@buildocsdev/sdk 1.1.7 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- import {g,i,l,k as k$1,d as d$1}from'./chunk-XIHHDF46.js';import {b as b$2,f,e as e$1,g as g$2}from'./chunk-FRAOYRZD.js';import {b as b$3,a as a$3}from'./chunk-22LEYH6Q.js';import {u,v,x,P,Q,t,w,g as g$3}from'./chunk-XUX4HB5C.js';import {b as b$1}from'./chunk-LBMVBVXW.js';import {m,d,j as j$1,k,o,n,e,f as f$1,g as g$1,l as l$1}from'./chunk-UB4UI4WT.js';import {j,a as a$1,n as n$1,Q as Q$1,u as u$1,B,F,O,t as t$1}from'./chunk-TO4AS5KE.js';import {a as a$2}from'./chunk-SDIZEEZP.js';import {a,b}from'./chunk-EK7ODJWE.js';import*as Te from'react';import Te__default,{memo,useRef,useState,useEffect,createElement,createContext,lazy,useCallback,startTransition,Suspense,useContext,useMemo}from'react';import {withTranslation,useTranslation}from'react-i18next';import {useLocation,useNavigate}from'react-router-dom';import {nanoid}from'@reduxjs/toolkit';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import rr from'@mui/material/Box';import ai from'@mui/material/Button';import ri from'@mui/material/Tooltip';import zi from'axios';import Xi from'@mui/material/CircularProgress';import Zi from'@mui/material/LinearProgress';import vr from'@mui/material/IconButton';import Ul from'@mui/material/InputAdornment';import Hl from'@mui/icons-material/Visibility';import Wl from'@mui/icons-material/VisibilityOff';import {animated,useSpring}from'@react-spring/web';import {styled,alpha}from'@mui/material/styles';import ql from'@mui/material/Collapse';import Jl from'@mui/material/Typography';import jl from'@mui/icons-material/FolderRounded';import {RichTreeView}from'@mui/x-tree-view/RichTreeView';import {treeItemClasses}from'@mui/x-tree-view/TreeItem';import {unstable_useTreeItem2}from'@mui/x-tree-view/useTreeItem2';import {TreeItem2Root,TreeItem2Content,TreeItem2IconContainer,TreeItem2Checkbox,TreeItem2Label}from'@mui/x-tree-view/TreeItem2';import {TreeItem2Icon}from'@mui/x-tree-view/TreeItem2Icon';import {TreeItem2DragAndDropOverlay}from'@mui/x-tree-view/TreeItem2DragAndDropOverlay';import Ct from'@mui/material/ListItemIcon';import xt from'@mui/material/ListItemText';import nd from'@mui/material/Menu';import It from'@mui/material/MenuItem';import Sd from'i18next';import xd from'@mui/material/Backdrop';var vt=a((_t,At)=>{(function(t,e){typeof _t=="object"&&typeof At!="undefined"?At.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis!="undefined"?globalThis:t||self).dayjs_plugin_utc=e();})(_t,(function(){var t="minute",e=/[+-]\d\d(?::?\d\d)?/g,n=/([+-]|\d\d)/g;return function(i,r,s){var a=r.prototype;s.utc=function(d){var u={date:d,utc:true,args:arguments};return new r(u)},a.utc=function(d){var u=s(this.toDate(),{locale:this.$L,utc:true});return d?u.add(this.utcOffset(),t):u},a.local=function(){return s(this.toDate(),{locale:this.$L,utc:false})};var f=a.parse;a.parse=function(d){d.utc&&(this.$u=true),this.$utils().u(d.$offset)||(this.$offset=d.$offset),f.call(this,d);};var m=a.init;a.init=function(){if(this.$u){var d=this.$d;this.$y=d.getUTCFullYear(),this.$M=d.getUTCMonth(),this.$D=d.getUTCDate(),this.$W=d.getUTCDay(),this.$H=d.getUTCHours(),this.$m=d.getUTCMinutes(),this.$s=d.getUTCSeconds(),this.$ms=d.getUTCMilliseconds();}else m.call(this);};var c=a.utcOffset;a.utcOffset=function(d,u){var g=this.$utils().u;if(g(d))return this.$u?0:g(this.$offset)?c.call(this):this.$offset;if(typeof d=="string"&&(d=(function(y){y===void 0&&(y="");var D=y.match(e);if(!D)return null;var V=(""+D[0]).match(n)||["-",0,0],M=V[0],C=60*+V[1]+ +V[2];return C===0?0:M==="+"?C:-C})(d),d===null))return this;var b=Math.abs(d)<=16?60*d:d;if(b===0)return this.utc(u);var h=this.clone();if(u)return h.$offset=b,h.$u=false,h;var S=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return (h=this.local().add(b+S,t)).$offset=b,h.$x.$localOffset=S,h};var w=a.format;a.format=function(d){var u=d||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return w.call(this,u)},a.valueOf=function(){var d=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*d},a.isUTC=function(){return !!this.$u},a.toISOString=function(){return this.toDate().toISOString()},a.toString=function(){return this.toDate().toUTCString()};var F=a.toDate;a.toDate=function(d){return d==="s"&&this.$offset?s(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():F.call(this)};var p=a.diff;a.diff=function(d,u,g){if(d&&this.$u===d.$u)return p.call(this,d,u,g);var b=this.local(),h=s(d).local();return p.call(b,h,u,g)};}}));});var zn=a((We,Gn)=>{Object.defineProperty(We,"__esModule",{value:true});function _e(t){return typeof t=="object"&&!("toString"in t)?Object.prototype.toString.call(t).slice(8,-1):t}var Rr=typeof process=="object"&&true;function Me(t,e){if(!t)throw Rr?new Error("Invariant failed"):new Error(e())}We.invariant=Me;var Vt=Object.prototype.hasOwnProperty,Er=Array.prototype.splice,kr=Object.prototype.toString;function Xe(t){return kr.call(t).slice(8,-1)}var yt=Object.assign||(function(t,e){return Ot(e).forEach(function(n){Vt.call(e,n)&&(t[n]=e[n]);}),t}),Ot=typeof Object.getOwnPropertySymbols=="function"?function(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.keys(t)};function Je(t){return Array.isArray(t)?yt(t.constructor(t.length),t):Xe(t)==="Map"?new Map(t):Xe(t)==="Set"?new Set(t):t&&typeof t=="object"?yt(Object.create(Object.getPrototypeOf(t)),t):t}var Wn=(function(){function t(){this.commands=yt({},Mr),this.update=this.update.bind(this),this.update.extend=this.extend=this.extend.bind(this),this.update.isEquals=function(e,n){return e===n},this.update.newContext=function(){return new t().update};}return Object.defineProperty(t.prototype,"isEquals",{get:function(){return this.update.isEquals},set:function(e){this.update.isEquals=e;},enumerable:true,configurable:true}),t.prototype.extend=function(e,n){this.commands[e]=n;},t.prototype.update=function(e,n){var i=this,r=typeof n=="function"?{$apply:n}:n;Array.isArray(e)&&Array.isArray(r)||Me(!Array.isArray(r),function(){return "update(): You provided an invalid spec to update(). The spec may not contain an array except as the value of $set, $push, $unshift, $splice or any custom command allowing an array value."}),Me(typeof r=="object"&&r!==null,function(){return "update(): You provided an invalid spec to update(). The spec and every included key path must be plain objects containing one of the "+("following commands: "+Object.keys(i.commands).join(", ")+".")});var s=e;return Ot(r).forEach(function(a){if(Vt.call(i.commands,a)){var f=e===s;s=i.commands[a](r[a],s,r,e),f&&i.isEquals(s,e)&&(s=e);}else {var m=Xe(e)==="Map"?i.update(e.get(a),r[a]):i.update(e[a],r[a]),c=Xe(s)==="Map"?s.get(a):s[a];(!i.isEquals(m,c)||typeof m=="undefined"&&!Vt.call(e,a))&&(s===e&&(s=Je(e)),Xe(s)==="Map"?s.set(a,m):s[a]=m);}}),s},t})();We.Context=Wn;var Mr={$push:function(t,e,n){return Un(e,n,"$push"),t.length?e.concat(t):e},$unshift:function(t,e,n){return Un(e,n,"$unshift"),t.length?t.concat(e):e},$splice:function(t,e,n,i){return Br(e,n),t.forEach(function(r){$n(r),e===i&&r.length&&(e=Je(i)),Er.apply(e,r);}),e},$set:function(t,e,n){return Lr(n),t},$toggle:function(t,e){lt(t,"$toggle");var n=t.length?Je(e):e;return t.forEach(function(i){n[i]=!e[i];}),n},$unset:function(t,e,n,i){return lt(t,"$unset"),t.forEach(function(r){Object.hasOwnProperty.call(e,r)&&(e===i&&(e=Je(i)),delete e[r]);}),e},$add:function(t,e,n,i){return Hn(e,"$add"),lt(t,"$add"),Xe(e)==="Map"?t.forEach(function(r){var s=r[0],a=r[1];e===i&&e.get(s)!==a&&(e=Je(i)),e.set(s,a);}):t.forEach(function(r){e===i&&!e.has(r)&&(e=Je(i)),e.add(r);}),e},$remove:function(t,e,n,i){return Hn(e,"$remove"),lt(t,"$remove"),t.forEach(function(r){e===i&&e.has(r)&&(e=Je(i)),e.delete(r);}),e},$merge:function(t,e,n,i){return _r(e,t),Ot(t).forEach(function(r){t[r]!==e[r]&&(e===i&&(e=Je(i)),e[r]=t[r]);}),e},$apply:function(t,e){return Nr(t),t(e)}},Ut=new Wn;We.isEquals=Ut.update.isEquals;We.extend=Ut.extend;We.default=Ut.update;We.default.default=Gn.exports=yt(We.default,We);function Un(t,e,n){Me(Array.isArray(t),function(){return "update(): expected target of "+_e(n)+" to be an array; got "+_e(t)+"."}),lt(e[n],n);}function lt(t,e){Me(Array.isArray(t),function(){return "update(): expected spec of "+_e(e)+" to be an array; got "+_e(t)+". Did you forget to wrap your parameter in an array?"});}function Br(t,e){Me(Array.isArray(t),function(){return "Expected $splice target to be an array; got "+_e(t)}),$n(e.$splice);}function $n(t){Me(Array.isArray(t),function(){return "update(): expected spec of $splice to be an array of arrays; got "+_e(t)+". Did you forget to wrap your parameters in an array?"});}function Nr(t){Me(typeof t=="function",function(){return "update(): expected spec of $apply to be a function; got "+_e(t)+"."});}function Lr(t){Me(Object.keys(t).length===1,function(){return "Cannot have more than one key in an object with $set"});}function _r(t,e){Me(e&&typeof e=="object",function(){return "update(): $merge expects a spec of type 'object'; got "+_e(e)}),Me(t&&typeof t=="object",function(){return "update(): $merge expects a target of type 'object'; got "+_e(t)});}function Hn(t,e){var n=Xe(t);Me(n==="Map"||n==="Set",function(){return "update(): "+_e(e)+" expects a target of type Set or Map; got "+_e(n)});}});var wr=b(zn());var Jn=withTranslation()(memo(function(e){let{id:n,tabId:i,panelId:r,context:s,methodProvider:a,widgetsState:f}=e,m=a.findRowItem(i,r,n);return Te__default.createElement("div",{className:"row-container"},(m.item._children||[]).map(({rowId:c,id:w,component:F,properties:p})=>Te__default.createElement(Ae.getFormComponent(F,p),{key:"key_"+w,tabId:i,panelId:r,rowId:c,segmentId:w,properties:p,widgetsState:f,methodProvider:a,context:{...s},segmentsCount:m.item._children.length},null)))}));Jn.displayName="_Rowcontainer";var jn=Jn;var Qn=withTranslation()(memo(function(e){let{tabId:n,panelId:i,rowId:r,segmentId:s,segmentsCount:a,properties:f,methodProvider:m,context:c,widgetsState:w}=e,F=m.findSegmentItem(n,i,r,s),p={...f.style};return Te__default.createElement("div",{className:"rowSegment",style:p},(F.item._children||[]).map(({id:d,component:u,properties:g})=>{let b=g.groupname?g.groupname:g.name;return Te__default.createElement(Ae.getFormComponent(u,g),{key:"key_"+d,context:{params:c.params,displayButtonLoader:c.displayButtonLoader,doValidateForm:c.doValidateForm,redrawComponent:c.redrawComponent,formDimension:c.formDimension,segmentDimensions:{minWidth:parseInt(p.minWidth)},tabIndex:c.tabIndex,formData:u.displayName==="_Fileuploader"||u.displayName==="_Label"||u.displayName==="_View"||u.displayName==="_Textinput"&&g.inputtype==="currency"?c.formData:[]},id:d,methodProvider:m,panelId:i,properties:{...g,visible:w!==void 0&&w.visibility[b]!==void 0?w.visibility[b]:g.visible,readonly:w!==void 0&&w.readonly[b]!==void 0?w.readonly[b]:g.readonly},rowId:r,segmentId:s,segmentsCount:a,tabId:n,value:c.formData!==void 0?c.formData[b]:void 0,fieldAllowedValues:c!=null&&c.fieldAllowedValues?c.fieldAllowedValues[b]:void 0,validationMessage:c!=null&&c.formValidationData&&c.formValidationData[b]!==void 0?c.formValidationData[b]:null},null)}))}));Qn.displayName="_Rowsegment";var Kn=Qn;function jr(t,e){return {id:t,value:e}}var Zn=withTranslation()(memo(function(e){var O;let n=useRef(null),{datalength:i,id:r,forcereadonly:s,ignorereadonly:a,label:f,name:m$1,onchangehandler:c,placeholder:w,readonly:F,regex:p,searchbar:d,size:u,style:g,tabIndex:b,uppercasemode:h,variant:S,visible:y}=e.properties,D=useLocation(),{viewPort:V}=b$1(),{tabId:M}=e,[C,T]=useState(String((O=e.value)!=null?O:"")),[v,J]=Te__default.useState([]),Z=!!(C.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{var R;T(String((R=e.value)!=null?R:""));},[e.value]),useEffect(()=>{let R=[];if(e.fieldAllowedValues){for(let U in e.fieldAllowedValues)R.push(jr(U,e.fieldAllowedValues[U]));J(R);}},[e.fieldAllowedValues]);let ee=R=>{var U;e.methodProvider.eventDispatcher({widgetName:m$1,widgetValue:R,widgetEvent:c?Q.onChange:null,widgetContext:JSON.stringify({referer:D.pathname,parentWidgetId:M,hasParentForm:P.hasParentForm(),originator:(U=e.context.params)==null?void 0:U.originator})});},x=R=>{T(R);};return jsx(m,{autoFocus:false,data:v,disabled:!!(F&&!a),error:Z,helperText:Z?e.validationMessage:"",id:r,inputProps:{id:r,tabIndex:b,style:{...g},autoComplete:nanoid(5)},InputProps:{},inputRef:n,label:f,maxCharCount:i,name:m$1,onBlur:R=>{ee(R.target.value);},onInput:R=>{x(R.target.value),V.isMobileDevice&&ee(R.currentTarget.value);},onChange:R=>{C.trim()===""&&ee(R.target.value);},placeholder:w,readOnly:!!(F&&!a),regEx:p,searchBar:d,size:u!=null?u:"small",type:"text",inputtype:e.properties.inputType,toUpperCase:h,value:C,variant:S,visible:y})}));Zn.displayName="_Input";var ea=Zn;var oa=withTranslation()(memo(function(e){var R;let n=useRef(null),{datalength:i,id:r,forcereadonly:s,ignorereadonly:a,label:f,name:m$1,onchangehandler:c,placeholder:w,readonly:F,regex:p,size:d,style:u,tabIndex:g,uppercasemode:b,variant:h,visible:S}=e.properties,y=useLocation(),{viewPort:D}=b$1(),{tabId:V}=e,[M,C]=useState(String((R=e.value)!=null?R:"")),T=!!(M.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm),[v,J]=useState(false),{t:Z}=useTranslation(),ee=()=>{navigator.clipboard.writeText(M).then(()=>{J(true),setTimeout(()=>J(false),2e4);});};useEffect(()=>{var U;C(String((U=e.value)!=null?U:""));},[e.value]);let x=U=>{var j;e.methodProvider.eventDispatcher({widgetName:m$1,widgetValue:U,widgetEvent:c?Q.onChange:null,widgetContext:JSON.stringify({referer:y.pathname,parentWidgetId:V,hasParentForm:P.hasParentForm(),originator:(j=e.context.params)==null?void 0:j.originator})});},O=U=>{C(U);};return jsxs(rr,{display:"flex",alignItems:"flex-start",gap:0,children:[jsx(m,{autoFocus:false,disabled:!!(F&&!a),error:T,helperText:T?e.validationMessage:"",id:r,inputProps:{id:r,tabIndex:g,style:{...u},autoComplete:nanoid(5)},InputProps:{},inputRef:n,label:f,maxCharCount:i,name:m$1,onBlur:U=>{x(U.target.value);},onInput:U=>{O(U.target.value),D.isMobileDevice&&x(U.currentTarget.value);},onChange:U=>{M.trim()===""&&x(U.target.value);},placeholder:w,readOnly:!!(F&&!a),regEx:p,size:d,type:"text",inputtype:e.properties.inputType,toUpperCase:b,value:M,variant:h,visible:S}),S&&jsx(ri,{title:Z(v?"copied!":"copy to clipboard"),children:jsx(ai,{variant:"contained",style:{backgroundColor:"#C0C0C0",borderRadius:"0px 4px 4px 0px",boxShadow:"none",marginLeft:"-3px",border:"2px solid #C0C0C0",lineHeight:"24px",fontSize:"11px"},onClick:ee,startIcon:jsx(j,{}),children:Z("copy")})})]})}));oa.displayName="_InputWCopy";var na=oa;var ra=withTranslation()(memo(function(e){useRef(null);let {tabId:i,id:r,context:s,widgetsState:a}=e,f=e.methodProvider.findWidgetItem(r),m=e.methodProvider.getActiveTabIndex(i,r),c=(p,d,u,g)=>{d||(p.target.style.background=g,p.target.style.color=u);},w$1=(p,d,u,g)=>{d||(p.target.style.background=g,p.target.style.color=u);},F=({children:p,...d})=>jsx(w,{onPointerUp:u=>u.stopPropagation(),onMouseOver:u=>c(u,d.selected,d.item_active_color,d.item_active_background_color),onMouseOut:u=>w$1(u,d.selected,d.item_default_color,d.item_default_background_color),style:{borderRadius:"5px 5px 0 0",marginRight:"1px",color:d.selected?d.item_active_color:d.item_default_color,background:d.selected?d.item_active_background_color:d.item_default_background_color,fontSize:d.item_fontsize,fontWeight:d.item_fontweight},selected:d.selected,children:p},d.id);return F.tabsRole="Tab",e.properties.visible?Te__default.createElement("div",{className:"form-tab-widget"},jsxs(u,{selectedIndex:m,onSelect:p=>e.methodProvider.setActiveTabIndex(i,r,p),children:[jsx(v,{children:(f.item._children||[]).map(({properties:p},d)=>!p.item_visible||a&&a.visibility&&a.visibility[p.item_name]===false?null:createElement(F,{...f.item.properties.tabsetup,...p,key:"TabCaptionComponent_"+r+"_"+d},p.item_title))}),(f.item._children||[]).map(({_children:p},d)=>jsx(x,{children:(p||[]).map(({tabId:u,panelId:g,id:b,type:h,component:S,properties:y},D)=>Te__default.createElement(Ae.getFormComponent(S,y),{key:"tabSubPanel_"+D,id:b,tabId:u,panelId:g,properties:{...y,visible:a!==void 0&&a.visibility[y.name]!==void 0?a.visibility[y.name]:y.visible,readonly:a!==void 0&&a.readonly[y.name]!==void 0?a.readonly[y.name]:y.readonly},className:h,widgetsState:a,methodProvider:e.methodProvider,context:{...s},segmentsCount:f.item._children.length,fieldAllowedValues:s!=null&&s.fieldAllowedValues?s.fieldAllowedValues[y.name]:void 0},null))},"TabPanel_"+r+"_"+d))]})):null}));ra.displayName="_TabBox";var ia=ra;function pi(t,e){if(!e||Array.isArray(e)&&e.length===0)return t;let n=e;return t.replace(/<b>@(\w+)<\/b>|@(\w+)/g,(i,r,s)=>{let a=(r||s).toLowerCase(),f=n[a];return typeof f=="string"?r?`<b>${f}</b>`:f:i})}var da=withTranslation()(memo(function(e){let{title:n,style:i,verticalalign:r,visible:s}=e.properties,a={paddingTop:"0px"};if(r==="bottom"&&(a.paddingTop="10px"),!s)return null;let f=pi(n,e.context.formData);return jsx("div",{style:{...i,...a},children:jsx("div",{style:{...i},dangerouslySetInnerHTML:{__html:f}})})}));da.displayName="_Label";var sa=da;var ua=withTranslation()(memo(function(e){let n=useRef(null),{defaultvalue:i,id:r,ignorereadonly:s,label:a,labelplacement:f,name:m,onchangehandler:c,readonly:w,style:F,tabIndex:p,visible:d$1}=e.properties,u=m,g=e.value||"",b=useLocation(),{tabId:h}=e,S=!!(!g&&e.validationMessage!=null&&e.context.doValidateForm);return useEffect(()=>{!e.value&&i&&e.methodProvider.eventDispatcher({widgetName:u,widgetValue:e.properties.value,widgetEvent:null,widgetContext:JSON.stringify({referer:b.pathname,parentWidgetId:h,hasParentForm:P.hasParentForm()})});},[]),jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:F.textAlign,height:"100%"},children:jsx(d,{checkedIcon:void 0,defaultChecked:!!(e.value===void 0&&i),disabled:!!(w&&!s),error:S,helperText:S?e.validationMessage:"",icon:void 0,inputProps:{id:r,tabIndex:p},inputRef:n,labelText:a,labelPlacement:f,name:u,onChange:y=>{e.methodProvider.eventDispatcher({widgetName:u,widgetValue:y.target.checked?e.properties.value:"",widgetEvent:c?Q.onChange:null,widgetContext:JSON.stringify({referer:b.pathname,parentWidgetId:h,hasParentForm:P.hasParentForm()})});},selectedValue:g,value:e.properties.value,visible:d$1})})}));ua.displayName="_Checkbox";var ca=ua;var pa=withTranslation()(memo(function(e){let n=useRef(null),{defaultvalue:i,groupname:r,id:s,ignorereadonly:a,label:f,labelplacement:m,name:c,onchangehandler:w,readonly:F,style:p,tabIndex:d,visible:u}=e.properties,g=useLocation(),{tabId:b}=e;useEffect(()=>{!y&&i&&V(e.properties.value);},[]);let h=r||c;let y=e.value||"",D=!!(e.validationMessage!=null&&e.context.doValidateForm),V=M=>{var C;e.methodProvider.eventDispatcher({widgetName:h,widgetValue:M,widgetEvent:w?Q.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:b,hasParentForm:P.hasParentForm(),originator:(C=e.context.params)==null?void 0:C.originator})});};return jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:p.textAlign,height:"100%"},children:jsx(j$1,{defaultValue:i?e.properties.value:"",disabled:!!(F&&!a),inputProps:{id:s,tabIndex:d,style:{...p}},error:D,helperText:D?e.validationMessage:"",inputRef:n,labelText:f,labelPlacement:m,name:h,onChange:M=>{y!==M.target.value.trim()&&V(M.target.value);},selectedValue:y,value:e.properties.value,visible:u})})}));pa.displayName="_Radio";var ga=pa;var ha=withTranslation()(memo(function(e){var ee;let n=useRef(null),{runFormEvent:i,viewPort:r}=b$1(),{id:s,autocompleteTextArea:a,ignorereadonly:f,label:m$1,name:c,onchangehandler:w,placeholder:F,required:p,requiredmessage:d,readonly:u,size:g,style:b,tabIndex:h,variant:S,visible:y}=e.properties,D=useLocation(),{tabId:V}=e,[M,C]=useState(String((ee=e.value)!=null?ee:""));useEffect(()=>{var x;C(String((x=e.value)!=null?x:""));},[e.value]);let T=!!(M.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm),v=x=>{var O;e.methodProvider.eventDispatcher({widgetName:c,widgetValue:x,widgetEvent:w?Q.onChange:null,widgetContext:JSON.stringify({referer:D.pathname,parentWidgetId:V,hasParentForm:P.hasParentForm(),originator:(O=e.context.params)==null?void 0:O.originator})});},J=async x=>{var O,R,U;try{let j=await i({pluginCode:e.context.params.pluginCode,formCode:e.context.params.formCode,guid:e.context.params.guid,projectGuid:e.context.params.pGuid,pGuid:e.context.params.pGuid,formData:(O=e.context.formData)!=null?O:{},widgetContext:JSON.stringify({}),widgetEvent:Q.onGetCustomResponse,widgetName:c,widgetValue:JSON.stringify({methodName:"getAutoCompleteData",value:x})});if(((R=j.meta)==null?void 0:R.requestStatus)==="fulfilled"){let N=j.payload,E=(U=N==null?void 0:N.FECommand)==null?void 0:U.CustomResponse;if(Array.isArray(E))return E.filter($=>typeof $=="string").map($=>({label:$}))}}catch(j){}return []},Z=x=>{C(x);};return jsx(m,{autocompleteTextArea:a,autoFocus:false,disabled:!!(u&&!f),id:s,inputProps:{id:s,tabIndex:h,readOnly:!!(u&&!f),style:{...b}},error:T,helperText:T?e.validationMessage:"",InputProps:{},inputRef:n,label:m$1,multiline:true,name:c,onAutoCompleteChange:a?x=>J(x):void 0,onBlur:x=>{v(x.target.value);},onInput:x=>{Z(x.target.value),r.isMobileDevice&&v(x.currentTarget.value);},onChange:x=>{M.trim()===""&&v(x.target.value);},placeholder:F,readOnly:!!(u&&!f),size:g,type:"text",value:M,variant:S,visible:y})}));ha.displayName="_Textarea";var ba=ha;function va(t,e){return {id:t,value:e}}var Gt="\xA4",ya=withTranslation()(memo(function(e){var R,U;let n=useRef(null),[i,r]=Te__default.useState(null),[s,a]=Te__default.useState([]),f=typeof e.value=="string"&&e.value!=null&&e.value.length>0?e.value.split(Gt):[],[m,c]=Te__default.useState(f),{id:w,ignorereadonly:F,label:p,multiple:d,name:u,onchangehandler:g,placeholder:b,readonly:h,rendertype:S,searchbar:y,size:D,tabIndex:V,variant:M,visible:C,dropvalues:T}=e.properties,v=useLocation(),{tabId:J}=e,{t:Z}=useTranslation();useEffect(()=>{let j=typeof e.value=="string"&&e.value!=null&&e.value.length>0?e.value.split(Gt):[];c(j);},[e.value]),useEffect(()=>{let j=S==="none"?[{id:"",value:""}]:[];if(T&&Array.isArray(T)&&T.length>0){for(let N of T)typeof N=="object"&&N!==null&&j.push(va(N.id||"",N.value||""));a(j);}else if(e.fieldAllowedValues){for(let N in e.fieldAllowedValues)j.push(va(N,e.fieldAllowedValues[N]));a(j);}},[e.fieldAllowedValues,T]),useEffect(()=>{var j;if(i===false){let N=typeof e.value!="string"?e.value:[];(JSON.stringify(N)!==JSON.stringify(m)||m.length===0)&&e.methodProvider.eventDispatcher({widgetName:u,widgetValue:m.length>0?m.join(Gt):[],widgetEvent:g?Q.onChange:null,widgetContext:JSON.stringify({referer:v.pathname,parentWidgetId:J,hasParentForm:P.hasParentForm(),originator:(j=e.context.params)==null?void 0:j.originator,folderData:e.context.params.folderData})});}},[i]);let ee=j=>{let{target:{value:N}}=j,E;d?E=typeof N=="string"?N.split(","):N:E=typeof N=="string"?[N]:N,c(E);},x=e.context.formDimension.width/e.segmentsCount;x=x<e.context.segmentDimensions.minWidth?e.context.segmentDimensions.minWidth:x-60;let O=!!(m.length===0&&e.validationMessage!=null&&e.context.doValidateForm);return jsx(k,{darkMode:false,data:s,error:O,helperText:O?e.validationMessage:"",inputProps:{tabIndex:V,style:{maxWidth:`${x}px`}},inputRef:n,onOpen:()=>{r(true);},onClose:()=>{r(false);},onChange:ee,id:w,label:p,multiple:d,placeholder:b,readOnly:h&&!F,renderType:S,noOptionsText:(U=(R=e.properties)==null?void 0:R.noOptionsLabel)!=null?U:Z("No options"),searchBar:y,selectDisplayProps:{style:{maxWidth:"100%",whiteSpace:S==="chip"?"normal":"nowrap"}},selectedValue:m,size:D,variant:M,width:"auto",visible:C})}));ya.displayName="_SelectBox";var wa=ya;var Ca=withTranslation()(memo(function(e){var f;let{style:n,visible:i}=(f=e.properties)!=null?f:{},[r,s]=useState(false);if(useEffect(()=>{s(true);},[]),!r)return null;let a="form-widget form-placeholder-widget";return i||(a+=" visibilityOff"),jsx("div",{className:a,style:{...n,display:"flex",alignItems:"center",justifyContent:"center",width:"100%",textAlign:"center"}})}));Ca.displayName="_Placeholder";var xa=Ca;var Ia=createContext({});function Fa(){return useContext(Ia)}var Ta=Ia;var el=lazy(()=>import('./fileviewer-N5Z4NUU6.js'));function tl(){let[,t]=useState(0);return ()=>t(e=>e+1)}var Ra=withTranslation()(memo(function(e){var we,ge;tl();let [i,r]=useState([]),[s,a]=useState(e.context.params),[f$1,m]=useState(false),[c,w]=useState(null),[F,p]=useState(false),[d,u]=useState(null),[g$1,b]=useState(0),{t:h}=useTranslation(),{iframeMode:S}=g(),y=Fa(),D=H=>{var Q;return (Q=y[H])!=null?Q:h(H)},{UserDialog:V}=b$2(),M=f(),{style:C,readonly:T,visible:v}=e.properties,[J,Z]=useState({showDialog:false,dialogTitle:"",dialogContent:"",buttonAgree:"",buttonDisagree:"",callBackFunc:()=>{}}),{appSettings:ee,viewPort:x,runFormDeleteFileEvent:O,runFormDownloadFileEvent:R,runFormGetLinkedFileEvent:U,runFormGetLinkedFileMetaEvent:j,runFormUploadFiles:N}=b$1();useEffect(()=>{a(e.context.params);},[e.context.params]),useEffect(()=>{let H=e.value?JSON.parse(e.value):[];return H&&(r(E(H,100)),m(true)),()=>{i&&(m(false),i.forEach(Q=>{Q.preview&&URL.revokeObjectURL(Q.preview);}));}},[]);let E=(H,Q)=>{let k=[];return H.forEach((G,o)=>{let te=new File([],G,{type:"image/jpeg"});Object.assign(te,{preview:null,uploadProgress:Q}),k.push(te);}),k},$=useCallback(async H=>{var ie;let k=(await j({...s,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:H,context:{action:"Preview"}})).payload,{linkedFileSize:G,linkedFileName:o,mimeType:te}=k;if(!G)throw new Error("File data or metadata is missing");let oe=(ie=ee==null?void 0:ee.MAX_DOWNLOAD_NOCHUNK_FILESIZE)!=null?ie:b$3.MAX_DOWNLOAD_NOCHUNK_FILESIZE;return G>oe?{type:"formbuilder/getlinkedfile",payload:{linkedFile:null,linkedFileSize:G,linkedFileName:o},meta:{requestStatus:"fulfilled"}}:await U({...s,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:H,context:{action:"Load"}})},[s,e.context.params.pGuid,e.properties.name]),re=H=>{J.callBackFunc(H);},pe=async(H,Q)=>{H&&await O({...e.context.params,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:Q}).then(k=>{if(k.meta.requestStatus==="fulfilled"){let G={...k.payload};G.linkedFileDeleteSuccess&&(M({toastID:nanoid(11),msg:D("The file has been successfully deleted"),clearQueue:false,hideProgressBar:false}),r(o=>o.filter(te=>te.name!==Q)),e.methodProvider.eventDispatcher({widgetName:e.properties.name,widgetValue:JSON.stringify(G.linkedFiles),widgetEvent:null,widgetContext:null}));}}),Z({...J,showDialog:false,callBackFunc:k=>{}});},ye=async H=>{if(H)try{let Q=await R({...e.context.params,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:H}),k=new Blob([Q]),G=window.URL.createObjectURL(k),o=document.createElement("a");o.href=G,o.setAttribute("download",H.split("/").pop()||"downloadedFile"),document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(G);}catch(Q){}},se=useCallback(async(H,Q)=>(Q&&Z({showDialog:true,dialogTitle:D("Confirmation"),dialogContent:D("Are you sure you want to delete file?"),buttonAgree:D("Continue"),buttonDisagree:D("Close"),callBackFunc:k=>pe(k,Q)}),null),[e.context.params,h]),_=useCallback(async(H,Q)=>(Q&&ye(Q),null),[e.context.params]),ue=useCallback((H,Q)=>{Q&&startTransition(()=>{w(Q);});},[]),Y=()=>{w(null);},ce=useCallback(async(H,Q$1)=>{var k,G;if(H){let o=new FormData;for(let ie in e.context.params)e.context.params.hasOwnProperty(ie)&&o.append(ie,e.context.params[ie]);o.append("fieldName",e.properties.name),H.forEach(ie=>{o.append("files",ie);}),o.append("widgetContext",JSON.stringify({hasParentForm:P.hasParentForm(),originator:(k=e.context.params)==null?void 0:k.originator,folderData:(G=e.context.params)==null?void 0:G.folderData})),o.append("widgetEvent",Q.onFileUploadEvent),o.append("widgetName",e.properties.name),o.append("formData",JSON.stringify({...e.context.formData}));let te=zi.CancelToken.source(),oe=H.map(ie=>Object.assign(ie,{preview:URL.createObjectURL(ie),uploadProgress:0}));r(i.concat(oe)),u(0),await N({content:o,cancelTokenSource:te,onUploadProgress:ie=>{let Ne=ie.total?Math.round(ie.loaded*100/ie.total):0;u(Ne);}}).then(ie=>{var Ge,Ye,Ve;let Ne=[];if(ie.meta.requestStatus==="fulfilled"){let Ce={...ie.payload};if((Ge=Ce.FECommand)!=null&&Ge.FormValidationData&&Object.keys(Ce.FECommand.FormValidationData).length>0){oe.forEach(xe=>{xe.preview&&URL.revokeObjectURL(xe.preview);}),u(null),b(xe=>xe+1);let tt=i.filter(xe=>xe.uploadProgress===100);r(tt),e.methodProvider.eventDispatcher({widgetName:e.properties.name,widgetValue:JSON.stringify(i),widgetEvent:null,widgetContext:null,feCommand:Ce.FECommand});}else if(Ce.linkedFiles&&e.properties.name){Ne=E(Ce.linkedFiles,100);let tt=Ne.map(xe=>{let rt=xe;return rt.uploadProgress=100,rt.preview=null,rt});oe.forEach(xe=>{xe.preview&&URL.revokeObjectURL(xe.preview);}),u(null),b(xe=>xe+1),r(tt),a({...e.context.params,guid:(Ve=(Ye=Ce.FECommand)==null?void 0:Ye.ReplaceContextRecordGuid)==null?void 0:Ve.guid}),Ce.FECommand={...Ce.FECommand,UpdateFieldAllowedValues:Ce.fieldAllowedValues,UpdateFormData:Ce.data},e.methodProvider.execCommands(Ce.FECommand);}}});}},[i,e.context.params,e.methodProvider,e.properties.name,e.value]);return !f$1||!v?null:jsxs("div",{style:{...C,lineHeight:"1.1em"},children:[jsx(V,{...J,handleDialogClose:re}),jsxs("div",{style:{position:"relative",zIndex:1,isolation:"isolate"},children:[S&&jsx("div",{style:{position:"absolute",inset:0,zIndex:10,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255,255,255,0.85)",borderRadius:4,padding:"8px 16px",textAlign:"center",fontSize:"0.875rem",color:"#555"},children:h("File upload is available only when using the SDK")}),jsx(o,{defaultText:(ge=(we=e.properties)==null?void 0:we.dragDropLabel)!=null?ge:D("Drag and Drop..."),tryGetLinkedFile:$,onDeleteButtonPress:se,onDownloadButtonPress:_,onDownloadText:D("Download"),onDeleteText:D("Delete"),filesData:i,onDragText:"On drop text",onFilesDrop:ce,onPreviewButtonPress:ue,isMobileDevice:x.isMobileDevice,isReadonly:T},g$1),d!==null&&jsx(Zi,{variant:"determinate",value:d,style:{marginTop:6,borderRadius:3,height:8}})]}),c!=null&&jsx(Suspense,{fallback:jsx(Xi,{}),children:jsx(el,{fileId:c,fileBase64:null,fieldName:e.properties.name,params:{...e.context.params,modalCloseFn:Y}},nanoid(11))})]})}));Ra.displayName="_Fileuploader";var Ea=Ra;var ka=(t,e)=>"#"+t.replace(/^#/,"").replace(/../g,n=>("0"+Math.min(255,Math.max(0,parseInt(n,16)+e)).toString(16)).substring(-2)),Ba=withTranslation()(memo(function(e){var h,S;let{buttontype:n$1,colorSchema:i,fullWidth:r,name:s,style:a,tabIndex:f,title:m,variant:c,visible:w}=e.properties,F=useLocation(),{tabId:p}=e,d=(S=(h=e.context)==null?void 0:h.displayButtonLoader)!=null?S:false;if(!w)return null;let u=a.backgroundColor,g=u?ka(u,-50):"";i&&(u=i+".main",g=i+".hover");let b={};return c==="outlined"?(Object.assign(b,{"&.MuiButtonBase-root":{fontSize:a.fontSize,fontWeight:a.fontWeight,border:"1px solid"+u,cursor:"pointer"}}),Object.assign(b,{"&.MuiButtonBase-root:hover":{border:g?"1px solid"+ka(g,-50):""}})):(Object.assign(b,{"&.MuiButtonBase-root":{fontSize:a.fontSize,fontWeight:a.fontWeight,backgroundColor:u,cursor:"pointer"}}),Object.assign(b,{"&.MuiButtonBase-root:hover":{backgroundColor:g}})),jsx("div",{children:jsx(n,{variant:c,label:m,loading:d,onPointerUp:()=>{var y,D;e.methodProvider.eventDispatcher({widgetName:s,widgetValue:null,widgetEvent:Q.getFormButtonEvent(n$1),widgetContext:JSON.stringify({referer:F.pathname,parentWidgetId:p,hasParentForm:P.hasParentForm(),originator:(y=e.context.params)==null?void 0:y.originator,parent:{widgetName:s,params:{pGuid:e.context.params.pGuid,pluginCode:e.context.params.pluginCode,formCode:e.context.params.formCode,guid:e.context.params.guid}},folderData:(D=e.context.params)==null?void 0:D.folderData})});},fullWidth:r,sx:b,tabIndex:f})})}));Ba.displayName="_Button";var Na=Ba;var zt=b(a$1()),La=b(vt());zt.default.extend(La.default);var _a=withTranslation()(memo(function(e$1){var D,V,M;let n=useRef(null),{id:i,ignorereadonly:r,defaultvalue:s,dateformat:a,label:f,name:m,onchangehandler:c,readonly:w,size:F,tabIndex:p,variant:d,visible:u}=e$1.properties,g=useLocation(),{tabId:b}=e$1,h=!!(!e$1.value&&e$1.validationMessage!=null&&e$1.context.doValidateForm),S=C=>{var T;return e$1.methodProvider.eventDispatcher({widgetName:m,widgetValue:C!=null?C:"",widgetEvent:c?Q.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:b,hasParentForm:P.hasParentForm(),originator:(T=e$1.context.params)==null?void 0:T.originator})})},y=(V=(D=e$1==null?void 0:e$1.i18n)==null?void 0:D.language)==null?void 0:V.substr(0,2);return jsx(e,{id:i,defaultvalue:s,disabled:!!(w&&!r),error:h,format:a!==void 0&&a!==""&&a!=null?a:void 0,helperText:h?e$1.validationMessage:"",inputRef:n,label:f,locale:y,name:m,onBlur:C=>{S(C?(0, zt.default)(C).utc().format():null);},size:F,type:"datepicker",value:(M=e$1.value)!=null?M:"",variant:d,visible:u})}));_a.displayName="_Textinput";var Aa=_a;var st=b(a$1()),Oa=b(vt());st.default.extend(Oa.default);var Ua=withTranslation()(memo(function(e){var M,C,T;let n=useRef(null),{id:i,ignorereadonly:r,defaultvalue:s,dateformat:a,label:f,name:m,onchangehandler:c,readonly:w,size:F,tabIndex:p,variant:d,visible:u}=e.properties,g=useLocation(),{tabId:b}=e,[h,S]=useState(String((M=e.value)!=null?M:"")),y=!!(!h&&e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{var v;S(String((v=e.value)!=null?v:""));},[e.value]);let D=v=>{var J;return S(v),e.methodProvider.eventDispatcher({widgetName:m,widgetValue:v!=null?v:"",widgetEvent:c?Q.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:b,hasParentForm:P.hasParentForm(),originator:(J=e.context.params)==null?void 0:J.originator})})};useEffect(()=>{if(!e.value&&s){let v=s==="now"?(0, st.default)().utc().format():s==="start of day"?(0, st.default)().startOf("day").utc().format():null;v&&D(v);}},[]);let V=(T=(C=e==null?void 0:e.i18n)==null?void 0:C.language)==null?void 0:T.substr(0,2);return jsx(f$1,{autoFocus:false,defaultvalue:s,disabled:!!(w&&!r),error:y,format:a!==void 0&&a!==""&&a!=null?a:void 0,helperText:y?e.validationMessage:"",id:i,inputRef:n,label:f,locale:V,name:m,onChange:v=>{D(v?(0, st.default)(v).utc().format():null);},size:F,value:h,variant:d,visible:u})}));Ua.displayName="_Textinput";var Ha=Ua;var qt=b(a$1()),Wa=b(vt());qt.default.extend(Wa.default);var $a=withTranslation()(memo(function(e){var D,V,M;let n=useRef(null),{id:i,ignorereadonly:r,defaultvalue:s,dateformat:a,label:f,name:m,onchangehandler:c,readonly:w,size:F,tabIndex:p,variant:d,visible:u}=e.properties,g=useLocation(),{tabId:b}=e,h=!!(!e.value&&e.validationMessage!=null&&e.context.doValidateForm),S=C=>{var T;return e.methodProvider.eventDispatcher({widgetName:m,widgetValue:C!=null?C:"",widgetEvent:c?Q.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:b,hasParentForm:P.hasParentForm(),originator:(T=e.context.params)==null?void 0:T.originator})})},y=(V=(D=e==null?void 0:e.i18n)==null?void 0:D.language)==null?void 0:V.substr(0,2);return jsx(g$1,{id:i,defaultvalue:s,disabled:!!(w&&!r),error:h,format:a!==void 0&&a!==""&&a!=null?a:void 0,helperText:h?e.validationMessage:"",inputRef:n,label:f,locale:y,name:m,onBlur:C=>{S(C?(0, qt.default)(C).utc().format():null);},size:F,type:"datetimepicker",value:(M=e.value)!=null?M:"",variant:d,visible:u})}));$a.displayName="_Textinput";var Ga=$a;var za=withTranslation()(memo(function(e){var ee;let n=useRef(null),{datalength:i,id:r,forcereadonly:s,ignorereadonly:a,label:f,name:m$1,onchangehandler:c,placeholder:w,phoneformat:F,readonly:p,regex:d,size:u,style:g,tabIndex:b,uppercasemode:h,variant:S,visible:y}=e.properties,D=useLocation(),{viewPort:V}=b$1(),{tabId:M}=e,[C,T]=useState(String((ee=e.value)!=null?ee:"")),v=!!(e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{e.value!==void 0&&e.value!==null&&T(String(e.value));},[e.value]);let J=x=>{var O;e.methodProvider.eventDispatcher({widgetName:m$1,widgetValue:x,widgetEvent:c?Q.onChange:null,widgetContext:JSON.stringify({referer:D.pathname,parentWidgetId:M,hasParentForm:P.hasParentForm(),originator:(O=e.context.params)==null?void 0:O.originator})});},Z=x=>{T(x);};return jsx(m,{autoFocus:false,disabled:!!(p&&!a),error:v,helperText:v?e.validationMessage:"",id:r,inputProps:{id:r,tabIndex:b,style:{...g}},InputProps:{},inputRef:n,label:f,maxCharCount:i,name:m$1,onBlur:x=>{J(x.target.value);},onInput:x=>{Z(x.target.value),V.isMobileDevice&&J(x.currentTarget.value);},placeholder:w,phoneFormat:F||void 0,readOnly:!!(p&&!a),regEx:d,size:u!=null?u:"small",type:F?"phone":"text",toUpperCase:h,value:C,variant:S,visible:y})}));za.displayName="_PhoneInput";var qa=za;var Ya=withTranslation()(memo(function(e){var ue;let n=useRef(null),{t:i,i18n:r}=useTranslation(),s=r==null?void 0:r.language,{currency_format:a,currency_assymbol:f,currency_currencydisplay:m$1,currency_fixedlocale:c,datalength:w,id:F,ignorereadonly:p,label:d,name:u,onchangehandler:g,placeholder:b,readonly:h,regex:S,size:y,style:D,tabIndex:V,uppercasemode:M,variant:C,visible:T}=e.properties,v=useLocation(),{viewPort:J}=b$1(),{tabId:Z}=e,[ee,x]=useState(String((ue=e.value)!=null?ue:"0")),[O,R]=useState(false),[U,j]=useState(0),N=useRef(0);useEffect(()=>{var Y;x(String((Y=e.value)!=null?Y:"0"));},[e.value]),useEffect(()=>{e.validationMessage!=null&&(N.current+=1,R(false));},[e.context.formValidationData]);let E=!!(!O&&e.validationMessage!=null&&e.context.doValidateForm),$=Y=>{var ce;e.methodProvider.eventDispatcher({widgetName:u,widgetValue:Y,widgetEvent:g?Q.onChange:null,widgetContext:JSON.stringify({referer:v.pathname,parentWidgetId:Z,hasParentForm:P.hasParentForm(),originator:(ce=e.context.params)==null?void 0:ce.originator})});},re=Y=>{x(Y);},pe=a==="fixed-locale"&&c?c:s,ye=()=>{var we;if(m$1==="")return "";let Y=e.context.formData,ce=e.properties.currency_inputfield;return ce&&(Y!=null&&Y[ce])?Y[ce]:e.properties.currency_currency?e.properties.currency_currency:(a==="locale"||a==="fixed-locale")&&(we=g$3(pe!=null?pe:""))!=null?we:""},se=m$1==="symbol"?true:m$1==="code"?false:f!=null?f:false,_=a==="locale"||a==="fixed-locale"?"locale":a!=null?a:"";return jsx(m,{autoFocus:false,currency:ye(),disabled:!!(h&&!p),error:E,helperText:E?e.validationMessage:"",id:F,inputProps:{id:F,tabIndex:V,style:{...D,textAlign:"right"}},InputProps:{},inputRef:n,label:d,locale:pe,maxCharCount:w,name:u,onBlur:Y=>{R(true);let ce=Y.target.value;(ce==="0"||ce==="")&&j(we=>we+1),$(ce);},onInput:Y=>{re(Y.target.value),J.isMobileDevice&&$(Y.currentTarget.value);},onChange:Y=>{ee.trim()===""&&$(Y.target.value);},placeholder:b,readOnly:!!(h&&!p),regEx:S,size:y,type:"currency",toUpperCase:M,value:ee,variant:C,visible:T,format:_,assymbol:se},U)}));Ya.displayName="_CurrencyInput";var Qa=Ya;var Xa=withTranslation()(memo(function(e){var j,N;let n=useRef(null),{t:i,i18n:r}=useTranslation(),s=(j=r==null?void 0:r.language)==null?void 0:j.substring(0,2),{datalength:a,id:f,forcereadonly:m$1,ignorereadonly:c,label:w,name:F,onchangehandler:p,placeholder:d,readonly:u,regex:g,size:b,style:h,tabIndex:S,uppercasemode:y,variant:D,visible:V}=e.properties,[M,C]=useState(false),{viewPort:T}=b$1(),v=useLocation(),{tabId:J}=e,[Z,ee]=useState(String((N=e.value)!=null?N:"")),x=!!(Z.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{var E;ee(String((E=e.value)!=null?E:""));},[e.value]);let O=()=>{C(E=>!E);},R=E=>{var $;e.methodProvider.eventDispatcher({widgetName:F,widgetValue:E,widgetEvent:p?Q.onChange:null,widgetContext:JSON.stringify({referer:v.pathname,parentWidgetId:J,hasParentForm:P.hasParentForm(),originator:($=e.context.params)==null?void 0:$.originator})});},U=E=>{ee(E);};return jsx(m,{autoFocus:false,disabled:!!(u&&!c),error:x,helperText:x?e.validationMessage:"",id:f,inputProps:{id:f,tabIndex:S,style:{...h,textAlign:"center"}},InputProps:{endAdornment:jsx(Ul,{position:"end",children:jsx(vr,{onClick:O,edge:"end",children:M?jsx(Hl,{}):jsx(Wl,{})})})},inputRef:n,label:w,locale:s,maxCharCount:a,name:F,onBlur:E=>{R(E.target.value);},onInput:E=>{U(E.target.value),T.isMobileDevice&&R(E.currentTarget.value);},onChange:E=>{Z.trim()===""&&R(E.target.value);},placeholder:d,readOnly:!!(u&&!c),regEx:g,size:b,type:"text",toUpperCase:y,value:Z,variant:D,visible:V,inputtype:M?"text":"password"})}));Xa.displayName="_PasswordInput";var Za=Xa;var or=styled(TreeItem2Root)(({theme:t})=>({color:t.palette.mode==="light"?t.palette.grey[800]:t.palette.grey[400],position:"relative",[`& .${treeItemClasses.groupTransition}`]:{marginLeft:t.spacing(3.5)}})),ld=styled(TreeItem2Content)(({theme:t})=>({borderRadius:t.spacing(.3),marginBottom:t.spacing(.5),marginTop:t.spacing(.3),padding:t.spacing(.3),paddingRight:t.spacing(.1),fontWeight:500,"&.Mui-expanded ":{"&:not(.Mui-focused, .Mui-selected, .Mui-selected.Mui-focused) .labelIcon":{color:t.palette.mode==="light"?t.palette.primary.main:t.palette.primary.dark},"&::before":{content:'""',display:"block",position:"absolute",left:"16px",top:"34px",height:"calc(100% - 36px)",width:"1.5px",backgroundColor:t.palette.mode==="light"?t.palette.grey[300]:t.palette.grey[700]}},"&:hover":{backgroundColor:alpha(t.palette.primary.main,.1),color:t.palette.mode==="light"?t.palette.primary.main:"white"},"&.Mui-focused, &.Mui-selected, &.Mui-selected.Mui-focused":{backgroundColor:t.palette.mode==="light"?t.palette.primary.main:t.palette.primary.dark,color:t.palette.primary.contrastText,fontWeight:700}})),dd=styled(TreeItem2Content)(({theme:t})=>({borderRadius:t.spacing(.3),marginBottom:t.spacing(.5),marginTop:t.spacing(.3),padding:t.spacing(.3),paddingRight:t.spacing(.1),fontWeight:500,"&.Mui-expanded ":{"&:not(.Mui-focused, .Mui-selected, .Mui-selected.Mui-focused) .labelIcon":{},"&::before":{content:'""',display:"block",position:"absolute",left:"16px",top:"34px",height:"calc(100% - 36px)",width:"1.5px"}}})),sd=animated(ql);function nr(t){let e=useSpring({to:{opacity:t.in?1:0,transform:`translate3d(0,${t.in?0:20}px,0)`}});return jsx(sd,{style:e,...t})}var md=styled(Jl)({color:"inherit",fontWeight:500});function ar({icon:t,expandable:e,children:n,isFirstRootNode:i,...r}){return jsxs(TreeItem2Label,{...r,sx:{display:"flex",alignItems:"center",fontWeight:i?"700":"normal",backgroundColor:"transparent","&.Mui-focused, &.Mui-selected":{backgroundColor:"transparent"}},children:[t&&jsx(rr,{component:t,className:"labelIcon",color:"inherit",sx:{mr:1,fontSize:"1.2rem"}}),jsx(md,{sx:{fontSize:i?"1rem":"0.9rem",fontWeight:i?"700":"normal"},children:n})]})}var lr=t=>Array.isArray(t)?t.length>0&&t.some(lr):!!t,Ft=t=>{let e=null,n=t.action,i=t.applyInternalStyle?{fontSize:"1em",marginRight:"0.5em"}:{};return n==="add"?e=jsx(u$1,{style:i}):n==="edit"?e=jsx(B,{style:i}):n==="share"?e=jsx(F,{style:i}):n==="trash"&&(e=jsx(O,{style:i})),e},ud=Te.forwardRef(function(e,n){let{id:i,itemId:r,label:s,disabled:a,children:f,item:m,index:c,mode:w,setSelectedItem:F,treeCheckedItems:p,properties:d,disableRootItem:u,userData:g,formData:b,deletePrompt:h,selectedItem:S,execCommands:y,eventDispatcher:D,...V}=e,{getRootProps:M,getContentProps:C,getIconContainerProps:T,getCheckboxProps:v,getLabelProps:J,getGroupTransitionProps:Z,getDragAndDropOverlayProps:ee,status:x}=unstable_useTreeItem2({id:i,itemId:r,children:f,label:s,disabled:a,rootRef:n}),O=useLocation(),{t:R}=useTranslation(),[U,j]=Te.useState(null),N=!!U,E=lr(f),$=c===0?void 0:jl,[re,pe]=Te.useState(x.expanded),{runFormEvent:ye}=b$1(),se=useCallback(async(k,G,o,te,oe,ie)=>{var Ne,Ge,Ye;k&&await ye({pluginCode:o.params.pluginCode,formCode:"FOLDER",guid:(Ne=o.params.folderData)==null?void 0:Ne.id,projectGuid:o.params.pGuid,pGuid:o.params.pGuid,widgetContext:JSON.stringify({referer:oe.pathname,parentWidgetId:ie,hasParentForm:P.hasParentForm(),originator:(Ge=o.params)==null?void 0:Ge.originator,parent:o.params,folderData:(Ye=o.params)==null?void 0:Ye.folderData}),widgetEvent:Q.onDelete,widgetName:"delete",formData:o.formData}).then(Ve=>{if(Ve.meta.requestStatus==="fulfilled"){let Ce={...Ve.payload};o.execCommands(Ce.FECommand);}}),o.deletePrompt({delete:{buttonAgree:"",buttonDisagree:"",dialogTitle:"",dialogContent:"",showDialog:false,callBackFunc:()=>{}}});},[e.params.pluginCode,e.params.folderData,e.params.pGuid,e.formData,e.deletePrompt,e.execCommands]),_=k=>{k.stopPropagation(),pe(G=>!G);},ue=k=>{k.stopPropagation(),j(k.currentTarget);},Y=()=>{j(null);},ce=useCallback(()=>{Y();let k="addbtn";return e.eventDispatcher({tabIndex:0,widgetName:k,widgetValue:null,widgetEvent:Q.onFolderCreateRecordEvent,widgetContext:JSON.stringify({referer:O.pathname,parentWidgetId:"",hasParentForm:P.hasParentForm(),parentOriginator:{params:e.params.originator?e.params.originator.params:{}},originator:{params:e.params,widgetName:k},parent:{widgetName:k,params:e.params},isModal:true,folderData:e.params.folderData})})},[Y,O.pathname,e.params,e.eventDispatcher,P.hasParentForm]),we=useCallback(()=>{Y();let k="share";return e.eventDispatcher({tabIndex:0,widgetName:k,widgetValue:null,widgetEvent:Q.onFolderShareRecordEvent,widgetContext:JSON.stringify({referer:O.pathname,parentWidgetId:"",hasParentForm:P.hasParentForm(),parentOriginator:{params:e.params.originator?e.params.originator.params:{}},originator:{params:{...e.params,guid:e.params.folderData.id},widgetName:k},parent:{widgetName:k,params:e.params},isModal:true,folderData:e.params.folderData})})},[e,O.pathname]),ge=useCallback(()=>{Y();let k="edit";return e.eventDispatcher({tabIndex:0,widgetName:k,widgetValue:null,widgetEvent:Q.onFolderEditRecordEvent,widgetContext:JSON.stringify({referer:O.pathname,parentWidgetId:"",hasParentForm:P.hasParentForm(),parentOriginator:{params:e.params.originator?e.params.originator.params:{}},originator:{params:e.params,widgetName:k},parent:{widgetName:k,params:e.params},isModal:true,folderData:e.params.folderData})})},[e,O.pathname]),H=useCallback(async k=>{var G,o;await ye({pluginCode:e.params.pluginCode,formCode:e.params.formCode,guid:e.params.guid,projectGuid:e.params.pGuid,pGuid:e.params.pGuid,widgetContext:JSON.stringify({referer:O.pathname,parentWidgetId:null,hasParentForm:P.hasParentForm(),originator:(G=e.params)==null?void 0:G.originator,parent:e.params,folderData:(o=e.params)==null?void 0:o.folderData}),widgetEvent:Q.onRefresh,widgetName:d==null?void 0:d.name,widgetValue:k,formData:b}).then(te=>{if(te.meta.requestStatus==="fulfilled"){let oe={...te.payload};oe.FECommand={...oe.FECommand,UpdateFormData:oe.data},e.execCommands(oe.FECommand);}});},[e,d==null?void 0:d.name,O.pathname]),Q$1=useCallback(()=>{e.deletePrompt({delete:{showDialog:true,dialogTitle:R("Delete")+" ?",dialogContent:R("Are you certain that you wish to delete this folder?"),buttonAgree:R("Continue"),buttonDisagree:R("Close"),callBackFunc:k=>{k?se(k,"delete",e,{},O,""):se(false,"",e,{},O,"");}}});},[e,R,O,se]);if(w==="live"){let k=g.rightMode!=="Edit";return jsxs(or,{...M(V),sx:{"& > ul":{paddingLeft:"0.2rem",paddingRight:"0.1rem"}},children:[jsxs(ld,{...C({className:t("content",{"Mui-expanded":re,"Mui-selected":x.selected,"Mui-focused":x.focused,"Mui-disabled":x.disabled})}),children:[c!==0&&jsxs(Fragment,{children:[jsx(TreeItem2IconContainer,{...T({status:x,onPointerUp:_}),children:jsx(TreeItem2Icon,{status:x})}),jsx(TreeItem2Checkbox,{...v()})]}),jsx(ar,{...J({icon:$,expandable:E&&re,isFirstRootNode:c===0,onClick:G=>{F&&F(G,r),G.stopPropagation();}}),children:s}),!k&&e.selectedItem===r&&c!==0&&jsx(vr,{size:"small",onClick:ue,"aria-controls":N?"menu":void 0,"aria-haspopup":"true","aria-expanded":N?"true":void 0,style:{marginLeft:"auto",color:"#FFF",fontSize:"14px"},children:jsx(n$1,{})}),jsxs(nd,{anchorEl:U,open:N,onClose:Y,onClick:G=>G.stopPropagation(),slotProps:{paper:{sx:{minWidth:"12em"}}},children:[jsxs(It,{onClick:ce,children:[jsx(Ct,{children:jsx(Ft,{action:"add",applyInternalStyle:true})}),jsx(xt,{primaryTypographyProps:{fontSize:"0.875rem"},children:R("New Folder")})]}),jsxs(It,{onClick:ge,children:[jsx(Ct,{children:jsx(Ft,{action:"edit",applyInternalStyle:true})}),jsx(xt,{children:R("Settings")})]}),jsxs(It,{onClick:we,children:[jsx(Ct,{children:jsx(Ft,{action:"share",applyInternalStyle:true})}),jsx(xt,{children:R("Share")})]}),jsxs(It,{onClick:Q$1,children:[jsx(Ct,{children:jsx(Ft,{action:"trash",applyInternalStyle:true})}),jsx(xt,{children:R("Delete")})]})]}),jsx(TreeItem2DragAndDropOverlay,{...ee()})]}),f&&jsx(nr,{...Z(),in:re,children:f})]})}else {let k=false;return p&&p.length>0&&p.forEach((G,o)=>{if(G===r){k=true;return}}),jsxs(or,{...M({...V,expandable:false}),sx:{"& > ul":{paddingLeft:"1rem",paddingRight:"0rem"}},children:[jsxs(dd,{...C({className:t("content",{"Mui-expanded":true,"Mui-selected":x.selected,"Mui-focused":x.focused,"Mui-disabled":x.disabled})}),children:[c!==0&&jsx(Fragment,{children:jsx(TreeItem2Checkbox,{id:r,visible:true,checked:k,onPointerUp:G=>H(r),onResize:void 0,onResizeCapture:void 0,popover:void 0,popoverTargetAction:void 0,popoverTarget:void 0,inert:void 0,onToggle:void 0,onBeforeToggle:void 0,onTransitionCancel:void 0,onTransitionCancelCapture:void 0,onTransitionRun:void 0,onTransitionRunCapture:void 0,onTransitionStart:void 0,onTransitionStartCapture:void 0})}),jsx(ar,{...J({icon:$,expandable:E,isFirstRootNode:c===0}),children:s}),jsx(TreeItem2DragAndDropOverlay,{...ee()})]}),f&&jsx(nr,{...Z(),in:true,children:f})]})}}),cd=t=>{let e=[],n=i=>{i.forEach(r=>{r.children&&r.children.length>0&&(e.push(r.id),n(r.children));});};return n(t),e},fd=(t,e)=>{let n=(i,r)=>{for(let s of i)if(s.id===r||s.children&&n(s.children,r))return s;return null};return n(t,e)},pd=(t,e)=>{let n=[],i=(r,s,a=[])=>{for(let f of r){if(f.id===s)return n.push(...a),true;if(f.children&&i(f.children,s,[...a,f]))return true}return false};return i(t,e),n},jt=(t,e)=>{for(let n of t){if(n.id===e)return n;if(n.children){let i=jt(n.children,e);if(i)return i}}return null},Tt=(t,e)=>{for(let n of t){if(n.id===e)return [n.label];if(n.children){let i=Tt(n.children,e);if(i.length>0)return [n.label,...i]}}return []},gd=({eventDispatcher:t,execCommands:e,params:n,properties:i,redrawComponent:r,formlayout:s,onFolderSelected:a,onFolderAdded:f,formData:m,mode:c,checkedItems:w})=>{var U,j;let{runFormEvent:F}=b$1(),[p,d]=Te.useState([]),[u,g]=Te.useState(((U=n==null?void 0:n.folderData)==null?void 0:U.id)||null),[b,h]=Te.useState([]),[S,y]=Te.useState(w),[D,V]=Te.useState(false),[M,C]=Te.useState(),{UserDialog:T}=b$2();Te.useEffect(()=>{y(w);},[w]);let v=useCallback(P.debounce(async()=>{var N,E,$,re,pe,ye,se,_,ue,Y,ce;try{let we=await F({pluginCode:((N=n.sourcePluginCode)==null?void 0:N.trim())!==""?n.sourcePluginCode:n.pluginCode,formCode:((E=n.sourceFormCode)==null?void 0:E.trim())!==""?n.sourceFormCode:n.formCode,guid:n.guid,projectGuid:n.pGuid,pGuid:n.pGuid,widgetEvent:Q.onFoldersDataLoad,widgetContext:JSON.stringify({originator:($=n.originator)!=null?$:null})});if(we.meta.requestStatus==="fulfilled"){let ge={...we.payload};ge!=null&&ge.userData&&C(ge==null?void 0:ge.userData),(re=ge==null?void 0:ge.userData)!=null&&re.isContributor&&V(!0);let H=JSON.parse(ge.widgetData.treeData);if(d(H),(pe=n==null?void 0:n.folderData)!=null&&pe.addedFolderId){let Q=fd(H,(ye=n==null?void 0:n.folderData)==null?void 0:ye.addedFolderId);if(Q){let k=cd([Q]);h(k),g((se=n==null?void 0:n.folderData)==null?void 0:se.addedFolderId);let G=Tt([Q],(_=n==null?void 0:n.folderData)==null?void 0:_.addedFolderId);f(null,G);}}else if(b.length===0&&h([(ue=H[0])==null?void 0:ue.id]),!u){let Q=(Y=H[0])==null?void 0:Y.id,k=(ce=H[0])==null?void 0:ce.isroot;g(Q||null),a(Q||null,k);}}}catch(we){}},500),[n]);Te.useEffect(()=>(v(),()=>{v.cancel();}),[v]),Te.useEffect(()=>{var N,E,$,re,pe,ye;if((N=n==null?void 0:n.folderData)!=null&&N.id){g(((E=n==null?void 0:n.folderData)==null?void 0:E.id)||null);let se=jt(p,($=n==null?void 0:n.folderData)==null?void 0:$.id),_=Tt(p,se==null?void 0:se.id),ue=[],Y=pd(p,(re=n==null?void 0:n.folderData)==null?void 0:re.id);Y.length>0&&(Y.forEach(ce=>{ue.push(ce.id);}),ue.push((pe=n==null?void 0:n.folderData)==null?void 0:pe.id),h(ue)),a((ye=n==null?void 0:n.folderData)==null?void 0:ye.id,se==null?void 0:se.isroot,_);}},[(j=n==null?void 0:n.folderData)==null?void 0:j.id]);let[J,Z]=useState({delete:{buttonAgree:"",buttonDisagree:"",dialogTitle:"",dialogContent:"",showDialog:false,callBackFunc:()=>{}}}),ee=N=>J.delete.callBackFunc(N),x=N=>{Z(N);},O=(N,E)=>{g(E);let $=jt(p,E),re=Tt(p,$==null?void 0:$.id);a(E,$==null?void 0:$.isroot,re);};return jsxs(Fragment,{children:[jsx(rr,{sx:{paddingTop:"5px"},children:jsx(RichTreeView,{items:p,selectedItems:u,expandedItems:b,sx:{height:"fit-content",flexGrow:1,maxWidth:250,overflowY:"auto"},slots:{item:N=>jsx(ud,{...N,mode:c,params:n,eventDispatcher:t,execCommands:e,deletePrompt:x,index:p.findIndex(E=>E.id===N.itemId),selectedItem:u,setSelectedItem:O,treeCheckedItems:S,disableRootItem:D,userData:M,formData:m,properties:i})},onSelectedItemsChange:O,onExpandedItemsChange:(N,E)=>{var re;let $=(re=p[0])==null?void 0:re.id;$&&!E.includes($)?h(pe=>pe.includes($)?pe:[...pe,$]):h(E);}})}),jsx(T,{...J.delete,handleDialogClose:ee})]})},ut=gd;var sr=withTranslation()(memo(function(e){var c,w;let{style:n,verticalalign:i,plugincode:r,formcode:s,visible:a}=e.properties,f={paddingTop:"0px"};if(i==="bottom"&&(f.paddingTop="10px"),!a)return null;let m=(c=e.context.formData)!=null&&c[e.properties.name]?JSON.parse((w=e.context.formData)==null?void 0:w[e.properties.name]):{};return jsx("div",{style:{...n,...f,minHeight:"2rem"},children:jsx(ut,{params:{sourceFormCode:s,sourcePluginCode:r,pluginCode:e.context.params.pluginCode,formCode:e.context.params.formCode,guid:e.context.params.guid,pGuid:e.context.params.pGuid,originator:e.context.params.originator},properties:e.properties,checkedItems:m,redrawComponent:e.context.redrawComponent,eventDispatcher:e.methodProvider.eventDispatcher,execCommands:e.methodProvider.execCommands,formData:e.context.formData,formlayout:"folders",onFolderSelected:()=>{},onFolderAdded:()=>{},mode:"setup"})})}));sr.displayName="_View";var mr=sr;var vd=lazy(()=>import('./tabulator-SQ554EQC.js').then(t=>({default:t.TabulatorTable}))),yd=lazy(()=>import('./datatable-JUVSEKE5.js').then(t=>({default:t.Datatable}))),Ae=class{static getFormComponent(e,n){if(e.displayName==="_Rowcontainer")return jn;if(e.displayName==="_Rowsegment")return Kn;if(e.displayName==="_Textinput"){if(n.inputtype==="input")return ea;if(n.inputtype==="inputwcopy")return na;if(n.inputtype==="currency")return Qa;if(n.inputtype==="password")return Za;if(n.inputtype==="date")return Aa;if(n.inputtype==="time")return Ha;if(n.inputtype==="datetime")return Ga;if(n.inputtype==="phone")return qa}else {if(e.displayName==="_TabBox")return ia;if(e.displayName==="_Button")return Na;if(e.displayName==="_Label")return sa;if(e.displayName==="_CheckBox")return ca;if(e.displayName==="_Radio")return ga;if(e.displayName==="_Textarea")return ba;if(e.displayName==="_SelectBox")return wa;if(e.displayName==="_Placeholder")return xa;if(e.displayName==="_Fileuploader")return Ea;if(e.displayName==="_Table")return n.alloweditrow||n.tablemode!==void 0&&n.tablemode==="tabulator"?vd:yd;if(e.displayName==="_View")return mr}return e}};function fr(t,e,n){var i=this,r=useRef(null),s=useRef(0),a=useRef(null),f=useRef([]),m=useRef(),c=useRef(),w=useRef(t),F=useRef(true);useEffect(function(){w.current=t;},[t]);var p=!e&&e!==0&&typeof window!="undefined";if(typeof t!="function")throw new TypeError("Expected a function");e=+e||0;var d=!!(n=n||{}).leading,u=!("trailing"in n)||!!n.trailing,g="maxWait"in n,b=g?Math.max(+n.maxWait||0,e):null;useEffect(function(){return F.current=true,function(){F.current=false;}},[]);var h=useMemo(function(){var S=function(T){var v=f.current,J=m.current;return f.current=m.current=null,s.current=T,c.current=w.current.apply(J,v)},y=function(T,v){p&&cancelAnimationFrame(a.current),a.current=p?requestAnimationFrame(T):setTimeout(T,v);},D=function(T){if(!F.current)return false;var v=T-r.current;return !r.current||v>=e||v<0||g&&T-s.current>=b},V=function(T){return a.current=null,u&&f.current?S(T):(f.current=m.current=null,c.current)},M=function T(){var v=Date.now();if(D(v))return V(v);if(F.current){var J=e-(v-r.current),Z=g?Math.min(J,b-(v-s.current)):J;y(T,Z);}},C=function(){var T=Date.now(),v=D(T);if(f.current=[].slice.call(arguments),m.current=i,r.current=T,v){if(!a.current&&F.current)return s.current=r.current,y(M,e),d?S(r.current):c.current;if(g)return y(M,e),S(r.current)}return a.current||y(M,e),c.current};return C.cancel=function(){a.current&&(p?cancelAnimationFrame(a.current):clearTimeout(a.current)),s.current=0,f.current=r.current=m.current=a.current=null;},C.isPending=function(){return !!a.current},C.flush=function(){return a.current?V(Date.now()):c.current},C},[d,g,e,b,u,p]);return h}var Td=Te__default.createContext(void 0),gr=({children:t,eventDispatcher:e,redrawComponent:n,formlayout:i,params:r,onFolderSelected:s,onFolderAdded:a,formData:f,execCommands:m})=>{let[c,w]=useState(i),{viewPort:F}=b$1(),[p,d]=useState(false),{t:u}=useTranslation(),g=()=>d(y=>!y),b=()=>d(false),h={viewHolder:{display:"flex",position:"relative"},toggleButton:{position:"absolute",top:"1em",right:"1em",zIndex:1e3,background:"#FFF",color:"#3f86cc ",border:"1px solid #3f86cc",borderRadius:"50%",width:"35px",height:"35px",display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer"},toggleButtonMenuActive:{background:"#3f86cc",color:"#FFF "},btreeContainerMobile:{position:"fixed",top:0,left:p?0:"-16rem",height:"100%",width:"16rem",backgroundColor:"#F8F8F8",borderRight:"1px solid #C0C0C0",transition:"left 0.3s ease",zIndex:999,padding:"0.5rem"},btreeContainerDesktop:{borderRight:"1px solid #C0C0C0"},mainContent:{flex:1,margin:"1em"}},S=()=>jsx(Jl,{variant:"h6",sx:{padding:"0.5em",fontWeight:"bold",borderBottom:"1px dashed #C0C0C0"},children:u("My Folders")});return jsxs(Td.Provider,{value:{layout:c,setLayout:w},children:[(!i||i==="regular")&&t,i==="folders"&&jsxs("div",{className:"viewHolder",style:h.viewHolder,children:[F.isMobileDevice?jsxs(Fragment,{children:[!p&&jsx("button",{onClick:g,style:{...h.toggleButton,...h.toggleButtonMenuActive},children:t$1({size:"1.3rem"})}),jsx(xd,{open:p,onClick:b,sx:{zIndex:998,backgroundColor:"rgba(0, 0, 0, 0.5)"}}),jsxs("div",{style:h.btreeContainerMobile,onClick:y=>y.stopPropagation(),children:[jsx("div",{style:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingLeft:"0.5rem"}}),jsx(S,{}),jsx(ut,{params:{...r,sourcePluginCode:r.pluginCode,sourceFormCode:r.formCode},redrawComponent:n,eventDispatcher:e,execCommands:m,formData:f,formlayout:i,onFolderSelected:s,onFolderAdded:a,mode:"live"})]})]}):jsxs("div",{className:"foldersHolder",style:h.btreeContainerDesktop,children:[jsx(S,{}),jsx(ut,{params:{...r,sourcePluginCode:r.pluginCode,sourceFormCode:r.formCode},redrawComponent:n,eventDispatcher:e,execCommands:m,formData:f,formlayout:i,onFolderSelected:s,onFolderAdded:a,mode:"live"})]}),jsx("div",{style:h.mainContent,children:t})]})]})};var Md=lazy(()=>import('./fileviewer-N5Z4NUU6.js')),Bd=lazy(()=>import('./formeditor-UXGXSTS6.js').then(t=>({default:t.Formeditor}))),Pt=t=>new Promise(e=>setTimeout(e,t)),Kt={command:{},params:{id:null,parentId:null,guid:"",pGuid:"",formCode:"",pluginCode:"",modal:false,modalCloseFn:()=>{},modalCloseAndOpenFn:()=>{},originator:{params:{pluginCode:"",formCode:"",guid:""}},parent:{widgetName:"",params:{pluginCode:"",formCode:"",guid:""}},hasParentForm:false,folderData:{id:"",label:"",isRoot:"",captions:[]}},doValidateForm:false,redrawComponent:false,redrawFoldersComponent:false,fieldAllowedValues:{},formData:{},widgetRelatedData:[],widgetsState:{visibility:{},readonly:{}},formDimension:{width:0,height:0},formValidationData:{},enableEventHandlers:false,isModal:false,hasParentForm:false,formLayout:"regular"},yr={containerSetup:{properties:{style:{minHeight:0}}},selectedWidgetProps:{title:"",subtitle:"",style:{},tabsetup:null,_path:{type:null,stricttype:null,component:null,tabId:null,panelId:null,rowId:null,segmentId:null,widgetId:null},lastActiveTabId:null}},Nd={id:"",parentId:"",pluginCode:"",formCode:"",guid:null,pGuid:void 0,isFormEditorMode:false,originator:{params:{pGuid:"",pluginCode:"",formCode:"",guid:""}},parent:{widgetName:"",params:{pGuid:"",pluginCode:"",formCode:"",guid:""}},folderData:{id:"",addedFolderId:"",isRoot:"",captions:[]},prefillData:void 0},Ld=memo(function({previewMode:e,className:n,maxWidth:i$1,setup:r,params:s,enableEventHandlers:a,modalCloseFn:f$1}){var no,ao;let m={...s,modalCloseFn:f$1||(s==null?void 0:s.modalCloseFn)},c=useRef(null),[w,F]=useState(0),{registerFormSubmitEvent:p,checkFormAccess:d}=i(),{apiConfig:u,appSettings:g,viewPort:b,runLoadFormEvent:h,runServerPingEvent:S,runFormEvent:y,fetchUserMenu:D,signInUser:V,signOut:M}=b$1(),[C,T]=useState(null),v=useNavigate(),[J,Z]=useState(false),ee=useRef({}),[x,O]=useState({}),[R,U]=useState(null),[j,N]=useState(null),E=useLocation(),[$]=useState(b.width),[re]=useState(m.modal||false),[pe]=useState(P.hasParentForm()||!!(u!=null&&u.token)),[ye,se]=useState([]),_=ye.length>0?ye[ye.length-1]:Nd,[ue,Y]=useState(),[ce,we]=useState(true),{t:ge}=useTranslation(),H=e$1(),Q=f(),k=g$2(),G={command:{},params:m,doValidateForm:false,redrawComponent:false,redrawFoldersComponent:false,fieldAllowedValues:{},formData:{},widgetRelatedData:[],widgetsState:{visibility:{},readonly:{}},formDimension:{width:w,height:0},formValidationData:{},enableEventHandlers:a,isModal:re,hasParentForm:pe,formLayout:"regular"},[o,te]=useState(G),[oe,ie]=useState({...yr,containerSetup:r}),Ne=fr(()=>{c&&c.current&&F(c.current.offsetWidth);},200),Ge=async(l,B)=>{await h({pluginCode:l.pluginCode,formCode:l.formCode,guid:l.guid,projectGuid:l.pGuid,pGuid:l.pGuid,originator:l.originator,parent:l.parent,previewMode:e,widgetContext:JSON.stringify({folderData:l.folderData,prefillData:l.prefillData})}).then(async P$1=>{var A,K,X,ve,he,be,Fe,W;if(P$1.meta.requestStatus==="fulfilled"){let L={...P$1.payload};if(Object.keys(L).length===0)return;try{let me=window.location.hostname;if(!b$3.SKIP_ACCESS_VALIDATION_DOMAINS.some(He=>me===He||me.endsWith(`.${He}`))){let He=await d(l.formCode);(He==null?void 0:He.subscriptionPlan)!=null&&U(He.subscriptionPlan);}}catch(me){N({title:(K=(A=me==null?void 0:me.data)==null?void 0:A.error)!=null?K:"Form Unavailable",message:(ve=(X=me==null?void 0:me.data)==null?void 0:X.message)!=null?ve:"This form is temporarily unavailable."});return}if(L.uiTranslations&&Object.keys(L.uiTranslations).length>0){ee.current=L.uiTranslations,O(L.uiTranslations);let me=Sd;me.addResourceBundle(me.language,"default",L.uiTranslations,true,true);}let Re={},de={visibility:{...o==null?void 0:o.widgetsState.visibility,...(he=L==null?void 0:L.widgetsState)==null?void 0:he.visibility},readonly:{...o==null?void 0:o.widgetsState.readonly,...(be=L==null?void 0:L.widgetsState)==null?void 0:be.readOnly}};if(B){te(me=>({...me,formData:L.data,fieldAllowedValues:L.fieldAllowedValues,widgetsState:de,formLayout:L.layout,requiredFields:L.requiredFields}));return}let De={},Le=[],Oe={},Ue=JSON.parse(L.definition);if(Ue==null){te({...G,redrawComponent:false,doValidateForm:false,command:{...L.FECommand},formData:{},widgetsState:de,formLayout:L.layout,requiredFields:L.requiredFields,params:{...G.params,folderData:L.folderData}});return}P.mapComponents(Ue._children);let Qe=Ue.properties;Le=Ue._children,Oe=Ue,ie({...oe,containerProps:Qe,selectedWidgetProps:{...oe.containerProps},containerData:Le,containerSetup:Oe}),Re=L.fieldAllowedValues,De=L.data,te({...G,formData:De,formLayout:L.layout,widgetsState:{visibility:{...o==null?void 0:o.widgetsState.visibility,...(Fe=L==null?void 0:L.widgetsState)==null?void 0:Fe.visibility},readonly:{...o==null?void 0:o.widgetsState.readonly,...(W=L==null?void 0:L.widgetsState)==null?void 0:W.readOnly}},requiredFields:L.requiredFields,command:{...L.FECommand},fieldAllowedValues:Re,params:{...G.params,folderData:L.folderData}}),Z(true);}});};if(useEffect(()=>(Ne(),Ge(m,false),window.addEventListener("resize",Ne),()=>{te(()=>({...Kt})),ie(yr),Z(false),window.removeEventListener("resize",Ne);}),[m.pGuid,m.guid,m.pluginCode,m.formCode]),useEffect(()=>{var K,X,ve,he,be,Fe,W,L,Re,de,De,Le,Oe,Ue,Qe,me,Et,He,ro,io,lo,so,mo,uo,co,fo,po,go,ho,bo,vo,yo,wo,Co,xo,Io,Fo,To,Do,Po,So,Ro,Eo,ko,Mo,Bo,No,Lo,_o,Ao,Vo,Oo,Uo,Ho,Wo,$o,Go,zo,qo,Jo,jo,Yo,Qo,Ko,Xo,Zo,en,tn,on,nn,an,rn,ln,dn,sn;let l=o,B=null,P$1=true,A=false;if((K=o.command)!=null&&K.Messages&&((X=o.command)==null||X.Messages.forEach(le=>{var Ee;let ae=(Ee=ee.current[le.text])!=null?Ee:ge(le.text);le.code==="NOTICE"?(A=true,k({toastID:nanoid(11),msg:ae,clearQueue:false,hideProgressBar:false})):le.code==="SUCCESS"?(A=true,Q({toastID:nanoid(11),msg:ae,clearQueue:false,hideProgressBar:false})):le.code==="WARNING"&&(P$1=false,H({toastID:nanoid(11),msg:ae,clearQueue:false,hideProgressBar:false}));})),(ve=o.command)!=null&&ve.DisplayButtonLoader){te({...o,displayButtonLoader:true});return}if((he=o.command)!=null&&he.DisplayErrorPage){v("/pagenotfound");return}if((be=o.command)!=null&&be.MoveToTab){let le=(W=(Fe=o.command)==null?void 0:Fe.MoveToTab)==null?void 0:W.widgetName;if(le){let ae=P.getTabWidgetByFieldName(le,oe.containerSetup);ae!==null&&(ae==null?void 0:ae.tabId)!==void 0&&Ve(ae);}}if((L=o.command)!=null&&L.FormValidationData&&Object.keys(o.command.FormValidationData).length>0){let le=Object.keys(o.command.FormValidationData)[0];if(le){let ae=P.getTabWidgetByFieldName(le,oe.containerSetup);ae!==null&&(ae==null?void 0:ae.tabId)!==void 0&&Ve(ae),setTimeout(()=>{let Ee=[`[name="${le}"]`,`[data-field-name="${le}"]`,`#${le}`,`[id*="${le}"]`],Pe=null;for(let gt of Ee)try{if(Pe=document.querySelector(gt),Pe)break}catch(kt){}Pe&&(Pe.scrollIntoView({behavior:"smooth",block:"center"}),(Pe.tagName==="INPUT"||Pe.tagName==="TEXTAREA"||Pe.tagName==="SELECT")&&Pe.focus());},100);}te({...o,doValidateForm:true,formValidationData:(Re=o.command)==null?void 0:Re.FormValidationData});return}else l={...l,formValidationData:{}};if((de=o.command)!=null&&de.FetchUserMenu&&D&&D({ProjectGuid:(Le=(De=o.command)==null?void 0:De.FetchUserMenu)==null?void 0:Le.projectGuid,pGuid:(Ue=(Oe=o.command)==null?void 0:Oe.FetchUserMenu)==null?void 0:Ue.projectGuid}),(Qe=o.command)!=null&&Qe.Redirect){m.modalCloseFn&&m.modalCloseFn(),v(`${(me=o.command)==null?void 0:me.Redirect.url}?ref=${(ro=(He=(Et=o.command)==null?void 0:Et.Redirect)==null?void 0:He.context)==null?void 0:ro.referer}`,{state:{from:(so=(lo=(io=o.command)==null?void 0:io.Redirect)==null?void 0:lo.context)==null?void 0:so.referer}});return}if((mo=o.command)!=null&&mo.BuildPlugin){v(`${(uo=o.command)==null?void 0:uo.BuildPlugin.url}?ref=${(fo=(co=o.command)==null?void 0:co.BuildPlugin)==null?void 0:fo.referer}`);return}if((po=o.command)!=null&&po.DisplayComponent&&T((go=o.command)==null?void 0:go.DisplayComponent),(ho=o.command)!=null&&ho.CloseDisplayComponent&&T(null),(bo=o.command)!=null&&bo.Login&&(async()=>{var le,ae,Ee,Pe,gt,kt,mn;V&&await V((le=o.command)==null?void 0:le.Login),D&&await D({ProjectGuid:P.extractProjectGuid((Ee=(ae=o.command)==null?void 0:ae.Login)==null?void 0:Ee.url),pGuid:P.extractProjectGuid((gt=(Pe=o.command)==null?void 0:Pe.Login)==null?void 0:gt.url)}),v(((mn=(kt=o.command)==null?void 0:kt.Login)==null?void 0:mn.url)||"/");})(),(vo=o.command)!=null&&vo.Logout&&(async()=>{var ae;(ae=o.command)!=null&&ae.Logout&&(M&&await M(),v("/"));})(),((yo=o.command)!=null&&yo.Cancel||(wo=o.command)!=null&&wo.CloseForm)&&(o.isModal&&m.modalCloseFn!==void 0?m.modalCloseFn(null,null,false,(Co=o.command)==null?void 0:Co.RedrawFolders):(B=P.getUrlParameter("ref"),B!=null&&v(B))),(xo=o.command)!=null&&xo.AfterRecordSave){let le=(Io=g==null?void 0:g.TOASTER_AUTOCLOSE)!=null?Io:b$3.TOASTER_AUTOCLOSE;if(B=P.getUrlParameter("ref"),((Fo=o.command)==null?void 0:Fo.AfterRecordSave.guid)==null)!((To=o.command)!=null&&To.OpenModal)&&m.modalCloseFn?m.modalCloseFn(null,null,false,null,null):(Do=o.command)!=null&&Do.OpenModal||(async()=>(await Pt(A?le:0),B!=null&&v(B)))();else if(o.isModal){let ae;(Po=o.command)!=null&&Po.HotReloadEnabled&&(ae=(So=o.command)==null?void 0:So.HotReloadEnabled),(Ro=o.command)!=null&&Ro.OpenModal||(async()=>{var Ee,Pe;await Pt(A?le:0),m.modalCloseFn&&m.modalCloseFn(ae,o.formData,(Ee=o.command)==null?void 0:Ee.RedrawScreen,(Pe=o.command)==null?void 0:Pe.RedrawFolders,null);})();}else {let ae=B!=null;if(!((Eo=o.command)!=null&&Eo.OpenModal)&&ae&&P$1)(async()=>(await Pt(A?le:0),B!=null&&v(B)))();else if(!((ko=o.command)!=null&&ko.OpenModal)){let Ee=E.pathname.replace(/\/new/gi,"/"+((Mo=o.command)==null?void 0:Mo.AfterRecordSave.guid.replace(/#/g,"%23")));v(Ee,{state:{from:E.pathname}}),l={...l,params:{...o.params,guid:(Bo=o.command)==null?void 0:Bo.AfterRecordSave.guid}};}}}if((No=o.command)!=null&&No.UpdateWidgetsState&&(l={...l,widgetsState:{visibility:{...l==null?void 0:l.widgetsState.visibility,...(_o=(Lo=o.command)==null?void 0:Lo.UpdateWidgetsState)==null?void 0:_o.visibility},readonly:{...l==null?void 0:l.widgetsState.readonly,...(Vo=(Ao=o.command)==null?void 0:Ao.UpdateWidgetsState)==null?void 0:Vo.readonly}}}),(Oo=o.command)!=null&&Oo.UpdateFieldAllowedValues&&(l={...l,fieldAllowedValues:{...(Uo=o.command)==null?void 0:Uo.UpdateFieldAllowedValues}}),(Ho=o.command)!=null&&Ho.UpdateFormData&&(l={...l,formData:{...(Wo=o.command)==null?void 0:Wo.UpdateFormData}}),($o=o.command)!=null&&$o.UpdateFormDataItem&&(l={...l,formData:{...l.formData,[(Go=o.command)==null?void 0:Go.UpdateFormDataItem.name]:(zo=o.command)==null?void 0:zo.UpdateFormDataItem.value}}),((Jo=(qo=o.command)==null?void 0:qo.ReplaceContextRecordGuid)==null?void 0:Jo.guid)!=null&&(l={...l,displayButtonLoader:false,params:{...o.params,guid:(jo=o.command)==null?void 0:jo.ReplaceContextRecordGuid.guid}}),(Yo=o.command)!=null&&Yo.OpenModal){let le={...(Qo=o.command)==null?void 0:Qo.OpenModal,parentId:m.id};se(ae=>[...ae,le]),l={...l,command:{}};}(Ko=o.command)!=null&&Ko.PreviewDocument&&Y((Xo=o.command)==null?void 0:Xo.PreviewDocument),(Zo=o.command)!=null&&Zo.RedrawScreen&&(l={...l,redrawComponent:!o.redrawComponent,redrawFoldersComponent:!o.redrawFoldersComponent}),(en=o.command)!=null&&en.RedrawFolders&&(l={...l,params:{...o.params,folderData:{id:(on=(tn=o.command)==null?void 0:tn.RedrawFolders)==null?void 0:on.folderId,addedFolderId:(an=(nn=o.command)==null?void 0:nn.RedrawFolders)==null?void 0:an.folderId,isRoot:(ln=(rn=o.command)==null?void 0:rn.RedrawFolders)==null?void 0:ln.isRoot,captions:(sn=(dn=o.command)==null?void 0:dn.RedrawFolders)==null?void 0:sn.captions}}}),Object.keys(o.command).length>0&&(l={...l,command:{}},te(l));},[o.command]),j)return jsx(l,{title:j.title,message:j.message});if(!J)return Te__default.createElement("div",{},jsx(a$2,{message:ge("Please wait...")}));let Ye=(l,B)=>{let P={};return Object.entries(l).forEach(([A,K])=>{let X=B[A];(X==null||X===""||X==="0"||X===0||Array.isArray(X)&&X.length===0)&&(P[A]=K);}),P},Ve=(l,B=false,P$1={})=>{let A=ft(null,l.tabId,l.index,B,P$1.containerSetup);if(A===void 0)return;let K=P.GetParentTabId(A.containerSetup,l.tabId);(K==null?void 0:K.tabId)!=null?(A=ft(null,K.tabId,K.index,false,A.containerSetup),A!==void 0&&Ve(K,true,A)):B===false&&ft(null,l.tabId,l.index,true);},Ce=async l=>(te({...o,displayButtonLoader:true}),await y({pluginCode:l.pluginCode,formCode:l.formCode,guid:l.guid,projectGuid:l.projectGuid,pGuid:l.projectGuid,formData:{...l.formData,[l.fieldName]:l.value},widgetContext:JSON.stringify({referer:E.pathname,parentWidgetId:l.tabId,hasParentForm:P.hasParentForm(),originator:{widgetName:l.fieldName.toLowerCase(),params:o.params},parent:{widgetName:l.fieldName.toLowerCase(),params:o.params},parentOriginator:{params:o.params.originator?o.params.originator.params:{}},folderData:o.params.folderData}),widgetEvent:l.widgetEvent,widgetName:l.fieldName.toLowerCase(),widgetValue:l.widgetValue}).then(async B=>{var P,A,K,X,ve,he,be,Fe;if(B.meta.requestStatus==="fulfilled"){let W={...B.payload};((P=W.FECommand)==null?void 0:P.ReplaceContextRecordGuid)!==void 0?(W.FECommand={Messages:(K=(A=W.FECommand)==null?void 0:A.Messages)!=null?K:[],UpdateFormData:W.data,ReplaceContextRecordGuid:(X=W.FECommand)==null?void 0:X.ReplaceContextRecordGuid},ot(W.FECommand)):(ve=W.FECommand)!=null&&ve.Messages?(W.FECommand={UpdateFormData:W.data,Messages:(he=W.FECommand)==null?void 0:he.Messages},ot(W.FECommand)):(be=W.FECommand)!=null&&be.FormValidationData&&(W.FECommand={FormValidationData:(Fe=W.FECommand)==null?void 0:Fe.FormValidationData},ot(W.FECommand));}else te({...o,displayButtonLoader:false});})),tt=l=>{let B=l.widgetContext,P$1=l.widgetEvent,A=l.widgetName.toLowerCase(),K=l.widgetValue,X=l.feCommand||{},ve=l.skipFormDataItem||false;if(P$1!==null&&o.enableEventHandlers){if(l.autoSave){Ce(l.autoSave);return}let he=K!=null&&ve===false?{...o.formData,[A]:K}:o.formData;if((P$1==null?void 0:P$1.toUpperCase())==="ONSAVE"&&o.requiredFields!=null){let be=Ye(o.requiredFields,he),Fe=Object.keys(o.formValidationData||{}).length>0,W=Object.keys(be).length>0;if((W||Fe)&&(te({...o,command:{...o.command,FormValidationData:be}}),W))return}(async()=>{var be,Fe;if((P$1==null?void 0:P$1.toUpperCase())==="ONSAVE")try{await p(o.params.formCode);}catch(W){if((W==null?void 0:W.status)===429)return}we(false),await y({pluginCode:o.params.pluginCode,formCode:o.params.formCode,guid:o.params.guid,projectGuid:(be=o.params.pGuid)!=null?be:"",pGuid:(Fe=o.params.pGuid)!=null?Fe:"",widgetContext:B,widgetEvent:P$1,widgetName:A,widgetValue:typeof K=="string"?K:K!=null?JSON.stringify(K):null,formData:he,widgetsState:o.widgetsState}).then(W=>{var L,Re;if(W.meta.requestStatus==="fulfilled"){if(W.payload instanceof Blob){te({...o,redrawComponent:!o.redrawComponent});return}let de={...W.payload};if(Object.keys(de).length===0)return;let De=JSON.parse(de.definition);if(De!=null){let Le=[],Oe={};P.mapComponents(De._children);let Ue=De.properties;Le=De._children,Oe=De,ie({...oe,containerProps:Ue,selectedWidgetProps:{...oe.selectedWidgetProps},containerData:Le,containerSetup:Oe});let Qe=A;if(Qe){let me=P.getTabWidgetByFieldName(Qe,Oe);me!==null&&(me==null?void 0:me.tabId)!==void 0&&Ve(me,true,{containerSetup:Oe});}}ve||(o.redrawComponent=false),te({...o,fieldAllowedValues:de.fieldAllowedValues,doValidateForm:true,command:{...de.FECommand},formData:{...o.formData,...de.data},widgetRelatedData:de.widgetRelatedData,widgetsState:{visibility:{...o==null?void 0:o.widgetsState.visibility,...(L=de==null?void 0:de.widgetsState)==null?void 0:L.visibility},readonly:{...o==null?void 0:o.widgetsState.readonly,...(Re=de==null?void 0:de.widgetsState)==null?void 0:Re.readOnly}},tabIndex:l.tabIndex?Number(l.tabIndex+1):0});}}).finally(async()=>{var W;if(we(true),(P$1==null?void 0:P$1.toUpperCase())==="ONSAVE"&&u!=null&&u.iframeMode&&u!=null&&u.token){let L=(W=oe.containerProps)==null?void 0:W.webhooks;if(Array.isArray(L)&&L.length>0){let Re={formCode:o.params.formCode,submittedAt:new Date().toISOString(),data:he};L.forEach(de=>{var De;de.enabled&&((De=de.url)!=null&&De.startsWith("http"))&&fetch(de.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Re),mode:"cors"}).then(Le=>{Le.ok||H({toastID:nanoid(11),msg:`Webhook failed: ${de.url}`,clearQueue:false,hideProgressBar:false});}).catch(Le=>{H({toastID:nanoid(11),msg:`Webhook failed: ${de.url}`,clearQueue:false,hideProgressBar:false});});});}}});})();}if(K!=null){let he={...o.formData,[A]:K};te({...o,command:X,formData:he});}},xe=(l,B,P$1)=>P.findRowItem(l,B,P$1,oe.containerSetup._children),rt=(l,B,P$1,A)=>P.findSegmentItem(l,B,P$1,A,oe.containerSetup._children),xr=l=>P.findWidgetByIdRecursive(oe.containerSetup._children,l),Ir=(l,B)=>P.getActiveTabIndex(oe.containerSetup._children,B),ft=(l,B,P$1,A=true,K={})=>{let X=Object.keys(K).length>0?K:oe.containerSetup,ve=P.getTabContainer(X._children,B),he=P.getTabContainerChildrens(X._children,B);if(he===void 0)return;for(let L=0;L<he.data.length;L++)he.data[L].activeTab="0";let be=he.data.filter((L,Re)=>Re===P$1)[0];be.properties={...ve.item.properties.tabsetup,...be.properties};let Fe=P.getNodeUpdatePath(he.path,{$splice:[[P$1,1,{...be,activeTab:"1"}]]});var W={containerSetup:{...X,_children:(0, wr.default)(X._children,Fe)},selectedWidgetProps:{...oe.selectedWidgetProps,tabsetup:{...be.properties},_path:{...oe.selectedWidgetProps._path,panelId:be.id},lastActiveTabId:B}};return A&&ie(W),W},Fr=(l=true)=>{let B=Kt;l&&(B={...o,redrawComponent:!o.redrawComponent,params:{...o.params,folderData:{id:"",isRoot:"",captions:[]}}}),te(B);},ot=l=>{te({...o,redrawComponent:!o.redrawComponent,command:{...l}});},Xt=(l,B)=>{(async()=>S&&await S({cmd:"ping"}).then(async P=>{(P==null?void 0:P.type)==="formbuilder/ping/rejected"?(H({toastID:nanoid(11),msg:"Application is being restarted. Please wait until it finishes....",clearQueue:false,hideProgressBar:false}),await Pt(1e3),Xt(l)):l();}))();},Rt=(l,B=false,P,A=null)=>{Xt(()=>{if(se(X=>X.slice(0,-1)),A!=null){let X={...A,parentId:m.id};se(ve=>[...ve,X]);}else if(l!=null){let X={id:nanoid(5),pluginCode:l==null?void 0:l.pluginCode,formCode:l==null?void 0:l.formCode,guid:null,isFormEditorMode:true,parentId:m.id};se(ve=>[...ve,X]);}if(Ge(o.params,true),P){let X=P==null?void 0:P.folderId;Zt(X,[]);}else te({...o,redrawComponent:!o.redrawComponent});}),B&&o.isModal&&Ge(m,true);},Tr=(l,B="",P)=>{let A={...o,redrawFoldersComponent:!o.redrawFoldersComponent,redrawComponent:!o.redrawComponent,params:{...o.params,folderData:{...o.params.folderData,addedFolderId:"",captions:P,id:l!==null?l:"",isRoot:B}}};te(A);},Zt=(l,B)=>{let P=Kt;l==null?P={...o,redrawFoldersComponent:!o.redrawFoldersComponent,params:{...o.params,folderData:{...o.params.folderData,addedFolderId:l!==null?l:"",captions:B}}}:P={...o,params:{...o.params,folderData:{...o.params.folderData,id:l!==null?l:"",addedFolderId:l!==null?l:"",isRoot:"",captions:B}}},te(P);},eo=l=>{l&&se(B=>[...B.slice(0,-1),{...l,id:nanoid(5)}]);},Dr=()=>{Y(void 0);},Pr=()=>T(null),Sr=l=>{let{title:B,subtitle:P}=l,A=B;return P!==void 0&&String(P).trim()!==""&&(A=B+" - "+P),o.enableEventHandlers&&Object.keys((o==null?void 0:o.formData)||{}).length>0&&Object.entries(o.formData).forEach(([K,X])=>{A=A.replace(`#${K}`,X);}),A},{properties:Ie}=oe.containerSetup||{},{minHeight:to}=(Ie==null?void 0:Ie.style)||{},pt={};to&&(pt.minHeight=to),re&&(pt={...pt,width:"100%",minWidth:$-$*.3,maxHeight:"calc(100dvh - 4rem)",overflow:"auto"});let oo={};return e&&(oo={overflowY:"scroll",height:"100vh",padding:"0px 10px 10px 10px"}),jsx(k$1.Provider,{value:R,children:jsx(Ta.Provider,{value:x,children:jsxs(gr,{execCommands:ot,eventDispatcher:tt,redrawComponent:o.redrawFoldersComponent,formlayout:o.formLayout,params:o.params,onFolderSelected:Tr,onFolderAdded:Zt,formData:o.formData,children:[jsxs("div",{id:"main-content-wrapper",className:n,children:[jsx("div",{className:"content",children:jsx("div",{className:"main-content on-scrollbar",style:oo,children:jsxs("div",{id:"formCanvas",ref:c,style:{maxWidth:i$1,border:(Ie==null?void 0:Ie.border)===false?"none":void 0},children:[jsxs("form",{onSubmit:l=>{l.preventDefault();},style:{position:"relative"},children:[Ie&&!Ie.hideheader&&jsxs("div",{className:"form-header top-border-radius",style:{backgroundColor:(Ie==null?void 0:Ie.headerbackground)===false?"transparent":void 0},children:[jsx("div",{style:{flex:1,marginLeft:"0.5rem"},children:Ie&&Sr(Ie)}),re&&m.modalCloseFn!==void 0&&jsx("div",{style:{width:"2.5em"},children:jsx(vr,{onClick:()=>m.modalCloseFn(null),children:Te__default.createElement(Q$1)})})]}),Ie&&Ie.hideheader&&re&&m.modalCloseFn!==void 0&&jsx("div",{style:{position:"absolute",top:"0.5rem",right:"0.5rem",zIndex:9999},children:jsx(vr,{size:"medium",onClick:l=>{l.stopPropagation(),m.modalCloseFn(null);},sx:{backgroundColor:"rgba(255, 255, 255, 0.95)","&:hover":{backgroundColor:"rgba(255, 255, 255, 1)"}},children:Te__default.createElement(Q$1)})}),jsx("div",{style:pt,className:"form-container bottom-border-radius",children:jsx("div",{className:"form-container",children:jsx(l$1,{darkMode:false,noPadding:true,children:jsx(Suspense,{fallback:jsx(a$2,{}),children:jsx(_d,{eventDispatcher:tt,context:o,formWidth:w,findRowItem:xe,findSegmentItem:rt,findWidgetItem:xr,modal:re,getActiveTabIndex:Ir,setActiveTabIndex:ft,setRedrawComponent:Fr,execCommands:ot,widgets:oe.containerSetup})})})})})]}),C!==null&&jsx(d$1,{componentName:C.componentName,options:C.options,params:{params:(no=C.options)!=null&&no.contextParams?(ao=C.options)==null?void 0:ao.contextParams:o.params,formData:o.formData,execCommands:l=>ot(l),modalCloseFn:()=>Pr(),modalCloseAndOpenFn:l=>eo(l)}})]})})}),(R==null?void 0:R.toLowerCase())==="free"&&!re&&jsxs("div",{style:{textAlign:"center",padding:"12px 16px",fontSize:"13px",color:"#aaa"},children:["Powered by"," ",jsx("a",{href:"https://buildocs.com",target:"_blank",rel:"noopener noreferrer",style:{color:"#3498db",textDecoration:"none",fontWeight:500},children:"Buildocs"})]})]}),!ce&&jsx(a$2,{message:ge("Please wait...")}),!_.isFormEditorMode&&ue&&ue.fileId&&jsx(Suspense,{fallback:jsx(a$2,{message:ge("Loading viewer...")}),children:jsx(Md,{fileId:ue.fileId,fileBase64:ue.data,fieldName:ue.fieldName,params:{...ue.context?ue.context:o.params,modalCloseFn:Dr}},nanoid(11))}),!_.isFormEditorMode&&(_==null?void 0:_.pluginCode)&&(_==null?void 0:_.formCode)&&jsx(a$3,{component:jsx(Ld,{params:{id:_.id,parentId:_.parentId,pluginCode:_.pluginCode,formCode:_.formCode,guid:_.guid==null?"new":_.guid,pGuid:_.pGuid,modal:true,modalCloseFn:(l,B,P,A,K=null)=>Rt(l,P,A,K),modalCloseAndOpenFn:l=>eo(l),originator:_.originator,parent:_.parent,folderData:_.folderData,prefillData:_.prefillData},enableEventHandlers:true}),id:_.id,onCloseModal:Rt,parentId:_.parentId},_.id),_.isFormEditorMode&&(_==null?void 0:_.pluginCode)&&(_==null?void 0:_.formCode)&&jsx(a$3,{component:jsx(Suspense,{fallback:jsx(a$2,{}),children:jsx(Bd,{inPreviewMode:false,pluginCode:_.pluginCode,formCode:_.formCode,modal:true},nanoid(11))}),id:_.id,onCloseModal:()=>Rt(null,false,null),parentId:_.parentId,windowMode:"fullWindow"},_.id)]})})})}),_d=t=>{let e=0,n=i=>{for(var r in i)typeof i[r]=="object"&&i[r]!==null?n(i[r]):r==="tabIndex"&&(t.modal?i[r]=0:i[r]=++e);};return n(t.widgets._children),(t.widgets._children||[]).map(({id:i,tabId:r,panelId:s,type:a,component:f,properties:m})=>Te__default.createElement(Ae.getFormComponent(f,m),{key:"key_"+i,id:i,tabId:r,panelId:s,className:a,context:{...t.context,formDimension:{width:t.formWidth,height:0}},properties:m,widgetsState:t.context.widgetsState,methodProvider:{eventDispatcher:t.eventDispatcher,findRowItem:t.findRowItem,findSegmentItem:t.findSegmentItem,findWidgetItem:t.findWidgetItem,getActiveTabIndex:t.getActiveTabIndex,setActiveTabIndex:t.setActiveTabIndex,setRedrawComponent:t.setRedrawComponent,execCommands:t.execCommands}},i))};
1
+ import {g,i,l,k as k$1,d as d$1}from'./chunk-XIHHDF46.js';import {b as b$2,f,e as e$1,g as g$2}from'./chunk-FRAOYRZD.js';import {b as b$3,a as a$3}from'./chunk-22LEYH6Q.js';import {u,v,x,P,Q,t,w,g as g$3}from'./chunk-XUX4HB5C.js';import {b as b$1}from'./chunk-LBMVBVXW.js';import {m,d,j as j$1,k,o,n,e,f as f$1,g as g$1,l as l$1}from'./chunk-UB4UI4WT.js';import {j,a as a$1,n as n$1,Q as Q$1,u as u$1,B,F,O,t as t$1}from'./chunk-TO4AS5KE.js';import {a as a$2}from'./chunk-SDIZEEZP.js';import {a,b}from'./chunk-EK7ODJWE.js';import*as Te from'react';import Te__default,{memo,useRef,useState,useEffect,createElement,createContext,lazy,useCallback,startTransition,Suspense,useContext,useMemo}from'react';import {withTranslation,useTranslation}from'react-i18next';import {useLocation,useNavigate}from'react-router-dom';import {nanoid}from'@reduxjs/toolkit';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import rr from'@mui/material/Box';import ai from'@mui/material/Button';import ri from'@mui/material/Tooltip';import zi from'axios';import Xi from'@mui/material/CircularProgress';import Zi from'@mui/material/LinearProgress';import vr from'@mui/material/IconButton';import Ul from'@mui/material/InputAdornment';import Hl from'@mui/icons-material/Visibility';import Wl from'@mui/icons-material/VisibilityOff';import {animated,useSpring}from'@react-spring/web';import {styled,alpha}from'@mui/material/styles';import ql from'@mui/material/Collapse';import Jl from'@mui/material/Typography';import jl from'@mui/icons-material/FolderRounded';import {RichTreeView}from'@mui/x-tree-view/RichTreeView';import {treeItemClasses}from'@mui/x-tree-view/TreeItem';import {unstable_useTreeItem2}from'@mui/x-tree-view/useTreeItem2';import {TreeItem2Root,TreeItem2Content,TreeItem2IconContainer,TreeItem2Checkbox,TreeItem2Label}from'@mui/x-tree-view/TreeItem2';import {TreeItem2Icon}from'@mui/x-tree-view/TreeItem2Icon';import {TreeItem2DragAndDropOverlay}from'@mui/x-tree-view/TreeItem2DragAndDropOverlay';import Ct from'@mui/material/ListItemIcon';import xt from'@mui/material/ListItemText';import nd from'@mui/material/Menu';import It from'@mui/material/MenuItem';import Sd from'i18next';import xd from'@mui/material/Backdrop';var vt=a((_t,At)=>{(function(t,e){typeof _t=="object"&&typeof At!="undefined"?At.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis!="undefined"?globalThis:t||self).dayjs_plugin_utc=e();})(_t,(function(){var t="minute",e=/[+-]\d\d(?::?\d\d)?/g,n=/([+-]|\d\d)/g;return function(i,r,s){var a=r.prototype;s.utc=function(d){var u={date:d,utc:true,args:arguments};return new r(u)},a.utc=function(d){var u=s(this.toDate(),{locale:this.$L,utc:true});return d?u.add(this.utcOffset(),t):u},a.local=function(){return s(this.toDate(),{locale:this.$L,utc:false})};var f=a.parse;a.parse=function(d){d.utc&&(this.$u=true),this.$utils().u(d.$offset)||(this.$offset=d.$offset),f.call(this,d);};var m=a.init;a.init=function(){if(this.$u){var d=this.$d;this.$y=d.getUTCFullYear(),this.$M=d.getUTCMonth(),this.$D=d.getUTCDate(),this.$W=d.getUTCDay(),this.$H=d.getUTCHours(),this.$m=d.getUTCMinutes(),this.$s=d.getUTCSeconds(),this.$ms=d.getUTCMilliseconds();}else m.call(this);};var c=a.utcOffset;a.utcOffset=function(d,u){var g=this.$utils().u;if(g(d))return this.$u?0:g(this.$offset)?c.call(this):this.$offset;if(typeof d=="string"&&(d=(function(y){y===void 0&&(y="");var D=y.match(e);if(!D)return null;var V=(""+D[0]).match(n)||["-",0,0],M=V[0],C=60*+V[1]+ +V[2];return C===0?0:M==="+"?C:-C})(d),d===null))return this;var b=Math.abs(d)<=16?60*d:d;if(b===0)return this.utc(u);var h=this.clone();if(u)return h.$offset=b,h.$u=false,h;var S=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return (h=this.local().add(b+S,t)).$offset=b,h.$x.$localOffset=S,h};var w=a.format;a.format=function(d){var u=d||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return w.call(this,u)},a.valueOf=function(){var d=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*d},a.isUTC=function(){return !!this.$u},a.toISOString=function(){return this.toDate().toISOString()},a.toString=function(){return this.toDate().toUTCString()};var F=a.toDate;a.toDate=function(d){return d==="s"&&this.$offset?s(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():F.call(this)};var p=a.diff;a.diff=function(d,u,g){if(d&&this.$u===d.$u)return p.call(this,d,u,g);var b=this.local(),h=s(d).local();return p.call(b,h,u,g)};}}));});var zn=a((We,Gn)=>{Object.defineProperty(We,"__esModule",{value:true});function _e(t){return typeof t=="object"&&!("toString"in t)?Object.prototype.toString.call(t).slice(8,-1):t}var Rr=typeof process=="object"&&true;function Me(t,e){if(!t)throw Rr?new Error("Invariant failed"):new Error(e())}We.invariant=Me;var Vt=Object.prototype.hasOwnProperty,Er=Array.prototype.splice,kr=Object.prototype.toString;function Xe(t){return kr.call(t).slice(8,-1)}var yt=Object.assign||(function(t,e){return Ot(e).forEach(function(n){Vt.call(e,n)&&(t[n]=e[n]);}),t}),Ot=typeof Object.getOwnPropertySymbols=="function"?function(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.keys(t)};function Je(t){return Array.isArray(t)?yt(t.constructor(t.length),t):Xe(t)==="Map"?new Map(t):Xe(t)==="Set"?new Set(t):t&&typeof t=="object"?yt(Object.create(Object.getPrototypeOf(t)),t):t}var Wn=(function(){function t(){this.commands=yt({},Mr),this.update=this.update.bind(this),this.update.extend=this.extend=this.extend.bind(this),this.update.isEquals=function(e,n){return e===n},this.update.newContext=function(){return new t().update};}return Object.defineProperty(t.prototype,"isEquals",{get:function(){return this.update.isEquals},set:function(e){this.update.isEquals=e;},enumerable:true,configurable:true}),t.prototype.extend=function(e,n){this.commands[e]=n;},t.prototype.update=function(e,n){var i=this,r=typeof n=="function"?{$apply:n}:n;Array.isArray(e)&&Array.isArray(r)||Me(!Array.isArray(r),function(){return "update(): You provided an invalid spec to update(). The spec may not contain an array except as the value of $set, $push, $unshift, $splice or any custom command allowing an array value."}),Me(typeof r=="object"&&r!==null,function(){return "update(): You provided an invalid spec to update(). The spec and every included key path must be plain objects containing one of the "+("following commands: "+Object.keys(i.commands).join(", ")+".")});var s=e;return Ot(r).forEach(function(a){if(Vt.call(i.commands,a)){var f=e===s;s=i.commands[a](r[a],s,r,e),f&&i.isEquals(s,e)&&(s=e);}else {var m=Xe(e)==="Map"?i.update(e.get(a),r[a]):i.update(e[a],r[a]),c=Xe(s)==="Map"?s.get(a):s[a];(!i.isEquals(m,c)||typeof m=="undefined"&&!Vt.call(e,a))&&(s===e&&(s=Je(e)),Xe(s)==="Map"?s.set(a,m):s[a]=m);}}),s},t})();We.Context=Wn;var Mr={$push:function(t,e,n){return Un(e,n,"$push"),t.length?e.concat(t):e},$unshift:function(t,e,n){return Un(e,n,"$unshift"),t.length?t.concat(e):e},$splice:function(t,e,n,i){return Br(e,n),t.forEach(function(r){$n(r),e===i&&r.length&&(e=Je(i)),Er.apply(e,r);}),e},$set:function(t,e,n){return Lr(n),t},$toggle:function(t,e){lt(t,"$toggle");var n=t.length?Je(e):e;return t.forEach(function(i){n[i]=!e[i];}),n},$unset:function(t,e,n,i){return lt(t,"$unset"),t.forEach(function(r){Object.hasOwnProperty.call(e,r)&&(e===i&&(e=Je(i)),delete e[r]);}),e},$add:function(t,e,n,i){return Hn(e,"$add"),lt(t,"$add"),Xe(e)==="Map"?t.forEach(function(r){var s=r[0],a=r[1];e===i&&e.get(s)!==a&&(e=Je(i)),e.set(s,a);}):t.forEach(function(r){e===i&&!e.has(r)&&(e=Je(i)),e.add(r);}),e},$remove:function(t,e,n,i){return Hn(e,"$remove"),lt(t,"$remove"),t.forEach(function(r){e===i&&e.has(r)&&(e=Je(i)),e.delete(r);}),e},$merge:function(t,e,n,i){return _r(e,t),Ot(t).forEach(function(r){t[r]!==e[r]&&(e===i&&(e=Je(i)),e[r]=t[r]);}),e},$apply:function(t,e){return Nr(t),t(e)}},Ut=new Wn;We.isEquals=Ut.update.isEquals;We.extend=Ut.extend;We.default=Ut.update;We.default.default=Gn.exports=yt(We.default,We);function Un(t,e,n){Me(Array.isArray(t),function(){return "update(): expected target of "+_e(n)+" to be an array; got "+_e(t)+"."}),lt(e[n],n);}function lt(t,e){Me(Array.isArray(t),function(){return "update(): expected spec of "+_e(e)+" to be an array; got "+_e(t)+". Did you forget to wrap your parameter in an array?"});}function Br(t,e){Me(Array.isArray(t),function(){return "Expected $splice target to be an array; got "+_e(t)}),$n(e.$splice);}function $n(t){Me(Array.isArray(t),function(){return "update(): expected spec of $splice to be an array of arrays; got "+_e(t)+". Did you forget to wrap your parameters in an array?"});}function Nr(t){Me(typeof t=="function",function(){return "update(): expected spec of $apply to be a function; got "+_e(t)+"."});}function Lr(t){Me(Object.keys(t).length===1,function(){return "Cannot have more than one key in an object with $set"});}function _r(t,e){Me(e&&typeof e=="object",function(){return "update(): $merge expects a spec of type 'object'; got "+_e(e)}),Me(t&&typeof t=="object",function(){return "update(): $merge expects a target of type 'object'; got "+_e(t)});}function Hn(t,e){var n=Xe(t);Me(n==="Map"||n==="Set",function(){return "update(): "+_e(e)+" expects a target of type Set or Map; got "+_e(n)});}});var wr=b(zn());var Jn=withTranslation()(memo(function(e){let{id:n,tabId:i,panelId:r,context:s,methodProvider:a,widgetsState:f}=e,m=a.findRowItem(i,r,n);return Te__default.createElement("div",{className:"row-container"},(m.item._children||[]).map(({rowId:c,id:w,component:F,properties:p})=>Te__default.createElement(Ae.getFormComponent(F,p),{key:"key_"+w,tabId:i,panelId:r,rowId:c,segmentId:w,properties:p,widgetsState:f,methodProvider:a,context:{...s},segmentsCount:m.item._children.length},null)))}));Jn.displayName="_Rowcontainer";var jn=Jn;var Qn=withTranslation()(memo(function(e){let{tabId:n,panelId:i,rowId:r,segmentId:s,segmentsCount:a,properties:f,methodProvider:m,context:c,widgetsState:w}=e,F=m.findSegmentItem(n,i,r,s),p={...f.style};return Te__default.createElement("div",{className:"rowSegment",style:p},(F.item._children||[]).map(({id:d,component:u,properties:g})=>{let b=g.groupname?g.groupname:g.name;return Te__default.createElement(Ae.getFormComponent(u,g),{key:"key_"+d,context:{params:c.params,displayButtonLoader:c.displayButtonLoader,doValidateForm:c.doValidateForm,redrawComponent:c.redrawComponent,formDimension:c.formDimension,segmentDimensions:{minWidth:parseInt(p.minWidth)},tabIndex:c.tabIndex,formData:u.displayName==="_Fileuploader"||u.displayName==="_Label"||u.displayName==="_View"||u.displayName==="_Textinput"&&g.inputtype==="currency"?c.formData:[]},id:d,methodProvider:m,panelId:i,properties:{...g,visible:w!==void 0&&w.visibility[b]!==void 0?w.visibility[b]:g.visible,readonly:w!==void 0&&w.readonly[b]!==void 0?w.readonly[b]:g.readonly},rowId:r,segmentId:s,segmentsCount:a,tabId:n,value:c.formData!==void 0?c.formData[b]:void 0,fieldAllowedValues:c!=null&&c.fieldAllowedValues?c.fieldAllowedValues[b]:void 0,validationMessage:c!=null&&c.formValidationData&&c.formValidationData[b]!==void 0?c.formValidationData[b]:null},null)}))}));Qn.displayName="_Rowsegment";var Kn=Qn;function jr(t,e){return {id:t,value:e}}var Zn=withTranslation()(memo(function(e){var O;let n=useRef(null),{datalength:i,id:r,forcereadonly:s,ignorereadonly:a,label:f,name:m$1,onchangehandler:c,placeholder:w,readonly:F,regex:p,searchbar:d,size:u,style:g,tabIndex:b,uppercasemode:h,variant:S,visible:y}=e.properties,D=useLocation(),{viewPort:V}=b$1(),{tabId:M}=e,[C,T]=useState(String((O=e.value)!=null?O:"")),[v,J]=Te__default.useState([]),Z=!!(C.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{var R;T(String((R=e.value)!=null?R:""));},[e.value]),useEffect(()=>{let R=[];if(e.fieldAllowedValues){for(let U in e.fieldAllowedValues)R.push(jr(U,e.fieldAllowedValues[U]));J(R);}},[e.fieldAllowedValues]);let ee=R=>{var U;e.methodProvider.eventDispatcher({widgetName:m$1,widgetValue:R,widgetEvent:c?Q.onChange:null,widgetContext:JSON.stringify({referer:D.pathname,parentWidgetId:M,hasParentForm:P.hasParentForm(),originator:(U=e.context.params)==null?void 0:U.originator})});},x=R=>{T(R);};return jsx(m,{autoFocus:false,data:v,disabled:!!(F&&!a),error:Z,helperText:Z?e.validationMessage:"",id:r,inputProps:{id:r,tabIndex:b,style:{...g},autoComplete:nanoid(5)},InputProps:{},inputRef:n,label:f,maxCharCount:i,name:m$1,onBlur:R=>{ee(R.target.value);},onInput:R=>{x(R.target.value),V.isMobileDevice&&ee(R.currentTarget.value);},onChange:R=>{C.trim()===""&&ee(R.target.value);},placeholder:w,readOnly:!!(F&&!a),regEx:p,searchBar:d,size:u!=null?u:"small",type:"text",inputtype:e.properties.inputType,toUpperCase:h,value:C,variant:S,visible:y})}));Zn.displayName="_Input";var ea=Zn;var oa=withTranslation()(memo(function(e){var R;let n=useRef(null),{datalength:i,id:r,forcereadonly:s,ignorereadonly:a,label:f,name:m$1,onchangehandler:c,placeholder:w,readonly:F,regex:p,size:d,style:u,tabIndex:g,uppercasemode:b,variant:h,visible:S}=e.properties,y=useLocation(),{viewPort:D}=b$1(),{tabId:V}=e,[M,C]=useState(String((R=e.value)!=null?R:"")),T=!!(M.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm),[v,J]=useState(false),{t:Z}=useTranslation(),ee=()=>{navigator.clipboard.writeText(M).then(()=>{J(true),setTimeout(()=>J(false),2e4);});};useEffect(()=>{var U;C(String((U=e.value)!=null?U:""));},[e.value]);let x=U=>{var j;e.methodProvider.eventDispatcher({widgetName:m$1,widgetValue:U,widgetEvent:c?Q.onChange:null,widgetContext:JSON.stringify({referer:y.pathname,parentWidgetId:V,hasParentForm:P.hasParentForm(),originator:(j=e.context.params)==null?void 0:j.originator})});},O=U=>{C(U);};return jsxs(rr,{display:"flex",alignItems:"flex-start",gap:0,children:[jsx(m,{autoFocus:false,disabled:!!(F&&!a),error:T,helperText:T?e.validationMessage:"",id:r,inputProps:{id:r,tabIndex:g,style:{...u},autoComplete:nanoid(5)},InputProps:{},inputRef:n,label:f,maxCharCount:i,name:m$1,onBlur:U=>{x(U.target.value);},onInput:U=>{O(U.target.value),D.isMobileDevice&&x(U.currentTarget.value);},onChange:U=>{M.trim()===""&&x(U.target.value);},placeholder:w,readOnly:!!(F&&!a),regEx:p,size:d,type:"text",inputtype:e.properties.inputType,toUpperCase:b,value:M,variant:h,visible:S}),S&&jsx(ri,{title:Z(v?"copied!":"copy to clipboard"),children:jsx(ai,{variant:"contained",style:{backgroundColor:"#C0C0C0",borderRadius:"0px 4px 4px 0px",boxShadow:"none",marginLeft:"-3px",border:"2px solid #C0C0C0",lineHeight:"24px",fontSize:"11px"},onClick:ee,startIcon:jsx(j,{}),children:Z("copy")})})]})}));oa.displayName="_InputWCopy";var na=oa;var ra=withTranslation()(memo(function(e){useRef(null);let {tabId:i,id:r,context:s,widgetsState:a}=e,f=e.methodProvider.findWidgetItem(r),m=e.methodProvider.getActiveTabIndex(i,r),c=(p,d,u,g)=>{d||(p.target.style.background=g,p.target.style.color=u);},w$1=(p,d,u,g)=>{d||(p.target.style.background=g,p.target.style.color=u);},F=({children:p,...d})=>jsx(w,{onPointerUp:u=>u.stopPropagation(),onMouseOver:u=>c(u,d.selected,d.item_active_color,d.item_active_background_color),onMouseOut:u=>w$1(u,d.selected,d.item_default_color,d.item_default_background_color),style:{borderRadius:"5px 5px 0 0",marginRight:"1px",color:d.selected?d.item_active_color:d.item_default_color,background:d.selected?d.item_active_background_color:d.item_default_background_color,fontSize:d.item_fontsize,fontWeight:d.item_fontweight},selected:d.selected,children:p},d.id);return F.tabsRole="Tab",e.properties.visible?Te__default.createElement("div",{className:"form-tab-widget"},jsxs(u,{selectedIndex:m,onSelect:p=>e.methodProvider.setActiveTabIndex(i,r,p),children:[jsx(v,{children:(f.item._children||[]).map(({properties:p},d)=>!p.item_visible||a&&a.visibility&&a.visibility[p.item_name]===false?null:createElement(F,{...f.item.properties.tabsetup,...p,key:"TabCaptionComponent_"+r+"_"+d},p.item_title))}),(f.item._children||[]).map(({_children:p},d)=>jsx(x,{children:(p||[]).map(({tabId:u,panelId:g,id:b,type:h,component:S,properties:y},D)=>Te__default.createElement(Ae.getFormComponent(S,y),{key:"tabSubPanel_"+D,id:b,tabId:u,panelId:g,properties:{...y,visible:a!==void 0&&a.visibility[y.name]!==void 0?a.visibility[y.name]:y.visible,readonly:a!==void 0&&a.readonly[y.name]!==void 0?a.readonly[y.name]:y.readonly},className:h,widgetsState:a,methodProvider:e.methodProvider,context:{...s},segmentsCount:f.item._children.length,fieldAllowedValues:s!=null&&s.fieldAllowedValues?s.fieldAllowedValues[y.name]:void 0},null))},"TabPanel_"+r+"_"+d))]})):null}));ra.displayName="_TabBox";var ia=ra;function pi(t,e){if(!e||Array.isArray(e)&&e.length===0)return t;let n=e;return t.replace(/<b>@(\w+)<\/b>|@(\w+)/g,(i,r,s)=>{let a=(r||s).toLowerCase(),f=n[a];return typeof f=="string"?r?`<b>${f}</b>`:f:i})}var da=withTranslation()(memo(function(e){let{title:n,style:i,verticalalign:r,visible:s}=e.properties,a={paddingTop:"0px"};if(r==="bottom"&&(a.paddingTop="10px"),!s)return null;let f=pi(n,e.context.formData);return jsx("div",{style:{...i,...a},children:jsx("div",{style:{...i},dangerouslySetInnerHTML:{__html:f}})})}));da.displayName="_Label";var sa=da;var ua=withTranslation()(memo(function(e){let n=useRef(null),{defaultvalue:i,id:r,ignorereadonly:s,label:a,labelplacement:f,name:m,onchangehandler:c,readonly:w,style:F,tabIndex:p,visible:d$1}=e.properties,u=m,g=e.value||"",b=useLocation(),{tabId:h}=e,S=!!(!g&&e.validationMessage!=null&&e.context.doValidateForm);return useEffect(()=>{!e.value&&i&&e.methodProvider.eventDispatcher({widgetName:u,widgetValue:e.properties.value,widgetEvent:null,widgetContext:JSON.stringify({referer:b.pathname,parentWidgetId:h,hasParentForm:P.hasParentForm()})});},[]),jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:F.textAlign,height:"100%"},children:jsx(d,{checkedIcon:void 0,defaultChecked:!!(e.value===void 0&&i),disabled:!!(w&&!s),error:S,helperText:S?e.validationMessage:"",icon:void 0,inputProps:{id:r,tabIndex:p},inputRef:n,labelText:a,labelPlacement:f,name:u,onChange:y=>{e.methodProvider.eventDispatcher({widgetName:u,widgetValue:y.target.checked?e.properties.value:"",widgetEvent:c?Q.onChange:null,widgetContext:JSON.stringify({referer:b.pathname,parentWidgetId:h,hasParentForm:P.hasParentForm()})});},selectedValue:g,value:e.properties.value,visible:d$1})})}));ua.displayName="_Checkbox";var ca=ua;var pa=withTranslation()(memo(function(e){let n=useRef(null),{defaultvalue:i,groupname:r,id:s,ignorereadonly:a,label:f,labelplacement:m,name:c,onchangehandler:w,readonly:F,style:p,tabIndex:d,visible:u}=e.properties,g=useLocation(),{tabId:b}=e;useEffect(()=>{!y&&i&&V(e.properties.value);},[]);let h=r||c;let y=e.value||"",D=!!(e.validationMessage!=null&&e.context.doValidateForm),V=M=>{var C;e.methodProvider.eventDispatcher({widgetName:h,widgetValue:M,widgetEvent:w?Q.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:b,hasParentForm:P.hasParentForm(),originator:(C=e.context.params)==null?void 0:C.originator})});};return jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:p.textAlign,height:"100%"},children:jsx(j$1,{defaultValue:i?e.properties.value:"",disabled:!!(F&&!a),inputProps:{id:s,tabIndex:d,style:{...p}},error:D,helperText:D?e.validationMessage:"",inputRef:n,labelText:f,labelPlacement:m,name:h,onChange:M=>{y!==M.target.value.trim()&&V(M.target.value);},selectedValue:y,value:e.properties.value,visible:u})})}));pa.displayName="_Radio";var ga=pa;var ha=withTranslation()(memo(function(e){var ee;let n=useRef(null),{runFormEvent:i,viewPort:r}=b$1(),{id:s,autocompleteTextArea:a,ignorereadonly:f,label:m$1,name:c,onchangehandler:w,placeholder:F,required:p,requiredmessage:d,readonly:u,size:g,style:b,tabIndex:h,variant:S,visible:y}=e.properties,D=useLocation(),{tabId:V}=e,[M,C]=useState(String((ee=e.value)!=null?ee:""));useEffect(()=>{var x;C(String((x=e.value)!=null?x:""));},[e.value]);let T=!!(M.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm),v=x=>{var O;e.methodProvider.eventDispatcher({widgetName:c,widgetValue:x,widgetEvent:w?Q.onChange:null,widgetContext:JSON.stringify({referer:D.pathname,parentWidgetId:V,hasParentForm:P.hasParentForm(),originator:(O=e.context.params)==null?void 0:O.originator})});},J=async x=>{var O,R,U;try{let j=await i({pluginCode:e.context.params.pluginCode,formCode:e.context.params.formCode,guid:e.context.params.guid,projectGuid:e.context.params.pGuid,pGuid:e.context.params.pGuid,formData:(O=e.context.formData)!=null?O:{},widgetContext:JSON.stringify({}),widgetEvent:Q.onGetCustomResponse,widgetName:c,widgetValue:JSON.stringify({methodName:"getAutoCompleteData",value:x})});if(((R=j.meta)==null?void 0:R.requestStatus)==="fulfilled"){let N=j.payload,E=(U=N==null?void 0:N.FECommand)==null?void 0:U.CustomResponse;if(Array.isArray(E))return E.filter($=>typeof $=="string").map($=>({label:$}))}}catch(j){}return []},Z=x=>{C(x);};return jsx(m,{autocompleteTextArea:a,autoFocus:false,disabled:!!(u&&!f),id:s,inputProps:{id:s,tabIndex:h,readOnly:!!(u&&!f),style:{...b}},error:T,helperText:T?e.validationMessage:"",InputProps:{},inputRef:n,label:m$1,multiline:true,name:c,onAutoCompleteChange:a?x=>J(x):void 0,onBlur:x=>{v(x.target.value);},onInput:x=>{Z(x.target.value),r.isMobileDevice&&v(x.currentTarget.value);},onChange:x=>{M.trim()===""&&v(x.target.value);},placeholder:F,readOnly:!!(u&&!f),size:g,type:"text",value:M,variant:S,visible:y})}));ha.displayName="_Textarea";var ba=ha;function va(t,e){return {id:t,value:e}}var Gt="\xA4",ya=withTranslation()(memo(function(e){var R,U;let n=useRef(null),[i,r]=Te__default.useState(null),[s,a]=Te__default.useState([]),f=typeof e.value=="string"&&e.value!=null&&e.value.length>0?e.value.split(Gt):[],[m,c]=Te__default.useState(f),{id:w,ignorereadonly:F,label:p,multiple:d,name:u,onchangehandler:g,placeholder:b,readonly:h,rendertype:S,searchbar:y,size:D,tabIndex:V,variant:M,visible:C,dropvalues:T}=e.properties,v=useLocation(),{tabId:J}=e,{t:Z}=useTranslation();useEffect(()=>{let j=typeof e.value=="string"&&e.value!=null&&e.value.length>0?e.value.split(Gt):[];c(j);},[e.value]),useEffect(()=>{let j=S==="none"?[{id:"",value:""}]:[];if(T&&Array.isArray(T)&&T.length>0){for(let N of T)typeof N=="object"&&N!==null&&j.push(va(N.id||"",N.value||""));a(j);}else if(e.fieldAllowedValues){for(let N in e.fieldAllowedValues)j.push(va(N,e.fieldAllowedValues[N]));a(j);}},[e.fieldAllowedValues,T]),useEffect(()=>{var j;if(i===false){let N=typeof e.value!="string"?e.value:[];(JSON.stringify(N)!==JSON.stringify(m)||m.length===0)&&e.methodProvider.eventDispatcher({widgetName:u,widgetValue:m.length>0?m.join(Gt):[],widgetEvent:g?Q.onChange:null,widgetContext:JSON.stringify({referer:v.pathname,parentWidgetId:J,hasParentForm:P.hasParentForm(),originator:(j=e.context.params)==null?void 0:j.originator,folderData:e.context.params.folderData})});}},[i]);let ee=j=>{let{target:{value:N}}=j,E;d?E=typeof N=="string"?N.split(","):N:E=typeof N=="string"?[N]:N,c(E);},x=e.context.formDimension.width/e.segmentsCount;x=x<e.context.segmentDimensions.minWidth?e.context.segmentDimensions.minWidth:x-60;let O=!!(m.length===0&&e.validationMessage!=null&&e.context.doValidateForm);return jsx(k,{darkMode:false,data:s,error:O,helperText:O?e.validationMessage:"",inputProps:{tabIndex:V,style:{maxWidth:`${x}px`}},inputRef:n,onOpen:()=>{r(true);},onClose:()=>{r(false);},onChange:ee,id:w,label:p,multiple:d,placeholder:b,readOnly:h&&!F,renderType:S,noOptionsText:(U=(R=e.properties)==null?void 0:R.noOptionsLabel)!=null?U:Z("No options"),searchBar:y,selectDisplayProps:{style:{maxWidth:"100%",whiteSpace:S==="chip"?"normal":"nowrap"}},selectedValue:m,size:D,variant:M,width:"auto",visible:C})}));ya.displayName="_SelectBox";var wa=ya;var Ca=withTranslation()(memo(function(e){var f;let{style:n,visible:i}=(f=e.properties)!=null?f:{},[r,s]=useState(false);if(useEffect(()=>{s(true);},[]),!r)return null;let a="form-widget form-placeholder-widget";return i||(a+=" visibilityOff"),jsx("div",{className:a,style:{...n,display:"flex",alignItems:"center",justifyContent:"center",width:"100%",textAlign:"center"}})}));Ca.displayName="_Placeholder";var xa=Ca;var Ia=createContext({});function Fa(){return useContext(Ia)}var Ta=Ia;var el=lazy(()=>import('./fileviewer-N5Z4NUU6.js'));function tl(){let[,t]=useState(0);return ()=>t(e=>e+1)}var Ra=withTranslation()(memo(function(e){var we,ge;tl();let [i,r]=useState([]),[s,a]=useState(e.context.params),[f$1,m]=useState(false),[c,w]=useState(null),[F,p]=useState(false),[d,u]=useState(null),[g$1,b]=useState(0),{t:h}=useTranslation(),{iframeMode:S}=g(),y=Fa(),D=H=>{var Q;return (Q=y[H])!=null?Q:h(H)},{UserDialog:V}=b$2(),M=f(),{style:C,readonly:T,visible:v}=e.properties,[J,Z]=useState({showDialog:false,dialogTitle:"",dialogContent:"",buttonAgree:"",buttonDisagree:"",callBackFunc:()=>{}}),{appSettings:ee,viewPort:x,runFormDeleteFileEvent:O,runFormDownloadFileEvent:R,runFormGetLinkedFileEvent:U,runFormGetLinkedFileMetaEvent:j,runFormUploadFiles:N}=b$1();useEffect(()=>{a(e.context.params);},[e.context.params]),useEffect(()=>{let H=e.value?JSON.parse(e.value):[];return H&&(r(E(H,100)),m(true)),()=>{i&&(m(false),i.forEach(Q=>{Q.preview&&URL.revokeObjectURL(Q.preview);}));}},[]);let E=(H,Q)=>{let k=[];return H.forEach((G,o)=>{let te=new File([],G,{type:"image/jpeg"});Object.assign(te,{preview:null,uploadProgress:Q}),k.push(te);}),k},$=useCallback(async H=>{var ie;let k=(await j({...s,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:H,context:{action:"Preview"}})).payload,{linkedFileSize:G,linkedFileName:o,mimeType:te}=k;if(!G)throw new Error("File data or metadata is missing");let oe=(ie=ee==null?void 0:ee.MAX_DOWNLOAD_NOCHUNK_FILESIZE)!=null?ie:b$3.MAX_DOWNLOAD_NOCHUNK_FILESIZE;return G>oe?{type:"formbuilder/getlinkedfile",payload:{linkedFile:null,linkedFileSize:G,linkedFileName:o},meta:{requestStatus:"fulfilled"}}:await U({...s,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:H,context:{action:"Load"}})},[s,e.context.params.pGuid,e.properties.name]),re=H=>{J.callBackFunc(H);},pe=async(H,Q)=>{H&&await O({...e.context.params,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:Q}).then(k=>{if(k.meta.requestStatus==="fulfilled"){let G={...k.payload};G.linkedFileDeleteSuccess&&(M({toastID:nanoid(11),msg:D("The file has been successfully deleted"),clearQueue:false,hideProgressBar:false}),r(o=>o.filter(te=>te.name!==Q)),e.methodProvider.eventDispatcher({widgetName:e.properties.name,widgetValue:JSON.stringify(G.linkedFiles),widgetEvent:null,widgetContext:null}));}}),Z({...J,showDialog:false,callBackFunc:k=>{}});},ye=async H=>{if(H)try{let Q=await R({...e.context.params,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:H}),k=new Blob([Q]),G=window.URL.createObjectURL(k),o=document.createElement("a");o.href=G,o.setAttribute("download",H.split("/").pop()||"downloadedFile"),document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(G);}catch(Q){}},se=useCallback(async(H,Q)=>(Q&&Z({showDialog:true,dialogTitle:D("Confirmation"),dialogContent:D("Are you sure you want to delete file?"),buttonAgree:D("Continue"),buttonDisagree:D("Close"),callBackFunc:k=>pe(k,Q)}),null),[e.context.params,h]),_=useCallback(async(H,Q)=>(Q&&ye(Q),null),[e.context.params]),ue=useCallback((H,Q)=>{Q&&startTransition(()=>{w(Q);});},[]),Y=()=>{w(null);},ce=useCallback(async(H,Q$1)=>{var k,G;if(H){let o=new FormData;for(let ie in e.context.params)e.context.params.hasOwnProperty(ie)&&o.append(ie,e.context.params[ie]);o.append("fieldName",e.properties.name),H.forEach(ie=>{o.append("files",ie);}),o.append("widgetContext",JSON.stringify({hasParentForm:P.hasParentForm(),originator:(k=e.context.params)==null?void 0:k.originator,folderData:(G=e.context.params)==null?void 0:G.folderData})),o.append("widgetEvent",Q.onFileUploadEvent),o.append("widgetName",e.properties.name),o.append("formData",JSON.stringify({...e.context.formData}));let te=zi.CancelToken.source(),oe=H.map(ie=>Object.assign(ie,{preview:URL.createObjectURL(ie),uploadProgress:0}));r(i.concat(oe)),u(0),await N({content:o,cancelTokenSource:te,onUploadProgress:ie=>{let Ne=ie.total?Math.round(ie.loaded*100/ie.total):0;u(Ne);}}).then(ie=>{var Ge,Ye,Ve;let Ne=[];if(ie.meta.requestStatus==="fulfilled"){let Ce={...ie.payload};if((Ge=Ce.FECommand)!=null&&Ge.FormValidationData&&Object.keys(Ce.FECommand.FormValidationData).length>0){oe.forEach(xe=>{xe.preview&&URL.revokeObjectURL(xe.preview);}),u(null),b(xe=>xe+1);let tt=i.filter(xe=>xe.uploadProgress===100);r(tt),e.methodProvider.eventDispatcher({widgetName:e.properties.name,widgetValue:JSON.stringify(i),widgetEvent:null,widgetContext:null,feCommand:Ce.FECommand});}else if(Ce.linkedFiles&&e.properties.name){Ne=E(Ce.linkedFiles,100);let tt=Ne.map(xe=>{let rt=xe;return rt.uploadProgress=100,rt.preview=null,rt});oe.forEach(xe=>{xe.preview&&URL.revokeObjectURL(xe.preview);}),u(null),b(xe=>xe+1),r(tt),a({...e.context.params,guid:(Ve=(Ye=Ce.FECommand)==null?void 0:Ye.ReplaceContextRecordGuid)==null?void 0:Ve.guid}),Ce.FECommand={...Ce.FECommand,UpdateFieldAllowedValues:Ce.fieldAllowedValues,UpdateFormData:Ce.data},e.methodProvider.execCommands(Ce.FECommand);}}});}},[i,e.context.params,e.methodProvider,e.properties.name,e.value]);return !f$1||!v?null:jsxs("div",{style:{...C,lineHeight:"1.1em"},children:[jsx(V,{...J,handleDialogClose:re}),jsxs("div",{style:{position:"relative",zIndex:1,isolation:"isolate"},children:[S&&jsx("div",{style:{position:"absolute",inset:0,zIndex:10,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255,255,255,0.85)",borderRadius:4,padding:"8px 16px",textAlign:"center",fontSize:"0.875rem",color:"#555"},children:h("File upload is available only when using the SDK")}),jsx(o,{defaultText:(ge=(we=e.properties)==null?void 0:we.dragDropLabel)!=null?ge:D("Drag and Drop..."),tryGetLinkedFile:$,onDeleteButtonPress:se,onDownloadButtonPress:_,onDownloadText:D("Download"),onDeleteText:D("Delete"),filesData:i,onDragText:"On drop text",onFilesDrop:ce,onPreviewButtonPress:ue,isMobileDevice:x.isMobileDevice,isReadonly:T},g$1),d!==null&&jsx(Zi,{variant:"determinate",value:d,style:{marginTop:6,borderRadius:3,height:8}})]}),c!=null&&jsx(Suspense,{fallback:jsx(Xi,{}),children:jsx(el,{fileId:c,fileBase64:null,fieldName:e.properties.name,params:{...e.context.params,modalCloseFn:Y}},nanoid(11))})]})}));Ra.displayName="_Fileuploader";var Ea=Ra;var ka=(t,e)=>"#"+t.replace(/^#/,"").replace(/../g,n=>("0"+Math.min(255,Math.max(0,parseInt(n,16)+e)).toString(16)).substring(-2)),Ba=withTranslation()(memo(function(e){var h,S;let{buttontype:n$1,colorSchema:i,fullWidth:r,name:s,style:a,tabIndex:f,title:m,variant:c,visible:w}=e.properties,F=useLocation(),{tabId:p}=e,d=(S=(h=e.context)==null?void 0:h.displayButtonLoader)!=null?S:false;if(!w)return null;let u=a.backgroundColor,g=u?ka(u,-50):"";i&&(u=i+".main",g=i+".hover");let b={};return c==="outlined"?(Object.assign(b,{"&.MuiButtonBase-root":{fontSize:a.fontSize,fontWeight:a.fontWeight,border:"1px solid"+u,cursor:"pointer"}}),Object.assign(b,{"&.MuiButtonBase-root:hover":{border:g?"1px solid"+ka(g,-50):""}})):(Object.assign(b,{"&.MuiButtonBase-root":{fontSize:a.fontSize,fontWeight:a.fontWeight,backgroundColor:u,cursor:"pointer"}}),Object.assign(b,{"&.MuiButtonBase-root:hover":{backgroundColor:g}})),jsx("div",{children:jsx(n,{variant:c,label:m,loading:d,onPointerUp:()=>{var y,D;e.methodProvider.eventDispatcher({widgetName:s,widgetValue:null,widgetEvent:Q.getFormButtonEvent(n$1),widgetContext:JSON.stringify({referer:F.pathname,parentWidgetId:p,hasParentForm:P.hasParentForm(),originator:(y=e.context.params)==null?void 0:y.originator,parent:{widgetName:s,params:{pGuid:e.context.params.pGuid,pluginCode:e.context.params.pluginCode,formCode:e.context.params.formCode,guid:e.context.params.guid}},folderData:(D=e.context.params)==null?void 0:D.folderData})});},fullWidth:r,sx:b,tabIndex:f})})}));Ba.displayName="_Button";var Na=Ba;var zt=b(a$1()),La=b(vt());zt.default.extend(La.default);var _a=withTranslation()(memo(function(e$1){var D,V,M;let n=useRef(null),{id:i,ignorereadonly:r,defaultvalue:s,dateformat:a,label:f,name:m,onchangehandler:c,readonly:w,size:F,tabIndex:p,variant:d,visible:u}=e$1.properties,g=useLocation(),{tabId:b}=e$1,h=!!(!e$1.value&&e$1.validationMessage!=null&&e$1.context.doValidateForm),S=C=>{var T;return e$1.methodProvider.eventDispatcher({widgetName:m,widgetValue:C!=null?C:"",widgetEvent:c?Q.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:b,hasParentForm:P.hasParentForm(),originator:(T=e$1.context.params)==null?void 0:T.originator})})},y=(V=(D=e$1==null?void 0:e$1.i18n)==null?void 0:D.language)==null?void 0:V.substr(0,2);return jsx(e,{id:i,defaultvalue:s,disabled:!!(w&&!r),error:h,format:a!==void 0&&a!==""&&a!=null?a:void 0,helperText:h?e$1.validationMessage:"",inputRef:n,label:f,locale:y,name:m,onBlur:C=>{S(C?(0, zt.default)(C).utc().format():null);},size:F,type:"datepicker",value:(M=e$1.value)!=null?M:"",variant:d,visible:u})}));_a.displayName="_Textinput";var Aa=_a;var st=b(a$1()),Oa=b(vt());st.default.extend(Oa.default);var Ua=withTranslation()(memo(function(e){var M,C,T;let n=useRef(null),{id:i,ignorereadonly:r,defaultvalue:s,dateformat:a,label:f,name:m,onchangehandler:c,readonly:w,size:F,tabIndex:p,variant:d,visible:u}=e.properties,g=useLocation(),{tabId:b}=e,[h,S]=useState(String((M=e.value)!=null?M:"")),y=!!(!h&&e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{var v;S(String((v=e.value)!=null?v:""));},[e.value]);let D=v=>{var J;return S(v),e.methodProvider.eventDispatcher({widgetName:m,widgetValue:v!=null?v:"",widgetEvent:c?Q.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:b,hasParentForm:P.hasParentForm(),originator:(J=e.context.params)==null?void 0:J.originator})})};useEffect(()=>{if(!e.value&&s){let v=s==="now"?(0, st.default)().utc().format():s==="start of day"?(0, st.default)().startOf("day").utc().format():null;v&&D(v);}},[]);let V=(T=(C=e==null?void 0:e.i18n)==null?void 0:C.language)==null?void 0:T.substr(0,2);return jsx(f$1,{autoFocus:false,defaultvalue:s,disabled:!!(w&&!r),error:y,format:a!==void 0&&a!==""&&a!=null?a:void 0,helperText:y?e.validationMessage:"",id:i,inputRef:n,label:f,locale:V,name:m,onChange:v=>{D(v?(0, st.default)(v).utc().format():null);},size:F,value:h,variant:d,visible:u})}));Ua.displayName="_Textinput";var Ha=Ua;var qt=b(a$1()),Wa=b(vt());qt.default.extend(Wa.default);var $a=withTranslation()(memo(function(e){var D,V,M;let n=useRef(null),{id:i,ignorereadonly:r,defaultvalue:s,dateformat:a,label:f,name:m,onchangehandler:c,readonly:w,size:F,tabIndex:p,variant:d,visible:u}=e.properties,g=useLocation(),{tabId:b}=e,h=!!(!e.value&&e.validationMessage!=null&&e.context.doValidateForm),S=C=>{var T;return e.methodProvider.eventDispatcher({widgetName:m,widgetValue:C!=null?C:"",widgetEvent:c?Q.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:b,hasParentForm:P.hasParentForm(),originator:(T=e.context.params)==null?void 0:T.originator})})},y=(V=(D=e==null?void 0:e.i18n)==null?void 0:D.language)==null?void 0:V.substr(0,2);return jsx(g$1,{id:i,defaultvalue:s,disabled:!!(w&&!r),error:h,format:a!==void 0&&a!==""&&a!=null?a:void 0,helperText:h?e.validationMessage:"",inputRef:n,label:f,locale:y,name:m,onBlur:C=>{S(C?(0, qt.default)(C).utc().format():null);},size:F,type:"datetimepicker",value:(M=e.value)!=null?M:"",variant:d,visible:u})}));$a.displayName="_Textinput";var Ga=$a;var za=withTranslation()(memo(function(e){var ee;let n=useRef(null),{datalength:i,id:r,forcereadonly:s,ignorereadonly:a,label:f,name:m$1,onchangehandler:c,placeholder:w,phoneformat:F,readonly:p,regex:d,size:u,style:g,tabIndex:b,uppercasemode:h,variant:S,visible:y}=e.properties,D=useLocation(),{viewPort:V}=b$1(),{tabId:M}=e,[C,T]=useState(String((ee=e.value)!=null?ee:"")),v=!!(e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{e.value!==void 0&&e.value!==null&&T(String(e.value));},[e.value]);let J=x=>{var O;e.methodProvider.eventDispatcher({widgetName:m$1,widgetValue:x,widgetEvent:c?Q.onChange:null,widgetContext:JSON.stringify({referer:D.pathname,parentWidgetId:M,hasParentForm:P.hasParentForm(),originator:(O=e.context.params)==null?void 0:O.originator})});},Z=x=>{T(x);};return jsx(m,{autoFocus:false,disabled:!!(p&&!a),error:v,helperText:v?e.validationMessage:"",id:r,inputProps:{id:r,tabIndex:b,style:{...g}},InputProps:{},inputRef:n,label:f,maxCharCount:i,name:m$1,onBlur:x=>{J(x.target.value);},onInput:x=>{Z(x.target.value),V.isMobileDevice&&J(x.currentTarget.value);},placeholder:w,phoneFormat:F||void 0,readOnly:!!(p&&!a),regEx:d,size:u!=null?u:"small",type:F?"phone":"text",toUpperCase:h,value:C,variant:S,visible:y})}));za.displayName="_PhoneInput";var qa=za;var Ya=withTranslation()(memo(function(e){var ue;let n=useRef(null),{t:i,i18n:r}=useTranslation(),s=r==null?void 0:r.language,{currency_format:a,currency_assymbol:f,currency_currencydisplay:m$1,currency_fixedlocale:c,datalength:w,id:F,ignorereadonly:p,label:d,name:u,onchangehandler:g,placeholder:b,readonly:h,regex:S,size:y,style:D,tabIndex:V,uppercasemode:M,variant:C,visible:T}=e.properties,v=useLocation(),{viewPort:J}=b$1(),{tabId:Z}=e,[ee,x]=useState(String((ue=e.value)!=null?ue:"0")),[O,R]=useState(false),[U,j]=useState(0),N=useRef(0);useEffect(()=>{var Y;x(String((Y=e.value)!=null?Y:"0"));},[e.value]),useEffect(()=>{e.validationMessage!=null&&(N.current+=1,R(false));},[e.context.formValidationData]);let E=!!(!O&&e.validationMessage!=null&&e.context.doValidateForm),$=Y=>{var ce;e.methodProvider.eventDispatcher({widgetName:u,widgetValue:Y,widgetEvent:g?Q.onChange:null,widgetContext:JSON.stringify({referer:v.pathname,parentWidgetId:Z,hasParentForm:P.hasParentForm(),originator:(ce=e.context.params)==null?void 0:ce.originator})});},re=Y=>{x(Y);},pe=a==="fixed-locale"&&c?c:s,ye=()=>{var we;if(m$1==="")return "";let Y=e.context.formData,ce=e.properties.currency_inputfield;return ce&&(Y!=null&&Y[ce])?Y[ce]:e.properties.currency_currency?e.properties.currency_currency:(a==="locale"||a==="fixed-locale")&&(we=g$3(pe!=null?pe:""))!=null?we:""},se=m$1==="symbol"?true:m$1==="code"?false:f!=null?f:false,_=a==="locale"||a==="fixed-locale"?"locale":a!=null?a:"";return jsx(m,{autoFocus:false,currency:ye(),disabled:!!(h&&!p),error:E,helperText:E?e.validationMessage:"",id:F,inputProps:{id:F,tabIndex:V,style:{...D,textAlign:"right"}},InputProps:{},inputRef:n,label:d,locale:pe,maxCharCount:w,name:u,onBlur:Y=>{R(true);let ce=Y.target.value;(ce==="0"||ce==="")&&j(we=>we+1),$(ce);},onInput:Y=>{re(Y.target.value),J.isMobileDevice&&$(Y.currentTarget.value);},onChange:Y=>{ee.trim()===""&&$(Y.target.value);},placeholder:b,readOnly:!!(h&&!p),regEx:S,size:y,type:"currency",toUpperCase:M,value:ee,variant:C,visible:T,format:_,assymbol:se},U)}));Ya.displayName="_CurrencyInput";var Qa=Ya;var Xa=withTranslation()(memo(function(e){var j,N;let n=useRef(null),{t:i,i18n:r}=useTranslation(),s=(j=r==null?void 0:r.language)==null?void 0:j.substring(0,2),{datalength:a,id:f,forcereadonly:m$1,ignorereadonly:c,label:w,name:F,onchangehandler:p,placeholder:d,readonly:u,regex:g,size:b,style:h,tabIndex:S,uppercasemode:y,variant:D,visible:V}=e.properties,[M,C]=useState(false),{viewPort:T}=b$1(),v=useLocation(),{tabId:J}=e,[Z,ee]=useState(String((N=e.value)!=null?N:"")),x=!!(Z.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{var E;ee(String((E=e.value)!=null?E:""));},[e.value]);let O=()=>{C(E=>!E);},R=E=>{var $;e.methodProvider.eventDispatcher({widgetName:F,widgetValue:E,widgetEvent:p?Q.onChange:null,widgetContext:JSON.stringify({referer:v.pathname,parentWidgetId:J,hasParentForm:P.hasParentForm(),originator:($=e.context.params)==null?void 0:$.originator})});},U=E=>{ee(E);};return jsx(m,{autoFocus:false,disabled:!!(u&&!c),error:x,helperText:x?e.validationMessage:"",id:f,inputProps:{id:f,tabIndex:S,style:{...h,textAlign:"center"}},InputProps:{endAdornment:jsx(Ul,{position:"end",children:jsx(vr,{onClick:O,edge:"end",children:M?jsx(Hl,{}):jsx(Wl,{})})})},inputRef:n,label:w,locale:s,maxCharCount:a,name:F,onBlur:E=>{R(E.target.value);},onInput:E=>{U(E.target.value),T.isMobileDevice&&R(E.currentTarget.value);},onChange:E=>{Z.trim()===""&&R(E.target.value);},placeholder:d,readOnly:!!(u&&!c),regEx:g,size:b,type:"text",toUpperCase:y,value:Z,variant:D,visible:V,inputtype:M?"text":"password"})}));Xa.displayName="_PasswordInput";var Za=Xa;var or=styled(TreeItem2Root)(({theme:t})=>({color:t.palette.mode==="light"?t.palette.grey[800]:t.palette.grey[400],position:"relative",[`& .${treeItemClasses.groupTransition}`]:{marginLeft:t.spacing(3.5)}})),ld=styled(TreeItem2Content)(({theme:t})=>({borderRadius:t.spacing(.3),marginBottom:t.spacing(.5),marginTop:t.spacing(.3),padding:t.spacing(.3),paddingRight:t.spacing(.1),fontWeight:500,"&.Mui-expanded ":{"&:not(.Mui-focused, .Mui-selected, .Mui-selected.Mui-focused) .labelIcon":{color:t.palette.mode==="light"?t.palette.primary.main:t.palette.primary.dark},"&::before":{content:'""',display:"block",position:"absolute",left:"16px",top:"34px",height:"calc(100% - 36px)",width:"1.5px",backgroundColor:t.palette.mode==="light"?t.palette.grey[300]:t.palette.grey[700]}},"&:hover":{backgroundColor:alpha(t.palette.primary.main,.1),color:t.palette.mode==="light"?t.palette.primary.main:"white"},"&.Mui-focused, &.Mui-selected, &.Mui-selected.Mui-focused":{backgroundColor:t.palette.mode==="light"?t.palette.primary.main:t.palette.primary.dark,color:t.palette.primary.contrastText,fontWeight:700}})),dd=styled(TreeItem2Content)(({theme:t})=>({borderRadius:t.spacing(.3),marginBottom:t.spacing(.5),marginTop:t.spacing(.3),padding:t.spacing(.3),paddingRight:t.spacing(.1),fontWeight:500,"&.Mui-expanded ":{"&:not(.Mui-focused, .Mui-selected, .Mui-selected.Mui-focused) .labelIcon":{},"&::before":{content:'""',display:"block",position:"absolute",left:"16px",top:"34px",height:"calc(100% - 36px)",width:"1.5px"}}})),sd=animated(ql);function nr(t){let e=useSpring({to:{opacity:t.in?1:0,transform:`translate3d(0,${t.in?0:20}px,0)`}});return jsx(sd,{style:e,...t})}var md=styled(Jl)({color:"inherit",fontWeight:500});function ar({icon:t,expandable:e,children:n,isFirstRootNode:i,...r}){return jsxs(TreeItem2Label,{...r,sx:{display:"flex",alignItems:"center",fontWeight:i?"700":"normal",backgroundColor:"transparent","&.Mui-focused, &.Mui-selected":{backgroundColor:"transparent"}},children:[t&&jsx(rr,{component:t,className:"labelIcon",color:"inherit",sx:{mr:1,fontSize:"1.2rem"}}),jsx(md,{sx:{fontSize:i?"1rem":"0.9rem",fontWeight:i?"700":"normal"},children:n})]})}var lr=t=>Array.isArray(t)?t.length>0&&t.some(lr):!!t,Ft=t=>{let e=null,n=t.action,i=t.applyInternalStyle?{fontSize:"1em",marginRight:"0.5em"}:{};return n==="add"?e=jsx(u$1,{style:i}):n==="edit"?e=jsx(B,{style:i}):n==="share"?e=jsx(F,{style:i}):n==="trash"&&(e=jsx(O,{style:i})),e},ud=Te.forwardRef(function(e,n){let{id:i,itemId:r,label:s,disabled:a,children:f,item:m,index:c,mode:w,setSelectedItem:F,treeCheckedItems:p,properties:d,disableRootItem:u,userData:g,formData:b,deletePrompt:h,selectedItem:S,execCommands:y,eventDispatcher:D,...V}=e,{getRootProps:M,getContentProps:C,getIconContainerProps:T,getCheckboxProps:v,getLabelProps:J,getGroupTransitionProps:Z,getDragAndDropOverlayProps:ee,status:x}=unstable_useTreeItem2({id:i,itemId:r,children:f,label:s,disabled:a,rootRef:n}),O=useLocation(),{t:R}=useTranslation(),[U,j]=Te.useState(null),N=!!U,E=lr(f),$=c===0?void 0:jl,[re,pe]=Te.useState(x.expanded),{runFormEvent:ye}=b$1(),se=useCallback(async(k,G,o,te,oe,ie)=>{var Ne,Ge,Ye;k&&await ye({pluginCode:o.params.pluginCode,formCode:"FOLDER",guid:(Ne=o.params.folderData)==null?void 0:Ne.id,projectGuid:o.params.pGuid,pGuid:o.params.pGuid,widgetContext:JSON.stringify({referer:oe.pathname,parentWidgetId:ie,hasParentForm:P.hasParentForm(),originator:(Ge=o.params)==null?void 0:Ge.originator,parent:o.params,folderData:(Ye=o.params)==null?void 0:Ye.folderData}),widgetEvent:Q.onDelete,widgetName:"delete",formData:o.formData}).then(Ve=>{if(Ve.meta.requestStatus==="fulfilled"){let Ce={...Ve.payload};o.execCommands(Ce.FECommand);}}),o.deletePrompt({delete:{buttonAgree:"",buttonDisagree:"",dialogTitle:"",dialogContent:"",showDialog:false,callBackFunc:()=>{}}});},[e.params.pluginCode,e.params.folderData,e.params.pGuid,e.formData,e.deletePrompt,e.execCommands]),_=k=>{k.stopPropagation(),pe(G=>!G);},ue=k=>{k.stopPropagation(),j(k.currentTarget);},Y=()=>{j(null);},ce=useCallback(()=>{Y();let k="addbtn";return e.eventDispatcher({tabIndex:0,widgetName:k,widgetValue:null,widgetEvent:Q.onFolderCreateRecordEvent,widgetContext:JSON.stringify({referer:O.pathname,parentWidgetId:"",hasParentForm:P.hasParentForm(),parentOriginator:{params:e.params.originator?e.params.originator.params:{}},originator:{params:e.params,widgetName:k},parent:{widgetName:k,params:e.params},isModal:true,folderData:e.params.folderData})})},[Y,O.pathname,e.params,e.eventDispatcher,P.hasParentForm]),we=useCallback(()=>{Y();let k="share";return e.eventDispatcher({tabIndex:0,widgetName:k,widgetValue:null,widgetEvent:Q.onFolderShareRecordEvent,widgetContext:JSON.stringify({referer:O.pathname,parentWidgetId:"",hasParentForm:P.hasParentForm(),parentOriginator:{params:e.params.originator?e.params.originator.params:{}},originator:{params:{...e.params,guid:e.params.folderData.id},widgetName:k},parent:{widgetName:k,params:e.params},isModal:true,folderData:e.params.folderData})})},[e,O.pathname]),ge=useCallback(()=>{Y();let k="edit";return e.eventDispatcher({tabIndex:0,widgetName:k,widgetValue:null,widgetEvent:Q.onFolderEditRecordEvent,widgetContext:JSON.stringify({referer:O.pathname,parentWidgetId:"",hasParentForm:P.hasParentForm(),parentOriginator:{params:e.params.originator?e.params.originator.params:{}},originator:{params:e.params,widgetName:k},parent:{widgetName:k,params:e.params},isModal:true,folderData:e.params.folderData})})},[e,O.pathname]),H=useCallback(async k=>{var G,o;await ye({pluginCode:e.params.pluginCode,formCode:e.params.formCode,guid:e.params.guid,projectGuid:e.params.pGuid,pGuid:e.params.pGuid,widgetContext:JSON.stringify({referer:O.pathname,parentWidgetId:null,hasParentForm:P.hasParentForm(),originator:(G=e.params)==null?void 0:G.originator,parent:e.params,folderData:(o=e.params)==null?void 0:o.folderData}),widgetEvent:Q.onRefresh,widgetName:d==null?void 0:d.name,widgetValue:k,formData:b}).then(te=>{if(te.meta.requestStatus==="fulfilled"){let oe={...te.payload};oe.FECommand={...oe.FECommand,UpdateFormData:oe.data},e.execCommands(oe.FECommand);}});},[e,d==null?void 0:d.name,O.pathname]),Q$1=useCallback(()=>{e.deletePrompt({delete:{showDialog:true,dialogTitle:R("Delete")+" ?",dialogContent:R("Are you certain that you wish to delete this folder?"),buttonAgree:R("Continue"),buttonDisagree:R("Close"),callBackFunc:k=>{k?se(k,"delete",e,{},O,""):se(false,"",e,{},O,"");}}});},[e,R,O,se]);if(w==="live"){let k=g.rightMode!=="Edit";return jsxs(or,{...M(V),sx:{"& > ul":{paddingLeft:"0.2rem",paddingRight:"0.1rem"}},children:[jsxs(ld,{...C({className:t("content",{"Mui-expanded":re,"Mui-selected":x.selected,"Mui-focused":x.focused,"Mui-disabled":x.disabled})}),children:[c!==0&&jsxs(Fragment,{children:[jsx(TreeItem2IconContainer,{...T({status:x,onPointerUp:_}),children:jsx(TreeItem2Icon,{status:x})}),jsx(TreeItem2Checkbox,{...v()})]}),jsx(ar,{...J({icon:$,expandable:E&&re,isFirstRootNode:c===0,onClick:G=>{F&&F(G,r),G.stopPropagation();}}),children:s}),!k&&e.selectedItem===r&&c!==0&&jsx(vr,{size:"small",onClick:ue,"aria-controls":N?"menu":void 0,"aria-haspopup":"true","aria-expanded":N?"true":void 0,style:{marginLeft:"auto",color:"#FFF",fontSize:"14px"},children:jsx(n$1,{})}),jsxs(nd,{anchorEl:U,open:N,onClose:Y,onClick:G=>G.stopPropagation(),slotProps:{paper:{sx:{minWidth:"12em"}}},children:[jsxs(It,{onClick:ce,children:[jsx(Ct,{children:jsx(Ft,{action:"add",applyInternalStyle:true})}),jsx(xt,{primaryTypographyProps:{fontSize:"0.875rem"},children:R("New Folder")})]}),jsxs(It,{onClick:ge,children:[jsx(Ct,{children:jsx(Ft,{action:"edit",applyInternalStyle:true})}),jsx(xt,{children:R("Settings")})]}),jsxs(It,{onClick:we,children:[jsx(Ct,{children:jsx(Ft,{action:"share",applyInternalStyle:true})}),jsx(xt,{children:R("Share")})]}),jsxs(It,{onClick:Q$1,children:[jsx(Ct,{children:jsx(Ft,{action:"trash",applyInternalStyle:true})}),jsx(xt,{children:R("Delete")})]})]}),jsx(TreeItem2DragAndDropOverlay,{...ee()})]}),f&&jsx(nr,{...Z(),in:re,children:f})]})}else {let k=false;return p&&p.length>0&&p.forEach((G,o)=>{if(G===r){k=true;return}}),jsxs(or,{...M({...V,expandable:false}),sx:{"& > ul":{paddingLeft:"1rem",paddingRight:"0rem"}},children:[jsxs(dd,{...C({className:t("content",{"Mui-expanded":true,"Mui-selected":x.selected,"Mui-focused":x.focused,"Mui-disabled":x.disabled})}),children:[c!==0&&jsx(Fragment,{children:jsx(TreeItem2Checkbox,{id:r,visible:true,checked:k,onPointerUp:G=>H(r),onResize:void 0,onResizeCapture:void 0,popover:void 0,popoverTargetAction:void 0,popoverTarget:void 0,inert:void 0,onToggle:void 0,onBeforeToggle:void 0,onTransitionCancel:void 0,onTransitionCancelCapture:void 0,onTransitionRun:void 0,onTransitionRunCapture:void 0,onTransitionStart:void 0,onTransitionStartCapture:void 0})}),jsx(ar,{...J({icon:$,expandable:E,isFirstRootNode:c===0}),children:s}),jsx(TreeItem2DragAndDropOverlay,{...ee()})]}),f&&jsx(nr,{...Z(),in:true,children:f})]})}}),cd=t=>{let e=[],n=i=>{i.forEach(r=>{r.children&&r.children.length>0&&(e.push(r.id),n(r.children));});};return n(t),e},fd=(t,e)=>{let n=(i,r)=>{for(let s of i)if(s.id===r||s.children&&n(s.children,r))return s;return null};return n(t,e)},pd=(t,e)=>{let n=[],i=(r,s,a=[])=>{for(let f of r){if(f.id===s)return n.push(...a),true;if(f.children&&i(f.children,s,[...a,f]))return true}return false};return i(t,e),n},jt=(t,e)=>{for(let n of t){if(n.id===e)return n;if(n.children){let i=jt(n.children,e);if(i)return i}}return null},Tt=(t,e)=>{for(let n of t){if(n.id===e)return [n.label];if(n.children){let i=Tt(n.children,e);if(i.length>0)return [n.label,...i]}}return []},gd=({eventDispatcher:t,execCommands:e,params:n,properties:i,redrawComponent:r,formlayout:s,onFolderSelected:a,onFolderAdded:f,formData:m,mode:c,checkedItems:w})=>{var U,j;let{runFormEvent:F}=b$1(),[p,d]=Te.useState([]),[u,g]=Te.useState(((U=n==null?void 0:n.folderData)==null?void 0:U.id)||null),[b,h]=Te.useState([]),[S,y]=Te.useState(w),[D,V]=Te.useState(false),[M,C]=Te.useState(),{UserDialog:T}=b$2();Te.useEffect(()=>{y(w);},[w]);let v=useCallback(P.debounce(async()=>{var N,E,$,re,pe,ye,se,_,ue,Y,ce;try{let we=await F({pluginCode:((N=n.sourcePluginCode)==null?void 0:N.trim())!==""?n.sourcePluginCode:n.pluginCode,formCode:((E=n.sourceFormCode)==null?void 0:E.trim())!==""?n.sourceFormCode:n.formCode,guid:n.guid,projectGuid:n.pGuid,pGuid:n.pGuid,widgetEvent:Q.onFoldersDataLoad,widgetContext:JSON.stringify({originator:($=n.originator)!=null?$:null})});if(we.meta.requestStatus==="fulfilled"){let ge={...we.payload};ge!=null&&ge.userData&&C(ge==null?void 0:ge.userData),(re=ge==null?void 0:ge.userData)!=null&&re.isContributor&&V(!0);let H=JSON.parse(ge.widgetData.treeData);if(d(H),(pe=n==null?void 0:n.folderData)!=null&&pe.addedFolderId){let Q=fd(H,(ye=n==null?void 0:n.folderData)==null?void 0:ye.addedFolderId);if(Q){let k=cd([Q]);h(k),g((se=n==null?void 0:n.folderData)==null?void 0:se.addedFolderId);let G=Tt([Q],(_=n==null?void 0:n.folderData)==null?void 0:_.addedFolderId);f(null,G);}}else if(b.length===0&&h([(ue=H[0])==null?void 0:ue.id]),!u){let Q=(Y=H[0])==null?void 0:Y.id,k=(ce=H[0])==null?void 0:ce.isroot;g(Q||null),a(Q||null,k);}}}catch(we){}},500),[n]);Te.useEffect(()=>(v(),()=>{v.cancel();}),[v]),Te.useEffect(()=>{var N,E,$,re,pe,ye;if((N=n==null?void 0:n.folderData)!=null&&N.id){g(((E=n==null?void 0:n.folderData)==null?void 0:E.id)||null);let se=jt(p,($=n==null?void 0:n.folderData)==null?void 0:$.id),_=Tt(p,se==null?void 0:se.id),ue=[],Y=pd(p,(re=n==null?void 0:n.folderData)==null?void 0:re.id);Y.length>0&&(Y.forEach(ce=>{ue.push(ce.id);}),ue.push((pe=n==null?void 0:n.folderData)==null?void 0:pe.id),h(ue)),a((ye=n==null?void 0:n.folderData)==null?void 0:ye.id,se==null?void 0:se.isroot,_);}},[(j=n==null?void 0:n.folderData)==null?void 0:j.id]);let[J,Z]=useState({delete:{buttonAgree:"",buttonDisagree:"",dialogTitle:"",dialogContent:"",showDialog:false,callBackFunc:()=>{}}}),ee=N=>J.delete.callBackFunc(N),x=N=>{Z(N);},O=(N,E)=>{g(E);let $=jt(p,E),re=Tt(p,$==null?void 0:$.id);a(E,$==null?void 0:$.isroot,re);};return jsxs(Fragment,{children:[jsx(rr,{sx:{paddingTop:"5px"},children:jsx(RichTreeView,{items:p,selectedItems:u,expandedItems:b,sx:{height:"fit-content",flexGrow:1,maxWidth:250,overflowY:"auto"},slots:{item:N=>jsx(ud,{...N,mode:c,params:n,eventDispatcher:t,execCommands:e,deletePrompt:x,index:p.findIndex(E=>E.id===N.itemId),selectedItem:u,setSelectedItem:O,treeCheckedItems:S,disableRootItem:D,userData:M,formData:m,properties:i})},onSelectedItemsChange:O,onExpandedItemsChange:(N,E)=>{var re;let $=(re=p[0])==null?void 0:re.id;$&&!E.includes($)?h(pe=>pe.includes($)?pe:[...pe,$]):h(E);}})}),jsx(T,{...J.delete,handleDialogClose:ee})]})},ut=gd;var sr=withTranslation()(memo(function(e){var c,w;let{style:n,verticalalign:i,plugincode:r,formcode:s,visible:a}=e.properties,f={paddingTop:"0px"};if(i==="bottom"&&(f.paddingTop="10px"),!a)return null;let m=(c=e.context.formData)!=null&&c[e.properties.name]?JSON.parse((w=e.context.formData)==null?void 0:w[e.properties.name]):{};return jsx("div",{style:{...n,...f,minHeight:"2rem"},children:jsx(ut,{params:{sourceFormCode:s,sourcePluginCode:r,pluginCode:e.context.params.pluginCode,formCode:e.context.params.formCode,guid:e.context.params.guid,pGuid:e.context.params.pGuid,originator:e.context.params.originator},properties:e.properties,checkedItems:m,redrawComponent:e.context.redrawComponent,eventDispatcher:e.methodProvider.eventDispatcher,execCommands:e.methodProvider.execCommands,formData:e.context.formData,formlayout:"folders",onFolderSelected:()=>{},onFolderAdded:()=>{},mode:"setup"})})}));sr.displayName="_View";var mr=sr;var vd=lazy(()=>import('./tabulator-SQ554EQC.js').then(t=>({default:t.TabulatorTable}))),yd=lazy(()=>import('./datatable-JUVSEKE5.js').then(t=>({default:t.Datatable}))),Ae=class{static getFormComponent(e,n){if(e.displayName==="_Rowcontainer")return jn;if(e.displayName==="_Rowsegment")return Kn;if(e.displayName==="_Textinput"){if(n.inputtype==="input")return ea;if(n.inputtype==="inputwcopy")return na;if(n.inputtype==="currency")return Qa;if(n.inputtype==="password")return Za;if(n.inputtype==="date")return Aa;if(n.inputtype==="time")return Ha;if(n.inputtype==="datetime")return Ga;if(n.inputtype==="phone")return qa}else {if(e.displayName==="_TabBox")return ia;if(e.displayName==="_Button")return Na;if(e.displayName==="_Label")return sa;if(e.displayName==="_CheckBox")return ca;if(e.displayName==="_Radio")return ga;if(e.displayName==="_Textarea")return ba;if(e.displayName==="_SelectBox")return wa;if(e.displayName==="_Placeholder")return xa;if(e.displayName==="_Fileuploader")return Ea;if(e.displayName==="_Table")return n.alloweditrow||n.tablemode!==void 0&&n.tablemode==="tabulator"?vd:yd;if(e.displayName==="_View")return mr}return e}};function fr(t,e,n){var i=this,r=useRef(null),s=useRef(0),a=useRef(null),f=useRef([]),m=useRef(),c=useRef(),w=useRef(t),F=useRef(true);useEffect(function(){w.current=t;},[t]);var p=!e&&e!==0&&typeof window!="undefined";if(typeof t!="function")throw new TypeError("Expected a function");e=+e||0;var d=!!(n=n||{}).leading,u=!("trailing"in n)||!!n.trailing,g="maxWait"in n,b=g?Math.max(+n.maxWait||0,e):null;useEffect(function(){return F.current=true,function(){F.current=false;}},[]);var h=useMemo(function(){var S=function(T){var v=f.current,J=m.current;return f.current=m.current=null,s.current=T,c.current=w.current.apply(J,v)},y=function(T,v){p&&cancelAnimationFrame(a.current),a.current=p?requestAnimationFrame(T):setTimeout(T,v);},D=function(T){if(!F.current)return false;var v=T-r.current;return !r.current||v>=e||v<0||g&&T-s.current>=b},V=function(T){return a.current=null,u&&f.current?S(T):(f.current=m.current=null,c.current)},M=function T(){var v=Date.now();if(D(v))return V(v);if(F.current){var J=e-(v-r.current),Z=g?Math.min(J,b-(v-s.current)):J;y(T,Z);}},C=function(){var T=Date.now(),v=D(T);if(f.current=[].slice.call(arguments),m.current=i,r.current=T,v){if(!a.current&&F.current)return s.current=r.current,y(M,e),d?S(r.current):c.current;if(g)return y(M,e),S(r.current)}return a.current||y(M,e),c.current};return C.cancel=function(){a.current&&(p?cancelAnimationFrame(a.current):clearTimeout(a.current)),s.current=0,f.current=r.current=m.current=a.current=null;},C.isPending=function(){return !!a.current},C.flush=function(){return a.current?V(Date.now()):c.current},C},[d,g,e,b,u,p]);return h}var Td=Te__default.createContext(void 0),gr=({children:t,eventDispatcher:e,redrawComponent:n,formlayout:i,params:r,onFolderSelected:s,onFolderAdded:a,formData:f,execCommands:m})=>{let[c,w]=useState(i),{viewPort:F}=b$1(),[p,d]=useState(false),{t:u}=useTranslation(),g=()=>d(y=>!y),b=()=>d(false),h={viewHolder:{display:"flex",position:"relative"},toggleButton:{position:"absolute",top:"1em",right:"1em",zIndex:1e3,background:"#FFF",color:"#3f86cc ",border:"1px solid #3f86cc",borderRadius:"50%",width:"35px",height:"35px",display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer"},toggleButtonMenuActive:{background:"#3f86cc",color:"#FFF "},btreeContainerMobile:{position:"fixed",top:0,left:p?0:"-16rem",height:"100%",width:"16rem",backgroundColor:"#F8F8F8",borderRight:"1px solid #C0C0C0",transition:"left 0.3s ease",zIndex:999,padding:"0.5rem"},btreeContainerDesktop:{borderRight:"1px solid #C0C0C0"},mainContent:{flex:1,margin:"1em"}},S=()=>jsx(Jl,{variant:"h6",sx:{padding:"0.5em",fontWeight:"bold",borderBottom:"1px dashed #C0C0C0"},children:u("My Folders")});return jsxs(Td.Provider,{value:{layout:c,setLayout:w},children:[(!i||i==="regular")&&t,i==="folders"&&jsxs("div",{className:"viewHolder",style:h.viewHolder,children:[F.isMobileDevice?jsxs(Fragment,{children:[!p&&jsx("button",{onClick:g,style:{...h.toggleButton,...h.toggleButtonMenuActive},children:t$1({size:"1.3rem"})}),jsx(xd,{open:p,onClick:b,sx:{zIndex:998,backgroundColor:"rgba(0, 0, 0, 0.5)"}}),jsxs("div",{style:h.btreeContainerMobile,onClick:y=>y.stopPropagation(),children:[jsx("div",{style:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingLeft:"0.5rem"}}),jsx(S,{}),jsx(ut,{params:{...r,sourcePluginCode:r.pluginCode,sourceFormCode:r.formCode},redrawComponent:n,eventDispatcher:e,execCommands:m,formData:f,formlayout:i,onFolderSelected:s,onFolderAdded:a,mode:"live"})]})]}):jsxs("div",{className:"foldersHolder",style:h.btreeContainerDesktop,children:[jsx(S,{}),jsx(ut,{params:{...r,sourcePluginCode:r.pluginCode,sourceFormCode:r.formCode},redrawComponent:n,eventDispatcher:e,execCommands:m,formData:f,formlayout:i,onFolderSelected:s,onFolderAdded:a,mode:"live"})]}),jsx("div",{style:h.mainContent,children:t})]})]})};var Md=lazy(()=>import('./fileviewer-N5Z4NUU6.js')),Bd=lazy(()=>import('./formeditor-NTEFKL7B.js').then(t=>({default:t.Formeditor}))),Pt=t=>new Promise(e=>setTimeout(e,t)),Kt={command:{},params:{id:null,parentId:null,guid:"",pGuid:"",formCode:"",pluginCode:"",modal:false,modalCloseFn:()=>{},modalCloseAndOpenFn:()=>{},originator:{params:{pluginCode:"",formCode:"",guid:""}},parent:{widgetName:"",params:{pluginCode:"",formCode:"",guid:""}},hasParentForm:false,folderData:{id:"",label:"",isRoot:"",captions:[]}},doValidateForm:false,redrawComponent:false,redrawFoldersComponent:false,fieldAllowedValues:{},formData:{},widgetRelatedData:[],widgetsState:{visibility:{},readonly:{}},formDimension:{width:0,height:0},formValidationData:{},enableEventHandlers:false,isModal:false,hasParentForm:false,formLayout:"regular"},yr={containerSetup:{properties:{style:{minHeight:0}}},selectedWidgetProps:{title:"",subtitle:"",style:{},tabsetup:null,_path:{type:null,stricttype:null,component:null,tabId:null,panelId:null,rowId:null,segmentId:null,widgetId:null},lastActiveTabId:null}},Nd={id:"",parentId:"",pluginCode:"",formCode:"",guid:null,pGuid:void 0,isFormEditorMode:false,originator:{params:{pGuid:"",pluginCode:"",formCode:"",guid:""}},parent:{widgetName:"",params:{pGuid:"",pluginCode:"",formCode:"",guid:""}},folderData:{id:"",addedFolderId:"",isRoot:"",captions:[]},prefillData:void 0},Ld=memo(function({previewMode:e,className:n,maxWidth:i$1,setup:r,params:s,enableEventHandlers:a,modalCloseFn:f$1}){var no,ao;let m={...s,modalCloseFn:f$1||(s==null?void 0:s.modalCloseFn)},c=useRef(null),[w,F]=useState(0),{registerFormSubmitEvent:p,checkFormAccess:d}=i(),{apiConfig:u,appSettings:g,viewPort:b,runLoadFormEvent:h,runServerPingEvent:S,runFormEvent:y,fetchUserMenu:D,signInUser:V,signOut:M}=b$1(),[C,T]=useState(null),v=useNavigate(),[J,Z]=useState(false),ee=useRef({}),[x,O]=useState({}),[R,U]=useState(null),[j,N]=useState(null),E=useLocation(),[$]=useState(b.width),[re]=useState(m.modal||false),[pe]=useState(P.hasParentForm()||!!(u!=null&&u.token)),[ye,se]=useState([]),_=ye.length>0?ye[ye.length-1]:Nd,[ue,Y]=useState(),[ce,we]=useState(true),{t:ge}=useTranslation(),H=e$1(),Q=f(),k=g$2(),G={command:{},params:m,doValidateForm:false,redrawComponent:false,redrawFoldersComponent:false,fieldAllowedValues:{},formData:{},widgetRelatedData:[],widgetsState:{visibility:{},readonly:{}},formDimension:{width:w,height:0},formValidationData:{},enableEventHandlers:a,isModal:re,hasParentForm:pe,formLayout:"regular"},[o,te]=useState(G),[oe,ie]=useState({...yr,containerSetup:r}),Ne=fr(()=>{c&&c.current&&F(c.current.offsetWidth);},200),Ge=async(l,B)=>{await h({pluginCode:l.pluginCode,formCode:l.formCode,guid:l.guid,projectGuid:l.pGuid,pGuid:l.pGuid,originator:l.originator,parent:l.parent,previewMode:e,widgetContext:JSON.stringify({folderData:l.folderData,prefillData:l.prefillData})}).then(async P$1=>{var A,K,X,ve,he,be,Fe,W;if(P$1.meta.requestStatus==="fulfilled"){let L={...P$1.payload};if(Object.keys(L).length===0)return;try{let me=window.location.hostname;if(!b$3.SKIP_ACCESS_VALIDATION_DOMAINS.some(He=>me===He||me.endsWith(`.${He}`))){let He=await d(l.formCode);(He==null?void 0:He.subscriptionPlan)!=null&&U(He.subscriptionPlan);}}catch(me){N({title:(K=(A=me==null?void 0:me.data)==null?void 0:A.error)!=null?K:"Form Unavailable",message:(ve=(X=me==null?void 0:me.data)==null?void 0:X.message)!=null?ve:"This form is temporarily unavailable."});return}if(L.uiTranslations&&Object.keys(L.uiTranslations).length>0){ee.current=L.uiTranslations,O(L.uiTranslations);let me=Sd;me.addResourceBundle(me.language,"default",L.uiTranslations,true,true);}let Re={},de={visibility:{...o==null?void 0:o.widgetsState.visibility,...(he=L==null?void 0:L.widgetsState)==null?void 0:he.visibility},readonly:{...o==null?void 0:o.widgetsState.readonly,...(be=L==null?void 0:L.widgetsState)==null?void 0:be.readOnly}};if(B){te(me=>({...me,formData:L.data,fieldAllowedValues:L.fieldAllowedValues,widgetsState:de,formLayout:L.layout,requiredFields:L.requiredFields}));return}let De={},Le=[],Oe={},Ue=JSON.parse(L.definition);if(Ue==null){te({...G,redrawComponent:false,doValidateForm:false,command:{...L.FECommand},formData:{},widgetsState:de,formLayout:L.layout,requiredFields:L.requiredFields,params:{...G.params,folderData:L.folderData}});return}P.mapComponents(Ue._children);let Qe=Ue.properties;Le=Ue._children,Oe=Ue,ie({...oe,containerProps:Qe,selectedWidgetProps:{...oe.containerProps},containerData:Le,containerSetup:Oe}),Re=L.fieldAllowedValues,De=L.data,te({...G,formData:De,formLayout:L.layout,widgetsState:{visibility:{...o==null?void 0:o.widgetsState.visibility,...(Fe=L==null?void 0:L.widgetsState)==null?void 0:Fe.visibility},readonly:{...o==null?void 0:o.widgetsState.readonly,...(W=L==null?void 0:L.widgetsState)==null?void 0:W.readOnly}},requiredFields:L.requiredFields,command:{...L.FECommand},fieldAllowedValues:Re,params:{...G.params,folderData:L.folderData}}),Z(true);}});};if(useEffect(()=>(Ne(),Ge(m,false),window.addEventListener("resize",Ne),()=>{te(()=>({...Kt})),ie(yr),Z(false),window.removeEventListener("resize",Ne);}),[m.pGuid,m.guid,m.pluginCode,m.formCode]),useEffect(()=>{var K,X,ve,he,be,Fe,W,L,Re,de,De,Le,Oe,Ue,Qe,me,Et,He,ro,io,lo,so,mo,uo,co,fo,po,go,ho,bo,vo,yo,wo,Co,xo,Io,Fo,To,Do,Po,So,Ro,Eo,ko,Mo,Bo,No,Lo,_o,Ao,Vo,Oo,Uo,Ho,Wo,$o,Go,zo,qo,Jo,jo,Yo,Qo,Ko,Xo,Zo,en,tn,on,nn,an,rn,ln,dn,sn;let l=o,B=null,P$1=true,A=false;if((K=o.command)!=null&&K.Messages&&((X=o.command)==null||X.Messages.forEach(le=>{var Ee;let ae=(Ee=ee.current[le.text])!=null?Ee:ge(le.text);le.code==="NOTICE"?(A=true,k({toastID:nanoid(11),msg:ae,clearQueue:false,hideProgressBar:false})):le.code==="SUCCESS"?(A=true,Q({toastID:nanoid(11),msg:ae,clearQueue:false,hideProgressBar:false})):le.code==="WARNING"&&(P$1=false,H({toastID:nanoid(11),msg:ae,clearQueue:false,hideProgressBar:false}));})),(ve=o.command)!=null&&ve.DisplayButtonLoader){te({...o,displayButtonLoader:true});return}if((he=o.command)!=null&&he.DisplayErrorPage){v("/pagenotfound");return}if((be=o.command)!=null&&be.MoveToTab){let le=(W=(Fe=o.command)==null?void 0:Fe.MoveToTab)==null?void 0:W.widgetName;if(le){let ae=P.getTabWidgetByFieldName(le,oe.containerSetup);ae!==null&&(ae==null?void 0:ae.tabId)!==void 0&&Ve(ae);}}if((L=o.command)!=null&&L.FormValidationData&&Object.keys(o.command.FormValidationData).length>0){let le=Object.keys(o.command.FormValidationData)[0];if(le){let ae=P.getTabWidgetByFieldName(le,oe.containerSetup);ae!==null&&(ae==null?void 0:ae.tabId)!==void 0&&Ve(ae),setTimeout(()=>{let Ee=[`[name="${le}"]`,`[data-field-name="${le}"]`,`#${le}`,`[id*="${le}"]`],Pe=null;for(let gt of Ee)try{if(Pe=document.querySelector(gt),Pe)break}catch(kt){}Pe&&(Pe.scrollIntoView({behavior:"smooth",block:"center"}),(Pe.tagName==="INPUT"||Pe.tagName==="TEXTAREA"||Pe.tagName==="SELECT")&&Pe.focus());},100);}te({...o,doValidateForm:true,formValidationData:(Re=o.command)==null?void 0:Re.FormValidationData});return}else l={...l,formValidationData:{}};if((de=o.command)!=null&&de.FetchUserMenu&&D&&D({ProjectGuid:(Le=(De=o.command)==null?void 0:De.FetchUserMenu)==null?void 0:Le.projectGuid,pGuid:(Ue=(Oe=o.command)==null?void 0:Oe.FetchUserMenu)==null?void 0:Ue.projectGuid}),(Qe=o.command)!=null&&Qe.Redirect){m.modalCloseFn&&m.modalCloseFn(),v(`${(me=o.command)==null?void 0:me.Redirect.url}?ref=${(ro=(He=(Et=o.command)==null?void 0:Et.Redirect)==null?void 0:He.context)==null?void 0:ro.referer}`,{state:{from:(so=(lo=(io=o.command)==null?void 0:io.Redirect)==null?void 0:lo.context)==null?void 0:so.referer}});return}if((mo=o.command)!=null&&mo.BuildPlugin){v(`${(uo=o.command)==null?void 0:uo.BuildPlugin.url}?ref=${(fo=(co=o.command)==null?void 0:co.BuildPlugin)==null?void 0:fo.referer}`);return}if((po=o.command)!=null&&po.DisplayComponent&&T((go=o.command)==null?void 0:go.DisplayComponent),(ho=o.command)!=null&&ho.CloseDisplayComponent&&T(null),(bo=o.command)!=null&&bo.Login&&(async()=>{var le,ae,Ee,Pe,gt,kt,mn;V&&await V((le=o.command)==null?void 0:le.Login),D&&await D({ProjectGuid:P.extractProjectGuid((Ee=(ae=o.command)==null?void 0:ae.Login)==null?void 0:Ee.url),pGuid:P.extractProjectGuid((gt=(Pe=o.command)==null?void 0:Pe.Login)==null?void 0:gt.url)}),v(((mn=(kt=o.command)==null?void 0:kt.Login)==null?void 0:mn.url)||"/");})(),(vo=o.command)!=null&&vo.Logout&&(async()=>{var ae;(ae=o.command)!=null&&ae.Logout&&(M&&await M(),v("/"));})(),((yo=o.command)!=null&&yo.Cancel||(wo=o.command)!=null&&wo.CloseForm)&&(o.isModal&&m.modalCloseFn!==void 0?m.modalCloseFn(null,null,false,(Co=o.command)==null?void 0:Co.RedrawFolders):(B=P.getUrlParameter("ref"),B!=null&&v(B))),(xo=o.command)!=null&&xo.AfterRecordSave){let le=(Io=g==null?void 0:g.TOASTER_AUTOCLOSE)!=null?Io:b$3.TOASTER_AUTOCLOSE;if(B=P.getUrlParameter("ref"),((Fo=o.command)==null?void 0:Fo.AfterRecordSave.guid)==null)!((To=o.command)!=null&&To.OpenModal)&&m.modalCloseFn?m.modalCloseFn(null,null,false,null,null):(Do=o.command)!=null&&Do.OpenModal||(async()=>(await Pt(A?le:0),B!=null&&v(B)))();else if(o.isModal){let ae;(Po=o.command)!=null&&Po.HotReloadEnabled&&(ae=(So=o.command)==null?void 0:So.HotReloadEnabled),(Ro=o.command)!=null&&Ro.OpenModal||(async()=>{var Ee,Pe;await Pt(A?le:0),m.modalCloseFn&&m.modalCloseFn(ae,o.formData,(Ee=o.command)==null?void 0:Ee.RedrawScreen,(Pe=o.command)==null?void 0:Pe.RedrawFolders,null);})();}else {let ae=B!=null;if(!((Eo=o.command)!=null&&Eo.OpenModal)&&ae&&P$1)(async()=>(await Pt(A?le:0),B!=null&&v(B)))();else if(!((ko=o.command)!=null&&ko.OpenModal)){let Ee=E.pathname.replace(/\/new/gi,"/"+((Mo=o.command)==null?void 0:Mo.AfterRecordSave.guid.replace(/#/g,"%23")));v(Ee,{state:{from:E.pathname}}),l={...l,params:{...o.params,guid:(Bo=o.command)==null?void 0:Bo.AfterRecordSave.guid}};}}}if((No=o.command)!=null&&No.UpdateWidgetsState&&(l={...l,widgetsState:{visibility:{...l==null?void 0:l.widgetsState.visibility,...(_o=(Lo=o.command)==null?void 0:Lo.UpdateWidgetsState)==null?void 0:_o.visibility},readonly:{...l==null?void 0:l.widgetsState.readonly,...(Vo=(Ao=o.command)==null?void 0:Ao.UpdateWidgetsState)==null?void 0:Vo.readonly}}}),(Oo=o.command)!=null&&Oo.UpdateFieldAllowedValues&&(l={...l,fieldAllowedValues:{...(Uo=o.command)==null?void 0:Uo.UpdateFieldAllowedValues}}),(Ho=o.command)!=null&&Ho.UpdateFormData&&(l={...l,formData:{...(Wo=o.command)==null?void 0:Wo.UpdateFormData}}),($o=o.command)!=null&&$o.UpdateFormDataItem&&(l={...l,formData:{...l.formData,[(Go=o.command)==null?void 0:Go.UpdateFormDataItem.name]:(zo=o.command)==null?void 0:zo.UpdateFormDataItem.value}}),((Jo=(qo=o.command)==null?void 0:qo.ReplaceContextRecordGuid)==null?void 0:Jo.guid)!=null&&(l={...l,displayButtonLoader:false,params:{...o.params,guid:(jo=o.command)==null?void 0:jo.ReplaceContextRecordGuid.guid}}),(Yo=o.command)!=null&&Yo.OpenModal){let le={...(Qo=o.command)==null?void 0:Qo.OpenModal,parentId:m.id};se(ae=>[...ae,le]),l={...l,command:{}};}(Ko=o.command)!=null&&Ko.PreviewDocument&&Y((Xo=o.command)==null?void 0:Xo.PreviewDocument),(Zo=o.command)!=null&&Zo.RedrawScreen&&(l={...l,redrawComponent:!o.redrawComponent,redrawFoldersComponent:!o.redrawFoldersComponent}),(en=o.command)!=null&&en.RedrawFolders&&(l={...l,params:{...o.params,folderData:{id:(on=(tn=o.command)==null?void 0:tn.RedrawFolders)==null?void 0:on.folderId,addedFolderId:(an=(nn=o.command)==null?void 0:nn.RedrawFolders)==null?void 0:an.folderId,isRoot:(ln=(rn=o.command)==null?void 0:rn.RedrawFolders)==null?void 0:ln.isRoot,captions:(sn=(dn=o.command)==null?void 0:dn.RedrawFolders)==null?void 0:sn.captions}}}),Object.keys(o.command).length>0&&(l={...l,command:{}},te(l));},[o.command]),j)return jsx(l,{title:j.title,message:j.message});if(!J)return Te__default.createElement("div",{},jsx(a$2,{message:ge("Please wait...")}));let Ye=(l,B)=>{let P={};return Object.entries(l).forEach(([A,K])=>{let X=B[A];(X==null||X===""||X==="0"||X===0||Array.isArray(X)&&X.length===0)&&(P[A]=K);}),P},Ve=(l,B=false,P$1={})=>{let A=ft(null,l.tabId,l.index,B,P$1.containerSetup);if(A===void 0)return;let K=P.GetParentTabId(A.containerSetup,l.tabId);(K==null?void 0:K.tabId)!=null?(A=ft(null,K.tabId,K.index,false,A.containerSetup),A!==void 0&&Ve(K,true,A)):B===false&&ft(null,l.tabId,l.index,true);},Ce=async l=>(te({...o,displayButtonLoader:true}),await y({pluginCode:l.pluginCode,formCode:l.formCode,guid:l.guid,projectGuid:l.projectGuid,pGuid:l.projectGuid,formData:{...l.formData,[l.fieldName]:l.value},widgetContext:JSON.stringify({referer:E.pathname,parentWidgetId:l.tabId,hasParentForm:P.hasParentForm(),originator:{widgetName:l.fieldName.toLowerCase(),params:o.params},parent:{widgetName:l.fieldName.toLowerCase(),params:o.params},parentOriginator:{params:o.params.originator?o.params.originator.params:{}},folderData:o.params.folderData}),widgetEvent:l.widgetEvent,widgetName:l.fieldName.toLowerCase(),widgetValue:l.widgetValue}).then(async B=>{var P,A,K,X,ve,he,be,Fe;if(B.meta.requestStatus==="fulfilled"){let W={...B.payload};((P=W.FECommand)==null?void 0:P.ReplaceContextRecordGuid)!==void 0?(W.FECommand={Messages:(K=(A=W.FECommand)==null?void 0:A.Messages)!=null?K:[],UpdateFormData:W.data,ReplaceContextRecordGuid:(X=W.FECommand)==null?void 0:X.ReplaceContextRecordGuid},ot(W.FECommand)):(ve=W.FECommand)!=null&&ve.Messages?(W.FECommand={UpdateFormData:W.data,Messages:(he=W.FECommand)==null?void 0:he.Messages},ot(W.FECommand)):(be=W.FECommand)!=null&&be.FormValidationData&&(W.FECommand={FormValidationData:(Fe=W.FECommand)==null?void 0:Fe.FormValidationData},ot(W.FECommand));}else te({...o,displayButtonLoader:false});})),tt=l=>{let B=l.widgetContext,P$1=l.widgetEvent,A=l.widgetName.toLowerCase(),K=l.widgetValue,X=l.feCommand||{},ve=l.skipFormDataItem||false;if(P$1!==null&&o.enableEventHandlers){if(l.autoSave){Ce(l.autoSave);return}let he=K!=null&&ve===false?{...o.formData,[A]:K}:o.formData;if((P$1==null?void 0:P$1.toUpperCase())==="ONSAVE"&&o.requiredFields!=null){let be=Ye(o.requiredFields,he),Fe=Object.keys(o.formValidationData||{}).length>0,W=Object.keys(be).length>0;if((W||Fe)&&(te({...o,command:{...o.command,FormValidationData:be}}),W))return}(async()=>{var be,Fe;if((P$1==null?void 0:P$1.toUpperCase())==="ONSAVE")try{await p(o.params.formCode);}catch(W){if((W==null?void 0:W.status)===429)return}we(false),await y({pluginCode:o.params.pluginCode,formCode:o.params.formCode,guid:o.params.guid,projectGuid:(be=o.params.pGuid)!=null?be:"",pGuid:(Fe=o.params.pGuid)!=null?Fe:"",widgetContext:B,widgetEvent:P$1,widgetName:A,widgetValue:typeof K=="string"?K:K!=null?JSON.stringify(K):null,formData:he,widgetsState:o.widgetsState}).then(W=>{var L,Re;if(W.meta.requestStatus==="fulfilled"){if(W.payload instanceof Blob){te({...o,redrawComponent:!o.redrawComponent});return}let de={...W.payload};if(Object.keys(de).length===0)return;let De=JSON.parse(de.definition);if(De!=null){let Le=[],Oe={};P.mapComponents(De._children);let Ue=De.properties;Le=De._children,Oe=De,ie({...oe,containerProps:Ue,selectedWidgetProps:{...oe.selectedWidgetProps},containerData:Le,containerSetup:Oe});let Qe=A;if(Qe){let me=P.getTabWidgetByFieldName(Qe,Oe);me!==null&&(me==null?void 0:me.tabId)!==void 0&&Ve(me,true,{containerSetup:Oe});}}ve||(o.redrawComponent=false),te({...o,fieldAllowedValues:de.fieldAllowedValues,doValidateForm:true,command:{...de.FECommand},formData:{...o.formData,...de.data},widgetRelatedData:de.widgetRelatedData,widgetsState:{visibility:{...o==null?void 0:o.widgetsState.visibility,...(L=de==null?void 0:de.widgetsState)==null?void 0:L.visibility},readonly:{...o==null?void 0:o.widgetsState.readonly,...(Re=de==null?void 0:de.widgetsState)==null?void 0:Re.readOnly}},tabIndex:l.tabIndex?Number(l.tabIndex+1):0});}}).finally(async()=>{var W;if(we(true),(P$1==null?void 0:P$1.toUpperCase())==="ONSAVE"&&u!=null&&u.iframeMode&&u!=null&&u.token){let L=(W=oe.containerProps)==null?void 0:W.webhooks;if(Array.isArray(L)&&L.length>0){let Re={formCode:o.params.formCode,submittedAt:new Date().toISOString(),data:he};L.forEach(de=>{var De;de.enabled&&((De=de.url)!=null&&De.startsWith("http"))&&fetch(de.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Re),mode:"cors"}).then(Le=>{Le.ok||H({toastID:nanoid(11),msg:`Webhook failed: ${de.url}`,clearQueue:false,hideProgressBar:false});}).catch(Le=>{H({toastID:nanoid(11),msg:`Webhook failed: ${de.url}`,clearQueue:false,hideProgressBar:false});});});}}});})();}if(K!=null){let he={...o.formData,[A]:K};te({...o,command:X,formData:he});}},xe=(l,B,P$1)=>P.findRowItem(l,B,P$1,oe.containerSetup._children),rt=(l,B,P$1,A)=>P.findSegmentItem(l,B,P$1,A,oe.containerSetup._children),xr=l=>P.findWidgetByIdRecursive(oe.containerSetup._children,l),Ir=(l,B)=>P.getActiveTabIndex(oe.containerSetup._children,B),ft=(l,B,P$1,A=true,K={})=>{let X=Object.keys(K).length>0?K:oe.containerSetup,ve=P.getTabContainer(X._children,B),he=P.getTabContainerChildrens(X._children,B);if(he===void 0)return;for(let L=0;L<he.data.length;L++)he.data[L].activeTab="0";let be=he.data.filter((L,Re)=>Re===P$1)[0];be.properties={...ve.item.properties.tabsetup,...be.properties};let Fe=P.getNodeUpdatePath(he.path,{$splice:[[P$1,1,{...be,activeTab:"1"}]]});var W={containerSetup:{...X,_children:(0, wr.default)(X._children,Fe)},selectedWidgetProps:{...oe.selectedWidgetProps,tabsetup:{...be.properties},_path:{...oe.selectedWidgetProps._path,panelId:be.id},lastActiveTabId:B}};return A&&ie(W),W},Fr=(l=true)=>{let B=Kt;l&&(B={...o,redrawComponent:!o.redrawComponent,params:{...o.params,folderData:{id:"",isRoot:"",captions:[]}}}),te(B);},ot=l=>{te({...o,redrawComponent:!o.redrawComponent,command:{...l}});},Xt=(l,B)=>{(async()=>S&&await S({cmd:"ping"}).then(async P=>{(P==null?void 0:P.type)==="formbuilder/ping/rejected"?(H({toastID:nanoid(11),msg:"Application is being restarted. Please wait until it finishes....",clearQueue:false,hideProgressBar:false}),await Pt(1e3),Xt(l)):l();}))();},Rt=(l,B=false,P,A=null)=>{Xt(()=>{if(se(X=>X.slice(0,-1)),A!=null){let X={...A,parentId:m.id};se(ve=>[...ve,X]);}else if(l!=null){let X={id:nanoid(5),pluginCode:l==null?void 0:l.pluginCode,formCode:l==null?void 0:l.formCode,guid:null,isFormEditorMode:true,parentId:m.id};se(ve=>[...ve,X]);}if(Ge(o.params,true),P){let X=P==null?void 0:P.folderId;Zt(X,[]);}else te({...o,redrawComponent:!o.redrawComponent});}),B&&o.isModal&&Ge(m,true);},Tr=(l,B="",P)=>{let A={...o,redrawFoldersComponent:!o.redrawFoldersComponent,redrawComponent:!o.redrawComponent,params:{...o.params,folderData:{...o.params.folderData,addedFolderId:"",captions:P,id:l!==null?l:"",isRoot:B}}};te(A);},Zt=(l,B)=>{let P=Kt;l==null?P={...o,redrawFoldersComponent:!o.redrawFoldersComponent,params:{...o.params,folderData:{...o.params.folderData,addedFolderId:l!==null?l:"",captions:B}}}:P={...o,params:{...o.params,folderData:{...o.params.folderData,id:l!==null?l:"",addedFolderId:l!==null?l:"",isRoot:"",captions:B}}},te(P);},eo=l=>{l&&se(B=>[...B.slice(0,-1),{...l,id:nanoid(5)}]);},Dr=()=>{Y(void 0);},Pr=()=>T(null),Sr=l=>{let{title:B,subtitle:P}=l,A=B;return P!==void 0&&String(P).trim()!==""&&(A=B+" - "+P),o.enableEventHandlers&&Object.keys((o==null?void 0:o.formData)||{}).length>0&&Object.entries(o.formData).forEach(([K,X])=>{A=A.replace(`#${K}`,X);}),A},{properties:Ie}=oe.containerSetup||{},{minHeight:to}=(Ie==null?void 0:Ie.style)||{},pt={};to&&(pt.minHeight=to),re&&(pt={...pt,width:"100%",minWidth:$-$*.3,maxHeight:"calc(100dvh - 4rem)",overflow:"auto"});let oo={};return e&&(oo={overflowY:"scroll",height:"85vh",padding:"0px 10px 10px 10px"}),jsx(k$1.Provider,{value:R,children:jsx(Ta.Provider,{value:x,children:jsxs(gr,{execCommands:ot,eventDispatcher:tt,redrawComponent:o.redrawFoldersComponent,formlayout:o.formLayout,params:o.params,onFolderSelected:Tr,onFolderAdded:Zt,formData:o.formData,children:[jsxs("div",{id:"main-content-wrapper",className:n,children:[jsx("div",{className:"content",children:jsx("div",{className:"main-content on-scrollbar",style:oo,children:jsxs("div",{id:"formCanvas",ref:c,style:{maxWidth:i$1,border:(Ie==null?void 0:Ie.border)===false?"none":void 0},children:[jsxs("form",{onSubmit:l=>{l.preventDefault();},style:{position:"relative"},children:[Ie&&!Ie.hideheader&&jsxs("div",{className:"form-header top-border-radius",style:{backgroundColor:(Ie==null?void 0:Ie.headerbackground)===false?"transparent":void 0},children:[jsx("div",{style:{flex:1,marginLeft:"0.5rem"},children:Ie&&Sr(Ie)}),re&&m.modalCloseFn!==void 0&&jsx("div",{style:{width:"2.5em"},children:jsx(vr,{onClick:()=>m.modalCloseFn(null),children:Te__default.createElement(Q$1)})})]}),Ie&&Ie.hideheader&&re&&m.modalCloseFn!==void 0&&jsx("div",{style:{position:"absolute",top:"0.5rem",right:"0.5rem",zIndex:9999},children:jsx(vr,{size:"medium",onClick:l=>{l.stopPropagation(),m.modalCloseFn(null);},sx:{backgroundColor:"rgba(255, 255, 255, 0.95)","&:hover":{backgroundColor:"rgba(255, 255, 255, 1)"}},children:Te__default.createElement(Q$1)})}),jsx("div",{style:pt,className:"form-container bottom-border-radius",children:jsx("div",{className:"form-container",children:jsx(l$1,{darkMode:false,noPadding:true,children:jsx(Suspense,{fallback:jsx(a$2,{}),children:jsx(_d,{eventDispatcher:tt,context:o,formWidth:w,findRowItem:xe,findSegmentItem:rt,findWidgetItem:xr,modal:re,getActiveTabIndex:Ir,setActiveTabIndex:ft,setRedrawComponent:Fr,execCommands:ot,widgets:oe.containerSetup})})})})})]}),C!==null&&jsx(d$1,{componentName:C.componentName,options:C.options,params:{params:(no=C.options)!=null&&no.contextParams?(ao=C.options)==null?void 0:ao.contextParams:o.params,formData:o.formData,execCommands:l=>ot(l),modalCloseFn:()=>Pr(),modalCloseAndOpenFn:l=>eo(l)}})]})})}),(R==null?void 0:R.toLowerCase())==="free"&&!re&&jsxs("div",{style:{textAlign:"center",padding:"12px 16px",fontSize:"13px",color:"#aaa"},children:["Powered by"," ",jsx("a",{href:"https://buildocs.com",target:"_blank",rel:"noopener noreferrer",style:{color:"#3498db",textDecoration:"none",fontWeight:500},children:"Buildocs"})]})]}),!ce&&jsx(a$2,{message:ge("Please wait...")}),!_.isFormEditorMode&&ue&&ue.fileId&&jsx(Suspense,{fallback:jsx(a$2,{message:ge("Loading viewer...")}),children:jsx(Md,{fileId:ue.fileId,fileBase64:ue.data,fieldName:ue.fieldName,params:{...ue.context?ue.context:o.params,modalCloseFn:Dr}},nanoid(11))}),!_.isFormEditorMode&&(_==null?void 0:_.pluginCode)&&(_==null?void 0:_.formCode)&&jsx(a$3,{component:jsx(Ld,{params:{id:_.id,parentId:_.parentId,pluginCode:_.pluginCode,formCode:_.formCode,guid:_.guid==null?"new":_.guid,pGuid:_.pGuid,modal:true,modalCloseFn:(l,B,P,A,K=null)=>Rt(l,P,A,K),modalCloseAndOpenFn:l=>eo(l),originator:_.originator,parent:_.parent,folderData:_.folderData,prefillData:_.prefillData},enableEventHandlers:true}),id:_.id,onCloseModal:Rt,parentId:_.parentId},_.id),_.isFormEditorMode&&(_==null?void 0:_.pluginCode)&&(_==null?void 0:_.formCode)&&jsx(a$3,{component:jsx(Suspense,{fallback:jsx(a$2,{}),children:jsx(Bd,{inPreviewMode:false,pluginCode:_.pluginCode,formCode:_.formCode,modal:true},nanoid(11))}),id:_.id,onCloseModal:()=>Rt(null,false,null),parentId:_.parentId,windowMode:"fullWindow"},_.id)]})})})}),_d=t=>{let e=0,n=i=>{for(var r in i)typeof i[r]=="object"&&i[r]!==null?n(i[r]):r==="tabIndex"&&(t.modal?i[r]=0:i[r]=++e);};return n(t.widgets._children),(t.widgets._children||[]).map(({id:i,tabId:r,panelId:s,type:a,component:f,properties:m})=>Te__default.createElement(Ae.getFormComponent(f,m),{key:"key_"+i,id:i,tabId:r,panelId:s,className:a,context:{...t.context,formDimension:{width:t.formWidth,height:0}},properties:m,widgetsState:t.context.widgetsState,methodProvider:{eventDispatcher:t.eventDispatcher,findRowItem:t.findRowItem,findSegmentItem:t.findSegmentItem,findWidgetItem:t.findWidgetItem,getActiveTabIndex:t.getActiveTabIndex,setActiveTabIndex:t.setActiveTabIndex,setRedrawComponent:t.setRedrawComponent,execCommands:t.execCommands}},i))};
2
2
  export{vt as a,zn as b,Ld as c};