diff --git a/assets/css/demo.min.css b/assets/css/demo.min.css index 4e5fda48..22106526 100644 --- a/assets/css/demo.min.css +++ b/assets/css/demo.min.css @@ -1,7 +1,7 @@ /** formeo - https://formeo.io -Version: 2.3.1 +Version: 3.0.0 Author: Draggable https://draggable.io */ diff --git a/assets/css/demo.min.css.gz b/assets/css/demo.min.css.gz index 5cf443e7..79f6dd82 100644 Binary files a/assets/css/demo.min.css.gz and b/assets/css/demo.min.css.gz differ diff --git a/assets/css/formeo.min.css b/assets/css/formeo.min.css index f67229ce..2d01e8ea 100644 --- a/assets/css/formeo.min.css +++ b/assets/css/formeo.min.css @@ -1,7 +1,7 @@ /** formeo - https://formeo.io -Version: 2.3.1 +Version: 3.0.0 Author: Draggable https://draggable.io */ diff --git a/assets/css/formeo.min.css.gz b/assets/css/formeo.min.css.gz index 885e2cc8..da5836c5 100644 Binary files a/assets/css/formeo.min.css.gz and b/assets/css/formeo.min.css.gz differ diff --git a/assets/js/demo.min.js b/assets/js/demo.min.js index b5d098ff..4361ef09 100644 --- a/assets/js/demo.min.js +++ b/assets/js/demo.min.js @@ -1,8 +1,8 @@ /** formeo - https://formeo.io -Version: 2.3.1 +Version: 3.0.0 Author: Draggable https://draggable.io */ -var t=Object.defineProperty,e=(e,n,o)=>((e,n,o)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o)(e,"symbol"!=typeof n?n+"":n,o);!function(){const t=document.createElement("link").relList;if(!(t&&t.supports&&t.supports("modulepreload"))){for(const t of document.querySelectorAll('link[rel="modulepreload"]'))e(t);new MutationObserver((t=>{for(const n of t)if("childList"===n.type)for(const t of n.addedNodes)"LINK"===t.tagName&&"modulepreload"===t.rel&&e(t)})).observe(document,{childList:!0,subtree:!0})}function e(t){if(t.ep)return;t.ep=!0;const e=function(t){const e={};return t.integrity&&(e.integrity=t.integrity),t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),"use-credentials"===t.crossOrigin?e.credentials="include":"anonymous"===t.crossOrigin?e.credentials="omit":e.credentials="same-origin",e}(t);fetch(t.href,e)}}();const n=-1!==window.location.href.indexOf("draggable.github.io");if(n){"https:"!==window.location.protocol&&(window.location.protocol="https:"),((window.gitter={}).chat={}).options={room:"Draggable/formeo",activationElement:".toggle-gitter"};[{src:"//platform.twitter.com/widgets.js",id:"twitter-script"},{src:"//buttons.github.io/buttons.js",id:"github-script"},{src:"//www.google-analytics.com/analytics.js",id:"google-analytics",onload:()=>{window.ga("create","UA-79014176-2","auto"),window.ga("send","pageview")}}].forEach((function(t){const[e]=document.getElementsByTagName("script");if(document.getElementById(t.id))return;const n=Object.assign(document.createElement("script"),t);e.parentNode.insertBefore(n,e)}))}const o={user:{isAuthenticated:!0,userName:"Kevin"}},i={rows:{all:{events:{onRender:t=>{}}}},fields:{checkbox:{actionButtons:{}},"a33bcc32-c54c-46ed-9609-7cdb5b3dc511":{events:{onRender:t=>{const e=setTimeout((()=>{t.querySelector(".next-group").click(),clearTimeout(e)}),333)}},panels:{attrs:{hideDisabled:!0},disabled:[]}}}},r={editorContainer:document.querySelector(".build-form"),i18n:{location:"./assets/lang"},actions:{},external:o,controls:{sortable:!1,groupOrder:["common","html"],disable:{},elements:[{tag:"input",config:{label:"Email",disabledAttrs:["type"],lockedAttrs:["required","className"]},meta:{group:"common",id:"email",icon:"@"},attrs:{className:"custom-email",type:"email",required:!0}}],elementOrder:{common:["button","checkbox","date-input","hidden","upload","number","radio","select","text-input","textarea"]}},config:i,events:{onSave:console.log},sessionStorage:!0,editPanelOrder:["attrs","options"]},s={renderContainer:".render-form",external:o,elements:{tinymce:{action:{onRender:t=>{if(t.id){const e=`#${t.id}`;window.tinymce.remove(e),window.tinymce.init({selector:e})}}}}}};var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function l(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var c=function(t,e,n,o){var i=-1,r=null==t?0:t.length;for(o&&r&&(n=t[++i]);++ii?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var r=Array(i);++o=o?t:At(t,e,n)},Tt=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var jt=function(t){return Tt.test(t)};var Pt=function(t){return t.split("")},Lt="\\ud800-\\udfff",Dt="["+Lt+"]",kt="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",$t="\\ud83c[\\udffb-\\udfff]",It="[^"+Lt+"]",Rt="(?:\\ud83c[\\udde6-\\uddff]){2}",Mt="[\\ud800-\\udbff][\\udc00-\\udfff]",Ft="(?:"+kt+"|"+$t+")"+"?",Bt="[\\ufe0e\\ufe0f]?",Wt=Bt+Ft+("(?:\\u200d(?:"+[It,Rt,Mt].join("|")+")"+Bt+Ft+")*"),zt="(?:"+[It+kt+"?",kt,Rt,Mt,Dt].join("|")+")",Ut=RegExp($t+"(?="+$t+")|"+zt+Wt,"g");var qt=Pt,Ht=jt,Gt=function(t){return t.match(Ut)||[]};var Vt=_t,Xt=jt,Yt=function(t){return Ht(t)?Gt(t):qt(t)},Zt=B;var Jt=function(t){return function(e){e=Zt(e);var n=Xt(e)?Yt(e):void 0,o=n?n[0]:e.charAt(0),i=n?Vt(n,1).join(""):e.slice(1);return o[t]()+i}}("toUpperCase");const Kt=l(Nt((function(t,e,n){return t+(n?" ":"")+Jt(e)}))),Qt=document.getElementById("editor-action-buttons"),te=document.querySelector(".render-form");const ee={extension:".lang",location:"assets/lang/",langs:["en-US"],locale:"en-US",override:{}};class ne{constructor(t=ee){this.langs=Object.create(null),this.loaded=[],this.processConfig(t)}processConfig(t){const{location:e,...n}={...ee,...t},o=e.replace(/\/?$/,"/");this.config={location:o,...n};const{override:i,preloaded:r={}}=this.config,s=Object.entries(this.langs).concat(Object.entries(i||r));this.langs=s.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?ne.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 ne.fromFile(t.replace(/\n\n/g,"\n"))}static fromFile(t){const e=t.split("\n"),n={};for(let o,i=0;i{const i=ne.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 oe=new ne;!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 ie=Object.defineProperty,re=(t,e,n)=>((t,e,n)=>e in t?ie(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);const se="_3x4ZIcu-",ae="JIt36hCJ",le={triggerName:"tooltip"};class ce{constructor(t=le){re(this,"triggerName"),re(this,"tooltip"),re(this,"activeTriggerType",null),re(this,"spacing",12),re(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()})),re(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")}})),re(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()})),re(this,"handleResize",(()=>{this.isVisible()&&this.hide()})),re(this,"handleScroll",(()=>{this.isVisible()&&this.hide()})),this.triggerName=`data-${t.triggerName}`,this.tooltip=document.createElement("div"),this.tooltip.className=`d-tooltip ${se}`,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(ae)}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(se)||"none"===getComputedStyle(t).pointerEvents)return!1})).length}show(t,e){this.tooltip.innerHTML=e??"",this.tooltip.classList.add(ae);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(ae),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=ce);const de="2.3.1",ue="formeo",he="formeo-sprite",pe=[{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"}],fe=`https://cdn.jsdelivr.net/npm/formeo@${de}/dist/${he}.svg`,me=`https://draggable.github.io/formeo/assets/img/${he}.svg`,ge=`https://cdn.jsdelivr.net/npm/formeo@${de}/dist/formeo.min.css`,ve="control-group",be=`${ue}-stage`,ye=`${ue}-row`,we=`${ue}-column`,Ce=`${ue}-field`,Ee="custom-column-widths",xe="column-preset",Se="resizing-columns",Oe=new Map([[be,ye],[ye,we],[we,Ce]]),Ne=["external","stages","rows","columns","fields"],Ae=["stage","row","column","field"].reduce(((t,e)=>({...t,[e]:e})),{}),_e=[{name:"controls",className:ve},{name:"stage",className:be},{name:"row",className:ye},{name:"column",className:we},{name:"field",className:Ce}],Te={controls:ve,stage:be,row:ye,column:we,field:Ce},je=Object.entries(Te).reduce(((t,[e,n])=>({...t,[n]:e})),{}),Pe=Object.values(Te),Le=new RegExp(`${Pe.join("|")}`,"g"),De=_e.map((({name:t},e,n)=>{const{name:o}=n[e+1]||{};return o&&[t,o]})).filter(Boolean),ke=De.slice().map((t=>t.slice().reverse())).reverse(),$e=new Map(De),Ie=new Map(ke.slice()),Re=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)),[])),Me=[{type:"added",condition:(t,e)=>Boolean(void 0===t&&e)}],Fe=`${ue}-formData`,Be=`${ue}-locale`,We=333,ze=Math.round(166.5),Ue=Math.round(666),qe="formeoSaved",He="formeoUpdated",Ge="formeoOnRender",Ve=["label","logical","source","thenTarget","sourceProperty","comparison","target","targetProperty","assignment","value"],Xe={value:"attrs.value",checked:"attrs.checked",isVisible:"config.isVisible",isNotVisible:"config.isNotVisible"},Ye={comparison:{equals:"==",notEquals:"!=",contains:"⊃",notContains:"!⊃"},assignment:{equals:"="},logical:{and:"&&",or:"||"},property:Xe},Ze=/(\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,Je=/\bcol-\w+-\d+/g,Ke="f-i-";var Qe=function(){this.__data__=[],this.size=0};var tn=function(t,e){return t===e||t!=t&&e!=e},en=tn;var nn=function(t,e){for(var n=t.length;n--;)if(en(t[n][0],e))return n;return-1},on=nn,rn=Array.prototype.splice;var sn=nn;var an=nn;var ln=nn;var cn=Qe,dn=function(t){var e=this.__data__,n=on(e,t);return!(n<0)&&(n==e.length-1?e.pop():rn.call(e,n,1),--this.size,!0)},un=function(t){var e=this.__data__,n=sn(e,t);return n<0?void 0:e[n][1]},hn=function(t){return an(this.__data__,t)>-1},pn=function(t,e){var n=this.__data__,o=ln(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this};function fn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e-1&&t%1==0&&t<=9007199254740991},xi=On,Si=Ei;var Oi=function(t){return null!=t&&Si(t.length)&&!xi(t)},Ni=Oi,Ai=T;var _i=function(t){return Ai(t)&&Ni(t)},Ti={exports:{}};var ji=function(){return!1};!function(t,e){var n=f,o=ji,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}(Ti,Ti.exports);var Pi=Ti.exports,Li=_,Di=ai,ki=T,$i=Function.prototype,Ii=Object.prototype,Ri=$i.toString,Mi=Ii.hasOwnProperty,Fi=Ri.call(Object);var Bi=function(t){if(!ki(t)||"[object Object]"!=Li(t))return!1;var e=Di(t);if(null===e)return!0;var n=Mi.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Ri.call(n)==Fi},Wi=_,zi=Ei,Ui=T,qi={};qi["[object Float32Array]"]=qi["[object Float64Array]"]=qi["[object Int8Array]"]=qi["[object Int16Array]"]=qi["[object Int32Array]"]=qi["[object Uint8Array]"]=qi["[object Uint8ClampedArray]"]=qi["[object Uint16Array]"]=qi["[object Uint32Array]"]=!0,qi["[object Arguments]"]=qi["[object Array]"]=qi["[object ArrayBuffer]"]=qi["[object Boolean]"]=qi["[object DataView]"]=qi["[object Date]"]=qi["[object Error]"]=qi["[object Function]"]=qi["[object Map]"]=qi["[object Number]"]=qi["[object Object]"]=qi["[object RegExp]"]=qi["[object Set]"]=qi["[object String]"]=qi["[object WeakMap]"]=!1;var Hi=function(t){return Ui(t)&&zi(t.length)&&!!qi[Wi(t)]};var Gi=function(t){return function(e){return t(e)}},Vi={exports:{}};!function(t,e){var n=u,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}(Vi,Vi.exports);var Xi=Vi.exports,Yi=Hi,Zi=Gi,Ji=Xi&&Xi.isTypedArray,Ki=Ji?Zi(Ji):Yi;var Qi=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},tr=Mo,er=tn,nr=Object.prototype.hasOwnProperty;var or=function(t,e,n){var o=t[e];nr.call(t,e)&&er(o,n)&&(void 0!==n||e in t)||tr(t,e,n)},ir=or,rr=Mo;var sr=function(t,e,n,o){var i=!n;n||(n={});for(var r=-1,s=e.length;++r-1&&t%1==0&&t0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(ns),rs=Zr,ss=Qr,as=is;var ls=tn,cs=Oi,ds=lr,us=Cn;var hs=function(t,e){return as(ss(t,e,rs),t+"")},ps=function(t,e,n){if(!us(n))return!1;var o=typeof e;return!!("number"==o?cs(n)&&ds(e,n.length):"string"==o&&e in n)&&ls(n[e],t)};var fs=Yr;const ms=l(function(t){return hs((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&&ps(n[0],n[1],s)&&(r=i<3?void 0:r,i=1),e=Object(e);++ocrypto.randomUUID(),vs=(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},bs=t=>{var e;const n=null==(e=t.className)?void 0:e.match(Le);return n&&je[n[0]]},ys=t=>Array.from(new Set(t)),ws=t=>{let e;if(t){const{attrs:n={}}=t;e=n.id||t.id||gs(),t.id=e}else e=gs();return e},Cs=(t,e)=>ms({},t,e,((t,e)=>Array.isArray(t)?null!=e?ys(t.concat(e)):e:Array.isArray(e)?null!=t?ys(e.concat(t)):e:void 0)),Es=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;nt/e*100,Ss=t=>`${t.toString()}%`,Os=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){}}}}),Ns=t=>Ne.some((e=>new RegExp(`^${e}.`).test(t))),As=t=>t.startsWith("external");function _s(t,e=Ue){let n=0;return function(...o){const i=Date.now();i-n>=e&&(n=i,t.apply(this,o))}}function Ts(t){return t}function js(){}var Ps=v,Ls=L,Ds=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ks=/^\w*$/;var $s=function(t,e){if(Ps(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!Ls(t))||(ks.test(t)||!Ds.test(t)||null!=e&&t in Object(e))},Is=xo;function Rs(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(Rs.Cache||Is),n}Rs.Cache=Is;var Ms=Rs;var Fs=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Bs=/\\(\\)?/g,Ws=function(t){var e=Ms(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(Fs,(function(t,n,o,i){e.push(o?i.replace(Bs,"$1"):n||t)})),e})),zs=v,Us=$s,qs=Ws,Hs=B;var Gs=function(t,e){return zs(t)?t:Us(t,e)?[t]:qs(Hs(t))},Vs=L;var Xs=function(t){if("string"==typeof t||Vs(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e},Ys=or,Zs=Gs,Js=lr,Ks=Cn,Qs=Xs;var ta=function(t,e,n,o){if(!Ks(t))return t;for(var i=-1,r=(e=Zs(e,t)).length,s=r-1,a=t;null!=a&&++iNumber.isInteger(Number(t)),la=(t,e)=>{const n=e||t.parentElement;return Array.prototype.slice.call(n.childNodes).indexOf(t)},ca=(t,e,n)=>{const o=n.split("||"),i=ys(e).map((e=>t.find((t=>{const n=o.find((e=>!!ra(t,e)));return n&&ra(t,n)===e})))).filter(Boolean).concat(t);return ys(i)},da=(t,e,n)=>{for(let o=0;o{const n=[];return da(t,((t,o)=>n.push(e(t,o)))),n},ha={},pa=t=>t.replace(/\b\w/g,(t=>t.toUpperCase())),fa=()=>-1!==window.navigator.userAgent.indexOf("MSIE "),ma={capitalize:pa,safeAttrName:t=>{if(ha[t])return ha[t];const e=({className:"class"}[t]||t).replace(/^\d+/,"").replace(/[^a-zA-Z0-9-:]/g,"");return ha[t]=e,e},forEach:da,copyObj:t=>window.JSON.parse(window.JSON.stringify(t)),map:ua,subtract:(t,e)=>e.filter((e=>!~t.indexOf(e))),indexOfNode:la,isInt:aa,get:ra,orderObjectsBy:ca,isIE:fa},ga={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=ga.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{const o=ga.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"===ga.getStyle(t,"display"))=>{n?ga.slideDown(t,e):ga.slideUp(t,e)}},va="no-transition",ba={debug:!1,bubbles:!0,formeoLoaded:t=>{},onAdd:()=>{},onUpdate:t=>{var e;return(null==(e=wa.opts)?void 0:e.debug)&&void 0},onUpdateStage:t=>{var e;return(null==(e=wa.opts)?void 0:e.debug)&&void 0},onUpdateRow:t=>{var e;return(null==(e=wa.opts)?void 0:e.debug)&&void 0},onUpdateColumn:t=>{var e;return(null==(e=wa.opts)?void 0:e.debug)&&void 0},onUpdateField:t=>{var e;return(null==(e=wa.opts)?void 0:e.debug)&&void 0},onRender:t=>{var e;return(null==(e=wa.opts)?void 0:e.debug)&&void 0},onSave:t=>{},confirmClearAll:t=>{window.confirm(t.confirmationMessage)&&t.clearAllAction(t)}},ya=({src:t,...e},n=He)=>{var o,i;const r=new window.CustomEvent(n,{detail:e,bubbles:(null==(o=wa.opts)?void 0:o.debug)||(null==(i=wa.opts)?void 0:i.bubbles)});return r.data=(t||document).dispatchEvent(r),r},wa={init:function(t){return this.opts={...ba,...t},this},formeoSaved:t=>ya(t,qe),formeoUpdated:t=>ya(t,He),formeoCleared:t=>ya(t,"formeoCleared"),formeoOnRender:t=>ya(t,Ge),formeoConditionUpdated:t=>ya(t,"formeoConditionUpdated")},Ca=_s((()=>{wa.opts.onUpdate({timeStamp:window.performance.now(),type:He,detail:sh.formData})}),ze);let Ea;document.addEventListener(He,Ca),document.addEventListener("formeoUpdatedStage",(t=>{const{timeStamp:e,type:n,detail:o}=t;wa.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedRow",(t=>{const{timeStamp:e,type:n,detail:o}=t;wa.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedColumn",(t=>{const{timeStamp:e,type:n,detail:o}=t;wa.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedField",(t=>{const{timeStamp:e,type:n,detail:o}=t;wa.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener(Ge,(t=>{const{timeStamp:e,type:n,detail:o}=t;wa.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},wa.opts.confirmClearAll(t)})),document.addEventListener(qe,(({timeStamp:t,type:e,detail:{formData:n}})=>{const o={timeStamp:t,type:e,formData:n};wa.opts.onSave(o)})),document.addEventListener("formeoLoaded",(t=>{wa.opts.formeoLoaded(t.detail.formeo)})),window.addEventListener("resize",(function(){Ea=Ea||window.requestAnimationFrame((()=>{Ea=!1;for(const t of Object.values(eh.data))t.dom.classList.add(va),oh.dom.classList.add(va),oh.panels.nav.refresh(),t.refreshFieldPanels()}))}));var xa=xo,Sa=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Oa=function(t){return this.__data__.has(t)};function Na(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new xa;++ea))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 Aa:void 0;for(r.set(t,e),r.set(e,t);++uJSON.stringify(t,null,e))),e(this,"get",(t=>ra(this.data,t))),e(this,"getChangeType",((t,e)=>{const n=Me.find((({condition:n})=>n(t,e)))||{type:"unknown"};return n.desc="added"===n.type?`${t} to ${e}`:e,n})),e(this,"add",((t,e=Object.create(null))=>{const{id:n}=e,o=t||n||ws();return this.set(o,e)})),e(this,"remove",(t=>{const e=t.split("."),n=e.pop(),o=this.get(e);return Array.isArray(o)?o.splice(Number(n),1):delete o[n],o})),e(this,"getData",(()=>Object.entries(this.data).reduce(((t,[e,n])=>(t[e]=(null==n?void 0:n.data)?n.getData():n,t)),{}))),e(this,"setCallbacks",{}),e(this,"configVal",Object.create(null)),this.name=t,this.data=n,this.dataPath=""}get size(){return Object.keys(this.data).length}get js(){return this.data}get json(){return this.data}set(t,e){const n=ra(this.data,t);if(Bl(n,e))return this.data;const o=sa(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),wa.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)}}function zl(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 Ul(t){for(var e=1;e=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Xl(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var Yl=Xl(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Zl=Xl(/Edge/i),Jl=Xl(/firefox/i),Kl=Xl(/safari/i)&&!Xl(/chrome/i)&&!Xl(/android/i),Ql=Xl(/iP(ad|od|hone)/i),tc=Xl(/chrome/i)&&Xl(/android/i),ec={capture:!1,passive:!1};function nc(t,e,n){t.addEventListener(e,n,!Yl&&ec)}function oc(t,e,n){t.removeEventListener(e,n,!Yl&&ec)}function ic(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 rc(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function sc(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&ic(t,e):ic(t,e))||o&&t===n)return t;if(t===n)break}while(t=rc(t))}return null}var ac,lc=/\s+/g;function cc(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(lc," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(lc," ")}}function dc(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 uc(t,e){var n="";if("string"==typeof t)n=t;else do{var o=dc(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 hc(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i=fc(o)[n]))return o;if(o===pc())break;o=wc(o,!1)}return!1}function gc(t,e,n,o){for(var i=0,r=0,s=t.children;r2&&void 0!==arguments[2]?arguments[2]:{},o=n.evt,i=Vl(n,Pc);jc.pluginEvent.bind(Sd)(t,e,Ul({dragEl:kc,parentEl:$c,ghostEl:Ic,rootEl:Rc,nextEl:Mc,lastDownEl:Fc,cloneEl:Bc,cloneHidden:Wc,dragStarted:td,putSortable:Vc,activeSortable:Sd.active,originalEvent:o,oldIndex:zc,oldDraggableIndex:qc,newIndex:Uc,newDraggableIndex:Hc,hideGhostForTarget:wd,unhideGhostForTarget:Cd,cloneNowHidden:function(){Wc=!0},cloneNowShown:function(){Wc=!1},dispatchSortableEvent:function(t){Dc({sortable:e,name:t,originalEvent:o})}},i))};function Dc(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[Nc]){var m,g=e.options,v="on"+o.charAt(0).toUpperCase()+o.substr(1);!window.CustomEvent||Yl||Zl?(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=Ul(Ul({},f),jc.getEventProperties(o,e));for(var y in b)m[y]=b[y];n&&n.dispatchEvent(m),g[v]&&g[v].call(e,m)}}(Ul({putSortable:Vc,cloneEl:Bc,targetEl:kc,rootEl:Rc,oldIndex:zc,oldDraggableIndex:qc,newIndex:Uc,newDraggableIndex:Hc},t))}var kc,$c,Ic,Rc,Mc,Fc,Bc,Wc,zc,Uc,qc,Hc,Gc,Vc,Xc,Yc,Zc,Jc,Kc,Qc,td,ed,nd,od,id,rd=!1,sd=!1,ad=[],ld=!1,cd=!1,dd=[],ud=!1,hd=[],pd="undefined"!=typeof document,fd=Ql,md=Zl||Yl?"cssFloat":"float",gd=pd&&!tc&&!Ql&&"draggable"in document.createElement("div"),vd=function(){if(pd){if(Yl)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),bd=function(t,e){var n=dc(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=gc(t,0,e),r=gc(t,1,e),s=i&&dc(i),a=r&&dc(r),l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+fc(i).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+fc(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[md]||r&&"none"===n[md]&&l+c>o)?"vertical":"horizontal"},yd=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"==ql(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},wd=function(){!vd&&Ic&&dc(Ic,"display","none")},Cd=function(){!vd&&Ic&&dc(Ic,"display","")};pd&&!tc&&document.addEventListener("click",(function(t){if(sd)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),sd=!1,!1}),!0);var Ed=function(t){if(kc){t=t.touches?t.touches[0]:t;var e=(i=t.clientX,r=t.clientY,ad.some((function(t){var e=t[Nc].options.emptyInsertThreshold;if(e&&!vc(t)){var n=fc(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[Nc]._onDragOver(n)}}var i,r,s},xd=function(t){kc&&kc.parentNode[Nc]._isOutsideThisEl(t.target)};function Sd(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=Gl({},e),t[Nc]=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 bd(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!==Sd.supportPointer&&"PointerEvent"in window&&!Kl,emptyInsertThreshold:5};for(var o in jc.initializePlugins(this,t,n),n)!(o in e)&&(e[o]=n[o]);for(var i in yd(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&gd,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?nc(t,"pointerdown",this._onTapStart):(nc(t,"mousedown",this._onTapStart),nc(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(nc(t,"dragover",this),nc(t,"dragenter",this)),ad.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),Gl(this,Ac())}function Od(t,e,n,o,i,r,s,a){var l,c,d=t[Nc],u=d.options.onMove;return!window.CustomEvent||Yl||Zl?(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||fc(e),l.willInsertAfter=a,l.originalEvent=s,t.dispatchEvent(l),u&&(c=u.call(d,l,s)),c}function Nd(t){t.draggable=!1}function Ad(){ud=!1}function _d(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 Td(t){return setTimeout(t,0)}function jd(t){return clearTimeout(t)}Sd.prototype={constructor:Sd,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(ed=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,kc):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){hd.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&hd.push(o)}}(n),!kc&&!(/mousedown|pointerdown/.test(r)&&0!==t.button||o.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!Kl||!a||"SELECT"!==a.tagName.toUpperCase())&&!((a=sc(a,o.draggable,n,!1))&&a.animated||Fc===a)){if(zc=bc(a),qc=bc(a,o.draggable),"function"==typeof c){if(c.call(this,t,a,this))return Dc({sortable:e,rootEl:l,name:"filter",targetEl:a,toEl:n,fromEl:n}),Lc("filter",e,{evt:t}),void(i&&t.cancelable&&t.preventDefault())}else if(c&&(c=c.split(",").some((function(o){if(o=sc(l,o.trim(),n,!1))return Dc({sortable:e,rootEl:o,name:"filter",targetEl:a,fromEl:n,toEl:n}),Lc("filter",e,{evt:t}),!0}))))return void(i&&t.cancelable&&t.preventDefault());o.handle&&!sc(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&&!kc&&n.parentNode===r){var l=fc(n);if(Rc=r,$c=(kc=n).parentNode,Mc=kc.nextSibling,Fc=n,Gc=s.group,Sd.dragged=kc,Xc={target:kc,clientX:(e||t).clientX,clientY:(e||t).clientY},Kc=Xc.clientX-l.left,Qc=Xc.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,kc.style["will-change"]="all",o=function(){Lc("delayEnded",i,{evt:t}),Sd.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!Jl&&i.nativeDraggable&&(kc.draggable=!0),i._triggerDragStart(t,e),Dc({sortable:i,name:"choose",originalEvent:t}),cc(kc,s.chosenClass,!0))},s.ignore.split(",").forEach((function(t){hc(kc,t.trim(),Nd)})),nc(a,"dragover",Ed),nc(a,"mousemove",Ed),nc(a,"touchmove",Ed),nc(a,"mouseup",i._onDrop),nc(a,"touchend",i._onDrop),nc(a,"touchcancel",i._onDrop),Jl&&this.nativeDraggable&&(this.options.touchStartThreshold=4,kc.draggable=!0),Lc("delayStart",this,{evt:t}),!s.delay||s.delayOnTouchOnly&&!e||this.nativeDraggable&&(Zl||Yl))o();else{if(Sd.eventCanceled)return void this._onDrop();nc(a,"mouseup",i._disableDelayedDrag),nc(a,"touchend",i._disableDelayedDrag),nc(a,"touchcancel",i._disableDelayedDrag),nc(a,"mousemove",i._delayedDragTouchMoveHandler),nc(a,"touchmove",i._delayedDragTouchMoveHandler),s.supportPointer&&nc(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(){kc&&Nd(kc),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;oc(t,"mouseup",this._disableDelayedDrag),oc(t,"touchend",this._disableDelayedDrag),oc(t,"touchcancel",this._disableDelayedDrag),oc(t,"mousemove",this._delayedDragTouchMoveHandler),oc(t,"touchmove",this._delayedDragTouchMoveHandler),oc(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?nc(document,"pointermove",this._onTouchMove):nc(document,e?"touchmove":"mousemove",this._onTouchMove):(nc(kc,"dragend",this),nc(Rc,"dragstart",this._onDragStart));try{document.selection?Td((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(n){}},_dragStarted:function(t,e){if(rd=!1,Rc&&kc){Lc("dragStarted",this,{evt:e}),this.nativeDraggable&&nc(document,"dragover",xd);var n=this.options;!t&&cc(kc,n.dragClass,!1),cc(kc,n.ghostClass,!0),Sd.active=this,t&&this._appendGhost(),Dc({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(Yc){this._lastX=Yc.clientX,this._lastY=Yc.clientY,wd();for(var t=document.elementFromPoint(Yc.clientX,Yc.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Yc.clientX,Yc.clientY))!==e;)e=t;if(kc.parentNode[Nc]._isOutsideThisEl(t),e)do{if(e[Nc]){if(e[Nc]._onDragOver({clientX:Yc.clientX,clientY:Yc.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=rc(e));Cd()}},_onTouchMove:function(t){if(Xc){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=Ic&&uc(Ic,!0),s=Ic&&r&&r.a,a=Ic&&r&&r.d,l=fd&&id&&yc(id),c=(i.clientX-Xc.clientX+o.x)/(s||1)+(l?l[0]-dd[0]:0)/(s||1),d=(i.clientY-Xc.clientY+o.y)/(a||1)+(l?l[1]-dd[1]:0)/(a||1);if(!Sd.active&&!rd){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))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===kc)return P(!1);if(m&&r===t.target&&(s=m),s&&(n=fc(s)),!1!==Od(Rc,r,kc,e,s,n,t,!!s))return j(),m&&m.nextSibling?r.insertBefore(kc,m.nextSibling):r.appendChild(kc),$c=r,L(),P(!0)}else if(m&&function(t,e,n){var o=fc(gc(n.el,0,n.options,!0)),i=Oc(n.el,n.options,Ic),r=10;return e?t.clientXd+c*r/2:lu-od)return-nd}else if(l>d+c*(1-i)/2&&lu-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,cd,ed===s),0!==v){var O=bc(kc);do{O-=v,y=$c.children[O]}while(y&&("none"===dc(y,"display")||y===Ic))}if(0===v||y===s)return P(!1);ed=s,nd=v;var N=s.nextElementSibling,A=!1,_=Od(Rc,r,kc,e,s,n,t,A=1===v);if(!1!==_)return 1!==_&&-1!==_||(A=1===_),ud=!0,setTimeout(Ad,30),j(),A&&!N?r.appendChild(kc):s.parentNode.insertBefore(kc,A?N:s),x&&xc(x,0,S-x.scrollTop),$c=kc.parentNode,void 0===b||cd||(od=Math.abs(b-fc(s)[E])),L(),P(!0)}if(r.contains(kc))return P(!1)}return!1}function T(a,l){Lc(a,p,Ul({evt:t,isOwner:d,axis:i?"vertical":"horizontal",revert:o,dragRect:e,targetRect:n,canSort:u,fromSortable:h,target:s,completed:P,onMove:function(n,o){return Od(Rc,r,kc,e,n,fc(n),t,o)},changed:L},l))}function j(){T("dragOverAnimationCapture"),p.captureAnimationState(),p!==h&&h.captureAnimationState()}function P(e){return T("dragOverCompleted",{insertion:e}),e&&(d?c._hideClone():c._showClone(p),p!==h&&(cc(kc,Vc?Vc.options.ghostClass:c.options.ghostClass,!1),cc(kc,a.ghostClass,!0)),Vc!==p&&p!==Sd.active?Vc=p:p===Sd.active&&Vc&&(Vc=null),h===p&&(p._ignoreWhileAnimating=s),p.animateAll((function(){T("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(s===kc&&!kc.animated||s===r&&!s.animated)&&(ed=null),a.dragoverBubble||t.rootEl||s===document||(kc.parentNode[Nc]._isOutsideThisEl(t.target),!e&&Ed(t)),!a.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),f=!0}function L(){Uc=bc(kc),Hc=bc(kc,a.draggable),Dc({sortable:p,name:"change",toEl:r,newIndex:Uc,newDraggableIndex:Hc,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){oc(document,"mousemove",this._onTouchMove),oc(document,"touchmove",this._onTouchMove),oc(document,"pointermove",this._onTouchMove),oc(document,"dragover",Ed),oc(document,"mousemove",Ed),oc(document,"touchmove",Ed)},_offUpEvents:function(){var t=this.el.ownerDocument;oc(t,"mouseup",this._onDrop),oc(t,"touchend",this._onDrop),oc(t,"pointerup",this._onDrop),oc(t,"touchcancel",this._onDrop),oc(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;Uc=bc(kc),Hc=bc(kc,n.draggable),Lc("drop",this,{evt:t}),$c=kc&&kc.parentNode,Uc=bc(kc),Hc=bc(kc,n.draggable),Sd.eventCanceled||(rd=!1,cd=!1,ld=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),jd(this.cloneId),jd(this._dragStartId),this.nativeDraggable&&(oc(document,"drop",this),oc(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Kl&&dc(document.body,"user-select",""),dc(kc,"transform",""),t&&(td&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),Ic&&Ic.parentNode&&Ic.parentNode.removeChild(Ic),(Rc===$c||Vc&&"clone"!==Vc.lastPutMode)&&Bc&&Bc.parentNode&&Bc.parentNode.removeChild(Bc),kc&&(this.nativeDraggable&&oc(kc,"dragend",this),Nd(kc),kc.style["will-change"]="",td&&!rd&&cc(kc,Vc?Vc.options.ghostClass:this.options.ghostClass,!1),cc(kc,this.options.chosenClass,!1),Dc({sortable:this,name:"unchoose",toEl:$c,newIndex:null,newDraggableIndex:null,originalEvent:t}),Rc!==$c?(Uc>=0&&(Dc({rootEl:$c,name:"add",toEl:$c,fromEl:Rc,originalEvent:t}),Dc({sortable:this,name:"remove",toEl:$c,originalEvent:t}),Dc({rootEl:$c,name:"sort",toEl:$c,fromEl:Rc,originalEvent:t}),Dc({sortable:this,name:"sort",toEl:$c,originalEvent:t})),Vc&&Vc.save()):Uc!==zc&&Uc>=0&&(Dc({sortable:this,name:"update",toEl:$c,originalEvent:t}),Dc({sortable:this,name:"sort",toEl:$c,originalEvent:t})),Sd.active&&(null!=Uc&&-1!==Uc||(Uc=zc,Hc=qc),Dc({sortable:this,name:"end",toEl:$c,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){Lc("nulling",this),Rc=kc=$c=Ic=Mc=Bc=Fc=Wc=Xc=Yc=td=Uc=Hc=zc=qc=ed=nd=Vc=Gc=Sd.dragged=Sd.ghost=Sd.clone=Sd.active=null,hd.forEach((function(t){t.checked=!0})),hd.length=Zc=Jc=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":kc&&(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{const e=window.prompt(t.message.attr);if(e&&t.isDisabled(e))return window.alert(oe.get("attributeNotPermitted",e||"")),Gd.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:Ts}},Gd={init:function(t){const e=Object.keys(Hd);return this.opts=e.reduce(((e,n)=>(e[n]={...Hd[n],...t[n]},e)),t),this},add:{attrs:t=>Gd.opts.add.attr(t),options:t=>Gd.opts.add.option(t),conditions:t=>(t.template={if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]},Gd.opts.add.condition(t))},click:{btn:t=>Gd.opts.click.btn(t)},save:{form:t=>(Gd.opts.sessionStorage&&Os.set(Fe,t),wa.formeoSaved({formData:t}),Gd.opts.save.form(t))}},Vd=Object.freeze({type:"field",displayType:"slider"}),Xd=t=>({transform:`translateX(${t?`${t}px`:0})`});class Yd{constructor(t){e(this,"toggleTabbedLayout",(()=>{this.getPanelDisplay();const t=this.isTabbed;return this.panelsWrap.parentElement.classList.toggle("tabbed-panels",t),t&&this.panelNav.removeAttribute("style"),t})),e(this,"resizePanels",(()=>{this.toggleTabbedLayout();const t=this.panelsWrap.style,e=ch.getStyle(this.currentPanel,"height");return t.height=e,e})),this.opts=Cs(Vd,t),this.panelDisplay=this.opts.displayType,this.activePanelIndex=0,this.panelNav=this.createPanelNav();const n=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(n),window.clearTimeout(i)}),Ue)}getPanelDisplay(){const t=this.panelsWrap,e=Number.parseInt(ch.getStyle(t,"width"))>390?"tabbed":"slider",n="auto"===this.opts.displayType;return this.panelDisplay=n?e:this.opts.displayType||Vd.displayType,this.panelDisplay}createPanelsWrap(){const t=ch.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 ma.forEach(e,(t=>{t.fieldId=this.opts.id,t.isSortable&&Sd.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=la(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",ch.create(e)}createPanelNav(){this.labels=this.createPanelNavLabels();const t={tag:"button",attrs:{className:"next-group",title:oe.get("controlGroups.nextGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.nextGroup(t)},content:ch.icon("triangle-right")},e={tag:"button",attrs:{className:"prev-group",title:oe.get("controlGroups.prevGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.prevGroup(t)},content:ch.icon("triangle-left")};return ch.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=la(this.currentPanel,e);let r={nav:0,panel:0},s={...r};t.groupChange=t=>(this.activePanelIndex=t,this.currentPanel=i[t],ch.removeClasses(i,"active-panel"),ch.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=ze,animate:r=!this.isTabbed})=>{const a=[Xd(s.panel),Xd(t.panel)],l=[Xd(s.nav),Xd(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=ch.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 Zd="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`)),Jd=new RegExp(`(?!${Zd.join("|")})\\w\\S*`,"g"),Kd=/\s+/g;function Qd(t){if("string"!=typeof t)return t;if(t.trim().match(Kd))return t;return t.replace(Jd,(t=>t.charAt(0).toUpperCase()+t.substring(1).replace(/[A-Z]/g,(t=>` ${t}`))))}const tu=(t,e="-")=>t.toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,e),eu="f-autocomplete",nu="highlight-component";let ou,iu=Date.now();const ru=({name:t,id:e,...n})=>["config.label","attrs.id","meta.id"].reduce(((t,e)=>(t||(t=n.get(e)),t)),null)||"external"===t&&((...t)=>oe.get(t.join("."))||Qd(t.join(" ")))(t,e);class su{constructor(t,e,n){this.key=t,this.className=t.replace(/\./g,"-"),this.value=e,this.events=[],this.i18nKey=n,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=ch.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=ch.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}};return this.displayField=ch.create({tag:"input",autocomplete:"off",action:e,attrs:{type:"text",className:`${eu}-display-field`,value:this.label||this.value,placeholder:oe.get(`${this.i18nKey}.${this.key}.placeholder`)}}),this.hiddenField=ch.create({tag:"input",attrs:{type:"hidden",className:this.className,value:this.value}}),this.list=ch.create({tag:"ul",attrs:{className:`${eu}-list`}}),this.dom=ch.create({children:[this.displayField,this.hiddenField,this.list],className:this.className,action:{onRender:()=>{const t=this.value&&sh.getAddress(this.value);this.label=t&&ru(t),this.label&&(this.displayField.value=this.label),this.updateOptions()}}}),this.dom}updateOptions(){const t=Date.now();t-iu>Ue&&(ch.empty(this.list),this.generateOptions(),iu=t);const e=ou||this.generateOptions();for(const n of e)this.list.appendChild(n)}generateOptions(){const t=(t=>{const e=[],n=sh.flatList(),o=Object.entries(n).map((([n,o])=>{const i=ru(o);if(i){const r={tag:"span",content:` ${Qd(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=`${eu}-list-item`;return t.classList.contains(e)||(t=t.parentElement),t};return ou=t.map((t=>{const{value:n,textLabel:o,htmlLabel:i}=t,r={tag:"li",children:i,dataset:{value:n,label:o},className:`${eu}-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 ch.create(r)})),ou}hideList(t=this.list){ga.slideUp(t,ze),this.removeHighlight()}showList(t,e=this.list){this.selectOption(t),ga.slideDown(e,ze)}getActiveOption(t=this.list){const e=t.getElementsByClassName("active-option")[0];return e&&"none"!==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=sh.getAddress(t).dom)||n.classList.remove(nu)}}t&&(t.classList.add("active-option"),this.highlightComponent(t))}removeHighlight(){const t=document.getElementsByClassName(nu);for(const e of t)e.classList.remove(nu)}highlightComponent(t){var e;const{dataset:{value:n}}=t;if(n){null==(e=sh.getAddress(n).dom)||e.classList.add(nu)}}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 au=(t,e)=>{const n=(t=>{const e=As(t),n={"field.property":Xe,...Ye},o=e?(i=t,sh.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:oe.get(`${t}.${o}`)||o.toLowerCase(),attrs:{value:i}};e===i&&(r.attrs.selected=!0),n.push(ch.create(r))}return n}),[])},lu=(t,e)=>{ch.empty(t);for(const n of e)t.add(n)},cu=({key:t,value:e,type:n="text",checked:o})=>{const i={tag:"input",attrs:{type:n,value:e,placeholder:oe.get(`${t}.placeholder`)||Qd(t)},className:t.replace(/\./g,"-"),config:{}};return o&&(i.attrs.checked=!0),i},du=t=>{const e=oe.get(t);if(e)return e;const n=t.split(".");return oe.get(n[n.length-1])},uu={autocomplete:(t,e,n)=>new su(t,e,n),string:(t,e)=>cu({key:t,value:e}),boolean:(t,e)=>cu({key:t,value:e,type:"selected"===t?"radio":"checkbox",checked:e}),number:(t,e)=>cu({key:t,value:e,type:"number"}),array:(t,e=[])=>({tag:"select",attrs:{placeholder:du(`placeholder.${t}`)},className:t.replace(/\./g,"-"),options:e}),object:t=>Object.entries(t).map((([t,e])=>uu[ch.childType(e)](t,e)))},hu=["selected","checked"],pu={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 fu{constructor({key:t,data:n,index:o,field:i}){e(this,"generateConditionFields",((t,e)=>{const n={tag:"label",className:`condition-label ${t}-condition-label`,content:oe.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=ca(r,Ve.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(" ")}`}}))})),e(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)}),We)},o=t=>{t=Array.isArray(t)?t:[t];const e=setTimeout((()=>{t.forEach((t=>{t.dom&&(t=t.dom),t.removeAttribute("style")})),clearTimeout(e)}),We)},i=new Map([["condition-source",t=>{const i=e("condition-sourceProperty"),r=i[0],s=As(t.value)?t.value:"field.property",a=au(s,r.value);return lu(r,a),t.value?o(i):n(i)}],["condition-target",t=>{const i=e("condition-targetProperty");return Ns(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)}})),e(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=au(n||t,e),i=uu.array(`condition.${t}`);i.action={change:c,onRender:t=>c({target:t})};const r=ch.create(i);return lu(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,""),e.classList.add([t.className,t.value].filter(Boolean).join("-"));const o={dataPath:a,value:t.value,src:t};wa.formeoUpdated(o),sh.setAddress(a,t.value);const i=t.closest(".f-condition-row"),r=la(i);this.processConditionUIState(this.itemFieldGroups[r])},d={comparison:t=>l("comparison",t),logical:t=>l("logical",t),source:(t,e="source")=>{const o=uu.autocomplete(`condition.${e}`,t,n);return sh.setConditionMap(t,i),o.addEvent("onChange",(t=>{sh.removeConditionMap(sh.getAddress(a)),c(t),sh.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=uu.string("condition.value",t);return e.action={input:c},ch.create(e)},assignment:t=>l("assignment",t)};if(d[t])return d[t](e)})),this.itemValues=ca(Object.entries(n),hu,"0");const[r,s]=t.split(".");this.field=i,this.itemKey=t,this.itemIndex=o,this.panelName=r,this.isDisabled=i.isDisabledProp(s,r),this.isHidden=this.isDisabled&&i.config.panels[r].hideDisabled,this.isLocked=i.isLockedProp(s,r),this.dom=ch.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:()=>{ga.slideUp(this.dom,250,(t=>{this.field.remove(this.itemKey),ch.remove(t),this.field.resizePanelWrap()}))}},content:ch.icon("remove")};return{className:`${this.panelName}-prop-controls prop-controls`,content:[t]}}itemInput(t,e){const n=ch.childType(e)||"string",o={config:{},attrs:{},...uu[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&&(du(r)||Qd(r)),labelAfter:!1},o.attrs={...o.attrs,name:"checkbox"===o.attrs.type?`${a}[]`:a,id:s,disabled:this.isDisabled,locked:this.isLocked},o.action={...pu[n](i,this.field)},o}}class mu{constructor(t,n,o){e(this,"addAttribute",((t,e)=>{const n=tu(t),o=`attrs.${n}`;oe.current[o]||oe.put(o,pa(t)),"string"==typeof e&&["true","false"].includes(e)&&(e=JSON.parse(e)),this.field.set(`attrs.${t}`,e);const i=this.props.querySelector(`.field-attrs-${n}`),r=new fu({key:o,data:{[n]:e},field:this.field});i?this.props.replaceChild(r.dom,i):this.props.appendChild(r.dom),this.field.resizePanelWrap()})),e(this,"addOption",(()=>{const t=this.field.data.meta.id,e=this.field.get("options"),n="select"===t?"option":t,o=oe.get("newOptionLabel",{type:n})||"New Option",i=`options.${this.data.length}`,r=e[e.length-1],s={...e.length?r:{},label:o};"button"!==t&&(s.value=tu(o));const a=new fu({key:i,data:s,field:this.field,index:this.props.children.length});this.editPanelItems.push(a),this.props.appendChild(a.dom),this.field.set(i,s),this.field.resizePanelWrap()})),e(this,"addCondition",(t=>{const e=`conditions.${this.field.get("conditions").length}`,n=this.props.querySelector(`.field-${e.replace(".","-")}`),o=new fu({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=ch.childType(t),this.data="object"===this.type?Object.entries(t):t,this.name=n,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:oe.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 fu({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 ch.create(e)}createEditButtons(){const t=this,e=this.name,n=oe.get(`panelEditButtons.${e}`),o={attrs:t.addAttribute,options:t.addOption,conditions:t.addCondition};return{className:"panel-action-buttons",content:[{...ch.btnTemplate({content:n,title:n}),className:`add-${e}`,action:{click:n=>{const i={btnCoords:ch.coords(n.target),addAction:o[e]};"attrs"===e&&(i.isDisabled=t.field.isDisabledProp,i.isLocked=t.field.isLockedProp,i.message={attr:oe.get(`action.add.${e}.attr`),value:oe.get(`action.add.${e}.value`)});const r=Qd(e),s=new window.CustomEvent(`onAdd${r}`,{detail:i});Gd.add[e](i),document.dispatchEvent(s)}}}]}}}class gu extends Wl{constructor(t,n={},o){super(t,{...n,id:n.id||ws()}),e(this,"mutationHandler",(t=>t.map((t=>{})))),e(this,"remove",(t=>{if(t){const e=t.split("."),n=e.pop(),o=this.get(e);return Array.isArray(o)?aa(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 da(n,(t=>t.remove())),this.dom.parentElement.removeChild(this.dom),((t,e)=>{const n=t.indexOf(e);-1!==n&&t.splice(n,1)})(sh.getAddress(`${e.name}s.${e.id}.children`),this.id),e.children.length||e.emptyClass(),"row"===e.name&&e.autoColumnWidths(),sh[`${this.name}s`].delete(this.id)})),e(this,"emptyClass",(()=>this.dom.classList.toggle("empty",!this.children.length))),e(this,"getComponentTag",(()=>ch.create({tag:"span",className:["component-tag",`${this.name}-tag`],children:[(this.isColumn||this.isField)&&ch.icon("component-corner",{className:"bottom-left"}),ch.icon(`handle-${this.name}`),Qd(this.name),(this.isColumn||this.isRow)&&ch.icon("component-corner",{className:"bottom-right"})].filter(Boolean)}))),e(this,"removeClasses",(t=>{const e={string:()=>this.dom.classList.remove(t),array:()=>t.map((t=>this.dom.classList.remove(t)))};return e.object=e.string,e[ch.childType(t)](this.dom)})),e(this,"loadChildren",((t=this.data.children)=>t.map((t=>this.addChild({id:t}))))),e(this,"saveChildOrder",(()=>{if(this.render)return;const t=this.children.map((({id:t})=>t));return this.set("children",t),t})),e(this,"onSort",(()=>this.saveChildOrder())),e(this,"onEnd",(({to:{parentElement:t},from:{parentElement:e}})=>{null==t||t.classList.remove(`hovering-${bs(t)}`),null==e||e.classList.remove(`hovering-${bs(e)}`)})),e(this,"runConditions",(()=>{const t=this.get("conditions");if(!(null==t?void 0:t.length))return null;return t.map((t=>{const e=this.processConditions(t.if),n=this.processResults(t.then);return e.map((t=>this.evaluateConditions(t)&&this.execResults(n)))}))})),e(this,"value",((t,e)=>{const n=t.split("."),o=this.getComponent(t),i=o&&n.slice(2,n.length).join(".");return[!o,!i,!Xe[i]].some(Boolean)?t:e?o.set(Xe[i],e):o.get(Xe[i])})),e(this,"getResult",(t=>({"=":(t,e,n)=>t.set(e,n)}[t]))),e(this,"processResults",(t=>t.map((({operator:t,target:e,value:n})=>{const o=this.getComponent(e);return{target:o,propertyPath:o&&e.split(".").slice(2,e.length).join("."),action:this.getResult(t),value:this.value(n)}})))),e(this,"execResults",(t=>{const e=t.map((t=>this.execResult(t)));return Promise.all(e)})),e(this,"execResult",(({target:t,action:e,value:n,propertyPath:o})=>new Promise(((o,i)=>{try{return o(e(t,n))}catch(r){return i(r)}})))),e(this,"cloneData",(()=>{const t={...Es(this.data),id:ws()};return"field"!==this.name&&(t.children=[]),t})),e(this,"clone",((t=this.parent)=>{const e=t.addChild(this.cloneData(),this.index+1);return"field"!==this.name&&this.cloneChildren(e),e})),e(this,"createChildWrap",(t=>ch.create({tag:"ul",attrs:{className:"children"},children:t}))),this.id=this.data.id,this.name=t,this.config=sh[`${this.name}s`].config,Cs(this.config,n.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.data.children=this.data.children.filter((e=>-1===t.indexOf(e))),this.dom.classList.add("empty"),t}getActionButtons(){const t=[`hovering-${this.name}`,"hovering"];return{className:[`${this.name}-actions`,"group-actions"],action:{mouseenter:()=>{sh.stages.active.dom.classList.add(`active-hover-${this.name}`),this.dom.classList.add(...t)},mouseleave:({target:e})=>{this.dom.classList.remove(...t),sh.stages.active.dom.classList.remove(`active-hover-${this.name}`),e.removeAttribute("style")}},children:[{...ch.btnTemplate({content:ch.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`);ga.slideToggle(i,We,t),"field"===this.name&&(ga.slideToggle(this.preview,We,!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}`)=>({...ch.btnTemplate({content:ch.icon(t)}),className:["component-handle"]}),move:(t="move")=>({...ch.btnTemplate({content:ch.icon(t)}),className:["item-move"],meta:{id:"move"}}),edit:(t="edit")=>({...ch.btnTemplate({content:ch.icon(t)}),className:["item-edit-toggle"],meta:{id:"edit"},action:{click:t=>{this.toggleEdit()}}}),remove:(t="remove")=>({...ch.btnTemplate({content:ch.icon(t)}),className:["item-remove"],meta:{id:"remove"},action:{click:(t,e)=>{ga.slideUp(this.dom,We,(()=>{if("column"===this.name){this.parent.autoColumnWidths(),this.remove()}else this.remove()}))}}}),clone:(t="copy")=>({...ch.btnTemplate({content:ch.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 la(this.dom)}get parentType(){return Ie.get(this.name)}get parent(){const t=this.parentType;if(!this.dom||!t)return null;const e=this.dom.closest(`.${Te[t]}`);return e&&ch.asComponent(e)}get children(){if(!this.dom)return[];const t=this.domChildren,e=$e.get(this.name);return ua(t,(t=>sh.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=ws()}=i,a=$e.get(this.name);if(!a)return null;const l=`${a}s`,c=sh.getAddress(`${l}.${s}`)||sh[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(ve)||(t=t.parentElement);const r=bs(t),s=bs(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=la(this.dom);return()=>this.parent.addChild(t,e+1)}],[2,t=>()=>this.parent.parent.addChild(t)]]),l={controls:()=>{const{controlData:t}=Ru.get(n.id),{meta:{id:e}}=t,i=e.startsWith("layout-")?e.replace(/^layout-/,""):"field",r=ra({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)();ch.remove(n);return s(t,o)},row:()=>{const t=(a.get({stage:-1,row:0,column:1}[s])||Ts)();return null==t?void 0:t({id:n.id},o)},column:()=>{const t=(a.get({stage:-2,row:-1}[s])||Ts)();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(we)&&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&&ch.onRender(this.dom,t.onRender)}set config(t){const e=ra(this.data,"meta.id"),n=[ra(t,"all"),e&&ra(t,e),ra(t,this.id)].reduce(((t,e)=>e?Cs(t,e):t),this.configVal);this.configVal=n}get config(){return this.configVal}getComponent(t){const[e,n]=t.split("."),o=sh[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===Ae.row}get isColumn(){return this.name===Ae.column}get isField(){return this.name===Ae.field}}class vu extends gu{constructor(t=Object.create(null)){super("field",{conditions:[{if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]}],...t}),e(this,"updateConditionsPanel",_s((()=>{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)}),We)),e(this,"updatePreview",(()=>{if(!this.preview.parentElement)return null;this.updateLabel();const t=ch.create(this.fieldPreview(),!0);this.preview.parentElement.replaceChild(t,this.preview),this.preview=t})),e(this,"updateEditPanels",(()=>{this.editPanels=[];const t=["object","array"],e=ys([...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=ch.childType(e);if(t.includes(n)){const t=new mu(e,r,this);this.editPanels.push(t)}}const i={panels:this.editPanels.map((({panelConfig:t})=>t)),id:this.id,displayType:"auto"};this.panels=new Yd(i),this.dom&&(this.dom.querySelector(".panel-nav").replaceWith(this.panels.panelNav),this.dom.querySelector(".panels").replaceWith(this.panels.panelsWrap))})),e(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)})),e(this,"isDisabledProp",((t,e="attrs")=>{const n=this.config.panels[e];if(!n)return!1;return n.disabled.concat(this.get(`config.disabled${Qd(e)}`)).includes(t)})),e(this,"isLockedProp",((t,e="attrs")=>{const n=this.config.panels[e];if(!n)return!1;return n.locked.concat(this.get(`config.locked${Qd(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=ch.create(this.labelConfig),this.preview=ch.create({}),this.editPanels=[];const n=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:Ce},id:this.id,children:[this.label,this.getComponentTag(),n,o&&this.fieldEdit,this.preview].filter(Boolean),panelNav:this.panelNav,dataset:{hoverTag:oe.get("field")}};i=ch.create(i),this.observe(i),this.dom=i,this.isEditing=!1,this.onRender(i)}get labelConfig(){if(!!this.get("config.hideLabel"))return;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=sh.getConditionMap(`fields.${this.id}`);if(i)return i.updateConditionSourceLabel(`${this.name}s.${this.id}`,n?o:e)}}},e&&ch.requiredMark()]}}updateConditionSourceLabel(t,e){const n=this.editPanels.find((({name:t})=>"conditions"===t));if(!n)return null;for(const{itemFieldGroups:o}of n.editPanelItems)for(const n of o){const o=n.find((e=>e.value===t));o&&(o.displayField.value=e)}}set(...t){const[e,n]=t,o=super.set(e,n);return this.updatePreview(),o}updateLabel(){if(!this.label)return null;const t=ch.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",ch.remove(e)}else this.resizePanelWrap()}},ch.create(t)}get defaultPreviewActions(){return{change:t=>{const{target:e}=t,{type:n}=e;if(["checkbox","radio"].includes(n)){const t=+e.id.split("-").pop();this.toggleCheckedOptions(t,n),this.debouncedUpdateEditPanels()}},click:t=>{"true"===t.target.contentEditable&&t.preventDefault()},input:t=>{if(["input","meter","progress","button"].includes(t.target.tagName.toLowerCase()))return super.set("attrs.value",t.target.value),this.debouncedUpdateEditPanels();if(t.target.contentEditable){const e=t.target.parentElement.classList;if(e.contains("f-checkbox")||e.contains("f-radio")){const e=t.target.parentElement,n=e.parentElement,o=la(e,n);return super.set(`options[${o}].label`,t.target.innerHTML),this.debouncedUpdateEditPanels()}super.set("content",t.target.innerHTML)}}}}fieldPreview(){var t;const e=Es(this.data),{action:n={}}=Ru.get(e.meta.id);e.id=`prev-${this.id}`,e.action=n,(null==(t=this.data)?void 0:t.config.editableContent)&&(e.attrs={...e.attrs,contenteditable:!0});return{attrs:{className:"field-preview",style:this.isEditing&&"display: none;"},content:ch.create(e,!0),action:this.defaultPreviewActions}}}const bu={js:new Set,css:new Set},yu=(t,e,n=js)=>new Promise((o=>fetch(t).then((t=>{if(!t.ok)return o(n(t));o(e?e(t):t)})).catch((t=>n(t))))),wu=(t,e)=>{t.removeEventListener("load",wu),e(t.src)},Cu=(t,e)=>{t.removeEventListener("load",Cu),e(t.src)},Eu=t=>new Promise(((e,n)=>{if(bu.js.has(t))return e(t);bu.js.add(t);const o=ch.create({tag:"script",attrs:{type:"text/javascript",async:!0,src:t},action:{load:()=>Cu(o,e),error:()=>n(new Error(`${t} failed to load.`))}});document.head.appendChild(o)})),xu=t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>new Promise(((e,n)=>{if(bu.css.has(t))return e(t);bu.css.add(t);const o=ch.create({tag:"link",attrs:{rel:"stylesheet",href:t},action:{load:()=>wu(o,e),error:()=>n(new Error(`${(void 0).src} failed to load.`))}});document.head.appendChild(o)}))));return Promise.all(e)},Su=async(t=fe)=>{if(document.getElementById(he))return;const e=async t=>(t=>{let e=document.getElementById(he);return e||(e=ch.create({id:he,children:t,attrs:{hidden:!0,style:"display: none;"}}),document.body.insertBefore(e,document.body.childNodes[0])),e})(await t.text());return yu(t,e,(()=>yu(me,e)))},Ou={js:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>Eu(t)));return Promise.all(e)},css:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>xu(t)));return Promise.all(e)}},Nu=t=>{const e=Object.entries(t).map((([t,e])=>Ou[t](e)));return Promise.all(e)},Au=()=>{const t=document.getElementById(he);return"hidden"===window.getComputedStyle(t).visibility};class _u{constructor({events:t={},dependencies:n={},controlAction:o,...i}){e(this,"controlCache",new Set),this.events=t,this.controlData=i,this.controlAction=o,this.dependencies=n,this.id=i.id||ws()}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:ch.icon(t.icon)},n],action:{focus:({target:t})=>{const e=t.closest(`.${ve}`);return e&&Ru.panels.nav.refresh(la(e))},click:({target:t})=>{Ru.addElement(t.parentElement.id)}}};return ch.create({tag:"li",id:this.id,className:["field-control",`${t.group}-control`,`${t.id}-control`],content:o,meta:t,action:this.controlAction})}promise(){return Nu(this.dependencies)}i18n(t,e){var n,o;const i=oe.locale,r=null==(n=this.definition)?void 0:n.i18n,s=(null==r?void 0:r[i])||{};return((null==(o=s[t])?void 0:o.call(s))??s[t])||oe.get(t,e)}}const Tu=[{config:{label:"row"},meta:{group:"layout",icon:"rows",id:"layout-row"}},{config:{label:"column"},meta:{group:"layout",icon:"columns",id:"layout-column"}}];const ju=(t,e=3)=>Array.from({length:e},((t,e)=>e+1)).map((e=>{const n="checkbox"===t?"checked":"selected";return{label:oe.get("labelCount",{label:Qd(t),count:e}),value:`${t}-${e}`,[n]:!e}}));const Pu=[class extends _u{constructor(){super({tag:"button",attrs:{className:[{label:"grouped",value:"f-btn-group"},{label:"ungrouped",value:"f-field-group"}]},config:{label:oe.get("controls.form.button"),hideLabel:!0},meta:{group:"common",icon:"button",id:"button"},options:[{label:oe.get("button"),type:["button","submit","reset"].map(((t,e)=>({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 _u{constructor(){super({tag:"input",attrs:{type:"date",required:!1,className:""},config:{label:oe.get("controls.form.input.date")},meta:{group:"common",icon:"calendar",id:"date-input"}})}},class extends _u{constructor(){super({tag:"input",attrs:{type:"hidden",value:""},config:{label:oe.get("hidden"),hideLabel:!0},meta:{group:"common",icon:"hidden",id:"hidden"}})}},class extends _u{constructor(){super({tag:"input",attrs:{type:"number",required:!1,className:""},config:{label:oe.get("number")},meta:{group:"common",icon:"hash",id:"number"}})}},class extends _u{constructor(){super({tag:"textarea",config:{label:oe.get("controls.form.textarea")},meta:{group:"common",icon:"textarea",id:"textarea"},attrs:{required:!1}})}},class extends _u{constructor(){super({tag:"input",attrs:{required:!1,type:"text",className:""},config:{label:oe.get("controls.form.input.text")},meta:{group:"common",icon:"text-input",id:"text-input"}})}},class extends _u{constructor(){super({tag:"input",attrs:{type:"file",required:!1},config:{label:oe.get("fileUpload")},meta:{group:"common",icon:"upload",id:"upload"}})}},class extends _u{constructor(){super({tag:"select",config:{label:oe.get("controls.form.select")},attrs:{required:!1,className:""},meta:{group:"common",icon:"select",id:"select"},options:ju("option")})}},class extends _u{constructor(){super({tag:"input",attrs:{type:"checkbox",required:!1},config:{label:oe.get("controls.form.checkbox-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"checkbox",id:"checkbox"},options:ju("checkbox",1)})}},class extends _u{constructor(){super({tag:"input",attrs:{type:"radio",required:!1},config:{label:oe.get("controls.form.radio-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"radio-group",id:"radio"},options:ju("radio")})}}],Lu=Array.from(Array(5).keys()).slice(1).map((t=>`h${t}`)),Du="controls.html.header";const ku=[class extends _u{constructor(){super({tag:Lu[0],attrs:{tag:Lu.map(((t,e)=>({label:t.toUpperCase(),value:t,selected:!e}))),className:""},config:{label:oe.get(Du),hideLabel:!0,editableContent:!0},meta:{group:"html",icon:"header",id:"html.header"},content:oe.get(Du),action:{}})}static get definition(){return{i18n:{"en-US":{header:"Custom English Header"}}}}get content(){return super.i18n(Du)}},class extends _u{constructor(){super({tag:"p",attrs:{className:""},config:{label:oe.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 _u{constructor(){super({tag:"hr",config:{label:oe.get("controls.html.divider"),hideLabel:!0},meta:{group:"html",icon:"divider",id:"divider"}})}},class extends _u{constructor(t){super(Cs({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))}}],$u=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"}}),Iu=[...Pu,...ku,...Tu];const Ru=new class{constructor(){e(this,"groupLabel",(t=>oe.get(t)||t||"")),e(this,"addElement",(t=>{const e=ra(this.get(t),"controlData"),{meta:{group:n,id:o}}=e,i={row:()=>Qu.active.addChild(),column:()=>i.row().addChild(),field:t=>i.column().addChild(t)};return"layout"!==n?i.field(e):i[o.replace("layout-","")]()})),e(this,"applyOptions",(async(t={})=>{const{container:e,elements:n,groupOrder:o,...i}=Cs($u,t);return this.container=e,this.groupOrder=ys(o.concat(["common","html","layout"])),this.options=i,Promise.all(this.registerControls([...Iu,...n]))})),this.data=new Map,this.buttonActions={focus:({target:t})=>{const e=t.closest(`.${ve}`);return e&&this.panels.nav.refresh(la(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 _u(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=ca(t,this.groupOrder,"id"),t=t.filter((t=>vs(t.id,this.options.disable.groups))),n=t.map((t=>{const n={tag:"ul",attrs:{className:ve,id:`${t.id}-${ve}`},config:{label:this.groupLabel(t.label)}};if(this.options.elementOrder[t.id]){const e=this.options.elementOrder[t.id],n=ys(e.concat(t.elementOrder));t.elementOrder=n}return e=ca(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=[vs(i,this.options.disable.elements),n.meta.group===t.id,!o.includes(n.meta.id)].every((t=>!0===t)),r&&o.push(i),r})),n})),n}add(t=Object.create(null)){const e=Es(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 Es(this.data.get(t))}formActions(){if(!0===this.options.disable.formActions)return null;const t={...ch.btnTemplate({content:[ch.icon("bin"),oe.get("clear")],title:oe.get("clearAll")}),className:["clear-form"],action:{click:t=>{th.size?(wa.confirmClearAll=new window.CustomEvent("confirmClearAll",{detail:{confirmationMessage:oe.get("confirmClearAll"),clearAllAction:()=>{Qu.clearAll().then((()=>{const e={src:t.target};wa.formeoCleared(e)}))},btnCoords:ch.coords(t.target)}}),document.dispatchEvent(wa.confirmClearAll)):window.alert(oe.get("cannotClearFields"))}}},e={...ch.btnTemplate({content:[ch.icon("floppy-disk"),oe.get("save")],title:oe.get("save")}),className:["save-form"],action:{click:({target:t})=>{const{formData:e}=sh,n={action:()=>{},coords:ch.coords(t),message:"",button:t};return Gd.click.btn(n),Gd.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 Yd({panels:e,type:"controls",displayType:o});const i=["control-groups","formeo-panels-wrap",`panel-count-${e.length}`],r=ch.create({className:i,content:[this.panels.panelNav,this.panels.panelsWrap]}),s=["formeo-controls"];t&&s.push("formeo-sticky");const a=ch.create({className:s,content:[r,n]}),l=a.getElementsByClassName("control-group");this.dom=a,this.groups=l;const[c]=l;this.currentGroup=c,this.actions={filter:t=>{const e=""!==t,n=this.controls;let o=r.querySelector(".filtered-term");if(ch.toggleElementsByStr(n,t),e){const e=oe.get("controls.filteringTerm",t);a.classList.add("filtered"),o?o.textContent=e:(o=ch.create({tag:"h5",className:"filtered-term",content:e}),r.insertBefore(o,r.firstChild))}else o&&(a.classList.remove("filtered"),o.remove())},addElement:this.addElement,addGroup:t=>{}};for(let d=l.length-1;d>=0;d--){const t=`formeo-controls-${l[d]}`;this.options.sortable||window.localStorage.removeItem(t),Sd.create(l[d],{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 vu(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 a}};class Mu extends Wl{constructor(){super(...arguments),e(this,"load",((t=Object.create(null))=>(this.empty(),"string"==typeof t&&(t=JSON.parse(t)),Object.entries(t).forEach((([t,e])=>this.add(t,e))),this.data))),e(this,"get",(t=>t?ra(this.data,t):this.add())),e(this,"add",((t,e=Object.create(null))=>{const n=t||ws(),o=this.Component({...e,id:n});return this.set(n,o),this.active=o,o})),e(this,"remove",(t=>(Array.isArray(t)?t.forEach((t=>{this.get(t).remove()})):this.get(t).remove(),this.data))),e(this,"delete",(t=>(delete this.data[t],t))),e(this,"clearAll",((t=!0)=>{const e=Object.values(this.data).map((e=>e.empty(t)));return Promise.all(e)})),e(this,"conditionMap",new Map)}set config(t){this.configVal=Cs(this.configVal,Es(t))}get config(){return this.configVal}}class Fu extends gu{constructor(t,e){super("stage",{...Object.freeze({children:[]}),...t},e);const n=this.createChildWrap();this.dom=ch.create({attrs:{className:[be,"empty"],id:this.id},children:n}),Sd.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:()=>{Bu.active=this},onSort:this.onSort.bind(this),draggable:`.${ye}`,handle:".item-move"})}empty(t=!0){return new Promise((e=>{t?(this.dom.classList.add("removing-all-fields"),ga.slideUp(this.dom,We,(()=>{e(super.empty(t)),this.dom.classList.remove("removing-all-fields"),ga.slideDown(this.dom,We)}))):e(super.empty())}))}onAdd(...t){const e=super.onAdd(...t);e&&"column"===e.name&&e.parent.autoColumnWidths()}}const Bu=new class extends Mu{constructor(t){super("stages",t)}Component(t){return new Fu(t)}};class Wu extends gu{constructor(t){super("row",{...Object.freeze({config:{fieldset:!1,legend:"",inputGroup:!1},children:[],className:[ye]}),...t}),e(this,"autoColumnWidths",(()=>{const t=this.children;if(!t.length)return;const e=Number.parseFloat((100/t.length).toFixed(1))/1;for(const n of t){n.removeClasses(Je);const t=n.dom,o=Ss(e);n.set("config.width",o),t.style.width=o,t.dataset.colWidth=o;const i=setTimeout((()=>{clearTimeout(i),n.refreshFieldPanels()}),ze);document.dispatchEvent(wa.columnResized)}this.updateColumnPreset()})),e(this,"updateColumnPreset",(()=>{this.columnPresetControl.innerHTML="";const t=this.getColumnPresetOptions.map((({label:t,...e})=>ch.create({tag:"option",content:t,attrs:e})));this.columnPresetControl.append(...t)})),e(this,"setColumnWidths",(t=>{"string"==typeof t&&(t=t.split(",")),this.children.forEach(((e,n)=>{e.setWidth(`${t[n]}%`),e.refreshFieldPanels()}))}));const n=this.createChildWrap();this.dom=ch.create({tag:"li",className:[ye,"empty"],dataset:{hoverTag:oe.get("row"),editingHoverTag:oe.get("editing.row")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),this.editWindow,n]}),Sd.create(n,{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:`.${we}`,handle:".item-move"})}get editWindow(){const t={tag:"input",id:`${this.id}-fieldset`,attrs:{type:"checkbox",checked:this.get("config.fieldset"),ariaLabel:oe.get("row.settings.fieldsetWrap.aria")},action:{click:({target:{checked:t}})=>{this.set("config.fieldset",Boolean(t))}},config:{label:oe.get("row.settings.fieldsetWrap")}},e={tag:"input",id:`${this.id}-inputGroup`,attrs:{type:"checkbox",checked:this.get("config.inputGroup"),ariaLabel:oe.get("row.settings.inputGroup.aria")},action:{click:({target:{checked:t}})=>this.set("config.inputGroup",t)},config:{label:oe.get("row.makeInputGroup"),description:oe.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=ch.formGroup([t,n]),i={tag:"label",content:oe.get("defineColumnWidths"),className:"col-sm-4 form-control-label"};this.columnPresetControl=ch.create(this.columnPresetControlConfig);const r={className:"col-sm-8",content:this.columnPresetControl,action:{onRender:()=>{this.updateColumnPreset()}}},s=[e,"hr",o,"hr",ch.formGroup([i,r],"row")];return ch.create({className:`${this.name}-edit group-config`,action:{onRender:t=>{const e=s.map((t=>ch.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=Re.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:Ee}),t.map((t=>{const e={...t};return e.selected=t.value===n,e}))}return[]}get columnPresetControlConfig(){return{tag:"select",attrs:{ariaLabel:oe.get("defineColumnLayout"),className:xe},action:{change:({target:t})=>{const{value:e}=t;this.setColumnWidths(e)}},options:this.getColumnPresetOptions}}}const zu={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]}};const Uu=new class extends Mu{constructor(t){super("rows",t),this.config={all:zu}}Component(t){return new Wu(t)}};class qu{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=ch.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(`.${ye}`);if(this.validateResizeTarget(e,n))if(this.startX="touchstart"===t.type?t.touches[0].clientX:t.clientX,o.classList.add(Se),this.columnPreset=o.querySelector(`.${xe}`),this.originalColumnClass=e.className,this.originalSiblingClass=n.className,e.className=e.className.replace(Je,""),n.className=n.className.replace(Je,""),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(xs(e,this.rowWidth)),i=parseFloat(xs(n,this.rowWidth));return o<10||i<10?null:{colWidth:Ss(o.toFixed(1)),siblingColWidth:Ss(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(),sh.setAddress(`columns.${t.id}.config.width`,t.dataset.colWidth),sh.setAddress(`columns.${e.id}.config.width`,e.dataset.colWidth),this.row.classList.remove(Se),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(Se),window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onStop)}setCustomWidthValue(){const t=this.columnPreset;let e=t.querySelector(`.${Ee}`);const n=this.row.querySelector(".children").children,o=ua(n,(t=>xs(t.clientWidth,this.rowWidth).toFixed(1))),i=o.join(","),r=o.join(" | ");return e||(e=ch.create({tag:"option",attrs:{className:Ee,value:i,selected:!0},content:r}),t.append(e)),e.value=i,e.textContent=r,i}}const Hu=t=>({className:"resize-x-handle",action:{pointerdown:t.onStart.bind(t)},content:[ch.icon("triangle-down"),ch.icon("triangle-up")]}),Gu=()=>({className:"column-edit group-config"});class Vu extends gu{constructor(t){super("column",{...Object.freeze({config:{width:"100%"},children:[],className:[we]}),...t}),e(this,"refreshFieldPanels",(()=>{for(const t of this.children)t.panels.nav.refresh()})),e(this,"setWidth",(t=>(this.dom.dataset.colWidth=t,this.dom.style.width=t,this.set("config.width",t))));const n=this.createChildWrap();this.dom=ch.create({tag:"li",className:[we,"empty"],dataset:{hoverTag:oe.get("column")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),Gu(),Hu(new qu),n]}),this.processConfig(this.dom),wa.columnResized=new window.CustomEvent("columnResized",{detail:{column:this.dom,instance:this}}),Sd.create(n,{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:`.${Ce}`,handle:".item-move"})}processConfig(t){const e=ma.get(this.data,"config.width");e&&(t.dataset.colWidth=e,t.style.width=e)}}const Xu={actionButtons:{buttons:["clone","move","remove"],disabled:[]}};const Yu=new class extends Mu{constructor(t){super("columns",t),this.config={all:Xu}}Component(t){return new Vu(t)}},Zu={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]},panels:{disabled:[],attrs:{disabled:["type"],hideDisabled:!0,locked:[]},order:["attrs","options","conditions"]},label:{disableHTML:!1}};const Ju=new class extends Mu{constructor(t){super("fields",t),e(this,"get",(t=>{let e=t&&ra(this.data,t);if(!e){const n=Ru.get(t);n&&(e=this.add(null,n.controlData))}return e})),this.config={all:Zu}}Component(t){return new vu(t)}};const Ku=new class extends Mu{constructor(t){super("externals",t)}Component(t){return new gu("external",t)}},Qu=Bu,th=Uu,eh=Yu,nh=Ju,oh=Ru,ih=Ku,rh={id:ws()};const sh=new class extends Wl{constructor(t){super("components"),e(this,"sessionFormData",(()=>{var t;if(null==(t=this.opts)?void 0:t.sessionStorage)return Os.get(Fe)})),e(this,"load",((t,e=this.opts||Object.create(null))=>{let n=t;this.empty(),"string"==typeof t&&(n=JSON.parse(t)),this.opts=e;const{stages:o={[ws()]:{}},rows:i,columns:r,fields:s,id:a=ws()}={...this.sessionFormData(),...n};this.set("id",a),this.add("stages",Qu.load(o)),this.add("rows",th.load(i)),this.add("columns",eh.load(r)),this.add("fields",nh.load(s)),this.add("externals",ih.load(e.external));for(const l of Object.values(this.get("stages")))l.loadChildren();return this.data})),this.opts=t,this.data=rh,this.disableEvents=!0,this.stages=Qu,this.rows=th,this.columns=eh,this.fields=nh,this.controls=oh,this.externals=ih}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(this.formData)}get formData(){return{id:this.get("id"),stages:Bu.getData(),rows:Uu.getData(),columns:Yu.getData(),fields:Ju.getData()}}set config(t){const{stages:e,rows:n,columns:o,fields:i}=t;Qu.config=e,th.config=n,eh.config=o,nh.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(!Ns(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(Ns(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.get(e[1])}}setConditionMap(t,e){if(Ns(t)){const n=t.split(".");return n.every((t=>Boolean(t)))&&this[n[0]].conditionMap.set(n[1],e)}}removeConditionMap(t){if(Ns(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.delete(e[1])}}},ah={glyphicons:t=>``,"font-awesome":t=>{const[e,n]=t.split(" ");return``},fontello:t=>`${t}`},lh=new Set(["input","textarea","select"]);const ch=new class{constructor(t=Object.create(null)){e(this,"render",(t=>(t.id=`f-${t.id||ws()}`,this.create(t)))),e(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:[ma.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=Cs(a.attrs,{className:i})),r){const t=this.processOptions(r,a,e);if(!this.holdsContent(h)||"button"===c)return ma.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(ma.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=ma.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})),e(this,"onRender",((t,e)=>{t.parentElement?e(t):window.requestAnimationFrame((()=>this.onRender(t,e)))})),e(this,"toggleElementsByStr",((t,e)=>{const n=[];return ch.elementsContainText(t,e,((t,e)=>{e?(t.style.display="block",n.push(t)):t.style.display="none"})),n})),e(this,"elementsContainText",((t,e,n)=>{const o=[];return da(t,(t=>{const i=-1!==t.textContent.toLowerCase().indexOf(e.toLowerCase());null==n||n(t,i),i&&o.push(t)})),o})),e(this,"generateOption",(({type:t="option",label:e,value:n,i:o=0,selected:i})=>({tag:"option"===t?"option":"input",attrs:{type:t,value:n||`${t}-${o}`,["option"===t?"selected":"checked"]:i||!o},config:{label:e||oe.get("labelCount",{label:oe.get("option"),count:o})}}))),e(this,"requiredMark",(()=>({tag:"span",className:"text-error",children:"*"}))),e(this,"removeEmpty",(t=>{const e=t.parentElement,n=bs(t),o=e.getElementsByClassName(`formeo-${n}`);if(this.remove(t),!o.length)return this.isStage(e)?this.emptyClass(e):this.removeEmpty(e)})),e(this,"btnTemplate",(({title:t="",...e})=>({tag:"button",attrs:{type:"button",title:t},...e}))),e(this,"isControls",(t=>bs(t)===ve)),e(this,"isStage",(t=>bs(t)===be)),e(this,"isRow",(t=>bs(t)===ye)),e(this,"isColumn",(t=>bs(t)===we)),e(this,"isField",(t=>bs(t)===Ce)),e(this,"asComponent",(t=>sh[`${bs(t)}s`].get(t.id))),this.options=t}set setOptions(t){this.options=Cs(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:ch.onRender,render:ch.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(`#${he} svg symbol`);return this.iconSymbols=Array.from(t).reduce(((t,e)=>{var n;return t[e.id.replace(Ke,"")]={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=Cs(r,e);return this.cachedIcons[i]=ch.create(t).outerHTML,this.cachedIcons[i]}return this.cachedIcons[i]=ch.create(r).outerHTML,this.cachedIcons[i]}return(null==(o=ah[ch.options.iconFont])?void 0:o.call(ah,t))||t}processAttrs(t,e,n){const{attrs:o={}}=t;n||o.name||!this.isInput(t.tag)||e.setAttribute("name",ws(t));for(const i of Object.keys(o)){const t=ma.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||ws(),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),lh.has(e)}parsedHtml(t){const e=document.createElement("textarea");return e.innerHTML=t,e.textContent}labelAfter(t){const e=ma.get(t,"attrs.type"),n=ma.get(t,"config.labelAfter");return void 0!==n?n:"checkbox"===e||"radio"===e}label(t,e){const n=ma.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=bs(t);return e?sh.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,ma.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)}};ma.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");ga.slideUp(t,600,(()=>{ch.empty(t),t.classList.remove("removing-all-fields"),ch.emptyClass(t),ga.slideDown(t,300)}))}toggleSortable(t,e){let n=e;const o=bs(t);if(!o)return;const i=bs(t.parentElement),r=ch[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(Oe.get(t.classList.item(0)));t.classList.toggle("empty",!e.length)}};const dh={"en-US":"English",dir:"ltr","af-ZA":"Afrikaans (South Africa)","ar-TN":"Arabic (Tunisia)","cs-CZ":"Czech (Czechia)","de-DE":"German (Germany)","es-ES":"European Spanish","fa-IR":"Persian (Iran)","fi-FI":"Finnish (Finland)","fr-FR":"French (France)","hu-HU":"Hungarian (Hungary)","it-IT":"Italian (Italy)","ja-JP":"Japanese (Japan)","nb-NO":"Norwegian Bokmål (Norway)","pl-PL":"Polish (Poland)","pt-BR":"Brazilian Portuguese","pt-PT":"European Portuguese","ro-RO":"Romanian (Romania)","ru-RU":"Russian (Russia)","th-TH":"Thai (Thailand)","tr-TR":"Turkish (Türkiye)","zh-CN":"Chinese (China)","zh-HK":"Chinese (Hong Kong SAR China)","action.add.attrs.attr":"What attribute would you like to add?","action.add.attrs.value":"Default Value",addOption:"Add Option",allFieldsRemoved:"All fields were removed.",allowSelect:"Allow Select",and:"and",attribute:"Attribute",attributeNotPermitted:'Attribute "{attribute}" is not permitted, please choose another.',attributes:"Attributes","attrs.class":"Class","attrs.className":"Class","attrs.dir":"Direction","attrs.id":"Id","attrs.required":"Required","attrs.style":"Style","attrs.title":"Title","attrs.type":"Type","attrs.value":"Value",autocomplete:"Autocomplete",button:"Button",cannotBeEmpty:"This field cannot be empty",cannotClearFields:"There are no fields to clear",checkbox:"Checkbox",checkboxes:"Checkboxes",class:"Class",clear:"Clear",clearAllMessage:"Are you sure you want to clear all fields?",close:"Close",column:"Column","condition.target.placeholder":"target","condition.value.placeholder":"value",confirmClearAll:"Are you sure you want to remove all fields?",content:"Content",control:"Control","controlGroups.nextGroup":"Next Group","controlGroups.prevGroup":"Previous Group","controls.filteringTerm":'Filtering "{term}"',"controls.form.button":"Button","controls.form.checkbox-group":"Checkbox Group","controls.form.input.date":"Date","controls.form.input.email":"Email","controls.form.input.file":"File Upload","controls.form.input.hidden":"Hidden Input","controls.form.input.number":"Number","controls.form.input.text":"Text Input","controls.form.radio-group":"Radio Group","controls.form.select":"Select","controls.form.textarea":"TextArea","controls.groups.form":"Form Fields","controls.groups.html":"HTML Elements","controls.groups.layout":"Layout","controls.html.divider":"Divider","controls.html.header":"Header","controls.html.paragraph":"Paragraph","controls.layout.column":"Column","controls.layout.row":"Row",copy:"Copy To Clipboard",danger:"Danger",defineColumnLayout:"Define a column layout",defineColumnWidths:"Define column widths",description:"Help Text",descriptionField:"Description","editing.row":"Editing Row",editorTitle:"Form Elements",field:"Field","field.property.invalid":"not valid","field.property.isNotVisible":"is not visible","field.property.isVisible":"is visible","field.property.label":"label","field.property.valid":"valid","field.property.value":"value",fieldNonEditable:"This field cannot be edited.",fieldRemoveWarning:"Are you sure you want to remove this field?",fileUpload:"File Upload",formUpdated:"Form Updated",getStarted:"Drag a field from the right to get started.",group:"Group",grouped:"Grouped",hidden:"Hidden Input",hide:"Edit",htmlElements:"HTML Elements",if:"If","if.condition.source.placeholder":"source","if.condition.target.placeholder":"target / value",info:"Info","input.date":"Date","input.text":"Text",label:"Label",labelCount:"{label} {count}",labelEmpty:"Field Label cannot be empty","lang.af":"Afrikaans","lang.ar":"Arabic","lang.cs":"Czech","lang.de":"German","lang.en":"English","lang.es":"Spanish","lang.fa":"Persian","lang.fi":"Finnish","lang.fr":"French","lang.hu":"Hungarian","lang.it":"Italian","lang.ja":"Japanese","lang.nb":"Norwegian Bokmål","lang.pl":"Polish","lang.pt":"Portuguese","lang.ro":"Romanian","lang.ru":"Russian","lang.th":"Thai","lang.tr":"Turkish","lang.zh":"Chinese",layout:"Layout",limitRole:"Limit access to one or more of the following roles:",mandatory:"Mandatory",maxlength:"Max Length","meta.group":"Group","meta.icon":"Ico","meta.label":"Label",minOptionMessage:"This field requires a minimum of 2 options",name:"Name",newOptionLabel:"New {type}",no:"No",number:"Number",off:"Off",on:"On","operator.contains":"contains","operator.equals":"equals","operator.notContains":"not contains","operator.notEquals":"not equal","operator.notVisible":"not visible","operator.visible":"visible",option:"Option",optional:"optional",optionEmpty:"Option value required",optionLabel:"Option {count}",options:"Options",or:"or",order:"Order","panel.label.attrs":"Attributes","panel.label.conditions":"Conditions","panel.label.config":"Configuration","panel.label.meta":"Meta","panel.label.options":"Options","panelEditButtons.attrs":"+ Attribute","panelEditButtons.conditions":"+ Condition","panelEditButtons.options":"+ Option",placeholder:"Placeholder","placeholder.className":"space separated classes","placeholder.email":"Enter you email","placeholder.label":"Label","placeholder.password":"Enter your password","placeholder.placeholder":"Placeholder","placeholder.text":"Enter some Text","placeholder.textarea":"Enter a lot of text","placeholder.value":"Value",preview:"Preview",primary:"Primary",remove:"Remove",removeMessage:"Remove Element",removeType:"Remove {type}",required:"Required",reset:"Reset",richText:"Rich Text Editor",roles:"Access",row:"Row","row.makeInputGroup":"Make this row an input group.","row.makeInputGroupDesc":"Input Groups enable users to add sets of inputs at a time.","row.settings.fieldsetWrap":"Wrap row in a <fieldset> tag","row.settings.fieldsetWrap.aria":"Wrap Row in Fieldset",save:"Save",secondary:"Secondary",select:"Select",selectColor:"Select Color",selectionsMessage:"Allow Multiple Selections",selectOptions:"Options",separator:"Separator",settings:"Settings",size:"Size",sizes:"Sizes","sizes.lg":"Large","sizes.m":"Default","sizes.sm":"Small","sizes.xs":"Extra Small",style:"Style",styles:"Styles","styles.btn":"Button Style","styles.btn.danger":"Danger","styles.btn.default":"Default","styles.btn.info":"Info","styles.btn.primary":"Primary","styles.btn.success":"Success","styles.btn.warning":"Warning",subtype:"Type",success:"Success",text:"Text Field",then:"Then","then.condition.target.placeholder":"target",toggle:"Toggle",ungrouped:"Un-Grouped",warning:"Warning",yes:"Yes"};oe.addLanguage("en-US",dh);const uh={get editor(){return{stickyControls:!1,allowEdit:!0,dataType:"json",debug:!1,sessionStorage:!1,editorContainer:null,external:{},svgSprite:fe,style:ge,iconFont:null,config:{},events:{},actions:{},controls:{},polyfills:fa(),i18n:{location:"https://draggable.github.io/formeo/assets/lang/"}}}};let hh=class{constructor({formData:t,...e},n){const o=Cs(uh.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,ch.setOptions=c,sh.config=a,this.userFormData=n||t,this.Components=sh,this.dom=ch,wa.init({debug:s,...r}),Gd.init({debug:s,sessionStorage:c.sessionStorage,...i}),this.tooltip=new ce,document.addEventListener("DOMContentLoaded",this.loadResources.bind(this))}get formData(){return this.Components.formData}set formData(t={}){this.load({...this.userFormData,...t},this.opts)}get json(){return this.Components.json}async loadResources(){var t;document.removeEventListener("DOMContentLoaded",this.loadResources);const e=[];this.opts.polyfills&&(t=>{const e=Array.isArray(t)?pe.filter((({name:e})=>-1!==t.indexOf(e))):pe;Promise.all(e.map((({src:t})=>Eu(t))))})(this.opts.polyfills),await Su(this.opts.svgSprite),e.push((async t=>{if(!Au()&&(await xu(t),!Au()))return await xu("https://draggable.github.io/formeo/assets/css/formeo.min.css")})(this.opts.style)),e.push(oe.init({...this.opts.i18n,locale:null==(t=window.sessionStorage)?void 0:t.getItem(Be)}));const n=await Promise.all(e);return this.opts.allowEdit&&this.init(),n}init(){Ru.init(this.opts.controls,this.opts.stickyControls).then((t=>{this.controls=t,this.load(this.userFormData,this.opts),this.formId=sh.get("id"),this.i18n={setLang:t=>{var e;null==(e=window.sessionStorage)||e.setItem(Be,t);oe.setCurrent(t).then((()=>{this.init()}),console.error)}},this.render()}))}load(t=this.userFormData,e=this.opts){return this.Components.load(t,e)}render(){if(!this.controls)return window.requestAnimationFrame((()=>this.render()));if(this.stages=Object.values(sh.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))]};oe.current.dir&&(t.attrs.dir=oe.current.dir,ch.dir=oe.current.dir),this.editor=ch.create(t);(this.controls.container||this.editor).appendChild(this.controls.dom),this.editorContainer&&(ch.empty(this.editorContainer),this.editorContainer.appendChild(this.editor)),wa.formeoLoaded=new window.CustomEvent("formeoLoaded",{detail:{formeo:this}}),document.dispatchEvent(wa.formeoLoaded)}};const ph=t=>{const e=t.match(Ze);return(null==e?void 0:e[0])||t},fh=t=>t.replace(Ze,ws());let mh=class{constructor(t,n={}){e(this,"render",((t=this.form)=>{this.form=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=ch.render(n),this.applyConditions();const o=this.container.querySelector(".formeo-render");o?o.replaceWith(this.renderedForm):this.container.appendChild(this.renderedForm)})),e(this,"orderChildren",((t,e)=>e.reduce(((e,n)=>(e.push(this.form[t][n]),e)),[]))),e(this,"prefixId",(t=>"f-"+t)),e(this,"processColumn",(({id:t,...e})=>({...e,id:this.prefixId(t),children:this.processFields(e.children),style:`width: ${e.config.width||"100%"}`}))),e(this,"processRows",(t=>this.orderChildren("rows",this.form.stages[t].children).reduce(((t,e)=>(e&&t.push(this.processRow(e)),t)),[]))),e(this,"cacheComponent",(t=>(this.components[ph(t.id)]=t,t))),e(this,"processRow",((t,e="row")=>{const{config:n,id:o}=t,i=[`formeo-${e}-wrap`],r={...t,children:this.processColumns(t.id),id:this.prefixId(o)};this.cacheComponent(r);const s=[{condition:n.legend,result:()=>({tag:n.fieldset?"legend":"h3",children:n.legend})},{condition:!0,result:()=>r},{condition:n.inputGroup,result:()=>this.addButton(o)}].reduce(((t,{condition:e,result:n})=>(e&&t.push(n()),t)),[]);return n.inputGroup&&i.push("f-input-group-wrap"),{tag:n.fieldset?"fieldset":"div",id:ws(),className:i,children:s}})),e(this,"cloneComponentData",(t=>{const{children:e=[],id:n,...o}=this.components[t];return Object.assign({},o,{id:fh(n),children:e.length&&e.map((({id:t})=>this.cloneComponentData(ph(t))))})})),e(this,"addButton",(t=>ch.render({tag:"button",attrs:{className:"add-input-group btn pull-right",type:"button"},children:"Add +",action:{click:e=>{const n=e.target.parentElement,o=ch.render(this.cloneComponentData(t));n.insertBefore(o,n.lastChild),o.appendChild(ch.render(ch.btnTemplate({className:"remove-input-group",children:ch.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()}})))}}}))),e(this,"processColumns",(t=>this.orderChildren("columns",this.form.rows[t].children).map((t=>this.cacheComponent(this.processColumn(t)))))),e(this,"processFieldsOrig",(t=>this.orderChildren("fields",t).map((({id:t,...e})=>this.cacheComponent(Object.assign({},e,{id:this.prefixId(t)})))))),e(this,"processFields",(t=>this.orderChildren("fields",t).map((({id:t,...e})=>{const{action:n={},dependencies:o={}}=this.elements[e.meta.id]||{};o&&Nu(o);const i=Cs({action:n},e);return this.cacheComponent({...i,id:this.prefixId(t)})})))),e(this,"applyConditions",(()=>{Object.values(this.components).forEach((({conditions:t})=>{t&&t.forEach(((t,e)=>{const{if:n,then:o}=t;n.forEach((t=>{const{source:e,...n}=t;if(Ns(e)){this.getComponents(e).forEach((t=>{const e=gh(t);e&&t.addEventListener(e,(t=>this.evaluateCondition(n,t)&&o.forEach((e=>this.execResult(e,t)))),!1);const i={target:t};this.evaluateCondition(n,i)&&o.forEach((t=>this.execResult(t,i)))}))}}))}))}))})),e(this,"evaluateCondition",(({sourceProperty:t,targetProperty:e,comparison:n,target:o},i)=>{var r;const s={equals:Bl,notEquals:(t,e)=>!Bl(t,e),contains:(t,e)=>t.includes(e),notContains:(t,e)=>!t.includes(e)},a=String(i.target[t]),l=String(Ns(o)?this.getComponent(o)[e]:o);return null==(r=s[n])?void 0:r.call(s,a,l)})),e(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(Ns(e)){const n=this.getComponent(e);n&&void 0===n._required&&(n._required=n.required),null==(i=r[t])||i.call(r,n)}})),e(this,"getComponent",(t=>{const e=t.slice(t.indexOf(".")+1);return As(t)?this.external[e]:this.renderedForm.querySelector(`#f-${e}`)})),e(this,"getComponents",(t=>{const e=[],n=t.slice(t.indexOf(".")+1);return As(t)?e.push(this.external[n]):e.push(...this.renderedForm.querySelectorAll(`[name=f-${n}]`)),e}));const{renderContainer:o,external:i,elements:r}=(({editorContainer:t,renderContainer:e,...n})=>{const o=t=>"string"==typeof t?document.querySelector(t):t;return{...n,renderContainer:o(e),editorContainer:o(t)}})(t);this.container=o,this.form=n,this.external=i,this.dom=ch,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=be,ch.render(t))))}};const gh=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=hh,window.FormeoRenderer=mh);const vh=mh,bh=new hh(r);((t,e)=>{const n=((t,e)=>({renderForm:()=>{te.style.display="block",e.render(t.formData)},logJSON:()=>{},viewData:()=>{for(const[e,n]of Object.entries(t.formData));},resetEditor:()=>{window.sessionStorage.removeItem("formeo-formData"),window.location.reload()}}))(t,e);Object.entries(n).map((([t,e])=>{const n={id:t,type:"button"},o=Object.assign(document.createElement("button"),n),i=document.createTextNode(Kt(t));return o.appendChild(i),o.addEventListener("click",e,!1),Qt.appendChild(o),o}))})(bh,new vh(s)),(t=>{const e=document.getElementById("control-filter"),n=document.getElementById("locale"),o=window.sessionStorage.getItem("formeo-locale");e.addEventListener("input",(({target:{value:e}})=>t.controls.actions.filter(e))),n.value=o||"en-US",n.addEventListener("change",(({target:{value:e}})=>{window.sessionStorage.setItem("formeo-locale",e),t.i18n.setLang(e)}),!1)})(bh); +var t=Object.defineProperty,e=(e,n,o)=>((e,n,o)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o)(e,"symbol"!=typeof n?n+"":n,o);!function(){const t=document.createElement("link").relList;if(!(t&&t.supports&&t.supports("modulepreload"))){for(const t of document.querySelectorAll('link[rel="modulepreload"]'))e(t);new MutationObserver((t=>{for(const n of t)if("childList"===n.type)for(const t of n.addedNodes)"LINK"===t.tagName&&"modulepreload"===t.rel&&e(t)})).observe(document,{childList:!0,subtree:!0})}function e(t){if(t.ep)return;t.ep=!0;const e=function(t){const e={};return t.integrity&&(e.integrity=t.integrity),t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),"use-credentials"===t.crossOrigin?e.credentials="include":"anonymous"===t.crossOrigin?e.credentials="omit":e.credentials="same-origin",e}(t);fetch(t.href,e)}}();const n=-1!==window.location.href.indexOf("draggable.github.io");if(n){"https:"!==window.location.protocol&&(window.location.protocol="https:"),((window.gitter={}).chat={}).options={room:"Draggable/formeo",activationElement:".toggle-gitter"};[{src:"//platform.twitter.com/widgets.js",id:"twitter-script"},{src:"//buttons.github.io/buttons.js",id:"github-script"},{src:"//www.google-analytics.com/analytics.js",id:"google-analytics",onload:()=>{window.ga("create","UA-79014176-2","auto"),window.ga("send","pageview")}}].forEach((function(t){const[e]=document.getElementsByTagName("script");if(document.getElementById(t.id))return;const n=Object.assign(document.createElement("script"),t);e.parentNode.insertBefore(n,e)}))}const o={user:{isAuthenticated:!0,userName:"Kevin"}},i={rows:{all:{events:{onRender:t=>{}}}},fields:{checkbox:{actionButtons:{}},"a33bcc32-c54c-46ed-9609-7cdb5b3dc511":{events:{onRender:t=>{const e=setTimeout((()=>{t.querySelector(".next-group").click(),clearTimeout(e)}),333)}},panels:{attrs:{hideDisabled:!0},disabled:[]}}}},r={editorContainer:document.querySelector(".build-form"),i18n:{location:"./assets/lang"},actions:{},external:o,controls:{sortable:!1,groupOrder:["common","html"],disable:{},elements:[{tag:"input",config:{label:"Email",disabledAttrs:["type"],lockedAttrs:["required","className"]},meta:{group:"common",id:"email",icon:"@"},attrs:{className:"custom-email",type:"email",required:!0}}],elementOrder:{common:["button","checkbox","date-input","hidden","upload","number","radio","select","text-input","textarea"]}},config:i,events:{onSave:console.log},sessionStorage:!0,editPanelOrder:["attrs","options"]},s={renderContainer:".render-form",external:o,elements:{tinymce:{action:{onRender:t=>{if(t.id){const e=`#${t.id}`;window.tinymce.remove(e),window.tinymce.init({selector:e})}}}}}};var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function l(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var c=function(t,e,n,o){var i=-1,r=null==t?0:t.length;for(o&&r&&(n=t[++i]);++ii?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var r=Array(i);++o=o?t:At(t,e,n)},Tt=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var jt=function(t){return Tt.test(t)};var Pt=function(t){return t.split("")},Lt="\\ud800-\\udfff",Dt="["+Lt+"]",kt="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",$t="\\ud83c[\\udffb-\\udfff]",It="[^"+Lt+"]",Rt="(?:\\ud83c[\\udde6-\\uddff]){2}",Mt="[\\ud800-\\udbff][\\udc00-\\udfff]",Ft="(?:"+kt+"|"+$t+")"+"?",Wt="[\\ufe0e\\ufe0f]?",Bt=Wt+Ft+("(?:\\u200d(?:"+[It,Rt,Mt].join("|")+")"+Wt+Ft+")*"),zt="(?:"+[It+kt+"?",kt,Rt,Mt,Dt].join("|")+")",Ut=RegExp($t+"(?="+$t+")|"+zt+Bt,"g");var qt=Pt,Ht=jt,Gt=function(t){return t.match(Ut)||[]};var Vt=_t,Xt=jt,Yt=function(t){return Ht(t)?Gt(t):qt(t)},Zt=W;var Jt=function(t){return function(e){e=Zt(e);var n=Xt(e)?Yt(e):void 0,o=n?n[0]:e.charAt(0),i=n?Vt(n,1).join(""):e.slice(1);return o[t]()+i}}("toUpperCase");const Kt=l(Nt((function(t,e,n){return t+(n?" ":"")+Jt(e)}))),Qt=document.getElementById("editor-action-buttons"),te=document.querySelector(".render-form");const ee={extension:".lang",location:"assets/lang/",langs:["en-US"],locale:"en-US",override:{}};class ne{constructor(t=ee){this.langs=Object.create(null),this.loaded=[],this.processConfig(t)}processConfig(t){const{location:e,...n}={...ee,...t},o=e.replace(/\/?$/,"/");this.config={location:o,...n};const{override:i,preloaded:r={}}=this.config,s=Object.entries(this.langs).concat(Object.entries(i||r));this.langs=s.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?ne.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 ne.fromFile(t.replace(/\n\n/g,"\n"))}static fromFile(t){const e=t.split("\n"),n={};for(let o,i=0;i{const i=ne.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 oe=new ne;!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 ie=Object.defineProperty,re=(t,e,n)=>((t,e,n)=>e in t?ie(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);const se="_3x4ZIcu-",ae="JIt36hCJ",le={triggerName:"tooltip"};class ce{constructor(t=le){re(this,"triggerName"),re(this,"tooltip"),re(this,"activeTriggerType",null),re(this,"spacing",12),re(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()})),re(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")}})),re(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()})),re(this,"handleResize",(()=>{this.isVisible()&&this.hide()})),re(this,"handleScroll",(()=>{this.isVisible()&&this.hide()})),this.triggerName=`data-${t.triggerName}`,this.tooltip=document.createElement("div"),this.tooltip.className=`d-tooltip ${se}`,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(ae)}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(se)||"none"===getComputedStyle(t).pointerEvents)return!1})).length}show(t,e){this.tooltip.innerHTML=e??"",this.tooltip.classList.add(ae);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(ae),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=ce);const de="formeo",ue="3.0.0",he="formeo-sprite",pe=[{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"}],fe=`https://cdn.jsdelivr.net/npm/formeo@${ue}/dist/${he}.svg`,me=`https://draggable.github.io/formeo/assets/img/${he}.svg`,ge=`https://cdn.jsdelivr.net/npm/formeo@${ue}/dist/formeo.min.css`,ve="control-group",be=`${de}-stage`,ye=`${de}-row`,we=`${de}-column`,Ce=`${de}-field`,Ee="custom-column-widths",xe="column-preset",Se="resizing-columns",Oe=new Map([[be,ye],[ye,we],[we,Ce]]),Ne=["external","stages","rows","columns","fields"],Ae=["stage","row","column","field"].reduce(((t,e)=>({...t,[e]:e})),{}),_e=[{name:"controls",className:ve},{name:"stage",className:be},{name:"row",className:ye},{name:"column",className:we},{name:"field",className:Ce}],Te={controls:ve,stage:be,row:ye,column:we,field:Ce},je=Object.entries(Te).reduce(((t,[e,n])=>({...t,[n]:e})),{}),Pe=Object.values(Te),Le=new RegExp(`${Pe.join("|")}`,"g"),De=_e.map((({name:t},e,n)=>{const{name:o}=n[e+1]||{};return o&&[t,o]})).filter(Boolean),ke=De.slice().map((t=>t.slice().reverse())).reverse(),$e=new Map(De),Ie=new Map(ke.slice()),Re=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)),[])),Me=[{type:"added",condition:(t,e)=>Boolean(void 0===t&&e)}],Fe=`${de}-formData`,We=`${de}-locale`,Be=333,ze=Math.round(166.5),Ue=Math.round(666),qe="formeoSaved",He="formeoUpdated",Ge="formeoOnRender",Ve=["label","logical","source","thenTarget","sourceProperty","comparison","target","targetProperty","assignment","value"],Xe={value:"attrs.value",checked:"attrs.checked",isVisible:"config.isVisible",isNotVisible:"config.isNotVisible"},Ye={comparison:{equals:"==",notEquals:"!=",contains:"⊃",notContains:"!⊃"},assignment:{equals:"="},logical:{and:"&&",or:"||"},property:Xe},Ze=/(\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,Je=/\bcol-\w+-\d+/g,Ke="f-i-";var Qe=function(){this.__data__=[],this.size=0};var tn=function(t,e){return t===e||t!=t&&e!=e},en=tn;var nn=function(t,e){for(var n=t.length;n--;)if(en(t[n][0],e))return n;return-1},on=nn,rn=Array.prototype.splice;var sn=nn;var an=nn;var ln=nn;var cn=Qe,dn=function(t){var e=this.__data__,n=on(e,t);return!(n<0)&&(n==e.length-1?e.pop():rn.call(e,n,1),--this.size,!0)},un=function(t){var e=this.__data__,n=sn(e,t);return n<0?void 0:e[n][1]},hn=function(t){return an(this.__data__,t)>-1},pn=function(t,e){var n=this.__data__,o=ln(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this};function fn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e-1&&t%1==0&&t<=9007199254740991},xi=On,Si=Ei;var Oi=function(t){return null!=t&&Si(t.length)&&!xi(t)},Ni=Oi,Ai=T;var _i=function(t){return Ai(t)&&Ni(t)},Ti={exports:{}};var ji=function(){return!1};!function(t,e){var n=f,o=ji,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}(Ti,Ti.exports);var Pi=Ti.exports,Li=_,Di=ai,ki=T,$i=Function.prototype,Ii=Object.prototype,Ri=$i.toString,Mi=Ii.hasOwnProperty,Fi=Ri.call(Object);var Wi=function(t){if(!ki(t)||"[object Object]"!=Li(t))return!1;var e=Di(t);if(null===e)return!0;var n=Mi.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Ri.call(n)==Fi},Bi=_,zi=Ei,Ui=T,qi={};qi["[object Float32Array]"]=qi["[object Float64Array]"]=qi["[object Int8Array]"]=qi["[object Int16Array]"]=qi["[object Int32Array]"]=qi["[object Uint8Array]"]=qi["[object Uint8ClampedArray]"]=qi["[object Uint16Array]"]=qi["[object Uint32Array]"]=!0,qi["[object Arguments]"]=qi["[object Array]"]=qi["[object ArrayBuffer]"]=qi["[object Boolean]"]=qi["[object DataView]"]=qi["[object Date]"]=qi["[object Error]"]=qi["[object Function]"]=qi["[object Map]"]=qi["[object Number]"]=qi["[object Object]"]=qi["[object RegExp]"]=qi["[object Set]"]=qi["[object String]"]=qi["[object WeakMap]"]=!1;var Hi=function(t){return Ui(t)&&zi(t.length)&&!!qi[Bi(t)]};var Gi=function(t){return function(e){return t(e)}},Vi={exports:{}};!function(t,e){var n=u,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}(Vi,Vi.exports);var Xi=Vi.exports,Yi=Hi,Zi=Gi,Ji=Xi&&Xi.isTypedArray,Ki=Ji?Zi(Ji):Yi;var Qi=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},tr=Mo,er=tn,nr=Object.prototype.hasOwnProperty;var or=function(t,e,n){var o=t[e];nr.call(t,e)&&er(o,n)&&(void 0!==n||e in t)||tr(t,e,n)},ir=or,rr=Mo;var sr=function(t,e,n,o){var i=!n;n||(n={});for(var r=-1,s=e.length;++r-1&&t%1==0&&t0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(ns),rs=Zr,ss=Qr,as=is;var ls=tn,cs=Oi,ds=lr,us=Cn;var hs=function(t,e){return as(ss(t,e,rs),t+"")},ps=function(t,e,n){if(!us(n))return!1;var o=typeof e;return!!("number"==o?cs(n)&&ds(e,n.length):"string"==o&&e in n)&&ls(n[e],t)};var fs=Yr;const ms=l(function(t){return hs((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&&ps(n[0],n[1],s)&&(r=i<3?void 0:r,i=1),e=Object(e);++ocrypto.randomUUID(),vs=(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},bs=t=>{var e;const n=null==(e=t.className)?void 0:e.match(Le);return n&&je[n[0]]},ys=t=>Array.from(new Set(t)),ws=t=>{let e;if(t){const{attrs:n={}}=t;e=n.id||t.id||gs(),t.id=e}else e=gs();return e},Cs=(t,e)=>ms({},t,e,((t,e)=>Array.isArray(t)?null!=e?ys(t.concat(e)):e:Array.isArray(e)?null!=t?ys(e.concat(t)):e:void 0)),Es=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;nt/e*100,Ss=t=>`${t.toString()}%`,Os=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){}}}}),Ns=t=>Ne.some((e=>new RegExp(`^${e}.`).test(t))),As=t=>t.startsWith("external");function _s(t,e=Ue){let n=0;return function(...o){const i=Date.now();i-n>=e&&(n=i,t.apply(this,o))}}function Ts(t){return t}function js(){}var Ps=v,Ls=L,Ds=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ks=/^\w*$/;var $s=function(t,e){if(Ps(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!Ls(t))||(ks.test(t)||!Ds.test(t)||null!=e&&t in Object(e))},Is=xo;function Rs(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(Rs.Cache||Is),n}Rs.Cache=Is;var Ms=Rs;var Fs=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ws=/\\(\\)?/g,Bs=function(t){var e=Ms(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(Fs,(function(t,n,o,i){e.push(o?i.replace(Ws,"$1"):n||t)})),e})),zs=v,Us=$s,qs=Bs,Hs=W;var Gs=function(t,e){return zs(t)?t:Us(t,e)?[t]:qs(Hs(t))},Vs=L;var Xs=function(t){if("string"==typeof t||Vs(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e},Ys=or,Zs=Gs,Js=lr,Ks=Cn,Qs=Xs;var ta=function(t,e,n,o){if(!Ks(t))return t;for(var i=-1,r=(e=Zs(e,t)).length,s=r-1,a=t;null!=a&&++iNumber.isInteger(Number(t)),la=(t,e)=>{const n=e||t.parentElement;return Array.prototype.slice.call(n.childNodes).indexOf(t)},ca=(t,e,n)=>{const o=n.split("||"),i=ys(e).map((e=>t.find((t=>{const n=o.find((e=>!!ra(t,e)));return n&&ra(t,n)===e})))).filter(Boolean).concat(t);return ys(i)},da=(t,e,n)=>{for(let o=0;o{const n=[];return da(t,((t,o)=>n.push(e(t,o)))),n},ha={},pa=t=>t.replace(/\b\w/g,(t=>t.toUpperCase())),fa=()=>-1!==window.navigator.userAgent.indexOf("MSIE "),ma={capitalize:pa,safeAttrName:t=>{if(ha[t])return ha[t];const e=({className:"class"}[t]||t).replace(/^\d+/,"").replace(/[^a-zA-Z0-9-:]/g,"");return ha[t]=e,e},forEach:da,copyObj:t=>window.JSON.parse(window.JSON.stringify(t)),map:ua,subtract:(t,e)=>e.filter((e=>!~t.indexOf(e))),indexOfNode:la,isInt:aa,get:ra,orderObjectsBy:ca,isIE:fa},ga={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=ga.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{const o=ga.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"===ga.getStyle(t,"display"))=>{n?ga.slideDown(t,e):ga.slideUp(t,e)}},va="no-transition",ba={debug:!1,bubbles:!0,formeoLoaded:t=>{},onAdd:()=>{},onUpdate:t=>{var e;return(null==(e=wa.opts)?void 0:e.debug)&&void 0},onUpdateStage:t=>{var e;return(null==(e=wa.opts)?void 0:e.debug)&&void 0},onUpdateRow:t=>{var e;return(null==(e=wa.opts)?void 0:e.debug)&&void 0},onUpdateColumn:t=>{var e;return(null==(e=wa.opts)?void 0:e.debug)&&void 0},onUpdateField:t=>{var e;return(null==(e=wa.opts)?void 0:e.debug)&&void 0},onRender:t=>{var e;return(null==(e=wa.opts)?void 0:e.debug)&&void 0},onSave:t=>{},confirmClearAll:t=>{window.confirm(t.confirmationMessage)&&t.clearAllAction(t)}},ya=({src:t,...e},n=He)=>{var o,i;const r=new window.CustomEvent(n,{detail:e,bubbles:(null==(o=wa.opts)?void 0:o.debug)||(null==(i=wa.opts)?void 0:i.bubbles)});return r.data=(t||document).dispatchEvent(r),r},wa={init:function(t){return this.opts={...ba,...t},this},formeoSaved:t=>ya(t,qe),formeoUpdated:t=>ya(t,He),formeoCleared:t=>ya(t,"formeoCleared"),formeoOnRender:t=>ya(t,Ge),formeoConditionUpdated:t=>ya(t,"formeoConditionUpdated")},Ca=_s((()=>{wa.opts.onUpdate({timeStamp:window.performance.now(),type:He,detail:sh.formData})}),ze);let Ea;document.addEventListener(He,Ca),document.addEventListener("formeoUpdatedStage",(t=>{const{timeStamp:e,type:n,detail:o}=t;wa.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedRow",(t=>{const{timeStamp:e,type:n,detail:o}=t;wa.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedColumn",(t=>{const{timeStamp:e,type:n,detail:o}=t;wa.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedField",(t=>{const{timeStamp:e,type:n,detail:o}=t;wa.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener(Ge,(t=>{const{timeStamp:e,type:n,detail:o}=t;wa.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},wa.opts.confirmClearAll(t)})),document.addEventListener(qe,(({timeStamp:t,type:e,detail:{formData:n}})=>{const o={timeStamp:t,type:e,formData:n};wa.opts.onSave(o)})),document.addEventListener("formeoLoaded",(t=>{wa.opts.formeoLoaded(t.detail.formeo)})),window.addEventListener("resize",(function(){Ea=Ea||window.requestAnimationFrame((()=>{Ea=!1;for(const t of Object.values(eh.data))t.dom.classList.add(va),oh.dom.classList.add(va),oh.panels.nav.refresh(),t.refreshFieldPanels()}))}));var xa=xo,Sa=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Oa=function(t){return this.__data__.has(t)};function Na(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new xa;++ea))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 Aa:void 0;for(r.set(t,e),r.set(e,t);++uJSON.stringify(t,null,e))),e(this,"get",(t=>ra(this.data,t))),e(this,"getChangeType",((t,e)=>{const n=Me.find((({condition:n})=>n(t,e)))||{type:"unknown"};return n.desc="added"===n.type?`${t} to ${e}`:e,n})),e(this,"add",((t,e=Object.create(null))=>{const{id:n}=e,o=t||n||ws();return this.set(o,e)})),e(this,"remove",(t=>{const e=t.split("."),n=e.pop(),o=this.get(e);return Array.isArray(o)?o.splice(Number(n),1):delete o[n],o})),e(this,"getData",(()=>Object.entries(this.data).reduce(((t,[e,n])=>(t[e]=(null==n?void 0:n.data)?n.getData():n,t)),{}))),e(this,"setCallbacks",{}),e(this,"configVal",Object.create(null)),this.name=t,this.data=n,this.dataPath=""}get size(){return Object.keys(this.data).length}get js(){return this.data}get json(){return this.data}set(t,e){const n=ra(this.data,t);if(Wl(n,e))return this.data;const o=sa(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),wa.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)}}function zl(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 Ul(t){for(var e=1;e=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Xl(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var Yl=Xl(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Zl=Xl(/Edge/i),Jl=Xl(/firefox/i),Kl=Xl(/safari/i)&&!Xl(/chrome/i)&&!Xl(/android/i),Ql=Xl(/iP(ad|od|hone)/i),tc=Xl(/chrome/i)&&Xl(/android/i),ec={capture:!1,passive:!1};function nc(t,e,n){t.addEventListener(e,n,!Yl&&ec)}function oc(t,e,n){t.removeEventListener(e,n,!Yl&&ec)}function ic(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 rc(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function sc(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&ic(t,e):ic(t,e))||o&&t===n)return t;if(t===n)break}while(t=rc(t))}return null}var ac,lc=/\s+/g;function cc(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(lc," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(lc," ")}}function dc(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 uc(t,e){var n="";if("string"==typeof t)n=t;else do{var o=dc(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 hc(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i=fc(o)[n]))return o;if(o===pc())break;o=wc(o,!1)}return!1}function gc(t,e,n,o){for(var i=0,r=0,s=t.children;r2&&void 0!==arguments[2]?arguments[2]:{},o=n.evt,i=Vl(n,Pc);jc.pluginEvent.bind(Sd)(t,e,Ul({dragEl:kc,parentEl:$c,ghostEl:Ic,rootEl:Rc,nextEl:Mc,lastDownEl:Fc,cloneEl:Wc,cloneHidden:Bc,dragStarted:td,putSortable:Vc,activeSortable:Sd.active,originalEvent:o,oldIndex:zc,oldDraggableIndex:qc,newIndex:Uc,newDraggableIndex:Hc,hideGhostForTarget:wd,unhideGhostForTarget:Cd,cloneNowHidden:function(){Bc=!0},cloneNowShown:function(){Bc=!1},dispatchSortableEvent:function(t){Dc({sortable:e,name:t,originalEvent:o})}},i))};function Dc(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[Nc]){var m,g=e.options,v="on"+o.charAt(0).toUpperCase()+o.substr(1);!window.CustomEvent||Yl||Zl?(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=Ul(Ul({},f),jc.getEventProperties(o,e));for(var y in b)m[y]=b[y];n&&n.dispatchEvent(m),g[v]&&g[v].call(e,m)}}(Ul({putSortable:Vc,cloneEl:Wc,targetEl:kc,rootEl:Rc,oldIndex:zc,oldDraggableIndex:qc,newIndex:Uc,newDraggableIndex:Hc},t))}var kc,$c,Ic,Rc,Mc,Fc,Wc,Bc,zc,Uc,qc,Hc,Gc,Vc,Xc,Yc,Zc,Jc,Kc,Qc,td,ed,nd,od,id,rd=!1,sd=!1,ad=[],ld=!1,cd=!1,dd=[],ud=!1,hd=[],pd="undefined"!=typeof document,fd=Ql,md=Zl||Yl?"cssFloat":"float",gd=pd&&!tc&&!Ql&&"draggable"in document.createElement("div"),vd=function(){if(pd){if(Yl)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),bd=function(t,e){var n=dc(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=gc(t,0,e),r=gc(t,1,e),s=i&&dc(i),a=r&&dc(r),l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+fc(i).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+fc(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[md]||r&&"none"===n[md]&&l+c>o)?"vertical":"horizontal"},yd=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"==ql(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},wd=function(){!vd&&Ic&&dc(Ic,"display","none")},Cd=function(){!vd&&Ic&&dc(Ic,"display","")};pd&&!tc&&document.addEventListener("click",(function(t){if(sd)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),sd=!1,!1}),!0);var Ed=function(t){if(kc){t=t.touches?t.touches[0]:t;var e=(i=t.clientX,r=t.clientY,ad.some((function(t){var e=t[Nc].options.emptyInsertThreshold;if(e&&!vc(t)){var n=fc(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[Nc]._onDragOver(n)}}var i,r,s},xd=function(t){kc&&kc.parentNode[Nc]._isOutsideThisEl(t.target)};function Sd(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=Gl({},e),t[Nc]=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 bd(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!==Sd.supportPointer&&"PointerEvent"in window&&!Kl,emptyInsertThreshold:5};for(var o in jc.initializePlugins(this,t,n),n)!(o in e)&&(e[o]=n[o]);for(var i in yd(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&gd,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?nc(t,"pointerdown",this._onTapStart):(nc(t,"mousedown",this._onTapStart),nc(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(nc(t,"dragover",this),nc(t,"dragenter",this)),ad.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),Gl(this,Ac())}function Od(t,e,n,o,i,r,s,a){var l,c,d=t[Nc],u=d.options.onMove;return!window.CustomEvent||Yl||Zl?(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||fc(e),l.willInsertAfter=a,l.originalEvent=s,t.dispatchEvent(l),u&&(c=u.call(d,l,s)),c}function Nd(t){t.draggable=!1}function Ad(){ud=!1}function _d(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 Td(t){return setTimeout(t,0)}function jd(t){return clearTimeout(t)}Sd.prototype={constructor:Sd,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(ed=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,kc):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){hd.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&hd.push(o)}}(n),!kc&&!(/mousedown|pointerdown/.test(r)&&0!==t.button||o.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!Kl||!a||"SELECT"!==a.tagName.toUpperCase())&&!((a=sc(a,o.draggable,n,!1))&&a.animated||Fc===a)){if(zc=bc(a),qc=bc(a,o.draggable),"function"==typeof c){if(c.call(this,t,a,this))return Dc({sortable:e,rootEl:l,name:"filter",targetEl:a,toEl:n,fromEl:n}),Lc("filter",e,{evt:t}),void(i&&t.cancelable&&t.preventDefault())}else if(c&&(c=c.split(",").some((function(o){if(o=sc(l,o.trim(),n,!1))return Dc({sortable:e,rootEl:o,name:"filter",targetEl:a,fromEl:n,toEl:n}),Lc("filter",e,{evt:t}),!0}))))return void(i&&t.cancelable&&t.preventDefault());o.handle&&!sc(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&&!kc&&n.parentNode===r){var l=fc(n);if(Rc=r,$c=(kc=n).parentNode,Mc=kc.nextSibling,Fc=n,Gc=s.group,Sd.dragged=kc,Xc={target:kc,clientX:(e||t).clientX,clientY:(e||t).clientY},Kc=Xc.clientX-l.left,Qc=Xc.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,kc.style["will-change"]="all",o=function(){Lc("delayEnded",i,{evt:t}),Sd.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!Jl&&i.nativeDraggable&&(kc.draggable=!0),i._triggerDragStart(t,e),Dc({sortable:i,name:"choose",originalEvent:t}),cc(kc,s.chosenClass,!0))},s.ignore.split(",").forEach((function(t){hc(kc,t.trim(),Nd)})),nc(a,"dragover",Ed),nc(a,"mousemove",Ed),nc(a,"touchmove",Ed),nc(a,"mouseup",i._onDrop),nc(a,"touchend",i._onDrop),nc(a,"touchcancel",i._onDrop),Jl&&this.nativeDraggable&&(this.options.touchStartThreshold=4,kc.draggable=!0),Lc("delayStart",this,{evt:t}),!s.delay||s.delayOnTouchOnly&&!e||this.nativeDraggable&&(Zl||Yl))o();else{if(Sd.eventCanceled)return void this._onDrop();nc(a,"mouseup",i._disableDelayedDrag),nc(a,"touchend",i._disableDelayedDrag),nc(a,"touchcancel",i._disableDelayedDrag),nc(a,"mousemove",i._delayedDragTouchMoveHandler),nc(a,"touchmove",i._delayedDragTouchMoveHandler),s.supportPointer&&nc(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(){kc&&Nd(kc),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;oc(t,"mouseup",this._disableDelayedDrag),oc(t,"touchend",this._disableDelayedDrag),oc(t,"touchcancel",this._disableDelayedDrag),oc(t,"mousemove",this._delayedDragTouchMoveHandler),oc(t,"touchmove",this._delayedDragTouchMoveHandler),oc(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?nc(document,"pointermove",this._onTouchMove):nc(document,e?"touchmove":"mousemove",this._onTouchMove):(nc(kc,"dragend",this),nc(Rc,"dragstart",this._onDragStart));try{document.selection?Td((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(n){}},_dragStarted:function(t,e){if(rd=!1,Rc&&kc){Lc("dragStarted",this,{evt:e}),this.nativeDraggable&&nc(document,"dragover",xd);var n=this.options;!t&&cc(kc,n.dragClass,!1),cc(kc,n.ghostClass,!0),Sd.active=this,t&&this._appendGhost(),Dc({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(Yc){this._lastX=Yc.clientX,this._lastY=Yc.clientY,wd();for(var t=document.elementFromPoint(Yc.clientX,Yc.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Yc.clientX,Yc.clientY))!==e;)e=t;if(kc.parentNode[Nc]._isOutsideThisEl(t),e)do{if(e[Nc]){if(e[Nc]._onDragOver({clientX:Yc.clientX,clientY:Yc.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=rc(e));Cd()}},_onTouchMove:function(t){if(Xc){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=Ic&&uc(Ic,!0),s=Ic&&r&&r.a,a=Ic&&r&&r.d,l=fd&&id&&yc(id),c=(i.clientX-Xc.clientX+o.x)/(s||1)+(l?l[0]-dd[0]:0)/(s||1),d=(i.clientY-Xc.clientY+o.y)/(a||1)+(l?l[1]-dd[1]:0)/(a||1);if(!Sd.active&&!rd){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))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===kc)return P(!1);if(m&&r===t.target&&(s=m),s&&(n=fc(s)),!1!==Od(Rc,r,kc,e,s,n,t,!!s))return j(),m&&m.nextSibling?r.insertBefore(kc,m.nextSibling):r.appendChild(kc),$c=r,L(),P(!0)}else if(m&&function(t,e,n){var o=fc(gc(n.el,0,n.options,!0)),i=Oc(n.el,n.options,Ic),r=10;return e?t.clientXd+c*r/2:lu-od)return-nd}else if(l>d+c*(1-i)/2&&lu-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,cd,ed===s),0!==v){var O=bc(kc);do{O-=v,y=$c.children[O]}while(y&&("none"===dc(y,"display")||y===Ic))}if(0===v||y===s)return P(!1);ed=s,nd=v;var N=s.nextElementSibling,A=!1,_=Od(Rc,r,kc,e,s,n,t,A=1===v);if(!1!==_)return 1!==_&&-1!==_||(A=1===_),ud=!0,setTimeout(Ad,30),j(),A&&!N?r.appendChild(kc):s.parentNode.insertBefore(kc,A?N:s),x&&xc(x,0,S-x.scrollTop),$c=kc.parentNode,void 0===b||cd||(od=Math.abs(b-fc(s)[E])),L(),P(!0)}if(r.contains(kc))return P(!1)}return!1}function T(a,l){Lc(a,p,Ul({evt:t,isOwner:d,axis:i?"vertical":"horizontal",revert:o,dragRect:e,targetRect:n,canSort:u,fromSortable:h,target:s,completed:P,onMove:function(n,o){return Od(Rc,r,kc,e,n,fc(n),t,o)},changed:L},l))}function j(){T("dragOverAnimationCapture"),p.captureAnimationState(),p!==h&&h.captureAnimationState()}function P(e){return T("dragOverCompleted",{insertion:e}),e&&(d?c._hideClone():c._showClone(p),p!==h&&(cc(kc,Vc?Vc.options.ghostClass:c.options.ghostClass,!1),cc(kc,a.ghostClass,!0)),Vc!==p&&p!==Sd.active?Vc=p:p===Sd.active&&Vc&&(Vc=null),h===p&&(p._ignoreWhileAnimating=s),p.animateAll((function(){T("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(s===kc&&!kc.animated||s===r&&!s.animated)&&(ed=null),a.dragoverBubble||t.rootEl||s===document||(kc.parentNode[Nc]._isOutsideThisEl(t.target),!e&&Ed(t)),!a.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),f=!0}function L(){Uc=bc(kc),Hc=bc(kc,a.draggable),Dc({sortable:p,name:"change",toEl:r,newIndex:Uc,newDraggableIndex:Hc,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){oc(document,"mousemove",this._onTouchMove),oc(document,"touchmove",this._onTouchMove),oc(document,"pointermove",this._onTouchMove),oc(document,"dragover",Ed),oc(document,"mousemove",Ed),oc(document,"touchmove",Ed)},_offUpEvents:function(){var t=this.el.ownerDocument;oc(t,"mouseup",this._onDrop),oc(t,"touchend",this._onDrop),oc(t,"pointerup",this._onDrop),oc(t,"touchcancel",this._onDrop),oc(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;Uc=bc(kc),Hc=bc(kc,n.draggable),Lc("drop",this,{evt:t}),$c=kc&&kc.parentNode,Uc=bc(kc),Hc=bc(kc,n.draggable),Sd.eventCanceled||(rd=!1,cd=!1,ld=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),jd(this.cloneId),jd(this._dragStartId),this.nativeDraggable&&(oc(document,"drop",this),oc(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Kl&&dc(document.body,"user-select",""),dc(kc,"transform",""),t&&(td&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),Ic&&Ic.parentNode&&Ic.parentNode.removeChild(Ic),(Rc===$c||Vc&&"clone"!==Vc.lastPutMode)&&Wc&&Wc.parentNode&&Wc.parentNode.removeChild(Wc),kc&&(this.nativeDraggable&&oc(kc,"dragend",this),Nd(kc),kc.style["will-change"]="",td&&!rd&&cc(kc,Vc?Vc.options.ghostClass:this.options.ghostClass,!1),cc(kc,this.options.chosenClass,!1),Dc({sortable:this,name:"unchoose",toEl:$c,newIndex:null,newDraggableIndex:null,originalEvent:t}),Rc!==$c?(Uc>=0&&(Dc({rootEl:$c,name:"add",toEl:$c,fromEl:Rc,originalEvent:t}),Dc({sortable:this,name:"remove",toEl:$c,originalEvent:t}),Dc({rootEl:$c,name:"sort",toEl:$c,fromEl:Rc,originalEvent:t}),Dc({sortable:this,name:"sort",toEl:$c,originalEvent:t})),Vc&&Vc.save()):Uc!==zc&&Uc>=0&&(Dc({sortable:this,name:"update",toEl:$c,originalEvent:t}),Dc({sortable:this,name:"sort",toEl:$c,originalEvent:t})),Sd.active&&(null!=Uc&&-1!==Uc||(Uc=zc,Hc=qc),Dc({sortable:this,name:"end",toEl:$c,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){Lc("nulling",this),Rc=kc=$c=Ic=Mc=Wc=Fc=Bc=Xc=Yc=td=Uc=Hc=zc=qc=ed=nd=Vc=Gc=Sd.dragged=Sd.ghost=Sd.clone=Sd.active=null,hd.forEach((function(t){t.checked=!0})),hd.length=Zc=Jc=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":kc&&(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{const e=window.prompt(t.message.attr);if(e&&t.isDisabled(e))return window.alert(oe.get("attributeNotPermitted",e||"")),Gd.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:Ts}},Gd={init:function(t){const e=Object.keys(Hd);return this.opts=e.reduce(((e,n)=>(e[n]={...Hd[n],...t[n]},e)),t),this},add:{attrs:t=>Gd.opts.add.attr(t),options:t=>Gd.opts.add.option(t),conditions:t=>(t.template={if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]},Gd.opts.add.condition(t))},click:{btn:t=>Gd.opts.click.btn(t)},save:{form:t=>(Gd.opts.sessionStorage&&Os.set(Fe,t),wa.formeoSaved({formData:t}),Gd.opts.save.form(t))}},Vd=Object.freeze({type:"field",displayType:"slider"}),Xd=t=>({transform:`translateX(${t?`${t}px`:0})`});class Yd{constructor(t){e(this,"toggleTabbedLayout",(()=>{this.getPanelDisplay();const t=this.isTabbed;return this.panelsWrap.parentElement.classList.toggle("tabbed-panels",t),t&&this.panelNav.removeAttribute("style"),t})),e(this,"resizePanels",(()=>{this.toggleTabbedLayout();const t=this.panelsWrap.style,e=ch.getStyle(this.currentPanel,"height");return t.height=e,e})),this.opts=Cs(Vd,t),this.panelDisplay=this.opts.displayType,this.activePanelIndex=0,this.panelNav=this.createPanelNav();const n=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(n),window.clearTimeout(i)}),Ue)}getPanelDisplay(){const t=this.panelsWrap,e=Number.parseInt(ch.getStyle(t,"width"))>390?"tabbed":"slider",n="auto"===this.opts.displayType;return this.panelDisplay=n?e:this.opts.displayType||Vd.displayType,this.panelDisplay}createPanelsWrap(){const t=ch.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 ma.forEach(e,(t=>{t.fieldId=this.opts.id,t.isSortable&&Sd.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=la(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",ch.create(e)}createPanelNav(){this.labels=this.createPanelNavLabels();const t={tag:"button",attrs:{className:"next-group",title:oe.get("controlGroups.nextGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.nextGroup(t)},content:ch.icon("triangle-right")},e={tag:"button",attrs:{className:"prev-group",title:oe.get("controlGroups.prevGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.prevGroup(t)},content:ch.icon("triangle-left")};return ch.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=la(this.currentPanel,e);let r={nav:0,panel:0},s={...r};t.groupChange=t=>(this.activePanelIndex=t,this.currentPanel=i[t],ch.removeClasses(i,"active-panel"),ch.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=ze,animate:r=!this.isTabbed})=>{const a=[Xd(s.panel),Xd(t.panel)],l=[Xd(s.nav),Xd(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=ch.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 Zd="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`)),Jd=new RegExp(`(?!${Zd.join("|")})\\w\\S*`,"g"),Kd=/\s+/g;function Qd(t){if("string"!=typeof t)return t;if(t.trim().match(Kd))return t;return t.replace(Jd,(t=>t.charAt(0).toUpperCase()+t.substring(1).replace(/[A-Z]/g,(t=>` ${t}`))))}const tu=(t,e="-")=>t.toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,e),eu="f-autocomplete",nu="highlight-component";let ou,iu=Date.now();const ru=({name:t,id:e,...n})=>["config.label","attrs.id","meta.id"].reduce(((t,e)=>(t||(t=n.get(e)),t)),null)||"external"===t&&((...t)=>oe.get(t.join("."))||Qd(t.join(" ")))(t,e);class su{constructor(t,e,n){this.key=t,this.className=t.replace(/\./g,"-"),this.value=e,this.events=[],this.i18nKey=n,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=ch.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=ch.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}};return this.displayField=ch.create({tag:"input",autocomplete:"off",action:e,attrs:{type:"text",className:`${eu}-display-field`,value:this.label||this.value,placeholder:oe.get(`${this.i18nKey}.${this.key}.placeholder`)}}),this.hiddenField=ch.create({tag:"input",attrs:{type:"hidden",className:this.className,value:this.value}}),this.list=ch.create({tag:"ul",attrs:{className:`${eu}-list`}}),this.dom=ch.create({children:[this.displayField,this.hiddenField,this.list],className:this.className,action:{onRender:()=>{const t=this.value&&sh.getAddress(this.value);this.label=t&&ru(t),this.label&&(this.displayField.value=this.label),this.updateOptions()}}}),this.dom}updateOptions(){const t=Date.now();t-iu>Ue&&(ch.empty(this.list),this.generateOptions(),iu=t);const e=ou||this.generateOptions();for(const n of e)this.list.appendChild(n)}generateOptions(){const t=(t=>{const e=[],n=sh.flatList(),o=Object.entries(n).map((([n,o])=>{const i=ru(o);if(i){const r={tag:"span",content:` ${Qd(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=`${eu}-list-item`;return t.classList.contains(e)||(t=t.parentElement),t};return ou=t.map((t=>{const{value:n,textLabel:o,htmlLabel:i}=t,r={tag:"li",children:i,dataset:{value:n,label:o},className:`${eu}-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 ch.create(r)})),ou}hideList(t=this.list){ga.slideUp(t,ze),this.removeHighlight()}showList(t,e=this.list){this.selectOption(t),ga.slideDown(e,ze)}getActiveOption(t=this.list){const e=t.getElementsByClassName("active-option")[0];return e&&"none"!==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=sh.getAddress(t).dom)||n.classList.remove(nu)}}t&&(t.classList.add("active-option"),this.highlightComponent(t))}removeHighlight(){const t=document.getElementsByClassName(nu);for(const e of t)e.classList.remove(nu)}highlightComponent(t){var e;const{dataset:{value:n}}=t;if(n){null==(e=sh.getAddress(n).dom)||e.classList.add(nu)}}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 au=(t,e)=>{const n=(t=>{const e=As(t),n={"field.property":Xe,...Ye},o=e?(i=t,sh.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:oe.get(`${t}.${o}`)||o.toLowerCase(),attrs:{value:i}};e===i&&(r.attrs.selected=!0),n.push(ch.create(r))}return n}),[])},lu=(t,e)=>{ch.empty(t);for(const n of e)t.add(n)},cu=({key:t,value:e,type:n="text",checked:o})=>{const i={tag:"input",attrs:{type:n,value:e,placeholder:oe.get(`${t}.placeholder`)||Qd(t)},className:t.replace(/\./g,"-"),config:{}};return o&&(i.attrs.checked=!0),i},du=t=>{const e=oe.get(t);if(e)return e;const n=t.split(".");return oe.get(n[n.length-1])},uu={autocomplete:(t,e,n)=>new su(t,e,n),string:(t,e)=>cu({key:t,value:e}),boolean:(t,e)=>cu({key:t,value:e,type:"selected"===t?"radio":"checkbox",checked:e}),number:(t,e)=>cu({key:t,value:e,type:"number"}),array:(t,e=[])=>({tag:"select",attrs:{placeholder:du(`placeholder.${t}`)},className:t.replace(/\./g,"-"),options:e}),object:t=>Object.entries(t).map((([t,e])=>uu[ch.childType(e)](t,e)))},hu=["selected","checked"],pu={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 fu{constructor({key:t,data:n,index:o,field:i}){e(this,"generateConditionFields",((t,e)=>{const n={tag:"label",className:`condition-label ${t}-condition-label`,content:oe.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=ca(r,Ve.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(" ")}`}}))})),e(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)}),Be)},o=t=>{t=Array.isArray(t)?t:[t];const e=setTimeout((()=>{t.forEach((t=>{t.dom&&(t=t.dom),t.removeAttribute("style")})),clearTimeout(e)}),Be)},i=new Map([["condition-source",t=>{const i=e("condition-sourceProperty"),r=i[0],s=As(t.value)?t.value:"field.property",a=au(s,r.value);return lu(r,a),t.value?o(i):n(i)}],["condition-target",t=>{const i=e("condition-targetProperty");return Ns(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)}})),e(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=au(n||t,e),i=uu.array(`condition.${t}`);i.action={change:c,onRender:t=>c({target:t})};const r=ch.create(i);return lu(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,""),e.classList.add([t.className,t.value].filter(Boolean).join("-"));const o={dataPath:a,value:t.value,src:t};wa.formeoUpdated(o),sh.setAddress(a,t.value);const i=t.closest(".f-condition-row"),r=la(i);this.processConditionUIState(this.itemFieldGroups[r])},d={comparison:t=>l("comparison",t),logical:t=>l("logical",t),source:(t,e="source")=>{const o=uu.autocomplete(`condition.${e}`,t,n);return sh.setConditionMap(t,i),o.addEvent("onChange",(t=>{sh.removeConditionMap(sh.getAddress(a)),c(t),sh.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=uu.string("condition.value",t);return e.action={input:c},ch.create(e)},assignment:t=>l("assignment",t)};if(d[t])return d[t](e)})),this.itemValues=ca(Object.entries(n),hu,"0");const[r,s]=t.split(".");this.field=i,this.itemKey=t,this.itemIndex=o,this.panelName=r,this.isDisabled=i.isDisabledProp(s,r),this.isHidden=this.isDisabled&&i.config.panels[r].hideDisabled,this.isLocked=i.isLockedProp(s,r),this.dom=ch.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:()=>{ga.slideUp(this.dom,250,(t=>{this.field.remove(this.itemKey),ch.remove(t),this.field.resizePanelWrap()}))}},content:ch.icon("remove")};return{className:`${this.panelName}-prop-controls prop-controls`,content:[t]}}itemInput(t,e){const n=ch.childType(e)||"string",o={config:{},attrs:{},...uu[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&&(du(r)||Qd(r)),labelAfter:!1},o.attrs={...o.attrs,name:"checkbox"===o.attrs.type?`${a}[]`:a,id:s,disabled:this.isDisabled,locked:this.isLocked},o.action={...pu[n](i,this.field)},o}}class mu{constructor(t,n,o){e(this,"addAttribute",((t,e)=>{const n=tu(t),o=`attrs.${n}`;oe.current[o]||oe.put(o,pa(t)),"string"==typeof e&&["true","false"].includes(e)&&(e=JSON.parse(e)),this.field.set(`attrs.${t}`,e);const i=this.props.querySelector(`.field-attrs-${n}`),r=new fu({key:o,data:{[n]:e},field:this.field});i?this.props.replaceChild(r.dom,i):this.props.appendChild(r.dom),this.field.resizePanelWrap()})),e(this,"addOption",(()=>{const t=this.field.data.meta.id,e=this.field.get("options"),n="select"===t?"option":t,o=oe.get("newOptionLabel",{type:n})||"New Option",i=`options.${this.data.length}`,r=e[e.length-1],s={...e.length?r:{},label:o};"button"!==t&&(s.value=tu(o));const a=new fu({key:i,data:s,field:this.field,index:this.props.children.length});this.editPanelItems.push(a),this.props.appendChild(a.dom),this.field.set(i,s),this.field.resizePanelWrap()})),e(this,"addCondition",(t=>{const e=`conditions.${this.field.get("conditions").length}`,n=this.props.querySelector(`.field-${e.replace(".","-")}`),o=new fu({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=ch.childType(t),this.data="object"===this.type?Object.entries(t):t,this.name=n,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:oe.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 fu({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 ch.create(e)}createEditButtons(){const t=this,e=this.name,n=oe.get(`panelEditButtons.${e}`),o={attrs:t.addAttribute,options:t.addOption,conditions:t.addCondition};return{className:"panel-action-buttons",content:[{...ch.btnTemplate({content:n,title:n}),className:`add-${e}`,action:{click:n=>{const i={btnCoords:ch.coords(n.target),addAction:o[e]};"attrs"===e&&(i.isDisabled=t.field.isDisabledProp,i.isLocked=t.field.isLockedProp,i.message={attr:oe.get(`action.add.${e}.attr`),value:oe.get(`action.add.${e}.value`)});const r=Qd(e),s=new window.CustomEvent(`onAdd${r}`,{detail:i});Gd.add[e](i),document.dispatchEvent(s)}}}]}}}class gu extends Bl{constructor(t,n={},o){super(t,{...n,id:n.id||ws()}),e(this,"mutationHandler",(t=>t.map((t=>{})))),e(this,"remove",(t=>{if(t){const e=t.split("."),n=e.pop(),o=this.get(e);return Array.isArray(o)?aa(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 da(n,(t=>t.remove())),this.dom.parentElement.removeChild(this.dom),((t,e)=>{const n=t.indexOf(e);-1!==n&&t.splice(n,1)})(sh.getAddress(`${e.name}s.${e.id}.children`),this.id),e.children.length||e.emptyClass(),"row"===e.name&&e.autoColumnWidths(),sh[`${this.name}s`].delete(this.id)})),e(this,"emptyClass",(()=>this.dom.classList.toggle("empty",!this.children.length))),e(this,"getComponentTag",(()=>ch.create({tag:"span",className:["component-tag",`${this.name}-tag`],children:[(this.isColumn||this.isField)&&ch.icon("component-corner",{className:"bottom-left"}),ch.icon(`handle-${this.name}`),Qd(this.name),(this.isColumn||this.isRow)&&ch.icon("component-corner",{className:"bottom-right"})].filter(Boolean)}))),e(this,"removeClasses",(t=>{const e={string:()=>this.dom.classList.remove(t),array:()=>t.map((t=>this.dom.classList.remove(t)))};return e.object=e.string,e[ch.childType(t)](this.dom)})),e(this,"loadChildren",((t=this.data.children)=>t.map((t=>this.addChild({id:t}))))),e(this,"saveChildOrder",(()=>{if(this.render)return;const t=this.children.map((({id:t})=>t));return this.set("children",t),t})),e(this,"onSort",(()=>this.saveChildOrder())),e(this,"onEnd",(({to:{parentElement:t},from:{parentElement:e}})=>{null==t||t.classList.remove(`hovering-${bs(t)}`),null==e||e.classList.remove(`hovering-${bs(e)}`)})),e(this,"runConditions",(()=>{const t=this.get("conditions");if(!(null==t?void 0:t.length))return null;return t.map((t=>{const e=this.processConditions(t.if),n=this.processResults(t.then);return e.map((t=>this.evaluateConditions(t)&&this.execResults(n)))}))})),e(this,"value",((t,e)=>{const n=t.split("."),o=this.getComponent(t),i=o&&n.slice(2,n.length).join(".");return[!o,!i,!Xe[i]].some(Boolean)?t:e?o.set(Xe[i],e):o.get(Xe[i])})),e(this,"getResult",(t=>({"=":(t,e,n)=>t.set(e,n)}[t]))),e(this,"processResults",(t=>t.map((({operator:t,target:e,value:n})=>{const o=this.getComponent(e);return{target:o,propertyPath:o&&e.split(".").slice(2,e.length).join("."),action:this.getResult(t),value:this.value(n)}})))),e(this,"execResults",(t=>{const e=t.map((t=>this.execResult(t)));return Promise.all(e)})),e(this,"execResult",(({target:t,action:e,value:n,propertyPath:o})=>new Promise(((o,i)=>{try{return o(e(t,n))}catch(r){return i(r)}})))),e(this,"cloneData",(()=>{const t={...Es(this.data),id:ws()};return"field"!==this.name&&(t.children=[]),t})),e(this,"clone",((t=this.parent)=>{const e=t.addChild(this.cloneData(),this.index+1);return"field"!==this.name&&this.cloneChildren(e),e})),e(this,"createChildWrap",(t=>ch.create({tag:"ul",attrs:{className:"children"},children:t}))),this.id=this.data.id,this.name=t,this.config=sh[`${this.name}s`].config,Cs(this.config,n.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.data.children=this.data.children.filter((e=>-1===t.indexOf(e))),this.dom.classList.add("empty"),t}getActionButtons(){const t=[`hovering-${this.name}`,"hovering"];return{className:[`${this.name}-actions`,"group-actions"],action:{mouseenter:()=>{sh.stages.active.dom.classList.add(`active-hover-${this.name}`),this.dom.classList.add(...t)},mouseleave:({target:e})=>{this.dom.classList.remove(...t),sh.stages.active.dom.classList.remove(`active-hover-${this.name}`),e.removeAttribute("style")}},children:[{...ch.btnTemplate({content:ch.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`);ga.slideToggle(i,Be,t),"field"===this.name&&(ga.slideToggle(this.preview,Be,!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}`)=>({...ch.btnTemplate({content:ch.icon(t)}),className:["component-handle"]}),move:(t="move")=>({...ch.btnTemplate({content:ch.icon(t)}),className:["item-move"],meta:{id:"move"}}),edit:(t="edit")=>({...ch.btnTemplate({content:ch.icon(t)}),className:["item-edit-toggle"],meta:{id:"edit"},action:{click:t=>{this.toggleEdit()}}}),remove:(t="remove")=>({...ch.btnTemplate({content:ch.icon(t)}),className:["item-remove"],meta:{id:"remove"},action:{click:(t,e)=>{ga.slideUp(this.dom,Be,(()=>{if("column"===this.name){this.parent.autoColumnWidths(),this.remove()}else this.remove()}))}}}),clone:(t="copy")=>({...ch.btnTemplate({content:ch.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 la(this.dom)}get parentType(){return Ie.get(this.name)}get parent(){const t=this.parentType;if(!this.dom||!t)return null;const e=this.dom.closest(`.${Te[t]}`);return e&&ch.asComponent(e)}get children(){if(!this.dom)return[];const t=this.domChildren,e=$e.get(this.name);return ua(t,(t=>sh.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=ws()}=i,a=$e.get(this.name);if(!a)return null;const l=`${a}s`,c=sh.getAddress(`${l}.${s}`)||sh[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(ve)||(t=t.parentElement);const r=bs(t),s=bs(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=la(this.dom);return()=>this.parent.addChild(t,e+1)}],[2,t=>()=>this.parent.parent.addChild(t)]]),l={controls:()=>{const{controlData:t}=Ru.get(n.id),{meta:{id:e}}=t,i=e.startsWith("layout-")?e.replace(/^layout-/,""):"field",r=ra({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)();ch.remove(n);return s(t,o)},row:()=>{const t=(a.get({stage:-1,row:0,column:1}[s])||Ts)();return null==t?void 0:t({id:n.id},o)},column:()=>{const t=(a.get({stage:-2,row:-1}[s])||Ts)();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(we)&&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&&ch.onRender(this.dom,t.onRender)}set config(t){const e=ra(this.data,"meta.id"),n=[ra(t,"all"),e&&ra(t,e),ra(t,this.id)].reduce(((t,e)=>e?Cs(t,e):t),this.configVal);this.configVal=n}get config(){return this.configVal}getComponent(t){const[e,n]=t.split("."),o=sh[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===Ae.row}get isColumn(){return this.name===Ae.column}get isField(){return this.name===Ae.field}}class vu extends gu{constructor(t=Object.create(null)){super("field",{conditions:[{if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]}],...t}),e(this,"updateConditionsPanel",_s((()=>{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)}),Be)),e(this,"updatePreview",(()=>{if(!this.preview.parentElement)return null;this.updateLabel();const t=ch.create(this.fieldPreview(),!0);this.preview.parentElement.replaceChild(t,this.preview),this.preview=t})),e(this,"updateEditPanels",(()=>{this.editPanels=[];const t=["object","array"],e=ys([...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=ch.childType(e);if(t.includes(n)){const t=new mu(e,r,this);this.editPanels.push(t)}}const i={panels:this.editPanels.map((({panelConfig:t})=>t)),id:this.id,displayType:"auto"};this.panels=new Yd(i),this.dom&&(this.dom.querySelector(".panel-nav").replaceWith(this.panels.panelNav),this.dom.querySelector(".panels").replaceWith(this.panels.panelsWrap))})),e(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)})),e(this,"isDisabledProp",((t,e="attrs")=>{const n=this.config.panels[e];if(!n)return!1;return n.disabled.concat(this.get(`config.disabled${Qd(e)}`)).includes(t)})),e(this,"isLockedProp",((t,e="attrs")=>{const n=this.config.panels[e];if(!n)return!1;return n.locked.concat(this.get(`config.locked${Qd(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=ch.create(this.labelConfig),this.preview=ch.create({}),this.editPanels=[];const n=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:Ce},id:this.id,children:[this.label,this.getComponentTag(),n,o&&this.fieldEdit,this.preview].filter(Boolean),panelNav:this.panelNav,dataset:{hoverTag:oe.get("field")}};i=ch.create(i),this.observe(i),this.dom=i,this.isEditing=!1,this.onRender(i)}get labelConfig(){if(!!this.get("config.hideLabel"))return;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=sh.getConditionMap(`fields.${this.id}`);if(i)return i.updateConditionSourceLabel(`${this.name}s.${this.id}`,n?o:e)}}},e&&ch.requiredMark()]}}updateConditionSourceLabel(t,e){const n=this.editPanels.find((({name:t})=>"conditions"===t));if(!n)return null;for(const{itemFieldGroups:o}of n.editPanelItems)for(const n of o){const o=n.find((e=>e.value===t));o&&(o.displayField.value=e)}}set(...t){const[e,n]=t,o=super.set(e,n);return this.updatePreview(),o}updateLabel(){if(!this.label)return null;const t=ch.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",ch.remove(e)}else this.resizePanelWrap()}},ch.create(t)}get defaultPreviewActions(){return{change:t=>{const{target:e}=t,{type:n}=e;if(["checkbox","radio"].includes(n)){const t=+e.id.split("-").pop();this.toggleCheckedOptions(t,n),this.debouncedUpdateEditPanels()}},click:t=>{"true"===t.target.contentEditable&&t.preventDefault()},input:t=>{if(["input","meter","progress","button"].includes(t.target.tagName.toLowerCase()))return super.set("attrs.value",t.target.value),this.debouncedUpdateEditPanels();if(t.target.contentEditable){const e=t.target.parentElement.classList;if(e.contains("f-checkbox")||e.contains("f-radio")){const e=t.target.parentElement,n=e.parentElement,o=la(e,n);return super.set(`options[${o}].label`,t.target.innerHTML),this.debouncedUpdateEditPanels()}super.set("content",t.target.innerHTML)}}}}fieldPreview(){var t;const e=Es(this.data),{action:n={}}=Ru.get(e.meta.id);e.id=`prev-${this.id}`,e.action=n,(null==(t=this.data)?void 0:t.config.editableContent)&&(e.attrs={...e.attrs,contenteditable:!0});return{attrs:{className:"field-preview",style:this.isEditing&&"display: none;"},content:ch.create(e,!0),action:this.defaultPreviewActions}}}const bu={js:new Set,css:new Set},yu=(t,e,n=js)=>new Promise((o=>fetch(t).then((t=>{if(!t.ok)return o(n(t));o(e?e(t):t)})).catch((t=>n(t))))),wu=(t,e)=>{t.removeEventListener("load",wu),e(t.src)},Cu=(t,e)=>{t.removeEventListener("load",Cu),e(t.src)},Eu=t=>new Promise(((e,n)=>{if(bu.js.has(t))return e(t);bu.js.add(t);const o=ch.create({tag:"script",attrs:{type:"text/javascript",async:!0,src:t},action:{load:()=>Cu(o,e),error:()=>n(new Error(`${t} failed to load.`))}});document.head.appendChild(o)})),xu=t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>new Promise(((e,n)=>{if(bu.css.has(t))return e(t);bu.css.add(t);const o=ch.create({tag:"link",attrs:{rel:"stylesheet",href:t},action:{load:()=>wu(o,e),error:()=>n(new Error(`${(void 0).src} failed to load.`))}});document.head.appendChild(o)}))));return Promise.all(e)},Su=async(t=fe)=>{if(document.getElementById(he))return;const e=async t=>(t=>{let e=document.getElementById(he);return e||(e=ch.create({id:he,children:t,attrs:{hidden:!0,style:"display: none;"}}),document.body.insertBefore(e,document.body.childNodes[0])),e})(await t.text());return yu(t,e,(()=>yu(me,e)))},Ou={js:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>Eu(t)));return Promise.all(e)},css:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>xu(t)));return Promise.all(e)}},Nu=t=>{const e=Object.entries(t).map((([t,e])=>Ou[t](e)));return Promise.all(e)},Au=()=>{const t=document.getElementById(he);return"hidden"===window.getComputedStyle(t).visibility};class _u{constructor({events:t={},dependencies:n={},controlAction:o,...i}){e(this,"controlCache",new Set),this.events=t,this.controlData=i,this.controlAction=o,this.dependencies=n,this.id=i.id||ws()}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:ch.icon(t.icon)},n],action:{focus:({target:t})=>{const e=t.closest(`.${ve}`);return e&&Ru.panels.nav.refresh(la(e))},click:({target:t})=>{Ru.addElement(t.parentElement.id)}}};return ch.create({tag:"li",id:this.id,className:["field-control",`${t.group}-control`,`${t.id}-control`],content:o,meta:t,action:this.controlAction})}promise(){return Nu(this.dependencies)}i18n(t,e){var n,o;const i=oe.locale,r=null==(n=this.definition)?void 0:n.i18n,s=(null==r?void 0:r[i])||{};return((null==(o=s[t])?void 0:o.call(s))??s[t])||oe.get(t,e)}}const Tu=[{config:{label:"row"},meta:{group:"layout",icon:"rows",id:"layout-row"}},{config:{label:"column"},meta:{group:"layout",icon:"columns",id:"layout-column"}}];const ju=(t,e=3)=>Array.from({length:e},((t,e)=>e+1)).map((e=>{const n="checkbox"===t?"checked":"selected";return{label:oe.get("labelCount",{label:Qd(t),count:e}),value:`${t}-${e}`,[n]:!e}}));const Pu=[class extends _u{constructor(){super({tag:"button",attrs:{className:[{label:"grouped",value:"f-btn-group"},{label:"ungrouped",value:"f-field-group"}]},config:{label:oe.get("controls.form.button"),hideLabel:!0},meta:{group:"common",icon:"button",id:"button"},options:[{label:oe.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 _u{constructor(){super({tag:"input",attrs:{type:"date",required:!1,className:""},config:{label:oe.get("controls.form.input.date")},meta:{group:"common",icon:"calendar",id:"date-input"}})}},class extends _u{constructor(){super({tag:"input",attrs:{type:"hidden",value:""},config:{label:oe.get("hidden"),hideLabel:!0},meta:{group:"common",icon:"hidden",id:"hidden"}})}},class extends _u{constructor(){super({tag:"input",attrs:{type:"number",required:!1,className:""},config:{label:oe.get("number")},meta:{group:"common",icon:"hash",id:"number"}})}},class extends _u{constructor(){super({tag:"textarea",config:{label:oe.get("controls.form.textarea")},meta:{group:"common",icon:"textarea",id:"textarea"},attrs:{required:!1}})}},class extends _u{constructor(){super({tag:"input",attrs:{required:!1,type:"text",className:""},config:{label:oe.get("controls.form.input.text")},meta:{group:"common",icon:"text-input",id:"text-input"}})}},class extends _u{constructor(){super({tag:"input",attrs:{type:"file",required:!1},config:{label:oe.get("fileUpload")},meta:{group:"common",icon:"upload",id:"upload"}})}},class extends _u{constructor(){super({tag:"select",config:{label:oe.get("controls.form.select")},attrs:{required:!1,className:""},meta:{group:"common",icon:"select",id:"select"},options:ju("option")})}},class extends _u{constructor(){super({tag:"input",attrs:{type:"checkbox",required:!1},config:{label:oe.get("controls.form.checkbox-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"checkbox",id:"checkbox"},options:ju("checkbox",1)})}},class extends _u{constructor(){super({tag:"input",attrs:{type:"radio",required:!1},config:{label:oe.get("controls.form.radio-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"radio-group",id:"radio"},options:ju("radio")})}}],Lu=Array.from(Array(5).keys()).slice(1).map((t=>`h${t}`)),Du="controls.html.header";const ku=[class extends _u{constructor(){super({tag:Lu[0],attrs:{tag:Lu.map(((t,e)=>({label:t.toUpperCase(),value:t,selected:!e}))),className:""},config:{label:oe.get(Du),hideLabel:!0,editableContent:!0},meta:{group:"html",icon:"header",id:"html.header"},content:oe.get(Du),action:{}})}static get definition(){return{i18n:{"en-US":{header:"Custom English Header"}}}}get content(){return super.i18n(Du)}},class extends _u{constructor(){super({tag:"p",attrs:{className:""},config:{label:oe.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 _u{constructor(){super({tag:"hr",config:{label:oe.get("controls.html.divider"),hideLabel:!0},meta:{group:"html",icon:"divider",id:"divider"}})}},class extends _u{constructor(t){super(Cs({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))}}],$u=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"}}),Iu=[...Pu,...ku,...Tu];const Ru=new class{constructor(){e(this,"groupLabel",(t=>oe.get(t)||t||"")),e(this,"addElement",(t=>{const e=ra(this.get(t),"controlData"),{meta:{group:n,id:o}}=e,i={row:()=>Qu.active.addChild(),column:()=>i.row().addChild(),field:t=>i.column().addChild(t)};return"layout"!==n?i.field(e):i[o.replace("layout-","")]()})),e(this,"applyOptions",(async(t={})=>{const{container:e,elements:n,groupOrder:o,...i}=Cs($u,t);return this.container=e,this.groupOrder=ys(o.concat(["common","html","layout"])),this.options=i,Promise.all(this.registerControls([...Iu,...n]))})),this.data=new Map,this.buttonActions={focus:({target:t})=>{const e=t.closest(`.${ve}`);return e&&this.panels.nav.refresh(la(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 _u(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=ca(t,this.groupOrder,"id"),t=t.filter((t=>vs(t.id,this.options.disable.groups))),n=t.map((t=>{const n={tag:"ul",attrs:{className:ve,id:`${t.id}-${ve}`},config:{label:this.groupLabel(t.label)}};if(this.options.elementOrder[t.id]){const e=this.options.elementOrder[t.id],n=ys(e.concat(t.elementOrder));t.elementOrder=n}return e=ca(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=[vs(i,this.options.disable.elements),n.meta.group===t.id,!o.includes(n.meta.id)].every((t=>!0===t)),r&&o.push(i),r})),n})),n}add(t=Object.create(null)){const e=Es(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 Es(this.data.get(t))}formActions(){if(!0===this.options.disable.formActions)return null;const t={...ch.btnTemplate({content:[ch.icon("bin"),oe.get("clear")],title:oe.get("clearAll")}),className:["clear-form"],action:{click:t=>{th.size?(wa.confirmClearAll=new window.CustomEvent("confirmClearAll",{detail:{confirmationMessage:oe.get("confirmClearAll"),clearAllAction:()=>{Qu.clearAll().then((()=>{const e={src:t.target};wa.formeoCleared(e)}))},btnCoords:ch.coords(t.target)}}),document.dispatchEvent(wa.confirmClearAll)):window.alert(oe.get("cannotClearFields"))}}},e={...ch.btnTemplate({content:[ch.icon("floppy-disk"),oe.get("save")],title:oe.get("save")}),className:["save-form"],action:{click:({target:t})=>{const{formData:e}=sh,n={action:()=>{},coords:ch.coords(t),message:"",button:t};return Gd.click.btn(n),Gd.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 Yd({panels:e,type:"controls",displayType:o});const i=["control-groups","formeo-panels-wrap",`panel-count-${e.length}`],r=ch.create({className:i,content:[this.panels.panelNav,this.panels.panelsWrap]}),s=["formeo-controls"];t&&s.push("formeo-sticky");const a=ch.create({className:s,content:[r,n]}),l=a.getElementsByClassName("control-group");this.dom=a,this.groups=l;const[c]=l;this.currentGroup=c,this.actions={filter:t=>{const e=""!==t,n=this.controls;let o=r.querySelector(".filtered-term");if(ch.toggleElementsByStr(n,t),e){const e=oe.get("controls.filteringTerm",t);a.classList.add("filtered"),o?o.textContent=e:(o=ch.create({tag:"h5",className:"filtered-term",content:e}),r.insertBefore(o,r.firstChild))}else o&&(a.classList.remove("filtered"),o.remove())},addElement:this.addElement,addGroup:t=>{}};for(let d=l.length-1;d>=0;d--){const t=`formeo-controls-${l[d]}`;this.options.sortable||window.localStorage.removeItem(t),Sd.create(l[d],{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 vu(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 a}};class Mu extends Bl{constructor(){super(...arguments),e(this,"load",((t=Object.create(null))=>(this.empty(),"string"==typeof t&&(t=JSON.parse(t)),Object.entries(t).forEach((([t,e])=>this.add(t,e))),this.data))),e(this,"get",(t=>t?ra(this.data,t):this.add())),e(this,"add",((t,e=Object.create(null))=>{const n=t||ws(),o=this.Component({...e,id:n});return this.set(n,o),this.active=o,o})),e(this,"remove",(t=>(Array.isArray(t)?t.forEach((t=>{this.get(t).remove()})):this.get(t).remove(),this.data))),e(this,"delete",(t=>(delete this.data[t],t))),e(this,"clearAll",((t=!0)=>{const e=Object.values(this.data).map((e=>e.empty(t)));return Promise.all(e)})),e(this,"conditionMap",new Map)}set config(t){this.configVal=Cs(this.configVal,Es(t))}get config(){return this.configVal}}class Fu extends gu{constructor(t,e){super("stage",{...Object.freeze({children:[]}),...t},e);const n=this.createChildWrap();this.dom=ch.create({attrs:{className:[be,"empty"],id:this.id},children:n}),Sd.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:()=>{Wu.active=this},onSort:this.onSort.bind(this),draggable:`.${ye}`,handle:".item-move"})}empty(t=!0){return new Promise((e=>{t?(this.dom.classList.add("removing-all-fields"),ga.slideUp(this.dom,Be,(()=>{e(super.empty(t)),this.dom.classList.remove("removing-all-fields"),ga.slideDown(this.dom,Be)}))):e(super.empty())}))}onAdd(...t){const e=super.onAdd(...t);e&&"column"===e.name&&e.parent.autoColumnWidths()}}const Wu=new class extends Mu{constructor(t){super("stages",t)}Component(t){return new Fu(t)}};class Bu extends gu{constructor(t){super("row",{...Object.freeze({config:{fieldset:!1,legend:"",inputGroup:!1},children:[],className:[ye]}),...t}),e(this,"autoColumnWidths",(()=>{const t=this.children;if(!t.length)return;const e=Number.parseFloat((100/t.length).toFixed(1))/1;for(const n of t){n.removeClasses(Je);const t=n.dom,o=Ss(e);n.set("config.width",o),t.style.width=o,t.dataset.colWidth=o;const i=setTimeout((()=>{clearTimeout(i),n.refreshFieldPanels()}),ze);document.dispatchEvent(wa.columnResized)}this.updateColumnPreset()})),e(this,"updateColumnPreset",(()=>{this.columnPresetControl.innerHTML="";const t=this.getColumnPresetOptions.map((({label:t,...e})=>ch.create({tag:"option",content:t,attrs:e})));this.columnPresetControl.append(...t)})),e(this,"setColumnWidths",(t=>{"string"==typeof t&&(t=t.split(",")),this.children.forEach(((e,n)=>{e.setWidth(`${t[n]}%`),e.refreshFieldPanels()}))}));const n=this.createChildWrap();this.dom=ch.create({tag:"li",className:[ye,"empty"],dataset:{hoverTag:oe.get("row"),editingHoverTag:oe.get("editing.row")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),this.editWindow,n]}),Sd.create(n,{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:`.${we}`,handle:".item-move"})}get editWindow(){const t={tag:"input",id:`${this.id}-fieldset`,attrs:{type:"checkbox",checked:this.get("config.fieldset"),ariaLabel:oe.get("row.settings.fieldsetWrap.aria")},action:{click:({target:{checked:t}})=>{this.set("config.fieldset",Boolean(t))}},config:{label:oe.get("row.settings.fieldsetWrap")}},e={tag:"input",id:`${this.id}-inputGroup`,attrs:{type:"checkbox",checked:this.get("config.inputGroup"),ariaLabel:oe.get("row.settings.inputGroup.aria")},action:{click:({target:{checked:t}})=>this.set("config.inputGroup",t)},config:{label:oe.get("row.makeInputGroup"),description:oe.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=ch.formGroup([t,n]),i={tag:"label",content:oe.get("defineColumnWidths"),className:"col-sm-4 form-control-label"};this.columnPresetControl=ch.create(this.columnPresetControlConfig);const r={className:"col-sm-8",content:this.columnPresetControl,action:{onRender:()=>{this.updateColumnPreset()}}},s=[e,"hr",o,"hr",ch.formGroup([i,r],"row")];return ch.create({className:`${this.name}-edit group-config`,action:{onRender:t=>{const e=s.map((t=>ch.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=Re.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:Ee}),t.map((t=>{const e={...t};return e.selected=t.value===n,e}))}return[]}get columnPresetControlConfig(){return{tag:"select",attrs:{ariaLabel:oe.get("defineColumnLayout"),className:xe},action:{change:({target:t})=>{const{value:e}=t;this.setColumnWidths(e)}},options:this.getColumnPresetOptions}}}const zu={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]}};const Uu=new class extends Mu{constructor(t){super("rows",t),this.config={all:zu}}Component(t){return new Bu(t)}};class qu{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=ch.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(`.${ye}`);if(this.validateResizeTarget(e,n))if(this.startX="touchstart"===t.type?t.touches[0].clientX:t.clientX,o.classList.add(Se),this.columnPreset=o.querySelector(`.${xe}`),this.originalColumnClass=e.className,this.originalSiblingClass=n.className,e.className=e.className.replace(Je,""),n.className=n.className.replace(Je,""),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(xs(e,this.rowWidth)),i=parseFloat(xs(n,this.rowWidth));return o<10||i<10?null:{colWidth:Ss(o.toFixed(1)),siblingColWidth:Ss(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(),sh.setAddress(`columns.${t.id}.config.width`,t.dataset.colWidth),sh.setAddress(`columns.${e.id}.config.width`,e.dataset.colWidth),this.row.classList.remove(Se),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(Se),window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onStop)}setCustomWidthValue(){const t=this.columnPreset;let e=t.querySelector(`.${Ee}`);const n=this.row.querySelector(".children").children,o=ua(n,(t=>xs(t.clientWidth,this.rowWidth).toFixed(1))),i=o.join(","),r=o.join(" | ");return e||(e=ch.create({tag:"option",attrs:{className:Ee,value:i,selected:!0},content:r}),t.append(e)),e.value=i,e.textContent=r,i}}const Hu=t=>({className:"resize-x-handle",action:{pointerdown:t.onStart.bind(t)},content:[ch.icon("triangle-down"),ch.icon("triangle-up")]}),Gu=()=>({className:"column-edit group-config"});class Vu extends gu{constructor(t){super("column",{...Object.freeze({config:{width:"100%"},children:[],className:[we]}),...t}),e(this,"refreshFieldPanels",(()=>{for(const t of this.children)t.panels.nav.refresh()})),e(this,"setDomWidth",(t=>{this.dom.dataset.colWidth=t,this.dom.style.width=t})),e(this,"setWidth",(t=>(this.setDomWidth(t),this.set("config.width",t))));const n=this.createChildWrap();this.dom=ch.create({tag:"li",className:[we,"empty"],dataset:{hoverTag:oe.get("column")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),Gu(),Hu(new qu),n]}),this.processConfig(),wa.columnResized=new window.CustomEvent("columnResized",{detail:{column:this.dom,instance:this}}),Sd.create(n,{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:`.${Ce}`,handle:".item-move"})}processConfig(){const t=ma.get(this.data,"config.width");t&&this.setDomWidth(t)}}const Xu={actionButtons:{buttons:["clone","move","remove"],disabled:[]}};const Yu=new class extends Mu{constructor(t){super("columns",t),this.config={all:Xu}}Component(t){return new Vu(t)}},Zu={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]},panels:{disabled:[],attrs:{disabled:["type"],hideDisabled:!0,locked:[]},order:["attrs","options","conditions"]},label:{disableHTML:!1}};const Ju=new class extends Mu{constructor(t){super("fields",t),e(this,"get",(t=>{let e=t&&ra(this.data,t);if(!e){const n=Ru.get(t);n&&(e=this.add(null,n.controlData))}return e})),e(this,"getData",(()=>Object.entries(this.data).reduce(((t,[e,n])=>{const{conditions:o,...i}=(null==n?void 0:n.getData())||n;if(null==o?void 0:o.length){let t=!0;if(1===o.length){const[e]=o;t=Boolean(e.if[0].source&&e.then[0].target)}t&&(i.conditions=o)}return t[e]=i,t}),{}))),this.config={all:Zu}}Component(t){return new vu(t)}};const Ku=new class extends Mu{constructor(t){super("externals",t)}Component(t){return new gu("external",t)}},Qu=Wu,th=Uu,eh=Yu,nh=Ju,oh=Ru,ih=Ku,rh={id:ws()};const sh=new class extends Bl{constructor(t){super("components"),e(this,"sessionFormData",(()=>{var t;if(null==(t=this.opts)?void 0:t.sessionStorage)return Os.get(Fe)})),e(this,"load",((t,e=this.opts||Object.create(null))=>{let n=t;this.empty(),"string"==typeof t&&(n=JSON.parse(t)),this.opts=e;const{stages:o={[ws()]:{}},rows:i,columns:r,fields:s,id:a=ws()}={...this.sessionFormData(),...n};this.set("id",a),this.add("stages",Qu.load(o)),this.add("rows",th.load(i)),this.add("columns",eh.load(r)),this.add("fields",nh.load(s)),this.add("externals",ih.load(e.external));for(const l of Object.values(this.get("stages")))l.loadChildren();return this.data})),this.opts=t,this.data=rh,this.disableEvents=!0,this.stages=Qu,this.rows=th,this.columns=eh,this.fields=nh,this.controls=oh,this.externals=ih}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@${ue}/dist/formData_schema.json`,...this.formData})}get formData(){return{id:this.get("id"),stages:Wu.getData(),rows:Uu.getData(),columns:Yu.getData(),fields:Ju.getData()}}set config(t){const{stages:e,rows:n,columns:o,fields:i}=t;Qu.config=e,th.config=n,eh.config=o,nh.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(!Ns(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(Ns(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.get(e[1])}}setConditionMap(t,e){if(Ns(t)){const n=t.split(".");return n.every((t=>Boolean(t)))&&this[n[0]].conditionMap.set(n[1],e)}}removeConditionMap(t){if(Ns(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.delete(e[1])}}},ah={glyphicons:t=>``,"font-awesome":t=>{const[e,n]=t.split(" ");return``},fontello:t=>`${t}`},lh=new Set(["input","textarea","select"]);const ch=new class{constructor(t=Object.create(null)){e(this,"render",(t=>(t.id=`f-${t.id||ws()}`,this.create(t)))),e(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:[ma.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=Cs(a.attrs,{className:i})),r){const t=this.processOptions(r,a,e);if(!this.holdsContent(h)||"button"===c)return ma.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(ma.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=ma.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})),e(this,"onRender",((t,e)=>{t.parentElement?e(t):window.requestAnimationFrame((()=>this.onRender(t,e)))})),e(this,"toggleElementsByStr",((t,e)=>{const n=[];return ch.elementsContainText(t,e,((t,e)=>{e?(t.style.display="block",n.push(t)):t.style.display="none"})),n})),e(this,"elementsContainText",((t,e,n)=>{const o=[];return da(t,(t=>{const i=-1!==t.textContent.toLowerCase().indexOf(e.toLowerCase());null==n||n(t,i),i&&o.push(t)})),o})),e(this,"generateOption",(({type:t="option",label:e,value:n,i:o=0,selected:i})=>({tag:"option"===t?"option":"input",attrs:{type:t,value:n||`${t}-${o}`,["option"===t?"selected":"checked"]:i||!o},config:{label:e||oe.get("labelCount",{label:oe.get("option"),count:o})}}))),e(this,"requiredMark",(()=>({tag:"span",className:"text-error",children:"*"}))),e(this,"removeEmpty",(t=>{const e=t.parentElement,n=bs(t),o=e.getElementsByClassName(`formeo-${n}`);if(this.remove(t),!o.length)return this.isStage(e)?this.emptyClass(e):this.removeEmpty(e)})),e(this,"btnTemplate",(({title:t="",...e})=>({tag:"button",attrs:{type:"button",title:t},...e}))),e(this,"isControls",(t=>bs(t)===ve)),e(this,"isStage",(t=>bs(t)===be)),e(this,"isRow",(t=>bs(t)===ye)),e(this,"isColumn",(t=>bs(t)===we)),e(this,"isField",(t=>bs(t)===Ce)),e(this,"asComponent",(t=>sh[`${bs(t)}s`].get(t.id))),this.options=t}set setOptions(t){this.options=Cs(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:ch.onRender,render:ch.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(`#${he} svg symbol`);return this.iconSymbols=Array.from(t).reduce(((t,e)=>{var n;return t[e.id.replace(Ke,"")]={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=Cs(r,e);return this.cachedIcons[i]=ch.create(t).outerHTML,this.cachedIcons[i]}return this.cachedIcons[i]=ch.create(r).outerHTML,this.cachedIcons[i]}return(null==(o=ah[ch.options.iconFont])?void 0:o.call(ah,t))||t}processAttrs(t,e,n){const{attrs:o={}}=t;n||o.name||!this.isInput(t.tag)||e.setAttribute("name",ws(t));for(const i of Object.keys(o)){const t=ma.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||ws(),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),lh.has(e)}parsedHtml(t){const e=document.createElement("textarea");return e.innerHTML=t,e.textContent}labelAfter(t){const e=ma.get(t,"attrs.type"),n=ma.get(t,"config.labelAfter");return void 0!==n?n:"checkbox"===e||"radio"===e}label(t,e){const n=ma.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=bs(t);return e?sh.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,ma.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)}};ma.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");ga.slideUp(t,600,(()=>{ch.empty(t),t.classList.remove("removing-all-fields"),ch.emptyClass(t),ga.slideDown(t,300)}))}toggleSortable(t,e){let n=e;const o=bs(t);if(!o)return;const i=bs(t.parentElement),r=ch[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(Oe.get(t.classList.item(0)));t.classList.toggle("empty",!e.length)}};const dh={"en-US":"English",dir:"ltr","af-ZA":"Afrikaans (South Africa)","ar-TN":"Arabic (Tunisia)","cs-CZ":"Czech (Czechia)","de-DE":"German (Germany)","es-ES":"European Spanish","fa-IR":"Persian (Iran)","fi-FI":"Finnish (Finland)","fr-FR":"French (France)","hu-HU":"Hungarian (Hungary)","it-IT":"Italian (Italy)","ja-JP":"Japanese (Japan)","nb-NO":"Norwegian Bokmål (Norway)","pl-PL":"Polish (Poland)","pt-BR":"Brazilian Portuguese","pt-PT":"European Portuguese","ro-RO":"Romanian (Romania)","ru-RU":"Russian (Russia)","th-TH":"Thai (Thailand)","tr-TR":"Turkish (Türkiye)","zh-CN":"Chinese (China)","zh-HK":"Chinese (Hong Kong SAR China)","action.add.attrs.attr":"What attribute would you like to add?","action.add.attrs.value":"Default Value",addOption:"Add Option",allFieldsRemoved:"All fields were removed.",allowSelect:"Allow Select",and:"and",attribute:"Attribute",attributeNotPermitted:'Attribute "{attribute}" is not permitted, please choose another.',attributes:"Attributes","attrs.class":"Class","attrs.className":"Class","attrs.dir":"Direction","attrs.id":"Id","attrs.required":"Required","attrs.style":"Style","attrs.title":"Title","attrs.type":"Type","attrs.value":"Value",autocomplete:"Autocomplete",button:"Button",cannotBeEmpty:"This field cannot be empty",cannotClearFields:"There are no fields to clear",checkbox:"Checkbox",checkboxes:"Checkboxes",class:"Class",clear:"Clear",clearAllMessage:"Are you sure you want to clear all fields?",close:"Close",column:"Column","condition.target.placeholder":"target","condition.value.placeholder":"value",confirmClearAll:"Are you sure you want to remove all fields?",content:"Content",control:"Control","controlGroups.nextGroup":"Next Group","controlGroups.prevGroup":"Previous Group","controls.filteringTerm":'Filtering "{term}"',"controls.form.button":"Button","controls.form.checkbox-group":"Checkbox Group","controls.form.input.date":"Date","controls.form.input.email":"Email","controls.form.input.file":"File Upload","controls.form.input.hidden":"Hidden Input","controls.form.input.number":"Number","controls.form.input.text":"Text Input","controls.form.radio-group":"Radio Group","controls.form.select":"Select","controls.form.textarea":"TextArea","controls.groups.form":"Form Fields","controls.groups.html":"HTML Elements","controls.groups.layout":"Layout","controls.html.divider":"Divider","controls.html.header":"Header","controls.html.paragraph":"Paragraph","controls.layout.column":"Column","controls.layout.row":"Row",copy:"Copy To Clipboard",danger:"Danger",defineColumnLayout:"Define a column layout",defineColumnWidths:"Define column widths",description:"Help Text",descriptionField:"Description","editing.row":"Editing Row",editorTitle:"Form Elements",field:"Field","field.property.invalid":"not valid","field.property.isNotVisible":"is not visible","field.property.isVisible":"is visible","field.property.label":"label","field.property.valid":"valid","field.property.value":"value",fieldNonEditable:"This field cannot be edited.",fieldRemoveWarning:"Are you sure you want to remove this field?",fileUpload:"File Upload",formUpdated:"Form Updated",getStarted:"Drag a field from the right to get started.",group:"Group",grouped:"Grouped",hidden:"Hidden Input",hide:"Edit",htmlElements:"HTML Elements",if:"If","if.condition.source.placeholder":"source","if.condition.target.placeholder":"target / value",info:"Info","input.date":"Date","input.text":"Text",label:"Label",labelCount:"{label} {count}",labelEmpty:"Field Label cannot be empty","lang.af":"Afrikaans","lang.ar":"Arabic","lang.cs":"Czech","lang.de":"German","lang.en":"English","lang.es":"Spanish","lang.fa":"Persian","lang.fi":"Finnish","lang.fr":"French","lang.hu":"Hungarian","lang.it":"Italian","lang.ja":"Japanese","lang.nb":"Norwegian Bokmål","lang.pl":"Polish","lang.pt":"Portuguese","lang.ro":"Romanian","lang.ru":"Russian","lang.th":"Thai","lang.tr":"Turkish","lang.zh":"Chinese",layout:"Layout",limitRole:"Limit access to one or more of the following roles:",mandatory:"Mandatory",maxlength:"Max Length","meta.group":"Group","meta.icon":"Ico","meta.label":"Label",minOptionMessage:"This field requires a minimum of 2 options",name:"Name",newOptionLabel:"New {type}",no:"No",number:"Number",off:"Off",on:"On","operator.contains":"contains","operator.equals":"equals","operator.notContains":"not contains","operator.notEquals":"not equal","operator.notVisible":"not visible","operator.visible":"visible",option:"Option",optional:"optional",optionEmpty:"Option value required",optionLabel:"Option {count}",options:"Options",or:"or",order:"Order","panel.label.attrs":"Attributes","panel.label.conditions":"Conditions","panel.label.config":"Configuration","panel.label.meta":"Meta","panel.label.options":"Options","panelEditButtons.attrs":"+ Attribute","panelEditButtons.conditions":"+ Condition","panelEditButtons.options":"+ Option",placeholder:"Placeholder","placeholder.className":"space separated classes","placeholder.email":"Enter you email","placeholder.label":"Label","placeholder.password":"Enter your password","placeholder.placeholder":"Placeholder","placeholder.text":"Enter some Text","placeholder.textarea":"Enter a lot of text","placeholder.value":"Value",preview:"Preview",primary:"Primary",remove:"Remove",removeMessage:"Remove Element",removeType:"Remove {type}",required:"Required",reset:"Reset",richText:"Rich Text Editor",roles:"Access",row:"Row","row.makeInputGroup":"Make this row an input group.","row.makeInputGroupDesc":"Input Groups enable users to add sets of inputs at a time.","row.settings.fieldsetWrap":"Wrap row in a <fieldset> tag","row.settings.fieldsetWrap.aria":"Wrap Row in Fieldset",save:"Save",secondary:"Secondary",select:"Select",selectColor:"Select Color",selectionsMessage:"Allow Multiple Selections",selectOptions:"Options",separator:"Separator",settings:"Settings",size:"Size",sizes:"Sizes","sizes.lg":"Large","sizes.m":"Default","sizes.sm":"Small","sizes.xs":"Extra Small",style:"Style",styles:"Styles","styles.btn":"Button Style","styles.btn.danger":"Danger","styles.btn.default":"Default","styles.btn.info":"Info","styles.btn.primary":"Primary","styles.btn.success":"Success","styles.btn.warning":"Warning",subtype:"Type",success:"Success",text:"Text Field",then:"Then","then.condition.target.placeholder":"target",toggle:"Toggle",ungrouped:"Un-Grouped",warning:"Warning",yes:"Yes"};oe.addLanguage("en-US",dh);const uh={get editor(){return{stickyControls:!1,allowEdit:!0,dataType:"json",debug:!1,sessionStorage:!1,editorContainer:null,external:{},svgSprite:fe,style:ge,iconFont:null,config:{},events:{},actions:{},controls:{},polyfills:fa(),i18n:{location:"https://draggable.github.io/formeo/assets/lang/"}}}};let hh=class{constructor({formData:t,...e},n){const o=Cs(uh.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,ch.setOptions=c,sh.config=a,this.userFormData=n||t,this.Components=sh,this.dom=ch,wa.init({debug:s,...r}),Gd.init({debug:s,sessionStorage:c.sessionStorage,...i}),this.tooltip=new ce,document.addEventListener("DOMContentLoaded",this.loadResources.bind(this))}get formData(){return this.Components.formData}set formData(t={}){this.load({...this.userFormData,...t},this.opts)}get json(){return this.Components.json}async loadResources(){var t;document.removeEventListener("DOMContentLoaded",this.loadResources);const e=[];this.opts.polyfills&&(t=>{const e=Array.isArray(t)?pe.filter((({name:e})=>-1!==t.indexOf(e))):pe;Promise.all(e.map((({src:t})=>Eu(t))))})(this.opts.polyfills),await Su(this.opts.svgSprite),e.push((async t=>{if(!Au()&&(await xu(t),!Au()))return await xu("https://draggable.github.io/formeo/assets/css/formeo.min.css")})(this.opts.style)),e.push(oe.init({...this.opts.i18n,locale:null==(t=window.sessionStorage)?void 0:t.getItem(We)}));const n=await Promise.all(e);return this.opts.allowEdit&&this.init(),n}init(){Ru.init(this.opts.controls,this.opts.stickyControls).then((t=>{this.controls=t,this.load(this.userFormData,this.opts),this.formId=sh.get("id"),this.i18n={setLang:t=>{var e;null==(e=window.sessionStorage)||e.setItem(We,t);oe.setCurrent(t).then((()=>{this.init()}),console.error)}},this.render()}))}load(t=this.userFormData,e=this.opts){return this.Components.load(t,e)}render(){if(!this.controls)return window.requestAnimationFrame((()=>this.render()));if(this.stages=Object.values(sh.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))]};oe.current.dir&&(t.attrs.dir=oe.current.dir,ch.dir=oe.current.dir),this.editor=ch.create(t);(this.controls.container||this.editor).appendChild(this.controls.dom),this.editorContainer&&(ch.empty(this.editorContainer),this.editorContainer.appendChild(this.editor)),wa.formeoLoaded=new window.CustomEvent("formeoLoaded",{detail:{formeo:this}}),document.dispatchEvent(wa.formeoLoaded)}};const ph=t=>{const e=t.match(Ze);return(null==e?void 0:e[0])||t},fh=t=>t.replace(Ze,ws());let mh=class{constructor(t,n={}){e(this,"render",((t=this.form)=>{this.form=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=ch.render(n),this.applyConditions();const o=this.container.querySelector(".formeo-render");o?o.replaceWith(this.renderedForm):this.container.appendChild(this.renderedForm)})),e(this,"orderChildren",((t,e)=>e.reduce(((e,n)=>(e.push(this.form[t][n]),e)),[]))),e(this,"prefixId",(t=>"f-"+t)),e(this,"processColumn",(({id:t,...e})=>({...e,id:this.prefixId(t),children:this.processFields(e.children),style:`width: ${e.config.width||"100%"}`}))),e(this,"processRows",(t=>this.orderChildren("rows",this.form.stages[t].children).reduce(((t,e)=>(e&&t.push(this.processRow(e)),t)),[]))),e(this,"cacheComponent",(t=>(this.components[ph(t.id)]=t,t))),e(this,"processRow",((t,e="row")=>{const{config:n,id:o}=t,i=[`formeo-${e}-wrap`],r={...t,children:this.processColumns(t.id),id:this.prefixId(o)};this.cacheComponent(r);const s=[{condition:n.legend,result:()=>({tag:n.fieldset?"legend":"h3",children:n.legend})},{condition:!0,result:()=>r},{condition:n.inputGroup,result:()=>this.addButton(o)}].reduce(((t,{condition:e,result:n})=>(e&&t.push(n()),t)),[]);return n.inputGroup&&i.push("f-input-group-wrap"),{tag:n.fieldset?"fieldset":"div",id:ws(),className:i,children:s}})),e(this,"cloneComponentData",(t=>{const{children:e=[],id:n,...o}=this.components[t];return Object.assign({},o,{id:fh(n),children:e.length&&e.map((({id:t})=>this.cloneComponentData(ph(t))))})})),e(this,"addButton",(t=>ch.render({tag:"button",attrs:{className:"add-input-group btn pull-right",type:"button"},children:"Add +",action:{click:e=>{const n=e.target.parentElement,o=ch.render(this.cloneComponentData(t));n.insertBefore(o,n.lastChild),o.appendChild(ch.render(ch.btnTemplate({className:"remove-input-group",children:ch.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()}})))}}}))),e(this,"processColumns",(t=>this.orderChildren("columns",this.form.rows[t].children).map((t=>this.cacheComponent(this.processColumn(t)))))),e(this,"processFieldsOrig",(t=>this.orderChildren("fields",t).map((({id:t,...e})=>this.cacheComponent(Object.assign({},e,{id:this.prefixId(t)})))))),e(this,"processFields",(t=>this.orderChildren("fields",t).map((({id:t,...e})=>{const{action:n={},dependencies:o={}}=this.elements[e.meta.id]||{};o&&Nu(o);const i=Cs({action:n},e);return this.cacheComponent({...i,id:this.prefixId(t)})})))),e(this,"applyConditions",(()=>{Object.values(this.components).forEach((({conditions:t})=>{t&&t.forEach(((t,e)=>{const{if:n,then:o}=t;n.forEach((t=>{const{source:e,...n}=t;if(Ns(e)){this.getComponents(e).forEach((t=>{const e=gh(t);e&&t.addEventListener(e,(t=>this.evaluateCondition(n,t)&&o.forEach((e=>this.execResult(e,t)))),!1);const i={target:t};this.evaluateCondition(n,i)&&o.forEach((t=>this.execResult(t,i)))}))}}))}))}))})),e(this,"evaluateCondition",(({sourceProperty:t,targetProperty:e,comparison:n,target:o},i)=>{var r;const s={equals:Wl,notEquals:(t,e)=>!Wl(t,e),contains:(t,e)=>t.includes(e),notContains:(t,e)=>!t.includes(e)},a=String(i.target[t]),l=String(Ns(o)?this.getComponent(o)[e]:o);return null==(r=s[n])?void 0:r.call(s,a,l)})),e(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(Ns(e)){const n=this.getComponent(e);n&&void 0===n._required&&(n._required=n.required),null==(i=r[t])||i.call(r,n)}})),e(this,"getComponent",(t=>{const e=t.slice(t.indexOf(".")+1);return As(t)?this.external[e]:this.renderedForm.querySelector(`#f-${e}`)})),e(this,"getComponents",(t=>{const e=[],n=t.slice(t.indexOf(".")+1);return As(t)?e.push(this.external[n]):e.push(...this.renderedForm.querySelectorAll(`[name=f-${n}]`)),e}));const{renderContainer:o,external:i,elements:r}=(({editorContainer:t,renderContainer:e,...n})=>{const o=t=>"string"==typeof t?document.querySelector(t):t;return{...n,renderContainer:o(e),editorContainer:o(t)}})(t);this.container=o,this.form=n,this.external=i,this.dom=ch,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=be,ch.render(t))))}};const gh=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=hh,window.FormeoRenderer=mh);const vh=mh,bh=new hh(r);((t,e)=>{const n=((t,e)=>({renderForm:()=>{te.style.display="block",e.render(t.formData)},logJSON:()=>{},viewData:()=>{for(const[e,n]of Object.entries(t.formData));},resetEditor:()=>{window.sessionStorage.removeItem("formeo-formData"),window.location.reload()}}))(t,e);Object.entries(n).map((([t,e])=>{const n={id:t,type:"button"},o=Object.assign(document.createElement("button"),n),i=document.createTextNode(Kt(t));return o.appendChild(i),o.addEventListener("click",e,!1),Qt.appendChild(o),o}))})(bh,new vh(s)),(t=>{const e=document.getElementById("control-filter"),n=document.getElementById("locale"),o=window.sessionStorage.getItem("formeo-locale");e.addEventListener("input",(({target:{value:e}})=>t.controls.actions.filter(e))),n.value=o||"en-US",n.addEventListener("change",(({target:{value:e}})=>{window.sessionStorage.setItem("formeo-locale",e),t.i18n.setLang(e)}),!1)})(bh); diff --git a/assets/js/demo.min.js.gz b/assets/js/demo.min.js.gz index b1fd8b47..cb010842 100644 Binary files a/assets/js/demo.min.js.gz and b/assets/js/demo.min.js.gz differ diff --git a/assets/js/formeo.min.js b/assets/js/formeo.min.js index 1025f282..3ae13986 100644 --- a/assets/js/formeo.min.js +++ b/assets/js/formeo.min.js @@ -1,14 +1,14 @@ /** formeo - https://formeo.io -Version: 2.3.1 +Version: 3.0.0 Author: Draggable https://draggable.io */ -!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{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="2.3.1",p="formeo",f="formeo-sprite",m=[{name:"cssPreload",src:"//cdnjs.cloudflare.com/ajax/libs/loadCSS/2.0.1/cssrelpreload.min.js"},{name:"mutationObserver",src:"//cdn.jsdelivr.net/npm/mutationobserver-shim/dist/mutationobserver.min.js"},{name:"fetch",src:"https://unpkg.com/unfetch/polyfill"}],g=`https://cdn.jsdelivr.net/npm/formeo@${h}/dist/${f}.svg`,v=`https://draggable.github.io/formeo/assets/img/${f}.svg`,b=`https://cdn.jsdelivr.net/npm/formeo@${h}/dist/formeo.min.css`,y="control-group",w=`${p}-stage`,C=`${p}-row`,E=`${p}-column`,x=`${p}-field`,S="custom-column-widths",O="column-preset",_="resizing-columns",N=new Map([[w,C],[C,E],[E,x]]),A=["external","stages","rows","columns","fields"],j=["stage","row","column","field"].reduce(((t,e)=>({...t,[e]:e})),{}),P=[{name:"controls",className:y},{name:"stage",className:w},{name:"row",className:C},{name:"column",className:E},{name:"field",className:x}],T={controls:y,stage:w,row:C,column:E,field:x},L=Object.entries(T).reduce(((t,[e,n])=>({...t,[n]:e})),{}),D=Object.values(T),k=new RegExp(`${D.join("|")}`,"g"),$=P.map((({name:t},e,n)=>{const{name:o}=n[e+1]||{};return o&&[t,o]})).filter(Boolean),I=$.slice().map((t=>t.slice().reverse())).reverse(),M=new Map($),R=new Map(I.slice()),F=new Map([[{value:"100.0",label:"100%"}],[{value:"50.0,50.0",label:"50 | 50"},{value:"33.3,66.6",label:"33 | 66"},{value:"66.6,33.3",label:"66 | 33"}],[{value:"33.3,33.3,33.3",label:"33 | 33 | 33"},{value:"25.0,25.0,50.0",label:"25 | 25 | 50"},{value:"50.0,25.0,25.0",label:"50 | 25 | 25"},{value:"25.0,50.0,25.0",label:"25 | 50 | 25"}],[{value:"25.0,25.0,25.0,25.0",label:"25 | 25 | 25 | 25"}],[{value:"20.0,20.0,20.0,20.0,20.0",label:"20 | 20 | 20 | 20 | 20"}],[{value:"16.66,16.66,16.66,16.66,16.66,16.66",label:"16.66 | 16.66 | 16.66 | 16.66 | 16.66 | 16.66"}]].reduce(((t,e,n)=>(t.push([n,e]),t)),[])),W=[{type:"added",condition:(t,e)=>Boolean(void 0===t&&e)}],B=`${p}-formData`,z=`${p}-locale`,q=333,U=Math.round(166.5),H=Math.round(666),X="formeoSaved",V="formeoUpdated",Y="formeoOnRender",G=["label","logical","source","thenTarget","sourceProperty","comparison","target","targetProperty","assignment","value"],Z={value:"attrs.value",checked:"attrs.checked",isVisible:"config.isVisible",isNotVisible:"config.isNotVisible"},J={comparison:{equals:"==",notEquals:"!=",contains:"⊃",notContains:"!⊃"},assignment:{equals:"="},logical:{and:"&&",or:"||"},property:Z},K=/(\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b)/gi,Q=/\bcol-\w+-\d+/g,tt="f-i-";var et="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function nt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ot=function(){this.__data__=[],this.size=0};var it=function(t,e){return t===e||t!=t&&e!=e},rt=it;var st=function(t,e){for(var n=t.length;n--;)if(rt(t[n][0],e))return n;return-1},at=st,lt=Array.prototype.splice;var ct=st;var dt=st;var ut=st;var ht=ot,pt=function(t){var e=this.__data__,n=at(e,t);return!(n<0)&&(n==e.length-1?e.pop():lt.call(e,n,1),--this.size,!0)},ft=function(t){var e=this.__data__,n=ct(e,t);return n<0?void 0:e[n][1]},mt=function(t){return dt(this.__data__,t)>-1},gt=function(t,e){var n=this.__data__,o=ut(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this};function vt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e-1&&t%1==0&&t<=9007199254740991},Hn=Ut,Xn=Un;var Vn=function(t){return null!=t&&Xn(t.length)&&!Hn(t)},Yn=Vn,Gn=Dn;var Zn=function(t){return Gn(t)&&Yn(t)},Jn={exports:{}};var Kn=function(){return!1};!function(t,e){var n=Nt,o=Kn,i=e&&!e.nodeType&&e,r=i&&t&&!t.nodeType&&t,s=r&&r.exports===i?n.Buffer:void 0,a=(s?s.isBuffer:void 0)||o;t.exports=a}(Jn,Jn.exports);var Qn=Jn.exports,to=Ft,eo=_n,no=Dn,oo=Function.prototype,io=Object.prototype,ro=oo.toString,so=io.hasOwnProperty,ao=ro.call(Object);var lo=function(t){if(!no(t)||"[object Object]"!=to(t))return!1;var e=eo(t);if(null===e)return!0;var n=so.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&ro.call(n)==ao},co=Ft,uo=Un,ho=Dn,po={};po["[object Float32Array]"]=po["[object Float64Array]"]=po["[object Int8Array]"]=po["[object Int16Array]"]=po["[object Int32Array]"]=po["[object Uint8Array]"]=po["[object Uint8ClampedArray]"]=po["[object Uint16Array]"]=po["[object Uint32Array]"]=!0,po["[object Arguments]"]=po["[object Array]"]=po["[object ArrayBuffer]"]=po["[object Boolean]"]=po["[object DataView]"]=po["[object Date]"]=po["[object Error]"]=po["[object Function]"]=po["[object Map]"]=po["[object Number]"]=po["[object Object]"]=po["[object RegExp]"]=po["[object Set]"]=po["[object String]"]=po["[object WeakMap]"]=!1;var fo=function(t){return ho(t)&&uo(t.length)&&!!po[co(t)]};var mo=function(t){return function(e){return t(e)}},go={exports:{}};!function(t,e){var n=St,o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,r=i&&i.exports===o&&n.process,s=function(){try{var t=i&&i.require&&i.require("util").types;return t||r&&r.binding&&r.binding("util")}catch(e){}}();t.exports=s}(go,go.exports);var vo=go.exports,bo=fo,yo=mo,wo=vo&&vo.isTypedArray,Co=wo?yo(wo):bo;var Eo=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},xo=nn,So=it,Oo=Object.prototype.hasOwnProperty;var _o=function(t,e,n){var o=t[e];Oo.call(t,e)&&So(o,n)&&(void 0!==n||e in t)||xo(t,e,n)},No=_o,Ao=nn;var jo=function(t,e,n,o){var i=!n;n||(n={});for(var r=-1,s=e.length;++r-1&&t%1==0&&t0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}},Ai=Ni(Oi),ji=yi,Pi=Ei,Ti=Ai;var Li=it,Di=Vn,ki=To,$i=Wt;var Ii=function(t,e){return Ti(Pi(t,e,ji),t+"")},Mi=function(t,e,n){if(!$i(n))return!1;var o=typeof e;return!!("number"==o?Di(n)&&ki(e,n.length):"string"==o&&e in n)&&Li(n[e],t)};var Ri=bi;const Fi=nt(function(t){return Ii((function(e,n){var o=-1,i=n.length,r=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(r=t.length>3&&"function"==typeof r?(i--,r):void 0,s&&Mi(n[0],n[1],s)&&(r=i<3?void 0:r,i=1),e=Object(e);++ocrypto.randomUUID(),Bi=(t="",e)=>{if(!e)return!1;const n=/[|\\{}()[\]^*$+?.]/g;let o="string"==typeof e?[e]:e;o=o.map((t=>"*"===t?"":t.replace(n,"\\$&")));let i=!0;return o.length&&(i=!new RegExp(o.join("|"),"i").exec(t)),i},zi=t=>{var e;const n=null==(e=t.className)?void 0:e.match(k);return n&&L[n[0]]},qi=t=>Array.from(new Set(t)),Ui=t=>{let e;if(t){const{attrs:n={}}=t;e=n.id||t.id||Wi(),t.id=e}else e=Wi();return e},Hi=(t,e)=>Fi({},t,e,((t,e)=>Array.isArray(t)?null!=e?qi(t.concat(e)):e:Array.isArray(e)?null!=t?qi(e.concat(t)):e:void 0)),Xi=t=>{let e;if(null===t||!("object"==typeof t)||t instanceof Promise)return t;if(t instanceof Date)return e=new Date,e.setTime(t.getTime()),e;if(Array.isArray(t)){e=[];for(let n=0,o=t.length;nt/e*100,Yi=t=>`${t.toString()}%`,Gi=Object.create(null,{get:{value:t=>{var e;const n=null==(e=window.sessionStorage)?void 0:e.getItem(t);try{return JSON.parse(n)}catch(o){return n}}},set:{value:(t,e)=>{var n;try{return null==(n=window.sessionStorage)?void 0:n.setItem(t,JSON.stringify(e))}catch(o){}}}}),Zi=t=>A.some((e=>new RegExp(`^${e}.`).test(t))),Ji=t=>t.startsWith("external");function Ki(t,e=H){let n=0;return function(...o){const i=Date.now();i-n>=e&&(n=i,t.apply(this,o))}}function Qi(t){return t}function tr(){}var er=Ft,nr=Dn;var or=function(t){return"symbol"==typeof t||nr(t)&&"[object Symbol]"==er(t)},ir=qn,rr=or,sr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ar=/^\w*$/;var lr=function(t,e){if(ir(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!rr(t))||(ar.test(t)||!sr.test(t)||null!=e&&t in Object(e))},cr=Be;function dr(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(dr.Cache||cr),n}dr.Cache=cr;var ur=dr;var hr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,pr=/\\(\\)?/g,fr=function(t){var e=ur(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(hr,(function(t,n,o,i){e.push(o?i.replace(pr,"$1"):n||t)})),e}));var mr=function(t,e){for(var n=-1,o=null==t?0:t.length,i=Array(o);++nNumber.isInteger(Number(t)),zr=(t,e)=>{const n=e||t.parentElement;return Array.prototype.slice.call(n.childNodes).indexOf(t)},qr=(t,e,n)=>{const o=n.split("||"),i=qi(e).map((e=>t.find((t=>{const n=o.find((e=>!!Fr(t,e)));return n&&Fr(t,n)===e})))).filter(Boolean).concat(t);return qi(i)},Ur=(t,e,n)=>{for(let o=0;o{const n=[];return Ur(t,((t,o)=>n.push(e(t,o)))),n},Xr={},Vr=t=>t.replace(/\b\w/g,(t=>t.toUpperCase())),Yr=()=>-1!==window.navigator.userAgent.indexOf("MSIE "),Gr={capitalize:Vr,safeAttrName:t=>{if(Xr[t])return Xr[t];const e=({className:"class"}[t]||t).replace(/^\d+/,"").replace(/[^a-zA-Z0-9-:]/g,"");return Xr[t]=e,e},forEach:Ur,copyObj:t=>window.JSON.parse(window.JSON.stringify(t)),map:Hr,subtract:(t,e)=>e.filter((e=>!~t.indexOf(e))),indexOfNode:zr,isInt:Br,get:Fr,orderObjectsBy:qr,isIE:Yr},Zr={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=Zr.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{const o=Zr.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"===Zr.getStyle(t,"display"))=>{n?Zr.slideDown(t,e):Zr.slideUp(t,e)}},Jr="no-transition",Kr={debug:!1,bubbles:!0,formeoLoaded:t=>{},onAdd:()=>{},onUpdate:t=>{var e;return(null==(e=ts.opts)?void 0:e.debug)&&void 0},onUpdateStage:t=>{var e;return(null==(e=ts.opts)?void 0:e.debug)&&void 0},onUpdateRow:t=>{var e;return(null==(e=ts.opts)?void 0:e.debug)&&void 0},onUpdateColumn:t=>{var e;return(null==(e=ts.opts)?void 0:e.debug)&&void 0},onUpdateField:t=>{var e;return(null==(e=ts.opts)?void 0:e.debug)&&void 0},onRender:t=>{var e;return(null==(e=ts.opts)?void 0:e.debug)&&void 0},onSave:t=>{},confirmClearAll:t=>{window.confirm(t.confirmationMessage)&&t.clearAllAction(t)}},Qr=({src:t,...e},n=V)=>{var o,i;const r=new window.CustomEvent(n,{detail:e,bubbles:(null==(o=ts.opts)?void 0:o.debug)||(null==(i=ts.opts)?void 0:i.bubbles)});return r.data=(t||document).dispatchEvent(r),r},ts={init:function(t){return this.opts={...Kr,...t},this},formeoSaved:t=>Qr(t,X),formeoUpdated:t=>Qr(t,V),formeoCleared:t=>Qr(t,"formeoCleared"),formeoOnRender:t=>Qr(t,Y),formeoConditionUpdated:t=>Qr(t,"formeoConditionUpdated")},es=Ki((()=>{ts.opts.onUpdate({timeStamp:window.performance.now(),type:V,detail:Wd.formData})}),U);let ns;document.addEventListener(V,es),document.addEventListener("formeoUpdatedStage",(t=>{const{timeStamp:e,type:n,detail:o}=t;ts.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedRow",(t=>{const{timeStamp:e,type:n,detail:o}=t;ts.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedColumn",(t=>{const{timeStamp:e,type:n,detail:o}=t;ts.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedField",(t=>{const{timeStamp:e,type:n,detail:o}=t;ts.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener(Y,(t=>{const{timeStamp:e,type:n,detail:o}=t;ts.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},ts.opts.confirmClearAll(t)})),document.addEventListener(X,(({timeStamp:t,type:e,detail:{formData:n}})=>{const o={timeStamp:t,type:e,formData:n};ts.opts.onSave(o)})),document.addEventListener("formeoLoaded",(t=>{ts.opts.formeoLoaded(t.detail.formeo)})),window.addEventListener("resize",(function(){ns=ns||window.requestAnimationFrame((()=>{ns=!1;for(const t of Object.values($d.data))t.dom.classList.add(Jr),Md.dom.classList.add(Jr),Md.panels.nav.refresh(),t.refreshFieldPanels()}))}));var os=Be,is=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},rs=function(t){return this.__data__.has(t)};function ss(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new os;++ea))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 as:void 0;for(r.set(t,e),r.set(e,t);++uJSON.stringify(t,null,e))),n(this,"get",(t=>Fr(this.data,t))),n(this,"getChangeType",((t,e)=>{const n=W.find((({condition:n})=>n(t,e)))||{type:"unknown"};return n.desc="added"===n.type?`${t} to ${e}`:e,n})),n(this,"add",((t,e=Object.create(null))=>{const{id:n}=e,o=t||n||Ui();return this.set(o,e)})),n(this,"remove",(t=>{const e=t.split("."),n=e.pop(),o=this.get(e);return Array.isArray(o)?o.splice(Number(n),1):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=Fr(this.data,t);if(wa(n,e))return this.data;const o=Wr(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),ts.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)}} +!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{const r=i.processFile(e);return n.applyLanguage(t,r),n.loaded.push(t),o(n.langs[t])})).catch((e=>{const i=n.applyLanguage(t);o(i)}))}))}applyLanguage(t,e={}){const n=this.config.override[t]||{},o=this.langs[t]||{};return this.langs[t]={...o,...e,...n},this.langs[t]}get getLangs(){return this.config.langs}async setCurrent(t="en-US"){return await this.loadLang(t),this.locale=t,this.current=this.langs[t],this.current}}const r=new i;!function(){try{if("undefined"!=typeof document){var t=document.createElement("style");t.appendChild(document.createTextNode('._3x4ZIcu-{position:absolute;background:#1f2937;color:#fff;padding:.75rem;border-radius:.375rem;max-width:200px;z-index:50;visibility:hidden;opacity:0;transition:opacity .2s;pointer-events:none;left:0;top:0}._3x4ZIcu-.JIt36hCJ{visibility:visible;opacity:1;pointer-events:all}._3x4ZIcu-:before{content:"";position:absolute;width:0;height:0;border:6px solid transparent}._3x4ZIcu-[data-position=top]:before{border-top-color:#1f2937;bottom:-12px;left:50%;transform:translate(-50%)}._3x4ZIcu-[data-position=bottom]:before{border-bottom-color:#1f2937;top:-12px;left:50%;transform:translate(-50%)}._3x4ZIcu-[data-position=left]:before{border-left-color:#1f2937;right:-12px;top:50%;transform:translateY(-50%)}._3x4ZIcu-[data-position=right]:before{border-right-color:#1f2937;left:-12px;top:50%;transform:translateY(-50%)}._3x4ZIcu-[data-position=top-left]:before{border-top-color:#1f2937;bottom:-12px;left:12px;transform:none}._3x4ZIcu-[data-position=top-right]:before{border-top-color:#1f2937;bottom:-12px;right:12px;left:auto;transform:none}._3x4ZIcu-[data-position=bottom-left]:before{border-bottom-color:#1f2937;top:-12px;left:12px;transform:none}._3x4ZIcu-[data-position=bottom-right]:before{border-bottom-color:#1f2937;top:-12px;right:12px;left:auto;transform:none}')),document.head.appendChild(t)}}catch(e){}}();var s=Object.defineProperty,a=(t,e,n)=>((t,e,n)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);const l="_3x4ZIcu-",c="JIt36hCJ",d={triggerName:"tooltip"};class u{constructor(t=d){a(this,"triggerName"),a(this,"tooltip"),a(this,"activeTriggerType",null),a(this,"spacing",12),a(this,"handleClick",(t=>{const e=this.triggerName,n=t.target.closest(`[${e}][${e}-type="click"]`);if(n)if(this.isVisible())this.hide();else{const t=n.getAttribute(`${e}`);this.show(n,t),this.activeTriggerType="click"}else this.hide()})),a(this,"handleMouseOver",(t=>{const e=this.triggerName,n=t.target.closest(`[${e}]`);if("click"!==this.activeTriggerType&&"click"!==(null==n?void 0:n.getAttribute(`${e}-type`))){const t=null==n?void 0:n.getAttribute(`${e}`);t&&(this.show(n,t),this.activeTriggerType="hover")}})),a(this,"handleMouseOut",(t=>{const e=this.triggerName,n=t.target.closest(`[${e}]`);"click"!==this.activeTriggerType&&"click"!==(null==n?void 0:n.getAttribute(`${e}-type`))&&this.hide()})),a(this,"handleResize",(()=>{this.isVisible()&&this.hide()})),a(this,"handleScroll",(()=>{this.isVisible()&&this.hide()})),this.triggerName=`data-${t.triggerName}`,this.tooltip=document.createElement("div"),this.tooltip.className=`d-tooltip ${l}`,document.body.appendChild(this.tooltip),this.setupEventListeners()}setupEventListeners(){document.addEventListener("mouseover",this.handleMouseOver),document.addEventListener("mouseout",this.handleMouseOut),document.addEventListener("touchstart",this.handleMouseOver),document.addEventListener("touchend",this.handleMouseOut),document.addEventListener("click",this.handleClick),window.addEventListener("resize",this.handleResize),window.addEventListener("scroll",this.handleScroll,!0)}isVisible(){return this.tooltip.classList.contains(c)}calculatePosition(t){const e=t.getBoundingClientRect(),n=this.tooltip.getBoundingClientRect(),o=[{name:"top",x:e.left+(e.width-n.width)/2,y:e.top-n.height-this.spacing},{name:"bottom",x:e.left+(e.width-n.width)/2,y:e.bottom+this.spacing},{name:"left",x:e.left-n.width-this.spacing,y:e.top+(e.height-n.height)/2},{name:"right",x:e.right+this.spacing,y:e.top+(e.height-n.height)/2},{name:"top-left",x:e.left,y:e.top-n.height-this.spacing},{name:"top-right",x:e.right-n.width,y:e.top-n.height-this.spacing},{name:"bottom-left",x:e.left,y:e.bottom+this.spacing},{name:"bottom-right",x:e.right-n.width,y:e.bottom+this.spacing}];return o.find((t=>this.fitsInViewport(t,n)))||o[0]}fitsInViewport(t,e){if(!(t.x>=0&&t.y>=0&&t.x+e.width<=window.innerWidth&&t.y+e.height<=window.innerHeight))return!1;return 0===[[t.x,t.y],[t.x+e.width,t.y],[t.x,t.y+e.height],[t.x+e.width,t.y+e.height],[t.x+e.width/2,t.y+e.height/2]].flatMap((([t,e])=>Array.from(document.elementsFromPoint(t,e)))).filter((t=>{if(this.tooltip.contains(t)||t===this.tooltip||t.classList.contains(l)||"none"===getComputedStyle(t).pointerEvents)return!1})).length}show(t,e){this.tooltip.innerHTML=e??"",this.tooltip.classList.add(c);const n=this.calculatePosition(t);this.tooltip.style.left=`${n.x}px`,this.tooltip.style.top=`${n.y}px`,this.tooltip.dataset.position=n.name}hide(){this.tooltip.classList.remove(c),this.activeTriggerType=null}destroy(){document.removeEventListener("mouseover",this.handleMouseOver),document.removeEventListener("mouseout",this.handleMouseOut),document.removeEventListener("touchstart",this.handleMouseOver),document.removeEventListener("touchend",this.handleMouseOut),document.removeEventListener("click",this.handleClick),window.removeEventListener("resize",this.handleResize),window.removeEventListener("scroll",this.handleScroll,!0),this.tooltip.remove()}}void 0!==window&&(window.SmartTooltip=u);const h="formeo",p="3.0.0",f="formeo-sprite",m=[{name:"cssPreload",src:"//cdnjs.cloudflare.com/ajax/libs/loadCSS/2.0.1/cssrelpreload.min.js"},{name:"mutationObserver",src:"//cdn.jsdelivr.net/npm/mutationobserver-shim/dist/mutationobserver.min.js"},{name:"fetch",src:"https://unpkg.com/unfetch/polyfill"}],g=`https://cdn.jsdelivr.net/npm/formeo@${p}/dist/${f}.svg`,v=`https://draggable.github.io/formeo/assets/img/${f}.svg`,b=`https://cdn.jsdelivr.net/npm/formeo@${p}/dist/formeo.min.css`,y="control-group",w=`${h}-stage`,C=`${h}-row`,E=`${h}-column`,x=`${h}-field`,S="custom-column-widths",O="column-preset",_="resizing-columns",N=new Map([[w,C],[C,E],[E,x]]),A=["external","stages","rows","columns","fields"],j=["stage","row","column","field"].reduce(((t,e)=>({...t,[e]:e})),{}),P=[{name:"controls",className:y},{name:"stage",className:w},{name:"row",className:C},{name:"column",className:E},{name:"field",className:x}],T={controls:y,stage:w,row:C,column:E,field:x},L=Object.entries(T).reduce(((t,[e,n])=>({...t,[n]:e})),{}),D=Object.values(T),k=new RegExp(`${D.join("|")}`,"g"),$=P.map((({name:t},e,n)=>{const{name:o}=n[e+1]||{};return o&&[t,o]})).filter(Boolean),I=$.slice().map((t=>t.slice().reverse())).reverse(),M=new Map($),R=new Map(I.slice()),F=new Map([[{value:"100.0",label:"100%"}],[{value:"50.0,50.0",label:"50 | 50"},{value:"33.3,66.6",label:"33 | 66"},{value:"66.6,33.3",label:"66 | 33"}],[{value:"33.3,33.3,33.3",label:"33 | 33 | 33"},{value:"25.0,25.0,50.0",label:"25 | 25 | 50"},{value:"50.0,25.0,25.0",label:"50 | 25 | 25"},{value:"25.0,50.0,25.0",label:"25 | 50 | 25"}],[{value:"25.0,25.0,25.0,25.0",label:"25 | 25 | 25 | 25"}],[{value:"20.0,20.0,20.0,20.0,20.0",label:"20 | 20 | 20 | 20 | 20"}],[{value:"16.66,16.66,16.66,16.66,16.66,16.66",label:"16.66 | 16.66 | 16.66 | 16.66 | 16.66 | 16.66"}]].reduce(((t,e,n)=>(t.push([n,e]),t)),[])),W=[{type:"added",condition:(t,e)=>Boolean(void 0===t&&e)}],B=`${h}-formData`,z=`${h}-locale`,q=333,U=Math.round(166.5),H=Math.round(666),X="formeoSaved",V="formeoUpdated",Y="formeoOnRender",G=["label","logical","source","thenTarget","sourceProperty","comparison","target","targetProperty","assignment","value"],Z={value:"attrs.value",checked:"attrs.checked",isVisible:"config.isVisible",isNotVisible:"config.isNotVisible"},J={comparison:{equals:"==",notEquals:"!=",contains:"⊃",notContains:"!⊃"},assignment:{equals:"="},logical:{and:"&&",or:"||"},property:Z},K=/(\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b)/gi,Q=/\bcol-\w+-\d+/g,tt="f-i-";var et="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function nt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ot=function(){this.__data__=[],this.size=0};var it=function(t,e){return t===e||t!=t&&e!=e},rt=it;var st=function(t,e){for(var n=t.length;n--;)if(rt(t[n][0],e))return n;return-1},at=st,lt=Array.prototype.splice;var ct=st;var dt=st;var ut=st;var ht=ot,pt=function(t){var e=this.__data__,n=at(e,t);return!(n<0)&&(n==e.length-1?e.pop():lt.call(e,n,1),--this.size,!0)},ft=function(t){var e=this.__data__,n=ct(e,t);return n<0?void 0:e[n][1]},mt=function(t){return dt(this.__data__,t)>-1},gt=function(t,e){var n=this.__data__,o=ut(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this};function vt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e-1&&t%1==0&&t<=9007199254740991},Hn=Ut,Xn=Un;var Vn=function(t){return null!=t&&Xn(t.length)&&!Hn(t)},Yn=Vn,Gn=Dn;var Zn=function(t){return Gn(t)&&Yn(t)},Jn={exports:{}};var Kn=function(){return!1};!function(t,e){var n=Nt,o=Kn,i=e&&!e.nodeType&&e,r=i&&t&&!t.nodeType&&t,s=r&&r.exports===i?n.Buffer:void 0,a=(s?s.isBuffer:void 0)||o;t.exports=a}(Jn,Jn.exports);var Qn=Jn.exports,to=Ft,eo=_n,no=Dn,oo=Function.prototype,io=Object.prototype,ro=oo.toString,so=io.hasOwnProperty,ao=ro.call(Object);var lo=function(t){if(!no(t)||"[object Object]"!=to(t))return!1;var e=eo(t);if(null===e)return!0;var n=so.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&ro.call(n)==ao},co=Ft,uo=Un,ho=Dn,po={};po["[object Float32Array]"]=po["[object Float64Array]"]=po["[object Int8Array]"]=po["[object Int16Array]"]=po["[object Int32Array]"]=po["[object Uint8Array]"]=po["[object Uint8ClampedArray]"]=po["[object Uint16Array]"]=po["[object Uint32Array]"]=!0,po["[object Arguments]"]=po["[object Array]"]=po["[object ArrayBuffer]"]=po["[object Boolean]"]=po["[object DataView]"]=po["[object Date]"]=po["[object Error]"]=po["[object Function]"]=po["[object Map]"]=po["[object Number]"]=po["[object Object]"]=po["[object RegExp]"]=po["[object Set]"]=po["[object String]"]=po["[object WeakMap]"]=!1;var fo=function(t){return ho(t)&&uo(t.length)&&!!po[co(t)]};var mo=function(t){return function(e){return t(e)}},go={exports:{}};!function(t,e){var n=St,o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,r=i&&i.exports===o&&n.process,s=function(){try{var t=i&&i.require&&i.require("util").types;return t||r&&r.binding&&r.binding("util")}catch(e){}}();t.exports=s}(go,go.exports);var vo=go.exports,bo=fo,yo=mo,wo=vo&&vo.isTypedArray,Co=wo?yo(wo):bo;var Eo=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},xo=nn,So=it,Oo=Object.prototype.hasOwnProperty;var _o=function(t,e,n){var o=t[e];Oo.call(t,e)&&So(o,n)&&(void 0!==n||e in t)||xo(t,e,n)},No=_o,Ao=nn;var jo=function(t,e,n,o){var i=!n;n||(n={});for(var r=-1,s=e.length;++r-1&&t%1==0&&t0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}},Ai=Ni(Oi),ji=yi,Pi=Ei,Ti=Ai;var Li=it,Di=Vn,ki=To,$i=Wt;var Ii=function(t,e){return Ti(Pi(t,e,ji),t+"")},Mi=function(t,e,n){if(!$i(n))return!1;var o=typeof e;return!!("number"==o?Di(n)&&ki(e,n.length):"string"==o&&e in n)&&Li(n[e],t)};var Ri=bi;const Fi=nt(function(t){return Ii((function(e,n){var o=-1,i=n.length,r=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(r=t.length>3&&"function"==typeof r?(i--,r):void 0,s&&Mi(n[0],n[1],s)&&(r=i<3?void 0:r,i=1),e=Object(e);++ocrypto.randomUUID(),Bi=(t="",e)=>{if(!e)return!1;const n=/[|\\{}()[\]^*$+?.]/g;let o="string"==typeof e?[e]:e;o=o.map((t=>"*"===t?"":t.replace(n,"\\$&")));let i=!0;return o.length&&(i=!new RegExp(o.join("|"),"i").exec(t)),i},zi=t=>{var e;const n=null==(e=t.className)?void 0:e.match(k);return n&&L[n[0]]},qi=t=>Array.from(new Set(t)),Ui=t=>{let e;if(t){const{attrs:n={}}=t;e=n.id||t.id||Wi(),t.id=e}else e=Wi();return e},Hi=(t,e)=>Fi({},t,e,((t,e)=>Array.isArray(t)?null!=e?qi(t.concat(e)):e:Array.isArray(e)?null!=t?qi(e.concat(t)):e:void 0)),Xi=t=>{let e;if(null===t||!("object"==typeof t)||t instanceof Promise)return t;if(t instanceof Date)return e=new Date,e.setTime(t.getTime()),e;if(Array.isArray(t)){e=[];for(let n=0,o=t.length;nt/e*100,Yi=t=>`${t.toString()}%`,Gi=Object.create(null,{get:{value:t=>{var e;const n=null==(e=window.sessionStorage)?void 0:e.getItem(t);try{return JSON.parse(n)}catch(o){return n}}},set:{value:(t,e)=>{var n;try{return null==(n=window.sessionStorage)?void 0:n.setItem(t,JSON.stringify(e))}catch(o){}}}}),Zi=t=>A.some((e=>new RegExp(`^${e}.`).test(t))),Ji=t=>t.startsWith("external");function Ki(t,e=H){let n=0;return function(...o){const i=Date.now();i-n>=e&&(n=i,t.apply(this,o))}}function Qi(t){return t}function tr(){}var er=Ft,nr=Dn;var or=function(t){return"symbol"==typeof t||nr(t)&&"[object Symbol]"==er(t)},ir=qn,rr=or,sr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ar=/^\w*$/;var lr=function(t,e){if(ir(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!rr(t))||(ar.test(t)||!sr.test(t)||null!=e&&t in Object(e))},cr=Be;function dr(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(dr.Cache||cr),n}dr.Cache=cr;var ur=dr;var hr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,pr=/\\(\\)?/g,fr=function(t){var e=ur(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(hr,(function(t,n,o,i){e.push(o?i.replace(pr,"$1"):n||t)})),e}));var mr=function(t,e){for(var n=-1,o=null==t?0:t.length,i=Array(o);++nNumber.isInteger(Number(t)),zr=(t,e)=>{const n=e||t.parentElement;return Array.prototype.slice.call(n.childNodes).indexOf(t)},qr=(t,e,n)=>{const o=n.split("||"),i=qi(e).map((e=>t.find((t=>{const n=o.find((e=>!!Fr(t,e)));return n&&Fr(t,n)===e})))).filter(Boolean).concat(t);return qi(i)},Ur=(t,e,n)=>{for(let o=0;o{const n=[];return Ur(t,((t,o)=>n.push(e(t,o)))),n},Xr={},Vr=t=>t.replace(/\b\w/g,(t=>t.toUpperCase())),Yr=()=>-1!==window.navigator.userAgent.indexOf("MSIE "),Gr={capitalize:Vr,safeAttrName:t=>{if(Xr[t])return Xr[t];const e=({className:"class"}[t]||t).replace(/^\d+/,"").replace(/[^a-zA-Z0-9-:]/g,"");return Xr[t]=e,e},forEach:Ur,copyObj:t=>window.JSON.parse(window.JSON.stringify(t)),map:Hr,subtract:(t,e)=>e.filter((e=>!~t.indexOf(e))),indexOfNode:zr,isInt:Br,get:Fr,orderObjectsBy:qr,isIE:Yr},Zr={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=Zr.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{const o=Zr.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"===Zr.getStyle(t,"display"))=>{n?Zr.slideDown(t,e):Zr.slideUp(t,e)}},Jr="no-transition",Kr={debug:!1,bubbles:!0,formeoLoaded:t=>{},onAdd:()=>{},onUpdate:t=>{var e;return(null==(e=ts.opts)?void 0:e.debug)&&void 0},onUpdateStage:t=>{var e;return(null==(e=ts.opts)?void 0:e.debug)&&void 0},onUpdateRow:t=>{var e;return(null==(e=ts.opts)?void 0:e.debug)&&void 0},onUpdateColumn:t=>{var e;return(null==(e=ts.opts)?void 0:e.debug)&&void 0},onUpdateField:t=>{var e;return(null==(e=ts.opts)?void 0:e.debug)&&void 0},onRender:t=>{var e;return(null==(e=ts.opts)?void 0:e.debug)&&void 0},onSave:t=>{},confirmClearAll:t=>{window.confirm(t.confirmationMessage)&&t.clearAllAction(t)}},Qr=({src:t,...e},n=V)=>{var o,i;const r=new window.CustomEvent(n,{detail:e,bubbles:(null==(o=ts.opts)?void 0:o.debug)||(null==(i=ts.opts)?void 0:i.bubbles)});return r.data=(t||document).dispatchEvent(r),r},ts={init:function(t){return this.opts={...Kr,...t},this},formeoSaved:t=>Qr(t,X),formeoUpdated:t=>Qr(t,V),formeoCleared:t=>Qr(t,"formeoCleared"),formeoOnRender:t=>Qr(t,Y),formeoConditionUpdated:t=>Qr(t,"formeoConditionUpdated")},es=Ki((()=>{ts.opts.onUpdate({timeStamp:window.performance.now(),type:V,detail:Wd.formData})}),U);let ns;document.addEventListener(V,es),document.addEventListener("formeoUpdatedStage",(t=>{const{timeStamp:e,type:n,detail:o}=t;ts.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedRow",(t=>{const{timeStamp:e,type:n,detail:o}=t;ts.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedColumn",(t=>{const{timeStamp:e,type:n,detail:o}=t;ts.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedField",(t=>{const{timeStamp:e,type:n,detail:o}=t;ts.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener(Y,(t=>{const{timeStamp:e,type:n,detail:o}=t;ts.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},ts.opts.confirmClearAll(t)})),document.addEventListener(X,(({timeStamp:t,type:e,detail:{formData:n}})=>{const o={timeStamp:t,type:e,formData:n};ts.opts.onSave(o)})),document.addEventListener("formeoLoaded",(t=>{ts.opts.formeoLoaded(t.detail.formeo)})),window.addEventListener("resize",(function(){ns=ns||window.requestAnimationFrame((()=>{ns=!1;for(const t of Object.values($d.data))t.dom.classList.add(Jr),Md.dom.classList.add(Jr),Md.panels.nav.refresh(),t.refreshFieldPanels()}))}));var os=Be,is=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},rs=function(t){return this.__data__.has(t)};function ss(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new os;++ea))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 as:void 0;for(r.set(t,e),r.set(e,t);++uJSON.stringify(t,null,e))),n(this,"get",(t=>Fr(this.data,t))),n(this,"getChangeType",((t,e)=>{const n=W.find((({condition:n})=>n(t,e)))||{type:"unknown"};return n.desc="added"===n.type?`${t} to ${e}`:e,n})),n(this,"add",((t,e=Object.create(null))=>{const{id:n}=e,o=t||n||Ui();return this.set(o,e)})),n(this,"remove",(t=>{const e=t.split("."),n=e.pop(),o=this.get(e);return Array.isArray(o)?o.splice(Number(n),1):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=Fr(this.data,t);if(wa(n,e))return this.data;const o=Wr(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),ts.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)}} /**! * Sortable 1.15.3 * @author RubaXa * @author owenm * @license MIT - */function Ea(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 xa(t){for(var e=1;e=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Aa(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var ja=Aa(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Pa=Aa(/Edge/i),Ta=Aa(/firefox/i),La=Aa(/safari/i)&&!Aa(/chrome/i)&&!Aa(/android/i),Da=Aa(/iP(ad|od|hone)/i),ka=Aa(/chrome/i)&&Aa(/android/i),$a={capture:!1,passive:!1};function Ia(t,e,n){t.addEventListener(e,n,!ja&&$a)}function Ma(t,e,n){t.removeEventListener(e,n,!ja&&$a)}function Ra(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 Fa(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function Wa(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&Ra(t,e):Ra(t,e))||o&&t===n)return t;if(t===n)break}while(t=Fa(t))}return null}var Ba,za=/\s+/g;function qa(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(za," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(za," ")}}function Ua(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 Ha(t,e){var n="";if("string"==typeof t)n=t;else do{var o=Ua(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 Xa(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i=Ya(o)[n]))return o;if(o===Va())break;o=tl(o,!1)}return!1}function Za(t,e,n,o){for(var i=0,r=0,s=t.children;r2&&void 0!==arguments[2]?arguments[2]:{},o=n.evt,i=Na(n,ul);dl.pluginEvent.bind(ic)(t,e,xa({dragEl:fl,parentEl:ml,ghostEl:gl,rootEl:vl,nextEl:bl,lastDownEl:yl,cloneEl:wl,cloneHidden:Cl,dragStarted:kl,putSortable:Nl,activeSortable:ic.active,originalEvent:o,oldIndex:El,oldDraggableIndex:Sl,newIndex:xl,newDraggableIndex:Ol,hideGhostForTarget:tc,unhideGhostForTarget:ec,cloneNowHidden:function(){Cl=!0},cloneNowShown:function(){Cl=!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,f=t.extraEventProperties;if(e=e||n&&n[sl]){var m,g=e.options,v="on"+o.charAt(0).toUpperCase()+o.substr(1);!window.CustomEvent||ja||Pa?(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=xa(xa({},f),dl.getEventProperties(o,e));for(var y in b)m[y]=b[y];n&&n.dispatchEvent(m),g[v]&&g[v].call(e,m)}}(xa({putSortable:Nl,cloneEl:wl,targetEl:fl,rootEl:vl,oldIndex:El,oldDraggableIndex:Sl,newIndex:xl,newDraggableIndex:Ol},t))}var fl,ml,gl,vl,bl,yl,wl,Cl,El,xl,Sl,Ol,_l,Nl,Al,jl,Pl,Tl,Ll,Dl,kl,$l,Il,Ml,Rl,Fl=!1,Wl=!1,Bl=[],zl=!1,ql=!1,Ul=[],Hl=!1,Xl=[],Vl="undefined"!=typeof document,Yl=Da,Gl=Pa||ja?"cssFloat":"float",Zl=Vl&&!ka&&!Da&&"draggable"in document.createElement("div"),Jl=function(){if(Vl){if(ja)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),Kl=function(t,e){var n=Ua(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=Za(t,0,e),r=Za(t,1,e),s=i&&Ua(i),a=r&&Ua(r),l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Ya(i).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Ya(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[Gl]||r&&"none"===n[Gl]&&l+c>o)?"vertical":"horizontal"},Ql=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"==Sa(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},tc=function(){!Jl&&gl&&Ua(gl,"display","none")},ec=function(){!Jl&&gl&&Ua(gl,"display","")};Vl&&!ka&&document.addEventListener("click",(function(t){if(Wl)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),Wl=!1,!1}),!0);var nc=function(t){if(fl){t=t.touches?t.touches[0]:t;var e=(i=t.clientX,r=t.clientY,Bl.some((function(t){var e=t[sl].options.emptyInsertThreshold;if(e&&!Ja(t)){var n=Ya(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[sl]._onDragOver(n)}}var i,r,s},oc=function(t){fl&&fl.parentNode[sl]._isOutsideThisEl(t.target)};function ic(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=_a({},e),t[sl]=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 Kl(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!==ic.supportPointer&&"PointerEvent"in window&&!La,emptyInsertThreshold:5};for(var o in dl.initializePlugins(this,t,n),n)!(o in e)&&(e[o]=n[o]);for(var i in Ql(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&Zl,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?Ia(t,"pointerdown",this._onTapStart):(Ia(t,"mousedown",this._onTapStart),Ia(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(Ia(t,"dragover",this),Ia(t,"dragenter",this)),Bl.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),_a(this,al())}function rc(t,e,n,o,i,r,s,a){var l,c,d=t[sl],u=d.options.onMove;return!window.CustomEvent||ja||Pa?(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||Ya(e),l.willInsertAfter=a,l.originalEvent=s,t.dispatchEvent(l),u&&(c=u.call(d,l,s)),c}function sc(t){t.draggable=!1}function ac(){Hl=!1}function lc(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 cc(t){return setTimeout(t,0)}function dc(t){return clearTimeout(t)}ic.prototype={constructor:ic,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||($l=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,fl):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){Xl.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&Xl.push(o)}}(n),!fl&&!(/mousedown|pointerdown/.test(r)&&0!==t.button||o.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!La||!a||"SELECT"!==a.tagName.toUpperCase())&&!((a=Wa(a,o.draggable,n,!1))&&a.animated||yl===a)){if(El=Ka(a),Sl=Ka(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}),hl("filter",e,{evt:t}),void(i&&t.cancelable&&t.preventDefault())}else if(c&&(c=c.split(",").some((function(o){if(o=Wa(l,o.trim(),n,!1))return pl({sortable:e,rootEl:o,name:"filter",targetEl:a,fromEl:n,toEl:n}),hl("filter",e,{evt:t}),!0}))))return void(i&&t.cancelable&&t.preventDefault());o.handle&&!Wa(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&&!fl&&n.parentNode===r){var l=Ya(n);if(vl=r,ml=(fl=n).parentNode,bl=fl.nextSibling,yl=n,_l=s.group,ic.dragged=fl,Al={target:fl,clientX:(e||t).clientX,clientY:(e||t).clientY},Ll=Al.clientX-l.left,Dl=Al.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,fl.style["will-change"]="all",o=function(){hl("delayEnded",i,{evt:t}),ic.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!Ta&&i.nativeDraggable&&(fl.draggable=!0),i._triggerDragStart(t,e),pl({sortable:i,name:"choose",originalEvent:t}),qa(fl,s.chosenClass,!0))},s.ignore.split(",").forEach((function(t){Xa(fl,t.trim(),sc)})),Ia(a,"dragover",nc),Ia(a,"mousemove",nc),Ia(a,"touchmove",nc),Ia(a,"mouseup",i._onDrop),Ia(a,"touchend",i._onDrop),Ia(a,"touchcancel",i._onDrop),Ta&&this.nativeDraggable&&(this.options.touchStartThreshold=4,fl.draggable=!0),hl("delayStart",this,{evt:t}),!s.delay||s.delayOnTouchOnly&&!e||this.nativeDraggable&&(Pa||ja))o();else{if(ic.eventCanceled)return void this._onDrop();Ia(a,"mouseup",i._disableDelayedDrag),Ia(a,"touchend",i._disableDelayedDrag),Ia(a,"touchcancel",i._disableDelayedDrag),Ia(a,"mousemove",i._delayedDragTouchMoveHandler),Ia(a,"touchmove",i._delayedDragTouchMoveHandler),s.supportPointer&&Ia(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(){fl&&sc(fl),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;Ma(t,"mouseup",this._disableDelayedDrag),Ma(t,"touchend",this._disableDelayedDrag),Ma(t,"touchcancel",this._disableDelayedDrag),Ma(t,"mousemove",this._delayedDragTouchMoveHandler),Ma(t,"touchmove",this._delayedDragTouchMoveHandler),Ma(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?Ia(document,"pointermove",this._onTouchMove):Ia(document,e?"touchmove":"mousemove",this._onTouchMove):(Ia(fl,"dragend",this),Ia(vl,"dragstart",this._onDragStart));try{document.selection?cc((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(n){}},_dragStarted:function(t,e){if(Fl=!1,vl&&fl){hl("dragStarted",this,{evt:e}),this.nativeDraggable&&Ia(document,"dragover",oc);var n=this.options;!t&&qa(fl,n.dragClass,!1),qa(fl,n.ghostClass,!0),ic.active=this,t&&this._appendGhost(),pl({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(jl){this._lastX=jl.clientX,this._lastY=jl.clientY,tc();for(var t=document.elementFromPoint(jl.clientX,jl.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(jl.clientX,jl.clientY))!==e;)e=t;if(fl.parentNode[sl]._isOutsideThisEl(t),e)do{if(e[sl]){if(e[sl]._onDragOver({clientX:jl.clientX,clientY:jl.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=Fa(e));ec()}},_onTouchMove:function(t){if(Al){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=gl&&Ha(gl,!0),s=gl&&r&&r.a,a=gl&&r&&r.d,l=Yl&&Rl&&Qa(Rl),c=(i.clientX-Al.clientX+o.x)/(s||1)+(l?l[0]-Ul[0]:0)/(s||1),d=(i.clientY-Al.clientY+o.y)/(a||1)+(l?l[1]-Ul[1]:0)/(a||1);if(!ic.active&&!Fl){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))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===fl)return T(!1);if(m&&r===t.target&&(s=m),s&&(n=Ya(s)),!1!==rc(vl,r,fl,e,s,n,t,!!s))return P(),m&&m.nextSibling?r.insertBefore(fl,m.nextSibling):r.appendChild(fl),ml=r,L(),T(!0)}else if(m&&function(t,e,n){var o=Ya(Za(n.el,0,n.options,!0)),i=rl(n.el,n.options,gl),r=10;return e?t.clientXd+c*r/2:lu-Ml)return-Il}else if(l>d+c*(1-i)/2&&lu-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,ql,$l===s),0!==v){var O=Ka(fl);do{O-=v,y=ml.children[O]}while(y&&("none"===Ua(y,"display")||y===gl))}if(0===v||y===s)return T(!1);$l=s,Il=v;var _=s.nextElementSibling,N=!1,A=rc(vl,r,fl,e,s,n,t,N=1===v);if(!1!==A)return 1!==A&&-1!==A||(N=1===A),Hl=!0,setTimeout(ac,30),P(),N&&!_?r.appendChild(fl):s.parentNode.insertBefore(fl,N?_:s),x&&ol(x,0,S-x.scrollTop),ml=fl.parentNode,void 0===b||ql||(Ml=Math.abs(b-Ya(s)[E])),L(),T(!0)}if(r.contains(fl))return T(!1)}return!1}function j(a,l){hl(a,p,xa({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 rc(vl,r,fl,e,n,Ya(n),t,o)},changed:L},l))}function P(){j("dragOverAnimationCapture"),p.captureAnimationState(),p!==h&&h.captureAnimationState()}function T(e){return j("dragOverCompleted",{insertion:e}),e&&(d?c._hideClone():c._showClone(p),p!==h&&(qa(fl,Nl?Nl.options.ghostClass:c.options.ghostClass,!1),qa(fl,a.ghostClass,!0)),Nl!==p&&p!==ic.active?Nl=p:p===ic.active&&Nl&&(Nl=null),h===p&&(p._ignoreWhileAnimating=s),p.animateAll((function(){j("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(s===fl&&!fl.animated||s===r&&!s.animated)&&($l=null),a.dragoverBubble||t.rootEl||s===document||(fl.parentNode[sl]._isOutsideThisEl(t.target),!e&&nc(t)),!a.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),f=!0}function L(){xl=Ka(fl),Ol=Ka(fl,a.draggable),pl({sortable:p,name:"change",toEl:r,newIndex:xl,newDraggableIndex:Ol,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){Ma(document,"mousemove",this._onTouchMove),Ma(document,"touchmove",this._onTouchMove),Ma(document,"pointermove",this._onTouchMove),Ma(document,"dragover",nc),Ma(document,"mousemove",nc),Ma(document,"touchmove",nc)},_offUpEvents:function(){var t=this.el.ownerDocument;Ma(t,"mouseup",this._onDrop),Ma(t,"touchend",this._onDrop),Ma(t,"pointerup",this._onDrop),Ma(t,"touchcancel",this._onDrop),Ma(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;xl=Ka(fl),Ol=Ka(fl,n.draggable),hl("drop",this,{evt:t}),ml=fl&&fl.parentNode,xl=Ka(fl),Ol=Ka(fl,n.draggable),ic.eventCanceled||(Fl=!1,ql=!1,zl=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),dc(this.cloneId),dc(this._dragStartId),this.nativeDraggable&&(Ma(document,"drop",this),Ma(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),La&&Ua(document.body,"user-select",""),Ua(fl,"transform",""),t&&(kl&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),gl&&gl.parentNode&&gl.parentNode.removeChild(gl),(vl===ml||Nl&&"clone"!==Nl.lastPutMode)&&wl&&wl.parentNode&&wl.parentNode.removeChild(wl),fl&&(this.nativeDraggable&&Ma(fl,"dragend",this),sc(fl),fl.style["will-change"]="",kl&&!Fl&&qa(fl,Nl?Nl.options.ghostClass:this.options.ghostClass,!1),qa(fl,this.options.chosenClass,!1),pl({sortable:this,name:"unchoose",toEl:ml,newIndex:null,newDraggableIndex:null,originalEvent:t}),vl!==ml?(xl>=0&&(pl({rootEl:ml,name:"add",toEl:ml,fromEl:vl,originalEvent:t}),pl({sortable:this,name:"remove",toEl:ml,originalEvent:t}),pl({rootEl:ml,name:"sort",toEl:ml,fromEl:vl,originalEvent:t}),pl({sortable:this,name:"sort",toEl:ml,originalEvent:t})),Nl&&Nl.save()):xl!==El&&xl>=0&&(pl({sortable:this,name:"update",toEl:ml,originalEvent:t}),pl({sortable:this,name:"sort",toEl:ml,originalEvent:t})),ic.active&&(null!=xl&&-1!==xl||(xl=El,Ol=Sl),pl({sortable:this,name:"end",toEl:ml,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){hl("nulling",this),vl=fl=ml=gl=bl=wl=yl=Cl=Al=jl=kl=xl=Ol=El=Sl=$l=Il=Nl=_l=ic.dragged=ic.ghost=ic.clone=ic.active=null,Xl.forEach((function(t){t.checked=!0})),Xl.length=Pl=Tl=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":fl&&(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{const e=window.prompt(t.message.attr);if(e&&t.isDisabled(e))return window.alert(r.get("attributeNotPermitted",e||"")),_c.add.attrs(t);let n;e&&(n=String(window.prompt(t.message.value,"")),t.addAction(e,n))},option:t=>{t.addAction()},condition:t=>{t.addAction(t)}},click:{btn:t=>{t.action()}},save:{form:Qi}},_c={init:function(t){const e=Object.keys(Oc);return this.opts=e.reduce(((e,n)=>(e[n]={...Oc[n],...t[n]},e)),t),this},add:{attrs:t=>_c.opts.add.attr(t),options:t=>_c.opts.add.option(t),conditions:t=>(t.template={if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]},_c.opts.add.condition(t))},click:{btn:t=>_c.opts.click.btn(t)},save:{form:t=>(_c.opts.sessionStorage&&Gi.set(B,t),ts.formeoSaved({formData:t}),_c.opts.save.form(t))}},Nc=Object.freeze({type:"field",displayType:"slider"}),Ac=t=>({transform:`translateX(${t?`${t}px`:0})`});class jc{constructor(t){n(this,"toggleTabbedLayout",(()=>{this.getPanelDisplay();const t=this.isTabbed;return this.panelsWrap.parentElement.classList.toggle("tabbed-panels",t),t&&this.panelNav.removeAttribute("style"),t})),n(this,"resizePanels",(()=>{this.toggleTabbedLayout();const t=this.panelsWrap.style,e=qd.getStyle(this.currentPanel,"height");return t.height=e,e})),this.opts=Hi(Nc,t),this.panelDisplay=this.opts.displayType,this.activePanelIndex=0,this.panelNav=this.createPanelNav();const e=this.createPanelsWrap();this.nav=this.navActions();const o=new window.ResizeObserver((([{contentRect:{width:t}}])=>{this.currentWidth!==t&&(this.toggleTabbedLayout(),this.currentWidth=t,this.nav.setTranslateX(this.activePanelIndex,!1))})),i=window.setTimeout((()=>{o.observe(e),window.clearTimeout(i)}),H)}getPanelDisplay(){const t=this.panelsWrap,e=Number.parseInt(qd.getStyle(t,"width"))>390?"tabbed":"slider",n="auto"===this.opts.displayType;return this.panelDisplay=n?e:this.opts.displayType||Nc.displayType,this.panelDisplay}createPanelsWrap(){const t=qd.create({className:"panels",content:this.opts.panels.map((({config:t,...e})=>e))});return"field"===this.opts.type&&this.sortableProperties(t),this.panelsWrap=t,this.panels=t.children,this.currentPanel=this.panels[this.activePanelIndex],t}sortableProperties(t){const e=t.getElementsByClassName("field-edit-group");return Gr.forEach(e,(t=>{t.fieldId=this.opts.id,t.isSortable&&ic.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=zr(t.target,t.target.parentElement);this.nav.setTranslateX(e,!1),this.nav.groupChange(e)}},content:t.config.label}))),e={className:"panel-labels",content:{content:t}},[n]=t;return n.className="active-tab",qd.create(e)}createPanelNav(){this.labels=this.createPanelNavLabels();const t={tag:"button",attrs:{className:"next-group",title:r.get("controlGroups.nextGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.nextGroup(t)},content:qd.icon("triangle-right")},e={tag:"button",attrs:{className:"prev-group",title:r.get("controlGroups.prevGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.prevGroup(t)},content:qd.icon("triangle-left")};return qd.create({tag:"nav",attrs:{className:"panel-nav"},content:[e,this.labels,t]})}get isTabbed(){return"tabbed"===this.panelDisplay}navActions(){const t={},e=this.currentPanel.parentElement,n=this.labels.firstChild,o=n.children,i=this.currentPanel.parentElement.childNodes;this.activePanelIndex=zr(this.currentPanel,e);let r={nav:0,panel:0},s={...r};t.groupChange=t=>(this.activePanelIndex=t,this.currentPanel=i[t],qd.removeClasses(i,"active-panel"),qd.removeClasses(o,"active-tab"),this.currentPanel.classList.add("active-panel"),o[t].classList.add("active-tab"),this.currentPanel);const a=({offset:t,reset:o,duration:i=U,animate:r=!this.isTabbed})=>{const a=[Ac(s.panel),Ac(t.panel)],l=[Ac(s.nav),Ac(this.isTabbed?0:t.nav)];if(o){const[t]=a,[e]=l;a.push(t),l.push(e)}const c={easing:"ease-in-out",duration:r?i:0,fill:"forwards"},d=e.animate(a,c);n.animate(l,c);const u=()=>{this.panelsWrap.style.height=qd.getStyle(this.currentPanel,"height"),d.removeEventListener("finish",u),o||(s=t)};d.addEventListener("finish",u)};return t.setTranslateX=(t=this.activePanelIndex,o=!0)=>{var i;i=t,r={nav:-n.offsetWidth*i,panel:-e.offsetWidth*i},a({offset:r,animate:o})},t.refresh=(e=this.activePanelIndex)=>{this.activePanelIndex!==e&&t.groupChange(e),t.setTranslateX(this.activePanelIndex,!1),this.resizePanels()},t.nextGroup=()=>{const e=this.activePanelIndex+1;if(e!==i.length){const o=i[e];r={nav:-n.offsetWidth*e,panel:-o.offsetLeft},a({offset:r}),t.groupChange(e)}else r={nav:s.nav-8,panel:s.panel-8},a({offset:r,reset:!0});return this.currentPanel},t.prevGroup=()=>{if(0!==this.activePanelIndex){const e=this.activePanelIndex-1,o=i[e];r={nav:-n.offsetWidth*e,panel:-o.offsetLeft},a({offset:r}),t.groupChange(e)}else r={nav:8,panel:8},a({offset:r,reset:!0})},t}}const Pc="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`)),Tc=new RegExp(`(?!${Pc.join("|")})\\w\\S*`,"g"),Lc=/\s+/g;function Dc(t){if("string"!=typeof t)return t;if(t.trim().match(Lc))return t;return t.replace(Tc,(t=>t.charAt(0).toUpperCase()+t.substring(1).replace(/[A-Z]/g,(t=>` ${t}`))))}const kc=(t,e="-")=>t.toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,e),$c="f-autocomplete",Ic="highlight-component";let Mc,Rc=Date.now();const Fc=({name:t,id:e,...n})=>["config.label","attrs.id","meta.id"].reduce(((t,e)=>(t||(t=n.get(e)),t)),null)||"external"===t&&((...t)=>r.get(t.join("."))||Dc(t.join(" ")))(t,e);class Wc{constructor(t,e,n){this.key=t,this.className=t.replace(/\./g,"-"),this.value=e,this.events=[],this.i18nKey=n,this.build()}build(){const t=t=>{const e=this.list,n=this.getActiveOption();let o=new Map([[38,()=>{const t=this.getPreviousOption(n);t&&this.selectOption(t)}],[40,()=>{const t=this.getNextOption(n);t&&this.selectOption(t)}],[13,()=>{n&&(this.selectOption(n),this.setValue(n),"none"===e.style.display?this.showList(n):this.hideList()),t.preventDefault()}],[27,()=>{this.hideList()}]]).get(t.keyCode);return o||(o=()=>!1),o()},e={focus:({target:e})=>{this.updateOptions(),e.parentElement.classList.add(`${this.className}-focused`);const n=qd.toggleElementsByStr(this.list.querySelectorAll("li"),e.value);e.addEventListener("keydown",t);const o=this.list.querySelector(".active-option")||n[0];this.showList(o)},blur:({target:e})=>{e.parentElement.classList.remove(`${this.className}-focused`),e.removeEventListener("keydown",t),this.hideList()},input:t=>{const e=qd.toggleElementsByStr(this.list.querySelectorAll("li"),t.target.value);if(0===t.target.value.length&&this.clearValue(),0===e.length)this.hideList();else{const t=this.getActiveOption()||e[0];this.showList(t)}const n=t.target.value.trim();this.hiddenField.value=n,this.value=n}};return this.displayField=qd.create({tag:"input",autocomplete:"off",action:e,attrs:{type:"text",className:`${$c}-display-field`,value:this.label||this.value,placeholder:r.get(`${this.i18nKey}.${this.key}.placeholder`)}}),this.hiddenField=qd.create({tag:"input",attrs:{type:"hidden",className:this.className,value:this.value}}),this.list=qd.create({tag:"ul",attrs:{className:`${$c}-list`}}),this.dom=qd.create({children:[this.displayField,this.hiddenField,this.list],className:this.className,action:{onRender:()=>{const t=this.value&&Wd.getAddress(this.value);this.label=t&&Fc(t),this.label&&(this.displayField.value=this.label),this.updateOptions()}}}),this.dom}updateOptions(){const t=Date.now();t-Rc>H&&(qd.empty(this.list),this.generateOptions(),Rc=t);const e=Mc||this.generateOptions();for(const n of e)this.list.appendChild(n)}generateOptions(){const t=(t=>{const e=[],n=Wd.flatList(),o=Object.entries(n).map((([n,o])=>{const i=Fc(o);if(i){const r={tag:"span",content:` ${Dc(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=`${$c}-list-item`;return t.classList.contains(e)||(t=t.parentElement),t};return Mc=t.map((t=>{const{value:n,textLabel:o,htmlLabel:i}=t,r={tag:"li",children:i,dataset:{value:n,label:o},className:`${$c}-list-item`,action:{mousedown:({target:t})=>{t=e(t),this.setValue(t),this.selectOption(t),this.hideList()},mouseover:({target:t})=>{t=e(t),this.removeHighlight(),this.highlightComponent(t)}}};return qd.create(r)})),Mc}hideList(t=this.list){Zr.slideUp(t,U),this.removeHighlight()}showList(t,e=this.list){this.selectOption(t),Zr.slideDown(e,U)}getActiveOption(t=this.list){const e=t.getElementsByClassName("active-option")[0];return e&&"none"!==e.style.display?e:null}getPreviousOption(t){let e=t;do{e=e?e.previousSibling:null}while(null!=e&&"none"===e.style.display);return e}getNextOption(t){let e=t;do{e=e?e.nextSibling:null}while(null!=e&&"none"===e.style.display);return e}selectOption(t,e=this.list){var n;const o=e.querySelectorAll("li");for(const i of o){const{dataset:{value:t}}=i;if(i.classList.remove("active-option"),t){null==(n=Wd.getAddress(t).dom)||n.classList.remove(Ic)}}t&&(t.classList.add("active-option"),this.highlightComponent(t))}removeHighlight(){const t=document.getElementsByClassName(Ic);for(const e of t)e.classList.remove(Ic)}highlightComponent(t){var e;const{dataset:{value:n}}=t;if(n){null==(e=Wd.getAddress(n).dom)||e.classList.add(Ic)}}clearValue(){this.selectOption(null),this.displayField.value="",this.hiddenField.value="",this.value="",this.runEvent("onChange",{target:this.hiddenField})}setValue(t){const{label:e,value:n}=t.dataset;this.displayField.value=e,this.hiddenField.value=n,this.value=n,this.runEvent("onChange",{target:this.hiddenField})}addEvent(t,e){this.events.push([t,e])}runEvent(t,e){for(const[n,o]of this.events)n===t&&o(e)}}const Bc=(t,e)=>{const n=(t=>{const e=Ji(t),n={"field.property":Z,...J},o=e?(i=t,Wd.getAddress(i).getData()):n[t];var i;return Object.keys(o).reduce(((t,e)=>(t[e]=e,t)),{})})(t);return Object.entries(n).reduce(((n,[o,i])=>{if("id"!==o){const s={tag:"option",content:r.get(`${t}.${o}`)||o.toLowerCase(),attrs:{value:i}};e===i&&(s.attrs.selected=!0),n.push(qd.create(s))}return n}),[])},zc=(t,e)=>{qd.empty(t);for(const n of e)t.add(n)},qc=({key:t,value:e,type:n="text",checked:o})=>{const i={tag:"input",attrs:{type:n,value:e,placeholder:r.get(`${t}.placeholder`)||Dc(t)},className:t.replace(/\./g,"-"),config:{}};return o&&(i.attrs.checked=!0),i},Uc=t=>{const e=r.get(t);if(e)return e;const n=t.split(".");return r.get(n[n.length-1])},Hc={autocomplete:(t,e,n)=>new Wc(t,e,n),string:(t,e)=>qc({key:t,value:e}),boolean:(t,e)=>qc({key:t,value:e,type:"selected"===t?"radio":"checkbox",checked:e}),number:(t,e)=>qc({key:t,value:e,type:"number"}),array:(t,e=[])=>({tag:"select",attrs:{placeholder:Uc(`placeholder.${t}`)},className:t.replace(/\./g,"-"),options:e}),object:t=>Object.entries(t).map((([t,e])=>Hc[qd.childType(e)](t,e)))},Xc=["selected","checked"],Vc={boolean:(t,e)=>({click:({target:{checked:n}})=>{var o,i;"radio"===(null==(i=null==(o=e.data)?void 0:o.attrs)?void 0:i.type)&&e.set("options",e.data.options.map((t=>({...t,selected:!1})))),e.set(t,n)}}),string:(t,e)=>({input:({target:{value:n}})=>{e.set(t,n)}}),number:(t,e)=>({input:({target:{value:n}})=>{e.set(t,Number(n))}}),array:(t,e)=>({change:({target:{value:n}})=>{e.set(t,n)}}),object:()=>({})};class Yc{constructor({key:t,data:e,index:o,field:i}){n(this,"generateConditionFields",((t,e)=>{const n={tag:"label",className:`condition-label ${t}-condition-label`,content:r.get(t)||t};return e.map(((e,o)=>{const i=[],r=Object.entries(e).map((([e,n])=>{const r=this.conditionInput(e,n,t,o);return r&&i.push([r.className,n.trim()].filter(Boolean).join("-")),r})).filter(Boolean),s=qr(r,G.map((t=>`condition-${t}`)),"className||dom.className");return this.processConditionUIState(s),o||s.unshift(n),this.itemFieldGroups.push(s),{children:s,className:`f-condition-row ${t}-condition-row ${i.join(" ")}`}}))})),n(this,"processConditionUIState",(t=>{const e=e=>(e=e.split("|"),t.filter((t=>e.includes(t.className)))),n=t=>{t=Array.isArray(t)?t:[t];const e=setTimeout((()=>{t.forEach((t=>{t.dom&&(t=t.dom),t.style.display="none"})),clearTimeout(e)}),q)},o=t=>{t=Array.isArray(t)?t:[t];const e=setTimeout((()=>{t.forEach((t=>{t.dom&&(t=t.dom),t.removeAttribute("style")})),clearTimeout(e)}),q)},i=new Map([["condition-source",t=>{const i=e("condition-sourceProperty"),r=i[0],s=Ji(t.value)?t.value:"field.property",a=Bc(s,r.value);return zc(r,a),t.value?o(i):n(i)}],["condition-target",t=>{const i=e("condition-targetProperty");return Zi(t.value)&&t.value?o(i):n(i)}],["condition-sourceProperty",t=>{const i=e("condition-comparison|condition-targetProperty|condition-target"),r=t.value;return(t=>/^is|^has/.test(t))(r.substring(r.lastIndexOf(".")+1,r.length))?n(i):o(i)}]]);for(const r of t){const t=i.get(r.className);t&&t(r)}})),n(this,"conditionInput",((t,e,n,o)=>{const i=this.field,r=`${this.itemKey}.${n}.${o}`,s=`${this.field.id}.${r}`,a=`${i.name}s.${s}.${t}`,l=(t,e,n)=>{const o=Bc(n||t,e),i=Hc.array(`condition.${t}`);i.action={change:c,onRender:t=>c({target:t})};const r=qd.create(i);return zc(r,o),r},c=({target:t})=>{const e=t.closest(".f-condition-row"),n=new RegExp(`${t.className}(?:\\S?)+`,"gm");e.className=e.className.replace(n,""),e.classList.add([t.className,t.value].filter(Boolean).join("-"));const o={dataPath:a,value:t.value,src:t};ts.formeoUpdated(o),Wd.setAddress(a,t.value);const i=t.closest(".f-condition-row"),r=zr(i);this.processConditionUIState(this.itemFieldGroups[r])},d={comparison:t=>l("comparison",t),logical:t=>l("logical",t),source:(t,e="source")=>{const o=Hc.autocomplete(`condition.${e}`,t,n);return Wd.setConditionMap(t,i),o.addEvent("onChange",(t=>{Wd.removeConditionMap(Wd.getAddress(a)),c(t),Wd.setConditionMap(t.target.value,i)})),o},sourceProperty:t=>l("sourceProperty",t,"field.property"),targetProperty:t=>l("targetProperty",t,"field.property"),target:t=>d.source(t,"target"),value:t=>{const e=Hc.string("condition.value",t);return e.action={input:c},qd.create(e)},assignment:t=>l("assignment",t)};if(d[t])return d[t](e)})),this.itemValues=qr(Object.entries(e),Xc,"0");const[s,a]=t.split(".");this.field=i,this.itemKey=t,this.itemIndex=o,this.panelName=s,this.isDisabled=i.isDisabledProp(a,s),this.isHidden=this.isDisabled&&i.config.panels[s].hideDisabled,this.isLocked=i.isLockedProp(a,s),this.dom=qd.create({tag:"li",className:[`field-${t.replace(/\./g,"-")}`,"prop-wrap",this.isHidden&&"hidden-property"],children:{className:"field-prop",children:[this.itemInputs,this.itemControls]}})}get itemInputs(){this.itemFieldGroups=[];return{className:`${this.panelName}-prop-inputs prop-inputs f-input-group`,children:this.itemValues.map((([t,e])=>{let n="conditions"===this.panelName?this.generateConditionFields(t,e):this.itemInput(t,e);return["selected","checked"].includes(t)&&(n={className:"f-addon",children:n}),n}))}}get itemControls(){if(this.isLocked){return{className:`${this.panelName}-prop-controls prop-controls`,content:[]}}const t={tag:"button",attrs:{type:"button",className:"prop-remove prop-control"},action:{click:()=>{Zr.slideUp(this.dom,250,(t=>{this.field.remove(this.itemKey),qd.remove(t),this.field.resizePanelWrap()}))}},content:qd.icon("remove")};return{className:`${this.panelName}-prop-controls prop-controls`,content:[t]}}itemInput(t,e){const n=qd.childType(e)||"string",o={config:{},attrs:{},...Hc[n](t,e)},i=this.itemKey.replace(/.\d+$/,(e=>`${e}.${t}`)),r=i.split(".").filter(Number.isNaN).join(".")||t,[s,a]=[[...this.itemKey.split("."),t],[t]].map((t=>[this.field.id,...t].filter(Boolean).join("-")));return o.config={...o.config,label:"options"!==this.panelName&&(Uc(r)||Dc(r)),labelAfter:!1},o.attrs={...o.attrs,name:"checkbox"===o.attrs.type?`${a}[]`:a,id:s,disabled:this.isDisabled,locked:this.isLocked},o.action={...Vc[n](i,this.field)},o}}class Gc{constructor(t,e,o){n(this,"addAttribute",((t,e)=>{const n=kc(t),o=`attrs.${n}`;r.current[o]||r.put(o,Vr(t)),"string"==typeof e&&["true","false"].includes(e)&&(e=JSON.parse(e)),this.field.set(`attrs.${t}`,e);const i=this.props.querySelector(`.field-attrs-${n}`),s=new Yc({key:o,data:{[n]:e},field:this.field});i?this.props.replaceChild(s.dom,i):this.props.appendChild(s.dom),this.field.resizePanelWrap()})),n(this,"addOption",(()=>{const t=this.field.data.meta.id,e=this.field.get("options"),n="select"===t?"option":t,o=r.get("newOptionLabel",{type:n})||"New Option",i=`options.${this.data.length}`,s=e[e.length-1],a={...e.length?s:{},label:o};"button"!==t&&(a.value=kc(o));const l=new Yc({key:i,data:a,field:this.field,index:this.props.children.length});this.editPanelItems.push(l),this.props.appendChild(l.dom),this.field.set(i,a),this.field.resizePanelWrap()})),n(this,"addCondition",(t=>{const e=`conditions.${this.field.get("conditions").length}`,n=this.props.querySelector(`.field-${e.replace(".","-")}`),o=new Yc({key:e,data:t.template,field:this.field});n?this.props.replaceChild(o.dom,n):this.props.appendChild(o.dom),this.field.set(e,t.template),this.field.resizePanelWrap()})),this.type=qd.childType(t),this.data="object"===this.type?Object.entries(t):t,this.name=e,this.field=o,this.panelConfig=this.getPanelConfig(this.data)}getPanelConfig(t){return this.props=this.createProps(t),this.editButtons=this.createEditButtons(),{id:`${this.field.id}-${this.name}-panel`,config:{label:r.get(`panel.label.${this.name}`)},attrs:{className:`f-panel ${this.name}-panel`},children:[this.props,this.editButtons]}}createProps(t){this.editPanelItems=Array.from(t).map(((t,e)=>{const n="array"===this.type,o=[this.name,n?String(e):t[0]].join("."),i=n?t:{[t[0]]:t[1]};return new Yc({key:o,data:i,field:this.field})}));const e={tag:"ul",attrs:{className:["field-edit-group",`field-edit-${this.name}`]},editGroup:this.name,isSortable:"options"===this.name,content:this.editPanelItems};return qd.create(e)}createEditButtons(){const t=this,e=this.name,n=r.get(`panelEditButtons.${e}`),o={attrs:t.addAttribute,options:t.addOption,conditions:t.addCondition};return{className:"panel-action-buttons",content:[{...qd.btnTemplate({content:n,title:n}),className:`add-${e}`,action:{click:n=>{const i={btnCoords:qd.coords(n.target),addAction:o[e]};"attrs"===e&&(i.isDisabled=t.field.isDisabledProp,i.isLocked=t.field.isLockedProp,i.message={attr:r.get(`action.add.${e}.attr`),value:r.get(`action.add.${e}.value`)});const s=Dc(e),a=new window.CustomEvent(`onAdd${s}`,{detail:i});_c.add[e](i),document.dispatchEvent(a)}}}]}}}class Zc extends Ca{constructor(t,e={},o){super(t,{...e,id:e.id||Ui()}),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)?Br(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 Ur(n,(t=>t.remove())),this.dom.parentElement.removeChild(this.dom),((t,e)=>{const n=t.indexOf(e);-1!==n&&t.splice(n,1)})(Wd.getAddress(`${e.name}s.${e.id}.children`),this.id),e.children.length||e.emptyClass(),"row"===e.name&&e.autoColumnWidths(),Wd[`${this.name}s`].delete(this.id)})),n(this,"emptyClass",(()=>this.dom.classList.toggle("empty",!this.children.length))),n(this,"getComponentTag",(()=>qd.create({tag:"span",className:["component-tag",`${this.name}-tag`],children:[(this.isColumn||this.isField)&&qd.icon("component-corner",{className:"bottom-left"}),qd.icon(`handle-${this.name}`),Dc(this.name),(this.isColumn||this.isRow)&&qd.icon("component-corner",{className:"bottom-right"})].filter(Boolean)}))),n(this,"removeClasses",(t=>{const e={string:()=>this.dom.classList.remove(t),array:()=>t.map((t=>this.dom.classList.remove(t)))};return e.object=e.string,e[qd.childType(t)](this.dom)})),n(this,"loadChildren",((t=this.data.children)=>t.map((t=>this.addChild({id:t}))))),n(this,"saveChildOrder",(()=>{if(this.render)return;const t=this.children.map((({id:t})=>t));return this.set("children",t),t})),n(this,"onSort",(()=>this.saveChildOrder())),n(this,"onEnd",(({to:{parentElement:t},from:{parentElement:e}})=>{null==t||t.classList.remove(`hovering-${zi(t)}`),null==e||e.classList.remove(`hovering-${zi(e)}`)})),n(this,"runConditions",(()=>{const t=this.get("conditions");if(!(null==t?void 0:t.length))return null;return t.map((t=>{const e=this.processConditions(t.if),n=this.processResults(t.then);return e.map((t=>this.evaluateConditions(t)&&this.execResults(n)))}))})),n(this,"value",((t,e)=>{const n=t.split("."),o=this.getComponent(t),i=o&&n.slice(2,n.length).join(".");return[!o,!i,!Z[i]].some(Boolean)?t:e?o.set(Z[i],e):o.get(Z[i])})),n(this,"getResult",(t=>({"=":(t,e,n)=>t.set(e,n)}[t]))),n(this,"processResults",(t=>t.map((({operator:t,target:e,value:n})=>{const o=this.getComponent(e);return{target:o,propertyPath:o&&e.split(".").slice(2,e.length).join("."),action:this.getResult(t),value:this.value(n)}})))),n(this,"execResults",(t=>{const e=t.map((t=>this.execResult(t)));return Promise.all(e)})),n(this,"execResult",(({target:t,action:e,value:n,propertyPath:o})=>new Promise(((o,i)=>{try{return o(e(t,n))}catch(r){return i(r)}})))),n(this,"cloneData",(()=>{const t={...Xi(this.data),id:Ui()};return"field"!==this.name&&(t.children=[]),t})),n(this,"clone",((t=this.parent)=>{const e=t.addChild(this.cloneData(),this.index+1);return"field"!==this.name&&this.cloneChildren(e),e})),n(this,"createChildWrap",(t=>qd.create({tag:"ul",attrs:{className:"children"},children:t}))),this.id=this.data.id,this.name=t,this.config=Wd[`${this.name}s`].config,Hi(this.config,e.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.data.children=this.data.children.filter((e=>-1===t.indexOf(e))),this.dom.classList.add("empty"),t}getActionButtons(){const t=[`hovering-${this.name}`,"hovering"];return{className:[`${this.name}-actions`,"group-actions"],action:{mouseenter:()=>{Wd.stages.active.dom.classList.add(`active-hover-${this.name}`),this.dom.classList.add(...t)},mouseleave:({target:e})=>{this.dom.classList.remove(...t),Wd.stages.active.dom.classList.remove(`active-hover-${this.name}`),e.removeAttribute("style")}},children:[{...qd.btnTemplate({content:qd.icon(`handle-${this.name}`)}),className:["component-handle",`${this.name}-handle`]},{className:["action-btn-wrap",`${this.name}-action-btn-wrap`],children:this.buttons}]}}toggleEdit(t=!this.isEditing){this.isEditing=t;const e=this.dom,n="editing",o=`${n}-${this.name}`,i=this.dom.querySelector(`.${this.name}-edit`);Zr.slideToggle(i,q,t),"field"===this.name&&(Zr.slideToggle(this.preview,q,!t),e.parentElement.classList.toggle(`column-${o}`,t)),e.classList.toggle(n,t),e.classList.toggle(o,t)}get buttons(){if(this.actionButtons)return this.actionButtons;const t={handle:(t=`handle-${this.name}`)=>({...qd.btnTemplate({content:qd.icon(t)}),className:["component-handle"]}),move:(t="move")=>({...qd.btnTemplate({content:qd.icon(t)}),className:["item-move"],meta:{id:"move"}}),edit:(t="edit")=>({...qd.btnTemplate({content:qd.icon(t)}),className:["item-edit-toggle"],meta:{id:"edit"},action:{click:t=>{this.toggleEdit()}}}),remove:(t="remove")=>({...qd.btnTemplate({content:qd.icon(t)}),className:["item-remove"],meta:{id:"remove"},action:{click:(t,e)=>{Zr.slideUp(this.dom,q,(()=>{if("column"===this.name){this.parent.autoColumnWidths(),this.remove()}else this.remove()}))}}}),clone:(t="copy")=>({...qd.btnTemplate({content:qd.icon(t)}),className:["item-clone"],meta:{id:"clone"},action:{click:()=>{this.clone(this.parent),"column"===this.name&&this.parent.autoColumnWidths()}}})},{buttons:e,disabled:n}=this.config.actionButtons,o=e.filter((t=>!n.includes(t))).map((e=>{var n;return(null==(n=t[e])?void 0:n.call(t))||e}));return this.actionButtons=o,this.actionButtons}get index(){return zr(this.dom)}get parentType(){return R.get(this.name)}get parent(){const t=this.parentType;if(!this.dom||!t)return null;const e=this.dom.closest(`.${T[t]}`);return e&&qd.asComponent(e)}get children(){if(!this.dom)return[];const t=this.domChildren,e=M.get(this.name);return Hr(t,(t=>Wd.getAddress(`${e}s.${t.id}`))).filter(Boolean)}get domChildren(){const t=this.dom.querySelector(".children");return t?t.children:[]}addChild(t={},e=this.domChildren.length){var n,o;let i=t;"object"!=typeof t&&(i={id:i});const r=this.dom.querySelector(".children"),{id:s=Ui()}=i,a=M.get(this.name);if(!a)return null;const l=`${a}s`,c=Wd.getAddress(`${l}.${s}`)||Wd[l].add(s,i);r.insertBefore(c.dom,r.children[e]),null==(o=null==(n=this.config.events)?void 0:n.onAddChild)||o.call(n,{parent:this,child:c});const d=c.get("children");return(null==d?void 0:d.length)&&c.loadChildren(d),this.removeClasses("empty"),this.saveChildOrder(),c}onAdd({from:t,to:e,item:n,newIndex:o}){var i;t.classList.contains(y)||(t=t.parentElement);const r=zi(t),s=zi(e.parentElement),a=new Map([[-2,()=>{const t=this.addChild({},o).addChild();return t.addChild.bind(t)}],[-1,()=>{const t=this.addChild({},o);return t.addChild.bind(t)}],[0,()=>this.addChild.bind(this)],[1,t=>{const e=zr(this.dom);return()=>this.parent.addChild(t,e+1)}],[2,t=>()=>this.parent.parent.addChild(t)]]),l={controls:()=>{const{controlData:t}=vd.get(n.id),{meta:{id:e}}=t,i=e.startsWith("layout-")?e.replace(/^layout-/,""):"field",r=Fr({stage:{row:0,column:-1,field:-2},row:{row:1,column:0,field:-1},column:{row:2,column:1,field:0},field:1},`${this.name}.${i}`),s=a.get(r)();qd.remove(n);return s(t,o)},row:()=>{const t=(a.get({stage:-1,row:0,column:1}[s])||Qi)();return null==t?void 0:t({id:n.id},o)},column:()=>{const t=(a.get({stage:-2,row:-1}[s])||Qi)();return null==t?void 0:t(n.id)}},c=null==(i=l[r])?void 0:i.call(l,n,o);return(()=>{this.saveChildOrder(),this.removeClasses("empty")})(),c}onRemove({from:{parentElement:t}}){return t.classList.contains(E)&&t.classList.remove("column-editing-field"),"stage"===this.name||this.children.length?(this.emptyClass(),this.saveChildOrder()):this.remove()}onRender(){const{events:t}=this.config;if(!t)return null;t.onRender&&qd.onRender(this.dom,t.onRender)}set config(t){const e=Fr(this.data,"meta.id"),n=[Fr(t,"all"),e&&Fr(t,e),Fr(t,this.id)].reduce(((t,e)=>e?Hi(t,e):t),this.configVal);this.configVal=n}get config(){return this.configVal}getComponent(t){const[e,n]=t.split("."),o=Wd[e];return n===this.id?this:null==o?void 0:o.get(n)}cloneChildren(t){for(const e of this.children)null==e||e.clone(t)}get isRow(){return this.name===j.row}get isColumn(){return this.name===j.column}get isField(){return this.name===j.field}}class Jc extends Zc{constructor(t=Object.create(null)){super("field",{conditions:[{if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]}],...t}),n(this,"updateConditionsPanel",Ki((()=>{const t=this.editPanels.find((({name:t})=>"conditions"===t));if(!t)return null;const e=t.createProps(),n=this.dom.querySelector(".field-edit-conditions");n.parentElement.replaceChild(e,n)}),q)),n(this,"updatePreview",(()=>{if(!this.preview.parentElement)return null;this.updateLabel();const t=qd.create(this.fieldPreview(),!0);this.preview.parentElement.replaceChild(t,this.preview),this.preview=t})),n(this,"updateEditPanels",(()=>{this.editPanels=[];const t=["object","array"],e=qi([...this.config.panels.order,...Object.keys(this.data)]),n=["config","meta","action","events",...this.config.panels.disabled],o=e.filter((t=>!n.includes(t)));for(const r of o){const e=this.get(r),n=qd.childType(e);if(t.includes(n)){const t=new Gc(e,r,this);this.editPanels.push(t)}}const i={panels:this.editPanels.map((({panelConfig:t})=>t)),id:this.id,displayType:"auto"};this.panels=new jc(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${Dc(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${Dc(e)}`)).includes(t)})),this.debouncedUpdateEditPanels=function(t,e=333){let n;return function(...o){n&&clearTimeout(n),n=setTimeout((()=>t.apply(this,o)),e)}}(this.updateEditPanels),this.label=qd.create(this.labelConfig),this.preview=qd.create({}),this.editPanels=[];const e=this.getActionButtons(),o=this.actionButtons.some((t=>{var e;return"edit"===(null==(e=t.meta)?void 0:e.id)}));let i={tag:"li",attrs:{className:x},id:this.id,children:[this.label,this.getComponentTag(),e,o&&this.fieldEdit,this.preview].filter(Boolean),panelNav:this.panelNav,dataset:{hoverTag:r.get("field")}};i=qd.create(i),this.observe(i),this.dom=i,this.isEditing=!1,this.onRender(i)}get labelConfig(){if(!!this.get("config.hideLabel"))return;const t=this.get("config.editorLabel")||this.get("config.label"),e=this.get("attrs.required"),n=this.config.label.disableHTML;return{className:"prev-label",children:[{...(()=>{const e={tag:"label",attrs:{}};return n?(e.tag="input",e.attrs.value=t,e):(e.attrs.contenteditable=!0,e.children=t,e)})(),action:{input:({target:{innerHTML:t,innerText:e,value:o}})=>{super.set("config.label",n?o:t);const i=Wd.getConditionMap(`fields.${this.id}`);if(i)return i.updateConditionSourceLabel(`${this.name}s.${this.id}`,n?o:e)}}},e&&qd.requiredMark()]}}updateConditionSourceLabel(t,e){const n=this.editPanels.find((({name:t})=>"conditions"===t));if(!n)return null;for(const{itemFieldGroups:o}of n.editPanelItems)for(const n of o){const o=n.find((e=>e.value===t));o&&(o.displayField.value=e)}}set(...t){const[e,n]=t,o=super.set(e,n);return this.updatePreview(),o}updateLabel(){if(!this.label)return null;const t=qd.create(this.labelConfig);this.label.parentElement.replaceChild(t,this.label),this.label=t}get fieldEdit(){const t={className:["field-edit","slide-toggle","formeo-panels-wrap"]};this.updateEditPanels();const e=this.editPanels.length;return e&&(t.className.push(`panel-count-${e}`),t.content=[this.panels.panelNav,this.panels.panelsWrap],this.panelNav=this.panels.nav,this.resizePanelWrap=this.panels.nav.refresh),t.action={onRender:()=>{if(0===e){const t=this.dom,e=t.querySelector(".item-edit-toggle"),n=t.querySelector(".field-actions"),o=n.getElementsByTagName("button");n.style.maxWidth=o.length*o[0].clientWidth+"px",qd.remove(e)}else this.resizePanelWrap()}},qd.create(t)}get defaultPreviewActions(){return{change:t=>{const{target:e}=t,{type:n}=e;if(["checkbox","radio"].includes(n)){const t=+e.id.split("-").pop();this.toggleCheckedOptions(t,n),this.debouncedUpdateEditPanels()}},click:t=>{"true"===t.target.contentEditable&&t.preventDefault()},input:t=>{if(["input","meter","progress","button"].includes(t.target.tagName.toLowerCase()))return super.set("attrs.value",t.target.value),this.debouncedUpdateEditPanels();if(t.target.contentEditable){const e=t.target.parentElement.classList;if(e.contains("f-checkbox")||e.contains("f-radio")){const e=t.target.parentElement,n=e.parentElement,o=zr(e,n);return super.set(`options[${o}].label`,t.target.innerHTML),this.debouncedUpdateEditPanels()}super.set("content",t.target.innerHTML)}}}}fieldPreview(){var t;const e=Xi(this.data),{action:n={}}=vd.get(e.meta.id);e.id=`prev-${this.id}`,e.action=n,(null==(t=this.data)?void 0:t.config.editableContent)&&(e.attrs={...e.attrs,contenteditable:!0});return{attrs:{className:"field-preview",style:this.isEditing&&"display: none;"},content:qd.create(e,!0),action:this.defaultPreviewActions}}}const Kc={js:new Set,css:new Set},Qc=(t,e,n=tr)=>new Promise((o=>fetch(t).then((t=>{if(!t.ok)return o(n(t));o(e?e(t):t)})).catch((t=>n(t))))),td=(t,e)=>{t.removeEventListener("load",td),e(t.src)},ed=(t,e)=>{t.removeEventListener("load",ed),e(t.src)},nd=t=>new Promise(((e,n)=>{if(Kc.js.has(t))return e(t);Kc.js.add(t);const o=qd.create({tag:"script",attrs:{type:"text/javascript",async:!0,src:t},action:{load:()=>ed(o,e),error:()=>n(new Error(`${t} failed to load.`))}});document.head.appendChild(o)})),od=t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>new Promise(((e,n)=>{if(Kc.css.has(t))return e(t);Kc.css.add(t);const o=qd.create({tag:"link",attrs:{rel:"stylesheet",href:t},action:{load:()=>td(o,e),error:()=>n(new Error(`${(void 0).src} failed to load.`))}});document.head.appendChild(o)}))));return Promise.all(e)},id=async(t=g)=>{if(document.getElementById(f))return;const e=async t=>(t=>{let e=document.getElementById(f);return e||(e=qd.create({id:f,children:t,attrs:{hidden:!0,style:"display: none;"}}),document.body.insertBefore(e,document.body.childNodes[0])),e})(await t.text());return Qc(t,e,(()=>Qc(v,e)))},rd={js:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>nd(t)));return Promise.all(e)},css:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>od(t)));return Promise.all(e)}},sd=t=>{const e=Object.entries(t).map((([t,e])=>rd[t](e)));return Promise.all(e)},ad=()=>{const t=document.getElementById(f);return"hidden"===window.getComputedStyle(t).visibility};class ld{constructor({events:t={},dependencies:e={},controlAction:o,...i}){n(this,"controlCache",new Set),this.events=t,this.controlData=i,this.controlAction=o,this.dependencies=e,this.id=i.id||Ui()}get controlId(){var t;return null==(t=this.controlData.meta)?void 0:t.id}get dom(){const{meta:t,config:e}=this.controlData,n=this.i18n(e.label)||e.label,o={tag:"button",attrs:{type:"button"},content:[{tag:"span",className:"control-icon",children:qd.icon(t.icon)},n],action:{focus:({target:t})=>{const e=t.closest(`.${y}`);return e&&vd.panels.nav.refresh(zr(e))},click:({target:t})=>{vd.addElement(t.parentElement.id)}}};return qd.create({tag:"li",id:this.id,className:["field-control",`${t.group}-control`,`${t.id}-control`],content:o,meta:t,action:this.controlAction})}promise(){return sd(this.dependencies)}i18n(t,e){var n,o;const i=r.locale,s=null==(n=this.definition)?void 0:n.i18n,a=(null==s?void 0:s[i])||{};return((null==(o=a[t])?void 0:o.call(a))??a[t])||r.get(t,e)}}const cd=[{config:{label:"row"},meta:{group:"layout",icon:"rows",id:"layout-row"}},{config:{label:"column"},meta:{group:"layout",icon:"columns",id:"layout-column"}}];const dd=(t,e=3)=>Array.from({length:e},((t,e)=>e+1)).map((e=>{const n="checkbox"===t?"checked":"selected";return{label:r.get("labelCount",{label:Dc(t),count:e}),value:`${t}-${e}`,[n]:!e}}));const ud=[class extends ld{constructor(){super({tag:"button",attrs:{className:[{label:"grouped",value:"f-btn-group"},{label:"ungrouped",value:"f-field-group"}]},config:{label:r.get("controls.form.button"),hideLabel:!0},meta:{group:"common",icon:"button",id:"button"},options:[{label:r.get("button"),type:["button","submit","reset"].map(((t,e)=>({label:t,type:t}))),className:[{label:"default",value:"",selected:!0},{label:"primary",value:"primary"},{label:"danger",value:"error"},{label:"success",value:"success"},{label:"warning",value:"warning"}]}]})}},class extends ld{constructor(){super({tag:"input",attrs:{type:"date",required:!1,className:""},config:{label:r.get("controls.form.input.date")},meta:{group:"common",icon:"calendar",id:"date-input"}})}},class extends ld{constructor(){super({tag:"input",attrs:{type:"hidden",value:""},config:{label:r.get("hidden"),hideLabel:!0},meta:{group:"common",icon:"hidden",id:"hidden"}})}},class extends ld{constructor(){super({tag:"input",attrs:{type:"number",required:!1,className:""},config:{label:r.get("number")},meta:{group:"common",icon:"hash",id:"number"}})}},class extends ld{constructor(){super({tag:"textarea",config:{label:r.get("controls.form.textarea")},meta:{group:"common",icon:"textarea",id:"textarea"},attrs:{required:!1}})}},class extends ld{constructor(){super({tag:"input",attrs:{required:!1,type:"text",className:""},config:{label:r.get("controls.form.input.text")},meta:{group:"common",icon:"text-input",id:"text-input"}})}},class extends ld{constructor(){super({tag:"input",attrs:{type:"file",required:!1},config:{label:r.get("fileUpload")},meta:{group:"common",icon:"upload",id:"upload"}})}},class extends ld{constructor(){super({tag:"select",config:{label:r.get("controls.form.select")},attrs:{required:!1,className:""},meta:{group:"common",icon:"select",id:"select"},options:dd("option")})}},class extends ld{constructor(){super({tag:"input",attrs:{type:"checkbox",required:!1},config:{label:r.get("controls.form.checkbox-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"checkbox",id:"checkbox"},options:dd("checkbox",1)})}},class extends ld{constructor(){super({tag:"input",attrs:{type:"radio",required:!1},config:{label:r.get("controls.form.radio-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"radio-group",id:"radio"},options:dd("radio")})}}],hd=Array.from(Array(5).keys()).slice(1).map((t=>`h${t}`)),pd="controls.html.header";const fd=[class extends ld{constructor(){super({tag:hd[0],attrs:{tag:hd.map(((t,e)=>({label:t.toUpperCase(),value:t,selected:!e}))),className:""},config:{label:r.get(pd),hideLabel:!0,editableContent:!0},meta:{group:"html",icon:"header",id:"html.header"},content:r.get(pd),action:{}})}static get definition(){return{i18n:{"en-US":{header:"Custom English Header"}}}}get content(){return super.i18n(pd)}},class extends ld{constructor(){super({tag:"p",attrs:{className:""},config:{label:r.get("controls.html.paragraph"),hideLabel:!0,editableContent:!0},meta:{group:"html",icon:"paragraph",id:"paragraph"},content:"Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment."})}},class extends ld{constructor(){super({tag:"hr",config:{label:r.get("controls.html.divider"),hideLabel:!0},meta:{group:"html",icon:"divider",id:"divider"}})}},class extends ld{constructor(t){super(Hi({tag:"textarea",config:{label:"WYSIWYG",editableContent:!0},meta:{group:"html",icon:"rich-text",id:"tinymce"},attrs:{required:!1},dependencies:{js:"https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.9.11/tinymce.min.js"},action:{onRender:t=>{const e=`#${t.id}`;window.tinymce.remove(e),window.tinymce.init({selector:e})}},controlAction:{click:()=>{},onRender:()=>{}}},t))}}],md=Object.freeze({sortable:!0,elementOrder:{},groupOrder:[],groups:[{id:"layout",label:"controls.groups.layout",elementOrder:["row","column"]},{id:"common",label:"controls.groups.form",elementOrder:["button","checkbox"]},{id:"html",label:"controls.groups.html",elementOrder:["header","block-text"]}],disable:{groups:[],elements:[],formActions:[]},elements:[],container:null,panels:{displayType:"slider"}}),gd=[...ud,...fd,...cd];const vd=new class{constructor(){n(this,"groupLabel",(t=>r.get(t)||t||"")),n(this,"addElement",(t=>{const e=Fr(this.get(t),"controlData"),{meta:{group:n,id:o}}=e,i={row:()=>Dd.active.addChild(),column:()=>i.row().addChild(),field:t=>i.column().addChild(t)};return"layout"!==n?i.field(e):i[o.replace("layout-","")]()})),n(this,"applyOptions",(async(t={})=>{const{container:e,elements:n,groupOrder:o,...i}=Hi(md,t);return this.container=e,this.groupOrder=qi(o.concat(["common","html","layout"])),this.options=i,Promise.all(this.registerControls([...gd,...n]))})),this.data=new Map,this.buttonActions={focus:({target:t})=>{const e=t.closest(`.${y}`);return e&&this.panels.nav.refresh(zr(e))},click:({target:t})=>{this.addElement(t.parentElement.id)}}}async init(t,e=!1){return await this.applyOptions(t),this.buildDOM(e),this}registerControls(t){return this.controls=[],t.map((async t=>{let e;return e="function"==typeof t?new t:new ld(t),this.add(e),this.controls.push(e.dom),e.promise()}))}groupElements(){let t=this.options.groups.slice(),e=this.controls.slice(),n=[];const o=[];return t=qr(t,this.groupOrder,"id"),t=t.filter((t=>Bi(t.id,this.options.disable.groups))),n=t.map((t=>{const n={tag:"ul",attrs:{className:y,id:`${t.id}-${y}`},config:{label:this.groupLabel(t.label)}};if(this.options.elementOrder[t.id]){const e=this.options.elementOrder[t.id],n=qi(e.concat(t.elementOrder));t.elementOrder=n}return e=qr(e,t.elementOrder,"meta.id"),n.content=e.filter((e=>{const{controlData:n}=this.get(e.id),i=n.meta.id||"";let r=!0;return r=[Bi(i,this.options.disable.elements),n.meta.group===t.id,!o.includes(n.meta.id)].every((t=>!0===t)),r&&o.push(i),r})),n})),n}add(t=Object.create(null)){const e=Xi(t);return this.data.set(e.id,e),e.controlData.meta.id&&this.data.set(e.controlData.meta.id,e.controlData),e}get(t){return Xi(this.data.get(t))}formActions(){if(!0===this.options.disable.formActions)return null;const t={...qd.btnTemplate({content:[qd.icon("bin"),r.get("clear")],title:r.get("clearAll")}),className:["clear-form"],action:{click:t=>{kd.size?(ts.confirmClearAll=new window.CustomEvent("confirmClearAll",{detail:{confirmationMessage:r.get("confirmClearAll"),clearAllAction:()=>{Dd.clearAll().then((()=>{const e={src:t.target};ts.formeoCleared(e)}))},btnCoords:qd.coords(t.target)}}),document.dispatchEvent(ts.confirmClearAll)):window.alert(r.get("cannotClearFields"))}}},e={...qd.btnTemplate({content:[qd.icon("floppy-disk"),r.get("save")],title:r.get("save")}),className:["save-form"],action:{click:({target:t})=>{const{formData:e}=Wd,n={action:()=>{},coords:qd.coords(t),message:"",button:t};return _c.click.btn(n),_c.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 jc({panels:e,type:"controls",displayType:o});const i=["control-groups","formeo-panels-wrap",`panel-count-${e.length}`],s=qd.create({className:i,content:[this.panels.panelNav,this.panels.panelsWrap]}),a=["formeo-controls"];t&&a.push("formeo-sticky");const l=qd.create({className:a,content:[s,n]}),c=l.getElementsByClassName("control-group");this.dom=l,this.groups=c;const[d]=c;this.currentGroup=d,this.actions={filter:t=>{const e=""!==t,n=this.controls;let o=s.querySelector(".filtered-term");if(qd.toggleElementsByStr(n,t),e){const e=r.get("controls.filteringTerm",t);l.classList.add("filtered"),o?o.textContent=e:(o=qd.create({tag:"h5",className:"filtered-term",content:e}),s.insertBefore(o,s.firstChild))}else o&&(l.classList.remove("filtered"),o.remove())},addElement:this.addElement,addGroup:t=>{}};for(let r=c.length-1;r>=0;r--){const t=`formeo-controls-${c[r]}`;this.options.sortable||window.localStorage.removeItem(t),ic.create(c[r],{animation:150,forceFallback:!0,fallbackClass:"control-moving",fallbackOnBody:!0,group:{name:"controls",pull:"clone",put:!1},onStart:({item:t})=>{const{controlData:e}=this.get(t.id);this.options.ghostPreview&&(t.innerHTML="",t.appendChild(new Jc(e).preview))},onEnd:({from:t,item:e,clone:n})=>{t.contains(n)&&t.replaceChild(e,n)},sort:this.options.sortable,store:{get:()=>{const e=window.localStorage.getItem(t);return e?e.split("|"):[]},set:e=>{const n=e.toArray();window.localStorage.setItem(t,n.join("|"))}}})}return l}};class bd extends Ca{constructor(){super(...arguments),n(this,"load",((t=Object.create(null))=>(this.empty(),"string"==typeof t&&(t=JSON.parse(t)),Object.entries(t).forEach((([t,e])=>this.add(t,e))),this.data))),n(this,"get",(t=>t?Fr(this.data,t):this.add())),n(this,"add",((t,e=Object.create(null))=>{const n=t||Ui(),o=this.Component({...e,id:n});return this.set(n,o),this.active=o,o})),n(this,"remove",(t=>(Array.isArray(t)?t.forEach((t=>{this.get(t).remove()})):this.get(t).remove(),this.data))),n(this,"delete",(t=>(delete this.data[t],t))),n(this,"clearAll",((t=!0)=>{const e=Object.values(this.data).map((e=>e.empty(t)));return Promise.all(e)})),n(this,"conditionMap",new Map)}set config(t){this.configVal=Hi(this.configVal,Xi(t))}get config(){return this.configVal}}class yd extends Zc{constructor(t,e){super("stage",{...Object.freeze({children:[]}),...t},e);const n=this.createChildWrap();this.dom=qd.create({attrs:{className:[w,"empty"],id:this.id},children:n}),ic.create(n,{animation:150,fallbackClass:"row-moving",forceFallback:!0,group:{name:"stage",pull:!0,put:["row","column","controls"]},sort:!0,disabled:!1,onAdd:this.onAdd.bind(this),onRemove:this.onRemove.bind(this),onStart:()=>{wd.active=this},onSort:this.onSort.bind(this),draggable:`.${C}`,handle:".item-move"})}empty(t=!0){return new Promise((e=>{t?(this.dom.classList.add("removing-all-fields"),Zr.slideUp(this.dom,q,(()=>{e(super.empty(t)),this.dom.classList.remove("removing-all-fields"),Zr.slideDown(this.dom,q)}))):e(super.empty())}))}onAdd(...t){const e=super.onAdd(...t);e&&"column"===e.name&&e.parent.autoColumnWidths()}}const wd=new class extends bd{constructor(t){super("stages",t)}Component(t){return new yd(t)}};class Cd extends Zc{constructor(t){super("row",{...Object.freeze({config:{fieldset:!1,legend:"",inputGroup:!1},children:[],className:[C]}),...t}),n(this,"autoColumnWidths",(()=>{const t=this.children;if(!t.length)return;const e=Number.parseFloat((100/t.length).toFixed(1))/1;for(const n of t){n.removeClasses(Q);const t=n.dom,o=Yi(e);n.set("config.width",o),t.style.width=o,t.dataset.colWidth=o;const i=setTimeout((()=>{clearTimeout(i),n.refreshFieldPanels()}),U);document.dispatchEvent(ts.columnResized)}this.updateColumnPreset()})),n(this,"updateColumnPreset",(()=>{this.columnPresetControl.innerHTML="";const t=this.getColumnPresetOptions.map((({label:t,...e})=>qd.create({tag:"option",content:t,attrs:e})));this.columnPresetControl.append(...t)})),n(this,"setColumnWidths",(t=>{"string"==typeof t&&(t=t.split(",")),this.children.forEach(((e,n)=>{e.setWidth(`${t[n]}%`),e.refreshFieldPanels()}))}));const e=this.createChildWrap();this.dom=qd.create({tag:"li",className:[C,"empty"],dataset:{hoverTag:r.get("row"),editingHoverTag:r.get("editing.row")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),this.editWindow,e]}),ic.create(e,{animation:150,fallbackClass:"column-moving",forceFallback:!0,group:{name:"row",pull:!0,put:["row","column","controls"]},sort:!0,disabled:!1,onRemove:this.onRemove.bind(this),onEnd:this.onEnd.bind(this),onAdd:this.onAdd.bind(this),onSort:this.onSort.bind(this),draggable:`.${E}`,handle:".item-move"})}get editWindow(){const t={tag:"input",id:`${this.id}-fieldset`,attrs:{type:"checkbox",checked:this.get("config.fieldset"),ariaLabel:r.get("row.settings.fieldsetWrap.aria")},action:{click:({target:{checked:t}})=>{this.set("config.fieldset",Boolean(t))}},config:{label:r.get("row.settings.fieldsetWrap")}},e={tag:"input",id:`${this.id}-inputGroup`,attrs:{type:"checkbox",checked:this.get("config.inputGroup"),ariaLabel:r.get("row.settings.inputGroup.aria")},action:{click:({target:{checked:t}})=>this.set("config.inputGroup",t)},config:{label:r.get("row.makeInputGroup"),description:r.get("row.makeInputGroupDesc")}},n={className:"input-group",content:{tag:"input",attrs:{type:"text",ariaLabel:"Legend for fieldset",value:this.get("config.legend"),placeholder:"Title"},config:{label:{children:["Row Title",{tag:"span",content:" ⓘ",dataset:{tooltip:"Row title will be used as the legend for the fieldset"}}]}},action:{input:({target:{value:t}})=>this.set("config.legend",t)},className:""}},o=qd.formGroup([t,n]),i={tag:"label",content:r.get("defineColumnWidths"),className:"col-sm-4 form-control-label"};this.columnPresetControl=qd.create(this.columnPresetControlConfig);const s={className:"col-sm-8",content:this.columnPresetControl,action:{onRender:()=>{this.updateColumnPreset()}}},a=[e,"hr",o,"hr",qd.formGroup([i,s],"row")];return qd.create({className:`${this.name}-edit group-config`,action:{onRender:t=>{const e=a.map((t=>qd.create(t)));t.append(...e)}}})}onAdd(...t){super.onAdd(...t),this.autoColumnWidths()}onRemove(...t){super.onRemove(...t),this.autoColumnWidths()}get getColumnPresetOptions(){const t=this.children,e=F.get(t.length-1)||[],n=t.map((t=>{const e=t.get("config.width")||"";return Number(e.replace("%","")).toFixed(1)})).join(",");if(e.length){const t=e.slice();return!t.find((t=>t.value===n))&&t.push({value:n,label:n.replace(/,/g," | "),className:S}),t.map((t=>{const e={...t};return e.selected=t.value===n,e}))}return[]}get columnPresetControlConfig(){return{tag:"select",attrs:{ariaLabel:r.get("defineColumnLayout"),className:O},action:{change:({target:t})=>{const{value:e}=t;this.setColumnWidths(e)}},options:this.getColumnPresetOptions}}}const Ed={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]}};const xd=new class extends bd{constructor(t){super("rows",t),this.config={all:Ed}}Component(t){return new Cd(t)}};class Sd{constructor(){this.onMove=this.onMove.bind(this),this.onStop=this.onStop.bind(this),this.cleanup=this.cleanup.bind(this)}getRowWidth(t){const e=t.querySelector(".children");if(!e)return 0;const n=e.children.length,o=qd.getStyle(e,"gap")||"0px",i=parseFloat(o,10)||0;return this.totalGapWidth=i*(n-1),e.offsetWidth-this.totalGapWidth}validateResizeTarget(t,e){return t&&e&&t.offsetWidth&&e.offsetWidth}onStart(t){if(t.preventDefault(),this.resized=!1,0!==t.button)return;const e=t.target.parentElement,n=e.nextSibling||e.previousSibling,o=e.closest(`.${C}`);if(this.validateResizeTarget(e,n))if(this.startX="touchstart"===t.type?t.touches[0].clientX:t.clientX,o.classList.add(_),this.columnPreset=o.querySelector(`.${O}`),this.originalColumnClass=e.className,this.originalSiblingClass=n.className,e.className=e.className.replace(Q,""),n.className=n.className.replace(Q,""),this.colStartWidth=e.offsetWidth,this.sibStartWidth=n.offsetWidth,this.rowWidth=this.getRowWidth(o),this.rowWidth<=0)this.cleanup();else{this.column=e,this.sibling=n,this.row=o;try{window.addEventListener("pointermove",this.onMove,!1),window.addEventListener("pointerup",this.onStop,!1)}catch(i){this.cleanup()}}else this.cleanup()}calculateNewWidths(t){const e=this.colStartWidth+t-this.startX,n=this.sibStartWidth-t+this.startX,o=parseFloat(Vi(e,this.rowWidth)),i=parseFloat(Vi(n,this.rowWidth));return o<10||i<10?null:{colWidth:Yi(o.toFixed(1)),siblingColWidth:Yi(i.toFixed(1))}}onMove(t){t.preventDefault();const{column:e,sibling:n}=this,o="touchmove"===t.type?t.touches[0].clientX:t.clientX,i=this.calculateNewWidths(o);if(!i)return;const{colWidth:r,siblingColWidth:s}=i;e.dataset.colWidth=r,n.dataset.colWidth=s,e.style.width=r,n.style.width=s,this.resized=!0}onStop(){const{column:t,sibling:e}=this;window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onStop),this.resized&&(this.setCustomWidthValue(),Wd.setAddress(`columns.${t.id}.config.width`,t.dataset.colWidth),Wd.setAddress(`columns.${e.id}.config.width`,e.dataset.colWidth),this.row.classList.remove(_),this.resized=!1,this.cleanup())}cleanup(){this.column&&this.originalColumnClass&&(this.column.className=this.originalColumnClass),this.sibling&&this.originalSiblingClass&&(this.sibling.className=this.originalSiblingClass),this.row&&this.row.classList.remove(_),window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onStop)}setCustomWidthValue(){const t=this.columnPreset;let e=t.querySelector(`.${S}`);const n=this.row.querySelector(".children").children,o=Hr(n,(t=>Vi(t.clientWidth,this.rowWidth).toFixed(1))),i=o.join(","),r=o.join(" | ");return e||(e=qd.create({tag:"option",attrs:{className:S,value:i,selected:!0},content:r}),t.append(e)),e.value=i,e.textContent=r,i}}const Od=t=>({className:"resize-x-handle",action:{pointerdown:t.onStart.bind(t)},content:[qd.icon("triangle-down"),qd.icon("triangle-up")]}),_d=()=>({className:"column-edit group-config"});class Nd extends Zc{constructor(t){super("column",{...Object.freeze({config:{width:"100%"},children:[],className:[E]}),...t}),n(this,"refreshFieldPanels",(()=>{for(const t of this.children)t.panels.nav.refresh()})),n(this,"setWidth",(t=>(this.dom.dataset.colWidth=t,this.dom.style.width=t,this.set("config.width",t))));const e=this.createChildWrap();this.dom=qd.create({tag:"li",className:[E,"empty"],dataset:{hoverTag:r.get("column")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),_d(),Od(new Sd),e]}),this.processConfig(this.dom),ts.columnResized=new window.CustomEvent("columnResized",{detail:{column:this.dom,instance:this}}),ic.create(e,{animation:150,fallbackClass:"field-moving",forceFallback:!0,group:{name:"column",pull:!0,put:["column","controls"]},sort:!0,disabled:!1,onEnd:this.onEnd.bind(this),onAdd:this.onAdd.bind(this),onSort:this.onSort.bind(this),onRemove:this.onRemove.bind(this),onMove:t=>{t.from!==t.to&&t.from.classList.remove("hovering-column")},draggable:`.${x}`,handle:".item-move"})}processConfig(t){const e=Gr.get(this.data,"config.width");e&&(t.dataset.colWidth=e,t.style.width=e)}}const Ad={actionButtons:{buttons:["clone","move","remove"],disabled:[]}};const jd=new class extends bd{constructor(t){super("columns",t),this.config={all:Ad}}Component(t){return new Nd(t)}},Pd={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]},panels:{disabled:[],attrs:{disabled:["type"],hideDisabled:!0,locked:[]},order:["attrs","options","conditions"]},label:{disableHTML:!1}};const Td=new class extends bd{constructor(t){super("fields",t),n(this,"get",(t=>{let e=t&&Fr(this.data,t);if(!e){const n=vd.get(t);n&&(e=this.add(null,n.controlData))}return e})),this.config={all:Pd}}Component(t){return new Jc(t)}};const Ld=new class extends bd{constructor(t){super("externals",t)}Component(t){return new Zc("external",t)}},Dd=wd,kd=xd,$d=jd,Id=Td,Md=vd,Rd=Ld,Fd={id:Ui()};const Wd=new class extends Ca{constructor(t){super("components"),n(this,"sessionFormData",(()=>{var t;if(null==(t=this.opts)?void 0:t.sessionStorage)return Gi.get(B)})),n(this,"load",((t,e=this.opts||Object.create(null))=>{let n=t;this.empty(),"string"==typeof t&&(n=JSON.parse(t)),this.opts=e;const{stages:o={[Ui()]:{}},rows:i,columns:r,fields:s,id:a=Ui()}={...this.sessionFormData(),...n};this.set("id",a),this.add("stages",Dd.load(o)),this.add("rows",kd.load(i)),this.add("columns",$d.load(r)),this.add("fields",Id.load(s)),this.add("externals",Rd.load(e.external));for(const l of Object.values(this.get("stages")))l.loadChildren();return this.data})),this.opts=t,this.data=Fd,this.disableEvents=!0,this.stages=Dd,this.rows=kd,this.columns=$d,this.fields=Id,this.controls=Md,this.externals=Rd}flatList(t=this.data,e=Object.create(null)){return Object.entries(t).reduce(((t,[e,n])=>{if("object"==typeof n)for(const[o,i]of Object.entries(n))t[`${e}.${o}`]=i;return t}),e)}get json(){return window.JSON.stringify(this.formData)}get formData(){return{id:this.get("id"),stages:wd.getData(),rows:xd.getData(),columns:jd.getData(),fields:Td.getData()}}set config(t){const{stages:e,rows:n,columns:o,fields:i}=t;Dd.config=e,kd.config=n,$d.config=o,Id.config=i}setAddress(t,e){const[n,o,...i]=Array.isArray(t)?t:t.split("."),r=this[n.replace(/s?$/,"s")].get(o);return null==r||r.set(i,e),r}getAddress(t){if(!Zi(t))return;const[e,n,...o]=Array.isArray(t)?t:t.split("."),i=this[e.replace(/s?$/,"s")].get(n);return o.length?i.get(o):i}getConditionMap(t){if(Zi(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.get(e[1])}}setConditionMap(t,e){if(Zi(t)){const n=t.split(".");return n.every((t=>Boolean(t)))&&this[n[0]].conditionMap.set(n[1],e)}}removeConditionMap(t){if(Zi(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.delete(e[1])}}},Bd={glyphicons:t=>``,"font-awesome":t=>{const[e,n]=t.split(" ");return``},fontello:t=>`${t}`},zd=new Set(["input","textarea","select"]);const qd=new class{constructor(t=Object.create(null)){n(this,"render",(t=>(t.id=`f-${t.id||Ui()}`,this.create(t)))),n(this,"create",((t,e=!1)=>{if(!t)return;const n=this,o=["children","content"],{className:i,options:r,dataset:s,...a}=this.processTagName(t);let l;o.push("tag");const{tag:c}=a;let d;const u={attrs:{},className:[Gr.get(a,"config.inputWrap")||"f-field-group"],children:[],config:{}};let h=document.createElement(c);const p={string:t=>{h.innerHTML+=t},object:t=>t&&h.appendChild(n.create(t,e)),node:t=>h.appendChild(t),component:t=>h.appendChild(t.dom),array:t=>{for(const e of t)l=n.childType(e),p[l](e)},function:t=>{t=t(),l=n.childType(t),p[l](t)},undefined:()=>null,boolean:()=>null};if(i&&(a.attrs=Hi(a.attrs,{className:i})),r){const t=this.processOptions(r,a,e);if(!this.holdsContent(h)||"button"===c)return Gr.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(Gr.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=Gr.subtract(o,Object.keys(a));for(d=f.length-1;d>=0;d--)h[f[d]]=a[f[d]];return u.children.length&&(h=this.create(u)),h})),n(this,"onRender",((t,e)=>{t.parentElement?e(t):window.requestAnimationFrame((()=>this.onRender(t,e)))})),n(this,"toggleElementsByStr",((t,e)=>{const n=[];return qd.elementsContainText(t,e,((t,e)=>{e?(t.style.display="block",n.push(t)):t.style.display="none"})),n})),n(this,"elementsContainText",((t,e,n)=>{const o=[];return Ur(t,(t=>{const i=-1!==t.textContent.toLowerCase().indexOf(e.toLowerCase());null==n||n(t,i),i&&o.push(t)})),o})),n(this,"generateOption",(({type:t="option",label:e,value:n,i:o=0,selected:i})=>({tag:"option"===t?"option":"input",attrs:{type:t,value:n||`${t}-${o}`,["option"===t?"selected":"checked"]:i||!o},config:{label:e||r.get("labelCount",{label:r.get("option"),count:o})}}))),n(this,"requiredMark",(()=>({tag:"span",className:"text-error",children:"*"}))),n(this,"removeEmpty",(t=>{const e=t.parentElement,n=zi(t),o=e.getElementsByClassName(`formeo-${n}`);if(this.remove(t),!o.length)return this.isStage(e)?this.emptyClass(e):this.removeEmpty(e)})),n(this,"btnTemplate",(({title:t="",...e})=>({tag:"button",attrs:{type:"button",title:t},...e}))),n(this,"isControls",(t=>zi(t)===y)),n(this,"isStage",(t=>zi(t)===w)),n(this,"isRow",(t=>zi(t)===C)),n(this,"isColumn",(t=>zi(t)===E)),n(this,"isField",(t=>zi(t)===x)),n(this,"asComponent",(t=>Wd[`${zi(t)}s`].get(t.id))),this.options=t}set setOptions(t){this.options=Hi(this.options,t)}processTagName(t){let e,n=t;if("string"==typeof n)return e=n,n={tag:e},n;if(n.attrs){const{tag:t,...o}=n.attrs;if(t)if("string"==typeof t)e=t;else{e=(t.find((t=>!0===t.selected))||t[0]).value}n.attrs=o}return n.tag=e||n.tag||"div",n}actionHandler(t,e){const n={onRender:qd.onRender,render:qd.onRender},o=["focus","blur"];return Object.entries(e).map((([e,i])=>(Array.isArray(i)?i:[i]).map((i=>{const r=n[e]||(t=>(e,n)=>e.addEventListener(t,n,o.includes(t)))(e);return r(t,i)}))))}get icons(){if(this.iconSymbols)return this.iconSymbols;const t=document.querySelectorAll(`#${f} svg symbol`);return this.iconSymbols=Array.from(t).reduce(((t,e)=>{var n;return t[e.id.replace(tt,"")]={tag:"svg",attrs:{className:["svg-icon",n=e.id]},children:[{tag:"use",attrs:{"xmlns:xlink":"http://www.w3.org/1999/xlink","xlink:href":`#${n}`}}]},t}),{}),this.cachedIcons={},this.iconSymbols}icon(t,e){var n,o;if(!t)return;const i=`${t}?${new URLSearchParams(e).toString()}`;if(null==(n=this.cachedIcons)?void 0:n[i])return this.cachedIcons[i];const r=this.icons[t];if(r){if(e){const t=Hi(r,e);return this.cachedIcons[i]=qd.create(t).outerHTML,this.cachedIcons[i]}return this.cachedIcons[i]=qd.create(r).outerHTML,this.cachedIcons[i]}return(null==(o=Bd[qd.options.iconFont])?void 0:o.call(Bd,t))||t}processAttrs(t,e,n){const{attrs:o={}}=t;n||o.name||!this.isInput(t.tag)||e.setAttribute("name",Ui(t));for(const i of Object.keys(o)){const t=Gr.safeAttrName(i),n=this.processAttrValue(o[i]);n&&e.setAttribute(t,!0===n?"":n)}}processAttrValue(t){let e=t||"";if(Array.isArray(e))if("object"==typeof e[0]){const t=e.filter((t=>!0===t.selected));e=t.length?t[0].value:e[0].value}else e=e.join(" ");return e}processOptions(t,e,n){const{action:o,attrs:i}=e,r=i.type||e.tag,s=i.id||e.id;return t.map(((t,i)=>{var a;const{label:l,...c}=t,d=()=>{const a={tag:"input",attrs:{name:s,type:r,value:t.value||"",id:`${s}-${i}`,...c},action:o},l={tag:"label",attrs:{for:`${s}-${i}`},config:{inputWrap:"form-check"},children:t.label},d={children:[a,l],className:[`f-${r}`]};return e.attrs.className&&(e.config.inputWrap=e.attrs.className),e.config.inline&&d.className.push(`f-${r}-inline`),t.selected&&(a.attrs.checked=!0),n&&(l.attrs.contenteditable=!0),d},u={select:()=>({tag:"option",attrs:t,children:t.label}),button:t=>{const{type:n,label:o,className:i,id:r}=t;return{...e,attrs:{type:n},className:i,id:r||Ui(),options:void 0,children:o,action:e.action}},checkbox:d,radio:d};return null==(a=u[r])?void 0:a.call(u,t)}))}holdsContent(t){return-1!==t.outerHTML.indexOf("/")}isBlockInput(t){return!this.isInput(t)&&this.holdsContent(t)}isInput(t){let e=t;return"string"!=typeof e&&(e=e.tagName),zd.has(e)}parsedHtml(t){const e=document.createElement("textarea");return e.innerHTML=t,e.textContent}labelAfter(t){const e=Gr.get(t,"attrs.type"),n=Gr.get(t,"config.labelAfter");return void 0!==n?n:"checkbox"===e||"radio"===e}label(t,e){const n=Gr.get(t,"attrs.required");let{config:{label:o=""}}=t;const{id:i,attrs:r}=t;"function"==typeof o&&(o=o());const s={tag:"label",attrs:{for:i||(null==r?void 0:r.id)},className:[],children:[o,n&&this.requiredMark()],action:{}};return e&&(s.attrs.for=void 0,s.attrs.contenteditable=!0,s.fMap=e),s}childType(t){return void 0===t?t:[["array",t=>Array.isArray(t)],["node",t=>t instanceof window.Node||t instanceof window.HTMLElement],["component",()=>null==t?void 0:t.dom],[typeof t,()=>!0]].find((e=>e[1](t)))[0]}getStyle(t,e=!1){let n;return window.getComputedStyle?n=window.getComputedStyle(t,null):t.currentStyle&&(n=t.currentStyle),e?n[e]:n}getElement(t){return{node:()=>t,object:()=>document.getElementById(t.id),string:()=>document.getElementById(t)}[this.childType(t)]()}empty(t){for(;t.firstChild;)this.remove(t.firstChild);return t}remove(t){const e=zi(t);return e?Wd.remove(`${e}s.${t.id}`):t.parentElement.removeChild(t)}removeClasses(t,e){const n={string:t=>t.classList.remove(e),array:t=>{for(const n of e)t.classList.remove(n)}};n.object=n.string,Gr.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)}};Gr.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");Zr.slideUp(t,600,(()=>{qd.empty(t),t.classList.remove("removing-all-fields"),qd.emptyClass(t),Zr.slideDown(t,300)}))}toggleSortable(t,e){let n=e;const o=zi(t);if(!o)return;const i=zi(t.parentElement),r=qd[o].get(t.id).sortable;n||(n=!r.option("disabled")),r.option("disabled",n),i&&["rows","columns","stages"].includes(i)&&this.toggleSortable(t.parentElement,n)}emptyClass(t){const e=t.getElementsByClassName(N.get(t.classList.item(0)));t.classList.toggle("empty",!e.length)}};r.addLanguage("en-US",void 0);const Ud={get editor(){return{stickyControls:!1,allowEdit:!0,dataType:"json",debug:!1,sessionStorage:!1,editorContainer:null,external:{},svgSprite:g,style:b,iconFont:null,config:{},events:{},actions:{},controls:{},polyfills:Yr(),i18n:{location:"https://draggable.github.io/formeo/assets/lang/"}}}};let Hd=class{constructor({formData:t,...e},n){const o=Hi(Ud.editor,e),{actions:i,events:r,debug:s,config:a,editorContainer:l,...c}=o;l&&(this.editorContainer="string"==typeof l?document.querySelector(l):l),this.opts=c,qd.setOptions=c,Wd.config=a,this.userFormData=n||t,this.Components=Wd,this.dom=qd,ts.init({debug:s,...r}),_c.init({debug:s,sessionStorage:c.sessionStorage,...i}),this.tooltip=new u,document.addEventListener("DOMContentLoaded",this.loadResources.bind(this))}get formData(){return this.Components.formData}set formData(t={}){this.load({...this.userFormData,...t},this.opts)}get json(){return this.Components.json}async loadResources(){var t;document.removeEventListener("DOMContentLoaded",this.loadResources);const e=[];this.opts.polyfills&&(t=>{const e=Array.isArray(t)?m.filter((({name:e})=>-1!==t.indexOf(e))):m;Promise.all(e.map((({src:t})=>nd(t))))})(this.opts.polyfills),await id(this.opts.svgSprite),e.push((async t=>{if(!ad()&&(await od(t),!ad()))return await od("https://draggable.github.io/formeo/assets/css/formeo.min.css")})(this.opts.style)),e.push(r.init({...this.opts.i18n,locale:null==(t=window.sessionStorage)?void 0:t.getItem(z)}));const n=await Promise.all(e);return this.opts.allowEdit&&this.init(),n}init(){vd.init(this.opts.controls,this.opts.stickyControls).then((t=>{this.controls=t,this.load(this.userFormData,this.opts),this.formId=Wd.get("id"),this.i18n={setLang:t=>{var e;null==(e=window.sessionStorage)||e.setItem(z,t);r.setCurrent(t).then((()=>{this.init()}),console.error)}},this.render()}))}load(t=this.userFormData,e=this.opts){return this.Components.load(t,e)}render(){if(!this.controls)return window.requestAnimationFrame((()=>this.render()));if(this.stages=Object.values(Wd.get("stages")),this.opts.controlOnLeft)for(const e of this.stages)e.dom.style.order=1;const t={attrs:{className:"formeo formeo-editor",id:this.formId},content:[this.stages.map((({dom:t})=>t))]};r.current.dir&&(t.attrs.dir=r.current.dir,qd.dir=r.current.dir),this.editor=qd.create(t);(this.controls.container||this.editor).appendChild(this.controls.dom),this.editorContainer&&(qd.empty(this.editorContainer),this.editorContainer.appendChild(this.editor)),ts.formeoLoaded=new window.CustomEvent("formeoLoaded",{detail:{formeo:this}}),document.dispatchEvent(ts.formeoLoaded)}};const Xd=t=>{const e=t.match(K);return(null==e?void 0:e[0])||t},Vd=t=>t.replace(K,Ui());let Yd=class{constructor(t,e={}){n(this,"render",((t=this.form)=>{this.form=t;const e=document.getElementsByClassName("formeo-render").length,n={id:this.form.id,className:`formeo-render formeo formeo-rendered-${e}`,children:this.processedData};this.renderedForm=qd.render(n),this.applyConditions();const o=this.container.querySelector(".formeo-render");o?o.replaceWith(this.renderedForm):this.container.appendChild(this.renderedForm)})),n(this,"orderChildren",((t,e)=>e.reduce(((e,n)=>(e.push(this.form[t][n]),e)),[]))),n(this,"prefixId",(t=>"f-"+t)),n(this,"processColumn",(({id:t,...e})=>({...e,id:this.prefixId(t),children:this.processFields(e.children),style:`width: ${e.config.width||"100%"}`}))),n(this,"processRows",(t=>this.orderChildren("rows",this.form.stages[t].children).reduce(((t,e)=>(e&&t.push(this.processRow(e)),t)),[]))),n(this,"cacheComponent",(t=>(this.components[Xd(t.id)]=t,t))),n(this,"processRow",((t,e="row")=>{const{config:n,id:o}=t,i=[`formeo-${e}-wrap`],r={...t,children:this.processColumns(t.id),id:this.prefixId(o)};this.cacheComponent(r);const s=[{condition:n.legend,result:()=>({tag:n.fieldset?"legend":"h3",children:n.legend})},{condition:!0,result:()=>r},{condition:n.inputGroup,result:()=>this.addButton(o)}].reduce(((t,{condition:e,result:n})=>(e&&t.push(n()),t)),[]);return n.inputGroup&&i.push("f-input-group-wrap"),{tag:n.fieldset?"fieldset":"div",id:Ui(),className:i,children:s}})),n(this,"cloneComponentData",(t=>{const{children:e=[],id:n,...o}=this.components[t];return Object.assign({},o,{id:Vd(n),children:e.length&&e.map((({id:t})=>this.cloneComponentData(Xd(t))))})})),n(this,"addButton",(t=>qd.render({tag:"button",attrs:{className:"add-input-group btn pull-right",type:"button"},children:"Add +",action:{click:e=>{const n=e.target.parentElement,o=qd.render(this.cloneComponentData(t));n.insertBefore(o,n.lastChild),o.appendChild(qd.render(qd.btnTemplate({className:"remove-input-group",children:qd.icon("remove"),action:{mouseover:({target:t})=>t.parentElement.classList.add("will-remove"),mouseleave:({target:t})=>t.parentElement.classList.remove("will-remove"),click:({target:t})=>t.parentElement.remove()}})))}}}))),n(this,"processColumns",(t=>this.orderChildren("columns",this.form.rows[t].children).map((t=>this.cacheComponent(this.processColumn(t)))))),n(this,"processFieldsOrig",(t=>this.orderChildren("fields",t).map((({id:t,...e})=>this.cacheComponent(Object.assign({},e,{id:this.prefixId(t)})))))),n(this,"processFields",(t=>this.orderChildren("fields",t).map((({id:t,...e})=>{const{action:n={},dependencies:o={}}=this.elements[e.meta.id]||{};o&&sd(o);const i=Hi({action:n},e);return this.cacheComponent({...i,id:this.prefixId(t)})})))),n(this,"applyConditions",(()=>{Object.values(this.components).forEach((({conditions:t})=>{t&&t.forEach(((t,e)=>{const{if:n,then:o}=t;n.forEach((t=>{const{source:e,...n}=t;if(Zi(e)){this.getComponents(e).forEach((t=>{const e=Gd(t);e&&t.addEventListener(e,(t=>this.evaluateCondition(n,t)&&o.forEach((e=>this.execResult(e,t)))),!1);const i={target:t};this.evaluateCondition(n,i)&&o.forEach((t=>this.execResult(t,i)))}))}}))}))}))})),n(this,"evaluateCondition",(({sourceProperty:t,targetProperty:e,comparison:n,target:o},i)=>{var r;const s={equals:wa,notEquals:(t,e)=>!wa(t,e),contains:(t,e)=>t.includes(e),notContains:(t,e)=>!t.includes(e)},a=String(i.target[t]),l=String(Zi(o)?this.getComponent(o)[e]:o);return null==(r=s[n])?void 0:r.call(s,a,l)})),n(this,"execResult",(({assignment:t,target:e,targetProperty:n,value:o})=>{var i;const r={equals:t=>{var e;const i={value:()=>{t[n]=o},isNotVisible:()=>{t.parentElement.setAttribute("hidden",!0),t.required=!1},isVisible:()=>{t.parentElement.removeAttribute("hidden"),t.required=t._required}};null==(e=i[n])||e.call(i)}};if(Zi(e)){const n=this.getComponent(e);n&&void 0===n._required&&(n._required=n.required),null==(i=r[t])||i.call(r,n)}})),n(this,"getComponent",(t=>{const e=t.slice(t.indexOf(".")+1);return Ji(t)?this.external[e]:this.renderedForm.querySelector(`#f-${e}`)})),n(this,"getComponents",(t=>{const e=[],n=t.slice(t.indexOf(".")+1);return Ji(t)?e.push(this.external[n]):e.push(...this.renderedForm.querySelectorAll(`[name=f-${n}]`)),e}));const{renderContainer:o,external:i,elements:r}=(({editorContainer:t,renderContainer:e,...n})=>{const o=t=>"string"==typeof t?document.querySelector(t):t;return{...n,renderContainer:o(e),editorContainer:o(t)}})(t);this.container=o,this.form=e,this.external=i,this.dom=qd,this.components=Object.create(null),this.elements=r}get processedData(){return Object.values(this.form.stages).map((t=>(t.children=this.processRows(t.id),t.className=w,qd.render(t))))}};const Gd=t=>{const[e]=[["input",t=>["textarea","text"].includes(t.type)],["change",t=>["select"].includes(t.tagName.toLowerCase())||["checkbox","radio"].includes(t.type)]].find((e=>e[1](t)))||[!1];return e};void 0!==window&&(window.FormeoEditor=Hd,window.FormeoRenderer=Yd);const Zd=Hd,Jd=Yd;t.FormeoEditor=Zd,t.FormeoRenderer=Jd,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})})); + */function Ea(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 xa(t){for(var e=1;e=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Aa(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var ja=Aa(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Pa=Aa(/Edge/i),Ta=Aa(/firefox/i),La=Aa(/safari/i)&&!Aa(/chrome/i)&&!Aa(/android/i),Da=Aa(/iP(ad|od|hone)/i),ka=Aa(/chrome/i)&&Aa(/android/i),$a={capture:!1,passive:!1};function Ia(t,e,n){t.addEventListener(e,n,!ja&&$a)}function Ma(t,e,n){t.removeEventListener(e,n,!ja&&$a)}function Ra(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 Fa(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function Wa(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&Ra(t,e):Ra(t,e))||o&&t===n)return t;if(t===n)break}while(t=Fa(t))}return null}var Ba,za=/\s+/g;function qa(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(za," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(za," ")}}function Ua(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 Ha(t,e){var n="";if("string"==typeof t)n=t;else do{var o=Ua(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 Xa(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i=Ya(o)[n]))return o;if(o===Va())break;o=tl(o,!1)}return!1}function Za(t,e,n,o){for(var i=0,r=0,s=t.children;r2&&void 0!==arguments[2]?arguments[2]:{},o=n.evt,i=Na(n,ul);dl.pluginEvent.bind(ic)(t,e,xa({dragEl:fl,parentEl:ml,ghostEl:gl,rootEl:vl,nextEl:bl,lastDownEl:yl,cloneEl:wl,cloneHidden:Cl,dragStarted:kl,putSortable:Nl,activeSortable:ic.active,originalEvent:o,oldIndex:El,oldDraggableIndex:Sl,newIndex:xl,newDraggableIndex:Ol,hideGhostForTarget:tc,unhideGhostForTarget:ec,cloneNowHidden:function(){Cl=!0},cloneNowShown:function(){Cl=!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,f=t.extraEventProperties;if(e=e||n&&n[sl]){var m,g=e.options,v="on"+o.charAt(0).toUpperCase()+o.substr(1);!window.CustomEvent||ja||Pa?(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=xa(xa({},f),dl.getEventProperties(o,e));for(var y in b)m[y]=b[y];n&&n.dispatchEvent(m),g[v]&&g[v].call(e,m)}}(xa({putSortable:Nl,cloneEl:wl,targetEl:fl,rootEl:vl,oldIndex:El,oldDraggableIndex:Sl,newIndex:xl,newDraggableIndex:Ol},t))}var fl,ml,gl,vl,bl,yl,wl,Cl,El,xl,Sl,Ol,_l,Nl,Al,jl,Pl,Tl,Ll,Dl,kl,$l,Il,Ml,Rl,Fl=!1,Wl=!1,Bl=[],zl=!1,ql=!1,Ul=[],Hl=!1,Xl=[],Vl="undefined"!=typeof document,Yl=Da,Gl=Pa||ja?"cssFloat":"float",Zl=Vl&&!ka&&!Da&&"draggable"in document.createElement("div"),Jl=function(){if(Vl){if(ja)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),Kl=function(t,e){var n=Ua(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=Za(t,0,e),r=Za(t,1,e),s=i&&Ua(i),a=r&&Ua(r),l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Ya(i).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Ya(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[Gl]||r&&"none"===n[Gl]&&l+c>o)?"vertical":"horizontal"},Ql=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"==Sa(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},tc=function(){!Jl&&gl&&Ua(gl,"display","none")},ec=function(){!Jl&&gl&&Ua(gl,"display","")};Vl&&!ka&&document.addEventListener("click",(function(t){if(Wl)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),Wl=!1,!1}),!0);var nc=function(t){if(fl){t=t.touches?t.touches[0]:t;var e=(i=t.clientX,r=t.clientY,Bl.some((function(t){var e=t[sl].options.emptyInsertThreshold;if(e&&!Ja(t)){var n=Ya(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[sl]._onDragOver(n)}}var i,r,s},oc=function(t){fl&&fl.parentNode[sl]._isOutsideThisEl(t.target)};function ic(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=_a({},e),t[sl]=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 Kl(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!==ic.supportPointer&&"PointerEvent"in window&&!La,emptyInsertThreshold:5};for(var o in dl.initializePlugins(this,t,n),n)!(o in e)&&(e[o]=n[o]);for(var i in Ql(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&Zl,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?Ia(t,"pointerdown",this._onTapStart):(Ia(t,"mousedown",this._onTapStart),Ia(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(Ia(t,"dragover",this),Ia(t,"dragenter",this)),Bl.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),_a(this,al())}function rc(t,e,n,o,i,r,s,a){var l,c,d=t[sl],u=d.options.onMove;return!window.CustomEvent||ja||Pa?(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||Ya(e),l.willInsertAfter=a,l.originalEvent=s,t.dispatchEvent(l),u&&(c=u.call(d,l,s)),c}function sc(t){t.draggable=!1}function ac(){Hl=!1}function lc(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 cc(t){return setTimeout(t,0)}function dc(t){return clearTimeout(t)}ic.prototype={constructor:ic,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||($l=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,fl):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){Xl.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&Xl.push(o)}}(n),!fl&&!(/mousedown|pointerdown/.test(r)&&0!==t.button||o.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!La||!a||"SELECT"!==a.tagName.toUpperCase())&&!((a=Wa(a,o.draggable,n,!1))&&a.animated||yl===a)){if(El=Ka(a),Sl=Ka(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}),hl("filter",e,{evt:t}),void(i&&t.cancelable&&t.preventDefault())}else if(c&&(c=c.split(",").some((function(o){if(o=Wa(l,o.trim(),n,!1))return pl({sortable:e,rootEl:o,name:"filter",targetEl:a,fromEl:n,toEl:n}),hl("filter",e,{evt:t}),!0}))))return void(i&&t.cancelable&&t.preventDefault());o.handle&&!Wa(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&&!fl&&n.parentNode===r){var l=Ya(n);if(vl=r,ml=(fl=n).parentNode,bl=fl.nextSibling,yl=n,_l=s.group,ic.dragged=fl,Al={target:fl,clientX:(e||t).clientX,clientY:(e||t).clientY},Ll=Al.clientX-l.left,Dl=Al.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,fl.style["will-change"]="all",o=function(){hl("delayEnded",i,{evt:t}),ic.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!Ta&&i.nativeDraggable&&(fl.draggable=!0),i._triggerDragStart(t,e),pl({sortable:i,name:"choose",originalEvent:t}),qa(fl,s.chosenClass,!0))},s.ignore.split(",").forEach((function(t){Xa(fl,t.trim(),sc)})),Ia(a,"dragover",nc),Ia(a,"mousemove",nc),Ia(a,"touchmove",nc),Ia(a,"mouseup",i._onDrop),Ia(a,"touchend",i._onDrop),Ia(a,"touchcancel",i._onDrop),Ta&&this.nativeDraggable&&(this.options.touchStartThreshold=4,fl.draggable=!0),hl("delayStart",this,{evt:t}),!s.delay||s.delayOnTouchOnly&&!e||this.nativeDraggable&&(Pa||ja))o();else{if(ic.eventCanceled)return void this._onDrop();Ia(a,"mouseup",i._disableDelayedDrag),Ia(a,"touchend",i._disableDelayedDrag),Ia(a,"touchcancel",i._disableDelayedDrag),Ia(a,"mousemove",i._delayedDragTouchMoveHandler),Ia(a,"touchmove",i._delayedDragTouchMoveHandler),s.supportPointer&&Ia(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(){fl&&sc(fl),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;Ma(t,"mouseup",this._disableDelayedDrag),Ma(t,"touchend",this._disableDelayedDrag),Ma(t,"touchcancel",this._disableDelayedDrag),Ma(t,"mousemove",this._delayedDragTouchMoveHandler),Ma(t,"touchmove",this._delayedDragTouchMoveHandler),Ma(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?Ia(document,"pointermove",this._onTouchMove):Ia(document,e?"touchmove":"mousemove",this._onTouchMove):(Ia(fl,"dragend",this),Ia(vl,"dragstart",this._onDragStart));try{document.selection?cc((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(n){}},_dragStarted:function(t,e){if(Fl=!1,vl&&fl){hl("dragStarted",this,{evt:e}),this.nativeDraggable&&Ia(document,"dragover",oc);var n=this.options;!t&&qa(fl,n.dragClass,!1),qa(fl,n.ghostClass,!0),ic.active=this,t&&this._appendGhost(),pl({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(jl){this._lastX=jl.clientX,this._lastY=jl.clientY,tc();for(var t=document.elementFromPoint(jl.clientX,jl.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(jl.clientX,jl.clientY))!==e;)e=t;if(fl.parentNode[sl]._isOutsideThisEl(t),e)do{if(e[sl]){if(e[sl]._onDragOver({clientX:jl.clientX,clientY:jl.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=Fa(e));ec()}},_onTouchMove:function(t){if(Al){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=gl&&Ha(gl,!0),s=gl&&r&&r.a,a=gl&&r&&r.d,l=Yl&&Rl&&Qa(Rl),c=(i.clientX-Al.clientX+o.x)/(s||1)+(l?l[0]-Ul[0]:0)/(s||1),d=(i.clientY-Al.clientY+o.y)/(a||1)+(l?l[1]-Ul[1]:0)/(a||1);if(!ic.active&&!Fl){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))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===fl)return T(!1);if(m&&r===t.target&&(s=m),s&&(n=Ya(s)),!1!==rc(vl,r,fl,e,s,n,t,!!s))return P(),m&&m.nextSibling?r.insertBefore(fl,m.nextSibling):r.appendChild(fl),ml=r,L(),T(!0)}else if(m&&function(t,e,n){var o=Ya(Za(n.el,0,n.options,!0)),i=rl(n.el,n.options,gl),r=10;return e?t.clientXd+c*r/2:lu-Ml)return-Il}else if(l>d+c*(1-i)/2&&lu-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,ql,$l===s),0!==v){var O=Ka(fl);do{O-=v,y=ml.children[O]}while(y&&("none"===Ua(y,"display")||y===gl))}if(0===v||y===s)return T(!1);$l=s,Il=v;var _=s.nextElementSibling,N=!1,A=rc(vl,r,fl,e,s,n,t,N=1===v);if(!1!==A)return 1!==A&&-1!==A||(N=1===A),Hl=!0,setTimeout(ac,30),P(),N&&!_?r.appendChild(fl):s.parentNode.insertBefore(fl,N?_:s),x&&ol(x,0,S-x.scrollTop),ml=fl.parentNode,void 0===b||ql||(Ml=Math.abs(b-Ya(s)[E])),L(),T(!0)}if(r.contains(fl))return T(!1)}return!1}function j(a,l){hl(a,p,xa({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 rc(vl,r,fl,e,n,Ya(n),t,o)},changed:L},l))}function P(){j("dragOverAnimationCapture"),p.captureAnimationState(),p!==h&&h.captureAnimationState()}function T(e){return j("dragOverCompleted",{insertion:e}),e&&(d?c._hideClone():c._showClone(p),p!==h&&(qa(fl,Nl?Nl.options.ghostClass:c.options.ghostClass,!1),qa(fl,a.ghostClass,!0)),Nl!==p&&p!==ic.active?Nl=p:p===ic.active&&Nl&&(Nl=null),h===p&&(p._ignoreWhileAnimating=s),p.animateAll((function(){j("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(s===fl&&!fl.animated||s===r&&!s.animated)&&($l=null),a.dragoverBubble||t.rootEl||s===document||(fl.parentNode[sl]._isOutsideThisEl(t.target),!e&&nc(t)),!a.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),f=!0}function L(){xl=Ka(fl),Ol=Ka(fl,a.draggable),pl({sortable:p,name:"change",toEl:r,newIndex:xl,newDraggableIndex:Ol,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){Ma(document,"mousemove",this._onTouchMove),Ma(document,"touchmove",this._onTouchMove),Ma(document,"pointermove",this._onTouchMove),Ma(document,"dragover",nc),Ma(document,"mousemove",nc),Ma(document,"touchmove",nc)},_offUpEvents:function(){var t=this.el.ownerDocument;Ma(t,"mouseup",this._onDrop),Ma(t,"touchend",this._onDrop),Ma(t,"pointerup",this._onDrop),Ma(t,"touchcancel",this._onDrop),Ma(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;xl=Ka(fl),Ol=Ka(fl,n.draggable),hl("drop",this,{evt:t}),ml=fl&&fl.parentNode,xl=Ka(fl),Ol=Ka(fl,n.draggable),ic.eventCanceled||(Fl=!1,ql=!1,zl=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),dc(this.cloneId),dc(this._dragStartId),this.nativeDraggable&&(Ma(document,"drop",this),Ma(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),La&&Ua(document.body,"user-select",""),Ua(fl,"transform",""),t&&(kl&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),gl&&gl.parentNode&&gl.parentNode.removeChild(gl),(vl===ml||Nl&&"clone"!==Nl.lastPutMode)&&wl&&wl.parentNode&&wl.parentNode.removeChild(wl),fl&&(this.nativeDraggable&&Ma(fl,"dragend",this),sc(fl),fl.style["will-change"]="",kl&&!Fl&&qa(fl,Nl?Nl.options.ghostClass:this.options.ghostClass,!1),qa(fl,this.options.chosenClass,!1),pl({sortable:this,name:"unchoose",toEl:ml,newIndex:null,newDraggableIndex:null,originalEvent:t}),vl!==ml?(xl>=0&&(pl({rootEl:ml,name:"add",toEl:ml,fromEl:vl,originalEvent:t}),pl({sortable:this,name:"remove",toEl:ml,originalEvent:t}),pl({rootEl:ml,name:"sort",toEl:ml,fromEl:vl,originalEvent:t}),pl({sortable:this,name:"sort",toEl:ml,originalEvent:t})),Nl&&Nl.save()):xl!==El&&xl>=0&&(pl({sortable:this,name:"update",toEl:ml,originalEvent:t}),pl({sortable:this,name:"sort",toEl:ml,originalEvent:t})),ic.active&&(null!=xl&&-1!==xl||(xl=El,Ol=Sl),pl({sortable:this,name:"end",toEl:ml,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){hl("nulling",this),vl=fl=ml=gl=bl=wl=yl=Cl=Al=jl=kl=xl=Ol=El=Sl=$l=Il=Nl=_l=ic.dragged=ic.ghost=ic.clone=ic.active=null,Xl.forEach((function(t){t.checked=!0})),Xl.length=Pl=Tl=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":fl&&(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{const e=window.prompt(t.message.attr);if(e&&t.isDisabled(e))return window.alert(r.get("attributeNotPermitted",e||"")),_c.add.attrs(t);let n;e&&(n=String(window.prompt(t.message.value,"")),t.addAction(e,n))},option:t=>{t.addAction()},condition:t=>{t.addAction(t)}},click:{btn:t=>{t.action()}},save:{form:Qi}},_c={init:function(t){const e=Object.keys(Oc);return this.opts=e.reduce(((e,n)=>(e[n]={...Oc[n],...t[n]},e)),t),this},add:{attrs:t=>_c.opts.add.attr(t),options:t=>_c.opts.add.option(t),conditions:t=>(t.template={if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]},_c.opts.add.condition(t))},click:{btn:t=>_c.opts.click.btn(t)},save:{form:t=>(_c.opts.sessionStorage&&Gi.set(B,t),ts.formeoSaved({formData:t}),_c.opts.save.form(t))}},Nc=Object.freeze({type:"field",displayType:"slider"}),Ac=t=>({transform:`translateX(${t?`${t}px`:0})`});class jc{constructor(t){n(this,"toggleTabbedLayout",(()=>{this.getPanelDisplay();const t=this.isTabbed;return this.panelsWrap.parentElement.classList.toggle("tabbed-panels",t),t&&this.panelNav.removeAttribute("style"),t})),n(this,"resizePanels",(()=>{this.toggleTabbedLayout();const t=this.panelsWrap.style,e=qd.getStyle(this.currentPanel,"height");return t.height=e,e})),this.opts=Hi(Nc,t),this.panelDisplay=this.opts.displayType,this.activePanelIndex=0,this.panelNav=this.createPanelNav();const e=this.createPanelsWrap();this.nav=this.navActions();const o=new window.ResizeObserver((([{contentRect:{width:t}}])=>{this.currentWidth!==t&&(this.toggleTabbedLayout(),this.currentWidth=t,this.nav.setTranslateX(this.activePanelIndex,!1))})),i=window.setTimeout((()=>{o.observe(e),window.clearTimeout(i)}),H)}getPanelDisplay(){const t=this.panelsWrap,e=Number.parseInt(qd.getStyle(t,"width"))>390?"tabbed":"slider",n="auto"===this.opts.displayType;return this.panelDisplay=n?e:this.opts.displayType||Nc.displayType,this.panelDisplay}createPanelsWrap(){const t=qd.create({className:"panels",content:this.opts.panels.map((({config:t,...e})=>e))});return"field"===this.opts.type&&this.sortableProperties(t),this.panelsWrap=t,this.panels=t.children,this.currentPanel=this.panels[this.activePanelIndex],t}sortableProperties(t){const e=t.getElementsByClassName("field-edit-group");return Gr.forEach(e,(t=>{t.fieldId=this.opts.id,t.isSortable&&ic.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=zr(t.target,t.target.parentElement);this.nav.setTranslateX(e,!1),this.nav.groupChange(e)}},content:t.config.label}))),e={className:"panel-labels",content:{content:t}},[n]=t;return n.className="active-tab",qd.create(e)}createPanelNav(){this.labels=this.createPanelNavLabels();const t={tag:"button",attrs:{className:"next-group",title:r.get("controlGroups.nextGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.nextGroup(t)},content:qd.icon("triangle-right")},e={tag:"button",attrs:{className:"prev-group",title:r.get("controlGroups.prevGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.prevGroup(t)},content:qd.icon("triangle-left")};return qd.create({tag:"nav",attrs:{className:"panel-nav"},content:[e,this.labels,t]})}get isTabbed(){return"tabbed"===this.panelDisplay}navActions(){const t={},e=this.currentPanel.parentElement,n=this.labels.firstChild,o=n.children,i=this.currentPanel.parentElement.childNodes;this.activePanelIndex=zr(this.currentPanel,e);let r={nav:0,panel:0},s={...r};t.groupChange=t=>(this.activePanelIndex=t,this.currentPanel=i[t],qd.removeClasses(i,"active-panel"),qd.removeClasses(o,"active-tab"),this.currentPanel.classList.add("active-panel"),o[t].classList.add("active-tab"),this.currentPanel);const a=({offset:t,reset:o,duration:i=U,animate:r=!this.isTabbed})=>{const a=[Ac(s.panel),Ac(t.panel)],l=[Ac(s.nav),Ac(this.isTabbed?0:t.nav)];if(o){const[t]=a,[e]=l;a.push(t),l.push(e)}const c={easing:"ease-in-out",duration:r?i:0,fill:"forwards"},d=e.animate(a,c);n.animate(l,c);const u=()=>{this.panelsWrap.style.height=qd.getStyle(this.currentPanel,"height"),d.removeEventListener("finish",u),o||(s=t)};d.addEventListener("finish",u)};return t.setTranslateX=(t=this.activePanelIndex,o=!0)=>{var i;i=t,r={nav:-n.offsetWidth*i,panel:-e.offsetWidth*i},a({offset:r,animate:o})},t.refresh=(e=this.activePanelIndex)=>{this.activePanelIndex!==e&&t.groupChange(e),t.setTranslateX(this.activePanelIndex,!1),this.resizePanels()},t.nextGroup=()=>{const e=this.activePanelIndex+1;if(e!==i.length){const o=i[e];r={nav:-n.offsetWidth*e,panel:-o.offsetLeft},a({offset:r}),t.groupChange(e)}else r={nav:s.nav-8,panel:s.panel-8},a({offset:r,reset:!0});return this.currentPanel},t.prevGroup=()=>{if(0!==this.activePanelIndex){const e=this.activePanelIndex-1,o=i[e];r={nav:-n.offsetWidth*e,panel:-o.offsetLeft},a({offset:r}),t.groupChange(e)}else r={nav:8,panel:8},a({offset:r,reset:!0})},t}}const Pc="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`)),Tc=new RegExp(`(?!${Pc.join("|")})\\w\\S*`,"g"),Lc=/\s+/g;function Dc(t){if("string"!=typeof t)return t;if(t.trim().match(Lc))return t;return t.replace(Tc,(t=>t.charAt(0).toUpperCase()+t.substring(1).replace(/[A-Z]/g,(t=>` ${t}`))))}const kc=(t,e="-")=>t.toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,e),$c="f-autocomplete",Ic="highlight-component";let Mc,Rc=Date.now();const Fc=({name:t,id:e,...n})=>["config.label","attrs.id","meta.id"].reduce(((t,e)=>(t||(t=n.get(e)),t)),null)||"external"===t&&((...t)=>r.get(t.join("."))||Dc(t.join(" ")))(t,e);class Wc{constructor(t,e,n){this.key=t,this.className=t.replace(/\./g,"-"),this.value=e,this.events=[],this.i18nKey=n,this.build()}build(){const t=t=>{const e=this.list,n=this.getActiveOption();let o=new Map([[38,()=>{const t=this.getPreviousOption(n);t&&this.selectOption(t)}],[40,()=>{const t=this.getNextOption(n);t&&this.selectOption(t)}],[13,()=>{n&&(this.selectOption(n),this.setValue(n),"none"===e.style.display?this.showList(n):this.hideList()),t.preventDefault()}],[27,()=>{this.hideList()}]]).get(t.keyCode);return o||(o=()=>!1),o()},e={focus:({target:e})=>{this.updateOptions(),e.parentElement.classList.add(`${this.className}-focused`);const n=qd.toggleElementsByStr(this.list.querySelectorAll("li"),e.value);e.addEventListener("keydown",t);const o=this.list.querySelector(".active-option")||n[0];this.showList(o)},blur:({target:e})=>{e.parentElement.classList.remove(`${this.className}-focused`),e.removeEventListener("keydown",t),this.hideList()},input:t=>{const e=qd.toggleElementsByStr(this.list.querySelectorAll("li"),t.target.value);if(0===t.target.value.length&&this.clearValue(),0===e.length)this.hideList();else{const t=this.getActiveOption()||e[0];this.showList(t)}const n=t.target.value.trim();this.hiddenField.value=n,this.value=n}};return this.displayField=qd.create({tag:"input",autocomplete:"off",action:e,attrs:{type:"text",className:`${$c}-display-field`,value:this.label||this.value,placeholder:r.get(`${this.i18nKey}.${this.key}.placeholder`)}}),this.hiddenField=qd.create({tag:"input",attrs:{type:"hidden",className:this.className,value:this.value}}),this.list=qd.create({tag:"ul",attrs:{className:`${$c}-list`}}),this.dom=qd.create({children:[this.displayField,this.hiddenField,this.list],className:this.className,action:{onRender:()=>{const t=this.value&&Wd.getAddress(this.value);this.label=t&&Fc(t),this.label&&(this.displayField.value=this.label),this.updateOptions()}}}),this.dom}updateOptions(){const t=Date.now();t-Rc>H&&(qd.empty(this.list),this.generateOptions(),Rc=t);const e=Mc||this.generateOptions();for(const n of e)this.list.appendChild(n)}generateOptions(){const t=(t=>{const e=[],n=Wd.flatList(),o=Object.entries(n).map((([n,o])=>{const i=Fc(o);if(i){const r={tag:"span",content:` ${Dc(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=`${$c}-list-item`;return t.classList.contains(e)||(t=t.parentElement),t};return Mc=t.map((t=>{const{value:n,textLabel:o,htmlLabel:i}=t,r={tag:"li",children:i,dataset:{value:n,label:o},className:`${$c}-list-item`,action:{mousedown:({target:t})=>{t=e(t),this.setValue(t),this.selectOption(t),this.hideList()},mouseover:({target:t})=>{t=e(t),this.removeHighlight(),this.highlightComponent(t)}}};return qd.create(r)})),Mc}hideList(t=this.list){Zr.slideUp(t,U),this.removeHighlight()}showList(t,e=this.list){this.selectOption(t),Zr.slideDown(e,U)}getActiveOption(t=this.list){const e=t.getElementsByClassName("active-option")[0];return e&&"none"!==e.style.display?e:null}getPreviousOption(t){let e=t;do{e=e?e.previousSibling:null}while(null!=e&&"none"===e.style.display);return e}getNextOption(t){let e=t;do{e=e?e.nextSibling:null}while(null!=e&&"none"===e.style.display);return e}selectOption(t,e=this.list){var n;const o=e.querySelectorAll("li");for(const i of o){const{dataset:{value:t}}=i;if(i.classList.remove("active-option"),t){null==(n=Wd.getAddress(t).dom)||n.classList.remove(Ic)}}t&&(t.classList.add("active-option"),this.highlightComponent(t))}removeHighlight(){const t=document.getElementsByClassName(Ic);for(const e of t)e.classList.remove(Ic)}highlightComponent(t){var e;const{dataset:{value:n}}=t;if(n){null==(e=Wd.getAddress(n).dom)||e.classList.add(Ic)}}clearValue(){this.selectOption(null),this.displayField.value="",this.hiddenField.value="",this.value="",this.runEvent("onChange",{target:this.hiddenField})}setValue(t){const{label:e,value:n}=t.dataset;this.displayField.value=e,this.hiddenField.value=n,this.value=n,this.runEvent("onChange",{target:this.hiddenField})}addEvent(t,e){this.events.push([t,e])}runEvent(t,e){for(const[n,o]of this.events)n===t&&o(e)}}const Bc=(t,e)=>{const n=(t=>{const e=Ji(t),n={"field.property":Z,...J},o=e?(i=t,Wd.getAddress(i).getData()):n[t];var i;return Object.keys(o).reduce(((t,e)=>(t[e]=e,t)),{})})(t);return Object.entries(n).reduce(((n,[o,i])=>{if("id"!==o){const s={tag:"option",content:r.get(`${t}.${o}`)||o.toLowerCase(),attrs:{value:i}};e===i&&(s.attrs.selected=!0),n.push(qd.create(s))}return n}),[])},zc=(t,e)=>{qd.empty(t);for(const n of e)t.add(n)},qc=({key:t,value:e,type:n="text",checked:o})=>{const i={tag:"input",attrs:{type:n,value:e,placeholder:r.get(`${t}.placeholder`)||Dc(t)},className:t.replace(/\./g,"-"),config:{}};return o&&(i.attrs.checked=!0),i},Uc=t=>{const e=r.get(t);if(e)return e;const n=t.split(".");return r.get(n[n.length-1])},Hc={autocomplete:(t,e,n)=>new Wc(t,e,n),string:(t,e)=>qc({key:t,value:e}),boolean:(t,e)=>qc({key:t,value:e,type:"selected"===t?"radio":"checkbox",checked:e}),number:(t,e)=>qc({key:t,value:e,type:"number"}),array:(t,e=[])=>({tag:"select",attrs:{placeholder:Uc(`placeholder.${t}`)},className:t.replace(/\./g,"-"),options:e}),object:t=>Object.entries(t).map((([t,e])=>Hc[qd.childType(e)](t,e)))},Xc=["selected","checked"],Vc={boolean:(t,e)=>({click:({target:{checked:n}})=>{var o,i;"radio"===(null==(i=null==(o=e.data)?void 0:o.attrs)?void 0:i.type)&&e.set("options",e.data.options.map((t=>({...t,selected:!1})))),e.set(t,n)}}),string:(t,e)=>({input:({target:{value:n}})=>{e.set(t,n)}}),number:(t,e)=>({input:({target:{value:n}})=>{e.set(t,Number(n))}}),array:(t,e)=>({change:({target:{value:n}})=>{e.set(t,n)}}),object:()=>({})};class Yc{constructor({key:t,data:e,index:o,field:i}){n(this,"generateConditionFields",((t,e)=>{const n={tag:"label",className:`condition-label ${t}-condition-label`,content:r.get(t)||t};return e.map(((e,o)=>{const i=[],r=Object.entries(e).map((([e,n])=>{const r=this.conditionInput(e,n,t,o);return r&&i.push([r.className,n.trim()].filter(Boolean).join("-")),r})).filter(Boolean),s=qr(r,G.map((t=>`condition-${t}`)),"className||dom.className");return this.processConditionUIState(s),o||s.unshift(n),this.itemFieldGroups.push(s),{children:s,className:`f-condition-row ${t}-condition-row ${i.join(" ")}`}}))})),n(this,"processConditionUIState",(t=>{const e=e=>(e=e.split("|"),t.filter((t=>e.includes(t.className)))),n=t=>{t=Array.isArray(t)?t:[t];const e=setTimeout((()=>{t.forEach((t=>{t.dom&&(t=t.dom),t.style.display="none"})),clearTimeout(e)}),q)},o=t=>{t=Array.isArray(t)?t:[t];const e=setTimeout((()=>{t.forEach((t=>{t.dom&&(t=t.dom),t.removeAttribute("style")})),clearTimeout(e)}),q)},i=new Map([["condition-source",t=>{const i=e("condition-sourceProperty"),r=i[0],s=Ji(t.value)?t.value:"field.property",a=Bc(s,r.value);return zc(r,a),t.value?o(i):n(i)}],["condition-target",t=>{const i=e("condition-targetProperty");return Zi(t.value)&&t.value?o(i):n(i)}],["condition-sourceProperty",t=>{const i=e("condition-comparison|condition-targetProperty|condition-target"),r=t.value;return(t=>/^is|^has/.test(t))(r.substring(r.lastIndexOf(".")+1,r.length))?n(i):o(i)}]]);for(const r of t){const t=i.get(r.className);t&&t(r)}})),n(this,"conditionInput",((t,e,n,o)=>{const i=this.field,r=`${this.itemKey}.${n}.${o}`,s=`${this.field.id}.${r}`,a=`${i.name}s.${s}.${t}`,l=(t,e,n)=>{const o=Bc(n||t,e),i=Hc.array(`condition.${t}`);i.action={change:c,onRender:t=>c({target:t})};const r=qd.create(i);return zc(r,o),r},c=({target:t})=>{const e=t.closest(".f-condition-row"),n=new RegExp(`${t.className}(?:\\S?)+`,"gm");e.className=e.className.replace(n,""),e.classList.add([t.className,t.value].filter(Boolean).join("-"));const o={dataPath:a,value:t.value,src:t};ts.formeoUpdated(o),Wd.setAddress(a,t.value);const i=t.closest(".f-condition-row"),r=zr(i);this.processConditionUIState(this.itemFieldGroups[r])},d={comparison:t=>l("comparison",t),logical:t=>l("logical",t),source:(t,e="source")=>{const o=Hc.autocomplete(`condition.${e}`,t,n);return Wd.setConditionMap(t,i),o.addEvent("onChange",(t=>{Wd.removeConditionMap(Wd.getAddress(a)),c(t),Wd.setConditionMap(t.target.value,i)})),o},sourceProperty:t=>l("sourceProperty",t,"field.property"),targetProperty:t=>l("targetProperty",t,"field.property"),target:t=>d.source(t,"target"),value:t=>{const e=Hc.string("condition.value",t);return e.action={input:c},qd.create(e)},assignment:t=>l("assignment",t)};if(d[t])return d[t](e)})),this.itemValues=qr(Object.entries(e),Xc,"0");const[s,a]=t.split(".");this.field=i,this.itemKey=t,this.itemIndex=o,this.panelName=s,this.isDisabled=i.isDisabledProp(a,s),this.isHidden=this.isDisabled&&i.config.panels[s].hideDisabled,this.isLocked=i.isLockedProp(a,s),this.dom=qd.create({tag:"li",className:[`field-${t.replace(/\./g,"-")}`,"prop-wrap",this.isHidden&&"hidden-property"],children:{className:"field-prop",children:[this.itemInputs,this.itemControls]}})}get itemInputs(){this.itemFieldGroups=[];return{className:`${this.panelName}-prop-inputs prop-inputs f-input-group`,children:this.itemValues.map((([t,e])=>{let n="conditions"===this.panelName?this.generateConditionFields(t,e):this.itemInput(t,e);return["selected","checked"].includes(t)&&(n={className:"f-addon",children:n}),n}))}}get itemControls(){if(this.isLocked){return{className:`${this.panelName}-prop-controls prop-controls`,content:[]}}const t={tag:"button",attrs:{type:"button",className:"prop-remove prop-control"},action:{click:()=>{Zr.slideUp(this.dom,250,(t=>{this.field.remove(this.itemKey),qd.remove(t),this.field.resizePanelWrap()}))}},content:qd.icon("remove")};return{className:`${this.panelName}-prop-controls prop-controls`,content:[t]}}itemInput(t,e){const n=qd.childType(e)||"string",o={config:{},attrs:{},...Hc[n](t,e)},i=this.itemKey.replace(/.\d+$/,(e=>`${e}.${t}`)),r=i.split(".").filter(Number.isNaN).join(".")||t,[s,a]=[[...this.itemKey.split("."),t],[t]].map((t=>[this.field.id,...t].filter(Boolean).join("-")));return o.config={...o.config,label:"options"!==this.panelName&&(Uc(r)||Dc(r)),labelAfter:!1},o.attrs={...o.attrs,name:"checkbox"===o.attrs.type?`${a}[]`:a,id:s,disabled:this.isDisabled,locked:this.isLocked},o.action={...Vc[n](i,this.field)},o}}class Gc{constructor(t,e,o){n(this,"addAttribute",((t,e)=>{const n=kc(t),o=`attrs.${n}`;r.current[o]||r.put(o,Vr(t)),"string"==typeof e&&["true","false"].includes(e)&&(e=JSON.parse(e)),this.field.set(`attrs.${t}`,e);const i=this.props.querySelector(`.field-attrs-${n}`),s=new Yc({key:o,data:{[n]:e},field:this.field});i?this.props.replaceChild(s.dom,i):this.props.appendChild(s.dom),this.field.resizePanelWrap()})),n(this,"addOption",(()=>{const t=this.field.data.meta.id,e=this.field.get("options"),n="select"===t?"option":t,o=r.get("newOptionLabel",{type:n})||"New Option",i=`options.${this.data.length}`,s=e[e.length-1],a={...e.length?s:{},label:o};"button"!==t&&(a.value=kc(o));const l=new Yc({key:i,data:a,field:this.field,index:this.props.children.length});this.editPanelItems.push(l),this.props.appendChild(l.dom),this.field.set(i,a),this.field.resizePanelWrap()})),n(this,"addCondition",(t=>{const e=`conditions.${this.field.get("conditions").length}`,n=this.props.querySelector(`.field-${e.replace(".","-")}`),o=new Yc({key:e,data:t.template,field:this.field});n?this.props.replaceChild(o.dom,n):this.props.appendChild(o.dom),this.field.set(e,t.template),this.field.resizePanelWrap()})),this.type=qd.childType(t),this.data="object"===this.type?Object.entries(t):t,this.name=e,this.field=o,this.panelConfig=this.getPanelConfig(this.data)}getPanelConfig(t){return this.props=this.createProps(t),this.editButtons=this.createEditButtons(),{id:`${this.field.id}-${this.name}-panel`,config:{label:r.get(`panel.label.${this.name}`)},attrs:{className:`f-panel ${this.name}-panel`},children:[this.props,this.editButtons]}}createProps(t){this.editPanelItems=Array.from(t).map(((t,e)=>{const n="array"===this.type,o=[this.name,n?String(e):t[0]].join("."),i=n?t:{[t[0]]:t[1]};return new Yc({key:o,data:i,field:this.field})}));const e={tag:"ul",attrs:{className:["field-edit-group",`field-edit-${this.name}`]},editGroup:this.name,isSortable:"options"===this.name,content:this.editPanelItems};return qd.create(e)}createEditButtons(){const t=this,e=this.name,n=r.get(`panelEditButtons.${e}`),o={attrs:t.addAttribute,options:t.addOption,conditions:t.addCondition};return{className:"panel-action-buttons",content:[{...qd.btnTemplate({content:n,title:n}),className:`add-${e}`,action:{click:n=>{const i={btnCoords:qd.coords(n.target),addAction:o[e]};"attrs"===e&&(i.isDisabled=t.field.isDisabledProp,i.isLocked=t.field.isLockedProp,i.message={attr:r.get(`action.add.${e}.attr`),value:r.get(`action.add.${e}.value`)});const s=Dc(e),a=new window.CustomEvent(`onAdd${s}`,{detail:i});_c.add[e](i),document.dispatchEvent(a)}}}]}}}class Zc extends Ca{constructor(t,e={},o){super(t,{...e,id:e.id||Ui()}),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)?Br(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 Ur(n,(t=>t.remove())),this.dom.parentElement.removeChild(this.dom),((t,e)=>{const n=t.indexOf(e);-1!==n&&t.splice(n,1)})(Wd.getAddress(`${e.name}s.${e.id}.children`),this.id),e.children.length||e.emptyClass(),"row"===e.name&&e.autoColumnWidths(),Wd[`${this.name}s`].delete(this.id)})),n(this,"emptyClass",(()=>this.dom.classList.toggle("empty",!this.children.length))),n(this,"getComponentTag",(()=>qd.create({tag:"span",className:["component-tag",`${this.name}-tag`],children:[(this.isColumn||this.isField)&&qd.icon("component-corner",{className:"bottom-left"}),qd.icon(`handle-${this.name}`),Dc(this.name),(this.isColumn||this.isRow)&&qd.icon("component-corner",{className:"bottom-right"})].filter(Boolean)}))),n(this,"removeClasses",(t=>{const e={string:()=>this.dom.classList.remove(t),array:()=>t.map((t=>this.dom.classList.remove(t)))};return e.object=e.string,e[qd.childType(t)](this.dom)})),n(this,"loadChildren",((t=this.data.children)=>t.map((t=>this.addChild({id:t}))))),n(this,"saveChildOrder",(()=>{if(this.render)return;const t=this.children.map((({id:t})=>t));return this.set("children",t),t})),n(this,"onSort",(()=>this.saveChildOrder())),n(this,"onEnd",(({to:{parentElement:t},from:{parentElement:e}})=>{null==t||t.classList.remove(`hovering-${zi(t)}`),null==e||e.classList.remove(`hovering-${zi(e)}`)})),n(this,"runConditions",(()=>{const t=this.get("conditions");if(!(null==t?void 0:t.length))return null;return t.map((t=>{const e=this.processConditions(t.if),n=this.processResults(t.then);return e.map((t=>this.evaluateConditions(t)&&this.execResults(n)))}))})),n(this,"value",((t,e)=>{const n=t.split("."),o=this.getComponent(t),i=o&&n.slice(2,n.length).join(".");return[!o,!i,!Z[i]].some(Boolean)?t:e?o.set(Z[i],e):o.get(Z[i])})),n(this,"getResult",(t=>({"=":(t,e,n)=>t.set(e,n)}[t]))),n(this,"processResults",(t=>t.map((({operator:t,target:e,value:n})=>{const o=this.getComponent(e);return{target:o,propertyPath:o&&e.split(".").slice(2,e.length).join("."),action:this.getResult(t),value:this.value(n)}})))),n(this,"execResults",(t=>{const e=t.map((t=>this.execResult(t)));return Promise.all(e)})),n(this,"execResult",(({target:t,action:e,value:n,propertyPath:o})=>new Promise(((o,i)=>{try{return o(e(t,n))}catch(r){return i(r)}})))),n(this,"cloneData",(()=>{const t={...Xi(this.data),id:Ui()};return"field"!==this.name&&(t.children=[]),t})),n(this,"clone",((t=this.parent)=>{const e=t.addChild(this.cloneData(),this.index+1);return"field"!==this.name&&this.cloneChildren(e),e})),n(this,"createChildWrap",(t=>qd.create({tag:"ul",attrs:{className:"children"},children:t}))),this.id=this.data.id,this.name=t,this.config=Wd[`${this.name}s`].config,Hi(this.config,e.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.data.children=this.data.children.filter((e=>-1===t.indexOf(e))),this.dom.classList.add("empty"),t}getActionButtons(){const t=[`hovering-${this.name}`,"hovering"];return{className:[`${this.name}-actions`,"group-actions"],action:{mouseenter:()=>{Wd.stages.active.dom.classList.add(`active-hover-${this.name}`),this.dom.classList.add(...t)},mouseleave:({target:e})=>{this.dom.classList.remove(...t),Wd.stages.active.dom.classList.remove(`active-hover-${this.name}`),e.removeAttribute("style")}},children:[{...qd.btnTemplate({content:qd.icon(`handle-${this.name}`)}),className:["component-handle",`${this.name}-handle`]},{className:["action-btn-wrap",`${this.name}-action-btn-wrap`],children:this.buttons}]}}toggleEdit(t=!this.isEditing){this.isEditing=t;const e=this.dom,n="editing",o=`${n}-${this.name}`,i=this.dom.querySelector(`.${this.name}-edit`);Zr.slideToggle(i,q,t),"field"===this.name&&(Zr.slideToggle(this.preview,q,!t),e.parentElement.classList.toggle(`column-${o}`,t)),e.classList.toggle(n,t),e.classList.toggle(o,t)}get buttons(){if(this.actionButtons)return this.actionButtons;const t={handle:(t=`handle-${this.name}`)=>({...qd.btnTemplate({content:qd.icon(t)}),className:["component-handle"]}),move:(t="move")=>({...qd.btnTemplate({content:qd.icon(t)}),className:["item-move"],meta:{id:"move"}}),edit:(t="edit")=>({...qd.btnTemplate({content:qd.icon(t)}),className:["item-edit-toggle"],meta:{id:"edit"},action:{click:t=>{this.toggleEdit()}}}),remove:(t="remove")=>({...qd.btnTemplate({content:qd.icon(t)}),className:["item-remove"],meta:{id:"remove"},action:{click:(t,e)=>{Zr.slideUp(this.dom,q,(()=>{if("column"===this.name){this.parent.autoColumnWidths(),this.remove()}else this.remove()}))}}}),clone:(t="copy")=>({...qd.btnTemplate({content:qd.icon(t)}),className:["item-clone"],meta:{id:"clone"},action:{click:()=>{this.clone(this.parent),"column"===this.name&&this.parent.autoColumnWidths()}}})},{buttons:e,disabled:n}=this.config.actionButtons,o=e.filter((t=>!n.includes(t))).map((e=>{var n;return(null==(n=t[e])?void 0:n.call(t))||e}));return this.actionButtons=o,this.actionButtons}get index(){return zr(this.dom)}get parentType(){return R.get(this.name)}get parent(){const t=this.parentType;if(!this.dom||!t)return null;const e=this.dom.closest(`.${T[t]}`);return e&&qd.asComponent(e)}get children(){if(!this.dom)return[];const t=this.domChildren,e=M.get(this.name);return Hr(t,(t=>Wd.getAddress(`${e}s.${t.id}`))).filter(Boolean)}get domChildren(){const t=this.dom.querySelector(".children");return t?t.children:[]}addChild(t={},e=this.domChildren.length){var n,o;let i=t;"object"!=typeof t&&(i={id:i});const r=this.dom.querySelector(".children"),{id:s=Ui()}=i,a=M.get(this.name);if(!a)return null;const l=`${a}s`,c=Wd.getAddress(`${l}.${s}`)||Wd[l].add(s,i);r.insertBefore(c.dom,r.children[e]),null==(o=null==(n=this.config.events)?void 0:n.onAddChild)||o.call(n,{parent:this,child:c});const d=c.get("children");return(null==d?void 0:d.length)&&c.loadChildren(d),this.removeClasses("empty"),this.saveChildOrder(),c}onAdd({from:t,to:e,item:n,newIndex:o}){var i;t.classList.contains(y)||(t=t.parentElement);const r=zi(t),s=zi(e.parentElement),a=new Map([[-2,()=>{const t=this.addChild({},o).addChild();return t.addChild.bind(t)}],[-1,()=>{const t=this.addChild({},o);return t.addChild.bind(t)}],[0,()=>this.addChild.bind(this)],[1,t=>{const e=zr(this.dom);return()=>this.parent.addChild(t,e+1)}],[2,t=>()=>this.parent.parent.addChild(t)]]),l={controls:()=>{const{controlData:t}=vd.get(n.id),{meta:{id:e}}=t,i=e.startsWith("layout-")?e.replace(/^layout-/,""):"field",r=Fr({stage:{row:0,column:-1,field:-2},row:{row:1,column:0,field:-1},column:{row:2,column:1,field:0},field:1},`${this.name}.${i}`),s=a.get(r)();qd.remove(n);return s(t,o)},row:()=>{const t=(a.get({stage:-1,row:0,column:1}[s])||Qi)();return null==t?void 0:t({id:n.id},o)},column:()=>{const t=(a.get({stage:-2,row:-1}[s])||Qi)();return null==t?void 0:t(n.id)}},c=null==(i=l[r])?void 0:i.call(l,n,o);return(()=>{this.saveChildOrder(),this.removeClasses("empty")})(),c}onRemove({from:{parentElement:t}}){return t.classList.contains(E)&&t.classList.remove("column-editing-field"),"stage"===this.name||this.children.length?(this.emptyClass(),this.saveChildOrder()):this.remove()}onRender(){const{events:t}=this.config;if(!t)return null;t.onRender&&qd.onRender(this.dom,t.onRender)}set config(t){const e=Fr(this.data,"meta.id"),n=[Fr(t,"all"),e&&Fr(t,e),Fr(t,this.id)].reduce(((t,e)=>e?Hi(t,e):t),this.configVal);this.configVal=n}get config(){return this.configVal}getComponent(t){const[e,n]=t.split("."),o=Wd[e];return n===this.id?this:null==o?void 0:o.get(n)}cloneChildren(t){for(const e of this.children)null==e||e.clone(t)}get isRow(){return this.name===j.row}get isColumn(){return this.name===j.column}get isField(){return this.name===j.field}}class Jc extends Zc{constructor(t=Object.create(null)){super("field",{conditions:[{if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]}],...t}),n(this,"updateConditionsPanel",Ki((()=>{const t=this.editPanels.find((({name:t})=>"conditions"===t));if(!t)return null;const e=t.createProps(),n=this.dom.querySelector(".field-edit-conditions");n.parentElement.replaceChild(e,n)}),q)),n(this,"updatePreview",(()=>{if(!this.preview.parentElement)return null;this.updateLabel();const t=qd.create(this.fieldPreview(),!0);this.preview.parentElement.replaceChild(t,this.preview),this.preview=t})),n(this,"updateEditPanels",(()=>{this.editPanels=[];const t=["object","array"],e=qi([...this.config.panels.order,...Object.keys(this.data)]),n=["config","meta","action","events",...this.config.panels.disabled],o=e.filter((t=>!n.includes(t)));for(const r of o){const e=this.get(r),n=qd.childType(e);if(t.includes(n)){const t=new Gc(e,r,this);this.editPanels.push(t)}}const i={panels:this.editPanels.map((({panelConfig:t})=>t)),id:this.id,displayType:"auto"};this.panels=new jc(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${Dc(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${Dc(e)}`)).includes(t)})),this.debouncedUpdateEditPanels=function(t,e=333){let n;return function(...o){n&&clearTimeout(n),n=setTimeout((()=>t.apply(this,o)),e)}}(this.updateEditPanels),this.label=qd.create(this.labelConfig),this.preview=qd.create({}),this.editPanels=[];const e=this.getActionButtons(),o=this.actionButtons.some((t=>{var e;return"edit"===(null==(e=t.meta)?void 0:e.id)}));let i={tag:"li",attrs:{className:x},id:this.id,children:[this.label,this.getComponentTag(),e,o&&this.fieldEdit,this.preview].filter(Boolean),panelNav:this.panelNav,dataset:{hoverTag:r.get("field")}};i=qd.create(i),this.observe(i),this.dom=i,this.isEditing=!1,this.onRender(i)}get labelConfig(){if(!!this.get("config.hideLabel"))return;const t=this.get("config.editorLabel")||this.get("config.label"),e=this.get("attrs.required"),n=this.config.label.disableHTML;return{className:"prev-label",children:[{...(()=>{const e={tag:"label",attrs:{}};return n?(e.tag="input",e.attrs.value=t,e):(e.attrs.contenteditable=!0,e.children=t,e)})(),action:{input:({target:{innerHTML:t,innerText:e,value:o}})=>{super.set("config.label",n?o:t);const i=Wd.getConditionMap(`fields.${this.id}`);if(i)return i.updateConditionSourceLabel(`${this.name}s.${this.id}`,n?o:e)}}},e&&qd.requiredMark()]}}updateConditionSourceLabel(t,e){const n=this.editPanels.find((({name:t})=>"conditions"===t));if(!n)return null;for(const{itemFieldGroups:o}of n.editPanelItems)for(const n of o){const o=n.find((e=>e.value===t));o&&(o.displayField.value=e)}}set(...t){const[e,n]=t,o=super.set(e,n);return this.updatePreview(),o}updateLabel(){if(!this.label)return null;const t=qd.create(this.labelConfig);this.label.parentElement.replaceChild(t,this.label),this.label=t}get fieldEdit(){const t={className:["field-edit","slide-toggle","formeo-panels-wrap"]};this.updateEditPanels();const e=this.editPanels.length;return e&&(t.className.push(`panel-count-${e}`),t.content=[this.panels.panelNav,this.panels.panelsWrap],this.panelNav=this.panels.nav,this.resizePanelWrap=this.panels.nav.refresh),t.action={onRender:()=>{if(0===e){const t=this.dom,e=t.querySelector(".item-edit-toggle"),n=t.querySelector(".field-actions"),o=n.getElementsByTagName("button");n.style.maxWidth=o.length*o[0].clientWidth+"px",qd.remove(e)}else this.resizePanelWrap()}},qd.create(t)}get defaultPreviewActions(){return{change:t=>{const{target:e}=t,{type:n}=e;if(["checkbox","radio"].includes(n)){const t=+e.id.split("-").pop();this.toggleCheckedOptions(t,n),this.debouncedUpdateEditPanels()}},click:t=>{"true"===t.target.contentEditable&&t.preventDefault()},input:t=>{if(["input","meter","progress","button"].includes(t.target.tagName.toLowerCase()))return super.set("attrs.value",t.target.value),this.debouncedUpdateEditPanels();if(t.target.contentEditable){const e=t.target.parentElement.classList;if(e.contains("f-checkbox")||e.contains("f-radio")){const e=t.target.parentElement,n=e.parentElement,o=zr(e,n);return super.set(`options[${o}].label`,t.target.innerHTML),this.debouncedUpdateEditPanels()}super.set("content",t.target.innerHTML)}}}}fieldPreview(){var t;const e=Xi(this.data),{action:n={}}=vd.get(e.meta.id);e.id=`prev-${this.id}`,e.action=n,(null==(t=this.data)?void 0:t.config.editableContent)&&(e.attrs={...e.attrs,contenteditable:!0});return{attrs:{className:"field-preview",style:this.isEditing&&"display: none;"},content:qd.create(e,!0),action:this.defaultPreviewActions}}}const Kc={js:new Set,css:new Set},Qc=(t,e,n=tr)=>new Promise((o=>fetch(t).then((t=>{if(!t.ok)return o(n(t));o(e?e(t):t)})).catch((t=>n(t))))),td=(t,e)=>{t.removeEventListener("load",td),e(t.src)},ed=(t,e)=>{t.removeEventListener("load",ed),e(t.src)},nd=t=>new Promise(((e,n)=>{if(Kc.js.has(t))return e(t);Kc.js.add(t);const o=qd.create({tag:"script",attrs:{type:"text/javascript",async:!0,src:t},action:{load:()=>ed(o,e),error:()=>n(new Error(`${t} failed to load.`))}});document.head.appendChild(o)})),od=t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>new Promise(((e,n)=>{if(Kc.css.has(t))return e(t);Kc.css.add(t);const o=qd.create({tag:"link",attrs:{rel:"stylesheet",href:t},action:{load:()=>td(o,e),error:()=>n(new Error(`${(void 0).src} failed to load.`))}});document.head.appendChild(o)}))));return Promise.all(e)},id=async(t=g)=>{if(document.getElementById(f))return;const e=async t=>(t=>{let e=document.getElementById(f);return e||(e=qd.create({id:f,children:t,attrs:{hidden:!0,style:"display: none;"}}),document.body.insertBefore(e,document.body.childNodes[0])),e})(await t.text());return Qc(t,e,(()=>Qc(v,e)))},rd={js:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>nd(t)));return Promise.all(e)},css:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>od(t)));return Promise.all(e)}},sd=t=>{const e=Object.entries(t).map((([t,e])=>rd[t](e)));return Promise.all(e)},ad=()=>{const t=document.getElementById(f);return"hidden"===window.getComputedStyle(t).visibility};class ld{constructor({events:t={},dependencies:e={},controlAction:o,...i}){n(this,"controlCache",new Set),this.events=t,this.controlData=i,this.controlAction=o,this.dependencies=e,this.id=i.id||Ui()}get controlId(){var t;return null==(t=this.controlData.meta)?void 0:t.id}get dom(){const{meta:t,config:e}=this.controlData,n=this.i18n(e.label)||e.label,o={tag:"button",attrs:{type:"button"},content:[{tag:"span",className:"control-icon",children:qd.icon(t.icon)},n],action:{focus:({target:t})=>{const e=t.closest(`.${y}`);return e&&vd.panels.nav.refresh(zr(e))},click:({target:t})=>{vd.addElement(t.parentElement.id)}}};return qd.create({tag:"li",id:this.id,className:["field-control",`${t.group}-control`,`${t.id}-control`],content:o,meta:t,action:this.controlAction})}promise(){return sd(this.dependencies)}i18n(t,e){var n,o;const i=r.locale,s=null==(n=this.definition)?void 0:n.i18n,a=(null==s?void 0:s[i])||{};return((null==(o=a[t])?void 0:o.call(a))??a[t])||r.get(t,e)}}const cd=[{config:{label:"row"},meta:{group:"layout",icon:"rows",id:"layout-row"}},{config:{label:"column"},meta:{group:"layout",icon:"columns",id:"layout-column"}}];const dd=(t,e=3)=>Array.from({length:e},((t,e)=>e+1)).map((e=>{const n="checkbox"===t?"checked":"selected";return{label:r.get("labelCount",{label:Dc(t),count:e}),value:`${t}-${e}`,[n]:!e}}));const ud=[class extends ld{constructor(){super({tag:"button",attrs:{className:[{label:"grouped",value:"f-btn-group"},{label:"ungrouped",value:"f-field-group"}]},config:{label:r.get("controls.form.button"),hideLabel:!0},meta:{group:"common",icon:"button",id:"button"},options:[{label:r.get("button"),type:["button","submit","reset"].map((t=>({label:t,type:t}))),className:[{label:"default",value:"",selected:!0},{label:"primary",value:"primary"},{label:"danger",value:"error"},{label:"success",value:"success"},{label:"warning",value:"warning"}]}]})}},class extends ld{constructor(){super({tag:"input",attrs:{type:"date",required:!1,className:""},config:{label:r.get("controls.form.input.date")},meta:{group:"common",icon:"calendar",id:"date-input"}})}},class extends ld{constructor(){super({tag:"input",attrs:{type:"hidden",value:""},config:{label:r.get("hidden"),hideLabel:!0},meta:{group:"common",icon:"hidden",id:"hidden"}})}},class extends ld{constructor(){super({tag:"input",attrs:{type:"number",required:!1,className:""},config:{label:r.get("number")},meta:{group:"common",icon:"hash",id:"number"}})}},class extends ld{constructor(){super({tag:"textarea",config:{label:r.get("controls.form.textarea")},meta:{group:"common",icon:"textarea",id:"textarea"},attrs:{required:!1}})}},class extends ld{constructor(){super({tag:"input",attrs:{required:!1,type:"text",className:""},config:{label:r.get("controls.form.input.text")},meta:{group:"common",icon:"text-input",id:"text-input"}})}},class extends ld{constructor(){super({tag:"input",attrs:{type:"file",required:!1},config:{label:r.get("fileUpload")},meta:{group:"common",icon:"upload",id:"upload"}})}},class extends ld{constructor(){super({tag:"select",config:{label:r.get("controls.form.select")},attrs:{required:!1,className:""},meta:{group:"common",icon:"select",id:"select"},options:dd("option")})}},class extends ld{constructor(){super({tag:"input",attrs:{type:"checkbox",required:!1},config:{label:r.get("controls.form.checkbox-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"checkbox",id:"checkbox"},options:dd("checkbox",1)})}},class extends ld{constructor(){super({tag:"input",attrs:{type:"radio",required:!1},config:{label:r.get("controls.form.radio-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"radio-group",id:"radio"},options:dd("radio")})}}],hd=Array.from(Array(5).keys()).slice(1).map((t=>`h${t}`)),pd="controls.html.header";const fd=[class extends ld{constructor(){super({tag:hd[0],attrs:{tag:hd.map(((t,e)=>({label:t.toUpperCase(),value:t,selected:!e}))),className:""},config:{label:r.get(pd),hideLabel:!0,editableContent:!0},meta:{group:"html",icon:"header",id:"html.header"},content:r.get(pd),action:{}})}static get definition(){return{i18n:{"en-US":{header:"Custom English Header"}}}}get content(){return super.i18n(pd)}},class extends ld{constructor(){super({tag:"p",attrs:{className:""},config:{label:r.get("controls.html.paragraph"),hideLabel:!0,editableContent:!0},meta:{group:"html",icon:"paragraph",id:"paragraph"},content:"Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment."})}},class extends ld{constructor(){super({tag:"hr",config:{label:r.get("controls.html.divider"),hideLabel:!0},meta:{group:"html",icon:"divider",id:"divider"}})}},class extends ld{constructor(t){super(Hi({tag:"textarea",config:{label:"WYSIWYG",editableContent:!0},meta:{group:"html",icon:"rich-text",id:"tinymce"},attrs:{required:!1},dependencies:{js:"https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.9.11/tinymce.min.js"},action:{onRender:t=>{const e=`#${t.id}`;window.tinymce.remove(e),window.tinymce.init({selector:e})}},controlAction:{click:()=>{},onRender:()=>{}}},t))}}],md=Object.freeze({sortable:!0,elementOrder:{},groupOrder:[],groups:[{id:"layout",label:"controls.groups.layout",elementOrder:["row","column"]},{id:"common",label:"controls.groups.form",elementOrder:["button","checkbox"]},{id:"html",label:"controls.groups.html",elementOrder:["header","block-text"]}],disable:{groups:[],elements:[],formActions:[]},elements:[],container:null,panels:{displayType:"slider"}}),gd=[...ud,...fd,...cd];const vd=new class{constructor(){n(this,"groupLabel",(t=>r.get(t)||t||"")),n(this,"addElement",(t=>{const e=Fr(this.get(t),"controlData"),{meta:{group:n,id:o}}=e,i={row:()=>Dd.active.addChild(),column:()=>i.row().addChild(),field:t=>i.column().addChild(t)};return"layout"!==n?i.field(e):i[o.replace("layout-","")]()})),n(this,"applyOptions",(async(t={})=>{const{container:e,elements:n,groupOrder:o,...i}=Hi(md,t);return this.container=e,this.groupOrder=qi(o.concat(["common","html","layout"])),this.options=i,Promise.all(this.registerControls([...gd,...n]))})),this.data=new Map,this.buttonActions={focus:({target:t})=>{const e=t.closest(`.${y}`);return e&&this.panels.nav.refresh(zr(e))},click:({target:t})=>{this.addElement(t.parentElement.id)}}}async init(t,e=!1){return await this.applyOptions(t),this.buildDOM(e),this}registerControls(t){return this.controls=[],t.map((async t=>{let e;return e="function"==typeof t?new t:new ld(t),this.add(e),this.controls.push(e.dom),e.promise()}))}groupElements(){let t=this.options.groups.slice(),e=this.controls.slice(),n=[];const o=[];return t=qr(t,this.groupOrder,"id"),t=t.filter((t=>Bi(t.id,this.options.disable.groups))),n=t.map((t=>{const n={tag:"ul",attrs:{className:y,id:`${t.id}-${y}`},config:{label:this.groupLabel(t.label)}};if(this.options.elementOrder[t.id]){const e=this.options.elementOrder[t.id],n=qi(e.concat(t.elementOrder));t.elementOrder=n}return e=qr(e,t.elementOrder,"meta.id"),n.content=e.filter((e=>{const{controlData:n}=this.get(e.id),i=n.meta.id||"";let r=!0;return r=[Bi(i,this.options.disable.elements),n.meta.group===t.id,!o.includes(n.meta.id)].every((t=>!0===t)),r&&o.push(i),r})),n})),n}add(t=Object.create(null)){const e=Xi(t);return this.data.set(e.id,e),e.controlData.meta.id&&this.data.set(e.controlData.meta.id,e.controlData),e}get(t){return Xi(this.data.get(t))}formActions(){if(!0===this.options.disable.formActions)return null;const t={...qd.btnTemplate({content:[qd.icon("bin"),r.get("clear")],title:r.get("clearAll")}),className:["clear-form"],action:{click:t=>{kd.size?(ts.confirmClearAll=new window.CustomEvent("confirmClearAll",{detail:{confirmationMessage:r.get("confirmClearAll"),clearAllAction:()=>{Dd.clearAll().then((()=>{const e={src:t.target};ts.formeoCleared(e)}))},btnCoords:qd.coords(t.target)}}),document.dispatchEvent(ts.confirmClearAll)):window.alert(r.get("cannotClearFields"))}}},e={...qd.btnTemplate({content:[qd.icon("floppy-disk"),r.get("save")],title:r.get("save")}),className:["save-form"],action:{click:({target:t})=>{const{formData:e}=Wd,n={action:()=>{},coords:qd.coords(t),message:"",button:t};return _c.click.btn(n),_c.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 jc({panels:e,type:"controls",displayType:o});const i=["control-groups","formeo-panels-wrap",`panel-count-${e.length}`],s=qd.create({className:i,content:[this.panels.panelNav,this.panels.panelsWrap]}),a=["formeo-controls"];t&&a.push("formeo-sticky");const l=qd.create({className:a,content:[s,n]}),c=l.getElementsByClassName("control-group");this.dom=l,this.groups=c;const[d]=c;this.currentGroup=d,this.actions={filter:t=>{const e=""!==t,n=this.controls;let o=s.querySelector(".filtered-term");if(qd.toggleElementsByStr(n,t),e){const e=r.get("controls.filteringTerm",t);l.classList.add("filtered"),o?o.textContent=e:(o=qd.create({tag:"h5",className:"filtered-term",content:e}),s.insertBefore(o,s.firstChild))}else o&&(l.classList.remove("filtered"),o.remove())},addElement:this.addElement,addGroup:t=>{}};for(let r=c.length-1;r>=0;r--){const t=`formeo-controls-${c[r]}`;this.options.sortable||window.localStorage.removeItem(t),ic.create(c[r],{animation:150,forceFallback:!0,fallbackClass:"control-moving",fallbackOnBody:!0,group:{name:"controls",pull:"clone",put:!1},onStart:({item:t})=>{const{controlData:e}=this.get(t.id);this.options.ghostPreview&&(t.innerHTML="",t.appendChild(new Jc(e).preview))},onEnd:({from:t,item:e,clone:n})=>{t.contains(n)&&t.replaceChild(e,n)},sort:this.options.sortable,store:{get:()=>{const e=window.localStorage.getItem(t);return e?e.split("|"):[]},set:e=>{const n=e.toArray();window.localStorage.setItem(t,n.join("|"))}}})}return l}};class bd extends Ca{constructor(){super(...arguments),n(this,"load",((t=Object.create(null))=>(this.empty(),"string"==typeof t&&(t=JSON.parse(t)),Object.entries(t).forEach((([t,e])=>this.add(t,e))),this.data))),n(this,"get",(t=>t?Fr(this.data,t):this.add())),n(this,"add",((t,e=Object.create(null))=>{const n=t||Ui(),o=this.Component({...e,id:n});return this.set(n,o),this.active=o,o})),n(this,"remove",(t=>(Array.isArray(t)?t.forEach((t=>{this.get(t).remove()})):this.get(t).remove(),this.data))),n(this,"delete",(t=>(delete this.data[t],t))),n(this,"clearAll",((t=!0)=>{const e=Object.values(this.data).map((e=>e.empty(t)));return Promise.all(e)})),n(this,"conditionMap",new Map)}set config(t){this.configVal=Hi(this.configVal,Xi(t))}get config(){return this.configVal}}class yd extends Zc{constructor(t,e){super("stage",{...Object.freeze({children:[]}),...t},e);const n=this.createChildWrap();this.dom=qd.create({attrs:{className:[w,"empty"],id:this.id},children:n}),ic.create(n,{animation:150,fallbackClass:"row-moving",forceFallback:!0,group:{name:"stage",pull:!0,put:["row","column","controls"]},sort:!0,disabled:!1,onAdd:this.onAdd.bind(this),onRemove:this.onRemove.bind(this),onStart:()=>{wd.active=this},onSort:this.onSort.bind(this),draggable:`.${C}`,handle:".item-move"})}empty(t=!0){return new Promise((e=>{t?(this.dom.classList.add("removing-all-fields"),Zr.slideUp(this.dom,q,(()=>{e(super.empty(t)),this.dom.classList.remove("removing-all-fields"),Zr.slideDown(this.dom,q)}))):e(super.empty())}))}onAdd(...t){const e=super.onAdd(...t);e&&"column"===e.name&&e.parent.autoColumnWidths()}}const wd=new class extends bd{constructor(t){super("stages",t)}Component(t){return new yd(t)}};class Cd extends Zc{constructor(t){super("row",{...Object.freeze({config:{fieldset:!1,legend:"",inputGroup:!1},children:[],className:[C]}),...t}),n(this,"autoColumnWidths",(()=>{const t=this.children;if(!t.length)return;const e=Number.parseFloat((100/t.length).toFixed(1))/1;for(const n of t){n.removeClasses(Q);const t=n.dom,o=Yi(e);n.set("config.width",o),t.style.width=o,t.dataset.colWidth=o;const i=setTimeout((()=>{clearTimeout(i),n.refreshFieldPanels()}),U);document.dispatchEvent(ts.columnResized)}this.updateColumnPreset()})),n(this,"updateColumnPreset",(()=>{this.columnPresetControl.innerHTML="";const t=this.getColumnPresetOptions.map((({label:t,...e})=>qd.create({tag:"option",content:t,attrs:e})));this.columnPresetControl.append(...t)})),n(this,"setColumnWidths",(t=>{"string"==typeof t&&(t=t.split(",")),this.children.forEach(((e,n)=>{e.setWidth(`${t[n]}%`),e.refreshFieldPanels()}))}));const e=this.createChildWrap();this.dom=qd.create({tag:"li",className:[C,"empty"],dataset:{hoverTag:r.get("row"),editingHoverTag:r.get("editing.row")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),this.editWindow,e]}),ic.create(e,{animation:150,fallbackClass:"column-moving",forceFallback:!0,group:{name:"row",pull:!0,put:["row","column","controls"]},sort:!0,disabled:!1,onRemove:this.onRemove.bind(this),onEnd:this.onEnd.bind(this),onAdd:this.onAdd.bind(this),onSort:this.onSort.bind(this),draggable:`.${E}`,handle:".item-move"})}get editWindow(){const t={tag:"input",id:`${this.id}-fieldset`,attrs:{type:"checkbox",checked:this.get("config.fieldset"),ariaLabel:r.get("row.settings.fieldsetWrap.aria")},action:{click:({target:{checked:t}})=>{this.set("config.fieldset",Boolean(t))}},config:{label:r.get("row.settings.fieldsetWrap")}},e={tag:"input",id:`${this.id}-inputGroup`,attrs:{type:"checkbox",checked:this.get("config.inputGroup"),ariaLabel:r.get("row.settings.inputGroup.aria")},action:{click:({target:{checked:t}})=>this.set("config.inputGroup",t)},config:{label:r.get("row.makeInputGroup"),description:r.get("row.makeInputGroupDesc")}},n={className:"input-group",content:{tag:"input",attrs:{type:"text",ariaLabel:"Legend for fieldset",value:this.get("config.legend"),placeholder:"Title"},config:{label:{children:["Row Title",{tag:"span",content:" ⓘ",dataset:{tooltip:"Row title will be used as the legend for the fieldset"}}]}},action:{input:({target:{value:t}})=>this.set("config.legend",t)},className:""}},o=qd.formGroup([t,n]),i={tag:"label",content:r.get("defineColumnWidths"),className:"col-sm-4 form-control-label"};this.columnPresetControl=qd.create(this.columnPresetControlConfig);const s={className:"col-sm-8",content:this.columnPresetControl,action:{onRender:()=>{this.updateColumnPreset()}}},a=[e,"hr",o,"hr",qd.formGroup([i,s],"row")];return qd.create({className:`${this.name}-edit group-config`,action:{onRender:t=>{const e=a.map((t=>qd.create(t)));t.append(...e)}}})}onAdd(...t){super.onAdd(...t),this.autoColumnWidths()}onRemove(...t){super.onRemove(...t),this.autoColumnWidths()}get getColumnPresetOptions(){const t=this.children,e=F.get(t.length-1)||[],n=t.map((t=>{const e=t.get("config.width")||"";return Number(e.replace("%","")).toFixed(1)})).join(",");if(e.length){const t=e.slice();return!t.find((t=>t.value===n))&&t.push({value:n,label:n.replace(/,/g," | "),className:S}),t.map((t=>{const e={...t};return e.selected=t.value===n,e}))}return[]}get columnPresetControlConfig(){return{tag:"select",attrs:{ariaLabel:r.get("defineColumnLayout"),className:O},action:{change:({target:t})=>{const{value:e}=t;this.setColumnWidths(e)}},options:this.getColumnPresetOptions}}}const Ed={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]}};const xd=new class extends bd{constructor(t){super("rows",t),this.config={all:Ed}}Component(t){return new Cd(t)}};class Sd{constructor(){this.onMove=this.onMove.bind(this),this.onStop=this.onStop.bind(this),this.cleanup=this.cleanup.bind(this)}getRowWidth(t){const e=t.querySelector(".children");if(!e)return 0;const n=e.children.length,o=qd.getStyle(e,"gap")||"0px",i=parseFloat(o,10)||0;return this.totalGapWidth=i*(n-1),e.offsetWidth-this.totalGapWidth}validateResizeTarget(t,e){return t&&e&&t.offsetWidth&&e.offsetWidth}onStart(t){if(t.preventDefault(),this.resized=!1,0!==t.button)return;const e=t.target.parentElement,n=e.nextSibling||e.previousSibling,o=e.closest(`.${C}`);if(this.validateResizeTarget(e,n))if(this.startX="touchstart"===t.type?t.touches[0].clientX:t.clientX,o.classList.add(_),this.columnPreset=o.querySelector(`.${O}`),this.originalColumnClass=e.className,this.originalSiblingClass=n.className,e.className=e.className.replace(Q,""),n.className=n.className.replace(Q,""),this.colStartWidth=e.offsetWidth,this.sibStartWidth=n.offsetWidth,this.rowWidth=this.getRowWidth(o),this.rowWidth<=0)this.cleanup();else{this.column=e,this.sibling=n,this.row=o;try{window.addEventListener("pointermove",this.onMove,!1),window.addEventListener("pointerup",this.onStop,!1)}catch(i){this.cleanup()}}else this.cleanup()}calculateNewWidths(t){const e=this.colStartWidth+t-this.startX,n=this.sibStartWidth-t+this.startX,o=parseFloat(Vi(e,this.rowWidth)),i=parseFloat(Vi(n,this.rowWidth));return o<10||i<10?null:{colWidth:Yi(o.toFixed(1)),siblingColWidth:Yi(i.toFixed(1))}}onMove(t){t.preventDefault();const{column:e,sibling:n}=this,o="touchmove"===t.type?t.touches[0].clientX:t.clientX,i=this.calculateNewWidths(o);if(!i)return;const{colWidth:r,siblingColWidth:s}=i;e.dataset.colWidth=r,n.dataset.colWidth=s,e.style.width=r,n.style.width=s,this.resized=!0}onStop(){const{column:t,sibling:e}=this;window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onStop),this.resized&&(this.setCustomWidthValue(),Wd.setAddress(`columns.${t.id}.config.width`,t.dataset.colWidth),Wd.setAddress(`columns.${e.id}.config.width`,e.dataset.colWidth),this.row.classList.remove(_),this.resized=!1,this.cleanup())}cleanup(){this.column&&this.originalColumnClass&&(this.column.className=this.originalColumnClass),this.sibling&&this.originalSiblingClass&&(this.sibling.className=this.originalSiblingClass),this.row&&this.row.classList.remove(_),window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onStop)}setCustomWidthValue(){const t=this.columnPreset;let e=t.querySelector(`.${S}`);const n=this.row.querySelector(".children").children,o=Hr(n,(t=>Vi(t.clientWidth,this.rowWidth).toFixed(1))),i=o.join(","),r=o.join(" | ");return e||(e=qd.create({tag:"option",attrs:{className:S,value:i,selected:!0},content:r}),t.append(e)),e.value=i,e.textContent=r,i}}const Od=t=>({className:"resize-x-handle",action:{pointerdown:t.onStart.bind(t)},content:[qd.icon("triangle-down"),qd.icon("triangle-up")]}),_d=()=>({className:"column-edit group-config"});class Nd extends Zc{constructor(t){super("column",{...Object.freeze({config:{width:"100%"},children:[],className:[E]}),...t}),n(this,"refreshFieldPanels",(()=>{for(const t of this.children)t.panels.nav.refresh()})),n(this,"setDomWidth",(t=>{this.dom.dataset.colWidth=t,this.dom.style.width=t})),n(this,"setWidth",(t=>(this.setDomWidth(t),this.set("config.width",t))));const e=this.createChildWrap();this.dom=qd.create({tag:"li",className:[E,"empty"],dataset:{hoverTag:r.get("column")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),_d(),Od(new Sd),e]}),this.processConfig(),ts.columnResized=new window.CustomEvent("columnResized",{detail:{column:this.dom,instance:this}}),ic.create(e,{animation:150,fallbackClass:"field-moving",forceFallback:!0,group:{name:"column",pull:!0,put:["column","controls"]},sort:!0,disabled:!1,onEnd:this.onEnd.bind(this),onAdd:this.onAdd.bind(this),onSort:this.onSort.bind(this),onRemove:this.onRemove.bind(this),onMove:t=>{t.from!==t.to&&t.from.classList.remove("hovering-column")},draggable:`.${x}`,handle:".item-move"})}processConfig(){const t=Gr.get(this.data,"config.width");t&&this.setDomWidth(t)}}const Ad={actionButtons:{buttons:["clone","move","remove"],disabled:[]}};const jd=new class extends bd{constructor(t){super("columns",t),this.config={all:Ad}}Component(t){return new Nd(t)}},Pd={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]},panels:{disabled:[],attrs:{disabled:["type"],hideDisabled:!0,locked:[]},order:["attrs","options","conditions"]},label:{disableHTML:!1}};const Td=new class extends bd{constructor(t){super("fields",t),n(this,"get",(t=>{let e=t&&Fr(this.data,t);if(!e){const n=vd.get(t);n&&(e=this.add(null,n.controlData))}return e})),n(this,"getData",(()=>Object.entries(this.data).reduce(((t,[e,n])=>{const{conditions:o,...i}=(null==n?void 0:n.getData())||n;if(null==o?void 0:o.length){let t=!0;if(1===o.length){const[e]=o;t=Boolean(e.if[0].source&&e.then[0].target)}t&&(i.conditions=o)}return t[e]=i,t}),{}))),this.config={all:Pd}}Component(t){return new Jc(t)}};const Ld=new class extends bd{constructor(t){super("externals",t)}Component(t){return new Zc("external",t)}},Dd=wd,kd=xd,$d=jd,Id=Td,Md=vd,Rd=Ld,Fd={id:Ui()};const Wd=new class extends Ca{constructor(t){super("components"),n(this,"sessionFormData",(()=>{var t;if(null==(t=this.opts)?void 0:t.sessionStorage)return Gi.get(B)})),n(this,"load",((t,e=this.opts||Object.create(null))=>{let n=t;this.empty(),"string"==typeof t&&(n=JSON.parse(t)),this.opts=e;const{stages:o={[Ui()]:{}},rows:i,columns:r,fields:s,id:a=Ui()}={...this.sessionFormData(),...n};this.set("id",a),this.add("stages",Dd.load(o)),this.add("rows",kd.load(i)),this.add("columns",$d.load(r)),this.add("fields",Id.load(s)),this.add("externals",Rd.load(e.external));for(const l of Object.values(this.get("stages")))l.loadChildren();return this.data})),this.opts=t,this.data=Fd,this.disableEvents=!0,this.stages=Dd,this.rows=kd,this.columns=$d,this.fields=Id,this.controls=Md,this.externals=Rd}flatList(t=this.data,e=Object.create(null)){return Object.entries(t).reduce(((t,[e,n])=>{if("object"==typeof n)for(const[o,i]of Object.entries(n))t[`${e}.${o}`]=i;return t}),e)}get json(){return window.JSON.stringify({$schema:`https://cdn.jsdelivr.net/npm/formeo@${p}/dist/formData_schema.json`,...this.formData})}get formData(){return{id:this.get("id"),stages:wd.getData(),rows:xd.getData(),columns:jd.getData(),fields:Td.getData()}}set config(t){const{stages:e,rows:n,columns:o,fields:i}=t;Dd.config=e,kd.config=n,$d.config=o,Id.config=i}setAddress(t,e){const[n,o,...i]=Array.isArray(t)?t:t.split("."),r=this[n.replace(/s?$/,"s")].get(o);return null==r||r.set(i,e),r}getAddress(t){if(!Zi(t))return;const[e,n,...o]=Array.isArray(t)?t:t.split("."),i=this[e.replace(/s?$/,"s")].get(n);return o.length?i.get(o):i}getConditionMap(t){if(Zi(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.get(e[1])}}setConditionMap(t,e){if(Zi(t)){const n=t.split(".");return n.every((t=>Boolean(t)))&&this[n[0]].conditionMap.set(n[1],e)}}removeConditionMap(t){if(Zi(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.delete(e[1])}}},Bd={glyphicons:t=>``,"font-awesome":t=>{const[e,n]=t.split(" ");return``},fontello:t=>`${t}`},zd=new Set(["input","textarea","select"]);const qd=new class{constructor(t=Object.create(null)){n(this,"render",(t=>(t.id=`f-${t.id||Ui()}`,this.create(t)))),n(this,"create",((t,e=!1)=>{if(!t)return;const n=this,o=["children","content"],{className:i,options:r,dataset:s,...a}=this.processTagName(t);let l;o.push("tag");const{tag:c}=a;let d;const u={attrs:{},className:[Gr.get(a,"config.inputWrap")||"f-field-group"],children:[],config:{}};let h=document.createElement(c);const p={string:t=>{h.innerHTML+=t},object:t=>t&&h.appendChild(n.create(t,e)),node:t=>h.appendChild(t),component:t=>h.appendChild(t.dom),array:t=>{for(const e of t)l=n.childType(e),p[l](e)},function:t=>{t=t(),l=n.childType(t),p[l](t)},undefined:()=>null,boolean:()=>null};if(i&&(a.attrs=Hi(a.attrs,{className:i})),r){const t=this.processOptions(r,a,e);if(!this.holdsContent(h)||"button"===c)return Gr.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(Gr.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=Gr.subtract(o,Object.keys(a));for(d=f.length-1;d>=0;d--)h[f[d]]=a[f[d]];return u.children.length&&(h=this.create(u)),h})),n(this,"onRender",((t,e)=>{t.parentElement?e(t):window.requestAnimationFrame((()=>this.onRender(t,e)))})),n(this,"toggleElementsByStr",((t,e)=>{const n=[];return qd.elementsContainText(t,e,((t,e)=>{e?(t.style.display="block",n.push(t)):t.style.display="none"})),n})),n(this,"elementsContainText",((t,e,n)=>{const o=[];return Ur(t,(t=>{const i=-1!==t.textContent.toLowerCase().indexOf(e.toLowerCase());null==n||n(t,i),i&&o.push(t)})),o})),n(this,"generateOption",(({type:t="option",label:e,value:n,i:o=0,selected:i})=>({tag:"option"===t?"option":"input",attrs:{type:t,value:n||`${t}-${o}`,["option"===t?"selected":"checked"]:i||!o},config:{label:e||r.get("labelCount",{label:r.get("option"),count:o})}}))),n(this,"requiredMark",(()=>({tag:"span",className:"text-error",children:"*"}))),n(this,"removeEmpty",(t=>{const e=t.parentElement,n=zi(t),o=e.getElementsByClassName(`formeo-${n}`);if(this.remove(t),!o.length)return this.isStage(e)?this.emptyClass(e):this.removeEmpty(e)})),n(this,"btnTemplate",(({title:t="",...e})=>({tag:"button",attrs:{type:"button",title:t},...e}))),n(this,"isControls",(t=>zi(t)===y)),n(this,"isStage",(t=>zi(t)===w)),n(this,"isRow",(t=>zi(t)===C)),n(this,"isColumn",(t=>zi(t)===E)),n(this,"isField",(t=>zi(t)===x)),n(this,"asComponent",(t=>Wd[`${zi(t)}s`].get(t.id))),this.options=t}set setOptions(t){this.options=Hi(this.options,t)}processTagName(t){let e,n=t;if("string"==typeof n)return e=n,n={tag:e},n;if(n.attrs){const{tag:t,...o}=n.attrs;if(t)if("string"==typeof t)e=t;else{e=(t.find((t=>!0===t.selected))||t[0]).value}n.attrs=o}return n.tag=e||n.tag||"div",n}actionHandler(t,e){const n={onRender:qd.onRender,render:qd.onRender},o=["focus","blur"];return Object.entries(e).map((([e,i])=>(Array.isArray(i)?i:[i]).map((i=>{const r=n[e]||(t=>(e,n)=>e.addEventListener(t,n,o.includes(t)))(e);return r(t,i)}))))}get icons(){if(this.iconSymbols)return this.iconSymbols;const t=document.querySelectorAll(`#${f} svg symbol`);return this.iconSymbols=Array.from(t).reduce(((t,e)=>{var n;return t[e.id.replace(tt,"")]={tag:"svg",attrs:{className:["svg-icon",n=e.id]},children:[{tag:"use",attrs:{"xmlns:xlink":"http://www.w3.org/1999/xlink","xlink:href":`#${n}`}}]},t}),{}),this.cachedIcons={},this.iconSymbols}icon(t,e){var n,o;if(!t)return;const i=`${t}?${new URLSearchParams(e).toString()}`;if(null==(n=this.cachedIcons)?void 0:n[i])return this.cachedIcons[i];const r=this.icons[t];if(r){if(e){const t=Hi(r,e);return this.cachedIcons[i]=qd.create(t).outerHTML,this.cachedIcons[i]}return this.cachedIcons[i]=qd.create(r).outerHTML,this.cachedIcons[i]}return(null==(o=Bd[qd.options.iconFont])?void 0:o.call(Bd,t))||t}processAttrs(t,e,n){const{attrs:o={}}=t;n||o.name||!this.isInput(t.tag)||e.setAttribute("name",Ui(t));for(const i of Object.keys(o)){const t=Gr.safeAttrName(i),n=this.processAttrValue(o[i]);n&&e.setAttribute(t,!0===n?"":n)}}processAttrValue(t){let e=t||"";if(Array.isArray(e))if("object"==typeof e[0]){const t=e.filter((t=>!0===t.selected));e=t.length?t[0].value:e[0].value}else e=e.join(" ");return e}processOptions(t,e,n){const{action:o,attrs:i}=e,r=i.type||e.tag,s=i.id||e.id;return t.map(((t,i)=>{var a;const{label:l,...c}=t,d=()=>{const a={tag:"input",attrs:{name:s,type:r,value:t.value||"",id:`${s}-${i}`,...c},action:o},l={tag:"label",attrs:{for:`${s}-${i}`},config:{inputWrap:"form-check"},children:t.label},d={children:[a,l],className:[`f-${r}`]};return e.attrs.className&&(e.config.inputWrap=e.attrs.className),e.config.inline&&d.className.push(`f-${r}-inline`),t.selected&&(a.attrs.checked=!0),n&&(l.attrs.contenteditable=!0),d},u={select:()=>({tag:"option",attrs:t,children:t.label}),button:t=>{const{type:n,label:o,className:i,id:r}=t;return{...e,attrs:{type:n},className:i,id:r||Ui(),options:void 0,children:o,action:e.action}},checkbox:d,radio:d};return null==(a=u[r])?void 0:a.call(u,t)}))}holdsContent(t){return-1!==t.outerHTML.indexOf("/")}isBlockInput(t){return!this.isInput(t)&&this.holdsContent(t)}isInput(t){let e=t;return"string"!=typeof e&&(e=e.tagName),zd.has(e)}parsedHtml(t){const e=document.createElement("textarea");return e.innerHTML=t,e.textContent}labelAfter(t){const e=Gr.get(t,"attrs.type"),n=Gr.get(t,"config.labelAfter");return void 0!==n?n:"checkbox"===e||"radio"===e}label(t,e){const n=Gr.get(t,"attrs.required");let{config:{label:o=""}}=t;const{id:i,attrs:r}=t;"function"==typeof o&&(o=o());const s={tag:"label",attrs:{for:i||(null==r?void 0:r.id)},className:[],children:[o,n&&this.requiredMark()],action:{}};return e&&(s.attrs.for=void 0,s.attrs.contenteditable=!0,s.fMap=e),s}childType(t){return void 0===t?t:[["array",t=>Array.isArray(t)],["node",t=>t instanceof window.Node||t instanceof window.HTMLElement],["component",()=>null==t?void 0:t.dom],[typeof t,()=>!0]].find((e=>e[1](t)))[0]}getStyle(t,e=!1){let n;return window.getComputedStyle?n=window.getComputedStyle(t,null):t.currentStyle&&(n=t.currentStyle),e?n[e]:n}getElement(t){return{node:()=>t,object:()=>document.getElementById(t.id),string:()=>document.getElementById(t)}[this.childType(t)]()}empty(t){for(;t.firstChild;)this.remove(t.firstChild);return t}remove(t){const e=zi(t);return e?Wd.remove(`${e}s.${t.id}`):t.parentElement.removeChild(t)}removeClasses(t,e){const n={string:t=>t.classList.remove(e),array:t=>{for(const n of e)t.classList.remove(n)}};n.object=n.string,Gr.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)}};Gr.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");Zr.slideUp(t,600,(()=>{qd.empty(t),t.classList.remove("removing-all-fields"),qd.emptyClass(t),Zr.slideDown(t,300)}))}toggleSortable(t,e){let n=e;const o=zi(t);if(!o)return;const i=zi(t.parentElement),r=qd[o].get(t.id).sortable;n||(n=!r.option("disabled")),r.option("disabled",n),i&&["rows","columns","stages"].includes(i)&&this.toggleSortable(t.parentElement,n)}emptyClass(t){const e=t.getElementsByClassName(N.get(t.classList.item(0)));t.classList.toggle("empty",!e.length)}};r.addLanguage("en-US",void 0);const Ud={get editor(){return{stickyControls:!1,allowEdit:!0,dataType:"json",debug:!1,sessionStorage:!1,editorContainer:null,external:{},svgSprite:g,style:b,iconFont:null,config:{},events:{},actions:{},controls:{},polyfills:Yr(),i18n:{location:"https://draggable.github.io/formeo/assets/lang/"}}}};let Hd=class{constructor({formData:t,...e},n){const o=Hi(Ud.editor,e),{actions:i,events:r,debug:s,config:a,editorContainer:l,...c}=o;l&&(this.editorContainer="string"==typeof l?document.querySelector(l):l),this.opts=c,qd.setOptions=c,Wd.config=a,this.userFormData=n||t,this.Components=Wd,this.dom=qd,ts.init({debug:s,...r}),_c.init({debug:s,sessionStorage:c.sessionStorage,...i}),this.tooltip=new u,document.addEventListener("DOMContentLoaded",this.loadResources.bind(this))}get formData(){return this.Components.formData}set formData(t={}){this.load({...this.userFormData,...t},this.opts)}get json(){return this.Components.json}async loadResources(){var t;document.removeEventListener("DOMContentLoaded",this.loadResources);const e=[];this.opts.polyfills&&(t=>{const e=Array.isArray(t)?m.filter((({name:e})=>-1!==t.indexOf(e))):m;Promise.all(e.map((({src:t})=>nd(t))))})(this.opts.polyfills),await id(this.opts.svgSprite),e.push((async t=>{if(!ad()&&(await od(t),!ad()))return await od("https://draggable.github.io/formeo/assets/css/formeo.min.css")})(this.opts.style)),e.push(r.init({...this.opts.i18n,locale:null==(t=window.sessionStorage)?void 0:t.getItem(z)}));const n=await Promise.all(e);return this.opts.allowEdit&&this.init(),n}init(){vd.init(this.opts.controls,this.opts.stickyControls).then((t=>{this.controls=t,this.load(this.userFormData,this.opts),this.formId=Wd.get("id"),this.i18n={setLang:t=>{var e;null==(e=window.sessionStorage)||e.setItem(z,t);r.setCurrent(t).then((()=>{this.init()}),console.error)}},this.render()}))}load(t=this.userFormData,e=this.opts){return this.Components.load(t,e)}render(){if(!this.controls)return window.requestAnimationFrame((()=>this.render()));if(this.stages=Object.values(Wd.get("stages")),this.opts.controlOnLeft)for(const e of this.stages)e.dom.style.order=1;const t={attrs:{className:"formeo formeo-editor",id:this.formId},content:[this.stages.map((({dom:t})=>t))]};r.current.dir&&(t.attrs.dir=r.current.dir,qd.dir=r.current.dir),this.editor=qd.create(t);(this.controls.container||this.editor).appendChild(this.controls.dom),this.editorContainer&&(qd.empty(this.editorContainer),this.editorContainer.appendChild(this.editor)),ts.formeoLoaded=new window.CustomEvent("formeoLoaded",{detail:{formeo:this}}),document.dispatchEvent(ts.formeoLoaded)}};const Xd=t=>{const e=t.match(K);return(null==e?void 0:e[0])||t},Vd=t=>t.replace(K,Ui());let Yd=class{constructor(t,e={}){n(this,"render",((t=this.form)=>{this.form=t;const e=document.getElementsByClassName("formeo-render").length,n={id:this.form.id,className:`formeo-render formeo formeo-rendered-${e}`,children:this.processedData};this.renderedForm=qd.render(n),this.applyConditions();const o=this.container.querySelector(".formeo-render");o?o.replaceWith(this.renderedForm):this.container.appendChild(this.renderedForm)})),n(this,"orderChildren",((t,e)=>e.reduce(((e,n)=>(e.push(this.form[t][n]),e)),[]))),n(this,"prefixId",(t=>"f-"+t)),n(this,"processColumn",(({id:t,...e})=>({...e,id:this.prefixId(t),children:this.processFields(e.children),style:`width: ${e.config.width||"100%"}`}))),n(this,"processRows",(t=>this.orderChildren("rows",this.form.stages[t].children).reduce(((t,e)=>(e&&t.push(this.processRow(e)),t)),[]))),n(this,"cacheComponent",(t=>(this.components[Xd(t.id)]=t,t))),n(this,"processRow",((t,e="row")=>{const{config:n,id:o}=t,i=[`formeo-${e}-wrap`],r={...t,children:this.processColumns(t.id),id:this.prefixId(o)};this.cacheComponent(r);const s=[{condition:n.legend,result:()=>({tag:n.fieldset?"legend":"h3",children:n.legend})},{condition:!0,result:()=>r},{condition:n.inputGroup,result:()=>this.addButton(o)}].reduce(((t,{condition:e,result:n})=>(e&&t.push(n()),t)),[]);return n.inputGroup&&i.push("f-input-group-wrap"),{tag:n.fieldset?"fieldset":"div",id:Ui(),className:i,children:s}})),n(this,"cloneComponentData",(t=>{const{children:e=[],id:n,...o}=this.components[t];return Object.assign({},o,{id:Vd(n),children:e.length&&e.map((({id:t})=>this.cloneComponentData(Xd(t))))})})),n(this,"addButton",(t=>qd.render({tag:"button",attrs:{className:"add-input-group btn pull-right",type:"button"},children:"Add +",action:{click:e=>{const n=e.target.parentElement,o=qd.render(this.cloneComponentData(t));n.insertBefore(o,n.lastChild),o.appendChild(qd.render(qd.btnTemplate({className:"remove-input-group",children:qd.icon("remove"),action:{mouseover:({target:t})=>t.parentElement.classList.add("will-remove"),mouseleave:({target:t})=>t.parentElement.classList.remove("will-remove"),click:({target:t})=>t.parentElement.remove()}})))}}}))),n(this,"processColumns",(t=>this.orderChildren("columns",this.form.rows[t].children).map((t=>this.cacheComponent(this.processColumn(t)))))),n(this,"processFieldsOrig",(t=>this.orderChildren("fields",t).map((({id:t,...e})=>this.cacheComponent(Object.assign({},e,{id:this.prefixId(t)})))))),n(this,"processFields",(t=>this.orderChildren("fields",t).map((({id:t,...e})=>{const{action:n={},dependencies:o={}}=this.elements[e.meta.id]||{};o&&sd(o);const i=Hi({action:n},e);return this.cacheComponent({...i,id:this.prefixId(t)})})))),n(this,"applyConditions",(()=>{Object.values(this.components).forEach((({conditions:t})=>{t&&t.forEach(((t,e)=>{const{if:n,then:o}=t;n.forEach((t=>{const{source:e,...n}=t;if(Zi(e)){this.getComponents(e).forEach((t=>{const e=Gd(t);e&&t.addEventListener(e,(t=>this.evaluateCondition(n,t)&&o.forEach((e=>this.execResult(e,t)))),!1);const i={target:t};this.evaluateCondition(n,i)&&o.forEach((t=>this.execResult(t,i)))}))}}))}))}))})),n(this,"evaluateCondition",(({sourceProperty:t,targetProperty:e,comparison:n,target:o},i)=>{var r;const s={equals:wa,notEquals:(t,e)=>!wa(t,e),contains:(t,e)=>t.includes(e),notContains:(t,e)=>!t.includes(e)},a=String(i.target[t]),l=String(Zi(o)?this.getComponent(o)[e]:o);return null==(r=s[n])?void 0:r.call(s,a,l)})),n(this,"execResult",(({assignment:t,target:e,targetProperty:n,value:o})=>{var i;const r={equals:t=>{var e;const i={value:()=>{t[n]=o},isNotVisible:()=>{t.parentElement.setAttribute("hidden",!0),t.required=!1},isVisible:()=>{t.parentElement.removeAttribute("hidden"),t.required=t._required}};null==(e=i[n])||e.call(i)}};if(Zi(e)){const n=this.getComponent(e);n&&void 0===n._required&&(n._required=n.required),null==(i=r[t])||i.call(r,n)}})),n(this,"getComponent",(t=>{const e=t.slice(t.indexOf(".")+1);return Ji(t)?this.external[e]:this.renderedForm.querySelector(`#f-${e}`)})),n(this,"getComponents",(t=>{const e=[],n=t.slice(t.indexOf(".")+1);return Ji(t)?e.push(this.external[n]):e.push(...this.renderedForm.querySelectorAll(`[name=f-${n}]`)),e}));const{renderContainer:o,external:i,elements:r}=(({editorContainer:t,renderContainer:e,...n})=>{const o=t=>"string"==typeof t?document.querySelector(t):t;return{...n,renderContainer:o(e),editorContainer:o(t)}})(t);this.container=o,this.form=e,this.external=i,this.dom=qd,this.components=Object.create(null),this.elements=r}get processedData(){return Object.values(this.form.stages).map((t=>(t.children=this.processRows(t.id),t.className=w,qd.render(t))))}};const Gd=t=>{const[e]=[["input",t=>["textarea","text"].includes(t.type)],["change",t=>["select"].includes(t.tagName.toLowerCase())||["checkbox","radio"].includes(t.type)]].find((e=>e[1](t)))||[!1];return e};void 0!==window&&(window.FormeoEditor=Hd,window.FormeoRenderer=Yd);const Zd=Hd,Jd=Yd;t.FormeoEditor=Zd,t.FormeoRenderer=Jd,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})})); diff --git a/assets/js/formeo.min.js.gz b/assets/js/formeo.min.js.gz index 34c12fe5..e5ffcd39 100644 Binary files a/assets/js/formeo.min.js.gz and b/assets/js/formeo.min.js.gz differ diff --git a/index.html b/index.html index 6ef57cb7..aa09709a 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -Formeo | Drag & Drop Form Creation

Rendered Form

\ No newline at end of file +Formeo | Drag & Drop Form Creation

Rendered Form

\ No newline at end of file