formeo 3.1.4 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/demo/assets/css/demo.min.css +2 -2
- package/dist/demo/assets/css/demo.min.css.gz +0 -0
- package/dist/demo/assets/css/formeo.min.css +2 -2
- package/dist/demo/assets/img/formeo-sprite.svg +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 +6268 -5490
- package/dist/demo/assets/js/formeo.es.js +5375 -4595
- package/dist/demo/assets/js/formeo.min.cjs.js +3 -3
- package/dist/demo/assets/js/formeo.min.es.js +5375 -4595
- package/dist/demo/assets/js/formeo.min.js +6269 -5491
- package/dist/demo/assets/js/formeo.min.umd.js +3 -3
- package/dist/demo/assets/js/formeo.umd.js +6269 -5491
- package/dist/demo/assets/js/index.min.js +1 -1
- package/dist/demo/assets/js/index.min2.js +2 -2
- 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/assets/lang/af-ZA.json +1 -1
- package/dist/demo/assets/lang/af-ZA.lang +9 -0
- package/dist/demo/assets/lang/ar-TN.json +1 -1
- package/dist/demo/assets/lang/ar-TN.lang +9 -0
- package/dist/demo/assets/lang/cs-CZ.json +1 -1
- package/dist/demo/assets/lang/cs-CZ.lang +9 -0
- package/dist/demo/assets/lang/de-DE.json +1 -1
- package/dist/demo/assets/lang/de-DE.lang +9 -0
- package/dist/demo/assets/lang/en-US.json +1 -1
- package/dist/demo/assets/lang/en-US.lang +6 -1
- package/dist/demo/assets/lang/es-ES.json +1 -1
- package/dist/demo/assets/lang/es-ES.lang +9 -0
- package/dist/demo/assets/lang/fa-IR.json +1 -1
- package/dist/demo/assets/lang/fa-IR.lang +9 -0
- package/dist/demo/assets/lang/fi-FI.json +1 -1
- package/dist/demo/assets/lang/fi-FI.lang +9 -0
- package/dist/demo/assets/lang/fr-FR.json +1 -1
- package/dist/demo/assets/lang/fr-FR.lang +9 -0
- package/dist/demo/assets/lang/he-IL.json +1 -1
- package/dist/demo/assets/lang/he-IL.lang +5 -0
- package/dist/demo/assets/lang/hi-IN.json +1 -1
- package/dist/demo/assets/lang/hi-IN.lang +7 -0
- package/dist/demo/assets/lang/hu-HU.json +1 -1
- package/dist/demo/assets/lang/hu-HU.lang +9 -0
- package/dist/demo/assets/lang/it-IT.json +1 -1
- package/dist/demo/assets/lang/it-IT.lang +9 -0
- package/dist/demo/assets/lang/ja-JP.json +1 -1
- package/dist/demo/assets/lang/ja-JP.lang +9 -0
- package/dist/demo/assets/lang/nb-NO.json +1 -1
- package/dist/demo/assets/lang/nb-NO.lang +9 -0
- package/dist/demo/assets/lang/pl-PL.json +1 -1
- package/dist/demo/assets/lang/pl-PL.lang +9 -0
- package/dist/demo/assets/lang/pt-BR.json +1 -1
- package/dist/demo/assets/lang/pt-BR.lang +9 -0
- package/dist/demo/assets/lang/pt-PT.json +1 -1
- package/dist/demo/assets/lang/pt-PT.lang +9 -0
- package/dist/demo/assets/lang/ro-RO.json +1 -1
- package/dist/demo/assets/lang/ro-RO.lang +9 -0
- package/dist/demo/assets/lang/ru-RU.json +1 -1
- package/dist/demo/assets/lang/ru-RU.lang +9 -0
- package/dist/demo/assets/lang/th-TH.json +1 -1
- package/dist/demo/assets/lang/th-TH.lang +9 -0
- package/dist/demo/assets/lang/tr-TR.json +1 -1
- package/dist/demo/assets/lang/tr-TR.lang +9 -0
- package/dist/demo/assets/lang/zh-CN.json +1 -1
- package/dist/demo/assets/lang/zh-CN.lang +9 -0
- package/dist/demo/assets/lang/zh-HK.json +1 -1
- package/dist/demo/assets/lang/zh-HK.lang +9 -0
- package/dist/demo/index.html +1 -1
- package/dist/formeo-sprite.svg +1 -1
- package/dist/formeo.cjs.js +6268 -5490
- package/dist/formeo.css +469 -239
- package/dist/formeo.es.js +5375 -4595
- package/dist/formeo.min.cjs.js +3 -3
- package/dist/formeo.min.css +2 -2
- package/dist/formeo.min.es.js +5375 -4595
- package/dist/formeo.min.js +6269 -5491
- package/dist/formeo.min.umd.js +3 -3
- package/dist/formeo.umd.js +6269 -5491
- package/package.json +18 -5
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
formeo - https://formeo.io
|
|
4
|
-
Version:
|
|
4
|
+
Version: 4.0.0
|
|
5
5
|
Author: Draggable https://draggable.io
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).formeo={})}(this,(function(t){"use strict";var e=Object.defineProperty,n=(t,n,o)=>((t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o)(t,"symbol"!=typeof n?n+"":n,o),o="undefined"!=typeof document?document.currentScript:null;const i={extension:".lang",location:"assets/lang/",langs:["en-US"],locale:"en-US",override:{}};class r{constructor(t=i){this.langs=Object.create(null),this.loaded=[],this.processConfig(t)}processConfig(t){const{location:e,...n}={...i,...t},o=e.replace(/\/?$/,"/");this.config={location:o,...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?r.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 r.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,i){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 i=r.processFile(e);return n.applyLanguage(t,i),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 s=new r;!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 a=Object.defineProperty,l=(t,e,n)=>((t,e,n)=>e in t?a(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);const c="_3x4ZIcu-",d="JIt36hCJ",u={triggerName:"tooltip"};class h{constructor(t=u){l(this,"triggerName"),l(this,"tooltip"),l(this,"activeTriggerType",null),l(this,"spacing",12),l(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()})),l(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")}})),l(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()})),l(this,"handleResize",(()=>{this.isVisible()&&this.hide()})),l(this,"handleScroll",(()=>{this.isVisible()&&this.hide()})),this.triggerName=`data-${t.triggerName}`,this.tooltip=document.createElement("div"),this.tooltip.className=`d-tooltip ${c}`,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(d)}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(c)||"none"===getComputedStyle(t).pointerEvents)return!1})).length}show(t,e){this.tooltip.innerHTML=e??"",this.tooltip.classList.add(d);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(d),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=h);const p="formeo",f="3.1.3",{env:m,resolve:g}={url:"undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:o&&"SCRIPT"===o.tagName.toUpperCase()&&o.src||new URL("formeo.min.umd.js",document.baseURI).href},v=p,b=f,y=v,w="formeo-sprite",C=[{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"}],E=`../../lib/icons/${w}.svg`,S="function"==typeof g?g(E):E,x=(null==m?void 0:m.DEV)?S:`https://cdn.jsdelivr.net/npm/formeo@${b}/dist/${w}.svg`,O=`https://draggable.github.io/formeo/assets/img/${w}.svg`,_=`https://cdn.jsdelivr.net/npm/formeo@${b}/dist/formeo.min.css`,N="control-group",j=`${y}-stage`,A=`${y}-row`,P=`${y}-column`,T=`${y}-field`,D="custom-column-widths",L="column-preset",$="resizing-columns",k=new Map([[j,A],[A,P],[P,T]]),I=["external","stages","rows","columns","fields"],M=["stage","row","column","field"].reduce(((t,e)=>({...t,[e]:e})),{}),R=[{name:"controls",className:N},{name:"stage",className:j},{name:"row",className:A},{name:"column",className:P},{name:"field",className:T}],F={controls:N,stage:j,row:A,column:P,field:T},W=Object.entries(F).reduce(((t,[e,n])=>({...t,[n]:e})),{}),B=Object.values(F),z=new RegExp(`${B.join("|")}`,"g"),q=R.map((({name:t},e,n)=>{const{name:o}=n[e+1]||{};return o&&[t,o]})).filter(Boolean),U=q.slice().map((t=>t.slice().reverse())).reverse(),H=new Map(q),X=new Map(U.slice()),V=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)),[])),Y=[{type:"added",condition:(t,e)=>Boolean(void 0===t&&e)}],G=`${v}-formData`,Z=`${v}-locale`,J=333,K=Math.round(166.5),Q=Math.round(666),tt="formeoSaved",et="formeoUpdated",nt="formeoOnRender",ot=["label","logical","source","thenTarget","sourceProperty","comparison","target","targetProperty","assignment","value"],it={value:"attrs.value",checked:"attrs.checked",isVisible:"config.isVisible",isNotVisible:"config.isNotVisible"},rt={comparison:{equals:"==",notEquals:"!=",contains:"⊃",notContains:"!⊃"},assignment:{equals:"="},logical:{and:"&&",or:"||"},property:it},st=/(\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b)/gi,at=/\bcol-\w+-\d+/g,lt="f-i-",ct=()=>({id:Qi(),stages:{[Qi()]:{}},rows:{},columns:{},fields:{}});var dt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ut(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ht=function(){this.__data__=[],this.size=0};var pt=function(t,e){return t===e||t!=t&&e!=e},ft=pt;var mt=function(t,e){for(var n=t.length;n--;)if(ft(t[n][0],e))return n;return-1},gt=mt,vt=Array.prototype.splice;var bt=mt;var yt=mt;var wt=mt;var Ct=ht,Et=function(t){var e=this.__data__,n=gt(e,t);return!(n<0)&&(n==e.length-1?e.pop():vt.call(e,n,1),--this.size,!0)},St=function(t){var e=this.__data__,n=bt(e,t);return n<0?void 0:e[n][1]},xt=function(t){return yt(this.__data__,t)>-1},Ot=function(t,e){var n=this.__data__,o=wt(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=Ct,_t.prototype.delete=Et,_t.prototype.get=St,_t.prototype.has=xt,_t.prototype.set=Ot;var Nt=_t,jt=Nt;var At=function(){this.__data__=new jt,this.size=0};var Pt=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n};var Tt=function(t){return this.__data__.get(t)};var Dt=function(t){return this.__data__.has(t)},Lt="object"==typeof dt&&dt&&dt.Object===Object&&dt,$t=Lt,kt="object"==typeof self&&self&&self.Object===Object&&self,It=$t||kt||Function("return this")(),Mt=It.Symbol,Rt=Mt,Ft=Object.prototype,Wt=Ft.hasOwnProperty,Bt=Ft.toString,zt=Rt?Rt.toStringTag:void 0;var qt=function(t){var e=Wt.call(t,zt),n=t[zt];try{t[zt]=void 0;var o=!0}catch(r){}var i=Bt.call(t);return o&&(e?t[zt]=n:delete t[zt]),i},Ut=Object.prototype.toString;var Ht=qt,Xt=function(t){return Ut.call(t)},Vt=Mt?Mt.toStringTag:void 0;var Yt=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Vt&&Vt in Object(t)?Ht(t):Xt(t)};var Gt=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},Zt=Yt,Jt=Gt;var Kt,Qt=function(t){if(!Jt(t))return!1;var e=Zt(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},te=It["__core-js_shared__"],ee=(Kt=/[^.]+$/.exec(te&&te.keys&&te.keys.IE_PROTO||""))?"Symbol(src)_1."+Kt:"";var ne=function(t){return!!ee&&ee in t},oe=Function.prototype.toString;var ie=function(t){if(null!=t){try{return oe.call(t)}catch(e){}try{return t+""}catch(e){}}return""},re=Qt,se=ne,ae=Gt,le=ie,ce=/^\[object .+?Constructor\]$/,de=Function.prototype,ue=Object.prototype,he=de.toString,pe=ue.hasOwnProperty,fe=RegExp("^"+he.call(pe).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var me=function(t){return!(!ae(t)||se(t))&&(re(t)?fe:ce).test(le(t))},ge=function(t,e){return null==t?void 0:t[e]};var ve=function(t,e){var n=ge(t,e);return me(n)?n:void 0},be=ve(It,"Map"),ye=ve(Object,"create"),we=ye;var Ce=function(){this.__data__=we?we(null):{},this.size=0};var Ee=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Se=ye,xe=Object.prototype.hasOwnProperty;var Oe=function(t){var e=this.__data__;if(Se){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return xe.call(e,t)?e[t]:void 0},_e=ye,Ne=Object.prototype.hasOwnProperty;var je=ye;var Ae=Ce,Pe=Ee,Te=Oe,De=function(t){var e=this.__data__;return _e?void 0!==e[t]:Ne.call(e,t)},Le=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=je&&void 0===e?"__lodash_hash_undefined__":e,this};function $e(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}$e.prototype.clear=Ae,$e.prototype.delete=Pe,$e.prototype.get=Te,$e.prototype.has=De,$e.prototype.set=Le;var ke=$e,Ie=Nt,Me=be;var Re=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Fe=function(t,e){var n=t.__data__;return Re(e)?n["string"==typeof e?"string":"hash"]:n.map},We=Fe;var Be=Fe;var ze=Fe;var qe=Fe;var Ue=function(){this.size=0,this.__data__={hash:new ke,map:new(Me||Ie),string:new ke}},He=function(t){var e=We(this,t).delete(t);return this.size-=e?1:0,e},Xe=function(t){return Be(this,t).get(t)},Ve=function(t){return ze(this,t).has(t)},Ye=function(t,e){var n=qe(this,t),o=n.size;return n.set(t,e),this.size+=n.size==o?0:1,this};function Ge(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])}}Ge.prototype.clear=Ue,Ge.prototype.delete=He,Ge.prototype.get=Xe,Ge.prototype.has=Ve,Ge.prototype.set=Ye;var Ze=Ge,Je=Nt,Ke=be,Qe=Ze;var tn=Nt,en=At,nn=Pt,on=Tt,rn=Dt,sn=function(t,e){var n=this.__data__;if(n instanceof Je){var o=n.__data__;if(!Ke||o.length<199)return o.push([t,e]),this.size=++n.size,this;n=this.__data__=new Qe(o)}return n.set(t,e),this.size=n.size,this};function an(t){var e=this.__data__=new tn(t);this.size=e.size}an.prototype.clear=en,an.prototype.delete=nn,an.prototype.get=on,an.prototype.has=rn,an.prototype.set=sn;var ln=an,cn=ve,dn=function(){try{var t=cn(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),un=dn;var hn=function(t,e,n){"__proto__"==e&&un?un(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n},pn=hn,fn=pt;var mn=function(t,e,n){(void 0!==n&&!fn(t[e],n)||void 0===n&&!(e in t))&&pn(t,e,n)};var gn,vn,bn,yn,wn,Cn,En,Sn=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}}(),xn={exports:{}};gn=xn,bn=It,yn=(vn=xn.exports)&&!vn.nodeType&&vn,wn=yn&&gn&&!gn.nodeType&&gn,Cn=wn&&wn.exports===yn?bn.Buffer:void 0,En=Cn?Cn.allocUnsafe:void 0,gn.exports=function(t,e){if(e)return t.slice();var n=t.length,o=En?En(n):new t.constructor(n);return t.copy(o),o};var On=xn.exports,_n=It.Uint8Array,Nn=_n;var jn=function(t){var e=new t.constructor(t.byteLength);return new Nn(e).set(new Nn(t)),e};var An=function(t,e){var n=e?jn(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)};var Pn=function(t,e){var n=-1,o=t.length;for(e||(e=Array(o));++n<o;)e[n]=t[n];return e},Tn=Gt,Dn=Object.create,Ln=function(){function t(){}return function(e){if(!Tn(e))return{};if(Dn)return Dn(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();var $n=function(t,e){return function(n){return t(e(n))}},kn=$n(Object.getPrototypeOf,Object),In=Object.prototype;var Mn=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||In)},Rn=Ln,Fn=kn,Wn=Mn;var Bn=function(t){return"function"!=typeof t.constructor||Wn(t)?{}:Rn(Fn(t))};var zn=function(t){return null!=t&&"object"==typeof t},qn=Yt,Un=zn;var Hn=function(t){return Un(t)&&"[object Arguments]"==qn(t)},Xn=zn,Vn=Object.prototype,Yn=Vn.hasOwnProperty,Gn=Vn.propertyIsEnumerable,Zn=Hn(function(){return arguments}())?Hn:function(t){return Xn(t)&&Yn.call(t,"callee")&&!Gn.call(t,"callee")},Jn=Zn,Kn=Array.isArray;var Qn=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},to=Qt,eo=Qn;var no=function(t){return null!=t&&eo(t.length)&&!to(t)},oo=no,io=zn;var ro=function(t){return io(t)&&oo(t)},so={exports:{}};var ao=function(){return!1};!function(t,e){var n=It,o=ao,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}(so,so.exports);var lo=so.exports,co=Yt,uo=kn,ho=zn,po=Function.prototype,fo=Object.prototype,mo=po.toString,go=fo.hasOwnProperty,vo=mo.call(Object);var bo=function(t){if(!ho(t)||"[object Object]"!=co(t))return!1;var e=uo(t);if(null===e)return!0;var n=go.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&mo.call(n)==vo},yo=Yt,wo=Qn,Co=zn,Eo={};Eo["[object Float32Array]"]=Eo["[object Float64Array]"]=Eo["[object Int8Array]"]=Eo["[object Int16Array]"]=Eo["[object Int32Array]"]=Eo["[object Uint8Array]"]=Eo["[object Uint8ClampedArray]"]=Eo["[object Uint16Array]"]=Eo["[object Uint32Array]"]=!0,Eo["[object Arguments]"]=Eo["[object Array]"]=Eo["[object ArrayBuffer]"]=Eo["[object Boolean]"]=Eo["[object DataView]"]=Eo["[object Date]"]=Eo["[object Error]"]=Eo["[object Function]"]=Eo["[object Map]"]=Eo["[object Number]"]=Eo["[object Object]"]=Eo["[object RegExp]"]=Eo["[object Set]"]=Eo["[object String]"]=Eo["[object WeakMap]"]=!1;var So=function(t){return Co(t)&&wo(t.length)&&!!Eo[yo(t)]};var xo=function(t){return function(e){return t(e)}},Oo={exports:{}};!function(t,e){var n=Lt,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}(Oo,Oo.exports);var _o=Oo.exports,No=So,jo=xo,Ao=_o&&_o.isTypedArray,Po=Ao?jo(Ao):No;var To=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},Do=hn,Lo=pt,$o=Object.prototype.hasOwnProperty;var ko=function(t,e,n){var o=t[e];$o.call(t,e)&&Lo(o,n)&&(void 0!==n||e in t)||Do(t,e,n)},Io=ko,Mo=hn;var Ro=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?Mo(n,a,l):Io(n,a,l)}return n};var Fo=/^(?:0|[1-9]\d*)$/;var Wo=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Fo.test(t))&&t>-1&&t%1==0&&t<e},Bo=function(t,e){for(var n=-1,o=Array(t);++n<t;)o[n]=e(n);return o},zo=Jn,qo=Kn,Uo=lo,Ho=Wo,Xo=Po,Vo=Object.prototype.hasOwnProperty;var Yo=function(t,e){var n=qo(t),o=!n&&zo(t),i=!n&&!o&&Uo(t),r=!n&&!o&&!i&&Xo(t),s=n||o||i||r,a=s?Bo(t.length,String):[],l=a.length;for(var c in t)!e&&!Vo.call(t,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Ho(c,l))||a.push(c);return a};var Go=Gt,Zo=Mn,Jo=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e},Ko=Object.prototype.hasOwnProperty;var Qo=Yo,ti=function(t){if(!Go(t))return Jo(t);var e=Zo(t),n=[];for(var o in t)("constructor"!=o||!e&&Ko.call(t,o))&&n.push(o);return n},ei=no;var ni=function(t){return ei(t)?Qo(t,!0):ti(t)},oi=Ro,ii=ni;var ri=mn,si=On,ai=An,li=Pn,ci=Bn,di=Jn,ui=Kn,hi=ro,pi=lo,fi=Qt,mi=Gt,gi=bo,vi=Po,bi=To,yi=function(t){return oi(t,ii(t))};var wi=ln,Ci=mn,Ei=Sn,Si=function(t,e,n,o,i,r,s){var a=bi(t,n),l=bi(e,n),c=s.get(l);if(c)ri(t,n,c);else{var d=r?r(a,l,n+"",t,e,s):void 0,u=void 0===d;if(u){var h=ui(l),p=!h&&pi(l),f=!h&&!p&&vi(l);d=l,h||p||f?ui(a)?d=a:hi(a)?d=li(a):p?(u=!1,d=si(l,!0)):f?(u=!1,d=ai(l,!0)):d=[]:gi(l)||di(l)?(d=a,di(a)?d=yi(a):mi(a)&&!fi(a)||(d=ci(l))):u=!1}u&&(s.set(l,d),i(d,l,o,r,s),s.delete(l)),ri(t,n,d)}},xi=Gt,Oi=ni,_i=To;var Ni=function t(e,n,o,i,r){e!==n&&Ei(n,(function(s,a){if(r||(r=new wi),xi(s))Si(e,n,a,o,t,i,r);else{var l=i?i(_i(e,a),s,a+"",e,n,r):void 0;void 0===l&&(l=s),Ci(e,a,l)}}),Oi)};var ji=function(t){return t};var Ai=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)},Pi=Math.max;var Ti=function(t,e,n){return e=Pi(void 0===e?t.length-1:e,0),function(){for(var o=arguments,i=-1,r=Pi(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),Ai(t,this,a)}};var Di=function(t){return function(){return t}},Li=dn,$i=Li?function(t,e){return Li(t,"toString",{configurable:!0,enumerable:!1,value:Di(e),writable:!0})}:ji,ki=Date.now;var Ii=function(t){var e=0,n=0;return function(){var o=ki(),i=16-(o-n);if(n=o,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}},Mi=Ii($i),Ri=ji,Fi=Ti,Wi=Mi;var Bi=pt,zi=no,qi=Wo,Ui=Gt;var Hi=function(t,e){return Wi(Fi(t,e,Ri),t+"")},Xi=function(t,e,n){if(!Ui(n))return!1;var o=typeof e;return!!("number"==o?zi(n)&&qi(e,n.length):"string"==o&&e in n)&&Bi(n[e],t)};var Vi=Ni;const Yi=ut(function(t){return Hi((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&&Xi(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){Vi(t,e,n,o)}))),Gi=()=>crypto.randomUUID(),Zi=(t="",e)=>{if(!e)return!1;const n=/[|\\{}()[\]^*$+?.]/g;let o="string"==typeof e?[e]:e;o=o.map((t=>"*"===t?"":t.replace(n,"\\$&")));let i=!0;return o.length&&(i=!new RegExp(o.join("|"),"i").exec(t)),i},Ji=t=>{var e;const n=null==(e=t.className)?void 0:e.match(z);return n&&W[n[0]]},Ki=t=>Array.from(new Set(t)),Qi=t=>{let e;if(t){const{attrs:n={}}=t;e=n.id||t.id||Gi(),t.id=e}else e=Gi();return e},tr=(t,e)=>Yi({},t,e,((t,e)=>Array.isArray(t)?null!=e?Ki(t.concat(e)):e:Array.isArray(e)?null!=t?Ki(e.concat(t)):e:void 0)),er=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]=er(t[n]);return e}if(t instanceof Object){e={};for(const n in t)Object.hasOwn(t,n)&&(e[n]=er(t[n]));return e}throw new Error("Unable to copy Object, type not supported.")},nr=(t,e)=>t/e*100,or=t=>`${t.toString()}%`,ir=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){}}}}),rr=t=>I.some((e=>new RegExp(`^${e}.`).test(t))),sr=t=>t.startsWith("external");function ar(t,e=Q){let n=0;return function(...o){const i=Date.now();i-n>=e&&(n=i,t.apply(this,o))}}function lr(t){return t}function cr(){}function dr(t=Object.create(null)){if("string"==typeof t)try{return JSON.parse(t)}catch(e){return Object.create(null)}return t}const ur=t=>t?er(dr(t)):ct();var hr=Yt,pr=zn;var fr=function(t){return"symbol"==typeof t||pr(t)&&"[object Symbol]"==hr(t)},mr=Kn,gr=fr,vr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,br=/^\w*$/;var yr=function(t,e){if(mr(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!gr(t))||(br.test(t)||!vr.test(t)||null!=e&&t in Object(e))},wr=Ze;function Cr(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(Cr.Cache||wr),n}Cr.Cache=wr;var Er=Cr;var Sr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,xr=/\\(\\)?/g,Or=function(t){var e=Er(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(Sr,(function(t,n,o,i){e.push(o?i.replace(xr,"$1"):n||t)})),e}));var _r=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},Nr=Kn,jr=fr,Ar=Mt?Mt.prototype:void 0,Pr=Ar?Ar.toString:void 0;var Tr=function t(e){if("string"==typeof e)return e;if(Nr(e))return _r(e,t)+"";if(jr(e))return Pr?Pr.call(e):"";var n=e+"";return"0"==n&&1/e==-1/0?"-0":n},Dr=Tr;var Lr=Kn,$r=yr,kr=Or,Ir=function(t){return null==t?"":Dr(t)};var Mr=function(t,e){return Lr(t)?t:$r(t,e)?[t]:kr(Ir(t))},Rr=fr;var Fr=function(t){if("string"==typeof t||Rr(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e},Wr=ko,Br=Mr,zr=Wo,qr=Gt,Ur=Fr;var Hr=function(t,e,n,o){if(!qr(t))return t;for(var i=-1,r=(e=Br(e,t)).length,s=r-1,a=t;null!=a&&++i<r;){var l=Ur(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=qr(d)?d:zr(e[i+1])?[]:{})}Wr(a,l,c),a=a[l]}return t};const Xr=ut((function(t,e,n){return null==t?t:Hr(t,e,n)}));var Vr=Mr,Yr=Fr;var Gr=function(t,e){for(var n=0,o=(e=Vr(e,t)).length;null!=t&&n<o;)t=t[Yr(e[n++])];return n&&n==o?t:void 0};const Zr=ut((function(t,e,n){var o=null==t?void 0:Gr(t,e);return void 0===o?n:o})),Jr=Xr,Kr=t=>Number.isInteger(Number(t)),Qr=(t,e)=>{const n=e||t.parentElement;return Array.prototype.slice.call(n.childNodes).indexOf(t)},ts=(t,e,n)=>{const o=n.split("||"),i=Ki(e).map((e=>t.find((t=>{const n=o.find((e=>!!Zr(t,e)));return n&&Zr(t,n)===e})))).filter(Boolean).concat(t);return Ki(i)},es=(t,e,n)=>{for(let o=0;o<t.length;o++)e.call(n,t[o],o)},ns=(t,e)=>{const n=[];return es(t,((t,o)=>n.push(e(t,o)))),n},os={},is=t=>t.replace(/\b\w/g,(t=>t.toUpperCase())),rs=()=>-1!==window.navigator.userAgent.indexOf("MSIE "),ss={capitalize:is,safeAttrName:t=>{if(os[t])return os[t];const e=({className:"class"}[t]||t).replace(/^\d+/,"").replace(/[^a-zA-Z0-9-:]/g,"");return os[t]=e,e},forEach:es,copyObj:t=>window.JSON.parse(window.JSON.stringify(t)),map:ns,subtract:(t,e)=>e.filter((e=>!~t.indexOf(e))),indexOfNode:Qr,isInt:Kr,get:Zr,orderObjectsBy:ts,isIE:rs},as={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=as.getStyle(t),i=parseInt(o.height,10),r=i/(e/60);t.style.height="0px",function e(){const o=parseFloat(t.style.height),s=o+r;o<i?(t.style.height=s+"px",window.requestAnimationFrame(e)):(t.style.height="auto",n&&n(t))}()},slideUp:(t,e=250,n=!1)=>{const o=as.getStyle(t),i=parseInt(o.height),r=o.overflow;t.style.overflow="hidden",t.style.height=i+"px";const s=o.minHeight;t.style.minHeight="auto";const a=parseFloat(i/(e/60)).toFixed(2);!function e(){const o=parseInt(t.style.height,10)-a;o>0?(t.style.height=o+"px",window.requestAnimationFrame(e)):(t.style.overflow=r,t.style.display="none",t.style.minHeight=s,delete t.style.height,n&&n(t))}()},slideToggle:(t,e=250,n="none"===as.getStyle(t,"display"))=>{n?as.slideDown(t,e):as.slideUp(t,e)}},ls="no-transition",cs={debug:!1,bubbles:!0,formeoLoaded:t=>{},onAdd:()=>{},onUpdate:t=>{var e;return(null==(e=us.opts)?void 0:e.debug)&&void 0},onUpdateStage:t=>{var e;return(null==(e=us.opts)?void 0:e.debug)&&void 0},onUpdateRow:t=>{var e;return(null==(e=us.opts)?void 0:e.debug)&&void 0},onUpdateColumn:t=>{var e;return(null==(e=us.opts)?void 0:e.debug)&&void 0},onUpdateField:t=>{var e;return(null==(e=us.opts)?void 0:e.debug)&&void 0},onRender:t=>{var e;return(null==(e=us.opts)?void 0:e.debug)&&void 0},onSave:t=>{},confirmClearAll:t=>{window.confirm(t.confirmationMessage)&&t.clearAllAction(t)}},ds=({src:t,...e},n=et)=>{var o,i;const r=new window.CustomEvent(n,{detail:e,bubbles:(null==(o=us.opts)?void 0:o.debug)||(null==(i=us.opts)?void 0:i.bubbles)});return r.data=(t||document).dispatchEvent(r),r},us={init:function(t){return this.opts={...cs,...t},this},formeoSaved:t=>ds(t,tt),formeoUpdated:t=>ds(t,et),formeoCleared:t=>ds(t,"formeoCleared"),formeoOnRender:t=>ds(t,nt),formeoConditionUpdated:t=>ds(t,"formeoConditionUpdated")},hs=ar((()=>{us.opts.onUpdate({timeStamp:window.performance.now(),type:et,detail:Bd.formData})}),K);let ps;document.addEventListener(et,hs),document.addEventListener("formeoUpdatedStage",(t=>{const{timeStamp:e,type:n,detail:o}=t;us.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedRow",(t=>{const{timeStamp:e,type:n,detail:o}=t;us.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedColumn",(t=>{const{timeStamp:e,type:n,detail:o}=t;us.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedField",(t=>{const{timeStamp:e,type:n,detail:o}=t;us.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener(nt,(t=>{const{timeStamp:e,type:n,detail:o}=t;us.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},us.opts.confirmClearAll(t)})),document.addEventListener(tt,(({timeStamp:t,type:e,detail:{formData:n}})=>{const o={timeStamp:t,type:e,formData:n};us.opts.onSave(o)})),document.addEventListener("formeoLoaded",(t=>{us.opts.formeoLoaded(t.detail.formeo)})),window.addEventListener("resize",(function(){ps=ps||window.requestAnimationFrame((()=>{ps=!1;for(const t of Object.values(Md.data))t.dom.classList.add(ls),Fd.dom.classList.add(ls),Fd.panels.nav.refresh(),t.refreshFieldPanels()}))}));var fs=Ze,ms=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},gs=function(t){return this.__data__.has(t)};function vs(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new fs;++e<n;)this.add(t[e])}vs.prototype.add=vs.prototype.push=ms,vs.prototype.has=gs;var bs=vs,ys=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},ws=function(t,e){return t.has(e)};var Cs=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 bs:void 0;for(r.set(t,e),r.set(e,t);++u<a;){var f=t[u],m=e[u];if(o)var g=s?o(m,f,u,e,t,r):o(f,m,u,t,e,r);if(void 0!==g){if(g)continue;h=!1;break}if(p){if(!ys(e,(function(t,e){if(!ws(p,e)&&(f===t||i(f,t,n,o,r)))return p.push(e)}))){h=!1;break}}else if(f!==m&&!i(f,m,n,o,r)){h=!1;break}}return r.delete(t),r.delete(e),h};var Es=_n,Ss=pt,xs=Cs,Os=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,o){n[++e]=[o,t]})),n},_s=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n},Ns=Mt?Mt.prototype:void 0,js=Ns?Ns.valueOf:void 0;var As=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 Es(t),new Es(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Ss(+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=Os;case"[object Set]":var l=1&o;if(a||(a=_s),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=xs(a(t),a(e),o,i,r,s);return s.delete(t),d;case"[object Symbol]":if(js)return js.call(t)==js.call(e)}return!1};var Ps=function(t,e){for(var n=-1,o=e.length,i=t.length;++n<o;)t[i+n]=e[n];return t},Ts=Kn;var Ds=function(t,e,n){var o=e(t);return Ts(t)?o:Ps(o,n(t))};var Ls=function(t,e){for(var n=-1,o=null==t?0:t.length,i=0,r=[];++n<o;){var s=t[n];e(s,n,t)&&(r[i++]=s)}return r},$s=function(){return[]},ks=Object.prototype.propertyIsEnumerable,Is=Object.getOwnPropertySymbols,Ms=Is?function(t){return null==t?[]:(t=Object(t),Ls(Is(t),(function(e){return ks.call(t,e)})))}:$s,Rs=$n(Object.keys,Object),Fs=Mn,Ws=Rs,Bs=Object.prototype.hasOwnProperty;var zs=Yo,qs=function(t){if(!Fs(t))return Ws(t);var e=[];for(var n in Object(t))Bs.call(t,n)&&"constructor"!=n&&e.push(n);return e},Us=no;var Hs=Ds,Xs=Ms,Vs=function(t){return Us(t)?zs(t):qs(t)};var Ys=function(t){return Hs(t,Vs,Xs)},Gs=Object.prototype.hasOwnProperty;var Zs=function(t,e,n,o,i,r){var s=1&n,a=Ys(t),l=a.length;if(l!=Ys(e).length&&!s)return!1;for(var c=l;c--;){var d=a[c];if(!(s?d in e:Gs.call(e,d)))return!1}var u=r.get(t),h=r.get(e);if(u&&h)return u==e&&h==t;var p=!0;r.set(t,e),r.set(e,t);for(var f=s;++c<l;){var m=t[d=a[c]],g=e[d];if(o)var v=s?o(g,m,d,e,t,r):o(m,g,d,t,e,r);if(!(void 0===v?m===g||i(m,g,n,o,r):v)){p=!1;break}f||(f="constructor"==d)}if(p&&!f){var b=t.constructor,y=e.constructor;b==y||!("constructor"in t)||!("constructor"in e)||"function"==typeof b&&b instanceof b&&"function"==typeof y&&y instanceof y||(p=!1)}return r.delete(t),r.delete(e),p},Js=ve(It,"DataView"),Ks=be,Qs=ve(It,"Promise"),ta=ve(It,"Set"),ea=ve(It,"WeakMap"),na=Yt,oa=ie,ia="[object Map]",ra="[object Promise]",sa="[object Set]",aa="[object WeakMap]",la="[object DataView]",ca=oa(Js),da=oa(Ks),ua=oa(Qs),ha=oa(ta),pa=oa(ea),fa=na;(Js&&fa(new Js(new ArrayBuffer(1)))!=la||Ks&&fa(new Ks)!=ia||Qs&&fa(Qs.resolve())!=ra||ta&&fa(new ta)!=sa||ea&&fa(new ea)!=aa)&&(fa=function(t){var e=na(t),n="[object Object]"==e?t.constructor:void 0,o=n?oa(n):"";if(o)switch(o){case ca:return la;case da:return ia;case ua:return ra;case ha:return sa;case pa:return aa}return e});var ma=ln,ga=Cs,va=As,ba=Zs,ya=fa,wa=Kn,Ca=lo,Ea=Po,Sa="[object Arguments]",xa="[object Array]",Oa="[object Object]",_a=Object.prototype.hasOwnProperty;var Na=function(t,e,n,o,i,r){var s=wa(t),a=wa(e),l=s?xa:ya(t),c=a?xa:ya(e),d=(l=l==Sa?Oa:l)==Oa,u=(c=c==Sa?Oa:c)==Oa,h=l==c;if(h&&Ca(t)){if(!Ca(e))return!1;s=!0,d=!1}if(h&&!d)return r||(r=new ma),s||Ea(t)?ga(t,e,n,o,i,r):va(t,e,l,n,o,i,r);if(!(1&n)){var p=d&&_a.call(t,"__wrapped__"),f=u&&_a.call(e,"__wrapped__");if(p||f){var m=p?t.value():t,g=f?e.value():e;return r||(r=new ma),i(m,g,n,o,r)}}return!!h&&(r||(r=new ma),ba(t,e,n,o,i,r))},ja=zn;var Aa=function t(e,n,o,i,r){return e===n||(null==e||null==n||!ja(e)&&!ja(n)?e!=e&&n!=n:Na(e,n,o,i,t,r))},Pa=Aa;const Ta=ut((function(t,e){return Pa(t,e)}));class Da{constructor(t,e=Object.create(null)){n(this,"toJSON",((t,e)=>JSON.stringify(t,null,e))),n(this,"get",(t=>Zr(this.data,t))),n(this,"getChangeType",((t,e)=>{const n=Y.find((({condition:n})=>n(t,e)))||{type:"unknown"};return n.desc="added"===n.type?`${t} to ${e}`:e,n})),n(this,"add",((t,e=Object.create(null))=>{const{id:n}=e,o=t||n||Qi();return this.set(o,e)})),n(this,"remove",(t=>{const e=t.split("."),n=e.pop(),o=this.get(e);return Array.isArray(o)?o.splice(Number(n),1):o&&delete o[n],o})),n(this,"getData",(()=>Object.entries(this.data).reduce(((t,[e,n])=>(t[e]=(null==n?void 0:n.data)?n.getData():n,t)),{}))),n(this,"setCallbacks",{}),n(this,"configVal",Object.create(null)),this.name=t,this.data=e,this.dataPath=""}get size(){return Object.keys(this.data).length}get js(){return this.data}get json(){return this.data}set(t,e){const n=Zr(this.data,t);if(Ta(n,e))return this.data;const o=Jr(this.data,t,e),i=Array.isArray(t)?t.join("."):t,r=Object.keys(this.setCallbacks).filter((t=>new RegExp(t).test(i))),s={newVal:e,oldVal:n,path:t};for(const a of r)for(const t of this.setCallbacks[a])t(s);if(!this.disableEvents){const i=this.getChangeType(n,e),r={entity:this,dataPath:this.dataPath.replace(/\.+$/,""),changePath:this.dataPath+t,value:e,data:o,change:`${i.type}: ${i.desc}`,src:this.dom};n&&(r.previousValue=n),us.formeoUpdated(r)}return o}addSetCallback(t,e){this.setCallbacks[t]?this.setCallbacks[t].push(e):this.setCallbacks[t]=[e]}removeSetCallback(t,e){this.setCallbacks[t]=this.setCallbacks[t].filter((t=>t!==e))}empty(){this.data=Object.create(null)}}
|
|
8
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).formeo={})}(this,(function(t){"use strict";var e=Object.defineProperty,n=(t,n,o)=>((t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o)(t,"symbol"!=typeof n?n+"":n,o);const o={extension:".lang",location:"assets/lang/",langs:["en-US"],locale:"en-US",override:{}};class i{constructor(t=o){this.langs=Object.create(null),this.loaded=[],this.processConfig(t)}processConfig(t){const{location:e,...n}={...o,...t},i=e.replace(/\/?$/,"/");this.config={location:i,...n};const{override:r,preloaded:s={}}=this.config,a=Object.entries(this.langs).concat(Object.entries(r||s));this.langs=a.reduce(((t,[e,n])=>(t[e]=this.applyLanguage(e,n),t)),{}),this.locale=this.config.locale||this.config.langs[0]}init(t){return this.processConfig({...this.config,...t}),this.setCurrent(this.locale)}addLanguage(t,e={}){e="string"==typeof e?i.processFile(e):e,this.applyLanguage(t,e),this.config.langs.push("locale")}getValue(t,e=this.locale){var n;return(null==(n=this.langs[e])?void 0:n[t])||this.getFallbackValue(t)}getFallbackValue(t){const e=Object.values(this.langs).find((e=>e[t]));return null==e?void 0:e[t]}makeSafe(t){const e={"{":"\\{","}":"\\}","|":"\\|"};return t=t.replace(/[{}|]/g,(t=>e[t])),new RegExp(t,"g")}put(t,e){return this.current[t]=e,e}get(t,e){const n=this;let o=this.getValue(t);if(!o)return;const i=o.match(/\{[^}]+?\}/g);if(e&&i)if("object"==typeof e)for(const r of i){const t=r.substring(1,r.length-1);o=o.replace(n.makeSafe(r),e[t]||"")}else o=o.replace(/\{[^}]+?\}/g,e);return o}static processFile(t){return i.fromFile(t.replace(/\n\n/g,"\n"))}static fromFile(t){const e=t.split("\n"),n={};for(let o,i=0;i<e.length;i++){o=/^(.+?) *?= *?([^\n]+)/.exec(e[i]),o&&(n[o[1]]=o[2].replace(/(^\s+|\s+$)/g,""))}return n}loadLang(t,e=!0){const n=this;return new Promise((function(o,r){if(-1!==n.loaded.indexOf(t)&&e)return n.applyLanguage(n.langs[t]),o(n.langs[t]);return async function(t){try{const e=await fetch(t);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const n=t.endsWith(".lang")?"text":"json";return await e[n]()}catch(e){throw e}}([n.config.location,t,n.config.extension].join("")).then((e=>{const r=i.processFile(e);return n.applyLanguage(t,r),n.loaded.push(t),o(n.langs[t])})).catch((e=>{const i=n.applyLanguage(t);o(i)}))}))}applyLanguage(t,e={}){const n=this.config.override[t]||{},o=this.langs[t]||{};return this.langs[t]={...o,...e,...n},this.langs[t]}get getLangs(){return this.config.langs}async setCurrent(t="en-US"){return await this.loadLang(t),this.locale=t,this.current=this.langs[t],this.current}}const r=new i;!function(){try{if("undefined"!=typeof document){var t=document.createElement("style");t.appendChild(document.createTextNode('._3x4ZIcu-{position:absolute;background:#1f2937;color:#fff;padding:.75rem;border-radius:.375rem;max-width:200px;z-index:50;visibility:hidden;opacity:0;transition:opacity .2s;pointer-events:none;left:0;top:0}._3x4ZIcu-.JIt36hCJ{visibility:visible;opacity:1;pointer-events:all}._3x4ZIcu-:before{content:"";position:absolute;width:0;height:0;border:6px solid transparent}._3x4ZIcu-[data-position=top]:before{border-top-color:#1f2937;bottom:-12px;left:50%;transform:translate(-50%)}._3x4ZIcu-[data-position=bottom]:before{border-bottom-color:#1f2937;top:-12px;left:50%;transform:translate(-50%)}._3x4ZIcu-[data-position=left]:before{border-left-color:#1f2937;right:-12px;top:50%;transform:translateY(-50%)}._3x4ZIcu-[data-position=right]:before{border-right-color:#1f2937;left:-12px;top:50%;transform:translateY(-50%)}._3x4ZIcu-[data-position=top-left]:before{border-top-color:#1f2937;bottom:-12px;left:12px;transform:none}._3x4ZIcu-[data-position=top-right]:before{border-top-color:#1f2937;bottom:-12px;right:12px;left:auto;transform:none}._3x4ZIcu-[data-position=bottom-left]:before{border-bottom-color:#1f2937;top:-12px;left:12px;transform:none}._3x4ZIcu-[data-position=bottom-right]:before{border-bottom-color:#1f2937;top:-12px;right:12px;left:auto;transform:none}')),document.head.appendChild(t)}}catch(e){}}();var s=Object.defineProperty,a=(t,e,n)=>((t,e,n)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);const l="_3x4ZIcu-",c="JIt36hCJ",d={triggerName:"tooltip"};class u{constructor(t=d){a(this,"triggerName"),a(this,"tooltip"),a(this,"activeTriggerType",null),a(this,"spacing",12),a(this,"handleClick",(t=>{const e=this.triggerName,n=t.target.closest(`[${e}][${e}-type="click"]`);if(n)if(this.isVisible())this.hide();else{const t=n.getAttribute(`${e}`);this.show(n,t),this.activeTriggerType="click"}else this.hide()})),a(this,"handleMouseOver",(t=>{const e=this.triggerName,n=t.target.closest(`[${e}]`);if("click"!==this.activeTriggerType&&"click"!==(null==n?void 0:n.getAttribute(`${e}-type`))){const t=null==n?void 0:n.getAttribute(`${e}`);t&&(this.show(n,t),this.activeTriggerType="hover")}})),a(this,"handleMouseOut",(t=>{const e=this.triggerName,n=t.target.closest(`[${e}]`);"click"!==this.activeTriggerType&&"click"!==(null==n?void 0:n.getAttribute(`${e}-type`))&&this.hide()})),a(this,"handleResize",(()=>{this.isVisible()&&this.hide()})),a(this,"handleScroll",(()=>{this.isVisible()&&this.hide()})),this.triggerName=`data-${t.triggerName}`,this.tooltip=document.createElement("div"),this.tooltip.className=`d-tooltip ${l}`,document.body.appendChild(this.tooltip),this.setupEventListeners()}setupEventListeners(){document.addEventListener("mouseover",this.handleMouseOver),document.addEventListener("mouseout",this.handleMouseOut),document.addEventListener("touchstart",this.handleMouseOver),document.addEventListener("touchend",this.handleMouseOut),document.addEventListener("click",this.handleClick),window.addEventListener("resize",this.handleResize),window.addEventListener("scroll",this.handleScroll,!0)}isVisible(){return this.tooltip.classList.contains(c)}calculatePosition(t){const e=t.getBoundingClientRect(),n=this.tooltip.getBoundingClientRect(),o=[{name:"top",x:e.left+(e.width-n.width)/2,y:e.top-n.height-this.spacing},{name:"bottom",x:e.left+(e.width-n.width)/2,y:e.bottom+this.spacing},{name:"left",x:e.left-n.width-this.spacing,y:e.top+(e.height-n.height)/2},{name:"right",x:e.right+this.spacing,y:e.top+(e.height-n.height)/2},{name:"top-left",x:e.left,y:e.top-n.height-this.spacing},{name:"top-right",x:e.right-n.width,y:e.top-n.height-this.spacing},{name:"bottom-left",x:e.left,y:e.bottom+this.spacing},{name:"bottom-right",x:e.right-n.width,y:e.bottom+this.spacing}];return o.find((t=>this.fitsInViewport(t,n)))||o[0]}fitsInViewport(t,e){if(!(t.x>=0&&t.y>=0&&t.x+e.width<=window.innerWidth&&t.y+e.height<=window.innerHeight))return!1;return 0===[[t.x,t.y],[t.x+e.width,t.y],[t.x,t.y+e.height],[t.x+e.width,t.y+e.height],[t.x+e.width/2,t.y+e.height/2]].flatMap((([t,e])=>Array.from(document.elementsFromPoint(t,e)))).filter((t=>{if(this.tooltip.contains(t)||t===this.tooltip||t.classList.contains(l)||"none"===getComputedStyle(t).pointerEvents)return!1})).length}show(t,e){this.tooltip.innerHTML=e??"",this.tooltip.classList.add(c);const n=this.calculatePosition(t);this.tooltip.style.left=`${n.x}px`,this.tooltip.style.top=`${n.y}px`,this.tooltip.dataset.position=n.name}hide(){this.tooltip.classList.remove(c),this.activeTriggerType=null}destroy(){document.removeEventListener("mouseover",this.handleMouseOver),document.removeEventListener("mouseout",this.handleMouseOut),document.removeEventListener("touchstart",this.handleMouseOver),document.removeEventListener("touchend",this.handleMouseOut),document.removeEventListener("click",this.handleClick),window.removeEventListener("resize",this.handleResize),window.removeEventListener("scroll",this.handleScroll,!0),this.tooltip.remove()}}void 0!==window&&(window.SmartTooltip=u);const h="formeo",p="4.0.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]},T=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 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=T,P.prototype.set=N;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,Tt=Object.prototype.hasOwnProperty;var Nt=function(t){var e=this.__data__;if(At){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return Tt.call(e,t)?e[t]:void 0},Pt=xt,jt=Object.prototype.hasOwnProperty;var kt=xt;var Dt=Ot,Lt=_t,$t=Nt,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 Te=Ae.exports,Ne=F.Uint8Array,Pe=Ne;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=Qe,en=Array.isArray;var nn=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},on=ot,rn=nn;var sn=function(t){return null!=t&&rn(t.length)&&!on(t)},an=sn,ln=Ve;var cn=function(t){return ln(t)&&an(t)},dn={exports:{}};var un=function(){return!1};!function(t,e){var n=F,o=un,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}(dn,dn.exports);var hn=dn.exports,pn=K,mn=Re,fn=Ve,gn=Function.prototype,vn=Object.prototype,bn=gn.toString,yn=vn.hasOwnProperty,wn=bn.call(Object);var Cn=function(t){if(!fn(t)||"[object Object]"!=pn(t))return!1;var e=mn(t);if(null===e)return!0;var n=yn.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&bn.call(n)==wn},En=K,xn=nn,Sn=Ve,On={};On["[object Float32Array]"]=On["[object Float64Array]"]=On["[object Int8Array]"]=On["[object Int16Array]"]=On["[object Int32Array]"]=On["[object Uint8Array]"]=On["[object Uint8ClampedArray]"]=On["[object Uint16Array]"]=On["[object Uint32Array]"]=!0,On["[object Arguments]"]=On["[object Array]"]=On["[object ArrayBuffer]"]=On["[object Boolean]"]=On["[object DataView]"]=On["[object Date]"]=On["[object Error]"]=On["[object Function]"]=On["[object Map]"]=On["[object Number]"]=On["[object Object]"]=On["[object RegExp]"]=On["[object Set]"]=On["[object String]"]=On["[object WeakMap]"]=!1;var _n=function(t){return Sn(t)&&xn(t.length)&&!!On[En(t)]};var An=function(t){return function(e){return t(e)}},Tn={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}(Tn,Tn.exports);var Nn=Tn.exports,Pn=_n,jn=An,kn=Nn&&Nn.isTypedArray,Dn=kn?jn(kn):Pn;var Ln=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},$n=fe,In=v,Mn=Object.prototype.hasOwnProperty;var Rn=function(t,e,n){var o=t[e];Mn.call(t,e)&&In(o,n)&&(void 0!==n||e in t)||$n(t,e,n)},Wn=Rn,Fn=fe;var Bn=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?Fn(n,a,l):Wn(n,a,l)}return n};var zn=/^(?:0|[1-9]\d*)$/;var Un=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&zn.test(t))&&t>-1&&t%1==0&&t<e},qn=function(t,e){for(var n=-1,o=Array(t);++n<t;)o[n]=e(n);return o},Vn=tn,Hn=en,Xn=hn,Yn=Un,Gn=Dn,Zn=Object.prototype.hasOwnProperty;var Jn=function(t,e){var n=Hn(t),o=!n&&Vn(t),i=!n&&!o&&Xn(t),r=!n&&!o&&!i&&Gn(t),s=n||o||i||r,a=s?qn(t.length,String):[],l=a.length;for(var c in t)!e&&!Zn.call(t,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Yn(c,l))||a.push(c);return a};var Kn=Q,Qn=Fe,to=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e},eo=Object.prototype.hasOwnProperty;var no=Jn,oo=function(t){if(!Kn(t))return to(t);var e=Qn(t),n=[];for(var o in t)("constructor"!=o||!e&&eo.call(t,o))&&n.push(o);return n},io=sn;var ro=function(t){return io(t)?no(t,!0):oo(t)},so=Bn,ao=ro;var lo=be,co=Te,uo=ke,ho=De,po=qe,mo=tn,fo=en,go=cn,vo=hn,bo=ot,yo=Q,wo=Cn,Co=Dn,Eo=Ln,xo=function(t){return so(t,ao(t))};var So=ue,Oo=be,_o=_e,Ao=function(t,e,n,o,i,r,s){var a=Eo(t,n),l=Eo(e,n),c=s.get(l);if(c)lo(t,n,c);else{var d=r?r(a,l,n+"",t,e,s):void 0,u=void 0===d;if(u){var h=fo(l),p=!h&&vo(l),m=!h&&!p&&Co(l);d=l,h||p||m?fo(a)?d=a:go(a)?d=ho(a):p?(u=!1,d=co(l,!0)):m?(u=!1,d=uo(l,!0)):d=[]:wo(l)||mo(l)?(d=a,mo(a)?d=xo(a):yo(a)&&!bo(a)||(d=po(l))):u=!1}u&&(s.set(l,d),i(d,l,o,r,s),s.delete(l)),lo(t,n,d)}},To=Q,No=ro,Po=Ln;var jo=function t(e,n,o,i,r){e!==n&&_o(n,(function(s,a){if(r||(r=new So),To(s))Ao(e,n,a,o,t,i,r);else{var l=i?i(Po(e,a),s,a+"",e,n,r):void 0;void 0===l&&(l=s),Oo(e,a,l)}}),No)};var ko=function(t){return t};var Do=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)},Lo=Math.max;var $o=function(t,e,n){return e=Lo(void 0===e?t.length-1:e,0),function(){for(var o=arguments,i=-1,r=Lo(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),Do(t,this,a)}};var Io=function(t){return function(){return t}},Mo=pe,Ro=Mo?function(t,e){return Mo(t,"toString",{configurable:!0,enumerable:!1,value:Io(e),writable:!0})}:ko,Wo=Date.now;var Fo=function(t){var e=0,n=0;return function(){var o=Wo(),i=16-(o-n);if(n=o,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}},Bo=Fo(Ro),zo=ko,Uo=$o,qo=Bo;var Vo=v,Ho=sn,Xo=Un,Yo=Q;var Go=function(t,e){return qo(Uo(t,e,zo),t+"")},Zo=function(t,e,n){if(!Yo(n))return!1;var o=typeof e;return!!("number"==o?Ho(n)&&Xo(e,n.length):"string"==o&&e in n)&&Vo(n[e],t)};var Jo=jo;const Ko=f(function(t){return Go((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&&Zo(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){Jo(t,e,n,o)}))),Qo=()=>crypto.randomUUID().slice(0,8).slice(0,8),ti=(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},ei=t=>{var e;const n=null==(e=t.className)?void 0:e.match(Xi);return n&&Vi[n[0]]},ni=t=>Array.from(new Set(t)),oi=t=>{var e;return(null==(e=null==t?void 0:t.attrs)?void 0:e.id)||(null==t?void 0:t.id)||Qo()},ii=(t,e)=>Ko({},t,e,((t,e)=>Array.isArray(t)?null!=e?ni(t.concat(e)):e:Array.isArray(e)?null!=t?ni(e.concat(t)):e:void 0)),ri=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]=ri(t[n]);return e}if(t instanceof Object){e={};for(const n in t)Object.hasOwn(t,n)&&(e[n]=ri(t[n]));return e}throw new Error("Unable to copy Object, type not supported.")},si=(t,e)=>t/e*100,ai=t=>`${t.toString()}%`,li=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){}}}}),ci=t=>/^(stage|row|column|field)s./.test(t);function di(t,e=ir){let n;return function(...o){n&&clearTimeout(n),n=setTimeout((()=>t.apply(this,o)),e)}}function ui(t){return t}function hi(){}function pi(t=Object.create(null)){if("string"==typeof t)try{return JSON.parse(t)}catch(e){return Object.create(null)}return t}const mi=t=>t?ri(pi(t)):Er();function fi(t,e,n,o={}){var i;if(!e||!t[n][e])return o;o[`${n}.${e}`]=t[n][e];const r=Ki.get(n);if(r){const s=(null==(i=t[n][e].data)?void 0:i.children)||[];for(const e of s)fi(t,e,r,o)}return o}const gi=h,vi=p,bi=gi,yi="formeo-sprite",wi=[{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"}],Ci=`../../lib/icons/${yi}.svg`,Ei=Ci,xi="development"===process.env.NODE_ENV||!1?Ei:`https://cdn.jsdelivr.net/npm/formeo@${vi}/dist/${yi}.svg`,Si=`https://draggable.github.io/formeo/assets/img/${yi}.svg`,Oi=`https://cdn.jsdelivr.net/npm/formeo@${vi}/dist/formeo.min.css`,_i="f-panel",Ai="control-group",Ti=`${bi}-stage`,Ni=`${bi}-row`,Pi=`${bi}-column`,ji=`${bi}-field`,ki="custom-column-widths",Di="column-preset",Li="resizing-columns",$i=new Map([[Ti,Ni],[Ni,Pi],[Pi,ji]]),Ii=["stage","row","column","field"],Mi=Ii.map((t=>`${t}s`));new Map(Mi.map(((t,e)=>[t,Ii[e]])));const Ri=new RegExp(`^${Mi.join("|")}.`),Wi=[...Ii],Fi=[...Mi],Bi=new Map(Fi.map(((t,e)=>[t,Wi[e]]))),zi=Wi.reduce(((t,e)=>(t[e]=e,t)),{}),Ui=[{name:"controls",className:Ai},{name:"stage",className:Ti},{name:"row",className:Ni},{name:"column",className:Pi},{name:"field",className:ji}],qi={controls:Ai,stage:Ti,row:Ni,column:Pi,field:ji},Vi=Object.entries(qi).reduce(((t,[e,n])=>(t[n]=e,t)),{}),Hi=Object.values(qi),Xi=new RegExp(`${Hi.join("|")}`,"g"),{childTypeMapVals:Yi,childTypeIndexMapVals:Gi}=Ui.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:[]}),Zi=Yi.slice().map((t=>t.slice().reverse())).reverse(),Ji=new Map(Yi),Ki=new Map(Gi),Qi=new Map(Zi.slice()),tr=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)),[])),er=`${gi}-formData`,nr=`${gi}-locale`,or=333,ir=Math.round(166.5),rr=Math.round(666),sr="formeoSaved",ar="formeoUpdated",lr="formeoOnRender",cr={equals:"==",notEquals:"!=",contains:"⊃",notContains:"!⊃"},dr={equals:"="},ur=["logical","source","sourceProperty","comparison","target","targetProperty","assignment","value"],hr=["isChecked","isNotChecked"],pr=["isVisible","isNotVisible"],mr=["value"],fr={comparison:cr,assignment:dr,logical:{and:"&&",or:"||"}},gr="if",vr="then",br=()=>({[gr]:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],[vr]:[{target:"",targetProperty:"",assignment:"",value:""}]}),yr=/(\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,wr=/\bcol-\w+-\d+/g,Cr="f-i-",Er=()=>({id:oi(),stages:{[oi()]:{}},rows:{},columns:{},fields:{}}),xr=["selected","checked"],Sr=xr.toReversed(),Or="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`)),_r=new RegExp(`(?!${Or.join("|")})\\w\\S*`,"g"),Ar=/\s+/g;function Tr(t){if("string"!=typeof t)return t;if(t.trim().match(Ar))return t;return t.replace(_r,(t=>t.charAt(0).toUpperCase()+t.substring(1).replace(/[A-Z]/g,(t=>` ${t}`))))}const Nr=(t,e="-")=>t.toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,e),Pr=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)},jr=(t,e="-")=>Pr(t).join(e);var kr=K,Dr=Ve;var Lr=function(t){return"symbol"==typeof t||Dr(t)&&"[object Symbol]"==kr(t)},$r=en,Ir=Lr,Mr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Rr=/^\w*$/;var Wr=function(t,e){if($r(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!Ir(t))||(Rr.test(t)||!Mr.test(t)||null!=e&&t in Object(e))},Fr=te;function Br(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(Br.Cache||Fr),n}Br.Cache=Fr;var zr=Br;var Ur=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,qr=/\\(\\)?/g,Vr=function(t){var e=zr(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(Ur,(function(t,n,o,i){e.push(o?i.replace(qr,"$1"):n||t)})),e}));var Hr=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},Xr=en,Yr=Lr,Gr=B?B.prototype:void 0,Zr=Gr?Gr.toString:void 0;var Jr=function t(e){if("string"==typeof e)return e;if(Xr(e))return Hr(e,t)+"";if(Yr(e))return Zr?Zr.call(e):"";var n=e+"";return"0"==n&&1/e==-1/0?"-0":n},Kr=Jr;var Qr=en,ts=Wr,es=Vr,ns=function(t){return null==t?"":Kr(t)};var os=function(t,e){return Qr(t)?t:ts(t,e)?[t]:es(ns(t))},is=Lr;var rs=function(t){if("string"==typeof t||is(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e},ss=os,as=rs;var ls=function(t,e){for(var n=0,o=(e=ss(e,t)).length;null!=t&&n<o;)t=t[as(e[n++])];return n&&n==o?t:void 0};var cs=Rn,ds=os,us=Un,hs=Q,ps=rs;var ms=function(t,e,n,o){if(!hs(t))return t;for(var i=-1,r=(e=ds(e,t)).length,s=r-1,a=t;null!=a&&++i<r;){var l=ps(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=hs(d)?d:us(e[i+1])?[]:{})}cs(a,l,c),a=a[l]}return t};const fs=f((function(t,e,n){var o=null==t?void 0:ls(t,e);return void 0===o?n:o})),gs=f((function(t,e,n){return null==t?t:ms(t,e,n)}));function vs(...t){return t.flat().reduce(((t,e)=>(t[e]=e,t)),{})}var bs=te,ys=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},ws=function(t){return this.__data__.has(t)};function Cs(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new bs;++e<n;)this.add(t[e])}Cs.prototype.add=Cs.prototype.push=ys,Cs.prototype.has=ws;var Es=Cs,xs=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},Ss=function(t,e){return t.has(e)};var Os=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 Es: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(!xs(e,(function(t,e){if(!Ss(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 _s=Ne,As=v,Ts=Os,Ns=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,o){n[++e]=[o,t]})),n},Ps=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n},js=B?B.prototype:void 0,ks=js?js.valueOf:void 0;var Ds=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 _s(t),new _s(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return As(+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=Ns;case"[object Set]":var l=1&o;if(a||(a=Ps),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=Ts(a(t),a(e),o,i,r,s);return s.delete(t),d;case"[object Symbol]":if(ks)return ks.call(t)==ks.call(e)}return!1};var Ls=function(t,e){for(var n=-1,o=e.length,i=t.length;++n<o;)t[i+n]=e[n];return t},$s=en;var Is=function(t,e,n){var o=e(t);return $s(t)?o:Ls(o,n(t))};var Ms=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},Rs=function(){return[]},Ws=Object.prototype.propertyIsEnumerable,Fs=Object.getOwnPropertySymbols,Bs=Fs?function(t){return null==t?[]:(t=Object(t),Ms(Fs(t),(function(e){return Ws.call(t,e)})))}:Rs,zs=Me(Object.keys,Object),Us=Fe,qs=zs,Vs=Object.prototype.hasOwnProperty;var Hs=Jn,Xs=function(t){if(!Us(t))return qs(t);var e=[];for(var n in Object(t))Vs.call(t,n)&&"constructor"!=n&&e.push(n);return e},Ys=sn;var Gs=Is,Zs=Bs,Js=function(t){return Ys(t)?Hs(t):Xs(t)};var Ks=function(t){return Gs(t,Js,Zs)},Qs=Object.prototype.hasOwnProperty;var ta=function(t,e,n,o,i,r){var s=1&n,a=Ks(t),l=a.length;if(l!=Ks(e).length&&!s)return!1;for(var c=l;c--;){var d=a[c];if(!(s?d in e:Qs.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},ea=Ct(F,"DataView"),na=Et,oa=Ct(F,"Promise"),ia=Ct(F,"Set"),ra=Ct(F,"WeakMap"),sa=K,aa=lt,la="[object Map]",ca="[object Promise]",da="[object Set]",ua="[object WeakMap]",ha="[object DataView]",pa=aa(ea),ma=aa(na),fa=aa(oa),ga=aa(ia),va=aa(ra),ba=sa;(ea&&ba(new ea(new ArrayBuffer(1)))!=ha||na&&ba(new na)!=la||oa&&ba(oa.resolve())!=ca||ia&&ba(new ia)!=da||ra&&ba(new ra)!=ua)&&(ba=function(t){var e=sa(t),n="[object Object]"==e?t.constructor:void 0,o=n?aa(n):"";if(o)switch(o){case pa:return ha;case ma:return la;case fa:return ca;case ga:return da;case va:return ua}return e});var ya=ue,wa=Os,Ca=Ds,Ea=ta,xa=ba,Sa=en,Oa=hn,_a=Dn,Aa="[object Arguments]",Ta="[object Array]",Na="[object Object]",Pa=Object.prototype.hasOwnProperty;var ja=function(t,e,n,o,i,r){var s=Sa(t),a=Sa(e),l=s?Ta:xa(t),c=a?Ta:xa(e),d=(l=l==Aa?Na:l)==Na,u=(c=c==Aa?Na:c)==Na,h=l==c;if(h&&Oa(t)){if(!Oa(e))return!1;s=!0,d=!1}if(h&&!d)return r||(r=new ya),s||_a(t)?wa(t,e,n,o,i,r):Ca(t,e,l,n,o,i,r);if(!(1&n)){var p=d&&Pa.call(t,"__wrapped__"),m=u&&Pa.call(e,"__wrapped__");if(p||m){var f=p?t.value():t,g=m?e.value():e;return r||(r=new ya),i(f,g,n,o,r)}}return!!h&&(r||(r=new ya),Ea(t,e,n,o,i,r))},ka=Ve;var Da=function t(e,n,o,i,r){return e===n||(null==e||null==n||!ka(e)&&!ka(n)?e!=e&&n!=n:ja(e,n,o,i,t,r))},La=Da;const $a=f((function(t,e){return La(t,e)})),Ia=(t,e)=>void 0===t?"added":void 0===e?"removed":$a(t,e)?"unchanged":"changed";class Ma{constructor(t,e=Object.create(null)){n(this,"toJSON",((t,e)=>JSON.stringify(t,null,e))),n(this,"get",(t=>fs(this.data,t))),n(this,"add",((t,e=Object.create(null))=>{const{id:n}=e,o=t||n||oi();return this.set(o,e)})),n(this,"remove",(t=>{const e=Pr(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=fs(this.data,t),o=gs(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:Ia(n,e),src:this.dom};n&&(i.previousValue=n),Lu.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 Ra extends Ma{constructor(){super(...arguments),n(this,"load",(t=>{const e=pi(t);this.empty();for(const[n,o]of Object.entries(e))this.add(n,o);return this.data})),n(this,"get",(t=>t?fs(this.data,t):this.add())),n(this,"add",((t,e=Object.create(null))=>{const n=t||oi(),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=ii(this.configVal,ri(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 La(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function $a(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?La(Object(n),!0).forEach((function(e){Ia(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):La(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function ka(t){return(ka="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 Ia(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ma(){return Ma=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},Ma.apply(this,arguments)}function Ra(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 Fa(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var Wa=Fa(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Ba=Fa(/Edge/i),za=Fa(/firefox/i),qa=Fa(/safari/i)&&!Fa(/chrome/i)&&!Fa(/android/i),Ua=Fa(/iP(ad|od|hone)/i),Ha=Fa(/chrome/i)&&Fa(/android/i),Xa={capture:!1,passive:!1};function Va(t,e,n){t.addEventListener(e,n,!Wa&&Xa)}function Ya(t,e,n){t.removeEventListener(e,n,!Wa&&Xa)}function Ga(t,e){if(e){if(">"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(n){return!1}return!1}}function Za(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function Ja(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&Ga(t,e):Ga(t,e))||o&&t===n)return t;if(t===n)break}while(t=Za(t))}return null}var Ka,Qa=/\s+/g;function tl(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(Qa," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(Qa," ")}}function el(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 nl(t,e){var n="";if("string"==typeof t)n=t;else do{var o=el(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 ol(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 il(){var t=document.scrollingElement;return t||document.documentElement}function rl(t,e,n,o,i){if(t.getBoundingClientRect||t===window){var r,s,a,l,c,d,u;if(t!==window&&t.parentNode&&t!==il()?(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,!Wa))do{if(i&&i.getBoundingClientRect&&("none"!==el(i,"transform")||n&&"static"!==el(i,"position"))){var h=i.getBoundingClientRect();s-=h.top+parseInt(el(i,"border-top-width")),a-=h.left+parseInt(el(i,"border-left-width")),l=s+r.height,c=a+r.width;break}}while(i=i.parentNode);if(o&&t!==window){var p=nl(i||t),f=p&&p.a,m=p&&p.d;p&&(l=(s/=m)+(d/=m),c=(a/=f)+(u/=f))}return{top:s,left:a,bottom:l,right:c,width:u,height:d}}}function sl(t,e,n){for(var o=ul(t,!0),i=rl(t)[e];o;){if(!(i>=rl(o)[n]))return o;if(o===il())break;o=ul(o,!1)}return!1}function al(t,e,n,o){for(var i=0,r=0,s=t.children;r<s.length;){if("none"!==s[r].style.display&&s[r]!==mc.ghost&&(o||s[r]!==mc.dragged)&&Ja(s[r],n.draggable,t,!1)){if(i===e)return s[r];i++}r++}return null}function ll(t,e){for(var n=t.lastElementChild;n&&(n===mc.ghost||"none"===el(n,"display")||e&&!Ga(n,e));)n=n.previousElementSibling;return n||null}function cl(t,e){var n=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||t===mc.clone||e&&!Ga(t,e)||n++;return n}function dl(t){var e=0,n=0,o=il();if(t)do{var i=nl(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 ul(t,e){if(!t||!t.getBoundingClientRect)return il();var n=t,o=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=el(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 il();if(o||e)return n;o=!0}}}while(n=n.parentNode);return il()}function hl(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 pl(t,e){return function(){if(!Ka){var n=arguments;1===n.length?t.call(this,n[0]):t.apply(this,n),Ka=setTimeout((function(){Ka=void 0}),e)}}}function fl(t,e,n){t.scrollLeft+=e,t.scrollTop+=n}function ml(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 gl(t,e,n){var o={};return Array.from(t.children).forEach((function(i){var r,s,a,l;if(Ja(i,e.draggable,t,!1)&&!i.animated&&i!==n){var c=rl(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 vl="Sortable"+(new Date).getTime();function bl(){var t,e=[];return{captureAnimationState:function(){(e=[],this.options.animation)&&[].slice.call(this.el.children).forEach((function(t){if("none"!==el(t,"display")&&t!==mc.ghost){e.push({target:t,rect:rl(t)});var n=$a({},e[e.length-1].rect);if(t.thisAnimationDuration){var o=nl(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=rl(n),l=n.prevFromRect,c=n.prevToRect,d=t.rect,u=nl(n,!0);u&&(a.top-=u.f,a.left-=u.e),n.toRect=a,n.thisAnimationDuration&&hl(l,a)&&!hl(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)),hl(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){el(t,"transition",""),el(t,"transform","");var i=nl(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,el(t,"transform","translate3d("+a+"px,"+l+"px,0)"),this.forRepaintDummy=function(t){return t.offsetWidth}(t),el(t,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),el(t,"transform","translate3d(0,0,0)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout((function(){el(t,"transition",""),el(t,"transform",""),t.animated=!1,t.animatingX=!1,t.animatingY=!1}),o)}}}}var yl=[],wl={initializeByDefault:!0},Cl={mount:function(t){for(var e in wl)wl.hasOwnProperty(e)&&!(e in t)&&(t[e]=wl[e]);yl.forEach((function(e){if(e.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")})),yl.push(t)},pluginEvent:function(t,e,n){var o=this;this.eventCanceled=!1,n.cancel=function(){o.eventCanceled=!0};var i=t+"Global";yl.forEach((function(o){e[o.pluginName]&&(e[o.pluginName][i]&&e[o.pluginName][i]($a({sortable:e},n)),e.options[o.pluginName]&&e[o.pluginName][t]&&e[o.pluginName][t]($a({sortable:e},n)))}))},initializePlugins:function(t,e,n,o){for(var i in yl.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,Ma(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 yl.forEach((function(o){"function"==typeof o.eventProperties&&Ma(n,o.eventProperties.call(e[o.pluginName],t))})),n},modifyOption:function(t,e,n){var o;return yl.forEach((function(i){t[i.pluginName]&&i.optionListeners&&"function"==typeof i.optionListeners[e]&&(o=i.optionListeners[e].call(t[i.pluginName],n))})),o}};var El=["evt"],Sl=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=n.evt,i=Ra(n,El);Cl.pluginEvent.bind(mc)(t,e,$a({dragEl:Ol,parentEl:_l,ghostEl:Nl,rootEl:jl,nextEl:Al,lastDownEl:Pl,cloneEl:Tl,cloneHidden:Dl,dragStarted:Hl,putSortable:Rl,activeSortable:mc.active,originalEvent:o,oldIndex:Ll,oldDraggableIndex:kl,newIndex:$l,newDraggableIndex:Il,hideGhostForTarget:uc,unhideGhostForTarget:hc,cloneNowHidden:function(){Dl=!0},cloneNowShown:function(){Dl=!1},dispatchSortableEvent:function(t){xl({sortable:e,name:t,originalEvent:o})}},i))};function xl(t){!function(t){var e=t.sortable,n=t.rootEl,o=t.name,i=t.targetEl,r=t.cloneEl,s=t.toEl,a=t.fromEl,l=t.oldIndex,c=t.newIndex,d=t.oldDraggableIndex,u=t.newDraggableIndex,h=t.originalEvent,p=t.putSortable,f=t.extraEventProperties;if(e=e||n&&n[vl]){var m,g=e.options,v="on"+o.charAt(0).toUpperCase()+o.substr(1);!window.CustomEvent||Wa||Ba?(m=document.createEvent("Event")).initEvent(o,!0,!0):m=new CustomEvent(o,{bubbles:!0,cancelable:!0}),m.to=s||n,m.from=a||n,m.item=i||n,m.clone=r,m.oldIndex=l,m.newIndex=c,m.oldDraggableIndex=d,m.newDraggableIndex=u,m.originalEvent=h,m.pullMode=p?p.lastPutMode:void 0;var b=$a($a({},f),Cl.getEventProperties(o,e));for(var y in b)m[y]=b[y];n&&n.dispatchEvent(m),g[v]&&g[v].call(e,m)}}($a({putSortable:Rl,cloneEl:Tl,targetEl:Ol,rootEl:jl,oldIndex:Ll,oldDraggableIndex:kl,newIndex:$l,newDraggableIndex:Il},t))}var Ol,_l,Nl,jl,Al,Pl,Tl,Dl,Ll,$l,kl,Il,Ml,Rl,Fl,Wl,Bl,zl,ql,Ul,Hl,Xl,Vl,Yl,Gl,Zl=!1,Jl=!1,Kl=[],Ql=!1,tc=!1,ec=[],nc=!1,oc=[],ic="undefined"!=typeof document,rc=Ua,sc=Ba||Wa?"cssFloat":"float",ac=ic&&!Ha&&!Ua&&"draggable"in document.createElement("div"),lc=function(){if(ic){if(Wa)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),cc=function(t,e){var n=el(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=al(t,0,e),r=al(t,1,e),s=i&&el(i),a=r&&el(r),l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+rl(i).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+rl(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[sc]||r&&"none"===n[sc]&&l+c>o)?"vertical":"horizontal"},dc=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"==ka(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},uc=function(){!lc&&Nl&&el(Nl,"display","none")},hc=function(){!lc&&Nl&&el(Nl,"display","")};ic&&!Ha&&document.addEventListener("click",(function(t){if(Jl)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),Jl=!1,!1}),!0);var pc=function(t){if(Ol){t=t.touches?t.touches[0]:t;var e=(i=t.clientX,r=t.clientY,Kl.some((function(t){var e=t[vl].options.emptyInsertThreshold;if(e&&!ll(t)){var n=rl(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[vl]._onDragOver(n)}}var i,r,s},fc=function(t){Ol&&Ol.parentNode[vl]._isOutsideThisEl(t.target)};function mc(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=Ma({},e),t[vl]=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 cc(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!==mc.supportPointer&&"PointerEvent"in window&&!qa,emptyInsertThreshold:5};for(var o in Cl.initializePlugins(this,t,n),n)!(o in e)&&(e[o]=n[o]);for(var i in dc(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&ac,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?Va(t,"pointerdown",this._onTapStart):(Va(t,"mousedown",this._onTapStart),Va(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(Va(t,"dragover",this),Va(t,"dragenter",this)),Kl.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),Ma(this,bl())}function gc(t,e,n,o,i,r,s,a){var l,c,d=t[vl],u=d.options.onMove;return!window.CustomEvent||Wa||Ba?(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||rl(e),l.willInsertAfter=a,l.originalEvent=s,t.dispatchEvent(l),u&&(c=u.call(d,l,s)),c}function vc(t){t.draggable=!1}function bc(){nc=!1}function yc(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 wc(t){return setTimeout(t,0)}function Cc(t){return clearTimeout(t)}mc.prototype={constructor:mc,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(Xl=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,Ol):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){oc.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&oc.push(o)}}(n),!Ol&&!(/mousedown|pointerdown/.test(r)&&0!==t.button||o.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!qa||!a||"SELECT"!==a.tagName.toUpperCase())&&!((a=Ja(a,o.draggable,n,!1))&&a.animated||Pl===a)){if(Ll=cl(a),kl=cl(a,o.draggable),"function"==typeof c){if(c.call(this,t,a,this))return xl({sortable:e,rootEl:l,name:"filter",targetEl:a,toEl:n,fromEl:n}),Sl("filter",e,{evt:t}),void(i&&t.cancelable&&t.preventDefault())}else if(c&&(c=c.split(",").some((function(o){if(o=Ja(l,o.trim(),n,!1))return xl({sortable:e,rootEl:o,name:"filter",targetEl:a,fromEl:n,toEl:n}),Sl("filter",e,{evt:t}),!0}))))return void(i&&t.cancelable&&t.preventDefault());o.handle&&!Ja(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&&!Ol&&n.parentNode===r){var l=rl(n);if(jl=r,_l=(Ol=n).parentNode,Al=Ol.nextSibling,Pl=n,Ml=s.group,mc.dragged=Ol,Fl={target:Ol,clientX:(e||t).clientX,clientY:(e||t).clientY},ql=Fl.clientX-l.left,Ul=Fl.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,Ol.style["will-change"]="all",o=function(){Sl("delayEnded",i,{evt:t}),mc.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!za&&i.nativeDraggable&&(Ol.draggable=!0),i._triggerDragStart(t,e),xl({sortable:i,name:"choose",originalEvent:t}),tl(Ol,s.chosenClass,!0))},s.ignore.split(",").forEach((function(t){ol(Ol,t.trim(),vc)})),Va(a,"dragover",pc),Va(a,"mousemove",pc),Va(a,"touchmove",pc),Va(a,"mouseup",i._onDrop),Va(a,"touchend",i._onDrop),Va(a,"touchcancel",i._onDrop),za&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Ol.draggable=!0),Sl("delayStart",this,{evt:t}),!s.delay||s.delayOnTouchOnly&&!e||this.nativeDraggable&&(Ba||Wa))o();else{if(mc.eventCanceled)return void this._onDrop();Va(a,"mouseup",i._disableDelayedDrag),Va(a,"touchend",i._disableDelayedDrag),Va(a,"touchcancel",i._disableDelayedDrag),Va(a,"mousemove",i._delayedDragTouchMoveHandler),Va(a,"touchmove",i._delayedDragTouchMoveHandler),s.supportPointer&&Va(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(){Ol&&vc(Ol),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;Ya(t,"mouseup",this._disableDelayedDrag),Ya(t,"touchend",this._disableDelayedDrag),Ya(t,"touchcancel",this._disableDelayedDrag),Ya(t,"mousemove",this._delayedDragTouchMoveHandler),Ya(t,"touchmove",this._delayedDragTouchMoveHandler),Ya(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?Va(document,"pointermove",this._onTouchMove):Va(document,e?"touchmove":"mousemove",this._onTouchMove):(Va(Ol,"dragend",this),Va(jl,"dragstart",this._onDragStart));try{document.selection?wc((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(n){}},_dragStarted:function(t,e){if(Zl=!1,jl&&Ol){Sl("dragStarted",this,{evt:e}),this.nativeDraggable&&Va(document,"dragover",fc);var n=this.options;!t&&tl(Ol,n.dragClass,!1),tl(Ol,n.ghostClass,!0),mc.active=this,t&&this._appendGhost(),xl({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(Wl){this._lastX=Wl.clientX,this._lastY=Wl.clientY,uc();for(var t=document.elementFromPoint(Wl.clientX,Wl.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Wl.clientX,Wl.clientY))!==e;)e=t;if(Ol.parentNode[vl]._isOutsideThisEl(t),e)do{if(e[vl]){if(e[vl]._onDragOver({clientX:Wl.clientX,clientY:Wl.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=Za(e));hc()}},_onTouchMove:function(t){if(Fl){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=Nl&&nl(Nl,!0),s=Nl&&r&&r.a,a=Nl&&r&&r.d,l=rc&&Gl&&dl(Gl),c=(i.clientX-Fl.clientX+o.x)/(s||1)+(l?l[0]-ec[0]:0)/(s||1),d=(i.clientY-Fl.clientY+o.y)/(a||1)+(l?l[1]-ec[1]:0)/(a||1);if(!mc.active&&!Zl){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<n)return;this._onDragStart(t,!0)}if(Nl){r?(r.e+=c-(Bl||0),r.f+=d-(zl||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,")");el(Nl,"webkitTransform",u),el(Nl,"mozTransform",u),el(Nl,"msTransform",u),el(Nl,"transform",u),Bl=c,zl=d,Wl=i}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!Nl){var t=this.options.fallbackOnBody?document.body:jl,e=rl(Ol,!0,rc,!0,t),n=this.options;if(rc){for(Gl=t;"static"===el(Gl,"position")&&"none"===el(Gl,"transform")&&Gl!==document;)Gl=Gl.parentNode;Gl!==document.body&&Gl!==document.documentElement?(Gl===document&&(Gl=il()),e.top+=Gl.scrollTop,e.left+=Gl.scrollLeft):Gl=il(),ec=dl(Gl)}tl(Nl=Ol.cloneNode(!0),n.ghostClass,!1),tl(Nl,n.fallbackClass,!0),tl(Nl,n.dragClass,!0),el(Nl,"transition",""),el(Nl,"transform",""),el(Nl,"box-sizing","border-box"),el(Nl,"margin",0),el(Nl,"top",e.top),el(Nl,"left",e.left),el(Nl,"width",e.width),el(Nl,"height",e.height),el(Nl,"opacity","0.8"),el(Nl,"position",rc?"absolute":"fixed"),el(Nl,"zIndex","100000"),el(Nl,"pointerEvents","none"),mc.ghost=Nl,t.appendChild(Nl),el(Nl,"transform-origin",ql/parseInt(Nl.style.width)*100+"% "+Ul/parseInt(Nl.style.height)*100+"%")}},_onDragStart:function(t,e){var n=this,o=t.dataTransfer,i=n.options;Sl("dragStart",this,{evt:t}),mc.eventCanceled?this._onDrop():(Sl("setupClone",this),mc.eventCanceled||((Tl=ml(Ol)).removeAttribute("id"),Tl.draggable=!1,Tl.style["will-change"]="",this._hideClone(),tl(Tl,this.options.chosenClass,!1),mc.clone=Tl),n.cloneId=wc((function(){Sl("clone",n),mc.eventCanceled||(n.options.removeCloneOnHide||jl.insertBefore(Tl,Ol),n._hideClone(),xl({sortable:n,name:"clone"}))})),!e&&tl(Ol,i.dragClass,!0),e?(Jl=!0,n._loopId=setInterval(n._emulateDragOver,50)):(Ya(document,"mouseup",n._onDrop),Ya(document,"touchend",n._onDrop),Ya(document,"touchcancel",n._onDrop),o&&(o.effectAllowed="move",i.setData&&i.setData.call(n,o,Ol)),Va(document,"drop",n),el(Ol,"transform","translateZ(0)")),Zl=!0,n._dragStartId=wc(n._dragStarted.bind(n,e,t)),Va(document,"selectstart",n),Hl=!0,qa&&el(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=mc.active,d=Ml===l,u=a.sort,h=Rl||c,p=this,f=!1;if(!nc){if(void 0!==t.preventDefault&&t.cancelable&&t.preventDefault(),s=Ja(s,a.draggable,r,!0),A("dragOver"),mc.eventCanceled)return f;if(Ol.contains(t.target)||s.animated&&s.animatingX&&s.animatingY||p._ignoreWhileAnimating===s)return T(!1);if(Jl=!1,c&&!a.disabled&&(d?u||(o=_l!==jl):Rl===this||(this.lastPutMode=Ml.checkPull(this,c,Ol,t))&&l.checkPut(this,c,Ol,t))){if(i="vertical"===this._getDirection(t,s),e=rl(Ol),A("dragOverValid"),mc.eventCanceled)return f;if(o)return _l=jl,P(),this._hideClone(),A("revert"),mc.eventCanceled||(Al?jl.insertBefore(Ol,Al):jl.appendChild(Ol)),T(!0);var m=ll(r,a.draggable);if(!m||function(t,e,n){var o=rl(ll(n.el,n.options.draggable)),i=gl(n.el,n.options,Nl),r=10;return e?t.clientX>i.right+r||t.clientY>o.bottom&&t.clientX>o.left:t.clientY>i.bottom+r||t.clientX>o.right&&t.clientY>o.top}(t,i,this)&&!m.animated){if(m===Ol)return T(!1);if(m&&r===t.target&&(s=m),s&&(n=rl(s)),!1!==gc(jl,r,Ol,e,s,n,t,!!s))return P(),m&&m.nextSibling?r.insertBefore(Ol,m.nextSibling):r.appendChild(Ol),_l=r,D(),T(!0)}else if(m&&function(t,e,n){var o=rl(al(n.el,0,n.options,!0)),i=gl(n.el,n.options,Nl),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=al(r,0,a,!0);if(g===Ol)return T(!1);if(n=rl(s=g),!1!==gc(jl,r,Ol,e,s,n,t,!1))return P(),r.insertBefore(Ol,g),_l=r,D(),T(!0)}else if(s.parentNode===r){n=rl(s);var v,b,y,w=Ol.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}(Ol.animated&&Ol.toRect||e,s.animated&&s.toRect||n,i),E=i?"top":"left",S=sl(s,"top","top")||sl(Ol,"top","top"),x=S?S.scrollTop:void 0;if(Xl!==s&&(b=n[E],Ql=!1,tc=!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&&Yl<c*i){if(!Ql&&(1===Vl?l>d+c*r/2:l<u-c*r/2)&&(Ql=!0),Ql)h=!0;else if(1===Vl?l<d+Yl:l>u-Yl)return-Vl}else if(l>d+c*(1-i)/2&&l<u-c*(1-i)/2)return function(t){return cl(Ol)<cl(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,tc,Xl===s),0!==v){var O=cl(Ol);do{O-=v,y=_l.children[O]}while(y&&("none"===el(y,"display")||y===Nl))}if(0===v||y===s)return T(!1);Xl=s,Vl=v;var _=s.nextElementSibling,N=!1,j=gc(jl,r,Ol,e,s,n,t,N=1===v);if(!1!==j)return 1!==j&&-1!==j||(N=1===j),nc=!0,setTimeout(bc,30),P(),N&&!_?r.appendChild(Ol):s.parentNode.insertBefore(Ol,N?_:s),S&&fl(S,0,x-S.scrollTop),_l=Ol.parentNode,void 0===b||tc||(Yl=Math.abs(b-rl(s)[E])),D(),T(!0)}if(r.contains(Ol))return T(!1)}return!1}function A(a,l){Sl(a,p,$a({evt:t,isOwner:d,axis:i?"vertical":"horizontal",revert:o,dragRect:e,targetRect:n,canSort:u,fromSortable:h,target:s,completed:T,onMove:function(n,o){return gc(jl,r,Ol,e,n,rl(n),t,o)},changed:D},l))}function P(){A("dragOverAnimationCapture"),p.captureAnimationState(),p!==h&&h.captureAnimationState()}function T(e){return A("dragOverCompleted",{insertion:e}),e&&(d?c._hideClone():c._showClone(p),p!==h&&(tl(Ol,Rl?Rl.options.ghostClass:c.options.ghostClass,!1),tl(Ol,a.ghostClass,!0)),Rl!==p&&p!==mc.active?Rl=p:p===mc.active&&Rl&&(Rl=null),h===p&&(p._ignoreWhileAnimating=s),p.animateAll((function(){A("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(s===Ol&&!Ol.animated||s===r&&!s.animated)&&(Xl=null),a.dragoverBubble||t.rootEl||s===document||(Ol.parentNode[vl]._isOutsideThisEl(t.target),!e&&pc(t)),!a.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),f=!0}function D(){$l=cl(Ol),Il=cl(Ol,a.draggable),xl({sortable:p,name:"change",toEl:r,newIndex:$l,newDraggableIndex:Il,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){Ya(document,"mousemove",this._onTouchMove),Ya(document,"touchmove",this._onTouchMove),Ya(document,"pointermove",this._onTouchMove),Ya(document,"dragover",pc),Ya(document,"mousemove",pc),Ya(document,"touchmove",pc)},_offUpEvents:function(){var t=this.el.ownerDocument;Ya(t,"mouseup",this._onDrop),Ya(t,"touchend",this._onDrop),Ya(t,"pointerup",this._onDrop),Ya(t,"touchcancel",this._onDrop),Ya(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;$l=cl(Ol),Il=cl(Ol,n.draggable),Sl("drop",this,{evt:t}),_l=Ol&&Ol.parentNode,$l=cl(Ol),Il=cl(Ol,n.draggable),mc.eventCanceled||(Zl=!1,tc=!1,Ql=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Cc(this.cloneId),Cc(this._dragStartId),this.nativeDraggable&&(Ya(document,"drop",this),Ya(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),qa&&el(document.body,"user-select",""),el(Ol,"transform",""),t&&(Hl&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),Nl&&Nl.parentNode&&Nl.parentNode.removeChild(Nl),(jl===_l||Rl&&"clone"!==Rl.lastPutMode)&&Tl&&Tl.parentNode&&Tl.parentNode.removeChild(Tl),Ol&&(this.nativeDraggable&&Ya(Ol,"dragend",this),vc(Ol),Ol.style["will-change"]="",Hl&&!Zl&&tl(Ol,Rl?Rl.options.ghostClass:this.options.ghostClass,!1),tl(Ol,this.options.chosenClass,!1),xl({sortable:this,name:"unchoose",toEl:_l,newIndex:null,newDraggableIndex:null,originalEvent:t}),jl!==_l?($l>=0&&(xl({rootEl:_l,name:"add",toEl:_l,fromEl:jl,originalEvent:t}),xl({sortable:this,name:"remove",toEl:_l,originalEvent:t}),xl({rootEl:_l,name:"sort",toEl:_l,fromEl:jl,originalEvent:t}),xl({sortable:this,name:"sort",toEl:_l,originalEvent:t})),Rl&&Rl.save()):$l!==Ll&&$l>=0&&(xl({sortable:this,name:"update",toEl:_l,originalEvent:t}),xl({sortable:this,name:"sort",toEl:_l,originalEvent:t})),mc.active&&(null!=$l&&-1!==$l||($l=Ll,Il=kl),xl({sortable:this,name:"end",toEl:_l,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){Sl("nulling",this),jl=Ol=_l=Nl=Al=Tl=Pl=Dl=Fl=Wl=Hl=$l=Il=Ll=kl=Xl=Vl=Rl=Ml=mc.dragged=mc.ghost=mc.clone=mc.active=null,oc.forEach((function(t){t.checked=!0})),oc.length=Bl=zl=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":Ol&&(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++)Ja(t=n[o],r.draggable,this.el,!1)&&e.push(t.getAttribute(r.dataIdAttr)||yc(t));return e},sort:function(t,e){var n={},o=this.el;this.toArray().forEach((function(t,e){var i=o.children[e];Ja(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 Ja(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=Cl.modifyOption(this,t,e);n[t]=void 0!==o?o:e,"group"===t&&dc(n)},destroy:function(){Sl("destroy",this);var t=this.el;t[vl]=null,Ya(t,"mousedown",this._onTapStart),Ya(t,"touchstart",this._onTapStart),Ya(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(Ya(t,"dragover",this),Ya(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),(function(t){t.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),Kl.splice(Kl.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!Dl){if(Sl("hideClone",this),mc.eventCanceled)return;el(Tl,"display","none"),this.options.removeCloneOnHide&&Tl.parentNode&&Tl.parentNode.removeChild(Tl),Dl=!0}},_showClone:function(t){if("clone"===t.lastPutMode){if(Dl){if(Sl("showClone",this),mc.eventCanceled)return;Ol.parentNode!=jl||this.options.group.revertClone?Al?jl.insertBefore(Tl,Al):jl.appendChild(Tl):jl.insertBefore(Tl,Ol),this.options.group.revertClone&&this.animate(Ol,Tl),el(Tl,"display",""),Dl=!1}}else this._hideClone()}},ic&&Va(document,"touchmove",(function(t){(mc.active||Zl)&&t.cancelable&&t.preventDefault()})),mc.utils={on:Va,off:Ya,css:el,find:ol,is:function(t,e){return!!Ja(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:pl,closest:Ja,toggleClass:tl,clone:ml,index:cl,nextTick:wc,cancelNextTick:Cc,detectDirection:cc,getChild:al,expando:vl},mc.get=function(t){return t[vl]},mc.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&&(mc.utils=$a($a({},mc.utils),t.utils)),Cl.mount(t)}))},mc.create=function(t,e){return new mc(t,e)},mc.version="1.15.3";var Ec,Sc,xc,Oc,_c,Nc,jc=[],Ac=!1;function Pc(){jc.forEach((function(t){clearInterval(t.pid)})),jc=[]}function Tc(){clearInterval(Nc)}var Dc=pl((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=il(),d=!1;Sc!==n&&(Sc=n,Pc(),Ec=e.scroll,i=e.scrollFn,!0===Ec&&(Ec=ul(n,!0)));var u=0,h=Ec;do{var p=h,f=rl(p),m=f.top,g=f.bottom,v=f.left,b=f.right,y=f.width,w=f.height,C=void 0,E=void 0,S=p.scrollWidth,x=p.scrollHeight,O=el(p),_=p.scrollLeft,N=p.scrollTop;p===c?(C=y<S&&("auto"===O.overflowX||"scroll"===O.overflowX||"visible"===O.overflowX),E=w<x&&("auto"===O.overflowY||"scroll"===O.overflowY||"visible"===O.overflowY)):(C=y<S&&("auto"===O.overflowX||"scroll"===O.overflowX),E=w<x&&("auto"===O.overflowY||"scroll"===O.overflowY));var j=C&&(Math.abs(b-r)<=a&&_+y<S)-(Math.abs(v-r)<=a&&!!_),A=E&&(Math.abs(g-s)<=a&&N+w<x)-(Math.abs(m-s)<=a&&!!N);if(!jc[u])for(var P=0;P<=u;P++)jc[P]||(jc[P]={});jc[u].vx==j&&jc[u].vy==A&&jc[u].el===p||(jc[u].el=p,jc[u].vx=j,jc[u].vy=A,clearInterval(jc[u].pid),0==j&&0==A||(d=!0,jc[u].pid=setInterval(function(){o&&0===this.layer&&mc.active._onTouchMove(_c);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(mc.dragged.parentNode[vl],n,e,t,_c,jc[this.layer].el)||fl(jc[this.layer].el,n,e)}.bind({layer:u}),24))),u++}while(e.bubbleScroll&&h!==c&&(h=ul(h,!1)));Ac=d}}),30),Lc=function(t){var e=t.originalEvent,n=t.putSortable,o=t.dragEl,i=t.activeSortable,r=t.dispatchSortableEvent,s=t.hideGhostForTarget,a=t.unhideGhostForTarget;if(e){var l=n||i;s();var c=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e,d=document.elementFromPoint(c.clientX,c.clientY);a(),l&&!l.el.contains(d)&&(r("spill"),this.onSpill({dragEl:o,putSortable:n}))}};function $c(){}function kc(){}$c.prototype={startIndex:null,dragStart:function(t){var e=t.oldDraggableIndex;this.startIndex=e},onSpill:function(t){var e=t.dragEl,n=t.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var o=al(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:Lc},Ma($c,{pluginName:"revertOnSpill"}),kc.prototype={onSpill:function(t){var e=t.dragEl,n=t.putSortable||this.sortable;n.captureAnimationState(),e.parentNode&&e.parentNode.removeChild(e),n.animateAll()},drop:Lc},Ma(kc,{pluginName:"removeOnSpill"}),mc.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?Va(document,"dragover",this._handleAutoScroll):this.options.supportPointer?Va(document,"pointermove",this._handleFallbackAutoScroll):e.touches?Va(document,"touchmove",this._handleFallbackAutoScroll):Va(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(t){var e=t.originalEvent;this.options.dragOverBubble||e.rootEl||this._handleAutoScroll(e)},drop:function(){this.sortable.nativeDraggable?Ya(document,"dragover",this._handleAutoScroll):(Ya(document,"pointermove",this._handleFallbackAutoScroll),Ya(document,"touchmove",this._handleFallbackAutoScroll),Ya(document,"mousemove",this._handleFallbackAutoScroll)),Tc(),Pc(),clearTimeout(Ka),Ka=void 0},nulling:function(){_c=Sc=Ec=Ac=Nc=xc=Oc=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(_c=t,e||this.options.forceAutoScrollFallback||Ba||Wa||qa){Dc(t,this.options,r,e);var s=ul(r,!0);!Ac||Nc&&o===xc&&i===Oc||(Nc&&Tc(),Nc=setInterval((function(){var r=ul(document.elementFromPoint(o,i),!0);r!==s&&(s=r,Pc()),Dc(t,n.options,r,e)}),10),xc=o,Oc=i)}else{if(!this.options.bubbleScroll||ul(r,!0)===il())return void Pc();Dc(t,this.options,ul(r,!1),!1)}}},Ma(t,{pluginName:"scroll",initializeByDefault:!0})}),mc.mount(kc,$c);const Ic={add:{attr:t=>{const e=window.prompt(t.message.attr);if(e&&t.isDisabled(e))return window.alert(s.get("attributeNotPermitted",e||"")),Mc.add.attrs(t);let n;e&&(n=String(window.prompt(t.message.value,"")),t.addAction(e,n))},option:t=>{t.addAction()},condition:t=>{t.addAction(t)}},click:{btn:t=>{t.action()}},save:{form:lr}},Mc={init:function(t){const e=Object.keys(Ic);return this.opts=e.reduce(((e,n)=>(e[n]={...Ic[n],...t[n]},e)),t),this},add:{attrs:t=>Mc.opts.add.attr(t),options:t=>Mc.opts.add.option(t),conditions:t=>(t.template={if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]},Mc.opts.add.condition(t))},click:{btn:t=>Mc.opts.click.btn(t)},save:{form:t=>(Mc.opts.sessionStorage&&ir.set(G,t),us.formeoSaved({formData:t}),Mc.opts.save.form(t))}},Rc=Object.freeze({type:"field",displayType:"slider"}),Fc=t=>({transform:`translateX(${t?`${t}px`:0})`});class Wc{constructor(t){n(this,"toggleTabbedLayout",(()=>{this.getPanelDisplay();const t=this.isTabbed;return this.panelsWrap.parentElement.classList.toggle("tabbed-panels",t),t&&this.panelNav.removeAttribute("style"),t})),n(this,"resizePanels",(()=>{this.toggleTabbedLayout();const t=this.panelsWrap.style,e=Ud.getStyle(this.currentPanel,"height");return t.height=e,e})),this.opts=tr(Rc,t),this.panelDisplay=this.opts.displayType,this.activePanelIndex=0,this.panelNav=this.createPanelNav();const e=this.createPanelsWrap();this.nav=this.navActions();const o=new window.ResizeObserver((([{contentRect:{width:t}}])=>{this.currentWidth!==t&&(this.toggleTabbedLayout(),this.currentWidth=t,this.nav.setTranslateX(this.activePanelIndex,!1))})),i=window.setTimeout((()=>{o.observe(e),window.clearTimeout(i)}),Q)}getPanelDisplay(){const t=this.panelsWrap,e=Number.parseInt(Ud.getStyle(t,"width"))>390?"tabbed":"slider",n="auto"===this.opts.displayType;return this.panelDisplay=n?e:this.opts.displayType||Rc.displayType,this.panelDisplay}createPanelsWrap(){const t=Ud.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 ss.forEach(e,(t=>{t.fieldId=this.opts.id,t.isSortable&&mc.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=Qr(t.target,t.target.parentElement);this.nav.setTranslateX(e,!1),this.nav.groupChange(e)}},content:t.config.label}))),e={className:"panel-labels",content:{content:t}},[n]=t;return n.className="active-tab",Ud.create(e)}createPanelNav(){this.labels=this.createPanelNavLabels();const t={tag:"button",attrs:{className:"next-group",title:s.get("controlGroups.nextGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.nextGroup(t)},content:Ud.icon("triangle-right")},e={tag:"button",attrs:{className:"prev-group",title:s.get("controlGroups.prevGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.prevGroup(t)},content:Ud.icon("triangle-left")};return Ud.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=Qr(this.currentPanel,e);let r={nav:0,panel:0},s={...r};t.groupChange=t=>(this.activePanelIndex=t,this.currentPanel=i[t],Ud.removeClasses(i,"active-panel"),Ud.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=K,animate:r=!this.isTabbed})=>{const a=[Fc(s.panel),Fc(t.panel)],l=[Fc(s.nav),Fc(this.isTabbed?0:t.nav)];if(o){const[t]=a,[e]=l;a.push(t),l.push(e)}const c={easing:"ease-in-out",duration:r?i:0,fill:"forwards"},d=e.animate(a,c);n.animate(l,c);const u=()=>{this.panelsWrap.style.height=Ud.getStyle(this.currentPanel,"height"),d.removeEventListener("finish",u),o||(s=t)};d.addEventListener("finish",u)};return t.setTranslateX=(t=this.activePanelIndex,o=!0)=>{var i;i=t,r={nav:-n.offsetWidth*i,panel:-e.offsetWidth*i},a({offset:r,animate:o})},t.refresh=(e=this.activePanelIndex)=>{this.activePanelIndex!==e&&t.groupChange(e),t.setTranslateX(this.activePanelIndex,!1),this.resizePanels()},t.nextGroup=()=>{const e=this.activePanelIndex+1;if(e!==i.length){const o=i[e];r={nav:-n.offsetWidth*e,panel:-o.offsetLeft},a({offset:r}),t.groupChange(e)}else r={nav:s.nav-8,panel:s.panel-8},a({offset:r,reset:!0});return this.currentPanel},t.prevGroup=()=>{if(0!==this.activePanelIndex){const e=this.activePanelIndex-1,o=i[e];r={nav:-n.offsetWidth*e,panel:-o.offsetLeft},a({offset:r}),t.groupChange(e)}else r={nav:8,panel:8},a({offset:r,reset:!0})},t}}const Bc="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`)),zc=new RegExp(`(?!${Bc.join("|")})\\w\\S*`,"g"),qc=/\s+/g;function Uc(t){if("string"!=typeof t)return t;if(t.trim().match(qc))return t;return t.replace(zc,(t=>t.charAt(0).toUpperCase()+t.substring(1).replace(/[A-Z]/g,(t=>` ${t}`))))}const Hc=(t,e="-")=>t.toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,e),Xc="f-autocomplete",Vc="highlight-component",Yc=({name:t,id:e,...n})=>["config.label","config.controlId","meta.id","attrs.id"].reduce(((t,e)=>t||n.get(e)),null)||"external"===t&&((...t)=>s.get(t.join("."))||Uc(t.join(" ")))(t,e);class Gc{constructor(t,e,o){n(this,"lastCache",Date.now()),n(this,"optionsCache",null),this.key=t,this.className=t.replace(/\./g,"-"),this.value=e,this.events=[],this.i18nKey=o,this.build()}build(){const t=t=>{const e=this.list,n=this.getActiveOption();let o=new Map([[38,()=>{const t=this.getPreviousOption(n);t&&this.selectOption(t)}],[40,()=>{const t=this.getNextOption(n);t&&this.selectOption(t)}],[13,()=>{n&&(this.selectOption(n),this.setValue(n),"none"===e.style.display?this.showList(n):this.hideList()),t.preventDefault()}],[27,()=>{this.hideList()}]]).get(t.keyCode);return o||(o=()=>!1),o()},e={focus:({target:e})=>{this.updateOptions(),e.parentElement.classList.add(`${this.className}-focused`);const n=Ud.toggleElementsByStr(this.list.querySelectorAll("li"),e.value);e.addEventListener("keydown",t);const o=this.list.querySelector(".active-option")||n[0];this.showList(o)},blur:({target:e})=>{e.parentElement.classList.remove(`${this.className}-focused`),e.removeEventListener("keydown",t),this.hideList()},input:t=>{const e=Ud.toggleElementsByStr(this.list.querySelectorAll("li"),t.target.value);if(0===t.target.value.length&&this.clearValue(),0===e.length)this.hideList();else{const t=this.getActiveOption()||e[0];this.showList(t)}const n=t.target.value.trim();this.hiddenField.value=n,this.value=n,this.setValue({dataset:{label:n,value:n}})}};return this.displayField=Ud.create({tag:"input",autocomplete:"off",action:e,attrs:{type:"text",className:`${Xc}-display-field`,value:this.label||this.value,placeholder:s.get(`${this.i18nKey}.${this.key}.placeholder`)}}),this.hiddenField=Ud.create({tag:"input",attrs:{type:"hidden",className:this.className,value:this.value}}),this.list=Ud.create({tag:"ul",attrs:{className:`${Xc}-list`}}),this.dom=Ud.create({children:[this.displayField,this.hiddenField],className:this.className,action:{onRender:t=>{this.stage=t.closest(".formeo-stage");const e=this.value&&Bd.getAddress(this.value);this.label=e&&Yc(e),this.label&&(this.displayField.value=this.label)}}}),this.dom}updateOptions(){let t=this.optionsCache;const e=Date.now();(!t||e-this.lastCache>10*Q)&&(Ud.empty(this.list),t=this.generateOptions(),this.lastCache=e),this.list.children.length||this.list.append(...t)}generateOptions(){const t=(t=>{const e=[],n=Bd.flatList(),o=Object.entries(n).map((([n,o])=>{const i=Yc(o);if(i){const r={tag:"span",content:` ${Uc(o.name)}`,className:"component-type"},s=`${o.name}.${i}`;e.push(s);const a=((t,e)=>{const n=t.reduce(((t,n)=>t+(n===e)),0);return n>1?`(${n})`:""})(e,s),l=[`${i} `,{tag:"span",content:a,className:"component-label-count"},r];return(({id:t,textLabel:e,htmlLabel:n,selectedId:o})=>{const i={value:t,textLabel:e,htmlLabel:n};return t===o&&(i.selected=!0),i})({id:n,textLabel:[i,a].join(" ").trim(),htmlLabel:l,selectedId:t})}}));return o.filter(Boolean)})(),e=t=>{const e=`${Xc}-list-item`;return t.classList.contains(e)||(t=t.parentElement),t};return this.optionsCache=t.map((t=>{const{value:n,textLabel:o,htmlLabel:i}=t,r={tag:"li",children:i,dataset:{value:n,label:o},className:`${Xc}-list-item`,action:{mousedown:({target:t})=>{t=e(t),this.setValue(t),this.selectOption(t),this.hideList()},mouseover:({target:t})=>{t=e(t),this.removeHighlight(),this.highlightComponent(t)}}};return Ud.create(r)})),this.optionsCache}setListPosition(){const{offsetHeight:t,offsetWidth:e}=this.displayField,n=this.displayField.closest(".formeo-stage").getBoundingClientRect(),o=this.displayField.getBoundingClientRect(),i={position:"absolute",top:o.y+t+window.scrollY-n.y+"px",left:o.x+window.scrollX-n.x+"px",width:`${e+1}px`};Object.assign(this.list.style,i)}showList(t,e=this.list){this.stage.contains(this.list)||this.stage.appendChild(this.list),this.setListPosition(),this.selectOption(t),as.slideDown(e,K)}hideList(t=this.list){as.slideUp(t,K),this.removeHighlight(),this.stage.contains(this.list)&&this.stage.removeChild(this.list)}getActiveOption(t=this.list){const e=t.querySelector(".active-option");return"none"!==(null==e?void 0:e.style.display)?e:null}getPreviousOption(t){let e=t;do{e=e?e.previousSibling:null}while(null!=e&&"none"===e.style.display);return e}getNextOption(t){let e=t;do{e=e?e.nextSibling:null}while(null!=e&&"none"===e.style.display);return e}selectOption(t,e=this.list){var n;const o=e.querySelectorAll("li");for(const i of o){const{dataset:{value:t}}=i;if(i.classList.remove("active-option"),t){null==(n=Bd.getAddress(t).dom)||n.classList.remove(Vc)}}t&&(t.classList.add("active-option"),this.highlightComponent(t))}removeHighlight(){const t=document.getElementsByClassName(Vc);for(const e of t)e.classList.remove(Vc)}highlightComponent(t){var e;const{dataset:{value:n}}=t;if(n){null==(e=Bd.getAddress(n).dom)||e.classList.add(Vc)}}clearValue(){this.selectOption(null),this.displayField.value="",this.hiddenField.value="",this.value="",this.runEvent("onChange",{target:this.hiddenField})}setValue(t){const{label:e,value:n}=t.dataset;this.displayField.value=e,this.hiddenField.value=n,this.value=n,this.runEvent("onChange",{target:this.hiddenField})}addEvent(t,e){this.events.push([t,e])}runEvent(t,e){for(const[n,o]of this.events)n===t&&o(e)}}const Zc=(t,e)=>{const n=(t=>{const e=sr(t),n={"field.property":it,...rt},o=e?(i=t,Bd.getAddress(i).getData()):n[t];var i;return Object.keys(o).reduce(((t,e)=>(t[e]=e,t)),{})})(t);return Object.entries(n).reduce(((n,[o,i])=>{if("id"!==o){const r={tag:"option",content:s.get(`${t}.${o}`)||o.toLowerCase(),attrs:{value:i}};e===i&&(r.attrs.selected=!0),n.push(Ud.create(r))}return n}),[])},Jc=(t,e)=>{Ud.empty(t);for(const n of e)t.add(n)},Kc=({key:t,value:e,type:n="text",checked:o})=>{const i={tag:"input",attrs:{type:n,value:e,placeholder:s.get(`${t}.placeholder`)||Uc(t)},className:t.replace(/\./g,"-"),config:{}};return o&&(i.attrs.checked=!0),i},Qc=t=>{const e=s.get(t);if(e)return e;const n=t.split(".");return s.get(n[n.length-1])},td={autocomplete:(t,e,n)=>new Gc(t,e,n),string:(t,e)=>Kc({key:t,value:e}),boolean:(t,e)=>Kc({key:t,value:e,type:"selected"===t?"radio":"checkbox",checked:e}),number:(t,e)=>Kc({key:t,value:e,type:"number"}),array:(t,e=[])=>({tag:"select",attrs:{placeholder:Qc(`placeholder.${t}`)},className:t.replace(/\./g,"-"),options:e}),object:t=>Object.entries(t).map((([t,e])=>td[Ud.childType(e)](t,e)))},ed=["selected","checked"],nd={boolean:(t,e)=>({click:({target:{checked:n}})=>{var o,i;"radio"===(null==(i=null==(o=e.data)?void 0:o.attrs)?void 0:i.type)&&e.set("options",e.data.options.map((t=>({...t,selected:!1})))),e.set(t,n)}}),string:(t,e)=>({input:({target:{value:n}})=>{e.set(t,n)}}),number:(t,e)=>({input:({target:{value:n}})=>{e.set(t,Number(n))}}),array:(t,e)=>({change:({target:{value:n}})=>{e.set(t,n)}}),object:()=>({})};class od{constructor({key:t,data:e,index:o,field:i}){n(this,"generateConditionFields",((t,e)=>{const n={tag:"label",className:`condition-label ${t}-condition-label`,content:s.get(t)||t};return e.map(((e,o)=>{const i=[],r=Object.entries(e).map((([e,n])=>{const r=this.conditionInput(e,n,t,o);return r&&i.push([r.className,n.trim()].filter(Boolean).join("-")),r})).filter(Boolean),s=ts(r,ot.map((t=>`condition-${t}`)),"className||dom.className");return this.processConditionUIState(s),o||s.unshift(n),this.itemFieldGroups.push(s),{children:s,className:`f-condition-row ${t}-condition-row ${i.join(" ")}`}}))})),n(this,"processConditionUIState",(t=>{const e=e=>(e=e.split("|"),t.filter((t=>e.includes(t.className)))),n=t=>{t=Array.isArray(t)?t:[t];const e=setTimeout((()=>{t.forEach((t=>{t.dom&&(t=t.dom),t.style.display="none"})),clearTimeout(e)}),J)},o=t=>{t=Array.isArray(t)?t:[t];const e=setTimeout((()=>{t.forEach((t=>{t.dom&&(t=t.dom),t.removeAttribute("style")})),clearTimeout(e)}),J)},i=new Map([["condition-source",t=>{const i=e("condition-sourceProperty"),r=i[0],s=sr(t.value)?t.value:"field.property",a=Zc(s,r.value);return Jc(r,a),t.value?o(i):n(i)}],["condition-target",t=>{const i=e("condition-targetProperty");return rr(t.value)&&t.value?o(i):n(i)}],["condition-sourceProperty",t=>{const i=e("condition-comparison|condition-targetProperty|condition-target"),r=t.value;return(t=>/^is|^has/.test(t))(r.substring(r.lastIndexOf(".")+1,r.length))?n(i):o(i)}]]);for(const r of t){const t=i.get(r.className);t&&t(r)}})),n(this,"conditionInput",((t,e,n,o)=>{const i=this.field,r=`${this.itemKey}.${n}.${o}`,s=`${this.field.id}.${r}`,a=`${i.name}s.${s}.${t}`,l=(t,e,n)=>{const o=Zc(n||t,e),i=td.array(`condition.${t}`);i.action={change:c,onRender:t=>c({target:t})};const r=Ud.create(i);return Jc(r,o),r},c=({target:t})=>{const e=t.closest(".f-condition-row"),n=new RegExp(`${t.className}(?:\\S?)+`,"gm");e.className=e.className.replace(n,"");const o={dataPath:a,value:t.value,src:t};us.formeoUpdated(o),Bd.setAddress(a,t.value);const i=Qr(e);this.processConditionUIState(this.itemFieldGroups[i])},d={comparison:t=>l("comparison",t),logical:t=>l("logical",t),source:(t,e="source")=>{const o=td.autocomplete(`condition.${e}`,t,n);return Bd.setConditionMap(t,i),o.addEvent("onChange",(t=>{Bd.removeConditionMap(Bd.getAddress(a)),c(t),Bd.setConditionMap(t.target.value,i)})),o},sourceProperty:t=>l("sourceProperty",t,"field.property"),targetProperty:t=>l("targetProperty",t,"field.property"),target:t=>d.source(t,"target"),value:t=>{const e=td.string("condition.value",t);return e.action={input:c},Ud.create(e)},assignment:t=>l("assignment",t)};if(d[t])return d[t](e)})),this.itemValues=ts(Object.entries(e),ed,"0");const[r,a]=t.split(".");this.field=i,this.itemKey=t,this.itemIndex=o,this.panelName=r,this.isDisabled=i.isDisabledProp(a,r),this.isHidden=this.isDisabled&&i.config.panels[r].hideDisabled,this.isLocked=i.isLockedProp(a,r),this.dom=Ud.create({tag:"li",className:[`field-${t.replace(/\./g,"-")}`,"prop-wrap",this.isHidden&&"hidden-property"],children:{className:"field-prop",children:[this.itemInputs,this.itemControls]}})}get itemInputs(){this.itemFieldGroups=[];return{className:`${this.panelName}-prop-inputs prop-inputs f-input-group`,children:this.itemValues.map((([t,e])=>{let n="conditions"===this.panelName?this.generateConditionFields(t,e):this.itemInput(t,e);return["selected","checked"].includes(t)&&(n={className:"f-addon",children:n}),n}))}}get itemControls(){if(this.isLocked){return{className:`${this.panelName}-prop-controls prop-controls`,content:[]}}const t={tag:"button",attrs:{type:"button",className:"prop-remove prop-control"},action:{click:()=>{as.slideUp(this.dom,250,(t=>{this.field.remove(this.itemKey),Ud.remove(t),this.field.resizePanelWrap()}))}},content:Ud.icon("remove")};return{className:`${this.panelName}-prop-controls prop-controls`,content:[t]}}itemInput(t,e){const n=Ud.childType(e)||"string",o={config:{},attrs:{},...td[n](t,e)},i=this.itemKey.replace(/.\d+$/,(e=>`${e}.${t}`)),r=i.split(".").filter(Number.isNaN).join(".")||t,[s,a]=[[...this.itemKey.split("."),t],[t]].map((t=>[this.field.id,...t].filter(Boolean).join("-")));return o.config={...o.config,label:"options"!==this.panelName&&(Qc(r)||Uc(r)),labelAfter:!1},o.attrs={...o.attrs,name:"checkbox"===o.attrs.type?`${a}[]`:a,id:s,disabled:this.isDisabled,locked:this.isLocked},o.action={...nd[n](i,this.field)},o}}class id{constructor(t,e,o){n(this,"addAttribute",((t,e)=>{let n=e;const o=Hc(t),i=`attrs.${o}`;s.current[i]||s.put(i,is(t)),"string"==typeof n&&["true","false"].includes(n)&&(n=JSON.parse(n)),this.field.set(`attrs.${t}`,n);const r=this.props.querySelector(`.field-attrs-${o}`),a=new od({key:i,data:{[o]:n},field:this.field});r?this.props.replaceChild(a.dom,r):this.props.appendChild(a.dom),this.field.resizePanelWrap()})),n(this,"addOption",(()=>{const t=this.field.data.config.controlId,e=this.field.get("options"),n="select"===t?"option":t,o=s.get("newOptionLabel",{type:n})||"New Option",i=`options.${this.data.length}`,r=e[e.length-1],a={...e.length?r:{},label:o};"button"!==t&&(a.value=Hc(o));const l=new od({key:i,data:a,field:this.field,index:this.props.children.length});this.editPanelItems.push(l),this.props.appendChild(l.dom),this.field.set(i,a),this.field.resizePanelWrap()})),n(this,"addCondition",(t=>{const e=`conditions.${this.field.get("conditions").length}`,n=this.props.querySelector(`.field-${e.replace(".","-")}`),o=new od({key:e,data:t.template,field:this.field});n?this.props.replaceChild(o.dom,n):this.props.appendChild(o.dom),this.field.set(e,t.template),this.field.resizePanelWrap()})),this.type=Ud.childType(t),this.data="object"===this.type?Object.entries(t):t,this.name=e,this.field=o,this.panelConfig=this.getPanelConfig(this.data)}getPanelConfig(t){return this.props=this.createProps(t),this.editButtons=this.createEditButtons(),{id:`${this.field.id}-${this.name}-panel`,config:{label:s.get(`panel.label.${this.name}`)},attrs:{className:`f-panel ${this.name}-panel`},children:[this.props,this.editButtons]}}createProps(t){this.editPanelItems=Array.from(t).map(((t,e)=>{const n="array"===this.type,o=[this.name,n?String(e):t[0]].join("."),i=n?t:{[t[0]]:t[1]};return new od({key:o,data:i,field:this.field})}));const e={tag:"ul",attrs:{className:["field-edit-group",`field-edit-${this.name}`]},editGroup:this.name,isSortable:"options"===this.name,content:this.editPanelItems};return Ud.create(e)}createEditButtons(){const t=this,e=this.name,n=s.get(`panelEditButtons.${e}`),o={attrs:t.addAttribute,options:t.addOption,conditions:t.addCondition};return{className:"panel-action-buttons",content:[{...Ud.btnTemplate({content:n,title:n}),className:`add-${e}`,action:{click:n=>{const i={btnCoords:Ud.coords(n.target),addAction:o[e]};"attrs"===e&&(i.isDisabled=t.field.isDisabledProp,i.isLocked=t.field.isLockedProp,i.message={attr:s.get(`action.add.${e}.attr`),value:s.get(`action.add.${e}.value`)});const r=Uc(e),a=new window.CustomEvent(`onAdd${r}`,{detail:i});Mc.add[e](i),document.dispatchEvent(a)}}}]}}}class rd extends Da{constructor(t,e={},o){const i={...e,id:e.id||Qi()};super(t,i),n(this,"mutationHandler",(t=>t.map((t=>{})))),n(this,"remove",(t=>{if(t){const e=t.split("."),n=e.pop(),o=this.get(e);return Array.isArray(o)?Kr(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 es(n,(t=>t.remove())),this.dom.parentElement.removeChild(this.dom),((t,e)=>{const n=t.indexOf(e);-1!==n&&t.splice(n,1)})(Bd.getAddress(`${e.name}s.${e.id}.children`),this.id),e.children.length||e.emptyClass(),"row"===e.name&&e.autoColumnWidths(),Bd[`${this.name}s`].delete(this.id)})),n(this,"emptyClass",(()=>this.dom.classList.toggle("empty",!this.children.length))),n(this,"getComponentTag",(()=>Ud.create({tag:"span",className:["component-tag",`${this.name}-tag`],children:[(this.isColumn||this.isField)&&Ud.icon("component-corner",{className:"bottom-left"}),Ud.icon(`handle-${this.name}`),Uc(this.name),(this.isColumn||this.isRow)&&Ud.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[Ud.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-${Ji(t)}`),null==e||e.classList.remove(`hovering-${Ji(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,!it[i]].some(Boolean)?t:e?o.set(it[i],e):o.get(it[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={...er(this.data),id:Qi()};return"field"!==this.name&&(t.children=[]),t})),n(this,"clone",((t=this.parent)=>{const e=t.addChild(this.cloneData(),this.index+1);return"field"!==this.name&&this.cloneChildren(e),e})),n(this,"createChildWrap",(t=>Ud.create({tag:"ul",attrs:{className:"children"},children:t}))),this.id=i.id,this.name=t,this.config=Bd[`${this.name}s`].config,tr(this.config,i.config),this.dataPath=`${this.name}s.${this.id}.`,this.observer=new window.MutationObserver(this.mutationHandler),this.render=o}observe(t){this.observer.disconnect(),this.observer.observe(t,{childList:!0})}get js(){return this.data}get json(){return this.data}empty(){const t=this.children.map((t=>{t.remove()}));return this.dom.classList.add("empty"),t}getActionButtons(){const t=[`hovering-${this.name}`,"hovering"];return{className:[`${this.name}-actions`,"group-actions"],action:{mouseenter:()=>{Bd.stages.active.dom.classList.add(`active-hover-${this.name}`),this.dom.classList.add(...t)},mouseleave:({target:e})=>{this.dom.classList.remove(...t),Bd.stages.active.dom.classList.remove(`active-hover-${this.name}`),e.removeAttribute("style")}},children:[{...Ud.btnTemplate({content:Ud.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`);as.slideToggle(i,J,t),"field"===this.name&&(as.slideToggle(this.preview,J,!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}`)=>({...Ud.btnTemplate({content:Ud.icon(t)}),className:["component-handle"]}),move:(t="move")=>({...Ud.btnTemplate({content:Ud.icon(t)}),className:["item-move"],meta:{id:"move"}}),edit:(t="edit")=>({...Ud.btnTemplate({content:Ud.icon(t)}),className:["item-edit-toggle"],meta:{id:"edit"},action:{click:t=>{this.toggleEdit()}}}),remove:(t="remove")=>({...Ud.btnTemplate({content:Ud.icon(t)}),className:["item-remove"],meta:{id:"remove"},action:{click:(t,e)=>{as.slideUp(this.dom,J,(()=>{if("column"===this.name){this.parent.autoColumnWidths(),this.remove()}else this.remove()}))}}}),clone:(t="copy")=>({...Ud.btnTemplate({content:Ud.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 Qr(this.dom)}get parentType(){return X.get(this.name)}get parent(){const t=this.parentType;if(!this.dom||!t)return null;const e=this.dom.closest(`.${F[t]}`);return e&&Ud.asComponent(e)}get children(){if(!this.dom)return[];const t=this.domChildren,e=H.get(this.name);return ns(t,(t=>Bd.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=Qi()}=i,a=H.get(this.name);if(!a)return null;const l=`${a}s`,c=Bd.getAddress(`${l}.${s}`)||Bd[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(N)||(t=t.parentElement);const r=Ji(t),s=Ji(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=Qr(this.dom);return()=>this.parent.addChild(t,e+1)}],[2,t=>()=>this.parent.parent.addChild(t)]]),l={controls:()=>{const{controlData:{meta:{id:t},...e}}=yd.get(n.id);Jr(e,"config.controlId",t);const i=t.startsWith("layout-")?t.replace(/^layout-/,""):"field",r=Zr({stage:{row:0,column:-1,field:-2},row:{row:1,column:0,field:-1},column:{row:2,column:1,field:0},field:1},`${this.name}.${i}`),s=a.get(r)();Ud.remove(n);return s(e,o)},row:()=>{const t=(a.get({stage:-1,row:0,column:1}[s])||lr)();return null==t?void 0:t({id:n.id},o)},column:()=>{const t=(a.get({stage:-2,row:-1}[s])||lr)();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(P)&&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&&Ud.onRender(this.dom,t.onRender)}set config(t){const e=Zr(t,"all"),n=Zr(this.data,"config.controlId"),o=[e,n&&Zr(t,n),Zr(t,this.id)].reduce(((t,e)=>e?tr(t,e):t),this.configVal);this.configVal=o}get config(){return this.configVal}getComponent(t){const[e,n]=t.split("."),o=Bd[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===M.row}get isColumn(){return this.name===M.column}get isField(){return this.name===M.field}}class sd extends rd{constructor(t=Object.create(null)){super("field",{conditions:[{if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]}],...t}),n(this,"setData",((t,e)=>super.set(t,e))),n(this,"updateConditionsPanel",ar((()=>{const t=this.editPanels.find((({name:t})=>"conditions"===t));if(!t)return null;const e=t.createProps(),n=this.dom.querySelector(".field-edit-conditions");n.parentElement.replaceChild(e,n)}),J)),n(this,"updatePreview",(()=>{if(!this.preview.parentElement)return null;this.updateLabel();const t=Ud.create(this.fieldPreview(),!0);this.preview.parentElement.replaceChild(t,this.preview),this.preview=t})),n(this,"updateEditPanels",(()=>{this.editPanels=[];const t=["object","array"],e=Ki([...this.config.panels.order,...Object.keys(this.data)]),n=["config","meta","action","events",...this.config.panels.disabled],o=e.filter((t=>!n.includes(t)));for(const r of o){const e=this.get(r),n=Ud.childType(e);if(t.includes(n)){const t=new id(e,r,this);this.editPanels.push(t)}}const i={panels:this.editPanels.map((({panelConfig:t})=>t)),id:this.id,displayType:"auto"};this.panels=new Wc(i),this.dom&&(this.dom.querySelector(".panel-nav").replaceWith(this.panels.panelNav),this.dom.querySelector(".panels").replaceWith(this.panels.panelsWrap))})),n(this,"toggleCheckedOptions",((t,e)=>{const n=this.get("options").map(((n,o)=>{const i=o===t;return"radio"===e?n.selected=i:n.checked=i?!n.checked:n.checked,n}));this.set("options",n)})),n(this,"isDisabledProp",((t,e="attrs")=>{const n=this.config.panels[e];if(!n)return!1;return n.disabled.concat(this.get(`config.disabled${Uc(e)}`)).includes(t)})),n(this,"isLockedProp",((t,e="attrs")=>{const n=this.config.panels[e];if(!n)return!1;return n.locked.concat(this.get(`config.locked${Uc(e)}`)).includes(t)})),this.debouncedUpdateEditPanels=function(t,e=333){let n;return function(...o){n&&clearTimeout(n),n=setTimeout((()=>t.apply(this,o)),e)}}(this.updateEditPanels),this.label=Ud.create(this.labelConfig),this.preview=Ud.create({}),this.editPanels=[];const e=this.getActionButtons(),o=this.actionButtons.some((t=>{var e;return"edit"===(null==(e=t.meta)?void 0:e.id)}));let i={tag:"li",attrs:{className:T},id:this.id,children:[this.label,this.getComponentTag(),e,o&&this.fieldEdit,this.preview].filter(Boolean),panelNav:this.panelNav,dataset:{hoverTag:s.get("field")}};i=Ud.create(i),this.observe(i),this.dom=i,this.isEditing=!1,this.onRender(i)}get labelConfig(){if(!!this.get("config.hideLabel"))return null;const t=this.get("config.editorLabel")||this.get("config.label"),e=this.get("attrs.required"),n=this.config.label.disableHTML;return{className:"prev-label",children:[{...(()=>{const e={tag:"label",attrs:{}};return n?(e.tag="input",e.attrs.value=t,e):(e.attrs.contenteditable=!0,e.children=t,e)})(),action:{input:({target:{innerHTML:t,innerText:e,value:o}})=>{super.set("config.label",n?o:t);const i=Bd.getConditionMap(`fields.${this.id}`);if(i)return i.updateConditionSourceLabel(`${this.name}s.${this.id}`,n?o:e)}}},e&&Ud.requiredMark()]}}updateConditionSourceLabel(t,e){const n=this.editPanels.find((({name:t})=>"conditions"===t));if(!n)return null;for(const{itemFieldGroups:o}of n.editPanelItems)for(const n of o){const o=n.find((e=>e.value===t));o&&(o.displayField.value=e)}}set(t,e){const n=this.setData(t,e);return this.updatePreview(),n}updateLabel(){if(!this.label)return null;const t=Ud.create(this.labelConfig);this.label.parentElement.replaceChild(t,this.label),this.label=t}get fieldEdit(){const t={className:["field-edit","slide-toggle","formeo-panels-wrap"]};this.updateEditPanels();const e=this.editPanels.length;return e&&(t.className.push(`panel-count-${e}`),t.content=[this.panels.panelNav,this.panels.panelsWrap],this.panelNav=this.panels.nav,this.resizePanelWrap=this.panels.nav.refresh),t.action={onRender:()=>{if(0===e){const t=this.dom,e=t.querySelector(".item-edit-toggle"),n=t.querySelector(".field-actions"),o=n.getElementsByTagName("button");n.style.maxWidth=o.length*o[0].clientWidth+"px",Ud.remove(e)}else this.resizePanelWrap()}},Ud.create(t)}get defaultPreviewActions(){return{change:t=>{const{target:e}=t,{type:n}=e;if(["checkbox","radio"].includes(n)){const t=+e.id.split("-").pop();this.toggleCheckedOptions(t,n),this.debouncedUpdateEditPanels()}},click:t=>{"true"===t.target.contentEditable&&t.preventDefault()},input:t=>{if(["input","meter","progress","button"].includes(t.target.tagName.toLowerCase()))return super.set("attrs.value",t.target.value),this.debouncedUpdateEditPanels();if(t.target.contentEditable){const e=t.target,n=e.parentElement.classList;if(n.contains("f-checkbox")||n.contains("f-radio")){const t=e.parentElement,n=t.parentElement,o=Qr(t,n);return this.setData(`options[${o}].label`,e.innerHTML),this.debouncedUpdateEditPanels()}this.setData("content",e.innerHTML||e.value)}}}}fieldPreview(){var t;const e=er(this.data),{action:n={}}=yd.get(e.config.controlId);e.id=`prev-${this.id}`,e.action=Object.entries(n).reduce(((t,[e,n])=>(t[e]=n.bind(this),t)),{}),(null==(t=this.data)?void 0:t.config.editableContent)&&(e.attrs={...e.attrs,contenteditable:!0});return{attrs:{className:"field-preview",style:this.isEditing&&"display: none;"},content:Ud.create(e,!0),action:this.defaultPreviewActions}}}const ad={js:new Set,css:new Set},ld=(t,e,n=cr)=>new Promise((o=>fetch(t).then((t=>{if(!t.ok)return o(n(t));o(e?e(t):t)})).catch((t=>n(t))))),cd=(t,e)=>{t.removeEventListener("load",cd),e(t.src)},dd=(t,e)=>{t.removeEventListener("load",dd),e(t.src)},ud=t=>new Promise(((e,n)=>{if(ad.js.has(t))return e(t);ad.js.add(t);const o=Ud.create({tag:"script",attrs:{type:"text/javascript",async:!0,src:t},action:{load:()=>dd(o,e),error:()=>n(new Error(`${t} failed to load.`))}});document.head.appendChild(o)})),hd=t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>new Promise(((e,n)=>{if(ad.css.has(t))return e(t);ad.css.add(t);const o=Ud.create({tag:"link",attrs:{rel:"stylesheet",href:t},action:{load:()=>cd(o,e),error:()=>n(new Error(`${(void 0).src} failed to load.`))}});document.head.appendChild(o)}))));return Promise.all(e)},pd=async(t=x)=>{if(document.getElementById(w))return;const e=async t=>(t=>{let e=document.getElementById(w);return e||(e=Ud.create({id:w,children:t,attrs:{hidden:!0,style:"display: none;"}}),document.body.insertBefore(e,document.body.childNodes[0])),e})(await t.text());return ld(t,e,(()=>ld(O,e)))},fd={js:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>ud(t)));return Promise.all(e)},css:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>hd(t)));return Promise.all(e)}},md=t=>{const e=Object.entries(t).map((([t,e])=>fd[t](e)));return Promise.all(e)},gd=()=>{const t=document.getElementById(w);return"hidden"===window.getComputedStyle(t).visibility};class vd{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||Qi()}get controlId(){var t;return null==(t=this.controlData.meta)?void 0:t.id}get dom(){const{meta:t,config:e}=this.controlData,n=this.i18n(e.label)||e.label,o={tag:"button",attrs:{type:"button"},content:[{tag:"span",className:"control-icon",children:Ud.icon(t.icon)},n],action:{focus:({target:t})=>{const e=t.closest(`.${N}`);return e&&yd.panels.nav.refresh(Qr(e))},click:({target:t})=>{yd.addElement(t.parentElement.id)}}};return Ud.create({tag:"li",id:this.id,className:["field-control",`${t.group}-control`,`${t.id}-control`],content:o,meta:t,action:this.controlAction})}promise(){return md(this.dependencies)}i18n(t,e){var n,o;const i=s.locale,r=null==(n=this.definition)?void 0:n.i18n,a=(null==r?void 0:r[i])||{};return((null==(o=a[t])?void 0:o.call(a))??a[t])||s.get(t,e)}}const bd=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"}});const yd=new class{constructor(){n(this,"groupLabel",(t=>s.get(t)||t||"")),n(this,"layoutTypes",{row:()=>kd.active.addChild(),column:()=>this.layoutTypes.row().addChild(),field:t=>this.layoutTypes.column().addChild(t)}),n(this,"addElement",(t=>{const{meta:{group:e,id:n},...o}=Zr(this.get(t),"controlData");return Jr(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}=tr(bd,t);this.container=e,this.groupOrder=Ki(o.concat(["common","html","layout"])),this.options=i;const[r,s,a]=await Promise.all([Promise.resolve().then((()=>eu)),Promise.resolve().then((()=>iu)),Promise.resolve().then((()=>lu))]),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(`.${N}`);return e&&this.panels.nav.refresh(Qr(e))},click:({target:t})=>{this.addElement(t.parentElement.id)}}}async init(t,e=!1){return await this.applyOptions(t),this.buildDOM(e),this}registerControls(t){return this.controls=[],t.map((async t=>{let e;return e="function"==typeof t?new t:new vd(t),this.add(e),this.controls.push(e.dom),e.promise()}))}groupElements(){let t=this.options.groups.slice(),e=this.controls.slice(),n=[];const o=[];return t=ts(t,this.groupOrder,"id"),t=t.filter((t=>Zi(t.id,this.options.disable.groups))),n=t.map((t=>{const n={tag:"ul",attrs:{className:N,id:`${t.id}-${N}`},config:{label:this.groupLabel(t.label)}};if(this.options.elementOrder[t.id]){const e=this.options.elementOrder[t.id],n=Ki(e.concat(t.elementOrder));t.elementOrder=n}return e=ts(e,t.elementOrder,"meta.id"),n.content=e.filter((e=>{const{controlData:n}=this.get(e.id),i=n.meta.id||"";let r=!0;return r=[Zi(i,this.options.disable.elements),n.meta.group===t.id,!o.includes(i)].every((t=>!0===t)),r&&o.push(i),r})),n})),n}add(t=Object.create(null)){const e=er(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 er(this.data.get(t))}formActions(){if(!0===this.options.disable.formActions)return null;const t={...Ud.btnTemplate({content:[Ud.icon("bin"),s.get("clear")],title:s.get("clearAll")}),className:["clear-form"],action:{click:t=>{Id.size?(us.confirmClearAll=new window.CustomEvent("confirmClearAll",{detail:{confirmationMessage:s.get("confirmClearAll"),clearAllAction:()=>{kd.clearAll().then((()=>{const e={src:t.target};us.formeoCleared(e)}))},btnCoords:Ud.coords(t.target)}}),document.dispatchEvent(us.confirmClearAll)):window.alert(s.get("cannotClearFields"))}}},e={...Ud.btnTemplate({content:[Ud.icon("floppy-disk"),s.get("save")],title:s.get("save")}),className:["save-form"],action:{click:({target:t})=>{const{formData:e}=Bd,n={action:()=>{},coords:Ud.coords(t),message:"",button:t};return Mc.click.btn(n),Mc.save.form(e)}}};return{className:"form-actions f-btn-group",content:Object.entries({clearBtn:t,saveBtn:e}).reduce(((t,[e,n])=>(this.options.disable.formActions.includes(e)||t.push(n),t)),[])}}buildDOM(t){const e=this.groupElements(),n=this.formActions(),{displayType:o}=this.options.panels;this.panels=new Wc({panels:e,type:"controls",displayType:o});const i=["control-groups","formeo-panels-wrap",`panel-count-${e.length}`],r=Ud.create({className:i,content:[this.panels.panelNav,this.panels.panelsWrap]}),a=["formeo-controls"];t&&a.push("formeo-sticky");const l=Ud.create({className:a,content:[r,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=r.querySelector(".filtered-term");if(Ud.toggleElementsByStr(n,t),e){const e=s.get("controls.filteringTerm",t);l.classList.add("filtered"),o?o.textContent=e:(o=Ud.create({tag:"h5",className:"filtered-term",content:e}),r.insertBefore(o,r.firstChild))}else o&&(l.classList.remove("filtered"),o.remove())},addElement:this.addElement,addGroup:t=>{}};for(let s=c.length-1;s>=0;s--){const t=`formeo-controls-${c[s]}`;this.options.sortable||window.localStorage.removeItem(t),mc.create(c[s],{animation:150,forceFallback:!0,fallbackClass:"control-moving",fallbackOnBody:!0,group:{name:"controls",pull:"clone",put:!1},onStart:({item:t})=>{const{controlData:e}=this.get(t.id);this.options.ghostPreview&&(t.innerHTML="",t.appendChild(new sd(e).preview))},onEnd:({from:t,item:e,clone:n})=>{t.contains(n)&&t.replaceChild(e,n)},sort:this.options.sortable,store:{get:()=>{const e=window.localStorage.getItem(t);return e?e.split("|"):[]},set:e=>{const n=e.toArray();window.localStorage.setItem(t,n.join("|"))}}})}return l}};class wd extends Da{constructor(){super(...arguments),n(this,"load",(t=>{const e=dr(t);this.empty();for(const[n,o]of Object.entries(e))this.add(n,o);return this.data})),n(this,"get",(t=>t?Zr(this.data,t):this.add())),n(this,"add",((t,e=Object.create(null))=>{const n=t||Qi(),o=this.Component({...e,id:n});return this.set(n,o),this.active=o,o})),n(this,"remove",(t=>{if(Array.isArray(t))for(const e of t)this.get(e).remove();else this.get(t).remove();return this.data})),n(this,"delete",(t=>(delete this.data[t],t))),n(this,"clearAll",((t=!0)=>{const e=Object.values(this.data).map((e=>e.empty(t)));return Promise.all(e)})),n(this,"conditionMap",new Map)}set config(t){this.configVal=tr(this.configVal,er(t))}get config(){return this.configVal}}class Cd extends rd{constructor(t,e){super("stage",{...Object.freeze({children:[]}),...t},e);const n=this.createChildWrap();this.dom=Ud.create({attrs:{className:[j,"empty"],id:this.id},children:n}),mc.create(n,{animation:150,fallbackClass:"row-moving",forceFallback:!0,group:{name:"stage",pull:!0,put:["row","column","controls"]},sort:!0,disabled:!1,onAdd:this.onAdd.bind(this),onRemove:this.onRemove.bind(this),onStart:()=>{Ed.active=this},onSort:this.onSort.bind(this),draggable:`.${A}`,handle:".item-move"})}empty(t=!0){return new Promise((e=>{t?(this.dom.classList.add("removing-all-fields"),as.slideUp(this.dom,J,(()=>{e(super.empty(t)),this.dom.classList.remove("removing-all-fields"),as.slideDown(this.dom,J)}))):e(super.empty())}))}onAdd(...t){const e=super.onAdd(...t);e&&"column"===e.name&&e.parent.autoColumnWidths()}}const Ed=new class extends wd{constructor(t){super("stages",t)}Component(t){return new Cd(t)}};class Sd extends rd{constructor(t){super("row",{...Object.freeze({config:{fieldset:!1,legend:"",inputGroup:!1},children:[],className:[A]}),...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(at);const t=n.dom,o=or(e);n.set("config.width",o),t.style.width=o,t.dataset.colWidth=o;const i=setTimeout((()=>{clearTimeout(i),n.refreshFieldPanels()}),K);document.dispatchEvent(us.columnResized)}this.updateColumnPreset()})),n(this,"updateColumnPreset",(()=>{this.columnPresetControl.innerHTML="";const t=this.getColumnPresetOptions.map((({label:t,...e})=>Ud.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=Ud.create({tag:"li",className:[A,"empty"],dataset:{hoverTag:s.get("row"),editingHoverTag:s.get("editing.row")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),this.editWindow,e]}),mc.create(e,{animation:150,fallbackClass:"column-moving",forceFallback:!0,group:{name:"row",pull:!0,put:["row","column","controls"]},sort:!0,disabled:!1,onRemove:this.onRemove.bind(this),onEnd:this.onEnd.bind(this),onAdd:this.onAdd.bind(this),onSort:this.onSort.bind(this),draggable:`.${P}`,handle:".item-move"})}get editWindow(){const t={tag:"input",id:`${this.id}-fieldset`,attrs:{type:"checkbox",checked:this.get("config.fieldset"),ariaLabel:s.get("row.settings.fieldsetWrap.aria")},action:{click:({target:{checked:t}})=>{this.set("config.fieldset",Boolean(t))}},config:{label:s.get("row.settings.fieldsetWrap")}},e={tag:"input",id:`${this.id}-inputGroup`,attrs:{type:"checkbox",checked:this.get("config.inputGroup"),ariaLabel:s.get("row.settings.inputGroup.aria")},action:{click:({target:{checked:t}})=>this.set("config.inputGroup",t)},config:{label:s.get("row.makeInputGroup"),description:s.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=Ud.formGroup([t,n]),i={tag:"label",content:s.get("defineColumnWidths"),className:"col-sm-4 form-control-label"};this.columnPresetControl=Ud.create(this.columnPresetControlConfig);const r={className:"col-sm-8",content:this.columnPresetControl,action:{onRender:()=>{this.updateColumnPreset()}}},a=[e,"hr",o,"hr",Ud.formGroup([i,r],"row")];return Ud.create({className:`${this.name}-edit group-config`,action:{onRender:t=>{const e=a.map((t=>Ud.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=V.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:D}),t.map((t=>{const e={...t};return e.selected=t.value===n,e}))}return[]}get columnPresetControlConfig(){return{tag:"select",attrs:{ariaLabel:s.get("defineColumnLayout"),className:L},action:{change:({target:t})=>{const{value:e}=t;this.setColumnWidths(e)}},options:this.getColumnPresetOptions}}}const xd={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]}};const Od=new class extends wd{constructor(t){super("rows",t),this.config={all:xd}}Component(t){return new Sd(t)}};class _d{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=Ud.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(`.${A}`);if(this.validateResizeTarget(e,n))if(this.startX="touchstart"===t.type?t.touches[0].clientX:t.clientX,o.classList.add($),this.columnPreset=o.querySelector(`.${L}`),this.originalColumnClass=e.className,this.originalSiblingClass=n.className,e.className=e.className.replace(at,""),n.className=n.className.replace(at,""),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(nr(e,this.rowWidth)),i=parseFloat(nr(n,this.rowWidth));return o<10||i<10?null:{colWidth:or(o.toFixed(1)),siblingColWidth:or(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(),Bd.setAddress(`columns.${t.id}.config.width`,t.dataset.colWidth),Bd.setAddress(`columns.${e.id}.config.width`,e.dataset.colWidth),this.row.classList.remove($),this.resized=!1,this.cleanup())}cleanup(){this.column&&this.originalColumnClass&&(this.column.className=this.originalColumnClass),this.sibling&&this.originalSiblingClass&&(this.sibling.className=this.originalSiblingClass),this.row&&this.row.classList.remove($),window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onStop)}setCustomWidthValue(){const t=this.columnPreset;let e=t.querySelector(`.${D}`);const n=this.row.querySelector(".children").children,o=ns(n,(t=>nr(t.clientWidth,this.rowWidth).toFixed(1))),i=o.join(","),r=o.join(" | ");return e||(e=Ud.create({tag:"option",attrs:{className:D,value:i,selected:!0},content:r}),t.append(e)),e.value=i,e.textContent=r,i}}const Nd=t=>({className:"resize-x-handle",action:{pointerdown:t.onStart.bind(t)},content:[Ud.icon("triangle-down"),Ud.icon("triangle-up")]}),jd=()=>({className:"column-edit group-config"});class Ad extends rd{constructor(t){super("column",{...Object.freeze({config:{width:"100%"},children:[],className:[P]}),...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=Ud.create({tag:"li",className:[P,"empty"],dataset:{hoverTag:s.get("column")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),jd(),Nd(new _d),e]}),this.processConfig(),us.columnResized=new window.CustomEvent("columnResized",{detail:{column:this.dom,instance:this}}),mc.create(e,{animation:150,fallbackClass:"field-moving",forceFallback:!0,group:{name:"column",pull:!0,put:["column","controls"]},sort:!0,disabled:!1,onEnd:this.onEnd.bind(this),onAdd:this.onAdd.bind(this),onSort:this.onSort.bind(this),onRemove:this.onRemove.bind(this),onMove:t=>{t.from!==t.to&&t.from.classList.remove("hovering-column")},draggable:`.${T}`,handle:".item-move"})}processConfig(){const t=ss.get(this.data,"config.width");t&&this.setDomWidth(t)}}const Pd={actionButtons:{buttons:["clone","move","remove"],disabled:[]}};const Td=new class extends wd{constructor(t){super("columns",t),this.config={all:Pd}}Component(t){return new Ad(t)}},Dd={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]},panels:{disabled:[],attrs:{disabled:["type"],hideDisabled:!0,locked:[]},order:["attrs","options","conditions"]},label:{disableHTML:!1}};const Ld=new class extends wd{constructor(t){super("fields",t),n(this,"get",(t=>{let e=t&&Zr(this.data,t);if(!e){const n=yd.get(t);n&&(e=this.add(null,n.controlData))}return e})),n(this,"getData",(()=>Object.entries(this.data).reduce(((t,[e,n])=>{const{conditions:o,...i}=(null==n?void 0:n.getData())||n;if(null==o?void 0:o.length){let t=!0;if(1===o.length){const[e]=o;t=Boolean(e.if[0].source&&e.then[0].target)}t&&(i.conditions=o)}return t[e]=i,t}),{}))),n(this,"load",((t=Object.create(null))=>{const e=dr(t);this.empty();for(const[n,o]of Object.entries(e)){const{meta:t,...e}=o;(null==t?void 0:t.id)&&Jr(e,"config.controlId",null==t?void 0:t.id),this.add(n,e)}return this.data})),this.config={all:Dd}}Component(t){return new sd(t)}};const $d=new class extends wd{constructor(t){super("externals",t)}Component(t){return new rd("external",t)}},kd=Ed,Id=Od,Md=Td,Rd=Ld,Fd=yd,Wd=$d;const Bd=new class extends Da{constructor(){super("components"),n(this,"load",((t,e)=>{this.empty();const n=((t,e=!1)=>t?er(dr(t)):e&&ir.get(G)||ct())(t,e.sessionStorage);this.opts=e,this.set("id",n.id),this.add("stages",kd.load(n.stages)),this.add("rows",Id.load(n.rows)),this.add("columns",Md.load(n.columns)),this.add("fields",Rd.load(n.fields)),this.add("externals",Wd.load(this.opts.external));for(const o of Object.values(this.get("stages")))o.loadChildren();return this.data})),this.disableEvents=!0,this.stages=kd,this.rows=Id,this.columns=Md,this.fields=Rd,this.controls=Fd,this.externals=Wd}flatList(t=this.data,e=Object.create(null)){return Object.entries(t).reduce(((t,[e,n])=>{if("object"==typeof n)for(const[o,i]of Object.entries(n))t[`${e}.${o}`]=i;return t}),e)}get json(){return window.JSON.stringify({$schema:`https://cdn.jsdelivr.net/npm/formeo@${b}/dist/formData_schema.json`,...this.formData})}get formData(){return{id:this.get("id"),stages:Ed.getData(),rows:Od.getData(),columns:Td.getData(),fields:Ld.getData()}}set config(t){const{stages:e,rows:n,columns:o,fields:i}=t;kd.config=e,Id.config=n,Md.config=o,Rd.config=i}setAddress(t,e){const[n,o,...i]=Array.isArray(t)?t:t.split("."),r=this[n.replace(/s?$/,"s")].get(o);return null==r||r.set(i,e),r}getAddress(t){if(!rr(t))return;const[e,n,...o]=Array.isArray(t)?t:t.split("."),i=this[e.replace(/s?$/,"s")].get(n);return o.length?i.get(o):i}getConditionMap(t){if(rr(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.get(e[1])}}setConditionMap(t,e){if(rr(t)){const n=t.split(".");return n.every((t=>Boolean(t)))&&this[n[0]].conditionMap.set(n[1],e)}}removeConditionMap(t){if(rr(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.delete(e[1])}}},zd={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="${lt}${t}">${t}</i>`},qd=new Set(["input","textarea","select"]);const Ud=new class{constructor(t=Object.create(null)){n(this,"render",(t=>(t.id=`f-${t.id||Qi()}`,this.create(t)))),n(this,"create",((t,e=!1)=>{if(!t)return;const n=this,o=["children","content"],{className:i,options:r,dataset:s,...a}=this.processTagName(t);let l;o.push("tag");const{tag:c}=a;let d;const u={attrs:{},className:[ss.get(a,"config.inputWrap")||"f-field-group"],children:[],config:{}};let h=document.createElement(c);const p={string:t=>{h.innerHTML+=t},object:t=>t&&h.appendChild(n.create(t,e)),node:t=>h.appendChild(t),component:t=>h.appendChild(t.dom),array:t=>{for(const e of t)l=n.childType(e),p[l](e)},function:t=>{t=t(),l=n.childType(t),p[l](t)},undefined:()=>null,boolean:()=>null};if(i&&(a.attrs=tr(a.attrs,{className:i})),r){const t=this.processOptions(r,a,e);if(!this.holdsContent(h)||"button"===c)return ss.forEach(t,(t=>{u.children.push(n.create(t,e))})),a.attrs.className&&(u.className=a.attrs.className),u.config={...a.config},this.create(u,e);p.array.call(this,t),a.content=void 0,o.push("options")}if(a.attrs&&(n.processAttrs(a,h,e),o.push("attrs")),a.config){if(a.config.label&&(a.config.label&&"button"!==c||["radio","checkbox"].includes(ss.get(a,"attrs.type")))&&!e){const t=n.label(a);if(!a.config.hideLabel){const e=[t,h];n.labelAfter(a)&&e.reverse(),u.children.push(e)}}o.push("config")}if(a.content||a.children){const t=a.content||a.children;l=n.childType(t),p[l],p[l].call(this,t)}if(s){for(const t in s)Object.hasOwn(s,t)&&(h.dataset[t]="function"==typeof s[t]?s[t]():s[t]);o.push("dataset")}a.action&&(this.actionHandler(h,a.action),o.push("action"));const f=ss.subtract(o,Object.keys(a));for(d=f.length-1;d>=0;d--)h[f[d]]=a[f[d]];return u.children.length&&(h=this.create(u)),h})),n(this,"onRender",((t,e)=>{t.parentElement?e(t):window.requestAnimationFrame((()=>this.onRender(t,e)))})),n(this,"toggleElementsByStr",((t,e)=>{const n=[];return Ud.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 es(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||s.get("labelCount",{label:s.get("option"),count:o})}}))),n(this,"requiredMark",(()=>({tag:"span",className:"text-error",children:"*"}))),n(this,"removeEmpty",(t=>{const e=t.parentElement,n=Ji(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=>Ji(t)===N)),n(this,"isStage",(t=>Ji(t)===j)),n(this,"isRow",(t=>Ji(t)===A)),n(this,"isColumn",(t=>Ji(t)===P)),n(this,"isField",(t=>Ji(t)===T)),n(this,"asComponent",(t=>Bd[`${Ji(t)}s`].get(t.id))),this.options=t}set setOptions(t){this.options=tr(this.options,t)}processTagName(t){let e,n=t;if("string"==typeof n)return e=n,n={tag:e},n;if(n.attrs){const{tag:t,...o}=n.attrs;if(t)if("string"==typeof t)e=t;else{e=(t.find((t=>!0===t.selected))||t[0]).value}n.attrs=o}return n.tag=e||n.tag||"div",n}actionHandler(t,e){const n={onRender:Ud.onRender,render:Ud.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(`#${w} svg symbol`);return this.iconSymbols=Array.from(t).reduce(((t,e)=>{var n;return t[e.id.replace(lt,"")]={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=tr(r,e);return this.cachedIcons[i]=Ud.create(t).outerHTML,this.cachedIcons[i]}return this.cachedIcons[i]=Ud.create(r).outerHTML,this.cachedIcons[i]}return(null==(o=zd[Ud.options.iconFont])?void 0:o.call(zd,t))||t}processAttrs(t,e,n){const{attrs:o={}}=t;n||o.name||!this.isInput(t.tag)||e.setAttribute("name",Qi(t));for(const i of Object.keys(o)){const t=ss.safeAttrName(i),n=this.processAttrValue(o[i]);n&&e.setAttribute(t,!0===n?"":n)}}processAttrValue(t){let e=t||"";if(Array.isArray(e))if("object"==typeof e[0]){const t=e.filter((t=>!0===t.selected));e=t.length?t[0].value:e[0].value}else e=e.join(" ");return e}processOptions(t,e,n){const{action:o,attrs:i}=e,r=i.type||e.tag,s=i.id||e.id;return t.map(((t,i)=>{var a;const{label:l,...c}=t,d=()=>{const a={tag:"input",attrs:{name:s,type:r,value:t.value||"",id:`${s}-${i}`,...c},action:o},l={tag:"label",attrs:{for:`${s}-${i}`},config:{inputWrap:"form-check"},children:t.label},d={children:[a,l],className:[`f-${r}`]};return e.attrs.className&&(e.config.inputWrap=e.attrs.className),e.config.inline&&d.className.push(`f-${r}-inline`),t.selected&&(a.attrs.checked=!0),n&&(l.attrs.contenteditable=!0),d},u={select:()=>({tag:"option",attrs:t,children:t.label}),button:t=>{const{type:n,label:o,className:i,id:r}=t;return{...e,attrs:{type:n},className:i,id:r||Qi(),options:void 0,children:o,action:e.action}},checkbox:d,radio:d};return null==(a=u[r])?void 0:a.call(u,t)}))}holdsContent(t){return-1!==t.outerHTML.indexOf("/")}isBlockInput(t){return!this.isInput(t)&&this.holdsContent(t)}isInput(t){let e=t;return"string"!=typeof e&&(e=e.tagName),qd.has(e)}parsedHtml(t){const e=document.createElement("textarea");return e.innerHTML=t,e.textContent}labelAfter(t){const e=ss.get(t,"attrs.type"),n=ss.get(t,"config.labelAfter");return void 0!==n?n:"checkbox"===e||"radio"===e}label(t,e){const n=ss.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=Ji(t);return e?Bd.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,ss.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)}};ss.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");as.slideUp(t,600,(()=>{Ud.empty(t),t.classList.remove("removing-all-fields"),Ud.emptyClass(t),as.slideDown(t,300)}))}toggleSortable(t,e){let n=e;const o=Ji(t);if(!o)return;const i=Ji(t.parentElement),r=Ud[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(k.get(t.classList.item(0)));t.classList.toggle("empty",!e.length)}};s.addLanguage("en-US",void 0);const Hd={get editor(){return{stickyControls:!1,allowEdit:!0,dataType:"json",debug:!1,sessionStorage:!1,editorContainer:null,external:{},svgSprite:x,style:_,iconFont:null,config:{},events:{},actions:{},controls:{},polyfills:rs(),i18n:{location:"https://draggable.github.io/formeo/assets/lang/"},onLoad:()=>{}}}};let Xd=class{constructor({formData:t,...e},n){const o=tr(Hd.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,Ud.setOptions=c,Bd.config=a,this.userFormData=n||t,this.Components=Bd,this.dom=Ud,us.init({debug:s,...r}),Mc.init({debug:s,sessionStorage:c.sessionStorage,...i}),this.tooltip=new h,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",this.loadResources.bind(this)):this.loadResources()}get formData(){return this.Components.formData}set formData(t={}){this.userFormData=ur(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)?C.filter((({name:e})=>-1!==t.indexOf(e))):C;Promise.all(e.map((({src:t})=>ud(t))))})(this.opts.polyfills),await pd(this.opts.svgSprite),e.push((async t=>{if(!gd()&&(await hd(t),!gd()))return await hd("https://draggable.github.io/formeo/assets/css/formeo.min.css")})(this.opts.style)),e.push(s.init({...this.opts.i18n,locale:null==(t=window.sessionStorage)?void 0:t.getItem(Z)}));const n=await Promise.all(e);return this.opts.allowEdit&&this.init(),n}init(){return yd.init(this.opts.controls,this.opts.stickyControls).then((t=>{var e,n;this.controls=t,this.load(this.userFormData,this.opts),this.formId=Bd.get("id"),this.i18n={setLang:t=>{var e;null==(e=window.sessionStorage)||e.setItem(Z,t);s.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(Bd.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))]};s.current.dir&&(t.attrs.dir=s.current.dir,Ud.dir=s.current.dir),this.editor=Ud.create(t);(this.controls.container||this.editor).appendChild(this.controls.dom),this.editorContainer&&(Ud.empty(this.editorContainer),this.editorContainer.appendChild(this.editor)),us.formeoLoaded=new window.CustomEvent("formeoLoaded",{detail:{formeo:this}}),document.dispatchEvent(us.formeoLoaded)}};const Vd=t=>"string"==typeof t?document.querySelector(t):t,Yd=t=>{const e=t.match(st);return(null==e?void 0:e[0])||t},Gd=t=>t.replace(st,Qi());let Zd=class{constructor(t,e){n(this,"render",((t=this.form)=>{this.form=ur(t);const e=document.getElementsByClassName("formeo-render").length,n={id:this.form.id,className:`formeo-render formeo formeo-rendered-${e}`,children:this.processedData};this.renderedForm=Ud.render(n),this.applyConditions();const o=this.container.querySelector(".formeo-render");o?o.replaceWith(this.renderedForm):this.container.appendChild(this.renderedForm)})),n(this,"orderChildren",((t,e)=>e.reduce(((e,n)=>(e.push(this.form[t][n]),e)),[]))),n(this,"prefixId",(t=>"f-"+t)),n(this,"processColumn",(({id:t,...e})=>({...e,id:this.prefixId(t),children:this.processFields(e.children),style:`width: ${e.config.width||"100%"}`}))),n(this,"processRows",(t=>this.orderChildren("rows",this.form.stages[t].children).reduce(((t,e)=>(e&&t.push(this.processRow(e)),t)),[]))),n(this,"cacheComponent",(t=>(this.components[Yd(t.id)]=t,t))),n(this,"processRow",((t,e="row")=>{const{config:n,id:o}=t,i=[`formeo-${e}-wrap`],r={...t,children:this.processColumns(t.id),id:this.prefixId(o)};this.cacheComponent(r);const s=[{condition:n.legend,result:()=>({tag:n.fieldset?"legend":"h3",children:n.legend})},{condition:!0,result:()=>r},{condition:n.inputGroup,result:()=>this.addButton(o)}].reduce(((t,{condition:e,result:n})=>(e&&t.push(n()),t)),[]);return n.inputGroup&&i.push("f-input-group-wrap"),{tag:n.fieldset?"fieldset":"div",id:Qi(),className:i,children:s}})),n(this,"cloneComponentData",(t=>{const{children:e=[],id:n,...o}=this.components[t];return Object.assign({},o,{id:Gd(n),children:e.length&&e.map((({id:t})=>this.cloneComponentData(Yd(t))))})})),n(this,"addButton",(t=>Ud.render({tag:"button",attrs:{className:"add-input-group btn pull-right",type:"button"},children:"Add +",action:{click:e=>{const n=e.target.parentElement,o=Ud.render(this.cloneComponentData(t));n.insertBefore(o,n.lastChild),o.appendChild(Ud.render(Ud.btnTemplate({className:"remove-input-group",children:Ud.icon("remove"),action:{mouseover:({target:t})=>t.parentElement.classList.add("will-remove"),mouseleave:({target:t})=>t.parentElement.classList.remove("will-remove"),click:({target:t})=>t.parentElement.remove()}})))}}}))),n(this,"processColumns",(t=>this.orderChildren("columns",this.form.rows[t].children).map((t=>this.cacheComponent(this.processColumn(t)))))),n(this,"processFields",(t=>this.orderChildren("fields",t).map((({id:t,...e})=>{var n,o;const i=(null==(n=e.config)?void 0:n.controlId)||(null==(o=e.meta)?void 0:o.id),{action:r={},dependencies:s={}}=this.elements[i]||{};s&&md(s);const a=tr({action:r},e);return this.cacheComponent({...a,id:this.prefixId(t)})})))),n(this,"handleComponentCondition",((t,e,n)=>{const o=Jd(t);o&&t.addEventListener(o,(t=>{if(this.evaluateCondition(e,t))for(const e of n)this.execResult(e,t)}),!1);const i={target:t};if(this.evaluateCondition(e,i))for(const r of n)this.execResult(r,i)})),n(this,"applyConditions",(()=>{for(const{conditions:t}of Object.values(this.components))if(t)for(const e of t){const{if:t,then:n}=e;for(const e of t){const{source:t,...o}=e;if(rr(t)){const e=this.getComponents(t);for(const t of e)this.handleComponentCondition(t,o,n)}}}})),n(this,"evaluateCondition",(({sourceProperty:t,targetProperty:e,comparison:n,target:o},i)=>{var r;const s={equals:Ta,notEquals:(t,e)=>!Ta(t,e),contains:(t,e)=>t.includes(e),notContains:(t,e)=>!t.includes(e)},a=String(i.target[t]),l=String(rr(o)?this.getComponent(o)[e]:o);return null==(r=s[n])?void 0:r.call(s,a,l)})),n(this,"execResult",(({assignment:t,target:e,targetProperty:n,value:o})=>{var i;const r={equals:t=>{var e;const i={value:()=>{t[n]=o},isNotVisible:()=>{t.parentElement.setAttribute("hidden",!0),t.required=!1},isVisible:()=>{t.parentElement.removeAttribute("hidden"),t.required=t._required}};null==(e=i[n])||e.call(i)}};if(rr(e)){const n=this.getComponent(e);n&&void 0===n._required&&(n._required=n.required),null==(i=r[t])||i.call(r,n)}})),n(this,"getComponent",(t=>{const e=t.slice(t.indexOf(".")+1);return sr(t)?this.external[e]:this.renderedForm.querySelector(`#f-${e}`)})),n(this,"getComponents",(t=>{const e=[],n=t.slice(t.indexOf(".")+1);return sr(t)?e.push(this.external[n]):e.push(...this.renderedForm.querySelectorAll(`[name=f-${n}]`)),e}));const{renderContainer:o,external:i,elements:r,formData:s}=(({editorContainer:t,renderContainer:e,formData:n,...o})=>({elements:{},...o,renderContainer:Vd(e),editorContainer:Vd(t),formData:ur(n)}))(t);this.container=o,this.form=ur(e||s),this.external=i,this.dom=Ud,this.components=Object.create(null),this.elements=r}get processedData(){return Object.values(this.form.stages).map((t=>(t.children=this.processRows(t.id),t.className=j,Ud.render(t))))}};const Jd=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=Xd,window.FormeoRenderer=Zd);const Kd=Xd,Qd=Zd,tu=[{config:{label:"row"},meta:{group:"layout",icon:"rows",id:"layout-row"}},{config:{label:"column"},meta:{group:"layout",icon:"columns",id:"layout-column"}}],eu=Object.freeze(Object.defineProperty({__proto__:null,default:tu},Symbol.toStringTag,{value:"Module"}));const nu=(t,e=3)=>Array.from({length:e},((t,e)=>e+1)).map((e=>{const n="checkbox"===t?"checked":"selected";return{label:s.get("labelCount",{label:Uc(t),count:e}),value:`${t}-${e}`,[n]:!e}}));const ou=[class extends vd{constructor(){super({tag:"button",attrs:{className:[{label:"grouped",value:"f-btn-group"},{label:"ungrouped",value:"f-field-group"}]},config:{label:s.get("controls.form.button"),hideLabel:!0},meta:{group:"common",icon:"button",id:"button"},options:[{label:s.get("button"),type:["button","submit","reset"].map((t=>({label:t,type:t}))),className:[{label:"default",value:"",selected:!0},{label:"primary",value:"primary"},{label:"danger",value:"error"},{label:"success",value:"success"},{label:"warning",value:"warning"}]}]})}},class extends vd{constructor(){super({tag:"input",attrs:{type:"date",required:!1,className:""},config:{label:s.get("controls.form.input.date")},meta:{group:"common",icon:"calendar",id:"date-input"}})}},class extends vd{constructor(){super({tag:"input",attrs:{type:"hidden",value:""},config:{label:s.get("hidden"),hideLabel:!0},meta:{group:"common",icon:"hidden",id:"hidden"}})}},class extends vd{constructor(){super({tag:"input",attrs:{type:"number",required:!1,className:""},config:{label:s.get("number")},meta:{group:"common",icon:"hash",id:"number"}})}},class extends vd{constructor(){super({tag:"textarea",config:{label:s.get("controls.form.textarea")},meta:{group:"common",icon:"textarea",id:"textarea"},attrs:{required:!1}})}},class extends vd{constructor(){super({tag:"input",attrs:{required:!1,type:"text",className:""},config:{label:s.get("controls.form.input.text")},meta:{group:"common",icon:"text-input",id:"text-input"}})}},class extends vd{constructor(){super({tag:"input",attrs:{type:"file",required:!1},config:{label:s.get("fileUpload")},meta:{group:"common",icon:"upload",id:"upload"}})}},class extends vd{constructor(){super({tag:"select",config:{label:s.get("controls.form.select")},attrs:{required:!1,className:""},meta:{group:"common",icon:"select",id:"select"},options:nu("option")})}},class extends vd{constructor(){super({tag:"input",attrs:{type:"checkbox",required:!1},config:{label:s.get("controls.form.checkbox-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"checkbox",id:"checkbox"},options:nu("checkbox",1)})}},class extends vd{constructor(){super({tag:"input",attrs:{type:"radio",required:!1},config:{label:s.get("controls.form.radio-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"radio-group",id:"radio"},options:nu("radio")})}}],iu=Object.freeze(Object.defineProperty({__proto__:null,default:ou},Symbol.toStringTag,{value:"Module"})),ru=Array.from(Array(5).keys()).slice(1).map((t=>`h${t}`)),su="controls.html.header";const au=[class extends vd{constructor(){super({tag:ru[0],attrs:{tag:ru.map(((t,e)=>({label:t.toUpperCase(),value:t,selected:!e}))),className:""},config:{label:s.get(su),hideLabel:!0,editableContent:!0},meta:{group:"html",icon:"header",id:"html.header"},content:s.get(su),action:{}})}static get definition(){return{i18n:{"en-US":{header:"Custom English Header"}}}}get content(){return super.i18n(su)}},class extends vd{constructor(){super({tag:"p",attrs:{className:""},config:{label:s.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 vd{constructor(){super({tag:"hr",config:{label:s.get("controls.html.divider"),hideLabel:!0},meta:{group:"html",icon:"divider",id:"divider"}})}},class extends vd{constructor(t){super(tr({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))}}],lu=Object.freeze(Object.defineProperty({__proto__:null,default:au},Symbol.toStringTag,{value:"Module"}));t.FormeoEditor=Kd,t.FormeoRenderer=Qd,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
|
|
14
|
+
*/function Wa(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 Fa(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Wa(Object(n),!0).forEach((function(e){za(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Wa(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Ba(t){return(Ba="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 za(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ua(){return Ua=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},Ua.apply(this,arguments)}function qa(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 Va(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var Ha=Va(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Xa=Va(/Edge/i),Ya=Va(/firefox/i),Ga=Va(/safari/i)&&!Va(/chrome/i)&&!Va(/android/i),Za=Va(/iP(ad|od|hone)/i),Ja=Va(/chrome/i)&&Va(/android/i),Ka={capture:!1,passive:!1};function Qa(t,e,n){t.addEventListener(e,n,!Ha&&Ka)}function tl(t,e,n){t.removeEventListener(e,n,!Ha&&Ka)}function el(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 nl(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function ol(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&el(t,e):el(t,e))||o&&t===n)return t;if(t===n)break}while(t=nl(t))}return null}var il,rl=/\s+/g;function sl(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(rl," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(rl," ")}}function al(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 ll(t,e){var n="";if("string"==typeof t)n=t;else do{var o=al(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 cl(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 dl(){var t=document.scrollingElement;return t||document.documentElement}function ul(t,e,n,o,i){if(t.getBoundingClientRect||t===window){var r,s,a,l,c,d,u;if(t!==window&&t.parentNode&&t!==dl()?(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,!Ha))do{if(i&&i.getBoundingClientRect&&("none"!==al(i,"transform")||n&&"static"!==al(i,"position"))){var h=i.getBoundingClientRect();s-=h.top+parseInt(al(i,"border-top-width")),a-=h.left+parseInt(al(i,"border-left-width")),l=s+r.height,c=a+r.width;break}}while(i=i.parentNode);if(o&&t!==window){var p=ll(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 hl(t,e,n){for(var o=vl(t,!0),i=ul(t)[e];o;){if(!(i>=ul(o)[n]))return o;if(o===dl())break;o=vl(o,!1)}return!1}function pl(t,e,n,o){for(var i=0,r=0,s=t.children;r<s.length;){if("none"!==s[r].style.display&&s[r]!==Cc.ghost&&(o||s[r]!==Cc.dragged)&&ol(s[r],n.draggable,t,!1)){if(i===e)return s[r];i++}r++}return null}function ml(t,e){for(var n=t.lastElementChild;n&&(n===Cc.ghost||"none"===al(n,"display")||e&&!el(n,e));)n=n.previousElementSibling;return n||null}function fl(t,e){var n=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||t===Cc.clone||e&&!el(t,e)||n++;return n}function gl(t){var e=0,n=0,o=dl();if(t)do{var i=ll(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 vl(t,e){if(!t||!t.getBoundingClientRect)return dl();var n=t,o=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=al(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 dl();if(o||e)return n;o=!0}}}while(n=n.parentNode);return dl()}function bl(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 yl(t,e){return function(){if(!il){var n=arguments;1===n.length?t.call(this,n[0]):t.apply(this,n),il=setTimeout((function(){il=void 0}),e)}}}function wl(t,e,n){t.scrollLeft+=e,t.scrollTop+=n}function Cl(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 El(t,e,n){var o={};return Array.from(t.children).forEach((function(i){var r,s,a,l;if(ol(i,e.draggable,t,!1)&&!i.animated&&i!==n){var c=ul(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 xl="Sortable"+(new Date).getTime();function Sl(){var t,e=[];return{captureAnimationState:function(){(e=[],this.options.animation)&&[].slice.call(this.el.children).forEach((function(t){if("none"!==al(t,"display")&&t!==Cc.ghost){e.push({target:t,rect:ul(t)});var n=Fa({},e[e.length-1].rect);if(t.thisAnimationDuration){var o=ll(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=ul(n),l=n.prevFromRect,c=n.prevToRect,d=t.rect,u=ll(n,!0);u&&(a.top-=u.f,a.left-=u.e),n.toRect=a,n.thisAnimationDuration&&bl(l,a)&&!bl(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)),bl(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){al(t,"transition",""),al(t,"transform","");var i=ll(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,al(t,"transform","translate3d("+a+"px,"+l+"px,0)"),this.forRepaintDummy=function(t){return t.offsetWidth}(t),al(t,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),al(t,"transform","translate3d(0,0,0)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout((function(){al(t,"transition",""),al(t,"transform",""),t.animated=!1,t.animatingX=!1,t.animatingY=!1}),o)}}}}var Ol=[],_l={initializeByDefault:!0},Al={mount:function(t){for(var e in _l)_l.hasOwnProperty(e)&&!(e in t)&&(t[e]=_l[e]);Ol.forEach((function(e){if(e.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")})),Ol.push(t)},pluginEvent:function(t,e,n){var o=this;this.eventCanceled=!1,n.cancel=function(){o.eventCanceled=!0};var i=t+"Global";Ol.forEach((function(o){e[o.pluginName]&&(e[o.pluginName][i]&&e[o.pluginName][i](Fa({sortable:e},n)),e.options[o.pluginName]&&e[o.pluginName][t]&&e[o.pluginName][t](Fa({sortable:e},n)))}))},initializePlugins:function(t,e,n,o){for(var i in Ol.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,Ua(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 Ol.forEach((function(o){"function"==typeof o.eventProperties&&Ua(n,o.eventProperties.call(e[o.pluginName],t))})),n},modifyOption:function(t,e,n){var o;return Ol.forEach((function(i){t[i.pluginName]&&i.optionListeners&&"function"==typeof i.optionListeners[e]&&(o=i.optionListeners[e].call(t[i.pluginName],n))})),o}};var Tl=["evt"],Nl=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=n.evt,i=qa(n,Tl);Al.pluginEvent.bind(Cc)(t,e,Fa({dragEl:jl,parentEl:kl,ghostEl:Dl,rootEl:Ll,nextEl:$l,lastDownEl:Il,cloneEl:Ml,cloneHidden:Rl,dragStarted:Jl,putSortable:ql,activeSortable:Cc.active,originalEvent:o,oldIndex:Wl,oldDraggableIndex:Bl,newIndex:Fl,newDraggableIndex:zl,hideGhostForTarget:vc,unhideGhostForTarget:bc,cloneNowHidden:function(){Rl=!0},cloneNowShown:function(){Rl=!1},dispatchSortableEvent:function(t){Pl({sortable:e,name:t,originalEvent:o})}},i))};function Pl(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[xl]){var f,g=e.options,v="on"+o.charAt(0).toUpperCase()+o.substr(1);!window.CustomEvent||Ha||Xa?(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=Fa(Fa({},m),Al.getEventProperties(o,e));for(var y in b)f[y]=b[y];n&&n.dispatchEvent(f),g[v]&&g[v].call(e,f)}}(Fa({putSortable:ql,cloneEl:Ml,targetEl:jl,rootEl:Ll,oldIndex:Wl,oldDraggableIndex:Bl,newIndex:Fl,newDraggableIndex:zl},t))}var jl,kl,Dl,Ll,$l,Il,Ml,Rl,Wl,Fl,Bl,zl,Ul,ql,Vl,Hl,Xl,Yl,Gl,Zl,Jl,Kl,Ql,tc,ec,nc=!1,oc=!1,ic=[],rc=!1,sc=!1,ac=[],lc=!1,cc=[],dc="undefined"!=typeof document,uc=Za,hc=Xa||Ha?"cssFloat":"float",pc=dc&&!Ja&&!Za&&"draggable"in document.createElement("div"),mc=function(){if(dc){if(Ha)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),fc=function(t,e){var n=al(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=pl(t,0,e),r=pl(t,1,e),s=i&&al(i),a=r&&al(r),l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+ul(i).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+ul(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[hc]||r&&"none"===n[hc]&&l+c>o)?"vertical":"horizontal"},gc=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"==Ba(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},vc=function(){!mc&&Dl&&al(Dl,"display","none")},bc=function(){!mc&&Dl&&al(Dl,"display","")};dc&&!Ja&&document.addEventListener("click",(function(t){if(oc)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),oc=!1,!1}),!0);var yc=function(t){if(jl){t=t.touches?t.touches[0]:t;var e=(i=t.clientX,r=t.clientY,ic.some((function(t){var e=t[xl].options.emptyInsertThreshold;if(e&&!ml(t)){var n=ul(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[xl]._onDragOver(n)}}var i,r,s},wc=function(t){jl&&jl.parentNode[xl]._isOutsideThisEl(t.target)};function Cc(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=Ua({},e),t[xl]=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 fc(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!==Cc.supportPointer&&"PointerEvent"in window&&!Ga,emptyInsertThreshold:5};for(var o in Al.initializePlugins(this,t,n),n)!(o in e)&&(e[o]=n[o]);for(var i in gc(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&pc,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?Qa(t,"pointerdown",this._onTapStart):(Qa(t,"mousedown",this._onTapStart),Qa(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(Qa(t,"dragover",this),Qa(t,"dragenter",this)),ic.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),Ua(this,Sl())}function Ec(t,e,n,o,i,r,s,a){var l,c,d=t[xl],u=d.options.onMove;return!window.CustomEvent||Ha||Xa?(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||ul(e),l.willInsertAfter=a,l.originalEvent=s,t.dispatchEvent(l),u&&(c=u.call(d,l,s)),c}function xc(t){t.draggable=!1}function Sc(){lc=!1}function Oc(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 _c(t){return setTimeout(t,0)}function Ac(t){return clearTimeout(t)}Cc.prototype={constructor:Cc,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(Kl=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,jl):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){cc.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&cc.push(o)}}(n),!jl&&!(/mousedown|pointerdown/.test(r)&&0!==t.button||o.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!Ga||!a||"SELECT"!==a.tagName.toUpperCase())&&!((a=ol(a,o.draggable,n,!1))&&a.animated||Il===a)){if(Wl=fl(a),Bl=fl(a,o.draggable),"function"==typeof c){if(c.call(this,t,a,this))return Pl({sortable:e,rootEl:l,name:"filter",targetEl:a,toEl:n,fromEl:n}),Nl("filter",e,{evt:t}),void(i&&t.cancelable&&t.preventDefault())}else if(c&&(c=c.split(",").some((function(o){if(o=ol(l,o.trim(),n,!1))return Pl({sortable:e,rootEl:o,name:"filter",targetEl:a,fromEl:n,toEl:n}),Nl("filter",e,{evt:t}),!0}))))return void(i&&t.cancelable&&t.preventDefault());o.handle&&!ol(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&&!jl&&n.parentNode===r){var l=ul(n);if(Ll=r,kl=(jl=n).parentNode,$l=jl.nextSibling,Il=n,Ul=s.group,Cc.dragged=jl,Vl={target:jl,clientX:(e||t).clientX,clientY:(e||t).clientY},Gl=Vl.clientX-l.left,Zl=Vl.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,jl.style["will-change"]="all",o=function(){Nl("delayEnded",i,{evt:t}),Cc.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!Ya&&i.nativeDraggable&&(jl.draggable=!0),i._triggerDragStart(t,e),Pl({sortable:i,name:"choose",originalEvent:t}),sl(jl,s.chosenClass,!0))},s.ignore.split(",").forEach((function(t){cl(jl,t.trim(),xc)})),Qa(a,"dragover",yc),Qa(a,"mousemove",yc),Qa(a,"touchmove",yc),Qa(a,"mouseup",i._onDrop),Qa(a,"touchend",i._onDrop),Qa(a,"touchcancel",i._onDrop),Ya&&this.nativeDraggable&&(this.options.touchStartThreshold=4,jl.draggable=!0),Nl("delayStart",this,{evt:t}),!s.delay||s.delayOnTouchOnly&&!e||this.nativeDraggable&&(Xa||Ha))o();else{if(Cc.eventCanceled)return void this._onDrop();Qa(a,"mouseup",i._disableDelayedDrag),Qa(a,"touchend",i._disableDelayedDrag),Qa(a,"touchcancel",i._disableDelayedDrag),Qa(a,"mousemove",i._delayedDragTouchMoveHandler),Qa(a,"touchmove",i._delayedDragTouchMoveHandler),s.supportPointer&&Qa(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(){jl&&xc(jl),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;tl(t,"mouseup",this._disableDelayedDrag),tl(t,"touchend",this._disableDelayedDrag),tl(t,"touchcancel",this._disableDelayedDrag),tl(t,"mousemove",this._delayedDragTouchMoveHandler),tl(t,"touchmove",this._delayedDragTouchMoveHandler),tl(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?Qa(document,"pointermove",this._onTouchMove):Qa(document,e?"touchmove":"mousemove",this._onTouchMove):(Qa(jl,"dragend",this),Qa(Ll,"dragstart",this._onDragStart));try{document.selection?_c((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(n){}},_dragStarted:function(t,e){if(nc=!1,Ll&&jl){Nl("dragStarted",this,{evt:e}),this.nativeDraggable&&Qa(document,"dragover",wc);var n=this.options;!t&&sl(jl,n.dragClass,!1),sl(jl,n.ghostClass,!0),Cc.active=this,t&&this._appendGhost(),Pl({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(Hl){this._lastX=Hl.clientX,this._lastY=Hl.clientY,vc();for(var t=document.elementFromPoint(Hl.clientX,Hl.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Hl.clientX,Hl.clientY))!==e;)e=t;if(jl.parentNode[xl]._isOutsideThisEl(t),e)do{if(e[xl]){if(e[xl]._onDragOver({clientX:Hl.clientX,clientY:Hl.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=nl(e));bc()}},_onTouchMove:function(t){if(Vl){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=Dl&&ll(Dl,!0),s=Dl&&r&&r.a,a=Dl&&r&&r.d,l=uc&&ec&&gl(ec),c=(i.clientX-Vl.clientX+o.x)/(s||1)+(l?l[0]-ac[0]:0)/(s||1),d=(i.clientY-Vl.clientY+o.y)/(a||1)+(l?l[1]-ac[1]:0)/(a||1);if(!Cc.active&&!nc){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<n)return;this._onDragStart(t,!0)}if(Dl){r?(r.e+=c-(Xl||0),r.f+=d-(Yl||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,")");al(Dl,"webkitTransform",u),al(Dl,"mozTransform",u),al(Dl,"msTransform",u),al(Dl,"transform",u),Xl=c,Yl=d,Hl=i}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!Dl){var t=this.options.fallbackOnBody?document.body:Ll,e=ul(jl,!0,uc,!0,t),n=this.options;if(uc){for(ec=t;"static"===al(ec,"position")&&"none"===al(ec,"transform")&&ec!==document;)ec=ec.parentNode;ec!==document.body&&ec!==document.documentElement?(ec===document&&(ec=dl()),e.top+=ec.scrollTop,e.left+=ec.scrollLeft):ec=dl(),ac=gl(ec)}sl(Dl=jl.cloneNode(!0),n.ghostClass,!1),sl(Dl,n.fallbackClass,!0),sl(Dl,n.dragClass,!0),al(Dl,"transition",""),al(Dl,"transform",""),al(Dl,"box-sizing","border-box"),al(Dl,"margin",0),al(Dl,"top",e.top),al(Dl,"left",e.left),al(Dl,"width",e.width),al(Dl,"height",e.height),al(Dl,"opacity","0.8"),al(Dl,"position",uc?"absolute":"fixed"),al(Dl,"zIndex","100000"),al(Dl,"pointerEvents","none"),Cc.ghost=Dl,t.appendChild(Dl),al(Dl,"transform-origin",Gl/parseInt(Dl.style.width)*100+"% "+Zl/parseInt(Dl.style.height)*100+"%")}},_onDragStart:function(t,e){var n=this,o=t.dataTransfer,i=n.options;Nl("dragStart",this,{evt:t}),Cc.eventCanceled?this._onDrop():(Nl("setupClone",this),Cc.eventCanceled||((Ml=Cl(jl)).removeAttribute("id"),Ml.draggable=!1,Ml.style["will-change"]="",this._hideClone(),sl(Ml,this.options.chosenClass,!1),Cc.clone=Ml),n.cloneId=_c((function(){Nl("clone",n),Cc.eventCanceled||(n.options.removeCloneOnHide||Ll.insertBefore(Ml,jl),n._hideClone(),Pl({sortable:n,name:"clone"}))})),!e&&sl(jl,i.dragClass,!0),e?(oc=!0,n._loopId=setInterval(n._emulateDragOver,50)):(tl(document,"mouseup",n._onDrop),tl(document,"touchend",n._onDrop),tl(document,"touchcancel",n._onDrop),o&&(o.effectAllowed="move",i.setData&&i.setData.call(n,o,jl)),Qa(document,"drop",n),al(jl,"transform","translateZ(0)")),nc=!0,n._dragStartId=_c(n._dragStarted.bind(n,e,t)),Qa(document,"selectstart",n),Jl=!0,Ga&&al(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=Cc.active,d=Ul===l,u=a.sort,h=ql||c,p=this,m=!1;if(!lc){if(void 0!==t.preventDefault&&t.cancelable&&t.preventDefault(),s=ol(s,a.draggable,r,!0),N("dragOver"),Cc.eventCanceled)return m;if(jl.contains(t.target)||s.animated&&s.animatingX&&s.animatingY||p._ignoreWhileAnimating===s)return j(!1);if(oc=!1,c&&!a.disabled&&(d?u||(o=kl!==Ll):ql===this||(this.lastPutMode=Ul.checkPull(this,c,jl,t))&&l.checkPut(this,c,jl,t))){if(i="vertical"===this._getDirection(t,s),e=ul(jl),N("dragOverValid"),Cc.eventCanceled)return m;if(o)return kl=Ll,P(),this._hideClone(),N("revert"),Cc.eventCanceled||($l?Ll.insertBefore(jl,$l):Ll.appendChild(jl)),j(!0);var f=ml(r,a.draggable);if(!f||function(t,e,n){var o=ul(ml(n.el,n.options.draggable)),i=El(n.el,n.options,Dl),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===jl)return j(!1);if(f&&r===t.target&&(s=f),s&&(n=ul(s)),!1!==Ec(Ll,r,jl,e,s,n,t,!!s))return P(),f&&f.nextSibling?r.insertBefore(jl,f.nextSibling):r.appendChild(jl),kl=r,k(),j(!0)}else if(f&&function(t,e,n){var o=ul(pl(n.el,0,n.options,!0)),i=El(n.el,n.options,Dl),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=pl(r,0,a,!0);if(g===jl)return j(!1);if(n=ul(s=g),!1!==Ec(Ll,r,jl,e,s,n,t,!1))return P(),r.insertBefore(jl,g),kl=r,k(),j(!0)}else if(s.parentNode===r){n=ul(s);var v,b,y,w=jl.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}(jl.animated&&jl.toRect||e,s.animated&&s.toRect||n,i),E=i?"top":"left",x=hl(s,"top","top")||hl(jl,"top","top"),S=x?x.scrollTop:void 0;if(Kl!==s&&(b=n[E],rc=!1,sc=!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&&tc<c*i){if(!rc&&(1===Ql?l>d+c*r/2:l<u-c*r/2)&&(rc=!0),rc)h=!0;else if(1===Ql?l<d+tc:l>u-tc)return-Ql}else if(l>d+c*(1-i)/2&&l<u-c*(1-i)/2)return function(t){return fl(jl)<fl(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,sc,Kl===s),0!==v){var O=fl(jl);do{O-=v,y=kl.children[O]}while(y&&("none"===al(y,"display")||y===Dl))}if(0===v||y===s)return j(!1);Kl=s,Ql=v;var _=s.nextElementSibling,A=!1,T=Ec(Ll,r,jl,e,s,n,t,A=1===v);if(!1!==T)return 1!==T&&-1!==T||(A=1===T),lc=!0,setTimeout(Sc,30),P(),A&&!_?r.appendChild(jl):s.parentNode.insertBefore(jl,A?_:s),x&&wl(x,0,S-x.scrollTop),kl=jl.parentNode,void 0===b||sc||(tc=Math.abs(b-ul(s)[E])),k(),j(!0)}if(r.contains(jl))return j(!1)}return!1}function N(a,l){Nl(a,p,Fa({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 Ec(Ll,r,jl,e,n,ul(n),t,o)},changed:k},l))}function P(){N("dragOverAnimationCapture"),p.captureAnimationState(),p!==h&&h.captureAnimationState()}function j(e){return N("dragOverCompleted",{insertion:e}),e&&(d?c._hideClone():c._showClone(p),p!==h&&(sl(jl,ql?ql.options.ghostClass:c.options.ghostClass,!1),sl(jl,a.ghostClass,!0)),ql!==p&&p!==Cc.active?ql=p:p===Cc.active&&ql&&(ql=null),h===p&&(p._ignoreWhileAnimating=s),p.animateAll((function(){N("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(s===jl&&!jl.animated||s===r&&!s.animated)&&(Kl=null),a.dragoverBubble||t.rootEl||s===document||(jl.parentNode[xl]._isOutsideThisEl(t.target),!e&&yc(t)),!a.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),m=!0}function k(){Fl=fl(jl),zl=fl(jl,a.draggable),Pl({sortable:p,name:"change",toEl:r,newIndex:Fl,newDraggableIndex:zl,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){tl(document,"mousemove",this._onTouchMove),tl(document,"touchmove",this._onTouchMove),tl(document,"pointermove",this._onTouchMove),tl(document,"dragover",yc),tl(document,"mousemove",yc),tl(document,"touchmove",yc)},_offUpEvents:function(){var t=this.el.ownerDocument;tl(t,"mouseup",this._onDrop),tl(t,"touchend",this._onDrop),tl(t,"pointerup",this._onDrop),tl(t,"touchcancel",this._onDrop),tl(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;Fl=fl(jl),zl=fl(jl,n.draggable),Nl("drop",this,{evt:t}),kl=jl&&jl.parentNode,Fl=fl(jl),zl=fl(jl,n.draggable),Cc.eventCanceled||(nc=!1,sc=!1,rc=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Ac(this.cloneId),Ac(this._dragStartId),this.nativeDraggable&&(tl(document,"drop",this),tl(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Ga&&al(document.body,"user-select",""),al(jl,"transform",""),t&&(Jl&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),Dl&&Dl.parentNode&&Dl.parentNode.removeChild(Dl),(Ll===kl||ql&&"clone"!==ql.lastPutMode)&&Ml&&Ml.parentNode&&Ml.parentNode.removeChild(Ml),jl&&(this.nativeDraggable&&tl(jl,"dragend",this),xc(jl),jl.style["will-change"]="",Jl&&!nc&&sl(jl,ql?ql.options.ghostClass:this.options.ghostClass,!1),sl(jl,this.options.chosenClass,!1),Pl({sortable:this,name:"unchoose",toEl:kl,newIndex:null,newDraggableIndex:null,originalEvent:t}),Ll!==kl?(Fl>=0&&(Pl({rootEl:kl,name:"add",toEl:kl,fromEl:Ll,originalEvent:t}),Pl({sortable:this,name:"remove",toEl:kl,originalEvent:t}),Pl({rootEl:kl,name:"sort",toEl:kl,fromEl:Ll,originalEvent:t}),Pl({sortable:this,name:"sort",toEl:kl,originalEvent:t})),ql&&ql.save()):Fl!==Wl&&Fl>=0&&(Pl({sortable:this,name:"update",toEl:kl,originalEvent:t}),Pl({sortable:this,name:"sort",toEl:kl,originalEvent:t})),Cc.active&&(null!=Fl&&-1!==Fl||(Fl=Wl,zl=Bl),Pl({sortable:this,name:"end",toEl:kl,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){Nl("nulling",this),Ll=jl=kl=Dl=$l=Ml=Il=Rl=Vl=Hl=Jl=Fl=zl=Wl=Bl=Kl=Ql=ql=Ul=Cc.dragged=Cc.ghost=Cc.clone=Cc.active=null,cc.forEach((function(t){t.checked=!0})),cc.length=Xl=Yl=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":jl&&(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++)ol(t=n[o],r.draggable,this.el,!1)&&e.push(t.getAttribute(r.dataIdAttr)||Oc(t));return e},sort:function(t,e){var n={},o=this.el;this.toArray().forEach((function(t,e){var i=o.children[e];ol(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 ol(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=Al.modifyOption(this,t,e);n[t]=void 0!==o?o:e,"group"===t&&gc(n)},destroy:function(){Nl("destroy",this);var t=this.el;t[xl]=null,tl(t,"mousedown",this._onTapStart),tl(t,"touchstart",this._onTapStart),tl(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(tl(t,"dragover",this),tl(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),(function(t){t.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),ic.splice(ic.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!Rl){if(Nl("hideClone",this),Cc.eventCanceled)return;al(Ml,"display","none"),this.options.removeCloneOnHide&&Ml.parentNode&&Ml.parentNode.removeChild(Ml),Rl=!0}},_showClone:function(t){if("clone"===t.lastPutMode){if(Rl){if(Nl("showClone",this),Cc.eventCanceled)return;jl.parentNode!=Ll||this.options.group.revertClone?$l?Ll.insertBefore(Ml,$l):Ll.appendChild(Ml):Ll.insertBefore(Ml,jl),this.options.group.revertClone&&this.animate(jl,Ml),al(Ml,"display",""),Rl=!1}}else this._hideClone()}},dc&&Qa(document,"touchmove",(function(t){(Cc.active||nc)&&t.cancelable&&t.preventDefault()})),Cc.utils={on:Qa,off:tl,css:al,find:cl,is:function(t,e){return!!ol(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:yl,closest:ol,toggleClass:sl,clone:Cl,index:fl,nextTick:_c,cancelNextTick:Ac,detectDirection:fc,getChild:pl,expando:xl},Cc.get=function(t){return t[xl]},Cc.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&&(Cc.utils=Fa(Fa({},Cc.utils),t.utils)),Al.mount(t)}))},Cc.create=function(t,e){return new Cc(t,e)},Cc.version="1.15.3";var Tc,Nc,Pc,jc,kc,Dc,Lc=[],$c=!1;function Ic(){Lc.forEach((function(t){clearInterval(t.pid)})),Lc=[]}function Mc(){clearInterval(Dc)}var Rc=yl((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=dl(),d=!1;Nc!==n&&(Nc=n,Ic(),Tc=e.scroll,i=e.scrollFn,!0===Tc&&(Tc=vl(n,!0)));var u=0,h=Tc;do{var p=h,m=ul(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=al(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 T=C&&(Math.abs(b-r)<=a&&_+y<x)-(Math.abs(v-r)<=a&&!!_),N=E&&(Math.abs(g-s)<=a&&A+w<S)-(Math.abs(f-s)<=a&&!!A);if(!Lc[u])for(var P=0;P<=u;P++)Lc[P]||(Lc[P]={});Lc[u].vx==T&&Lc[u].vy==N&&Lc[u].el===p||(Lc[u].el=p,Lc[u].vx=T,Lc[u].vy=N,clearInterval(Lc[u].pid),0==T&&0==N||(d=!0,Lc[u].pid=setInterval(function(){o&&0===this.layer&&Cc.active._onTouchMove(kc);var e=Lc[this.layer].vy?Lc[this.layer].vy*l:0,n=Lc[this.layer].vx?Lc[this.layer].vx*l:0;"function"==typeof i&&"continue"!==i.call(Cc.dragged.parentNode[xl],n,e,t,kc,Lc[this.layer].el)||wl(Lc[this.layer].el,n,e)}.bind({layer:u}),24))),u++}while(e.bubbleScroll&&h!==c&&(h=vl(h,!1)));$c=d}}),30),Wc=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 Fc(){}function Bc(){}Fc.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=pl(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:Wc},Ua(Fc,{pluginName:"revertOnSpill"}),Bc.prototype={onSpill:function(t){var e=t.dragEl,n=t.putSortable||this.sortable;n.captureAnimationState(),e.parentNode&&e.parentNode.removeChild(e),n.animateAll()},drop:Wc},Ua(Bc,{pluginName:"removeOnSpill"}),Cc.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?Qa(document,"dragover",this._handleAutoScroll):this.options.supportPointer?Qa(document,"pointermove",this._handleFallbackAutoScroll):e.touches?Qa(document,"touchmove",this._handleFallbackAutoScroll):Qa(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(t){var e=t.originalEvent;this.options.dragOverBubble||e.rootEl||this._handleAutoScroll(e)},drop:function(){this.sortable.nativeDraggable?tl(document,"dragover",this._handleAutoScroll):(tl(document,"pointermove",this._handleFallbackAutoScroll),tl(document,"touchmove",this._handleFallbackAutoScroll),tl(document,"mousemove",this._handleFallbackAutoScroll)),Mc(),Ic(),clearTimeout(il),il=void 0},nulling:function(){kc=Nc=Tc=$c=Dc=Pc=jc=null,Lc.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(kc=t,e||this.options.forceAutoScrollFallback||Xa||Ha||Ga){Rc(t,this.options,r,e);var s=vl(r,!0);!$c||Dc&&o===Pc&&i===jc||(Dc&&Mc(),Dc=setInterval((function(){var r=vl(document.elementFromPoint(o,i),!0);r!==s&&(s=r,Ic()),Rc(t,n.options,r,e)}),10),Pc=o,jc=i)}else{if(!this.options.bubbleScroll||vl(r,!0)===dl())return void Ic();Rc(t,this.options,vl(r,!1),!1)}}},Ua(t,{pluginName:"scroll",initializeByDefault:!0})}),Cc.mount(Bc,Fc);const zc={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=zc.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=zc.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"===zc.getStyle(t,"display"))=>{n?zc.slideDown(t,e):zc.slideUp(t,e)}},Uc=t=>Number.isInteger(Number(t)),qc=t=>{let e=0,n=t;for(;null==n?void 0:n.previousElementSibling;)n=n.previousElementSibling,e++;return e},Vc=(t,e,n)=>{const o=n.split("||"),i=ni(e).map((e=>t.find((t=>{const n=o.find((e=>!!fs(t,e)));return n&&fs(t,n)===e})))).filter(Boolean).concat(t);return ni(i)},Hc=(t,e,n)=>{for(let o=0;o<t.length;o++)e.call(n,t[o],o)},Xc=(t,e)=>{const n=[];return Hc(t,((t,o)=>n.push(e(t,o)))),n},Yc={},Gc=t=>{if(Yc[t])return Yc[t];const e=({className:"class"}[t]||t).replace(/^\d+/,"").replace(/[^a-zA-Z0-9-:]/g,"");return Yc[t]=e,e},Zc=t=>t.replace(/\b\w/g,(t=>t.toUpperCase())),Jc=()=>-1!==window.navigator.userAgent.indexOf("MSIE "),Kc={capitalize:Zc,safeAttrName:Gc,forEach:Hc,copyObj:t=>window.JSON.parse(window.JSON.stringify(t)),map:Xc,subtract:(t,e)=>e.filter((e=>!~t.indexOf(e))),indexOfNode:qc,isInt:Uc,get:fs,orderObjectsBy:Vc,isIE:Jc},Qc={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="${Cr}${t}">${t}</i>`},td=new Set(["input","textarea","select"]),ed=(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=oi(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=nd.create(s).textContent),/^<.+>.+<.+>$/gim.test(s)&&(s=(t=>{const e=document.createElement("div");return e.innerHTML=t,e.textContent||e.innerText||""})(s)),i=`${r}-${Nr(((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 nd=new class{constructor(t=Object.create(null)){n(this,"render",(t=>(t.id=`f-${t.id||oi()}`,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:[Kc.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=ii(a.attrs,{className:i})),r){const t=this.processOptions(r,a,e);if(!this.holdsContent(h)||"button"===c)return Kc.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(Kc.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=Kc.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 nd.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 Hc(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=ei(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=>ei(t)===Ai)),n(this,"isStage",(t=>ei(t)===Ti)),n(this,"isRow",(t=>ei(t)===Ni)),n(this,"isColumn",(t=>ei(t)===Pi)),n(this,"isField",(t=>ei(t)===ji)),n(this,"asComponent",(t=>Nu[`${ei(t)}s`].get(t.id))),this.options=t}set setOptions(t){this.options=ii(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:nd.onRender,render:nd.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(`#${yi} svg symbol`);return this.iconSymbols=Array.from(t).reduce(((t,e)=>{var n;return t[e.id.replace(Cr,"")]={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=ii(r,e);return this.cachedIcons[i]=nd.create(t).outerHTML,this.cachedIcons[i]}return this.cachedIcons[i]=nd.create(r).outerHTML,this.cachedIcons[i]}return(null==(o=Qc[nd.options.iconFont])?void 0:o.call(Qc,t))||t}processAttrs(t,e,n){const{attrs:o={}}=t;if(!n&&!o.name&&null!==o.name&&this.isInput(t.tag)){const n=ed(t);n&&e.setAttribute("name",n)}for(const i of Object.keys(o)){const t=Kc.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||oi(),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),td.has(e)}parsedHtml(t){const e=document.createElement("textarea");return e.innerHTML=t,e.textContent}labelAfter(t){const e=Kc.get(t,"attrs.type"),n=Kc.get(t,"config.labelAfter");return void 0!==n?n:"checkbox"===e||"radio"===e}label(t,e){const n=Kc.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=ei(t);return e?Nu.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,Kc.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)}};Kc.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");zc.slideUp(t,600,(()=>{nd.empty(t),t.classList.remove("removing-all-fields"),nd.emptyClass(t),zc.slideDown(t,300)}))}toggleSortable(t,e){let n=e;const o=ei(t);if(!o)return;const i=ei(t.parentElement),r=nd[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($i.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)}},od="f-autocomplete",id=`${od}-display-field`,rd=`${od}-list`,sd="highlight-component",ad=`${rd}-item`,ld=["config.label","config.controlId"],cd=[...ld,"config.legend","name"],dd=t=>ld.reduce(((e,n)=>e||t.get(n)),null),ud=t=>cd.reduce(((e,n)=>e||t.get(n)),null)||Tr(t.name),hd=new Map([["condition.source",dd],["if.condition.source",dd],["if.condition.target",dd],["then.condition.target",ud],["condition.target",ud]]),pd=({id:t,...e},n)=>{const{name:o,label:i}=e;if(!o)return i;return hd.get(n)(e)},md=t=>(t.classList.contains(ad)||(t=t.parentElement),t),fd=({value:t,textLabel:e,htmlLabel:n,componentType:o,depth:i=0},r)=>{const s={tag:"li",children:n,dataset:{value:t,label:e},className:[ad,`${ad}-depth-${i}`,`component-type-${o}`],action:{mousedown:({target:t})=>{t=md(t),r.setValue(t),r.selectOption(t),r.hideList()},mouseover:({target:t})=>{t=md(t),r.removeHighlight(),r.highlightComponent(t)},mouseleave:({target:t})=>{t=md(t),r.removeHighlight()}}};return nd.create(s)},gd=t=>{const e=t.value,n=[],o=Nu.flatList(),i=Object.entries(o).reduce(((o,[i,r])=>{const s=pd(r,t.key);if(s){const a=r.name,l={tag:"span",content:` ${Tr(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 fd({value:i,textLabel:r,htmlLabel:s,componentType:"option",depth:1},e)}));return nd.create({tag:"ul",attrs:{className:[rd,"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(fd(p,t))}return o}),[]);return i};class vd{constructor({key:t,value:e,className:o,onChange:i=hi}){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||hi,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 ci(this.value)}get valueComponent(){return ci(this.value)&&Nu.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(`${od}-focused`);const n=nd.toggleElementsByStr(this.list.querySelectorAll(`.${ad}-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(`${od}-focused`),e.removeEventListener("keydown",t),this.hideList()},input:t=>{const{value:e}=t.target,n=nd.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=nd.create({tag:"input",autocomplete:"off",action:e,attrs:{type:"text",className:id,value:this.label||this.value,placeholder:r.get(`${this.key}.placeholder`)}}),this.hiddenField=nd.create({tag:"input",attrs:{type:"hidden",className:od,value:this.value}}),this.list=nd.create({tag:"ul",attrs:{className:rd}}),this.clearButton=nd.create({tag:"span",content:nd.icon("remove"),className:"clear-button hidden",action:{click:()=>this.clearValue()}}),this.dom=nd.create({children:[this.displayField,this.clearButton,this.hiddenField],className:[od,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(!ci(this.value))return this.value;const t=this.value&&Nu.getAddress(this.value);return t&&pd(t,`${this.key}`)||this.value}updateOptions(){let t=this.optionsCache;const e=Date.now();(e-this.lastCache>5*rr||!t)&&(nd.empty(this.list),t=this.generateOptions(),this.lastCache=e),this.list.children.length||this.list.append(...t)}generateOptions(){return this.optionsCache=gd(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),zc.slideDown(e,ir)}hideList(t=this.list){zc.slideUp(t,ir),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"),ci(t)){const e=Nu.getAddress(t);null==(n=null==e?void 0:e.dom)||n.classList.remove(sd)}}t&&(t.classList.add("active-option"),this.highlightComponent(t))}removeHighlight(){const t=document.getElementsByClassName(sd);for(const e of t)e.classList.remove(sd)}highlightComponent(t){var e;const{dataset:{value:n}}=t;if(ci(n)){const{componentAddress:t,isOptionAddress:o,optionIndex:i}=Pr(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=Nu.getAddress(t);if((null==r?void 0:r.dom)&&(r.dom.classList.add(sd),o)){null==(e=r.dom.querySelectorAll(".field-preview .f-checkbox, .field-preview .f-radio")[i])||e.classList.add(sd)}}}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 bd({key:t,value:e,type:n="text",checked:o}){const i={tag:"input",attrs:{type:n,value:e,placeholder:r.get(`${t}.placeholder`)||Tr(t)},className:[t.replace(/\./g,"-")],config:{}};return o&&(i.attrs.checked=!0),i}function yd(t){const e=r.get(t);if(e)return e;const n=t.split(".");return r.get(n[n.length-1])}const wd={autocomplete:(...t)=>new vd(...t).createProxy(),string:({key:t,value:e})=>bd({key:t,value:e}),boolean:({key:t,value:e})=>bd({key:t,value:e,type:"selected"===t?"radio":"checkbox",checked:!!e}),number:({key:t,value:e})=>bd({key:t,value:e,type:"number"}),array:({key:t,value:e})=>({tag:"select",attrs:{placeholder:yd(`placeholder.${t}`)},className:[t.replace(/\./g,"-")],options:e}),object:t=>Object.entries(t).map((([t,e])=>wd[nd.childType(e)]({key:t,value:e})))},Cd={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:()=>({})},Ed="hidden-property",xd=/\.options\[\d+\]$/,Sd={"if-sourceProperty":vs(mr,hr,pr),"if-targetProperty":vs(mr),"then-targetProperty":vs(mr,hr,pr),...Object.entries(fr).reduce(((t,[e,n])=>(t[`if-${e}`]=n,t[`then-${e}`]=n,t)),{})},Od={assignment:Ad,comparison:Ad,logical:Ad,source:({key:t,value:e,onChange:n,conditionType:o})=>wd.autocomplete({key:`${o}.condition.${t}`,value:e,onChange:n,className:`condition-${t}`}),sourceProperty:Ad,targetProperty:Ad,target:t=>Od.source(t),value:({key:t,value:e,onChange:n},o)=>{const i=wd.string({key:`condition.${t}`,value:e});return i.action={input:n},i}};function _d({key:t,value:e,conditionType:n}){const o=Sd[`${n}-${t}`];return Object.entries(o||{}).map((([n,o])=>function({fieldName:t,fieldValue:e,key:n,optionValue:o}){return{label:r.get(`${t}.${n}`)||Tr(n).toLowerCase(),value:o,selected:o===e}}({fieldName:t,fieldValue:e,key:n,optionValue:o})))}function Ad({key:t,value:e,onChange:n,conditionType:o}){const i=_d({key:t,value:e,conditionType:o}),r=wd.array({key:`condition.${t}`,value:i});return r.action={change:n},r}const Td={sourceProperty:t=>{const e=t.get("source"),n=t.get("sourceProperty"),o=!!e.value,i=!!e.value.match(xd);return kd(i,n),!o},comparison:t=>{const e=t.get("source"),n=t.get("sourceProperty"),o=!!e.value,i=!!e.value.match(xd);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(xd);return kd(o,n),i=e.value,!Ri.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(Ed))||(n.value===Pd||n.value.startsWith("is"))));var o}},Nd=t=>{var e;for(const[n,o]of t){const i=!!(null==(e=Td[n])?void 0:e.call(Td,t))||!1;o.classList.toggle(Ed,i)}},Pd="isChecked",jd=t=>t.value.endsWith("Checked"),kd=(t,e)=>{var n;if(t&&jd(e))return null;const o=Array.from(e.querySelectorAll("option")),i=[];for(const r of o){const e=jd(r),n=t?!e:e;n&&i.push(r.value),r.classList.toggle("hidden-option",n)}i.includes(e.value)&&(e.value=t?Pd:(null==(n=o.find((t=>!jd(t))))?void 0:n.value)||e.value)};class Dd{constructor({conditionValues:t,conditionType:e,conditionCount:o,index:i},r){n(this,"updateDataDebounced",di((t=>{Lu.formeoUpdated(t),Nu.setAddress(t.dataPath,t.value)}))),n(this,"onChangeCondition",(({key:t,target:e})=>{const n={changedProperty:t,dataPath:this.address,value:this.value,src:e};Nd(this.fields),this.updateDataDebounced(n)})),this.values=new Map(function(t,e=ur){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=Nu.getAddress(this.baseAddress);t.splice(this.index,1),Nu.setAddress(this.baseAddress,t),zc.slideUp(this.dom,ir,(()=>{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=Od[n](i,this.values),s=r.dom||nd.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 nd.create(e)}generateConditionTypeActionButtons(){const t=[],e="manage-condition-type",n=t=>`${t}-condition-type`,o=nd.btnTemplate({title:r.get(`remove${this.conditionType}Condition`),className:[e,n("remove")],content:nd.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=nd.btnTemplate({title:r.get(`add${this.conditionType}Condition`),className:[e,n("add")],content:nd.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(){Nd(this.fields),this.dom.classList.remove("display-none")}}const Ld=new Map([["attrs",({itemKey:t})=>t],["options",({itemKey:t,key:e})=>`${t}.${e}`]]),$d=(t,e)=>{if("select"===e.controlId){const n=e.editPanels.get("options"),[o,i]=t?xr:Sr,r=n.data.map((({[o]:t,...e})=>({[i]:t,...e})));n.setData(r)}},Id=new Map([["attrs-multiple",t=>({change:({target:e})=>{"select"===t.field.controlId&&$d(e.checked,t.field)}})]]);class Md{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]=br()[t],i=n.children.length;"if"===t&&(e.logical="||"),o={conditionValues:e,conditionCount:i,index:i}}const i=new Dd({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=jr(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=nd.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?Vc(Object.entries(t),xr,"0"):[[this.itemKey,t]]}findOrCreateConditionTypeWrap(t){let e=this.conditionTypeWrap.get(t);return e||(e=nd.create({className:`type-conditions-wrap ${t}-conditions-wrap`}),this.conditionTypeWrap.set(t,e),e)}itemInputs(){const t=nd.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:()=>{zc.slideUp(this.dom,or,(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:nd.icon("remove")};return{className:`${this.panelName}-prop-controls prop-controls`,content:[t]}}itemInput(t,e){var n,o;const i=nd.childType(e)||"string",r=(null==(n=Ld.get(this.panelName))?void 0:n({itemKey:this.itemKey,key:t}))||this.itemKey,s=r.split(".").filter(Number.isNaN).join(".")||t,a=wd[i]({key:t,value:e}),l=`${this.field.shortId}-${jr(r).replace(/-\d+-(selected)/g,"-$1")}`,c={label:"options"!==this.panelName&&(yd(s)||Tr(s)),labelAfter:!1},d={name:"checkbox"===a.attrs.type?`${l}[]`:l};d.disabled=this.isDisabled,d.locked=this.isLocked;const u=null==(o=Id.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}(Cd[i](r,this.field),u||{}),p=ii(wd[i]({key:t,value:e}),{action:h,attrs:d,config:c});return xr.includes(t)?{className:"f-addon",children:p}:p}}const Rd={multiple:(t,e)=>{$d(!!t,e)}};class Wd{constructor(t,e,o){n(this,"addAttribute",((t,e)=>{var n;let o=e;const i=Gc(t),s=`attrs.${i}`;r.current[s]||r.put(s,Zc(t)),"string"==typeof o&&["true","false"].includes(o)&&(o=JSON.parse(o)),this.component.set(`attrs.${t}`,o),null==(n=Rd[i])||n.call(Rd,o,this.component);const a=this.props.querySelector(`.${this.component.name}-attrs-${i}`),l=new Md({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=Nr(o));const l=new Md({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 Md({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()}};Ru.remove[this.name](e);const n=Tr(this.name),o=new window.CustomEvent(`onRemove${n}`,{detail:e});document.dispatchEvent(o)})),this.type=nd.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:`${_i} ${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 Md({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 nd.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={...nd.btnTemplate({content:[nd.icon("bin"),r.get("clearAll")],title:r.get("clearAll")}),className:`clear-all-${t}`,action:{click:()=>{this.clearAllItems()}}};o.push(e)}const i={...nd.btnTemplate({content:e,title:e}),className:`add-${t}`,action:{click:e=>{const o={btnCoords:nd.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=Tr(t),s=new window.CustomEvent(`onAdd${i}`,{detail:o});Ru.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 Fd=Object.freeze({type:"field",displayType:"slider"}),Bd=t=>({transform:`translateX(${t?`${t}px`:0})`});class zd{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=ii(Fd,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)}),rr)}getPanelDisplay(){const t=this.panelsWrap,e=Number.parseInt(nd.getStyle(t,"width"),10)>390?"tabbed":"slider",n="auto"===this.opts.displayType;return this.panelDisplay=n?e:this.opts.displayType||Fd.displayType,this.panelDisplay}createPanelsWrap(){const t=nd.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 Kc.forEach(e,(t=>{t.fieldId=this.opts.id,t.isSortable&&Cc.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=qc(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",nd.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:nd.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:nd.icon("triangle-left")};return nd.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=qc(this.currentPanel);let r={nav:0,panel:0},s={...r};t.groupChange=t=>(this.activePanelIndex=t,this.currentPanel=i[t],nd.removeClasses(i,"active-panel"),nd.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=ir,animate:r=!this.isTabbed})=>{const a=[Bd(s.panel),Bd(t.panel)],l=[Bd(s.nav),Bd(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 Ud=null;const qd=vs(mr);class Vd extends Ma{constructor(t,e={}){const o={...e,id:e.id||oi()};super(t,o),n(this,"remove",(t=>{if(t){const e=Pr(t),n=e.pop(),o=this.get(e);return Array.isArray(o)?Uc(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]}),Hc(n,(t=>t.remove())),this.dom.parentElement.removeChild(this.dom),((t,e)=>{const n=t.indexOf(e);-1!==n&&t.splice(n,1)})(Nu.getAddress(`${e.name}s.${e.id}.children`),this.id),e.children.length||e.emptyClass(),"row"===e.name&&e.autoColumnWidths(),Nu[`${this.name}s`].delete(this.id)})),n(this,"emptyClass",(()=>this.dom.classList.toggle("empty",!this.children.length))),n(this,"getComponentTag",(()=>nd.create({tag:"span",className:["component-tag",`${this.name}-tag`],children:[(this.isColumn||this.isField)&&nd.icon("component-corner",{className:"bottom-left"}),nd.icon(`handle-${this.name}`),Tr(this.name),(this.isColumn||this.isRow)&&nd.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[nd.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-${ei(t)}`),null==e||e.classList.remove(`hovering-${ei(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,!qd[i]].some(Boolean)?t:e?o.set(qd[i],e):o.get(qd[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={...ri(this.data),id:oi()};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=>nd.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=ni([...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=nd.childType(e);if(t.includes(n)){const t=new Wd(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 zd(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=Nu[`${this.name}s`].config,ii(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:()=>{Nu.stages.active.dom.classList.add(`active-hover-${this.name}`),this.dom.classList.add(...t)},mouseleave:({target:e})=>{this.dom.classList.remove(...t),Nu.stages.active.dom.classList.remove(`active-hover-${this.name}`),e.removeAttribute("style")}},children:[{...nd.btnTemplate({content:nd.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`);zc.slideToggle(i,or,t),"field"===this.name&&(zc.slideToggle(this.preview,or,!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}`)=>({...nd.btnTemplate({content:nd.icon(t)}),className:["component-handle"]}),move:(t="move")=>({...nd.btnTemplate({content:nd.icon(t)}),className:["item-move"],meta:{id:"move"}}),edit:(t="edit")=>({...nd.btnTemplate({content:nd.icon(t)}),className:["edit-toggle"],meta:{id:"edit"},action:{click:()=>{this.toggleEdit()}}}),remove:(t="remove")=>({...nd.btnTemplate({content:nd.icon(t)}),className:["item-remove"],meta:{id:"remove"},action:{click:()=>{zc.slideUp(this.dom,or,(()=>{if("column"===this.name){this.parent.autoColumnWidths(),this.remove()}else this.remove()}))}}}),clone:(t="copy")=>({...nd.btnTemplate({content:nd.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 qc(this.dom)}get parentType(){return Qi.get(this.name)}get parent(){const t=this.parentType;if(!this.dom||!t)return null;const e=this.dom.closest(`.${qi[t]}`);return e&&nd.asComponent(e)}get children(){if(!this.dom)return[];const t=this.domChildren,e=Ji.get(this.name);return Xc(t,(t=>Nu.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=oi()}=i,a=Ji.get(this.name);if(!a)return null;const l=`${a}s`,c=Nu.getAddress(`${l}.${s}`)||Nu[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(Ai)||(t=t.parentElement);const r=ei(t),s=ei(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=qc(this.dom);return()=>this.parent.addChild(t,e+1)}],[2,t=>()=>this.parent.parent.addChild(t)]]),l={controls:async()=>{if(!Ud){const{default:t}=await Promise.resolve().then((()=>vu));Ud=t}const{controlData:{meta:{id:t},...e}}=Ud.get(n.id);gs(e,"config.controlId",t);const i=t.startsWith("layout-")?t.replace(/^layout-/,""):"field",r=fs({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)();nd.remove(n);return s(e,o)},row:()=>{const t=(a.get({stage:-1,row:0,column:1}[s])||ui)();return null==t?void 0:t({id:n.id},o)},column:()=>{const t=(a.get({stage:-2,row:-1}[s])||ui)();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(Pi)&&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&&nd.onRender(this.dom,t.onRender)}set config(t){const e=fs(t,"all"),n=fs(this.data,"config.controlId"),o=[e,n&&fs(t,n),fs(t,this.id)].reduce(((t,e)=>e?ii(t,e):t),this.configVal);this.configVal=o}get config(){return this.configVal}getComponent(t){const[e,n]=t.split("."),o=Nu[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===zi.row}get isColumn(){return this.name===zi.column}get isField(){return this.name===zi.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",nd.remove(t)}else this.resizePanelWrap()}},nd.create(t)}}class Hd{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=nd.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(`.${Ni}`);if(this.validateResizeTarget(e,n))if(this.startX="touchstart"===t.type?t.touches[0].clientX:t.clientX,o.classList.add(Li),this.columnPreset=o.querySelector(`.${Di}`),this.originalColumnClass=e.className,this.originalSiblingClass=n.className,e.className=e.className.replace(wr,""),n.className=n.className.replace(wr,""),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(si(e,this.rowWidth)),i=parseFloat(si(n,this.rowWidth));return o<10||i<10?null:{colWidth:ai(o.toFixed(1)),siblingColWidth:ai(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(),Nu.setAddress(`columns.${t.id}.config.width`,t.dataset.colWidth),Nu.setAddress(`columns.${e.id}.config.width`,e.dataset.colWidth),this.row.classList.remove(Li),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(Li),window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onStop)}setCustomWidthValue(){const t=this.columnPreset;let e=t.querySelector(`.${ki}`);const n=this.row.querySelector(".children").children,o=Xc(n,(t=>si(t.clientWidth,this.rowWidth).toFixed(1))),i=o.join(","),r=o.join(" | ");return e||(e=nd.create({tag:"option",attrs:{className:ki,value:i,selected:!0},content:r}),t.append(e)),e.value=i,e.textContent=r,i}}const Xd=t=>({className:"resize-x-handle",action:{pointerdown:t.onStart.bind(t)},content:[nd.icon("triangle-down"),nd.icon("triangle-up")]}),Yd=()=>({className:"column-edit group-config"});class Gd extends Vd{constructor(t){super("column",{...Object.freeze({config:{width:"100%"},children:[],className:[Pi]}),...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=nd.create({tag:"li",className:[Pi,"empty"],dataset:{hoverTag:r.get("column")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),Yd(),Xd(new Hd),e]}),this.processConfig(),Lu.columnResized=new window.CustomEvent("columnResized",{detail:{column:this.dom,instance:this}}),Cc.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:`.${ji}`,handle:".item-move"})}processConfig(){const t=Kc.get(this.data,"config.width");t&&this.setDomWidth(t)}}const Zd={actionButtons:{buttons:["clone","move","remove"],disabled:[]}};const Jd=new class extends Ra{constructor(t){super("columns",t),this.config={all:Zd}}Component(t){return new Gd(t)}};class Kd extends Vd{constructor(t){super("row",{...Object.freeze({config:{fieldset:!1,legend:"",inputGroup:!1},children:[],className:[Ni]}),...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(wr);const t=n.dom,o=ai(e);n.set("config.width",o),t.style.width=o,t.dataset.colWidth=o;const i=setTimeout((()=>{clearTimeout(i),n.refreshFieldPanels()}),ir);document.dispatchEvent(Lu.columnResized)}this.updateColumnPreset()})),n(this,"updateColumnPreset",(()=>{this.columnPresetControl.innerHTML="";const t=this.getColumnPresetOptions.map((({label:t,...e})=>nd.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=nd.create({tag:"li",className:[Ni,"empty"],dataset:{hoverTag:r.get("row"),editingHoverTag:r.get("editing.row")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),this.editWindow,e]}),Cc.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:`.${Pi}`,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=nd.formGroup([t,n]),i={tag:"label",content:r.get("defineColumnWidths"),className:"col-sm-4 form-control-label"};this.columnPresetControl=nd.create(this.columnPresetControlConfig);const s={className:"col-sm-8",content:this.columnPresetControl,action:{onRender:()=>{this.updateColumnPreset()}}},a=[e,"hr",o,"hr",nd.formGroup([i,s],"row")];return nd.create({className:`${this.name}-edit group-config`,action:{onRender:t=>{const e=a.map((t=>nd.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=tr.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:ki}),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:Di},action:{change:({target:t})=>{const{value:e}=t;this.setColumnWidths(e)}},options:this.getColumnPresetOptions}}}const Qd={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]}};const tu=new class extends Ra{constructor(t){super("rows",t),this.config={all:Qd}}Component(t){return new Kd(t)}};class eu extends Vd{constructor(t){super("stage",{conditions:[br()],children:[],...t}),this.updateEditPanels(),this.debouncedUpdateEditPanels=di(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=nd.create({attrs:{className:[Ti,"empty"],id:this.id},children:[this.getComponentTag(),this.getActionButtons(),this.editWindow,e]}),Cc.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:()=>{nu.active=this},onSort:this.onSort.bind(this),draggable:`.${Ni}`,handle:".item-move"})}empty(t=!0){return new Promise((e=>{t?(this.dom.classList.add("removing-all-fields"),zc.slideUp(this.dom,or,(()=>{e(super.empty(t)),this.dom.classList.remove("removing-all-fields"),zc.slideDown(this.dom,or)}))):e(super.empty())}))}onAdd(...t){const e=super.onAdd(...t);e&&"column"===e.name&&e.parent.autoColumnWidths()}}const nu=new class extends Ra{constructor(t){super("stages",t),this.config={all:{actionButtons:{buttons:["edit"],disabled:[]},panels:{disabled:[],order:["attrs","options","conditions"]}}}}Component(t){return new eu(t)}},ou={js:new Set,css:new Set},iu=(t,e,n=hi)=>new Promise((o=>fetch(t).then((t=>{if(!t.ok)return o(n(t));o(e?e(t):t)})).catch((t=>n(t))))),ru=(t,e)=>{t.removeEventListener("load",ru),e(t.src)},su=(t,e)=>{t.removeEventListener("load",su),e(t.src)},au=t=>new Promise(((e,n)=>{if(ou.js.has(t))return e(t);ou.js.add(t);const o=nd.create({tag:"script",attrs:{type:"text/javascript",async:!0,src:t},action:{load:()=>su(o,e),error:()=>n(new Error(`${t} failed to load.`))}});document.head.appendChild(o)})),lu=t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>new Promise(((e,n)=>{if(ou.css.has(t))return e(t);ou.css.add(t);const o=nd.create({tag:"link",attrs:{rel:"stylesheet",href:t},action:{load:()=>ru(o,e),error:()=>n(new Error(`${(void 0).src} failed to load.`))}});document.head.appendChild(o)}))));return Promise.all(e)},cu=async(t=xi)=>{if(document.getElementById(yi))return;const e=async t=>(t=>{let e=document.getElementById(yi);return e||(e=nd.create({id:yi,children:t,attrs:{hidden:!0,style:"display: none;"}}),document.body.insertBefore(e,document.body.childNodes[0])),e})(await t.text());return iu(t,e,(()=>iu(Si,e)))},du={js:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>au(t)));return Promise.all(e)},css:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>lu(t)));return Promise.all(e)}},uu=t=>{const e=Object.entries(t).map((([t,e])=>du[t](e)));return Promise.all(e)},hu=()=>{const t=document.getElementById(yi);return"hidden"===window.getComputedStyle(t).visibility};class pu{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||oi()}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:nd.icon(t.icon)},{tag:"span",className:"control-label",content:n}],action:{focus:({target:t})=>{const e=t.closest(`.${Ai}`);return e&&gu.panels.nav.refresh(qc(e))},click:({target:t})=>{var e;const n=null==(e=t.closest(".field-control"))?void 0:e.id;n&&gu.addElement(n)}}};return nd.create({tag:"li",id:this.id,className:["field-control",`${t.group}-control`,`${t.id}-control`],content:o,meta:t,action:this.controlAction})}promise(){return uu(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 mu=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 fu=class{constructor(){n(this,"groupLabel",(t=>r.get(t)||t||"")),n(this,"layoutTypes",{row:()=>nu.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}=fs(this.get(t),"controlData");return gs(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}=ii(mu,t);this.container=e,this.groupOrder=ni(o.concat(["common","html","layout"])),this.options=i;const[r,s,a]=await Promise.all([Promise.resolve().then((()=>nh)),Promise.resolve().then((()=>sh)),Promise.resolve().then((()=>dh))]),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(`.${Ai}`);return e&&this.panels.nav.refresh(qc(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 pu(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=Vc(t,this.groupOrder,"id"),t=t.filter((t=>ti(t.id,this.options.disable.groups))),n=t.map((t=>{const n={tag:"ul",attrs:{className:[Ai,_i],id:`${t.id}-${Ai}`},config:{label:this.groupLabel(t.label)}};if(this.options.elementOrder[t.id]){const e=this.options.elementOrder[t.id],n=ni(e.concat(t.elementOrder));t.elementOrder=n}return e=Vc(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=[ti(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=ri(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 ri(this.data.get(t))}formActions(){if(!0===this.options.disable.formActions)return null;const t={...nd.btnTemplate({content:[nd.icon("bin"),r.get("clear")],title:r.get("clearAll")}),className:["clear-form"],action:{click:t=>{tu.size?(Lu.confirmClearAll=new window.CustomEvent("confirmClearAll",{detail:{confirmationMessage:r.get("confirmClearAll"),clearAllAction:()=>{nu.clearAll().then((()=>{const e={src:t.target};Lu.formeoCleared(e)}))},btnCoords:nd.coords(t.target)}}),document.dispatchEvent(Lu.confirmClearAll)):window.alert(r.get("cannotClearFields"))}}},e={...nd.btnTemplate({content:[nd.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((()=>Pu)),{formData:n}=e,o={action:()=>{},coords:nd.coords(t),message:"",button:t};return Ru.click.btn(o),Ru.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 zd({panels:e,type:"controls",displayType:o});const i=["control-groups","formeo-panels-wrap",`panel-count-${e.length}`],s=nd.create({className:i,content:[this.panels.panelNav,this.panels.panelsWrap]}),a=["formeo-controls"];t&&a.push("formeo-sticky");const l=nd.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(nd.toggleElementsByStr(n,t),e){const e=r.get("controls.filteringTerm",t);l.classList.add("filtered"),o?o.textContent=e:(o=nd.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),Cc.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((()=>Cu));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 gu=new fu,vu=Object.freeze(Object.defineProperty({__proto__:null,Controls:fu,default:gu},Symbol.toStringTag,{value:"Module"})),bu=new Set(["checkbox","radio"]),yu=new Set(["radio","checkbox","select-one","select-multiple"]);class wu extends Vd{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=di(this.updateEditPanels),this.debouncedUpdatePreview=di(this.updatePreview),this.label=nd.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=nd.create({tag:"li",attrs:{className:ji},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&&nd.requiredMark()]}}set(t,e){const n=this.setData(t,e);return this.debouncedUpdatePreview(),n}updateLabel(){if(!this.label)return null;const t=nd.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(yu.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=qc(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}=ri(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:nd.create(n,!0),action:this.defaultPreviewActions};return nd.create(o,!0)}get isCheckable(){return bu.has(this.get("config.controlId"))}}const Cu=Object.freeze(Object.defineProperty({__proto__:null,default:wu},Symbol.toStringTag,{value:"Module"}));const Eu=new class extends Ra{constructor(t){super("fields",t),n(this,"get",(t=>{let e=t&&fs(this.data,t);if(!e){const n=gu.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=pi(t);this.empty();for(const[n,o]of Object.entries(e)){const{meta:t,...e}=o;(null==t?void 0:t.id)&&gs(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 wu(t)}},xu=nu,Su=tu,Ou=Jd,_u=Eu,Au=gu;class Tu extends Ma{constructor(){super("components"),n(this,"load",((t,e)=>{this.empty();const n=((t,e=!1)=>t?ri(pi(t)):e&&li.get(er)||Er())(t,e.sessionStorage);this.opts=e,this.set("id",n.id),this.add("stages",xu.load(n.stages)),this.add("rows",Su.load(n.rows)),this.add("columns",Ou.load(n.columns)),this.add("fields",_u.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=xu,this.rows=Su,this.columns=Ou,this.fields=_u,this.controls=Au}flatList(){const t={};for(const e of Object.keys(this.data.stages))fi(this.data,e,"stages",t);return t}get json(){return window.JSON.stringify({$schema:`https://cdn.jsdelivr.net/npm/formeo@${vi}/dist/formData_schema.json`,...this.formData})}get formData(){return{id:this.get("id"),stages:nu.getData(),rows:tu.getData(),columns:Jd.getData(),fields:Eu.getData()}}set config(t){const{stages:e,rows:n,columns:o,fields:i}=t;xu.config=e,Su.config=n,Ou.config=o,_u.config=i}getIndex(t){return this[t]||this[Bi.get(t)]}setAddress(t,e){if(!ci(t))return;const[n,o,...i]=Array.isArray(t)?t:Pr(t),r=this.getIndex(n).get(o);return null==r||r.set(i,e),r}getAddress(t){if(!ci(t))return;const[e,n,...o]=Array.isArray(t)?t:Pr(t),i=this.getIndex(e).get(n);return!o.length||i?o.length?i.get(o):i:void 0}}const Nu=new Tu,Pu=Object.freeze(Object.defineProperty({__proto__:null,Columns:Ou,Components:Tu,Controls:Au,Fields:_u,Rows:Su,Stages:xu,default:Nu},Symbol.toStringTag,{value:"Module"})),ju="no-transition",ku={debug:!1,bubbles:!0,formeoLoaded:t=>{},onAdd:()=>{},onChange:(...t)=>ku.onUpdate(...t),onUpdate:t=>{var e;return(null==(e=Lu.opts)?void 0:e.debug)&&void 0},onUpdateStage:t=>{var e;return(null==(e=Lu.opts)?void 0:e.debug)&&void 0},onUpdateRow:t=>{var e;return(null==(e=Lu.opts)?void 0:e.debug)&&void 0},onUpdateColumn:t=>{var e;return(null==(e=Lu.opts)?void 0:e.debug)&&void 0},onUpdateField:t=>{var e;return(null==(e=Lu.opts)?void 0:e.debug)&&void 0},onRender:t=>{var e;return(null==(e=Lu.opts)?void 0:e.debug)&&void 0},onSave:t=>{},confirmClearAll:t=>{window.confirm(t.confirmationMessage)&&t.clearAllAction(t)}},Du=({src:t,...e},n=ar)=>{var o,i;const r=new window.CustomEvent(n,{detail:e,bubbles:(null==(o=Lu.opts)?void 0:o.debug)||(null==(i=Lu.opts)?void 0:i.bubbles)});return r.data=(t||document).dispatchEvent(r),r},Lu={init:function(t){return this.opts={...ku,...t},this},formeoSaved:t=>Du(t,sr),formeoUpdated:t=>Du(t,ar),formeoCleared:t=>Du(t,"formeoCleared"),formeoOnRender:t=>Du(t,lr),formeoConditionUpdated:t=>Du(t,"formeoConditionUpdated")},$u=function(t,e=rr){let n=0;return function(...o){const i=Date.now();i-n>=e&&(n=i,t.apply(this,o))}}((()=>{Lu.opts.onUpdate({timeStamp:window.performance.now(),type:ar,detail:Nu.formData})}),ir);let Iu;document.addEventListener(ar,$u),document.addEventListener("formeoUpdatedStage",(t=>{const{timeStamp:e,type:n,detail:o}=t;Lu.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedRow",(t=>{const{timeStamp:e,type:n,detail:o}=t;Lu.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedColumn",(t=>{const{timeStamp:e,type:n,detail:o}=t;Lu.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedField",(t=>{const{timeStamp:e,type:n,detail:o}=t;Lu.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener(lr,(t=>{const{timeStamp:e,type:n,detail:o}=t;Lu.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},Lu.opts.confirmClearAll(t)})),document.addEventListener(sr,(({timeStamp:t,type:e,detail:{formData:n}})=>{const o={timeStamp:t,type:e,formData:n};Lu.opts.onSave(o)})),document.addEventListener("formeoLoaded",(t=>{Lu.opts.formeoLoaded(t.detail.formeo)})),window.addEventListener("resize",(function(){Iu=Iu||window.requestAnimationFrame((()=>{Iu=!1;for(const t of Object.values(Ou.data))t.dom.classList.add(ju),Au.dom.classList.add(ju),Au.panels.nav.refresh(),t.refreshFieldPanels()}))}));const Mu={add:{attr:t=>{const e=window.prompt(t.message.attr);if(e&&t.isDisabled(e))return window.alert(r.get("attributeNotPermitted",e||"")),Ru.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:ui}},Ru={init:function(t){const e=Object.keys(Mu);return this.opts=e.reduce(((e,n)=>(e[n]={...Mu[n],...t[n]},e)),t),this},add:{attrs:t=>Ru.opts.add.attr(t),options:t=>Ru.opts.add.option(t),conditions:t=>(t.template=t.template||br(),Ru.opts.add.condition(t))},remove:{attrs:t=>Ru.opts.remove.attrs(t),options:t=>Ru.opts.remove.options(t),conditions:t=>Ru.opts.remove.conditions(t)},click:{btn:t=>Ru.opts.click.btn(t)},save:{form:t=>(Ru.opts.sessionStorage&&li.set(er,t),Lu.formeoSaved({formData:t}),Ru.opts.save.form(t))}};r.addLanguage("en-US",void 0);const Wu={get editor(){return{stickyControls:!1,allowEdit:!0,dataType:"json",debug:!1,sessionStorage:!1,editorContainer:null,svgSprite:xi,style:Oi,iconFont:null,config:{},events:{},actions:{},controls:{},polyfills:Jc(),i18n:{location:"https://draggable.github.io/formeo/assets/lang/"},onLoad:()=>{}}}};let Fu=class{constructor({formData:t,...e},n){const o=ii(Wu.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,nd.setOptions=c,Nu.config=a,this.userFormData=n||t,this.Components=Nu,this.dom=nd,Lu.init({debug:s,...r}),Ru.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=mi(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)?wi.filter((({name:e})=>-1!==t.indexOf(e))):wi;Promise.all(e.map((({src:t})=>au(t))))})(this.opts.polyfills),await cu(this.opts.svgSprite),e.push((async t=>{if(!hu()&&(await lu(t),!hu()))return await lu("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(nr)}));const n=await Promise.all(e);return this.opts.allowEdit&&this.init(),n}init(){return gu.init(this.opts.controls,this.opts.stickyControls).then((t=>{var e,n;this.controls=t,this.load(this.userFormData,this.opts),this.formId=Nu.get("id"),this.i18n={setLang:t=>{var e;null==(e=window.sessionStorage)||e.setItem(nr,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(Nu.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,nd.dir=r.current.dir),this.editor=nd.create(t);(this.controls.container||this.editor).appendChild(this.controls.dom),this.editorContainer&&(nd.empty(this.editorContainer),this.editorContainer.appendChild(this.editor)),Lu.formeoLoaded=new window.CustomEvent("formeoLoaded",{detail:{formeo:this}}),document.dispatchEvent(Lu.formeoLoaded)}};const Bu="f-",zu=t=>"string"==typeof t?document.querySelector(t):t,Uu=t=>{const e=t.match(yr);return(null==e?void 0:e[0])||t``},qu=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)},Vu={isChecked:t=>t.checked,isNotChecked:t=>!t.checked,value:t=>t.value,isVisible:t=>qu(t),isNotVisible:t=>!qu(t)},Hu={equals:$a,notEquals:(t,e)=>!$a(t,e),contains:(t,e)=>t.includes(e),notContains:(t,e)=>!t.includes(e)},Xu=Object.entries(cr).reduce(((t,[e,n])=>(t[n]=Hu[e],t[e]=Hu[e],t)),{}),Yu={equals:(t,{targetProperty:e,value:n})=>{t[`_${e}`]=t[e],t[e]=n}},Gu=Object.entries(dr).reduce(((t,[e,n])=>(t[n]=Yu[e],t[e]=Yu[e],t)),{}),Zu={isChecked:t=>{t.checked=!0},isNotChecked:t=>{t.checked=!1},value:(t,{assignment:e,...n})=>{var o;const i=null==(o=Gu[e])?void 0:o.call(Gu,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 Ju=class{constructor(t,e){n(this,"orderChildren",((t,e)=>e.reduce(((e,n)=>(e.push(this.form[t][n]),e)),[]))),n(this,"prefixId",(t=>Bu+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[Uu(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(`${Bu}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:oi(n),children:(null==e?void 0:e.length)&&e.map((({id:t})=>this.cloneComponentData(Uu(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=nd.create(this.cloneComponentData(t));n.insertBefore(o,n.lastChild);const i=nd.create(nd.btnTemplate({className:"remove-input-group",children:nd.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&&uu(s);const a=ii({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=Ku(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(ci(t)){const{component:o,options:i}=this.getComponent(t),r=i||o;this.handleComponentCondition(r,e,n)}if(ci(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(ci(i)?this.getComponentProperty(i,n):i);return null==(r=Xu[o])?void 0:r.call(Xu,s,a)})),n(this,"execResult",(({target:t,targetProperty:e,assignment:n,value:o})=>{var i;if(ci(t)){const{component:r,option:s}=this.getComponent(t),a=s||r;null==(i=Zu[e])||i.call(Zu,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=Vu[e])?void 0:n.call(Vu,r))||r[e]})),n(this,"getComponent",(t=>{const e={component:null};if(!ci(t))return null;const[,n,o,i]=Pr(t),r=this.renderedForm.querySelector(`#${Bu}${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:zu(e),editorContainer:zu(t),formData:mi(n)}))(t);this.container=o,this.form=mi(e||r),this.dom=nd,this.components=Object.create(null),this.elements=i}get formData(){return this.form}set formData(t){this.form=mi(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=mi(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=nd.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=Ti,this.components[Uu(t.id)]=t,t)))}};const Ku=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=Fu,window.FormeoRenderer=Ju);const Qu=Fu,th=Ju,eh=[{config:{label:"row"},meta:{group:"layout",icon:"rows",id:"layout-row"}},{config:{label:"column"},meta:{group:"layout",icon:"columns",id:"layout-column"}}],nh=Object.freeze(Object.defineProperty({__proto__:null,default:eh},Symbol.toStringTag,{value:"Module"})),oh=["button","submit","reset"].map((t=>({label:t,value:t})));oh[0].selected=!0;const ih=({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:Tr(t),count:n}),value:`${t}-${n}`,[o]:!n}}));const rh=[class extends pu{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:oh,className:[{label:"default",value:"",selected:!0},{label:"primary",value:"primary"},{label:"danger",value:"error"},{label:"success",value:"success"},{label:"warning",value:"warning"}]}]};super(ii(e,t))}},class extends pu{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 pu{constructor(){super({tag:"input",attrs:{type:"hidden",value:""},config:{label:r.get("hidden"),hideLabel:!0},meta:{group:"common",icon:"hidden",id:"hidden"}})}},class extends pu{constructor(){super({tag:"input",attrs:{type:"number",required:!1,className:""},config:{label:r.get("number")},meta:{group:"common",icon:"hash",id:"number"}})}},class extends pu{constructor(){super({tag:"textarea",config:{label:r.get("controls.form.textarea")},meta:{group:"common",icon:"textarea",id:"textarea"},attrs:{required:!1}})}},class extends pu{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 pu{constructor(){super({tag:"input",attrs:{type:"file",required:!1},config:{label:r.get("fileUpload")},meta:{group:"common",icon:"upload",id:"upload"}})}},class extends pu{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:ih({type:"option",isMultiple:null==(e=t.attrs)?void 0:e.multiple})};super(ii(n,t))}},class extends pu{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:ih({type:"checkbox",count:1})})}},class extends pu{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:ih({type:"radio"})})}}],sh=Object.freeze(Object.defineProperty({__proto__:null,default:rh},Symbol.toStringTag,{value:"Module"})),ah=Array.from(Array(5).keys()).slice(1).map((t=>`h${t}`)),lh="controls.html.header";const ch=[class extends pu{constructor(){super({tag:ah[0],attrs:{tag:ah.map(((t,e)=>({label:t.toUpperCase(),value:t,selected:!e}))),className:""},config:{label:r.get(lh),hideLabel:!0,editableContent:!0},meta:{group:"html",icon:"header",id:"html.header"},content:r.get(lh),action:{}})}static get definition(){return{i18n:{"en-US":{header:"Custom English Header"}}}}get content(){return super.i18n(lh)}},class extends pu{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 pu{constructor(){super({tag:"hr",config:{label:r.get("controls.html.divider"),hideLabel:!0},meta:{group:"html",icon:"divider",id:"divider"}})}},class extends pu{constructor(t){super(ii({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))}}],dh=Object.freeze(Object.defineProperty({__proto__:null,default:ch},Symbol.toStringTag,{value:"Module"}));t.FormeoEditor=Qu,t.FormeoRenderer=th,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
|