@qikdev/vue-ui 0.3.6 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lib.umd.js CHANGED
@@ -23,6 +23,6 @@
23
23
  * @author RubaXa <trash@rubaxa.org>
24
24
  * @author owenm <owen23355@gmail.com>
25
25
  * @license MIT
26
- */function im(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function Xe(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?im(Object(r),!0).forEach(function(i){AV(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):im(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function Lr(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Lr=function(n){return typeof n}:Lr=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Lr(e)}function AV(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function it(){return it=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},it.apply(this,arguments)}function LV(e,n){if(e==null)return{};var r={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(n.indexOf(s)>=0)&&(r[s]=e[s]);return r}function $V(e,n){if(e==null)return{};var r=LV(e,n),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}var PV="1.14.0";function st(e){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(e)}var lt=st(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Ln=st(/Edge/i),sm=st(/firefox/i),$n=st(/safari/i)&&!st(/chrome/i)&&!st(/android/i),lm=st(/iP(ad|od|hone)/i),RV=st(/chrome/i)&&st(/android/i),am={capture:!1,passive:!1};function X(e,n,r){e.addEventListener(n,r,!lt&&am)}function J(e,n,r){e.removeEventListener(n,r,!lt&&am)}function $r(e,n){if(n){if(n[0]===">"&&(n=n.substring(1)),e)try{if(e.matches)return e.matches(n);if(e.msMatchesSelector)return e.msMatchesSelector(n);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(n)}catch{return!1}return!1}}function UV(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function Qe(e,n,r,i){if(e){r=r||document;do{if(n!=null&&(n[0]===">"?e.parentNode===r&&$r(e,n):$r(e,n))||i&&e===r)return e;if(e===r)break}while(e=UV(e))}return null}var cm=/\s+/g;function Oe(e,n,r){if(e&&n)if(e.classList)e.classList[r?"add":"remove"](n);else{var i=(" "+e.className+" ").replace(cm," ").replace(" "+n+" "," ");e.className=(i+(r?" "+n:"")).replace(cm," ")}}function $(e,n,r){var i=e&&e.style;if(i){if(r===void 0)return document.defaultView&&document.defaultView.getComputedStyle?r=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(r=e.currentStyle),n===void 0?r:r[n];!(n in i)&&n.indexOf("webkit")===-1&&(n="-webkit-"+n),i[n]=r+(typeof r=="string"?"":"px")}}function cn(e,n){var r="";if(typeof e=="string")r=e;else do{var i=$(e,"transform");i&&i!=="none"&&(r=i+" "+r)}while(!n&&(e=e.parentNode));var s=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return s&&new s(r)}function dm(e,n,r){if(e){var i=e.getElementsByTagName(n),s=0,o=i.length;if(r)for(;s<o;s++)r(i[s],s);return i}return[]}function ve(){var e=document.scrollingElement;return e||document.documentElement}function ge(e,n,r,i,s){if(!(!e.getBoundingClientRect&&e!==window)){var o,l,a,c,d,u,m;if(e!==window&&e.parentNode&&e!==ve()?(o=e.getBoundingClientRect(),l=o.top,a=o.left,c=o.bottom,d=o.right,u=o.height,m=o.width):(l=0,a=0,c=window.innerHeight,d=window.innerWidth,u=window.innerHeight,m=window.innerWidth),(n||r)&&e!==window&&(s=s||e.parentNode,!lt))do if(s&&s.getBoundingClientRect&&($(s,"transform")!=="none"||r&&$(s,"position")!=="static")){var f=s.getBoundingClientRect();l-=f.top+parseInt($(s,"border-top-width")),a-=f.left+parseInt($(s,"border-left-width")),c=l+o.height,d=a+o.width;break}while(s=s.parentNode);if(i&&e!==window){var h=cn(s||e),y=h&&h.a,p=h&&h.d;h&&(l/=p,a/=y,m/=y,u/=p,c=l+u,d=a+m)}return{top:l,left:a,bottom:c,right:d,width:m,height:u}}}function um(e,n,r){for(var i=wt(e,!0),s=ge(e)[n];i;){var o=ge(i)[r],l=void 0;if(l=s>=o,!l)return i;if(i===ve())break;i=wt(i,!1)}return!1}function dn(e,n,r,i){for(var s=0,o=0,l=e.children;o<l.length;){if(l[o].style.display!=="none"&&l[o]!==P.ghost&&(i||l[o]!==P.dragged)&&Qe(l[o],r.draggable,e,!1)){if(s===n)return l[o];s++}o++}return null}function us(e,n){for(var r=e.lastElementChild;r&&(r===P.ghost||$(r,"display")==="none"||n&&!$r(r,n));)r=r.previousElementSibling;return r||null}function Pe(e,n){var r=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)e.nodeName.toUpperCase()!=="TEMPLATE"&&e!==P.clone&&(!n||$r(e,n))&&r++;return r}function mm(e){var n=0,r=0,i=ve();if(e)do{var s=cn(e),o=s.a,l=s.d;n+=e.scrollLeft*o,r+=e.scrollTop*l}while(e!==i&&(e=e.parentNode));return[n,r]}function jV(e,n){for(var r in e)if(e.hasOwnProperty(r)){for(var i in n)if(n.hasOwnProperty(i)&&n[i]===e[r][i])return Number(r)}return-1}function wt(e,n){if(!e||!e.getBoundingClientRect)return ve();var r=e,i=!1;do if(r.clientWidth<r.scrollWidth||r.clientHeight<r.scrollHeight){var s=$(r);if(r.clientWidth<r.scrollWidth&&(s.overflowX=="auto"||s.overflowX=="scroll")||r.clientHeight<r.scrollHeight&&(s.overflowY=="auto"||s.overflowY=="scroll")){if(!r.getBoundingClientRect||r===document.body)return ve();if(i||n)return r;i=!0}}while(r=r.parentNode);return ve()}function qV(e,n){if(e&&n)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r]);return e}function ms(e,n){return Math.round(e.top)===Math.round(n.top)&&Math.round(e.left)===Math.round(n.left)&&Math.round(e.height)===Math.round(n.height)&&Math.round(e.width)===Math.round(n.width)}var Pn;function fm(e,n){return function(){if(!Pn){var r=arguments,i=this;r.length===1?e.call(i,r[0]):e.apply(i,r),Pn=setTimeout(function(){Pn=void 0},n)}}}function zV(){clearTimeout(Pn),Pn=void 0}function hm(e,n,r){e.scrollLeft+=n,e.scrollTop+=r}function pm(e){var n=window.Polymer,r=window.jQuery||window.Zepto;return n&&n.dom?n.dom(e).cloneNode(!0):r?r(e).clone(!0)[0]:e.cloneNode(!0)}var Me="Sortable"+new Date().getTime();function WV(){var e=[],n;return{captureAnimationState:function(){if(e=[],!!this.options.animation){var i=[].slice.call(this.el.children);i.forEach(function(s){if(!($(s,"display")==="none"||s===P.ghost)){e.push({target:s,rect:ge(s)});var o=Xe({},e[e.length-1].rect);if(s.thisAnimationDuration){var l=cn(s,!0);l&&(o.top-=l.f,o.left-=l.e)}s.fromRect=o}})}},addAnimationState:function(i){e.push(i)},removeAnimationState:function(i){e.splice(jV(e,{target:i}),1)},animateAll:function(i){var s=this;if(!this.options.animation){clearTimeout(n),typeof i=="function"&&i();return}var o=!1,l=0;e.forEach(function(a){var c=0,d=a.target,u=d.fromRect,m=ge(d),f=d.prevFromRect,h=d.prevToRect,y=a.rect,p=cn(d,!0);p&&(m.top-=p.f,m.left-=p.e),d.toRect=m,d.thisAnimationDuration&&ms(f,m)&&!ms(u,m)&&(y.top-m.top)/(y.left-m.left)===(u.top-m.top)/(u.left-m.left)&&(c=GV(y,f,h,s.options)),ms(m,u)||(d.prevFromRect=u,d.prevToRect=m,c||(c=s.options.animation),s.animate(d,y,m,c)),c&&(o=!0,l=Math.max(l,c),clearTimeout(d.animationResetTimer),d.animationResetTimer=setTimeout(function(){d.animationTime=0,d.prevFromRect=null,d.fromRect=null,d.prevToRect=null,d.thisAnimationDuration=null},c),d.thisAnimationDuration=c)}),clearTimeout(n),o?n=setTimeout(function(){typeof i=="function"&&i()},l):typeof i=="function"&&i(),e=[]},animate:function(i,s,o,l){if(l){$(i,"transition",""),$(i,"transform","");var a=cn(this.el),c=a&&a.a,d=a&&a.d,u=(s.left-o.left)/(c||1),m=(s.top-o.top)/(d||1);i.animatingX=!!u,i.animatingY=!!m,$(i,"transform","translate3d("+u+"px,"+m+"px,0)"),this.forRepaintDummy=HV(i),$(i,"transition","transform "+l+"ms"+(this.options.easing?" "+this.options.easing:"")),$(i,"transform","translate3d(0,0,0)"),typeof i.animated=="number"&&clearTimeout(i.animated),i.animated=setTimeout(function(){$(i,"transition",""),$(i,"transform",""),i.animated=!1,i.animatingX=!1,i.animatingY=!1},l)}}}}function HV(e){return e.offsetWidth}function GV(e,n,r,i){return Math.sqrt(Math.pow(n.top-e.top,2)+Math.pow(n.left-e.left,2))/Math.sqrt(Math.pow(n.top-r.top,2)+Math.pow(n.left-r.left,2))*i.animation}var un=[],fs={initializeByDefault:!0},Rn={mount:function(n){for(var r in fs)fs.hasOwnProperty(r)&&!(r in n)&&(n[r]=fs[r]);un.forEach(function(i){if(i.pluginName===n.pluginName)throw"Sortable: Cannot mount plugin ".concat(n.pluginName," more than once")}),un.push(n)},pluginEvent:function(n,r,i){var s=this;this.eventCanceled=!1,i.cancel=function(){s.eventCanceled=!0};var o=n+"Global";un.forEach(function(l){r[l.pluginName]&&(r[l.pluginName][o]&&r[l.pluginName][o](Xe({sortable:r},i)),r.options[l.pluginName]&&r[l.pluginName][n]&&r[l.pluginName][n](Xe({sortable:r},i)))})},initializePlugins:function(n,r,i,s){un.forEach(function(a){var c=a.pluginName;if(!(!n.options[c]&&!a.initializeByDefault)){var d=new a(n,r,n.options);d.sortable=n,d.options=n.options,n[c]=d,it(i,d.defaults)}});for(var o in n.options)if(n.options.hasOwnProperty(o)){var l=this.modifyOption(n,o,n.options[o]);typeof l<"u"&&(n.options[o]=l)}},getEventProperties:function(n,r){var i={};return un.forEach(function(s){typeof s.eventProperties=="function"&&it(i,s.eventProperties.call(r[s.pluginName],n))}),i},modifyOption:function(n,r,i){var s;return un.forEach(function(o){n[o.pluginName]&&o.optionListeners&&typeof o.optionListeners[r]=="function"&&(s=o.optionListeners[r].call(n[o.pluginName],i))}),s}};function YV(e){var n=e.sortable,r=e.rootEl,i=e.name,s=e.targetEl,o=e.cloneEl,l=e.toEl,a=e.fromEl,c=e.oldIndex,d=e.newIndex,u=e.oldDraggableIndex,m=e.newDraggableIndex,f=e.originalEvent,h=e.putSortable,y=e.extraEventProperties;if(n=n||r&&r[Me],!!n){var p,g=n.options,k="on"+i.charAt(0).toUpperCase()+i.substr(1);window.CustomEvent&&!lt&&!Ln?p=new CustomEvent(i,{bubbles:!0,cancelable:!0}):(p=document.createEvent("Event"),p.initEvent(i,!0,!0)),p.to=l||r,p.from=a||r,p.item=s||r,p.clone=o,p.oldIndex=c,p.newIndex=d,p.oldDraggableIndex=u,p.newDraggableIndex=m,p.originalEvent=f,p.pullMode=h?h.lastPutMode:void 0;var x=Xe(Xe({},y),Rn.getEventProperties(i,n));for(var S in x)p[S]=x[S];r&&r.dispatchEvent(p),g[k]&&g[k].call(n,p)}}var JV=["evt"],Te=function(n,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=i.evt,o=$V(i,JV);Rn.pluginEvent.bind(P)(n,r,Xe({dragEl:B,parentEl:de,ghostEl:U,rootEl:ie,nextEl:Gt,lastDownEl:Pr,cloneEl:ue,cloneHidden:xt,dragStarted:jn,putSortable:_e,activeSortable:P.active,originalEvent:s,oldIndex:mn,oldDraggableIndex:Un,newIndex:Fe,newDraggableIndex:bt,hideGhostForTarget:bm,unhideGhostForTarget:Cm,cloneNowHidden:function(){xt=!0},cloneNowShown:function(){xt=!1},dispatchSortableEvent:function(a){Ve({sortable:r,name:a,originalEvent:s})}},o))};function Ve(e){YV(Xe({putSortable:_e,cloneEl:ue,targetEl:B,rootEl:ie,oldIndex:mn,oldDraggableIndex:Un,newIndex:Fe,newDraggableIndex:bt},e))}var B,de,U,ie,Gt,Pr,ue,xt,mn,Fe,Un,bt,Rr,_e,fn=!1,Ur=!1,jr=[],Yt,Ge,hs,ps,ym,gm,jn,hn,qn,zn=!1,qr=!1,zr,be,ys=[],gs=!1,Wr=[],Hr=typeof document<"u",Gr=lm,km=Ln||lt?"cssFloat":"float",KV=Hr&&!RV&&!lm&&"draggable"in document.createElement("div"),_m=function(){if(Hr){if(lt)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto",e.style.pointerEvents==="auto"}}(),wm=function(n,r){var i=$(n),s=parseInt(i.width)-parseInt(i.paddingLeft)-parseInt(i.paddingRight)-parseInt(i.borderLeftWidth)-parseInt(i.borderRightWidth),o=dn(n,0,r),l=dn(n,1,r),a=o&&$(o),c=l&&$(l),d=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+ge(o).width,u=c&&parseInt(c.marginLeft)+parseInt(c.marginRight)+ge(l).width;if(i.display==="flex")return i.flexDirection==="column"||i.flexDirection==="column-reverse"?"vertical":"horizontal";if(i.display==="grid")return i.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&a.float&&a.float!=="none"){var m=a.float==="left"?"left":"right";return l&&(c.clear==="both"||c.clear===m)?"vertical":"horizontal"}return o&&(a.display==="block"||a.display==="flex"||a.display==="table"||a.display==="grid"||d>=s&&i[km]==="none"||l&&i[km]==="none"&&d+u>s)?"vertical":"horizontal"},ZV=function(n,r,i){var s=i?n.left:n.top,o=i?n.right:n.bottom,l=i?n.width:n.height,a=i?r.left:r.top,c=i?r.right:r.bottom,d=i?r.width:r.height;return s===a||o===c||s+l/2===a+d/2},XV=function(n,r){var i;return jr.some(function(s){var o=s[Me].options.emptyInsertThreshold;if(!(!o||us(s))){var l=ge(s),a=n>=l.left-o&&n<=l.right+o,c=r>=l.top-o&&r<=l.bottom+o;if(a&&c)return i=s}}),i},xm=function(n){function r(o,l){return function(a,c,d,u){var m=a.options.group.name&&c.options.group.name&&a.options.group.name===c.options.group.name;if(o==null&&(l||m))return!0;if(o==null||o===!1)return!1;if(l&&o==="clone")return o;if(typeof o=="function")return r(o(a,c,d,u),l)(a,c,d,u);var f=(l?a:c).options.group.name;return o===!0||typeof o=="string"&&o===f||o.join&&o.indexOf(f)>-1}}var i={},s=n.group;(!s||Lr(s)!="object")&&(s={name:s}),i.name=s.name,i.checkPull=r(s.pull,!0),i.checkPut=r(s.put),i.revertClone=s.revertClone,n.group=i},bm=function(){!_m&&U&&$(U,"display","none")},Cm=function(){!_m&&U&&$(U,"display","")};Hr&&document.addEventListener("click",function(e){if(Ur)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Ur=!1,!1},!0);var Jt=function(n){if(B){n=n.touches?n.touches[0]:n;var r=XV(n.clientX,n.clientY);if(r){var i={};for(var s in n)n.hasOwnProperty(s)&&(i[s]=n[s]);i.target=i.rootEl=r,i.preventDefault=void 0,i.stopPropagation=void 0,r[Me]._onDragOver(i)}}},QV=function(n){B&&B.parentNode[Me]._isOutsideThisEl(n.target)};function P(e,n){if(!(e&&e.nodeType&&e.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=n=it({},n),e[Me]=this;var r={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return wm(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(l,a){l.setData("Text",a.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:P.supportPointer!==!1&&"PointerEvent"in window&&!$n,emptyInsertThreshold:5};Rn.initializePlugins(this,e,r);for(var i in r)!(i in n)&&(n[i]=r[i]);xm(n);for(var s in this)s.charAt(0)==="_"&&typeof this[s]=="function"&&(this[s]=this[s].bind(this));this.nativeDraggable=n.forceFallback?!1:KV,this.nativeDraggable&&(this.options.touchStartThreshold=1),n.supportPointer?X(e,"pointerdown",this._onTapStart):(X(e,"mousedown",this._onTapStart),X(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(X(e,"dragover",this),X(e,"dragenter",this)),jr.push(this.el),n.store&&n.store.get&&this.sort(n.store.get(this)||[]),it(this,WV())}P.prototype={constructor:P,_isOutsideThisEl:function(n){!this.el.contains(n)&&n!==this.el&&(hn=null)},_getDirection:function(n,r){return typeof this.options.direction=="function"?this.options.direction.call(this,n,r,B):this.options.direction},_onTapStart:function(n){if(n.cancelable){var r=this,i=this.el,s=this.options,o=s.preventOnFilter,l=n.type,a=n.touches&&n.touches[0]||n.pointerType&&n.pointerType==="touch"&&n,c=(a||n).target,d=n.target.shadowRoot&&(n.path&&n.path[0]||n.composedPath&&n.composedPath()[0])||c,u=s.filter;if(sN(i),!B&&!(/mousedown|pointerdown/.test(l)&&n.button!==0||s.disabled)&&!d.isContentEditable&&!(!this.nativeDraggable&&$n&&c&&c.tagName.toUpperCase()==="SELECT")&&(c=Qe(c,s.draggable,i,!1),!(c&&c.animated)&&Pr!==c)){if(mn=Pe(c),Un=Pe(c,s.draggable),typeof u=="function"){if(u.call(this,n,c,this)){Ve({sortable:r,rootEl:d,name:"filter",targetEl:c,toEl:i,fromEl:i}),Te("filter",r,{evt:n}),o&&n.cancelable&&n.preventDefault();return}}else if(u&&(u=u.split(",").some(function(m){if(m=Qe(d,m.trim(),i,!1),m)return Ve({sortable:r,rootEl:m,name:"filter",targetEl:c,fromEl:i,toEl:i}),Te("filter",r,{evt:n}),!0}),u)){o&&n.cancelable&&n.preventDefault();return}s.handle&&!Qe(d,s.handle,i,!1)||this._prepareDragStart(n,a,c)}}},_prepareDragStart:function(n,r,i){var s=this,o=s.el,l=s.options,a=o.ownerDocument,c;if(i&&!B&&i.parentNode===o){var d=ge(i);if(ie=o,B=i,de=B.parentNode,Gt=B.nextSibling,Pr=i,Rr=l.group,P.dragged=B,Yt={target:B,clientX:(r||n).clientX,clientY:(r||n).clientY},ym=Yt.clientX-d.left,gm=Yt.clientY-d.top,this._lastX=(r||n).clientX,this._lastY=(r||n).clientY,B.style["will-change"]="all",c=function(){if(Te("delayEnded",s,{evt:n}),P.eventCanceled){s._onDrop();return}s._disableDelayedDragEvents(),!sm&&s.nativeDraggable&&(B.draggable=!0),s._triggerDragStart(n,r),Ve({sortable:s,name:"choose",originalEvent:n}),Oe(B,l.chosenClass,!0)},l.ignore.split(",").forEach(function(u){dm(B,u.trim(),ks)}),X(a,"dragover",Jt),X(a,"mousemove",Jt),X(a,"touchmove",Jt),X(a,"mouseup",s._onDrop),X(a,"touchend",s._onDrop),X(a,"touchcancel",s._onDrop),sm&&this.nativeDraggable&&(this.options.touchStartThreshold=4,B.draggable=!0),Te("delayStart",this,{evt:n}),l.delay&&(!l.delayOnTouchOnly||r)&&(!this.nativeDraggable||!(Ln||lt))){if(P.eventCanceled){this._onDrop();return}X(a,"mouseup",s._disableDelayedDrag),X(a,"touchend",s._disableDelayedDrag),X(a,"touchcancel",s._disableDelayedDrag),X(a,"mousemove",s._delayedDragTouchMoveHandler),X(a,"touchmove",s._delayedDragTouchMoveHandler),l.supportPointer&&X(a,"pointermove",s._delayedDragTouchMoveHandler),s._dragStartTimer=setTimeout(c,l.delay)}else c()}},_delayedDragTouchMoveHandler:function(n){var r=n.touches?n.touches[0]:n;Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){B&&ks(B),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var n=this.el.ownerDocument;J(n,"mouseup",this._disableDelayedDrag),J(n,"touchend",this._disableDelayedDrag),J(n,"touchcancel",this._disableDelayedDrag),J(n,"mousemove",this._delayedDragTouchMoveHandler),J(n,"touchmove",this._delayedDragTouchMoveHandler),J(n,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(n,r){r=r||n.pointerType=="touch"&&n,!this.nativeDraggable||r?this.options.supportPointer?X(document,"pointermove",this._onTouchMove):r?X(document,"touchmove",this._onTouchMove):X(document,"mousemove",this._onTouchMove):(X(B,"dragend",this),X(ie,"dragstart",this._onDragStart));try{document.selection?Jr(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(n,r){if(fn=!1,ie&&B){Te("dragStarted",this,{evt:r}),this.nativeDraggable&&X(document,"dragover",QV);var i=this.options;!n&&Oe(B,i.dragClass,!1),Oe(B,i.ghostClass,!0),P.active=this,n&&this._appendGhost(),Ve({sortable:this,name:"start",originalEvent:r})}else this._nulling()},_emulateDragOver:function(){if(Ge){this._lastX=Ge.clientX,this._lastY=Ge.clientY,bm();for(var n=document.elementFromPoint(Ge.clientX,Ge.clientY),r=n;n&&n.shadowRoot&&(n=n.shadowRoot.elementFromPoint(Ge.clientX,Ge.clientY),n!==r);)r=n;if(B.parentNode[Me]._isOutsideThisEl(n),r)do{if(r[Me]){var i=void 0;if(i=r[Me]._onDragOver({clientX:Ge.clientX,clientY:Ge.clientY,target:n,rootEl:r}),i&&!this.options.dragoverBubble)break}n=r}while(r=r.parentNode);Cm()}},_onTouchMove:function(n){if(Yt){var r=this.options,i=r.fallbackTolerance,s=r.fallbackOffset,o=n.touches?n.touches[0]:n,l=U&&cn(U,!0),a=U&&l&&l.a,c=U&&l&&l.d,d=Gr&&be&&mm(be),u=(o.clientX-Yt.clientX+s.x)/(a||1)+(d?d[0]-ys[0]:0)/(a||1),m=(o.clientY-Yt.clientY+s.y)/(c||1)+(d?d[1]-ys[1]:0)/(c||1);if(!P.active&&!fn){if(i&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))<i)return;this._onDragStart(n,!0)}if(U){l?(l.e+=u-(hs||0),l.f+=m-(ps||0)):l={a:1,b:0,c:0,d:1,e:u,f:m};var f="matrix(".concat(l.a,",").concat(l.b,",").concat(l.c,",").concat(l.d,",").concat(l.e,",").concat(l.f,")");$(U,"webkitTransform",f),$(U,"mozTransform",f),$(U,"msTransform",f),$(U,"transform",f),hs=u,ps=m,Ge=o}n.cancelable&&n.preventDefault()}},_appendGhost:function(){if(!U){var n=this.options.fallbackOnBody?document.body:ie,r=ge(B,!0,Gr,!0,n),i=this.options;if(Gr){for(be=n;$(be,"position")==="static"&&$(be,"transform")==="none"&&be!==document;)be=be.parentNode;be!==document.body&&be!==document.documentElement?(be===document&&(be=ve()),r.top+=be.scrollTop,r.left+=be.scrollLeft):be=ve(),ys=mm(be)}U=B.cloneNode(!0),Oe(U,i.ghostClass,!1),Oe(U,i.fallbackClass,!0),Oe(U,i.dragClass,!0),$(U,"transition",""),$(U,"transform",""),$(U,"box-sizing","border-box"),$(U,"margin",0),$(U,"top",r.top),$(U,"left",r.left),$(U,"width",r.width),$(U,"height",r.height),$(U,"opacity","0.8"),$(U,"position",Gr?"absolute":"fixed"),$(U,"zIndex","100000"),$(U,"pointerEvents","none"),P.ghost=U,n.appendChild(U),$(U,"transform-origin",ym/parseInt(U.style.width)*100+"% "+gm/parseInt(U.style.height)*100+"%")}},_onDragStart:function(n,r){var i=this,s=n.dataTransfer,o=i.options;if(Te("dragStart",this,{evt:n}),P.eventCanceled){this._onDrop();return}Te("setupClone",this),P.eventCanceled||(ue=pm(B),ue.draggable=!1,ue.style["will-change"]="",this._hideClone(),Oe(ue,this.options.chosenClass,!1),P.clone=ue),i.cloneId=Jr(function(){Te("clone",i),!P.eventCanceled&&(i.options.removeCloneOnHide||ie.insertBefore(ue,B),i._hideClone(),Ve({sortable:i,name:"clone"}))}),!r&&Oe(B,o.dragClass,!0),r?(Ur=!0,i._loopId=setInterval(i._emulateDragOver,50)):(J(document,"mouseup",i._onDrop),J(document,"touchend",i._onDrop),J(document,"touchcancel",i._onDrop),s&&(s.effectAllowed="move",o.setData&&o.setData.call(i,s,B)),X(document,"drop",i),$(B,"transform","translateZ(0)")),fn=!0,i._dragStartId=Jr(i._dragStarted.bind(i,r,n)),X(document,"selectstart",i),jn=!0,$n&&$(document.body,"user-select","none")},_onDragOver:function(n){var r=this.el,i=n.target,s,o,l,a=this.options,c=a.group,d=P.active,u=Rr===c,m=a.sort,f=_e||d,h,y=this,p=!1;if(gs)return;function g(Re,Bt){Te(Re,y,Xe({evt:n,isOwner:u,axis:h?"vertical":"horizontal",revert:l,dragRect:s,targetRect:o,canSort:m,fromSortable:f,target:i,completed:x,onMove:function(Ue,at){return Yr(ie,r,B,s,Ue,ge(Ue),n,at)},changed:S},Bt))}function k(){g("dragOverAnimationCapture"),y.captureAnimationState(),y!==f&&f.captureAnimationState()}function x(Re){return g("dragOverCompleted",{insertion:Re}),Re&&(u?d._hideClone():d._showClone(y),y!==f&&(Oe(B,_e?_e.options.ghostClass:d.options.ghostClass,!1),Oe(B,a.ghostClass,!0)),_e!==y&&y!==P.active?_e=y:y===P.active&&_e&&(_e=null),f===y&&(y._ignoreWhileAnimating=i),y.animateAll(function(){g("dragOverAnimationComplete"),y._ignoreWhileAnimating=null}),y!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(i===B&&!B.animated||i===r&&!i.animated)&&(hn=null),!a.dragoverBubble&&!n.rootEl&&i!==document&&(B.parentNode[Me]._isOutsideThisEl(n.target),!Re&&Jt(n)),!a.dragoverBubble&&n.stopPropagation&&n.stopPropagation(),p=!0}function S(){Fe=Pe(B),bt=Pe(B,a.draggable),Ve({sortable:y,name:"change",toEl:r,newIndex:Fe,newDraggableIndex:bt,originalEvent:n})}if(n.preventDefault!==void 0&&n.cancelable&&n.preventDefault(),i=Qe(i,a.draggable,r,!0),g("dragOver"),P.eventCanceled)return p;if(B.contains(n.target)||i.animated&&i.animatingX&&i.animatingY||y._ignoreWhileAnimating===i)return x(!1);if(Ur=!1,d&&!a.disabled&&(u?m||(l=de!==ie):_e===this||(this.lastPutMode=Rr.checkPull(this,d,B,n))&&c.checkPut(this,d,B,n))){if(h=this._getDirection(n,i)==="vertical",s=ge(B),g("dragOverValid"),P.eventCanceled)return p;if(l)return de=ie,k(),this._hideClone(),g("revert"),P.eventCanceled||(Gt?ie.insertBefore(B,Gt):ie.appendChild(B)),x(!0);var A=us(r,a.draggable);if(!A||nN(n,h,this)&&!A.animated){if(A===B)return x(!1);if(A&&r===n.target&&(i=A),i&&(o=ge(i)),Yr(ie,r,B,s,i,o,n,!!i)!==!1)return k(),r.appendChild(B),de=r,S(),x(!0)}else if(A&&tN(n,h,this)){var R=dn(r,0,a,!0);if(R===B)return x(!1);if(i=R,o=ge(i),Yr(ie,r,B,s,i,o,n,!1)!==!1)return k(),r.insertBefore(B,R),de=r,S(),x(!0)}else if(i.parentNode===r){o=ge(i);var C=0,D,I=B.parentNode!==r,M=!ZV(B.animated&&B.toRect||s,i.animated&&i.toRect||o,h),j=h?"top":"left",L=um(i,"top","top")||um(B,"top","top"),te=L?L.scrollTop:void 0;hn!==i&&(D=o[j],zn=!1,qr=!M&&a.invertSwap||I),C=rN(n,i,o,h,M?1:a.swapThreshold,a.invertedSwapThreshold==null?a.swapThreshold:a.invertedSwapThreshold,qr,hn===i);var q;if(C!==0){var v=Pe(B);do v-=C,q=de.children[v];while(q&&($(q,"display")==="none"||q===U))}if(C===0||q===i)return x(!1);hn=i,qn=C;var ae=i.nextElementSibling,me=!1;me=C===1;var Ye=Yr(ie,r,B,s,i,o,n,me);if(Ye!==!1)return(Ye===1||Ye===-1)&&(me=Ye===1),gs=!0,setTimeout(eN,30),k(),me&&!ae?r.appendChild(B):i.parentNode.insertBefore(B,me?ae:i),L&&hm(L,0,te-L.scrollTop),de=B.parentNode,D!==void 0&&!qr&&(zr=Math.abs(D-ge(i)[j])),S(),x(!0)}if(r.contains(B))return x(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){J(document,"mousemove",this._onTouchMove),J(document,"touchmove",this._onTouchMove),J(document,"pointermove",this._onTouchMove),J(document,"dragover",Jt),J(document,"mousemove",Jt),J(document,"touchmove",Jt)},_offUpEvents:function(){var n=this.el.ownerDocument;J(n,"mouseup",this._onDrop),J(n,"touchend",this._onDrop),J(n,"pointerup",this._onDrop),J(n,"touchcancel",this._onDrop),J(document,"selectstart",this)},_onDrop:function(n){var r=this.el,i=this.options;if(Fe=Pe(B),bt=Pe(B,i.draggable),Te("drop",this,{evt:n}),de=B&&B.parentNode,Fe=Pe(B),bt=Pe(B,i.draggable),P.eventCanceled){this._nulling();return}fn=!1,qr=!1,zn=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),_s(this.cloneId),_s(this._dragStartId),this.nativeDraggable&&(J(document,"drop",this),J(r,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),$n&&$(document.body,"user-select",""),$(B,"transform",""),n&&(jn&&(n.cancelable&&n.preventDefault(),!i.dropBubble&&n.stopPropagation()),U&&U.parentNode&&U.parentNode.removeChild(U),(ie===de||_e&&_e.lastPutMode!=="clone")&&ue&&ue.parentNode&&ue.parentNode.removeChild(ue),B&&(this.nativeDraggable&&J(B,"dragend",this),ks(B),B.style["will-change"]="",jn&&!fn&&Oe(B,_e?_e.options.ghostClass:this.options.ghostClass,!1),Oe(B,this.options.chosenClass,!1),Ve({sortable:this,name:"unchoose",toEl:de,newIndex:null,newDraggableIndex:null,originalEvent:n}),ie!==de?(Fe>=0&&(Ve({rootEl:de,name:"add",toEl:de,fromEl:ie,originalEvent:n}),Ve({sortable:this,name:"remove",toEl:de,originalEvent:n}),Ve({rootEl:de,name:"sort",toEl:de,fromEl:ie,originalEvent:n}),Ve({sortable:this,name:"sort",toEl:de,originalEvent:n})),_e&&_e.save()):Fe!==mn&&Fe>=0&&(Ve({sortable:this,name:"update",toEl:de,originalEvent:n}),Ve({sortable:this,name:"sort",toEl:de,originalEvent:n})),P.active&&((Fe==null||Fe===-1)&&(Fe=mn,bt=Un),Ve({sortable:this,name:"end",toEl:de,originalEvent:n}),this.save()))),this._nulling()},_nulling:function(){Te("nulling",this),ie=B=de=U=Gt=ue=Pr=xt=Yt=Ge=jn=Fe=bt=mn=Un=hn=qn=_e=Rr=P.dragged=P.ghost=P.clone=P.active=null,Wr.forEach(function(n){n.checked=!0}),Wr.length=hs=ps=0},handleEvent:function(n){switch(n.type){case"drop":case"dragend":this._onDrop(n);break;case"dragenter":case"dragover":B&&(this._onDragOver(n),vV(n));break;case"selectstart":n.preventDefault();break}},toArray:function(){for(var n=[],r,i=this.el.children,s=0,o=i.length,l=this.options;s<o;s++)r=i[s],Qe(r,l.draggable,this.el,!1)&&n.push(r.getAttribute(l.dataIdAttr)||iN(r));return n},sort:function(n,r){var i={},s=this.el;this.toArray().forEach(function(o,l){var a=s.children[l];Qe(a,this.options.draggable,s,!1)&&(i[o]=a)},this),r&&this.captureAnimationState(),n.forEach(function(o){i[o]&&(s.removeChild(i[o]),s.appendChild(i[o]))}),r&&this.animateAll()},save:function(){var n=this.options.store;n&&n.set&&n.set(this)},closest:function(n,r){return Qe(n,r||this.options.draggable,this.el,!1)},option:function(n,r){var i=this.options;if(r===void 0)return i[n];var s=Rn.modifyOption(this,n,r);typeof s<"u"?i[n]=s:i[n]=r,n==="group"&&xm(i)},destroy:function(){Te("destroy",this);var n=this.el;n[Me]=null,J(n,"mousedown",this._onTapStart),J(n,"touchstart",this._onTapStart),J(n,"pointerdown",this._onTapStart),this.nativeDraggable&&(J(n,"dragover",this),J(n,"dragenter",this)),Array.prototype.forEach.call(n.querySelectorAll("[draggable]"),function(r){r.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),jr.splice(jr.indexOf(this.el),1),this.el=n=null},_hideClone:function(){if(!xt){if(Te("hideClone",this),P.eventCanceled)return;$(ue,"display","none"),this.options.removeCloneOnHide&&ue.parentNode&&ue.parentNode.removeChild(ue),xt=!0}},_showClone:function(n){if(n.lastPutMode!=="clone"){this._hideClone();return}if(xt){if(Te("showClone",this),P.eventCanceled)return;B.parentNode==ie&&!this.options.group.revertClone?ie.insertBefore(ue,B):Gt?ie.insertBefore(ue,Gt):ie.appendChild(ue),this.options.group.revertClone&&this.animate(B,ue),$(ue,"display",""),xt=!1}}};function vV(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move"),e.cancelable&&e.preventDefault()}function Yr(e,n,r,i,s,o,l,a){var c,d=e[Me],u=d.options.onMove,m;return window.CustomEvent&&!lt&&!Ln?c=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(c=document.createEvent("Event"),c.initEvent("move",!0,!0)),c.to=n,c.from=e,c.dragged=r,c.draggedRect=i,c.related=s||n,c.relatedRect=o||ge(n),c.willInsertAfter=a,c.originalEvent=l,e.dispatchEvent(c),u&&(m=u.call(d,c,l)),m}function ks(e){e.draggable=!1}function eN(){gs=!1}function tN(e,n,r){var i=ge(dn(r.el,0,r.options,!0)),s=10;return n?e.clientX<i.left-s||e.clientY<i.top&&e.clientX<i.right:e.clientY<i.top-s||e.clientY<i.bottom&&e.clientX<i.left}function nN(e,n,r){var i=ge(us(r.el,r.options.draggable)),s=10;return n?e.clientX>i.right+s||e.clientX<=i.right&&e.clientY>i.bottom&&e.clientX>=i.left:e.clientX>i.right&&e.clientY>i.top||e.clientX<=i.right&&e.clientY>i.bottom+s}function rN(e,n,r,i,s,o,l,a){var c=i?e.clientY:e.clientX,d=i?r.height:r.width,u=i?r.top:r.left,m=i?r.bottom:r.right,f=!1;if(!l){if(a&&zr<d*s){if(!zn&&(qn===1?c>u+d*o/2:c<m-d*o/2)&&(zn=!0),zn)f=!0;else if(qn===1?c<u+zr:c>m-zr)return-qn}else if(c>u+d*(1-s)/2&&c<m-d*(1-s)/2)return oN(n)}return f=f||l,f&&(c<u+d*o/2||c>m-d*o/2)?c>u+d/2?1:-1:0}function oN(e){return Pe(B)<Pe(e)?1:-1}function iN(e){for(var n=e.tagName+e.className+e.src+e.href+e.textContent,r=n.length,i=0;r--;)i+=n.charCodeAt(r);return i.toString(36)}function sN(e){Wr.length=0;for(var n=e.getElementsByTagName("input"),r=n.length;r--;){var i=n[r];i.checked&&Wr.push(i)}}function Jr(e){return setTimeout(e,0)}function _s(e){return clearTimeout(e)}Hr&&X(document,"touchmove",function(e){(P.active||fn)&&e.cancelable&&e.preventDefault()}),P.utils={on:X,off:J,css:$,find:dm,is:function(n,r){return!!Qe(n,r,n,!1)},extend:qV,throttle:fm,closest:Qe,toggleClass:Oe,clone:pm,index:Pe,nextTick:Jr,cancelNextTick:_s,detectDirection:wm,getChild:dn},P.get=function(e){return e[Me]},P.mount=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];n[0].constructor===Array&&(n=n[0]),n.forEach(function(i){if(!i.prototype||!i.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(i));i.utils&&(P.utils=Xe(Xe({},P.utils),i.utils)),Rn.mount(i)})},P.create=function(e,n){return new P(e,n)},P.version=PV;var he=[],Wn,ws,xs=!1,bs,Cs,Kr,Hn;function lN(){function e(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var n in this)n.charAt(0)==="_"&&typeof this[n]=="function"&&(this[n]=this[n].bind(this))}return e.prototype={dragStarted:function(r){var i=r.originalEvent;this.sortable.nativeDraggable?X(document,"dragover",this._handleAutoScroll):this.options.supportPointer?X(document,"pointermove",this._handleFallbackAutoScroll):i.touches?X(document,"touchmove",this._handleFallbackAutoScroll):X(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(r){var i=r.originalEvent;!this.options.dragOverBubble&&!i.rootEl&&this._handleAutoScroll(i)},drop:function(){this.sortable.nativeDraggable?J(document,"dragover",this._handleAutoScroll):(J(document,"pointermove",this._handleFallbackAutoScroll),J(document,"touchmove",this._handleFallbackAutoScroll),J(document,"mousemove",this._handleFallbackAutoScroll)),Vm(),Zr(),zV()},nulling:function(){Kr=ws=Wn=xs=Hn=bs=Cs=null,he.length=0},_handleFallbackAutoScroll:function(r){this._handleAutoScroll(r,!0)},_handleAutoScroll:function(r,i){var s=this,o=(r.touches?r.touches[0]:r).clientX,l=(r.touches?r.touches[0]:r).clientY,a=document.elementFromPoint(o,l);if(Kr=r,i||this.options.forceAutoScrollFallback||Ln||lt||$n){Vs(r,this.options,a,i);var c=wt(a,!0);xs&&(!Hn||o!==bs||l!==Cs)&&(Hn&&Vm(),Hn=setInterval(function(){var d=wt(document.elementFromPoint(o,l),!0);d!==c&&(c=d,Zr()),Vs(r,s.options,d,i)},10),bs=o,Cs=l)}else{if(!this.options.bubbleScroll||wt(a,!0)===ve()){Zr();return}Vs(r,this.options,wt(a,!1),!1)}}},it(e,{pluginName:"scroll",initializeByDefault:!0})}function Zr(){he.forEach(function(e){clearInterval(e.pid)}),he=[]}function Vm(){clearInterval(Hn)}var Vs=fm(function(e,n,r,i){if(n.scroll){var s=(e.touches?e.touches[0]:e).clientX,o=(e.touches?e.touches[0]:e).clientY,l=n.scrollSensitivity,a=n.scrollSpeed,c=ve(),d=!1,u;ws!==r&&(ws=r,Zr(),Wn=n.scroll,u=n.scrollFn,Wn===!0&&(Wn=wt(r,!0)));var m=0,f=Wn;do{var h=f,y=ge(h),p=y.top,g=y.bottom,k=y.left,x=y.right,S=y.width,A=y.height,R=void 0,C=void 0,D=h.scrollWidth,I=h.scrollHeight,M=$(h),j=h.scrollLeft,L=h.scrollTop;h===c?(R=S<D&&(M.overflowX==="auto"||M.overflowX==="scroll"||M.overflowX==="visible"),C=A<I&&(M.overflowY==="auto"||M.overflowY==="scroll"||M.overflowY==="visible")):(R=S<D&&(M.overflowX==="auto"||M.overflowX==="scroll"),C=A<I&&(M.overflowY==="auto"||M.overflowY==="scroll"));var te=R&&(Math.abs(x-s)<=l&&j+S<D)-(Math.abs(k-s)<=l&&!!j),q=C&&(Math.abs(g-o)<=l&&L+A<I)-(Math.abs(p-o)<=l&&!!L);if(!he[m])for(var v=0;v<=m;v++)he[v]||(he[v]={});(he[m].vx!=te||he[m].vy!=q||he[m].el!==h)&&(he[m].el=h,he[m].vx=te,he[m].vy=q,clearInterval(he[m].pid),(te!=0||q!=0)&&(d=!0,he[m].pid=setInterval((function(){i&&this.layer===0&&P.active._onTouchMove(Kr);var ae=he[this.layer].vy?he[this.layer].vy*a:0,me=he[this.layer].vx?he[this.layer].vx*a:0;typeof u=="function"&&u.call(P.dragged.parentNode[Me],me,ae,e,Kr,he[this.layer].el)!=="continue"||hm(he[this.layer].el,me,ae)}).bind({layer:m}),24))),m++}while(n.bubbleScroll&&f!==c&&(f=wt(f,!1)));xs=d}},30),Nm=function(n){var r=n.originalEvent,i=n.putSortable,s=n.dragEl,o=n.activeSortable,l=n.dispatchSortableEvent,a=n.hideGhostForTarget,c=n.unhideGhostForTarget;if(r){var d=i||o;a();var u=r.changedTouches&&r.changedTouches.length?r.changedTouches[0]:r,m=document.elementFromPoint(u.clientX,u.clientY);c(),d&&!d.el.contains(m)&&(l("spill"),this.onSpill({dragEl:s,putSortable:i}))}};function Ns(){}Ns.prototype={startIndex:null,dragStart:function(n){var r=n.oldDraggableIndex;this.startIndex=r},onSpill:function(n){var r=n.dragEl,i=n.putSortable;this.sortable.captureAnimationState(),i&&i.captureAnimationState();var s=dn(this.sortable.el,this.startIndex,this.options);s?this.sortable.el.insertBefore(r,s):this.sortable.el.appendChild(r),this.sortable.animateAll(),i&&i.animateAll()},drop:Nm},it(Ns,{pluginName:"revertOnSpill"});function Es(){}Es.prototype={onSpill:function(n){var r=n.dragEl,i=n.putSortable,s=i||this.sortable;s.captureAnimationState(),r.parentNode&&r.parentNode.removeChild(r),s.animateAll()},drop:Nm},it(Es,{pluginName:"removeOnSpill"}),P.mount(new lN),P.mount(Es,Ns);function Bs(e){e.parentElement!==null&&e.parentElement.removeChild(e)}function Em(e,n,r){const i=r===0?e.children[0]:e.children[r-1].nextSibling;e.insertBefore(n,i)}function aN(){return typeof window<"u"?window.console:global.console}const cN=aN();function dN(e){const n=Object.create(null);return function(i){return n[i]||(n[i]=e(i))}}const uN=/-(\w)/g,mN=dN(e=>e.replace(uN,(n,r)=>r.toUpperCase())),Bm=["Start","Add","Remove","Update","End"],Sm=["Choose","Unchoose","Sort","Filter","Clone"],Tm=["Move"],fN=[Tm,Bm,Sm].flatMap(e=>e).map(e=>`on${e}`),Ss={manage:Tm,manageAndEmit:Bm,emit:Sm};function hN(e){return fN.indexOf(e)!==-1}const pN=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","math","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rb","rp","rt","rtc","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"];function yN(e){return pN.includes(e)}function gN(e){return["transition-group","TransitionGroup"].includes(e)}function Dm(e){return["id","class","role","style"].includes(e)||e.startsWith("data-")||e.startsWith("aria-")||e.startsWith("on")}function Om(e){return e.reduce((n,[r,i])=>(n[r]=i,n),{})}function kN({$attrs:e,componentData:n={}}){return{...Om(Object.entries(e).filter(([i,s])=>Dm(i))),...n}}function _N({$attrs:e,callBackBuilder:n}){const r=Om(Mm(e));Object.entries(n).forEach(([s,o])=>{Ss[s].forEach(l=>{r[`on${l}`]=o(l)})});const i=`[data-draggable]${r.draggable||""}`;return{...r,draggable:i}}function Mm(e){return Object.entries(e).filter(([n,r])=>!Dm(n)).map(([n,r])=>[mN(n),r]).filter(([n,r])=>!hN(n))}const Fm=({el:e})=>e,wN=(e,n)=>e.__draggable_context=n,Im=e=>e.__draggable_context;class xN{constructor({nodes:{header:n,default:r,footer:i},root:s,realList:o}){this.defaultNodes=r,this.children=[...n,...r,...i],this.externalComponent=s.externalComponent,this.rootTransition=s.transition,this.tag=s.tag,this.realList=o}get _isRootComponent(){return this.externalComponent||this.rootTransition}render(n,r){const{tag:i,children:s,_isRootComponent:o}=this;return n(i,r,o?{default:()=>s}:s)}updated(){const{defaultNodes:n,realList:r}=this;n.forEach((i,s)=>{wN(Fm(i),{element:r[s],index:s})})}getUnderlyingVm(n){return Im(n)}getVmIndexFromDomIndex(n,r){const{defaultNodes:i}=this,{length:s}=i,o=r.children,l=o.item(n);if(l===null)return s;const a=Im(l);if(a)return a.index;if(s===0)return 0;const c=Fm(i[0]),d=[...o].findIndex(u=>u===c);return n<d?0:s}}function bN(e,n){const r=e[n];return r?r():[]}function CN({$slots:e,realList:n,getKey:r}){const i=n||[],[s,o]=["header","footer"].map(c=>bN(e,c)),{item:l}=e;if(!l)throw new Error("draggable element must have an item slot");const a=i.flatMap((c,d)=>l({element:c,index:d}).map(u=>(u.key=r(c),u.props={...u.props||{},"data-draggable":!0},u)));if(a.length!==i.length)throw new Error("Item slot must have only one child");return{header:s,footer:o,default:a}}function VN(e){const n=gN(e),r=!yN(e)&&!n;return{transition:n,externalComponent:r,tag:r?t.resolveComponent(e):n?t.TransitionGroup:e}}function NN({$slots:e,tag:n,realList:r,getKey:i}){const s=CN({$slots:e,realList:r,getKey:i}),o=VN(n);return new xN({nodes:s,root:o,realList:r})}function Am(e,n){t.nextTick(()=>this.$emit(e.toLowerCase(),n))}function Lm(e){return(n,r)=>{if(this.realList!==null)return this[`onDrag${e}`](n,r)}}function EN(e){const n=Lm.call(this,e);return(r,i)=>{n.call(this,r,i),Am.call(this,e,r)}}let Ts=null;const BN={list:{type:Array,required:!1,default:null},modelValue:{type:Array,required:!1,default:null},itemKey:{type:[String,Function],required:!0},clone:{type:Function,default:e=>e},tag:{type:String,default:"div"},move:{type:Function,default:null},componentData:{type:Object,required:!1,default:null}},SN=["update:modelValue","change",...[...Ss.manageAndEmit,...Ss.emit].map(e=>e.toLowerCase())],Xr=t.defineComponent({name:"draggable",inheritAttrs:!1,props:BN,emits:SN,data(){return{error:!1}},render(){try{this.error=!1;const{$slots:e,$attrs:n,tag:r,componentData:i,realList:s,getKey:o}=this,l=NN({$slots:e,tag:r,realList:s,getKey:o});this.componentStructure=l;const a=kN({$attrs:n,componentData:i});return l.render(t.h,a)}catch(e){return this.error=!0,t.h("pre",{style:{color:"red"}},e.stack)}},created(){this.list!==null&&this.modelValue!==null&&cN.error("modelValue and list props are mutually exclusive! Please set one or another.")},mounted(){if(this.error)return;const{$attrs:e,$el:n,componentStructure:r}=this;r.updated();const i=_N({$attrs:e,callBackBuilder:{manageAndEmit:o=>EN.call(this,o),emit:o=>Am.bind(this,o),manage:o=>Lm.call(this,o)}}),s=n.nodeType===1?n:n.parentElement;this._sortable=new P(s,i),this.targetDomElement=s,s.__draggable_component__=this},updated(){this.componentStructure.updated()},beforeUnmount(){this._sortable!==void 0&&this._sortable.destroy()},computed:{realList(){const{list:e}=this;return e||this.modelValue},getKey(){const{itemKey:e}=this;return typeof e=="function"?e:n=>n[e]}},watch:{$attrs:{handler(e){const{_sortable:n}=this;n&&Mm(e).forEach(([r,i])=>{n.option(r,i)})},deep:!0}},methods:{getUnderlyingVm(e){return this.componentStructure.getUnderlyingVm(e)||null},getUnderlyingPotencialDraggableComponent(e){return e.__draggable_component__},emitChanges(e){t.nextTick(()=>this.$emit("change",e))},alterList(e){if(this.list){e(this.list);return}const n=[...this.modelValue];e(n),this.$emit("update:modelValue",n)},spliceList(){const e=n=>n.splice(...arguments);this.alterList(e)},updatePosition(e,n){const r=i=>i.splice(n,0,i.splice(e,1)[0]);this.alterList(r)},getRelatedContextFromMoveEvent({to:e,related:n}){const r=this.getUnderlyingPotencialDraggableComponent(e);if(!r)return{component:r};const i=r.realList,s={list:i,component:r};return e!==n&&i?{...r.getUnderlyingVm(n)||{},...s}:s},getVmIndexFromDomIndex(e){return this.componentStructure.getVmIndexFromDomIndex(e,this.targetDomElement)},onDragStart(e){this.context=this.getUnderlyingVm(e.item),e.item._underlying_vm_=this.clone(this.context.element),Ts=e.item},onDragAdd(e){const n=e.item._underlying_vm_;if(n===void 0)return;Bs(e.item);const r=this.getVmIndexFromDomIndex(e.newIndex);this.spliceList(r,0,n);const i={element:n,newIndex:r};this.emitChanges({added:i})},onDragRemove(e){if(Em(this.$el,e.item,e.oldIndex),e.pullMode==="clone"){Bs(e.clone);return}const{index:n,element:r}=this.context;this.spliceList(n,1);const i={element:r,oldIndex:n};this.emitChanges({removed:i})},onDragUpdate(e){Bs(e.item),Em(e.from,e.item,e.oldIndex);const n=this.context.index,r=this.getVmIndexFromDomIndex(e.newIndex);this.updatePosition(n,r);const i={element:this.context.element,oldIndex:n,newIndex:r};this.emitChanges({moved:i})},computeFutureIndex(e,n){if(!e.element)return 0;const r=[...n.to.children].filter(l=>l.style.display!=="none"),i=r.indexOf(n.related),s=e.component.getVmIndexFromDomIndex(i);return r.indexOf(Ts)!==-1||!n.willInsertAfter?s:s+1},onDragMove(e,n){const{move:r,realList:i}=this;if(!r||!i)return!0;const s=this.getRelatedContextFromMoveEvent(e),o=this.computeFutureIndex(s,e),l={...this.context,futureIndex:o},a={...e,relatedContext:s,draggedContext:l};return r(a,n)},onDragEnd(){Ts=null}}});function $m(e,n){let r=e.title.toUpperCase(),i=n.title.toUpperCase();return r<i?-1:r>i?1:0}const TN={components:{Item:Ar,draggable:Xr},props:{modelValue:{type:[Object,Array]}},mixins:[z],async created(){await this.$glossary.ensure(),this.value=this.cleanInput(this.value,!0),this.dispatch()},methods:{elementLabel(e){var n=e.firstName||e.title||"";return n.length<60?n:""},async swap(){var e=this;e.touch();var n={field:e.field,model:[e.value],maximum:1,browserOptions:{columns:e.field.columns,select:e.field.select,lockFilter:e.field.lockFilter,dateFilterEnabled:e.dateFilterEnabled}};let r=this.field.referenceType;if(!r){await e.$glossary.ensure();const s=e.$glossary.items.sort($m),{key:o}=await e.$sdk.options(s,"Select content type","What type of content are you wanting to select");r=o}e.$sdk.browse(r,n).then(function(i){e.model=i[0]}).catch(function(i){i&&e.$sdk.error(i)})},async create(){var i;const e=this;if(!((i=e.$sdk.global)!=null&&i.create))return;let n=e.field.createModel;const r=await e.$sdk.global.create(e.field.referenceType,{model:n,preselected:!!n});r.multiple&&(e.multiValue?(e.model||(e.model=[]),e.model=[...e.model,...r.items]):e.model=r.items[0]),r._id&&(e.multiValue?(e.model||(e.model=[]),e.model.push(r)):e.model=r)},clear(){this.model=void 0,this.touch()},canEdit(e){var n=this.user;return n?this.$sdk.access.canEditItem(n,e):!1},async edit(e){var n=await this.$sdk.global.edit(e,!0).catch(function(i){});for(var r in n)e[r]=n[r]},async open(){var e=this;e.touch();var n={field:e.field,model:e.multiValue?e.value:[e.value].filter(Boolean),maximum:e.field.maximum,browserOptions:{columns:e.field.columns,select:e.field.select,lockFilter:e.field.lockFilter,dateFilterEnabled:e.dateFilterEnabled}};let r=this.field.referenceType;if(!r){await e.$glossary.ensure();const s=e.$glossary.items.sort($m),{key:o}=await e.$sdk.options(s,"Select content type","What type of content are you wanting to select");r=o}switch(r){case"scope":const i=e.multiValue?e.value:[e.value].filter(Boolean);return e.$sdk.selectScopes({action:"view",type:r,model:i,maximum:e.field.maximum,include:"scope"}).then(function(s){e.model=e.multiValue?s:s[0]}).catch(function(s){s&&e.$sdk.error(s)})}e.$sdk.browse(r,n).then(function(i){e.model=e.multiValue?i:i[0]}).catch(function(i){i&&e.$sdk.error(i)})},cleanInput(e){var n=this;return n.multiValue?(e||(e=[]),Array.isArray(e)||(e=[]),n.maximum&&e.length>n.maximum&&(e.length=n.maximum)):Array.isArray(e)&&(e=e[0]),e}},computed:{dateFilterEnabled(){switch(this.field.referenceType){case"log":case"event":case"submission":case"email":case"transaction":return!0}},showList(){return this.field.list!==!1},canAdd(){const e=this;return!e.showList||!e.maximum?!0:e.multiValue?e.model.length<e.maximum:!e.model},canCreate(){var i;var e=this.field.referenceType;if(e==="scope")return!1;if(this.field.create!==!1&&(i=this.$sdk.global)!=null&&i.create){var e=this.field.referenceType,n=e,r=this.$glossary.hash[this.field.referenceType];return r&&(e=r.definesType||r.key,n=r.key||r.definesType),this.user&&this.$sdk.access.canCreate(this.user,n,e)}},summary(){if(this.multiValue)if(this.model&&this.model.length){var e="Click to select",n=this.model.length;return this.showList?(n&&(e=`Adjust selection (${n})`),e):n===1?this.model[0].title||this.model[0].name||this.model[0].firstName:`${n} selected`}else return"Click to select";else return this.model?this.showList?"Click to select":this.model.title||this.model.name||this.model.firstName:"Click to select"}}},DN={key:0,class:"ux-field-title"},ON={key:0,class:"ux-required-marker"},MN={key:1,class:"ux-field-description"},FN={class:"multi-list"},IN={key:1,class:"items"};function AN(e,n,r,i,s,o){var k;const l=t.resolveComponent("ux-icon"),a=t.resolveComponent("ux-button"),c=t.resolveComponent("ux-list-item"),d=t.resolveComponent("ux-list"),u=t.resolveComponent("ux-menu"),m=t.resolveComponent("item"),f=t.resolveComponent("draggable"),h=t.resolveComponent("ux-panel"),y=t.resolveComponent("flex-cell"),p=t.resolveComponent("flex-row"),g=t.resolveComponent("flex-spacer");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",DN,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",ON,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",MN,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),o.showList?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[e.multiValue?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[(k=e.model)!=null&&k.length?(t.openBlock(),t.createBlock(h,{key:0},{default:t.withCtx(()=>[t.createElementVNode("div",FN,[t.createVNode(f,{class:"items",modelValue:e.model,"onUpdate:modelValue":n[1]||(n[1]=x=>e.model=x)},{item:t.withCtx(({element:x,index:S})=>[(t.openBlock(),t.createBlock(m,{key:x._id,item:x},{actions:t.withCtx(()=>[t.createVNode(u,{group:"content-actions",right:""},{activator:t.withCtx(({on:A})=>[t.createVNode(a,t.mergeProps({size:"sm"},t.toHandlers(A),{icon:"",onClick:n[0]||(n[0]=t.withModifiers(()=>{},["stop","prevent"]))}),{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-ellipsis"})]),_:2},1040)]),default:t.withCtx(()=>[t.createVNode(d,null,{default:t.withCtx(()=>[t.createVNode(c,{onClick:A=>e.remove(x)},{default:t.withCtx(()=>[t.createTextVNode("Remove "+t.toDisplayString(o.elementLabel(x)),1)]),_:2},1032,["onClick"]),o.canEdit(x)?(t.openBlock(),t.createBlock(c,{key:0,onClick:A=>o.edit(x)},{default:t.withCtx(()=>[t.createTextVNode(" Edit "+t.toDisplayString(o.elementLabel(x)),1)]),_:2},1032,["onClick"])):t.createCommentVNode("",!0),t.createVNode(c,{onClick:A=>e.$actions.open([x])},{default:t.withCtx(()=>[t.createTextVNode(" More Actions ")]),_:2},1032,["onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1032,["item"]))]),_:1},8,["modelValue"])])]),_:1})):t.createCommentVNode("",!0)],64)):e.model?(t.openBlock(),t.createElementBlock("div",IN,[t.createVNode(m,{item:e.model},{actions:t.withCtx(()=>[t.createVNode(u,{group:"content-actions",right:""},{activator:t.withCtx(({on:x})=>[t.createVNode(a,t.mergeProps({size:"sm"},t.toHandlers(x),{icon:"",onClick:n[2]||(n[2]=t.withModifiers(()=>{},["stop","prevent"]))}),{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-ellipsis"})]),_:2},1040)]),default:t.withCtx(()=>[t.createVNode(d,null,{default:t.withCtx(()=>[o.canCreate?(t.openBlock(),t.createBlock(c,{key:0,onClick:o.create},{default:t.withCtx(()=>[t.createVNode(p,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(y,null,{default:t.withCtx(()=>[t.createTextVNode("Replace with new")]),_:1})]),_:1})]),_:1},8,["onClick"])):t.createCommentVNode("",!0),t.createVNode(c,{onClick:n[3]||(n[3]=x=>o.swap(e.model))},{default:t.withCtx(()=>[t.createVNode(p,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(y,null,{default:t.withCtx(()=>[t.createTextVNode("Swap with existing")]),_:1})]),_:1})]),_:1}),t.createVNode(c,{onClick:o.clear},{default:t.withCtx(()=>[t.createVNode(p,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(y,null,{default:t.withCtx(()=>[t.createTextVNode("Remove")]),_:1})]),_:1})]),_:1},8,["onClick"]),o.canEdit(e.model)?(t.openBlock(),t.createBlock(c,{key:1,onClick:n[4]||(n[4]=x=>o.edit(e.model))},{default:t.withCtx(()=>[t.createVNode(p,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(y,null,{default:t.withCtx(()=>[t.createTextVNode("Edit")]),_:1})]),_:1})]),_:1})):t.createCommentVNode("",!0),t.createVNode(c,{onClick:n[5]||(n[5]=x=>e.$actions.open([e.model]))},{default:t.withCtx(()=>[t.createVNode(p,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(y,null,{default:t.withCtx(()=>[t.createTextVNode("More Actions")]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["item"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),o.canAdd?(t.openBlock(),t.createBlock(p,{key:3,gap:""},{default:t.withCtx(()=>[t.createVNode(y,{shrink:""},{default:t.withCtx(()=>[t.createVNode(a,{size:"sm",onClick:o.open},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.summary),1)]),_:1},8,["onClick"])]),_:1}),o.canCreate?(t.openBlock(),t.createBlock(y,{key:0,shrink:""},{default:t.withCtx(()=>[t.createVNode(a,{size:"sm",color:"primary",onClick:o.create},{default:t.withCtx(()=>[t.createTextVNode(" Create "),t.createVNode(l,{right:"",icon:"fa-plus"})]),_:1},8,["onClick"])]),_:1})):t.createCommentVNode("",!0),t.createVNode(g)]),_:1})):t.createCommentVNode("",!0)],64)}const Pm=w(TN,[["render",AN],["__scopeId","data-v-9d53981e"]]),LN={components:{Item:Ar,ContentSearch:cs,draggable:Xr},props:{modelValue:{type:[Object,Array]},browse:{type:Boolean,default:!1}},mixins:[z],async created(){await this.$glossary.ensure(),this.value=this.cleanInput(this.value,!0),this.dispatch()},methods:{elementLabel(e){var n=e.firstName||e.title||"";return n.length<60?n:""},async swap(){var e=this;e.touch();var n={field:e.field,model:[e.value],maximum:1,browserOptions:{columns:e.field.columns,select:e.field.select,lockFilter:e.field.lockFilter}};let r=this.referenceType;if(!r){await e.$glossary.ensure();const s=e.$glossary.items.sort(sortFunction),{key:o}=await e.$sdk.options(s,"Select content type","What type of content are you wanting to select");r=o}e.$sdk.browse(r,n).then(function(i){e.model=i[0]}).catch(function(i){i&&e.$sdk.error(i)})},async create(){var i;const e=this;if(!((i=e.$sdk.global)!=null&&i.create))return;let n=e.field.createModel;const r=await e.$sdk.global.create(e.field.referenceType,{model:n,preselected:!!n});r.multiple&&(e.multiValue?(e.model||(e.model=[]),e.model=[...e.model,...r.items]):e.model=r.items[0]),r._id&&(e.multiValue?(e.model||(e.model=[]),e.model.push(r)):e.model=r)},clear(){this.model=void 0,this.touch()},canEdit(e){var n=this.user;return n?this.$sdk.access.canEditItem(n,e):!1},async edit(e){var n=await this.$sdk.global.edit(e,!0).catch(function(i){});for(var r in n)e[r]=n[r]},async open(){var e=this;e.touch();var n={field:e.field,model:e.multiValue?e.value:[e.value].filter(Boolean),maximum:e.field.maximum,browserOptions:{columns:e.field.columns,select:e.field.select,lockFilter:e.field.lockFilter}};let r=this.referenceType;if(!r){await e.$glossary.ensure();const s=e.$glossary.items.sort(sortFunction),{key:o}=await e.$sdk.options(s,"Select content type","What type of content are you wanting to select");r=o}switch(r){case"scope":const i=e.multiValue?e.value:[e.value].filter(Boolean);return e.$sdk.selectScopes({action:"view",type:r,model:i,maximum:e.field.maximum}).then(function(s){console.log("GOT NEW SELECTION",s),e.model=e.multiValue?s:s[0]}).catch(function(s){s&&e.$sdk.error(s)})}e.$sdk.browse(r,n).then(function(i){e.model=e.multiValue?i:i[0]}).catch(function(i){i&&e.$sdk.error(i)})},cleanInput(e){var n=this;return n.multiValue?(e||(e=[]),Array.isArray(e)||(e=[]),n.maximum&&e.length>n.maximum&&(e.length=n.maximum)):Array.isArray(e)&&(e=e[0]),e}},computed:{shouldPreload(){return!!this.field.dynamicOptions||!!this.field.preloadOptions},hasAsyncOptions(){return!!(this.asyncOptionsURL&&this.shouldPreload||this.field.type==="reference"&&this.field.lockFilter)},canBrowse(){return this.browse},referenceType(){return this.field.referenceType},showList(){return this.field.list!==!1},canAdd(){const e=this;return!e.showList||!e.maximum?!0:e.multiValue?e.model.length<e.maximum:!e.model},canCreate(){var i;var e=this.referenceType;if(e==="scope")return!1;if(this.field.create!==!1&&(i=this.$sdk.global)!=null&&i.create){var e=this.referenceType,n=e,r=this.$glossary.hash[this.referenceType];return r&&(e=r.definesType||r.key,n=r.key||r.definesType),this.user&&this.$sdk.access.canCreate(this.user,n,e)}},summary(){if(this.multiValue)if(this.model&&this.model.length){var e="Click to select",n=this.model.length;return this.showList?(n&&(e=`Adjust selection (${n})`),e):n===1?this.model[0].title||this.model[0].name||this.model[0].firstName:`${n} selected`}else return"Click to select";else return this.model?this.showList?"Click to select":this.model.title||this.model.name||this.model.firstName:"Click to select"}}},$N={key:0,class:"ux-field-title"},PN={key:0,class:"ux-required-marker"},RN={key:1,class:"ux-field-description"},UN={key:1,class:"items"};function jN(e,n,r,i,s,o){const l=t.resolveComponent("ux-icon"),a=t.resolveComponent("ux-button"),c=t.resolveComponent("ux-list-item"),d=t.resolveComponent("ux-list"),u=t.resolveComponent("ux-menu"),m=t.resolveComponent("item"),f=t.resolveComponent("draggable"),h=t.resolveComponent("flex-cell"),y=t.resolveComponent("flex-row"),p=t.resolveComponent("content-search");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",$N,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",PN,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",RN,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),o.showList?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[e.multiValue?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[e.model&&e.model.length?(t.openBlock(),t.createBlock(f,{key:0,class:"items",modelValue:e.model,"onUpdate:modelValue":n[1]||(n[1]=g=>e.model=g)},{item:t.withCtx(({element:g,index:k})=>[(t.openBlock(),t.createBlock(m,{key:g._id,item:g},{actions:t.withCtx(()=>[t.createVNode(u,{group:"content-actions",right:""},{activator:t.withCtx(({on:x})=>[t.createVNode(a,t.mergeProps({size:"sm"},t.toHandlers(x),{icon:"",onClick:n[0]||(n[0]=t.withModifiers(()=>{},["stop","prevent"]))}),{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-ellipsis"})]),_:2},1040)]),default:t.withCtx(()=>[t.createVNode(d,null,{default:t.withCtx(()=>[t.createVNode(c,{onClick:x=>e.remove(g)},{default:t.withCtx(()=>[t.createTextVNode("Remove "+t.toDisplayString(o.elementLabel(g)),1)]),_:2},1032,["onClick"]),o.canEdit(g)?(t.openBlock(),t.createBlock(c,{key:0,onClick:x=>o.edit(g)},{default:t.withCtx(()=>[t.createTextVNode(" Edit "+t.toDisplayString(o.elementLabel(g)),1)]),_:2},1032,["onClick"])):t.createCommentVNode("",!0),t.createVNode(c,{onClick:x=>e.$actions.open([g])},{default:t.withCtx(()=>[t.createTextVNode(" More Actions ")]),_:2},1032,["onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1032,["item"]))]),_:1},8,["modelValue"])):t.createCommentVNode("",!0)],64)):e.model?(t.openBlock(),t.createElementBlock("div",UN,[t.createVNode(m,{item:e.model},{actions:t.withCtx(()=>[t.createVNode(u,{group:"content-actions",right:""},{activator:t.withCtx(({on:g})=>[t.createVNode(a,t.mergeProps({size:"sm"},t.toHandlers(g),{icon:"",onClick:n[2]||(n[2]=t.withModifiers(()=>{},["stop","prevent"]))}),{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-ellipsis"})]),_:2},1040)]),default:t.withCtx(()=>[t.createVNode(d,null,{default:t.withCtx(()=>[o.canCreate?(t.openBlock(),t.createBlock(c,{key:0,onClick:o.create},{default:t.withCtx(()=>[t.createVNode(y,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(h,null,{default:t.withCtx(()=>[t.createTextVNode("Replace with new")]),_:1})]),_:1})]),_:1},8,["onClick"])):t.createCommentVNode("",!0),t.createVNode(c,{onClick:n[3]||(n[3]=g=>o.swap(e.model))},{default:t.withCtx(()=>[t.createVNode(y,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(h,null,{default:t.withCtx(()=>[t.createTextVNode("Swap with existing")]),_:1})]),_:1})]),_:1}),t.createVNode(c,{onClick:o.clear},{default:t.withCtx(()=>[t.createVNode(y,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(h,null,{default:t.withCtx(()=>[t.createTextVNode("Remove")]),_:1})]),_:1})]),_:1},8,["onClick"]),o.canEdit(e.model)?(t.openBlock(),t.createBlock(c,{key:1,onClick:n[4]||(n[4]=g=>o.edit(e.model))},{default:t.withCtx(()=>[t.createVNode(y,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(h,null,{default:t.withCtx(()=>[t.createTextVNode("Edit")]),_:1})]),_:1})]),_:1})):t.createCommentVNode("",!0),t.createVNode(c,{onClick:n[5]||(n[5]=g=>e.$actions.open([e.model]))},{default:t.withCtx(()=>[t.createVNode(y,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(h,null,{default:t.withCtx(()=>[t.createTextVNode("More Actions")]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["item"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),e.multiValue||!e.model?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[o.canAdd?(t.openBlock(),t.createBlock(y,{key:0,center:"",gap:""},{default:t.withCtx(()=>[t.createVNode(h,null,{default:t.withCtx(()=>[t.createVNode(p,{type:o.referenceType,"async-options":o.shouldPreload?void 0:e.field.asyncOptions,"preloaded-options":o.shouldPreload?e.options:[],"server-filtered":e.field.serverFiltered,"lock-filter":e.field.lockFilter,modelValue:e.model,"onUpdate:modelValue":n[6]||(n[6]=g=>e.model=g),multiple:e.multiValue,placeholder:e.placeholder,list:!1,onBrowse:o.open},null,8,["type","async-options","preloaded-options","server-filtered","lock-filter","modelValue","multiple","placeholder","onBrowse"])]),_:1}),o.canBrowse?(t.openBlock(),t.createBlock(h,{key:0,shrink:""},{default:t.withCtx(()=>[t.createVNode(a,{onClick:o.open},{default:t.withCtx(()=>[t.createTextVNode("Browse")]),_:1},8,["onClick"])]),_:1})):t.createCommentVNode("",!0),o.canCreate?(t.openBlock(),t.createBlock(h,{key:1,shrink:""},{default:t.withCtx(()=>[t.createVNode(a,{icon:"",color:"primary",onClick:o.create},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-plus"})]),_:1},8,["onClick"])]),_:1})):t.createCommentVNode("",!0)]),_:1})):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0)],64)}const qN=w(LN,[["render",jN],["__scopeId","data-v-873f84cd"]]),zN={components:{Search:ot},props:{modelValue:{type:[Array,String],default(){return[]}},search:{type:String,default:""},options:{type:Array,default(){return[]}},asyncOptions:{type:String},serverFiltered:{type:Boolean,default:!1},placeholder:{type:String},multiple:{type:Boolean,default:!1},list:{type:Boolean,default:!0}},data(){return{keywords:this.search,asyncResults:[],model:[],activeIndex:-1,isFocused:!1,showOptions:!1,searching:!1}},computed:{placeholderText(){return this.placeholder?this.placeholder:this.multiple?"Search to add items":"Search for an item"},normalizedOptions(){return(this.options||[]).map(function(e){if(typeof e=="string")return{title:e,value:e};const n=e.value||e._id||e.title||e.name||String(e);return{title:e.title||e.name||e.label||n,value:n}})},optionTitleLookup(){return this.normalizedOptions.reduce(function(e,n){return e[n.value]=n.title,e},{})},filteredOptions(){const e=(this.keywords||"").toLowerCase();return e?this.asyncOptions?this.serverFiltered?this.asyncResults:this.asyncResults.filter(function(n){return n.title.toLowerCase().includes(e)}):this.normalizedOptions.filter(function(n){return n.title.toLowerCase().includes(e)}):[]},selectedLabels(){const e=this.optionTitleLookup;return(this.model||[]).map(function(n){return e[n]||n})},totalOptions(){return this.filteredOptions.length}},watch:{modelValue:{handler(e){e?Array.isArray(e)?this.model=e.slice():this.model=[e]:this.model=[]},immediate:!0},search(e){this.keywords=e},keywords:{immediate:!0,async handler(e){if(this.$emit("update:search",e),this.asyncResults=[],this.showOptions=!1,!e){this.searching=!1;return}try{if(this.asyncOptions){this.searching=!0;const n=this.asyncOptions.includes("?")?"&":"?",r=`${this.asyncOptions}${n}search=${encodeURIComponent(e)}`,{data:i}=await this.$sdk.api.get(r);this.asyncResults=(i||[]).map(function(s){if(typeof s=="string")return{title:s,value:s};const o=s.value||s._id||s.title||s.name||String(s);return{title:s.title||s.name||s.label||o,value:o}})}this.showOptions=!0,this.activeIndex=this.totalOptions>0?0:-1}catch{}finally{this.searching=!1}}},filteredOptions(){this.activeIndex=this.totalOptions>0?0:-1}},methods:{focus(){this.$refs.input.focus()},dispatch(){this.$emit("update:modelValue",this.model)},handleKeydown(e){var n,r;if(!(!this.showOptions||this.totalOptions===0))switch(e.key){case"ArrowDown":e.preventDefault(),this.activeIndex=(this.activeIndex+1)%this.totalOptions,this.$nextTick(()=>{const i=this.$el.querySelector(".ux-value-search-option.active");i&&i.scrollIntoView({behavior:"smooth",block:"nearest"})});break;case"ArrowUp":e.preventDefault(),this.activeIndex=this.activeIndex<=0?this.totalOptions-1:this.activeIndex-1,this.$nextTick(()=>{const i=this.$el.querySelector(".ux-value-search-option.active");i&&i.scrollIntoView({behavior:"smooth",block:"nearest"})});break;case"Enter":e.preventDefault(),this.activeIndex>=0&&this.activeIndex<this.filteredOptions.length&&this.selectItem(this.filteredOptions[this.activeIndex],!0);break;case"Escape":this.showOptions=!1,(r=(n=this.$refs.input)==null?void 0:n.$el)==null||r.blur();break}},selectItem(e,n=!1){const r=e.value;this.model.indexOf(r)!==-1||(this.multiple?this.model.push(r):this.model=[r],this.dispatch()),this.keywords="",this.showOptions=!1,n&&this.$nextTick(()=>{var s,o;(o=(s=this.$refs.input)==null?void 0:s.$el)==null||o.focus()})},handleBlur(){setTimeout(()=>{this.isFocused=!1,this.showOptions=!1},200)}},mounted(){this.handleClickOutside=e=>{this.$el&&!this.$el.contains(e.target)&&(this.showOptions=!1)},document.addEventListener("click",this.handleClickOutside)},beforeUnmount(){document.removeEventListener("click",this.handleClickOutside)}},WN={key:0,class:"ux-value-search-selected-items"};function HN(e,n,r,i,s,o){const l=t.resolveComponent("search"),a=t.resolveComponent("ux-list-item"),c=t.resolveComponent("ux-list");return t.openBlock(),t.createElementBlock("div",{class:"ux-value-search",onKeydown:n[2]||(n[2]=(...d)=>o.handleKeydown&&o.handleKeydown(...d))},[r.list?(t.openBlock(),t.createElementBlock("div",WN,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.selectedLabels,(d,u)=>(t.openBlock(),t.createElementBlock("div",{key:u,class:"ux-value-search-selected-item"},t.toDisplayString(d),1))),128))])):t.createCommentVNode("",!0),t.createVNode(l,{modelValue:s.keywords,"onUpdate:modelValue":n[0]||(n[0]=d=>s.keywords=d),onFocus:n[1]||(n[1]=d=>s.isFocused=!0),onBlur:o.handleBlur,ref:"input",placeholder:o.placeholderText,loading:s.searching,debounce:r.asyncOptions?500:50},null,8,["modelValue","onBlur","placeholder","loading","debounce"]),s.showOptions&&o.filteredOptions.length?(t.openBlock(),t.createBlock(c,{key:1,class:"ux-value-search-options"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.filteredOptions,(d,u)=>(t.openBlock(),t.createBlock(a,{key:d.value||u,class:t.normalizeClass([{active:u===s.activeIndex},"ux-value-search-option"]),onClick:m=>o.selectItem(d,!0),onMouseover:m=>s.activeIndex=u},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(d.title),1)]),_:2},1032,["class","onClick","onMouseover"]))),128))]),_:1})):t.createCommentVNode("",!0)],32)}const GN={components:{ValueSearch:w(zN,[["render",HN],["__scopeId","data-v-23db8282"]])},props:{modelValue:{type:[String,Array]}},mixins:[z],methods:{removeValue(e){const n=this.model.slice();n.splice(e,1),this.model=n,this.touch()},clear(){this.model=void 0,this.touch()}},computed:{shouldPreload(){return!!this.field.preloadOptions},asyncOptionsURL(){const e=this.field.asyncOptions;if(e&&String(e).trim().length)return e},hasAsyncOptions(){return!!(this.asyncOptionsURL&&this.shouldPreload)},optionTitleLookup(){return(this.options||[]).reduce(function(e,n){const r=n.value||n._id||n;return e[r]=n.title||n.name||n.label||r,e},{})},singleLabel(){var n;const e=(n=this.model)==null?void 0:n[0];return this.optionTitleLookup[e]||e},modelDisplay(){const e=this.optionTitleLookup;return(this.model||[]).map(function(n){return e[n]||n})}}},YN={key:0,class:"ux-field-title"},JN={key:0,class:"ux-required-marker"},KN={key:1,class:"ux-field-description"},ZN={key:0,class:"select-tags"},XN=["onClick"],QN={key:0,class:"single-value"};function vN(e,n,r,i,s,o){const l=t.resolveComponent("flex-cell"),a=t.resolveComponent("ux-icon"),c=t.resolveComponent("flex-row"),d=t.resolveComponent("value-search"),u=t.resolveComponent("ux-button");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",YN,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",JN,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",KN,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[e.model&&e.model.length?(t.openBlock(),t.createElementBlock("div",ZN,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.modelDisplay,(m,f)=>(t.openBlock(),t.createElementBlock("div",{class:"select-tag",key:f},[t.createVNode(c,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(m),1)]),_:2},1024),t.createVNode(l,{shrink:""},{default:t.withCtx(()=>[t.createElementVNode("a",{onClick:h=>o.removeValue(f)},[t.createVNode(a,{icon:"fa-times"})],8,XN)]),_:2},1024)]),_:2},1024)]))),128))])):t.createCommentVNode("",!0),e.canAddValue?(t.openBlock(),t.createBlock(d,{key:1,options:e.options,"async-options":o.shouldPreload?void 0:o.asyncOptionsURL,"server-filtered":e.field.serverFiltered,modelValue:e.model,"onUpdate:modelValue":n[0]||(n[0]=m=>e.model=m),multiple:!0,placeholder:e.placeholder,list:!1},null,8,["options","async-options","server-filtered","modelValue","placeholder"])):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[e.model?(t.openBlock(),t.createElementBlock("div",QN,[t.createVNode(c,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.singleLabel),1)]),_:1}),t.createVNode(l,{shrink:""},{default:t.withCtx(()=>[t.createVNode(u,{size:"sm",icon:"",onClick:o.clear},{default:t.withCtx(()=>[t.createVNode(a,{icon:"fa-times"})]),_:1},8,["onClick"])]),_:1})]),_:1})])):(t.openBlock(),t.createBlock(d,{key:1,options:e.options,"async-options":o.shouldPreload?void 0:o.asyncOptionsURL,"server-filtered":e.field.serverFiltered,modelValue:e.model,"onUpdate:modelValue":n[1]||(n[1]=m=>e.model=m),multiple:!1,placeholder:e.placeholder,list:!1},null,8,["options","async-options","server-filtered","modelValue","placeholder"]))],64))],64)}const eE=w(GN,[["render",vN],["__scopeId","data-v-1103bb68"]]);function tE(e){return e===void 0||typeof e>"u"||e===null||String(e)==="null"||String(e)==="undefined"}const nE={props:{title:{type:String},modelValue:{}},mixins:[z],async created(){this.model=this.model,await this.$glossary.ensure();var e=this.$glossary.items;this.hash=this.$glossary.hash;var n=e;this.field.defineableTypes?n=n.filter(function(r){return r.defineable}):(this.field.basicTypes===!1&&(n=n.filter(function(r){return!!r.definesType})),this.field.definedTypes===!1&&(n=n.filter(function(r){return!r.definesType}))),n=n.map(function(r){return{title:r.title,value:r.key,definesType:r.definesType}}).sort((r,i)=>r.title>i.title?1:-1),this.types=n},data(){return{hash:{},types:[]}},methods:{cleanOutput(e){var n=this;return tE(e)?n.multiValue?e=[]:e=void 0:n.multiValue?e=(e||[]).filter(Boolean).map(function(r){return n.getValue(r)}):e=n.getValue(e),e},cleanInput(e){var n=this;if(n.multiValue)e||(e=[]),Array.isArray(e)||(e=[e]),n.maximum&&e.length>n.maximum&&(e.length=n.maximum),e=e.filter(Boolean).map(function(i){var s=n.getValue(i);return n.returnObject?n.optionLookup[s]:s});else{var r=n.getValue(e);e=n.returnObject?n.optionLookup[r]:r}return e}},computed:{optionGroups(){const e=this,n=e.selectableOptions.reduce(function(r,i){const s=i.key||i.value;let o=i.definesType;o||r.__basic.options.push({title:i.title,value:i.key||i.value}),o=o||s;let l=r[o];if(!l){const a=e.hash[o];a?l=r[o]={title:a.plural,key:o,options:[]}:console.log("NO PARENT TYPE",o,e.hash)}return l&&l.options.push(i),r},{__basic:{key:"__basic",title:"Basic Types",options:[]}});return Object.values(n).filter(function(r){return r.options.length?r.options.length>1?!0:r.options[0].value!==r.key:!1}).sort(function(r,i){var s=(r.title||r).toLowerCase();if(r.key==="__basic")return-1;var o=(i.title||i).toLowerCase();return s<o?-1:s>o?1:0})},returnObject(){return!1},classes(){var e=[];return this.multiValue?e.push("multiple"):e.push("single"),e},optionLookup(){var e=this;return e.types.reduce(function(n,r){const i=e.getValue(r);return n[i]=r,n},{})},summary(){return this.model?this.getLabel(this.optionLookup[this.model]):this.title||"Click to select"},selectableOptions(){return this.types}}},rE={key:0,class:"ux-field-title"},oE={key:0,class:"ux-required-marker"},iE={key:1,class:"ux-field-description"},sE={key:2,class:"ui-select-button"},lE=["multiple"],aE={key:0,value:""},cE=["label"],dE=["value"];function uE(e,n,r,i,s,o){const l=t.resolveComponent("ux-button");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["native-select",o.classes])},[e.showLabel?(t.openBlock(),t.createElementBlock("label",rE,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",oE,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",iE,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.singleValue?(t.openBlock(),t.createElementBlock("div",sE,[t.renderSlot(e.$slots,"default",{},()=>[t.createVNode(l,{tag:"div"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.summary),1)]),_:1})],!0)])):t.createCommentVNode("",!0),t.withDirectives(t.createElementVNode("select",{onFocus:n[0]||(n[0]=(...a)=>e.touch&&e.touch(...a)),multiple:e.multiValue,"onUpdate:modelValue":n[1]||(n[1]=a=>e.model=a)},[e.singleValue&&!e.minimum?(t.openBlock(),t.createElementBlock("option",aE,"None")):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.optionGroups,a=>(t.openBlock(),t.createElementBlock("optgroup",{key:a.key,label:a.title},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.options,c=>(t.openBlock(),t.createElementBlock("option",{value:c.value},t.toDisplayString(c.title),9,dE))),256))],8,cE))),128))],40,lE),[[t.vModelSelect,e.model]])],2)}const mE=w(nE,[["render",uE],["__scopeId","data-v-74252ee9"]]);function Rm(e,n){return e=String(e||"").toLowerCase(),n=String(n||"").toLowerCase(),n.includes(e)}const fE={components:{UxCircle:pr},props:{item:{type:Object},click:{type:Function},keywords:{type:String,default:""}},data(){return{}},methods:{clicked(){this.click(this.item)},toggleCollapse(){return this.collapsed=!this.collapsed}},created(){this.$glossary.ensure()},inject:{registry:{},isSelected:{default(){}}},computed:{glossary(){return this.$glossary.hash},definition(){var n,r;const e=(r=(n=this.item)==null?void 0:n.meta)==null?void 0:r.definition;if(e)return this.glossary[e]},selected(){return this.isSelected(this.item)},isChildMatch(){const e=this;function n(r){if(!r||r.length===0)return!1;let i=!1;return r.forEach(function(s){if(!i){if(Rm(e.keywords,s.title)){i=!0;return}if(e.isSelected(s)){i=!0;return}s.children&&n(s.children)&&(i=!0)}}),i}return n(e.item.children)},isMatching(){var e;return!!((e=this.keywords)!=null&&e.length)},isMatch(){return this.isMatching?Rm(this.keywords,this.item.title):!1},isUnmatch(){if(this.isMatching)return!this.isMatch},hasChildren(){var e;return(e=this.item.children)==null?void 0:e.length},expanded(){return!this.collapsed},collapsed:{set(e){this.registry[this.item._id]=this.item.collapsed=e},get(){return this.hasChildren?this.keywords?!1:this.registry[this.item._id]?!0:this.item.collapsed:!0}}}},hE={class:"outer"},pE={key:0,class:"children"};function yE(e,n,r,i,s,o){const l=t.resolveComponent("ux-icon"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-circle"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row"),m=t.resolveComponent("scope-item",!0);return t.openBlock(),t.createElementBlock("div",hE,[t.createElementVNode("div",{class:t.normalizeClass(["scope-item",{selected:o.selected,matched:o.isMatch,unmatched:o.isUnmatch,childmatched:o.isChildMatch,childselected:e.isChildSelected}]),onClick:n[1]||(n[1]=(...f)=>o.clicked&&o.clicked(...f))},[t.createVNode(u,{gap:"",vcenter:""},{default:t.withCtx(()=>[t.createVNode(a,{class:"select-mark",shrink:""},{default:t.withCtx(()=>[t.createVNode(l,{icon:o.selected?"fa-check":"fa-regular fa-circle"},null,8,["icon"])]),_:1}),t.createVNode(a,{shrink:""},{default:t.withCtx(()=>[t.createVNode(c,{value:r.item},null,8,["value"])]),_:1}),t.createVNode(a,{class:"scope-title"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(r.item.title),1)]),_:1}),o.definition?(t.openBlock(),t.createBlock(a,{key:0,class:"definition-title",shrink:""},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.definition.title),1)]),_:1})):t.createCommentVNode("",!0),o.hasChildren?(t.openBlock(),t.createBlock(a,{key:1,shrink:""},{default:t.withCtx(()=>[t.createVNode(d,{onClick:n[0]||(n[0]=t.withModifiers(f=>o.toggleCollapse(),["stop","prevent"])),size:"xs",icon:""},{default:t.withCtx(()=>[t.createVNode(l,{icon:o.expanded?"fa-angle-up":"fa-angle-down"},null,8,["icon"])]),_:1})]),_:1})):t.createCommentVNode("",!0)]),_:1})],2),o.expanded?(t.openBlock(),t.createElementBlock("div",pE,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.item.children,f=>(t.openBlock(),t.createBlock(m,{click:r.click,item:f,keywords:r.keywords},null,8,["click","item","keywords"]))),256))])):t.createCommentVNode("",!0)])}const gE=w(fE,[["render",yE],["__scopeId","data-v-eeed1e2f"]]);let Ds;const kE={components:{ScopeItem:gE,Search:ot},created(){this.$glossary.ensure()},props:{action:{type:String},type:{type:String,required:!0},include:{type:String,default:"scope"},modelValue:{type:Array,default(){return[]}},single:{type:Boolean,default:!1}},data(){return{loading:!0,model:this.modelValue,scopes:[],registry:{},keywords:""}},mounted(){},beforeUnmount(){},methods:{expandAll(){const e=this;e.allLeaves.forEach(function({_id:n}){e.registry[n]=!1})},collapseAll(){const e=this;e.allLeaves.forEach(function({_id:n}){e.registry[n]=!0})},select(e){if(this.single){this.model=[e];return}this.isSelected(e)||this.model.push(e)},deselect(e){const n=this,r=n.$sdk.utils.id(e);n.isSelected(e)&&(n.single&&(n.model.length=0),n.model=n.model.filter(function(i){return n.$sdk.utils.id(i)!=r}))},isSelected(e){const n=this.$sdk.utils.id(e);return this.hash[n]},toggle(e){this.isSelected(e)?this.deselect(e):this.select(e)},click(e){this.toggle(e)},async checkLoad(){Ds||(Ds=!0,this.action&&this.type?this.scopes=await this.loadScopes():(console.log("missing action or type",this.action,this.type),this.scopes=await this.loadTree()),Ds=!1)},async loadTree(){this.loading=!0;const{data:e}=await this.$sdk.api.get("/scope/tree");return this.loading=!1,e},async loadScopes(){this.loading=!0;const{data:e}=await this.$sdk.api.post("/scope/actionable",{action:this.action,type:this.type});return this.loading=!1,e},async showModal(){const e=this,n={};await e.$sdk.modal({component:ScopeSelectModal,options:n})}},provide(){return{isSelected:this.isSelected,registry:this.registry}},computed:{glossary(){return this.$glossary.hash},filteredScopes(){var r;let e=this.scopes;switch(((r=this.field)==null?void 0:r.include)||this.include||"scope"){case"unit":e=e.filter(function(i){return!!i.unit});break;case"scope":e=e.filter(function(i){return!i.unit});break}return e},hasSelection(){return this.model.length},hash(){return this.model.reduce(function(e,n){return e[n._id||n]=!0,e},{})},empty(){return!this.model.length},summary(){const e=this;return e.model.length?e.model.map(function(n){return n.title}).join(", "):"Select Scopes"},allLeaves(){const e=[];function n(r){r.forEach(function(i){e.push(i),i.children&&n(i.children)})}return n(this.filteredScopes),e}},watch:{type:{handler(){this.checkLoad()},immediate:!0},action:{handler(){this.checkLoad()},immediate:!0},modelValue(e){this.model=e},model(e){this.$emit("update:modelValue",e)}}},_E={key:0,class:"padder"},wE={class:"padder"},xE={class:"padder"};function bE(e,n,r,i,s,o){const l=t.resolveComponent("spinner"),a=t.resolveComponent("search"),c=t.resolveComponent("flex-cell"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row"),m=t.resolveComponent("flex-header"),f=t.resolveComponent("scope-item"),h=t.resolveComponent("flex-body"),y=t.resolveComponent("flex-column");return t.openBlock(),t.createBlock(y,{class:t.normalizeClass({has:o.hasSelection})},{default:t.withCtx(()=>[s.loading?(t.openBlock(),t.createElementBlock("div",_E,[t.createVNode(l)])):(t.openBlock(),t.createBlock(y,{key:1},{default:t.withCtx(()=>[t.withDirectives(t.createVNode(m,null,{default:t.withCtx(()=>[t.createElementVNode("div",wE,[t.createVNode(u,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(c,null,{default:t.withCtx(()=>[t.createVNode(a,{modelValue:s.keywords,"onUpdate:modelValue":n[0]||(n[0]=p=>s.keywords=p),placeholder:"Search scopes"},null,8,["modelValue"])]),_:1}),t.createVNode(c,{shrink:""},{default:t.withCtx(()=>[t.createVNode(d,{onClick:o.expandAll,size:"xs"},{default:t.withCtx(()=>[t.createTextVNode("Expand All")]),_:1},8,["onClick"])]),_:1}),t.createVNode(c,{shrink:""},{default:t.withCtx(()=>[t.createVNode(d,{onClick:o.collapseAll,size:"xs"},{default:t.withCtx(()=>[t.createTextVNode("Collapse All")]),_:1},8,["onClick"])]),_:1})]),_:1})])]),_:1},512),[[t.vShow,o.allLeaves.length>20]]),t.createVNode(h,{class:"scroll-body"},{default:t.withCtx(()=>[t.createElementVNode("div",xE,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.filteredScopes,p=>(t.openBlock(),t.createBlock(f,{click:o.click,keywords:s.keywords,item:p},null,8,["click","keywords","item"]))),256))])]),_:1})]),_:1}))]),_:1},8,["class"])}const Um=w(kE,[["render",bE],["__scopeId","data-v-78a3e8d6"]]),CE={components:{UxCircle:pr},async created(){this.reloadScopeGlossary()},props:{size:{type:String},action:{type:String},type:{type:String},include:{type:String,default:"scope"},modelValue:{type:Array,default(){return[]}},minimum:{type:Number,default:0},maximum:{type:Number,default:0}},data(){return{scopeGlossary:{},loadingScopeGlossary:!0,loadingContentGlossary:!0,model:this.modelValue,definition:null}},mounted(){this.$sdk.addEventListener("glossary:scope",this.reloadScopeGlossary)},beforeUnmount(){this.$sdk.removeEventListener("glossary:scope",this.reloadScopeGlossary)},methods:{async reloadScopeGlossary(){this.loadingScopeGlossary=!0;const e=await this.$sdk.content.scopeGlossary({hash:!0});this.scopeGlossary=e,this.loadingScopeGlossary=!1},async openSelection(){const e=this,n={action:e.action,type:e.type,model:e.model,maximum:e.maximum,include:e.include},r=await e.$sdk.selectScopes(n);e.model=r}},computed:{visible(){const e=this.$sdk.utils.ids(this.model)||[],n=this.$sdk.utils.ids(this.availableDefaultScopes)||[];return!(n.length===1&&(!e.length||e[0]===n[0]))},loading(){return this.loadingScopeGlossary||this.loadingContentGlossary},cacheKey(){return this.user.cacheKey},empty(){return!this.model.length},filteredScopes(){let e=this.model||[];switch(this.include){case"scope":e=e.filter(function(n){return!n.unit});break;case"unit":e=e.filter(function(n){return!!n.unit});break}return e},summary(){var r;const e=this;return e.model.length?((r=e.filteredScopes)!=null&&r.length?e.filteredScopes:e.model).map(function(i){const s=i._id||i;return(e.scopeGlossary[s]||i).title||(e.loading?"loading":"(redacted)")}).join(", "):"Select Scopes"},definitionDefaultScopes(){var i;const e=this,n=(i=e.definition)==null?void 0:i.defaultScopes;if(n&&n.length)return[...n];const r=Object.keys(e.scopeGlossary);return r.length===1?[...r]:[]},definitionRestrictScopes(){var e;return((e=this.definition)==null?void 0:e.restrictScopes)||[]},restrictedLookup(){return this.definitionRestrictScopes.reduce(function(e,n){if(!n)return e;var r=n._id||n;return e[r]=r,e},{})},availableDefaultScopes(){const e=this;let n;return e.definitionRestrictScopes.length?(n=e.definitionDefaultScopes.filter(function(r){if(!r)return!1;var i=r._id||r;return e.restrictedLookup[i]}),!n.length&&e.definitionRestrictScopes.length===1&&(n=e.definitionRestrictScopes),n):e.definitionDefaultScopes}},watch:{availableDefaultScopes:{handler(e){this.model.length||e.length&&(this.model=[...e])},immediate:!0},modelValue(e){this.model=e},model(e){this.$emit("update:modelValue",e)},type:{async handler(e){const n=this;n.loadingContentGlossary=!0,await this.$glossary.ensure(),n.definition=this.$glossary.hash[e],n.loadingContentGlossary=!1},immediate:!0}}},VE={class:"circles"};function NE(e,n,r,i,s,o){const l=t.resolveComponent("ux-circle"),a=t.resolveComponent("ux-button");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass({invisible:!o.visible})},[t.createVNode(a,{size:r.size,loading:o.loading,onClick:o.openSelection},{default:t.withCtx(()=>[t.createElementVNode("div",VE,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.filteredScopes,c=>(t.openBlock(),t.createBlock(l,{value:c},null,8,["value"]))),256))]),t.createElementVNode("span",{class:t.normalizeClass({"empty-text":o.empty})},t.toDisplayString(o.summary),3)]),_:1},8,["size","loading","onClick"])],2)}const jm=w(CE,[["render",NE],["__scopeId","data-v-1913d47e"]]);function EE(e){return e===void 0||typeof e>"u"||e===null||String(e)==="null"||String(e)==="undefined"}const BE={components:{ScopeSelectButton:jm},props:{title:{type:String},modelValue:{},minimum:{type:Number,default:0},maximum:{type:Number,default:0}},mixins:[z],async created(){this.model=this.model,await this.$glossary.ensure();var e=this.$glossary.items,n=e;this.field.basicTypes===!1&&(n=n.filter(function(r){return!!r.definesType})),this.field.definedTypes===!1&&(n=n.filter(function(r){return!r.definesType})),n=n.map(function(r){return{title:r.title,value:r.key}}).sort((r,i)=>r.title>i.title?1:-1),this.types=n},data(){return{types:[]}},methods:{cleanOutput(e){var n=this;return EE(e)?n.multiValue?e=[]:e=void 0:n.multiValue?e=(e||[]).filter(Boolean).map(function(r){return n.getValue(r)}):e=n.getValue(e),e},cleanInput(e){var n=this;if(n.multiValue)e||(e=[]),Array.isArray(e)||(e=[e]),n.maximum&&e.length>n.maximum&&(e.length=n.maximum),e=e.filter(Boolean).map(function(i){var s=n.getValue(i);return n.returnObject?n.optionLookup[s]:s});else{var r=n.getValue(e);e=n.returnObject?n.optionLookup[r]:r}return e}},computed:{returnObject(){return!1},classes(){var e=[];return this.multiValue?e.push("multiple"):e.push("single"),e},optionLookup(){var e=this;return e.types.reduce(function(n,r){const i=e.getValue(r);return n[i]=r,n},{})},summary(){return this.model?this.getLabel(this.optionLookup[this.model]):this.title||"Click to select"},contextReferenceType(){return this.field.contextReferenceType},contextReferenceAction(){return this.field.contextReferenceAction},selectableOptions(){return this.types}}},SE={key:0,class:"ux-field-title"},TE={key:0,class:"ux-required-marker"},DE={key:1,class:"ux-field-description"};function OE(e,n,r,i,s,o){const l=t.resolveComponent("scope-select-button");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["scope-select",o.classes])},[e.showLabel?(t.openBlock(),t.createElementBlock("label",SE,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",TE,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",DE,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),t.createVNode(l,{maximum:r.maximum,type:o.contextReferenceType,action:o.contextReferenceAction,modelValue:e.model,"onUpdate:modelValue":n[0]||(n[0]=a=>e.model=a)},null,8,["maximum","type","action","modelValue"])],2)}const qm=w(BE,[["render",OE],["__scopeId","data-v-335f960b"]]),ME={props:{modelValue:{type:[String,Array]}},mixins:[z],methods:{update(e,n){var r=this.format(e.target.value);this.model[n]=r},format(n){n=String(n).replace(/[^0-9.-]/g,"");var n=parseFloat(n)*100;return isNaN(n)?"":(n=Math.round(n),n)},unformat(n){n=String(n).replace(/[^0-9.-]/g,"");var n=parseFloat(n)/100;return isNaN(n)?"":(n=n.toFixed(2),n)},getNewDefaultEntry(){return""},unfocus(){this.$refs.input.blur(),this.touch()}},computed:{model:{get(){return this.cleanOutput(this.value)},set(e){this.value=this.cleanInput(e),this.dispatch()}},proxy:{get(){var e=this;return e.multiValue?e.model.map(e.unformat):e.unformat(e.model)},set(e){var n=this;n.multiValue?n.model=e.map(n.format):n.model=n.format(e)}},currency(){return String(this.field.currency||"usd").toLowerCase()},prefix(){return this.$sdk.utils.currencySymbol(this.currency)},suffix(){return String(this.currency).toUpperCase()}}},FE={key:0,class:"ux-field-title"},IE={key:0,class:"ux-required-marker"},AE={key:1,class:"ux-field-description"},LE={key:2},$E={key:0,class:"ux-text-prefix"},PE=["onBlur","onUpdate:modelValue"],RE={key:1,class:"ux-text-suffix"},UE={key:0,class:"ux-text-prefix"},jE={key:1,class:"ux-text-suffix"};function qE(e,n,r,i,s,o){const l=t.resolveComponent("flex-cell"),a=t.resolveComponent("ux-icon"),c=t.resolveComponent("ux-button"),d=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",FE,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",IE,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",AE,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",LE,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.model,(u,m)=>(t.openBlock(),t.createBlock(d,{class:"ux-text-row",key:m},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["ux-text-wrap",{prefixed:o.prefix,suffixed:o.suffix}])},[o.prefix?(t.openBlock(),t.createElementBlock("span",$E,t.toDisplayString(o.prefix),1)):t.createCommentVNode("",!0),t.withDirectives((t.openBlock(),t.createElementBlock("input",{class:"ux-field-focus ux-text-input-multiple",ref_for:!0,ref:"input",placeholder:"0.00",key:`proxy-index-${m}`,onKeydown:n[0]||(n[0]=t.withKeys(t.withModifiers(f=>e.add(),["stop","prevent"]),["enter"])),onBlur:f=>o.update(f,m),"onUpdate:modelValue":f=>o.proxy[m]=f,onFocus:n[1]||(n[1]=(...f)=>e.touch&&e.touch(...f))},null,40,PE)),[[t.vModelText,o.proxy[m],void 0,{lazy:!0}]]),o.suffix?(t.openBlock(),t.createElementBlock("span",RE,t.toDisplayString(o.suffix),1)):t.createCommentVNode("",!0)],2)]),_:2},1024),t.createVNode(l,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(c,{key:0,tag:"a",icon:"",onClick:f=>e.remove(u)},{default:t.withCtx(()=>[t.createVNode(a,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(c,{key:0,onClick:n[2]||(n[2]=u=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel)+" ",1),t.createVNode(a,{icon:"fa-plus",right:""})]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock("div",{key:3,class:t.normalizeClass(["ux-text-wrap",{prefixed:o.prefix,suffixed:o.suffix}])},[o.prefix?(t.openBlock(),t.createElementBlock("span",UE,t.toDisplayString(o.prefix),1)):t.createCommentVNode("",!0),t.withDirectives((t.openBlock(),t.createElementBlock("input",{class:"ux-field-focus ux-text-input-single",ref:"input",key:o.proxy,placeholder:"0.00",onKeyup:n[3]||(n[3]=t.withKeys(t.withModifiers((...u)=>o.unfocus&&o.unfocus(...u),["stop","prevent"]),["enter"])),onFocus:n[4]||(n[4]=(...u)=>e.touch&&e.touch(...u)),"onUpdate:modelValue":n[5]||(n[5]=u=>o.proxy=u)},null,32)),[[t.vModelText,o.proxy,void 0,{lazy:!0}]]),o.suffix?(t.openBlock(),t.createElementBlock("span",jE,t.toDisplayString(o.suffix),1)):t.createCommentVNode("",!0)],2))],64)}const zm=w(ME,[["render",qE],["__scopeId","data-v-30b07ae5"]]),zE={components:{draggable:Xr},props:{modelValue:{type:[String,Array]}},data(){return{drag:!1,unmasked:!1,unmaskedLookup:t.reactive({})}},mixins:[z],computed:{reorderable(){return this.multiValue&&this.field.reorderable},copyable(){return this.$sdk.global.copyText&&this.field.copyable},uneditable(){return this.field.editable===!1},inputClasses(){const e=[];return e.push(`ux-text-input-${this.inputType}`),e.join(" ")},actualInputType(){return this.unmasked?"text":this.inputType},sensitive(){return this.inputType==="password"},inputType(){switch(this.field.widget){case"password":case"email":return this.field.widget;default:switch(this.field.type){case"email":return"email";default:return"text"}}},lazy(){switch(this.type){case"integer":case"number":case"decimal":case"float":case"url":case"key":return!0}},actualPlaceholder(){if(this.field.placeholder)return this.field.placeholder;switch(this.type){case"integer":case"number":case"decimal":case"float":return"0";case"url":return"https://www.website.com";case"email":return"you@youremail.com"}}},methods:{copy(e){let n;this.maximum===1?n=this.model:n=this.model[e],this.$sdk.global.copyText(n)},toggleMask(e){this.maximum===1?this.unmasked=!this.unmasked:this.unmaskedLookup[`m${e}`]=!this.unmaskedLookup[`m${e}`]},cleanOutputValue(e){var n=this.cleanTextInput(e,this.type,this);return n?String(n):""},cleanInputValue(e){return this.cleanTextInput(e,this.type,this)},getNewDefaultEntry(){return""}}},WE={key:0,class:"ux-field-title"},HE={key:0,class:"ux-required-marker"},GE={key:1,class:"ux-field-description"},YE={key:2},JE={class:"ux-text-wrap"},KE={key:0,class:"ux-text-prefix"},ZE=["readonly","type","placeholder","onUpdate:modelValue"],XE=["readonly","type","placeholder","onUpdate:modelValue"],QE={key:3,class:"ux-text-suffix"},vE={class:"ux-text-wrap"},eB={key:0,class:"ux-text-prefix"},tB=["readonly","type","placeholder","onUpdate:modelValue"],nB=["readonly","type","placeholder","onUpdate:modelValue"],rB={key:3,class:"ux-text-suffix"},oB={class:"ux-text-wrap"},iB={key:0,class:"ux-text-prefix"},sB=["readonly","type","placeholder"],lB=["readonly","type","placeholder"],aB={key:3,class:"ux-text-suffix"};function cB(e,n,r,i,s,o){const l=t.resolveComponent("ux-icon"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-button"),d=t.resolveComponent("flex-row"),u=t.resolveComponent("draggable");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",WE,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",HE,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",GE,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",YE,[o.reorderable?(t.openBlock(),t.createBlock(u,{key:0,modelValue:e.model,"onUpdate:modelValue":n[4]||(n[4]=m=>e.model=m),group:`${e.field.key}-order`,onStart:n[5]||(n[5]=m=>s.drag=!0),onEnd:n[6]||(n[6]=m=>s.drag=!1),handle:".handle"},{item:t.withCtx(({element:m,index:f})=>[t.createVNode(d,{gap:"",class:"ux-text-row"},{default:t.withCtx(()=>[t.createVNode(a,{class:"handle arrows",shrink:"",vcenter:""},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-arrows"})]),_:1}),t.createVNode(a,null,{default:t.withCtx(()=>[t.createElementVNode("div",JE,[e.prefix?(t.openBlock(),t.createElementBlock("span",KE,t.toDisplayString(e.prefix),1)):t.createCommentVNode("",!0),o.lazy?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,readonly:o.uneditable,type:s.unmaskedLookup[`m${f}`]?"text":o.inputType,class:t.normalizeClass([o.inputClasses,"ux-field-focus ux-text-input-multiple"]),placeholder:o.actualPlaceholder,onFocus:n[0]||(n[0]=(...h)=>e.touch&&e.touch(...h)),ref:"input",onKeydown:n[1]||(n[1]=t.withKeys(t.withModifiers(h=>e.add(),["stop","prevent"]),["enter"])),"onUpdate:modelValue":h=>e.model[f]=h},null,42,ZE)),[[t.vModelDynamic,e.model[f],void 0,{lazy:!0}]]):t.createCommentVNode("",!0),o.lazy?t.createCommentVNode("",!0):t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:2,readonly:o.uneditable,type:s.unmaskedLookup[`m${f}`]?"text":o.inputType,class:t.normalizeClass([o.inputClasses,"ux-field-focus ux-text-input-multiple"]),placeholder:o.actualPlaceholder,onFocus:n[2]||(n[2]=(...h)=>e.touch&&e.touch(...h)),ref:"input",onKeydown:n[3]||(n[3]=t.withKeys(t.withModifiers(h=>e.add(),["stop","prevent"]),["enter"])),"onUpdate:modelValue":h=>e.model[f]=h},null,42,XE)),[[t.vModelDynamic,e.model[f]]]),e.suffix?(t.openBlock(),t.createElementBlock("span",QE,t.toDisplayString(e.suffix),1)):t.createCommentVNode("",!0)])]),_:2},1024),o.sensitive?(t.openBlock(),t.createBlock(a,{key:0,shrink:"",vcenter:""},{default:t.withCtx(()=>[t.createVNode(c,{size:e.size,tag:"a",icon:"",onClick:h=>o.toggleMask(f)},{default:t.withCtx(()=>[t.createVNode(l,{icon:s.unmaskedLookup[`m${f}`]?"fa-eye":"fa-eye-slash"},null,8,["icon"])]),_:2},1032,["size","onClick"])]),_:2},1024)):t.createCommentVNode("",!0),o.copyable?(t.openBlock(),t.createBlock(a,{key:1,shrink:"",vcenter:""},{default:t.withCtx(()=>[t.createVNode(c,{size:e.size,tag:"a",icon:"",onClick:h=>o.copy(f)},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-copy"})]),_:2},1032,["size","onClick"])]),_:2},1024)):t.createCommentVNode("",!0),t.createVNode(a,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(c,{key:0,size:e.size,tag:"a",icon:"",onClick:h=>e.remove(m)},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-times"})]),_:2},1032,["size","onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024)]),_:1},8,["modelValue","group"])):(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(e.model,(m,f)=>(t.openBlock(),t.createBlock(d,{gap:"",class:"ux-text-row",key:f},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createElementVNode("div",vE,[e.prefix?(t.openBlock(),t.createElementBlock("span",eB,t.toDisplayString(e.prefix),1)):t.createCommentVNode("",!0),o.lazy?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,readonly:o.uneditable,type:s.unmaskedLookup[`m${f}`]?"text":o.inputType,class:t.normalizeClass([o.inputClasses,"ux-field-focus ux-text-input-multiple"]),placeholder:o.actualPlaceholder,onFocus:n[7]||(n[7]=(...h)=>e.touch&&e.touch(...h)),ref_for:!0,ref:"input",onKeydown:n[8]||(n[8]=t.withKeys(t.withModifiers(h=>e.add(),["stop","prevent"]),["enter"])),"onUpdate:modelValue":h=>e.model[f]=h},null,42,tB)),[[t.vModelDynamic,e.model[f],void 0,{lazy:!0}]]):t.createCommentVNode("",!0),o.lazy?t.createCommentVNode("",!0):t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:2,readonly:o.uneditable,type:s.unmaskedLookup[`m${f}`]?"text":o.inputType,class:t.normalizeClass([o.inputClasses,"ux-field-focus ux-text-input-multiple"]),placeholder:o.actualPlaceholder,onFocus:n[9]||(n[9]=(...h)=>e.touch&&e.touch(...h)),ref_for:!0,ref:"input",onKeydown:n[10]||(n[10]=t.withKeys(t.withModifiers(h=>e.add(),["stop","prevent"]),["enter"])),"onUpdate:modelValue":h=>e.model[f]=h},null,42,nB)),[[t.vModelDynamic,e.model[f]]]),e.suffix?(t.openBlock(),t.createElementBlock("span",rB,t.toDisplayString(e.suffix),1)):t.createCommentVNode("",!0)])]),_:2},1024),o.sensitive?(t.openBlock(),t.createBlock(a,{key:0,shrink:"",vcenter:""},{default:t.withCtx(()=>[t.createVNode(c,{size:e.size,tag:"a",icon:"",onClick:h=>o.toggleMask(f)},{default:t.withCtx(()=>[t.createVNode(l,{icon:s.unmaskedLookup[`m${f}`]?"fa-eye":"fa-eye-slash"},null,8,["icon"])]),_:2},1032,["size","onClick"])]),_:2},1024)):t.createCommentVNode("",!0),o.copyable?(t.openBlock(),t.createBlock(a,{key:1,shrink:"",vcenter:""},{default:t.withCtx(()=>[t.createVNode(c,{size:e.size,tag:"a",icon:"",onClick:h=>o.copy(f)},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-copy"})]),_:2},1032,["size","onClick"])]),_:2},1024)):t.createCommentVNode("",!0),t.createVNode(a,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(c,{key:0,size:e.size,tag:"a",icon:"",onClick:h=>e.remove(m)},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-times"})]),_:2},1032,["size","onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(c,{key:2,size:e.size,onClick:n[11]||(n[11]=m=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel)+" ",1),t.createVNode(l,{icon:"fa-plus",right:""})]),_:1},8,["size"])):t.createCommentVNode("",!0)])):(t.openBlock(),t.createBlock(d,{key:3,gap:""},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createElementVNode("div",oB,[e.prefix?(t.openBlock(),t.createElementBlock("span",iB,t.toDisplayString(e.prefix),1)):t.createCommentVNode("",!0),o.lazy?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,readonly:o.uneditable,type:o.actualInputType,ref:"input",class:t.normalizeClass([o.inputClasses,"ux-field-focus ux-text-input-single"]),placeholder:o.actualPlaceholder,onFocus:n[12]||(n[12]=(...m)=>e.touch&&e.touch(...m)),"onUpdate:modelValue":n[13]||(n[13]=m=>e.model=m)},null,42,sB)),[[t.vModelDynamic,e.model,void 0,{lazy:!0}]]):t.createCommentVNode("",!0),o.lazy?t.createCommentVNode("",!0):t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:2,readonly:o.uneditable,type:o.actualInputType,ref:"input",class:t.normalizeClass([o.inputClasses,"ux-field-focus ux-text-input-single"]),placeholder:o.actualPlaceholder,onFocus:n[14]||(n[14]=(...m)=>e.touch&&e.touch(...m)),"onUpdate:modelValue":n[15]||(n[15]=m=>e.model=m)},null,42,lB)),[[t.vModelDynamic,e.model]]),e.suffix?(t.openBlock(),t.createElementBlock("span",aB,t.toDisplayString(e.suffix),1)):t.createCommentVNode("",!0)])]),_:1}),o.sensitive?(t.openBlock(),t.createBlock(a,{key:0,shrink:"",vcenter:""},{default:t.withCtx(()=>[t.createVNode(c,{size:e.size,tag:"a",icon:"",onClick:o.toggleMask},{default:t.withCtx(()=>[t.createVNode(l,{icon:s.unmasked?"fa-eye":"fa-eye-slash"},null,8,["icon"])]),_:1},8,["size","onClick"])]),_:1})):t.createCommentVNode("",!0),o.copyable?(t.openBlock(),t.createBlock(a,{key:1,shrink:"",vcenter:""},{default:t.withCtx(()=>[t.createVNode(c,{size:e.size,tag:"a",icon:"",onClick:o.copy},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-copy"})]),_:1},8,["size","onClick"])]),_:1})):t.createCommentVNode("",!0)]),_:1}))],64)}const Os=w(zE,[["render",cB],["__scopeId","data-v-790b60de"]]),dB={props:{modelValue:{type:[String,Array]}},data(){return{}},mixins:[z],computed:{copyable(){return this.$sdk.global.copyText&&this.field.copyable},uneditable(){return this.field.editable===!1}},methods:{async edit(){const e=this,{key:n}=await e.$sdk.prompt([{title:"Key",type:"string",key:"key",type:"key",minimum:1,maximum:1,defaultValues:[e.model],autofocus:!0}],{title:"Set a key",description:"This is a database key that once set should rarely be changed. Only edit this if you know what you are doing."});e.model=n},copy(e){let n;this.maximum===1?n=this.model:n=this.model[e],this.$sdk.global.copyText(n)},cleanOutputValue(e){var n=this.cleanTextInput(e,this.type,this);return n?String(n):""},cleanInputValue(e){return this.cleanTextInput(e,this.type,this)},getNewDefaultEntry(){return""}}},uB={key:0,class:"ux-field-title"},mB={key:0,class:"ux-required-marker"},fB={key:1,class:"ux-field-description"},hB={key:2};function pB(e,n,r,i,s,o){const l=t.resolveComponent("ux-icon"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",uB,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",mB,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",fB,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",hB)):(t.openBlock(),t.createBlock(c,{key:3,gap:""},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createElementVNode("div",{class:"ux-key-wrap",onClick:n[0]||(n[0]=(...d)=>o.edit&&o.edit(...d))},[t.createTextVNode(t.toDisplayString(e.model)+" ",1),t.createVNode(l,{icon:"far fa-pen-to-square"})])]),_:1})]),_:1}))],64)}const yB=w(dB,[["render",pB],["__scopeId","data-v-de658074"]]),gB={props:{modelValue:{type:[String,Array]}},mixins:[z],methods:{getNewDefaultEntry(){return""}}},kB={key:0,class:"ux-field-title"},_B={key:0,class:"ux-required-marker"},wB={key:1,class:"ux-field-description"},xB={key:2},bB=["placeholder","onUpdate:modelValue"],CB=["placeholder"];function VB(e,n,r,i,s,o){const l=t.resolveComponent("flex-cell"),a=t.resolveComponent("ux-icon"),c=t.resolveComponent("ux-button"),d=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",kB,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",_B,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",wB,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",xB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.model,(u,m)=>(t.openBlock(),t.createBlock(d,{class:"ux-text-row",key:m},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("textarea",{placeholder:e.placeholder,contenteditable:"",onFocus:n[0]||(n[0]=(...f)=>e.touch&&e.touch(...f)),ref_for:!0,ref:"input","onUpdate:modelValue":f=>e.model[m]=f,class:"ux-textarea ux-field-focus ux-text-area-multiple"},null,40,bB),[[t.vModelText,e.model[m]]])]),_:2},1024),t.createVNode(l,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(c,{key:0,tag:"a",icon:"",onClick:f=>e.remove(u)},{default:t.withCtx(()=>[t.createVNode(a,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(c,{key:0,onClick:n[1]||(n[1]=u=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:3,placeholder:e.placeholder,class:"ux-textarea ux-field-focus ux-text-area-single",onFocus:n[2]||(n[2]=(...u)=>e.touch&&e.touch(...u)),"onUpdate:modelValue":n[3]||(n[3]=u=>e.model=u),role:"textbox",contenteditable:""},null,40,CB)),[[t.vModelText,e.model]])],64)}const NB=w(gB,[["render",VB],["__scopeId","data-v-18c18ffb"]]);function Ct(e){return String(e).length<2&&(e=`0${e}`),e}const EB={components:{Datepicker:$u},props:{modelValue:{type:[Date,String,Array]},disableTime:{type:Boolean,default:!1}},mixins:[z],computed:{formattedMinDate(){return this.minDate?this.showTime?this.formatDateTime(this.minDate):this.formatDate(this.minDate):null},formattedMaxDate(){return this.maxDate?this.showTime?this.formatDateTime(this.maxDate):this.formatDate(this.maxDate):null},singleModel:{get(){return this.cleanOutput(this.value)},set(e){if(!e){this.value=void 0,this.dispatch();return}const n=new Date(e);isNaN(n.getTime())||(this.value=n.toISOString(),this.dispatch())}},dateOnlyModel:{get(){let e=this.cleanOutput(this.model);if(this.multiValue)e=e.map(function(n){if(!n)return n;const r=new Date(n);return isNaN(r.getTime())?null:r.toISOString().slice(0,10)}).filter(Boolean);else if(e){const n=new Date(e);if(isNaN(n.getTime()))return null;e=n.toISOString().slice(0,10)}return e},set(e){if(!e){this.value=void 0,this.dispatch();return}if(e!=="invalid"){var n=this.cleanOutput(e),r=this.cleanOutput(this.value);if(n!=r){if(e=this.cleanInput(n),this.multiValue)e=e.map(function(i){const s=new Date(i);return isNaN(s.getTime())?null:s.toISOString()}).filter(Boolean);else{const i=new Date(e);if(isNaN(i.getTime()))return;e=i.toISOString()}this.value=e,this.dispatch()}}}},showTime(){return!this.dateOnly},dateOnly(){var e;return this.disableTime?!0:!!((e=this.field)!=null&&e.dateOnly)},model:{get(){return this.cleanOutput(this.value)},set(e){if(!e){this.value=void 0,this.dispatch();return}if(e!=="invalid"){var n=this.cleanOutput(e),r=this.cleanOutput(this.value);n!=r&&(e=this.cleanInput(n),this.value=e,this.dispatch())}}}},methods:{updateMultiValue(e,n){if(!n)return;const r=new Date(n);if(isNaN(r.getTime()))return;const i=[...this.model];i[e]=r.toISOString(),this.value=this.cleanInput(i),this.dispatch()},formatDate(e){if(!e)return null;const n=new Date(e);return isNaN(n.getTime())?null:`${n.getFullYear()}-${Ct(n.getMonth()+1)}-${Ct(n.getDate())}`},formatDateTime(e){if(!e)return null;const n=new Date(e);return isNaN(n.getTime())?null:`${this.formatDate(n)}T${Ct(n.getHours())}:${Ct(n.getMinutes())}`},cleanOutputValue(e){if(e=e?new Date(e):new Date,!isNaN(e.getFullYear()))return`${e.getFullYear()}-${Ct(e.getMonth()+1)}-${Ct(e.getDate())}T${Ct(e.getHours())}:${Ct(e.getMinutes())}`},cleanInputValue(e){let n=new Date(e);return n.toString()=="Invalid Date"?"invalid":n.toISOString()},getNewDefaultEntry(){return new Date}}},BB={key:0,class:"ux-field-title"},SB={key:0,class:"ux-required-marker"},TB={key:1,class:"ux-field-description"},DB={key:2};function OB(e,n,r,i,s,o){const l=t.resolveComponent("datepicker"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-icon"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",BB,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",SB,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",TB,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",DB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.model,(m,f)=>(t.openBlock(),t.createBlock(u,{class:"ux-text-row",key:f},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(l,{"date-only":o.dateOnly,"min-date":e.minDate,"max-date":e.maxDate,"model-value":o.model[f],"onUpdate:modelValue":h=>o.updateMultiValue(f,h),onFocus:e.touch,class:"ux-field-focus"},null,8,["date-only","min-date","max-date","model-value","onUpdate:modelValue","onFocus"])]),_:2},1024),t.createVNode(a,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(d,{key:0,color:"default",tag:"a",icon:"",onClick:h=>e.remove(m)},{default:t.withCtx(()=>[t.createVNode(c,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(d,{key:0,onClick:n[0]||(n[0]=m=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createBlock(l,{key:3,"date-only":o.dateOnly,"min-date":e.minDate,"max-date":e.maxDate,modelValue:o.singleModel,"onUpdate:modelValue":n[1]||(n[1]=m=>o.singleModel=m),onFocus:e.touch,class:"ux-field-focus"},null,8,["date-only","min-date","max-date","modelValue","onFocus"]))],64)}const Wm=w(EB,[["render",OB],["__scopeId","data-v-a7631835"]]);function Hm(e){return e=String(e||"00").replace(/[^0-9.]/g,"").slice(0,2),e.length<2&&(e=`0${e}`),e}const MB={props:{modelValue:{type:String}},mixins:[z],methods:{cleanInputValue(e){return e.split(":").join("")},cleanOutputValue(e){let n=Hm(e.slice(0,2))||"",r=Hm(e.slice(2))||"";return`${n}:${r}`.slice(0,5)},getNewDefaultEntry(){return"00:00"}}},FB={key:0,class:"ux-field-title"},IB={key:0,class:"ux-required-marker"},AB={key:1,class:"ux-field-description"},LB={key:2},$B=["onUpdate:modelValue"];function PB(e,n,r,i,s,o){const l=t.resolveComponent("flex-cell"),a=t.resolveComponent("ux-icon"),c=t.resolveComponent("ux-button"),d=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",FB,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",IB,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",AB,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",LB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.model,(u,m)=>(t.openBlock(),t.createBlock(d,{class:"ux-text-row",key:m},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("input",{type:"time",class:"ux-field-focus ux-text-input-multiple",onFocus:n[0]||(n[0]=(...f)=>e.touch&&e.touch(...f)),ref_for:!0,ref:"input",onKeydown:n[1]||(n[1]=t.withKeys(t.withModifiers(f=>e.add(),["stop","prevent"]),["enter"])),"onUpdate:modelValue":f=>e.model[m]=f},null,40,$B),[[t.vModelText,e.model[m]]])]),_:2},1024),t.createVNode(l,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(c,{key:0,tag:"a",icon:"",onClick:f=>e.remove(u)},{default:t.withCtx(()=>[t.createVNode(a,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(c,{key:0,onClick:n[2]||(n[2]=u=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:3,type:"time",class:"ux-field-focus ux-text-input-single",onFocus:n[3]||(n[3]=(...u)=>e.touch&&e.touch(...u)),"onUpdate:modelValue":n[4]||(n[4]=u=>e.model=u)},null,544)),[[t.vModelText,e.model]])],64)}const Gm=w(MB,[["render",PB],["__scopeId","data-v-b9cac2ad"]]),RB={components:{Daterange:es},props:{modelValue:{type:[Object,Array]}},mixins:[z],computed:{model:{get(){return this.cleanOutput(this.value)},set(e){if(!e){this.value=void 0,this.dispatch();return}var n=this.cleanOutput(e),r=this.cleanOutput(this.value);n!=r&&(e=this.cleanInput(n),this.value=e,this.dispatch())}}},methods:{cleanOutputValue(e){return e},cleanInputValue(e){return e},getNewDefaultEntry(){return{}}}},UB={key:0,class:"ux-field-title"},jB={key:0,class:"ux-required-marker"},qB={key:1,class:"ux-field-description"},zB={key:2};function WB(e,n,r,i,s,o){const l=t.resolveComponent("daterange",!0),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-icon"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",UB,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",jB,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",qB,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",zB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.model,(m,f)=>(t.openBlock(),t.createBlock(u,{class:"ux-text-row",key:f},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(l,{onFocus:e.touch,modelValue:o.model[f],"onUpdate:modelValue":h=>o.model[f]=h},null,8,["onFocus","modelValue","onUpdate:modelValue"])]),_:2},1024),t.createVNode(a,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(d,{key:0,tag:"a",icon:"",onClick:h=>e.remove(m)},{default:t.withCtx(()=>[t.createVNode(c,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(d,{key:0,onClick:n[0]||(n[0]=m=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createBlock(l,{key:3,onFocus:e.touch,modelValue:o.model,"onUpdate:modelValue":n[1]||(n[1]=m=>o.model=m)},null,8,["onFocus","modelValue"]))],64)}const HB=w(RB,[["render",WB],["__scopeId","data-v-b6688859"]]);function Ym(e){return Array.isArray(e)?!!e[0]:!!e}const GB={mixins:[z],components:{UxCheckbox:gr},props:{modelValue:{type:[Boolean,Array]}},data(){return{boolean:Ym(this.modelValue)}},watch:{modelValue(e,n){this.boolean=Ym(e)},boolean(e,n){this.multiValue?this.$emit("update:modelValue",[e]):this.$emit("update:modelValue",e)}},methods:{getNewDefaultEntry(){return!!this.boolean}},computed:{longDescription(){return String(this.description).length>2}}},YB={key:0,class:"ux-field-title"},JB={key:0,class:"ux-required-marker"},KB={key:1,class:"ux-field-description"};function ZB(e,n,r,i,s,o){const l=t.resolveComponent("ux-checkbox"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock("div",null,[t.createVNode(c,{onClick:n[1]||(n[1]=d=>e.touch()),gap:""},{default:t.withCtx(()=>[t.createVNode(a,{vcenter:"",shrink:""},{default:t.withCtx(()=>[t.createVNode(l,{value:s.boolean,onClick:n[0]||(n[0]=d=>s.boolean=!s.boolean)},null,8,["value"])]),_:1}),t.createVNode(a,{vcenter:""},{default:t.withCtx(()=>[t.createElementVNode("div",null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",YB,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",JB,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",KB,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0)])]),_:1})]),_:1})])}const XB=w(GB,[["render",ZB]]),QB={props:{modelValue:{type:[String,Array]}},mixins:[z],methods:{getNewDefaultEntry(){return""}}},vB={key:0},eS=["innerHTML"],tS=["innerHTML"];function nS(e,n,r,i,s,o){const l=t.resolveComponent("compile"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-icon"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row");return e.multiValue?(t.openBlock(),t.createElementBlock("div",vB,[t.createVNode(u,{class:"ux-text-row"},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[e.field.compile?(t.openBlock(),t.createBlock(l,{key:0,template:e.field.template},null,8,["template"])):(t.openBlock(),t.createElementBlock("div",{key:1,innerHTML:e.field.template},null,8,eS))]),_:1}),t.createVNode(a,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(d,{key:0,tag:"a",icon:"",onClick:n[0]||(n[0]=m=>e.remove(e.entry))},{default:t.withCtx(()=>[t.createVNode(c,{icon:"fa-times"})]),_:1})):t.createCommentVNode("",!0)]),_:1})]),_:1}),e.canAddValue?(t.openBlock(),t.createBlock(d,{key:0,onClick:n[1]||(n[1]=m=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[e.field.compile?(t.openBlock(),t.createBlock(l,{key:0,template:e.field.template},null,8,["template"])):(t.openBlock(),t.createElementBlock("div",{key:1,innerHTML:e.field.template},null,8,tS))],64))}const rS=w(QB,[["render",nS]]);var Ms,Jm;function oS(){if(Jm)return Ms;Jm=1;var e=Math.ceil,n=Math.max;function r(i,s,o,l){for(var a=-1,c=n(e((s-i)/(o||1)),0),d=Array(c);c--;)d[l?c:++a]=i,i+=o;return d}return Ms=r,Ms}var Fs,Km;function Zm(){if(Km)return Fs;Km=1;var e=9007199254740991;function n(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return Fs=n,Fs}var Is,Xm;function As(){if(Xm)return Is;Xm=1;var e=jc(),n=Zm();function r(i){return i!=null&&n(i.length)&&!e(i)}return Is=r,Is}var Ls,Qm;function vm(){if(Qm)return Ls;Qm=1;var e=9007199254740991,n=/^(?:0|[1-9]\d*)$/;function r(i,s){var o=typeof i;return s=s??e,!!s&&(o=="number"||o!="symbol"&&n.test(i))&&i>-1&&i%1==0&&i<s}return Ls=r,Ls}var $s,ef;function iS(){if(ef)return $s;ef=1;var e=rd(),n=As(),r=vm(),i=En();function s(o,l,a){if(!i(a))return!1;var c=typeof l;return(c=="number"?n(a)&&r(l,a.length):c=="string"&&l in a)?e(a[l],o):!1}return $s=s,$s}var Ps,tf;function nf(){if(tf)return Ps;tf=1;var e=Ic(),n=1/0,r=17976931348623157e292;function i(s){if(!s)return s===0?s:0;if(s=e(s),s===n||s===-1/0){var o=s<0?-1:1;return o*r}return s===s?s:0}return Ps=i,Ps}var Rs,rf;function sS(){if(rf)return Rs;rf=1;var e=oS(),n=iS(),r=nf();function i(s){return function(o,l,a){return a&&typeof a!="number"&&n(o,l,a)&&(l=a=void 0),o=r(o),l===void 0?(l=o,o=0):l=r(l),a=a===void 0?o<l?1:-1:r(a),e(o,l,a,s)}}return Rs=i,Rs}var Us,of;function lS(){if(of)return Us;of=1;var e=sS(),n=e();return Us=n,Us}var aS=lS();const sf=mt(aS);function cS(e){return String(e).length<2&&(e=`0${e}`),e}const{lookup:dS,options:uS}=[...sf(1,13)].reduce(function(e,n){let r;switch(n){case 1:r="January";break;case 2:r="February";break;case 3:r="March";break;case 4:r="April";break;case 5:r="May";break;case 6:r="June";break;case 7:r="July";break;case 8:r="August";break;case 9:r="September";break;case 10:r="October";break;case 11:r="November";break;case 12:r="December";break}return e.lookup[n]=r,e.options.push({title:r,value:n}),e},{lookup:{},options:[]});function lf(){const e=_.now().toObject();return e.millisecond=0,e.second=0,e.minute=0,e.hour=12,e}const mS={components:{NativeSelect:Ke},props:{allDay:{type:Boolean,default:!1},modelValue:{type:Object,default(){return lf()}}},data(){return{model:void 0,meridian:"PM",disableEmit:!1,empty:!1}},methods:{touched(){this.empty=!1},reset(){this.disableEmit=!0,this.meridian="PM",this.model=lf(),this.$nextTick(function(){this.disableEmit=!1,this.empty=!0})},outputUpdate(){this.disableEmit||this.$emit("update:modelValue",this.output)}},watch:{changeString:"outputUpdate",modelValue:{immediate:!0,handler(e){if(e=JSON.parse(JSON.stringify(e)),!e){this.reset();return}this.empty=!1;let n=e.hour,r=this.meridian;n>=12?(r="PM",n>12&&(n=n-12)):n<12&&(r="AM"),this.meridian=r,e.hour=n,this.model=e}}},computed:{showTime(){return!this.allDay},changeString(){return JSON.stringify(this.output)},output(){if(!this.model)return;const e=this.showTime?this.minute:0,n=this.showTime?this.actualHour:0;return{millisecond:0,second:0,minute:e,hour:n,day:this.day,month:this.month,year:this.year,meridian:this.meridian}},displayHour(){const e=this;if(e.empty)return"--";let n=e.hour;return n===0&&(n=12),n},displayDay(){const e=this;return e.empty?"--":e.day},displayMonth(){const e=this;return e.empty?"-":dS[e.month]},displayYear(){const e=this;return e.empty?"----":e.year},displayMinute(){const e=this;return e.empty?"--":cS(e.minute)},meridianGate:{get(){return this.meridian},set(e){this.meridian=e}},hour:{get(){return this.model.hour||0},set(e){this.model.hour=e}},minute:{get(){let e=this.model.minute||0;return e=Math.min(e,59),e=Math.max(e,0),e},set(e){this.model.minute=e}},day:{get(){return this.model.day||_.now().toObject().day},set(e){this.model.day=e}},month:{get(){return this.model.month||_.now().toObject().month},set(e){this.model.month=e}},year:{get(){return this.model.year||new Date().getFullYear()},set(e){this.model.year=e}},actualHour(){const e=this;let n=e.hour;switch(e.meridian){case"AM":if(n===12)return 0;break;case"PM":if(n===12)return 12;n=12+n;break}return n},hourOptions(){return[{title:"1",value:1},{title:"2",value:2},{title:"3",value:3},{title:"4",value:4},{title:"5",value:5},{title:"6",value:6},{title:"7",value:7},{title:"8",value:8},{title:"9",value:9},{title:"10",value:10},{title:"11",value:11},{title:"12",value:0}]},minuteOptions(){return[{title:"00",value:0},{title:"05",value:5},{title:"10",value:10},{title:"15",value:15},{title:"20",value:20},{title:"25",value:25},{title:"30",value:30},{title:"35",value:35},{title:"40",value:40},{title:"45",value:45},{title:"50",value:50},{title:"55",value:55}]},dayOptions(){return[...sf(1,32)].map(function(e){return{title:e,value:e}})},yearOptions(){for(var e=new Date().getFullYear(),n=e-100,r=e+20,i=[],s=n;s<r;s++)i.push({title:s,value:s});return i},monthOptions(){return uS},amOptions(){return[{title:"AM",value:"AM"},{title:"PM",value:"PM"}]},timezone(){return"Australia/Melbourne"}}},fS=e=>(t.pushScopeId("data-v-7c5620c6"),e=e(),t.popScopeId(),e),hS={class:"date-section"},pS=fS(()=>t.createElementVNode("div",{class:"date-section shrink"},":",-1)),yS={class:"date-section"},gS={class:"date-section"},kS={class:"date-section"},_S={class:"date-section"},wS={class:"custom-select"},xS={class:"date-section"};function bS(e,n,r,i,s,o){const l=t.resolveComponent("ux-icon"),a=t.resolveComponent("native-select"),c=t.resolveComponent("flex-cell"),d=t.resolveComponent("flex-row");return t.openBlock(),t.createBlock(d,null,{default:t.withCtx(()=>[o.showTime?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(c,{shrink:"",class:"first"},{default:t.withCtx(()=>[t.createVNode(a,{onTouched:o.touched,modelValue:o.hour,"onUpdate:modelValue":n[0]||(n[0]=u=>o.hour=u),field:{minimum:1,maximum:1,options:o.hourOptions}},{default:t.withCtx(()=>[t.createElementVNode("div",hS,[t.createTextVNode(t.toDisplayString(o.displayHour)+" ",1),t.createVNode(l,{right:"",icon:"fa-angle-down"})])]),_:1},8,["onTouched","modelValue","field"])]),_:1}),t.createVNode(c,{shrink:""},{default:t.withCtx(()=>[pS]),_:1}),t.createVNode(c,{shrink:""},{default:t.withCtx(()=>[t.createVNode(a,{onTouched:o.touched,modelValue:o.minute,"onUpdate:modelValue":n[1]||(n[1]=u=>o.minute=u),field:{minimum:1,maximum:1,options:o.minuteOptions}},{default:t.withCtx(()=>[t.createElementVNode("div",yS,[t.createTextVNode(t.toDisplayString(o.displayMinute)+" ",1),t.createVNode(l,{right:"",icon:"fa-angle-down"})])]),_:1},8,["onTouched","modelValue","field"])]),_:1}),t.createVNode(c,{shrink:"",class:"last"},{default:t.withCtx(()=>[t.createVNode(a,{onTouched:o.touched,modelValue:o.meridianGate,"onUpdate:modelValue":n[2]||(n[2]=u=>o.meridianGate=u),field:{minimum:1,maximum:1,options:o.amOptions}},{default:t.withCtx(()=>[t.createElementVNode("div",gS,[t.createTextVNode(t.toDisplayString(s.meridian)+" ",1),t.createVNode(l,{right:"",icon:"fa-angle-down"})])]),_:1},8,["onTouched","modelValue","field"])]),_:1}),t.createVNode(c,{class:"spacer"})],64)):t.createCommentVNode("",!0),t.createVNode(c,{shrink:"",class:"first"},{default:t.withCtx(()=>[t.createVNode(a,{onTouched:o.touched,modelValue:o.day,"onUpdate:modelValue":n[3]||(n[3]=u=>o.day=u),field:{minimum:1,maximum:1,options:o.dayOptions}},{default:t.withCtx(()=>[t.createElementVNode("div",kS,[t.createTextVNode(t.toDisplayString(o.displayDay)+" ",1),t.createVNode(l,{right:"",icon:"fa-angle-down"})])]),_:1},8,["onTouched","modelValue","field"])]),_:1}),t.createVNode(c,{shrink:""},{default:t.withCtx(()=>[t.createVNode(a,{onTouched:o.touched,modelValue:o.month,"onUpdate:modelValue":n[4]||(n[4]=u=>o.month=u),field:{minimum:1,maximum:1,options:o.monthOptions}},{default:t.withCtx(()=>[t.createElementVNode("div",_S,[t.createTextVNode(t.toDisplayString(o.displayMonth)+" ",1),t.createVNode(l,{right:"",icon:"fa-angle-down"})])]),_:1},8,["onTouched","modelValue","field"])]),_:1}),t.createVNode(c,{shrink:"",class:"last"},{default:t.withCtx(()=>[t.createElementVNode("div",wS,[t.createVNode(a,{onTouched:o.touched,modelValue:o.year,"onUpdate:modelValue":n[5]||(n[5]=u=>o.year=u),field:{minimum:1,maximum:1,options:o.yearOptions}},{default:t.withCtx(()=>[t.createElementVNode("div",xS,[t.createTextVNode(t.toDisplayString(o.displayYear)+" ",1),t.createVNode(l,{right:"",icon:"fa-angle-down"})])]),_:1},8,["onTouched","modelValue","field"])])]),_:1})]),_:1})}const CS={mixins:[z],components:{DateObject:w(mS,[["render",bS],["__scopeId","data-v-7c5620c6"]])},props:{modelValue:{type:Object}},computed:{allDay(){return this.field.allDay||this.field.dateOnly},model:{get(){return this.cleanInput(this.value)},set(e){let n;(this.isGroup||this.widget==="form")&&(e===this.value?n=!1:n=!0);const r=this.cleanInput(e),i=this.cleanInput(this.value);if(JSON.stringify(r)!=JSON.stringify(i)||n){this.value=r,this.checkAutofocus();const o=this.cleanOutputValue(r);this.$emit("update:modelValue",o)}}}},methods:{getNewDefaultEntry(){return{}},cleanOutputValue(e){if(this.field.type==="date"&&e&&typeof e=="object"&&e.year!==void 0)try{let n=e.hour||0;e.meridian==="PM"&&n!==12?n=n+12:e.meridian==="AM"&&n===12&&(n=0);const r=_.fromObject({year:e.year,month:e.month,day:e.day,hour:n,minute:e.minute||0,second:e.second||0,millisecond:e.millisecond||0});return r.isValid?r.toJSDate():(console.warn("Invalid date object:",e,r.invalidReason),e)}catch(n){return console.warn("Error converting dateobject to Date:",n,e),e}return e},cleanInputValue(e){if(this.field.type==="date"){let n;if(e instanceof Date&&!isNaN(e.getTime()))try{n=_.fromJSDate(e)}catch(r){return console.warn("Error parsing JavaScript Date:",r,e),e}else if(typeof e=="string"&&e.trim().length>0)try{n=_.fromISO(e),n.isValid||(n=_.fromJSDate(new Date(e)))}catch(r){return console.warn("Error parsing date string:",r,e),e}else return e&&typeof e=="object"&&e.year!==void 0,e;if(n&&n.isValid)try{let r=n.hour,i="AM";return r>=12?(i="PM",r>12&&(r=r-12)):r===0&&(r=12),{millisecond:n.millisecond,second:n.second,minute:n.minute,hour:r,day:n.day,month:n.month,year:n.year,meridian:i}}catch(r){return console.warn("Error converting DateTime to dateobject:",r,e),e}else return console.warn("Invalid date value:",e,n==null?void 0:n.invalidReason),e}return e}}},VS={key:0,class:"ux-field-title"},NS={key:0,class:"ux-required-marker"},ES={key:1,class:"ux-field-description"},BS={key:2};function SS(e,n,r,i,s,o){const l=t.resolveComponent("date-object"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-icon"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",VS,[t.createTextVNode(t.toDisplayString(e.label),1),e.required?(t.openBlock(),t.createElementBlock("span",NS,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",ES,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",BS,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.model,(m,f)=>(t.openBlock(),t.createBlock(u,{class:"ux-text-row",key:f},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(l,{allDay:o.allDay,modelValue:o.model[f],"onUpdate:modelValue":h=>o.model[f]=h},null,8,["allDay","modelValue","onUpdate:modelValue"])]),_:2},1024),t.createVNode(a,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(d,{key:0,tag:"a",icon:"",onClick:h=>e.remove(m)},{default:t.withCtx(()=>[t.createVNode(c,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(d,{key:0,size:"sm",onClick:n[0]||(n[0]=m=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createBlock(l,{key:3,allDay:o.allDay,modelValue:o.model,"onUpdate:modelValue":n[1]||(n[1]=m=>o.model=m)},null,8,["allDay","modelValue"]))],64)}const TS=w(CS,[["render",SS],["__scopeId","data-v-7cccbc7b"]]);function DS(e,n){if(!e.glossary)return;const r=e.glossary.checkin;if(!r)return;const i={title:"Checkins",minimum:1,maximum:1,key:"join_checkin",asObject:!0,type:"group",fields:[{title:"",minimum:1,maximum:1,key:"checkin",asObject:!0,type:"group",fields:[{title:"Total",minimum:1,maximum:1,key:"total",type:"integer",referenceType:r.key}]}]};n.push(i)}function OS(e,n){if(!e.glossary)return;const r=e.glossary.assignment;if(!r)return;const i={title:"Roster › Assignments",minimum:1,maximum:1,key:"join_assignment",asObject:!0,type:"group",fields:[{title:"",minimum:1,maximum:1,key:"assignment",asObject:!0,type:"group",fields:[{title:"Total",minimum:1,maximum:1,key:"total",type:"integer",referenceType:r.key}]}]};n.push(i)}function MS(e,n){const r={title:"Roster › Blockout Periods",minimum:1,maximum:1,key:"join_blockout",asObject:!0,type:"group",fields:[{title:"",minimum:1,maximum:1,key:"blockout",asObject:!0,type:"group",fields:[{title:"Total",minimum:1,maximum:1,key:"total",type:"integer",referenceType:"blockout"}]}]};n.push(r)}function FS(e){let n=[];if(n.push({title:"Age",minimum:1,maximum:1,key:"_age",type:"integer"}),n.push({title:"Date of birth",minimum:1,maximum:1,key:"_dob",type:"date"}),e.glossary){DS(e,n),OS(e,n),MS(e,n);const r=e.glossary.persona;if(r){const o={title:"User Login",minimum:1,maximum:1,key:"join_persona",asObject:!0,type:"group",fields:[{title:"",minimum:1,maximum:1,key:"items[]",asObject:!0,type:"group",fields:(r.fields||[]).map(function(l){let a=l;switch(l.key){case"organisation":case"names":case"password":return;case"meta":a=JSON.parse(JSON.stringify(l)),a.fields=a.fields.filter(function({key:c}){switch(c){case"status":case"scopes":case"tags":case"updated":case"created":case"status":return!0}});break}return a}).filter(Boolean)},{title:"Total",minimum:1,maximum:1,key:"total",type:"integer",referenceType:"persona"}]};n.push(o)}}return n}function af(e){let n=[];if(n.push({title:"Event › Start",minimum:1,maximum:1,key:"join_event.startDate",type:"date",filterIncludeTime:!0}),n.push({title:"Event › Doors Open",minimum:1,maximum:1,key:"join_event.openDate",type:"date",filterIncludeTime:!0}),n.push({title:"Event › Doors Close",minimum:1,maximum:1,key:"join_event.closeDate",type:"date",filterIncludeTime:!0}),n.push({title:"Event › End",minimum:1,maximum:1,key:"join_event.endDate",type:"date",filterIncludeTime:!0}),e.glossary){const r=Object.entries(e.glossary).reduce(function(i,[s,o]){return o.definesType==="event"&&i.push(o),i},[]).map(function({title:i,key:s}){return{title:i,value:s}});r.length&&n.push({title:"Event › Type",minimum:1,maximum:1,key:"join_event.meta.definition",type:"string",widget:"select",options:r})}return n}function cf(e){let n=[];if(n.push({title:"Event › Start",minimum:1,maximum:1,key:"join_roster_event.startDate",type:"date",filterIncludeTime:!0}),n.push({title:"Event › End",minimum:1,maximum:1,key:"join_roster_event.endDate",type:"date",filterIncludeTime:!0}),e.glossary){const r=Object.entries(e.glossary).reduce(function(i,[s,o]){return o.definesType==="event"&&i.push(o),i},[]).map(function({title:i,key:s}){return{title:i,value:s}});r.length&&n.push({title:"Event › Type",minimum:1,maximum:1,key:"join_roster_event.meta.definition",type:"string",widget:"select",options:r})}return n}const IS={emits:["remove"],props:{fields:{type:Array,default(){return[]}},enableRemove:{type:Boolean},modelValue:{type:Object,default(){return{key:"",comparator:"",value:null,value2:null,values:[],conditions:[]}}}},async created(){this.comparators=await this.$sdk.content.comparators(),this.$glossary.ensure()},data(){return{comparators:null,model:this.modelValue,criteriaFields:[]}},watch:{"field.referenceType":{async handler(e){e&&await this.$glossary.ensure(e)},immediate:!0},field:{immediate:!0,handler(e){e&&e.translationDisabled?this.model.translationDisabled=!0:delete this.model.translationDisabled}},useTime(e){if(e)this.model.options||(this.model.options={}),this.model.options.useTime=!0;else{if(!this.model.options)return;delete this.model.options.useTime}},modelValue(e){e!=this.model&&(this.model=e)},fieldType(e,n){n&&(this.model.comparator=void 0)},modelKey:{handler(e,n){const r=this.field;if(!n&&e&&r){switch(e){case"_dob":this.model.comparator="anniversarybetween";return;case"_age":this.model.comparator="between";return}switch(r.type){case"date":this.model.comparator="datebetween";break;case"number":case"integer":case"decimal":case"float":this.model.comparator="equal";break;default:switch(r.widget){case"timezone":case"country":this.model.comparator="equal";break;default:this.model.comparator="in";break}break}if(this.extraCriteria){var i=(r.titles||[])[1];this.model.title=`Filter (${i||r.title})`}else this.model.title=`Filter (${r.title})`;this.model.type=r.type}n&&r&&(this.model.value=void 0,this.model.value2=void 0,this.model.values=[])}},checkCriteriaType:{immediate:!0,handler(){var i;const e=this,n=e.extraCriteria;let r=[];if(n){const s=e.glossary,o=(i=e.field)==null?void 0:i.referenceType;let l=s[o];if(l){let a=l.fields||[],c=[];switch(o){case"assignment":c=cf(e);break;case"checkin":c=af(e);break}a=[...a,...c],r=[...a.filter(function(u){switch(u.key){case"organisation":case"reference":case"referenceType":return!1}return!0}),{title:"",key:"data",type:"group",asObject:!0,minimum:1,maximum:1,fields:[...l.definedFields||[]]}]}switch(r=e.$sdk.utils.mapFields(r,{includeArrayDelimeter:!0}),o){case"stat":r=[{title:"User",key:"p",minimum:1,maximum:0,type:"reference",referenceType:"persona"},{title:"Reaction",key:"k",minimum:1,maximum:0,type:"string",widget:"select",options:[{title:"Like",value:"_like"},{title:"Dislike",value:"_dislike"},{title:"Upvote",value:"_upvote"},{title:"Downvote",value:"_downvote"},{title:"Subscribe",value:"_subscribe"},{title:"Unsubscribe",value:"_unsubscribe"}]}];break;case"blockout":r=[{title:"Start",key:"startDate",type:"date",minimum:0,maximum:1},{title:"End",key:"endDate",type:"date",minimum:0,maximum:1},{title:"Reason / Title",key:"title",type:"string",minimum:0,maximum:1}];break}e.model.renderer="complex"}else e.model.renderer==="complex"&&(e.model.renderer=void 0);e.criteriaFields=r}}},computed:{glossary(){return this.$glossary.hash},checkCriteriaType(){return[this.extraCriteria,this.referenceType]},modelKey(){return this.model.key},useTime(){switch(this.model.type){case"date":case"daterange":if(!this.showDateOnly)return!0;break}},singleValueTransformer:{get(){return[this.model.value].filter(Boolean)},set(e){this.model.value=e[0]}},extraCriteria(){return this.field&&this.field.path&&this.field.path.startsWith("join_")&&this.field.path.endsWith(".total")},showSelectOptions(){var e;return!(!this.hasOptions||(e=this.comparator)!=null&&e.freeform)},hasOptions(){return!!(this.field&&this.field.options&&this.field.options.length)},fieldHash(){return this.fields.reduce(function(e,n){return e[n.path||n.key]=n,e},{})},keyOptions(){return this.fields.reduce(function(n,r,i){switch(r.type){case"object":case"group":break;default:let s=r.title,o=r.titles||[r.title];const l=r.path||r.key;switch(l){case"meta.status":s="Status",o=[s];break;case"meta.scopes":s="Scopes",o=[s];break;case"meta.tags":s="Tags",o=[s];break;default:r.filterTitle?s=r.filterTitle:o&&o.length&&(s=o.filter(Boolean).join(" › "));break}if(!r.filterDisabled){const a={title:s,value:l,group:"All"};if(o&&o.length>1){const c=(a.title=o.filter(Boolean).join(" › "))||"";a.group=c.split(" › ")[0]||"All",a.title=c}n.push(a)}break}return n},[])},keyField(){return{minimum:1,maximum:1,options:this.keyOptions,sorted:!0}},field(){return this.fieldHash[this.model.key]},fieldWidget(){var e,n;if((e=this.comparator)!=null&&e.inputWidget)return this.comparator.inputWidget;switch((n=this.field)==null?void 0:n.widget){case"country":case"timezone":case"currency":case"timefield":return this.field.widget}},fieldType(){if(this.field)return this.field.type},inputType(){if(this.comparator){var e=this.comparator.inputType;switch(e){case"none":case"range":case"daterange":case"daterelative":case"integer":case"decimal":case"float":case"number":break;case"array":switch(this.fieldType){case"reference":e="multireference";break}break;default:switch(e="normal",this.fieldType){case"reference":case"boolean":case"date":e=this.fieldType;break;case"integer":case"decimal":case"float":case"number":e="number";break}break}return e}},comparator(){return this.comparatorLookup[this.model.comparator]},comparatorLookup(){return this.comparators.hash},comparatorOptions(){const e=this;if(!e.fieldType)return[];var n=e.comparators.available[e.fieldType]||[],r=n.filter(function(i){return i.restrictKey?i.restrictKey.includes(e.model.key):!(i.multipleOnly&&e.field.maximum===1)}).map(function(i){return{title:i.title,value:i.operator}});return r},comparatorField(){return{minimum:1,maximum:1,options:this.comparatorOptions}},referenceType(){if(this.field)return this.field.referenceType},relativeNumberField(){return{type:"integer",maximum:1,minimum:1,placeholder:"0"}},relativePeriodField(){return{type:"string",maximum:1,minimum:1,widget:"select",options:[{title:"Minutes",value:"minutes"},{title:"Hours",value:"hours"},{title:"Days",value:"days"},{title:"Weeks",value:"weeks"},{title:"Months",value:"months"},{title:"Years",value:"years"}]}},inputPlaceholder(){var e;switch(this.model.comparator){case"valuesgreater":case"valuesgreaterequal":case"valueslesser":case"valueslesserequal":return"0"}return(e=this.field)==null?void 0:e.title},showDateOnly(){var n,r;switch(this.model.comparator){case"dateanniversary":case"anniversarybetween":case"datesameday":case"datesamemonth":case"datesameweek":case"datesameyear":return!0}return(n=this.field)!=null&&n.dateOnly?!0:!((r=this.field)!=null&&r.filterIncludeTime)},dateField(){return{type:this.fieldType,maximum:1,minimum:1,placeholder:this.inputPlaceholder,dateOnly:this.showDateOnly}},multiOptionsField(){return{options:this.field.options,widget:"select",type:this.fieldType,maximum:0,minimum:1,placeholder:this.inputPlaceholder,sorted:!0}},singleOptionsField(){return{title:"",options:this.field.options,widget:"select",type:this.fieldType,maximum:1,minimum:0,placeholder:this.inputPlaceholder,sorted:!0}},normalField(){var r,i;const e={},n={};return n.currency=(r=this.field)==null?void 0:r.currency,n.syntax=(i=this.field)==null?void 0:i.syntax,Object.assign(e,{type:this.fieldType,maximum:1,minimum:1,placeholder:this.inputPlaceholder,widget:this.fieldWidget},n)},arrayField(){var e;return{title:(e=this.field)==null?void 0:e.title,hideTitle:!0,type:this.fieldType,maximum:0,minimum:1}},singleReferenceField(){return{type:"reference",referenceType:this.referenceType,maximum:1,minimum:1,create:!1,list:!1}},multiReferenceField(){return{type:"reference",referenceType:this.referenceType,maximum:0,minimum:1,create:!1,list:!1}}},methods:{addCondition(){this.model.conditions||(this.model.conditions=[]),this.model.conditions.push({_guid:Math.random()})},removeCondition(e){this.model.conditions.splice(e,1)}},components:{TextField:Os,CurrencyField:zm,TimeField:Gm,DateField:Wm,NativeSelect:Ke,ContentSelect:Pm,ScopeSelect:qm,CountrySelect:ds,TimezoneSelect:om}},AS=e=>(t.pushScopeId("data-v-d82ed29d"),e=e(),t.popScopeId(),e),LS={key:0,class:"filter-condition"},$S={key:0},PS={key:1},RS={key:2},US={key:3},jS={key:4},qS={key:5},zS={key:6},WS={key:7},HS={key:8},GS={key:9},YS={key:10},JS=AS(()=>t.createElementVNode("label",null,"Where:",-1));function KS(e,n,r,i,s,o){const l=t.resolveComponent("native-select"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("currency-field"),d=t.resolveComponent("timefield"),u=t.resolveComponent("country-select"),m=t.resolveComponent("timezone-select"),f=t.resolveComponent("text-field"),h=t.resolveComponent("time-field"),y=t.resolveComponent("flex-row"),p=t.resolveComponent("date-field"),g=t.resolveComponent("scope-select"),k=t.resolveComponent("content-select"),x=t.resolveComponent("ux-switch"),S=t.resolveComponent("ux-icon"),A=t.resolveComponent("ux-button"),R=t.resolveComponent("filter-condition",!0);return s.comparators?(t.openBlock(),t.createElementBlock("div",LS,[t.createVNode(y,{gap:"",vcenter:""},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(l,{title:"Select field",modelValue:s.model.key,"onUpdate:modelValue":n[0]||(n[0]=C=>s.model.key=C),field:o.keyField},null,8,["modelValue","field"])]),_:1}),s.model.key?(t.openBlock(),t.createBlock(a,{key:0},{default:t.withCtx(()=>[t.createVNode(l,{title:"Select comparator",modelValue:s.model.comparator,"onUpdate:modelValue":n[1]||(n[1]=C=>s.model.comparator=C),field:o.comparatorField},null,8,["modelValue","field"])]),_:1})):t.createCommentVNode("",!0),s.model.key&&s.model.comparator?(t.openBlock(),t.createBlock(a,{key:1},{default:t.withCtx(()=>[o.inputType=="array"?(t.openBlock(),t.createElementBlock("div",$S,[o.showSelectOptions?(t.openBlock(),t.createBlock(l,{key:0,modelValue:s.model.values,"onUpdate:modelValue":n[2]||(n[2]=C=>s.model.values=C),field:o.multiOptionsField},null,8,["modelValue","field"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[o.fieldWidget=="currency"?(t.openBlock(),t.createBlock(c,{key:0,field:o.arrayField,modelValue:s.model.values,"onUpdate:modelValue":n[3]||(n[3]=C=>s.model.values=C)},null,8,["field","modelValue"])):o.fieldWidget=="timefield"?(t.openBlock(),t.createBlock(d,{key:1,field:o.arrayField,modelValue:s.model.values,"onUpdate:modelValue":n[4]||(n[4]=C=>s.model.values=C)},null,8,["field","modelValue"])):o.fieldWidget=="country"?(t.openBlock(),t.createBlock(u,{key:2,field:o.arrayField,modelValue:s.model.values,"onUpdate:modelValue":n[5]||(n[5]=C=>s.model.values=C)},null,8,["field","modelValue"])):o.fieldWidget=="timezone"?(t.openBlock(),t.createBlock(m,{key:3,field:o.arrayField,modelValue:s.model.values,"onUpdate:modelValue":n[6]||(n[6]=C=>s.model.values=C)},null,8,["field","modelValue"])):(t.openBlock(),t.createBlock(f,{key:4,field:o.arrayField,modelValue:s.model.values,"onUpdate:modelValue":n[7]||(n[7]=C=>s.model.values=C)},null,8,["field","modelValue"]))],64))])):t.createCommentVNode("",!0),o.inputType=="range"?(t.openBlock(),t.createElementBlock("div",PS,[o.fieldWidget=="currency"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(c,{field:o.normalField,modelValue:s.model.value,"onUpdate:modelValue":n[8]||(n[8]=C=>s.model.value=C)},null,8,["field","modelValue"]),t.createTextVNode(" And "),t.createVNode(c,{field:o.normalField,modelValue:s.model.value2,"onUpdate:modelValue":n[9]||(n[9]=C=>s.model.value2=C)},null,8,["field","modelValue"])],64)):o.fieldWidget=="timefield"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(h,{field:o.normalField,modelValue:s.model.value,"onUpdate:modelValue":n[10]||(n[10]=C=>s.model.value=C)},null,8,["field","modelValue"]),t.createTextVNode(" And "),t.createVNode(h,{field:o.normalField,modelValue:s.model.value2,"onUpdate:modelValue":n[11]||(n[11]=C=>s.model.value2=C)},null,8,["field","modelValue"])],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createVNode(f,{field:o.normalField,modelValue:s.model.value,"onUpdate:modelValue":n[12]||(n[12]=C=>s.model.value=C)},null,8,["field","modelValue"]),t.createTextVNode(" And "),t.createVNode(f,{field:o.normalField,modelValue:s.model.value2,"onUpdate:modelValue":n[13]||(n[13]=C=>s.model.value2=C)},null,8,["field","modelValue"])],64))])):t.createCommentVNode("",!0),o.inputType=="daterelative"?(t.openBlock(),t.createElementBlock("div",RS,[t.createVNode(y,null,{default:t.withCtx(()=>[t.createVNode(a,{style:{width:"80px"}},{default:t.withCtx(()=>[t.createVNode(f,{field:o.relativeNumberField,modelValue:s.model.value,"onUpdate:modelValue":n[14]||(n[14]=C=>s.model.value=C)},null,8,["field","modelValue"])]),_:1}),t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(l,{modelValue:s.model.value2,"onUpdate:modelValue":n[15]||(n[15]=C=>s.model.value2=C),field:o.relativePeriodField},null,8,["modelValue","field"])]),_:1})]),_:1})])):t.createCommentVNode("",!0),o.inputType=="daterange"?(t.openBlock(),t.createElementBlock("div",US,[t.createVNode(p,{disableTime:o.showDateOnly,field:o.dateField,modelValue:s.model.value,"onUpdate:modelValue":n[16]||(n[16]=C=>s.model.value=C)},null,8,["disableTime","field","modelValue"]),t.createTextVNode(" And "),t.createVNode(p,{disableTime:o.showDateOnly,field:o.dateField,modelValue:s.model.value2,"onUpdate:modelValue":n[17]||(n[17]=C=>s.model.value2=C)},null,8,["disableTime","field","modelValue"])])):t.createCommentVNode("",!0),o.inputType=="date"?(t.openBlock(),t.createElementBlock("div",jS,[t.createVNode(p,{disableTime:o.showDateOnly,field:o.dateField,modelValue:s.model.value,"onUpdate:modelValue":n[18]||(n[18]=C=>s.model.value=C)},null,8,["disableTime","field","modelValue"])])):t.createCommentVNode("",!0),o.inputType=="reference"?(t.openBlock(),t.createElementBlock("div",qS,[s.model.key==="meta.scopes"?(t.openBlock(),t.createBlock(g,{key:0,maximum:1,modelValue:o.singleValueTransformer,"onUpdate:modelValue":n[19]||(n[19]=C=>o.singleValueTransformer=C)},null,8,["modelValue"])):(t.openBlock(),t.createBlock(k,{key:1,field:o.singleReferenceField,modelValue:s.model.value,"onUpdate:modelValue":n[20]||(n[20]=C=>s.model.value=C)},null,8,["field","modelValue"]))])):t.createCommentVNode("",!0),o.inputType=="multireference"?(t.openBlock(),t.createElementBlock("div",zS,[s.model.key==="meta.scopes"?(t.openBlock(),t.createBlock(g,{key:0,modelValue:s.model.values,"onUpdate:modelValue":n[21]||(n[21]=C=>s.model.values=C)},null,8,["modelValue"])):(t.openBlock(),t.createBlock(k,{key:1,field:o.multiReferenceField,modelValue:s.model.values,"onUpdate:modelValue":n[22]||(n[22]=C=>s.model.values=C)},null,8,["field","modelValue"]))])):t.createCommentVNode("",!0),o.inputType=="boolean"?(t.openBlock(),t.createElementBlock("div",WS,[t.createVNode(y,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(a,{shrink:""},{default:t.withCtx(()=>[t.createVNode(x,{onClick:n[23]||(n[23]=C=>s.model.value=!s.model.value),value:s.model.value},null,8,["value"])]),_:1}),t.createVNode(a,null,{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(s.model.value?"True":"False"),1)]),_:1})]),_:1})])):t.createCommentVNode("",!0),o.inputType=="none"?(t.openBlock(),t.createElementBlock("div",HS)):t.createCommentVNode("",!0),o.inputType=="number"?(t.openBlock(),t.createElementBlock("div",GS,[o.fieldWidget=="currency"?(t.openBlock(),t.createBlock(c,{key:0,field:o.normalField,modelValue:s.model.value,"onUpdate:modelValue":n[24]||(n[24]=C=>s.model.value=C)},null,8,["field","modelValue"])):o.fieldWidget=="timefield"?(t.openBlock(),t.createBlock(h,{key:1,field:o.normalField,modelValue:s.model.value,"onUpdate:modelValue":n[25]||(n[25]=C=>s.model.value=C)},null,8,["field","modelValue"])):(t.openBlock(),t.createBlock(f,{key:2,field:o.normalField,modelValue:s.model.value,"onUpdate:modelValue":n[26]||(n[26]=C=>s.model.value=C)},null,8,["field","modelValue"]))])):t.createCommentVNode("",!0),o.inputType=="normal"?(t.openBlock(),t.createElementBlock("div",YS,[o.showSelectOptions?(t.openBlock(),t.createBlock(l,{key:0,modelValue:s.model.value,"onUpdate:modelValue":n[27]||(n[27]=C=>s.model.value=C),field:o.singleOptionsField},null,8,["modelValue","field"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[o.fieldWidget=="country"?(t.openBlock(),t.createBlock(u,{key:0,field:o.normalField,modelValue:s.model.value,"onUpdate:modelValue":n[28]||(n[28]=C=>s.model.value=C)},null,8,["field","modelValue"])):o.fieldWidget=="timezone"?(t.openBlock(),t.createBlock(m,{key:1,field:o.normalField,modelValue:s.model.value,"onUpdate:modelValue":n[29]||(n[29]=C=>s.model.value=C)},null,8,["field","modelValue"])):(t.openBlock(),t.createBlock(f,{key:2,field:o.normalField,modelValue:s.model.value,"onUpdate:modelValue":n[30]||(n[30]=C=>s.model.value=C)},null,8,["field","modelValue"]))],64))])):t.createCommentVNode("",!0)]),_:1})):t.createCommentVNode("",!0),r.enableRemove?(t.openBlock(),t.createBlock(a,{key:2,shrink:""},{default:t.withCtx(()=>[t.createVNode(A,{size:"sm",icon:"",onClick:n[31]||(n[31]=C=>e.$emit("remove"))},{default:t.withCtx(()=>[t.createVNode(S,{icon:"fa-times"})]),_:1})]),_:1})):t.createCommentVNode("",!0)]),_:1}),o.extraCriteria?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[JS,(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.model.conditions,(C,D)=>(t.openBlock(),t.createElementBlock("div",{key:C._guid},[t.createVNode(R,{enableRemove:!0,fields:s.criteriaFields,onRemove:I=>o.removeCondition(D),modelValue:s.model.conditions[D],"onUpdate:modelValue":I=>s.model.conditions[D]=I},null,8,["fields","onRemove","modelValue","onUpdate:modelValue"])]))),128)),t.createVNode(A,{size:"sm",onClick:t.withModifiers(o.addCondition,["stop","prevent"])},{default:t.withCtx(()=>[t.createTextVNode(" Add Criteria "),t.createVNode(S,{icon:"fa-plus",right:""})]),_:1},8,["onClick"])],64)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)}const ZS=w(IS,[["render",KS],["__scopeId","data-v-d82ed29d"]]);function XS(e,n){let r=[];if(n.length){var i={title:"Form Data",minimum:1,maximum:1,key:"formData",asObject:!0,type:"group",fields:n};r.push(i);var s={title:"Data",minimum:1,maximum:1,key:"data",asObject:!0,type:"group",fields:n.map(function(l){return l.type==="reference"&&(l=JSON.parse(JSON.stringify(l)),delete l.fields),l})};r.push(s)}return r}function QS(e,n){if(!e.glossary)return;const r=Object.entries(e.glossary).reduce(function(o,[l,a]){return a.definesType==="workflowcard"&&a.key!=e.definition.key&&o.push(a),o},[]);if((e.definition.definesType||e.definition.key)==="workflowcard")return;const s={title:"Workflow",minimum:1,maximum:1,key:"join_workflow",asObject:!0,type:"group",fields:[]};(r||[]).forEach(function(o){[...(o.fields||[]).map(function(a){let c;switch(a.key){case"step":case"due":c=a;break;case"meta":c=JSON.parse(JSON.stringify(a)),c.fields=c.fields.filter(function({key:d}){switch(d){case"status":case"scopes":case"tags":case"updated":case"created":case"status":return!0}});break}return c}).filter(Boolean),o.definedFields],s.fields.push({title:`${o.title}`,minimum:1,maximum:1,key:o.key,asObject:!0,type:"group",fields:[{title:"Cards",minimum:1,maximum:1,key:"total",type:"integer",referenceType:o.key}]})}),n.push(s)}function vS(e,n){if(!e.glossary)return;const r=Object.entries(e.glossary).reduce(function(s,[o,l]){return(l.definesType==="comment"||l.key==="comment")&&s.push(l),s},[]);if(!r.length)return;const i={title:"Comments",minimum:1,maximum:1,key:"join_comment",asObject:!0,type:"group",fields:[]};r.forEach(function(s){[...(s.fields||[]).map(function(l){let a;switch(l.key){case"reference":case"referenceType":case"organisation":return!1;case"meta":a=JSON.parse(JSON.stringify(l)),a.fields=a.fields.filter(function({key:c}){switch(c){case"status":case"scopes":case"tags":case"updated":case"created":return!0}});break}return a}).filter(Boolean),s.definedFields],i.fields.push({title:`${s.plural}`,minimum:1,maximum:1,key:s.key,asObject:!0,type:"group",fields:[{title:"Total",minimum:1,maximum:1,key:"total",type:"integer",referenceType:s.key}]})}),n.push(i)}function eT(e,n){const r={title:"Reactions",minimum:1,maximum:1,key:"join_stats",asObject:!0,type:"group",fields:[{title:"All",minimum:1,maximum:1,key:"total",type:"integer",referenceType:"stat"}]};n.push(r)}function tT(e,n){const r=["Like","Dislike","Upvote","Downvote","Subscribe","Unsubscribe"].map(function(o){return{title:`${o}s`,key:`_${o.toLowerCase()}`}}),i={title:"Reactions",minimum:1,maximum:1,key:"meta.stats",asObject:!0,type:"group",fields:[]};r.forEach(function({title:o,key:l}){i.fields.push({title:`All ${o}`,minimum:1,maximum:1,key:l,type:"integer"})}),n.push(i);const s={title:"Reactions",minimum:1,maximum:1,key:"_stat",asObject:!0,type:"group",fields:[]};r.forEach(function({title:o,key:l}){s.fields.push({title:`Your ${o}`,minimum:1,maximum:1,key:l,type:"integer"})}),n.push(s)}function nT(e,n){if(!e.glossary)return;const r=Object.entries(e.glossary).reduce(function(i,[s,o]){return o.definesType==="scope"&&o.key!=e.definition.key&&i.push(o),i},[]);r.length&&r.forEach(function(i){n.push({title:`${i.plural}`,minimum:0,maximum:0,key:`meta.scopes|${i.key}`,type:"reference",referenceType:i.key})})}function rT(e,n){if(!e.glossary)return;const r=Object.entries(e.glossary).reduce(function(i,[s,o]){return o.definesType==="tag"&&o.key!=e.definition.key&&i.push(o),i},[]);r.length&&r.forEach(function(i){n.push({title:`${i.plural}`,minimum:0,maximum:0,key:`meta.tags|${i.key}`,type:"reference",referenceType:i.key})})}function oT(e){let n=[];return QS(e,n),vS(e,n),nT(e,n),rT(e,n),tT(e,n),eT(e,n),n}const iT={emits:["remove"],props:{enableRemove:{type:Boolean},definition:{type:Object,required:!0,default(){return{}}},modelValue:{type:Object,default(){return{operator:"and",filters:[]}}}},methods:{isType(e){const n=this;return n.definition.definesType===e||n.definition.key===e},addCondition(){const e=this;e.model.filters.push({guid:e.$sdk.utils.guid()})},removeCondition(e){this.model.filters.splice(e,1)}},data(){return this.modelValue.operator||(this.modelValue.operator="and"),this.modelValue.filters||(this.modelValue.filters=[]),{model:JSON.parse(JSON.stringify(this.modelValue))}},created(){this.$glossary.ensure()},watch:{modelValue(e){e!=this.model&&(this.model=e)},model:{handler:Tn(function(e){this.$emit("update:modelValue",e)},200),deep:!0}},computed:{glossary(){return this.$glossary.hash},summary(){switch(this.model.operator){case"or":return"any";case"nor":return"none";default:return"all"}},fields(){const e=this;var n=e.definition&&e.definition.fields?[...e.definition.fields]:[],r=e.definition&&e.definition.definedFields?e.definition.definedFields:[];n=[...n,...oT(e)];const i=e.definition.definesType==="submission";if(e.isType("profile")){const l=FS(e);n=[...n,...l]}if(e.isType("checkin")){const l=af(e);n=[...n,...l]}if(e.isType("assignment")){const l=cf(e);n=[...n,...l]}if(r.length)if(i){const l=XS(e,r);n=[...n,...l]}else{var s={title:`${e.definition.title}`,minimum:1,maximum:1,key:"data",asObject:!0,type:"group",fields:r};n.push(s)}var o=e.$sdk.utils.mapFields(n,{includeArrayDelimeter:!0});return o},operatorField(){return{minimum:1,maximum:1,options:[{title:"All",value:"and"},{title:"Any",value:"or"},{title:"None",value:"nor"}]}}},components:{FilterCondition:ZS,NativeSelect:Ke}},sT=e=>(t.pushScopeId("data-v-497fdd88"),e=e(),t.popScopeId(),e),lT={key:0,class:"filter-rule"},aT={class:"top"},cT={class:"summary"},dT=sT(()=>t.createElementVNode("span",{class:"line"},null,-1)),uT={class:"operator"};function mT(e,n,r,i,s,o){const l=t.resolveComponent("native-select"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-icon"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row"),m=t.resolveComponent("filter-condition");return r.definition?(t.openBlock(),t.createElementBlock("div",lT,[t.createElementVNode("div",aT,[t.createVNode(u,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createElementVNode("div",cT,[t.createTextVNode(" Match "),t.createVNode(l,{modelValue:s.model.operator,"onUpdate:modelValue":n[0]||(n[0]=f=>s.model.operator=f),field:o.operatorField},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.summary),1)]),_:1},8,["modelValue","field"]),t.createTextVNode(" of the following conditions ")])]),_:1}),r.enableRemove?(t.openBlock(),t.createBlock(a,{key:0,onClick:n[1]||(n[1]=f=>e.$emit("remove")),shrink:""},{default:t.withCtx(()=>[t.createVNode(d,{size:"sm",icon:""},{default:t.withCtx(()=>[t.createVNode(c,{icon:"fa-trash"})]),_:1})]),_:1})):t.createCommentVNode("",!0)]),_:1})]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.model.filters,(f,h)=>(t.openBlock(),t.createBlock(u,{key:`condition-${h}-${f._guid}`},{default:t.withCtx(()=>[h!=0?(t.openBlock(),t.createBlock(a,{key:0,class:t.normalizeClass(["operator-cell",[s.model.operator,{last:h==s.model.filters.length}]]),vcenter:"",shrink:""},{default:t.withCtx(()=>[dT,t.createElementVNode("div",uT,t.toDisplayString(s.model.operator),1)]),_:2},1032,["class"])):t.createCommentVNode("",!0),t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(m,{enableRemove:s.model.filters.length>1,fields:o.fields,onRemove:y=>o.removeCondition(h),modelValue:s.model.filters[h],"onUpdate:modelValue":y=>s.model.filters[h]=y},null,8,["enableRemove","fields","onRemove","modelValue","onUpdate:modelValue"])]),_:2},1024)]),_:2},1024))),128)),t.createVNode(d,{size:"sm",onClick:o.addCondition},{default:t.withCtx(()=>[t.createTextVNode(" Add Condition "),t.createVNode(c,{icon:"fa-plus",right:""})]),_:1},8,["onClick"])])):t.createCommentVNode("",!0)}const fT={components:{FilterRule:w(iT,[["render",mT],["__scopeId","data-v-497fdd88"]]),NativeSelect:Ke},methods:{removeRule(e){this.model.filters&&this.model.filters.splice(e,1)},addRule(){const e=this;e.model.filters||(e.model.filters=[]),e.model.operator||(e.model.operator="and"),e.model.filters.push({guid:e.$sdk.utils.guid(),operator:"and",filters:[{}]})}},computed:{summary(){switch(this.model.operator){case"or":return"any";case"nor":return"none";default:return"all"}},operatorField(){return{minimum:1,maximum:1,options:[{title:"All",value:"and"},{title:"Any",value:"or"},{title:"None",value:"nor"}]}}},watch:{modelValue:{handler(e){var n=JSON.stringify(this.model),r=JSON.stringify(e);if(n!=r){var i=JSON.parse(r);this.model=i}},immediate:!0},model:{handler:Tn(function(e){e=JSON.parse(JSON.stringify(e)),this.$emit("update:modelValue",e)},100),deep:!0,immediate:!0}},props:{definition:{type:Object,required:!0},modelValue:{type:Object,default(){return{operator:"and",filters:[{operator:"and",filters:[]}]}}}},data(){return{model:JSON.parse(JSON.stringify(this.modelValue))}}},hT={class:"filters"},pT={key:0,class:"top"},yT={class:"summary"};function gT(e,n,r,i,s,o){const l=t.resolveComponent("native-select"),a=t.resolveComponent("filter-rule"),c=t.resolveComponent("ux-button"),d=t.resolveComponent("flex-body"),u=t.resolveComponent("flex-column");return t.openBlock(),t.createBlock(u,{class:"filter-builder"},{default:t.withCtx(()=>[t.createVNode(d,null,{default:t.withCtx(()=>[t.createElementVNode("div",hT,[s.model&&s.model.filters&&s.model.filters.length>1?(t.openBlock(),t.createElementBlock("div",pT,[t.createElementVNode("div",yT,[t.createTextVNode(" Match "),t.createVNode(l,{modelValue:s.model.operator,"onUpdate:modelValue":n[0]||(n[0]=m=>s.model.operator=m),field:o.operatorField},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.summary),1)]),_:1},8,["modelValue","field"]),t.createTextVNode(" of the following rules ")])])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.model.filters,(m,f)=>(t.openBlock(),t.createBlock(a,{enableRemove:"",key:`rule-${f}-${m.guid}`,onRemove:h=>o.removeRule(f),definition:r.definition,modelValue:s.model.filters[f],"onUpdate:modelValue":h=>s.model.filters[f]=h,index:f},null,8,["onRemove","definition","modelValue","onUpdate:modelValue","index"]))),128)),t.createVNode(c,{size:"sm",onClick:n[1]||(n[1]=m=>o.addRule())},{default:t.withCtx(()=>[t.createTextVNode("Add Filter Rule")]),_:1})])]),_:1})]),_:1})}const df=w(fT,[["render",gT],["__scopeId","data-v-6c52f8af"]]),kT={mixins:[z],components:{FilterBuilder:df},props:{modelValue:{type:Object}},data(){return{definition:null}},watch:{"field.referenceType":{handler:async function(e){if(!e)return this.definition=null;await this.$glossary.ensure(e),this.definition=this.$glossary.hash[e]},immediate:!0}},computed:{definitionTitle(){const e=this.definition?this.definition.title:"";return(this.definition?this.definition.plural:"")||e}},methods:{getNewDefaultEntry(){return{operator:"and",filters:[]}}}},_T={key:0,class:"ux-field-title"},wT={key:0,class:"ux-required-marker"},xT={key:1,class:"ux-field-description"},bT={key:2};function CT(e,n,r,i,s,o){const l=t.resolveComponent("filter-builder"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-icon"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",_T,[t.createTextVNode(t.toDisplayString(e.label)+" ("+t.toDisplayString(o.definitionTitle)+") ",1),e.required?(t.openBlock(),t.createElementBlock("span",wT,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",xT,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",bT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.model,(m,f)=>(t.openBlock(),t.createBlock(u,{class:"ux-text-row",key:f},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(l,{definition:s.definition,modelValue:e.model[f],"onUpdate:modelValue":h=>e.model[f]=h},null,8,["definition","modelValue","onUpdate:modelValue"])]),_:2},1024),t.createVNode(a,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(d,{key:0,tag:"a",icon:"",onClick:h=>e.remove(m)},{default:t.withCtx(()=>[t.createVNode(c,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(d,{key:0,size:"sm",onClick:n[0]||(n[0]=m=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createBlock(l,{key:3,definition:s.definition,modelValue:e.model,"onUpdate:modelValue":n[1]||(n[1]=m=>e.model=m)},null,8,["definition","modelValue"]))],64)}const VT=w(kT,[["render",CT],["__scopeId","data-v-5ca20810"]]),NT={components:{},methods:{injectToken(e){const n=this.$refs.editor;n&&n.inject(e)},focussed(){const e=this;e.timer&&(clearTimeout(e.timer),e.timer=null)},blurred(){const e=this;e.timer=setTimeout(function(){e.format()},100)},format(){if(typeof window!==void 0){var e=this.model;if(e){switch(this.lang){case"js":case"javascript":window.js_beautify&&(e=window.js_beautify(e));break;case"json":try{const n=JSON.parse(e);e=JSON.stringify(n,null,4)}catch(n){console.error("Unable to format invalid JSON string:",n)}break;case"css":case"scss":window.css_beautify&&(e=window.css_beautify(e));break;case"html":window.html_beautify&&(e=window.html_beautify(e));break;default:return}this.model=e}}}},props:{modelValue:{type:String,default(){return""}},tokens:{type:Array,default(){return[]}},lang:{type:String},readonly:{type:Boolean},singleLine:{type:Boolean}},watch:{modelValue(e){this.model=e},model(e){this.$emit("update:modelValue",e)},async formatReady(){if(this.mounted&&!(!this.$sdk.global||!this.$sdk.global.injectScript))switch(this.lang){case"js":case"javascript":await this.$sdk.global.injectScript("https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.5/beautify.min.js");break;case"css":case"scss":await this.$sdk.global.injectScript("https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.5/beautify-css.min.js");break;case"html":await this.$sdk.global.injectScript("https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.5/beautify-html.min.js");break}}},unmounted(){this.editor=null},mounted(){this.mounted=!0},computed:{formatReady(){return`${this.mounted}-${this.lang}`}},data(){return{showTokens:!1,timer:null,mounted:!1,model:this.modelValue,editor:null,selectionContext:{}}}},ET={key:0,class:"tokens"},BT={key:0,class:"tokens-body"};function ST(e,n,r,i,s,o){const l=t.resolveComponent("flex-cell"),a=t.resolveComponent("ux-icon"),c=t.resolveComponent("flex-row"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("qik-code-editor"),m=t.resolveComponent("flex-column");return s.mounted?(t.openBlock(),t.createBlock(m,{key:0,class:"ux-code-editor"},{default:t.withCtx(()=>[r.tokens.length?(t.openBlock(),t.createElementBlock("div",ET,[t.createElementVNode("div",{class:"tokens-header",onClick:n[0]||(n[0]=f=>s.showTokens=!s.showTokens)},[t.createVNode(c,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(s.showTokens?"Hide":"Show")+" Tokens ",1)]),_:1}),t.createVNode(l,{shrink:""},{default:t.withCtx(()=>[t.createVNode(a,{icon:s.showTokens?"fa-angle-up":"fa-angle-right"},null,8,["icon"])]),_:1})]),_:1})]),s.showTokens?(t.openBlock(),t.createElementBlock("div",BT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.tokens,f=>(t.openBlock(),t.createBlock(d,{size:"xs",onClick:t.withModifiers(h=>o.injectToken(f.value),["stop","prevent"])},{default:t.withCtx(()=>[t.createVNode(a,{icon:"fa-asterisk"}),t.createTextVNode(" "+t.toDisplayString(f.title),1)]),_:2},1032,["onClick"]))),256))])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createVNode(u,{ref:"editor",syntax:r.lang,onBlur:o.blurred,onFocus:o.focussed,readonly:r.readonly,singleLine:r.singleLine,class:"editor-wrap",modelValue:s.model,"onUpdate:modelValue":n[1]||(n[1]=f=>s.model=f),style:{height:"300px"}},null,8,["syntax","onBlur","onFocus","readonly","singleLine","modelValue"])]),_:1})):t.createCommentVNode("",!0)}const js=w(NT,[["render",ST],["__scopeId","data-v-a1601d1d"]]);function TT(e){return e===void 0||typeof e>"u"||e===null||String(e)==="null"||String(e)==="undefined"}const DT={props:{title:{type:String},modelValue:{}},components:{NativeSelect:Ke,CodeEditor:js},mixins:[z],async created(){this.model=this.model},watch:{referenceType:{async handler(e){const n=this;await this.$glossary.ensure(e),n.definition=this.$glossary.hash[e]},immediate:!0}},data(){return{types:[],definition:null,customKey:!1}},methods:{toggleCustomKey(){this.customKey=!this.customKey},cleanOutput(e){var n=this;return TT(e)?n.multiValue?e=[]:e=void 0:n.multiValue?e=(e||[]).filter(Boolean).map(function(r){return n.getValue(r)}):e=n.getValue(e),e},cleanInput(e){var n=this;if(n.multiValue)e||(e=[]),Array.isArray(e)||(e=[e]),n.maximum&&e.length>n.maximum&&(e.length=n.maximum),e=e.filter(Boolean).map(function(i){var s=n.getValue(i);return n.returnObject?n.optionLookup[s]:s});else{var r=n.getValue(e);e=n.returnObject?n.optionLookup[r]:r}return e}},computed:{actualField(){const e={...this.field,options:this.selectableOptions};return delete e.title,delete e.description,e},showNoneOption(){return this.singleValue&&!this.minimum?this.selectableOptions.find(function(r){return r.none})?(console.log("has custom none option"),!1):!0:!1},fields(){var d;const e=this,n=e.definition,r=(d=e.field)==null?void 0:d.contextDefinition;if(!n)return[];if(e.$sdk.utils.getAllFields)return e.$sdk.utils.getAllFields(n);const i=n.definesType==="submission";var s=[...n.fields],o=r?r.fields:n.definedFields||[];if(o.length)if(i){var l={title:"Form Data",minimum:1,maximum:1,key:"formData",asObject:!0,type:"group",fields:o};s.push(l);var a={title:"Data",minimum:1,maximum:1,key:"data",asObject:!0,type:"group",fields:o.map(function(m){return m.type==="reference"&&(m=JSON.parse(JSON.stringify(m)),delete m.fields),m})};s.push(a)}else{var a={title:`${n.title}`,minimum:1,maximum:1,key:"data",asObject:!0,type:"group",fields:o};s.push(a)}var c=e.$sdk.utils.mapFields(s).filter(function(u){if(u.trail[0]==="fields")return!1;var m=u.type=="group"&&u.asObject&&u.minimum==1&&u.maximum==1;return!m}).map(function(u){return u.title=u.titles.join(" › "),u}).sort(function(u,m){return u.title<m.title?-1:1});return c},fieldOptions(){return this.fields.map(function(n){return{title:n.title,value:n.path,none:n.none}})},referenceType(){return this.field.referenceType},returnObject(){return!1},classes(){var e=[];return this.multiValue?e.push("multiple"):e.push("single"),e},optionLookup(){var e=this;return e.fieldOptions.reduce(function(n,r){const i=e.getValue(r);return n[i]=r,n},{})},summary(){const e=this.getLabel(this.optionLookup[this.model])||this.model;return this.model?e:this.title||"Click to select"},selectableOptions(){return this.fieldOptions}}},OT={key:0,class:"ux-field-title"},MT={key:0,class:"ux-required-marker"},FT={key:1,class:"ux-field-description"},IT={class:"ui-select-button"},AT={key:0,value:""},LT=["value"];function $T(e,n,r,i,s,o){const l=t.resolveComponent("code-editor"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-button"),d=t.resolveComponent("ux-icon"),u=t.resolveComponent("flex-row"),m=t.resolveComponent("native-select");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["native-select",o.classes])},[e.showLabel?(t.openBlock(),t.createElementBlock("label",OT,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",MT,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",FT,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.singleValue?(t.openBlock(),t.createBlock(u,{key:2,gap:"",center:""},{default:t.withCtx(()=>[s.customKey?(t.openBlock(),t.createBlock(a,{key:0},{default:t.withCtx(()=>[t.createVNode(l,{singleLine:"",class:"ux-code-editor ux-field-focus ux-text-area-single",onFocus:e.touch,modelValue:e.model,"onUpdate:modelValue":n[0]||(n[0]=f=>e.model=f)},null,8,["onFocus","modelValue"])]),_:1})):(t.openBlock(),t.createBlock(a,{key:1},{default:t.withCtx(()=>[t.createElementVNode("div",null,[t.createElementVNode("div",IT,[t.renderSlot(e.$slots,"default",{},()=>[t.createVNode(c,{tag:"div"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.summary),1)]),_:1})],!0)]),t.withDirectives(t.createElementVNode("select",{onFocus:n[1]||(n[1]=(...f)=>e.touch&&e.touch(...f)),"onUpdate:modelValue":n[2]||(n[2]=f=>e.model=f)},[o.showNoneOption?(t.openBlock(),t.createElementBlock("option",AT,"None")):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.selectableOptions,f=>(t.openBlock(),t.createElementBlock("option",{value:f.value},t.toDisplayString(f.title),9,LT))),256))],544),[[t.vModelSelect,e.model]])])]),_:3})),t.createVNode(a,{shrink:""},{default:t.withCtx(()=>[t.createVNode(c,{icon:"",size:"sm",onClick:o.toggleCustomKey},{default:t.withCtx(()=>[t.createVNode(d,{icon:s.customKey?"far fa-hand-pointer":"far fa-pen-to-square"},null,8,["icon"])]),_:1},8,["onClick"])]),_:1})]),_:3})):(t.openBlock(),t.createBlock(m,{key:3,pills:"",onTouched:e.touch,field:o.actualField,modelValue:e.model,"onUpdate:modelValue":n[3]||(n[3]=f=>e.model=f)},null,8,["onTouched","field","modelValue"]))],2)}const uf=w(DT,[["render",$T],["__scopeId","data-v-7a914d2a"]]);function PT(e,n,r){return e+(n-e)*(r/100)}const RT={props:{modelValue:{type:Number},min:{type:Number,default:0},step:{type:Number,default:1},max:{type:Number,default:100},prefix:{type:String,default:""},suffix:{type:String,default:""}},data(){return{model:this.modelValue}},watch:{model(e,n){this.$emit("update:modelValue",Number(e))}},mounted(){this.attachListeners()},beforeUnmount(){this.detachListeners()},methods:{inputReceived(e){const n=this,r=n.$refs.range,i=n.$refs.bubble,s=r.value,o=r.min?r.min:0,l=r.max?r.max:100;let a=Number((s-o)*100/(l-o));a=PT(1,99,a),i.innerHTML=`${n.prefix}${s}${n.suffix}`,i.style.left=`${a}%`},attachListeners(){const e=this,n=e.$refs.range;e.$refs.bubble,n.addEventListener("input",e.inputReceived)},detachListeners(){const e=this,n=e.$refs.range;e.$refs.bubble,n.addEventListener("input",e.inputReceived)}}},UT={class:"ux-range-slider-wrap"},jT=["min","step","max"],qT={ref:"bubble",class:"ux-range-bubble"};function zT(e,n,r,i,s,o){return t.openBlock(),t.createElementBlock("div",UT,[t.withDirectives(t.createElementVNode("input",{ref:"range",min:r.min,step:r.step,max:r.max,"onUpdate:modelValue":n[0]||(n[0]=l=>s.model=l),type:"range",class:"ux-range-slider"},null,8,jT),[[t.vModelText,s.model]]),t.createElementVNode("output",qT,null,512)])}const WT={components:{RangeSlider:w(RT,[["render",zT],["__scopeId","data-v-639c59a6"]])},props:{modelValue:{type:[String,Array]}},computed:{sliderPrefix(){return this.field.prefix||""},sliderSuffix(){return this.field.suffix||""},sliderStepValue(){return parseFloat(this.field.stepValue)||1},minSliderValue(){return parseFloat(this.field.minValue)||0},maxSliderValue(){return parseFloat(this.field.maxValue)||100}},mixins:[z],methods:{getNewDefaultEntry(){return""}}},HT={key:0,class:"ux-field-title"},GT={key:0,class:"ux-required-marker"},YT={key:1,class:"ux-field-description"},JT={key:2},KT={class:"ux-slider-limit ux-slider-limit-value"},ZT={class:"ux-slider-limit ux-slider-limit-value"};function XT(e,n,r,i,s,o){const l=t.resolveComponent("range-slider"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("flex-row"),d=t.resolveComponent("ux-icon"),u=t.resolveComponent("ux-button");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",HT,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",GT,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",YT,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",JT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.model,(m,f)=>(t.openBlock(),t.createBlock(c,{class:"ux-slider-row",key:f},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(c,{center:"",gap:""},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(l,{type:"range",min:o.minSliderValue,step:o.sliderStepValue,prefix:o.sliderPrefix,suffix:o.sliderSuffix,max:o.maxSliderValue,modelValue:e.model[f],"onUpdate:modelValue":h=>e.model[f]=h,class:"ux-slider"},null,8,["min","step","prefix","suffix","max","modelValue","onUpdate:modelValue"])]),_:2},1024),t.createVNode(a,{shrink:""},{default:t.withCtx(()=>[t.createElementVNode("span",KT,t.toDisplayString(o.sliderPrefix)+t.toDisplayString(e.model[f])+t.toDisplayString(o.sliderSuffix),1)]),_:2},1024)]),_:2},1024)]),_:2},1024),t.createVNode(a,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(u,{key:0,tag:"a",icon:"",onClick:h=>e.remove(m)},{default:t.withCtx(()=>[t.createVNode(d,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(u,{key:0,onClick:n[0]||(n[0]=m=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createBlock(c,{key:3,center:"",gap:""},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(l,{type:"range",min:o.minSliderValue,step:o.sliderStepValue,prefix:o.sliderPrefix,suffix:o.sliderSuffix,max:o.maxSliderValue,modelValue:e.model,"onUpdate:modelValue":n[1]||(n[1]=m=>e.model=m),class:"ux-slider"},null,8,["min","step","prefix","suffix","max","modelValue"])]),_:1}),t.createVNode(a,{shrink:""},{default:t.withCtx(()=>[t.createElementVNode("span",ZT,t.toDisplayString(o.sliderPrefix)+t.toDisplayString(e.model)+t.toDisplayString(o.sliderSuffix),1)]),_:1})]),_:1}))],64)}const QT=w(WT,[["render",XT],["__scopeId","data-v-ae8ff721"]]),vT={props:{modelValue:{type:String}},mixins:[z],methods:{cleanInputValue(e){return e},cleanOutputValue(e){return!e||(String(e)[0]==="#"&&(e=e.slice(1)),e=e||"",e.length===3&&(e=`${e[0]}${e[0]}${e[1]}${e[1]}${e[2]}${e[2]}`),!e)?e:`#${e}`},getNewDefaultEntry(){return""}}},eD={key:0,class:"ux-field-title"},tD={key:0,class:"ux-required-marker"},nD={key:1,class:"ux-field-description"},rD={key:2},oD=["onUpdate:modelValue"],iD=["onUpdate:modelValue"];function sD(e,n,r,i,s,o){const l=t.resolveComponent("flex-cell"),a=t.resolveComponent("ux-icon"),c=t.resolveComponent("ux-button"),d=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",eD,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",tD,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",nD,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",rD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.model,(u,m)=>(t.openBlock(),t.createBlock(d,{class:"ux-text-row",gap:"",key:m},{default:t.withCtx(()=>[t.createVNode(l,{shrink:""},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("input",{type:"color",class:"ux-field-focus ux-color-input ux-color-input-multiple",onFocus:n[0]||(n[0]=(...f)=>e.touch&&e.touch(...f)),ref_for:!0,ref:"input","onUpdate:modelValue":f=>e.model[m]=f},null,40,oD),[[t.vModelText,e.model[m]]])]),_:2},1024),t.createVNode(l,null,{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("input",{type:"text",class:"ux-field-focus ux-text-input-multiple",onFocus:n[1]||(n[1]=(...f)=>e.touch&&e.touch(...f)),ref_for:!0,ref:"input","onUpdate:modelValue":f=>e.model[m]=f},null,40,iD),[[t.vModelText,e.model[m]]])]),_:2},1024),t.createVNode(l,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(c,{key:0,tag:"a",icon:"",onClick:f=>e.remove(u)},{default:t.withCtx(()=>[t.createVNode(a,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(c,{key:0,onClick:n[2]||(n[2]=u=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createBlock(d,{key:3,class:"ux-text-row",gap:""},{default:t.withCtx(()=>[t.createVNode(l,{shrink:""},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("input",{type:"color",class:"ux-field-focus ux-color-input ux-color-input-single",onFocus:n[3]||(n[3]=(...u)=>e.touch&&e.touch(...u)),"onUpdate:modelValue":n[4]||(n[4]=u=>e.model=u)},null,544),[[t.vModelText,e.model]])]),_:1}),t.createVNode(l,null,{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("input",{type:"text",class:"ux-field-focus ux-text-input-single",onFocus:n[5]||(n[5]=(...u)=>e.touch&&e.touch(...u)),"onUpdate:modelValue":n[6]||(n[6]=u=>e.model=u)},null,544),[[t.vModelText,e.model]])]),_:1})]),_:1}))],64)}const lD=w(vT,[["render",sD],["__scopeId","data-v-91624210"]]);function mf(e){return Array.isArray(e)?!!e[0]:!!e}const aD={mixins:[z],components:{UxSwitch:ji},props:{modelValue:{type:[Boolean,Array]}},data(){return{boolean:mf(this.modelValue)}},watch:{modelValue(e,n){this.boolean=mf(e)},boolean(e,n){this.multiValue?this.$emit("update:modelValue",[e]):this.$emit("update:modelValue",e)}},methods:{getNewDefaultEntry(){return!!this.boolean}},computed:{longDescription(){return String(this.description).length>2}}},cD={key:0,class:"ux-field-title"},dD={key:0,class:"ux-required-marker"},uD={key:1,class:"ux-field-description"};function mD(e,n,r,i,s,o){const l=t.resolveComponent("ux-switch"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock("div",null,[t.createVNode(c,{onClick:n[1]||(n[1]=d=>e.touch()),gap:""},{default:t.withCtx(()=>[t.createVNode(a,{vcenter:"",shrink:""},{default:t.withCtx(()=>[t.createVNode(l,{value:s.boolean,onClick:n[0]||(n[0]=d=>s.boolean=!s.boolean)},null,8,["value"])]),_:1}),t.createVNode(a,{vcenter:""},{default:t.withCtx(()=>[t.createElementVNode("div",null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",cD,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",dD,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",uD,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0)])]),_:1})]),_:1})])}const fD=w(aD,[["render",mD],["__scopeId","data-v-1b49e626"]]),hD={props:{multiple:{type:Boolean},accept:{type:String}},data(){return{over:!1}},methods:{clicked(){this.multiple||(this.$refs.file.value=null),this.$refs.file.click()},fileout(e){this.over=!0},fileover(e){this.over=!0},filedrop(e){const n=this;e.dataTransfer&&e.dataTransfer.files&&e.dataTransfer.files.length&&(e.preventDefault(),e.stopPropagation(),n.filesSelected(e.dataTransfer.files))},emits:["files"],filesSelected(e){var n=[];for(var r in[...e]){var i=e[r];n.push({file:i,data:{},name:i.name,size:i.size,state:""})}this.$emit("files",n)}}},pD=["accept","multiple"];function yD(e,n,r,i,s,o){const l=t.resolveComponent("ux-button");return t.openBlock(),t.createElementBlock("label",{class:t.normalizeClass(["file-drop",{over:s.over}]),onDragover:n[2]||(n[2]=t.withModifiers((...a)=>o.fileover&&o.fileover(...a),["prevent","stop"])),onDragleave:n[3]||(n[3]=t.withModifiers((...a)=>o.fileout&&o.fileout(...a),["prevent","stop"])),onDrop:n[4]||(n[4]=t.withModifiers((...a)=>o.filedrop&&o.filedrop(...a),["prevent","stop"]))},[t.createElementVNode("input",{ref:"file",accept:r.accept,type:"file",multiple:r.multiple,onChange:n[0]||(n[0]=a=>o.filesSelected(a.target.files))},null,40,pD),t.createElementVNode("div",{class:"file-drop-ux",onClick:n[1]||(n[1]=t.withModifiers((...a)=>o.clicked&&o.clicked(...a),["stop","prevent"]))},[t.renderSlot(e.$slots,"default",{},()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.createTextVNode("Select Files")]),_:1})],!0)])],34)}const ff=w(hD,[["render",yD],["__scopeId","data-v-6bce29af"]]),gD={mixins:[z],components:{FileDrop:ff},props:{},data(){return{files:[],bytesUploaded:0,state:"ready"}},methods:{filesize(e){return this.$sdk.files.filesize(e)},remove(e){var n=this,r=n.files[e];r.cancelToken&&r.cancelToken.cancel("Operation canceled by the user."),n.files.splice(e,1),console.log("Map to values",n.files),n.mapFilesToValues()},upload(e){var n=this;switch(e.state){case"complete":case"processing":return}e.state="processing";var r=new FormData,i={};i.attachment=!0,i.form=n.$sdk.utils.id(n.form),i.fieldPath=n.fieldPath,r.append("json",JSON.stringify(i)),r.append("file",e.file,e.name);var s={headers:{"Content-Type":"multipart/form-data"},onUploadProgress:c=>{let d=Math.floor(c.loaded*100/c.total);e.progress=d,e.bytesUploaded=c.loaded,e.bytesTotal=c.total,n.bytesUploaded=n.files.reduce(function(u,m){return m.state=="complete"?u+=m.size||m.bytesTotal||0:u+=m.bytesUploaded||0,u},0)}};const l=n.$sdk.api.CancelToken.source();s.cancelToken=l.token,e.cancelToken=l,s.headers={"Content-Type":void 0};let a="/file/upload";return n.$sdk.fileAPI&&(a=`${n.$sdk.fileAPI}${a}`),n.$sdk.api.post(a,r,s).then(function(c){e.state="complete",e.result=c.data,e.cancelToken=null,n.uploadNextFile()}).catch(function(c){e.state="error",e.cancelToken=null,n.uploadNextFile()})},uploadNextFile(){var e=this;e.state="uploading";var n=e.files.find(function(r){switch(r.state){case"complete":case"error":return;default:return!0}});n?e.upload(n):e.state="ready",e.mapFilesToValues()},mapFilesToValues(){var e=this;if(e.multiValue)e.model=e.files.map(function(r){return r.result});else{var n=e.files[0];if(!n)return e.model=void 0;e.model=n.result}console.log("NEW MODEL",e.model)},fileover(e){},filedrop(e){},filesSelected(e){return this.touch(),console.log("FILES SELECTED",e),this.multiValue?this.files=[...this.files,...e]:this.files=e,this.uploadNextFile()}},computed:{}},kD={key:0,class:"ux-field-title"},_D={key:0,class:"ux-required-marker"},wD={key:1,class:"ux-field-description"},xD={key:2,class:"files"},bD={class:"size"};function CD(e,n,r,i,s,o){const l=t.resolveComponent("progress-bar"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-icon"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row"),m=t.resolveComponent("file-drop");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",kD,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",_D,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",wD,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),s.files&&s.files.length?(t.openBlock(),t.createElementBlock("div",xD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.files,(f,h)=>(t.openBlock(),t.createElementBlock("div",{class:"file-item",key:h},[t.createVNode(u,null,{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createElementVNode("strong",null,t.toDisplayString(f.name),1),t.createElementVNode("div",bD,t.toDisplayString(o.filesize(f.size)),1),t.createVNode(l,{value:f.progress},null,8,["value"])]),_:2},1024),t.createVNode(a,{shrink:""},{default:t.withCtx(()=>[t.createVNode(d,{icon:"",onClick:y=>o.remove(h)},{default:t.withCtx(()=>[t.createVNode(c,{icon:"fa-times"})]),_:2},1032,["onClick"])]),_:2},1024)]),_:2},1024)]))),128))])):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[e.canAddValue?(t.openBlock(),t.createBlock(m,{key:0,multiple:e.multiValue,onFiles:o.filesSelected},{default:t.withCtx(()=>[t.createVNode(d,null,{default:t.withCtx(()=>[t.createTextVNode("Select Files")]),_:1})]),_:1},8,["multiple","onFiles"])):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createBlock(m,{key:4,onFiles:o.filesSelected},{default:t.withCtx(()=>[t.createVNode(d,null,{default:t.withCtx(()=>[t.createTextVNode("Select File")]),_:1})]),_:1},8,["onFiles"]))],64)}const VD=w(gD,[["render",CD],["__scopeId","data-v-d29a9855"]]),ND={mixins:[z],components:{draggable:Xr},props:{paymentConfiguration:{type:Object},sandbox:{type:Boolean},submission:{type:Boolean,default:!1},ignoreDefaults:{type:Boolean,default:!1},includeOfficeOnly:{type:Boolean,default:!1},modelValue:{type:[Object,Array]},trail:{type:Array,default(){return[]}}},data(){return{drag:!1}},created(){},computed:{groupKey(){return`${this.field.key}-order`},duplicatable(){return this.field.duplicatable},collapsible(){return this.field.collapsible},showLabel(){return this.field.showLabel},reorderable(){return this.multiValue&&this.field.reorderable},sameLine(){return this.field.sameLine}},emits:["form:state"],methods:{createSingleObject(){this.model={}},stateChange(e){this.$emit("form:state",e)},multiLabel(e,n){return e.title?e.title:e.name?e.name:e.firstName?e.firstName:`${this.label} ${n+1}`},enterPress(e){},refocus(){const e=this;e.$nextTick(function(){var n=e.$refs.row||[],r=n[n.length-1];if(r){var i=r.$el.querySelector(".ux-field-focus");i&&i.focus()}})},getNewDefaultEntry(){return{}},duplicate(e){let n=this.model[e];if(!n)return;const r=JSON.parse(JSON.stringify(n));this.model.push(r)}}},ED={key:0,class:"ux-multi-group"},BD={key:0,class:"ux-group-title"},SD={key:0,class:"ux-field-title"},TD={key:0,class:"ux-required-marker"},DD={key:1,class:"ux-field-description"},OD={key:0,class:"ux-single-group"},MD={class:"ux-group-title"},FD={key:0,class:"ux-field-title"},ID={key:1,class:"ux-field-description"};function AD(e,n,r,i,s,o){const l=t.resolveComponent("ux-icon"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-button"),d=t.resolveComponent("flex-row"),u=t.resolveComponent("ux-panel-header"),m=t.resolveComponent("ux-form"),f=t.resolveComponent("ux-panel-body"),h=t.resolveComponent("ux-panel"),y=t.resolveComponent("draggable");return e.multiValue?(t.openBlock(),t.createElementBlock("div",ED,[o.showLabel?(t.openBlock(),t.createElementBlock("div",BD,[o.showLabel?(t.openBlock(),t.createElementBlock("label",SD,[t.createTextVNode(t.toDisplayString(e.plural||e.title)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",TD,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",DD,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),o.reorderable?(t.openBlock(),t.createBlock(y,{key:1,modelValue:e.model,"onUpdate:modelValue":n[1]||(n[1]=p=>e.model=p),group:o.groupKey,onStart:n[2]||(n[2]=p=>s.drag=!0),onEnd:n[3]||(n[3]=p=>s.drag=!1),handle:".handle"},{item:t.withCtx(({element:p,index:g})=>[t.createVNode(h,{ref:"row"},{default:t.withCtx(()=>[t.createVNode(u,null,{default:t.withCtx(()=>[t.createVNode(d,{vcenter:"",gap:""},{default:t.withCtx(()=>[o.reorderable?(t.openBlock(),t.createBlock(a,{key:0,class:"handle arrows",shrink:""},{default:t.withCtx(()=>[t.createVNode(l,{left:"",icon:"fa-arrows"})]),_:1})):t.createCommentVNode("",!0),t.createVNode(a,{vcenter:""},{default:t.withCtx(()=>[t.createElementVNode("div",null,[t.createElementVNode("strong",null,t.toDisplayString(o.multiLabel(p,g)),1)])]),_:2},1024),o.duplicatable?(t.openBlock(),t.createBlock(a,{key:1,shrink:""},{default:t.withCtx(()=>[t.createVNode(c,{icon:"",size:"xs",tag:"a",onClick:k=>o.duplicate(g)},{default:t.withCtx(()=>[t.createVNode(l,{icon:"far fa-copy"})]),_:2},1032,["onClick"])]),_:2},1024)):t.createCommentVNode("",!0),o.collapsible?(t.openBlock(),t.createBlock(a,{key:2,shrink:""},{default:t.withCtx(()=>[t.createVNode(c,{size:"xs",tag:"a",onClick:k=>p.collapsed=!p.collapsed},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(p.collapsed?"More":"Less")+" ",1),t.createVNode(l,{right:"",icon:p.collapsed?"fa-angle-down":"fa-angle-up"},null,8,["icon"])]),_:2},1032,["onClick"])]),_:2},1024)):t.createCommentVNode("",!0),t.createVNode(a,{vcenter:"",shrink:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(c,{key:0,icon:"",tag:"a",onClick:k=>e.remove(p)},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024)]),_:2},1024),t.withDirectives(t.createVNode(f,{onKeydown:n[0]||(n[0]=t.withKeys(k=>o.enterPress(k),["enter"]))},{default:t.withCtx(()=>[t.createVNode(m,{trail:r.trail,ref:"form",includeOfficeOnly:r.includeOfficeOnly,submission:r.submission,sandbox:r.sandbox,ignoreDefaults:r.ignoreDefaults,"onForm:state":o.stateChange,parentModel:e.parentModel,modelValue:e.model[g],"onUpdate:modelValue":k=>e.model[g]=k,flex:o.sameLine,fields:e.field.fields},null,8,["trail","includeOfficeOnly","submission","sandbox","ignoreDefaults","onForm:state","parentModel","modelValue","onUpdate:modelValue","flex","fields"])]),_:2},1536),[[t.vShow,!o.collapsible||!p.collapsed]])]),_:2},1536)]),_:1},8,["modelValue","group"])):(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:2},t.renderList(e.model,(p,g)=>(t.openBlock(),t.createBlock(h,{ref_for:!0,ref:"row"},{default:t.withCtx(()=>[t.createVNode(u,null,{default:t.withCtx(()=>[t.createVNode(d,{vcenter:"",gap:""},{default:t.withCtx(()=>[o.reorderable?(t.openBlock(),t.createBlock(a,{key:0,shrink:"",class:"arrows handle"},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-arrows"})]),_:1})):t.createCommentVNode("",!0),t.createVNode(a,{vcenter:""},{default:t.withCtx(()=>[t.createElementVNode("div",null,[t.createElementVNode("strong",null,t.toDisplayString(o.multiLabel(p,g)),1)])]),_:2},1024),o.duplicatable?(t.openBlock(),t.createBlock(a,{key:1,shrink:""},{default:t.withCtx(()=>[t.createVNode(c,{icon:"",size:"xs",tag:"a",onClick:k=>o.duplicate(g)},{default:t.withCtx(()=>[t.createVNode(l,{icon:"far fa-copy"})]),_:2},1032,["onClick"])]),_:2},1024)):t.createCommentVNode("",!0),o.collapsible?(t.openBlock(),t.createBlock(a,{key:2,shrink:""},{default:t.withCtx(()=>[t.createVNode(c,{size:"xs",tag:"a",onClick:k=>p.collapsed=!p.collapsed},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(p.collapsed?"More":"Less")+" ",1),t.createVNode(l,{right:"",icon:p.collapsed?"fa-angle-down":"fa-angle-up"},null,8,["icon"])]),_:2},1032,["onClick"])]),_:2},1024)):t.createCommentVNode("",!0),t.createVNode(a,{vcenter:"",shrink:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(c,{key:0,icon:"",tag:"a",onClick:k=>e.remove(p)},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024)]),_:2},1024),t.withDirectives(t.createVNode(f,{onKeydown:n[4]||(n[4]=t.withKeys(k=>o.enterPress(k),["enter"]))},{default:t.withCtx(()=>[t.createVNode(m,{ref_for:!0,ref:"form",trail:r.trail,includeOfficeOnly:r.includeOfficeOnly,submission:r.submission,sandbox:r.sandbox,ignoreDefaults:r.ignoreDefaults,"onForm:state":o.stateChange,parentModel:e.parentModel,modelValue:e.model[g],"onUpdate:modelValue":k=>e.model[g]=k,flex:o.sameLine,fields:e.field.fields},null,8,["trail","includeOfficeOnly","submission","sandbox","ignoreDefaults","onForm:state","parentModel","modelValue","onUpdate:modelValue","flex","fields"])]),_:2},1536),[[t.vShow,!p.collapsed]])]),_:2},1536))),256)),e.canAddValue?(t.openBlock(),t.createBlock(c,{key:3,onClick:n[5]||(n[5]=p=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel)+" ",1),t.createVNode(l,{icon:"fa-plus",right:""})]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[e.widget==="form"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[e.model?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[e.minimum===0?(t.openBlock(),t.createBlock(h,{key:0},{default:t.withCtx(()=>[t.createVNode(u,null,{default:t.withCtx(()=>[t.createVNode(d,{vcenter:"",gap:""},{default:t.withCtx(()=>[t.createVNode(a,{vcenter:""},{default:t.withCtx(()=>[t.createElementVNode("div",null,[t.createElementVNode("strong",null,t.toDisplayString(e.label),1)])]),_:1}),t.createVNode(a,{vcenter:"",shrink:""},{default:t.withCtx(()=>[t.createVNode(c,{icon:"",tag:"a",onClick:n[6]||(n[6]=p=>e.model=void 0)},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-times"})]),_:1})]),_:1})]),_:1})]),_:1}),t.createVNode(f,null,{default:t.withCtx(()=>[t.createVNode(m,{ref:"form",trail:r.trail,includeOfficeOnly:r.includeOfficeOnly,submission:r.submission,sandbox:r.sandbox,ignoreDefaults:r.ignoreDefaults,"onForm:state":o.stateChange,parentModel:e.parentModel,modelValue:e.model,"onUpdate:modelValue":n[7]||(n[7]=p=>e.model=p),flex:o.sameLine,fields:e.field.fields},null,8,["trail","includeOfficeOnly","submission","sandbox","ignoreDefaults","onForm:state","parentModel","modelValue","flex","fields"])]),_:1})]),_:1})):(t.openBlock(),t.createBlock(m,{key:1,ref:"form",trail:r.trail,includeOfficeOnly:r.includeOfficeOnly,submission:r.submission,sandbox:r.sandbox,ignoreDefaults:r.ignoreDefaults,"onForm:state":o.stateChange,parentModel:e.parentModel,modelValue:e.model,"onUpdate:modelValue":n[8]||(n[8]=p=>e.model=p),flex:o.sameLine,fields:e.field.fields},null,8,["trail","includeOfficeOnly","submission","sandbox","ignoreDefaults","onForm:state","parentModel","modelValue","flex","fields"]))],64)):(t.openBlock(),t.createBlock(c,{key:1,onClick:n[9]||(n[9]=p=>o.createSingleObject())},{default:t.withCtx(()=>[t.createTextVNode("Add "+t.toDisplayString(e.label)+" ",1),t.createVNode(l,{icon:"fa-plus",right:""})]),_:1}))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[o.showLabel?(t.openBlock(),t.createElementBlock("div",OD,[t.createElementVNode("div",MD,[o.showLabel?(t.openBlock(),t.createElementBlock("label",FD,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",ID,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0)]),t.createVNode(h,null,{default:t.withCtx(()=>[t.createVNode(f,null,{default:t.withCtx(()=>[t.createVNode(m,{ref:"form",trail:r.trail,includeOfficeOnly:r.includeOfficeOnly,submission:r.submission,sandbox:r.sandbox,ignoreDefaults:r.ignoreDefaults,"onForm:state":o.stateChange,parentModel:e.parentModel,modelValue:e.model,"onUpdate:modelValue":n[10]||(n[10]=p=>e.model=p),flex:o.sameLine,fields:e.field.fields},null,8,["trail","includeOfficeOnly","submission","sandbox","ignoreDefaults","onForm:state","parentModel","modelValue","flex","fields"])]),_:1})]),_:1})])):(t.openBlock(),t.createBlock(m,{key:1,ref:"form",trail:r.trail,includeOfficeOnly:r.includeOfficeOnly,submission:r.submission,sandbox:r.sandbox,ignoreDefaults:r.ignoreDefaults,"onForm:state":o.stateChange,parentModel:e.parentModel,modelValue:e.model,"onUpdate:modelValue":n[11]||(n[11]=p=>e.model=p),flex:o.sameLine,fields:e.field.fields},null,8,["trail","includeOfficeOnly","submission","sandbox","ignoreDefaults","onForm:state","parentModel","modelValue","flex","fields"]))],64))],64))}const LD=w(ND,[["render",AD],["__scopeId","data-v-3ce8a8fa"]]);function qs(e){return e===void 0||typeof e>"u"||e===null||String(e)==="null"||String(e)==="undefined"}const $D={props:{option:{required:!0}},computed:{plainValue(){if(this.option._id)return this.option._id;const e=this.option.value;return qs(e)?this.option:this.option.value}}};function PD(e,n,r,i,s,o){return t.renderSlot(e.$slots,"default",{plainValue:o.plainValue},()=>[t.createElementVNode("pre",null,t.toDisplayString(r.option),1)])}const RD={components:{OptionSlot:w($D,[["render",PD]])},props:{modelValue:{}},mixins:[z],created(){this.model=this.model},methods:{select(e){var n=this;n.multiValue?n.model=[...n.model,e]:n.model=e},deselect(e){var n=this;if(this.multiValue){var r=this.model.slice(),i=r.indexOf(e);i!=-1&&(r.splice(i,1),this.model=r)}else n.getValue(this.model)==e?this.model=void 0:this.model=e},toggle(e){this.selectionHash[e]?this.deselect(e):this.select(e),this.touch()},model:{get(){return this.cleanOutput(this.value)},set(e){this.value=this.cleanInput(e),this.dispatch()}},cleanOutput(e){var n=this;return qs(e)?n.multiValue?e=[]:e=void 0:n.multiValue?e=(e||[]).map(function(r){return n.getValue(r)}):e=n.getValue(e),e},cleanInput(e){var n=this;if(n.multiValue)e||(e=[]),Array.isArray(e)||(e=[e]),n.maximum&&e.length>n.maximum&&(e.length=n.maximum),e=e.map(function(i){var s=n.getValue(i);return n.returnObject?n.optionLookup[s]:s});else{var r=n.getValue(e);e=n.returnObject?n.optionLookup[r]:r}return e}},computed:{size(){return this.field.size},selectionHash(){const e=this;var n={};return!qs(e.model)&&(e.multiValue?e.model.forEach(function(i){n[i]=!0}):n[e.model]=!0),n},returnObject(){return this.type=="reference"},summary(){return this.getLabel(this.optionLookup[this.model])||"Click to select"}}},UD={key:0,class:"ux-field-title"},jD={key:0,class:"ux-required-marker"},qD={key:1,class:"ux-field-description"},zD={key:2},WD={key:3,class:"buttons"};function HD(e,n,r,i,s,o){const l=t.resolveComponent("ux-icon"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("flex-row"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("option-slot");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",UD,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",jD,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",qD,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.loadingAsyncOptions?(t.openBlock(),t.createElementBlock("div",zD,[t.createVNode(l,{icon:"fa-spinner",spin:"",left:""}),t.createTextVNode(" Loading Options ")])):(t.openBlock(),t.createElementBlock("div",WD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.selectableOptions,m=>(t.openBlock(),t.createBlock(u,{option:m},{default:t.withCtx(({plainValue:f})=>[t.createVNode(d,{size:o.size,class:t.normalizeClass({active:o.selectionHash[String(f)]}),onClick:h=>o.toggle(f)},{default:t.withCtx(()=>[t.createVNode(c,{center:"",gap:""},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.getLabel(m)),1)]),_:2},1024),t.createVNode(a,{shrink:""},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-check",right:""})]),_:1})]),_:2},1024)]),_:2},1032,["size","class","onClick"])]),_:2},1032,["option"]))),256))]))],64)}const GD=w(RD,[["render",HD],["__scopeId","data-v-491bd3a3"]]),YD={props:{modelValue:{type:Object}},mixins:[z],computed:{},methods:{getNewDefaultEntry(){return{}}}},JD={key:0,class:"ux-field-title"},KD={key:0,class:"ux-required-marker"},ZD={key:1,class:"ux-field-description"},XD={key:2},QD={key:3};function vD(e,n,r,i,s,o){const l=t.resolveComponent("flex-cell"),a=t.resolveComponent("ux-icon"),c=t.resolveComponent("ux-button"),d=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",JD,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",KD,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",ZD,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",XD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.model,(u,m)=>(t.openBlock(),t.createBlock(d,{class:"ux-text-row",key:m},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.createElementVNode("pre",null,t.toDisplayString(u),1)]),_:2},1024),t.createVNode(l,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(c,{key:0,tag:"a",icon:"",onClick:f=>e.remove(u)},{default:t.withCtx(()=>[t.createVNode(a,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(c,{key:0,onClick:n[0]||(n[0]=u=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel)+" ",1),t.createVNode(a,{icon:"fa-plus",right:""})]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock("pre",QD,t.toDisplayString(e.model),1))],64)}const eO=w(YD,[["render",vD],["__scopeId","data-v-aae5394a"]]),tO={components:{UxCheckbox:gr},props:{modelValue:{type:Object}},data(){return{update:0}},mixins:[z],watch:{"field.referenceType":{async handler(e,n){n&&(this.model={},console.log("Reset model")),e?await this.$glossary.ensure(e):await this.$glossary.ensure()},immediate:!0},model:{immediate:!0,deep:!0,handler(e){e.enabled||(e.enabled={}),e.updates||(e.updates={}),this.$emit("update:modelValue",e)}}},computed:{glossary(){return this.$glossary.hash},loadingGlossary(){return!this.$glossary.loaded},definition(){const e=this.field.referenceType;if(e)return(this.glossary||{})[e]},enabledFields(){const e=this;return e.fields.filter(function(n){return e.model.enabled[n.path]})},mergeFields(){const e=[];return e.push({title:"Merge behavior",description:"As this field can have multiple answers, how would you like to update any existing values?",key:"merge",minimum:1,maximum:1,defaultValues:["add"],widget:"select",type:"string",options:[{title:"Replace existing values",value:"replace"},{title:"Add to existing values",value:"add"},{title:"Remove from existing values",value:"remove"}]}),e},fields(){const e=this,n=e.definition.definesType==="submission";var r=[...e.definition.fields],i=(e.definition.definedFields||[]).map(function(a){return a={...a},a.batchEditable=!0,a});if(i.length)if(n){var s={title:"Form Data",minimum:1,maximum:1,key:"formData",asObject:!0,type:"group",fields:i};r.push(s);var o={title:"Data",minimum:1,maximum:1,key:"data",asObject:!0,type:"group",fields:i.map(function(c){return c.type==="reference"&&(c=JSON.parse(JSON.stringify(c)),delete c.fields),c})};r.push(o)}else{var o={title:`${e.definition.title}`,minimum:1,maximum:1,key:"data",asObject:!0,type:"group",fields:i};r.push(o)}var l=e.$sdk.utils.mapFields(r).filter(function(a){var c=a.type=="group"&&a.asObject&&a.minimum==1&&a.maximum==1;return!c}).filter(function(a){return a.trail[0]==="fields"||a.readOnly?!1:a.batchEditable!=!1}).map(function(a){return a.title=a.titles.filter(Boolean).join(" › "),a.key="value",a}).sort(function(a,c){const d=a.filterTitle||a.title,u=c.filterTitle||c.title;return d<u?-1:1});return l}},methods:{toggle(e){this.model.enabled[e]=!this.model.enabled[e],this.update++},getNewDefaultEntry(){return{enabled:{},update:{}}}}},nO={key:0},rO={key:1},oO={key:0,class:"ux-field-title"},iO={key:0,class:"ux-required-marker"},sO={key:1,class:"ux-field-description"},lO={key:2};function aO(e,n,r,i,s,o){const l=t.resolveComponent("spinner"),a=t.resolveComponent("ux-checkbox"),c=t.resolveComponent("flex-cell"),d=t.resolveComponent("ux-form"),u=t.resolveComponent("flex-row");return o.loadingGlossary?(t.openBlock(),t.createElementBlock("div",nO,[t.createVNode(l)])):o.definition?(t.openBlock(),t.createElementBlock("div",rO,[e.showLabel?(t.openBlock(),t.createElementBlock("label",oO,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",iO,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",sO,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",lO,"This field can not be used on a multiple")):(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:3},t.renderList(o.fields,m=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["field-row",{active:e.model.enabled[m.path]}])},[t.createVNode(u,{gap:""},{default:t.withCtx(()=>[t.createVNode(c,{shrink:"",onClick:f=>o.toggle(m.path)},{default:t.withCtx(()=>[t.createVNode(a,{value:e.model.enabled[m.path]},null,8,["value"])]),_:2},1032,["onClick"]),t.createVNode(c,{shrink:"",style:{width:"200px"}},{default:t.withCtx(()=>[t.createElementVNode("strong",null,t.toDisplayString(m.filterTitle||m.title),1)]),_:2},1024),t.createVNode(c,null,{default:t.withCtx(()=>[e.model.enabled[m.path]?(t.openBlock(),t.createBlock(d,{key:0,modelValue:e.model.updates[m.path],"onUpdate:modelValue":f=>e.model.updates[m.path]=f,fields:[m]},null,8,["modelValue","onUpdate:modelValue","fields"])):t.createCommentVNode("",!0)]),_:2},1024),t.createVNode(c,{shrink:"",style:{width:"200px"}},{default:t.withCtx(()=>[e.model.enabled[m.path]&&m.maximum!=1?(t.openBlock(),t.createBlock(d,{key:0,modelValue:e.model.updates[m.path],"onUpdate:modelValue":f=>e.model.updates[m.path]=f,fields:o.mergeFields},null,8,["modelValue","onUpdate:modelValue","fields"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024)],2))),256))])):t.createCommentVNode("",!0)}const cO=w(tO,[["render",aO],["__scopeId","data-v-5bb07754"]]),dO={props:{modelValue:{type:[String,Array]}},mixins:[z],computed:{lazy(){switch(this.type){case"integer":case"number":case"decimal":case"float":case"url":case"key":return!0}},actualPlaceholder(){if(this.field.placeholder)return this.field.placeholder;switch(this.type){case"integer":case"number":case"decimal":case"float":return"0";case"url":return"https://www.website.com";case"email":return"you@youremail.com"}},addLabel(){return this.numValues?"Add another option":"Add options"}},methods:{titleBlurred(e){var n;this.multiValue?n=this.model[e]:n=this.model,n.title!==n.value&&delete n.pristine},valuePlaceholder(e){var n;return this.multiValue?n=this.model[e]:n=this.model,(n==null?void 0:n.title)||"Value"},valueTouched(e){var n;this.multiValue?n=this.model[e]:n=this.model,delete n.pristine,this.touch()},entryTitleChanged(e){this.$nextTick(function(){var n;this.multiValue?n=this.model[e]:n=this.model,n.pristine&&(n.value=n.title)})},cleanOutputValue(e){return e.value=this.cleanTextInput(e.value,this.type,this),e},cleanInputValue(e){return e.value=this.cleanTextInput(e.value,this.type,this),e},getNewDefaultEntry(){return{pristine:!0}}}},Qr=e=>(t.pushScopeId("data-v-91cc715f"),e=e(),t.popScopeId(),e),uO={key:0,class:"ux-field-title"},mO={key:0,class:"ux-required-marker"},fO={key:1,class:"ux-field-description"},hO={key:2},pO={class:"ux-text-wrap prefixed"},yO=Qr(()=>t.createElementVNode("span",{class:"ux-text-prefix"},"Label",-1)),gO=["onBlur","on:update:modelValue","onUpdate:modelValue"],kO=["onBlur","on:update:modelValue","onUpdate:modelValue"],_O={class:"ux-text-wrap prefixed"},wO=Qr(()=>t.createElementVNode("span",{class:"ux-text-prefix"},"Value",-1)),xO=["placeholder","onFocus","onUpdate:modelValue"],bO=["placeholder","onFocus","onUpdate:modelValue"],CO={class:"ux-text-wrap prefixed"},VO=Qr(()=>t.createElementVNode("span",{class:"ux-text-prefix"},"Label",-1)),NO={class:"ux-text-wrap prefixed"},EO=Qr(()=>t.createElementVNode("span",{class:"ux-text-prefix"},"Value",-1));function BO(e,n,r,i,s,o){const l=t.resolveComponent("flex-cell"),a=t.resolveComponent("ux-icon"),c=t.resolveComponent("ux-button"),d=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",uO,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",mO,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",fO,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",hO,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.model,(u,m)=>(t.openBlock(),t.createBlock(d,{gap:"",class:"ux-text-row",key:m},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.createElementVNode("div",pO,[yO,o.lazy?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,class:"ux-field-focus ux-text-input-multiple",placeholder:"Label",onFocus:n[0]||(n[0]=(...f)=>e.touch&&e.touch(...f)),ref_for:!0,ref:"input",onKeydown:n[1]||(n[1]=t.withKeys(t.withModifiers(f=>e.add(),["stop","prevent"]),["enter"])),onBlur:f=>o.titleBlurred(m),"on:update:modelValue":f=>o.entryTitleChanged(m),"onUpdate:modelValue":f=>e.model[m].title=f},null,40,gO)),[[t.vModelText,e.model[m].title,void 0,{lazy:!0}]]):t.createCommentVNode("",!0),o.lazy?t.createCommentVNode("",!0):t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,class:"ux-field-focus ux-text-input-multiple",placeholder:"Label",onFocus:n[2]||(n[2]=(...f)=>e.touch&&e.touch(...f)),ref_for:!0,ref:"input",onKeydown:n[3]||(n[3]=t.withKeys(t.withModifiers(f=>e.add(),["stop","prevent"]),["enter"])),onBlur:f=>o.titleBlurred(m),"on:update:modelValue":f=>o.entryTitleChanged(m),"onUpdate:modelValue":f=>e.model[m].title=f},null,40,kO)),[[t.vModelText,e.model[m].title]])])]),_:2},1024),t.createVNode(l,null,{default:t.withCtx(()=>[t.createElementVNode("div",_O,[wO,o.lazy?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,class:"ux-field-focus ux-text-input-multiple",placeholder:o.valuePlaceholder(m),onFocus:f=>o.valueTouched(m),ref_for:!0,ref:"valueInput",onKeydown:n[4]||(n[4]=t.withKeys(t.withModifiers(f=>e.add(),["stop","prevent"]),["enter"])),"onUpdate:modelValue":f=>e.model[m].value=f},null,40,xO)),[[t.vModelText,e.model[m].value,void 0,{lazy:!0}]]):t.createCommentVNode("",!0),o.lazy?t.createCommentVNode("",!0):t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,class:"ux-field-focus ux-text-input-multiple",placeholder:o.valuePlaceholder(m),onFocus:f=>o.valueTouched(m),ref_for:!0,ref:"valueInput",onKeydown:n[5]||(n[5]=t.withKeys(t.withModifiers(f=>e.add(),["stop","prevent"]),["enter"])),"onUpdate:modelValue":f=>e.model[m].value=f},null,40,bO)),[[t.vModelText,e.model[m].value]])])]),_:2},1024),t.createVNode(l,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(c,{key:0,tag:"a",icon:"",onClick:f=>e.remove(u)},{default:t.withCtx(()=>[t.createVNode(a,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(c,{key:0,onClick:n[6]||(n[6]=u=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.addLabel)+" ",1),t.createVNode(a,{icon:"fa-plus",right:""})]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createBlock(d,{key:3,class:"ux-text-row"},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.createElementVNode("div",CO,[VO,o.lazy?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,class:"ux-field-focus ux-text-input-multiple",placeholder:"Label",onFocus:n[7]||(n[7]=(...u)=>e.touch&&e.touch(...u)),ref:"input",onKeydown:n[8]||(n[8]=t.withKeys(t.withModifiers(u=>e.add(),["stop","prevent"]),["enter"])),onBlur:n[9]||(n[9]=u=>o.titleBlurred(e.index)),"on:update:modelValue":n[10]||(n[10]=(...u)=>o.entryTitleChanged&&o.entryTitleChanged(...u)),"onUpdate:modelValue":n[11]||(n[11]=u=>e.model.title=u)},null,544)),[[t.vModelText,e.model.title,void 0,{lazy:!0}]]):t.createCommentVNode("",!0),o.lazy?t.createCommentVNode("",!0):t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,class:"ux-field-focus ux-text-input-multiple",placeholder:"Label",onFocus:n[12]||(n[12]=(...u)=>e.touch&&e.touch(...u)),ref:"input",onKeydown:n[13]||(n[13]=t.withKeys(t.withModifiers(u=>e.add(),["stop","prevent"]),["enter"])),onBlur:n[14]||(n[14]=u=>o.titleBlurred(e.index)),"on:update:modelValue":n[15]||(n[15]=(...u)=>o.entryTitleChanged&&o.entryTitleChanged(...u)),"onUpdate:modelValue":n[16]||(n[16]=u=>e.model.title=u)},null,544)),[[t.vModelText,e.model.title]])])]),_:1}),t.createVNode(l,null,{default:t.withCtx(()=>[t.createElementVNode("div",NO,[EO,o.lazy?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,class:"ux-field-focus ux-text-input-multiple",placeholder:"Value",onFocus:n[17]||(n[17]=(...u)=>o.valueTouched&&o.valueTouched(...u)),ref:"valueInput",onKeydown:n[18]||(n[18]=t.withKeys(t.withModifiers(u=>e.add(),["stop","prevent"]),["enter"])),"onUpdate:modelValue":n[19]||(n[19]=u=>e.model.value=u)},null,544)),[[t.vModelText,e.model.value,void 0,{lazy:!0}]]):t.createCommentVNode("",!0),o.lazy?t.createCommentVNode("",!0):t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,class:"ux-field-focus ux-text-input-multiple",placeholder:"Value",onFocus:n[20]||(n[20]=(...u)=>o.valueTouched&&o.valueTouched(...u)),ref:"valueInput",onKeydown:n[21]||(n[21]=t.withKeys(t.withModifiers(u=>e.add(),["stop","prevent"]),["enter"])),"onUpdate:modelValue":n[22]||(n[22]=u=>e.model.value=u)},null,544)),[[t.vModelText,e.model.value]])])]),_:1})]),_:1}))],64)}const SO=w(dO,[["render",BO],["__scopeId","data-v-91cc715f"]]),TO={components:{CodeEditor:js},props:{modelValue:{type:[String,Array]}},computed:{syntax(){return this.field?this.field.syntax:"json"},tokens(){return this.field?this.field.tokens:[]}},mixins:[z],methods:{enterPress(){},getNewDefaultEntry(){return""}}},DO={key:0,class:"ux-field-title"},OO={key:0,class:"ux-required-marker"},MO={key:1,class:"ux-field-description"},FO={key:2},IO={class:"code-editor-field-wrap"},AO={key:3,class:"code-editor-field-wrap"};function LO(e,n,r,i,s,o){const l=t.resolveComponent("code-editor"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-icon"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock("div",{onKeydown:n[2]||(n[2]=t.withKeys(t.withModifiers(m=>o.enterPress(m),["stop"]),["enter"]))},[e.showLabel?(t.openBlock(),t.createElementBlock("label",DO,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",OO,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",MO,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",FO,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.model,(m,f)=>(t.openBlock(),t.createBlock(u,{class:"ux-text-row",key:f},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createElementVNode("div",IO,[t.createVNode(l,{lang:o.syntax,onFocus:e.touch,ref_for:!0,ref:"input",modelValue:e.model[f],"onUpdate:modelValue":h=>e.model[f]=h,class:"ux-code-editor ux-field-focus ux-text-area-multiple"},null,8,["lang","onFocus","modelValue","onUpdate:modelValue"])])]),_:2},1024),t.createVNode(a,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(d,{key:0,tag:"a",icon:"",onClick:h=>e.remove(m)},{default:t.withCtx(()=>[t.createVNode(c,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(d,{key:0,onClick:n[0]||(n[0]=m=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock("div",AO,[t.createVNode(l,{lang:o.syntax,tokens:o.tokens,class:"ux-code-editor ux-field-focus ux-text-area-single",onFocus:e.touch,modelValue:e.model,"onUpdate:modelValue":n[1]||(n[1]=m=>e.model=m)},null,8,["lang","tokens","onFocus","modelValue"])]))],32)}const $O=w(TO,[["render",LO],["__scopeId","data-v-ecb1b9f8"]]),PO={emits:["deselect"],components:{Search:ot,Spinner:Pt},props:{deselectEnabled:{type:Boolean,default:!0},showAdvancedToggle:{type:Boolean},advanced:{type:Boolean},teleportID:{type:[String,Number]},modelValue:{type:Object,default(){return{search:void 0,latitude:void 0,longitude:void 0,threshold:void 0,title:void 0,addressLine1:void 0,addressLine2:void 0,suburb:void 0,state:void 0,country:void 0,postalCode:void 0}}}},computed:{hasLocation(){var e,n;return this.model.addressLine1||((e=this.model)==null?void 0:e.longitude)&&((n=this.model)==null?void 0:n.latitude)},teleportTarget(){if(this.teleportID)return`#teleport-${this.teleportID}`},keywords:{get(){return this.model.search||""},set(e){this.model.search=e||""}}},data(){return{selectedIndex:-1,results:[],processing:!1,model:this.modelValue,showAdvanced:this.advanced}},watch:{keywords:"findResults",modelValue(e){this.model=e},model(e){console.log("emit up!",e),this.$emit("update:modelValue",e)}},methods:{summary(e){if(!e)return"";const n=[e.addressLine1,e.suburb,e.state,e.postalCode,e.country].filter(Boolean);return n?n.join(", "):[e.latitude,e.longitude].filter(Boolean).join(", ")},toggleAdvanced(){this.showAdvanced=!this.showAdvanced,this.$emit("update:advanced",this.showAdvanced)},deselect(){this.model={title:void 0,longitude:void 0,latitude:void 0,search:void 0,threshold:0,addressLine1:void 0,addressLine2:void 0,suburb:void 0,state:void 0,country:void 0,postalCode:void 0},this.$emit("deselect")},handleKeyNavigation(e){e.key==="ArrowDown"?(e.preventDefault(),this.selectedIndex=(this.selectedIndex+1)%this.results.length):e.key==="ArrowUp"?(e.preventDefault(),this.selectedIndex=(this.selectedIndex-1+this.results.length)%this.results.length):e.key==="Enter"&&this.selectedIndex!==-1&&this.select(this.results[this.selectedIndex])},async select(e){e&&(this.model=Object.assign({threshold:0},this.model,{longitude:e.longitude,latitude:e.latitude,title:e.title||"",search:"",addressLine1:e.addressLine1||e.address,addressLine2:e.addressLine2||"",suburb:e.suburb||"",state:e.state||"",country:e.country||"",postalCode:e.postalCode||""}),this.keywords="")},async findResults(){const e=this;e.selectedIndex=-1;const n=e.keywords;if(!(n!=null&&n.length)){e.results=[],e.processing=!1;return}e.processing=!0;const{data:r}=await e.$sdk.api.get(`/geo/places/search/${n}`);e.results=(r.locations||[]).map(function({formatted:i}){return{...i,summary:e.summary(i)}}),e.processing=!1}}},RO={class:"location-search-outer"},UO={key:0,class:"selectedLocation"},jO={class:"content-item"},qO={class:"image-wrapper"},zO={class:"content-item-title"},WO={key:0,class:"content-item-subtitle"},HO={key:0,class:"results"},GO=["onClick"],YO={class:"result-item-title"},JO={class:"result-item-subtitle"};function KO(e,n,r,i,s,o){const l=t.resolveComponent("ux-icon"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-button"),d=t.resolveComponent("flex-row"),u=t.resolveComponent("search");return t.openBlock(),t.createElementBlock("div",RO,[o.hasLocation?(t.openBlock(),t.createElementBlock("div",UO,[t.createElementVNode("div",jO,[t.createVNode(d,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(a,{shrink:""},{default:t.withCtx(()=>[t.createElementVNode("div",qO,[t.createVNode(l,{icon:"fa-map-marker"})])]),_:1}),t.createVNode(a,null,{default:t.withCtx(()=>[t.createElementVNode("div",zO,t.toDisplayString(s.model.title||s.model.addressLine1),1),o.summary?(t.openBlock(),t.createElementBlock("div",WO,t.toDisplayString(o.summary(s.model)),1)):t.createCommentVNode("",!0)]),_:1}),r.showAdvancedToggle?(t.openBlock(),t.createBlock(a,{key:0,shrink:""},{default:t.withCtx(()=>[t.createVNode(c,{size:"sm",onClick:o.toggleAdvanced},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(r.advanced?"Less detail":"More detail")+" ",1),t.createVNode(l,{right:"",icon:r.advanced?"fa-angle-up":"fa-angle-down"},null,8,["icon"])]),_:1},8,["onClick"])]),_:1})):t.createCommentVNode("",!0),r.deselectEnabled?(t.openBlock(),t.createBlock(a,{key:1,shrink:""},{default:t.withCtx(()=>[t.createVNode(c,{icon:"",onClick:o.deselect},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-times"})]),_:1},8,["onClick"])]),_:1})):t.createCommentVNode("",!0)]),_:1})])])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(u,{onTouched:e.touch,modelValue:o.keywords,"onUpdate:modelValue":n[0]||(n[0]=m=>o.keywords=m),onKeydown:o.handleKeyNavigation,placeholder:"Search for a location",loading:s.processing},null,8,["onTouched","modelValue","onKeydown","loading"]),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!o.teleportTarget,to:o.teleportTarget},[s.results.length?(t.openBlock(),t.createElementBlock("div",HO,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.results,(m,f)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["result-item",{selected:f===s.selectedIndex}]),key:m.title,onClick:h=>o.select(m)},[t.createElementVNode("div",YO,t.toDisplayString(m.title),1),t.createElementVNode("div",JO,t.toDisplayString(m.summary),1)],10,GO))),128))])):t.createCommentVNode("",!0)],8,["disabled","to"]))],64))])}const ZO=w(PO,[["render",KO],["__scopeId","data-v-084b9220"]]),XO={components:{TextField:Os,Spinner:Pt,CountrySelect:ds},props:{showTitle:{type:Boolean,default:!0},showAddress:{type:Boolean,default:!0},showInputs:{type:Boolean,default:!0},showThreshold:{type:Boolean,default:!0},modelValue:{type:Object,default(){return{latitude:0,longitude:0,threshold:0,title:"",address:"",search:""}}},assumeDefault:{type:Boolean,default:!1}},computed:{initializing(){return this.loadingUserPosition||this.loadingMapScript},showFields(){return this.showInputs||this.showThreshold},position:{get(){return this.model},set(e){const n=this;n.model={...n.model||{},...e},n.redrawMarker(),n.$emit("update:modelValue",n.model)}},address:{get(){return this.model.address||""},set(e){this.model.address=e}},title:{get(){return this.model.title||""},set(e){this.model.title=e}},lat:{get(){var e;return((e=this.model)==null?void 0:e.latitude)||0},set(e){this.model.latitude!=e&&(this.position={latitude:e})}},radius:{get(){var e;return isNaN((e=this.model)==null?void 0:e.threshold)?0:Number(this.model.threshold)||0},set(e){e=Number(e),this.model.threshold!=e&&(this.position={threshold:e},this.redrawCircle())}},lng:{get(){var e;return((e=this.model)==null?void 0:e.longitude)||0},set(e){this.model.longitude!=e&&(this.position={longitude:e})}}},data(){const e={title:"Latitude",key:"lat",type:"number",minimum:0,maximum:1},n={title:"Longitude",key:"lng",type:"number",minimum:0,maximum:1},r={title:"Radius (Meters)",description:"Enter the maximum distance in meters from this location that can be considered valid",key:"radius",type:"number",minimum:0,maximum:1},i={title:"Title",description:"Optionally enter a descriptive name for this location",key:"title",type:"string",minimum:0,maximum:1},s={title:"Address Line 1",key:"addressLine1",type:"string",minimum:0,maximum:1},o={title:"Address Line 2",key:"addressLine2",type:"string",minimum:0,maximum:1},l={title:"Suburb",key:"suburb",type:"string",minimum:0,maximum:1},a={title:"State",key:"state",type:"string",minimum:0,maximum:1},c={title:"Postal Code",key:"postalCode",type:"string",minimum:0,maximum:1},d={title:"Country",key:"country",type:"string",minimum:0,maximum:1},u=this.modelValue||{};return u.latitude=u.latitude||0,u.longitude=u.longitude||0,u.threshold=u.threshold||0,{map:null,marker:null,circle:null,model:u,latField:e,lngField:n,thresholdField:r,titleField:i,addressLine1Field:s,addressLine2Field:o,suburbField:l,stateField:a,postalCodeField:c,countryField:d,userPosition:null,loadingUserPosition:!0,loadingMapScript:!0,initialised:!1}},mounted(){var r,i;const e=this,n=((i=(r=e.$sdk.app)==null?void 0:r.global)==null?void 0:i.googleMapsAPIKey)||"AIzaSyDxBa2lg5dUZWvVSAO2EfgHHKuNnERMzec";e.$sdk.utils.loadExternalScript(`https://maps.googleapis.com/maps/api/js?key=${n}`).then(function(s){e.loadingMapScript=!1},function(s){e.loadingMapScript=!1}),navigator.geolocation?(e.loadingUserPosition=!0,navigator.geolocation.getCurrentPosition(s=>{e.userPosition={latitude:s.coords.latitude,longitude:s.coords.longitude},e.loadingUserPosition=!1},s=>{console.error("Error getting user position:",s),e.loadingUserPosition=!1})):e.loadingUserPosition=!1},watch:{modelValue(e){this.model=e,this.redrawMarker()},initializing:{handler:"checkInitialisation",immediate:!0}},beforeUnmount(){this.map&&window.google.maps.event.clearInstanceListeners(this.map)},methods:{setToUserPosition(){var n,r;const e=this;(n=e.userPosition)!=null&&n.latitude&&((r=e.userPosition)!=null&&r.longitude)&&(e.position={latitude:e.userPosition.latitude,longitude:e.userPosition.longitude,title:"",address:""})},checkInitialisation(){var n,r,i,s;const e=this;if(e.loadingUserPosition||e.loadingMapScript)console.log("Still initializing...",[e.loadingUserPosition,this.loadingMapScript]);else{if(e.assumeDefault){const o=Number(((n=e.model)==null?void 0:n.latitude)||0),l=Number(((r=e.model)==null?void 0:r.longitude)||0);if(!o||!l){const a=Number(((i=e.userPosition)==null?void 0:i.latitude)||0),c=Number(((s=e.userPosition)==null?void 0:s.longitude)||0);a&&c&&(e.model={...e.model,latitude:a,longitude:c})}}e.initializeMap()}},focus(){},redrawMarker(){const e=this,n=Number(e.model.latitude||0),r=Number(e.model.longitude||0),i=new google.maps.LatLng(n,r);e.marker.setPosition(i),n&&r?(e.marker.setVisible(!0),e.map.setCenter(i)):e.marker.setVisible(!1),e.redrawCircle()},redrawCircle(){const e=this;if(!e.radius){e.circle&&(e.circle.setMap(null),e.circle=null);return}const n=new google.maps.LatLng(Number(e.model.latitude),Number(e.model.longitude));e.circle?(e.circle.setRadius(e.radius),e.circle.setCenter(n)):e.circle=new window.google.maps.Circle({center:n,radius:Number(e.radius),strokeColor:"#FF0000",strokeOpacity:.8,strokeWeight:2,fillColor:"#FF0000",fillOpacity:.35,map:e.map})},initializeMap(){var a,c,d,u;const e=this;if(e.initialised)return;e.initialised=!0;let n=Number(((a=e.model)==null?void 0:a.latitude)||0),r=Number(((c=e.model)==null?void 0:c.longitude)||0),i=Number(((d=e.userPosition)==null?void 0:d.latitude)||0),s=Number(((u=e.userPosition)==null?void 0:u.longitude)||0),o=n||0,l=r||0;!o&&!l&&(o=i,l=s),e.map=new window.google.maps.Map(e.$refs.mapContainer,{center:{lat:o,lng:l},zoom:12,streetViewControl:!1}),e.marker=new window.google.maps.Marker({position:{lat:o,lng:l},map:e.map,draggable:!0}),n&&r?e.marker.setVisible(!0):e.marker.setVisible(!1),e.map.addListener("click",m=>{e.position={latitude:m.latLng.lat(),longitude:m.latLng.lng()}}),e.marker.addListener("dragend",()=>{e.position={latitude:e.marker.getPosition().lat(),longitude:e.marker.getPosition().lng()}}),e.redrawCircle()}}},QO={class:"font-muted font-sm"},vO={class:"map-outer"},e2={key:0,class:"indicator"},t2={class:"map-inner",ref:"mapContainer"};function n2(e,n,r,i,s,o){const l=t.resolveComponent("flex-cell"),a=t.resolveComponent("ux-icon"),c=t.resolveComponent("flex-row"),d=t.resolveComponent("ux-panel-header"),u=t.resolveComponent("spinner"),m=t.resolveComponent("text-field"),f=t.resolveComponent("country-select"),h=t.resolveComponent("ux-panel-body"),y=t.resolveComponent("ux-panel");return t.openBlock(),t.createBlock(y,null,{default:t.withCtx(()=>[t.createVNode(d,null,{default:t.withCtx(()=>[t.createElementVNode("div",QO,[t.createVNode(c,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.createTextVNode(" Select a location using the map below ")]),_:1}),t.createVNode(l,{shrink:""},{default:t.withCtx(()=>[t.createElementVNode("a",{onClick:n[0]||(n[0]=(...p)=>o.setToUserPosition&&o.setToUserPosition(...p))},[t.createTextVNode("Set to my position "),t.createVNode(a,{icon:"fa-map-marker",right:""})])]),_:1})]),_:1})])]),_:1}),t.createElementVNode("div",vO,[o.initializing?(t.openBlock(),t.createElementBlock("div",e2,[t.createVNode(u)])):t.createCommentVNode("",!0),t.createElementVNode("div",t2,null,512)]),o.showFields?(t.openBlock(),t.createBlock(h,{key:0},{default:t.withCtx(()=>[r.showTitle?(t.openBlock(),t.createBlock(m,{key:0,onTouched:e.touch,field:s.titleField,modelValue:o.title,"onUpdate:modelValue":n[1]||(n[1]=p=>o.title=p)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),r.showAddress?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(m,{onTouched:e.touch,field:s.addressLine1Field,modelValue:s.model.addressLine1,"onUpdate:modelValue":n[2]||(n[2]=p=>s.model.addressLine1=p)},null,8,["onTouched","field","modelValue"]),t.createVNode(c,{gap:""},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.createVNode(m,{onTouched:e.touch,field:s.suburbField,modelValue:s.model.suburb,"onUpdate:modelValue":n[3]||(n[3]=p=>s.model.suburb=p)},null,8,["onTouched","field","modelValue"])]),_:1}),t.createVNode(l,null,{default:t.withCtx(()=>[t.createVNode(m,{onTouched:e.touch,field:s.stateField,modelValue:s.model.state,"onUpdate:modelValue":n[4]||(n[4]=p=>s.model.state=p)},null,8,["onTouched","field","modelValue"])]),_:1}),t.createVNode(l,null,{default:t.withCtx(()=>[t.createVNode(m,{onTouched:e.touch,field:s.postalCodeField,modelValue:s.model.postalCode,"onUpdate:modelValue":n[5]||(n[5]=p=>s.model.postalCode=p)},null,8,["onTouched","field","modelValue"])]),_:1})]),_:1}),t.createVNode(f,{onTouched:e.touch,field:s.countryField,modelValue:s.model.country,"onUpdate:modelValue":n[6]||(n[6]=p=>s.model.country=p)},null,8,["onTouched","field","modelValue"])],64)):t.createCommentVNode("",!0),r.showInputs?(t.openBlock(),t.createBlock(c,{key:2,gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.createVNode(m,{onTouched:e.touch,field:s.latField,modelValue:o.lat,"onUpdate:modelValue":n[7]||(n[7]=p=>o.lat=p)},null,8,["onTouched","field","modelValue"])]),_:1}),t.createVNode(l,null,{default:t.withCtx(()=>[t.createVNode(m,{onTouched:e.touch,field:s.lngField,modelValue:o.lng,"onUpdate:modelValue":n[8]||(n[8]=p=>o.lng=p)},null,8,["onTouched","field","modelValue"])]),_:1})]),_:1})):t.createCommentVNode("",!0),r.showThreshold?(t.openBlock(),t.createBlock(m,{key:3,onTouched:e.touch,field:s.thresholdField,modelValue:o.radius,"onUpdate:modelValue":n[9]||(n[9]=p=>o.radius=p)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0)]),_:1})):t.createCommentVNode("",!0)]),_:1})}const hf=w(XO,[["render",n2]]);function pf(){return{title:void 0,latitude:void 0,longitude:void 0,addressLine1:void 0,addressLine2:void 0,suburb:void 0,state:void 0,country:void 0,postalCode:void 0,threshold:void 0,search:void 0}}const r2={data(){return{singleAdvancedOptions:!1,multiAdvancedOptions:{}}},components:{LocationSelect:hf,LocationSearch:ZO},props:{modelValue:{type:[Object,Array]}},created(){console.log("CREATED LOCATION"),this.model||this.singleValue&&(this.model=pf())},mixins:[z],computed:{singleTeleportID(){return Math.floor(Math.random()*1e4)+1},multipleTeleportIDs(){const e=this;return e.model.map(function(n,r){return`${e.singleTeleportID}-${r}`})}},methods:{refocus(){const e=this.$el.querySelector(".search input");e&&(e.focus(),console.log("foxys"))},checkRemoveEntry(e,n){if(this.singleValue){this.singleAdvancedOptions=!1;return}this.canRemoveValue&&this.remove(e)},removeValue(){this.model=this.getNewDefaultEntry(),this.dispatch()},getNewDefaultEntry(){return pf()}}},o2={key:0,class:"ux-field-title"},i2={key:0,class:"ux-required-marker"},s2={key:1,class:"ux-field-description"},l2={key:2},a2={class:"location-field-wrap"},c2=["id"],d2={key:3,class:"location-field-wrap"},u2=["id"];function m2(e,n,r,i,s,o){const l=t.resolveComponent("location-search"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-icon"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row"),m=t.resolveComponent("location-select");return t.openBlock(),t.createElementBlock("div",null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",o2,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",i2,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",s2,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",l2,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.model,(f,h)=>(t.openBlock(),t.createElementBlock("div",{class:"ux-location-row",key:h},[t.createElementVNode("div",a2,[t.createVNode(u,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(l,{deselectEnabled:e.canRemoveValue,onDeselect:y=>o.checkRemoveEntry(f,h),modelValue:e.model[h],"onUpdate:modelValue":y=>e.model[h]=y,advanced:s.multiAdvancedOptions[h],"onUpdate:advanced":y=>s.multiAdvancedOptions[h]=y,"show-advanced-toggle":""},null,8,["deselectEnabled","onDeselect","modelValue","onUpdate:modelValue","advanced","onUpdate:advanced"])]),_:2},1024),e.canRemoveValue&&!(f.latitude&&f.longitude)?(t.openBlock(),t.createBlock(a,{key:0,shrink:""},{default:t.withCtx(()=>[t.createVNode(d,{tag:"a",icon:"",onClick:y=>e.remove(f)},{default:t.withCtx(()=>[t.createVNode(c,{icon:"fa-times"})]),_:2},1032,["onClick"])]),_:2},1024)):t.createCommentVNode("",!0)]),_:2},1024),t.createElementVNode("div",{class:"teleport-results",id:`teleport-${o.multipleTeleportIDs[h]}`},null,8,c2),s.multiAdvancedOptions[h]?(t.openBlock(),t.createBlock(m,{key:0,onFocus:e.touch,ref_for:!0,ref:"input",modelValue:e.model[h],"onUpdate:modelValue":y=>e.model[h]=y,class:"ux-location-select ux-field-focus ux-location-multiple"},null,8,["onFocus","modelValue","onUpdate:modelValue"])):t.createCommentVNode("",!0)])]))),128)),e.canAddValue?(t.openBlock(),t.createBlock(d,{key:0,onClick:n[0]||(n[0]=f=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel)+" ",1),t.createVNode(c,{icon:"fa-plus",right:""})]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock("div",d2,[t.createVNode(u,null,{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(l,{onDeselect:o.checkRemoveEntry,modelValue:e.model,"onUpdate:modelValue":n[1]||(n[1]=f=>e.model=f),advanced:s.singleAdvancedOptions,"onUpdate:advanced":n[2]||(n[2]=f=>s.singleAdvancedOptions=f),"show-advanced-toggle":""},null,8,["onDeselect","modelValue","advanced"]),t.createElementVNode("div",{class:"teleport-results",id:`teleport-${o.singleTeleportID}`},null,8,u2),s.singleAdvancedOptions?(t.openBlock(),t.createBlock(m,{key:0,assumeDefault:!!e.field.assumeDefault,class:"ux-location-select ux-field-focus ux-location-single",ref:"input",onFocus:e.touch,modelValue:e.model,"onUpdate:modelValue":n[3]||(n[3]=f=>e.model=f)},null,8,["assumeDefault","onFocus","modelValue"])):t.createCommentVNode("",!0)]),_:1})]),_:1})]))])}const f2=w(r2,[["render",m2],["__scopeId","data-v-eac978e1"]]),h2={props:{modelValue:{type:[String,Array]}},mixins:[z],methods:{enterPress(){},getNewDefaultEntry(){return""}}},p2={key:0,class:"ux-field-title"},y2={key:0,class:"ux-required-marker"},g2={key:1,class:"ux-field-description"},k2={key:2},_2={class:"expression-field-wrap"},w2={key:3,class:"expression-field-wrap"};function x2(e,n,r,i,s,o){const l=t.resolveComponent("expression-editor"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-icon"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock("div",{onKeydown:n[2]||(n[2]=t.withKeys(t.withModifiers(m=>o.enterPress(m),["stop"]),["enter"]))},[e.showLabel?(t.openBlock(),t.createElementBlock("label",p2,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",y2,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",g2,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",k2,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.model,(m,f)=>(t.openBlock(),t.createBlock(u,{class:"ux-text-row",key:f},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createElementVNode("div",_2,[t.createVNode(l,{field:e.field,onFocus:e.touch,ref_for:!0,ref:"input",modelValue:e.model[f],"onUpdate:modelValue":h=>e.model[f]=h,class:"ux-expression ux-field-focus ux-text-area-multiple"},null,8,["field","onFocus","modelValue","onUpdate:modelValue"])])]),_:2},1024),t.createVNode(a,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(d,{key:0,tag:"a",icon:"",onClick:h=>e.remove(m)},{default:t.withCtx(()=>[t.createVNode(c,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(d,{key:0,onClick:n[0]||(n[0]=m=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock("div",w2,[t.createVNode(l,{field:e.field,class:"ux-expression ux-field-focus ux-text-area-single",onFocus:e.touch,modelValue:e.model,"onUpdate:modelValue":n[1]||(n[1]=m=>e.model=m)},null,8,["field","onFocus","modelValue"])]))],32)}const b2=w(h2,[["render",x2],["__scopeId","data-v-56c3b71b"]]),C2={components:{},methods:{},props:{modelValue:{type:String,default(){return""}},lang:{type:String}},watch:{modelValue(e){this.model=e},model(e){this.$emit("update:modelValue",e)}},mounted(){this.mounted=!0},beforeUnmount(){this.mounted=!1},data(){return{mounted:!1,model:this.modelValue}}};function V2(e,n,r,i,s,o){const l=t.resolveComponent("tiptap"),a=t.resolveComponent("flex-column");return s.mounted?(t.openBlock(),t.createBlock(a,{key:0},{default:t.withCtx(()=>[t.createVNode(l,{modelValue:s.model,"onUpdate:modelValue":n[0]||(n[0]=c=>s.model=c),style:{height:"250px"}},null,8,["modelValue"])]),_:1})):t.createCommentVNode("",!0)}const N2={components:{richtext:w(C2,[["render",V2],["__scopeId","data-v-844777a7"]])},props:{modelValue:{type:[String,Array]}},computed:{},mixins:[z],methods:{getNewDefaultEntry(){return""}}},E2={key:0,class:"ux-field-title"},B2={key:0,class:"ux-required-marker"},S2={key:1,class:"ux-field-description"},T2={key:2},D2={class:"richtext-field-wrap"},O2={key:3,class:"richtext-field-wrap"};function M2(e,n,r,i,s,o){const l=t.resolveComponent("richtext"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-icon"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock("div",null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",E2,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",B2,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",S2,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",T2,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.model,(m,f)=>(t.openBlock(),t.createBlock(u,{class:"ux-text-row",key:f},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createElementVNode("div",D2,[t.createVNode(l,{onFocus:e.touch,ref_for:!0,ref:"input",modelValue:e.model[f],"onUpdate:modelValue":h=>e.model[f]=h,class:"ux-richtext ux-field-focus ux-text-area-multiple"},null,8,["onFocus","modelValue","onUpdate:modelValue"])])]),_:2},1024),t.createVNode(a,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(d,{key:0,tag:"a",icon:"",onClick:h=>e.remove(m)},{default:t.withCtx(()=>[t.createVNode(c,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(d,{key:0,onClick:n[0]||(n[0]=m=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock("div",O2,[t.createVNode(l,{class:"ux-richtext ux-field-focus ux-text-area-single",onFocus:e.touch,modelValue:e.model,"onUpdate:modelValue":n[1]||(n[1]=m=>e.model=m)},null,8,["onFocus","modelValue"])]))])}const F2=w(N2,[["render",M2],["__scopeId","data-v-396fd196"]]);var vr={exports:{}},yf;function I2(){return yf||(yf=1,function(e,n){(function(r){var i="Compound",s="Identifier",o="MemberExpression",l="Literal",a="ThisExpression",c="CallExpression",d="UnaryExpression",u="BinaryExpression",m="LogicalExpression",f="ConditionalExpression",h="ArrayExpression",y=46,p=44,g=39,k=34,x=40,S=41,A=91,R=93,C=63,D=59,I=58,M=function(O,V){var je=new Error(O+" at character "+V);throw je.index=V,je.description=O,je},j=!0,L={"-":j,"!":j,"~":j,"+":j},te={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},q=function(O){var V=0,je;for(var St in O)(je=St.length)>V&&O.hasOwnProperty(St)&&(V=je);return V},v=q(L),ae=q(te),me={true:!0,false:!1,null:null},Ye="this",Re=function(O){return te[O]||0},Bt=function(O,V,je){var St=O==="||"||O==="&&"?m:u;return{type:St,operator:O,left:V,right:je}},tt=function(O){return O>=48&&O<=57},Ue=function(O){return O===36||O===95||O>=65&&O<=90||O>=97&&O<=122||O>=128&&!te[String.fromCharCode(O)]},at=function(O){return O===36||O===95||O>=65&&O<=90||O>=97&&O<=122||O>=48&&O<=57||O>=128&&!te[String.fromCharCode(O)]},ke=function(O){for(var V=0,je=O.charAt,St=O.charCodeAt,xe=function(N){return je.call(O,N)},ne=function(N){return St.call(O,N)},Zt=O.length,b=function(){for(var N=ne(V);N===32||N===9||N===10||N===13;)N=ne(++V)},pn=function(){var N=qL(),F,G;if(b(),ne(V)===C){if(V++,F=pn(),F||M("Expected expression",V),b(),ne(V)===I)return V++,G=pn(),G||M("Expected expression",V),{type:f,test:N,consequent:F,alternate:G};M("Expected :",V)}else return N},Lh=function(){b();for(var N=O.substr(V,ae),F=N.length;F>0;){if(te.hasOwnProperty(N)&&(!Ue(ne(V))||V+N.length<O.length&&!at(ne(V+N.length))))return V+=F,N;N=N.substr(0,--F)}return!1},qL=function(){var N,F,G,re,Xt,Je,Tt,yn,Uh;if(Je=no(),F=Lh(),!F)return Je;for(Xt={value:F,prec:Re(F)},Tt=no(),Tt||M("Expected expression after "+F,V),re=[Je,Xt,Tt];(F=Lh())&&(G=Re(F),G!==0);){for(Xt={value:F,prec:G},Uh=F;re.length>2&&G<=re[re.length-2].prec;)Tt=re.pop(),F=re.pop().value,Je=re.pop(),N=Bt(F,Je,Tt),re.push(N);N=no(),N||M("Expected expression after "+Uh,V),re.push(Xt,N)}for(yn=re.length-1,N=re[yn];yn>1;)N=Bt(re[yn-1].value,re[yn-2],N),yn-=2;return N},no=function(){var N,F,G;if(b(),N=ne(V),tt(N)||N===y)return zL();if(N===g||N===k)return WL();if(N===A)return YL();for(F=O.substr(V,v),G=F.length;G>0;){if(L.hasOwnProperty(F)&&(!Ue(ne(V))||V+F.length<O.length&&!at(ne(V+F.length))))return V+=G,{type:d,operator:F,argument:no(),prefix:!0};F=F.substr(0,--G)}return Ue(N)||N===x?HL():!1},zL=function(){for(var N="",F,G;tt(ne(V));)N+=xe(V++);if(ne(V)===y)for(N+=xe(V++);tt(ne(V));)N+=xe(V++);if(F=xe(V),F==="e"||F==="E"){for(N+=xe(V++),F=xe(V),(F==="+"||F==="-")&&(N+=xe(V++));tt(ne(V));)N+=xe(V++);tt(ne(V-1))||M("Expected exponent ("+N+xe(V)+")",V)}return G=ne(V),Ue(G)?M("Variable names cannot start with a number ("+N+xe(V)+")",V):G===y&&M("Unexpected period",V),{type:l,value:parseFloat(N),raw:N}},WL=function(){for(var N="",F=xe(V++),G=!1,re;V<Zt;)if(re=xe(V++),re===F){G=!0;break}else if(re==="\\")switch(re=xe(V++),re){case"n":N+=`
26
+ */function im(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function Xe(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?im(Object(r),!0).forEach(function(i){AV(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):im(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function Lr(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Lr=function(n){return typeof n}:Lr=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Lr(e)}function AV(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function it(){return it=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},it.apply(this,arguments)}function LV(e,n){if(e==null)return{};var r={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(n.indexOf(s)>=0)&&(r[s]=e[s]);return r}function $V(e,n){if(e==null)return{};var r=LV(e,n),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}var PV="1.14.0";function st(e){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(e)}var lt=st(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Ln=st(/Edge/i),sm=st(/firefox/i),$n=st(/safari/i)&&!st(/chrome/i)&&!st(/android/i),lm=st(/iP(ad|od|hone)/i),RV=st(/chrome/i)&&st(/android/i),am={capture:!1,passive:!1};function X(e,n,r){e.addEventListener(n,r,!lt&&am)}function J(e,n,r){e.removeEventListener(n,r,!lt&&am)}function $r(e,n){if(n){if(n[0]===">"&&(n=n.substring(1)),e)try{if(e.matches)return e.matches(n);if(e.msMatchesSelector)return e.msMatchesSelector(n);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(n)}catch{return!1}return!1}}function UV(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function Qe(e,n,r,i){if(e){r=r||document;do{if(n!=null&&(n[0]===">"?e.parentNode===r&&$r(e,n):$r(e,n))||i&&e===r)return e;if(e===r)break}while(e=UV(e))}return null}var cm=/\s+/g;function Oe(e,n,r){if(e&&n)if(e.classList)e.classList[r?"add":"remove"](n);else{var i=(" "+e.className+" ").replace(cm," ").replace(" "+n+" "," ");e.className=(i+(r?" "+n:"")).replace(cm," ")}}function $(e,n,r){var i=e&&e.style;if(i){if(r===void 0)return document.defaultView&&document.defaultView.getComputedStyle?r=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(r=e.currentStyle),n===void 0?r:r[n];!(n in i)&&n.indexOf("webkit")===-1&&(n="-webkit-"+n),i[n]=r+(typeof r=="string"?"":"px")}}function cn(e,n){var r="";if(typeof e=="string")r=e;else do{var i=$(e,"transform");i&&i!=="none"&&(r=i+" "+r)}while(!n&&(e=e.parentNode));var s=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return s&&new s(r)}function dm(e,n,r){if(e){var i=e.getElementsByTagName(n),s=0,o=i.length;if(r)for(;s<o;s++)r(i[s],s);return i}return[]}function ve(){var e=document.scrollingElement;return e||document.documentElement}function ge(e,n,r,i,s){if(!(!e.getBoundingClientRect&&e!==window)){var o,l,a,c,d,u,m;if(e!==window&&e.parentNode&&e!==ve()?(o=e.getBoundingClientRect(),l=o.top,a=o.left,c=o.bottom,d=o.right,u=o.height,m=o.width):(l=0,a=0,c=window.innerHeight,d=window.innerWidth,u=window.innerHeight,m=window.innerWidth),(n||r)&&e!==window&&(s=s||e.parentNode,!lt))do if(s&&s.getBoundingClientRect&&($(s,"transform")!=="none"||r&&$(s,"position")!=="static")){var f=s.getBoundingClientRect();l-=f.top+parseInt($(s,"border-top-width")),a-=f.left+parseInt($(s,"border-left-width")),c=l+o.height,d=a+o.width;break}while(s=s.parentNode);if(i&&e!==window){var h=cn(s||e),y=h&&h.a,p=h&&h.d;h&&(l/=p,a/=y,m/=y,u/=p,c=l+u,d=a+m)}return{top:l,left:a,bottom:c,right:d,width:m,height:u}}}function um(e,n,r){for(var i=wt(e,!0),s=ge(e)[n];i;){var o=ge(i)[r],l=void 0;if(l=s>=o,!l)return i;if(i===ve())break;i=wt(i,!1)}return!1}function dn(e,n,r,i){for(var s=0,o=0,l=e.children;o<l.length;){if(l[o].style.display!=="none"&&l[o]!==P.ghost&&(i||l[o]!==P.dragged)&&Qe(l[o],r.draggable,e,!1)){if(s===n)return l[o];s++}o++}return null}function us(e,n){for(var r=e.lastElementChild;r&&(r===P.ghost||$(r,"display")==="none"||n&&!$r(r,n));)r=r.previousElementSibling;return r||null}function Pe(e,n){var r=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)e.nodeName.toUpperCase()!=="TEMPLATE"&&e!==P.clone&&(!n||$r(e,n))&&r++;return r}function mm(e){var n=0,r=0,i=ve();if(e)do{var s=cn(e),o=s.a,l=s.d;n+=e.scrollLeft*o,r+=e.scrollTop*l}while(e!==i&&(e=e.parentNode));return[n,r]}function jV(e,n){for(var r in e)if(e.hasOwnProperty(r)){for(var i in n)if(n.hasOwnProperty(i)&&n[i]===e[r][i])return Number(r)}return-1}function wt(e,n){if(!e||!e.getBoundingClientRect)return ve();var r=e,i=!1;do if(r.clientWidth<r.scrollWidth||r.clientHeight<r.scrollHeight){var s=$(r);if(r.clientWidth<r.scrollWidth&&(s.overflowX=="auto"||s.overflowX=="scroll")||r.clientHeight<r.scrollHeight&&(s.overflowY=="auto"||s.overflowY=="scroll")){if(!r.getBoundingClientRect||r===document.body)return ve();if(i||n)return r;i=!0}}while(r=r.parentNode);return ve()}function qV(e,n){if(e&&n)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r]);return e}function ms(e,n){return Math.round(e.top)===Math.round(n.top)&&Math.round(e.left)===Math.round(n.left)&&Math.round(e.height)===Math.round(n.height)&&Math.round(e.width)===Math.round(n.width)}var Pn;function fm(e,n){return function(){if(!Pn){var r=arguments,i=this;r.length===1?e.call(i,r[0]):e.apply(i,r),Pn=setTimeout(function(){Pn=void 0},n)}}}function zV(){clearTimeout(Pn),Pn=void 0}function hm(e,n,r){e.scrollLeft+=n,e.scrollTop+=r}function pm(e){var n=window.Polymer,r=window.jQuery||window.Zepto;return n&&n.dom?n.dom(e).cloneNode(!0):r?r(e).clone(!0)[0]:e.cloneNode(!0)}var Me="Sortable"+new Date().getTime();function WV(){var e=[],n;return{captureAnimationState:function(){if(e=[],!!this.options.animation){var i=[].slice.call(this.el.children);i.forEach(function(s){if(!($(s,"display")==="none"||s===P.ghost)){e.push({target:s,rect:ge(s)});var o=Xe({},e[e.length-1].rect);if(s.thisAnimationDuration){var l=cn(s,!0);l&&(o.top-=l.f,o.left-=l.e)}s.fromRect=o}})}},addAnimationState:function(i){e.push(i)},removeAnimationState:function(i){e.splice(jV(e,{target:i}),1)},animateAll:function(i){var s=this;if(!this.options.animation){clearTimeout(n),typeof i=="function"&&i();return}var o=!1,l=0;e.forEach(function(a){var c=0,d=a.target,u=d.fromRect,m=ge(d),f=d.prevFromRect,h=d.prevToRect,y=a.rect,p=cn(d,!0);p&&(m.top-=p.f,m.left-=p.e),d.toRect=m,d.thisAnimationDuration&&ms(f,m)&&!ms(u,m)&&(y.top-m.top)/(y.left-m.left)===(u.top-m.top)/(u.left-m.left)&&(c=GV(y,f,h,s.options)),ms(m,u)||(d.prevFromRect=u,d.prevToRect=m,c||(c=s.options.animation),s.animate(d,y,m,c)),c&&(o=!0,l=Math.max(l,c),clearTimeout(d.animationResetTimer),d.animationResetTimer=setTimeout(function(){d.animationTime=0,d.prevFromRect=null,d.fromRect=null,d.prevToRect=null,d.thisAnimationDuration=null},c),d.thisAnimationDuration=c)}),clearTimeout(n),o?n=setTimeout(function(){typeof i=="function"&&i()},l):typeof i=="function"&&i(),e=[]},animate:function(i,s,o,l){if(l){$(i,"transition",""),$(i,"transform","");var a=cn(this.el),c=a&&a.a,d=a&&a.d,u=(s.left-o.left)/(c||1),m=(s.top-o.top)/(d||1);i.animatingX=!!u,i.animatingY=!!m,$(i,"transform","translate3d("+u+"px,"+m+"px,0)"),this.forRepaintDummy=HV(i),$(i,"transition","transform "+l+"ms"+(this.options.easing?" "+this.options.easing:"")),$(i,"transform","translate3d(0,0,0)"),typeof i.animated=="number"&&clearTimeout(i.animated),i.animated=setTimeout(function(){$(i,"transition",""),$(i,"transform",""),i.animated=!1,i.animatingX=!1,i.animatingY=!1},l)}}}}function HV(e){return e.offsetWidth}function GV(e,n,r,i){return Math.sqrt(Math.pow(n.top-e.top,2)+Math.pow(n.left-e.left,2))/Math.sqrt(Math.pow(n.top-r.top,2)+Math.pow(n.left-r.left,2))*i.animation}var un=[],fs={initializeByDefault:!0},Rn={mount:function(n){for(var r in fs)fs.hasOwnProperty(r)&&!(r in n)&&(n[r]=fs[r]);un.forEach(function(i){if(i.pluginName===n.pluginName)throw"Sortable: Cannot mount plugin ".concat(n.pluginName," more than once")}),un.push(n)},pluginEvent:function(n,r,i){var s=this;this.eventCanceled=!1,i.cancel=function(){s.eventCanceled=!0};var o=n+"Global";un.forEach(function(l){r[l.pluginName]&&(r[l.pluginName][o]&&r[l.pluginName][o](Xe({sortable:r},i)),r.options[l.pluginName]&&r[l.pluginName][n]&&r[l.pluginName][n](Xe({sortable:r},i)))})},initializePlugins:function(n,r,i,s){un.forEach(function(a){var c=a.pluginName;if(!(!n.options[c]&&!a.initializeByDefault)){var d=new a(n,r,n.options);d.sortable=n,d.options=n.options,n[c]=d,it(i,d.defaults)}});for(var o in n.options)if(n.options.hasOwnProperty(o)){var l=this.modifyOption(n,o,n.options[o]);typeof l<"u"&&(n.options[o]=l)}},getEventProperties:function(n,r){var i={};return un.forEach(function(s){typeof s.eventProperties=="function"&&it(i,s.eventProperties.call(r[s.pluginName],n))}),i},modifyOption:function(n,r,i){var s;return un.forEach(function(o){n[o.pluginName]&&o.optionListeners&&typeof o.optionListeners[r]=="function"&&(s=o.optionListeners[r].call(n[o.pluginName],i))}),s}};function YV(e){var n=e.sortable,r=e.rootEl,i=e.name,s=e.targetEl,o=e.cloneEl,l=e.toEl,a=e.fromEl,c=e.oldIndex,d=e.newIndex,u=e.oldDraggableIndex,m=e.newDraggableIndex,f=e.originalEvent,h=e.putSortable,y=e.extraEventProperties;if(n=n||r&&r[Me],!!n){var p,g=n.options,k="on"+i.charAt(0).toUpperCase()+i.substr(1);window.CustomEvent&&!lt&&!Ln?p=new CustomEvent(i,{bubbles:!0,cancelable:!0}):(p=document.createEvent("Event"),p.initEvent(i,!0,!0)),p.to=l||r,p.from=a||r,p.item=s||r,p.clone=o,p.oldIndex=c,p.newIndex=d,p.oldDraggableIndex=u,p.newDraggableIndex=m,p.originalEvent=f,p.pullMode=h?h.lastPutMode:void 0;var x=Xe(Xe({},y),Rn.getEventProperties(i,n));for(var S in x)p[S]=x[S];r&&r.dispatchEvent(p),g[k]&&g[k].call(n,p)}}var JV=["evt"],Te=function(n,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=i.evt,o=$V(i,JV);Rn.pluginEvent.bind(P)(n,r,Xe({dragEl:B,parentEl:de,ghostEl:U,rootEl:ie,nextEl:Gt,lastDownEl:Pr,cloneEl:ue,cloneHidden:xt,dragStarted:jn,putSortable:_e,activeSortable:P.active,originalEvent:s,oldIndex:mn,oldDraggableIndex:Un,newIndex:Fe,newDraggableIndex:bt,hideGhostForTarget:bm,unhideGhostForTarget:Cm,cloneNowHidden:function(){xt=!0},cloneNowShown:function(){xt=!1},dispatchSortableEvent:function(a){Ve({sortable:r,name:a,originalEvent:s})}},o))};function Ve(e){YV(Xe({putSortable:_e,cloneEl:ue,targetEl:B,rootEl:ie,oldIndex:mn,oldDraggableIndex:Un,newIndex:Fe,newDraggableIndex:bt},e))}var B,de,U,ie,Gt,Pr,ue,xt,mn,Fe,Un,bt,Rr,_e,fn=!1,Ur=!1,jr=[],Yt,Ge,hs,ps,ym,gm,jn,hn,qn,zn=!1,qr=!1,zr,be,ys=[],gs=!1,Wr=[],Hr=typeof document<"u",Gr=lm,km=Ln||lt?"cssFloat":"float",KV=Hr&&!RV&&!lm&&"draggable"in document.createElement("div"),_m=function(){if(Hr){if(lt)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto",e.style.pointerEvents==="auto"}}(),wm=function(n,r){var i=$(n),s=parseInt(i.width)-parseInt(i.paddingLeft)-parseInt(i.paddingRight)-parseInt(i.borderLeftWidth)-parseInt(i.borderRightWidth),o=dn(n,0,r),l=dn(n,1,r),a=o&&$(o),c=l&&$(l),d=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+ge(o).width,u=c&&parseInt(c.marginLeft)+parseInt(c.marginRight)+ge(l).width;if(i.display==="flex")return i.flexDirection==="column"||i.flexDirection==="column-reverse"?"vertical":"horizontal";if(i.display==="grid")return i.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&a.float&&a.float!=="none"){var m=a.float==="left"?"left":"right";return l&&(c.clear==="both"||c.clear===m)?"vertical":"horizontal"}return o&&(a.display==="block"||a.display==="flex"||a.display==="table"||a.display==="grid"||d>=s&&i[km]==="none"||l&&i[km]==="none"&&d+u>s)?"vertical":"horizontal"},ZV=function(n,r,i){var s=i?n.left:n.top,o=i?n.right:n.bottom,l=i?n.width:n.height,a=i?r.left:r.top,c=i?r.right:r.bottom,d=i?r.width:r.height;return s===a||o===c||s+l/2===a+d/2},XV=function(n,r){var i;return jr.some(function(s){var o=s[Me].options.emptyInsertThreshold;if(!(!o||us(s))){var l=ge(s),a=n>=l.left-o&&n<=l.right+o,c=r>=l.top-o&&r<=l.bottom+o;if(a&&c)return i=s}}),i},xm=function(n){function r(o,l){return function(a,c,d,u){var m=a.options.group.name&&c.options.group.name&&a.options.group.name===c.options.group.name;if(o==null&&(l||m))return!0;if(o==null||o===!1)return!1;if(l&&o==="clone")return o;if(typeof o=="function")return r(o(a,c,d,u),l)(a,c,d,u);var f=(l?a:c).options.group.name;return o===!0||typeof o=="string"&&o===f||o.join&&o.indexOf(f)>-1}}var i={},s=n.group;(!s||Lr(s)!="object")&&(s={name:s}),i.name=s.name,i.checkPull=r(s.pull,!0),i.checkPut=r(s.put),i.revertClone=s.revertClone,n.group=i},bm=function(){!_m&&U&&$(U,"display","none")},Cm=function(){!_m&&U&&$(U,"display","")};Hr&&document.addEventListener("click",function(e){if(Ur)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Ur=!1,!1},!0);var Jt=function(n){if(B){n=n.touches?n.touches[0]:n;var r=XV(n.clientX,n.clientY);if(r){var i={};for(var s in n)n.hasOwnProperty(s)&&(i[s]=n[s]);i.target=i.rootEl=r,i.preventDefault=void 0,i.stopPropagation=void 0,r[Me]._onDragOver(i)}}},QV=function(n){B&&B.parentNode[Me]._isOutsideThisEl(n.target)};function P(e,n){if(!(e&&e.nodeType&&e.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=n=it({},n),e[Me]=this;var r={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return wm(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(l,a){l.setData("Text",a.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:P.supportPointer!==!1&&"PointerEvent"in window&&!$n,emptyInsertThreshold:5};Rn.initializePlugins(this,e,r);for(var i in r)!(i in n)&&(n[i]=r[i]);xm(n);for(var s in this)s.charAt(0)==="_"&&typeof this[s]=="function"&&(this[s]=this[s].bind(this));this.nativeDraggable=n.forceFallback?!1:KV,this.nativeDraggable&&(this.options.touchStartThreshold=1),n.supportPointer?X(e,"pointerdown",this._onTapStart):(X(e,"mousedown",this._onTapStart),X(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(X(e,"dragover",this),X(e,"dragenter",this)),jr.push(this.el),n.store&&n.store.get&&this.sort(n.store.get(this)||[]),it(this,WV())}P.prototype={constructor:P,_isOutsideThisEl:function(n){!this.el.contains(n)&&n!==this.el&&(hn=null)},_getDirection:function(n,r){return typeof this.options.direction=="function"?this.options.direction.call(this,n,r,B):this.options.direction},_onTapStart:function(n){if(n.cancelable){var r=this,i=this.el,s=this.options,o=s.preventOnFilter,l=n.type,a=n.touches&&n.touches[0]||n.pointerType&&n.pointerType==="touch"&&n,c=(a||n).target,d=n.target.shadowRoot&&(n.path&&n.path[0]||n.composedPath&&n.composedPath()[0])||c,u=s.filter;if(sN(i),!B&&!(/mousedown|pointerdown/.test(l)&&n.button!==0||s.disabled)&&!d.isContentEditable&&!(!this.nativeDraggable&&$n&&c&&c.tagName.toUpperCase()==="SELECT")&&(c=Qe(c,s.draggable,i,!1),!(c&&c.animated)&&Pr!==c)){if(mn=Pe(c),Un=Pe(c,s.draggable),typeof u=="function"){if(u.call(this,n,c,this)){Ve({sortable:r,rootEl:d,name:"filter",targetEl:c,toEl:i,fromEl:i}),Te("filter",r,{evt:n}),o&&n.cancelable&&n.preventDefault();return}}else if(u&&(u=u.split(",").some(function(m){if(m=Qe(d,m.trim(),i,!1),m)return Ve({sortable:r,rootEl:m,name:"filter",targetEl:c,fromEl:i,toEl:i}),Te("filter",r,{evt:n}),!0}),u)){o&&n.cancelable&&n.preventDefault();return}s.handle&&!Qe(d,s.handle,i,!1)||this._prepareDragStart(n,a,c)}}},_prepareDragStart:function(n,r,i){var s=this,o=s.el,l=s.options,a=o.ownerDocument,c;if(i&&!B&&i.parentNode===o){var d=ge(i);if(ie=o,B=i,de=B.parentNode,Gt=B.nextSibling,Pr=i,Rr=l.group,P.dragged=B,Yt={target:B,clientX:(r||n).clientX,clientY:(r||n).clientY},ym=Yt.clientX-d.left,gm=Yt.clientY-d.top,this._lastX=(r||n).clientX,this._lastY=(r||n).clientY,B.style["will-change"]="all",c=function(){if(Te("delayEnded",s,{evt:n}),P.eventCanceled){s._onDrop();return}s._disableDelayedDragEvents(),!sm&&s.nativeDraggable&&(B.draggable=!0),s._triggerDragStart(n,r),Ve({sortable:s,name:"choose",originalEvent:n}),Oe(B,l.chosenClass,!0)},l.ignore.split(",").forEach(function(u){dm(B,u.trim(),ks)}),X(a,"dragover",Jt),X(a,"mousemove",Jt),X(a,"touchmove",Jt),X(a,"mouseup",s._onDrop),X(a,"touchend",s._onDrop),X(a,"touchcancel",s._onDrop),sm&&this.nativeDraggable&&(this.options.touchStartThreshold=4,B.draggable=!0),Te("delayStart",this,{evt:n}),l.delay&&(!l.delayOnTouchOnly||r)&&(!this.nativeDraggable||!(Ln||lt))){if(P.eventCanceled){this._onDrop();return}X(a,"mouseup",s._disableDelayedDrag),X(a,"touchend",s._disableDelayedDrag),X(a,"touchcancel",s._disableDelayedDrag),X(a,"mousemove",s._delayedDragTouchMoveHandler),X(a,"touchmove",s._delayedDragTouchMoveHandler),l.supportPointer&&X(a,"pointermove",s._delayedDragTouchMoveHandler),s._dragStartTimer=setTimeout(c,l.delay)}else c()}},_delayedDragTouchMoveHandler:function(n){var r=n.touches?n.touches[0]:n;Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){B&&ks(B),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var n=this.el.ownerDocument;J(n,"mouseup",this._disableDelayedDrag),J(n,"touchend",this._disableDelayedDrag),J(n,"touchcancel",this._disableDelayedDrag),J(n,"mousemove",this._delayedDragTouchMoveHandler),J(n,"touchmove",this._delayedDragTouchMoveHandler),J(n,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(n,r){r=r||n.pointerType=="touch"&&n,!this.nativeDraggable||r?this.options.supportPointer?X(document,"pointermove",this._onTouchMove):r?X(document,"touchmove",this._onTouchMove):X(document,"mousemove",this._onTouchMove):(X(B,"dragend",this),X(ie,"dragstart",this._onDragStart));try{document.selection?Jr(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(n,r){if(fn=!1,ie&&B){Te("dragStarted",this,{evt:r}),this.nativeDraggable&&X(document,"dragover",QV);var i=this.options;!n&&Oe(B,i.dragClass,!1),Oe(B,i.ghostClass,!0),P.active=this,n&&this._appendGhost(),Ve({sortable:this,name:"start",originalEvent:r})}else this._nulling()},_emulateDragOver:function(){if(Ge){this._lastX=Ge.clientX,this._lastY=Ge.clientY,bm();for(var n=document.elementFromPoint(Ge.clientX,Ge.clientY),r=n;n&&n.shadowRoot&&(n=n.shadowRoot.elementFromPoint(Ge.clientX,Ge.clientY),n!==r);)r=n;if(B.parentNode[Me]._isOutsideThisEl(n),r)do{if(r[Me]){var i=void 0;if(i=r[Me]._onDragOver({clientX:Ge.clientX,clientY:Ge.clientY,target:n,rootEl:r}),i&&!this.options.dragoverBubble)break}n=r}while(r=r.parentNode);Cm()}},_onTouchMove:function(n){if(Yt){var r=this.options,i=r.fallbackTolerance,s=r.fallbackOffset,o=n.touches?n.touches[0]:n,l=U&&cn(U,!0),a=U&&l&&l.a,c=U&&l&&l.d,d=Gr&&be&&mm(be),u=(o.clientX-Yt.clientX+s.x)/(a||1)+(d?d[0]-ys[0]:0)/(a||1),m=(o.clientY-Yt.clientY+s.y)/(c||1)+(d?d[1]-ys[1]:0)/(c||1);if(!P.active&&!fn){if(i&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))<i)return;this._onDragStart(n,!0)}if(U){l?(l.e+=u-(hs||0),l.f+=m-(ps||0)):l={a:1,b:0,c:0,d:1,e:u,f:m};var f="matrix(".concat(l.a,",").concat(l.b,",").concat(l.c,",").concat(l.d,",").concat(l.e,",").concat(l.f,")");$(U,"webkitTransform",f),$(U,"mozTransform",f),$(U,"msTransform",f),$(U,"transform",f),hs=u,ps=m,Ge=o}n.cancelable&&n.preventDefault()}},_appendGhost:function(){if(!U){var n=this.options.fallbackOnBody?document.body:ie,r=ge(B,!0,Gr,!0,n),i=this.options;if(Gr){for(be=n;$(be,"position")==="static"&&$(be,"transform")==="none"&&be!==document;)be=be.parentNode;be!==document.body&&be!==document.documentElement?(be===document&&(be=ve()),r.top+=be.scrollTop,r.left+=be.scrollLeft):be=ve(),ys=mm(be)}U=B.cloneNode(!0),Oe(U,i.ghostClass,!1),Oe(U,i.fallbackClass,!0),Oe(U,i.dragClass,!0),$(U,"transition",""),$(U,"transform",""),$(U,"box-sizing","border-box"),$(U,"margin",0),$(U,"top",r.top),$(U,"left",r.left),$(U,"width",r.width),$(U,"height",r.height),$(U,"opacity","0.8"),$(U,"position",Gr?"absolute":"fixed"),$(U,"zIndex","100000"),$(U,"pointerEvents","none"),P.ghost=U,n.appendChild(U),$(U,"transform-origin",ym/parseInt(U.style.width)*100+"% "+gm/parseInt(U.style.height)*100+"%")}},_onDragStart:function(n,r){var i=this,s=n.dataTransfer,o=i.options;if(Te("dragStart",this,{evt:n}),P.eventCanceled){this._onDrop();return}Te("setupClone",this),P.eventCanceled||(ue=pm(B),ue.draggable=!1,ue.style["will-change"]="",this._hideClone(),Oe(ue,this.options.chosenClass,!1),P.clone=ue),i.cloneId=Jr(function(){Te("clone",i),!P.eventCanceled&&(i.options.removeCloneOnHide||ie.insertBefore(ue,B),i._hideClone(),Ve({sortable:i,name:"clone"}))}),!r&&Oe(B,o.dragClass,!0),r?(Ur=!0,i._loopId=setInterval(i._emulateDragOver,50)):(J(document,"mouseup",i._onDrop),J(document,"touchend",i._onDrop),J(document,"touchcancel",i._onDrop),s&&(s.effectAllowed="move",o.setData&&o.setData.call(i,s,B)),X(document,"drop",i),$(B,"transform","translateZ(0)")),fn=!0,i._dragStartId=Jr(i._dragStarted.bind(i,r,n)),X(document,"selectstart",i),jn=!0,$n&&$(document.body,"user-select","none")},_onDragOver:function(n){var r=this.el,i=n.target,s,o,l,a=this.options,c=a.group,d=P.active,u=Rr===c,m=a.sort,f=_e||d,h,y=this,p=!1;if(gs)return;function g(Re,Bt){Te(Re,y,Xe({evt:n,isOwner:u,axis:h?"vertical":"horizontal",revert:l,dragRect:s,targetRect:o,canSort:m,fromSortable:f,target:i,completed:x,onMove:function(Ue,at){return Yr(ie,r,B,s,Ue,ge(Ue),n,at)},changed:S},Bt))}function k(){g("dragOverAnimationCapture"),y.captureAnimationState(),y!==f&&f.captureAnimationState()}function x(Re){return g("dragOverCompleted",{insertion:Re}),Re&&(u?d._hideClone():d._showClone(y),y!==f&&(Oe(B,_e?_e.options.ghostClass:d.options.ghostClass,!1),Oe(B,a.ghostClass,!0)),_e!==y&&y!==P.active?_e=y:y===P.active&&_e&&(_e=null),f===y&&(y._ignoreWhileAnimating=i),y.animateAll(function(){g("dragOverAnimationComplete"),y._ignoreWhileAnimating=null}),y!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(i===B&&!B.animated||i===r&&!i.animated)&&(hn=null),!a.dragoverBubble&&!n.rootEl&&i!==document&&(B.parentNode[Me]._isOutsideThisEl(n.target),!Re&&Jt(n)),!a.dragoverBubble&&n.stopPropagation&&n.stopPropagation(),p=!0}function S(){Fe=Pe(B),bt=Pe(B,a.draggable),Ve({sortable:y,name:"change",toEl:r,newIndex:Fe,newDraggableIndex:bt,originalEvent:n})}if(n.preventDefault!==void 0&&n.cancelable&&n.preventDefault(),i=Qe(i,a.draggable,r,!0),g("dragOver"),P.eventCanceled)return p;if(B.contains(n.target)||i.animated&&i.animatingX&&i.animatingY||y._ignoreWhileAnimating===i)return x(!1);if(Ur=!1,d&&!a.disabled&&(u?m||(l=de!==ie):_e===this||(this.lastPutMode=Rr.checkPull(this,d,B,n))&&c.checkPut(this,d,B,n))){if(h=this._getDirection(n,i)==="vertical",s=ge(B),g("dragOverValid"),P.eventCanceled)return p;if(l)return de=ie,k(),this._hideClone(),g("revert"),P.eventCanceled||(Gt?ie.insertBefore(B,Gt):ie.appendChild(B)),x(!0);var A=us(r,a.draggable);if(!A||nN(n,h,this)&&!A.animated){if(A===B)return x(!1);if(A&&r===n.target&&(i=A),i&&(o=ge(i)),Yr(ie,r,B,s,i,o,n,!!i)!==!1)return k(),r.appendChild(B),de=r,S(),x(!0)}else if(A&&tN(n,h,this)){var R=dn(r,0,a,!0);if(R===B)return x(!1);if(i=R,o=ge(i),Yr(ie,r,B,s,i,o,n,!1)!==!1)return k(),r.insertBefore(B,R),de=r,S(),x(!0)}else if(i.parentNode===r){o=ge(i);var C=0,D,I=B.parentNode!==r,M=!ZV(B.animated&&B.toRect||s,i.animated&&i.toRect||o,h),j=h?"top":"left",L=um(i,"top","top")||um(B,"top","top"),te=L?L.scrollTop:void 0;hn!==i&&(D=o[j],zn=!1,qr=!M&&a.invertSwap||I),C=rN(n,i,o,h,M?1:a.swapThreshold,a.invertedSwapThreshold==null?a.swapThreshold:a.invertedSwapThreshold,qr,hn===i);var q;if(C!==0){var v=Pe(B);do v-=C,q=de.children[v];while(q&&($(q,"display")==="none"||q===U))}if(C===0||q===i)return x(!1);hn=i,qn=C;var ae=i.nextElementSibling,me=!1;me=C===1;var Ye=Yr(ie,r,B,s,i,o,n,me);if(Ye!==!1)return(Ye===1||Ye===-1)&&(me=Ye===1),gs=!0,setTimeout(eN,30),k(),me&&!ae?r.appendChild(B):i.parentNode.insertBefore(B,me?ae:i),L&&hm(L,0,te-L.scrollTop),de=B.parentNode,D!==void 0&&!qr&&(zr=Math.abs(D-ge(i)[j])),S(),x(!0)}if(r.contains(B))return x(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){J(document,"mousemove",this._onTouchMove),J(document,"touchmove",this._onTouchMove),J(document,"pointermove",this._onTouchMove),J(document,"dragover",Jt),J(document,"mousemove",Jt),J(document,"touchmove",Jt)},_offUpEvents:function(){var n=this.el.ownerDocument;J(n,"mouseup",this._onDrop),J(n,"touchend",this._onDrop),J(n,"pointerup",this._onDrop),J(n,"touchcancel",this._onDrop),J(document,"selectstart",this)},_onDrop:function(n){var r=this.el,i=this.options;if(Fe=Pe(B),bt=Pe(B,i.draggable),Te("drop",this,{evt:n}),de=B&&B.parentNode,Fe=Pe(B),bt=Pe(B,i.draggable),P.eventCanceled){this._nulling();return}fn=!1,qr=!1,zn=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),_s(this.cloneId),_s(this._dragStartId),this.nativeDraggable&&(J(document,"drop",this),J(r,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),$n&&$(document.body,"user-select",""),$(B,"transform",""),n&&(jn&&(n.cancelable&&n.preventDefault(),!i.dropBubble&&n.stopPropagation()),U&&U.parentNode&&U.parentNode.removeChild(U),(ie===de||_e&&_e.lastPutMode!=="clone")&&ue&&ue.parentNode&&ue.parentNode.removeChild(ue),B&&(this.nativeDraggable&&J(B,"dragend",this),ks(B),B.style["will-change"]="",jn&&!fn&&Oe(B,_e?_e.options.ghostClass:this.options.ghostClass,!1),Oe(B,this.options.chosenClass,!1),Ve({sortable:this,name:"unchoose",toEl:de,newIndex:null,newDraggableIndex:null,originalEvent:n}),ie!==de?(Fe>=0&&(Ve({rootEl:de,name:"add",toEl:de,fromEl:ie,originalEvent:n}),Ve({sortable:this,name:"remove",toEl:de,originalEvent:n}),Ve({rootEl:de,name:"sort",toEl:de,fromEl:ie,originalEvent:n}),Ve({sortable:this,name:"sort",toEl:de,originalEvent:n})),_e&&_e.save()):Fe!==mn&&Fe>=0&&(Ve({sortable:this,name:"update",toEl:de,originalEvent:n}),Ve({sortable:this,name:"sort",toEl:de,originalEvent:n})),P.active&&((Fe==null||Fe===-1)&&(Fe=mn,bt=Un),Ve({sortable:this,name:"end",toEl:de,originalEvent:n}),this.save()))),this._nulling()},_nulling:function(){Te("nulling",this),ie=B=de=U=Gt=ue=Pr=xt=Yt=Ge=jn=Fe=bt=mn=Un=hn=qn=_e=Rr=P.dragged=P.ghost=P.clone=P.active=null,Wr.forEach(function(n){n.checked=!0}),Wr.length=hs=ps=0},handleEvent:function(n){switch(n.type){case"drop":case"dragend":this._onDrop(n);break;case"dragenter":case"dragover":B&&(this._onDragOver(n),vV(n));break;case"selectstart":n.preventDefault();break}},toArray:function(){for(var n=[],r,i=this.el.children,s=0,o=i.length,l=this.options;s<o;s++)r=i[s],Qe(r,l.draggable,this.el,!1)&&n.push(r.getAttribute(l.dataIdAttr)||iN(r));return n},sort:function(n,r){var i={},s=this.el;this.toArray().forEach(function(o,l){var a=s.children[l];Qe(a,this.options.draggable,s,!1)&&(i[o]=a)},this),r&&this.captureAnimationState(),n.forEach(function(o){i[o]&&(s.removeChild(i[o]),s.appendChild(i[o]))}),r&&this.animateAll()},save:function(){var n=this.options.store;n&&n.set&&n.set(this)},closest:function(n,r){return Qe(n,r||this.options.draggable,this.el,!1)},option:function(n,r){var i=this.options;if(r===void 0)return i[n];var s=Rn.modifyOption(this,n,r);typeof s<"u"?i[n]=s:i[n]=r,n==="group"&&xm(i)},destroy:function(){Te("destroy",this);var n=this.el;n[Me]=null,J(n,"mousedown",this._onTapStart),J(n,"touchstart",this._onTapStart),J(n,"pointerdown",this._onTapStart),this.nativeDraggable&&(J(n,"dragover",this),J(n,"dragenter",this)),Array.prototype.forEach.call(n.querySelectorAll("[draggable]"),function(r){r.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),jr.splice(jr.indexOf(this.el),1),this.el=n=null},_hideClone:function(){if(!xt){if(Te("hideClone",this),P.eventCanceled)return;$(ue,"display","none"),this.options.removeCloneOnHide&&ue.parentNode&&ue.parentNode.removeChild(ue),xt=!0}},_showClone:function(n){if(n.lastPutMode!=="clone"){this._hideClone();return}if(xt){if(Te("showClone",this),P.eventCanceled)return;B.parentNode==ie&&!this.options.group.revertClone?ie.insertBefore(ue,B):Gt?ie.insertBefore(ue,Gt):ie.appendChild(ue),this.options.group.revertClone&&this.animate(B,ue),$(ue,"display",""),xt=!1}}};function vV(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move"),e.cancelable&&e.preventDefault()}function Yr(e,n,r,i,s,o,l,a){var c,d=e[Me],u=d.options.onMove,m;return window.CustomEvent&&!lt&&!Ln?c=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(c=document.createEvent("Event"),c.initEvent("move",!0,!0)),c.to=n,c.from=e,c.dragged=r,c.draggedRect=i,c.related=s||n,c.relatedRect=o||ge(n),c.willInsertAfter=a,c.originalEvent=l,e.dispatchEvent(c),u&&(m=u.call(d,c,l)),m}function ks(e){e.draggable=!1}function eN(){gs=!1}function tN(e,n,r){var i=ge(dn(r.el,0,r.options,!0)),s=10;return n?e.clientX<i.left-s||e.clientY<i.top&&e.clientX<i.right:e.clientY<i.top-s||e.clientY<i.bottom&&e.clientX<i.left}function nN(e,n,r){var i=ge(us(r.el,r.options.draggable)),s=10;return n?e.clientX>i.right+s||e.clientX<=i.right&&e.clientY>i.bottom&&e.clientX>=i.left:e.clientX>i.right&&e.clientY>i.top||e.clientX<=i.right&&e.clientY>i.bottom+s}function rN(e,n,r,i,s,o,l,a){var c=i?e.clientY:e.clientX,d=i?r.height:r.width,u=i?r.top:r.left,m=i?r.bottom:r.right,f=!1;if(!l){if(a&&zr<d*s){if(!zn&&(qn===1?c>u+d*o/2:c<m-d*o/2)&&(zn=!0),zn)f=!0;else if(qn===1?c<u+zr:c>m-zr)return-qn}else if(c>u+d*(1-s)/2&&c<m-d*(1-s)/2)return oN(n)}return f=f||l,f&&(c<u+d*o/2||c>m-d*o/2)?c>u+d/2?1:-1:0}function oN(e){return Pe(B)<Pe(e)?1:-1}function iN(e){for(var n=e.tagName+e.className+e.src+e.href+e.textContent,r=n.length,i=0;r--;)i+=n.charCodeAt(r);return i.toString(36)}function sN(e){Wr.length=0;for(var n=e.getElementsByTagName("input"),r=n.length;r--;){var i=n[r];i.checked&&Wr.push(i)}}function Jr(e){return setTimeout(e,0)}function _s(e){return clearTimeout(e)}Hr&&X(document,"touchmove",function(e){(P.active||fn)&&e.cancelable&&e.preventDefault()}),P.utils={on:X,off:J,css:$,find:dm,is:function(n,r){return!!Qe(n,r,n,!1)},extend:qV,throttle:fm,closest:Qe,toggleClass:Oe,clone:pm,index:Pe,nextTick:Jr,cancelNextTick:_s,detectDirection:wm,getChild:dn},P.get=function(e){return e[Me]},P.mount=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];n[0].constructor===Array&&(n=n[0]),n.forEach(function(i){if(!i.prototype||!i.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(i));i.utils&&(P.utils=Xe(Xe({},P.utils),i.utils)),Rn.mount(i)})},P.create=function(e,n){return new P(e,n)},P.version=PV;var he=[],Wn,ws,xs=!1,bs,Cs,Kr,Hn;function lN(){function e(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var n in this)n.charAt(0)==="_"&&typeof this[n]=="function"&&(this[n]=this[n].bind(this))}return e.prototype={dragStarted:function(r){var i=r.originalEvent;this.sortable.nativeDraggable?X(document,"dragover",this._handleAutoScroll):this.options.supportPointer?X(document,"pointermove",this._handleFallbackAutoScroll):i.touches?X(document,"touchmove",this._handleFallbackAutoScroll):X(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(r){var i=r.originalEvent;!this.options.dragOverBubble&&!i.rootEl&&this._handleAutoScroll(i)},drop:function(){this.sortable.nativeDraggable?J(document,"dragover",this._handleAutoScroll):(J(document,"pointermove",this._handleFallbackAutoScroll),J(document,"touchmove",this._handleFallbackAutoScroll),J(document,"mousemove",this._handleFallbackAutoScroll)),Vm(),Zr(),zV()},nulling:function(){Kr=ws=Wn=xs=Hn=bs=Cs=null,he.length=0},_handleFallbackAutoScroll:function(r){this._handleAutoScroll(r,!0)},_handleAutoScroll:function(r,i){var s=this,o=(r.touches?r.touches[0]:r).clientX,l=(r.touches?r.touches[0]:r).clientY,a=document.elementFromPoint(o,l);if(Kr=r,i||this.options.forceAutoScrollFallback||Ln||lt||$n){Vs(r,this.options,a,i);var c=wt(a,!0);xs&&(!Hn||o!==bs||l!==Cs)&&(Hn&&Vm(),Hn=setInterval(function(){var d=wt(document.elementFromPoint(o,l),!0);d!==c&&(c=d,Zr()),Vs(r,s.options,d,i)},10),bs=o,Cs=l)}else{if(!this.options.bubbleScroll||wt(a,!0)===ve()){Zr();return}Vs(r,this.options,wt(a,!1),!1)}}},it(e,{pluginName:"scroll",initializeByDefault:!0})}function Zr(){he.forEach(function(e){clearInterval(e.pid)}),he=[]}function Vm(){clearInterval(Hn)}var Vs=fm(function(e,n,r,i){if(n.scroll){var s=(e.touches?e.touches[0]:e).clientX,o=(e.touches?e.touches[0]:e).clientY,l=n.scrollSensitivity,a=n.scrollSpeed,c=ve(),d=!1,u;ws!==r&&(ws=r,Zr(),Wn=n.scroll,u=n.scrollFn,Wn===!0&&(Wn=wt(r,!0)));var m=0,f=Wn;do{var h=f,y=ge(h),p=y.top,g=y.bottom,k=y.left,x=y.right,S=y.width,A=y.height,R=void 0,C=void 0,D=h.scrollWidth,I=h.scrollHeight,M=$(h),j=h.scrollLeft,L=h.scrollTop;h===c?(R=S<D&&(M.overflowX==="auto"||M.overflowX==="scroll"||M.overflowX==="visible"),C=A<I&&(M.overflowY==="auto"||M.overflowY==="scroll"||M.overflowY==="visible")):(R=S<D&&(M.overflowX==="auto"||M.overflowX==="scroll"),C=A<I&&(M.overflowY==="auto"||M.overflowY==="scroll"));var te=R&&(Math.abs(x-s)<=l&&j+S<D)-(Math.abs(k-s)<=l&&!!j),q=C&&(Math.abs(g-o)<=l&&L+A<I)-(Math.abs(p-o)<=l&&!!L);if(!he[m])for(var v=0;v<=m;v++)he[v]||(he[v]={});(he[m].vx!=te||he[m].vy!=q||he[m].el!==h)&&(he[m].el=h,he[m].vx=te,he[m].vy=q,clearInterval(he[m].pid),(te!=0||q!=0)&&(d=!0,he[m].pid=setInterval((function(){i&&this.layer===0&&P.active._onTouchMove(Kr);var ae=he[this.layer].vy?he[this.layer].vy*a:0,me=he[this.layer].vx?he[this.layer].vx*a:0;typeof u=="function"&&u.call(P.dragged.parentNode[Me],me,ae,e,Kr,he[this.layer].el)!=="continue"||hm(he[this.layer].el,me,ae)}).bind({layer:m}),24))),m++}while(n.bubbleScroll&&f!==c&&(f=wt(f,!1)));xs=d}},30),Nm=function(n){var r=n.originalEvent,i=n.putSortable,s=n.dragEl,o=n.activeSortable,l=n.dispatchSortableEvent,a=n.hideGhostForTarget,c=n.unhideGhostForTarget;if(r){var d=i||o;a();var u=r.changedTouches&&r.changedTouches.length?r.changedTouches[0]:r,m=document.elementFromPoint(u.clientX,u.clientY);c(),d&&!d.el.contains(m)&&(l("spill"),this.onSpill({dragEl:s,putSortable:i}))}};function Ns(){}Ns.prototype={startIndex:null,dragStart:function(n){var r=n.oldDraggableIndex;this.startIndex=r},onSpill:function(n){var r=n.dragEl,i=n.putSortable;this.sortable.captureAnimationState(),i&&i.captureAnimationState();var s=dn(this.sortable.el,this.startIndex,this.options);s?this.sortable.el.insertBefore(r,s):this.sortable.el.appendChild(r),this.sortable.animateAll(),i&&i.animateAll()},drop:Nm},it(Ns,{pluginName:"revertOnSpill"});function Es(){}Es.prototype={onSpill:function(n){var r=n.dragEl,i=n.putSortable,s=i||this.sortable;s.captureAnimationState(),r.parentNode&&r.parentNode.removeChild(r),s.animateAll()},drop:Nm},it(Es,{pluginName:"removeOnSpill"}),P.mount(new lN),P.mount(Es,Ns);function Bs(e){e.parentElement!==null&&e.parentElement.removeChild(e)}function Em(e,n,r){const i=r===0?e.children[0]:e.children[r-1].nextSibling;e.insertBefore(n,i)}function aN(){return typeof window<"u"?window.console:global.console}const cN=aN();function dN(e){const n=Object.create(null);return function(i){return n[i]||(n[i]=e(i))}}const uN=/-(\w)/g,mN=dN(e=>e.replace(uN,(n,r)=>r.toUpperCase())),Bm=["Start","Add","Remove","Update","End"],Sm=["Choose","Unchoose","Sort","Filter","Clone"],Tm=["Move"],fN=[Tm,Bm,Sm].flatMap(e=>e).map(e=>`on${e}`),Ss={manage:Tm,manageAndEmit:Bm,emit:Sm};function hN(e){return fN.indexOf(e)!==-1}const pN=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","math","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rb","rp","rt","rtc","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"];function yN(e){return pN.includes(e)}function gN(e){return["transition-group","TransitionGroup"].includes(e)}function Dm(e){return["id","class","role","style"].includes(e)||e.startsWith("data-")||e.startsWith("aria-")||e.startsWith("on")}function Om(e){return e.reduce((n,[r,i])=>(n[r]=i,n),{})}function kN({$attrs:e,componentData:n={}}){return{...Om(Object.entries(e).filter(([i,s])=>Dm(i))),...n}}function _N({$attrs:e,callBackBuilder:n}){const r=Om(Mm(e));Object.entries(n).forEach(([s,o])=>{Ss[s].forEach(l=>{r[`on${l}`]=o(l)})});const i=`[data-draggable]${r.draggable||""}`;return{...r,draggable:i}}function Mm(e){return Object.entries(e).filter(([n,r])=>!Dm(n)).map(([n,r])=>[mN(n),r]).filter(([n,r])=>!hN(n))}const Fm=({el:e})=>e,wN=(e,n)=>e.__draggable_context=n,Im=e=>e.__draggable_context;class xN{constructor({nodes:{header:n,default:r,footer:i},root:s,realList:o}){this.defaultNodes=r,this.children=[...n,...r,...i],this.externalComponent=s.externalComponent,this.rootTransition=s.transition,this.tag=s.tag,this.realList=o}get _isRootComponent(){return this.externalComponent||this.rootTransition}render(n,r){const{tag:i,children:s,_isRootComponent:o}=this;return n(i,r,o?{default:()=>s}:s)}updated(){const{defaultNodes:n,realList:r}=this;n.forEach((i,s)=>{wN(Fm(i),{element:r[s],index:s})})}getUnderlyingVm(n){return Im(n)}getVmIndexFromDomIndex(n,r){const{defaultNodes:i}=this,{length:s}=i,o=r.children,l=o.item(n);if(l===null)return s;const a=Im(l);if(a)return a.index;if(s===0)return 0;const c=Fm(i[0]),d=[...o].findIndex(u=>u===c);return n<d?0:s}}function bN(e,n){const r=e[n];return r?r():[]}function CN({$slots:e,realList:n,getKey:r}){const i=n||[],[s,o]=["header","footer"].map(c=>bN(e,c)),{item:l}=e;if(!l)throw new Error("draggable element must have an item slot");const a=i.flatMap((c,d)=>l({element:c,index:d}).map(u=>(u.key=r(c),u.props={...u.props||{},"data-draggable":!0},u)));if(a.length!==i.length)throw new Error("Item slot must have only one child");return{header:s,footer:o,default:a}}function VN(e){const n=gN(e),r=!yN(e)&&!n;return{transition:n,externalComponent:r,tag:r?t.resolveComponent(e):n?t.TransitionGroup:e}}function NN({$slots:e,tag:n,realList:r,getKey:i}){const s=CN({$slots:e,realList:r,getKey:i}),o=VN(n);return new xN({nodes:s,root:o,realList:r})}function Am(e,n){t.nextTick(()=>this.$emit(e.toLowerCase(),n))}function Lm(e){return(n,r)=>{if(this.realList!==null)return this[`onDrag${e}`](n,r)}}function EN(e){const n=Lm.call(this,e);return(r,i)=>{n.call(this,r,i),Am.call(this,e,r)}}let Ts=null;const BN={list:{type:Array,required:!1,default:null},modelValue:{type:Array,required:!1,default:null},itemKey:{type:[String,Function],required:!0},clone:{type:Function,default:e=>e},tag:{type:String,default:"div"},move:{type:Function,default:null},componentData:{type:Object,required:!1,default:null}},SN=["update:modelValue","change",...[...Ss.manageAndEmit,...Ss.emit].map(e=>e.toLowerCase())],Xr=t.defineComponent({name:"draggable",inheritAttrs:!1,props:BN,emits:SN,data(){return{error:!1}},render(){try{this.error=!1;const{$slots:e,$attrs:n,tag:r,componentData:i,realList:s,getKey:o}=this,l=NN({$slots:e,tag:r,realList:s,getKey:o});this.componentStructure=l;const a=kN({$attrs:n,componentData:i});return l.render(t.h,a)}catch(e){return this.error=!0,t.h("pre",{style:{color:"red"}},e.stack)}},created(){this.list!==null&&this.modelValue!==null&&cN.error("modelValue and list props are mutually exclusive! Please set one or another.")},mounted(){if(this.error)return;const{$attrs:e,$el:n,componentStructure:r}=this;r.updated();const i=_N({$attrs:e,callBackBuilder:{manageAndEmit:o=>EN.call(this,o),emit:o=>Am.bind(this,o),manage:o=>Lm.call(this,o)}}),s=n.nodeType===1?n:n.parentElement;this._sortable=new P(s,i),this.targetDomElement=s,s.__draggable_component__=this},updated(){this.componentStructure.updated()},beforeUnmount(){this._sortable!==void 0&&this._sortable.destroy()},computed:{realList(){const{list:e}=this;return e||this.modelValue},getKey(){const{itemKey:e}=this;return typeof e=="function"?e:n=>n[e]}},watch:{$attrs:{handler(e){const{_sortable:n}=this;n&&Mm(e).forEach(([r,i])=>{n.option(r,i)})},deep:!0}},methods:{getUnderlyingVm(e){return this.componentStructure.getUnderlyingVm(e)||null},getUnderlyingPotencialDraggableComponent(e){return e.__draggable_component__},emitChanges(e){t.nextTick(()=>this.$emit("change",e))},alterList(e){if(this.list){e(this.list);return}const n=[...this.modelValue];e(n),this.$emit("update:modelValue",n)},spliceList(){const e=n=>n.splice(...arguments);this.alterList(e)},updatePosition(e,n){const r=i=>i.splice(n,0,i.splice(e,1)[0]);this.alterList(r)},getRelatedContextFromMoveEvent({to:e,related:n}){const r=this.getUnderlyingPotencialDraggableComponent(e);if(!r)return{component:r};const i=r.realList,s={list:i,component:r};return e!==n&&i?{...r.getUnderlyingVm(n)||{},...s}:s},getVmIndexFromDomIndex(e){return this.componentStructure.getVmIndexFromDomIndex(e,this.targetDomElement)},onDragStart(e){this.context=this.getUnderlyingVm(e.item),e.item._underlying_vm_=this.clone(this.context.element),Ts=e.item},onDragAdd(e){const n=e.item._underlying_vm_;if(n===void 0)return;Bs(e.item);const r=this.getVmIndexFromDomIndex(e.newIndex);this.spliceList(r,0,n);const i={element:n,newIndex:r};this.emitChanges({added:i})},onDragRemove(e){if(Em(this.$el,e.item,e.oldIndex),e.pullMode==="clone"){Bs(e.clone);return}const{index:n,element:r}=this.context;this.spliceList(n,1);const i={element:r,oldIndex:n};this.emitChanges({removed:i})},onDragUpdate(e){Bs(e.item),Em(e.from,e.item,e.oldIndex);const n=this.context.index,r=this.getVmIndexFromDomIndex(e.newIndex);this.updatePosition(n,r);const i={element:this.context.element,oldIndex:n,newIndex:r};this.emitChanges({moved:i})},computeFutureIndex(e,n){if(!e.element)return 0;const r=[...n.to.children].filter(l=>l.style.display!=="none"),i=r.indexOf(n.related),s=e.component.getVmIndexFromDomIndex(i);return r.indexOf(Ts)!==-1||!n.willInsertAfter?s:s+1},onDragMove(e,n){const{move:r,realList:i}=this;if(!r||!i)return!0;const s=this.getRelatedContextFromMoveEvent(e),o=this.computeFutureIndex(s,e),l={...this.context,futureIndex:o},a={...e,relatedContext:s,draggedContext:l};return r(a,n)},onDragEnd(){Ts=null}}});function $m(e,n){let r=e.title.toUpperCase(),i=n.title.toUpperCase();return r<i?-1:r>i?1:0}const TN={components:{Item:Ar,draggable:Xr},props:{modelValue:{type:[Object,Array]}},mixins:[z],async created(){await this.$glossary.ensure(),this.value=this.cleanInput(this.value,!0),this.dispatch()},methods:{elementLabel(e){var n=e.firstName||e.title||"";return n.length<60?n:""},async swap(){var e=this;e.touch();var n={field:e.field,model:[e.value],maximum:1,browserOptions:{columns:e.field.columns,select:e.field.select,lockFilter:e.field.lockFilter,dateFilterEnabled:e.dateFilterEnabled}};let r=this.field.referenceType;if(!r){await e.$glossary.ensure();const s=e.$glossary.items.sort($m),{key:o}=await e.$sdk.options(s,"Select content type","What type of content are you wanting to select");r=o}e.$sdk.browse(r,n).then(function(i){e.model=i[0]}).catch(function(i){i&&e.$sdk.error(i)})},async create(){var i;const e=this;if(!((i=e.$sdk.global)!=null&&i.create))return;let n=e.field.createModel;const r=await e.$sdk.global.create(e.field.referenceType,{model:n,preselected:!!n});r.multiple&&(e.multiValue?(e.model||(e.model=[]),e.model=[...e.model,...r.items]):e.model=r.items[0]),r._id&&(e.multiValue?(e.model||(e.model=[]),e.model.push(r)):e.model=r)},clear(){this.model=void 0,this.touch()},canEdit(e){var n=this.user;return n?this.$sdk.access.canEditItem(n,e):!1},async edit(e){var n=await this.$sdk.global.edit(e,!0).catch(function(i){});for(var r in n)e[r]=n[r]},async open(){var e=this;e.touch();var n={field:e.field,model:e.multiValue?e.value:[e.value].filter(Boolean),maximum:e.field.maximum,browserOptions:{columns:e.field.columns,select:e.field.select,lockFilter:e.field.lockFilter,dateFilterEnabled:e.dateFilterEnabled}};let r=this.field.referenceType;if(!r){await e.$glossary.ensure();const s=e.$glossary.items.sort($m),{key:o}=await e.$sdk.options(s,"Select content type","What type of content are you wanting to select");r=o}switch(r){case"scope":const i=e.multiValue?e.value:[e.value].filter(Boolean);return e.$sdk.selectScopes({action:"view",type:r,model:i,maximum:e.field.maximum,include:"scope"}).then(function(s){e.model=e.multiValue?s:s[0]}).catch(function(s){s&&e.$sdk.error(s)})}e.$sdk.browse(r,n).then(function(i){e.model=e.multiValue?i:i[0]}).catch(function(i){i&&e.$sdk.error(i)})},cleanInput(e){var n=this;return n.multiValue?(e||(e=[]),Array.isArray(e)||(e=[]),n.maximum&&e.length>n.maximum&&(e.length=n.maximum)):Array.isArray(e)&&(e=e[0]),e}},computed:{dateFilterEnabled(){switch(this.field.referenceType){case"log":case"event":case"submission":case"email":case"transaction":return!0}},showList(){return this.field.list!==!1},canAdd(){const e=this;return!e.showList||!e.maximum?!0:e.multiValue?e.model.length<e.maximum:!e.model},canCreate(){var i;var e=this.field.referenceType;if(e==="scope")return!1;if(this.field.create!==!1&&(i=this.$sdk.global)!=null&&i.create){var e=this.field.referenceType,n=e,r=this.$glossary.hash[this.field.referenceType];return r&&(e=r.definesType||r.key,n=r.key||r.definesType),this.user&&this.$sdk.access.canCreate(this.user,n,e)}},summary(){if(this.multiValue)if(this.model&&this.model.length){var e="Click to select",n=this.model.length;return this.showList?(n&&(e=`Adjust selection (${n})`),e):n===1?this.model[0].title||this.model[0].name||this.model[0].firstName:`${n} selected`}else return"Click to select";else return this.model?this.showList?"Click to select":this.model.title||this.model.name||this.model.firstName:"Click to select"}}},DN={key:0,class:"ux-field-title"},ON={key:0,class:"ux-required-marker"},MN={key:1,class:"ux-field-description"},FN={class:"multi-list"},IN={key:1,class:"items"};function AN(e,n,r,i,s,o){var k;const l=t.resolveComponent("ux-icon"),a=t.resolveComponent("ux-button"),c=t.resolveComponent("ux-list-item"),d=t.resolveComponent("ux-list"),u=t.resolveComponent("ux-menu"),m=t.resolveComponent("item"),f=t.resolveComponent("draggable"),h=t.resolveComponent("ux-panel"),y=t.resolveComponent("flex-cell"),p=t.resolveComponent("flex-row"),g=t.resolveComponent("flex-spacer");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",DN,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",ON,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",MN,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),o.showList?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[e.multiValue?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[(k=e.model)!=null&&k.length?(t.openBlock(),t.createBlock(h,{key:0},{default:t.withCtx(()=>[t.createElementVNode("div",FN,[t.createVNode(f,{class:"items",modelValue:e.model,"onUpdate:modelValue":n[1]||(n[1]=x=>e.model=x)},{item:t.withCtx(({element:x,index:S})=>[(t.openBlock(),t.createBlock(m,{key:x._id,item:x},{actions:t.withCtx(()=>[t.createVNode(u,{group:"content-actions",right:""},{activator:t.withCtx(({on:A})=>[t.createVNode(a,t.mergeProps({size:"sm"},t.toHandlers(A),{icon:"",onClick:n[0]||(n[0]=t.withModifiers(()=>{},["stop","prevent"]))}),{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-ellipsis"})]),_:2},1040)]),default:t.withCtx(()=>[t.createVNode(d,null,{default:t.withCtx(()=>[t.createVNode(c,{onClick:A=>e.remove(x)},{default:t.withCtx(()=>[t.createTextVNode("Remove "+t.toDisplayString(o.elementLabel(x)),1)]),_:2},1032,["onClick"]),o.canEdit(x)?(t.openBlock(),t.createBlock(c,{key:0,onClick:A=>o.edit(x)},{default:t.withCtx(()=>[t.createTextVNode(" Edit "+t.toDisplayString(o.elementLabel(x)),1)]),_:2},1032,["onClick"])):t.createCommentVNode("",!0),t.createVNode(c,{onClick:A=>e.$actions.open([x])},{default:t.withCtx(()=>[t.createTextVNode(" More Actions ")]),_:2},1032,["onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1032,["item"]))]),_:1},8,["modelValue"])])]),_:1})):t.createCommentVNode("",!0)],64)):e.model?(t.openBlock(),t.createElementBlock("div",IN,[t.createVNode(m,{item:e.model},{actions:t.withCtx(()=>[t.createVNode(u,{group:"content-actions",right:""},{activator:t.withCtx(({on:x})=>[t.createVNode(a,t.mergeProps({size:"sm"},t.toHandlers(x),{icon:"",onClick:n[2]||(n[2]=t.withModifiers(()=>{},["stop","prevent"]))}),{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-ellipsis"})]),_:2},1040)]),default:t.withCtx(()=>[t.createVNode(d,null,{default:t.withCtx(()=>[o.canCreate?(t.openBlock(),t.createBlock(c,{key:0,onClick:o.create},{default:t.withCtx(()=>[t.createVNode(p,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(y,null,{default:t.withCtx(()=>[t.createTextVNode("Replace with new")]),_:1})]),_:1})]),_:1},8,["onClick"])):t.createCommentVNode("",!0),t.createVNode(c,{onClick:n[3]||(n[3]=x=>o.swap(e.model))},{default:t.withCtx(()=>[t.createVNode(p,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(y,null,{default:t.withCtx(()=>[t.createTextVNode("Swap with existing")]),_:1})]),_:1})]),_:1}),t.createVNode(c,{onClick:o.clear},{default:t.withCtx(()=>[t.createVNode(p,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(y,null,{default:t.withCtx(()=>[t.createTextVNode("Remove")]),_:1})]),_:1})]),_:1},8,["onClick"]),o.canEdit(e.model)?(t.openBlock(),t.createBlock(c,{key:1,onClick:n[4]||(n[4]=x=>o.edit(e.model))},{default:t.withCtx(()=>[t.createVNode(p,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(y,null,{default:t.withCtx(()=>[t.createTextVNode("Edit")]),_:1})]),_:1})]),_:1})):t.createCommentVNode("",!0),t.createVNode(c,{onClick:n[5]||(n[5]=x=>e.$actions.open([e.model]))},{default:t.withCtx(()=>[t.createVNode(p,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(y,null,{default:t.withCtx(()=>[t.createTextVNode("More Actions")]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["item"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),o.canAdd?(t.openBlock(),t.createBlock(p,{key:3,gap:""},{default:t.withCtx(()=>[t.createVNode(y,{shrink:""},{default:t.withCtx(()=>[t.createVNode(a,{size:"sm",onClick:o.open},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.summary),1)]),_:1},8,["onClick"])]),_:1}),o.canCreate?(t.openBlock(),t.createBlock(y,{key:0,shrink:""},{default:t.withCtx(()=>[t.createVNode(a,{size:"sm",color:"primary",onClick:o.create},{default:t.withCtx(()=>[t.createTextVNode(" Create "),t.createVNode(l,{right:"",icon:"fa-plus"})]),_:1},8,["onClick"])]),_:1})):t.createCommentVNode("",!0),t.createVNode(g)]),_:1})):t.createCommentVNode("",!0)],64)}const Pm=w(TN,[["render",AN],["__scopeId","data-v-9d53981e"]]),LN={components:{Item:Ar,ContentSearch:cs,draggable:Xr},props:{modelValue:{type:[Object,Array]},browse:{type:Boolean,default:!1}},mixins:[z],async created(){await this.$glossary.ensure(),this.value=this.cleanInput(this.value,!0),this.dispatch()},methods:{elementLabel(e){var n=e.firstName||e.title||"";return n.length<60?n:""},async swap(){var e=this;e.touch();var n={field:e.field,model:[e.value],maximum:1,browserOptions:{columns:e.field.columns,select:e.field.select,lockFilter:e.field.lockFilter}};let r=this.referenceType;if(!r){await e.$glossary.ensure();const s=e.$glossary.items.sort(sortFunction),{key:o}=await e.$sdk.options(s,"Select content type","What type of content are you wanting to select");r=o}e.$sdk.browse(r,n).then(function(i){e.model=i[0]}).catch(function(i){i&&e.$sdk.error(i)})},async create(){var i;const e=this;if(!((i=e.$sdk.global)!=null&&i.create))return;let n=e.field.createModel;const r=await e.$sdk.global.create(e.field.referenceType,{model:n,preselected:!!n});r.multiple&&(e.multiValue?(e.model||(e.model=[]),e.model=[...e.model,...r.items]):e.model=r.items[0]),r._id&&(e.multiValue?(e.model||(e.model=[]),e.model.push(r)):e.model=r)},clear(){this.model=void 0,this.touch()},canEdit(e){var n=this.user;return n?this.$sdk.access.canEditItem(n,e):!1},async edit(e){var n=await this.$sdk.global.edit(e,!0).catch(function(i){});for(var r in n)e[r]=n[r]},async open(){var e=this;e.touch();var n={field:e.field,model:e.multiValue?e.value:[e.value].filter(Boolean),maximum:e.field.maximum,browserOptions:{columns:e.field.columns,select:e.field.select,lockFilter:e.field.lockFilter}};let r=this.referenceType;if(!r){await e.$glossary.ensure();const s=e.$glossary.items.sort(sortFunction),{key:o}=await e.$sdk.options(s,"Select content type","What type of content are you wanting to select");r=o}switch(r){case"scope":const i=e.multiValue?e.value:[e.value].filter(Boolean);return e.$sdk.selectScopes({action:"view",type:r,model:i,maximum:e.field.maximum}).then(function(s){console.log("GOT NEW SELECTION",s),e.model=e.multiValue?s:s[0]}).catch(function(s){s&&e.$sdk.error(s)})}e.$sdk.browse(r,n).then(function(i){e.model=e.multiValue?i:i[0]}).catch(function(i){i&&e.$sdk.error(i)})},cleanInput(e){var n=this;return n.multiValue?(e||(e=[]),Array.isArray(e)||(e=[]),n.maximum&&e.length>n.maximum&&(e.length=n.maximum)):Array.isArray(e)&&(e=e[0]),e}},computed:{shouldPreload(){return!!this.field.dynamicOptions||!!this.field.preloadOptions},hasAsyncOptions(){return!!(this.asyncOptionsURL&&this.shouldPreload||this.field.type==="reference"&&this.field.lockFilter)},canBrowse(){return this.browse},referenceType(){return this.field.referenceType},showList(){return this.field.list!==!1},canAdd(){const e=this;return!e.showList||!e.maximum?!0:e.multiValue?e.model.length<e.maximum:!e.model},canCreate(){var i;var e=this.referenceType;if(e==="scope")return!1;if(this.field.create!==!1&&(i=this.$sdk.global)!=null&&i.create){var e=this.referenceType,n=e,r=this.$glossary.hash[this.referenceType];return r&&(e=r.definesType||r.key,n=r.key||r.definesType),this.user&&this.$sdk.access.canCreate(this.user,n,e)}},summary(){if(this.multiValue)if(this.model&&this.model.length){var e="Click to select",n=this.model.length;return this.showList?(n&&(e=`Adjust selection (${n})`),e):n===1?this.model[0].title||this.model[0].name||this.model[0].firstName:`${n} selected`}else return"Click to select";else return this.model?this.showList?"Click to select":this.model.title||this.model.name||this.model.firstName:"Click to select"}}},$N={key:0,class:"ux-field-title"},PN={key:0,class:"ux-required-marker"},RN={key:1,class:"ux-field-description"},UN={key:1,class:"items"};function jN(e,n,r,i,s,o){const l=t.resolveComponent("ux-icon"),a=t.resolveComponent("ux-button"),c=t.resolveComponent("ux-list-item"),d=t.resolveComponent("ux-list"),u=t.resolveComponent("ux-menu"),m=t.resolveComponent("item"),f=t.resolveComponent("draggable"),h=t.resolveComponent("flex-cell"),y=t.resolveComponent("flex-row"),p=t.resolveComponent("content-search");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",$N,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",PN,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",RN,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),o.showList?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[e.multiValue?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[e.model&&e.model.length?(t.openBlock(),t.createBlock(f,{key:0,class:"items",modelValue:e.model,"onUpdate:modelValue":n[1]||(n[1]=g=>e.model=g)},{item:t.withCtx(({element:g,index:k})=>[(t.openBlock(),t.createBlock(m,{key:g._id,item:g},{actions:t.withCtx(()=>[t.createVNode(u,{group:"content-actions",right:""},{activator:t.withCtx(({on:x})=>[t.createVNode(a,t.mergeProps({size:"sm"},t.toHandlers(x),{icon:"",onClick:n[0]||(n[0]=t.withModifiers(()=>{},["stop","prevent"]))}),{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-ellipsis"})]),_:2},1040)]),default:t.withCtx(()=>[t.createVNode(d,null,{default:t.withCtx(()=>[t.createVNode(c,{onClick:x=>e.remove(g)},{default:t.withCtx(()=>[t.createTextVNode("Remove "+t.toDisplayString(o.elementLabel(g)),1)]),_:2},1032,["onClick"]),o.canEdit(g)?(t.openBlock(),t.createBlock(c,{key:0,onClick:x=>o.edit(g)},{default:t.withCtx(()=>[t.createTextVNode(" Edit "+t.toDisplayString(o.elementLabel(g)),1)]),_:2},1032,["onClick"])):t.createCommentVNode("",!0),t.createVNode(c,{onClick:x=>e.$actions.open([g])},{default:t.withCtx(()=>[t.createTextVNode(" More Actions ")]),_:2},1032,["onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1032,["item"]))]),_:1},8,["modelValue"])):t.createCommentVNode("",!0)],64)):e.model?(t.openBlock(),t.createElementBlock("div",UN,[t.createVNode(m,{item:e.model},{actions:t.withCtx(()=>[t.createVNode(u,{group:"content-actions",right:""},{activator:t.withCtx(({on:g})=>[t.createVNode(a,t.mergeProps({size:"sm"},t.toHandlers(g),{icon:"",onClick:n[2]||(n[2]=t.withModifiers(()=>{},["stop","prevent"]))}),{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-ellipsis"})]),_:2},1040)]),default:t.withCtx(()=>[t.createVNode(d,null,{default:t.withCtx(()=>[o.canCreate?(t.openBlock(),t.createBlock(c,{key:0,onClick:o.create},{default:t.withCtx(()=>[t.createVNode(y,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(h,null,{default:t.withCtx(()=>[t.createTextVNode("Replace with new")]),_:1})]),_:1})]),_:1},8,["onClick"])):t.createCommentVNode("",!0),t.createVNode(c,{onClick:n[3]||(n[3]=g=>o.swap(e.model))},{default:t.withCtx(()=>[t.createVNode(y,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(h,null,{default:t.withCtx(()=>[t.createTextVNode("Swap with existing")]),_:1})]),_:1})]),_:1}),t.createVNode(c,{onClick:o.clear},{default:t.withCtx(()=>[t.createVNode(y,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(h,null,{default:t.withCtx(()=>[t.createTextVNode("Remove")]),_:1})]),_:1})]),_:1},8,["onClick"]),o.canEdit(e.model)?(t.openBlock(),t.createBlock(c,{key:1,onClick:n[4]||(n[4]=g=>o.edit(e.model))},{default:t.withCtx(()=>[t.createVNode(y,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(h,null,{default:t.withCtx(()=>[t.createTextVNode("Edit")]),_:1})]),_:1})]),_:1})):t.createCommentVNode("",!0),t.createVNode(c,{onClick:n[5]||(n[5]=g=>e.$actions.open([e.model]))},{default:t.withCtx(()=>[t.createVNode(y,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(h,null,{default:t.withCtx(()=>[t.createTextVNode("More Actions")]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["item"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),e.multiValue||!e.model?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[o.canAdd?(t.openBlock(),t.createBlock(y,{key:0,center:"",gap:""},{default:t.withCtx(()=>[t.createVNode(h,null,{default:t.withCtx(()=>[t.createVNode(p,{type:o.referenceType,"async-options":o.shouldPreload?void 0:e.field.asyncOptions,"preloaded-options":o.shouldPreload?e.options:[],"server-filtered":e.field.serverFiltered,"lock-filter":e.field.lockFilter,modelValue:e.model,"onUpdate:modelValue":n[6]||(n[6]=g=>e.model=g),multiple:e.multiValue,placeholder:e.placeholder,list:!1,onBrowse:o.open},null,8,["type","async-options","preloaded-options","server-filtered","lock-filter","modelValue","multiple","placeholder","onBrowse"])]),_:1}),o.canBrowse?(t.openBlock(),t.createBlock(h,{key:0,shrink:""},{default:t.withCtx(()=>[t.createVNode(a,{onClick:o.open},{default:t.withCtx(()=>[t.createTextVNode("Browse")]),_:1},8,["onClick"])]),_:1})):t.createCommentVNode("",!0),o.canCreate?(t.openBlock(),t.createBlock(h,{key:1,shrink:""},{default:t.withCtx(()=>[t.createVNode(a,{icon:"",color:"primary",onClick:o.create},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-plus"})]),_:1},8,["onClick"])]),_:1})):t.createCommentVNode("",!0)]),_:1})):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0)],64)}const qN=w(LN,[["render",jN],["__scopeId","data-v-873f84cd"]]),zN={components:{Search:ot},props:{modelValue:{type:[Array,String],default(){return[]}},search:{type:String,default:""},options:{type:Array,default(){return[]}},asyncOptions:{type:String},serverFiltered:{type:Boolean,default:!1},placeholder:{type:String},multiple:{type:Boolean,default:!1},list:{type:Boolean,default:!0}},data(){return{keywords:this.search,asyncResults:[],model:[],activeIndex:-1,isFocused:!1,showOptions:!1,searching:!1}},computed:{placeholderText(){return this.placeholder?this.placeholder:this.multiple?"Search to add items":"Search for an item"},normalizedOptions(){return(this.options||[]).map(function(e){if(typeof e=="string")return{title:e,value:e};const n=e.value||e._id||e.title||e.name||String(e);return{title:e.title||e.name||e.label||n,value:n}})},optionTitleLookup(){return this.normalizedOptions.reduce(function(e,n){return e[n.value]=n.title,e},{})},filteredOptions(){const e=(this.keywords||"").toLowerCase();return e?this.asyncOptions?this.serverFiltered?this.asyncResults:this.asyncResults.filter(function(n){return n.title.toLowerCase().includes(e)}):this.normalizedOptions.filter(function(n){return n.title.toLowerCase().includes(e)}):[]},selectedLabels(){const e=this.optionTitleLookup;return(this.model||[]).map(function(n){return e[n]||n})},totalOptions(){return this.filteredOptions.length}},watch:{modelValue:{handler(e){e?Array.isArray(e)?this.model=e.slice():this.model=[e]:this.model=[]},immediate:!0},search(e){this.keywords=e},keywords:{immediate:!0,async handler(e){if(this.$emit("update:search",e),this.asyncResults=[],this.showOptions=!1,!e){this.searching=!1;return}try{if(this.asyncOptions){this.searching=!0;const n=this.asyncOptions.includes("?")?"&":"?",r=`${this.asyncOptions}${n}search=${encodeURIComponent(e)}`,{data:i}=await this.$sdk.api.get(r);this.asyncResults=(i||[]).map(function(s){if(typeof s=="string")return{title:s,value:s};const o=s.value||s._id||s.title||s.name||String(s);return{title:s.title||s.name||s.label||o,value:o}})}this.showOptions=!0,this.activeIndex=this.totalOptions>0?0:-1}catch{}finally{this.searching=!1}}},filteredOptions(){this.activeIndex=this.totalOptions>0?0:-1}},methods:{focus(){this.$refs.input.focus()},dispatch(){this.$emit("update:modelValue",this.model)},handleKeydown(e){var n,r;if(!(!this.showOptions||this.totalOptions===0))switch(e.key){case"ArrowDown":e.preventDefault(),this.activeIndex=(this.activeIndex+1)%this.totalOptions,this.$nextTick(()=>{const i=this.$el.querySelector(".ux-value-search-option.active");i&&i.scrollIntoView({behavior:"smooth",block:"nearest"})});break;case"ArrowUp":e.preventDefault(),this.activeIndex=this.activeIndex<=0?this.totalOptions-1:this.activeIndex-1,this.$nextTick(()=>{const i=this.$el.querySelector(".ux-value-search-option.active");i&&i.scrollIntoView({behavior:"smooth",block:"nearest"})});break;case"Enter":e.preventDefault(),this.activeIndex>=0&&this.activeIndex<this.filteredOptions.length&&this.selectItem(this.filteredOptions[this.activeIndex],!0);break;case"Escape":this.showOptions=!1,(r=(n=this.$refs.input)==null?void 0:n.$el)==null||r.blur();break}},selectItem(e,n=!1){const r=e.value;this.model.indexOf(r)!==-1||(this.multiple?this.model.push(r):this.model=[r],this.dispatch()),this.keywords="",this.showOptions=!1,n&&this.$nextTick(()=>{var s,o;(o=(s=this.$refs.input)==null?void 0:s.$el)==null||o.focus()})},handleBlur(){setTimeout(()=>{this.isFocused=!1,this.showOptions=!1},200)}},mounted(){this.handleClickOutside=e=>{this.$el&&!this.$el.contains(e.target)&&(this.showOptions=!1)},document.addEventListener("click",this.handleClickOutside)},beforeUnmount(){document.removeEventListener("click",this.handleClickOutside)}},WN={key:0,class:"ux-value-search-selected-items"};function HN(e,n,r,i,s,o){const l=t.resolveComponent("search"),a=t.resolveComponent("ux-list-item"),c=t.resolveComponent("ux-list");return t.openBlock(),t.createElementBlock("div",{class:"ux-value-search",onKeydown:n[2]||(n[2]=(...d)=>o.handleKeydown&&o.handleKeydown(...d))},[r.list?(t.openBlock(),t.createElementBlock("div",WN,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.selectedLabels,(d,u)=>(t.openBlock(),t.createElementBlock("div",{key:u,class:"ux-value-search-selected-item"},t.toDisplayString(d),1))),128))])):t.createCommentVNode("",!0),t.createVNode(l,{modelValue:s.keywords,"onUpdate:modelValue":n[0]||(n[0]=d=>s.keywords=d),onFocus:n[1]||(n[1]=d=>s.isFocused=!0),onBlur:o.handleBlur,ref:"input",placeholder:o.placeholderText,loading:s.searching,debounce:r.asyncOptions?500:50},null,8,["modelValue","onBlur","placeholder","loading","debounce"]),s.showOptions&&o.filteredOptions.length?(t.openBlock(),t.createBlock(c,{key:1,class:"ux-value-search-options"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.filteredOptions,(d,u)=>(t.openBlock(),t.createBlock(a,{key:d.value||u,class:t.normalizeClass([{active:u===s.activeIndex},"ux-value-search-option"]),onClick:m=>o.selectItem(d,!0),onMouseover:m=>s.activeIndex=u},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(d.title),1)]),_:2},1032,["class","onClick","onMouseover"]))),128))]),_:1})):t.createCommentVNode("",!0)],32)}const GN={components:{ValueSearch:w(zN,[["render",HN],["__scopeId","data-v-23db8282"]])},props:{modelValue:{type:[String,Array]}},mixins:[z],methods:{removeValue(e){const n=this.model.slice();n.splice(e,1),this.model=n,this.touch()},clear(){this.model=void 0,this.touch()}},computed:{shouldPreload(){return!!this.field.preloadOptions},asyncOptionsURL(){const e=this.field.asyncOptions;if(e&&String(e).trim().length)return e},hasAsyncOptions(){return!!(this.asyncOptionsURL&&this.shouldPreload)},optionTitleLookup(){return(this.options||[]).reduce(function(e,n){const r=n.value||n._id||n;return e[r]=n.title||n.name||n.label||r,e},{})},singleLabel(){var n;const e=(n=this.model)==null?void 0:n[0];return this.optionTitleLookup[e]||e},modelDisplay(){const e=this.optionTitleLookup;return(this.model||[]).map(function(n){return e[n]||n})}}},YN={key:0,class:"ux-field-title"},JN={key:0,class:"ux-required-marker"},KN={key:1,class:"ux-field-description"},ZN={key:0,class:"select-tags"},XN=["onClick"],QN={key:0,class:"single-value"};function vN(e,n,r,i,s,o){const l=t.resolveComponent("flex-cell"),a=t.resolveComponent("ux-icon"),c=t.resolveComponent("flex-row"),d=t.resolveComponent("value-search"),u=t.resolveComponent("ux-button");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",YN,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",JN,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",KN,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[e.model&&e.model.length?(t.openBlock(),t.createElementBlock("div",ZN,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.modelDisplay,(m,f)=>(t.openBlock(),t.createElementBlock("div",{class:"select-tag",key:f},[t.createVNode(c,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(m),1)]),_:2},1024),t.createVNode(l,{shrink:""},{default:t.withCtx(()=>[t.createElementVNode("a",{onClick:h=>o.removeValue(f)},[t.createVNode(a,{icon:"fa-times"})],8,XN)]),_:2},1024)]),_:2},1024)]))),128))])):t.createCommentVNode("",!0),e.canAddValue?(t.openBlock(),t.createBlock(d,{key:1,options:e.options,"async-options":o.shouldPreload?void 0:o.asyncOptionsURL,"server-filtered":e.field.serverFiltered,modelValue:e.model,"onUpdate:modelValue":n[0]||(n[0]=m=>e.model=m),multiple:!0,placeholder:e.placeholder,list:!1},null,8,["options","async-options","server-filtered","modelValue","placeholder"])):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[e.model?(t.openBlock(),t.createElementBlock("div",QN,[t.createVNode(c,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.singleLabel),1)]),_:1}),t.createVNode(l,{shrink:""},{default:t.withCtx(()=>[t.createVNode(u,{size:"sm",icon:"",onClick:o.clear},{default:t.withCtx(()=>[t.createVNode(a,{icon:"fa-times"})]),_:1},8,["onClick"])]),_:1})]),_:1})])):(t.openBlock(),t.createBlock(d,{key:1,options:e.options,"async-options":o.shouldPreload?void 0:o.asyncOptionsURL,"server-filtered":e.field.serverFiltered,modelValue:e.model,"onUpdate:modelValue":n[1]||(n[1]=m=>e.model=m),multiple:!1,placeholder:e.placeholder,list:!1},null,8,["options","async-options","server-filtered","modelValue","placeholder"]))],64))],64)}const eE=w(GN,[["render",vN],["__scopeId","data-v-1103bb68"]]);function tE(e){return e===void 0||typeof e>"u"||e===null||String(e)==="null"||String(e)==="undefined"}const nE={props:{title:{type:String},modelValue:{}},mixins:[z],async created(){this.model=this.model,await this.$glossary.ensure();var e=this.$glossary.items;this.hash=this.$glossary.hash;var n=e;this.field.defineableTypes?n=n.filter(function(r){return r.defineable}):(this.field.basicTypes===!1&&(n=n.filter(function(r){return!!r.definesType})),this.field.definedTypes===!1&&(n=n.filter(function(r){return!r.definesType}))),n=n.map(function(r){return{title:r.title,value:r.key,definesType:r.definesType}}).sort((r,i)=>r.title>i.title?1:-1),this.types=n},data(){return{hash:{},types:[]}},methods:{cleanOutput(e){var n=this;return tE(e)?n.multiValue?e=[]:e=void 0:n.multiValue?e=(e||[]).filter(Boolean).map(function(r){return n.getValue(r)}):e=n.getValue(e),e},cleanInput(e){var n=this;if(n.multiValue)e||(e=[]),Array.isArray(e)||(e=[e]),n.maximum&&e.length>n.maximum&&(e.length=n.maximum),e=e.filter(Boolean).map(function(i){var s=n.getValue(i);return n.returnObject?n.optionLookup[s]:s});else{var r=n.getValue(e);e=n.returnObject?n.optionLookup[r]:r}return e}},computed:{optionGroups(){const e=this,n=e.selectableOptions.reduce(function(r,i){const s=i.key||i.value;let o=i.definesType;o||r.__basic.options.push({title:i.title,value:i.key||i.value}),o=o||s;let l=r[o];if(!l){const a=e.hash[o];a?l=r[o]={title:a.plural,key:o,options:[]}:console.log("NO PARENT TYPE",o,e.hash)}return l&&l.options.push(i),r},{__basic:{key:"__basic",title:"Basic Types",options:[]}});return Object.values(n).filter(function(r){return r.options.length?r.options.length>1?!0:r.options[0].value!==r.key:!1}).sort(function(r,i){var s=(r.title||r).toLowerCase();if(r.key==="__basic")return-1;var o=(i.title||i).toLowerCase();return s<o?-1:s>o?1:0})},returnObject(){return!1},classes(){var e=[];return this.multiValue?e.push("multiple"):e.push("single"),e},optionLookup(){var e=this;return e.types.reduce(function(n,r){const i=e.getValue(r);return n[i]=r,n},{})},summary(){return this.model?this.getLabel(this.optionLookup[this.model]):this.title||"Click to select"},selectableOptions(){return this.types}}},rE={key:0,class:"ux-field-title"},oE={key:0,class:"ux-required-marker"},iE={key:1,class:"ux-field-description"},sE={key:2,class:"ui-select-button"},lE=["multiple"],aE={key:0,value:""},cE=["label"],dE=["value"];function uE(e,n,r,i,s,o){const l=t.resolveComponent("ux-button");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["native-select",o.classes])},[e.showLabel?(t.openBlock(),t.createElementBlock("label",rE,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",oE,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",iE,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.singleValue?(t.openBlock(),t.createElementBlock("div",sE,[t.renderSlot(e.$slots,"default",{},()=>[t.createVNode(l,{tag:"div"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.summary),1)]),_:1})],!0)])):t.createCommentVNode("",!0),t.withDirectives(t.createElementVNode("select",{onFocus:n[0]||(n[0]=(...a)=>e.touch&&e.touch(...a)),multiple:e.multiValue,"onUpdate:modelValue":n[1]||(n[1]=a=>e.model=a)},[e.singleValue&&!e.minimum?(t.openBlock(),t.createElementBlock("option",aE,"None")):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.optionGroups,a=>(t.openBlock(),t.createElementBlock("optgroup",{key:a.key,label:a.title},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.options,c=>(t.openBlock(),t.createElementBlock("option",{value:c.value},t.toDisplayString(c.title),9,dE))),256))],8,cE))),128))],40,lE),[[t.vModelSelect,e.model]])],2)}const mE=w(nE,[["render",uE],["__scopeId","data-v-74252ee9"]]);function Rm(e,n){return e=String(e||"").toLowerCase(),n=String(n||"").toLowerCase(),n.includes(e)}const fE={components:{UxCircle:pr},props:{item:{type:Object},click:{type:Function},keywords:{type:String,default:""}},data(){return{}},methods:{clicked(){this.click(this.item)},toggleCollapse(){return this.collapsed=!this.collapsed}},created(){this.$glossary.ensure()},inject:{registry:{},isSelected:{default(){}}},computed:{glossary(){return this.$glossary.hash},definition(){var n,r;const e=(r=(n=this.item)==null?void 0:n.meta)==null?void 0:r.definition;if(e)return this.glossary[e]},selected(){return this.isSelected(this.item)},isChildMatch(){const e=this;function n(r){if(!r||r.length===0)return!1;let i=!1;return r.forEach(function(s){if(!i){if(Rm(e.keywords,s.title)){i=!0;return}if(e.isSelected(s)){i=!0;return}s.children&&n(s.children)&&(i=!0)}}),i}return n(e.item.children)},isMatching(){var e;return!!((e=this.keywords)!=null&&e.length)},isMatch(){return this.isMatching?Rm(this.keywords,this.item.title):!1},isUnmatch(){if(this.isMatching)return!this.isMatch},hasChildren(){var e;return(e=this.item.children)==null?void 0:e.length},expanded(){return!this.collapsed},collapsed:{set(e){this.registry[this.item._id]=this.item.collapsed=e},get(){return this.hasChildren?this.keywords?!1:this.registry[this.item._id]?!0:this.item.collapsed:!0}}}},hE={class:"outer"},pE={key:0,class:"children"};function yE(e,n,r,i,s,o){const l=t.resolveComponent("ux-icon"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-circle"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row"),m=t.resolveComponent("scope-item",!0);return t.openBlock(),t.createElementBlock("div",hE,[t.createElementVNode("div",{class:t.normalizeClass(["scope-item",{selected:o.selected,matched:o.isMatch,unmatched:o.isUnmatch,childmatched:o.isChildMatch,childselected:e.isChildSelected}]),onClick:n[1]||(n[1]=(...f)=>o.clicked&&o.clicked(...f))},[t.createVNode(u,{gap:"",vcenter:""},{default:t.withCtx(()=>[t.createVNode(a,{class:"select-mark",shrink:""},{default:t.withCtx(()=>[t.createVNode(l,{icon:o.selected?"fa-check":"fa-regular fa-circle"},null,8,["icon"])]),_:1}),t.createVNode(a,{shrink:""},{default:t.withCtx(()=>[t.createVNode(c,{value:r.item},null,8,["value"])]),_:1}),t.createVNode(a,{class:"scope-title"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(r.item.title),1)]),_:1}),o.definition?(t.openBlock(),t.createBlock(a,{key:0,class:"definition-title",shrink:""},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.definition.title),1)]),_:1})):t.createCommentVNode("",!0),o.hasChildren?(t.openBlock(),t.createBlock(a,{key:1,shrink:""},{default:t.withCtx(()=>[t.createVNode(d,{onClick:n[0]||(n[0]=t.withModifiers(f=>o.toggleCollapse(),["stop","prevent"])),size:"xs",icon:""},{default:t.withCtx(()=>[t.createVNode(l,{icon:o.expanded?"fa-angle-up":"fa-angle-down"},null,8,["icon"])]),_:1})]),_:1})):t.createCommentVNode("",!0)]),_:1})],2),o.expanded?(t.openBlock(),t.createElementBlock("div",pE,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.item.children,f=>(t.openBlock(),t.createBlock(m,{click:r.click,item:f,keywords:r.keywords},null,8,["click","item","keywords"]))),256))])):t.createCommentVNode("",!0)])}const gE=w(fE,[["render",yE],["__scopeId","data-v-eeed1e2f"]]);let Ds;const kE={components:{ScopeItem:gE,Search:ot},created(){this.$glossary.ensure()},props:{action:{type:String},type:{type:String,required:!0},include:{type:String,default:"scope"},modelValue:{type:Array,default(){return[]}},single:{type:Boolean,default:!1}},data(){return{loading:!0,model:this.modelValue,scopes:[],registry:{},keywords:""}},mounted(){},beforeUnmount(){},methods:{expandAll(){const e=this;e.allLeaves.forEach(function({_id:n}){e.registry[n]=!1})},collapseAll(){const e=this;e.allLeaves.forEach(function({_id:n}){e.registry[n]=!0})},select(e){if(this.single){this.model=[e];return}this.isSelected(e)||this.model.push(e)},deselect(e){const n=this,r=n.$sdk.utils.id(e);n.isSelected(e)&&(n.single&&(n.model.length=0),n.model=n.model.filter(function(i){return n.$sdk.utils.id(i)!=r}))},isSelected(e){const n=this.$sdk.utils.id(e);return this.hash[n]},toggle(e){this.isSelected(e)?this.deselect(e):this.select(e)},click(e){this.toggle(e)},async checkLoad(){Ds||(Ds=!0,this.action&&this.type?this.scopes=await this.loadScopes():(console.log("missing action or type",this.action,this.type),this.scopes=await this.loadTree()),Ds=!1)},async loadTree(){this.loading=!0;const{data:e}=await this.$sdk.api.get("/scope/tree");return this.loading=!1,e},async loadScopes(){this.loading=!0;const{data:e}=await this.$sdk.api.post("/scope/actionable",{action:this.action,type:this.type});return this.loading=!1,e},async showModal(){const e=this,n={};await e.$sdk.modal({component:ScopeSelectModal,options:n})}},provide(){return{isSelected:this.isSelected,registry:this.registry}},computed:{glossary(){return this.$glossary.hash},filteredScopes(){var r;let e=this.scopes;switch(((r=this.field)==null?void 0:r.include)||this.include||"scope"){case"unit":e=e.filter(function(i){return!!i.unit});break;case"scope":e=e.filter(function(i){return!i.unit});break}return e},hasSelection(){return this.model.length},hash(){return this.model.reduce(function(e,n){return e[n._id||n]=!0,e},{})},empty(){return!this.model.length},summary(){const e=this;return e.model.length?e.model.map(function(n){return n.title}).join(", "):"Select Scopes"},allLeaves(){const e=[];function n(r){r.forEach(function(i){e.push(i),i.children&&n(i.children)})}return n(this.filteredScopes),e}},watch:{type:{handler(){this.checkLoad()},immediate:!0},action:{handler(){this.checkLoad()},immediate:!0},modelValue(e){this.model=e},model(e){this.$emit("update:modelValue",e)}}},_E={key:0,class:"padder"},wE={class:"padder"},xE={class:"padder"};function bE(e,n,r,i,s,o){const l=t.resolveComponent("spinner"),a=t.resolveComponent("search"),c=t.resolveComponent("flex-cell"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row"),m=t.resolveComponent("flex-header"),f=t.resolveComponent("scope-item"),h=t.resolveComponent("flex-body"),y=t.resolveComponent("flex-column");return t.openBlock(),t.createBlock(y,{class:t.normalizeClass({has:o.hasSelection})},{default:t.withCtx(()=>[s.loading?(t.openBlock(),t.createElementBlock("div",_E,[t.createVNode(l)])):(t.openBlock(),t.createBlock(y,{key:1},{default:t.withCtx(()=>[t.withDirectives(t.createVNode(m,null,{default:t.withCtx(()=>[t.createElementVNode("div",wE,[t.createVNode(u,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(c,null,{default:t.withCtx(()=>[t.createVNode(a,{modelValue:s.keywords,"onUpdate:modelValue":n[0]||(n[0]=p=>s.keywords=p),placeholder:"Search scopes"},null,8,["modelValue"])]),_:1}),t.createVNode(c,{shrink:""},{default:t.withCtx(()=>[t.createVNode(d,{onClick:o.expandAll,size:"xs"},{default:t.withCtx(()=>[t.createTextVNode("Expand All")]),_:1},8,["onClick"])]),_:1}),t.createVNode(c,{shrink:""},{default:t.withCtx(()=>[t.createVNode(d,{onClick:o.collapseAll,size:"xs"},{default:t.withCtx(()=>[t.createTextVNode("Collapse All")]),_:1},8,["onClick"])]),_:1})]),_:1})])]),_:1},512),[[t.vShow,o.allLeaves.length>20]]),t.createVNode(h,{class:"scroll-body"},{default:t.withCtx(()=>[t.createElementVNode("div",xE,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.filteredScopes,p=>(t.openBlock(),t.createBlock(f,{click:o.click,keywords:s.keywords,item:p},null,8,["click","keywords","item"]))),256))])]),_:1})]),_:1}))]),_:1},8,["class"])}const Um=w(kE,[["render",bE],["__scopeId","data-v-78a3e8d6"]]),CE={components:{UxCircle:pr},async created(){this.reloadScopeGlossary()},props:{size:{type:String},action:{type:String},type:{type:String},include:{type:String,default:"scope"},modelValue:{type:Array,default(){return[]}},minimum:{type:Number,default:0},maximum:{type:Number,default:0}},data(){return{scopeGlossary:{},loadingScopeGlossary:!0,loadingContentGlossary:!0,model:this.modelValue,definition:null}},mounted(){this.$sdk.addEventListener("glossary:scope",this.reloadScopeGlossary)},beforeUnmount(){this.$sdk.removeEventListener("glossary:scope",this.reloadScopeGlossary)},methods:{async reloadScopeGlossary(){this.loadingScopeGlossary=!0;const e=await this.$sdk.content.scopeGlossary({hash:!0});this.scopeGlossary=e,this.loadingScopeGlossary=!1},async openSelection(){const e=this,n={action:e.action,type:e.type,model:e.model,maximum:e.maximum,include:e.include},r=await e.$sdk.selectScopes(n);e.model=r}},computed:{visible(){const e=this.$sdk.utils.ids(this.model)||[],n=this.$sdk.utils.ids(this.availableDefaultScopes)||[];return!(n.length===1&&(!e.length||e[0]===n[0]))},loading(){return this.loadingScopeGlossary||this.loadingContentGlossary},cacheKey(){return this.user.cacheKey},empty(){return!this.model.length},filteredScopes(){let e=this.model||[];switch(this.include){case"scope":e=e.filter(function(n){return!n.unit});break;case"unit":e=e.filter(function(n){return!!n.unit});break}return e},summary(){var r;const e=this;return e.model.length?((r=e.filteredScopes)!=null&&r.length?e.filteredScopes:e.model).map(function(i){const s=i._id||i;return(e.scopeGlossary[s]||i).title||(e.loading?"loading":"(redacted)")}).join(", "):"Select Scopes"},definitionDefaultScopes(){var i;const e=this,n=(i=e.definition)==null?void 0:i.defaultScopes;if(n&&n.length)return[...n];const r=Object.keys(e.scopeGlossary);return r.length===1?[...r]:[]},definitionRestrictScopes(){var e;return((e=this.definition)==null?void 0:e.restrictScopes)||[]},restrictedLookup(){return this.definitionRestrictScopes.reduce(function(e,n){if(!n)return e;var r=n._id||n;return e[r]=r,e},{})},availableDefaultScopes(){const e=this;let n;return e.definitionRestrictScopes.length?(n=e.definitionDefaultScopes.filter(function(r){if(!r)return!1;var i=r._id||r;return e.restrictedLookup[i]}),!n.length&&e.definitionRestrictScopes.length===1&&(n=e.definitionRestrictScopes),n):e.definitionDefaultScopes}},watch:{availableDefaultScopes:{handler(e){this.model.length||e.length&&(this.model=[...e])},immediate:!0},modelValue(e){this.model=e},model(e){this.$emit("update:modelValue",e)},type:{async handler(e){const n=this;n.loadingContentGlossary=!0,await this.$glossary.ensure(),n.definition=this.$glossary.hash[e],n.loadingContentGlossary=!1},immediate:!0}}},VE={class:"circles"};function NE(e,n,r,i,s,o){const l=t.resolveComponent("ux-circle"),a=t.resolveComponent("ux-button");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass({invisible:!o.visible})},[t.createVNode(a,{size:r.size,loading:o.loading,onClick:o.openSelection},{default:t.withCtx(()=>[t.createElementVNode("div",VE,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.filteredScopes,c=>(t.openBlock(),t.createBlock(l,{value:c},null,8,["value"]))),256))]),t.createElementVNode("span",{class:t.normalizeClass({"empty-text":o.empty})},t.toDisplayString(o.summary),3)]),_:1},8,["size","loading","onClick"])],2)}const jm=w(CE,[["render",NE],["__scopeId","data-v-1913d47e"]]);function EE(e){return e===void 0||typeof e>"u"||e===null||String(e)==="null"||String(e)==="undefined"}const BE={components:{ScopeSelectButton:jm},props:{title:{type:String},modelValue:{},minimum:{type:Number,default:0},maximum:{type:Number,default:0}},mixins:[z],async created(){this.model=this.model,await this.$glossary.ensure();var e=this.$glossary.items,n=e;this.field.basicTypes===!1&&(n=n.filter(function(r){return!!r.definesType})),this.field.definedTypes===!1&&(n=n.filter(function(r){return!r.definesType})),n=n.map(function(r){return{title:r.title,value:r.key}}).sort((r,i)=>r.title>i.title?1:-1),this.types=n},data(){return{types:[]}},methods:{cleanOutput(e){var n=this;return EE(e)?n.multiValue?e=[]:e=void 0:n.multiValue?e=(e||[]).filter(Boolean).map(function(r){return n.getValue(r)}):e=n.getValue(e),e},cleanInput(e){var n=this;if(n.multiValue)e||(e=[]),Array.isArray(e)||(e=[e]),n.maximum&&e.length>n.maximum&&(e.length=n.maximum),e=e.filter(Boolean).map(function(i){var s=n.getValue(i);return n.returnObject?n.optionLookup[s]:s});else{var r=n.getValue(e);e=n.returnObject?n.optionLookup[r]:r}return e}},computed:{returnObject(){return!1},classes(){var e=[];return this.multiValue?e.push("multiple"):e.push("single"),e},optionLookup(){var e=this;return e.types.reduce(function(n,r){const i=e.getValue(r);return n[i]=r,n},{})},summary(){return this.model?this.getLabel(this.optionLookup[this.model]):this.title||"Click to select"},contextReferenceType(){return this.field.contextReferenceType},contextReferenceAction(){return this.field.contextReferenceAction},selectableOptions(){return this.types}}},SE={key:0,class:"ux-field-title"},TE={key:0,class:"ux-required-marker"},DE={key:1,class:"ux-field-description"};function OE(e,n,r,i,s,o){const l=t.resolveComponent("scope-select-button");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["scope-select",o.classes])},[e.showLabel?(t.openBlock(),t.createElementBlock("label",SE,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",TE,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",DE,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),t.createVNode(l,{maximum:r.maximum,type:o.contextReferenceType,action:o.contextReferenceAction,modelValue:e.model,"onUpdate:modelValue":n[0]||(n[0]=a=>e.model=a)},null,8,["maximum","type","action","modelValue"])],2)}const qm=w(BE,[["render",OE],["__scopeId","data-v-335f960b"]]),ME={props:{modelValue:{type:[String,Array]}},mixins:[z],methods:{update(e,n){var r=this.format(e.target.value);this.model[n]=r},format(n){n=String(n).replace(/[^0-9.-]/g,"");var n=parseFloat(n)*100;return isNaN(n)?"":(n=Math.round(n),n)},unformat(n){n=String(n).replace(/[^0-9.-]/g,"");var n=parseFloat(n)/100;return isNaN(n)?"":(n=n.toFixed(2),n)},getNewDefaultEntry(){return""},unfocus(){this.$refs.input.blur(),this.touch()}},computed:{model:{get(){return this.cleanOutput(this.value)},set(e){this.value=this.cleanInput(e),this.dispatch()}},proxy:{get(){var e=this;return e.multiValue?e.model.map(e.unformat):e.unformat(e.model)},set(e){var n=this;n.multiValue?n.model=e.map(n.format):n.model=n.format(e)}},currency(){return String(this.field.currency||"usd").toLowerCase()},prefix(){return this.$sdk.utils.currencySymbol(this.currency)},suffix(){return String(this.currency).toUpperCase()}}},FE={key:0,class:"ux-field-title"},IE={key:0,class:"ux-required-marker"},AE={key:1,class:"ux-field-description"},LE={key:2},$E={key:0,class:"ux-text-prefix"},PE=["onBlur","onUpdate:modelValue"],RE={key:1,class:"ux-text-suffix"},UE={key:0,class:"ux-text-prefix"},jE={key:1,class:"ux-text-suffix"};function qE(e,n,r,i,s,o){const l=t.resolveComponent("flex-cell"),a=t.resolveComponent("ux-icon"),c=t.resolveComponent("ux-button"),d=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",FE,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",IE,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",AE,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",LE,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.model,(u,m)=>(t.openBlock(),t.createBlock(d,{class:"ux-text-row",key:m},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["ux-text-wrap",{prefixed:o.prefix,suffixed:o.suffix}])},[o.prefix?(t.openBlock(),t.createElementBlock("span",$E,t.toDisplayString(o.prefix),1)):t.createCommentVNode("",!0),t.withDirectives((t.openBlock(),t.createElementBlock("input",{class:"ux-field-focus ux-text-input-multiple",ref_for:!0,ref:"input",placeholder:"0.00",key:`proxy-index-${m}`,onKeydown:n[0]||(n[0]=t.withKeys(t.withModifiers(f=>e.add(),["stop","prevent"]),["enter"])),onBlur:f=>o.update(f,m),"onUpdate:modelValue":f=>o.proxy[m]=f,onFocus:n[1]||(n[1]=(...f)=>e.touch&&e.touch(...f))},null,40,PE)),[[t.vModelText,o.proxy[m],void 0,{lazy:!0}]]),o.suffix?(t.openBlock(),t.createElementBlock("span",RE,t.toDisplayString(o.suffix),1)):t.createCommentVNode("",!0)],2)]),_:2},1024),t.createVNode(l,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(c,{key:0,tag:"a",icon:"",onClick:f=>e.remove(u)},{default:t.withCtx(()=>[t.createVNode(a,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(c,{key:0,onClick:n[2]||(n[2]=u=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel)+" ",1),t.createVNode(a,{icon:"fa-plus",right:""})]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock("div",{key:3,class:t.normalizeClass(["ux-text-wrap",{prefixed:o.prefix,suffixed:o.suffix}])},[o.prefix?(t.openBlock(),t.createElementBlock("span",UE,t.toDisplayString(o.prefix),1)):t.createCommentVNode("",!0),t.withDirectives((t.openBlock(),t.createElementBlock("input",{class:"ux-field-focus ux-text-input-single",ref:"input",key:o.proxy,placeholder:"0.00",onKeyup:n[3]||(n[3]=t.withKeys(t.withModifiers((...u)=>o.unfocus&&o.unfocus(...u),["stop","prevent"]),["enter"])),onFocus:n[4]||(n[4]=(...u)=>e.touch&&e.touch(...u)),"onUpdate:modelValue":n[5]||(n[5]=u=>o.proxy=u)},null,32)),[[t.vModelText,o.proxy,void 0,{lazy:!0}]]),o.suffix?(t.openBlock(),t.createElementBlock("span",jE,t.toDisplayString(o.suffix),1)):t.createCommentVNode("",!0)],2))],64)}const zm=w(ME,[["render",qE],["__scopeId","data-v-30b07ae5"]]),zE={components:{draggable:Xr},props:{modelValue:{type:[String,Array]}},data(){return{drag:!1,unmasked:!1,unmaskedLookup:t.reactive({})}},mixins:[z],computed:{reorderable(){return this.multiValue&&this.field.reorderable},copyable(){return this.$sdk.global.copyText&&this.field.copyable},uneditable(){return this.field.editable===!1},inputClasses(){const e=[];return e.push(`ux-text-input-${this.inputType}`),e.join(" ")},actualInputType(){return this.unmasked?"text":this.inputType},sensitive(){return this.inputType==="password"},inputType(){switch(this.field.widget){case"password":case"email":return this.field.widget;default:switch(this.field.type){case"email":return"email";default:return"text"}}},lazy(){switch(this.type){case"integer":case"number":case"decimal":case"float":case"url":case"key":return!0}},actualPlaceholder(){if(this.field.placeholder)return this.field.placeholder;switch(this.type){case"integer":case"number":case"decimal":case"float":return"0";case"url":return"https://www.website.com";case"email":return"you@youremail.com"}}},methods:{copy(e){let n;this.maximum===1?n=this.model:n=this.model[e],this.$sdk.global.copyText(n)},toggleMask(e){this.maximum===1?this.unmasked=!this.unmasked:this.unmaskedLookup[`m${e}`]=!this.unmaskedLookup[`m${e}`]},cleanOutputValue(e){var n=this.cleanTextInput(e,this.type,this);return n?String(n):""},cleanInputValue(e){return this.cleanTextInput(e,this.type,this)},getNewDefaultEntry(){return""}}},WE={key:0,class:"ux-field-title"},HE={key:0,class:"ux-required-marker"},GE={key:1,class:"ux-field-description"},YE={key:2},JE={class:"ux-text-wrap"},KE={key:0,class:"ux-text-prefix"},ZE=["readonly","type","placeholder","onUpdate:modelValue"],XE=["readonly","type","placeholder","onUpdate:modelValue"],QE={key:3,class:"ux-text-suffix"},vE={class:"ux-text-wrap"},eB={key:0,class:"ux-text-prefix"},tB=["readonly","type","placeholder","onUpdate:modelValue"],nB=["readonly","type","placeholder","onUpdate:modelValue"],rB={key:3,class:"ux-text-suffix"},oB={class:"ux-text-wrap"},iB={key:0,class:"ux-text-prefix"},sB=["readonly","type","placeholder"],lB=["readonly","type","placeholder"],aB={key:3,class:"ux-text-suffix"};function cB(e,n,r,i,s,o){const l=t.resolveComponent("ux-icon"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-button"),d=t.resolveComponent("flex-row"),u=t.resolveComponent("draggable");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",WE,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",HE,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",GE,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",YE,[o.reorderable?(t.openBlock(),t.createBlock(u,{key:0,modelValue:e.model,"onUpdate:modelValue":n[4]||(n[4]=m=>e.model=m),group:`${e.field.key}-order`,onStart:n[5]||(n[5]=m=>s.drag=!0),onEnd:n[6]||(n[6]=m=>s.drag=!1),handle:".handle"},{item:t.withCtx(({element:m,index:f})=>[t.createVNode(d,{gap:"",class:"ux-text-row"},{default:t.withCtx(()=>[t.createVNode(a,{class:"handle arrows",shrink:"",vcenter:""},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-arrows"})]),_:1}),t.createVNode(a,null,{default:t.withCtx(()=>[t.createElementVNode("div",JE,[e.prefix?(t.openBlock(),t.createElementBlock("span",KE,t.toDisplayString(e.prefix),1)):t.createCommentVNode("",!0),o.lazy?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,readonly:o.uneditable,type:s.unmaskedLookup[`m${f}`]?"text":o.inputType,class:t.normalizeClass([o.inputClasses,"ux-field-focus ux-text-input-multiple"]),placeholder:o.actualPlaceholder,onFocus:n[0]||(n[0]=(...h)=>e.touch&&e.touch(...h)),ref:"input",onKeydown:n[1]||(n[1]=t.withKeys(t.withModifiers(h=>e.add(),["stop","prevent"]),["enter"])),"onUpdate:modelValue":h=>e.model[f]=h},null,42,ZE)),[[t.vModelDynamic,e.model[f],void 0,{lazy:!0}]]):t.createCommentVNode("",!0),o.lazy?t.createCommentVNode("",!0):t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:2,readonly:o.uneditable,type:s.unmaskedLookup[`m${f}`]?"text":o.inputType,class:t.normalizeClass([o.inputClasses,"ux-field-focus ux-text-input-multiple"]),placeholder:o.actualPlaceholder,onFocus:n[2]||(n[2]=(...h)=>e.touch&&e.touch(...h)),ref:"input",onKeydown:n[3]||(n[3]=t.withKeys(t.withModifiers(h=>e.add(),["stop","prevent"]),["enter"])),"onUpdate:modelValue":h=>e.model[f]=h},null,42,XE)),[[t.vModelDynamic,e.model[f]]]),e.suffix?(t.openBlock(),t.createElementBlock("span",QE,t.toDisplayString(e.suffix),1)):t.createCommentVNode("",!0)])]),_:2},1024),o.sensitive?(t.openBlock(),t.createBlock(a,{key:0,shrink:"",vcenter:""},{default:t.withCtx(()=>[t.createVNode(c,{size:e.size,tag:"a",icon:"",onClick:h=>o.toggleMask(f)},{default:t.withCtx(()=>[t.createVNode(l,{icon:s.unmaskedLookup[`m${f}`]?"fa-eye":"fa-eye-slash"},null,8,["icon"])]),_:2},1032,["size","onClick"])]),_:2},1024)):t.createCommentVNode("",!0),o.copyable?(t.openBlock(),t.createBlock(a,{key:1,shrink:"",vcenter:""},{default:t.withCtx(()=>[t.createVNode(c,{size:e.size,tag:"a",icon:"",onClick:h=>o.copy(f)},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-copy"})]),_:2},1032,["size","onClick"])]),_:2},1024)):t.createCommentVNode("",!0),t.createVNode(a,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(c,{key:0,size:e.size,tag:"a",icon:"",onClick:h=>e.remove(m)},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-times"})]),_:2},1032,["size","onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024)]),_:1},8,["modelValue","group"])):(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(e.model,(m,f)=>(t.openBlock(),t.createBlock(d,{gap:"",class:"ux-text-row",key:f},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createElementVNode("div",vE,[e.prefix?(t.openBlock(),t.createElementBlock("span",eB,t.toDisplayString(e.prefix),1)):t.createCommentVNode("",!0),o.lazy?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,readonly:o.uneditable,type:s.unmaskedLookup[`m${f}`]?"text":o.inputType,class:t.normalizeClass([o.inputClasses,"ux-field-focus ux-text-input-multiple"]),placeholder:o.actualPlaceholder,onFocus:n[7]||(n[7]=(...h)=>e.touch&&e.touch(...h)),ref_for:!0,ref:"input",onKeydown:n[8]||(n[8]=t.withKeys(t.withModifiers(h=>e.add(),["stop","prevent"]),["enter"])),"onUpdate:modelValue":h=>e.model[f]=h},null,42,tB)),[[t.vModelDynamic,e.model[f],void 0,{lazy:!0}]]):t.createCommentVNode("",!0),o.lazy?t.createCommentVNode("",!0):t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:2,readonly:o.uneditable,type:s.unmaskedLookup[`m${f}`]?"text":o.inputType,class:t.normalizeClass([o.inputClasses,"ux-field-focus ux-text-input-multiple"]),placeholder:o.actualPlaceholder,onFocus:n[9]||(n[9]=(...h)=>e.touch&&e.touch(...h)),ref_for:!0,ref:"input",onKeydown:n[10]||(n[10]=t.withKeys(t.withModifiers(h=>e.add(),["stop","prevent"]),["enter"])),"onUpdate:modelValue":h=>e.model[f]=h},null,42,nB)),[[t.vModelDynamic,e.model[f]]]),e.suffix?(t.openBlock(),t.createElementBlock("span",rB,t.toDisplayString(e.suffix),1)):t.createCommentVNode("",!0)])]),_:2},1024),o.sensitive?(t.openBlock(),t.createBlock(a,{key:0,shrink:"",vcenter:""},{default:t.withCtx(()=>[t.createVNode(c,{size:e.size,tag:"a",icon:"",onClick:h=>o.toggleMask(f)},{default:t.withCtx(()=>[t.createVNode(l,{icon:s.unmaskedLookup[`m${f}`]?"fa-eye":"fa-eye-slash"},null,8,["icon"])]),_:2},1032,["size","onClick"])]),_:2},1024)):t.createCommentVNode("",!0),o.copyable?(t.openBlock(),t.createBlock(a,{key:1,shrink:"",vcenter:""},{default:t.withCtx(()=>[t.createVNode(c,{size:e.size,tag:"a",icon:"",onClick:h=>o.copy(f)},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-copy"})]),_:2},1032,["size","onClick"])]),_:2},1024)):t.createCommentVNode("",!0),t.createVNode(a,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(c,{key:0,size:e.size,tag:"a",icon:"",onClick:h=>e.remove(m)},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-times"})]),_:2},1032,["size","onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(c,{key:2,size:e.size,onClick:n[11]||(n[11]=m=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel)+" ",1),t.createVNode(l,{icon:"fa-plus",right:""})]),_:1},8,["size"])):t.createCommentVNode("",!0)])):(t.openBlock(),t.createBlock(d,{key:3,gap:""},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createElementVNode("div",oB,[e.prefix?(t.openBlock(),t.createElementBlock("span",iB,t.toDisplayString(e.prefix),1)):t.createCommentVNode("",!0),o.lazy?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,readonly:o.uneditable,type:o.actualInputType,ref:"input",class:t.normalizeClass([o.inputClasses,"ux-field-focus ux-text-input-single"]),placeholder:o.actualPlaceholder,onFocus:n[12]||(n[12]=(...m)=>e.touch&&e.touch(...m)),"onUpdate:modelValue":n[13]||(n[13]=m=>e.model=m)},null,42,sB)),[[t.vModelDynamic,e.model,void 0,{lazy:!0}]]):t.createCommentVNode("",!0),o.lazy?t.createCommentVNode("",!0):t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:2,readonly:o.uneditable,type:o.actualInputType,ref:"input",class:t.normalizeClass([o.inputClasses,"ux-field-focus ux-text-input-single"]),placeholder:o.actualPlaceholder,onFocus:n[14]||(n[14]=(...m)=>e.touch&&e.touch(...m)),"onUpdate:modelValue":n[15]||(n[15]=m=>e.model=m)},null,42,lB)),[[t.vModelDynamic,e.model]]),e.suffix?(t.openBlock(),t.createElementBlock("span",aB,t.toDisplayString(e.suffix),1)):t.createCommentVNode("",!0)])]),_:1}),o.sensitive?(t.openBlock(),t.createBlock(a,{key:0,shrink:"",vcenter:""},{default:t.withCtx(()=>[t.createVNode(c,{size:e.size,tag:"a",icon:"",onClick:o.toggleMask},{default:t.withCtx(()=>[t.createVNode(l,{icon:s.unmasked?"fa-eye":"fa-eye-slash"},null,8,["icon"])]),_:1},8,["size","onClick"])]),_:1})):t.createCommentVNode("",!0),o.copyable?(t.openBlock(),t.createBlock(a,{key:1,shrink:"",vcenter:""},{default:t.withCtx(()=>[t.createVNode(c,{size:e.size,tag:"a",icon:"",onClick:o.copy},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-copy"})]),_:1},8,["size","onClick"])]),_:1})):t.createCommentVNode("",!0)]),_:1}))],64)}const Os=w(zE,[["render",cB],["__scopeId","data-v-790b60de"]]),dB={props:{modelValue:{type:[String,Array]}},data(){return{}},mixins:[z],computed:{copyable(){return this.$sdk.global.copyText&&this.field.copyable},uneditable(){return this.field.editable===!1}},methods:{async edit(){const e=this,{key:n}=await e.$sdk.prompt([{title:"Key",type:"string",key:"key",type:"key",minimum:1,maximum:1,defaultValues:[e.model],autofocus:!0}],{title:"Set a key",description:"This is a database key that once set should rarely be changed. Only edit this if you know what you are doing."});e.model=n},copy(e){let n;this.maximum===1?n=this.model:n=this.model[e],this.$sdk.global.copyText(n)},cleanOutputValue(e){var n=this.cleanTextInput(e,this.type,this);return n?String(n):""},cleanInputValue(e){return this.cleanTextInput(e,this.type,this)},getNewDefaultEntry(){return""}}},uB={key:0,class:"ux-field-title"},mB={key:0,class:"ux-required-marker"},fB={key:1,class:"ux-field-description"},hB={key:2};function pB(e,n,r,i,s,o){const l=t.resolveComponent("ux-icon"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",uB,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",mB,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",fB,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",hB)):(t.openBlock(),t.createBlock(c,{key:3,gap:""},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createElementVNode("div",{class:"ux-key-wrap",onClick:n[0]||(n[0]=(...d)=>o.edit&&o.edit(...d))},[t.createTextVNode(t.toDisplayString(e.model)+" ",1),t.createVNode(l,{icon:"far fa-pen-to-square"})])]),_:1})]),_:1}))],64)}const yB=w(dB,[["render",pB],["__scopeId","data-v-de658074"]]),gB={props:{modelValue:{type:[String,Array]}},mixins:[z],methods:{getNewDefaultEntry(){return""}}},kB={key:0,class:"ux-field-title"},_B={key:0,class:"ux-required-marker"},wB={key:1,class:"ux-field-description"},xB={key:2},bB=["placeholder","onUpdate:modelValue"],CB=["placeholder"];function VB(e,n,r,i,s,o){const l=t.resolveComponent("flex-cell"),a=t.resolveComponent("ux-icon"),c=t.resolveComponent("ux-button"),d=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",kB,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",_B,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",wB,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",xB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.model,(u,m)=>(t.openBlock(),t.createBlock(d,{class:"ux-text-row",key:m},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("textarea",{placeholder:e.placeholder,contenteditable:"",onFocus:n[0]||(n[0]=(...f)=>e.touch&&e.touch(...f)),ref_for:!0,ref:"input","onUpdate:modelValue":f=>e.model[m]=f,class:"ux-textarea ux-field-focus ux-text-area-multiple"},null,40,bB),[[t.vModelText,e.model[m]]])]),_:2},1024),t.createVNode(l,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(c,{key:0,tag:"a",icon:"",onClick:f=>e.remove(u)},{default:t.withCtx(()=>[t.createVNode(a,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(c,{key:0,onClick:n[1]||(n[1]=u=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:3,placeholder:e.placeholder,class:"ux-textarea ux-field-focus ux-text-area-single",onFocus:n[2]||(n[2]=(...u)=>e.touch&&e.touch(...u)),"onUpdate:modelValue":n[3]||(n[3]=u=>e.model=u),role:"textbox",contenteditable:""},null,40,CB)),[[t.vModelText,e.model]])],64)}const NB=w(gB,[["render",VB],["__scopeId","data-v-18c18ffb"]]);function Ct(e){return String(e).length<2&&(e=`0${e}`),e}const EB={components:{Datepicker:$u},props:{modelValue:{type:[Date,String,Array]},disableTime:{type:Boolean,default:!1}},mixins:[z],computed:{formattedMinDate(){return this.minDate?this.showTime?this.formatDateTime(this.minDate):this.formatDate(this.minDate):null},formattedMaxDate(){return this.maxDate?this.showTime?this.formatDateTime(this.maxDate):this.formatDate(this.maxDate):null},singleModel:{get(){return this.cleanOutput(this.value)},set(e){if(!e){this.value=void 0,this.dispatch();return}const n=new Date(e);isNaN(n.getTime())||(this.value=n.toISOString(),this.dispatch())}},dateOnlyModel:{get(){let e=this.cleanOutput(this.model);if(this.multiValue)e=e.map(function(n){if(!n)return n;const r=new Date(n);return isNaN(r.getTime())?null:r.toISOString().slice(0,10)}).filter(Boolean);else if(e){const n=new Date(e);if(isNaN(n.getTime()))return null;e=n.toISOString().slice(0,10)}return e},set(e){if(!e){this.value=void 0,this.dispatch();return}if(e!=="invalid"){var n=this.cleanOutput(e),r=this.cleanOutput(this.value);if(n!=r){if(e=this.cleanInput(n),this.multiValue)e=e.map(function(i){const s=new Date(i);return isNaN(s.getTime())?null:s.toISOString()}).filter(Boolean);else{const i=new Date(e);if(isNaN(i.getTime()))return;e=i.toISOString()}this.value=e,this.dispatch()}}}},showTime(){return!this.dateOnly},dateOnly(){var e;return this.disableTime?!0:!!((e=this.field)!=null&&e.dateOnly)},model:{get(){return this.cleanOutput(this.value)},set(e){if(!e){this.value=void 0,this.dispatch();return}if(e!=="invalid"){var n=this.cleanOutput(e),r=this.cleanOutput(this.value);n!=r&&(e=this.cleanInput(n),this.value=e,this.dispatch())}}}},methods:{updateMultiValue(e,n){if(!n)return;const r=new Date(n);if(isNaN(r.getTime()))return;const i=[...this.model];i[e]=r.toISOString(),this.value=this.cleanInput(i),this.dispatch()},formatDate(e){if(!e)return null;const n=new Date(e);return isNaN(n.getTime())?null:`${n.getFullYear()}-${Ct(n.getMonth()+1)}-${Ct(n.getDate())}`},formatDateTime(e){if(!e)return null;const n=new Date(e);return isNaN(n.getTime())?null:`${this.formatDate(n)}T${Ct(n.getHours())}:${Ct(n.getMinutes())}`},cleanOutputValue(e){if(e=e?new Date(e):new Date,!isNaN(e.getFullYear()))return`${e.getFullYear()}-${Ct(e.getMonth()+1)}-${Ct(e.getDate())}T${Ct(e.getHours())}:${Ct(e.getMinutes())}`},cleanInputValue(e){let n=new Date(e);return n.toString()=="Invalid Date"?"invalid":n.toISOString()},getNewDefaultEntry(){return new Date}}},BB={key:0,class:"ux-field-title"},SB={key:0,class:"ux-required-marker"},TB={key:1,class:"ux-field-description"},DB={key:2};function OB(e,n,r,i,s,o){const l=t.resolveComponent("datepicker"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-icon"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",BB,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",SB,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",TB,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",DB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.model,(m,f)=>(t.openBlock(),t.createBlock(u,{class:"ux-text-row",key:f},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(l,{"date-only":o.dateOnly,"min-date":e.minDate,"max-date":e.maxDate,"model-value":o.model[f],"onUpdate:modelValue":h=>o.updateMultiValue(f,h),onFocus:e.touch,class:"ux-field-focus"},null,8,["date-only","min-date","max-date","model-value","onUpdate:modelValue","onFocus"])]),_:2},1024),t.createVNode(a,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(d,{key:0,color:"default",tag:"a",icon:"",onClick:h=>e.remove(m)},{default:t.withCtx(()=>[t.createVNode(c,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(d,{key:0,onClick:n[0]||(n[0]=m=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createBlock(l,{key:3,"date-only":o.dateOnly,"min-date":e.minDate,"max-date":e.maxDate,modelValue:o.singleModel,"onUpdate:modelValue":n[1]||(n[1]=m=>o.singleModel=m),onFocus:e.touch,class:"ux-field-focus"},null,8,["date-only","min-date","max-date","modelValue","onFocus"]))],64)}const Wm=w(EB,[["render",OB],["__scopeId","data-v-a7631835"]]);function Hm(e){return e=String(e||"00").replace(/[^0-9.]/g,"").slice(0,2),e.length<2&&(e=`0${e}`),e}const MB={props:{modelValue:{type:String}},mixins:[z],methods:{cleanInputValue(e){return e.split(":").join("")},cleanOutputValue(e){let n=Hm(e.slice(0,2))||"",r=Hm(e.slice(2))||"";return`${n}:${r}`.slice(0,5)},getNewDefaultEntry(){return"00:00"}}},FB={key:0,class:"ux-field-title"},IB={key:0,class:"ux-required-marker"},AB={key:1,class:"ux-field-description"},LB={key:2},$B=["onUpdate:modelValue"];function PB(e,n,r,i,s,o){const l=t.resolveComponent("flex-cell"),a=t.resolveComponent("ux-icon"),c=t.resolveComponent("ux-button"),d=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",FB,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",IB,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",AB,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",LB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.model,(u,m)=>(t.openBlock(),t.createBlock(d,{class:"ux-text-row",key:m},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("input",{type:"time",class:"ux-field-focus ux-text-input-multiple",onFocus:n[0]||(n[0]=(...f)=>e.touch&&e.touch(...f)),ref_for:!0,ref:"input",onKeydown:n[1]||(n[1]=t.withKeys(t.withModifiers(f=>e.add(),["stop","prevent"]),["enter"])),"onUpdate:modelValue":f=>e.model[m]=f},null,40,$B),[[t.vModelText,e.model[m]]])]),_:2},1024),t.createVNode(l,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(c,{key:0,tag:"a",icon:"",onClick:f=>e.remove(u)},{default:t.withCtx(()=>[t.createVNode(a,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(c,{key:0,onClick:n[2]||(n[2]=u=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:3,type:"time",class:"ux-field-focus ux-text-input-single",onFocus:n[3]||(n[3]=(...u)=>e.touch&&e.touch(...u)),"onUpdate:modelValue":n[4]||(n[4]=u=>e.model=u)},null,544)),[[t.vModelText,e.model]])],64)}const Gm=w(MB,[["render",PB],["__scopeId","data-v-b9cac2ad"]]),RB={components:{Daterange:es},props:{modelValue:{type:[Object,Array]}},mixins:[z],computed:{model:{get(){return this.cleanOutput(this.value)},set(e){if(!e){this.value=void 0,this.dispatch();return}var n=this.cleanOutput(e),r=this.cleanOutput(this.value);n!=r&&(e=this.cleanInput(n),this.value=e,this.dispatch())}}},methods:{cleanOutputValue(e){return e},cleanInputValue(e){return e},getNewDefaultEntry(){return{}}}},UB={key:0,class:"ux-field-title"},jB={key:0,class:"ux-required-marker"},qB={key:1,class:"ux-field-description"},zB={key:2};function WB(e,n,r,i,s,o){const l=t.resolveComponent("daterange",!0),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-icon"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",UB,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",jB,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",qB,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",zB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.model,(m,f)=>(t.openBlock(),t.createBlock(u,{class:"ux-text-row",key:f},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(l,{onFocus:e.touch,modelValue:o.model[f],"onUpdate:modelValue":h=>o.model[f]=h},null,8,["onFocus","modelValue","onUpdate:modelValue"])]),_:2},1024),t.createVNode(a,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(d,{key:0,tag:"a",icon:"",onClick:h=>e.remove(m)},{default:t.withCtx(()=>[t.createVNode(c,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(d,{key:0,onClick:n[0]||(n[0]=m=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createBlock(l,{key:3,onFocus:e.touch,modelValue:o.model,"onUpdate:modelValue":n[1]||(n[1]=m=>o.model=m)},null,8,["onFocus","modelValue"]))],64)}const HB=w(RB,[["render",WB],["__scopeId","data-v-b6688859"]]);function Ym(e){return Array.isArray(e)?!!e[0]:!!e}const GB={mixins:[z],components:{UxCheckbox:gr},props:{modelValue:{type:[Boolean,Array]}},data(){return{boolean:Ym(this.modelValue)}},watch:{modelValue(e,n){this.boolean=Ym(e)},boolean(e,n){this.multiValue?this.$emit("update:modelValue",[e]):this.$emit("update:modelValue",e)}},methods:{getNewDefaultEntry(){return!!this.boolean}},computed:{longDescription(){return String(this.description).length>2}}},YB={key:0,class:"ux-field-title"},JB={key:0,class:"ux-required-marker"},KB={key:1,class:"ux-field-description"};function ZB(e,n,r,i,s,o){const l=t.resolveComponent("ux-checkbox"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock("div",null,[t.createVNode(c,{onClick:n[1]||(n[1]=d=>e.touch()),gap:""},{default:t.withCtx(()=>[t.createVNode(a,{vcenter:"",shrink:""},{default:t.withCtx(()=>[t.createVNode(l,{value:s.boolean,onClick:n[0]||(n[0]=d=>s.boolean=!s.boolean)},null,8,["value"])]),_:1}),t.createVNode(a,{vcenter:""},{default:t.withCtx(()=>[t.createElementVNode("div",null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",YB,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",JB,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",KB,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0)])]),_:1})]),_:1})])}const XB=w(GB,[["render",ZB]]),QB={props:{modelValue:{type:[String,Array]}},mixins:[z],methods:{getNewDefaultEntry(){return""}}},vB={key:0},eS=["innerHTML"],tS=["innerHTML"];function nS(e,n,r,i,s,o){const l=t.resolveComponent("compile"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-icon"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row");return e.multiValue?(t.openBlock(),t.createElementBlock("div",vB,[t.createVNode(u,{class:"ux-text-row"},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[e.field.compile?(t.openBlock(),t.createBlock(l,{key:0,template:e.field.template},null,8,["template"])):(t.openBlock(),t.createElementBlock("div",{key:1,innerHTML:e.field.template},null,8,eS))]),_:1}),t.createVNode(a,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(d,{key:0,tag:"a",icon:"",onClick:n[0]||(n[0]=m=>e.remove(e.entry))},{default:t.withCtx(()=>[t.createVNode(c,{icon:"fa-times"})]),_:1})):t.createCommentVNode("",!0)]),_:1})]),_:1}),e.canAddValue?(t.openBlock(),t.createBlock(d,{key:0,onClick:n[1]||(n[1]=m=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[e.field.compile?(t.openBlock(),t.createBlock(l,{key:0,template:e.field.template},null,8,["template"])):(t.openBlock(),t.createElementBlock("div",{key:1,innerHTML:e.field.template},null,8,tS))],64))}const rS=w(QB,[["render",nS]]);var Ms,Jm;function oS(){if(Jm)return Ms;Jm=1;var e=Math.ceil,n=Math.max;function r(i,s,o,l){for(var a=-1,c=n(e((s-i)/(o||1)),0),d=Array(c);c--;)d[l?c:++a]=i,i+=o;return d}return Ms=r,Ms}var Fs,Km;function Zm(){if(Km)return Fs;Km=1;var e=9007199254740991;function n(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return Fs=n,Fs}var Is,Xm;function As(){if(Xm)return Is;Xm=1;var e=jc(),n=Zm();function r(i){return i!=null&&n(i.length)&&!e(i)}return Is=r,Is}var Ls,Qm;function vm(){if(Qm)return Ls;Qm=1;var e=9007199254740991,n=/^(?:0|[1-9]\d*)$/;function r(i,s){var o=typeof i;return s=s??e,!!s&&(o=="number"||o!="symbol"&&n.test(i))&&i>-1&&i%1==0&&i<s}return Ls=r,Ls}var $s,ef;function iS(){if(ef)return $s;ef=1;var e=rd(),n=As(),r=vm(),i=En();function s(o,l,a){if(!i(a))return!1;var c=typeof l;return(c=="number"?n(a)&&r(l,a.length):c=="string"&&l in a)?e(a[l],o):!1}return $s=s,$s}var Ps,tf;function nf(){if(tf)return Ps;tf=1;var e=Ic(),n=1/0,r=17976931348623157e292;function i(s){if(!s)return s===0?s:0;if(s=e(s),s===n||s===-1/0){var o=s<0?-1:1;return o*r}return s===s?s:0}return Ps=i,Ps}var Rs,rf;function sS(){if(rf)return Rs;rf=1;var e=oS(),n=iS(),r=nf();function i(s){return function(o,l,a){return a&&typeof a!="number"&&n(o,l,a)&&(l=a=void 0),o=r(o),l===void 0?(l=o,o=0):l=r(l),a=a===void 0?o<l?1:-1:r(a),e(o,l,a,s)}}return Rs=i,Rs}var Us,of;function lS(){if(of)return Us;of=1;var e=sS(),n=e();return Us=n,Us}var aS=lS();const sf=mt(aS);function cS(e){return String(e).length<2&&(e=`0${e}`),e}const{lookup:dS,options:uS}=[...sf(1,13)].reduce(function(e,n){let r;switch(n){case 1:r="January";break;case 2:r="February";break;case 3:r="March";break;case 4:r="April";break;case 5:r="May";break;case 6:r="June";break;case 7:r="July";break;case 8:r="August";break;case 9:r="September";break;case 10:r="October";break;case 11:r="November";break;case 12:r="December";break}return e.lookup[n]=r,e.options.push({title:r,value:n}),e},{lookup:{},options:[]});function lf(){const e=_.now().toObject();return e.millisecond=0,e.second=0,e.minute=0,e.hour=12,e}const mS={components:{NativeSelect:Ke},props:{allDay:{type:Boolean,default:!1},modelValue:{type:Object,default(){return lf()}}},data(){return{model:void 0,meridian:"PM",disableEmit:!1,empty:!1}},methods:{touched(){this.empty=!1},reset(){this.disableEmit=!0,this.meridian="PM",this.model=lf(),this.$nextTick(function(){this.disableEmit=!1,this.empty=!0})},outputUpdate(){this.disableEmit||this.$emit("update:modelValue",this.output)}},watch:{changeString:"outputUpdate",modelValue:{immediate:!0,handler(e){if(e=JSON.parse(JSON.stringify(e)),!e){this.reset();return}this.empty=!1;let n=e.hour,r=this.meridian;n>=12?(r="PM",n>12&&(n=n-12)):n<12&&(r="AM"),this.meridian=r,e.hour=n,this.model=e}}},computed:{showTime(){return!this.allDay},changeString(){return JSON.stringify(this.output)},output(){if(!this.model)return;const e=this.showTime?this.minute:0,n=this.showTime?this.actualHour:0;return{millisecond:0,second:0,minute:e,hour:n,day:this.day,month:this.month,year:this.year,meridian:this.meridian}},displayHour(){const e=this;if(e.empty)return"--";let n=e.hour;return n===0&&(n=12),n},displayDay(){const e=this;return e.empty?"--":e.day},displayMonth(){const e=this;return e.empty?"-":dS[e.month]},displayYear(){const e=this;return e.empty?"----":e.year},displayMinute(){const e=this;return e.empty?"--":cS(e.minute)},meridianGate:{get(){return this.meridian},set(e){this.meridian=e}},hour:{get(){return this.model.hour||0},set(e){this.model.hour=e}},minute:{get(){let e=this.model.minute||0;return e=Math.min(e,59),e=Math.max(e,0),e},set(e){this.model.minute=e}},day:{get(){return this.model.day||_.now().toObject().day},set(e){this.model.day=e}},month:{get(){return this.model.month||_.now().toObject().month},set(e){this.model.month=e}},year:{get(){return this.model.year||new Date().getFullYear()},set(e){this.model.year=e}},actualHour(){const e=this;let n=e.hour;switch(e.meridian){case"AM":if(n===12)return 0;break;case"PM":if(n===12)return 12;n=12+n;break}return n},hourOptions(){return[{title:"1",value:1},{title:"2",value:2},{title:"3",value:3},{title:"4",value:4},{title:"5",value:5},{title:"6",value:6},{title:"7",value:7},{title:"8",value:8},{title:"9",value:9},{title:"10",value:10},{title:"11",value:11},{title:"12",value:0}]},minuteOptions(){return[{title:"00",value:0},{title:"05",value:5},{title:"10",value:10},{title:"15",value:15},{title:"20",value:20},{title:"25",value:25},{title:"30",value:30},{title:"35",value:35},{title:"40",value:40},{title:"45",value:45},{title:"50",value:50},{title:"55",value:55}]},dayOptions(){return[...sf(1,32)].map(function(e){return{title:e,value:e}})},yearOptions(){for(var e=new Date().getFullYear(),n=e-100,r=e+20,i=[],s=n;s<r;s++)i.push({title:s,value:s});return i},monthOptions(){return uS},amOptions(){return[{title:"AM",value:"AM"},{title:"PM",value:"PM"}]},timezone(){return"Australia/Melbourne"}}},fS=e=>(t.pushScopeId("data-v-7c5620c6"),e=e(),t.popScopeId(),e),hS={class:"date-section"},pS=fS(()=>t.createElementVNode("div",{class:"date-section shrink"},":",-1)),yS={class:"date-section"},gS={class:"date-section"},kS={class:"date-section"},_S={class:"date-section"},wS={class:"custom-select"},xS={class:"date-section"};function bS(e,n,r,i,s,o){const l=t.resolveComponent("ux-icon"),a=t.resolveComponent("native-select"),c=t.resolveComponent("flex-cell"),d=t.resolveComponent("flex-row");return t.openBlock(),t.createBlock(d,null,{default:t.withCtx(()=>[o.showTime?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(c,{shrink:"",class:"first"},{default:t.withCtx(()=>[t.createVNode(a,{onTouched:o.touched,modelValue:o.hour,"onUpdate:modelValue":n[0]||(n[0]=u=>o.hour=u),field:{minimum:1,maximum:1,options:o.hourOptions}},{default:t.withCtx(()=>[t.createElementVNode("div",hS,[t.createTextVNode(t.toDisplayString(o.displayHour)+" ",1),t.createVNode(l,{right:"",icon:"fa-angle-down"})])]),_:1},8,["onTouched","modelValue","field"])]),_:1}),t.createVNode(c,{shrink:""},{default:t.withCtx(()=>[pS]),_:1}),t.createVNode(c,{shrink:""},{default:t.withCtx(()=>[t.createVNode(a,{onTouched:o.touched,modelValue:o.minute,"onUpdate:modelValue":n[1]||(n[1]=u=>o.minute=u),field:{minimum:1,maximum:1,options:o.minuteOptions}},{default:t.withCtx(()=>[t.createElementVNode("div",yS,[t.createTextVNode(t.toDisplayString(o.displayMinute)+" ",1),t.createVNode(l,{right:"",icon:"fa-angle-down"})])]),_:1},8,["onTouched","modelValue","field"])]),_:1}),t.createVNode(c,{shrink:"",class:"last"},{default:t.withCtx(()=>[t.createVNode(a,{onTouched:o.touched,modelValue:o.meridianGate,"onUpdate:modelValue":n[2]||(n[2]=u=>o.meridianGate=u),field:{minimum:1,maximum:1,options:o.amOptions}},{default:t.withCtx(()=>[t.createElementVNode("div",gS,[t.createTextVNode(t.toDisplayString(s.meridian)+" ",1),t.createVNode(l,{right:"",icon:"fa-angle-down"})])]),_:1},8,["onTouched","modelValue","field"])]),_:1}),t.createVNode(c,{class:"spacer"})],64)):t.createCommentVNode("",!0),t.createVNode(c,{shrink:"",class:"first"},{default:t.withCtx(()=>[t.createVNode(a,{onTouched:o.touched,modelValue:o.day,"onUpdate:modelValue":n[3]||(n[3]=u=>o.day=u),field:{minimum:1,maximum:1,options:o.dayOptions}},{default:t.withCtx(()=>[t.createElementVNode("div",kS,[t.createTextVNode(t.toDisplayString(o.displayDay)+" ",1),t.createVNode(l,{right:"",icon:"fa-angle-down"})])]),_:1},8,["onTouched","modelValue","field"])]),_:1}),t.createVNode(c,{shrink:""},{default:t.withCtx(()=>[t.createVNode(a,{onTouched:o.touched,modelValue:o.month,"onUpdate:modelValue":n[4]||(n[4]=u=>o.month=u),field:{minimum:1,maximum:1,options:o.monthOptions}},{default:t.withCtx(()=>[t.createElementVNode("div",_S,[t.createTextVNode(t.toDisplayString(o.displayMonth)+" ",1),t.createVNode(l,{right:"",icon:"fa-angle-down"})])]),_:1},8,["onTouched","modelValue","field"])]),_:1}),t.createVNode(c,{shrink:"",class:"last"},{default:t.withCtx(()=>[t.createElementVNode("div",wS,[t.createVNode(a,{onTouched:o.touched,modelValue:o.year,"onUpdate:modelValue":n[5]||(n[5]=u=>o.year=u),field:{minimum:1,maximum:1,options:o.yearOptions}},{default:t.withCtx(()=>[t.createElementVNode("div",xS,[t.createTextVNode(t.toDisplayString(o.displayYear)+" ",1),t.createVNode(l,{right:"",icon:"fa-angle-down"})])]),_:1},8,["onTouched","modelValue","field"])])]),_:1})]),_:1})}const CS={mixins:[z],components:{DateObject:w(mS,[["render",bS],["__scopeId","data-v-7c5620c6"]])},props:{modelValue:{type:Object}},computed:{allDay(){return this.field.allDay||this.field.dateOnly},model:{get(){return this.cleanInput(this.value)},set(e){let n;(this.isGroup||this.widget==="form")&&(e===this.value?n=!1:n=!0);const r=this.cleanInput(e),i=this.cleanInput(this.value);if(JSON.stringify(r)!=JSON.stringify(i)||n){this.value=r,this.checkAutofocus();const o=this.cleanOutputValue(r);this.$emit("update:modelValue",o)}}}},methods:{getNewDefaultEntry(){return{}},cleanOutputValue(e){if(this.field.type==="date"&&e&&typeof e=="object"&&e.year!==void 0)try{let n=e.hour||0;e.meridian==="PM"&&n!==12?n=n+12:e.meridian==="AM"&&n===12&&(n=0);const r=_.fromObject({year:e.year,month:e.month,day:e.day,hour:n,minute:e.minute||0,second:e.second||0,millisecond:e.millisecond||0});return r.isValid?r.toJSDate():(console.warn("Invalid date object:",e,r.invalidReason),e)}catch(n){return console.warn("Error converting dateobject to Date:",n,e),e}return e},cleanInputValue(e){if(this.field.type==="date"){let n;if(e instanceof Date&&!isNaN(e.getTime()))try{n=_.fromJSDate(e)}catch(r){return console.warn("Error parsing JavaScript Date:",r,e),e}else if(typeof e=="string"&&e.trim().length>0)try{n=_.fromISO(e),n.isValid||(n=_.fromJSDate(new Date(e)))}catch(r){return console.warn("Error parsing date string:",r,e),e}else return e&&typeof e=="object"&&e.year!==void 0,e;if(n&&n.isValid)try{let r=n.hour,i="AM";return r>=12?(i="PM",r>12&&(r=r-12)):r===0&&(r=12),{millisecond:n.millisecond,second:n.second,minute:n.minute,hour:r,day:n.day,month:n.month,year:n.year,meridian:i}}catch(r){return console.warn("Error converting DateTime to dateobject:",r,e),e}else return console.warn("Invalid date value:",e,n==null?void 0:n.invalidReason),e}return e}}},VS={key:0,class:"ux-field-title"},NS={key:0,class:"ux-required-marker"},ES={key:1,class:"ux-field-description"},BS={key:2};function SS(e,n,r,i,s,o){const l=t.resolveComponent("date-object"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-icon"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",VS,[t.createTextVNode(t.toDisplayString(e.label),1),e.required?(t.openBlock(),t.createElementBlock("span",NS,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",ES,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",BS,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.model,(m,f)=>(t.openBlock(),t.createBlock(u,{class:"ux-text-row",key:f},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(l,{allDay:o.allDay,modelValue:o.model[f],"onUpdate:modelValue":h=>o.model[f]=h},null,8,["allDay","modelValue","onUpdate:modelValue"])]),_:2},1024),t.createVNode(a,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(d,{key:0,tag:"a",icon:"",onClick:h=>e.remove(m)},{default:t.withCtx(()=>[t.createVNode(c,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(d,{key:0,size:"sm",onClick:n[0]||(n[0]=m=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createBlock(l,{key:3,allDay:o.allDay,modelValue:o.model,"onUpdate:modelValue":n[1]||(n[1]=m=>o.model=m)},null,8,["allDay","modelValue"]))],64)}const TS=w(CS,[["render",SS],["__scopeId","data-v-7cccbc7b"]]);function DS(e,n){if(!e.glossary)return;const r=e.glossary.checkin;if(!r)return;const i={title:"Checkins",minimum:1,maximum:1,key:"join_checkin",asObject:!0,type:"group",fields:[{title:"",minimum:1,maximum:1,key:"checkin",asObject:!0,type:"group",fields:[{title:"Total",minimum:1,maximum:1,key:"total",type:"integer",referenceType:r.key}]}]};n.push(i)}function OS(e,n){if(!e.glossary)return;const r=e.glossary.assignment;if(!r)return;const i={title:"Roster › Assignments",minimum:1,maximum:1,key:"join_assignment",asObject:!0,type:"group",fields:[{title:"",minimum:1,maximum:1,key:"assignment",asObject:!0,type:"group",fields:[{title:"Total",minimum:1,maximum:1,key:"total",type:"integer",referenceType:r.key}]}]};n.push(i)}function MS(e,n){const r={title:"Roster › Blockout Periods",minimum:1,maximum:1,key:"join_blockout",asObject:!0,type:"group",fields:[{title:"",minimum:1,maximum:1,key:"blockout",asObject:!0,type:"group",fields:[{title:"Total",minimum:1,maximum:1,key:"total",type:"integer",referenceType:"blockout"}]}]};n.push(r)}function FS(e){let n=[];if(n.push({title:"Age",minimum:1,maximum:1,key:"_age",type:"integer"}),n.push({title:"Date of birth",minimum:1,maximum:1,key:"_dob",type:"date"}),e.glossary){DS(e,n),OS(e,n),MS(e,n);const r=e.glossary.persona;if(r){const o={title:"User Login",minimum:1,maximum:1,key:"join_persona",asObject:!0,type:"group",fields:[{title:"",minimum:1,maximum:1,key:"items[]",asObject:!0,type:"group",fields:(r.fields||[]).map(function(l){let a=l;switch(l.key){case"organisation":case"names":case"password":return;case"meta":a=JSON.parse(JSON.stringify(l)),a.fields=a.fields.filter(function({key:c}){switch(c){case"status":case"scopes":case"tags":case"updated":case"created":case"status":return!0}});break}return a}).filter(Boolean)},{title:"Total",minimum:1,maximum:1,key:"total",type:"integer",referenceType:"persona"}]};n.push(o)}}return n}function af(e){let n=[];if(n.push({title:"Event › Start",minimum:1,maximum:1,key:"join_event.startDate",type:"date",filterIncludeTime:!0}),n.push({title:"Event › Doors Open",minimum:1,maximum:1,key:"join_event.openDate",type:"date",filterIncludeTime:!0}),n.push({title:"Event › Doors Close",minimum:1,maximum:1,key:"join_event.closeDate",type:"date",filterIncludeTime:!0}),n.push({title:"Event › End",minimum:1,maximum:1,key:"join_event.endDate",type:"date",filterIncludeTime:!0}),e.glossary){const r=Object.entries(e.glossary).reduce(function(i,[s,o]){return o.definesType==="event"&&i.push(o),i},[]).map(function({title:i,key:s}){return{title:i,value:s}});r.length&&n.push({title:"Event › Type",minimum:1,maximum:1,key:"join_event.meta.definition",type:"string",widget:"select",options:r})}return n}function cf(e){let n=[];if(n.push({title:"Event › Start",minimum:1,maximum:1,key:"join_roster_event.startDate",type:"date",filterIncludeTime:!0}),n.push({title:"Event › End",minimum:1,maximum:1,key:"join_roster_event.endDate",type:"date",filterIncludeTime:!0}),e.glossary){const r=Object.entries(e.glossary).reduce(function(i,[s,o]){return o.definesType==="event"&&i.push(o),i},[]).map(function({title:i,key:s}){return{title:i,value:s}});r.length&&n.push({title:"Event › Type",minimum:1,maximum:1,key:"join_roster_event.meta.definition",type:"string",widget:"select",options:r})}return n}const IS={emits:["remove"],props:{fields:{type:Array,default(){return[]}},enableRemove:{type:Boolean},modelValue:{type:Object,default(){return{key:"",comparator:"",value:null,value2:null,values:[],conditions:[]}}}},async created(){this.comparators=await this.$sdk.content.comparators(),this.$glossary.ensure()},data(){return{comparators:null,model:this.modelValue,criteriaFields:[]}},watch:{"field.referenceType":{async handler(e){e&&await this.$glossary.ensure(e)},immediate:!0},field:{immediate:!0,handler(e){e&&e.translationDisabled?this.model.translationDisabled=!0:delete this.model.translationDisabled}},useTime(e){if(e)this.model.options||(this.model.options={}),this.model.options.useTime=!0;else{if(!this.model.options)return;delete this.model.options.useTime}},modelValue(e){e!=this.model&&(this.model=e)},fieldType(e,n){n&&(this.model.comparator=void 0)},modelKey:{handler(e,n){const r=this.field;if(!n&&e&&r){switch(e){case"_dob":this.model.comparator="anniversarybetween";return;case"_age":this.model.comparator="between";return}switch(r.type){case"date":this.model.comparator="datebetween";break;case"number":case"integer":case"decimal":case"float":this.model.comparator="equal";break;default:switch(r.widget){case"timezone":case"country":this.model.comparator="equal";break;default:this.model.comparator="in";break}break}if(this.extraCriteria){var i=(r.titles||[])[1];this.model.title=`Filter (${i||r.title})`}else this.model.title=`Filter (${r.title})`;this.model.type=r.type}n&&r&&(this.model.value=void 0,this.model.value2=void 0,this.model.values=[])}},checkCriteriaType:{immediate:!0,async handler(){var i;const e=this,n=e.extraCriteria;let r=[];if(n){const s=(i=e.field)==null?void 0:i.referenceType;s&&await e.$glossary.ensure(s);let l=e.glossary[s];if(l){let a=l.fields||[],c=[];switch(s){case"assignment":c=cf(e);break;case"checkin":c=af(e);break}a=[...a,...c],r=[...a.filter(function(u){switch(u.key){case"organisation":case"reference":case"referenceType":return!1}return!0}),{title:"",key:"data",type:"group",asObject:!0,minimum:1,maximum:1,fields:[...l.definedFields||[]]}]}switch(r=e.$sdk.utils.mapFields(r,{includeArrayDelimeter:!0}),console.log("RECREATED CRITERIA FIELDS",r),s){case"stat":r=[{title:"User",key:"p",minimum:1,maximum:0,type:"reference",referenceType:"persona"},{title:"Reaction",key:"k",minimum:1,maximum:0,type:"string",widget:"select",options:[{title:"Like",value:"_like"},{title:"Dislike",value:"_dislike"},{title:"Upvote",value:"_upvote"},{title:"Downvote",value:"_downvote"},{title:"Subscribe",value:"_subscribe"},{title:"Unsubscribe",value:"_unsubscribe"}]}];break;case"blockout":r=[{title:"Start",key:"startDate",type:"date",minimum:0,maximum:1},{title:"End",key:"endDate",type:"date",minimum:0,maximum:1},{title:"Reason / Title",key:"title",type:"string",minimum:0,maximum:1}];break}e.model.renderer="complex"}else e.model.renderer==="complex"&&(e.model.renderer=void 0);e.criteriaFields=r}}},computed:{glossary(){return this.$glossary.hash},checkCriteriaType(){var r;const e=this.referenceType,n=e?(r=this.glossary[e])==null?void 0:r.definedFields:void 0;return[this.extraCriteria,e,n]},modelKey(){return this.model.key},useTime(){switch(this.model.type){case"date":case"daterange":if(!this.showDateOnly)return!0;break}},singleValueTransformer:{get(){return[this.model.value].filter(Boolean)},set(e){this.model.value=e[0]}},extraCriteria(){return this.field&&this.field.path&&this.field.path.startsWith("join_")&&this.field.path.endsWith(".total")},showSelectOptions(){var e;return!(!this.hasOptions||(e=this.comparator)!=null&&e.freeform)},hasOptions(){return!!(this.field&&this.field.options&&this.field.options.length)},fieldHash(){return this.fields.reduce(function(e,n){return e[n.path||n.key]=n,e},{})},keyOptions(){return this.fields.reduce(function(n,r,i){switch(r.type){case"object":case"group":break;default:let s=r.title,o=r.titles||[r.title];const l=r.path||r.key;switch(l){case"meta.status":s="Status",o=[s];break;case"meta.scopes":s="Scopes",o=[s];break;case"meta.tags":s="Tags",o=[s];break;default:r.filterTitle?s=r.filterTitle:o&&o.length&&(s=o.filter(Boolean).join(" › "));break}if(!r.filterDisabled){const a={title:s,value:l,group:"All"};if(o&&o.length>1){const c=(a.title=o.filter(Boolean).join(" › "))||"";a.group=c.split(" › ")[0]||"All",a.title=c}n.push(a)}break}return n},[])},keyField(){return{minimum:1,maximum:1,options:this.keyOptions,sorted:!0}},field(){return this.fieldHash[this.model.key]},fieldWidget(){var e,n;if((e=this.comparator)!=null&&e.inputWidget)return this.comparator.inputWidget;switch((n=this.field)==null?void 0:n.widget){case"country":case"timezone":case"currency":case"timefield":return this.field.widget}},fieldType(){if(this.field)return this.field.type},inputType(){if(this.comparator){var e=this.comparator.inputType;switch(e){case"none":case"range":case"daterange":case"daterelative":case"integer":case"decimal":case"float":case"number":break;case"array":switch(this.fieldType){case"reference":e="multireference";break}break;default:switch(e="normal",this.fieldType){case"reference":case"boolean":case"date":e=this.fieldType;break;case"integer":case"decimal":case"float":case"number":e="number";break}break}return e}},comparator(){return this.comparatorLookup[this.model.comparator]},comparatorLookup(){return this.comparators.hash},comparatorOptions(){const e=this;if(!e.fieldType)return[];var n=e.comparators.available[e.fieldType]||[],r=n.filter(function(i){return i.restrictKey?i.restrictKey.includes(e.model.key):!(i.multipleOnly&&e.field.maximum===1)}).map(function(i){return{title:i.title,value:i.operator}});return r},comparatorField(){return{minimum:1,maximum:1,options:this.comparatorOptions}},referenceType(){if(this.field)return this.field.referenceType},relativeNumberField(){return{type:"integer",maximum:1,minimum:1,placeholder:"0"}},relativePeriodField(){return{type:"string",maximum:1,minimum:1,widget:"select",options:[{title:"Minutes",value:"minutes"},{title:"Hours",value:"hours"},{title:"Days",value:"days"},{title:"Weeks",value:"weeks"},{title:"Months",value:"months"},{title:"Years",value:"years"}]}},inputPlaceholder(){var e;switch(this.model.comparator){case"valuesgreater":case"valuesgreaterequal":case"valueslesser":case"valueslesserequal":return"0"}return(e=this.field)==null?void 0:e.title},showDateOnly(){var n,r;switch(this.model.comparator){case"dateanniversary":case"anniversarybetween":case"datesameday":case"datesamemonth":case"datesameweek":case"datesameyear":return!0}return(n=this.field)!=null&&n.dateOnly?!0:!((r=this.field)!=null&&r.filterIncludeTime)},dateField(){return{type:this.fieldType,maximum:1,minimum:1,placeholder:this.inputPlaceholder,dateOnly:this.showDateOnly}},multiOptionsField(){return{options:this.field.options,widget:"select",type:this.fieldType,maximum:0,minimum:1,placeholder:this.inputPlaceholder,sorted:!0}},singleOptionsField(){return{title:"",options:this.field.options,widget:"select",type:this.fieldType,maximum:1,minimum:0,placeholder:this.inputPlaceholder,sorted:!0}},normalField(){var r,i;const e={},n={};return n.currency=(r=this.field)==null?void 0:r.currency,n.syntax=(i=this.field)==null?void 0:i.syntax,Object.assign(e,{type:this.fieldType,maximum:1,minimum:1,placeholder:this.inputPlaceholder,widget:this.fieldWidget},n)},arrayField(){var e;return{title:(e=this.field)==null?void 0:e.title,hideTitle:!0,type:this.fieldType,maximum:0,minimum:1}},singleReferenceField(){return{type:"reference",referenceType:this.referenceType,maximum:1,minimum:1,create:!1,list:!1}},multiReferenceField(){return{type:"reference",referenceType:this.referenceType,maximum:0,minimum:1,create:!1,list:!1}}},methods:{addCondition(){this.model.conditions||(this.model.conditions=[]),this.model.conditions.push({_guid:Math.random()})},removeCondition(e){this.model.conditions.splice(e,1)}},components:{TextField:Os,CurrencyField:zm,TimeField:Gm,DateField:Wm,NativeSelect:Ke,ContentSelect:Pm,ScopeSelect:qm,CountrySelect:ds,TimezoneSelect:om}},AS=e=>(t.pushScopeId("data-v-6625b57f"),e=e(),t.popScopeId(),e),LS={key:0,class:"filter-condition"},$S={key:0},PS={key:1},RS={key:2},US={key:3},jS={key:4},qS={key:5},zS={key:6},WS={key:7},HS={key:8},GS={key:9},YS={key:10},JS=AS(()=>t.createElementVNode("label",null,"Where:",-1));function KS(e,n,r,i,s,o){const l=t.resolveComponent("native-select"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("currency-field"),d=t.resolveComponent("timefield"),u=t.resolveComponent("country-select"),m=t.resolveComponent("timezone-select"),f=t.resolveComponent("text-field"),h=t.resolveComponent("time-field"),y=t.resolveComponent("flex-row"),p=t.resolveComponent("date-field"),g=t.resolveComponent("scope-select"),k=t.resolveComponent("content-select"),x=t.resolveComponent("ux-switch"),S=t.resolveComponent("ux-icon"),A=t.resolveComponent("ux-button"),R=t.resolveComponent("filter-condition",!0);return s.comparators?(t.openBlock(),t.createElementBlock("div",LS,[t.createVNode(y,{gap:"",vcenter:""},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(l,{title:"Select field",modelValue:s.model.key,"onUpdate:modelValue":n[0]||(n[0]=C=>s.model.key=C),field:o.keyField},null,8,["modelValue","field"])]),_:1}),s.model.key?(t.openBlock(),t.createBlock(a,{key:0},{default:t.withCtx(()=>[t.createVNode(l,{title:"Select comparator",modelValue:s.model.comparator,"onUpdate:modelValue":n[1]||(n[1]=C=>s.model.comparator=C),field:o.comparatorField},null,8,["modelValue","field"])]),_:1})):t.createCommentVNode("",!0),s.model.key&&s.model.comparator?(t.openBlock(),t.createBlock(a,{key:1},{default:t.withCtx(()=>[o.inputType=="array"?(t.openBlock(),t.createElementBlock("div",$S,[o.showSelectOptions?(t.openBlock(),t.createBlock(l,{key:0,modelValue:s.model.values,"onUpdate:modelValue":n[2]||(n[2]=C=>s.model.values=C),field:o.multiOptionsField},null,8,["modelValue","field"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[o.fieldWidget=="currency"?(t.openBlock(),t.createBlock(c,{key:0,field:o.arrayField,modelValue:s.model.values,"onUpdate:modelValue":n[3]||(n[3]=C=>s.model.values=C)},null,8,["field","modelValue"])):o.fieldWidget=="timefield"?(t.openBlock(),t.createBlock(d,{key:1,field:o.arrayField,modelValue:s.model.values,"onUpdate:modelValue":n[4]||(n[4]=C=>s.model.values=C)},null,8,["field","modelValue"])):o.fieldWidget=="country"?(t.openBlock(),t.createBlock(u,{key:2,field:o.arrayField,modelValue:s.model.values,"onUpdate:modelValue":n[5]||(n[5]=C=>s.model.values=C)},null,8,["field","modelValue"])):o.fieldWidget=="timezone"?(t.openBlock(),t.createBlock(m,{key:3,field:o.arrayField,modelValue:s.model.values,"onUpdate:modelValue":n[6]||(n[6]=C=>s.model.values=C)},null,8,["field","modelValue"])):(t.openBlock(),t.createBlock(f,{key:4,field:o.arrayField,modelValue:s.model.values,"onUpdate:modelValue":n[7]||(n[7]=C=>s.model.values=C)},null,8,["field","modelValue"]))],64))])):t.createCommentVNode("",!0),o.inputType=="range"?(t.openBlock(),t.createElementBlock("div",PS,[o.fieldWidget=="currency"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(c,{field:o.normalField,modelValue:s.model.value,"onUpdate:modelValue":n[8]||(n[8]=C=>s.model.value=C)},null,8,["field","modelValue"]),t.createTextVNode(" And "),t.createVNode(c,{field:o.normalField,modelValue:s.model.value2,"onUpdate:modelValue":n[9]||(n[9]=C=>s.model.value2=C)},null,8,["field","modelValue"])],64)):o.fieldWidget=="timefield"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(h,{field:o.normalField,modelValue:s.model.value,"onUpdate:modelValue":n[10]||(n[10]=C=>s.model.value=C)},null,8,["field","modelValue"]),t.createTextVNode(" And "),t.createVNode(h,{field:o.normalField,modelValue:s.model.value2,"onUpdate:modelValue":n[11]||(n[11]=C=>s.model.value2=C)},null,8,["field","modelValue"])],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createVNode(f,{field:o.normalField,modelValue:s.model.value,"onUpdate:modelValue":n[12]||(n[12]=C=>s.model.value=C)},null,8,["field","modelValue"]),t.createTextVNode(" And "),t.createVNode(f,{field:o.normalField,modelValue:s.model.value2,"onUpdate:modelValue":n[13]||(n[13]=C=>s.model.value2=C)},null,8,["field","modelValue"])],64))])):t.createCommentVNode("",!0),o.inputType=="daterelative"?(t.openBlock(),t.createElementBlock("div",RS,[t.createVNode(y,null,{default:t.withCtx(()=>[t.createVNode(a,{style:{width:"80px"}},{default:t.withCtx(()=>[t.createVNode(f,{field:o.relativeNumberField,modelValue:s.model.value,"onUpdate:modelValue":n[14]||(n[14]=C=>s.model.value=C)},null,8,["field","modelValue"])]),_:1}),t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(l,{modelValue:s.model.value2,"onUpdate:modelValue":n[15]||(n[15]=C=>s.model.value2=C),field:o.relativePeriodField},null,8,["modelValue","field"])]),_:1})]),_:1})])):t.createCommentVNode("",!0),o.inputType=="daterange"?(t.openBlock(),t.createElementBlock("div",US,[t.createVNode(p,{disableTime:o.showDateOnly,field:o.dateField,modelValue:s.model.value,"onUpdate:modelValue":n[16]||(n[16]=C=>s.model.value=C)},null,8,["disableTime","field","modelValue"]),t.createTextVNode(" And "),t.createVNode(p,{disableTime:o.showDateOnly,field:o.dateField,modelValue:s.model.value2,"onUpdate:modelValue":n[17]||(n[17]=C=>s.model.value2=C)},null,8,["disableTime","field","modelValue"])])):t.createCommentVNode("",!0),o.inputType=="date"?(t.openBlock(),t.createElementBlock("div",jS,[t.createVNode(p,{disableTime:o.showDateOnly,field:o.dateField,modelValue:s.model.value,"onUpdate:modelValue":n[18]||(n[18]=C=>s.model.value=C)},null,8,["disableTime","field","modelValue"])])):t.createCommentVNode("",!0),o.inputType=="reference"?(t.openBlock(),t.createElementBlock("div",qS,[s.model.key==="meta.scopes"?(t.openBlock(),t.createBlock(g,{key:0,maximum:1,modelValue:o.singleValueTransformer,"onUpdate:modelValue":n[19]||(n[19]=C=>o.singleValueTransformer=C)},null,8,["modelValue"])):(t.openBlock(),t.createBlock(k,{key:1,field:o.singleReferenceField,modelValue:s.model.value,"onUpdate:modelValue":n[20]||(n[20]=C=>s.model.value=C)},null,8,["field","modelValue"]))])):t.createCommentVNode("",!0),o.inputType=="multireference"?(t.openBlock(),t.createElementBlock("div",zS,[s.model.key==="meta.scopes"?(t.openBlock(),t.createBlock(g,{key:0,modelValue:s.model.values,"onUpdate:modelValue":n[21]||(n[21]=C=>s.model.values=C)},null,8,["modelValue"])):(t.openBlock(),t.createBlock(k,{key:1,field:o.multiReferenceField,modelValue:s.model.values,"onUpdate:modelValue":n[22]||(n[22]=C=>s.model.values=C)},null,8,["field","modelValue"]))])):t.createCommentVNode("",!0),o.inputType=="boolean"?(t.openBlock(),t.createElementBlock("div",WS,[t.createVNode(y,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(a,{shrink:""},{default:t.withCtx(()=>[t.createVNode(x,{onClick:n[23]||(n[23]=C=>s.model.value=!s.model.value),value:s.model.value},null,8,["value"])]),_:1}),t.createVNode(a,null,{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(s.model.value?"True":"False"),1)]),_:1})]),_:1})])):t.createCommentVNode("",!0),o.inputType=="none"?(t.openBlock(),t.createElementBlock("div",HS)):t.createCommentVNode("",!0),o.inputType=="number"?(t.openBlock(),t.createElementBlock("div",GS,[o.fieldWidget=="currency"?(t.openBlock(),t.createBlock(c,{key:0,field:o.normalField,modelValue:s.model.value,"onUpdate:modelValue":n[24]||(n[24]=C=>s.model.value=C)},null,8,["field","modelValue"])):o.fieldWidget=="timefield"?(t.openBlock(),t.createBlock(h,{key:1,field:o.normalField,modelValue:s.model.value,"onUpdate:modelValue":n[25]||(n[25]=C=>s.model.value=C)},null,8,["field","modelValue"])):(t.openBlock(),t.createBlock(f,{key:2,field:o.normalField,modelValue:s.model.value,"onUpdate:modelValue":n[26]||(n[26]=C=>s.model.value=C)},null,8,["field","modelValue"]))])):t.createCommentVNode("",!0),o.inputType=="normal"?(t.openBlock(),t.createElementBlock("div",YS,[o.showSelectOptions?(t.openBlock(),t.createBlock(l,{key:0,modelValue:s.model.value,"onUpdate:modelValue":n[27]||(n[27]=C=>s.model.value=C),field:o.singleOptionsField},null,8,["modelValue","field"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[o.fieldWidget=="country"?(t.openBlock(),t.createBlock(u,{key:0,field:o.normalField,modelValue:s.model.value,"onUpdate:modelValue":n[28]||(n[28]=C=>s.model.value=C)},null,8,["field","modelValue"])):o.fieldWidget=="timezone"?(t.openBlock(),t.createBlock(m,{key:1,field:o.normalField,modelValue:s.model.value,"onUpdate:modelValue":n[29]||(n[29]=C=>s.model.value=C)},null,8,["field","modelValue"])):(t.openBlock(),t.createBlock(f,{key:2,field:o.normalField,modelValue:s.model.value,"onUpdate:modelValue":n[30]||(n[30]=C=>s.model.value=C)},null,8,["field","modelValue"]))],64))])):t.createCommentVNode("",!0)]),_:1})):t.createCommentVNode("",!0),r.enableRemove?(t.openBlock(),t.createBlock(a,{key:2,shrink:""},{default:t.withCtx(()=>[t.createVNode(A,{size:"sm",icon:"",onClick:n[31]||(n[31]=C=>e.$emit("remove"))},{default:t.withCtx(()=>[t.createVNode(S,{icon:"fa-times"})]),_:1})]),_:1})):t.createCommentVNode("",!0)]),_:1}),o.extraCriteria?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[JS,(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.model.conditions,(C,D)=>(t.openBlock(),t.createElementBlock("div",{key:C._guid},[t.createVNode(R,{enableRemove:!0,fields:s.criteriaFields,onRemove:I=>o.removeCondition(D),modelValue:s.model.conditions[D],"onUpdate:modelValue":I=>s.model.conditions[D]=I},null,8,["fields","onRemove","modelValue","onUpdate:modelValue"])]))),128)),t.createVNode(A,{size:"sm",onClick:t.withModifiers(o.addCondition,["stop","prevent"])},{default:t.withCtx(()=>[t.createTextVNode(" Add Criteria "),t.createVNode(S,{icon:"fa-plus",right:""})]),_:1},8,["onClick"])],64)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)}const ZS=w(IS,[["render",KS],["__scopeId","data-v-6625b57f"]]);function XS(e,n){let r=[];if(n.length){var i={title:"Form Data",minimum:1,maximum:1,key:"formData",asObject:!0,type:"group",fields:n};r.push(i);var s={title:"Data",minimum:1,maximum:1,key:"data",asObject:!0,type:"group",fields:n.map(function(l){return l.type==="reference"&&(l=JSON.parse(JSON.stringify(l)),delete l.fields),l})};r.push(s)}return r}function QS(e,n){if(!e.glossary)return;const r=Object.entries(e.glossary).reduce(function(o,[l,a]){return a.definesType==="workflowcard"&&a.key!=e.definition.key&&o.push(a),o},[]);if((e.definition.definesType||e.definition.key)==="workflowcard")return;const s={title:"Workflow",minimum:1,maximum:1,key:"join_workflow",asObject:!0,type:"group",fields:[]};(r||[]).forEach(function(o){[...(o.fields||[]).map(function(a){let c;switch(a.key){case"step":case"due":c=a;break;case"meta":c=JSON.parse(JSON.stringify(a)),c.fields=c.fields.filter(function({key:d}){switch(d){case"status":case"scopes":case"tags":case"updated":case"created":case"status":return!0}});break}return c}).filter(Boolean),o.definedFields],s.fields.push({title:`${o.title}`,minimum:1,maximum:1,key:o.key,asObject:!0,type:"group",fields:[{title:"Cards",minimum:1,maximum:1,key:"total",type:"integer",referenceType:o.key}]})}),n.push(s)}function vS(e,n){if(!e.glossary)return;const r=Object.entries(e.glossary).reduce(function(s,[o,l]){return(l.definesType==="comment"||l.key==="comment")&&s.push(l),s},[]);if(!r.length)return;const i={title:"Comments",minimum:1,maximum:1,key:"join_comment",asObject:!0,type:"group",fields:[]};r.forEach(function(s){[...(s.fields||[]).map(function(l){let a;switch(l.key){case"reference":case"referenceType":case"organisation":return!1;case"meta":a=JSON.parse(JSON.stringify(l)),a.fields=a.fields.filter(function({key:c}){switch(c){case"status":case"scopes":case"tags":case"updated":case"created":return!0}});break}return a}).filter(Boolean),s.definedFields],i.fields.push({title:`${s.plural}`,minimum:1,maximum:1,key:s.key,asObject:!0,type:"group",fields:[{title:"Total",minimum:1,maximum:1,key:"total",type:"integer",referenceType:s.key}]})}),n.push(i)}function eT(e,n){const r={title:"Reactions",minimum:1,maximum:1,key:"join_stats",asObject:!0,type:"group",fields:[{title:"All",minimum:1,maximum:1,key:"total",type:"integer",referenceType:"stat"}]};n.push(r)}function tT(e,n){const r=["Like","Dislike","Upvote","Downvote","Subscribe","Unsubscribe"].map(function(o){return{title:`${o}s`,key:`_${o.toLowerCase()}`}}),i={title:"Reactions",minimum:1,maximum:1,key:"meta.stats",asObject:!0,type:"group",fields:[]};r.forEach(function({title:o,key:l}){i.fields.push({title:`All ${o}`,minimum:1,maximum:1,key:l,type:"integer"})}),n.push(i);const s={title:"Reactions",minimum:1,maximum:1,key:"_stat",asObject:!0,type:"group",fields:[]};r.forEach(function({title:o,key:l}){s.fields.push({title:`Your ${o}`,minimum:1,maximum:1,key:l,type:"integer"})}),n.push(s)}function nT(e,n){if(!e.glossary)return;const r=Object.entries(e.glossary).reduce(function(i,[s,o]){return o.definesType==="scope"&&o.key!=e.definition.key&&i.push(o),i},[]);r.length&&r.forEach(function(i){n.push({title:`${i.plural}`,minimum:0,maximum:0,key:`meta.scopes|${i.key}`,type:"reference",referenceType:i.key})})}function rT(e,n){if(!e.glossary)return;const r=Object.entries(e.glossary).reduce(function(i,[s,o]){return o.definesType==="tag"&&o.key!=e.definition.key&&i.push(o),i},[]);r.length&&r.forEach(function(i){n.push({title:`${i.plural}`,minimum:0,maximum:0,key:`meta.tags|${i.key}`,type:"reference",referenceType:i.key})})}function oT(e){let n=[];return QS(e,n),vS(e,n),nT(e,n),rT(e,n),tT(e,n),eT(e,n),n}const iT={emits:["remove"],props:{enableRemove:{type:Boolean},definition:{type:Object,required:!0,default(){return{}}},modelValue:{type:Object,default(){return{operator:"and",filters:[]}}}},methods:{isType(e){const n=this;return n.definition.definesType===e||n.definition.key===e},addCondition(){const e=this;e.model.filters.push({guid:e.$sdk.utils.guid()})},removeCondition(e){this.model.filters.splice(e,1)}},data(){return this.modelValue.operator||(this.modelValue.operator="and"),this.modelValue.filters||(this.modelValue.filters=[]),{model:JSON.parse(JSON.stringify(this.modelValue))}},created(){this.$glossary.ensure()},watch:{modelValue(e){e!=this.model&&(this.model=e)},model:{handler:Tn(function(e){this.$emit("update:modelValue",e)},200),deep:!0}},computed:{glossary(){return this.$glossary.hash},summary(){switch(this.model.operator){case"or":return"any";case"nor":return"none";default:return"all"}},fields(){const e=this;var n=e.definition&&e.definition.fields?[...e.definition.fields]:[],r=e.definition&&e.definition.definedFields?e.definition.definedFields:[];n=[...n,...oT(e)];const i=e.definition.definesType==="submission";if(e.isType("profile")){const l=FS(e);n=[...n,...l]}if(e.isType("checkin")){const l=af(e);n=[...n,...l]}if(e.isType("assignment")){const l=cf(e);n=[...n,...l]}if(r.length)if(i){const l=XS(e,r);n=[...n,...l]}else{var s={title:`${e.definition.title}`,minimum:1,maximum:1,key:"data",asObject:!0,type:"group",fields:r};n.push(s)}var o=e.$sdk.utils.mapFields(n,{includeArrayDelimeter:!0});return o},operatorField(){return{minimum:1,maximum:1,options:[{title:"All",value:"and"},{title:"Any",value:"or"},{title:"None",value:"nor"}]}}},components:{FilterCondition:ZS,NativeSelect:Ke}},sT=e=>(t.pushScopeId("data-v-497fdd88"),e=e(),t.popScopeId(),e),lT={key:0,class:"filter-rule"},aT={class:"top"},cT={class:"summary"},dT=sT(()=>t.createElementVNode("span",{class:"line"},null,-1)),uT={class:"operator"};function mT(e,n,r,i,s,o){const l=t.resolveComponent("native-select"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-icon"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row"),m=t.resolveComponent("filter-condition");return r.definition?(t.openBlock(),t.createElementBlock("div",lT,[t.createElementVNode("div",aT,[t.createVNode(u,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createElementVNode("div",cT,[t.createTextVNode(" Match "),t.createVNode(l,{modelValue:s.model.operator,"onUpdate:modelValue":n[0]||(n[0]=f=>s.model.operator=f),field:o.operatorField},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.summary),1)]),_:1},8,["modelValue","field"]),t.createTextVNode(" of the following conditions ")])]),_:1}),r.enableRemove?(t.openBlock(),t.createBlock(a,{key:0,onClick:n[1]||(n[1]=f=>e.$emit("remove")),shrink:""},{default:t.withCtx(()=>[t.createVNode(d,{size:"sm",icon:""},{default:t.withCtx(()=>[t.createVNode(c,{icon:"fa-trash"})]),_:1})]),_:1})):t.createCommentVNode("",!0)]),_:1})]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.model.filters,(f,h)=>(t.openBlock(),t.createBlock(u,{key:`condition-${h}-${f._guid}`},{default:t.withCtx(()=>[h!=0?(t.openBlock(),t.createBlock(a,{key:0,class:t.normalizeClass(["operator-cell",[s.model.operator,{last:h==s.model.filters.length}]]),vcenter:"",shrink:""},{default:t.withCtx(()=>[dT,t.createElementVNode("div",uT,t.toDisplayString(s.model.operator),1)]),_:2},1032,["class"])):t.createCommentVNode("",!0),t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(m,{enableRemove:s.model.filters.length>1,fields:o.fields,onRemove:y=>o.removeCondition(h),modelValue:s.model.filters[h],"onUpdate:modelValue":y=>s.model.filters[h]=y},null,8,["enableRemove","fields","onRemove","modelValue","onUpdate:modelValue"])]),_:2},1024)]),_:2},1024))),128)),t.createVNode(d,{size:"sm",onClick:o.addCondition},{default:t.withCtx(()=>[t.createTextVNode(" Add Condition "),t.createVNode(c,{icon:"fa-plus",right:""})]),_:1},8,["onClick"])])):t.createCommentVNode("",!0)}const fT={components:{FilterRule:w(iT,[["render",mT],["__scopeId","data-v-497fdd88"]]),NativeSelect:Ke},methods:{removeRule(e){this.model.filters&&this.model.filters.splice(e,1)},addRule(){const e=this;e.model.filters||(e.model.filters=[]),e.model.operator||(e.model.operator="and"),e.model.filters.push({guid:e.$sdk.utils.guid(),operator:"and",filters:[{}]})}},computed:{summary(){switch(this.model.operator){case"or":return"any";case"nor":return"none";default:return"all"}},operatorField(){return{minimum:1,maximum:1,options:[{title:"All",value:"and"},{title:"Any",value:"or"},{title:"None",value:"nor"}]}}},watch:{modelValue:{handler(e){var n=JSON.stringify(this.model),r=JSON.stringify(e);if(n!=r){var i=JSON.parse(r);this.model=i}},immediate:!0},model:{handler:Tn(function(e){e=JSON.parse(JSON.stringify(e)),this.$emit("update:modelValue",e)},100),deep:!0,immediate:!0}},props:{definition:{type:Object,required:!0},modelValue:{type:Object,default(){return{operator:"and",filters:[{operator:"and",filters:[]}]}}}},data(){return{model:JSON.parse(JSON.stringify(this.modelValue))}}},hT={class:"filters"},pT={key:0,class:"top"},yT={class:"summary"};function gT(e,n,r,i,s,o){const l=t.resolveComponent("native-select"),a=t.resolveComponent("filter-rule"),c=t.resolveComponent("ux-button"),d=t.resolveComponent("flex-body"),u=t.resolveComponent("flex-column");return t.openBlock(),t.createBlock(u,{class:"filter-builder"},{default:t.withCtx(()=>[t.createVNode(d,null,{default:t.withCtx(()=>[t.createElementVNode("div",hT,[s.model&&s.model.filters&&s.model.filters.length>1?(t.openBlock(),t.createElementBlock("div",pT,[t.createElementVNode("div",yT,[t.createTextVNode(" Match "),t.createVNode(l,{modelValue:s.model.operator,"onUpdate:modelValue":n[0]||(n[0]=m=>s.model.operator=m),field:o.operatorField},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.summary),1)]),_:1},8,["modelValue","field"]),t.createTextVNode(" of the following rules ")])])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.model.filters,(m,f)=>(t.openBlock(),t.createBlock(a,{enableRemove:"",key:`rule-${f}-${m.guid}`,onRemove:h=>o.removeRule(f),definition:r.definition,modelValue:s.model.filters[f],"onUpdate:modelValue":h=>s.model.filters[f]=h,index:f},null,8,["onRemove","definition","modelValue","onUpdate:modelValue","index"]))),128)),t.createVNode(c,{size:"sm",onClick:n[1]||(n[1]=m=>o.addRule())},{default:t.withCtx(()=>[t.createTextVNode("Add Filter Rule")]),_:1})])]),_:1})]),_:1})}const df=w(fT,[["render",gT],["__scopeId","data-v-6c52f8af"]]),kT={mixins:[z],components:{FilterBuilder:df},props:{modelValue:{type:Object}},data(){return{definition:null}},watch:{"field.referenceType":{handler:async function(e){if(!e)return this.definition=null;await this.$glossary.ensure(e),this.definition=this.$glossary.hash[e]},immediate:!0}},computed:{definitionTitle(){const e=this.definition?this.definition.title:"";return(this.definition?this.definition.plural:"")||e}},methods:{getNewDefaultEntry(){return{operator:"and",filters:[]}}}},_T={key:0,class:"ux-field-title"},wT={key:0,class:"ux-required-marker"},xT={key:1,class:"ux-field-description"},bT={key:2};function CT(e,n,r,i,s,o){const l=t.resolveComponent("filter-builder"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-icon"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",_T,[t.createTextVNode(t.toDisplayString(e.label)+" ("+t.toDisplayString(o.definitionTitle)+") ",1),e.required?(t.openBlock(),t.createElementBlock("span",wT,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",xT,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",bT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.model,(m,f)=>(t.openBlock(),t.createBlock(u,{class:"ux-text-row",key:f},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(l,{definition:s.definition,modelValue:e.model[f],"onUpdate:modelValue":h=>e.model[f]=h},null,8,["definition","modelValue","onUpdate:modelValue"])]),_:2},1024),t.createVNode(a,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(d,{key:0,tag:"a",icon:"",onClick:h=>e.remove(m)},{default:t.withCtx(()=>[t.createVNode(c,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(d,{key:0,size:"sm",onClick:n[0]||(n[0]=m=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createBlock(l,{key:3,definition:s.definition,modelValue:e.model,"onUpdate:modelValue":n[1]||(n[1]=m=>e.model=m)},null,8,["definition","modelValue"]))],64)}const VT=w(kT,[["render",CT],["__scopeId","data-v-5ca20810"]]),NT={components:{},methods:{injectToken(e){const n=this.$refs.editor;n&&n.inject(e)},focussed(){const e=this;e.timer&&(clearTimeout(e.timer),e.timer=null)},blurred(){const e=this;e.timer=setTimeout(function(){e.format()},100)},format(){if(typeof window!==void 0){var e=this.model;if(e){switch(this.lang){case"js":case"javascript":window.js_beautify&&(e=window.js_beautify(e));break;case"json":try{const n=JSON.parse(e);e=JSON.stringify(n,null,4)}catch(n){console.error("Unable to format invalid JSON string:",n)}break;case"css":case"scss":window.css_beautify&&(e=window.css_beautify(e));break;case"html":window.html_beautify&&(e=window.html_beautify(e));break;default:return}this.model=e}}}},props:{modelValue:{type:String,default(){return""}},tokens:{type:Array,default(){return[]}},lang:{type:String},readonly:{type:Boolean},singleLine:{type:Boolean}},watch:{modelValue(e){this.model=e},model(e){this.$emit("update:modelValue",e)},async formatReady(){if(this.mounted&&!(!this.$sdk.global||!this.$sdk.global.injectScript))switch(this.lang){case"js":case"javascript":await this.$sdk.global.injectScript("https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.5/beautify.min.js");break;case"css":case"scss":await this.$sdk.global.injectScript("https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.5/beautify-css.min.js");break;case"html":await this.$sdk.global.injectScript("https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.5/beautify-html.min.js");break}}},unmounted(){this.editor=null},mounted(){this.mounted=!0},computed:{formatReady(){return`${this.mounted}-${this.lang}`}},data(){return{showTokens:!1,timer:null,mounted:!1,model:this.modelValue,editor:null,selectionContext:{}}}},ET={key:0,class:"tokens"},BT={key:0,class:"tokens-body"};function ST(e,n,r,i,s,o){const l=t.resolveComponent("flex-cell"),a=t.resolveComponent("ux-icon"),c=t.resolveComponent("flex-row"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("qik-code-editor"),m=t.resolveComponent("flex-column");return s.mounted?(t.openBlock(),t.createBlock(m,{key:0,class:"ux-code-editor"},{default:t.withCtx(()=>[r.tokens.length?(t.openBlock(),t.createElementBlock("div",ET,[t.createElementVNode("div",{class:"tokens-header",onClick:n[0]||(n[0]=f=>s.showTokens=!s.showTokens)},[t.createVNode(c,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(s.showTokens?"Hide":"Show")+" Tokens ",1)]),_:1}),t.createVNode(l,{shrink:""},{default:t.withCtx(()=>[t.createVNode(a,{icon:s.showTokens?"fa-angle-up":"fa-angle-right"},null,8,["icon"])]),_:1})]),_:1})]),s.showTokens?(t.openBlock(),t.createElementBlock("div",BT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.tokens,f=>(t.openBlock(),t.createBlock(d,{size:"xs",onClick:t.withModifiers(h=>o.injectToken(f.value),["stop","prevent"])},{default:t.withCtx(()=>[t.createVNode(a,{icon:"fa-asterisk"}),t.createTextVNode(" "+t.toDisplayString(f.title),1)]),_:2},1032,["onClick"]))),256))])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createVNode(u,{ref:"editor",syntax:r.lang,onBlur:o.blurred,onFocus:o.focussed,readonly:r.readonly,singleLine:r.singleLine,class:"editor-wrap",modelValue:s.model,"onUpdate:modelValue":n[1]||(n[1]=f=>s.model=f),style:{height:"300px"}},null,8,["syntax","onBlur","onFocus","readonly","singleLine","modelValue"])]),_:1})):t.createCommentVNode("",!0)}const js=w(NT,[["render",ST],["__scopeId","data-v-a1601d1d"]]);function TT(e){return e===void 0||typeof e>"u"||e===null||String(e)==="null"||String(e)==="undefined"}const DT={props:{title:{type:String},modelValue:{}},components:{NativeSelect:Ke,CodeEditor:js},mixins:[z],async created(){this.model=this.model},watch:{referenceType:{async handler(e){const n=this;await this.$glossary.ensure(e),n.definition=this.$glossary.hash[e]},immediate:!0}},data(){return{types:[],definition:null,customKey:!1}},methods:{toggleCustomKey(){this.customKey=!this.customKey},cleanOutput(e){var n=this;return TT(e)?n.multiValue?e=[]:e=void 0:n.multiValue?e=(e||[]).filter(Boolean).map(function(r){return n.getValue(r)}):e=n.getValue(e),e},cleanInput(e){var n=this;if(n.multiValue)e||(e=[]),Array.isArray(e)||(e=[e]),n.maximum&&e.length>n.maximum&&(e.length=n.maximum),e=e.filter(Boolean).map(function(i){var s=n.getValue(i);return n.returnObject?n.optionLookup[s]:s});else{var r=n.getValue(e);e=n.returnObject?n.optionLookup[r]:r}return e}},computed:{actualField(){const e={...this.field,options:this.selectableOptions};return delete e.title,delete e.description,e},showNoneOption(){return this.singleValue&&!this.minimum?this.selectableOptions.find(function(r){return r.none})?(console.log("has custom none option"),!1):!0:!1},fields(){var d;const e=this,n=e.definition,r=(d=e.field)==null?void 0:d.contextDefinition;if(!n)return[];if(e.$sdk.utils.getAllFields)return e.$sdk.utils.getAllFields(n);const i=n.definesType==="submission";var s=[...n.fields],o=r?r.fields:n.definedFields||[];if(o.length)if(i){var l={title:"Form Data",minimum:1,maximum:1,key:"formData",asObject:!0,type:"group",fields:o};s.push(l);var a={title:"Data",minimum:1,maximum:1,key:"data",asObject:!0,type:"group",fields:o.map(function(m){return m.type==="reference"&&(m=JSON.parse(JSON.stringify(m)),delete m.fields),m})};s.push(a)}else{var a={title:`${n.title}`,minimum:1,maximum:1,key:"data",asObject:!0,type:"group",fields:o};s.push(a)}var c=e.$sdk.utils.mapFields(s).filter(function(u){if(u.trail[0]==="fields")return!1;var m=u.type=="group"&&u.asObject&&u.minimum==1&&u.maximum==1;return!m}).map(function(u){return u.title=u.titles.join(" › "),u}).sort(function(u,m){return u.title<m.title?-1:1});return c},fieldOptions(){return this.fields.map(function(n){return{title:n.title,value:n.path,none:n.none}})},referenceType(){return this.field.referenceType},returnObject(){return!1},classes(){var e=[];return this.multiValue?e.push("multiple"):e.push("single"),e},optionLookup(){var e=this;return e.fieldOptions.reduce(function(n,r){const i=e.getValue(r);return n[i]=r,n},{})},summary(){const e=this.getLabel(this.optionLookup[this.model])||this.model;return this.model?e:this.title||"Click to select"},selectableOptions(){return this.fieldOptions}}},OT={key:0,class:"ux-field-title"},MT={key:0,class:"ux-required-marker"},FT={key:1,class:"ux-field-description"},IT={class:"ui-select-button"},AT={key:0,value:""},LT=["value"];function $T(e,n,r,i,s,o){const l=t.resolveComponent("code-editor"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-button"),d=t.resolveComponent("ux-icon"),u=t.resolveComponent("flex-row"),m=t.resolveComponent("native-select");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["native-select",o.classes])},[e.showLabel?(t.openBlock(),t.createElementBlock("label",OT,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",MT,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",FT,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.singleValue?(t.openBlock(),t.createBlock(u,{key:2,gap:"",center:""},{default:t.withCtx(()=>[s.customKey?(t.openBlock(),t.createBlock(a,{key:0},{default:t.withCtx(()=>[t.createVNode(l,{singleLine:"",class:"ux-code-editor ux-field-focus ux-text-area-single",onFocus:e.touch,modelValue:e.model,"onUpdate:modelValue":n[0]||(n[0]=f=>e.model=f)},null,8,["onFocus","modelValue"])]),_:1})):(t.openBlock(),t.createBlock(a,{key:1},{default:t.withCtx(()=>[t.createElementVNode("div",null,[t.createElementVNode("div",IT,[t.renderSlot(e.$slots,"default",{},()=>[t.createVNode(c,{tag:"div"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.summary),1)]),_:1})],!0)]),t.withDirectives(t.createElementVNode("select",{onFocus:n[1]||(n[1]=(...f)=>e.touch&&e.touch(...f)),"onUpdate:modelValue":n[2]||(n[2]=f=>e.model=f)},[o.showNoneOption?(t.openBlock(),t.createElementBlock("option",AT,"None")):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.selectableOptions,f=>(t.openBlock(),t.createElementBlock("option",{value:f.value},t.toDisplayString(f.title),9,LT))),256))],544),[[t.vModelSelect,e.model]])])]),_:3})),t.createVNode(a,{shrink:""},{default:t.withCtx(()=>[t.createVNode(c,{icon:"",size:"sm",onClick:o.toggleCustomKey},{default:t.withCtx(()=>[t.createVNode(d,{icon:s.customKey?"far fa-hand-pointer":"far fa-pen-to-square"},null,8,["icon"])]),_:1},8,["onClick"])]),_:1})]),_:3})):(t.openBlock(),t.createBlock(m,{key:3,pills:"",onTouched:e.touch,field:o.actualField,modelValue:e.model,"onUpdate:modelValue":n[3]||(n[3]=f=>e.model=f)},null,8,["onTouched","field","modelValue"]))],2)}const uf=w(DT,[["render",$T],["__scopeId","data-v-7a914d2a"]]);function PT(e,n,r){return e+(n-e)*(r/100)}const RT={props:{modelValue:{type:Number},min:{type:Number,default:0},step:{type:Number,default:1},max:{type:Number,default:100},prefix:{type:String,default:""},suffix:{type:String,default:""}},data(){return{model:this.modelValue}},watch:{model(e,n){this.$emit("update:modelValue",Number(e))}},mounted(){this.attachListeners()},beforeUnmount(){this.detachListeners()},methods:{inputReceived(e){const n=this,r=n.$refs.range,i=n.$refs.bubble,s=r.value,o=r.min?r.min:0,l=r.max?r.max:100;let a=Number((s-o)*100/(l-o));a=PT(1,99,a),i.innerHTML=`${n.prefix}${s}${n.suffix}`,i.style.left=`${a}%`},attachListeners(){const e=this,n=e.$refs.range;e.$refs.bubble,n.addEventListener("input",e.inputReceived)},detachListeners(){const e=this,n=e.$refs.range;e.$refs.bubble,n.addEventListener("input",e.inputReceived)}}},UT={class:"ux-range-slider-wrap"},jT=["min","step","max"],qT={ref:"bubble",class:"ux-range-bubble"};function zT(e,n,r,i,s,o){return t.openBlock(),t.createElementBlock("div",UT,[t.withDirectives(t.createElementVNode("input",{ref:"range",min:r.min,step:r.step,max:r.max,"onUpdate:modelValue":n[0]||(n[0]=l=>s.model=l),type:"range",class:"ux-range-slider"},null,8,jT),[[t.vModelText,s.model]]),t.createElementVNode("output",qT,null,512)])}const WT={components:{RangeSlider:w(RT,[["render",zT],["__scopeId","data-v-639c59a6"]])},props:{modelValue:{type:[String,Array]}},computed:{sliderPrefix(){return this.field.prefix||""},sliderSuffix(){return this.field.suffix||""},sliderStepValue(){return parseFloat(this.field.stepValue)||1},minSliderValue(){return parseFloat(this.field.minValue)||0},maxSliderValue(){return parseFloat(this.field.maxValue)||100}},mixins:[z],methods:{getNewDefaultEntry(){return""}}},HT={key:0,class:"ux-field-title"},GT={key:0,class:"ux-required-marker"},YT={key:1,class:"ux-field-description"},JT={key:2},KT={class:"ux-slider-limit ux-slider-limit-value"},ZT={class:"ux-slider-limit ux-slider-limit-value"};function XT(e,n,r,i,s,o){const l=t.resolveComponent("range-slider"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("flex-row"),d=t.resolveComponent("ux-icon"),u=t.resolveComponent("ux-button");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",HT,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",GT,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",YT,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",JT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.model,(m,f)=>(t.openBlock(),t.createBlock(c,{class:"ux-slider-row",key:f},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(c,{center:"",gap:""},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(l,{type:"range",min:o.minSliderValue,step:o.sliderStepValue,prefix:o.sliderPrefix,suffix:o.sliderSuffix,max:o.maxSliderValue,modelValue:e.model[f],"onUpdate:modelValue":h=>e.model[f]=h,class:"ux-slider"},null,8,["min","step","prefix","suffix","max","modelValue","onUpdate:modelValue"])]),_:2},1024),t.createVNode(a,{shrink:""},{default:t.withCtx(()=>[t.createElementVNode("span",KT,t.toDisplayString(o.sliderPrefix)+t.toDisplayString(e.model[f])+t.toDisplayString(o.sliderSuffix),1)]),_:2},1024)]),_:2},1024)]),_:2},1024),t.createVNode(a,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(u,{key:0,tag:"a",icon:"",onClick:h=>e.remove(m)},{default:t.withCtx(()=>[t.createVNode(d,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(u,{key:0,onClick:n[0]||(n[0]=m=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createBlock(c,{key:3,center:"",gap:""},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(l,{type:"range",min:o.minSliderValue,step:o.sliderStepValue,prefix:o.sliderPrefix,suffix:o.sliderSuffix,max:o.maxSliderValue,modelValue:e.model,"onUpdate:modelValue":n[1]||(n[1]=m=>e.model=m),class:"ux-slider"},null,8,["min","step","prefix","suffix","max","modelValue"])]),_:1}),t.createVNode(a,{shrink:""},{default:t.withCtx(()=>[t.createElementVNode("span",ZT,t.toDisplayString(o.sliderPrefix)+t.toDisplayString(e.model)+t.toDisplayString(o.sliderSuffix),1)]),_:1})]),_:1}))],64)}const QT=w(WT,[["render",XT],["__scopeId","data-v-ae8ff721"]]),vT={props:{modelValue:{type:String}},mixins:[z],methods:{cleanInputValue(e){return e},cleanOutputValue(e){return!e||(String(e)[0]==="#"&&(e=e.slice(1)),e=e||"",e.length===3&&(e=`${e[0]}${e[0]}${e[1]}${e[1]}${e[2]}${e[2]}`),!e)?e:`#${e}`},getNewDefaultEntry(){return""}}},eD={key:0,class:"ux-field-title"},tD={key:0,class:"ux-required-marker"},nD={key:1,class:"ux-field-description"},rD={key:2},oD=["onUpdate:modelValue"],iD=["onUpdate:modelValue"];function sD(e,n,r,i,s,o){const l=t.resolveComponent("flex-cell"),a=t.resolveComponent("ux-icon"),c=t.resolveComponent("ux-button"),d=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",eD,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",tD,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",nD,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",rD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.model,(u,m)=>(t.openBlock(),t.createBlock(d,{class:"ux-text-row",gap:"",key:m},{default:t.withCtx(()=>[t.createVNode(l,{shrink:""},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("input",{type:"color",class:"ux-field-focus ux-color-input ux-color-input-multiple",onFocus:n[0]||(n[0]=(...f)=>e.touch&&e.touch(...f)),ref_for:!0,ref:"input","onUpdate:modelValue":f=>e.model[m]=f},null,40,oD),[[t.vModelText,e.model[m]]])]),_:2},1024),t.createVNode(l,null,{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("input",{type:"text",class:"ux-field-focus ux-text-input-multiple",onFocus:n[1]||(n[1]=(...f)=>e.touch&&e.touch(...f)),ref_for:!0,ref:"input","onUpdate:modelValue":f=>e.model[m]=f},null,40,iD),[[t.vModelText,e.model[m]]])]),_:2},1024),t.createVNode(l,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(c,{key:0,tag:"a",icon:"",onClick:f=>e.remove(u)},{default:t.withCtx(()=>[t.createVNode(a,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(c,{key:0,onClick:n[2]||(n[2]=u=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createBlock(d,{key:3,class:"ux-text-row",gap:""},{default:t.withCtx(()=>[t.createVNode(l,{shrink:""},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("input",{type:"color",class:"ux-field-focus ux-color-input ux-color-input-single",onFocus:n[3]||(n[3]=(...u)=>e.touch&&e.touch(...u)),"onUpdate:modelValue":n[4]||(n[4]=u=>e.model=u)},null,544),[[t.vModelText,e.model]])]),_:1}),t.createVNode(l,null,{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("input",{type:"text",class:"ux-field-focus ux-text-input-single",onFocus:n[5]||(n[5]=(...u)=>e.touch&&e.touch(...u)),"onUpdate:modelValue":n[6]||(n[6]=u=>e.model=u)},null,544),[[t.vModelText,e.model]])]),_:1})]),_:1}))],64)}const lD=w(vT,[["render",sD],["__scopeId","data-v-91624210"]]);function mf(e){return Array.isArray(e)?!!e[0]:!!e}const aD={mixins:[z],components:{UxSwitch:ji},props:{modelValue:{type:[Boolean,Array]}},data(){return{boolean:mf(this.modelValue)}},watch:{modelValue(e,n){this.boolean=mf(e)},boolean(e,n){this.multiValue?this.$emit("update:modelValue",[e]):this.$emit("update:modelValue",e)}},methods:{getNewDefaultEntry(){return!!this.boolean}},computed:{longDescription(){return String(this.description).length>2}}},cD={key:0,class:"ux-field-title"},dD={key:0,class:"ux-required-marker"},uD={key:1,class:"ux-field-description"};function mD(e,n,r,i,s,o){const l=t.resolveComponent("ux-switch"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock("div",null,[t.createVNode(c,{onClick:n[1]||(n[1]=d=>e.touch()),gap:""},{default:t.withCtx(()=>[t.createVNode(a,{vcenter:"",shrink:""},{default:t.withCtx(()=>[t.createVNode(l,{value:s.boolean,onClick:n[0]||(n[0]=d=>s.boolean=!s.boolean)},null,8,["value"])]),_:1}),t.createVNode(a,{vcenter:""},{default:t.withCtx(()=>[t.createElementVNode("div",null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",cD,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",dD,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",uD,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0)])]),_:1})]),_:1})])}const fD=w(aD,[["render",mD],["__scopeId","data-v-1b49e626"]]),hD={props:{multiple:{type:Boolean},accept:{type:String}},data(){return{over:!1}},methods:{clicked(){this.multiple||(this.$refs.file.value=null),this.$refs.file.click()},fileout(e){this.over=!0},fileover(e){this.over=!0},filedrop(e){const n=this;e.dataTransfer&&e.dataTransfer.files&&e.dataTransfer.files.length&&(e.preventDefault(),e.stopPropagation(),n.filesSelected(e.dataTransfer.files))},emits:["files"],filesSelected(e){var n=[];for(var r in[...e]){var i=e[r];n.push({file:i,data:{},name:i.name,size:i.size,state:""})}this.$emit("files",n)}}},pD=["accept","multiple"];function yD(e,n,r,i,s,o){const l=t.resolveComponent("ux-button");return t.openBlock(),t.createElementBlock("label",{class:t.normalizeClass(["file-drop",{over:s.over}]),onDragover:n[2]||(n[2]=t.withModifiers((...a)=>o.fileover&&o.fileover(...a),["prevent","stop"])),onDragleave:n[3]||(n[3]=t.withModifiers((...a)=>o.fileout&&o.fileout(...a),["prevent","stop"])),onDrop:n[4]||(n[4]=t.withModifiers((...a)=>o.filedrop&&o.filedrop(...a),["prevent","stop"]))},[t.createElementVNode("input",{ref:"file",accept:r.accept,type:"file",multiple:r.multiple,onChange:n[0]||(n[0]=a=>o.filesSelected(a.target.files))},null,40,pD),t.createElementVNode("div",{class:"file-drop-ux",onClick:n[1]||(n[1]=t.withModifiers((...a)=>o.clicked&&o.clicked(...a),["stop","prevent"]))},[t.renderSlot(e.$slots,"default",{},()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.createTextVNode("Select Files")]),_:1})],!0)])],34)}const ff=w(hD,[["render",yD],["__scopeId","data-v-6bce29af"]]),gD={mixins:[z],components:{FileDrop:ff},props:{},data(){return{files:[],bytesUploaded:0,state:"ready"}},methods:{filesize(e){return this.$sdk.files.filesize(e)},remove(e){var n=this,r=n.files[e];r.cancelToken&&r.cancelToken.cancel("Operation canceled by the user."),n.files.splice(e,1),console.log("Map to values",n.files),n.mapFilesToValues()},upload(e){var n=this;switch(e.state){case"complete":case"processing":return}e.state="processing";var r=new FormData,i={};i.attachment=!0,i.form=n.$sdk.utils.id(n.form),i.fieldPath=n.fieldPath,r.append("json",JSON.stringify(i)),r.append("file",e.file,e.name);var s={headers:{"Content-Type":"multipart/form-data"},onUploadProgress:c=>{let d=Math.floor(c.loaded*100/c.total);e.progress=d,e.bytesUploaded=c.loaded,e.bytesTotal=c.total,n.bytesUploaded=n.files.reduce(function(u,m){return m.state=="complete"?u+=m.size||m.bytesTotal||0:u+=m.bytesUploaded||0,u},0)}};const l=n.$sdk.api.CancelToken.source();s.cancelToken=l.token,e.cancelToken=l,s.headers={"Content-Type":void 0};let a="/file/upload";return n.$sdk.fileAPI&&(a=`${n.$sdk.fileAPI}${a}`),n.$sdk.api.post(a,r,s).then(function(c){e.state="complete",e.result=c.data,e.cancelToken=null,n.uploadNextFile()}).catch(function(c){e.state="error",e.cancelToken=null,n.uploadNextFile()})},uploadNextFile(){var e=this;e.state="uploading";var n=e.files.find(function(r){switch(r.state){case"complete":case"error":return;default:return!0}});n?e.upload(n):e.state="ready",e.mapFilesToValues()},mapFilesToValues(){var e=this;if(e.multiValue)e.model=e.files.map(function(r){return r.result});else{var n=e.files[0];if(!n)return e.model=void 0;e.model=n.result}console.log("NEW MODEL",e.model)},fileover(e){},filedrop(e){},filesSelected(e){return this.touch(),console.log("FILES SELECTED",e),this.multiValue?this.files=[...this.files,...e]:this.files=e,this.uploadNextFile()}},computed:{}},kD={key:0,class:"ux-field-title"},_D={key:0,class:"ux-required-marker"},wD={key:1,class:"ux-field-description"},xD={key:2,class:"files"},bD={class:"size"};function CD(e,n,r,i,s,o){const l=t.resolveComponent("progress-bar"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-icon"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row"),m=t.resolveComponent("file-drop");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",kD,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",_D,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",wD,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),s.files&&s.files.length?(t.openBlock(),t.createElementBlock("div",xD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.files,(f,h)=>(t.openBlock(),t.createElementBlock("div",{class:"file-item",key:h},[t.createVNode(u,null,{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createElementVNode("strong",null,t.toDisplayString(f.name),1),t.createElementVNode("div",bD,t.toDisplayString(o.filesize(f.size)),1),t.createVNode(l,{value:f.progress},null,8,["value"])]),_:2},1024),t.createVNode(a,{shrink:""},{default:t.withCtx(()=>[t.createVNode(d,{icon:"",onClick:y=>o.remove(h)},{default:t.withCtx(()=>[t.createVNode(c,{icon:"fa-times"})]),_:2},1032,["onClick"])]),_:2},1024)]),_:2},1024)]))),128))])):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[e.canAddValue?(t.openBlock(),t.createBlock(m,{key:0,multiple:e.multiValue,onFiles:o.filesSelected},{default:t.withCtx(()=>[t.createVNode(d,null,{default:t.withCtx(()=>[t.createTextVNode("Select Files")]),_:1})]),_:1},8,["multiple","onFiles"])):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createBlock(m,{key:4,onFiles:o.filesSelected},{default:t.withCtx(()=>[t.createVNode(d,null,{default:t.withCtx(()=>[t.createTextVNode("Select File")]),_:1})]),_:1},8,["onFiles"]))],64)}const VD=w(gD,[["render",CD],["__scopeId","data-v-d29a9855"]]),ND={mixins:[z],components:{draggable:Xr},props:{paymentConfiguration:{type:Object},sandbox:{type:Boolean},submission:{type:Boolean,default:!1},ignoreDefaults:{type:Boolean,default:!1},includeOfficeOnly:{type:Boolean,default:!1},modelValue:{type:[Object,Array]},trail:{type:Array,default(){return[]}}},data(){return{drag:!1}},created(){},computed:{groupKey(){return`${this.field.key}-order`},duplicatable(){return this.field.duplicatable},collapsible(){return this.field.collapsible},showLabel(){return this.field.showLabel},reorderable(){return this.multiValue&&this.field.reorderable},sameLine(){return this.field.sameLine}},emits:["form:state"],methods:{createSingleObject(){this.model={}},stateChange(e){this.$emit("form:state",e)},multiLabel(e,n){return e.title?e.title:e.name?e.name:e.firstName?e.firstName:`${this.label} ${n+1}`},enterPress(e){},refocus(){const e=this;e.$nextTick(function(){var n=e.$refs.row||[],r=n[n.length-1];if(r){var i=r.$el.querySelector(".ux-field-focus");i&&i.focus()}})},getNewDefaultEntry(){return{}},duplicate(e){let n=this.model[e];if(!n)return;const r=JSON.parse(JSON.stringify(n));this.model.push(r)}}},ED={key:0,class:"ux-multi-group"},BD={key:0,class:"ux-group-title"},SD={key:0,class:"ux-field-title"},TD={key:0,class:"ux-required-marker"},DD={key:1,class:"ux-field-description"},OD={key:0,class:"ux-single-group"},MD={class:"ux-group-title"},FD={key:0,class:"ux-field-title"},ID={key:1,class:"ux-field-description"};function AD(e,n,r,i,s,o){const l=t.resolveComponent("ux-icon"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-button"),d=t.resolveComponent("flex-row"),u=t.resolveComponent("ux-panel-header"),m=t.resolveComponent("ux-form"),f=t.resolveComponent("ux-panel-body"),h=t.resolveComponent("ux-panel"),y=t.resolveComponent("draggable");return e.multiValue?(t.openBlock(),t.createElementBlock("div",ED,[o.showLabel?(t.openBlock(),t.createElementBlock("div",BD,[o.showLabel?(t.openBlock(),t.createElementBlock("label",SD,[t.createTextVNode(t.toDisplayString(e.plural||e.title)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",TD,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",DD,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),o.reorderable?(t.openBlock(),t.createBlock(y,{key:1,modelValue:e.model,"onUpdate:modelValue":n[1]||(n[1]=p=>e.model=p),group:o.groupKey,onStart:n[2]||(n[2]=p=>s.drag=!0),onEnd:n[3]||(n[3]=p=>s.drag=!1),handle:".handle"},{item:t.withCtx(({element:p,index:g})=>[t.createVNode(h,{ref:"row"},{default:t.withCtx(()=>[t.createVNode(u,null,{default:t.withCtx(()=>[t.createVNode(d,{vcenter:"",gap:""},{default:t.withCtx(()=>[o.reorderable?(t.openBlock(),t.createBlock(a,{key:0,class:"handle arrows",shrink:""},{default:t.withCtx(()=>[t.createVNode(l,{left:"",icon:"fa-arrows"})]),_:1})):t.createCommentVNode("",!0),t.createVNode(a,{vcenter:""},{default:t.withCtx(()=>[t.createElementVNode("div",null,[t.createElementVNode("strong",null,t.toDisplayString(o.multiLabel(p,g)),1)])]),_:2},1024),o.duplicatable?(t.openBlock(),t.createBlock(a,{key:1,shrink:""},{default:t.withCtx(()=>[t.createVNode(c,{icon:"",size:"xs",tag:"a",onClick:k=>o.duplicate(g)},{default:t.withCtx(()=>[t.createVNode(l,{icon:"far fa-copy"})]),_:2},1032,["onClick"])]),_:2},1024)):t.createCommentVNode("",!0),o.collapsible?(t.openBlock(),t.createBlock(a,{key:2,shrink:""},{default:t.withCtx(()=>[t.createVNode(c,{size:"xs",tag:"a",onClick:k=>p.collapsed=!p.collapsed},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(p.collapsed?"More":"Less")+" ",1),t.createVNode(l,{right:"",icon:p.collapsed?"fa-angle-down":"fa-angle-up"},null,8,["icon"])]),_:2},1032,["onClick"])]),_:2},1024)):t.createCommentVNode("",!0),t.createVNode(a,{vcenter:"",shrink:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(c,{key:0,icon:"",tag:"a",onClick:k=>e.remove(p)},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024)]),_:2},1024),t.withDirectives(t.createVNode(f,{onKeydown:n[0]||(n[0]=t.withKeys(k=>o.enterPress(k),["enter"]))},{default:t.withCtx(()=>[t.createVNode(m,{trail:r.trail,ref:"form",includeOfficeOnly:r.includeOfficeOnly,submission:r.submission,sandbox:r.sandbox,ignoreDefaults:r.ignoreDefaults,"onForm:state":o.stateChange,parentModel:e.parentModel,modelValue:e.model[g],"onUpdate:modelValue":k=>e.model[g]=k,flex:o.sameLine,fields:e.field.fields},null,8,["trail","includeOfficeOnly","submission","sandbox","ignoreDefaults","onForm:state","parentModel","modelValue","onUpdate:modelValue","flex","fields"])]),_:2},1536),[[t.vShow,!o.collapsible||!p.collapsed]])]),_:2},1536)]),_:1},8,["modelValue","group"])):(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:2},t.renderList(e.model,(p,g)=>(t.openBlock(),t.createBlock(h,{ref_for:!0,ref:"row"},{default:t.withCtx(()=>[t.createVNode(u,null,{default:t.withCtx(()=>[t.createVNode(d,{vcenter:"",gap:""},{default:t.withCtx(()=>[o.reorderable?(t.openBlock(),t.createBlock(a,{key:0,shrink:"",class:"arrows handle"},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-arrows"})]),_:1})):t.createCommentVNode("",!0),t.createVNode(a,{vcenter:""},{default:t.withCtx(()=>[t.createElementVNode("div",null,[t.createElementVNode("strong",null,t.toDisplayString(o.multiLabel(p,g)),1)])]),_:2},1024),o.duplicatable?(t.openBlock(),t.createBlock(a,{key:1,shrink:""},{default:t.withCtx(()=>[t.createVNode(c,{icon:"",size:"xs",tag:"a",onClick:k=>o.duplicate(g)},{default:t.withCtx(()=>[t.createVNode(l,{icon:"far fa-copy"})]),_:2},1032,["onClick"])]),_:2},1024)):t.createCommentVNode("",!0),o.collapsible?(t.openBlock(),t.createBlock(a,{key:2,shrink:""},{default:t.withCtx(()=>[t.createVNode(c,{size:"xs",tag:"a",onClick:k=>p.collapsed=!p.collapsed},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(p.collapsed?"More":"Less")+" ",1),t.createVNode(l,{right:"",icon:p.collapsed?"fa-angle-down":"fa-angle-up"},null,8,["icon"])]),_:2},1032,["onClick"])]),_:2},1024)):t.createCommentVNode("",!0),t.createVNode(a,{vcenter:"",shrink:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(c,{key:0,icon:"",tag:"a",onClick:k=>e.remove(p)},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024)]),_:2},1024),t.withDirectives(t.createVNode(f,{onKeydown:n[4]||(n[4]=t.withKeys(k=>o.enterPress(k),["enter"]))},{default:t.withCtx(()=>[t.createVNode(m,{ref_for:!0,ref:"form",trail:r.trail,includeOfficeOnly:r.includeOfficeOnly,submission:r.submission,sandbox:r.sandbox,ignoreDefaults:r.ignoreDefaults,"onForm:state":o.stateChange,parentModel:e.parentModel,modelValue:e.model[g],"onUpdate:modelValue":k=>e.model[g]=k,flex:o.sameLine,fields:e.field.fields},null,8,["trail","includeOfficeOnly","submission","sandbox","ignoreDefaults","onForm:state","parentModel","modelValue","onUpdate:modelValue","flex","fields"])]),_:2},1536),[[t.vShow,!p.collapsed]])]),_:2},1536))),256)),e.canAddValue?(t.openBlock(),t.createBlock(c,{key:3,onClick:n[5]||(n[5]=p=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel)+" ",1),t.createVNode(l,{icon:"fa-plus",right:""})]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[e.widget==="form"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[e.model?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[e.minimum===0?(t.openBlock(),t.createBlock(h,{key:0},{default:t.withCtx(()=>[t.createVNode(u,null,{default:t.withCtx(()=>[t.createVNode(d,{vcenter:"",gap:""},{default:t.withCtx(()=>[t.createVNode(a,{vcenter:""},{default:t.withCtx(()=>[t.createElementVNode("div",null,[t.createElementVNode("strong",null,t.toDisplayString(e.label),1)])]),_:1}),t.createVNode(a,{vcenter:"",shrink:""},{default:t.withCtx(()=>[t.createVNode(c,{icon:"",tag:"a",onClick:n[6]||(n[6]=p=>e.model=void 0)},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-times"})]),_:1})]),_:1})]),_:1})]),_:1}),t.createVNode(f,null,{default:t.withCtx(()=>[t.createVNode(m,{ref:"form",trail:r.trail,includeOfficeOnly:r.includeOfficeOnly,submission:r.submission,sandbox:r.sandbox,ignoreDefaults:r.ignoreDefaults,"onForm:state":o.stateChange,parentModel:e.parentModel,modelValue:e.model,"onUpdate:modelValue":n[7]||(n[7]=p=>e.model=p),flex:o.sameLine,fields:e.field.fields},null,8,["trail","includeOfficeOnly","submission","sandbox","ignoreDefaults","onForm:state","parentModel","modelValue","flex","fields"])]),_:1})]),_:1})):(t.openBlock(),t.createBlock(m,{key:1,ref:"form",trail:r.trail,includeOfficeOnly:r.includeOfficeOnly,submission:r.submission,sandbox:r.sandbox,ignoreDefaults:r.ignoreDefaults,"onForm:state":o.stateChange,parentModel:e.parentModel,modelValue:e.model,"onUpdate:modelValue":n[8]||(n[8]=p=>e.model=p),flex:o.sameLine,fields:e.field.fields},null,8,["trail","includeOfficeOnly","submission","sandbox","ignoreDefaults","onForm:state","parentModel","modelValue","flex","fields"]))],64)):(t.openBlock(),t.createBlock(c,{key:1,onClick:n[9]||(n[9]=p=>o.createSingleObject())},{default:t.withCtx(()=>[t.createTextVNode("Add "+t.toDisplayString(e.label)+" ",1),t.createVNode(l,{icon:"fa-plus",right:""})]),_:1}))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[o.showLabel?(t.openBlock(),t.createElementBlock("div",OD,[t.createElementVNode("div",MD,[o.showLabel?(t.openBlock(),t.createElementBlock("label",FD,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",ID,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0)]),t.createVNode(h,null,{default:t.withCtx(()=>[t.createVNode(f,null,{default:t.withCtx(()=>[t.createVNode(m,{ref:"form",trail:r.trail,includeOfficeOnly:r.includeOfficeOnly,submission:r.submission,sandbox:r.sandbox,ignoreDefaults:r.ignoreDefaults,"onForm:state":o.stateChange,parentModel:e.parentModel,modelValue:e.model,"onUpdate:modelValue":n[10]||(n[10]=p=>e.model=p),flex:o.sameLine,fields:e.field.fields},null,8,["trail","includeOfficeOnly","submission","sandbox","ignoreDefaults","onForm:state","parentModel","modelValue","flex","fields"])]),_:1})]),_:1})])):(t.openBlock(),t.createBlock(m,{key:1,ref:"form",trail:r.trail,includeOfficeOnly:r.includeOfficeOnly,submission:r.submission,sandbox:r.sandbox,ignoreDefaults:r.ignoreDefaults,"onForm:state":o.stateChange,parentModel:e.parentModel,modelValue:e.model,"onUpdate:modelValue":n[11]||(n[11]=p=>e.model=p),flex:o.sameLine,fields:e.field.fields},null,8,["trail","includeOfficeOnly","submission","sandbox","ignoreDefaults","onForm:state","parentModel","modelValue","flex","fields"]))],64))],64))}const LD=w(ND,[["render",AD],["__scopeId","data-v-3ce8a8fa"]]);function qs(e){return e===void 0||typeof e>"u"||e===null||String(e)==="null"||String(e)==="undefined"}const $D={props:{option:{required:!0}},computed:{plainValue(){if(this.option._id)return this.option._id;const e=this.option.value;return qs(e)?this.option:this.option.value}}};function PD(e,n,r,i,s,o){return t.renderSlot(e.$slots,"default",{plainValue:o.plainValue},()=>[t.createElementVNode("pre",null,t.toDisplayString(r.option),1)])}const RD={components:{OptionSlot:w($D,[["render",PD]])},props:{modelValue:{}},mixins:[z],created(){this.model=this.model},methods:{select(e){var n=this;n.multiValue?n.model=[...n.model,e]:n.model=e},deselect(e){var n=this;if(this.multiValue){var r=this.model.slice(),i=r.indexOf(e);i!=-1&&(r.splice(i,1),this.model=r)}else n.getValue(this.model)==e?this.model=void 0:this.model=e},toggle(e){this.selectionHash[e]?this.deselect(e):this.select(e),this.touch()},model:{get(){return this.cleanOutput(this.value)},set(e){this.value=this.cleanInput(e),this.dispatch()}},cleanOutput(e){var n=this;return qs(e)?n.multiValue?e=[]:e=void 0:n.multiValue?e=(e||[]).map(function(r){return n.getValue(r)}):e=n.getValue(e),e},cleanInput(e){var n=this;if(n.multiValue)e||(e=[]),Array.isArray(e)||(e=[e]),n.maximum&&e.length>n.maximum&&(e.length=n.maximum),e=e.map(function(i){var s=n.getValue(i);return n.returnObject?n.optionLookup[s]:s});else{var r=n.getValue(e);e=n.returnObject?n.optionLookup[r]:r}return e}},computed:{size(){return this.field.size},selectionHash(){const e=this;var n={};return!qs(e.model)&&(e.multiValue?e.model.forEach(function(i){n[i]=!0}):n[e.model]=!0),n},returnObject(){return this.type=="reference"},summary(){return this.getLabel(this.optionLookup[this.model])||"Click to select"}}},UD={key:0,class:"ux-field-title"},jD={key:0,class:"ux-required-marker"},qD={key:1,class:"ux-field-description"},zD={key:2},WD={key:3,class:"buttons"};function HD(e,n,r,i,s,o){const l=t.resolveComponent("ux-icon"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("flex-row"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("option-slot");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",UD,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",jD,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",qD,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.loadingAsyncOptions?(t.openBlock(),t.createElementBlock("div",zD,[t.createVNode(l,{icon:"fa-spinner",spin:"",left:""}),t.createTextVNode(" Loading Options ")])):(t.openBlock(),t.createElementBlock("div",WD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.selectableOptions,m=>(t.openBlock(),t.createBlock(u,{option:m},{default:t.withCtx(({plainValue:f})=>[t.createVNode(d,{size:o.size,class:t.normalizeClass({active:o.selectionHash[String(f)]}),onClick:h=>o.toggle(f)},{default:t.withCtx(()=>[t.createVNode(c,{center:"",gap:""},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.getLabel(m)),1)]),_:2},1024),t.createVNode(a,{shrink:""},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-check",right:""})]),_:1})]),_:2},1024)]),_:2},1032,["size","class","onClick"])]),_:2},1032,["option"]))),256))]))],64)}const GD=w(RD,[["render",HD],["__scopeId","data-v-491bd3a3"]]),YD={props:{modelValue:{type:Object}},mixins:[z],computed:{},methods:{getNewDefaultEntry(){return{}}}},JD={key:0,class:"ux-field-title"},KD={key:0,class:"ux-required-marker"},ZD={key:1,class:"ux-field-description"},XD={key:2},QD={key:3};function vD(e,n,r,i,s,o){const l=t.resolveComponent("flex-cell"),a=t.resolveComponent("ux-icon"),c=t.resolveComponent("ux-button"),d=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",JD,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",KD,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",ZD,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",XD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.model,(u,m)=>(t.openBlock(),t.createBlock(d,{class:"ux-text-row",key:m},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.createElementVNode("pre",null,t.toDisplayString(u),1)]),_:2},1024),t.createVNode(l,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(c,{key:0,tag:"a",icon:"",onClick:f=>e.remove(u)},{default:t.withCtx(()=>[t.createVNode(a,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(c,{key:0,onClick:n[0]||(n[0]=u=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel)+" ",1),t.createVNode(a,{icon:"fa-plus",right:""})]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock("pre",QD,t.toDisplayString(e.model),1))],64)}const eO=w(YD,[["render",vD],["__scopeId","data-v-aae5394a"]]),tO={components:{UxCheckbox:gr},props:{modelValue:{type:Object}},data(){return{update:0}},mixins:[z],watch:{"field.referenceType":{async handler(e,n){n&&(this.model={},console.log("Reset model")),e?await this.$glossary.ensure(e):await this.$glossary.ensure()},immediate:!0},model:{immediate:!0,deep:!0,handler(e){e.enabled||(e.enabled={}),e.updates||(e.updates={}),this.$emit("update:modelValue",e)}}},computed:{glossary(){return this.$glossary.hash},loadingGlossary(){return!this.$glossary.loaded},definition(){const e=this.field.referenceType;if(e)return(this.glossary||{})[e]},enabledFields(){const e=this;return e.fields.filter(function(n){return e.model.enabled[n.path]})},mergeFields(){const e=[];return e.push({title:"Merge behavior",description:"As this field can have multiple answers, how would you like to update any existing values?",key:"merge",minimum:1,maximum:1,defaultValues:["add"],widget:"select",type:"string",options:[{title:"Replace existing values",value:"replace"},{title:"Add to existing values",value:"add"},{title:"Remove from existing values",value:"remove"}]}),e},fields(){const e=this,n=e.definition.definesType==="submission";var r=[...e.definition.fields],i=(e.definition.definedFields||[]).map(function(a){return a={...a},a.batchEditable=!0,a});if(i.length)if(n){var s={title:"Form Data",minimum:1,maximum:1,key:"formData",asObject:!0,type:"group",fields:i};r.push(s);var o={title:"Data",minimum:1,maximum:1,key:"data",asObject:!0,type:"group",fields:i.map(function(c){return c.type==="reference"&&(c=JSON.parse(JSON.stringify(c)),delete c.fields),c})};r.push(o)}else{var o={title:`${e.definition.title}`,minimum:1,maximum:1,key:"data",asObject:!0,type:"group",fields:i};r.push(o)}var l=e.$sdk.utils.mapFields(r).filter(function(a){var c=a.type=="group"&&a.asObject&&a.minimum==1&&a.maximum==1;return!c}).filter(function(a){return a.trail[0]==="fields"||a.readOnly?!1:a.batchEditable!=!1}).map(function(a){return a.title=a.titles.filter(Boolean).join(" › "),a.key="value",a}).sort(function(a,c){const d=a.filterTitle||a.title,u=c.filterTitle||c.title;return d<u?-1:1});return l}},methods:{toggle(e){this.model.enabled[e]=!this.model.enabled[e],this.update++},getNewDefaultEntry(){return{enabled:{},update:{}}}}},nO={key:0},rO={key:1},oO={key:0,class:"ux-field-title"},iO={key:0,class:"ux-required-marker"},sO={key:1,class:"ux-field-description"},lO={key:2};function aO(e,n,r,i,s,o){const l=t.resolveComponent("spinner"),a=t.resolveComponent("ux-checkbox"),c=t.resolveComponent("flex-cell"),d=t.resolveComponent("ux-form"),u=t.resolveComponent("flex-row");return o.loadingGlossary?(t.openBlock(),t.createElementBlock("div",nO,[t.createVNode(l)])):o.definition?(t.openBlock(),t.createElementBlock("div",rO,[e.showLabel?(t.openBlock(),t.createElementBlock("label",oO,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",iO,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",sO,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",lO,"This field can not be used on a multiple")):(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:3},t.renderList(o.fields,m=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["field-row",{active:e.model.enabled[m.path]}])},[t.createVNode(u,{gap:""},{default:t.withCtx(()=>[t.createVNode(c,{shrink:"",onClick:f=>o.toggle(m.path)},{default:t.withCtx(()=>[t.createVNode(a,{value:e.model.enabled[m.path]},null,8,["value"])]),_:2},1032,["onClick"]),t.createVNode(c,{shrink:"",style:{width:"200px"}},{default:t.withCtx(()=>[t.createElementVNode("strong",null,t.toDisplayString(m.filterTitle||m.title),1)]),_:2},1024),t.createVNode(c,null,{default:t.withCtx(()=>[e.model.enabled[m.path]?(t.openBlock(),t.createBlock(d,{key:0,modelValue:e.model.updates[m.path],"onUpdate:modelValue":f=>e.model.updates[m.path]=f,fields:[m]},null,8,["modelValue","onUpdate:modelValue","fields"])):t.createCommentVNode("",!0)]),_:2},1024),t.createVNode(c,{shrink:"",style:{width:"200px"}},{default:t.withCtx(()=>[e.model.enabled[m.path]&&m.maximum!=1?(t.openBlock(),t.createBlock(d,{key:0,modelValue:e.model.updates[m.path],"onUpdate:modelValue":f=>e.model.updates[m.path]=f,fields:o.mergeFields},null,8,["modelValue","onUpdate:modelValue","fields"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024)],2))),256))])):t.createCommentVNode("",!0)}const cO=w(tO,[["render",aO],["__scopeId","data-v-5bb07754"]]),dO={props:{modelValue:{type:[String,Array]}},mixins:[z],computed:{lazy(){switch(this.type){case"integer":case"number":case"decimal":case"float":case"url":case"key":return!0}},actualPlaceholder(){if(this.field.placeholder)return this.field.placeholder;switch(this.type){case"integer":case"number":case"decimal":case"float":return"0";case"url":return"https://www.website.com";case"email":return"you@youremail.com"}},addLabel(){return this.numValues?"Add another option":"Add options"}},methods:{titleBlurred(e){var n;this.multiValue?n=this.model[e]:n=this.model,n.title!==n.value&&delete n.pristine},valuePlaceholder(e){var n;return this.multiValue?n=this.model[e]:n=this.model,(n==null?void 0:n.title)||"Value"},valueTouched(e){var n;this.multiValue?n=this.model[e]:n=this.model,delete n.pristine,this.touch()},entryTitleChanged(e){this.$nextTick(function(){var n;this.multiValue?n=this.model[e]:n=this.model,n.pristine&&(n.value=n.title)})},cleanOutputValue(e){return e.value=this.cleanTextInput(e.value,this.type,this),e},cleanInputValue(e){return e.value=this.cleanTextInput(e.value,this.type,this),e},getNewDefaultEntry(){return{pristine:!0}}}},Qr=e=>(t.pushScopeId("data-v-91cc715f"),e=e(),t.popScopeId(),e),uO={key:0,class:"ux-field-title"},mO={key:0,class:"ux-required-marker"},fO={key:1,class:"ux-field-description"},hO={key:2},pO={class:"ux-text-wrap prefixed"},yO=Qr(()=>t.createElementVNode("span",{class:"ux-text-prefix"},"Label",-1)),gO=["onBlur","on:update:modelValue","onUpdate:modelValue"],kO=["onBlur","on:update:modelValue","onUpdate:modelValue"],_O={class:"ux-text-wrap prefixed"},wO=Qr(()=>t.createElementVNode("span",{class:"ux-text-prefix"},"Value",-1)),xO=["placeholder","onFocus","onUpdate:modelValue"],bO=["placeholder","onFocus","onUpdate:modelValue"],CO={class:"ux-text-wrap prefixed"},VO=Qr(()=>t.createElementVNode("span",{class:"ux-text-prefix"},"Label",-1)),NO={class:"ux-text-wrap prefixed"},EO=Qr(()=>t.createElementVNode("span",{class:"ux-text-prefix"},"Value",-1));function BO(e,n,r,i,s,o){const l=t.resolveComponent("flex-cell"),a=t.resolveComponent("ux-icon"),c=t.resolveComponent("ux-button"),d=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",uO,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",mO,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",fO,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",hO,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.model,(u,m)=>(t.openBlock(),t.createBlock(d,{gap:"",class:"ux-text-row",key:m},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.createElementVNode("div",pO,[yO,o.lazy?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,class:"ux-field-focus ux-text-input-multiple",placeholder:"Label",onFocus:n[0]||(n[0]=(...f)=>e.touch&&e.touch(...f)),ref_for:!0,ref:"input",onKeydown:n[1]||(n[1]=t.withKeys(t.withModifiers(f=>e.add(),["stop","prevent"]),["enter"])),onBlur:f=>o.titleBlurred(m),"on:update:modelValue":f=>o.entryTitleChanged(m),"onUpdate:modelValue":f=>e.model[m].title=f},null,40,gO)),[[t.vModelText,e.model[m].title,void 0,{lazy:!0}]]):t.createCommentVNode("",!0),o.lazy?t.createCommentVNode("",!0):t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,class:"ux-field-focus ux-text-input-multiple",placeholder:"Label",onFocus:n[2]||(n[2]=(...f)=>e.touch&&e.touch(...f)),ref_for:!0,ref:"input",onKeydown:n[3]||(n[3]=t.withKeys(t.withModifiers(f=>e.add(),["stop","prevent"]),["enter"])),onBlur:f=>o.titleBlurred(m),"on:update:modelValue":f=>o.entryTitleChanged(m),"onUpdate:modelValue":f=>e.model[m].title=f},null,40,kO)),[[t.vModelText,e.model[m].title]])])]),_:2},1024),t.createVNode(l,null,{default:t.withCtx(()=>[t.createElementVNode("div",_O,[wO,o.lazy?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,class:"ux-field-focus ux-text-input-multiple",placeholder:o.valuePlaceholder(m),onFocus:f=>o.valueTouched(m),ref_for:!0,ref:"valueInput",onKeydown:n[4]||(n[4]=t.withKeys(t.withModifiers(f=>e.add(),["stop","prevent"]),["enter"])),"onUpdate:modelValue":f=>e.model[m].value=f},null,40,xO)),[[t.vModelText,e.model[m].value,void 0,{lazy:!0}]]):t.createCommentVNode("",!0),o.lazy?t.createCommentVNode("",!0):t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,class:"ux-field-focus ux-text-input-multiple",placeholder:o.valuePlaceholder(m),onFocus:f=>o.valueTouched(m),ref_for:!0,ref:"valueInput",onKeydown:n[5]||(n[5]=t.withKeys(t.withModifiers(f=>e.add(),["stop","prevent"]),["enter"])),"onUpdate:modelValue":f=>e.model[m].value=f},null,40,bO)),[[t.vModelText,e.model[m].value]])])]),_:2},1024),t.createVNode(l,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(c,{key:0,tag:"a",icon:"",onClick:f=>e.remove(u)},{default:t.withCtx(()=>[t.createVNode(a,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(c,{key:0,onClick:n[6]||(n[6]=u=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.addLabel)+" ",1),t.createVNode(a,{icon:"fa-plus",right:""})]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createBlock(d,{key:3,class:"ux-text-row"},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.createElementVNode("div",CO,[VO,o.lazy?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,class:"ux-field-focus ux-text-input-multiple",placeholder:"Label",onFocus:n[7]||(n[7]=(...u)=>e.touch&&e.touch(...u)),ref:"input",onKeydown:n[8]||(n[8]=t.withKeys(t.withModifiers(u=>e.add(),["stop","prevent"]),["enter"])),onBlur:n[9]||(n[9]=u=>o.titleBlurred(e.index)),"on:update:modelValue":n[10]||(n[10]=(...u)=>o.entryTitleChanged&&o.entryTitleChanged(...u)),"onUpdate:modelValue":n[11]||(n[11]=u=>e.model.title=u)},null,544)),[[t.vModelText,e.model.title,void 0,{lazy:!0}]]):t.createCommentVNode("",!0),o.lazy?t.createCommentVNode("",!0):t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,class:"ux-field-focus ux-text-input-multiple",placeholder:"Label",onFocus:n[12]||(n[12]=(...u)=>e.touch&&e.touch(...u)),ref:"input",onKeydown:n[13]||(n[13]=t.withKeys(t.withModifiers(u=>e.add(),["stop","prevent"]),["enter"])),onBlur:n[14]||(n[14]=u=>o.titleBlurred(e.index)),"on:update:modelValue":n[15]||(n[15]=(...u)=>o.entryTitleChanged&&o.entryTitleChanged(...u)),"onUpdate:modelValue":n[16]||(n[16]=u=>e.model.title=u)},null,544)),[[t.vModelText,e.model.title]])])]),_:1}),t.createVNode(l,null,{default:t.withCtx(()=>[t.createElementVNode("div",NO,[EO,o.lazy?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,class:"ux-field-focus ux-text-input-multiple",placeholder:"Value",onFocus:n[17]||(n[17]=(...u)=>o.valueTouched&&o.valueTouched(...u)),ref:"valueInput",onKeydown:n[18]||(n[18]=t.withKeys(t.withModifiers(u=>e.add(),["stop","prevent"]),["enter"])),"onUpdate:modelValue":n[19]||(n[19]=u=>e.model.value=u)},null,544)),[[t.vModelText,e.model.value,void 0,{lazy:!0}]]):t.createCommentVNode("",!0),o.lazy?t.createCommentVNode("",!0):t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,class:"ux-field-focus ux-text-input-multiple",placeholder:"Value",onFocus:n[20]||(n[20]=(...u)=>o.valueTouched&&o.valueTouched(...u)),ref:"valueInput",onKeydown:n[21]||(n[21]=t.withKeys(t.withModifiers(u=>e.add(),["stop","prevent"]),["enter"])),"onUpdate:modelValue":n[22]||(n[22]=u=>e.model.value=u)},null,544)),[[t.vModelText,e.model.value]])])]),_:1})]),_:1}))],64)}const SO=w(dO,[["render",BO],["__scopeId","data-v-91cc715f"]]),TO={components:{CodeEditor:js},props:{modelValue:{type:[String,Array]}},computed:{syntax(){return this.field?this.field.syntax:"json"},tokens(){return this.field?this.field.tokens:[]}},mixins:[z],methods:{enterPress(){},getNewDefaultEntry(){return""}}},DO={key:0,class:"ux-field-title"},OO={key:0,class:"ux-required-marker"},MO={key:1,class:"ux-field-description"},FO={key:2},IO={class:"code-editor-field-wrap"},AO={key:3,class:"code-editor-field-wrap"};function LO(e,n,r,i,s,o){const l=t.resolveComponent("code-editor"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-icon"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock("div",{onKeydown:n[2]||(n[2]=t.withKeys(t.withModifiers(m=>o.enterPress(m),["stop"]),["enter"]))},[e.showLabel?(t.openBlock(),t.createElementBlock("label",DO,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",OO,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",MO,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",FO,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.model,(m,f)=>(t.openBlock(),t.createBlock(u,{class:"ux-text-row",key:f},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createElementVNode("div",IO,[t.createVNode(l,{lang:o.syntax,onFocus:e.touch,ref_for:!0,ref:"input",modelValue:e.model[f],"onUpdate:modelValue":h=>e.model[f]=h,class:"ux-code-editor ux-field-focus ux-text-area-multiple"},null,8,["lang","onFocus","modelValue","onUpdate:modelValue"])])]),_:2},1024),t.createVNode(a,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(d,{key:0,tag:"a",icon:"",onClick:h=>e.remove(m)},{default:t.withCtx(()=>[t.createVNode(c,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(d,{key:0,onClick:n[0]||(n[0]=m=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock("div",AO,[t.createVNode(l,{lang:o.syntax,tokens:o.tokens,class:"ux-code-editor ux-field-focus ux-text-area-single",onFocus:e.touch,modelValue:e.model,"onUpdate:modelValue":n[1]||(n[1]=m=>e.model=m)},null,8,["lang","tokens","onFocus","modelValue"])]))],32)}const $O=w(TO,[["render",LO],["__scopeId","data-v-ecb1b9f8"]]),PO={emits:["deselect"],components:{Search:ot,Spinner:Pt},props:{deselectEnabled:{type:Boolean,default:!0},showAdvancedToggle:{type:Boolean},advanced:{type:Boolean},teleportID:{type:[String,Number]},modelValue:{type:Object,default(){return{search:void 0,latitude:void 0,longitude:void 0,threshold:void 0,title:void 0,addressLine1:void 0,addressLine2:void 0,suburb:void 0,state:void 0,country:void 0,postalCode:void 0}}}},computed:{hasLocation(){var e,n;return this.model.addressLine1||((e=this.model)==null?void 0:e.longitude)&&((n=this.model)==null?void 0:n.latitude)},teleportTarget(){if(this.teleportID)return`#teleport-${this.teleportID}`},keywords:{get(){return this.model.search||""},set(e){this.model.search=e||""}}},data(){return{selectedIndex:-1,results:[],processing:!1,model:this.modelValue,showAdvanced:this.advanced}},watch:{keywords:"findResults",modelValue(e){this.model=e},model(e){console.log("emit up!",e),this.$emit("update:modelValue",e)}},methods:{summary(e){if(!e)return"";const n=[e.addressLine1,e.suburb,e.state,e.postalCode,e.country].filter(Boolean);return n?n.join(", "):[e.latitude,e.longitude].filter(Boolean).join(", ")},toggleAdvanced(){this.showAdvanced=!this.showAdvanced,this.$emit("update:advanced",this.showAdvanced)},deselect(){this.model={title:void 0,longitude:void 0,latitude:void 0,search:void 0,threshold:0,addressLine1:void 0,addressLine2:void 0,suburb:void 0,state:void 0,country:void 0,postalCode:void 0},this.$emit("deselect")},handleKeyNavigation(e){e.key==="ArrowDown"?(e.preventDefault(),this.selectedIndex=(this.selectedIndex+1)%this.results.length):e.key==="ArrowUp"?(e.preventDefault(),this.selectedIndex=(this.selectedIndex-1+this.results.length)%this.results.length):e.key==="Enter"&&this.selectedIndex!==-1&&this.select(this.results[this.selectedIndex])},async select(e){e&&(this.model=Object.assign({threshold:0},this.model,{longitude:e.longitude,latitude:e.latitude,title:e.title||"",search:"",addressLine1:e.addressLine1||e.address,addressLine2:e.addressLine2||"",suburb:e.suburb||"",state:e.state||"",country:e.country||"",postalCode:e.postalCode||""}),this.keywords="")},async findResults(){const e=this;e.selectedIndex=-1;const n=e.keywords;if(!(n!=null&&n.length)){e.results=[],e.processing=!1;return}e.processing=!0;const{data:r}=await e.$sdk.api.get(`/geo/places/search/${n}`);e.results=(r.locations||[]).map(function({formatted:i}){return{...i,summary:e.summary(i)}}),e.processing=!1}}},RO={class:"location-search-outer"},UO={key:0,class:"selectedLocation"},jO={class:"content-item"},qO={class:"image-wrapper"},zO={class:"content-item-title"},WO={key:0,class:"content-item-subtitle"},HO={key:0,class:"results"},GO=["onClick"],YO={class:"result-item-title"},JO={class:"result-item-subtitle"};function KO(e,n,r,i,s,o){const l=t.resolveComponent("ux-icon"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-button"),d=t.resolveComponent("flex-row"),u=t.resolveComponent("search");return t.openBlock(),t.createElementBlock("div",RO,[o.hasLocation?(t.openBlock(),t.createElementBlock("div",UO,[t.createElementVNode("div",jO,[t.createVNode(d,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(a,{shrink:""},{default:t.withCtx(()=>[t.createElementVNode("div",qO,[t.createVNode(l,{icon:"fa-map-marker"})])]),_:1}),t.createVNode(a,null,{default:t.withCtx(()=>[t.createElementVNode("div",zO,t.toDisplayString(s.model.title||s.model.addressLine1),1),o.summary?(t.openBlock(),t.createElementBlock("div",WO,t.toDisplayString(o.summary(s.model)),1)):t.createCommentVNode("",!0)]),_:1}),r.showAdvancedToggle?(t.openBlock(),t.createBlock(a,{key:0,shrink:""},{default:t.withCtx(()=>[t.createVNode(c,{size:"sm",onClick:o.toggleAdvanced},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(r.advanced?"Less detail":"More detail")+" ",1),t.createVNode(l,{right:"",icon:r.advanced?"fa-angle-up":"fa-angle-down"},null,8,["icon"])]),_:1},8,["onClick"])]),_:1})):t.createCommentVNode("",!0),r.deselectEnabled?(t.openBlock(),t.createBlock(a,{key:1,shrink:""},{default:t.withCtx(()=>[t.createVNode(c,{icon:"",onClick:o.deselect},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-times"})]),_:1},8,["onClick"])]),_:1})):t.createCommentVNode("",!0)]),_:1})])])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(u,{onTouched:e.touch,modelValue:o.keywords,"onUpdate:modelValue":n[0]||(n[0]=m=>o.keywords=m),onKeydown:o.handleKeyNavigation,placeholder:"Search for a location",loading:s.processing},null,8,["onTouched","modelValue","onKeydown","loading"]),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!o.teleportTarget,to:o.teleportTarget},[s.results.length?(t.openBlock(),t.createElementBlock("div",HO,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.results,(m,f)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["result-item",{selected:f===s.selectedIndex}]),key:m.title,onClick:h=>o.select(m)},[t.createElementVNode("div",YO,t.toDisplayString(m.title),1),t.createElementVNode("div",JO,t.toDisplayString(m.summary),1)],10,GO))),128))])):t.createCommentVNode("",!0)],8,["disabled","to"]))],64))])}const ZO=w(PO,[["render",KO],["__scopeId","data-v-084b9220"]]),XO={components:{TextField:Os,Spinner:Pt,CountrySelect:ds},props:{showTitle:{type:Boolean,default:!0},showAddress:{type:Boolean,default:!0},showInputs:{type:Boolean,default:!0},showThreshold:{type:Boolean,default:!0},modelValue:{type:Object,default(){return{latitude:0,longitude:0,threshold:0,title:"",address:"",search:""}}},assumeDefault:{type:Boolean,default:!1}},computed:{initializing(){return this.loadingUserPosition||this.loadingMapScript},showFields(){return this.showInputs||this.showThreshold},position:{get(){return this.model},set(e){const n=this;n.model={...n.model||{},...e},n.redrawMarker(),n.$emit("update:modelValue",n.model)}},address:{get(){return this.model.address||""},set(e){this.model.address=e}},title:{get(){return this.model.title||""},set(e){this.model.title=e}},lat:{get(){var e;return((e=this.model)==null?void 0:e.latitude)||0},set(e){this.model.latitude!=e&&(this.position={latitude:e})}},radius:{get(){var e;return isNaN((e=this.model)==null?void 0:e.threshold)?0:Number(this.model.threshold)||0},set(e){e=Number(e),this.model.threshold!=e&&(this.position={threshold:e},this.redrawCircle())}},lng:{get(){var e;return((e=this.model)==null?void 0:e.longitude)||0},set(e){this.model.longitude!=e&&(this.position={longitude:e})}}},data(){const e={title:"Latitude",key:"lat",type:"number",minimum:0,maximum:1},n={title:"Longitude",key:"lng",type:"number",minimum:0,maximum:1},r={title:"Radius (Meters)",description:"Enter the maximum distance in meters from this location that can be considered valid",key:"radius",type:"number",minimum:0,maximum:1},i={title:"Title",description:"Optionally enter a descriptive name for this location",key:"title",type:"string",minimum:0,maximum:1},s={title:"Address Line 1",key:"addressLine1",type:"string",minimum:0,maximum:1},o={title:"Address Line 2",key:"addressLine2",type:"string",minimum:0,maximum:1},l={title:"Suburb",key:"suburb",type:"string",minimum:0,maximum:1},a={title:"State",key:"state",type:"string",minimum:0,maximum:1},c={title:"Postal Code",key:"postalCode",type:"string",minimum:0,maximum:1},d={title:"Country",key:"country",type:"string",minimum:0,maximum:1},u=this.modelValue||{};return u.latitude=u.latitude||0,u.longitude=u.longitude||0,u.threshold=u.threshold||0,{map:null,marker:null,circle:null,model:u,latField:e,lngField:n,thresholdField:r,titleField:i,addressLine1Field:s,addressLine2Field:o,suburbField:l,stateField:a,postalCodeField:c,countryField:d,userPosition:null,loadingUserPosition:!0,loadingMapScript:!0,initialised:!1}},mounted(){var r,i;const e=this,n=((i=(r=e.$sdk.app)==null?void 0:r.global)==null?void 0:i.googleMapsAPIKey)||"AIzaSyDxBa2lg5dUZWvVSAO2EfgHHKuNnERMzec";e.$sdk.utils.loadExternalScript(`https://maps.googleapis.com/maps/api/js?key=${n}`).then(function(s){e.loadingMapScript=!1},function(s){e.loadingMapScript=!1}),navigator.geolocation?(e.loadingUserPosition=!0,navigator.geolocation.getCurrentPosition(s=>{e.userPosition={latitude:s.coords.latitude,longitude:s.coords.longitude},e.loadingUserPosition=!1},s=>{console.error("Error getting user position:",s),e.loadingUserPosition=!1})):e.loadingUserPosition=!1},watch:{modelValue(e){this.model=e,this.redrawMarker()},initializing:{handler:"checkInitialisation",immediate:!0}},beforeUnmount(){this.map&&window.google.maps.event.clearInstanceListeners(this.map)},methods:{setToUserPosition(){var n,r;const e=this;(n=e.userPosition)!=null&&n.latitude&&((r=e.userPosition)!=null&&r.longitude)&&(e.position={latitude:e.userPosition.latitude,longitude:e.userPosition.longitude,title:"",address:""})},checkInitialisation(){var n,r,i,s;const e=this;if(e.loadingUserPosition||e.loadingMapScript)console.log("Still initializing...",[e.loadingUserPosition,this.loadingMapScript]);else{if(e.assumeDefault){const o=Number(((n=e.model)==null?void 0:n.latitude)||0),l=Number(((r=e.model)==null?void 0:r.longitude)||0);if(!o||!l){const a=Number(((i=e.userPosition)==null?void 0:i.latitude)||0),c=Number(((s=e.userPosition)==null?void 0:s.longitude)||0);a&&c&&(e.model={...e.model,latitude:a,longitude:c})}}e.initializeMap()}},focus(){},redrawMarker(){const e=this,n=Number(e.model.latitude||0),r=Number(e.model.longitude||0),i=new google.maps.LatLng(n,r);e.marker.setPosition(i),n&&r?(e.marker.setVisible(!0),e.map.setCenter(i)):e.marker.setVisible(!1),e.redrawCircle()},redrawCircle(){const e=this;if(!e.radius){e.circle&&(e.circle.setMap(null),e.circle=null);return}const n=new google.maps.LatLng(Number(e.model.latitude),Number(e.model.longitude));e.circle?(e.circle.setRadius(e.radius),e.circle.setCenter(n)):e.circle=new window.google.maps.Circle({center:n,radius:Number(e.radius),strokeColor:"#FF0000",strokeOpacity:.8,strokeWeight:2,fillColor:"#FF0000",fillOpacity:.35,map:e.map})},initializeMap(){var a,c,d,u;const e=this;if(e.initialised)return;e.initialised=!0;let n=Number(((a=e.model)==null?void 0:a.latitude)||0),r=Number(((c=e.model)==null?void 0:c.longitude)||0),i=Number(((d=e.userPosition)==null?void 0:d.latitude)||0),s=Number(((u=e.userPosition)==null?void 0:u.longitude)||0),o=n||0,l=r||0;!o&&!l&&(o=i,l=s),e.map=new window.google.maps.Map(e.$refs.mapContainer,{center:{lat:o,lng:l},zoom:12,streetViewControl:!1}),e.marker=new window.google.maps.Marker({position:{lat:o,lng:l},map:e.map,draggable:!0}),n&&r?e.marker.setVisible(!0):e.marker.setVisible(!1),e.map.addListener("click",m=>{e.position={latitude:m.latLng.lat(),longitude:m.latLng.lng()}}),e.marker.addListener("dragend",()=>{e.position={latitude:e.marker.getPosition().lat(),longitude:e.marker.getPosition().lng()}}),e.redrawCircle()}}},QO={class:"font-muted font-sm"},vO={class:"map-outer"},e2={key:0,class:"indicator"},t2={class:"map-inner",ref:"mapContainer"};function n2(e,n,r,i,s,o){const l=t.resolveComponent("flex-cell"),a=t.resolveComponent("ux-icon"),c=t.resolveComponent("flex-row"),d=t.resolveComponent("ux-panel-header"),u=t.resolveComponent("spinner"),m=t.resolveComponent("text-field"),f=t.resolveComponent("country-select"),h=t.resolveComponent("ux-panel-body"),y=t.resolveComponent("ux-panel");return t.openBlock(),t.createBlock(y,null,{default:t.withCtx(()=>[t.createVNode(d,null,{default:t.withCtx(()=>[t.createElementVNode("div",QO,[t.createVNode(c,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.createTextVNode(" Select a location using the map below ")]),_:1}),t.createVNode(l,{shrink:""},{default:t.withCtx(()=>[t.createElementVNode("a",{onClick:n[0]||(n[0]=(...p)=>o.setToUserPosition&&o.setToUserPosition(...p))},[t.createTextVNode("Set to my position "),t.createVNode(a,{icon:"fa-map-marker",right:""})])]),_:1})]),_:1})])]),_:1}),t.createElementVNode("div",vO,[o.initializing?(t.openBlock(),t.createElementBlock("div",e2,[t.createVNode(u)])):t.createCommentVNode("",!0),t.createElementVNode("div",t2,null,512)]),o.showFields?(t.openBlock(),t.createBlock(h,{key:0},{default:t.withCtx(()=>[r.showTitle?(t.openBlock(),t.createBlock(m,{key:0,onTouched:e.touch,field:s.titleField,modelValue:o.title,"onUpdate:modelValue":n[1]||(n[1]=p=>o.title=p)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),r.showAddress?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(m,{onTouched:e.touch,field:s.addressLine1Field,modelValue:s.model.addressLine1,"onUpdate:modelValue":n[2]||(n[2]=p=>s.model.addressLine1=p)},null,8,["onTouched","field","modelValue"]),t.createVNode(c,{gap:""},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.createVNode(m,{onTouched:e.touch,field:s.suburbField,modelValue:s.model.suburb,"onUpdate:modelValue":n[3]||(n[3]=p=>s.model.suburb=p)},null,8,["onTouched","field","modelValue"])]),_:1}),t.createVNode(l,null,{default:t.withCtx(()=>[t.createVNode(m,{onTouched:e.touch,field:s.stateField,modelValue:s.model.state,"onUpdate:modelValue":n[4]||(n[4]=p=>s.model.state=p)},null,8,["onTouched","field","modelValue"])]),_:1}),t.createVNode(l,null,{default:t.withCtx(()=>[t.createVNode(m,{onTouched:e.touch,field:s.postalCodeField,modelValue:s.model.postalCode,"onUpdate:modelValue":n[5]||(n[5]=p=>s.model.postalCode=p)},null,8,["onTouched","field","modelValue"])]),_:1})]),_:1}),t.createVNode(f,{onTouched:e.touch,field:s.countryField,modelValue:s.model.country,"onUpdate:modelValue":n[6]||(n[6]=p=>s.model.country=p)},null,8,["onTouched","field","modelValue"])],64)):t.createCommentVNode("",!0),r.showInputs?(t.openBlock(),t.createBlock(c,{key:2,gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.createVNode(m,{onTouched:e.touch,field:s.latField,modelValue:o.lat,"onUpdate:modelValue":n[7]||(n[7]=p=>o.lat=p)},null,8,["onTouched","field","modelValue"])]),_:1}),t.createVNode(l,null,{default:t.withCtx(()=>[t.createVNode(m,{onTouched:e.touch,field:s.lngField,modelValue:o.lng,"onUpdate:modelValue":n[8]||(n[8]=p=>o.lng=p)},null,8,["onTouched","field","modelValue"])]),_:1})]),_:1})):t.createCommentVNode("",!0),r.showThreshold?(t.openBlock(),t.createBlock(m,{key:3,onTouched:e.touch,field:s.thresholdField,modelValue:o.radius,"onUpdate:modelValue":n[9]||(n[9]=p=>o.radius=p)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0)]),_:1})):t.createCommentVNode("",!0)]),_:1})}const hf=w(XO,[["render",n2]]);function pf(){return{title:void 0,latitude:void 0,longitude:void 0,addressLine1:void 0,addressLine2:void 0,suburb:void 0,state:void 0,country:void 0,postalCode:void 0,threshold:void 0,search:void 0}}const r2={data(){return{singleAdvancedOptions:!1,multiAdvancedOptions:{}}},components:{LocationSelect:hf,LocationSearch:ZO},props:{modelValue:{type:[Object,Array]}},created(){console.log("CREATED LOCATION"),this.model||this.singleValue&&(this.model=pf())},mixins:[z],computed:{singleTeleportID(){return Math.floor(Math.random()*1e4)+1},multipleTeleportIDs(){const e=this;return e.model.map(function(n,r){return`${e.singleTeleportID}-${r}`})}},methods:{refocus(){const e=this.$el.querySelector(".search input");e&&(e.focus(),console.log("foxys"))},checkRemoveEntry(e,n){if(this.singleValue){this.singleAdvancedOptions=!1;return}this.canRemoveValue&&this.remove(e)},removeValue(){this.model=this.getNewDefaultEntry(),this.dispatch()},getNewDefaultEntry(){return pf()}}},o2={key:0,class:"ux-field-title"},i2={key:0,class:"ux-required-marker"},s2={key:1,class:"ux-field-description"},l2={key:2},a2={class:"location-field-wrap"},c2=["id"],d2={key:3,class:"location-field-wrap"},u2=["id"];function m2(e,n,r,i,s,o){const l=t.resolveComponent("location-search"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-icon"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row"),m=t.resolveComponent("location-select");return t.openBlock(),t.createElementBlock("div",null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",o2,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",i2,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",s2,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",l2,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.model,(f,h)=>(t.openBlock(),t.createElementBlock("div",{class:"ux-location-row",key:h},[t.createElementVNode("div",a2,[t.createVNode(u,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(l,{deselectEnabled:e.canRemoveValue,onDeselect:y=>o.checkRemoveEntry(f,h),modelValue:e.model[h],"onUpdate:modelValue":y=>e.model[h]=y,advanced:s.multiAdvancedOptions[h],"onUpdate:advanced":y=>s.multiAdvancedOptions[h]=y,"show-advanced-toggle":""},null,8,["deselectEnabled","onDeselect","modelValue","onUpdate:modelValue","advanced","onUpdate:advanced"])]),_:2},1024),e.canRemoveValue&&!(f.latitude&&f.longitude)?(t.openBlock(),t.createBlock(a,{key:0,shrink:""},{default:t.withCtx(()=>[t.createVNode(d,{tag:"a",icon:"",onClick:y=>e.remove(f)},{default:t.withCtx(()=>[t.createVNode(c,{icon:"fa-times"})]),_:2},1032,["onClick"])]),_:2},1024)):t.createCommentVNode("",!0)]),_:2},1024),t.createElementVNode("div",{class:"teleport-results",id:`teleport-${o.multipleTeleportIDs[h]}`},null,8,c2),s.multiAdvancedOptions[h]?(t.openBlock(),t.createBlock(m,{key:0,onFocus:e.touch,ref_for:!0,ref:"input",modelValue:e.model[h],"onUpdate:modelValue":y=>e.model[h]=y,class:"ux-location-select ux-field-focus ux-location-multiple"},null,8,["onFocus","modelValue","onUpdate:modelValue"])):t.createCommentVNode("",!0)])]))),128)),e.canAddValue?(t.openBlock(),t.createBlock(d,{key:0,onClick:n[0]||(n[0]=f=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel)+" ",1),t.createVNode(c,{icon:"fa-plus",right:""})]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock("div",d2,[t.createVNode(u,null,{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(l,{onDeselect:o.checkRemoveEntry,modelValue:e.model,"onUpdate:modelValue":n[1]||(n[1]=f=>e.model=f),advanced:s.singleAdvancedOptions,"onUpdate:advanced":n[2]||(n[2]=f=>s.singleAdvancedOptions=f),"show-advanced-toggle":""},null,8,["onDeselect","modelValue","advanced"]),t.createElementVNode("div",{class:"teleport-results",id:`teleport-${o.singleTeleportID}`},null,8,u2),s.singleAdvancedOptions?(t.openBlock(),t.createBlock(m,{key:0,assumeDefault:!!e.field.assumeDefault,class:"ux-location-select ux-field-focus ux-location-single",ref:"input",onFocus:e.touch,modelValue:e.model,"onUpdate:modelValue":n[3]||(n[3]=f=>e.model=f)},null,8,["assumeDefault","onFocus","modelValue"])):t.createCommentVNode("",!0)]),_:1})]),_:1})]))])}const f2=w(r2,[["render",m2],["__scopeId","data-v-eac978e1"]]),h2={props:{modelValue:{type:[String,Array]}},mixins:[z],methods:{enterPress(){},getNewDefaultEntry(){return""}}},p2={key:0,class:"ux-field-title"},y2={key:0,class:"ux-required-marker"},g2={key:1,class:"ux-field-description"},k2={key:2},_2={class:"expression-field-wrap"},w2={key:3,class:"expression-field-wrap"};function x2(e,n,r,i,s,o){const l=t.resolveComponent("expression-editor"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-icon"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock("div",{onKeydown:n[2]||(n[2]=t.withKeys(t.withModifiers(m=>o.enterPress(m),["stop"]),["enter"]))},[e.showLabel?(t.openBlock(),t.createElementBlock("label",p2,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",y2,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",g2,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",k2,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.model,(m,f)=>(t.openBlock(),t.createBlock(u,{class:"ux-text-row",key:f},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createElementVNode("div",_2,[t.createVNode(l,{field:e.field,onFocus:e.touch,ref_for:!0,ref:"input",modelValue:e.model[f],"onUpdate:modelValue":h=>e.model[f]=h,class:"ux-expression ux-field-focus ux-text-area-multiple"},null,8,["field","onFocus","modelValue","onUpdate:modelValue"])])]),_:2},1024),t.createVNode(a,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(d,{key:0,tag:"a",icon:"",onClick:h=>e.remove(m)},{default:t.withCtx(()=>[t.createVNode(c,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(d,{key:0,onClick:n[0]||(n[0]=m=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock("div",w2,[t.createVNode(l,{field:e.field,class:"ux-expression ux-field-focus ux-text-area-single",onFocus:e.touch,modelValue:e.model,"onUpdate:modelValue":n[1]||(n[1]=m=>e.model=m)},null,8,["field","onFocus","modelValue"])]))],32)}const b2=w(h2,[["render",x2],["__scopeId","data-v-56c3b71b"]]),C2={components:{},methods:{},props:{modelValue:{type:String,default(){return""}},lang:{type:String}},watch:{modelValue(e){this.model=e},model(e){this.$emit("update:modelValue",e)}},mounted(){this.mounted=!0},beforeUnmount(){this.mounted=!1},data(){return{mounted:!1,model:this.modelValue}}};function V2(e,n,r,i,s,o){const l=t.resolveComponent("tiptap"),a=t.resolveComponent("flex-column");return s.mounted?(t.openBlock(),t.createBlock(a,{key:0},{default:t.withCtx(()=>[t.createVNode(l,{modelValue:s.model,"onUpdate:modelValue":n[0]||(n[0]=c=>s.model=c),style:{height:"250px"}},null,8,["modelValue"])]),_:1})):t.createCommentVNode("",!0)}const N2={components:{richtext:w(C2,[["render",V2],["__scopeId","data-v-844777a7"]])},props:{modelValue:{type:[String,Array]}},computed:{},mixins:[z],methods:{getNewDefaultEntry(){return""}}},E2={key:0,class:"ux-field-title"},B2={key:0,class:"ux-required-marker"},S2={key:1,class:"ux-field-description"},T2={key:2},D2={class:"richtext-field-wrap"},O2={key:3,class:"richtext-field-wrap"};function M2(e,n,r,i,s,o){const l=t.resolveComponent("richtext"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-icon"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock("div",null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",E2,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",B2,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",S2,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",T2,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.model,(m,f)=>(t.openBlock(),t.createBlock(u,{class:"ux-text-row",key:f},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createElementVNode("div",D2,[t.createVNode(l,{onFocus:e.touch,ref_for:!0,ref:"input",modelValue:e.model[f],"onUpdate:modelValue":h=>e.model[f]=h,class:"ux-richtext ux-field-focus ux-text-area-multiple"},null,8,["onFocus","modelValue","onUpdate:modelValue"])])]),_:2},1024),t.createVNode(a,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(d,{key:0,tag:"a",icon:"",onClick:h=>e.remove(m)},{default:t.withCtx(()=>[t.createVNode(c,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(d,{key:0,onClick:n[0]||(n[0]=m=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock("div",O2,[t.createVNode(l,{class:"ux-richtext ux-field-focus ux-text-area-single",onFocus:e.touch,modelValue:e.model,"onUpdate:modelValue":n[1]||(n[1]=m=>e.model=m)},null,8,["onFocus","modelValue"])]))])}const F2=w(N2,[["render",M2],["__scopeId","data-v-396fd196"]]);var vr={exports:{}},yf;function I2(){return yf||(yf=1,function(e,n){(function(r){var i="Compound",s="Identifier",o="MemberExpression",l="Literal",a="ThisExpression",c="CallExpression",d="UnaryExpression",u="BinaryExpression",m="LogicalExpression",f="ConditionalExpression",h="ArrayExpression",y=46,p=44,g=39,k=34,x=40,S=41,A=91,R=93,C=63,D=59,I=58,M=function(O,V){var je=new Error(O+" at character "+V);throw je.index=V,je.description=O,je},j=!0,L={"-":j,"!":j,"~":j,"+":j},te={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},q=function(O){var V=0,je;for(var St in O)(je=St.length)>V&&O.hasOwnProperty(St)&&(V=je);return V},v=q(L),ae=q(te),me={true:!0,false:!1,null:null},Ye="this",Re=function(O){return te[O]||0},Bt=function(O,V,je){var St=O==="||"||O==="&&"?m:u;return{type:St,operator:O,left:V,right:je}},tt=function(O){return O>=48&&O<=57},Ue=function(O){return O===36||O===95||O>=65&&O<=90||O>=97&&O<=122||O>=128&&!te[String.fromCharCode(O)]},at=function(O){return O===36||O===95||O>=65&&O<=90||O>=97&&O<=122||O>=48&&O<=57||O>=128&&!te[String.fromCharCode(O)]},ke=function(O){for(var V=0,je=O.charAt,St=O.charCodeAt,xe=function(N){return je.call(O,N)},ne=function(N){return St.call(O,N)},Zt=O.length,b=function(){for(var N=ne(V);N===32||N===9||N===10||N===13;)N=ne(++V)},pn=function(){var N=qL(),F,G;if(b(),ne(V)===C){if(V++,F=pn(),F||M("Expected expression",V),b(),ne(V)===I)return V++,G=pn(),G||M("Expected expression",V),{type:f,test:N,consequent:F,alternate:G};M("Expected :",V)}else return N},Lh=function(){b();for(var N=O.substr(V,ae),F=N.length;F>0;){if(te.hasOwnProperty(N)&&(!Ue(ne(V))||V+N.length<O.length&&!at(ne(V+N.length))))return V+=F,N;N=N.substr(0,--F)}return!1},qL=function(){var N,F,G,re,Xt,Je,Tt,yn,Uh;if(Je=no(),F=Lh(),!F)return Je;for(Xt={value:F,prec:Re(F)},Tt=no(),Tt||M("Expected expression after "+F,V),re=[Je,Xt,Tt];(F=Lh())&&(G=Re(F),G!==0);){for(Xt={value:F,prec:G},Uh=F;re.length>2&&G<=re[re.length-2].prec;)Tt=re.pop(),F=re.pop().value,Je=re.pop(),N=Bt(F,Je,Tt),re.push(N);N=no(),N||M("Expected expression after "+Uh,V),re.push(Xt,N)}for(yn=re.length-1,N=re[yn];yn>1;)N=Bt(re[yn-1].value,re[yn-2],N),yn-=2;return N},no=function(){var N,F,G;if(b(),N=ne(V),tt(N)||N===y)return zL();if(N===g||N===k)return WL();if(N===A)return YL();for(F=O.substr(V,v),G=F.length;G>0;){if(L.hasOwnProperty(F)&&(!Ue(ne(V))||V+F.length<O.length&&!at(ne(V+F.length))))return V+=G,{type:d,operator:F,argument:no(),prefix:!0};F=F.substr(0,--G)}return Ue(N)||N===x?HL():!1},zL=function(){for(var N="",F,G;tt(ne(V));)N+=xe(V++);if(ne(V)===y)for(N+=xe(V++);tt(ne(V));)N+=xe(V++);if(F=xe(V),F==="e"||F==="E"){for(N+=xe(V++),F=xe(V),(F==="+"||F==="-")&&(N+=xe(V++));tt(ne(V));)N+=xe(V++);tt(ne(V-1))||M("Expected exponent ("+N+xe(V)+")",V)}return G=ne(V),Ue(G)?M("Variable names cannot start with a number ("+N+xe(V)+")",V):G===y&&M("Unexpected period",V),{type:l,value:parseFloat(N),raw:N}},WL=function(){for(var N="",F=xe(V++),G=!1,re;V<Zt;)if(re=xe(V++),re===F){G=!0;break}else if(re==="\\")switch(re=xe(V++),re){case"n":N+=`
27
27
  `;break;case"r":N+="\r";break;case"t":N+=" ";break;case"b":N+="\b";break;case"f":N+="\f";break;case"v":N+="\v";break;default:N+=re}else N+=re;return G||M('Unclosed quote after "'+N+'"',V),{type:l,value:N,raw:F+N+F}},$h=function(){var N=ne(V),F=V,G;for(Ue(N)?V++:M("Unexpected "+xe(V),V);V<Zt&&(N=ne(V),at(N));)V++;return G=O.slice(F,V),me.hasOwnProperty(G)?{type:l,value:me[G],raw:G}:G===Ye?{type:a}:{type:s,name:G}},Ph=function(N){for(var F,G=[],re,Xt=!1,Je=0;V<Zt;)if(b(),F=ne(V),F===N){Xt=!0,V++,N===S&&Je&&Je>=G.length&&M("Unexpected token "+String.fromCharCode(N),V);break}else if(F===p){if(V++,Je++,Je!==G.length){if(N===S)M("Unexpected token ,",V);else if(N===R)for(var Tt=G.length;Tt<Je;Tt++)G.push(null)}}else re=pn(),(!re||re.type===i)&&M("Expected comma",V),G.push(re);return Xt||M("Expected "+String.fromCharCode(N),V),G},HL=function(){var N,F;for(N=ne(V),N===x?F=GL():F=$h(),b(),N=ne(V);N===y||N===A||N===x;)V++,N===y?(b(),F={type:o,computed:!1,object:F,property:$h()}):N===A?(F={type:o,computed:!0,object:F,property:pn()},b(),N=ne(V),N!==R&&M("Unclosed [",V),V++):N===x&&(F={type:c,arguments:Ph(S),callee:F}),b(),N=ne(V);return F},GL=function(){V++;var N=pn();if(b(),ne(V)===S)return V++,N;M("Unclosed (",V)},YL=function(){return V++,{type:h,elements:Ph(R)}},ro=[],Ul,Rh;V<Zt;)Ul=ne(V),Ul===D||Ul===p?V++:(Rh=pn())?ro.push(Rh):V<Zt&&M('Unexpected "'+xe(V)+'"',V);return ro.length===1?ro[0]:{type:i,body:ro}};ke.version="0.3.5",ke.toString=function(){return"JavaScript Expression Parser (JSEP) v"+ke.version},ke.addUnaryOp=function(O){return v=Math.max(O.length,v),L[O]=j,this},ke.addBinaryOp=function(O,V){return ae=Math.max(O.length,ae),te[O]=V,this},ke.addLiteral=function(O,V){return me[O]=V,this},ke.removeUnaryOp=function(O){return delete L[O],O.length===v&&(v=q(L)),this},ke.removeAllUnaryOps=function(){return L={},v=0,this},ke.removeBinaryOp=function(O){return delete te[O],O.length===ae&&(ae=q(te)),this},ke.removeAllBinaryOps=function(){return te={},ae=0,this},ke.removeLiteral=function(O){return delete me[O],this},ke.removeAllLiterals=function(){return me={},this},e.exports?n=e.exports=ke:n.parse=ke})()}(vr,vr.exports)),vr.exports}var A2=I2();const L2=mt(A2);var gf={"||":function(e,n){return e||n},"&&":function(e,n){return e&&n},"|":function(e,n){return e|n},"^":function(e,n){return e^n},"&":function(e,n){return e&n},"==":function(e,n){return e==n},"!=":function(e,n){return e!=n},"===":function(e,n){return e===n},"!==":function(e,n){return e!==n},"<":function(e,n){return e<n},">":function(e,n){return e>n},"<=":function(e,n){return e<=n},">=":function(e,n){return e>=n},"<<":function(e,n){return e<<n},">>":function(e,n){return e>>n},">>>":function(e,n){return e>>>n},"+":function(e,n){return e+n},"-":function(e,n){return e-n},"*":function(e,n){return e*n},"/":function(e,n){return e/n},"%":function(e,n){return e%n}},$2={"-":function(e){return-e},"+":function(e){return+e},"~":function(e){return~e},"!":function(e){return!e}};function kf(e,n){return e.map(function(r){return we(r,n)})}function _f(e,n){var r,i=we(e.object,n);if(r=e.computed?we(e.property,n):e.property.name,/^__proto__|prototype|constructor$/.test(r))throw Error('Access to member "'+r+'" disallowed.');return[i,i[r]]}function we(e,n){var r=e;switch(r.type){case"ArrayExpression":return kf(r.elements,n);case"BinaryExpression":return gf[r.operator](we(r.left,n),we(r.right,n));case"CallExpression":var i,s,o;return r.callee.type==="MemberExpression"?(i=(o=_f(r.callee,n))[0],s=o[1]):s=we(r.callee,n),typeof s!="function"?void 0:s.apply(i,kf(r.arguments,n));case"ConditionalExpression":return we(r.test,n)?we(r.consequent,n):we(r.alternate,n);case"Identifier":return n[r.name];case"Literal":return r.value;case"LogicalExpression":return r.operator==="||"?we(r.left,n)||we(r.right,n):r.operator==="&&"?we(r.left,n)&&we(r.right,n):gf[r.operator](we(r.left,n),we(r.right,n));case"MemberExpression":return _f(r,n)[1];case"ThisExpression":return n;case"UnaryExpression":return $2[r.operator](we(r.argument,n));default:return}}var zs,wf;function P2(){if(wf)return zs;wf=1;function e(n,r,i,s){for(var o=n.length,l=i+(s?1:-1);s?l--:++l<o;)if(r(n[l],l,n))return l;return-1}return zs=e,zs}var Ws,xf;function R2(){if(xf)return Ws;xf=1;function e(n){return n!==n}return Ws=e,Ws}var Hs,bf;function U2(){if(bf)return Hs;bf=1;function e(n,r,i){for(var s=i-1,o=n.length;++s<o;)if(n[s]===r)return s;return-1}return Hs=e,Hs}var Gs,Cf;function Vf(){if(Cf)return Gs;Cf=1;var e=P2(),n=R2(),r=U2();function i(s,o,l){return o===o?r(s,o,l):e(s,n,l)}return Gs=i,Gs}var Ys,Nf;function j2(){if(Nf)return Ys;Nf=1;var e=Bn(),n=Dn(),r=Sn(),i="[object String]";function s(o){return typeof o=="string"||!n(o)&&r(o)&&e(o)==i}return Ys=s,Ys}var Js,Ef;function q2(){if(Ef)return Js;Ef=1;var e=nf();function n(r){var i=e(r),s=i%1;return i===i?s?i-s:i:0}return Js=n,Js}var Ks,Bf;function z2(){if(Bf)return Ks;Bf=1;var e=Vd();function n(r,i){return e(i,function(s){return r[s]})}return Ks=n,Ks}var Zs,Sf;function W2(){if(Sf)return Zs;Sf=1;function e(n,r){for(var i=-1,s=Array(n);++i<n;)s[i]=r(i);return s}return Zs=e,Zs}var Xs,Tf;function H2(){if(Tf)return Xs;Tf=1;var e=Bn(),n=Sn(),r="[object Arguments]";function i(s){return n(s)&&e(s)==r}return Xs=i,Xs}var Qs,Df;function G2(){if(Df)return Qs;Df=1;var e=H2(),n=Sn(),r=Object.prototype,i=r.hasOwnProperty,s=r.propertyIsEnumerable,o=e(function(){return arguments}())?e:function(l){return n(l)&&i.call(l,"callee")&&!s.call(l,"callee")};return Qs=o,Qs}var Gn={exports:{}},vs,Of;function Y2(){if(Of)return vs;Of=1;function e(){return!1}return vs=e,vs}Gn.exports;var Mf;function J2(){return Mf||(Mf=1,function(e,n){var r=on(),i=Y2(),s=n&&!n.nodeType&&n,o=s&&!0&&e&&!e.nodeType&&e,l=o&&o.exports===s,a=l?r.Buffer:void 0,c=a?a.isBuffer:void 0,d=c||i;e.exports=d}(Gn,Gn.exports)),Gn.exports}var el,Ff;function K2(){if(Ff)return el;Ff=1;var e=Bn(),n=Zm(),r=Sn(),i="[object Arguments]",s="[object Array]",o="[object Boolean]",l="[object Date]",a="[object Error]",c="[object Function]",d="[object Map]",u="[object Number]",m="[object Object]",f="[object RegExp]",h="[object Set]",y="[object String]",p="[object WeakMap]",g="[object ArrayBuffer]",k="[object DataView]",x="[object Float32Array]",S="[object Float64Array]",A="[object Int8Array]",R="[object Int16Array]",C="[object Int32Array]",D="[object Uint8Array]",I="[object Uint8ClampedArray]",M="[object Uint16Array]",j="[object Uint32Array]",L={};L[x]=L[S]=L[A]=L[R]=L[C]=L[D]=L[I]=L[M]=L[j]=!0,L[i]=L[s]=L[g]=L[o]=L[k]=L[l]=L[a]=L[c]=L[d]=L[u]=L[m]=L[f]=L[h]=L[y]=L[p]=!1;function te(q){return r(q)&&n(q.length)&&!!L[e(q)]}return el=te,el}var tl,If;function Z2(){if(If)return tl;If=1;function e(n){return function(r){return n(r)}}return tl=e,tl}var Yn={exports:{}};Yn.exports;var Af;function X2(){return Af||(Af=1,function(e,n){var r=bc(),i=n&&!n.nodeType&&n,s=i&&!0&&e&&!e.nodeType&&e,o=s&&s.exports===i,l=o&&r.process,a=function(){try{var c=s&&s.require&&s.require("util").types;return c||l&&l.binding&&l.binding("util")}catch{}}();e.exports=a}(Yn,Yn.exports)),Yn.exports}var nl,Lf;function Q2(){if(Lf)return nl;Lf=1;var e=K2(),n=Z2(),r=X2(),i=r&&r.isTypedArray,s=i?n(i):e;return nl=s,nl}var rl,$f;function v2(){if($f)return rl;$f=1;var e=W2(),n=G2(),r=Dn(),i=J2(),s=vm(),o=Q2(),l=Object.prototype,a=l.hasOwnProperty;function c(d,u){var m=r(d),f=!m&&n(d),h=!m&&!f&&i(d),y=!m&&!f&&!h&&o(d),p=m||f||h||y,g=p?e(d.length,String):[],k=g.length;for(var x in d)(u||a.call(d,x))&&!(p&&(x=="length"||h&&(x=="offset"||x=="parent")||y&&(x=="buffer"||x=="byteLength"||x=="byteOffset")||s(x,k)))&&g.push(x);return g}return rl=c,rl}var ol,Pf;function eM(){if(Pf)return ol;Pf=1;var e=Object.prototype;function n(r){var i=r&&r.constructor,s=typeof i=="function"&&i.prototype||e;return r===s}return ol=n,ol}var il,Rf;function tM(){if(Rf)return il;Rf=1;function e(n,r){return function(i){return n(r(i))}}return il=e,il}var sl,Uf;function nM(){if(Uf)return sl;Uf=1;var e=tM(),n=e(Object.keys,Object);return sl=n,sl}var ll,jf;function rM(){if(jf)return ll;jf=1;var e=eM(),n=nM(),r=Object.prototype,i=r.hasOwnProperty;function s(o){if(!e(o))return n(o);var l=[];for(var a in Object(o))i.call(o,a)&&a!="constructor"&&l.push(a);return l}return ll=s,ll}var al,qf;function oM(){if(qf)return al;qf=1;var e=v2(),n=rM(),r=As();function i(s){return r(s)?e(s):n(s)}return al=i,al}var cl,zf;function iM(){if(zf)return cl;zf=1;var e=z2(),n=oM();function r(i){return i==null?[]:e(i,n(i))}return cl=r,cl}var dl,Wf;function sM(){if(Wf)return dl;Wf=1;var e=Vf(),n=As(),r=j2(),i=q2(),s=iM(),o=Math.max;function l(a,c,d,u){a=n(a)?a:s(a),d=d&&!u?i(d):0;var m=a.length;return d<0&&(d=o(m+d,0)),r(a)?d<=m&&a.indexOf(c,d)>-1:!!m&&e(a,c,d)>-1}return dl=l,dl}var lM=sM();const aM=mt(lM),Vt={};function cM(e,n,r,i){return e?Array.isArray(e)?e.filter(function(s){const o=ft(s,n);let l;switch(i){case">":l=o>r;break;case"<":l=o<r;break;case">=":l=o>=r;break;case"<=":l=o<=r;break;case"in":l=aM(o,r);break;default:r===void 0?l=o:l=o==r;break}return l}):(console.error("array.filter value was not provided as array",{input:e}),[]):[]}function dM(e){return e.reduce(function(n,r){return n+r},0)}function uM(e,n,r,i,s){if(!e)return[];if(s=s||{},s.flat=r,s.unique=i,!Array.isArray(e))return console.error("array.filter value was not provided as array",{input:e}),[];let o=e.reduce(function(l,a){const c=ft(a,n),d=!c&&c!==!1&&c!==0;return s.excludeNull&&d||l.push(c),l},[]);return s.unique&&(o=[...new Set(o)]),s.flat&&(o=o.flat()),o}function mM(){var e=new Date().getTime().toString(16)+Math.random().toString(16).substring(2)+"0".repeat(16);return`id${e.substr(0,8)}${e.substr(8,4)}${e.substr(12,3)}${e.substr(15,12)}`}function fM(e){var n=new Date(e),r=n instanceof Date&&!isNaN(n);if(!r||isNaN(n.getTime()))return 0;const i=new Date;let s=i.getFullYear()-n.getFullYear();const o=n.getMonth(),l=i.getMonth();return(l<o||l===o&&i.getDate()<n.getDate())&&s--,s}Vt.evaluateExpression=function(e,n){if(typeof e=="function")return e(n);n=Object.assign({},{Math,String,Array,Date,Boolean,parseInt,parseFloat,now:new Date,guid:mM,age:fM,array:{filter:cM,extract:uM,sum:dM},create(o,...l){return new o(...l)}},n);var i,s;try{i=L2(e),s=we(i,n)}catch(o){console.log("There was an error evaluating your expression",{expression:e,error:o,context:n})}finally{}return s};const hM=Array.from({length:6},(e,n)=>new Date().getFullYear()+n).map(function(e){const n=String(e).slice(2);return{title:e,value:n}}),pM={mixins:[z],components:{},props:{submission:{type:Boolean,default:!0},sandbox:{type:Boolean,default:!1},configuration:{type:Object,default(){return{}}},includeOfficeOnly:{type:Boolean,default:!1},modelValue:{type:[Object,Array]},trail:{type:Array,default(){return[]}}},data(){return{}},created(){},watch:{gateways:{async handler(e){const n=this;Array.from(new Set(e.map(function(r){var i;return(i=r.integration)==null?void 0:i.module}))).filter(Boolean),e.length===1&&(n.model.gateway=e[0])},immediate:!0}},computed:{baseAmountVisible(){return this.baseAmount&&!this.visibleModifications.some(function(e){return e.modifier==="set"})},visibleModifications(){return this.calculations.modifications||[]},expressionsContext(){const e={this:this.parentModel,self:this.parentModel,model:this.parentModel,data:this.parentModel};return console.log("Expressions context changed",e),e},requiresPayment(){return this.enabled&&this.calculatedTotal},enabled(){return this.configuration.enabled},gateway(){return this.model.gateway},gatewayIntegration(){var e;return(e=this.gateway)==null?void 0:e.integration},gatewayIntegrationModule(){var e;return(e=this.gatewayIntegration)==null?void 0:e.module},gateways(){return this.configuration.gateways||[]},currency(){return this.configuration.currency},baseAmount(){return parseInt(this.configuration.amount||0)},formattedBaseAmount(){return this.$sdk.utils.formatCurrency(this.baseAmount,this.currency)},modifiers(){return this.configuration.modifiers||[]},activeModifiers(){const e=this,n=this.expressionsContext;return e.modifiers.filter(function(r){return r.condition?Vt.evaluateExpression(r.condition,n):!0})},calculations(){const e=this;let n=[],r=0;e.baseAmount&&(r+=e.baseAmount);function i(o,l){if(!o||(o=Number(o),isNaN(o)))return 0;if(l){var a=o.toFixed(l);o=i(a)}return o}e.activeModifiers.forEach(function(o,l){const a=Object.assign({},e.expressionsContext,{total:r}),c=r;let d=Vt.evaluateExpression(o.expression,a);d=i(d||0,2);const u=e.$sdk.utils.formatCurrency(d,e.currency);let m="";switch(o.modifier){case"add":r=Math.max(0,r+d),m=`+${u}`;break;case"subtract":r=Math.max(0,r-d),m=`-${u}`;break;case"multiply":r=Math.max(0,r*d),m=`x ${d}`;break;case"divide":r=Math.max(0,r/d),m=`÷ ${d}`;break;case"set":r=Math.max(0,d),m="";break}if(c!=r){let f=e.$sdk.utils.formatCurrency(r,e.currency);n.push({title:o.title,summary:m,total:r,result:f,modifier:o.modifier,visible:!0})}});const s=n.findLastIndex(function(o){return o.modifier==="set"});return s!=-1&&(n=n.map(function(o,l){return l<s&&(o.visible=!1),o}),console.log("modifications",s,n)),{modifications:n,total:r}},formattedTotal(){return this.$sdk.utils.formatCurrency(this.calculatedTotal,this.currency)},calculatedTotal(){return this.calculations.total},calculatedTotalFields(){const e=this,n=[];return n.push({title:"Calculated Total",type:"integer",key:"total",widget:"value",minimum:parseInt(e.calculatedTotal)?1:0,maximum:1,expressions:{value(){return e.calculatedTotal}}}),n},subFields(){const e=[],n=[];return n.push({title:"Name on card",key:"name",type:"string",minimum:1,maximum:1,placeholder:"Super Citizen"}),n.push({title:"Card Number",key:"number",type:"string",minimum:1,maximum:1,placeholder:"xxxx xxxx xxxx xxxx"}),n.push({type:"group",sameLine:!0,fields:[{title:"Expiry Month",key:"expMonth",type:"string",minimum:1,maximum:1,minLength:2,maxLength:2,widget:"select",options:[{title:"01",value:"01"},{title:"02",value:"02"},{title:"03",value:"03"},{title:"04",value:"04"},{title:"05",value:"05"},{title:"06",value:"06"},{title:"07",value:"07"},{title:"08",value:"08"},{title:"09",value:"09"},{title:"10",value:"10"},{title:"11",value:"11"},{title:"12",value:"12"}]},{title:"Expiry Year",key:"expYear",type:"string",minimum:1,maximum:1,minLength:2,maxLength:2,widget:"select",options:hM},{title:"CVN",key:"cvc",type:"string",minimum:1,maximum:1,minLength:3,maxLength:3}]}),e.push({title:"Card Details",key:"card",type:"group",asObject:!0,minimum:1,maximum:1,fields:n}),e}},emits:["form:state"],methods:{isSelectedGateway(e){var n;return((n=this.model.gateway)==null?void 0:n.key)===e.key},selectGateway(e){this.model.gateway=e},stateChange(e){this.$emit("form:state",e)},getNewDefaultEntry(){return{}}}},Nt=e=>(t.pushScopeId("data-v-f9a7cc65"),e=e(),t.popScopeId(),e),yM=Nt(()=>t.createElementVNode("h2",null,"Payment Summary",-1)),gM={class:"calculations"},kM=Nt(()=>t.createElementVNode("td",null,"Amount",-1)),_M={class:"running-total"},wM=[Nt(()=>t.createElementVNode("td",null,"Amount",-1)),Nt(()=>t.createElementVNode("td",null," ",-1)),Nt(()=>t.createElementVNode("td",{class:"running-total"}," ",-1))],xM={class:"running-total"},bM={key:0,class:"grand-total"},CM=Nt(()=>t.createElementVNode("td",null,[t.createElementVNode("strong",null,"Total")],-1)),VM=Nt(()=>t.createElementVNode("td",null,null,-1)),NM=Nt(()=>t.createElementVNode("h3",null,"Please select a payment method",-1)),EM=["innerHTML"];function BM(e,n,r,i,s,o){var m,f;const l=t.resolveComponent("ux-form"),a=t.resolveComponent("ux-panel-body"),c=t.resolveComponent("ux-panel"),d=t.resolveComponent("ux-icon"),u=t.resolveComponent("ux-button");return e.multiValue?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createTextVNode(" Invalid configuration ")],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(l,{ref:"form",trail:r.trail,paymentConfiguration:r.configuration,includeOfficeOnly:r.includeOfficeOnly,submission:r.submission,"onForm:state":o.stateChange,parentModel:e.parentModel,modelValue:e.model,"onUpdate:modelValue":n[0]||(n[0]=h=>e.model=h),fields:o.calculatedTotalFields},null,8,["trail","paymentConfiguration","includeOfficeOnly","submission","onForm:state","parentModel","modelValue","fields"]),o.requiresPayment?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[yM,t.createVNode(c,null,{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createElementVNode("table",gM,[t.createElementVNode("tbody",null,[o.baseAmount?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["calculation-modifier",["modifier-set",`modifier-visible-${o.baseAmountVisible}`]])},[kM,t.createElementVNode("td",null,t.toDisplayString(o.formattedBaseAmount),1),t.createElementVNode("td",_M,t.toDisplayString(o.formattedBaseAmount),1)],2)):o.calculatedTotal?(t.openBlock(),t.createElementBlock("tr",{key:1,class:t.normalizeClass(["calculation-modifier",["modifier-set","modifier-visible-true"]])},wM)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.visibleModifications,h=>(t.openBlock(),t.createElementBlock("tr",{class:t.normalizeClass(["calculation-modifier",[`modifier-${h.modifier}`,`modifier-visible-${h.visible}`]])},[t.createElementVNode("td",null,t.toDisplayString(h.title),1),t.createElementVNode("td",null,t.toDisplayString(h.summary),1),t.createElementVNode("td",xM,t.toDisplayString(h.result),1)],2))),256))]),t.createElementVNode("tfoot",null,[o.calculatedTotal?(t.openBlock(),t.createElementBlock("tr",bM,[CM,VM,t.createElementVNode("td",null,[t.createElementVNode("strong",null,t.toDisplayString(o.formattedTotal),1)])])):t.createCommentVNode("",!0)])])]),_:1})]),_:1}),o.gateways.length>1?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[NM,t.createElementVNode("div",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.gateways,h=>(t.openBlock(),t.createBlock(u,{class:"gateway-selector",color:o.isSelectedGateway(h)?"primary":"default",active:o.isSelectedGateway(h),onClick:y=>o.selectGateway(h)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(h.title)+" ",1),t.createVNode(d,{icon:o.isSelectedGateway(h)?"fa-check":"far fa-circle"},null,8,["icon"])]),_:2},1032,["color","active","onClick"]))),256))]),(m=o.gateway)!=null&&m.payLater&&((f=o.gateway)!=null&&f.instructions)?(t.openBlock(),t.createBlock(c,{key:0},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createElementVNode("h5",null,t.toDisplayString(o.gateway.title),1),t.createElementVNode("div",{innerHTML:o.gateway.instructions},null,8,EM)]),_:1})]),_:1})):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0)],64))}const SM=w(pM,[["render",BM],["__scopeId","data-v-f9a7cc65"]]),TM={name:"Signature",props:{modelValue:{type:String,default:""},maxWidth:{type:Number,default:500},aspectRatio:{type:Number,default:2},lineWidth:{type:Number,default:2},lineColor:{type:String,default:""},detectDarkMode:{type:Boolean,default:!0}},emits:["update:modelValue"],data(){return{canvas:null,ctx:null,drawing:!1,lastX:0,lastY:0,currentWidth:0,currentHeight:0,observer:null,isDarkMode:!1,prefersDarkModeQuery:null}},computed:{effectiveLineColor(){return this.lineColor?this.lineColor:this.isDarkMode?"#FFFFFF":"#000000"}},mounted(){this.setupResizeObserver(),this.setupDarkModeDetection(),this.initCanvas(),this.modelValue&&this.loadSignature(this.modelValue),window.addEventListener("resize",this.handleResize)},beforeUnmount(){window.removeEventListener("resize",this.handleResize),this.observer&&this.observer.disconnect(),this.prefersDarkModeQuery&&this.prefersDarkModeQuery.removeEventListener("change",this.handleDarkModeChange)},methods:{setupResizeObserver(){this.observer=new ResizeObserver(()=>{this.handleResize()}),this.observer.observe(this.$el)},setupDarkModeDetection(){this.detectDarkMode&&(window.matchMedia&&(this.prefersDarkModeQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.isDarkMode=this.prefersDarkModeQuery.matches,this.prefersDarkModeQuery.addEventListener("change",this.handleDarkModeChange)),this.checkDarkModeClasses())},handleDarkModeChange(e){this.isDarkMode=e.matches,this.updateCanvasColors()},checkDarkModeClasses(){const e=document.documentElement,n=document.body;(e.classList.contains("dark-mode")||e.classList.contains("dark-theme")||e.classList.contains("dark")||n.classList.contains("dark-mode")||n.classList.contains("dark-theme")||n.classList.contains("dark")||e.getAttribute("data-theme")==="dark"||n.getAttribute("data-theme")==="dark")&&(this.isDarkMode=!0)},updateCanvasColors(){this.ctx&&(this.ctx.strokeStyle=this.effectiveLineColor)},calculateDimensions(){const e=this.$el.clientWidth;this.currentWidth=Math.min(e,this.maxWidth),this.currentHeight=this.currentWidth/this.aspectRatio},initCanvas(){this.canvas=this.$refs.canvas,this.ctx=this.canvas.getContext("2d"),this.calculateDimensions(),this.canvas.width=this.currentWidth,this.canvas.height=this.currentHeight;const e=this.currentWidth/300;this.ctx.lineWidth=this.lineWidth*Math.max(e,1),this.ctx.lineCap="round",this.ctx.lineJoin="round",this.ctx.strokeStyle=this.effectiveLineColor},handleResize(){const e=this.canvas.toDataURL();this.initCanvas(),e!==this.getEmptyCanvasDataUrl()&&this.loadSignature(e)},startDrawing(e){this.drawing=!0;const{x:n,y:r}=this.getCoordinates(e);this.lastX=n,this.lastY=r},draw(e){if(!this.drawing)return;const{x:n,y:r}=this.getCoordinates(e);this.ctx.beginPath(),this.ctx.moveTo(this.lastX,this.lastY),this.ctx.lineTo(n,r),this.ctx.stroke(),this.lastX=n,this.lastY=r,this.updateModel()},stopDrawing(){this.drawing=!1,this.updateModel()},handleTouchStart(e){e.preventDefault(),e.touches.length===1&&this.startDrawing({clientX:e.touches[0].clientX,clientY:e.touches[0].clientY})},handleTouchMove(e){e.preventDefault(),e.touches.length===1&&this.draw({clientX:e.touches[0].clientX,clientY:e.touches[0].clientY})},getCoordinates(e){const n=this.canvas.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}},clearSignature(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.$emit("update:modelValue",null)},updateModel(){const e=this.canvas.toDataURL("image/png"),n=this.getEmptyCanvasDataUrl();e===n?this.$emit("update:modelValue",null):this.$emit("update:modelValue",e)},loadSignature(e){if(!e){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);return}const n=new Image;n.onload=()=>{this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.drawImage(n,0,0,this.canvas.width,this.canvas.height)},n.src=e},getEmptyCanvasDataUrl(){const e=document.createElement("canvas");return e.width=this.currentWidth,e.height=this.currentHeight,e.toDataURL()}}},DM={class:"signature-container"},OM={class:"buttons"};function MM(e,n,r,i,s,o){const l=t.resolveComponent("ux-icon"),a=t.resolveComponent("ux-button");return t.openBlock(),t.createElementBlock("div",DM,[t.createElementVNode("canvas",{ref:"canvas",class:"signature-canvas",onMousedown:n[0]||(n[0]=(...c)=>o.startDrawing&&o.startDrawing(...c)),onMousemove:n[1]||(n[1]=(...c)=>o.draw&&o.draw(...c)),onMouseup:n[2]||(n[2]=(...c)=>o.stopDrawing&&o.stopDrawing(...c)),onMouseleave:n[3]||(n[3]=(...c)=>o.stopDrawing&&o.stopDrawing(...c)),onTouchstart:n[4]||(n[4]=(...c)=>o.handleTouchStart&&o.handleTouchStart(...c)),onTouchmove:n[5]||(n[5]=(...c)=>o.handleTouchMove&&o.handleTouchMove(...c)),onTouchend:n[6]||(n[6]=(...c)=>o.stopDrawing&&o.stopDrawing(...c))},null,544),t.createElementVNode("div",OM,[t.createVNode(a,{size:"sm",onClick:o.clearSignature},{default:t.withCtx(()=>[t.createTextVNode(" Clear "),t.createVNode(l,{right:"",icon:"fa-times"})]),_:1},8,["onClick"])])])}const FM={components:{signature:w(TM,[["render",MM],["__scopeId","data-v-d6d646d4"]])},props:{modelValue:{type:[String,null],default:null}},mixins:[z],methods:{getNewDefaultEntry(){return null}}},IM={key:0,class:"ux-field-title"},AM={key:0,class:"ux-required-marker"},LM={key:1,class:"ux-field-description"},$M={key:2};function PM(e,n,r,i,s,o){const l=t.resolveComponent("signature"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("ux-icon"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("flex-row");return t.openBlock(),t.createElementBlock(t.Fragment,null,[e.showLabel?(t.openBlock(),t.createElementBlock("label",IM,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",AM,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",LM,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.multiValue?(t.openBlock(),t.createElementBlock("div",$M,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.model,(m,f)=>(t.openBlock(),t.createBlock(u,{class:"ux-signature-row",gap:"",key:f},{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(l,{class:"ux-field-focus ux-signature-input ux-signature-input-multiple",onFocus:e.touch,ref_for:!0,ref:"input",modelValue:e.model[f],"onUpdate:modelValue":h=>e.model[f]=h},null,8,["onFocus","modelValue","onUpdate:modelValue"])]),_:2},1024),t.createVNode(a,{shrink:"",vcenter:""},{default:t.withCtx(()=>[e.canRemoveValue?(t.openBlock(),t.createBlock(d,{key:0,tag:"a",icon:"",onClick:h=>e.remove(m)},{default:t.withCtx(()=>[t.createVNode(c,{icon:"fa-times"})]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024))),128)),e.canAddValue?(t.openBlock(),t.createBlock(d,{key:0,onClick:n[0]||(n[0]=m=>e.add())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.addLabel),1)]),_:1})):t.createCommentVNode("",!0)])):(t.openBlock(),t.createBlock(l,{key:3,type:"color",class:"ux-field-focus ux-signature-input ux-signature-input-single",onFocus:e.touch,modelValue:e.model,"onUpdate:modelValue":n[1]||(n[1]=m=>e.model=m)},null,8,["onFocus","modelValue"]))],64)}const RM=w(FM,[["render",PM],["__scopeId","data-v-afb76f23"]]);function UM(e){return e===void 0||typeof e>"u"||e===null||String(e)==="null"||String(e)==="undefined"}const jM={props:{title:{type:String},modelValue:{}},mixins:[z],created(){this.model=this.model},methods:{cleanOutput(e){var n=this;return UM(e)?n.multiValue?e=[]:e=void 0:n.multiValue?e=(e||[]).filter(Boolean).map(function(r){return n.getValue(r)}):e=n.getValue(e),e},cleanInput(e){var n=this;if(n.multiValue)e||(e=[]),Array.isArray(e)||(e=[e]),n.maximum&&e.length>n.maximum&&(e.length=n.maximum),e=e.filter(Boolean).map(function(i){var s=n.getValue(i);return n.returnObject?n.optionLookup[s]:s});else{var r=n.getValue(e);e=n.returnObject?n.optionLookup[r]:r}return e}},computed:{interface(){var e=this.$sdk.global.editor;if(e)return e.model},returnObject(){return!1},classes(){var e=[];return this.multiValue?e.push("multiple"):e.push("single"),e},optionLookup(){var e=this;return e.actualOptions.reduce(function(n,r){const i=e.getValue(r);return n[i]=r,n},{})},summary(){return this.model?this.getLabel(this.optionLookup[this.model]):this.title||"Click to select"},dynamicRoutesOnly(){return!!this.field.dynamicRoutesOnly},actualOptions(){const e=this;if(!e.interface)return[];var n=[];r(e.interface.routes);function r(i,s){s||(s=0),i.forEach(function(o){o.type!="folder"&&n.push({route:o,depth:s}),o.routes&&o.routes.length&&r(o.routes,s+1)})}return n.filter(function({route:i}){const s=(i.path||"").includes("/:");return e.dynamicRoutesOnly?s:!s}).map(function({route:i,depth:s}){var o="-".repeat(s);return{title:`${o}${i.title}`,value:i.name}})},selectableOptions(){return this.actualOptions||[]}}},qM={key:0,class:"ux-field-title"},zM={key:0,class:"ux-required-marker"},WM={key:1,class:"ux-field-description"},HM={key:0,class:"ui-select-button"},GM=["multiple"],YM={key:0,value:""},JM=["value"],KM={key:3,class:"ui-select-button"};function ZM(e,n,r,i,s,o){const l=t.resolveComponent("ux-button");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["native-select",o.classes])},[e.showLabel?(t.openBlock(),t.createElementBlock("label",qM,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",zM,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",WM,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),o.selectableOptions.length?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[e.singleValue?(t.openBlock(),t.createElementBlock("div",HM,[t.renderSlot(e.$slots,"default",{},()=>[t.createVNode(l,{tag:"div"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.summary),1)]),_:1})],!0)])):t.createCommentVNode("",!0),t.withDirectives(t.createElementVNode("select",{onFocus:n[0]||(n[0]=(...a)=>e.touch&&e.touch(...a)),multiple:e.multiValue,"onUpdate:modelValue":n[1]||(n[1]=a=>e.model=a)},[e.singleValue&&!e.minimum?(t.openBlock(),t.createElementBlock("option",YM,"None")):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.selectableOptions,a=>(t.openBlock(),t.createElementBlock("option",{value:a.value},t.toDisplayString(a.title),9,JM))),256))],40,GM),[[t.vModelSelect,e.model]])],64)):(t.openBlock(),t.createElementBlock("div",KM,[t.createVNode(l,{tag:"div"},{default:t.withCtx(()=>[t.createTextVNode(" No valid routes ")]),_:1})]))],2)}const XM=w(jM,[["render",ZM],["__scopeId","data-v-a9c5a05f"]]);function QM(e){return e===void 0||typeof e>"u"||e===null||String(e)==="null"||String(e)==="undefined"}const vM={props:{title:{type:String},modelValue:{}},mixins:[z],created(){this.model=this.model},methods:{cleanOutput(e){var n=this;return QM(e)?n.multiValue?e=[]:e=void 0:n.multiValue?e=(e||[]).filter(Boolean).map(function(r){return n.getValue(r)}):e=n.getValue(e),e},cleanInput(e){var n=this;if(n.multiValue)e||(e=[]),Array.isArray(e)||(e=[e]),n.maximum&&e.length>n.maximum&&(e.length=n.maximum),e=e.filter(Boolean).map(function(i){var s=n.getValue(i);return n.returnObject?n.optionLookup[s]:s});else{var r=n.getValue(e);e=n.returnObject?n.optionLookup[r]:r}return e}},computed:{interface(){var e=this.$sdk.global.editor;if(e)return e.model},returnObject(){return!1},classes(){var e=[];return this.multiValue?e.push("multiple"):e.push("single"),e},optionLookup(){var e=this;return e.actualOptions.reduce(function(n,r){const i=e.getValue(r);return n[i]=r,n},{})},summary(){return this.model?this.getLabel(this.optionLookup[this.model]):this.title||"Click to select"},actualOptions(){return this.interface?this.interface.menus.map(function(e){return{title:e.title,value:e.name}}):[]},selectableOptions(){return this.actualOptions}}},eF={key:0,class:"ux-field-title"},tF={key:0,class:"ux-required-marker"},nF={key:1,class:"ux-field-description"},rF={key:2,class:"ui-select-button"},oF=["multiple"],iF={key:0,value:""},sF=["value"];function lF(e,n,r,i,s,o){const l=t.resolveComponent("ux-button");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["native-select",o.classes])},[e.showLabel?(t.openBlock(),t.createElementBlock("label",eF,[t.createTextVNode(t.toDisplayString(e.label)+" ",1),e.required?(t.openBlock(),t.createElementBlock("span",tF,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),e.showDescription?(t.openBlock(),t.createElementBlock("div",nF,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0),e.singleValue?(t.openBlock(),t.createElementBlock("div",rF,[t.renderSlot(e.$slots,"default",{},()=>[t.createVNode(l,{tag:"div"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.summary),1)]),_:1})],!0)])):t.createCommentVNode("",!0),t.withDirectives(t.createElementVNode("select",{onFocus:n[0]||(n[0]=(...a)=>e.touch&&e.touch(...a)),multiple:e.multiValue,"onUpdate:modelValue":n[1]||(n[1]=a=>e.model=a)},[e.singleValue&&!e.minimum?(t.openBlock(),t.createElementBlock("option",iF,"None")):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.selectableOptions,a=>(t.openBlock(),t.createElementBlock("option",{value:a.value},t.toDisplayString(a.title),9,sF))),256))],40,oF),[[t.vModelSelect,e.model]])],2)}const aF=w(vM,[["render",lF],["__scopeId","data-v-8801d1a0"]]),Et={props:{options:{type:Object,default(){return{}}}},data(){return{}},provide(){return{isInModal:!0,closeParentModal:e=>this.close(e),dismissParentModal:e=>this.dismiss(e)}},emits:["dismiss","close"],methods:{dismiss(e){this.$emit("dismiss",e)},close(e){this.$emit("close",e)}}},cF={data(){return{selection:{}}},mixins:[Et],computed:{keys(){const e=[];for(var n in this.selection)this.selection[n]&&e.push(n);return e},definition(){return this.options.definition},fields(){const e=this;if(!e.definition)return[];let n=e.definition.fields.filter(function(r){return!r.readOnly}).map(function(r){switch(r.key){case"data":r.title="Custom Fields";break}return r});return n=e.$sdk.utils.mapFields(n,{includeLayout:!0,original:!0}),n=n.map(function(r){if(!r.path.startsWith("meta")){switch(r.selectTitle=r.titles.filter(Boolean).join(" › "),r.path){case"dob":return[{...r,selectTitle:"Date of birth › Date Picker",title:"Date of Birth",key:"dob",path:"dob:date",type:"date",widget:"datepicker",dateOnly:!0,style:{marginLeft:`${(r.trail.length*1-1)*2}em`}},{...r,selectTitle:"Date of birth › Date Fields",title:"Date of Birth",key:"dob",path:"dob:object",type:"object",widget:"dateobject",dateOnly:!0,style:{marginLeft:`${(r.trail.length*1-1)*2}em`}}];case"dobDay":return;case"dobMonth":return;case"dobYear":return;case"data":r.selectTitle="All Custom Fields";break}return r.style={marginLeft:`${(r.trail.length*1-1)*2}em`},r}}).flat().filter(Boolean).sort(function(r,i){return r.selectTitle<i.selectTitle?-1:r.selectTitle>i.selectTitle?1:0}).sort(function(r,i){const s=r.path==="data"||r.path.startsWith("data."),o=i.path==="data"||i.path.startsWith("data.");return s&&!o?1:o&&!s||r.path<i.path?-1:r.path>i.path?1:0}),n}},methods:{isSelected(e){return this.selection[e.path]},isParentSelected(e){return this.keys.some(function(n){return e.path!=n&&e.path.startsWith(n)})},done(){const e=this.selection,n=JSON.parse(JSON.stringify(this.fields)),r={},i=[];function s(o,l){l.forEach(function(a){if(e[a.path]&&!r[a.path]){r[a.path]=!0,o.push(a);return}const c=a.fields||[];c.length&&(a.fields=[],s(a.fields,c),a.fields.length&&o.push(a))})}s(i,n),this.close(i)},toggle(e){this.selection[e.path]=!this.selection[e.path],console.log(e)}}},dF={class:"wrapper"},uF={class:"header"},mF=["onClick"],fF={class:"font-sm font-muted"};function hF(e,n,r,i,s,o){const l=t.resolveComponent("flex-cell"),a=t.resolveComponent("ux-button"),c=t.resolveComponent("flex-row"),d=t.resolveComponent("flex-header"),u=t.resolveComponent("ux-checkbox"),m=t.resolveComponent("flex-body"),f=t.resolveComponent("flex-column");return t.openBlock(),t.createElementBlock("div",dF,[t.createVNode(f,null,{default:t.withCtx(()=>[t.createVNode(d,null,{default:t.withCtx(()=>[t.createElementVNode("div",uF,[t.createVNode(c,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.createElementVNode("h3",null,"Select "+t.toDisplayString(o.definition.title)+" fields to add",1)]),_:1}),t.createVNode(l,{shrink:""},{default:t.withCtx(()=>[t.createVNode(a,{onClick:e.dismiss},{default:t.withCtx(()=>[t.createTextVNode("Cancel")]),_:1},8,["onClick"])]),_:1}),t.createVNode(l,{shrink:""},{default:t.withCtx(()=>[t.createVNode(a,{color:"primary",onClick:o.done},{default:t.withCtx(()=>[t.createTextVNode("Done")]),_:1},8,["onClick"])]),_:1})]),_:1})])]),_:1}),t.createVNode(m,{class:"body-area"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.fields,h=>(t.openBlock(),t.createElementBlock("a",{class:t.normalizeClass(["field-item",{selected:o.isSelected(h),parented:o.isParentSelected(h)}]),style:t.normalizeStyle(h.style),onClick:y=>o.toggle(h)},[t.createVNode(c,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(l,{shrink:""},{default:t.withCtx(()=>[t.createVNode(u,{value:o.isSelected(h)||o.isParentSelected(h)},null,8,["value"])]),_:2},1024),t.createVNode(l,null,{default:t.withCtx(()=>[t.createElementVNode("strong",null,t.toDisplayString(h.selectTitle),1)]),_:2},1024),t.createVNode(l,{shrink:"",class:"font-muted"},{default:t.withCtx(()=>[t.createElementVNode("div",fF,t.toDisplayString(h.path),1)]),_:2},1024)]),_:2},1024)],14,mF))),256))]),_:1})]),_:1})])}const pF=w(cF,[["render",hF],["__scopeId","data-v-73221a58"]]),yF={props:{modelValue:{type:Object},referenceType:{type:String}},data(){return{model:this.modelValue}},watch:{referenceType:{async handler(e){e&&await this.$glossary.ensure(e)},immediate:!0}},computed:{glossary(){return this.$glossary.hash},definition(){return this.glossary[this.referenceType]}},inject:{addFields:{default(){}}},methods:{async openModal(){const e=this,n=await e.$sdk.modal({component:pF,options:{definition:e.definition}});n.length&&e.addFields&&e.addFields(n)}}},gF={key:0};function kF(e,n,r,i,s,o){const l=t.resolveComponent("ux-icon"),a=t.resolveComponent("ux-button");return o.definition?(t.openBlock(),t.createElementBlock("div",gF,[t.createVNode(a,{color:"primary",onClick:o.openModal},{default:t.withCtx(()=>[t.createTextVNode("Include additional "+t.toDisplayString(o.definition.title)+" fields ",1),t.createVNode(l,{icon:"fa-plus"})]),_:1},8,["onClick"])])):t.createCommentVNode("",!0)}const _F=w(yF,[["render",kF]]);function ul(e){switch(String(e).toLowerCase()){case"true":case"y":case"yes":case"1":case"t":e=!0;break;case"false":case"n":case"no":case"0":case"f":case"undefined":case"null":case"":case"-1":e=!1;break}return!!e}function Jn(e,n,r,i,s,o){n=n||[],r=Math.max(r,i);var l=n.length,a=l>=r;if(!a){var c=r-l;console.log("ARRAY",{meetsMinimum:a,array:n,extras:d,difference:c,min:r,max:s});var d=Array(c).fill().map(o);return[...n||[],...d||[]]}return n}function wF(e,n){function r(f){return f===void 0||typeof f>"u"||f===null}var i=parseInt(e.minimum),s=parseInt(e.maximum),o=parseInt(e.ask||0);o=Math.max(o,i),o=s?Math.min(o,s):o;var l=s===1;e.asObject&&e.type==="group"&&(s===1&&i===1?l=!0:l=!1);var a=!l,c=(e.type==="reference"?e.defaultReferences:e.defaultValues)||[],d=c[0],u;switch(e.type){case"date":let f=function(h){switch(String(h).toLowerCase()){case"now":return new Date}return new Date(h)};a?(c.length&&(s?u=c.slice(0,s).map(function(h){return f(h)}):u=c.slice().map(function(h){return f(h)})),u=Jn(e,u,i,o,s,function(){return f(new Date)})):u=r(d)?void 0:f(d);break;case"integer":case"decimal":case"number":case"float":a?(c.length&&(s?u=c.slice(0,s).map(function(h){return Number(h)}):u=c.slice().map(function(h){return Number(h)})),u=Jn(e,u,i,o,s,function(){return""})):u=r(d)?void 0:Number(d);break;case"group":if(e.asObject){var m=o;a?m>0?u=Array(m).fill().map(function(){return{}}):u=[]:u=r(d)?{}:d}break;case"object":var m=o;a?m>0?u=Array(m).fill().map(function(){return{}}):u=[]:u=r(d)?{}:d;break;case"boolean":a?(c.length&&(s?u=c.slice(0,s).map(function(h){return ul(h)}):u=c.slice().map(function(h){return ul(h)})),u=Jn(e,u,i,o,s,function(){})):u=r(d)?!1:ul(d);break;case"reference":if(e.widget==="form"){var m=o;a?m>0?u=Array(m).fill().map(function(){return{}}):u=[]:i?u=r(d)?{}:d:u=void 0}else a?c.length?s?u=c.slice(0,s):u=c.slice():u=[]:u=r(d)?void 0:d;break;case"string":a?(c.length&&(s?u=c.slice(0,s):u=c.slice()),u=Jn(e,u,i,o,s,function(){return""}).filter(Boolean)):u=r(d)?"":d;break;default:a?(c.length&&(u=c.slice(0,s)),u=Jn(e,u,i,o,s,function(){})):u=r(d)?"":d;break}return u}function pe(e){return function(){var n=this;if(!n.expressions)return;let r=n.expressions[e];if(!r)return;let i=n.expressionsContext;return Vt.evaluateExpression(r,i)}}const xF={emits:["field:mount","field:unmount","field:focus","field:blur","field:invalid","field:valid","field:error","field:touched","field:dirty","update:modelValue"],components:{InternalRouteSelect:XM,InternalMenuSelect:aF,InternalFieldCreator:_F,ButtonSelect:GD,NativeSelect:Ke,DateField:Wm,TimeField:Gm,DateRange:HB,TextField:Os,KeyField:yB,CurrencyField:zm,TextArea:NB,Checkbox:XB,FilterInput:VT,FieldSelect:uf,DateObjectInput:TS,SliderInput:QT,ColorInput:lD,CustomHtml:rS,BooleanSwitch:fD,FieldGroup:LD,ContentSelect:Pm,ContentSearch:qN,ValueSearch:eE,TypeSelect:mE,ScopeSelect:qm,FieldSelect:uf,TimezoneSelect:om,CountrySelect:ds,PhoneNumberInput:dV,Upload:VD,Signature:RM,ObjectField:eO,ModelField:cO,OptionsManager:SO,CodeEditorField:$O,LocationField:f2,ExpressionField:b2,RichTextField:F2,PaymentField:SM},props:{trail:{type:Array,default(){return[]}},submission:{type:Boolean,default:!1},ignoreDefaults:{type:Boolean,default:!1},sandbox:{type:Boolean,default:!1},paymentConfiguration:{type:Object},field:{type:Object,required:!0},parentModel:{type:Object},modelValue:{type:Object,required:!0},includeOfficeOnly:{type:Boolean,default:!1}},data(){return{definedField:this.field,watching:!0,defaultValue:null,model:this.modelValue,touched:!1,focussed:!1,validateResults:{valid:!0},mounted:!1,subFormState:{},isDirty:!1,isDirtyBeforeInput:!1,appeared:!1}},inject:{parentFormElement:{default(){}},directParentModel:{default(){}},directFormElement:{default(){}},additionalContext:{default(){}},fieldIsHovered:{default(){}},fieldIsSelected:{default(){}},selectField:{default(){}},mouseOverField:{default(){}},mouseOutField:{default(){}}},provide(){return{fieldPath:this.fieldPath,directParentModel:this.model}},created(){this.checkDirtyState(!0)},mounted(){const e=this;e.mounted=!0,e.directFormElement&&e.directFormElement.childFormElements&&e.directFormElement.childFormElements.push(e),e.parentFormElement&&e.parentFormElement.childFormElements&&e.parentFormElement.childFormElements.push(e)},beforeUnmount(){const e=this;if(e.mounted=!1,e.directFormElement){var n=e.directFormElement.childFormElements.indexOf(e);e.directFormElement.childFormElements.splice(n,1)}if(e.parentFormElement){var n=e.parentFormElement.childFormElements.indexOf(e);e.parentFormElement.childFormElements.splice(n,1)}},methods:{clicked(e){const n=this;n.selectField&&n.sandbox&&(n.selectField(n.field),e.stopImmediatePropagation(),e.stopPropagation())},hoverover(){const e=this;e.sandbox&&e.mouseOverField&&e.mouseOverField(e.field)},hoverout(){const e=this;e.sandbox&&e.mouseOutField&&e.mouseOutField(e.field)},fieldDefaultValue(){var s,o;var e=this.expressions&&this.expressions.value?this.getExpressionValue:void 0;if(e)return e;var n=this.expressions&&this.expressions.defaultValue?this.getExpressionDefaultValue:void 0,r=wF(this.actualField),i=this.cleanInput(n||r);if((s=this.field)!=null&&s.assumeDefault){if(!i&&this.widget==="timezone"&&(i=this.$sdk.geo.getDefaultTimezone(),console.log("Set the default timezone:",i)),!i&&this.widget==="country"){const l=this.$sdk.geo.getDefaultCountry();i=l==null?void 0:l.name,console.log("Set the default country:",l,i)}!i&&((o=this.field)==null?void 0:o.type)==="date"&&(i=new Date)}return i},checkDirtyState(e){const n=this;var r=n.fieldModel,i=n.ignoreDefaults||r||r===!1||r===0,s=n.fieldDefaultValue(),o=JSON.stringify(n.cleanOutput(r)),l=JSON.stringify(n.cleanOutput(s));let a;e?a=i:a=i&&o!=l,a?(n.isDirty=!0,n.isDirtyBeforeInput=!0,n.fieldModel=r):(n.isDirty=!1,n.isDirtyBeforeInput=!1,n.fieldModel=s),n.validateResults=n.$sdk.content.validateField(n.fieldModel,n.actualField)},groupStateAltered(e){this.subFormState=e},focus(){this.focussed=!0},blur(){this.focussed=!1,this.expressions&&this.expressions.value&&(this.fieldModel=this.getExpressionValue)},touch(){this.touched=!0},untouch(){this.touched=!1},reset(){this.untouch(),this.watching=!1;var e=this.fieldDefaultValue();Array.isArray(e)&&(e=[]),this.model[this.key]=e,this.$nextTick(function(){this.watching=!0})},cleanInput(e){return this.fieldCleanInput(e)},cleanOutput(e){return this.fieldCleanOutput(e)},fieldCleanInput(e){var i;var n=this,r=(i=n.expressions)==null?void 0:i.transform;return r&&typeof r.set=="function"&&(e=r.set(e)),n.field.type==="key"&&(e=String(n.$sdk.utils.machineName(e||"")||"").trim()),e},fieldCleanOutput(e){var i;var n=this,r=(i=n.expressions)==null?void 0:i.transform;return r&&typeof r.get=="function"&&(e=r.get(e)),e}},watch:{isSelected(e){var n;e&&(n=this.$el)!=null&&n.scrollIntoView&&this.$el.scrollIntoView({behavior:"smooth",block:"center"})},mounted(e){e?this.$emit("field:mount",this):this.$emit("field:unmount",this)},visible(e,n){const r=this;e?r.untouch():(r.touched=!1,r.expressions&&r.expressions.value?r.fieldModel=r.getExpressionValue:r.ignoreDefaults||(r.fieldModel=void 0))},focussed(e){e?this.$emit("field:focus",this):this.$emit("field:blur",this)},invalid(e){this.$emit("field:invalid",this)},valid(e){this.$emit("field:valid",this)},error(e){this.$emit("field:error",this)},touched(e){this.$emit("field:touched",this)},dirty(e){this.$emit("field:dirty",this)},changeString(e){this.validateResults=this.$sdk.content.validateField(this.fieldModel,this.actualField)},modelValue(e,n){this.watching&&(this.model=e,this.touched=!1,this.checkDirtyState())},async getExpressionHide(e,n){!e&&n&&(this.appeared=!0,await this.$nextTick(),this.appeared=!1)},getExpressionDefaultValue(e){this.isDirtyBeforeInput||this.touched&&this.dirty||(this.fieldModel=e)},getExpressionValue(e){this.fieldModel=e}},computed:{isSelected(){return this.fieldIsSelected&&this.fieldIsSelected(this.field)},isHovered(){return this.fieldIsHovered&&this.fieldIsHovered(this.field)},shouldIgnoreDefaults(){return this.ignoreDefaults&&!this.appeared},fieldPath(){return this.currentTrail.join(".")},currentTrail(){var e=this.trail.slice();return e.push(this.field.key),e},title(){return this.field.title},minimum(){return parseInt(this.actualField.minimum)},maximum(){return parseInt(this.actualField.maximum)},actualField(){var e=this.field,n=e;return this.getExpressionRequired&&(n=Object.assign({},n,{minimum:1})),this.getExpressionTitle&&(n=Object.assign({},n,{title:this.getExpressionTitle})),this.getExpressionDescription&&(n=Object.assign({},n,{description:this.getExpressionDescription})),this.getExpressionPlaceholder&&(n=Object.assign({},n,{placeholder:this.getExpressionPlaceholder})),this.getExpressionReferenceType&&(n=Object.assign({},n,{referenceType:this.getExpressionReferenceType})),this.getExpressionAllDay&&(n=Object.assign({},n,{allDay:this.getExpressionAllDay})),this.getExpressionVisualHide&&(n=Object.assign({},n,{visualHide:this.getExpressionVisualHide})),this.getExpressionWidgetType&&(n=Object.assign({},n,{widget:this.getExpressionWidgetType})),this.getExpressionDataType&&(n=Object.assign({},n,{type:this.getExpressionDataType})),this.getExpressionOptions&&(n=Object.assign({},n,{options:this.getExpressionOptions})),this.getExpressionSyntax&&(n=Object.assign({},n,{syntax:this.getExpressionSyntax})),this.getExpressionFields&&(n=Object.assign({},n,{fields:this.getExpressionFields})),this.getExpressionMinValue&&(n=Object.assign({},n,{minValue:this.getExpressionMinValue})),this.getExpressionMinDate&&(n=Object.assign({},n,{minDate:this.getExpressionMinDate})),this.getExpressionMaxDate&&(n=Object.assign({},n,{maxDate:this.getExpressionMaxDate})),this.getExpressionStepValue&&(n=Object.assign({},n,{stepValue:this.getExpressionStepValue})),this.getExpressionMaxValue&&(n=Object.assign({},n,{maxValue:this.getExpressionMaxValue})),this.getExpressionCurrency&&(n=Object.assign({},n,{currency:this.getExpressionCurrency})),n},changeString(){const e=this.fieldModel;return`${$i(e)}-${this.actualField.minimum}-${this.actualField.referenceType}`},valid(){return!this.invalid},error(){return!this.focussed&&this.touched&&this.invalid},invalid(){var s,o,l;const e=((s=this.field)==null?void 0:s.type)==="group"&&!((o=this.field)!=null&&o.asObject),n=((l=this.field)==null?void 0:l.type)==="void";if(e||n)return!1;var r=this.subFormState&&this.subFormState.invalid;if(r)return{invalidSubForm:this.subFormState,mounted:this.mounted};var i=!this.validateResults.valid;return this.hidden?!1:i},dirty(){return this.isDirty},getExpressionHide(){if(!this.expressions)return;let e=this.expressions.show,n=this.expressions.hide,r=this.expressionsContext,i;return e?i=!Vt.evaluateExpression(e,r):n&&(i=Vt.evaluateExpression(n,r)),i},getExpressionTitle:pe("title"),getExpressionDescription:pe("description"),getExpressionPlaceholder:pe("placeholder"),getExpressionRequired:pe("required"),getExpressionDefaultValue:pe("defaultValue"),getExpressionValue:pe("value"),getExpressionReferenceType:pe("referenceType"),getExpressionAllDay:pe("allDay"),getExpressionWidgetType:pe("widget"),getExpressionDataType:pe("type"),getExpressionOptions:pe("options"),getExpressionSyntax:pe("syntax"),getExpressionFields:pe("fields"),getExpressionCurrency:pe("currency"),getExpressionMinValue:pe("minValue"),getExpressionStepValue:pe("stepValue"),getExpressionMaxValue:pe("maxValue"),getExpressionMinDate:pe("minDate"),getExpressionMaxDate:pe("maxDate"),getExpressionVisualHide:pe("visualHide"),expressions(){var e;return(e=this.field)==null?void 0:e.expressions},expressionUser(){return this.user?this.user:this.$sdk.auth.getCurrentUser()},expressionsContext(){var c;const e=this,{firstName:n,lastName:r,email:i}=e.expressionUser||{},s={firstName:n,lastName:r,email:i};var o=((c=e.additionalContext)==null?void 0:c.value)||e.additionalContext||{};const l=e.directParentModel;return{this:e.model,self:e.model,model:e.model,data:e.parentModel||e.model,parent:l,additional:{...o},user:s}},officeOnly(){return this.submission&&this.field.officeOnly},hidden(){var e;return this.officeOnly&&!this.includeOfficeOnly||(e=this.actualField)!=null&&e.readOnly?!0:this.getExpressionHide},visible(){return this.field&&this.mounted&&!this.hidden},type(){var e;return((e=this.actualField)==null?void 0:e.type)||"string"},key(){var e;return(e=this.actualField)==null?void 0:e.key},isGroup(){return this.type==="group"},asObject(){return this.widget==="form"||this.isGroup&&this.actualField.asObject},visualHide(){var e;return(e=this.actualField)==null?void 0:e.visualHide},layoutGroup(){return this.isGroup&&!this.actualField.asObject},fieldModel:{get(){return this.cleanOutput(this.model[this.key])},set(e){var n=this.cleanInput(e);this.model[this.key]!=n&&(this.model[this.key]=n,this.isDirty=!0,this.$emit("update:modelValue",this.model))}},sourceModel:{get(){return this.model},set(e){this.model=e,this.$emit("update:modelValue",this.model)}},classes(){var e=[];return e.push(`ux-field-${this.type}`),e.push(`ux-field-widget-${this.widget}`),this.widget==="form"&&this.minimum===1&&this.maximum===1&&e.push("ux-layout-only"),this.isHovered&&e.push("hover"),this.isSelected&&e.push("selected"),this.layoutGroup&&e.push("ux-layout-only"),this.touched&&e.push("ux-field-touched"),this.dirty&&e.push("ux-field-dirty"),this.valid&&e.push("ux-field-valid"),this.invalid&&e.push("ux-field-invalid"),this.error&&e.push("ux-field-error"),this.visualHide&&e.push("ux-field-hide"),e},component(){return this.field.component},widget(){if(this.type=="group")return this.type;var e=this.actualField.widget;switch(e){case"form":e=this.submission?"form":"content-select";break;case"upload":e=this.submission&&!this.includeOfficeOnly?"upload":"content-select";break;case"content-search":case"value-search":return e;case"location":case"payment":case"internal-menu":case"internal-route":case"internal-field-creator":case"content-select":case"select":case"checkbox":case"daterange":case"richtext":case"textarea":case"switch":case"email":case"url":case"currency":case"timezone":case"country":case"code":case"expression":case"options":case"type-select":case"scope-select":case"field-select":case"html":case"dateobject":case"filter":case"value":case"slider":case"color":case"model":case"signature":break;case"button":case"buttons":case"buttonselect":return"button";case"date":case"datefield":case"datepicker":return"datefield";case"timefield":case"timepicker":return"timefield";case"password":return"textfield";case"key":case"keyfield":return"keyfield";case"phone":case"phonenumber":return"phone";default:switch(this.type){case"date":e="datefield";break;case"reference":e="content-select";break;case"boolean":e="checkbox";break;default:case"string":e="textfield";break;case"object":e="object";break}break}return e}}},bF={key:2,class:"ux-field-message"};function CF(e,n,r,i,s,o){const l=t.resolveComponent("text-field"),a=t.resolveComponent("key-field"),c=t.resolveComponent("internal-route-select"),d=t.resolveComponent("internal-menu-select"),u=t.resolveComponent("internal-field-creator"),m=t.resolveComponent("custom-html"),f=t.resolveComponent("slider-input"),h=t.resolveComponent("color-input"),y=t.resolveComponent("filter-input"),p=t.resolveComponent("date-object-input"),g=t.resolveComponent("signature"),k=t.resolveComponent("checkbox"),x=t.resolveComponent("boolean-switch"),S=t.resolveComponent("upload"),A=t.resolveComponent("field-group"),R=t.resolveComponent("field-select"),C=t.resolveComponent("native-select"),D=t.resolveComponent("button-select"),I=t.resolveComponent("currency-field"),M=t.resolveComponent("form-relationship-field"),j=t.resolveComponent("date-field"),L=t.resolveComponent("time-field"),te=t.resolveComponent("date-range"),q=t.resolveComponent("content-select"),v=t.resolveComponent("content-search"),ae=t.resolveComponent("value-search"),me=t.resolveComponent("type-select"),Ye=t.resolveComponent("scope-select"),Re=t.resolveComponent("rich-text-field"),Bt=t.resolveComponent("text-area"),tt=t.resolveComponent("timezone-select"),Ue=t.resolveComponent("country-select"),at=t.resolveComponent("phone-number-input"),ke=t.resolveComponent("object-field"),O=t.resolveComponent("model-field"),V=t.resolveComponent("payment-field"),je=t.resolveComponent("options-manager"),St=t.resolveComponent("code-editor-field"),xe=t.resolveComponent("flex-column"),ne=t.resolveComponent("location-field"),Zt=t.resolveComponent("expression-field");return o.visible?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["ux-field",o.classes]),onFocusin:n[43]||(n[43]=(...b)=>o.focus&&o.focus(...b)),onFocusout:n[44]||(n[44]=(...b)=>o.blur&&o.blur(...b)),onMouseover:n[45]||(n[45]=t.withModifiers((...b)=>o.hoverover&&o.hoverover(...b),["stop"])),onMouseout:n[46]||(n[46]=t.withModifiers((...b)=>o.hoverout&&o.hoverout(...b),["stop"])),onClick:n[47]||(n[47]=b=>o.clicked(b))},[o.component?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.component),{key:0,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[0]||(n[0]=b=>o.fieldModel=b)},null,40,["onTouched","field","modelValue"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[o.widget=="textfield"?(t.openBlock(),t.createBlock(l,{key:0,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[1]||(n[1]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="keyfield"?(t.openBlock(),t.createBlock(a,{key:1,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[2]||(n[2]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="internal-route"?(t.openBlock(),t.createBlock(c,{key:2,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[3]||(n[3]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="internal-menu"?(t.openBlock(),t.createBlock(d,{key:3,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[4]||(n[4]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="internal-field-creator"?(t.openBlock(),t.createBlock(u,{key:4,modelValue:s.definedField,"onUpdate:modelValue":n[5]||(n[5]=b=>s.definedField=b),referenceType:o.actualField.referenceType},null,8,["modelValue","referenceType"])):t.createCommentVNode("",!0),o.widget=="html"?(t.openBlock(),t.createBlock(m,{key:5,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[6]||(n[6]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="value"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:6},[],64)):t.createCommentVNode("",!0),o.widget=="slider"?(t.openBlock(),t.createBlock(f,{key:7,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[7]||(n[7]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="color"?(t.openBlock(),t.createBlock(h,{key:8,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[8]||(n[8]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="filter"?(t.openBlock(),t.createBlock(y,{key:9,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[9]||(n[9]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="dateobject"?(t.openBlock(),t.createBlock(p,{key:10,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[10]||(n[10]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="signature"?(t.openBlock(),t.createBlock(g,{key:11,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[11]||(n[11]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="checkbox"?(t.openBlock(),t.createBlock(k,{key:12,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[12]||(n[12]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="switch"?(t.openBlock(),t.createBlock(x,{key:13,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[13]||(n[13]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="upload"?(t.openBlock(),t.createBlock(S,{key:14,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[14]||(n[14]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="group"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:15},[o.asObject?(t.openBlock(),t.createBlock(A,{key:0,trail:o.currentTrail,paymentConfiguration:r.paymentConfiguration,includeOfficeOnly:r.includeOfficeOnly,submission:r.submission,ignoreDefaults:o.shouldIgnoreDefaults,sandbox:r.sandbox,"onForm:state":o.groupStateAltered,ref:"group",onTouched:o.touch,field:o.actualField,parentModel:r.parentModel,modelValue:o.fieldModel,"onUpdate:modelValue":n[15]||(n[15]=b=>o.fieldModel=b)},null,8,["trail","paymentConfiguration","includeOfficeOnly","submission","ignoreDefaults","sandbox","onForm:state","onTouched","field","parentModel","modelValue"])):(t.openBlock(),t.createBlock(A,{key:1,trail:r.trail,paymentConfiguration:r.paymentConfiguration,includeOfficeOnly:r.includeOfficeOnly,submission:r.submission,ignoreDefaults:o.shouldIgnoreDefaults,sandbox:r.sandbox,"onForm:state":o.groupStateAltered,ref:"group",onTouched:o.touch,field:o.actualField,parentModel:r.parentModel,modelValue:o.sourceModel,"onUpdate:modelValue":n[16]||(n[16]=b=>o.sourceModel=b)},null,8,["trail","paymentConfiguration","includeOfficeOnly","submission","ignoreDefaults","sandbox","onForm:state","onTouched","field","parentModel","modelValue"]))],64)):t.createCommentVNode("",!0),o.widget=="form"?(t.openBlock(),t.createBlock(A,{key:16,trail:o.currentTrail,paymentConfiguration:r.paymentConfiguration,includeOfficeOnly:r.includeOfficeOnly,submission:r.submission,ignoreDefaults:o.shouldIgnoreDefaults,sandbox:r.sandbox,"onForm:state":o.groupStateAltered,ref:"group",onTouched:o.touch,field:o.actualField,parentModel:r.parentModel,modelValue:o.fieldModel,"onUpdate:modelValue":n[17]||(n[17]=b=>o.fieldModel=b)},null,8,["trail","paymentConfiguration","includeOfficeOnly","submission","ignoreDefaults","sandbox","onForm:state","onTouched","field","parentModel","modelValue"])):t.createCommentVNode("",!0),o.widget=="field-select"?(t.openBlock(),t.createBlock(R,{key:17,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[18]||(n[18]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="select"?(t.openBlock(),t.createBlock(C,{key:18,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[19]||(n[19]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="button"?(t.openBlock(),t.createBlock(D,{key:19,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[20]||(n[20]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="currency"?(t.openBlock(),t.createBlock(I,{key:20,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[21]||(n[21]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="form-relationship"?(t.openBlock(),t.createBlock(M,{key:21,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[22]||(n[22]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="datefield"?(t.openBlock(),t.createBlock(j,{key:22,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[23]||(n[23]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="timefield"?(t.openBlock(),t.createBlock(L,{key:23,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[24]||(n[24]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="daterange"?(t.openBlock(),t.createBlock(te,{key:24,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[25]||(n[25]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="content-select"?(t.openBlock(),t.createBlock(q,{key:25,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[26]||(n[26]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="content-search"?(t.openBlock(),t.createBlock(v,{key:26,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[27]||(n[27]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="value-search"?(t.openBlock(),t.createBlock(ae,{key:27,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[28]||(n[28]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="type-select"?(t.openBlock(),t.createBlock(me,{key:28,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[29]||(n[29]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="scope-select"?(t.openBlock(),t.createBlock(Ye,{key:29,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[30]||(n[30]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="richtext"?(t.openBlock(),t.createBlock(Re,{key:30,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[31]||(n[31]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="textarea"?(t.openBlock(),t.createBlock(Bt,{key:31,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[32]||(n[32]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="timezone"?(t.openBlock(),t.createBlock(tt,{key:32,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[33]||(n[33]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="country"?(t.openBlock(),t.createBlock(Ue,{key:33,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[34]||(n[34]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="phone"?(t.openBlock(),t.createBlock(at,{key:34,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[35]||(n[35]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="value"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:35},[],64)):t.createCommentVNode("",!0),o.widget=="object"?(t.openBlock(),t.createBlock(ke,{key:36,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[36]||(n[36]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="model"?(t.openBlock(),t.createBlock(O,{key:37,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[37]||(n[37]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="payment"?(t.openBlock(),t.createBlock(V,{key:38,sandbox:r.sandbox,configuration:r.paymentConfiguration,"onForm:state":o.groupStateAltered,field:o.actualField,onTouched:o.touch,parentModel:r.parentModel,modelValue:o.fieldModel,"onUpdate:modelValue":n[38]||(n[38]=b=>o.fieldModel=b)},null,8,["sandbox","configuration","onForm:state","field","onTouched","parentModel","modelValue"])):t.createCommentVNode("",!0),o.widget=="options"?(t.openBlock(),t.createBlock(je,{key:39,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[39]||(n[39]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="code"?(t.openBlock(),t.createBlock(xe,{key:40,style:{"min-height":"300px"}},{default:t.withCtx(()=>[t.createVNode(St,{onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[40]||(n[40]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])]),_:1})):t.createCommentVNode("",!0),o.widget=="location"?(t.openBlock(),t.createBlock(ne,{key:41,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[41]||(n[41]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0),o.widget=="expression"?(t.openBlock(),t.createBlock(Zt,{key:42,onTouched:o.touch,field:o.actualField,modelValue:o.fieldModel,"onUpdate:modelValue":n[42]||(n[42]=b=>o.fieldModel=b)},null,8,["onTouched","field","modelValue"])):t.createCommentVNode("",!0)],64)),o.error&&s.validateResults.message?(t.openBlock(),t.createElementBlock("div",bF,t.toDisplayString(s.validateResults.message),1)):t.createCommentVNode("",!0)],34)):t.createCommentVNode("",!0)}const eo=w(xF,[["render",CF],["__scopeId","data-v-ec394390"]]);var ml,Hf;function VF(){if(Hf)return ml;Hf=1;function e(n,r,i,s){var o=-1,l=n==null?0:n.length;for(s&&l&&(i=n[++o]);++o<l;)i=r(i,n[o],o,n);return i}return ml=e,ml}var fl,Gf;function NF(){if(Gf)return fl;Gf=1;function e(n){return function(r){return n==null?void 0:n[r]}}return fl=e,fl}var hl,Yf;function EF(){if(Yf)return hl;Yf=1;var e=NF(),n={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},r=e(n);return hl=r,hl}var pl,Jf;function BF(){if(Jf)return pl;Jf=1;var e=EF(),n=Oi(),r=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,i="\\u0300-\\u036f",s="\\ufe20-\\ufe2f",o="\\u20d0-\\u20ff",l=i+s+o,a="["+l+"]",c=RegExp(a,"g");function d(u){return u=n(u),u&&u.replace(r,e).replace(c,"")}return pl=d,pl}var yl,Kf;function SF(){if(Kf)return yl;Kf=1;var e=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function n(r){return r.match(e)||[]}return yl=n,yl}var gl,Zf;function TF(){if(Zf)return gl;Zf=1;var e=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function n(r){return e.test(r)}return gl=n,gl}var kl,Xf;function DF(){if(Xf)return kl;Xf=1;var e="\\ud800-\\udfff",n="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",s=n+r+i,o="\\u2700-\\u27bf",l="a-z\\xdf-\\xf6\\xf8-\\xff",a="\\xac\\xb1\\xd7\\xf7",c="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",d="\\u2000-\\u206f",u=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",m="A-Z\\xc0-\\xd6\\xd8-\\xde",f="\\ufe0e\\ufe0f",h=a+c+d+u,y="['’]",p="["+h+"]",g="["+s+"]",k="\\d+",x="["+o+"]",S="["+l+"]",A="[^"+e+h+k+o+l+m+"]",R="\\ud83c[\\udffb-\\udfff]",C="(?:"+g+"|"+R+")",D="[^"+e+"]",I="(?:\\ud83c[\\udde6-\\uddff]){2}",M="[\\ud800-\\udbff][\\udc00-\\udfff]",j="["+m+"]",L="\\u200d",te="(?:"+S+"|"+A+")",q="(?:"+j+"|"+A+")",v="(?:"+y+"(?:d|ll|m|re|s|t|ve))?",ae="(?:"+y+"(?:D|LL|M|RE|S|T|VE))?",me=C+"?",Ye="["+f+"]?",Re="(?:"+L+"(?:"+[D,I,M].join("|")+")"+Ye+me+")*",Bt="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",tt="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ue=Ye+me+Re,at="(?:"+[x,I,M].join("|")+")"+Ue,ke=RegExp([j+"?"+S+"+"+v+"(?="+[p,j,"$"].join("|")+")",q+"+"+ae+"(?="+[p,j+te,"$"].join("|")+")",j+"?"+te+"+"+v,j+"+"+ae,tt,Bt,k,at].join("|"),"g");function O(V){return V.match(ke)||[]}return kl=O,kl}var _l,Qf;function OF(){if(Qf)return _l;Qf=1;var e=SF(),n=TF(),r=Oi(),i=DF();function s(o,l,a){return o=r(o),l=a?void 0:l,l===void 0?n(o)?i(o):e(o):o.match(l)||[]}return _l=s,_l}var wl,vf;function MF(){if(vf)return wl;vf=1;var e=VF(),n=BF(),r=OF(),i="['’]",s=RegExp(i,"g");function o(l){return function(a){return e(r(n(a).replace(s,"")),l,"")}}return wl=o,wl}var xl,eh;function FF(){if(eh)return xl;eh=1;var e=MF(),n=e(function(r,i,s){return r+(s?"-":"")+i.toLowerCase()});return xl=n,xl}var IF=FF();const AF=mt(IF),LF={emits:["field:unmount","field:mount","field:dirty","field:invalid","field:valid","field:error","field:focus","field:blur","field:touch","form:state","update:modelValue"],props:{step:{type:Number},parentModel:{type:Object},parentForm:{type:Object},trail:{type:Array,default(){return[]}},fields:{type:Array,default(){return[]}},modelValue:{type:Object,default(){return{}}},flex:{type:Boolean,default:!1},submission:{type:Boolean,default:!1},ignoreDefaults:{type:Boolean,default:!1},sandbox:{type:Boolean,default:!1},paymentConfiguration:{type:Object},includeOfficeOnly:{type:Boolean,default:!1}},inject:{form:{default(){}},parentFormElement:{default(){}}},watch:{modelValue(e,n){this.model=e}},data(){return{mounted:!1,model:this.modelValue,touched:!1,invalid:!1,error:!1,dirty:!1,focussed:!1}},created(){this.childFormElements=[]},provide(){return{parentFormElement:this.parentFormElement||this,directFormElement:this}},mounted(){const e=this;e.mounted=!0},beforeUnmount(){const e=this;e.mounted=!1},methods:{getCurrentFormState(){const e=this;var n=!1,r=!1,i=!1,s=!1,o=!1,l=[],a=new Map;function c(u,m){const f=m.split(".").pop();return`${u}:${f}`}function d(u,m=""){var y,p,g,k,x,S,A;if(!u.visible)return;const f=((y=u.field)==null?void 0:y.type)==="group"&&!((p=u.field)!=null&&p.asObject),h=((g=u.field)==null?void 0:g.type)==="void";if(u.invalid&&typeof u.invalid=="boolean"&&!((x=(k=u.subFormState)==null?void 0:k.invalidFields)!=null&&x.length)){if(f||h)return;const R=m?`${m}.${u.field.key}`:u.field.key,C=c(u.field.title,R),D={title:u.field.title,key:R,message:((S=u.validateResults)==null?void 0:S.message)||`Please provide a valid value for ${u.field.title}`};if(a.has(C)){const I=a.get(C);if(R.length>I.key.length){a.set(C,D);const M=l.findIndex(j=>j===I);M!==-1&&(l[M]=D)}}else a.set(C,D),l.push(D)}(A=u.subFormState)!=null&&A.invalidFields&&u.subFormState.invalidFields.length>0&&u.subFormState.invalidFields.forEach(R=>{const C=f?m?`${m}.${R.key}`:R.key:m?`${m}.${u.field.key}.${R.key}`:`${u.field.key}.${R.key}`,D=c(R.title,C),I={...R,key:C};if(a.has(D)){const M=a.get(D);if(C.length>M.key.length){a.set(D,I);const j=l.findIndex(L=>L===M);j!==-1&&(l[j]=I)}}else a.set(D,I),l.push(I)})}return e.childFormElements.forEach(function(u){u.dirty&&(n=!0),u.invalid&&d(u),u.error&&(i=!0),u.touched&&(s=!0),u.focussed&&(o=!0)}),r=l.length>0,e.dirty=n,e.error=i,e.touched=s,e.focussed=o,e.invalid=r,{dirty:n,error:i,focussed:o,touched:s,invalid:r,valid:!r,invalidFields:l}},getFieldKey(e){let n=AF(`${e.title}-${e.key}`);return e.incrementor&&(n=`${n}-${e.incrementor}`),n},touch(){(this.childFormElements||[]).forEach(function(e){e.touch()}),this.touched=!0},untouch(){(this.childFormElements||[]).forEach(function(e){e.untouch()}),this.touched=!1},reset(){this.untouch(),(this.childFormElements||[]).forEach(function(e){e.reset()}),this.model={}},fieldUnmounted(e){this.fieldStateChange(e,"unmount"),this.$emit("field:unmount",this)},fieldMounted(e){this.fieldStateChange(e,"unmount"),this.$emit("field:mount",this)},fieldDirty(e){this.fieldStateChange(e,"dirty"),this.$emit("field:dirty",this)},fieldInvalid(e){this.fieldStateChange(e,"invalid"),this.$emit("field:invalid",this)},fieldValid(e){this.fieldStateChange(e,"valid"),this.$emit("field:valid",this)},fieldError(e){this.fieldStateChange(e,"error"),this.$emit("field:error",this)},fieldFocus(e){this.fieldStateChange(e,"focus"),this.$emit("field:focus",this)},fieldBlur(e){this.fieldStateChange(e,"blur"),this.$emit("field:blur",this)},fieldTouch(e){this.fieldStateChange(e,"touch"),this.$emit("field:touch",this)},fieldStateChange(e,n){var r=this;r.$nextTick(function(){r.$emit("form:state",r.getCurrentFormState())})}},components:{UxField:eo},computed:{currentTrail(){return this.trail},fieldHash(){return this.renderFields.reduce(function(e,n){return n&&(e[n.key]=n),e},{})},valid(){return!this.invalid},formClass(){var e=[];return this.flex&&e.push("ux-form-flex"),(this.step||this.step===0)&&e.push(`ux-form-step-${this.step}`),e},fieldClass(){var e=[];return this.flex&&e.push("ux-field-flex"),e},formModel:{get(){return this.model},set(e){this.model=e,this.$emit("update:modelValue",this.model)}},renderFields(){return this.fields.filter(function(e){if(e)return e.includeIf&&typeof e.includeIf=="function"?e.includeIf(e):e.excludeIf&&typeof e.excludeIf=="function"?!e.excludeIf(e):!0})}}};function $F(e,n,r,i,s,o){const l=t.resolveComponent("ux-field");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["ux-form",o.formClass])},[t.renderSlot(e.$slots,"above",{model:o.formModel},void 0,!0),t.renderSlot(e.$slots,"fields",{fields:o.renderFields,hash:o.fieldHash},()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.renderFields,(a,c)=>(t.openBlock(),t.createBlock(l,{ref_for:!0,ref:"field",trail:o.currentTrail,sandbox:r.sandbox,submission:r.submission,ignoreDefaults:r.ignoreDefaults,paymentConfiguration:r.paymentConfiguration,includeOfficeOnly:r.includeOfficeOnly,"onField:mount":o.fieldMounted,"onField:unmount":o.fieldUnmounted,"onField:dirty":o.fieldDirty,"onField:invalid":o.fieldInvalid,"onField:valid":o.fieldValid,"onField:error":o.fieldError,"onField:focus":o.fieldFocus,"onField:blur":o.fieldBlur,"onField:touched":o.fieldTouch,field:a,modelValue:o.formModel,"onUpdate:modelValue":n[0]||(n[0]=d=>o.formModel=d),parentModel:r.parentModel||o.formModel,class:t.normalizeClass([o.fieldClass,{"ux-field-clear":a.clear}]),key:`ux-form-field-${o.getFieldKey(a)}-${c}`},null,8,["trail","sandbox","submission","ignoreDefaults","paymentConfiguration","includeOfficeOnly","onField:mount","onField:unmount","onField:dirty","onField:invalid","onField:valid","onField:error","onField:focus","onField:blur","onField:touched","field","modelValue","parentModel","class"]))),128))],!0),t.renderSlot(e.$slots,"below",{model:o.formModel},void 0,!0)],2)}const bl=w(LF,[["render",$F],["__scopeId","data-v-e6afec75"]]),Cl="form.ready",PF="form.processing",th="form.complete",nh="form.error",RF="form.intent",UF={emits:["reset","processing","intent","success","error"],methods:{multiFormStateUpdated(e,n){n===this.currentPage&&(this.formState=e,this.currentFormIsInvalid&&this.checkPageValidity())},formStateUpdated(e){this.formState=e,this.currentFormIsInvalid&&this.checkPageValidity()},softReset(){this.processing=!1,this.state=Cl},touch(){this.$refs.form&&(Array.isArray(this.$refs.form)?this.$refs.form.forEach(function(e){e.touch()}):this.$refs.form.touch())},untouch(){this.$refs.form&&(Array.isArray(this.$refs.form)?this.$refs.form.forEach(function(e){e.untouch()}):this.$refs.form.untouch())},reset(){this.model={},this.intent=null,this.currentPage=0,this.$refs.form&&(Array.isArray(this.$refs.form)?this.$refs.form.forEach(function(e){e.reset()}):this.$refs.form.reset()),this.state=Cl,this.error=null,this.submitAttempted=!1,this.processing=!1,this.$emit("reset")},async confirmIntention(){const e=this;e.processing=!0,e.$emit("processing");const n=e.$sdk.utils.id(e.intent),r=e.$refs.elms,i=e.$refs.stripePayment,s=window.location.href;await r.instance.confirmPayment({elements:i.elements,redirect:"if_required",confirmParams:{return_url:s}}),e.$sdk.api.post(`/form/capture/${n}`).then(o,l);async function o({data:a}){await e.postSubmit(a),e.processing=!1,e.state=th,e.$emit("success",a)}async function l(a){var c;a=((c=a.response)==null?void 0:c.data)||a,e.error=a,e.processing=!1,e.state=nh,e.$emit("error",a)}},async submit(){const e=this;if(e.touch(),e.submitAttempted||(e.submitAttempted=!0,e.touch()),e.buttonDisabled){console.log("Form is invalid",this.invalidFields);return}e.processing=!0,e.state=PF,e.$emit("processing");const{submission:n,error:r}=await e.preSubmit(e.model);if(r)return console.log("pre submit error",r),a(r);const i={},s=new URLSearchParams(window.location.search);for(const[c,d]of s)i[c]=d;e.$sdk.api.post(`/form/${e.formID}`,{data:n,sandbox:e.sandbox,gtm:i,request:e.$sdk.utils.id(e.formRequest),event:e.$sdk.utils.id(e.event)}).then(function(c){const{data:d}=c;return d.submission?l(c.data):d.intent?o(c.data):a({message:"Unexpected response from server",status:500,statusCode:500})},a);async function o({intent:c}){switch(console.log("Submission intent was returned",c),e.intent=c,e.intentModule){case"stripe":await e.$sdk.utils.loadExternalScript("https://js.stripe.com/v3/");break}e.state=RF,e.processing=!1,e.$emit("intent",c)}async function l(c){await e.postSubmit(c),e.processing=!1,e.state=th,e.$emit("success",c)}async function a(c){var d;c=((d=c.response)==null?void 0:d.data)||c,e.error=c,e.processing=!1,e.state=nh,e.$emit("error",c)}},async preSubmit(e){var o,l;const n=this,r=JSON.parse(JSON.stringify(e)),i=(o=r._payment)==null?void 0:o.total,s=(l=r._payment)==null?void 0:l.gateway;if(n.form.hasGeographicRequirements){const{coords:a}=await n.$sdk.geo.getPosition().catch(function(c){return console.log("Error",c),{coords:void 0}});if(!a||!a.latitude||!a.longitude)return{error:{message:"Location data is required to submit this form. Please allow location to continue.",status:400,statusCode:400}};r._geo={latitude:a.latitude,longitude:a.longitude,altitude:a.altitude,accuracy:a.accuracy}}return i?s?(s.integration,{submission:r}):{error:{message:"No gateway selected",status:400,statusCode:400}}:{submission:r}},async postSubmit(e){},checkPageValidity(){const e=this.$refs.form[this.currentPage];e.touch(),this.currentFormIsInvalid=e.invalid},nextPageAttempt(){this.checkPageValidity(),!this.currentFormIsInvalid&&this.nextPage()},nextPage(){this.currentPage++,this.$nextTick(function(){this.touch(),this.$nextTick(function(){this.untouch()})})},previousPage(){this.movedBackwards=!0,this.currentPage--,this.$nextTick(function(){this.movedBackwards=!1,this.checkPageValidity()})}},components:{UxForm:bl,StripeElements:To,StripeElement:So},provide(){return{form:this.form}},props:{submitText:{type:String,default(){return"Submit"}},modelValue:{type:Object,default(){return{}}},event:{type:String},formRequest:{type:String},form:{type:Object,required:!0},multistep:{type:Boolean,default:!1},preview:{type:Boolean,default:!1},autoadvance:{type:Boolean,default:!1},sandbox:{type:Boolean,default:!1},showBlockers:{type:Boolean,default:!1}},watch:{currentPage(e){const n=this.$refs.form[e],r=n.getCurrentFormState();this.formState=r,this.$nextTick(function(){n.$el.scrollIntoView({smooth:!0})})},canAdvance(e){if(!this.movedBackwards&&e&&this.autoadvance){const n=this.$refs.form[this.currentPage],r=(n==null?void 0:n.fields)||[],i=this.$sdk.utils.mapFields(r).filter(function({type:s}){switch(s){case"void":return!1}return!0});console.log("Lets autoadvance!!!"),i.length==1&&this.nextPageAttempt()}},modelValue(e,n){this.model=e},model(e){this.$emit("update:modelValue",e)}},data(){return{movedBackwards:!1,submitAttempted:!1,formState:null,state:Cl,mounted:!1,model:this.modelValue,error:null,intent:null,processing:!1,actualCurrentPage:0,currentFormIsInvalid:!1}},mounted(){this.mounted=!0},beforeUnmount(){this.mounted=!1},computed:{invalidFields(){var e;return!this.showBlockers||!this.submitAttempted?[]:this.buttonDisabled?((e=this.formState)==null?void 0:e.invalidFields)||[]:[]},canAdvance(){var e;return!!((e=this.formState)!=null&&e.valid)},paymentEnabled(){var e;return!!((e=this.paymentConfiguration)!=null&&e.enabled)},requiresPayment(){var e;return this.paymentEnabled?parseInt((e=this.model._payment)==null?void 0:e.total)>0:!1},currentPageFields(){return[this.pages[this.actualCurrentPage]]},pages(){return this.formFields},currentPage:{get(){return this.actualCurrentPage},set(e){e>this.totalPages&&(e=this.totalPages),e<0&&(e=0),this.actualCurrentPage=e}},totalPages(){return this.pages.length-1},displayCurrentPage(){return this.currentPage+1},displayTotalPages(){return this.totalPages+1},displayPercentage(){return Math.round(this.displayCurrentPage/this.displayTotalPages*100)},previousPageEnabled(){return this.currentPage>0},nextPageEnabled(){return!(!(this.currentPage<this.totalPages)||this.autoadvance&&!this.canAdvance)},submittable(){return this.currentPage===this.totalPages},payment(){return this.model._payment},total(){var e;return(e=this.payment)==null?void 0:e.total},formattedTotal(){return this.$sdk.utils.formatCurrency(this.payment.total,this.payment.currency)},intentModule(){return this.intentAction.module},intentAction(){var e;return((e=this.intent)==null?void 0:e.actionDetails)||{}},stripeIntent(){var n,r;if(this.intentModule!=="stripe")return;const e=(r=(n=this.intentAction)==null?void 0:n.paymentIntent)==null?void 0:r.client_secret;return{module:"stripe",key:this.intentAction.key,clientSecret:e,instanceOptions:{clientSecret:e},elementOptions:{clientSecret:e}}},formFields(){const e=[...this.fields];return this.paymentEnabled&&e.push({title:"Payment",type:"object",key:"_payment",widget:"payment",asObject:!0,minimum:1,maximum:1}),e},classes(){const e=[];return this.formID&&e.push(`form-${this.formID}`),e},tooltip(){return this.buttonDisabled?"Please check the errors in your form":void 0},buttonDisabled(){return this.preview?!0:this.noGatewaySelectedButPaymentIsRequired?(console.error("There is no payment gateway selected but payment is required"),!0):this.submitAttempted&&this.invalid},noGatewaySelectedButPaymentIsRequired(){return this.total?!this.payment.gateway:!1},invalid(){var n;var e=(n=this.formState)==null?void 0:n.invalid;return e?(console.error("Form is invalid",this.formState.invalid),!0):this.noGatewaySelectedButPaymentIsRequired},formID(){return this.$sdk.utils.id(this.form)},paymentConfiguration(){var e;return((e=this.form)==null?void 0:e.paymentConfiguration)||{}},fields(){var e;return((e=this.form)==null?void 0:e.fields)||[]}}},rh=e=>(t.pushScopeId("data-v-495d5e95"),e=e(),t.popScopeId(),e),jF=rh(()=>t.createElementVNode("h3",null,"An error occurred",-1)),qF={key:0},zF={key:1},WF={key:2},HF={class:"intent-submit"},GF={key:0,class:"multistep-form"},YF={class:"multistep-form-sections"},JF={class:"multistep-fields"},KF={class:"multistep-controls"},ZF=["tooltip"],XF=["tooltip"],QF={class:"multistep-progress"},vF={key:0,class:"invalid-field-message"},eI=rh(()=>t.createElementVNode("h5",null,"Please fix the issues below to continue",-1)),tI=["tooltip"];function nI(e,n,r,i,s,o){const l=t.resolveComponent("ux-icon"),a=t.resolveComponent("ux-button"),c=t.resolveComponent("ux-panel-body"),d=t.resolveComponent("ux-panel"),u=t.resolveComponent("StripeElement"),m=t.resolveComponent("StripeElements"),f=t.resolveComponent("ux-form"),h=t.resolveComponent("flex-cell"),y=t.resolveComponent("flex-row"),p=t.resolveComponent("ux-progress-bar");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["ux-submission-form",o.classes])},[s.state==="form.error"?t.renderSlot(e.$slots,"error",t.normalizeProps(t.mergeProps({key:0},{error:s.error,softReset:o.softReset})),()=>{var g;return[jF,s.error.message?(t.openBlock(),t.createElementBlock("pre",qF,t.toDisplayString(s.error.message),1)):t.createCommentVNode("",!0),(g=s.error.data)!=null&&g.errors?(t.openBlock(),t.createElementBlock("div",zF,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.error.data.errors,k=>(t.openBlock(),t.createElementBlock("pre",{key:k.path},t.toDisplayString(k.message),1))),128))])):(t.openBlock(),t.createElementBlock("pre",WF,t.toDisplayString(s.error),1)),t.createVNode(a,{color:"primary",onClick:o.softReset},{default:t.withCtx(()=>[t.createTextVNode(" Try again "),t.createVNode(l,{right:"",icon:"fa-undo"})]),_:1},8,["onClick"])]},!0):s.state==="form.complete"?t.renderSlot(e.$slots,"default",{key:1,reset:o.reset},()=>[t.createTextVNode(" Thank you "),t.createVNode(a,{onClick:o.reset},{default:t.withCtx(()=>[t.createTextVNode(" Back to form ")]),_:1},8,["onClick"])],!0):s.state==="form.intent"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[o.intentModule==="stripe"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(d,null,{default:t.withCtx(()=>[t.createVNode(c,null,{default:t.withCtx(()=>[t.createTextVNode(" Total: "+t.toDisplayString(o.formattedTotal),1)]),_:1})]),_:1}),o.stripeIntent?(t.openBlock(),t.createBlock(m,{key:0,ref:"elms","stripe-key":o.stripeIntent.key,"instance-options":o.stripeIntent.instanceOptions,"elements-options":o.stripeIntent.elementOptions},{default:t.withCtx(({elements:g,instance:k})=>[t.createVNode(u,{ref:"stripePayment",type:"payment",elements:g},null,8,["elements"])]),_:1},8,["stripe-key","instance-options","elements-options"])):t.createCommentVNode("",!0),t.createElementVNode("div",HF,[t.createVNode(a,{color:"primary",onClick:o.confirmIntention},{default:t.withCtx(()=>[t.createTextVNode(" Confirm Payment ")]),_:1},8,["onClick"])])],64)):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[r.multistep?(t.openBlock(),t.createElementBlock("div",GF,[t.createElementVNode("div",YF,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.pages,(g,k)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["multistep-form-section",{inactive:k!==o.currentPage,past:k<o.currentPage,future:k>o.currentPage,active:k===o.currentPage}])},[t.createElementVNode("div",JF,[t.createVNode(f,{step:k+1,submission:"",sandbox:r.sandbox,ref_for:!0,ref:"form",paymentConfiguration:o.paymentConfiguration,modelValue:s.model,"onUpdate:modelValue":n[0]||(n[0]=x=>s.model=x),"onForm:state":x=>o.multiFormStateUpdated(x,k),fields:[g]},null,8,["step","sandbox","paymentConfiguration","modelValue","onForm:state","fields"])]),t.createElementVNode("div",KF,[t.createVNode(y,{gap:"",center:""},{default:t.withCtx(()=>[o.previousPageEnabled?(t.openBlock(),t.createBlock(h,{key:0,shrink:""},{default:t.withCtx(()=>[t.createVNode(a,{link:"",onClick:o.previousPage},{default:t.withCtx(()=>[t.createTextVNode(" Back ")]),_:1},8,["onClick"])]),_:1})):t.createCommentVNode("",!0),t.createVNode(h),o.nextPageEnabled?(t.openBlock(),t.createBlock(h,{key:1,shrink:""},{default:t.withCtx(()=>[t.createElementVNode("span",{class:"tooltip-span",tooltip:s.currentFormIsInvalid?"Please fix errors to continue":null},[t.createVNode(a,{color:"primary",onClick:o.nextPageAttempt,disabled:s.currentFormIsInvalid},{default:t.withCtx(()=>[t.createTextVNode(" Next "),t.createVNode(l,{icon:"fa-angle-right",right:""})]),_:1},8,["onClick","disabled"])],8,ZF)]),_:1})):t.createCommentVNode("",!0),o.submittable?(t.openBlock(),t.createBlock(h,{key:2,shrink:""},{default:t.withCtx(()=>[t.createElementVNode("span",{tooltip:o.tooltip},[t.createVNode(a,{disabled:o.buttonDisabled,color:"primary",onClick:o.submit,loading:s.processing},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(r.submitText),1)]),_:1},8,["disabled","onClick","loading"])],8,XF)]),_:1})):t.createCommentVNode("",!0)]),_:1})])],2))),256))]),t.createElementVNode("div",QF,[t.createTextVNode(t.toDisplayString(o.displayCurrentPage)+" of "+t.toDisplayString(o.displayTotalPages)+" ",1),t.createVNode(p,{value:o.displayPercentage},null,8,["value"])])])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(f,{submission:"",sandbox:r.sandbox,ref:"form",paymentConfiguration:o.paymentConfiguration,modelValue:s.model,"onUpdate:modelValue":n[1]||(n[1]=g=>s.model=g),"onForm:state":o.formStateUpdated,fields:o.formFields},null,8,["sandbox","paymentConfiguration","modelValue","onForm:state","fields"]),o.invalidFields.length?(t.openBlock(),t.createElementBlock("div",vF,[eI,(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.invalidFields,g=>(t.openBlock(),t.createElementBlock("div",{key:g.key},t.toDisplayString(g.message||`Please provide a valid answer for ${g.title}`),1))),128))])):t.createCommentVNode("",!0),t.createElementVNode("span",{tooltip:o.tooltip},[t.createVNode(a,{disabled:o.buttonDisabled,color:"primary",onClick:o.submit,loading:s.processing},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(r.submitText),1)]),_:1},8,["disabled","onClick","loading"])],8,tI)],64))],64))],2)}const oh=w(UF,[["render",nI],["__scopeId","data-v-495d5e95"]]),rI="init",ih="ready",oI="processing",iI="success",sI="error",lI={name:"PaymentMethodForm",components:{StripeElements:To,StripeElement:So},emits:["close","success","error"],props:{sandbox:{type:Boolean},formKey:{type:String,default(){return String(Math.random())}},stripeKey:{type:String,required:!0},integration:{type:String,required:!0},askEmail:{type:Boolean},modelValue:{type:Object,default(){return{}}}},async created(){const e=this;e.$sdk.utils.loadExternalScript("https://js.stripe.com/v3/").then(function(){e.initialised=!0,e.state=ih})},computed:{allSetup(){return this.stripeKey&&this.initialised},activeUser(){var e;return((e=this.$sdk.app)==null?void 0:e.user)||this.$sdk.auth.getCurrentUser()},integrationID(){return this.$sdk.utils.id(this.integration)},invalid(){return this.processing||!(this.dataModel.name||"").trim()},impersonatorName(){var e,n;return[(e=this.activeUser)==null?void 0:e.impersonatorFirstName,(n=this.activeUser)==null?void 0:n.impersonatorLastName].filter(Boolean).join(" ").trim()},actualName(){var e,n;return[(e=this.activeUser)==null?void 0:e.firstName,(n=this.activeUser)==null?void 0:n.lastName].filter(Boolean).join(" ").trim()},impersonatorEmail(){var e;return(e=this.activeUser)==null?void 0:e.impersonatorEmail},actualEmail(){var e;return(e=this.activeUser)==null?void 0:e.email},defaultName(){return this.dataModel.name||this.actualName||this.impersonatorName||""},defaultEmail(){return this.dataModel.email||this.actualEmail||this.impersonatorEmail||""},definedFields(){const e=[];return(this.askEmail||!this.defaultEmail)&&e.push({title:"Email Address",key:"email",minimum:1,maximum:1,type:"email",placeholder:"you@youremail.com",defaultValues:[this.defaultEmail]}),e.push({title:"Cardholder Name",key:"name",minimum:1,maximum:1,type:"string",placeholder:"John Citizen",defaultValues:[this.defaultName]}),e}},data(){return{initialised:!1,state:rI,cardholderName:"",processing:!1,error:null,cardError:null,dataModel:this.modelValue,instanceOptions:{},elementsOptions:{},cardElementOptions:{hidePostalCode:!0,style:{base:{fontSize:"16px",color:"#424770","::placeholder":{color:"#aab7c4"}},invalid:{color:"#9e2146"}}}}},watch:{stripeKey(e){console.log("PMF: stripe key initialised",e)},initialised(e){console.log("PMF initialised",e)},allSetup(e,n){!n&&e&&(this.resetForm(),this.$nextTick(()=>{this.setupCardErrorHandling()}))}},methods:{setupCardErrorHandling(){this.$nextTick(()=>{const e=this.$refs.stripeCard;e&&e.stripeElement&&e.stripeElement.on("change",({error:n})=>{this.cardError=n?n.message:null})})},async submitPaymentMethod(){const e=this;if(!e.processing){e.processing=!0,e.state=oI,e.cardError=null;try{const n=await e.startSetup(),{setupIntent:r,key:i,method:s}=n,o=e.$refs.stripeElements,l=e.$refs.stripeCard;if(!o||!l)throw new Error("Stripe elements not ready");let a=e.dataModel.email||e.defaultEmail||"";console.log("INSTANCE",{stripeElementsRef:o,stripeElementsInstance:o.instance,stripeCardElement:l.stripeElement});const{error:c}=await o.instance.confirmCardSetup(r.client_secret,{payment_method:{card:l.stripeElement,billing_details:{name:e.dataModel.name||"",email:a}}});if(c)throw console.log("Confirmation Error",c),c;const d=await e.confirmSetup(s._id);e.$emit("success",d.method),e.state=iI}catch(n){console.error("Error saving payment method:",n),this.error=n,this.state=sI,this.$emit("error",n)}finally{this.processing=!1}}},async startSetup(){let e=`/payment/${this.integrationID}/method/setup`;return this.sandbox&&(e=`/payment/${this.integrationID}/method/setup?sandbox=true`),(await this.$sdk.api.get(e)).data},async confirmSetup(e){return(await this.$sdk.api.post(`/payment/${this.integrationID}/method/confirm`,{method:e,sandbox:this.sandbox})).data},resetForm(){this.state=ih,this.dataModel={},this.processing=!1,this.error=null,this.cardError=null,this.$nextTick(()=>{const e=this.$refs.stripeCard;e&&e.stripeElement&&e.stripeElement.clear()})},cancel(){this.processing||this.close()},close(){this.resetForm(),this.$emit("close")}}},Vl=e=>(t.pushScopeId("data-v-e3ee591f"),e=e(),t.popScopeId(),e),aI={key:0,class:"payment-method"},cI={class:"payment-method-form"},dI=Vl(()=>t.createElementVNode("h3",null,"Add Payment Method",-1)),uI={key:0,class:"error-message"},mI=Vl(()=>t.createElementVNode("h4",null,"An error occurred",-1)),fI={key:0},hI={key:1},pI={key:1,class:"success-message"},yI=Vl(()=>t.createElementVNode("h4",null,"Payment method added successfully!",-1)),gI={key:2},kI={key:0,id:"card-errors",class:"error-text"},_I={class:"form-actions"},wI={key:1};function xI(e,n,r,i,s,o){const l=t.resolveComponent("ux-icon"),a=t.resolveComponent("ux-button"),c=t.resolveComponent("ux-form"),d=t.resolveComponent("StripeElement"),u=t.resolveComponent("StripeElements"),m=t.resolveComponent("ux-field-wrapper");return o.allSetup?(t.openBlock(),t.createElementBlock("div",aI,[t.createElementVNode("div",cI,[dI,s.state==="error"?(t.openBlock(),t.createElementBlock("div",uI,[mI,s.error.message?(t.openBlock(),t.createElementBlock("div",fI,t.toDisplayString(s.error.message),1)):(t.openBlock(),t.createElementBlock("div",hI,t.toDisplayString(s.error),1)),t.createVNode(a,{color:"primary",onClick:o.resetForm},{default:t.withCtx(()=>[t.createTextVNode(" Try again "),t.createVNode(l,{right:"",icon:"fa-undo"})]),_:1},8,["onClick"])])):s.state==="success"?(t.openBlock(),t.createElementBlock("div",pI,[yI,t.createVNode(a,{color:"primary",onClick:o.close},{default:t.withCtx(()=>[t.createTextVNode(" Done "),t.createVNode(l,{right:"",icon:"fa-check"})]),_:1},8,["onClick"])])):(t.openBlock(),t.createElementBlock("div",gI,[t.createElementVNode("form",{onSubmit:n[1]||(n[1]=t.withModifiers((...f)=>o.submitPaymentMethod&&o.submitPaymentMethod(...f),["prevent","stop"]))},[t.createVNode(c,{ref:"form",modelValue:s.dataModel,"onUpdate:modelValue":n[0]||(n[0]=f=>s.dataModel=f),fields:o.definedFields},null,8,["modelValue","fields"]),t.createVNode(m,{title:"Card Number"},{default:t.withCtx(()=>[(t.openBlock(),t.createBlock(u,{ref:"stripeElements","stripe-key":r.stripeKey,"instance-options":s.instanceOptions,"elements-options":s.elementsOptions,key:`stripe-${r.formKey}`},{default:t.withCtx(({elements:f,instance:h})=>[t.createVNode(d,{ref:"stripeCard",type:"card",elements:f,options:s.cardElementOptions},null,8,["elements","options"])]),_:1},8,["stripe-key","instance-options","elements-options"])),s.cardError?(t.openBlock(),t.createElementBlock("div",kI,t.toDisplayString(s.cardError),1)):t.createCommentVNode("",!0)]),_:1}),t.createElementVNode("div",_I,[t.createVNode(a,{type:"button",color:"secondary",onClick:o.cancel,disabled:s.processing},{default:t.withCtx(()=>[t.createTextVNode(" Cancel ")]),_:1},8,["onClick","disabled"]),t.createVNode(a,{type:"submit",color:"primary",disabled:o.invalid,loading:s.processing},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(s.processing?"Adding...":"Add Payment Method"),1)]),_:1},8,["disabled","loading"])])],32)]))])])):(t.openBlock(),t.createElementBlock("div",wI,"Initialising secure payment form..."))}const sh=w(lI,[["render",xI],["__scopeId","data-v-e3ee591f"]]),bI={name:"UxFieldWrapper",props:{title:{type:String,default:null},description:{type:String,default:null},error:{type:Boolean,default:!1}},computed:{classes(){var e=[];return this.error&&e.push("ux-field-error"),e}}},CI={key:0,class:"ux-field-title"},VI={key:1,class:"ux-field-description"};function NI(e,n,r,i,s,o){return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["ux-field",o.classes])},[r.title?(t.openBlock(),t.createElementBlock("label",CI,t.toDisplayString(r.title),1)):t.createCommentVNode("",!0),r.description?(t.openBlock(),t.createElementBlock("div",VI,t.toDisplayString(r.description),1)):t.createCommentVNode("",!0),t.renderSlot(e.$slots,"default",{},void 0,!0)],2)}const lh=w(bI,[["render",NI],["__scopeId","data-v-980de6f6"]]),ah=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function EI(e){const n=/<\/?([a-zA-Z0-9]+)[^>]*>/g,r=[];let i;for(;(i=n.exec(e))!==null;){const s=i[0],o=i[1];if(!ah.has(o.toLowerCase()))if(s[1]==="/"){const l=r.pop();if(l!==o)return{invalid:`Mismatched closing tag for ${o}, expected ${l}`}}else!s.endsWith("/>")&&!ah.has(o.toLowerCase())&&r.push(o)}return r.length>0?{invalid:`Unclosed tag(s): ${r.join(", ")}`}:{valid:!0}}const ch={props:{template:{type:String},parent:{type:Object}},template:'<v-runtime-template :parent="actualParent" :template="actualTemplate"/>',watch:{actualTemplate:{immediate:!0,async handler(){await this.$nextTick()}}},computed:{actualParent(){return this.parent||this.$parent},actualTemplate(){let e=this.template||"";e=e.replaceAll?e.replaceAll("<br>","<br/>"):e;var{valid:n,invalid:r}=EI(e);return n||(console.log("Invalid html",e),e=`<div>Invalid HTML. <pre>${r}</pre></div>`),e}},components:{VRuntimeTemplate:Ad}},BI={emits:["error","reset"],data(){return{error:null}},errorCaptured(e,n,r){this.error=e==null?void 0:e.message,this.$emit("error",e)},methods:{reset(){this.$emit("reset")}}},SI={key:0,class:"error-boundary",style:{color:"#b40000",border:"2px solid #fd0000",background:"#ffd6d6",padding:"1em"}};function TI(e,n,r,i,s,o){const l=t.resolveComponent("ux-button");return s.error?(t.openBlock(),t.createElementBlock("div",SI,[t.createElementVNode("pre",null,"COMPILE ERROR: "+t.toDisplayString(s.error),1),t.createVNode(l,{onClick:o.reset},{default:t.withCtx(()=>[t.createTextVNode(" Click here once you've fixed the issue. ")]),_:1},8,["onClick"])])):t.renderSlot(e.$slots,"default",{key:1},void 0,!0)}const DI=w(BI,[["render",TI],["__scopeId","data-v-0fd69158"]]),OI={mixins:[{props:{field:{type:Object,default(){return{}}},parentModel:{type:Object}},data(){return{model:this.modelValue}},methods:{getValue(e){if(e)return e._id||e.value||e},getLabel(e){if(e)return e.title||e.name||e.label||e}},computed:{label(){return this.field.title},description(){return this.field.description},singleValue(){if(this.asObject){var e=this.minimum===1&&this.maximum===1;return e}else return this.maximum===1},type(){return this.field.type||"string"},multiValue(){return!this.singleValue},key(){return this.field.key},isGroup(){return this.type==="group"},asObject(){return this.isGroup&&!!this.field.asObject},layoutGroup(){return this.isGroup&&!this.field.asObject},numValues(){return this.multiValue?(this.model||[]).length:1},fields(){var e=this.field.fields;if(e&&e.length)return e},minimum(){if(this.layoutGroup)return 1;var e=parseInt(this.field.minimum||0);return isNaN(e)&&(e=0),e=Math.max(e,0),e=this.maximum?Math.min(e,this.maximum):e,parseInt(e)},maximum(){if(this.layoutGroup)return 1;var e=parseInt(this.field.maximum||0);return isNaN(e)&&(e=0),e=Math.max(e,0),parseInt(e)}}}],props:{modelValue:{type:[Object,Array]},submission:{type:Boolean,default:!1}},computed:{sameLine(){return this.field.sameLine}},methods:{multiLabel(e,n){return`${this.label} ${n+1}`}}},MI={key:0,class:"ux-multi-group"};function FI(e,n,r,i,s,o){const l=t.resolveComponent("flex-cell"),a=t.resolveComponent("flex-row"),c=t.resolveComponent("ux-panel-header"),d=t.resolveComponent("ux-render"),u=t.resolveComponent("ux-panel-body"),m=t.resolveComponent("ux-panel");return e.multiValue?(t.openBlock(),t.createElementBlock("div",MI,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.model,(f,h)=>(t.openBlock(),t.createBlock(m,{ref_for:!0,ref:"row",key:f},{default:t.withCtx(()=>[t.createVNode(c,null,{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(l,{vcenter:""},{default:t.withCtx(()=>[t.createElementVNode("div",null,[t.createElementVNode("strong",null,t.toDisplayString(o.multiLabel(f,h)),1)])]),_:2},1024)]),_:2},1024)]),_:2},1024),t.createVNode(u,null,{default:t.withCtx(()=>[t.createVNode(d,{submission:r.submission,fields:e.fields,flex:o.sameLine,parentModel:e.parentModel,modelValue:e.model[h],"onUpdate:modelValue":y=>e.model[h]=y},null,8,["submission","fields","flex","parentModel","modelValue","onUpdate:modelValue"])]),_:2},1024)]),_:2},1024))),128))])):(t.openBlock(),t.createBlock(d,{key:1,submission:r.submission,fields:e.fields,flex:o.sameLine,parentModel:e.parentModel,modelValue:e.model,"onUpdate:modelValue":n[0]||(n[0]=f=>e.model=f)},null,8,["submission","fields","flex","parentModel","modelValue"]))}const II={components:{Item:Ar,FieldGroup:w(OI,[["render",FI],["__scopeId","data-v-cb997d0e"]]),Compile:ch,ErrorBoundary:DI},props:{field:{type:Object,required:!0},parentModel:{type:Object},modelValue:{type:Object,required:!0},submission:{type:Boolean,default:!1},display:{type:Boolean,default:!1}},data(){return{model:this.modelValue,unmaskedLookup:{},unmasked:!1}},methods:{copy(e){let n;this.field.maximum===1?n=this.fieldModel:n=this.fieldModel[e],this.$sdk.global.copyText(n)},openActions(e){this.$actions&&this.$actions.open([e])},toggleMask(e){this.multiValue?this.unmaskedLookup[`${e}`]=!this.unmaskedLookup[`${e}`]:this.unmasked=!this.unmasked},renderDate(e){return _.fromJSDate(new Date(e)).toFormat("h:mma - ccc, DD")},formatCurrency(e){return`${this.$sdk.utils.formatCurrency(e,this.field.currency)}`.toUpperCase()},cleanInput(e){return e},cleanOutput(e){return this.type=="reference"&&!this.multiValue&&Array.isArray(e)&&e.length?e[0]:e}},watch:{modelValue(e,n){this.model=e}},computed:{displayType(){if(!(!this.display||this.field.type!="reference"))return this.field.referenceType},copyable(){return this.$sdk.global.copyText&&this.field.copyable},type(){return this.field.type||"string"},isEmbedded(){return this.submission&&this.field.widget==="form"&&this.field.type==="reference"},isGroup(){return this.isEmbedded||this.type==="group"},asObject(){return this.isEmbedded||this.isGroup&&this.field.asObject},isNumber(){switch(this.type){case"integer":case"number":case"float":case"decimal":return!0}},multiValue(){return this.field.maximum!=1},title(){return this.field.title},getExpressionHide(){if(!this.expressions)return;let e=this.expressions.show,n=this.expressions.hide,r=this.expressionsContext;if(e)return!Vt.evaluateExpression(e,r);if(n)return Vt.evaluateExpression(n,r)},expressions(){return this.field.expressions},expressionUser(){return this.user?this.user:this.$sdk.auth.getCurrentUser()},expressionsContext(){const{firstName:e,lastName:n,email:r}=this.expressionUser||{},i={firstName:e,lastName:n,email:r};return{this:this.model,model:this.model,self:this.model,data:this.parentModel,user:i||{firstName:"jerry"}}},hidden(){return this.getExpressionHide},visible(){var e=!this.hidden,n=this.layoutGroup||this.fieldModel||this.fieldModel===0||this.fieldModel===!1;return e&&n},type(){return this.field.type||"string"},key(){return this.field.key},isGroup(){return this.type==="group"},asObject(){return this.isGroup&&this.field.asObject},layoutGroup(){return this.isGroup&&!this.field.asObject},fieldModel:{get(){return this.cleanOutput(this.model[this.key])},set(e){}},sourceModel:{get(){return this.model},set(e){}},classes(){var e=[];return e.push(`ux-field-render-${this.type}`),this.layoutGroup?e.push("ux-layout-only"):(!this.fieldModel||Array.isArray(this.fieldModel)&&!this.fieldModel.length)&&e.push("ux-empty"),e},widget(){if(this.type=="group")return this.type;var e=this.field.widget;switch(e){case"form":e=this.submission?"form":"content-select";break;case"signature":case"content-select":case"select":case"checkbox":case"datefield":case"richtext":case"longtext":case"buttons":case"switch":case"email":case"url":case"currency":case"timezone":case"country":case"typeselect":case"upload":case"code":case"password":break;default:switch(this.type){case"date":e="datefield";break;case"reference":e="content-select";break;case"boolean":e="checkbox";break;default:case"string":e="textfield";break}break}return e}}},AI={class:"ux-field-title"},LI={class:"signature-view"},$I=["src"],PI={key:1,class:"signature-view"},RI=["src"],UI={class:"currency"},jI={key:1},qI={class:"currency"},zI={key:1},WI={key:5,class:"ux-password-render"},HI=["type","value"],GI=["type","value"],YI={key:0,class:"display-grid"},JI={class:"display-cell"},KI={key:1},ZI={class:"display-cell"},XI={key:0,class:"display-grid"},QI={class:"display-cell"},vI={key:1},eA={class:"display-cell"},tA=["innerHTML"],nA=["innerHTML"],rA={key:1},oA={key:1},iA=["href"],sA={key:1},lA=["href"],aA=["href"],cA={key:1},dA=["href"],uA={key:1};function mA(e,n,r,i,s,o){const l=t.resolveComponent("field-group"),a=t.resolveComponent("qik-code-editor"),c=t.resolveComponent("flex-cell"),d=t.resolveComponent("ux-icon"),u=t.resolveComponent("ux-button"),m=t.resolveComponent("flex-row"),f=t.resolveComponent("ux-image"),h=t.resolveComponent("ux-video"),y=t.resolveComponent("item"),p=t.resolveComponent("error-boundary");return o.visible?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["ux-field-render",o.classes])},[t.createElementVNode("label",AI,t.toDisplayString(o.title),1),o.widget==="group"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[o.asObject?(t.openBlock(),t.createBlock(l,{key:0,submission:r.submission,display:r.display,field:r.field,parentModel:r.parentModel,modelValue:o.fieldModel,"onUpdate:modelValue":n[0]||(n[0]=g=>o.fieldModel=g)},null,8,["submission","display","field","parentModel","modelValue"])):(t.openBlock(),t.createBlock(l,{key:1,submission:r.submission,display:r.display,field:r.field,parentModel:r.parentModel,modelValue:o.sourceModel,"onUpdate:modelValue":n[1]||(n[1]=g=>o.sourceModel=g)},null,8,["submission","display","field","parentModel","modelValue"]))],64)):o.widget==="form"?(t.openBlock(),t.createBlock(l,{key:1,submission:r.submission,display:r.display,field:r.field,parentModel:r.parentModel,modelValue:o.fieldModel,"onUpdate:modelValue":n[2]||(n[2]=g=>o.fieldModel=g)},null,8,["submission","display","field","parentModel","modelValue"])):o.widget==="signature"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[o.multiValue?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(o.fieldModel,(g,k)=>(t.openBlock(),t.createElementBlock("div",LI,[t.createElementVNode("img",{src:g},null,8,$I)]))),256)):(t.openBlock(),t.createElementBlock("div",PI,[t.createElementVNode("img",{src:o.fieldModel},null,8,RI)]))],64)):o.widget==="currency"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[o.multiValue?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(o.fieldModel,(g,k)=>(t.openBlock(),t.createElementBlock("div",null,[t.createTextVNode(t.toDisplayString(o.formatCurrency(g))+" ",1),t.createElementVNode("span",UI,t.toDisplayString(r.field.currency),1)]))),256)):(t.openBlock(),t.createElementBlock("div",jI,[t.createTextVNode(t.toDisplayString(o.formatCurrency(o.fieldModel))+" ",1),t.createElementVNode("span",qI,t.toDisplayString(r.field.currency),1)]))],64)):o.widget==="code"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:4},[o.multiValue?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(o.fieldModel,(g,k)=>(t.openBlock(),t.createElementBlock("div",null,[t.createVNode(a,{readonly:!0,class:"editor-wrap",modelValue:g,syntax:r.field.syntax,style:{"min-height":"300px"}},null,8,["modelValue","syntax"])]))),256)):(t.openBlock(),t.createElementBlock("div",zI,[t.createVNode(a,{readonly:!0,class:"editor-wrap",modelValue:o.fieldModel,syntax:r.field.syntax,style:{"min-height":"300px"}},null,8,["modelValue","syntax"])]))],64)):o.widget==="password"?(t.openBlock(),t.createElementBlock("div",WI,[o.multiValue?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(o.fieldModel,(g,k)=>(t.openBlock(),t.createBlock(m,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(c,null,{default:t.withCtx(()=>[t.createElementVNode("input",{type:s.unmaskedLookup[`${k}`]?"text":"password",value:g},null,8,HI)]),_:2},1024),t.createVNode(c,{shrink:""},{default:t.withCtx(()=>[t.createVNode(u,{icon:"",onClick:x=>o.toggleMask(k)},{default:t.withCtx(()=>[t.createVNode(d,{icon:s.unmaskedLookup[`${k}`]?"fa-eye":"fa-eye-slash"},null,8,["icon"])]),_:2},1032,["onClick"])]),_:2},1024),o.copyable?(t.openBlock(),t.createBlock(c,{key:0,shrink:"",vcenter:""},{default:t.withCtx(()=>[t.createVNode(u,{tag:"a",icon:"",onClick:x=>o.copy(k)},{default:t.withCtx(()=>[t.createVNode(d,{icon:"fa-copy"})]),_:2},1032,["onClick"])]),_:2},1024)):t.createCommentVNode("",!0)]),_:2},1024))),256)):(t.openBlock(),t.createBlock(m,{key:1,gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(c,null,{default:t.withCtx(()=>[t.createElementVNode("input",{type:s.unmasked?"text":"password",value:o.fieldModel},null,8,GI)]),_:1}),t.createVNode(c,{shrink:""},{default:t.withCtx(()=>[t.createVNode(u,{icon:"",onClick:o.toggleMask},{default:t.withCtx(()=>[t.createVNode(d,{icon:s.unmasked?"fa-eye":"fa-eye-slash"},null,8,["icon"])]),_:1},8,["onClick"])]),_:1}),o.copyable?(t.openBlock(),t.createBlock(c,{key:0,shrink:"",vcenter:""},{default:t.withCtx(()=>[t.createVNode(u,{tag:"a",icon:"",onClick:n[3]||(n[3]=g=>o.copy())},{default:t.withCtx(()=>[t.createVNode(d,{icon:"fa-copy"})]),_:1})]),_:1})):t.createCommentVNode("",!0)]),_:1}))])):o.displayType==="image"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:6},[o.multiValue?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[o.fieldModel.length>1?(t.openBlock(),t.createElementBlock("div",YI,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.fieldModel,(g,k)=>(t.openBlock(),t.createElementBlock("div",JI,[t.createVNode(f,{item:g},null,8,["item"])]))),256))])):(t.openBlock(),t.createElementBlock("div",KI,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.fieldModel,(g,k)=>(t.openBlock(),t.createElementBlock("div",ZI,[t.createVNode(f,{item:g},null,8,["item"])]))),256))]))],64)):(t.openBlock(),t.createBlock(f,{key:1,item:o.fieldModel},null,8,["item"]))],64)):o.displayType==="video"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:7},[o.multiValue?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[o.fieldModel.length>1?(t.openBlock(),t.createElementBlock("div",XI,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.fieldModel,(g,k)=>(t.openBlock(),t.createElementBlock("div",QI,[t.createVNode(h,{item:g},null,8,["item"])]))),256))])):(t.openBlock(),t.createElementBlock("div",vI,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.fieldModel,(g,k)=>(t.openBlock(),t.createElementBlock("div",eA,[t.createVNode(h,{item:g},null,8,["item"])]))),256))]))],64)):(t.openBlock(),t.createBlock(h,{key:1,item:o.fieldModel},null,8,["item"]))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:8},[o.type==="reference"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[o.multiValue?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(o.fieldModel,(g,k)=>(t.openBlock(),t.createBlock(y,{submission:r.submission,display:r.display,key:g._id,item:g},{actions:t.withCtx(()=>[t.createVNode(u,{size:"sm",icon:"",onClick:t.withModifiers(x=>o.openActions(g),["stop","prevent"])},{default:t.withCtx(()=>[t.createVNode(d,{icon:"fa-ellipsis"})]),_:2},1032,["onClick"])]),_:2},1032,["submission","display","item"]))),128)):(t.openBlock(),t.createBlock(y,{key:1,submission:r.submission,display:r.display,item:o.fieldModel},{actions:t.withCtx(()=>[t.createVNode(u,{size:"sm",icon:"",onClick:n[4]||(n[4]=t.withModifiers(g=>o.openActions(o.fieldModel),["stop","prevent"]))},{default:t.withCtx(()=>[t.createVNode(d,{icon:"fa-ellipsis"})]),_:1})]),_:1},8,["submission","display","item"]))],64)):t.createCommentVNode("",!0),o.type=="string"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[o.multiValue?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(o.fieldModel,(g,k)=>(t.openBlock(),t.createElementBlock("div",null,[t.createVNode(p,null,{default:t.withCtx(()=>[t.createElementVNode("div",{innerHTML:g},null,8,tA)]),_:2},1024)]))),256)):(t.openBlock(),t.createBlock(p,{key:1},{default:t.withCtx(()=>[t.createElementVNode("div",{innerHTML:o.fieldModel},null,8,nA)]),_:1}))],64)):t.createCommentVNode("",!0),o.type=="boolean"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[o.multiValue?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(o.fieldModel,(g,k)=>(t.openBlock(),t.createElementBlock("div",null,t.toDisplayString(!!g),1))),256)):(t.openBlock(),t.createElementBlock("div",rA,t.toDisplayString(!!o.fieldModel),1))],64)):t.createCommentVNode("",!0),o.type=="date"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[o.multiValue?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(o.fieldModel,(g,k)=>(t.openBlock(),t.createElementBlock("div",null,t.toDisplayString(o.renderDate(g)),1))),256)):(t.openBlock(),t.createElementBlock("div",oA,t.toDisplayString(o.renderDate(o.fieldModel)),1))],64)):t.createCommentVNode("",!0),o.type=="email"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:4},[o.multiValue?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(o.fieldModel,(g,k)=>(t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("a",{href:`mailto:${g}`},t.toDisplayString(g),9,iA)]))),256)):(t.openBlock(),t.createElementBlock("div",sA,[t.createElementVNode("a",{href:`mailto:${o.fieldModel}`},t.toDisplayString(o.fieldModel),9,lA)]))],64)):t.createCommentVNode("",!0),o.type=="url"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:5},[o.multiValue?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(o.fieldModel,(g,k)=>(t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("a",{href:g},t.toDisplayString(g),9,aA)]))),256)):(t.openBlock(),t.createElementBlock("div",cA,[t.createElementVNode("a",{href:o.fieldModel},t.toDisplayString(o.fieldModel),9,dA)]))],64)):t.createCommentVNode("",!0),o.isNumber?(t.openBlock(),t.createElementBlock(t.Fragment,{key:6},[o.multiValue?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(o.fieldModel,(g,k)=>(t.openBlock(),t.createElementBlock("div",null,t.toDisplayString(g),1))),256)):(t.openBlock(),t.createElementBlock("div",uA,t.toDisplayString(o.fieldModel),1))],64)):t.createCommentVNode("",!0)],64))],2)):t.createCommentVNode("",!0)}const Nl=w(II,[["render",mA],["__scopeId","data-v-3047313a"]]),fA={props:{parentModel:{type:Object},fields:{type:Array,default(){return[]}},modelValue:{type:Object,default(){return{}}},flex:{type:Boolean,default:!1},submission:{type:Boolean,default:!1},display:{type:Boolean,default:!1}},watch:{modelValue(e,n){this.model=e}},data(){return{model:this.modelValue}},components:{UxFieldRender:Nl},computed:{renderClass(){var e=[];return this.flex&&e.push("ux-render-flex"),e},fieldClass(){var e=[];return this.flex&&e.push("ux-field-render-flex"),e},renderFields(){return this.fields}}};function hA(e,n,r,i,s,o){const l=t.resolveComponent("ux-field-render");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["ux-render bigbadaboom",o.renderClass])},[t.renderSlot(e.$slots,"render",{fields:r.fields},()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.renderFields,(a,c)=>(t.openBlock(),t.createBlock(l,{submission:r.submission,display:r.display,field:a,modelValue:s.model,"onUpdate:modelValue":n[0]||(n[0]=d=>s.model=d),parentModel:r.parentModel||s.model,key:`ux-render-field-${a.key}-${c}`,class:t.normalizeClass(o.fieldClass)},null,8,["submission","display","field","modelValue","parentModel","class"]))),128))],!0)],2)}const dh=w(fA,[["render",hA],["__scopeId","data-v-62742e05"]]);function uh(e){e=e||{},Math.max(parseInt(e.minimum||0),0);let n=Math.max(parseInt(e.maximum||0),0);const r=Dt.EventDispatcher({}),i=t.reactive([]);let s={};t.watch(i,function(){o()});function o(){s=i.reduce(function(l,a){var c=a._id||a.id;if(c)return l[c]=a,l},{})}return r.isSelected=function(l){return s[l._id||l.id]},r.select=function(l,a){r.isSelected(l)||(n&&i.length>=n&&n===1&&(i.length=0),i.push(l),n&&i.length>n&&(i.length=n,r.dispatch("limit",n)),a||r.dispatch("change",i))},r.deselect=function(l,a){if(n===1){i.length=0;return}var c=i.findIndex(function(d){return d._id&&d._id==l._id||d.id&&d.id==l.id});c!=-1&&(i.splice(c,1),a||r.dispatch("change",i))},r.toggle=function(l,a){r.isSelected(l)?r.deselect(l,a):r.select(l,a)},r.selectMultiple=function(l){l.forEach(function(a){r.select(a,!0)}),r.dispatch("change",i)},r.deselectMultiple=function(l){l.forEach(function(a){r.deselect(a,!0)}),r.dispatch("change",i)},r.setSelection=function(l){i.length=0,setTimeout(function(){r.selectMultiple(l)})},r.deselectAll=function(){i.length=0,r.dispatch("change",i)},Object.defineProperty(r,"items",{value:i,writable:!1}),Object.defineProperty(r,"hash",{get(){return s}}),r}var El,mh;function pA(){if(mh)return El;mh=1;var e="__lodash_hash_undefined__";function n(r){return this.__data__.set(r,e),this}return El=n,El}var Bl,fh;function yA(){if(fh)return Bl;fh=1;function e(n){return this.__data__.has(n)}return Bl=e,Bl}var Sl,hh;function gA(){if(hh)return Sl;hh=1;var e=_d(),n=pA(),r=yA();function i(s){var o=-1,l=s==null?0:s.length;for(this.__data__=new e;++o<l;)this.add(s[o])}return i.prototype.add=i.prototype.push=n,i.prototype.has=r,Sl=i,Sl}var Tl,ph;function kA(){if(ph)return Tl;ph=1;var e=Vf();function n(r,i){var s=r==null?0:r.length;return!!s&&e(r,i,0)>-1}return Tl=n,Tl}var Dl,yh;function _A(){if(yh)return Dl;yh=1;function e(n,r,i){for(var s=-1,o=n==null?0:n.length;++s<o;)if(i(r,n[s]))return!0;return!1}return Dl=e,Dl}var Ol,gh;function wA(){if(gh)return Ol;gh=1;function e(n,r){return n.has(r)}return Ol=e,Ol}var Ml,kh;function xA(){if(kh)return Ml;kh=1;var e=ei(),n=on(),r=e(n,"Set");return Ml=r,Ml}var Fl,_h;function bA(){if(_h)return Fl;_h=1;function e(){}return Fl=e,Fl}var Il,wh;function xh(){if(wh)return Il;wh=1;function e(n){var r=-1,i=Array(n.size);return n.forEach(function(s){i[++r]=s}),i}return Il=e,Il}var Al,bh;function CA(){if(bh)return Al;bh=1;var e=xA(),n=bA(),r=xh(),i=1/0,s=e&&1/r(new e([,-0]))[1]==i?function(o){return new e(o)}:n;return Al=s,Al}var Ll,Ch;function VA(){if(Ch)return Ll;Ch=1;var e=gA(),n=kA(),r=_A(),i=wA(),s=CA(),o=xh(),l=200;function a(c,d,u){var m=-1,f=n,h=c.length,y=!0,p=[],g=p;if(u)y=!1,f=r;else if(h>=l){var k=d?null:s(c);if(k)return o(k);y=!1,f=i,g=new e}else g=d?[]:p;e:for(;++m<h;){var x=c[m],S=d?d(x):x;if(x=u||x!==0?x:0,y&&S===S){for(var A=g.length;A--;)if(g[A]===S)continue e;d&&g.push(S),p.push(x)}else f(g,S,u)||(g!==p&&g.push(S),p.push(x))}return p}return Ll=a,Ll}var $l,Vh;function NA(){if(Vh)return $l;Vh=1;var e=VA();function n(r){return r&&r.length?e(r):[]}return $l=n,$l}var EA=NA();const BA=mt(EA);function SA(e,n){var r=[],i;switch(n){case"image":case"video":r.push({title:"",key:"_id",renderer:"thumbnail",shrink:!0,fields:["width","height","fileMeta.colors.colors[0]"]});break}switch(n){case"facility":r.push({title:"Venue",path:"venue"});break;case"persona":r.push({title:"",path:"_id",shrink:!0,widget:"avatar"});break;case"profile":i=!0,r.push({title:"",path:"_id",shrink:!0,widget:"avatar"}),r.push({title:"First Name",key:"firstName",shrink:!0}),r.push({title:"Last Name",key:"lastName",shrink:!0}),r.push({title:"Email",key:"emails"});break;case"definition":r.push({title:"Plural",key:"plural"}),r.push({title:"Defines Type",key:"definesType"}),r.push({title:"Database Key",key:"key"}),r.push({title:"Category",key:"category"});break;case"file":case"audio":case"image":case"video":switch(i=!0,r.push({title:"Title",key:"title"}),n){case"image":case"video":r.push({title:"Width",key:"width",shrink:!0}),r.push({title:"Height",key:"height",shrink:!0});break}switch(r.push({title:"Ext",key:"fileExtension",shrink:!0}),r.push({title:"Mime Type",key:"fileMime",shrink:!0}),n){case"image":case"video":r.push({title:"Media Type",key:"mediaIntegrationType",shrink:!0});break}break}switch(i||r.unshift({title:"Title",key:"title"}),n){case"file":case"audio":case"image":case"video":r.push({title:"",key:"meta.security",renderer:"security",shrink:!0}),r.push({title:"",key:"_id",renderer:"button",shrink:!0,button:{size:"sm",text:"Download",icon:"fa-download",action(s){return new Promise(async function(o,l){await e.$sdk.auth.ensureValidToken();var a=e.$sdk.files.downloadUrl(e.basicType,s);window.open(a),o()})}}});break}return r}function Nh(){return{operator:"and",filters:[]}}let Pl;const TA={emits:["loading","loaded","click:row","click:actions"],props:{defaultPage:{type:Number,default:1},defaultPageSize:{type:Number,default:50},view:{type:Object,default(){return{title:"List",key:"table"}}},filter:{type:Object,default(){return Nh()}},type:{type:String,required:!0},showFilters:{type:Boolean},search:{type:String,default:""},target:{type:String},dateRange:{type:Object,default:{}},rolodexPrimary:{type:String,default:""},rolodexSecondary:{type:String,default:""},options:{type:Object,default(){return{}}},cacheKey:{type:[String,Number]},modelValue:{type:Array,default(){return[]}},maximum:{type:Number,default(){return 0}},dateFilterEnabled:{type:Boolean},selectionManager:{type:Object},enableActions:{type:Boolean,default:!1},enableSelection:{type:Boolean,default:!0},trash:{type:Boolean,default:!1},pluralText:{type:String}},components:{Pager:jd,NativeTable:Pd,FilterBuilder:df,Search:ot,UxField:eo},deactivated(){Pl=this.$sdk.global.cacheKeys[this.type],this.inflightRequest&&(this.inflightRequest.cancel(),this.inflightRequest=null,this.cancelledUnmount=!0)},async activated(){var e=this,n=e.$sdk.global.cacheKeys[e.type];Pl!=n&&(Pl=n,e.dataSource=await e.load()),e.cancelledUnmount&&(e.cancelledUnmount=!1,e.dataSource=await e.load())},mounted(){},beforeUnmount(){},async created(){var e=this;await e.$glossary.ensure(e.type),e.sort=e.defaultSort,e.debounceReload=Tn(function(){e.reload()}),e.debounceReload()},watch:{"page.index":{handler(e){this.$emit("update:defaultPage",e)}},"page.size":{handler(e){this.$emit("update:defaultPageSize",e)}},keywords(e){this.$emit("update:search",e)},targetID(e){this.$emit("update:target",e)},roloPrimary(e){this.$emit("update:rolodexPrimary",e)},roloSecondary(e){this.$emit("update:rolodexSecondary",e)},dateRangeFilter(e){this.$emit("update:dateRange",e.dateRange)},dateRange(e){e&&(this.dateRangeFilter.dateRange=e)},search(e){this.keywords=e},rolodexPrimary(e){this.roloPrimary=e},rolodexSecondary(e){this.roloSecondary=e},change(){this.debounceReload?this.debounceReload():(console.log("debounce reload does not exist yet"),this.reload())},loading(){this.$emit("loading",this.loading)},selectedItems(e){this.$emit("update:modelValue",e)},loadKey(){this.$emit("loaded")},options(e){this.actualOptions=e},filter(e){e?this.actualFilter=e:this.actualFilter=Nh()},actualFilter(e){this.$emit("update:filter",e)}},computed:{glossary(){return this.$glossary.hash},emptyTextString(){return this.actualOptions.customEmptyMessage?this.actualOptions.customEmptyMessage:this.dateFilterEnabled?`No ${this.plural} match your filters.`:`No ${this.plural} found.`},definition(){const e=this;return e.glossary?e.glossary[e.type]:null},scopeTypes(){const e=this;return e.glossary?Object.entries(e.glossary).reduce(function(r,[i,s]){return s.definesType==="scope"&&r.push(s),r},[]):void 0},profileDetailTypes(){const e=this;return e.glossary?Object.entries(e.glossary).reduce(function(r,[i,s]){return s.definesType==="profiledetail"&&r.push(s),r},[]):void 0},actualDefinition(){var e;return((e=this.options)==null?void 0:e.definition)||this.definition},showFilterSidebar(){return this.showFilters},boundaryMessage(){var e;if((e=this.dataSource)!=null&&e.boundary)return this.dataSource.message||"Limit was reached. Please provide more selective criteria"},viewModeCacheKey(){return`${this.cacheKey}-${this.loadKey}`},dateRangeField(){return{type:"object",widget:"daterange",key:"dateRange",minimum:0,maximum:1}},combinedFilter(){const e=this;let n=e.actualFilter,r=e.actualOptions.lockFilter;if(!r)return n;n=JSON.parse(JSON.stringify(n)),r=JSON.parse(JSON.stringify(r));let i;return n.operator==="and"?(i=n,i.filters.push(r)):(i=r,r.filters.push(n)),i},viewMode(){var e=this.view;switch(e.key){case"list":case"table":return}return e},defaultSort(){var n;var e=(n=this.definition)==null?void 0:n.defaultSort;if(e)return e;switch(e={key:"title",direction:"asc",type:"string"},this.basicType){case"profile":case"persona":case"user":e={key:"lastName",direction:"asc",type:"string"};break;case"event":e={key:"startDate",direction:"asc",type:"date"};break;case"workflowcard":e={key:"due",direction:"dsc",type:"date"};break;case"article":e={key:"meta.updated",direction:"dsc",type:"date"};break;case"email":case"notification":case"transaction":case"campaign":case"transaction":case"componentsnapshot":case"interfacesnapshot":case"image":case"video":case"audio":case"file":case"submission":case"export":case"log":e={key:"meta.created",direction:"dsc",type:"date"};break}return e},fields(){const e=this,n=e.actualDefinition.definesType==="profile"||e.actualDefinition.key==="profile",r=e.actualDefinition.definesType==="submission";var i=[...e.actualDefinition.fields],s=e.actualDefinition.definedFields||[];if(s.length)if(r){var o={title:"Form Data",minimum:1,maximum:1,key:"formData",asObject:!0,type:"group",fields:s};i.push(o);var l={title:"Data",minimum:1,maximum:1,key:"data",asObject:!0,type:"group",fields:s.map(function(u){return u.type==="reference"&&(u=JSON.parse(JSON.stringify(u)),delete u.fields),u})};i.push(l)}else{var l={title:`${e.actualDefinition.title}`,minimum:1,maximum:1,key:"data",asObject:!0,type:"group",fields:s};i.push(l)}if(n){i.push({title:"Age",key:"_age",minimum:1,maximum:1,type:"integer"}),i.push({title:"Date of birth",key:"_dob",minimum:1,maximum:1,type:"date"});const d=e.scopeTypes;d.length&&(d.forEach(function(m){i.push({title:`${m.plural}`,minimum:0,maximum:0,key:`meta.scopes|${m.key}`})}),i.push({title:"Scopes (No definition)",minimum:0,maximum:0,key:"meta.scopes|null"}));const u=e.profileDetailTypes;if(u.length){var a={title:"",minimum:1,maximum:1,key:"join_details",asObject:!0,type:"group",fields:[]};u.forEach(function(m){a.fields.push({title:`${m.title}`,minimum:1,maximum:1,key:m.key,asObject:!0,type:"group",fields:[{title:"",minimum:1,maximum:1,key:"data",asObject:!0,type:"group",fields:m.definedFields}]})}),i.push(a)}}i.push({title:"Reactions › Your Likes",key:"_stat._like",minimum:1,maximum:1,type:"integer"}),i.push({title:"Reactions › All Likes",key:"meta.stats._like",minimum:1,maximum:1,type:"integer"}),i.push({title:"Reactions › Your Subscribes",key:"_stat._subscribe",minimum:1,maximum:1,type:"integer"}),i.push({title:"Reactions › All Subscribes",key:"meta.stats._subscribe",minimum:1,maximum:1,type:"integer"});var c=e.$sdk.utils.mapFields(i).filter(function(d){var u=d.type=="group"&&d.asObject&&d.minimum==1&&d.maximum==1;return!u}).map(function(d){return d.title=d.filterTitle||d.titles.filter(Boolean).join(" › "),d});return c},selectableFields(){return this.fields.filter(function(n){const r=n.path||n.key;return!(r==="fields"||r.startsWith("fields."))}).map(function(n){switch(n={...n},n.path){case"meta.scopes":n.title="Scopes";break;case"meta.tags":n.title="Tags";break}return n}).sort(function(n,r){return n.title<r.title?-1:1})},deselectAllFunction(){return(this.manager.items||[]).length?this.deselectAll:null},selectedItems(){return this.manager.items.slice()},activeFilters(){const e=this;var n=this.$sdk.filter.activeFilters(e.actualFilter).reduce(function(r,i){return i.key&&(i={...i},i.title=i.title||`Filter ${((r==null?void 0:r.length)||0)+1}`,i.key=i.key.split("[]").join(""),i.class="active-filter",i.shrink=!0,r.push(i)),r},[]);return n},searching(){var e;return this.loading&&((e=this.keywords)==null?void 0:e.length)},title(){return this.actualDefinition.title},plural(){return this.actualDefinition.plural},selectFields(){const e=this;var n=e.columns.map(function(r){return[r.path||r.key,...r.select||[]]}).flat().filter(Boolean).map(function(r){return r.split("[]").join("")});switch(e.actualOptions.select&&(n=[...n,...e.actualOptions.select]),e.basicType){case"scope":n.push("color"),n.push("bgColor");break;case"event":n.push("startDate"),n.push("endDate"),n.push("nonevent"),n.push("allDay");break;case"roster":case"assignment":case"runsheet":n.push("event");break}return BA(n)},columns(){let e=[],n={};function r(d){return function(u){var m=n[u.path||u.key];(d||!m)&&(n[u.path||u.key]=1,e.push({...u,key:u.path||u.key}))}}var i=this.actualOptions.prefixColumns||[];i.forEach(r(!0));var s=this.actualOptions.columns||[],o=s.length?s:SA(this,this.basicType);o.length||o.push({title:"Title",key:"title"}),o.forEach(r(!0));var l=this.additionalFields;l.forEach(r());var a=this.actualOptions.suffixColumns||[];a.forEach(r(!0));var c=this.activeFilters;return c.forEach(r()),this.basicType==="scope"?e.unshift({title:"",key:"_id",renderer:"circles",shrink:!0,sortable:!1}):e.unshift({title:"",key:"meta.scopes",renderer:"circles",shrink:!0,sortable:!1}),e},filterChangeString(){const e=this;var n=this.$sdk.filter.filterChangeString(e.combinedFilter);return n},change(){return`${JSON.stringify([this.page,this.roloSecondary,this.rolodexPrimary,this.dateRangeFilter,this.sort,this.keywords,this.selectFields,this.type,this.filterChangeString])}-${this.cacheKey}-${this.$sdk.global.cacheKeys[this.type]}`},items(){return this.dataSource.items},totalItems(){return this.dataSource.total},basicType(){return this.actualDefinition?this.actualDefinition.definesType||this.actualDefinition.key:this.type},loadCriteria(){const e=this,n=e.sort||e.defaultSort,r=e.keywords,i=e.selectFields,s=e.page,o=e.combinedFilter,l=e.roloPrimary,a=e.roloSecondary,c=e.$sdk.utils.ids(e.options.ids);return{sort:n,search:r,select:i,page:s,filter:o,rolodexPrimary:l,rolodexSecondary:a,ids:c}},fieldEnabled(){var e=this;return e.columns.reduce(function(n,r){return n[r.key]=!0,n},{})}},methods:{messageReceived(){},async reload(){this.dataSource=await this.load()},toggleField(e){var n=e.path||e.key,r=this.additionalFields.findIndex(function(i){return i.path===n||i.key===n});r===-1?this.additionalFields.push(e):this.additionalFields.splice(r,1)},ensureMeta(e){var n;return e.meta||(e.meta={}),e.meta.type||(e.meta.type=this.basicType),e.meta.definition||(e.meta.definition=(n=this.definition)==null?void 0:n.key),this.trash&&(e.meta.deleted=!0),e},deselectAll(){this.manager.deselectAll()},async selectAll(){var e=this;e.dataSource=await e.load(!0);var n=this.dataSource.all.map(function(r){var i=e.ensureMeta({_id:r});return i});e.manager.setSelection(n)},selectMultiple(e){e=e.map(this.ensureMeta),this.manager.selectMultiple(e)},deselectMultiple(e){e=e.map(this.ensureMeta),this.manager.deselectMultiple(e)},rowToggled(e){this.toggle(e)},rowClicked(e){this.$emit("click:row",e)},dateViewChanged({dateRange:e}){const{startDate:n,endDate:r}=e;this.dateRange.startDate=n,this.dateRange.endDate=r},actionsClicked(e){this.$emit("click:actions",e)},select(e){this.ensureMeta(e),this.manager.select(e)},deselect(e){this.manager.deselect(e)},isSelected(e){return this.manager.isSelected(e)},toggle(e){this.ensureMeta(e),this.manager.toggle(e)},async load(e){var c,d,u,m;var n=this;n.loading=!0,n.inflightRequest&&(n.inflightRequest.cancel(),n.inflightRequest=null);var r=Object.assign({},n.loadCriteria);if(r.includeAll=e,n.trash&&(r.trash=!0),n.dateFilterEnabled){let f=(d=(c=n.dateRangeFilter)==null?void 0:c.dateRange)==null?void 0:d.startDate,h=(m=(u=n.dateRangeFilter)==null?void 0:u.dateRange)==null?void 0:m.endDate;const y=f&&!isNaN(new Date(f).getTime()),p=h&&!isNaN(new Date(h).getTime());if(y||(f=new Date),p||(h=new Date),f||h){let g=Intl.DateTimeFormat().resolvedOptions().timeZone;f.toISOString()==h.toISOString()?(f=new Date(f),f.setHours(0,0,0,0),h=new Date(f),h.setHours(23,59,59,999)):(h=new Date(h),h.setHours(23,59,59,999)),r.date={startDate:f,endDate:h,timezone:g}}}const s=Math.random(),{promise:o,cancel:l}=await n.$sdk.content.list(n.type,r,{remoteURL:n.actualOptions.remoteURL,cancellable:!0});n.inflightRequest={id:s,cancel:l},o.then(function(f){var h;((h=n.inflightRequest)==null?void 0:h.id)===s&&(n.inflightRequest=null,n.loading=!1,n.loadKey++)}),o.catch(function(f){var h;((h=n.inflightRequest)==null?void 0:h.id)===s&&(n.inflightRequest=null)});const{data:a}=await o;if(a)return a.items.forEach(n.ensureMeta),a}},data(){var s;var e=this.selectionManager;e||(e=new uh({minimum:this.minimum,maximum:this.maximum})),this.modelValue&&e.setSelection(this.modelValue);const n=Math.max(isNaN(this.defaultPage)?1:this.defaultPage||1,1);let i=Math.max(isNaN(this.defaultPageSize)?50:this.defaultPageSize||50,50);switch((s=this.view)==null?void 0:s.key){case"calendar":case"map":case"tree":case"scopecolumns":i=2e3;break}return{inflightRequest:null,cancelledUnmount:!1,manager:e,loading:!0,additionalFields:[],loadKey:1,page:{size:i,index:n},actualFilter:this.filter,sort:this.defaultSort,keywords:this.search,targetID:this.target,roloPrimary:this.rolodexPrimary,roloSecondary:this.roloSecondary,dateRangeFilter:{dateRange:this.dateRange},dataSource:null,actualOptions:this.options}}},Rl=e=>(t.pushScopeId("data-v-09d249b3"),e=e(),t.popScopeId(),e),DA=Rl(()=>t.createElementVNode("strong",null,"Select Columns",-1)),OA={key:0,class:"font-sm"},MA={class:"footer"},FA=Rl(()=>t.createElementVNode("p",null,null,-1)),IA={key:0},AA=Rl(()=>t.createElementVNode("p",null,null,-1));function LA(e,n,r,i,s,o){const l=t.resolveComponent("ux-icon"),a=t.resolveComponent("ux-panel-body"),c=t.resolveComponent("ux-panel"),d=t.resolveComponent("flex-column"),u=t.resolveComponent("ux-button"),m=t.resolveComponent("flex-header"),f=t.resolveComponent("ux-list-item"),h=t.resolveComponent("ux-list"),y=t.resolveComponent("flex-body"),p=t.resolveComponent("ux-menu"),g=t.resolveComponent("native-table"),k=t.resolveComponent("pager"),x=t.resolveComponent("flex-footer"),S=t.resolveComponent("flex-row"),A=t.resolveComponent("search"),R=t.resolveComponent("ux-field"),C=t.resolveComponent("filter-builder"),D=t.resolveComponent("spinner");return o.actualDefinition?(t.openBlock(),t.createBlock(d,{key:0,class:"content-browser"},{default:t.withCtx(()=>[t.createVNode(d,{class:"browser-body"},{default:t.withCtx(()=>[t.createVNode(S,null,{default:t.withCtx(()=>[t.createVNode(S,{class:t.normalizeClass({loading:s.loading})},{default:t.withCtx(()=>[t.createVNode(d,null,{default:t.withCtx(()=>[t.createVNode(d,null,{default:t.withCtx(()=>{var I,M;return[s.dataSource?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.renderSlot(e.$slots,"abovecontent",{},void 0,!0),o.boundaryMessage?(t.openBlock(),t.createBlock(d,{key:0,class:"empty"},{default:t.withCtx(()=>[t.createVNode(c,null,{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(l,{class:"large-icon",icon:"fa-database"}),t.createElementVNode("div",null,t.toDisplayString(o.boundaryMessage),1)]),_:1})]),_:1})]),_:1})):(I=o.items)!=null&&I.length||(M=o.viewMode)!=null&&M.customEmpty?(t.openBlock(),t.createBlock(d,{key:1},{default:t.withCtx(()=>[o.viewMode&&o.viewMode.component?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.viewMode.component),{key:0,dateRangeFilter:s.dateRangeFilter,onDateRangeFilter:o.dateViewChanged,onReload:e.debounceReload,cacheKey:o.viewModeCacheKey,definition:o.actualDefinition,selection:s.manager.items,selectionManager:s.manager,items:o.items,target:s.targetID,"onUpdate:target":n[0]||(n[0]=j=>s.targetID=j),"onClick:actions":o.actionsClicked,"onSelect:item:toggle":o.rowToggled,"onClick:item":o.rowClicked},null,40,["dateRangeFilter","onDateRangeFilter","onReload","cacheKey","definition","selection","selectionManager","items","target","onClick:actions","onSelect:item:toggle","onClick:item"])):(t.openBlock(),t.createBlock(g,{key:1,sort:s.sort,"onUpdate:sort":n[1]||(n[1]=j=>s.sort=j),enableSelection:r.enableSelection,enableActions:r.enableActions,total:o.totalItems,selectAll:o.selectAll,deselectAll:o.deselectAllFunction,selection:s.manager.items,"onClick:row":o.rowClicked,"onClick:actions":o.actionsClicked,"onSelect:row:toggle":o.rowToggled,"onSelect:multiple":o.selectMultiple,"onDeselect:multiple":o.deselectMultiple,rows:o.items,columns:o.columns},{corner:t.withCtx(()=>[t.createVNode(p,{flex:"",right:""},{activator:t.withCtx(({on:j})=>[t.createVNode(u,t.mergeProps({icon:""},t.toHandlers(j)),{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-plus-minus"})]),_:2},1040)]),default:t.withCtx(()=>[t.createVNode(d,{class:"column-panel"},{default:t.withCtx(()=>[t.createVNode(m,null,{default:t.withCtx(()=>[t.createVNode(a,{class:"border-bottom"},{default:t.withCtx(()=>[t.createVNode(l,{icon:"fa-plus-minus",left:""}),DA]),_:1})]),_:1}),t.createVNode(y,null,{default:t.withCtx(()=>[t.createVNode(h,null,{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.selectableFields,j=>(t.openBlock(),t.createBlock(f,{onClick:L=>o.toggleField(j),key:j.path},{default:t.withCtx(()=>[t.createVNode(l,{icon:o.fieldEnabled[j.path]?"fa-check-square":"fa-regular fa-square",left:""},null,8,["icon"]),t.createTextVNode(" "+t.toDisplayString(j.title),1)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["sort","enableSelection","enableActions","total","selectAll","deselectAll","selection","onClick:row","onClick:actions","onSelect:row:toggle","onSelect:multiple","onDeselect:multiple","rows","columns"]))]),_:1})):s.loading?(t.openBlock(),t.createBlock(d,{key:3,class:"empty",center:""})):(t.openBlock(),t.createBlock(d,{key:2,class:"empty",center:""},{default:t.withCtx(()=>[t.createVNode(c,null,{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createElementVNode("div",null,t.toDisplayString(o.emptyTextString),1),r.dateFilterEnabled?(t.openBlock(),t.createElementBlock("div",OA," Try changing your date range or updating your filter. ")):t.createCommentVNode("",!0)]),_:1})]),_:1})]),_:1}))],64)):t.createCommentVNode("",!0)]}),_:3}),s.dataSource&&!o.boundaryMessage?(t.openBlock(),t.createBlock(x,{key:0},{default:t.withCtx(()=>[t.renderSlot(e.$slots,"footera",{},void 0,!0),t.createElementVNode("div",MA,[t.createVNode(k,{page:s.page,"onUpdate:page":n[2]||(n[2]=I=>s.page=I),total:o.totalItems},null,8,["page","total"])]),t.renderSlot(e.$slots,"footerb",{},void 0,!0)]),_:3})):t.createCommentVNode("",!0)]),_:3})]),_:3},8,["class"]),o.showFilterSidebar?(t.openBlock(),t.createBlock(d,{key:0,class:"filter-column"},{default:t.withCtx(()=>[t.renderSlot(e.$slots,"abovefilter",{},void 0,!0),t.createVNode(y,null,{default:t.withCtx(()=>[t.createVNode(A,{modelValue:s.keywords,"onUpdate:modelValue":n[3]||(n[3]=I=>s.keywords=I),loading:o.searching,debounce:500,placeholder:"Keyword Search"},null,8,["modelValue","loading"]),FA,r.dateFilterEnabled?(t.openBlock(),t.createElementBlock("div",IA,[t.createVNode(R,{field:o.dateRangeField,modelValue:s.dateRangeFilter,"onUpdate:modelValue":n[4]||(n[4]=I=>s.dateRangeFilter=I)},null,8,["field","modelValue"])])):t.createCommentVNode("",!0),AA,t.createVNode(C,{definition:o.actualDefinition,modelValue:s.actualFilter,"onUpdate:modelValue":n[5]||(n[5]=I=>s.actualFilter=I)},null,8,["definition","modelValue"])]),_:1}),t.renderSlot(e.$slots,"belowfilter",{},void 0,!0)]),_:3})):t.createCommentVNode("",!0)]),_:3})]),_:3}),s.loading?(t.openBlock(),t.createBlock(D,{key:0,large:""})):t.createCommentVNode("",!0)]),_:3})):t.createCommentVNode("",!0)}const Eh=w(TA,[["render",LA],["__scopeId","data-v-09d249b3"]]),$A={props:{modal:{type:Object,required:!0}},data(){return{}},methods:{blanketClick(){this.dismiss()},dismiss(e){this.$sdk.closeModal(this.modal.id),this.modal.reject(e)},close(e){this.$sdk.closeModal(this.modal.id),this.modal.resolve(e)}},computed:{componentProps(){return this.modal.componentProps||{}},style(){var e={};return this.modal.style&&(e=Object.assign(e,this.modal.style)),e}}},PA={class:"modal-wrapper"};function RA(e,n,r,i,s,o){return t.openBlock(),t.createElementBlock("div",PA,[t.createElementVNode("div",{class:"modal-blanket",onClick:n[0]||(n[0]=(...l)=>o.blanketClick&&o.blanketClick(...l))}),t.createElementVNode("div",{class:"modal-content",style:t.normalizeStyle(o.style)},[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.modal.component),t.mergeProps({options:r.modal.options},o.componentProps,{onClose:o.close,onDismiss:o.dismiss}),null,16,["options","onClose","onDismiss"]))],4)])}const Bh=w($A,[["render",RA],["__scopeId","data-v-90c28992"]]),UA={mixins:[Et],computed:{confirmText(){return this.options.confirmText||"Confirm"},cancelText(){return this.options.cancelText||"Cancel"}},mounted(){window.addEventListener("keydown",this.handleKeyDown)},beforeUnmount(){window.removeEventListener("keydown",this.handleKeyDown)},methods:{handleKeyDown(e){switch(e.key){case"Enter":this.close();break;case"Escape":this.dismiss();break}}}},jA={class:"padder"},qA=["innerHTML"],zA={class:"padder"};function WA(e,n,r,i,s,o){const l=t.resolveComponent("flex-body"),a=t.resolveComponent("ux-button"),c=t.resolveComponent("flex-cell"),d=t.resolveComponent("flex-row"),u=t.resolveComponent("flex-footer"),m=t.resolveComponent("flex-column");return t.openBlock(),t.createBlock(m,{class:"wrapper"},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[t.createElementVNode("div",jA,[t.createElementVNode("h5",null,t.toDisplayString(e.options.title),1),t.createElementVNode("div",{innerHTML:e.options.description},null,8,qA)])]),_:1}),t.createVNode(u,null,{default:t.withCtx(()=>[t.createElementVNode("div",zA,[t.createVNode(d,null,{default:t.withCtx(()=>[t.createVNode(c,null,{default:t.withCtx(()=>[t.createVNode(a,{color:"dismiss",onClick:e.dismiss},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.cancelText),1)]),_:1},8,["onClick"])]),_:1}),t.createVNode(c,null,{default:t.withCtx(()=>[t.createVNode(a,{color:"primary",onClick:e.close},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.confirmText),1)]),_:1},8,["onClick"])]),_:1})]),_:1})])]),_:1})]),_:1})}const Sh=w(UA,[["render",WA],["__scopeId","data-v-ee67e4b1"]]),HA={data(){return{selected:null,search:""}},components:{Search:ot},mixins:[Et],computed:{searchEnabled(){return this.options.search===!1?!1:this.options.choices.length>10},columns(){var e;return(e=this.options)==null?void 0:e.columns},filteredChoices(){var r;const e=this;let n=((r=this.options)==null?void 0:r.choices)||[];if(e.search){const i=e.search.toLowerCase(),s=new RegExp(i);n=n.map(function(o){return o.searchString=`${o.title} ${o.plural} ${o.key}`.toLowerCase(),o}).filter(function(o){return s.test(o.searchString)})}return n}},methods:{select(e){this.selected=e,this.close(e)}}},GA={class:"options-modal-header"},YA={class:"padder"},JA={class:"options-modal-header"},KA={class:"padder"},ZA=["onClick"],XA=["innerHTML"],QA={key:0,class:"title"},vA={key:1,class:"description"},eL={class:"padder"};function tL(e,n,r,i,s,o){const l=t.resolveComponent("flex-header"),a=t.resolveComponent("search"),c=t.resolveComponent("flex-cell"),d=t.resolveComponent("ux-icon"),u=t.resolveComponent("flex-row"),m=t.resolveComponent("flex-body"),f=t.resolveComponent("ux-button"),h=t.resolveComponent("flex-footer"),y=t.resolveComponent("flex-column");return t.openBlock(),t.createBlock(y,{class:"wrapper"},{default:t.withCtx(()=>[e.options.title||e.options.description?(t.openBlock(),t.createBlock(l,{key:0},{default:t.withCtx(()=>[t.createElementVNode("div",GA,[t.createElementVNode("div",YA,[t.createElementVNode("h5",null,t.toDisplayString(e.options.title),1),t.createElementVNode("div",null,t.toDisplayString(e.options.description),1)])])]),_:1})):t.createCommentVNode("",!0),o.searchEnabled?(t.openBlock(),t.createBlock(l,{key:1},{default:t.withCtx(()=>[t.createElementVNode("div",JA,[t.createElementVNode("div",KA,[t.createVNode(a,{modelValue:s.search,"onUpdate:modelValue":n[0]||(n[0]=p=>s.search=p),loading:e.searching,debounce:500,placeholder:"Search"},null,8,["modelValue","loading"])])])]),_:1})):t.createCommentVNode("",!0),t.createVNode(m,{class:"options-modal-body"},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["padder",{columns:o.columns}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.filteredChoices,p=>(t.openBlock(),t.createElementBlock("a",{class:"choice",onClick:g=>o.select(p)},[t.createVNode(u,{gap:"",center:""},{default:t.withCtx(()=>[p.icon?(t.openBlock(),t.createBlock(c,{key:0,shrink:""},{default:t.withCtx(()=>[t.createElementVNode("div",{class:"option-icon",innerHTML:p.icon},null,8,XA)]),_:2},1024)):t.createCommentVNode("",!0),t.createVNode(c,null,{default:t.withCtx(()=>[p.title?(t.openBlock(),t.createElementBlock("div",QA,t.toDisplayString(p.title),1)):t.createCommentVNode("",!0),p.description?(t.openBlock(),t.createElementBlock("div",vA,t.toDisplayString(p.description),1)):t.createCommentVNode("",!0)]),_:2},1024),t.createVNode(c,{shrink:""},{default:t.withCtx(()=>[t.createVNode(d,{right:"",icon:"fa-angle-right"})]),_:1})]),_:2},1024)],8,ZA))),256))],2)]),_:1}),t.createVNode(h,{class:"options-modal-footer"},{default:t.withCtx(()=>[t.createElementVNode("div",eL,[t.createVNode(f,{size:"sm",onClick:e.dismiss},{default:t.withCtx(()=>[t.createTextVNode("Cancel")]),_:1},8,["onClick"])])]),_:1})]),_:1})}const Th=w(HA,[["render",tL],["__scopeId","data-v-79ee703e"]]),nL={mixins:[Et],data(){return{model:{},formState:null}},methods:{formStateUpdated(e){this.formState=e}},computed:{confirmText(){return this.options.confirmText||"Confirm"},cancelText(){return this.options.cancelText||"Cancel"},invalid(){var n;var e=(n=this.formState)==null?void 0:n.invalid;if(e)return!0},fields(){return this.options.fields||[]}},created(){this.options.model&&(this.model=this.options.model)}},rL={class:"padder"},oL={key:0},iL={class:"padder"};function sL(e,n,r,i,s,o){const l=t.resolveComponent("ux-form"),a=t.resolveComponent("flex-body"),c=t.resolveComponent("ux-button"),d=t.resolveComponent("flex-cell"),u=t.resolveComponent("flex-spacer"),m=t.resolveComponent("flex-row"),f=t.resolveComponent("flex-footer"),h=t.resolveComponent("flex-column");return t.openBlock(),t.createElementBlock("form",{class:"wrapper",onSubmit:n[2]||(n[2]=t.withModifiers((...y)=>e.submit&&e.submit(...y),["prevent","stop"]))},[t.createVNode(h,null,{default:t.withCtx(()=>[t.createVNode(a,null,{default:t.withCtx(()=>[t.createElementVNode("div",rL,[t.createElementVNode("h5",null,t.toDisplayString(e.options.title),1),e.options.description?(t.openBlock(),t.createElementBlock("p",oL,t.toDisplayString(e.options.description),1)):t.createCommentVNode("",!0),t.createVNode(l,{ref:"form","onForm:state":o.formStateUpdated,modelValue:s.model,"onUpdate:modelValue":n[0]||(n[0]=y=>s.model=y),fields:o.fields},null,8,["onForm:state","modelValue","fields"])])]),_:1}),t.createVNode(f,{class:"border-top"},{default:t.withCtx(()=>[t.createElementVNode("div",iL,[t.createVNode(m,null,{default:t.withCtx(()=>[t.createVNode(d,{shrink:""},{default:t.withCtx(()=>[t.createVNode(c,{tag:"a",onClick:e.dismiss},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.cancelText),1)]),_:1},8,["onClick"])]),_:1}),t.createVNode(u),t.createVNode(d,{shrink:""},{default:t.withCtx(()=>[t.createVNode(c,{disabled:o.invalid,color:"primary",type:"submit",onClick:n[1]||(n[1]=y=>e.close(s.model))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.confirmText),1)]),_:1},8,["disabled"])]),_:1})]),_:1})])]),_:1})]),_:1})],32)}const Dh=w(nL,[["render",sL],["__scopeId","data-v-22036a05"]]);function lL(e,n){switch(e){case"systemtask":case"comment":case"log":case"email":case"campaign":case"transaction":case"submission":case"campaign":case"notification":case"event":case"checkin":case"runsheet":return!0;default:switch(n){case"photo":return!0}break}}function aL(e,n){let r=[];switch(e){case"transaction":Array.from({length:3}).forEach(function(i,s){let o=_.now().minus({year:s});r.push({title:o.toFormat("yyyy"),startDate:o.startOf("year").toJSDate(),endDate:o.endOf("year").toJSDate()})}),Array.from({length:3}).forEach(function(i,s){const o=parseInt(_.now().toFormat("yyyy"));let l=_.fromObject({year:o-(s+1),month:7,day:1}),a=_.fromObject({year:o-s,month:6,day:30});r.push({title:`FY ${l.toFormat("yyyy")}/${a.toFormat("yyyy")}`,startDate:l.toJSDate(),endDate:a.toJSDate()})});break;case"checkin":r.push({title:"Today",startDate:_.now().startOf("day").toJSDate(),endDate:_.now().endOf("day").toJSDate()}),r.push({title:"This week",endDate:_.now().endOf("day").toJSDate(),startDate:_.now().minus({days:7}).toJSDate()});break;case"assignment":r.push({title:"Today",startDate:_.now().startOf("day").toJSDate(),endDate:_.now().endOf("day").toJSDate()}),r.push({title:"Next 7 days",startDate:_.now().startOf("day").toJSDate(),endDate:_.now().plus({days:7}).toJSDate()}),r.push({title:"Next 30 days",startDate:_.now().startOf("day").toJSDate(),endDate:_.now().plus({months:1}).toJSDate()}),r.push({title:"Next 3 months",startDate:_.now().startOf("day").toJSDate(),endDate:_.now().plus({months:3}).toJSDate()});break;case"event":case"runsheet":r.push({title:"Today",startDate:_.now().startOf("day").toJSDate(),endDate:_.now().endOf("day").toJSDate()}),r.push({title:"Future",startDate:_.now().startOf("day").toJSDate(),endDate:_.now().plus({months:6}).toJSDate()}),r.push({title:"Past",endDate:_.now().startOf("day").toJSDate(),startDate:_.now().minus({months:6}).toJSDate()}),r.push({title:"Next 14 days",startDate:_.now().startOf("day").toJSDate(),endDate:_.now().plus({days:14}).toJSDate()}),r.push({title:"Last 14 days",endDate:_.now().endOf("day").toJSDate(),startDate:_.now().minus({days:14}).toJSDate()}),r.push({title:"Last Month",startDate:_.now().minus({months:1}).startOf("month").toJSDate(),endDate:_.now().minus({months:1}).endOf("month").toJSDate()});break;case"comment":r.push({title:"Today",startDate:_.now().startOf("day").toJSDate(),endDate:_.now().endOf("day").toJSDate()}),r.push({title:"This week",startDate:_.now().startOf("week").toJSDate(),endDate:_.now().endOf("week").toJSDate()});case"log":r.push({title:"Today",startDate:_.now().startOf("day").toJSDate(),endDate:_.now().endOf("day").toJSDate()}),r.push({title:"Past 5 minutes",startDate:_.now().minus({minutes:5}).toJSDate(),endDate:_.now().toJSDate()}),r.push({title:"Past 12 Hours",startDate:_.now().minus({hours:12}).toJSDate(),endDate:_.now().toJSDate()}),r.push({title:"Past 7 Days",startDate:_.now().minus({days:7}).toJSDate(),endDate:_.now().toJSDate()});break;case"email":r.push({title:"Today",startDate:_.now().startOf("day").toJSDate(),endDate:_.now().endOf("day").toJSDate()}),r.push({title:"This week",startDate:_.now().startOf("week").toJSDate(),endDate:_.now().endOf("week").toJSDate()});break;case"submission":r.push({title:"Today",startDate:_.now().startOf("day").toJSDate(),endDate:_.now().endOf("day").toJSDate()}),r.push({title:"This week",startDate:_.now().startOf("week").toJSDate(),endDate:_.now().endOf("week").toJSDate()}),r.push({title:"Past 30 days",startDate:_.now().minus({days:30}).toJSDate(),endDate:_.now().plus({hours:1}).toJSDate()}),r.push({title:"Past year",startDate:_.now().minus({years:1}).toJSDate(),endDate:_.now().plus({hours:1}).toJSDate()});break;case"systemtask":r.push({title:"Past 5 minutes",startDate:_.now().minus({minutes:5}).toJSDate(),endDate:_.now().toJSDate()}),r.push({title:"Past hour",startDate:_.now().minus({hours:1}).toJSDate(),endDate:_.now().toJSDate()}),r.push({title:"Past day",startDate:_.now().minus({days:1}).toJSDate(),endDate:_.now().toJSDate()});break;case"campaign":Array.from({length:5}).forEach(function(i,s){let o=_.now().minus({month:s});r.push({title:o.toFormat("MMMM yyyy"),startDate:o.startOf("month").toJSDate(),endDate:o.endOf("month").toJSDate()})});break;case"image":r.push({title:"This week",startDate:_.now().startOf("week").toJSDate(),endDate:_.now().endOf("week").toJSDate()}),Array.from({length:5}).forEach(function(i,s){let o=_.now().minus({month:s});r.push({title:o.toFormat("MMMM yyyy"),startDate:o.startOf("month").toJSDate(),endDate:o.endOf("month").toJSDate()})});break}return r}const cL={components:{ContentBrowser:Eh,Search:ot,DateRange:es},mixins:[Et],async created(){var e=this;await e.$glossary.ensure(e.type),e.loading=!1;var n=e.$glossary.hash[e.type];if(!n){e.$sdk.notify("You do not have the required permissions to list content of this type"),e.dismiss();return}e.definition=n,e.bigData&&e.rolodexEnabled&&(e.rolodexLetter="A")},computed:{modalTitle(){return this.options.title?this.options.title:`Select ${this.maximum==1?this.title:this.plural}`},dateShortcuts(){const e=this.definition.key,n=this.definition.definesType||e;return aL(n)},bigData(){var e;return((e=this.definition)==null?void 0:e.count)>2e4},dateFilterEnabled(){const e=this.definition.key,n=this.definition.definesType||e;return lL(n,e)},dateSummary(){let{startDate:e,endDate:n}=this.dateRange;if(!e||String(e)=="Invalid Date"||!n||String(n)=="Invalid Date")return"Invalid date";if(new Date(e).toISOString()==new Date(n).toISOString())return`${_.fromJSDate(e).toFormat("dd LLL yyyy")}`;{const r=_.fromJSDate(e).toFormat("LLL yyyy"),i=_.fromJSDate(n).toFormat("LLL yyyy"),s=_.fromJSDate(e).toFormat("yyyy"),o=_.fromJSDate(n).toFormat("yyyy"),l=_.fromJSDate(e).toFormat("dd"),a=_.fromJSDate(n).toFormat("dd");return r==i?l===a?`${_.fromJSDate(e).toFormat("d LLL yyyy")}`:`${_.fromJSDate(e).toFormat("d")} - ${_.fromJSDate(n).toFormat("d LLL yyyy")}`:s==o?`${_.fromJSDate(e).toFormat("d LLL")} - ${_.fromJSDate(n).toFormat("d LLL yyyy")}`:`${_.fromJSDate(e).toFormat("d LLL yyyy")} - ${_.fromJSDate(n).toFormat("d LLL yyyy")}`}},dateRangeField(){return{key:"dates",type:"object",widget:"daterange",minimum:0,maximum:1}},rolodexEnabled(){let e;if(!this.bigData)return;switch(this.definition.definesType||this.definition.key){case"profile":case"persona":e=!0;break}return(this.search||this.shortcut)&&(e=!1),e},rolodexPrimary:{get(){if(!(this.search||this.shortcut))return this.rolodexLetter},set(e){this.search||this.shortcut||(this.rolodexLetter=e)}},letters(){return"abcdefghijklmnopqrstuvwxyz".toUpperCase().split("")},type(){return this.options.type},title(){return this.definition.title},plural(){return this.definition.plural},maximum(){return this.options.maximum||0},browserOptions(){return this.options.browserOptions||{}}},watch:{search(e,n){const r=this;!e&&r.bigData&&(r.rolodexLetter||(r.rolodexLetter="A"))}},data(){return{showFilters:!1,search:"",searching:!1,definition:null,loading:!0,model:this.options.model.slice(),rolodexLetter:"",dateRange:{startDate:_.now().startOf("day").toJSDate(),endDate:_.now().plus({months:3}).toJSDate()}}},methods:{setDateRange({startDate:e,endDate:n}){const r=e&&!isNaN(new Date(e).getTime()),i=n&&!isNaN(new Date(n).getTime());r&&i?(this.dateRange.startDate=new Date(e),this.dateRange.endDate=new Date(n)):console.log("WARNING: Invalid date range selected",{startDate:e,endDate:n,validStartDate:r,validEndDate:i})},toggleRolodex(e){this.rolodexLetter===e?this.rolodexLetter="":this.rolodexLetter=e},rowClicked(e){this.$refs.browser.toggle(e)},selectionComplete(e){this.close(this.model)}}},dL={class:"header"},uL={class:"font-muted font-sm"},mL={class:"date-range"},fL={class:"date-shortcuts"},hL=["onClick"],pL={class:"rolodex"};function yL(e,n,r,i,s,o){const l=t.resolveComponent("flex-column"),a=t.resolveComponent("flex-cell"),c=t.resolveComponent("search"),d=t.resolveComponent("ux-button"),u=t.resolveComponent("date-range"),m=t.resolveComponent("flex-row"),f=t.resolveComponent("ux-menu"),h=t.resolveComponent("ux-icon"),y=t.resolveComponent("flex-header"),p=t.resolveComponent("content-browser"),g=t.resolveDirective("tippy");return t.openBlock(),t.createBlock(l,{class:"wrapper"},{default:t.withCtx(()=>[s.loading?(t.openBlock(),t.createBlock(l,{key:0},{default:t.withCtx(()=>[t.createTextVNode(" Loading ")]),_:1})):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[s.definition?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(y,null,{default:t.withCtx(()=>[t.createElementVNode("div",dL,[t.createVNode(m,{vcenter:"",gap:""},{default:t.withCtx(()=>[t.createVNode(a,{shrink:""},{default:t.withCtx(()=>[t.createElementVNode("h3",null,t.toDisplayString(o.modalTitle),1)]),_:1}),o.maximum?(t.openBlock(),t.createBlock(a,{key:0},{default:t.withCtx(()=>[t.createElementVNode("span",uL,"("+t.toDisplayString(s.model.length)+" of "+t.toDisplayString(o.maximum)+")",1)]),_:1})):t.createCommentVNode("",!0),t.createVNode(a,null,{default:t.withCtx(()=>[s.showFilters?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(c,{key:0,autofocus:"",modelValue:s.search,"onUpdate:modelValue":n[0]||(n[0]=k=>s.search=k),loading:s.searching,debounce:500,placeholder:"Keyword Search"},null,8,["modelValue","loading"]))]),_:1}),o.dateFilterEnabled&&!s.showFilters?(t.openBlock(),t.createBlock(a,{key:1,shrink:""},{default:t.withCtx(()=>[t.createVNode(f,{closeOnClick:!1},{activator:t.withCtx(({on:k})=>[t.withDirectives((t.openBlock(),t.createBlock(d,t.toHandlers(k),{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.dateSummary),1)]),_:2},1040)),[[g,{placement:"bottom",content:"Modify the visible date range"}]])]),default:t.withCtx(()=>[t.createElementVNode("div",mL,[t.createVNode(m,{gap:""},{default:t.withCtx(()=>[t.createVNode(a,{shrink:""},{default:t.withCtx(()=>[t.createElementVNode("ul",fL,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.dateShortcuts,k=>(t.openBlock(),t.createElementBlock("li",null,[t.createElementVNode("a",{onClick:x=>o.setDateRange(k)},t.toDisplayString(k.title),9,hL)]))),256))])]),_:1}),t.createVNode(a,null,{default:t.withCtx(()=>[t.createVNode(u,{modelValue:s.dateRange,"onUpdate:modelValue":n[1]||(n[1]=k=>s.dateRange=k)},null,8,["modelValue"])]),_:1})]),_:1})])]),_:1})]),_:1})):t.createCommentVNode("",!0),t.createVNode(a,{shrink:""},{default:t.withCtx(()=>[t.createVNode(d,{icon:e.$device.breakpoint.mobile,onClick:n[2]||(n[2]=k=>s.showFilters=!s.showFilters)},{default:t.withCtx(()=>[e.$device.breakpoint.mobile?(t.openBlock(),t.createBlock(h,{key:0,icon:"fa-search"})):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(s.showFilters?"Hide":"Show")+" Filters",1)],64))]),_:1},8,["icon"])]),_:1}),t.createVNode(a,{shrink:""},{default:t.withCtx(()=>[t.createVNode(d,{color:"primary",onClick:o.selectionComplete},{default:t.withCtx(()=>[t.createTextVNode("Done")]),_:1},8,["onClick"])]),_:1})]),_:1})])]),_:1}),t.createVNode(p,{dateFilterEnabled:o.dateFilterEnabled,rolodexPrimary:o.rolodexPrimary,"onUpdate:rolodexPrimary":n[4]||(n[4]=k=>o.rolodexPrimary=k),showFilters:s.showFilters,ref:"browser",search:s.search,"onClick:row":o.rowClicked,maximum:e.options.maximum,dateRange:s.dateRange,"onUpdate:dateRange":n[5]||(n[5]=k=>s.dateRange=k),modelValue:s.model,"onUpdate:modelValue":n[6]||(n[6]=k=>s.model=k),type:e.options.type,options:o.browserOptions},{abovecontent:t.withCtx(()=>[o.rolodexEnabled?(t.openBlock(),t.createBlock(y,{key:0},{default:t.withCtx(()=>[t.createElementVNode("div",pL,[t.createVNode(d,{size:"sm",onClick:n[3]||(n[3]=k=>o.toggleRolodex("")),icon:"",color:o.rolodexPrimary?"":"primary"},{default:t.withCtx(()=>[t.createTextVNode("All")]),_:1},8,["color"]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.letters,k=>(t.openBlock(),t.createBlock(d,{size:"sm",onClick:x=>o.toggleRolodex(k),icon:"",color:o.rolodexPrimary===k?"primary":""},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(k),1)]),_:2},1032,["onClick","color"]))),256))])]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["dateFilterEnabled","rolodexPrimary","showFilters","search","onClick:row","maximum","dateRange","modelValue","type","options"])],64)):t.createCommentVNode("",!0)],64))]),_:1})}const Oh=w(cL,[["render",yL],["__scopeId","data-v-aeaca77a"]]),gL={components:{ScopeSelect:Um},mixins:[Et],computed:{single(){return this.maximum===1},type(){return this.options.type},action(){return this.options.action},include(){let e="scope";switch(this.options.include){case"unit":e="unit";break;case"all":e="all";break;default:e="scope";break}return e},maximum(){return this.options.maximum||0}},data(){return console.log("initial model",this.options.model),{model:(this.options.model||[]).slice()}},methods:{selectionComplete(e){console.log("selection complete",e,this.model),this.close(this.model)}}},kL=e=>(t.pushScopeId("data-v-c5b42335"),e=e(),t.popScopeId(),e),_L={class:"header"},wL=kL(()=>t.createElementVNode("h3",null,"Select Scopes",-1));function xL(e,n,r,i,s,o){const l=t.resolveComponent("flex-cell"),a=t.resolveComponent("ux-button"),c=t.resolveComponent("flex-row"),d=t.resolveComponent("flex-header"),u=t.resolveComponent("scope-select"),m=t.resolveComponent("flex-column");return t.openBlock(),t.createBlock(m,{class:"wrapper"},{default:t.withCtx(()=>[t.createVNode(d,null,{default:t.withCtx(()=>[t.createElementVNode("div",_L,[t.createVNode(c,{vcenter:"",gap:""},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>[wL]),_:1}),t.createVNode(l,{shrink:""},{default:t.withCtx(()=>[t.createVNode(a,{color:"primary",onClick:o.selectionComplete},{default:t.withCtx(()=>[t.createTextVNode("Done")]),_:1},8,["onClick"])]),_:1})]),_:1})])]),_:1}),t.createVNode(u,{action:o.action,single:o.single,type:o.type,modelValue:s.model,"onUpdate:modelValue":n[0]||(n[0]=f=>s.model=f),include:o.include},null,8,["action","single","type","modelValue","include"])]),_:1})}const Mh=w(gL,[["render",xL],["__scopeId","data-v-c5b42335"]]),bL={mixins:[Et],components:{Tagger:rm},methods:{done(){this.close(this.options.model)},cancel(){this.dismiss()}},computed:{title(){return this.options.title||"Manage Tags"},description(){return this.options.description}},data(){return{}}},CL={class:"header"},VL={key:0,class:"font-sm font-muted"},NL={class:"footer"};function EL(e,n,r,i,s,o){const l=t.resolveComponent("flex-cell"),a=t.resolveComponent("flex-row"),c=t.resolveComponent("flex-header"),d=t.resolveComponent("tagger"),u=t.resolveComponent("ux-panel-body"),m=t.resolveComponent("flex-body"),f=t.resolveComponent("ux-button"),h=t.resolveComponent("flex-footer"),y=t.resolveComponent("flex-column");return t.openBlock(),t.createBlock(y,{class:"wrapper"},{default:t.withCtx(()=>[t.createVNode(c,null,{default:t.withCtx(()=>[t.createElementVNode("div",CL,[t.createVNode(a,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(l,null,{default:t.withCtx(()=>{var p;return[t.createElementVNode("h3",null,t.toDisplayString(o.title),1),(p=o.description)!=null&&p.length?(t.openBlock(),t.createElementBlock("div",VL,t.toDisplayString(o.description),1)):t.createCommentVNode("",!0)]}),_:1})]),_:1})])]),_:1}),t.createVNode(m,null,{default:t.withCtx(()=>[t.createVNode(u,null,{default:t.withCtx(()=>[t.createVNode(d,{modelValue:e.options.model,"onUpdate:modelValue":n[0]||(n[0]=p=>e.options.model=p)},null,8,["modelValue"])]),_:1})]),_:1}),t.createVNode(h,null,{default:t.withCtx(()=>[t.createElementVNode("div",NL,[t.createVNode(a,{gap:"",center:""},{default:t.withCtx(()=>[t.createVNode(l,{shrink:""},{default:t.withCtx(()=>[t.createVNode(f,{onClick:o.cancel},{default:t.withCtx(()=>[t.createTextVNode("Cancel")]),_:1},8,["onClick"])]),_:1}),t.createVNode(l),t.createVNode(l,{shrink:""},{default:t.withCtx(()=>[t.createVNode(f,{color:"primary",onClick:o.done},{default:t.withCtx(()=>[t.createTextVNode("Save")]),_:1},8,["onClick"])]),_:1})]),_:1})])]),_:1})]),_:1})}const Fh=w(bL,[["render",EL],["__scopeId","data-v-da6e77a9"]]),et="uploading",to="complete",Kt="ready",BL="error",SL="upload.cancel",TL="upload.start",Ih="upload.complete",DL="upload.progress",OL="upload.error",ML={props:{accept:{type:String}},data(){return{queue:[],state:Kt,defaultScopes:[],defaultTags:[],defaultFreeformTags:[],ui:!1}},mounted(){this.$glossary.ensure()},computed:{glossary(){return this.$glossary.hash},outstanding(){return this.queue.filter(function(e){return e.state!==to})},uploading(){return this.state==et},bytesLoaded(){var e=this;return e.outstanding.reduce(function(n,r){return n+=r.bytesLoaded||0,n},0)},bytesTotal(){var e=this;return e.outstanding.reduce(function(n,r){return n+=r.bytesTotal||r.file.size,n},0)},percent(){var e=this;return e.state!=et?0:Math.floor(e.bytesLoaded*100/e.bytesTotal)}},methods:{select(){this.$refs.file.click()},async selectAndUpload(e){e=e||{};const n=this,r=n.$refs.immediateFile;return new Promise(function(i,s){r.addEventListener("change",o);function o({target:l}){r.removeEventListener("change",o);const a=l.files||[];if(!a||!a.length)return;const c=a[0],d=n.addFile(c,{silent:!0,data:e.data||{},scopes:e.scopes||[],tags:e.tags||[]});i(d),n.uploadFile(d)}r.click()})},filesSelected(e,n){const r=this;!e||!e.length||(r.defaultScopes=[],r.defaultTags=[],r.defaultFreeformTags=[],[...e].forEach(i=>{r.addFile(i)}))},createObjectURL(e){return window.URL?window.URL.createObjectURL(e):window.webkitURL.createObjectURL(e)},show(){this.ui=!0},hide(){this.ui=!1},addFile(e,n){n=n||{};var r=this,i=e.name,s=e.size,o=e.type,l=r.$sdk.files.getBinaryTypeFromMime(o)||"file",a=`${i}-${s}`;if(!n.silent){var c=r.queue.some(function(m){return a==`${m.name}-${m.size}`});if(c)return}var d={name:i,size:s,mime:o,webkitRelativePath:e.webkitRelativePath,file:e,expanded:!1,local:r.createObjectURL(e),state:Kt,bytesLoaded:0,bytesTotal:0,percent:0,result:null,rendered:!1,item:{title:i,meta:{type:l,scopes:n.scopes||[],tags:n.tags||[]},data:{...n.data||{}}}};return new Dt.EventDispatcher().bootstrap(d),r.queue.unshift(d),d},cancelFile(e){e.state==et&&(e.cancel&&e.cancel("Cancelled"),e.bytesLoaded=0,e.percent=0,e.state=Kt,e.dispatch(SL))},removeFile(e){var n=this.queue.indexOf(e);this.cancelFile(e),this.queue.splice(n,1)},uploadNextFile(){var e=this;if(e.state==et){var n=e.queue.find(function(r){return r.state==Kt});if(!n){e.state=Kt,e.$sdk.notify("Upload Complete!",{lifetime:1e4});return}e.uploadFile(n)}},async uploadFile(e){var n=this;switch(e.state){case to:case et:return}e.state=et,e.dispatch(TL);{const u=e.size,m=e.name,f=e.mime,{data:h}=await n.$sdk.api.post("/file/check",{fileSize:u,fileName:m,fileType:f});if(h&&h.exists){e.result=h,e.state=to,e.result.meta,n.$sdk.notify(`${e.result.title} was uploaded successfully`),e.dispatch(Ih,h),n.uploadNextFile();return}}var r=Object.assign({},e.item||{});r.meta||(r.meta={}),(!r.meta.scopes||!r.meta.scopes.length)&&(r.meta.scopes=n.defaultScopes),r.tags||(r.tags=[]),n.defaultFreeformTags.length&&(r.tags=[...r.tags,...n.defaultFreeformTags]);var i=new FormData;i.set("json",JSON.stringify(r)),i.append("file",e.file,e.name);var s=i,o={headers:{"Content-Type":"multipart/form-data"},onUploadProgress:u=>{let m=Math.floor(u.loaded*100/u.total);e.percent=m,e.bytesLoaded=u.loaded,e.bytesTotal=u.total,e.dispatch(DL,u)}};const a=n.$sdk.api.CancelToken.source();o.cancelToken=a.token,e.cancel=a.cancel;let c="/file/upload";n.$sdk.fileAPI&&(c=`${n.$sdk.fileAPI}${c}`);var d=n.$sdk.api.post(c,s,o);d.then(function(u){e.result=u.data,e.state=to,e.result.meta,n.$sdk.notify(`${e.result.title} was uploaded successfully`),e.dispatch(Ih,u.data),n.uploadNextFile()}),d.catch(function(u){var m=n.$sdk.api.wasCancelled(u);m?e.state=Kt:(e.state=BL,e.dispatch(OL,u),n.uploadNextFile())})},toggle(){this.state===et?this.pause():this.start()},async start(){var e=this;if(e.state!==et){if(!e.defaultScopes.length){var n=e.$sdk.access.actionableScopes(e.user,"create","file"),r=e.$sdk.access.actionableScopes(e.user,"create","image"),i=e.$sdk.access.actionableScopes(e.user,"create","audio"),s=e.$sdk.access.actionableScopes(e.user,"create","video"),o=e.$sdk.utils.ids([...n,...r,...i,...s]);if(o.length===1)e.defaultScopes=o;else{var l=await e.$sdk.browse("scope",{maximum:0});if(!l||!l.length)return;e.defaultScopes=e.$sdk.utils.ids(l)}}e.state=et,e.uploadNextFile()}},pause(){var e=this;e.state===et&&(e.state=Kt,e.queue.forEach(function(n){e.cancelFile(n)}))},cancel(){var e=this;e.uploading?e.pause():(e.queue.length=0,e.defaultFreeformTags.length=0,e.defaultScopes.length=0)}}},FL={class:"uploader"},IL=["accept"],AL=["accept"];function LL(e,n,r,i,s,o){return t.openBlock(),t.createElementBlock("div",FL,[t.createElementVNode("input",{style:{display:"none"},accept:r.accept,ref:"file",type:"file",multiple:"",onChange:n[0]||(n[0]=l=>o.filesSelected(l.target.files))},null,40,IL),t.createElementVNode("input",{style:{display:"none"},accept:r.accept,ref:"immediateFile",type:"file"},null,8,AL),t.renderSlot(e.$slots,"default",{queue:s.queue,items:e.items,uploading:o.uploading,bytesLoaded:o.bytesLoaded,bytesTotal:o.bytesTotal,percent:o.percent,state:s.state})])}const $L=w(ML,[["render",LL]]);function PL(e,n){return n.reduce((r,i)=>Math.abs(i-e)<Math.abs(r-e)?i:r)}function RL(){var e=t.reactive({mounted:!1,screen:{width:1024,height:768},limits:{xs:600,sm:960,md:1264,lg:1904},breakpoint:{mobile:!1,tablet:!1,desktop:!1,xs:!1,sm:!1,md:!1,lg:!1,xl:!1,xsOnly:!1,smOnly:!1,smAndDown:!1,smAndUp:!1,mdOnly:!1,mdAndDown:!1,mdAndUp:!1,lgOnly:!1,lgAndDown:!1,lgAndUp:!1,xlOnly:!1,point:0},image:{auto:{low:768,med:1152,high:1536}}}),n;let r;return e.resize=function(){var i=Math.max(r.innerWidth||0),s=Math.max(r.innerHeight||0);e.screen={width:i,height:s};var o={mobile:!1,tablet:!1,desktop:!1,xs:!1,sm:!1,md:!1,lg:!1,xl:!1,xsOnly:!1,smOnly:!1,smAndDown:!1,smAndUp:!1,mdOnly:!1,mdAndDown:!1,mdAndUp:!1,lgOnly:!1,lgAndDown:!1,lgAndUp:!1,xlOnly:!1,point:0},l=0;i>e.limits.xs&&l++,i>e.limits.sm&&l++,i>e.limits.md&&l++,i>e.limits.lg&&l++,l<1&&(o.mobile=!0,o.xs=!0,o.xsOnly=!0,o.smAndDown=!0,o.mdAndDown=!0,o.lgAndDown=!0),l==1&&(o.tablet=!0,o.sm=!0,o.smOnly=!0,o.smAndDown=!0,o.mdAndDown=!0,o.lgAndDown=!0,o.smAndUp=!0),l==2&&(o.desktop=!0,o.md=!0,o.mdOnly=!0,o.mdAndDown=!0,o.lgAndDown=!0,o.smAndUp=!0,o.mdAndUp=!0),l==3&&(o.desktop=!0,o.lg=!0,o.lgOnly=!0,o.lgAndDown=!0,o.smAndUp=!0,o.mdAndUp=!0,o.lgAndUp=!0),l>3&&(o.desktop=!0,o.xl=!0,o.xlOnly=!0,o.smAndUp=!0,o.mdAndUp=!0,o.lgAndUp=!0),e.point=l,e.breakpoint=o;const c=PL(i,[320,768,1200,1800,2e3]),d=c*1,u=c*1.5,m=c*2;e.image={auto:{low:d,med:u,high:m}}},e.mount=function(i){n||(r=i,e.resize(),n=!0,e.mounted=!0,r.addEventListener("resize",e.resize))},e.unmount=function(){r.removeEventListener("resize",e.resize),r=!1,n=!1,e.mounted=!1},e}const UL=`qik vue ui ${jh}`,Ah={FlexColumn:cc,FlexBody:dc,FlexHeader:uc,FlexFooter:mc,FlexCell:fc,FlexSpacer:pc,FlexRow:hc,UxInfo:Wd,UxPanel:yc,UxPanelBody:gc,UxPanelHeader:kc,UxPanelFooter:_c,UxList:vd,UxListItem:eu,UxPill:Qd,UxForm:bl,UxFormField:eo,UxFieldWrapper:lh,UxSubmissionForm:oh,UxPaymentMethodForm:sh,UxRender:dh,UxRenderField:Nl,UxIcon:Yd,UxMenu:Jd,UxMenuList:Kd,UxImage:Zd,UxVideo:Xd,UxButton:Hd,UxCheckbox:gr,UxSwitch:ji,UxLink:Gd,UxTabset:Lc,UxTab:$c,UxMap:nm,Avatar:Ui,UxAvatar:Ui,UxLazy:zd,Spinner:Pt,UxSpinner:Pt,ProgressBar:qi,UxProgressBar:qi,UxModal:Bh,Compile:ch},jL={install(e,n){var i;if(console.log(UL),n.date=Q,n.global=n.global||t.reactive({}),(i=n.global)!=null&&i.cacheKeys||(n.global.cacheKeys=n.global.cacheKeys||t.reactive({})),!n.global.glossary){var r=lc(n);e.config.globalProperties.$glossary=r,n.global.glossary=r}n.modals=t.reactive([]),n.modal=function(s){return new Promise(function(o,l){s.id=String(n.modals.length),s.resolve=o,s.reject=l,n.modals.splice(s.id,0,s)})},n.prompt=function(s,o){return o=o||{},o.model=o.model||{},o.fields=s,n.modal({component:Dh,options:o})},n.browse=function(s,o){return o=o||{},o.type=s,o.model=o.model||[],n.modal({component:Oh,options:o})},n.tag=function(s){return s=s||{},s.model=s.model||[],n.modal({component:Fh,options:s})},n.selectScopes=async function(s){s=s||{},s.model=s.model||[];const{session:o}=await n.auth.getCurrentUser(),{type:l,action:a}=s;let c=s.definition||s.type;const d=n.access.actionableScopes(o,a,c,l);if(d.length===1){const u=await n.content.scopeGlossary({hash:!0});return Promise.resolve(d.map(function(m){return u[m]}))}return n.modal({component:Mh,options:s})},n.confirm=function(s,o){return o=o||{},o.title=s,n.modal({component:Sh,options:o})},n.options=function(s,o,l,a){return a=a||{},n.modal({component:Th,options:{title:o,description:l,choices:s,...a}})},n.closeModal=function(s){var o=n.modals.find(function(a){return String(a.id)==String(s)}),l=n.modals.indexOf(o);n.modals.splice(l,1)};for(const s in Ah){const o=Ah[s];e.component(s,o)}}};E.Avatar=Ui,E.CodeEditor=js,E.ContentBrowser=Eh,E.ContentSearch=cs,E.DateRange=es,E.Device=RL,E.FileDrop=ff,E.FlexBody=dc,E.FlexCell=fc,E.FlexColumn=cc,E.FlexFooter=mc,E.FlexHeader=uc,E.FlexRow=hc,E.FlexSpacer=pc,E.GlossaryService=lc,E.Info=Wd,E.InputMixin=z,E.Item=Ar,E.ModalMixin=Et,E.NativeSelect=Ke,E.Pager=jd,E.Panel=yc,E.PanelBody=gc,E.PanelFooter=_c,E.PanelHeader=kc,E.ProgressBar=qi,E.QikUI=jL,E.RememberScrollMixin=$d,E.ScopeSelect=Um,E.ScopeSelectButton=jm,E.Search=ot,E.Selection=uh,E.Spinner=Pt,E.StripeElement=So,E.StripeElements=To,E.Tagger=rm,E.UXButton=Hd,E.UXCheckbox=gr,E.UXCircle=pr,E.UXFieldWrapper=lh,E.UXForm=bl,E.UXFormField=eo,E.UXIcon=Yd,E.UXImage=Zd,E.UXLazy=zd,E.UXLink=Gd,E.UXList=vd,E.UXListItem=eu,E.UXLocationSelect=hf,E.UXMap=nm,E.UXMenu=Jd,E.UXMenuList=Kd,E.UXPaymentMethodForm=sh,E.UXPill=Qd,E.UXRender=dh,E.UXRenderField=Nl,E.UXSubmissionForm=oh,E.UXSwitch=ji,E.UXTab=$c,E.UXTable=Pd,E.UXTabset=Lc,E.UXVideo=Xd,E.UploadService=$L,E.UxConfirmModal=Sh,E.UxContentModal=Oh,E.UxModal=Bh,E.UxOptionsModal=Th,E.UxPromptModal=Dh,E.UxScopeModal=Mh,E.UxTaggerModal=Fh,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
28
28
  //# sourceMappingURL=lib.umd.js.map