formeo 4.0.0 → 4.1.1
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/README.md +2 -2
- package/dist/demo/assets/css/demo.min.css +1 -1
- 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/js/demo.min.js +2 -2
- package/dist/demo/assets/js/demo.min.js.gz +0 -0
- package/dist/demo/assets/js/formeo.cjs.js +218 -95
- package/dist/demo/assets/js/formeo.es.js +134 -12
- package/dist/demo/assets/js/formeo.min.cjs.js +3 -3
- package/dist/demo/assets/js/formeo.min.es.js +134 -12
- package/dist/demo/assets/js/formeo.min.js +218 -95
- package/dist/demo/assets/js/formeo.min.umd.js +3 -3
- package/dist/demo/assets/js/formeo.umd.js +218 -95
- package/dist/demo/assets/js/index.min.js +1 -1
- package/dist/demo/assets/js/index.min2.js +1 -1
- package/dist/demo/assets/js/index.min3.js +1 -1
- package/dist/demo/assets/js/mode-json.min.js +1 -1
- package/dist/demo/assets/js/mode-json.min.js.gz +0 -0
- package/dist/demo/assets/js/theme-github_light_default.min.js +1 -1
- package/dist/demo/index.html +1 -1
- package/dist/formeo.cjs.js +218 -95
- package/dist/formeo.css +1 -1
- package/dist/formeo.es.js +134 -12
- package/dist/formeo.min.cjs.js +3 -3
- package/dist/formeo.min.css +1 -1
- package/dist/formeo.min.es.js +134 -12
- package/dist/formeo.min.js +218 -95
- package/dist/formeo.min.umd.js +3 -3
- package/dist/formeo.umd.js +218 -95
- package/package.json +2 -2
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
formeo - https://formeo.io
|
|
4
|
-
Version:
|
|
4
|
+
Version: 4.1.0
|
|
5
5
|
Author: Draggable https://draggable.io
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
"use strict";var t=Object.defineProperty,e=(e,n,o)=>((e,n,o)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o)(e,"symbol"!=typeof n?n+"":n,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n={extension:".lang",location:"assets/lang/",langs:["en-US"],locale:"en-US",override:{}};class o{constructor(t=n){this.langs=Object.create(null),this.loaded=[],this.processConfig(t)}processConfig(t){const{location:e,...o}={...n,...t},i=e.replace(/\/?$/,"/");this.config={location:i,...o};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?o.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 o.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(i,r){if(-1!==n.loaded.indexOf(t)&&e)return n.applyLanguage(n.langs[t]),i(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=o.processFile(e);return n.applyLanguage(t,r),n.loaded.push(t),i(n.langs[t])})).catch((e=>{const o=n.applyLanguage(t);i(o)}))}))}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 i=new o;!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 r=Object.defineProperty,s=(t,e,n)=>((t,e,n)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);const a="_3x4ZIcu-",l="JIt36hCJ",c={triggerName:"tooltip"};class d{constructor(t=c){s(this,"triggerName"),s(this,"tooltip"),s(this,"activeTriggerType",null),s(this,"spacing",12),s(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()})),s(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")}})),s(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()})),s(this,"handleResize",(()=>{this.isVisible()&&this.hide()})),s(this,"handleScroll",(()=>{this.isVisible()&&this.hide()})),this.triggerName=`data-${t.triggerName}`,this.tooltip=document.createElement("div"),this.tooltip.className=`d-tooltip ${a}`,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(l)}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(a)||"none"===getComputedStyle(t).pointerEvents)return!1})).length}show(t,e){this.tooltip.innerHTML=e??"",this.tooltip.classList.add(l);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(l),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=d);const u="formeo",h="3.1.4";var p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function m(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var f=function(){this.__data__=[],this.size=0};var g=function(t,e){return t===e||t!=t&&e!=e},v=g;var b=function(t,e){for(var n=t.length;n--;)if(v(t[n][0],e))return n;return-1},y=b,w=Array.prototype.splice;var C=b;var x=b;var S=b;var E=f,O=function(t){var e=this.__data__,n=y(e,t);return!(n<0)&&(n==e.length-1?e.pop():w.call(e,n,1),--this.size,!0)},_=function(t){var e=this.__data__,n=C(e,t);return n<0?void 0:e[n][1]},A=function(t){return x(this.__data__,t)>-1},N=function(t,e){var n=this.__data__,o=S(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this};function T(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])}}T.prototype.clear=E,T.prototype.delete=O,T.prototype.get=_,T.prototype.has=A,T.prototype.set=N;var P=T,j=P;var k=function(){this.__data__=new j,this.size=0};var D=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n};var $=function(t){return this.__data__.get(t)};var L=function(t){return this.__data__.has(t)},I="object"==typeof p&&p&&p.Object===Object&&p,M=I,W="object"==typeof self&&self&&self.Object===Object&&self,R=M||W||Function("return this")(),F=R.Symbol,B=F,z=Object.prototype,U=z.hasOwnProperty,q=z.toString,V=B?B.toStringTag:void 0;var H=function(t){var e=U.call(t,V),n=t[V];try{t[V]=void 0;var o=!0}catch(r){}var i=q.call(t);return o&&(e?t[V]=n:delete t[V]),i},X=Object.prototype.toString;var Y=H,G=function(t){return X.call(t)},Z=F?F.toStringTag:void 0;var J=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Z&&Z in Object(t)?Y(t):G(t)};var K=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},Q=J,tt=K;var et,nt=function(t){if(!tt(t))return!1;var e=Q(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},ot=R["__core-js_shared__"],it=(et=/[^.]+$/.exec(ot&&ot.keys&&ot.keys.IE_PROTO||""))?"Symbol(src)_1."+et:"";var rt=function(t){return!!it&&it in t},st=Function.prototype.toString;var at=function(t){if(null!=t){try{return st.call(t)}catch(e){}try{return t+""}catch(e){}}return""},lt=nt,ct=rt,dt=K,ut=at,ht=/^\[object .+?Constructor\]$/,pt=Function.prototype,mt=Object.prototype,ft=pt.toString,gt=mt.hasOwnProperty,vt=RegExp("^"+ft.call(gt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var bt=function(t){return!(!dt(t)||ct(t))&&(lt(t)?vt:ht).test(ut(t))},yt=function(t,e){return null==t?void 0:t[e]};var wt=function(t,e){var n=yt(t,e);return bt(n)?n:void 0},Ct=wt(R,"Map"),xt=wt(Object,"create"),St=xt;var Et=function(){this.__data__=St?St(null):{},this.size=0};var Ot=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},_t=xt,At=Object.prototype.hasOwnProperty;var Nt=function(t){var e=this.__data__;if(_t){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return At.call(e,t)?e[t]:void 0},Tt=xt,Pt=Object.prototype.hasOwnProperty;var jt=xt;var kt=Et,Dt=Ot,$t=Nt,Lt=function(t){var e=this.__data__;return Tt?void 0!==e[t]:Pt.call(e,t)},It=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=jt&&void 0===e?"__lodash_hash_undefined__":e,this};function Mt(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])}}Mt.prototype.clear=kt,Mt.prototype.delete=Dt,Mt.prototype.get=$t,Mt.prototype.has=Lt,Mt.prototype.set=It;var Wt=Mt,Rt=P,Ft=Ct;var Bt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var zt=function(t,e){var n=t.__data__;return Bt(e)?n["string"==typeof e?"string":"hash"]:n.map},Ut=zt;var qt=zt;var Vt=zt;var Ht=zt;var Xt=function(){this.size=0,this.__data__={hash:new Wt,map:new(Ft||Rt),string:new Wt}},Yt=function(t){var e=Ut(this,t).delete(t);return this.size-=e?1:0,e},Gt=function(t){return qt(this,t).get(t)},Zt=function(t){return Vt(this,t).has(t)},Jt=function(t,e){var n=Ht(this,t),o=n.size;return n.set(t,e),this.size+=n.size==o?0:1,this};function Kt(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])}}Kt.prototype.clear=Xt,Kt.prototype.delete=Yt,Kt.prototype.get=Gt,Kt.prototype.has=Zt,Kt.prototype.set=Jt;var Qt=Kt,te=P,ee=Ct,ne=Qt;var oe=P,ie=k,re=D,se=$,ae=L,le=function(t,e){var n=this.__data__;if(n instanceof te){var o=n.__data__;if(!ee||o.length<199)return o.push([t,e]),this.size=++n.size,this;n=this.__data__=new ne(o)}return n.set(t,e),this.size=n.size,this};function ce(t){var e=this.__data__=new oe(t);this.size=e.size}ce.prototype.clear=ie,ce.prototype.delete=re,ce.prototype.get=se,ce.prototype.has=ae,ce.prototype.set=le;var de=ce,ue=wt,he=function(){try{var t=ue(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),pe=he;var me=function(t,e,n){"__proto__"==e&&pe?pe(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n},fe=me,ge=g;var ve=function(t,e,n){(void 0!==n&&!ge(t[e],n)||void 0===n&&!(e in t))&&fe(t,e,n)};var be,ye,we,Ce,xe,Se,Ee,Oe=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}}(),_e={exports:{}};be=_e,we=R,Ce=(ye=_e.exports)&&!ye.nodeType&&ye,xe=Ce&&be&&!be.nodeType&&be,Se=xe&&xe.exports===Ce?we.Buffer:void 0,Ee=Se?Se.allocUnsafe:void 0,be.exports=function(t,e){if(e)return t.slice();var n=t.length,o=Ee?Ee(n):new t.constructor(n);return t.copy(o),o};var Ae=_e.exports,Ne=R.Uint8Array,Te=Ne;var Pe=function(t){var e=new t.constructor(t.byteLength);return new Te(e).set(new Te(t)),e};var je=function(t,e){var n=e?Pe(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)};var ke=function(t,e){var n=-1,o=t.length;for(e||(e=Array(o));++n<o;)e[n]=t[n];return e},De=K,$e=Object.create,Le=function(){function t(){}return function(e){if(!De(e))return{};if($e)return $e(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();var Ie=function(t,e){return function(n){return t(e(n))}},Me=Ie(Object.getPrototypeOf,Object),We=Object.prototype;var Re=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||We)},Fe=Le,Be=Me,ze=Re;var Ue=function(t){return"function"!=typeof t.constructor||ze(t)?{}:Fe(Be(t))};var qe=function(t){return null!=t&&"object"==typeof t},Ve=J,He=qe;var Xe=function(t){return He(t)&&"[object Arguments]"==Ve(t)},Ye=qe,Ge=Object.prototype,Ze=Ge.hasOwnProperty,Je=Ge.propertyIsEnumerable,Ke=Xe(function(){return arguments}())?Xe:function(t){return Ye(t)&&Ze.call(t,"callee")&&!Je.call(t,"callee")},Qe=Array.isArray;var tn=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},en=nt,nn=tn;var on=function(t){return null!=t&&nn(t.length)&&!en(t)},rn=on,sn=qe;var an=function(t){return sn(t)&&rn(t)},ln={exports:{}};var cn=function(){return!1};!function(t,e){var n=R,o=cn,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}(ln,ln.exports);var dn=ln.exports,un=J,hn=Me,pn=qe,mn=Function.prototype,fn=Object.prototype,gn=mn.toString,vn=fn.hasOwnProperty,bn=gn.call(Object);var yn=function(t){if(!pn(t)||"[object Object]"!=un(t))return!1;var e=hn(t);if(null===e)return!0;var n=vn.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&gn.call(n)==bn},wn=J,Cn=tn,xn=qe,Sn={};Sn["[object Float32Array]"]=Sn["[object Float64Array]"]=Sn["[object Int8Array]"]=Sn["[object Int16Array]"]=Sn["[object Int32Array]"]=Sn["[object Uint8Array]"]=Sn["[object Uint8ClampedArray]"]=Sn["[object Uint16Array]"]=Sn["[object Uint32Array]"]=!0,Sn["[object Arguments]"]=Sn["[object Array]"]=Sn["[object ArrayBuffer]"]=Sn["[object Boolean]"]=Sn["[object DataView]"]=Sn["[object Date]"]=Sn["[object Error]"]=Sn["[object Function]"]=Sn["[object Map]"]=Sn["[object Number]"]=Sn["[object Object]"]=Sn["[object RegExp]"]=Sn["[object Set]"]=Sn["[object String]"]=Sn["[object WeakMap]"]=!1;var En=function(t){return xn(t)&&Cn(t.length)&&!!Sn[wn(t)]};var On=function(t){return function(e){return t(e)}},_n={exports:{}};!function(t,e){var n=I,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}(_n,_n.exports);var An=_n.exports,Nn=En,Tn=On,Pn=An&&An.isTypedArray,jn=Pn?Tn(Pn):Nn;var kn=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},Dn=me,$n=g,Ln=Object.prototype.hasOwnProperty;var In=function(t,e,n){var o=t[e];Ln.call(t,e)&&$n(o,n)&&(void 0!==n||e in t)||Dn(t,e,n)},Mn=In,Wn=me;var Rn=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?Wn(n,a,l):Mn(n,a,l)}return n};var Fn=/^(?:0|[1-9]\d*)$/;var Bn=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Fn.test(t))&&t>-1&&t%1==0&&t<e},zn=function(t,e){for(var n=-1,o=Array(t);++n<t;)o[n]=e(n);return o},Un=Ke,qn=Qe,Vn=dn,Hn=Bn,Xn=jn,Yn=Object.prototype.hasOwnProperty;var Gn=function(t,e){var n=qn(t),o=!n&&Un(t),i=!n&&!o&&Vn(t),r=!n&&!o&&!i&&Xn(t),s=n||o||i||r,a=s?zn(t.length,String):[],l=a.length;for(var c in t)!e&&!Yn.call(t,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Hn(c,l))||a.push(c);return a};var Zn=K,Jn=Re,Kn=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e},Qn=Object.prototype.hasOwnProperty;var to=Gn,eo=function(t){if(!Zn(t))return Kn(t);var e=Jn(t),n=[];for(var o in t)("constructor"!=o||!e&&Qn.call(t,o))&&n.push(o);return n},no=on;var oo=function(t){return no(t)?to(t,!0):eo(t)},io=Rn,ro=oo;var so=ve,ao=Ae,lo=je,co=ke,uo=Ue,ho=Ke,po=Qe,mo=an,fo=dn,go=nt,vo=K,bo=yn,yo=jn,wo=kn,Co=function(t){return io(t,ro(t))};var xo=de,So=ve,Eo=Oe,Oo=function(t,e,n,o,i,r,s){var a=wo(t,n),l=wo(e,n),c=s.get(l);if(c)so(t,n,c);else{var d=r?r(a,l,n+"",t,e,s):void 0,u=void 0===d;if(u){var h=po(l),p=!h&&fo(l),m=!h&&!p&&yo(l);d=l,h||p||m?po(a)?d=a:mo(a)?d=co(a):p?(u=!1,d=ao(l,!0)):m?(u=!1,d=lo(l,!0)):d=[]:bo(l)||ho(l)?(d=a,ho(a)?d=Co(a):vo(a)&&!go(a)||(d=uo(l))):u=!1}u&&(s.set(l,d),i(d,l,o,r,s),s.delete(l)),so(t,n,d)}},_o=K,Ao=oo,No=kn;var To=function t(e,n,o,i,r){e!==n&&Eo(n,(function(s,a){if(r||(r=new xo),_o(s))Oo(e,n,a,o,t,i,r);else{var l=i?i(No(e,a),s,a+"",e,n,r):void 0;void 0===l&&(l=s),So(e,a,l)}}),Ao)};var Po=function(t){return t};var jo=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)},ko=Math.max;var Do=function(t,e,n){return e=ko(void 0===e?t.length-1:e,0),function(){for(var o=arguments,i=-1,r=ko(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),jo(t,this,a)}};var $o=function(t){return function(){return t}},Lo=he,Io=Lo?function(t,e){return Lo(t,"toString",{configurable:!0,enumerable:!1,value:$o(e),writable:!0})}:Po,Mo=Date.now;var Wo=function(t){var e=0,n=0;return function(){var o=Mo(),i=16-(o-n);if(n=o,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(Io),Ro=Po,Fo=Do,Bo=Wo;var zo=g,Uo=on,qo=Bn,Vo=K;var Ho=function(t,e){return Bo(Fo(t,e,Ro),t+"")},Xo=function(t,e,n){if(!Vo(n))return!1;var o=typeof e;return!!("number"==o?Uo(n)&&qo(e,n.length):"string"==o&&e in n)&&zo(n[e],t)};var Yo=To;const Go=m(function(t){return Ho((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&&Xo(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){Yo(t,e,n,o)}))),Zo=()=>crypto.randomUUID().slice(0,8).slice(0,8),Jo=(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},Ko=t=>{var e;const n=null==(e=t.className)?void 0:e.match(qi);return n&&zi[n[0]]},Qo=t=>Array.from(new Set(t)),ti=t=>{var e;return(null==(e=null==t?void 0:t.attrs)?void 0:e.id)||(null==t?void 0:t.id)||Zo()},ei=(t,e)=>Go({},t,e,((t,e)=>Array.isArray(t)?null!=e?Qo(t.concat(e)):e:Array.isArray(e)?null!=t?Qo(e.concat(t)):e:void 0)),ni=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]=ni(t[n]);return e}if(t instanceof Object){e={};for(const n in t)Object.hasOwn(t,n)&&(e[n]=ni(t[n]));return e}throw new Error("Unable to copy Object, type not supported.")},oi=(t,e)=>t/e*100,ii=t=>`${t.toString()}%`,ri=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){}}}}),si=t=>/^(stage|row|column|field)s./.test(t);function ai(t,e=er){let n;return function(...o){n&&clearTimeout(n),n=setTimeout((()=>t.apply(this,o)),e)}}function li(t){return t}function ci(){}function di(t=Object.create(null)){if("string"==typeof t)try{return JSON.parse(t)}catch(e){return Object.create(null)}return t}const ui=t=>t?ni(di(t)):yr();function hi(t,e,n,o={}){var i;if(!e||!t[n][e])return o;o[`${n}.${e}`]=t[n][e];const r=Gi.get(n);if(r){const s=(null==(i=t[n][e].data)?void 0:i.children)||[];for(const e of s)hi(t,e,r,o)}return o}const pi=u,mi=h,fi=pi,gi="formeo-sprite",vi=[{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"}],bi=`../../lib/icons/${gi}.svg`,yi=bi,wi="development"===process.env.NODE_ENV||!1?yi:`https://cdn.jsdelivr.net/npm/formeo@${mi}/dist/${gi}.svg`,Ci=`https://draggable.github.io/formeo/assets/img/${gi}.svg`,xi=`https://cdn.jsdelivr.net/npm/formeo@${mi}/dist/formeo.min.css`,Si="f-panel",Ei="control-group",Oi=`${fi}-stage`,_i=`${fi}-row`,Ai=`${fi}-column`,Ni=`${fi}-field`,Ti="custom-column-widths",Pi="column-preset",ji="resizing-columns",ki=new Map([[Oi,_i],[_i,Ai],[Ai,Ni]]),Di=["stage","row","column","field"],$i=Di.map((t=>`${t}s`));new Map($i.map(((t,e)=>[t,Di[e]])));const Li=new RegExp(`^${$i.join("|")}.`),Ii=[...Di],Mi=[...$i],Wi=new Map(Mi.map(((t,e)=>[t,Ii[e]]))),Ri=Ii.reduce(((t,e)=>(t[e]=e,t)),{}),Fi=[{name:"controls",className:Ei},{name:"stage",className:Oi},{name:"row",className:_i},{name:"column",className:Ai},{name:"field",className:Ni}],Bi={controls:Ei,stage:Oi,row:_i,column:Ai,field:Ni},zi=Object.entries(Bi).reduce(((t,[e,n])=>(t[n]=e,t)),{}),Ui=Object.values(Bi),qi=new RegExp(`${Ui.join("|")}`,"g"),{childTypeMapVals:Vi,childTypeIndexMapVals:Hi}=Fi.reduce(((t,{name:e},n,o)=>{const{name:i}=o[n+1]||{};return i&&(t.childTypeMapVals.push([e,i]),t.childTypeIndexMapVals.push([`${e}s`,`${i}s`])),t}),{childTypeMapVals:[],childTypeIndexMapVals:[]}),Xi=Vi.slice().map((t=>t.slice().reverse())).reverse(),Yi=new Map(Vi),Gi=new Map(Hi),Zi=new Map(Xi.slice()),Ji=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)),[])),Ki=`${pi}-formData`,Qi=`${pi}-locale`,tr=333,er=Math.round(166.5),nr=Math.round(666),or="formeoSaved",ir="formeoUpdated",rr="formeoOnRender",sr={equals:"==",notEquals:"!=",contains:"⊃",notContains:"!⊃"},ar={equals:"="},lr=["logical","source","sourceProperty","comparison","target","targetProperty","assignment","value"],cr=["isChecked","isNotChecked"],dr=["isVisible","isNotVisible"],ur=["value"],hr={comparison:sr,assignment:ar,logical:{and:"&&",or:"||"}},pr="if",mr="then",fr=()=>({[pr]:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],[mr]:[{target:"",targetProperty:"",assignment:"",value:""}]}),gr=/(\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b)|(\b[0-9a-f]{8}\b)/g,vr=/\bcol-\w+-\d+/g,br="f-i-",yr=()=>({id:ti(),stages:{[ti()]:{}},rows:{},columns:{},fields:{}}),wr=["selected","checked"],Cr=wr.toReversed(),xr="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`)),Sr=new RegExp(`(?!${xr.join("|")})\\w\\S*`,"g"),Er=/\s+/g;function Or(t){if("string"!=typeof t)return t;if(t.trim().match(Er))return t;return t.replace(Sr,(t=>t.charAt(0).toUpperCase()+t.substring(1).replace(/[A-Z]/g,(t=>` ${t}`))))}const _r=(t,e="-")=>t.toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,e),Ar=t=>{if(Array.isArray(t))return t;const e=/[.[\]]/g,n=[];let o=0,i=e.exec(t);for(;null!==i;)n.push(t.slice(o,i.index)),o=i.index+i[0].length,i=e.exec(t);return o<t.length&&n.push(t.slice(o)),n.filter(Boolean)},Nr=(t,e="-")=>Ar(t).join(e);var Tr=J,Pr=qe;var jr=function(t){return"symbol"==typeof t||Pr(t)&&"[object Symbol]"==Tr(t)},kr=Qe,Dr=jr,$r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Lr=/^\w*$/;var Ir=function(t,e){if(kr(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!Dr(t))||(Lr.test(t)||!$r.test(t)||null!=e&&t in Object(e))},Mr=Qt;function Wr(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(Wr.Cache||Mr),n}Wr.Cache=Mr;var Rr=Wr;var Fr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Br=/\\(\\)?/g,zr=function(t){var e=Rr(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(Br,"$1"):n||t)})),e}));var Ur=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},qr=Qe,Vr=jr,Hr=F?F.prototype:void 0,Xr=Hr?Hr.toString:void 0;var Yr=function t(e){if("string"==typeof e)return e;if(qr(e))return Ur(e,t)+"";if(Vr(e))return Xr?Xr.call(e):"";var n=e+"";return"0"==n&&1/e==-1/0?"-0":n},Gr=Yr;var Zr=Qe,Jr=Ir,Kr=zr,Qr=function(t){return null==t?"":Gr(t)};var ts=function(t,e){return Zr(t)?t:Jr(t,e)?[t]:Kr(Qr(t))},es=jr;var ns=function(t){if("string"==typeof t||es(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e},os=ts,is=ns;var rs=function(t,e){for(var n=0,o=(e=os(e,t)).length;null!=t&&n<o;)t=t[is(e[n++])];return n&&n==o?t:void 0};var ss=In,as=ts,ls=Bn,cs=K,ds=ns;var us=function(t,e,n,o){if(!cs(t))return t;for(var i=-1,r=(e=as(e,t)).length,s=r-1,a=t;null!=a&&++i<r;){var l=ds(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=cs(d)?d:ls(e[i+1])?[]:{})}ss(a,l,c),a=a[l]}return t};const hs=m((function(t,e,n){var o=null==t?void 0:rs(t,e);return void 0===o?n:o})),ps=m((function(t,e,n){return null==t?t:us(t,e,n)}));function ms(...t){return t.flat().reduce(((t,e)=>(t[e]=e,t)),{})}var fs=Qt,gs=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},vs=function(t){return this.__data__.has(t)};function bs(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new fs;++e<n;)this.add(t[e])}bs.prototype.add=bs.prototype.push=gs,bs.prototype.has=vs;var ys=bs,ws=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},Cs=function(t,e){return t.has(e)};var xs=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 ys:void 0;for(r.set(t,e),r.set(e,t);++u<a;){var m=t[u],f=e[u];if(o)var g=s?o(f,m,u,e,t,r):o(m,f,u,t,e,r);if(void 0!==g){if(g)continue;h=!1;break}if(p){if(!ws(e,(function(t,e){if(!Cs(p,e)&&(m===t||i(m,t,n,o,r)))return p.push(e)}))){h=!1;break}}else if(m!==f&&!i(m,f,n,o,r)){h=!1;break}}return r.delete(t),r.delete(e),h};var Ss=Ne,Es=g,Os=xs,_s=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,o){n[++e]=[o,t]})),n},As=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n},Ns=F?F.prototype:void 0,Ts=Ns?Ns.valueOf:void 0;var Ps=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 Ss(t),new Ss(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Es(+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=_s;case"[object Set]":var l=1&o;if(a||(a=As),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=Os(a(t),a(e),o,i,r,s);return s.delete(t),d;case"[object Symbol]":if(Ts)return Ts.call(t)==Ts.call(e)}return!1};var js=function(t,e){for(var n=-1,o=e.length,i=t.length;++n<o;)t[i+n]=e[n];return t},ks=Qe;var Ds=function(t,e,n){var o=e(t);return ks(t)?o:js(o,n(t))};var $s=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},Ls=function(){return[]},Is=Object.prototype.propertyIsEnumerable,Ms=Object.getOwnPropertySymbols,Ws=Ms?function(t){return null==t?[]:(t=Object(t),$s(Ms(t),(function(e){return Is.call(t,e)})))}:Ls,Rs=Ie(Object.keys,Object),Fs=Re,Bs=Rs,zs=Object.prototype.hasOwnProperty;var Us=Gn,qs=function(t){if(!Fs(t))return Bs(t);var e=[];for(var n in Object(t))zs.call(t,n)&&"constructor"!=n&&e.push(n);return e},Vs=on;var Hs=Ds,Xs=Ws,Ys=function(t){return Vs(t)?Us(t):qs(t)};var Gs=function(t){return Hs(t,Ys,Xs)},Zs=Object.prototype.hasOwnProperty;var Js=function(t,e,n,o,i,r){var s=1&n,a=Gs(t),l=a.length;if(l!=Gs(e).length&&!s)return!1;for(var c=l;c--;){var d=a[c];if(!(s?d in e:Zs.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 m=s;++c<l;){var f=t[d=a[c]],g=e[d];if(o)var v=s?o(g,f,d,e,t,r):o(f,g,d,t,e,r);if(!(void 0===v?f===g||i(f,g,n,o,r):v)){p=!1;break}m||(m="constructor"==d)}if(p&&!m){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},Ks=wt(R,"DataView"),Qs=Ct,ta=wt(R,"Promise"),ea=wt(R,"Set"),na=wt(R,"WeakMap"),oa=J,ia=at,ra="[object Map]",sa="[object Promise]",aa="[object Set]",la="[object WeakMap]",ca="[object DataView]",da=ia(Ks),ua=ia(Qs),ha=ia(ta),pa=ia(ea),ma=ia(na),fa=oa;(Ks&&fa(new Ks(new ArrayBuffer(1)))!=ca||Qs&&fa(new Qs)!=ra||ta&&fa(ta.resolve())!=sa||ea&&fa(new ea)!=aa||na&&fa(new na)!=la)&&(fa=function(t){var e=oa(t),n="[object Object]"==e?t.constructor:void 0,o=n?ia(n):"";if(o)switch(o){case da:return ca;case ua:return ra;case ha:return sa;case pa:return aa;case ma:return la}return e});var ga=de,va=xs,ba=Ps,ya=Js,wa=fa,Ca=Qe,xa=dn,Sa=jn,Ea="[object Arguments]",Oa="[object Array]",_a="[object Object]",Aa=Object.prototype.hasOwnProperty;var Na=function(t,e,n,o,i,r){var s=Ca(t),a=Ca(e),l=s?Oa:wa(t),c=a?Oa:wa(e),d=(l=l==Ea?_a:l)==_a,u=(c=c==Ea?_a:c)==_a,h=l==c;if(h&&xa(t)){if(!xa(e))return!1;s=!0,d=!1}if(h&&!d)return r||(r=new ga),s||Sa(t)?va(t,e,n,o,i,r):ba(t,e,l,n,o,i,r);if(!(1&n)){var p=d&&Aa.call(t,"__wrapped__"),m=u&&Aa.call(e,"__wrapped__");if(p||m){var f=p?t.value():t,g=m?e.value():e;return r||(r=new ga),i(f,g,n,o,r)}}return!!h&&(r||(r=new ga),ya(t,e,n,o,i,r))},Ta=qe;var Pa=function t(e,n,o,i,r){return e===n||(null==e||null==n||!Ta(e)&&!Ta(n)?e!=e&&n!=n:Na(e,n,o,i,t,r))},ja=Pa;const ka=m((function(t,e){return ja(t,e)})),Da=(t,e)=>void 0===t?"added":void 0===e?"removed":ka(t,e)?"unchanged":"changed";class $a{constructor(t,n=Object.create(null)){e(this,"toJSON",((t,e)=>JSON.stringify(t,null,e))),e(this,"get",(t=>hs(this.data,t))),e(this,"add",((t,e=Object.create(null))=>{const{id:n}=e,o=t||n||ti();return this.set(o,e)})),e(this,"remove",(t=>{const e=Ar(t),n=e.pop(),o=this.get(e);return Array.isArray(o)?o.splice(Number(n),1):o&&delete o[n],o})),e(this,"getData",(()=>Object.entries(this.data).reduce(((t,[e,n])=>(t[e]=(null==n?void 0:n.data)?n.getData():n,t)),{}))),e(this,"setCallbacks",{}),e(this,"configVal",Object.create(null)),this.name=t,this.data=n,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=hs(this.data,t),o=ps(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={entity:this,dataPath:this.dataPath.replace(/\.+$/,""),changePath:this.dataPath+t,value:e,data:o,changeType:Da(n,e),src:this.dom};n&&(i.previousValue=n),ju.formeoUpdated(i)}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)}}class La extends $a{constructor(){super(...arguments),e(this,"load",(t=>{const e=di(t);this.empty();for(const[n,o]of Object.entries(e))this.add(n,o);return this.data})),e(this,"get",(t=>t?hs(this.data,t):this.add())),e(this,"add",((t,e=Object.create(null))=>{const n=t||ti(),o=this.Component({...e,id:n});return this.data[n]=o,this.active=o,o})),e(this,"remove",(t=>{if(Array.isArray(t))for(const e of t)this.get(e).remove();else this.get(t).remove();return this.data})),e(this,"delete",(t=>(delete this.data[t],t))),e(this,"clearAll",((t=!0)=>{const e=Object.values(this.data).map((e=>e.empty(t)));return Promise.all(e)})),e(this,"conditionMap",new Map)}set config(t){this.configVal=ei(this.configVal,ni(t))}get config(){return this.configVal}}
|
|
8
|
+
"use strict";var t,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);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});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="4.1.0";var m="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function f(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var g=function(){this.__data__=[],this.size=0};var v=function(t,e){return t===e||t!=t&&e!=e},b=v;var y=function(t,e){for(var n=t.length;n--;)if(b(t[n][0],e))return n;return-1},w=y,C=Array.prototype.splice;var E=y;var x=y;var S=y;var O=g,_=function(t){var e=this.__data__,n=w(e,t);return!(n<0)&&(n==e.length-1?e.pop():C.call(e,n,1),--this.size,!0)},A=function(t){var e=this.__data__,n=E(e,t);return n<0?void 0:e[n][1]},N=function(t){return x(this.__data__,t)>-1},T=function(t,e){var n=this.__data__,o=S(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this};function P(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])}}P.prototype.clear=O,P.prototype.delete=_,P.prototype.get=A,P.prototype.has=N,P.prototype.set=T;var j=P,k=j;var D=function(){this.__data__=new k,this.size=0};var L=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n};var $=function(t){return this.__data__.get(t)};var I=function(t){return this.__data__.has(t)},M="object"==typeof m&&m&&m.Object===Object&&m,R=M,W="object"==typeof self&&self&&self.Object===Object&&self,F=R||W||Function("return this")(),B=F.Symbol,z=B,U=Object.prototype,q=U.hasOwnProperty,V=U.toString,H=z?z.toStringTag:void 0;var X=function(t){var e=q.call(t,H),n=t[H];try{t[H]=void 0;var o=!0}catch(r){}var i=V.call(t);return o&&(e?t[H]=n:delete t[H]),i},Y=Object.prototype.toString;var G=X,Z=function(t){return Y.call(t)},J=B?B.toStringTag:void 0;var K=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":J&&J in Object(t)?G(t):Z(t)};var Q=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},tt=K,et=Q;var nt,ot=function(t){if(!et(t))return!1;var e=tt(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},it=F["__core-js_shared__"],rt=(nt=/[^.]+$/.exec(it&&it.keys&&it.keys.IE_PROTO||""))?"Symbol(src)_1."+nt:"";var st=function(t){return!!rt&&rt in t},at=Function.prototype.toString;var lt=function(t){if(null!=t){try{return at.call(t)}catch(e){}try{return t+""}catch(e){}}return""},ct=ot,dt=st,ut=Q,ht=lt,pt=/^\[object .+?Constructor\]$/,mt=Function.prototype,ft=Object.prototype,gt=mt.toString,vt=ft.hasOwnProperty,bt=RegExp("^"+gt.call(vt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var yt=function(t){return!(!ut(t)||dt(t))&&(ct(t)?bt:pt).test(ht(t))},wt=function(t,e){return null==t?void 0:t[e]};var Ct=function(t,e){var n=wt(t,e);return yt(n)?n:void 0},Et=Ct(F,"Map"),xt=Ct(Object,"create"),St=xt;var Ot=function(){this.__data__=St?St(null):{},this.size=0};var _t=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},At=xt,Nt=Object.prototype.hasOwnProperty;var Tt=function(t){var e=this.__data__;if(At){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return Nt.call(e,t)?e[t]:void 0},Pt=xt,jt=Object.prototype.hasOwnProperty;var kt=xt;var Dt=Ot,Lt=_t,$t=Tt,It=function(t){var e=this.__data__;return Pt?void 0!==e[t]:jt.call(e,t)},Mt=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=kt&&void 0===e?"__lodash_hash_undefined__":e,this};function Rt(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])}}Rt.prototype.clear=Dt,Rt.prototype.delete=Lt,Rt.prototype.get=$t,Rt.prototype.has=It,Rt.prototype.set=Mt;var Wt=Rt,Ft=j,Bt=Et;var zt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Ut=function(t,e){var n=t.__data__;return zt(e)?n["string"==typeof e?"string":"hash"]:n.map},qt=Ut;var Vt=Ut;var Ht=Ut;var Xt=Ut;var Yt=function(){this.size=0,this.__data__={hash:new Wt,map:new(Bt||Ft),string:new Wt}},Gt=function(t){var e=qt(this,t).delete(t);return this.size-=e?1:0,e},Zt=function(t){return Vt(this,t).get(t)},Jt=function(t){return Ht(this,t).has(t)},Kt=function(t,e){var n=Xt(this,t),o=n.size;return n.set(t,e),this.size+=n.size==o?0:1,this};function Qt(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])}}Qt.prototype.clear=Yt,Qt.prototype.delete=Gt,Qt.prototype.get=Zt,Qt.prototype.has=Jt,Qt.prototype.set=Kt;var te=Qt,ee=j,ne=Et,oe=te;var ie=j,re=D,se=L,ae=$,le=I,ce=function(t,e){var n=this.__data__;if(n instanceof ee){var o=n.__data__;if(!ne||o.length<199)return o.push([t,e]),this.size=++n.size,this;n=this.__data__=new oe(o)}return n.set(t,e),this.size=n.size,this};function de(t){var e=this.__data__=new ie(t);this.size=e.size}de.prototype.clear=re,de.prototype.delete=se,de.prototype.get=ae,de.prototype.has=le,de.prototype.set=ce;var ue=de,he=Ct,pe=function(){try{var t=he(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),me=pe;var fe=function(t,e,n){"__proto__"==e&&me?me(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n},ge=fe,ve=v;var be=function(t,e,n){(void 0!==n&&!ve(t[e],n)||void 0===n&&!(e in t))&&ge(t,e,n)};var ye,we,Ce,Ee,xe,Se,Oe,_e=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}}(),Ae={exports:{}};ye=Ae,Ce=F,Ee=(we=Ae.exports)&&!we.nodeType&&we,xe=Ee&&ye&&!ye.nodeType&&ye,Se=xe&&xe.exports===Ee?Ce.Buffer:void 0,Oe=Se?Se.allocUnsafe:void 0,ye.exports=function(t,e){if(e)return t.slice();var n=t.length,o=Oe?Oe(n):new t.constructor(n);return t.copy(o),o};var Ne=Ae.exports,Te=F.Uint8Array,Pe=Te;var je=function(t){var e=new t.constructor(t.byteLength);return new Pe(e).set(new Pe(t)),e};var ke=function(t,e){var n=e?je(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)};var De=function(t,e){var n=-1,o=t.length;for(e||(e=Array(o));++n<o;)e[n]=t[n];return e},Le=Q,$e=Object.create,Ie=function(){function t(){}return function(e){if(!Le(e))return{};if($e)return $e(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();var Me=function(t,e){return function(n){return t(e(n))}},Re=Me(Object.getPrototypeOf,Object),We=Object.prototype;var Fe=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||We)},Be=Ie,ze=Re,Ue=Fe;var qe=function(t){return"function"!=typeof t.constructor||Ue(t)?{}:Be(ze(t))};var Ve=function(t){return null!=t&&"object"==typeof t},He=K,Xe=Ve;var Ye=function(t){return Xe(t)&&"[object Arguments]"==He(t)},Ge=Ve,Ze=Object.prototype,Je=Ze.hasOwnProperty,Ke=Ze.propertyIsEnumerable,Qe=Ye(function(){return arguments}())?Ye:function(t){return Ge(t)&&Je.call(t,"callee")&&!Ke.call(t,"callee")},tn=Array.isArray;var en=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},nn=ot,on=en;var rn=function(t){return null!=t&&on(t.length)&&!nn(t)},sn=rn,an=Ve;var ln=function(t){return an(t)&&sn(t)},cn={exports:{}};var dn=function(){return!1};!function(t,e){var n=F,o=dn,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}(cn,cn.exports);var un=cn.exports,hn=K,pn=Re,mn=Ve,fn=Function.prototype,gn=Object.prototype,vn=fn.toString,bn=gn.hasOwnProperty,yn=vn.call(Object);var wn=function(t){if(!mn(t)||"[object Object]"!=hn(t))return!1;var e=pn(t);if(null===e)return!0;var n=bn.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&vn.call(n)==yn},Cn=K,En=en,xn=Ve,Sn={};Sn["[object Float32Array]"]=Sn["[object Float64Array]"]=Sn["[object Int8Array]"]=Sn["[object Int16Array]"]=Sn["[object Int32Array]"]=Sn["[object Uint8Array]"]=Sn["[object Uint8ClampedArray]"]=Sn["[object Uint16Array]"]=Sn["[object Uint32Array]"]=!0,Sn["[object Arguments]"]=Sn["[object Array]"]=Sn["[object ArrayBuffer]"]=Sn["[object Boolean]"]=Sn["[object DataView]"]=Sn["[object Date]"]=Sn["[object Error]"]=Sn["[object Function]"]=Sn["[object Map]"]=Sn["[object Number]"]=Sn["[object Object]"]=Sn["[object RegExp]"]=Sn["[object Set]"]=Sn["[object String]"]=Sn["[object WeakMap]"]=!1;var On=function(t){return xn(t)&&En(t.length)&&!!Sn[Cn(t)]};var _n=function(t){return function(e){return t(e)}},An={exports:{}};!function(t,e){var n=M,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}(An,An.exports);var Nn=An.exports,Tn=On,Pn=_n,jn=Nn&&Nn.isTypedArray,kn=jn?Pn(jn):Tn;var Dn=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},Ln=fe,$n=v,In=Object.prototype.hasOwnProperty;var Mn=function(t,e,n){var o=t[e];In.call(t,e)&&$n(o,n)&&(void 0!==n||e in t)||Ln(t,e,n)},Rn=Mn,Wn=fe;var Fn=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?Wn(n,a,l):Rn(n,a,l)}return n};var Bn=/^(?:0|[1-9]\d*)$/;var zn=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Bn.test(t))&&t>-1&&t%1==0&&t<e},Un=function(t,e){for(var n=-1,o=Array(t);++n<t;)o[n]=e(n);return o},qn=Qe,Vn=tn,Hn=un,Xn=zn,Yn=kn,Gn=Object.prototype.hasOwnProperty;var Zn=function(t,e){var n=Vn(t),o=!n&&qn(t),i=!n&&!o&&Hn(t),r=!n&&!o&&!i&&Yn(t),s=n||o||i||r,a=s?Un(t.length,String):[],l=a.length;for(var c in t)!e&&!Gn.call(t,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Xn(c,l))||a.push(c);return a};var Jn=Q,Kn=Fe,Qn=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e},to=Object.prototype.hasOwnProperty;var eo=Zn,no=function(t){if(!Jn(t))return Qn(t);var e=Kn(t),n=[];for(var o in t)("constructor"!=o||!e&&to.call(t,o))&&n.push(o);return n},oo=rn;var io=function(t){return oo(t)?eo(t,!0):no(t)},ro=Fn,so=io;var ao=be,lo=Ne,co=ke,uo=De,ho=qe,po=Qe,mo=tn,fo=ln,go=un,vo=ot,bo=Q,yo=wn,wo=kn,Co=Dn,Eo=function(t){return ro(t,so(t))};var xo=ue,So=be,Oo=_e,_o=function(t,e,n,o,i,r,s){var a=Co(t,n),l=Co(e,n),c=s.get(l);if(c)ao(t,n,c);else{var d=r?r(a,l,n+"",t,e,s):void 0,u=void 0===d;if(u){var h=mo(l),p=!h&&go(l),m=!h&&!p&&wo(l);d=l,h||p||m?mo(a)?d=a:fo(a)?d=uo(a):p?(u=!1,d=lo(l,!0)):m?(u=!1,d=co(l,!0)):d=[]:yo(l)||po(l)?(d=a,po(a)?d=Eo(a):bo(a)&&!vo(a)||(d=ho(l))):u=!1}u&&(s.set(l,d),i(d,l,o,r,s),s.delete(l)),ao(t,n,d)}},Ao=Q,No=io,To=Dn;var Po=function t(e,n,o,i,r){e!==n&&Oo(n,(function(s,a){if(r||(r=new xo),Ao(s))_o(e,n,a,o,t,i,r);else{var l=i?i(To(e,a),s,a+"",e,n,r):void 0;void 0===l&&(l=s),So(e,a,l)}}),No)};var jo=function(t){return t};var ko=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)},Do=Math.max;var Lo=function(t,e,n){return e=Do(void 0===e?t.length-1:e,0),function(){for(var o=arguments,i=-1,r=Do(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),ko(t,this,a)}};var $o=function(t){return function(){return t}},Io=pe,Mo=Io?function(t,e){return Io(t,"toString",{configurable:!0,enumerable:!1,value:$o(e),writable:!0})}:jo,Ro=Date.now;var Wo=function(t){var e=0,n=0;return function(){var o=Ro(),i=16-(o-n);if(n=o,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(Mo),Fo=jo,Bo=Lo,zo=Wo;var Uo=v,qo=rn,Vo=zn,Ho=Q;var Xo=function(t,e){return zo(Bo(t,e,Fo),t+"")},Yo=function(t,e,n){if(!Ho(n))return!1;var o=typeof e;return!!("number"==o?qo(n)&&Vo(e,n.length):"string"==o&&e in n)&&Uo(n[e],t)};var Go=Po;const Zo=f(function(t){return Xo((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&&Yo(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){Go(t,e,n,o)}))),Jo=()=>crypto.randomUUID().slice(0,8).slice(0,8),Ko=(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},Qo=t=>{var e;const n=null==(e=t.className)?void 0:e.match(Vi);return n&&Ui[n[0]]},ti=t=>Array.from(new Set(t)),ei=t=>{var e;return(null==(e=null==t?void 0:t.attrs)?void 0:e.id)||(null==t?void 0:t.id)||Jo()},ni=(t,e)=>Zo({},t,e,((t,e)=>Array.isArray(t)?null!=e?ti(t.concat(e)):e:Array.isArray(e)?null!=t?ti(e.concat(t)):e:void 0)),oi=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]=oi(t[n]);return e}if(t instanceof Object){e={};for(const n in t)Object.hasOwn(t,n)&&(e[n]=oi(t[n]));return e}throw new Error("Unable to copy Object, type not supported.")},ii=(t,e)=>t/e*100,ri=t=>`${t.toString()}%`,si=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){}}}}),ai=t=>/^(stage|row|column|field)s./.test(t);function li(t,e=nr){let n;return function(...o){n&&clearTimeout(n),n=setTimeout((()=>t.apply(this,o)),e)}}function ci(t){return t}function di(){}function ui(t=Object.create(null)){if("string"==typeof t)try{return JSON.parse(t)}catch(e){return Object.create(null)}return t}const hi=t=>t?oi(ui(t)):wr();function pi(t,e,n,o={}){var i;if(!e||!t[n][e])return o;o[`${n}.${e}`]=t[n][e];const r=Zi.get(n);if(r){const s=(null==(i=t[n][e].data)?void 0:i.children)||[];for(const e of s)pi(t,e,r,o)}return o}const mi=h,fi=p,gi=mi,vi="formeo-sprite",bi=[{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"}],yi=`../../lib/icons/${vi}.svg`,wi=yi,Ci="undefined"!=typeof process&&"development"===(null==(t=process.env)?void 0:t.NODE_ENV)||!1?wi:`https://cdn.jsdelivr.net/npm/formeo@${fi}/dist/${vi}.svg`,Ei=`https://draggable.github.io/formeo/assets/img/${vi}.svg`,xi=`https://cdn.jsdelivr.net/npm/formeo@${fi}/dist/formeo.min.css`,Si="f-panel",Oi="control-group",_i=`${gi}-stage`,Ai=`${gi}-row`,Ni=`${gi}-column`,Ti=`${gi}-field`,Pi="custom-column-widths",ji="column-preset",ki="resizing-columns",Di=new Map([[_i,Ai],[Ai,Ni],[Ni,Ti]]),Li=["stage","row","column","field"],$i=Li.map((t=>`${t}s`));new Map($i.map(((t,e)=>[t,Li[e]])));const Ii=new RegExp(`^${$i.join("|")}.`),Mi=[...Li],Ri=[...$i],Wi=new Map(Ri.map(((t,e)=>[t,Mi[e]]))),Fi=Mi.reduce(((t,e)=>(t[e]=e,t)),{}),Bi=[{name:"controls",className:Oi},{name:"stage",className:_i},{name:"row",className:Ai},{name:"column",className:Ni},{name:"field",className:Ti}],zi={controls:Oi,stage:_i,row:Ai,column:Ni,field:Ti},Ui=Object.entries(zi).reduce(((t,[e,n])=>(t[n]=e,t)),{}),qi=Object.values(zi),Vi=new RegExp(`${qi.join("|")}`,"g"),{childTypeMapVals:Hi,childTypeIndexMapVals:Xi}=Bi.reduce(((t,{name:e},n,o)=>{const{name:i}=o[n+1]||{};return i&&(t.childTypeMapVals.push([e,i]),t.childTypeIndexMapVals.push([`${e}s`,`${i}s`])),t}),{childTypeMapVals:[],childTypeIndexMapVals:[]}),Yi=Hi.slice().map((t=>t.slice().reverse())).reverse(),Gi=new Map(Hi),Zi=new Map(Xi),Ji=new Map(Yi.slice()),Ki=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)),[])),Qi=`${mi}-formData`,tr=`${mi}-locale`,er=333,nr=Math.round(166.5),or=Math.round(666),ir="formeoSaved",rr="formeoUpdated",sr="formeoOnRender",ar={equals:"==",notEquals:"!=",contains:"⊃",notContains:"!⊃"},lr={equals:"="},cr=["logical","source","sourceProperty","comparison","target","targetProperty","assignment","value"],dr=["isChecked","isNotChecked"],ur=["isVisible","isNotVisible"],hr=["value"],pr={comparison:ar,assignment:lr,logical:{and:"&&",or:"||"}},mr="if",fr="then",gr=()=>({[mr]:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],[fr]:[{target:"",targetProperty:"",assignment:"",value:""}]}),vr=/(\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b)|(\b[0-9a-f]{8}\b)/g,br=/\bcol-\w+-\d+/g,yr="f-i-",wr=()=>({id:ei(),stages:{[ei()]:{}},rows:{},columns:{},fields:{}}),Cr=["selected","checked"],Er=Cr.toReversed(),xr="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`)),Sr=new RegExp(`(?!${xr.join("|")})\\w\\S*`,"g"),Or=/\s+/g;function _r(t){if("string"!=typeof t)return t;if(t.trim().match(Or))return t;return t.replace(Sr,(t=>t.charAt(0).toUpperCase()+t.substring(1).replace(/[A-Z]/g,(t=>` ${t}`))))}const Ar=(t,e="-")=>t.toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,e),Nr=t=>{if(Array.isArray(t))return t;const e=/[.[\]]/g,n=[];let o=0,i=e.exec(t);for(;null!==i;)n.push(t.slice(o,i.index)),o=i.index+i[0].length,i=e.exec(t);return o<t.length&&n.push(t.slice(o)),n.filter(Boolean)},Tr=(t,e="-")=>Nr(t).join(e);var Pr=K,jr=Ve;var kr=function(t){return"symbol"==typeof t||jr(t)&&"[object Symbol]"==Pr(t)},Dr=tn,Lr=kr,$r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ir=/^\w*$/;var Mr=function(t,e){if(Dr(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!Lr(t))||(Ir.test(t)||!$r.test(t)||null!=e&&t in Object(e))},Rr=te;function Wr(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(Wr.Cache||Rr),n}Wr.Cache=Rr;var Fr=Wr;var Br=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,zr=/\\(\\)?/g,Ur=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(Br,(function(t,n,o,i){e.push(o?i.replace(zr,"$1"):n||t)})),e}));var qr=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},Vr=tn,Hr=kr,Xr=B?B.prototype:void 0,Yr=Xr?Xr.toString:void 0;var Gr=function t(e){if("string"==typeof e)return e;if(Vr(e))return qr(e,t)+"";if(Hr(e))return Yr?Yr.call(e):"";var n=e+"";return"0"==n&&1/e==-1/0?"-0":n},Zr=Gr;var Jr=tn,Kr=Mr,Qr=Ur,ts=function(t){return null==t?"":Zr(t)};var es=function(t,e){return Jr(t)?t:Kr(t,e)?[t]:Qr(ts(t))},ns=kr;var os=function(t){if("string"==typeof t||ns(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e},is=es,rs=os;var ss=function(t,e){for(var n=0,o=(e=is(e,t)).length;null!=t&&n<o;)t=t[rs(e[n++])];return n&&n==o?t:void 0};var as=Mn,ls=es,cs=zn,ds=Q,us=os;var hs=function(t,e,n,o){if(!ds(t))return t;for(var i=-1,r=(e=ls(e,t)).length,s=r-1,a=t;null!=a&&++i<r;){var l=us(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=ds(d)?d:cs(e[i+1])?[]:{})}as(a,l,c),a=a[l]}return t};const ps=f((function(t,e,n){var o=null==t?void 0:ss(t,e);return void 0===o?n:o})),ms=f((function(t,e,n){return null==t?t:hs(t,e,n)}));function fs(...t){return t.flat().reduce(((t,e)=>(t[e]=e,t)),{})}var gs=te,vs=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},bs=function(t){return this.__data__.has(t)};function ys(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new gs;++e<n;)this.add(t[e])}ys.prototype.add=ys.prototype.push=vs,ys.prototype.has=bs;var ws=ys,Cs=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},Es=function(t,e){return t.has(e)};var xs=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 ws:void 0;for(r.set(t,e),r.set(e,t);++u<a;){var m=t[u],f=e[u];if(o)var g=s?o(f,m,u,e,t,r):o(m,f,u,t,e,r);if(void 0!==g){if(g)continue;h=!1;break}if(p){if(!Cs(e,(function(t,e){if(!Es(p,e)&&(m===t||i(m,t,n,o,r)))return p.push(e)}))){h=!1;break}}else if(m!==f&&!i(m,f,n,o,r)){h=!1;break}}return r.delete(t),r.delete(e),h};var Ss=Te,Os=v,_s=xs,As=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,o){n[++e]=[o,t]})),n},Ns=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n},Ts=B?B.prototype:void 0,Ps=Ts?Ts.valueOf:void 0;var js=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 Ss(t),new Ss(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Os(+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=As;case"[object Set]":var l=1&o;if(a||(a=Ns),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=_s(a(t),a(e),o,i,r,s);return s.delete(t),d;case"[object Symbol]":if(Ps)return Ps.call(t)==Ps.call(e)}return!1};var ks=function(t,e){for(var n=-1,o=e.length,i=t.length;++n<o;)t[i+n]=e[n];return t},Ds=tn;var Ls=function(t,e,n){var o=e(t);return Ds(t)?o:ks(o,n(t))};var $s=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},Is=function(){return[]},Ms=Object.prototype.propertyIsEnumerable,Rs=Object.getOwnPropertySymbols,Ws=Rs?function(t){return null==t?[]:(t=Object(t),$s(Rs(t),(function(e){return Ms.call(t,e)})))}:Is,Fs=Me(Object.keys,Object),Bs=Fe,zs=Fs,Us=Object.prototype.hasOwnProperty;var qs=Zn,Vs=function(t){if(!Bs(t))return zs(t);var e=[];for(var n in Object(t))Us.call(t,n)&&"constructor"!=n&&e.push(n);return e},Hs=rn;var Xs=Ls,Ys=Ws,Gs=function(t){return Hs(t)?qs(t):Vs(t)};var Zs=function(t){return Xs(t,Gs,Ys)},Js=Object.prototype.hasOwnProperty;var Ks=function(t,e,n,o,i,r){var s=1&n,a=Zs(t),l=a.length;if(l!=Zs(e).length&&!s)return!1;for(var c=l;c--;){var d=a[c];if(!(s?d in e:Js.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 m=s;++c<l;){var f=t[d=a[c]],g=e[d];if(o)var v=s?o(g,f,d,e,t,r):o(f,g,d,t,e,r);if(!(void 0===v?f===g||i(f,g,n,o,r):v)){p=!1;break}m||(m="constructor"==d)}if(p&&!m){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=Ct(F,"DataView"),ta=Et,ea=Ct(F,"Promise"),na=Ct(F,"Set"),oa=Ct(F,"WeakMap"),ia=K,ra=lt,sa="[object Map]",aa="[object Promise]",la="[object Set]",ca="[object WeakMap]",da="[object DataView]",ua=ra(Qs),ha=ra(ta),pa=ra(ea),ma=ra(na),fa=ra(oa),ga=ia;(Qs&&ga(new Qs(new ArrayBuffer(1)))!=da||ta&&ga(new ta)!=sa||ea&&ga(ea.resolve())!=aa||na&&ga(new na)!=la||oa&&ga(new oa)!=ca)&&(ga=function(t){var e=ia(t),n="[object Object]"==e?t.constructor:void 0,o=n?ra(n):"";if(o)switch(o){case ua:return da;case ha:return sa;case pa:return aa;case ma:return la;case fa:return ca}return e});var va=ue,ba=xs,ya=js,wa=Ks,Ca=ga,Ea=tn,xa=un,Sa=kn,Oa="[object Arguments]",_a="[object Array]",Aa="[object Object]",Na=Object.prototype.hasOwnProperty;var Ta=function(t,e,n,o,i,r){var s=Ea(t),a=Ea(e),l=s?_a:Ca(t),c=a?_a:Ca(e),d=(l=l==Oa?Aa:l)==Aa,u=(c=c==Oa?Aa:c)==Aa,h=l==c;if(h&&xa(t)){if(!xa(e))return!1;s=!0,d=!1}if(h&&!d)return r||(r=new va),s||Sa(t)?ba(t,e,n,o,i,r):ya(t,e,l,n,o,i,r);if(!(1&n)){var p=d&&Na.call(t,"__wrapped__"),m=u&&Na.call(e,"__wrapped__");if(p||m){var f=p?t.value():t,g=m?e.value():e;return r||(r=new va),i(f,g,n,o,r)}}return!!h&&(r||(r=new va),wa(t,e,n,o,i,r))},Pa=Ve;var ja=function t(e,n,o,i,r){return e===n||(null==e||null==n||!Pa(e)&&!Pa(n)?e!=e&&n!=n:Ta(e,n,o,i,t,r))},ka=ja;const Da=f((function(t,e){return ka(t,e)})),La=(t,e)=>void 0===t?"added":void 0===e?"removed":Da(t,e)?"unchanged":"changed";class $a{constructor(t,e=Object.create(null)){n(this,"toJSON",((t,e)=>JSON.stringify(t,null,e))),n(this,"get",(t=>ps(this.data,t))),n(this,"add",((t,e=Object.create(null))=>{const{id:n}=e,o=t||n||ei();return this.set(o,e)})),n(this,"remove",(t=>{const e=Nr(t),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=ps(this.data,t),o=ms(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={entity:this,dataPath:this.dataPath.replace(/\.+$/,""),changePath:this.dataPath+t,value:e,data:o,changeType:La(n,e),src:this.dom};n&&(i.previousValue=n),ku.formeoUpdated(i)}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)}}class Ia extends $a{constructor(){super(...arguments),n(this,"load",(t=>{const e=ui(t);this.empty();for(const[n,o]of Object.entries(e))this.add(n,o);return this.data})),n(this,"get",(t=>t?ps(this.data,t):this.add())),n(this,"add",((t,e=Object.create(null))=>{const n=t||ei(),o=this.Component({...e,id:n});return this.data[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=ni(this.configVal,oi(t))}get config(){return this.configVal}}
|
|
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 Ia(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 Ma(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Ia(Object(n),!0).forEach((function(e){Ra(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ia(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Wa(t){return(Wa="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 Ra(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Fa(){return Fa=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},Fa.apply(this,arguments)}function Ba(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 za(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var Ua=za(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),qa=za(/Edge/i),Va=za(/firefox/i),Ha=za(/safari/i)&&!za(/chrome/i)&&!za(/android/i),Xa=za(/iP(ad|od|hone)/i),Ya=za(/chrome/i)&&za(/android/i),Ga={capture:!1,passive:!1};function Za(t,e,n){t.addEventListener(e,n,!Ua&&Ga)}function Ja(t,e,n){t.removeEventListener(e,n,!Ua&&Ga)}function Ka(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 Qa(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function tl(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&Ka(t,e):Ka(t,e))||o&&t===n)return t;if(t===n)break}while(t=Qa(t))}return null}var el,nl=/\s+/g;function ol(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(nl," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(nl," ")}}function il(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 rl(t,e){var n="";if("string"==typeof t)n=t;else do{var o=il(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 sl(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 al(){var t=document.scrollingElement;return t||document.documentElement}function ll(t,e,n,o,i){if(t.getBoundingClientRect||t===window){var r,s,a,l,c,d,u;if(t!==window&&t.parentNode&&t!==al()?(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,!Ua))do{if(i&&i.getBoundingClientRect&&("none"!==il(i,"transform")||n&&"static"!==il(i,"position"))){var h=i.getBoundingClientRect();s-=h.top+parseInt(il(i,"border-top-width")),a-=h.left+parseInt(il(i,"border-left-width")),l=s+r.height,c=a+r.width;break}}while(i=i.parentNode);if(o&&t!==window){var p=rl(i||t),m=p&&p.a,f=p&&p.d;p&&(l=(s/=f)+(d/=f),c=(a/=m)+(u/=m))}return{top:s,left:a,bottom:l,right:c,width:u,height:d}}}function cl(t,e,n){for(var o=ml(t,!0),i=ll(t)[e];o;){if(!(i>=ll(o)[n]))return o;if(o===al())break;o=ml(o,!1)}return!1}function dl(t,e,n,o){for(var i=0,r=0,s=t.children;r<s.length;){if("none"!==s[r].style.display&&s[r]!==bc.ghost&&(o||s[r]!==bc.dragged)&&tl(s[r],n.draggable,t,!1)){if(i===e)return s[r];i++}r++}return null}function ul(t,e){for(var n=t.lastElementChild;n&&(n===bc.ghost||"none"===il(n,"display")||e&&!Ka(n,e));)n=n.previousElementSibling;return n||null}function hl(t,e){var n=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||t===bc.clone||e&&!Ka(t,e)||n++;return n}function pl(t){var e=0,n=0,o=al();if(t)do{var i=rl(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 ml(t,e){if(!t||!t.getBoundingClientRect)return al();var n=t,o=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=il(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 al();if(o||e)return n;o=!0}}}while(n=n.parentNode);return al()}function fl(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 gl(t,e){return function(){if(!el){var n=arguments;1===n.length?t.call(this,n[0]):t.apply(this,n),el=setTimeout((function(){el=void 0}),e)}}}function vl(t,e,n){t.scrollLeft+=e,t.scrollTop+=n}function bl(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 yl(t,e,n){var o={};return Array.from(t.children).forEach((function(i){var r,s,a,l;if(tl(i,e.draggable,t,!1)&&!i.animated&&i!==n){var c=ll(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 wl="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"!==il(t,"display")&&t!==bc.ghost){e.push({target:t,rect:ll(t)});var n=Ma({},e[e.length-1].rect);if(t.thisAnimationDuration){var o=rl(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=ll(n),l=n.prevFromRect,c=n.prevToRect,d=t.rect,u=rl(n,!0);u&&(a.top-=u.f,a.left-=u.e),n.toRect=a,n.thisAnimationDuration&&fl(l,a)&&!fl(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)),fl(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){il(t,"transition",""),il(t,"transform","");var i=rl(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,il(t,"transform","translate3d("+a+"px,"+l+"px,0)"),this.forRepaintDummy=function(t){return t.offsetWidth}(t),il(t,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),il(t,"transform","translate3d(0,0,0)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout((function(){il(t,"transition",""),il(t,"transform",""),t.animated=!1,t.animatingX=!1,t.animatingY=!1}),o)}}}}var xl=[],Sl={initializeByDefault:!0},El={mount:function(t){for(var e in Sl)Sl.hasOwnProperty(e)&&!(e in t)&&(t[e]=Sl[e]);xl.forEach((function(e){if(e.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")})),xl.push(t)},pluginEvent:function(t,e,n){var o=this;this.eventCanceled=!1,n.cancel=function(){o.eventCanceled=!0};var i=t+"Global";xl.forEach((function(o){e[o.pluginName]&&(e[o.pluginName][i]&&e[o.pluginName][i](Ma({sortable:e},n)),e.options[o.pluginName]&&e[o.pluginName][t]&&e[o.pluginName][t](Ma({sortable:e},n)))}))},initializePlugins:function(t,e,n,o){for(var i in xl.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,Fa(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 xl.forEach((function(o){"function"==typeof o.eventProperties&&Fa(n,o.eventProperties.call(e[o.pluginName],t))})),n},modifyOption:function(t,e,n){var o;return xl.forEach((function(i){t[i.pluginName]&&i.optionListeners&&"function"==typeof i.optionListeners[e]&&(o=i.optionListeners[e].call(t[i.pluginName],n))})),o}};var Ol=["evt"],_l=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=n.evt,i=Ba(n,Ol);El.pluginEvent.bind(bc)(t,e,Ma({dragEl:Nl,parentEl:Tl,ghostEl:Pl,rootEl:jl,nextEl:kl,lastDownEl:Dl,cloneEl:$l,cloneHidden:Ll,dragStarted:Yl,putSortable:Bl,activeSortable:bc.active,originalEvent:o,oldIndex:Il,oldDraggableIndex:Wl,newIndex:Ml,newDraggableIndex:Rl,hideGhostForTarget:mc,unhideGhostForTarget:fc,cloneNowHidden:function(){Ll=!0},cloneNowShown:function(){Ll=!1},dispatchSortableEvent:function(t){Al({sortable:e,name:t,originalEvent:o})}},i))};function Al(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,m=t.extraEventProperties;if(e=e||n&&n[wl]){var f,g=e.options,v="on"+o.charAt(0).toUpperCase()+o.substr(1);!window.CustomEvent||Ua||qa?(f=document.createEvent("Event")).initEvent(o,!0,!0):f=new CustomEvent(o,{bubbles:!0,cancelable:!0}),f.to=s||n,f.from=a||n,f.item=i||n,f.clone=r,f.oldIndex=l,f.newIndex=c,f.oldDraggableIndex=d,f.newDraggableIndex=u,f.originalEvent=h,f.pullMode=p?p.lastPutMode:void 0;var b=Ma(Ma({},m),El.getEventProperties(o,e));for(var y in b)f[y]=b[y];n&&n.dispatchEvent(f),g[v]&&g[v].call(e,f)}}(Ma({putSortable:Bl,cloneEl:$l,targetEl:Nl,rootEl:jl,oldIndex:Il,oldDraggableIndex:Wl,newIndex:Ml,newDraggableIndex:Rl},t))}var Nl,Tl,Pl,jl,kl,Dl,$l,Ll,Il,Ml,Wl,Rl,Fl,Bl,zl,Ul,ql,Vl,Hl,Xl,Yl,Gl,Zl,Jl,Kl,Ql=!1,tc=!1,ec=[],nc=!1,oc=!1,ic=[],rc=!1,sc=[],ac="undefined"!=typeof document,lc=Xa,cc=qa||Ua?"cssFloat":"float",dc=ac&&!Ya&&!Xa&&"draggable"in document.createElement("div"),uc=function(){if(ac){if(Ua)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),hc=function(t,e){var n=il(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=dl(t,0,e),r=dl(t,1,e),s=i&&il(i),a=r&&il(r),l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+ll(i).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+ll(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[cc]||r&&"none"===n[cc]&&l+c>o)?"vertical":"horizontal"},pc=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"==Wa(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},mc=function(){!uc&&Pl&&il(Pl,"display","none")},fc=function(){!uc&&Pl&&il(Pl,"display","")};ac&&!Ya&&document.addEventListener("click",(function(t){if(tc)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),tc=!1,!1}),!0);var gc=function(t){if(Nl){t=t.touches?t.touches[0]:t;var e=(i=t.clientX,r=t.clientY,ec.some((function(t){var e=t[wl].options.emptyInsertThreshold;if(e&&!ul(t)){var n=ll(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[wl]._onDragOver(n)}}var i,r,s},vc=function(t){Nl&&Nl.parentNode[wl]._isOutsideThisEl(t.target)};function bc(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=Fa({},e),t[wl]=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 hc(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!==bc.supportPointer&&"PointerEvent"in window&&!Ha,emptyInsertThreshold:5};for(var o in El.initializePlugins(this,t,n),n)!(o in e)&&(e[o]=n[o]);for(var i in pc(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&dc,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?Za(t,"pointerdown",this._onTapStart):(Za(t,"mousedown",this._onTapStart),Za(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(Za(t,"dragover",this),Za(t,"dragenter",this)),ec.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),Fa(this,Cl())}function yc(t,e,n,o,i,r,s,a){var l,c,d=t[wl],u=d.options.onMove;return!window.CustomEvent||Ua||qa?(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||ll(e),l.willInsertAfter=a,l.originalEvent=s,t.dispatchEvent(l),u&&(c=u.call(d,l,s)),c}function wc(t){t.draggable=!1}function Cc(){rc=!1}function xc(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 Sc(t){return setTimeout(t,0)}function Ec(t){return clearTimeout(t)}bc.prototype={constructor:bc,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(Gl=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,Nl):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){sc.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&sc.push(o)}}(n),!Nl&&!(/mousedown|pointerdown/.test(r)&&0!==t.button||o.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!Ha||!a||"SELECT"!==a.tagName.toUpperCase())&&!((a=tl(a,o.draggable,n,!1))&&a.animated||Dl===a)){if(Il=hl(a),Wl=hl(a,o.draggable),"function"==typeof c){if(c.call(this,t,a,this))return Al({sortable:e,rootEl:l,name:"filter",targetEl:a,toEl:n,fromEl:n}),_l("filter",e,{evt:t}),void(i&&t.cancelable&&t.preventDefault())}else if(c&&(c=c.split(",").some((function(o){if(o=tl(l,o.trim(),n,!1))return Al({sortable:e,rootEl:o,name:"filter",targetEl:a,fromEl:n,toEl:n}),_l("filter",e,{evt:t}),!0}))))return void(i&&t.cancelable&&t.preventDefault());o.handle&&!tl(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&&!Nl&&n.parentNode===r){var l=ll(n);if(jl=r,Tl=(Nl=n).parentNode,kl=Nl.nextSibling,Dl=n,Fl=s.group,bc.dragged=Nl,zl={target:Nl,clientX:(e||t).clientX,clientY:(e||t).clientY},Hl=zl.clientX-l.left,Xl=zl.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,Nl.style["will-change"]="all",o=function(){_l("delayEnded",i,{evt:t}),bc.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!Va&&i.nativeDraggable&&(Nl.draggable=!0),i._triggerDragStart(t,e),Al({sortable:i,name:"choose",originalEvent:t}),ol(Nl,s.chosenClass,!0))},s.ignore.split(",").forEach((function(t){sl(Nl,t.trim(),wc)})),Za(a,"dragover",gc),Za(a,"mousemove",gc),Za(a,"touchmove",gc),Za(a,"mouseup",i._onDrop),Za(a,"touchend",i._onDrop),Za(a,"touchcancel",i._onDrop),Va&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Nl.draggable=!0),_l("delayStart",this,{evt:t}),!s.delay||s.delayOnTouchOnly&&!e||this.nativeDraggable&&(qa||Ua))o();else{if(bc.eventCanceled)return void this._onDrop();Za(a,"mouseup",i._disableDelayedDrag),Za(a,"touchend",i._disableDelayedDrag),Za(a,"touchcancel",i._disableDelayedDrag),Za(a,"mousemove",i._delayedDragTouchMoveHandler),Za(a,"touchmove",i._delayedDragTouchMoveHandler),s.supportPointer&&Za(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(){Nl&&wc(Nl),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;Ja(t,"mouseup",this._disableDelayedDrag),Ja(t,"touchend",this._disableDelayedDrag),Ja(t,"touchcancel",this._disableDelayedDrag),Ja(t,"mousemove",this._delayedDragTouchMoveHandler),Ja(t,"touchmove",this._delayedDragTouchMoveHandler),Ja(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?Za(document,"pointermove",this._onTouchMove):Za(document,e?"touchmove":"mousemove",this._onTouchMove):(Za(Nl,"dragend",this),Za(jl,"dragstart",this._onDragStart));try{document.selection?Sc((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(n){}},_dragStarted:function(t,e){if(Ql=!1,jl&&Nl){_l("dragStarted",this,{evt:e}),this.nativeDraggable&&Za(document,"dragover",vc);var n=this.options;!t&&ol(Nl,n.dragClass,!1),ol(Nl,n.ghostClass,!0),bc.active=this,t&&this._appendGhost(),Al({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(Ul){this._lastX=Ul.clientX,this._lastY=Ul.clientY,mc();for(var t=document.elementFromPoint(Ul.clientX,Ul.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Ul.clientX,Ul.clientY))!==e;)e=t;if(Nl.parentNode[wl]._isOutsideThisEl(t),e)do{if(e[wl]){if(e[wl]._onDragOver({clientX:Ul.clientX,clientY:Ul.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=Qa(e));fc()}},_onTouchMove:function(t){if(zl){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=Pl&&rl(Pl,!0),s=Pl&&r&&r.a,a=Pl&&r&&r.d,l=lc&&Kl&&pl(Kl),c=(i.clientX-zl.clientX+o.x)/(s||1)+(l?l[0]-ic[0]:0)/(s||1),d=(i.clientY-zl.clientY+o.y)/(a||1)+(l?l[1]-ic[1]:0)/(a||1);if(!bc.active&&!Ql){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<n)return;this._onDragStart(t,!0)}if(Pl){r?(r.e+=c-(ql||0),r.f+=d-(Vl||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,")");il(Pl,"webkitTransform",u),il(Pl,"mozTransform",u),il(Pl,"msTransform",u),il(Pl,"transform",u),ql=c,Vl=d,Ul=i}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!Pl){var t=this.options.fallbackOnBody?document.body:jl,e=ll(Nl,!0,lc,!0,t),n=this.options;if(lc){for(Kl=t;"static"===il(Kl,"position")&&"none"===il(Kl,"transform")&&Kl!==document;)Kl=Kl.parentNode;Kl!==document.body&&Kl!==document.documentElement?(Kl===document&&(Kl=al()),e.top+=Kl.scrollTop,e.left+=Kl.scrollLeft):Kl=al(),ic=pl(Kl)}ol(Pl=Nl.cloneNode(!0),n.ghostClass,!1),ol(Pl,n.fallbackClass,!0),ol(Pl,n.dragClass,!0),il(Pl,"transition",""),il(Pl,"transform",""),il(Pl,"box-sizing","border-box"),il(Pl,"margin",0),il(Pl,"top",e.top),il(Pl,"left",e.left),il(Pl,"width",e.width),il(Pl,"height",e.height),il(Pl,"opacity","0.8"),il(Pl,"position",lc?"absolute":"fixed"),il(Pl,"zIndex","100000"),il(Pl,"pointerEvents","none"),bc.ghost=Pl,t.appendChild(Pl),il(Pl,"transform-origin",Hl/parseInt(Pl.style.width)*100+"% "+Xl/parseInt(Pl.style.height)*100+"%")}},_onDragStart:function(t,e){var n=this,o=t.dataTransfer,i=n.options;_l("dragStart",this,{evt:t}),bc.eventCanceled?this._onDrop():(_l("setupClone",this),bc.eventCanceled||(($l=bl(Nl)).removeAttribute("id"),$l.draggable=!1,$l.style["will-change"]="",this._hideClone(),ol($l,this.options.chosenClass,!1),bc.clone=$l),n.cloneId=Sc((function(){_l("clone",n),bc.eventCanceled||(n.options.removeCloneOnHide||jl.insertBefore($l,Nl),n._hideClone(),Al({sortable:n,name:"clone"}))})),!e&&ol(Nl,i.dragClass,!0),e?(tc=!0,n._loopId=setInterval(n._emulateDragOver,50)):(Ja(document,"mouseup",n._onDrop),Ja(document,"touchend",n._onDrop),Ja(document,"touchcancel",n._onDrop),o&&(o.effectAllowed="move",i.setData&&i.setData.call(n,o,Nl)),Za(document,"drop",n),il(Nl,"transform","translateZ(0)")),Ql=!0,n._dragStartId=Sc(n._dragStarted.bind(n,e,t)),Za(document,"selectstart",n),Yl=!0,Ha&&il(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=bc.active,d=Fl===l,u=a.sort,h=Bl||c,p=this,m=!1;if(!rc){if(void 0!==t.preventDefault&&t.cancelable&&t.preventDefault(),s=tl(s,a.draggable,r,!0),T("dragOver"),bc.eventCanceled)return m;if(Nl.contains(t.target)||s.animated&&s.animatingX&&s.animatingY||p._ignoreWhileAnimating===s)return j(!1);if(tc=!1,c&&!a.disabled&&(d?u||(o=Tl!==jl):Bl===this||(this.lastPutMode=Fl.checkPull(this,c,Nl,t))&&l.checkPut(this,c,Nl,t))){if(i="vertical"===this._getDirection(t,s),e=ll(Nl),T("dragOverValid"),bc.eventCanceled)return m;if(o)return Tl=jl,P(),this._hideClone(),T("revert"),bc.eventCanceled||(kl?jl.insertBefore(Nl,kl):jl.appendChild(Nl)),j(!0);var f=ul(r,a.draggable);if(!f||function(t,e,n){var o=ll(ul(n.el,n.options.draggable)),i=yl(n.el,n.options,Pl),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)&&!f.animated){if(f===Nl)return j(!1);if(f&&r===t.target&&(s=f),s&&(n=ll(s)),!1!==yc(jl,r,Nl,e,s,n,t,!!s))return P(),f&&f.nextSibling?r.insertBefore(Nl,f.nextSibling):r.appendChild(Nl),Tl=r,k(),j(!0)}else if(f&&function(t,e,n){var o=ll(dl(n.el,0,n.options,!0)),i=yl(n.el,n.options,Pl),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=dl(r,0,a,!0);if(g===Nl)return j(!1);if(n=ll(s=g),!1!==yc(jl,r,Nl,e,s,n,t,!1))return P(),r.insertBefore(Nl,g),Tl=r,k(),j(!0)}else if(s.parentNode===r){n=ll(s);var v,b,y,w=Nl.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}(Nl.animated&&Nl.toRect||e,s.animated&&s.toRect||n,i),x=i?"top":"left",S=cl(s,"top","top")||cl(Nl,"top","top"),E=S?S.scrollTop:void 0;if(Gl!==s&&(b=n[x],nc=!1,oc=!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&&Jl<c*i){if(!nc&&(1===Zl?l>d+c*r/2:l<u-c*r/2)&&(nc=!0),nc)h=!0;else if(1===Zl?l<d+Jl:l>u-Jl)return-Zl}else if(l>d+c*(1-i)/2&&l<u-c*(1-i)/2)return function(t){return hl(Nl)<hl(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,oc,Gl===s),0!==v){var O=hl(Nl);do{O-=v,y=Tl.children[O]}while(y&&("none"===il(y,"display")||y===Pl))}if(0===v||y===s)return j(!1);Gl=s,Zl=v;var _=s.nextElementSibling,A=!1,N=yc(jl,r,Nl,e,s,n,t,A=1===v);if(!1!==N)return 1!==N&&-1!==N||(A=1===N),rc=!0,setTimeout(Cc,30),P(),A&&!_?r.appendChild(Nl):s.parentNode.insertBefore(Nl,A?_:s),S&&vl(S,0,E-S.scrollTop),Tl=Nl.parentNode,void 0===b||oc||(Jl=Math.abs(b-ll(s)[x])),k(),j(!0)}if(r.contains(Nl))return j(!1)}return!1}function T(a,l){_l(a,p,Ma({evt:t,isOwner:d,axis:i?"vertical":"horizontal",revert:o,dragRect:e,targetRect:n,canSort:u,fromSortable:h,target:s,completed:j,onMove:function(n,o){return yc(jl,r,Nl,e,n,ll(n),t,o)},changed:k},l))}function P(){T("dragOverAnimationCapture"),p.captureAnimationState(),p!==h&&h.captureAnimationState()}function j(e){return T("dragOverCompleted",{insertion:e}),e&&(d?c._hideClone():c._showClone(p),p!==h&&(ol(Nl,Bl?Bl.options.ghostClass:c.options.ghostClass,!1),ol(Nl,a.ghostClass,!0)),Bl!==p&&p!==bc.active?Bl=p:p===bc.active&&Bl&&(Bl=null),h===p&&(p._ignoreWhileAnimating=s),p.animateAll((function(){T("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(s===Nl&&!Nl.animated||s===r&&!s.animated)&&(Gl=null),a.dragoverBubble||t.rootEl||s===document||(Nl.parentNode[wl]._isOutsideThisEl(t.target),!e&&gc(t)),!a.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),m=!0}function k(){Ml=hl(Nl),Rl=hl(Nl,a.draggable),Al({sortable:p,name:"change",toEl:r,newIndex:Ml,newDraggableIndex:Rl,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){Ja(document,"mousemove",this._onTouchMove),Ja(document,"touchmove",this._onTouchMove),Ja(document,"pointermove",this._onTouchMove),Ja(document,"dragover",gc),Ja(document,"mousemove",gc),Ja(document,"touchmove",gc)},_offUpEvents:function(){var t=this.el.ownerDocument;Ja(t,"mouseup",this._onDrop),Ja(t,"touchend",this._onDrop),Ja(t,"pointerup",this._onDrop),Ja(t,"touchcancel",this._onDrop),Ja(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;Ml=hl(Nl),Rl=hl(Nl,n.draggable),_l("drop",this,{evt:t}),Tl=Nl&&Nl.parentNode,Ml=hl(Nl),Rl=hl(Nl,n.draggable),bc.eventCanceled||(Ql=!1,oc=!1,nc=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Ec(this.cloneId),Ec(this._dragStartId),this.nativeDraggable&&(Ja(document,"drop",this),Ja(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Ha&&il(document.body,"user-select",""),il(Nl,"transform",""),t&&(Yl&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),Pl&&Pl.parentNode&&Pl.parentNode.removeChild(Pl),(jl===Tl||Bl&&"clone"!==Bl.lastPutMode)&&$l&&$l.parentNode&&$l.parentNode.removeChild($l),Nl&&(this.nativeDraggable&&Ja(Nl,"dragend",this),wc(Nl),Nl.style["will-change"]="",Yl&&!Ql&&ol(Nl,Bl?Bl.options.ghostClass:this.options.ghostClass,!1),ol(Nl,this.options.chosenClass,!1),Al({sortable:this,name:"unchoose",toEl:Tl,newIndex:null,newDraggableIndex:null,originalEvent:t}),jl!==Tl?(Ml>=0&&(Al({rootEl:Tl,name:"add",toEl:Tl,fromEl:jl,originalEvent:t}),Al({sortable:this,name:"remove",toEl:Tl,originalEvent:t}),Al({rootEl:Tl,name:"sort",toEl:Tl,fromEl:jl,originalEvent:t}),Al({sortable:this,name:"sort",toEl:Tl,originalEvent:t})),Bl&&Bl.save()):Ml!==Il&&Ml>=0&&(Al({sortable:this,name:"update",toEl:Tl,originalEvent:t}),Al({sortable:this,name:"sort",toEl:Tl,originalEvent:t})),bc.active&&(null!=Ml&&-1!==Ml||(Ml=Il,Rl=Wl),Al({sortable:this,name:"end",toEl:Tl,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){_l("nulling",this),jl=Nl=Tl=Pl=kl=$l=Dl=Ll=zl=Ul=Yl=Ml=Rl=Il=Wl=Gl=Zl=Bl=Fl=bc.dragged=bc.ghost=bc.clone=bc.active=null,sc.forEach((function(t){t.checked=!0})),sc.length=ql=Vl=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":Nl&&(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++)tl(t=n[o],r.draggable,this.el,!1)&&e.push(t.getAttribute(r.dataIdAttr)||xc(t));return e},sort:function(t,e){var n={},o=this.el;this.toArray().forEach((function(t,e){var i=o.children[e];tl(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 tl(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=El.modifyOption(this,t,e);n[t]=void 0!==o?o:e,"group"===t&&pc(n)},destroy:function(){_l("destroy",this);var t=this.el;t[wl]=null,Ja(t,"mousedown",this._onTapStart),Ja(t,"touchstart",this._onTapStart),Ja(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(Ja(t,"dragover",this),Ja(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),(function(t){t.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),ec.splice(ec.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!Ll){if(_l("hideClone",this),bc.eventCanceled)return;il($l,"display","none"),this.options.removeCloneOnHide&&$l.parentNode&&$l.parentNode.removeChild($l),Ll=!0}},_showClone:function(t){if("clone"===t.lastPutMode){if(Ll){if(_l("showClone",this),bc.eventCanceled)return;Nl.parentNode!=jl||this.options.group.revertClone?kl?jl.insertBefore($l,kl):jl.appendChild($l):jl.insertBefore($l,Nl),this.options.group.revertClone&&this.animate(Nl,$l),il($l,"display",""),Ll=!1}}else this._hideClone()}},ac&&Za(document,"touchmove",(function(t){(bc.active||Ql)&&t.cancelable&&t.preventDefault()})),bc.utils={on:Za,off:Ja,css:il,find:sl,is:function(t,e){return!!tl(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:gl,closest:tl,toggleClass:ol,clone:bl,index:hl,nextTick:Sc,cancelNextTick:Ec,detectDirection:hc,getChild:dl,expando:wl},bc.get=function(t){return t[wl]},bc.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&&(bc.utils=Ma(Ma({},bc.utils),t.utils)),El.mount(t)}))},bc.create=function(t,e){return new bc(t,e)},bc.version="1.15.3";var Oc,_c,Ac,Nc,Tc,Pc,jc=[],kc=!1;function Dc(){jc.forEach((function(t){clearInterval(t.pid)})),jc=[]}function $c(){clearInterval(Pc)}var Lc=gl((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=al(),d=!1;_c!==n&&(_c=n,Dc(),Oc=e.scroll,i=e.scrollFn,!0===Oc&&(Oc=ml(n,!0)));var u=0,h=Oc;do{var p=h,m=ll(p),f=m.top,g=m.bottom,v=m.left,b=m.right,y=m.width,w=m.height,C=void 0,x=void 0,S=p.scrollWidth,E=p.scrollHeight,O=il(p),_=p.scrollLeft,A=p.scrollTop;p===c?(C=y<S&&("auto"===O.overflowX||"scroll"===O.overflowX||"visible"===O.overflowX),x=w<E&&("auto"===O.overflowY||"scroll"===O.overflowY||"visible"===O.overflowY)):(C=y<S&&("auto"===O.overflowX||"scroll"===O.overflowX),x=w<E&&("auto"===O.overflowY||"scroll"===O.overflowY));var N=C&&(Math.abs(b-r)<=a&&_+y<S)-(Math.abs(v-r)<=a&&!!_),T=x&&(Math.abs(g-s)<=a&&A+w<E)-(Math.abs(f-s)<=a&&!!A);if(!jc[u])for(var P=0;P<=u;P++)jc[P]||(jc[P]={});jc[u].vx==N&&jc[u].vy==T&&jc[u].el===p||(jc[u].el=p,jc[u].vx=N,jc[u].vy=T,clearInterval(jc[u].pid),0==N&&0==T||(d=!0,jc[u].pid=setInterval(function(){o&&0===this.layer&&bc.active._onTouchMove(Tc);var e=jc[this.layer].vy?jc[this.layer].vy*l:0,n=jc[this.layer].vx?jc[this.layer].vx*l:0;"function"==typeof i&&"continue"!==i.call(bc.dragged.parentNode[wl],n,e,t,Tc,jc[this.layer].el)||vl(jc[this.layer].el,n,e)}.bind({layer:u}),24))),u++}while(e.bubbleScroll&&h!==c&&(h=ml(h,!1)));kc=d}}),30),Ic=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 Mc(){}function Wc(){}Mc.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=dl(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:Ic},Fa(Mc,{pluginName:"revertOnSpill"}),Wc.prototype={onSpill:function(t){var e=t.dragEl,n=t.putSortable||this.sortable;n.captureAnimationState(),e.parentNode&&e.parentNode.removeChild(e),n.animateAll()},drop:Ic},Fa(Wc,{pluginName:"removeOnSpill"}),bc.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?Za(document,"dragover",this._handleAutoScroll):this.options.supportPointer?Za(document,"pointermove",this._handleFallbackAutoScroll):e.touches?Za(document,"touchmove",this._handleFallbackAutoScroll):Za(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(t){var e=t.originalEvent;this.options.dragOverBubble||e.rootEl||this._handleAutoScroll(e)},drop:function(){this.sortable.nativeDraggable?Ja(document,"dragover",this._handleAutoScroll):(Ja(document,"pointermove",this._handleFallbackAutoScroll),Ja(document,"touchmove",this._handleFallbackAutoScroll),Ja(document,"mousemove",this._handleFallbackAutoScroll)),$c(),Dc(),clearTimeout(el),el=void 0},nulling:function(){Tc=_c=Oc=kc=Pc=Ac=Nc=null,jc.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(Tc=t,e||this.options.forceAutoScrollFallback||qa||Ua||Ha){Lc(t,this.options,r,e);var s=ml(r,!0);!kc||Pc&&o===Ac&&i===Nc||(Pc&&$c(),Pc=setInterval((function(){var r=ml(document.elementFromPoint(o,i),!0);r!==s&&(s=r,Dc()),Lc(t,n.options,r,e)}),10),Ac=o,Nc=i)}else{if(!this.options.bubbleScroll||ml(r,!0)===al())return void Dc();Lc(t,this.options,ml(r,!1),!1)}}},Fa(t,{pluginName:"scroll",initializeByDefault:!0})}),bc.mount(Wc,Mc);const Rc={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=Rc.getStyle(t),i=Number.parseInt(o.height,10),r=i/(e/60);t.style.height="0px",function e(){const o=Number.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=Rc.getStyle(t),i=Number.parseInt(o.height,10),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=Number.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"===Rc.getStyle(t,"display"))=>{n?Rc.slideDown(t,e):Rc.slideUp(t,e)}},Fc=t=>Number.isInteger(Number(t)),Bc=t=>{let e=0,n=t;for(;null==n?void 0:n.previousElementSibling;)n=n.previousElementSibling,e++;return e},zc=(t,e,n)=>{const o=n.split("||"),i=Qo(e).map((e=>t.find((t=>{const n=o.find((e=>!!hs(t,e)));return n&&hs(t,n)===e})))).filter(Boolean).concat(t);return Qo(i)},Uc=(t,e,n)=>{for(let o=0;o<t.length;o++)e.call(n,t[o],o)},qc=(t,e)=>{const n=[];return Uc(t,((t,o)=>n.push(e(t,o)))),n},Vc={},Hc=t=>{if(Vc[t])return Vc[t];const e=({className:"class"}[t]||t).replace(/^\d+/,"").replace(/[^a-zA-Z0-9-:]/g,"");return Vc[t]=e,e},Xc=t=>t.replace(/\b\w/g,(t=>t.toUpperCase())),Yc=()=>-1!==window.navigator.userAgent.indexOf("MSIE "),Gc={capitalize:Xc,safeAttrName:Hc,forEach:Uc,copyObj:t=>window.JSON.parse(window.JSON.stringify(t)),map:qc,subtract:(t,e)=>e.filter((e=>!~t.indexOf(e))),indexOfNode:Bc,isInt:Fc,get:hs,orderObjectsBy:zc,isIE:Yc},Zc={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="${br}${t}">${t}</i>`},Jc=new Set(["input","textarea","select"]),Kc=(t={})=>{var e,n,o;let i=(null==(e=null==t?void 0:t.attrs)?void 0:e.name)||(null==t?void 0:t.name);if(i)return i;const r=ti(t);let s=(null==(n=t.config)?void 0:n.label)||(null==(o=t.attrs)?void 0:o.label)||(null==t?void 0:t.label);return s&&("object"==typeof s&&(s=Qc.create(s).textContent),/^<.+>.+<.+>$/gim.test(s)&&(s=(t=>{const e=document.createElement("div");return e.innerHTML=t,e.textContent||e.innerText||""})(s)),i=`${r}-${_r(((t,e,n="…")=>{if(t.length<=e)return t;const o=t.slice(0,e),i=o.lastIndexOf(" ");let r=`${i>0?o.slice(0,i):o}`;return n&&(r+=n),r})(s,24,null))}`),i||r};const Qc=new class{constructor(t=Object.create(null)){e(this,"render",(t=>(t.id=`f-${t.id||ti()}`,this.create(t)))),e(this,"create",((t,e=!1)=>{if(!t)return;if(this.isDOMElement(t))return t;const n=this,o=["children","content"],{className:i,options:r,dataset:s,conditions:a,...l}=this.processElemArg(t);let c;o.push("tag");const{tag:d}=l;let u;const h={attrs:{},className:[Gc.get(l,"config.inputWrap")],children:[],config:{}};let p=document.createElement(d);const m={string:t=>{p.innerHTML+=t},object:t=>t&&p.appendChild(n.create(t,e)),node:t=>p.appendChild(t),component:t=>p.appendChild(t.dom),array:t=>{for(const e of t)c=n.childType(e),m[c](e)},function:t=>{t=t(),c=n.childType(t),m[c](t)},undefined:()=>null,boolean:()=>null};if(i&&(l.attrs=ei(l.attrs,{className:i})),r){const t=this.processOptions(r,l,e);if(!this.holdsContent(p)||"button"===d)return Gc.forEach(t,(t=>{h.children.push(n.create(t,e))})),l.attrs.className&&(h.className=l.attrs.className),h.id=l.id,h.config={...l.config},this.create(h,e);m.array.call(this,t),l.content=void 0,o.push("options")}if(l.attrs&&(n.processAttrs(l,p,e),o.push("attrs")),l.config){if(l.config.label&&(l.config.label&&"button"!==d||["radio","checkbox"].includes(Gc.get(l,"attrs.type")))&&!e){const t=n.label(l);if(!l.config.hideLabel){const e=[t,p];n.labelAfter(l)&&e.reverse(),h.children.push(e)}}o.push("config")}if(l.content||l.children){const t=l.content||l.children;c=n.childType(t),m[c],m[c].call(this,t)}if(s){for(const t in s)Object.hasOwn(s,t)&&(p.dataset[t]="function"==typeof s[t]?s[t]():s[t]);o.push("dataset")}l.action&&(this.actionHandler(p,l.action),o.push("action"));const f=Gc.subtract(o,Object.keys(l));for(u=f.length-1;u>=0;u--)p[f[u]]=l[f[u]];return h.children.length&&(p=this.create(h)),p})),e(this,"onRender",((t,e,n=333)=>{const o=Date.now(),i=()=>{!t.parentElement&&Date.now()-o<n?window.requestAnimationFrame(i):t.parentElement&&e(t)};i()})),e(this,"toggleElementsByStr",((t,e)=>{const n=[];return Qc.elementsContainText(t,e,((t,e)=>{e?(t.style.display="block",n.push(t)):t.style.display="none"})),n})),e(this,"elementsContainText",((t,e,n)=>{const o=[];return Uc(t,(t=>{const i=-1!==t.textContent.toLowerCase().indexOf(e.toLowerCase());null==n||n(t,i),i&&o.push(t)})),o})),e(this,"generateOption",(({type:t="option",label:e,value:n,i:o=0,selected:r})=>({tag:"option"===t?"option":"input",attrs:{type:t,value:n||`${t}-${o}`,["option"===t?"selected":"checked"]:r||!o},config:{label:e||i.get("labelCount",{label:i.get("option"),count:o})}}))),e(this,"requiredMark",(()=>({tag:"span",className:"text-error",children:"*"}))),e(this,"removeEmpty",(t=>{const e=t.parentElement,n=Ko(t),o=e.getElementsByClassName(`formeo-${n}`);if(this.remove(t),!o.length)return this.isStage(e)?this.emptyClass(e):this.removeEmpty(e)})),e(this,"btnTemplate",(({title:t="",...e})=>({tag:"button",attrs:{type:"button",title:t},...e}))),e(this,"isControls",(t=>Ko(t)===Ei)),e(this,"isStage",(t=>Ko(t)===Oi)),e(this,"isRow",(t=>Ko(t)===_i)),e(this,"isColumn",(t=>Ko(t)===Ai)),e(this,"isField",(t=>Ko(t)===Ni)),e(this,"asComponent",(t=>_u[`${Ko(t)}s`].get(t.id))),this.options=t}set setOptions(t){this.options=ei(this.options,t)}processElemArg(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:Qc.onRender,render:Qc.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(`#${gi} svg symbol`);return this.iconSymbols=Array.from(t).reduce(((t,e)=>{var n;return t[e.id.replace(br,"")]={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=ei(r,e);return this.cachedIcons[i]=Qc.create(t).outerHTML,this.cachedIcons[i]}return this.cachedIcons[i]=Qc.create(r).outerHTML,this.cachedIcons[i]}return(null==(o=Zc[Qc.options.iconFont])?void 0:o.call(Zc,t))||t}processAttrs(t,e,n){const{attrs:o={}}=t;if(!n&&!o.name&&null!==o.name&&this.isInput(t.tag)){const n=Kc(t);n&&e.setAttribute("name",n)}for(const i of Object.keys(o)){const t=Gc.safeAttrName(i),n=this.processAttrValue(o[i]);!1!==n&&e.setAttribute(t,n)}}processAttrValue(t){if("function"==typeof t)return t();if("boolean"==typeof t)return t?"":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,a)=>{var l;const{label:c,value:d,...u}=t,h=()=>{const l={tag:"input",attrs:{name:s,type:r,value:d||"",id:`${s}-${a}`,...u},action:o},h={tag:"label",attrs:{for:`${s}-${a}`},children:c},p={children:[l,h],className:[`f-${r}`]};return i.className&&(e.config.inputWrap=i.className),e.config.inline&&p.className.push(`f-${r}-inline`),t.selected&&(l.attrs.checked=!0),n&&(h.attrs.contenteditable=!0),p},p={select:()=>{const e=t.attrs||t,n={attrs:e,...t,...e},{label:o,checked:i,selected:r,attrs:s}=n;return{tag:"option",attrs:{...s,selected:!(!i&&!r)},children:o}},button:t=>{const{type:n,label:o,className:i,id:r}=t;return{...e,attrs:{type:n},className:i,id:r||ti(),options:void 0,children:o,action:e.action}},checkbox:h,radio:h};return null==(l=p[r])?void 0:l.call(p,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),Jc.has(e)}parsedHtml(t){const e=document.createElement("textarea");return e.innerHTML=t,e.textContent}labelAfter(t){const e=Gc.get(t,"attrs.type"),n=Gc.get(t,"config.labelAfter");return void 0!==n?n:"checkbox"===e||"radio"===e}label(t,e){const n=Gc.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=Ko(t);return e?_u.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,Gc.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)}};Gc.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");Rc.slideUp(t,600,(()=>{Qc.empty(t),t.classList.remove("removing-all-fields"),Qc.emptyClass(t),Rc.slideDown(t,300)}))}toggleSortable(t,e){let n=e;const o=Ko(t);if(!o)return;const i=Ko(t.parentElement),r=Qc[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(ki.get(t.classList.item(0)));t.classList.toggle("empty",!e.length)}isDOMElement(t){return t instanceof window.Element||t instanceof window.HTMLElement||!(!t||"object"!=typeof t||1!==t.nodeType||"string"!=typeof t.nodeName)}},td="f-autocomplete",ed=`${td}-display-field`,nd=`${td}-list`,od="highlight-component",id=`${nd}-item`,rd=["config.label","config.controlId"],sd=[...rd,"config.legend","name"],ad=t=>rd.reduce(((e,n)=>e||t.get(n)),null),ld=t=>sd.reduce(((e,n)=>e||t.get(n)),null)||Or(t.name),cd=new Map([["condition.source",ad],["if.condition.source",ad],["if.condition.target",ad],["then.condition.target",ld],["condition.target",ld]]),dd=({id:t,...e},n)=>{const{name:o,label:i}=e;if(!o)return i;return cd.get(n)(e)},ud=t=>(t.classList.contains(id)||(t=t.parentElement),t),hd=({value:t,textLabel:e,htmlLabel:n,componentType:o,depth:i=0},r)=>{const s={tag:"li",children:n,dataset:{value:t,label:e},className:[id,`${id}-depth-${i}`,`component-type-${o}`],action:{mousedown:({target:t})=>{t=ud(t),r.setValue(t),r.selectOption(t),r.hideList()},mouseover:({target:t})=>{t=ud(t),r.removeHighlight(),r.highlightComponent(t)},mouseleave:({target:t})=>{t=ud(t),r.removeHighlight()}}};return Qc.create(s)},pd=t=>{const e=t.value,n=[],o=_u.flatList(),i=Object.entries(o).reduce(((o,[i,r])=>{const s=dd(r,t.key);if(s){const a=r.name,l={tag:"span",content:` ${Or(a)}`,className:"component-type"},c=`${a}.${s}`;n.push(c);const d=((t,e)=>{const n=t.reduce(((t,n)=>t+(n===e)),0);return n>1?`(${n})`:""})(n,c),u=[`${s} `,{tag:"span",content:d,className:"component-label-count"},l],h=[s,d].join(" ").trim();if(r.isCheckable){const e=((t,e)=>{const n=t.data.options.map(((n,o)=>{const i=`${t.address}.options[${o}]`,r=n.label,s=n.label;return hd({value:i,textLabel:r,htmlLabel:s,componentType:"option",depth:1},e)}));return Qc.create({tag:"ul",attrs:{className:[nd,"options-list"]},children:n})})(r,t);u.push(e)}const p=(({selectedId:t,...e})=>(e.value===t&&(e.selected=!0),e))({value:i,textLabel:h,htmlLabel:u,componentType:a,selectedId:e});o.push(hd(p,t))}return o}),[]);return i};class md{constructor({key:t,value:n,className:o,onChange:i=ci}){e(this,"lastCache",Date.now()),e(this,"optionsCache",null),this.key=t,this.className=[o||this.key.replace(/\./g,"-")].flat(),this.value=n,this.onChange=i||ci,this.events=[],this.build()}createProxy(){return new Proxy(this,{get(t,e){if(e in t)return t[e];if(e in t.dom){const n=t.dom[e];return"function"==typeof n?n.bind(t.dom):n}},set:(t,e,n)=>(e in t?t[e]=n:t.dom[e]=n,!0)})}get isAddress(){return si(this.value)}get valueComponent(){return si(this.value)&&_u.getAddress(this.value)}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(`${td}-focused`);const n=Qc.toggleElementsByStr(this.list.querySelectorAll(`.${id}-depth-0`),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(`${td}-focused`),e.removeEventListener("keydown",t),this.hideList()},input:t=>{const{value:e}=t.target,n=Qc.toggleElementsByStr(this.list.querySelectorAll("li"),e);if(0===e.length&&this.clearValue(),0===n.length)this.hideList();else{const t=this.getActiveOption()||n[0];this.showList(t)}this.setValue({dataset:{label:e,value:e}})}};return this.displayField=Qc.create({tag:"input",autocomplete:"off",action:e,attrs:{type:"text",className:ed,value:this.label||this.value,placeholder:i.get(`${this.key}.placeholder`)}}),this.hiddenField=Qc.create({tag:"input",attrs:{type:"hidden",className:td,value:this.value}}),this.list=Qc.create({tag:"ul",attrs:{className:nd}}),this.clearButton=Qc.create({tag:"span",content:Qc.icon("remove"),className:"clear-button hidden",action:{click:()=>this.clearValue()}}),this.dom=Qc.create({children:[this.displayField,this.clearButton,this.hiddenField],className:[td,this.className].flat(),action:{onRender:t=>{this.stage=t.closest(".formeo-stage"),this.value&&(this.displayField.value=this.label),this.clearButton.classList.toggle("hidden",!this.value.length)}}}),this.dom}get label(){if(!si(this.value))return this.value;const t=this.value&&_u.getAddress(this.value);return t&&dd(t,`${this.key}`)||this.value}updateOptions(){let t=this.optionsCache;const e=Date.now();(e-this.lastCache>5*nr||!t)&&(Qc.empty(this.list),t=this.generateOptions(),this.lastCache=e),this.list.children.length||this.list.append(...t)}generateOptions(){return this.optionsCache=pd(this),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-n.y+"px",left:o.x+window.scrollX-n.x+2+"px",width:`${e}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),Rc.slideDown(e,er)}hideList(t=this.list){Rc.slideUp(t,er),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"),si(t)){const e=_u.getAddress(t);null==(n=null==e?void 0:e.dom)||n.classList.remove(od)}}t&&(t.classList.add("active-option"),this.highlightComponent(t))}removeHighlight(){const t=document.getElementsByClassName(od);for(const e of t)e.classList.remove(od)}highlightComponent(t){var e;const{dataset:{value:n}}=t;if(si(n)){const{componentAddress:t,isOptionAddress:o,optionIndex:i}=Ar(n).reduce(((t,e)=>"options"===e?(t.isOptionAddress=!0,t):t.isOptionAddress?(t.optionIndex=+e,t):(t.componentAddress.push(e),t)),{componentAddress:[],optionIndex:null,isOptionAddress:!1}),r=_u.getAddress(t);if((null==r?void 0:r.dom)&&(r.dom.classList.add(od),o)){null==(e=r.dom.querySelectorAll(".field-preview .f-checkbox, .field-preview .f-radio")[i])||e.classList.add(od)}}}clearValue(){this.selectOption(null),this.setValue({dataset:{label:"",value:""}}),this.displayField.focus()}setValue(t){var e;const{label:n,value:o}=t.dataset;this.displayField.value=n,this.hiddenField.value=o,this.value=o,this.clearButton.classList.toggle("hidden",!o.length),null==(e=this.onChange)||e.call(this,{target:this.hiddenField})}}function fd({key:t,value:e,type:n="text",checked:o}){const r={tag:"input",attrs:{type:n,value:e,placeholder:i.get(`${t}.placeholder`)||Or(t)},className:[t.replace(/\./g,"-")],config:{}};return o&&(r.attrs.checked=!0),r}function gd(t){const e=i.get(t);if(e)return e;const n=t.split(".");return i.get(n[n.length-1])}const vd={autocomplete:(...t)=>new md(...t).createProxy(),string:({key:t,value:e})=>fd({key:t,value:e}),boolean:({key:t,value:e})=>fd({key:t,value:e,type:"selected"===t?"radio":"checkbox",checked:!!e}),number:({key:t,value:e})=>fd({key:t,value:e,type:"number"}),array:({key:t,value:e})=>({tag:"select",attrs:{placeholder:gd(`placeholder.${t}`)},className:[t.replace(/\./g,"-")],options:e}),object:t=>Object.entries(t).map((([t,e])=>vd[Qc.childType(e)]({key:t,value:e})))},bd={boolean:(t,e)=>({click:({target:n})=>{if("radio"===n.type){const t=e.data.options.map((t=>({...t,selected:!1})));e.set("options",t)}e.set(t,n.checked),e.updatePreview()}}),string:(t,e)=>({input:({target:{value:n}})=>{e.set(t,n),e.debouncedUpdatePreview()}}),number:(t,e)=>({input:({target:{value:n}})=>{e.set(t,Number(n)),e.debouncedUpdatePreview()}}),array:(t,e)=>({change:({target:{value:n}})=>{e.set(t,n),e.debouncedUpdatePreview()}}),object:()=>({})},yd="hidden-property",wd=/\.options\[\d+\]$/,Cd={"if-sourceProperty":ms(ur,cr,dr),"if-targetProperty":ms(ur),"then-targetProperty":ms(ur,cr,dr),...Object.entries(hr).reduce(((t,[e,n])=>(t[`if-${e}`]=n,t[`then-${e}`]=n,t)),{})},xd={assignment:Ed,comparison:Ed,logical:Ed,source:({key:t,value:e,onChange:n,conditionType:o})=>vd.autocomplete({key:`${o}.condition.${t}`,value:e,onChange:n,className:`condition-${t}`}),sourceProperty:Ed,targetProperty:Ed,target:t=>xd.source(t),value:({key:t,value:e,onChange:n},o)=>{const i=vd.string({key:`condition.${t}`,value:e});return i.action={input:n},i}};function Sd({key:t,value:e,conditionType:n}){const o=Cd[`${n}-${t}`];return Object.entries(o||{}).map((([n,o])=>function({fieldName:t,fieldValue:e,key:n,optionValue:o}){return{label:i.get(`${t}.${n}`)||Or(n).toLowerCase(),value:o,selected:o===e}}({fieldName:t,fieldValue:e,key:n,optionValue:o})))}function Ed({key:t,value:e,onChange:n,conditionType:o}){const i=Sd({key:t,value:e,conditionType:o}),r=vd.array({key:`condition.${t}`,value:i});return r.action={change:n},r}const Od={sourceProperty:t=>{const e=t.get("source"),n=t.get("sourceProperty"),o=!!e.value,i=!!e.value.match(wd);return Td(i,n),!o},comparison:t=>{const e=t.get("source"),n=t.get("sourceProperty"),o=!!e.value,i=!!e.value.match(wd);return!o||i||"value"!==n.value},assignment:t=>{const e=t.get("target"),n=t.get("targetProperty");return!!!e.value||n.value.startsWith("is")},targetProperty:t=>{const e=t.get("target"),n=t.get("targetProperty"),o=!!e.value.match(wd);return Td(o,n),i=e.value,!Li.test(i);var i},target:t=>{const e=t.get("source"),n=t.get("sourceProperty"),o=!!(null==e?void 0:e.value);return!(!n||o)||n&&"value"!==(null==n?void 0:n.value)},value:t=>{const e=t.get("target"),n=t.get("targetProperty");return void 0!==n&&(!(!e||e.value)||(!!(null==(o=t.get("comparison"))?void 0:o.classList.contains(yd))||(n.value===Ad||n.value.startsWith("is"))));var o}},_d=t=>{var e;for(const[n,o]of t){const i=!!(null==(e=Od[n])?void 0:e.call(Od,t))||!1;o.classList.toggle(yd,i)}},Ad="isChecked",Nd=t=>t.value.endsWith("Checked"),Td=(t,e)=>{var n;if(t&&Nd(e))return null;const o=Array.from(e.querySelectorAll("option")),i=[];for(const r of o){const e=Nd(r),n=t?!e:e;n&&i.push(r.value),r.classList.toggle("hidden-option",n)}i.includes(e.value)&&(e.value=t?Ad:(null==(n=o.find((t=>!Nd(t))))?void 0:n.value)||e.value)};class Pd{constructor({conditionValues:t,conditionType:n,conditionCount:o,index:i},r){e(this,"updateDataDebounced",ai((t=>{ju.formeoUpdated(t),_u.setAddress(t.dataPath,t.value)}))),e(this,"onChangeCondition",(({key:t,target:e})=>{const n={changedProperty:t,dataPath:this.address,value:this.value,src:e};_d(this.fields),this.updateDataDebounced(n)})),this.values=new Map(function(t,e=lr){return e.reduce(((e,n)=>(void 0!==t[n]&&e.push([n,t[n]]),e)),[])}(t)),this.conditionType=n,this.parent=r,this.baseAddress=`${r.address}.${n}`,this.fields=new Map,this.conditionCount=o,this.index=i,this.dom=this.generateDom()}setConditionIndex(t){this.index=t}get address(){return`${this.baseAddress}[${this.index}]`}destroy(){const t=_u.getAddress(this.baseAddress);t.splice(this.index,1),_u.setAddress(this.baseAddress,t),Rc.slideUp(this.dom,er,(()=>{this.dom.remove()}))}label(){return this.index?null:{tag:"label",className:`condition-label ${this.conditionType}-condition-label`,content:i.get(`condition.type.${this.conditionType}`)}}generateDom(){const t=[];for(const[n,o]of this.values){const e=t=>this.onChangeCondition({key:n,target:t.target}),i={key:n,value:o,conditionType:this.conditionType,onChange:e},r=xd[n](i,this.values),s=r.dom||Qc.create(r);this.fields.set(n,r.dom?r:s),t.push(s)}const e={children:[this.label(),...t,...this.generateConditionTypeActionButtons()],className:`f-condition-row ${this.conditionType}-condition-row display-none`,action:{onRender:t=>{this.processUiState()}}};return Qc.create(e)}generateConditionTypeActionButtons(){const t=[],e="manage-condition-type",n=t=>`${t}-condition-type`,o=Qc.btnTemplate({title:i.get(`remove${this.conditionType}Condition`),className:[e,n("remove")],content:Qc.icon("minus"),action:{click:()=>this.destroy(),mouseover:t=>{this.dom.classList.add("to-remove")},mouseout:t=>{this.dom.classList.remove("to-remove")}}});t.push(o);const r=Qc.btnTemplate({title:i.get(`add${this.conditionType}Condition`),className:[e,n("add")],content:Qc.icon("plus"),action:{click:()=>{const t=this.parent.addConditionType(this.conditionType),e={changedProperty:null,dataPath:t.address,value:t.value,src:t.dom};this.updateDataDebounced(e)}}});return t.push(r),t}get value(){return Array.from(this.fields).reduce(((t,[e,n])=>(t[e]=n.value,t)),{})}processUiState(){_d(this.fields),this.dom.classList.remove("display-none")}}const jd=new Map([["attrs",({itemKey:t})=>t],["options",({itemKey:t,key:e})=>`${t}.${e}`]]),kd=(t,e)=>{if("select"===e.controlId){const n=e.editPanels.get("options"),[o,i]=t?wr:Cr,r=n.data.map((({[o]:t,...e})=>({[i]:t,...e})));n.setData(r)}},Dd=new Map([["attrs-multiple",t=>({change:({target:e})=>{"select"===t.field.controlId&&kd(e.checked,t.field)}})]]);class $d{constructor({key:t,index:n,field:o,panel:i,data:r}){e(this,"addConditionType",((t,e)=>{const n=this.findOrCreateConditionTypeWrap(t);let o=e;if(!o){const[e]=fr()[t],i=n.children.length;"if"===t&&(e.logical="||"),o={conditionValues:e,conditionCount:i,index:i}}const i=new Pd({conditionType:t,...o},this);return n.appendChild(i.dom),i})),e(this,"removeConditionType",((t,e)=>{const n=this.conditionTypeWrap.get(t),o=n.children[e];o.destroy(),n.removeChild(o.dom)})),e(this,"generateConditionFields",((t,e)=>(this.conditions=new Map,e.forEach(((n,o)=>{const i=this.addConditionType(t,{index:o,conditionCount:e.length,conditionValues:n});this.conditions.set(o,i)})),this.findOrCreateConditionTypeWrap(t)))),this.field=o,this.itemKey=t,this.itemIndex=n,this.panel=i,this.panelName=i.name,this.isDisabled=o.isDisabledProp(t,this.panelName),this.isHidden=this.isDisabled&&o.config.panels[this.panelName].hideDisabled,this.isLocked=o.isLockedProp(t,this.panelName),this.address=`${o.indexName}.${o.id}.${t}`,this.itemSlug=Nr(t),this.conditionTypeWrap=new Map,void 0!==r&&void 0===this.field.get(this.itemKey)&&this.field.set(this.itemKey,r);const s=[`field-${this.itemSlug}`,"prop-wrap"];this.isHidden&&s.push("hidden-property"),this.dom=Qc.create({tag:"li",className:s,children:{className:"component-prop",children:[this.itemInputs(),this.itemControls]}})}get itemValues(){const t=this.field.get(this.itemKey);return(null==t?void 0:t.constructor)===Object?zc(Object.entries(t),wr,"0"):[[this.itemKey,t]]}findOrCreateConditionTypeWrap(t){let e=this.conditionTypeWrap.get(t);return e||(e=Qc.create({className:`type-conditions-wrap ${t}-conditions-wrap`}),this.conditionTypeWrap.set(t,e),e)}itemInputs(){const t=Qc.create({className:`${this.panelName}-prop-inputs prop-inputs f-input-group`,children:this.itemValues.map((([t,e])=>"conditions"===this.panelName?this.generateConditionFields(t,e):this.itemInput(t,e)))});return this.inputs&&this.inputs.replaceWith(t),this.inputs=t,t}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:()=>{Rc.slideUp(this.dom,tr,(t=>{this.field.remove(this.itemKey),t.remove(),this.panel.updateProps()}))},mouseover:t=>{this.dom.classList.add("to-remove")},mouseout:t=>{this.dom.classList.remove("to-remove")}},content:Qc.icon("remove")};return{className:`${this.panelName}-prop-controls prop-controls`,content:[t]}}itemInput(t,e){var n,o;const i=Qc.childType(e)||"string",r=(null==(n=jd.get(this.panelName))?void 0:n({itemKey:this.itemKey,key:t}))||this.itemKey,s=r.split(".").filter(Number.isNaN).join(".")||t,a=vd[i]({key:t,value:e}),l=`${this.field.shortId}-${Nr(r).replace(/-\d+-(selected)/g,"-$1")}`,c={label:"options"!==this.panelName&&(gd(s)||Or(s)),labelAfter:!1},d={name:"checkbox"===a.attrs.type?`${l}[]`:l};d.disabled=this.isDisabled,d.locked=this.isLocked;const u=null==(o=Dd.get(this.itemSlug))?void 0:o(this),h=function(t,e={}){const n={...t};for(const o in e)Object.hasOwn(e,o)&&(Object.hasOwn(n,o)?Array.isArray(n[o])?n[o].push(e[o]):n[o]=[n[o],e[o]]:n[o]=e[o]);return n}(bd[i](r,this.field),u||{}),p=ei(vd[i]({key:t,value:e}),{action:h,attrs:d,config:c});return wr.includes(t)?{className:"f-addon",children:p}:p}}const Ld={multiple:(t,e)=>{kd(!!t,e)}};class Id{constructor(t,n,o){e(this,"addAttribute",((t,e)=>{var n;let o=e;const r=Hc(t),s=`attrs.${r}`;i.current[s]||i.put(s,Xc(t)),"string"==typeof o&&["true","false"].includes(o)&&(o=JSON.parse(o)),this.component.set(`attrs.${t}`,o),null==(n=Ld[r])||n.call(Ld,o,this.component);const a=this.props.querySelector(`.${this.component.name}-attrs-${r}`),l=new $d({key:s,data:{[r]:o},field:this.component,panel:this});a?a.replaceWith(l.dom):this.props.appendChild(l.dom),this.component.resizePanelWrap()})),e(this,"addOption",(()=>{const t=this.component.data.config.controlId,e=this.component.get("options"),n="select"===t?"option":t,o=i.get("newOptionLabel",{type:n})||"New Option",r=`${this.name}[${this.data.length}]`,s=e[e.length-1],a={...e.length?s:{},label:o};"button"!==t&&(a.value=_r(o));const l=new $d({key:r,data:a,field:this.component,index:this.props.children.length,panel:this});this.editPanelItems.push(l),this.props.appendChild(l.dom),this.component.debouncedUpdatePreview(),this.component.resizePanelWrap()})),e(this,"addCondition",(t=>{const e=`conditions[${this.component.get("conditions").length}]`,n=new $d({key:e,data:t.template,field:this.component,panel:this});this.props.appendChild(n.dom),this.component.set(e,t.template),this.component.resizePanelWrap()})),e(this,"clearAllItems",(()=>{const t="array"===this.type?[]:{},e={type:this.name,removeAction:()=>{this.component.set(this.name,t),this.updateProps()}};Lu.remove[this.name](e);const n=Or(this.name),o=new window.CustomEvent(`onRemove${n}`,{detail:e});document.dispatchEvent(o)})),this.type=Qc.childType(t),this.name=n,this.component=o,this.panelConfig=this.getPanelConfig(this.data)}get data(){const t=this.component.get(this.name);return"object"===this.type?Object.entries(t):t}getPanelConfig(t){return this.props=this.createProps(t),this.editButtons=this.createEditButtons(),{config:{label:i.get(`panel.label.${this.name}`)},attrs:{className:`${Si} ${this.name}-panel`},children:[this.props,this.editButtons]}}createProps(t=this.data){this.editPanelItems=Array.from(t).map(((t,e)=>{const n="array"===this.type,o=n?`[${e}]`:`.${t[0]}`,i=n?t:{[t[0]]:t[1]};return new $d({key:`${this.name}${o}`,data:i,field:this.component,index:e,panel:this})}));const e={tag:"ul",attrs:{className:["edit-group",`${this.component.name}-edit-group`,`${this.component.name}-edit-${this.name}`]},editGroup:this.name,isSortable:"options"===this.name,content:this.editPanelItems};return Qc.create(e)}updateProps(){const t=this.createProps();this.props.replaceWith(t),this.props=t}createEditButtons(){const t=this.name,e=i.get(`panelEditButtons.${t}`),n={attrs:this.addAttribute,options:this.addOption,conditions:this.addCondition},o=[];if("conditions"===t){i.current.clearAll||i.put("clearAll","Clear All");const e={...Qc.btnTemplate({content:[Qc.icon("bin"),i.get("clearAll")],title:i.get("clearAll")}),className:`clear-all-${t}`,action:{click:()=>{this.clearAllItems()}}};o.push(e)}const r={...Qc.btnTemplate({content:e,title:e}),className:`add-${t}`,action:{click:e=>{const o={btnCoords:Qc.coords(e.target),addAction:n[t]};"attrs"===t&&(o.isDisabled=this.component.isDisabledProp,o.isLocked=this.component.isLockedProp,o.message={attr:i.get(`action.add.${t}.attr`),value:i.get(`action.add.${t}.value`)});const r=Or(t),s=new window.CustomEvent(`onAdd${r}`,{detail:o});Lu.add[t](o),document.dispatchEvent(s)}}};o.push(r);return{className:"panel-action-buttons",content:o}}setData(t){this.data=t,this.component.set(this.name,t),this.updateProps()}}const Md=Object.freeze({type:"field",displayType:"slider"}),Wd=t=>({transform:`translateX(${t?`${t}px`:0})`});class Rd{constructor(t){e(this,"toggleTabbedLayout",(()=>{var t;this.getPanelDisplay();const e=this.isTabbed;return null==(t=this.panelsWrap.parentElement)||t.classList.toggle("tabbed-panels",e),e&&this.panelNav.removeAttribute("style"),e})),e(this,"resizePanels",(()=>{this.toggleTabbedLayout()})),this.opts=ei(Md,t),this.panelDisplay=this.opts.displayType,this.activePanelIndex=0,this.panelNav=this.createPanelNav();const n=this.createPanelsWrap();this.nav=this.navActions(),this.nav.groupChange(this.activePanelIndex);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(n),window.clearTimeout(i)}),nr)}getPanelDisplay(){const t=this.panelsWrap,e=Number.parseInt(Qc.getStyle(t,"width"))>390?"tabbed":"slider",n="auto"===this.opts.displayType;return this.panelDisplay=n?e:this.opts.displayType||Md.displayType,this.panelDisplay}createPanelsWrap(){const t=Qc.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 Gc.forEach(e,(t=>{t.fieldId=this.opts.id,t.isSortable&&bc.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=Bc(t.target);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",Qc.create(e)}createPanelNav(){this.labels=this.createPanelNavLabels();const t={tag:"button",attrs:{className:"next-group",title:i.get("controlGroups.nextGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.nextGroup(t)},content:Qc.icon("triangle-right")},e={tag:"button",attrs:{className:"prev-group",title:i.get("controlGroups.prevGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.prevGroup(t)},content:Qc.icon("triangle-left")};return Qc.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=Bc(this.currentPanel);let r={nav:0,panel:0},s={...r};t.groupChange=t=>(this.activePanelIndex=t,this.currentPanel=i[t],Qc.removeClasses(i,"active-panel"),Qc.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=er,animate:r=!this.isTabbed})=>{const a=[Wd(s.panel),Wd(t.panel)],l=[Wd(s.nav),Wd(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=()=>{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}}let Fd=null;const Bd=ms(ur);class zd extends $a{constructor(t,n={}){const o={...n,id:n.id||ti()};super(t,o),e(this,"remove",(t=>{if(t){const e=Ar(t),n=e.pop(),o=this.get(e);return Array.isArray(o)?Fc(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 Uc(n,(t=>t.remove())),this.dom.parentElement.removeChild(this.dom),((t,e)=>{const n=t.indexOf(e);-1!==n&&t.splice(n,1)})(_u.getAddress(`${e.name}s.${e.id}.children`),this.id),e.children.length||e.emptyClass(),"row"===e.name&&e.autoColumnWidths(),_u[`${this.name}s`].delete(this.id)})),e(this,"emptyClass",(()=>this.dom.classList.toggle("empty",!this.children.length))),e(this,"getComponentTag",(()=>Qc.create({tag:"span",className:["component-tag",`${this.name}-tag`],children:[(this.isColumn||this.isField)&&Qc.icon("component-corner",{className:"bottom-left"}),Qc.icon(`handle-${this.name}`),Or(this.name),(this.isColumn||this.isRow)&&Qc.icon("component-corner",{className:"bottom-right"})].filter(Boolean)}))),e(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[Qc.childType(t)](this.dom)})),e(this,"loadChildren",((t=this.data.children)=>t.map((t=>this.addChild({id:t}))))),e(this,"saveChildOrder",(()=>{if(this.render)return;const t=this.children.map((({id:t})=>t));return this.set("children",t),t})),e(this,"onSort",(()=>this.saveChildOrder())),e(this,"onEnd",(({to:{parentElement:t},from:{parentElement:e}})=>{null==t||t.classList.remove(`hovering-${Ko(t)}`),null==e||e.classList.remove(`hovering-${Ko(e)}`)})),e(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)))}))})),e(this,"value",((t,e)=>{const n=t.split("."),o=this.getComponent(t),i=o&&n.slice(2,n.length).join(".");return[!o,!i,!Bd[i]].some(Boolean)?t:e?o.set(Bd[i],e):o.get(Bd[i])})),e(this,"getResult",(t=>({"=":(t,e,n)=>t.set(e,n)}[t]))),e(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)}})))),e(this,"execResults",(t=>{const e=t.map((t=>this.execResult(t)));return Promise.all(e)})),e(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)}})))),e(this,"cloneData",(()=>{const t={...ni(this.data),id:ti()};return"field"!==this.name&&(t.children=[]),t})),e(this,"clone",((t=this.parent)=>{const e=t.addChild(this.cloneData(),this.index+1);return"field"!==this.name&&this.cloneChildren(e),e})),e(this,"createChildWrap",(t=>Qc.create({tag:"ul",attrs:{className:"children"},children:t}))),e(this,"isDisabledProp",((t,e="attrs")=>{const n=this.config.panels[e];if(!n)return!1;return n.disabled.concat(this.get("config.disabled")).includes(t)})),e(this,"isLockedProp",((t,e="attrs")=>{const n=this.config.panels[e];if(!n)return!1;return n.locked.concat(this.get("config.locked")).includes(t)})),e(this,"updateEditPanels",(()=>{if(!this.config)return null;const t=["object","array"],e=Qo([...this.config.panels.order,...Object.keys(this.data)]),n=["children","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=Qc.childType(e);if(t.includes(n)){const t=new Id(e,r,this);this.editPanels.set(t.name,t)}}const i={panels:Array.from(this.editPanels.values()).map((({panelConfig:t})=>t)),id:this.id,displayType:"auto"};this.panels=new Rd(i),this.dom&&(this.dom.querySelector(".panel-nav").replaceWith(this.panels.panelNav),this.dom.querySelector(".panels").replaceWith(this.panels.panelsWrap))})),this.id=o.id,this.shortId=this.id.slice(0,this.id.indexOf("-")),this.name=t,this.indexName=`${t}s`,this.config=_u[`${this.name}s`].config,ei(this.config,o.config),this.address=`${this.name}s.${this.id}`,this.dataPath=`${this.address}.`,this.editPanels=new Map}get js(){return this.data}get json(){return this.data}empty(){const t=this.children.map((t=>(t.remove(),t)));return this.dom.classList.add("empty"),t}getActionButtons(){const t=[`hovering-${this.name}`,"hovering"];return{className:[`${this.name}-actions`,"group-actions"],action:{mouseenter:()=>{_u.stages.active.dom.classList.add(`active-hover-${this.name}`),this.dom.classList.add(...t)},mouseleave:({target:e})=>{this.dom.classList.remove(...t),_u.stages.active.dom.classList.remove(`active-hover-${this.name}`),e.removeAttribute("style")}},children:[{...Qc.btnTemplate({content:Qc.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`);Rc.slideToggle(i,tr,t),"field"===this.name&&(Rc.slideToggle(this.preview,tr,!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}`)=>({...Qc.btnTemplate({content:Qc.icon(t)}),className:["component-handle"]}),move:(t="move")=>({...Qc.btnTemplate({content:Qc.icon(t)}),className:["item-move"],meta:{id:"move"}}),edit:(t="edit")=>({...Qc.btnTemplate({content:Qc.icon(t)}),className:["edit-toggle"],meta:{id:"edit"},action:{click:()=>{this.toggleEdit()}}}),remove:(t="remove")=>({...Qc.btnTemplate({content:Qc.icon(t)}),className:["item-remove"],meta:{id:"remove"},action:{click:()=>{Rc.slideUp(this.dom,tr,(()=>{if("column"===this.name){this.parent.autoColumnWidths(),this.remove()}else this.remove()}))}}}),clone:(t="copy")=>({...Qc.btnTemplate({content:Qc.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 Bc(this.dom)}get parentType(){return Zi.get(this.name)}get parent(){const t=this.parentType;if(!this.dom||!t)return null;const e=this.dom.closest(`.${Bi[t]}`);return e&&Qc.asComponent(e)}get children(){if(!this.dom)return[];const t=this.domChildren,e=Yi.get(this.name);return qc(t,(t=>_u.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=ti()}=i,a=Yi.get(this.name);if(!a)return null;const l=`${a}s`,c=_u.getAddress(`${l}.${s}`)||_u[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(Ei)||(t=t.parentElement);const r=Ko(t),s=Ko(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=Bc(this.dom);return()=>this.parent.addChild(t,e+1)}],[2,t=>()=>this.parent.parent.addChild(t)]]),l={controls:async()=>{if(!Fd){const{default:t}=await Promise.resolve().then((()=>mu));Fd=t}const{controlData:{meta:{id:t},...e}}=Fd.get(n.id);ps(e,"config.controlId",t);const i=t.startsWith("layout-")?t.replace(/^layout-/,""):"field",r=hs({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)();Qc.remove(n);return s(e,o)},row:()=>{const t=(a.get({stage:-1,row:0,column:1}[s])||li)();return null==t?void 0:t({id:n.id},o)},column:()=>{const t=(a.get({stage:-2,row:-1}[s])||li)();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(Ai)&&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&&Qc.onRender(this.dom,t.onRender)}set config(t){const e=hs(t,"all"),n=hs(this.data,"config.controlId"),o=[e,n&&hs(t,n),hs(t,this.id)].reduce(((t,e)=>e?ei(t,e):t),this.configVal);this.configVal=o}get config(){return this.configVal}getComponent(t){const[e,n]=t.split("."),o=_u[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===Ri.row}get isColumn(){return this.name===Ri.column}get isField(){return this.name===Ri.field}get editWindow(){const t={className:["component-edit",`${this.name}-edit`,"slide-toggle","formeo-panels-wrap"]},e=this.editPanels.size;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.querySelector(".edit-toggle"),e=this.dom.querySelector(`.${this.name}-actions`),n=e.getElementsByTagName("button");e.style.maxWidth=n.length*n[0].clientWidth+"px",Qc.remove(t)}else this.resizePanelWrap()}},Qc.create(t)}}class Ud{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=Qc.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(`.${_i}`);if(this.validateResizeTarget(e,n))if(this.startX="touchstart"===t.type?t.touches[0].clientX:t.clientX,o.classList.add(ji),this.columnPreset=o.querySelector(`.${Pi}`),this.originalColumnClass=e.className,this.originalSiblingClass=n.className,e.className=e.className.replace(vr,""),n.className=n.className.replace(vr,""),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(oi(e,this.rowWidth)),i=parseFloat(oi(n,this.rowWidth));return o<10||i<10?null:{colWidth:ii(o.toFixed(1)),siblingColWidth:ii(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(),_u.setAddress(`columns.${t.id}.config.width`,t.dataset.colWidth),_u.setAddress(`columns.${e.id}.config.width`,e.dataset.colWidth),this.row.classList.remove(ji),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(ji),window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onStop)}setCustomWidthValue(){const t=this.columnPreset;let e=t.querySelector(`.${Ti}`);const n=this.row.querySelector(".children").children,o=qc(n,(t=>oi(t.clientWidth,this.rowWidth).toFixed(1))),i=o.join(","),r=o.join(" | ");return e||(e=Qc.create({tag:"option",attrs:{className:Ti,value:i,selected:!0},content:r}),t.append(e)),e.value=i,e.textContent=r,i}}const qd=t=>({className:"resize-x-handle",action:{pointerdown:t.onStart.bind(t)},content:[Qc.icon("triangle-down"),Qc.icon("triangle-up")]}),Vd=()=>({className:"column-edit group-config"});class Hd extends zd{constructor(t){super("column",{...Object.freeze({config:{width:"100%"},children:[],className:[Ai]}),...t}),e(this,"refreshFieldPanels",(()=>{for(const t of this.children)t.panels.nav.refresh()})),e(this,"setDomWidth",(t=>{this.dom.dataset.colWidth=t,this.dom.style.width=t})),e(this,"setWidth",(t=>(this.setDomWidth(t),this.set("config.width",t))));const n=this.createChildWrap();this.dom=Qc.create({tag:"li",className:[Ai,"empty"],dataset:{hoverTag:i.get("column")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),Vd(),qd(new Ud),n]}),this.processConfig(),ju.columnResized=new window.CustomEvent("columnResized",{detail:{column:this.dom,instance:this}}),bc.create(n,{animation:150,fallbackClass:"field-moving",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:`.${Ni}`,handle:".item-move"})}processConfig(){const t=Gc.get(this.data,"config.width");t&&this.setDomWidth(t)}}const Xd={actionButtons:{buttons:["clone","move","remove"],disabled:[]}};const Yd=new class extends La{constructor(t){super("columns",t),this.config={all:Xd}}Component(t){return new Hd(t)}};class Gd extends zd{constructor(t){super("row",{...Object.freeze({config:{fieldset:!1,legend:"",inputGroup:!1},children:[],className:[_i]}),...t}),e(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(vr);const t=n.dom,o=ii(e);n.set("config.width",o),t.style.width=o,t.dataset.colWidth=o;const i=setTimeout((()=>{clearTimeout(i),n.refreshFieldPanels()}),er);document.dispatchEvent(ju.columnResized)}this.updateColumnPreset()})),e(this,"updateColumnPreset",(()=>{this.columnPresetControl.innerHTML="";const t=this.getColumnPresetOptions.map((({label:t,...e})=>Qc.create({tag:"option",content:t,attrs:e})));this.columnPresetControl.append(...t)})),e(this,"setColumnWidths",(t=>{"string"==typeof t&&(t=t.split(",")),this.children.forEach(((e,n)=>{e.setWidth(`${t[n]}%`),e.refreshFieldPanels()}))}));const n=this.createChildWrap();this.dom=Qc.create({tag:"li",className:[_i,"empty"],dataset:{hoverTag:i.get("row"),editingHoverTag:i.get("editing.row")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),this.editWindow,n]}),bc.create(n,{animation:150,fallbackClass:"column-moving",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:`.${Ai}`,handle:".item-move"})}get editWindow(){const t={tag:"input",id:`${this.id}-fieldset`,attrs:{type:"checkbox",checked:this.get("config.fieldset"),ariaLabel:i.get("row.settings.fieldsetWrap.aria")},action:{click:({target:{checked:t}})=>{this.set("config.fieldset",Boolean(t))}},config:{label:i.get("row.settings.fieldsetWrap")}},e={tag:"input",id:`${this.id}-inputGroup`,attrs:{type:"checkbox",checked:this.get("config.inputGroup"),ariaLabel:i.get("row.settings.inputGroup.aria")},action:{click:({target:{checked:t}})=>this.set("config.inputGroup",t)},config:{label:i.get("row.makeInputGroup"),description:i.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=Qc.formGroup([t,n]),r={tag:"label",content:i.get("defineColumnWidths"),className:"col-sm-4 form-control-label"};this.columnPresetControl=Qc.create(this.columnPresetControlConfig);const s={className:"col-sm-8",content:this.columnPresetControl,action:{onRender:()=>{this.updateColumnPreset()}}},a=[e,"hr",o,"hr",Qc.formGroup([r,s],"row")];return Qc.create({className:`${this.name}-edit group-config`,action:{onRender:t=>{const e=a.map((t=>Qc.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=Ji.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:Ti}),t.map((t=>{const e={...t};return e.selected=t.value===n,e}))}return[]}get columnPresetControlConfig(){return{tag:"select",attrs:{ariaLabel:i.get("defineColumnLayout"),className:Pi},action:{change:({target:t})=>{const{value:e}=t;this.setColumnWidths(e)}},options:this.getColumnPresetOptions}}}const Zd={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]}};const Jd=new class extends La{constructor(t){super("rows",t),this.config={all:Zd}}Component(t){return new Gd(t)}};class Kd extends zd{constructor(t){super("stage",{conditions:[fr()],children:[],...t}),this.updateEditPanels(),this.debouncedUpdateEditPanels=ai(this.updateEditPanels),i.get("Untitled Form"),i.get("Untitled Form"),i.get("Form Title"),i.get("Form novalidate"),i.get("Tags");const e=this.createChildWrap();this.dom=Qc.create({attrs:{className:[Oi,"empty"],id:this.id},children:[this.getComponentTag(),this.getActionButtons(),this.editWindow,e]}),bc.create(e,{animation:150,fallbackClass:"row-moving",group:{name:"stage",pull:!0,put:["row","column","controls"]},sort:!0,disabled:!1,onAdd:this.onAdd.bind(this),onRemove:this.onRemove.bind(this),onStart:()=>{Qd.active=this},onSort:this.onSort.bind(this),draggable:`.${_i}`,handle:".item-move"})}empty(t=!0){return new Promise((e=>{t?(this.dom.classList.add("removing-all-fields"),Rc.slideUp(this.dom,tr,(()=>{e(super.empty(t)),this.dom.classList.remove("removing-all-fields"),Rc.slideDown(this.dom,tr)}))):e(super.empty())}))}onAdd(...t){const e=super.onAdd(...t);e&&"column"===e.name&&e.parent.autoColumnWidths()}}const Qd=new class extends La{constructor(t){super("stages",t),this.config={all:{actionButtons:{buttons:["edit"],disabled:[]},panels:{disabled:[],order:["attrs","options","conditions"]}}}}Component(t){return new Kd(t)}},tu={js:new Set,css:new Set},eu=(t,e,n=ci)=>new Promise((o=>fetch(t).then((t=>{if(!t.ok)return o(n(t));o(e?e(t):t)})).catch((t=>n(t))))),nu=(t,e)=>{t.removeEventListener("load",nu),e(t.src)},ou=(t,e)=>{t.removeEventListener("load",ou),e(t.src)},iu=t=>new Promise(((e,n)=>{if(tu.js.has(t))return e(t);tu.js.add(t);const o=Qc.create({tag:"script",attrs:{type:"text/javascript",async:!0,src:t},action:{load:()=>ou(o,e),error:()=>n(new Error(`${t} failed to load.`))}});document.head.appendChild(o)})),ru=t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>new Promise(((e,n)=>{if(tu.css.has(t))return e(t);tu.css.add(t);const o=Qc.create({tag:"link",attrs:{rel:"stylesheet",href:t},action:{load:()=>nu(o,e),error:()=>n(new Error(`${(void 0).src} failed to load.`))}});document.head.appendChild(o)}))));return Promise.all(e)},su=async(t=wi)=>{if(document.getElementById(gi))return;const e=async t=>(t=>{let e=document.getElementById(gi);return e||(e=Qc.create({id:gi,children:t,attrs:{hidden:!0,style:"display: none;"}}),document.body.insertBefore(e,document.body.childNodes[0])),e})(await t.text());return eu(t,e,(()=>eu(Ci,e)))},au={js:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>iu(t)));return Promise.all(e)},css:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>ru(t)));return Promise.all(e)}},lu=t=>{const e=Object.entries(t).map((([t,e])=>au[t](e)));return Promise.all(e)},cu=()=>{const t=document.getElementById(gi);return"hidden"===window.getComputedStyle(t).visibility};class du{constructor({events:t={},dependencies:n={},controlAction:o,...i}){e(this,"controlCache",new Set),this.events=t,this.controlData=i,this.controlAction=o,this.dependencies=n,this.id=i.id||ti()}get controlId(){var t,e;return(null==(t=this.controlData.meta)?void 0:t.id)||(null==(e=this.controlData.config)?void 0:e.controlId)}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:Qc.icon(t.icon)},{tag:"span",className:"control-label",content:n}],action:{focus:({target:t})=>{const e=t.closest(`.${Ei}`);return e&&pu.panels.nav.refresh(Bc(e))},click:({target:t})=>{var e;const n=null==(e=t.closest(".field-control"))?void 0:e.id;n&&pu.addElement(n)}}};return Qc.create({tag:"li",id:this.id,className:["field-control",`${t.group}-control`,`${t.id}-control`],content:o,meta:t,action:this.controlAction})}promise(){return lu(this.dependencies)}i18n(t,e){var n,o;const r=i.locale,s=null==(n=this.definition)?void 0:n.i18n,a=(null==s?void 0:s[r])||{};return((null==(o=a[t])?void 0:o.call(a))??a[t])||i.get(t,e)}}const uu=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"}});let hu=class{constructor(){e(this,"groupLabel",(t=>i.get(t)||t||"")),e(this,"layoutTypes",{row:()=>Qd.active.addChild(),column:()=>this.layoutTypes.row().addChild(),field:t=>this.layoutTypes.column().addChild(t)}),e(this,"addElement",(t=>{const{meta:{group:e,id:n},...o}=hs(this.get(t),"controlData");return ps(o,"config.controlId",n),"layout"===e?this.layoutTypes[n.replace("layout-","")]():this.layoutTypes.field(o)})),e(this,"applyOptions",(async(t={})=>{const{container:e,elements:n,groupOrder:o,...i}=ei(uu,t);this.container=e,this.groupOrder=Qo(o.concat(["common","html","layout"])),this.options=i;const[r,s,a]=await Promise.all([Promise.resolve().then((()=>Qu)),Promise.resolve().then((()=>oh)),Promise.resolve().then((()=>ah))]),l=[r.default,s.default,a.default].flat();return Promise.all(this.registerControls([...l,...n]))})),this.data=new Map,this.buttonActions={focus:({target:t})=>{const e=t.closest(`.${Ei}`);return e&&this.panels.nav.refresh(Bc(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((t=>{const e="function"==typeof t?new t:new du(t);return 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=zc(t,this.groupOrder,"id"),t=t.filter((t=>Jo(t.id,this.options.disable.groups))),n=t.map((t=>{const n={tag:"ul",attrs:{className:[Ei,Si],id:`${t.id}-${Ei}`},config:{label:this.groupLabel(t.label)}};if(this.options.elementOrder[t.id]){const e=this.options.elementOrder[t.id],n=Qo(e.concat(t.elementOrder));t.elementOrder=n}return e=zc(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=[Jo(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=ni(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 ni(this.data.get(t))}formActions(){if(!0===this.options.disable.formActions)return null;const t={...Qc.btnTemplate({content:[Qc.icon("bin"),i.get("clear")],title:i.get("clearAll")}),className:["clear-form"],action:{click:t=>{Jd.size?(ju.confirmClearAll=new window.CustomEvent("confirmClearAll",{detail:{confirmationMessage:i.get("confirmClearAll"),clearAllAction:()=>{Qd.clearAll().then((()=>{const e={src:t.target};ju.formeoCleared(e)}))},btnCoords:Qc.coords(t.target)}}),document.dispatchEvent(ju.confirmClearAll)):window.alert(i.get("cannotClearFields"))}}},e={...Qc.btnTemplate({content:[Qc.icon("floppy-disk"),i.get("save")],title:i.get("save")}),className:["save-form"],action:{click:async({target:t})=>{const{default:e}=await Promise.resolve().then((()=>Au)),{formData:n}=e,o={action:()=>{},coords:Qc.coords(t),message:"",button:t};return Lu.click.btn(o),Lu.save.form(n)}}};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 Rd({panels:e,type:"controls",displayType:o});const r=["control-groups","formeo-panels-wrap",`panel-count-${e.length}`],s=Qc.create({className:r,content:[this.panels.panelNav,this.panels.panelsWrap]}),a=["formeo-controls"];t&&a.push("formeo-sticky");const l=Qc.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(Qc.toggleElementsByStr(n,t),e){const e=i.get("controls.filteringTerm",t);l.classList.add("filtered"),o?o.textContent=e:(o=Qc.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 i=c.length-1;i>=0;i--){const t=`formeo-controls-${c[i]}`;this.options.sortable||window.localStorage.removeItem(t),bc.create(c[i],{animation:150,forceFallback:!0,fallbackClass:"control-moving",fallbackOnBody:!0,group:{name:"controls",pull:"clone",put:!1},onStart:async({item:t})=>{const{controlData:e}=this.get(t.id);if(this.options.ghostPreview){const{default:n}=await Promise.resolve().then((()=>bu));t.innerHTML="",t.appendChild(new n(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}};const pu=new hu,mu=Object.freeze(Object.defineProperty({__proto__:null,Controls:hu,default:pu},Symbol.toStringTag,{value:"Module"})),fu=new Set(["checkbox","radio"]),gu=new Set(["radio","checkbox","select-one","select-multiple"]);class vu extends zd{constructor(t=Object.create(null)){super("field",{...t}),e(this,"setData",((t,e)=>super.set(t,e))),e(this,"updatePreview",(()=>{this.updateLabel();const t=this.fieldPreview();this.preview.replaceWith(t),this.preview=t})),this.debouncedUpdateEditPanels=ai(this.updateEditPanels),this.debouncedUpdatePreview=ai(this.updatePreview),this.label=Qc.create(this.labelConfig),this.preview=this.fieldPreview(),this.controlId=this.get("config.controlId")||this.get("meta.id");const n=this.getActionButtons(),o=this.actionButtons.some((t=>{var e;return"edit"===(null==(e=t.meta)?void 0:e.id)}));this.updateEditPanels();const r=Qc.create({tag:"li",attrs:{className:Ni},id:this.id,children:[this.label,this.getComponentTag(),n,o&&this.editWindow,this.preview].filter(Boolean),panelNav:this.panelNav,dataset:{hoverTag:i.get("field")}});this.dom=r,this.isEditing=!1}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}})=>{super.set("config.label",n?e:t)}}},e&&Qc.requiredMark()]}}set(t,e){const n=this.setData(t,e);return this.debouncedUpdatePreview(),n}updateLabel(){if(!this.label)return null;const t=Qc.create(this.labelConfig);this.label.replaceWith(t),this.label=t}get defaultPreviewActions(){return{change:t=>{var e;const{target:n}=t,{type:o}=n;if(gu.has(o)){const t=this.preview.querySelectorAll(":checked"),n=this.get("options"),o=void 0!==(null==(e=null==n?void 0:n[0])?void 0:e.selected)?"selected":"checked",i=n.reduce(((t,e)=>(t[e.value]=e,t[e.value][o]=!1,t)),{});for(const e of t)i[e.value][o]=e.value===i[e.value].value;return super.set("options",Object.values(i)),this.debouncedUpdateEditPanels()}},click:t=>{"true"===t.target.contentEditable&&t.preventDefault()},input:({target:t})=>{var e;if(["input","meter","progress","button"].includes(t.tagName.toLowerCase()))return super.set("attrs.value",t.value),this.debouncedUpdateEditPanels();if(t.contentEditable&&!(null==(e=t.type)?void 0:e.startsWith("select-"))){const e=t.parentElement.classList;if(e.contains("f-checkbox")||e.contains("f-radio")){const e=t.parentElement,n=Bc(e);return this.setData(`options[${n}].label`,t.innerHTML),this.debouncedUpdateEditPanels()}this.setData("content",t.innerHTML||t.value)}}}}fieldPreview(){var t;const{action:e={},...n}=ni(this.data);n.id=`prev-${this.id}`,n.action=Object.entries(e).reduce(((t,[e,n])=>(t[e]=n.bind(this),t)),{}),(null==(t=this.data)?void 0:t.config.editableContent)&&(n.attrs={...n.attrs,contenteditable:!0});const o={attrs:{className:"field-preview",style:this.isEditing&&"display: none;"},content:Qc.create(n,!0),action:this.defaultPreviewActions};return Qc.create(o,!0)}get isCheckable(){return fu.has(this.get("config.controlId"))}}const bu=Object.freeze(Object.defineProperty({__proto__:null,default:vu},Symbol.toStringTag,{value:"Module"}));const yu=new class extends La{constructor(t){super("fields",t),e(this,"get",(t=>{let e=t&&hs(this.data,t);if(!e){const n=pu.get(t);n&&(e=this.add(null,n.controlData))}return e})),e(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)}t&&(i.conditions=o)}return t[e]=i,t}),{}))),e(this,"load",((t=Object.create(null))=>{const e=di(t);this.empty();for(const[n,o]of Object.entries(e)){const{meta:t,...e}=o;(null==t?void 0:t.id)&&ps(e,"config.controlId",null==t?void 0:t.id),this.add(n,e)}return this.data})),this.config={all:{actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]},panels:{disabled:[],attrs:{disabled:["type"],hideDisabled:!0,locked:[]},order:["attrs","options","conditions"]},label:{disableHTML:!1}}}}Component(t){return new vu(t)}},wu=Qd,Cu=Jd,xu=Yd,Su=yu,Eu=pu;class Ou extends $a{constructor(){super("components"),e(this,"load",((t,e)=>{this.empty();const n=((t,e=!1)=>t?ni(di(t)):e&&ri.get(Ki)||yr())(t,e.sessionStorage);this.opts=e,this.set("id",n.id),this.add("stages",wu.load(n.stages)),this.add("rows",Cu.load(n.rows)),this.add("columns",xu.load(n.columns)),this.add("fields",Su.load(n.fields));for(const o of Object.values(this.get("stages")))o.loadChildren();return this.data})),e(this,"getChildData",(({type:t,id:e})=>{const n=this.get(t,e);if(n)return n.getData()})),this.disableEvents=!0,this.stages=wu,this.rows=Cu,this.columns=xu,this.fields=Su,this.controls=Eu}flatList(){const t={};for(const e of Object.keys(this.data.stages))hi(this.data,e,"stages",t);return t}get json(){return window.JSON.stringify({$schema:`https://cdn.jsdelivr.net/npm/formeo@${mi}/dist/formData_schema.json`,...this.formData})}get formData(){return{id:this.get("id"),stages:Qd.getData(),rows:Jd.getData(),columns:Yd.getData(),fields:yu.getData()}}set config(t){const{stages:e,rows:n,columns:o,fields:i}=t;wu.config=e,Cu.config=n,xu.config=o,Su.config=i}getIndex(t){return this[t]||this[Wi.get(t)]}setAddress(t,e){if(!si(t))return;const[n,o,...i]=Array.isArray(t)?t:Ar(t),r=this.getIndex(n).get(o);return null==r||r.set(i,e),r}getAddress(t){if(!si(t))return;const[e,n,...o]=Array.isArray(t)?t:Ar(t),i=this.getIndex(e).get(n);return!o.length||i?o.length?i.get(o):i:void 0}}const _u=new Ou,Au=Object.freeze(Object.defineProperty({__proto__:null,Columns:xu,Components:Ou,Controls:Eu,Fields:Su,Rows:Cu,Stages:wu,default:_u},Symbol.toStringTag,{value:"Module"})),Nu="no-transition",Tu={debug:!1,bubbles:!0,formeoLoaded:t=>{},onAdd:()=>{},onChange:(...t)=>Tu.onUpdate(...t),onUpdate:t=>{var e;return(null==(e=ju.opts)?void 0:e.debug)&&void 0},onUpdateStage:t=>{var e;return(null==(e=ju.opts)?void 0:e.debug)&&void 0},onUpdateRow:t=>{var e;return(null==(e=ju.opts)?void 0:e.debug)&&void 0},onUpdateColumn:t=>{var e;return(null==(e=ju.opts)?void 0:e.debug)&&void 0},onUpdateField:t=>{var e;return(null==(e=ju.opts)?void 0:e.debug)&&void 0},onRender:t=>{var e;return(null==(e=ju.opts)?void 0:e.debug)&&void 0},onSave:t=>{},confirmClearAll:t=>{window.confirm(t.confirmationMessage)&&t.clearAllAction(t)}},Pu=({src:t,...e},n=ir)=>{var o,i;const r=new window.CustomEvent(n,{detail:e,bubbles:(null==(o=ju.opts)?void 0:o.debug)||(null==(i=ju.opts)?void 0:i.bubbles)});return r.data=(t||document).dispatchEvent(r),r},ju={init:function(t){return this.opts={...Tu,...t},this},formeoSaved:t=>Pu(t,or),formeoUpdated:t=>Pu(t,ir),formeoCleared:t=>Pu(t,"formeoCleared"),formeoOnRender:t=>Pu(t,rr),formeoConditionUpdated:t=>Pu(t,"formeoConditionUpdated")},ku=function(t,e=nr){let n=0;return function(...o){const i=Date.now();i-n>=e&&(n=i,t.apply(this,o))}}((()=>{ju.opts.onUpdate({timeStamp:window.performance.now(),type:ir,detail:_u.formData})}),er);let Du;document.addEventListener(ir,ku),document.addEventListener("formeoUpdatedStage",(t=>{const{timeStamp:e,type:n,detail:o}=t;ju.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedRow",(t=>{const{timeStamp:e,type:n,detail:o}=t;ju.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedColumn",(t=>{const{timeStamp:e,type:n,detail:o}=t;ju.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedField",(t=>{const{timeStamp:e,type:n,detail:o}=t;ju.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener(rr,(t=>{const{timeStamp:e,type:n,detail:o}=t;ju.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},ju.opts.confirmClearAll(t)})),document.addEventListener(or,(({timeStamp:t,type:e,detail:{formData:n}})=>{const o={timeStamp:t,type:e,formData:n};ju.opts.onSave(o)})),document.addEventListener("formeoLoaded",(t=>{ju.opts.formeoLoaded(t.detail.formeo)})),window.addEventListener("resize",(function(){Du=Du||window.requestAnimationFrame((()=>{Du=!1;for(const t of Object.values(xu.data))t.dom.classList.add(Nu),Eu.dom.classList.add(Nu),Eu.panels.nav.refresh(),t.refreshFieldPanels()}))}));const $u={add:{attr:t=>{const e=window.prompt(t.message.attr);if(e&&t.isDisabled(e))return window.alert(i.get("attributeNotPermitted",e||"")),Lu.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)}},remove:{attrs:t=>{t.removeAction()},options:t=>{t.removeAction()},conditions:t=>{t.removeAction()}},click:{btn:t=>{t.action()}},save:{form:li}},Lu={init:function(t){const e=Object.keys($u);return this.opts=e.reduce(((e,n)=>(e[n]={...$u[n],...t[n]},e)),t),this},add:{attrs:t=>Lu.opts.add.attr(t),options:t=>Lu.opts.add.option(t),conditions:t=>(t.template=t.template||fr(),Lu.opts.add.condition(t))},remove:{attrs:t=>Lu.opts.remove.attrs(t),options:t=>Lu.opts.remove.options(t),conditions:t=>Lu.opts.remove.conditions(t)},click:{btn:t=>Lu.opts.click.btn(t)},save:{form:t=>(Lu.opts.sessionStorage&&ri.set(Ki,t),ju.formeoSaved({formData:t}),Lu.opts.save.form(t))}};i.addLanguage("en-US",void 0);const Iu={get editor(){return{stickyControls:!1,allowEdit:!0,dataType:"json",debug:!1,sessionStorage:!1,editorContainer:null,svgSprite:wi,style:xi,iconFont:null,config:{},events:{},actions:{},controls:{},polyfills:Yc(),i18n:{location:"https://draggable.github.io/formeo/assets/lang/"},onLoad:()=>{}}}};let Mu=class{constructor({formData:t,...e},n){const o=ei(Iu.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,Qc.setOptions=c,_u.config=a,this.userFormData=n||t,this.Components=_u,this.dom=Qc,ju.init({debug:s,...r}),Lu.init({debug:s,sessionStorage:c.sessionStorage,...i}),this.tooltip=new d,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",this.loadResources.bind(this)):this.loadResources()}get formData(){return this.Components.formData}set formData(t={}){this.userFormData=ui(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)?vi.filter((({name:e})=>-1!==t.indexOf(e))):vi;Promise.all(e.map((({src:t})=>iu(t))))})(this.opts.polyfills),await su(this.opts.svgSprite),e.push((async t=>{if(!cu()&&(await ru(t),!cu()))return await ru("https://draggable.github.io/formeo/assets/css/formeo.min.css")})(this.opts.style)),e.push(i.init({...this.opts.i18n,locale:null==(t=window.sessionStorage)?void 0:t.getItem(Qi)}));const n=await Promise.all(e);return this.opts.allowEdit&&this.init(),n}init(){return pu.init(this.opts.controls,this.opts.stickyControls).then((t=>{var e,n;this.controls=t,this.load(this.userFormData,this.opts),this.formId=_u.get("id"),this.i18n={setLang:t=>{var e;null==(e=window.sessionStorage)||e.setItem(Qi,t);i.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(_u.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))]};i.current.dir&&(t.attrs.dir=i.current.dir,Qc.dir=i.current.dir),this.editor=Qc.create(t);(this.controls.container||this.editor).appendChild(this.controls.dom),this.editorContainer&&(Qc.empty(this.editorContainer),this.editorContainer.appendChild(this.editor)),ju.formeoLoaded=new window.CustomEvent("formeoLoaded",{detail:{formeo:this}}),document.dispatchEvent(ju.formeoLoaded)}};const Wu="f-",Ru=t=>"string"==typeof t?document.querySelector(t):t,Fu=t=>{const e=t.match(gr);return(null==e?void 0:e[0])||t``},Bu=t=>{if(!t)return!1;if(t.hasAttribute("hidden")||t.parentElement.hasAttribute("hidden"))return!1;const e=window.getComputedStyle(t);return!("none"===e.display||"hidden"===e.visibility||"0"===e.opacity)},zu={isChecked:t=>t.checked,isNotChecked:t=>!t.checked,value:t=>t.value,isVisible:t=>Bu(t),isNotVisible:t=>!Bu(t)},Uu={equals:ka,notEquals:(t,e)=>!ka(t,e),contains:(t,e)=>t.includes(e),notContains:(t,e)=>!t.includes(e)},qu=Object.entries(sr).reduce(((t,[e,n])=>(t[n]=Uu[e],t[e]=Uu[e],t)),{}),Vu={equals:(t,{targetProperty:e,value:n})=>{t[`_${e}`]=t[e],t[e]=n}},Hu=Object.entries(ar).reduce(((t,[e,n])=>(t[n]=Vu[e],t[e]=Vu[e],t)),{}),Xu={isChecked:t=>{t.checked=!0},isNotChecked:t=>{t.checked=!1},value:(t,{assignment:e,...n})=>{var o;const i=null==(o=Hu[e])?void 0:o.call(Hu,t,n),r=new Event("input",{bubbles:!0});return t.dispatchEvent(r),i},isNotVisible:t=>{void 0===(null==t?void 0:t._required)&&(t._required=t.required),t.parentElement.setAttribute("hidden",!0),t.required=!1},isVisible:t=>{t.parentElement.removeAttribute("hidden"),t.required=t._required}};let Yu=class{constructor(t,n){e(this,"orderChildren",((t,e)=>e.reduce(((e,n)=>(e.push(this.form[t][n]),e)),[]))),e(this,"prefixId",(t=>Wu+t)),e(this,"processColumn",(({id:t,...e})=>({...e,id:this.prefixId(t),children:this.processFields(e.children),style:`width: ${e.config.width||"100%"}`}))),e(this,"processRows",(t=>this.orderChildren("rows",this.form.stages[t].children).reduce(((t,e)=>(e&&t.push(this.processRow(e)),t)),[]))),e(this,"cacheComponent",(t=>(this.components[Fu(t.id)]=t,t))),e(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(`${Wu}input-group-wrap`),{tag:n.fieldset?"fieldset":"div",className:i,children:s}})),e(this,"cloneComponentData",(t=>{const{children:e=[],id:n,...o}=this.components[t];return{...o,id:ti(n),children:(null==e?void 0:e.length)&&e.map((({id:t})=>this.cloneComponentData(Fu(t))))}})),e(this,"addButton",(t=>({tag:"button",attrs:{className:"add-input-group btn pull-right",type:"button"},children:"Add +",action:{click:e=>{const n=e.target.parentElement,o=Qc.create(this.cloneComponentData(t));n.insertBefore(o,n.lastChild);const i=Qc.create(Qc.btnTemplate({className:"remove-input-group",children:Qc.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()}}));o.appendChild(i)}}}))),e(this,"processColumns",(t=>this.orderChildren("columns",this.form.rows[t].children).map((t=>this.cacheComponent(this.processColumn(t)))))),e(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&&lu(s);const a=ei({action:r},e);return this.cacheComponent({...a,id:this.prefixId(t)})})))),e(this,"handleComponentCondition",((t,e,n)=>{if(t.length){for(const o of t)this.handleComponentCondition(o,e,n);return}const o=Gu(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)})),e(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,target:o}=e;if(si(t)){const{component:o,options:i}=this.getComponent(t),r=i||o;this.handleComponentCondition(r,e,n)}if(si(o)){const{component:t,options:i}=this.getComponent(o),r=i||t;this.handleComponentCondition(r,e,n)}}}})),e(this,"evaluateCondition",(({source:t,sourceProperty:e,targetProperty:n,comparison:o,target:i})=>{var r;const s=this.getComponentProperty(t,e);if("boolean"==typeof s)return s;const a=String(si(i)?this.getComponentProperty(i,n):i);return null==(r=qu[o])?void 0:r.call(qu,s,a)})),e(this,"execResult",(({target:t,targetProperty:e,assignment:n,value:o})=>{var i;if(si(t)){const{component:r,option:s}=this.getComponent(t),a=s||r;null==(i=Xu[e])||i.call(Xu,a,{targetProperty:e,assignment:n,value:o})}})),e(this,"getComponentProperty",((t,e)=>{var n;const{component:o,option:i}=this.getComponent(t),r=i||o;return(null==(n=zu[e])?void 0:n.call(zu,r))||r[e]})),e(this,"getComponent",(t=>{const e={component:null};if(!si(t))return null;const[,n,o,i]=Ar(t),r=this.renderedForm.querySelector(`#${Wu}${n}`);if(!r)return e;if(e.component=r,o){const t=r.querySelectorAll("input"),n=t[i];return e.options=t,e.option=n,e}return e})),e(this,"getComponents",(t=>{const e=[],n=t.slice(t.indexOf(".")+1);return e.push(...this.renderedForm.querySelectorAll(`[name=f-${n}]`)),e}));const{renderContainer:o,elements:i,formData:r}=(({editorContainer:t,renderContainer:e,formData:n,...o})=>({elements:{},...o,renderContainer:Ru(e),editorContainer:Ru(t),formData:ui(n)}))(t);this.container=o,this.form=ui(n||r),this.dom=Qc,this.components=Object.create(null),this.elements=i}get formData(){return this.form}set formData(t){this.form=ui(t)}get userData(){const t=new FormData(this.renderedForm),e={};for(const[n,o]of t.entries())e[n]?Array.isArray(e[n])?e[n].push(o):e[n]=[e[n],o]:e[n]=o;return e}set userData(t={}){const e=this.container.querySelector("form");for(const n of Object.keys(t)){const o=e.elements[n];if(o.length&&"checkbox"===o[0].type){const e=Array.isArray(t[n])?t[n]:[t[n]];for(const t of o)t.checked=e.includes(t.value)}else if(o.length&&"radio"===o[0].type)for(const e of o)e.checked=e.value===t[n];else o.type&&(o.value=t[n])}}render(t=this.form){const e=this.getRenderedForm(t),n=this.container.querySelector(".formeo-render");n?n.replaceWith(e):this.container.appendChild(e)}getRenderedForm(t=this.form){this.form=ui(t);const e=document.getElementsByClassName("formeo-render").length,n={tag:"form",id:this.form.id,className:`formeo-render formeo formeo-rendered-${e}`,children:this.processedData};return this.renderedForm=Qc.render(n),this.applyConditions(),this.renderedForm}get html(){return(this.renderedForm||this.getRenderedForm()).outerHTML}get processedData(){return Object.values(this.form.stages).map((t=>(t.children=this.processRows(t.id),t.className=Oi,this.components[Fu(t.id)]=t,t)))}};const Gu=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=Mu,window.FormeoRenderer=Yu);const Zu=Mu,Ju=Yu,Ku=[{config:{label:"row"},meta:{group:"layout",icon:"rows",id:"layout-row"}},{config:{label:"column"},meta:{group:"layout",icon:"columns",id:"layout-column"}}],Qu=Object.freeze(Object.defineProperty({__proto__:null,default:Ku},Symbol.toStringTag,{value:"Module"})),th=["button","submit","reset"].map((t=>({label:t,value:t})));th[0].selected=!0;const eh=({type:t,isMultiple:e=!1,count:n=3})=>Array.from({length:n},((t,e)=>e+1)).map((n=>{const o="checkbox"===t||e?"checked":"selected";return{label:i.get("labelCount",{label:Or(t),count:n}),value:`${t}-${n}`,[o]:!n}}));const nh=[class extends du{constructor(t={}){const e={tag:"button",attrs:{className:[{label:"grouped",value:"f-btn-group"},{label:"ungrouped",value:"f-field-group"}]},config:{label:i.get("controls.form.button"),hideLabel:!0},meta:{group:"common",icon:"button",id:"button"},options:[{label:i.get("button"),type:th,className:[{label:"default",value:"",selected:!0},{label:"primary",value:"primary"},{label:"danger",value:"error"},{label:"success",value:"success"},{label:"warning",value:"warning"}]}]};super(ei(e,t))}},class extends du{constructor(){super({tag:"input",attrs:{type:"date",required:!1,className:""},config:{label:i.get("controls.form.input.date")},meta:{group:"common",icon:"calendar",id:"date-input"}})}},class extends du{constructor(){super({tag:"input",attrs:{type:"hidden",value:""},config:{label:i.get("hidden"),hideLabel:!0},meta:{group:"common",icon:"hidden",id:"hidden"}})}},class extends du{constructor(){super({tag:"input",attrs:{type:"number",required:!1,className:""},config:{label:i.get("number")},meta:{group:"common",icon:"hash",id:"number"}})}},class extends du{constructor(){super({tag:"textarea",config:{label:i.get("controls.form.textarea")},meta:{group:"common",icon:"textarea",id:"textarea"},attrs:{required:!1}})}},class extends du{constructor(){super({tag:"input",attrs:{required:!1,type:"text",className:""},config:{label:i.get("controls.form.input.text")},meta:{group:"common",icon:"text-input",id:"text-input"}})}},class extends du{constructor(){super({tag:"input",attrs:{type:"file",required:!1},config:{label:i.get("fileUpload")},meta:{group:"common",icon:"upload",id:"upload"}})}},class extends du{constructor(t={}){var e;const n={tag:"select",config:{label:i.get("controls.form.select")},attrs:{required:!1,className:"",multiple:!1},meta:{group:"common",icon:"select",id:"select"},options:eh({type:"option",isMultiple:null==(e=t.attrs)?void 0:e.multiple})};super(ei(n,t))}},class extends du{constructor(){super({tag:"input",attrs:{type:"checkbox",required:!1},config:{label:i.get("controls.form.checkbox-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"checkbox",id:"checkbox"},options:eh({type:"checkbox",count:1})})}},class extends du{constructor(){super({tag:"input",attrs:{type:"radio",required:!1},config:{label:i.get("controls.form.radio-group"),disabled:["attrs.type"]},meta:{group:"common",icon:"radio-group",id:"radio"},options:eh({type:"radio"})})}}],oh=Object.freeze(Object.defineProperty({__proto__:null,default:nh},Symbol.toStringTag,{value:"Module"})),ih=Array.from(Array(5).keys()).slice(1).map((t=>`h${t}`)),rh="controls.html.header";const sh=[class extends du{constructor(){super({tag:ih[0],attrs:{tag:ih.map(((t,e)=>({label:t.toUpperCase(),value:t,selected:!e}))),className:""},config:{label:i.get(rh),hideLabel:!0,editableContent:!0},meta:{group:"html",icon:"header",id:"html.header"},content:i.get(rh),action:{}})}static get definition(){return{i18n:{"en-US":{header:"Custom English Header"}}}}get content(){return super.i18n(rh)}},class extends du{constructor(){super({tag:"p",attrs:{className:""},config:{label:i.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 du{constructor(){super({tag:"hr",config:{label:i.get("controls.html.divider"),hideLabel:!0},meta:{group:"html",icon:"divider",id:"divider"}})}},class extends du{constructor(t){super(ei({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))}}],ah=Object.freeze(Object.defineProperty({__proto__:null,default:sh},Symbol.toStringTag,{value:"Module"}));exports.FormeoEditor=Zu,exports.FormeoRenderer=Ju;
|
|
14
|
+
*/function Ma(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 Ra(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Ma(Object(n),!0).forEach((function(e){Fa(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ma(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Wa(t){return(Wa="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 Fa(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ba(){return Ba=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},Ba.apply(this,arguments)}function za(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 Ua(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var qa=Ua(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Va=Ua(/Edge/i),Ha=Ua(/firefox/i),Xa=Ua(/safari/i)&&!Ua(/chrome/i)&&!Ua(/android/i),Ya=Ua(/iP(ad|od|hone)/i),Ga=Ua(/chrome/i)&&Ua(/android/i),Za={capture:!1,passive:!1};function Ja(t,e,n){t.addEventListener(e,n,!qa&&Za)}function Ka(t,e,n){t.removeEventListener(e,n,!qa&&Za)}function Qa(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 tl(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function el(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&Qa(t,e):Qa(t,e))||o&&t===n)return t;if(t===n)break}while(t=tl(t))}return null}var nl,ol=/\s+/g;function il(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(ol," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(ol," ")}}function rl(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 sl(t,e){var n="";if("string"==typeof t)n=t;else do{var o=rl(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 al(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 ll(){var t=document.scrollingElement;return t||document.documentElement}function cl(t,e,n,o,i){if(t.getBoundingClientRect||t===window){var r,s,a,l,c,d,u;if(t!==window&&t.parentNode&&t!==ll()?(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,!qa))do{if(i&&i.getBoundingClientRect&&("none"!==rl(i,"transform")||n&&"static"!==rl(i,"position"))){var h=i.getBoundingClientRect();s-=h.top+parseInt(rl(i,"border-top-width")),a-=h.left+parseInt(rl(i,"border-left-width")),l=s+r.height,c=a+r.width;break}}while(i=i.parentNode);if(o&&t!==window){var p=sl(i||t),m=p&&p.a,f=p&&p.d;p&&(l=(s/=f)+(d/=f),c=(a/=m)+(u/=m))}return{top:s,left:a,bottom:l,right:c,width:u,height:d}}}function dl(t,e,n){for(var o=fl(t,!0),i=cl(t)[e];o;){if(!(i>=cl(o)[n]))return o;if(o===ll())break;o=fl(o,!1)}return!1}function ul(t,e,n,o){for(var i=0,r=0,s=t.children;r<s.length;){if("none"!==s[r].style.display&&s[r]!==yc.ghost&&(o||s[r]!==yc.dragged)&&el(s[r],n.draggable,t,!1)){if(i===e)return s[r];i++}r++}return null}function hl(t,e){for(var n=t.lastElementChild;n&&(n===yc.ghost||"none"===rl(n,"display")||e&&!Qa(n,e));)n=n.previousElementSibling;return n||null}function pl(t,e){var n=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||t===yc.clone||e&&!Qa(t,e)||n++;return n}function ml(t){var e=0,n=0,o=ll();if(t)do{var i=sl(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 fl(t,e){if(!t||!t.getBoundingClientRect)return ll();var n=t,o=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=rl(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 ll();if(o||e)return n;o=!0}}}while(n=n.parentNode);return ll()}function gl(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 vl(t,e){return function(){if(!nl){var n=arguments;1===n.length?t.call(this,n[0]):t.apply(this,n),nl=setTimeout((function(){nl=void 0}),e)}}}function bl(t,e,n){t.scrollLeft+=e,t.scrollTop+=n}function yl(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 wl(t,e,n){var o={};return Array.from(t.children).forEach((function(i){var r,s,a,l;if(el(i,e.draggable,t,!1)&&!i.animated&&i!==n){var c=cl(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 El(){var t,e=[];return{captureAnimationState:function(){(e=[],this.options.animation)&&[].slice.call(this.el.children).forEach((function(t){if("none"!==rl(t,"display")&&t!==yc.ghost){e.push({target:t,rect:cl(t)});var n=Ra({},e[e.length-1].rect);if(t.thisAnimationDuration){var o=sl(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=cl(n),l=n.prevFromRect,c=n.prevToRect,d=t.rect,u=sl(n,!0);u&&(a.top-=u.f,a.left-=u.e),n.toRect=a,n.thisAnimationDuration&&gl(l,a)&&!gl(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)),gl(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){rl(t,"transition",""),rl(t,"transform","");var i=sl(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,rl(t,"transform","translate3d("+a+"px,"+l+"px,0)"),this.forRepaintDummy=function(t){return t.offsetWidth}(t),rl(t,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),rl(t,"transform","translate3d(0,0,0)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout((function(){rl(t,"transition",""),rl(t,"transform",""),t.animated=!1,t.animatingX=!1,t.animatingY=!1}),o)}}}}var xl=[],Sl={initializeByDefault:!0},Ol={mount:function(t){for(var e in Sl)Sl.hasOwnProperty(e)&&!(e in t)&&(t[e]=Sl[e]);xl.forEach((function(e){if(e.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")})),xl.push(t)},pluginEvent:function(t,e,n){var o=this;this.eventCanceled=!1,n.cancel=function(){o.eventCanceled=!0};var i=t+"Global";xl.forEach((function(o){e[o.pluginName]&&(e[o.pluginName][i]&&e[o.pluginName][i](Ra({sortable:e},n)),e.options[o.pluginName]&&e[o.pluginName][t]&&e[o.pluginName][t](Ra({sortable:e},n)))}))},initializePlugins:function(t,e,n,o){for(var i in xl.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,Ba(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 xl.forEach((function(o){"function"==typeof o.eventProperties&&Ba(n,o.eventProperties.call(e[o.pluginName],t))})),n},modifyOption:function(t,e,n){var o;return xl.forEach((function(i){t[i.pluginName]&&i.optionListeners&&"function"==typeof i.optionListeners[e]&&(o=i.optionListeners[e].call(t[i.pluginName],n))})),o}};var _l=["evt"],Al=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=n.evt,i=za(n,_l);Ol.pluginEvent.bind(yc)(t,e,Ra({dragEl:Tl,parentEl:Pl,ghostEl:jl,rootEl:kl,nextEl:Dl,lastDownEl:Ll,cloneEl:$l,cloneHidden:Il,dragStarted:Gl,putSortable:zl,activeSortable:yc.active,originalEvent:o,oldIndex:Ml,oldDraggableIndex:Wl,newIndex:Rl,newDraggableIndex:Fl,hideGhostForTarget:fc,unhideGhostForTarget:gc,cloneNowHidden:function(){Il=!0},cloneNowShown:function(){Il=!1},dispatchSortableEvent:function(t){Nl({sortable:e,name:t,originalEvent:o})}},i))};function Nl(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,m=t.extraEventProperties;if(e=e||n&&n[Cl]){var f,g=e.options,v="on"+o.charAt(0).toUpperCase()+o.substr(1);!window.CustomEvent||qa||Va?(f=document.createEvent("Event")).initEvent(o,!0,!0):f=new CustomEvent(o,{bubbles:!0,cancelable:!0}),f.to=s||n,f.from=a||n,f.item=i||n,f.clone=r,f.oldIndex=l,f.newIndex=c,f.oldDraggableIndex=d,f.newDraggableIndex=u,f.originalEvent=h,f.pullMode=p?p.lastPutMode:void 0;var b=Ra(Ra({},m),Ol.getEventProperties(o,e));for(var y in b)f[y]=b[y];n&&n.dispatchEvent(f),g[v]&&g[v].call(e,f)}}(Ra({putSortable:zl,cloneEl:$l,targetEl:Tl,rootEl:kl,oldIndex:Ml,oldDraggableIndex:Wl,newIndex:Rl,newDraggableIndex:Fl},t))}var Tl,Pl,jl,kl,Dl,Ll,$l,Il,Ml,Rl,Wl,Fl,Bl,zl,Ul,ql,Vl,Hl,Xl,Yl,Gl,Zl,Jl,Kl,Ql,tc=!1,ec=!1,nc=[],oc=!1,ic=!1,rc=[],sc=!1,ac=[],lc="undefined"!=typeof document,cc=Ya,dc=Va||qa?"cssFloat":"float",uc=lc&&!Ga&&!Ya&&"draggable"in document.createElement("div"),hc=function(){if(lc){if(qa)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),pc=function(t,e){var n=rl(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=ul(t,0,e),r=ul(t,1,e),s=i&&rl(i),a=r&&rl(r),l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+cl(i).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+cl(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[dc]||r&&"none"===n[dc]&&l+c>o)?"vertical":"horizontal"},mc=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"==Wa(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},fc=function(){!hc&&jl&&rl(jl,"display","none")},gc=function(){!hc&&jl&&rl(jl,"display","")};lc&&!Ga&&document.addEventListener("click",(function(t){if(ec)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),ec=!1,!1}),!0);var vc=function(t){if(Tl){t=t.touches?t.touches[0]:t;var e=(i=t.clientX,r=t.clientY,nc.some((function(t){var e=t[Cl].options.emptyInsertThreshold;if(e&&!hl(t)){var n=cl(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},bc=function(t){Tl&&Tl.parentNode[Cl]._isOutsideThisEl(t.target)};function yc(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=Ba({},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 pc(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!==yc.supportPointer&&"PointerEvent"in window&&!Xa,emptyInsertThreshold:5};for(var o in Ol.initializePlugins(this,t,n),n)!(o in e)&&(e[o]=n[o]);for(var i in mc(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&uc,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?Ja(t,"pointerdown",this._onTapStart):(Ja(t,"mousedown",this._onTapStart),Ja(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(Ja(t,"dragover",this),Ja(t,"dragenter",this)),nc.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),Ba(this,El())}function wc(t,e,n,o,i,r,s,a){var l,c,d=t[Cl],u=d.options.onMove;return!window.CustomEvent||qa||Va?(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||cl(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 Ec(){sc=!1}function xc(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 Sc(t){return setTimeout(t,0)}function Oc(t){return clearTimeout(t)}yc.prototype={constructor:yc,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(Zl=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,Tl):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){ac.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&ac.push(o)}}(n),!Tl&&!(/mousedown|pointerdown/.test(r)&&0!==t.button||o.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!Xa||!a||"SELECT"!==a.tagName.toUpperCase())&&!((a=el(a,o.draggable,n,!1))&&a.animated||Ll===a)){if(Ml=pl(a),Wl=pl(a,o.draggable),"function"==typeof c){if(c.call(this,t,a,this))return Nl({sortable:e,rootEl:l,name:"filter",targetEl:a,toEl:n,fromEl:n}),Al("filter",e,{evt:t}),void(i&&t.cancelable&&t.preventDefault())}else if(c&&(c=c.split(",").some((function(o){if(o=el(l,o.trim(),n,!1))return Nl({sortable:e,rootEl:o,name:"filter",targetEl:a,fromEl:n,toEl:n}),Al("filter",e,{evt:t}),!0}))))return void(i&&t.cancelable&&t.preventDefault());o.handle&&!el(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&&!Tl&&n.parentNode===r){var l=cl(n);if(kl=r,Pl=(Tl=n).parentNode,Dl=Tl.nextSibling,Ll=n,Bl=s.group,yc.dragged=Tl,Ul={target:Tl,clientX:(e||t).clientX,clientY:(e||t).clientY},Xl=Ul.clientX-l.left,Yl=Ul.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,Tl.style["will-change"]="all",o=function(){Al("delayEnded",i,{evt:t}),yc.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!Ha&&i.nativeDraggable&&(Tl.draggable=!0),i._triggerDragStart(t,e),Nl({sortable:i,name:"choose",originalEvent:t}),il(Tl,s.chosenClass,!0))},s.ignore.split(",").forEach((function(t){al(Tl,t.trim(),Cc)})),Ja(a,"dragover",vc),Ja(a,"mousemove",vc),Ja(a,"touchmove",vc),Ja(a,"mouseup",i._onDrop),Ja(a,"touchend",i._onDrop),Ja(a,"touchcancel",i._onDrop),Ha&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Tl.draggable=!0),Al("delayStart",this,{evt:t}),!s.delay||s.delayOnTouchOnly&&!e||this.nativeDraggable&&(Va||qa))o();else{if(yc.eventCanceled)return void this._onDrop();Ja(a,"mouseup",i._disableDelayedDrag),Ja(a,"touchend",i._disableDelayedDrag),Ja(a,"touchcancel",i._disableDelayedDrag),Ja(a,"mousemove",i._delayedDragTouchMoveHandler),Ja(a,"touchmove",i._delayedDragTouchMoveHandler),s.supportPointer&&Ja(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(){Tl&&Cc(Tl),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;Ka(t,"mouseup",this._disableDelayedDrag),Ka(t,"touchend",this._disableDelayedDrag),Ka(t,"touchcancel",this._disableDelayedDrag),Ka(t,"mousemove",this._delayedDragTouchMoveHandler),Ka(t,"touchmove",this._delayedDragTouchMoveHandler),Ka(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?Ja(document,"pointermove",this._onTouchMove):Ja(document,e?"touchmove":"mousemove",this._onTouchMove):(Ja(Tl,"dragend",this),Ja(kl,"dragstart",this._onDragStart));try{document.selection?Sc((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(n){}},_dragStarted:function(t,e){if(tc=!1,kl&&Tl){Al("dragStarted",this,{evt:e}),this.nativeDraggable&&Ja(document,"dragover",bc);var n=this.options;!t&&il(Tl,n.dragClass,!1),il(Tl,n.ghostClass,!0),yc.active=this,t&&this._appendGhost(),Nl({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(ql){this._lastX=ql.clientX,this._lastY=ql.clientY,fc();for(var t=document.elementFromPoint(ql.clientX,ql.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(ql.clientX,ql.clientY))!==e;)e=t;if(Tl.parentNode[Cl]._isOutsideThisEl(t),e)do{if(e[Cl]){if(e[Cl]._onDragOver({clientX:ql.clientX,clientY:ql.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=tl(e));gc()}},_onTouchMove:function(t){if(Ul){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=jl&&sl(jl,!0),s=jl&&r&&r.a,a=jl&&r&&r.d,l=cc&&Ql&&ml(Ql),c=(i.clientX-Ul.clientX+o.x)/(s||1)+(l?l[0]-rc[0]:0)/(s||1),d=(i.clientY-Ul.clientY+o.y)/(a||1)+(l?l[1]-rc[1]:0)/(a||1);if(!yc.active&&!tc){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<n)return;this._onDragStart(t,!0)}if(jl){r?(r.e+=c-(Vl||0),r.f+=d-(Hl||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,")");rl(jl,"webkitTransform",u),rl(jl,"mozTransform",u),rl(jl,"msTransform",u),rl(jl,"transform",u),Vl=c,Hl=d,ql=i}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!jl){var t=this.options.fallbackOnBody?document.body:kl,e=cl(Tl,!0,cc,!0,t),n=this.options;if(cc){for(Ql=t;"static"===rl(Ql,"position")&&"none"===rl(Ql,"transform")&&Ql!==document;)Ql=Ql.parentNode;Ql!==document.body&&Ql!==document.documentElement?(Ql===document&&(Ql=ll()),e.top+=Ql.scrollTop,e.left+=Ql.scrollLeft):Ql=ll(),rc=ml(Ql)}il(jl=Tl.cloneNode(!0),n.ghostClass,!1),il(jl,n.fallbackClass,!0),il(jl,n.dragClass,!0),rl(jl,"transition",""),rl(jl,"transform",""),rl(jl,"box-sizing","border-box"),rl(jl,"margin",0),rl(jl,"top",e.top),rl(jl,"left",e.left),rl(jl,"width",e.width),rl(jl,"height",e.height),rl(jl,"opacity","0.8"),rl(jl,"position",cc?"absolute":"fixed"),rl(jl,"zIndex","100000"),rl(jl,"pointerEvents","none"),yc.ghost=jl,t.appendChild(jl),rl(jl,"transform-origin",Xl/parseInt(jl.style.width)*100+"% "+Yl/parseInt(jl.style.height)*100+"%")}},_onDragStart:function(t,e){var n=this,o=t.dataTransfer,i=n.options;Al("dragStart",this,{evt:t}),yc.eventCanceled?this._onDrop():(Al("setupClone",this),yc.eventCanceled||(($l=yl(Tl)).removeAttribute("id"),$l.draggable=!1,$l.style["will-change"]="",this._hideClone(),il($l,this.options.chosenClass,!1),yc.clone=$l),n.cloneId=Sc((function(){Al("clone",n),yc.eventCanceled||(n.options.removeCloneOnHide||kl.insertBefore($l,Tl),n._hideClone(),Nl({sortable:n,name:"clone"}))})),!e&&il(Tl,i.dragClass,!0),e?(ec=!0,n._loopId=setInterval(n._emulateDragOver,50)):(Ka(document,"mouseup",n._onDrop),Ka(document,"touchend",n._onDrop),Ka(document,"touchcancel",n._onDrop),o&&(o.effectAllowed="move",i.setData&&i.setData.call(n,o,Tl)),Ja(document,"drop",n),rl(Tl,"transform","translateZ(0)")),tc=!0,n._dragStartId=Sc(n._dragStarted.bind(n,e,t)),Ja(document,"selectstart",n),Gl=!0,Xa&&rl(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=yc.active,d=Bl===l,u=a.sort,h=zl||c,p=this,m=!1;if(!sc){if(void 0!==t.preventDefault&&t.cancelable&&t.preventDefault(),s=el(s,a.draggable,r,!0),T("dragOver"),yc.eventCanceled)return m;if(Tl.contains(t.target)||s.animated&&s.animatingX&&s.animatingY||p._ignoreWhileAnimating===s)return j(!1);if(ec=!1,c&&!a.disabled&&(d?u||(o=Pl!==kl):zl===this||(this.lastPutMode=Bl.checkPull(this,c,Tl,t))&&l.checkPut(this,c,Tl,t))){if(i="vertical"===this._getDirection(t,s),e=cl(Tl),T("dragOverValid"),yc.eventCanceled)return m;if(o)return Pl=kl,P(),this._hideClone(),T("revert"),yc.eventCanceled||(Dl?kl.insertBefore(Tl,Dl):kl.appendChild(Tl)),j(!0);var f=hl(r,a.draggable);if(!f||function(t,e,n){var o=cl(hl(n.el,n.options.draggable)),i=wl(n.el,n.options,jl),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)&&!f.animated){if(f===Tl)return j(!1);if(f&&r===t.target&&(s=f),s&&(n=cl(s)),!1!==wc(kl,r,Tl,e,s,n,t,!!s))return P(),f&&f.nextSibling?r.insertBefore(Tl,f.nextSibling):r.appendChild(Tl),Pl=r,k(),j(!0)}else if(f&&function(t,e,n){var o=cl(ul(n.el,0,n.options,!0)),i=wl(n.el,n.options,jl),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=ul(r,0,a,!0);if(g===Tl)return j(!1);if(n=cl(s=g),!1!==wc(kl,r,Tl,e,s,n,t,!1))return P(),r.insertBefore(Tl,g),Pl=r,k(),j(!0)}else if(s.parentNode===r){n=cl(s);var v,b,y,w=Tl.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}(Tl.animated&&Tl.toRect||e,s.animated&&s.toRect||n,i),E=i?"top":"left",x=dl(s,"top","top")||dl(Tl,"top","top"),S=x?x.scrollTop:void 0;if(Zl!==s&&(b=n[E],oc=!1,ic=!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&&Kl<c*i){if(!oc&&(1===Jl?l>d+c*r/2:l<u-c*r/2)&&(oc=!0),oc)h=!0;else if(1===Jl?l<d+Kl:l>u-Kl)return-Jl}else if(l>d+c*(1-i)/2&&l<u-c*(1-i)/2)return function(t){return pl(Tl)<pl(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,ic,Zl===s),0!==v){var O=pl(Tl);do{O-=v,y=Pl.children[O]}while(y&&("none"===rl(y,"display")||y===jl))}if(0===v||y===s)return j(!1);Zl=s,Jl=v;var _=s.nextElementSibling,A=!1,N=wc(kl,r,Tl,e,s,n,t,A=1===v);if(!1!==N)return 1!==N&&-1!==N||(A=1===N),sc=!0,setTimeout(Ec,30),P(),A&&!_?r.appendChild(Tl):s.parentNode.insertBefore(Tl,A?_:s),x&&bl(x,0,S-x.scrollTop),Pl=Tl.parentNode,void 0===b||ic||(Kl=Math.abs(b-cl(s)[E])),k(),j(!0)}if(r.contains(Tl))return j(!1)}return!1}function T(a,l){Al(a,p,Ra({evt:t,isOwner:d,axis:i?"vertical":"horizontal",revert:o,dragRect:e,targetRect:n,canSort:u,fromSortable:h,target:s,completed:j,onMove:function(n,o){return wc(kl,r,Tl,e,n,cl(n),t,o)},changed:k},l))}function P(){T("dragOverAnimationCapture"),p.captureAnimationState(),p!==h&&h.captureAnimationState()}function j(e){return T("dragOverCompleted",{insertion:e}),e&&(d?c._hideClone():c._showClone(p),p!==h&&(il(Tl,zl?zl.options.ghostClass:c.options.ghostClass,!1),il(Tl,a.ghostClass,!0)),zl!==p&&p!==yc.active?zl=p:p===yc.active&&zl&&(zl=null),h===p&&(p._ignoreWhileAnimating=s),p.animateAll((function(){T("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(s===Tl&&!Tl.animated||s===r&&!s.animated)&&(Zl=null),a.dragoverBubble||t.rootEl||s===document||(Tl.parentNode[Cl]._isOutsideThisEl(t.target),!e&&vc(t)),!a.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),m=!0}function k(){Rl=pl(Tl),Fl=pl(Tl,a.draggable),Nl({sortable:p,name:"change",toEl:r,newIndex:Rl,newDraggableIndex:Fl,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){Ka(document,"mousemove",this._onTouchMove),Ka(document,"touchmove",this._onTouchMove),Ka(document,"pointermove",this._onTouchMove),Ka(document,"dragover",vc),Ka(document,"mousemove",vc),Ka(document,"touchmove",vc)},_offUpEvents:function(){var t=this.el.ownerDocument;Ka(t,"mouseup",this._onDrop),Ka(t,"touchend",this._onDrop),Ka(t,"pointerup",this._onDrop),Ka(t,"touchcancel",this._onDrop),Ka(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;Rl=pl(Tl),Fl=pl(Tl,n.draggable),Al("drop",this,{evt:t}),Pl=Tl&&Tl.parentNode,Rl=pl(Tl),Fl=pl(Tl,n.draggable),yc.eventCanceled||(tc=!1,ic=!1,oc=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Oc(this.cloneId),Oc(this._dragStartId),this.nativeDraggable&&(Ka(document,"drop",this),Ka(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Xa&&rl(document.body,"user-select",""),rl(Tl,"transform",""),t&&(Gl&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),jl&&jl.parentNode&&jl.parentNode.removeChild(jl),(kl===Pl||zl&&"clone"!==zl.lastPutMode)&&$l&&$l.parentNode&&$l.parentNode.removeChild($l),Tl&&(this.nativeDraggable&&Ka(Tl,"dragend",this),Cc(Tl),Tl.style["will-change"]="",Gl&&!tc&&il(Tl,zl?zl.options.ghostClass:this.options.ghostClass,!1),il(Tl,this.options.chosenClass,!1),Nl({sortable:this,name:"unchoose",toEl:Pl,newIndex:null,newDraggableIndex:null,originalEvent:t}),kl!==Pl?(Rl>=0&&(Nl({rootEl:Pl,name:"add",toEl:Pl,fromEl:kl,originalEvent:t}),Nl({sortable:this,name:"remove",toEl:Pl,originalEvent:t}),Nl({rootEl:Pl,name:"sort",toEl:Pl,fromEl:kl,originalEvent:t}),Nl({sortable:this,name:"sort",toEl:Pl,originalEvent:t})),zl&&zl.save()):Rl!==Ml&&Rl>=0&&(Nl({sortable:this,name:"update",toEl:Pl,originalEvent:t}),Nl({sortable:this,name:"sort",toEl:Pl,originalEvent:t})),yc.active&&(null!=Rl&&-1!==Rl||(Rl=Ml,Fl=Wl),Nl({sortable:this,name:"end",toEl:Pl,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){Al("nulling",this),kl=Tl=Pl=jl=Dl=$l=Ll=Il=Ul=ql=Gl=Rl=Fl=Ml=Wl=Zl=Jl=zl=Bl=yc.dragged=yc.ghost=yc.clone=yc.active=null,ac.forEach((function(t){t.checked=!0})),ac.length=Vl=Hl=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":Tl&&(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++)el(t=n[o],r.draggable,this.el,!1)&&e.push(t.getAttribute(r.dataIdAttr)||xc(t));return e},sort:function(t,e){var n={},o=this.el;this.toArray().forEach((function(t,e){var i=o.children[e];el(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 el(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=Ol.modifyOption(this,t,e);n[t]=void 0!==o?o:e,"group"===t&&mc(n)},destroy:function(){Al("destroy",this);var t=this.el;t[Cl]=null,Ka(t,"mousedown",this._onTapStart),Ka(t,"touchstart",this._onTapStart),Ka(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(Ka(t,"dragover",this),Ka(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),(function(t){t.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),nc.splice(nc.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!Il){if(Al("hideClone",this),yc.eventCanceled)return;rl($l,"display","none"),this.options.removeCloneOnHide&&$l.parentNode&&$l.parentNode.removeChild($l),Il=!0}},_showClone:function(t){if("clone"===t.lastPutMode){if(Il){if(Al("showClone",this),yc.eventCanceled)return;Tl.parentNode!=kl||this.options.group.revertClone?Dl?kl.insertBefore($l,Dl):kl.appendChild($l):kl.insertBefore($l,Tl),this.options.group.revertClone&&this.animate(Tl,$l),rl($l,"display",""),Il=!1}}else this._hideClone()}},lc&&Ja(document,"touchmove",(function(t){(yc.active||tc)&&t.cancelable&&t.preventDefault()})),yc.utils={on:Ja,off:Ka,css:rl,find:al,is:function(t,e){return!!el(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:vl,closest:el,toggleClass:il,clone:yl,index:pl,nextTick:Sc,cancelNextTick:Oc,detectDirection:pc,getChild:ul,expando:Cl},yc.get=function(t){return t[Cl]},yc.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&&(yc.utils=Ra(Ra({},yc.utils),t.utils)),Ol.mount(t)}))},yc.create=function(t,e){return new yc(t,e)},yc.version="1.15.3";var _c,Ac,Nc,Tc,Pc,jc,kc=[],Dc=!1;function Lc(){kc.forEach((function(t){clearInterval(t.pid)})),kc=[]}function $c(){clearInterval(jc)}var Ic=vl((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=ll(),d=!1;Ac!==n&&(Ac=n,Lc(),_c=e.scroll,i=e.scrollFn,!0===_c&&(_c=fl(n,!0)));var u=0,h=_c;do{var p=h,m=cl(p),f=m.top,g=m.bottom,v=m.left,b=m.right,y=m.width,w=m.height,C=void 0,E=void 0,x=p.scrollWidth,S=p.scrollHeight,O=rl(p),_=p.scrollLeft,A=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 N=C&&(Math.abs(b-r)<=a&&_+y<x)-(Math.abs(v-r)<=a&&!!_),T=E&&(Math.abs(g-s)<=a&&A+w<S)-(Math.abs(f-s)<=a&&!!A);if(!kc[u])for(var P=0;P<=u;P++)kc[P]||(kc[P]={});kc[u].vx==N&&kc[u].vy==T&&kc[u].el===p||(kc[u].el=p,kc[u].vx=N,kc[u].vy=T,clearInterval(kc[u].pid),0==N&&0==T||(d=!0,kc[u].pid=setInterval(function(){o&&0===this.layer&&yc.active._onTouchMove(Pc);var e=kc[this.layer].vy?kc[this.layer].vy*l:0,n=kc[this.layer].vx?kc[this.layer].vx*l:0;"function"==typeof i&&"continue"!==i.call(yc.dragged.parentNode[Cl],n,e,t,Pc,kc[this.layer].el)||bl(kc[this.layer].el,n,e)}.bind({layer:u}),24))),u++}while(e.bubbleScroll&&h!==c&&(h=fl(h,!1)));Dc=d}}),30),Mc=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 Rc(){}function Wc(){}Rc.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=ul(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:Mc},Ba(Rc,{pluginName:"revertOnSpill"}),Wc.prototype={onSpill:function(t){var e=t.dragEl,n=t.putSortable||this.sortable;n.captureAnimationState(),e.parentNode&&e.parentNode.removeChild(e),n.animateAll()},drop:Mc},Ba(Wc,{pluginName:"removeOnSpill"}),yc.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?Ja(document,"dragover",this._handleAutoScroll):this.options.supportPointer?Ja(document,"pointermove",this._handleFallbackAutoScroll):e.touches?Ja(document,"touchmove",this._handleFallbackAutoScroll):Ja(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(t){var e=t.originalEvent;this.options.dragOverBubble||e.rootEl||this._handleAutoScroll(e)},drop:function(){this.sortable.nativeDraggable?Ka(document,"dragover",this._handleAutoScroll):(Ka(document,"pointermove",this._handleFallbackAutoScroll),Ka(document,"touchmove",this._handleFallbackAutoScroll),Ka(document,"mousemove",this._handleFallbackAutoScroll)),$c(),Lc(),clearTimeout(nl),nl=void 0},nulling:function(){Pc=Ac=_c=Dc=jc=Nc=Tc=null,kc.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(Pc=t,e||this.options.forceAutoScrollFallback||Va||qa||Xa){Ic(t,this.options,r,e);var s=fl(r,!0);!Dc||jc&&o===Nc&&i===Tc||(jc&&$c(),jc=setInterval((function(){var r=fl(document.elementFromPoint(o,i),!0);r!==s&&(s=r,Lc()),Ic(t,n.options,r,e)}),10),Nc=o,Tc=i)}else{if(!this.options.bubbleScroll||fl(r,!0)===ll())return void Lc();Ic(t,this.options,fl(r,!1),!1)}}},Ba(t,{pluginName:"scroll",initializeByDefault:!0})}),yc.mount(Wc,Rc);const Fc={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=Fc.getStyle(t),i=Number.parseInt(o.height,10),r=i/(e/60);t.style.height="0px",function e(){const o=Number.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=Fc.getStyle(t),i=Number.parseInt(o.height,10),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=Number.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"===Fc.getStyle(t,"display"))=>{n?Fc.slideDown(t,e):Fc.slideUp(t,e)}},Bc=t=>Number.isInteger(Number(t)),zc=t=>{let e=0,n=t;for(;null==n?void 0:n.previousElementSibling;)n=n.previousElementSibling,e++;return e},Uc=(t,e,n)=>{const o=n.split("||"),i=ti(e).map((e=>t.find((t=>{const n=o.find((e=>!!ps(t,e)));return n&&ps(t,n)===e})))).filter(Boolean).concat(t);return ti(i)},qc=(t,e,n)=>{for(let o=0;o<t.length;o++)e.call(n,t[o],o)},Vc=(t,e)=>{const n=[];return qc(t,((t,o)=>n.push(e(t,o)))),n},Hc={},Xc=t=>{if(Hc[t])return Hc[t];const e=({className:"class"}[t]||t).replace(/^\d+/,"").replace(/[^a-zA-Z0-9-:]/g,"");return Hc[t]=e,e},Yc=t=>t.replace(/\b\w/g,(t=>t.toUpperCase())),Gc=()=>-1!==window.navigator.userAgent.indexOf("MSIE "),Zc={capitalize:Yc,safeAttrName:Xc,forEach:qc,copyObj:t=>window.JSON.parse(window.JSON.stringify(t)),map:Vc,subtract:(t,e)=>e.filter((e=>!~t.indexOf(e))),indexOfNode:zc,isInt:Bc,get:ps,orderObjectsBy:Uc,isIE:Gc},Jc={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="${yr}${t}">${t}</i>`},Kc=new Set(["input","textarea","select"]),Qc=(t={})=>{var e,n,o;let i=(null==(e=null==t?void 0:t.attrs)?void 0:e.name)||(null==t?void 0:t.name);if(i)return i;const r=ei(t);let s=(null==(n=t.config)?void 0:n.label)||(null==(o=t.attrs)?void 0:o.label)||(null==t?void 0:t.label);return s&&("object"==typeof s&&(s=td.create(s).textContent),/^<.+>.+<.+>$/gim.test(s)&&(s=(t=>{const e=document.createElement("div");return e.innerHTML=t,e.textContent||e.innerText||""})(s)),i=`${r}-${Ar(((t,e,n="…")=>{if(t.length<=e)return t;const o=t.slice(0,e),i=o.lastIndexOf(" ");let r=`${i>0?o.slice(0,i):o}`;return n&&(r+=n),r})(s,24,null))}`),i||r};const td=new class{constructor(t=Object.create(null)){n(this,"render",(t=>(t.id=`f-${t.id||ei()}`,this.create(t)))),n(this,"create",((t,e=!1)=>{if(!t)return;if(this.isDOMElement(t))return t;const n=this,o=["children","content"],{className:i,options:r,dataset:s,...a}=this.processElemArg(t);let l;o.push("tag");const{tag:c}=a;let d;const u={attrs:{},className:[Zc.get(a,"config.inputWrap")],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=ni(a.attrs,{className:i})),r){const t=this.processOptions(r,a,e);if(!this.holdsContent(h)||"button"===c)return Zc.forEach(t,(t=>{u.children.push(n.create(t,e))})),a.attrs.className&&(u.className=a.attrs.className),u.id=a.id,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(Zc.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 m=Zc.subtract(o,Object.keys(a));for(d=m.length-1;d>=0;d--)h[m[d]]=a[m[d]];return u.children.length&&(h=this.create(u)),h})),n(this,"onRender",((t,e,n=333)=>{const o=Date.now(),i=()=>{!t.parentElement&&Date.now()-o<n?window.requestAnimationFrame(i):t.parentElement&&e(t)};i()})),n(this,"toggleElementsByStr",((t,e)=>{const n=[];return td.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 qc(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=Qo(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=>Qo(t)===Oi)),n(this,"isStage",(t=>Qo(t)===_i)),n(this,"isRow",(t=>Qo(t)===Ai)),n(this,"isColumn",(t=>Qo(t)===Ni)),n(this,"isField",(t=>Qo(t)===Ti)),n(this,"asComponent",(t=>Au[`${Qo(t)}s`].get(t.id))),this.options=t}set setOptions(t){this.options=ni(this.options,t)}processElemArg(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:td.onRender,render:td.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(`#${vi} svg symbol`);return this.iconSymbols=Array.from(t).reduce(((t,e)=>{var n;return t[e.id.replace(yr,"")]={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=ni(r,e);return this.cachedIcons[i]=td.create(t).outerHTML,this.cachedIcons[i]}return this.cachedIcons[i]=td.create(r).outerHTML,this.cachedIcons[i]}return(null==(o=Jc[td.options.iconFont])?void 0:o.call(Jc,t))||t}processAttrs(t,e,n){const{attrs:o={}}=t;if(!n&&!o.name&&null!==o.name&&this.isInput(t.tag)){const n=Qc(t);n&&e.setAttribute("name",n)}for(const i of Object.keys(o)){const t=Zc.safeAttrName(i),n=this.processAttrValue(o[i]);!1!==n&&e.setAttribute(t,n)}}processAttrValue(t){if("function"==typeof t)return t();if("boolean"==typeof t)return t?"":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,a)=>{var l;const{label:c,value:d,...u}=t,h=()=>{const l={tag:"input",attrs:{name:s,type:r,value:d||"",id:`${s}-${a}`,...u},action:o},h={tag:"label",attrs:{for:`${s}-${a}`},children:c},p={children:[l,h],className:[`f-${r}`]};return i.className&&(e.config.inputWrap=i.className),e.config.inline&&p.className.push(`f-${r}-inline`),t.selected&&(l.attrs.checked=!0),n&&(h.attrs.contenteditable=!0),p},p={select:()=>{const e=t.attrs||t,n={attrs:e,...t,...e},{label:o,checked:i,selected:r,attrs:s}=n;return{tag:"option",attrs:{...s,selected:!(!i&&!r)},children:o}},button:t=>{const{type:n,label:o,className:i,id:r}=t;return{...e,attrs:{type:n},className:i,id:r||ei(),options:void 0,children:o,action:e.action}},checkbox:h,radio:h};return null==(l=p[r])?void 0:l.call(p,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),Kc.has(e)}parsedHtml(t){const e=document.createElement("textarea");return e.innerHTML=t,e.textContent}labelAfter(t){const e=Zc.get(t,"attrs.type"),n=Zc.get(t,"config.labelAfter");return void 0!==n?n:"checkbox"===e||"radio"===e}label(t,e){const n=Zc.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=Qo(t);return e?Au.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,Zc.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)}};Zc.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");Fc.slideUp(t,600,(()=>{td.empty(t),t.classList.remove("removing-all-fields"),td.emptyClass(t),Fc.slideDown(t,300)}))}toggleSortable(t,e){let n=e;const o=Qo(t);if(!o)return;const i=Qo(t.parentElement),r=td[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(Di.get(t.classList.item(0)));t.classList.toggle("empty",!e.length)}isDOMElement(t){return t instanceof window.Element||t instanceof window.HTMLElement||!(!t||"object"!=typeof t||1!==t.nodeType||"string"!=typeof t.nodeName)}},ed="f-autocomplete",nd=`${ed}-display-field`,od=`${ed}-list`,id="highlight-component",rd=`${od}-item`,sd=["config.label","config.controlId"],ad=[...sd,"config.legend","name"],ld=t=>sd.reduce(((e,n)=>e||t.get(n)),null),cd=t=>ad.reduce(((e,n)=>e||t.get(n)),null)||_r(t.name),dd=new Map([["condition.source",ld],["if.condition.source",ld],["if.condition.target",ld],["then.condition.target",cd],["condition.target",cd]]),ud=({id:t,...e},n)=>{const{name:o,label:i}=e;if(!o)return i;return dd.get(n)(e)},hd=t=>(t.classList.contains(rd)||(t=t.parentElement),t),pd=({value:t,textLabel:e,htmlLabel:n,componentType:o,depth:i=0},r)=>{const s={tag:"li",children:n,dataset:{value:t,label:e},className:[rd,`${rd}-depth-${i}`,`component-type-${o}`],action:{mousedown:({target:t})=>{t=hd(t),r.setValue(t),r.selectOption(t),r.hideList()},mouseover:({target:t})=>{t=hd(t),r.removeHighlight(),r.highlightComponent(t)},mouseleave:({target:t})=>{t=hd(t),r.removeHighlight()}}};return td.create(s)},md=t=>{const e=t.value,n=[],o=Au.flatList(),i=Object.entries(o).reduce(((o,[i,r])=>{const s=ud(r,t.key);if(s){const a=r.name,l={tag:"span",content:` ${_r(a)}`,className:"component-type"},c=`${a}.${s}`;n.push(c);const d=((t,e)=>{const n=t.reduce(((t,n)=>t+(n===e)),0);return n>1?`(${n})`:""})(n,c),u=[`${s} `,{tag:"span",content:d,className:"component-label-count"},l],h=[s,d].join(" ").trim();if(r.isCheckable){const e=((t,e)=>{const n=t.data.options.map(((n,o)=>{const i=`${t.address}.options[${o}]`,r=n.label,s=n.label;return pd({value:i,textLabel:r,htmlLabel:s,componentType:"option",depth:1},e)}));return td.create({tag:"ul",attrs:{className:[od,"options-list"]},children:n})})(r,t);u.push(e)}const p=(({selectedId:t,...e})=>(e.value===t&&(e.selected=!0),e))({value:i,textLabel:h,htmlLabel:u,componentType:a,selectedId:e});o.push(pd(p,t))}return o}),[]);return i};class fd{constructor({key:t,value:e,className:o,onChange:i=di}){n(this,"lastCache",Date.now()),n(this,"optionsCache",null),this.key=t,this.className=[o||this.key.replace(/\./g,"-")].flat(),this.value=e,this.onChange=i||di,this.events=[],this.build()}createProxy(){return new Proxy(this,{get(t,e){if(e in t)return t[e];if(e in t.dom){const n=t.dom[e];return"function"==typeof n?n.bind(t.dom):n}},set:(t,e,n)=>(e in t?t[e]=n:t.dom[e]=n,!0)})}get isAddress(){return ai(this.value)}get valueComponent(){return ai(this.value)&&Au.getAddress(this.value)}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(`${ed}-focused`);const n=td.toggleElementsByStr(this.list.querySelectorAll(`.${rd}-depth-0`),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(`${ed}-focused`),e.removeEventListener("keydown",t),this.hideList()},input:t=>{const{value:e}=t.target,n=td.toggleElementsByStr(this.list.querySelectorAll("li"),e);if(0===e.length&&this.clearValue(),0===n.length)this.hideList();else{const t=this.getActiveOption()||n[0];this.showList(t)}this.setValue({dataset:{label:e,value:e}})}};return this.displayField=td.create({tag:"input",autocomplete:"off",action:e,attrs:{type:"text",className:nd,value:this.label||this.value,placeholder:r.get(`${this.key}.placeholder`)}}),this.hiddenField=td.create({tag:"input",attrs:{type:"hidden",className:ed,value:this.value}}),this.list=td.create({tag:"ul",attrs:{className:od}}),this.clearButton=td.create({tag:"span",content:td.icon("remove"),className:"clear-button hidden",action:{click:()=>this.clearValue()}}),this.dom=td.create({children:[this.displayField,this.clearButton,this.hiddenField],className:[ed,this.className].flat(),action:{onRender:t=>{this.stage=t.closest(".formeo-stage"),this.value&&(this.displayField.value=this.label),this.clearButton.classList.toggle("hidden",!this.value.length)}}}),this.dom}get label(){if(!ai(this.value))return this.value;const t=this.value&&Au.getAddress(this.value);return t&&ud(t,`${this.key}`)||this.value}updateOptions(){let t=this.optionsCache;const e=Date.now();(e-this.lastCache>5*or||!t)&&(td.empty(this.list),t=this.generateOptions(),this.lastCache=e),this.list.children.length||this.list.append(...t)}generateOptions(){return this.optionsCache=md(this),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-n.y+"px",left:o.x+window.scrollX-n.x+2+"px",width:`${e}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),Fc.slideDown(e,nr)}hideList(t=this.list){Fc.slideUp(t,nr),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"),ai(t)){const e=Au.getAddress(t);null==(n=null==e?void 0:e.dom)||n.classList.remove(id)}}t&&(t.classList.add("active-option"),this.highlightComponent(t))}removeHighlight(){const t=document.getElementsByClassName(id);for(const e of t)e.classList.remove(id)}highlightComponent(t){var e;const{dataset:{value:n}}=t;if(ai(n)){const{componentAddress:t,isOptionAddress:o,optionIndex:i}=Nr(n).reduce(((t,e)=>"options"===e?(t.isOptionAddress=!0,t):t.isOptionAddress?(t.optionIndex=+e,t):(t.componentAddress.push(e),t)),{componentAddress:[],optionIndex:null,isOptionAddress:!1}),r=Au.getAddress(t);if((null==r?void 0:r.dom)&&(r.dom.classList.add(id),o)){null==(e=r.dom.querySelectorAll(".field-preview .f-checkbox, .field-preview .f-radio")[i])||e.classList.add(id)}}}clearValue(){this.selectOption(null),this.setValue({dataset:{label:"",value:""}}),this.displayField.focus()}setValue(t){var e;const{label:n,value:o}=t.dataset;this.displayField.value=n,this.hiddenField.value=o,this.value=o,this.clearButton.classList.toggle("hidden",!o.length),null==(e=this.onChange)||e.call(this,{target:this.hiddenField})}}function gd({key:t,value:e,type:n="text",checked:o}){const i={tag:"input",attrs:{type:n,value:e,placeholder:r.get(`${t}.placeholder`)||_r(t)},className:[t.replace(/\./g,"-")],config:{}};return o&&(i.attrs.checked=!0),i}function vd(t){const e=r.get(t);if(e)return e;const n=t.split(".");return r.get(n[n.length-1])}const bd={autocomplete:(...t)=>new fd(...t).createProxy(),string:({key:t,value:e})=>gd({key:t,value:e}),boolean:({key:t,value:e})=>gd({key:t,value:e,type:"selected"===t?"radio":"checkbox",checked:!!e}),number:({key:t,value:e})=>gd({key:t,value:e,type:"number"}),array:({key:t,value:e})=>({tag:"select",attrs:{placeholder:vd(`placeholder.${t}`)},className:[t.replace(/\./g,"-")],options:e}),object:t=>Object.entries(t).map((([t,e])=>bd[td.childType(e)]({key:t,value:e})))},yd={boolean:(t,e)=>({click:({target:n})=>{if("radio"===n.type){const t=e.data.options.map((t=>({...t,selected:!1})));e.set("options",t)}e.set(t,n.checked),e.updatePreview()}}),string:(t,e)=>({input:({target:{value:n}})=>{e.set(t,n),e.debouncedUpdatePreview()}}),number:(t,e)=>({input:({target:{value:n}})=>{e.set(t,Number(n)),e.debouncedUpdatePreview()}}),array:(t,e)=>({change:({target:{value:n}})=>{e.set(t,n),e.debouncedUpdatePreview()}}),object:()=>({})},wd="hidden-property",Cd=/\.options\[\d+\]$/,Ed={"if-sourceProperty":fs(hr,dr,ur),"if-targetProperty":fs(hr),"then-targetProperty":fs(hr,dr,ur),...Object.entries(pr).reduce(((t,[e,n])=>(t[`if-${e}`]=n,t[`then-${e}`]=n,t)),{})},xd={assignment:Od,comparison:Od,logical:Od,source:({key:t,value:e,onChange:n,conditionType:o})=>bd.autocomplete({key:`${o}.condition.${t}`,value:e,onChange:n,className:`condition-${t}`}),sourceProperty:Od,targetProperty:Od,target:t=>xd.source(t),value:({key:t,value:e,onChange:n},o)=>{const i=bd.string({key:`condition.${t}`,value:e});return i.action={input:n},i}};function Sd({key:t,value:e,conditionType:n}){const o=Ed[`${n}-${t}`];return Object.entries(o||{}).map((([n,o])=>function({fieldName:t,fieldValue:e,key:n,optionValue:o}){return{label:r.get(`${t}.${n}`)||_r(n).toLowerCase(),value:o,selected:o===e}}({fieldName:t,fieldValue:e,key:n,optionValue:o})))}function Od({key:t,value:e,onChange:n,conditionType:o}){const i=Sd({key:t,value:e,conditionType:o}),r=bd.array({key:`condition.${t}`,value:i});return r.action={change:n},r}const _d={sourceProperty:t=>{const e=t.get("source"),n=t.get("sourceProperty"),o=!!e.value,i=!!e.value.match(Cd);return Pd(i,n),!o},comparison:t=>{const e=t.get("source"),n=t.get("sourceProperty"),o=!!e.value,i=!!e.value.match(Cd);return!o||i||"value"!==n.value},assignment:t=>{const e=t.get("target"),n=t.get("targetProperty");return!!!e.value||n.value.startsWith("is")},targetProperty:t=>{const e=t.get("target"),n=t.get("targetProperty"),o=!!e.value.match(Cd);return Pd(o,n),i=e.value,!Ii.test(i);var i},target:t=>{const e=t.get("source"),n=t.get("sourceProperty"),o=!!(null==e?void 0:e.value);return!(!n||o)||n&&"value"!==(null==n?void 0:n.value)},value:t=>{const e=t.get("target"),n=t.get("targetProperty");return void 0!==n&&(!(!e||e.value)||(!!(null==(o=t.get("comparison"))?void 0:o.classList.contains(wd))||(n.value===Nd||n.value.startsWith("is"))));var o}},Ad=t=>{var e;for(const[n,o]of t){const i=!!(null==(e=_d[n])?void 0:e.call(_d,t))||!1;o.classList.toggle(wd,i)}},Nd="isChecked",Td=t=>t.value.endsWith("Checked"),Pd=(t,e)=>{var n;if(t&&Td(e))return null;const o=Array.from(e.querySelectorAll("option")),i=[];for(const r of o){const e=Td(r),n=t?!e:e;n&&i.push(r.value),r.classList.toggle("hidden-option",n)}i.includes(e.value)&&(e.value=t?Nd:(null==(n=o.find((t=>!Td(t))))?void 0:n.value)||e.value)};class jd{constructor({conditionValues:t,conditionType:e,conditionCount:o,index:i},r){n(this,"updateDataDebounced",li((t=>{ku.formeoUpdated(t),Au.setAddress(t.dataPath,t.value)}))),n(this,"onChangeCondition",(({key:t,target:e})=>{const n={changedProperty:t,dataPath:this.address,value:this.value,src:e};Ad(this.fields),this.updateDataDebounced(n)})),this.values=new Map(function(t,e=cr){return e.reduce(((e,n)=>(void 0!==t[n]&&e.push([n,t[n]]),e)),[])}(t)),this.conditionType=e,this.parent=r,this.baseAddress=`${r.address}.${e}`,this.fields=new Map,this.conditionCount=o,this.index=i,this.dom=this.generateDom()}setConditionIndex(t){this.index=t}get address(){return`${this.baseAddress}[${this.index}]`}destroy(){const t=Au.getAddress(this.baseAddress);t.splice(this.index,1),Au.setAddress(this.baseAddress,t),Fc.slideUp(this.dom,nr,(()=>{this.dom.remove()}))}label(){return this.index?null:{tag:"label",className:`condition-label ${this.conditionType}-condition-label`,content:r.get(`condition.type.${this.conditionType}`)}}generateDom(){const t=[];for(const[n,o]of this.values){const e=t=>this.onChangeCondition({key:n,target:t.target}),i={key:n,value:o,conditionType:this.conditionType,onChange:e},r=xd[n](i,this.values),s=r.dom||td.create(r);this.fields.set(n,r.dom?r:s),t.push(s)}const e={children:[this.label(),...t,...this.generateConditionTypeActionButtons()],className:`f-condition-row ${this.conditionType}-condition-row display-none`,action:{onRender:t=>{this.processUiState()}}};return td.create(e)}generateConditionTypeActionButtons(){const t=[],e="manage-condition-type",n=t=>`${t}-condition-type`,o=td.btnTemplate({title:r.get(`remove${this.conditionType}Condition`),className:[e,n("remove")],content:td.icon("minus"),action:{click:()=>this.destroy(),mouseover:t=>{this.dom.classList.add("to-remove")},mouseout:t=>{this.dom.classList.remove("to-remove")}}});t.push(o);const i=td.btnTemplate({title:r.get(`add${this.conditionType}Condition`),className:[e,n("add")],content:td.icon("plus"),action:{click:()=>{const t=this.parent.addConditionType(this.conditionType),e={changedProperty:null,dataPath:t.address,value:t.value,src:t.dom};this.updateDataDebounced(e)}}});return t.push(i),t}get value(){return Array.from(this.fields).reduce(((t,[e,n])=>(t[e]=n.value,t)),{})}processUiState(){Ad(this.fields),this.dom.classList.remove("display-none")}}const kd=new Map([["attrs",({itemKey:t})=>t],["options",({itemKey:t,key:e})=>`${t}.${e}`]]),Dd=(t,e)=>{if("select"===e.controlId){const n=e.editPanels.get("options"),[o,i]=t?Cr:Er,r=n.data.map((({[o]:t,...e})=>({[i]:t,...e})));n.setData(r)}},Ld=new Map([["attrs-multiple",t=>({change:({target:e})=>{"select"===t.field.controlId&&Dd(e.checked,t.field)}})]]);class $d{constructor({key:t,index:e,field:o,panel:i,data:r}){n(this,"addConditionType",((t,e)=>{const n=this.findOrCreateConditionTypeWrap(t);let o=e;if(!o){const[e]=gr()[t],i=n.children.length;"if"===t&&(e.logical="||"),o={conditionValues:e,conditionCount:i,index:i}}const i=new jd({conditionType:t,...o},this);return n.appendChild(i.dom),i})),n(this,"removeConditionType",((t,e)=>{const n=this.conditionTypeWrap.get(t),o=n.children[e];o.destroy(),n.removeChild(o.dom)})),n(this,"generateConditionFields",((t,e)=>(this.conditions=new Map,e.forEach(((n,o)=>{const i=this.addConditionType(t,{index:o,conditionCount:e.length,conditionValues:n});this.conditions.set(o,i)})),this.findOrCreateConditionTypeWrap(t)))),this.field=o,this.itemKey=t,this.itemIndex=e,this.panel=i,this.panelName=i.name,this.isDisabled=o.isDisabledProp(t,this.panelName),this.isHidden=this.isDisabled&&o.config.panels[this.panelName].hideDisabled,this.isLocked=o.isLockedProp(t,this.panelName),this.address=`${o.indexName}.${o.id}.${t}`,this.itemSlug=Tr(t),this.conditionTypeWrap=new Map,void 0!==r&&void 0===this.field.get(this.itemKey)&&this.field.set(this.itemKey,r);const s=[`field-${this.itemSlug}`,"prop-wrap"];this.isHidden&&s.push("hidden-property"),this.dom=td.create({tag:"li",className:s,children:{className:"component-prop",children:[this.itemInputs(),this.itemControls]}})}get itemValues(){const t=this.field.get(this.itemKey);return(null==t?void 0:t.constructor)===Object?Uc(Object.entries(t),Cr,"0"):[[this.itemKey,t]]}findOrCreateConditionTypeWrap(t){let e=this.conditionTypeWrap.get(t);return e||(e=td.create({className:`type-conditions-wrap ${t}-conditions-wrap`}),this.conditionTypeWrap.set(t,e),e)}itemInputs(){const t=td.create({className:`${this.panelName}-prop-inputs prop-inputs f-input-group`,children:this.itemValues.map((([t,e])=>"conditions"===this.panelName?this.generateConditionFields(t,e):this.itemInput(t,e)))});return this.inputs&&this.inputs.replaceWith(t),this.inputs=t,t}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:()=>{Fc.slideUp(this.dom,er,(t=>{this.field.remove(this.itemKey),t.remove(),this.panel.updateProps()}))},mouseover:t=>{this.dom.classList.add("to-remove")},mouseout:t=>{this.dom.classList.remove("to-remove")}},content:td.icon("remove")};return{className:`${this.panelName}-prop-controls prop-controls`,content:[t]}}itemInput(t,e){var n,o;const i=td.childType(e)||"string",r=(null==(n=kd.get(this.panelName))?void 0:n({itemKey:this.itemKey,key:t}))||this.itemKey,s=r.split(".").filter(Number.isNaN).join(".")||t,a=bd[i]({key:t,value:e}),l=`${this.field.shortId}-${Tr(r).replace(/-\d+-(selected)/g,"-$1")}`,c={label:"options"!==this.panelName&&(vd(s)||_r(s)),labelAfter:!1},d={name:"checkbox"===a.attrs.type?`${l}[]`:l};d.disabled=this.isDisabled,d.locked=this.isLocked;const u=null==(o=Ld.get(this.itemSlug))?void 0:o(this),h=function(t,e={}){const n={...t};for(const o in e)Object.hasOwn(e,o)&&(Object.hasOwn(n,o)?Array.isArray(n[o])?n[o].push(e[o]):n[o]=[n[o],e[o]]:n[o]=e[o]);return n}(yd[i](r,this.field),u||{}),p=ni(bd[i]({key:t,value:e}),{action:h,attrs:d,config:c});return Cr.includes(t)?{className:"f-addon",children:p}:p}}const Id={multiple:(t,e)=>{Dd(!!t,e)}};class Md{constructor(t,e,o){n(this,"addAttribute",((t,e)=>{var n;let o=e;const i=Xc(t),s=`attrs.${i}`;r.current[s]||r.put(s,Yc(t)),"string"==typeof o&&["true","false"].includes(o)&&(o=JSON.parse(o)),this.component.set(`attrs.${t}`,o),null==(n=Id[i])||n.call(Id,o,this.component);const a=this.props.querySelector(`.${this.component.name}-attrs-${i}`),l=new $d({key:s,data:{[i]:o},field:this.component,panel:this});a?a.replaceWith(l.dom):this.props.appendChild(l.dom),this.component.resizePanelWrap()})),n(this,"addOption",(()=>{const t=this.component.data.config.controlId,e=this.component.get("options"),n="select"===t?"option":t,o=r.get("newOptionLabel",{type:n})||"New Option",i=`${this.name}[${this.data.length}]`,s=e[e.length-1],a={...e.length?s:{},label:o};"button"!==t&&(a.value=Ar(o));const l=new $d({key:i,data:a,field:this.component,index:this.props.children.length,panel:this});this.editPanelItems.push(l),this.props.appendChild(l.dom),this.component.debouncedUpdatePreview(),this.component.resizePanelWrap()})),n(this,"addCondition",(t=>{const e=`conditions[${this.component.get("conditions").length}]`,n=new $d({key:e,data:t.template,field:this.component,panel:this});this.props.appendChild(n.dom),this.component.set(e,t.template),this.component.resizePanelWrap()})),n(this,"clearAllItems",(()=>{const t="array"===this.type?[]:{},e={type:this.name,removeAction:()=>{this.component.set(this.name,t),this.updateProps()}};Iu.remove[this.name](e);const n=_r(this.name),o=new window.CustomEvent(`onRemove${n}`,{detail:e});document.dispatchEvent(o)})),this.type=td.childType(t),this.name=e,this.component=o,this.panelConfig=this.getPanelConfig(this.data)}get data(){const t=this.component.get(this.name);return"object"===this.type?Object.entries(t):t}getPanelConfig(t){return this.props=this.createProps(t),this.editButtons=this.createEditButtons(),{config:{label:r.get(`panel.label.${this.name}`)},attrs:{className:`${Si} ${this.name}-panel`},children:[this.props,this.editButtons]}}createProps(t=this.data){this.editPanelItems=Array.from(t).map(((t,e)=>{const n="array"===this.type,o=n?`[${e}]`:`.${t[0]}`,i=n?t:{[t[0]]:t[1]};return new $d({key:`${this.name}${o}`,data:i,field:this.component,index:e,panel:this})}));const e={tag:"ul",attrs:{className:["edit-group",`${this.component.name}-edit-group`,`${this.component.name}-edit-${this.name}`]},editGroup:this.name,isSortable:"options"===this.name,content:this.editPanelItems};return td.create(e)}updateProps(){const t=this.createProps();this.props.replaceWith(t),this.props=t}createEditButtons(){const t=this.name,e=r.get(`panelEditButtons.${t}`),n={attrs:this.addAttribute,options:this.addOption,conditions:this.addCondition},o=[];if("conditions"===t){r.current.clearAll||r.put("clearAll","Clear All");const e={...td.btnTemplate({content:[td.icon("bin"),r.get("clearAll")],title:r.get("clearAll")}),className:`clear-all-${t}`,action:{click:()=>{this.clearAllItems()}}};o.push(e)}const i={...td.btnTemplate({content:e,title:e}),className:`add-${t}`,action:{click:e=>{const o={btnCoords:td.coords(e.target),addAction:n[t]};"attrs"===t&&(o.isDisabled=this.component.isDisabledProp,o.isLocked=this.component.isLockedProp,o.message={attr:r.get(`action.add.${t}.attr`),value:r.get(`action.add.${t}.value`)});const i=_r(t),s=new window.CustomEvent(`onAdd${i}`,{detail:o});Iu.add[t](o),document.dispatchEvent(s)}}};o.push(i);return{className:"panel-action-buttons",content:o}}setData(t){this.data=t,this.component.set(this.name,t),this.updateProps()}}const Rd=Object.freeze({type:"field",displayType:"slider"}),Wd=t=>({transform:`translateX(${t?`${t}px`:0})`});class Fd{constructor(t){n(this,"toggleTabbedLayout",(()=>{var t;this.getPanelDisplay();const e=this.isTabbed;return null==(t=this.panelsWrap.parentElement)||t.classList.toggle("tabbed-panels",e),e&&this.panelNav.removeAttribute("style"),e})),n(this,"resizePanels",(()=>{this.toggleTabbedLayout()})),this.opts=ni(Rd,t),this.panelDisplay=this.opts.displayType,this.activePanelIndex=0,this.panelNav=this.createPanelNav();const e=this.createPanelsWrap();this.nav=this.navActions(),this.nav.groupChange(this.activePanelIndex);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)}),or)}getPanelDisplay(){const t=this.panelsWrap,e=Number.parseInt(td.getStyle(t,"width"),10)>390?"tabbed":"slider",n="auto"===this.opts.displayType;return this.panelDisplay=n?e:this.opts.displayType||Rd.displayType,this.panelDisplay}createPanelsWrap(){const t=td.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 Zc.forEach(e,(t=>{t.fieldId=this.opts.id,t.isSortable&&yc.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=zc(t.target);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",td.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:td.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:td.icon("triangle-left")};return td.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=zc(this.currentPanel);let r={nav:0,panel:0},s={...r};t.groupChange=t=>(this.activePanelIndex=t,this.currentPanel=i[t],td.removeClasses(i,"active-panel"),td.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=nr,animate:r=!this.isTabbed})=>{const a=[Wd(s.panel),Wd(t.panel)],l=[Wd(s.nav),Wd(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=()=>{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}}let Bd=null;const zd=fs(hr);class Ud extends $a{constructor(t,e={}){const o={...e,id:e.id||ei()};super(t,o),n(this,"remove",(t=>{if(t){const e=Nr(t),n=e.pop(),o=this.get(e);return Array.isArray(o)?Bc(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 this.dispatchComponentEvent("onRemove",{path:t,parent:e,children:[...n]}),qc(n,(t=>t.remove())),this.dom.parentElement.removeChild(this.dom),((t,e)=>{const n=t.indexOf(e);-1!==n&&t.splice(n,1)})(Au.getAddress(`${e.name}s.${e.id}.children`),this.id),e.children.length||e.emptyClass(),"row"===e.name&&e.autoColumnWidths(),Au[`${this.name}s`].delete(this.id)})),n(this,"emptyClass",(()=>this.dom.classList.toggle("empty",!this.children.length))),n(this,"getComponentTag",(()=>td.create({tag:"span",className:["component-tag",`${this.name}-tag`],children:[(this.isColumn||this.isField)&&td.icon("component-corner",{className:"bottom-left"}),td.icon(`handle-${this.name}`),_r(this.name),(this.isColumn||this.isRow)&&td.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[td.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-${Qo(t)}`),null==e||e.classList.remove(`hovering-${Qo(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,!zd[i]].some(Boolean)?t:e?o.set(zd[i],e):o.get(zd[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={...oi(this.data),id:ei()};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),this.dispatchComponentEvent("onClone",{original:this,clone:e,parent:t}),e})),n(this,"createChildWrap",(t=>td.create({tag:"ul",attrs:{className:"children"},children:t}))),n(this,"isDisabledProp",((t,e="attrs")=>{const n=this.config.panels[e];if(!n)return!1;return n.disabled.concat(this.get("config.disabled")).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")).includes(t)})),n(this,"updateEditPanels",(()=>{if(!this.config)return null;const t=["object","array"],e=ti([...this.config.panels.order,...Object.keys(this.data)]),n=["children","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=td.childType(e);if(t.includes(n)){const t=new Md(e,r,this);this.editPanels.set(t.name,t)}}const i={panels:Array.from(this.editPanels.values()).map((({panelConfig:t})=>t)),id:this.id,displayType:"auto"};this.panels=new Fd(i),this.dom&&(this.dom.querySelector(".panel-nav").replaceWith(this.panels.panelNav),this.dom.querySelector(".panels").replaceWith(this.panels.panelsWrap))})),this.id=o.id,this.shortId=this.id.slice(0,this.id.indexOf("-")),this.name=t,this.indexName=`${t}s`,this.config=Au[`${this.name}s`].config,ni(this.config,o.config),this.address=`${this.name}s.${this.id}`,this.dataPath=`${this.address}.`,this.editPanels=new Map,this.eventListeners=new Map,this.initEventHandlers()}initEventHandlers(){this.config.events&&Object.entries(this.config.events).forEach((([t,e])=>{this.addEventListener(t,e)}))}addEventListener(t,e){this.eventListeners.has(t)||this.eventListeners.set(t,[]),this.eventListeners.get(t).push(e)}removeEventListener(t,e){var n;if(!(null==(n=this.eventListeners)?void 0:n.has(t)))return;const o=this.eventListeners.get(t),i=o.indexOf(e);i>-1&&o.splice(i,1)}dispatchComponentEvent(t,e={}){var n;const o={component:this,type:t,timestamp:Date.now(),...e};return(null==(n=this.eventListeners)?void 0:n.has(t))&&this.eventListeners.get(t).forEach((t=>{try{"function"==typeof t&&t(o)}catch(e){}})),o}set(t,e){const n=this.get(t),o=super.set(t,e);return n!==e&&this.dom&&this.dispatchComponentEvent("onUpdate",{path:t,oldValue:n,newValue:e}),o}get js(){return this.data}get json(){return this.data}empty(){const t=this.children.map((t=>(t.remove(),t)));return this.dom.classList.add("empty"),t}getActionButtons(){const t=[`hovering-${this.name}`,"hovering"];return{className:[`${this.name}-actions`,"group-actions"],action:{mouseenter:()=>{Au.stages.active.dom.classList.add(`active-hover-${this.name}`),this.dom.classList.add(...t)},mouseleave:({target:e})=>{this.dom.classList.remove(...t),Au.stages.active.dom.classList.remove(`active-hover-${this.name}`),e.removeAttribute("style")}},children:[{...td.btnTemplate({content:td.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`);Fc.slideToggle(i,er,t),"field"===this.name&&(Fc.slideToggle(this.preview,er,!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}`)=>({...td.btnTemplate({content:td.icon(t)}),className:["component-handle"]}),move:(t="move")=>({...td.btnTemplate({content:td.icon(t)}),className:["item-move"],meta:{id:"move"}}),edit:(t="edit")=>({...td.btnTemplate({content:td.icon(t)}),className:["edit-toggle"],meta:{id:"edit"},action:{click:()=>{this.toggleEdit()}}}),remove:(t="remove")=>({...td.btnTemplate({content:td.icon(t)}),className:["item-remove"],meta:{id:"remove"},action:{click:()=>{Fc.slideUp(this.dom,er,(()=>{if("column"===this.name){this.parent.autoColumnWidths(),this.remove()}else this.remove()}))}}}),clone:(t="copy")=>({...td.btnTemplate({content:td.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 zc(this.dom)}get parentType(){return Ji.get(this.name)}get parent(){const t=this.parentType;if(!this.dom||!t)return null;const e=this.dom.closest(`.${zi[t]}`);return e&&td.asComponent(e)}get children(){if(!this.dom)return[];const t=this.domChildren,e=Gi.get(this.name);return Vc(t,(t=>Au.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=ei()}=i,a=Gi.get(this.name);if(!a)return null;const l=`${a}s`,c=Au.getAddress(`${l}.${s}`)||Au[l].add(s,i);e>=r.children.length?r.appendChild(c.dom):r.children[e].before(c.dom),this.dispatchComponentEvent("onAddChild",{parent:this,target:c,child:c,index:e}),c.dispatchComponentEvent("onAdd",{parent:this,target:c,index:e,addedVia:"addChild"}),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(Oi)||(t=t.parentElement);const r=Qo(t),s=Qo(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=zc(this.dom);return()=>this.parent.addChild(t,e+1)}],[2,t=>()=>this.parent.parent.addChild(t)]]),l={controls:async()=>{if(!Bd){const{default:t}=await Promise.resolve().then((()=>fu));Bd=t}const{controlData:{meta:{id:t},...e}}=Bd.get(n.id);ms(e,"config.controlId",t);const i=t.startsWith("layout-")?t.replace(/^layout-/,""):"field",r=ps({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)();td.remove(n);return s(e,o)},row:()=>{const t=(a.get({stage:-1,row:0,column:1}[s])||ci)();return null==t?void 0:t({id:n.id},o)},column:()=>{const t=(a.get({stage:-2,row:-1}[s])||ci)();return null==t?void 0:t(n.id)}},c=null==(i=l[r])?void 0:i.call(l,n,o);return this.dispatchComponentEvent("onAdd",{from:t,to:e,item:n,newIndex:o,fromType:r,toType:s,addedComponent:c,addedVia:"dragDrop"}),(()=>{this.saveChildOrder(),this.removeClasses("empty")})(),c}onRemove({from:{parentElement:t}}){return t.classList.contains(Ni)&&t.classList.remove("column-editing-field"),"stage"===this.name||this.children.length?(this.emptyClass(),this.saveChildOrder()):this.remove()}onRender(){this.dispatchComponentEvent("onRender",{dom:this.dom});const{events:t}=this.config;if(!t)return null;t.onRender&&td.onRender(this.dom,t.onRender)}set config(t){const e=ps(t,"all"),n=ps(this.data,"config.controlId"),o=[e,n&&ps(t,n),ps(t,this.id)].reduce(((t,e)=>e?ni(t,e):t),this.configVal);this.configVal=o}get config(){return this.configVal}getComponent(t){const[e,n]=t.split("."),o=Au[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===Fi.row}get isColumn(){return this.name===Fi.column}get isField(){return this.name===Fi.field}get editWindow(){const t={className:["component-edit",`${this.name}-edit`,"slide-toggle","formeo-panels-wrap"]},e=this.editPanels.size;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.querySelector(".edit-toggle"),e=this.dom.querySelector(`.${this.name}-actions`),n=e.getElementsByTagName("button");e.style.maxWidth=n.length*n[0].clientWidth+"px",td.remove(t)}else this.resizePanelWrap()}},td.create(t)}}class qd{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=td.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(`.${Ai}`);if(this.validateResizeTarget(e,n))if(this.startX="touchstart"===t.type?t.touches[0].clientX:t.clientX,o.classList.add(ki),this.columnPreset=o.querySelector(`.${ji}`),this.originalColumnClass=e.className,this.originalSiblingClass=n.className,e.className=e.className.replace(br,""),n.className=n.className.replace(br,""),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(ii(e,this.rowWidth)),i=parseFloat(ii(n,this.rowWidth));return o<10||i<10?null:{colWidth:ri(o.toFixed(1)),siblingColWidth:ri(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(),Au.setAddress(`columns.${t.id}.config.width`,t.dataset.colWidth),Au.setAddress(`columns.${e.id}.config.width`,e.dataset.colWidth),this.row.classList.remove(ki),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(ki),window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onStop)}setCustomWidthValue(){const t=this.columnPreset;let e=t.querySelector(`.${Pi}`);const n=this.row.querySelector(".children").children,o=Vc(n,(t=>ii(t.clientWidth,this.rowWidth).toFixed(1))),i=o.join(","),r=o.join(" | ");return e||(e=td.create({tag:"option",attrs:{className:Pi,value:i,selected:!0},content:r}),t.append(e)),e.value=i,e.textContent=r,i}}const Vd=t=>({className:"resize-x-handle",action:{pointerdown:t.onStart.bind(t)},content:[td.icon("triangle-down"),td.icon("triangle-up")]}),Hd=()=>({className:"column-edit group-config"});class Xd extends Ud{constructor(t){super("column",{...Object.freeze({config:{width:"100%"},children:[],className:[Ni]}),...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=td.create({tag:"li",className:[Ni,"empty"],dataset:{hoverTag:r.get("column")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),Hd(),Vd(new qd),e]}),this.processConfig(),ku.columnResized=new window.CustomEvent("columnResized",{detail:{column:this.dom,instance:this}}),yc.create(e,{animation:150,fallbackClass:"field-moving",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:`.${Ti}`,handle:".item-move"})}processConfig(){const t=Zc.get(this.data,"config.width");t&&this.setDomWidth(t)}}const Yd={actionButtons:{buttons:["clone","move","remove"],disabled:[]}};const Gd=new class extends Ia{constructor(t){super("columns",t),this.config={all:Yd}}Component(t){return new Xd(t)}};class Zd extends Ud{constructor(t){super("row",{...Object.freeze({config:{fieldset:!1,legend:"",inputGroup:!1},children:[],className:[Ai]}),...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(br);const t=n.dom,o=ri(e);n.set("config.width",o),t.style.width=o,t.dataset.colWidth=o;const i=setTimeout((()=>{clearTimeout(i),n.refreshFieldPanels()}),nr);document.dispatchEvent(ku.columnResized)}this.updateColumnPreset()})),n(this,"updateColumnPreset",(()=>{this.columnPresetControl.innerHTML="";const t=this.getColumnPresetOptions.map((({label:t,...e})=>td.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=td.create({tag:"li",className:[Ai,"empty"],dataset:{hoverTag:r.get("row"),editingHoverTag:r.get("editing.row")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),this.editWindow,e]}),yc.create(e,{animation:150,fallbackClass:"column-moving",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:`.${Ni}`,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=td.formGroup([t,n]),i={tag:"label",content:r.get("defineColumnWidths"),className:"col-sm-4 form-control-label"};this.columnPresetControl=td.create(this.columnPresetControlConfig);const s={className:"col-sm-8",content:this.columnPresetControl,action:{onRender:()=>{this.updateColumnPreset()}}},a=[e,"hr",o,"hr",td.formGroup([i,s],"row")];return td.create({className:`${this.name}-edit group-config`,action:{onRender:t=>{const e=a.map((t=>td.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=Ki.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:Pi}),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:ji},action:{change:({target:t})=>{const{value:e}=t;this.setColumnWidths(e)}},options:this.getColumnPresetOptions}}}const Jd={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]}};const Kd=new class extends Ia{constructor(t){super("rows",t),this.config={all:Jd}}Component(t){return new Zd(t)}};class Qd extends Ud{constructor(t){super("stage",{conditions:[gr()],children:[],...t}),this.updateEditPanels(),this.debouncedUpdateEditPanels=li(this.updateEditPanels),r.get("Untitled Form"),r.get("Untitled Form"),r.get("Form Title"),r.get("Form novalidate"),r.get("Tags");const e=this.createChildWrap();this.dom=td.create({attrs:{className:[_i,"empty"],id:this.id},children:[this.getComponentTag(),this.getActionButtons(),this.editWindow,e]}),yc.create(e,{animation:150,fallbackClass:"row-moving",group:{name:"stage",pull:!0,put:["row","column","controls"]},sort:!0,disabled:!1,onAdd:this.onAdd.bind(this),onRemove:this.onRemove.bind(this),onStart:()=>{tu.active=this},onSort:this.onSort.bind(this),draggable:`.${Ai}`,handle:".item-move"})}empty(t=!0){return new Promise((e=>{t?(this.dom.classList.add("removing-all-fields"),Fc.slideUp(this.dom,er,(()=>{e(super.empty(t)),this.dom.classList.remove("removing-all-fields"),Fc.slideDown(this.dom,er)}))):e(super.empty())}))}onAdd(...t){const e=super.onAdd(...t);e&&"column"===e.name&&e.parent.autoColumnWidths()}}const tu=new class extends Ia{constructor(t){super("stages",t),this.config={all:{actionButtons:{buttons:["edit"],disabled:[]},panels:{disabled:[],order:["attrs","options","conditions"]}}}}Component(t){return new Qd(t)}},eu={js:new Set,css:new Set},nu=(t,e,n=di)=>new Promise((o=>fetch(t).then((t=>{if(!t.ok)return o(n(t));o(e?e(t):t)})).catch((t=>n(t))))),ou=(t,e)=>{t.removeEventListener("load",ou),e(t.src)},iu=(t,e)=>{t.removeEventListener("load",iu),e(t.src)},ru=t=>new Promise(((e,n)=>{if(eu.js.has(t))return e(t);eu.js.add(t);const o=td.create({tag:"script",attrs:{type:"text/javascript",async:!0,src:t},action:{load:()=>iu(o,e),error:()=>n(new Error(`${t} failed to load.`))}});document.head.appendChild(o)})),su=t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>new Promise(((e,n)=>{if(eu.css.has(t))return e(t);eu.css.add(t);const o=td.create({tag:"link",attrs:{rel:"stylesheet",href:t},action:{load:()=>ou(o,e),error:()=>n(new Error(`${(void 0).src} failed to load.`))}});document.head.appendChild(o)}))));return Promise.all(e)},au=async(t=Ci)=>{if(document.getElementById(vi))return;const e=async t=>(t=>{let e=document.getElementById(vi);return e||(e=td.create({id:vi,children:t,attrs:{hidden:!0,style:"display: none;"}}),document.body.insertBefore(e,document.body.childNodes[0])),e})(await t.text());return nu(t,e,(()=>nu(Ei,e)))},lu={js:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>ru(t)));return Promise.all(e)},css:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>su(t)));return Promise.all(e)}},cu=t=>{const e=Object.entries(t).map((([t,e])=>lu[t](e)));return Promise.all(e)},du=()=>{const t=document.getElementById(vi);return"hidden"===window.getComputedStyle(t).visibility};class uu{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||ei()}get controlId(){var t,e;return(null==(t=this.controlData.meta)?void 0:t.id)||(null==(e=this.controlData.config)?void 0:e.controlId)}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:td.icon(t.icon)},{tag:"span",className:"control-label",content:n}],action:{focus:({target:t})=>{const e=t.closest(`.${Oi}`);return e&&mu.panels.nav.refresh(zc(e))},click:({target:t})=>{var e;const n=null==(e=t.closest(".field-control"))?void 0:e.id;n&&mu.addElement(n)}}};return td.create({tag:"li",id:this.id,className:["field-control",`${t.group}-control`,`${t.id}-control`],content:o,meta:t,action:this.controlAction})}promise(){return cu(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 hu=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"}});let pu=class{constructor(){n(this,"groupLabel",(t=>r.get(t)||t||"")),n(this,"layoutTypes",{row:()=>tu.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}=ps(this.get(t),"controlData");return ms(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}=ni(hu,t);this.container=e,this.groupOrder=ti(o.concat(["common","html","layout"])),this.options=i;const[r,s,a]=await Promise.all([Promise.resolve().then((()=>th)),Promise.resolve().then((()=>ih)),Promise.resolve().then((()=>lh))]),l=[r.default,s.default,a.default].flat();return Promise.all(this.registerControls([...l,...n]))})),this.data=new Map,this.buttonActions={focus:({target:t})=>{const e=t.closest(`.${Oi}`);return e&&this.panels.nav.refresh(zc(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((t=>{const e="function"==typeof t?new t:new uu(t);return 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=Uc(t,this.groupOrder,"id"),t=t.filter((t=>Ko(t.id,this.options.disable.groups))),n=t.map((t=>{const n={tag:"ul",attrs:{className:[Oi,Si],id:`${t.id}-${Oi}`},config:{label:this.groupLabel(t.label)}};if(this.options.elementOrder[t.id]){const e=this.options.elementOrder[t.id],n=ti(e.concat(t.elementOrder));t.elementOrder=n}return e=Uc(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=[Ko(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=oi(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 oi(this.data.get(t))}formActions(){if(!0===this.options.disable.formActions)return null;const t={...td.btnTemplate({content:[td.icon("bin"),r.get("clear")],title:r.get("clearAll")}),className:["clear-form"],action:{click:t=>{Kd.size?(ku.confirmClearAll=new window.CustomEvent("confirmClearAll",{detail:{confirmationMessage:r.get("confirmClearAll"),clearAllAction:()=>{tu.clearAll().then((()=>{const e={src:t.target};ku.formeoCleared(e)}))},btnCoords:td.coords(t.target)}}),document.dispatchEvent(ku.confirmClearAll)):window.alert(r.get("cannotClearFields"))}}},e={...td.btnTemplate({content:[td.icon("floppy-disk"),r.get("save")],title:r.get("save")}),className:["save-form"],action:{click:async({target:t})=>{const{default:e}=await Promise.resolve().then((()=>Nu)),{formData:n}=e,o={action:()=>{},coords:td.coords(t),message:"",button:t};return Iu.click.btn(o),Iu.save.form(n)}}};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 Fd({panels:e,type:"controls",displayType:o});const i=["control-groups","formeo-panels-wrap",`panel-count-${e.length}`],s=td.create({className:i,content:[this.panels.panelNav,this.panels.panelsWrap]}),a=["formeo-controls"];t&&a.push("formeo-sticky");const l=td.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(td.toggleElementsByStr(n,t),e){const e=r.get("controls.filteringTerm",t);l.classList.add("filtered"),o?o.textContent=e:(o=td.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),yc.create(c[r],{animation:150,forceFallback:!0,fallbackClass:"control-moving",fallbackOnBody:!0,group:{name:"controls",pull:"clone",put:!1},onStart:async({item:t})=>{const{controlData:e}=this.get(t.id);if(this.options.ghostPreview){const{default:n}=await Promise.resolve().then((()=>yu));t.innerHTML="",t.appendChild(new n(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}};const mu=new pu,fu=Object.freeze(Object.defineProperty({__proto__:null,Controls:pu,default:mu},Symbol.toStringTag,{value:"Module"})),gu=new Set(["checkbox","radio"]),vu=new Set(["radio","checkbox","select-one","select-multiple"]);class bu extends Ud{constructor(t=Object.create(null)){super("field",{...t}),n(this,"setData",((t,e)=>super.set(t,e))),n(this,"updatePreview",(()=>{this.updateLabel();const t=this.fieldPreview();this.preview.replaceWith(t),this.preview=t})),this.debouncedUpdateEditPanels=li(this.updateEditPanels),this.debouncedUpdatePreview=li(this.updatePreview),this.label=td.create(this.labelConfig),this.preview=this.fieldPreview(),this.controlId=this.get("config.controlId")||this.get("meta.id");const e=this.getActionButtons(),o=this.actionButtons.some((t=>{var e;return"edit"===(null==(e=t.meta)?void 0:e.id)}));this.updateEditPanels();const i=td.create({tag:"li",attrs:{className:Ti},id:this.id,children:[this.label,this.getComponentTag(),e,o&&this.editWindow,this.preview].filter(Boolean),panelNav:this.panelNav,dataset:{hoverTag:r.get("field")}});this.dom=i,this.isEditing=!1}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}})=>{super.set("config.label",n?e:t)}}},e&&td.requiredMark()]}}set(t,e){const n=this.setData(t,e);return this.debouncedUpdatePreview(),n}updateLabel(){if(!this.label)return null;const t=td.create(this.labelConfig);this.label.replaceWith(t),this.label=t}get defaultPreviewActions(){return{change:t=>{var e;const{target:n}=t,{type:o}=n;if(vu.has(o)){const t=this.preview.querySelectorAll(":checked"),n=this.get("options"),o=void 0!==(null==(e=null==n?void 0:n[0])?void 0:e.selected)?"selected":"checked",i=n.reduce(((t,e)=>(t[e.value]=e,t[e.value][o]=!1,t)),{});for(const e of t)i[e.value][o]=e.value===i[e.value].value;return super.set("options",Object.values(i)),this.debouncedUpdateEditPanels()}},click:t=>{"true"===t.target.contentEditable&&t.preventDefault()},input:({target:t})=>{var e;if(["input","meter","progress","button"].includes(t.tagName.toLowerCase()))return super.set("attrs.value",t.value),this.debouncedUpdateEditPanels();if(t.contentEditable&&!(null==(e=t.type)?void 0:e.startsWith("select-"))){const e=t.parentElement.classList;if(e.contains("f-checkbox")||e.contains("f-radio")){const e=t.parentElement,n=zc(e);return this.setData(`options[${n}].label`,t.innerHTML),this.debouncedUpdateEditPanels()}this.setData("content",t.innerHTML||t.value)}}}}fieldPreview(){var t;const{action:e={},...n}=oi(this.data);n.id=`prev-${this.id}`,n.action=Object.entries(e).reduce(((t,[e,n])=>(t[e]=n.bind(this),t)),{}),(null==(t=this.data)?void 0:t.config.editableContent)&&(n.attrs={...n.attrs,contenteditable:!0});const o={attrs:{className:"field-preview",style:this.isEditing&&"display: none;"},content:td.create(n,!0),action:this.defaultPreviewActions};return td.create(o,!0)}get isCheckable(){return gu.has(this.get("config.controlId"))}}const yu=Object.freeze(Object.defineProperty({__proto__:null,default:bu},Symbol.toStringTag,{value:"Module"}));const wu=new class extends Ia{constructor(t){super("fields",t),n(this,"get",(t=>{let e=t&&ps(this.data,t);if(!e){const n=mu.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)}t&&(i.conditions=o)}return t[e]=i,t}),{}))),n(this,"load",((t=Object.create(null))=>{const e=ui(t);this.empty();for(const[n,o]of Object.entries(e)){const{meta:t,...e}=o;(null==t?void 0:t.id)&&ms(e,"config.controlId",null==t?void 0:t.id),this.add(n,e)}return this.data})),this.config={all:{actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]},panels:{disabled:[],attrs:{disabled:["type"],hideDisabled:!0,locked:[]},order:["attrs","options","conditions"]},label:{disableHTML:!1}}}}Component(t){return new bu(t)}},Cu=tu,Eu=Kd,xu=Gd,Su=wu,Ou=mu;class _u extends $a{constructor(){super("components"),n(this,"load",((t,e)=>{this.empty();const n=((t,e=!1)=>t?oi(ui(t)):e&&si.get(Qi)||wr())(t,e.sessionStorage);this.opts=e,this.set("id",n.id),this.add("stages",Cu.load(n.stages)),this.add("rows",Eu.load(n.rows)),this.add("columns",xu.load(n.columns)),this.add("fields",Su.load(n.fields));for(const o of Object.values(this.get("stages")))o.loadChildren();return this.data})),n(this,"getChildData",(({type:t,id:e})=>{const n=this.get(t,e);if(n)return n.getData()})),this.disableEvents=!0,this.stages=Cu,this.rows=Eu,this.columns=xu,this.fields=Su,this.controls=Ou}flatList(){const t={};for(const e of Object.keys(this.data.stages))pi(this.data,e,"stages",t);return t}get json(){return window.JSON.stringify({$schema:`https://cdn.jsdelivr.net/npm/formeo@${fi}/dist/formData_schema.json`,...this.formData})}get formData(){return{id:this.get("id"),stages:tu.getData(),rows:Kd.getData(),columns:Gd.getData(),fields:wu.getData()}}set config(t){const{stages:e,rows:n,columns:o,fields:i}=t;Cu.config=e,Eu.config=n,xu.config=o,Su.config=i}getIndex(t){return this[t]||this[Wi.get(t)]}setAddress(t,e){if(!ai(t))return;const[n,o,...i]=Array.isArray(t)?t:Nr(t),r=this.getIndex(n).get(o);return null==r||r.set(i,e),r}getAddress(t){if(!ai(t))return;const[e,n,...o]=Array.isArray(t)?t:Nr(t),i=this.getIndex(e).get(n);return!o.length||i?o.length?i.get(o):i:void 0}}const Au=new _u,Nu=Object.freeze(Object.defineProperty({__proto__:null,Columns:xu,Components:_u,Controls:Ou,Fields:Su,Rows:Eu,Stages:Cu,default:Au},Symbol.toStringTag,{value:"Module"})),Tu="no-transition",Pu={debug:!1,bubbles:!0,formeoLoaded:t=>{},onAdd:()=>{},onChange:(...t)=>Pu.onUpdate(...t),onUpdate:t=>{var e;return(null==(e=ku.opts)?void 0:e.debug)&&void 0},onUpdateStage:t=>{var e;return(null==(e=ku.opts)?void 0:e.debug)&&void 0},onUpdateRow:t=>{var e;return(null==(e=ku.opts)?void 0:e.debug)&&void 0},onUpdateColumn:t=>{var e;return(null==(e=ku.opts)?void 0:e.debug)&&void 0},onUpdateField:t=>{var e;return(null==(e=ku.opts)?void 0:e.debug)&&void 0},onRender:t=>{var e;return(null==(e=ku.opts)?void 0:e.debug)&&void 0},onSave:t=>{},confirmClearAll:t=>{window.confirm(t.confirmationMessage)&&t.clearAllAction(t)}},ju=({src:t,...e},n=rr)=>{var o,i;const r=new window.CustomEvent(n,{detail:e,bubbles:(null==(o=ku.opts)?void 0:o.debug)||(null==(i=ku.opts)?void 0:i.bubbles)});return r.data=(t||document).dispatchEvent(r),r},ku={init:function(t){return this.opts={...Pu,...t},this},formeoSaved:t=>ju(t,ir),formeoUpdated:t=>ju(t,rr),formeoCleared:t=>ju(t,"formeoCleared"),formeoOnRender:t=>ju(t,sr),formeoConditionUpdated:t=>ju(t,"formeoConditionUpdated")},Du=function(t,e=or){let n=0;return function(...o){const i=Date.now();i-n>=e&&(n=i,t.apply(this,o))}}((()=>{ku.opts.onUpdate({timeStamp:window.performance.now(),type:rr,detail:Au.formData})}),nr);let Lu;document.addEventListener(rr,Du),document.addEventListener("formeoUpdatedStage",(t=>{const{timeStamp:e,type:n,detail:o}=t;ku.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedRow",(t=>{const{timeStamp:e,type:n,detail:o}=t;ku.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedColumn",(t=>{const{timeStamp:e,type:n,detail:o}=t;ku.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedField",(t=>{const{timeStamp:e,type:n,detail:o}=t;ku.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener(sr,(t=>{const{timeStamp:e,type:n,detail:o}=t;ku.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},ku.opts.confirmClearAll(t)})),document.addEventListener(ir,(({timeStamp:t,type:e,detail:{formData:n}})=>{const o={timeStamp:t,type:e,formData:n};ku.opts.onSave(o)})),document.addEventListener("formeoLoaded",(t=>{ku.opts.formeoLoaded(t.detail.formeo)})),window.addEventListener("resize",(function(){Lu=Lu||window.requestAnimationFrame((()=>{Lu=!1;for(const t of Object.values(xu.data))t.dom.classList.add(Tu),Ou.dom.classList.add(Tu),Ou.panels.nav.refresh(),t.refreshFieldPanels()}))}));const $u={add:{attr:t=>{const e=window.prompt(t.message.attr);if(e&&t.isDisabled(e))return window.alert(r.get("attributeNotPermitted",e||"")),Iu.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)}},remove:{attrs:t=>{t.removeAction()},options:t=>{t.removeAction()},conditions:t=>{t.removeAction()}},click:{btn:t=>{t.action()}},save:{form:ci}},Iu={init:function(t){const e=Object.keys($u);return this.opts=e.reduce(((e,n)=>(e[n]={...$u[n],...t[n]},e)),t),this},add:{attrs:t=>Iu.opts.add.attr(t),options:t=>Iu.opts.add.option(t),conditions:t=>(t.template=t.template||gr(),Iu.opts.add.condition(t))},remove:{attrs:t=>Iu.opts.remove.attrs(t),options:t=>Iu.opts.remove.options(t),conditions:t=>Iu.opts.remove.conditions(t)},click:{btn:t=>Iu.opts.click.btn(t)},save:{form:t=>(Iu.opts.sessionStorage&&si.set(Qi,t),ku.formeoSaved({formData:t}),Iu.opts.save.form(t))}};r.addLanguage("en-US",void 0);const Mu={get editor(){return{stickyControls:!1,allowEdit:!0,dataType:"json",debug:!1,sessionStorage:!1,editorContainer:null,svgSprite:Ci,style:xi,iconFont:null,config:{},events:{},actions:{},controls:{},polyfills:Gc(),i18n:{location:"https://draggable.github.io/formeo/assets/lang/"},onLoad:()=>{}}}};let Ru=class{constructor({formData:t,...e},n){const o=ni(Mu.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,td.setOptions=c,Au.config=a,this.userFormData=n||t,this.Components=Au,this.dom=td,ku.init({debug:s,...r}),Iu.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=hi(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)?bi.filter((({name:e})=>-1!==t.indexOf(e))):bi;Promise.all(e.map((({src:t})=>ru(t))))})(this.opts.polyfills),await au(this.opts.svgSprite),e.push((async t=>{if(!du()&&(await su(t),!du()))return await su("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(tr)}));const n=await Promise.all(e);return this.opts.allowEdit&&this.init(),n}init(){return mu.init(this.opts.controls,this.opts.stickyControls).then((t=>{var e,n;this.controls=t,this.load(this.userFormData,this.opts),this.formId=Au.get("id"),this.i18n={setLang:t=>{var e;null==(e=window.sessionStorage)||e.setItem(tr,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(Au.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,td.dir=r.current.dir),this.editor=td.create(t);(this.controls.container||this.editor).appendChild(this.controls.dom),this.editorContainer&&(td.empty(this.editorContainer),this.editorContainer.appendChild(this.editor)),ku.formeoLoaded=new window.CustomEvent("formeoLoaded",{detail:{formeo:this}}),document.dispatchEvent(ku.formeoLoaded)}};const Wu="f-",Fu=t=>"string"==typeof t?document.querySelector(t):t,Bu=t=>{const e=t.match(vr);return(null==e?void 0:e[0])||t``},zu=t=>{if(!t)return!1;if(t.hasAttribute("hidden")||t.parentElement.hasAttribute("hidden"))return!1;const e=window.getComputedStyle(t);return!("none"===e.display||"hidden"===e.visibility||"0"===e.opacity)},Uu={isChecked:t=>t.checked,isNotChecked:t=>!t.checked,value:t=>t.value,isVisible:t=>zu(t),isNotVisible:t=>!zu(t)},qu={equals:Da,notEquals:(t,e)=>!Da(t,e),contains:(t,e)=>t.includes(e),notContains:(t,e)=>!t.includes(e)},Vu=Object.entries(ar).reduce(((t,[e,n])=>(t[n]=qu[e],t[e]=qu[e],t)),{}),Hu={equals:(t,{targetProperty:e,value:n})=>{t[`_${e}`]=t[e],t[e]=n}},Xu=Object.entries(lr).reduce(((t,[e,n])=>(t[n]=Hu[e],t[e]=Hu[e],t)),{}),Yu={isChecked:t=>{t.checked=!0},isNotChecked:t=>{t.checked=!1},value:(t,{assignment:e,...n})=>{var o;const i=null==(o=Xu[e])?void 0:o.call(Xu,t,n),r=new Event("input",{bubbles:!0});return t.dispatchEvent(r),i},isNotVisible:t=>{void 0===(null==t?void 0:t._required)&&(t._required=t.required),t.parentElement.setAttribute("hidden",!0),t.required=!1},isVisible:t=>{t.parentElement.removeAttribute("hidden"),t.required=t._required}};let Gu=class{constructor(t,e){n(this,"orderChildren",((t,e)=>e.reduce(((e,n)=>(e.push(this.form[t][n]),e)),[]))),n(this,"prefixId",(t=>Wu+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[Bu(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(`${Wu}input-group-wrap`),{tag:n.fieldset?"fieldset":"div",className:i,children:s}})),n(this,"cloneComponentData",(t=>{const{children:e=[],id:n,...o}=this.components[t];return{...o,id:ei(n),children:(null==e?void 0:e.length)&&e.map((({id:t})=>this.cloneComponentData(Bu(t))))}})),n(this,"addButton",(t=>({tag:"button",attrs:{className:"add-input-group btn pull-right",type:"button"},children:"Add +",action:{click:e=>{const n=e.target.parentElement,o=td.create(this.cloneComponentData(t));n.insertBefore(o,n.lastChild);const i=td.create(td.btnTemplate({className:"remove-input-group",children:td.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()}}));o.appendChild(i)}}}))),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&&cu(s);const a=ni({action:r},e);return this.cacheComponent({...a,id:this.prefixId(t)})})))),n(this,"handleComponentCondition",((t,e,n)=>{if(t.length){for(const o of t)this.handleComponentCondition(o,e,n);return}const o=Zu(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,target:o}=e;if(ai(t)){const{component:o,options:i}=this.getComponent(t),r=i||o;this.handleComponentCondition(r,e,n)}if(ai(o)){const{component:t,options:i}=this.getComponent(o),r=i||t;this.handleComponentCondition(r,e,n)}}}})),n(this,"evaluateCondition",(({source:t,sourceProperty:e,targetProperty:n,comparison:o,target:i})=>{var r;const s=this.getComponentProperty(t,e);if("boolean"==typeof s)return s;const a=String(ai(i)?this.getComponentProperty(i,n):i);return null==(r=Vu[o])?void 0:r.call(Vu,s,a)})),n(this,"execResult",(({target:t,targetProperty:e,assignment:n,value:o})=>{var i;if(ai(t)){const{component:r,option:s}=this.getComponent(t),a=s||r;null==(i=Yu[e])||i.call(Yu,a,{targetProperty:e,assignment:n,value:o})}})),n(this,"getComponentProperty",((t,e)=>{var n;const{component:o,option:i}=this.getComponent(t),r=i||o;return(null==(n=Uu[e])?void 0:n.call(Uu,r))||r[e]})),n(this,"getComponent",(t=>{const e={component:null};if(!ai(t))return null;const[,n,o,i]=Nr(t),r=this.renderedForm.querySelector(`#${Wu}${n}`);if(!r)return e;if(e.component=r,o){const t=r.querySelectorAll("input"),n=t[i];return e.options=t,e.option=n,e}return e})),n(this,"getComponents",(t=>{const e=[],n=t.slice(t.indexOf(".")+1);return e.push(...this.renderedForm.querySelectorAll(`[name=f-${n}]`)),e}));const{renderContainer:o,elements:i,formData:r}=(({editorContainer:t,renderContainer:e,formData:n,...o})=>({elements:{},...o,renderContainer:Fu(e),editorContainer:Fu(t),formData:hi(n)}))(t);this.container=o,this.form=hi(e||r),this.dom=td,this.components=Object.create(null),this.elements=i}get formData(){return this.form}set formData(t){this.form=hi(t)}get userData(){const t=new FormData(this.renderedForm),e={};for(const[n,o]of t.entries())e[n]?Array.isArray(e[n])?e[n].push(o):e[n]=[e[n],o]:e[n]=o;return e}set userData(t={}){const e=this.container.querySelector("form");for(const n of Object.keys(t)){const o=e.elements[n];if(o.length&&"checkbox"===o[0].type){const e=Array.isArray(t[n])?t[n]:[t[n]];for(const t of o)t.checked=e.includes(t.value)}else if(o.length&&"radio"===o[0].type)for(const e of o)e.checked=e.value===t[n];else o.type&&(o.value=t[n])}}render(t=this.form){const e=this.getRenderedForm(t),n=this.container.querySelector(".formeo-render");n?n.replaceWith(e):this.container.appendChild(e)}getRenderedForm(t=this.form){this.form=hi(t);const e=document.getElementsByClassName("formeo-render").length,n={tag:"form",id:this.form.id,className:`formeo-render formeo formeo-rendered-${e}`,children:this.processedData};return this.renderedForm=td.render(n),this.applyConditions(),this.renderedForm}get html(){return(this.renderedForm||this.getRenderedForm()).outerHTML}get processedData(){return Object.values(this.form.stages).map((t=>(t.children=this.processRows(t.id),t.className=_i,this.components[Bu(t.id)]=t,t)))}};const Zu=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=Ru,window.FormeoRenderer=Gu);const Ju=Ru,Ku=Gu,Qu=[{config:{label:"row"},meta:{group:"layout",icon:"rows",id:"layout-row"}},{config:{label:"column"},meta:{group:"layout",icon:"columns",id:"layout-column"}}],th=Object.freeze(Object.defineProperty({__proto__:null,default:Qu},Symbol.toStringTag,{value:"Module"})),eh=["button","submit","reset"].map((t=>({label:t,value:t})));eh[0].selected=!0;const nh=({type:t,isMultiple:e=!1,count:n=3})=>Array.from({length:n},((t,e)=>e+1)).map((n=>{const o="checkbox"===t||e?"checked":"selected";return{label:r.get("labelCount",{label:_r(t),count:n}),value:`${t}-${n}`,[o]:!n}}));const oh=[class extends uu{constructor(t={}){const e={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:eh,className:[{label:"default",value:"",selected:!0},{label:"primary",value:"primary"},{label:"danger",value:"error"},{label:"success",value:"success"},{label:"warning",value:"warning"}]}]};super(ni(e,t))}},class extends uu{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 uu{constructor(){super({tag:"input",attrs:{type:"hidden",value:""},config:{label:r.get("hidden"),hideLabel:!0},meta:{group:"common",icon:"hidden",id:"hidden"}})}},class extends uu{constructor(){super({tag:"input",attrs:{type:"number",required:!1,className:""},config:{label:r.get("number")},meta:{group:"common",icon:"hash",id:"number"}})}},class extends uu{constructor(){super({tag:"textarea",config:{label:r.get("controls.form.textarea")},meta:{group:"common",icon:"textarea",id:"textarea"},attrs:{required:!1}})}},class extends uu{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 uu{constructor(){super({tag:"input",attrs:{type:"file",required:!1},config:{label:r.get("fileUpload")},meta:{group:"common",icon:"upload",id:"upload"}})}},class extends uu{constructor(t={}){var e;const n={tag:"select",config:{label:r.get("controls.form.select")},attrs:{required:!1,className:"",multiple:!1},meta:{group:"common",icon:"select",id:"select"},options:nh({type:"option",isMultiple:null==(e=t.attrs)?void 0:e.multiple})};super(ni(n,t))}},class extends uu{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:nh({type:"checkbox",count:1})})}},class extends uu{constructor(){super({tag:"input",attrs:{type:"radio",required:!1},config:{label:r.get("controls.form.radio-group"),disabled:["attrs.type"]},meta:{group:"common",icon:"radio-group",id:"radio"},options:nh({type:"radio"})})}}],ih=Object.freeze(Object.defineProperty({__proto__:null,default:oh},Symbol.toStringTag,{value:"Module"})),rh=Array.from(Array(5).keys()).slice(1).map((t=>`h${t}`)),sh="controls.html.header";const ah=[class extends uu{constructor(){super({tag:rh[0],attrs:{tag:rh.map(((t,e)=>({label:t.toUpperCase(),value:t,selected:!e}))),className:""},config:{label:r.get(sh),hideLabel:!0,editableContent:!0},meta:{group:"html",icon:"header",id:"html.header"},content:r.get(sh),action:{}})}static get definition(){return{i18n:{"en-US":{header:"Custom English Header"}}}}get content(){return super.i18n(sh)}},class extends uu{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 uu{constructor(){super({tag:"hr",config:{label:r.get("controls.html.divider"),hideLabel:!0},meta:{group:"html",icon:"divider",id:"divider"}})}},class extends uu{constructor(t){super(ni({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))}}],lh=Object.freeze(Object.defineProperty({__proto__:null,default:ah},Symbol.toStringTag,{value:"Module"}));exports.FormeoEditor=Ju,exports.FormeoRenderer=Ku;
|