@dartech/arsenal-ui 1.5.85 → 1.5.87

Sign up to get free protection for your applications and to get access to all the features.
package/index.esm.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./index";
package/index.esm.js ADDED
@@ -0,0 +1 @@
1
+ import{useTheme as e,createTheme as r,responsiveFontSizes as n,styled as t,ThemeProvider as l}from"@mui/material/styles";import{jsx as i,jsxs as a,Fragment as o}from"react/jsx-runtime";import{__rest as s,__awaiter as c}from"tslib";import d from"@mui/material/TextField";import u from"@mui/material/MenuItem";import*as p from"react";import m,{useRef as g,useEffect as h,useState as f,useCallback as b,useMemo as y,createElement as v,forwardRef as C,memo as O,useImperativeHandle as E,createContext as x,useContext as j,Suspense as V}from"react";import{useController as T,useWatch as R,useFormContext as N,Controller as w,useFieldArray as S,useForm as k}from"react-hook-form";import L from"@mui/material/SvgIcon";import I from"@mui/material/IconButton";import A from"@mui/material/InputAdornment";import M from"@mui/material/Button";import D from"@mui/material/Dialog";import F from"@mui/material/DialogActions";import P from"@mui/material/DialogContent";import q from"@mui/material/DialogContentText";import $ from"@mui/material/DialogTitle";import B from"@mui/material/Box";import z from"@mui/material/Typography";import _ from"@mui/material/CircularProgress";import H from"@mui/material/FormControl";import J from"@mui/material/FormControlLabel";import G from"@mui/material/FormHelperText";import Y from"@mui/material/Checkbox";import W from"@mui/material/Radio";import U from"@mui/material/RadioGroup";import Z from"@mui/material/FormLabel";import K from"@mui/material/Autocomplete";import X from"lodash/get";import Q from"@mui/material/useMediaQuery";import ee from"@mui/material/ListSubheader";import{VariableSizeList as re}from"react-window";import{useQuery as ne}from"@tanstack/react-query";import te from"qs";import le from"@mui/material/Tooltip";import{useNavigate as ie,useLocation as ae,Link as oe,useSearchParams as se,Outlet as ce}from"react-router-dom";import de from"@uiw/react-codemirror";import{langs as ue}from"@uiw/codemirror-extensions-langs";import{abcdef as pe}from"@uiw/codemirror-theme-abcdef";import me from"@mui/material/Switch";import{DatePicker as ge}from"@mui/x-date-pickers/DatePicker";import{format as he,parse as fe,isValid as be,isMatch as ye,endOfYesterday as ve,startOfTomorrow as Ce,isToday as Oe,isAfter as Ee,isBefore as xe}from"date-fns";import{DateTimePicker as je}from"@mui/x-date-pickers/DateTimePicker";import{TimePicker as Ve}from"@mui/x-date-pickers/TimePicker";import Te from"@mui/material/Chip";import Re from"@mui/material/Unstable_Grid2";import{toString as Ne,parse as we}from"duration-fns";import Se from"react-input-mask";import ke from"@mui/material/Pagination";import Le from"@mui/material/TablePagination";import{useGridApiContext as Ie,useGridSelector as Ae,gridPageSelector as Me,gridPageCountSelector as De,gridRowCountSelector as Fe,gridPageSizeSelector as Pe,GridColumnMenuContainer as qe,GridFilterMenuItem as $e,DataGrid as Be,GridActionsCellItem as ze}from"@mui/x-data-grid";import _e from"@mui/material/Table";import He from"@mui/material/TableBody";import Je from"@mui/material/TableCell";import Ge from"@mui/material/TableContainer";import Ye from"@mui/material/TableHead";import We from"@mui/material/TableRow";import Ue from"@mui/material/TableFooter";import Ze from"@mui/material/Backdrop";import Ke from"@mui/material/TableSortLabel";import Xe from"@mui/material/Menu";import Qe from"@mui/icons-material/MoreHoriz";import er from"@mui/material/Paper";import rr from"@mui/material/Tab";import nr from"@mui/material/Tabs";import tr from"@mui/material/Accordion";import lr from"@mui/material/AccordionSummary";import ir from"@mui/material/AccordionDetails";import ar from"@mui/material/AccordionActions";import{ExpandMore as or}from"@mui/icons-material";import sr from"@mui/material/Stepper";import cr from"@mui/material/Step";import dr from"@mui/material/StepLabel";import ur from"@mui/material/StepContent";import pr from"@mui/material/StepConnector";import{AdapterDateFns as mr}from"@mui/x-date-pickers/AdapterDateFns";import{LocalizationProvider as gr}from"@mui/x-date-pickers/LocalizationProvider";import hr from"@mui/material/Select";import fr from"lodash/isNil";import br from"@mui/material/InputLabel";import yr from"@mui/icons-material/Delete";import vr from"lodash/isPlainObject";import Cr from"classnames";import{toast as Or}from"react-toastify";import Er from"@mui/material/CssBaseline";import xr from"@mui/material/Drawer";import jr from"@mui/material/List";import Vr from"@mui/material/ListItem";import Tr from"@mui/material/ListItemIcon";import Rr from"@mui/material/ListItemButton";import Nr from"@mui/material/ListItemText";import wr from"@mui/material/Toolbar";import Sr from"@mui/material/ButtonBase";import kr from"@mui/material/Collapse";import Lr from"@mui/material/Breadcrumbs";import Ir from"@mui/icons-material/NavigateNext";var Ar;!function(e){e.STRING="STRING",e.INTEGER="INTEGER",e.BIG_INTEGER="BIG_INTEGER",e.BIG_DECIMAL="BIG_DECIMAL",e.FLOAT="FLOAT",e.LONG="LONG",e.DOUBLE="DOUBLE",e.BOOLEAN="BOOLEAN",e.ENTITY_REFERENCE="ENTITY_REFERENCE",e.ENTITY="ENTITY",e.FILE="FILE",e.FILE_REFERENCE="FILE_REFERENCE",e.JSON="JSON",e.DATE="DATE",e.TIME="TIME",e.DATE_TIME="DATE_TIME",e.ANY="ANY"}(Ar||(Ar={}));const Mr="yyyy-MM-dd",Dr="HH:mm:ss",Fr="yyyy-MM-dd'T'HH:mm:ss.SSSZ";var Pr,qr;!function(e){e.STRING="STRING",e.INTEGER="INTEGER",e.LONG="LONG",e.BIG_INTEGER="BIG_INTEGER",e.BIG_DECIMAL="BIG_DECIMAL",e.ENTITY_REFERENCE="ENTITY_REFERENCE",e.FLOAT="FLOAT",e.DOUBLE="DOUBLE",e.BOOLEAN="BOOLEAN",e.OBJECT="OBJECT",e.DATE="DATE",e.TIME="TIME",e.DATE_TIME="DATE_TIME",e.FILE="FILE",e.FILE_REFERENCE="FILE_REFERENCE",e.ANY="ANY",e.ARRAY="ARRAY",e.SHORT="SHORT"}(Pr||(Pr={})),function(e){e.UP="UP",e.DOWN="DOWN",e.CEILING="CEILING",e.FLOOR="FLOOR",e.HALF_UP="HALF_UP",e.HALF_DOWN="HALF_DOWN",e.HALF_EVEN="HALF_EVEN",e.UNNECESSARY="UNNECESSARY"}(qr||(qr={}));const $r=({transparent:e,position:r,bgcolor:n})=>i(B,Object.assign({position:null!=r?r:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:n||(e?"none":"rgba(255, 255, 255, .3)"),zIndex:10},{children:i(_,{})})),Br=({open:e,title:r,description:n,closeButtonTitle:t="Close",onClose:l,confirmButtonTitle:o="Confirm",confirmButtonDisabled:s=!1,disableBackdropClick:c=!1,onConfirm:d,children:u,dialogProps:p,loading:m,maxWidth:g="xs",hideCloseButton:h=!1})=>i("div",{children:a(D,Object.assign({open:e,onClose:c?(e,r)=>{if("backdropClick"===r)return null;l()}:l,disableEscapeKeyDown:c,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",fullWidth:!0,maxWidth:g},p,{children:[m&&i($r,{}),a($,Object.assign({id:"alert-dialog-title",sx:{display:"flex",justifyContent:"space-between"}},{children:[i(z,Object.assign({variant:"inherit"},{children:r})),!h&&i(I,Object.assign({sx:{padding:0,height:"28px",width:"28px"},onClick:l},{children:i(L,{children:i("g",Object.assign({opacity:"0.6"},{children:i("path",{d:"M4.39704 4.554L4.47004 4.47C4.59702 4.34299 4.76538 4.26576 4.94449 4.25236C5.1236 4.23897 5.30157 4.29029 5.44604 4.397L5.53004 4.47L12 10.939L18.47 4.469C18.5393 4.3974 18.622 4.34031 18.7136 4.30104C18.8051 4.26178 18.9035 4.24114 19.0031 4.24032C19.1027 4.2395 19.2014 4.25853 19.2936 4.29628C19.3857 4.33403 19.4694 4.38976 19.5398 4.46022C19.6102 4.53067 19.6659 4.61443 19.7035 4.70662C19.7412 4.79881 19.7601 4.89758 19.7592 4.99716C19.7583 5.09675 19.7376 5.19515 19.6982 5.28664C19.6589 5.37812 19.6017 5.46085 19.53 5.53L13.061 12L19.531 18.47C19.6579 18.5971 19.7349 18.7655 19.7482 18.9446C19.7614 19.1237 19.7099 19.3016 19.603 19.446L19.53 19.53C19.403 19.657 19.2347 19.7343 19.0556 19.7476C18.8765 19.761 18.6985 19.7097 18.554 19.603L18.47 19.53L12 13.061L5.53004 19.531C5.38852 19.6676 5.19903 19.7431 5.00238 19.7413C4.80574 19.7395 4.61766 19.6605 4.47867 19.5214C4.33968 19.3823 4.26089 19.1941 4.25928 18.9975C4.25766 18.8008 4.33335 18.6114 4.47004 18.47L10.939 12L4.46904 5.53C4.34217 5.40289 4.26512 5.23447 4.25191 5.05537C4.2387 4.87626 4.29019 4.69836 4.39704 4.554L4.47004 4.47L4.39704 4.554Z",fill:"black"})}))})}))]})),a(P,{children:[n&&i(q,Object.assign({id:"alert-dialog-description"},{children:n})),i(B,Object.assign({maxWidth:"100%",overflow:"hidden"},{children:u}))]}),a(F,{children:[!h&&i(M,Object.assign({onClick:l,variant:"outlined"},{children:t})),o&&d?i(M,Object.assign({onClick:d,color:"primary",variant:"contained",autoFocus:!0,disabled:s,disableElevation:!0},{children:o})):null]})]}))}),zr={code:"",name:"",version:0,properties:[]},_r={code:"",name:"",version:0,properties:{}},Hr="Please, fill this field",Jr="Incorrect date format",Gr=e=>{var r,{control:n,validate:t,name:l="",label:c="",required:u=!1,defaultValue:p="",disabled:m=!1,textarea:g=!1,hideErrorMessage:h=!1,onChange:f,requiredErrorText:b=""}=e,y=s(e,["control","validate","name","label","required","defaultValue","disabled","textarea","hideErrorMessage","onChange","requiredErrorText"]);const v=T({name:l,control:n,defaultValue:p,rules:{required:!!u&&(b||Hr),validate:t}}),C=v.field,{ref:O,onChange:E,value:x}=C,j=s(C,["ref","onChange","value"]),{fieldState:{error:V}}=v;return i(d,Object.assign({},j,{fullWidth:!0,size:"small",variant:"outlined",type:"text",inputRef:O,name:l,label:u?a(o,{children:[c," ",i("span",{children:"*"})]}):c,sx:{".MuiInputLabel-root span":{color:"#D6331F"}},error:!!V,helperText:!h&&(null==V?void 0:V.message),FormHelperTextProps:{variant:"standard"},disabled:m,multiline:g,minRows:g?3:1,value:null!=x?x:"",onChange:f||E,InputLabelProps:{shrink:!!y.placeholder},inputProps:Object.assign(Object.assign({},null!==(r=null==y?void 0:y.inputProps)&&void 0!==r?r:{}),{value:null!=x?x:""})},y))};function Yr(e,r){const n=g();h((()=>()=>{n.current&&clearTimeout(n.current)}),[]);return(...t)=>{clearTimeout(n.current),n.current=setTimeout((()=>{e(...t)}),r)}}const Wr=()=>{const[e,r]=f(!1);return{open:e,toggle:()=>{r((e=>!e))},onClose:()=>{r(!1)},onOpen:()=>{r(!0)}}},Ur=e=>{var r,{control:n,validate:t,name:l="",label:c="",required:u=!1,defaultValue:p="",disabled:m=!1,textarea:g=!1,hideErrorMessage:y=!1,onChange:v,requiredErrorText:C=""}=e,O=s(e,["control","validate","name","label","required","defaultValue","disabled","textarea","hideErrorMessage","onChange","requiredErrorText"]);const{field:{ref:E,onChange:x},fieldState:{error:j}}=T({name:l,control:n,defaultValue:p,rules:{required:!!u&&(C||Hr),validate:t}}),V=R({control:n,name:l}),[N,w]=f("");h((()=>{!N&&V&&w(V)}),[N,V]);const S=Yr((e=>{x(e)}),200),k=b((e=>{w(e.target.value),S(e.target.value)}),[S]);return i(d,Object.assign({fullWidth:!0,size:"small",variant:"outlined",type:"text",inputRef:E,name:l,label:u?a(o,{children:[c," ",i("span",{children:"*"})]}):c,sx:{".MuiInputLabel-root span":{color:"#D6331F"}},error:!!j,helperText:!y&&(null==j?void 0:j.message),FormHelperTextProps:{variant:"standard"},disabled:m,multiline:g,minRows:g?3:1,value:null!=N?N:"",onChange:k},O,{inputProps:Object.assign(Object.assign({},null!==(r=null==O?void 0:O.inputProps)&&void 0!==r?r:{}),{value:null!=N?N:""})}))},Zr=()=>i(L,{children:i("path",{d:"M4.22032 8.46991C4.36094 8.32946 4.55157 8.25057 4.75032 8.25057C4.94907 8.25057 5.13969 8.32946 5.28032 8.46991L12.0003 15.1899L18.7203 8.46991C18.789 8.39622 18.8718 8.33712 18.9638 8.29613C19.0558 8.25514 19.1551 8.23309 19.2558 8.23132C19.3565 8.22954 19.4565 8.24807 19.5499 8.28579C19.6433 8.32351 19.7281 8.37965 19.7994 8.45087C19.8706 8.52209 19.9267 8.60692 19.9644 8.70031C20.0022 8.7937 20.0207 8.89373 20.0189 8.99443C20.0171 9.09513 19.9951 9.19445 19.9541 9.28645C19.9131 9.37845 19.854 9.46125 19.7803 9.52991L12.5303 16.7799C12.3897 16.9204 12.1991 16.9992 12.0003 16.9992C11.8016 16.9992 11.6109 16.9204 11.4703 16.7799L4.22032 9.52991C4.07987 9.38928 4.00098 9.19866 4.00098 8.99991C4.00098 8.80116 4.07987 8.61054 4.22032 8.46991Z",fill:"#8B8C9E"})}),Kr=e=>{var r,{control:n,validate:t,name:l="",label:c="",required:p=!1,defaultValue:m="",disabled:g=!1,hideErrorMessage:h=!1,onChange:f,labelKey:y,valueKey:v,options:C=[],requiredErrorText:O=""}=e,E=s(e,["control","validate","name","label","required","defaultValue","disabled","hideErrorMessage","onChange","labelKey","valueKey","options","requiredErrorText"]);const x=T({name:l,control:n,defaultValue:m,rules:{required:!!p&&(O||Hr),validate:t}}),j=x.field,{ref:V,onChange:R,value:N}=j,w=s(j,["ref","onChange","value"]),{fieldState:{error:S}}=x,k=b((e=>"string"==typeof e?e:v?e[v]:e.value),[v]),M=b((e=>"string"==typeof e?e:y?e[y]:e.label),[y]),D=b((()=>{f?f(null):R(null)}),[R,f]);return i(d,Object.assign({},w,{select:!0,fullWidth:!0,size:"small",variant:"outlined",type:"text",inputRef:V,name:l,label:p?a(o,{children:[c," ",i("span",{children:"*"})]}):c,sx:{".MuiInputLabel-root span":{color:"#D6331F"}},error:!!S,helperText:!h&&(null==S?void 0:S.message),FormHelperTextProps:{variant:"standard"},disabled:g,value:null!=N?N:"",onChange:f||R},E,{inputProps:Object.assign(Object.assign({},null!==(r=null==E?void 0:E.inputProps)&&void 0!==r?r:{}),{value:null!=N?N:""}),InputProps:Object.assign({endAdornment:!p&&N?i(A,Object.assign({position:"end",sx:{mr:0}},{children:i(I,Object.assign({onClick:D,size:"small"},{children:i(L,Object.assign({fontSize:"small"},{children:i("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})}))}))})):null},null==E?void 0:E.InputProps),SelectProps:{sx:{"& .MuiSelect-select .notranslate::after":E.placeholder?{content:`"${E.placeholder}"`,opacity:.42}:{}}}},{children:C.map(((e,r)=>i(u,Object.assign({value:k(e)},{children:M(e)}),r)))}))},Xr=e=>{var{control:r,validate:n,name:t="",label:l="",required:o=!1,defaultValue:c,disabled:d=!1,hideErrorMessage:u=!1,onChange:p}=e,m=s(e,["control","validate","name","label","required","defaultValue","disabled","hideErrorMessage","onChange"]);const g=T({name:t,control:r,defaultValue:null!=c&&c}),h=g.field,{ref:f,onChange:b,value:v}=h,C=s(h,["ref","onChange","value"]),{fieldState:{error:O}}=g,E=y((()=>{if("boolean"==typeof v)return v;if("string"==typeof v){if("false"===v)return b(!1),!1;if("true"===v)return b(!0),!0}return!1}),[v,b]);return a(H,Object.assign({error:!!O,component:"fieldset",variant:"standard",disabled:d},{children:[i(J,{control:i(Y,Object.assign({},C,{checked:E,onChange:p||b,name:t,inputRef:f,disabled:d,color:"secondary"},m)),label:l}),!u&&(null==O?void 0:O.message)&&i(G,Object.assign({variant:"standard"},{children:O.message}))]}))},Qr=({name:e,label:r,values:n=[],control:t,required:l,defaultValue:o,disabled:c,hideErrorMessage:d,labelKey:u,valueKey:p,validate:m,onChange:g,row:h,radioProps:f,requiredErrorText:y=""})=>{const v=T({name:e,control:t,defaultValue:o,rules:{required:!!l&&(y||Hr),validate:m}}),C=v.field,{onChange:O}=C,E=s(C,["onChange"]),{fieldState:{error:x}}=v,j=b((e=>"string"==typeof e?e:p?e[p]:e.value),[p]),V=b((e=>"string"==typeof e?e:u?e[u]:e.label),[u]),R=b((e=>"string"==typeof e?e===E.value:e===("string"==typeof E.value?"true"===E.value:E.value)),[E.value]),N=b((e=>{"true"===e.target.value||"false"===e.target.value?O("true"===e.target.value):O(e)}),[O]);return a(H,Object.assign({disabled:c,error:!!x},{children:[i(Z,Object.assign({id:"radio-buttons-group"},{children:r})),i(U,Object.assign({},E,{row:h,"aria-labelledby":"radio-buttons-group",onChange:g||N},{children:n.map(((e,r)=>i(J,{value:j(e),control:i(W,Object.assign({},f,{checked:R(j(e))})),label:V(e)},r)))})),!d&&(null==x?void 0:x.message)&&i(G,Object.assign({variant:"standard"},{children:x.message}))]}))};var en=({valueKey:e,labelKey:r})=>{const n=b(((r,n)=>{if(r&&n){if("string"==typeof r)return r===n;if(e)return X(r,e)===X(n,e)||X(r,e)===n;if(r.value)return r.value===n.value||r.value===n}return!1}),[e]),t=b((e=>e?"string"==typeof e?e:r&&X(e,r,"")?X(e,r,"")+"":e.label+""||e.name+""||e.value+""||e.code+""||"--no label--":""),[r]),l=b(((e,r)=>v(B,Object.assign({},e,{component:"li",key:e.id}),t(r))),[t]);return{isOptionEqualToValue:n,getOptionLabel:t,renderOption:l}};const rn=p.createContext({}),nn=p.forwardRef(((e,r)=>{const n=p.useContext(rn);return i("div",Object.assign({ref:r},e,n))}));function tn(e){const{data:r,index:n,style:t}=e,l=r[n],a=Object.assign(Object.assign({},t),{top:t.top+8});if(l.hasOwnProperty("group"))return i(ee,Object.assign({component:"div",style:a},{children:l.group}),l.key);const{key:o}=l,c=s(l,["key"]);return i(z,Object.assign({component:"li"},c,{noWrap:!0,style:a},{children:l}),o)}const ln=p.forwardRef((function(r,n){const{children:t}=r,l=s(r,["children"]),a=[];t.forEach((e=>{a.push(e),a.push(...e.children||[])}));const o=e(),c=Q(o.breakpoints.up("sm"),{noSsr:!0}),d=a.length,u=c?36:48,m=e=>e.hasOwnProperty("group")?48:u,g=function(e){const r=p.useRef(null);return p.useEffect((()=>{null!=r.current&&r.current.resetAfterIndex(0,!0)}),[e]),r}(d);return i("div",Object.assign({ref:n},{children:i(rn.Provider,Object.assign({value:l},{children:i(re,Object.assign({itemData:a,height:(d>8?8*u:a.map(m).reduce(((e,r)=>e+r),0))+16,width:"100%",ref:g,outerElementType:nn,innerElementType:"ul",itemSize:e=>m(a[e]),overscanCount:5,itemCount:d},{children:tn}))}))}))}));var an=ln;const on=e=>{var{control:r,validate:n,name:t="",label:l="",required:c=!1,defaultValue:u="",disabled:p=!1,hideErrorMessage:m=!1,onChange:g,labelKey:b,valueKey:y,options:v=[],multiple:C,textFieldProps:O={},disableCloseOnSelect:E,useStringValue:x,requiredErrorText:j="",startAdornment:V,endAdornment:R,useVirtualList:N}=e,w=s(e,["control","validate","name","label","required","defaultValue","disabled","hideErrorMessage","onChange","labelKey","valueKey","options","multiple","textFieldProps","disableCloseOnSelect","useStringValue","requiredErrorText","startAdornment","endAdornment","useVirtualList"]);const S=T({name:t,control:r,defaultValue:u||(C?[]:null),rules:{required:!!c&&(j||Hr),validate:n}}),k=S.field,{ref:L,onChange:I,value:A}=k,M=s(k,["ref","onChange","value"]),{fieldState:{error:D}}=S,[F,P]=f(),{getOptionLabel:q,isOptionEqualToValue:$,renderOption:B}=en({valueKey:y,labelKey:b});return h((()=>{"string"==typeof A&&y&&x&&void 0===F&&v.length&&v[0]&&"object"==typeof v[0]&&P(v.find((e=>X(e,y)===A)))}),[F,v,x,A,y]),i(K,Object.assign({},M,{value:x?null!=F?F:null:A,fullWidth:!0,disablePortal:!0,size:"small",readOnly:p,options:v,multiple:C,ListboxComponent:N?an:null,disableListWrap:N,getOptionLabel:q,isOptionEqualToValue:$,disableCloseOnSelect:E||C,filterSelectedOptions:C,onChange:g||((e,r)=>{I(x&&y?X(r,y):r),P(r)}),renderOption:B,renderInput:e=>i(d,Object.assign({},e,{variant:"outlined",name:t,label:c?a(o,{children:[l," ",i("span",{children:"*"})]}):l,InputLabelProps:{shrink:!!(null==w?void 0:w.placeholder)},sx:{".MuiInputLabel-root span":{color:"#D6331F"}},placeholder:null==w?void 0:w.placeholder,error:!!D,inputRef:L,helperText:!m&&(null==D?void 0:D.message),FormHelperTextProps:{variant:"standard"},InputProps:Object.assign(Object.assign({},e.InputProps),{startAdornment:V||e.InputProps.startAdornment,endAdornment:R||e.InputProps.endAdornment})},O))},w))};const sn=()=>i("img",{src:"data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M4.22032 8.46991C4.36094 8.32946 4.55157 8.25057 4.75032 8.25057C4.94907 8.25057 5.13969 8.32946 5.28032 8.46991L12.0003 15.1899L18.7203 8.46991C18.789 8.39622 18.8718 8.33712 18.9638 8.29613C19.0558 8.25514 19.1551 8.23309 19.2558 8.23132C19.3565 8.22954 19.4565 8.24807 19.5499 8.28579C19.6433 8.32351 19.7281 8.37965 19.7994 8.45087C19.8706 8.52209 19.9267 8.60692 19.9644 8.70031C20.0022 8.7937 20.0207 8.89373 20.0189 8.99443C20.0171 9.09513 19.9951 9.19445 19.9541 9.28645C19.9131 9.37845 19.854 9.46125 19.7803 9.52991L12.5303 16.7799C12.3897 16.9204 12.1991 16.9992 12.0003 16.9992C11.8016 16.9992 11.6109 16.9204 11.4703 16.7799L4.22032 9.52991C4.07987 9.38928 4.00098 9.19866 4.00098 8.99991C4.00098 8.80116 4.07987 8.61054 4.22032 8.46991Z' fill='%238B8C9E'/%3e%3c/svg%3e",alt:""});function cn(e){var{name:r,label:n,control:t,required:l=!1,searchBy:c,labelKey:u,multiple:p=!1,mongoQueryJson:g,disabled:v,valueKey:C,sortBy:O="",hideErrorMessage:E,disableCloseOnSelect:x,textFieldProps:j,onChange:V,queryFunction:R,validate:N,itemQueryFunction:w,requiredErrorText:S="",startAdornment:k,endAdornment:L,useVirtualList:I}=e,M=s(e,["name","label","control","required","searchBy","labelKey","multiple","mongoQueryJson","disabled","valueKey","sortBy","hideErrorMessage","disableCloseOnSelect","textFieldProps","onChange","queryFunction","validate","itemQueryFunction","requiredErrorText","startAdornment","endAdornment","useVirtualList"]);const D=T({control:t,name:r,defaultValue:p?[]:null,rules:{required:!!l&&(S||Hr),validate:N}}),F=D.field,{ref:P,onChange:q,value:$}=F,B=s(F,["ref","onChange","value"]),{fieldState:{error:z,isDirty:H}}=D,{getOptionLabel:J,isOptionEqualToValue:G,renderOption:Y}=en({valueKey:C,labelKey:u}),[W,U]=f([]),[Z,Q]=f(!1),[ee,re]=f(""),[le,ie]=f(""),[ae,oe]=f(0),se=y((()=>!!W.length&&Z),[Z,W]),{data:ce,isFetching:de}=ne(["options",ae,le],(()=>{const e=te.parse(Object.assign({page:`${ae}`,size:"20",sort:O},le?{[c]:le}:{}),{ignoreQueryPrefix:!0});return R(e)}),{onSuccess(e){U(le?e.collection:r=>1===r.length?e.collection:[...r,...e.collection])}}),ue=(e,r)=>{if("object"==typeof e){if(Array.isArray(e))return e.map((e=>ue(e,r)));{const n={};for(const t in e)n[t]=ue(e[t],r);return n}}return"string"==typeof e&&e.includes("${variable}")?e.replace("${variable}",r):e},pe=Yr((e=>{if(oe(0),g){const r=ue(g,e);ie(JSON.stringify(r))}else ie(e)}),500),me=b(((e,r)=>{U([]),re(r),pe(r)}),[pe]),ge=b(((e,r)=>{q(r),V&&V(e,r)}),[q,V]);h((()=>{if(!H&&$&&w){let e=$;"object"==typeof $&&C in $&&(e=X($,C)),w(e).then((e=>{q(e),re(X(e,u))})).catch(console.error)}}),[$,H,C,u,w,q]);const he=b((e=>{const r=e.currentTarget;r.scrollHeight-r.scrollTop-r.clientHeight<=1&&W.length<(null==ce?void 0:ce.totalItems)&&oe((e=>e+1))}),[ce,W]);return i(K,Object.assign({},B,{fullWidth:!0,disablePortal:!0,size:"small",readOnly:v,options:W,multiple:p,getOptionLabel:J,isOptionEqualToValue:G,disableCloseOnSelect:x||p,filterSelectedOptions:p,inputValue:ee,value:$,onChange:ge,ListboxComponent:I?an:null,disableListWrap:I,loading:de,clearOnBlur:!1,open:se,filterOptions:e=>e,onOpen:()=>{Q(!0)},onClose:()=>{Q(!1),ie("")},onInputChange:me,ListboxProps:{onScroll:he},renderOption:Y,popupIcon:i(sn,{}),renderInput:e=>i(d,Object.assign({},e,{label:l?a(o,{children:[n," ",i("span",{children:"*"})]}):n,InputLabelProps:{shrink:!!(null==M?void 0:M.placeholder)},placeholder:null==M?void 0:M.placeholder,sx:{".MuiInputLabel-root span":{color:"#D6331F"}},variant:"outlined",error:!!z,inputRef:P,helperText:!E&&(null==z?void 0:z.message),FormHelperTextProps:{variant:"standard"},InputProps:Object.assign(Object.assign({},e.InputProps),{endAdornment:L||a(m.Fragment,{children:[de?i(A,Object.assign({position:"end"},{children:i(_,{color:"inherit",size:20})})):null,e.InputProps.endAdornment]}),startAdornment:k||e.InputProps.startAdornment})},j))},M))}const dn=({copyText:e,helpText:r="Copy"})=>{const[n,t]=f(r);return n?i(le,Object.assign({title:n,placement:"top"},{children:i(I,Object.assign({onClick:()=>{navigator.clipboard.writeText(e),t("Copied!"),setTimeout((()=>{t(r)}),1e3)}},{children:i(L,Object.assign({fontSize:"small"},{children:i("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4 6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z"})}))}))})):null},un=({text:e,buttonProps:r={}})=>{const n=ie(),{state:t}=ae(),l=y((()=>null==t?void 0:t.from),[t]),a=b((()=>{n(l||-1)}),[n,l]);return i(B,Object.assign({mr:2},{children:e?i(M,Object.assign({color:"inherit",onClick:l?null:a,component:oe,to:null!=l?l:""},r,{children:e})):i(I,Object.assign({onClick:a},{children:i(L,{children:i("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"})})}))}))},pn=C(((e,r)=>{var{control:n,name:t,mode:l="json",label:c,width:d="100%",height:u="200px",readOnly:p,required:m=!1,validateJson:g=!1,hideErrorMessage:h=!1,fontSize:f=16,validate:v=!0,parseValue:C,requiredErrorText:O="",useCleanValue:E}=e,x=s(e,["control","name","mode","label","width","height","readOnly","required","validateJson","hideErrorMessage","fontSize","validate","parseValue","requiredErrorText","useCleanValue"]);const j=T({control:n,name:t,rules:{required:!!m&&(O||Hr),validate:e=>{if(e&&g&&"string"==typeof e)try{return JSON.parse(e),!0}catch(e){return console.error(e),"Invalid JSON"}return!0}}}),V=j.field,{onChange:R,value:N,ref:w}=V,S=s(V,["onChange","value","ref"]),{fieldState:{error:k}}=j,L=y((()=>({json:[ue.json()],javascript:[ue.javascript()],python:[ue.python()]})),[]),I=y((()=>"text"===l&&"string"!=typeof N?JSON.stringify(N,null,2):"json"===l&&"string"!=typeof N?null===N?"":E?JSON.stringify(N,null,2).replace(/\\"/g,""):JSON.stringify(N,null,2):"string"==typeof N&&"text"!==l&&E?N.replace(/\\"/g,""):N),[N,E,l]),A=b((e=>{if(C)try{const r=JSON.parse(e);R(r)}catch(r){R(e)}else R(e)}),[R,C]);return a(B,Object.assign({display:"flex",flexDirection:"column",width:"100%"},{children:[i(B,{children:c&&i(z,Object.assign({variant:"subtitle1",display:"inline",style:{marginRight:10}},{children:m?a(o,{children:[c," ",i(B,Object.assign({component:"span",color:"#D6331F"},{children:"*"}))]}):c}))}),a(o,{children:[i(de,Object.assign({},S,{ref:r||w,basicSetup:{autocompletion:!0,history:!0},theme:pe,width:d,height:u,style:{fontSize:f,lineHeight:1.4,zIndex:0,isolation:"isolate"},readOnly:p,value:I,onChange:A,extensions:"text"===l?[]:L[l]},x)),k&&!h&&i(G,Object.assign({variant:"standard",error:!0},{children:k.message}))]})]}))})),mn=(e,r)=>{const n=[...e];return n.splice(r,1),n},gn=e=>{try{JSON.parse(e)}catch(e){return!1}return!0};function hn(e){return e.replace(/(^\w)|([-\s]\w)/g,(e=>e.toUpperCase()))}const fn=(e,r,n,t="asc")=>{const l=e[n],i=r[n];return l<i?"asc"===t?-1:1:l>i?"asc"===t?1:-1:0},bn=e=>{if(!e)return"";if("string"==typeof e)try{return JSON.stringify(JSON.parse(e),null,2)}catch(r){return e}else try{return JSON.stringify(e,null,2)}catch(e){return"Failed to stringify JSON"}},yn=e=>{try{return JSON.parse(e)}catch(e){return null}},vn=e=>{try{const r=JSON.parse(e);return Object.keys(r).forEach((e=>{r[e]=vn(r[e])})),r}catch(r){return e}},Cn=C((({value:e,height:r=200,fontSize:n=16},t)=>{const[l,o]=f(!0),s=b((e=>{const r=n=>{e.scrollDOM.scrollHeight-e.scrollDOM.offsetHeight-n.target.scrollTop<10&&setTimeout((()=>e.scrollDOM.scrollTo(0,0)),200),0===n.target.scrollTop&&(o(!1),e.scrollDOM.removeEventListener("scroll",r))};e.scrollDOM.scrollHeight>3e4?(o(!0),e.scrollDOM.addEventListener("scroll",r),e.scrollDOM.scrollTo(0,e.scrollDOM.scrollHeight-1e3),setTimeout((()=>{e.scrollDOM.scrollTo({top:e.scrollDOM.scrollHeight,behavior:"smooth"})}),300)):o(!1)}),[]);return a(B,Object.assign({position:"relative"},{children:[l&&i($r,{bgcolor:"#fff"}),i(de,{ref:t,readOnly:!0,width:"100%",value:"string"==typeof e?e:JSON.stringify(e,null,2),height:`${r}px`,basicSetup:{autocompletion:!0,history:!0,foldGutter:!0},onCreateEditor:s,extensions:[ue.json()],style:{fontSize:n,width:"100%"}})]}))})),On=({open:e,onClose:r,value:n,jsonViewProps:t})=>{const l=g();return a(D,Object.assign({disableEscapeKeyDown:!0,open:e,onClose:r,fullWidth:!0,maxWidth:"md",style:{width:800,left:"30%"}},{children:[i(P,{children:i(Cn,Object.assign({value:n},t,{ref:l}))}),a(F,{children:[i(dn,{copyText:n}),i(M,Object.assign({onClick:r,variant:"contained",color:"secondary"},{children:"Close"}))]})]}))};var En=({value:e,copyButton:r=!1,textField:n=!1})=>{const{open:t,onOpen:l,onClose:o}=Wr(),s=b((e=>{e.stopPropagation(),l()}),[l]);return a(B,Object.assign({width:"100%"},{children:[a(B,Object.assign({display:"flex",alignItems:"center",justifyContent:"flex-end",pt:1,mb:2},{children:[r&&i(dn,{copyText:bn(e)}),i(le,Object.assign({title:"Open",placement:"top"},{children:i(I,Object.assign({size:"small",onClick:s},{children:i(L,{children:i("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"})})}))}))]})),n?i(B,Object.assign({overflow:"hidden",whiteSpace:"nowrap"},{children:"object"==typeof e?JSON.stringify(e):e})):i(Cn,{value:e}),i(On,{open:t,value:bn(e),onClose:o,jsonViewProps:{height:450}})]}))};const xn={spacing:4,palette:{primary:{main:"#E0613A",dark:"#d9512e",light:"#E0613A"},secondary:{main:"#007994",dark:"#262842",light:"#cbe8ee"},text:{disabled:"#A9A9B8"},success:{main:"#2DB77B",light:"#DBFCEE"},grey:{100:"#F7F8FC",700:"#101F2B"}},typography:{fontSize:14,allVariants:{fontFamily:["Euclid","-apple-system","BlinkMacSystemFont",'"Segoe UI"',"Roboto",'"Helvetica Neue"',"Arial","sans-serif",'"Apple Color Emoji"','"Segoe UI Emoji"','"Segoe UI Symbol"'].join(",")},h1:{fontWeight:400},h3:{fontWeight:500},h4:{fontWeight:500}}};var jn=r(xn);var Vn={components:{MuiButtonBase:{defaultProps:{disableElevation:!0,disableRipple:!0},styleOverrides:{root:{"&.MuiButton-root":{boxShadow:"none"},"&.MuiButton-root:hover":{boxShadow:"none"},"&.MuiButton-containedPrimary:hover":{backgroundColor:"#D15C3B"},"&.MuiButton-outlinedPrimary:hover":{backgroundColor:"#F6F6F7",borderColor:"#DDDDE1"},"&.MuiButton-textPrimary":{color:jn.palette.secondary.dark,"&:hover":{backgroundColor:"#F6F6F7"},"&:active":{backgroundColor:"#EEEEF0"}},"&.MuiButton-textSecondary":{color:jn.palette.secondary.main,"&:hover":{backgroundColor:"#DEF7FC"},"&:active":{backgroundColor:"#CFE6ED"}}}}},MuiInputBase:{styleOverrides:{root:{color:"#262842",borderRadius:jn.spacing(3),minWidth:jn.spacing(25),background:jn.palette.background.default,paddingRight:jn.spacing(3)},input:{minWidth:jn.spacing(25)}}},MuiSelect:{defaultProps:{IconComponent:Zr},styleOverrides:{nativeInput:{padding:0,height:"32px"}}},MuiTextField:{styleOverrides:{root:{minWidth:jn.spacing(25)}}},MuiInputLabel:{styleOverrides:{root:{color:"#6D6E85",position:"relative",overflow:"initial",transform:"none",marginBottom:jn.spacing(1),fontWeight:500,fontSize:"14px",lineHeight:"20px",pointerEvents:"auto",whiteSpace:"normal","&.Mui-focused":{color:"#6D6E85"}}}},MuiOutlinedInput:{styleOverrides:{root:{borderRadius:jn.spacing(3),minWidth:jn.spacing(25),"&:hover":{".MuiOutlinedInput-notchedOutline":{borderColor:"#8B8C9E"}},"&.Mui-focused":{".MuiOutlinedInput-notchedOutline":{borderColor:jn.palette.secondary.main}}},notchedOutline:{top:0,"& legend":{display:"none",transition:"none"}}}},MuiAutocomplete:{defaultProps:{popupIcon:i(Zr,{})},styleOverrides:{root:{"& .MuiOutlinedInput-root .MuiAutocomplete-endAdornment":{right:12}},paper:{marginTop:8,borderRadius:12,boxShadow:"0px 8px 16px rgba(0, 0, 0, 0.04)"},listbox:{"::-webkit-scrollbar":{width:"6px",backgroundColor:"white"},"::-webkit-scrollbar-thumb":{borderRadius:"10px",backgroundColor:"rgba(38, 40, 66, 0.24)"}}}},MuiMenu:{styleOverrides:{list:{paddingTop:0,paddingBottom:0,background:"white","& li.Mui-selected":{background:"rgba(38, 40, 66, 0.08) !important"}}}},MuiPopover:{styleOverrides:{paper:{marginTop:8,borderRadius:12,boxShadow:"0px 8px 16px rgba(0, 0, 0, 0.04)"}}},MuiFormLabel:{styleOverrides:{root:{color:"#6D6E85",fontSize:14,fontWeight:500,"&.Mui-focused":{color:"#6D6E85"},"& span":{color:"#D6331F"}},asterisk:{color:"#D6331F","&$error":{color:"#D6331F"}}}},MuiTooltip:{styleOverrides:{tooltip:{fontSize:14},backgroundColor:jn.palette.secondary.dark,padding:jn.spacing(2,3),borderRadius:8,textAlign:"center"}}}};var Tn={components:{MuiTableContainer:{styleOverrides:{root:{borderRadius:jn.spacing(3),border:"1px solid rgba(38, 40, 66, 0.08)",overflow:"hidden"}}},MuiTableHead:{styleOverrides:{root:{backgroundColor:"#F7F8FC"}}},MuiTableRow:{styleOverrides:{root:{"&.MuiTableRow-hover":{"&:hover":{backgroundColor:"#F6F6F7"},"&:active, &:focus":{backgroundColor:"#EEEEF0"}},"&:active, &:focus":{backgroundColor:"#EEEEF0"}}}},MuiTableCell:{styleOverrides:{root:{padding:jn.spacing(1,2),borderColor:"#26284214","&:first-of-type":{paddingLeft:jn.spacing(4)}},head:{padding:jn.spacing(2,2),color:"#6D6E85"},body:{wordBreak:"break-all"}}},MuiTableSortLabel:{styleOverrides:{root:{maxHeight:"24px",lineHeight:1}}},MuiTablePagination:{styleOverrides:{root:{"& .MuiInputBase-root":{border:"1px solid #2628421F",borderRadius:4,minWidth:58,height:32,paddingRight:jn.spacing(2),"& .MuiSelect-select":{paddingRight:"4px !important",color:jn.palette.secondary.dark,"&:focus":{backgroundColor:"transparent"}}}}}},MuiPaginationItem:{styleOverrides:{root:{height:32,minWidth:32,borderRadius:4,border:"1px solid transparent",margin:"0, 2px","&.Mui-selected":{borderColor:"#2628421F",backgroundColor:"#F7F8FC"}}}},MuiDataGrid:{defaultProps:{headerHeight:40,getRowHeight:()=>"auto"},styleOverrides:{root:{borderRadius:jn.spacing(3),width:"100%",color:jn.palette.secondary.dark,border:"1px solid #26284214","& .MuiDataGrid-actionsCell":{flexWrap:"wrap",width:"100%",'& > button[aria-label="more"]':{marginLeft:"auto"}}},columnHeaders:{backgroundColor:jn.palette.grey[100],borderTopLeftRadius:jn.spacing(3),borderTopRightRadius:jn.spacing(3)},columnHeader:{"&:focus":{outline:"none"}},columnHeaderTitle:{color:"#6D6E85",fontWeight:500},row:{"&:hover":{backgroundColor:"#F6F6F7"},"&:active, &:focus":{backgroundColor:"#EEEEF0"}},columnSeparator:{display:"none"},withBorder:{borderColor:"#E0E3EA"},cell:{minHeight:"48px !important",textOverflow:"ellipsis",wordBreak:"break-all",lineHeight:"unset",padding:jn.spacing(1.25,3),borderColor:"#E0E3EA","&:focus":{outline:"none"}}}}}};var Rn={components:{MuiStepIcon:{styleOverrides:{root:{fontSize:"20px",color:jn.palette.text.disabled,"&.Mui-active, &.Mui-completed":{color:jn.palette.secondary.main}}}}}};var Nn={components:{MuiTypography:{styleOverrides:{h1:{[jn.breakpoints.up("lg")]:{fontSize:"1.5rem"}},h3:{fontSize:"1.25rem",[jn.breakpoints.up("lg")]:{fontSize:"1.125rem"}},h4:{fontSize:"1rem",[jn.breakpoints.up("lg")]:{fontSize:"1rem"}},subtitle2:{color:"#6D6E85"}}}}};const wn=(()=>{if(document){const e="https://dev-qa-arsenal-frontend-fonts-bucket.s3.eu-north-1.amazonaws.com/fonts.css";if(!document.querySelectorAll(`link[href="${e}"]`).length){const r=document.createElement("link");r.href=e,r.rel="stylesheet",document.head.appendChild(r)}}return n(r(jn,{components:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Vn.components),Tn.components),Rn.components),Nn.components),{MuiToolbar:{styleOverrides:{root:{[jn.breakpoints.up("sm")]:{minHeight:"56px"}}}},MuiAppBar:{styleOverrides:{root:{boxShadow:"none",backgroundColor:"#007F9B"}}},MuiButton:{styleOverrides:{root:{borderRadius:jn.spacing(2.5),padding:jn.spacing(2.5,4),lineHeight:"20px",fontSize:"1rem",textTransform:"none"},outlined:{color:"#262842",backgroundColor:"#FFFFFF !important",border:"1px solid rgba(38, 40, 66, 0.12)"},text:{color:jn.palette.secondary.dark}}},MuiDialog:{styleOverrides:{root:{"& .MuiModal-backdrop":{background:"rgba(28, 55, 77, 0.5)",backdropFilter:"blur(2px)"}},paper:{borderRadius:jn.spacing(3)},paperWidthXs:{maxWidth:500}}},MuiDialogContent:{styleOverrides:{root:{color:"#6D6E85"}}},MuiDialogActions:{styleOverrides:{root:{background:"#F7F8FC",borderTop:"1px solid rgba(38, 40, 66, 0.08)",padding:jn.spacing(3,6)}}},MuiTabs:{styleOverrides:{root:{minHeight:"38px"},indicator:{backgroundColor:jn.palette.secondary.main}}},MuiTab:{styleOverrides:{root:{fontSize:14,fontWeight:500,textTransform:"none",padding:"10px 12px",lineHeight:"1.125rem",minHeight:"38px",color:"#8B8C9E","&.Mui-selected":{color:jn.palette.secondary.main}}}}})}))})(),Sn=({value:e,canCopy:r,copyValue:n,shortId:t,fullText:l=!1,textParams:o})=>{const{displayAs:s="text",tooltipLinkComponent:c=null,dateFormat:d=null,statusVariant:u=null}=o||{};switch(s){case"boolean":return i(L,e?Object.assign({color:"primary",fontSize:"small"},{children:i("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})}):Object.assign({fontSize:"small"},{children:i("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20zm6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9z"})}));case"date":return e?d?i(ua,{children:d.map(((r,n)=>i(B,{children:he(new Date(e),r)},n)))}):a(ua,{children:[i(B,{children:he(new Date(e),"dd.MM.yyyy")}),i(B,{children:he(new Date(e),"HH:mm:ss")})]}):"";case"status":return i(ua,{children:i(Mi,{text:e,status:u||"default"})});case"json_text":return i(En,{value:e,textField:!0});case"json_code":return i(En,{value:e,copyButton:!0});case"array":return i(B,{children:null==e?void 0:e.map(((e,r)=>i(B,{children:e},r)))});case"collapsed_array":return e&&i(B,{children:i(le,Object.assign({arrow:!0,title:c||e.map(((e,r)=>i(B,Object.assign({fontSize:14,style:{paddingTop:wn.spacing(1)}},{children:e}),r)))},{children:i(B,{children:e.length>1?`${e[0]} (+${e.length-1})`:e[0]})}))});case"number":return i(B,Object.assign({display:"flex",justifyContent:"flex-end"},{children:i(ua,{children:e.toLocaleString("ru-Ru",{minimumFractionDigits:2})})}));default:return e?a(B,Object.assign({display:"flex",alignItems:"center",width:"100%"},{children:[t?i(ua,{children:e?`${e.slice(0,6)}...${e.slice(-6)}`:"..."}):l?i(B,Object.assign({sx:{whiteSpace:"normal"}},{children:"string"==typeof e?e:JSON.stringify(e)})):i(ua,{children:"string"==typeof e?e:JSON.stringify(e)}),r&&i(dn,{copyText:n?"string"==typeof n?n:JSON.stringify(n):e})]})):""}},kn=new RegExp("^[-+]?[0-9]+$"),Ln=new RegExp(/^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/),In=(e,r)=>{if("string"==typeof e)return/[$%#{<]{1}(?:S?JS)?(?:[{(%#>]|\()/g.test(e);if(r){if(Array.isArray(e))for(const n of e)if(In(n,r))return!0;if("object"==typeof e)for(const n in e)if(In(e[n],r))return!0}return!1},An=e=>e===Ar.DATE||e===Ar.DATE_TIME||e===Ar.TIME,Mn=new Intl.NumberFormat("ru-RU",{style:"decimal"}),Dn=e=>!e&&0!==e&&!1!==e,Fn=(e,r,n)=>{if(null==r)return null;if(In(r))return r;let t=r;switch(e){case Ar.BOOLEAN:t=!!r||!(!r&&null!==r)&&null;break;case Ar.INTEGER:case Ar.BIG_INTEGER:case Ar.BIG_DECIMAL:case Ar.FLOAT:case Ar.LONG:case Ar.DOUBLE:t=Number(r);break;case Ar.DATE:case Ar.DATE_TIME:case Ar.TIME:if(r)try{const e=n.formatText.replace(/[Z,z,x]+/g,"XX");t=he(fe(r,e,new Date),e)}catch(e){console.error(e)}break;case Ar.JSON:try{"string"!=typeof r&&(t=JSON.stringify(r)),t=JSON.parse(t)}catch(e){console.log(e),t=null}break;case Ar.ANY:try{t="string"==typeof r?JSON.parse(t):r}catch(e){t=r}break;case Ar.ENTITY:t=Pn(n.properties,r)}return t},Pn=(e,r)=>{if(r){const n={};return e.forEach((e=>{const{key:t,propertyType:l}=e,i=r[t];Array.isArray(i)?n[t]=i.map((r=>Fn(l,r,{formatText:e.format,properties:e.properties}))):n[t]=Fn(l,i,{formatText:e.format,properties:e.properties})})),n}return null},qn=(e,r)=>{const n={};return e.forEach((e=>{const{key:t,name:l,isRequired:i,isMultiple:a,sortOrder:o,isEnabled:s,uiSettings:c,validationNode:d}=e,u=e.propertyType?"string"==typeof e.propertyType?e.propertyType:e.propertyType.value:null,p=Object.assign({name:l,propertyType:u,isRequired:i,isMultiple:a,sortOrder:o,isEnabled:s,validationNode:d,uiSettings:c},((e,r)=>{const n={};let t,l="";return r?e.isMultiple?(l="values",t=e.value):(l="value",t=e.value):e.isMultiple?(l="defaultValues",t=e.defaultValue):(l="defaultValue",t=e.defaultValue),Array.isArray(t)?n[l]=t.map((r=>Fn(e.propertyType,r,{formatText:e.format,properties:e.properties}))):n[l]=Fn(e.propertyType,t,{formatText:e.format,properties:e.properties}),n})(Object.assign(Object.assign({},e),{propertyType:u}),r));if("isViewableInList"in e&&(p.isViewableInList=e.isViewableInList),c)if("string"==typeof c)try{p.uiSettings=JSON.parse(c)}catch(e){console.log(e),p.uiSettings=c}else p.uiSettings=c;else p.uiSettings=null;u===Ar.BIG_DECIMAL&&(p.precisionScale=e.precisionScale,p.roundingMode=e.roundingMode),u!==Ar.DATE&&u!==Ar.TIME&&u!==Ar.DATE_TIME||(p.format=e.format),u===Ar.STRING&&(p.restrictedValues=e.restrictedValues),u===Ar.ENTITY_REFERENCE&&(p.source=e.source,p.definitionCode=e.definitionCode,p.definitionVersion=e.definitionVersion,p.labelPropertyCode=e.labelPropertyCode,p.valuePropertyCode=e.valuePropertyCode),u===Ar.ENTITY&&(p.properties=qn(e.properties,r)),n[t]=p})),n};function $n(e,r){return Object.keys(e).map((n=>{const t=Object.assign(Object.assign({key:n},e[n]),r||{});if(t.propertyType===Ar.ENTITY&&(t.properties=$n(t.properties,r)),t.propertyType===Ar.JSON)try{null==t.defaultValue?t.defaultValue="":t.defaultValue=JSON.stringify(t.defaultValue,null,2)}catch(e){t.defaultValue=""}return t.isMultiple&&("defaultValues"in t&&(t.defaultValue=t.defaultValues),"values"in t&&(t.value=t.values)),t})).sort(((e,r)=>fn(e,r,"sortOrder")))}const Bn=(e,r)=>{if(r)try{const e=r.replace(/Z/g,"XXX");return he(new Date,e),e}catch(r){return console.error("Incorrect format",r),e}return e},zn=e=>{let r=[];return r=Array.isArray(e.properties)?e.properties:$n(e.properties),r.reduce(((e,r)=>{const n=JSON.parse(JSON.stringify(e));return r.propertyType===Ar.ENTITY?n[r.key]=zn(r):n[r.key]=r.propertyType,n}),{})},_n=({propertyType:e,useExpression:r,required:n})=>{let t=[{value:"widget",label:"Fill array (widget)",sortOrder:1}];return n||t.push({value:"null",label:"NULL",sortOrder:0}),r&&(e===Ar.JSON||e===Ar.ENTITY||e===Ar.ANY?t.push({value:"expression",label:"Expression (JSON editor)",sortOrder:3}):t.push({value:"expression",label:"Expression",sortOrder:3})),e!==Ar.JSON&&e!==Ar.ANY&&e!==Ar.ENTITY||t.push({value:"json_valid",label:"JSON editor",sortOrder:2}),t=t.sort(((e,r)=>fn(e,r,"sortOrder"))),t},Hn=({propertyType:e,useExpression:r,required:n})=>{let t=[{value:"widget",label:"Widget",sortOrder:1}];switch(n||t.push({value:"null",label:"NULL",sortOrder:0}),r&&(e===Ar.JSON||e===Ar.ENTITY||e===Ar.ANY?t.push({value:"expression",label:"Expression (JSON editor)",sortOrder:3}):t.push({value:"expression",label:"Expression",sortOrder:3})),e===Ar.JSON&&t.push({value:"dem_builder",label:"DEM Builder",sortOrder:2}),e){case Ar.STRING:t[0].label="Text input";break;case Ar.INTEGER:case Ar.BIG_INTEGER:case Ar.BIG_DECIMAL:case Ar.FLOAT:case Ar.LONG:case Ar.DOUBLE:t[0].label="Number input";break;case Ar.BOOLEAN:t[0].label="Switch";break;case Ar.ENTITY_REFERENCE:t[0].label="Entity reference field";break;case Ar.JSON:t[0].label="JSON editor";break;case Ar.DATE:t[0].label="Date picker",t.push({value:"string",label:"Text input",sortOrder:2});break;case Ar.DATE_TIME:t[0].label="Date & Time picker",t.push({value:"string",label:"Text input",sortOrder:2});break;case Ar.TIME:t[0].label="Time picker",t.push({value:"string",label:"Text input",sortOrder:2});break;case Ar.ANY:t[0].label="Textarea"}return t=t.sort(((e,r)=>fn(e,r,"sortOrder"))),t},Jn=e=>!e&&0!==e&&!1!==e,Gn=(e,r,n)=>{if(null==r)return null;if(In(r))return r;let t=r;switch(Qn(e)){case Pr.BOOLEAN:t=!!r||!(!r&&null!==r)&&null;break;case Pr.INTEGER:case Pr.BIG_INTEGER:case Pr.BIG_DECIMAL:case Pr.FLOAT:case Pr.LONG:case Pr.DOUBLE:case Pr.SHORT:t=Number(r);break;case Pr.DATE:case Pr.DATE_TIME:case Pr.TIME:if(r)try{const e=n.formatText.replace(/[Z,z,x]+/g,"XX");t=he(fe(r,e,new Date),e)}catch(e){console.error(e)}break;case Pr.ANY:try{t="string"==typeof r?JSON.parse(t):r}catch(e){t=r}break;case Pr.OBJECT:t=Yn(e,r)}return t},Yn=(e,r)=>{var n;let t={};if(r){const l=Qn(e);return l===Pr.OBJECT?Array.isArray(e.properties)?null===(n=e.properties)||void 0===n||n.forEach((function(e){const{key:n}=e,l=r[n];Array.isArray(l)?t[n]=l.map((r=>Gn(e,r,{formatText:e.format,properties:e.properties}))):t[n]=Gn(e,l,{formatText:e.format,properties:e.properties})})):t=vr(r)?r:{}:t=l===Pr.ARRAY&&Array.isArray(r)?r.map((r=>e.memberNodes?Gn(e.memberNodes,r):r)):Gn(e,r),t}return null},Wn=(e,r)=>{return n(e);function n(e){const{name:t,isRequired:l,sortOrder:i,isEnabled:a,uiSettings:o,validationNode:s}=e,c=Qn(e),d=Object.assign({name:t,nodeType:c,isRequired:null!==l&&l,sortOrder:i,isEnabled:null!==a&&a,validationNode:s,uiSettings:o},((e,r)=>{const n={};let t,l="";return r?e.nodeType===Pr.ARRAY?(l="values",t=e.value):(l="value",t=e.value):e.nodeType===Pr.ARRAY?(l="defaultValues",t=e.defaultValue):(l="defaultValue",t=e.defaultValue),Array.isArray(t)?n[l]=t.map((r=>Gn(e,r,{formatText:e.format,properties:e.properties}))):n[l]=Gn(e,t,{formatText:e.format,properties:e.properties}),n})(e,r));if("isViewableInList"in e&&(d.isViewableInList=e.isViewableInList),o)if("string"==typeof o)try{d.uiSettings=JSON.parse(o)}catch(e){console.log(e),d.uiSettings=o}else d.uiSettings=o;else d.uiSettings=null;if(c===Pr.BIG_DECIMAL&&(d.precisionScale=e.precisionScale,d.roundingMode=e.roundingMode),c!==Pr.DATE&&c!==Pr.TIME&&c!==Pr.DATE_TIME||(d.format=e.format),c===Pr.STRING&&(d.restrictedValues=e.restrictedValues),c===Pr.ENTITY_REFERENCE){const{definitionCode:r,definitionVersion:n,labelPropertyCode:t,valuePropertyCode:l}=e;d.definitionCode=r,d.definitionVersion=n,d.labelPropertyCode=t,d.valuePropertyCode=l}return c===Pr.ARRAY&&(d.memberNodes=e.memberNodes?n(e.memberNodes):null),c===Pr.OBJECT&&(d.properties=function(e){if(!Array.isArray(e)||!e.length)return null;const r={};return e.forEach((e=>{r[e.key]=n(e)})),r}(e.properties)),d}};function Un(e,r){var n;return e&&e.nodeType===Pr.OBJECT&&e.properties&&(e.properties=(n=e.properties)?Array.isArray(n)?n:Object.keys(n).map((e=>{let t=Object.assign(Object.assign({key:e},n[e]),r||{});const l=Qn(t);return l===Pr.OBJECT&&(t=Un(t,r)),l===Pr.ARRAY&&t.memberNodes&&(t.memberNodes=Un(t.memberNodes,r),"defaultValues"in t&&(t.defaultValue=t.defaultValues),"values"in t&&(t.value=t.values)),t})).sort(((e,r)=>fn(e,r,"sortOrder"))):[]),e&&e.nodeType===Pr.ARRAY&&e.memberNodes&&(e.memberNodes=Un(e.memberNodes,r)),e}const Zn=(e,r)=>{if(r)try{const e=r.replace(/Z/g,"XXX");return he(new Date,e),e}catch(r){return console.error("Incorrect format",r),e}return e},Kn=e=>(Array.isArray(e.properties)?e:Un(e)).properties.reduce(((r,n)=>{const t=JSON.parse(JSON.stringify(r));return e.nodeType===Pr.OBJECT?t[e.key]=Kn(e):t[e.key]=e.nodeType,t}),{}),Xn=({nodeType:e,useExpression:r,required:n})=>{let t=[{value:"widget",label:"Fill array",sortOrder:1}];return n||t.push({value:"null",label:"NULL",sortOrder:0}),r&&(e===Pr.OBJECT||e===Pr.ANY?t.push({value:"expression",label:"Expression (JSON editor)",sortOrder:3}):t.push({value:"expression",label:"Expression",sortOrder:3})),e!==Pr.ANY&&e!==Pr.OBJECT&&e!==Pr.ARRAY||t.push({value:"json_valid",label:"JSON editor",sortOrder:2}),t=t.sort(((e,r)=>fn(e,r,"sortOrder"))),t},Qn=e=>{var r;return e?"string"==typeof e.nodeType?e.nodeType:null===(r=e.nodeType)||void 0===r?void 0:r.value:Pr.ANY},et=({nodeType:e,useExpression:r,required:n})=>{let t=[{value:"widget",label:"Widget",sortOrder:1}];switch(n||t.push({value:"null",label:"NULL",sortOrder:0}),r&&(e===Pr.OBJECT||e===Pr.ANY?t.push({value:"expression",label:"Expression (JSON editor)",sortOrder:3}):t.push({value:"expression",label:"Expression",sortOrder:3})),e){case Pr.STRING:t[0].label="Text input";break;case Pr.INTEGER:case Pr.BIG_INTEGER:case Pr.BIG_DECIMAL:case Pr.FLOAT:case Pr.LONG:case Pr.DOUBLE:case Pr.SHORT:t[0].label="Number input";break;case Pr.BOOLEAN:t[0].label="Switch";break;case Pr.ENTITY_REFERENCE:t[0].label="Entity reference field";break;case Pr.ARRAY:t[0].label="Array editor";break;case Pr.DATE:t[0].label="Date picker",t.push({value:"string",label:"Text input",sortOrder:2});break;case Pr.DATE_TIME:t[0].label="Date & Time picker",t.push({value:"string",label:"Text input",sortOrder:2});break;case Pr.TIME:t[0].label="Time picker",t.push({value:"string",label:"Text input",sortOrder:2});break;case Pr.ANY:t[0].label="JSON"}return t=t.sort(((e,r)=>fn(e,r,"sortOrder"))),t},rt={required:Hr,notValidNumber:"Not valid number",notValidInteger:"Not valid integer"},nt=e=>{var r,n,{control:t,validate:l,name:c="",label:u="",required:p=!1,defaultValue:m=null,disabled:g=!1,hideErrorMessage:h=!1,onChange:f,decimal:b=!1,valueAsNumber:v=!0,useFormattedInputValue:C=!1,errorText:O}=e,E=s(e,["control","validate","name","label","required","defaultValue","disabled","hideErrorMessage","onChange","decimal","valueAsNumber","useFormattedInputValue","errorText"]);const x=y((()=>O||rt),[O]),j=T({name:c,control:t,defaultValue:m,rules:{required:!!p&&x.required,validate:e=>l?"function"!=typeof l||l(e):0==+e||(null===e?!p||x.required:b&&!Ln.test(e)||/^-*0+$/.test(e)?x.notValidNumber:!(!b&&!kn.test(e))||x.notValidInteger)}}),V=j.field,{ref:R,onChange:N,value:w}=V,S=s(V,["ref","onChange","value"]),{fieldState:{error:k}}=j;return i(d,Object.assign({},S,{fullWidth:!0,size:"small",variant:"outlined",type:"text",inputRef:R,name:c,label:p?a(o,{children:[u," ",i("span",{children:"*"})]}):u,sx:{".MuiInputLabel-root span":{color:"#D6331F"}},error:!!k,helperText:!h&&(null==k?void 0:k.message),disabled:g,value:C?null!==(r=null==w?void 0:w.toLocaleString("ru-Ru",{maximumFractionDigits:10}).replace(",","."))&&void 0!==r?r:"":null!=w?w:"",onChange:e=>{let r=e.target.value.replace(/\s/g,"");const n=e.nativeEvent.data;if(!(b?/^-?\d*[.,]?\d*$/:/^-?\d*$/).test(r))return;if(!((r.match(/[.,]/g)||[]).length>1||r.lastIndexOf("-")>0))if(r=r.replace(/,/g,"."),!isNaN(n)||b&&"."===n||"-"===n||"+"===n||r)if(f)f(e);else if(v)if(r)if("0"===r)N(0);else if(b){const e=r.replace(",",".").split(".")[1],n=parseFloat(r.replace(",","."));N(!Ln.test(r.replace(",","."))||/^0+$/.test(e)||/^-*0+$/.test(r)||Number.isNaN(n)?r:n)}else N(Number.isNaN(+r.replace(",","."))?r:+r.replace(",","."));else N(null);else N(r);else N(r)},FormHelperTextProps:{variant:"standard"},InputLabelProps:{shrink:!!E.placeholder},inputProps:Object.assign({},null!==(n=null==E?void 0:E.inputProps)&&void 0!==n?n:{})},E))},tt=e=>{var{control:r,name:n,label:t,defaultValue:l}=e,a=s(e,["control","name","label","defaultValue"]);const o=T({control:r,name:n,defaultValue:l}).field,{ref:c,onChange:d,value:u}=o,p=s(o,["ref","onChange","value"]),m=y((()=>{if("boolean"==typeof u)return u;if("string"==typeof u){if("false"===u)return d(!1),!1;if("true"===u)return d(!0),!0}return!1}),[u,d]);h((()=>{null===u&&d(!1)}),[u,d]);return i(J,{label:t,name:n,control:i(me,Object.assign({},p,{color:"primary",size:"small",inputRef:c,onChange:e=>{const{checked:r}=e.target;d(r)},checked:m},a))})};var lt="data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M17.75 3C18.612 3 19.4386 3.34241 20.0481 3.9519C20.6576 4.5614 21 5.38805 21 6.25V17.75C21 18.612 20.6576 19.4386 20.0481 20.0481C19.4386 20.6576 18.612 21 17.75 21H6.25C5.38805 21 4.5614 20.6576 3.9519 20.0481C3.34241 19.4386 3 18.612 3 17.75V6.25C3 5.38805 3.34241 4.5614 3.9519 3.9519C4.5614 3.34241 5.38805 3 6.25 3H17.75ZM19.5 8.5H4.5V17.75C4.5 18.716 5.284 19.5 6.25 19.5H17.75C18.2141 19.5 18.6592 19.3156 18.9874 18.9874C19.3156 18.6592 19.5 18.2141 19.5 17.75V8.5ZM7.75 14.5C8.08152 14.5 8.39946 14.6317 8.63388 14.8661C8.8683 15.1005 9 15.4185 9 15.75C9 16.0815 8.8683 16.3995 8.63388 16.6339C8.39946 16.8683 8.08152 17 7.75 17C7.41848 17 7.10054 16.8683 6.86612 16.6339C6.6317 16.3995 6.5 16.0815 6.5 15.75C6.5 15.4185 6.6317 15.1005 6.86612 14.8661C7.10054 14.6317 7.41848 14.5 7.75 14.5ZM12 14.5C12.3315 14.5 12.6495 14.6317 12.8839 14.8661C13.1183 15.1005 13.25 15.4185 13.25 15.75C13.25 16.0815 13.1183 16.3995 12.8839 16.6339C12.6495 16.8683 12.3315 17 12 17C11.6685 17 11.3505 16.8683 11.1161 16.6339C10.8817 16.3995 10.75 16.0815 10.75 15.75C10.75 15.4185 10.8817 15.1005 11.1161 14.8661C11.3505 14.6317 11.6685 14.5 12 14.5ZM7.75 10.5C8.08152 10.5 8.39946 10.6317 8.63388 10.8661C8.8683 11.1005 9 11.4185 9 11.75C9 12.0815 8.8683 12.3995 8.63388 12.6339C8.39946 12.8683 8.08152 13 7.75 13C7.41848 13 7.10054 12.8683 6.86612 12.6339C6.6317 12.3995 6.5 12.0815 6.5 11.75C6.5 11.4185 6.6317 11.1005 6.86612 10.8661C7.10054 10.6317 7.41848 10.5 7.75 10.5ZM12 10.5C12.3315 10.5 12.6495 10.6317 12.8839 10.8661C13.1183 11.1005 13.25 11.4185 13.25 11.75C13.25 12.0815 13.1183 12.3995 12.8839 12.6339C12.6495 12.8683 12.3315 13 12 13C11.6685 13 11.3505 12.8683 11.1161 12.6339C10.8817 12.3995 10.75 12.0815 10.75 11.75C10.75 11.4185 10.8817 11.1005 11.1161 10.8661C11.3505 10.6317 11.6685 10.5 12 10.5ZM16.25 10.5C16.5815 10.5 16.8995 10.6317 17.1339 10.8661C17.3683 11.1005 17.5 11.4185 17.5 11.75C17.5 12.0815 17.3683 12.3995 17.1339 12.6339C16.8995 12.8683 16.5815 13 16.25 13C15.9185 13 15.6005 12.8683 15.3661 12.6339C15.1317 12.3995 15 12.0815 15 11.75C15 11.4185 15.1317 11.1005 15.3661 10.8661C15.6005 10.6317 15.9185 10.5 16.25 10.5ZM17.75 4.5H6.25C5.78587 4.5 5.34075 4.68437 5.01256 5.01256C4.68437 5.34075 4.5 5.78587 4.5 6.25V7H19.5V6.25C19.5 5.78587 19.3156 5.34075 18.9874 5.01256C18.6592 4.68437 18.2141 4.5 17.75 4.5Z' fill='%238B8C9E'/%3e%3c/svg%3e";const it=()=>i("img",{src:lt,alt:""}),at=e=>{var{control:r,name:n,required:t,label:l,placeholder:c,defaultValue:u,format:p=Mr,hideErrorMessage:m=!1,textFieldProps:g={},requiredErrorText:y="",validate:v,dateCondition:C,validateErrorText:O}=e,E=s(e,["control","name","required","label","placeholder","defaultValue","format","hideErrorMessage","textFieldProps","requiredErrorText","validate","dateCondition","validateErrorText"]);const[x,j]=f(Mr),{field:V,fieldState:{error:R}}=T({control:r,name:n,defaultValue:u,rules:{required:!!t&&(y||Hr),validate:v||(e=>{if(""!==e&&x&&e&&!ye(e,x))return null!=O?O:Jr;if(C&&e){const r=fe(e,x,new Date),n=new Date;switch(C){case"current":return!!Oe(r)||"Только сегодняшний день";case"gt":return!Oe(r)&&!xe(r,n)||"Только будущие даты";case"lt":return!Oe(r)&&!Ee(r,n)||"Только прошлые даты";case"gte":return!(!Oe(r)&&xe(r,n))||"Только текущая или будущие даты";case"lte":return!(!Oe(r)&&Ee(r,n))||"Только текущая или прошлые даты";default:return!0}}return!0})}}),N=b((e=>{V.onChange(be(e)?he(e,x):e)}),[V,x]);return h((()=>{if(p){const e=p.replace(/[Zzx]+/g,"XX");try{ye(he(new Date,e),e),j(e)}catch(e){console.error(e)}}}),[p]),a(o,{children:[i(Z,Object.assign({required:t},{children:l})),i(ge,Object.assign({},V,x?{inputFormat:x}:{},{value:x?fe(V.value,x,new Date):V.value,onChange:N,disableFuture:"lte"===C||"current"===C,disablePast:"gte"===C||"current"===C,maxDate:"lt"===C?ve():null,minDate:"gt"===C?Ce():null,components:{OpenPickerIcon:it}},E,{renderInput:e=>i(d,Object.assign({},e,{fullWidth:!0,size:"small",variant:"outlined",name:n,error:!!R,helperText:!m&&(null==R?void 0:R.message),FormHelperTextProps:{variant:"standard"},inputProps:Object.assign(Object.assign({},e.inputProps),{placeholder:c})},g))}))]})},ot=()=>i("img",{src:lt,alt:""}),st=e=>{var{control:r,name:n,required:t,label:l,placeholder:c,defaultValue:u,format:p=Fr,hideErrorMessage:m=!1,textFieldProps:g,requiredErrorText:y="",validate:v,dateCondition:C,validateErrorText:O}=e,E=s(e,["control","name","required","label","placeholder","defaultValue","format","hideErrorMessage","textFieldProps","requiredErrorText","validate","dateCondition","validateErrorText"]);const[x,j]=f(),{field:V,fieldState:{error:R}}=T({control:r,name:n,defaultValue:u,rules:{required:!!t&&(y||Hr),validate:v||(e=>{if(""!==e&&x&&e&&!ye(e,x))return null!=O?O:Jr;if(C&&e){const r=fe(e,x,new Date),n=new Date;switch(C){case"current":return!!Oe(r)||"Только сегодняшний день";case"gt":return!Oe(r)&&!xe(r,n)||"Только будущие даты";case"lt":return!Oe(r)&&!Ee(r,n)||"Только прошлые даты";case"gte":return!(!Oe(r)&&xe(r,n))||"Только текущая или будущие даты";case"lte":return!(!Oe(r)&&Ee(r,n))||"Только текущая или прошлые даты";default:return!0}}return!0})}}),N=b((e=>{V.onChange(be(e)?he(e,x):e)}),[V,x]);return h((()=>{const e=p.replace(/[Zzx]+/g,"XX");try{ye(he(new Date,e),e),j(e)}catch(e){console.error(e)}}),[p]),i(je,Object.assign({},V,{ampm:!1,label:t?a(o,{children:[l," ",i("span",{children:"*"})]}):l,value:x?fe(V.value,x,new Date):V.value},x?{inputFormat:x}:{},{onChange:N,disableFuture:"lte"===C||"current"===C,disablePast:"gte"===C||"current"===C,maxDate:"lt"===C?ve():null,minDate:"gt"===C?Ce():null,components:{OpenPickerIcon:ot}},E,{renderInput:e=>i(d,Object.assign({},e,{fullWidth:!0,size:"small",sx:{".MuiInputLabel-root span":{color:"#D6331F"}},inputProps:Object.assign(Object.assign({},e.inputProps),{placeholder:c}),variant:"outlined",name:n,error:!!R,helperText:!m&&(null==R?void 0:R.message),FormHelperTextProps:{variant:"standard"}},g))}))},ct=e=>{var{control:r,name:n,required:t,label:l,textFieldProps:c={},format:u=Dr,hideErrorMessage:p=!1,requiredErrorText:m="",placeholder:g,defaultValue:b}=e,y=s(e,["control","name","required","label","textFieldProps","format","hideErrorMessage","requiredErrorText","placeholder","defaultValue"]);const v=T({control:r,name:n,defaultValue:b,rules:{required:!!t&&(m||Hr),validate:e=>!!ye(e,u)||"Incorrect date format"}}),C=v.field,{onChange:O,ref:E,value:x}=C,j=s(C,["onChange","ref","value"]),{fieldState:{error:V}}=v,[R,N]=f(null);return h((()=>{if(x&&u){let e=fe(x,u,new Date);be(e)||(e=fe(x,"HH:mm:ss.SSS",new Date)),N(e)}}),[x,u]),i(Ve,Object.assign({},j,{mask:"",inputRef:E,label:t?a(o,{children:[l," ",i("span",{children:"*"})]}):l,ampm:!1,value:R,inputFormat:u,onChange:e=>{N(e),O(be(e)?he(e,u):e)}},y,{renderInput:e=>i(d,Object.assign({},e,{fullWidth:!0,size:"small",sx:{".MuiInputLabel-root span":{color:"#D6331F"}},inputProps:Object.assign(Object.assign({},e.inputProps),{placeholder:g}),variant:"outlined",name:n,error:!!V,helperText:!p&&(null==V?void 0:V.message),FormHelperTextProps:{variant:"standard"}}))}))},dt=e=>{var r,n,t,{name:l,control:c,label:u,required:p,defaultValue:m=null,onChange:g,textFieldLabel:h}=e,v=s(e,["name","control","label","required","defaultValue","onChange","textFieldLabel"]);const[C,O]=f(""),[E,x]=f(null),j=T({control:c,name:l,defaultValue:m,rules:{required:p&&Hr}}),V=j.field,{onChange:R,value:N}=V,w=s(V,["onChange","value"]),{formState:{errors:S}}=j,k=y((()=>g||R),[g,R]),A=b((e=>{const{value:r}=e.target;O(r)}),[]),M=b((()=>{x(null),!C||Array.isArray(N)&&N.includes(C)?Array.isArray(N)&&N.includes(C)&&x("This value already exists"):(k([...null!=N?N:[],C]),O(""))}),[C,k,N]),D=b((e=>{k(N.filter((r=>r!==e)))}),[N,k]),F=b((e=>{"Enter"!==e.key&&13!==e.keyCode||(e.stopPropagation(),e.preventDefault(),M())}),[M]);return a(o,{children:[i(Z,Object.assign({required:p},{children:u})),i(B,Object.assign({display:"flex",flexWrap:"wrap"},{children:null==N?void 0:N.map(((e,r)=>i(Te,{sx:{mr:1,mb:1},variant:"outlined",label:e,onDelete:()=>D(e)},r)))})),i("input",Object.assign({type:"hidden"},c.register(l),{onChange:k,value:N},w)),i(d,Object.assign({fullWidth:!0,variant:"outlined",size:"small",label:h||""===h?h:`Add ${null!=u?u:""}`,value:C,onChange:A,error:!!(null===(r=S[l])||void 0===r?void 0:r.message),helperText:null===(n=S[l])||void 0===n?void 0:n.message,FormHelperTextProps:{variant:"standard"},name:l,onKeyDown:F,InputProps:{endAdornment:i(I,Object.assign({size:"small",onClick:M},{children:i(L,{children:i("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"})})}))},inputProps:Object.assign({},null!==(t=null==v?void 0:v.inputProps)&&void 0!==t?t:{})},v)),E&&i(G,Object.assign({error:!0},{children:E}))]})},ut=({name:e="period",control:r,label:n="Period",required:t,isSecondsVisible:l=!1})=>{var s;const[c,u]=f(),{setValue:p,register:m,formState:{errors:g}}=N(),y=R({control:r,name:e}),v=b((r=>{const{name:n,value:t}=r.target,l=Object.assign({},null!=c?c:{});t?(l[n]=+t,p(e,Ne(l),{shouldValidate:!0})):(delete l[n],p(e,"",{shouldValidate:!0})),u(l)}),[p,e,c]),C=null===(s=g[e])||void 0===s?void 0:s.message;return h((()=>{y&&!c&&u(we(y))}),[c,y]),a(o,{children:[i("input",Object.assign({type:"hidden"},m(e,{required:t&&"Please, fill one of the fields"}))),i(z,Object.assign({variant:"subtitle1"},{children:t?a(o,{children:[n," ",i(B,Object.assign({component:"span",color:"#D6331F"},{children:"*"}))]}):n})),C&&i(G,Object.assign({error:!0},{children:C})),a(Re,Object.assign({container:!0,columns:2,spacing:2,flexWrap:"wrap"},{children:[i(Re,Object.assign({sm:1},{children:i(d,{variant:"outlined",size:"small",value:(null==c?void 0:c.years)||"",error:!!C,name:"years",label:"Years",type:"number",onChange:v,fullWidth:!0,FormHelperTextProps:{variant:"standard"}})})),i(Re,Object.assign({sm:1},{children:i(d,{variant:"outlined",size:"small",error:!!C,value:(null==c?void 0:c.months)||"",name:"months",label:"Months",type:"number",onChange:v,fullWidth:!0,FormHelperTextProps:{variant:"standard"}})})),i(Re,Object.assign({sm:1},{children:i(d,{variant:"outlined",size:"small",error:!!C,value:(null==c?void 0:c.weeks)||"",name:"weeks",label:"Weeks",type:"number",onChange:v,fullWidth:!0,FormHelperTextProps:{variant:"standard"}})})),i(Re,Object.assign({sm:1},{children:i(d,{variant:"outlined",size:"small",error:!!C,value:(null==c?void 0:c.days)||"",name:"days",label:"Days",type:"number",onChange:v,fullWidth:!0,FormHelperTextProps:{variant:"standard"}})})),i(Re,Object.assign({sm:1},{children:i(d,{variant:"outlined",size:"small",error:!!C,value:(null==c?void 0:c.hours)||"",name:"hours",label:"Hours",type:"number",onChange:v,fullWidth:!0,FormHelperTextProps:{variant:"standard"}})})),i(Re,Object.assign({sm:1},{children:i(d,{variant:"outlined",size:"small",error:!!C,value:(null==c?void 0:c.minutes)||"",name:"minutes",label:"Minutes",type:"number",onChange:v,fullWidth:!0,FormHelperTextProps:{variant:"standard"}})})),l&&i(Re,Object.assign({sm:1},{children:i(d,{variant:"outlined",size:"small",error:!!C,value:(null==c?void 0:c.seconds)||"",name:"seconds",label:"Seconds",type:"number",onChange:v,fullWidth:!0,FormHelperTextProps:{variant:"standard"}})}))]}))]})};const pt=e=>{var{control:r,name:n,label:t,required:l,mask:c="+7 (799) 999 99 99",requiredErrorText:u="",inputMaskProps:p,disabled:m,validate:g,invalidErrorText:h}=e,f=s(e,["control","name","label","required","mask","requiredErrorText","inputMaskProps","disabled","validate","invalidErrorText"]);return i(w,{control:r,name:n,rules:{required:!!l&&(u||Hr),validate:e=>!l&&!e||(/(\+7\s\(\d{3}\)\s)(\d{3}\s\d{2})(\s\d{2})/.test(e)?!g||("function"!=typeof g||g(e)):h||"Incorrect phone number format")},render:({field:e,fieldState:{error:r}})=>i(Se,Object.assign({disabled:m,mask:c,value:e.value,onChange:e.onChange,onBlur:e.onBlur},p,{children:i(d,Object.assign({fullWidth:!0,size:"small",label:l&&t?a(o,{children:[t," ",i("span",{children:"*"})]}):t,sx:{".MuiInputLabel-root span":{color:"#D6331F"}},inputMode:"numeric",InputProps:{startAdornment:i(A,Object.assign({position:"start"},{children:i("img",{src:"data:image/svg+xml,%3csvg width='32' height='24' viewBox='0 0 32 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg clip-path='url(%23clip0_6762_5474)'%3e%3crect width='32' height='24' rx='2' fill='white'/%3e%3cmask id='mask0_6762_5474' style='mask-type:luminance' maskUnits='userSpaceOnUse' x='0' y='0' width='32' height='24'%3e%3crect width='32' height='24' rx='2' fill='white'/%3e%3c/mask%3e%3cg mask='url(%23mask0_6762_5474)'%3e%3crect width='32' height='24' fill='%2330C6E0'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M16.0001 16.8002C18.5249 16.8002 20.5716 14.6512 20.5716 12.0002C20.5716 9.34923 18.5249 7.2002 16.0001 7.2002C13.4754 7.2002 11.4287 9.34923 11.4287 12.0002C11.4287 14.6512 13.4754 16.8002 16.0001 16.8002Z' fill='%23FFCD4B'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M14.1352 20.5791L16.0001 17.6561L17.865 20.5791L18.3374 17.096L21.2255 18.8799L20.2118 15.5264L23.5511 15.818L21.252 13.2584L24.381 11.9998L21.252 10.7411L23.5511 8.1816L20.2118 8.47311L21.2255 5.11966L18.3374 6.90359L17.865 3.42041L16.0001 6.34344L14.1352 3.42041L13.6628 6.90359L10.7747 5.11966L11.7884 8.47311L8.44912 8.1816L10.7482 10.7411L7.61914 11.9998L10.7482 13.2584L8.44912 15.818L11.7884 15.5264L10.7747 18.8799L13.6628 17.096L14.1352 20.5791ZM21.3334 11.9998C21.3334 15.0926 18.9456 17.5998 16.0001 17.5998C13.0546 17.5998 10.6668 15.0926 10.6668 11.9998C10.6668 8.90698 13.0546 6.39978 16.0001 6.39978C18.9456 6.39978 21.3334 8.90698 21.3334 11.9998Z' fill='%23FFCD4B'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M1.52393 1.93343C1.52393 1.74934 1.67316 1.6001 1.85726 1.6001H2.7144C2.8985 1.6001 3.04774 1.74934 3.04774 1.93343V2.86676C3.04774 3.05086 2.8985 3.2001 2.7144 3.2001H1.85726C1.67316 3.2001 1.52393 3.05086 1.52393 2.86676V1.93343ZM1.52393 5.13343C1.52393 4.94934 1.67316 4.8001 1.85726 4.8001H2.7144C2.8985 4.8001 3.04774 4.94934 3.04774 5.13343V6.06676C3.04774 6.25086 2.8985 6.4001 2.7144 6.4001H1.85726C1.67316 6.4001 1.52393 6.25086 1.52393 6.06676V5.13343ZM1.85726 8.0001C1.67316 8.0001 1.52393 8.14934 1.52393 8.33343V9.26676C1.52393 9.45086 1.67316 9.6001 1.85726 9.6001H2.7144C2.8985 9.6001 3.04774 9.45086 3.04774 9.26676V8.33343C3.04774 8.14934 2.8985 8.0001 2.7144 8.0001H1.85726ZM1.52393 11.5334C1.52393 11.3493 1.67316 11.2001 1.85726 11.2001H2.7144C2.8985 11.2001 3.04774 11.3493 3.04774 11.5334V12.4668C3.04774 12.6509 2.8985 12.8001 2.7144 12.8001H1.85726C1.67316 12.8001 1.52393 12.6509 1.52393 12.4668V11.5334ZM1.85726 14.4001C1.67316 14.4001 1.52393 14.5493 1.52393 14.7334V15.6668C1.52393 15.8509 1.67316 16.0001 1.85726 16.0001H2.7144C2.8985 16.0001 3.04774 15.8509 3.04774 15.6668V14.7334C3.04774 14.5493 2.8985 14.4001 2.7144 14.4001H1.85726ZM1.52393 17.9334C1.52393 17.7493 1.67316 17.6001 1.85726 17.6001H2.7144C2.8985 17.6001 3.04774 17.7493 3.04774 17.9334V18.8668C3.04774 19.0509 2.8985 19.2001 2.7144 19.2001H1.85726C1.67316 19.2001 1.52393 19.0509 1.52393 18.8668V17.9334ZM1.85726 20.8001C1.67316 20.8001 1.52393 20.9493 1.52393 21.1334V22.0668C1.52393 22.2509 1.67316 22.4001 1.85726 22.4001H2.7144C2.8985 22.4001 3.04774 22.2509 3.04774 22.0668V21.1334C3.04774 20.9493 2.8985 20.8001 2.7144 20.8001H1.85726ZM3.04774 19.5334C3.04774 19.3493 3.19697 19.2001 3.38107 19.2001H4.23821C4.42231 19.2001 4.57154 19.3493 4.57154 19.5334V20.4668C4.57154 20.6509 4.42231 20.8001 4.23821 20.8001H3.38107C3.19697 20.8001 3.04774 20.6509 3.04774 20.4668V19.5334ZM3.38107 16.0001C3.19697 16.0001 3.04774 16.1493 3.04774 16.3334V17.2668C3.04774 17.4509 3.19697 17.6001 3.38107 17.6001H4.23821C4.42231 17.6001 4.57154 17.4509 4.57154 17.2668V16.3334C4.57154 16.1493 4.42231 16.0001 4.23821 16.0001H3.38107ZM3.04774 13.1334C3.04774 12.9493 3.19697 12.8001 3.38107 12.8001H4.23821C4.42231 12.8001 4.57154 12.9493 4.57154 13.1334V14.0668C4.57154 14.2509 4.42231 14.4001 4.23821 14.4001H3.38107C3.19697 14.4001 3.04774 14.2509 3.04774 14.0668V13.1334ZM3.38107 9.6001C3.19697 9.6001 3.04774 9.74934 3.04774 9.93343V10.8668C3.04774 11.0509 3.19697 11.2001 3.38107 11.2001H4.23821C4.42231 11.2001 4.57154 11.0509 4.57154 10.8668V9.93343C4.57154 9.74934 4.42231 9.6001 4.23821 9.6001H3.38107ZM3.04774 6.73343C3.04774 6.54934 3.19697 6.4001 3.38107 6.4001H4.23821C4.42231 6.4001 4.57154 6.54934 4.57154 6.73343V7.66676C4.57154 7.85086 4.42231 8.0001 4.23821 8.0001H3.38107C3.19697 8.0001 3.04774 7.85086 3.04774 7.66676V6.73343ZM3.38107 3.2001C3.19697 3.2001 3.04774 3.34934 3.04774 3.53343V4.46676C3.04774 4.65086 3.19697 4.8001 3.38107 4.8001H4.23821C4.42231 4.8001 4.57154 4.65086 4.57154 4.46676V3.53343C4.57154 3.34934 4.42231 3.2001 4.23821 3.2001H3.38107Z' fill='%23FFCD4B'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath id='clip0_6762_5474'%3e%3crect width='32' height='24' rx='4' fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",alt:""})}))}},f,{error:!!r,FormHelperTextProps:{variant:"standard"},helperText:null==r?void 0:r.message}))}))})};var mt="data:image/svg+xml,%3csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M5.99995 8L9.99995 12L14 8H5.99995Z' fill='%236D7C8B'/%3e%3c/svg%3e";const gt=()=>i("img",{src:mt,alt:""});var ht=()=>{const e=Ie(),r=Ae(e,Me),n=Ae(e,De),t=Ae(e,Fe),l=Ae(e,Pe),o=r=>e.current.setPage(r);return a(B,Object.assign({px:2,display:"flex",alignItems:"center"},{children:[i(Le,{component:"div",page:r,count:t,rowsPerPage:l,rowsPerPageOptions:[10,20,50,100],onPageChange:(e,r)=>o(r),onRowsPerPageChange:r=>e.current.setPageSize(parseInt(r.target.value,10)),labelRowsPerPage:"Строк на странице",labelDisplayedRows:({from:e,to:r,count:n})=>`${e}–${r} из ${-1!==n?n:`более ${r}`}`,ActionsComponent:void 0,SelectProps:{IconComponent:gt}}),i(ke,{count:n,page:r+1,onChange:(e,r)=>o(r-1)})]}))};var ft=e=>{var{hideMenu:r,currentColumn:n,onUnsort:t}=e,l=s(e,["hideMenu","currentColumn","onUnsort"]);return i(qe,Object.assign({hideMenu:r,currentColumn:n},l,{children:i($e,{onClick:r,column:n})}))};var bt=({mode:e,pagination:r})=>{const[n,t]=se(),l=+n.get("page")||0,i=+n.get("size")||10;return h((()=>{"server"===e&&r&&(n.has("page")||n.set("page","0"),n.has("size")||n.set("size","10"),t(n,{replace:!0}))}),[e,r,n,t]),{page:l,size:i,onPageChange:e=>{n.set("page",`${e}`),t(n,{replace:!0})},onSizeChange:e=>{n.set("size",`${e}`),t(n,{replace:!0})}}};var yt=()=>{const[e,r]=se(),n=e.getAll("sort").map((e=>e.split(",")));return{onColumnHeaderClick:({field:n,colDef:t})=>{if(t.sortable){let t=!1;const l=e.getAll("sort");e.delete("sort"),l.forEach((r=>{const[l,i]=r.split(",");l===n?(t=!0,"asc"===i&&e.append("sort",`${l},desc`)):e.append("sort",`${l},${i}`)})),t||e.append("sort",`${n},asc`),r(e,{replace:!0})}},getSortedColumns:e=>e.map((e=>{const r=n.find((r=>r[0]===e.field));return e.headerClassName=r?`Sorted --${r[1]} `:"",e}))}};var vt=e=>{const[r,n]=f(10);h((()=>{n(e)}),[e]);return{pageSize:r,handlePageSizeChange:e=>n(e)}},Ct="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M3.47341 10.4087C3.3698 10.2747 3.32108 10.1063 3.33715 9.9377C3.35321 9.76909 3.43285 9.61291 3.55989 9.50088C3.68693 9.38886 3.85185 9.3294 4.02115 9.33457C4.19045 9.33974 4.35144 9.40915 4.47141 9.52872L8.00008 13.0574L11.5287 9.52872L11.5914 9.47338C11.7254 9.36978 11.8938 9.32106 12.0624 9.33712C12.231 9.35318 12.3872 9.43282 12.4992 9.55987C12.6113 9.68691 12.6707 9.85183 12.6656 10.0211C12.6604 10.1904 12.591 10.3514 12.4714 10.4714L8.47141 14.4714L8.40874 14.5267C8.28047 14.6262 8.12031 14.6755 7.95829 14.6653C7.79627 14.6551 7.64354 14.5862 7.52874 14.4714L3.52874 10.4714L3.47341 10.4087ZM12.5267 5.59138C12.6304 5.72538 12.6791 5.89379 12.663 6.0624C12.6469 6.23102 12.5673 6.3872 12.4403 6.49922C12.3132 6.61124 12.1483 6.67071 11.979 6.66554C11.8097 6.66037 11.6487 6.59095 11.5287 6.47138L8.00008 2.94272L4.47141 6.47138L4.40874 6.52672C4.27475 6.63032 4.10634 6.67905 3.93773 6.66298C3.76911 6.64692 3.61293 6.56728 3.50091 6.44024C3.38889 6.31319 3.32942 6.14827 3.33459 5.97897C3.33976 5.80967 3.40918 5.64869 3.52874 5.52872L7.52874 1.52872L7.59141 1.47338C7.71968 1.37388 7.87985 1.3246 8.04187 1.33479C8.20388 1.34498 8.35662 1.41393 8.47141 1.52872L12.4714 5.52872L12.5267 5.59138Z' fill='%23262842'/%3e%3c/svg%3e",Ot="data:image/svg+xml,%3c%3fxml version='1.0' encoding='utf-8'%3f%3e%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e %3cg transform='matrix(1%2c 0%2c 0%2c 1%2c 0.05728%2c 0.935561)'%3e %3cpath d='M 3.473 9.409 C 3.37 9.275 3.321 9.106 3.337 8.938 C 3.353 8.769 3.433 8.613 3.56 8.501 C 3.687 8.389 3.852 8.329 4.021 8.335 C 4.19 8.34 4.351 8.409 4.471 8.529 L 8 12.057 L 11.529 8.529 L 11.591 8.473 C 11.725 8.37 11.894 8.321 12.062 8.337 C 12.231 8.353 12.387 8.433 12.499 8.56 C 12.611 8.687 12.671 8.852 12.666 9.021 C 12.66 9.19 12.591 9.351 12.471 9.471 L 8.471 13.471 L 8.409 13.527 C 8.28 13.626 8.12 13.676 7.958 13.665 C 7.796 13.655 7.644 13.586 7.529 13.471 L 3.529 9.471 L 3.473 9.409 Z' fill='%23262842' style='fill-opacity: 0.6%3b'/%3e %3cpath d='M 12.472 4.636 C 12.575 4.77 12.624 4.939 12.608 5.107 C 12.592 5.276 12.512 5.432 12.385 5.544 C 12.258 5.656 12.093 5.716 11.924 5.71 C 11.755 5.705 11.594 5.636 11.474 5.516 L 7.945 1.988 L 4.416 5.516 L 4.354 5.572 C 4.22 5.675 4.051 5.724 3.883 5.708 C 3.714 5.692 3.558 5.612 3.446 5.485 C 3.334 5.358 3.274 5.193 3.28 5.024 C 3.285 4.855 3.354 4.694 3.474 4.574 L 7.474 0.574 L 7.536 0.518 C 7.665 0.419 7.825 0.37 7.987 0.38 C 8.149 0.39 8.302 0.459 8.416 0.574 L 12.416 4.574 L 12.472 4.636 Z' fill='%23262842' style='fill-opacity: 1%3b'/%3e %3c/g%3e%3c/svg%3e",Et="data:image/svg+xml,%3c%3fxml version='1.0' encoding='utf-8'%3f%3e%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e %3cg transform='matrix(1%2c 0%2c 0%2c 1%2c 0.05728%2c 0.935561)'%3e %3cpath d='M 3.473 9.409 C 3.37 9.275 3.321 9.106 3.337 8.938 C 3.353 8.769 3.433 8.613 3.56 8.501 C 3.687 8.389 3.852 8.329 4.021 8.335 C 4.19 8.34 4.351 8.409 4.471 8.529 L 8 12.057 L 11.529 8.529 L 11.591 8.473 C 11.725 8.37 11.894 8.321 12.062 8.337 C 12.231 8.353 12.387 8.433 12.499 8.56 C 12.611 8.687 12.671 8.852 12.666 9.021 C 12.66 9.19 12.591 9.351 12.471 9.471 L 8.471 13.471 L 8.409 13.527 C 8.28 13.626 8.12 13.676 7.958 13.665 C 7.796 13.655 7.644 13.586 7.529 13.471 L 3.529 9.471 L 3.473 9.409 Z' fill='%23262842' style='fill-opacity: 1%3b'/%3e %3cpath d='M 12.472 4.636 C 12.575 4.77 12.624 4.939 12.608 5.107 C 12.592 5.276 12.512 5.432 12.385 5.544 C 12.258 5.656 12.093 5.716 11.924 5.71 C 11.755 5.705 11.594 5.636 11.474 5.516 L 7.945 1.988 L 4.416 5.516 L 4.354 5.572 C 4.22 5.675 4.051 5.724 3.883 5.708 C 3.714 5.692 3.558 5.612 3.446 5.485 C 3.334 5.358 3.274 5.193 3.28 5.024 C 3.285 4.855 3.354 4.694 3.474 4.574 L 7.474 0.574 L 7.536 0.518 C 7.665 0.419 7.825 0.37 7.987 0.38 C 8.149 0.39 8.302 0.459 8.416 0.574 L 12.416 4.574 L 12.472 4.636 Z' fill='%23262842' style='fill-opacity: 0.6%3b'/%3e %3c/g%3e%3c/svg%3e";const xt=()=>i("img",{src:Ct,alt:""}),jt=()=>i("img",{src:Ot,alt:""}),Vt=()=>i("img",{src:Et,alt:""}),Tt=t(Be)((({theme:e})=>({"& .MuiDataGrid-row":{cursor:"pointer"},"& .MuiDataGrid-cell:focus-within, & .MuiDataGrid-cell:focus":{outline:"none !important"},"& .MuiDataGrid-columnHeader:focus-within, & .MuiDataGrid-columnHeader:focus":{outline:"none !important"},"& .MuiDataGrid-columnHeader--sortable":{"& .MuiDataGrid-iconButtonContainer":{visibility:"visible !important",width:"auto !important"},"& .MuiDataGrid-sortIcon":{visibility:"visible !important",opacity:1}}}))),Rt=e=>{var{columns:r,rows:n,rowCount:t,loading:l,disableMargin:a,mode:o="server",initialPageSize:c=10,pagination:d=!0,onCellClick:u}=e,p=s(e,["columns","rows","rowCount","loading","disableMargin","mode","initialPageSize","pagination","onCellClick"]);const{page:m,size:g,onPageChange:h,onSizeChange:f}=bt({mode:o,pagination:d}),{onColumnHeaderClick:b,getSortedColumns:y}=yt(),{pageSize:v,handlePageSizeChange:C}=vt(c),O={sortingMode:o,paginationMode:o,pageSize:"server"===o?g:d?v:t,onPageSizeChange:"server"===o?f:C,components:{BaseTooltip:le,Pagination:ht,ColumnUnsortedIcon:e=>(s(e,["sortingOrder"]),i(xt,{})),ColumnSortedDescendingIcon:e=>(s(e,["sortingOrder"]),i(Vt,{})),ColumnSortedAscendingIcon:e=>(s(e,["sortingOrder"]),i(jt,{}))}};return"server"===o&&(O.onColumnHeaderClick=b,O.page=m,O.onPageChange=h,O.components.ColumnMenu=ft),i(B,Object.assign({mt:a?0:2},{children:i(Tt,Object.assign({autoHeight:!0,hideFooterPagination:!d,hideFooter:!d,disableSelectionOnClick:!0,loading:l,rows:n,disableColumnMenu:!0,columns:y(r),rowCount:t,rowsPerPageOptions:[10,20,50,100],onCellClick:u},O,p))}))},Nt=({icon:e,label:r,showInMenu:n,onClick:t,location:l})=>{var a;return l?i(I,Object.assign({component:oe,to:l.pathname,state:null!==(a=l.state)&&void 0!==a?a:null,size:"small"},{children:i(le,Object.assign({title:r,arrow:!0},{children:m.cloneElement(e,{fontSize:"small"})}))})):i(ze,{nonce:"",onResize:void 0,onResizeCapture:void 0,icon:i(le,Object.assign({title:r,arrow:!0},{children:e})),onClick:t,label:r,showInMenu:n})};var wt=e=>{const[r,n]=se(),t=y((()=>{var e;return null!==(e=r.get("page"))&&void 0!==e?e:0}),[r]),l=y((()=>{var e;return null!==(e=r.get("size"))&&void 0!==e?e:10}),[r]),i=b((e=>{n((r=>(r.set("page",`${e}`),r)))}),[n]),a=b((e=>{n((r=>(r.set("size",`${e}`),r)))}),[n]);return h((()=>{e&&(r.has("page")||n((e=>(e.set("page","0"),e))),r.has("size")||n((e=>(e.set("size","10"),e))))}),[r,n,e]),{page:t,size:l,onPageChange:i,onSizeChange:a}};var St=()=>{const[e,r]=se(),n=y((()=>e.getAll("sort").map((e=>e.split(",")))),[e]),t=b((e=>{r((r=>{r.delete("sort");let t=!1;return n.forEach((([n,l])=>{n===e?(t=!0,"asc"===l&&r.append("sort",`${n},desc`)):r.append("sort",`${n},${l}`)})),t||r.append("sort",`${e},asc`),r}))}),[n,r]),l=b((e=>{const r=n.find((([r,n])=>r===e));return!!r&&r[1]}),[n]);return{sortParams:n,onSortChanged:t,getColumnSorting:l}};const kt=t(Ke)((({active:e})=>({".MuiSvgIcon-root":{opacity:e?1:.5,marginTop:"4%"}}))),Lt=()=>i("img",{src:mt,alt:""}),It=()=>i("img",{src:Ct,alt:""}),At=()=>i("img",{src:Ot,alt:""}),Mt=()=>i("img",{src:Et,alt:""});function Dt({columns:e=[],rows:r=[],totalCount:n,children:t,pagination:l=!0,loading:o=!1,onRowClick:s,emptyDataText:c,verticalAlign:d="middle",labelRowsPerPage:u},p){const{page:m,size:g,onPageChange:h,onSizeChange:f}=wt(l),{onSortChanged:b,getColumnSorting:y}=St();return i(B,Object.assign({sx:{overflow:"auto"}},{children:a(Ge,Object.assign({sx:{width:"100%",display:"table",tableLayout:"fixed"}},{children:[i(Ze,Object.assign({open:o,sx:{position:"absolute",top:0,left:0}},{children:i($r,{})})),a(_e,Object.assign({ref:p},{children:[i(Ye,{children:i(We,{children:e.map(((e,r)=>{const n=!!e.sortKey&&y(e.sortKey);return i(Je,Object.assign({align:e.align?e.align:"left",sortDirection:n,sx:{width:e.width?`${e.width}%`:"unset"}},{children:i(kt,Object.assign({active:!!n,hideSortIcon:!e.sortKey,direction:n||"asc",IconComponent:"asc"===n?At:"desc"===n?Mt:It,onClick:()=>e.sortKey?b(e.sortKey):{}},{children:e.label}))}),r)}))})}),i(He,{children:r.length?r.map(((r,n)=>i(We,Object.assign({hover:!0,onClick:s?()=>s(r):r.onClick,sx:{verticalAlign:d}},{children:e.map(((e,t)=>i(Je,Object.assign({align:e.align?e.align:"left",sx:{maxWidth:e.width?`${e.width}%`:"unset"}},{children:i(B,Object.assign({sx:{maxWidth:"90%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",padding:({spacing:e})=>e(2.4,0)}},{children:i(B,{children:e.renderCell?e.renderCell(r,n):r[e.id]})}))}),t)))}),n))):i(We,Object.assign({sx:{verticalAlign:d}},{children:i(Je,Object.assign({align:"center",colSpan:e.length},{children:null!=c?c:"Нет данных"}))}))}),l||t?i(Ue,{children:a(We,{children:[t&&i(Je,Object.assign({colSpan:e.length,sx:{background:"#F0F0F7",px:4,py:3}},{children:t})),l&&r.length?i(Le,{rowsPerPageOptions:[5,10,25],count:n,rowsPerPage:+g,page:+m,sx:{borderBottom:"none"},labelRowsPerPage:u,labelDisplayedRows:u?({from:e,to:r,count:n})=>`${e}–${r} из ${-1!==n?n:`более ${r}`}`:void 0,SelectProps:{IconComponent:Lt},onPageChange:(e,r)=>h(r),onRowsPerPageChange:e=>f(+e.target.value)}):null]})}):null]}))]}))}))}const Ft=C(Dt),Pt=({actionsList:e})=>{const[r,n]=f(null),t=Boolean(r),l=()=>{n(null)};return a("div",{children:[i(I,Object.assign({"aria-label":"more",id:"more-button","aria-controls":t?"more-menu":void 0,"aria-expanded":t?"true":void 0,"aria-haspopup":"true",onClick:e=>{e.stopPropagation(),n(e.currentTarget)}},{children:i(Qe,{})})),i(Xe,Object.assign({id:"more-menu",MenuListProps:{"aria-labelledby":"more-button"},anchorEl:r,open:t,onClose:e=>{e.stopPropagation(),l()},PaperProps:{style:{minWidth:"127px"}}},{children:e.map((e=>i(u,Object.assign({onClick:r=>{r.stopPropagation(),e.onClick&&e.onClick(),l()}},{children:e.title}),e.title)))}))]})},qt=e=>{const{children:r,value:n,index:t}=e,l=s(e,["children","value","index"]);return i("div",Object.assign({role:"tabpanel",hidden:n!==t,id:`simple-tabpanel-${t}`,"aria-labelledby":`simple-tab-${t}`},l,{children:n===t?r:null}))},$t=e=>{var r;const{tabs:n}=e,t=ie(),l=ae(),o=y((()=>new URLSearchParams(l.search)),[l.search]),s=o.get("tab");return a(B,{children:[i(er,{children:i(nr,Object.assign({value:s||(null===(r=n[0])||void 0===r?void 0:r.name),indicatorColor:"primary",textColor:"primary",onChange:(e,r)=>{o.set("tab",r),t({pathname:l.pathname,search:o.toString()},{replace:!0})}},{children:n.map((e=>i(rr,{value:e.name,label:e.label},e.name)))}))}),i(B,Object.assign({mt:2},{children:n.map((e=>{var r;return i(qt,Object.assign({value:s||(null===(r=n[0])||void 0===r?void 0:r.name),index:e.name},{children:e.component}),e.name)}))}))]})},Bt=({title:e,text:r,json:n})=>a(B,Object.assign({sx:{paddingBottom:8}},{children:[i(B,Object.assign({sx:{fontSize:"14px",fontWeight:600,color:"#536DFE"}},{children:e})),r&&i(B,Object.assign({sx:{fontSize:"18px",wordWrap:"break-word"}},{children:r})),n&&i(Cn,{value:n,height:300})]})),zt=Object.values(qr).sort(((e,r)=>e.localeCompare(r)));var _t=({propertyFieldName:e,control:r})=>a(o,{children:[i(Re,{children:i(nt,{required:!0,control:r,defaultValue:2,name:`${e}.precisionScale`,label:"Precision Scale"})}),i(Re,{children:i(Kr,{required:!0,control:r,name:`${e}.roundingMode`,label:"Rounding Mode",defaultValue:qr.HALF_UP,options:zt})})]});var Ht=({propertyFieldName:e,control:r,defaultValue:n=""})=>i(Re,{children:i(Gr,{required:!0,control:r,defaultValue:n,name:`${e}.format`,label:"Format"})});const Jt=()=>i(B,{component:"span",sx:{display:"inline-block",width:"10px",height:"10px",borderRadius:"50%",backgroundColor:"#536DFE",marginTop:"5px"}}),Gt=({data:e})=>a(sr,Object.assign({nonLinear:!0,orientation:"vertical",connector:i(pr,{sx:{marginLeft:4}}),sx:{width:"100%"}},{children:[e.filter(Boolean).map(((e,r)=>a(cr,Object.assign({expanded:!0},{children:[i(dr,Object.assign({sx:{display:"flex",alignItems:"flex-start"},StepIconComponent:Jt,StepIconProps:{icon:"",completed:!1,active:!0}},{children:e.label})),i(ur,Object.assign({sx:{marginLeft:4}},{children:Array.isArray(e.content)?i(Gt,{data:e.content}):e.content}))]}),r))),i(cr,{})]})),Yt=({properties:e=[]})=>{const r=y((()=>e&&Array.isArray(e)?e.map((e=>{const r="string"==typeof e.propertyType?e.propertyType:e.propertyType?e.propertyType.value:"";return{label:a(B,Object.assign({display:"flex",flexDirection:"column"},{children:[a("b",{children:[e.name,e.isRequired?"*":""]}),a("span",{children:[e.key," | ",e.isMultiple?"multiple":"single"," |"," ",r]})]})),content:"ENTITY"===e.propertyType&&i(Yt,{properties:e.properties})}})):[]),[e]);return i(Gt,{data:r})};var Wt=Yt;const Ut={key:"",propertyType:null,name:"",defaultValue:"",value:"",defaultValues:[],isRequired:!0,isMultiple:!1,sortOrder:0,isEnabled:!0,executeValue:"",uiSettings:""};var Zt=({control:e,parentPropertyFieldName:r,entityDefinition:n=!1,globalParameter:t=!1,entityReferenceDefinitionSources:l,entityReferenceValueComponent:s,fileReferenceValueComponent:d})=>{const u=g(null),{field:{onChange:p}}=T({control:e,name:`${r}.properties`}),m=R({control:e,name:`${r}.properties`,defaultValue:[]}),h=R({control:e,name:`${r}.name`}),{append:y,remove:v}=S({control:e,name:`${r}.properties`}),C=Wr(),[O,E]=f(0),x=b((()=>{if((null==m?void 0:m.length)>0){y(Ut);const e=m.length;E(e)}else y(Ut);u.current.addProperty()}),[m,y]),j=()=>c(void 0,void 0,void 0,(function*(){p(u.current.getProperties()),C.onClose()}));return a(o,{children:[i(Re,{children:i(z,Object.assign({variant:"h6"},{children:"Properties"}))}),i(Re,{children:i(Wt,{properties:m})}),i(Re,{children:i(M,Object.assign({variant:"contained",color:"primary",onClick:C.onOpen},{children:"Edit properties"}))}),a(D,Object.assign({disableEscapeKeyDown:!0,open:C.open,onClose:j,fullWidth:!0,maxWidth:"md"},{children:[a($,{children:[h||"Entity"," Properties"]}),i(P,Object.assign({style:{height:"500px",overflow:"hidden"}},{children:a(Re,Object.assign({container:!0,direction:"row",spacing:2,style:{height:"100%"}},{children:[a(Re,Object.assign({xs:3,style:{backgroundColor:"#f9f9f9",height:"100%",overflowY:"auto"}},{children:[i(sr,Object.assign({nonLinear:!0,activeStep:O,orientation:"vertical",style:{paddingLeft:"4px"}},{children:m.map(((e,r)=>a(cr,Object.assign({onClick:()=>(e=>E(e))(r),style:{cursor:"pointer"}},{children:[i(dr,Object.assign({StepIconProps:{icon:""},style:{wordBreak:"break-word"}},{children:e.name||"(no name)"})),i(ur,{})]}),r)))})),i(M,Object.assign({variant:"contained",size:"small",color:"primary",onClick:x},{children:"Add property"}))]})),i(Re,Object.assign({container:!0,wrap:"nowrap",direction:"column",spacing:2,style:{height:"100%",overflowY:"auto",width:"75%"}},{children:i(gl,{ref:u,properties:m,hideAddButton:!0,parentRemove:v,focusOnIndex:O,entityDefinition:n,globalParameter:t,entityReferenceDefinitionSources:l,entityReferenceValueComponent:s,fileReferenceValueComponent:d})}))]}))})),i(F,{children:i(M,Object.assign({variant:"contained",color:"primary",onClick:j},{children:"Ok"}))})]}))]})};var Kt=({propertyFieldName:e,control:r,sources:n=[{label:"Arsenal Entities",value:"ARSENAL_ENTITIES"}]})=>a(o,{children:[i(Re,{children:i(Kr,{required:!0,control:r,name:`${e}.source`,label:"Source",options:n})}),i(Re,{children:i(Gr,{required:!0,control:r,name:`${e}.definitionCode`,label:"Definition Code"})}),i(Re,{children:i(Gr,{required:!0,control:r,name:`${e}.definitionVersion`,label:"Definition Version",defaultValue:1})}),i(Re,{children:i(Gr,{required:!0,control:r,name:`${e}.labelPropertyCode`,label:"Label Property Code"})}),i(Re,{children:i(Gr,{required:!0,control:r,name:`${e}.valuePropertyCode`,label:"Value Property Code"})})]});const Xt=({control:e,propertyType:r,propertyFieldName:n,entityDefinition:t=!1,globalParameter:l=!1,entityReferenceDefinitionSources:a,entityReferenceValueComponent:o,fileReferenceValueComponent:s})=>{switch(r){case Ar.STRING:return i(dt,{name:`${n}.restrictedValues`,control:e,label:"Restricted Values"});case Ar.BIG_DECIMAL:return i(_t,{propertyFieldName:n,control:e});case Ar.DATE:return i(Ht,{control:e,propertyFieldName:n,defaultValue:Mr});case Ar.TIME:return i(Ht,{control:e,propertyFieldName:n,defaultValue:Dr});case Ar.DATE_TIME:return i(Ht,{control:e,propertyFieldName:n,defaultValue:Fr});case Ar.ENTITY_REFERENCE:return i(Kt,{control:e,propertyFieldName:n,sources:a});case Ar.ENTITY:return i(Zt,{control:e,parentPropertyFieldName:n,globalParameter:l,entityDefinition:t,entityReferenceDefinitionSources:a,entityReferenceValueComponent:o,fileReferenceValueComponent:s});default:return null}};var Qt=({control:e,name:r,label:n,required:t,restrictedValues:l,requiredErrorText:o="",requiredSelectErrorText:s=""})=>{const{field:{onChange:c,ref:d},fieldState:{error:p}}=T({control:e,name:r,rules:{required:!!t&&(Array.isArray(l)&&l.length?s||"Please, select a value":o||Hr)}}),m=R({control:e,name:r});return Array.isArray(l)&&l.length?a(H,Object.assign({fullWidth:!0,size:"small",variant:"outlined",error:!!p},{children:[i(br,Object.assign({htmlFor:"type-select"},{children:n})),i(hr,Object.assign({labelId:"type-select",label:n,value:m||"",onChange:c,ref:d},{children:l.map((e=>i(u,Object.assign({value:e},{children:e}),e)))}))]})):i(Gr,{hideErrorMessage:!0,required:t,control:e,name:r,label:n})};var el=({name:e})=>{const{control:r,setValue:n,register:t}=N(),l=R({control:r,name:e}),s=b((r=>c(void 0,void 0,void 0,(function*(){const t=r.target.files[0];(new FileReader).readAsDataURL(t);const l=yield(e=>new Promise(((r,n)=>{const t=new FileReader;t.readAsDataURL(e),t.onload=()=>{r(t.result)},t.onerror=e=>{n(e)}})))(t);n(e,l)}))),[e,n]);return a(o,{children:[a(B,Object.assign({mb:2,display:"flex",flex:"row"},{children:[i(z,{children:"Does file uploaded:"}),i(L,l?Object.assign({sx:{paddingLeft:2}},{children:i("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})}):Object.assign({sx:{paddingLeft:2}},{children:i("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20zm6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9z"})}))]})),a(M,Object.assign({component:"label",variant:"contained",size:"large",color:"primary",sx:{marginTop:4}},{children:[l?"Change file":"Upload file",i("input",Object.assign({type:"hidden"},t(`${e}`,{required:!0}))),i("input",{type:"file",hidden:!0,onChange:s})]}))]})};const rl=({property:e,name:r,label:n,useExpression:t,control:l,entityReferenceDefinitionSources:a,entityReferenceValueComponent:o,fileReferenceValueComponent:s})=>{var c;switch("string"==typeof e.propertyType?e.propertyType:null===(c=e.propertyType)||void 0===c?void 0:c.value){case Ar.BIG_DECIMAL:case Ar.FLOAT:case Ar.DOUBLE:return i(nt,{required:!0,decimal:!0,hideErrorMessage:!0,control:l,name:r,label:n,valueAsNumber:!0});case Ar.INTEGER:case Ar.BIG_INTEGER:case Ar.LONG:return i(nt,{required:!0,hideErrorMessage:!0,control:l,name:r,label:n,valueAsNumber:!0});case Ar.BOOLEAN:return i(tt,{control:l,name:r,defaultValue:!1});case Ar.DATE:return i(at,{hideErrorMessage:!0,control:l,name:r,label:n,format:e.format});case Ar.TIME:return i(ct,{hideErrorMessage:!0,control:l,name:r,label:n,format:e.format});case Ar.DATE_TIME:return i(st,{hideErrorMessage:!0,control:l,name:r,label:n,format:e.format});case Ar.JSON:return i(pn,{control:l,name:r,label:n,parseValue:!0,hideErrorMessage:!0,validateJson:!0});case Ar.STRING:return i(Qt,{control:l,name:r,label:n,restrictedValues:e.restrictedValues});case Ar.ENTITY_REFERENCE:return o?i(o,{name:r,property:e}):i(Qt,{name:r,label:n,control:l});case Ar.FILE:return i(el,{name:r});case Ar.FILE_REFERENCE:return s?i(s,{name:r}):i(Qt,{name:r,label:n,control:l});case Ar.ANY:return i(pn,{control:l,name:r,hideErrorMessage:!0,label:n});case Ar.ENTITY:return i(ji,{properties:e.properties,dataFieldName:r,useExpression:t,entityReferenceDefinitionSources:a,entityReferenceValueComponent:o,fileReferenceValueComponent:s});default:return i("div",{children:"No widget"})}};var nl=({value:e,property:r,label:n,isDirty:t,required:l=!1,useExpression:i=!1,multipleOptions:a=!1})=>{const o=y((()=>n?`${n} (value)`:`${r.name} (value)`),[n,r]),s=y((()=>n?`${n} (widget)`:`${r.name} (widget)`),[n,r]),c=y((()=>{var e;return"string"==typeof r.propertyType?r.propertyType:null===(e=r.propertyType)||void 0===e?void 0:e.value}),[r]),[d,u]=f(null),p=y((()=>a?_n({propertyType:c,required:l,useExpression:i}):Hn({propertyType:c,required:l,useExpression:i})),[i,l,c,a]),m=y((()=>{switch(c){case Ar.STRING:case Ar.DATE:case Ar.TIME:case Ar.DATE_TIME:case Ar.ENTITY_REFERENCE:case Ar.ANY:case Ar.FILE:case Ar.FILE_REFERENCE:return"";case Ar.JSON:return{};case Ar.BOOLEAN:return!1;case Ar.INTEGER:case Ar.BIG_DECIMAL:case Ar.BIG_INTEGER:case Ar.DOUBLE:case Ar.LONG:case Ar.FLOAT:return 0;default:return null}}),[c]),g=y((()=>c===Ar.JSON||c===Ar.ANY),[c]),v=b((()=>{In(e,g)?u("expression"):null==e||In(e,g)||"widget"===d||"string"===d||u("widget")}),[e,d,g]);return h((()=>{d?t||v():!Dn(e)||r.isRequired||null!==r.defaultValue&&null!==r.value?i&&In(e,g)?u("expression"):u("widget"):u("null")}),[e,d,p,i,t,v,g,l,r]),{propertyType:c,valueLabel:o,fillOptionLabel:s,fillOption:d,fillOptions:p,setFillOption:u,defaultProperyValue:m,checkFillOption:v}};const tl=t(br)((()=>({inputLabel:{overflow:"hidden",textOverflow:"ellipsis",width:"100%"}}))),ll=({control:e,property:r,name:n,useExpression:t,label:l,required:o,title:s,entityReferenceDefinitionSources:c,entityReferenceValueComponent:d,fileReferenceValueComponent:p,requiredErrorText:m=""})=>{const{field:{value:f,onChange:y},fieldState:{error:v,isDirty:C}}=T({name:n,control:e,defaultValue:r.defaultValue,rules:{validate:e=>!o||null!==e||(m||Hr)}}),O=g({}),{propertyType:E,valueLabel:x,fillOptionLabel:j,fillOption:V,fillOptions:R,setFillOption:N,defaultProperyValue:w}=nl({value:f,property:r,isDirty:C,label:l,required:o,useExpression:t}),S=b((e=>{const n=e.target.value;O.current=Object.assign(Object.assign({},O.current),{[V]:f}),N(n);const t=O.current[n];if("null"===n)y(null);else if("widget"===n)if(E===Ar.JSON&&f&&"string"!=typeof f&&"dem_builder"===V&&"properties"in f){const e=Object.assign(Object.assign({},f),{properties:qn(f.property||[])});try{y(null!=t?t:JSON.stringify(e,null,"\t"))}catch(e){console.log("Stringify failed",e)}}else y(null!=t?t:r.defaultValue||w);else if("expression"===n||"string"===n)y(null!=t?t:"",{shouldDirty:!0});else if("dem_builder"===n){const e={code:"",name:"",version:0,properties:[]};if(f)try{const e=JSON.parse(f);e.properties=$n(e.properties||{}),y(null!=t?t:e,{shouldDirty:!0})}catch(r){y(null!=t?t:e,{shouldDirty:!0})}else y(null!=t?t:e,{shouldDirty:!0})}}),[w,f,N,V,E,y,r]);return h((()=>{C||fr(r.defaultValue||r.value)||""===r.defaultValue&&""===r.value||!fr(f)||y(r.defaultValue||r.value)}),[C,r,y,f]),h((()=>{var e;(void 0===f||r.isRequired&&null===f&&fr(r.defaultValue||r.value))&&y(null!==(e=O.current[V])&&void 0!==e?e:w),r.isRequired||null!==r.defaultValue&&null!==r.value||y(null)}),[f,y,w,r,V]),a(Re,Object.assign({xs:12},{children:[s&&i(B,Object.assign({mb:2},{children:i(z,Object.assign({variant:"h6"},{children:s}))})),R?i(B,Object.assign({mb:2},{children:a(H,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[i(tl,Object.assign({htmlFor:"type-select"},{children:j})),i(hr,Object.assign({labelId:"type-select",label:j,value:V||"",onChange:S},{children:R.map((e=>i(u,Object.assign({value:e.value},{children:e.label}),e.value)))}))]}))})):null,"expression"===V&&(E===Ar.JSON||E===Ar.ENTITY||E===Ar.ANY?i(pn,{name:n,control:e,label:x,parseValue:!0,validateJson:!0,hideErrorMessage:!0}):i(Gr,{control:e,name:n,label:x,hideErrorMessage:!0})),"string"===V&&i(Gr,{control:e,name:n,label:x,hideErrorMessage:!0}),"json_notvalid"===V&&i(pn,{name:n,control:e,label:x,hideErrorMessage:!0}),"widget"===V&&i(rl,{control:e,property:r,name:n,useExpression:t,label:x,entityReferenceDefinitionSources:c,entityReferenceValueComponent:d,fileReferenceValueComponent:p}),"dem_builder"===V&&i(bl,{control:e,title:"JSON",definitionFieldName:n,entityReferenceDefinitionSources:c,entityReferenceValueComponent:d,fileReferenceValueComponent:p}),v&&i(G,Object.assign({error:!0},{children:v.message}))]}))};var il=({control:e,name:r,property:n,useExpression:t,required:l,label:o,entityReferenceDefinitionSources:s,entityReferenceValueComponent:c,fileReferenceValueComponent:d})=>{const{fields:u,append:p,remove:m}=S({control:e,name:r});return a(Re,Object.assign({container:!0,spacing:2,direction:"column",xs:12},{children:[Array.isArray(u)&&u.length?u.map(((u,p)=>i(Re,Object.assign({xs:12},{children:a(B,Object.assign({display:"flex",alignItems:"flex-start",width:"100%",p:2,style:{backgroundColor:"#f1f1f1"}},{children:[i(ll,{control:e,required:l,property:n,useExpression:t,name:`${r}.${p}`,label:`${o||n.name} (${p+1})`,entityReferenceDefinitionSources:s,entityReferenceValueComponent:c,fileReferenceValueComponent:d}),i(B,Object.assign({mt:"8px",ml:"4px"},{children:i(I,Object.assign({id:"close-button",size:"small",onClick:()=>m(p)},{children:i(L,Object.assign({fontSize:"small"},{children:i("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})}))}))}))]}))}),u.id))):null,i(Re,{children:i(M,Object.assign({variant:"contained",size:"small",color:"primary",onClick:()=>p(null)},{children:"Add value"}))})]}))};const al=({control:e,property:r,name:n,useExpression:t,required:l,label:o,title:s,entityReferenceDefinitionSources:c,entityReferenceValueComponent:d,fileReferenceValueComponent:p,requiredErrorText:m=""})=>{var b;const[y,v]=f(!1),{field:{value:C,onChange:O},fieldState:{error:E,isDirty:x}}=T({control:e,name:n,defaultValue:null!==(b=r.defaultValue)&&void 0!==b?b:[],rules:{validate:e=>!(l&&!e)||(m||Hr)}}),j=g({}),{propertyType:V,valueLabel:R,fillOptionLabel:N,fillOption:w,fillOptions:S,setFillOption:k,checkFillOption:L}=nl({property:r,value:C,isDirty:x,label:o,required:l,useExpression:t,multipleOptions:!0});return h((()=>{C||O(r.isRequired&&r.isMultiple?[]:null)}),[C,r,O]),h((()=>{C&&!y&&(v(!0),L())}),[L,y,C]),a(Re,{children:[s&&i(B,Object.assign({mb:2},{children:i(z,Object.assign({variant:"h6"},{children:s}))})),S?i(B,Object.assign({mb:2},{children:a(H,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[i(tl,Object.assign({htmlFor:"type-select"},{children:N})),i(hr,Object.assign({labelId:"type-select",label:N,value:w||"",onChange:e=>{v(!0),j.current=Object.assign(Object.assign({},j.current),{[w]:C});const r=e.target.value,n=j.current[r];"null"===r?O(null):"expression"===r||"json_valid"===r||"json_notvalid"===r?O(null!=n?n:"",{shouldDirty:!0}):"widget"===r&&O(null!=n?n:[],{shouldDirty:!0}),k(r)}},{children:S.map((e=>i(u,Object.assign({value:e.value},{children:e.label}),e.value)))}))]}))})):null,"expression"===w&&(V===Ar.JSON||V===Ar.ENTITY||V===Ar.ANY?i(pn,{name:n,control:e,label:R,parseValue:!0,validateJson:!0,hideErrorMessage:!0}):i(Gr,{required:!0,hideErrorMessage:!0,control:e,name:n,label:R})),"json_valid"===w&&i(pn,{name:n,control:e,label:R,parseValue:!0,validateJson:!0,hideErrorMessage:!0}),"widget"===w&&i(il,{control:e,property:r,name:n,useExpression:t,required:l,label:o,entityReferenceDefinitionSources:c,entityReferenceValueComponent:d,fileReferenceValueComponent:p}),E&&i(G,Object.assign({error:!0},{children:E.message}))]})},ol=({control:e,propertyFieldName:r,name:n,label:t="",required:l,entityReferenceDefinitionSources:a,entityReferenceValueComponent:o,fileReferenceValueComponent:s})=>{const c=R({control:e,name:`${r}.propertyType`}),d=R({control:e,name:`${r}.isMultiple`}),u=R({control:e,name:`${r}.format`}),p=R({control:e,name:`${r}.restrictedValues`}),m=R({control:e,name:`${r}.properties`}),g=R({control:e,name:`${r}.isRequired`}),h=y((()=>Object.assign(Object.assign(Object.assign(Object.assign({name:t,isRequired:null!=l?l:g,isMultiple:d},!!u&&{format:u}),{restrictedValues:p}),!!m&&{properties:m}),{propertyType:"string"==typeof c?c:c.value,defaultValue:null,defaultValues:[],sortOrder:0,isEnabled:!0,uiSettings:null,validationNode:null})),[c,u,p,d,t,g,m,l]);return i(gr,Object.assign({dateAdapter:mr},{children:i(d?al:ll,{control:e,name:n,property:h,title:t,required:l,entityReferenceDefinitionSources:a,entityReferenceValueComponent:o,fileReferenceValueComponent:s})}))};var sl=({name:e,label:r="",propertyFieldName:n,type:t,decimal:l=!1,options:a=[],required:o=!1})=>{const{control:s}=N(),c=y((()=>`${n}.${e}`),[e,n]);switch(t){case"text":return i(Gr,{control:s,name:c,label:r,required:o});case"number":return i(nt,{control:s,name:c,label:r,decimal:l,required:o});case"select":return i(Kr,{control:s,name:c,label:r,options:a,required:o});case"autocomplete":return i(on,{control:s,name:c,label:r,options:a,required:o});case"json":return i(pn,{control:s,name:c,label:r,mode:"json",required:o});default:return null}};var cl=e=>({customCheckboxes:y((()=>e.length?e.filter((e=>"checkbox"===e.type)):[]),[e]),customFields:y((()=>e.length?e.filter((e=>"checkbox"!==e.type)):[]),[e])});const dl=Object.values(Ar).sort(((e,r)=>e.localeCompare(r))).map((e=>({value:e,label:e.replace("_"," ").toLowerCase().replace(/(^\w)|([-\s]\w)/g,(e=>e.toUpperCase()))}))),ul=O((({setValue:e,control:r,propertyFieldName:n,entityDefinition:t=!1,globalParameter:l=!1,customPropertyFields:s=[],entityReferenceDefinitionSources:c,entityReferenceValueComponent:d,fileReferenceValueComponent:u})=>{const p=R({control:r,name:`${n}.propertyType`}),m=R({control:r,name:`${n}.isMultiple`}),g=R({control:r,name:`${n}.isRequired`}),{customCheckboxes:f,customFields:b}=cl(s),v=y((()=>{let e=l?"Value":"Default Value";return m&&(e+="s"),e}),[l,m]);return h((()=>{p&&"string"==typeof p&&e(`${n}.propertyType`,dl.find((e=>e.value===p)))}),[p,e,n]),a(Re,Object.assign({container:!0,direction:"column",spacing:2},{children:[i(Re,{children:i(Gr,{required:!0,control:r,name:`${n}.key`,label:"Key"})}),i(Re,{children:i(Gr,{required:!0,control:r,name:`${n}.name`,label:"Name"})}),i(Re,{children:i(on,{required:!0,control:r,name:`${n}.propertyType`,label:"Type",options:dl,onChange:(r,t)=>{const i=`${n}.propertyType`,a=`${n}.${l?"value":"defaultValue"}`;e(a,m?[]:null),e(i,t)}})}),i(Re,{children:i(nt,{required:!0,control:r,name:`${n}.sortOrder`,label:"Sort Order"})}),i(Re,{children:i(pn,{control:r,name:`${n}.uiSettings`,label:"UI Settings",validateJson:!0,parseValue:!0})}),a(Re,{children:[i(Xr,{control:r,name:`${n}.isMultiple`,label:"Multiple"}),i(Xr,{control:r,name:`${n}.isEnabled`,label:"Enabled"}),i(Xr,{control:r,name:`${n}.isRequired`,label:"Required"}),t&&i(Xr,{control:r,name:`${n}.isViewableInList`,label:"Is viewable in list"}),f.length?i(o,{children:f.map(((e,t)=>i(Xr,{control:r,name:`${n}.${e.name}`,label:e.label,checked:e.checked,defaultValue:e.defaultValue},t)))}):null]}),p&&a(o,{children:[i(Xt,{control:r,propertyType:"string"==typeof p?p:p.value,propertyFieldName:n,globalParameter:l,entityDefinition:t,entityReferenceDefinitionSources:c,entityReferenceValueComponent:d,fileReferenceValueComponent:u}),i(ol,{control:r,propertyFieldName:n,name:`${n}.${l?"value":"defaultValue"}`,label:v,required:!!l&&g,entityReferenceDefinitionSources:c,entityReferenceValueComponent:d,fileReferenceValueComponent:u})]}),b.length?i(o,{children:b.map(((e,r)=>i(Re,{children:i(sl,Object.assign({},e,{propertyFieldName:n}))},r)))}):null]}))}));var pl=({entityDefinition:e,globalParameter:r,customPropertyFields:n,index:t,arrLength:l,entityReferenceDefinitionSources:o,entityReferenceValueComponent:s,control:c,setValue:d,fileReferenceValueComponent:u,handleRemoveParameter:p,error:m,item:g,extRefs:h})=>{const[b,y]=f(t===l&&!g.key);return i(Re,Object.assign({sm:12,ref:e=>h.current[t]=e},{children:a(tr,Object.assign({expanded:b,onChange:()=>y(!b),elevation:3},{children:[i(lr,Object.assign({expandIcon:i(or,{})},{children:i(z,Object.assign({color:m&&m[t]?"secondary":"initial",style:{wordBreak:"break-word"}},{children:g.name||`Property ${t+1}`}))})),i(ir,{children:b&&i(ul,{control:c,setValue:d,propertyFieldName:`properties.${t}`,entityDefinition:e,globalParameter:r,customPropertyFields:n,entityReferenceDefinitionSources:o,entityReferenceValueComponent:s,fileReferenceValueComponent:u})}),i(ar,{children:i(M,Object.assign({variant:"contained",size:"small",color:"secondary",onClick:()=>p(t)},{children:"Remove"}))})]}))}))};const ml={key:"",propertyType:null,name:"",defaultValue:"",defaultValues:[],isRequired:!0,isMultiple:!1,sortOrder:0,isEnabled:!0,executeValue:"",uiSettings:""},gl=C((({properties:e,parentFieldName:r,hideAddButton:n,focusOnIndex:t,required:l,entityDefinition:s=!1,globalParameter:c=!1,customPropertyFields:d=[],parentRemove:u,entityReferenceDefinitionSources:p,entityReferenceValueComponent:m,fileReferenceValueComponent:f},y)=>{var v;const{clearErrors:C,control:O,setValue:x,getValues:j,reset:V,trigger:R,watch:N}=k({mode:"all",defaultValues:{properties:e}}),{fields:w,append:L,remove:I}=S({control:O,name:"properties"}),{fieldState:{error:A}}=T({control:O,name:"properties",rules:{validate:e=>!l||!Array.isArray(e)||0!==e.length||"Please, fill the properties"}}),D=g([]),F=b((()=>{L(ml),C("properties")}),[L,C]),P=b((e=>{u&&u(e),I(e)}),[u,I]);return h((()=>{"number"==typeof t&&D.current[t]&&D.current[t].scrollIntoView({behavior:"smooth",block:"start"})}),[t,D]),h((()=>{var r;e.length&&!(null===(r=j("properties"))||void 0===r?void 0:r.length)&&V({properties:e})}),[e,j,V]),E(y,(()=>({getProperties:()=>j("properties"),addProperty:F,removeProperty:P,trigger:R})),[j,F,P,R]),a(o,{children:[A&&A.message&&i(Re,Object.assign({sm:12},{children:i(z,Object.assign({color:"secondary"},{children:A.message}))})),Array.isArray(w)&&w.map(((e,r,n)=>i(pl,{item:e,index:r,arrLength:n.length-1,control:O,setValue:x,customPropertyFields:d,entityDefinition:s,globalParameter:c,error:A,handleRemoveParameter:P,fileReferenceValueComponent:f,entityReferenceValueComponent:m,entityReferenceDefinitionSources:p,extRefs:D},e.id))),!n&&a(Re,Object.assign({xs:12},{children:[i(M,Object.assign({variant:"contained",size:"small",color:"primary",onClick:F},{children:"Add property"})),A&&i(G,Object.assign({error:!0},{children:null===(v=A.root)||void 0===v?void 0:v.message}))]}))]})})),hl={key:"",propertyType:null,name:"",defaultValue:"",defaultValues:[],isRequired:!0,isMultiple:!1,sortOrder:0,isEnabled:!0,executeValue:"",uiSettings:""},fl=({control:e,parentFieldName:r,hideAddButton:n,focusOnIndex:t,required:l,entityDefinition:s=!1,globalParameter:c=!1,customPropertyFields:d=[],parentRemove:u,entityReferenceDefinitionSources:p,entityReferenceValueComponent:m,fileReferenceValueComponent:f})=>{var v;const C=y((()=>r?`${r}.properties`:"properties"),[r]),{clearErrors:O,setValue:E}=N(),{fields:x,append:j,remove:V}=S({control:e,name:C}),{fieldState:{error:R}}=T({control:e,name:C,rules:{validate:e=>!l||!Array.isArray(e)||0!==e.length||"Please, fill the properties"}}),w=g([]),k=b((()=>{j(hl),O("properties")}),[j,O]),L=b((e=>{u&&u(e),V(e)}),[u,V]);return h((()=>{"number"==typeof t&&w.current[t]&&w.current[t].scrollIntoView({behavior:"smooth",block:"start"})}),[t,w]),a(o,{children:[R&&R.message&&i(Re,Object.assign({sm:12},{children:i(z,Object.assign({color:"secondary"},{children:R.message}))})),Array.isArray(x)&&x.map(((r,n,t)=>i(Re,Object.assign({sm:12,ref:e=>w.current[n]=e},{children:a(tr,Object.assign({defaultExpanded:n===t.length-1&&!r.key,elevation:3},{children:[i(lr,Object.assign({expandIcon:i(or,{})},{children:i(z,Object.assign({color:R&&R[n]?"secondary":"initial",style:{wordBreak:"break-word"}},{children:r.name||`Property ${n+1}`}))})),i(ir,{children:i(ul,{control:e,setValue:E,propertyFieldName:`${C}.${n}`,entityDefinition:s,globalParameter:c,customPropertyFields:d,entityReferenceDefinitionSources:p,entityReferenceValueComponent:m,fileReferenceValueComponent:f})}),i(ar,{children:i(M,Object.assign({variant:"contained",size:"small",color:"secondary",onClick:()=>L(n)},{children:"Remove"}))})]}))}),r.id))),!n&&a(Re,Object.assign({xs:12},{children:[i(M,Object.assign({variant:"contained",size:"small",color:"primary",onClick:k},{children:"Add property"})),R&&i(G,Object.assign({error:!0},{children:null===(v=R.root)||void 0===v?void 0:v.message}))]}))]})},bl=C((({control:e,definitionFieldName:r,title:n,hideCodeField:t,hideVersionField:l,hideNameField:o,required:s=!1,entityReferenceDefinitionSources:c,entityReferenceValueComponent:d,fileReferenceValueComponent:u},p)=>{const{control:m,getValues:g}=N(),h=g(`${r}.properties`);return a(Re,Object.assign({container:!0,direction:"column",spacing:2},{children:[n&&i(Re,Object.assign({sm:12},{children:i(B,Object.assign({my:2},{children:i(z,Object.assign({variant:"h6"},{children:n}))}))})),!o&&i(Re,Object.assign({sm:12},{children:i(Gr,{required:!0,control:null!=e?e:m,name:r?`${r}.name`:"name",label:"Name"})})),!t&&i(Re,Object.assign({sm:12},{children:i(Gr,{required:!0,control:null!=e?e:m,name:r?`${r}.code`:"code",label:"Code"})})),!l&&i(Re,Object.assign({sm:12},{children:i(nt,{required:!0,control:null!=e?e:m,name:r?`${r}.version`:"version",label:"Version"})})),p?i(gl,{ref:p,properties:h,required:s,parentFieldName:r,entityReferenceDefinitionSources:c,entityReferenceValueComponent:d,fileReferenceValueComponent:u}):i(fl,{control:e,required:s,parentFieldName:r,entityReferenceDefinitionSources:c,entityReferenceValueComponent:d,fileReferenceValueComponent:u})]}))})),yl=({node:e,name:r,label:n,useExpression:t,control:l,entityReferenceValueComponent:a,fileReferenceValueComponent:o})=>{var s;switch("string"==typeof e.nodeType?e.nodeType:null===(s=e.nodeType)||void 0===s?void 0:s.value){case Pr.BIG_DECIMAL:case Pr.FLOAT:case Pr.DOUBLE:return i(nt,{required:!0,decimal:!0,hideErrorMessage:!0,control:l,name:r,label:n,valueAsNumber:!0});case Pr.INTEGER:case Pr.SHORT:case Pr.BIG_INTEGER:case Pr.LONG:return i(nt,{required:!0,hideErrorMessage:!0,control:l,name:r,label:n,valueAsNumber:!0});case Pr.BOOLEAN:return i(tt,{control:l,name:r,defaultValue:!1});case Pr.DATE:return i(at,{hideErrorMessage:!0,control:l,name:r,label:n,format:e.format});case Pr.TIME:return i(ct,{hideErrorMessage:!0,control:l,name:r,label:n,format:e.format});case Pr.DATE_TIME:return i(st,{hideErrorMessage:!0,control:l,name:r,label:n,format:e.format});case Pr.STRING:return i(Qt,{control:l,name:r,label:n,restrictedValues:e.restrictedValues});case Pr.ENTITY_REFERENCE:return a?i(a,{name:r,node:e}):i(Qt,{name:r,label:n,control:l});case Pr.FILE:return i(el,{name:r});case Pr.FILE_REFERENCE:return o?i(o,{name:r}):i(Qt,{name:r,label:n,control:l});case Pr.ANY:return i(pn,{control:l,name:r,hideErrorMessage:!0,label:n,parseValue:!0});case Pr.OBJECT:return e.properties?i("div",{children:e.properties.map((e=>i(Vi,{node:e,dataFieldName:`${r}.${e.key}`,useExpression:t,entityReferenceValueComponent:a,fileReferenceValueComponent:o})))}):i(pn,{control:l,name:r,hideErrorMessage:!0,label:n,parseValue:!0,mode:"json"});default:return i("div",{children:"No widget"})}};var vl=({value:e,node:r,label:n,isDirty:t,required:l=!1,useExpression:i=!1,multipleOptions:a=!1})=>{const o=y((()=>n?`${n} (value)`:`${r.name} (value)`),[n,r]),s=y((()=>n?`${n} (widget)`:`${r.name} (widget)`),[n,r]),c=y((()=>Qn(r)),[r]),[d,u]=f(null),p=y((()=>a?Xn({nodeType:c,required:l,useExpression:i}):et({nodeType:c,required:l,useExpression:i})),[i,l,c,a]),m=y((()=>{switch(c){case Pr.STRING:case Pr.DATE:case Pr.TIME:case Pr.DATE_TIME:case Pr.ENTITY_REFERENCE:case Pr.ANY:case Pr.FILE:case Pr.FILE_REFERENCE:return"";case Pr.OBJECT:return{};case Pr.ARRAY:return[];case Pr.BOOLEAN:return!1;case Pr.INTEGER:case Pr.BIG_DECIMAL:case Pr.BIG_INTEGER:case Pr.DOUBLE:case Pr.LONG:case Pr.FLOAT:case Pr.SHORT:return 0;default:return null}}),[c]),g=y((()=>c===Pr.ANY||c===Pr.ARRAY),[c]),v=b((()=>{In(e,g)?u("expression"):c===Pr.ARRAY||null==e||In(e,g)||"widget"===d||"string"===d||"json_valid"===d||u("widget")}),[e,d,g,c]);return h((()=>{d?t||v():!Dn(e)||r.isRequired||null!==r.defaultValue&&null!==r.value?i&&In(e,g)?u("expression"):u("widget"):u("null")}),[e,d,p,i,t,v,g,l,r]),{nodeType:c,valueLabel:o,fillOptionLabel:s,fillOption:d,fillOptions:p,setFillOption:u,defaultProperyValue:m,checkFillOption:v}};const Cl=t(br)((()=>({inputLabel:{overflow:"hidden",textOverflow:"ellipsis",width:"100%"}}))),Ol=({control:e,node:r,name:n,useExpression:t,label:l,required:o,title:s,entityReferenceValueComponent:c,fileReferenceValueComponent:d,requiredErrorText:p=""})=>{const{field:{value:m,onChange:f},fieldState:{error:y,isDirty:v}}=T({name:n,control:e,rules:{validate:e=>!o||null!==e||(p||Hr)}}),C=g({}),{nodeType:O,valueLabel:E,fillOptionLabel:x,fillOption:j,fillOptions:V,setFillOption:R,defaultProperyValue:N}=vl({value:m,node:r,isDirty:v,label:l,required:o,useExpression:t}),w=b((e=>{const t=e.target.value;C.current=Object.assign(Object.assign({},C.current),{[j]:m}),R(t);const l=C.current[t];if("null"===t)f(null);else if("widget"===t)if(O===Pr.OBJECT&&m&&"string"!=typeof m&&"dem_builder"===j&&"node"in m){const e=Wn(m);try{f(null!=l?l:JSON.stringify(e,null,"\t"))}catch(e){console.log("Stringify failed",e)}}else f(null!=l?l:r.defaultValue||N);else if("expression"===t||"string"===t)f(n,null!=l?l:"");else if("dem_builder"===t){const e={code:"",name:"",version:0,node:null};if(m)try{const e=JSON.parse(m);e.properties=Un(e.properties||{}),f(null!=l?l:e)}catch(r){f(null!=l?l:e)}else f(null!=l?l:e,{shouldDirty:!0})}}),[n,m,R,j,O,f,N,r]);return h((()=>{v||fr(r.defaultValue||r.value)||""===r.defaultValue&&""===r.value||!fr(m)||f(n,r.defaultValue||r.value)}),[v,r,f,m,n]),h((()=>{var e;(void 0===m||r.isRequired&&null===m&&!r.defaultValue&&!r.value)&&f(null!==(e=C.current[j])&&void 0!==e?e:N),void 0!==m||r.isRequired||null!==r.defaultValue&&null!==r.value||f(null)}),[m,f,n,N,r,j]),a(Re,Object.assign({xs:12},{children:[s&&i(B,Object.assign({mb:2},{children:i(z,Object.assign({component:"h6",color:"initial",mb:3,style:{wordBreak:"break-word",fontSize:18}},{children:s}))})),V?i(B,Object.assign({mb:2},{children:a(H,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[i(Cl,Object.assign({htmlFor:"type-select"},{children:x})),i(hr,Object.assign({labelId:"type-select",label:x,value:j||"",onChange:w},{children:V.map((e=>i(u,Object.assign({value:e.value},{children:e.label}),e.value)))}))]}))})):null,"expression"===j&&(O===Pr.OBJECT||O===Pr.ANY?i(pn,{name:n,control:e,label:E,parseValue:!0,hideErrorMessage:!0,useCleanValue:!0,mode:O===Pr.ANY?"text":"json"}):i(Gr,{control:e,name:n,label:E,hideErrorMessage:!0})),"string"===j&&i(Gr,{control:e,name:n,label:E,hideErrorMessage:!0}),"widget"===j&&i(yl,{control:e,node:r,name:n,useExpression:t,label:E,entityReferenceValueComponent:c,fileReferenceValueComponent:d}),y&&i(G,Object.assign({error:!0},{children:y.message}))]}))},El=({control:e,name:r,node:n,useExpression:t,required:l,label:o,entityReferenceValueComponent:s,fileReferenceValueComponent:c})=>{const{fields:d,append:u,remove:p}=S({control:e,name:r});return a(Re,Object.assign({container:!0,spacing:2,direction:"column",xs:12},{children:[Array.isArray(d)&&d.length?d.map(((d,u)=>i(Re,Object.assign({xs:12},{children:a(B,Object.assign({display:"flex",alignItems:"flex-start",width:"100%",p:2,style:{backgroundColor:"#f1f1f1"}},{children:[i(Ol,{control:e,required:l,node:n,useExpression:t,name:`${r}.${u}`,label:`${o||n.name} (${u+1})`,entityReferenceValueComponent:s,fileReferenceValueComponent:c}),i(B,Object.assign({mt:"8px",ml:"4px"},{children:i(I,Object.assign({id:"close-button",size:"small",onClick:()=>p(u)},{children:i(L,Object.assign({fontSize:"small"},{children:i("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})}))}))}))]}))}),u))):null,i(Re,{children:i(M,Object.assign({variant:"contained",size:"small",color:"primary",onClick:()=>u(null)},{children:"Add value"}))})]}))},xl=({node:e,name:r,useExpression:n,label:t,required:l,title:o,entityReferenceValueComponent:s,fileReferenceValueComponent:c,requiredErrorText:d=""})=>{const{control:p,clearErrors:m,setValue:f}=N(),{field:{value:y},fieldState:{error:v,isDirty:C}}=T({name:r,control:p,rules:{validate:e=>!l||null!==e||(d||Hr)}}),O=g({}),{nodeType:E,valueLabel:x,fillOptionLabel:j,fillOption:V,fillOptions:R,setFillOption:w,defaultProperyValue:S}=vl({value:y,node:e,isDirty:C,label:t,required:l,useExpression:n}),k=b((n=>{const t=n.target.value;O.current=Object.assign(Object.assign({},O.current),{[V]:y}),w(t);const l=O.current[t];if("null"===t)f(r,null,{shouldDirty:!0});else if("widget"===t)if(E===Pr.OBJECT&&y&&"string"!=typeof y&&"dem_builder"===V&&"node"in y){const e=Wn(y);try{f(r,null!=l?l:JSON.stringify(e,null,"\t"))}catch(e){console.log("Stringify failed",e)}}else f(r,null!=l?l:e.defaultValue||S);else if("expression"===t||"string"===t)f(r,null!=l?l:"",{shouldDirty:!0});else if("dem_builder"===t){const e={code:"",name:"",version:0,node:null};if(y)try{const e=JSON.parse(y);e.properties=Un(e.properties||{}),f(r,null!=l?l:e,{shouldDirty:!0})}catch(n){f(r,null!=l?l:e,{shouldDirty:!0})}else f(r,null!=l?l:e,{shouldDirty:!0})}m()}),[r,m,y,w,V,E,f,S,e]);return h((()=>{C||fr(e.defaultValue||e.value)||""===e.defaultValue&&""===e.value||!fr(y)||f(r,e.defaultValue||e.value)}),[C,e,f,y,r]),h((()=>{var n;(void 0===y||e.isRequired&&null===y&&!e.defaultValue&&!e.value)&&f(r,null!==(n=O.current[V])&&void 0!==n?n:S),void 0!==y||e.isRequired||null!==e.defaultValue&&null!==e.value||f(r,null)}),[y,f,r,S,e,V]),a(Re,Object.assign({xs:12},{children:[o&&i(B,Object.assign({mb:2},{children:i(z,Object.assign({component:"h6",color:"initial",mb:3,style:{wordBreak:"break-word",fontSize:18}},{children:o}))})),R?i(B,Object.assign({mb:2},{children:a(H,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[i(Cl,Object.assign({htmlFor:"type-select"},{children:j})),i(hr,Object.assign({labelId:"type-select",label:j,value:V||"",onChange:k},{children:R.map((e=>i(u,Object.assign({value:e.value},{children:e.label}),e.value)))}))]}))})):null,"expression"===V&&(E===Pr.OBJECT||E===Pr.ANY?i(pn,{name:r,control:p,label:x,parseValue:!0,hideErrorMessage:!0,useCleanValue:!0,mode:"expression"===V?"text":"json"}):i(pn,{control:p,name:r,hideErrorMessage:!0,label:t,parseValue:!0,height:"40px"})),"string"===V&&i(Gr,{control:p,name:r,label:x,hideErrorMessage:!0}),"widget"===V&&i(yl,{control:p,node:e,name:r,useExpression:n,label:x,entityReferenceValueComponent:s,fileReferenceValueComponent:c}),v&&i(G,Object.assign({error:!0},{children:v.message}))]}))},jl={nodeType:Pr.ANY,name:"",isRequired:!0,defaultValue:null,defaultValues:null,sortOrder:0,isEnabled:!0,uiSettings:null,validationNode:null},Vl=({node:e,name:r,useExpression:n,required:t,label:l,title:s,entityReferenceValueComponent:c,fileReferenceValueComponent:d,requiredErrorText:p=""})=>{var m,b,y,v;const[C,O]=f(!1),{control:E,clearErrors:x,setValue:j,watch:V}=N(),{field:{ref:R,onChange:w},fieldState:{error:S,isDirty:k}}=T({control:E,name:r,defaultValue:null!==(m=e.defaultValue)&&void 0!==m?m:[],rules:{validate:e=>!(t&&!e)||(p||Hr)}}),L=V(r),I=g({}),{valueLabel:A,fillOptionLabel:M,fillOption:D,fillOptions:F,setFillOption:P,checkFillOption:q}=vl({node:e,value:L,isDirty:k,label:l,required:t,useExpression:n,multipleOptions:!0});return h((()=>{!L&&e.isRequired&&w([]),vr(L)&&!e.isRequired&&w(null)}),[L,e,w]),h((()=>{L&&!C&&(O(!0),q())}),[q,C,L]),a(o,{children:[s&&i(B,Object.assign({mb:2},{children:i(z,Object.assign({variant:"h6"},{children:s}))})),F?i(B,Object.assign({mb:2},{children:a(H,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[i(Cl,Object.assign({htmlFor:"type-select"},{children:M})),i(hr,Object.assign({labelId:"type-select",label:M,value:D||"",onChange:e=>{O(!0),I.current=Object.assign(Object.assign({},I.current),{[D]:L});const n=e.target.value,t=I.current[n];"null"===n?j(r,null):j(r,null!=t?t:[],{shouldDirty:!0}),P(n),x(r)}},{children:F.map((e=>i(u,Object.assign({value:e.value},{children:e.label}),e.value)))}))]}))})):null,("expression"===D||"json_valid"===D)&&i(pn,{name:r,control:E,label:A,parseValue:!0,hideErrorMessage:!0,useCleanValue:!0,mode:"json"}),"widget"===D&&i(El,{control:E,node:null!==(b=e.memberNodes)&&void 0!==b?b:jl,name:r,useExpression:n,required:t,label:null!==(v=null===(y=e.memberNodes)||void 0===y?void 0:y.name)&&void 0!==v?v:e.name,entityReferenceValueComponent:c,fileReferenceValueComponent:d}),S&&i(G,Object.assign({error:!0},{children:S.message}))]})},Tl={nodeType:Pr.ANY,name:"",isRequired:!0,defaultValue:null,defaultValues:null,sortOrder:0,isEnabled:!0,uiSettings:null,validationNode:null},Rl=({control:e,node:r,name:n,useExpression:t,required:l,label:s,title:c,entityReferenceValueComponent:d,fileReferenceValueComponent:p,requiredErrorText:m=""})=>{var b,y,v,C;const[O,E]=f(!1),{field:{value:x,onChange:j},fieldState:{error:V,isDirty:R}}=T({control:e,name:n,defaultValue:null!==(b=r.defaultValue)&&void 0!==b?b:[],rules:{validate:e=>!(l&&!e)||(m||Hr)}}),N=g({}),{valueLabel:w,fillOptionLabel:S,fillOption:k,fillOptions:L,setFillOption:I,checkFillOption:A}=vl({node:r,value:x,isDirty:R,label:s,required:l,useExpression:t,multipleOptions:!0});return h((()=>{!x&&r.isRequired&&j([])}),[x,r,j]),h((()=>{(null==x?void 0:x.length)&&!O&&(E(!0),A())}),[A,O,x]),a(o,{children:[c&&i(B,Object.assign({mb:2},{children:i(z,Object.assign({variant:"h6"},{children:c}))})),L?i(B,Object.assign({mb:2},{children:a(H,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[i(Cl,Object.assign({htmlFor:"type-select"},{children:S})),i(hr,Object.assign({labelId:"type-select",label:S,value:k||"",onChange:e=>{E(!0),N.current=Object.assign(Object.assign({},N.current),{[k]:x});const r=e.target.value,n=N.current[r];j("null"===r?null:null!=n?n:[]),I(r)}},{children:L.map((e=>i(u,Object.assign({value:e.value},{children:e.label}),e.value)))}))]}))})):null,("expression"===k||"json_valid"===k)&&i(pn,{name:n,control:e,label:w,parseValue:!0,hideErrorMessage:!0,useCleanValue:!0,mode:"json"}),"widget"===k&&i(El,{control:e,node:null!==(y=r.memberNodes)&&void 0!==y?y:Tl,name:n,useExpression:t,required:l,label:null!==(C=null===(v=r.memberNodes)||void 0===v?void 0:v.name)&&void 0!==C?C:r.name,entityReferenceValueComponent:d,fileReferenceValueComponent:p}),V&&i(G,Object.assign({error:!0},{children:V.message}))]})},Nl={name:"Name",key:"Key",nodeType:"Node Type",defaultValue:"Default Value",defaultValues:"Default Values",sortOrder:"Sort Order",isRequired:"Required",isEnabled:"Enabled",isViewableInList:"Is Viewable In List",precisionScale:"Precision Scale",roundingMode:"Rounding Mode",format:"Format",definitionCode:"Definition Code",definitionVersion:"Definition Version",labelPropertyCode:"Label Property Code",valuePropertyCode:"Value Property Code",restrictedValues:"Restricted Values",value:"Value",values:"Values",uiSettings:"UI Settings",validationNode:"Validation Node",memberNodes:"Member Nodes"},wl=({value:e,type:r})=>r!==Pr.OBJECT&&r!==Pr.ANY||!e?i(z,Object.assign({variant:"subtitle1",display:"inline",style:{wordBreak:"break-word"}},{children:null===e?"null":e.toString()})):i(Cn,{value:e}),Sl=(e,r,n)=>{switch(r){case"nodeType":return i(z,Object.assign({variant:"subtitle1",display:"inline",style:{wordBreak:"break-word"}},{children:n}));case"isRequired":case"isEnabled":case"isViewableInList":return e?i(L,Object.assign({color:"primary",fontSize:"small"},{children:i("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})})):null;case"restrictedValues":return e?i(B,Object.assign({display:"flex",flexWrap:"wrap"},{children:e.map((e=>i(Te,{label:e,style:{wordBreak:"break-word",maxWidth:"500px"}},e)))})):null;case"defaultValue":case"value":return i(wl,{value:e,type:n});case"values":case"defaultValues":return e?Array.isArray(e)&&n!==Pr.OBJECT&&n!==Pr.ANY?a("div",{children:["[",null==e?void 0:e.map(((e,r)=>i("div",{children:i(wl,{value:e,type:n})},r))),"]"]}):i(Cn,{value:e}):null;case"uiSettings":case"validationNode":return e?i(Cn,{value:e}):null;case"memberNodes":return e?i(Ml,{node:e,defaultExpanded:!1}):null;default:return i(z,Object.assign({variant:"subtitle1",display:"inline",style:{wordBreak:"break-word"}},{children:e}))}};var kl=({node:e})=>{const r=y((()=>(e&&(Qn(e)===Pr.ARRAY?(delete e.restrictedValues,delete e.defaultValue,delete e.value):(delete e.defaultValues,delete e.values)),e)),[e]);return i(_e,Object.assign({size:"small"},{children:i(He,{children:Object.keys(Nl).map((e=>e in r?a(We,{children:[i(Je,Object.assign({width:"30%"},{children:i(z,{children:Nl[e]})})),i(Je,{children:Sl(r[e],e,Qn(r))})]},e):null))})}))};const Ll=({properties:e,parentNames:r=[]})=>{const n=y((()=>{if(!e)return!1;let r=!1;return e.every((e=>e.nodeType!==Pr.OBJECT||(r=!0,!1))),r}),[e]);return a(B,Object.assign({mt:4},{children:[i(z,Object.assign({variant:"h6"},{children:"Properties"})),a(sr,Object.assign({orientation:"vertical",style:{paddingLeft:"4px"}},{children:[Array.isArray(e)?e.map((e=>a(cr,Object.assign({expanded:!0},{children:[i(dr,{StepIconProps:{icon:"",completed:!1,active:!0}}),i(ur,{children:i(Ml,{node:e,parentNames:[...r],defaultExpanded:!1})})]}),e.key))):null,n&&i(cr,{})]}))]}))};var Il=O(Ll);const Al=({node:e,parentNames:r=[],defaultExpanded:n=!0})=>{const[t,l]=f(!0);return h((()=>{l(n)}),[n]),e?a(tr,Object.assign({elevation:3,style:{backgroundColor:r.length%2==1?"#f1f1f1":"#fff",maxHeight:"none"},expanded:t,onChange:()=>l((e=>!e))},{children:[i(lr,Object.assign({expandIcon:i(L,{children:i("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})})},{children:i(z,Object.assign({style:{wordBreak:"break-word",fontWeight:"600"}},{children:e.name}))})),i(ir,{children:a(B,Object.assign({width:"100%"},{children:[i(kl,{node:e}),Qn(e)===Pr.OBJECT&&i(Il,{properties:Un(e).properties,parentNames:[...r,e.name]})]}))})]})):null};var Ml=Al;const Dl=Object.values(qr).sort(((e,r)=>e.localeCompare(r)));var Fl=({nodeFieldName:e,control:r})=>a(o,{children:[i(Re,{children:i(nt,{required:!0,control:r,defaultValue:2,name:`${e}.precisionScale`,label:"Precision Scale"})}),i(Re,{children:i(Kr,{required:!0,control:r,name:`${e}.roundingMode`,label:"Rounding Mode",defaultValue:qr.HALF_UP,options:Dl})})]});var Pl=({setValue:e,nodeFieldName:r,control:n,defaultValue:t=""})=>(h((()=>{t&&e(`${r}.format`,t)}),[t,e,r]),i(Re,{children:i(Gr,{required:!0,control:n,defaultValue:t,name:`${r}.format`,label:"Format"})}));const ql={key:"",nodeType:null,name:"",defaultValue:"",value:"",defaultValues:[],isRequired:!0,sortOrder:0,isEnabled:!0,executeValue:"",uiSettings:""};var $l=({setValue:e,control:r,parentNodeFieldName:n,entityDefinition:t=!1,globalParameter:l=!1,entityReferenceValueComponent:s,fileReferenceValueComponent:c})=>{const d=R({control:r,name:`${n}.memberNodes`});return a(o,{children:[i(z,Object.assign({variant:"h6"},{children:"Member Nodes"})),d?a(B,Object.assign({p:4,border:"1px solid rgba(0, 0, 0, 0.23)",borderRadius:3,my:2},{children:[i(di,{setValue:e,control:r,nodeFieldName:`${n}.memberNodes`,entityDefinition:t,globalParameter:l,entityReferenceValueComponent:s,fileReferenceValueComponent:c}),i(M,Object.assign({sx:{marginTop:4},variant:"contained",size:"small",color:"primary",onClick:()=>e(`${n}.memberNodes`,null)},{children:"Delete"}))]})):i(M,Object.assign({variant:"contained",size:"small",color:"primary",onClick:()=>e(`${n}.memberNodes`,ql),sx:{margin:"8px 0"}},{children:"Add node"}))]})};var Bl=({entityDefinition:e,globalParameter:r,customPropertyFields:n,index:t,watch:l,arrLength:o,entityReferenceValueComponent:s,control:c,setValue:d,fileReferenceValueComponent:u,handleRemoveParameter:p,error:m,item:g,extRefs:h,rootNode:b})=>{const[y,v]=f(t===o&&!g.key);return i(Re,Object.assign({sm:12,ref:e=>h.current[t]=e},{children:a(tr,Object.assign({expanded:y,onChange:()=>v(!y),elevation:3},{children:[i(lr,Object.assign({expandIcon:i(or,{})},{children:i(z,Object.assign({color:m&&m[t]?"secondary":"initial",style:{wordBreak:"break-word"}},{children:g.name||`Property ${t+1}`}))})),i(ir,{children:y&&i(di,{isObjectProperty:!0,control:c,setValue:d,nodeFieldName:`properties.${t}`,entityDefinition:e,globalParameter:r,customPropertyFields:n,entityReferenceValueComponent:s,fileReferenceValueComponent:u})}),!b&&i(ar,{children:i(M,Object.assign({variant:"contained",size:"small",color:"secondary",onClick:()=>p(t)},{children:"Remove"}))})]}))}))};const zl={propertyType:null,name:"",defaultValue:"",defaultValues:[],isRequired:!0,isMultiple:!1,sortOrder:0,isEnabled:!0,executeValue:"",uiSettings:""},_l=C((({properties:e,parentFieldName:r,hideAddButton:n,focusOnIndex:t,required:l,entityDefinition:s=!1,globalParameter:c=!1,customPropertyFields:d=[],parentRemove:u,entityReferenceValueComponent:p,fileReferenceValueComponent:m,rootNode:f},y)=>{var v;const{clearErrors:C,control:O,setValue:x,getValues:j,reset:V,trigger:R,watch:N}=k({mode:"all",defaultValues:{properties:e}}),{fields:w,append:L,remove:I}=S({control:O,name:"properties"}),{fieldState:{error:A}}=T({control:O,name:"properties",defaultValue:null,rules:{validate:e=>!l||!Array.isArray(e)||0!==e.length||"Please, fill the properties"}}),D=g([]),F=b((()=>{L(zl),C("properties")}),[L,C]),P=b((e=>{u&&u(e),I(e)}),[u,I]);return h((()=>{"number"==typeof t&&D.current[t]&&D.current[t].scrollIntoView({behavior:"smooth",block:"start"})}),[t,D]),h((()=>{var r;(null==e?void 0:e.length)&&!(null===(r=j("properties"))||void 0===r?void 0:r.length)&&V({properties:e})}),[e,j,V]),E(y,(()=>({getProperties:()=>j("properties"),addProperty:F,removeProperty:P,trigger:R})),[j,F,P,R]),a(o,{children:[A&&A.message&&i(Re,Object.assign({sm:12},{children:i(z,Object.assign({color:"secondary"},{children:A.message}))})),Array.isArray(w)&&w.map(((e,r,n)=>i(Bl,{item:e,index:r,arrLength:n.length-1,control:O,watch:N,setValue:x,customPropertyFields:d,entityDefinition:s,globalParameter:c,error:A,rootNode:f,handleRemoveParameter:P,fileReferenceValueComponent:m,entityReferenceValueComponent:p,extRefs:D},e.id))),!n&&a(Re,Object.assign({xs:12},{children:[i(M,Object.assign({variant:"contained",size:"small",color:"primary",onClick:F},{children:"Add property"})),A&&i(G,Object.assign({error:!0},{children:null===(v=A.root)||void 0===v?void 0:v.message}))]}))]})})),Hl=({properties:e=[]})=>{const r=y((()=>Array.isArray(e)?e.map((e=>{const r=Qn(e);return{label:a(B,Object.assign({display:"flex",flexDirection:"column"},{children:[a("b",{children:[a("b",{children:[e.name,e.isRequired&&"*"]}),""+(e.key?" | "+e.key:"")]}),i("span",{children:r})]})),content:r===Pr.OBJECT&&Array.isArray(e.properties)?i(Hl,{properties:e.properties}):(null==e?void 0:e.memberNodes)&&i(Hl,{properties:e.memberNodes.properties})}})):[]),[e]);return i(Gt,{data:r})};var Jl=Hl;const Gl={key:"",propertyType:null,name:"",defaultValue:"",value:"",defaultValues:[],isRequired:!0,isMultiple:!1,sortOrder:0,isEnabled:!0,executeValue:"",uiSettings:""},Yl=({control:e,parentNodeFieldName:r,entityDefinition:n=!1,globalParameter:t=!1,entityReferenceValueComponent:l,fileReferenceValueComponent:o})=>{const s=g(null),{field:{onChange:d}}=T({control:e,name:`${r}.properties`,defaultValue:null}),u=R({control:e,name:`${r}.properties`,defaultValue:null}),p=R({control:e,name:`${r}.name`}),m=b((e=>{d((null==u?void 0:u.length)?[...u,e]:[e])}),[u,d]),h=b((e=>{d(u.filter(((r,n)=>e!==n)))}),[u,d]),y=Wr(),[v,C]=f(0),O=b((()=>{if((null==u?void 0:u.length)>0){m(Gl);const e=u.length;C(e)}else m(Gl);s.current.addProperty(),d(s.current.getProperties())}),[u,m]),E=()=>c(void 0,void 0,void 0,(function*(){(yield s.current.trigger())&&(d(s.current.getProperties()),y.onClose())}));return a(Re,Object.assign({container:!0,spacing:2,direction:"column"},{children:[i(Re,{children:i(z,Object.assign({variant:"h6"},{children:"Properties"}))}),i(Re,{children:i(Jl,{properties:u})}),i(Re,{children:i(M,Object.assign({variant:"contained",color:"primary",onClick:y.onOpen},{children:"Edit properties"}))}),a(D,Object.assign({disableEscapeKeyDown:!0,open:y.open,onClose:E,fullWidth:!0,maxWidth:"md"},{children:[a($,{children:[p||"Entity"," Properties"]}),i(P,Object.assign({style:{height:"500px",overflow:"hidden"}},{children:a(Re,Object.assign({container:!0,direction:"row",spacing:2,style:{height:"100%"}},{children:[a(Re,Object.assign({xs:3,style:{backgroundColor:"#f9f9f9",height:"100%",overflowY:"auto"}},{children:[i(sr,Object.assign({nonLinear:!0,activeStep:v,orientation:"vertical",style:{paddingLeft:"4px"}},{children:Array.isArray(u)&&(null==u?void 0:u.map(((e,r)=>a(cr,Object.assign({onClick:()=>(e=>C(e))(r),style:{cursor:"pointer"}},{children:[i(dr,Object.assign({StepIconProps:{icon:""},style:{wordBreak:"break-word"}},{children:e.name||"(no name)"})),i(ur,{})]}),r))))})),i(M,Object.assign({variant:"contained",size:"small",color:"primary",onClick:O,sx:{marginTop:2}},{children:"Add property"}))]})),i(Re,Object.assign({container:!0,wrap:"nowrap",direction:"column",spacing:2,style:{height:"100%",overflowY:"auto",width:"75%"}},{children:i(_l,{ref:s,properties:u,hideAddButton:!0,parentRemove:h,focusOnIndex:v,entityDefinition:n,globalParameter:t,entityReferenceValueComponent:l,fileReferenceValueComponent:o})}))]}))})),i(F,{children:i(M,Object.assign({variant:"contained",color:"primary",onClick:E},{children:"Ok"}))})]}))]}))};var Wl=({propertyFieldName:e,control:r})=>a(o,{children:[i(Re,{children:i(Gr,{required:!0,control:r,name:`${e}.definitionCode`,label:"Definition Code"})}),i(Re,{children:i(Gr,{required:!0,control:r,name:`${e}.definitionVersion`,label:"Definition Version",defaultValue:1})}),i(Re,{children:i(Gr,{required:!0,control:r,name:`${e}.labelPropertyCode`,label:"Label Property Code"})}),i(Re,{children:i(Gr,{required:!0,control:r,name:`${e}.valuePropertyCode`,label:"Value Property Code"})})]});const Ul=({setValue:e,control:r,nodeType:n,nodeFieldName:t,entityDefinition:l=!1,globalParameter:s=!1,fileReferenceValueComponent:c,entityReferenceValueComponent:d})=>{switch(n){case Pr.STRING:return a(o,{children:[i(z,Object.assign({variant:"h6",mb:1},{children:"Restricted Values"})),i(dt,{name:`${t}.restrictedValues`,control:r})]});case Pr.BIG_DECIMAL:return i(Fl,{nodeFieldName:t,control:r});case Pr.DATE:return i(Pl,{setValue:e,control:r,nodeFieldName:t,defaultValue:Mr});case Pr.TIME:return i(Pl,{setValue:e,control:r,nodeFieldName:t,defaultValue:Dr});case Pr.DATE_TIME:return i(Pl,{setValue:e,control:r,nodeFieldName:t,defaultValue:Fr});case Pr.ENTITY_REFERENCE:return i(Wl,{control:r,propertyFieldName:t});case Pr.OBJECT:return i(Yl,{control:r,parentNodeFieldName:t,globalParameter:s,entityDefinition:l,fileReferenceValueComponent:c,entityReferenceValueComponent:d});case Pr.ARRAY:return i($l,{setValue:e,control:r,parentNodeFieldName:t,globalParameter:s,entityDefinition:l,fileReferenceValueComponent:c,entityReferenceValueComponent:d});default:return null}},Zl=({control:e,nodeFieldName:r,name:n,label:t="",required:l,entityReferenceValueComponent:a,fileReferenceValueComponent:o})=>{const s=R({control:e,name:`${r}.nodeType`}),c=R({control:e,name:`${r}.format`}),d=R({control:e,name:`${r}.restrictedValues`}),u=R({control:e,name:`${r}.properties`}),p=R({control:e,name:`${r}.isRequired`}),m=y((()=>Object.assign(Object.assign(Object.assign(Object.assign({name:t,isRequired:null!=l?l:p},!!c&&{format:c}),{restrictedValues:d}),!!u&&{properties:u}),{nodeType:"string"==typeof s?s:s.value,defaultValue:null,defaultValues:[],sortOrder:0,isEnabled:!0,uiSettings:null,validationNode:null})),[s,c,d,t,p,u,l]);return i(gr,Object.assign({dateAdapter:mr},{children:"ARRAY"===m.nodeType?i(Rl,{control:e,name:n,node:m,title:t,required:l,entityReferenceValueComponent:a,fileReferenceValueComponent:o}):i(Ol,{control:e,name:n,node:m,title:t,required:l,entityReferenceValueComponent:a,fileReferenceValueComponent:o})}))};var Kl=({name:e,control:r,setValue:n})=>{const t=y((()=>({type:""})),[]),{fields:l,append:o,remove:s}=S({control:r,name:e});return a(B,Object.assign({mt:2},{children:[i(M,Object.assign({variant:"outlined",size:"small",onClick:()=>o(t)},{children:"Add node"})),l.map((({id:t},l)=>i(ai,{setValue:n,control:r,removeHandle:()=>s(l),name:`${e}.${l}`},t)))]}))};const Xl=x(""),Ql=({name:e,control:r})=>a(o,{children:[i(z,Object.assign({variant:"body2",gutterBottom:!0},{children:"Node"})),i(B,{children:i(Gr,{control:r,name:`${e}.minimumLength`,label:"Minimum Length",type:"number"})}),i(B,Object.assign({mt:2},{children:i(Gr,{control:r,name:`${e}.maximumLength`,label:"Maximum Length",type:"number"})}))]}),ei=({name:e,control:r})=>a(o,{children:[i(z,Object.assign({variant:"body2",gutterBottom:!0},{children:"Node"})),i(B,{children:i(Gr,{control:r,name:`${e}.multipleOf`,label:"Multiple Of",type:"number"})}),i(B,Object.assign({mt:2},{children:i(Gr,{control:r,name:`${e}.minimum`,label:"Minimum",type:"number"})})),i(B,Object.assign({mt:2},{children:i(Gr,{control:r,name:`${e}.maximum`,label:"Maximum",type:"number"})})),a(B,Object.assign({mt:2},{children:[i(Xr,{control:r,name:`${e}.exclusiveMinimum`,label:"Exclusive Minimum"}),i(Xr,{control:r,name:`${e}.exclusiveMaximum`,label:"Exclusive Maximum"})]}))]}),ri=["STRING_REGEX","JSON_SCHEMA"],ni=new Set([Ar.INTEGER,Ar.FLOAT,Ar.DOUBLE,Ar.BIG_DECIMAL,Ar.BIG_INTEGER,Ar.LONG]);var ti=({name:e,control:r,setValue:n})=>{const t=j(Xl),l=R({control:r,name:`${e}.type`}),s=y((()=>{if("STRING_REGEX"===l)return i(Gr,{control:r,name:`${e}.pattern`,label:"Pattern"});if("JSON_SCHEMA"===l)switch(!0){case t===Ar.STRING:return i(Ql,{name:`${e}.node`,control:r});case ni.has(t):return i(ei,{name:`${e}.node`,control:r});case t===Ar.JSON:return i(pn,{label:"Properties",control:r,name:`${e}.properties`,validateJson:!0,parseValue:!0});default:return"Not available for type "+t}return null}),[t,l,r,e]);return h((()=>{ni.has(t)&&"JSON_SCHEMA"===l&&(n(`${e}.node.exclusiveMinimum`,!1),n(`${e}.node.exclusiveMaximum`,!1))}),[t,l,n,e]),i(Gt,{data:[{label:"Validator",content:a(o,{children:[i(B,{children:i(Kr,{control:r,name:`${e}.type`,label:"Type",options:ri,onChange:r=>{n(e,{}),n(`${e}.type`,r.target.value)}})}),i(B,Object.assign({mt:2},{children:s}))]})}]})};const li=["AND","OR","NOT","NODE"],ii=({name:e,removeHandle:r,control:n,setValue:t})=>{const l=R({control:n,name:`${e}.type`}),s=y((()=>({AND:i(Kl,{name:`${e}.nodes`,control:n,setValue:t}),OR:i(Kl,{name:`${e}.nodes`,control:n,setValue:t}),NODE:i(ti,{name:`${e}.validator`,control:n,setValue:t}),NOT:i(ii,{name:`${e}.node`,control:n,setValue:t})})),[e,n,t]);return i(Gt,{data:[{label:"Node Type",content:a(o,{children:[a(B,Object.assign({display:"flex",alignItems:"flex-end"},{children:[i(Kr,{required:!0,control:n,name:`${e}.type`,label:"Type",options:li}),r&&i(B,Object.assign({ml:2},{children:i(I,Object.assign({onClick:r,color:"primary"},{children:i(yr,{})}))}))]})),i(B,{children:s[l]})]})}]})};var ai=ii;const oi=({name:e,control:r,setValue:n,validator:t})=>{const[l,s]=f(!1),c=b((r=>{s(r.target.checked),r.target.checked||n(e,null)}),[n,e]);return h((()=>{t&&!l&&s(!0)}),[l,t]),a(o,{children:[a(B,Object.assign({display:"flex",justifyContent:"space-between",alignItems:"center"},{children:[i(z,Object.assign({component:"h6",color:"initial",style:{wordBreak:"break-word",fontSize:18}},{children:"Validator"})),i(J,{label:"Enable",control:i(Y,{color:"primary",checked:l,onChange:c})})]})),l&&i(ai,{name:e,control:r,setValue:n})]})};var si=e=>({customCheckboxes:y((()=>e.length?e.filter((e=>"checkbox"===e.type)):[]),[e]),customFields:y((()=>e.length?e.filter((e=>"checkbox"!==e.type)):[]),[e]),validateKey:b((e=>{const r=[...new Set(e.replace(/[a-zA-Z0-9]/g,"").split(""))];return!((null==r?void 0:r.length)>0)||"Delete invalid characters: "+r.join(", ").replace(", ,",",")}),[])});const ci=Object.values(Pr).sort(((e,r)=>e.localeCompare(r))).map((e=>({value:e,label:e.replace("_"," ").toLowerCase().replace(/(^\w)|([-\s]\w)/g,(e=>e.toUpperCase()))}))),di=O((({setValue:e,control:r,nodeFieldName:n,entityDefinition:t=!1,globalParameter:l=!1,customPropertyFields:s=[],entityReferenceValueComponent:c,fileReferenceValueComponent:d,isObjectProperty:u,isObjectNode:p})=>{var m,g;const f=R({control:r,name:`${n}.nodeType`}),b=R({control:r,name:`${n}.isRequired`});R({control:r,name:`${n}.uiSettings`});const v=R({control:r,name:`${n}.validationNode`}),{customCheckboxes:C,customFields:O,validateKey:E}=si(s),x=y((()=>l?"Value":"Default Value"),[l]);h((()=>{f&&"string"==typeof f&&!p?e(`${n}.nodeType`,ci.find((e=>e.value===f))):p&&e(`${n}.nodeType`,ci.find((e=>e.value===Pr.OBJECT)))}),[f,e,n,p]);const j=y((()=>{let e=ci;return l&&(e=ci.filter((e=>e.value!==Pr.ANY))),e}),[c,l]),V=!l||(null!==(m=null==f?void 0:f.value)&&void 0!==m?m:f)!==Pr.OBJECT;return a(Re,Object.assign({container:!0,direction:"column",spacing:2},{children:[u&&i(Re,{children:i(Gr,{required:!0,control:r,name:`${n}.key`,label:"Key",validate:E})}),i(Re,{children:i(Gr,{required:!0,control:r,name:`${n}.name`,label:"Name"})}),i(Re,{children:i(on,{required:!0,control:r,name:`${n}.nodeType`,label:"Type",options:j,disabled:p,onChange:(r,t)=>{const i=`${n}.nodeType`;e(`${n}.${l?"value":"defaultValue"}`,null),e(i,t)}})}),i(Re,{children:i(nt,{required:!0,control:r,name:`${n}.sortOrder`,label:"Sort Order"})}),i(Re,{children:i(pn,{control:r,name:`${n}.uiSettings`,label:"UI Settings",validateJson:!0,parseValue:!0})}),a(Re,{children:[i(Xr,{control:r,name:`${n}.isEnabled`,label:"Enabled"}),i(Xr,{control:r,name:`${n}.isRequired`,label:"Required"}),t&&i(Xr,{control:r,name:`${n}.isViewableInList`,label:"Is viewable in list"}),C.length?i(o,{children:C.map(((e,t)=>i(Xr,{control:r,name:`${n}.${e.name}`,label:e.label,checked:e.checked,defaultValue:e.defaultValue},t)))}):null]}),f&&a(o,{children:[i(Re,{children:i(Xl.Provider,Object.assign({value:null!==(g=f.value)&&void 0!==g?g:f},{children:i(oi,{control:r,setValue:e,validator:v,name:`${n}.validationNode`})}))}),i(Re,{children:i(Ul,{setValue:e,control:r,nodeType:"string"==typeof f?f:f.value,nodeFieldName:n,globalParameter:l,entityDefinition:t,fileReferenceValueComponent:d})}),V&&i(Re,{children:i(Zl,{control:r,nodeFieldName:n,name:`${n}.${l?"value":"defaultValue"}`,label:x,required:!!l&&b,fileReferenceValueComponent:d})})]})]}))})),ui=C((({node:e,entityDefinition:r=!1,globalParameter:n=!1,customPropertyFields:t=[],entityReferenceValueComponent:l,fileReferenceValueComponent:o,isObjectNode:s},c)=>{const{control:d,setValue:u,trigger:p,getValues:m,watch:g,reset:f}=k({mode:"all",defaultValues:{node:e}});return E(c,(()=>({getValues:()=>m("node"),trigger:p})),[m,p]),h((()=>{e&&f({node:e})}),[e,f]),a(B,Object.assign({mt:2},{children:[i(z,Object.assign({component:"h6",color:"initial",mb:3,style:{wordBreak:"break-word",fontSize:18}},{children:"Node Configuration"})),i(di,{control:d,setValue:u,nodeFieldName:"node",isObjectNode:s,entityDefinition:r,globalParameter:n,customPropertyFields:t,entityReferenceValueComponent:l,fileReferenceValueComponent:o})]}))})),pi=({control:e,parentFieldName:r,required:n,entityDefinition:t=!1,globalParameter:l=!1,customPropertyFields:o=[],entityReferenceValueComponent:s,fileReferenceValueComponent:c,isObjectNode:d})=>{const u=y((()=>r?`${r}.node`:"node"),[r]),{setValue:p,watch:m}=N(),{fieldState:{error:g}}=T({control:e,name:u,rules:{validate:e=>!n||!Array.isArray(e)||0!==e.length||"Please, fill the properties"}});return a(B,Object.assign({mt:2},{children:[g&&g.message&&i(Re,Object.assign({sm:12},{children:i(z,Object.assign({color:"secondary"},{children:g.message}))})),i(z,Object.assign({component:"h6",color:"initial",mb:3,sx:{wordBreak:"break-word",fontSize:18}},{children:"Node Configuration"})),i(di,{control:e,setValue:p,isObjectNode:d,nodeFieldName:u,entityDefinition:t,globalParameter:l,customPropertyFields:o,entityReferenceValueComponent:s,fileReferenceValueComponent:c})]}))},mi=C((({control:e,definitionFieldName:r,isObjectNode:n,title:t,hideCodeField:l,hideVersionField:o,hideNameField:s,required:c=!1,entityReferenceValueComponent:d,fileReferenceValueComponent:u},p)=>{const{control:m,getValues:g}=N(),h=g(r?`${r}.node`:"node");return a(Re,Object.assign({container:!0,direction:"column",spacing:2},{children:[t&&i(Re,Object.assign({sm:12},{children:i(B,Object.assign({my:2},{children:i(z,Object.assign({variant:"h6"},{children:t}))}))})),!s&&i(Re,Object.assign({sm:12},{children:i(Gr,{required:!0,control:null!=e?e:m,name:r?`${r}.name`:"name",label:"Name"})})),!l&&i(Re,Object.assign({sm:12},{children:i(Gr,{required:!0,control:null!=e?e:m,name:r?`${r}.code`:"code",label:"Code"})})),!o&&i(Re,Object.assign({sm:12},{children:i(nt,{required:!0,control:null!=e?e:m,name:r?`${r}.version`:"version",label:"Version"})})),i(Re,Object.assign({sm:12},{children:p?i(ui,{node:h,ref:p,isObjectNode:n,entityReferenceValueComponent:d,fileReferenceValueComponent:u}):i(pi,{control:e,required:c,isObjectNode:n,parentFieldName:r,entityReferenceValueComponent:d,fileReferenceValueComponent:u})}))]}))})),gi={name:"Name",key:"Key",propertyType:"Property Type",defaultValue:"Default Value",defaultValues:"Default Values",sortOrder:"Sort Order",isRequired:"Required",isMultiple:"Multiple",isEnabled:"Enabled",isViewableInList:"Is Viewable In List",precisionScale:"Precision Scale",roundingMode:"Rounding Mode",format:"Format",definitionCode:"Definition Code",definitionVersion:"Definition Version",labelPropertyCode:"Label Property Code",valuePropertyCode:"Value Property Code",restrictedValues:"Restricted Values",value:"Value",values:"Values",uiSettings:"UI Settings",validationNode:"Validation Node"},hi=({value:e,type:r})=>r!==Ar.JSON&&r!==Ar.ENTITY&&r!==Ar.ANY||!e?i(z,Object.assign({variant:"subtitle1",display:"inline",style:{wordBreak:"break-word"}},{children:null===e?"null":e.toString()})):i(Cn,{value:e}),fi=(e,r,n)=>{switch(r){case"isRequired":case"isMultiple":case"isEnabled":case"isViewableInList":return e?i(L,Object.assign({color:"primary",fontSize:"small"},{children:i("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})})):null;case"restrictedValues":return e?i(B,Object.assign({display:"flex",flexWrap:"wrap"},{children:e.map((e=>i(Te,{label:e,style:{wordBreak:"break-word",maxWidth:"500px"}},e)))})):null;case"defaultValue":case"value":return i(hi,{value:e,type:n});case"values":case"defaultValues":return Array.isArray(e)&&n!==Ar.ENTITY&&n!==Ar.JSON&&n!==Ar.ANY?a("div",{children:["[",null==e?void 0:e.map(((e,r)=>i("div",{children:i(hi,{value:e,type:n})},r))),"]"]}):i(Cn,{value:e});case"uiSettings":case"validationNode":return e?i(Cn,{value:e}):null;default:return i(z,Object.assign({variant:"subtitle1",display:"inline",style:{wordBreak:"break-word"}},{children:e}))}};var bi=({property:e})=>{const r=y((()=>(e&&(e.isMultiple?(delete e.defaultValue,delete e.value):(delete e.defaultValues,delete e.values)),e)),[e]);return i(_e,Object.assign({size:"small"},{children:i(He,{children:Object.keys(gi).map((e=>e in r?a(We,{children:[i(Je,Object.assign({width:"30%"},{children:i(z,{children:gi[e]})})),i(Je,{children:fi(r[e],e,r.propertyType)})]},e):null))})}))};var yi=O((({properties:e,parentNames:r=[]})=>{const n=y((()=>{if(!e)return!1;let r=!1;return e.every((e=>e.propertyType!==Ar.ENTITY||(r=!0,!1))),r}),[e]);return a(B,Object.assign({mt:4},{children:[i(z,Object.assign({variant:"h6"},{children:"Properties"})),a(sr,Object.assign({orientation:"vertical",style:{paddingLeft:"4px"}},{children:[null==e?void 0:e.map((e=>a(cr,Object.assign({expanded:!0},{children:[i(dr,{StepIconProps:{icon:"",completed:!1,active:!0}}),i(ur,{children:i(vi,{property:e,parentNames:[...r],defaultExpanded:!1})})]}),e.key))),n&&i(cr,{})]}))]}))}));const vi=({property:e,parentNames:r=[],defaultExpanded:n=!0})=>{const[t,l]=f(!0);return h((()=>{l(n)}),[n]),a(tr,Object.assign({elevation:3,style:{backgroundColor:r.length%2==1?"#f1f1f1":"#fff"},expanded:t,onChange:()=>l((e=>!e))},{children:[i(lr,Object.assign({expandIcon:i(L,{children:i("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})})},{children:i(z,Object.assign({style:{wordBreak:"break-word",fontWeight:"600"}},{children:e.name}))})),i(ir,{children:a(B,Object.assign({width:"100%"},{children:[i(bi,{property:e}),e.propertyType===Ar.ENTITY&&i(yi,{properties:$n(e.properties),parentNames:[...r,e.name]})]}))})]}))},Ci=({properties:e,expandAll:r=!0})=>{const n=y((()=>Array.isArray(e)?e:e?$n(e):[]),[e]);return i(B,Object.assign({display:"flex",flexDirection:"column"},{children:n.length?n.map((e=>i(vi,{property:e,defaultExpanded:r},e.key))):i(z,{children:"No properties"})}))},Oi=({property:e,name:r,useExpression:n,label:t,required:l,title:o,entityReferenceDefinitionSources:s,entityReferenceValueComponent:c,fileReferenceValueComponent:d,requiredErrorText:p=""})=>{const{control:m,clearErrors:f,setValue:y}=N(),{field:{value:v},fieldState:{error:C,isDirty:O}}=T({name:r,control:m,rules:{validate:e=>!l||null!==e||(p||Hr)}}),E=g({}),{propertyType:x,valueLabel:j,fillOptionLabel:V,fillOption:R,fillOptions:w,setFillOption:S,defaultProperyValue:k}=nl({value:v,property:e,isDirty:O,label:t,required:l,useExpression:n}),L=b((n=>{const t=n.target.value;E.current=Object.assign(Object.assign({},E.current),{[R]:v}),S(t);const l=E.current[t];if("null"===t)y(r,null,{shouldDirty:!0});else if("widget"===t)if(x===Ar.JSON&&v&&"string"!=typeof v&&"dem_builder"===R&&"properties"in v){const e=Object.assign(Object.assign({},v),{properties:qn(v.property||[])});try{y(r,null!=l?l:JSON.stringify(e,null,"\t"))}catch(e){console.log("Stringify failed",e)}}else y(r,null!=l?l:e.defaultValue||k);else if("expression"===t||"string"===t)y(r,null!=l?l:"",{shouldDirty:!0});else if("dem_builder"===t){const e={code:"",name:"",version:0,properties:[]};if(v)try{const e=JSON.parse(v);e.properties=$n(e.properties||{}),y(r,null!=l?l:e,{shouldDirty:!0})}catch(n){y(r,null!=l?l:e,{shouldDirty:!0})}else y(r,null!=l?l:e,{shouldDirty:!0})}f()}),[r,f,v,S,R,x,e,y,k]);return h((()=>{O||fr(e.defaultValue||e.value)||""===e.defaultValue&&""===e.value||!fr(v)||y(r,e.defaultValue||e.value)}),[O,e,y,v,r]),h((()=>{var n;(void 0===v||e.isRequired&&null===v&&!e.defaultValue&&!e.value)&&y(r,null!==(n=E.current[R])&&void 0!==n?n:k),void 0!==v||e.isRequired||null!==e.defaultValue&&null!==e.value||y(r,null)}),[v,y,r,k,e,R]),a(Re,Object.assign({xs:12},{children:[o&&i(B,Object.assign({mb:2},{children:i(z,Object.assign({variant:"h6"},{children:o}))})),w?i(B,Object.assign({mb:2},{children:a(H,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[i(tl,Object.assign({htmlFor:"type-select"},{children:V})),i(hr,Object.assign({labelId:"type-select",label:V,value:R||"",onChange:L},{children:w.map((e=>i(u,Object.assign({value:e.value},{children:e.label}),e.value)))}))]}))})):null,"expression"===R&&(x===Ar.JSON||x===Ar.ENTITY||x===Ar.ANY?i(pn,{name:r,control:m,label:j,parseValue:!0,hideErrorMessage:!0,useCleanValue:!0,mode:x===Ar.ANY?"text":"json"}):i(Gr,{control:m,name:r,label:j,hideErrorMessage:!0})),"string"===R&&i(Gr,{control:m,name:r,label:j,hideErrorMessage:!0}),"json_notvalid"===R&&i(pn,{name:r,control:m,label:j,hideErrorMessage:!0}),"widget"===R&&i(rl,{control:m,property:e,name:r,useExpression:n,label:j,entityReferenceDefinitionSources:s,entityReferenceValueComponent:c,fileReferenceValueComponent:d}),"dem_builder"===R&&i(bl,{title:"JSON",definitionFieldName:r,entityReferenceDefinitionSources:s,entityReferenceValueComponent:c,fileReferenceValueComponent:d}),C&&i(G,Object.assign({error:!0},{children:C.message}))]}))};var Ei=({name:e,property:r,useExpression:n,required:t,label:l,entityReferenceDefinitionSources:o,entityReferenceValueComponent:s,fileReferenceValueComponent:c})=>{const{control:d,setValue:u,clearErrors:p}=N(),m=R({control:d,name:e}),{defaultProperyValue:g}=nl({value:m,property:r,isDirty:!1,label:l,required:t}),h=b((()=>{m&&Array.isArray(m)?u(`${e}.${m.length}`,g):u(e,[g]),p(e)}),[e,m,u,p,g]),f=b((r=>{u(e,mn(m,r))}),[e,m,u]);return a(Re,Object.assign({container:!0,spacing:2,direction:"column",xs:12},{children:[Array.isArray(m)&&m.length?m.map(((d,u)=>i(Re,Object.assign({xs:12},{children:a(B,Object.assign({display:"flex",alignItems:"flex-start",width:"100%",p:2,style:{backgroundColor:"#f1f1f1"}},{children:[i(Oi,{required:t,property:r,useExpression:n,name:`${e}.${u}`,label:`${l||r.name} (${u+1})`,entityReferenceDefinitionSources:o,entityReferenceValueComponent:s,fileReferenceValueComponent:c}),i(B,Object.assign({mt:"8px",ml:"4px"},{children:i(I,Object.assign({id:"close-button",size:"small",onClick:()=>f(u)},{children:i(L,Object.assign({fontSize:"small"},{children:i("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})}))}))}))]}))}),u))):null,i(Re,{children:i(M,Object.assign({variant:"contained",size:"small",color:"primary",onClick:h},{children:"Add value"}))})]}))};const xi=({property:e,name:r,useExpression:n,required:t,label:l,title:o,entityReferenceDefinitionSources:s,entityReferenceValueComponent:c,fileReferenceValueComponent:d,requiredErrorText:p=""})=>{var m;const[b,y]=f(!1),{control:v,clearErrors:C,setValue:O,watch:E}=N(),{field:{ref:x,onChange:j},fieldState:{error:V,isDirty:R}}=T({control:v,name:r,defaultValue:null!==(m=e.defaultValue)&&void 0!==m?m:[],rules:{validate:e=>!(t&&!e)||(p||Hr)}}),w=E(r),S=g({}),{propertyType:k,valueLabel:L,fillOptionLabel:I,fillOption:A,fillOptions:M,setFillOption:D,checkFillOption:F}=nl({property:e,value:w,isDirty:R,label:l,required:t,useExpression:n,multipleOptions:!0});return h((()=>{w||j(e.isRequired&&e.isMultiple?[]:null)}),[w,e,j]),h((()=>{w&&!b&&(y(!0),F())}),[F,b,w]),a(Re,{children:[o&&i(B,Object.assign({mb:2},{children:i(z,Object.assign({variant:"h6"},{children:o}))})),M?i(B,Object.assign({mb:2},{children:a(H,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[i(tl,Object.assign({htmlFor:"type-select"},{children:I})),i(hr,Object.assign({labelId:"type-select",label:I,value:A||"",onChange:e=>{y(!0),S.current=Object.assign(Object.assign({},S.current),{[A]:w});const n=e.target.value,t=S.current[n];"null"===n?O(r,null):"expression"===n||"json_valid"===n||"json_notvalid"===n?O(r,null!=t?t:"",{shouldDirty:!0}):"widget"===n&&O(r,null!=t?t:[],{shouldDirty:!0}),D(n),C(r)}},{children:M.map((e=>i(u,Object.assign({value:e.value},{children:e.label}),e.value)))}))]}))})):null,"expression"===A&&(k===Ar.JSON||k===Ar.ENTITY||k===Ar.ANY?i(pn,{name:r,control:v,label:L,parseValue:!0,hideErrorMessage:!0,useCleanValue:!0,mode:k===Ar.ANY?"text":"json"}):i(Gr,{required:!0,hideErrorMessage:!0,control:v,name:r,label:L})),"json_valid"===A&&i(pn,{name:r,control:v,label:L,parseValue:!0,validateJson:!0,hideErrorMessage:!0}),"widget"===A&&i(Ei,{property:e,name:r,useExpression:n,required:t,label:l,entityReferenceDefinitionSources:s,entityReferenceValueComponent:c,fileReferenceValueComponent:d}),V&&i(G,Object.assign({error:!0},{children:V.message}))]})},ji=({properties:e,dataFieldName:r,useExpression:n=!1,title:t,entityReferenceDefinitionSources:l,entityReferenceValueComponent:o,fileReferenceValueComponent:s})=>{const c=y((()=>e?e.map((e=>{var t;const c="string"==typeof e.propertyType?e.propertyType:null===(t=e.propertyType)||void 0===t?void 0:t.value;return{label:a(B,Object.assign({display:"flex",flexDirection:"column"},{children:[a("b",{children:[e.name,e.isRequired?"*":""]}),a("span",{children:[e.key," | ",e.isMultiple?"multiple":"single"," |"," ",c]})]})),content:e.isMultiple?i(xi,{property:e,name:`${r}.${e.key}`,useExpression:n,label:e.name,required:e.isRequired,entityReferenceValueComponent:o,fileReferenceValueComponent:s,entityReferenceDefinitionSources:l}):i(Oi,{property:e,name:`${r}.${e.key}`,useExpression:n,label:e.name,required:e.isRequired,entityReferenceDefinitionSources:l,entityReferenceValueComponent:o,fileReferenceValueComponent:s})}})):[]),[e,r,n,o,l,s]);return i(gr,Object.assign({dateAdapter:mr},{children:a(Re,Object.assign({container:!0,direction:"column",spacing:2},{children:[t&&i(Re,Object.assign({xs:12},{children:i("div",Object.assign({style:{fontWeight:"600"}},{children:t}))})),i(Gt,{data:c})]}))}))},Vi=({node:e,dataFieldName:r,useExpression:n=!1,title:t,entityReferenceValueComponent:l,fileReferenceValueComponent:o})=>{const s=b(((e,r)=>Qn(e)===Pr.ARRAY?i(Vl,{node:e,name:r,useExpression:n,label:e.name,required:e.isRequired,entityReferenceValueComponent:l,fileReferenceValueComponent:o}):i(xl,{node:e,name:r,useExpression:n,label:e.name,required:e.isRequired,entityReferenceValueComponent:l,fileReferenceValueComponent:o})),[n,o,l]),c=b(((e,r)=>{if(e){const n=Qn(e);return{label:a(B,Object.assign({display:"flex",flexDirection:"column"},{children:[a("b",{children:[e.name,e.isRequired?"*":""]}),i("span",{children:`${e.key?e.key+" | ":""}${n}`})]})),content:s(e,r)}}return null}),[s]);return i(gr,Object.assign({dateAdapter:mr},{children:a(Re,Object.assign({container:!0,direction:"column",spacing:2},{children:[t&&i(Re,Object.assign({xs:12},{children:i("div",Object.assign({style:{fontWeight:"600"}},{children:t}))})),i(Gt,{data:[c(Un(e),r)]})]}))}))};var Ti=({property:e,data:r})=>{const{name:n}=e,t=b(((e,r)=>{const n=e,t=document.createElement("a");document.body.appendChild(t),t.href=n,t.target="_self",t.download=r,t.click()}),[]);return i(M,Object.assign({component:"label",variant:"contained",size:"large",color:"primary",onClick:()=>t(r,n)},{children:"Download File"}))};const Ri=({property:e,data:r,properties:n})=>{const t=e=>i(B,Object.assign({style:{backgroundColor:"#fff",border:"1px solid #ccc",borderRadius:"4px",padding:"4px",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}},{children:null===e?"null":e.toString()}));switch(e.propertyType){case Ar.JSON:return i(Cn,{value:r});case Ar.ENTITY:return i(wi,{properties:n,data:r});case Ar.ANY:return"object"==typeof r?i(Cn,{value:r}):t(r);case Ar.FILE_REFERENCE:return null===r?t(r):i(M,Object.assign({component:oe,color:"primary",variant:"contained",target:"_blank",to:r,sx:{marginTop:4}},{children:"Download via link"}));case Ar.FILE:return null===r?t(r):i(Ti,{data:r,property:e});default:return t(r)}};var Ni=({property:e,data:r,hasBackground:n=!1})=>{const t=y((()=>e.propertyType===Ar.ENTITY?Array.isArray(e.properties)?e.properties:$n(e.properties):[]),[e]);return i(B,Object.assign({style:{backgroundColor:n?"#f1f1f1":"none"}},{children:i(Ri,{property:e,data:r,properties:t})}))};const wi=({properties:e,data:r})=>{const n=y((()=>e&&r?e.map((e=>{const{key:n,name:t,isMultiple:l,propertyType:s}=e,c=r[e.key]?r[e.key]:null;return{label:a(B,Object.assign({display:"flex",flexDirection:"column"},{children:[i("b",{children:t}),a("span",{children:[n," | ",l?"multiple":"single"," | ",s]})]})),content:l&&Array.isArray(c)&&e.propertyType!==Ar.ANY?i(o,{children:c.map(((r,n)=>i(B,Object.assign({mb:2},{children:i(Ni,{property:e,data:r,hasBackground:!0})}),n)))}):i(Ni,{property:e,data:c})}})):[]),[e,r]);return i(Re,Object.assign({container:!0,direction:"column",spacing:2},{children:i(Gt,{data:n})}))};var Si=({node:e,data:r})=>{const{name:n}=e,t=b(((e,r)=>{const n=e,t=document.createElement("a");document.body.appendChild(t),t.href=n,t.target="_self",t.download=r,t.click()}),[]);return i(M,Object.assign({component:"label",variant:"contained",size:"large",color:"primary",onClick:()=>t(r,n)},{children:"Download File"}))};const ki=({node:e,data:r})=>{var n;const t=e=>i(B,Object.assign({sx:{borderRadius:"4px",padding:"4px",wordBreak:"auto-phrase"}},{children:fr(e)?"null":vr(e)?JSON.stringify(e,null,2):e.toString()}));switch(Qn(e)){case Pr.ARRAY:return Array.isArray(r)?i("div",{children:null==r?void 0:r.map((r=>i(ki,{node:e.memberNodes,data:vr(r)?r:r+","})))}):t(r);case Pr.OBJECT:return Array.isArray(e.properties)&&(null===(n=e.properties)||void 0===n?void 0:n.length)?i(Ii,{node:e,data:r}):"object"==typeof r?i(Cn,{value:r}):t(r);case Pr.ANY:return"object"==typeof r?i(Cn,{value:r}):t(r);case Pr.FILE_REFERENCE:return null===r?t(r):i(M,Object.assign({component:oe,color:"primary",variant:"contained",target:"_blank",to:r,sx:{marginTop:4}},{children:"Download via link"}));case Pr.FILE:return fr(r)?t(r):"string"==typeof r?i(Si,{data:r,node:e}):t(r);default:return t(r)}};var Li=({node:e,data:r,hasBackground:n=!1})=>i(B,Object.assign({sx:{backgroundColor:n?"#f1f1f1":"none"}},{children:i(ki,{node:e,data:r})}));const Ii=({node:e,data:r})=>{const n=b(((e,r)=>{var t;if(e&&r){const l=e.key?r[e.key]:r,o=Qn(e);return{label:a(B,Object.assign({display:"flex",flexDirection:"column"},{children:[a("span",{children:[a("b",{children:[e.name,e.isRequired&&"*"]}),""+(e.key?" | "+e.key:"")]}),i("span",{children:o})]})),content:o===Pr.OBJECT&&Array.isArray(e.properties)&&(null===(t=e.properties)||void 0===t?void 0:t.length)?e.properties.map((e=>n(e,l))):i(Li,{node:e,data:l})}}return null}),[]);return i(Re,Object.assign({container:!0,direction:"column",spacing:2},{children:i(Gt,{data:[n(e,r)]})}))},Ai=t(B)((({theme:e})=>({backgroundColor:"#eee",fontSize:"14px",padding:"0 8px",borderRadius:"10px",width:"fit-content","&.success":{backgroundColor:"#a9dfa9"},"&.error":{backgroundColor:"#ff7e7e"},"&.warning":{backgroundColor:e.palette.warning.main}}))),Mi=({text:e,status:r="default"})=>i(Ai,Object.assign({className:Cr("root",{[r]:!0})},{children:e})),Di=({properties:e,parentKey:r="",activePath:n="",prefix:t="",onClick:l})=>i(sr,Object.assign({orientation:"vertical",onClick:e=>e.stopPropagation()},{children:e&&e.map((e=>{var o;const s=r?`${r}.${e.key}`:e.key,c=null!==(o=e.propertyType.value)&&void 0!==o?o:e.propertyType;return a(cr,Object.assign({expanded:!0,onClick:()=>{return e=s,void l(t?`${t}.${e}`:e);var e}},{children:[i(dr,Object.assign({StepIconProps:{icon:"",completed:!1,active:n===s}},{children:a(B,Object.assign({sx:{propertyStepLabel:{"&:hover":{fontWeight:"600",cursor:"pointer"}}}},{children:[e.name," - ",e.key," - ",c]}))})),i(ur,{children:i("div",{children:c===Ar.ENTITY&&i(Di,{onClick:l,activePath:n,properties:e.properties,parentKey:s},e.key)})})]}),e.key)}))}));var Fi=Di;const Pi=({open:e=!1,onClose:r,onPaste:n,properties:t})=>{const[l,o]=f("");return a(D,Object.assign({open:e,onClose:r,fullWidth:!0,maxWidth:"md"},{children:[i($,{children:"JSON path picker"}),a(P,{children:[(null==t?void 0:t.length)?t.map(((e,r)=>a("div",{children:[i(z,Object.assign({variant:"h6"},{children:e.title})),i(Fi,{properties:e.properties,prefix:e.pathPrefix,onClick:o,activePath:l})]},r))):i(z,{children:"Please, add properties"}),l&&a(z,Object.assign({variant:"h6",gutterBottom:!0},{children:["Selected path : $(",l,")"]}))]}),a(F,{children:[i(M,Object.assign({variant:"contained",color:"primary",onClick:()=>{navigator.clipboard.writeText(`$(${l})`),Or.success("Copied!")}},{children:"Copy"})),i(M,Object.assign({variant:"contained",color:"primary",onClick:()=>{n(`$(${l})`),Or.success("Pasted!")}},{children:"Paste"})),i(M,Object.assign({variant:"contained",color:"secondary",onClick:r},{children:"Close"}))]})]}))},qi=x({collapsed:!1,toggleCollapse:()=>{console.log("collapse toggle")}}),$i=()=>j(qi),Bi=({children:e})=>{const[r,n]=f("true"===localStorage.getItem("sidebar_collapsed")),t=b((()=>{n(!r),localStorage.setItem("sidebar_collapsed",`${!r}`),window.dispatchEvent(new CustomEvent("sidebar_collapsed",{detail:{collapsed:!r}}))}),[r]),l=b(((e,r)=>{localStorage.setItem(`${e.toLowerCase()}_collapsed`,`${!r}`)}),[]);return i(qi.Provider,Object.assign({value:{collapsed:r,toggleCollapse:t,toggleRootElementLink:l}},{children:e}))},zi=t("div")({position:"relative","&:hover":{".button-collapse":{opacity:1}}}),_i=t(xr)((e=>({width:248,flexShrink:0,position:"relative",transition:"all 0.3s ease-in-out",zIndex:999,"& .MuiDrawer-paper":{backgroundColor:e.theme.palette.secondary.main,width:248,boxSizing:"border-box",borderRight:"none",borderRadius:0,transition:"all 0.3s ease-in-out",overflow:"hidden"},"&.collapsed":{width:70,"& .MuiDrawer-paper":{width:70}}}))),Hi=t(wr)((({theme:e})=>({backgroundColor:"#fff",borderRight:"1px solid rgba(38, 40, 66, 0.08)",position:"relative","& span":{paddingLeft:10,paddingTop:5,fontSize:24,fontWeight:600,transition:".3s ease .1s",whiteSpace:"nowrap"},"&:after":{transition:"opacity .3s",content:"attr(data-title)",fontSize:30,position:"absolute",left:"50%",transform:"translate3d(-50%, 0, 0)",opacity:0,visibility:"hidden"},"&.collapsed":{justifyContent:"center","& img":{width:40},"& span":{opacity:0,visibility:"hidden",transitionDelay:"0s"},"&:after":{opacity:1,visibility:"visible",transitionDelay:".1s"}}}))),Ji=t(jr)((e=>({padding:e.theme.spacing(3),margin:0}))),Gi=t(Vr)((e=>({color:"#fff",height:e.theme.spacing(11),overflow:"hidden"}))),Yi=t(Rr)((({theme:e})=>({borderRadius:e.spacing(2.5),padding:e.spacing(2),height:e.spacing(11),alignItems:"center","&.active":{backgroundColor:"rgba(38, 40, 66, 0.12)","&.main":{backgroundColor:"rgba(255, 255, 255, 0.12)",borderLeft:"4px solid #E0613A"}},"&:hover":{backgroundColor:"rgba(255, 255, 255, 0.08)"},"&.collapsed":{width:e.spacing(11.5),"&.active":{"&.main":{border:"none",backgroundColor:"#E0613A"}}}}))),Wi=t(Tr)((({theme:e})=>({color:"#fff",minWidth:20,marginRight:e.spacing(2),"& svg":{marginLeft:2,fill:"#fff",color:"#fff"}}))),Ui=t(ee)((({theme:e})=>({textTransform:"uppercase",borderRadius:e.spacing(2.5),backgroundColor:e.palette.secondary.main,color:"#fff",paddingLeft:0,paddingRight:0,position:"relative","&:hover":{backgroundColor:"rgba(255, 255, 255, 0.08)"},"&.collapsed":{fontSize:24,textAlign:"center",fontWeight:"bold",paddingRight:0}}))),Zi=t(Nr)((({theme:e})=>({width:"100%",marginLeft:e.spacing(2),alignItems:"center","& > *":{overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-all",whiteSpace:"nowrap"}}))),Ki=t(jr)((e=>({margin:0,padding:0,"& .MuiListItemText-root:not(.main)":{paddingLeft:e.theme.spacing(8.5)}}))),Xi=t(Sr)((e=>({position:"absolute",top:e.theme.spacing(10),left:"calc(100% - 16px)",width:e.theme.spacing(8),height:e.theme.spacing(8),border:"1px solid #E0E3EA",borderRadius:"50%",boxShadow:"0px 2px 8px rgba(0, 0, 0, 0.12)",backgroundColor:"#fff",zIndex:1e3,opacity:0,transition:"all 0.3s ease-in-out","&.collapsed":{img:{transition:"all 0.3s ease-in-out",transform:"rotate(180deg)"}}})));var Qi=({route:e,isActive:r,isSubmenu:n})=>{const{collapsed:t}=$i(),[l,s]=m.useState(null),c=Boolean(l),d=e=>{s(e.currentTarget)},u=()=>{s(null)},p=b((({children:r})=>t&&!n?i(le,Object.assign({title:e.name,placement:"right"},{children:r})):r),[t,e,n]);return e.link?i(Gi,Object.assign({disablePadding:!0},{component:oe,replace:!0,to:{pathname:e.link,search:e.query}},{children:i(p,{children:a(Yi,Object.assign({className:Cr({active:r,main:e.main,collapsed:t})},{children:[e.icon&&i(Wi,Object.assign({className:Cr({collapsed:t})},{children:e.icon})),i(Zi,{primary:e.name,primaryTypographyProps:{variant:"body2"},className:Cr({collapsed:t,main:e.main}),sx:t&&!n?{display:"none"}:{}})]}))})})):e.children&&t?a(o,{children:[i(Ui,Object.assign({className:"collapsed"},{children:i(le,Object.assign({title:e.name,placement:"right"},{children:i(Yi,Object.assign({className:Cr({active:r,main:e.main,collapsed:t}),sx:{justifyContent:"center"},onClick:d},{children:e.name.substring(0,1)}))}))})),i(Xe,Object.assign({open:c,anchorEl:l,onClose:u,PaperProps:{sx:{width:300,maxHeight:440}},MenuListProps:{sx:{bgcolor:"secondary.main"}},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"}},{children:e.children.map(((e,r)=>i(la,{route:e,isSubmenu:!0},r)))}))]}):i(Ui,{children:e.name})},ea="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg opacity='0.6'%3e%3cpath d='M10.3533 2.81334C10.447 2.90709 10.4996 3.03417 10.4996 3.16667C10.4996 3.29917 10.447 3.42626 10.3533 3.52001L5.87334 8.00001L10.3533 12.48C10.4025 12.5258 10.4419 12.581 10.4692 12.6423C10.4965 12.7036 10.5112 12.7699 10.5124 12.837C10.5136 12.9041 10.5012 12.9708 10.4761 13.0331C10.4509 13.0953 10.4135 13.1519 10.366 13.1994C10.3186 13.2468 10.262 13.2843 10.1997 13.3094C10.1375 13.3346 10.0708 13.3469 10.0037 13.3457C9.93652 13.3446 9.87032 13.3299 9.80898 13.3025C9.74765 13.2752 9.69245 13.2358 9.64667 13.1867L4.81334 8.35334C4.71971 8.25959 4.66711 8.13251 4.66711 8.00001C4.66711 7.86751 4.71971 7.74042 4.81334 7.64667L9.64667 2.81334C9.74042 2.71971 9.86751 2.66711 10 2.66711C10.1325 2.66711 10.2596 2.71971 10.3533 2.81334Z' fill='white'/%3e%3c/g%3e%3c/svg%3e";var ra=({route:e,isActive:r,isListOpen:n,handleClick:t,isSubmenu:l})=>i(Ui,{children:i(Ji,Object.assign({sx:{padding:0,margin:0}},{children:i(Gi,Object.assign({disablePadding:!0,onClick:t},{children:a(Yi,Object.assign({className:Cr({active:r,main:e.main}),sx:{justifyContent:"space-between"}},{children:[i(Zi,{primary:e.name,className:Cr({main:e.main}),sx:l?{}:{display:"none"}}),e.name,i(B,{component:"img",src:ea,mr:3,sx:{transition:"transform .3s",transform:`rotate(${n?0:"-90deg"})`}})]}))}))}))});function na({route:e,isActive:r,isListOpen:n,handleClick:t,isSubmenu:l}){const{collapsed:o}=$i();return(null==e?void 0:e.link)?i(Gi,Object.assign({disablePadding:!0,onClick:t},{children:a(Yi,Object.assign({className:Cr({active:r,main:e.main,collapsed:o})},{children:[e.icon&&i(Wi,{children:e.icon}),i(Zi,{primary:e.name,primaryTypographyProps:{variant:"body2"},className:Cr({collapsed:o,main:e.main}),sx:o&&!l?{display:"none"}:{}}),i(B,{component:"img",src:ea,mr:3,sx:{transition:"transform .3s",transform:`rotate(${n?"-90deg":0})`}})]}))})):(null==e?void 0:e.rootLink)?i(ra,{route:e,handleClick:t,isListOpen:n}):i(Ui,{children:e.name})}const ta=({route:e,isSubmenu:r})=>{var n,t,l;const s=ae(),{collapsed:c,toggleRootElementLink:d}=$i(),[u,p]=f(!1),[m,g]=f("true"===localStorage.getItem(`${e.name.toLowerCase()}_collapsed`)),v=y((()=>!(!e.link&&!e.rootLink)&&s.pathname.startsWith(e.link||e.rootLink)),[s.pathname,e]),C=b((()=>{e&&e.rootLink&&(d(e.name,m),g(!m))}),[m,e,d]);return h((()=>{p(v)}),[v]),(null==e?void 0:e.rootLink)&&(null===(n=e.children)||void 0===n?void 0:n.length)&&(!c||c&&r)?a(o,{children:[i(na,{route:e,isActive:v,handleClick:C,isListOpen:m,isSubmenu:r}),i(kr,Object.assign({in:!m,timeout:"auto"},{children:i(Ki,{children:e.children.map((e=>i(ta,{route:e,isSubmenu:r},e.name)))})}))]}):(null===(t=e.children)||void 0===t?void 0:t.length)&&(!c||c&&r)?a(o,{children:[i(na,{route:e,isActive:v,handleClick:()=>{p(!u)},isListOpen:u||!e.link,isSubmenu:r}),i(kr,Object.assign({in:u||!e.link,timeout:"auto"},{children:i(Ki,{children:null===(l=e.children)||void 0===l?void 0:l.map(((e,n)=>i(ta,{route:e,isSubmenu:r},e.name)))})}))]}):i(Qi,{route:e,isActive:v,isSubmenu:r})};var la=ta;const ia=({src:e,alt:r})=>i(B,Object.assign({sx:{width:20,height:20,display:"flex",justifyContent:"center",alignItems:"center"}},{children:i("img",{src:e,alt:r})}));var aa=({title:e,routes:r,id:n,logo:t,collapsedLogo:l,footer:o,collapsedFooter:s})=>{const{collapsed:c,toggleCollapse:d}=$i();return a(zi,{children:[i(Xi,Object.assign({className:Cr("button-collapse",{collapsed:c}),onClick:d},{children:i("img",{src:"data:image/svg+xml,%3csvg width='7' height='12' viewBox='0 0 7 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M6.47054 0.861939C6.59552 0.986958 6.66573 1.1565 6.66573 1.33327C6.66573 1.51005 6.59552 1.67959 6.47054 1.80461L2.27521 5.99994L6.47054 10.1953C6.59198 10.321 6.65917 10.4894 6.65766 10.6642C6.65614 10.839 6.58602 11.0062 6.46242 11.1298C6.33881 11.2534 6.1716 11.3235 5.99681 11.3251C5.82201 11.3266 5.65361 11.2594 5.52787 11.1379L0.861207 6.47127C0.736226 6.34625 0.666016 6.17672 0.666016 5.99994C0.666016 5.82316 0.736226 5.65362 0.861207 5.52861L5.52787 0.861939C5.65289 0.736958 5.82243 0.666748 5.99921 0.666748C6.17598 0.666748 6.34552 0.736958 6.47054 0.861939V0.861939Z' fill='%238B8C9E'/%3e%3c/svg%3e",alt:"collapse"})})),a(_i,Object.assign({variant:"permanent",anchor:"left",className:Cr({collapsed:c}),id:n},{children:[(!!e||!!t)&&i(Hi,Object.assign({className:Cr({collapsed:c}),"data-title":e.substring(0,1)},{children:a(B,Object.assign({display:"flex",flexDirection:"column"},{children:[!!e&&i(B,Object.assign({component:"span"},{children:e})),!!t&&i(B,{component:"img",src:c?l:t,alt:"Lending Hub KZ"})]}))})),a(B,Object.assign({height:""+(t||e?"calc(100vh - 56px)":"auto"),display:"flex",flexDirection:"column",justifyContent:"space-between"},{children:[i(Ji,Object.assign({sx:{overflowY:"auto","&::-webkit-scrollbar":{width:"8px"},"&::-webkit-scrollbar-thumb":{background:"rgba(196, 196, 196, 0.8)",borderRadius:"16px",backgroundClip:"padding-box",border:"2px solid rgba(0, 0, 0, 0)"}}},{children:r.map((e=>i(la,{route:e},e.name)))})),o&&i(B,Object.assign({borderTop:"1px solid #FFFFFF1F"},{children:c?s:o}))]}))]}))]})};const oa=({routes:e,theme:r=wn,title:n="",id:t,logo:o,collapsedLogo:s,footer:c,collapsedFooter:d})=>a(l,Object.assign({theme:r},{children:[i(Er,{}),i(Bi,{children:i(aa,{title:n,routes:e,id:t,logo:o,collapsedLogo:s,footer:c,collapsedFooter:d})})]})),sa=({children:e,toolbar:r,contentSx:n,sx:t})=>a(B,Object.assign({component:"section",sx:Object.assign({flexGrow:1,bgcolor:"background.default"},t)},{children:[i(wr,Object.assign({sx:{borderBottom:"1px solid rgba(38, 40, 66, 0.08)"}},{children:r})),i(B,Object.assign({sx:Object.assign(Object.assign({},n),{height:"calc(100vh - 56px)",overflow:"scroll"})},{children:i(V,Object.assign({fallback:i($r,{})},{children:null!=e?e:i(ce,{})}))}))]})),ca=t(oe)((()=>({textDecoration:"none",color:"inherit"}))),da=({crumbs:e})=>i(Lr,Object.assign({separator:i(Ir,{fontSize:"small"}),"aria-label":"breadcrumb",sx:{"& li":{color:"#6D6E85","&:last-child":{color:"#262842"}}}},{children:e.map(((e,r)=>e.link?i(ca,Object.assign({to:e.link,className:"breadcrumb"},{children:e.title}),r):i(z,Object.assign({className:"breadcrumb"},{children:e.title}),r)))})),ua=({children:e})=>{const[r,n]=f(!1),t=b((e=>{n((null==e?void 0:e.scrollWidth)>(null==e?void 0:e.clientWidth));window.addEventListener("resize",(()=>{n((null==e?void 0:e.scrollWidth)>(null==e?void 0:e.clientWidth))}))}),[]);return i(le,Object.assign({title:e,arrow:!0,disableHoverListener:!r},{children:i("div",Object.assign({ref:t,style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},{children:e}))}))};export{Br as AlertDialog,Vl as ArrayNodeFormBuilder,Rl as ArrayNodeFormBuilderControl,un as BackButton,da as Breadcrumbs,sa as ContentLayout,pn as ControlAceEditor,dt as ControlArrayInput,on as ControlAutocomplete,Xr as ControlCheckbox,at as ControlDate,st as ControlDateTime,Ur as ControlDebouncedInput,Gr as ControlInput,nt as ControlNumberInput,ut as ControlPeriodInput,pt as ControlPhoneInput,cn as ControlQueryAutocomplete,Qr as ControlRadio,Kr as ControlSelect,tt as ControlSwitch,ct as ControlTime,dn as CopyButton,bl as CreateDefinition,ui as CreateNode,pi as CreateNodeWithContext,gl as CreatePropertiesList,fl as CreatePropertiesListContext,ul as CreatePropertyFormFields,Mr as DATE_DEFAULT_FORMAT,Fr as DATE_TIME_DEFAULT_FORMAT,Jr as DEFAULT_DATE_VALIDATION_ERROR_TEXT,rt as DEFAULT_ERROR_TEXT,Hr as DEFAULT_REQUIRED_ERROR_TEXT,ji as DefinitionFiller,wi as DefinitionValueView,mi as Dem3CreateDefinition,Vi as Dem3DefinitionFiller,Ii as Dem3DefinitionView,Bt as InfoItem,On as JsonModalView,Pi as JsonPathPicker,Cn as JsonView,$r as Loader,ia as MenuIcon,xi as MultiplePropertyFiller,Ul as NodeAdditionalFields,di as NodeForm,xl as NodeFormBuilderContext,Ol as NodeFormBuilderControl,Pr as NodeType,Zl as NodeValueField,Yl as ObjectAdditionalFields,_l as ObjectNodeProperties,Ll as ObjectNodeView,ua as OverflowTip,Zr as PopupIconComponent,Oi as PropertyFiller,Ar as PropertyType,ol as PropertyValueField,qr as RoundingMode,$t as RouteTabs,oa as Sidebar,Ft as SimpleTable,Mi as Status,Gt as StepperView,Dr as TIME_DEFAULT_FORMAT,qt as TabPanel,Rt as Table,Nt as TableAction,Pt as TableActionCell,Al as ViewNode,Ci as ViewPropertiesList,vi as ViewProperty,hn as capitalize,vn as deepParseJson,zr as defaultDefinitionArrayValue,_r as defaultDefinitionObjectValue,kn as digitsOnly,Ln as floatsOnly,Pn as formatDefinitionData,Yn as formatDefinitionNodeData,Sn as formatTableRowValue,Zn as getDemNodeDateFormat,Bn as getDemPropertyDateFormat,zn as getEntityStarterValue,bn as getJsonStringValue,Xn as getMultipleNodeFillOptions,_n as getMultiplePropertyFillOptions,Qn as getNodeType,Kn as getObjectStarterValue,et as getSingleNodeFillOptions,Hn as getSinglePropertyFillOptions,An as isDateType,In as isExpression,Dn as isPropertyValueEmpty,Jn as isValueEmpty,Wn as nodePropertiesArrayToObject,Un as nodePropertiesObjectToArray,Mn as numberFormat,qn as propertiesArrayToObject,$n as propertiesObjectToArray,mn as removeArrayItem,yn as safeParseJson,fn as sortArrayOfObjects,wn as theme,Yr as useDebounce,Wr as useToggle,gn as validateJson};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dartech/arsenal-ui",
3
- "version": "1.5.85",
3
+ "version": "1.5.87",
4
4
  "author": "DAR",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -26,15 +26,9 @@
26
26
  "react-toastify": "^9.1.1",
27
27
  "classnames": "^2.3.1",
28
28
  "@tanstack/react-query": "^4.24.10",
29
- "react-window": "^1.8.10",
30
- "@rollup/plugin-node-resolve": "13.3.0",
31
- "lodash": "4.17.21",
32
- "qs": "6.11.0",
33
- "react-input-mask": "3.0.0-alpha.2"
29
+ "react-window": "^1.8.10"
34
30
  },
35
- "module": "./index.js",
36
- "main": "./index.js",
31
+ "module": "./index.esm.js",
37
32
  "type": "module",
38
- "types": "./index.d.ts",
39
- "peerDependencies": {}
33
+ "main": "./index.esm.js"
40
34
  }
@@ -1,8 +1,9 @@
1
1
  import { GridFeatureMode } from '@mui/x-data-grid';
2
2
  interface Props {
3
3
  mode: GridFeatureMode;
4
+ pagination: boolean;
4
5
  }
5
- export declare const useTableQueryPagination: ({ mode }: Props) => {
6
+ export declare const useTableQueryPagination: ({ mode, pagination }: Props) => {
6
7
  page: number;
7
8
  size: number;
8
9
  onPageChange: (newPage: number) => void;
@@ -1,4 +1,4 @@
1
- declare const useTablePagination: () => {
1
+ declare const useTablePagination: (pagination: boolean) => {
2
2
  page: string | number;
3
3
  size: string | number;
4
4
  onPageChange: (newPage: number) => void;
package/index.js DELETED
@@ -1 +0,0 @@
1
- import{useTheme as e,createTheme as r,responsiveFontSizes as n,styled as t,ThemeProvider as l}from"@mui/material/styles";import{jsx as i,jsxs as a,Fragment as o}from"react/jsx-runtime";import{__rest as s,__awaiter as c}from"tslib";import d from"@mui/material/TextField";import u from"@mui/material/MenuItem";import*as p from"react";import m,{useRef as g,useEffect as h,useState as f,useCallback as b,useMemo as y,createElement as v,forwardRef as C,memo as O,useImperativeHandle as E,createContext as x,useContext as j,Suspense as V}from"react";import{useController as T,useWatch as R,useFormContext as N,Controller as w,useFieldArray as S,useForm as k}from"react-hook-form";import L from"@mui/material/SvgIcon";import I from"@mui/material/IconButton";import A from"@mui/material/InputAdornment";import M from"@mui/material/Button";import D from"@mui/material/Dialog";import F from"@mui/material/DialogActions";import P from"@mui/material/DialogContent";import q from"@mui/material/DialogContentText";import $ from"@mui/material/DialogTitle";import B from"@mui/material/Box";import z from"@mui/material/Typography";import _ from"@mui/material/CircularProgress";import H from"@mui/material/FormControl";import J from"@mui/material/FormControlLabel";import G from"@mui/material/FormHelperText";import Y from"@mui/material/Checkbox";import W from"@mui/material/Radio";import U from"@mui/material/RadioGroup";import Z from"@mui/material/FormLabel";import K from"@mui/material/Autocomplete";import X from"lodash/get";import Q from"@mui/material/useMediaQuery";import ee from"@mui/material/ListSubheader";import{VariableSizeList as re}from"react-window";import{useQuery as ne}from"@tanstack/react-query";import te from"qs";import le from"@mui/material/Tooltip";import{useNavigate as ie,useLocation as ae,Link as oe,useSearchParams as se,Outlet as ce}from"react-router-dom";import de from"@uiw/react-codemirror";import{langs as ue}from"@uiw/codemirror-extensions-langs";import{abcdef as pe}from"@uiw/codemirror-theme-abcdef";import me from"@mui/material/Switch";import{DatePicker as ge}from"@mui/x-date-pickers/DatePicker";import{format as he,parse as fe,isValid as be,isMatch as ye,endOfYesterday as ve,startOfTomorrow as Ce,isToday as Oe,isAfter as Ee,isBefore as xe}from"date-fns";import{DateTimePicker as je}from"@mui/x-date-pickers/DateTimePicker";import{TimePicker as Ve}from"@mui/x-date-pickers/TimePicker";import Te from"@mui/material/Chip";import Re from"@mui/material/Unstable_Grid2";import{toString as Ne,parse as we}from"duration-fns";import Se from"react-input-mask";import ke from"@mui/material/Pagination";import Le from"@mui/material/TablePagination";import{useGridApiContext as Ie,useGridSelector as Ae,gridPageSelector as Me,gridPageCountSelector as De,gridRowCountSelector as Fe,gridPageSizeSelector as Pe,GridColumnMenuContainer as qe,GridFilterMenuItem as $e,DataGrid as Be,GridActionsCellItem as ze}from"@mui/x-data-grid";import _e from"@mui/material/Table";import He from"@mui/material/TableBody";import Je from"@mui/material/TableCell";import Ge from"@mui/material/TableContainer";import Ye from"@mui/material/TableHead";import We from"@mui/material/TableRow";import Ue from"@mui/material/TableFooter";import Ze from"@mui/material/Backdrop";import Ke from"@mui/material/TableSortLabel";import Xe from"@mui/material/Menu";import Qe from"@mui/icons-material/MoreHoriz";import er from"@mui/material/Paper";import rr from"@mui/material/Tab";import nr from"@mui/material/Tabs";import tr from"@mui/material/Accordion";import lr from"@mui/material/AccordionSummary";import ir from"@mui/material/AccordionDetails";import ar from"@mui/material/AccordionActions";import{ExpandMore as or}from"@mui/icons-material";import sr from"@mui/material/Stepper";import cr from"@mui/material/Step";import dr from"@mui/material/StepLabel";import ur from"@mui/material/StepContent";import pr from"@mui/material/StepConnector";import{AdapterDateFns as mr}from"@mui/x-date-pickers/AdapterDateFns";import{LocalizationProvider as gr}from"@mui/x-date-pickers/LocalizationProvider";import hr from"@mui/material/Select";import fr from"lodash/isNil";import br from"@mui/material/InputLabel";import yr from"@mui/icons-material/Delete";import vr from"lodash/isPlainObject";import Cr from"classnames";import{toast as Or}from"react-toastify";import Er from"@mui/material/CssBaseline";import xr from"@mui/material/Drawer";import jr from"@mui/material/List";import Vr from"@mui/material/ListItem";import Tr from"@mui/material/ListItemIcon";import Rr from"@mui/material/ListItemButton";import Nr from"@mui/material/ListItemText";import wr from"@mui/material/Toolbar";import Sr from"@mui/material/ButtonBase";import kr from"@mui/material/Collapse";import Lr from"@mui/material/Breadcrumbs";import Ir from"@mui/icons-material/NavigateNext";var Ar;!function(e){e.STRING="STRING",e.INTEGER="INTEGER",e.BIG_INTEGER="BIG_INTEGER",e.BIG_DECIMAL="BIG_DECIMAL",e.FLOAT="FLOAT",e.LONG="LONG",e.DOUBLE="DOUBLE",e.BOOLEAN="BOOLEAN",e.ENTITY_REFERENCE="ENTITY_REFERENCE",e.ENTITY="ENTITY",e.FILE="FILE",e.FILE_REFERENCE="FILE_REFERENCE",e.JSON="JSON",e.DATE="DATE",e.TIME="TIME",e.DATE_TIME="DATE_TIME",e.ANY="ANY"}(Ar||(Ar={}));const Mr="yyyy-MM-dd",Dr="HH:mm:ss",Fr="yyyy-MM-dd'T'HH:mm:ss.SSSZ";var Pr,qr;!function(e){e.STRING="STRING",e.INTEGER="INTEGER",e.LONG="LONG",e.BIG_INTEGER="BIG_INTEGER",e.BIG_DECIMAL="BIG_DECIMAL",e.ENTITY_REFERENCE="ENTITY_REFERENCE",e.FLOAT="FLOAT",e.DOUBLE="DOUBLE",e.BOOLEAN="BOOLEAN",e.OBJECT="OBJECT",e.DATE="DATE",e.TIME="TIME",e.DATE_TIME="DATE_TIME",e.FILE="FILE",e.FILE_REFERENCE="FILE_REFERENCE",e.ANY="ANY",e.ARRAY="ARRAY",e.SHORT="SHORT"}(Pr||(Pr={})),function(e){e.UP="UP",e.DOWN="DOWN",e.CEILING="CEILING",e.FLOOR="FLOOR",e.HALF_UP="HALF_UP",e.HALF_DOWN="HALF_DOWN",e.HALF_EVEN="HALF_EVEN",e.UNNECESSARY="UNNECESSARY"}(qr||(qr={}));const $r=({transparent:e,position:r,bgcolor:n})=>i(B,Object.assign({position:null!=r?r:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:n||(e?"none":"rgba(255, 255, 255, .3)"),zIndex:10},{children:i(_,{})})),Br=({open:e,title:r,description:n,closeButtonTitle:t="Close",onClose:l,confirmButtonTitle:o="Confirm",confirmButtonDisabled:s=!1,disableBackdropClick:c=!1,onConfirm:d,children:u,dialogProps:p,loading:m,maxWidth:g="xs",hideCloseButton:h=!1})=>i("div",{children:a(D,Object.assign({open:e,onClose:c?(e,r)=>{if("backdropClick"===r)return null;l()}:l,disableEscapeKeyDown:c,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",fullWidth:!0,maxWidth:g},p,{children:[m&&i($r,{}),a($,Object.assign({id:"alert-dialog-title",sx:{display:"flex",justifyContent:"space-between"}},{children:[i(z,Object.assign({variant:"inherit"},{children:r})),!h&&i(I,Object.assign({sx:{padding:0,height:"28px",width:"28px"},onClick:l},{children:i(L,{children:i("g",Object.assign({opacity:"0.6"},{children:i("path",{d:"M4.39704 4.554L4.47004 4.47C4.59702 4.34299 4.76538 4.26576 4.94449 4.25236C5.1236 4.23897 5.30157 4.29029 5.44604 4.397L5.53004 4.47L12 10.939L18.47 4.469C18.5393 4.3974 18.622 4.34031 18.7136 4.30104C18.8051 4.26178 18.9035 4.24114 19.0031 4.24032C19.1027 4.2395 19.2014 4.25853 19.2936 4.29628C19.3857 4.33403 19.4694 4.38976 19.5398 4.46022C19.6102 4.53067 19.6659 4.61443 19.7035 4.70662C19.7412 4.79881 19.7601 4.89758 19.7592 4.99716C19.7583 5.09675 19.7376 5.19515 19.6982 5.28664C19.6589 5.37812 19.6017 5.46085 19.53 5.53L13.061 12L19.531 18.47C19.6579 18.5971 19.7349 18.7655 19.7482 18.9446C19.7614 19.1237 19.7099 19.3016 19.603 19.446L19.53 19.53C19.403 19.657 19.2347 19.7343 19.0556 19.7476C18.8765 19.761 18.6985 19.7097 18.554 19.603L18.47 19.53L12 13.061L5.53004 19.531C5.38852 19.6676 5.19903 19.7431 5.00238 19.7413C4.80574 19.7395 4.61766 19.6605 4.47867 19.5214C4.33968 19.3823 4.26089 19.1941 4.25928 18.9975C4.25766 18.8008 4.33335 18.6114 4.47004 18.47L10.939 12L4.46904 5.53C4.34217 5.40289 4.26512 5.23447 4.25191 5.05537C4.2387 4.87626 4.29019 4.69836 4.39704 4.554L4.47004 4.47L4.39704 4.554Z",fill:"black"})}))})}))]})),a(P,{children:[n&&i(q,Object.assign({id:"alert-dialog-description"},{children:n})),i(B,Object.assign({maxWidth:"100%",overflow:"hidden"},{children:u}))]}),a(F,{children:[!h&&i(M,Object.assign({onClick:l,variant:"outlined"},{children:t})),o&&d?i(M,Object.assign({onClick:d,color:"primary",variant:"contained",autoFocus:!0,disabled:s,disableElevation:!0},{children:o})):null]})]}))}),zr={code:"",name:"",version:0,properties:[]},_r={code:"",name:"",version:0,properties:{}},Hr="Please, fill this field",Jr="Incorrect date format",Gr=e=>{var r,{control:n,validate:t,name:l="",label:c="",required:u=!1,defaultValue:p="",disabled:m=!1,textarea:g=!1,hideErrorMessage:h=!1,onChange:f,requiredErrorText:b=""}=e,y=s(e,["control","validate","name","label","required","defaultValue","disabled","textarea","hideErrorMessage","onChange","requiredErrorText"]);const v=T({name:l,control:n,defaultValue:p,rules:{required:!!u&&(b||Hr),validate:t}}),C=v.field,{ref:O,onChange:E,value:x}=C,j=s(C,["ref","onChange","value"]),{fieldState:{error:V}}=v;return i(d,Object.assign({},j,{fullWidth:!0,size:"small",variant:"outlined",type:"text",inputRef:O,name:l,label:u?a(o,{children:[c," ",i("span",{children:"*"})]}):c,sx:{".MuiInputLabel-root span":{color:"#D6331F"}},error:!!V,helperText:!h&&(null==V?void 0:V.message),FormHelperTextProps:{variant:"standard"},disabled:m,multiline:g,minRows:g?3:1,value:null!=x?x:"",onChange:f||E,InputLabelProps:{shrink:!!y.placeholder},inputProps:Object.assign(Object.assign({},null!==(r=null==y?void 0:y.inputProps)&&void 0!==r?r:{}),{value:null!=x?x:""})},y))};function Yr(e,r){const n=g();h((()=>()=>{n.current&&clearTimeout(n.current)}),[]);return(...t)=>{clearTimeout(n.current),n.current=setTimeout((()=>{e(...t)}),r)}}const Wr=()=>{const[e,r]=f(!1);return{open:e,toggle:()=>{r((e=>!e))},onClose:()=>{r(!1)},onOpen:()=>{r(!0)}}},Ur=e=>{var r,{control:n,validate:t,name:l="",label:c="",required:u=!1,defaultValue:p="",disabled:m=!1,textarea:g=!1,hideErrorMessage:y=!1,onChange:v,requiredErrorText:C=""}=e,O=s(e,["control","validate","name","label","required","defaultValue","disabled","textarea","hideErrorMessage","onChange","requiredErrorText"]);const{field:{ref:E,onChange:x},fieldState:{error:j}}=T({name:l,control:n,defaultValue:p,rules:{required:!!u&&(C||Hr),validate:t}}),V=R({control:n,name:l}),[N,w]=f("");h((()=>{!N&&V&&w(V)}),[N,V]);const S=Yr((e=>{x(e)}),200),k=b((e=>{w(e.target.value),S(e.target.value)}),[S]);return i(d,Object.assign({fullWidth:!0,size:"small",variant:"outlined",type:"text",inputRef:E,name:l,label:u?a(o,{children:[c," ",i("span",{children:"*"})]}):c,sx:{".MuiInputLabel-root span":{color:"#D6331F"}},error:!!j,helperText:!y&&(null==j?void 0:j.message),FormHelperTextProps:{variant:"standard"},disabled:m,multiline:g,minRows:g?3:1,value:null!=N?N:"",onChange:k},O,{inputProps:Object.assign(Object.assign({},null!==(r=null==O?void 0:O.inputProps)&&void 0!==r?r:{}),{value:null!=N?N:""})}))},Zr=()=>i(L,{children:i("path",{d:"M4.22032 8.46991C4.36094 8.32946 4.55157 8.25057 4.75032 8.25057C4.94907 8.25057 5.13969 8.32946 5.28032 8.46991L12.0003 15.1899L18.7203 8.46991C18.789 8.39622 18.8718 8.33712 18.9638 8.29613C19.0558 8.25514 19.1551 8.23309 19.2558 8.23132C19.3565 8.22954 19.4565 8.24807 19.5499 8.28579C19.6433 8.32351 19.7281 8.37965 19.7994 8.45087C19.8706 8.52209 19.9267 8.60692 19.9644 8.70031C20.0022 8.7937 20.0207 8.89373 20.0189 8.99443C20.0171 9.09513 19.9951 9.19445 19.9541 9.28645C19.9131 9.37845 19.854 9.46125 19.7803 9.52991L12.5303 16.7799C12.3897 16.9204 12.1991 16.9992 12.0003 16.9992C11.8016 16.9992 11.6109 16.9204 11.4703 16.7799L4.22032 9.52991C4.07987 9.38928 4.00098 9.19866 4.00098 8.99991C4.00098 8.80116 4.07987 8.61054 4.22032 8.46991Z",fill:"#8B8C9E"})}),Kr=e=>{var r,{control:n,validate:t,name:l="",label:c="",required:p=!1,defaultValue:m="",disabled:g=!1,hideErrorMessage:h=!1,onChange:f,labelKey:y,valueKey:v,options:C=[],requiredErrorText:O=""}=e,E=s(e,["control","validate","name","label","required","defaultValue","disabled","hideErrorMessage","onChange","labelKey","valueKey","options","requiredErrorText"]);const x=T({name:l,control:n,defaultValue:m,rules:{required:!!p&&(O||Hr),validate:t}}),j=x.field,{ref:V,onChange:R,value:N}=j,w=s(j,["ref","onChange","value"]),{fieldState:{error:S}}=x,k=b((e=>"string"==typeof e?e:v?e[v]:e.value),[v]),M=b((e=>"string"==typeof e?e:y?e[y]:e.label),[y]),D=b((()=>{f?f(null):R(null)}),[R,f]);return i(d,Object.assign({},w,{select:!0,fullWidth:!0,size:"small",variant:"outlined",type:"text",inputRef:V,name:l,label:p?a(o,{children:[c," ",i("span",{children:"*"})]}):c,sx:{".MuiInputLabel-root span":{color:"#D6331F"}},error:!!S,helperText:!h&&(null==S?void 0:S.message),FormHelperTextProps:{variant:"standard"},disabled:g,value:null!=N?N:"",onChange:f||R},E,{inputProps:Object.assign(Object.assign({},null!==(r=null==E?void 0:E.inputProps)&&void 0!==r?r:{}),{value:null!=N?N:""}),InputProps:Object.assign({endAdornment:!p&&N?i(A,Object.assign({position:"end",sx:{mr:0}},{children:i(I,Object.assign({onClick:D,size:"small"},{children:i(L,Object.assign({fontSize:"small"},{children:i("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})}))}))})):null},null==E?void 0:E.InputProps),SelectProps:{sx:{"& .MuiSelect-select .notranslate::after":E.placeholder?{content:`"${E.placeholder}"`,opacity:.42}:{}}}},{children:C.map(((e,r)=>i(u,Object.assign({value:k(e)},{children:M(e)}),r)))}))},Xr=e=>{var{control:r,validate:n,name:t="",label:l="",required:o=!1,defaultValue:c,disabled:d=!1,hideErrorMessage:u=!1,onChange:p}=e,m=s(e,["control","validate","name","label","required","defaultValue","disabled","hideErrorMessage","onChange"]);const g=T({name:t,control:r,defaultValue:null!=c&&c}),h=g.field,{ref:f,onChange:b,value:v}=h,C=s(h,["ref","onChange","value"]),{fieldState:{error:O}}=g,E=y((()=>{if("boolean"==typeof v)return v;if("string"==typeof v){if("false"===v)return b(!1),!1;if("true"===v)return b(!0),!0}return!1}),[v,b]);return a(H,Object.assign({error:!!O,component:"fieldset",variant:"standard",disabled:d},{children:[i(J,{control:i(Y,Object.assign({},C,{checked:E,onChange:p||b,name:t,inputRef:f,disabled:d,color:"secondary"},m)),label:l}),!u&&(null==O?void 0:O.message)&&i(G,Object.assign({variant:"standard"},{children:O.message}))]}))},Qr=({name:e,label:r,values:n=[],control:t,required:l,defaultValue:o,disabled:c,hideErrorMessage:d,labelKey:u,valueKey:p,validate:m,onChange:g,row:h,radioProps:f,requiredErrorText:y=""})=>{const v=T({name:e,control:t,defaultValue:o,rules:{required:!!l&&(y||Hr),validate:m}}),C=v.field,{onChange:O}=C,E=s(C,["onChange"]),{fieldState:{error:x}}=v,j=b((e=>"string"==typeof e?e:p?e[p]:e.value),[p]),V=b((e=>"string"==typeof e?e:u?e[u]:e.label),[u]),R=b((e=>"string"==typeof e?e===E.value:e===("string"==typeof E.value?"true"===E.value:E.value)),[E.value]),N=b((e=>{"true"===e.target.value||"false"===e.target.value?O("true"===e.target.value):O(e)}),[O]);return a(H,Object.assign({disabled:c,error:!!x},{children:[i(Z,Object.assign({id:"radio-buttons-group"},{children:r})),i(U,Object.assign({},E,{row:h,"aria-labelledby":"radio-buttons-group",onChange:g||N},{children:n.map(((e,r)=>i(J,{value:j(e),control:i(W,Object.assign({},f,{checked:R(j(e))})),label:V(e)},r)))})),!d&&(null==x?void 0:x.message)&&i(G,Object.assign({variant:"standard"},{children:x.message}))]}))};var en=({valueKey:e,labelKey:r})=>{const n=b(((r,n)=>{if(r&&n){if("string"==typeof r)return r===n;if(e)return X(r,e)===X(n,e)||X(r,e)===n;if(r.value)return r.value===n.value||r.value===n}return!1}),[e]),t=b((e=>e?"string"==typeof e?e:r&&X(e,r,"")?X(e,r,"")+"":e.label+""||e.name+""||e.value+""||e.code+""||"--no label--":""),[r]),l=b(((e,r)=>v(B,Object.assign({},e,{component:"li",key:e.id}),t(r))),[t]);return{isOptionEqualToValue:n,getOptionLabel:t,renderOption:l}};const rn=p.createContext({}),nn=p.forwardRef(((e,r)=>{const n=p.useContext(rn);return i("div",Object.assign({ref:r},e,n))}));function tn(e){const{data:r,index:n,style:t}=e,l=r[n],a=Object.assign(Object.assign({},t),{top:t.top+8});if(l.hasOwnProperty("group"))return i(ee,Object.assign({component:"div",style:a},{children:l.group}),l.key);const{key:o}=l,c=s(l,["key"]);return i(z,Object.assign({component:"li"},c,{noWrap:!0,style:a},{children:l}),o)}const ln=p.forwardRef((function(r,n){const{children:t}=r,l=s(r,["children"]),a=[];t.forEach((e=>{a.push(e),a.push(...e.children||[])}));const o=e(),c=Q(o.breakpoints.up("sm"),{noSsr:!0}),d=a.length,u=c?36:48,m=e=>e.hasOwnProperty("group")?48:u,g=function(e){const r=p.useRef(null);return p.useEffect((()=>{null!=r.current&&r.current.resetAfterIndex(0,!0)}),[e]),r}(d);return i("div",Object.assign({ref:n},{children:i(rn.Provider,Object.assign({value:l},{children:i(re,Object.assign({itemData:a,height:(d>8?8*u:a.map(m).reduce(((e,r)=>e+r),0))+16,width:"100%",ref:g,outerElementType:nn,innerElementType:"ul",itemSize:e=>m(a[e]),overscanCount:5,itemCount:d},{children:tn}))}))}))}));var an=ln;const on=e=>{var{control:r,validate:n,name:t="",label:l="",required:c=!1,defaultValue:u="",disabled:p=!1,hideErrorMessage:m=!1,onChange:g,labelKey:b,valueKey:y,options:v=[],multiple:C,textFieldProps:O={},disableCloseOnSelect:E,useStringValue:x,requiredErrorText:j="",startAdornment:V,endAdornment:R,useVirtualList:N}=e,w=s(e,["control","validate","name","label","required","defaultValue","disabled","hideErrorMessage","onChange","labelKey","valueKey","options","multiple","textFieldProps","disableCloseOnSelect","useStringValue","requiredErrorText","startAdornment","endAdornment","useVirtualList"]);const S=T({name:t,control:r,defaultValue:u||(C?[]:null),rules:{required:!!c&&(j||Hr),validate:n}}),k=S.field,{ref:L,onChange:I,value:A}=k,M=s(k,["ref","onChange","value"]),{fieldState:{error:D}}=S,[F,P]=f(),{getOptionLabel:q,isOptionEqualToValue:$,renderOption:B}=en({valueKey:y,labelKey:b});return h((()=>{"string"==typeof A&&y&&x&&void 0===F&&v.length&&v[0]&&"object"==typeof v[0]&&P(v.find((e=>X(e,y)===A)))}),[F,v,x,A,y]),i(K,Object.assign({},M,{value:x?null!=F?F:null:A,fullWidth:!0,disablePortal:!0,size:"small",readOnly:p,options:v,multiple:C,ListboxComponent:N?an:null,disableListWrap:N,getOptionLabel:q,isOptionEqualToValue:$,disableCloseOnSelect:E||C,filterSelectedOptions:C,onChange:g||((e,r)=>{I(x&&y?X(r,y):r),P(r)}),renderOption:B,renderInput:e=>i(d,Object.assign({},e,{variant:"outlined",name:t,label:c?a(o,{children:[l," ",i("span",{children:"*"})]}):l,InputLabelProps:{shrink:!!(null==w?void 0:w.placeholder)},sx:{".MuiInputLabel-root span":{color:"#D6331F"}},placeholder:null==w?void 0:w.placeholder,error:!!D,inputRef:L,helperText:!m&&(null==D?void 0:D.message),FormHelperTextProps:{variant:"standard"},InputProps:Object.assign(Object.assign({},e.InputProps),{startAdornment:V||e.InputProps.startAdornment,endAdornment:R||e.InputProps.endAdornment})},O))},w))};const sn=()=>i("img",{src:"data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M4.22032 8.46991C4.36094 8.32946 4.55157 8.25057 4.75032 8.25057C4.94907 8.25057 5.13969 8.32946 5.28032 8.46991L12.0003 15.1899L18.7203 8.46991C18.789 8.39622 18.8718 8.33712 18.9638 8.29613C19.0558 8.25514 19.1551 8.23309 19.2558 8.23132C19.3565 8.22954 19.4565 8.24807 19.5499 8.28579C19.6433 8.32351 19.7281 8.37965 19.7994 8.45087C19.8706 8.52209 19.9267 8.60692 19.9644 8.70031C20.0022 8.7937 20.0207 8.89373 20.0189 8.99443C20.0171 9.09513 19.9951 9.19445 19.9541 9.28645C19.9131 9.37845 19.854 9.46125 19.7803 9.52991L12.5303 16.7799C12.3897 16.9204 12.1991 16.9992 12.0003 16.9992C11.8016 16.9992 11.6109 16.9204 11.4703 16.7799L4.22032 9.52991C4.07987 9.38928 4.00098 9.19866 4.00098 8.99991C4.00098 8.80116 4.07987 8.61054 4.22032 8.46991Z' fill='%238B8C9E'/%3e%3c/svg%3e",alt:""});function cn(e){var{name:r,label:n,control:t,required:l=!1,searchBy:c,labelKey:u,multiple:p=!1,mongoQueryJson:g,disabled:v,valueKey:C,sortBy:O="",hideErrorMessage:E,disableCloseOnSelect:x,textFieldProps:j,onChange:V,queryFunction:R,validate:N,itemQueryFunction:w,requiredErrorText:S="",startAdornment:k,endAdornment:L,useVirtualList:I}=e,M=s(e,["name","label","control","required","searchBy","labelKey","multiple","mongoQueryJson","disabled","valueKey","sortBy","hideErrorMessage","disableCloseOnSelect","textFieldProps","onChange","queryFunction","validate","itemQueryFunction","requiredErrorText","startAdornment","endAdornment","useVirtualList"]);const D=T({control:t,name:r,defaultValue:p?[]:null,rules:{required:!!l&&(S||Hr),validate:N}}),F=D.field,{ref:P,onChange:q,value:$}=F,B=s(F,["ref","onChange","value"]),{fieldState:{error:z,isDirty:H}}=D,{getOptionLabel:J,isOptionEqualToValue:G,renderOption:Y}=en({valueKey:C,labelKey:u}),[W,U]=f([]),[Z,Q]=f(!1),[ee,re]=f(""),[le,ie]=f(""),[ae,oe]=f(0),se=y((()=>!!W.length&&Z),[Z,W]),{data:ce,isFetching:de}=ne(["options",ae,le],(()=>{const e=te.parse(Object.assign({page:`${ae}`,size:"20",sort:O},le?{[c]:le}:{}),{ignoreQueryPrefix:!0});return R(e)}),{onSuccess(e){U(le?e.collection:r=>1===r.length?e.collection:[...r,...e.collection])}}),ue=(e,r)=>{if("object"==typeof e){if(Array.isArray(e))return e.map((e=>ue(e,r)));{const n={};for(const t in e)n[t]=ue(e[t],r);return n}}return"string"==typeof e&&e.includes("${variable}")?e.replace("${variable}",r):e},pe=Yr((e=>{if(oe(0),g){const r=ue(g,e);ie(JSON.stringify(r))}else ie(e)}),500),me=b(((e,r)=>{U([]),re(r),pe(r)}),[pe]),ge=b(((e,r)=>{q(r),V&&V(e,r)}),[q,V]);h((()=>{if(!H&&$&&w){let e=$;"object"==typeof $&&C in $&&(e=X($,C)),w(e).then((e=>{q(e),re(X(e,u))})).catch(console.error)}}),[$,H,C,u,w,q]);const he=b((e=>{const r=e.currentTarget;r.scrollHeight-r.scrollTop-r.clientHeight<=1&&W.length<(null==ce?void 0:ce.totalItems)&&oe((e=>e+1))}),[ce,W]);return i(K,Object.assign({},B,{fullWidth:!0,disablePortal:!0,size:"small",readOnly:v,options:W,multiple:p,getOptionLabel:J,isOptionEqualToValue:G,disableCloseOnSelect:x||p,filterSelectedOptions:p,inputValue:ee,value:$,onChange:ge,ListboxComponent:I?an:null,disableListWrap:I,loading:de,clearOnBlur:!1,open:se,filterOptions:e=>e,onOpen:()=>{Q(!0)},onClose:()=>{Q(!1),ie("")},onInputChange:me,ListboxProps:{onScroll:he},renderOption:Y,popupIcon:i(sn,{}),renderInput:e=>i(d,Object.assign({},e,{label:l?a(o,{children:[n," ",i("span",{children:"*"})]}):n,InputLabelProps:{shrink:!!(null==M?void 0:M.placeholder)},placeholder:null==M?void 0:M.placeholder,sx:{".MuiInputLabel-root span":{color:"#D6331F"}},variant:"outlined",error:!!z,inputRef:P,helperText:!E&&(null==z?void 0:z.message),FormHelperTextProps:{variant:"standard"},InputProps:Object.assign(Object.assign({},e.InputProps),{endAdornment:L||a(m.Fragment,{children:[de?i(A,Object.assign({position:"end"},{children:i(_,{color:"inherit",size:20})})):null,e.InputProps.endAdornment]}),startAdornment:k||e.InputProps.startAdornment})},j))},M))}const dn=({copyText:e,helpText:r="Copy"})=>{const[n,t]=f(r);return n?i(le,Object.assign({title:n,placement:"top"},{children:i(I,Object.assign({onClick:()=>{navigator.clipboard.writeText(e),t("Copied!"),setTimeout((()=>{t(r)}),1e3)}},{children:i(L,Object.assign({fontSize:"small"},{children:i("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4 6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z"})}))}))})):null},un=({text:e,buttonProps:r={}})=>{const n=ie(),{state:t}=ae(),l=y((()=>null==t?void 0:t.from),[t]),a=b((()=>{n(l||-1)}),[n,l]);return i(B,Object.assign({mr:2},{children:e?i(M,Object.assign({color:"inherit",onClick:l?null:a,component:oe,to:null!=l?l:""},r,{children:e})):i(I,Object.assign({onClick:a},{children:i(L,{children:i("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"})})}))}))},pn=C(((e,r)=>{var{control:n,name:t,mode:l="json",label:c,width:d="100%",height:u="200px",readOnly:p,required:m=!1,validateJson:g=!1,hideErrorMessage:h=!1,fontSize:f=16,validate:v=!0,parseValue:C,requiredErrorText:O="",useCleanValue:E}=e,x=s(e,["control","name","mode","label","width","height","readOnly","required","validateJson","hideErrorMessage","fontSize","validate","parseValue","requiredErrorText","useCleanValue"]);const j=T({control:n,name:t,rules:{required:!!m&&(O||Hr),validate:e=>{if(e&&g&&"string"==typeof e)try{return JSON.parse(e),!0}catch(e){return console.error(e),"Invalid JSON"}return!0}}}),V=j.field,{onChange:R,value:N,ref:w}=V,S=s(V,["onChange","value","ref"]),{fieldState:{error:k}}=j,L=y((()=>({json:[ue.json()],javascript:[ue.javascript()],python:[ue.python()]})),[]),I=y((()=>"text"===l&&"string"!=typeof N?JSON.stringify(N,null,2):"json"===l&&"string"!=typeof N?null===N?"":E?JSON.stringify(N,null,2).replace(/\\"/g,""):JSON.stringify(N,null,2):"string"==typeof N&&"text"!==l&&E?N.replace(/\\"/g,""):N),[N,E,l]),A=b((e=>{if(C)try{const r=JSON.parse(e);R(r)}catch(r){R(e)}else R(e)}),[R,C]);return a(B,Object.assign({display:"flex",flexDirection:"column",width:"100%"},{children:[i(B,{children:c&&i(z,Object.assign({variant:"subtitle1",display:"inline",style:{marginRight:10}},{children:m?a(o,{children:[c," ",i(B,Object.assign({component:"span",color:"#D6331F"},{children:"*"}))]}):c}))}),a(o,{children:[i(de,Object.assign({},S,{ref:r||w,basicSetup:{autocompletion:!0,history:!0},theme:pe,width:d,height:u,style:{fontSize:f,lineHeight:1.4,zIndex:0,isolation:"isolate"},readOnly:p,value:I,onChange:A,extensions:"text"===l?[]:L[l]},x)),k&&!h&&i(G,Object.assign({variant:"standard",error:!0},{children:k.message}))]})]}))})),mn=(e,r)=>{const n=[...e];return n.splice(r,1),n},gn=e=>{try{JSON.parse(e)}catch(e){return!1}return!0};function hn(e){return e.replace(/(^\w)|([-\s]\w)/g,(e=>e.toUpperCase()))}const fn=(e,r,n,t="asc")=>{const l=e[n],i=r[n];return l<i?"asc"===t?-1:1:l>i?"asc"===t?1:-1:0},bn=e=>{if(!e)return"";if("string"==typeof e)try{return JSON.stringify(JSON.parse(e),null,2)}catch(r){return e}else try{return JSON.stringify(e,null,2)}catch(e){return"Failed to stringify JSON"}},yn=e=>{try{return JSON.parse(e)}catch(e){return null}},vn=e=>{try{const r=JSON.parse(e);return Object.keys(r).forEach((e=>{r[e]=vn(r[e])})),r}catch(r){return e}},Cn=C((({value:e,height:r=200,fontSize:n=16},t)=>{const[l,o]=f(!0),s=b((e=>{const r=n=>{e.scrollDOM.scrollHeight-e.scrollDOM.offsetHeight-n.target.scrollTop<10&&setTimeout((()=>e.scrollDOM.scrollTo(0,0)),200),0===n.target.scrollTop&&(o(!1),e.scrollDOM.removeEventListener("scroll",r))};e.scrollDOM.scrollHeight>3e4?(o(!0),e.scrollDOM.addEventListener("scroll",r),e.scrollDOM.scrollTo(0,e.scrollDOM.scrollHeight-1e3),setTimeout((()=>{e.scrollDOM.scrollTo({top:e.scrollDOM.scrollHeight,behavior:"smooth"})}),300)):o(!1)}),[]);return a(B,Object.assign({position:"relative"},{children:[l&&i($r,{bgcolor:"#fff"}),i(de,{ref:t,readOnly:!0,width:"100%",value:"string"==typeof e?e:JSON.stringify(e,null,2),height:`${r}px`,basicSetup:{autocompletion:!0,history:!0,foldGutter:!0},onCreateEditor:s,extensions:[ue.json()],style:{fontSize:n,width:"100%"}})]}))})),On=({open:e,onClose:r,value:n,jsonViewProps:t})=>{const l=g();return a(D,Object.assign({disableEscapeKeyDown:!0,open:e,onClose:r,fullWidth:!0,maxWidth:"md",style:{width:800,left:"30%"}},{children:[i(P,{children:i(Cn,Object.assign({value:n},t,{ref:l}))}),a(F,{children:[i(dn,{copyText:n}),i(M,Object.assign({onClick:r,variant:"contained",color:"secondary"},{children:"Close"}))]})]}))};var En=({value:e,copyButton:r=!1,textField:n=!1})=>{const{open:t,onOpen:l,onClose:o}=Wr(),s=b((e=>{e.stopPropagation(),l()}),[l]);return a(B,Object.assign({width:"100%"},{children:[a(B,Object.assign({display:"flex",alignItems:"center",justifyContent:"flex-end",pt:1,mb:2},{children:[r&&i(dn,{copyText:bn(e)}),i(le,Object.assign({title:"Open",placement:"top"},{children:i(I,Object.assign({size:"small",onClick:s},{children:i(L,{children:i("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"})})}))}))]})),n?i(B,Object.assign({overflow:"hidden",whiteSpace:"nowrap"},{children:"object"==typeof e?JSON.stringify(e):e})):i(Cn,{value:e}),i(On,{open:t,value:bn(e),onClose:o,jsonViewProps:{height:450}})]}))};const xn={spacing:4,palette:{primary:{main:"#E0613A",dark:"#d9512e",light:"#E0613A"},secondary:{main:"#007994",dark:"#262842",light:"#cbe8ee"},text:{disabled:"#A9A9B8"},success:{main:"#2DB77B",light:"#DBFCEE"},grey:{100:"#F7F8FC",700:"#101F2B"}},typography:{fontSize:14,allVariants:{fontFamily:["Euclid","-apple-system","BlinkMacSystemFont",'"Segoe UI"',"Roboto",'"Helvetica Neue"',"Arial","sans-serif",'"Apple Color Emoji"','"Segoe UI Emoji"','"Segoe UI Symbol"'].join(",")},h1:{fontWeight:400},h3:{fontWeight:500},h4:{fontWeight:500}}};var jn=r(xn);var Vn={components:{MuiButtonBase:{defaultProps:{disableElevation:!0,disableRipple:!0},styleOverrides:{root:{"&.MuiButton-root":{boxShadow:"none"},"&.MuiButton-root:hover":{boxShadow:"none"},"&.MuiButton-containedPrimary:hover":{backgroundColor:"#D15C3B"},"&.MuiButton-outlinedPrimary:hover":{backgroundColor:"#F6F6F7",borderColor:"#DDDDE1"},"&.MuiButton-textPrimary":{color:jn.palette.secondary.dark,"&:hover":{backgroundColor:"#F6F6F7"},"&:active":{backgroundColor:"#EEEEF0"}},"&.MuiButton-textSecondary":{color:jn.palette.secondary.main,"&:hover":{backgroundColor:"#DEF7FC"},"&:active":{backgroundColor:"#CFE6ED"}}}}},MuiInputBase:{styleOverrides:{root:{color:"#262842",borderRadius:jn.spacing(3),minWidth:jn.spacing(25),background:jn.palette.background.default,paddingRight:jn.spacing(3)},input:{minWidth:jn.spacing(25)}}},MuiSelect:{defaultProps:{IconComponent:Zr},styleOverrides:{nativeInput:{padding:0,height:"32px"}}},MuiTextField:{styleOverrides:{root:{minWidth:jn.spacing(25)}}},MuiInputLabel:{styleOverrides:{root:{color:"#6D6E85",position:"relative",overflow:"initial",transform:"none",marginBottom:jn.spacing(1),fontWeight:500,fontSize:"14px",lineHeight:"20px",pointerEvents:"auto",whiteSpace:"normal","&.Mui-focused":{color:"#6D6E85"}}}},MuiOutlinedInput:{styleOverrides:{root:{borderRadius:jn.spacing(3),minWidth:jn.spacing(25),"&:hover":{".MuiOutlinedInput-notchedOutline":{borderColor:"#8B8C9E"}},"&.Mui-focused":{".MuiOutlinedInput-notchedOutline":{borderColor:jn.palette.secondary.main}}},notchedOutline:{top:0,"& legend":{display:"none",transition:"none"}}}},MuiAutocomplete:{defaultProps:{popupIcon:i(Zr,{})},styleOverrides:{root:{"& .MuiOutlinedInput-root .MuiAutocomplete-endAdornment":{right:12}},paper:{marginTop:8,borderRadius:12,boxShadow:"0px 8px 16px rgba(0, 0, 0, 0.04)"},listbox:{"::-webkit-scrollbar":{width:"6px",backgroundColor:"white"},"::-webkit-scrollbar-thumb":{borderRadius:"10px",backgroundColor:"rgba(38, 40, 66, 0.24)"}}}},MuiMenu:{styleOverrides:{list:{paddingTop:0,paddingBottom:0,background:"white","& li.Mui-selected":{background:"rgba(38, 40, 66, 0.08) !important"}}}},MuiPopover:{styleOverrides:{paper:{marginTop:8,borderRadius:12,boxShadow:"0px 8px 16px rgba(0, 0, 0, 0.04)"}}},MuiFormLabel:{styleOverrides:{root:{color:"#6D6E85",fontSize:14,fontWeight:500,"&.Mui-focused":{color:"#6D6E85"},"& span":{color:"#D6331F"}},asterisk:{color:"#D6331F","&$error":{color:"#D6331F"}}}},MuiTooltip:{styleOverrides:{tooltip:{fontSize:14},backgroundColor:jn.palette.secondary.dark,padding:jn.spacing(2,3),borderRadius:8,textAlign:"center"}}}};var Tn={components:{MuiTableContainer:{styleOverrides:{root:{borderRadius:jn.spacing(3),border:"1px solid rgba(38, 40, 66, 0.08)",overflow:"hidden"}}},MuiTableHead:{styleOverrides:{root:{backgroundColor:"#F7F8FC"}}},MuiTableRow:{styleOverrides:{root:{"&.MuiTableRow-hover":{"&:hover":{backgroundColor:"#F6F6F7"},"&:active, &:focus":{backgroundColor:"#EEEEF0"}},"&:active, &:focus":{backgroundColor:"#EEEEF0"}}}},MuiTableCell:{styleOverrides:{root:{padding:jn.spacing(1,2),borderColor:"#26284214","&:first-of-type":{paddingLeft:jn.spacing(4)}},head:{padding:jn.spacing(2,2),color:"#6D6E85"},body:{wordBreak:"break-all"}}},MuiTableSortLabel:{styleOverrides:{root:{maxHeight:"24px",lineHeight:1}}},MuiTablePagination:{styleOverrides:{root:{"& .MuiInputBase-root":{border:"1px solid #2628421F",borderRadius:4,minWidth:58,height:32,paddingRight:jn.spacing(2),"& .MuiSelect-select":{paddingRight:"4px !important",color:jn.palette.secondary.dark,"&:focus":{backgroundColor:"transparent"}}}}}},MuiPaginationItem:{styleOverrides:{root:{height:32,minWidth:32,borderRadius:4,border:"1px solid transparent",margin:"0, 2px","&.Mui-selected":{borderColor:"#2628421F",backgroundColor:"#F7F8FC"}}}},MuiDataGrid:{defaultProps:{headerHeight:40,getRowHeight:()=>"auto"},styleOverrides:{root:{borderRadius:jn.spacing(3),width:"100%",color:jn.palette.secondary.dark,border:"1px solid #26284214","& .MuiDataGrid-actionsCell":{flexWrap:"wrap",width:"100%",'& > button[aria-label="more"]':{marginLeft:"auto"}}},columnHeaders:{backgroundColor:jn.palette.grey[100],borderTopLeftRadius:jn.spacing(3),borderTopRightRadius:jn.spacing(3)},columnHeader:{"&:focus":{outline:"none"}},columnHeaderTitle:{color:"#6D6E85",fontWeight:500},row:{"&:hover":{backgroundColor:"#F6F6F7"},"&:active, &:focus":{backgroundColor:"#EEEEF0"}},columnSeparator:{display:"none"},withBorder:{borderColor:"#E0E3EA"},cell:{minHeight:"48px !important",textOverflow:"ellipsis",wordBreak:"break-all",lineHeight:"unset",padding:jn.spacing(1.25,3),borderColor:"#E0E3EA","&:focus":{outline:"none"}}}}}};var Rn={components:{MuiStepIcon:{styleOverrides:{root:{fontSize:"20px",color:jn.palette.text.disabled,"&.Mui-active, &.Mui-completed":{color:jn.palette.secondary.main}}}}}};var Nn={components:{MuiTypography:{styleOverrides:{h1:{[jn.breakpoints.up("lg")]:{fontSize:"1.5rem"}},h3:{fontSize:"1.25rem",[jn.breakpoints.up("lg")]:{fontSize:"1.125rem"}},h4:{fontSize:"1rem",[jn.breakpoints.up("lg")]:{fontSize:"1rem"}},subtitle2:{color:"#6D6E85"}}}}};const wn=(()=>{if(document){const e="https://dev-qa-arsenal-frontend-fonts-bucket.s3.eu-north-1.amazonaws.com/fonts.css";if(!document.querySelectorAll(`link[href="${e}"]`).length){const r=document.createElement("link");r.href=e,r.rel="stylesheet",document.head.appendChild(r)}}return n(r(jn,{components:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Vn.components),Tn.components),Rn.components),Nn.components),{MuiToolbar:{styleOverrides:{root:{[jn.breakpoints.up("sm")]:{minHeight:"56px"}}}},MuiAppBar:{styleOverrides:{root:{boxShadow:"none",backgroundColor:"#007F9B"}}},MuiButton:{styleOverrides:{root:{borderRadius:jn.spacing(2.5),padding:jn.spacing(2.5,4),lineHeight:"20px",fontSize:"1rem",textTransform:"none"},outlined:{color:"#262842",backgroundColor:"#FFFFFF !important",border:"1px solid rgba(38, 40, 66, 0.12)"},text:{color:jn.palette.secondary.dark}}},MuiDialog:{styleOverrides:{root:{"& .MuiModal-backdrop":{background:"rgba(28, 55, 77, 0.5)",backdropFilter:"blur(2px)"}},paper:{borderRadius:jn.spacing(3)},paperWidthXs:{maxWidth:500}}},MuiDialogContent:{styleOverrides:{root:{color:"#6D6E85"}}},MuiDialogActions:{styleOverrides:{root:{background:"#F7F8FC",borderTop:"1px solid rgba(38, 40, 66, 0.08)",padding:jn.spacing(3,6)}}},MuiTabs:{styleOverrides:{root:{minHeight:"38px"},indicator:{backgroundColor:jn.palette.secondary.main}}},MuiTab:{styleOverrides:{root:{fontSize:14,fontWeight:500,textTransform:"none",padding:"10px 12px",lineHeight:"1.125rem",minHeight:"38px",color:"#8B8C9E","&.Mui-selected":{color:jn.palette.secondary.main}}}}})}))})(),Sn=({value:e,canCopy:r,copyValue:n,shortId:t,fullText:l=!1,textParams:o})=>{const{displayAs:s="text",tooltipLinkComponent:c=null,dateFormat:d=null,statusVariant:u=null}=o||{};switch(s){case"boolean":return i(L,e?Object.assign({color:"primary",fontSize:"small"},{children:i("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})}):Object.assign({fontSize:"small"},{children:i("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20zm6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9z"})}));case"date":return e?d?i(ua,{children:d.map(((r,n)=>i(B,{children:he(new Date(e),r)},n)))}):a(ua,{children:[i(B,{children:he(new Date(e),"dd.MM.yyyy")}),i(B,{children:he(new Date(e),"HH:mm:ss")})]}):"";case"status":return i(ua,{children:i(Mi,{text:e,status:u||"default"})});case"json_text":return i(En,{value:e,textField:!0});case"json_code":return i(En,{value:e,copyButton:!0});case"array":return i(B,{children:null==e?void 0:e.map(((e,r)=>i(B,{children:e},r)))});case"collapsed_array":return e&&i(B,{children:i(le,Object.assign({arrow:!0,title:c||e.map(((e,r)=>i(B,Object.assign({fontSize:14,style:{paddingTop:wn.spacing(1)}},{children:e}),r)))},{children:i(B,{children:e.length>1?`${e[0]} (+${e.length-1})`:e[0]})}))});case"number":return i(B,Object.assign({display:"flex",justifyContent:"flex-end"},{children:i(ua,{children:e.toLocaleString("ru-Ru",{minimumFractionDigits:2})})}));default:return e?a(B,Object.assign({display:"flex",alignItems:"center",width:"100%"},{children:[t?i(ua,{children:e?`${e.slice(0,6)}...${e.slice(-6)}`:"..."}):l?i(B,Object.assign({sx:{whiteSpace:"normal"}},{children:"string"==typeof e?e:JSON.stringify(e)})):i(ua,{children:"string"==typeof e?e:JSON.stringify(e)}),r&&i(dn,{copyText:n?"string"==typeof n?n:JSON.stringify(n):e})]})):""}},kn=new RegExp("^[-+]?[0-9]+$"),Ln=new RegExp(/^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/),In=(e,r)=>{if("string"==typeof e)return/[$%#{<]{1}(?:S?JS)?(?:[{(%#>]|\()/g.test(e);if(r){if(Array.isArray(e))for(const n of e)if(In(n,r))return!0;if("object"==typeof e)for(const n in e)if(In(e[n],r))return!0}return!1},An=e=>e===Ar.DATE||e===Ar.DATE_TIME||e===Ar.TIME,Mn=new Intl.NumberFormat("ru-RU",{style:"decimal"}),Dn=e=>!e&&0!==e&&!1!==e,Fn=(e,r,n)=>{if(null==r)return null;if(In(r))return r;let t=r;switch(e){case Ar.BOOLEAN:t=!!r||!(!r&&null!==r)&&null;break;case Ar.INTEGER:case Ar.BIG_INTEGER:case Ar.BIG_DECIMAL:case Ar.FLOAT:case Ar.LONG:case Ar.DOUBLE:t=Number(r);break;case Ar.DATE:case Ar.DATE_TIME:case Ar.TIME:if(r)try{const e=n.formatText.replace(/[Z,z,x]+/g,"XX");t=he(fe(r,e,new Date),e)}catch(e){console.error(e)}break;case Ar.JSON:try{"string"!=typeof r&&(t=JSON.stringify(r)),t=JSON.parse(t)}catch(e){console.log(e),t=null}break;case Ar.ANY:try{t="string"==typeof r?JSON.parse(t):r}catch(e){t=r}break;case Ar.ENTITY:t=Pn(n.properties,r)}return t},Pn=(e,r)=>{if(r){const n={};return e.forEach((e=>{const{key:t,propertyType:l}=e,i=r[t];Array.isArray(i)?n[t]=i.map((r=>Fn(l,r,{formatText:e.format,properties:e.properties}))):n[t]=Fn(l,i,{formatText:e.format,properties:e.properties})})),n}return null},qn=(e,r)=>{const n={};return e.forEach((e=>{const{key:t,name:l,isRequired:i,isMultiple:a,sortOrder:o,isEnabled:s,uiSettings:c,validationNode:d}=e,u=e.propertyType?"string"==typeof e.propertyType?e.propertyType:e.propertyType.value:null,p=Object.assign({name:l,propertyType:u,isRequired:i,isMultiple:a,sortOrder:o,isEnabled:s,validationNode:d,uiSettings:c},((e,r)=>{const n={};let t,l="";return r?e.isMultiple?(l="values",t=e.value):(l="value",t=e.value):e.isMultiple?(l="defaultValues",t=e.defaultValue):(l="defaultValue",t=e.defaultValue),Array.isArray(t)?n[l]=t.map((r=>Fn(e.propertyType,r,{formatText:e.format,properties:e.properties}))):n[l]=Fn(e.propertyType,t,{formatText:e.format,properties:e.properties}),n})(Object.assign(Object.assign({},e),{propertyType:u}),r));if("isViewableInList"in e&&(p.isViewableInList=e.isViewableInList),c)if("string"==typeof c)try{p.uiSettings=JSON.parse(c)}catch(e){console.log(e),p.uiSettings=c}else p.uiSettings=c;else p.uiSettings=null;u===Ar.BIG_DECIMAL&&(p.precisionScale=e.precisionScale,p.roundingMode=e.roundingMode),u!==Ar.DATE&&u!==Ar.TIME&&u!==Ar.DATE_TIME||(p.format=e.format),u===Ar.STRING&&(p.restrictedValues=e.restrictedValues),u===Ar.ENTITY_REFERENCE&&(p.source=e.source,p.definitionCode=e.definitionCode,p.definitionVersion=e.definitionVersion,p.labelPropertyCode=e.labelPropertyCode,p.valuePropertyCode=e.valuePropertyCode),u===Ar.ENTITY&&(p.properties=qn(e.properties,r)),n[t]=p})),n};function $n(e,r){return Object.keys(e).map((n=>{const t=Object.assign(Object.assign({key:n},e[n]),r||{});if(t.propertyType===Ar.ENTITY&&(t.properties=$n(t.properties,r)),t.propertyType===Ar.JSON)try{null==t.defaultValue?t.defaultValue="":t.defaultValue=JSON.stringify(t.defaultValue,null,2)}catch(e){t.defaultValue=""}return t.isMultiple&&("defaultValues"in t&&(t.defaultValue=t.defaultValues),"values"in t&&(t.value=t.values)),t})).sort(((e,r)=>fn(e,r,"sortOrder")))}const Bn=(e,r)=>{if(r)try{const e=r.replace(/Z/g,"XXX");return he(new Date,e),e}catch(r){return console.error("Incorrect format",r),e}return e},zn=e=>{let r=[];return r=Array.isArray(e.properties)?e.properties:$n(e.properties),r.reduce(((e,r)=>{const n=JSON.parse(JSON.stringify(e));return r.propertyType===Ar.ENTITY?n[r.key]=zn(r):n[r.key]=r.propertyType,n}),{})},_n=({propertyType:e,useExpression:r,required:n})=>{let t=[{value:"widget",label:"Fill array (widget)",sortOrder:1}];return n||t.push({value:"null",label:"NULL",sortOrder:0}),r&&(e===Ar.JSON||e===Ar.ENTITY||e===Ar.ANY?t.push({value:"expression",label:"Expression (JSON editor)",sortOrder:3}):t.push({value:"expression",label:"Expression",sortOrder:3})),e!==Ar.JSON&&e!==Ar.ANY&&e!==Ar.ENTITY||t.push({value:"json_valid",label:"JSON editor",sortOrder:2}),t=t.sort(((e,r)=>fn(e,r,"sortOrder"))),t},Hn=({propertyType:e,useExpression:r,required:n})=>{let t=[{value:"widget",label:"Widget",sortOrder:1}];switch(n||t.push({value:"null",label:"NULL",sortOrder:0}),r&&(e===Ar.JSON||e===Ar.ENTITY||e===Ar.ANY?t.push({value:"expression",label:"Expression (JSON editor)",sortOrder:3}):t.push({value:"expression",label:"Expression",sortOrder:3})),e===Ar.JSON&&t.push({value:"dem_builder",label:"DEM Builder",sortOrder:2}),e){case Ar.STRING:t[0].label="Text input";break;case Ar.INTEGER:case Ar.BIG_INTEGER:case Ar.BIG_DECIMAL:case Ar.FLOAT:case Ar.LONG:case Ar.DOUBLE:t[0].label="Number input";break;case Ar.BOOLEAN:t[0].label="Switch";break;case Ar.ENTITY_REFERENCE:t[0].label="Entity reference field";break;case Ar.JSON:t[0].label="JSON editor";break;case Ar.DATE:t[0].label="Date picker",t.push({value:"string",label:"Text input",sortOrder:2});break;case Ar.DATE_TIME:t[0].label="Date & Time picker",t.push({value:"string",label:"Text input",sortOrder:2});break;case Ar.TIME:t[0].label="Time picker",t.push({value:"string",label:"Text input",sortOrder:2});break;case Ar.ANY:t[0].label="Textarea"}return t=t.sort(((e,r)=>fn(e,r,"sortOrder"))),t},Jn=e=>!e&&0!==e&&!1!==e,Gn=(e,r,n)=>{if(null==r)return null;if(In(r))return r;let t=r;switch(Qn(e)){case Pr.BOOLEAN:t=!!r||!(!r&&null!==r)&&null;break;case Pr.INTEGER:case Pr.BIG_INTEGER:case Pr.BIG_DECIMAL:case Pr.FLOAT:case Pr.LONG:case Pr.DOUBLE:case Pr.SHORT:t=Number(r);break;case Pr.DATE:case Pr.DATE_TIME:case Pr.TIME:if(r)try{const e=n.formatText.replace(/[Z,z,x]+/g,"XX");t=he(fe(r,e,new Date),e)}catch(e){console.error(e)}break;case Pr.ANY:try{t="string"==typeof r?JSON.parse(t):r}catch(e){t=r}break;case Pr.OBJECT:t=Yn(e,r)}return t},Yn=(e,r)=>{var n;let t={};if(r){const l=Qn(e);return l===Pr.OBJECT?Array.isArray(e.properties)?null===(n=e.properties)||void 0===n||n.forEach((function(e){const{key:n}=e,l=r[n];Array.isArray(l)?t[n]=l.map((r=>Gn(e,r,{formatText:e.format,properties:e.properties}))):t[n]=Gn(e,l,{formatText:e.format,properties:e.properties})})):t=vr(r)?r:{}:t=l===Pr.ARRAY&&Array.isArray(r)?r.map((r=>e.memberNodes?Gn(e.memberNodes,r):r)):Gn(e,r),t}return null},Wn=(e,r)=>{return n(e);function n(e){const{name:t,isRequired:l,sortOrder:i,isEnabled:a,uiSettings:o,validationNode:s}=e,c=Qn(e),d=Object.assign({name:t,nodeType:c,isRequired:null!==l&&l,sortOrder:i,isEnabled:null!==a&&a,validationNode:s,uiSettings:o},((e,r)=>{const n={};let t,l="";return r?e.nodeType===Pr.ARRAY?(l="values",t=e.value):(l="value",t=e.value):e.nodeType===Pr.ARRAY?(l="defaultValues",t=e.defaultValue):(l="defaultValue",t=e.defaultValue),Array.isArray(t)?n[l]=t.map((r=>Gn(e,r,{formatText:e.format,properties:e.properties}))):n[l]=Gn(e,t,{formatText:e.format,properties:e.properties}),n})(e,r));if("isViewableInList"in e&&(d.isViewableInList=e.isViewableInList),o)if("string"==typeof o)try{d.uiSettings=JSON.parse(o)}catch(e){console.log(e),d.uiSettings=o}else d.uiSettings=o;else d.uiSettings=null;if(c===Pr.BIG_DECIMAL&&(d.precisionScale=e.precisionScale,d.roundingMode=e.roundingMode),c!==Pr.DATE&&c!==Pr.TIME&&c!==Pr.DATE_TIME||(d.format=e.format),c===Pr.STRING&&(d.restrictedValues=e.restrictedValues),c===Pr.ENTITY_REFERENCE){const{definitionCode:r,definitionVersion:n,labelPropertyCode:t,valuePropertyCode:l}=e;d.definitionCode=r,d.definitionVersion=n,d.labelPropertyCode=t,d.valuePropertyCode=l}return c===Pr.ARRAY&&(d.memberNodes=e.memberNodes?n(e.memberNodes):null),c===Pr.OBJECT&&(d.properties=function(e){if(!Array.isArray(e)||!e.length)return null;const r={};return e.forEach((e=>{r[e.key]=n(e)})),r}(e.properties)),d}};function Un(e,r){var n;return e&&e.nodeType===Pr.OBJECT&&e.properties&&(e.properties=(n=e.properties)?Array.isArray(n)?n:Object.keys(n).map((e=>{let t=Object.assign(Object.assign({key:e},n[e]),r||{});const l=Qn(t);return l===Pr.OBJECT&&(t=Un(t,r)),l===Pr.ARRAY&&t.memberNodes&&(t.memberNodes=Un(t.memberNodes,r),"defaultValues"in t&&(t.defaultValue=t.defaultValues),"values"in t&&(t.value=t.values)),t})).sort(((e,r)=>fn(e,r,"sortOrder"))):[]),e&&e.nodeType===Pr.ARRAY&&e.memberNodes&&(e.memberNodes=Un(e.memberNodes,r)),e}const Zn=(e,r)=>{if(r)try{const e=r.replace(/Z/g,"XXX");return he(new Date,e),e}catch(r){return console.error("Incorrect format",r),e}return e},Kn=e=>(Array.isArray(e.properties)?e:Un(e)).properties.reduce(((r,n)=>{const t=JSON.parse(JSON.stringify(r));return e.nodeType===Pr.OBJECT?t[e.key]=Kn(e):t[e.key]=e.nodeType,t}),{}),Xn=({nodeType:e,useExpression:r,required:n})=>{let t=[{value:"widget",label:"Fill array",sortOrder:1}];return n||t.push({value:"null",label:"NULL",sortOrder:0}),r&&(e===Pr.OBJECT||e===Pr.ANY?t.push({value:"expression",label:"Expression (JSON editor)",sortOrder:3}):t.push({value:"expression",label:"Expression",sortOrder:3})),e!==Pr.ANY&&e!==Pr.OBJECT&&e!==Pr.ARRAY||t.push({value:"json_valid",label:"JSON editor",sortOrder:2}),t=t.sort(((e,r)=>fn(e,r,"sortOrder"))),t},Qn=e=>{var r;return e?"string"==typeof e.nodeType?e.nodeType:null===(r=e.nodeType)||void 0===r?void 0:r.value:Pr.ANY},et=({nodeType:e,useExpression:r,required:n})=>{let t=[{value:"widget",label:"Widget",sortOrder:1}];switch(n||t.push({value:"null",label:"NULL",sortOrder:0}),r&&(e===Pr.OBJECT||e===Pr.ANY?t.push({value:"expression",label:"Expression (JSON editor)",sortOrder:3}):t.push({value:"expression",label:"Expression",sortOrder:3})),e){case Pr.STRING:t[0].label="Text input";break;case Pr.INTEGER:case Pr.BIG_INTEGER:case Pr.BIG_DECIMAL:case Pr.FLOAT:case Pr.LONG:case Pr.DOUBLE:case Pr.SHORT:t[0].label="Number input";break;case Pr.BOOLEAN:t[0].label="Switch";break;case Pr.ENTITY_REFERENCE:t[0].label="Entity reference field";break;case Pr.ARRAY:t[0].label="Array editor";break;case Pr.DATE:t[0].label="Date picker",t.push({value:"string",label:"Text input",sortOrder:2});break;case Pr.DATE_TIME:t[0].label="Date & Time picker",t.push({value:"string",label:"Text input",sortOrder:2});break;case Pr.TIME:t[0].label="Time picker",t.push({value:"string",label:"Text input",sortOrder:2});break;case Pr.ANY:t[0].label="JSON"}return t=t.sort(((e,r)=>fn(e,r,"sortOrder"))),t},rt={required:Hr,notValidNumber:"Not valid number",notValidInteger:"Not valid integer"},nt=e=>{var r,n,{control:t,validate:l,name:c="",label:u="",required:p=!1,defaultValue:m=null,disabled:g=!1,hideErrorMessage:h=!1,onChange:f,decimal:b=!1,valueAsNumber:v=!0,useFormattedInputValue:C=!1,errorText:O}=e,E=s(e,["control","validate","name","label","required","defaultValue","disabled","hideErrorMessage","onChange","decimal","valueAsNumber","useFormattedInputValue","errorText"]);const x=y((()=>O||rt),[O]),j=T({name:c,control:t,defaultValue:m,rules:{required:!!p&&x.required,validate:e=>l?"function"!=typeof l||l(e):0==+e||(null===e?!p||x.required:b&&!Ln.test(e)||/^-*0+$/.test(e)?x.notValidNumber:!(!b&&!kn.test(e))||x.notValidInteger)}}),V=j.field,{ref:R,onChange:N,value:w}=V,S=s(V,["ref","onChange","value"]),{fieldState:{error:k}}=j;return i(d,Object.assign({},S,{fullWidth:!0,size:"small",variant:"outlined",type:"text",inputRef:R,name:c,label:p?a(o,{children:[u," ",i("span",{children:"*"})]}):u,sx:{".MuiInputLabel-root span":{color:"#D6331F"}},error:!!k,helperText:!h&&(null==k?void 0:k.message),disabled:g,value:C?null!==(r=null==w?void 0:w.toLocaleString("ru-Ru",{maximumFractionDigits:10}).replace(",","."))&&void 0!==r?r:"":null!=w?w:"",onChange:e=>{let r=e.target.value.replace(/\s/g,"");const n=e.nativeEvent.data;if(!(b?/^-?\d*[.,]?\d*$/:/^-?\d*$/).test(r))return;if(!((r.match(/[.,]/g)||[]).length>1||r.lastIndexOf("-")>0))if(r=r.replace(/,/g,"."),!isNaN(n)||b&&"."===n||"-"===n||"+"===n||r)if(f)f(e);else if(v)if(r)if("0"===r)N(0);else if(b){const e=r.split(",")[1],n=parseFloat(r.replace(",","."));N(!Ln.test(r.replace(",","."))||/^0+$/.test(e)||/^-*0+$/.test(r)||Number.isNaN(n)?r:n)}else N(Number.isNaN(+r.replace(",","."))?r:+r.replace(",","."));else N(null);else N(r);else N(r)},FormHelperTextProps:{variant:"standard"},InputLabelProps:{shrink:!!E.placeholder},inputProps:Object.assign({},null!==(n=null==E?void 0:E.inputProps)&&void 0!==n?n:{})},E))},tt=e=>{var{control:r,name:n,label:t,defaultValue:l}=e,a=s(e,["control","name","label","defaultValue"]);const o=T({control:r,name:n,defaultValue:l}).field,{ref:c,onChange:d,value:u}=o,p=s(o,["ref","onChange","value"]),m=y((()=>{if("boolean"==typeof u)return u;if("string"==typeof u){if("false"===u)return d(!1),!1;if("true"===u)return d(!0),!0}return!1}),[u,d]);h((()=>{null===u&&d(!1)}),[u,d]);return i(J,{label:t,name:n,control:i(me,Object.assign({},p,{color:"primary",size:"small",inputRef:c,onChange:e=>{const{checked:r}=e.target;d(r)},checked:m},a))})};var lt="data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M17.75 3C18.612 3 19.4386 3.34241 20.0481 3.9519C20.6576 4.5614 21 5.38805 21 6.25V17.75C21 18.612 20.6576 19.4386 20.0481 20.0481C19.4386 20.6576 18.612 21 17.75 21H6.25C5.38805 21 4.5614 20.6576 3.9519 20.0481C3.34241 19.4386 3 18.612 3 17.75V6.25C3 5.38805 3.34241 4.5614 3.9519 3.9519C4.5614 3.34241 5.38805 3 6.25 3H17.75ZM19.5 8.5H4.5V17.75C4.5 18.716 5.284 19.5 6.25 19.5H17.75C18.2141 19.5 18.6592 19.3156 18.9874 18.9874C19.3156 18.6592 19.5 18.2141 19.5 17.75V8.5ZM7.75 14.5C8.08152 14.5 8.39946 14.6317 8.63388 14.8661C8.8683 15.1005 9 15.4185 9 15.75C9 16.0815 8.8683 16.3995 8.63388 16.6339C8.39946 16.8683 8.08152 17 7.75 17C7.41848 17 7.10054 16.8683 6.86612 16.6339C6.6317 16.3995 6.5 16.0815 6.5 15.75C6.5 15.4185 6.6317 15.1005 6.86612 14.8661C7.10054 14.6317 7.41848 14.5 7.75 14.5ZM12 14.5C12.3315 14.5 12.6495 14.6317 12.8839 14.8661C13.1183 15.1005 13.25 15.4185 13.25 15.75C13.25 16.0815 13.1183 16.3995 12.8839 16.6339C12.6495 16.8683 12.3315 17 12 17C11.6685 17 11.3505 16.8683 11.1161 16.6339C10.8817 16.3995 10.75 16.0815 10.75 15.75C10.75 15.4185 10.8817 15.1005 11.1161 14.8661C11.3505 14.6317 11.6685 14.5 12 14.5ZM7.75 10.5C8.08152 10.5 8.39946 10.6317 8.63388 10.8661C8.8683 11.1005 9 11.4185 9 11.75C9 12.0815 8.8683 12.3995 8.63388 12.6339C8.39946 12.8683 8.08152 13 7.75 13C7.41848 13 7.10054 12.8683 6.86612 12.6339C6.6317 12.3995 6.5 12.0815 6.5 11.75C6.5 11.4185 6.6317 11.1005 6.86612 10.8661C7.10054 10.6317 7.41848 10.5 7.75 10.5ZM12 10.5C12.3315 10.5 12.6495 10.6317 12.8839 10.8661C13.1183 11.1005 13.25 11.4185 13.25 11.75C13.25 12.0815 13.1183 12.3995 12.8839 12.6339C12.6495 12.8683 12.3315 13 12 13C11.6685 13 11.3505 12.8683 11.1161 12.6339C10.8817 12.3995 10.75 12.0815 10.75 11.75C10.75 11.4185 10.8817 11.1005 11.1161 10.8661C11.3505 10.6317 11.6685 10.5 12 10.5ZM16.25 10.5C16.5815 10.5 16.8995 10.6317 17.1339 10.8661C17.3683 11.1005 17.5 11.4185 17.5 11.75C17.5 12.0815 17.3683 12.3995 17.1339 12.6339C16.8995 12.8683 16.5815 13 16.25 13C15.9185 13 15.6005 12.8683 15.3661 12.6339C15.1317 12.3995 15 12.0815 15 11.75C15 11.4185 15.1317 11.1005 15.3661 10.8661C15.6005 10.6317 15.9185 10.5 16.25 10.5ZM17.75 4.5H6.25C5.78587 4.5 5.34075 4.68437 5.01256 5.01256C4.68437 5.34075 4.5 5.78587 4.5 6.25V7H19.5V6.25C19.5 5.78587 19.3156 5.34075 18.9874 5.01256C18.6592 4.68437 18.2141 4.5 17.75 4.5Z' fill='%238B8C9E'/%3e%3c/svg%3e";const it=()=>i("img",{src:lt,alt:""}),at=e=>{var{control:r,name:n,required:t,label:l,placeholder:c,defaultValue:u,format:p=Mr,hideErrorMessage:m=!1,textFieldProps:g={},requiredErrorText:y="",validate:v,dateCondition:C,validateErrorText:O}=e,E=s(e,["control","name","required","label","placeholder","defaultValue","format","hideErrorMessage","textFieldProps","requiredErrorText","validate","dateCondition","validateErrorText"]);const[x,j]=f(Mr),{field:V,fieldState:{error:R}}=T({control:r,name:n,defaultValue:u,rules:{required:!!t&&(y||Hr),validate:v||(e=>{if(""!==e&&x&&e&&!ye(e,x))return null!=O?O:Jr;if(C&&e){const r=fe(e,x,new Date),n=new Date;switch(C){case"current":return!!Oe(r)||"Только сегодняшний день";case"gt":return!Oe(r)&&!xe(r,n)||"Только будущие даты";case"lt":return!Oe(r)&&!Ee(r,n)||"Только прошлые даты";case"gte":return!(!Oe(r)&&xe(r,n))||"Только текущая или будущие даты";case"lte":return!(!Oe(r)&&Ee(r,n))||"Только текущая или прошлые даты";default:return!0}}return!0})}}),N=b((e=>{V.onChange(be(e)?he(e,x):e)}),[V,x]);return h((()=>{if(p){const e=p.replace(/[Zzx]+/g,"XX");try{ye(he(new Date,e),e),j(e)}catch(e){console.error(e)}}}),[p]),a(o,{children:[i(Z,Object.assign({required:t},{children:l})),i(ge,Object.assign({},V,x?{inputFormat:x}:{},{value:x?fe(V.value,x,new Date):V.value,onChange:N,disableFuture:"lte"===C||"current"===C,disablePast:"gte"===C||"current"===C,maxDate:"lt"===C?ve():null,minDate:"gt"===C?Ce():null,components:{OpenPickerIcon:it}},E,{renderInput:e=>i(d,Object.assign({},e,{fullWidth:!0,size:"small",variant:"outlined",name:n,error:!!R,helperText:!m&&(null==R?void 0:R.message),FormHelperTextProps:{variant:"standard"},inputProps:Object.assign(Object.assign({},e.inputProps),{placeholder:c})},g))}))]})},ot=()=>i("img",{src:lt,alt:""}),st=e=>{var{control:r,name:n,required:t,label:l,placeholder:c,defaultValue:u,format:p=Fr,hideErrorMessage:m=!1,textFieldProps:g,requiredErrorText:y="",validate:v,dateCondition:C,validateErrorText:O}=e,E=s(e,["control","name","required","label","placeholder","defaultValue","format","hideErrorMessage","textFieldProps","requiredErrorText","validate","dateCondition","validateErrorText"]);const[x,j]=f(),{field:V,fieldState:{error:R}}=T({control:r,name:n,defaultValue:u,rules:{required:!!t&&(y||Hr),validate:v||(e=>{if(""!==e&&x&&e&&!ye(e,x))return null!=O?O:Jr;if(C&&e){const r=fe(e,x,new Date),n=new Date;switch(C){case"current":return!!Oe(r)||"Только сегодняшний день";case"gt":return!Oe(r)&&!xe(r,n)||"Только будущие даты";case"lt":return!Oe(r)&&!Ee(r,n)||"Только прошлые даты";case"gte":return!(!Oe(r)&&xe(r,n))||"Только текущая или будущие даты";case"lte":return!(!Oe(r)&&Ee(r,n))||"Только текущая или прошлые даты";default:return!0}}return!0})}}),N=b((e=>{V.onChange(be(e)?he(e,x):e)}),[V,x]);return h((()=>{const e=p.replace(/[Zzx]+/g,"XX");try{ye(he(new Date,e),e),j(e)}catch(e){console.error(e)}}),[p]),i(je,Object.assign({},V,{ampm:!1,label:t?a(o,{children:[l," ",i("span",{children:"*"})]}):l,value:x?fe(V.value,x,new Date):V.value},x?{inputFormat:x}:{},{onChange:N,disableFuture:"lte"===C||"current"===C,disablePast:"gte"===C||"current"===C,maxDate:"lt"===C?ve():null,minDate:"gt"===C?Ce():null,components:{OpenPickerIcon:ot}},E,{renderInput:e=>i(d,Object.assign({},e,{fullWidth:!0,size:"small",sx:{".MuiInputLabel-root span":{color:"#D6331F"}},inputProps:Object.assign(Object.assign({},e.inputProps),{placeholder:c}),variant:"outlined",name:n,error:!!R,helperText:!m&&(null==R?void 0:R.message),FormHelperTextProps:{variant:"standard"}},g))}))},ct=e=>{var{control:r,name:n,required:t,label:l,textFieldProps:c={},format:u=Dr,hideErrorMessage:p=!1,requiredErrorText:m="",placeholder:g,defaultValue:b}=e,y=s(e,["control","name","required","label","textFieldProps","format","hideErrorMessage","requiredErrorText","placeholder","defaultValue"]);const v=T({control:r,name:n,defaultValue:b,rules:{required:!!t&&(m||Hr),validate:e=>!!ye(e,u)||"Incorrect date format"}}),C=v.field,{onChange:O,ref:E,value:x}=C,j=s(C,["onChange","ref","value"]),{fieldState:{error:V}}=v,[R,N]=f(null);return h((()=>{if(x&&u){let e=fe(x,u,new Date);be(e)||(e=fe(x,"HH:mm:ss.SSS",new Date)),N(e)}}),[x,u]),i(Ve,Object.assign({},j,{mask:"",inputRef:E,label:t?a(o,{children:[l," ",i("span",{children:"*"})]}):l,ampm:!1,value:R,inputFormat:u,onChange:e=>{N(e),O(be(e)?he(e,u):e)}},y,{renderInput:e=>i(d,Object.assign({},e,{fullWidth:!0,size:"small",sx:{".MuiInputLabel-root span":{color:"#D6331F"}},inputProps:Object.assign(Object.assign({},e.inputProps),{placeholder:g}),variant:"outlined",name:n,error:!!V,helperText:!p&&(null==V?void 0:V.message),FormHelperTextProps:{variant:"standard"}}))}))},dt=e=>{var r,n,t,{name:l,control:c,label:u,required:p,defaultValue:m=null,onChange:g,textFieldLabel:h}=e,v=s(e,["name","control","label","required","defaultValue","onChange","textFieldLabel"]);const[C,O]=f(""),[E,x]=f(null),j=T({control:c,name:l,defaultValue:m,rules:{required:p&&Hr}}),V=j.field,{onChange:R,value:N}=V,w=s(V,["onChange","value"]),{formState:{errors:S}}=j,k=y((()=>g||R),[g,R]),A=b((e=>{const{value:r}=e.target;O(r)}),[]),M=b((()=>{x(null),!C||Array.isArray(N)&&N.includes(C)?Array.isArray(N)&&N.includes(C)&&x("This value already exists"):(k([...null!=N?N:[],C]),O(""))}),[C,k,N]),D=b((e=>{k(N.filter((r=>r!==e)))}),[N,k]),F=b((e=>{"Enter"!==e.key&&13!==e.keyCode||(e.stopPropagation(),e.preventDefault(),M())}),[M]);return a(o,{children:[i(Z,Object.assign({required:p},{children:u})),i(B,Object.assign({display:"flex",flexWrap:"wrap"},{children:null==N?void 0:N.map(((e,r)=>i(Te,{sx:{mr:1,mb:1},variant:"outlined",label:e,onDelete:()=>D(e)},r)))})),i("input",Object.assign({type:"hidden"},c.register(l),{onChange:k,value:N},w)),i(d,Object.assign({fullWidth:!0,variant:"outlined",size:"small",label:h||""===h?h:`Add ${null!=u?u:""}`,value:C,onChange:A,error:!!(null===(r=S[l])||void 0===r?void 0:r.message),helperText:null===(n=S[l])||void 0===n?void 0:n.message,FormHelperTextProps:{variant:"standard"},name:l,onKeyDown:F,InputProps:{endAdornment:i(I,Object.assign({size:"small",onClick:M},{children:i(L,{children:i("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"})})}))},inputProps:Object.assign({},null!==(t=null==v?void 0:v.inputProps)&&void 0!==t?t:{})},v)),E&&i(G,Object.assign({error:!0},{children:E}))]})},ut=({name:e="period",control:r,label:n="Period",required:t,isSecondsVisible:l=!1})=>{var s;const[c,u]=f(),{setValue:p,register:m,formState:{errors:g}}=N(),y=R({control:r,name:e}),v=b((r=>{const{name:n,value:t}=r.target,l=Object.assign({},null!=c?c:{});t?(l[n]=+t,p(e,Ne(l),{shouldValidate:!0})):(delete l[n],p(e,"",{shouldValidate:!0})),u(l)}),[p,e,c]),C=null===(s=g[e])||void 0===s?void 0:s.message;return h((()=>{y&&!c&&u(we(y))}),[c,y]),a(o,{children:[i("input",Object.assign({type:"hidden"},m(e,{required:t&&"Please, fill one of the fields"}))),i(z,Object.assign({variant:"subtitle1"},{children:t?a(o,{children:[n," ",i(B,Object.assign({component:"span",color:"#D6331F"},{children:"*"}))]}):n})),C&&i(G,Object.assign({error:!0},{children:C})),a(Re,Object.assign({container:!0,columns:2,spacing:2,flexWrap:"wrap"},{children:[i(Re,Object.assign({sm:1},{children:i(d,{variant:"outlined",size:"small",value:(null==c?void 0:c.years)||"",error:!!C,name:"years",label:"Years",type:"number",onChange:v,fullWidth:!0,FormHelperTextProps:{variant:"standard"}})})),i(Re,Object.assign({sm:1},{children:i(d,{variant:"outlined",size:"small",error:!!C,value:(null==c?void 0:c.months)||"",name:"months",label:"Months",type:"number",onChange:v,fullWidth:!0,FormHelperTextProps:{variant:"standard"}})})),i(Re,Object.assign({sm:1},{children:i(d,{variant:"outlined",size:"small",error:!!C,value:(null==c?void 0:c.weeks)||"",name:"weeks",label:"Weeks",type:"number",onChange:v,fullWidth:!0,FormHelperTextProps:{variant:"standard"}})})),i(Re,Object.assign({sm:1},{children:i(d,{variant:"outlined",size:"small",error:!!C,value:(null==c?void 0:c.days)||"",name:"days",label:"Days",type:"number",onChange:v,fullWidth:!0,FormHelperTextProps:{variant:"standard"}})})),i(Re,Object.assign({sm:1},{children:i(d,{variant:"outlined",size:"small",error:!!C,value:(null==c?void 0:c.hours)||"",name:"hours",label:"Hours",type:"number",onChange:v,fullWidth:!0,FormHelperTextProps:{variant:"standard"}})})),i(Re,Object.assign({sm:1},{children:i(d,{variant:"outlined",size:"small",error:!!C,value:(null==c?void 0:c.minutes)||"",name:"minutes",label:"Minutes",type:"number",onChange:v,fullWidth:!0,FormHelperTextProps:{variant:"standard"}})})),l&&i(Re,Object.assign({sm:1},{children:i(d,{variant:"outlined",size:"small",error:!!C,value:(null==c?void 0:c.seconds)||"",name:"seconds",label:"Seconds",type:"number",onChange:v,fullWidth:!0,FormHelperTextProps:{variant:"standard"}})}))]}))]})};const pt=e=>{var{control:r,name:n,label:t,required:l,mask:c="+7 (799) 999 99 99",requiredErrorText:u="",inputMaskProps:p,disabled:m,validate:g,invalidErrorText:h}=e,f=s(e,["control","name","label","required","mask","requiredErrorText","inputMaskProps","disabled","validate","invalidErrorText"]);return i(w,{control:r,name:n,rules:{required:!!l&&(u||Hr),validate:e=>!l&&!e||(/(\+7\s\(\d{3}\)\s)(\d{3}\s\d{2})(\s\d{2})/.test(e)?!g||("function"!=typeof g||g(e)):h||"Incorrect phone number format")},render:({field:e,fieldState:{error:r}})=>i(Se,Object.assign({disabled:m,mask:c,value:e.value,onChange:e.onChange,onBlur:e.onBlur},p,{children:i(d,Object.assign({fullWidth:!0,size:"small",label:l&&t?a(o,{children:[t," ",i("span",{children:"*"})]}):t,sx:{".MuiInputLabel-root span":{color:"#D6331F"}},inputMode:"numeric",InputProps:{startAdornment:i(A,Object.assign({position:"start"},{children:i("img",{src:"data:image/svg+xml,%3csvg width='32' height='24' viewBox='0 0 32 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg clip-path='url(%23clip0_6762_5474)'%3e%3crect width='32' height='24' rx='2' fill='white'/%3e%3cmask id='mask0_6762_5474' style='mask-type:luminance' maskUnits='userSpaceOnUse' x='0' y='0' width='32' height='24'%3e%3crect width='32' height='24' rx='2' fill='white'/%3e%3c/mask%3e%3cg mask='url(%23mask0_6762_5474)'%3e%3crect width='32' height='24' fill='%2330C6E0'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M16.0001 16.8002C18.5249 16.8002 20.5716 14.6512 20.5716 12.0002C20.5716 9.34923 18.5249 7.2002 16.0001 7.2002C13.4754 7.2002 11.4287 9.34923 11.4287 12.0002C11.4287 14.6512 13.4754 16.8002 16.0001 16.8002Z' fill='%23FFCD4B'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M14.1352 20.5791L16.0001 17.6561L17.865 20.5791L18.3374 17.096L21.2255 18.8799L20.2118 15.5264L23.5511 15.818L21.252 13.2584L24.381 11.9998L21.252 10.7411L23.5511 8.1816L20.2118 8.47311L21.2255 5.11966L18.3374 6.90359L17.865 3.42041L16.0001 6.34344L14.1352 3.42041L13.6628 6.90359L10.7747 5.11966L11.7884 8.47311L8.44912 8.1816L10.7482 10.7411L7.61914 11.9998L10.7482 13.2584L8.44912 15.818L11.7884 15.5264L10.7747 18.8799L13.6628 17.096L14.1352 20.5791ZM21.3334 11.9998C21.3334 15.0926 18.9456 17.5998 16.0001 17.5998C13.0546 17.5998 10.6668 15.0926 10.6668 11.9998C10.6668 8.90698 13.0546 6.39978 16.0001 6.39978C18.9456 6.39978 21.3334 8.90698 21.3334 11.9998Z' fill='%23FFCD4B'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M1.52393 1.93343C1.52393 1.74934 1.67316 1.6001 1.85726 1.6001H2.7144C2.8985 1.6001 3.04774 1.74934 3.04774 1.93343V2.86676C3.04774 3.05086 2.8985 3.2001 2.7144 3.2001H1.85726C1.67316 3.2001 1.52393 3.05086 1.52393 2.86676V1.93343ZM1.52393 5.13343C1.52393 4.94934 1.67316 4.8001 1.85726 4.8001H2.7144C2.8985 4.8001 3.04774 4.94934 3.04774 5.13343V6.06676C3.04774 6.25086 2.8985 6.4001 2.7144 6.4001H1.85726C1.67316 6.4001 1.52393 6.25086 1.52393 6.06676V5.13343ZM1.85726 8.0001C1.67316 8.0001 1.52393 8.14934 1.52393 8.33343V9.26676C1.52393 9.45086 1.67316 9.6001 1.85726 9.6001H2.7144C2.8985 9.6001 3.04774 9.45086 3.04774 9.26676V8.33343C3.04774 8.14934 2.8985 8.0001 2.7144 8.0001H1.85726ZM1.52393 11.5334C1.52393 11.3493 1.67316 11.2001 1.85726 11.2001H2.7144C2.8985 11.2001 3.04774 11.3493 3.04774 11.5334V12.4668C3.04774 12.6509 2.8985 12.8001 2.7144 12.8001H1.85726C1.67316 12.8001 1.52393 12.6509 1.52393 12.4668V11.5334ZM1.85726 14.4001C1.67316 14.4001 1.52393 14.5493 1.52393 14.7334V15.6668C1.52393 15.8509 1.67316 16.0001 1.85726 16.0001H2.7144C2.8985 16.0001 3.04774 15.8509 3.04774 15.6668V14.7334C3.04774 14.5493 2.8985 14.4001 2.7144 14.4001H1.85726ZM1.52393 17.9334C1.52393 17.7493 1.67316 17.6001 1.85726 17.6001H2.7144C2.8985 17.6001 3.04774 17.7493 3.04774 17.9334V18.8668C3.04774 19.0509 2.8985 19.2001 2.7144 19.2001H1.85726C1.67316 19.2001 1.52393 19.0509 1.52393 18.8668V17.9334ZM1.85726 20.8001C1.67316 20.8001 1.52393 20.9493 1.52393 21.1334V22.0668C1.52393 22.2509 1.67316 22.4001 1.85726 22.4001H2.7144C2.8985 22.4001 3.04774 22.2509 3.04774 22.0668V21.1334C3.04774 20.9493 2.8985 20.8001 2.7144 20.8001H1.85726ZM3.04774 19.5334C3.04774 19.3493 3.19697 19.2001 3.38107 19.2001H4.23821C4.42231 19.2001 4.57154 19.3493 4.57154 19.5334V20.4668C4.57154 20.6509 4.42231 20.8001 4.23821 20.8001H3.38107C3.19697 20.8001 3.04774 20.6509 3.04774 20.4668V19.5334ZM3.38107 16.0001C3.19697 16.0001 3.04774 16.1493 3.04774 16.3334V17.2668C3.04774 17.4509 3.19697 17.6001 3.38107 17.6001H4.23821C4.42231 17.6001 4.57154 17.4509 4.57154 17.2668V16.3334C4.57154 16.1493 4.42231 16.0001 4.23821 16.0001H3.38107ZM3.04774 13.1334C3.04774 12.9493 3.19697 12.8001 3.38107 12.8001H4.23821C4.42231 12.8001 4.57154 12.9493 4.57154 13.1334V14.0668C4.57154 14.2509 4.42231 14.4001 4.23821 14.4001H3.38107C3.19697 14.4001 3.04774 14.2509 3.04774 14.0668V13.1334ZM3.38107 9.6001C3.19697 9.6001 3.04774 9.74934 3.04774 9.93343V10.8668C3.04774 11.0509 3.19697 11.2001 3.38107 11.2001H4.23821C4.42231 11.2001 4.57154 11.0509 4.57154 10.8668V9.93343C4.57154 9.74934 4.42231 9.6001 4.23821 9.6001H3.38107ZM3.04774 6.73343C3.04774 6.54934 3.19697 6.4001 3.38107 6.4001H4.23821C4.42231 6.4001 4.57154 6.54934 4.57154 6.73343V7.66676C4.57154 7.85086 4.42231 8.0001 4.23821 8.0001H3.38107C3.19697 8.0001 3.04774 7.85086 3.04774 7.66676V6.73343ZM3.38107 3.2001C3.19697 3.2001 3.04774 3.34934 3.04774 3.53343V4.46676C3.04774 4.65086 3.19697 4.8001 3.38107 4.8001H4.23821C4.42231 4.8001 4.57154 4.65086 4.57154 4.46676V3.53343C4.57154 3.34934 4.42231 3.2001 4.23821 3.2001H3.38107Z' fill='%23FFCD4B'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath id='clip0_6762_5474'%3e%3crect width='32' height='24' rx='4' fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",alt:""})}))}},f,{error:!!r,FormHelperTextProps:{variant:"standard"},helperText:null==r?void 0:r.message}))}))})};var mt="data:image/svg+xml,%3csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M5.99995 8L9.99995 12L14 8H5.99995Z' fill='%236D7C8B'/%3e%3c/svg%3e";const gt=()=>i("img",{src:mt,alt:""});var ht=()=>{const e=Ie(),r=Ae(e,Me),n=Ae(e,De),t=Ae(e,Fe),l=Ae(e,Pe),o=r=>e.current.setPage(r);return a(B,Object.assign({px:2,display:"flex",alignItems:"center"},{children:[i(Le,{component:"div",page:r,count:t,rowsPerPage:l,rowsPerPageOptions:[10,20,50,100],onPageChange:(e,r)=>o(r),onRowsPerPageChange:r=>e.current.setPageSize(parseInt(r.target.value,10)),labelRowsPerPage:"Строк на странице",labelDisplayedRows:({from:e,to:r,count:n})=>`${e}–${r} из ${-1!==n?n:`более ${r}`}`,ActionsComponent:void 0,SelectProps:{IconComponent:gt}}),i(ke,{count:n,page:r+1,onChange:(e,r)=>o(r-1)})]}))};var ft=e=>{var{hideMenu:r,currentColumn:n,onUnsort:t}=e,l=s(e,["hideMenu","currentColumn","onUnsort"]);return i(qe,Object.assign({hideMenu:r,currentColumn:n},l,{children:i($e,{onClick:r,column:n})}))};var bt=({mode:e})=>{const[r,n]=se(),t=+r.get("page")||0,l=+r.get("size")||10;return h((()=>{"server"===e&&(r.has("page")||r.set("page","0"),r.has("size")||r.set("size","10"),n(r,{replace:!0}))}),[e,r,n]),{page:t,size:l,onPageChange:e=>{r.set("page",`${e}`),n(r,{replace:!0})},onSizeChange:e=>{r.set("size",`${e}`),n(r,{replace:!0})}}};var yt=()=>{const[e,r]=se(),n=e.getAll("sort").map((e=>e.split(",")));return{onColumnHeaderClick:({field:n,colDef:t})=>{if(t.sortable){let t=!1;const l=e.getAll("sort");e.delete("sort"),l.forEach((r=>{const[l,i]=r.split(",");l===n?(t=!0,"asc"===i&&e.append("sort",`${l},desc`)):e.append("sort",`${l},${i}`)})),t||e.append("sort",`${n},asc`),r(e,{replace:!0})}},getSortedColumns:e=>e.map((e=>{const r=n.find((r=>r[0]===e.field));return e.headerClassName=r?`Sorted --${r[1]} `:"",e}))}};var vt=e=>{const[r,n]=f(10);h((()=>{n(e)}),[e]);return{pageSize:r,handlePageSizeChange:e=>n(e)}},Ct="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M3.47341 10.4087C3.3698 10.2747 3.32108 10.1063 3.33715 9.9377C3.35321 9.76909 3.43285 9.61291 3.55989 9.50088C3.68693 9.38886 3.85185 9.3294 4.02115 9.33457C4.19045 9.33974 4.35144 9.40915 4.47141 9.52872L8.00008 13.0574L11.5287 9.52872L11.5914 9.47338C11.7254 9.36978 11.8938 9.32106 12.0624 9.33712C12.231 9.35318 12.3872 9.43282 12.4992 9.55987C12.6113 9.68691 12.6707 9.85183 12.6656 10.0211C12.6604 10.1904 12.591 10.3514 12.4714 10.4714L8.47141 14.4714L8.40874 14.5267C8.28047 14.6262 8.12031 14.6755 7.95829 14.6653C7.79627 14.6551 7.64354 14.5862 7.52874 14.4714L3.52874 10.4714L3.47341 10.4087ZM12.5267 5.59138C12.6304 5.72538 12.6791 5.89379 12.663 6.0624C12.6469 6.23102 12.5673 6.3872 12.4403 6.49922C12.3132 6.61124 12.1483 6.67071 11.979 6.66554C11.8097 6.66037 11.6487 6.59095 11.5287 6.47138L8.00008 2.94272L4.47141 6.47138L4.40874 6.52672C4.27475 6.63032 4.10634 6.67905 3.93773 6.66298C3.76911 6.64692 3.61293 6.56728 3.50091 6.44024C3.38889 6.31319 3.32942 6.14827 3.33459 5.97897C3.33976 5.80967 3.40918 5.64869 3.52874 5.52872L7.52874 1.52872L7.59141 1.47338C7.71968 1.37388 7.87985 1.3246 8.04187 1.33479C8.20388 1.34498 8.35662 1.41393 8.47141 1.52872L12.4714 5.52872L12.5267 5.59138Z' fill='%23262842'/%3e%3c/svg%3e",Ot="data:image/svg+xml,%3c%3fxml version='1.0' encoding='utf-8'%3f%3e%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e %3cg transform='matrix(1%2c 0%2c 0%2c 1%2c 0.05728%2c 0.935561)'%3e %3cpath d='M 3.473 9.409 C 3.37 9.275 3.321 9.106 3.337 8.938 C 3.353 8.769 3.433 8.613 3.56 8.501 C 3.687 8.389 3.852 8.329 4.021 8.335 C 4.19 8.34 4.351 8.409 4.471 8.529 L 8 12.057 L 11.529 8.529 L 11.591 8.473 C 11.725 8.37 11.894 8.321 12.062 8.337 C 12.231 8.353 12.387 8.433 12.499 8.56 C 12.611 8.687 12.671 8.852 12.666 9.021 C 12.66 9.19 12.591 9.351 12.471 9.471 L 8.471 13.471 L 8.409 13.527 C 8.28 13.626 8.12 13.676 7.958 13.665 C 7.796 13.655 7.644 13.586 7.529 13.471 L 3.529 9.471 L 3.473 9.409 Z' fill='%23262842' style='fill-opacity: 0.6%3b'/%3e %3cpath d='M 12.472 4.636 C 12.575 4.77 12.624 4.939 12.608 5.107 C 12.592 5.276 12.512 5.432 12.385 5.544 C 12.258 5.656 12.093 5.716 11.924 5.71 C 11.755 5.705 11.594 5.636 11.474 5.516 L 7.945 1.988 L 4.416 5.516 L 4.354 5.572 C 4.22 5.675 4.051 5.724 3.883 5.708 C 3.714 5.692 3.558 5.612 3.446 5.485 C 3.334 5.358 3.274 5.193 3.28 5.024 C 3.285 4.855 3.354 4.694 3.474 4.574 L 7.474 0.574 L 7.536 0.518 C 7.665 0.419 7.825 0.37 7.987 0.38 C 8.149 0.39 8.302 0.459 8.416 0.574 L 12.416 4.574 L 12.472 4.636 Z' fill='%23262842' style='fill-opacity: 1%3b'/%3e %3c/g%3e%3c/svg%3e",Et="data:image/svg+xml,%3c%3fxml version='1.0' encoding='utf-8'%3f%3e%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e %3cg transform='matrix(1%2c 0%2c 0%2c 1%2c 0.05728%2c 0.935561)'%3e %3cpath d='M 3.473 9.409 C 3.37 9.275 3.321 9.106 3.337 8.938 C 3.353 8.769 3.433 8.613 3.56 8.501 C 3.687 8.389 3.852 8.329 4.021 8.335 C 4.19 8.34 4.351 8.409 4.471 8.529 L 8 12.057 L 11.529 8.529 L 11.591 8.473 C 11.725 8.37 11.894 8.321 12.062 8.337 C 12.231 8.353 12.387 8.433 12.499 8.56 C 12.611 8.687 12.671 8.852 12.666 9.021 C 12.66 9.19 12.591 9.351 12.471 9.471 L 8.471 13.471 L 8.409 13.527 C 8.28 13.626 8.12 13.676 7.958 13.665 C 7.796 13.655 7.644 13.586 7.529 13.471 L 3.529 9.471 L 3.473 9.409 Z' fill='%23262842' style='fill-opacity: 1%3b'/%3e %3cpath d='M 12.472 4.636 C 12.575 4.77 12.624 4.939 12.608 5.107 C 12.592 5.276 12.512 5.432 12.385 5.544 C 12.258 5.656 12.093 5.716 11.924 5.71 C 11.755 5.705 11.594 5.636 11.474 5.516 L 7.945 1.988 L 4.416 5.516 L 4.354 5.572 C 4.22 5.675 4.051 5.724 3.883 5.708 C 3.714 5.692 3.558 5.612 3.446 5.485 C 3.334 5.358 3.274 5.193 3.28 5.024 C 3.285 4.855 3.354 4.694 3.474 4.574 L 7.474 0.574 L 7.536 0.518 C 7.665 0.419 7.825 0.37 7.987 0.38 C 8.149 0.39 8.302 0.459 8.416 0.574 L 12.416 4.574 L 12.472 4.636 Z' fill='%23262842' style='fill-opacity: 0.6%3b'/%3e %3c/g%3e%3c/svg%3e";const xt=()=>i("img",{src:Ct,alt:""}),jt=()=>i("img",{src:Ot,alt:""}),Vt=()=>i("img",{src:Et,alt:""}),Tt=t(Be)((({theme:e})=>({"& .MuiDataGrid-row":{cursor:"pointer"},"& .MuiDataGrid-cell:focus-within, & .MuiDataGrid-cell:focus":{outline:"none !important"},"& .MuiDataGrid-columnHeader:focus-within, & .MuiDataGrid-columnHeader:focus":{outline:"none !important"},"& .MuiDataGrid-columnHeader--sortable":{"& .MuiDataGrid-iconButtonContainer":{visibility:"visible !important",width:"auto !important"},"& .MuiDataGrid-sortIcon":{visibility:"visible !important",opacity:1}}}))),Rt=e=>{var{columns:r,rows:n,rowCount:t,loading:l,disableMargin:a,mode:o="server",initialPageSize:c=10,pagination:d=!0,onCellClick:u}=e,p=s(e,["columns","rows","rowCount","loading","disableMargin","mode","initialPageSize","pagination","onCellClick"]);const{page:m,size:g,onPageChange:h,onSizeChange:f}=bt({mode:o}),{onColumnHeaderClick:b,getSortedColumns:y}=yt(),{pageSize:v,handlePageSizeChange:C}=vt(c),O={sortingMode:o,paginationMode:o,pageSize:"server"===o?g:d?v:t,onPageSizeChange:"server"===o?f:C,components:{BaseTooltip:le,Pagination:ht,ColumnUnsortedIcon:e=>(s(e,["sortingOrder"]),i(xt,{})),ColumnSortedDescendingIcon:e=>(s(e,["sortingOrder"]),i(Vt,{})),ColumnSortedAscendingIcon:e=>(s(e,["sortingOrder"]),i(jt,{}))}};return"server"===o&&(O.onColumnHeaderClick=b,O.page=m,O.onPageChange=h,O.components.ColumnMenu=ft),i(B,Object.assign({mt:a?0:2},{children:i(Tt,Object.assign({autoHeight:!0,hideFooterPagination:!d,hideFooter:!d,disableSelectionOnClick:!0,loading:l,rows:n,disableColumnMenu:!0,columns:y(r),rowCount:t,rowsPerPageOptions:[10,20,50,100],onCellClick:u},O,p))}))},Nt=({icon:e,label:r,showInMenu:n,onClick:t,location:l})=>{var a;return l?i(I,Object.assign({component:oe,to:l.pathname,state:null!==(a=l.state)&&void 0!==a?a:null,size:"small"},{children:i(le,Object.assign({title:r,arrow:!0},{children:m.cloneElement(e,{fontSize:"small"})}))})):i(ze,{nonce:"",onResize:void 0,onResizeCapture:void 0,icon:i(le,Object.assign({title:r,arrow:!0},{children:e})),onClick:t,label:r,showInMenu:n})};var wt=()=>{const[e,r]=se(),n=y((()=>{var r;return null!==(r=e.get("page"))&&void 0!==r?r:0}),[e]),t=y((()=>{var r;return null!==(r=e.get("size"))&&void 0!==r?r:10}),[e]),l=b((e=>{r((r=>(r.set("page",`${e}`),r)))}),[r]),i=b((e=>{r((r=>(r.set("size",`${e}`),r)))}),[r]);return h((()=>{e.has("page")||r((e=>(e.set("page","0"),e))),e.has("size")||r((e=>(e.set("size","10"),e)))}),[e,r]),{page:n,size:t,onPageChange:l,onSizeChange:i}};var St=()=>{const[e,r]=se(),n=y((()=>e.getAll("sort").map((e=>e.split(",")))),[e]),t=b((e=>{r((r=>{r.delete("sort");let t=!1;return n.forEach((([n,l])=>{n===e?(t=!0,"asc"===l&&r.append("sort",`${n},desc`)):r.append("sort",`${n},${l}`)})),t||r.append("sort",`${e},asc`),r}))}),[n,r]),l=b((e=>{const r=n.find((([r,n])=>r===e));return!!r&&r[1]}),[n]);return{sortParams:n,onSortChanged:t,getColumnSorting:l}};const kt=t(Ke)((({active:e})=>({".MuiSvgIcon-root":{opacity:e?1:.5,marginTop:"4%"}}))),Lt=()=>i("img",{src:mt,alt:""}),It=()=>i("img",{src:Ct,alt:""}),At=()=>i("img",{src:Ot,alt:""}),Mt=()=>i("img",{src:Et,alt:""});function Dt({columns:e=[],rows:r=[],totalCount:n,children:t,pagination:l=!0,loading:o=!1,onRowClick:s,emptyDataText:c,verticalAlign:d="middle",labelRowsPerPage:u},p){const{page:m,size:g,onPageChange:h,onSizeChange:f}=wt(),{onSortChanged:b,getColumnSorting:y}=St();return i(B,Object.assign({sx:{overflow:"auto"}},{children:a(Ge,Object.assign({sx:{width:"100%",display:"table",tableLayout:"fixed"}},{children:[i(Ze,Object.assign({open:o,sx:{position:"absolute",top:0,left:0}},{children:i($r,{})})),a(_e,Object.assign({ref:p},{children:[i(Ye,{children:i(We,{children:e.map(((e,r)=>{const n=!!e.sortKey&&y(e.sortKey);return i(Je,Object.assign({align:e.align?e.align:"left",sortDirection:n,sx:{width:e.width?`${e.width}%`:"unset"}},{children:i(kt,Object.assign({active:!!n,hideSortIcon:!e.sortKey,direction:n||"asc",IconComponent:"asc"===n?At:"desc"===n?Mt:It,onClick:()=>e.sortKey?b(e.sortKey):{}},{children:e.label}))}),r)}))})}),i(He,{children:r.length?r.map(((r,n)=>i(We,Object.assign({hover:!0,onClick:s?()=>s(r):r.onClick,sx:{verticalAlign:d}},{children:e.map(((e,t)=>i(Je,Object.assign({align:e.align?e.align:"left",sx:{maxWidth:e.width?`${e.width}%`:"unset"}},{children:i(B,Object.assign({sx:{maxWidth:"90%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",padding:({spacing:e})=>e(2.4,0)}},{children:i(B,{children:e.renderCell?e.renderCell(r,n):r[e.id]})}))}),t)))}),n))):i(We,Object.assign({sx:{verticalAlign:d}},{children:i(Je,Object.assign({align:"center",colSpan:e.length},{children:null!=c?c:"Нет данных"}))}))}),l||t?i(Ue,{children:a(We,{children:[t&&i(Je,Object.assign({colSpan:e.length,sx:{background:"#F0F0F7",px:4,py:3}},{children:t})),l&&r.length?i(Le,{rowsPerPageOptions:[5,10,25],count:n,rowsPerPage:+g,page:+m,sx:{borderBottom:"none"},labelRowsPerPage:u,labelDisplayedRows:u?({from:e,to:r,count:n})=>`${e}–${r} из ${-1!==n?n:`более ${r}`}`:void 0,SelectProps:{IconComponent:Lt},onPageChange:(e,r)=>h(r),onRowsPerPageChange:e=>f(+e.target.value)}):null]})}):null]}))]}))}))}const Ft=C(Dt),Pt=({actionsList:e})=>{const[r,n]=f(null),t=Boolean(r),l=()=>{n(null)};return a("div",{children:[i(I,Object.assign({"aria-label":"more",id:"more-button","aria-controls":t?"more-menu":void 0,"aria-expanded":t?"true":void 0,"aria-haspopup":"true",onClick:e=>{e.stopPropagation(),n(e.currentTarget)}},{children:i(Qe,{})})),i(Xe,Object.assign({id:"more-menu",MenuListProps:{"aria-labelledby":"more-button"},anchorEl:r,open:t,onClose:e=>{e.stopPropagation(),l()},PaperProps:{style:{minWidth:"127px"}}},{children:e.map((e=>i(u,Object.assign({onClick:r=>{r.stopPropagation(),e.onClick&&e.onClick(),l()}},{children:e.title}),e.title)))}))]})},qt=e=>{const{children:r,value:n,index:t}=e,l=s(e,["children","value","index"]);return i("div",Object.assign({role:"tabpanel",hidden:n!==t,id:`simple-tabpanel-${t}`,"aria-labelledby":`simple-tab-${t}`},l,{children:n===t?r:null}))},$t=e=>{var r;const{tabs:n}=e,t=ie(),l=ae(),o=y((()=>new URLSearchParams(l.search)),[l.search]),s=o.get("tab");return a(B,{children:[i(er,{children:i(nr,Object.assign({value:s||(null===(r=n[0])||void 0===r?void 0:r.name),indicatorColor:"primary",textColor:"primary",onChange:(e,r)=>{o.set("tab",r),t({pathname:l.pathname,search:o.toString()},{replace:!0})}},{children:n.map((e=>i(rr,{value:e.name,label:e.label},e.name)))}))}),i(B,Object.assign({mt:2},{children:n.map((e=>{var r;return i(qt,Object.assign({value:s||(null===(r=n[0])||void 0===r?void 0:r.name),index:e.name},{children:e.component}),e.name)}))}))]})},Bt=({title:e,text:r,json:n})=>a(B,Object.assign({sx:{paddingBottom:8}},{children:[i(B,Object.assign({sx:{fontSize:"14px",fontWeight:600,color:"#536DFE"}},{children:e})),r&&i(B,Object.assign({sx:{fontSize:"18px",wordWrap:"break-word"}},{children:r})),n&&i(Cn,{value:n,height:300})]})),zt=Object.values(qr).sort(((e,r)=>e.localeCompare(r)));var _t=({propertyFieldName:e,control:r})=>a(o,{children:[i(Re,{children:i(nt,{required:!0,control:r,defaultValue:2,name:`${e}.precisionScale`,label:"Precision Scale"})}),i(Re,{children:i(Kr,{required:!0,control:r,name:`${e}.roundingMode`,label:"Rounding Mode",defaultValue:qr.HALF_UP,options:zt})})]});var Ht=({propertyFieldName:e,control:r,defaultValue:n=""})=>i(Re,{children:i(Gr,{required:!0,control:r,defaultValue:n,name:`${e}.format`,label:"Format"})});const Jt=()=>i(B,{component:"span",sx:{display:"inline-block",width:"10px",height:"10px",borderRadius:"50%",backgroundColor:"#536DFE",marginTop:"5px"}}),Gt=({data:e})=>a(sr,Object.assign({nonLinear:!0,orientation:"vertical",connector:i(pr,{sx:{marginLeft:4}}),sx:{width:"100%"}},{children:[e.filter(Boolean).map(((e,r)=>a(cr,Object.assign({expanded:!0},{children:[i(dr,Object.assign({sx:{display:"flex",alignItems:"flex-start"},StepIconComponent:Jt,StepIconProps:{icon:"",completed:!1,active:!0}},{children:e.label})),i(ur,Object.assign({sx:{marginLeft:4}},{children:Array.isArray(e.content)?i(Gt,{data:e.content}):e.content}))]}),r))),i(cr,{})]})),Yt=({properties:e=[]})=>{const r=y((()=>e&&Array.isArray(e)?e.map((e=>{const r="string"==typeof e.propertyType?e.propertyType:e.propertyType?e.propertyType.value:"";return{label:a(B,Object.assign({display:"flex",flexDirection:"column"},{children:[a("b",{children:[e.name,e.isRequired?"*":""]}),a("span",{children:[e.key," | ",e.isMultiple?"multiple":"single"," |"," ",r]})]})),content:"ENTITY"===e.propertyType&&i(Yt,{properties:e.properties})}})):[]),[e]);return i(Gt,{data:r})};var Wt=Yt;const Ut={key:"",propertyType:null,name:"",defaultValue:"",value:"",defaultValues:[],isRequired:!0,isMultiple:!1,sortOrder:0,isEnabled:!0,executeValue:"",uiSettings:""};var Zt=({control:e,parentPropertyFieldName:r,entityDefinition:n=!1,globalParameter:t=!1,entityReferenceDefinitionSources:l,entityReferenceValueComponent:s,fileReferenceValueComponent:d})=>{const u=g(null),{field:{onChange:p}}=T({control:e,name:`${r}.properties`}),m=R({control:e,name:`${r}.properties`,defaultValue:[]}),h=R({control:e,name:`${r}.name`}),{append:y,remove:v}=S({control:e,name:`${r}.properties`}),C=Wr(),[O,E]=f(0),x=b((()=>{if((null==m?void 0:m.length)>0){y(Ut);const e=m.length;E(e)}else y(Ut);u.current.addProperty()}),[m,y]),j=()=>c(void 0,void 0,void 0,(function*(){p(u.current.getProperties()),C.onClose()}));return a(o,{children:[i(Re,{children:i(z,Object.assign({variant:"h6"},{children:"Properties"}))}),i(Re,{children:i(Wt,{properties:m})}),i(Re,{children:i(M,Object.assign({variant:"contained",color:"primary",onClick:C.onOpen},{children:"Edit properties"}))}),a(D,Object.assign({disableEscapeKeyDown:!0,open:C.open,onClose:j,fullWidth:!0,maxWidth:"md"},{children:[a($,{children:[h||"Entity"," Properties"]}),i(P,Object.assign({style:{height:"500px",overflow:"hidden"}},{children:a(Re,Object.assign({container:!0,direction:"row",spacing:2,style:{height:"100%"}},{children:[a(Re,Object.assign({xs:3,style:{backgroundColor:"#f9f9f9",height:"100%",overflowY:"auto"}},{children:[i(sr,Object.assign({nonLinear:!0,activeStep:O,orientation:"vertical",style:{paddingLeft:"4px"}},{children:m.map(((e,r)=>a(cr,Object.assign({onClick:()=>(e=>E(e))(r),style:{cursor:"pointer"}},{children:[i(dr,Object.assign({StepIconProps:{icon:""},style:{wordBreak:"break-word"}},{children:e.name||"(no name)"})),i(ur,{})]}),r)))})),i(M,Object.assign({variant:"contained",size:"small",color:"primary",onClick:x},{children:"Add property"}))]})),i(Re,Object.assign({container:!0,wrap:"nowrap",direction:"column",spacing:2,style:{height:"100%",overflowY:"auto",width:"75%"}},{children:i(gl,{ref:u,properties:m,hideAddButton:!0,parentRemove:v,focusOnIndex:O,entityDefinition:n,globalParameter:t,entityReferenceDefinitionSources:l,entityReferenceValueComponent:s,fileReferenceValueComponent:d})}))]}))})),i(F,{children:i(M,Object.assign({variant:"contained",color:"primary",onClick:j},{children:"Ok"}))})]}))]})};var Kt=({propertyFieldName:e,control:r,sources:n=[{label:"Arsenal Entities",value:"ARSENAL_ENTITIES"}]})=>a(o,{children:[i(Re,{children:i(Kr,{required:!0,control:r,name:`${e}.source`,label:"Source",options:n})}),i(Re,{children:i(Gr,{required:!0,control:r,name:`${e}.definitionCode`,label:"Definition Code"})}),i(Re,{children:i(Gr,{required:!0,control:r,name:`${e}.definitionVersion`,label:"Definition Version",defaultValue:1})}),i(Re,{children:i(Gr,{required:!0,control:r,name:`${e}.labelPropertyCode`,label:"Label Property Code"})}),i(Re,{children:i(Gr,{required:!0,control:r,name:`${e}.valuePropertyCode`,label:"Value Property Code"})})]});const Xt=({control:e,propertyType:r,propertyFieldName:n,entityDefinition:t=!1,globalParameter:l=!1,entityReferenceDefinitionSources:a,entityReferenceValueComponent:o,fileReferenceValueComponent:s})=>{switch(r){case Ar.STRING:return i(dt,{name:`${n}.restrictedValues`,control:e,label:"Restricted Values"});case Ar.BIG_DECIMAL:return i(_t,{propertyFieldName:n,control:e});case Ar.DATE:return i(Ht,{control:e,propertyFieldName:n,defaultValue:Mr});case Ar.TIME:return i(Ht,{control:e,propertyFieldName:n,defaultValue:Dr});case Ar.DATE_TIME:return i(Ht,{control:e,propertyFieldName:n,defaultValue:Fr});case Ar.ENTITY_REFERENCE:return i(Kt,{control:e,propertyFieldName:n,sources:a});case Ar.ENTITY:return i(Zt,{control:e,parentPropertyFieldName:n,globalParameter:l,entityDefinition:t,entityReferenceDefinitionSources:a,entityReferenceValueComponent:o,fileReferenceValueComponent:s});default:return null}};var Qt=({control:e,name:r,label:n,required:t,restrictedValues:l,requiredErrorText:o="",requiredSelectErrorText:s=""})=>{const{field:{onChange:c,ref:d},fieldState:{error:p}}=T({control:e,name:r,rules:{required:!!t&&(Array.isArray(l)&&l.length?s||"Please, select a value":o||Hr)}}),m=R({control:e,name:r});return Array.isArray(l)&&l.length?a(H,Object.assign({fullWidth:!0,size:"small",variant:"outlined",error:!!p},{children:[i(br,Object.assign({htmlFor:"type-select"},{children:n})),i(hr,Object.assign({labelId:"type-select",label:n,value:m||"",onChange:c,ref:d},{children:l.map((e=>i(u,Object.assign({value:e},{children:e}),e)))}))]})):i(Gr,{hideErrorMessage:!0,required:t,control:e,name:r,label:n})};var el=({name:e})=>{const{control:r,setValue:n,register:t}=N(),l=R({control:r,name:e}),s=b((r=>c(void 0,void 0,void 0,(function*(){const t=r.target.files[0];(new FileReader).readAsDataURL(t);const l=yield(e=>new Promise(((r,n)=>{const t=new FileReader;t.readAsDataURL(e),t.onload=()=>{r(t.result)},t.onerror=e=>{n(e)}})))(t);n(e,l)}))),[e,n]);return a(o,{children:[a(B,Object.assign({mb:2,display:"flex",flex:"row"},{children:[i(z,{children:"Does file uploaded:"}),i(L,l?Object.assign({sx:{paddingLeft:2}},{children:i("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})}):Object.assign({sx:{paddingLeft:2}},{children:i("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20zm6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9z"})}))]})),a(M,Object.assign({component:"label",variant:"contained",size:"large",color:"primary",sx:{marginTop:4}},{children:[l?"Change file":"Upload file",i("input",Object.assign({type:"hidden"},t(`${e}`,{required:!0}))),i("input",{type:"file",hidden:!0,onChange:s})]}))]})};const rl=({property:e,name:r,label:n,useExpression:t,control:l,entityReferenceDefinitionSources:a,entityReferenceValueComponent:o,fileReferenceValueComponent:s})=>{var c;switch("string"==typeof e.propertyType?e.propertyType:null===(c=e.propertyType)||void 0===c?void 0:c.value){case Ar.BIG_DECIMAL:case Ar.FLOAT:case Ar.DOUBLE:return i(nt,{required:!0,decimal:!0,hideErrorMessage:!0,control:l,name:r,label:n,valueAsNumber:!0});case Ar.INTEGER:case Ar.BIG_INTEGER:case Ar.LONG:return i(nt,{required:!0,hideErrorMessage:!0,control:l,name:r,label:n,valueAsNumber:!0});case Ar.BOOLEAN:return i(tt,{control:l,name:r,defaultValue:!1});case Ar.DATE:return i(at,{hideErrorMessage:!0,control:l,name:r,label:n,format:e.format});case Ar.TIME:return i(ct,{hideErrorMessage:!0,control:l,name:r,label:n,format:e.format});case Ar.DATE_TIME:return i(st,{hideErrorMessage:!0,control:l,name:r,label:n,format:e.format});case Ar.JSON:return i(pn,{control:l,name:r,label:n,parseValue:!0,hideErrorMessage:!0,validateJson:!0});case Ar.STRING:return i(Qt,{control:l,name:r,label:n,restrictedValues:e.restrictedValues});case Ar.ENTITY_REFERENCE:return o?i(o,{name:r,property:e}):i(Qt,{name:r,label:n,control:l});case Ar.FILE:return i(el,{name:r});case Ar.FILE_REFERENCE:return s?i(s,{name:r}):i(Qt,{name:r,label:n,control:l});case Ar.ANY:return i(pn,{control:l,name:r,hideErrorMessage:!0,label:n});case Ar.ENTITY:return i(ji,{properties:e.properties,dataFieldName:r,useExpression:t,entityReferenceDefinitionSources:a,entityReferenceValueComponent:o,fileReferenceValueComponent:s});default:return i("div",{children:"No widget"})}};var nl=({value:e,property:r,label:n,isDirty:t,required:l=!1,useExpression:i=!1,multipleOptions:a=!1})=>{const o=y((()=>n?`${n} (value)`:`${r.name} (value)`),[n,r]),s=y((()=>n?`${n} (widget)`:`${r.name} (widget)`),[n,r]),c=y((()=>{var e;return"string"==typeof r.propertyType?r.propertyType:null===(e=r.propertyType)||void 0===e?void 0:e.value}),[r]),[d,u]=f(null),p=y((()=>a?_n({propertyType:c,required:l,useExpression:i}):Hn({propertyType:c,required:l,useExpression:i})),[i,l,c,a]),m=y((()=>{switch(c){case Ar.STRING:case Ar.DATE:case Ar.TIME:case Ar.DATE_TIME:case Ar.ENTITY_REFERENCE:case Ar.ANY:case Ar.FILE:case Ar.FILE_REFERENCE:return"";case Ar.JSON:return{};case Ar.BOOLEAN:return!1;case Ar.INTEGER:case Ar.BIG_DECIMAL:case Ar.BIG_INTEGER:case Ar.DOUBLE:case Ar.LONG:case Ar.FLOAT:return 0;default:return null}}),[c]),g=y((()=>c===Ar.JSON||c===Ar.ANY),[c]),v=b((()=>{In(e,g)?u("expression"):null==e||In(e,g)||"widget"===d||"string"===d||u("widget")}),[e,d,g]);return h((()=>{d?t||v():!Dn(e)||r.isRequired||null!==r.defaultValue&&null!==r.value?i&&In(e,g)?u("expression"):u("widget"):u("null")}),[e,d,p,i,t,v,g,l,r]),{propertyType:c,valueLabel:o,fillOptionLabel:s,fillOption:d,fillOptions:p,setFillOption:u,defaultProperyValue:m,checkFillOption:v}};const tl=t(br)((()=>({inputLabel:{overflow:"hidden",textOverflow:"ellipsis",width:"100%"}}))),ll=({control:e,property:r,name:n,useExpression:t,label:l,required:o,title:s,entityReferenceDefinitionSources:c,entityReferenceValueComponent:d,fileReferenceValueComponent:p,requiredErrorText:m=""})=>{const{field:{value:f,onChange:y},fieldState:{error:v,isDirty:C}}=T({name:n,control:e,defaultValue:r.defaultValue,rules:{validate:e=>!o||null!==e||(m||Hr)}}),O=g({}),{propertyType:E,valueLabel:x,fillOptionLabel:j,fillOption:V,fillOptions:R,setFillOption:N,defaultProperyValue:w}=nl({value:f,property:r,isDirty:C,label:l,required:o,useExpression:t}),S=b((e=>{const n=e.target.value;O.current=Object.assign(Object.assign({},O.current),{[V]:f}),N(n);const t=O.current[n];if("null"===n)y(null);else if("widget"===n)if(E===Ar.JSON&&f&&"string"!=typeof f&&"dem_builder"===V&&"properties"in f){const e=Object.assign(Object.assign({},f),{properties:qn(f.property||[])});try{y(null!=t?t:JSON.stringify(e,null,"\t"))}catch(e){console.log("Stringify failed",e)}}else y(null!=t?t:r.defaultValue||w);else if("expression"===n||"string"===n)y(null!=t?t:"",{shouldDirty:!0});else if("dem_builder"===n){const e={code:"",name:"",version:0,properties:[]};if(f)try{const e=JSON.parse(f);e.properties=$n(e.properties||{}),y(null!=t?t:e,{shouldDirty:!0})}catch(r){y(null!=t?t:e,{shouldDirty:!0})}else y(null!=t?t:e,{shouldDirty:!0})}}),[w,f,N,V,E,y,r]);return h((()=>{C||fr(r.defaultValue||r.value)||""===r.defaultValue&&""===r.value||!fr(f)||y(r.defaultValue||r.value)}),[C,r,y,f]),h((()=>{var e;(void 0===f||r.isRequired&&null===f&&fr(r.defaultValue||r.value))&&y(null!==(e=O.current[V])&&void 0!==e?e:w),r.isRequired||null!==r.defaultValue&&null!==r.value||y(null)}),[f,y,w,r,V]),a(Re,Object.assign({xs:12},{children:[s&&i(B,Object.assign({mb:2},{children:i(z,Object.assign({variant:"h6"},{children:s}))})),R?i(B,Object.assign({mb:2},{children:a(H,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[i(tl,Object.assign({htmlFor:"type-select"},{children:j})),i(hr,Object.assign({labelId:"type-select",label:j,value:V||"",onChange:S},{children:R.map((e=>i(u,Object.assign({value:e.value},{children:e.label}),e.value)))}))]}))})):null,"expression"===V&&(E===Ar.JSON||E===Ar.ENTITY||E===Ar.ANY?i(pn,{name:n,control:e,label:x,parseValue:!0,validateJson:!0,hideErrorMessage:!0}):i(Gr,{control:e,name:n,label:x,hideErrorMessage:!0})),"string"===V&&i(Gr,{control:e,name:n,label:x,hideErrorMessage:!0}),"json_notvalid"===V&&i(pn,{name:n,control:e,label:x,hideErrorMessage:!0}),"widget"===V&&i(rl,{control:e,property:r,name:n,useExpression:t,label:x,entityReferenceDefinitionSources:c,entityReferenceValueComponent:d,fileReferenceValueComponent:p}),"dem_builder"===V&&i(bl,{control:e,title:"JSON",definitionFieldName:n,entityReferenceDefinitionSources:c,entityReferenceValueComponent:d,fileReferenceValueComponent:p}),v&&i(G,Object.assign({error:!0},{children:v.message}))]}))};var il=({control:e,name:r,property:n,useExpression:t,required:l,label:o,entityReferenceDefinitionSources:s,entityReferenceValueComponent:c,fileReferenceValueComponent:d})=>{const{fields:u,append:p,remove:m}=S({control:e,name:r});return a(Re,Object.assign({container:!0,spacing:2,direction:"column",xs:12},{children:[Array.isArray(u)&&u.length?u.map(((u,p)=>i(Re,Object.assign({xs:12},{children:a(B,Object.assign({display:"flex",alignItems:"flex-start",width:"100%",p:2,style:{backgroundColor:"#f1f1f1"}},{children:[i(ll,{control:e,required:l,property:n,useExpression:t,name:`${r}.${p}`,label:`${o||n.name} (${p+1})`,entityReferenceDefinitionSources:s,entityReferenceValueComponent:c,fileReferenceValueComponent:d}),i(B,Object.assign({mt:"8px",ml:"4px"},{children:i(I,Object.assign({id:"close-button",size:"small",onClick:()=>m(p)},{children:i(L,Object.assign({fontSize:"small"},{children:i("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})}))}))}))]}))}),u.id))):null,i(Re,{children:i(M,Object.assign({variant:"contained",size:"small",color:"primary",onClick:()=>p(null)},{children:"Add value"}))})]}))};const al=({control:e,property:r,name:n,useExpression:t,required:l,label:o,title:s,entityReferenceDefinitionSources:c,entityReferenceValueComponent:d,fileReferenceValueComponent:p,requiredErrorText:m=""})=>{var b;const[y,v]=f(!1),{field:{value:C,onChange:O},fieldState:{error:E,isDirty:x}}=T({control:e,name:n,defaultValue:null!==(b=r.defaultValue)&&void 0!==b?b:[],rules:{validate:e=>!(l&&!e)||(m||Hr)}}),j=g({}),{propertyType:V,valueLabel:R,fillOptionLabel:N,fillOption:w,fillOptions:S,setFillOption:k,checkFillOption:L}=nl({property:r,value:C,isDirty:x,label:o,required:l,useExpression:t,multipleOptions:!0});return h((()=>{C||O(r.isRequired&&r.isMultiple?[]:null)}),[C,r,O]),h((()=>{C&&!y&&(v(!0),L())}),[L,y,C]),a(Re,{children:[s&&i(B,Object.assign({mb:2},{children:i(z,Object.assign({variant:"h6"},{children:s}))})),S?i(B,Object.assign({mb:2},{children:a(H,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[i(tl,Object.assign({htmlFor:"type-select"},{children:N})),i(hr,Object.assign({labelId:"type-select",label:N,value:w||"",onChange:e=>{v(!0),j.current=Object.assign(Object.assign({},j.current),{[w]:C});const r=e.target.value,n=j.current[r];"null"===r?O(null):"expression"===r||"json_valid"===r||"json_notvalid"===r?O(null!=n?n:"",{shouldDirty:!0}):"widget"===r&&O(null!=n?n:[],{shouldDirty:!0}),k(r)}},{children:S.map((e=>i(u,Object.assign({value:e.value},{children:e.label}),e.value)))}))]}))})):null,"expression"===w&&(V===Ar.JSON||V===Ar.ENTITY||V===Ar.ANY?i(pn,{name:n,control:e,label:R,parseValue:!0,validateJson:!0,hideErrorMessage:!0}):i(Gr,{required:!0,hideErrorMessage:!0,control:e,name:n,label:R})),"json_valid"===w&&i(pn,{name:n,control:e,label:R,parseValue:!0,validateJson:!0,hideErrorMessage:!0}),"widget"===w&&i(il,{control:e,property:r,name:n,useExpression:t,required:l,label:o,entityReferenceDefinitionSources:c,entityReferenceValueComponent:d,fileReferenceValueComponent:p}),E&&i(G,Object.assign({error:!0},{children:E.message}))]})},ol=({control:e,propertyFieldName:r,name:n,label:t="",required:l,entityReferenceDefinitionSources:a,entityReferenceValueComponent:o,fileReferenceValueComponent:s})=>{const c=R({control:e,name:`${r}.propertyType`}),d=R({control:e,name:`${r}.isMultiple`}),u=R({control:e,name:`${r}.format`}),p=R({control:e,name:`${r}.restrictedValues`}),m=R({control:e,name:`${r}.properties`}),g=R({control:e,name:`${r}.isRequired`}),h=y((()=>Object.assign(Object.assign(Object.assign(Object.assign({name:t,isRequired:null!=l?l:g,isMultiple:d},!!u&&{format:u}),{restrictedValues:p}),!!m&&{properties:m}),{propertyType:"string"==typeof c?c:c.value,defaultValue:null,defaultValues:[],sortOrder:0,isEnabled:!0,uiSettings:null,validationNode:null})),[c,u,p,d,t,g,m,l]);return i(gr,Object.assign({dateAdapter:mr},{children:i(d?al:ll,{control:e,name:n,property:h,title:t,required:l,entityReferenceDefinitionSources:a,entityReferenceValueComponent:o,fileReferenceValueComponent:s})}))};var sl=({name:e,label:r="",propertyFieldName:n,type:t,decimal:l=!1,options:a=[],required:o=!1})=>{const{control:s}=N(),c=y((()=>`${n}.${e}`),[e,n]);switch(t){case"text":return i(Gr,{control:s,name:c,label:r,required:o});case"number":return i(nt,{control:s,name:c,label:r,decimal:l,required:o});case"select":return i(Kr,{control:s,name:c,label:r,options:a,required:o});case"autocomplete":return i(on,{control:s,name:c,label:r,options:a,required:o});case"json":return i(pn,{control:s,name:c,label:r,mode:"json",required:o});default:return null}};var cl=e=>({customCheckboxes:y((()=>e.length?e.filter((e=>"checkbox"===e.type)):[]),[e]),customFields:y((()=>e.length?e.filter((e=>"checkbox"!==e.type)):[]),[e])});const dl=Object.values(Ar).sort(((e,r)=>e.localeCompare(r))).map((e=>({value:e,label:e.replace("_"," ").toLowerCase().replace(/(^\w)|([-\s]\w)/g,(e=>e.toUpperCase()))}))),ul=O((({setValue:e,control:r,propertyFieldName:n,entityDefinition:t=!1,globalParameter:l=!1,customPropertyFields:s=[],entityReferenceDefinitionSources:c,entityReferenceValueComponent:d,fileReferenceValueComponent:u})=>{const p=R({control:r,name:`${n}.propertyType`}),m=R({control:r,name:`${n}.isMultiple`}),g=R({control:r,name:`${n}.isRequired`}),{customCheckboxes:f,customFields:b}=cl(s),v=y((()=>{let e=l?"Value":"Default Value";return m&&(e+="s"),e}),[l,m]);return h((()=>{p&&"string"==typeof p&&e(`${n}.propertyType`,dl.find((e=>e.value===p)))}),[p,e,n]),a(Re,Object.assign({container:!0,direction:"column",spacing:2},{children:[i(Re,{children:i(Gr,{required:!0,control:r,name:`${n}.key`,label:"Key"})}),i(Re,{children:i(Gr,{required:!0,control:r,name:`${n}.name`,label:"Name"})}),i(Re,{children:i(on,{required:!0,control:r,name:`${n}.propertyType`,label:"Type",options:dl,onChange:(r,t)=>{const i=`${n}.propertyType`,a=`${n}.${l?"value":"defaultValue"}`;e(a,m?[]:null),e(i,t)}})}),i(Re,{children:i(nt,{required:!0,control:r,name:`${n}.sortOrder`,label:"Sort Order"})}),i(Re,{children:i(pn,{control:r,name:`${n}.uiSettings`,label:"UI Settings",validateJson:!0,parseValue:!0})}),a(Re,{children:[i(Xr,{control:r,name:`${n}.isMultiple`,label:"Multiple"}),i(Xr,{control:r,name:`${n}.isEnabled`,label:"Enabled"}),i(Xr,{control:r,name:`${n}.isRequired`,label:"Required"}),t&&i(Xr,{control:r,name:`${n}.isViewableInList`,label:"Is viewable in list"}),f.length?i(o,{children:f.map(((e,t)=>i(Xr,{control:r,name:`${n}.${e.name}`,label:e.label,checked:e.checked,defaultValue:e.defaultValue},t)))}):null]}),p&&a(o,{children:[i(Xt,{control:r,propertyType:"string"==typeof p?p:p.value,propertyFieldName:n,globalParameter:l,entityDefinition:t,entityReferenceDefinitionSources:c,entityReferenceValueComponent:d,fileReferenceValueComponent:u}),i(ol,{control:r,propertyFieldName:n,name:`${n}.${l?"value":"defaultValue"}`,label:v,required:!!l&&g,entityReferenceDefinitionSources:c,entityReferenceValueComponent:d,fileReferenceValueComponent:u})]}),b.length?i(o,{children:b.map(((e,r)=>i(Re,{children:i(sl,Object.assign({},e,{propertyFieldName:n}))},r)))}):null]}))}));var pl=({entityDefinition:e,globalParameter:r,customPropertyFields:n,index:t,arrLength:l,entityReferenceDefinitionSources:o,entityReferenceValueComponent:s,control:c,setValue:d,fileReferenceValueComponent:u,handleRemoveParameter:p,error:m,item:g,extRefs:h})=>{const[b,y]=f(t===l&&!g.key);return i(Re,Object.assign({sm:12,ref:e=>h.current[t]=e},{children:a(tr,Object.assign({expanded:b,onChange:()=>y(!b),elevation:3},{children:[i(lr,Object.assign({expandIcon:i(or,{})},{children:i(z,Object.assign({color:m&&m[t]?"secondary":"initial",style:{wordBreak:"break-word"}},{children:g.name||`Property ${t+1}`}))})),i(ir,{children:b&&i(ul,{control:c,setValue:d,propertyFieldName:`properties.${t}`,entityDefinition:e,globalParameter:r,customPropertyFields:n,entityReferenceDefinitionSources:o,entityReferenceValueComponent:s,fileReferenceValueComponent:u})}),i(ar,{children:i(M,Object.assign({variant:"contained",size:"small",color:"secondary",onClick:()=>p(t)},{children:"Remove"}))})]}))}))};const ml={key:"",propertyType:null,name:"",defaultValue:"",defaultValues:[],isRequired:!0,isMultiple:!1,sortOrder:0,isEnabled:!0,executeValue:"",uiSettings:""},gl=C((({properties:e,parentFieldName:r,hideAddButton:n,focusOnIndex:t,required:l,entityDefinition:s=!1,globalParameter:c=!1,customPropertyFields:d=[],parentRemove:u,entityReferenceDefinitionSources:p,entityReferenceValueComponent:m,fileReferenceValueComponent:f},y)=>{var v;const{clearErrors:C,control:O,setValue:x,getValues:j,reset:V,trigger:R,watch:N}=k({mode:"all",defaultValues:{properties:e}}),{fields:w,append:L,remove:I}=S({control:O,name:"properties"}),{fieldState:{error:A}}=T({control:O,name:"properties",rules:{validate:e=>!l||!Array.isArray(e)||0!==e.length||"Please, fill the properties"}}),D=g([]),F=b((()=>{L(ml),C("properties")}),[L,C]),P=b((e=>{u&&u(e),I(e)}),[u,I]);return h((()=>{"number"==typeof t&&D.current[t]&&D.current[t].scrollIntoView({behavior:"smooth",block:"start"})}),[t,D]),h((()=>{var r;e.length&&!(null===(r=j("properties"))||void 0===r?void 0:r.length)&&V({properties:e})}),[e,j,V]),E(y,(()=>({getProperties:()=>j("properties"),addProperty:F,removeProperty:P,trigger:R})),[j,F,P,R]),a(o,{children:[A&&A.message&&i(Re,Object.assign({sm:12},{children:i(z,Object.assign({color:"secondary"},{children:A.message}))})),Array.isArray(w)&&w.map(((e,r,n)=>i(pl,{item:e,index:r,arrLength:n.length-1,control:O,setValue:x,customPropertyFields:d,entityDefinition:s,globalParameter:c,error:A,handleRemoveParameter:P,fileReferenceValueComponent:f,entityReferenceValueComponent:m,entityReferenceDefinitionSources:p,extRefs:D},e.id))),!n&&a(Re,Object.assign({xs:12},{children:[i(M,Object.assign({variant:"contained",size:"small",color:"primary",onClick:F},{children:"Add property"})),A&&i(G,Object.assign({error:!0},{children:null===(v=A.root)||void 0===v?void 0:v.message}))]}))]})})),hl={key:"",propertyType:null,name:"",defaultValue:"",defaultValues:[],isRequired:!0,isMultiple:!1,sortOrder:0,isEnabled:!0,executeValue:"",uiSettings:""},fl=({control:e,parentFieldName:r,hideAddButton:n,focusOnIndex:t,required:l,entityDefinition:s=!1,globalParameter:c=!1,customPropertyFields:d=[],parentRemove:u,entityReferenceDefinitionSources:p,entityReferenceValueComponent:m,fileReferenceValueComponent:f})=>{var v;const C=y((()=>r?`${r}.properties`:"properties"),[r]),{clearErrors:O,setValue:E}=N(),{fields:x,append:j,remove:V}=S({control:e,name:C}),{fieldState:{error:R}}=T({control:e,name:C,rules:{validate:e=>!l||!Array.isArray(e)||0!==e.length||"Please, fill the properties"}}),w=g([]),k=b((()=>{j(hl),O("properties")}),[j,O]),L=b((e=>{u&&u(e),V(e)}),[u,V]);return h((()=>{"number"==typeof t&&w.current[t]&&w.current[t].scrollIntoView({behavior:"smooth",block:"start"})}),[t,w]),a(o,{children:[R&&R.message&&i(Re,Object.assign({sm:12},{children:i(z,Object.assign({color:"secondary"},{children:R.message}))})),Array.isArray(x)&&x.map(((r,n,t)=>i(Re,Object.assign({sm:12,ref:e=>w.current[n]=e},{children:a(tr,Object.assign({defaultExpanded:n===t.length-1&&!r.key,elevation:3},{children:[i(lr,Object.assign({expandIcon:i(or,{})},{children:i(z,Object.assign({color:R&&R[n]?"secondary":"initial",style:{wordBreak:"break-word"}},{children:r.name||`Property ${n+1}`}))})),i(ir,{children:i(ul,{control:e,setValue:E,propertyFieldName:`${C}.${n}`,entityDefinition:s,globalParameter:c,customPropertyFields:d,entityReferenceDefinitionSources:p,entityReferenceValueComponent:m,fileReferenceValueComponent:f})}),i(ar,{children:i(M,Object.assign({variant:"contained",size:"small",color:"secondary",onClick:()=>L(n)},{children:"Remove"}))})]}))}),r.id))),!n&&a(Re,Object.assign({xs:12},{children:[i(M,Object.assign({variant:"contained",size:"small",color:"primary",onClick:k},{children:"Add property"})),R&&i(G,Object.assign({error:!0},{children:null===(v=R.root)||void 0===v?void 0:v.message}))]}))]})},bl=C((({control:e,definitionFieldName:r,title:n,hideCodeField:t,hideVersionField:l,hideNameField:o,required:s=!1,entityReferenceDefinitionSources:c,entityReferenceValueComponent:d,fileReferenceValueComponent:u},p)=>{const{control:m,getValues:g}=N(),h=g(`${r}.properties`);return a(Re,Object.assign({container:!0,direction:"column",spacing:2},{children:[n&&i(Re,Object.assign({sm:12},{children:i(B,Object.assign({my:2},{children:i(z,Object.assign({variant:"h6"},{children:n}))}))})),!o&&i(Re,Object.assign({sm:12},{children:i(Gr,{required:!0,control:null!=e?e:m,name:r?`${r}.name`:"name",label:"Name"})})),!t&&i(Re,Object.assign({sm:12},{children:i(Gr,{required:!0,control:null!=e?e:m,name:r?`${r}.code`:"code",label:"Code"})})),!l&&i(Re,Object.assign({sm:12},{children:i(nt,{required:!0,control:null!=e?e:m,name:r?`${r}.version`:"version",label:"Version"})})),p?i(gl,{ref:p,properties:h,required:s,parentFieldName:r,entityReferenceDefinitionSources:c,entityReferenceValueComponent:d,fileReferenceValueComponent:u}):i(fl,{control:e,required:s,parentFieldName:r,entityReferenceDefinitionSources:c,entityReferenceValueComponent:d,fileReferenceValueComponent:u})]}))})),yl=({node:e,name:r,label:n,useExpression:t,control:l,entityReferenceValueComponent:a,fileReferenceValueComponent:o})=>{var s;switch("string"==typeof e.nodeType?e.nodeType:null===(s=e.nodeType)||void 0===s?void 0:s.value){case Pr.BIG_DECIMAL:case Pr.FLOAT:case Pr.DOUBLE:return i(nt,{required:!0,decimal:!0,hideErrorMessage:!0,control:l,name:r,label:n,valueAsNumber:!0});case Pr.INTEGER:case Pr.SHORT:case Pr.BIG_INTEGER:case Pr.LONG:return i(nt,{required:!0,hideErrorMessage:!0,control:l,name:r,label:n,valueAsNumber:!0});case Pr.BOOLEAN:return i(tt,{control:l,name:r,defaultValue:!1});case Pr.DATE:return i(at,{hideErrorMessage:!0,control:l,name:r,label:n,format:e.format});case Pr.TIME:return i(ct,{hideErrorMessage:!0,control:l,name:r,label:n,format:e.format});case Pr.DATE_TIME:return i(st,{hideErrorMessage:!0,control:l,name:r,label:n,format:e.format});case Pr.STRING:return i(Qt,{control:l,name:r,label:n,restrictedValues:e.restrictedValues});case Pr.ENTITY_REFERENCE:return a?i(a,{name:r,node:e}):i(Qt,{name:r,label:n,control:l});case Pr.FILE:return i(el,{name:r});case Pr.FILE_REFERENCE:return o?i(o,{name:r}):i(Qt,{name:r,label:n,control:l});case Pr.ANY:return i(pn,{control:l,name:r,hideErrorMessage:!0,label:n,parseValue:!0});case Pr.OBJECT:return e.properties?i("div",{children:e.properties.map((e=>i(Vi,{node:e,dataFieldName:`${r}.${e.key}`,useExpression:t,entityReferenceValueComponent:a,fileReferenceValueComponent:o})))}):i(pn,{control:l,name:r,hideErrorMessage:!0,label:n,parseValue:!0,mode:"json"});default:return i("div",{children:"No widget"})}};var vl=({value:e,node:r,label:n,isDirty:t,required:l=!1,useExpression:i=!1,multipleOptions:a=!1})=>{const o=y((()=>n?`${n} (value)`:`${r.name} (value)`),[n,r]),s=y((()=>n?`${n} (widget)`:`${r.name} (widget)`),[n,r]),c=y((()=>Qn(r)),[r]),[d,u]=f(null),p=y((()=>a?Xn({nodeType:c,required:l,useExpression:i}):et({nodeType:c,required:l,useExpression:i})),[i,l,c,a]),m=y((()=>{switch(c){case Pr.STRING:case Pr.DATE:case Pr.TIME:case Pr.DATE_TIME:case Pr.ENTITY_REFERENCE:case Pr.ANY:case Pr.FILE:case Pr.FILE_REFERENCE:return"";case Pr.OBJECT:return{};case Pr.ARRAY:return[];case Pr.BOOLEAN:return!1;case Pr.INTEGER:case Pr.BIG_DECIMAL:case Pr.BIG_INTEGER:case Pr.DOUBLE:case Pr.LONG:case Pr.FLOAT:case Pr.SHORT:return 0;default:return null}}),[c]),g=y((()=>c===Pr.ANY||c===Pr.ARRAY),[c]),v=b((()=>{In(e,g)?u("expression"):c===Pr.ARRAY||null==e||In(e,g)||"widget"===d||"string"===d||"json_valid"===d||u("widget")}),[e,d,g,c]);return h((()=>{d?t||v():!Dn(e)||r.isRequired||null!==r.defaultValue&&null!==r.value?i&&In(e,g)?u("expression"):u("widget"):u("null")}),[e,d,p,i,t,v,g,l,r]),{nodeType:c,valueLabel:o,fillOptionLabel:s,fillOption:d,fillOptions:p,setFillOption:u,defaultProperyValue:m,checkFillOption:v}};const Cl=t(br)((()=>({inputLabel:{overflow:"hidden",textOverflow:"ellipsis",width:"100%"}}))),Ol=({control:e,node:r,name:n,useExpression:t,label:l,required:o,title:s,entityReferenceValueComponent:c,fileReferenceValueComponent:d,requiredErrorText:p=""})=>{const{field:{value:m,onChange:f},fieldState:{error:y,isDirty:v}}=T({name:n,control:e,rules:{validate:e=>!o||null!==e||(p||Hr)}}),C=g({}),{nodeType:O,valueLabel:E,fillOptionLabel:x,fillOption:j,fillOptions:V,setFillOption:R,defaultProperyValue:N}=vl({value:m,node:r,isDirty:v,label:l,required:o,useExpression:t}),w=b((e=>{const t=e.target.value;C.current=Object.assign(Object.assign({},C.current),{[j]:m}),R(t);const l=C.current[t];if("null"===t)f(null);else if("widget"===t)if(O===Pr.OBJECT&&m&&"string"!=typeof m&&"dem_builder"===j&&"node"in m){const e=Wn(m);try{f(null!=l?l:JSON.stringify(e,null,"\t"))}catch(e){console.log("Stringify failed",e)}}else f(null!=l?l:r.defaultValue||N);else if("expression"===t||"string"===t)f(n,null!=l?l:"");else if("dem_builder"===t){const e={code:"",name:"",version:0,node:null};if(m)try{const e=JSON.parse(m);e.properties=Un(e.properties||{}),f(null!=l?l:e)}catch(r){f(null!=l?l:e)}else f(null!=l?l:e,{shouldDirty:!0})}}),[n,m,R,j,O,f,N,r]);return h((()=>{v||fr(r.defaultValue||r.value)||""===r.defaultValue&&""===r.value||!fr(m)||f(n,r.defaultValue||r.value)}),[v,r,f,m,n]),h((()=>{var e;(void 0===m||r.isRequired&&null===m&&!r.defaultValue&&!r.value)&&f(null!==(e=C.current[j])&&void 0!==e?e:N),void 0!==m||r.isRequired||null!==r.defaultValue&&null!==r.value||f(null)}),[m,f,n,N,r,j]),a(Re,Object.assign({xs:12},{children:[s&&i(B,Object.assign({mb:2},{children:i(z,Object.assign({component:"h6",color:"initial",mb:3,style:{wordBreak:"break-word",fontSize:18}},{children:s}))})),V?i(B,Object.assign({mb:2},{children:a(H,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[i(Cl,Object.assign({htmlFor:"type-select"},{children:x})),i(hr,Object.assign({labelId:"type-select",label:x,value:j||"",onChange:w},{children:V.map((e=>i(u,Object.assign({value:e.value},{children:e.label}),e.value)))}))]}))})):null,"expression"===j&&(O===Pr.OBJECT||O===Pr.ANY?i(pn,{name:n,control:e,label:E,parseValue:!0,hideErrorMessage:!0,useCleanValue:!0,mode:O===Pr.ANY?"text":"json"}):i(Gr,{control:e,name:n,label:E,hideErrorMessage:!0})),"string"===j&&i(Gr,{control:e,name:n,label:E,hideErrorMessage:!0}),"widget"===j&&i(yl,{control:e,node:r,name:n,useExpression:t,label:E,entityReferenceValueComponent:c,fileReferenceValueComponent:d}),y&&i(G,Object.assign({error:!0},{children:y.message}))]}))},El=({control:e,name:r,node:n,useExpression:t,required:l,label:o,entityReferenceValueComponent:s,fileReferenceValueComponent:c})=>{const{fields:d,append:u,remove:p}=S({control:e,name:r});return a(Re,Object.assign({container:!0,spacing:2,direction:"column",xs:12},{children:[Array.isArray(d)&&d.length?d.map(((d,u)=>i(Re,Object.assign({xs:12},{children:a(B,Object.assign({display:"flex",alignItems:"flex-start",width:"100%",p:2,style:{backgroundColor:"#f1f1f1"}},{children:[i(Ol,{control:e,required:l,node:n,useExpression:t,name:`${r}.${u}`,label:`${o||n.name} (${u+1})`,entityReferenceValueComponent:s,fileReferenceValueComponent:c}),i(B,Object.assign({mt:"8px",ml:"4px"},{children:i(I,Object.assign({id:"close-button",size:"small",onClick:()=>p(u)},{children:i(L,Object.assign({fontSize:"small"},{children:i("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})}))}))}))]}))}),u))):null,i(Re,{children:i(M,Object.assign({variant:"contained",size:"small",color:"primary",onClick:()=>u(null)},{children:"Add value"}))})]}))},xl=({node:e,name:r,useExpression:n,label:t,required:l,title:o,entityReferenceValueComponent:s,fileReferenceValueComponent:c,requiredErrorText:d=""})=>{const{control:p,clearErrors:m,setValue:f}=N(),{field:{value:y},fieldState:{error:v,isDirty:C}}=T({name:r,control:p,rules:{validate:e=>!l||null!==e||(d||Hr)}}),O=g({}),{nodeType:E,valueLabel:x,fillOptionLabel:j,fillOption:V,fillOptions:R,setFillOption:w,defaultProperyValue:S}=vl({value:y,node:e,isDirty:C,label:t,required:l,useExpression:n}),k=b((n=>{const t=n.target.value;O.current=Object.assign(Object.assign({},O.current),{[V]:y}),w(t);const l=O.current[t];if("null"===t)f(r,null,{shouldDirty:!0});else if("widget"===t)if(E===Pr.OBJECT&&y&&"string"!=typeof y&&"dem_builder"===V&&"node"in y){const e=Wn(y);try{f(r,null!=l?l:JSON.stringify(e,null,"\t"))}catch(e){console.log("Stringify failed",e)}}else f(r,null!=l?l:e.defaultValue||S);else if("expression"===t||"string"===t)f(r,null!=l?l:"",{shouldDirty:!0});else if("dem_builder"===t){const e={code:"",name:"",version:0,node:null};if(y)try{const e=JSON.parse(y);e.properties=Un(e.properties||{}),f(r,null!=l?l:e,{shouldDirty:!0})}catch(n){f(r,null!=l?l:e,{shouldDirty:!0})}else f(r,null!=l?l:e,{shouldDirty:!0})}m()}),[r,m,y,w,V,E,f,S,e]);return h((()=>{C||fr(e.defaultValue||e.value)||""===e.defaultValue&&""===e.value||!fr(y)||f(r,e.defaultValue||e.value)}),[C,e,f,y,r]),h((()=>{var n;(void 0===y||e.isRequired&&null===y&&!e.defaultValue&&!e.value)&&f(r,null!==(n=O.current[V])&&void 0!==n?n:S),void 0!==y||e.isRequired||null!==e.defaultValue&&null!==e.value||f(r,null)}),[y,f,r,S,e,V]),a(Re,Object.assign({xs:12},{children:[o&&i(B,Object.assign({mb:2},{children:i(z,Object.assign({component:"h6",color:"initial",mb:3,style:{wordBreak:"break-word",fontSize:18}},{children:o}))})),R?i(B,Object.assign({mb:2},{children:a(H,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[i(Cl,Object.assign({htmlFor:"type-select"},{children:j})),i(hr,Object.assign({labelId:"type-select",label:j,value:V||"",onChange:k},{children:R.map((e=>i(u,Object.assign({value:e.value},{children:e.label}),e.value)))}))]}))})):null,"expression"===V&&(E===Pr.OBJECT||E===Pr.ANY?i(pn,{name:r,control:p,label:x,parseValue:!0,hideErrorMessage:!0,useCleanValue:!0,mode:"expression"===V?"text":"json"}):i(pn,{control:p,name:r,hideErrorMessage:!0,label:t,parseValue:!0,height:"40px"})),"string"===V&&i(Gr,{control:p,name:r,label:x,hideErrorMessage:!0}),"widget"===V&&i(yl,{control:p,node:e,name:r,useExpression:n,label:x,entityReferenceValueComponent:s,fileReferenceValueComponent:c}),v&&i(G,Object.assign({error:!0},{children:v.message}))]}))},jl={nodeType:Pr.ANY,name:"",isRequired:!0,defaultValue:null,defaultValues:null,sortOrder:0,isEnabled:!0,uiSettings:null,validationNode:null},Vl=({node:e,name:r,useExpression:n,required:t,label:l,title:s,entityReferenceValueComponent:c,fileReferenceValueComponent:d,requiredErrorText:p=""})=>{var m,b,y,v;const[C,O]=f(!1),{control:E,clearErrors:x,setValue:j,watch:V}=N(),{field:{ref:R,onChange:w},fieldState:{error:S,isDirty:k}}=T({control:E,name:r,defaultValue:null!==(m=e.defaultValue)&&void 0!==m?m:[],rules:{validate:e=>!(t&&!e)||(p||Hr)}}),L=V(r),I=g({}),{valueLabel:A,fillOptionLabel:M,fillOption:D,fillOptions:F,setFillOption:P,checkFillOption:q}=vl({node:e,value:L,isDirty:k,label:l,required:t,useExpression:n,multipleOptions:!0});return h((()=>{!L&&e.isRequired&&w([]),vr(L)&&!e.isRequired&&w(null)}),[L,e,w]),h((()=>{L&&!C&&(O(!0),q())}),[q,C,L]),a(o,{children:[s&&i(B,Object.assign({mb:2},{children:i(z,Object.assign({variant:"h6"},{children:s}))})),F?i(B,Object.assign({mb:2},{children:a(H,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[i(Cl,Object.assign({htmlFor:"type-select"},{children:M})),i(hr,Object.assign({labelId:"type-select",label:M,value:D||"",onChange:e=>{O(!0),I.current=Object.assign(Object.assign({},I.current),{[D]:L});const n=e.target.value,t=I.current[n];"null"===n?j(r,null):j(r,null!=t?t:[],{shouldDirty:!0}),P(n),x(r)}},{children:F.map((e=>i(u,Object.assign({value:e.value},{children:e.label}),e.value)))}))]}))})):null,("expression"===D||"json_valid"===D)&&i(pn,{name:r,control:E,label:A,parseValue:!0,hideErrorMessage:!0,useCleanValue:!0,mode:"json"}),"widget"===D&&i(El,{control:E,node:null!==(b=e.memberNodes)&&void 0!==b?b:jl,name:r,useExpression:n,required:t,label:null!==(v=null===(y=e.memberNodes)||void 0===y?void 0:y.name)&&void 0!==v?v:e.name,entityReferenceValueComponent:c,fileReferenceValueComponent:d}),S&&i(G,Object.assign({error:!0},{children:S.message}))]})},Tl={nodeType:Pr.ANY,name:"",isRequired:!0,defaultValue:null,defaultValues:null,sortOrder:0,isEnabled:!0,uiSettings:null,validationNode:null},Rl=({control:e,node:r,name:n,useExpression:t,required:l,label:s,title:c,entityReferenceValueComponent:d,fileReferenceValueComponent:p,requiredErrorText:m=""})=>{var b,y,v,C;const[O,E]=f(!1),{field:{value:x,onChange:j},fieldState:{error:V,isDirty:R}}=T({control:e,name:n,defaultValue:null!==(b=r.defaultValue)&&void 0!==b?b:[],rules:{validate:e=>!(l&&!e)||(m||Hr)}}),N=g({}),{valueLabel:w,fillOptionLabel:S,fillOption:k,fillOptions:L,setFillOption:I,checkFillOption:A}=vl({node:r,value:x,isDirty:R,label:s,required:l,useExpression:t,multipleOptions:!0});return h((()=>{!x&&r.isRequired&&j([])}),[x,r,j]),h((()=>{(null==x?void 0:x.length)&&!O&&(E(!0),A())}),[A,O,x]),a(o,{children:[c&&i(B,Object.assign({mb:2},{children:i(z,Object.assign({variant:"h6"},{children:c}))})),L?i(B,Object.assign({mb:2},{children:a(H,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[i(Cl,Object.assign({htmlFor:"type-select"},{children:S})),i(hr,Object.assign({labelId:"type-select",label:S,value:k||"",onChange:e=>{E(!0),N.current=Object.assign(Object.assign({},N.current),{[k]:x});const r=e.target.value,n=N.current[r];j("null"===r?null:null!=n?n:[]),I(r)}},{children:L.map((e=>i(u,Object.assign({value:e.value},{children:e.label}),e.value)))}))]}))})):null,("expression"===k||"json_valid"===k)&&i(pn,{name:n,control:e,label:w,parseValue:!0,hideErrorMessage:!0,useCleanValue:!0,mode:"json"}),"widget"===k&&i(El,{control:e,node:null!==(y=r.memberNodes)&&void 0!==y?y:Tl,name:n,useExpression:t,required:l,label:null!==(C=null===(v=r.memberNodes)||void 0===v?void 0:v.name)&&void 0!==C?C:r.name,entityReferenceValueComponent:d,fileReferenceValueComponent:p}),V&&i(G,Object.assign({error:!0},{children:V.message}))]})},Nl={name:"Name",key:"Key",nodeType:"Node Type",defaultValue:"Default Value",defaultValues:"Default Values",sortOrder:"Sort Order",isRequired:"Required",isEnabled:"Enabled",isViewableInList:"Is Viewable In List",precisionScale:"Precision Scale",roundingMode:"Rounding Mode",format:"Format",definitionCode:"Definition Code",definitionVersion:"Definition Version",labelPropertyCode:"Label Property Code",valuePropertyCode:"Value Property Code",restrictedValues:"Restricted Values",value:"Value",values:"Values",uiSettings:"UI Settings",validationNode:"Validation Node",memberNodes:"Member Nodes"},wl=({value:e,type:r})=>r!==Pr.OBJECT&&r!==Pr.ANY||!e?i(z,Object.assign({variant:"subtitle1",display:"inline",style:{wordBreak:"break-word"}},{children:null===e?"null":e.toString()})):i(Cn,{value:e}),Sl=(e,r,n)=>{switch(r){case"nodeType":return i(z,Object.assign({variant:"subtitle1",display:"inline",style:{wordBreak:"break-word"}},{children:n}));case"isRequired":case"isEnabled":case"isViewableInList":return e?i(L,Object.assign({color:"primary",fontSize:"small"},{children:i("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})})):null;case"restrictedValues":return e?i(B,Object.assign({display:"flex",flexWrap:"wrap"},{children:e.map((e=>i(Te,{label:e,style:{wordBreak:"break-word",maxWidth:"500px"}},e)))})):null;case"defaultValue":case"value":return i(wl,{value:e,type:n});case"values":case"defaultValues":return e?Array.isArray(e)&&n!==Pr.OBJECT&&n!==Pr.ANY?a("div",{children:["[",null==e?void 0:e.map(((e,r)=>i("div",{children:i(wl,{value:e,type:n})},r))),"]"]}):i(Cn,{value:e}):null;case"uiSettings":case"validationNode":return e?i(Cn,{value:e}):null;case"memberNodes":return e?i(Ml,{node:e,defaultExpanded:!1}):null;default:return i(z,Object.assign({variant:"subtitle1",display:"inline",style:{wordBreak:"break-word"}},{children:e}))}};var kl=({node:e})=>{const r=y((()=>(e&&(Qn(e)===Pr.ARRAY?(delete e.restrictedValues,delete e.defaultValue,delete e.value):(delete e.defaultValues,delete e.values)),e)),[e]);return i(_e,Object.assign({size:"small"},{children:i(He,{children:Object.keys(Nl).map((e=>e in r?a(We,{children:[i(Je,Object.assign({width:"30%"},{children:i(z,{children:Nl[e]})})),i(Je,{children:Sl(r[e],e,Qn(r))})]},e):null))})}))};const Ll=({properties:e,parentNames:r=[]})=>{const n=y((()=>{if(!e)return!1;let r=!1;return e.every((e=>e.nodeType!==Pr.OBJECT||(r=!0,!1))),r}),[e]);return a(B,Object.assign({mt:4},{children:[i(z,Object.assign({variant:"h6"},{children:"Properties"})),a(sr,Object.assign({orientation:"vertical",style:{paddingLeft:"4px"}},{children:[Array.isArray(e)?e.map((e=>a(cr,Object.assign({expanded:!0},{children:[i(dr,{StepIconProps:{icon:"",completed:!1,active:!0}}),i(ur,{children:i(Ml,{node:e,parentNames:[...r],defaultExpanded:!1})})]}),e.key))):null,n&&i(cr,{})]}))]}))};var Il=O(Ll);const Al=({node:e,parentNames:r=[],defaultExpanded:n=!0})=>{const[t,l]=f(!0);return h((()=>{l(n)}),[n]),e?a(tr,Object.assign({elevation:3,style:{backgroundColor:r.length%2==1?"#f1f1f1":"#fff",maxHeight:"none"},expanded:t,onChange:()=>l((e=>!e))},{children:[i(lr,Object.assign({expandIcon:i(L,{children:i("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})})},{children:i(z,Object.assign({style:{wordBreak:"break-word",fontWeight:"600"}},{children:e.name}))})),i(ir,{children:a(B,Object.assign({width:"100%"},{children:[i(kl,{node:e}),Qn(e)===Pr.OBJECT&&i(Il,{properties:Un(e).properties,parentNames:[...r,e.name]})]}))})]})):null};var Ml=Al;const Dl=Object.values(qr).sort(((e,r)=>e.localeCompare(r)));var Fl=({nodeFieldName:e,control:r})=>a(o,{children:[i(Re,{children:i(nt,{required:!0,control:r,defaultValue:2,name:`${e}.precisionScale`,label:"Precision Scale"})}),i(Re,{children:i(Kr,{required:!0,control:r,name:`${e}.roundingMode`,label:"Rounding Mode",defaultValue:qr.HALF_UP,options:Dl})})]});var Pl=({setValue:e,nodeFieldName:r,control:n,defaultValue:t=""})=>(h((()=>{t&&e(`${r}.format`,t)}),[t,e,r]),i(Re,{children:i(Gr,{required:!0,control:n,defaultValue:t,name:`${r}.format`,label:"Format"})}));const ql={key:"",nodeType:null,name:"",defaultValue:"",value:"",defaultValues:[],isRequired:!0,sortOrder:0,isEnabled:!0,executeValue:"",uiSettings:""};var $l=({setValue:e,control:r,parentNodeFieldName:n,entityDefinition:t=!1,globalParameter:l=!1,entityReferenceValueComponent:s,fileReferenceValueComponent:c})=>{const d=R({control:r,name:`${n}.memberNodes`});return a(o,{children:[i(z,Object.assign({variant:"h6"},{children:"Member Nodes"})),d?a(B,Object.assign({p:4,border:"1px solid rgba(0, 0, 0, 0.23)",borderRadius:3,my:2},{children:[i(di,{setValue:e,control:r,nodeFieldName:`${n}.memberNodes`,entityDefinition:t,globalParameter:l,entityReferenceValueComponent:s,fileReferenceValueComponent:c}),i(M,Object.assign({sx:{marginTop:4},variant:"contained",size:"small",color:"primary",onClick:()=>e(`${n}.memberNodes`,null)},{children:"Delete"}))]})):i(M,Object.assign({variant:"contained",size:"small",color:"primary",onClick:()=>e(`${n}.memberNodes`,ql),sx:{margin:"8px 0"}},{children:"Add node"}))]})};var Bl=({entityDefinition:e,globalParameter:r,customPropertyFields:n,index:t,watch:l,arrLength:o,entityReferenceValueComponent:s,control:c,setValue:d,fileReferenceValueComponent:u,handleRemoveParameter:p,error:m,item:g,extRefs:h,rootNode:b})=>{const[y,v]=f(t===o&&!g.key);return i(Re,Object.assign({sm:12,ref:e=>h.current[t]=e},{children:a(tr,Object.assign({expanded:y,onChange:()=>v(!y),elevation:3},{children:[i(lr,Object.assign({expandIcon:i(or,{})},{children:i(z,Object.assign({color:m&&m[t]?"secondary":"initial",style:{wordBreak:"break-word"}},{children:g.name||`Property ${t+1}`}))})),i(ir,{children:y&&i(di,{isObjectProperty:!0,control:c,setValue:d,nodeFieldName:`properties.${t}`,entityDefinition:e,globalParameter:r,customPropertyFields:n,entityReferenceValueComponent:s,fileReferenceValueComponent:u})}),!b&&i(ar,{children:i(M,Object.assign({variant:"contained",size:"small",color:"secondary",onClick:()=>p(t)},{children:"Remove"}))})]}))}))};const zl={propertyType:null,name:"",defaultValue:"",defaultValues:[],isRequired:!0,isMultiple:!1,sortOrder:0,isEnabled:!0,executeValue:"",uiSettings:""},_l=C((({properties:e,parentFieldName:r,hideAddButton:n,focusOnIndex:t,required:l,entityDefinition:s=!1,globalParameter:c=!1,customPropertyFields:d=[],parentRemove:u,entityReferenceValueComponent:p,fileReferenceValueComponent:m,rootNode:f},y)=>{var v;const{clearErrors:C,control:O,setValue:x,getValues:j,reset:V,trigger:R,watch:N}=k({mode:"all",defaultValues:{properties:e}}),{fields:w,append:L,remove:I}=S({control:O,name:"properties"}),{fieldState:{error:A}}=T({control:O,name:"properties",defaultValue:null,rules:{validate:e=>!l||!Array.isArray(e)||0!==e.length||"Please, fill the properties"}}),D=g([]),F=b((()=>{L(zl),C("properties")}),[L,C]),P=b((e=>{u&&u(e),I(e)}),[u,I]);return h((()=>{"number"==typeof t&&D.current[t]&&D.current[t].scrollIntoView({behavior:"smooth",block:"start"})}),[t,D]),h((()=>{var r;(null==e?void 0:e.length)&&!(null===(r=j("properties"))||void 0===r?void 0:r.length)&&V({properties:e})}),[e,j,V]),E(y,(()=>({getProperties:()=>j("properties"),addProperty:F,removeProperty:P,trigger:R})),[j,F,P,R]),a(o,{children:[A&&A.message&&i(Re,Object.assign({sm:12},{children:i(z,Object.assign({color:"secondary"},{children:A.message}))})),Array.isArray(w)&&w.map(((e,r,n)=>i(Bl,{item:e,index:r,arrLength:n.length-1,control:O,watch:N,setValue:x,customPropertyFields:d,entityDefinition:s,globalParameter:c,error:A,rootNode:f,handleRemoveParameter:P,fileReferenceValueComponent:m,entityReferenceValueComponent:p,extRefs:D},e.id))),!n&&a(Re,Object.assign({xs:12},{children:[i(M,Object.assign({variant:"contained",size:"small",color:"primary",onClick:F},{children:"Add property"})),A&&i(G,Object.assign({error:!0},{children:null===(v=A.root)||void 0===v?void 0:v.message}))]}))]})})),Hl=({properties:e=[]})=>{const r=y((()=>Array.isArray(e)?e.map((e=>{const r=Qn(e);return{label:a(B,Object.assign({display:"flex",flexDirection:"column"},{children:[a("b",{children:[a("b",{children:[e.name,e.isRequired&&"*"]}),""+(e.key?" | "+e.key:"")]}),i("span",{children:r})]})),content:r===Pr.OBJECT&&Array.isArray(e.properties)?i(Hl,{properties:e.properties}):(null==e?void 0:e.memberNodes)&&i(Hl,{properties:e.memberNodes.properties})}})):[]),[e]);return i(Gt,{data:r})};var Jl=Hl;const Gl={key:"",propertyType:null,name:"",defaultValue:"",value:"",defaultValues:[],isRequired:!0,isMultiple:!1,sortOrder:0,isEnabled:!0,executeValue:"",uiSettings:""},Yl=({control:e,parentNodeFieldName:r,entityDefinition:n=!1,globalParameter:t=!1,entityReferenceValueComponent:l,fileReferenceValueComponent:o})=>{const s=g(null),{field:{onChange:d}}=T({control:e,name:`${r}.properties`,defaultValue:null}),u=R({control:e,name:`${r}.properties`,defaultValue:null}),p=R({control:e,name:`${r}.name`}),m=b((e=>{d((null==u?void 0:u.length)?[...u,e]:[e])}),[u,d]),h=b((e=>{d(u.filter(((r,n)=>e!==n)))}),[u,d]),y=Wr(),[v,C]=f(0),O=b((()=>{if((null==u?void 0:u.length)>0){m(Gl);const e=u.length;C(e)}else m(Gl);s.current.addProperty(),d(s.current.getProperties())}),[u,m]),E=()=>c(void 0,void 0,void 0,(function*(){(yield s.current.trigger())&&(d(s.current.getProperties()),y.onClose())}));return a(Re,Object.assign({container:!0,spacing:2,direction:"column"},{children:[i(Re,{children:i(z,Object.assign({variant:"h6"},{children:"Properties"}))}),i(Re,{children:i(Jl,{properties:u})}),i(Re,{children:i(M,Object.assign({variant:"contained",color:"primary",onClick:y.onOpen},{children:"Edit properties"}))}),a(D,Object.assign({disableEscapeKeyDown:!0,open:y.open,onClose:E,fullWidth:!0,maxWidth:"md"},{children:[a($,{children:[p||"Entity"," Properties"]}),i(P,Object.assign({style:{height:"500px",overflow:"hidden"}},{children:a(Re,Object.assign({container:!0,direction:"row",spacing:2,style:{height:"100%"}},{children:[a(Re,Object.assign({xs:3,style:{backgroundColor:"#f9f9f9",height:"100%",overflowY:"auto"}},{children:[i(sr,Object.assign({nonLinear:!0,activeStep:v,orientation:"vertical",style:{paddingLeft:"4px"}},{children:Array.isArray(u)&&(null==u?void 0:u.map(((e,r)=>a(cr,Object.assign({onClick:()=>(e=>C(e))(r),style:{cursor:"pointer"}},{children:[i(dr,Object.assign({StepIconProps:{icon:""},style:{wordBreak:"break-word"}},{children:e.name||"(no name)"})),i(ur,{})]}),r))))})),i(M,Object.assign({variant:"contained",size:"small",color:"primary",onClick:O,sx:{marginTop:2}},{children:"Add property"}))]})),i(Re,Object.assign({container:!0,wrap:"nowrap",direction:"column",spacing:2,style:{height:"100%",overflowY:"auto",width:"75%"}},{children:i(_l,{ref:s,properties:u,hideAddButton:!0,parentRemove:h,focusOnIndex:v,entityDefinition:n,globalParameter:t,entityReferenceValueComponent:l,fileReferenceValueComponent:o})}))]}))})),i(F,{children:i(M,Object.assign({variant:"contained",color:"primary",onClick:E},{children:"Ok"}))})]}))]}))};var Wl=({propertyFieldName:e,control:r})=>a(o,{children:[i(Re,{children:i(Gr,{required:!0,control:r,name:`${e}.definitionCode`,label:"Definition Code"})}),i(Re,{children:i(Gr,{required:!0,control:r,name:`${e}.definitionVersion`,label:"Definition Version",defaultValue:1})}),i(Re,{children:i(Gr,{required:!0,control:r,name:`${e}.labelPropertyCode`,label:"Label Property Code"})}),i(Re,{children:i(Gr,{required:!0,control:r,name:`${e}.valuePropertyCode`,label:"Value Property Code"})})]});const Ul=({setValue:e,control:r,nodeType:n,nodeFieldName:t,entityDefinition:l=!1,globalParameter:s=!1,fileReferenceValueComponent:c,entityReferenceValueComponent:d})=>{switch(n){case Pr.STRING:return a(o,{children:[i(z,Object.assign({variant:"h6",mb:1},{children:"Restricted Values"})),i(dt,{name:`${t}.restrictedValues`,control:r})]});case Pr.BIG_DECIMAL:return i(Fl,{nodeFieldName:t,control:r});case Pr.DATE:return i(Pl,{setValue:e,control:r,nodeFieldName:t,defaultValue:Mr});case Pr.TIME:return i(Pl,{setValue:e,control:r,nodeFieldName:t,defaultValue:Dr});case Pr.DATE_TIME:return i(Pl,{setValue:e,control:r,nodeFieldName:t,defaultValue:Fr});case Pr.ENTITY_REFERENCE:return i(Wl,{control:r,propertyFieldName:t});case Pr.OBJECT:return i(Yl,{control:r,parentNodeFieldName:t,globalParameter:s,entityDefinition:l,fileReferenceValueComponent:c,entityReferenceValueComponent:d});case Pr.ARRAY:return i($l,{setValue:e,control:r,parentNodeFieldName:t,globalParameter:s,entityDefinition:l,fileReferenceValueComponent:c,entityReferenceValueComponent:d});default:return null}},Zl=({control:e,nodeFieldName:r,name:n,label:t="",required:l,entityReferenceValueComponent:a,fileReferenceValueComponent:o})=>{const s=R({control:e,name:`${r}.nodeType`}),c=R({control:e,name:`${r}.format`}),d=R({control:e,name:`${r}.restrictedValues`}),u=R({control:e,name:`${r}.properties`}),p=R({control:e,name:`${r}.isRequired`}),m=y((()=>Object.assign(Object.assign(Object.assign(Object.assign({name:t,isRequired:null!=l?l:p},!!c&&{format:c}),{restrictedValues:d}),!!u&&{properties:u}),{nodeType:"string"==typeof s?s:s.value,defaultValue:null,defaultValues:[],sortOrder:0,isEnabled:!0,uiSettings:null,validationNode:null})),[s,c,d,t,p,u,l]);return i(gr,Object.assign({dateAdapter:mr},{children:"ARRAY"===m.nodeType?i(Rl,{control:e,name:n,node:m,title:t,required:l,entityReferenceValueComponent:a,fileReferenceValueComponent:o}):i(Ol,{control:e,name:n,node:m,title:t,required:l,entityReferenceValueComponent:a,fileReferenceValueComponent:o})}))};var Kl=({name:e,control:r,setValue:n})=>{const t=y((()=>({type:""})),[]),{fields:l,append:o,remove:s}=S({control:r,name:e});return a(B,Object.assign({mt:2},{children:[i(M,Object.assign({variant:"outlined",size:"small",onClick:()=>o(t)},{children:"Add node"})),l.map((({id:t},l)=>i(ai,{setValue:n,control:r,removeHandle:()=>s(l),name:`${e}.${l}`},t)))]}))};const Xl=x(""),Ql=({name:e,control:r})=>a(o,{children:[i(z,Object.assign({variant:"body2",gutterBottom:!0},{children:"Node"})),i(B,{children:i(Gr,{control:r,name:`${e}.minimumLength`,label:"Minimum Length",type:"number"})}),i(B,Object.assign({mt:2},{children:i(Gr,{control:r,name:`${e}.maximumLength`,label:"Maximum Length",type:"number"})}))]}),ei=({name:e,control:r})=>a(o,{children:[i(z,Object.assign({variant:"body2",gutterBottom:!0},{children:"Node"})),i(B,{children:i(Gr,{control:r,name:`${e}.multipleOf`,label:"Multiple Of",type:"number"})}),i(B,Object.assign({mt:2},{children:i(Gr,{control:r,name:`${e}.minimum`,label:"Minimum",type:"number"})})),i(B,Object.assign({mt:2},{children:i(Gr,{control:r,name:`${e}.maximum`,label:"Maximum",type:"number"})})),a(B,Object.assign({mt:2},{children:[i(Xr,{control:r,name:`${e}.exclusiveMinimum`,label:"Exclusive Minimum"}),i(Xr,{control:r,name:`${e}.exclusiveMaximum`,label:"Exclusive Maximum"})]}))]}),ri=["STRING_REGEX","JSON_SCHEMA"],ni=new Set([Ar.INTEGER,Ar.FLOAT,Ar.DOUBLE,Ar.BIG_DECIMAL,Ar.BIG_INTEGER,Ar.LONG]);var ti=({name:e,control:r,setValue:n})=>{const t=j(Xl),l=R({control:r,name:`${e}.type`}),s=y((()=>{if("STRING_REGEX"===l)return i(Gr,{control:r,name:`${e}.pattern`,label:"Pattern"});if("JSON_SCHEMA"===l)switch(!0){case t===Ar.STRING:return i(Ql,{name:`${e}.node`,control:r});case ni.has(t):return i(ei,{name:`${e}.node`,control:r});case t===Ar.JSON:return i(pn,{label:"Properties",control:r,name:`${e}.properties`,validateJson:!0,parseValue:!0});default:return"Not available for type "+t}return null}),[t,l,r,e]);return h((()=>{ni.has(t)&&"JSON_SCHEMA"===l&&(n(`${e}.node.exclusiveMinimum`,!1),n(`${e}.node.exclusiveMaximum`,!1))}),[t,l,n,e]),i(Gt,{data:[{label:"Validator",content:a(o,{children:[i(B,{children:i(Kr,{control:r,name:`${e}.type`,label:"Type",options:ri,onChange:r=>{n(e,{}),n(`${e}.type`,r.target.value)}})}),i(B,Object.assign({mt:2},{children:s}))]})}]})};const li=["AND","OR","NOT","NODE"],ii=({name:e,removeHandle:r,control:n,setValue:t})=>{const l=R({control:n,name:`${e}.type`}),s=y((()=>({AND:i(Kl,{name:`${e}.nodes`,control:n,setValue:t}),OR:i(Kl,{name:`${e}.nodes`,control:n,setValue:t}),NODE:i(ti,{name:`${e}.validator`,control:n,setValue:t}),NOT:i(ii,{name:`${e}.node`,control:n,setValue:t})})),[e,n,t]);return i(Gt,{data:[{label:"Node Type",content:a(o,{children:[a(B,Object.assign({display:"flex",alignItems:"flex-end"},{children:[i(Kr,{required:!0,control:n,name:`${e}.type`,label:"Type",options:li}),r&&i(B,Object.assign({ml:2},{children:i(I,Object.assign({onClick:r,color:"primary"},{children:i(yr,{})}))}))]})),i(B,{children:s[l]})]})}]})};var ai=ii;const oi=({name:e,control:r,setValue:n,validator:t})=>{const[l,s]=f(!1),c=b((r=>{s(r.target.checked),r.target.checked||n(e,null)}),[n,e]);return h((()=>{t&&!l&&s(!0)}),[l,t]),a(o,{children:[a(B,Object.assign({display:"flex",justifyContent:"space-between",alignItems:"center"},{children:[i(z,Object.assign({component:"h6",color:"initial",style:{wordBreak:"break-word",fontSize:18}},{children:"Validator"})),i(J,{label:"Enable",control:i(Y,{color:"primary",checked:l,onChange:c})})]})),l&&i(ai,{name:e,control:r,setValue:n})]})};var si=e=>({customCheckboxes:y((()=>e.length?e.filter((e=>"checkbox"===e.type)):[]),[e]),customFields:y((()=>e.length?e.filter((e=>"checkbox"!==e.type)):[]),[e]),validateKey:b((e=>{const r=[...new Set(e.replace(/[a-zA-Z0-9]/g,"").split(""))];return!((null==r?void 0:r.length)>0)||"Delete invalid characters: "+r.join(", ").replace(", ,",",")}),[])});const ci=Object.values(Pr).sort(((e,r)=>e.localeCompare(r))).map((e=>({value:e,label:e.replace("_"," ").toLowerCase().replace(/(^\w)|([-\s]\w)/g,(e=>e.toUpperCase()))}))),di=O((({setValue:e,control:r,nodeFieldName:n,entityDefinition:t=!1,globalParameter:l=!1,customPropertyFields:s=[],entityReferenceValueComponent:c,fileReferenceValueComponent:d,isObjectProperty:u,isObjectNode:p})=>{var m,g;const f=R({control:r,name:`${n}.nodeType`}),b=R({control:r,name:`${n}.isRequired`});R({control:r,name:`${n}.uiSettings`});const v=R({control:r,name:`${n}.validationNode`}),{customCheckboxes:C,customFields:O,validateKey:E}=si(s),x=y((()=>l?"Value":"Default Value"),[l]);h((()=>{f&&"string"==typeof f&&!p?e(`${n}.nodeType`,ci.find((e=>e.value===f))):p&&e(`${n}.nodeType`,ci.find((e=>e.value===Pr.OBJECT)))}),[f,e,n,p]);const j=y((()=>{let e=ci;return l&&(e=ci.filter((e=>e.value!==Pr.ANY))),e}),[c,l]),V=!l||(null!==(m=null==f?void 0:f.value)&&void 0!==m?m:f)!==Pr.OBJECT;return a(Re,Object.assign({container:!0,direction:"column",spacing:2},{children:[u&&i(Re,{children:i(Gr,{required:!0,control:r,name:`${n}.key`,label:"Key",validate:E})}),i(Re,{children:i(Gr,{required:!0,control:r,name:`${n}.name`,label:"Name"})}),i(Re,{children:i(on,{required:!0,control:r,name:`${n}.nodeType`,label:"Type",options:j,disabled:p,onChange:(r,t)=>{const i=`${n}.nodeType`;e(`${n}.${l?"value":"defaultValue"}`,null),e(i,t)}})}),i(Re,{children:i(nt,{required:!0,control:r,name:`${n}.sortOrder`,label:"Sort Order"})}),i(Re,{children:i(pn,{control:r,name:`${n}.uiSettings`,label:"UI Settings",validateJson:!0,parseValue:!0})}),a(Re,{children:[i(Xr,{control:r,name:`${n}.isEnabled`,label:"Enabled"}),i(Xr,{control:r,name:`${n}.isRequired`,label:"Required"}),t&&i(Xr,{control:r,name:`${n}.isViewableInList`,label:"Is viewable in list"}),C.length?i(o,{children:C.map(((e,t)=>i(Xr,{control:r,name:`${n}.${e.name}`,label:e.label,checked:e.checked,defaultValue:e.defaultValue},t)))}):null]}),f&&a(o,{children:[i(Re,{children:i(Xl.Provider,Object.assign({value:null!==(g=f.value)&&void 0!==g?g:f},{children:i(oi,{control:r,setValue:e,validator:v,name:`${n}.validationNode`})}))}),i(Re,{children:i(Ul,{setValue:e,control:r,nodeType:"string"==typeof f?f:f.value,nodeFieldName:n,globalParameter:l,entityDefinition:t,fileReferenceValueComponent:d})}),V&&i(Re,{children:i(Zl,{control:r,nodeFieldName:n,name:`${n}.${l?"value":"defaultValue"}`,label:x,required:!!l&&b,fileReferenceValueComponent:d})})]})]}))})),ui=C((({node:e,entityDefinition:r=!1,globalParameter:n=!1,customPropertyFields:t=[],entityReferenceValueComponent:l,fileReferenceValueComponent:o,isObjectNode:s},c)=>{const{control:d,setValue:u,trigger:p,getValues:m,watch:g,reset:f}=k({mode:"all",defaultValues:{node:e}});return E(c,(()=>({getValues:()=>m("node"),trigger:p})),[m,p]),h((()=>{e&&f({node:e})}),[e,f]),a(B,Object.assign({mt:2},{children:[i(z,Object.assign({component:"h6",color:"initial",mb:3,style:{wordBreak:"break-word",fontSize:18}},{children:"Node Configuration"})),i(di,{control:d,setValue:u,nodeFieldName:"node",isObjectNode:s,entityDefinition:r,globalParameter:n,customPropertyFields:t,entityReferenceValueComponent:l,fileReferenceValueComponent:o})]}))})),pi=({control:e,parentFieldName:r,required:n,entityDefinition:t=!1,globalParameter:l=!1,customPropertyFields:o=[],entityReferenceValueComponent:s,fileReferenceValueComponent:c,isObjectNode:d})=>{const u=y((()=>r?`${r}.node`:"node"),[r]),{setValue:p,watch:m}=N(),{fieldState:{error:g}}=T({control:e,name:u,rules:{validate:e=>!n||!Array.isArray(e)||0!==e.length||"Please, fill the properties"}});return a(B,Object.assign({mt:2},{children:[g&&g.message&&i(Re,Object.assign({sm:12},{children:i(z,Object.assign({color:"secondary"},{children:g.message}))})),i(z,Object.assign({component:"h6",color:"initial",mb:3,sx:{wordBreak:"break-word",fontSize:18}},{children:"Node Configuration"})),i(di,{control:e,setValue:p,isObjectNode:d,nodeFieldName:u,entityDefinition:t,globalParameter:l,customPropertyFields:o,entityReferenceValueComponent:s,fileReferenceValueComponent:c})]}))},mi=C((({control:e,definitionFieldName:r,isObjectNode:n,title:t,hideCodeField:l,hideVersionField:o,hideNameField:s,required:c=!1,entityReferenceValueComponent:d,fileReferenceValueComponent:u},p)=>{const{control:m,getValues:g}=N(),h=g(r?`${r}.node`:"node");return a(Re,Object.assign({container:!0,direction:"column",spacing:2},{children:[t&&i(Re,Object.assign({sm:12},{children:i(B,Object.assign({my:2},{children:i(z,Object.assign({variant:"h6"},{children:t}))}))})),!s&&i(Re,Object.assign({sm:12},{children:i(Gr,{required:!0,control:null!=e?e:m,name:r?`${r}.name`:"name",label:"Name"})})),!l&&i(Re,Object.assign({sm:12},{children:i(Gr,{required:!0,control:null!=e?e:m,name:r?`${r}.code`:"code",label:"Code"})})),!o&&i(Re,Object.assign({sm:12},{children:i(nt,{required:!0,control:null!=e?e:m,name:r?`${r}.version`:"version",label:"Version"})})),i(Re,Object.assign({sm:12},{children:p?i(ui,{node:h,ref:p,isObjectNode:n,entityReferenceValueComponent:d,fileReferenceValueComponent:u}):i(pi,{control:e,required:c,isObjectNode:n,parentFieldName:r,entityReferenceValueComponent:d,fileReferenceValueComponent:u})}))]}))})),gi={name:"Name",key:"Key",propertyType:"Property Type",defaultValue:"Default Value",defaultValues:"Default Values",sortOrder:"Sort Order",isRequired:"Required",isMultiple:"Multiple",isEnabled:"Enabled",isViewableInList:"Is Viewable In List",precisionScale:"Precision Scale",roundingMode:"Rounding Mode",format:"Format",definitionCode:"Definition Code",definitionVersion:"Definition Version",labelPropertyCode:"Label Property Code",valuePropertyCode:"Value Property Code",restrictedValues:"Restricted Values",value:"Value",values:"Values",uiSettings:"UI Settings",validationNode:"Validation Node"},hi=({value:e,type:r})=>r!==Ar.JSON&&r!==Ar.ENTITY&&r!==Ar.ANY||!e?i(z,Object.assign({variant:"subtitle1",display:"inline",style:{wordBreak:"break-word"}},{children:null===e?"null":e.toString()})):i(Cn,{value:e}),fi=(e,r,n)=>{switch(r){case"isRequired":case"isMultiple":case"isEnabled":case"isViewableInList":return e?i(L,Object.assign({color:"primary",fontSize:"small"},{children:i("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})})):null;case"restrictedValues":return e?i(B,Object.assign({display:"flex",flexWrap:"wrap"},{children:e.map((e=>i(Te,{label:e,style:{wordBreak:"break-word",maxWidth:"500px"}},e)))})):null;case"defaultValue":case"value":return i(hi,{value:e,type:n});case"values":case"defaultValues":return Array.isArray(e)&&n!==Ar.ENTITY&&n!==Ar.JSON&&n!==Ar.ANY?a("div",{children:["[",null==e?void 0:e.map(((e,r)=>i("div",{children:i(hi,{value:e,type:n})},r))),"]"]}):i(Cn,{value:e});case"uiSettings":case"validationNode":return e?i(Cn,{value:e}):null;default:return i(z,Object.assign({variant:"subtitle1",display:"inline",style:{wordBreak:"break-word"}},{children:e}))}};var bi=({property:e})=>{const r=y((()=>(e&&(e.isMultiple?(delete e.defaultValue,delete e.value):(delete e.defaultValues,delete e.values)),e)),[e]);return i(_e,Object.assign({size:"small"},{children:i(He,{children:Object.keys(gi).map((e=>e in r?a(We,{children:[i(Je,Object.assign({width:"30%"},{children:i(z,{children:gi[e]})})),i(Je,{children:fi(r[e],e,r.propertyType)})]},e):null))})}))};var yi=O((({properties:e,parentNames:r=[]})=>{const n=y((()=>{if(!e)return!1;let r=!1;return e.every((e=>e.propertyType!==Ar.ENTITY||(r=!0,!1))),r}),[e]);return a(B,Object.assign({mt:4},{children:[i(z,Object.assign({variant:"h6"},{children:"Properties"})),a(sr,Object.assign({orientation:"vertical",style:{paddingLeft:"4px"}},{children:[null==e?void 0:e.map((e=>a(cr,Object.assign({expanded:!0},{children:[i(dr,{StepIconProps:{icon:"",completed:!1,active:!0}}),i(ur,{children:i(vi,{property:e,parentNames:[...r],defaultExpanded:!1})})]}),e.key))),n&&i(cr,{})]}))]}))}));const vi=({property:e,parentNames:r=[],defaultExpanded:n=!0})=>{const[t,l]=f(!0);return h((()=>{l(n)}),[n]),a(tr,Object.assign({elevation:3,style:{backgroundColor:r.length%2==1?"#f1f1f1":"#fff"},expanded:t,onChange:()=>l((e=>!e))},{children:[i(lr,Object.assign({expandIcon:i(L,{children:i("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})})},{children:i(z,Object.assign({style:{wordBreak:"break-word",fontWeight:"600"}},{children:e.name}))})),i(ir,{children:a(B,Object.assign({width:"100%"},{children:[i(bi,{property:e}),e.propertyType===Ar.ENTITY&&i(yi,{properties:$n(e.properties),parentNames:[...r,e.name]})]}))})]}))},Ci=({properties:e,expandAll:r=!0})=>{const n=y((()=>Array.isArray(e)?e:e?$n(e):[]),[e]);return i(B,Object.assign({display:"flex",flexDirection:"column"},{children:n.length?n.map((e=>i(vi,{property:e,defaultExpanded:r},e.key))):i(z,{children:"No properties"})}))},Oi=({property:e,name:r,useExpression:n,label:t,required:l,title:o,entityReferenceDefinitionSources:s,entityReferenceValueComponent:c,fileReferenceValueComponent:d,requiredErrorText:p=""})=>{const{control:m,clearErrors:f,setValue:y}=N(),{field:{value:v},fieldState:{error:C,isDirty:O}}=T({name:r,control:m,rules:{validate:e=>!l||null!==e||(p||Hr)}}),E=g({}),{propertyType:x,valueLabel:j,fillOptionLabel:V,fillOption:R,fillOptions:w,setFillOption:S,defaultProperyValue:k}=nl({value:v,property:e,isDirty:O,label:t,required:l,useExpression:n}),L=b((n=>{const t=n.target.value;E.current=Object.assign(Object.assign({},E.current),{[R]:v}),S(t);const l=E.current[t];if("null"===t)y(r,null,{shouldDirty:!0});else if("widget"===t)if(x===Ar.JSON&&v&&"string"!=typeof v&&"dem_builder"===R&&"properties"in v){const e=Object.assign(Object.assign({},v),{properties:qn(v.property||[])});try{y(r,null!=l?l:JSON.stringify(e,null,"\t"))}catch(e){console.log("Stringify failed",e)}}else y(r,null!=l?l:e.defaultValue||k);else if("expression"===t||"string"===t)y(r,null!=l?l:"",{shouldDirty:!0});else if("dem_builder"===t){const e={code:"",name:"",version:0,properties:[]};if(v)try{const e=JSON.parse(v);e.properties=$n(e.properties||{}),y(r,null!=l?l:e,{shouldDirty:!0})}catch(n){y(r,null!=l?l:e,{shouldDirty:!0})}else y(r,null!=l?l:e,{shouldDirty:!0})}f()}),[r,f,v,S,R,x,e,y,k]);return h((()=>{O||fr(e.defaultValue||e.value)||""===e.defaultValue&&""===e.value||!fr(v)||y(r,e.defaultValue||e.value)}),[O,e,y,v,r]),h((()=>{var n;(void 0===v||e.isRequired&&null===v&&!e.defaultValue&&!e.value)&&y(r,null!==(n=E.current[R])&&void 0!==n?n:k),void 0!==v||e.isRequired||null!==e.defaultValue&&null!==e.value||y(r,null)}),[v,y,r,k,e,R]),a(Re,Object.assign({xs:12},{children:[o&&i(B,Object.assign({mb:2},{children:i(z,Object.assign({variant:"h6"},{children:o}))})),w?i(B,Object.assign({mb:2},{children:a(H,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[i(tl,Object.assign({htmlFor:"type-select"},{children:V})),i(hr,Object.assign({labelId:"type-select",label:V,value:R||"",onChange:L},{children:w.map((e=>i(u,Object.assign({value:e.value},{children:e.label}),e.value)))}))]}))})):null,"expression"===R&&(x===Ar.JSON||x===Ar.ENTITY||x===Ar.ANY?i(pn,{name:r,control:m,label:j,parseValue:!0,hideErrorMessage:!0,useCleanValue:!0,mode:x===Ar.ANY?"text":"json"}):i(Gr,{control:m,name:r,label:j,hideErrorMessage:!0})),"string"===R&&i(Gr,{control:m,name:r,label:j,hideErrorMessage:!0}),"json_notvalid"===R&&i(pn,{name:r,control:m,label:j,hideErrorMessage:!0}),"widget"===R&&i(rl,{control:m,property:e,name:r,useExpression:n,label:j,entityReferenceDefinitionSources:s,entityReferenceValueComponent:c,fileReferenceValueComponent:d}),"dem_builder"===R&&i(bl,{title:"JSON",definitionFieldName:r,entityReferenceDefinitionSources:s,entityReferenceValueComponent:c,fileReferenceValueComponent:d}),C&&i(G,Object.assign({error:!0},{children:C.message}))]}))};var Ei=({name:e,property:r,useExpression:n,required:t,label:l,entityReferenceDefinitionSources:o,entityReferenceValueComponent:s,fileReferenceValueComponent:c})=>{const{control:d,setValue:u,clearErrors:p}=N(),m=R({control:d,name:e}),{defaultProperyValue:g}=nl({value:m,property:r,isDirty:!1,label:l,required:t}),h=b((()=>{m&&Array.isArray(m)?u(`${e}.${m.length}`,g):u(e,[g]),p(e)}),[e,m,u,p,g]),f=b((r=>{u(e,mn(m,r))}),[e,m,u]);return a(Re,Object.assign({container:!0,spacing:2,direction:"column",xs:12},{children:[Array.isArray(m)&&m.length?m.map(((d,u)=>i(Re,Object.assign({xs:12},{children:a(B,Object.assign({display:"flex",alignItems:"flex-start",width:"100%",p:2,style:{backgroundColor:"#f1f1f1"}},{children:[i(Oi,{required:t,property:r,useExpression:n,name:`${e}.${u}`,label:`${l||r.name} (${u+1})`,entityReferenceDefinitionSources:o,entityReferenceValueComponent:s,fileReferenceValueComponent:c}),i(B,Object.assign({mt:"8px",ml:"4px"},{children:i(I,Object.assign({id:"close-button",size:"small",onClick:()=>f(u)},{children:i(L,Object.assign({fontSize:"small"},{children:i("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})}))}))}))]}))}),u))):null,i(Re,{children:i(M,Object.assign({variant:"contained",size:"small",color:"primary",onClick:h},{children:"Add value"}))})]}))};const xi=({property:e,name:r,useExpression:n,required:t,label:l,title:o,entityReferenceDefinitionSources:s,entityReferenceValueComponent:c,fileReferenceValueComponent:d,requiredErrorText:p=""})=>{var m;const[b,y]=f(!1),{control:v,clearErrors:C,setValue:O,watch:E}=N(),{field:{ref:x,onChange:j},fieldState:{error:V,isDirty:R}}=T({control:v,name:r,defaultValue:null!==(m=e.defaultValue)&&void 0!==m?m:[],rules:{validate:e=>!(t&&!e)||(p||Hr)}}),w=E(r),S=g({}),{propertyType:k,valueLabel:L,fillOptionLabel:I,fillOption:A,fillOptions:M,setFillOption:D,checkFillOption:F}=nl({property:e,value:w,isDirty:R,label:l,required:t,useExpression:n,multipleOptions:!0});return h((()=>{w||j(e.isRequired&&e.isMultiple?[]:null)}),[w,e,j]),h((()=>{w&&!b&&(y(!0),F())}),[F,b,w]),a(Re,{children:[o&&i(B,Object.assign({mb:2},{children:i(z,Object.assign({variant:"h6"},{children:o}))})),M?i(B,Object.assign({mb:2},{children:a(H,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[i(tl,Object.assign({htmlFor:"type-select"},{children:I})),i(hr,Object.assign({labelId:"type-select",label:I,value:A||"",onChange:e=>{y(!0),S.current=Object.assign(Object.assign({},S.current),{[A]:w});const n=e.target.value,t=S.current[n];"null"===n?O(r,null):"expression"===n||"json_valid"===n||"json_notvalid"===n?O(r,null!=t?t:"",{shouldDirty:!0}):"widget"===n&&O(r,null!=t?t:[],{shouldDirty:!0}),D(n),C(r)}},{children:M.map((e=>i(u,Object.assign({value:e.value},{children:e.label}),e.value)))}))]}))})):null,"expression"===A&&(k===Ar.JSON||k===Ar.ENTITY||k===Ar.ANY?i(pn,{name:r,control:v,label:L,parseValue:!0,hideErrorMessage:!0,useCleanValue:!0,mode:k===Ar.ANY?"text":"json"}):i(Gr,{required:!0,hideErrorMessage:!0,control:v,name:r,label:L})),"json_valid"===A&&i(pn,{name:r,control:v,label:L,parseValue:!0,validateJson:!0,hideErrorMessage:!0}),"widget"===A&&i(Ei,{property:e,name:r,useExpression:n,required:t,label:l,entityReferenceDefinitionSources:s,entityReferenceValueComponent:c,fileReferenceValueComponent:d}),V&&i(G,Object.assign({error:!0},{children:V.message}))]})},ji=({properties:e,dataFieldName:r,useExpression:n=!1,title:t,entityReferenceDefinitionSources:l,entityReferenceValueComponent:o,fileReferenceValueComponent:s})=>{const c=y((()=>e?e.map((e=>{var t;const c="string"==typeof e.propertyType?e.propertyType:null===(t=e.propertyType)||void 0===t?void 0:t.value;return{label:a(B,Object.assign({display:"flex",flexDirection:"column"},{children:[a("b",{children:[e.name,e.isRequired?"*":""]}),a("span",{children:[e.key," | ",e.isMultiple?"multiple":"single"," |"," ",c]})]})),content:e.isMultiple?i(xi,{property:e,name:`${r}.${e.key}`,useExpression:n,label:e.name,required:e.isRequired,entityReferenceValueComponent:o,fileReferenceValueComponent:s,entityReferenceDefinitionSources:l}):i(Oi,{property:e,name:`${r}.${e.key}`,useExpression:n,label:e.name,required:e.isRequired,entityReferenceDefinitionSources:l,entityReferenceValueComponent:o,fileReferenceValueComponent:s})}})):[]),[e,r,n,o,l,s]);return i(gr,Object.assign({dateAdapter:mr},{children:a(Re,Object.assign({container:!0,direction:"column",spacing:2},{children:[t&&i(Re,Object.assign({xs:12},{children:i("div",Object.assign({style:{fontWeight:"600"}},{children:t}))})),i(Gt,{data:c})]}))}))},Vi=({node:e,dataFieldName:r,useExpression:n=!1,title:t,entityReferenceValueComponent:l,fileReferenceValueComponent:o})=>{const s=b(((e,r)=>Qn(e)===Pr.ARRAY?i(Vl,{node:e,name:r,useExpression:n,label:e.name,required:e.isRequired,entityReferenceValueComponent:l,fileReferenceValueComponent:o}):i(xl,{node:e,name:r,useExpression:n,label:e.name,required:e.isRequired,entityReferenceValueComponent:l,fileReferenceValueComponent:o})),[n,o,l]),c=b(((e,r)=>{if(e){const n=Qn(e);return{label:a(B,Object.assign({display:"flex",flexDirection:"column"},{children:[a("b",{children:[e.name,e.isRequired?"*":""]}),i("span",{children:`${e.key?e.key+" | ":""}${n}`})]})),content:s(e,r)}}return null}),[s]);return i(gr,Object.assign({dateAdapter:mr},{children:a(Re,Object.assign({container:!0,direction:"column",spacing:2},{children:[t&&i(Re,Object.assign({xs:12},{children:i("div",Object.assign({style:{fontWeight:"600"}},{children:t}))})),i(Gt,{data:[c(Un(e),r)]})]}))}))};var Ti=({property:e,data:r})=>{const{name:n}=e,t=b(((e,r)=>{const n=e,t=document.createElement("a");document.body.appendChild(t),t.href=n,t.target="_self",t.download=r,t.click()}),[]);return i(M,Object.assign({component:"label",variant:"contained",size:"large",color:"primary",onClick:()=>t(r,n)},{children:"Download File"}))};const Ri=({property:e,data:r,properties:n})=>{const t=e=>i(B,Object.assign({style:{backgroundColor:"#fff",border:"1px solid #ccc",borderRadius:"4px",padding:"4px",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}},{children:null===e?"null":e.toString()}));switch(e.propertyType){case Ar.JSON:return i(Cn,{value:r});case Ar.ENTITY:return i(wi,{properties:n,data:r});case Ar.ANY:return"object"==typeof r?i(Cn,{value:r}):t(r);case Ar.FILE_REFERENCE:return null===r?t(r):i(M,Object.assign({component:oe,color:"primary",variant:"contained",target:"_blank",to:r,sx:{marginTop:4}},{children:"Download via link"}));case Ar.FILE:return null===r?t(r):i(Ti,{data:r,property:e});default:return t(r)}};var Ni=({property:e,data:r,hasBackground:n=!1})=>{const t=y((()=>e.propertyType===Ar.ENTITY?Array.isArray(e.properties)?e.properties:$n(e.properties):[]),[e]);return i(B,Object.assign({style:{backgroundColor:n?"#f1f1f1":"none"}},{children:i(Ri,{property:e,data:r,properties:t})}))};const wi=({properties:e,data:r})=>{const n=y((()=>e&&r?e.map((e=>{const{key:n,name:t,isMultiple:l,propertyType:s}=e,c=r[e.key]?r[e.key]:null;return{label:a(B,Object.assign({display:"flex",flexDirection:"column"},{children:[i("b",{children:t}),a("span",{children:[n," | ",l?"multiple":"single"," | ",s]})]})),content:l&&Array.isArray(c)&&e.propertyType!==Ar.ANY?i(o,{children:c.map(((r,n)=>i(B,Object.assign({mb:2},{children:i(Ni,{property:e,data:r,hasBackground:!0})}),n)))}):i(Ni,{property:e,data:c})}})):[]),[e,r]);return i(Re,Object.assign({container:!0,direction:"column",spacing:2},{children:i(Gt,{data:n})}))};var Si=({node:e,data:r})=>{const{name:n}=e,t=b(((e,r)=>{const n=e,t=document.createElement("a");document.body.appendChild(t),t.href=n,t.target="_self",t.download=r,t.click()}),[]);return i(M,Object.assign({component:"label",variant:"contained",size:"large",color:"primary",onClick:()=>t(r,n)},{children:"Download File"}))};const ki=({node:e,data:r})=>{var n;const t=e=>i(B,Object.assign({sx:{borderRadius:"4px",padding:"4px",wordBreak:"auto-phrase"}},{children:fr(e)?"null":vr(e)?JSON.stringify(e,null,2):e.toString()}));switch(Qn(e)){case Pr.ARRAY:return Array.isArray(r)?i("div",{children:null==r?void 0:r.map((r=>i(ki,{node:e.memberNodes,data:vr(r)?r:r+","})))}):t(r);case Pr.OBJECT:return Array.isArray(e.properties)&&(null===(n=e.properties)||void 0===n?void 0:n.length)?i(Ii,{node:e,data:r}):"object"==typeof r?i(Cn,{value:r}):t(r);case Pr.ANY:return"object"==typeof r?i(Cn,{value:r}):t(r);case Pr.FILE_REFERENCE:return null===r?t(r):i(M,Object.assign({component:oe,color:"primary",variant:"contained",target:"_blank",to:r,sx:{marginTop:4}},{children:"Download via link"}));case Pr.FILE:return fr(r)?t(r):"string"==typeof r?i(Si,{data:r,node:e}):t(r);default:return t(r)}};var Li=({node:e,data:r,hasBackground:n=!1})=>i(B,Object.assign({sx:{backgroundColor:n?"#f1f1f1":"none"}},{children:i(ki,{node:e,data:r})}));const Ii=({node:e,data:r})=>{const n=b(((e,r)=>{var t;if(e&&r){const l=e.key?r[e.key]:r,o=Qn(e);return{label:a(B,Object.assign({display:"flex",flexDirection:"column"},{children:[a("span",{children:[a("b",{children:[e.name,e.isRequired&&"*"]}),""+(e.key?" | "+e.key:"")]}),i("span",{children:o})]})),content:o===Pr.OBJECT&&Array.isArray(e.properties)&&(null===(t=e.properties)||void 0===t?void 0:t.length)?e.properties.map((e=>n(e,l))):i(Li,{node:e,data:l})}}return null}),[]);return i(Re,Object.assign({container:!0,direction:"column",spacing:2},{children:i(Gt,{data:[n(e,r)]})}))},Ai=t(B)((({theme:e})=>({backgroundColor:"#eee",fontSize:"14px",padding:"0 8px",borderRadius:"10px",width:"fit-content","&.success":{backgroundColor:"#a9dfa9"},"&.error":{backgroundColor:"#ff7e7e"},"&.warning":{backgroundColor:e.palette.warning.main}}))),Mi=({text:e,status:r="default"})=>i(Ai,Object.assign({className:Cr("root",{[r]:!0})},{children:e})),Di=({properties:e,parentKey:r="",activePath:n="",prefix:t="",onClick:l})=>i(sr,Object.assign({orientation:"vertical",onClick:e=>e.stopPropagation()},{children:e&&e.map((e=>{var o;const s=r?`${r}.${e.key}`:e.key,c=null!==(o=e.propertyType.value)&&void 0!==o?o:e.propertyType;return a(cr,Object.assign({expanded:!0,onClick:()=>{return e=s,void l(t?`${t}.${e}`:e);var e}},{children:[i(dr,Object.assign({StepIconProps:{icon:"",completed:!1,active:n===s}},{children:a(B,Object.assign({sx:{propertyStepLabel:{"&:hover":{fontWeight:"600",cursor:"pointer"}}}},{children:[e.name," - ",e.key," - ",c]}))})),i(ur,{children:i("div",{children:c===Ar.ENTITY&&i(Di,{onClick:l,activePath:n,properties:e.properties,parentKey:s},e.key)})})]}),e.key)}))}));var Fi=Di;const Pi=({open:e=!1,onClose:r,onPaste:n,properties:t})=>{const[l,o]=f("");return a(D,Object.assign({open:e,onClose:r,fullWidth:!0,maxWidth:"md"},{children:[i($,{children:"JSON path picker"}),a(P,{children:[(null==t?void 0:t.length)?t.map(((e,r)=>a("div",{children:[i(z,Object.assign({variant:"h6"},{children:e.title})),i(Fi,{properties:e.properties,prefix:e.pathPrefix,onClick:o,activePath:l})]},r))):i(z,{children:"Please, add properties"}),l&&a(z,Object.assign({variant:"h6",gutterBottom:!0},{children:["Selected path : $(",l,")"]}))]}),a(F,{children:[i(M,Object.assign({variant:"contained",color:"primary",onClick:()=>{navigator.clipboard.writeText(`$(${l})`),Or.success("Copied!")}},{children:"Copy"})),i(M,Object.assign({variant:"contained",color:"primary",onClick:()=>{n(`$(${l})`),Or.success("Pasted!")}},{children:"Paste"})),i(M,Object.assign({variant:"contained",color:"secondary",onClick:r},{children:"Close"}))]})]}))},qi=x({collapsed:!1,toggleCollapse:()=>{console.log("collapse toggle")}}),$i=()=>j(qi),Bi=({children:e})=>{const[r,n]=f("true"===localStorage.getItem("sidebar_collapsed")),t=b((()=>{n(!r),localStorage.setItem("sidebar_collapsed",`${!r}`),window.dispatchEvent(new CustomEvent("sidebar_collapsed",{detail:{collapsed:!r}}))}),[r]),l=b(((e,r)=>{localStorage.setItem(`${e.toLowerCase()}_collapsed`,`${!r}`)}),[]);return i(qi.Provider,Object.assign({value:{collapsed:r,toggleCollapse:t,toggleRootElementLink:l}},{children:e}))},zi=t("div")({position:"relative","&:hover":{".button-collapse":{opacity:1}}}),_i=t(xr)((e=>({width:248,flexShrink:0,position:"relative",transition:"all 0.3s ease-in-out",zIndex:999,"& .MuiDrawer-paper":{backgroundColor:e.theme.palette.secondary.main,width:248,boxSizing:"border-box",borderRight:"none",borderRadius:0,transition:"all 0.3s ease-in-out",overflow:"hidden"},"&.collapsed":{width:70,"& .MuiDrawer-paper":{width:70}}}))),Hi=t(wr)((({theme:e})=>({backgroundColor:"#fff",borderRight:"1px solid rgba(38, 40, 66, 0.08)",position:"relative","& span":{paddingLeft:10,paddingTop:5,fontSize:24,fontWeight:600,transition:".3s ease .1s",whiteSpace:"nowrap"},"&:after":{transition:"opacity .3s",content:"attr(data-title)",fontSize:30,position:"absolute",left:"50%",transform:"translate3d(-50%, 0, 0)",opacity:0,visibility:"hidden"},"&.collapsed":{justifyContent:"center","& img":{width:40},"& span":{opacity:0,visibility:"hidden",transitionDelay:"0s"},"&:after":{opacity:1,visibility:"visible",transitionDelay:".1s"}}}))),Ji=t(jr)((e=>({padding:e.theme.spacing(3),margin:0}))),Gi=t(Vr)((e=>({color:"#fff",height:e.theme.spacing(11),overflow:"hidden"}))),Yi=t(Rr)((({theme:e})=>({borderRadius:e.spacing(2.5),padding:e.spacing(2),height:e.spacing(11),alignItems:"center","&.active":{backgroundColor:"rgba(38, 40, 66, 0.12)","&.main":{backgroundColor:"rgba(255, 255, 255, 0.12)",borderLeft:"4px solid #E0613A"}},"&:hover":{backgroundColor:"rgba(255, 255, 255, 0.08)"},"&.collapsed":{width:e.spacing(11.5),"&.active":{"&.main":{border:"none",backgroundColor:"#E0613A"}}}}))),Wi=t(Tr)((({theme:e})=>({color:"#fff",minWidth:20,marginRight:e.spacing(2),"& svg":{marginLeft:2,fill:"#fff",color:"#fff"}}))),Ui=t(ee)((({theme:e})=>({textTransform:"uppercase",borderRadius:e.spacing(2.5),backgroundColor:e.palette.secondary.main,color:"#fff",paddingLeft:0,paddingRight:0,position:"relative","&:hover":{backgroundColor:"rgba(255, 255, 255, 0.08)"},"&.collapsed":{fontSize:24,textAlign:"center",fontWeight:"bold",paddingRight:0}}))),Zi=t(Nr)((({theme:e})=>({width:"100%",marginLeft:e.spacing(2),alignItems:"center","& > *":{overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-all",whiteSpace:"nowrap"}}))),Ki=t(jr)((e=>({margin:0,padding:0,"& .MuiListItemText-root:not(.main)":{paddingLeft:e.theme.spacing(8.5)}}))),Xi=t(Sr)((e=>({position:"absolute",top:e.theme.spacing(10),left:"calc(100% - 16px)",width:e.theme.spacing(8),height:e.theme.spacing(8),border:"1px solid #E0E3EA",borderRadius:"50%",boxShadow:"0px 2px 8px rgba(0, 0, 0, 0.12)",backgroundColor:"#fff",zIndex:1e3,opacity:0,transition:"all 0.3s ease-in-out","&.collapsed":{img:{transition:"all 0.3s ease-in-out",transform:"rotate(180deg)"}}})));var Qi=({route:e,isActive:r,isSubmenu:n})=>{const{collapsed:t}=$i(),[l,s]=m.useState(null),c=Boolean(l),d=e=>{s(e.currentTarget)},u=()=>{s(null)},p=b((({children:r})=>t&&!n?i(le,Object.assign({title:e.name,placement:"right"},{children:r})):r),[t,e,n]);return e.link?i(Gi,Object.assign({disablePadding:!0},{component:oe,replace:!0,to:{pathname:e.link,search:e.query}},{children:i(p,{children:a(Yi,Object.assign({className:Cr({active:r,main:e.main,collapsed:t})},{children:[e.icon&&i(Wi,Object.assign({className:Cr({collapsed:t})},{children:e.icon})),i(Zi,{primary:e.name,primaryTypographyProps:{variant:"body2"},className:Cr({collapsed:t,main:e.main}),sx:t&&!n?{display:"none"}:{}})]}))})})):e.children&&t?a(o,{children:[i(Ui,Object.assign({className:"collapsed"},{children:i(le,Object.assign({title:e.name,placement:"right"},{children:i(Yi,Object.assign({className:Cr({active:r,main:e.main,collapsed:t}),sx:{justifyContent:"center"},onClick:d},{children:e.name.substring(0,1)}))}))})),i(Xe,Object.assign({open:c,anchorEl:l,onClose:u,PaperProps:{sx:{width:300,maxHeight:440}},MenuListProps:{sx:{bgcolor:"secondary.main"}},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"}},{children:e.children.map(((e,r)=>i(la,{route:e,isSubmenu:!0},r)))}))]}):i(Ui,{children:e.name})},ea="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg opacity='0.6'%3e%3cpath d='M10.3533 2.81334C10.447 2.90709 10.4996 3.03417 10.4996 3.16667C10.4996 3.29917 10.447 3.42626 10.3533 3.52001L5.87334 8.00001L10.3533 12.48C10.4025 12.5258 10.4419 12.581 10.4692 12.6423C10.4965 12.7036 10.5112 12.7699 10.5124 12.837C10.5136 12.9041 10.5012 12.9708 10.4761 13.0331C10.4509 13.0953 10.4135 13.1519 10.366 13.1994C10.3186 13.2468 10.262 13.2843 10.1997 13.3094C10.1375 13.3346 10.0708 13.3469 10.0037 13.3457C9.93652 13.3446 9.87032 13.3299 9.80898 13.3025C9.74765 13.2752 9.69245 13.2358 9.64667 13.1867L4.81334 8.35334C4.71971 8.25959 4.66711 8.13251 4.66711 8.00001C4.66711 7.86751 4.71971 7.74042 4.81334 7.64667L9.64667 2.81334C9.74042 2.71971 9.86751 2.66711 10 2.66711C10.1325 2.66711 10.2596 2.71971 10.3533 2.81334Z' fill='white'/%3e%3c/g%3e%3c/svg%3e";var ra=({route:e,isActive:r,isListOpen:n,handleClick:t,isSubmenu:l})=>i(Ui,{children:i(Ji,Object.assign({sx:{padding:0,margin:0}},{children:i(Gi,Object.assign({disablePadding:!0,onClick:t},{children:a(Yi,Object.assign({className:Cr({active:r,main:e.main}),sx:{justifyContent:"space-between"}},{children:[i(Zi,{primary:e.name,className:Cr({main:e.main}),sx:l?{}:{display:"none"}}),e.name,i(B,{component:"img",src:ea,mr:3,sx:{transition:"transform .3s",transform:`rotate(${n?0:"-90deg"})`}})]}))}))}))});function na({route:e,isActive:r,isListOpen:n,handleClick:t,isSubmenu:l}){const{collapsed:o}=$i();return(null==e?void 0:e.link)?i(Gi,Object.assign({disablePadding:!0,onClick:t},{children:a(Yi,Object.assign({className:Cr({active:r,main:e.main,collapsed:o})},{children:[e.icon&&i(Wi,{children:e.icon}),i(Zi,{primary:e.name,primaryTypographyProps:{variant:"body2"},className:Cr({collapsed:o,main:e.main}),sx:o&&!l?{display:"none"}:{}}),i(B,{component:"img",src:ea,mr:3,sx:{transition:"transform .3s",transform:`rotate(${n?"-90deg":0})`}})]}))})):(null==e?void 0:e.rootLink)?i(ra,{route:e,handleClick:t,isListOpen:n}):i(Ui,{children:e.name})}const ta=({route:e,isSubmenu:r})=>{var n,t,l;const s=ae(),{collapsed:c,toggleRootElementLink:d}=$i(),[u,p]=f(!1),[m,g]=f("true"===localStorage.getItem(`${e.name.toLowerCase()}_collapsed`)),v=y((()=>!(!e.link&&!e.rootLink)&&s.pathname.startsWith(e.link||e.rootLink)),[s.pathname,e]),C=b((()=>{e&&e.rootLink&&(d(e.name,m),g(!m))}),[m,e,d]);return h((()=>{p(v)}),[v]),(null==e?void 0:e.rootLink)&&(null===(n=e.children)||void 0===n?void 0:n.length)&&(!c||c&&r)?a(o,{children:[i(na,{route:e,isActive:v,handleClick:C,isListOpen:m,isSubmenu:r}),i(kr,Object.assign({in:!m,timeout:"auto"},{children:i(Ki,{children:e.children.map((e=>i(ta,{route:e,isSubmenu:r},e.name)))})}))]}):(null===(t=e.children)||void 0===t?void 0:t.length)&&(!c||c&&r)?a(o,{children:[i(na,{route:e,isActive:v,handleClick:()=>{p(!u)},isListOpen:u||!e.link,isSubmenu:r}),i(kr,Object.assign({in:u||!e.link,timeout:"auto"},{children:i(Ki,{children:null===(l=e.children)||void 0===l?void 0:l.map(((e,n)=>i(ta,{route:e,isSubmenu:r},e.name)))})}))]}):i(Qi,{route:e,isActive:v,isSubmenu:r})};var la=ta;const ia=({src:e,alt:r})=>i(B,Object.assign({sx:{width:20,height:20,display:"flex",justifyContent:"center",alignItems:"center"}},{children:i("img",{src:e,alt:r})}));var aa=({title:e,routes:r,id:n,logo:t,collapsedLogo:l,footer:o,collapsedFooter:s})=>{const{collapsed:c,toggleCollapse:d}=$i();return a(zi,{children:[i(Xi,Object.assign({className:Cr("button-collapse",{collapsed:c}),onClick:d},{children:i("img",{src:"data:image/svg+xml,%3csvg width='7' height='12' viewBox='0 0 7 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M6.47054 0.861939C6.59552 0.986958 6.66573 1.1565 6.66573 1.33327C6.66573 1.51005 6.59552 1.67959 6.47054 1.80461L2.27521 5.99994L6.47054 10.1953C6.59198 10.321 6.65917 10.4894 6.65766 10.6642C6.65614 10.839 6.58602 11.0062 6.46242 11.1298C6.33881 11.2534 6.1716 11.3235 5.99681 11.3251C5.82201 11.3266 5.65361 11.2594 5.52787 11.1379L0.861207 6.47127C0.736226 6.34625 0.666016 6.17672 0.666016 5.99994C0.666016 5.82316 0.736226 5.65362 0.861207 5.52861L5.52787 0.861939C5.65289 0.736958 5.82243 0.666748 5.99921 0.666748C6.17598 0.666748 6.34552 0.736958 6.47054 0.861939V0.861939Z' fill='%238B8C9E'/%3e%3c/svg%3e",alt:"collapse"})})),a(_i,Object.assign({variant:"permanent",anchor:"left",className:Cr({collapsed:c}),id:n},{children:[(!!e||!!t)&&i(Hi,Object.assign({className:Cr({collapsed:c}),"data-title":e.substring(0,1)},{children:a(B,Object.assign({display:"flex",flexDirection:"column"},{children:[!!e&&i(B,Object.assign({component:"span"},{children:e})),!!t&&i(B,{component:"img",src:c?l:t,alt:"Lending Hub KZ"})]}))})),a(B,Object.assign({height:""+(t||e?"calc(100vh - 56px)":"auto"),display:"flex",flexDirection:"column",justifyContent:"space-between"},{children:[i(Ji,Object.assign({sx:{overflowY:"auto","&::-webkit-scrollbar":{width:"8px"},"&::-webkit-scrollbar-thumb":{background:"rgba(196, 196, 196, 0.8)",borderRadius:"16px",backgroundClip:"padding-box",border:"2px solid rgba(0, 0, 0, 0)"}}},{children:r.map((e=>i(la,{route:e},e.name)))})),o&&i(B,Object.assign({borderTop:"1px solid #FFFFFF1F"},{children:c?s:o}))]}))]}))]})};const oa=({routes:e,theme:r=wn,title:n="",id:t,logo:o,collapsedLogo:s,footer:c,collapsedFooter:d})=>a(l,Object.assign({theme:r},{children:[i(Er,{}),i(Bi,{children:i(aa,{title:n,routes:e,id:t,logo:o,collapsedLogo:s,footer:c,collapsedFooter:d})})]})),sa=({children:e,toolbar:r,contentSx:n,sx:t})=>a(B,Object.assign({component:"section",sx:Object.assign({flexGrow:1,bgcolor:"background.default"},t)},{children:[i(wr,Object.assign({sx:{borderBottom:"1px solid rgba(38, 40, 66, 0.08)"}},{children:r})),i(B,Object.assign({sx:Object.assign(Object.assign({},n),{height:"calc(100vh - 56px)",overflow:"scroll"})},{children:i(V,Object.assign({fallback:i($r,{})},{children:null!=e?e:i(ce,{})}))}))]})),ca=t(oe)((()=>({textDecoration:"none",color:"inherit"}))),da=({crumbs:e})=>i(Lr,Object.assign({separator:i(Ir,{fontSize:"small"}),"aria-label":"breadcrumb",sx:{"& li":{color:"#6D6E85","&:last-child":{color:"#262842"}}}},{children:e.map(((e,r)=>e.link?i(ca,Object.assign({to:e.link,className:"breadcrumb"},{children:e.title}),r):i(z,Object.assign({className:"breadcrumb"},{children:e.title}),r)))})),ua=({children:e})=>{const[r,n]=f(!1),t=b((e=>{n((null==e?void 0:e.scrollWidth)>(null==e?void 0:e.clientWidth));window.addEventListener("resize",(()=>{n((null==e?void 0:e.scrollWidth)>(null==e?void 0:e.clientWidth))}))}),[]);return i(le,Object.assign({title:e,arrow:!0,disableHoverListener:!r},{children:i("div",Object.assign({ref:t,style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},{children:e}))}))};export{Br as AlertDialog,Vl as ArrayNodeFormBuilder,Rl as ArrayNodeFormBuilderControl,un as BackButton,da as Breadcrumbs,sa as ContentLayout,pn as ControlAceEditor,dt as ControlArrayInput,on as ControlAutocomplete,Xr as ControlCheckbox,at as ControlDate,st as ControlDateTime,Ur as ControlDebouncedInput,Gr as ControlInput,nt as ControlNumberInput,ut as ControlPeriodInput,pt as ControlPhoneInput,cn as ControlQueryAutocomplete,Qr as ControlRadio,Kr as ControlSelect,tt as ControlSwitch,ct as ControlTime,dn as CopyButton,bl as CreateDefinition,ui as CreateNode,pi as CreateNodeWithContext,gl as CreatePropertiesList,fl as CreatePropertiesListContext,ul as CreatePropertyFormFields,Mr as DATE_DEFAULT_FORMAT,Fr as DATE_TIME_DEFAULT_FORMAT,Jr as DEFAULT_DATE_VALIDATION_ERROR_TEXT,rt as DEFAULT_ERROR_TEXT,Hr as DEFAULT_REQUIRED_ERROR_TEXT,ji as DefinitionFiller,wi as DefinitionValueView,mi as Dem3CreateDefinition,Vi as Dem3DefinitionFiller,Ii as Dem3DefinitionView,Bt as InfoItem,On as JsonModalView,Pi as JsonPathPicker,Cn as JsonView,$r as Loader,ia as MenuIcon,xi as MultiplePropertyFiller,Ul as NodeAdditionalFields,di as NodeForm,xl as NodeFormBuilderContext,Ol as NodeFormBuilderControl,Pr as NodeType,Zl as NodeValueField,Yl as ObjectAdditionalFields,_l as ObjectNodeProperties,Ll as ObjectNodeView,ua as OverflowTip,Zr as PopupIconComponent,Oi as PropertyFiller,Ar as PropertyType,ol as PropertyValueField,qr as RoundingMode,$t as RouteTabs,oa as Sidebar,Ft as SimpleTable,Mi as Status,Gt as StepperView,Dr as TIME_DEFAULT_FORMAT,qt as TabPanel,Rt as Table,Nt as TableAction,Pt as TableActionCell,Al as ViewNode,Ci as ViewPropertiesList,vi as ViewProperty,hn as capitalize,vn as deepParseJson,zr as defaultDefinitionArrayValue,_r as defaultDefinitionObjectValue,kn as digitsOnly,Ln as floatsOnly,Pn as formatDefinitionData,Yn as formatDefinitionNodeData,Sn as formatTableRowValue,Zn as getDemNodeDateFormat,Bn as getDemPropertyDateFormat,zn as getEntityStarterValue,bn as getJsonStringValue,Xn as getMultipleNodeFillOptions,_n as getMultiplePropertyFillOptions,Qn as getNodeType,Kn as getObjectStarterValue,et as getSingleNodeFillOptions,Hn as getSinglePropertyFillOptions,An as isDateType,In as isExpression,Dn as isPropertyValueEmpty,Jn as isValueEmpty,Wn as nodePropertiesArrayToObject,Un as nodePropertiesObjectToArray,Mn as numberFormat,qn as propertiesArrayToObject,$n as propertiesObjectToArray,mn as removeArrayItem,yn as safeParseJson,fn as sortArrayOfObjects,wn as theme,Yr as useDebounce,Wr as useToggle,gn as validateJson};