@buildocsdev/sdk 1.1.49 → 1.1.51

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.
@@ -0,0 +1,2 @@
1
+ import {a as a$2}from'./chunk-NW34CD5C.js';import {g as g$1,j,i as i$2,d as d$1}from'./chunk-XGV2DLQ2.js';import {b as b$1}from'./chunk-VUS3THHW.js';import {a as a$1,i as i$1,h as h$1}from'./chunk-RYPE5BKG.js';import {d,c as c$1,e as e$1,b as b$2}from'./chunk-AY7MKCIL.js';import {y,z,B,T,U,x,A,k as k$1}from'./chunk-2YPJR6YZ.js';import {b}from'./chunk-LBMVBVXW.js';import {n,e,k,l,p,o,f,g,h,m as m$1}from'./chunk-C64U36LV.js';import {i,m,P,t,A as A$1,E,N,s}from'./chunk-IZKTNYAE.js';import {a as a$3}from'./chunk-SDIZEEZP.js';import {a,c}from'./chunk-5TBO732O.js';import*as Se from'react';import Se__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 er from'@mui/material/Box';import oi from'@mui/material/Button';import ni from'@mui/material/Tooltip';import Gi from'axios';import Ki from'@mui/material/CircularProgress';import Xi from'@mui/material/LinearProgress';import cr from'@mui/material/IconButton';import Ol from'@mui/material/InputAdornment';import Ul 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 $l from'@mui/material/Collapse';import ql 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 yt from'@mui/material/ListItemIcon';import wt from'@mui/material/ListItemText';import od from'@mui/material/Menu';import xt from'@mui/material/MenuItem';import Pd from'i18next';import xd from'@mui/material/Backdrop';var Wn=a((ze,Un)=>{Object.defineProperty(ze,"__esModule",{value:true});function Ae(t){return typeof t=="object"&&!("toString"in t)?Object.prototype.toString.call(t).slice(8,-1):t}var Pr=typeof process=="object"&&true;function Le(t,e){if(!t)throw Pr?new Error("Invariant failed"):new Error(e())}ze.invariant=Le;var Nt=Object.prototype.hasOwnProperty,Rr=Array.prototype.splice,Sr=Object.prototype.toString;function Ze(t){return Sr.call(t).slice(8,-1)}var bt=Object.assign||(function(t,e){return _t(e).forEach(function(o){Nt.call(e,o)&&(t[o]=e[o]);}),t}),_t=typeof Object.getOwnPropertySymbols=="function"?function(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.keys(t)};function Qe(t){return Array.isArray(t)?bt(t.constructor(t.length),t):Ze(t)==="Map"?new Map(t):Ze(t)==="Set"?new Set(t):t&&typeof t=="object"?bt(Object.create(Object.getPrototypeOf(t)),t):t}var An=(function(){function t(){this.commands=bt({},Er),this.update=this.update.bind(this),this.update.extend=this.extend=this.extend.bind(this),this.update.isEquals=function(e,o){return e===o},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,o){this.commands[e]=o;},t.prototype.update=function(e,o){var r=this,a=typeof o=="function"?{$apply:o}:o;Array.isArray(e)&&Array.isArray(a)||Le(!Array.isArray(a),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."}),Le(typeof a=="object"&&a!==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(r.commands).join(", ")+".")});var s=e;return _t(a).forEach(function(i){if(Nt.call(r.commands,i)){var m=e===s;s=r.commands[i](a[i],s,a,e),m&&r.isEquals(s,e)&&(s=e);}else {var d=Ze(e)==="Map"?r.update(e.get(i),a[i]):r.update(e[i],a[i]),c=Ze(s)==="Map"?s.get(i):s[i];(!r.isEquals(d,c)||typeof d=="undefined"&&!Nt.call(e,i))&&(s===e&&(s=Qe(e)),Ze(s)==="Map"?s.set(i,d):s[i]=d);}}),s},t})();ze.Context=An;var Er={$push:function(t,e,o){return Ln(e,o,"$push"),t.length?e.concat(t):e},$unshift:function(t,e,o){return Ln(e,o,"$unshift"),t.length?t.concat(e):e},$splice:function(t,e,o,r){return kr(e,o),t.forEach(function(a){On(a),e===r&&a.length&&(e=Qe(r)),Rr.apply(e,a);}),e},$set:function(t,e,o){return Br(o),t},$toggle:function(t,e){dt(t,"$toggle");var o=t.length?Qe(e):e;return t.forEach(function(r){o[r]=!e[r];}),o},$unset:function(t,e,o,r){return dt(t,"$unset"),t.forEach(function(a){Object.hasOwnProperty.call(e,a)&&(e===r&&(e=Qe(r)),delete e[a]);}),e},$add:function(t,e,o,r){return Vn(e,"$add"),dt(t,"$add"),Ze(e)==="Map"?t.forEach(function(a){var s=a[0],i=a[1];e===r&&e.get(s)!==i&&(e=Qe(r)),e.set(s,i);}):t.forEach(function(a){e===r&&!e.has(a)&&(e=Qe(r)),e.add(a);}),e},$remove:function(t,e,o,r){return Vn(e,"$remove"),dt(t,"$remove"),t.forEach(function(a){e===r&&e.has(a)&&(e=Qe(r)),e.delete(a);}),e},$merge:function(t,e,o,r){return Nr(e,t),_t(t).forEach(function(a){t[a]!==e[a]&&(e===r&&(e=Qe(r)),e[a]=t[a]);}),e},$apply:function(t,e){return Mr(t),t(e)}},Lt=new An;ze.isEquals=Lt.update.isEquals;ze.extend=Lt.extend;ze.default=Lt.update;ze.default.default=Un.exports=bt(ze.default,ze);function Ln(t,e,o){Le(Array.isArray(t),function(){return "update(): expected target of "+Ae(o)+" to be an array; got "+Ae(t)+"."}),dt(e[o],o);}function dt(t,e){Le(Array.isArray(t),function(){return "update(): expected spec of "+Ae(e)+" to be an array; got "+Ae(t)+". Did you forget to wrap your parameter in an array?"});}function kr(t,e){Le(Array.isArray(t),function(){return "Expected $splice target to be an array; got "+Ae(t)}),On(e.$splice);}function On(t){Le(Array.isArray(t),function(){return "update(): expected spec of $splice to be an array of arrays; got "+Ae(t)+". Did you forget to wrap your parameters in an array?"});}function Mr(t){Le(typeof t=="function",function(){return "update(): expected spec of $apply to be a function; got "+Ae(t)+"."});}function Br(t){Le(Object.keys(t).length===1,function(){return "Cannot have more than one key in an object with $set"});}function Nr(t,e){Le(e&&typeof e=="object",function(){return "update(): $merge expects a spec of type 'object'; got "+Ae(e)}),Le(t&&typeof t=="object",function(){return "update(): $merge expects a target of type 'object'; got "+Ae(t)});}function Vn(t,e){var o=Ze(t);Le(o==="Map"||o==="Set",function(){return "update(): "+Ae(e)+" expects a target of type Set or Map; got "+Ae(o)});}});var pr=c(Wn());var Gn=withTranslation()(memo(function(e){let{id:o,tabId:r,panelId:a,context:s,methodProvider:i,widgetsState:m}=e,d=i.findRowItem(r,a,o);return d?Se__default.createElement("div",{className:"row-container"},(d.item._children||[]).map(({rowId:c,id:b,component:F,properties:f})=>Se__default.createElement(Oe.getFormComponent(F,f),{key:"key_"+b,tabId:r,panelId:a,rowId:c,segmentId:b,properties:f,widgetsState:m,methodProvider:i,context:{...s},segmentsCount:d.item._children.length},null))):null}));Gn.displayName="_Rowcontainer";var zn=Gn;var qn=withTranslation()(memo(function(e){let{tabId:o,panelId:r,rowId:a,segmentId:s,segmentsCount:i,properties:m,methodProvider:d,context:c,widgetsState:b}=e,F=d.findSegmentItem(o,r,a,s),f={...m.style};return Se__default.createElement("div",{className:"rowSegment",style:f},(F.item._children||[]).map(({id:p,component:u,properties:h})=>{let w=h.groupname?h.groupname:h.name;return Se__default.createElement(Oe.getFormComponent(u,h),{key:"key_"+p,context:{params:c.params,displayButtonLoader:c.displayButtonLoader,doValidateForm:c.doValidateForm,redrawComponent:c.redrawComponent,formDimension:c.formDimension,segmentDimensions:{minWidth:parseInt(f.minWidth)},tabIndex:c.tabIndex,formData:u.displayName==="_Fileuploader"||u.displayName==="_Label"||u.displayName==="_View"||u.displayName==="_Textinput"&&h.inputtype==="currency"?c.formData:[]},id:p,methodProvider:d,panelId:r,properties:{...h,visible:b!==void 0&&b.visibility[w]!==void 0?b.visibility[w]:h.visible,readonly:b!==void 0&&b.readonly[w]!==void 0?b.readonly[w]:h.readonly},rowId:a,segmentId:s,segmentsCount:i,tabId:o,value:c.formData!==void 0?c.formData[w]:void 0,fieldAllowedValues:c!=null&&c.fieldAllowedValues?c.fieldAllowedValues[w]:void 0,validationMessage:c!=null&&c.formValidationData&&c.formValidationData[w]!==void 0?c.formValidationData[w]:null},null)}))}));qn.displayName="_Rowsegment";var Jn=qn;function qr(t,e){return {id:t,value:e}}var Qn=withTranslation()(memo(function(e){var V;let o=useRef(null),{datalength:r,id:a,forcereadonly:s,ignorereadonly:i,label:m,name:d,onchangehandler:c,placeholder:b$1,readonly:F,regex:f,searchbar:p,size:u,style:h,tabIndex:w,uppercasemode:I,variant:S,visible:v}=e.properties,E=useLocation(),{viewPort:W}=b(),{tabId:_}=e,[R,y]=useState(String((V=e.value)!=null?V:"")),[g,U$1]=Se__default.useState([]),Z=!!(R.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{var D;y(String((D=e.value)!=null?D:""));},[e.value]),useEffect(()=>{let D=[];if(e.fieldAllowedValues){for(let H in e.fieldAllowedValues)D.push(qr(H,e.fieldAllowedValues[H]));U$1(D);}},[e.fieldAllowedValues]);let te=D=>{var H;e.methodProvider.eventDispatcher({widgetName:d,widgetValue:D,widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:E.pathname,parentWidgetId:_,hasParentForm:T.hasParentForm(),originator:(H=e.context.params)==null?void 0:H.originator})});},T$1=D=>{y(D);};return jsx(n,{autoFocus:false,data:g,disabled:!!(F&&!i),error:Z,helperText:Z?e.validationMessage:"",id:a,inputProps:{id:a,tabIndex:w,style:{...h},autoComplete:nanoid(5)},InputProps:{},inputRef:o,label:m,maxCharCount:r,name:d,onBlur:D=>{te(D.target.value);},onInput:D=>{T$1(D.target.value),W.isMobileDevice&&te(D.currentTarget.value);},onChange:D=>{R.trim()===""&&te(D.target.value);},placeholder:b$1,readOnly:!!(F&&!i),regEx:f,searchBar:p,size:u!=null?u:"small",type:"text",inputtype:e.properties.inputType,toUpperCase:I,value:R,variant:S,visible:v})}));Qn.displayName="_Input";var Kn=Qn;var Yn=withTranslation()(memo(function(e){var D;let o=useRef(null),{datalength:r,id:a,forcereadonly:s,ignorereadonly:i$1,label:m,name:d,onchangehandler:c,placeholder:b$1,readonly:F,regex:f,size:p,style:u,tabIndex:h,uppercasemode:w,variant:I,visible:S}=e.properties,v=useLocation(),{viewPort:E}=b(),{tabId:W}=e,[_,R]=useState(String((D=e.value)!=null?D:"")),y=!!(_.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm),[g,U$1]=useState(false),{t:Z}=useTranslation(),te=()=>{navigator.clipboard.writeText(_).then(()=>{U$1(true),setTimeout(()=>U$1(false),2e4);});};useEffect(()=>{var H;R(String((H=e.value)!=null?H:""));},[e.value]);let T$1=H=>{var Q;e.methodProvider.eventDispatcher({widgetName:d,widgetValue:H,widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:v.pathname,parentWidgetId:W,hasParentForm:T.hasParentForm(),originator:(Q=e.context.params)==null?void 0:Q.originator})});},V=H=>{R(H);};return jsxs(er,{display:"flex",alignItems:"flex-start",gap:0,children:[jsx(n,{autoFocus:false,disabled:!!(F&&!i$1),error:y,helperText:y?e.validationMessage:"",id:a,inputProps:{id:a,tabIndex:h,style:{...u},autoComplete:nanoid(5)},InputProps:{},inputRef:o,label:m,maxCharCount:r,name:d,onBlur:H=>{T$1(H.target.value);},onInput:H=>{V(H.target.value),E.isMobileDevice&&T$1(H.currentTarget.value);},onChange:H=>{_.trim()===""&&T$1(H.target.value);},placeholder:b$1,readOnly:!!(F&&!i$1),regEx:f,size:p,type:"text",inputtype:e.properties.inputType,toUpperCase:w,value:_,variant:I,visible:S}),S&&jsx(ni,{title:Z(g?"copied!":"copy to clipboard"),children:jsx(oi,{variant:"contained",style:{backgroundColor:"#C0C0C0",borderRadius:"0px 4px 4px 0px",boxShadow:"none",marginLeft:"-3px",border:"2px solid #C0C0C0",lineHeight:"24px",fontSize:"11px"},onClick:te,startIcon:jsx(i,{}),children:Z("copy")})})]})}));Yn.displayName="_InputWCopy";var Zn=Yn;var ta=withTranslation()(memo(function(e){useRef(null);let {tabId:r,id:a,context:s,widgetsState:i}=e,m=e.methodProvider.findWidgetItem(a),d=e.methodProvider.getActiveTabIndex(r,a),c=(f,p,u,h)=>{p||(f.target.style.background=h,f.target.style.color=u);},b=(f,p,u,h)=>{p||(f.target.style.background=h,f.target.style.color=u);},F=({children:f,...p})=>jsx(A,{onPointerUp:u=>u.stopPropagation(),onMouseOver:u=>c(u,p.selected,p.item_active_color,p.item_active_background_color),onMouseOut:u=>b(u,p.selected,p.item_default_color,p.item_default_background_color),style:{borderRadius:"5px 5px 0 0",marginRight:"1px",color:p.selected?p.item_active_color:p.item_default_color,background:p.selected?p.item_active_background_color:p.item_default_background_color,fontSize:p.item_fontsize,fontWeight:p.item_fontweight},selected:p.selected,children:f},p.id);return F.tabsRole="Tab",e.properties.visible?Se__default.createElement("div",{className:"form-tab-widget"},jsxs(y,{selectedIndex:d,onSelect:f=>e.methodProvider.setActiveTabIndex(r,a,f),children:[jsx(z,{children:(m.item._children||[]).map(({properties:f},p)=>!f.item_visible||i&&i.visibility&&i.visibility[f.item_name]===false?null:createElement(F,{...m.item.properties.tabsetup,...f,key:"TabCaptionComponent_"+a+"_"+p},f.item_title))}),(m.item._children||[]).map(({_children:f},p)=>jsx(B,{children:(f||[]).map(({tabId:u,panelId:h,id:w,type:I,component:S,properties:v},E)=>Se__default.createElement(Oe.getFormComponent(S,v),{key:"tabSubPanel_"+E,id:w,tabId:u,panelId:h,properties:{...v,visible:i!==void 0&&i.visibility[v.name]!==void 0?i.visibility[v.name]:v.visible,readonly:i!==void 0&&i.readonly[v.name]!==void 0?i.readonly[v.name]:v.readonly},className:I,widgetsState:i,methodProvider:e.methodProvider,context:{...s},segmentsCount:m.item._children.length,fieldAllowedValues:s!=null&&s.fieldAllowedValues?s.fieldAllowedValues[v.name]:void 0},null))},"TabPanel_"+a+"_"+p))]})):null}));ta.displayName="_TabBox";var oa=ta;function ui(t,e){if(!e||Array.isArray(e)&&e.length===0)return t;let o=e;return t.replace(/<b>@(\w+)<\/b>|@(\w+)/g,(r,a,s)=>{let i=(a||s).toLowerCase(),m=o[i];return typeof m=="string"?a?`<b>${m}</b>`:m:r})}var aa=withTranslation()(memo(function(e){let{title:o,style:r,verticalalign:a,visible:s}=e.properties,i={paddingTop:"0px"};if(a==="bottom"&&(i.paddingTop="10px"),!s)return null;let m=ui(o,e.context.formData);return jsx("div",{style:{...r,...i},children:jsx("div",{style:{...r},dangerouslySetInnerHTML:{__html:m}})})}));aa.displayName="_Label";var ra=aa;var la=withTranslation()(memo(function(e$1){let o=useRef(null),{defaultvalue:r,id:a,ignorereadonly:s,label:i,labelplacement:m,name:d,onchangehandler:c,readonly:b,style:F,tabIndex:f,visible:p}=e$1.properties,u=d,h=e$1.value||"",w=useLocation(),{tabId:I}=e$1,S=!!(!h&&e$1.validationMessage!=null&&e$1.context.doValidateForm);return useEffect(()=>{!e$1.value&&r&&e$1.methodProvider.eventDispatcher({widgetName:u,widgetValue:e$1.properties.value,widgetEvent:null,widgetContext:JSON.stringify({referer:w.pathname,parentWidgetId:I,hasParentForm:T.hasParentForm()})});},[]),jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:F.textAlign,height:"100%"},children:jsx(e,{checkedIcon:void 0,defaultChecked:!!(e$1.value===void 0&&r),disabled:!!(b&&!s),error:S,helperText:S?e$1.validationMessage:"",icon:void 0,inputProps:{id:a,tabIndex:f},inputRef:o,labelText:i,labelPlacement:m,name:u,onChange:v=>{e$1.methodProvider.eventDispatcher({widgetName:u,widgetValue:v.target.checked?e$1.properties.value:"",widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:w.pathname,parentWidgetId:I,hasParentForm:T.hasParentForm()})});},selectedValue:h,value:e$1.properties.value,visible:p})})}));la.displayName="_Checkbox";var da=la;var ma=withTranslation()(memo(function(e){let o=useRef(null),{defaultvalue:r,groupname:a,id:s,ignorereadonly:i,label:m,labelplacement:d,name:c,onchangehandler:b,readonly:F,style:f,tabIndex:p,visible:u}=e.properties,h=useLocation(),{tabId:w}=e,I=a||c;let v=e.value||"",E=!!(e.validationMessage!=null&&e.context.doValidateForm),W=_=>{var R;e.methodProvider.eventDispatcher({widgetName:I,widgetValue:_,widgetEvent:b?U.onChange:null,widgetContext:JSON.stringify({referer:h.pathname,parentWidgetId:w,hasParentForm:T.hasParentForm(),originator:(R=e.context.params)==null?void 0:R.originator})});};return useEffect(()=>{!v&&r&&W(e.properties.value);},[]),jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:f.textAlign,height:"100%"},children:jsx(k,{defaultValue:r?e.properties.value:"",disabled:!!(F&&!i),inputProps:{id:s,tabIndex:p,style:{...f}},error:E,helperText:E?e.validationMessage:"",inputRef:o,labelText:m,labelPlacement:d,name:I,onChange:_=>{v!==_.target.value.trim()&&W(_.target.value);},selectedValue:v,value:e.properties.value,visible:u})})}));ma.displayName="_Radio";var ca=ma;var ua=withTranslation()(memo(function(e){var te;let o=useRef(null),{runFormEvent:r,viewPort:a}=b(),{id:s,autocompleteTextArea:i,ignorereadonly:m,label:d,name:c,onchangehandler:b$1,placeholder:F,required:f,requiredmessage:p,readonly:u,size:h,style:w,tabIndex:I,variant:S,visible:v}=e.properties,E=useLocation(),{tabId:W}=e,[_,R]=useState(String((te=e.value)!=null?te:""));useEffect(()=>{var T;R(String((T=e.value)!=null?T:""));},[e.value]);let y=!!(_.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm),g=T$1=>{var V;e.methodProvider.eventDispatcher({widgetName:c,widgetValue:T$1,widgetEvent:b$1?U.onChange:null,widgetContext:JSON.stringify({referer:E.pathname,parentWidgetId:W,hasParentForm:T.hasParentForm(),originator:(V=e.context.params)==null?void 0:V.originator})});},U$1=async T=>{var V,D,H;try{let Q=await r({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:(V=e.context.formData)!=null?V:{},widgetContext:JSON.stringify({}),widgetEvent:U.onGetCustomResponse,widgetName:c,widgetValue:JSON.stringify({methodName:"getAutoCompleteData",value:T})});if(((D=Q.meta)==null?void 0:D.requestStatus)==="fulfilled"){let B=Q.payload,k=(H=B==null?void 0:B.FECommand)==null?void 0:H.CustomResponse;if(Array.isArray(k))return k.filter(q=>typeof q=="string").map(q=>({label:q}))}}catch(Q){}return []},Z=T=>{R(T);};return jsx(n,{autocompleteTextArea:i,autoFocus:false,disabled:!!(u&&!m),id:s,inputProps:{id:s,tabIndex:I,readOnly:!!(u&&!m),style:{...w}},error:y,helperText:y?e.validationMessage:"",InputProps:{},inputRef:o,label:d,multiline:true,name:c,onAutoCompleteChange:i?T=>U$1(T):void 0,onBlur:T=>{g(T.target.value);},onInput:T=>{Z(T.target.value),a.isMobileDevice&&g(T.currentTarget.value);},onChange:T=>{_.trim()===""&&g(T.target.value);},placeholder:F,readOnly:!!(u&&!m),size:h,type:"text",value:_,variant:S,visible:v})}));ua.displayName="_Textarea";var fa=ua;function pa(t,e){return {id:t,value:e}}var Ut="\xA4",ga=withTranslation()(memo(function(e){var D,H;let o=useRef(null),[r,a]=Se__default.useState(null),[s,i]=Se__default.useState([]),m=typeof e.value=="string"&&e.value!=null&&e.value.length>0?e.value.split(Ut):[],[d,c]=Se__default.useState(m),{id:b,ignorereadonly:F,label:f,multiple:p,name:u,onchangehandler:h,placeholder:w,readonly:I,rendertype:S,searchbar:v,size:E,tabIndex:W,variant:_,visible:R,dropvalues:y}=e.properties,g=useLocation(),{tabId:U$1}=e,{t:Z}=useTranslation();useEffect(()=>{let Q=typeof e.value=="string"&&e.value!=null&&e.value.length>0?e.value.split(Ut):[];c(Q);},[e.value]),useEffect(()=>{let Q=S==="none"?[{id:"",value:""}]:[];if(e.fieldAllowedValues&&Object.keys(e.fieldAllowedValues).length>0){for(let B in e.fieldAllowedValues)Q.push(pa(B,e.fieldAllowedValues[B]));i(Q);}else if(y&&Array.isArray(y)&&y.length>0){for(let B of y)typeof B=="object"&&B!==null&&Q.push(pa(B.id||"",B.value||""));i(Q);}},[e.fieldAllowedValues,y]),useEffect(()=>{var Q;if(r===false){let B=typeof e.value!="string"?e.value:[];(JSON.stringify(B)!==JSON.stringify(d)||d.length===0)&&e.methodProvider.eventDispatcher({widgetName:u,widgetValue:d.length>0?d.join(Ut):[],widgetEvent:h?U.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:U$1,hasParentForm:T.hasParentForm(),originator:(Q=e.context.params)==null?void 0:Q.originator,folderData:e.context.params.folderData})});}},[r]);let te=Q=>{let{target:{value:B}}=Q,k;p?k=typeof B=="string"?B.split(","):B:k=typeof B=="string"?[B]:B,c(k);},T$1=e.context.formDimension.width/e.segmentsCount;T$1=T$1<e.context.segmentDimensions.minWidth?e.context.segmentDimensions.minWidth:T$1-60;let V=!!(d.length===0&&e.validationMessage!=null&&e.context.doValidateForm);return jsx(l,{darkMode:false,data:s,error:V,helperText:V?e.validationMessage:"",inputProps:{tabIndex:W,style:{maxWidth:`${T$1}px`}},inputRef:o,onOpen:()=>{a(true);},onClose:()=>{a(false);},onChange:te,id:b,label:f,multiple:p,placeholder:w,readOnly:I&&!F,renderType:S,noOptionsText:(H=(D=e.properties)==null?void 0:D.noOptionsLabel)!=null?H:Z("No options"),searchBar:v,selectDisplayProps:{style:{maxWidth:"100%",whiteSpace:S==="chip"?"normal":"nowrap"}},selectedValue:d,size:E,variant:_,width:"auto",visible:R})}));ga.displayName="_SelectBox";var ha=ga;var ba=withTranslation()(memo(function(e){var m;let{style:o,visible:r}=(m=e.properties)!=null?m:{},[a,s]=useState(false);if(useEffect(()=>{s(true);},[]),!a)return null;let i="form-widget form-placeholder-widget";return r||(i+=" visibilityOff"),jsx("div",{className:i,style:{...o,display:"flex",alignItems:"center",justifyContent:"center",width:"100%",textAlign:"center"}})}));ba.displayName="_Placeholder";var va=ba;var ya=createContext({});function wa(){return useContext(ya)}var xa=ya;var Yi=lazy(()=>import('./fileviewer-73OY3DUG.js'));function Zi(){let[,t]=useState(0);return ()=>t(e=>e+1)}var Ta=withTranslation()(memo(function(e){var Fe,ge;Zi();let [r,a]=useState([]),[s,i]=useState(e.context.params),[m,d$1]=useState(false),[c,b$2]=useState(null),[F,f]=useState(false),[p$1,u]=useState(null),[h,w]=useState(0),{t:I}=useTranslation(),{iframeMode:S}=a$1(),v=wa(),E=X=>{var G;return (G=v[X])!=null?G:I(X)},{UserDialog:W}=b$1(),_=d(),{style:R,readonly:y,visible:g}=e.properties,[U$1,Z]=useState({showDialog:false,dialogTitle:"",dialogContent:"",buttonAgree:"",buttonDisagree:"",callBackFunc:()=>{}}),{appSettings:te,viewPort:T$1,runFormDeleteFileEvent:V,runFormDownloadFileEvent:D,runFormGetLinkedFileEvent:H,runFormGetLinkedFileMetaEvent:Q,runFormUploadFiles:B}=b();useEffect(()=>{i(e.context.params);},[e.context.params]),useEffect(()=>{let X=e.value?JSON.parse(e.value):[];return X&&(a(k(X,100)),d$1(true)),()=>{r&&(d$1(false),r.forEach(G=>{G.preview&&URL.revokeObjectURL(G.preview);}));}},[]);let k=(X,G)=>{let M=[];return X.forEach((ee,O)=>{let Te=new File([],ee,{type:"image/jpeg"});Object.assign(Te,{preview:null,uploadProgress:G}),M.push(Te);}),M},q=useCallback(async X=>{var n;let M=(await Q({...s,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:X,context:{action:"Preview"}})).payload,{linkedFileSize:ee,linkedFileName:O,mimeType:Te}=M;if(!ee)throw new Error("File data or metadata is missing");let ve=(n=te==null?void 0:te.MAX_DOWNLOAD_NOCHUNK_FILESIZE)!=null?n:i$1.MAX_DOWNLOAD_NOCHUNK_FILESIZE;return ee>ve?{type:"formbuilder/getlinkedfile",payload:{linkedFile:null,linkedFileSize:ee,linkedFileName:O},meta:{requestStatus:"fulfilled"}}:await H({...s,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:X,context:{action:"Load"}})},[s,e.context.params.pGuid,e.properties.name]),re=X=>{U$1.callBackFunc(X);},pe=async(X,G)=>{X&&await V({...e.context.params,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:G}).then(M=>{if(M.meta.requestStatus==="fulfilled"){let ee={...M.payload};ee.linkedFileDeleteSuccess&&(_({toastID:nanoid(11),msg:E("The file has been successfully deleted"),clearQueue:false,hideProgressBar:false}),a(O=>O.filter(Te=>Te.name!==G)),e.methodProvider.eventDispatcher({widgetName:e.properties.name,widgetValue:JSON.stringify(ee.linkedFiles),widgetEvent:null,widgetContext:null}));}}),Z({...U$1,showDialog:false,callBackFunc:M=>{}});},Ie=async X=>{if(X)try{let G=await D({...e.context.params,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:X}),M=new Blob([G]),ee=window.URL.createObjectURL(M),O=document.createElement("a");O.href=ee,O.setAttribute("download",X.split("/").pop()||"downloadedFile"),document.body.appendChild(O),O.click(),document.body.removeChild(O),window.URL.revokeObjectURL(ee);}catch(G){}},se=useCallback(async(X,G)=>(G&&Z({showDialog:true,dialogTitle:E("Confirmation"),dialogContent:E("Are you sure you want to delete file?"),buttonAgree:E("Continue"),buttonDisagree:E("Close"),callBackFunc:M=>pe(M,G)}),null),[e.context.params,I,v]),A=useCallback(async(X,G)=>(G&&Ie(G),null),[e.context.params]),ce=useCallback((X,G)=>{G&&startTransition(()=>{b$2(G);});},[]),K=()=>{b$2(null);},ue=useCallback(async(X,G)=>{var M,ee;if(X){let O=new FormData;for(let n in e.context.params)e.context.params.hasOwnProperty(n)&&O.append(n,e.context.params[n]);O.append("fieldName",e.properties.name),X.forEach(n=>{O.append("files",n);}),O.append("widgetContext",JSON.stringify({hasParentForm:T.hasParentForm(),originator:(M=e.context.params)==null?void 0:M.originator,folderData:(ee=e.context.params)==null?void 0:ee.folderData})),O.append("widgetEvent",U.onFileUploadEvent),O.append("widgetName",e.properties.name),O.append("formData",JSON.stringify({...e.context.formData}));let Te=Gi.CancelToken.source(),ve=X.map(n=>Object.assign(n,{preview:URL.createObjectURL(n),uploadProgress:0}));a(r.concat(ve)),u(0),await B({content:O,cancelTokenSource:Te,onUploadProgress:n=>{let ae=n.total?Math.round(n.loaded*100/n.total):0;u(ae);}}).then(n=>{var ie,Ue,qe;let ae=[];if(n.meta.requestStatus==="fulfilled"){let we={...n.payload};if((ie=we.FECommand)!=null&&ie.FormValidationData&&Object.keys(we.FECommand.FormValidationData).length>0){ve.forEach(ye=>{ye.preview&&URL.revokeObjectURL(ye.preview);}),u(null),w(ye=>ye+1);let rt=r.filter(ye=>ye.uploadProgress===100);a(rt),e.methodProvider.eventDispatcher({widgetName:e.properties.name,widgetValue:JSON.stringify(r),widgetEvent:null,widgetContext:null,feCommand:we.FECommand});}else if(we.linkedFiles&&e.properties.name){ae=k(we.linkedFiles,100);let rt=ae.map(ye=>{let it=ye;return it.uploadProgress=100,it.preview=null,it});ve.forEach(ye=>{ye.preview&&URL.revokeObjectURL(ye.preview);}),u(null),w(ye=>ye+1),a(rt),i({...e.context.params,guid:(qe=(Ue=we.FECommand)==null?void 0:Ue.ReplaceContextRecordGuid)==null?void 0:qe.guid}),we.FECommand={...we.FECommand,UpdateFieldAllowedValues:we.fieldAllowedValues,UpdateFormData:we.data},e.methodProvider.execCommands(we.FECommand);}}});}},[r,e.context.params,e.methodProvider,e.properties.name,e.value]);return !m||!g?null:jsxs("div",{style:{...R,lineHeight:"1.1em"},children:[jsx(W,{...U$1,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:I("File upload is available only when using the SDK")}),jsx(p,{defaultText:(ge=(Fe=e.properties)==null?void 0:Fe.dragDropLabel)!=null?ge:E("Drag and Drop..."),tryGetLinkedFile:q,onDeleteButtonPress:se,onDownloadButtonPress:A,onDownloadText:E("Download"),onDeleteText:E("Delete"),filesData:r,onDragText:"On drop text",onFilesDrop:ue,onPreviewButtonPress:ce,isMobileDevice:T$1.isMobileDevice,isReadonly:y},h),p$1!==null&&jsx(Xi,{variant:"determinate",value:p$1,style:{marginTop:6,borderRadius:3,height:8}})]}),c!=null&&jsx(Suspense,{fallback:jsx(Ki,{}),children:jsx(Yi,{fileId:c,fileBase64:null,fieldName:e.properties.name,params:{...e.context.params,modalCloseFn:K}},nanoid(11))})]})}));Ta.displayName="_Fileuploader";var Da=Ta;var Pa=(t,e)=>"#"+t.replace(/^#/,"").replace(/../g,o=>("0"+Math.min(255,Math.max(0,parseInt(o,16)+e)).toString(16)).substring(-2)),Sa=withTranslation()(memo(function(e){var I,S;let{buttontype:o$1,colorSchema:r,fullWidth:a,name:s,style:i,tabIndex:m,title:d,variant:c,visible:b}=e.properties,F=useLocation(),{tabId:f}=e,p=(S=(I=e.context)==null?void 0:I.displayButtonLoader)!=null?S:false;if(!b)return null;let u=i.backgroundColor,h=u?Pa(u,-50):"";r&&(u=r+".main",h=r+".hover");let w={};return c==="outlined"?(Object.assign(w,{"&.MuiButtonBase-root":{fontSize:i.fontSize,fontWeight:i.fontWeight,border:"1px solid"+u,cursor:"pointer"}}),Object.assign(w,{"&.MuiButtonBase-root:hover":{border:h?"1px solid"+Pa(h,-50):""}})):(Object.assign(w,{"&.MuiButtonBase-root":{fontSize:i.fontSize,fontWeight:i.fontWeight,backgroundColor:u,cursor:"pointer"}}),Object.assign(w,{"&.MuiButtonBase-root:hover":{backgroundColor:h}})),jsx("div",{children:jsx(o,{variant:c,label:d,loading:p,onPointerUp:()=>{var v,E;e.methodProvider.eventDispatcher({widgetName:s,widgetValue:null,widgetEvent:U.getFormButtonEvent(o$1),widgetContext:JSON.stringify({referer:F.pathname,parentWidgetId:f,hasParentForm:T.hasParentForm(),originator:(v=e.context.params)==null?void 0:v.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:(E=e.context.params)==null?void 0:E.folderData})});},fullWidth:a,sx:w,tabIndex:m})})}));Sa.displayName="_Button";var Ea=Sa;var Ba=withTranslation()(memo(function(e){var W,_,R;let o=useRef(null),r=useRef(false),{id:a,ignorereadonly:s,defaultvalue:i,dateformat:m,label:d,name:c,onchangehandler:b,readonly:F,size:f$1,tabIndex:p,variant:u,visible:h}=e.properties,w=useLocation(),{tabId:I}=e,S=!!(!e.value&&e.validationMessage!=null&&e.context.doValidateForm),v=y=>{var g;return e.methodProvider.eventDispatcher({widgetName:c,widgetValue:y!=null?y:"",widgetEvent:b?U.onChange:null,widgetContext:JSON.stringify({referer:w.pathname,parentWidgetId:I,hasParentForm:T.hasParentForm(),originator:(g=e.context.params)==null?void 0:g.originator})})};useEffect(()=>{!e.value&&i==="today"&&v(a$2().utc().format());},[]);let E=(_=(W=e==null?void 0:e.i18n)==null?void 0:W.language)==null?void 0:_.substr(0,2);return jsx("div",{onFocus:()=>{r.current=true;},children:jsx(f,{id:a,defaultvalue:i,disabled:!!(F&&!s),error:S,format:m!==void 0&&m!==""&&m!=null?m:void 0,helperText:S?e.validationMessage:"",inputRef:o,label:d,locale:E,name:c,onBlur:y=>{if(!y){if(!r.current)return;v(null);return}r.current=true;let g=a$2(y);g.isValid()&&v(g.toISOString());},size:f$1,type:"datepicker",value:(R=e.value)!=null?R:"",variant:u,visible:h})})}));Ba.displayName="_Textinput";var Na=Ba;var La=withTranslation()(memo(function(e){var _,R,y;let o=useRef(null),{id:r,ignorereadonly:a,defaultvalue:s,dateformat:i,label:m,name:d,onchangehandler:c,readonly:b,size:F,tabIndex:f,variant:p,visible:u}=e.properties,h=useLocation(),{tabId:w}=e,[I,S]=useState(String((_=e.value)!=null?_:"")),v=!!(!I&&e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{var g;S(String((g=e.value)!=null?g:""));},[e.value]);let E=g=>{var U$1;return S(g),e.methodProvider.eventDispatcher({widgetName:d,widgetValue:g!=null?g:"",widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:h.pathname,parentWidgetId:w,hasParentForm:T.hasParentForm(),originator:(U$1=e.context.params)==null?void 0:U$1.originator})})};useEffect(()=>{if(!e.value&&s){let g=s==="now"?a$2().utc().format():s==="start of day"?a$2().startOf("day").utc().format():null;g&&E(g);}},[]);let W=(y=(R=e==null?void 0:e.i18n)==null?void 0:R.language)==null?void 0:y.substr(0,2);return jsx(g,{autoFocus:false,defaultvalue:s,disabled:!!(b&&!a),error:v,format:i!==void 0&&i!==""&&i!=null?i:void 0,helperText:v?e.validationMessage:"",id:r,inputRef:o,label:m,locale:W,name:d,onChange:g=>{if(!g){E(null);return}let U=a$2(g);U.isValid()&&E(U.toISOString());},size:F,value:I,variant:p,visible:u})}));La.displayName="_Textinput";var Va=La;var Aa=withTranslation()(memo(function(e){var E,W,_;let o=useRef(null),{id:r,ignorereadonly:a,defaultvalue:s,dateformat:i,label:m,name:d,onchangehandler:c,readonly:b,size:F,tabIndex:f,variant:p,visible:u}=e.properties,h$1=useLocation(),{tabId:w}=e,I=!!(!e.value&&e.validationMessage!=null&&e.context.doValidateForm),S=R=>{var y;return e.methodProvider.eventDispatcher({widgetName:d,widgetValue:R!=null?R:"",widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:h$1.pathname,parentWidgetId:w,hasParentForm:T.hasParentForm(),originator:(y=e.context.params)==null?void 0:y.originator})})};useEffect(()=>{!e.value&&s==="now"&&S(a$2().utc().format());},[]);let v=(W=(E=e==null?void 0:e.i18n)==null?void 0:E.language)==null?void 0:W.substr(0,2);return jsx(h,{id:r,defaultvalue:s,disabled:!!(b&&!a),error:I,format:i!==void 0&&i!==""&&i!=null?i:void 0,helperText:I?e.validationMessage:"",inputRef:o,label:m,locale:v,name:d,onBlur:R=>{S(R?a$2(R).utc().format():null);},size:F,type:"datetimepicker",value:(_=e.value)!=null?_:"",variant:p,visible:u})}));Aa.displayName="_Textinput";var Oa=Aa;var Ua=withTranslation()(memo(function(e){var T$1;let o=useRef(null),{datalength:r,id:a,forcereadonly:s,ignorereadonly:i,label:m,name:d,onchangehandler:c,placeholder:b$1,phoneformat:F,readonly:f,regex:p,size:u,style:h,tabIndex:w,uppercasemode:I,variant:S,visible:v}=e.properties,E=useLocation(),{i18n:W}=useTranslation(),{viewPort:_}=b(),{tabId:R}=e,[y,g]=useState(String((T$1=e.value)!=null?T$1:"")),U$1=!!(e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{e.value!==void 0&&e.value!==null&&g(String(e.value));},[e.value]);let Z=V=>{var D;e.methodProvider.eventDispatcher({widgetName:d,widgetValue:V,widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:E.pathname,parentWidgetId:R,hasParentForm:T.hasParentForm(),originator:(D=e.context.params)==null?void 0:D.originator})});},te=V=>{g(V);};return jsx(n,{autoFocus:false,disabled:!!(f&&!i),error:U$1,helperText:U$1?e.validationMessage:"",id:a,inputProps:{id:a,tabIndex:w,style:{...h}},InputProps:{},inputRef:o,label:m,maxCharCount:r,name:d,onBlur:V=>{Z(V.target.value);},onInput:V=>{te(V.target.value),_.isMobileDevice&&Z(V.currentTarget.value);},placeholder:b$1,locale:W==null?void 0:W.language,phoneFormat:F||void 0,readOnly:!!(f&&!i),regEx:p,size:u!=null?u:"small",type:F?"phone":"text",toUpperCase:I,value:y,variant:S,visible:v})}));Ua.displayName="_PhoneInput";var Wa=Ua;var za=withTranslation()(memo(function(e){var ce;let o=useRef(null),{t:r,i18n:a}=useTranslation(),s=a==null?void 0:a.language,{currency_format:i,currency_assymbol:m,currency_currencydisplay:d,currency_fixedlocale:c,datalength:b$1,id:F,ignorereadonly:f,label:p,name:u,onchangehandler:h,placeholder:w,readonly:I,regex:S,size:v,style:E,tabIndex:W,uppercasemode:_,variant:R,visible:y}=e.properties,g=useLocation(),{viewPort:U$1}=b(),{tabId:Z}=e,[te,T$1]=useState(String((ce=e.value)!=null?ce:"0")),[V,D]=useState(false),[H,Q]=useState(0),B=useRef(0);useEffect(()=>{var K;T$1(String((K=e.value)!=null?K:"0"));},[e.value]),useEffect(()=>{e.validationMessage!=null&&(B.current+=1,D(false));},[e.context.formValidationData]);let k=!!(!V&&e.validationMessage!=null&&e.context.doValidateForm),q=K=>{var ue;e.methodProvider.eventDispatcher({widgetName:u,widgetValue:K,widgetEvent:h?U.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:Z,hasParentForm:T.hasParentForm(),originator:(ue=e.context.params)==null?void 0:ue.originator})});},re=K=>{T$1(K);},pe=i==="fixed-locale"&&c?c:s,Ie=()=>{var Fe;if(d==="")return "";let K=e.context.formData,ue=e.properties.currency_inputfield;return ue&&(K!=null&&K[ue])?K[ue]:e.properties.currency_currency?e.properties.currency_currency:(i==="locale"||i==="fixed-locale")&&(Fe=k$1(pe!=null?pe:""))!=null?Fe:""},se=d==="symbol"?true:d==="code"?false:m!=null?m:false,A=i==="locale"||i==="fixed-locale"?"locale":i!=null?i:"";return jsx(n,{autoFocus:false,currency:Ie(),disabled:!!(I&&!f),error:k,helperText:k?e.validationMessage:"",id:F,inputProps:{id:F,tabIndex:W,style:{...E,textAlign:"right"}},InputProps:{},inputRef:o,label:p,locale:pe,maxCharCount:b$1,name:u,onBlur:K=>{D(true);let ue=K.target.value;(ue==="0"||ue==="")&&Q(Fe=>Fe+1),q(ue);},onInput:K=>{re(K.target.value),U$1.isMobileDevice&&q(K.currentTarget.value);},onChange:K=>{te.trim()===""&&q(K.target.value);},placeholder:w,readOnly:!!(I&&!f),regEx:S,size:v,type:"currency",toUpperCase:_,value:te,variant:R,visible:y,format:A,assymbol:se},H)}));za.displayName="_CurrencyInput";var $a=za;var Ja=withTranslation()(memo(function(e){var Q,B;let o=useRef(null),{t:r,i18n:a}=useTranslation(),s=(Q=a==null?void 0:a.language)==null?void 0:Q.substring(0,2),{datalength:i,id:m,forcereadonly:d,ignorereadonly:c,label:b$1,name:F,onchangehandler:f,placeholder:p,readonly:u,regex:h,size:w,style:I,tabIndex:S,uppercasemode:v,variant:E,visible:W}=e.properties,[_,R]=useState(false),{viewPort:y}=b(),g=useLocation(),{tabId:U$1}=e,[Z,te]=useState(String((B=e.value)!=null?B:"")),T$1=!!(Z.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{var k;te(String((k=e.value)!=null?k:""));},[e.value]);let V=()=>{R(k=>!k);},D=k=>{var q;e.methodProvider.eventDispatcher({widgetName:F,widgetValue:k,widgetEvent:f?U.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:U$1,hasParentForm:T.hasParentForm(),originator:(q=e.context.params)==null?void 0:q.originator})});},H=k=>{te(k);};return jsx(n,{autoFocus:false,disabled:!!(u&&!c),error:T$1,helperText:T$1?e.validationMessage:"",id:m,inputProps:{id:m,tabIndex:S,style:{...I,textAlign:"center"}},InputProps:{endAdornment:jsx(Ol,{position:"end",children:jsx(cr,{onClick:V,edge:"end",children:_?jsx(Ul,{}):jsx(Wl,{})})})},inputRef:o,label:b$1,locale:s,maxCharCount:i,name:F,onBlur:k=>{D(k.target.value);},onInput:k=>{H(k.target.value),y.isMobileDevice&&D(k.currentTarget.value);},onChange:k=>{Z.trim()===""&&D(k.target.value);},placeholder:p,readOnly:!!(u&&!c),regEx:h,size:w,type:"text",toUpperCase:v,value:Z,variant:E,visible:W,inputtype:_?"text":"password"})}));Ja.displayName="_PasswordInput";var ja=Ja;var Xa=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)}})),id=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}})),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":{},"&::before":{content:'""',display:"block",position:"absolute",left:"16px",top:"34px",height:"calc(100% - 36px)",width:"1.5px"}}})),dd=animated($l);function Ya(t){let e=useSpring({to:{opacity:t.in?1:0,transform:`translate3d(0,${t.in?0:20}px,0)`}});return jsx(dd,{style:e,...t})}var sd=styled(ql)({color:"inherit",fontWeight:500});function Za({icon:t,expandable:e,children:o,isFirstRootNode:r,...a}){return jsxs(TreeItem2Label,{...a,sx:{display:"flex",alignItems:"center",fontWeight:r?"700":"normal",backgroundColor:"transparent","&.Mui-focused, &.Mui-selected":{backgroundColor:"transparent"}},children:[t&&jsx(er,{component:t,className:"labelIcon",color:"inherit",sx:{mr:1,fontSize:"1.2rem"}}),jsx(sd,{sx:{fontSize:r?"1rem":"0.9rem",fontWeight:r?"700":"normal"},children:o})]})}var or=t=>Array.isArray(t)?t.length>0&&t.some(or):!!t,Ct=t$1=>{let e=null,o=t$1.action,r=t$1.applyInternalStyle?{fontSize:"1em",marginRight:"0.5em"}:{};return o==="add"?e=jsx(t,{style:r}):o==="edit"?e=jsx(A$1,{style:r}):o==="share"?e=jsx(E,{style:r}):o==="trash"&&(e=jsx(N,{style:r})),e},md=Se.forwardRef(function(e,o){let{id:r,itemId:a,label:s,disabled:i,children:m$1,item:d,index:c,mode:b$1,setSelectedItem:F,treeCheckedItems:f,properties:p,disableRootItem:u,userData:h,formData:w,deletePrompt:I,selectedItem:S,execCommands:v,eventDispatcher:E,...W}=e,{getRootProps:_,getContentProps:R,getIconContainerProps:y,getCheckboxProps:g,getLabelProps:U$1,getGroupTransitionProps:Z,getDragAndDropOverlayProps:te,status:T$1}=unstable_useTreeItem2({id:r,itemId:a,children:m$1,label:s,disabled:i,rootRef:o}),V=useLocation(),{t:D}=useTranslation(),[H,Q]=Se.useState(null),B=!!H,k=or(m$1),q=c===0?void 0:Jl,[re,pe]=Se.useState(T$1.expanded),{runFormEvent:Ie}=b(),se=useCallback(async(M,ee,O,Te,ve,n)=>{var ae,ie,Ue;M&&await Ie({pluginCode:O.params.pluginCode,formCode:"FOLDER",guid:(ae=O.params.folderData)==null?void 0:ae.id,projectGuid:O.params.pGuid,pGuid:O.params.pGuid,widgetContext:JSON.stringify({referer:ve.pathname,parentWidgetId:n,hasParentForm:T.hasParentForm(),originator:(ie=O.params)==null?void 0:ie.originator,parent:O.params,folderData:(Ue=O.params)==null?void 0:Ue.folderData}),widgetEvent:U.onDelete,widgetName:"delete",formData:O.formData}).then(qe=>{if(qe.meta.requestStatus==="fulfilled"){let we={...qe.payload};O.execCommands(we.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]),A=M=>{M.stopPropagation(),pe(ee=>!ee);},ce=M=>{M.stopPropagation(),Q(M.currentTarget);},K=()=>{Q(null);},ue=useCallback(()=>{K();let M="addbtn";return e.eventDispatcher({tabIndex:0,widgetName:M,widgetValue:null,widgetEvent:U.onFolderCreateRecordEvent,widgetContext:JSON.stringify({referer:V.pathname,parentWidgetId:"",hasParentForm:T.hasParentForm(),parentOriginator:{params:e.params.originator?e.params.originator.params:{}},originator:{params:e.params,widgetName:M},parent:{widgetName:M,params:e.params},isModal:true,folderData:e.params.folderData})})},[K,V.pathname,e.params,e.eventDispatcher,T.hasParentForm]),Fe=useCallback(()=>{K();let M="share";return e.eventDispatcher({tabIndex:0,widgetName:M,widgetValue:null,widgetEvent:U.onFolderShareRecordEvent,widgetContext:JSON.stringify({referer:V.pathname,parentWidgetId:"",hasParentForm:T.hasParentForm(),parentOriginator:{params:e.params.originator?e.params.originator.params:{}},originator:{params:{...e.params,guid:e.params.folderData.id},widgetName:M},parent:{widgetName:M,params:e.params},isModal:true,folderData:e.params.folderData})})},[e,V.pathname]),ge=useCallback(()=>{K();let M="edit";return e.eventDispatcher({tabIndex:0,widgetName:M,widgetValue:null,widgetEvent:U.onFolderEditRecordEvent,widgetContext:JSON.stringify({referer:V.pathname,parentWidgetId:"",hasParentForm:T.hasParentForm(),parentOriginator:{params:e.params.originator?e.params.originator.params:{}},originator:{params:e.params,widgetName:M},parent:{widgetName:M,params:e.params},isModal:true,folderData:e.params.folderData})})},[e,V.pathname]),X=useCallback(async M=>{var ee,O;await Ie({pluginCode:e.params.pluginCode,formCode:e.params.formCode,guid:e.params.guid,projectGuid:e.params.pGuid,pGuid:e.params.pGuid,widgetContext:JSON.stringify({referer:V.pathname,parentWidgetId:null,hasParentForm:T.hasParentForm(),originator:(ee=e.params)==null?void 0:ee.originator,parent:e.params,folderData:(O=e.params)==null?void 0:O.folderData}),widgetEvent:U.onRefresh,widgetName:p==null?void 0:p.name,widgetValue:M,formData:w}).then(Te=>{if(Te.meta.requestStatus==="fulfilled"){let ve={...Te.payload};ve.FECommand={...ve.FECommand,UpdateFormData:ve.data},e.execCommands(ve.FECommand);}});},[e,p==null?void 0:p.name,V.pathname]),G=useCallback(()=>{e.deletePrompt({delete:{showDialog:true,dialogTitle:D("Delete")+" ?",dialogContent:D("Are you certain that you wish to delete this folder?"),buttonAgree:D("Continue"),buttonDisagree:D("Close"),callBackFunc:M=>{M?se(M,"delete",e,{},V,""):se(false,"",e,{},V,"");}}});},[e,D,V,se]);if(b$1==="live"){let M=h.rightMode!=="Edit";return jsxs(Xa,{..._(W),sx:{"& > ul":{paddingLeft:"0.2rem",paddingRight:"0.1rem"}},children:[jsxs(id,{...R({className:x("content",{"Mui-expanded":re,"Mui-selected":T$1.selected,"Mui-focused":T$1.focused,"Mui-disabled":T$1.disabled})}),children:[c!==0&&jsxs(Fragment,{children:[jsx(TreeItem2IconContainer,{...y({status:T$1,onPointerUp:A}),children:jsx(TreeItem2Icon,{status:T$1})}),jsx(TreeItem2Checkbox,{...g()})]}),jsx(Za,{...U$1({icon:q,expandable:k&&re,isFirstRootNode:c===0,onClick:ee=>{F&&F(ee,a),ee.stopPropagation();}}),children:s}),!M&&e.selectedItem===a&&c!==0&&jsx(cr,{size:"small",onClick:ce,"aria-controls":B?"menu":void 0,"aria-haspopup":"true","aria-expanded":B?"true":void 0,style:{marginLeft:"auto",color:"#FFF",fontSize:"14px"},children:jsx(m,{})}),jsxs(od,{anchorEl:H,open:B,onClose:K,onClick:ee=>ee.stopPropagation(),slotProps:{paper:{sx:{minWidth:"12em"}}},children:[jsxs(xt,{onClick:ue,children:[jsx(yt,{children:jsx(Ct,{action:"add",applyInternalStyle:true})}),jsx(wt,{primaryTypographyProps:{fontSize:"0.875rem"},children:D("New Folder")})]}),jsxs(xt,{onClick:ge,children:[jsx(yt,{children:jsx(Ct,{action:"edit",applyInternalStyle:true})}),jsx(wt,{children:D("Settings")})]}),jsxs(xt,{onClick:Fe,children:[jsx(yt,{children:jsx(Ct,{action:"share",applyInternalStyle:true})}),jsx(wt,{children:D("Share")})]}),jsxs(xt,{onClick:G,children:[jsx(yt,{children:jsx(Ct,{action:"trash",applyInternalStyle:true})}),jsx(wt,{children:D("Delete")})]})]}),jsx(TreeItem2DragAndDropOverlay,{...te()})]}),m$1&&jsx(Ya,{...Z(),in:re,children:m$1})]})}else {let M=false;return f&&f.length>0&&f.forEach((ee,O)=>{if(ee===a){M=true;return}}),jsxs(Xa,{..._({...W,expandable:false}),sx:{"& > ul":{paddingLeft:"1rem",paddingRight:"0rem"}},children:[jsxs(ld,{...R({className:x("content",{"Mui-expanded":true,"Mui-selected":T$1.selected,"Mui-focused":T$1.focused,"Mui-disabled":T$1.disabled})}),children:[c!==0&&jsx(Fragment,{children:jsx(TreeItem2Checkbox,{id:a,visible:true,checked:M,onPointerUp:ee=>X(a),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(Za,{...U$1({icon:q,expandable:k,isFirstRootNode:c===0}),children:s}),jsx(TreeItem2DragAndDropOverlay,{...te()})]}),m$1&&jsx(Ya,{...Z(),in:true,children:m$1})]})}}),cd=t=>{let e=[],o=r=>{r.forEach(a=>{a.children&&a.children.length>0&&(e.push(a.id),o(a.children));});};return o(t),e},ud=(t,e)=>{let o=(r,a)=>{for(let s of r)if(s.id===a||s.children&&o(s.children,a))return s;return null};return o(t,e)},fd=(t,e)=>{let o=[],r=(a,s,i=[])=>{for(let m of a){if(m.id===s)return o.push(...i),true;if(m.children&&r(m.children,s,[...i,m]))return true}return false};return r(t,e),o},Ht=(t,e)=>{for(let o of t){if(o.id===e)return o;if(o.children){let r=Ht(o.children,e);if(r)return r}}return null},It=(t,e)=>{for(let o of t){if(o.id===e)return [o.label];if(o.children){let r=It(o.children,e);if(r.length>0)return [o.label,...r]}}return []},pd=({eventDispatcher:t,execCommands:e,params:o,properties:r,redrawComponent:a,formlayout:s,onFolderSelected:i,onFolderAdded:m,formData:d,mode:c,checkedItems:b$2})=>{var H,Q;let{runFormEvent:F}=b(),[f,p]=Se.useState([]),[u,h]=Se.useState(((H=o==null?void 0:o.folderData)==null?void 0:H.id)||null),[w,I]=Se.useState([]),[S,v]=Se.useState(b$2),[E,W]=Se.useState(false),[_,R]=Se.useState(),{UserDialog:y}=b$1();Se.useEffect(()=>{v(b$2);},[b$2]);let g=useCallback(T.debounce(async()=>{var B,k,q,re,pe,Ie,se,A,ce,K,ue;try{let Fe=await F({pluginCode:((B=o.sourcePluginCode)==null?void 0:B.trim())!==""?o.sourcePluginCode:o.pluginCode,formCode:((k=o.sourceFormCode)==null?void 0:k.trim())!==""?o.sourceFormCode:o.formCode,guid:o.guid,projectGuid:o.pGuid,pGuid:o.pGuid,widgetEvent:U.onFoldersDataLoad,widgetContext:JSON.stringify({originator:(q=o.originator)!=null?q:null})});if(Fe.meta.requestStatus==="fulfilled"){let ge={...Fe.payload};ge!=null&&ge.userData&&R(ge==null?void 0:ge.userData),(re=ge==null?void 0:ge.userData)!=null&&re.isContributor&&W(!0);let X=JSON.parse(ge.widgetData.treeData);if(p(X),(pe=o==null?void 0:o.folderData)!=null&&pe.addedFolderId){let G=ud(X,(Ie=o==null?void 0:o.folderData)==null?void 0:Ie.addedFolderId);if(G){let M=cd([G]);I(M),h((se=o==null?void 0:o.folderData)==null?void 0:se.addedFolderId);let ee=It([G],(A=o==null?void 0:o.folderData)==null?void 0:A.addedFolderId);m(null,ee);}}else if(w.length===0&&I([(ce=X[0])==null?void 0:ce.id]),!u){let G=(K=X[0])==null?void 0:K.id,M=(ue=X[0])==null?void 0:ue.isroot;h(G||null),i(G||null,M);}}}catch(Fe){}},500),[o]);Se.useEffect(()=>(g(),()=>{g.cancel();}),[g]),Se.useEffect(()=>{var B,k,q,re,pe,Ie;if((B=o==null?void 0:o.folderData)!=null&&B.id){h(((k=o==null?void 0:o.folderData)==null?void 0:k.id)||null);let se=Ht(f,(q=o==null?void 0:o.folderData)==null?void 0:q.id),A=It(f,se==null?void 0:se.id),ce=[],K=fd(f,(re=o==null?void 0:o.folderData)==null?void 0:re.id);K.length>0&&(K.forEach(ue=>{ce.push(ue.id);}),ce.push((pe=o==null?void 0:o.folderData)==null?void 0:pe.id),I(ce)),i((Ie=o==null?void 0:o.folderData)==null?void 0:Ie.id,se==null?void 0:se.isroot,A);}},[(Q=o==null?void 0:o.folderData)==null?void 0:Q.id]);let[U$1,Z]=useState({delete:{buttonAgree:"",buttonDisagree:"",dialogTitle:"",dialogContent:"",showDialog:false,callBackFunc:()=>{}}}),te=B=>U$1.delete.callBackFunc(B),T$1=B=>{Z(B);},V=(B,k)=>{h(k);let q=Ht(f,k),re=It(f,q==null?void 0:q.id);i(k,q==null?void 0:q.isroot,re);};return jsxs(Fragment,{children:[jsx(er,{sx:{paddingTop:"5px"},children:jsx(RichTreeView,{items:f,selectedItems:u,expandedItems:w,sx:{height:"fit-content",flexGrow:1,maxWidth:250,overflowY:"auto"},slots:{item:B=>jsx(md,{...B,mode:c,params:o,eventDispatcher:t,execCommands:e,deletePrompt:T$1,index:f.findIndex(k=>k.id===B.itemId),selectedItem:u,setSelectedItem:V,treeCheckedItems:S,disableRootItem:E,userData:_,formData:d,properties:r})},onSelectedItemsChange:V,onExpandedItemsChange:(B,k)=>{var re;let q=(re=f[0])==null?void 0:re.id;q&&!k.includes(q)?I(pe=>pe.includes(q)?pe:[...pe,q]):I(k);}})}),jsx(y,{...U$1.delete,handleDialogClose:te})]})},ct=pd;var ar=withTranslation()(memo(function(e){var c,b;let{style:o,verticalalign:r,plugincode:a,formcode:s,visible:i}=e.properties,m={paddingTop:"0px"};if(r==="bottom"&&(m.paddingTop="10px"),!i)return null;let d=(c=e.context.formData)!=null&&c[e.properties.name]?JSON.parse((b=e.context.formData)==null?void 0:b[e.properties.name]):{};return jsx("div",{style:{...o,...m,minHeight:"2rem"},children:jsx(ct,{params:{sourceFormCode:s,sourcePluginCode:a,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:d,redrawComponent:e.context.redrawComponent,eventDispatcher:e.methodProvider.eventDispatcher,execCommands:e.methodProvider.execCommands,formData:e.context.formData,formlayout:"folders",onFolderSelected:()=>{},onFolderAdded:()=>{},mode:"setup"})})}));ar.displayName="_View";var rr=ar;var bd=lazy(()=>import('./tabulator-VDKE2CC5.js').then(t=>({default:t.TabulatorTable}))),vd=lazy(()=>import('./datatable-XLBZ44SS.js').then(t=>({default:t.Datatable}))),Oe=class{static getFormComponent(e,o){if(e.displayName==="_Rowcontainer")return zn;if(e.displayName==="_Rowsegment")return Jn;if(e.displayName==="_Textinput"){if(o.inputtype==="input")return Kn;if(o.inputtype==="inputwcopy")return Zn;if(o.inputtype==="currency")return $a;if(o.inputtype==="password")return ja;if(o.inputtype==="date")return Na;if(o.inputtype==="time")return Va;if(o.inputtype==="datetime")return Oa;if(o.inputtype==="phone")return Wa}else {if(e.displayName==="_TabBox")return oa;if(e.displayName==="_Button")return Ea;if(e.displayName==="_Label")return ra;if(e.displayName==="_CheckBox")return da;if(e.displayName==="_Radio")return ca;if(e.displayName==="_Textarea")return fa;if(e.displayName==="_SelectBox")return ha;if(e.displayName==="_Placeholder")return va;if(e.displayName==="_Fileuploader")return Da;if(e.displayName==="_Table")return o.alloweditrow||o.tablemode!==void 0&&o.tablemode==="tabulator"?bd:vd;if(e.displayName==="_View")return rr}return e}};function dr(t,e,o){var r=this,a=useRef(null),s=useRef(0),i=useRef(null),m=useRef([]),d=useRef(),c=useRef(),b=useRef(t),F=useRef(true);useEffect(function(){b.current=t;},[t]);var f=!e&&e!==0&&typeof window!="undefined";if(typeof t!="function")throw new TypeError("Expected a function");e=+e||0;var p=!!(o=o||{}).leading,u=!("trailing"in o)||!!o.trailing,h="maxWait"in o,w=h?Math.max(+o.maxWait||0,e):null;useEffect(function(){return F.current=true,function(){F.current=false;}},[]);var I=useMemo(function(){var S=function(y){var g=m.current,U=d.current;return m.current=d.current=null,s.current=y,c.current=b.current.apply(U,g)},v=function(y,g){f&&cancelAnimationFrame(i.current),i.current=f?requestAnimationFrame(y):setTimeout(y,g);},E=function(y){if(!F.current)return false;var g=y-a.current;return !a.current||g>=e||g<0||h&&y-s.current>=w},W=function(y){return i.current=null,u&&m.current?S(y):(m.current=d.current=null,c.current)},_=function y(){var g=Date.now();if(E(g))return W(g);if(F.current){var U=e-(g-a.current),Z=h?Math.min(U,w-(g-s.current)):U;v(y,Z);}},R=function(){var y=Date.now(),g=E(y);if(m.current=[].slice.call(arguments),d.current=r,a.current=y,g){if(!i.current&&F.current)return s.current=a.current,v(_,e),p?S(a.current):c.current;if(h)return v(_,e),S(a.current)}return i.current||v(_,e),c.current};return R.cancel=function(){i.current&&(f?cancelAnimationFrame(i.current):clearTimeout(i.current)),s.current=0,m.current=a.current=d.current=i.current=null;},R.isPending=function(){return !!i.current},R.flush=function(){return i.current?W(Date.now()):c.current},R},[p,h,e,w,u,f]);return I}var Fd=Se__default.createContext(void 0),mr=({children:t,eventDispatcher:e,redrawComponent:o,formlayout:r,params:a,onFolderSelected:s$1,onFolderAdded:i,formData:m,execCommands:d})=>{let[c,b$1]=useState(r),{viewPort:F}=b(),[f,p]=useState(false),{t:u}=useTranslation(),h=()=>p(v=>!v),w=()=>p(false),I={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:f?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(ql,{variant:"h6",sx:{padding:"0.5em",fontWeight:"bold",borderBottom:"1px dashed #C0C0C0"},children:u("My Folders")});return jsxs(Fd.Provider,{value:{layout:c,setLayout:b$1},children:[(!r||r==="regular")&&t,r==="folders"&&jsxs("div",{className:"viewHolder",style:I.viewHolder,children:[F.isMobileDevice?jsxs(Fragment,{children:[!f&&jsx("button",{onClick:h,style:{...I.toggleButton,...I.toggleButtonMenuActive},children:s({size:"1.3rem"})}),jsx(xd,{open:f,onClick:w,sx:{zIndex:998,backgroundColor:"rgba(0, 0, 0, 0.5)"}}),jsxs("div",{style:I.btreeContainerMobile,onClick:v=>v.stopPropagation(),children:[jsx("div",{style:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingLeft:"0.5rem"}}),jsx(S,{}),jsx(ct,{params:{...a,sourcePluginCode:a.pluginCode,sourceFormCode:a.formCode},redrawComponent:o,eventDispatcher:e,execCommands:d,formData:m,formlayout:r,onFolderSelected:s$1,onFolderAdded:i,mode:"live"})]})]}):jsxs("div",{className:"foldersHolder",style:I.btreeContainerDesktop,children:[jsx(S,{}),jsx(ct,{params:{...a,sourcePluginCode:a.pluginCode,sourceFormCode:a.formCode},redrawComponent:o,eventDispatcher:e,execCommands:d,formData:m,formlayout:r,onFolderSelected:s$1,onFolderAdded:i,mode:"live"})]}),jsx("div",{style:I.mainContent,children:t})]})]})};var kd=lazy(()=>import('./fileviewer-73OY3DUG.js')),Md=lazy(()=>import('./formeditor-5HR2BJXQ.js').then(t=>({default:t.Formeditor}))),Dt=t=>new Promise(e=>setTimeout(e,t));function ur(t,e={}){let o={},r=e!=null?e:{},a=i=>{let m=i==null?void 0:i.properties;if(!(m!=null&&m.name)||!(m!=null&&m.defaultvalue)||i.stricttype!=="_Textinput")return;let{name:d,inputtype:c}=m,b=String(m.defaultvalue).toLowerCase().trim();r[d]!=null&&r[d]!==""||(c==="date"&&b==="today"?o[d]=a$2().utc().format():c==="datetime"&&b==="now"?o[d]=a$2().utc().format():c==="time"&&b==="now"?o[d]=a$2().utc().format():c==="time"&&b==="start of day"&&(o[d]=a$2().startOf("day").utc().format()));},s=i=>{if(i.type==="formrow"||i.stricttype==="_Rowcontainer")for(let m of i._children||[])for(let d of m._children||[])a(d);else if(i._children)for(let m of i._children)s(m);};for(let i of t||[])s(i);return o}var qt={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"},fr={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}},Bd={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},Nd=memo(function({previewMode:e,className:o,maxWidth:r,setup:a,params:s,enableEventHandlers:i,modalCloseFn:m}){var Zt,eo;let d$2={...s,modalCloseFn:m||(s==null?void 0:s.modalCloseFn)},c=useRef(null),[b$1,F]=useState(0),{registerFormSubmitEvent:f,checkFormAccess:p}=g$1(),{apiConfig:u,appSettings:h,viewPort:w,runLoadFormEvent:I,runServerPingEvent:S,runFormEvent:v,fetchUserMenu:E,signInUser:W,signOut:_}=b(),[R,y]=useState(null),g=useNavigate(),[U,Z]=useState(false),te=useRef({}),[T$1,V]=useState({}),[D,H]=useState(null),[Q,B]=useState(null),k=useLocation(),[q]=useState(w.width),[re]=useState(d$2.modal||false),[pe]=useState(T.hasParentForm()||!!(u!=null&&u.token)),[Ie,se]=useState([]),A=Ie.length>0?Ie[Ie.length-1]:Bd,[ce,K]=useState(),[ue,Fe]=useState(true),{t:ge,i18n:X}=useTranslation(),G=c$1(),M=d(),ee=e$1(),{dismissAll:O}=b$2(),Te=useRef(false);useEffect(()=>()=>{Te.current=true;},[]);let ve={command:{},params:d$2,doValidateForm:false,redrawComponent:false,redrawFoldersComponent:false,fieldAllowedValues:{},formData:{},widgetRelatedData:[],widgetsState:{visibility:{},readonly:{}},formDimension:{width:b$1,height:0},formValidationData:{},enableEventHandlers:i,isModal:re,hasParentForm:pe,formLayout:"regular"},[n,ae]=useState(ve),[ie,Ue]=useState({...fr,containerSetup:a}),qe=dr(()=>{c&&c.current&&F(c.current.offsetWidth);},200),we=async(l,P)=>{await I({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 C=>{var L,$,Y,xe,he,be,Pe,z;if(C.meta.requestStatus==="fulfilled"){let N={...C.payload};if(Object.keys(N).length===0)return;try{let de=window.location.hostname;if(!i$1.SKIP_ACCESS_VALIDATION_DOMAINS.some(Ge=>de===Ge||de.endsWith(`.${Ge}`))){let Ge=await p(l.formCode);(Ge==null?void 0:Ge.subscriptionPlan)!=null&&H(Ge.subscriptionPlan);}}catch(de){B({title:($=(L=de==null?void 0:de.data)==null?void 0:L.error)!=null?$:"Form Unavailable",message:(xe=(Y=de==null?void 0:de.data)==null?void 0:Y.message)!=null?xe:"This form is temporarily unavailable."});return}if(N.uiTranslations&&Object.keys(N.uiTranslations).length>0){te.current=N.uiTranslations,V(N.uiTranslations);let de=Pd;de.addResourceBundle(de.language,"default",N.uiTranslations,true,true);}let Be={},le={visibility:{...n==null?void 0:n.widgetsState.visibility,...(he=N==null?void 0:N.widgetsState)==null?void 0:he.visibility},readonly:{...n==null?void 0:n.widgetsState.readonly,...(be=N==null?void 0:N.widgetsState)==null?void 0:be.readOnly}};if(P){ae(de=>({...de,formData:de.formData,fieldAllowedValues:N.fieldAllowedValues,widgetsState:le,formLayout:N.layout,requiredFields:N.requiredFields}));return}let Ee={},Ne=[],We={},He=JSON.parse(N.definition);if(He==null){ae({...ve,redrawComponent:false,doValidateForm:false,command:{...N.FECommand},formData:{},widgetsState:le,formLayout:N.layout,requiredFields:N.requiredFields,params:{...ve.params,folderData:N.folderData}});return}T.mapComponents(He._children);let Xe=He.properties;Ne=He._children,We=He,Ue({...ie,containerProps:Xe,selectedWidgetProps:{...ie.containerProps},containerData:Ne,containerSetup:We}),Be=N.fieldAllowedValues,Ee={...N.data,...ur(Ne,N.data)},ae({...ve,formData:Ee,formLayout:N.layout,widgetsState:{visibility:{...n==null?void 0:n.widgetsState.visibility,...(Pe=N==null?void 0:N.widgetsState)==null?void 0:Pe.visibility},readonly:{...n==null?void 0:n.widgetsState.readonly,...(z=N==null?void 0:N.widgetsState)==null?void 0:z.readOnly}},requiredFields:N.requiredFields,command:{...N.FECommand},fieldAllowedValues:Be,params:{...ve.params,folderData:N.folderData}}),Z(true);}});};if(useEffect(()=>(qe(),we(d$2,false),window.addEventListener("resize",qe),()=>{ae(()=>({...qt})),Ue(fr),Z(false),window.removeEventListener("resize",qe);}),[d$2.pGuid,d$2.guid,d$2.pluginCode,d$2.formCode]),useEffect(()=>{var C;if(!U||!((C=ie.containerSetup)!=null&&C._children))return;let l=ie.containerSetup._children,P=setTimeout(()=>{ae(L=>{let $=ur(l,L.formData);return Object.keys($).length===0?L:{...L,formData:{...L.formData,...$}}});},0);return ()=>clearTimeout(P)},[X.language,U]),useEffect(()=>{var $,Y,xe,he,be,Pe,z,N,Be,le,Ee,Ne,We,He,Xe,de,St,Ge,to,oo,no,ao,ro,io,lo,so,mo,co,uo,fo,po,go,ho,bo,vo,yo,wo,xo,Co,Io,Fo,To,Do,Po,Ro,So,Eo,ko,Mo,Bo,No,_o,Lo,Vo,Ao,Oo,Uo,Wo,Ho,Go,zo,$o,qo,Jo,jo,Qo,Ko,Xo,Yo,Zo,en,tn,on,nn,an;let l=n,P=null,C=true,L=false;if(($=n.command)!=null&&$.Messages&&((Y=n.command)==null||Y.Messages.forEach(me=>{var Ce,Ye;let ne=(Ce=te.current[me.text])!=null?Ce:ge(me.text),Me=(Ye=me.code)==null?void 0:Ye.toUpperCase();Me==="NOTICE"?(L=true,ee({toastID:nanoid(11),msg:ne,clearQueue:false,hideProgressBar:false})):Me==="SUCCESS"?(L=true,M({toastID:nanoid(11),msg:ne,clearQueue:false,hideProgressBar:false})):Me==="WARNING"&&(C=false,G({toastID:nanoid(11),msg:ne,clearQueue:false,hideProgressBar:false}));})),(xe=n.command)!=null&&xe.DisplayButtonLoader){ae({...n,displayButtonLoader:true});return}if((he=n.command)!=null&&he.DisplayErrorPage){g("/pagenotfound");return}if((be=n.command)!=null&&be.MoveToTab){let me=(z=(Pe=n.command)==null?void 0:Pe.MoveToTab)==null?void 0:z.widgetName;if(me){let ne=T.getTabWidgetByFieldName(me,ie.containerSetup);ne!==null&&(ne==null?void 0:ne.tabId)!=null&&ye(ne);}}if((N=n.command)!=null&&N.FormValidationData&&Object.keys(n.command.FormValidationData).length>0){let me=Object.keys(n.command.FormValidationData)[0];if(me){let ne=T.getTabWidgetByFieldName(me,ie.containerSetup);ne!==null&&(ne==null?void 0:ne.tabId)!=null&&ye(ne),setTimeout(()=>{let Me=[`[name="${me}"]`,`[data-field-name="${me}"]`,`#${me}`,`[id*="${me}"]`],Ce=null;for(let Ye of Me)try{if(Ce=document.querySelector(Ye),Ce)break}catch(Et){}Ce&&(Ce.scrollIntoView({behavior:"smooth",block:"center"}),(Ce.tagName==="INPUT"||Ce.tagName==="TEXTAREA"||Ce.tagName==="SELECT")&&Ce.focus());},100);}ae({...n,doValidateForm:true,formValidationData:(Be=n.command)==null?void 0:Be.FormValidationData});return}else l={...l,formValidationData:{}};if((le=n.command)!=null&&le.FetchUserMenu&&E&&E({ProjectGuid:(Ne=(Ee=n.command)==null?void 0:Ee.FetchUserMenu)==null?void 0:Ne.projectGuid,pGuid:(He=(We=n.command)==null?void 0:We.FetchUserMenu)==null?void 0:He.projectGuid}),(Xe=n.command)!=null&&Xe.Redirect){d$2.modalCloseFn&&d$2.modalCloseFn(),g(`${(de=n.command)==null?void 0:de.Redirect.url}?ref=${(to=(Ge=(St=n.command)==null?void 0:St.Redirect)==null?void 0:Ge.context)==null?void 0:to.referer}`,{state:{from:(ao=(no=(oo=n.command)==null?void 0:oo.Redirect)==null?void 0:no.context)==null?void 0:ao.referer}});return}if((ro=n.command)!=null&&ro.BuildPlugin){g(`${(io=n.command)==null?void 0:io.BuildPlugin.url}?ref=${(so=(lo=n.command)==null?void 0:lo.BuildPlugin)==null?void 0:so.referer}`);return}if((mo=n.command)!=null&&mo.DisplayComponent&&y((co=n.command)==null?void 0:co.DisplayComponent),(uo=n.command)!=null&&uo.CloseDisplayComponent&&y(null),(fo=n.command)!=null&&fo.Login&&(async()=>{var me,ne,Me,Ce,Ye,Et,rn;W&&await W((me=n.command)==null?void 0:me.Login),E&&await E({ProjectGuid:T.extractProjectGuid((Me=(ne=n.command)==null?void 0:ne.Login)==null?void 0:Me.url),pGuid:T.extractProjectGuid((Ye=(Ce=n.command)==null?void 0:Ce.Login)==null?void 0:Ye.url)}),g(((rn=(Et=n.command)==null?void 0:Et.Login)==null?void 0:rn.url)||"/");})(),(po=n.command)!=null&&po.Logout&&(async()=>{var ne;(ne=n.command)!=null&&ne.Logout&&(_&&await _(),g("/"));})(),((go=n.command)!=null&&go.Cancel||(ho=n.command)!=null&&ho.CloseForm)&&(n.isModal&&d$2.modalCloseFn!==void 0?(O==null||O(),d$2.modalCloseFn(null,null,false,(bo=n.command)==null?void 0:bo.RedrawFolders)):(P=T.getUrlParameter("ref"),P!=null&&g(P))),(vo=n.command)!=null&&vo.AfterRecordSave){let me=(yo=h==null?void 0:h.TOASTER_AUTOCLOSE)!=null?yo:i$1.TOASTER_AUTOCLOSE;if(P=T.getUrlParameter("ref"),((wo=n.command)==null?void 0:wo.AfterRecordSave.guid)==null)!((xo=n.command)!=null&&xo.OpenModal)&&d$2.modalCloseFn?d$2.modalCloseFn(null,null,false,null,null):(Co=n.command)!=null&&Co.OpenModal||(async()=>(await Dt(L?me:0),!Te.current&&P!=null&&g(P)))();else if(n.isModal){let ne;(Io=n.command)!=null&&Io.HotReloadEnabled&&(ne=(Fo=n.command)==null?void 0:Fo.HotReloadEnabled),(To=n.command)!=null&&To.OpenModal||(async()=>{var Me,Ce;await Dt(L?me:0),!Te.current&&d$2.modalCloseFn&&d$2.modalCloseFn(ne,n.formData,(Me=n.command)==null?void 0:Me.RedrawScreen,(Ce=n.command)==null?void 0:Ce.RedrawFolders,null);})();}else {let ne=P!=null;if(!((Do=n.command)!=null&&Do.OpenModal)&&ne&&C)(async()=>(await Dt(L?me:0),!Te.current&&P!=null&&g(P)))();else if(!((Po=n.command)!=null&&Po.OpenModal)){let Me=k.pathname.replace(/\/new/gi,"/"+((Ro=n.command)==null?void 0:Ro.AfterRecordSave.guid.replace(/#/g,"%23")));g(Me,{state:{from:k.pathname}}),l={...l,params:{...n.params,guid:(So=n.command)==null?void 0:So.AfterRecordSave.guid}};}}}if((Eo=n.command)!=null&&Eo.UpdateWidgetsState&&(l={...l,widgetsState:{visibility:{...l==null?void 0:l.widgetsState.visibility,...(Mo=(ko=n.command)==null?void 0:ko.UpdateWidgetsState)==null?void 0:Mo.visibility},readonly:{...l==null?void 0:l.widgetsState.readonly,...(No=(Bo=n.command)==null?void 0:Bo.UpdateWidgetsState)==null?void 0:No.readonly}}}),(_o=n.command)!=null&&_o.UpdateFieldAllowedValues&&(l={...l,fieldAllowedValues:{...(Lo=n.command)==null?void 0:Lo.UpdateFieldAllowedValues}}),(Vo=n.command)!=null&&Vo.UpdateFormData&&(l={...l,formData:{...(Ao=n.command)==null?void 0:Ao.UpdateFormData}}),(Oo=n.command)!=null&&Oo.UpdateFormDataItem&&(l={...l,formData:{...l.formData,[(Uo=n.command)==null?void 0:Uo.UpdateFormDataItem.name]:(Wo=n.command)==null?void 0:Wo.UpdateFormDataItem.value}}),((Go=(Ho=n.command)==null?void 0:Ho.ReplaceContextRecordGuid)==null?void 0:Go.guid)!=null&&(l={...l,displayButtonLoader:false,params:{...n.params,guid:(zo=n.command)==null?void 0:zo.ReplaceContextRecordGuid.guid}}),($o=n.command)!=null&&$o.OpenModal){let me={...(qo=n.command)==null?void 0:qo.OpenModal,parentId:d$2.id};se(ne=>[...ne,me]),l={...l,command:{}};}(Jo=n.command)!=null&&Jo.PreviewDocument&&K((jo=n.command)==null?void 0:jo.PreviewDocument),(Qo=n.command)!=null&&Qo.RedrawScreen&&(l={...l,redrawComponent:!n.redrawComponent,redrawFoldersComponent:!n.redrawFoldersComponent}),(Ko=n.command)!=null&&Ko.RedrawFolders&&(l={...l,params:{...n.params,folderData:{id:(Yo=(Xo=n.command)==null?void 0:Xo.RedrawFolders)==null?void 0:Yo.folderId,addedFolderId:(en=(Zo=n.command)==null?void 0:Zo.RedrawFolders)==null?void 0:en.folderId,isRoot:(on=(tn=n.command)==null?void 0:tn.RedrawFolders)==null?void 0:on.isRoot,captions:(an=(nn=n.command)==null?void 0:nn.RedrawFolders)==null?void 0:an.captions}}}),Object.keys(n.command).length>0&&(l={...l,command:{}},ae(l));},[n.command]),Q)return jsx(j,{title:Q.title,message:Q.message});if(!U)return Se__default.createElement("div",{},jsx(a$3,{message:ge("Please wait...")}));let rt=(l,P)=>{let C={};return Object.entries(l).forEach(([L,$])=>{let Y=P[L];(Y==null||Y===""||Y==="0"||Y===0||Array.isArray(Y)&&Y.length===0)&&(C[L]=$);}),C},ye=(l,P=false,C={})=>{let L=ft(null,l.tabId,l.index,P,C.containerSetup);if(L===void 0)return;let $=T.GetParentTabId(L.containerSetup,l.tabId);($==null?void 0:$.tabId)!=null?(L=ft(null,$.tabId,$.index,false,L.containerSetup),L!==void 0&&ye($,true,L)):P===false&&ft(null,l.tabId,l.index,true);},it=async l=>(ae({...n,displayButtonLoader:true}),await v({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:k.pathname,parentWidgetId:l.tabId,hasParentForm:T.hasParentForm(),originator:{widgetName:l.fieldName.toLowerCase(),params:n.params},parent:{widgetName:l.fieldName.toLowerCase(),params:n.params},parentOriginator:{params:n.params.originator?n.params.originator.params:{}},folderData:n.params.folderData}),widgetEvent:l.widgetEvent,widgetName:l.fieldName.toLowerCase(),widgetValue:l.widgetValue}).then(async P=>{var C,L,$,Y,xe,he,be,Pe;if(P.meta.requestStatus==="fulfilled"){let z={...P.payload};((C=z.FECommand)==null?void 0:C.ReplaceContextRecordGuid)!==void 0?(z.FECommand={Messages:($=(L=z.FECommand)==null?void 0:L.Messages)!=null?$:[],UpdateFormData:z.data,ReplaceContextRecordGuid:(Y=z.FECommand)==null?void 0:Y.ReplaceContextRecordGuid},ot(z.FECommand)):(xe=z.FECommand)!=null&&xe.Messages?(z.FECommand={UpdateFormData:z.data,Messages:(he=z.FECommand)==null?void 0:he.Messages},ot(z.FECommand)):(be=z.FECommand)!=null&&be.FormValidationData&&(z.FECommand={FormValidationData:(Pe=z.FECommand)==null?void 0:Pe.FormValidationData},ot(z.FECommand));}else ae({...n,displayButtonLoader:false});})),Jt=l=>{let P=l.widgetContext,C=l.widgetEvent,L=l.widgetName.toLowerCase(),$=l.widgetValue,Y=l.feCommand||{},xe=l.skipFormDataItem||false;if(C!==null&&n.enableEventHandlers){if(l.autoSave){it(l.autoSave);return}let he=$!=null&&xe===false?{...n.formData,[L]:$}:n.formData;if((C==null?void 0:C.toUpperCase())==="ONSAVE"&&n.requiredFields!=null){let be=rt(n.requiredFields,he),Pe=Object.keys(n.formValidationData||{}).length>0,z=Object.keys(be).length>0;if((z||Pe)&&(ae({...n,command:{...n.command,FormValidationData:be}}),z))return}(async()=>{var be,Pe;if((C==null?void 0:C.toUpperCase())==="ONSAVE")try{await f(n.params.formCode);}catch(z){if((z==null?void 0:z.status)===429)return}Fe(false),await v({pluginCode:n.params.pluginCode,formCode:n.params.formCode,guid:n.params.guid,projectGuid:(be=n.params.pGuid)!=null?be:"",pGuid:(Pe=n.params.pGuid)!=null?Pe:"",widgetContext:P,widgetEvent:C,widgetName:L,widgetValue:typeof $=="string"?$:$!=null?JSON.stringify($):null,formData:he,widgetsState:n.widgetsState}).then(z=>{var N,Be;if(z.meta.requestStatus==="fulfilled"){if(z.payload instanceof Blob){ae({...n,redrawComponent:!n.redrawComponent});return}let le={...z.payload};if(Object.keys(le).length===0)return;let Ee=JSON.parse(le.definition);if(Ee!=null){let Ne=[],We={};T.mapComponents(Ee._children);let He=Ee.properties;Ne=Ee._children,We=Ee,Ue({...ie,containerProps:He,selectedWidgetProps:{...ie.selectedWidgetProps},containerData:Ne,containerSetup:We});let Xe=L;if(Xe){let de=T.getTabWidgetByFieldName(Xe,We);de!==null&&(de==null?void 0:de.tabId)!=null&&ye(de,true,{containerSetup:We});}}xe||(n.redrawComponent=false),ae({...n,fieldAllowedValues:le.fieldAllowedValues,doValidateForm:true,command:{...le.FECommand},formData:{...n.formData,...le.data},widgetRelatedData:le.widgetRelatedData,widgetsState:{visibility:{...n==null?void 0:n.widgetsState.visibility,...(N=le==null?void 0:le.widgetsState)==null?void 0:N.visibility},readonly:{...n==null?void 0:n.widgetsState.readonly,...(Be=le==null?void 0:le.widgetsState)==null?void 0:Be.readOnly}},tabIndex:l.tabIndex?Number(l.tabIndex+1):0});}}).finally(async()=>{var z;if(Fe(true),(C==null?void 0:C.toUpperCase())==="ONSAVE"&&u!=null&&u.iframeMode&&u!=null&&u.token){let N=(z=ie.containerProps)==null?void 0:z.webhooks;if(Array.isArray(N)&&N.length>0){let Be={formCode:n.params.formCode,submittedAt:new Date().toISOString(),data:he};N.forEach(le=>{var Ee;le.enabled&&((Ee=le.url)!=null&&Ee.startsWith("http"))&&fetch(le.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Be),mode:"cors"}).then(Ne=>{Ne.ok||G({toastID:nanoid(11),msg:`Webhook failed: ${le.url}`,clearQueue:false,hideProgressBar:false});}).catch(Ne=>{G({toastID:nanoid(11),msg:`Webhook failed: ${le.url}`,clearQueue:false,hideProgressBar:false});});});}}});})();}if($!=null){let he={...n.formData,[L]:$};ae({...n,command:Y,formData:he});}},hr=(l,P,C)=>T.findRowItem(l,P,C,ie.containerSetup._children),br=(l,P,C,L)=>T.findSegmentItem(l,P,C,L,ie.containerSetup._children),vr=l=>T.findWidgetByIdRecursive(ie.containerSetup._children,l),yr=(l,P)=>T.getActiveTabIndex(ie.containerSetup._children,P),ft=(l,P,C,L=true,$={})=>{let Y=Object.keys($).length>0?$:ie.containerSetup;if(!P)return;let xe=T.getTabContainer(Y._children,P),he=T.getTabContainerChildrens(Y._children,P);if(he===void 0)return;for(let N=0;N<he.data.length;N++)he.data[N].activeTab="0";let be=he.data.filter((N,Be)=>Be===C)[0];be.properties={...xe.item.properties.tabsetup,...be.properties};let Pe=T.getNodeUpdatePath(he.path,{$splice:[[C,1,{...be,activeTab:"1"}]]});var z={containerSetup:{...Y,_children:(0, pr.default)(Y._children,Pe)},selectedWidgetProps:{...ie.selectedWidgetProps,tabsetup:{...be.properties},_path:{...ie.selectedWidgetProps._path,panelId:be.id},lastActiveTabId:P}};return L&&Ue(z),z},wr=(l=true)=>{let P=qt;l&&(P={...n,redrawComponent:!n.redrawComponent,params:{...n.params,folderData:{id:"",isRoot:"",captions:[]}}}),ae(P);},ot=l=>{ae({...n,redrawComponent:!n.redrawComponent,command:{...l}});},jt=(l,P)=>{(async()=>{if(!S){l();return}await S({cmd:"ping"}).then(async C=>{(C==null?void 0:C.type)==="formbuilder/ping/rejected"?(G({toastID:nanoid(11),msg:"Application is being restarted. Please wait until it finishes....",clearQueue:false,hideProgressBar:false}),await Dt(1e3),jt(l)):l();});})();},Rt=(l,P=false,C,L=null)=>{jt(()=>{if(se(Y=>Y.slice(0,-1)),L!=null){let Y={...L,parentId:d$2.id};se(xe=>[...xe,Y]);}else if(l!=null){let Y={id:nanoid(5),pluginCode:l==null?void 0:l.pluginCode,formCode:l==null?void 0:l.formCode,guid:null,isFormEditorMode:true,parentId:d$2.id};se(xe=>[...xe,Y]);}if(we(n.params,true),C){let Y=C==null?void 0:C.folderId;Qt(Y,[]);}else ae({...n,redrawComponent:!n.redrawComponent});}),P&&n.isModal&&we(d$2,true);},xr=(l,P="",C)=>{let L={...n,redrawFoldersComponent:!n.redrawFoldersComponent,redrawComponent:!n.redrawComponent,params:{...n.params,folderData:{...n.params.folderData,addedFolderId:"",captions:C,id:l!==null?l:"",isRoot:P}}};ae(L);},Qt=(l,P)=>{let C=qt;l==null?C={...n,redrawFoldersComponent:!n.redrawFoldersComponent,params:{...n.params,folderData:{...n.params.folderData,addedFolderId:l!==null?l:"",captions:P}}}:C={...n,params:{...n.params,folderData:{...n.params.folderData,id:l!==null?l:"",addedFolderId:l!==null?l:"",isRoot:"",captions:P}}},ae(C);},Kt=l=>{l&&se(P=>[...P.slice(0,-1),{...l,id:nanoid(5)}]);},Cr=()=>{K(void 0);},Ir=()=>y(null),Fr=l=>{let{title:P,subtitle:C}=l,L=P;return C!==void 0&&String(C).trim()!==""&&(L=P+" - "+C),n.enableEventHandlers&&Object.keys((n==null?void 0:n.formData)||{}).length>0&&Object.entries(n.formData).forEach(([$,Y])=>{L=L.replace(`#${$}`,Y);}),L},{properties:De}=ie.containerSetup||{},{minHeight:Xt}=(De==null?void 0:De.style)||{},pt={};Xt&&(pt.minHeight=Xt),re&&(pt={...pt,width:"100%",minWidth:q-q*.3,maxHeight:"calc(100dvh - 4rem)",overflow:"auto"});let Yt={};return e&&(Yt={overflowY:"scroll",height:"100vh",padding:"0px 10px 10px 10px"}),jsx(i$2.Provider,{value:D,children:jsx(xa.Provider,{value:T$1,children:jsxs(mr,{execCommands:ot,eventDispatcher:Jt,redrawComponent:n.redrawFoldersComponent,formlayout:n.formLayout,params:n.params,onFolderSelected:xr,onFolderAdded:Qt,formData:n.formData,children:[jsxs("div",{id:"main-content-wrapper",className:o,children:[jsx("div",{className:"content",children:jsx("div",{className:"main-content on-scrollbar",style:Yt,children:jsxs("div",{id:"formCanvas",ref:c,style:{maxWidth:r,border:(De==null?void 0:De.border)===false?"none":void 0},children:[jsxs("form",{onSubmit:l=>{l.preventDefault();},style:{position:"relative"},children:[De&&!De.hideheader&&jsxs("div",{className:"form-header top-border-radius",style:{backgroundColor:(De==null?void 0:De.headerbackground)===false?"transparent":void 0},children:[jsx("div",{style:{flex:1,marginLeft:"0.5rem"},children:De&&Fr(De)}),re&&d$2.modalCloseFn!==void 0&&jsx("div",{style:{width:"2.5em"},children:jsx(cr,{onClick:()=>{O==null||O(),d$2.modalCloseFn(null);},children:Se__default.createElement(P)})})]}),De&&De.hideheader&&re&&d$2.modalCloseFn!==void 0&&jsx("div",{style:{position:"absolute",top:"0.5rem",right:"0.5rem",zIndex:9999},children:jsx(cr,{size:"medium",onClick:l=>{l.stopPropagation(),O==null||O(),d$2.modalCloseFn(null);},sx:{backgroundColor:"rgba(255, 255, 255, 0.95)","&:hover":{backgroundColor:"rgba(255, 255, 255, 1)"}},children:Se__default.createElement(P)})}),jsx("div",{style:pt,className:"form-container bottom-border-radius",children:jsx("div",{className:"form-container",children:jsx(m$1,{darkMode:false,noPadding:true,children:jsx(Suspense,{fallback:jsx(a$3,{}),children:jsx(_d,{eventDispatcher:Jt,context:n,formWidth:b$1,findRowItem:hr,findSegmentItem:br,findWidgetItem:vr,modal:re,getActiveTabIndex:yr,setActiveTabIndex:ft,setRedrawComponent:wr,execCommands:ot,widgets:ie.containerSetup})})})})})]}),R!==null&&jsx(d$1,{componentName:R.componentName,options:R.options,params:{params:(Zt=R.options)!=null&&Zt.contextParams?(eo=R.options)==null?void 0:eo.contextParams:n.params,formData:n.formData,execCommands:l=>ot(l),modalCloseFn:()=>Ir(),modalCloseAndOpenFn:l=>Kt(l)}})]})})}),(D==null?void 0:D.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"})]})]}),!ue&&jsx(a$3,{message:ge("Please wait...")}),!A.isFormEditorMode&&ce&&ce.fileId&&jsx(Suspense,{fallback:jsx(a$3,{message:ge("Loading viewer...")}),children:jsx(kd,{fileId:ce.fileId,fileBase64:ce.data,fieldName:ce.fieldName,params:{...ce.context?ce.context:n.params,modalCloseFn:Cr}},nanoid(11))}),!A.isFormEditorMode&&(A==null?void 0:A.pluginCode)&&(A==null?void 0:A.formCode)&&jsx(h$1,{component:jsx(Nd,{params:{id:A.id,parentId:A.parentId,pluginCode:A.pluginCode,formCode:A.formCode,guid:A.guid==null?"new":A.guid,pGuid:A.pGuid,modal:true,modalCloseFn:(l,P,C,L,$=null)=>Rt(l,C,L,$),modalCloseAndOpenFn:l=>Kt(l),originator:A.originator,parent:A.parent,folderData:A.folderData,prefillData:A.prefillData},enableEventHandlers:true}),id:A.id,onCloseModal:Rt,parentId:A.parentId},A.id),A.isFormEditorMode&&(A==null?void 0:A.pluginCode)&&(A==null?void 0:A.formCode)&&jsx(h$1,{component:jsx(Suspense,{fallback:jsx(a$3,{}),children:jsx(Md,{inPreviewMode:false,pluginCode:A.pluginCode,formCode:A.formCode,modal:true},nanoid(11))}),id:A.id,onCloseModal:()=>Rt(null,false,null),parentId:A.parentId,windowMode:"fullWindow"},A.id)]})})})}),_d=t=>{let e=0,o=r=>{for(var a in r)typeof r[a]=="object"&&r[a]!==null?o(r[a]):a==="tabIndex"&&(t.modal?r[a]=0:r[a]=++e);};return o(t.widgets._children),(t.widgets._children||[]).map(({id:r,tabId:a,panelId:s,type:i,component:m,properties:d})=>Se__default.createElement(Oe.getFormComponent(m,d),{key:"key_"+r,id:r,tabId:a,panelId:s,className:i,context:{...t.context,formDimension:{width:t.formWidth,height:0}},properties:d,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}},r))};
2
+ export{Wn as a,Nd as b};