@buildocsdev/sdk 1.1.56 → 1.1.57

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 {e as e$1,h as h$1,g as g$1,d as d$1}from'./chunk-WPUZPO7K.js';import {b as b$1}from'./chunk-VUS3THHW.js';import {a as a$1,i as i$1,h as h$2}from'./chunk-RYPE5BKG.js';import {d,c as c$1,e as e$2,b as b$2}from'./chunk-AY7MKCIL.js';import {x,y,A,T,U,w,z,j}from'./chunk-FTJXRFLR.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 Re from'react';import Re__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 Ya from'@mui/material/Box';import ei from'@mui/material/Button';import ti from'@mui/material/Tooltip';import Hi from'axios';import ji from'@mui/material/CircularProgress';import Qi from'@mui/material/LinearProgress';import sr from'@mui/material/IconButton';import Ol from'@mui/material/InputAdornment';import Wl from'@mui/icons-material/Visibility';import Hl 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 Hn=a((ze,Wn)=>{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 Tr=typeof process=="object"&&true;function Le(t,e){if(!t)throw Tr?new Error("Invariant failed"):new Error(e())}ze.invariant=Le;var Nt=Object.prototype.hasOwnProperty,Dr=Array.prototype.splice,Pr=Object.prototype.toString;function Ze(t){return Pr.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({},Sr),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 i=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(i.commands).join(", ")+".")});var d=e;return _t(a).forEach(function(r){if(Nt.call(i.commands,r)){var m=e===d;d=i.commands[r](a[r],d,a,e),m&&i.isEquals(d,e)&&(d=e);}else {var s=Ze(e)==="Map"?i.update(e.get(r),a[r]):i.update(e[r],a[r]),c=Ze(d)==="Map"?d.get(r):d[r];(!i.isEquals(s,c)||typeof s=="undefined"&&!Nt.call(e,r))&&(d===e&&(d=Qe(e)),Ze(d)==="Map"?d.set(r,s):d[r]=s);}}),d},t})();ze.Context=An;var Sr={$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,i){return Rr(e,o),t.forEach(function(a){On(a),e===i&&a.length&&(e=Qe(i)),Dr.apply(e,a);}),e},$set:function(t,e,o){return kr(o),t},$toggle:function(t,e){dt(t,"$toggle");var o=t.length?Qe(e):e;return t.forEach(function(i){o[i]=!e[i];}),o},$unset:function(t,e,o,i){return dt(t,"$unset"),t.forEach(function(a){Object.hasOwnProperty.call(e,a)&&(e===i&&(e=Qe(i)),delete e[a]);}),e},$add:function(t,e,o,i){return Vn(e,"$add"),dt(t,"$add"),Ze(e)==="Map"?t.forEach(function(a){var d=a[0],r=a[1];e===i&&e.get(d)!==r&&(e=Qe(i)),e.set(d,r);}):t.forEach(function(a){e===i&&!e.has(a)&&(e=Qe(i)),e.add(a);}),e},$remove:function(t,e,o,i){return Vn(e,"$remove"),dt(t,"$remove"),t.forEach(function(a){e===i&&e.has(a)&&(e=Qe(i)),e.delete(a);}),e},$merge:function(t,e,o,i){return Mr(e,t),_t(t).forEach(function(a){t[a]!==e[a]&&(e===i&&(e=Qe(i)),e[a]=t[a]);}),e},$apply:function(t,e){return Er(t),t(e)}},Lt=new An;ze.isEquals=Lt.update.isEquals;ze.extend=Lt.extend;ze.default=Lt.update;ze.default.default=Wn.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 Rr(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 Er(t){Le(typeof t=="function",function(){return "update(): expected spec of $apply to be a function; got "+Ae(t)+"."});}function kr(t){Le(Object.keys(t).length===1,function(){return "Cannot have more than one key in an object with $set"});}function Mr(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 ur=c(Hn());var Gn=withTranslation()(memo(function(e){let{id:o,tabId:i,panelId:a,context:d,methodProvider:r,widgetsState:m}=e,s=r.findRowItem(i,a,o);return s?Re__default.createElement("div",{className:"row-container"},(s.item._children||[]).map(({rowId:c,id:h,component:w,properties:p})=>Re__default.createElement(Oe.getFormComponent(w,p),{key:"key_"+h,tabId:i,panelId:a,rowId:c,segmentId:h,properties:p,widgetsState:m,methodProvider:r,context:{...d},segmentsCount:s.item._children.length},null))):null}));Gn.displayName="_Rowcontainer";var zn=Gn;var qn=withTranslation()(memo(function(e){let{tabId:o,panelId:i,rowId:a,segmentId:d,segmentsCount:r,properties:m,methodProvider:s,context:c,widgetsState:h}=e,w=s.findSegmentItem(o,i,a,d),p={...m.style};return Re__default.createElement("div",{className:"rowSegment",style:p},(w.item._children||[]).map(({id:f,component:u,properties:g})=>{let x=g.groupname?g.groupname:g.name;return Re__default.createElement(Oe.getFormComponent(u,g),{key:"key_"+f,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:f,methodProvider:s,panelId:i,properties:{...g,visible:h!==void 0&&h.visibility[x]!==void 0?h.visibility[x]:g.visible,readonly:h!==void 0&&h.readonly[x]!==void 0?h.readonly[x]:g.readonly},rowId:a,segmentId:d,segmentsCount:r,tabId:o,value:c.formData!==void 0?c.formData[x]:void 0,fieldAllowedValues:c!=null&&c.fieldAllowedValues?c.fieldAllowedValues[x]:void 0,validationMessage:c!=null&&c.formValidationData&&c.formValidationData[x]!==void 0?c.formValidationData[x]:null},null)}))}));qn.displayName="_Rowsegment";var Jn=qn;function zr(t,e){return {id:t,value:e}}var Qn=withTranslation()(memo(function(e){var V;let o=useRef(null),{datalength:i,id:a,forcereadonly:d,ignorereadonly:r,label:m,name:s,onchangehandler:c,placeholder:h,readonly:w,regex:p,searchbar:f,size:u,style:g,tabIndex:x,uppercasemode:F,variant:D,visible:C}=e.properties,E=useLocation(),{viewPort:H}=b(),{tabId:_}=e,[v,y]=useState(String((V=e.value)!=null?V:"")),[b$1,W]=Re__default.useState([]),Z=!!(v.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{var S;y(String((S=e.value)!=null?S:""));},[e.value]),useEffect(()=>{let S=[];if(e.fieldAllowedValues){for(let U in e.fieldAllowedValues)S.push(zr(U,e.fieldAllowedValues[U]));W(S);}},[e.fieldAllowedValues]);let te=S=>{var U$1;e.methodProvider.eventDispatcher({widgetName:s,widgetValue:S,widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:E.pathname,parentWidgetId:_,hasParentForm:T.hasParentForm(),originator:(U$1=e.context.params)==null?void 0:U$1.originator})});},P=S=>{y(S);};return jsx(n,{autoFocus:false,data:b$1,disabled:!!(w&&!r),error:Z,helperText:Z?e.validationMessage:"",id:a,inputProps:{id:a,tabIndex:x,style:{...g},autoComplete:nanoid(5)},InputProps:{},inputRef:o,label:m,maxCharCount:i,name:s,onBlur:S=>{te(S.target.value);},onInput:S=>{P(S.target.value),H.isMobileDevice&&te(S.currentTarget.value);},onChange:S=>{v.trim()===""&&te(S.target.value);},placeholder:h,readOnly:!!(w&&!r),regEx:p,searchBar:f,size:u!=null?u:"small",type:"text",inputtype:e.properties.inputType,toUpperCase:F,value:v,variant:D,visible:C})}));Qn.displayName="_Input";var Kn=Qn;var Yn=withTranslation()(memo(function(e){var S;let o=useRef(null),{datalength:i$1,id:a,forcereadonly:d,ignorereadonly:r,label:m,name:s,onchangehandler:c,placeholder:h,readonly:w,regex:p,size:f,style:u,tabIndex:g,uppercasemode:x,variant:F,visible:D}=e.properties,C=useLocation(),{viewPort:E}=b(),{tabId:H}=e,[_,v]=useState(String((S=e.value)!=null?S:"")),y=!!(_.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm),[b$1,W]=useState(false),{t:Z}=useTranslation(),te=()=>{navigator.clipboard.writeText(_).then(()=>{W(true),setTimeout(()=>W(false),2e4);});};useEffect(()=>{var U;v(String((U=e.value)!=null?U:""));},[e.value]);let P=U$1=>{var Q;e.methodProvider.eventDispatcher({widgetName:s,widgetValue:U$1,widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:C.pathname,parentWidgetId:H,hasParentForm:T.hasParentForm(),originator:(Q=e.context.params)==null?void 0:Q.originator})});},V=U=>{v(U);};return jsxs(Ya,{display:"flex",alignItems:"flex-start",gap:0,children:[jsx(n,{autoFocus:false,disabled:!!(w&&!r),error:y,helperText:y?e.validationMessage:"",id:a,inputProps:{id:a,tabIndex:g,style:{...u},autoComplete:nanoid(5)},InputProps:{},inputRef:o,label:m,maxCharCount:i$1,name:s,onBlur:U=>{P(U.target.value);},onInput:U=>{V(U.target.value),E.isMobileDevice&&P(U.currentTarget.value);},onChange:U=>{_.trim()===""&&P(U.target.value);},placeholder:h,readOnly:!!(w&&!r),regEx:p,size:f,type:"text",inputtype:e.properties.inputType,toUpperCase:x,value:_,variant:F,visible:D}),D&&jsx(ti,{title:Z(b$1?"copied!":"copy to clipboard"),children:jsx(ei,{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:i,id:a,context:d,widgetsState:r}=e,m=e.methodProvider.findWidgetItem(a),s=e.methodProvider.getActiveTabIndex(i,a),c=(p,f,u,g)=>{f||(p.target.style.background=g,p.target.style.color=u);},h=(p,f,u,g)=>{f||(p.target.style.background=g,p.target.style.color=u);},w=({children:p,...f})=>jsx(z,{onPointerUp:u=>u.stopPropagation(),onMouseOver:u=>c(u,f.selected,f.item_active_color,f.item_active_background_color),onMouseOut:u=>h(u,f.selected,f.item_default_color,f.item_default_background_color),style:{borderRadius:"5px 5px 0 0",marginRight:"1px",color:f.selected?f.item_active_color:f.item_default_color,background:f.selected?f.item_active_background_color:f.item_default_background_color,fontSize:f.item_fontsize,fontWeight:f.item_fontweight},selected:f.selected,children:p},f.id);return w.tabsRole="Tab",e.properties.visible?Re__default.createElement("div",{className:"form-tab-widget"},jsxs(x,{selectedIndex:s,onSelect:p=>e.methodProvider.setActiveTabIndex(i,a,p),children:[jsx(y,{children:(m.item._children||[]).map(({properties:p},f)=>!p.item_visible||r&&r.visibility&&r.visibility[p.item_name]===false?null:createElement(w,{...m.item.properties.tabsetup,...p,key:"TabCaptionComponent_"+a+"_"+f},p.item_title))}),(m.item._children||[]).map(({_children:p},f)=>jsx(A,{children:(p||[]).map(({tabId:u,panelId:g,id:x,type:F,component:D,properties:C},E)=>Re__default.createElement(Oe.getFormComponent(D,C),{key:"tabSubPanel_"+E,id:x,tabId:u,panelId:g,properties:{...C,visible:r!==void 0&&r.visibility[C.name]!==void 0?r.visibility[C.name]:C.visible,readonly:r!==void 0&&r.readonly[C.name]!==void 0?r.readonly[C.name]:C.readonly},className:F,widgetsState:r,methodProvider:e.methodProvider,context:{...d},segmentsCount:m.item._children.length,fieldAllowedValues:d!=null&&d.fieldAllowedValues?d.fieldAllowedValues[C.name]:void 0},null))},"TabPanel_"+a+"_"+f))]})):null}));ta.displayName="_TabBox";var oa=ta;function mi(t,e){if(!e||Array.isArray(e)&&e.length===0)return t;let o=e;return t.replace(/<b>@(\w+)<\/b>|@(\w+)/g,(i,a,d)=>{let r=(a||d).toLowerCase(),m=o[r];return typeof m=="string"?a?`<b>${m}</b>`:m:i})}var aa=withTranslation()(memo(function(e){let{title:o,style:i,verticalalign:a,visible:d}=e.properties,r={paddingTop:"0px"};if(a==="bottom"&&(r.paddingTop="10px"),!d)return null;let m=mi(o,e.context.formData);return jsx("div",{style:{...i,...r},children:jsx("div",{style:{...i},dangerouslySetInnerHTML:{__html:m}})})}));aa.displayName="_Label";var ra=aa;var la=withTranslation()(memo(function(e$1){let o=useRef(null),{defaultvalue:i,id:a,ignorereadonly:d,label:r,labelplacement:m,name:s,onchangehandler:c,readonly:h,style:w,tabIndex:p,visible:f}=e$1.properties,u=s,g=e$1.value||"",x=useLocation(),{tabId:F}=e$1,D=!!(!g&&e$1.validationMessage!=null&&e$1.context.doValidateForm);return useEffect(()=>{!e$1.value&&i&&e$1.methodProvider.eventDispatcher({widgetName:u,widgetValue:e$1.properties.value,widgetEvent:null,widgetContext:JSON.stringify({referer:x.pathname,parentWidgetId:F,hasParentForm:T.hasParentForm()})});},[]),jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:w.textAlign,height:"100%"},children:jsx(e,{checkedIcon:void 0,defaultChecked:!!(e$1.value===void 0&&i),disabled:!!(h&&!d),error:D,helperText:D?e$1.validationMessage:"",icon:void 0,inputProps:{id:a,tabIndex:p},inputRef:o,labelText:r,labelPlacement:m,name:u,onChange:C=>{e$1.methodProvider.eventDispatcher({widgetName:u,widgetValue:C.target.checked?e$1.properties.value:"",widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:x.pathname,parentWidgetId:F,hasParentForm:T.hasParentForm()})});},selectedValue:g,value:e$1.properties.value,visible:f})})}));la.displayName="_Checkbox";var da=la;var ma=withTranslation()(memo(function(e){let o=useRef(null),{defaultvalue:i,groupname:a,id:d,ignorereadonly:r,label:m,labelplacement:s,name:c,onchangehandler:h,readonly:w,style:p,tabIndex:f,visible:u}=e.properties,g=useLocation(),{tabId:x}=e,F=a||c;let C=e.value||"",E=!!(e.validationMessage!=null&&e.context.doValidateForm),H=_=>{var v;e.methodProvider.eventDispatcher({widgetName:F,widgetValue:_,widgetEvent:h?U.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:x,hasParentForm:T.hasParentForm(),originator:(v=e.context.params)==null?void 0:v.originator})});};return useEffect(()=>{!C&&i&&H(e.properties.value);},[]),jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:p.textAlign,height:"100%"},children:jsx(k,{defaultValue:i?e.properties.value:"",disabled:!!(w&&!r),inputProps:{id:d,tabIndex:f,style:{...p}},error:E,helperText:E?e.validationMessage:"",inputRef:o,labelText:m,labelPlacement:s,name:F,onChange:_=>{C!==_.target.value.trim()&&H(_.target.value);},selectedValue:C,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:i,viewPort:a}=b(),{id:d,autocompleteTextArea:r,ignorereadonly:m,label:s,name:c,onchangehandler:h,placeholder:w,required:p,requiredmessage:f,readonly:u,size:g,style:x,tabIndex:F,variant:D,visible:C}=e.properties,E=useLocation(),{tabId:H}=e,[_,v]=useState(String((te=e.value)!=null?te:""));useEffect(()=>{var P;v(String((P=e.value)!=null?P:""));},[e.value]);let y=!!(_.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm),b$1=P=>{var V;e.methodProvider.eventDispatcher({widgetName:c,widgetValue:P,widgetEvent:h?U.onChange:null,widgetContext:JSON.stringify({referer:E.pathname,parentWidgetId:H,hasParentForm:T.hasParentForm(),originator:(V=e.context.params)==null?void 0:V.originator})});},W=async P=>{var V,S,U$1;try{let Q=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:(V=e.context.formData)!=null?V:{},widgetContext:JSON.stringify({}),widgetEvent:U.onGetCustomResponse,widgetName:c,widgetValue:JSON.stringify({methodName:"getAutoCompleteData",value:P})});if(((S=Q.meta)==null?void 0:S.requestStatus)==="fulfilled"){let B=Q.payload,k=(U$1=B==null?void 0:B.FECommand)==null?void 0:U$1.CustomResponse;if(Array.isArray(k))return k.filter(q=>typeof q=="string").map(q=>({label:q}))}}catch(Q){}return []},Z=P=>{v(P);};return jsx(n,{autocompleteTextArea:r,autoFocus:false,disabled:!!(u&&!m),id:d,inputProps:{id:d,tabIndex:F,readOnly:!!(u&&!m),style:{...x}},error:y,helperText:y?e.validationMessage:"",InputProps:{},inputRef:o,label:s,multiline:true,name:c,onAutoCompleteChange:r?P=>W(P):void 0,onBlur:P=>{b$1(P.target.value);},onInput:P=>{Z(P.target.value),a.isMobileDevice&&b$1(P.currentTarget.value);},onChange:P=>{_.trim()===""&&b$1(P.target.value);},placeholder:w,readOnly:!!(u&&!m),size:g,type:"text",value:_,variant:D,visible:C})}));ua.displayName="_Textarea";var fa=ua;function pa(t,e){return {id:t,value:e}}var Wt="\xA4",ga=withTranslation()(memo(function(e){var S,U$1;let o=useRef(null),[i,a]=Re__default.useState(null),[d,r]=Re__default.useState([]),m=typeof e.value=="string"&&e.value!=null&&e.value.length>0?e.value.split(Wt):[],[s,c]=Re__default.useState(m),{id:h,ignorereadonly:w,label:p,multiple:f,name:u,onchangehandler:g,placeholder:x,readonly:F,rendertype:D,searchbar:C,size:E,tabIndex:H,variant:_,visible:v,dropvalues:y}=e.properties,b=useLocation(),{tabId:W}=e,{t:Z}=useTranslation();useEffect(()=>{let Q=typeof e.value=="string"&&e.value!=null&&e.value.length>0?e.value.split(Wt):[];c(Q);},[e.value]),useEffect(()=>{let Q=D==="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]));r(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||""));r(Q);}},[e.fieldAllowedValues,y]),useEffect(()=>{var Q;if(i===false){let B=typeof e.value!="string"?e.value:[];(JSON.stringify(B)!==JSON.stringify(s)||s.length===0)&&e.methodProvider.eventDispatcher({widgetName:u,widgetValue:s.length>0?s.join(Wt):[],widgetEvent:g?U.onChange:null,widgetContext:JSON.stringify({referer:b.pathname,parentWidgetId:W,hasParentForm:T.hasParentForm(),originator:(Q=e.context.params)==null?void 0:Q.originator,folderData:e.context.params.folderData})});}},[i]);let te=Q=>{let{target:{value:B}}=Q,k;f?k=typeof B=="string"?B.split(","):B:k=typeof B=="string"?[B]:B,c(k);},P=e.context.formDimension.width/e.segmentsCount;P=P<e.context.segmentDimensions.minWidth?e.context.segmentDimensions.minWidth:P-60;let V=!!(s.length===0&&e.validationMessage!=null&&e.context.doValidateForm);return jsx(l,{darkMode:false,data:d,error:V,helperText:V?e.validationMessage:"",inputProps:{tabIndex:H,style:{maxWidth:`${P}px`}},inputRef:o,onOpen:()=>{a(true);},onClose:()=>{a(false);},onChange:te,id:h,label:p,multiple:f,placeholder:x,readOnly:F&&!w,renderType:D,noOptionsText:(U$1=(S=e.properties)==null?void 0:S.noOptionsLabel)!=null?U$1:Z("No options"),searchBar:C,selectDisplayProps:{style:{maxWidth:"100%",whiteSpace:D==="chip"?"normal":"nowrap"}},selectedValue:s,size:E,variant:_,width:"auto",visible:v})}));ga.displayName="_SelectBox";var ha=ga;var ba=withTranslation()(memo(function(e){var m;let{style:o,visible:i}=(m=e.properties)!=null?m:{},[a,d]=useState(false);if(useEffect(()=>{d(true);},[]),!a)return null;let r="form-widget form-placeholder-widget";return i||(r+=" visibilityOff"),jsx("div",{className:r,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 Ki=lazy(()=>import('./fileviewer-73OY3DUG.js'));function Xi(){let[,t]=useState(0);return ()=>t(e=>e+1)}var Ta=withTranslation()(memo(function(e){var Te,ge;Xi();let [i,a]=useState([]),[d$1,r]=useState(e.context.params),[m,s]=useState(false),[c,h]=useState(null),[w,p$1]=useState(false),[f,u]=useState(null),[g,x]=useState(0),{t:F}=useTranslation(),{iframeMode:D}=a$1(),C=wa(),E=X=>{var G;return (G=C[X])!=null?G:F(X)},{UserDialog:H}=b$1(),_=d(),{style:v,readonly:y,visible:b$2}=e.properties,[W,Z]=useState({showDialog:false,dialogTitle:"",dialogContent:"",buttonAgree:"",buttonDisagree:"",callBackFunc:()=>{}}),{appSettings:te,viewPort:P,runFormDeleteFileEvent:V,runFormDownloadFileEvent:S,runFormGetLinkedFileEvent:U$1,runFormGetLinkedFileMetaEvent:Q,runFormUploadFiles:B}=b();useEffect(()=>{r(e.context.params);},[e.context.params]),useEffect(()=>{let X=e.value?JSON.parse(e.value):[];return X&&(a(k(X,100)),s(true)),()=>{i&&(s(false),i.forEach(G=>{G.preview&&URL.revokeObjectURL(G.preview);}));}},[]);let k=(X,G)=>{let M=[];return X.forEach((ee,O)=>{let De=new File([],ee,{type:"image/jpeg"});Object.assign(De,{preview:null,uploadProgress:G}),M.push(De);}),M},q=useCallback(async X=>{var n;let M=(await Q({...d$1,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:X,context:{action:"Preview"}})).payload,{linkedFileSize:ee,linkedFileName:O,mimeType:De}=M;if(!ee)throw new Error("File data or metadata is missing");let ye=(n=te==null?void 0:te.MAX_DOWNLOAD_NOCHUNK_FILESIZE)!=null?n:i$1.MAX_DOWNLOAD_NOCHUNK_FILESIZE;return ee>ye?{type:"formbuilder/getlinkedfile",payload:{linkedFile:null,linkedFileSize:ee,linkedFileName:O},meta:{requestStatus:"fulfilled"}}:await U$1({...d$1,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:X,context:{action:"Load"}})},[d$1,e.context.params.pGuid,e.properties.name]),re=X=>{W.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(De=>De.name!==G)),e.methodProvider.eventDispatcher({widgetName:e.properties.name,widgetValue:JSON.stringify(ee.linkedFiles),widgetEvent:null,widgetContext:null}));}}),Z({...W,showDialog:false,callBackFunc:M=>{}});},Fe=async X=>{if(X)try{let G=await S({...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,F,C]),A=useCallback(async(X,G)=>(G&&Fe(G),null),[e.context.params]),ce=useCallback((X,G)=>{G&&startTransition(()=>{h(G);});},[]),K=()=>{h(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 De=Hi.CancelToken.source(),ye=X.map(n=>Object.assign(n,{preview:URL.createObjectURL(n),uploadProgress:0}));a(i.concat(ye)),u(0),await B({content:O,cancelTokenSource:De,onUploadProgress:n=>{let ae=n.total?Math.round(n.loaded*100/n.total):0;u(ae);}}).then(n=>{var ie,We,qe;let ae=[];if(n.meta.requestStatus==="fulfilled"){let xe={...n.payload};if((ie=xe.FECommand)!=null&&ie.FormValidationData&&Object.keys(xe.FECommand.FormValidationData).length>0){ye.forEach(we=>{we.preview&&URL.revokeObjectURL(we.preview);}),u(null),x(we=>we+1);let rt=i.filter(we=>we.uploadProgress===100);a(rt),e.methodProvider.eventDispatcher({widgetName:e.properties.name,widgetValue:JSON.stringify(i),widgetEvent:null,widgetContext:null,feCommand:xe.FECommand});}else if(xe.linkedFiles&&e.properties.name){ae=k(xe.linkedFiles,100);let rt=ae.map(we=>{let it=we;return it.uploadProgress=100,it.preview=null,it});ye.forEach(we=>{we.preview&&URL.revokeObjectURL(we.preview);}),u(null),x(we=>we+1),a(rt),r({...e.context.params,guid:(qe=(We=xe.FECommand)==null?void 0:We.ReplaceContextRecordGuid)==null?void 0:qe.guid}),xe.FECommand={...xe.FECommand,UpdateFieldAllowedValues:xe.fieldAllowedValues,UpdateFormData:xe.data},e.methodProvider.execCommands(xe.FECommand);}}});}},[i,e.context.params,e.methodProvider,e.properties.name,e.value]);return !m||!b$2?null:jsxs("div",{style:{...v,lineHeight:"1.1em"},children:[jsx(H,{...W,handleDialogClose:re}),jsxs("div",{style:{position:"relative",zIndex:1,isolation:"isolate"},children:[D&&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:F("File upload is available only when using the SDK")}),jsx(p,{defaultText:(ge=(Te=e.properties)==null?void 0:Te.dragDropLabel)!=null?ge:E("Drag and Drop..."),tryGetLinkedFile:q,onDeleteButtonPress:se,onDownloadButtonPress:A,onDownloadText:E("Download"),onDeleteText:E("Delete"),filesData:i,onDragText:"On drop text",onFilesDrop:ue,onPreviewButtonPress:ce,isMobileDevice:P.isMobileDevice,isReadonly:y},g),f!==null&&jsx(Qi,{variant:"determinate",value:f,style:{marginTop:6,borderRadius:3,height:8}})]}),c!=null&&jsx(Suspense,{fallback:jsx(ji,{}),children:jsx(Ki,{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)),Ra=withTranslation()(memo(function(e){var F,D;let{buttontype:o$1,colorSchema:i,fullWidth:a,name:d,style:r,tabIndex:m,title:s,variant:c,visible:h}=e.properties,w=useLocation(),{tabId:p}=e,f=(D=(F=e.context)==null?void 0:F.displayButtonLoader)!=null?D:false;if(!h)return null;let u=r.backgroundColor,g=u?Pa(u,-50):"";i&&(u=i+".main",g=i+".hover");let x={};return c==="outlined"?(Object.assign(x,{"&.MuiButtonBase-root":{fontSize:r.fontSize,fontWeight:r.fontWeight,border:"1px solid"+u,cursor:"pointer"}}),Object.assign(x,{"&.MuiButtonBase-root:hover":{border:g?"1px solid"+Pa(g,-50):""}})):(Object.assign(x,{"&.MuiButtonBase-root":{fontSize:r.fontSize,fontWeight:r.fontWeight,backgroundColor:u,cursor:"pointer"}}),Object.assign(x,{"&.MuiButtonBase-root:hover":{backgroundColor:g}})),jsx("div",{children:jsx(o,{variant:c,label:s,loading:f,onPointerUp:()=>{var C,E;e.methodProvider.eventDispatcher({widgetName:d,widgetValue:null,widgetEvent:U.getFormButtonEvent(o$1),widgetContext:JSON.stringify({referer:w.pathname,parentWidgetId:p,hasParentForm:T.hasParentForm(),originator:(C=e.context.params)==null?void 0:C.originator,parent:{widgetName:d,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:x,tabIndex:m})})}));Ra.displayName="_Button";var Ea=Ra;var ka=withTranslation()(memo(function(e){var E,H,_;let o=useRef(null),{id:i,ignorereadonly:a,defaultvalue:d,dateformat:r,label:m,name:s,onchangehandler:c,readonly:h,size:w,tabIndex:p,variant:f$1,visible:u}=e.properties,g=useLocation(),{tabId:x}=e,F=!!(!e.value&&e.validationMessage!=null&&e.context.doValidateForm),D=v=>{var y;return e.methodProvider.eventDispatcher({widgetName:s,widgetValue:v!=null?v:"",widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:x,hasParentForm:T.hasParentForm(),originator:(y=e.context.params)==null?void 0:y.originator})})};useEffect(()=>{if(!e.value&&d)if(d==="today")D(a$2().utc().format());else {let v=a$2(d);v.isValid()&&D(v.toISOString());}},[]);let C=(H=(E=e==null?void 0:e.i18n)==null?void 0:E.language)==null?void 0:H.substr(0,2);return jsx(f,{id:i,defaultvalue:d,disabled:!!(h&&!a),error:F,format:r!==void 0&&r!==""&&r!=null?r:void 0,helperText:F?e.validationMessage:"",inputRef:o,label:m,locale:C,name:s,onBlur:v=>{if(!v){if(!e.value)return;D(null);return}let y=a$2(v);y.isValid()&&D(y.toISOString());},size:w,type:"datepicker",value:(_=e.value)!=null?_:"",variant:f$1,visible:u})}));ka.displayName="_Textinput";var Ma=ka;var Na=withTranslation()(memo(function(e){var _,v,y;let o=useRef(null),{id:i,ignorereadonly:a,defaultvalue:d,dateformat:r,label:m,name:s,onchangehandler:c,readonly:h,size:w,tabIndex:p,variant:f,visible:u}=e.properties,g$1=useLocation(),{tabId:x}=e,[F,D]=useState(String((_=e.value)!=null?_:"")),C=!!(!F&&e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{var b;D(String((b=e.value)!=null?b:""));},[e.value]);let E=b=>{var W;return D(b),e.methodProvider.eventDispatcher({widgetName:s,widgetValue:b!=null?b:"",widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:g$1.pathname,parentWidgetId:x,hasParentForm:T.hasParentForm(),originator:(W=e.context.params)==null?void 0:W.originator})})};useEffect(()=>{if(!e.value&&d){let b=d==="now"?a$2().utc().format():d==="start of day"?a$2().startOf("day").utc().format():null;b&&E(b);}},[]);let H=(y=(v=e==null?void 0:e.i18n)==null?void 0:v.language)==null?void 0:y.substr(0,2);return jsx(g,{autoFocus:false,defaultvalue:d,disabled:!!(h&&!a),error:C,format:r!==void 0&&r!==""&&r!=null?r:void 0,helperText:C?e.validationMessage:"",id:i,inputRef:o,label:m,locale:H,name:s,onChange:b=>{if(!b){E(null);return}let W=a$2(b);W.isValid()&&E(W.toISOString());},size:w,value:F,variant:f,visible:u})}));Na.displayName="_Textinput";var _a=Na;var La=withTranslation()(memo(function(e){var E,H,_;let o=useRef(null),{id:i,ignorereadonly:a,defaultvalue:d,dateformat:r,label:m,name:s,onchangehandler:c,readonly:h$1,size:w,tabIndex:p,variant:f,visible:u}=e.properties,g=useLocation(),{tabId:x}=e,F=!!(!e.value&&e.validationMessage!=null&&e.context.doValidateForm),D=v=>{var y;return e.methodProvider.eventDispatcher({widgetName:s,widgetValue:v!=null?v:"",widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:x,hasParentForm:T.hasParentForm(),originator:(y=e.context.params)==null?void 0:y.originator})})};useEffect(()=>{if(!e.value&&d)if(d==="now")D(a$2().utc().format());else {let v=a$2(d);v.isValid()&&D(v.toISOString());}},[]);let C=(H=(E=e==null?void 0:e.i18n)==null?void 0:E.language)==null?void 0:H.substr(0,2);return jsx(h,{id:i,defaultvalue:d,disabled:!!(h$1&&!a),error:F,format:r!==void 0&&r!==""&&r!=null?r:void 0,helperText:F?e.validationMessage:"",inputRef:o,label:m,locale:C,name:s,onBlur:v=>{if(!v){if(!e.value)return;D(null);return}let y=a$2(v);y.isValid()&&D(y.utc().format());},size:w,type:"datetimepicker",value:(_=e.value)!=null?_:"",variant:f,visible:u})}));La.displayName="_Textinput";var Va=La;var Aa=withTranslation()(memo(function(e){var P;let o=useRef(null),{datalength:i,id:a,forcereadonly:d,ignorereadonly:r,label:m,name:s,onchangehandler:c,placeholder:h,phoneformat:w,readonly:p,regex:f,size:u,style:g,tabIndex:x,uppercasemode:F,variant:D,visible:C}=e.properties,E=useLocation(),{i18n:H}=useTranslation(),{viewPort:_}=b(),{tabId:v}=e,[y,b$1]=useState(String((P=e.value)!=null?P:"")),W=!!(e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{e.value!==void 0&&e.value!==null&&b$1(String(e.value));},[e.value]);let Z=V=>{var S;e.methodProvider.eventDispatcher({widgetName:s,widgetValue:V,widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:E.pathname,parentWidgetId:v,hasParentForm:T.hasParentForm(),originator:(S=e.context.params)==null?void 0:S.originator})});},te=V=>{b$1(V);};return jsx(n,{autoFocus:false,disabled:!!(p&&!r),error:W,helperText:W?e.validationMessage:"",id:a,inputProps:{id:a,tabIndex:x,style:{...g}},InputProps:{},inputRef:o,label:m,maxCharCount:i,name:s,onBlur:V=>{Z(V.target.value);},onInput:V=>{te(V.target.value),_.isMobileDevice&&Z(V.currentTarget.value);},placeholder:h,locale:H==null?void 0:H.language,phoneFormat:w||void 0,readOnly:!!(p&&!r),regEx:f,size:u!=null?u:"small",type:w?"phone":"text",toUpperCase:F,value:y,variant:D,visible:C})}));Aa.displayName="_PhoneInput";var Oa=Aa;var Ua=withTranslation()(memo(function(e){var ce;let o=useRef(null),{t:i,i18n:a}=useTranslation(),d=a==null?void 0:a.language,{currency_format:r,currency_assymbol:m,currency_currencydisplay:s,currency_fixedlocale:c,datalength:h,id:w,ignorereadonly:p,label:f,name:u,onchangehandler:g,placeholder:x,readonly:F,regex:D,size:C,style:E,tabIndex:H,uppercasemode:_,variant:v,visible:y}=e.properties,b$1=useLocation(),{viewPort:W}=b(),{tabId:Z}=e,[te,P]=useState(String((ce=e.value)!=null?ce:"0")),[V,S]=useState(false),[U$1,Q]=useState(0),B=useRef(0);useEffect(()=>{var K;P(String((K=e.value)!=null?K:"0"));},[e.value]),useEffect(()=>{e.validationMessage!=null&&(B.current+=1,S(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:g?U.onChange:null,widgetContext:JSON.stringify({referer:b$1.pathname,parentWidgetId:Z,hasParentForm:T.hasParentForm(),originator:(ue=e.context.params)==null?void 0:ue.originator})});},re=K=>{P(K);},pe=r==="fixed-locale"&&c?c:d,Fe=()=>{var Te;if(s==="")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:(r==="locale"||r==="fixed-locale")&&(Te=j(pe!=null?pe:""))!=null?Te:""},se=s==="symbol"?true:s==="code"?false:m!=null?m:false,A=r==="locale"||r==="fixed-locale"?"locale":r!=null?r:"";return jsx(n,{autoFocus:false,currency:Fe(),disabled:!!(F&&!p),error:k,helperText:k?e.validationMessage:"",id:w,inputProps:{id:w,tabIndex:H,style:{...E,textAlign:"right"}},InputProps:{},inputRef:o,label:f,locale:pe,maxCharCount:h,name:u,onBlur:K=>{S(true);let ue=K.target.value;(ue==="0"||ue==="")&&Q(Te=>Te+1),q(ue);},onInput:K=>{re(K.target.value),W.isMobileDevice&&q(K.currentTarget.value);},onChange:K=>{te.trim()===""&&q(K.target.value);},placeholder:x,readOnly:!!(F&&!p),regEx:D,size:C,type:"currency",toUpperCase:_,value:te,variant:v,visible:y,format:A,assymbol:se},U$1)}));Ua.displayName="_CurrencyInput";var Ga=Ua;var $a=withTranslation()(memo(function(e){var Q,B;let o=useRef(null),{t:i,i18n:a}=useTranslation(),d=(Q=a==null?void 0:a.language)==null?void 0:Q.substring(0,2),{datalength:r,id:m,forcereadonly:s,ignorereadonly:c,label:h,name:w,onchangehandler:p,placeholder:f,readonly:u,regex:g,size:x,style:F,tabIndex:D,uppercasemode:C,variant:E,visible:H}=e.properties,[_,v]=useState(false),{viewPort:y}=b(),b$1=useLocation(),{tabId:W}=e,[Z,te]=useState(String((B=e.value)!=null?B:"")),P=!!(Z.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{var k;te(String((k=e.value)!=null?k:""));},[e.value]);let V=()=>{v(k=>!k);},S=k=>{var q;e.methodProvider.eventDispatcher({widgetName:w,widgetValue:k,widgetEvent:p?U.onChange:null,widgetContext:JSON.stringify({referer:b$1.pathname,parentWidgetId:W,hasParentForm:T.hasParentForm(),originator:(q=e.context.params)==null?void 0:q.originator})});},U$1=k=>{te(k);};return jsx(n,{autoFocus:false,disabled:!!(u&&!c),error:P,helperText:P?e.validationMessage:"",id:m,inputProps:{id:m,tabIndex:D,style:{...F,textAlign:"center"}},InputProps:{endAdornment:jsx(Ol,{position:"end",children:jsx(sr,{onClick:V,edge:"end",children:_?jsx(Wl,{}):jsx(Hl,{})})})},inputRef:o,label:h,locale:d,maxCharCount:r,name:w,onBlur:k=>{S(k.target.value);},onInput:k=>{U$1(k.target.value),y.isMobileDevice&&S(k.currentTarget.value);},onChange:k=>{Z.trim()===""&&S(k.target.value);},placeholder:f,readOnly:!!(u&&!c),regEx:g,size:x,type:"text",toUpperCase:C,value:Z,variant:E,visible:H,inputtype:_?"text":"password"})}));$a.displayName="_PasswordInput";var qa=$a;var Qa=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 Ka(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 Xa({icon:t,expandable:e,children:o,isFirstRootNode:i,...a}){return jsxs(TreeItem2Label,{...a,sx:{display:"flex",alignItems:"center",fontWeight:i?"700":"normal",backgroundColor:"transparent","&.Mui-focused, &.Mui-selected":{backgroundColor:"transparent"}},children:[t&&jsx(Ya,{component:t,className:"labelIcon",color:"inherit",sx:{mr:1,fontSize:"1.2rem"}}),jsx(sd,{sx:{fontSize:i?"1rem":"0.9rem",fontWeight:i?"700":"normal"},children:o})]})}var er=t=>Array.isArray(t)?t.length>0&&t.some(er):!!t,Ct=t$1=>{let e=null,o=t$1.action,i=t$1.applyInternalStyle?{fontSize:"1em",marginRight:"0.5em"}:{};return o==="add"?e=jsx(t,{style:i}):o==="edit"?e=jsx(A$1,{style:i}):o==="share"?e=jsx(E,{style:i}):o==="trash"&&(e=jsx(N,{style:i})),e},md=Re.forwardRef(function(e,o){let{id:i,itemId:a,label:d,disabled:r,children:m$1,item:s,index:c,mode:h,setSelectedItem:w$1,treeCheckedItems:p,properties:f,disableRootItem:u,userData:g,formData:x,deletePrompt:F,selectedItem:D,execCommands:C,eventDispatcher:E,...H}=e,{getRootProps:_,getContentProps:v,getIconContainerProps:y,getCheckboxProps:b$1,getLabelProps:W,getGroupTransitionProps:Z,getDragAndDropOverlayProps:te,status:P}=unstable_useTreeItem2({id:i,itemId:a,children:m$1,label:d,disabled:r,rootRef:o}),V=useLocation(),{t:S}=useTranslation(),[U$1,Q]=Re.useState(null),B=!!U$1,k=er(m$1),q=c===0?void 0:Jl,[re,pe]=Re.useState(P.expanded),{runFormEvent:Fe}=b(),se=useCallback(async(M,ee,O,De,ye,n)=>{var ae,ie,We;M&&await Fe({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:ye.pathname,parentWidgetId:n,hasParentForm:T.hasParentForm(),originator:(ie=O.params)==null?void 0:ie.originator,parent:O.params,folderData:(We=O.params)==null?void 0:We.folderData}),widgetEvent:U.onDelete,widgetName:"delete",formData:O.formData}).then(qe=>{if(qe.meta.requestStatus==="fulfilled"){let xe={...qe.payload};O.execCommands(xe.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]),Te=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 Fe({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:f==null?void 0:f.name,widgetValue:M,formData:x}).then(De=>{if(De.meta.requestStatus==="fulfilled"){let ye={...De.payload};ye.FECommand={...ye.FECommand,UpdateFormData:ye.data},e.execCommands(ye.FECommand);}});},[e,f==null?void 0:f.name,V.pathname]),G=useCallback(()=>{e.deletePrompt({delete:{showDialog:true,dialogTitle:S("Delete")+" ?",dialogContent:S("Are you certain that you wish to delete this folder?"),buttonAgree:S("Continue"),buttonDisagree:S("Close"),callBackFunc:M=>{M?se(M,"delete",e,{},V,""):se(false,"",e,{},V,"");}}});},[e,S,V,se]);if(h==="live"){let M=g.rightMode!=="Edit";return jsxs(Qa,{..._(H),sx:{"& > ul":{paddingLeft:"0.2rem",paddingRight:"0.1rem"}},children:[jsxs(id,{...v({className:w("content",{"Mui-expanded":re,"Mui-selected":P.selected,"Mui-focused":P.focused,"Mui-disabled":P.disabled})}),children:[c!==0&&jsxs(Fragment,{children:[jsx(TreeItem2IconContainer,{...y({status:P,onPointerUp:A}),children:jsx(TreeItem2Icon,{status:P})}),jsx(TreeItem2Checkbox,{...b$1()})]}),jsx(Xa,{...W({icon:q,expandable:k&&re,isFirstRootNode:c===0,onClick:ee=>{w$1&&w$1(ee,a),ee.stopPropagation();}}),children:d}),!M&&e.selectedItem===a&&c!==0&&jsx(sr,{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:U$1,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:S("New Folder")})]}),jsxs(xt,{onClick:ge,children:[jsx(yt,{children:jsx(Ct,{action:"edit",applyInternalStyle:true})}),jsx(wt,{children:S("Settings")})]}),jsxs(xt,{onClick:Te,children:[jsx(yt,{children:jsx(Ct,{action:"share",applyInternalStyle:true})}),jsx(wt,{children:S("Share")})]}),jsxs(xt,{onClick:G,children:[jsx(yt,{children:jsx(Ct,{action:"trash",applyInternalStyle:true})}),jsx(wt,{children:S("Delete")})]})]}),jsx(TreeItem2DragAndDropOverlay,{...te()})]}),m$1&&jsx(Ka,{...Z(),in:re,children:m$1})]})}else {let M=false;return p&&p.length>0&&p.forEach((ee,O)=>{if(ee===a){M=true;return}}),jsxs(Qa,{..._({...H,expandable:false}),sx:{"& > ul":{paddingLeft:"1rem",paddingRight:"0rem"}},children:[jsxs(ld,{...v({className:w("content",{"Mui-expanded":true,"Mui-selected":P.selected,"Mui-focused":P.focused,"Mui-disabled":P.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(Xa,{...W({icon:q,expandable:k,isFirstRootNode:c===0}),children:d}),jsx(TreeItem2DragAndDropOverlay,{...te()})]}),m$1&&jsx(Ka,{...Z(),in:true,children:m$1})]})}}),cd=t=>{let e=[],o=i=>{i.forEach(a=>{a.children&&a.children.length>0&&(e.push(a.id),o(a.children));});};return o(t),e},ud=(t,e)=>{let o=(i,a)=>{for(let d of i)if(d.id===a||d.children&&o(d.children,a))return d;return null};return o(t,e)},fd=(t,e)=>{let o=[],i=(a,d,r=[])=>{for(let m of a){if(m.id===d)return o.push(...r),true;if(m.children&&i(m.children,d,[...r,m]))return true}return false};return i(t,e),o},Ut=(t,e)=>{for(let o of t){if(o.id===e)return o;if(o.children){let i=Ut(o.children,e);if(i)return i}}return null},It=(t,e)=>{for(let o of t){if(o.id===e)return [o.label];if(o.children){let i=It(o.children,e);if(i.length>0)return [o.label,...i]}}return []},pd=({eventDispatcher:t,execCommands:e,params:o,properties:i,redrawComponent:a,formlayout:d,onFolderSelected:r,onFolderAdded:m,formData:s,mode:c,checkedItems:h})=>{var U$1,Q;let{runFormEvent:w}=b(),[p,f]=Re.useState([]),[u,g]=Re.useState(((U$1=o==null?void 0:o.folderData)==null?void 0:U$1.id)||null),[x,F]=Re.useState([]),[D,C]=Re.useState(h),[E,H]=Re.useState(false),[_,v]=Re.useState(),{UserDialog:y}=b$1();Re.useEffect(()=>{C(h);},[h]);let b$2=useCallback(T.debounce(async()=>{var B,k,q,re,pe,Fe,se,A,ce,K,ue;try{let Te=await w({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(Te.meta.requestStatus==="fulfilled"){let ge={...Te.payload};ge!=null&&ge.userData&&v(ge==null?void 0:ge.userData),(re=ge==null?void 0:ge.userData)!=null&&re.isContributor&&H(!0);let X=JSON.parse(ge.widgetData.treeData);if(f(X),(pe=o==null?void 0:o.folderData)!=null&&pe.addedFolderId){let G=ud(X,(Fe=o==null?void 0:o.folderData)==null?void 0:Fe.addedFolderId);if(G){let M=cd([G]);F(M),g((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(x.length===0&&F([(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;g(G||null),r(G||null,M);}}}catch(Te){}},500),[o]);Re.useEffect(()=>(b$2(),()=>{b$2.cancel();}),[b$2]),Re.useEffect(()=>{var B,k,q,re,pe,Fe;if((B=o==null?void 0:o.folderData)!=null&&B.id){g(((k=o==null?void 0:o.folderData)==null?void 0:k.id)||null);let se=Ut(p,(q=o==null?void 0:o.folderData)==null?void 0:q.id),A=It(p,se==null?void 0:se.id),ce=[],K=fd(p,(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),F(ce)),r((Fe=o==null?void 0:o.folderData)==null?void 0:Fe.id,se==null?void 0:se.isroot,A);}},[(Q=o==null?void 0:o.folderData)==null?void 0:Q.id]);let[W,Z]=useState({delete:{buttonAgree:"",buttonDisagree:"",dialogTitle:"",dialogContent:"",showDialog:false,callBackFunc:()=>{}}}),te=B=>W.delete.callBackFunc(B),P=B=>{Z(B);},V=(B,k)=>{g(k);let q=Ut(p,k),re=It(p,q==null?void 0:q.id);r(k,q==null?void 0:q.isroot,re);};return jsxs(Fragment,{children:[jsx(Ya,{sx:{paddingTop:"5px"},children:jsx(RichTreeView,{items:p,selectedItems:u,expandedItems:x,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:P,index:p.findIndex(k=>k.id===B.itemId),selectedItem:u,setSelectedItem:V,treeCheckedItems:D,disableRootItem:E,userData:_,formData:s,properties:i})},onSelectedItemsChange:V,onExpandedItemsChange:(B,k)=>{var re;let q=(re=p[0])==null?void 0:re.id;q&&!k.includes(q)?F(pe=>pe.includes(q)?pe:[...pe,q]):F(k);}})}),jsx(y,{...W.delete,handleDialogClose:te})]})},ct=pd;var or=withTranslation()(memo(function(e){var c,h;let{style:o,verticalalign:i,plugincode:a,formcode:d,visible:r}=e.properties,m={paddingTop:"0px"};if(i==="bottom"&&(m.paddingTop="10px"),!r)return null;let s=(c=e.context.formData)!=null&&c[e.properties.name]?JSON.parse((h=e.context.formData)==null?void 0:h[e.properties.name]):{};return jsx("div",{style:{...o,...m,minHeight:"2rem"},children:jsx(ct,{params:{sourceFormCode:d,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:s,redrawComponent:e.context.redrawComponent,eventDispatcher:e.methodProvider.eventDispatcher,execCommands:e.methodProvider.execCommands,formData:e.context.formData,formlayout:"folders",onFolderSelected:()=>{},onFolderAdded:()=>{},mode:"setup"})})}));or.displayName="_View";var nr=or;var bd=lazy(()=>import('./tabulator-QD3OEHKN.js').then(t=>({default:t.TabulatorTable}))),vd=lazy(()=>import('./datatable-U7HNLJAU.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 Ga;if(o.inputtype==="password")return qa;if(o.inputtype==="date")return Ma;if(o.inputtype==="time")return _a;if(o.inputtype==="datetime")return Va;if(o.inputtype==="phone")return Oa}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 nr}return e}};function ir(t,e,o){var i=this,a=useRef(null),d=useRef(0),r=useRef(null),m=useRef([]),s=useRef(),c=useRef(),h=useRef(t),w=useRef(true);useEffect(function(){h.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 f=!!(o=o||{}).leading,u=!("trailing"in o)||!!o.trailing,g="maxWait"in o,x=g?Math.max(+o.maxWait||0,e):null;useEffect(function(){return w.current=true,function(){w.current=false;}},[]);var F=useMemo(function(){var D=function(y){var b=m.current,W=s.current;return m.current=s.current=null,d.current=y,c.current=h.current.apply(W,b)},C=function(y,b){p&&cancelAnimationFrame(r.current),r.current=p?requestAnimationFrame(y):setTimeout(y,b);},E=function(y){if(!w.current)return false;var b=y-a.current;return !a.current||b>=e||b<0||g&&y-d.current>=x},H=function(y){return r.current=null,u&&m.current?D(y):(m.current=s.current=null,c.current)},_=function y(){var b=Date.now();if(E(b))return H(b);if(w.current){var W=e-(b-a.current),Z=g?Math.min(W,x-(b-d.current)):W;C(y,Z);}},v=function(){var y=Date.now(),b=E(y);if(m.current=[].slice.call(arguments),s.current=i,a.current=y,b){if(!r.current&&w.current)return d.current=a.current,C(_,e),f?D(a.current):c.current;if(g)return C(_,e),D(a.current)}return r.current||C(_,e),c.current};return v.cancel=function(){r.current&&(p?cancelAnimationFrame(r.current):clearTimeout(r.current)),d.current=0,m.current=a.current=s.current=r.current=null;},v.isPending=function(){return !!r.current},v.flush=function(){return r.current?H(Date.now()):c.current},v},[f,g,e,x,u,p]);return F}var Fd=Re__default.createContext(void 0),dr=({children:t,eventDispatcher:e,redrawComponent:o,formlayout:i,params:a,onFolderSelected:d,onFolderAdded:r,formData:m,execCommands:s$1})=>{let[c,h]=useState(i),{viewPort:w}=b(),[p,f]=useState(false),{t:u}=useTranslation(),g=()=>f(C=>!C),x=()=>f(false),F={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"}},D=()=>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:h},children:[(!i||i==="regular")&&t,i==="folders"&&jsxs("div",{className:"viewHolder",style:F.viewHolder,children:[w.isMobileDevice?jsxs(Fragment,{children:[!p&&jsx("button",{onClick:g,style:{...F.toggleButton,...F.toggleButtonMenuActive},children:s({size:"1.3rem"})}),jsx(xd,{open:p,onClick:x,sx:{zIndex:998,backgroundColor:"rgba(0, 0, 0, 0.5)"}}),jsxs("div",{style:F.btreeContainerMobile,onClick:C=>C.stopPropagation(),children:[jsx("div",{style:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingLeft:"0.5rem"}}),jsx(D,{}),jsx(ct,{params:{...a,sourcePluginCode:a.pluginCode,sourceFormCode:a.formCode},redrawComponent:o,eventDispatcher:e,execCommands:s$1,formData:m,formlayout:i,onFolderSelected:d,onFolderAdded:r,mode:"live"})]})]}):jsxs("div",{className:"foldersHolder",style:F.btreeContainerDesktop,children:[jsx(D,{}),jsx(ct,{params:{...a,sourcePluginCode:a.pluginCode,sourceFormCode:a.formCode},redrawComponent:o,eventDispatcher:e,execCommands:s$1,formData:m,formlayout:i,onFolderSelected:d,onFolderAdded:r,mode:"live"})]}),jsx("div",{style:F.mainContent,children:t})]})]})};var kd=lazy(()=>import('./fileviewer-73OY3DUG.js')),Md=lazy(()=>import('./formeditor-G4VYCI67.js').then(t=>({default:t.Formeditor}))),Dt=t=>new Promise(e=>setTimeout(e,t));function mr(t,e={}){let o={},i=e!=null?e:{},a=r=>{let m=r==null?void 0:r.properties;if(!(m!=null&&m.name)||!(m!=null&&m.defaultvalue)||r.stricttype!=="_Textinput")return;let{name:s,inputtype:c}=m,h=String(m.defaultvalue).toLowerCase().trim();if(!(i[s]!=null&&i[s]!==""))if(c==="date")if(h==="today")o[s]=a$2().utc().format();else {let w=a$2(h);w.isValid()&&(o[s]=w.utc().format());}else if(c==="datetime")if(h==="now")o[s]=a$2().utc().format();else {let w=a$2(h);w.isValid()&&(o[s]=w.utc().format());}else c==="time"&&(h==="now"?o[s]=a$2().utc().format():h==="start of day"&&(o[s]=a$2().startOf("day").utc().format()));},d=r=>{if(r.type==="formrow"||r.stricttype==="_Rowcontainer")for(let m of r._children||[])for(let s of m._children||[])a(s);else if(r._children)for(let m of r._children)d(m);};for(let r of t||[])d(r);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"},cr={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:i,setup:a,params:d$2,enableEventHandlers:r,modalCloseFn:m}){var Zt,eo;let s={...d$2,modalCloseFn:m||(d$2==null?void 0:d$2.modalCloseFn)},c=useRef(null),[h,w]=useState(0),{registerFormSubmitEvent:p,checkFormAccess:f}=e$1(),{apiConfig:u,appSettings:g,viewPort:x,runLoadFormEvent:F,runServerPingEvent:D,runFormEvent:C,fetchUserMenu:E,signInUser:H,signOut:_}=b(),[v,y]=useState(null),b$1=useNavigate(),[W,Z]=useState(false),te=useRef({}),[P$1,V]=useState({}),[S,U]=useState(null),[Q,B]=useState(null),k=useLocation(),[q]=useState(x.width),[re]=useState(s.modal||false),[pe]=useState(T.hasParentForm()||!!(u!=null&&u.token)),[Fe,se]=useState([]),A=Fe.length>0?Fe[Fe.length-1]:Bd,[ce,K]=useState(),[ue,Te]=useState(true),{t:ge,i18n:X}=useTranslation(),G=c$1(),M=d(),ee=e$2(),{dismissAll:O}=b$2(),De=useRef(false);useEffect(()=>()=>{De.current=true;},[]);let ye={command:{},params:s,doValidateForm:false,redrawComponent:false,redrawFoldersComponent:false,fieldAllowedValues:{},formData:{},widgetRelatedData:[],widgetsState:{visibility:{},readonly:{}},formDimension:{width:h,height:0},formValidationData:{},enableEventHandlers:r,isModal:re,hasParentForm:pe,formLayout:"regular"},[n,ae]=useState(ye),[ie,We]=useState({...cr,containerSetup:a}),qe=ir(()=>{c&&c.current&&w(c.current.offsetWidth);},200),xe=async(l,R)=>{await F({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 T$1=>{var L,$,Y,Ce,he,be,Se,z;if(T$1.meta.requestStatus==="fulfilled"){let N={...T$1.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 f(l.formCode);(Ge==null?void 0:Ge.subscriptionPlan)!=null&&U(Ge.subscriptionPlan);}}catch(de){B({title:($=(L=de==null?void 0:de.data)==null?void 0:L.error)!=null?$:"Form Unavailable",message:(Ce=(Y=de==null?void 0:de.data)==null?void 0:Y.message)!=null?Ce:"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(R){ae(de=>({...de,formData:de.formData,fieldAllowedValues:N.fieldAllowedValues,widgetsState:le,formLayout:N.layout,requiredFields:N.requiredFields}));return}let Ee={},Ne=[],He={},Ue=JSON.parse(N.definition);if(Ue==null){ae({...ye,redrawComponent:false,doValidateForm:false,command:{...N.FECommand},formData:{},widgetsState:le,formLayout:N.layout,requiredFields:N.requiredFields,params:{...ye.params,folderData:N.folderData}});return}T.mapComponents(Ue._children);let Xe=Ue.properties;Ne=Ue._children,He=Ue,We({...ie,containerProps:Xe,selectedWidgetProps:{...ie.containerProps},containerData:Ne,containerSetup:He}),Be=N.fieldAllowedValues,Ee={...N.data,...mr(Ne,N.data)},ae({...ye,formData:Ee,formLayout:N.layout,widgetsState:{visibility:{...n==null?void 0:n.widgetsState.visibility,...(Se=N==null?void 0:N.widgetsState)==null?void 0:Se.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:{...ye.params,folderData:N.folderData}}),Z(true);}});};if(useEffect(()=>(qe(),xe(s,false),window.addEventListener("resize",qe),()=>{ae(()=>({...qt})),We(cr),Z(false),window.removeEventListener("resize",qe);}),[s.pGuid,s.guid,s.pluginCode,s.formCode]),useEffect(()=>{var T;if(!W||!((T=ie.containerSetup)!=null&&T._children))return;let l=ie.containerSetup._children,R=setTimeout(()=>{ae(L=>{let $=mr(l,L.formData);return Object.keys($).length===0?L:{...L,formData:{...L.formData,...$}}});},0);return ()=>clearTimeout(R)},[X.language,W]),useEffect(()=>{var $,Y,Ce,he,be,Se,z,N,Be,le,Ee,Ne,He,Ue,Xe,de,Rt,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,So,Ro,Eo,ko,Mo,Bo,No,_o,Lo,Vo,Ao,Oo,Wo,Ho,Uo,Go,zo,$o,qo,Jo,jo,Qo,Ko,Xo,Yo,Zo,en,tn,on,nn,an;let l=n,R=null,T$1=true,L=false;if(($=n.command)!=null&&$.Messages&&((Y=n.command)==null||Y.Messages.forEach(me=>{var Ie,Ye;let ne=(Ie=te.current[me.text])!=null?Ie: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"&&(T$1=false,G({toastID:nanoid(11),msg:ne,clearQueue:false,hideProgressBar:false}));})),(Ce=n.command)!=null&&Ce.DisplayButtonLoader){ae({...n,displayButtonLoader:true});return}if((he=n.command)!=null&&he.DisplayErrorPage){b$1("/pagenotfound");return}if((be=n.command)!=null&&be.MoveToTab){let me=(z=(Se=n.command)==null?void 0:Se.MoveToTab)==null?void 0:z.widgetName;if(me){let ne=T.getTabWidgetByFieldName(me,ie.containerSetup);ne!==null&&(ne==null?void 0:ne.tabId)!=null&&we(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&&we(ne),setTimeout(()=>{let Me=[`[name="${me}"]`,`[data-field-name="${me}"]`,`#${me}`,`[id*="${me}"]`],Ie=null;for(let Ye of Me)try{if(Ie=document.querySelector(Ye),Ie)break}catch(Et){}Ie&&(Ie.scrollIntoView({behavior:"smooth",block:"center"}),(Ie.tagName==="INPUT"||Ie.tagName==="TEXTAREA"||Ie.tagName==="SELECT")&&Ie.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:(Ue=(He=n.command)==null?void 0:He.FetchUserMenu)==null?void 0:Ue.projectGuid}),(Xe=n.command)!=null&&Xe.Redirect){s.modalCloseFn&&s.modalCloseFn(),b$1(`${(de=n.command)==null?void 0:de.Redirect.url}?ref=${(to=(Ge=(Rt=n.command)==null?void 0:Rt.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){b$1(`${(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,Ie,Ye,Et,rn;H&&await H((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=(Ie=n.command)==null?void 0:Ie.Login)==null?void 0:Ye.url)}),b$1(((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 _(),b$1("/"));})(),((go=n.command)!=null&&go.Cancel||(ho=n.command)!=null&&ho.CloseForm)&&(n.isModal&&s.modalCloseFn!==void 0?(O==null||O(),s.modalCloseFn(null,null,false,(bo=n.command)==null?void 0:bo.RedrawFolders)):(R=T.getUrlParameter("ref"),R!=null&&b$1(R))),(vo=n.command)!=null&&vo.AfterRecordSave){let me=(yo=g==null?void 0:g.TOASTER_AUTOCLOSE)!=null?yo:i$1.TOASTER_AUTOCLOSE;if(R=T.getUrlParameter("ref"),((wo=n.command)==null?void 0:wo.AfterRecordSave.guid)==null)!((xo=n.command)!=null&&xo.OpenModal)&&s.modalCloseFn?s.modalCloseFn(null,null,false,null,null):(Co=n.command)!=null&&Co.OpenModal||(async()=>(await Dt(L?me:0),!De.current&&R!=null&&b$1(R)))();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,Ie;await Dt(L?me:0),!De.current&&s.modalCloseFn&&s.modalCloseFn(ne,n.formData,(Me=n.command)==null?void 0:Me.RedrawScreen,(Ie=n.command)==null?void 0:Ie.RedrawFolders,null);})();}else {let ne=R!=null;if(!((Do=n.command)!=null&&Do.OpenModal)&&ne&&T$1)(async()=>(await Dt(L?me:0),!De.current&&R!=null&&b$1(R)))();else if(!((Po=n.command)!=null&&Po.OpenModal)){let Me=k.pathname.replace(/\/new/gi,"/"+((So=n.command)==null?void 0:So.AfterRecordSave.guid.replace(/#/g,"%23")));b$1(Me,{state:{from:k.pathname}}),l={...l,params:{...n.params,guid:(Ro=n.command)==null?void 0:Ro.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,[(Wo=n.command)==null?void 0:Wo.UpdateFormDataItem.name]:(Ho=n.command)==null?void 0:Ho.UpdateFormDataItem.value}}),((Go=(Uo=n.command)==null?void 0:Uo.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:s.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(h$1,{title:Q.title,message:Q.message});if(!W)return Re__default.createElement("div",{},jsx(a$3,{message:ge("Please wait...")}));let rt=(l,R)=>{let T={};return Object.entries(l).forEach(([L,$])=>{let Y=R[L];(Y==null||Y===""||Y==="0"||Y===0||Array.isArray(Y)&&Y.length===0)&&(T[L]=$);}),T},we=(l,R=false,T$1={})=>{let L=ft(null,l.tabId,l.index,R,T$1.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&&we($,true,L)):R===false&&ft(null,l.tabId,l.index,true);},it=async l=>(ae({...n,displayButtonLoader:true}),await C({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 R=>{var T,L,$,Y,Ce,he,be,Se;if(R.meta.requestStatus==="fulfilled"){let z={...R.payload};((T=z.FECommand)==null?void 0:T.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)):(Ce=z.FECommand)!=null&&Ce.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:(Se=z.FECommand)==null?void 0:Se.FormValidationData},ot(z.FECommand));}else ae({...n,displayButtonLoader:false});})),Jt=l=>{let R=l.widgetContext,T$1=l.widgetEvent,L=l.widgetName.toLowerCase(),$=l.widgetValue,Y=l.feCommand||{},Ce=l.skipFormDataItem||false;if(T$1!==null&&n.enableEventHandlers){if(l.autoSave){it(l.autoSave);return}let he=$!=null&&Ce===false?{...n.formData,[L]:$}:n.formData;if((T$1==null?void 0:T$1.toUpperCase())==="ONSAVE"&&n.requiredFields!=null){let be=rt(n.requiredFields,he),Se=Object.keys(n.formValidationData||{}).length>0,z=Object.keys(be).length>0;if((z||Se)&&(ae({...n,command:{...n.command,FormValidationData:be}}),z))return}(async()=>{var be,Se;if((T$1==null?void 0:T$1.toUpperCase())==="ONSAVE")try{await p(n.params.formCode);}catch(z){if((z==null?void 0:z.status)===429)return}Te(false),await C({pluginCode:n.params.pluginCode,formCode:n.params.formCode,guid:n.params.guid,projectGuid:(be=n.params.pGuid)!=null?be:"",pGuid:(Se=n.params.pGuid)!=null?Se:"",widgetContext:R,widgetEvent:T$1,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=[],He={};T.mapComponents(Ee._children);let Ue=Ee.properties;Ne=Ee._children,He=Ee,We({...ie,containerProps:Ue,selectedWidgetProps:{...ie.selectedWidgetProps},containerData:Ne,containerSetup:He});let Xe=L;if(Xe){let de=T.getTabWidgetByFieldName(Xe,He);de!==null&&(de==null?void 0:de.tabId)!=null&&we(de,true,{containerSetup:He});}}Ce||(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(Te(true),(T$1==null?void 0:T$1.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});}},pr=(l,R,T$1)=>T.findRowItem(l,R,T$1,ie.containerSetup._children),gr=(l,R,T$1,L)=>T.findSegmentItem(l,R,T$1,L,ie.containerSetup._children),hr=l=>T.findWidgetByIdRecursive(ie.containerSetup._children,l),br=(l,R)=>T.getActiveTabIndex(ie.containerSetup._children,R),ft=(l,R,T$1,L=true,$={})=>{let Y=Object.keys($).length>0?$:ie.containerSetup;if(!R)return;let Ce=T.getTabContainer(Y._children,R),he=T.getTabContainerChildrens(Y._children,R);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===T$1)[0];be.properties={...Ce.item.properties.tabsetup,...be.properties};let Se=T.getNodeUpdatePath(he.path,{$splice:[[T$1,1,{...be,activeTab:"1"}]]});var z={containerSetup:{...Y,_children:(0, ur.default)(Y._children,Se)},selectedWidgetProps:{...ie.selectedWidgetProps,tabsetup:{...be.properties},_path:{...ie.selectedWidgetProps._path,panelId:be.id},lastActiveTabId:R}};return L&&We(z),z},vr=(l=true)=>{let R=qt;l&&(R={...n,redrawComponent:!n.redrawComponent,params:{...n.params,folderData:{id:"",isRoot:"",captions:[]}}}),ae(R);},ot=l=>{ae({...n,redrawComponent:!n.redrawComponent,command:{...l}});},jt=(l,R)=>{(async()=>{if(!D){l();return}await D({cmd:"ping"}).then(async T=>{(T==null?void 0:T.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();});})();},St=(l,R=false,T,L=null)=>{jt(()=>{if(se(Y=>Y.slice(0,-1)),L!=null){let Y={...L,parentId:s.id};se(Ce=>[...Ce,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:s.id};se(Ce=>[...Ce,Y]);}if(xe(n.params,true),T){let Y=T==null?void 0:T.folderId;Qt(Y,[]);}else ae({...n,redrawComponent:!n.redrawComponent});}),R&&n.isModal&&xe(s,true);},yr=(l,R="",T)=>{let L={...n,redrawFoldersComponent:!n.redrawFoldersComponent,redrawComponent:!n.redrawComponent,params:{...n.params,folderData:{...n.params.folderData,addedFolderId:"",captions:T,id:l!==null?l:"",isRoot:R}}};ae(L);},Qt=(l,R)=>{let T=qt;l==null?T={...n,redrawFoldersComponent:!n.redrawFoldersComponent,params:{...n.params,folderData:{...n.params.folderData,addedFolderId:l!==null?l:"",captions:R}}}:T={...n,params:{...n.params,folderData:{...n.params.folderData,id:l!==null?l:"",addedFolderId:l!==null?l:"",isRoot:"",captions:R}}},ae(T);},Kt=l=>{l&&se(R=>[...R.slice(0,-1),{...l,id:nanoid(5)}]);},wr=()=>{K(void 0);},xr=()=>y(null),Cr=l=>{let{title:R,subtitle:T}=l,L=R;return T!==void 0&&String(T).trim()!==""&&(L=R+" - "+T),n.enableEventHandlers&&Object.keys((n==null?void 0:n.formData)||{}).length>0&&Object.entries(n.formData).forEach(([$,Y])=>{L=L.replace(`#${$}`,Y);}),L},{properties:Pe}=ie.containerSetup||{},{minHeight:Xt}=(Pe==null?void 0:Pe.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(g$1.Provider,{value:S,children:jsx(xa.Provider,{value:P$1,children:jsxs(dr,{execCommands:ot,eventDispatcher:Jt,redrawComponent:n.redrawFoldersComponent,formlayout:n.formLayout,params:n.params,onFolderSelected:yr,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:i,border:(Pe==null?void 0:Pe.border)===false?"none":void 0},children:[jsxs("form",{onSubmit:l=>{l.preventDefault();},style:{position:"relative"},children:[Pe&&!Pe.hideheader&&jsxs("div",{className:"form-header top-border-radius",style:{backgroundColor:(Pe==null?void 0:Pe.headerbackground)===false?"transparent":void 0},children:[jsx("div",{style:{flex:1,marginLeft:"0.5rem"},children:Pe&&Cr(Pe)}),re&&s.modalCloseFn!==void 0&&jsx("div",{style:{width:"2.5em"},children:jsx(sr,{onClick:()=>{O==null||O(),s.modalCloseFn(null);},children:Re__default.createElement(P)})})]}),Pe&&Pe.hideheader&&re&&s.modalCloseFn!==void 0&&jsx("div",{style:{position:"absolute",top:"0.5rem",right:"0.5rem",zIndex:9999},children:jsx(sr,{size:"medium",onClick:l=>{l.stopPropagation(),O==null||O(),s.modalCloseFn(null);},sx:{backgroundColor:"rgba(255, 255, 255, 0.95)","&:hover":{backgroundColor:"rgba(255, 255, 255, 1)"}},children:Re__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:h,findRowItem:pr,findSegmentItem:gr,findWidgetItem:hr,modal:re,getActiveTabIndex:br,setActiveTabIndex:ft,setRedrawComponent:vr,execCommands:ot,widgets:ie.containerSetup})})})})})]}),v!==null&&jsx(d$1,{componentName:v.componentName,options:v.options,params:{params:(Zt=v.options)!=null&&Zt.contextParams?(eo=v.options)==null?void 0:eo.contextParams:n.params,formData:n.formData,execCommands:l=>ot(l),modalCloseFn:()=>xr(),modalCloseAndOpenFn:l=>Kt(l)}})]})})}),(S==null?void 0:S.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:wr}},nanoid(11))}),!A.isFormEditorMode&&(A==null?void 0:A.pluginCode)&&(A==null?void 0:A.formCode)&&jsx(h$2,{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,R,T,L,$=null)=>St(l,T,L,$),modalCloseAndOpenFn:l=>Kt(l),originator:A.originator,parent:A.parent,folderData:A.folderData,prefillData:A.prefillData},enableEventHandlers:true}),id:A.id,onCloseModal:St,parentId:A.parentId},A.id),A.isFormEditorMode&&(A==null?void 0:A.pluginCode)&&(A==null?void 0:A.formCode)&&jsx(h$2,{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:()=>St(null,false,null),parentId:A.parentId,windowMode:"fullWindow"},A.id)]})})})}),_d=t=>{let e=0,o=i=>{for(var a in i)typeof i[a]=="object"&&i[a]!==null?o(i[a]):a==="tabIndex"&&(t.modal?i[a]=0:i[a]=++e);};return o(t.widgets._children),(t.widgets._children||[]).map(({id:i,tabId:a,panelId:d,type:r,component:m,properties:s})=>Re__default.createElement(Oe.getFormComponent(m,s),{key:"key_"+i,id:i,tabId:a,panelId:d,className:r,context:{...t.context,formDimension:{width:t.formWidth,height:0}},properties:s,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
+ export{Hn as a,Nd as b};
@@ -0,0 +1 @@
1
+ import {d}from'./chunk-SYCZSSRF.js';import {a}from'./chunk-NW34CD5C.js';import {b as b$1}from'./chunk-VUS3THHW.js';import {c}from'./chunk-AY7MKCIL.js';import {U,T,j}from'./chunk-FTJXRFLR.js';import'./chunk-U4T4ACDE.js';import {b}from'./chunk-LBMVBVXW.js';import {d as d$1,t,p,V,h,q,g,N,P,Y,W,X,Z,r,n,i,w,A,b as b$2,y,x,C,l,O,o}from'./chunk-IZKTNYAE.js';import'./chunk-5TBO732O.js';import ut,{lazy,memo,useRef,useState,useEffect,useCallback,useMemo,Suspense}from'react';import {withTranslation,useTranslation}from'react-i18next';import $n from'@mui/material/CircularProgress';import en from'@mui/material/Box';import Fe from'@mui/material/Button';import Kn from'@mui/material/Checkbox';import Qn from'@mui/material/ClickAwayListener';import Qe from'@mui/material/IconButton';import Xe from'@mui/material/ListItemIcon';import Ze from'@mui/material/ListItemText';import et from'@mui/material/MenuItem';import Xn from'@mui/material/MenuList';import oe from'@mui/material/Tooltip';import Zn from'@mui/icons-material/Search';import ea from'@mui/icons-material/SearchOff';import ta from'@mui/material/InputBase';import {nanoid}from'@reduxjs/toolkit';import {useNavigate,useLocation}from'react-router-dom';import nn from'@mui/material/Menu';import aa from'axios';import oa from'@mui/icons-material/MoreVert';import {jsx,Fragment,jsxs}from'react/jsx-runtime';var ia=lazy(()=>import('./buildocslib.esm-3YCKLIZU.js').then(d=>({default:d.DatatableImb}))),ra="#1976d2";var gt=(r=>(r[r.SIGN=0]="SIGN",r[r.CONFIRM=1]="CONFIRM",r))(gt||{}),an=(l=>(l[l.SIGN=0]="SIGN",l[l.CONFIRM=1]="CONFIRM",l[l.EDIT=2]="EDIT",l))(an||{}),tt=(d,e,r,l,g)=>{var le,H,se,B,b;return e.methodProvider.eventDispatcher({skipFormDataItem:true,widgetName:e.properties.name.toLowerCase(),widgetValue:JSON.stringify({action:d,rowData:{_id:(le=r._id)!=null?le:null,_sk:(H=r._sk)!=null?H:null,_code:(se=r._fcode)!=null?se:r._code,_origformcode:(B=r._origformcode)!=null?B:null,_plugincode:(b=r._plcode)!=null?b:r._plugincode}}),widgetEvent:U.onTableRunActionEvent,widgetContext:JSON.stringify({referer:l.pathname,parentWidgetId:g,hasParentForm:T.hasParentForm(),originator:{widgetName:e.properties.name.toLowerCase(),params:e.context.params},parent:{widgetName:e.properties.name.toLowerCase(),params:e.context.params},folderData:e.context.params.folderData})})},Me=(d,e)=>{var r,l;return !(d==="file"&&e.formLayout==="folders"&&((r=e.params.folderData)!=null&&r.isRoot||((l=e.params.folderData)==null?void 0:l.id)===null))},la=({anchorEl:d,handleClose:e,setUploadMode:r,uploadMode:l,props:g,setLoaded:le})=>{let{runFormUploadFiles:H}=b(),se=c(),B=!!d,b$1=useRef(null),[ie,J]=useState([]),{t:ce}=useTranslation(),ee=(de="file")=>{if(!Me(de,g.context)){se({toastID:nanoid(11),msg:ce("Please select a folder before uploading a file"),clearQueue:false,hideProgressBar:false});return}b$1.current&&b$1.current.click(),r(de),e();},q=async de=>{var u,_;let me=de.target.files;if(me){le(false);let F=Array.from(me).map(I=>({...I,uploadProgress:0})),x=new FormData;if(g.context.params)for(let I in g.context.params)g.context.params.hasOwnProperty(I)&&x.append(I,g.context.params[I]);x.append("fieldName",g.properties.name),Array.from(me).forEach(I=>{x.append("files",I);}),x.append("widgetContext",JSON.stringify({hasParentForm:T.hasParentForm(),originator:(u=g.context.params)==null?void 0:u.originator,folderData:(_=g.context.params)==null?void 0:_.folderData})),x.append("widgetEvent",U.onFileUploadCreateDocumentEvent),x.append("widgetName","attached_files"),x.append("formData",JSON.stringify({...g.context.formData})),x.append("uploadMode",l);let O=aa.CancelToken.source();try{let I=await H({content:x,cancelTokenSource:O,onUploadProgress:$=>{let xe=Math.round($.loaded/F.length),ge=F.map(we=>({...we,uploadProgress:$.loaded===$.total?100:Math.round(xe*100/we.size)}));J(we=>we.concat(ge));}});if(I.meta.requestStatus==="fulfilled"){let $={...I.payload};g.methodProvider.execCommands($.FECommand);}}catch(I){}b$1.current&&(b$1.current.value="");}},Te=Me("file",g.context)?"inherit":"#C0C0C0";return jsxs(Fragment,{children:[jsx("input",{type:"file",name:"files",ref:b$1,style:{display:"none"},onChange:q,multiple:true}),jsxs(nn,{anchorEl:d,open:B,onClose:e,MenuListProps:{"aria-labelledby":"upload-button"},children:[jsxs(et,{onPointerUp:()=>ee("file"),children:[jsx(Xe,{sx:{color:Te},children:jsx(Pe,{action:"uploadfile",applyInternalStyle:true})}),jsx(Ze,{primary:ce("Upload File(s)"),primaryTypographyProps:{fontSize:"0.875rem",color:Te}})]},"Upload File(s)"),jsxs(et,{onPointerUp:()=>ee("container"),children:[jsx(Xe,{children:jsx(Pe,{action:"uploadzipfile",applyInternalStyle:true})}),jsx(Ze,{primary:ce("Upload .ZIP Archive"),primaryTypographyProps:{fontSize:"0.875rem"}})]},"Upload .ZIP Archive")]})]})},sa=(d,e,r,l)=>(d._plugincode=e.context.params.pluginCode,d._origformcode=d._code=e.context.params.formCode,tt("onrowcheckboxclicked",e,d,r,l)),ca=({value:d,style:e})=>{let[r,l]=ut.useState(false),g=ut.useRef(null);return jsx(oe,{title:String(d!=null?d:"").trim()?d:"No data",open:r,arrow:true,children:jsx("div",{ref:g,style:e,onMouseEnter:()=>{g.current&&g.current.scrollWidth>g.current.clientWidth&&l(true);},onMouseLeave:()=>l(false),children:d||""})})},pt=d=>!!(d.readonly&&!d.ignorereadonly),dt=d=>{let e=d.replace(/\s/g,""),r=e.lastIndexOf(","),l=e.lastIndexOf("."),g;return r>l?g=e.replace(/\./g,"").replace(",","."):l>r?g=e.replace(/,/g,""):g=e,parseFloat(g)},Zt=(d,e,r,l)=>d===0?"first":d<e?"previous":l>0&&(d+1)*r>=l?"last":"next",mt={rowsPerPage:0,pageIndex:0,serverPaginationEnabled:false,nextToken:"",paginationDirection:"first",previousToken:"",rowCount:0,qId:""},da={string:"freetext",freetext:"freetext",currency:"price",price:"price",date:"date",datetime:"datetime",number:"number",checkbox:"checkbox"},on=withTranslation()(memo(function(e){var Ft,Tt,St;let r$1=useRef(false),{runFormEvent:l,viewPort:g$1}=b(),le=c(),{UserDialog:H}=b$1(),se=e.properties.name,B=d(se,e.properties.pagesize||50),{pageIndex:b$2,pageSize:ie}=B,[J,ce]=useState(null),[ee,q$1]=useState(false),[Te,de]=useState("single"),[me,u]=useState([]),[_,F]=useState(0),[x,O]=useState(),[I,$]=useState(),[xe,ge]=useState(false),[we,Be]=useState(false),[M,v]=useState({delete:{buttonAgree:"",buttonDisagree:"",dialogTitle:"",dialogContent:"",showDialog:false,callBackFunc:()=>{}}}),[P$1,U$1]=useState(true),[K,Oe]=useState({}),[he,xt]=useState(false),[wt,Ue]=useState(""),re=useRef(e),ve=useRef(e.context.formData);useEffect(()=>{re.current=e;},[e]),useEffect(()=>{ve.current=e.context.formData;},[e.context.formData]);let[ua,rn]=useState((Ft=e.context)==null?void 0:Ft.widgetRelatedData),ke=useCallback(async(a,t,i,m,o)=>{q$1(false),await l({pluginCode:t.context.params.pluginCode,formCode:t.context.params.formCode,guid:t.context.params.guid,projectGuid:t.context.params.pGuid,pGuid:t.context.params.pGuid,formData:t.context.formData,widgetContext:JSON.stringify({referer:m.pathname,parentWidgetId:o,hasParentForm:T.hasParentForm(),originator:{widgetName:t.properties.name.toLowerCase(),params:t.context.params},parent:{widgetName:t.properties.name.toLowerCase(),params:t.context.params},parentOriginator:{params:t.context.params.originator?t.context.params.originator.params:{}},folderData:t.context.params.folderData}),widgetEvent:U.onTableEditRunActionEvent,widgetName:t.properties.name.toLowerCase(),widgetValue:JSON.stringify({action:a,data:i})}).then(f=>{var w;if(f.meta.requestStatus==="fulfilled"){let p={...f.payload};p.FECommand={...p.FECommand,UpdateFieldAllowedValues:p.fieldAllowedValues,UpdateFormData:p.data,UpdateFormDataItem:{name:t.properties.name,value:(w=p.data)==null?void 0:w[t.properties.name]}},t.methodProvider.execCommands(p.FECommand);}});},[]),Se=useCallback(async(a,t,i,m,o,f)=>{q$1(false),f.toggleAllRowsSelected(false),await l({pluginCode:t.context.params.pluginCode,formCode:t.context.params.formCode,guid:t.context.params.guid,projectGuid:t.context.params.pGuid,pGuid:t.context.params.pGuid,widgetContext:JSON.stringify({referer:m.pathname,parentWidgetId:o,hasParentForm:T.hasParentForm(),originator:{widgetName:t.properties.name.toLowerCase(),params:t.context.params},parent:{widgetName:t.properties.name.toLowerCase(),params:t.context.params},parentOriginator:{params:t.context.params.originator?t.context.params.originator.params:{}},folderData:t.context.params.folderData}),widgetEvent:U.onTableRunBatchActionEvent,widgetName:t.properties.name.toLowerCase(),widgetValue:JSON.stringify({action:a,data:i})}).then(w=>{if(w.meta.requestStatus==="fulfilled"){let p={...w.payload};p.widgetData&&u(Object.values(p.widgetData)),U$1(true),q$1(true),p.FECommand&&t.methodProvider.execCommands(p.FECommand);}});},[e.context.params.pluginCode,e.context.params.formCode,e.context.params.guid,e.context.params.pGuid,e.properties.name,e.context.formData]),ln=useCallback((a,t,i,m,o,f)=>{a&&(i.properties.alloweditrow?ke("delete",i,JSON.stringify(m),o,f):tt(t,i,m,o,f)),v({delete:{buttonAgree:"",buttonDisagree:"",dialogTitle:"",dialogContent:"",showDialog:false,callBackFunc:()=>{}}});},[e.properties.alloweditrow]),ht=useCallback((a,t,i,m,o,f,w)=>{a&&Se(t,i,m,f,w,o),v({delete:{buttonAgree:"",buttonDisagree:"",dialogTitle:"",dialogContent:"",showDialog:false,callBackFunc:()=>{}}});},[Se,v]),sn=a=>M.delete.callBackFunc(a),nt=a=>{v(a);},{alloweditrow:be,backendpagination:te,colactions:cn,colgrouping:dn,colordering:mn,colresizing:un,enableuploadfiles:fn,height:gn,hideaddbutton:pn,newrecordurl:bt,folders:Ve,pagination:yn,pagesize:He,rowactions:xn,rowactiontype:Ge,rowclickas:We,rowdensity:wn,rownumber:hn,rowselection:bn,rowvirtualization:Cn,search:Ct,searchtype:je,selectall:Dn,stickyheader:Rn,toolbarInternalActions:_n,topToolbar:Fn,visible:Tn}=e.properties,at=yn===true,Sn=Cn!==false&&!at,In=at,Dt=Ge==="flat"||Ge==="menu"||Ge==="primary",Rt=useNavigate(),T$1=useLocation(),{tabId:k}=e,{t:V$1,i18n:ot}=useTranslation(),G=(Tt=ot==null?void 0:ot.language)==null?void 0:Tt.substring(0,2),_t=useCallback((a,t)=>{B.setLastEvaluatedKey(Number(a),t||null);},[B]),Ye=useCallback(a=>B.getLastEvaluatedKey(Number(a)),[B]),Le=useCallback(async(a,t,i,m,o)=>{var L,N;q$1(false),a&&(F(0),O(null),$(mt));let f=Zt(i.pageIndex,b$2,i.pageSize,_),w=Ye(i.pageIndex-1),p=f==="last"?"":m;xe&&f!=="last"&&(f==="next"&&(p=Ye(i.pageIndex+1)),f==="previous"&&(w=Ye(i.pageIndex+1))),await l({DataTableMeta:{serverPaginationEnabled:te,rowsPerPage:i.pageSize,pageIndex:i.pageIndex,nextToken:p,previousToken:w,paginationDirection:f==="last"?"last":t,rowCount:_,qId:o==null?void 0:o.qId,lastRequestLimit:o==null?void 0:o.lastRequestLimit,oppositeDirection:f==="last"||xe},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,widgetContext:JSON.stringify({referer:T$1.pathname,parentWidgetId:k,hasParentForm:T.hasParentForm(),originator:(L=e.context.params)==null?void 0:L.originator,parent:e.context.params,folderData:(N=e.context.params)==null?void 0:N.folderData}),widgetEvent:be?U.onTableEditDataLoad:U.onTableDataLoad,widgetName:e.properties.name.toLowerCase(),formData:e.context.formData}).then(ne=>{var ue,E,C,Ce,X,pe,Ae,Ee,Z;if(ne.meta.requestStatus==="fulfilled"){let s={...ne.payload},c=(ue=s.data)==null?void 0:ue[e.properties.name];if(Array.isArray(s.widgetData)&&s.widgetData.length===0&&typeof c=="string"&&c.trim()!==""&&c!=="null"&&c!=="undefined"){let S=JSON.parse(c);u(S!=null?S:{});}else u(Object.values((E=s.widgetData)!=null?E:{})),F((Ce=(C=s.tableMeta)==null?void 0:C.rowCount)!=null?Ce:0),O((pe=(X=s.tableMeta)==null?void 0:X.nextToken)!=null?pe:null),$((Ae=s.tableMeta)!=null?Ae:{}),(Ee=s.tableMeta)!=null&&Ee.nextToken&&_t(i.pageIndex,(Z=s.tableMeta)==null?void 0:Z.nextToken),Be(false),s.widgetRelatedData&&Object.keys(s.widgetRelatedData).length>0&&(re.current.context.widgetRelatedData=s.widgetRelatedData);U$1(a),q$1(true);}});},[te,be,Ye,xe,T$1.pathname,b$2,e.context.formData,e.context.params,e.properties.name,_,U$1,q$1,O,Be,F,u,$,_t,k]),Mn=useCallback(a=>{if(r$1.current&&!te){r$1.current=false;return}let t;typeof a=="function"?t=a({pageIndex:b$2,pageSize:ie}):t=a;let i=Zt(t.pageIndex,b$2,t.pageSize,_);if(ee&&P$1&&b$2>0){U$1(false);return}t.pageIndex!==b$2&&B.setPageIndex(Number(t.pageIndex)),t.pageSize!==ie&&B.setPageSize(Number(t.pageSize)),(te&&t.pageIndex!==b$2||t.pageSize!==ie)&&(Be(true),i==="last"&&ge(true),i==="first"&&ge(false),Le(false,i,t,x,I));},[te,b$2,_,ee,P$1,ie,Le,x,I]);useEffect(()=>{var a;rn((a=e.context)==null?void 0:a.widgetRelatedData);},[(St=e.context)==null?void 0:St.widgetRelatedData]),useEffect(()=>{r$1.current=true,B.reset(Number(He));},[e.properties.name,e.context.params]),useEffect(()=>{var a;if(be){let t=(a=e.context.formData)==null?void 0:a[e.properties.name];if(t){let i=typeof t=="string"?JSON.parse(t):t;u(i);}}},[e.context.formData]),useEffect(()=>{(async()=>{var a,t,i,m;if(e.context.enableEventHandlers){if(e.context.formLayout==="folders"&&!((t=(a=e.context.params)==null?void 0:a.folderData)!=null&&t.id)&&!((m=(i=e.context.params)==null?void 0:i.folderData)!=null&&m.isRoot))return;te?b$2===0?Le(true,"first",{pageIndex:0,pageSize:He||100},"",mt):Le(false,"current",{pageIndex:b$2,pageSize:ie},x,I):Le(true,"first",{pageIndex:0,pageSize:He||100},"",mt);}else q$1(true);})();},[e.properties.name,e.context.redrawComponent,be,te]);let Q=e.methodProvider.findWidgetItem(e.id),Ne=[],Je={};((Q==null?void 0:Q.item.properties.datasource.columns)||[]).forEach(a=>{var t;Ne[a[1]]=a[0],a[2]&&(Je[a[1]]=(t=da[a[2]])!=null?t:"freetext");});let Pn=((Q==null?void 0:Q.item._children)||[]).some(({properties:a})=>{var i,m;if(!a.item_bottomcalc)return false;let t=(m=(i=Je[a.item_name])!=null?i:a.item_columntype)!=null?m:a.item_isprice?"price":"freetext";return t==="price"||t==="number"}),vn=useMemo(()=>{let a$1=[];return ((Q==null?void 0:Q.item._children)||[]).map(({properties:t})=>{var i,m,o,f,w,p,L,N,ne,ue,E;if(t.item_name.toString()!==""){let C=(i=Je[t.item_name])!=null?i:"";C||(C=(m=t.item_columntype)!=null?m:"freetext",t.item_columntype||(t.item_isdate===true?C="date":t.item_isdatetime===true?C="datetime":t.item_ischeckbox===true?C="checkbox":t.item_isprice===true?C="price":C="freetext"));let Ce=C==="checkbox",X=C==="price",pe=C==="number",Ae=C==="date",Ee=C==="datetime",Z={};Ce?Z={accessorKey:t.item_name,muiTableHeadCellProps:{align:(o=t.style.item_textalign)!=null?o:"left"},muiTableBodyCellProps:{align:(f=t.style.item_ctextalign)!=null?f:"left"},header:t.item_title||Ne[t.item_name],Header:()=>{let s=t.item_title||Ne[t.item_name];return t.item_displaytooltip?jsx(oe,{title:s,arrow:true,children:jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"},children:s})}):jsx("span",{children:s})},Cell:({row:s})=>{var c;return jsx("span",{style:{borderBottom:"none",padding:"0px",height:"36px"},children:jsx(Kn,{checked:Array.isArray((c=re.current.context)==null?void 0:c.widgetRelatedData)&&re.current.context.widgetRelatedData.includes(s.original._sk),onPointerUp:()=>sa(s.original,re.current,T$1,k),style:{margin:0}})})},size:parseInt(t.item_minsize,10)||void 0,enableSorting:(w=t.item_enablesorting)!=null?w:false,enableHiding:(p=t.item_visible)!=null?p:true,grow:true}:(Z={accessorKey:t.item_name.toString(),muiTableHeadCellProps:{align:(L=t.style.item_textalign)!=null?L:"left"},muiTableBodyCellProps:{align:(N=t.style.item_ctextalign)!=null?N:"left"},header:t.item_title.toString()||Ne[t.item_name],Header:()=>{let s=t.item_title.toString()||Ne[t.item_name];return t.item_displaytooltip?jsx(oe,{title:s,arrow:true,children:jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"},children:s})}):jsx("span",{children:s})},size:parseInt(t.item_minsize,10)||void 0,enableSorting:(ne=t.item_enablesorting)!=null?ne:false,enableHiding:t.item_visible===true,grow:true,muiEditTextFieldProps:{required:true,error:!!(K!=null&&K.firstName),helperText:K==null?void 0:K.firstName,onFocus:()=>Oe({...K,[t.item_name.toString()]:void 0})},Cell:({cell:s})=>{var S;let c=(S=s.getValue())!=null?S:"";if(X&&c){let y=dt(c);if(!isNaN(y)){let h=t.item_fixedlocale||"",W=t.item_format==="fixed-locale"&&h?h:G||void 0,R=t.item_inputfield&&ve.current&&ve.current[t.item_inputfield]||""||t.item_currency||"",De=t.item_format==="locale"?j(G!=null?G:""):t.item_format==="fixed-locale"&&h?j(h):void 0,Re=R||De||"";try{let ye=t.item_currencydisplay||"";Re&&ye!==""?c=new Intl.NumberFormat(W,{style:"currency",currency:Re,currencyDisplay:ye,minimumFractionDigits:2,maximumFractionDigits:2}).format(y):c=new Intl.NumberFormat(W,{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}).format(y);}catch(ye){c=y.toFixed(2);}}}if(pe&&c){let y=dt(c);isNaN(y)||(c=y.toLocaleString());}if(Ae&&c){let y=(()=>{if(/^\d{4}-\d{2}-\d{2}/.test(c)){let h=a(c);if(h.isValid())return h}return a(c,"DD.MM.YYYY",true)})();if(y.isValid())try{c=new Intl.DateTimeFormat(G||void 0,{dateStyle:"short"}).format(y.toDate());}catch(h){}}if(Ee&&c){let y=(()=>{if(/^\d{4}-\d{2}-\d{2}/.test(c)){let h=a(c);if(h.isValid())return h}return a(c,"DD.MM.YYYY HH:mm",true)})();if(y.isValid())try{c=new Intl.DateTimeFormat(G||void 0,{dateStyle:"short",timeStyle:"short"}).format(y.toDate());}catch(h){}}return t.item_displaytooltip?jsx(ca,{value:c,style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:`${parseInt(t.item_maxsize,10)||150}px`,minWidth:"50px",cursor:"default"}}):jsx(Fragment,{children:c})}},t.item_bottomcalc&&(X||pe)&&(Z.muiTableFooterCellProps={align:(E=(ue=t.style)==null?void 0:ue.item_ctextalign)!=null?E:"left"},Z.Footer=({table:s})=>{var W,D;let c=(W=s.getState().creatingRow)==null?void 0:W.id,S=(D=s.getState().editingRow)==null?void 0:D.id,y=s.getFilteredRowModel().rows.reduce((R,De)=>{if(De.id===c||De.id===S)return R;let Re=De.getValue(t.item_name.toString()),ye=dt(String(Re!=null?Re:""));return R+(isNaN(ye)?0:ye)},0),h=y.toLocaleString(G||void 0,{minimumFractionDigits:X||pe?2:0,maximumFractionDigits:X||pe?2:0});if(X){let R=t.item_fixedlocale||"",De=t.item_format==="fixed-locale"&&R?R:G||void 0,ye=t.item_inputfield&&ve.current&&ve.current[t.item_inputfield]||""||t.item_currency||"",Gn=t.item_format==="locale"?j(G!=null?G:""):t.item_format==="fixed-locale"&&R?j(R):void 0,It=ye||Gn||"",Mt=t.item_currencydisplay||"";if(It&&Mt!=="")try{h=new Intl.NumberFormat(De,{style:"currency",currency:It,currencyDisplay:Mt,minimumFractionDigits:2,maximumFractionDigits:2}).format(y);}catch(pa){h=y.toFixed(2);}}return jsx("b",{children:h})})),Ae?Z.sortingFn=(s,c,S)=>{let y=s.getValue(S),h=c.getValue(S),W=D=>{if(!D)return a("1900-01-01");if(/^\d{4}-\d{2}-\d{2}/.test(D)){let R=a(D);if(R.isValid())return R}return a(D,"DD.MM.YYYY",true)};try{let D=W(y),R=W(h);return D.isBefore(R)?-1:D.isAfter(R)?1:0}catch(D){return 0}}:Ee?Z.sortingFn=(s,c,S)=>{let y=s.getValue(S),h=c.getValue(S),W=D=>{if(!D)return a("1900-01-01T00:00:00");if(/^\d{4}-\d{2}-\d{2}/.test(D)){let R=a(D);if(R.isValid())return R}return a(D,"DD.MM.YYYY HH:mm",true)};try{let D=W(y),R=W(h);return D.isBefore(R)?-1:D.isAfter(R)?1:0}catch(D){return 0}}:(X||pe)&&(Z.sortingFn=(s,c,S)=>{let y=parseFloat(s.getValue(S))||0,h=parseFloat(c.getValue(S))||0;return y-h}),We&&We!=="none"&&(Z.Cell=({row:s})=>jsx("div",{style:{cursor:"pointer",width:"100%",padding:"0.7em"},onPointerUp:()=>{var S,y,h,W,D,R;let c={pluginCode:s.original._plugincode,formCode:s.original._origformcode,guid:null,originator:(S=re.current.context.params)==null?void 0:S.originator,pGuid:(y=re.current.context.params)==null?void 0:y.pGuid,folderData:re.current.context.params.folderData};We==="new"&&(W=(h=re.current.context)==null?void 0:h.params)!=null&&W.modalCloseFn&&((R=(D=re.current.context)==null?void 0:D.params)==null||R.modalCloseAndOpenFn(c));},children:s.getValue(t.item_name.toString())})),a$1.push(Z);}}),a$1},[G,K,We,k]),kn=a=>{ce(a.currentTarget);},Ln=()=>{ce(null);},Nn=useCallback(()=>{var t,i;if(!Ve)return null;var a=(i=(t=e.context.params)==null?void 0:t.folderData)==null?void 0:i.captions;return a==null||a.length===0?null:(a=a.slice(1),jsx("span",{style:{display:"flex",alignItems:"center"},children:a.map((m,o)=>jsxs("span",{style:{display:"inline-flex",alignItems:"center"},children:[m,o<a.length-1&&jsx(d$1,{style:{margin:"0 8px",fontSize:"0.6rem",color:"#666"}},`chevron-${o}`)]},`caption-${o}`))}))},[Ve,e.context.params.folderData]),An={density:wn,expanded:true,grouping:[],isFullScreen:false,pagination:{pageIndex:b$2||0,pageSize:Number(ie)||He},columnVisibility:{id:false}},En=useCallback((a,t)=>{var i=[];a.forEach(m=>{var f,w,p,L,N,ne;let o=m.original;i.push({_sk:(f=o._sk)!=null?f:null,_code:(w=o._fcode)!=null?w:o._code,_origformcode:(L=(p=o._origformcode)!=null?p:o._fcode)!=null?L:o._code,_plugincode:(N=o._plcode)!=null?N:o._plugincode,_desc:(ne=o._desc)!=null?ne:null});}),i.length>0&&Se("createsigncontainer",e,i,T$1,k,t);},[Se,e,T$1,k]),zn=useCallback((a,t)=>{var i=[];a.forEach(m=>{var f,w,p,L,N;let o=m.original;i.push({_sk:(f=o._sk)!=null?f:null,_code:(w=o._fcode)!=null?w:o._code,_origformcode:(L=(p=o._origformcode)!=null?p:o._fcode)!=null?L:o._code,_plugincode:(N=o._plcode)!=null?N:o._plugincode});}),i.length>0&&Se("download",e,i,T$1,k,t);},[Se,e,T$1,k]),Bn=useCallback((a,t)=>{var i=[];a.forEach(m=>{var f,w,p,L,N;let o=m.original;i.push({_sk:(f=o._sk)!=null?f:null,_code:(w=o._fcode)!=null?w:o._code,_origformcode:(L=(p=o._origformcode)!=null?p:o._fcode)!=null?L:o._code,_plugincode:(N=o._plcode)!=null?N:o._plugincode});}),nt({delete:{showDialog:true,dialogTitle:V$1("Delete")+" ?",dialogContent:V$1("Are you certain that you wish to delete selected records?"),buttonAgree:V$1("Continue"),buttonDisagree:V$1("Close"),callBackFunc:m=>ht(m,"delete",e,i,t,T$1,k)}});},[nt,ht,V$1,e,T$1,k]),On=useCallback(async({values:a,table:t})=>{ke("add",e,JSON.stringify(a),T$1,k),t.setCreatingRow(null);},[ke,e,T$1,k]),Un=useCallback(async({values:a,table:t,row:i})=>{let m={...i.original,...a};ke("edit",e,JSON.stringify(m),T$1,k),t.setEditingRow(null);},[ke,e,T$1,k]),[fa,Vn]=useState(null);if(!Tn)return null;let qe=Me("file",e.context)?"primary":"#C0C0C0",Hn=Me("file",e.context)?"contained":"outlined";return jsxs(Fragment,{children:[Ve&&jsx("div",{style:{paddingBottom:"0.8rem",fontSize:"0.85rem",color:"#666",marginLeft:"0.2rem"},children:Nn()}),jsx("div",{style:{maxWidth:e.context.isModal?g$1.width-30:void 0},children:jsx(Suspense,{fallback:jsx($n,{}),children:jsx(ia,{locale:G,columns:vn,enableBottomToolbar:In,enableTableFooter:Pn,createDisplayMode:"row",editDisplayMode:"row",enableEditing:false,enableColumnActions:cn,enableColumnOrdering:mn,enableColumnResizing:un,enableGlobalFilter:Ct,enableGlobalFilterModes:true,globalFilterModeOptions:[je||"startsWith"],globalFilterFn:je||"startsWith",enableGrouping:dn,enablePagination:at,manualPagination:te!=null?te:false,enableRowActions:Dt,enableRowNumbers:hn,enableRowSelection:bn,enableRowVirtualization:Sn,enableSelectAll:Dn,enableStickyHeader:Rn,enableToolbarInternalActions:_n,enableTopToolbar:Fn,onCreatingRowSave:On,onEditingRowSave:Un,darkMode:false,data:me,icons:{SaveIcon:()=>jsx(r,{color:ra,style:{fontSize:"1.2rem"}}),CancelIcon:()=>jsx(P,{color:"gray",style:{fontSize:"1.2rem"}})},initialState:An,isLoading:!ee,muiTableContainerProps:{sx:{maxHeight:gn}},name:e.properties.name,pageIndex:b$2,pageSize:ie,muiPaginationProps:{rowsPerPageOptions:[50,100,300,500],disabled:we},onPaginationChange:Mn,positionActionsColumn:"last",displayColumnDefOptions:{"mrt-row-actions":Dt?{header:"",minSize:g$1.isMobileDevice?75:270,enableHiding:false}:void 0},rowOnDoubleClick:a=>{!be&&!pt(e.properties)&&tt("edit",e,a,T$1,k);},rowCount:te?_:void 0,renderToolbarInternalActions:({table:a})=>jsx(en,{sx:{display:"flex",alignItems:"center"},children:!g$1.isMobileDevice&&jsxs(Fragment,{children:[!be&&Ct&&jsxs(Fragment,{children:[he&&jsx(ta,{autoFocus:true,size:"small",value:wt,placeholder:V$1("Search..."),onChange:t=>{Ue(t.target.value),a.setGlobalFilter(t.target.value||void 0);},onKeyDown:t=>{t.key==="Escape"&&(Ue(""),xt(false),a.setGlobalFilter(void 0));},endAdornment:wt?jsx(Qe,{size:"small",onClick:()=>{Ue(""),a.setGlobalFilter(void 0);},children:jsx(P,{size:10})}):void 0,sx:{border:"1px solid",borderColor:"divider",borderRadius:1,px:1,py:.25,fontSize:"0.875rem",mr:.5}}),jsx(oe,{title:V$1(he?"Hide Search":"Search"),children:jsx(Qe,{size:"small",onClick:()=>{he&&(Ue(""),a.setGlobalFilter(void 0)),xt(!he);},children:he?jsx(ea,{fontSize:"small"}):jsx(Zn,{fontSize:"small"})})})]}),jsx(Y,{table:a}),jsx(W,{table:a}),jsx(X,{table:a}),!e.context.isModal&&jsx(Z,{table:a})]})}),renderTopToolbarCustomActions:({table:a})=>{var t$1,i,m,o,f,w,p$1,L,N$1,ne;return jsxs("div",{style:{display:"flex",flexDirection:"row"},children:[a.getSelectedRowModel().rows.length===0&&Ve&&e.context.formLayout==="folders"&&jsx(Fragment,{children:jsx(oe,{title:(i=(t$1=e.properties)==null?void 0:t$1.newFolderLabel)!=null?i:V$1("New Folder"),children:jsx(Fe,{style:{marginRight:"5px"},color:"primary",onPointerUp:()=>e.context.isModal||e.context.hasParentForm?e.methodProvider.eventDispatcher({widgetName:e.properties.name.toLowerCase(),widgetValue:null,widgetEvent:U.onFolderCreateRecordEvent,widgetContext:JSON.stringify({referer:T$1.pathname,parentWidgetId:k,hasParentForm:T.hasParentForm(),parentOriginator:{params:e.context.params.originator?e.context.params.originator.params:{}},originator:{params:e.context.params,widgetName:e.properties.name.toLowerCase()},parent:{widgetName:e.properties.name.toLowerCase(),params:e.context.params},isModal:e.context.isModal,folderData:e.context.params.folderData})}):Rt(`${T$1.pathname}/new`,{state:{from:T$1.pathname}}),variant:"outlined",children:jsx(t,{})})})}),a.getSelectedRowModel().rows.length===0&&!pn&&jsx(Fragment,{children:jsx(oe,{title:(o=(m=e.properties)==null?void 0:m.addrecordlabel)!=null?o:V$1("Add Record"),children:jsx(Fe,{disabled:pt(e.properties),color:"primary",sx:{color:qe,borderColor:qe},style:{marginRight:"5px"},onPointerUp:()=>{if(!Me("file",e.context)){le({toastID:nanoid(11),msg:V$1("Please select a folder before adding a document"),clearQueue:false,hideProgressBar:false});return}if(be){let ue={};((Q==null?void 0:Q.item._children)||[]).forEach(({properties:E})=>{var Ce,X;if(!E.item_increment||!E.item_name)return;let C=(Ce=Je[E.item_name])!=null?Ce:"";C||(C=(X=E.item_columntype)!=null?X:"freetext",E.item_columntype||(E.item_isdate?C="date":E.item_isdatetime?C="datetime":E.item_ischeckbox?C="checkbox":E.item_isprice?C="price":C="freetext")),C==="number"&&(ue[E.item_name.toString()]=me.length+1);}),Object.keys(ue).length>0?a.setCreatingRow(V(a,ue)):a.setCreatingRow(true);}else return bt?Rt(`${T$1.pathname}/${bt}`,{state:{from:T$1.pathname}}):e.methodProvider.eventDispatcher({widgetName:e.properties.name.toLowerCase(),widgetValue:null,widgetEvent:U.onTableCreateRecordEvent,widgetContext:JSON.stringify({referer:T$1.pathname,parentWidgetId:k,hasParentForm:true,parentOriginator:{params:e.context.params.originator?e.context.params.originator.params:{}},originator:{params:e.context.params,widgetName:e.properties.name.toLowerCase()},parent:{widgetName:e.properties.name.toLowerCase(),params:e.context.params},isModal:e.context.isModal,folderData:e.context.params.folderData})})},variant:"outlined",children:jsx(p,{})})})}),a.getSelectedRowModel().rows.length===0&&fn&&jsx(Fragment,{children:jsx(oe,{title:(w=(f=e.properties)==null?void 0:f.uploadFilesLabel)!=null?w:V$1("Upload Files"),children:jsx(Fe,{color:"primary",onPointerUp:kn,variant:"outlined",children:jsx(h,{})})})}),a.getSelectedRowModel().rows.length>0&&jsxs(Fragment,{children:[e.context.formLayout==="folders"&&a.getSelectedRowModel().rows.length>1&&jsx(Fragment,{children:jsx(oe,{title:V$1("Create Container"),children:jsx(Fe,{style:{marginRight:"5px",color:qe,borderColor:qe},onPointerUp:()=>{if(!Me("file",e.context)){le({toastID:nanoid(11),msg:V$1("Please select a folder before creating a container"),clearQueue:false,hideProgressBar:false});return}En(a.getSelectedRowModel().rows,a);},variant:Hn,children:jsx(q,{})})})}),jsxs(Fragment,{children:[jsx(oe,{title:(L=(p$1=e.properties)==null?void 0:p$1.downloadLabel)!=null?L:V$1("Download"),children:jsx(Fe,{style:{marginRight:"5px"},onPointerUp:()=>zn(a.getSelectedRowModel().rows,a),variant:"contained",children:jsx(g,{})})}),jsx(oe,{title:(ne=(N$1=e.properties)==null?void 0:N$1.deleteLabel)!=null?ne:V$1("Delete"),children:jsx(Fe,{style:{marginRight:"5px"},onPointerUp:()=>Bn(a.getSelectedRowModel().rows,a),variant:"contained",children:jsx(N,{})})})]})]}),jsx(la,{anchorEl:J,handleClose:Ln,setUploadMode:de,uploadMode:Te,props:e,setLoaded:q$1})]})},...ma(e,xn,Ge,g$1.isMobileDevice,nt,ln)},G)})}),jsx(H,{...M.delete,handleDialogClose:sn})]})})),Pe=d=>{let e=null,r=d.action,l$1=d.applyInternalStyle?{fontSize:"1em",marginRight:"0.5em"}:{};return r==="open"?e=jsx(n,{style:l$1}):r==="copy"?e=jsx(i,{style:l$1}):r==="confirm"?e=jsx(w,{style:{...l$1,fontSize:"1.6em"}}):r==="edit"?e=jsx(A,{style:l$1}):r==="editrow"?e=jsx(n,{style:l$1}):r==="amend"?e=jsx(b$2,{style:l$1}):r==="delete"?e=jsx(N,{style:l$1}):r==="lock"?e=jsx(y,{style:l$1}):r==="unlock"?e=jsx(x,{style:l$1}):r==="print"?e=jsx(C,{style:l$1}):r==="preview"?e=jsx(n,{style:l$1}):r==="sign"?e=jsx(q,{style:l$1}):r==="download"?e=jsx(l,{style:l$1}):r==="uploadfile"?e=jsx(O,{style:l$1}):r==="uploadzipfile"&&(e=jsx(o,{style:l$1})),e},ma=(d,e,r,l,g,le)=>{var de,me;let H=typeof e=="string"?JSON.parse(e):e!=null?e:[],se=useLocation(),{t:B}=useTranslation(),{tabId:b}=d,ie=(me=(de=d.properties)==null?void 0:de.rowactionlabels)!=null?me:{},J=(u,_)=>ie[u]||B(_),ce={color:"text.secondary","&:hover":{color:"primary.main"},"&:focus":{color:"primary.main"},fontSize:"1.1em",marginRight:"0.5em"},ee=(u,_,F)=>u==="delete"?()=>{g({delete:{showDialog:true,dialogTitle:`${J("delete","Delete")} ?`,dialogContent:J("deleteConfirmContent","Are you certain that you wish to delete this record?"),buttonAgree:J("deleteConfirmAgree","Continue"),buttonDisagree:J("deleteConfirmDisagree","Close"),callBackFunc:x=>le(x,"delete",d,F,se,b)}});}:u==="editrow"?()=>{_.closeMenu(),_.table.setEditingRow(_.row);}:()=>{var x;(x=_.closeMenu)==null||x.call(_),tt(u,d,F,se,b);},q=({entryType:u,mode:_})=>{let F=u.row.original,[x,O]=ut.useState(null),I=M=>{O(M.currentTarget);},$=()=>{O(null);},xe=()=>jsx(Fragment,{children:Object.entries(H).map(([M,v])=>{if(!v)return null;let P=M.replace("action_",""),U=ee(P,u,F);return jsx("span",{children:jsx(oe,{title:J(P,P.charAt(0).toUpperCase()+P.slice(1)),children:jsx(Qe,{sx:ce,onPointerUp:U,children:jsx(Pe,{action:P})})})},M)})}),ge={};if(F._primAct){let M=F._primAct;if(Object.values(an).includes(M)){Object.values(gt).includes(M)&&(ge.edit=true,H.action_edit&&delete H.action_edit);let v="action_"+M.toLowerCase();ge[v]=true,H[v]&&delete H[v];}}return jsxs(en,{sx:{display:"flex",flexWrap:"nowrap",gap:"8px",justifyContent:"center",alignItems:"center"},children:[_===0&&jsx(xe,{}),_===1&&jsxs(Fragment,{children:[jsx(()=>jsx(Fragment,{children:Object.entries(ge).map(([M,v])=>{if(!v)return null;let P=M.replace("action_",""),U=ee(P,u,F),K=Object.values(gt).includes(P.toUpperCase()),Oe=P.charAt(0).toUpperCase()+P.slice(1),he=Oe==="Edit"?J("open","Open"):J(P,Oe);return jsx(Fe,{onClick:U,startIcon:jsx(Pe,{action:P==="edit"?"open":P}),variant:"contained",size:"small",sx:{textTransform:"none",fontSize:"0.75rem",height:"28px",borderRadius:"4px",boxShadow:"none",backgroundColor:K?"actionbtnok.main":"regularbtn.main",color:"#fff","&:hover":{backgroundColor:K?"actionbtnok.hover":"regularbtn.hover",boxShadow:"none"},minInlineSize:"7.5em"},children:he},M)})}),{}),jsx(()=>{let M=x?x.getBoundingClientRect():null;return jsxs("span",{style:{paddingLeft:"1.5em"},children:[jsx(Qe,{sx:ce,onClick:I,id:"dropdown-button",children:jsx(oa,{})}),jsx(nn,{anchorEl:x,open:!!x,onClose:$,PaperProps:{sx:{borderRadius:2,minWidth:180,py:1,boxShadow:3,top:M?`${M.top+5}px !important`:"auto",left:M?`${M.left+15}px !important`:"auto",zIndex:v=>v.zIndex.modal+1}},children:Object.entries(H).map(([v,P])=>{if(!P)return null;let U=v.replace("action_","");return jsxs(et,{onClick:()=>{$(),ee(U,u,F)();},sx:{px:2,py:1},children:[jsx(Xe,{sx:{minWidth:"unset",mr:1},children:jsx(Pe,{action:U==="print"?"preview":U,applyInternalStyle:true})}),jsx(Ze,{primaryTypographyProps:{fontSize:"0.875rem"},children:J(U,U.charAt(0).toUpperCase()+U.slice(1))})]},v)})})]})},{})]})]})},Te=u=>{let _=u.row.original;return [jsx(Qn,{onClickAway:()=>{var F;return (F=u.closeMenu)==null?void 0:F.call(u)},children:jsx(Xn,{sx:{minWidth:"12em",py:0,background:"none"},children:Object.entries(H).map(([F,x])=>{if(!x)return null;let O=F.replace("action_",""),I=ee(O,u,_);return jsxs(et,{disabled:pt(d.properties),onPointerUp:I,children:[jsx(Xe,{children:jsx(Pe,{action:O==="print"?"preview":O,applyInternalStyle:true})}),jsx(Ze,{primaryTypographyProps:{fontSize:"0.875rem"},children:J(O,O.charAt(0).toUpperCase()+O.slice(1))})]},F)})})},"row-action-menu")]};return r==="flat"&&!l?{renderRowActions:u=>jsx(q,{entryType:u,mode:0})}:r==="menu"||r!=="none"&&l?{renderRowActionMenuItems:u=>Te(u)}:r==="primary"?{renderRowActions:u=>jsx(q,{entryType:u,mode:1})}:{}};on.displayName="_Datatable";var Za=on;export{Za as Datatable};
package/dist/form.js CHANGED
@@ -1 +1 @@
1
- export{b as Form,b as default}from'./chunk-EPMMOUGS.js';import'./chunk-NW34CD5C.js';import'./chunk-WPUZPO7K.js';import'./chunk-VUS3THHW.js';import'./chunk-RYPE5BKG.js';import'./chunk-AY7MKCIL.js';import'./chunk-WNDOHYWO.js';import'./chunk-U4T4ACDE.js';import'./chunk-LBMVBVXW.js';import'./chunk-C64U36LV.js';import'./chunk-IZKTNYAE.js';import'./chunk-SDIZEEZP.js';import'./chunk-5TBO732O.js';
1
+ export{b as Form,b as default}from'./chunk-WHDLCSVJ.js';import'./chunk-NW34CD5C.js';import'./chunk-WPUZPO7K.js';import'./chunk-VUS3THHW.js';import'./chunk-RYPE5BKG.js';import'./chunk-AY7MKCIL.js';import'./chunk-FTJXRFLR.js';import'./chunk-U4T4ACDE.js';import'./chunk-LBMVBVXW.js';import'./chunk-C64U36LV.js';import'./chunk-IZKTNYAE.js';import'./chunk-SDIZEEZP.js';import'./chunk-5TBO732O.js';
@@ -1 +1 @@
1
- export{a as Formeditor,b as widgetInitialStyle}from'./chunk-A6VFMC4D.js';import'./chunk-ZV6IRE52.js';import'./chunk-EPMMOUGS.js';import'./chunk-NW34CD5C.js';import'./chunk-WPUZPO7K.js';import'./chunk-VUS3THHW.js';import'./chunk-RYPE5BKG.js';import'./chunk-AY7MKCIL.js';import'./chunk-WNDOHYWO.js';import'./chunk-U4T4ACDE.js';import'./chunk-LBMVBVXW.js';import'./chunk-C64U36LV.js';import'./chunk-IZKTNYAE.js';import'./chunk-SDIZEEZP.js';import'./chunk-5TBO732O.js';
1
+ export{a as Formeditor,b as widgetInitialStyle}from'./chunk-D32ONDPD.js';import'./chunk-ZV6IRE52.js';import'./chunk-WHDLCSVJ.js';import'./chunk-NW34CD5C.js';import'./chunk-WPUZPO7K.js';import'./chunk-VUS3THHW.js';import'./chunk-RYPE5BKG.js';import'./chunk-AY7MKCIL.js';import'./chunk-FTJXRFLR.js';import'./chunk-U4T4ACDE.js';import'./chunk-LBMVBVXW.js';import'./chunk-C64U36LV.js';import'./chunk-IZKTNYAE.js';import'./chunk-SDIZEEZP.js';import'./chunk-5TBO732O.js';
@@ -1 +1 @@
1
- export{a as Formeditor,a as default}from'./chunk-A6VFMC4D.js';import'./chunk-ZV6IRE52.js';import'./chunk-EPMMOUGS.js';import'./chunk-NW34CD5C.js';import'./chunk-WPUZPO7K.js';import'./chunk-VUS3THHW.js';import'./chunk-RYPE5BKG.js';import'./chunk-AY7MKCIL.js';import'./chunk-WNDOHYWO.js';import'./chunk-U4T4ACDE.js';import'./chunk-LBMVBVXW.js';import'./chunk-C64U36LV.js';import'./chunk-IZKTNYAE.js';import'./chunk-SDIZEEZP.js';import'./chunk-5TBO732O.js';
1
+ export{a as Formeditor,a as default}from'./chunk-D32ONDPD.js';import'./chunk-ZV6IRE52.js';import'./chunk-WHDLCSVJ.js';import'./chunk-NW34CD5C.js';import'./chunk-WPUZPO7K.js';import'./chunk-VUS3THHW.js';import'./chunk-RYPE5BKG.js';import'./chunk-AY7MKCIL.js';import'./chunk-FTJXRFLR.js';import'./chunk-U4T4ACDE.js';import'./chunk-LBMVBVXW.js';import'./chunk-C64U36LV.js';import'./chunk-IZKTNYAE.js';import'./chunk-SDIZEEZP.js';import'./chunk-5TBO732O.js';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import {a}from'./chunk-SYCZSSRF.js';export{a as PersistentStateProvider,d as useDatatablePagination,b as usePersistentState,c as useWidgetPersistentState}from'./chunk-SYCZSSRF.js';import {c}from'./chunk-5VSWNFWW.js';export{d as getLoadedLocales,b as isLocaleLoaded,a as loadLocale,c as preloadLocales}from'./chunk-5VSWNFWW.js';export{a as BuildocsExtendedEditorProvider,c as PluginWaitForm,b as useBuildocsExtendedEditor}from'./chunk-ZV6IRE52.js';import {h}from'./chunk-WPUZPO7K.js';export{d as DynamicComponent,a as DynamicComponentLoaderProvider,c as createCachedComponentLoader,e as useBuildocsApi,b as useComponentLoader,f as useSubscriptionPlan}from'./chunk-WPUZPO7K.js';import {a as a$2}from'./chunk-VUS3THHW.js';export{a as UiComponentsProvider,b as useUiComponents}from'./chunk-VUS3THHW.js';import {g,b,i}from'./chunk-RYPE5BKG.js';export{b as ApiConfigProvider,g as FormThemeProvider,h as ModalWindow,d as applyThemeToDom,c as fetchProjectTheme,e as removeThemeFromDom,a as useApiConfig,f as useThemeEnabled}from'./chunk-RYPE5BKG.js';import {a as a$3}from'./chunk-AY7MKCIL.js';export{a as ToastFnsProvider,f as useErrorMessage,e as useInfoMessage,d as useSuccessMessage,b as useToast,c as useWarningMessage}from'./chunk-AY7MKCIL.js';export{S as FormCommon,T as FormEvents}from'./chunk-WNDOHYWO.js';import'./chunk-U4T4ACDE.js';import {a as a$1}from'./chunk-LBMVBVXW.js';export{a as HostBridgeProvider,b as useHostBridgeProvider}from'./chunk-LBMVBVXW.js';import'./chunk-C64U36LV.js';import'./chunk-IZKTNYAE.js';import'./chunk-5TBO732O.js';import m,{memo,createContext,useEffect,useContext,useState,useRef}from'react';import {useTranslation}from'react-i18next';import {FormControl,InputLabel,Select,MenuItem}from'@mui/material';import {jsxs,jsx,Fragment}from'react/jsx-runtime';import H from'@mui/material/Button';import ke from'@mui/material/Dialog';import Ne from'@mui/material/DialogActions';import He from'@mui/material/DialogContent';import Oe from'@mui/material/DialogContentText';import We from'@mui/material/DialogTitle';import {toast,ToastContainer}from'react-toastify';import'react-toastify/dist/ReactToastify.css';var M=false,Ee=()=>{M||(M=true);},Re=()=>M;var Be=[{code:"af-ZA",label:"Afrikaans",flag:"\u{1F1FF}\u{1F1E6}"},{code:"ar-SA",label:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",flag:"\u{1F1F8}\u{1F1E6}"},{code:"ar-AE",label:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629 (\u0627\u0644\u0625\u0645\u0627\u0631\u0627\u062A)",flag:"\u{1F1E6}\u{1F1EA}"},{code:"bg-BG",label:"\u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438",flag:"\u{1F1E7}\u{1F1EC}"},{code:"cs-CZ",label:"\u010Ce\u0161tina",flag:"\u{1F1E8}\u{1F1FF}"},{code:"da-DK",label:"Dansk",flag:"\u{1F1E9}\u{1F1F0}"},{code:"de-DE",label:"Deutsch",flag:"\u{1F1E9}\u{1F1EA}"},{code:"el-GR",label:"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC",flag:"\u{1F1EC}\u{1F1F7}"},{code:"en-US",label:"English",flag:"\u{1F1FA}\u{1F1F8}"},{code:"es-ES",label:"Espa\xF1ol",flag:"\u{1F1EA}\u{1F1F8}"},{code:"et-EE",label:"Eesti",flag:"\u{1F1EA}\u{1F1EA}"},{code:"fa-IR",label:"\u0641\u0627\u0631\u0633\u06CC",flag:"\u{1F1EE}\u{1F1F7}"},{code:"fi-FI",label:"Suomi",flag:"\u{1F1EB}\u{1F1EE}"},{code:"fr-FR",label:"Fran\xE7ais",flag:"\u{1F1EB}\u{1F1F7}"},{code:"he-IL",label:"\u05E2\u05D1\u05E8\u05D9\u05EA",flag:"\u{1F1EE}\u{1F1F1}"},{code:"hr-HR",label:"Hrvatski",flag:"\u{1F1ED}\u{1F1F7}"},{code:"hu-HU",label:"Magyar",flag:"\u{1F1ED}\u{1F1FA}"},{code:"id-ID",label:"Bahasa Indonesia",flag:"\u{1F1EE}\u{1F1E9}"},{code:"it-IT",label:"Italiano",flag:"\u{1F1EE}\u{1F1F9}"},{code:"ja-JP",label:"\u65E5\u672C\u8A9E",flag:"\u{1F1EF}\u{1F1F5}"},{code:"ko-KR",label:"\uD55C\uAD6D\uC5B4",flag:"\u{1F1F0}\u{1F1F7}"},{code:"lt-LT",label:"Lietuvi\u0173",flag:"\u{1F1F1}\u{1F1F9}"},{code:"lv-LV",label:"Latvie\u0161u",flag:"\u{1F1F1}\u{1F1FB}"},{code:"nl-NL",label:"Nederlands",flag:"\u{1F1F3}\u{1F1F1}"},{code:"nb-NO",label:"Norsk",flag:"\u{1F1F3}\u{1F1F4}"},{code:"pl-PL",label:"Polski",flag:"\u{1F1F5}\u{1F1F1}"},{code:"pt-PT",label:"Portugu\xEAs",flag:"\u{1F1F5}\u{1F1F9}"},{code:"ro-RO",label:"Rom\xE2n\u0103",flag:"\u{1F1F7}\u{1F1F4}"},{code:"ru-RU",label:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",flag:"\u{1F1F7}\u{1F1FA}"},{code:"sk-SK",label:"Sloven\u010Dina",flag:"\u{1F1F8}\u{1F1F0}"},{code:"sl-SI",label:"Sloven\u0161\u010Dina",flag:"\u{1F1F8}\u{1F1EE}"},{code:"sr-RS",label:"\u0421\u0440\u043F\u0441\u043A\u0438",flag:"\u{1F1F7}\u{1F1F8}"},{code:"sv-SE",label:"Svenska",flag:"\u{1F1F8}\u{1F1EA}"},{code:"th-TH",label:"\u0E44\u0E17\u0E22",flag:"\u{1F1F9}\u{1F1ED}"},{code:"tr-TR",label:"T\xFCrk\xE7e",flag:"\u{1F1F9}\u{1F1F7}"},{code:"uk-UA",label:"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430",flag:"\u{1F1FA}\u{1F1E6}"},{code:"ur-PK",label:"\u0627\u0631\u062F\u0648",flag:"\u{1F1F5}\u{1F1F0}"},{code:"vi-VN",label:"Ti\u1EBFng Vi\u1EC7t",flag:"\u{1F1FB}\u{1F1F3}"},{code:"zh-CN",label:"\u4E2D\u6587",flag:"\u{1F1E8}\u{1F1F3}"}],Ae=({languages:o=Be,showFlags:e=true,label:t="Language",variant:r="outlined",size:c$1="small"})=>{let{i18n:n}=useTranslation(),f=n.language||"en-US";return useEffect(()=>{let a=o.map(s=>s.code);c(a).catch(s=>{});},[o]),jsxs(FormControl,{variant:r,size:c$1,sx:{minWidth:200},children:[jsx(InputLabel,{id:"language-switcher-label",children:t}),jsx(Select,{labelId:"language-switcher-label",id:"language-switcher",value:f,label:t,onChange:async a=>{let s=a.target.value;try{await n.changeLanguage(s);}catch(p){}},children:o.map(a=>jsxs(MenuItem,{value:a.code,children:[e&&a.flag&&jsx("span",{style:{marginRight:8},children:a.flag}),a.label]},a.code))})]})};var Ve=memo(function(e){return jsxs(ke,{open:e.showDialog,onClose:()=>e.handleDialogClose(false),"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[jsx(We,{id:"alert-dialog-title",children:e.dialogTitle}),jsx(He,{children:jsx(Oe,{id:"alert-dialog-description",children:e.dialogContent})}),jsxs(Ne,{children:[jsx(H,{onClick:()=>e.handleDialogClose(false),children:e.buttonDisagree}),jsx(H,{onClick:()=>e.handleDialogClose(true),autoFocus:true,children:e.buttonAgree})]})]})}),R=Ve;function S({toastID:o,msg:e,clearQueue:t,hideProgressBar:r=true}){t&&toast.dismiss(),toast.error(e,{toastId:o,autoClose:7e3,hideProgressBar:r,position:toast.POSITION.TOP_CENTER});}function I({toastID:o,msg:e,clearQueue:t,hideProgressBar:r=true}){t&&toast.dismiss(),toast.info(e,{toastId:o,autoClose:4e3,hideProgressBar:r,position:toast.POSITION.TOP_CENTER});}function L({toastID:o,msg:e,clearQueue:t,hideProgressBar:r=true}){t&&toast.dismiss(),toast.success(e,{toastId:o,autoClose:1e3,hideProgressBar:r,position:toast.POSITION.TOP_CENTER});}function F({toastID:o,msg:e,clearQueue:t,hideProgressBar:r=true}){t&&toast.dismiss(),toast.warn(e,{toastId:o,autoClose:6e3,hideProgressBar:r,position:toast.POSITION.TOP_CENTER});}var ze=()=>jsx(ToastContainer,{pauseOnFocusLoss:true}),w=ze;var qe=({children:o})=>jsx(Fragment,{children:o}),W=createContext(qe),$e=W.Provider;function Je(){return useContext(W)}var V=createContext([{pluginCode:"",formCode:"",guid:null},()=>{}]),D=({children:o})=>{let[e,t]=useState({pluginCode:"",formCode:"",guid:null});return jsx(V.Provider,{value:[e,t],children:o})};var _=m.createContext({width:0,height:0}),B=({children:o})=>{let[e,t]=m.useState(window.innerWidth),[r,c]=m.useState(window.innerHeight),n=()=>{t(window.innerWidth),c(window.innerHeight);};return m.useEffect(()=>(window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)),[]),jsx(_.Provider,{value:{width:e,height:r},children:o})},oo=()=>{let{width:o,height:e}=m.useContext(_);return {width:o,height:e,isMobileDevice:o<767}};var io=60,G=60;async function no(o,e=io){let t=await fetch(`${i.BASE_URL}/api/v1/formspublic/project-token?expiresInMinutes=${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:o})});if(!t.ok)throw new Error(`Token request failed: ${t.status}`);return t.json()}function q({children:o,apiKey:e}){let{i18n:t}=useTranslation(),[r,c]=useState(null),[n,f]=useState(null),l=useRef(null),a=useRef(0);return useEffect(()=>{let s=false;async function p(){try{let d=await no(e);if(s)return;c(d.token),a.current=Date.now()+d.expiresInMinutes*60*1e3;let $=(d.expiresInMinutes*60-G)*1e3;l.current=setTimeout(p,Math.max($,0));}catch(d){s||f(d.message);}}function U(){if(document.visibilityState!=="visible")return;a.current-Date.now()<G*1e3&&(l.current&&clearTimeout(l.current),p());}return p(),document.addEventListener("visibilitychange",U),()=>{s=true,l.current&&clearTimeout(l.current),document.removeEventListener("visibilitychange",U);}},[e]),n?jsx(h,{title:"Connection Error",message:n}):r?jsx(b,{token:r,baseURL:i.BASE_URL,lang:t.language,children:o}):null}function so({children:o,apiKey:e,themeEnabled:t=true}){return jsx(a,{children:jsxs(q,{apiKey:e,children:[jsx(g,{enabled:t,children:jsx(B,{children:jsx(D,{children:o})})}),jsx(w,{})]})})}var go={warn:F,info:I,success:L,error:S,dismissAll:()=>toast.dismiss()};function mo({children:o,hostBridge:e}){return jsx(a$1,{value:e,children:jsx(a$2,{value:{UserDialog:R},children:jsx(a$3,{value:go,children:o})})})}export{mo as BuildocsHostProvider,so as BuildocsProvider,$e as FormLayoutProviderBridge,Ae as LanguageSwitcher,V as ModalContext,D as ModalProvider,S as ToastErrorMessage,I as ToastInfoMessage,w as ToastNotificationAdapter,L as ToastSuccessMessage,F as ToastWarningMessage,R as UserDialogAdapter,B as ViewportProvider,Ee as initializeDayjs,Re as isDayjsInitialized,Je as useFormLayoutComponent,oo as useViewport};
1
+ import {a}from'./chunk-SYCZSSRF.js';export{a as PersistentStateProvider,d as useDatatablePagination,b as usePersistentState,c as useWidgetPersistentState}from'./chunk-SYCZSSRF.js';import {c}from'./chunk-5VSWNFWW.js';export{d as getLoadedLocales,b as isLocaleLoaded,a as loadLocale,c as preloadLocales}from'./chunk-5VSWNFWW.js';export{a as BuildocsExtendedEditorProvider,c as PluginWaitForm,b as useBuildocsExtendedEditor}from'./chunk-ZV6IRE52.js';import {h}from'./chunk-WPUZPO7K.js';export{d as DynamicComponent,a as DynamicComponentLoaderProvider,c as createCachedComponentLoader,e as useBuildocsApi,b as useComponentLoader,f as useSubscriptionPlan}from'./chunk-WPUZPO7K.js';import {a as a$2}from'./chunk-VUS3THHW.js';export{a as UiComponentsProvider,b as useUiComponents}from'./chunk-VUS3THHW.js';import {g,b,i}from'./chunk-RYPE5BKG.js';export{b as ApiConfigProvider,g as FormThemeProvider,h as ModalWindow,d as applyThemeToDom,c as fetchProjectTheme,e as removeThemeFromDom,a as useApiConfig,f as useThemeEnabled}from'./chunk-RYPE5BKG.js';import {a as a$3}from'./chunk-AY7MKCIL.js';export{a as ToastFnsProvider,f as useErrorMessage,e as useInfoMessage,d as useSuccessMessage,b as useToast,c as useWarningMessage}from'./chunk-AY7MKCIL.js';export{T as FormCommon,U as FormEvents}from'./chunk-FTJXRFLR.js';import'./chunk-U4T4ACDE.js';import {a as a$1}from'./chunk-LBMVBVXW.js';export{a as HostBridgeProvider,b as useHostBridgeProvider}from'./chunk-LBMVBVXW.js';import'./chunk-C64U36LV.js';import'./chunk-IZKTNYAE.js';import'./chunk-5TBO732O.js';import m,{memo,createContext,useEffect,useContext,useState,useRef}from'react';import {useTranslation}from'react-i18next';import {FormControl,InputLabel,Select,MenuItem}from'@mui/material';import {jsxs,jsx,Fragment}from'react/jsx-runtime';import H from'@mui/material/Button';import ke from'@mui/material/Dialog';import Ne from'@mui/material/DialogActions';import He from'@mui/material/DialogContent';import Oe from'@mui/material/DialogContentText';import We from'@mui/material/DialogTitle';import {toast,ToastContainer}from'react-toastify';import'react-toastify/dist/ReactToastify.css';var M=false,Ee=()=>{M||(M=true);},Re=()=>M;var Be=[{code:"af-ZA",label:"Afrikaans",flag:"\u{1F1FF}\u{1F1E6}"},{code:"ar-SA",label:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",flag:"\u{1F1F8}\u{1F1E6}"},{code:"ar-AE",label:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629 (\u0627\u0644\u0625\u0645\u0627\u0631\u0627\u062A)",flag:"\u{1F1E6}\u{1F1EA}"},{code:"bg-BG",label:"\u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438",flag:"\u{1F1E7}\u{1F1EC}"},{code:"cs-CZ",label:"\u010Ce\u0161tina",flag:"\u{1F1E8}\u{1F1FF}"},{code:"da-DK",label:"Dansk",flag:"\u{1F1E9}\u{1F1F0}"},{code:"de-DE",label:"Deutsch",flag:"\u{1F1E9}\u{1F1EA}"},{code:"el-GR",label:"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC",flag:"\u{1F1EC}\u{1F1F7}"},{code:"en-US",label:"English",flag:"\u{1F1FA}\u{1F1F8}"},{code:"es-ES",label:"Espa\xF1ol",flag:"\u{1F1EA}\u{1F1F8}"},{code:"et-EE",label:"Eesti",flag:"\u{1F1EA}\u{1F1EA}"},{code:"fa-IR",label:"\u0641\u0627\u0631\u0633\u06CC",flag:"\u{1F1EE}\u{1F1F7}"},{code:"fi-FI",label:"Suomi",flag:"\u{1F1EB}\u{1F1EE}"},{code:"fr-FR",label:"Fran\xE7ais",flag:"\u{1F1EB}\u{1F1F7}"},{code:"he-IL",label:"\u05E2\u05D1\u05E8\u05D9\u05EA",flag:"\u{1F1EE}\u{1F1F1}"},{code:"hr-HR",label:"Hrvatski",flag:"\u{1F1ED}\u{1F1F7}"},{code:"hu-HU",label:"Magyar",flag:"\u{1F1ED}\u{1F1FA}"},{code:"id-ID",label:"Bahasa Indonesia",flag:"\u{1F1EE}\u{1F1E9}"},{code:"it-IT",label:"Italiano",flag:"\u{1F1EE}\u{1F1F9}"},{code:"ja-JP",label:"\u65E5\u672C\u8A9E",flag:"\u{1F1EF}\u{1F1F5}"},{code:"ko-KR",label:"\uD55C\uAD6D\uC5B4",flag:"\u{1F1F0}\u{1F1F7}"},{code:"lt-LT",label:"Lietuvi\u0173",flag:"\u{1F1F1}\u{1F1F9}"},{code:"lv-LV",label:"Latvie\u0161u",flag:"\u{1F1F1}\u{1F1FB}"},{code:"nl-NL",label:"Nederlands",flag:"\u{1F1F3}\u{1F1F1}"},{code:"nb-NO",label:"Norsk",flag:"\u{1F1F3}\u{1F1F4}"},{code:"pl-PL",label:"Polski",flag:"\u{1F1F5}\u{1F1F1}"},{code:"pt-PT",label:"Portugu\xEAs",flag:"\u{1F1F5}\u{1F1F9}"},{code:"ro-RO",label:"Rom\xE2n\u0103",flag:"\u{1F1F7}\u{1F1F4}"},{code:"ru-RU",label:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",flag:"\u{1F1F7}\u{1F1FA}"},{code:"sk-SK",label:"Sloven\u010Dina",flag:"\u{1F1F8}\u{1F1F0}"},{code:"sl-SI",label:"Sloven\u0161\u010Dina",flag:"\u{1F1F8}\u{1F1EE}"},{code:"sr-RS",label:"\u0421\u0440\u043F\u0441\u043A\u0438",flag:"\u{1F1F7}\u{1F1F8}"},{code:"sv-SE",label:"Svenska",flag:"\u{1F1F8}\u{1F1EA}"},{code:"th-TH",label:"\u0E44\u0E17\u0E22",flag:"\u{1F1F9}\u{1F1ED}"},{code:"tr-TR",label:"T\xFCrk\xE7e",flag:"\u{1F1F9}\u{1F1F7}"},{code:"uk-UA",label:"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430",flag:"\u{1F1FA}\u{1F1E6}"},{code:"ur-PK",label:"\u0627\u0631\u062F\u0648",flag:"\u{1F1F5}\u{1F1F0}"},{code:"vi-VN",label:"Ti\u1EBFng Vi\u1EC7t",flag:"\u{1F1FB}\u{1F1F3}"},{code:"zh-CN",label:"\u4E2D\u6587",flag:"\u{1F1E8}\u{1F1F3}"}],Ae=({languages:o=Be,showFlags:e=true,label:t="Language",variant:r="outlined",size:c$1="small"})=>{let{i18n:n}=useTranslation(),f=n.language||"en-US";return useEffect(()=>{let a=o.map(s=>s.code);c(a).catch(s=>{});},[o]),jsxs(FormControl,{variant:r,size:c$1,sx:{minWidth:200},children:[jsx(InputLabel,{id:"language-switcher-label",children:t}),jsx(Select,{labelId:"language-switcher-label",id:"language-switcher",value:f,label:t,onChange:async a=>{let s=a.target.value;try{await n.changeLanguage(s);}catch(p){}},children:o.map(a=>jsxs(MenuItem,{value:a.code,children:[e&&a.flag&&jsx("span",{style:{marginRight:8},children:a.flag}),a.label]},a.code))})]})};var Ve=memo(function(e){return jsxs(ke,{open:e.showDialog,onClose:()=>e.handleDialogClose(false),"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[jsx(We,{id:"alert-dialog-title",children:e.dialogTitle}),jsx(He,{children:jsx(Oe,{id:"alert-dialog-description",children:e.dialogContent})}),jsxs(Ne,{children:[jsx(H,{onClick:()=>e.handleDialogClose(false),children:e.buttonDisagree}),jsx(H,{onClick:()=>e.handleDialogClose(true),autoFocus:true,children:e.buttonAgree})]})]})}),R=Ve;function S({toastID:o,msg:e,clearQueue:t,hideProgressBar:r=true}){t&&toast.dismiss(),toast.error(e,{toastId:o,autoClose:7e3,hideProgressBar:r,position:toast.POSITION.TOP_CENTER});}function I({toastID:o,msg:e,clearQueue:t,hideProgressBar:r=true}){t&&toast.dismiss(),toast.info(e,{toastId:o,autoClose:4e3,hideProgressBar:r,position:toast.POSITION.TOP_CENTER});}function L({toastID:o,msg:e,clearQueue:t,hideProgressBar:r=true}){t&&toast.dismiss(),toast.success(e,{toastId:o,autoClose:1e3,hideProgressBar:r,position:toast.POSITION.TOP_CENTER});}function F({toastID:o,msg:e,clearQueue:t,hideProgressBar:r=true}){t&&toast.dismiss(),toast.warn(e,{toastId:o,autoClose:6e3,hideProgressBar:r,position:toast.POSITION.TOP_CENTER});}var ze=()=>jsx(ToastContainer,{pauseOnFocusLoss:true}),w=ze;var qe=({children:o})=>jsx(Fragment,{children:o}),W=createContext(qe),$e=W.Provider;function Je(){return useContext(W)}var V=createContext([{pluginCode:"",formCode:"",guid:null},()=>{}]),D=({children:o})=>{let[e,t]=useState({pluginCode:"",formCode:"",guid:null});return jsx(V.Provider,{value:[e,t],children:o})};var _=m.createContext({width:0,height:0}),B=({children:o})=>{let[e,t]=m.useState(window.innerWidth),[r,c]=m.useState(window.innerHeight),n=()=>{t(window.innerWidth),c(window.innerHeight);};return m.useEffect(()=>(window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)),[]),jsx(_.Provider,{value:{width:e,height:r},children:o})},oo=()=>{let{width:o,height:e}=m.useContext(_);return {width:o,height:e,isMobileDevice:o<767}};var io=60,G=60;async function no(o,e=io){let t=await fetch(`${i.BASE_URL}/api/v1/formspublic/project-token?expiresInMinutes=${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:o})});if(!t.ok)throw new Error(`Token request failed: ${t.status}`);return t.json()}function q({children:o,apiKey:e}){let{i18n:t}=useTranslation(),[r,c]=useState(null),[n,f]=useState(null),l=useRef(null),a=useRef(0);return useEffect(()=>{let s=false;async function p(){try{let d=await no(e);if(s)return;c(d.token),a.current=Date.now()+d.expiresInMinutes*60*1e3;let $=(d.expiresInMinutes*60-G)*1e3;l.current=setTimeout(p,Math.max($,0));}catch(d){s||f(d.message);}}function U(){if(document.visibilityState!=="visible")return;a.current-Date.now()<G*1e3&&(l.current&&clearTimeout(l.current),p());}return p(),document.addEventListener("visibilitychange",U),()=>{s=true,l.current&&clearTimeout(l.current),document.removeEventListener("visibilitychange",U);}},[e]),n?jsx(h,{title:"Connection Error",message:n}):r?jsx(b,{token:r,baseURL:i.BASE_URL,lang:t.language,children:o}):null}function so({children:o,apiKey:e,themeEnabled:t=true}){return jsx(a,{children:jsxs(q,{apiKey:e,children:[jsx(g,{enabled:t,children:jsx(B,{children:jsx(D,{children:o})})}),jsx(w,{})]})})}var go={warn:F,info:I,success:L,error:S,dismissAll:()=>toast.dismiss()};function mo({children:o,hostBridge:e}){return jsx(a$1,{value:e,children:jsx(a$2,{value:{UserDialog:R},children:jsx(a$3,{value:go,children:o})})})}export{mo as BuildocsHostProvider,so as BuildocsProvider,$e as FormLayoutProviderBridge,Ae as LanguageSwitcher,V as ModalContext,D as ModalProvider,S as ToastErrorMessage,I as ToastInfoMessage,w as ToastNotificationAdapter,L as ToastSuccessMessage,F as ToastWarningMessage,R as UserDialogAdapter,B as ViewportProvider,Ee as initializeDayjs,Re as isDayjsInitialized,Je as useFormLayoutComponent,oo as useViewport};