formeo 3.0.7 → 3.1.0
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/demo/assets/css/demo.min.css +2 -2
- package/dist/demo/assets/css/demo.min.css.gz +0 -0
- package/dist/demo/assets/css/formeo.min.css +1 -1
- package/dist/demo/assets/css/formeo.min.css.gz +0 -0
- package/dist/demo/assets/js/demo.min.js +2 -2
- package/dist/demo/assets/js/demo.min.js.gz +0 -0
- package/dist/demo/assets/js/formeo.min.js +3 -3
- package/dist/demo/assets/js/formeo.min.js.gz +0 -0
- package/dist/demo/assets/js/mode-json.min.js +282 -0
- package/dist/demo/assets/js/mode-json.min.js.gz +0 -0
- package/dist/demo/assets/js/theme-github_light_default.min.js +25 -0
- package/dist/demo/index.html +1 -1
- package/dist/formeo.cjs.js +3 -3
- package/dist/formeo.es.js +18 -16
- package/dist/formeo.min.css +1 -1
- package/dist/formeo.min.js +3 -3
- package/dist/formeo.umd.js +3 -3
- package/package.json +2 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
formeo - https://formeo.io
|
|
4
|
-
Version: 3.0.
|
|
4
|
+
Version: 3.0.8
|
|
5
5
|
Author: Draggable https://draggable.io
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).formeo={})}(this,(function(t){"use strict";var e=Object.defineProperty,n=(t,n,o)=>((t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o)(t,"symbol"!=typeof n?n+"":n,o);const o={extension:".lang",location:"assets/lang/",langs:["en-US"],locale:"en-US",override:{}};class i{constructor(t=o){this.langs=Object.create(null),this.loaded=[],this.processConfig(t)}processConfig(t){const{location:e,...n}={...o,...t},i=e.replace(/\/?$/,"/");this.config={location:i,...n};const{override:r,preloaded:s={}}=this.config,a=Object.entries(this.langs).concat(Object.entries(r||s));this.langs=a.reduce(((t,[e,n])=>(t[e]=this.applyLanguage(e,n),t)),{}),this.locale=this.config.locale||this.config.langs[0]}init(t){return this.processConfig({...this.config,...t}),this.setCurrent(this.locale)}addLanguage(t,e={}){e="string"==typeof e?i.processFile(e):e,this.applyLanguage(t,e),this.config.langs.push("locale")}getValue(t,e=this.locale){var n;return(null==(n=this.langs[e])?void 0:n[t])||this.getFallbackValue(t)}getFallbackValue(t){const e=Object.values(this.langs).find((e=>e[t]));return null==e?void 0:e[t]}makeSafe(t){const e={"{":"\\{","}":"\\}","|":"\\|"};return t=t.replace(/[{}|]/g,(t=>e[t])),new RegExp(t,"g")}put(t,e){return this.current[t]=e,e}get(t,e){const n=this;let o=this.getValue(t);if(!o)return;const i=o.match(/\{[^}]+?\}/g);if(e&&i)if("object"==typeof e)for(const r of i){const t=r.substring(1,r.length-1);o=o.replace(n.makeSafe(r),e[t]||"")}else o=o.replace(/\{[^}]+?\}/g,e);return o}static processFile(t){return i.fromFile(t.replace(/\n\n/g,"\n"))}static fromFile(t){const e=t.split("\n"),n={};for(let o,i=0;i<e.length;i++){o=/^(.+?) *?= *?([^\n]+)/.exec(e[i]),o&&(n[o[1]]=o[2].replace(/(^\s+|\s+$)/g,""))}return n}loadLang(t,e=!0){const n=this;return new Promise((function(o,r){if(-1!==n.loaded.indexOf(t)&&e)return n.applyLanguage(n.langs[t]),o(n.langs[t]);return async function(t){try{const e=await fetch(t);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const n=t.endsWith(".lang")?"text":"json";return await e[n]()}catch(e){throw e}}([n.config.location,t,n.config.extension].join("")).then((e=>{const r=i.processFile(e);return n.applyLanguage(t,r),n.loaded.push(t),o(n.langs[t])})).catch((e=>{const i=n.applyLanguage(t);o(i)}))}))}applyLanguage(t,e={}){const n=this.config.override[t]||{},o=this.langs[t]||{};return this.langs[t]={...o,...e,...n},this.langs[t]}get getLangs(){return this.config.langs}async setCurrent(t="en-US"){return await this.loadLang(t),this.locale=t,this.current=this.langs[t],this.current}}const r=new i;!function(){try{if("undefined"!=typeof document){var t=document.createElement("style");t.appendChild(document.createTextNode('._3x4ZIcu-{position:absolute;background:#1f2937;color:#fff;padding:.75rem;border-radius:.375rem;max-width:200px;z-index:50;visibility:hidden;opacity:0;transition:opacity .2s;pointer-events:none;left:0;top:0}._3x4ZIcu-.JIt36hCJ{visibility:visible;opacity:1;pointer-events:all}._3x4ZIcu-:before{content:"";position:absolute;width:0;height:0;border:6px solid transparent}._3x4ZIcu-[data-position=top]:before{border-top-color:#1f2937;bottom:-12px;left:50%;transform:translate(-50%)}._3x4ZIcu-[data-position=bottom]:before{border-bottom-color:#1f2937;top:-12px;left:50%;transform:translate(-50%)}._3x4ZIcu-[data-position=left]:before{border-left-color:#1f2937;right:-12px;top:50%;transform:translateY(-50%)}._3x4ZIcu-[data-position=right]:before{border-right-color:#1f2937;left:-12px;top:50%;transform:translateY(-50%)}._3x4ZIcu-[data-position=top-left]:before{border-top-color:#1f2937;bottom:-12px;left:12px;transform:none}._3x4ZIcu-[data-position=top-right]:before{border-top-color:#1f2937;bottom:-12px;right:12px;left:auto;transform:none}._3x4ZIcu-[data-position=bottom-left]:before{border-bottom-color:#1f2937;top:-12px;left:12px;transform:none}._3x4ZIcu-[data-position=bottom-right]:before{border-bottom-color:#1f2937;top:-12px;right:12px;left:auto;transform:none}')),document.head.appendChild(t)}}catch(e){}}();var s=Object.defineProperty,a=(t,e,n)=>((t,e,n)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);const l="_3x4ZIcu-",c="JIt36hCJ",d={triggerName:"tooltip"};class u{constructor(t=d){a(this,"triggerName"),a(this,"tooltip"),a(this,"activeTriggerType",null),a(this,"spacing",12),a(this,"handleClick",(t=>{const e=this.triggerName,n=t.target.closest(`[${e}][${e}-type="click"]`);if(n)if(this.isVisible())this.hide();else{const t=n.getAttribute(`${e}`);this.show(n,t),this.activeTriggerType="click"}else this.hide()})),a(this,"handleMouseOver",(t=>{const e=this.triggerName,n=t.target.closest(`[${e}]`);if("click"!==this.activeTriggerType&&"click"!==(null==n?void 0:n.getAttribute(`${e}-type`))){const t=null==n?void 0:n.getAttribute(`${e}`);t&&(this.show(n,t),this.activeTriggerType="hover")}})),a(this,"handleMouseOut",(t=>{const e=this.triggerName,n=t.target.closest(`[${e}]`);"click"!==this.activeTriggerType&&"click"!==(null==n?void 0:n.getAttribute(`${e}-type`))&&this.hide()})),a(this,"handleResize",(()=>{this.isVisible()&&this.hide()})),a(this,"handleScroll",(()=>{this.isVisible()&&this.hide()})),this.triggerName=`data-${t.triggerName}`,this.tooltip=document.createElement("div"),this.tooltip.className=`d-tooltip ${l}`,document.body.appendChild(this.tooltip),this.setupEventListeners()}setupEventListeners(){document.addEventListener("mouseover",this.handleMouseOver),document.addEventListener("mouseout",this.handleMouseOut),document.addEventListener("touchstart",this.handleMouseOver),document.addEventListener("touchend",this.handleMouseOut),document.addEventListener("click",this.handleClick),window.addEventListener("resize",this.handleResize),window.addEventListener("scroll",this.handleScroll,!0)}isVisible(){return this.tooltip.classList.contains(c)}calculatePosition(t){const e=t.getBoundingClientRect(),n=this.tooltip.getBoundingClientRect(),o=[{name:"top",x:e.left+(e.width-n.width)/2,y:e.top-n.height-this.spacing},{name:"bottom",x:e.left+(e.width-n.width)/2,y:e.bottom+this.spacing},{name:"left",x:e.left-n.width-this.spacing,y:e.top+(e.height-n.height)/2},{name:"right",x:e.right+this.spacing,y:e.top+(e.height-n.height)/2},{name:"top-left",x:e.left,y:e.top-n.height-this.spacing},{name:"top-right",x:e.right-n.width,y:e.top-n.height-this.spacing},{name:"bottom-left",x:e.left,y:e.bottom+this.spacing},{name:"bottom-right",x:e.right-n.width,y:e.bottom+this.spacing}];return o.find((t=>this.fitsInViewport(t,n)))||o[0]}fitsInViewport(t,e){if(!(t.x>=0&&t.y>=0&&t.x+e.width<=window.innerWidth&&t.y+e.height<=window.innerHeight))return!1;return 0===[[t.x,t.y],[t.x+e.width,t.y],[t.x,t.y+e.height],[t.x+e.width,t.y+e.height],[t.x+e.width/2,t.y+e.height/2]].flatMap((([t,e])=>Array.from(document.elementsFromPoint(t,e)))).filter((t=>{if(this.tooltip.contains(t)||t===this.tooltip||t.classList.contains(l)||"none"===getComputedStyle(t).pointerEvents)return!1})).length}show(t,e){this.tooltip.innerHTML=e??"",this.tooltip.classList.add(c);const n=this.calculatePosition(t);this.tooltip.style.left=`${n.x}px`,this.tooltip.style.top=`${n.y}px`,this.tooltip.dataset.position=n.name}hide(){this.tooltip.classList.remove(c),this.activeTriggerType=null}destroy(){document.removeEventListener("mouseover",this.handleMouseOver),document.removeEventListener("mouseout",this.handleMouseOut),document.removeEventListener("touchstart",this.handleMouseOver),document.removeEventListener("touchend",this.handleMouseOut),document.removeEventListener("click",this.handleClick),window.removeEventListener("resize",this.handleResize),window.removeEventListener("scroll",this.handleScroll,!0),this.tooltip.remove()}}void 0!==window&&(window.SmartTooltip=u);const h="formeo",p="3.0.6",f="formeo-sprite",m=[{name:"cssPreload",src:"//cdnjs.cloudflare.com/ajax/libs/loadCSS/2.0.1/cssrelpreload.min.js"},{name:"mutationObserver",src:"//cdn.jsdelivr.net/npm/mutationobserver-shim/dist/mutationobserver.min.js"},{name:"fetch",src:"https://unpkg.com/unfetch/polyfill"}],g=`https://cdn.jsdelivr.net/npm/formeo@${p}/dist/${f}.svg`,v=`https://draggable.github.io/formeo/assets/img/${f}.svg`,b=`https://cdn.jsdelivr.net/npm/formeo@${p}/dist/formeo.min.css`,y="control-group",w=`${h}-stage`,C=`${h}-row`,E=`${h}-column`,x=`${h}-field`,S="custom-column-widths",O="column-preset",_="resizing-columns",N=new Map([[w,C],[C,E],[E,x]]),A=["external","stages","rows","columns","fields"],j=["stage","row","column","field"].reduce(((t,e)=>({...t,[e]:e})),{}),T=[{name:"controls",className:y},{name:"stage",className:w},{name:"row",className:C},{name:"column",className:E},{name:"field",className:x}],P={controls:y,stage:w,row:C,column:E,field:x},L=Object.entries(P).reduce(((t,[e,n])=>({...t,[n]:e})),{}),D=Object.values(P),k=new RegExp(`${D.join("|")}`,"g"),$=T.map((({name:t},e,n)=>{const{name:o}=n[e+1]||{};return o&&[t,o]})).filter(Boolean),I=$.slice().map((t=>t.slice().reverse())).reverse(),M=new Map($),R=new Map(I.slice()),F=new Map([[{value:"100.0",label:"100%"}],[{value:"50.0,50.0",label:"50 | 50"},{value:"33.3,66.6",label:"33 | 66"},{value:"66.6,33.3",label:"66 | 33"}],[{value:"33.3,33.3,33.3",label:"33 | 33 | 33"},{value:"25.0,25.0,50.0",label:"25 | 25 | 50"},{value:"50.0,25.0,25.0",label:"50 | 25 | 25"},{value:"25.0,50.0,25.0",label:"25 | 50 | 25"}],[{value:"25.0,25.0,25.0,25.0",label:"25 | 25 | 25 | 25"}],[{value:"20.0,20.0,20.0,20.0,20.0",label:"20 | 20 | 20 | 20 | 20"}],[{value:"16.66,16.66,16.66,16.66,16.66,16.66",label:"16.66 | 16.66 | 16.66 | 16.66 | 16.66 | 16.66"}]].reduce(((t,e,n)=>(t.push([n,e]),t)),[])),W=[{type:"added",condition:(t,e)=>Boolean(void 0===t&&e)}],B=`${h}-formData`,z=`${h}-locale`,q=333,U=Math.round(166.5),H=Math.round(666),X="formeoSaved",V="formeoUpdated",Y="formeoOnRender",G=["label","logical","source","thenTarget","sourceProperty","comparison","target","targetProperty","assignment","value"],Z={value:"attrs.value",checked:"attrs.checked",isVisible:"config.isVisible",isNotVisible:"config.isNotVisible"},J={comparison:{equals:"==",notEquals:"!=",contains:"⊃",notContains:"!⊃"},assignment:{equals:"="},logical:{and:"&&",or:"||"},property:Z},K=/(\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b)/gi,Q=/\bcol-\w+-\d+/g,tt="f-i-";var et="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function nt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ot=function(){this.__data__=[],this.size=0};var it=function(t,e){return t===e||t!=t&&e!=e},rt=it;var st=function(t,e){for(var n=t.length;n--;)if(rt(t[n][0],e))return n;return-1},at=st,lt=Array.prototype.splice;var ct=st;var dt=st;var ut=st;var ht=ot,pt=function(t){var e=this.__data__,n=at(e,t);return!(n<0)&&(n==e.length-1?e.pop():lt.call(e,n,1),--this.size,!0)},ft=function(t){var e=this.__data__,n=ct(e,t);return n<0?void 0:e[n][1]},mt=function(t){return dt(this.__data__,t)>-1},gt=function(t,e){var n=this.__data__,o=ut(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this};function vt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}vt.prototype.clear=ht,vt.prototype.delete=pt,vt.prototype.get=ft,vt.prototype.has=mt,vt.prototype.set=gt;var bt=vt,yt=bt;var wt=function(){this.__data__=new yt,this.size=0};var Ct=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n};var Et=function(t){return this.__data__.get(t)};var xt=function(t){return this.__data__.has(t)},St="object"==typeof et&&et&&et.Object===Object&&et,Ot=St,_t="object"==typeof self&&self&&self.Object===Object&&self,Nt=Ot||_t||Function("return this")(),At=Nt.Symbol,jt=At,Tt=Object.prototype,Pt=Tt.hasOwnProperty,Lt=Tt.toString,Dt=jt?jt.toStringTag:void 0;var kt=function(t){var e=Pt.call(t,Dt),n=t[Dt];try{t[Dt]=void 0;var o=!0}catch(r){}var i=Lt.call(t);return o&&(e?t[Dt]=n:delete t[Dt]),i},$t=Object.prototype.toString;var It=kt,Mt=function(t){return $t.call(t)},Rt=At?At.toStringTag:void 0;var Ft=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Rt&&Rt in Object(t)?It(t):Mt(t)};var Wt=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},Bt=Ft,zt=Wt;var qt,Ut=function(t){if(!zt(t))return!1;var e=Bt(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},Ht=Nt["__core-js_shared__"],Xt=(qt=/[^.]+$/.exec(Ht&&Ht.keys&&Ht.keys.IE_PROTO||""))?"Symbol(src)_1."+qt:"";var Vt=function(t){return!!Xt&&Xt in t},Yt=Function.prototype.toString;var Gt=function(t){if(null!=t){try{return Yt.call(t)}catch(e){}try{return t+""}catch(e){}}return""},Zt=Ut,Jt=Vt,Kt=Wt,Qt=Gt,te=/^\[object .+?Constructor\]$/,ee=Function.prototype,ne=Object.prototype,oe=ee.toString,ie=ne.hasOwnProperty,re=RegExp("^"+oe.call(ie).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var se=function(t){return!(!Kt(t)||Jt(t))&&(Zt(t)?re:te).test(Qt(t))},ae=function(t,e){return null==t?void 0:t[e]};var le=function(t,e){var n=ae(t,e);return se(n)?n:void 0},ce=le(Nt,"Map"),de=le(Object,"create"),ue=de;var he=function(){this.__data__=ue?ue(null):{},this.size=0};var pe=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},fe=de,me=Object.prototype.hasOwnProperty;var ge=function(t){var e=this.__data__;if(fe){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return me.call(e,t)?e[t]:void 0},ve=de,be=Object.prototype.hasOwnProperty;var ye=de;var we=he,Ce=pe,Ee=ge,xe=function(t){var e=this.__data__;return ve?void 0!==e[t]:be.call(e,t)},Se=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=ye&&void 0===e?"__lodash_hash_undefined__":e,this};function Oe(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}Oe.prototype.clear=we,Oe.prototype.delete=Ce,Oe.prototype.get=Ee,Oe.prototype.has=xe,Oe.prototype.set=Se;var _e=Oe,Ne=bt,Ae=ce;var je=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Te=function(t,e){var n=t.__data__;return je(e)?n["string"==typeof e?"string":"hash"]:n.map},Pe=Te;var Le=Te;var De=Te;var ke=Te;var $e=function(){this.size=0,this.__data__={hash:new _e,map:new(Ae||Ne),string:new _e}},Ie=function(t){var e=Pe(this,t).delete(t);return this.size-=e?1:0,e},Me=function(t){return Le(this,t).get(t)},Re=function(t){return De(this,t).has(t)},Fe=function(t,e){var n=ke(this,t),o=n.size;return n.set(t,e),this.size+=n.size==o?0:1,this};function We(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}We.prototype.clear=$e,We.prototype.delete=Ie,We.prototype.get=Me,We.prototype.has=Re,We.prototype.set=Fe;var Be=We,ze=bt,qe=ce,Ue=Be;var He=bt,Xe=wt,Ve=Ct,Ye=Et,Ge=xt,Ze=function(t,e){var n=this.__data__;if(n instanceof ze){var o=n.__data__;if(!qe||o.length<199)return o.push([t,e]),this.size=++n.size,this;n=this.__data__=new Ue(o)}return n.set(t,e),this.size=n.size,this};function Je(t){var e=this.__data__=new He(t);this.size=e.size}Je.prototype.clear=Xe,Je.prototype.delete=Ve,Je.prototype.get=Ye,Je.prototype.has=Ge,Je.prototype.set=Ze;var Ke=Je,Qe=le,tn=function(){try{var t=Qe(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),en=tn;var nn=function(t,e,n){"__proto__"==e&&en?en(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n},on=nn,rn=it;var sn=function(t,e,n){(void 0!==n&&!rn(t[e],n)||void 0===n&&!(e in t))&&on(t,e,n)};var an,ln,cn,dn,un,hn,pn,fn=function(t){return function(e,n,o){for(var i=-1,r=Object(e),s=o(e),a=s.length;a--;){var l=s[t?a:++i];if(!1===n(r[l],l,r))break}return e}}(),mn={exports:{}};an=mn,cn=Nt,dn=(ln=mn.exports)&&!ln.nodeType&&ln,un=dn&&an&&!an.nodeType&&an,hn=un&&un.exports===dn?cn.Buffer:void 0,pn=hn?hn.allocUnsafe:void 0,an.exports=function(t,e){if(e)return t.slice();var n=t.length,o=pn?pn(n):new t.constructor(n);return t.copy(o),o};var gn=mn.exports,vn=Nt.Uint8Array,bn=vn;var yn=function(t){var e=new t.constructor(t.byteLength);return new bn(e).set(new bn(t)),e};var wn=function(t,e){var n=e?yn(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)};var Cn=function(t,e){var n=-1,o=t.length;for(e||(e=Array(o));++n<o;)e[n]=t[n];return e},En=Wt,xn=Object.create,Sn=function(){function t(){}return function(e){if(!En(e))return{};if(xn)return xn(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();var On=function(t,e){return function(n){return t(e(n))}},_n=On(Object.getPrototypeOf,Object),Nn=Object.prototype;var An=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Nn)},jn=Sn,Tn=_n,Pn=An;var Ln=function(t){return"function"!=typeof t.constructor||Pn(t)?{}:jn(Tn(t))};var Dn=function(t){return null!=t&&"object"==typeof t},kn=Ft,$n=Dn;var In=function(t){return $n(t)&&"[object Arguments]"==kn(t)},Mn=Dn,Rn=Object.prototype,Fn=Rn.hasOwnProperty,Wn=Rn.propertyIsEnumerable,Bn=In(function(){return arguments}())?In:function(t){return Mn(t)&&Fn.call(t,"callee")&&!Wn.call(t,"callee")},zn=Bn,qn=Array.isArray;var Un=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},Hn=Ut,Xn=Un;var Vn=function(t){return null!=t&&Xn(t.length)&&!Hn(t)},Yn=Vn,Gn=Dn;var Zn=function(t){return Gn(t)&&Yn(t)},Jn={exports:{}};var Kn=function(){return!1};!function(t,e){var n=Nt,o=Kn,i=e&&!e.nodeType&&e,r=i&&t&&!t.nodeType&&t,s=r&&r.exports===i?n.Buffer:void 0,a=(s?s.isBuffer:void 0)||o;t.exports=a}(Jn,Jn.exports);var Qn=Jn.exports,to=Ft,eo=_n,no=Dn,oo=Function.prototype,io=Object.prototype,ro=oo.toString,so=io.hasOwnProperty,ao=ro.call(Object);var lo=function(t){if(!no(t)||"[object Object]"!=to(t))return!1;var e=eo(t);if(null===e)return!0;var n=so.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&ro.call(n)==ao},co=Ft,uo=Un,ho=Dn,po={};po["[object Float32Array]"]=po["[object Float64Array]"]=po["[object Int8Array]"]=po["[object Int16Array]"]=po["[object Int32Array]"]=po["[object Uint8Array]"]=po["[object Uint8ClampedArray]"]=po["[object Uint16Array]"]=po["[object Uint32Array]"]=!0,po["[object Arguments]"]=po["[object Array]"]=po["[object ArrayBuffer]"]=po["[object Boolean]"]=po["[object DataView]"]=po["[object Date]"]=po["[object Error]"]=po["[object Function]"]=po["[object Map]"]=po["[object Number]"]=po["[object Object]"]=po["[object RegExp]"]=po["[object Set]"]=po["[object String]"]=po["[object WeakMap]"]=!1;var fo=function(t){return ho(t)&&uo(t.length)&&!!po[co(t)]};var mo=function(t){return function(e){return t(e)}},go={exports:{}};!function(t,e){var n=St,o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,r=i&&i.exports===o&&n.process,s=function(){try{var t=i&&i.require&&i.require("util").types;return t||r&&r.binding&&r.binding("util")}catch(e){}}();t.exports=s}(go,go.exports);var vo=go.exports,bo=fo,yo=mo,wo=vo&&vo.isTypedArray,Co=wo?yo(wo):bo;var Eo=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},xo=nn,So=it,Oo=Object.prototype.hasOwnProperty;var _o=function(t,e,n){var o=t[e];Oo.call(t,e)&&So(o,n)&&(void 0!==n||e in t)||xo(t,e,n)},No=_o,Ao=nn;var jo=function(t,e,n,o){var i=!n;n||(n={});for(var r=-1,s=e.length;++r<s;){var a=e[r],l=o?o(n[a],t[a],a,n,t):void 0;void 0===l&&(l=t[a]),i?Ao(n,a,l):No(n,a,l)}return n};var To=/^(?:0|[1-9]\d*)$/;var Po=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&To.test(t))&&t>-1&&t%1==0&&t<e},Lo=function(t,e){for(var n=-1,o=Array(t);++n<t;)o[n]=e(n);return o},Do=zn,ko=qn,$o=Qn,Io=Po,Mo=Co,Ro=Object.prototype.hasOwnProperty;var Fo=function(t,e){var n=ko(t),o=!n&&Do(t),i=!n&&!o&&$o(t),r=!n&&!o&&!i&&Mo(t),s=n||o||i||r,a=s?Lo(t.length,String):[],l=a.length;for(var c in t)!e&&!Ro.call(t,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Io(c,l))||a.push(c);return a};var Wo=Wt,Bo=An,zo=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e},qo=Object.prototype.hasOwnProperty;var Uo=Fo,Ho=function(t){if(!Wo(t))return zo(t);var e=Bo(t),n=[];for(var o in t)("constructor"!=o||!e&&qo.call(t,o))&&n.push(o);return n},Xo=Vn;var Vo=function(t){return Xo(t)?Uo(t,!0):Ho(t)},Yo=jo,Go=Vo;var Zo=sn,Jo=gn,Ko=wn,Qo=Cn,ti=Ln,ei=zn,ni=qn,oi=Zn,ii=Qn,ri=Ut,si=Wt,ai=lo,li=Co,ci=Eo,di=function(t){return Yo(t,Go(t))};var ui=Ke,hi=sn,pi=fn,fi=function(t,e,n,o,i,r,s){var a=ci(t,n),l=ci(e,n),c=s.get(l);if(c)Zo(t,n,c);else{var d=r?r(a,l,n+"",t,e,s):void 0,u=void 0===d;if(u){var h=ni(l),p=!h&&ii(l),f=!h&&!p&&li(l);d=l,h||p||f?ni(a)?d=a:oi(a)?d=Qo(a):p?(u=!1,d=Jo(l,!0)):f?(u=!1,d=Ko(l,!0)):d=[]:ai(l)||ei(l)?(d=a,ei(a)?d=di(a):si(a)&&!ri(a)||(d=ti(l))):u=!1}u&&(s.set(l,d),i(d,l,o,r,s),s.delete(l)),Zo(t,n,d)}},mi=Wt,gi=Vo,vi=Eo;var bi=function t(e,n,o,i,r){e!==n&&pi(n,(function(s,a){if(r||(r=new ui),mi(s))fi(e,n,a,o,t,i,r);else{var l=i?i(vi(e,a),s,a+"",e,n,r):void 0;void 0===l&&(l=s),hi(e,a,l)}}),gi)};var yi=function(t){return t};var wi=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)},Ci=Math.max;var Ei=function(t,e,n){return e=Ci(void 0===e?t.length-1:e,0),function(){for(var o=arguments,i=-1,r=Ci(o.length-e,0),s=Array(r);++i<r;)s[i]=o[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=o[i];return a[e]=n(s),wi(t,this,a)}};var xi=function(t){return function(){return t}},Si=tn,Oi=Si?function(t,e){return Si(t,"toString",{configurable:!0,enumerable:!1,value:xi(e),writable:!0})}:yi,_i=Date.now;var Ni=function(t){var e=0,n=0;return function(){var o=_i(),i=16-(o-n);if(n=o,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}},Ai=Ni(Oi),ji=yi,Ti=Ei,Pi=Ai;var Li=it,Di=Vn,ki=Po,$i=Wt;var Ii=function(t,e){return Pi(Ti(t,e,ji),t+"")},Mi=function(t,e,n){if(!$i(n))return!1;var o=typeof e;return!!("number"==o?Di(n)&&ki(e,n.length):"string"==o&&e in n)&&Li(n[e],t)};var Ri=bi;const Fi=nt(function(t){return Ii((function(e,n){var o=-1,i=n.length,r=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(r=t.length>3&&"function"==typeof r?(i--,r):void 0,s&&Mi(n[0],n[1],s)&&(r=i<3?void 0:r,i=1),e=Object(e);++o<i;){var a=n[o];a&&t(e,a,o,r)}return e}))}((function(t,e,n,o){Ri(t,e,n,o)}))),Wi=()=>crypto.randomUUID(),Bi=(t="",e)=>{if(!e)return!1;const n=/[|\\{}()[\]^*$+?.]/g;let o="string"==typeof e?[e]:e;o=o.map((t=>"*"===t?"":t.replace(n,"\\$&")));let i=!0;return o.length&&(i=!new RegExp(o.join("|"),"i").exec(t)),i},zi=t=>{var e;const n=null==(e=t.className)?void 0:e.match(k);return n&&L[n[0]]},qi=t=>Array.from(new Set(t)),Ui=t=>{let e;if(t){const{attrs:n={}}=t;e=n.id||t.id||Wi(),t.id=e}else e=Wi();return e},Hi=(t,e)=>Fi({},t,e,((t,e)=>Array.isArray(t)?null!=e?qi(t.concat(e)):e:Array.isArray(e)?null!=t?qi(e.concat(t)):e:void 0)),Xi=t=>{let e;if(null===t||!("object"==typeof t)||t instanceof Promise)return t;if(t instanceof Date)return e=new Date,e.setTime(t.getTime()),e;if(Array.isArray(t)){e=[];for(let n=0,o=t.length;n<o;n++)e[n]=Xi(t[n]);return e}if(t instanceof Object){e={};for(const n in t)Object.hasOwn(t,n)&&(e[n]=Xi(t[n]));return e}throw new Error("Unable to copy Object, type not supported.")},Vi=(t,e)=>t/e*100,Yi=t=>`${t.toString()}%`,Gi=Object.create(null,{get:{value:t=>{var e;const n=null==(e=window.sessionStorage)?void 0:e.getItem(t);try{return JSON.parse(n)}catch(o){return n}}},set:{value:(t,e)=>{var n;try{return null==(n=window.sessionStorage)?void 0:n.setItem(t,JSON.stringify(e))}catch(o){}}}}),Zi=t=>A.some((e=>new RegExp(`^${e}.`).test(t))),Ji=t=>t.startsWith("external");function Ki(t,e=H){let n=0;return function(...o){const i=Date.now();i-n>=e&&(n=i,t.apply(this,o))}}function Qi(t){return t}function tr(){}function er(t=Object.create(null)){if("string"==typeof t)try{return JSON.parse(t)}catch(e){return Object.create(null)}return t}const nr=t=>t?Xi(er(t)):{};var or=Ft,ir=Dn;var rr=function(t){return"symbol"==typeof t||ir(t)&&"[object Symbol]"==or(t)},sr=qn,ar=rr,lr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,cr=/^\w*$/;var dr=function(t,e){if(sr(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!ar(t))||(cr.test(t)||!lr.test(t)||null!=e&&t in Object(e))},ur=Be;function hr(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var o=arguments,i=e?e.apply(this,o):o[0],r=n.cache;if(r.has(i))return r.get(i);var s=t.apply(this,o);return n.cache=r.set(i,s)||r,s};return n.cache=new(hr.Cache||ur),n}hr.Cache=ur;var pr=hr;var fr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,mr=/\\(\\)?/g,gr=function(t){var e=pr(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(fr,(function(t,n,o,i){e.push(o?i.replace(mr,"$1"):n||t)})),e}));var vr=function(t,e){for(var n=-1,o=null==t?0:t.length,i=Array(o);++n<o;)i[n]=e(t[n],n,t);return i},br=qn,yr=rr,wr=At?At.prototype:void 0,Cr=wr?wr.toString:void 0;var Er=function t(e){if("string"==typeof e)return e;if(br(e))return vr(e,t)+"";if(yr(e))return Cr?Cr.call(e):"";var n=e+"";return"0"==n&&1/e==-1/0?"-0":n},xr=Er;var Sr=qn,Or=dr,_r=gr,Nr=function(t){return null==t?"":xr(t)};var Ar=function(t,e){return Sr(t)?t:Or(t,e)?[t]:_r(Nr(t))},jr=rr;var Tr=function(t){if("string"==typeof t||jr(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e},Pr=_o,Lr=Ar,Dr=Po,kr=Wt,$r=Tr;var Ir=function(t,e,n,o){if(!kr(t))return t;for(var i=-1,r=(e=Lr(e,t)).length,s=r-1,a=t;null!=a&&++i<r;){var l=$r(e[i]),c=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return t;if(i!=s){var d=a[l];void 0===(c=o?o(d,l,a):void 0)&&(c=kr(d)?d:Dr(e[i+1])?[]:{})}Pr(a,l,c),a=a[l]}return t};const Mr=nt((function(t,e,n){return null==t?t:Ir(t,e,n)}));var Rr=Ar,Fr=Tr;var Wr=function(t,e){for(var n=0,o=(e=Rr(e,t)).length;null!=t&&n<o;)t=t[Fr(e[n++])];return n&&n==o?t:void 0};const Br=nt((function(t,e,n){var o=null==t?void 0:Wr(t,e);return void 0===o?n:o})),zr=Mr,qr=t=>Number.isInteger(Number(t)),Ur=(t,e)=>{const n=e||t.parentElement;return Array.prototype.slice.call(n.childNodes).indexOf(t)},Hr=(t,e,n)=>{const o=n.split("||"),i=qi(e).map((e=>t.find((t=>{const n=o.find((e=>!!Br(t,e)));return n&&Br(t,n)===e})))).filter(Boolean).concat(t);return qi(i)},Xr=(t,e,n)=>{for(let o=0;o<t.length;o++)e.call(n,t[o],o)},Vr=(t,e)=>{const n=[];return Xr(t,((t,o)=>n.push(e(t,o)))),n},Yr={},Gr=t=>t.replace(/\b\w/g,(t=>t.toUpperCase())),Zr=()=>-1!==window.navigator.userAgent.indexOf("MSIE "),Jr={capitalize:Gr,safeAttrName:t=>{if(Yr[t])return Yr[t];const e=({className:"class"}[t]||t).replace(/^\d+/,"").replace(/[^a-zA-Z0-9-:]/g,"");return Yr[t]=e,e},forEach:Xr,copyObj:t=>window.JSON.parse(window.JSON.stringify(t)),map:Vr,subtract:(t,e)=>e.filter((e=>!~t.indexOf(e))),indexOfNode:Ur,isInt:qr,get:Br,orderObjectsBy:Hr,isIE:Zr},Kr={getStyle:(t,e=!1)=>{let n;return window.getComputedStyle?n=window.getComputedStyle(t,null):t.currentStyle&&(n=t.currentStyle),e?n[e]:n},fadeOut:(t,e=250)=>{const n=1/(e/60);t.style.opacity=1,function e(){const o=Number(t.style.opacity)-n;o>0?(t.style.opacity=o,window.requestAnimationFrame(e)):t.remove()}()},slideDown:(t,e=250,n=!1)=>{t.style.display="block";const o=Kr.getStyle(t),i=parseInt(o.height,10),r=i/(e/60);t.style.height="0px",function e(){const o=parseFloat(t.style.height),s=o+r;o<i?(t.style.height=s+"px",window.requestAnimationFrame(e)):(t.style.height="auto",n&&n(t))}()},slideUp:(t,e=250,n=!1)=>{const o=Kr.getStyle(t),i=parseInt(o.height),r=o.overflow;t.style.overflow="hidden",t.style.height=i+"px";const s=o.minHeight;t.style.minHeight="auto";const a=parseFloat(i/(e/60)).toFixed(2);!function e(){const o=parseInt(t.style.height,10)-a;o>0?(t.style.height=o+"px",window.requestAnimationFrame(e)):(t.style.overflow=r,t.style.display="none",t.style.minHeight=s,delete t.style.height,n&&n(t))}()},slideToggle:(t,e=250,n="none"===Kr.getStyle(t,"display"))=>{n?Kr.slideDown(t,e):Kr.slideUp(t,e)}},Qr="no-transition",ts={debug:!1,bubbles:!0,formeoLoaded:t=>{},onAdd:()=>{},onUpdate:t=>{var e;return(null==(e=ns.opts)?void 0:e.debug)&&void 0},onUpdateStage:t=>{var e;return(null==(e=ns.opts)?void 0:e.debug)&&void 0},onUpdateRow:t=>{var e;return(null==(e=ns.opts)?void 0:e.debug)&&void 0},onUpdateColumn:t=>{var e;return(null==(e=ns.opts)?void 0:e.debug)&&void 0},onUpdateField:t=>{var e;return(null==(e=ns.opts)?void 0:e.debug)&&void 0},onRender:t=>{var e;return(null==(e=ns.opts)?void 0:e.debug)&&void 0},onSave:t=>{},confirmClearAll:t=>{window.confirm(t.confirmationMessage)&&t.clearAllAction(t)}},es=({src:t,...e},n=V)=>{var o,i;const r=new window.CustomEvent(n,{detail:e,bubbles:(null==(o=ns.opts)?void 0:o.debug)||(null==(i=ns.opts)?void 0:i.bubbles)});return r.data=(t||document).dispatchEvent(r),r},ns={init:function(t){return this.opts={...ts,...t},this},formeoSaved:t=>es(t,X),formeoUpdated:t=>es(t,V),formeoCleared:t=>es(t,"formeoCleared"),formeoOnRender:t=>es(t,Y),formeoConditionUpdated:t=>es(t,"formeoConditionUpdated")},os=Ki((()=>{ns.opts.onUpdate({timeStamp:window.performance.now(),type:V,detail:Wd.formData})}),U);let is;document.addEventListener(V,os),document.addEventListener("formeoUpdatedStage",(t=>{const{timeStamp:e,type:n,detail:o}=t;ns.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedRow",(t=>{const{timeStamp:e,type:n,detail:o}=t;ns.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedColumn",(t=>{const{timeStamp:e,type:n,detail:o}=t;ns.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedField",(t=>{const{timeStamp:e,type:n,detail:o}=t;ns.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener(Y,(t=>{const{timeStamp:e,type:n,detail:o}=t;ns.opts.onRender({timeStamp:e,type:n,detail:o})})),document.addEventListener("confirmClearAll",(t=>{t={timeStamp:t.timeStamp,type:t.type,confirmationMessage:t.detail.confirmationMessage,clearAllAction:t.detail.clearAllAction,btnCoords:t.detail.btnCoords},ns.opts.confirmClearAll(t)})),document.addEventListener(X,(({timeStamp:t,type:e,detail:{formData:n}})=>{const o={timeStamp:t,type:e,formData:n};ns.opts.onSave(o)})),document.addEventListener("formeoLoaded",(t=>{ns.opts.formeoLoaded(t.detail.formeo)})),window.addEventListener("resize",(function(){is=is||window.requestAnimationFrame((()=>{is=!1;for(const t of Object.values($d.data))t.dom.classList.add(Qr),Md.dom.classList.add(Qr),Md.panels.nav.refresh(),t.refreshFieldPanels()}))}));var rs=Be,ss=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},as=function(t){return this.__data__.has(t)};function ls(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new rs;++e<n;)this.add(t[e])}ls.prototype.add=ls.prototype.push=ss,ls.prototype.has=as;var cs=ls,ds=function(t,e){for(var n=-1,o=null==t?0:t.length;++n<o;)if(e(t[n],n,t))return!0;return!1},us=function(t,e){return t.has(e)};var hs=function(t,e,n,o,i,r){var s=1&n,a=t.length,l=e.length;if(a!=l&&!(s&&l>a))return!1;var c=r.get(t),d=r.get(e);if(c&&d)return c==e&&d==t;var u=-1,h=!0,p=2&n?new cs:void 0;for(r.set(t,e),r.set(e,t);++u<a;){var f=t[u],m=e[u];if(o)var g=s?o(m,f,u,e,t,r):o(f,m,u,t,e,r);if(void 0!==g){if(g)continue;h=!1;break}if(p){if(!ds(e,(function(t,e){if(!us(p,e)&&(f===t||i(f,t,n,o,r)))return p.push(e)}))){h=!1;break}}else if(f!==m&&!i(f,m,n,o,r)){h=!1;break}}return r.delete(t),r.delete(e),h};var ps=vn,fs=it,ms=hs,gs=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,o){n[++e]=[o,t]})),n},vs=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n},bs=At?At.prototype:void 0,ys=bs?bs.valueOf:void 0;var ws=function(t,e,n,o,i,r,s){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!r(new ps(t),new ps(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return fs(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=gs;case"[object Set]":var l=1&o;if(a||(a=vs),t.size!=e.size&&!l)return!1;var c=s.get(t);if(c)return c==e;o|=2,s.set(t,e);var d=ms(a(t),a(e),o,i,r,s);return s.delete(t),d;case"[object Symbol]":if(ys)return ys.call(t)==ys.call(e)}return!1};var Cs=function(t,e){for(var n=-1,o=e.length,i=t.length;++n<o;)t[i+n]=e[n];return t},Es=qn;var xs=function(t,e,n){var o=e(t);return Es(t)?o:Cs(o,n(t))};var Ss=function(t,e){for(var n=-1,o=null==t?0:t.length,i=0,r=[];++n<o;){var s=t[n];e(s,n,t)&&(r[i++]=s)}return r},Os=function(){return[]},_s=Object.prototype.propertyIsEnumerable,Ns=Object.getOwnPropertySymbols,As=Ns?function(t){return null==t?[]:(t=Object(t),Ss(Ns(t),(function(e){return _s.call(t,e)})))}:Os,js=On(Object.keys,Object),Ts=An,Ps=js,Ls=Object.prototype.hasOwnProperty;var Ds=Fo,ks=function(t){if(!Ts(t))return Ps(t);var e=[];for(var n in Object(t))Ls.call(t,n)&&"constructor"!=n&&e.push(n);return e},$s=Vn;var Is=xs,Ms=As,Rs=function(t){return $s(t)?Ds(t):ks(t)};var Fs=function(t){return Is(t,Rs,Ms)},Ws=Object.prototype.hasOwnProperty;var Bs=function(t,e,n,o,i,r){var s=1&n,a=Fs(t),l=a.length;if(l!=Fs(e).length&&!s)return!1;for(var c=l;c--;){var d=a[c];if(!(s?d in e:Ws.call(e,d)))return!1}var u=r.get(t),h=r.get(e);if(u&&h)return u==e&&h==t;var p=!0;r.set(t,e),r.set(e,t);for(var f=s;++c<l;){var m=t[d=a[c]],g=e[d];if(o)var v=s?o(g,m,d,e,t,r):o(m,g,d,t,e,r);if(!(void 0===v?m===g||i(m,g,n,o,r):v)){p=!1;break}f||(f="constructor"==d)}if(p&&!f){var b=t.constructor,y=e.constructor;b==y||!("constructor"in t)||!("constructor"in e)||"function"==typeof b&&b instanceof b&&"function"==typeof y&&y instanceof y||(p=!1)}return r.delete(t),r.delete(e),p},zs=le(Nt,"DataView"),qs=ce,Us=le(Nt,"Promise"),Hs=le(Nt,"Set"),Xs=le(Nt,"WeakMap"),Vs=Ft,Ys=Gt,Gs="[object Map]",Zs="[object Promise]",Js="[object Set]",Ks="[object WeakMap]",Qs="[object DataView]",ta=Ys(zs),ea=Ys(qs),na=Ys(Us),oa=Ys(Hs),ia=Ys(Xs),ra=Vs;(zs&&ra(new zs(new ArrayBuffer(1)))!=Qs||qs&&ra(new qs)!=Gs||Us&&ra(Us.resolve())!=Zs||Hs&&ra(new Hs)!=Js||Xs&&ra(new Xs)!=Ks)&&(ra=function(t){var e=Vs(t),n="[object Object]"==e?t.constructor:void 0,o=n?Ys(n):"";if(o)switch(o){case ta:return Qs;case ea:return Gs;case na:return Zs;case oa:return Js;case ia:return Ks}return e});var sa=Ke,aa=hs,la=ws,ca=Bs,da=ra,ua=qn,ha=Qn,pa=Co,fa="[object Arguments]",ma="[object Array]",ga="[object Object]",va=Object.prototype.hasOwnProperty;var ba=function(t,e,n,o,i,r){var s=ua(t),a=ua(e),l=s?ma:da(t),c=a?ma:da(e),d=(l=l==fa?ga:l)==ga,u=(c=c==fa?ga:c)==ga,h=l==c;if(h&&ha(t)){if(!ha(e))return!1;s=!0,d=!1}if(h&&!d)return r||(r=new sa),s||pa(t)?aa(t,e,n,o,i,r):la(t,e,l,n,o,i,r);if(!(1&n)){var p=d&&va.call(t,"__wrapped__"),f=u&&va.call(e,"__wrapped__");if(p||f){var m=p?t.value():t,g=f?e.value():e;return r||(r=new sa),i(m,g,n,o,r)}}return!!h&&(r||(r=new sa),ca(t,e,n,o,i,r))},ya=Dn;var wa=function t(e,n,o,i,r){return e===n||(null==e||null==n||!ya(e)&&!ya(n)?e!=e&&n!=n:ba(e,n,o,i,t,r))},Ca=wa;const Ea=nt((function(t,e){return Ca(t,e)}));class xa{constructor(t,e=Object.create(null)){n(this,"toJSON",((t,e)=>JSON.stringify(t,null,e))),n(this,"get",(t=>Br(this.data,t))),n(this,"getChangeType",((t,e)=>{const n=W.find((({condition:n})=>n(t,e)))||{type:"unknown"};return n.desc="added"===n.type?`${t} to ${e}`:e,n})),n(this,"add",((t,e=Object.create(null))=>{const{id:n}=e,o=t||n||Ui();return this.set(o,e)})),n(this,"remove",(t=>{const e=t.split("."),n=e.pop(),o=this.get(e);return Array.isArray(o)?o.splice(Number(n),1):o&&delete o[n],o})),n(this,"getData",(()=>Object.entries(this.data).reduce(((t,[e,n])=>(t[e]=(null==n?void 0:n.data)?n.getData():n,t)),{}))),n(this,"setCallbacks",{}),n(this,"configVal",Object.create(null)),this.name=t,this.data=e,this.dataPath=""}get size(){return Object.keys(this.data).length}get js(){return this.data}get json(){return this.data}set(t,e){const n=Br(this.data,t);if(Ea(n,e))return this.data;const o=zr(this.data,t,e),i=Array.isArray(t)?t.join("."):t,r=Object.keys(this.setCallbacks).filter((t=>new RegExp(t).test(i))),s={newVal:e,oldVal:n,path:t};for(const a of r)for(const t of this.setCallbacks[a])t(s);if(!this.disableEvents){const i=this.getChangeType(n,e),r={entity:this,dataPath:this.dataPath.replace(/\.+$/,""),changePath:this.dataPath+t,value:e,data:o,change:`${i.type}: ${i.desc}`,src:this.dom};n&&(r.previousValue=n),ns.formeoUpdated(r)}return o}addSetCallback(t,e){this.setCallbacks[t]?this.setCallbacks[t].push(e):this.setCallbacks[t]=[e]}removeSetCallback(t,e){this.setCallbacks[t]=this.setCallbacks[t].filter((t=>t!==e))}empty(){this.data=Object.create(null)}}
|
|
8
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).formeo={})}(this,(function(t){"use strict";var e=Object.defineProperty,n=(t,n,o)=>((t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o)(t,"symbol"!=typeof n?n+"":n,o);const o={extension:".lang",location:"assets/lang/",langs:["en-US"],locale:"en-US",override:{}};class i{constructor(t=o){this.langs=Object.create(null),this.loaded=[],this.processConfig(t)}processConfig(t){const{location:e,...n}={...o,...t},i=e.replace(/\/?$/,"/");this.config={location:i,...n};const{override:r,preloaded:s={}}=this.config,a=Object.entries(this.langs).concat(Object.entries(r||s));this.langs=a.reduce(((t,[e,n])=>(t[e]=this.applyLanguage(e,n),t)),{}),this.locale=this.config.locale||this.config.langs[0]}init(t){return this.processConfig({...this.config,...t}),this.setCurrent(this.locale)}addLanguage(t,e={}){e="string"==typeof e?i.processFile(e):e,this.applyLanguage(t,e),this.config.langs.push("locale")}getValue(t,e=this.locale){var n;return(null==(n=this.langs[e])?void 0:n[t])||this.getFallbackValue(t)}getFallbackValue(t){const e=Object.values(this.langs).find((e=>e[t]));return null==e?void 0:e[t]}makeSafe(t){const e={"{":"\\{","}":"\\}","|":"\\|"};return t=t.replace(/[{}|]/g,(t=>e[t])),new RegExp(t,"g")}put(t,e){return this.current[t]=e,e}get(t,e){const n=this;let o=this.getValue(t);if(!o)return;const i=o.match(/\{[^}]+?\}/g);if(e&&i)if("object"==typeof e)for(const r of i){const t=r.substring(1,r.length-1);o=o.replace(n.makeSafe(r),e[t]||"")}else o=o.replace(/\{[^}]+?\}/g,e);return o}static processFile(t){return i.fromFile(t.replace(/\n\n/g,"\n"))}static fromFile(t){const e=t.split("\n"),n={};for(let o,i=0;i<e.length;i++){o=/^(.+?) *?= *?([^\n]+)/.exec(e[i]),o&&(n[o[1]]=o[2].replace(/(^\s+|\s+$)/g,""))}return n}loadLang(t,e=!0){const n=this;return new Promise((function(o,r){if(-1!==n.loaded.indexOf(t)&&e)return n.applyLanguage(n.langs[t]),o(n.langs[t]);return async function(t){try{const e=await fetch(t);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const n=t.endsWith(".lang")?"text":"json";return await e[n]()}catch(e){throw e}}([n.config.location,t,n.config.extension].join("")).then((e=>{const r=i.processFile(e);return n.applyLanguage(t,r),n.loaded.push(t),o(n.langs[t])})).catch((e=>{const i=n.applyLanguage(t);o(i)}))}))}applyLanguage(t,e={}){const n=this.config.override[t]||{},o=this.langs[t]||{};return this.langs[t]={...o,...e,...n},this.langs[t]}get getLangs(){return this.config.langs}async setCurrent(t="en-US"){return await this.loadLang(t),this.locale=t,this.current=this.langs[t],this.current}}const r=new i;!function(){try{if("undefined"!=typeof document){var t=document.createElement("style");t.appendChild(document.createTextNode('._3x4ZIcu-{position:absolute;background:#1f2937;color:#fff;padding:.75rem;border-radius:.375rem;max-width:200px;z-index:50;visibility:hidden;opacity:0;transition:opacity .2s;pointer-events:none;left:0;top:0}._3x4ZIcu-.JIt36hCJ{visibility:visible;opacity:1;pointer-events:all}._3x4ZIcu-:before{content:"";position:absolute;width:0;height:0;border:6px solid transparent}._3x4ZIcu-[data-position=top]:before{border-top-color:#1f2937;bottom:-12px;left:50%;transform:translate(-50%)}._3x4ZIcu-[data-position=bottom]:before{border-bottom-color:#1f2937;top:-12px;left:50%;transform:translate(-50%)}._3x4ZIcu-[data-position=left]:before{border-left-color:#1f2937;right:-12px;top:50%;transform:translateY(-50%)}._3x4ZIcu-[data-position=right]:before{border-right-color:#1f2937;left:-12px;top:50%;transform:translateY(-50%)}._3x4ZIcu-[data-position=top-left]:before{border-top-color:#1f2937;bottom:-12px;left:12px;transform:none}._3x4ZIcu-[data-position=top-right]:before{border-top-color:#1f2937;bottom:-12px;right:12px;left:auto;transform:none}._3x4ZIcu-[data-position=bottom-left]:before{border-bottom-color:#1f2937;top:-12px;left:12px;transform:none}._3x4ZIcu-[data-position=bottom-right]:before{border-bottom-color:#1f2937;top:-12px;right:12px;left:auto;transform:none}')),document.head.appendChild(t)}}catch(e){}}();var s=Object.defineProperty,a=(t,e,n)=>((t,e,n)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);const l="_3x4ZIcu-",c="JIt36hCJ",d={triggerName:"tooltip"};class u{constructor(t=d){a(this,"triggerName"),a(this,"tooltip"),a(this,"activeTriggerType",null),a(this,"spacing",12),a(this,"handleClick",(t=>{const e=this.triggerName,n=t.target.closest(`[${e}][${e}-type="click"]`);if(n)if(this.isVisible())this.hide();else{const t=n.getAttribute(`${e}`);this.show(n,t),this.activeTriggerType="click"}else this.hide()})),a(this,"handleMouseOver",(t=>{const e=this.triggerName,n=t.target.closest(`[${e}]`);if("click"!==this.activeTriggerType&&"click"!==(null==n?void 0:n.getAttribute(`${e}-type`))){const t=null==n?void 0:n.getAttribute(`${e}`);t&&(this.show(n,t),this.activeTriggerType="hover")}})),a(this,"handleMouseOut",(t=>{const e=this.triggerName,n=t.target.closest(`[${e}]`);"click"!==this.activeTriggerType&&"click"!==(null==n?void 0:n.getAttribute(`${e}-type`))&&this.hide()})),a(this,"handleResize",(()=>{this.isVisible()&&this.hide()})),a(this,"handleScroll",(()=>{this.isVisible()&&this.hide()})),this.triggerName=`data-${t.triggerName}`,this.tooltip=document.createElement("div"),this.tooltip.className=`d-tooltip ${l}`,document.body.appendChild(this.tooltip),this.setupEventListeners()}setupEventListeners(){document.addEventListener("mouseover",this.handleMouseOver),document.addEventListener("mouseout",this.handleMouseOut),document.addEventListener("touchstart",this.handleMouseOver),document.addEventListener("touchend",this.handleMouseOut),document.addEventListener("click",this.handleClick),window.addEventListener("resize",this.handleResize),window.addEventListener("scroll",this.handleScroll,!0)}isVisible(){return this.tooltip.classList.contains(c)}calculatePosition(t){const e=t.getBoundingClientRect(),n=this.tooltip.getBoundingClientRect(),o=[{name:"top",x:e.left+(e.width-n.width)/2,y:e.top-n.height-this.spacing},{name:"bottom",x:e.left+(e.width-n.width)/2,y:e.bottom+this.spacing},{name:"left",x:e.left-n.width-this.spacing,y:e.top+(e.height-n.height)/2},{name:"right",x:e.right+this.spacing,y:e.top+(e.height-n.height)/2},{name:"top-left",x:e.left,y:e.top-n.height-this.spacing},{name:"top-right",x:e.right-n.width,y:e.top-n.height-this.spacing},{name:"bottom-left",x:e.left,y:e.bottom+this.spacing},{name:"bottom-right",x:e.right-n.width,y:e.bottom+this.spacing}];return o.find((t=>this.fitsInViewport(t,n)))||o[0]}fitsInViewport(t,e){if(!(t.x>=0&&t.y>=0&&t.x+e.width<=window.innerWidth&&t.y+e.height<=window.innerHeight))return!1;return 0===[[t.x,t.y],[t.x+e.width,t.y],[t.x,t.y+e.height],[t.x+e.width,t.y+e.height],[t.x+e.width/2,t.y+e.height/2]].flatMap((([t,e])=>Array.from(document.elementsFromPoint(t,e)))).filter((t=>{if(this.tooltip.contains(t)||t===this.tooltip||t.classList.contains(l)||"none"===getComputedStyle(t).pointerEvents)return!1})).length}show(t,e){this.tooltip.innerHTML=e??"",this.tooltip.classList.add(c);const n=this.calculatePosition(t);this.tooltip.style.left=`${n.x}px`,this.tooltip.style.top=`${n.y}px`,this.tooltip.dataset.position=n.name}hide(){this.tooltip.classList.remove(c),this.activeTriggerType=null}destroy(){document.removeEventListener("mouseover",this.handleMouseOver),document.removeEventListener("mouseout",this.handleMouseOut),document.removeEventListener("touchstart",this.handleMouseOver),document.removeEventListener("touchend",this.handleMouseOut),document.removeEventListener("click",this.handleClick),window.removeEventListener("resize",this.handleResize),window.removeEventListener("scroll",this.handleScroll,!0),this.tooltip.remove()}}void 0!==window&&(window.SmartTooltip=u);const h="formeo",p="3.0.8",f="formeo-sprite",m=[{name:"cssPreload",src:"//cdnjs.cloudflare.com/ajax/libs/loadCSS/2.0.1/cssrelpreload.min.js"},{name:"mutationObserver",src:"//cdn.jsdelivr.net/npm/mutationobserver-shim/dist/mutationobserver.min.js"},{name:"fetch",src:"https://unpkg.com/unfetch/polyfill"}],g=`https://cdn.jsdelivr.net/npm/formeo@${p}/dist/${f}.svg`,v=`https://draggable.github.io/formeo/assets/img/${f}.svg`,b=`https://cdn.jsdelivr.net/npm/formeo@${p}/dist/formeo.min.css`,y="control-group",w=`${h}-stage`,C=`${h}-row`,E=`${h}-column`,x=`${h}-field`,S="custom-column-widths",O="column-preset",_="resizing-columns",N=new Map([[w,C],[C,E],[E,x]]),A=["external","stages","rows","columns","fields"],j=["stage","row","column","field"].reduce(((t,e)=>({...t,[e]:e})),{}),T=[{name:"controls",className:y},{name:"stage",className:w},{name:"row",className:C},{name:"column",className:E},{name:"field",className:x}],P={controls:y,stage:w,row:C,column:E,field:x},L=Object.entries(P).reduce(((t,[e,n])=>({...t,[n]:e})),{}),D=Object.values(P),k=new RegExp(`${D.join("|")}`,"g"),$=T.map((({name:t},e,n)=>{const{name:o}=n[e+1]||{};return o&&[t,o]})).filter(Boolean),I=$.slice().map((t=>t.slice().reverse())).reverse(),M=new Map($),R=new Map(I.slice()),F=new Map([[{value:"100.0",label:"100%"}],[{value:"50.0,50.0",label:"50 | 50"},{value:"33.3,66.6",label:"33 | 66"},{value:"66.6,33.3",label:"66 | 33"}],[{value:"33.3,33.3,33.3",label:"33 | 33 | 33"},{value:"25.0,25.0,50.0",label:"25 | 25 | 50"},{value:"50.0,25.0,25.0",label:"50 | 25 | 25"},{value:"25.0,50.0,25.0",label:"25 | 50 | 25"}],[{value:"25.0,25.0,25.0,25.0",label:"25 | 25 | 25 | 25"}],[{value:"20.0,20.0,20.0,20.0,20.0",label:"20 | 20 | 20 | 20 | 20"}],[{value:"16.66,16.66,16.66,16.66,16.66,16.66",label:"16.66 | 16.66 | 16.66 | 16.66 | 16.66 | 16.66"}]].reduce(((t,e,n)=>(t.push([n,e]),t)),[])),W=[{type:"added",condition:(t,e)=>Boolean(void 0===t&&e)}],B=`${h}-formData`,z=`${h}-locale`,q=333,U=Math.round(166.5),H=Math.round(666),X="formeoSaved",V="formeoUpdated",Y="formeoOnRender",G=["label","logical","source","thenTarget","sourceProperty","comparison","target","targetProperty","assignment","value"],Z={value:"attrs.value",checked:"attrs.checked",isVisible:"config.isVisible",isNotVisible:"config.isNotVisible"},J={comparison:{equals:"==",notEquals:"!=",contains:"⊃",notContains:"!⊃"},assignment:{equals:"="},logical:{and:"&&",or:"||"},property:Z},K=/(\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b)/gi,Q=/\bcol-\w+-\d+/g,tt="f-i-",et=()=>({id:Hi(),stages:{[Hi()]:{}},rows:{},columns:{},fields:{}});var nt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ot(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var it=function(){this.__data__=[],this.size=0};var rt=function(t,e){return t===e||t!=t&&e!=e},st=rt;var at=function(t,e){for(var n=t.length;n--;)if(st(t[n][0],e))return n;return-1},lt=at,ct=Array.prototype.splice;var dt=at;var ut=at;var ht=at;var pt=it,ft=function(t){var e=this.__data__,n=lt(e,t);return!(n<0)&&(n==e.length-1?e.pop():ct.call(e,n,1),--this.size,!0)},mt=function(t){var e=this.__data__,n=dt(e,t);return n<0?void 0:e[n][1]},gt=function(t){return ut(this.__data__,t)>-1},vt=function(t,e){var n=this.__data__,o=ht(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this};function bt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}bt.prototype.clear=pt,bt.prototype.delete=ft,bt.prototype.get=mt,bt.prototype.has=gt,bt.prototype.set=vt;var yt=bt,wt=yt;var Ct=function(){this.__data__=new wt,this.size=0};var Et=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n};var xt=function(t){return this.__data__.get(t)};var St=function(t){return this.__data__.has(t)},Ot="object"==typeof nt&&nt&&nt.Object===Object&&nt,_t=Ot,Nt="object"==typeof self&&self&&self.Object===Object&&self,At=_t||Nt||Function("return this")(),jt=At.Symbol,Tt=jt,Pt=Object.prototype,Lt=Pt.hasOwnProperty,Dt=Pt.toString,kt=Tt?Tt.toStringTag:void 0;var $t=function(t){var e=Lt.call(t,kt),n=t[kt];try{t[kt]=void 0;var o=!0}catch(r){}var i=Dt.call(t);return o&&(e?t[kt]=n:delete t[kt]),i},It=Object.prototype.toString;var Mt=$t,Rt=function(t){return It.call(t)},Ft=jt?jt.toStringTag:void 0;var Wt=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Ft&&Ft in Object(t)?Mt(t):Rt(t)};var Bt=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},zt=Wt,qt=Bt;var Ut,Ht=function(t){if(!qt(t))return!1;var e=zt(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},Xt=At["__core-js_shared__"],Vt=(Ut=/[^.]+$/.exec(Xt&&Xt.keys&&Xt.keys.IE_PROTO||""))?"Symbol(src)_1."+Ut:"";var Yt=function(t){return!!Vt&&Vt in t},Gt=Function.prototype.toString;var Zt=function(t){if(null!=t){try{return Gt.call(t)}catch(e){}try{return t+""}catch(e){}}return""},Jt=Ht,Kt=Yt,Qt=Bt,te=Zt,ee=/^\[object .+?Constructor\]$/,ne=Function.prototype,oe=Object.prototype,ie=ne.toString,re=oe.hasOwnProperty,se=RegExp("^"+ie.call(re).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var ae=function(t){return!(!Qt(t)||Kt(t))&&(Jt(t)?se:ee).test(te(t))},le=function(t,e){return null==t?void 0:t[e]};var ce=function(t,e){var n=le(t,e);return ae(n)?n:void 0},de=ce(At,"Map"),ue=ce(Object,"create"),he=ue;var pe=function(){this.__data__=he?he(null):{},this.size=0};var fe=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},me=ue,ge=Object.prototype.hasOwnProperty;var ve=function(t){var e=this.__data__;if(me){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return ge.call(e,t)?e[t]:void 0},be=ue,ye=Object.prototype.hasOwnProperty;var we=ue;var Ce=pe,Ee=fe,xe=ve,Se=function(t){var e=this.__data__;return be?void 0!==e[t]:ye.call(e,t)},Oe=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=we&&void 0===e?"__lodash_hash_undefined__":e,this};function _e(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}_e.prototype.clear=Ce,_e.prototype.delete=Ee,_e.prototype.get=xe,_e.prototype.has=Se,_e.prototype.set=Oe;var Ne=_e,Ae=yt,je=de;var Te=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Pe=function(t,e){var n=t.__data__;return Te(e)?n["string"==typeof e?"string":"hash"]:n.map},Le=Pe;var De=Pe;var ke=Pe;var $e=Pe;var Ie=function(){this.size=0,this.__data__={hash:new Ne,map:new(je||Ae),string:new Ne}},Me=function(t){var e=Le(this,t).delete(t);return this.size-=e?1:0,e},Re=function(t){return De(this,t).get(t)},Fe=function(t){return ke(this,t).has(t)},We=function(t,e){var n=$e(this,t),o=n.size;return n.set(t,e),this.size+=n.size==o?0:1,this};function Be(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}Be.prototype.clear=Ie,Be.prototype.delete=Me,Be.prototype.get=Re,Be.prototype.has=Fe,Be.prototype.set=We;var ze=Be,qe=yt,Ue=de,He=ze;var Xe=yt,Ve=Ct,Ye=Et,Ge=xt,Ze=St,Je=function(t,e){var n=this.__data__;if(n instanceof qe){var o=n.__data__;if(!Ue||o.length<199)return o.push([t,e]),this.size=++n.size,this;n=this.__data__=new He(o)}return n.set(t,e),this.size=n.size,this};function Ke(t){var e=this.__data__=new Xe(t);this.size=e.size}Ke.prototype.clear=Ve,Ke.prototype.delete=Ye,Ke.prototype.get=Ge,Ke.prototype.has=Ze,Ke.prototype.set=Je;var Qe=Ke,tn=ce,en=function(){try{var t=tn(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),nn=en;var on=function(t,e,n){"__proto__"==e&&nn?nn(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n},rn=on,sn=rt;var an=function(t,e,n){(void 0!==n&&!sn(t[e],n)||void 0===n&&!(e in t))&&rn(t,e,n)};var ln,cn,dn,un,hn,pn,fn,mn=function(t){return function(e,n,o){for(var i=-1,r=Object(e),s=o(e),a=s.length;a--;){var l=s[t?a:++i];if(!1===n(r[l],l,r))break}return e}}(),gn={exports:{}};ln=gn,dn=At,un=(cn=gn.exports)&&!cn.nodeType&&cn,hn=un&&ln&&!ln.nodeType&&ln,pn=hn&&hn.exports===un?dn.Buffer:void 0,fn=pn?pn.allocUnsafe:void 0,ln.exports=function(t,e){if(e)return t.slice();var n=t.length,o=fn?fn(n):new t.constructor(n);return t.copy(o),o};var vn=gn.exports,bn=At.Uint8Array,yn=bn;var wn=function(t){var e=new t.constructor(t.byteLength);return new yn(e).set(new yn(t)),e};var Cn=function(t,e){var n=e?wn(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)};var En=function(t,e){var n=-1,o=t.length;for(e||(e=Array(o));++n<o;)e[n]=t[n];return e},xn=Bt,Sn=Object.create,On=function(){function t(){}return function(e){if(!xn(e))return{};if(Sn)return Sn(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();var _n=function(t,e){return function(n){return t(e(n))}},Nn=_n(Object.getPrototypeOf,Object),An=Object.prototype;var jn=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||An)},Tn=On,Pn=Nn,Ln=jn;var Dn=function(t){return"function"!=typeof t.constructor||Ln(t)?{}:Tn(Pn(t))};var kn=function(t){return null!=t&&"object"==typeof t},$n=Wt,In=kn;var Mn=function(t){return In(t)&&"[object Arguments]"==$n(t)},Rn=kn,Fn=Object.prototype,Wn=Fn.hasOwnProperty,Bn=Fn.propertyIsEnumerable,zn=Mn(function(){return arguments}())?Mn:function(t){return Rn(t)&&Wn.call(t,"callee")&&!Bn.call(t,"callee")},qn=zn,Un=Array.isArray;var Hn=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},Xn=Ht,Vn=Hn;var Yn=function(t){return null!=t&&Vn(t.length)&&!Xn(t)},Gn=Yn,Zn=kn;var Jn=function(t){return Zn(t)&&Gn(t)},Kn={exports:{}};var Qn=function(){return!1};!function(t,e){var n=At,o=Qn,i=e&&!e.nodeType&&e,r=i&&t&&!t.nodeType&&t,s=r&&r.exports===i?n.Buffer:void 0,a=(s?s.isBuffer:void 0)||o;t.exports=a}(Kn,Kn.exports);var to=Kn.exports,eo=Wt,no=Nn,oo=kn,io=Function.prototype,ro=Object.prototype,so=io.toString,ao=ro.hasOwnProperty,lo=so.call(Object);var co=function(t){if(!oo(t)||"[object Object]"!=eo(t))return!1;var e=no(t);if(null===e)return!0;var n=ao.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&so.call(n)==lo},uo=Wt,ho=Hn,po=kn,fo={};fo["[object Float32Array]"]=fo["[object Float64Array]"]=fo["[object Int8Array]"]=fo["[object Int16Array]"]=fo["[object Int32Array]"]=fo["[object Uint8Array]"]=fo["[object Uint8ClampedArray]"]=fo["[object Uint16Array]"]=fo["[object Uint32Array]"]=!0,fo["[object Arguments]"]=fo["[object Array]"]=fo["[object ArrayBuffer]"]=fo["[object Boolean]"]=fo["[object DataView]"]=fo["[object Date]"]=fo["[object Error]"]=fo["[object Function]"]=fo["[object Map]"]=fo["[object Number]"]=fo["[object Object]"]=fo["[object RegExp]"]=fo["[object Set]"]=fo["[object String]"]=fo["[object WeakMap]"]=!1;var mo=function(t){return po(t)&&ho(t.length)&&!!fo[uo(t)]};var go=function(t){return function(e){return t(e)}},vo={exports:{}};!function(t,e){var n=Ot,o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,r=i&&i.exports===o&&n.process,s=function(){try{var t=i&&i.require&&i.require("util").types;return t||r&&r.binding&&r.binding("util")}catch(e){}}();t.exports=s}(vo,vo.exports);var bo=vo.exports,yo=mo,wo=go,Co=bo&&bo.isTypedArray,Eo=Co?wo(Co):yo;var xo=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},So=on,Oo=rt,_o=Object.prototype.hasOwnProperty;var No=function(t,e,n){var o=t[e];_o.call(t,e)&&Oo(o,n)&&(void 0!==n||e in t)||So(t,e,n)},Ao=No,jo=on;var To=function(t,e,n,o){var i=!n;n||(n={});for(var r=-1,s=e.length;++r<s;){var a=e[r],l=o?o(n[a],t[a],a,n,t):void 0;void 0===l&&(l=t[a]),i?jo(n,a,l):Ao(n,a,l)}return n};var Po=/^(?:0|[1-9]\d*)$/;var Lo=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Po.test(t))&&t>-1&&t%1==0&&t<e},Do=function(t,e){for(var n=-1,o=Array(t);++n<t;)o[n]=e(n);return o},ko=qn,$o=Un,Io=to,Mo=Lo,Ro=Eo,Fo=Object.prototype.hasOwnProperty;var Wo=function(t,e){var n=$o(t),o=!n&&ko(t),i=!n&&!o&&Io(t),r=!n&&!o&&!i&&Ro(t),s=n||o||i||r,a=s?Do(t.length,String):[],l=a.length;for(var c in t)!e&&!Fo.call(t,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Mo(c,l))||a.push(c);return a};var Bo=Bt,zo=jn,qo=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e},Uo=Object.prototype.hasOwnProperty;var Ho=Wo,Xo=function(t){if(!Bo(t))return qo(t);var e=zo(t),n=[];for(var o in t)("constructor"!=o||!e&&Uo.call(t,o))&&n.push(o);return n},Vo=Yn;var Yo=function(t){return Vo(t)?Ho(t,!0):Xo(t)},Go=To,Zo=Yo;var Jo=an,Ko=vn,Qo=Cn,ti=En,ei=Dn,ni=qn,oi=Un,ii=Jn,ri=to,si=Ht,ai=Bt,li=co,ci=Eo,di=xo,ui=function(t){return Go(t,Zo(t))};var hi=Qe,pi=an,fi=mn,mi=function(t,e,n,o,i,r,s){var a=di(t,n),l=di(e,n),c=s.get(l);if(c)Jo(t,n,c);else{var d=r?r(a,l,n+"",t,e,s):void 0,u=void 0===d;if(u){var h=oi(l),p=!h&&ri(l),f=!h&&!p&&ci(l);d=l,h||p||f?oi(a)?d=a:ii(a)?d=ti(a):p?(u=!1,d=Ko(l,!0)):f?(u=!1,d=Qo(l,!0)):d=[]:li(l)||ni(l)?(d=a,ni(a)?d=ui(a):ai(a)&&!si(a)||(d=ei(l))):u=!1}u&&(s.set(l,d),i(d,l,o,r,s),s.delete(l)),Jo(t,n,d)}},gi=Bt,vi=Yo,bi=xo;var yi=function t(e,n,o,i,r){e!==n&&fi(n,(function(s,a){if(r||(r=new hi),gi(s))mi(e,n,a,o,t,i,r);else{var l=i?i(bi(e,a),s,a+"",e,n,r):void 0;void 0===l&&(l=s),pi(e,a,l)}}),vi)};var wi=function(t){return t};var Ci=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)},Ei=Math.max;var xi=function(t,e,n){return e=Ei(void 0===e?t.length-1:e,0),function(){for(var o=arguments,i=-1,r=Ei(o.length-e,0),s=Array(r);++i<r;)s[i]=o[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=o[i];return a[e]=n(s),Ci(t,this,a)}};var Si=function(t){return function(){return t}},Oi=en,_i=Oi?function(t,e){return Oi(t,"toString",{configurable:!0,enumerable:!1,value:Si(e),writable:!0})}:wi,Ni=Date.now;var Ai=function(t){var e=0,n=0;return function(){var o=Ni(),i=16-(o-n);if(n=o,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}},ji=Ai(_i),Ti=wi,Pi=xi,Li=ji;var Di=rt,ki=Yn,$i=Lo,Ii=Bt;var Mi=function(t,e){return Li(Pi(t,e,Ti),t+"")},Ri=function(t,e,n){if(!Ii(n))return!1;var o=typeof e;return!!("number"==o?ki(n)&&$i(e,n.length):"string"==o&&e in n)&&Di(n[e],t)};var Fi=yi;const Wi=ot(function(t){return Mi((function(e,n){var o=-1,i=n.length,r=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(r=t.length>3&&"function"==typeof r?(i--,r):void 0,s&&Ri(n[0],n[1],s)&&(r=i<3?void 0:r,i=1),e=Object(e);++o<i;){var a=n[o];a&&t(e,a,o,r)}return e}))}((function(t,e,n,o){Fi(t,e,n,o)}))),Bi=()=>crypto.randomUUID(),zi=(t="",e)=>{if(!e)return!1;const n=/[|\\{}()[\]^*$+?.]/g;let o="string"==typeof e?[e]:e;o=o.map((t=>"*"===t?"":t.replace(n,"\\$&")));let i=!0;return o.length&&(i=!new RegExp(o.join("|"),"i").exec(t)),i},qi=t=>{var e;const n=null==(e=t.className)?void 0:e.match(k);return n&&L[n[0]]},Ui=t=>Array.from(new Set(t)),Hi=t=>{let e;if(t){const{attrs:n={}}=t;e=n.id||t.id||Bi(),t.id=e}else e=Bi();return e},Xi=(t,e)=>Wi({},t,e,((t,e)=>Array.isArray(t)?null!=e?Ui(t.concat(e)):e:Array.isArray(e)?null!=t?Ui(e.concat(t)):e:void 0)),Vi=t=>{let e;if(null===t||!("object"==typeof t)||t instanceof Promise)return t;if(t instanceof Date)return e=new Date,e.setTime(t.getTime()),e;if(Array.isArray(t)){e=[];for(let n=0,o=t.length;n<o;n++)e[n]=Vi(t[n]);return e}if(t instanceof Object){e={};for(const n in t)Object.hasOwn(t,n)&&(e[n]=Vi(t[n]));return e}throw new Error("Unable to copy Object, type not supported.")},Yi=(t,e)=>t/e*100,Gi=t=>`${t.toString()}%`,Zi=Object.create(null,{get:{value:t=>{var e;const n=null==(e=window.sessionStorage)?void 0:e.getItem(t);try{return JSON.parse(n)}catch(o){return n}}},set:{value:(t,e)=>{var n;try{return null==(n=window.sessionStorage)?void 0:n.setItem(t,JSON.stringify(e))}catch(o){}}}}),Ji=t=>A.some((e=>new RegExp(`^${e}.`).test(t))),Ki=t=>t.startsWith("external");function Qi(t,e=H){let n=0;return function(...o){const i=Date.now();i-n>=e&&(n=i,t.apply(this,o))}}function tr(t){return t}function er(){}function nr(t=Object.create(null)){if("string"==typeof t)try{return JSON.parse(t)}catch(e){return Object.create(null)}return t}const or=t=>t?Vi(nr(t)):et();var ir=Wt,rr=kn;var sr=function(t){return"symbol"==typeof t||rr(t)&&"[object Symbol]"==ir(t)},ar=Un,lr=sr,cr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,dr=/^\w*$/;var ur=function(t,e){if(ar(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!lr(t))||(dr.test(t)||!cr.test(t)||null!=e&&t in Object(e))},hr=ze;function pr(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var o=arguments,i=e?e.apply(this,o):o[0],r=n.cache;if(r.has(i))return r.get(i);var s=t.apply(this,o);return n.cache=r.set(i,s)||r,s};return n.cache=new(pr.Cache||hr),n}pr.Cache=hr;var fr=pr;var mr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,gr=/\\(\\)?/g,vr=function(t){var e=fr(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(mr,(function(t,n,o,i){e.push(o?i.replace(gr,"$1"):n||t)})),e}));var br=function(t,e){for(var n=-1,o=null==t?0:t.length,i=Array(o);++n<o;)i[n]=e(t[n],n,t);return i},yr=Un,wr=sr,Cr=jt?jt.prototype:void 0,Er=Cr?Cr.toString:void 0;var xr=function t(e){if("string"==typeof e)return e;if(yr(e))return br(e,t)+"";if(wr(e))return Er?Er.call(e):"";var n=e+"";return"0"==n&&1/e==-1/0?"-0":n},Sr=xr;var Or=Un,_r=ur,Nr=vr,Ar=function(t){return null==t?"":Sr(t)};var jr=function(t,e){return Or(t)?t:_r(t,e)?[t]:Nr(Ar(t))},Tr=sr;var Pr=function(t){if("string"==typeof t||Tr(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e},Lr=No,Dr=jr,kr=Lo,$r=Bt,Ir=Pr;var Mr=function(t,e,n,o){if(!$r(t))return t;for(var i=-1,r=(e=Dr(e,t)).length,s=r-1,a=t;null!=a&&++i<r;){var l=Ir(e[i]),c=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return t;if(i!=s){var d=a[l];void 0===(c=o?o(d,l,a):void 0)&&(c=$r(d)?d:kr(e[i+1])?[]:{})}Lr(a,l,c),a=a[l]}return t};const Rr=ot((function(t,e,n){return null==t?t:Mr(t,e,n)}));var Fr=jr,Wr=Pr;var Br=function(t,e){for(var n=0,o=(e=Fr(e,t)).length;null!=t&&n<o;)t=t[Wr(e[n++])];return n&&n==o?t:void 0};const zr=ot((function(t,e,n){var o=null==t?void 0:Br(t,e);return void 0===o?n:o})),qr=Rr,Ur=t=>Number.isInteger(Number(t)),Hr=(t,e)=>{const n=e||t.parentElement;return Array.prototype.slice.call(n.childNodes).indexOf(t)},Xr=(t,e,n)=>{const o=n.split("||"),i=Ui(e).map((e=>t.find((t=>{const n=o.find((e=>!!zr(t,e)));return n&&zr(t,n)===e})))).filter(Boolean).concat(t);return Ui(i)},Vr=(t,e,n)=>{for(let o=0;o<t.length;o++)e.call(n,t[o],o)},Yr=(t,e)=>{const n=[];return Vr(t,((t,o)=>n.push(e(t,o)))),n},Gr={},Zr=t=>t.replace(/\b\w/g,(t=>t.toUpperCase())),Jr=()=>-1!==window.navigator.userAgent.indexOf("MSIE "),Kr={capitalize:Zr,safeAttrName:t=>{if(Gr[t])return Gr[t];const e=({className:"class"}[t]||t).replace(/^\d+/,"").replace(/[^a-zA-Z0-9-:]/g,"");return Gr[t]=e,e},forEach:Vr,copyObj:t=>window.JSON.parse(window.JSON.stringify(t)),map:Yr,subtract:(t,e)=>e.filter((e=>!~t.indexOf(e))),indexOfNode:Hr,isInt:Ur,get:zr,orderObjectsBy:Xr,isIE:Jr},Qr={getStyle:(t,e=!1)=>{let n;return window.getComputedStyle?n=window.getComputedStyle(t,null):t.currentStyle&&(n=t.currentStyle),e?n[e]:n},fadeOut:(t,e=250)=>{const n=1/(e/60);t.style.opacity=1,function e(){const o=Number(t.style.opacity)-n;o>0?(t.style.opacity=o,window.requestAnimationFrame(e)):t.remove()}()},slideDown:(t,e=250,n=!1)=>{t.style.display="block";const o=Qr.getStyle(t),i=parseInt(o.height,10),r=i/(e/60);t.style.height="0px",function e(){const o=parseFloat(t.style.height),s=o+r;o<i?(t.style.height=s+"px",window.requestAnimationFrame(e)):(t.style.height="auto",n&&n(t))}()},slideUp:(t,e=250,n=!1)=>{const o=Qr.getStyle(t),i=parseInt(o.height),r=o.overflow;t.style.overflow="hidden",t.style.height=i+"px";const s=o.minHeight;t.style.minHeight="auto";const a=parseFloat(i/(e/60)).toFixed(2);!function e(){const o=parseInt(t.style.height,10)-a;o>0?(t.style.height=o+"px",window.requestAnimationFrame(e)):(t.style.overflow=r,t.style.display="none",t.style.minHeight=s,delete t.style.height,n&&n(t))}()},slideToggle:(t,e=250,n="none"===Qr.getStyle(t,"display"))=>{n?Qr.slideDown(t,e):Qr.slideUp(t,e)}},ts="no-transition",es={debug:!1,bubbles:!0,formeoLoaded:t=>{},onAdd:()=>{},onUpdate:t=>{var e;return(null==(e=os.opts)?void 0:e.debug)&&void 0},onUpdateStage:t=>{var e;return(null==(e=os.opts)?void 0:e.debug)&&void 0},onUpdateRow:t=>{var e;return(null==(e=os.opts)?void 0:e.debug)&&void 0},onUpdateColumn:t=>{var e;return(null==(e=os.opts)?void 0:e.debug)&&void 0},onUpdateField:t=>{var e;return(null==(e=os.opts)?void 0:e.debug)&&void 0},onRender:t=>{var e;return(null==(e=os.opts)?void 0:e.debug)&&void 0},onSave:t=>{},confirmClearAll:t=>{window.confirm(t.confirmationMessage)&&t.clearAllAction(t)}},ns=({src:t,...e},n=V)=>{var o,i;const r=new window.CustomEvent(n,{detail:e,bubbles:(null==(o=os.opts)?void 0:o.debug)||(null==(i=os.opts)?void 0:i.bubbles)});return r.data=(t||document).dispatchEvent(r),r},os={init:function(t){return this.opts={...es,...t},this},formeoSaved:t=>ns(t,X),formeoUpdated:t=>ns(t,V),formeoCleared:t=>ns(t,"formeoCleared"),formeoOnRender:t=>ns(t,Y),formeoConditionUpdated:t=>ns(t,"formeoConditionUpdated")},is=Qi((()=>{os.opts.onUpdate({timeStamp:window.performance.now(),type:V,detail:Wd.formData})}),U);let rs;document.addEventListener(V,is),document.addEventListener("formeoUpdatedStage",(t=>{const{timeStamp:e,type:n,detail:o}=t;os.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedRow",(t=>{const{timeStamp:e,type:n,detail:o}=t;os.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedColumn",(t=>{const{timeStamp:e,type:n,detail:o}=t;os.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedField",(t=>{const{timeStamp:e,type:n,detail:o}=t;os.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener(Y,(t=>{const{timeStamp:e,type:n,detail:o}=t;os.opts.onRender({timeStamp:e,type:n,detail:o})})),document.addEventListener("confirmClearAll",(t=>{t={timeStamp:t.timeStamp,type:t.type,confirmationMessage:t.detail.confirmationMessage,clearAllAction:t.detail.clearAllAction,btnCoords:t.detail.btnCoords},os.opts.confirmClearAll(t)})),document.addEventListener(X,(({timeStamp:t,type:e,detail:{formData:n}})=>{const o={timeStamp:t,type:e,formData:n};os.opts.onSave(o)})),document.addEventListener("formeoLoaded",(t=>{os.opts.formeoLoaded(t.detail.formeo)})),window.addEventListener("resize",(function(){rs=rs||window.requestAnimationFrame((()=>{rs=!1;for(const t of Object.values(Id.data))t.dom.classList.add(ts),Rd.dom.classList.add(ts),Rd.panels.nav.refresh(),t.refreshFieldPanels()}))}));var ss=ze,as=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},ls=function(t){return this.__data__.has(t)};function cs(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new ss;++e<n;)this.add(t[e])}cs.prototype.add=cs.prototype.push=as,cs.prototype.has=ls;var ds=cs,us=function(t,e){for(var n=-1,o=null==t?0:t.length;++n<o;)if(e(t[n],n,t))return!0;return!1},hs=function(t,e){return t.has(e)};var ps=function(t,e,n,o,i,r){var s=1&n,a=t.length,l=e.length;if(a!=l&&!(s&&l>a))return!1;var c=r.get(t),d=r.get(e);if(c&&d)return c==e&&d==t;var u=-1,h=!0,p=2&n?new ds:void 0;for(r.set(t,e),r.set(e,t);++u<a;){var f=t[u],m=e[u];if(o)var g=s?o(m,f,u,e,t,r):o(f,m,u,t,e,r);if(void 0!==g){if(g)continue;h=!1;break}if(p){if(!us(e,(function(t,e){if(!hs(p,e)&&(f===t||i(f,t,n,o,r)))return p.push(e)}))){h=!1;break}}else if(f!==m&&!i(f,m,n,o,r)){h=!1;break}}return r.delete(t),r.delete(e),h};var fs=bn,ms=rt,gs=ps,vs=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,o){n[++e]=[o,t]})),n},bs=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n},ys=jt?jt.prototype:void 0,ws=ys?ys.valueOf:void 0;var Cs=function(t,e,n,o,i,r,s){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!r(new fs(t),new fs(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return ms(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=vs;case"[object Set]":var l=1&o;if(a||(a=bs),t.size!=e.size&&!l)return!1;var c=s.get(t);if(c)return c==e;o|=2,s.set(t,e);var d=gs(a(t),a(e),o,i,r,s);return s.delete(t),d;case"[object Symbol]":if(ws)return ws.call(t)==ws.call(e)}return!1};var Es=function(t,e){for(var n=-1,o=e.length,i=t.length;++n<o;)t[i+n]=e[n];return t},xs=Un;var Ss=function(t,e,n){var o=e(t);return xs(t)?o:Es(o,n(t))};var Os=function(t,e){for(var n=-1,o=null==t?0:t.length,i=0,r=[];++n<o;){var s=t[n];e(s,n,t)&&(r[i++]=s)}return r},_s=function(){return[]},Ns=Object.prototype.propertyIsEnumerable,As=Object.getOwnPropertySymbols,js=As?function(t){return null==t?[]:(t=Object(t),Os(As(t),(function(e){return Ns.call(t,e)})))}:_s,Ts=_n(Object.keys,Object),Ps=jn,Ls=Ts,Ds=Object.prototype.hasOwnProperty;var ks=Wo,$s=function(t){if(!Ps(t))return Ls(t);var e=[];for(var n in Object(t))Ds.call(t,n)&&"constructor"!=n&&e.push(n);return e},Is=Yn;var Ms=Ss,Rs=js,Fs=function(t){return Is(t)?ks(t):$s(t)};var Ws=function(t){return Ms(t,Fs,Rs)},Bs=Object.prototype.hasOwnProperty;var zs=function(t,e,n,o,i,r){var s=1&n,a=Ws(t),l=a.length;if(l!=Ws(e).length&&!s)return!1;for(var c=l;c--;){var d=a[c];if(!(s?d in e:Bs.call(e,d)))return!1}var u=r.get(t),h=r.get(e);if(u&&h)return u==e&&h==t;var p=!0;r.set(t,e),r.set(e,t);for(var f=s;++c<l;){var m=t[d=a[c]],g=e[d];if(o)var v=s?o(g,m,d,e,t,r):o(m,g,d,t,e,r);if(!(void 0===v?m===g||i(m,g,n,o,r):v)){p=!1;break}f||(f="constructor"==d)}if(p&&!f){var b=t.constructor,y=e.constructor;b==y||!("constructor"in t)||!("constructor"in e)||"function"==typeof b&&b instanceof b&&"function"==typeof y&&y instanceof y||(p=!1)}return r.delete(t),r.delete(e),p},qs=ce(At,"DataView"),Us=de,Hs=ce(At,"Promise"),Xs=ce(At,"Set"),Vs=ce(At,"WeakMap"),Ys=Wt,Gs=Zt,Zs="[object Map]",Js="[object Promise]",Ks="[object Set]",Qs="[object WeakMap]",ta="[object DataView]",ea=Gs(qs),na=Gs(Us),oa=Gs(Hs),ia=Gs(Xs),ra=Gs(Vs),sa=Ys;(qs&&sa(new qs(new ArrayBuffer(1)))!=ta||Us&&sa(new Us)!=Zs||Hs&&sa(Hs.resolve())!=Js||Xs&&sa(new Xs)!=Ks||Vs&&sa(new Vs)!=Qs)&&(sa=function(t){var e=Ys(t),n="[object Object]"==e?t.constructor:void 0,o=n?Gs(n):"";if(o)switch(o){case ea:return ta;case na:return Zs;case oa:return Js;case ia:return Ks;case ra:return Qs}return e});var aa=Qe,la=ps,ca=Cs,da=zs,ua=sa,ha=Un,pa=to,fa=Eo,ma="[object Arguments]",ga="[object Array]",va="[object Object]",ba=Object.prototype.hasOwnProperty;var ya=function(t,e,n,o,i,r){var s=ha(t),a=ha(e),l=s?ga:ua(t),c=a?ga:ua(e),d=(l=l==ma?va:l)==va,u=(c=c==ma?va:c)==va,h=l==c;if(h&&pa(t)){if(!pa(e))return!1;s=!0,d=!1}if(h&&!d)return r||(r=new aa),s||fa(t)?la(t,e,n,o,i,r):ca(t,e,l,n,o,i,r);if(!(1&n)){var p=d&&ba.call(t,"__wrapped__"),f=u&&ba.call(e,"__wrapped__");if(p||f){var m=p?t.value():t,g=f?e.value():e;return r||(r=new aa),i(m,g,n,o,r)}}return!!h&&(r||(r=new aa),da(t,e,n,o,i,r))},wa=kn;var Ca=function t(e,n,o,i,r){return e===n||(null==e||null==n||!wa(e)&&!wa(n)?e!=e&&n!=n:ya(e,n,o,i,t,r))},Ea=Ca;const xa=ot((function(t,e){return Ea(t,e)}));class Sa{constructor(t,e=Object.create(null)){n(this,"toJSON",((t,e)=>JSON.stringify(t,null,e))),n(this,"get",(t=>zr(this.data,t))),n(this,"getChangeType",((t,e)=>{const n=W.find((({condition:n})=>n(t,e)))||{type:"unknown"};return n.desc="added"===n.type?`${t} to ${e}`:e,n})),n(this,"add",((t,e=Object.create(null))=>{const{id:n}=e,o=t||n||Hi();return this.set(o,e)})),n(this,"remove",(t=>{const e=t.split("."),n=e.pop(),o=this.get(e);return Array.isArray(o)?o.splice(Number(n),1):o&&delete o[n],o})),n(this,"getData",(()=>Object.entries(this.data).reduce(((t,[e,n])=>(t[e]=(null==n?void 0:n.data)?n.getData():n,t)),{}))),n(this,"setCallbacks",{}),n(this,"configVal",Object.create(null)),this.name=t,this.data=e,this.dataPath=""}get size(){return Object.keys(this.data).length}get js(){return this.data}get json(){return this.data}set(t,e){const n=zr(this.data,t);if(xa(n,e))return this.data;const o=qr(this.data,t,e),i=Array.isArray(t)?t.join("."):t,r=Object.keys(this.setCallbacks).filter((t=>new RegExp(t).test(i))),s={newVal:e,oldVal:n,path:t};for(const a of r)for(const t of this.setCallbacks[a])t(s);if(!this.disableEvents){const i=this.getChangeType(n,e),r={entity:this,dataPath:this.dataPath.replace(/\.+$/,""),changePath:this.dataPath+t,value:e,data:o,change:`${i.type}: ${i.desc}`,src:this.dom};n&&(r.previousValue=n),os.formeoUpdated(r)}return o}addSetCallback(t,e){this.setCallbacks[t]?this.setCallbacks[t].push(e):this.setCallbacks[t]=[e]}removeSetCallback(t,e){this.setCallbacks[t]=this.setCallbacks[t].filter((t=>t!==e))}empty(){this.data=Object.create(null)}}
|
|
9
9
|
/**!
|
|
10
10
|
* Sortable 1.15.3
|
|
11
11
|
* @author RubaXa <trash@rubaxa.org>
|
|
12
12
|
* @author owenm <owen23355@gmail.com>
|
|
13
13
|
* @license MIT
|
|
14
|
-
*/function Sa(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function Oa(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Sa(Object(n),!0).forEach((function(e){Na(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Sa(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function _a(t){return(_a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Na(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Aa(){return Aa=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Aa.apply(this,arguments)}function ja(t,e){if(null==t)return{};var n,o,i=function(t,e){if(null==t)return{};var n,o,i={},r=Object.keys(t);for(o=0;o<r.length;o++)n=r[o],e.indexOf(n)>=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(o=0;o<r.length;o++)n=r[o],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Ta(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var Pa=Ta(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),La=Ta(/Edge/i),Da=Ta(/firefox/i),ka=Ta(/safari/i)&&!Ta(/chrome/i)&&!Ta(/android/i),$a=Ta(/iP(ad|od|hone)/i),Ia=Ta(/chrome/i)&&Ta(/android/i),Ma={capture:!1,passive:!1};function Ra(t,e,n){t.addEventListener(e,n,!Pa&&Ma)}function Fa(t,e,n){t.removeEventListener(e,n,!Pa&&Ma)}function Wa(t,e){if(e){if(">"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(n){return!1}return!1}}function Ba(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function za(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&Wa(t,e):Wa(t,e))||o&&t===n)return t;if(t===n)break}while(t=Ba(t))}return null}var qa,Ua=/\s+/g;function Ha(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(Ua," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(Ua," ")}}function Xa(t,e,n){var o=t&&t.style;if(o){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];e in o||-1!==e.indexOf("webkit")||(e="-webkit-"+e),o[e]=n+("string"==typeof n?"":"px")}}function Va(t,e){var n="";if("string"==typeof t)n=t;else do{var o=Xa(t,"transform");o&&"none"!==o&&(n=o+" "+n)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function Ya(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i<r;i++)n(o[i],i);return o}return[]}function Ga(){var t=document.scrollingElement;return t||document.documentElement}function Za(t,e,n,o,i){if(t.getBoundingClientRect||t===window){var r,s,a,l,c,d,u;if(t!==window&&t.parentNode&&t!==Ga()?(s=(r=t.getBoundingClientRect()).top,a=r.left,l=r.bottom,c=r.right,d=r.height,u=r.width):(s=0,a=0,l=window.innerHeight,c=window.innerWidth,d=window.innerHeight,u=window.innerWidth),(e||n)&&t!==window&&(i=i||t.parentNode,!Pa))do{if(i&&i.getBoundingClientRect&&("none"!==Xa(i,"transform")||n&&"static"!==Xa(i,"position"))){var h=i.getBoundingClientRect();s-=h.top+parseInt(Xa(i,"border-top-width")),a-=h.left+parseInt(Xa(i,"border-left-width")),l=s+r.height,c=a+r.width;break}}while(i=i.parentNode);if(o&&t!==window){var p=Va(i||t),f=p&&p.a,m=p&&p.d;p&&(l=(s/=m)+(d/=m),c=(a/=f)+(u/=f))}return{top:s,left:a,bottom:l,right:c,width:u,height:d}}}function Ja(t,e,n){for(var o=nl(t,!0),i=Za(t)[e];o;){if(!(i>=Za(o)[n]))return o;if(o===Ga())break;o=nl(o,!1)}return!1}function Ka(t,e,n,o){for(var i=0,r=0,s=t.children;r<s.length;){if("none"!==s[r].style.display&&s[r]!==sc.ghost&&(o||s[r]!==sc.dragged)&&za(s[r],n.draggable,t,!1)){if(i===e)return s[r];i++}r++}return null}function Qa(t,e){for(var n=t.lastElementChild;n&&(n===sc.ghost||"none"===Xa(n,"display")||e&&!Wa(n,e));)n=n.previousElementSibling;return n||null}function tl(t,e){var n=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||t===sc.clone||e&&!Wa(t,e)||n++;return n}function el(t){var e=0,n=0,o=Ga();if(t)do{var i=Va(t),r=i.a,s=i.d;e+=t.scrollLeft*r,n+=t.scrollTop*s}while(t!==o&&(t=t.parentNode));return[e,n]}function nl(t,e){if(!t||!t.getBoundingClientRect)return Ga();var n=t,o=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=Xa(n);if(n.clientWidth<n.scrollWidth&&("auto"==i.overflowX||"scroll"==i.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==i.overflowY||"scroll"==i.overflowY)){if(!n.getBoundingClientRect||n===document.body)return Ga();if(o||e)return n;o=!0}}}while(n=n.parentNode);return Ga()}function ol(t,e){return Math.round(t.top)===Math.round(e.top)&&Math.round(t.left)===Math.round(e.left)&&Math.round(t.height)===Math.round(e.height)&&Math.round(t.width)===Math.round(e.width)}function il(t,e){return function(){if(!qa){var n=arguments;1===n.length?t.call(this,n[0]):t.apply(this,n),qa=setTimeout((function(){qa=void 0}),e)}}}function rl(t,e,n){t.scrollLeft+=e,t.scrollTop+=n}function sl(t){var e=window.Polymer,n=window.jQuery||window.Zepto;return e&&e.dom?e.dom(t).cloneNode(!0):n?n(t).clone(!0)[0]:t.cloneNode(!0)}function al(t,e,n){var o={};return Array.from(t.children).forEach((function(i){var r,s,a,l;if(za(i,e.draggable,t,!1)&&!i.animated&&i!==n){var c=Za(i);o.left=Math.min(null!==(r=o.left)&&void 0!==r?r:1/0,c.left),o.top=Math.min(null!==(s=o.top)&&void 0!==s?s:1/0,c.top),o.right=Math.max(null!==(a=o.right)&&void 0!==a?a:-1/0,c.right),o.bottom=Math.max(null!==(l=o.bottom)&&void 0!==l?l:-1/0,c.bottom)}})),o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}var ll="Sortable"+(new Date).getTime();function cl(){var t,e=[];return{captureAnimationState:function(){(e=[],this.options.animation)&&[].slice.call(this.el.children).forEach((function(t){if("none"!==Xa(t,"display")&&t!==sc.ghost){e.push({target:t,rect:Za(t)});var n=Oa({},e[e.length-1].rect);if(t.thisAnimationDuration){var o=Va(t,!0);o&&(n.top-=o.f,n.left-=o.e)}t.fromRect=n}}))},addAnimationState:function(t){e.push(t)},removeAnimationState:function(t){e.splice(function(t,e){for(var n in t)if(t.hasOwnProperty(n))for(var o in e)if(e.hasOwnProperty(o)&&e[o]===t[n][o])return Number(n);return-1}(e,{target:t}),1)},animateAll:function(n){var o=this;if(!this.options.animation)return clearTimeout(t),void("function"==typeof n&&n());var i=!1,r=0;e.forEach((function(t){var e=0,n=t.target,s=n.fromRect,a=Za(n),l=n.prevFromRect,c=n.prevToRect,d=t.rect,u=Va(n,!0);u&&(a.top-=u.f,a.left-=u.e),n.toRect=a,n.thisAnimationDuration&&ol(l,a)&&!ol(s,a)&&(d.top-a.top)/(d.left-a.left)==(s.top-a.top)/(s.left-a.left)&&(e=function(t,e,n,o){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-n.top,2)+Math.pow(e.left-n.left,2))*o.animation}(d,l,c,o.options)),ol(a,s)||(n.prevFromRect=s,n.prevToRect=a,e||(e=o.options.animation),o.animate(n,d,a,e)),e&&(i=!0,r=Math.max(r,e),clearTimeout(n.animationResetTimer),n.animationResetTimer=setTimeout((function(){n.animationTime=0,n.prevFromRect=null,n.fromRect=null,n.prevToRect=null,n.thisAnimationDuration=null}),e),n.thisAnimationDuration=e)})),clearTimeout(t),i?t=setTimeout((function(){"function"==typeof n&&n()}),r):"function"==typeof n&&n(),e=[]},animate:function(t,e,n,o){if(o){Xa(t,"transition",""),Xa(t,"transform","");var i=Va(this.el),r=i&&i.a,s=i&&i.d,a=(e.left-n.left)/(r||1),l=(e.top-n.top)/(s||1);t.animatingX=!!a,t.animatingY=!!l,Xa(t,"transform","translate3d("+a+"px,"+l+"px,0)"),this.forRepaintDummy=function(t){return t.offsetWidth}(t),Xa(t,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),Xa(t,"transform","translate3d(0,0,0)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout((function(){Xa(t,"transition",""),Xa(t,"transform",""),t.animated=!1,t.animatingX=!1,t.animatingY=!1}),o)}}}}var dl=[],ul={initializeByDefault:!0},hl={mount:function(t){for(var e in ul)ul.hasOwnProperty(e)&&!(e in t)&&(t[e]=ul[e]);dl.forEach((function(e){if(e.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")})),dl.push(t)},pluginEvent:function(t,e,n){var o=this;this.eventCanceled=!1,n.cancel=function(){o.eventCanceled=!0};var i=t+"Global";dl.forEach((function(o){e[o.pluginName]&&(e[o.pluginName][i]&&e[o.pluginName][i](Oa({sortable:e},n)),e.options[o.pluginName]&&e[o.pluginName][t]&&e[o.pluginName][t](Oa({sortable:e},n)))}))},initializePlugins:function(t,e,n,o){for(var i in dl.forEach((function(o){var i=o.pluginName;if(t.options[i]||o.initializeByDefault){var r=new o(t,e,t.options);r.sortable=t,r.options=t.options,t[i]=r,Aa(n,r.defaults)}})),t.options)if(t.options.hasOwnProperty(i)){var r=this.modifyOption(t,i,t.options[i]);void 0!==r&&(t.options[i]=r)}},getEventProperties:function(t,e){var n={};return dl.forEach((function(o){"function"==typeof o.eventProperties&&Aa(n,o.eventProperties.call(e[o.pluginName],t))})),n},modifyOption:function(t,e,n){var o;return dl.forEach((function(i){t[i.pluginName]&&i.optionListeners&&"function"==typeof i.optionListeners[e]&&(o=i.optionListeners[e].call(t[i.pluginName],n))})),o}};var pl=["evt"],fl=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=n.evt,i=ja(n,pl);hl.pluginEvent.bind(sc)(t,e,Oa({dragEl:gl,parentEl:vl,ghostEl:bl,rootEl:yl,nextEl:wl,lastDownEl:Cl,cloneEl:El,cloneHidden:xl,dragStarted:Il,putSortable:jl,activeSortable:sc.active,originalEvent:o,oldIndex:Sl,oldDraggableIndex:_l,newIndex:Ol,newDraggableIndex:Nl,hideGhostForTarget:nc,unhideGhostForTarget:oc,cloneNowHidden:function(){xl=!0},cloneNowShown:function(){xl=!1},dispatchSortableEvent:function(t){ml({sortable:e,name:t,originalEvent:o})}},i))};function ml(t){!function(t){var e=t.sortable,n=t.rootEl,o=t.name,i=t.targetEl,r=t.cloneEl,s=t.toEl,a=t.fromEl,l=t.oldIndex,c=t.newIndex,d=t.oldDraggableIndex,u=t.newDraggableIndex,h=t.originalEvent,p=t.putSortable,f=t.extraEventProperties;if(e=e||n&&n[ll]){var m,g=e.options,v="on"+o.charAt(0).toUpperCase()+o.substr(1);!window.CustomEvent||Pa||La?(m=document.createEvent("Event")).initEvent(o,!0,!0):m=new CustomEvent(o,{bubbles:!0,cancelable:!0}),m.to=s||n,m.from=a||n,m.item=i||n,m.clone=r,m.oldIndex=l,m.newIndex=c,m.oldDraggableIndex=d,m.newDraggableIndex=u,m.originalEvent=h,m.pullMode=p?p.lastPutMode:void 0;var b=Oa(Oa({},f),hl.getEventProperties(o,e));for(var y in b)m[y]=b[y];n&&n.dispatchEvent(m),g[v]&&g[v].call(e,m)}}(Oa({putSortable:jl,cloneEl:El,targetEl:gl,rootEl:yl,oldIndex:Sl,oldDraggableIndex:_l,newIndex:Ol,newDraggableIndex:Nl},t))}var gl,vl,bl,yl,wl,Cl,El,xl,Sl,Ol,_l,Nl,Al,jl,Tl,Pl,Ll,Dl,kl,$l,Il,Ml,Rl,Fl,Wl,Bl=!1,zl=!1,ql=[],Ul=!1,Hl=!1,Xl=[],Vl=!1,Yl=[],Gl="undefined"!=typeof document,Zl=$a,Jl=La||Pa?"cssFloat":"float",Kl=Gl&&!Ia&&!$a&&"draggable"in document.createElement("div"),Ql=function(){if(Gl){if(Pa)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),tc=function(t,e){var n=Xa(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=Ka(t,0,e),r=Ka(t,1,e),s=i&&Xa(i),a=r&&Xa(r),l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Za(i).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Za(r).width;if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(i&&s.float&&"none"!==s.float){var d="left"===s.float?"left":"right";return!r||"both"!==a.clear&&a.clear!==d?"horizontal":"vertical"}return i&&("block"===s.display||"flex"===s.display||"table"===s.display||"grid"===s.display||l>=o&&"none"===n[Jl]||r&&"none"===n[Jl]&&l+c>o)?"vertical":"horizontal"},ec=function(t){function e(t,n){return function(o,i,r,s){var a=o.options.group.name&&i.options.group.name&&o.options.group.name===i.options.group.name;if(null==t&&(n||a))return!0;if(null==t||!1===t)return!1;if(n&&"clone"===t)return t;if("function"==typeof t)return e(t(o,i,r,s),n)(o,i,r,s);var l=(n?o:i).options.group.name;return!0===t||"string"==typeof t&&t===l||t.join&&t.indexOf(l)>-1}}var n={},o=t.group;o&&"object"==_a(o)||(o={name:o}),n.name=o.name,n.checkPull=e(o.pull,!0),n.checkPut=e(o.put),n.revertClone=o.revertClone,t.group=n},nc=function(){!Ql&&bl&&Xa(bl,"display","none")},oc=function(){!Ql&&bl&&Xa(bl,"display","")};Gl&&!Ia&&document.addEventListener("click",(function(t){if(zl)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),zl=!1,!1}),!0);var ic=function(t){if(gl){t=t.touches?t.touches[0]:t;var e=(i=t.clientX,r=t.clientY,ql.some((function(t){var e=t[ll].options.emptyInsertThreshold;if(e&&!Qa(t)){var n=Za(t),o=i>=n.left-e&&i<=n.right+e,a=r>=n.top-e&&r<=n.bottom+e;return o&&a?s=t:void 0}})),s);if(e){var n={};for(var o in t)t.hasOwnProperty(o)&&(n[o]=t[o]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[ll]._onDragOver(n)}}var i,r,s},rc=function(t){gl&&gl.parentNode[ll]._isOutsideThisEl(t.target)};function sc(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=Aa({},e),t[ll]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return tc(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.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:!1!==sc.supportPointer&&"PointerEvent"in window&&!ka,emptyInsertThreshold:5};for(var o in hl.initializePlugins(this,t,n),n)!(o in e)&&(e[o]=n[o]);for(var i in ec(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&Kl,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?Ra(t,"pointerdown",this._onTapStart):(Ra(t,"mousedown",this._onTapStart),Ra(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(Ra(t,"dragover",this),Ra(t,"dragenter",this)),ql.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),Aa(this,cl())}function ac(t,e,n,o,i,r,s,a){var l,c,d=t[ll],u=d.options.onMove;return!window.CustomEvent||Pa||La?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=e,l.from=t,l.dragged=n,l.draggedRect=o,l.related=i||e,l.relatedRect=r||Za(e),l.willInsertAfter=a,l.originalEvent=s,t.dispatchEvent(l),u&&(c=u.call(d,l,s)),c}function lc(t){t.draggable=!1}function cc(){Vl=!1}function dc(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,o=0;n--;)o+=e.charCodeAt(n);return o.toString(36)}function uc(t){return setTimeout(t,0)}function hc(t){return clearTimeout(t)}sc.prototype={constructor:sc,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(Ml=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,gl):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,n=this.el,o=this.options,i=o.preventOnFilter,r=t.type,s=t.touches&&t.touches[0]||t.pointerType&&"touch"===t.pointerType&&t,a=(s||t).target,l=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||a,c=o.filter;if(function(t){Yl.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&Yl.push(o)}}(n),!gl&&!(/mousedown|pointerdown/.test(r)&&0!==t.button||o.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!ka||!a||"SELECT"!==a.tagName.toUpperCase())&&!((a=za(a,o.draggable,n,!1))&&a.animated||Cl===a)){if(Sl=tl(a),_l=tl(a,o.draggable),"function"==typeof c){if(c.call(this,t,a,this))return ml({sortable:e,rootEl:l,name:"filter",targetEl:a,toEl:n,fromEl:n}),fl("filter",e,{evt:t}),void(i&&t.cancelable&&t.preventDefault())}else if(c&&(c=c.split(",").some((function(o){if(o=za(l,o.trim(),n,!1))return ml({sortable:e,rootEl:o,name:"filter",targetEl:a,fromEl:n,toEl:n}),fl("filter",e,{evt:t}),!0}))))return void(i&&t.cancelable&&t.preventDefault());o.handle&&!za(l,o.handle,n,!1)||this._prepareDragStart(t,s,a)}}},_prepareDragStart:function(t,e,n){var o,i=this,r=i.el,s=i.options,a=r.ownerDocument;if(n&&!gl&&n.parentNode===r){var l=Za(n);if(yl=r,vl=(gl=n).parentNode,wl=gl.nextSibling,Cl=n,Al=s.group,sc.dragged=gl,Tl={target:gl,clientX:(e||t).clientX,clientY:(e||t).clientY},kl=Tl.clientX-l.left,$l=Tl.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,gl.style["will-change"]="all",o=function(){fl("delayEnded",i,{evt:t}),sc.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!Da&&i.nativeDraggable&&(gl.draggable=!0),i._triggerDragStart(t,e),ml({sortable:i,name:"choose",originalEvent:t}),Ha(gl,s.chosenClass,!0))},s.ignore.split(",").forEach((function(t){Ya(gl,t.trim(),lc)})),Ra(a,"dragover",ic),Ra(a,"mousemove",ic),Ra(a,"touchmove",ic),Ra(a,"mouseup",i._onDrop),Ra(a,"touchend",i._onDrop),Ra(a,"touchcancel",i._onDrop),Da&&this.nativeDraggable&&(this.options.touchStartThreshold=4,gl.draggable=!0),fl("delayStart",this,{evt:t}),!s.delay||s.delayOnTouchOnly&&!e||this.nativeDraggable&&(La||Pa))o();else{if(sc.eventCanceled)return void this._onDrop();Ra(a,"mouseup",i._disableDelayedDrag),Ra(a,"touchend",i._disableDelayedDrag),Ra(a,"touchcancel",i._disableDelayedDrag),Ra(a,"mousemove",i._delayedDragTouchMoveHandler),Ra(a,"touchmove",i._delayedDragTouchMoveHandler),s.supportPointer&&Ra(a,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(o,s.delay)}}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){gl&&lc(gl),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;Fa(t,"mouseup",this._disableDelayedDrag),Fa(t,"touchend",this._disableDelayedDrag),Fa(t,"touchcancel",this._disableDelayedDrag),Fa(t,"mousemove",this._delayedDragTouchMoveHandler),Fa(t,"touchmove",this._delayedDragTouchMoveHandler),Fa(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?Ra(document,"pointermove",this._onTouchMove):Ra(document,e?"touchmove":"mousemove",this._onTouchMove):(Ra(gl,"dragend",this),Ra(yl,"dragstart",this._onDragStart));try{document.selection?uc((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(n){}},_dragStarted:function(t,e){if(Bl=!1,yl&&gl){fl("dragStarted",this,{evt:e}),this.nativeDraggable&&Ra(document,"dragover",rc);var n=this.options;!t&&Ha(gl,n.dragClass,!1),Ha(gl,n.ghostClass,!0),sc.active=this,t&&this._appendGhost(),ml({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(Pl){this._lastX=Pl.clientX,this._lastY=Pl.clientY,nc();for(var t=document.elementFromPoint(Pl.clientX,Pl.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Pl.clientX,Pl.clientY))!==e;)e=t;if(gl.parentNode[ll]._isOutsideThisEl(t),e)do{if(e[ll]){if(e[ll]._onDragOver({clientX:Pl.clientX,clientY:Pl.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=Ba(e));oc()}},_onTouchMove:function(t){if(Tl){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=bl&&Va(bl,!0),s=bl&&r&&r.a,a=bl&&r&&r.d,l=Zl&&Wl&&el(Wl),c=(i.clientX-Tl.clientX+o.x)/(s||1)+(l?l[0]-Xl[0]:0)/(s||1),d=(i.clientY-Tl.clientY+o.y)/(a||1)+(l?l[1]-Xl[1]:0)/(a||1);if(!sc.active&&!Bl){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<n)return;this._onDragStart(t,!0)}if(bl){r?(r.e+=c-(Ll||0),r.f+=d-(Dl||0)):r={a:1,b:0,c:0,d:1,e:c,f:d};var u="matrix(".concat(r.a,",").concat(r.b,",").concat(r.c,",").concat(r.d,",").concat(r.e,",").concat(r.f,")");Xa(bl,"webkitTransform",u),Xa(bl,"mozTransform",u),Xa(bl,"msTransform",u),Xa(bl,"transform",u),Ll=c,Dl=d,Pl=i}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!bl){var t=this.options.fallbackOnBody?document.body:yl,e=Za(gl,!0,Zl,!0,t),n=this.options;if(Zl){for(Wl=t;"static"===Xa(Wl,"position")&&"none"===Xa(Wl,"transform")&&Wl!==document;)Wl=Wl.parentNode;Wl!==document.body&&Wl!==document.documentElement?(Wl===document&&(Wl=Ga()),e.top+=Wl.scrollTop,e.left+=Wl.scrollLeft):Wl=Ga(),Xl=el(Wl)}Ha(bl=gl.cloneNode(!0),n.ghostClass,!1),Ha(bl,n.fallbackClass,!0),Ha(bl,n.dragClass,!0),Xa(bl,"transition",""),Xa(bl,"transform",""),Xa(bl,"box-sizing","border-box"),Xa(bl,"margin",0),Xa(bl,"top",e.top),Xa(bl,"left",e.left),Xa(bl,"width",e.width),Xa(bl,"height",e.height),Xa(bl,"opacity","0.8"),Xa(bl,"position",Zl?"absolute":"fixed"),Xa(bl,"zIndex","100000"),Xa(bl,"pointerEvents","none"),sc.ghost=bl,t.appendChild(bl),Xa(bl,"transform-origin",kl/parseInt(bl.style.width)*100+"% "+$l/parseInt(bl.style.height)*100+"%")}},_onDragStart:function(t,e){var n=this,o=t.dataTransfer,i=n.options;fl("dragStart",this,{evt:t}),sc.eventCanceled?this._onDrop():(fl("setupClone",this),sc.eventCanceled||((El=sl(gl)).removeAttribute("id"),El.draggable=!1,El.style["will-change"]="",this._hideClone(),Ha(El,this.options.chosenClass,!1),sc.clone=El),n.cloneId=uc((function(){fl("clone",n),sc.eventCanceled||(n.options.removeCloneOnHide||yl.insertBefore(El,gl),n._hideClone(),ml({sortable:n,name:"clone"}))})),!e&&Ha(gl,i.dragClass,!0),e?(zl=!0,n._loopId=setInterval(n._emulateDragOver,50)):(Fa(document,"mouseup",n._onDrop),Fa(document,"touchend",n._onDrop),Fa(document,"touchcancel",n._onDrop),o&&(o.effectAllowed="move",i.setData&&i.setData.call(n,o,gl)),Ra(document,"drop",n),Xa(gl,"transform","translateZ(0)")),Bl=!0,n._dragStartId=uc(n._dragStarted.bind(n,e,t)),Ra(document,"selectstart",n),Il=!0,ka&&Xa(document.body,"user-select","none"))},_onDragOver:function(t){var e,n,o,i,r=this.el,s=t.target,a=this.options,l=a.group,c=sc.active,d=Al===l,u=a.sort,h=jl||c,p=this,f=!1;if(!Vl){if(void 0!==t.preventDefault&&t.cancelable&&t.preventDefault(),s=za(s,a.draggable,r,!0),j("dragOver"),sc.eventCanceled)return f;if(gl.contains(t.target)||s.animated&&s.animatingX&&s.animatingY||p._ignoreWhileAnimating===s)return P(!1);if(zl=!1,c&&!a.disabled&&(d?u||(o=vl!==yl):jl===this||(this.lastPutMode=Al.checkPull(this,c,gl,t))&&l.checkPut(this,c,gl,t))){if(i="vertical"===this._getDirection(t,s),e=Za(gl),j("dragOverValid"),sc.eventCanceled)return f;if(o)return vl=yl,T(),this._hideClone(),j("revert"),sc.eventCanceled||(wl?yl.insertBefore(gl,wl):yl.appendChild(gl)),P(!0);var m=Qa(r,a.draggable);if(!m||function(t,e,n){var o=Za(Qa(n.el,n.options.draggable)),i=al(n.el,n.options,bl),r=10;return e?t.clientX>i.right+r||t.clientY>o.bottom&&t.clientX>o.left:t.clientY>i.bottom+r||t.clientX>o.right&&t.clientY>o.top}(t,i,this)&&!m.animated){if(m===gl)return P(!1);if(m&&r===t.target&&(s=m),s&&(n=Za(s)),!1!==ac(yl,r,gl,e,s,n,t,!!s))return T(),m&&m.nextSibling?r.insertBefore(gl,m.nextSibling):r.appendChild(gl),vl=r,L(),P(!0)}else if(m&&function(t,e,n){var o=Za(Ka(n.el,0,n.options,!0)),i=al(n.el,n.options,bl),r=10;return e?t.clientX<i.left-r||t.clientY<o.top&&t.clientX<o.right:t.clientY<i.top-r||t.clientY<o.bottom&&t.clientX<o.left}(t,i,this)){var g=Ka(r,0,a,!0);if(g===gl)return P(!1);if(n=Za(s=g),!1!==ac(yl,r,gl,e,s,n,t,!1))return T(),r.insertBefore(gl,g),vl=r,L(),P(!0)}else if(s.parentNode===r){n=Za(s);var v,b,y,w=gl.parentNode!==r,C=!function(t,e,n){var o=n?t.left:t.top,i=n?t.right:t.bottom,r=n?t.width:t.height,s=n?e.left:e.top,a=n?e.right:e.bottom,l=n?e.width:e.height;return o===s||i===a||o+r/2===s+l/2}(gl.animated&&gl.toRect||e,s.animated&&s.toRect||n,i),E=i?"top":"left",x=Ja(s,"top","top")||Ja(gl,"top","top"),S=x?x.scrollTop:void 0;if(Ml!==s&&(b=n[E],Ul=!1,Hl=!C&&a.invertSwap||w),v=function(t,e,n,o,i,r,s,a){var l=o?t.clientY:t.clientX,c=o?n.height:n.width,d=o?n.top:n.left,u=o?n.bottom:n.right,h=!1;if(!s)if(a&&Fl<c*i){if(!Ul&&(1===Rl?l>d+c*r/2:l<u-c*r/2)&&(Ul=!0),Ul)h=!0;else if(1===Rl?l<d+Fl:l>u-Fl)return-Rl}else if(l>d+c*(1-i)/2&&l<u-c*(1-i)/2)return function(t){return tl(gl)<tl(t)?1:-1}(e);if((h=h||s)&&(l<d+c*r/2||l>u-c*r/2))return l>d+c/2?1:-1;return 0}(t,s,n,i,C?1:a.swapThreshold,null==a.invertedSwapThreshold?a.swapThreshold:a.invertedSwapThreshold,Hl,Ml===s),0!==v){var O=tl(gl);do{O-=v,y=vl.children[O]}while(y&&("none"===Xa(y,"display")||y===bl))}if(0===v||y===s)return P(!1);Ml=s,Rl=v;var _=s.nextElementSibling,N=!1,A=ac(yl,r,gl,e,s,n,t,N=1===v);if(!1!==A)return 1!==A&&-1!==A||(N=1===A),Vl=!0,setTimeout(cc,30),T(),N&&!_?r.appendChild(gl):s.parentNode.insertBefore(gl,N?_:s),x&&rl(x,0,S-x.scrollTop),vl=gl.parentNode,void 0===b||Hl||(Fl=Math.abs(b-Za(s)[E])),L(),P(!0)}if(r.contains(gl))return P(!1)}return!1}function j(a,l){fl(a,p,Oa({evt:t,isOwner:d,axis:i?"vertical":"horizontal",revert:o,dragRect:e,targetRect:n,canSort:u,fromSortable:h,target:s,completed:P,onMove:function(n,o){return ac(yl,r,gl,e,n,Za(n),t,o)},changed:L},l))}function T(){j("dragOverAnimationCapture"),p.captureAnimationState(),p!==h&&h.captureAnimationState()}function P(e){return j("dragOverCompleted",{insertion:e}),e&&(d?c._hideClone():c._showClone(p),p!==h&&(Ha(gl,jl?jl.options.ghostClass:c.options.ghostClass,!1),Ha(gl,a.ghostClass,!0)),jl!==p&&p!==sc.active?jl=p:p===sc.active&&jl&&(jl=null),h===p&&(p._ignoreWhileAnimating=s),p.animateAll((function(){j("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(s===gl&&!gl.animated||s===r&&!s.animated)&&(Ml=null),a.dragoverBubble||t.rootEl||s===document||(gl.parentNode[ll]._isOutsideThisEl(t.target),!e&&ic(t)),!a.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),f=!0}function L(){Ol=tl(gl),Nl=tl(gl,a.draggable),ml({sortable:p,name:"change",toEl:r,newIndex:Ol,newDraggableIndex:Nl,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){Fa(document,"mousemove",this._onTouchMove),Fa(document,"touchmove",this._onTouchMove),Fa(document,"pointermove",this._onTouchMove),Fa(document,"dragover",ic),Fa(document,"mousemove",ic),Fa(document,"touchmove",ic)},_offUpEvents:function(){var t=this.el.ownerDocument;Fa(t,"mouseup",this._onDrop),Fa(t,"touchend",this._onDrop),Fa(t,"pointerup",this._onDrop),Fa(t,"touchcancel",this._onDrop),Fa(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;Ol=tl(gl),Nl=tl(gl,n.draggable),fl("drop",this,{evt:t}),vl=gl&&gl.parentNode,Ol=tl(gl),Nl=tl(gl,n.draggable),sc.eventCanceled||(Bl=!1,Hl=!1,Ul=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),hc(this.cloneId),hc(this._dragStartId),this.nativeDraggable&&(Fa(document,"drop",this),Fa(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),ka&&Xa(document.body,"user-select",""),Xa(gl,"transform",""),t&&(Il&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),bl&&bl.parentNode&&bl.parentNode.removeChild(bl),(yl===vl||jl&&"clone"!==jl.lastPutMode)&&El&&El.parentNode&&El.parentNode.removeChild(El),gl&&(this.nativeDraggable&&Fa(gl,"dragend",this),lc(gl),gl.style["will-change"]="",Il&&!Bl&&Ha(gl,jl?jl.options.ghostClass:this.options.ghostClass,!1),Ha(gl,this.options.chosenClass,!1),ml({sortable:this,name:"unchoose",toEl:vl,newIndex:null,newDraggableIndex:null,originalEvent:t}),yl!==vl?(Ol>=0&&(ml({rootEl:vl,name:"add",toEl:vl,fromEl:yl,originalEvent:t}),ml({sortable:this,name:"remove",toEl:vl,originalEvent:t}),ml({rootEl:vl,name:"sort",toEl:vl,fromEl:yl,originalEvent:t}),ml({sortable:this,name:"sort",toEl:vl,originalEvent:t})),jl&&jl.save()):Ol!==Sl&&Ol>=0&&(ml({sortable:this,name:"update",toEl:vl,originalEvent:t}),ml({sortable:this,name:"sort",toEl:vl,originalEvent:t})),sc.active&&(null!=Ol&&-1!==Ol||(Ol=Sl,Nl=_l),ml({sortable:this,name:"end",toEl:vl,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){fl("nulling",this),yl=gl=vl=bl=wl=El=Cl=xl=Tl=Pl=Il=Ol=Nl=Sl=_l=Ml=Rl=jl=Al=sc.dragged=sc.ghost=sc.clone=sc.active=null,Yl.forEach((function(t){t.checked=!0})),Yl.length=Ll=Dl=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":gl&&(this._onDragOver(t),function(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move");t.cancelable&&t.preventDefault()}(t));break;case"selectstart":t.preventDefault()}},toArray:function(){for(var t,e=[],n=this.el.children,o=0,i=n.length,r=this.options;o<i;o++)za(t=n[o],r.draggable,this.el,!1)&&e.push(t.getAttribute(r.dataIdAttr)||dc(t));return e},sort:function(t,e){var n={},o=this.el;this.toArray().forEach((function(t,e){var i=o.children[e];za(i,this.options.draggable,o,!1)&&(n[t]=i)}),this),e&&this.captureAnimationState(),t.forEach((function(t){n[t]&&(o.removeChild(n[t]),o.appendChild(n[t]))})),e&&this.animateAll()},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,e){return za(t,e||this.options.draggable,this.el,!1)},option:function(t,e){var n=this.options;if(void 0===e)return n[t];var o=hl.modifyOption(this,t,e);n[t]=void 0!==o?o:e,"group"===t&&ec(n)},destroy:function(){fl("destroy",this);var t=this.el;t[ll]=null,Fa(t,"mousedown",this._onTapStart),Fa(t,"touchstart",this._onTapStart),Fa(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(Fa(t,"dragover",this),Fa(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),(function(t){t.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),ql.splice(ql.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!xl){if(fl("hideClone",this),sc.eventCanceled)return;Xa(El,"display","none"),this.options.removeCloneOnHide&&El.parentNode&&El.parentNode.removeChild(El),xl=!0}},_showClone:function(t){if("clone"===t.lastPutMode){if(xl){if(fl("showClone",this),sc.eventCanceled)return;gl.parentNode!=yl||this.options.group.revertClone?wl?yl.insertBefore(El,wl):yl.appendChild(El):yl.insertBefore(El,gl),this.options.group.revertClone&&this.animate(gl,El),Xa(El,"display",""),xl=!1}}else this._hideClone()}},Gl&&Ra(document,"touchmove",(function(t){(sc.active||Bl)&&t.cancelable&&t.preventDefault()})),sc.utils={on:Ra,off:Fa,css:Xa,find:Ya,is:function(t,e){return!!za(t,e,t,!1)},extend:function(t,e){if(t&&e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t},throttle:il,closest:za,toggleClass:Ha,clone:sl,index:tl,nextTick:uc,cancelNextTick:hc,detectDirection:tc,getChild:Ka,expando:ll},sc.get=function(t){return t[ll]},sc.mount=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];e[0].constructor===Array&&(e=e[0]),e.forEach((function(t){if(!t.prototype||!t.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(t));t.utils&&(sc.utils=Oa(Oa({},sc.utils),t.utils)),hl.mount(t)}))},sc.create=function(t,e){return new sc(t,e)},sc.version="1.15.3";var pc,fc,mc,gc,vc,bc,yc=[],wc=!1;function Cc(){yc.forEach((function(t){clearInterval(t.pid)})),yc=[]}function Ec(){clearInterval(bc)}var xc=il((function(t,e,n,o){if(e.scroll){var i,r=(t.touches?t.touches[0]:t).clientX,s=(t.touches?t.touches[0]:t).clientY,a=e.scrollSensitivity,l=e.scrollSpeed,c=Ga(),d=!1;fc!==n&&(fc=n,Cc(),pc=e.scroll,i=e.scrollFn,!0===pc&&(pc=nl(n,!0)));var u=0,h=pc;do{var p=h,f=Za(p),m=f.top,g=f.bottom,v=f.left,b=f.right,y=f.width,w=f.height,C=void 0,E=void 0,x=p.scrollWidth,S=p.scrollHeight,O=Xa(p),_=p.scrollLeft,N=p.scrollTop;p===c?(C=y<x&&("auto"===O.overflowX||"scroll"===O.overflowX||"visible"===O.overflowX),E=w<S&&("auto"===O.overflowY||"scroll"===O.overflowY||"visible"===O.overflowY)):(C=y<x&&("auto"===O.overflowX||"scroll"===O.overflowX),E=w<S&&("auto"===O.overflowY||"scroll"===O.overflowY));var A=C&&(Math.abs(b-r)<=a&&_+y<x)-(Math.abs(v-r)<=a&&!!_),j=E&&(Math.abs(g-s)<=a&&N+w<S)-(Math.abs(m-s)<=a&&!!N);if(!yc[u])for(var T=0;T<=u;T++)yc[T]||(yc[T]={});yc[u].vx==A&&yc[u].vy==j&&yc[u].el===p||(yc[u].el=p,yc[u].vx=A,yc[u].vy=j,clearInterval(yc[u].pid),0==A&&0==j||(d=!0,yc[u].pid=setInterval(function(){o&&0===this.layer&&sc.active._onTouchMove(vc);var e=yc[this.layer].vy?yc[this.layer].vy*l:0,n=yc[this.layer].vx?yc[this.layer].vx*l:0;"function"==typeof i&&"continue"!==i.call(sc.dragged.parentNode[ll],n,e,t,vc,yc[this.layer].el)||rl(yc[this.layer].el,n,e)}.bind({layer:u}),24))),u++}while(e.bubbleScroll&&h!==c&&(h=nl(h,!1)));wc=d}}),30),Sc=function(t){var e=t.originalEvent,n=t.putSortable,o=t.dragEl,i=t.activeSortable,r=t.dispatchSortableEvent,s=t.hideGhostForTarget,a=t.unhideGhostForTarget;if(e){var l=n||i;s();var c=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e,d=document.elementFromPoint(c.clientX,c.clientY);a(),l&&!l.el.contains(d)&&(r("spill"),this.onSpill({dragEl:o,putSortable:n}))}};function Oc(){}function _c(){}Oc.prototype={startIndex:null,dragStart:function(t){var e=t.oldDraggableIndex;this.startIndex=e},onSpill:function(t){var e=t.dragEl,n=t.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var o=Ka(this.sortable.el,this.startIndex,this.options);o?this.sortable.el.insertBefore(e,o):this.sortable.el.appendChild(e),this.sortable.animateAll(),n&&n.animateAll()},drop:Sc},Aa(Oc,{pluginName:"revertOnSpill"}),_c.prototype={onSpill:function(t){var e=t.dragEl,n=t.putSortable||this.sortable;n.captureAnimationState(),e.parentNode&&e.parentNode.removeChild(e),n.animateAll()},drop:Sc},Aa(_c,{pluginName:"removeOnSpill"}),sc.mount(new function(){function t(){for(var t in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===t.charAt(0)&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}return t.prototype={dragStarted:function(t){var e=t.originalEvent;this.sortable.nativeDraggable?Ra(document,"dragover",this._handleAutoScroll):this.options.supportPointer?Ra(document,"pointermove",this._handleFallbackAutoScroll):e.touches?Ra(document,"touchmove",this._handleFallbackAutoScroll):Ra(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(t){var e=t.originalEvent;this.options.dragOverBubble||e.rootEl||this._handleAutoScroll(e)},drop:function(){this.sortable.nativeDraggable?Fa(document,"dragover",this._handleAutoScroll):(Fa(document,"pointermove",this._handleFallbackAutoScroll),Fa(document,"touchmove",this._handleFallbackAutoScroll),Fa(document,"mousemove",this._handleFallbackAutoScroll)),Ec(),Cc(),clearTimeout(qa),qa=void 0},nulling:function(){vc=fc=pc=wc=bc=mc=gc=null,yc.length=0},_handleFallbackAutoScroll:function(t){this._handleAutoScroll(t,!0)},_handleAutoScroll:function(t,e){var n=this,o=(t.touches?t.touches[0]:t).clientX,i=(t.touches?t.touches[0]:t).clientY,r=document.elementFromPoint(o,i);if(vc=t,e||this.options.forceAutoScrollFallback||La||Pa||ka){xc(t,this.options,r,e);var s=nl(r,!0);!wc||bc&&o===mc&&i===gc||(bc&&Ec(),bc=setInterval((function(){var r=nl(document.elementFromPoint(o,i),!0);r!==s&&(s=r,Cc()),xc(t,n.options,r,e)}),10),mc=o,gc=i)}else{if(!this.options.bubbleScroll||nl(r,!0)===Ga())return void Cc();xc(t,this.options,nl(r,!1),!1)}}},Aa(t,{pluginName:"scroll",initializeByDefault:!0})}),sc.mount(_c,Oc);const Nc={add:{attr:t=>{const e=window.prompt(t.message.attr);if(e&&t.isDisabled(e))return window.alert(r.get("attributeNotPermitted",e||"")),Ac.add.attrs(t);let n;e&&(n=String(window.prompt(t.message.value,"")),t.addAction(e,n))},option:t=>{t.addAction()},condition:t=>{t.addAction(t)}},click:{btn:t=>{t.action()}},save:{form:Qi}},Ac={init:function(t){const e=Object.keys(Nc);return this.opts=e.reduce(((e,n)=>(e[n]={...Nc[n],...t[n]},e)),t),this},add:{attrs:t=>Ac.opts.add.attr(t),options:t=>Ac.opts.add.option(t),conditions:t=>(t.template={if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]},Ac.opts.add.condition(t))},click:{btn:t=>Ac.opts.click.btn(t)},save:{form:t=>(Ac.opts.sessionStorage&&Gi.set(B,t),ns.formeoSaved({formData:t}),Ac.opts.save.form(t))}},jc=Object.freeze({type:"field",displayType:"slider"}),Tc=t=>({transform:`translateX(${t?`${t}px`:0})`});class Pc{constructor(t){n(this,"toggleTabbedLayout",(()=>{this.getPanelDisplay();const t=this.isTabbed;return this.panelsWrap.parentElement.classList.toggle("tabbed-panels",t),t&&this.panelNav.removeAttribute("style"),t})),n(this,"resizePanels",(()=>{this.toggleTabbedLayout();const t=this.panelsWrap.style,e=qd.getStyle(this.currentPanel,"height");return t.height=e,e})),this.opts=Hi(jc,t),this.panelDisplay=this.opts.displayType,this.activePanelIndex=0,this.panelNav=this.createPanelNav();const e=this.createPanelsWrap();this.nav=this.navActions();const o=new window.ResizeObserver((([{contentRect:{width:t}}])=>{this.currentWidth!==t&&(this.toggleTabbedLayout(),this.currentWidth=t,this.nav.setTranslateX(this.activePanelIndex,!1))})),i=window.setTimeout((()=>{o.observe(e),window.clearTimeout(i)}),H)}getPanelDisplay(){const t=this.panelsWrap,e=Number.parseInt(qd.getStyle(t,"width"))>390?"tabbed":"slider",n="auto"===this.opts.displayType;return this.panelDisplay=n?e:this.opts.displayType||jc.displayType,this.panelDisplay}createPanelsWrap(){const t=qd.create({className:"panels",content:this.opts.panels.map((({config:t,...e})=>e))});return"field"===this.opts.type&&this.sortableProperties(t),this.panelsWrap=t,this.panels=t.children,this.currentPanel=this.panels[this.activePanelIndex],t}sortableProperties(t){const e=t.getElementsByClassName("field-edit-group");return Jr.forEach(e,(t=>{t.fieldId=this.opts.id,t.isSortable&&sc.create(t,{animation:150,group:{name:`edit-${t.editGroup}`,pull:!0,put:["properties"]},sort:!0,handle:".prop-order",onSort:t=>{this.propertySave(t.to),this.resizePanels()}})}))}createPanelNavLabels(){const t=this.opts.panels.map((t=>({tag:"h5",action:{click:t=>{const e=Ur(t.target,t.target.parentElement);this.nav.setTranslateX(e,!1),this.nav.groupChange(e)}},content:t.config.label}))),e={className:"panel-labels",content:{content:t}},[n]=t;return n.className="active-tab",qd.create(e)}createPanelNav(){this.labels=this.createPanelNavLabels();const t={tag:"button",attrs:{className:"next-group",title:r.get("controlGroups.nextGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.nextGroup(t)},content:qd.icon("triangle-right")},e={tag:"button",attrs:{className:"prev-group",title:r.get("controlGroups.prevGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.prevGroup(t)},content:qd.icon("triangle-left")};return qd.create({tag:"nav",attrs:{className:"panel-nav"},content:[e,this.labels,t]})}get isTabbed(){return"tabbed"===this.panelDisplay}navActions(){const t={},e=this.currentPanel.parentElement,n=this.labels.firstChild,o=n.children,i=this.currentPanel.parentElement.childNodes;this.activePanelIndex=Ur(this.currentPanel,e);let r={nav:0,panel:0},s={...r};t.groupChange=t=>(this.activePanelIndex=t,this.currentPanel=i[t],qd.removeClasses(i,"active-panel"),qd.removeClasses(o,"active-tab"),this.currentPanel.classList.add("active-panel"),o[t].classList.add("active-tab"),this.currentPanel);const a=({offset:t,reset:o,duration:i=U,animate:r=!this.isTabbed})=>{const a=[Tc(s.panel),Tc(t.panel)],l=[Tc(s.nav),Tc(this.isTabbed?0:t.nav)];if(o){const[t]=a,[e]=l;a.push(t),l.push(e)}const c={easing:"ease-in-out",duration:r?i:0,fill:"forwards"},d=e.animate(a,c);n.animate(l,c);const u=()=>{this.panelsWrap.style.height=qd.getStyle(this.currentPanel,"height"),d.removeEventListener("finish",u),o||(s=t)};d.addEventListener("finish",u)};return t.setTranslateX=(t=this.activePanelIndex,o=!0)=>{var i;i=t,r={nav:-n.offsetWidth*i,panel:-e.offsetWidth*i},a({offset:r,animate:o})},t.refresh=(e=this.activePanelIndex)=>{this.activePanelIndex!==e&&t.groupChange(e),t.setTranslateX(this.activePanelIndex,!1),this.resizePanels()},t.nextGroup=()=>{const e=this.activePanelIndex+1;if(e!==i.length){const o=i[e];r={nav:-n.offsetWidth*e,panel:-o.offsetLeft},a({offset:r}),t.groupChange(e)}else r={nav:s.nav-8,panel:s.panel-8},a({offset:r,reset:!0});return this.currentPanel},t.prevGroup=()=>{if(0!==this.activePanelIndex){const e=this.activePanelIndex-1,o=i[e];r={nav:-n.offsetWidth*e,panel:-o.offsetLeft},a({offset:r}),t.groupChange(e)}else r={nav:8,panel:8},a({offset:r,reset:!0})},t}}const Lc="a an and as at but by for for from in into near nor of on onto or the to with".split(" ").map((t=>`\\s${t}\\s`)),Dc=new RegExp(`(?!${Lc.join("|")})\\w\\S*`,"g"),kc=/\s+/g;function $c(t){if("string"!=typeof t)return t;if(t.trim().match(kc))return t;return t.replace(Dc,(t=>t.charAt(0).toUpperCase()+t.substring(1).replace(/[A-Z]/g,(t=>` ${t}`))))}const Ic=(t,e="-")=>t.toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,e),Mc="f-autocomplete",Rc="highlight-component",Fc=({name:t,id:e,...n})=>["config.label","config.controlId","meta.id","attrs.id"].reduce(((t,e)=>t||n.get(e)),null)||"external"===t&&((...t)=>r.get(t.join("."))||$c(t.join(" ")))(t,e);class Wc{constructor(t,e,o){n(this,"lastCache",Date.now()),n(this,"optionsCache",null),this.key=t,this.className=t.replace(/\./g,"-"),this.value=e,this.events=[],this.i18nKey=o,this.build()}build(){const t=t=>{const e=this.list,n=this.getActiveOption();let o=new Map([[38,()=>{const t=this.getPreviousOption(n);t&&this.selectOption(t)}],[40,()=>{const t=this.getNextOption(n);t&&this.selectOption(t)}],[13,()=>{n&&(this.selectOption(n),this.setValue(n),"none"===e.style.display?this.showList(n):this.hideList()),t.preventDefault()}],[27,()=>{this.hideList()}]]).get(t.keyCode);return o||(o=()=>!1),o()},e={focus:({target:e})=>{this.updateOptions(),e.parentElement.classList.add(`${this.className}-focused`);const n=qd.toggleElementsByStr(this.list.querySelectorAll("li"),e.value);e.addEventListener("keydown",t);const o=this.list.querySelector(".active-option")||n[0];this.showList(o)},blur:({target:e})=>{e.parentElement.classList.remove(`${this.className}-focused`),e.removeEventListener("keydown",t),this.hideList()},input:t=>{const e=qd.toggleElementsByStr(this.list.querySelectorAll("li"),t.target.value);if(0===t.target.value.length&&this.clearValue(),0===e.length)this.hideList();else{const t=this.getActiveOption()||e[0];this.showList(t)}const n=t.target.value.trim();this.hiddenField.value=n,this.value=n,this.setValue({dataset:{label:n,value:n}})}};return this.displayField=qd.create({tag:"input",autocomplete:"off",action:e,attrs:{type:"text",className:`${Mc}-display-field`,value:this.label||this.value,placeholder:r.get(`${this.i18nKey}.${this.key}.placeholder`)}}),this.hiddenField=qd.create({tag:"input",attrs:{type:"hidden",className:this.className,value:this.value}}),this.list=qd.create({tag:"ul",attrs:{className:`${Mc}-list`}}),this.dom=qd.create({children:[this.displayField,this.hiddenField],className:this.className,action:{onRender:t=>{this.stage=t.closest(".formeo-stage");const e=this.value&&Wd.getAddress(this.value);this.label=e&&Fc(e),this.label&&(this.displayField.value=this.label)}}}),this.dom}updateOptions(){let t=this.optionsCache;const e=Date.now();(!t||e-this.lastCache>10*H)&&(qd.empty(this.list),t=this.generateOptions(),this.lastCache=e),this.list.children.length||this.list.append(...t)}generateOptions(){const t=(t=>{const e=[],n=Wd.flatList(),o=Object.entries(n).map((([n,o])=>{const i=Fc(o);if(i){const r={tag:"span",content:` ${$c(o.name)}`,className:"component-type"},s=`${o.name}.${i}`;e.push(s);const a=((t,e)=>{const n=t.reduce(((t,n)=>t+(n===e)),0);return n>1?`(${n})`:""})(e,s),l=[`${i} `,{tag:"span",content:a,className:"component-label-count"},r];return(({id:t,textLabel:e,htmlLabel:n,selectedId:o})=>{const i={value:t,textLabel:e,htmlLabel:n};return t===o&&(i.selected=!0),i})({id:n,textLabel:[i,a].join(" ").trim(),htmlLabel:l,selectedId:t})}}));return o.filter(Boolean)})(),e=t=>{const e=`${Mc}-list-item`;return t.classList.contains(e)||(t=t.parentElement),t};return this.optionsCache=t.map((t=>{const{value:n,textLabel:o,htmlLabel:i}=t,r={tag:"li",children:i,dataset:{value:n,label:o},className:`${Mc}-list-item`,action:{mousedown:({target:t})=>{t=e(t),this.setValue(t),this.selectOption(t),this.hideList()},mouseover:({target:t})=>{t=e(t),this.removeHighlight(),this.highlightComponent(t)}}};return qd.create(r)})),this.optionsCache}setListPosition(){const{offsetHeight:t,offsetWidth:e}=this.displayField,n=this.displayField.closest(".formeo-stage").getBoundingClientRect(),o=this.displayField.getBoundingClientRect(),i={position:"absolute",top:o.y+t+window.scrollY-n.y+"px",left:o.x+window.scrollX-n.x+"px",width:`${e+1}px`};Object.assign(this.list.style,i)}showList(t,e=this.list){this.stage.contains(this.list)||this.stage.appendChild(this.list),this.setListPosition(),this.selectOption(t),Kr.slideDown(e,U)}hideList(t=this.list){Kr.slideUp(t,U),this.removeHighlight(),this.stage.contains(this.list)&&this.stage.removeChild(this.list)}getActiveOption(t=this.list){const e=t.querySelector(".active-option");return"none"!==(null==e?void 0:e.style.display)?e:null}getPreviousOption(t){let e=t;do{e=e?e.previousSibling:null}while(null!=e&&"none"===e.style.display);return e}getNextOption(t){let e=t;do{e=e?e.nextSibling:null}while(null!=e&&"none"===e.style.display);return e}selectOption(t,e=this.list){var n;const o=e.querySelectorAll("li");for(const i of o){const{dataset:{value:t}}=i;if(i.classList.remove("active-option"),t){null==(n=Wd.getAddress(t).dom)||n.classList.remove(Rc)}}t&&(t.classList.add("active-option"),this.highlightComponent(t))}removeHighlight(){const t=document.getElementsByClassName(Rc);for(const e of t)e.classList.remove(Rc)}highlightComponent(t){var e;const{dataset:{value:n}}=t;if(n){null==(e=Wd.getAddress(n).dom)||e.classList.add(Rc)}}clearValue(){this.selectOption(null),this.displayField.value="",this.hiddenField.value="",this.value="",this.runEvent("onChange",{target:this.hiddenField})}setValue(t){const{label:e,value:n}=t.dataset;this.displayField.value=e,this.hiddenField.value=n,this.value=n,this.runEvent("onChange",{target:this.hiddenField})}addEvent(t,e){this.events.push([t,e])}runEvent(t,e){for(const[n,o]of this.events)n===t&&o(e)}}const Bc=(t,e)=>{const n=(t=>{const e=Ji(t),n={"field.property":Z,...J},o=e?(i=t,Wd.getAddress(i).getData()):n[t];var i;return Object.keys(o).reduce(((t,e)=>(t[e]=e,t)),{})})(t);return Object.entries(n).reduce(((n,[o,i])=>{if("id"!==o){const s={tag:"option",content:r.get(`${t}.${o}`)||o.toLowerCase(),attrs:{value:i}};e===i&&(s.attrs.selected=!0),n.push(qd.create(s))}return n}),[])},zc=(t,e)=>{qd.empty(t);for(const n of e)t.add(n)},qc=({key:t,value:e,type:n="text",checked:o})=>{const i={tag:"input",attrs:{type:n,value:e,placeholder:r.get(`${t}.placeholder`)||$c(t)},className:t.replace(/\./g,"-"),config:{}};return o&&(i.attrs.checked=!0),i},Uc=t=>{const e=r.get(t);if(e)return e;const n=t.split(".");return r.get(n[n.length-1])},Hc={autocomplete:(t,e,n)=>new Wc(t,e,n),string:(t,e)=>qc({key:t,value:e}),boolean:(t,e)=>qc({key:t,value:e,type:"selected"===t?"radio":"checkbox",checked:e}),number:(t,e)=>qc({key:t,value:e,type:"number"}),array:(t,e=[])=>({tag:"select",attrs:{placeholder:Uc(`placeholder.${t}`)},className:t.replace(/\./g,"-"),options:e}),object:t=>Object.entries(t).map((([t,e])=>Hc[qd.childType(e)](t,e)))},Xc=["selected","checked"],Vc={boolean:(t,e)=>({click:({target:{checked:n}})=>{var o,i;"radio"===(null==(i=null==(o=e.data)?void 0:o.attrs)?void 0:i.type)&&e.set("options",e.data.options.map((t=>({...t,selected:!1})))),e.set(t,n)}}),string:(t,e)=>({input:({target:{value:n}})=>{e.set(t,n)}}),number:(t,e)=>({input:({target:{value:n}})=>{e.set(t,Number(n))}}),array:(t,e)=>({change:({target:{value:n}})=>{e.set(t,n)}}),object:()=>({})};class Yc{constructor({key:t,data:e,index:o,field:i}){n(this,"generateConditionFields",((t,e)=>{const n={tag:"label",className:`condition-label ${t}-condition-label`,content:r.get(t)||t};return e.map(((e,o)=>{const i=[],r=Object.entries(e).map((([e,n])=>{const r=this.conditionInput(e,n,t,o);return r&&i.push([r.className,n.trim()].filter(Boolean).join("-")),r})).filter(Boolean),s=Hr(r,G.map((t=>`condition-${t}`)),"className||dom.className");return this.processConditionUIState(s),o||s.unshift(n),this.itemFieldGroups.push(s),{children:s,className:`f-condition-row ${t}-condition-row ${i.join(" ")}`}}))})),n(this,"processConditionUIState",(t=>{const e=e=>(e=e.split("|"),t.filter((t=>e.includes(t.className)))),n=t=>{t=Array.isArray(t)?t:[t];const e=setTimeout((()=>{t.forEach((t=>{t.dom&&(t=t.dom),t.style.display="none"})),clearTimeout(e)}),q)},o=t=>{t=Array.isArray(t)?t:[t];const e=setTimeout((()=>{t.forEach((t=>{t.dom&&(t=t.dom),t.removeAttribute("style")})),clearTimeout(e)}),q)},i=new Map([["condition-source",t=>{const i=e("condition-sourceProperty"),r=i[0],s=Ji(t.value)?t.value:"field.property",a=Bc(s,r.value);return zc(r,a),t.value?o(i):n(i)}],["condition-target",t=>{const i=e("condition-targetProperty");return Zi(t.value)&&t.value?o(i):n(i)}],["condition-sourceProperty",t=>{const i=e("condition-comparison|condition-targetProperty|condition-target"),r=t.value;return(t=>/^is|^has/.test(t))(r.substring(r.lastIndexOf(".")+1,r.length))?n(i):o(i)}]]);for(const r of t){const t=i.get(r.className);t&&t(r)}})),n(this,"conditionInput",((t,e,n,o)=>{const i=this.field,r=`${this.itemKey}.${n}.${o}`,s=`${this.field.id}.${r}`,a=`${i.name}s.${s}.${t}`,l=(t,e,n)=>{const o=Bc(n||t,e),i=Hc.array(`condition.${t}`);i.action={change:c,onRender:t=>c({target:t})};const r=qd.create(i);return zc(r,o),r},c=({target:t})=>{const e=t.closest(".f-condition-row"),n=new RegExp(`${t.className}(?:\\S?)+`,"gm");e.className=e.className.replace(n,"");const o={dataPath:a,value:t.value,src:t};ns.formeoUpdated(o),Wd.setAddress(a,t.value);const i=Ur(e);this.processConditionUIState(this.itemFieldGroups[i])},d={comparison:t=>l("comparison",t),logical:t=>l("logical",t),source:(t,e="source")=>{const o=Hc.autocomplete(`condition.${e}`,t,n);return Wd.setConditionMap(t,i),o.addEvent("onChange",(t=>{Wd.removeConditionMap(Wd.getAddress(a)),c(t),Wd.setConditionMap(t.target.value,i)})),o},sourceProperty:t=>l("sourceProperty",t,"field.property"),targetProperty:t=>l("targetProperty",t,"field.property"),target:t=>d.source(t,"target"),value:t=>{const e=Hc.string("condition.value",t);return e.action={input:c},qd.create(e)},assignment:t=>l("assignment",t)};if(d[t])return d[t](e)})),this.itemValues=Hr(Object.entries(e),Xc,"0");const[s,a]=t.split(".");this.field=i,this.itemKey=t,this.itemIndex=o,this.panelName=s,this.isDisabled=i.isDisabledProp(a,s),this.isHidden=this.isDisabled&&i.config.panels[s].hideDisabled,this.isLocked=i.isLockedProp(a,s),this.dom=qd.create({tag:"li",className:[`field-${t.replace(/\./g,"-")}`,"prop-wrap",this.isHidden&&"hidden-property"],children:{className:"field-prop",children:[this.itemInputs,this.itemControls]}})}get itemInputs(){this.itemFieldGroups=[];return{className:`${this.panelName}-prop-inputs prop-inputs f-input-group`,children:this.itemValues.map((([t,e])=>{let n="conditions"===this.panelName?this.generateConditionFields(t,e):this.itemInput(t,e);return["selected","checked"].includes(t)&&(n={className:"f-addon",children:n}),n}))}}get itemControls(){if(this.isLocked){return{className:`${this.panelName}-prop-controls prop-controls`,content:[]}}const t={tag:"button",attrs:{type:"button",className:"prop-remove prop-control"},action:{click:()=>{Kr.slideUp(this.dom,250,(t=>{this.field.remove(this.itemKey),qd.remove(t),this.field.resizePanelWrap()}))}},content:qd.icon("remove")};return{className:`${this.panelName}-prop-controls prop-controls`,content:[t]}}itemInput(t,e){const n=qd.childType(e)||"string",o={config:{},attrs:{},...Hc[n](t,e)},i=this.itemKey.replace(/.\d+$/,(e=>`${e}.${t}`)),r=i.split(".").filter(Number.isNaN).join(".")||t,[s,a]=[[...this.itemKey.split("."),t],[t]].map((t=>[this.field.id,...t].filter(Boolean).join("-")));return o.config={...o.config,label:"options"!==this.panelName&&(Uc(r)||$c(r)),labelAfter:!1},o.attrs={...o.attrs,name:"checkbox"===o.attrs.type?`${a}[]`:a,id:s,disabled:this.isDisabled,locked:this.isLocked},o.action={...Vc[n](i,this.field)},o}}class Gc{constructor(t,e,o){n(this,"addAttribute",((t,e)=>{let n=e;const o=Ic(t),i=`attrs.${o}`;r.current[i]||r.put(i,Gr(t)),"string"==typeof n&&["true","false"].includes(n)&&(n=JSON.parse(n)),this.field.set(`attrs.${t}`,n);const s=this.props.querySelector(`.field-attrs-${o}`),a=new Yc({key:i,data:{[o]:n},field:this.field});s?this.props.replaceChild(a.dom,s):this.props.appendChild(a.dom),this.field.resizePanelWrap()})),n(this,"addOption",(()=>{const t=this.field.data.config.controlId,e=this.field.get("options"),n="select"===t?"option":t,o=r.get("newOptionLabel",{type:n})||"New Option",i=`options.${this.data.length}`,s=e[e.length-1],a={...e.length?s:{},label:o};"button"!==t&&(a.value=Ic(o));const l=new Yc({key:i,data:a,field:this.field,index:this.props.children.length});this.editPanelItems.push(l),this.props.appendChild(l.dom),this.field.set(i,a),this.field.resizePanelWrap()})),n(this,"addCondition",(t=>{const e=`conditions.${this.field.get("conditions").length}`,n=this.props.querySelector(`.field-${e.replace(".","-")}`),o=new Yc({key:e,data:t.template,field:this.field});n?this.props.replaceChild(o.dom,n):this.props.appendChild(o.dom),this.field.set(e,t.template),this.field.resizePanelWrap()})),this.type=qd.childType(t),this.data="object"===this.type?Object.entries(t):t,this.name=e,this.field=o,this.panelConfig=this.getPanelConfig(this.data)}getPanelConfig(t){return this.props=this.createProps(t),this.editButtons=this.createEditButtons(),{id:`${this.field.id}-${this.name}-panel`,config:{label:r.get(`panel.label.${this.name}`)},attrs:{className:`f-panel ${this.name}-panel`},children:[this.props,this.editButtons]}}createProps(t){this.editPanelItems=Array.from(t).map(((t,e)=>{const n="array"===this.type,o=[this.name,n?String(e):t[0]].join("."),i=n?t:{[t[0]]:t[1]};return new Yc({key:o,data:i,field:this.field})}));const e={tag:"ul",attrs:{className:["field-edit-group",`field-edit-${this.name}`]},editGroup:this.name,isSortable:"options"===this.name,content:this.editPanelItems};return qd.create(e)}createEditButtons(){const t=this,e=this.name,n=r.get(`panelEditButtons.${e}`),o={attrs:t.addAttribute,options:t.addOption,conditions:t.addCondition};return{className:"panel-action-buttons",content:[{...qd.btnTemplate({content:n,title:n}),className:`add-${e}`,action:{click:n=>{const i={btnCoords:qd.coords(n.target),addAction:o[e]};"attrs"===e&&(i.isDisabled=t.field.isDisabledProp,i.isLocked=t.field.isLockedProp,i.message={attr:r.get(`action.add.${e}.attr`),value:r.get(`action.add.${e}.value`)});const s=$c(e),a=new window.CustomEvent(`onAdd${s}`,{detail:i});Ac.add[e](i),document.dispatchEvent(a)}}}]}}}class Zc extends xa{constructor(t,e={},o){const i={...e,id:e.id||Ui()};super(t,i),n(this,"mutationHandler",(t=>t.map((t=>{})))),n(this,"remove",(t=>{if(t){const e=t.split("."),n=e.pop(),o=this.get(e);return Array.isArray(o)?qr(n)?o.splice(Number(n),1):this.set(e,o.filter((t=>t!==n))):delete o[n],o}if("stage"===this.name)return null;const e=this.parent,n=this.children;return Xr(n,(t=>t.remove())),this.dom.parentElement.removeChild(this.dom),((t,e)=>{const n=t.indexOf(e);-1!==n&&t.splice(n,1)})(Wd.getAddress(`${e.name}s.${e.id}.children`),this.id),e.children.length||e.emptyClass(),"row"===e.name&&e.autoColumnWidths(),Wd[`${this.name}s`].delete(this.id)})),n(this,"emptyClass",(()=>this.dom.classList.toggle("empty",!this.children.length))),n(this,"getComponentTag",(()=>qd.create({tag:"span",className:["component-tag",`${this.name}-tag`],children:[(this.isColumn||this.isField)&&qd.icon("component-corner",{className:"bottom-left"}),qd.icon(`handle-${this.name}`),$c(this.name),(this.isColumn||this.isRow)&&qd.icon("component-corner",{className:"bottom-right"})].filter(Boolean)}))),n(this,"removeClasses",(t=>{const e={string:()=>this.dom.classList.remove(t),array:()=>t.map((t=>this.dom.classList.remove(t)))};return e.object=e.string,e[qd.childType(t)](this.dom)})),n(this,"loadChildren",((t=this.data.children)=>t.map((t=>this.addChild({id:t}))))),n(this,"saveChildOrder",(()=>{if(this.render)return;const t=this.children.map((({id:t})=>t));return this.set("children",t),t})),n(this,"onSort",(()=>this.saveChildOrder())),n(this,"onEnd",(({to:{parentElement:t},from:{parentElement:e}})=>{null==t||t.classList.remove(`hovering-${zi(t)}`),null==e||e.classList.remove(`hovering-${zi(e)}`)})),n(this,"runConditions",(()=>{const t=this.get("conditions");if(!(null==t?void 0:t.length))return null;return t.map((t=>{const e=this.processConditions(t.if),n=this.processResults(t.then);return e.map((t=>this.evaluateConditions(t)&&this.execResults(n)))}))})),n(this,"value",((t,e)=>{const n=t.split("."),o=this.getComponent(t),i=o&&n.slice(2,n.length).join(".");return[!o,!i,!Z[i]].some(Boolean)?t:e?o.set(Z[i],e):o.get(Z[i])})),n(this,"getResult",(t=>({"=":(t,e,n)=>t.set(e,n)}[t]))),n(this,"processResults",(t=>t.map((({operator:t,target:e,value:n})=>{const o=this.getComponent(e);return{target:o,propertyPath:o&&e.split(".").slice(2,e.length).join("."),action:this.getResult(t),value:this.value(n)}})))),n(this,"execResults",(t=>{const e=t.map((t=>this.execResult(t)));return Promise.all(e)})),n(this,"execResult",(({target:t,action:e,value:n,propertyPath:o})=>new Promise(((o,i)=>{try{return o(e(t,n))}catch(r){return i(r)}})))),n(this,"cloneData",(()=>{const t={...Xi(this.data),id:Ui()};return"field"!==this.name&&(t.children=[]),t})),n(this,"clone",((t=this.parent)=>{const e=t.addChild(this.cloneData(),this.index+1);return"field"!==this.name&&this.cloneChildren(e),e})),n(this,"createChildWrap",(t=>qd.create({tag:"ul",attrs:{className:"children"},children:t}))),this.id=i.id,this.name=t,this.config=Wd[`${this.name}s`].config,Hi(this.config,i.config),this.dataPath=`${this.name}s.${this.id}.`,this.observer=new window.MutationObserver(this.mutationHandler),this.render=o}observe(t){this.observer.disconnect(),this.observer.observe(t,{childList:!0})}get js(){return this.data}get json(){return this.data}empty(){const t=this.children.map((t=>{t.remove()}));return this.dom.classList.add("empty"),t}getActionButtons(){const t=[`hovering-${this.name}`,"hovering"];return{className:[`${this.name}-actions`,"group-actions"],action:{mouseenter:()=>{Wd.stages.active.dom.classList.add(`active-hover-${this.name}`),this.dom.classList.add(...t)},mouseleave:({target:e})=>{this.dom.classList.remove(...t),Wd.stages.active.dom.classList.remove(`active-hover-${this.name}`),e.removeAttribute("style")}},children:[{...qd.btnTemplate({content:qd.icon(`handle-${this.name}`)}),className:["component-handle",`${this.name}-handle`]},{className:["action-btn-wrap",`${this.name}-action-btn-wrap`],children:this.buttons}]}}toggleEdit(t=!this.isEditing){this.isEditing=t;const e=this.dom,n="editing",o=`${n}-${this.name}`,i=this.dom.querySelector(`.${this.name}-edit`);Kr.slideToggle(i,q,t),"field"===this.name&&(Kr.slideToggle(this.preview,q,!t),e.parentElement.classList.toggle(`column-${o}`,t)),e.classList.toggle(n,t),e.classList.toggle(o,t)}get buttons(){if(this.actionButtons)return this.actionButtons;const t={handle:(t=`handle-${this.name}`)=>({...qd.btnTemplate({content:qd.icon(t)}),className:["component-handle"]}),move:(t="move")=>({...qd.btnTemplate({content:qd.icon(t)}),className:["item-move"],meta:{id:"move"}}),edit:(t="edit")=>({...qd.btnTemplate({content:qd.icon(t)}),className:["item-edit-toggle"],meta:{id:"edit"},action:{click:t=>{this.toggleEdit()}}}),remove:(t="remove")=>({...qd.btnTemplate({content:qd.icon(t)}),className:["item-remove"],meta:{id:"remove"},action:{click:(t,e)=>{Kr.slideUp(this.dom,q,(()=>{if("column"===this.name){this.parent.autoColumnWidths(),this.remove()}else this.remove()}))}}}),clone:(t="copy")=>({...qd.btnTemplate({content:qd.icon(t)}),className:["item-clone"],meta:{id:"clone"},action:{click:()=>{this.clone(this.parent),"column"===this.name&&this.parent.autoColumnWidths()}}})},{buttons:e,disabled:n}=this.config.actionButtons,o=e.filter((t=>!n.includes(t))).map((e=>{var n;return(null==(n=t[e])?void 0:n.call(t))||e}));return this.actionButtons=o,this.actionButtons}get index(){return Ur(this.dom)}get parentType(){return R.get(this.name)}get parent(){const t=this.parentType;if(!this.dom||!t)return null;const e=this.dom.closest(`.${P[t]}`);return e&&qd.asComponent(e)}get children(){if(!this.dom)return[];const t=this.domChildren,e=M.get(this.name);return Vr(t,(t=>Wd.getAddress(`${e}s.${t.id}`))).filter(Boolean)}get domChildren(){const t=this.dom.querySelector(".children");return t?t.children:[]}addChild(t={},e=this.domChildren.length){var n,o;let i=t;"object"!=typeof t&&(i={id:i});const r=this.dom.querySelector(".children"),{id:s=Ui()}=i,a=M.get(this.name);if(!a)return null;const l=`${a}s`,c=Wd.getAddress(`${l}.${s}`)||Wd[l].add(s,i);r.insertBefore(c.dom,r.children[e]),null==(o=null==(n=this.config.events)?void 0:n.onAddChild)||o.call(n,{parent:this,child:c});const d=c.get("children");return(null==d?void 0:d.length)&&c.loadChildren(d),this.removeClasses("empty"),this.saveChildOrder(),c}onAdd({from:t,to:e,item:n,newIndex:o}){var i;t.classList.contains(y)||(t=t.parentElement);const r=zi(t),s=zi(e.parentElement),a=new Map([[-2,()=>{const t=this.addChild({},o).addChild();return t.addChild.bind(t)}],[-1,()=>{const t=this.addChild({},o);return t.addChild.bind(t)}],[0,()=>this.addChild.bind(this)],[1,t=>{const e=Ur(this.dom);return()=>this.parent.addChild(t,e+1)}],[2,t=>()=>this.parent.parent.addChild(t)]]),l={controls:()=>{const{controlData:{meta:{id:t},...e}}=vd.get(n.id);zr(e,"config.controlId",t);const i=t.startsWith("layout-")?t.replace(/^layout-/,""):"field",r=Br({stage:{row:0,column:-1,field:-2},row:{row:1,column:0,field:-1},column:{row:2,column:1,field:0},field:1},`${this.name}.${i}`),s=a.get(r)();qd.remove(n);return s(e,o)},row:()=>{const t=(a.get({stage:-1,row:0,column:1}[s])||Qi)();return null==t?void 0:t({id:n.id},o)},column:()=>{const t=(a.get({stage:-2,row:-1}[s])||Qi)();return null==t?void 0:t(n.id)}},c=null==(i=l[r])?void 0:i.call(l,n,o);return(()=>{this.saveChildOrder(),this.removeClasses("empty")})(),c}onRemove({from:{parentElement:t}}){return t.classList.contains(E)&&t.classList.remove("column-editing-field"),"stage"===this.name||this.children.length?(this.emptyClass(),this.saveChildOrder()):this.remove()}onRender(){const{events:t}=this.config;if(!t)return null;t.onRender&&qd.onRender(this.dom,t.onRender)}set config(t){const e=Br(t,"all"),n=Br(this.data,"config.controlId"),o=[e,n&&Br(t,n),Br(t,this.id)].reduce(((t,e)=>e?Hi(t,e):t),this.configVal);this.configVal=o}get config(){return this.configVal}getComponent(t){const[e,n]=t.split("."),o=Wd[e];return n===this.id?this:null==o?void 0:o.get(n)}cloneChildren(t){for(const e of this.children)null==e||e.clone(t)}get isRow(){return this.name===j.row}get isColumn(){return this.name===j.column}get isField(){return this.name===j.field}}class Jc extends Zc{constructor(t=Object.create(null)){super("field",{conditions:[{if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]}],...t}),n(this,"updateConditionsPanel",Ki((()=>{const t=this.editPanels.find((({name:t})=>"conditions"===t));if(!t)return null;const e=t.createProps(),n=this.dom.querySelector(".field-edit-conditions");n.parentElement.replaceChild(e,n)}),q)),n(this,"updatePreview",(()=>{if(!this.preview.parentElement)return null;this.updateLabel();const t=qd.create(this.fieldPreview(),!0);this.preview.parentElement.replaceChild(t,this.preview),this.preview=t})),n(this,"updateEditPanels",(()=>{this.editPanels=[];const t=["object","array"],e=qi([...this.config.panels.order,...Object.keys(this.data)]),n=["config","meta","action","events",...this.config.panels.disabled],o=e.filter((t=>!n.includes(t)));for(const r of o){const e=this.get(r),n=qd.childType(e);if(t.includes(n)){const t=new Gc(e,r,this);this.editPanels.push(t)}}const i={panels:this.editPanels.map((({panelConfig:t})=>t)),id:this.id,displayType:"auto"};this.panels=new Pc(i),this.dom&&(this.dom.querySelector(".panel-nav").replaceWith(this.panels.panelNav),this.dom.querySelector(".panels").replaceWith(this.panels.panelsWrap))})),n(this,"toggleCheckedOptions",((t,e)=>{const n=this.get("options").map(((n,o)=>{const i=o===t;return"radio"===e?n.selected=i:n.checked=i?!n.checked:n.checked,n}));this.set("options",n)})),n(this,"isDisabledProp",((t,e="attrs")=>{const n=this.config.panels[e];if(!n)return!1;return n.disabled.concat(this.get(`config.disabled${$c(e)}`)).includes(t)})),n(this,"isLockedProp",((t,e="attrs")=>{const n=this.config.panels[e];if(!n)return!1;return n.locked.concat(this.get(`config.locked${$c(e)}`)).includes(t)})),this.debouncedUpdateEditPanels=function(t,e=333){let n;return function(...o){n&&clearTimeout(n),n=setTimeout((()=>t.apply(this,o)),e)}}(this.updateEditPanels),this.label=qd.create(this.labelConfig),this.preview=qd.create({}),this.editPanels=[];const e=this.getActionButtons(),o=this.actionButtons.some((t=>{var e;return"edit"===(null==(e=t.meta)?void 0:e.id)}));let i={tag:"li",attrs:{className:x},id:this.id,children:[this.label,this.getComponentTag(),e,o&&this.fieldEdit,this.preview].filter(Boolean),panelNav:this.panelNav,dataset:{hoverTag:r.get("field")}};i=qd.create(i),this.observe(i),this.dom=i,this.isEditing=!1,this.onRender(i)}get labelConfig(){if(!!this.get("config.hideLabel"))return null;const t=this.get("config.editorLabel")||this.get("config.label"),e=this.get("attrs.required"),n=this.config.label.disableHTML;return{className:"prev-label",children:[{...(()=>{const e={tag:"label",attrs:{}};return n?(e.tag="input",e.attrs.value=t,e):(e.attrs.contenteditable=!0,e.children=t,e)})(),action:{input:({target:{innerHTML:t,innerText:e,value:o}})=>{super.set("config.label",n?o:t);const i=Wd.getConditionMap(`fields.${this.id}`);if(i)return i.updateConditionSourceLabel(`${this.name}s.${this.id}`,n?o:e)}}},e&&qd.requiredMark()]}}updateConditionSourceLabel(t,e){const n=this.editPanels.find((({name:t})=>"conditions"===t));if(!n)return null;for(const{itemFieldGroups:o}of n.editPanelItems)for(const n of o){const o=n.find((e=>e.value===t));o&&(o.displayField.value=e)}}set(...t){const[e,n]=t,o=super.set(e,n);return this.updatePreview(),o}updateLabel(){if(!this.label)return null;const t=qd.create(this.labelConfig);this.label.parentElement.replaceChild(t,this.label),this.label=t}get fieldEdit(){const t={className:["field-edit","slide-toggle","formeo-panels-wrap"]};this.updateEditPanels();const e=this.editPanels.length;return e&&(t.className.push(`panel-count-${e}`),t.content=[this.panels.panelNav,this.panels.panelsWrap],this.panelNav=this.panels.nav,this.resizePanelWrap=this.panels.nav.refresh),t.action={onRender:()=>{if(0===e){const t=this.dom,e=t.querySelector(".item-edit-toggle"),n=t.querySelector(".field-actions"),o=n.getElementsByTagName("button");n.style.maxWidth=o.length*o[0].clientWidth+"px",qd.remove(e)}else this.resizePanelWrap()}},qd.create(t)}get defaultPreviewActions(){return{change:t=>{const{target:e}=t,{type:n}=e;if(["checkbox","radio"].includes(n)){const t=+e.id.split("-").pop();this.toggleCheckedOptions(t,n),this.debouncedUpdateEditPanels()}},click:t=>{"true"===t.target.contentEditable&&t.preventDefault()},input:t=>{if(["input","meter","progress","button"].includes(t.target.tagName.toLowerCase()))return super.set("attrs.value",t.target.value),this.debouncedUpdateEditPanels();if(t.target.contentEditable){const e=t.target.parentElement.classList;if(e.contains("f-checkbox")||e.contains("f-radio")){const e=t.target.parentElement,n=e.parentElement,o=Ur(e,n);return super.set(`options[${o}].label`,t.target.innerHTML),this.debouncedUpdateEditPanels()}super.set("content",t.target.innerHTML)}}}}fieldPreview(){var t;const e=Xi(this.data),{action:n={}}=vd.get(e.config.controlId);e.id=`prev-${this.id}`,e.action=n,(null==(t=this.data)?void 0:t.config.editableContent)&&(e.attrs={...e.attrs,contenteditable:!0});return{attrs:{className:"field-preview",style:this.isEditing&&"display: none;"},content:qd.create(e,!0),action:this.defaultPreviewActions}}}const Kc={js:new Set,css:new Set},Qc=(t,e,n=tr)=>new Promise((o=>fetch(t).then((t=>{if(!t.ok)return o(n(t));o(e?e(t):t)})).catch((t=>n(t))))),td=(t,e)=>{t.removeEventListener("load",td),e(t.src)},ed=(t,e)=>{t.removeEventListener("load",ed),e(t.src)},nd=t=>new Promise(((e,n)=>{if(Kc.js.has(t))return e(t);Kc.js.add(t);const o=qd.create({tag:"script",attrs:{type:"text/javascript",async:!0,src:t},action:{load:()=>ed(o,e),error:()=>n(new Error(`${t} failed to load.`))}});document.head.appendChild(o)})),od=t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>new Promise(((e,n)=>{if(Kc.css.has(t))return e(t);Kc.css.add(t);const o=qd.create({tag:"link",attrs:{rel:"stylesheet",href:t},action:{load:()=>td(o,e),error:()=>n(new Error(`${(void 0).src} failed to load.`))}});document.head.appendChild(o)}))));return Promise.all(e)},id=async(t=g)=>{if(document.getElementById(f))return;const e=async t=>(t=>{let e=document.getElementById(f);return e||(e=qd.create({id:f,children:t,attrs:{hidden:!0,style:"display: none;"}}),document.body.insertBefore(e,document.body.childNodes[0])),e})(await t.text());return Qc(t,e,(()=>Qc(v,e)))},rd={js:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>nd(t)));return Promise.all(e)},css:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>od(t)));return Promise.all(e)}},sd=t=>{const e=Object.entries(t).map((([t,e])=>rd[t](e)));return Promise.all(e)},ad=()=>{const t=document.getElementById(f);return"hidden"===window.getComputedStyle(t).visibility};class ld{constructor({events:t={},dependencies:e={},controlAction:o,...i}){n(this,"controlCache",new Set),this.events=t,this.controlData=i,this.controlAction=o,this.dependencies=e,this.id=i.id||Ui()}get controlId(){var t;return null==(t=this.controlData.meta)?void 0:t.id}get dom(){const{meta:t,config:e}=this.controlData,n=this.i18n(e.label)||e.label,o={tag:"button",attrs:{type:"button"},content:[{tag:"span",className:"control-icon",children:qd.icon(t.icon)},n],action:{focus:({target:t})=>{const e=t.closest(`.${y}`);return e&&vd.panels.nav.refresh(Ur(e))},click:({target:t})=>{vd.addElement(t.parentElement.id)}}};return qd.create({tag:"li",id:this.id,className:["field-control",`${t.group}-control`,`${t.id}-control`],content:o,meta:t,action:this.controlAction})}promise(){return sd(this.dependencies)}i18n(t,e){var n,o;const i=r.locale,s=null==(n=this.definition)?void 0:n.i18n,a=(null==s?void 0:s[i])||{};return((null==(o=a[t])?void 0:o.call(a))??a[t])||r.get(t,e)}}const cd=[{config:{label:"row"},meta:{group:"layout",icon:"rows",id:"layout-row"}},{config:{label:"column"},meta:{group:"layout",icon:"columns",id:"layout-column"}}];const dd=(t,e=3)=>Array.from({length:e},((t,e)=>e+1)).map((e=>{const n="checkbox"===t?"checked":"selected";return{label:r.get("labelCount",{label:$c(t),count:e}),value:`${t}-${e}`,[n]:!e}}));const ud=[class extends ld{constructor(){super({tag:"button",attrs:{className:[{label:"grouped",value:"f-btn-group"},{label:"ungrouped",value:"f-field-group"}]},config:{label:r.get("controls.form.button"),hideLabel:!0},meta:{group:"common",icon:"button",id:"button"},options:[{label:r.get("button"),type:["button","submit","reset"].map((t=>({label:t,type:t}))),className:[{label:"default",value:"",selected:!0},{label:"primary",value:"primary"},{label:"danger",value:"error"},{label:"success",value:"success"},{label:"warning",value:"warning"}]}]})}},class extends ld{constructor(){super({tag:"input",attrs:{type:"date",required:!1,className:""},config:{label:r.get("controls.form.input.date")},meta:{group:"common",icon:"calendar",id:"date-input"}})}},class extends ld{constructor(){super({tag:"input",attrs:{type:"hidden",value:""},config:{label:r.get("hidden"),hideLabel:!0},meta:{group:"common",icon:"hidden",id:"hidden"}})}},class extends ld{constructor(){super({tag:"input",attrs:{type:"number",required:!1,className:""},config:{label:r.get("number")},meta:{group:"common",icon:"hash",id:"number"}})}},class extends ld{constructor(){super({tag:"textarea",config:{label:r.get("controls.form.textarea")},meta:{group:"common",icon:"textarea",id:"textarea"},attrs:{required:!1}})}},class extends ld{constructor(){super({tag:"input",attrs:{required:!1,type:"text",className:""},config:{label:r.get("controls.form.input.text")},meta:{group:"common",icon:"text-input",id:"text-input"}})}},class extends ld{constructor(){super({tag:"input",attrs:{type:"file",required:!1},config:{label:r.get("fileUpload")},meta:{group:"common",icon:"upload",id:"upload"}})}},class extends ld{constructor(){super({tag:"select",config:{label:r.get("controls.form.select")},attrs:{required:!1,className:""},meta:{group:"common",icon:"select",id:"select"},options:dd("option")})}},class extends ld{constructor(){super({tag:"input",attrs:{type:"checkbox",required:!1},config:{label:r.get("controls.form.checkbox-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"checkbox",id:"checkbox"},options:dd("checkbox",1)})}},class extends ld{constructor(){super({tag:"input",attrs:{type:"radio",required:!1},config:{label:r.get("controls.form.radio-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"radio-group",id:"radio"},options:dd("radio")})}}],hd=Array.from(Array(5).keys()).slice(1).map((t=>`h${t}`)),pd="controls.html.header";const fd=[class extends ld{constructor(){super({tag:hd[0],attrs:{tag:hd.map(((t,e)=>({label:t.toUpperCase(),value:t,selected:!e}))),className:""},config:{label:r.get(pd),hideLabel:!0,editableContent:!0},meta:{group:"html",icon:"header",id:"html.header"},content:r.get(pd),action:{}})}static get definition(){return{i18n:{"en-US":{header:"Custom English Header"}}}}get content(){return super.i18n(pd)}},class extends ld{constructor(){super({tag:"p",attrs:{className:""},config:{label:r.get("controls.html.paragraph"),hideLabel:!0,editableContent:!0},meta:{group:"html",icon:"paragraph",id:"paragraph"},content:"Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment."})}},class extends ld{constructor(){super({tag:"hr",config:{label:r.get("controls.html.divider"),hideLabel:!0},meta:{group:"html",icon:"divider",id:"divider"}})}},class extends ld{constructor(t){super(Hi({tag:"textarea",config:{label:"WYSIWYG",editableContent:!0},meta:{group:"html",icon:"rich-text",id:"tinymce"},attrs:{required:!1},dependencies:{js:"https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.9.11/tinymce.min.js"},action:{onRender:t=>{const e=`#${t.id}`;window.tinymce.remove(e),window.tinymce.init({selector:e})}},controlAction:{click:()=>{},onRender:()=>{}}},t))}}],md=Object.freeze({sortable:!0,elementOrder:{},groupOrder:[],groups:[{id:"layout",label:"controls.groups.layout",elementOrder:["row","column"]},{id:"common",label:"controls.groups.form",elementOrder:["button","checkbox"]},{id:"html",label:"controls.groups.html",elementOrder:["header","block-text"]}],disable:{groups:[],elements:[],formActions:[]},elements:[],container:null,panels:{displayType:"slider"}}),gd=[...ud,...fd,...cd];const vd=new class{constructor(){n(this,"groupLabel",(t=>r.get(t)||t||"")),n(this,"layoutTypes",{row:()=>Dd.active.addChild(),column:()=>this.layoutTypes.row().addChild(),field:t=>this.layoutTypes.column().addChild(t)}),n(this,"addElement",(t=>{const{meta:{group:e,id:n},...o}=Br(this.get(t),"controlData");return zr(o,"config.controlId",n),"layout"===e?this.layoutTypes[n.replace("layout-","")]():this.layoutTypes.field(o)})),n(this,"applyOptions",(async(t={})=>{const{container:e,elements:n,groupOrder:o,...i}=Hi(md,t);return this.container=e,this.groupOrder=qi(o.concat(["common","html","layout"])),this.options=i,Promise.all(this.registerControls([...gd,...n]))})),this.data=new Map,this.buttonActions={focus:({target:t})=>{const e=t.closest(`.${y}`);return e&&this.panels.nav.refresh(Ur(e))},click:({target:t})=>{this.addElement(t.parentElement.id)}}}async init(t,e=!1){return await this.applyOptions(t),this.buildDOM(e),this}registerControls(t){return this.controls=[],t.map((async t=>{let e;return e="function"==typeof t?new t:new ld(t),this.add(e),this.controls.push(e.dom),e.promise()}))}groupElements(){let t=this.options.groups.slice(),e=this.controls.slice(),n=[];const o=[];return t=Hr(t,this.groupOrder,"id"),t=t.filter((t=>Bi(t.id,this.options.disable.groups))),n=t.map((t=>{const n={tag:"ul",attrs:{className:y,id:`${t.id}-${y}`},config:{label:this.groupLabel(t.label)}};if(this.options.elementOrder[t.id]){const e=this.options.elementOrder[t.id],n=qi(e.concat(t.elementOrder));t.elementOrder=n}return e=Hr(e,t.elementOrder,"meta.id"),n.content=e.filter((e=>{const{controlData:n}=this.get(e.id),i=n.meta.id||"";let r=!0;return r=[Bi(i,this.options.disable.elements),n.meta.group===t.id,!o.includes(i)].every((t=>!0===t)),r&&o.push(i),r})),n})),n}add(t=Object.create(null)){const e=Xi(t);return this.data.set(e.id,e),e.controlData.meta.id&&this.data.set(e.controlData.meta.id,e.controlData),e}get(t){return Xi(this.data.get(t))}formActions(){if(!0===this.options.disable.formActions)return null;const t={...qd.btnTemplate({content:[qd.icon("bin"),r.get("clear")],title:r.get("clearAll")}),className:["clear-form"],action:{click:t=>{kd.size?(ns.confirmClearAll=new window.CustomEvent("confirmClearAll",{detail:{confirmationMessage:r.get("confirmClearAll"),clearAllAction:()=>{Dd.clearAll().then((()=>{const e={src:t.target};ns.formeoCleared(e)}))},btnCoords:qd.coords(t.target)}}),document.dispatchEvent(ns.confirmClearAll)):window.alert(r.get("cannotClearFields"))}}},e={...qd.btnTemplate({content:[qd.icon("floppy-disk"),r.get("save")],title:r.get("save")}),className:["save-form"],action:{click:({target:t})=>{const{formData:e}=Wd,n={action:()=>{},coords:qd.coords(t),message:"",button:t};return Ac.click.btn(n),Ac.save.form(e)}}};return{className:"form-actions f-btn-group",content:Object.entries({clearBtn:t,saveBtn:e}).reduce(((t,[e,n])=>(this.options.disable.formActions.includes(e)||t.push(n),t)),[])}}buildDOM(t){const e=this.groupElements(),n=this.formActions(),{displayType:o}=this.options.panels;this.panels=new Pc({panels:e,type:"controls",displayType:o});const i=["control-groups","formeo-panels-wrap",`panel-count-${e.length}`],s=qd.create({className:i,content:[this.panels.panelNav,this.panels.panelsWrap]}),a=["formeo-controls"];t&&a.push("formeo-sticky");const l=qd.create({className:a,content:[s,n]}),c=l.getElementsByClassName("control-group");this.dom=l,this.groups=c;const[d]=c;this.currentGroup=d,this.actions={filter:t=>{const e=""!==t,n=this.controls;let o=s.querySelector(".filtered-term");if(qd.toggleElementsByStr(n,t),e){const e=r.get("controls.filteringTerm",t);l.classList.add("filtered"),o?o.textContent=e:(o=qd.create({tag:"h5",className:"filtered-term",content:e}),s.insertBefore(o,s.firstChild))}else o&&(l.classList.remove("filtered"),o.remove())},addElement:this.addElement,addGroup:t=>{}};for(let r=c.length-1;r>=0;r--){const t=`formeo-controls-${c[r]}`;this.options.sortable||window.localStorage.removeItem(t),sc.create(c[r],{animation:150,forceFallback:!0,fallbackClass:"control-moving",fallbackOnBody:!0,group:{name:"controls",pull:"clone",put:!1},onStart:({item:t})=>{const{controlData:e}=this.get(t.id);this.options.ghostPreview&&(t.innerHTML="",t.appendChild(new Jc(e).preview))},onEnd:({from:t,item:e,clone:n})=>{t.contains(n)&&t.replaceChild(e,n)},sort:this.options.sortable,store:{get:()=>{const e=window.localStorage.getItem(t);return e?e.split("|"):[]},set:e=>{const n=e.toArray();window.localStorage.setItem(t,n.join("|"))}}})}return l}};class bd extends xa{constructor(){super(...arguments),n(this,"load",(t=>{const e=er(t);this.empty();for(const[n,o]of Object.entries(e))this.add(n,o);return this.data})),n(this,"get",(t=>t?Br(this.data,t):this.add())),n(this,"add",((t,e=Object.create(null))=>{const n=t||Ui(),o=this.Component({...e,id:n});return this.set(n,o),this.active=o,o})),n(this,"remove",(t=>{if(Array.isArray(t))for(const e of t)this.get(e).remove();else this.get(t).remove();return this.data})),n(this,"delete",(t=>(delete this.data[t],t))),n(this,"clearAll",((t=!0)=>{const e=Object.values(this.data).map((e=>e.empty(t)));return Promise.all(e)})),n(this,"conditionMap",new Map)}set config(t){this.configVal=Hi(this.configVal,Xi(t))}get config(){return this.configVal}}class yd extends Zc{constructor(t,e){super("stage",{...Object.freeze({children:[]}),...t},e);const n=this.createChildWrap();this.dom=qd.create({attrs:{className:[w,"empty"],id:this.id},children:n}),sc.create(n,{animation:150,fallbackClass:"row-moving",forceFallback:!0,group:{name:"stage",pull:!0,put:["row","column","controls"]},sort:!0,disabled:!1,onAdd:this.onAdd.bind(this),onRemove:this.onRemove.bind(this),onStart:()=>{wd.active=this},onSort:this.onSort.bind(this),draggable:`.${C}`,handle:".item-move"})}empty(t=!0){return new Promise((e=>{t?(this.dom.classList.add("removing-all-fields"),Kr.slideUp(this.dom,q,(()=>{e(super.empty(t)),this.dom.classList.remove("removing-all-fields"),Kr.slideDown(this.dom,q)}))):e(super.empty())}))}onAdd(...t){const e=super.onAdd(...t);e&&"column"===e.name&&e.parent.autoColumnWidths()}}const wd=new class extends bd{constructor(t){super("stages",t)}Component(t){return new yd(t)}};class Cd extends Zc{constructor(t){super("row",{...Object.freeze({config:{fieldset:!1,legend:"",inputGroup:!1},children:[],className:[C]}),...t}),n(this,"autoColumnWidths",(()=>{const t=this.children;if(!t.length)return;const e=Number.parseFloat((100/t.length).toFixed(1))/1;for(const n of t){n.removeClasses(Q);const t=n.dom,o=Yi(e);n.set("config.width",o),t.style.width=o,t.dataset.colWidth=o;const i=setTimeout((()=>{clearTimeout(i),n.refreshFieldPanels()}),U);document.dispatchEvent(ns.columnResized)}this.updateColumnPreset()})),n(this,"updateColumnPreset",(()=>{this.columnPresetControl.innerHTML="";const t=this.getColumnPresetOptions.map((({label:t,...e})=>qd.create({tag:"option",content:t,attrs:e})));this.columnPresetControl.append(...t)})),n(this,"setColumnWidths",(t=>{"string"==typeof t&&(t=t.split(",")),this.children.forEach(((e,n)=>{e.setWidth(`${t[n]}%`),e.refreshFieldPanels()}))}));const e=this.createChildWrap();this.dom=qd.create({tag:"li",className:[C,"empty"],dataset:{hoverTag:r.get("row"),editingHoverTag:r.get("editing.row")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),this.editWindow,e]}),sc.create(e,{animation:150,fallbackClass:"column-moving",forceFallback:!0,group:{name:"row",pull:!0,put:["row","column","controls"]},sort:!0,disabled:!1,onRemove:this.onRemove.bind(this),onEnd:this.onEnd.bind(this),onAdd:this.onAdd.bind(this),onSort:this.onSort.bind(this),draggable:`.${E}`,handle:".item-move"})}get editWindow(){const t={tag:"input",id:`${this.id}-fieldset`,attrs:{type:"checkbox",checked:this.get("config.fieldset"),ariaLabel:r.get("row.settings.fieldsetWrap.aria")},action:{click:({target:{checked:t}})=>{this.set("config.fieldset",Boolean(t))}},config:{label:r.get("row.settings.fieldsetWrap")}},e={tag:"input",id:`${this.id}-inputGroup`,attrs:{type:"checkbox",checked:this.get("config.inputGroup"),ariaLabel:r.get("row.settings.inputGroup.aria")},action:{click:({target:{checked:t}})=>this.set("config.inputGroup",t)},config:{label:r.get("row.makeInputGroup"),description:r.get("row.makeInputGroupDesc")}},n={className:"input-group",content:{tag:"input",attrs:{type:"text",ariaLabel:"Legend for fieldset",value:this.get("config.legend"),placeholder:"Title"},config:{label:{children:["Row Title",{tag:"span",content:" ⓘ",dataset:{tooltip:"Row title will be used as the legend for the fieldset"}}]}},action:{input:({target:{value:t}})=>this.set("config.legend",t)},className:""}},o=qd.formGroup([t,n]),i={tag:"label",content:r.get("defineColumnWidths"),className:"col-sm-4 form-control-label"};this.columnPresetControl=qd.create(this.columnPresetControlConfig);const s={className:"col-sm-8",content:this.columnPresetControl,action:{onRender:()=>{this.updateColumnPreset()}}},a=[e,"hr",o,"hr",qd.formGroup([i,s],"row")];return qd.create({className:`${this.name}-edit group-config`,action:{onRender:t=>{const e=a.map((t=>qd.create(t)));t.append(...e)}}})}onAdd(...t){super.onAdd(...t),this.autoColumnWidths()}onRemove(...t){super.onRemove(...t),this.autoColumnWidths()}get getColumnPresetOptions(){const t=this.children,e=F.get(t.length-1)||[],n=t.map((t=>{const e=t.get("config.width")||"";return Number(e.replace("%","")).toFixed(1)})).join(",");if(e.length){const t=e.slice();return!t.find((t=>t.value===n))&&t.push({value:n,label:n.replace(/,/g," | "),className:S}),t.map((t=>{const e={...t};return e.selected=t.value===n,e}))}return[]}get columnPresetControlConfig(){return{tag:"select",attrs:{ariaLabel:r.get("defineColumnLayout"),className:O},action:{change:({target:t})=>{const{value:e}=t;this.setColumnWidths(e)}},options:this.getColumnPresetOptions}}}const Ed={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]}};const xd=new class extends bd{constructor(t){super("rows",t),this.config={all:Ed}}Component(t){return new Cd(t)}};class Sd{constructor(){this.onMove=this.onMove.bind(this),this.onStop=this.onStop.bind(this),this.cleanup=this.cleanup.bind(this)}getRowWidth(t){const e=t.querySelector(".children");if(!e)return 0;const n=e.children.length,o=qd.getStyle(e,"gap")||"0px",i=parseFloat(o,10)||0;return this.totalGapWidth=i*(n-1),e.offsetWidth-this.totalGapWidth}validateResizeTarget(t,e){return t&&e&&t.offsetWidth&&e.offsetWidth}onStart(t){if(t.preventDefault(),this.resized=!1,0!==t.button)return;const e=t.target.parentElement,n=e.nextSibling||e.previousSibling,o=e.closest(`.${C}`);if(this.validateResizeTarget(e,n))if(this.startX="touchstart"===t.type?t.touches[0].clientX:t.clientX,o.classList.add(_),this.columnPreset=o.querySelector(`.${O}`),this.originalColumnClass=e.className,this.originalSiblingClass=n.className,e.className=e.className.replace(Q,""),n.className=n.className.replace(Q,""),this.colStartWidth=e.offsetWidth,this.sibStartWidth=n.offsetWidth,this.rowWidth=this.getRowWidth(o),this.rowWidth<=0)this.cleanup();else{this.column=e,this.sibling=n,this.row=o;try{window.addEventListener("pointermove",this.onMove,!1),window.addEventListener("pointerup",this.onStop,!1)}catch(i){this.cleanup()}}else this.cleanup()}calculateNewWidths(t){const e=this.colStartWidth+t-this.startX,n=this.sibStartWidth-t+this.startX,o=parseFloat(Vi(e,this.rowWidth)),i=parseFloat(Vi(n,this.rowWidth));return o<10||i<10?null:{colWidth:Yi(o.toFixed(1)),siblingColWidth:Yi(i.toFixed(1))}}onMove(t){t.preventDefault();const{column:e,sibling:n}=this,o="touchmove"===t.type?t.touches[0].clientX:t.clientX,i=this.calculateNewWidths(o);if(!i)return;const{colWidth:r,siblingColWidth:s}=i;e.dataset.colWidth=r,n.dataset.colWidth=s,e.style.width=r,n.style.width=s,this.resized=!0}onStop(){const{column:t,sibling:e}=this;window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onStop),this.resized&&(this.setCustomWidthValue(),Wd.setAddress(`columns.${t.id}.config.width`,t.dataset.colWidth),Wd.setAddress(`columns.${e.id}.config.width`,e.dataset.colWidth),this.row.classList.remove(_),this.resized=!1,this.cleanup())}cleanup(){this.column&&this.originalColumnClass&&(this.column.className=this.originalColumnClass),this.sibling&&this.originalSiblingClass&&(this.sibling.className=this.originalSiblingClass),this.row&&this.row.classList.remove(_),window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onStop)}setCustomWidthValue(){const t=this.columnPreset;let e=t.querySelector(`.${S}`);const n=this.row.querySelector(".children").children,o=Vr(n,(t=>Vi(t.clientWidth,this.rowWidth).toFixed(1))),i=o.join(","),r=o.join(" | ");return e||(e=qd.create({tag:"option",attrs:{className:S,value:i,selected:!0},content:r}),t.append(e)),e.value=i,e.textContent=r,i}}const Od=t=>({className:"resize-x-handle",action:{pointerdown:t.onStart.bind(t)},content:[qd.icon("triangle-down"),qd.icon("triangle-up")]}),_d=()=>({className:"column-edit group-config"});class Nd extends Zc{constructor(t){super("column",{...Object.freeze({config:{width:"100%"},children:[],className:[E]}),...t}),n(this,"refreshFieldPanels",(()=>{for(const t of this.children)t.panels.nav.refresh()})),n(this,"setDomWidth",(t=>{this.dom.dataset.colWidth=t,this.dom.style.width=t})),n(this,"setWidth",(t=>(this.setDomWidth(t),this.set("config.width",t))));const e=this.createChildWrap();this.dom=qd.create({tag:"li",className:[E,"empty"],dataset:{hoverTag:r.get("column")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),_d(),Od(new Sd),e]}),this.processConfig(),ns.columnResized=new window.CustomEvent("columnResized",{detail:{column:this.dom,instance:this}}),sc.create(e,{animation:150,fallbackClass:"field-moving",forceFallback:!0,group:{name:"column",pull:!0,put:["column","controls"]},sort:!0,disabled:!1,onEnd:this.onEnd.bind(this),onAdd:this.onAdd.bind(this),onSort:this.onSort.bind(this),onRemove:this.onRemove.bind(this),onMove:t=>{t.from!==t.to&&t.from.classList.remove("hovering-column")},draggable:`.${x}`,handle:".item-move"})}processConfig(){const t=Jr.get(this.data,"config.width");t&&this.setDomWidth(t)}}const Ad={actionButtons:{buttons:["clone","move","remove"],disabled:[]}};const jd=new class extends bd{constructor(t){super("columns",t),this.config={all:Ad}}Component(t){return new Nd(t)}},Td={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]},panels:{disabled:[],attrs:{disabled:["type"],hideDisabled:!0,locked:[]},order:["attrs","options","conditions"]},label:{disableHTML:!1}};const Pd=new class extends bd{constructor(t){super("fields",t),n(this,"get",(t=>{let e=t&&Br(this.data,t);if(!e){const n=vd.get(t);n&&(e=this.add(null,n.controlData))}return e})),n(this,"getData",(()=>Object.entries(this.data).reduce(((t,[e,n])=>{const{conditions:o,...i}=(null==n?void 0:n.getData())||n;if(null==o?void 0:o.length){let t=!0;if(1===o.length){const[e]=o;t=Boolean(e.if[0].source&&e.then[0].target)}t&&(i.conditions=o)}return t[e]=i,t}),{}))),n(this,"load",((t=Object.create(null))=>{const e=er(t);this.empty();for(const[n,o]of Object.entries(e)){const{meta:t,...e}=o;(null==t?void 0:t.id)&&zr(e,"config.controlId",null==t?void 0:t.id),this.add(n,e)}return this.data})),this.config={all:Td}}Component(t){return new Jc(t)}};const Ld=new class extends bd{constructor(t){super("externals",t)}Component(t){return new Zc("external",t)}},Dd=wd,kd=xd,$d=jd,Id=Pd,Md=vd,Rd=Ld,Fd=()=>({id:Ui(),stages:{[Ui()]:{}},rows:{},columns:{},fields:{}});const Wd=new class extends xa{constructor(){super("components"),n(this,"load",((t,e)=>{this.empty();const n=((t,e=!1)=>t?Xi(er(t)):e&&Gi.get(B)||Fd())(t,e.sessionStorage);this.opts=e,this.set("id",n.id),this.add("stages",Dd.load(n.stages)),this.add("rows",kd.load(n.rows)),this.add("columns",$d.load(n.columns)),this.add("fields",Id.load(n.fields)),this.add("externals",Rd.load(this.opts.external));for(const o of Object.values(this.get("stages")))o.loadChildren();return this.data})),this.disableEvents=!0,this.stages=Dd,this.rows=kd,this.columns=$d,this.fields=Id,this.controls=Md,this.externals=Rd}flatList(t=this.data,e=Object.create(null)){return Object.entries(t).reduce(((t,[e,n])=>{if("object"==typeof n)for(const[o,i]of Object.entries(n))t[`${e}.${o}`]=i;return t}),e)}get json(){return window.JSON.stringify({$schema:`https://cdn.jsdelivr.net/npm/formeo@${p}/dist/formData_schema.json`,...this.formData})}get formData(){return{id:this.get("id"),stages:wd.getData(),rows:xd.getData(),columns:jd.getData(),fields:Pd.getData()}}set config(t){const{stages:e,rows:n,columns:o,fields:i}=t;Dd.config=e,kd.config=n,$d.config=o,Id.config=i}setAddress(t,e){const[n,o,...i]=Array.isArray(t)?t:t.split("."),r=this[n.replace(/s?$/,"s")].get(o);return null==r||r.set(i,e),r}getAddress(t){if(!Zi(t))return;const[e,n,...o]=Array.isArray(t)?t:t.split("."),i=this[e.replace(/s?$/,"s")].get(n);return o.length?i.get(o):i}getConditionMap(t){if(Zi(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.get(e[1])}}setConditionMap(t,e){if(Zi(t)){const n=t.split(".");return n.every((t=>Boolean(t)))&&this[n[0]].conditionMap.set(n[1],e)}}removeConditionMap(t){if(Zi(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.delete(e[1])}}},Bd={glyphicons:t=>`<span class="glyphicon glyphicon-${t}" aria-hidden="true"></span>`,"font-awesome":t=>{const[e,n]=t.split(" ");return`<i class="${e} fa-${n}"></i>`},fontello:t=>`<i class="${tt}${t}">${t}</i>`},zd=new Set(["input","textarea","select"]);const qd=new class{constructor(t=Object.create(null)){n(this,"render",(t=>(t.id=`f-${t.id||Ui()}`,this.create(t)))),n(this,"create",((t,e=!1)=>{if(!t)return;const n=this,o=["children","content"],{className:i,options:r,dataset:s,...a}=this.processTagName(t);let l;o.push("tag");const{tag:c}=a;let d;const u={attrs:{},className:[Jr.get(a,"config.inputWrap")||"f-field-group"],children:[],config:{}};let h=document.createElement(c);const p={string:t=>{h.innerHTML+=t},object:t=>t&&h.appendChild(n.create(t,e)),node:t=>h.appendChild(t),component:t=>h.appendChild(t.dom),array:t=>{for(const e of t)l=n.childType(e),p[l](e)},function:t=>{t=t(),l=n.childType(t),p[l](t)},undefined:()=>null,boolean:()=>null};if(i&&(a.attrs=Hi(a.attrs,{className:i})),r){const t=this.processOptions(r,a,e);if(!this.holdsContent(h)||"button"===c)return Jr.forEach(t,(t=>{u.children.push(n.create(t,e))})),a.attrs.className&&(u.className=a.attrs.className),u.config={...a.config},this.create(u,e);p.array.call(this,t),a.content=void 0,o.push("options")}if(a.attrs&&(n.processAttrs(a,h,e),o.push("attrs")),a.config){if(a.config.label&&(a.config.label&&"button"!==c||["radio","checkbox"].includes(Jr.get(a,"attrs.type")))&&!e){const t=n.label(a);if(!a.config.hideLabel){const e=[t,h];n.labelAfter(a)&&e.reverse(),u.children.push(e)}}o.push("config")}if(a.content||a.children){const t=a.content||a.children;l=n.childType(t),p[l],p[l].call(this,t)}if(s){for(const t in s)Object.hasOwn(s,t)&&(h.dataset[t]="function"==typeof s[t]?s[t]():s[t]);o.push("dataset")}a.action&&(this.actionHandler(h,a.action),o.push("action"));const f=Jr.subtract(o,Object.keys(a));for(d=f.length-1;d>=0;d--)h[f[d]]=a[f[d]];return u.children.length&&(h=this.create(u)),h})),n(this,"onRender",((t,e)=>{t.parentElement?e(t):window.requestAnimationFrame((()=>this.onRender(t,e)))})),n(this,"toggleElementsByStr",((t,e)=>{const n=[];return qd.elementsContainText(t,e,((t,e)=>{e?(t.style.display="block",n.push(t)):t.style.display="none"})),n})),n(this,"elementsContainText",((t,e,n)=>{const o=[];return Xr(t,(t=>{const i=-1!==t.textContent.toLowerCase().indexOf(e.toLowerCase());null==n||n(t,i),i&&o.push(t)})),o})),n(this,"generateOption",(({type:t="option",label:e,value:n,i:o=0,selected:i})=>({tag:"option"===t?"option":"input",attrs:{type:t,value:n||`${t}-${o}`,["option"===t?"selected":"checked"]:i||!o},config:{label:e||r.get("labelCount",{label:r.get("option"),count:o})}}))),n(this,"requiredMark",(()=>({tag:"span",className:"text-error",children:"*"}))),n(this,"removeEmpty",(t=>{const e=t.parentElement,n=zi(t),o=e.getElementsByClassName(`formeo-${n}`);if(this.remove(t),!o.length)return this.isStage(e)?this.emptyClass(e):this.removeEmpty(e)})),n(this,"btnTemplate",(({title:t="",...e})=>({tag:"button",attrs:{type:"button",title:t},...e}))),n(this,"isControls",(t=>zi(t)===y)),n(this,"isStage",(t=>zi(t)===w)),n(this,"isRow",(t=>zi(t)===C)),n(this,"isColumn",(t=>zi(t)===E)),n(this,"isField",(t=>zi(t)===x)),n(this,"asComponent",(t=>Wd[`${zi(t)}s`].get(t.id))),this.options=t}set setOptions(t){this.options=Hi(this.options,t)}processTagName(t){let e,n=t;if("string"==typeof n)return e=n,n={tag:e},n;if(n.attrs){const{tag:t,...o}=n.attrs;if(t)if("string"==typeof t)e=t;else{e=(t.find((t=>!0===t.selected))||t[0]).value}n.attrs=o}return n.tag=e||n.tag||"div",n}actionHandler(t,e){const n={onRender:qd.onRender,render:qd.onRender},o=["focus","blur"];return Object.entries(e).map((([e,i])=>(Array.isArray(i)?i:[i]).map((i=>{const r=n[e]||(t=>(e,n)=>e.addEventListener(t,n,o.includes(t)))(e);return r(t,i)}))))}get icons(){if(this.iconSymbols)return this.iconSymbols;const t=document.querySelectorAll(`#${f} svg symbol`);return this.iconSymbols=Array.from(t).reduce(((t,e)=>{var n;return t[e.id.replace(tt,"")]={tag:"svg",attrs:{className:["svg-icon",n=e.id]},children:[{tag:"use",attrs:{"xmlns:xlink":"http://www.w3.org/1999/xlink","xlink:href":`#${n}`}}]},t}),{}),this.cachedIcons={},this.iconSymbols}icon(t,e){var n,o;if(!t)return;const i=`${t}?${new URLSearchParams(e).toString()}`;if(null==(n=this.cachedIcons)?void 0:n[i])return this.cachedIcons[i];const r=this.icons[t];if(r){if(e){const t=Hi(r,e);return this.cachedIcons[i]=qd.create(t).outerHTML,this.cachedIcons[i]}return this.cachedIcons[i]=qd.create(r).outerHTML,this.cachedIcons[i]}return(null==(o=Bd[qd.options.iconFont])?void 0:o.call(Bd,t))||t}processAttrs(t,e,n){const{attrs:o={}}=t;n||o.name||!this.isInput(t.tag)||e.setAttribute("name",Ui(t));for(const i of Object.keys(o)){const t=Jr.safeAttrName(i),n=this.processAttrValue(o[i]);n&&e.setAttribute(t,!0===n?"":n)}}processAttrValue(t){let e=t||"";if(Array.isArray(e))if("object"==typeof e[0]){const t=e.filter((t=>!0===t.selected));e=t.length?t[0].value:e[0].value}else e=e.join(" ");return e}processOptions(t,e,n){const{action:o,attrs:i}=e,r=i.type||e.tag,s=i.id||e.id;return t.map(((t,i)=>{var a;const{label:l,...c}=t,d=()=>{const a={tag:"input",attrs:{name:s,type:r,value:t.value||"",id:`${s}-${i}`,...c},action:o},l={tag:"label",attrs:{for:`${s}-${i}`},config:{inputWrap:"form-check"},children:t.label},d={children:[a,l],className:[`f-${r}`]};return e.attrs.className&&(e.config.inputWrap=e.attrs.className),e.config.inline&&d.className.push(`f-${r}-inline`),t.selected&&(a.attrs.checked=!0),n&&(l.attrs.contenteditable=!0),d},u={select:()=>({tag:"option",attrs:t,children:t.label}),button:t=>{const{type:n,label:o,className:i,id:r}=t;return{...e,attrs:{type:n},className:i,id:r||Ui(),options:void 0,children:o,action:e.action}},checkbox:d,radio:d};return null==(a=u[r])?void 0:a.call(u,t)}))}holdsContent(t){return-1!==t.outerHTML.indexOf("/")}isBlockInput(t){return!this.isInput(t)&&this.holdsContent(t)}isInput(t){let e=t;return"string"!=typeof e&&(e=e.tagName),zd.has(e)}parsedHtml(t){const e=document.createElement("textarea");return e.innerHTML=t,e.textContent}labelAfter(t){const e=Jr.get(t,"attrs.type"),n=Jr.get(t,"config.labelAfter");return void 0!==n?n:"checkbox"===e||"radio"===e}label(t,e){const n=Jr.get(t,"attrs.required");let{config:{label:o=""}}=t;const{id:i,attrs:r}=t;"function"==typeof o&&(o=o());const s={tag:"label",attrs:{for:i||(null==r?void 0:r.id)},className:[],children:[o,n&&this.requiredMark()],action:{}};return e&&(s.attrs.for=void 0,s.attrs.contenteditable=!0,s.fMap=e),s}childType(t){return void 0===t?t:[["array",t=>Array.isArray(t)],["node",t=>t instanceof window.Node||t instanceof window.HTMLElement],["component",()=>null==t?void 0:t.dom],[typeof t,()=>!0]].find((e=>e[1](t)))[0]}getStyle(t,e=!1){let n;return window.getComputedStyle?n=window.getComputedStyle(t,null):t.currentStyle&&(n=t.currentStyle),e?n[e]:n}getElement(t){return{node:()=>t,object:()=>document.getElementById(t.id),string:()=>document.getElementById(t)}[this.childType(t)]()}empty(t){for(;t.firstChild;)this.remove(t.firstChild);return t}remove(t){const e=zi(t);return e?Wd.remove(`${e}s.${t.id}`):t.parentElement.removeChild(t)}removeClasses(t,e){const n={string:t=>t.classList.remove(e),array:t=>{for(const n of e)t.classList.remove(n)}};n.object=n.string,Jr.forEach(t,n[this.childType(e)])}addClasses(t,e){const n={string:t=>t.classList.add(e),array:t=>{for(const n of e)t.classList.add(n)}};Jr.forEach(t,n[this.childType(e)])}formGroup(t,e=""){return{className:["f-field-group",e],children:t}}coords(t){const e=t.getBoundingClientRect(),n=document.body.getBoundingClientRect();return{pageX:e.left+e.width/2,pageY:e.top-n.top-e.height/2}}clearStage(t){t.classList.add("removing-all-fields");Kr.slideUp(t,600,(()=>{qd.empty(t),t.classList.remove("removing-all-fields"),qd.emptyClass(t),Kr.slideDown(t,300)}))}toggleSortable(t,e){let n=e;const o=zi(t);if(!o)return;const i=zi(t.parentElement),r=qd[o].get(t.id).sortable;n||(n=!r.option("disabled")),r.option("disabled",n),i&&["rows","columns","stages"].includes(i)&&this.toggleSortable(t.parentElement,n)}emptyClass(t){const e=t.getElementsByClassName(N.get(t.classList.item(0)));t.classList.toggle("empty",!e.length)}};r.addLanguage("en-US",void 0);const Ud={get editor(){return{stickyControls:!1,allowEdit:!0,dataType:"json",debug:!1,sessionStorage:!1,editorContainer:null,external:{},svgSprite:g,style:b,iconFont:null,config:{},events:{},actions:{},controls:{},polyfills:Zr(),i18n:{location:"https://draggable.github.io/formeo/assets/lang/"},onLoad:()=>{}}}};let Hd=class{constructor({formData:t,...e},n){const o=Hi(Ud.editor,e),{actions:i,events:r,debug:s,config:a,editorContainer:l,...c}=o;l&&(this.editorContainer="string"==typeof l?document.querySelector(l):l),this.opts=c,qd.setOptions=c,Wd.config=a,this.userFormData=nr(n||t),this.Components=Wd,this.dom=qd,ns.init({debug:s,...r}),Ac.init({debug:s,sessionStorage:c.sessionStorage,...i}),this.tooltip=new u,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",this.loadResources.bind(this)):this.loadResources()}get formData(){return this.Components.formData}set formData(t={}){this.load({...this.userFormData,...t},this.opts)}get json(){return this.Components.json}async loadResources(){var t;document.removeEventListener("DOMContentLoaded",this.loadResources);const e=[];this.opts.polyfills&&(t=>{const e=Array.isArray(t)?m.filter((({name:e})=>-1!==t.indexOf(e))):m;Promise.all(e.map((({src:t})=>nd(t))))})(this.opts.polyfills),await id(this.opts.svgSprite),e.push((async t=>{if(!ad()&&(await od(t),!ad()))return await od("https://draggable.github.io/formeo/assets/css/formeo.min.css")})(this.opts.style)),e.push(r.init({...this.opts.i18n,locale:null==(t=window.sessionStorage)?void 0:t.getItem(z)}));const n=await Promise.all(e);return this.opts.allowEdit&&this.init(),n}init(){return vd.init(this.opts.controls,this.opts.stickyControls).then((t=>{var e,n;this.controls=t,this.load(this.userFormData,this.opts),this.formId=Wd.get("id"),this.i18n={setLang:t=>{var e;null==(e=window.sessionStorage)||e.setItem(z,t);r.setCurrent(t).then((()=>{this.init()}),console.error)}},this.render(),null==(n=(e=this.opts).onLoad)||n.call(e,this)}))}load(t=this.userFormData,e=this.opts){return this.Components.load(t,e)}render(){if(!this.controls)return window.requestAnimationFrame((()=>this.render()));if(this.stages=Object.values(Wd.get("stages")),this.opts.controlOnLeft)for(const e of this.stages)e.dom.style.order=1;const t={attrs:{className:"formeo formeo-editor",id:this.formId},content:[this.stages.map((({dom:t})=>t))]};r.current.dir&&(t.attrs.dir=r.current.dir,qd.dir=r.current.dir),this.editor=qd.create(t);(this.controls.container||this.editor).appendChild(this.controls.dom),this.editorContainer&&(qd.empty(this.editorContainer),this.editorContainer.appendChild(this.editor)),ns.formeoLoaded=new window.CustomEvent("formeoLoaded",{detail:{formeo:this}}),document.dispatchEvent(ns.formeoLoaded)}};const Xd=t=>"string"==typeof t?document.querySelector(t):t,Vd=t=>{const e=t.match(K);return(null==e?void 0:e[0])||t},Yd=t=>t.replace(K,Ui());let Gd=class{constructor(t,e){n(this,"render",((t=this.form)=>{this.form=nr(t);const e=document.getElementsByClassName("formeo-render").length,n={id:this.form.id,className:`formeo-render formeo formeo-rendered-${e}`,children:this.processedData};this.renderedForm=qd.render(n),this.applyConditions();const o=this.container.querySelector(".formeo-render");o?o.replaceWith(this.renderedForm):this.container.appendChild(this.renderedForm)})),n(this,"orderChildren",((t,e)=>e.reduce(((e,n)=>(e.push(this.form[t][n]),e)),[]))),n(this,"prefixId",(t=>"f-"+t)),n(this,"processColumn",(({id:t,...e})=>({...e,id:this.prefixId(t),children:this.processFields(e.children),style:`width: ${e.config.width||"100%"}`}))),n(this,"processRows",(t=>this.orderChildren("rows",this.form.stages[t].children).reduce(((t,e)=>(e&&t.push(this.processRow(e)),t)),[]))),n(this,"cacheComponent",(t=>(this.components[Vd(t.id)]=t,t))),n(this,"processRow",((t,e="row")=>{const{config:n,id:o}=t,i=[`formeo-${e}-wrap`],r={...t,children:this.processColumns(t.id),id:this.prefixId(o)};this.cacheComponent(r);const s=[{condition:n.legend,result:()=>({tag:n.fieldset?"legend":"h3",children:n.legend})},{condition:!0,result:()=>r},{condition:n.inputGroup,result:()=>this.addButton(o)}].reduce(((t,{condition:e,result:n})=>(e&&t.push(n()),t)),[]);return n.inputGroup&&i.push("f-input-group-wrap"),{tag:n.fieldset?"fieldset":"div",id:Ui(),className:i,children:s}})),n(this,"cloneComponentData",(t=>{const{children:e=[],id:n,...o}=this.components[t];return Object.assign({},o,{id:Yd(n),children:e.length&&e.map((({id:t})=>this.cloneComponentData(Vd(t))))})})),n(this,"addButton",(t=>qd.render({tag:"button",attrs:{className:"add-input-group btn pull-right",type:"button"},children:"Add +",action:{click:e=>{const n=e.target.parentElement,o=qd.render(this.cloneComponentData(t));n.insertBefore(o,n.lastChild),o.appendChild(qd.render(qd.btnTemplate({className:"remove-input-group",children:qd.icon("remove"),action:{mouseover:({target:t})=>t.parentElement.classList.add("will-remove"),mouseleave:({target:t})=>t.parentElement.classList.remove("will-remove"),click:({target:t})=>t.parentElement.remove()}})))}}}))),n(this,"processColumns",(t=>this.orderChildren("columns",this.form.rows[t].children).map((t=>this.cacheComponent(this.processColumn(t)))))),n(this,"processFields",(t=>this.orderChildren("fields",t).map((({id:t,...e})=>{var n,o;const i=(null==(n=e.config)?void 0:n.controlId)||(null==(o=e.meta)?void 0:o.id),{action:r={},dependencies:s={}}=this.elements[i]||{};s&&sd(s);const a=Hi({action:r},e);return this.cacheComponent({...a,id:this.prefixId(t)})})))),n(this,"handleComponentCondition",((t,e,n)=>{const o=Zd(t);o&&t.addEventListener(o,(t=>{if(this.evaluateCondition(e,t))for(const e of n)this.execResult(e,t)}),!1);const i={target:t};if(this.evaluateCondition(e,i))for(const r of n)this.execResult(r,i)})),n(this,"applyConditions",(()=>{for(const{conditions:t}of Object.values(this.components))if(t)for(const e of t){const{if:t,then:n}=e;for(const e of t){const{source:t,...o}=e;if(Zi(t)){const e=this.getComponents(t);for(const t of e)this.handleComponentCondition(t,o,n)}}}})),n(this,"evaluateCondition",(({sourceProperty:t,targetProperty:e,comparison:n,target:o},i)=>{var r;const s={equals:Ea,notEquals:(t,e)=>!Ea(t,e),contains:(t,e)=>t.includes(e),notContains:(t,e)=>!t.includes(e)},a=String(i.target[t]),l=String(Zi(o)?this.getComponent(o)[e]:o);return null==(r=s[n])?void 0:r.call(s,a,l)})),n(this,"execResult",(({assignment:t,target:e,targetProperty:n,value:o})=>{var i;const r={equals:t=>{var e;const i={value:()=>{t[n]=o},isNotVisible:()=>{t.parentElement.setAttribute("hidden",!0),t.required=!1},isVisible:()=>{t.parentElement.removeAttribute("hidden"),t.required=t._required}};null==(e=i[n])||e.call(i)}};if(Zi(e)){const n=this.getComponent(e);n&&void 0===n._required&&(n._required=n.required),null==(i=r[t])||i.call(r,n)}})),n(this,"getComponent",(t=>{const e=t.slice(t.indexOf(".")+1);return Ji(t)?this.external[e]:this.renderedForm.querySelector(`#f-${e}`)})),n(this,"getComponents",(t=>{const e=[],n=t.slice(t.indexOf(".")+1);return Ji(t)?e.push(this.external[n]):e.push(...this.renderedForm.querySelectorAll(`[name=f-${n}]`)),e}));const{renderContainer:o,external:i,elements:r,formData:s}=(({editorContainer:t,renderContainer:e,formData:n,...o})=>({elements:{},...o,renderContainer:Xd(e),editorContainer:Xd(t),formData:nr(n)}))(t);this.container=o,this.form=nr(e||s),this.external=i,this.dom=qd,this.components=Object.create(null),this.elements=r}get processedData(){return Object.values(this.form.stages).map((t=>(t.children=this.processRows(t.id),t.className=w,qd.render(t))))}};const Zd=t=>{const[e]=[["input",t=>["textarea","text"].includes(t.type)],["change",t=>["select"].includes(t.tagName.toLowerCase())||["checkbox","radio"].includes(t.type)]].find((e=>e[1](t)))||[!1];return e};void 0!==window&&(window.FormeoEditor=Hd,window.FormeoRenderer=Gd);const Jd=Hd,Kd=Gd;t.FormeoEditor=Jd,t.FormeoRenderer=Kd,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
|
|
14
|
+
*/function Oa(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function _a(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Oa(Object(n),!0).forEach((function(e){Aa(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Oa(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Na(t){return(Na="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Aa(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ja(){return ja=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},ja.apply(this,arguments)}function Ta(t,e){if(null==t)return{};var n,o,i=function(t,e){if(null==t)return{};var n,o,i={},r=Object.keys(t);for(o=0;o<r.length;o++)n=r[o],e.indexOf(n)>=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(o=0;o<r.length;o++)n=r[o],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Pa(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var La=Pa(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Da=Pa(/Edge/i),ka=Pa(/firefox/i),$a=Pa(/safari/i)&&!Pa(/chrome/i)&&!Pa(/android/i),Ia=Pa(/iP(ad|od|hone)/i),Ma=Pa(/chrome/i)&&Pa(/android/i),Ra={capture:!1,passive:!1};function Fa(t,e,n){t.addEventListener(e,n,!La&&Ra)}function Wa(t,e,n){t.removeEventListener(e,n,!La&&Ra)}function Ba(t,e){if(e){if(">"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(n){return!1}return!1}}function za(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function qa(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&Ba(t,e):Ba(t,e))||o&&t===n)return t;if(t===n)break}while(t=za(t))}return null}var Ua,Ha=/\s+/g;function Xa(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(Ha," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(Ha," ")}}function Va(t,e,n){var o=t&&t.style;if(o){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];e in o||-1!==e.indexOf("webkit")||(e="-webkit-"+e),o[e]=n+("string"==typeof n?"":"px")}}function Ya(t,e){var n="";if("string"==typeof t)n=t;else do{var o=Va(t,"transform");o&&"none"!==o&&(n=o+" "+n)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function Ga(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i<r;i++)n(o[i],i);return o}return[]}function Za(){var t=document.scrollingElement;return t||document.documentElement}function Ja(t,e,n,o,i){if(t.getBoundingClientRect||t===window){var r,s,a,l,c,d,u;if(t!==window&&t.parentNode&&t!==Za()?(s=(r=t.getBoundingClientRect()).top,a=r.left,l=r.bottom,c=r.right,d=r.height,u=r.width):(s=0,a=0,l=window.innerHeight,c=window.innerWidth,d=window.innerHeight,u=window.innerWidth),(e||n)&&t!==window&&(i=i||t.parentNode,!La))do{if(i&&i.getBoundingClientRect&&("none"!==Va(i,"transform")||n&&"static"!==Va(i,"position"))){var h=i.getBoundingClientRect();s-=h.top+parseInt(Va(i,"border-top-width")),a-=h.left+parseInt(Va(i,"border-left-width")),l=s+r.height,c=a+r.width;break}}while(i=i.parentNode);if(o&&t!==window){var p=Ya(i||t),f=p&&p.a,m=p&&p.d;p&&(l=(s/=m)+(d/=m),c=(a/=f)+(u/=f))}return{top:s,left:a,bottom:l,right:c,width:u,height:d}}}function Ka(t,e,n){for(var o=ol(t,!0),i=Ja(t)[e];o;){if(!(i>=Ja(o)[n]))return o;if(o===Za())break;o=ol(o,!1)}return!1}function Qa(t,e,n,o){for(var i=0,r=0,s=t.children;r<s.length;){if("none"!==s[r].style.display&&s[r]!==ac.ghost&&(o||s[r]!==ac.dragged)&&qa(s[r],n.draggable,t,!1)){if(i===e)return s[r];i++}r++}return null}function tl(t,e){for(var n=t.lastElementChild;n&&(n===ac.ghost||"none"===Va(n,"display")||e&&!Ba(n,e));)n=n.previousElementSibling;return n||null}function el(t,e){var n=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||t===ac.clone||e&&!Ba(t,e)||n++;return n}function nl(t){var e=0,n=0,o=Za();if(t)do{var i=Ya(t),r=i.a,s=i.d;e+=t.scrollLeft*r,n+=t.scrollTop*s}while(t!==o&&(t=t.parentNode));return[e,n]}function ol(t,e){if(!t||!t.getBoundingClientRect)return Za();var n=t,o=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=Va(n);if(n.clientWidth<n.scrollWidth&&("auto"==i.overflowX||"scroll"==i.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==i.overflowY||"scroll"==i.overflowY)){if(!n.getBoundingClientRect||n===document.body)return Za();if(o||e)return n;o=!0}}}while(n=n.parentNode);return Za()}function il(t,e){return Math.round(t.top)===Math.round(e.top)&&Math.round(t.left)===Math.round(e.left)&&Math.round(t.height)===Math.round(e.height)&&Math.round(t.width)===Math.round(e.width)}function rl(t,e){return function(){if(!Ua){var n=arguments;1===n.length?t.call(this,n[0]):t.apply(this,n),Ua=setTimeout((function(){Ua=void 0}),e)}}}function sl(t,e,n){t.scrollLeft+=e,t.scrollTop+=n}function al(t){var e=window.Polymer,n=window.jQuery||window.Zepto;return e&&e.dom?e.dom(t).cloneNode(!0):n?n(t).clone(!0)[0]:t.cloneNode(!0)}function ll(t,e,n){var o={};return Array.from(t.children).forEach((function(i){var r,s,a,l;if(qa(i,e.draggable,t,!1)&&!i.animated&&i!==n){var c=Ja(i);o.left=Math.min(null!==(r=o.left)&&void 0!==r?r:1/0,c.left),o.top=Math.min(null!==(s=o.top)&&void 0!==s?s:1/0,c.top),o.right=Math.max(null!==(a=o.right)&&void 0!==a?a:-1/0,c.right),o.bottom=Math.max(null!==(l=o.bottom)&&void 0!==l?l:-1/0,c.bottom)}})),o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}var cl="Sortable"+(new Date).getTime();function dl(){var t,e=[];return{captureAnimationState:function(){(e=[],this.options.animation)&&[].slice.call(this.el.children).forEach((function(t){if("none"!==Va(t,"display")&&t!==ac.ghost){e.push({target:t,rect:Ja(t)});var n=_a({},e[e.length-1].rect);if(t.thisAnimationDuration){var o=Ya(t,!0);o&&(n.top-=o.f,n.left-=o.e)}t.fromRect=n}}))},addAnimationState:function(t){e.push(t)},removeAnimationState:function(t){e.splice(function(t,e){for(var n in t)if(t.hasOwnProperty(n))for(var o in e)if(e.hasOwnProperty(o)&&e[o]===t[n][o])return Number(n);return-1}(e,{target:t}),1)},animateAll:function(n){var o=this;if(!this.options.animation)return clearTimeout(t),void("function"==typeof n&&n());var i=!1,r=0;e.forEach((function(t){var e=0,n=t.target,s=n.fromRect,a=Ja(n),l=n.prevFromRect,c=n.prevToRect,d=t.rect,u=Ya(n,!0);u&&(a.top-=u.f,a.left-=u.e),n.toRect=a,n.thisAnimationDuration&&il(l,a)&&!il(s,a)&&(d.top-a.top)/(d.left-a.left)==(s.top-a.top)/(s.left-a.left)&&(e=function(t,e,n,o){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-n.top,2)+Math.pow(e.left-n.left,2))*o.animation}(d,l,c,o.options)),il(a,s)||(n.prevFromRect=s,n.prevToRect=a,e||(e=o.options.animation),o.animate(n,d,a,e)),e&&(i=!0,r=Math.max(r,e),clearTimeout(n.animationResetTimer),n.animationResetTimer=setTimeout((function(){n.animationTime=0,n.prevFromRect=null,n.fromRect=null,n.prevToRect=null,n.thisAnimationDuration=null}),e),n.thisAnimationDuration=e)})),clearTimeout(t),i?t=setTimeout((function(){"function"==typeof n&&n()}),r):"function"==typeof n&&n(),e=[]},animate:function(t,e,n,o){if(o){Va(t,"transition",""),Va(t,"transform","");var i=Ya(this.el),r=i&&i.a,s=i&&i.d,a=(e.left-n.left)/(r||1),l=(e.top-n.top)/(s||1);t.animatingX=!!a,t.animatingY=!!l,Va(t,"transform","translate3d("+a+"px,"+l+"px,0)"),this.forRepaintDummy=function(t){return t.offsetWidth}(t),Va(t,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),Va(t,"transform","translate3d(0,0,0)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout((function(){Va(t,"transition",""),Va(t,"transform",""),t.animated=!1,t.animatingX=!1,t.animatingY=!1}),o)}}}}var ul=[],hl={initializeByDefault:!0},pl={mount:function(t){for(var e in hl)hl.hasOwnProperty(e)&&!(e in t)&&(t[e]=hl[e]);ul.forEach((function(e){if(e.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")})),ul.push(t)},pluginEvent:function(t,e,n){var o=this;this.eventCanceled=!1,n.cancel=function(){o.eventCanceled=!0};var i=t+"Global";ul.forEach((function(o){e[o.pluginName]&&(e[o.pluginName][i]&&e[o.pluginName][i](_a({sortable:e},n)),e.options[o.pluginName]&&e[o.pluginName][t]&&e[o.pluginName][t](_a({sortable:e},n)))}))},initializePlugins:function(t,e,n,o){for(var i in ul.forEach((function(o){var i=o.pluginName;if(t.options[i]||o.initializeByDefault){var r=new o(t,e,t.options);r.sortable=t,r.options=t.options,t[i]=r,ja(n,r.defaults)}})),t.options)if(t.options.hasOwnProperty(i)){var r=this.modifyOption(t,i,t.options[i]);void 0!==r&&(t.options[i]=r)}},getEventProperties:function(t,e){var n={};return ul.forEach((function(o){"function"==typeof o.eventProperties&&ja(n,o.eventProperties.call(e[o.pluginName],t))})),n},modifyOption:function(t,e,n){var o;return ul.forEach((function(i){t[i.pluginName]&&i.optionListeners&&"function"==typeof i.optionListeners[e]&&(o=i.optionListeners[e].call(t[i.pluginName],n))})),o}};var fl=["evt"],ml=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=n.evt,i=Ta(n,fl);pl.pluginEvent.bind(ac)(t,e,_a({dragEl:vl,parentEl:bl,ghostEl:yl,rootEl:wl,nextEl:Cl,lastDownEl:El,cloneEl:xl,cloneHidden:Sl,dragStarted:Ml,putSortable:Tl,activeSortable:ac.active,originalEvent:o,oldIndex:Ol,oldDraggableIndex:Nl,newIndex:_l,newDraggableIndex:Al,hideGhostForTarget:oc,unhideGhostForTarget:ic,cloneNowHidden:function(){Sl=!0},cloneNowShown:function(){Sl=!1},dispatchSortableEvent:function(t){gl({sortable:e,name:t,originalEvent:o})}},i))};function gl(t){!function(t){var e=t.sortable,n=t.rootEl,o=t.name,i=t.targetEl,r=t.cloneEl,s=t.toEl,a=t.fromEl,l=t.oldIndex,c=t.newIndex,d=t.oldDraggableIndex,u=t.newDraggableIndex,h=t.originalEvent,p=t.putSortable,f=t.extraEventProperties;if(e=e||n&&n[cl]){var m,g=e.options,v="on"+o.charAt(0).toUpperCase()+o.substr(1);!window.CustomEvent||La||Da?(m=document.createEvent("Event")).initEvent(o,!0,!0):m=new CustomEvent(o,{bubbles:!0,cancelable:!0}),m.to=s||n,m.from=a||n,m.item=i||n,m.clone=r,m.oldIndex=l,m.newIndex=c,m.oldDraggableIndex=d,m.newDraggableIndex=u,m.originalEvent=h,m.pullMode=p?p.lastPutMode:void 0;var b=_a(_a({},f),pl.getEventProperties(o,e));for(var y in b)m[y]=b[y];n&&n.dispatchEvent(m),g[v]&&g[v].call(e,m)}}(_a({putSortable:Tl,cloneEl:xl,targetEl:vl,rootEl:wl,oldIndex:Ol,oldDraggableIndex:Nl,newIndex:_l,newDraggableIndex:Al},t))}var vl,bl,yl,wl,Cl,El,xl,Sl,Ol,_l,Nl,Al,jl,Tl,Pl,Ll,Dl,kl,$l,Il,Ml,Rl,Fl,Wl,Bl,zl=!1,ql=!1,Ul=[],Hl=!1,Xl=!1,Vl=[],Yl=!1,Gl=[],Zl="undefined"!=typeof document,Jl=Ia,Kl=Da||La?"cssFloat":"float",Ql=Zl&&!Ma&&!Ia&&"draggable"in document.createElement("div"),tc=function(){if(Zl){if(La)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),ec=function(t,e){var n=Va(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=Qa(t,0,e),r=Qa(t,1,e),s=i&&Va(i),a=r&&Va(r),l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Ja(i).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Ja(r).width;if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(i&&s.float&&"none"!==s.float){var d="left"===s.float?"left":"right";return!r||"both"!==a.clear&&a.clear!==d?"horizontal":"vertical"}return i&&("block"===s.display||"flex"===s.display||"table"===s.display||"grid"===s.display||l>=o&&"none"===n[Kl]||r&&"none"===n[Kl]&&l+c>o)?"vertical":"horizontal"},nc=function(t){function e(t,n){return function(o,i,r,s){var a=o.options.group.name&&i.options.group.name&&o.options.group.name===i.options.group.name;if(null==t&&(n||a))return!0;if(null==t||!1===t)return!1;if(n&&"clone"===t)return t;if("function"==typeof t)return e(t(o,i,r,s),n)(o,i,r,s);var l=(n?o:i).options.group.name;return!0===t||"string"==typeof t&&t===l||t.join&&t.indexOf(l)>-1}}var n={},o=t.group;o&&"object"==Na(o)||(o={name:o}),n.name=o.name,n.checkPull=e(o.pull,!0),n.checkPut=e(o.put),n.revertClone=o.revertClone,t.group=n},oc=function(){!tc&&yl&&Va(yl,"display","none")},ic=function(){!tc&&yl&&Va(yl,"display","")};Zl&&!Ma&&document.addEventListener("click",(function(t){if(ql)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),ql=!1,!1}),!0);var rc=function(t){if(vl){t=t.touches?t.touches[0]:t;var e=(i=t.clientX,r=t.clientY,Ul.some((function(t){var e=t[cl].options.emptyInsertThreshold;if(e&&!tl(t)){var n=Ja(t),o=i>=n.left-e&&i<=n.right+e,a=r>=n.top-e&&r<=n.bottom+e;return o&&a?s=t:void 0}})),s);if(e){var n={};for(var o in t)t.hasOwnProperty(o)&&(n[o]=t[o]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[cl]._onDragOver(n)}}var i,r,s},sc=function(t){vl&&vl.parentNode[cl]._isOutsideThisEl(t.target)};function ac(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=ja({},e),t[cl]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return ec(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.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:!1!==ac.supportPointer&&"PointerEvent"in window&&!$a,emptyInsertThreshold:5};for(var o in pl.initializePlugins(this,t,n),n)!(o in e)&&(e[o]=n[o]);for(var i in nc(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&Ql,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?Fa(t,"pointerdown",this._onTapStart):(Fa(t,"mousedown",this._onTapStart),Fa(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(Fa(t,"dragover",this),Fa(t,"dragenter",this)),Ul.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),ja(this,dl())}function lc(t,e,n,o,i,r,s,a){var l,c,d=t[cl],u=d.options.onMove;return!window.CustomEvent||La||Da?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=e,l.from=t,l.dragged=n,l.draggedRect=o,l.related=i||e,l.relatedRect=r||Ja(e),l.willInsertAfter=a,l.originalEvent=s,t.dispatchEvent(l),u&&(c=u.call(d,l,s)),c}function cc(t){t.draggable=!1}function dc(){Yl=!1}function uc(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,o=0;n--;)o+=e.charCodeAt(n);return o.toString(36)}function hc(t){return setTimeout(t,0)}function pc(t){return clearTimeout(t)}ac.prototype={constructor:ac,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(Rl=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,vl):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,n=this.el,o=this.options,i=o.preventOnFilter,r=t.type,s=t.touches&&t.touches[0]||t.pointerType&&"touch"===t.pointerType&&t,a=(s||t).target,l=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||a,c=o.filter;if(function(t){Gl.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&Gl.push(o)}}(n),!vl&&!(/mousedown|pointerdown/.test(r)&&0!==t.button||o.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!$a||!a||"SELECT"!==a.tagName.toUpperCase())&&!((a=qa(a,o.draggable,n,!1))&&a.animated||El===a)){if(Ol=el(a),Nl=el(a,o.draggable),"function"==typeof c){if(c.call(this,t,a,this))return gl({sortable:e,rootEl:l,name:"filter",targetEl:a,toEl:n,fromEl:n}),ml("filter",e,{evt:t}),void(i&&t.cancelable&&t.preventDefault())}else if(c&&(c=c.split(",").some((function(o){if(o=qa(l,o.trim(),n,!1))return gl({sortable:e,rootEl:o,name:"filter",targetEl:a,fromEl:n,toEl:n}),ml("filter",e,{evt:t}),!0}))))return void(i&&t.cancelable&&t.preventDefault());o.handle&&!qa(l,o.handle,n,!1)||this._prepareDragStart(t,s,a)}}},_prepareDragStart:function(t,e,n){var o,i=this,r=i.el,s=i.options,a=r.ownerDocument;if(n&&!vl&&n.parentNode===r){var l=Ja(n);if(wl=r,bl=(vl=n).parentNode,Cl=vl.nextSibling,El=n,jl=s.group,ac.dragged=vl,Pl={target:vl,clientX:(e||t).clientX,clientY:(e||t).clientY},$l=Pl.clientX-l.left,Il=Pl.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,vl.style["will-change"]="all",o=function(){ml("delayEnded",i,{evt:t}),ac.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!ka&&i.nativeDraggable&&(vl.draggable=!0),i._triggerDragStart(t,e),gl({sortable:i,name:"choose",originalEvent:t}),Xa(vl,s.chosenClass,!0))},s.ignore.split(",").forEach((function(t){Ga(vl,t.trim(),cc)})),Fa(a,"dragover",rc),Fa(a,"mousemove",rc),Fa(a,"touchmove",rc),Fa(a,"mouseup",i._onDrop),Fa(a,"touchend",i._onDrop),Fa(a,"touchcancel",i._onDrop),ka&&this.nativeDraggable&&(this.options.touchStartThreshold=4,vl.draggable=!0),ml("delayStart",this,{evt:t}),!s.delay||s.delayOnTouchOnly&&!e||this.nativeDraggable&&(Da||La))o();else{if(ac.eventCanceled)return void this._onDrop();Fa(a,"mouseup",i._disableDelayedDrag),Fa(a,"touchend",i._disableDelayedDrag),Fa(a,"touchcancel",i._disableDelayedDrag),Fa(a,"mousemove",i._delayedDragTouchMoveHandler),Fa(a,"touchmove",i._delayedDragTouchMoveHandler),s.supportPointer&&Fa(a,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(o,s.delay)}}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){vl&&cc(vl),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;Wa(t,"mouseup",this._disableDelayedDrag),Wa(t,"touchend",this._disableDelayedDrag),Wa(t,"touchcancel",this._disableDelayedDrag),Wa(t,"mousemove",this._delayedDragTouchMoveHandler),Wa(t,"touchmove",this._delayedDragTouchMoveHandler),Wa(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?Fa(document,"pointermove",this._onTouchMove):Fa(document,e?"touchmove":"mousemove",this._onTouchMove):(Fa(vl,"dragend",this),Fa(wl,"dragstart",this._onDragStart));try{document.selection?hc((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(n){}},_dragStarted:function(t,e){if(zl=!1,wl&&vl){ml("dragStarted",this,{evt:e}),this.nativeDraggable&&Fa(document,"dragover",sc);var n=this.options;!t&&Xa(vl,n.dragClass,!1),Xa(vl,n.ghostClass,!0),ac.active=this,t&&this._appendGhost(),gl({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(Ll){this._lastX=Ll.clientX,this._lastY=Ll.clientY,oc();for(var t=document.elementFromPoint(Ll.clientX,Ll.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Ll.clientX,Ll.clientY))!==e;)e=t;if(vl.parentNode[cl]._isOutsideThisEl(t),e)do{if(e[cl]){if(e[cl]._onDragOver({clientX:Ll.clientX,clientY:Ll.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=za(e));ic()}},_onTouchMove:function(t){if(Pl){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=yl&&Ya(yl,!0),s=yl&&r&&r.a,a=yl&&r&&r.d,l=Jl&&Bl&&nl(Bl),c=(i.clientX-Pl.clientX+o.x)/(s||1)+(l?l[0]-Vl[0]:0)/(s||1),d=(i.clientY-Pl.clientY+o.y)/(a||1)+(l?l[1]-Vl[1]:0)/(a||1);if(!ac.active&&!zl){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<n)return;this._onDragStart(t,!0)}if(yl){r?(r.e+=c-(Dl||0),r.f+=d-(kl||0)):r={a:1,b:0,c:0,d:1,e:c,f:d};var u="matrix(".concat(r.a,",").concat(r.b,",").concat(r.c,",").concat(r.d,",").concat(r.e,",").concat(r.f,")");Va(yl,"webkitTransform",u),Va(yl,"mozTransform",u),Va(yl,"msTransform",u),Va(yl,"transform",u),Dl=c,kl=d,Ll=i}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!yl){var t=this.options.fallbackOnBody?document.body:wl,e=Ja(vl,!0,Jl,!0,t),n=this.options;if(Jl){for(Bl=t;"static"===Va(Bl,"position")&&"none"===Va(Bl,"transform")&&Bl!==document;)Bl=Bl.parentNode;Bl!==document.body&&Bl!==document.documentElement?(Bl===document&&(Bl=Za()),e.top+=Bl.scrollTop,e.left+=Bl.scrollLeft):Bl=Za(),Vl=nl(Bl)}Xa(yl=vl.cloneNode(!0),n.ghostClass,!1),Xa(yl,n.fallbackClass,!0),Xa(yl,n.dragClass,!0),Va(yl,"transition",""),Va(yl,"transform",""),Va(yl,"box-sizing","border-box"),Va(yl,"margin",0),Va(yl,"top",e.top),Va(yl,"left",e.left),Va(yl,"width",e.width),Va(yl,"height",e.height),Va(yl,"opacity","0.8"),Va(yl,"position",Jl?"absolute":"fixed"),Va(yl,"zIndex","100000"),Va(yl,"pointerEvents","none"),ac.ghost=yl,t.appendChild(yl),Va(yl,"transform-origin",$l/parseInt(yl.style.width)*100+"% "+Il/parseInt(yl.style.height)*100+"%")}},_onDragStart:function(t,e){var n=this,o=t.dataTransfer,i=n.options;ml("dragStart",this,{evt:t}),ac.eventCanceled?this._onDrop():(ml("setupClone",this),ac.eventCanceled||((xl=al(vl)).removeAttribute("id"),xl.draggable=!1,xl.style["will-change"]="",this._hideClone(),Xa(xl,this.options.chosenClass,!1),ac.clone=xl),n.cloneId=hc((function(){ml("clone",n),ac.eventCanceled||(n.options.removeCloneOnHide||wl.insertBefore(xl,vl),n._hideClone(),gl({sortable:n,name:"clone"}))})),!e&&Xa(vl,i.dragClass,!0),e?(ql=!0,n._loopId=setInterval(n._emulateDragOver,50)):(Wa(document,"mouseup",n._onDrop),Wa(document,"touchend",n._onDrop),Wa(document,"touchcancel",n._onDrop),o&&(o.effectAllowed="move",i.setData&&i.setData.call(n,o,vl)),Fa(document,"drop",n),Va(vl,"transform","translateZ(0)")),zl=!0,n._dragStartId=hc(n._dragStarted.bind(n,e,t)),Fa(document,"selectstart",n),Ml=!0,$a&&Va(document.body,"user-select","none"))},_onDragOver:function(t){var e,n,o,i,r=this.el,s=t.target,a=this.options,l=a.group,c=ac.active,d=jl===l,u=a.sort,h=Tl||c,p=this,f=!1;if(!Yl){if(void 0!==t.preventDefault&&t.cancelable&&t.preventDefault(),s=qa(s,a.draggable,r,!0),j("dragOver"),ac.eventCanceled)return f;if(vl.contains(t.target)||s.animated&&s.animatingX&&s.animatingY||p._ignoreWhileAnimating===s)return P(!1);if(ql=!1,c&&!a.disabled&&(d?u||(o=bl!==wl):Tl===this||(this.lastPutMode=jl.checkPull(this,c,vl,t))&&l.checkPut(this,c,vl,t))){if(i="vertical"===this._getDirection(t,s),e=Ja(vl),j("dragOverValid"),ac.eventCanceled)return f;if(o)return bl=wl,T(),this._hideClone(),j("revert"),ac.eventCanceled||(Cl?wl.insertBefore(vl,Cl):wl.appendChild(vl)),P(!0);var m=tl(r,a.draggable);if(!m||function(t,e,n){var o=Ja(tl(n.el,n.options.draggable)),i=ll(n.el,n.options,yl),r=10;return e?t.clientX>i.right+r||t.clientY>o.bottom&&t.clientX>o.left:t.clientY>i.bottom+r||t.clientX>o.right&&t.clientY>o.top}(t,i,this)&&!m.animated){if(m===vl)return P(!1);if(m&&r===t.target&&(s=m),s&&(n=Ja(s)),!1!==lc(wl,r,vl,e,s,n,t,!!s))return T(),m&&m.nextSibling?r.insertBefore(vl,m.nextSibling):r.appendChild(vl),bl=r,L(),P(!0)}else if(m&&function(t,e,n){var o=Ja(Qa(n.el,0,n.options,!0)),i=ll(n.el,n.options,yl),r=10;return e?t.clientX<i.left-r||t.clientY<o.top&&t.clientX<o.right:t.clientY<i.top-r||t.clientY<o.bottom&&t.clientX<o.left}(t,i,this)){var g=Qa(r,0,a,!0);if(g===vl)return P(!1);if(n=Ja(s=g),!1!==lc(wl,r,vl,e,s,n,t,!1))return T(),r.insertBefore(vl,g),bl=r,L(),P(!0)}else if(s.parentNode===r){n=Ja(s);var v,b,y,w=vl.parentNode!==r,C=!function(t,e,n){var o=n?t.left:t.top,i=n?t.right:t.bottom,r=n?t.width:t.height,s=n?e.left:e.top,a=n?e.right:e.bottom,l=n?e.width:e.height;return o===s||i===a||o+r/2===s+l/2}(vl.animated&&vl.toRect||e,s.animated&&s.toRect||n,i),E=i?"top":"left",x=Ka(s,"top","top")||Ka(vl,"top","top"),S=x?x.scrollTop:void 0;if(Rl!==s&&(b=n[E],Hl=!1,Xl=!C&&a.invertSwap||w),v=function(t,e,n,o,i,r,s,a){var l=o?t.clientY:t.clientX,c=o?n.height:n.width,d=o?n.top:n.left,u=o?n.bottom:n.right,h=!1;if(!s)if(a&&Wl<c*i){if(!Hl&&(1===Fl?l>d+c*r/2:l<u-c*r/2)&&(Hl=!0),Hl)h=!0;else if(1===Fl?l<d+Wl:l>u-Wl)return-Fl}else if(l>d+c*(1-i)/2&&l<u-c*(1-i)/2)return function(t){return el(vl)<el(t)?1:-1}(e);if((h=h||s)&&(l<d+c*r/2||l>u-c*r/2))return l>d+c/2?1:-1;return 0}(t,s,n,i,C?1:a.swapThreshold,null==a.invertedSwapThreshold?a.swapThreshold:a.invertedSwapThreshold,Xl,Rl===s),0!==v){var O=el(vl);do{O-=v,y=bl.children[O]}while(y&&("none"===Va(y,"display")||y===yl))}if(0===v||y===s)return P(!1);Rl=s,Fl=v;var _=s.nextElementSibling,N=!1,A=lc(wl,r,vl,e,s,n,t,N=1===v);if(!1!==A)return 1!==A&&-1!==A||(N=1===A),Yl=!0,setTimeout(dc,30),T(),N&&!_?r.appendChild(vl):s.parentNode.insertBefore(vl,N?_:s),x&&sl(x,0,S-x.scrollTop),bl=vl.parentNode,void 0===b||Xl||(Wl=Math.abs(b-Ja(s)[E])),L(),P(!0)}if(r.contains(vl))return P(!1)}return!1}function j(a,l){ml(a,p,_a({evt:t,isOwner:d,axis:i?"vertical":"horizontal",revert:o,dragRect:e,targetRect:n,canSort:u,fromSortable:h,target:s,completed:P,onMove:function(n,o){return lc(wl,r,vl,e,n,Ja(n),t,o)},changed:L},l))}function T(){j("dragOverAnimationCapture"),p.captureAnimationState(),p!==h&&h.captureAnimationState()}function P(e){return j("dragOverCompleted",{insertion:e}),e&&(d?c._hideClone():c._showClone(p),p!==h&&(Xa(vl,Tl?Tl.options.ghostClass:c.options.ghostClass,!1),Xa(vl,a.ghostClass,!0)),Tl!==p&&p!==ac.active?Tl=p:p===ac.active&&Tl&&(Tl=null),h===p&&(p._ignoreWhileAnimating=s),p.animateAll((function(){j("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(s===vl&&!vl.animated||s===r&&!s.animated)&&(Rl=null),a.dragoverBubble||t.rootEl||s===document||(vl.parentNode[cl]._isOutsideThisEl(t.target),!e&&rc(t)),!a.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),f=!0}function L(){_l=el(vl),Al=el(vl,a.draggable),gl({sortable:p,name:"change",toEl:r,newIndex:_l,newDraggableIndex:Al,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){Wa(document,"mousemove",this._onTouchMove),Wa(document,"touchmove",this._onTouchMove),Wa(document,"pointermove",this._onTouchMove),Wa(document,"dragover",rc),Wa(document,"mousemove",rc),Wa(document,"touchmove",rc)},_offUpEvents:function(){var t=this.el.ownerDocument;Wa(t,"mouseup",this._onDrop),Wa(t,"touchend",this._onDrop),Wa(t,"pointerup",this._onDrop),Wa(t,"touchcancel",this._onDrop),Wa(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;_l=el(vl),Al=el(vl,n.draggable),ml("drop",this,{evt:t}),bl=vl&&vl.parentNode,_l=el(vl),Al=el(vl,n.draggable),ac.eventCanceled||(zl=!1,Xl=!1,Hl=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),pc(this.cloneId),pc(this._dragStartId),this.nativeDraggable&&(Wa(document,"drop",this),Wa(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),$a&&Va(document.body,"user-select",""),Va(vl,"transform",""),t&&(Ml&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),yl&&yl.parentNode&&yl.parentNode.removeChild(yl),(wl===bl||Tl&&"clone"!==Tl.lastPutMode)&&xl&&xl.parentNode&&xl.parentNode.removeChild(xl),vl&&(this.nativeDraggable&&Wa(vl,"dragend",this),cc(vl),vl.style["will-change"]="",Ml&&!zl&&Xa(vl,Tl?Tl.options.ghostClass:this.options.ghostClass,!1),Xa(vl,this.options.chosenClass,!1),gl({sortable:this,name:"unchoose",toEl:bl,newIndex:null,newDraggableIndex:null,originalEvent:t}),wl!==bl?(_l>=0&&(gl({rootEl:bl,name:"add",toEl:bl,fromEl:wl,originalEvent:t}),gl({sortable:this,name:"remove",toEl:bl,originalEvent:t}),gl({rootEl:bl,name:"sort",toEl:bl,fromEl:wl,originalEvent:t}),gl({sortable:this,name:"sort",toEl:bl,originalEvent:t})),Tl&&Tl.save()):_l!==Ol&&_l>=0&&(gl({sortable:this,name:"update",toEl:bl,originalEvent:t}),gl({sortable:this,name:"sort",toEl:bl,originalEvent:t})),ac.active&&(null!=_l&&-1!==_l||(_l=Ol,Al=Nl),gl({sortable:this,name:"end",toEl:bl,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){ml("nulling",this),wl=vl=bl=yl=Cl=xl=El=Sl=Pl=Ll=Ml=_l=Al=Ol=Nl=Rl=Fl=Tl=jl=ac.dragged=ac.ghost=ac.clone=ac.active=null,Gl.forEach((function(t){t.checked=!0})),Gl.length=Dl=kl=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":vl&&(this._onDragOver(t),function(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move");t.cancelable&&t.preventDefault()}(t));break;case"selectstart":t.preventDefault()}},toArray:function(){for(var t,e=[],n=this.el.children,o=0,i=n.length,r=this.options;o<i;o++)qa(t=n[o],r.draggable,this.el,!1)&&e.push(t.getAttribute(r.dataIdAttr)||uc(t));return e},sort:function(t,e){var n={},o=this.el;this.toArray().forEach((function(t,e){var i=o.children[e];qa(i,this.options.draggable,o,!1)&&(n[t]=i)}),this),e&&this.captureAnimationState(),t.forEach((function(t){n[t]&&(o.removeChild(n[t]),o.appendChild(n[t]))})),e&&this.animateAll()},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,e){return qa(t,e||this.options.draggable,this.el,!1)},option:function(t,e){var n=this.options;if(void 0===e)return n[t];var o=pl.modifyOption(this,t,e);n[t]=void 0!==o?o:e,"group"===t&&nc(n)},destroy:function(){ml("destroy",this);var t=this.el;t[cl]=null,Wa(t,"mousedown",this._onTapStart),Wa(t,"touchstart",this._onTapStart),Wa(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(Wa(t,"dragover",this),Wa(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),(function(t){t.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),Ul.splice(Ul.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!Sl){if(ml("hideClone",this),ac.eventCanceled)return;Va(xl,"display","none"),this.options.removeCloneOnHide&&xl.parentNode&&xl.parentNode.removeChild(xl),Sl=!0}},_showClone:function(t){if("clone"===t.lastPutMode){if(Sl){if(ml("showClone",this),ac.eventCanceled)return;vl.parentNode!=wl||this.options.group.revertClone?Cl?wl.insertBefore(xl,Cl):wl.appendChild(xl):wl.insertBefore(xl,vl),this.options.group.revertClone&&this.animate(vl,xl),Va(xl,"display",""),Sl=!1}}else this._hideClone()}},Zl&&Fa(document,"touchmove",(function(t){(ac.active||zl)&&t.cancelable&&t.preventDefault()})),ac.utils={on:Fa,off:Wa,css:Va,find:Ga,is:function(t,e){return!!qa(t,e,t,!1)},extend:function(t,e){if(t&&e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t},throttle:rl,closest:qa,toggleClass:Xa,clone:al,index:el,nextTick:hc,cancelNextTick:pc,detectDirection:ec,getChild:Qa,expando:cl},ac.get=function(t){return t[cl]},ac.mount=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];e[0].constructor===Array&&(e=e[0]),e.forEach((function(t){if(!t.prototype||!t.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(t));t.utils&&(ac.utils=_a(_a({},ac.utils),t.utils)),pl.mount(t)}))},ac.create=function(t,e){return new ac(t,e)},ac.version="1.15.3";var fc,mc,gc,vc,bc,yc,wc=[],Cc=!1;function Ec(){wc.forEach((function(t){clearInterval(t.pid)})),wc=[]}function xc(){clearInterval(yc)}var Sc=rl((function(t,e,n,o){if(e.scroll){var i,r=(t.touches?t.touches[0]:t).clientX,s=(t.touches?t.touches[0]:t).clientY,a=e.scrollSensitivity,l=e.scrollSpeed,c=Za(),d=!1;mc!==n&&(mc=n,Ec(),fc=e.scroll,i=e.scrollFn,!0===fc&&(fc=ol(n,!0)));var u=0,h=fc;do{var p=h,f=Ja(p),m=f.top,g=f.bottom,v=f.left,b=f.right,y=f.width,w=f.height,C=void 0,E=void 0,x=p.scrollWidth,S=p.scrollHeight,O=Va(p),_=p.scrollLeft,N=p.scrollTop;p===c?(C=y<x&&("auto"===O.overflowX||"scroll"===O.overflowX||"visible"===O.overflowX),E=w<S&&("auto"===O.overflowY||"scroll"===O.overflowY||"visible"===O.overflowY)):(C=y<x&&("auto"===O.overflowX||"scroll"===O.overflowX),E=w<S&&("auto"===O.overflowY||"scroll"===O.overflowY));var A=C&&(Math.abs(b-r)<=a&&_+y<x)-(Math.abs(v-r)<=a&&!!_),j=E&&(Math.abs(g-s)<=a&&N+w<S)-(Math.abs(m-s)<=a&&!!N);if(!wc[u])for(var T=0;T<=u;T++)wc[T]||(wc[T]={});wc[u].vx==A&&wc[u].vy==j&&wc[u].el===p||(wc[u].el=p,wc[u].vx=A,wc[u].vy=j,clearInterval(wc[u].pid),0==A&&0==j||(d=!0,wc[u].pid=setInterval(function(){o&&0===this.layer&&ac.active._onTouchMove(bc);var e=wc[this.layer].vy?wc[this.layer].vy*l:0,n=wc[this.layer].vx?wc[this.layer].vx*l:0;"function"==typeof i&&"continue"!==i.call(ac.dragged.parentNode[cl],n,e,t,bc,wc[this.layer].el)||sl(wc[this.layer].el,n,e)}.bind({layer:u}),24))),u++}while(e.bubbleScroll&&h!==c&&(h=ol(h,!1)));Cc=d}}),30),Oc=function(t){var e=t.originalEvent,n=t.putSortable,o=t.dragEl,i=t.activeSortable,r=t.dispatchSortableEvent,s=t.hideGhostForTarget,a=t.unhideGhostForTarget;if(e){var l=n||i;s();var c=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e,d=document.elementFromPoint(c.clientX,c.clientY);a(),l&&!l.el.contains(d)&&(r("spill"),this.onSpill({dragEl:o,putSortable:n}))}};function _c(){}function Nc(){}_c.prototype={startIndex:null,dragStart:function(t){var e=t.oldDraggableIndex;this.startIndex=e},onSpill:function(t){var e=t.dragEl,n=t.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var o=Qa(this.sortable.el,this.startIndex,this.options);o?this.sortable.el.insertBefore(e,o):this.sortable.el.appendChild(e),this.sortable.animateAll(),n&&n.animateAll()},drop:Oc},ja(_c,{pluginName:"revertOnSpill"}),Nc.prototype={onSpill:function(t){var e=t.dragEl,n=t.putSortable||this.sortable;n.captureAnimationState(),e.parentNode&&e.parentNode.removeChild(e),n.animateAll()},drop:Oc},ja(Nc,{pluginName:"removeOnSpill"}),ac.mount(new function(){function t(){for(var t in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===t.charAt(0)&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}return t.prototype={dragStarted:function(t){var e=t.originalEvent;this.sortable.nativeDraggable?Fa(document,"dragover",this._handleAutoScroll):this.options.supportPointer?Fa(document,"pointermove",this._handleFallbackAutoScroll):e.touches?Fa(document,"touchmove",this._handleFallbackAutoScroll):Fa(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(t){var e=t.originalEvent;this.options.dragOverBubble||e.rootEl||this._handleAutoScroll(e)},drop:function(){this.sortable.nativeDraggable?Wa(document,"dragover",this._handleAutoScroll):(Wa(document,"pointermove",this._handleFallbackAutoScroll),Wa(document,"touchmove",this._handleFallbackAutoScroll),Wa(document,"mousemove",this._handleFallbackAutoScroll)),xc(),Ec(),clearTimeout(Ua),Ua=void 0},nulling:function(){bc=mc=fc=Cc=yc=gc=vc=null,wc.length=0},_handleFallbackAutoScroll:function(t){this._handleAutoScroll(t,!0)},_handleAutoScroll:function(t,e){var n=this,o=(t.touches?t.touches[0]:t).clientX,i=(t.touches?t.touches[0]:t).clientY,r=document.elementFromPoint(o,i);if(bc=t,e||this.options.forceAutoScrollFallback||Da||La||$a){Sc(t,this.options,r,e);var s=ol(r,!0);!Cc||yc&&o===gc&&i===vc||(yc&&xc(),yc=setInterval((function(){var r=ol(document.elementFromPoint(o,i),!0);r!==s&&(s=r,Ec()),Sc(t,n.options,r,e)}),10),gc=o,vc=i)}else{if(!this.options.bubbleScroll||ol(r,!0)===Za())return void Ec();Sc(t,this.options,ol(r,!1),!1)}}},ja(t,{pluginName:"scroll",initializeByDefault:!0})}),ac.mount(Nc,_c);const Ac={add:{attr:t=>{const e=window.prompt(t.message.attr);if(e&&t.isDisabled(e))return window.alert(r.get("attributeNotPermitted",e||"")),jc.add.attrs(t);let n;e&&(n=String(window.prompt(t.message.value,"")),t.addAction(e,n))},option:t=>{t.addAction()},condition:t=>{t.addAction(t)}},click:{btn:t=>{t.action()}},save:{form:tr}},jc={init:function(t){const e=Object.keys(Ac);return this.opts=e.reduce(((e,n)=>(e[n]={...Ac[n],...t[n]},e)),t),this},add:{attrs:t=>jc.opts.add.attr(t),options:t=>jc.opts.add.option(t),conditions:t=>(t.template={if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]},jc.opts.add.condition(t))},click:{btn:t=>jc.opts.click.btn(t)},save:{form:t=>(jc.opts.sessionStorage&&Zi.set(B,t),os.formeoSaved({formData:t}),jc.opts.save.form(t))}},Tc=Object.freeze({type:"field",displayType:"slider"}),Pc=t=>({transform:`translateX(${t?`${t}px`:0})`});class Lc{constructor(t){n(this,"toggleTabbedLayout",(()=>{this.getPanelDisplay();const t=this.isTabbed;return this.panelsWrap.parentElement.classList.toggle("tabbed-panels",t),t&&this.panelNav.removeAttribute("style"),t})),n(this,"resizePanels",(()=>{this.toggleTabbedLayout();const t=this.panelsWrap.style,e=qd.getStyle(this.currentPanel,"height");return t.height=e,e})),this.opts=Xi(Tc,t),this.panelDisplay=this.opts.displayType,this.activePanelIndex=0,this.panelNav=this.createPanelNav();const e=this.createPanelsWrap();this.nav=this.navActions();const o=new window.ResizeObserver((([{contentRect:{width:t}}])=>{this.currentWidth!==t&&(this.toggleTabbedLayout(),this.currentWidth=t,this.nav.setTranslateX(this.activePanelIndex,!1))})),i=window.setTimeout((()=>{o.observe(e),window.clearTimeout(i)}),H)}getPanelDisplay(){const t=this.panelsWrap,e=Number.parseInt(qd.getStyle(t,"width"))>390?"tabbed":"slider",n="auto"===this.opts.displayType;return this.panelDisplay=n?e:this.opts.displayType||Tc.displayType,this.panelDisplay}createPanelsWrap(){const t=qd.create({className:"panels",content:this.opts.panels.map((({config:t,...e})=>e))});return"field"===this.opts.type&&this.sortableProperties(t),this.panelsWrap=t,this.panels=t.children,this.currentPanel=this.panels[this.activePanelIndex],t}sortableProperties(t){const e=t.getElementsByClassName("field-edit-group");return Kr.forEach(e,(t=>{t.fieldId=this.opts.id,t.isSortable&&ac.create(t,{animation:150,group:{name:`edit-${t.editGroup}`,pull:!0,put:["properties"]},sort:!0,handle:".prop-order",onSort:t=>{this.propertySave(t.to),this.resizePanels()}})}))}createPanelNavLabels(){const t=this.opts.panels.map((t=>({tag:"h5",action:{click:t=>{const e=Hr(t.target,t.target.parentElement);this.nav.setTranslateX(e,!1),this.nav.groupChange(e)}},content:t.config.label}))),e={className:"panel-labels",content:{content:t}},[n]=t;return n.className="active-tab",qd.create(e)}createPanelNav(){this.labels=this.createPanelNavLabels();const t={tag:"button",attrs:{className:"next-group",title:r.get("controlGroups.nextGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.nextGroup(t)},content:qd.icon("triangle-right")},e={tag:"button",attrs:{className:"prev-group",title:r.get("controlGroups.prevGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.prevGroup(t)},content:qd.icon("triangle-left")};return qd.create({tag:"nav",attrs:{className:"panel-nav"},content:[e,this.labels,t]})}get isTabbed(){return"tabbed"===this.panelDisplay}navActions(){const t={},e=this.currentPanel.parentElement,n=this.labels.firstChild,o=n.children,i=this.currentPanel.parentElement.childNodes;this.activePanelIndex=Hr(this.currentPanel,e);let r={nav:0,panel:0},s={...r};t.groupChange=t=>(this.activePanelIndex=t,this.currentPanel=i[t],qd.removeClasses(i,"active-panel"),qd.removeClasses(o,"active-tab"),this.currentPanel.classList.add("active-panel"),o[t].classList.add("active-tab"),this.currentPanel);const a=({offset:t,reset:o,duration:i=U,animate:r=!this.isTabbed})=>{const a=[Pc(s.panel),Pc(t.panel)],l=[Pc(s.nav),Pc(this.isTabbed?0:t.nav)];if(o){const[t]=a,[e]=l;a.push(t),l.push(e)}const c={easing:"ease-in-out",duration:r?i:0,fill:"forwards"},d=e.animate(a,c);n.animate(l,c);const u=()=>{this.panelsWrap.style.height=qd.getStyle(this.currentPanel,"height"),d.removeEventListener("finish",u),o||(s=t)};d.addEventListener("finish",u)};return t.setTranslateX=(t=this.activePanelIndex,o=!0)=>{var i;i=t,r={nav:-n.offsetWidth*i,panel:-e.offsetWidth*i},a({offset:r,animate:o})},t.refresh=(e=this.activePanelIndex)=>{this.activePanelIndex!==e&&t.groupChange(e),t.setTranslateX(this.activePanelIndex,!1),this.resizePanels()},t.nextGroup=()=>{const e=this.activePanelIndex+1;if(e!==i.length){const o=i[e];r={nav:-n.offsetWidth*e,panel:-o.offsetLeft},a({offset:r}),t.groupChange(e)}else r={nav:s.nav-8,panel:s.panel-8},a({offset:r,reset:!0});return this.currentPanel},t.prevGroup=()=>{if(0!==this.activePanelIndex){const e=this.activePanelIndex-1,o=i[e];r={nav:-n.offsetWidth*e,panel:-o.offsetLeft},a({offset:r}),t.groupChange(e)}else r={nav:8,panel:8},a({offset:r,reset:!0})},t}}const Dc="a an and as at but by for for from in into near nor of on onto or the to with".split(" ").map((t=>`\\s${t}\\s`)),kc=new RegExp(`(?!${Dc.join("|")})\\w\\S*`,"g"),$c=/\s+/g;function Ic(t){if("string"!=typeof t)return t;if(t.trim().match($c))return t;return t.replace(kc,(t=>t.charAt(0).toUpperCase()+t.substring(1).replace(/[A-Z]/g,(t=>` ${t}`))))}const Mc=(t,e="-")=>t.toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,e),Rc="f-autocomplete",Fc="highlight-component",Wc=({name:t,id:e,...n})=>["config.label","config.controlId","meta.id","attrs.id"].reduce(((t,e)=>t||n.get(e)),null)||"external"===t&&((...t)=>r.get(t.join("."))||Ic(t.join(" ")))(t,e);class Bc{constructor(t,e,o){n(this,"lastCache",Date.now()),n(this,"optionsCache",null),this.key=t,this.className=t.replace(/\./g,"-"),this.value=e,this.events=[],this.i18nKey=o,this.build()}build(){const t=t=>{const e=this.list,n=this.getActiveOption();let o=new Map([[38,()=>{const t=this.getPreviousOption(n);t&&this.selectOption(t)}],[40,()=>{const t=this.getNextOption(n);t&&this.selectOption(t)}],[13,()=>{n&&(this.selectOption(n),this.setValue(n),"none"===e.style.display?this.showList(n):this.hideList()),t.preventDefault()}],[27,()=>{this.hideList()}]]).get(t.keyCode);return o||(o=()=>!1),o()},e={focus:({target:e})=>{this.updateOptions(),e.parentElement.classList.add(`${this.className}-focused`);const n=qd.toggleElementsByStr(this.list.querySelectorAll("li"),e.value);e.addEventListener("keydown",t);const o=this.list.querySelector(".active-option")||n[0];this.showList(o)},blur:({target:e})=>{e.parentElement.classList.remove(`${this.className}-focused`),e.removeEventListener("keydown",t),this.hideList()},input:t=>{const e=qd.toggleElementsByStr(this.list.querySelectorAll("li"),t.target.value);if(0===t.target.value.length&&this.clearValue(),0===e.length)this.hideList();else{const t=this.getActiveOption()||e[0];this.showList(t)}const n=t.target.value.trim();this.hiddenField.value=n,this.value=n,this.setValue({dataset:{label:n,value:n}})}};return this.displayField=qd.create({tag:"input",autocomplete:"off",action:e,attrs:{type:"text",className:`${Rc}-display-field`,value:this.label||this.value,placeholder:r.get(`${this.i18nKey}.${this.key}.placeholder`)}}),this.hiddenField=qd.create({tag:"input",attrs:{type:"hidden",className:this.className,value:this.value}}),this.list=qd.create({tag:"ul",attrs:{className:`${Rc}-list`}}),this.dom=qd.create({children:[this.displayField,this.hiddenField],className:this.className,action:{onRender:t=>{this.stage=t.closest(".formeo-stage");const e=this.value&&Wd.getAddress(this.value);this.label=e&&Wc(e),this.label&&(this.displayField.value=this.label)}}}),this.dom}updateOptions(){let t=this.optionsCache;const e=Date.now();(!t||e-this.lastCache>10*H)&&(qd.empty(this.list),t=this.generateOptions(),this.lastCache=e),this.list.children.length||this.list.append(...t)}generateOptions(){const t=(t=>{const e=[],n=Wd.flatList(),o=Object.entries(n).map((([n,o])=>{const i=Wc(o);if(i){const r={tag:"span",content:` ${Ic(o.name)}`,className:"component-type"},s=`${o.name}.${i}`;e.push(s);const a=((t,e)=>{const n=t.reduce(((t,n)=>t+(n===e)),0);return n>1?`(${n})`:""})(e,s),l=[`${i} `,{tag:"span",content:a,className:"component-label-count"},r];return(({id:t,textLabel:e,htmlLabel:n,selectedId:o})=>{const i={value:t,textLabel:e,htmlLabel:n};return t===o&&(i.selected=!0),i})({id:n,textLabel:[i,a].join(" ").trim(),htmlLabel:l,selectedId:t})}}));return o.filter(Boolean)})(),e=t=>{const e=`${Rc}-list-item`;return t.classList.contains(e)||(t=t.parentElement),t};return this.optionsCache=t.map((t=>{const{value:n,textLabel:o,htmlLabel:i}=t,r={tag:"li",children:i,dataset:{value:n,label:o},className:`${Rc}-list-item`,action:{mousedown:({target:t})=>{t=e(t),this.setValue(t),this.selectOption(t),this.hideList()},mouseover:({target:t})=>{t=e(t),this.removeHighlight(),this.highlightComponent(t)}}};return qd.create(r)})),this.optionsCache}setListPosition(){const{offsetHeight:t,offsetWidth:e}=this.displayField,n=this.displayField.closest(".formeo-stage").getBoundingClientRect(),o=this.displayField.getBoundingClientRect(),i={position:"absolute",top:o.y+t+window.scrollY-n.y+"px",left:o.x+window.scrollX-n.x+"px",width:`${e+1}px`};Object.assign(this.list.style,i)}showList(t,e=this.list){this.stage.contains(this.list)||this.stage.appendChild(this.list),this.setListPosition(),this.selectOption(t),Qr.slideDown(e,U)}hideList(t=this.list){Qr.slideUp(t,U),this.removeHighlight(),this.stage.contains(this.list)&&this.stage.removeChild(this.list)}getActiveOption(t=this.list){const e=t.querySelector(".active-option");return"none"!==(null==e?void 0:e.style.display)?e:null}getPreviousOption(t){let e=t;do{e=e?e.previousSibling:null}while(null!=e&&"none"===e.style.display);return e}getNextOption(t){let e=t;do{e=e?e.nextSibling:null}while(null!=e&&"none"===e.style.display);return e}selectOption(t,e=this.list){var n;const o=e.querySelectorAll("li");for(const i of o){const{dataset:{value:t}}=i;if(i.classList.remove("active-option"),t){null==(n=Wd.getAddress(t).dom)||n.classList.remove(Fc)}}t&&(t.classList.add("active-option"),this.highlightComponent(t))}removeHighlight(){const t=document.getElementsByClassName(Fc);for(const e of t)e.classList.remove(Fc)}highlightComponent(t){var e;const{dataset:{value:n}}=t;if(n){null==(e=Wd.getAddress(n).dom)||e.classList.add(Fc)}}clearValue(){this.selectOption(null),this.displayField.value="",this.hiddenField.value="",this.value="",this.runEvent("onChange",{target:this.hiddenField})}setValue(t){const{label:e,value:n}=t.dataset;this.displayField.value=e,this.hiddenField.value=n,this.value=n,this.runEvent("onChange",{target:this.hiddenField})}addEvent(t,e){this.events.push([t,e])}runEvent(t,e){for(const[n,o]of this.events)n===t&&o(e)}}const zc=(t,e)=>{const n=(t=>{const e=Ki(t),n={"field.property":Z,...J},o=e?(i=t,Wd.getAddress(i).getData()):n[t];var i;return Object.keys(o).reduce(((t,e)=>(t[e]=e,t)),{})})(t);return Object.entries(n).reduce(((n,[o,i])=>{if("id"!==o){const s={tag:"option",content:r.get(`${t}.${o}`)||o.toLowerCase(),attrs:{value:i}};e===i&&(s.attrs.selected=!0),n.push(qd.create(s))}return n}),[])},qc=(t,e)=>{qd.empty(t);for(const n of e)t.add(n)},Uc=({key:t,value:e,type:n="text",checked:o})=>{const i={tag:"input",attrs:{type:n,value:e,placeholder:r.get(`${t}.placeholder`)||Ic(t)},className:t.replace(/\./g,"-"),config:{}};return o&&(i.attrs.checked=!0),i},Hc=t=>{const e=r.get(t);if(e)return e;const n=t.split(".");return r.get(n[n.length-1])},Xc={autocomplete:(t,e,n)=>new Bc(t,e,n),string:(t,e)=>Uc({key:t,value:e}),boolean:(t,e)=>Uc({key:t,value:e,type:"selected"===t?"radio":"checkbox",checked:e}),number:(t,e)=>Uc({key:t,value:e,type:"number"}),array:(t,e=[])=>({tag:"select",attrs:{placeholder:Hc(`placeholder.${t}`)},className:t.replace(/\./g,"-"),options:e}),object:t=>Object.entries(t).map((([t,e])=>Xc[qd.childType(e)](t,e)))},Vc=["selected","checked"],Yc={boolean:(t,e)=>({click:({target:{checked:n}})=>{var o,i;"radio"===(null==(i=null==(o=e.data)?void 0:o.attrs)?void 0:i.type)&&e.set("options",e.data.options.map((t=>({...t,selected:!1})))),e.set(t,n)}}),string:(t,e)=>({input:({target:{value:n}})=>{e.set(t,n)}}),number:(t,e)=>({input:({target:{value:n}})=>{e.set(t,Number(n))}}),array:(t,e)=>({change:({target:{value:n}})=>{e.set(t,n)}}),object:()=>({})};class Gc{constructor({key:t,data:e,index:o,field:i}){n(this,"generateConditionFields",((t,e)=>{const n={tag:"label",className:`condition-label ${t}-condition-label`,content:r.get(t)||t};return e.map(((e,o)=>{const i=[],r=Object.entries(e).map((([e,n])=>{const r=this.conditionInput(e,n,t,o);return r&&i.push([r.className,n.trim()].filter(Boolean).join("-")),r})).filter(Boolean),s=Xr(r,G.map((t=>`condition-${t}`)),"className||dom.className");return this.processConditionUIState(s),o||s.unshift(n),this.itemFieldGroups.push(s),{children:s,className:`f-condition-row ${t}-condition-row ${i.join(" ")}`}}))})),n(this,"processConditionUIState",(t=>{const e=e=>(e=e.split("|"),t.filter((t=>e.includes(t.className)))),n=t=>{t=Array.isArray(t)?t:[t];const e=setTimeout((()=>{t.forEach((t=>{t.dom&&(t=t.dom),t.style.display="none"})),clearTimeout(e)}),q)},o=t=>{t=Array.isArray(t)?t:[t];const e=setTimeout((()=>{t.forEach((t=>{t.dom&&(t=t.dom),t.removeAttribute("style")})),clearTimeout(e)}),q)},i=new Map([["condition-source",t=>{const i=e("condition-sourceProperty"),r=i[0],s=Ki(t.value)?t.value:"field.property",a=zc(s,r.value);return qc(r,a),t.value?o(i):n(i)}],["condition-target",t=>{const i=e("condition-targetProperty");return Ji(t.value)&&t.value?o(i):n(i)}],["condition-sourceProperty",t=>{const i=e("condition-comparison|condition-targetProperty|condition-target"),r=t.value;return(t=>/^is|^has/.test(t))(r.substring(r.lastIndexOf(".")+1,r.length))?n(i):o(i)}]]);for(const r of t){const t=i.get(r.className);t&&t(r)}})),n(this,"conditionInput",((t,e,n,o)=>{const i=this.field,r=`${this.itemKey}.${n}.${o}`,s=`${this.field.id}.${r}`,a=`${i.name}s.${s}.${t}`,l=(t,e,n)=>{const o=zc(n||t,e),i=Xc.array(`condition.${t}`);i.action={change:c,onRender:t=>c({target:t})};const r=qd.create(i);return qc(r,o),r},c=({target:t})=>{const e=t.closest(".f-condition-row"),n=new RegExp(`${t.className}(?:\\S?)+`,"gm");e.className=e.className.replace(n,"");const o={dataPath:a,value:t.value,src:t};os.formeoUpdated(o),Wd.setAddress(a,t.value);const i=Hr(e);this.processConditionUIState(this.itemFieldGroups[i])},d={comparison:t=>l("comparison",t),logical:t=>l("logical",t),source:(t,e="source")=>{const o=Xc.autocomplete(`condition.${e}`,t,n);return Wd.setConditionMap(t,i),o.addEvent("onChange",(t=>{Wd.removeConditionMap(Wd.getAddress(a)),c(t),Wd.setConditionMap(t.target.value,i)})),o},sourceProperty:t=>l("sourceProperty",t,"field.property"),targetProperty:t=>l("targetProperty",t,"field.property"),target:t=>d.source(t,"target"),value:t=>{const e=Xc.string("condition.value",t);return e.action={input:c},qd.create(e)},assignment:t=>l("assignment",t)};if(d[t])return d[t](e)})),this.itemValues=Xr(Object.entries(e),Vc,"0");const[s,a]=t.split(".");this.field=i,this.itemKey=t,this.itemIndex=o,this.panelName=s,this.isDisabled=i.isDisabledProp(a,s),this.isHidden=this.isDisabled&&i.config.panels[s].hideDisabled,this.isLocked=i.isLockedProp(a,s),this.dom=qd.create({tag:"li",className:[`field-${t.replace(/\./g,"-")}`,"prop-wrap",this.isHidden&&"hidden-property"],children:{className:"field-prop",children:[this.itemInputs,this.itemControls]}})}get itemInputs(){this.itemFieldGroups=[];return{className:`${this.panelName}-prop-inputs prop-inputs f-input-group`,children:this.itemValues.map((([t,e])=>{let n="conditions"===this.panelName?this.generateConditionFields(t,e):this.itemInput(t,e);return["selected","checked"].includes(t)&&(n={className:"f-addon",children:n}),n}))}}get itemControls(){if(this.isLocked){return{className:`${this.panelName}-prop-controls prop-controls`,content:[]}}const t={tag:"button",attrs:{type:"button",className:"prop-remove prop-control"},action:{click:()=>{Qr.slideUp(this.dom,250,(t=>{this.field.remove(this.itemKey),qd.remove(t),this.field.resizePanelWrap()}))}},content:qd.icon("remove")};return{className:`${this.panelName}-prop-controls prop-controls`,content:[t]}}itemInput(t,e){const n=qd.childType(e)||"string",o={config:{},attrs:{},...Xc[n](t,e)},i=this.itemKey.replace(/.\d+$/,(e=>`${e}.${t}`)),r=i.split(".").filter(Number.isNaN).join(".")||t,[s,a]=[[...this.itemKey.split("."),t],[t]].map((t=>[this.field.id,...t].filter(Boolean).join("-")));return o.config={...o.config,label:"options"!==this.panelName&&(Hc(r)||Ic(r)),labelAfter:!1},o.attrs={...o.attrs,name:"checkbox"===o.attrs.type?`${a}[]`:a,id:s,disabled:this.isDisabled,locked:this.isLocked},o.action={...Yc[n](i,this.field)},o}}class Zc{constructor(t,e,o){n(this,"addAttribute",((t,e)=>{let n=e;const o=Mc(t),i=`attrs.${o}`;r.current[i]||r.put(i,Zr(t)),"string"==typeof n&&["true","false"].includes(n)&&(n=JSON.parse(n)),this.field.set(`attrs.${t}`,n);const s=this.props.querySelector(`.field-attrs-${o}`),a=new Gc({key:i,data:{[o]:n},field:this.field});s?this.props.replaceChild(a.dom,s):this.props.appendChild(a.dom),this.field.resizePanelWrap()})),n(this,"addOption",(()=>{const t=this.field.data.config.controlId,e=this.field.get("options"),n="select"===t?"option":t,o=r.get("newOptionLabel",{type:n})||"New Option",i=`options.${this.data.length}`,s=e[e.length-1],a={...e.length?s:{},label:o};"button"!==t&&(a.value=Mc(o));const l=new Gc({key:i,data:a,field:this.field,index:this.props.children.length});this.editPanelItems.push(l),this.props.appendChild(l.dom),this.field.set(i,a),this.field.resizePanelWrap()})),n(this,"addCondition",(t=>{const e=`conditions.${this.field.get("conditions").length}`,n=this.props.querySelector(`.field-${e.replace(".","-")}`),o=new Gc({key:e,data:t.template,field:this.field});n?this.props.replaceChild(o.dom,n):this.props.appendChild(o.dom),this.field.set(e,t.template),this.field.resizePanelWrap()})),this.type=qd.childType(t),this.data="object"===this.type?Object.entries(t):t,this.name=e,this.field=o,this.panelConfig=this.getPanelConfig(this.data)}getPanelConfig(t){return this.props=this.createProps(t),this.editButtons=this.createEditButtons(),{id:`${this.field.id}-${this.name}-panel`,config:{label:r.get(`panel.label.${this.name}`)},attrs:{className:`f-panel ${this.name}-panel`},children:[this.props,this.editButtons]}}createProps(t){this.editPanelItems=Array.from(t).map(((t,e)=>{const n="array"===this.type,o=[this.name,n?String(e):t[0]].join("."),i=n?t:{[t[0]]:t[1]};return new Gc({key:o,data:i,field:this.field})}));const e={tag:"ul",attrs:{className:["field-edit-group",`field-edit-${this.name}`]},editGroup:this.name,isSortable:"options"===this.name,content:this.editPanelItems};return qd.create(e)}createEditButtons(){const t=this,e=this.name,n=r.get(`panelEditButtons.${e}`),o={attrs:t.addAttribute,options:t.addOption,conditions:t.addCondition};return{className:"panel-action-buttons",content:[{...qd.btnTemplate({content:n,title:n}),className:`add-${e}`,action:{click:n=>{const i={btnCoords:qd.coords(n.target),addAction:o[e]};"attrs"===e&&(i.isDisabled=t.field.isDisabledProp,i.isLocked=t.field.isLockedProp,i.message={attr:r.get(`action.add.${e}.attr`),value:r.get(`action.add.${e}.value`)});const s=Ic(e),a=new window.CustomEvent(`onAdd${s}`,{detail:i});jc.add[e](i),document.dispatchEvent(a)}}}]}}}class Jc extends Sa{constructor(t,e={},o){const i={...e,id:e.id||Hi()};super(t,i),n(this,"mutationHandler",(t=>t.map((t=>{})))),n(this,"remove",(t=>{if(t){const e=t.split("."),n=e.pop(),o=this.get(e);return Array.isArray(o)?Ur(n)?o.splice(Number(n),1):this.set(e,o.filter((t=>t!==n))):delete o[n],o}if("stage"===this.name)return null;const e=this.parent,n=this.children;return Vr(n,(t=>t.remove())),this.dom.parentElement.removeChild(this.dom),((t,e)=>{const n=t.indexOf(e);-1!==n&&t.splice(n,1)})(Wd.getAddress(`${e.name}s.${e.id}.children`),this.id),e.children.length||e.emptyClass(),"row"===e.name&&e.autoColumnWidths(),Wd[`${this.name}s`].delete(this.id)})),n(this,"emptyClass",(()=>this.dom.classList.toggle("empty",!this.children.length))),n(this,"getComponentTag",(()=>qd.create({tag:"span",className:["component-tag",`${this.name}-tag`],children:[(this.isColumn||this.isField)&&qd.icon("component-corner",{className:"bottom-left"}),qd.icon(`handle-${this.name}`),Ic(this.name),(this.isColumn||this.isRow)&&qd.icon("component-corner",{className:"bottom-right"})].filter(Boolean)}))),n(this,"removeClasses",(t=>{const e={string:()=>this.dom.classList.remove(t),array:()=>t.map((t=>this.dom.classList.remove(t)))};return e.object=e.string,e[qd.childType(t)](this.dom)})),n(this,"loadChildren",((t=this.data.children)=>t.map((t=>this.addChild({id:t}))))),n(this,"saveChildOrder",(()=>{if(this.render)return;const t=this.children.map((({id:t})=>t));return this.set("children",t),t})),n(this,"onSort",(()=>this.saveChildOrder())),n(this,"onEnd",(({to:{parentElement:t},from:{parentElement:e}})=>{null==t||t.classList.remove(`hovering-${qi(t)}`),null==e||e.classList.remove(`hovering-${qi(e)}`)})),n(this,"runConditions",(()=>{const t=this.get("conditions");if(!(null==t?void 0:t.length))return null;return t.map((t=>{const e=this.processConditions(t.if),n=this.processResults(t.then);return e.map((t=>this.evaluateConditions(t)&&this.execResults(n)))}))})),n(this,"value",((t,e)=>{const n=t.split("."),o=this.getComponent(t),i=o&&n.slice(2,n.length).join(".");return[!o,!i,!Z[i]].some(Boolean)?t:e?o.set(Z[i],e):o.get(Z[i])})),n(this,"getResult",(t=>({"=":(t,e,n)=>t.set(e,n)}[t]))),n(this,"processResults",(t=>t.map((({operator:t,target:e,value:n})=>{const o=this.getComponent(e);return{target:o,propertyPath:o&&e.split(".").slice(2,e.length).join("."),action:this.getResult(t),value:this.value(n)}})))),n(this,"execResults",(t=>{const e=t.map((t=>this.execResult(t)));return Promise.all(e)})),n(this,"execResult",(({target:t,action:e,value:n,propertyPath:o})=>new Promise(((o,i)=>{try{return o(e(t,n))}catch(r){return i(r)}})))),n(this,"cloneData",(()=>{const t={...Vi(this.data),id:Hi()};return"field"!==this.name&&(t.children=[]),t})),n(this,"clone",((t=this.parent)=>{const e=t.addChild(this.cloneData(),this.index+1);return"field"!==this.name&&this.cloneChildren(e),e})),n(this,"createChildWrap",(t=>qd.create({tag:"ul",attrs:{className:"children"},children:t}))),this.id=i.id,this.name=t,this.config=Wd[`${this.name}s`].config,Xi(this.config,i.config),this.dataPath=`${this.name}s.${this.id}.`,this.observer=new window.MutationObserver(this.mutationHandler),this.render=o}observe(t){this.observer.disconnect(),this.observer.observe(t,{childList:!0})}get js(){return this.data}get json(){return this.data}empty(){const t=this.children.map((t=>{t.remove()}));return this.dom.classList.add("empty"),t}getActionButtons(){const t=[`hovering-${this.name}`,"hovering"];return{className:[`${this.name}-actions`,"group-actions"],action:{mouseenter:()=>{Wd.stages.active.dom.classList.add(`active-hover-${this.name}`),this.dom.classList.add(...t)},mouseleave:({target:e})=>{this.dom.classList.remove(...t),Wd.stages.active.dom.classList.remove(`active-hover-${this.name}`),e.removeAttribute("style")}},children:[{...qd.btnTemplate({content:qd.icon(`handle-${this.name}`)}),className:["component-handle",`${this.name}-handle`]},{className:["action-btn-wrap",`${this.name}-action-btn-wrap`],children:this.buttons}]}}toggleEdit(t=!this.isEditing){this.isEditing=t;const e=this.dom,n="editing",o=`${n}-${this.name}`,i=this.dom.querySelector(`.${this.name}-edit`);Qr.slideToggle(i,q,t),"field"===this.name&&(Qr.slideToggle(this.preview,q,!t),e.parentElement.classList.toggle(`column-${o}`,t)),e.classList.toggle(n,t),e.classList.toggle(o,t)}get buttons(){if(this.actionButtons)return this.actionButtons;const t={handle:(t=`handle-${this.name}`)=>({...qd.btnTemplate({content:qd.icon(t)}),className:["component-handle"]}),move:(t="move")=>({...qd.btnTemplate({content:qd.icon(t)}),className:["item-move"],meta:{id:"move"}}),edit:(t="edit")=>({...qd.btnTemplate({content:qd.icon(t)}),className:["item-edit-toggle"],meta:{id:"edit"},action:{click:t=>{this.toggleEdit()}}}),remove:(t="remove")=>({...qd.btnTemplate({content:qd.icon(t)}),className:["item-remove"],meta:{id:"remove"},action:{click:(t,e)=>{Qr.slideUp(this.dom,q,(()=>{if("column"===this.name){this.parent.autoColumnWidths(),this.remove()}else this.remove()}))}}}),clone:(t="copy")=>({...qd.btnTemplate({content:qd.icon(t)}),className:["item-clone"],meta:{id:"clone"},action:{click:()=>{this.clone(this.parent),"column"===this.name&&this.parent.autoColumnWidths()}}})},{buttons:e,disabled:n}=this.config.actionButtons,o=e.filter((t=>!n.includes(t))).map((e=>{var n;return(null==(n=t[e])?void 0:n.call(t))||e}));return this.actionButtons=o,this.actionButtons}get index(){return Hr(this.dom)}get parentType(){return R.get(this.name)}get parent(){const t=this.parentType;if(!this.dom||!t)return null;const e=this.dom.closest(`.${P[t]}`);return e&&qd.asComponent(e)}get children(){if(!this.dom)return[];const t=this.domChildren,e=M.get(this.name);return Yr(t,(t=>Wd.getAddress(`${e}s.${t.id}`))).filter(Boolean)}get domChildren(){const t=this.dom.querySelector(".children");return t?t.children:[]}addChild(t={},e=this.domChildren.length){var n,o;let i=t;"object"!=typeof t&&(i={id:i});const r=this.dom.querySelector(".children"),{id:s=Hi()}=i,a=M.get(this.name);if(!a)return null;const l=`${a}s`,c=Wd.getAddress(`${l}.${s}`)||Wd[l].add(s,i);r.insertBefore(c.dom,r.children[e]),null==(o=null==(n=this.config.events)?void 0:n.onAddChild)||o.call(n,{parent:this,child:c});const d=c.get("children");return(null==d?void 0:d.length)&&c.loadChildren(d),this.removeClasses("empty"),this.saveChildOrder(),c}onAdd({from:t,to:e,item:n,newIndex:o}){var i;t.classList.contains(y)||(t=t.parentElement);const r=qi(t),s=qi(e.parentElement),a=new Map([[-2,()=>{const t=this.addChild({},o).addChild();return t.addChild.bind(t)}],[-1,()=>{const t=this.addChild({},o);return t.addChild.bind(t)}],[0,()=>this.addChild.bind(this)],[1,t=>{const e=Hr(this.dom);return()=>this.parent.addChild(t,e+1)}],[2,t=>()=>this.parent.parent.addChild(t)]]),l={controls:()=>{const{controlData:{meta:{id:t},...e}}=bd.get(n.id);qr(e,"config.controlId",t);const i=t.startsWith("layout-")?t.replace(/^layout-/,""):"field",r=zr({stage:{row:0,column:-1,field:-2},row:{row:1,column:0,field:-1},column:{row:2,column:1,field:0},field:1},`${this.name}.${i}`),s=a.get(r)();qd.remove(n);return s(e,o)},row:()=>{const t=(a.get({stage:-1,row:0,column:1}[s])||tr)();return null==t?void 0:t({id:n.id},o)},column:()=>{const t=(a.get({stage:-2,row:-1}[s])||tr)();return null==t?void 0:t(n.id)}},c=null==(i=l[r])?void 0:i.call(l,n,o);return(()=>{this.saveChildOrder(),this.removeClasses("empty")})(),c}onRemove({from:{parentElement:t}}){return t.classList.contains(E)&&t.classList.remove("column-editing-field"),"stage"===this.name||this.children.length?(this.emptyClass(),this.saveChildOrder()):this.remove()}onRender(){const{events:t}=this.config;if(!t)return null;t.onRender&&qd.onRender(this.dom,t.onRender)}set config(t){const e=zr(t,"all"),n=zr(this.data,"config.controlId"),o=[e,n&&zr(t,n),zr(t,this.id)].reduce(((t,e)=>e?Xi(t,e):t),this.configVal);this.configVal=o}get config(){return this.configVal}getComponent(t){const[e,n]=t.split("."),o=Wd[e];return n===this.id?this:null==o?void 0:o.get(n)}cloneChildren(t){for(const e of this.children)null==e||e.clone(t)}get isRow(){return this.name===j.row}get isColumn(){return this.name===j.column}get isField(){return this.name===j.field}}class Kc extends Jc{constructor(t=Object.create(null)){super("field",{conditions:[{if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]}],...t}),n(this,"updateConditionsPanel",Qi((()=>{const t=this.editPanels.find((({name:t})=>"conditions"===t));if(!t)return null;const e=t.createProps(),n=this.dom.querySelector(".field-edit-conditions");n.parentElement.replaceChild(e,n)}),q)),n(this,"updatePreview",(()=>{if(!this.preview.parentElement)return null;this.updateLabel();const t=qd.create(this.fieldPreview(),!0);this.preview.parentElement.replaceChild(t,this.preview),this.preview=t})),n(this,"updateEditPanels",(()=>{this.editPanels=[];const t=["object","array"],e=Ui([...this.config.panels.order,...Object.keys(this.data)]),n=["config","meta","action","events",...this.config.panels.disabled],o=e.filter((t=>!n.includes(t)));for(const r of o){const e=this.get(r),n=qd.childType(e);if(t.includes(n)){const t=new Zc(e,r,this);this.editPanels.push(t)}}const i={panels:this.editPanels.map((({panelConfig:t})=>t)),id:this.id,displayType:"auto"};this.panels=new Lc(i),this.dom&&(this.dom.querySelector(".panel-nav").replaceWith(this.panels.panelNav),this.dom.querySelector(".panels").replaceWith(this.panels.panelsWrap))})),n(this,"toggleCheckedOptions",((t,e)=>{const n=this.get("options").map(((n,o)=>{const i=o===t;return"radio"===e?n.selected=i:n.checked=i?!n.checked:n.checked,n}));this.set("options",n)})),n(this,"isDisabledProp",((t,e="attrs")=>{const n=this.config.panels[e];if(!n)return!1;return n.disabled.concat(this.get(`config.disabled${Ic(e)}`)).includes(t)})),n(this,"isLockedProp",((t,e="attrs")=>{const n=this.config.panels[e];if(!n)return!1;return n.locked.concat(this.get(`config.locked${Ic(e)}`)).includes(t)})),this.debouncedUpdateEditPanels=function(t,e=333){let n;return function(...o){n&&clearTimeout(n),n=setTimeout((()=>t.apply(this,o)),e)}}(this.updateEditPanels),this.label=qd.create(this.labelConfig),this.preview=qd.create({}),this.editPanels=[];const e=this.getActionButtons(),o=this.actionButtons.some((t=>{var e;return"edit"===(null==(e=t.meta)?void 0:e.id)}));let i={tag:"li",attrs:{className:x},id:this.id,children:[this.label,this.getComponentTag(),e,o&&this.fieldEdit,this.preview].filter(Boolean),panelNav:this.panelNav,dataset:{hoverTag:r.get("field")}};i=qd.create(i),this.observe(i),this.dom=i,this.isEditing=!1,this.onRender(i)}get labelConfig(){if(!!this.get("config.hideLabel"))return null;const t=this.get("config.editorLabel")||this.get("config.label"),e=this.get("attrs.required"),n=this.config.label.disableHTML;return{className:"prev-label",children:[{...(()=>{const e={tag:"label",attrs:{}};return n?(e.tag="input",e.attrs.value=t,e):(e.attrs.contenteditable=!0,e.children=t,e)})(),action:{input:({target:{innerHTML:t,innerText:e,value:o}})=>{super.set("config.label",n?o:t);const i=Wd.getConditionMap(`fields.${this.id}`);if(i)return i.updateConditionSourceLabel(`${this.name}s.${this.id}`,n?o:e)}}},e&&qd.requiredMark()]}}updateConditionSourceLabel(t,e){const n=this.editPanels.find((({name:t})=>"conditions"===t));if(!n)return null;for(const{itemFieldGroups:o}of n.editPanelItems)for(const n of o){const o=n.find((e=>e.value===t));o&&(o.displayField.value=e)}}set(...t){const[e,n]=t,o=super.set(e,n);return this.updatePreview(),o}updateLabel(){if(!this.label)return null;const t=qd.create(this.labelConfig);this.label.parentElement.replaceChild(t,this.label),this.label=t}get fieldEdit(){const t={className:["field-edit","slide-toggle","formeo-panels-wrap"]};this.updateEditPanels();const e=this.editPanels.length;return e&&(t.className.push(`panel-count-${e}`),t.content=[this.panels.panelNav,this.panels.panelsWrap],this.panelNav=this.panels.nav,this.resizePanelWrap=this.panels.nav.refresh),t.action={onRender:()=>{if(0===e){const t=this.dom,e=t.querySelector(".item-edit-toggle"),n=t.querySelector(".field-actions"),o=n.getElementsByTagName("button");n.style.maxWidth=o.length*o[0].clientWidth+"px",qd.remove(e)}else this.resizePanelWrap()}},qd.create(t)}get defaultPreviewActions(){return{change:t=>{const{target:e}=t,{type:n}=e;if(["checkbox","radio"].includes(n)){const t=+e.id.split("-").pop();this.toggleCheckedOptions(t,n),this.debouncedUpdateEditPanels()}},click:t=>{"true"===t.target.contentEditable&&t.preventDefault()},input:t=>{if(["input","meter","progress","button"].includes(t.target.tagName.toLowerCase()))return super.set("attrs.value",t.target.value),this.debouncedUpdateEditPanels();if(t.target.contentEditable){const e=t.target.parentElement.classList;if(e.contains("f-checkbox")||e.contains("f-radio")){const e=t.target.parentElement,n=e.parentElement,o=Hr(e,n);return super.set(`options[${o}].label`,t.target.innerHTML),this.debouncedUpdateEditPanels()}super.set("content",t.target.innerHTML)}}}}fieldPreview(){var t;const e=Vi(this.data),{action:n={}}=bd.get(e.config.controlId);e.id=`prev-${this.id}`,e.action=n,(null==(t=this.data)?void 0:t.config.editableContent)&&(e.attrs={...e.attrs,contenteditable:!0});return{attrs:{className:"field-preview",style:this.isEditing&&"display: none;"},content:qd.create(e,!0),action:this.defaultPreviewActions}}}const Qc={js:new Set,css:new Set},td=(t,e,n=er)=>new Promise((o=>fetch(t).then((t=>{if(!t.ok)return o(n(t));o(e?e(t):t)})).catch((t=>n(t))))),ed=(t,e)=>{t.removeEventListener("load",ed),e(t.src)},nd=(t,e)=>{t.removeEventListener("load",nd),e(t.src)},od=t=>new Promise(((e,n)=>{if(Qc.js.has(t))return e(t);Qc.js.add(t);const o=qd.create({tag:"script",attrs:{type:"text/javascript",async:!0,src:t},action:{load:()=>nd(o,e),error:()=>n(new Error(`${t} failed to load.`))}});document.head.appendChild(o)})),id=t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>new Promise(((e,n)=>{if(Qc.css.has(t))return e(t);Qc.css.add(t);const o=qd.create({tag:"link",attrs:{rel:"stylesheet",href:t},action:{load:()=>ed(o,e),error:()=>n(new Error(`${(void 0).src} failed to load.`))}});document.head.appendChild(o)}))));return Promise.all(e)},rd=async(t=g)=>{if(document.getElementById(f))return;const e=async t=>(t=>{let e=document.getElementById(f);return e||(e=qd.create({id:f,children:t,attrs:{hidden:!0,style:"display: none;"}}),document.body.insertBefore(e,document.body.childNodes[0])),e})(await t.text());return td(t,e,(()=>td(v,e)))},sd={js:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>od(t)));return Promise.all(e)},css:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>id(t)));return Promise.all(e)}},ad=t=>{const e=Object.entries(t).map((([t,e])=>sd[t](e)));return Promise.all(e)},ld=()=>{const t=document.getElementById(f);return"hidden"===window.getComputedStyle(t).visibility};class cd{constructor({events:t={},dependencies:e={},controlAction:o,...i}){n(this,"controlCache",new Set),this.events=t,this.controlData=i,this.controlAction=o,this.dependencies=e,this.id=i.id||Hi()}get controlId(){var t;return null==(t=this.controlData.meta)?void 0:t.id}get dom(){const{meta:t,config:e}=this.controlData,n=this.i18n(e.label)||e.label,o={tag:"button",attrs:{type:"button"},content:[{tag:"span",className:"control-icon",children:qd.icon(t.icon)},n],action:{focus:({target:t})=>{const e=t.closest(`.${y}`);return e&&bd.panels.nav.refresh(Hr(e))},click:({target:t})=>{bd.addElement(t.parentElement.id)}}};return qd.create({tag:"li",id:this.id,className:["field-control",`${t.group}-control`,`${t.id}-control`],content:o,meta:t,action:this.controlAction})}promise(){return ad(this.dependencies)}i18n(t,e){var n,o;const i=r.locale,s=null==(n=this.definition)?void 0:n.i18n,a=(null==s?void 0:s[i])||{};return((null==(o=a[t])?void 0:o.call(a))??a[t])||r.get(t,e)}}const dd=[{config:{label:"row"},meta:{group:"layout",icon:"rows",id:"layout-row"}},{config:{label:"column"},meta:{group:"layout",icon:"columns",id:"layout-column"}}];const ud=(t,e=3)=>Array.from({length:e},((t,e)=>e+1)).map((e=>{const n="checkbox"===t?"checked":"selected";return{label:r.get("labelCount",{label:Ic(t),count:e}),value:`${t}-${e}`,[n]:!e}}));const hd=[class extends cd{constructor(){super({tag:"button",attrs:{className:[{label:"grouped",value:"f-btn-group"},{label:"ungrouped",value:"f-field-group"}]},config:{label:r.get("controls.form.button"),hideLabel:!0},meta:{group:"common",icon:"button",id:"button"},options:[{label:r.get("button"),type:["button","submit","reset"].map((t=>({label:t,type:t}))),className:[{label:"default",value:"",selected:!0},{label:"primary",value:"primary"},{label:"danger",value:"error"},{label:"success",value:"success"},{label:"warning",value:"warning"}]}]})}},class extends cd{constructor(){super({tag:"input",attrs:{type:"date",required:!1,className:""},config:{label:r.get("controls.form.input.date")},meta:{group:"common",icon:"calendar",id:"date-input"}})}},class extends cd{constructor(){super({tag:"input",attrs:{type:"hidden",value:""},config:{label:r.get("hidden"),hideLabel:!0},meta:{group:"common",icon:"hidden",id:"hidden"}})}},class extends cd{constructor(){super({tag:"input",attrs:{type:"number",required:!1,className:""},config:{label:r.get("number")},meta:{group:"common",icon:"hash",id:"number"}})}},class extends cd{constructor(){super({tag:"textarea",config:{label:r.get("controls.form.textarea")},meta:{group:"common",icon:"textarea",id:"textarea"},attrs:{required:!1}})}},class extends cd{constructor(){super({tag:"input",attrs:{required:!1,type:"text",className:""},config:{label:r.get("controls.form.input.text")},meta:{group:"common",icon:"text-input",id:"text-input"}})}},class extends cd{constructor(){super({tag:"input",attrs:{type:"file",required:!1},config:{label:r.get("fileUpload")},meta:{group:"common",icon:"upload",id:"upload"}})}},class extends cd{constructor(){super({tag:"select",config:{label:r.get("controls.form.select")},attrs:{required:!1,className:""},meta:{group:"common",icon:"select",id:"select"},options:ud("option")})}},class extends cd{constructor(){super({tag:"input",attrs:{type:"checkbox",required:!1},config:{label:r.get("controls.form.checkbox-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"checkbox",id:"checkbox"},options:ud("checkbox",1)})}},class extends cd{constructor(){super({tag:"input",attrs:{type:"radio",required:!1},config:{label:r.get("controls.form.radio-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"radio-group",id:"radio"},options:ud("radio")})}}],pd=Array.from(Array(5).keys()).slice(1).map((t=>`h${t}`)),fd="controls.html.header";const md=[class extends cd{constructor(){super({tag:pd[0],attrs:{tag:pd.map(((t,e)=>({label:t.toUpperCase(),value:t,selected:!e}))),className:""},config:{label:r.get(fd),hideLabel:!0,editableContent:!0},meta:{group:"html",icon:"header",id:"html.header"},content:r.get(fd),action:{}})}static get definition(){return{i18n:{"en-US":{header:"Custom English Header"}}}}get content(){return super.i18n(fd)}},class extends cd{constructor(){super({tag:"p",attrs:{className:""},config:{label:r.get("controls.html.paragraph"),hideLabel:!0,editableContent:!0},meta:{group:"html",icon:"paragraph",id:"paragraph"},content:"Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment."})}},class extends cd{constructor(){super({tag:"hr",config:{label:r.get("controls.html.divider"),hideLabel:!0},meta:{group:"html",icon:"divider",id:"divider"}})}},class extends cd{constructor(t){super(Xi({tag:"textarea",config:{label:"WYSIWYG",editableContent:!0},meta:{group:"html",icon:"rich-text",id:"tinymce"},attrs:{required:!1},dependencies:{js:"https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.9.11/tinymce.min.js"},action:{onRender:t=>{const e=`#${t.id}`;window.tinymce.remove(e),window.tinymce.init({selector:e})}},controlAction:{click:()=>{},onRender:()=>{}}},t))}}],gd=Object.freeze({sortable:!0,elementOrder:{},groupOrder:[],groups:[{id:"layout",label:"controls.groups.layout",elementOrder:["row","column"]},{id:"common",label:"controls.groups.form",elementOrder:["button","checkbox"]},{id:"html",label:"controls.groups.html",elementOrder:["header","block-text"]}],disable:{groups:[],elements:[],formActions:[]},elements:[],container:null,panels:{displayType:"slider"}}),vd=[...hd,...md,...dd];const bd=new class{constructor(){n(this,"groupLabel",(t=>r.get(t)||t||"")),n(this,"layoutTypes",{row:()=>kd.active.addChild(),column:()=>this.layoutTypes.row().addChild(),field:t=>this.layoutTypes.column().addChild(t)}),n(this,"addElement",(t=>{const{meta:{group:e,id:n},...o}=zr(this.get(t),"controlData");return qr(o,"config.controlId",n),"layout"===e?this.layoutTypes[n.replace("layout-","")]():this.layoutTypes.field(o)})),n(this,"applyOptions",(async(t={})=>{const{container:e,elements:n,groupOrder:o,...i}=Xi(gd,t);return this.container=e,this.groupOrder=Ui(o.concat(["common","html","layout"])),this.options=i,Promise.all(this.registerControls([...vd,...n]))})),this.data=new Map,this.buttonActions={focus:({target:t})=>{const e=t.closest(`.${y}`);return e&&this.panels.nav.refresh(Hr(e))},click:({target:t})=>{this.addElement(t.parentElement.id)}}}async init(t,e=!1){return await this.applyOptions(t),this.buildDOM(e),this}registerControls(t){return this.controls=[],t.map((async t=>{let e;return e="function"==typeof t?new t:new cd(t),this.add(e),this.controls.push(e.dom),e.promise()}))}groupElements(){let t=this.options.groups.slice(),e=this.controls.slice(),n=[];const o=[];return t=Xr(t,this.groupOrder,"id"),t=t.filter((t=>zi(t.id,this.options.disable.groups))),n=t.map((t=>{const n={tag:"ul",attrs:{className:y,id:`${t.id}-${y}`},config:{label:this.groupLabel(t.label)}};if(this.options.elementOrder[t.id]){const e=this.options.elementOrder[t.id],n=Ui(e.concat(t.elementOrder));t.elementOrder=n}return e=Xr(e,t.elementOrder,"meta.id"),n.content=e.filter((e=>{const{controlData:n}=this.get(e.id),i=n.meta.id||"";let r=!0;return r=[zi(i,this.options.disable.elements),n.meta.group===t.id,!o.includes(i)].every((t=>!0===t)),r&&o.push(i),r})),n})),n}add(t=Object.create(null)){const e=Vi(t);return this.data.set(e.id,e),e.controlData.meta.id&&this.data.set(e.controlData.meta.id,e.controlData),e}get(t){return Vi(this.data.get(t))}formActions(){if(!0===this.options.disable.formActions)return null;const t={...qd.btnTemplate({content:[qd.icon("bin"),r.get("clear")],title:r.get("clearAll")}),className:["clear-form"],action:{click:t=>{$d.size?(os.confirmClearAll=new window.CustomEvent("confirmClearAll",{detail:{confirmationMessage:r.get("confirmClearAll"),clearAllAction:()=>{kd.clearAll().then((()=>{const e={src:t.target};os.formeoCleared(e)}))},btnCoords:qd.coords(t.target)}}),document.dispatchEvent(os.confirmClearAll)):window.alert(r.get("cannotClearFields"))}}},e={...qd.btnTemplate({content:[qd.icon("floppy-disk"),r.get("save")],title:r.get("save")}),className:["save-form"],action:{click:({target:t})=>{const{formData:e}=Wd,n={action:()=>{},coords:qd.coords(t),message:"",button:t};return jc.click.btn(n),jc.save.form(e)}}};return{className:"form-actions f-btn-group",content:Object.entries({clearBtn:t,saveBtn:e}).reduce(((t,[e,n])=>(this.options.disable.formActions.includes(e)||t.push(n),t)),[])}}buildDOM(t){const e=this.groupElements(),n=this.formActions(),{displayType:o}=this.options.panels;this.panels=new Lc({panels:e,type:"controls",displayType:o});const i=["control-groups","formeo-panels-wrap",`panel-count-${e.length}`],s=qd.create({className:i,content:[this.panels.panelNav,this.panels.panelsWrap]}),a=["formeo-controls"];t&&a.push("formeo-sticky");const l=qd.create({className:a,content:[s,n]}),c=l.getElementsByClassName("control-group");this.dom=l,this.groups=c;const[d]=c;this.currentGroup=d,this.actions={filter:t=>{const e=""!==t,n=this.controls;let o=s.querySelector(".filtered-term");if(qd.toggleElementsByStr(n,t),e){const e=r.get("controls.filteringTerm",t);l.classList.add("filtered"),o?o.textContent=e:(o=qd.create({tag:"h5",className:"filtered-term",content:e}),s.insertBefore(o,s.firstChild))}else o&&(l.classList.remove("filtered"),o.remove())},addElement:this.addElement,addGroup:t=>{}};for(let r=c.length-1;r>=0;r--){const t=`formeo-controls-${c[r]}`;this.options.sortable||window.localStorage.removeItem(t),ac.create(c[r],{animation:150,forceFallback:!0,fallbackClass:"control-moving",fallbackOnBody:!0,group:{name:"controls",pull:"clone",put:!1},onStart:({item:t})=>{const{controlData:e}=this.get(t.id);this.options.ghostPreview&&(t.innerHTML="",t.appendChild(new Kc(e).preview))},onEnd:({from:t,item:e,clone:n})=>{t.contains(n)&&t.replaceChild(e,n)},sort:this.options.sortable,store:{get:()=>{const e=window.localStorage.getItem(t);return e?e.split("|"):[]},set:e=>{const n=e.toArray();window.localStorage.setItem(t,n.join("|"))}}})}return l}};class yd extends Sa{constructor(){super(...arguments),n(this,"load",(t=>{const e=nr(t);this.empty();for(const[n,o]of Object.entries(e))this.add(n,o);return this.data})),n(this,"get",(t=>t?zr(this.data,t):this.add())),n(this,"add",((t,e=Object.create(null))=>{const n=t||Hi(),o=this.Component({...e,id:n});return this.set(n,o),this.active=o,o})),n(this,"remove",(t=>{if(Array.isArray(t))for(const e of t)this.get(e).remove();else this.get(t).remove();return this.data})),n(this,"delete",(t=>(delete this.data[t],t))),n(this,"clearAll",((t=!0)=>{const e=Object.values(this.data).map((e=>e.empty(t)));return Promise.all(e)})),n(this,"conditionMap",new Map)}set config(t){this.configVal=Xi(this.configVal,Vi(t))}get config(){return this.configVal}}class wd extends Jc{constructor(t,e){super("stage",{...Object.freeze({children:[]}),...t},e);const n=this.createChildWrap();this.dom=qd.create({attrs:{className:[w,"empty"],id:this.id},children:n}),ac.create(n,{animation:150,fallbackClass:"row-moving",forceFallback:!0,group:{name:"stage",pull:!0,put:["row","column","controls"]},sort:!0,disabled:!1,onAdd:this.onAdd.bind(this),onRemove:this.onRemove.bind(this),onStart:()=>{Cd.active=this},onSort:this.onSort.bind(this),draggable:`.${C}`,handle:".item-move"})}empty(t=!0){return new Promise((e=>{t?(this.dom.classList.add("removing-all-fields"),Qr.slideUp(this.dom,q,(()=>{e(super.empty(t)),this.dom.classList.remove("removing-all-fields"),Qr.slideDown(this.dom,q)}))):e(super.empty())}))}onAdd(...t){const e=super.onAdd(...t);e&&"column"===e.name&&e.parent.autoColumnWidths()}}const Cd=new class extends yd{constructor(t){super("stages",t)}Component(t){return new wd(t)}};class Ed extends Jc{constructor(t){super("row",{...Object.freeze({config:{fieldset:!1,legend:"",inputGroup:!1},children:[],className:[C]}),...t}),n(this,"autoColumnWidths",(()=>{const t=this.children;if(!t.length)return;const e=Number.parseFloat((100/t.length).toFixed(1))/1;for(const n of t){n.removeClasses(Q);const t=n.dom,o=Gi(e);n.set("config.width",o),t.style.width=o,t.dataset.colWidth=o;const i=setTimeout((()=>{clearTimeout(i),n.refreshFieldPanels()}),U);document.dispatchEvent(os.columnResized)}this.updateColumnPreset()})),n(this,"updateColumnPreset",(()=>{this.columnPresetControl.innerHTML="";const t=this.getColumnPresetOptions.map((({label:t,...e})=>qd.create({tag:"option",content:t,attrs:e})));this.columnPresetControl.append(...t)})),n(this,"setColumnWidths",(t=>{"string"==typeof t&&(t=t.split(",")),this.children.forEach(((e,n)=>{e.setWidth(`${t[n]}%`),e.refreshFieldPanels()}))}));const e=this.createChildWrap();this.dom=qd.create({tag:"li",className:[C,"empty"],dataset:{hoverTag:r.get("row"),editingHoverTag:r.get("editing.row")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),this.editWindow,e]}),ac.create(e,{animation:150,fallbackClass:"column-moving",forceFallback:!0,group:{name:"row",pull:!0,put:["row","column","controls"]},sort:!0,disabled:!1,onRemove:this.onRemove.bind(this),onEnd:this.onEnd.bind(this),onAdd:this.onAdd.bind(this),onSort:this.onSort.bind(this),draggable:`.${E}`,handle:".item-move"})}get editWindow(){const t={tag:"input",id:`${this.id}-fieldset`,attrs:{type:"checkbox",checked:this.get("config.fieldset"),ariaLabel:r.get("row.settings.fieldsetWrap.aria")},action:{click:({target:{checked:t}})=>{this.set("config.fieldset",Boolean(t))}},config:{label:r.get("row.settings.fieldsetWrap")}},e={tag:"input",id:`${this.id}-inputGroup`,attrs:{type:"checkbox",checked:this.get("config.inputGroup"),ariaLabel:r.get("row.settings.inputGroup.aria")},action:{click:({target:{checked:t}})=>this.set("config.inputGroup",t)},config:{label:r.get("row.makeInputGroup"),description:r.get("row.makeInputGroupDesc")}},n={className:"input-group",content:{tag:"input",attrs:{type:"text",ariaLabel:"Legend for fieldset",value:this.get("config.legend"),placeholder:"Title"},config:{label:{children:["Row Title",{tag:"span",content:" ⓘ",dataset:{tooltip:"Row title will be used as the legend for the fieldset"}}]}},action:{input:({target:{value:t}})=>this.set("config.legend",t)},className:""}},o=qd.formGroup([t,n]),i={tag:"label",content:r.get("defineColumnWidths"),className:"col-sm-4 form-control-label"};this.columnPresetControl=qd.create(this.columnPresetControlConfig);const s={className:"col-sm-8",content:this.columnPresetControl,action:{onRender:()=>{this.updateColumnPreset()}}},a=[e,"hr",o,"hr",qd.formGroup([i,s],"row")];return qd.create({className:`${this.name}-edit group-config`,action:{onRender:t=>{const e=a.map((t=>qd.create(t)));t.append(...e)}}})}onAdd(...t){super.onAdd(...t),this.autoColumnWidths()}onRemove(...t){super.onRemove(...t),this.autoColumnWidths()}get getColumnPresetOptions(){const t=this.children,e=F.get(t.length-1)||[],n=t.map((t=>{const e=t.get("config.width")||"";return Number(e.replace("%","")).toFixed(1)})).join(",");if(e.length){const t=e.slice();return!t.find((t=>t.value===n))&&t.push({value:n,label:n.replace(/,/g," | "),className:S}),t.map((t=>{const e={...t};return e.selected=t.value===n,e}))}return[]}get columnPresetControlConfig(){return{tag:"select",attrs:{ariaLabel:r.get("defineColumnLayout"),className:O},action:{change:({target:t})=>{const{value:e}=t;this.setColumnWidths(e)}},options:this.getColumnPresetOptions}}}const xd={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]}};const Sd=new class extends yd{constructor(t){super("rows",t),this.config={all:xd}}Component(t){return new Ed(t)}};class Od{constructor(){this.onMove=this.onMove.bind(this),this.onStop=this.onStop.bind(this),this.cleanup=this.cleanup.bind(this)}getRowWidth(t){const e=t.querySelector(".children");if(!e)return 0;const n=e.children.length,o=qd.getStyle(e,"gap")||"0px",i=parseFloat(o,10)||0;return this.totalGapWidth=i*(n-1),e.offsetWidth-this.totalGapWidth}validateResizeTarget(t,e){return t&&e&&t.offsetWidth&&e.offsetWidth}onStart(t){if(t.preventDefault(),this.resized=!1,0!==t.button)return;const e=t.target.parentElement,n=e.nextSibling||e.previousSibling,o=e.closest(`.${C}`);if(this.validateResizeTarget(e,n))if(this.startX="touchstart"===t.type?t.touches[0].clientX:t.clientX,o.classList.add(_),this.columnPreset=o.querySelector(`.${O}`),this.originalColumnClass=e.className,this.originalSiblingClass=n.className,e.className=e.className.replace(Q,""),n.className=n.className.replace(Q,""),this.colStartWidth=e.offsetWidth,this.sibStartWidth=n.offsetWidth,this.rowWidth=this.getRowWidth(o),this.rowWidth<=0)this.cleanup();else{this.column=e,this.sibling=n,this.row=o;try{window.addEventListener("pointermove",this.onMove,!1),window.addEventListener("pointerup",this.onStop,!1)}catch(i){this.cleanup()}}else this.cleanup()}calculateNewWidths(t){const e=this.colStartWidth+t-this.startX,n=this.sibStartWidth-t+this.startX,o=parseFloat(Yi(e,this.rowWidth)),i=parseFloat(Yi(n,this.rowWidth));return o<10||i<10?null:{colWidth:Gi(o.toFixed(1)),siblingColWidth:Gi(i.toFixed(1))}}onMove(t){t.preventDefault();const{column:e,sibling:n}=this,o="touchmove"===t.type?t.touches[0].clientX:t.clientX,i=this.calculateNewWidths(o);if(!i)return;const{colWidth:r,siblingColWidth:s}=i;e.dataset.colWidth=r,n.dataset.colWidth=s,e.style.width=r,n.style.width=s,this.resized=!0}onStop(){const{column:t,sibling:e}=this;window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onStop),this.resized&&(this.setCustomWidthValue(),Wd.setAddress(`columns.${t.id}.config.width`,t.dataset.colWidth),Wd.setAddress(`columns.${e.id}.config.width`,e.dataset.colWidth),this.row.classList.remove(_),this.resized=!1,this.cleanup())}cleanup(){this.column&&this.originalColumnClass&&(this.column.className=this.originalColumnClass),this.sibling&&this.originalSiblingClass&&(this.sibling.className=this.originalSiblingClass),this.row&&this.row.classList.remove(_),window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onStop)}setCustomWidthValue(){const t=this.columnPreset;let e=t.querySelector(`.${S}`);const n=this.row.querySelector(".children").children,o=Yr(n,(t=>Yi(t.clientWidth,this.rowWidth).toFixed(1))),i=o.join(","),r=o.join(" | ");return e||(e=qd.create({tag:"option",attrs:{className:S,value:i,selected:!0},content:r}),t.append(e)),e.value=i,e.textContent=r,i}}const _d=t=>({className:"resize-x-handle",action:{pointerdown:t.onStart.bind(t)},content:[qd.icon("triangle-down"),qd.icon("triangle-up")]}),Nd=()=>({className:"column-edit group-config"});class Ad extends Jc{constructor(t){super("column",{...Object.freeze({config:{width:"100%"},children:[],className:[E]}),...t}),n(this,"refreshFieldPanels",(()=>{for(const t of this.children)t.panels.nav.refresh()})),n(this,"setDomWidth",(t=>{this.dom.dataset.colWidth=t,this.dom.style.width=t})),n(this,"setWidth",(t=>(this.setDomWidth(t),this.set("config.width",t))));const e=this.createChildWrap();this.dom=qd.create({tag:"li",className:[E,"empty"],dataset:{hoverTag:r.get("column")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),Nd(),_d(new Od),e]}),this.processConfig(),os.columnResized=new window.CustomEvent("columnResized",{detail:{column:this.dom,instance:this}}),ac.create(e,{animation:150,fallbackClass:"field-moving",forceFallback:!0,group:{name:"column",pull:!0,put:["column","controls"]},sort:!0,disabled:!1,onEnd:this.onEnd.bind(this),onAdd:this.onAdd.bind(this),onSort:this.onSort.bind(this),onRemove:this.onRemove.bind(this),onMove:t=>{t.from!==t.to&&t.from.classList.remove("hovering-column")},draggable:`.${x}`,handle:".item-move"})}processConfig(){const t=Kr.get(this.data,"config.width");t&&this.setDomWidth(t)}}const jd={actionButtons:{buttons:["clone","move","remove"],disabled:[]}};const Td=new class extends yd{constructor(t){super("columns",t),this.config={all:jd}}Component(t){return new Ad(t)}},Pd={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]},panels:{disabled:[],attrs:{disabled:["type"],hideDisabled:!0,locked:[]},order:["attrs","options","conditions"]},label:{disableHTML:!1}};const Ld=new class extends yd{constructor(t){super("fields",t),n(this,"get",(t=>{let e=t&&zr(this.data,t);if(!e){const n=bd.get(t);n&&(e=this.add(null,n.controlData))}return e})),n(this,"getData",(()=>Object.entries(this.data).reduce(((t,[e,n])=>{const{conditions:o,...i}=(null==n?void 0:n.getData())||n;if(null==o?void 0:o.length){let t=!0;if(1===o.length){const[e]=o;t=Boolean(e.if[0].source&&e.then[0].target)}t&&(i.conditions=o)}return t[e]=i,t}),{}))),n(this,"load",((t=Object.create(null))=>{const e=nr(t);this.empty();for(const[n,o]of Object.entries(e)){const{meta:t,...e}=o;(null==t?void 0:t.id)&&qr(e,"config.controlId",null==t?void 0:t.id),this.add(n,e)}return this.data})),this.config={all:Pd}}Component(t){return new Kc(t)}};const Dd=new class extends yd{constructor(t){super("externals",t)}Component(t){return new Jc("external",t)}},kd=Cd,$d=Sd,Id=Td,Md=Ld,Rd=bd,Fd=Dd;const Wd=new class extends Sa{constructor(){super("components"),n(this,"load",((t,e)=>{this.empty();const n=((t,e=!1)=>t?Vi(nr(t)):e&&Zi.get(B)||et())(t,e.sessionStorage);this.opts=e,this.set("id",n.id),this.add("stages",kd.load(n.stages)),this.add("rows",$d.load(n.rows)),this.add("columns",Id.load(n.columns)),this.add("fields",Md.load(n.fields)),this.add("externals",Fd.load(this.opts.external));for(const o of Object.values(this.get("stages")))o.loadChildren();return this.data})),this.disableEvents=!0,this.stages=kd,this.rows=$d,this.columns=Id,this.fields=Md,this.controls=Rd,this.externals=Fd}flatList(t=this.data,e=Object.create(null)){return Object.entries(t).reduce(((t,[e,n])=>{if("object"==typeof n)for(const[o,i]of Object.entries(n))t[`${e}.${o}`]=i;return t}),e)}get json(){return window.JSON.stringify({$schema:`https://cdn.jsdelivr.net/npm/formeo@${p}/dist/formData_schema.json`,...this.formData})}get formData(){return{id:this.get("id"),stages:Cd.getData(),rows:Sd.getData(),columns:Td.getData(),fields:Ld.getData()}}set config(t){const{stages:e,rows:n,columns:o,fields:i}=t;kd.config=e,$d.config=n,Id.config=o,Md.config=i}setAddress(t,e){const[n,o,...i]=Array.isArray(t)?t:t.split("."),r=this[n.replace(/s?$/,"s")].get(o);return null==r||r.set(i,e),r}getAddress(t){if(!Ji(t))return;const[e,n,...o]=Array.isArray(t)?t:t.split("."),i=this[e.replace(/s?$/,"s")].get(n);return o.length?i.get(o):i}getConditionMap(t){if(Ji(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.get(e[1])}}setConditionMap(t,e){if(Ji(t)){const n=t.split(".");return n.every((t=>Boolean(t)))&&this[n[0]].conditionMap.set(n[1],e)}}removeConditionMap(t){if(Ji(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.delete(e[1])}}},Bd={glyphicons:t=>`<span class="glyphicon glyphicon-${t}" aria-hidden="true"></span>`,"font-awesome":t=>{const[e,n]=t.split(" ");return`<i class="${e} fa-${n}"></i>`},fontello:t=>`<i class="${tt}${t}">${t}</i>`},zd=new Set(["input","textarea","select"]);const qd=new class{constructor(t=Object.create(null)){n(this,"render",(t=>(t.id=`f-${t.id||Hi()}`,this.create(t)))),n(this,"create",((t,e=!1)=>{if(!t)return;const n=this,o=["children","content"],{className:i,options:r,dataset:s,...a}=this.processTagName(t);let l;o.push("tag");const{tag:c}=a;let d;const u={attrs:{},className:[Kr.get(a,"config.inputWrap")||"f-field-group"],children:[],config:{}};let h=document.createElement(c);const p={string:t=>{h.innerHTML+=t},object:t=>t&&h.appendChild(n.create(t,e)),node:t=>h.appendChild(t),component:t=>h.appendChild(t.dom),array:t=>{for(const e of t)l=n.childType(e),p[l](e)},function:t=>{t=t(),l=n.childType(t),p[l](t)},undefined:()=>null,boolean:()=>null};if(i&&(a.attrs=Xi(a.attrs,{className:i})),r){const t=this.processOptions(r,a,e);if(!this.holdsContent(h)||"button"===c)return Kr.forEach(t,(t=>{u.children.push(n.create(t,e))})),a.attrs.className&&(u.className=a.attrs.className),u.config={...a.config},this.create(u,e);p.array.call(this,t),a.content=void 0,o.push("options")}if(a.attrs&&(n.processAttrs(a,h,e),o.push("attrs")),a.config){if(a.config.label&&(a.config.label&&"button"!==c||["radio","checkbox"].includes(Kr.get(a,"attrs.type")))&&!e){const t=n.label(a);if(!a.config.hideLabel){const e=[t,h];n.labelAfter(a)&&e.reverse(),u.children.push(e)}}o.push("config")}if(a.content||a.children){const t=a.content||a.children;l=n.childType(t),p[l],p[l].call(this,t)}if(s){for(const t in s)Object.hasOwn(s,t)&&(h.dataset[t]="function"==typeof s[t]?s[t]():s[t]);o.push("dataset")}a.action&&(this.actionHandler(h,a.action),o.push("action"));const f=Kr.subtract(o,Object.keys(a));for(d=f.length-1;d>=0;d--)h[f[d]]=a[f[d]];return u.children.length&&(h=this.create(u)),h})),n(this,"onRender",((t,e)=>{t.parentElement?e(t):window.requestAnimationFrame((()=>this.onRender(t,e)))})),n(this,"toggleElementsByStr",((t,e)=>{const n=[];return qd.elementsContainText(t,e,((t,e)=>{e?(t.style.display="block",n.push(t)):t.style.display="none"})),n})),n(this,"elementsContainText",((t,e,n)=>{const o=[];return Vr(t,(t=>{const i=-1!==t.textContent.toLowerCase().indexOf(e.toLowerCase());null==n||n(t,i),i&&o.push(t)})),o})),n(this,"generateOption",(({type:t="option",label:e,value:n,i:o=0,selected:i})=>({tag:"option"===t?"option":"input",attrs:{type:t,value:n||`${t}-${o}`,["option"===t?"selected":"checked"]:i||!o},config:{label:e||r.get("labelCount",{label:r.get("option"),count:o})}}))),n(this,"requiredMark",(()=>({tag:"span",className:"text-error",children:"*"}))),n(this,"removeEmpty",(t=>{const e=t.parentElement,n=qi(t),o=e.getElementsByClassName(`formeo-${n}`);if(this.remove(t),!o.length)return this.isStage(e)?this.emptyClass(e):this.removeEmpty(e)})),n(this,"btnTemplate",(({title:t="",...e})=>({tag:"button",attrs:{type:"button",title:t},...e}))),n(this,"isControls",(t=>qi(t)===y)),n(this,"isStage",(t=>qi(t)===w)),n(this,"isRow",(t=>qi(t)===C)),n(this,"isColumn",(t=>qi(t)===E)),n(this,"isField",(t=>qi(t)===x)),n(this,"asComponent",(t=>Wd[`${qi(t)}s`].get(t.id))),this.options=t}set setOptions(t){this.options=Xi(this.options,t)}processTagName(t){let e,n=t;if("string"==typeof n)return e=n,n={tag:e},n;if(n.attrs){const{tag:t,...o}=n.attrs;if(t)if("string"==typeof t)e=t;else{e=(t.find((t=>!0===t.selected))||t[0]).value}n.attrs=o}return n.tag=e||n.tag||"div",n}actionHandler(t,e){const n={onRender:qd.onRender,render:qd.onRender},o=["focus","blur"];return Object.entries(e).map((([e,i])=>(Array.isArray(i)?i:[i]).map((i=>{const r=n[e]||(t=>(e,n)=>e.addEventListener(t,n,o.includes(t)))(e);return r(t,i)}))))}get icons(){if(this.iconSymbols)return this.iconSymbols;const t=document.querySelectorAll(`#${f} svg symbol`);return this.iconSymbols=Array.from(t).reduce(((t,e)=>{var n;return t[e.id.replace(tt,"")]={tag:"svg",attrs:{className:["svg-icon",n=e.id]},children:[{tag:"use",attrs:{"xmlns:xlink":"http://www.w3.org/1999/xlink","xlink:href":`#${n}`}}]},t}),{}),this.cachedIcons={},this.iconSymbols}icon(t,e){var n,o;if(!t)return;const i=`${t}?${new URLSearchParams(e).toString()}`;if(null==(n=this.cachedIcons)?void 0:n[i])return this.cachedIcons[i];const r=this.icons[t];if(r){if(e){const t=Xi(r,e);return this.cachedIcons[i]=qd.create(t).outerHTML,this.cachedIcons[i]}return this.cachedIcons[i]=qd.create(r).outerHTML,this.cachedIcons[i]}return(null==(o=Bd[qd.options.iconFont])?void 0:o.call(Bd,t))||t}processAttrs(t,e,n){const{attrs:o={}}=t;n||o.name||!this.isInput(t.tag)||e.setAttribute("name",Hi(t));for(const i of Object.keys(o)){const t=Kr.safeAttrName(i),n=this.processAttrValue(o[i]);n&&e.setAttribute(t,!0===n?"":n)}}processAttrValue(t){let e=t||"";if(Array.isArray(e))if("object"==typeof e[0]){const t=e.filter((t=>!0===t.selected));e=t.length?t[0].value:e[0].value}else e=e.join(" ");return e}processOptions(t,e,n){const{action:o,attrs:i}=e,r=i.type||e.tag,s=i.id||e.id;return t.map(((t,i)=>{var a;const{label:l,...c}=t,d=()=>{const a={tag:"input",attrs:{name:s,type:r,value:t.value||"",id:`${s}-${i}`,...c},action:o},l={tag:"label",attrs:{for:`${s}-${i}`},config:{inputWrap:"form-check"},children:t.label},d={children:[a,l],className:[`f-${r}`]};return e.attrs.className&&(e.config.inputWrap=e.attrs.className),e.config.inline&&d.className.push(`f-${r}-inline`),t.selected&&(a.attrs.checked=!0),n&&(l.attrs.contenteditable=!0),d},u={select:()=>({tag:"option",attrs:t,children:t.label}),button:t=>{const{type:n,label:o,className:i,id:r}=t;return{...e,attrs:{type:n},className:i,id:r||Hi(),options:void 0,children:o,action:e.action}},checkbox:d,radio:d};return null==(a=u[r])?void 0:a.call(u,t)}))}holdsContent(t){return-1!==t.outerHTML.indexOf("/")}isBlockInput(t){return!this.isInput(t)&&this.holdsContent(t)}isInput(t){let e=t;return"string"!=typeof e&&(e=e.tagName),zd.has(e)}parsedHtml(t){const e=document.createElement("textarea");return e.innerHTML=t,e.textContent}labelAfter(t){const e=Kr.get(t,"attrs.type"),n=Kr.get(t,"config.labelAfter");return void 0!==n?n:"checkbox"===e||"radio"===e}label(t,e){const n=Kr.get(t,"attrs.required");let{config:{label:o=""}}=t;const{id:i,attrs:r}=t;"function"==typeof o&&(o=o());const s={tag:"label",attrs:{for:i||(null==r?void 0:r.id)},className:[],children:[o,n&&this.requiredMark()],action:{}};return e&&(s.attrs.for=void 0,s.attrs.contenteditable=!0,s.fMap=e),s}childType(t){return void 0===t?t:[["array",t=>Array.isArray(t)],["node",t=>t instanceof window.Node||t instanceof window.HTMLElement],["component",()=>null==t?void 0:t.dom],[typeof t,()=>!0]].find((e=>e[1](t)))[0]}getStyle(t,e=!1){let n;return window.getComputedStyle?n=window.getComputedStyle(t,null):t.currentStyle&&(n=t.currentStyle),e?n[e]:n}getElement(t){return{node:()=>t,object:()=>document.getElementById(t.id),string:()=>document.getElementById(t)}[this.childType(t)]()}empty(t){for(;t.firstChild;)this.remove(t.firstChild);return t}remove(t){const e=qi(t);return e?Wd.remove(`${e}s.${t.id}`):t.parentElement.removeChild(t)}removeClasses(t,e){const n={string:t=>t.classList.remove(e),array:t=>{for(const n of e)t.classList.remove(n)}};n.object=n.string,Kr.forEach(t,n[this.childType(e)])}addClasses(t,e){const n={string:t=>t.classList.add(e),array:t=>{for(const n of e)t.classList.add(n)}};Kr.forEach(t,n[this.childType(e)])}formGroup(t,e=""){return{className:["f-field-group",e],children:t}}coords(t){const e=t.getBoundingClientRect(),n=document.body.getBoundingClientRect();return{pageX:e.left+e.width/2,pageY:e.top-n.top-e.height/2}}clearStage(t){t.classList.add("removing-all-fields");Qr.slideUp(t,600,(()=>{qd.empty(t),t.classList.remove("removing-all-fields"),qd.emptyClass(t),Qr.slideDown(t,300)}))}toggleSortable(t,e){let n=e;const o=qi(t);if(!o)return;const i=qi(t.parentElement),r=qd[o].get(t.id).sortable;n||(n=!r.option("disabled")),r.option("disabled",n),i&&["rows","columns","stages"].includes(i)&&this.toggleSortable(t.parentElement,n)}emptyClass(t){const e=t.getElementsByClassName(N.get(t.classList.item(0)));t.classList.toggle("empty",!e.length)}};r.addLanguage("en-US",void 0);const Ud={get editor(){return{stickyControls:!1,allowEdit:!0,dataType:"json",debug:!1,sessionStorage:!1,editorContainer:null,external:{},svgSprite:g,style:b,iconFont:null,config:{},events:{},actions:{},controls:{},polyfills:Jr(),i18n:{location:"https://draggable.github.io/formeo/assets/lang/"},onLoad:()=>{}}}};let Hd=class{constructor({formData:t,...e},n){const o=Xi(Ud.editor,e),{actions:i,events:r,debug:s,config:a,editorContainer:l,...c}=o;l&&(this.editorContainer="string"==typeof l?document.querySelector(l):l),this.opts=c,qd.setOptions=c,Wd.config=a,this.userFormData=n||t,this.Components=Wd,this.dom=qd,os.init({debug:s,...r}),jc.init({debug:s,sessionStorage:c.sessionStorage,...i}),this.tooltip=new u,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",this.loadResources.bind(this)):this.loadResources()}get formData(){return this.Components.formData}set formData(t={}){this.userFormData=or(t),this.load(this.userFormData,this.opts)}get json(){return this.Components.json}async loadResources(){var t;document.removeEventListener("DOMContentLoaded",this.loadResources);const e=[];this.opts.polyfills&&(t=>{const e=Array.isArray(t)?m.filter((({name:e})=>-1!==t.indexOf(e))):m;Promise.all(e.map((({src:t})=>od(t))))})(this.opts.polyfills),await rd(this.opts.svgSprite),e.push((async t=>{if(!ld()&&(await id(t),!ld()))return await id("https://draggable.github.io/formeo/assets/css/formeo.min.css")})(this.opts.style)),e.push(r.init({...this.opts.i18n,locale:null==(t=window.sessionStorage)?void 0:t.getItem(z)}));const n=await Promise.all(e);return this.opts.allowEdit&&this.init(),n}init(){return bd.init(this.opts.controls,this.opts.stickyControls).then((t=>{var e,n;this.controls=t,this.load(this.userFormData,this.opts),this.formId=Wd.get("id"),this.i18n={setLang:t=>{var e;null==(e=window.sessionStorage)||e.setItem(z,t);r.setCurrent(t).then((()=>{this.init()}),console.error)}},null==(n=(e=this.opts).onLoad)||n.call(e,this)}))}load(t=this.userFormData,e=this.opts){this.Components.load(t,e),this.render()}render(){if(!this.controls)return window.requestAnimationFrame((()=>this.render()));if(this.stages=Object.values(Wd.get("stages")),this.opts.controlOnLeft)for(const e of this.stages)e.dom.style.order=1;const t={attrs:{className:"formeo formeo-editor",id:this.formId},content:[this.stages.map((({dom:t})=>t))]};r.current.dir&&(t.attrs.dir=r.current.dir,qd.dir=r.current.dir),this.editor=qd.create(t);(this.controls.container||this.editor).appendChild(this.controls.dom),this.editorContainer&&(qd.empty(this.editorContainer),this.editorContainer.appendChild(this.editor)),os.formeoLoaded=new window.CustomEvent("formeoLoaded",{detail:{formeo:this}}),document.dispatchEvent(os.formeoLoaded)}};const Xd=t=>"string"==typeof t?document.querySelector(t):t,Vd=t=>{const e=t.match(K);return(null==e?void 0:e[0])||t},Yd=t=>t.replace(K,Hi());let Gd=class{constructor(t,e){n(this,"render",((t=this.form)=>{this.form=or(t);const e=document.getElementsByClassName("formeo-render").length,n={id:this.form.id,className:`formeo-render formeo formeo-rendered-${e}`,children:this.processedData};this.renderedForm=qd.render(n),this.applyConditions();const o=this.container.querySelector(".formeo-render");o?o.replaceWith(this.renderedForm):this.container.appendChild(this.renderedForm)})),n(this,"orderChildren",((t,e)=>e.reduce(((e,n)=>(e.push(this.form[t][n]),e)),[]))),n(this,"prefixId",(t=>"f-"+t)),n(this,"processColumn",(({id:t,...e})=>({...e,id:this.prefixId(t),children:this.processFields(e.children),style:`width: ${e.config.width||"100%"}`}))),n(this,"processRows",(t=>this.orderChildren("rows",this.form.stages[t].children).reduce(((t,e)=>(e&&t.push(this.processRow(e)),t)),[]))),n(this,"cacheComponent",(t=>(this.components[Vd(t.id)]=t,t))),n(this,"processRow",((t,e="row")=>{const{config:n,id:o}=t,i=[`formeo-${e}-wrap`],r={...t,children:this.processColumns(t.id),id:this.prefixId(o)};this.cacheComponent(r);const s=[{condition:n.legend,result:()=>({tag:n.fieldset?"legend":"h3",children:n.legend})},{condition:!0,result:()=>r},{condition:n.inputGroup,result:()=>this.addButton(o)}].reduce(((t,{condition:e,result:n})=>(e&&t.push(n()),t)),[]);return n.inputGroup&&i.push("f-input-group-wrap"),{tag:n.fieldset?"fieldset":"div",id:Hi(),className:i,children:s}})),n(this,"cloneComponentData",(t=>{const{children:e=[],id:n,...o}=this.components[t];return Object.assign({},o,{id:Yd(n),children:e.length&&e.map((({id:t})=>this.cloneComponentData(Vd(t))))})})),n(this,"addButton",(t=>qd.render({tag:"button",attrs:{className:"add-input-group btn pull-right",type:"button"},children:"Add +",action:{click:e=>{const n=e.target.parentElement,o=qd.render(this.cloneComponentData(t));n.insertBefore(o,n.lastChild),o.appendChild(qd.render(qd.btnTemplate({className:"remove-input-group",children:qd.icon("remove"),action:{mouseover:({target:t})=>t.parentElement.classList.add("will-remove"),mouseleave:({target:t})=>t.parentElement.classList.remove("will-remove"),click:({target:t})=>t.parentElement.remove()}})))}}}))),n(this,"processColumns",(t=>this.orderChildren("columns",this.form.rows[t].children).map((t=>this.cacheComponent(this.processColumn(t)))))),n(this,"processFields",(t=>this.orderChildren("fields",t).map((({id:t,...e})=>{var n,o;const i=(null==(n=e.config)?void 0:n.controlId)||(null==(o=e.meta)?void 0:o.id),{action:r={},dependencies:s={}}=this.elements[i]||{};s&&ad(s);const a=Xi({action:r},e);return this.cacheComponent({...a,id:this.prefixId(t)})})))),n(this,"handleComponentCondition",((t,e,n)=>{const o=Zd(t);o&&t.addEventListener(o,(t=>{if(this.evaluateCondition(e,t))for(const e of n)this.execResult(e,t)}),!1);const i={target:t};if(this.evaluateCondition(e,i))for(const r of n)this.execResult(r,i)})),n(this,"applyConditions",(()=>{for(const{conditions:t}of Object.values(this.components))if(t)for(const e of t){const{if:t,then:n}=e;for(const e of t){const{source:t,...o}=e;if(Ji(t)){const e=this.getComponents(t);for(const t of e)this.handleComponentCondition(t,o,n)}}}})),n(this,"evaluateCondition",(({sourceProperty:t,targetProperty:e,comparison:n,target:o},i)=>{var r;const s={equals:xa,notEquals:(t,e)=>!xa(t,e),contains:(t,e)=>t.includes(e),notContains:(t,e)=>!t.includes(e)},a=String(i.target[t]),l=String(Ji(o)?this.getComponent(o)[e]:o);return null==(r=s[n])?void 0:r.call(s,a,l)})),n(this,"execResult",(({assignment:t,target:e,targetProperty:n,value:o})=>{var i;const r={equals:t=>{var e;const i={value:()=>{t[n]=o},isNotVisible:()=>{t.parentElement.setAttribute("hidden",!0),t.required=!1},isVisible:()=>{t.parentElement.removeAttribute("hidden"),t.required=t._required}};null==(e=i[n])||e.call(i)}};if(Ji(e)){const n=this.getComponent(e);n&&void 0===n._required&&(n._required=n.required),null==(i=r[t])||i.call(r,n)}})),n(this,"getComponent",(t=>{const e=t.slice(t.indexOf(".")+1);return Ki(t)?this.external[e]:this.renderedForm.querySelector(`#f-${e}`)})),n(this,"getComponents",(t=>{const e=[],n=t.slice(t.indexOf(".")+1);return Ki(t)?e.push(this.external[n]):e.push(...this.renderedForm.querySelectorAll(`[name=f-${n}]`)),e}));const{renderContainer:o,external:i,elements:r,formData:s}=(({editorContainer:t,renderContainer:e,formData:n,...o})=>({elements:{},...o,renderContainer:Xd(e),editorContainer:Xd(t),formData:or(n)}))(t);this.container=o,this.form=or(e||s),this.external=i,this.dom=qd,this.components=Object.create(null),this.elements=r}get processedData(){return Object.values(this.form.stages).map((t=>(t.children=this.processRows(t.id),t.className=w,qd.render(t))))}};const Zd=t=>{const[e]=[["input",t=>["textarea","text"].includes(t.type)],["change",t=>["select"].includes(t.tagName.toLowerCase())||["checkbox","radio"].includes(t.type)]].find((e=>e[1](t)))||[!1];return e};void 0!==window&&(window.FormeoEditor=Hd,window.FormeoRenderer=Gd);const Jd=Hd,Kd=Gd;t.FormeoEditor=Jd,t.FormeoRenderer=Kd,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
|