moorr-react-mui 0.3.7 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.d.ts +2 -1
  2. package/index.js +1 -1
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -569,12 +569,13 @@ declare function useGraphingFramework<TModel extends GraphingControlModel>(graph
569
569
  data: any;
570
570
  };
571
571
 
572
- declare const useGraphingForm: (formName: string, graphingSettings: any, validationSchemas: any, fetchInputSchemas: (cardTile: any, graphingSettings: any, setInputSchemas: (fieldSchemas: any) => void, setDropdownValues: (fieldSchemas: any) => void, handleCustomDropdownValues?: ((dropdownValues: any) => void) | undefined, validationSchemas?: any) => Promise<any>, enforceStrictValidation?: boolean) => {
572
+ declare const useGraphingForm: (formName: string, graphingSettings: any, validationSchemas: any, fetchInputSchemas: (cardTile: any, graphingSettings: any, setInputSchemas: (fieldSchemas: any) => void, setDropdownValues: (fieldSchemas: any) => void, handleCustomDropdownValues?: ((dropdownValues: any) => void) | undefined, validationSchemas?: any) => Promise<any>, enforceStrictValidation?: boolean, handleCustomDropdownValues?: ((dropdownValues: any) => void) | undefined) => {
573
573
  context: GraphingContextResult;
574
574
  settings: any;
575
575
  graphingTile: any;
576
576
  graphingControls: any;
577
577
  inputSchemas: any;
578
+ dropdownValues: any;
578
579
  data: any;
579
580
  setData: React$1.Dispatch<any>;
580
581
  updatingCount: number;
package/index.js CHANGED
@@ -1 +1 @@
1
- import e,{forwardRef as t,useMemo as n,useCallback as r,createContext as o,useContext as i,useState as l,useRef as a,useEffect as s,useImperativeHandle as d}from"react";import c from"@mui/material/Button";import{useMediaQuery as u,Typography as m,Slide as p,Box as h,Icon as g,IconButton as v,Button as f}from"@mui/material";import{integers as b,utils as y,dates as E,decimals as x,strings as w}from"moorr-common";import M from"@mui/material/IconButton";import C from"@material-ui/core/MenuItem";import{makeStyles as T,createStyles as k,withStyles as N,StylesProvider as O}from"@material-ui/core/styles";import S from"@material-ui/core/TextField";import{StylesProvider as P,Modal as F,Backdrop as I,Fade as D}from"@material-ui/core";import{createGenerateClassName as L,StylesProvider as U}from"@material-ui/styles";import{v4 as V}from"uuid";import j,{Responsive as R}from"react-grid-layout";import B from"@mui/material/Accordion";import A from"@mui/material/AccordionSummary";import $ from"@mui/material/AccordionDetails";import z from"@mui/icons-material/ExpandMore";import H from"react-dom";import{toast as W}from"react-toastify";import G from"@mui/icons-material/Cancel";import q from"@mui/icons-material/Close";import K from"@mui/material/Box";import _ from"@mui/material/Fade";import Y from"@mui/material/Slide";const X=({type:t,label:n})=>(t||(t="button"),e.createElement("button",{type:t,className:"moorr-button"},e.createElement("span",null,n)));function Z(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function J(e,t,n,r){return new(n||(n=Promise))((function(o,i){function l(e){try{s(r.next(e))}catch(e){i(e)}}function a(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(l,a)}s((r=r.apply(e,t||[])).next())}))}const Q=t(((t,r)=>{var{style:o={},handleClick:i,label:l,disabled:a}=t,s=Z(t,["style","handleClick","label","disabled"]);const d=u("(max-width: 600px)"),m=n((()=>d?"8rem":"172px"),[d]);return e.createElement(c,Object.assign({},s,{ref:r,disabled:a,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,style:Object.assign(Object.assign(Object.assign({},!a&&{backgroundColor:"#541868"}),{color:"#FFFFFF",fontWeight:400,fontSize:"14px",width:m,height:"39px",borderRadius:"48px",textTransform:"capitalize"}),o),onClick:i,variant:"contained"}),l)})),ee=t(((t,o)=>{var{sx:i,item:l,label:a,qty:s,disabled:d,highlight:u,onSelectItem:p}=t,h=Z(t,["sx","item","label","qty","disabled","highlight","onSelectItem"]);const g=n((()=>({width:"27px",height:"27px",color:"#FFFFFF",flexShrink:0})),[]),v=n((()=>{const e=Object.assign(Object.assign({},i),{flexGrow:1,fontFamily:"Poppins",fontSize:"14px",fontWeight:400,lineHeight:"9px",minHeight:"42px",border:"1px solid #EDEDEE",borderRadius:"10rem",textTransform:"none",gap:"0.5rem","&:hover > button":{opacity:1}});return s>0?Object.assign(Object.assign({},e),{backgroundColor:"#66e84b",borderColor:"#541868",color:"#541868","&:hover":{backgroundColor:"#66e84b",borderColor:"#541868",color:"#541868"}}):Object.assign(Object.assign({},e),{backgroundColor:"#FBFBFD",borderColor:!0===u?"#541868":"#EDEDEE",color:"#000000","&:hover":{backgroundColor:"#66e84b",borderColor:"#66e84b",color:"#ffffff"}})}),[s,i]),f=r((e=>J(void 0,void 0,void 0,(function*(){e.stopPropagation(),e.preventDefault(),y.isFunction(p)&&s<=0&&(yield Promise.all([p(l,1)]))}))),[s,p]),E=r((()=>!b.isValid(s)||s<=0?null:e.createElement(M,{disabled:d,sx:Object.assign(Object.assign({},g),{backgroundColor:"#E37D7D",opacity:0,"&:hover":{backgroundColor:"#E37D7D"},"&:active":{backgroundColor:"#E37D7D"}}),onClick:()=>p&&p(l,Math.max(0,s-1))},"-")),[d,g,s,p]),x=r((()=>!b.isValid(s)||s<=0?null:e.createElement(M,{disabled:d,sx:Object.assign(Object.assign({},g),{backgroundColor:"#541868",opacity:0,"&:hover":{backgroundColor:"#541868"},"&:active":{backgroundColor:"#541868"}}),onClick:()=>p&&p(l,s+1)},"+")),[d,g,s,p]),w=r((()=>{let t,n;return!b.isValid(s)||s<=0?(t=1,n=0):(t=`${s}`,n=1),e.createElement(m,{variant:"body1",component:"span",sx:{color:"#541868",fontWeight:700,fontSize:"14px",lineHeight:"20px",flexShrink:0,opacity:n}},t)}),[s]);return e.createElement(c,Object.assign({},h,{ref:o,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,disabled:d,sx:v,onClick:f}),E(),e.createElement(m,{variant:"body1",component:"span",sx:{flexGrow:1}},null!=a?a:l),x(),w())})),te=t(((t,r)=>{var{style:o={},handleClick:i,label:l,disabled:a}=t,s=Z(t,["style","handleClick","label","disabled"]);const d=u("(max-width: 600px)"),m=n((()=>d?"8rem":"172px"),[d]);return e.createElement(c,Object.assign({},s,{ref:r,disabled:a,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,style:Object.assign(Object.assign(Object.assign({},!a&&{backgroundColor:"#D4C5D9"}),{color:"#541868",fontWeight:400,fontSize:"14px",width:m,height:"39px",borderRadius:"48px",textTransform:"capitalize"}),o),onClick:i,variant:"contained"}),l)})),ne=t(((t,o)=>{var{sx:i,item:l,label:a,itemSelected:s,onSelectItem:d}=t,u=Z(t,["sx","item","label","itemSelected","onSelectItem"]);const p=n((()=>{const e=Object.assign(Object.assign({},i),{flexGrow:1,fontFamily:"Poppins",fontSize:"13px",fontWeight:400,lineHeight:"18px",border:"1px solid #EDEDEE",borderRadius:"10rem",textTransform:"none"});return s?Object.assign(Object.assign({},e),{backgroundColor:"#66e84b",borderColor:"#541868",color:"#541868","&:hover":{backgroundColor:"#66e84b",borderColor:"#541868",color:"#541868"}}):Object.assign(Object.assign({},e),{backgroundColor:"#fbfbfd",borderColor:"#EDEDEE",color:"#000000","&:hover":{backgroundColor:"#66e84b",borderColor:"#66e84b",color:"#ffffff"}})}),[s,i]),h=r((e=>J(void 0,void 0,void 0,(function*(){e.stopPropagation(),e.preventDefault(),y.isFunction(d)&&(yield Promise.all([d(l)]))}))),[d]);return e.createElement(c,Object.assign({},u,{ref:o,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,sx:p,onClick:h}),e.createElement(m,{variant:"body1",component:"span",sx:{flexGrow:1}},null!=a?a:l))})),re=e=>({root:{"&:hover:not($disabled):not($focused):not($error) $notchedOutline":{},"&$checked":{color:"var(--primary-color)"},"& .vldt-MuiSelect-select.vldt-MuiSelect-select":{color:"var(--grey-color-2)"}},disabled:{},focused:{},error:{},notchedOutline:{},checked:{},notchedOutlineMBRequired:{flex:3,borderColor:"blue",borderWidth:2},fieldSetMBRequired:{"& fieldset":{flex:3,borderColor:"blue",borderWidth:2}},fieldSetErrorField:{"& fieldset":{borderColor:"var(--error-color)"}},blue:{color:"blue"}});T(re);const oe=T((()=>k({root:{overflow:"hidden",display:"flex",alignItems:"center","&.start":{flexDirection:"row"},"&.top":{flexDirection:"column"},"& .Mui-disabled":{backgroundColor:"var(--grey-color-3)",cursor:"not-allowed",borderRadius:"4px"}},label:{flex:2},field:{flex:3},required:{color:"red"},menuItem:{color:"var(--grey-color-2)","&:hover":{backgroundColor:"var(--primary-color-scale-25)",color:"var(--grey-color-2)"}},menuItemSelected:{color:"var(--grey-color-2)"},mandatory:{border:"red 2px solid",borderRadius:"4px"}})));var ie=N(re)((({handleChange:t,value:n,disabled:r=!1,name:o,className:i,classes:l,size:a,menuItemLabel:s,options:d,labelPlacement:c="start",label:u,required:m=!1,isMBRequiredField:p,fullWidth:h,selectIconComponent:g})=>{const{root:v,focused:f,error:b,notchedOutline:y,notchedOutlineMBRequired:E}=l,x=oe();let w;return g&&(w={IconComponent:g}),e.createElement(S,{fullWidth:!1!==h,id:"outlined-basic",variant:"outlined",value:n,onChange:t,disabled:r,name:o,className:[i].join(" "),InputProps:{classes:{root:v,focused:f,error:b,notchedOutline:!p||n&&0!==(null==n?void 0:n.length)?!m||n&&0!==(null==n?void 0:n.length)?y:x.mandatory:E}},color:"primary",size:a||"small",select:!0,SelectProps:w,defaultValue:""},e.createElement(C,{value:"",disabled:!0},e.createElement("em",null,s)),d&&d.map(((t,n)=>"-separator-"===t?e.createElement(C,{key:`separator-${n}`,value:"",disabled:!0},e.createElement("em",null,"-----------")):e.createElement(C,{key:`menu-item-${n}-${t.value||t}`,value:t.value||t},t.label||t))))}));const le={};function ae(e,t){e&&t&&(le[e]=t)}const se=({className:t,icon:n,width:r,height:o,fill:i,stroke:l,accent:a,dropShadow:s})=>{if(y.isNullOrUndefined(n))return null;const d=le[n]||null;return d?e.createElement(d,{className:t,fill:i,width:r,height:o,stroke:l,accent:a,dropShadow:s}):null},de={};var ce=({stylePrefix:t,children:n})=>{let r;if(t)r=de[t]?de[t]:de[t]=L({seed:t});else{const e=`MoorrStylesProvider-${V()}-`;r=L({seed:e})}return e.createElement(U,{generateClassName:r,injectFirst:!0},e.createElement(P,{generateClassName:r,injectFirst:!0},e.createElement(O,{generateClassName:r},n)))};const ue=o({});function me(){return i(ue)}const pe={};function he(e,t){e&&t&&(pe[e]=t)}const ge=({graphingTile:t,graphingTileIndex:n})=>{var r;if(!(null===(r=null==t?void 0:t.tile)||void 0===r?void 0:r.tileType))return null;const o=pe[t.tile.tileType]||null;return o?e.createElement(o,{graphingTile:t,graphingTileIndex:n}):null},ve=[20,20],fe={lg:600,sm:0},be={lg:8,sm:2},ye=({tilePrefix:t,responsive:n,columns:r,containerPadding:o,referenceMargin:i,referenceWidth:d,graphingTiles:c})=>{const u=me(),[m,p]=l(null),[h,g]=l(null),[v,f]=l(null),[b,E]=l(null),x=a(null),w=()=>{const e=(null==x?void 0:x.current)?(null==x?void 0:x.current).getBoundingClientRect().width:null;E(e);const t=k(e);p(t)};let M;const C=e=>{w(),clearTimeout(M),M=setTimeout((()=>{w()}),300)};s((()=>{w()}),[x]),s((()=>(window.addEventListener("resize",C),()=>{window.removeEventListener("resize",C)})),[]),s((()=>{if(n){if(!Array.isArray(c)||0===c.length)return void f({lg:[]});const e=c.map(((e,n)=>({x:e.x,y:e.y,w:isNaN(e.w)?1:e.w,h:isNaN(e.h)?1:e.h,i:`${t?t+"_":""}tile_${n}`})));f({lg:e})}else{if(!Array.isArray(c)||0===c.length)return void g([]);g(c.map(((e,n)=>({x:e.x,y:e.y,w:isNaN(e.w)?1:e.w,h:isNaN(e.h)?1:e.h,i:`${t?t+"_":""}tile_${n}`,static:!0}))))}}),[c]);const T=()=>null==c?void 0:c.map(((n,r)=>{if(!n.tile||!n.visible)return null;if(y.isFunction(u.isTileVisible)&&n.tile.id&&!u.isTileVisible(n.tile.id))return null;let o="graphing-tile-container";n.tile.id&&(o+=` ${n.tile.id}`),!1!==n.border&&(o+=" bordered"),n.autoHeight&&(o+=" auto-height");const i=`${t?t+"_":""}tile_${r}`;return e.createElement("div",{className:o,key:i},e.createElement(ge,{graphingTile:n,graphingTileIndex:r}))})),k=e=>{if(!i||isNaN(i)||i<=0||!d||isNaN(d)||d<=0||null==e)return ve;const t=e/d*i;return[t,t]};return e.createElement("div",{ref:x,className:"graphing-tiles-container"},(()=>{if(!b||!m)return null;if(!1!==n){if(!v)return null;const t=[o||0,0];return e.createElement(R,{width:b,breakpoints:fe,cols:r||be,rowHeight:1,layouts:v,containerPadding:t,margin:m,isDraggable:!1},T())}return h?e.createElement(j,{width:b,cols:9,rowHeight:50,margin:m,isDraggable:!1,layout:h},T()):null})())},Ee={};function xe(e,t){Ee[e]=t}function we(e){const t=Ee[null==e?void 0:e.tileType];return t?new t(e):null}function Me(e){const t=[];return e.forEach((e=>{const n=we(e);n&&t.push(n)})),t}class Ce{constructor(e){this.x=e.x,this.y=e.y,this.w=e.w,this.h=e.h,this.border=!0===e.border,this.background=e.background||null,this.autoHeight=!0===e.autoHeight,this.tile=we(e.tile),this.visible=!1!==e.visible}getBackground(){return this.background||"#FFFFFF"}}class Te{constructor(e){this.title=e.title||"",this.infoIconUrl=e.infoUrl,this.infoIconHref=e.infoHref,this.responsive=!1!==e.responsive,this.columns=e.columns||{lg:8,sm:2},this.containerPadding=e.containerPadding||0,this.referenceMargin=e.referenceMargin||null,this.referenceWidth=e.referenceWidth||null,this.tiles=[],Array.isArray(e.tiles)&&e.tiles.forEach((e=>{this.tiles.push(new Ce(e))}))}}const ke={};function Ne(e,t){ke[e]=t}function Oe(e){const t=ke[null==e?void 0:e.controlType];return t?new t(e):null}function Se(e){const t=[];return e.forEach((e=>{const n=Oe(e);n&&t.push(n)})),t}class Pe{constructor(e){this.controlType=e.controlType,this.dataKey=e.dataKey}}class Fe extends Pe{constructor(e){super(e),this.inputLabel=e.inputLabel||"",this.readOnly=!0===e.readOnly,this.readOnlyBorderless=!0===e.readOnlyBorderless,this.hasAsAtDate=!1===e.hasAsAtDate||!0===e.hasAsAtDate?e.hasAsAtDate:null,this.staticAsAtDate=!0===e.staticAsAtDate,this.validationSchemaPath=(y.isArray(e.validationSchemaPath)?e.validationSchemaPath:[]).filter((e=>y.isString(e))),this.validationErrorMessages=e.validationErrorMessages||{}}}class Ie{constructor(e){this.border=e.border,this.background=e.background||null,this.control=Oe(e.control)}getBackground(e){return this.background||(null==e?void 0:e.background)||"#FFFFFF"}}class De{constructor(e){this.id=e.id||"",this.title=e.title||"",this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new Ie(e))})),this.add=!0===e.add}}class Le{constructor(e){this.id=e.id,this.tileType=e.tileType}}class Ue extends Le{constructor(e){super(e),this.control=new Ie(e.control)}}class Ve extends Le{constructor(e){super(e),this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new Ie(e))}))}}class je extends Le{constructor(e){super(e),y.isArray(e.formGroups)&&e.formGroups.length>0?this.formGroups=e.formGroups.map((e=>new De(e))):this.formGroups=[]}}xe("form-groups-tile",je);class Re extends Ve{constructor(e){super(e),this.controlsPerPage=e.controlsPerPage,(isNaN(this.controlsPerPage)||this.controlsPerPage<=1)&&(this.controlsPerPage=1)}}xe("horizontal-tile",Re);class Be extends Ve{constructor(e){super(e),this.states={};for(const t in e.states){const n=e.states[t];n&&(this.states[t]=new Te(n))}}}xe("selectable-states-tile",Be);class Ae extends Le{constructor(e){super(e),this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new Ie(e))}))}}xe("simple-form-tile",Ae);class $e extends Ue{constructor(e){super(e)}}xe("single-tile",$e);class ze extends Ve{constructor(e){super(e)}}xe("vertical-tile",ze);const He=(e,t,n)=>{s((()=>{const n=document.querySelector("#react-root");return null==n||n.addEventListener(e,t),()=>{null==n||n.removeEventListener(e,t)}}),null!=n?n:[t])},We=(e,t)=>{const n=document.querySelector("#react-root");null==n||n.dispatchEvent(new CustomEvent(e,{detail:null!=t?t:{}}))},Ge=({})=>{const{settings:t,handleUIReady:n}=me(),[o,i]=l(null),[a,d]=l([]),[c,u]=l(!1);s((()=>{setTimeout((()=>{window.dispatchEvent(new Event("resize")),setTimeout((()=>{u(!0),y.isFunction(n)&&n()}),300)}),300)}),[]);const m=r((e=>{var t,n,r,o,i,l,s,c,u,m,p;if(!(null==a?void 0:a.length)||!(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.id))return;const h=a.find((t=>{var n,r;return(null===(n=t.tile)||void 0===n?void 0:n.id)===(null===(r=null==e?void 0:e.detail)||void 0===r?void 0:r.id)}));if(!h)return;y.isNullOrUndefined(null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.x)||(h.x=null===(r=null==e?void 0:e.detail)||void 0===r?void 0:r.x),y.isNullOrUndefined(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.y)||(h.y=null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.y),y.isNullOrUndefined(null===(l=null==e?void 0:e.detail)||void 0===l?void 0:l.w)||(h.w=null===(s=null==e?void 0:e.detail)||void 0===s?void 0:s.w),y.isNullOrUndefined(null===(c=null==e?void 0:e.detail)||void 0===c?void 0:c.h)||(h.h=null===(u=null==e?void 0:e.detail)||void 0===u?void 0:u.h),y.isNullOrUndefined(null===(m=null==e?void 0:e.detail)||void 0===m?void 0:m.visible)||(h.visible=null===(p=null==e?void 0:e.detail)||void 0===p?void 0:p.visible);const g=a.map((e=>new Ce(e)));d(g)}),[a]);He("graphingGrid.updateTile",m),s((()=>{var e;t?(i(new Te(t)),d(null===(e=t.tiles)||void 0===e?void 0:e.map((e=>new Ce(e))))):i(null)}),[t]);const p=()=>(null==t?void 0:t.infoIconUrl)&&t.infoIconHref?e.createElement("a",{className:"information-anchor",href:t.infoIconHref,target:"_blank"},e.createElement("img",{alt:null==t?void 0:t.title,src:null==t?void 0:t.infoIconUrl})):null;if(!o)return null;let h="graphing-grid-container";return c&&(h+=" in"),e.createElement(e.Fragment,null,e.createElement("div",{className:h},y.isNullOrUndefined(null==t?void 0:t.title)?null:e.createElement(e.Fragment,null,e.createElement("h2",{className:"graphing-grid-title"},null==t?void 0:t.title,p()),e.createElement("hr",{className:"graphing-grid-hr"})),e.createElement(ye,{graphingTiles:a,responsive:o.responsive,columns:o.columns,containerPadding:o.containerPadding,referenceMargin:o.referenceMargin,referenceWidth:o.referenceWidth})))},qe={};function Ke(e,t){e&&t&&(qe[e]=t)}const _e=({graphingTile:t,graphingTileIndex:n,graphingTileControl:r,ControlProps:o})=>{var i;if(!(null===(i=null==r?void 0:r.control)||void 0===i?void 0:i.controlType))return null;const l=qe[r.control.controlType]||null;return l?e.createElement(l,Object.assign({graphingTile:t,graphingTileIndex:n,graphingTileControl:r},o)):null},Ye=({graphingTile:t,graphingTileIndex:n,graphingTileControls:r,ControlProps:o})=>{var i,l;let a="graphing-tile-controls-container";return(null===(i=null==t?void 0:t.tile)||void 0===i?void 0:i.tileType)&&(a+=" "+(null===(l=null==t?void 0:t.tile)||void 0===l?void 0:l.tileType)),e.createElement("div",{className:a},null==r?void 0:r.map(((r,i)=>{var l,a;if(!r.control)return null;let s="graphing-tile-control-container";(null===(l=r.control)||void 0===l?void 0:l.controlType)&&(s+=" "+(null===(a=r.control)||void 0===a?void 0:a.controlType)),!1!==r.border&&(s+=" bordered");const d=`control_${n}_${i}`;return e.createElement("div",{className:s,key:d},e.createElement(_e,{graphingTile:t,graphingTileIndex:n,graphingTileControl:r,ControlProps:o}))})))},Xe=({className:t,context:n})=>e.createElement(ue.Provider,{value:n},e.createElement("div",{className:t},e.createElement(Ge,null))),Ze=({graphingTile:t,graphingTileIndex:n})=>{const o=null==t?void 0:t.tile;if(!o)return null;const i=me();return e.createElement("div",{className:"form-groups-tile-component"},!y.isArray(o.formGroups)||o.formGroups.length<0?null:o.formGroups.map(((o,d)=>{const c=a(null),[u,m]=l("normal"),[p,h]=l("form-group-container");s((()=>{E()}),[p,u]);const[g,v]=l(0),[f,b]=l(!0);s((()=>{if(f){const e=c.current;y.isNullOrUndefined(e)?v(0):setTimeout((()=>{v(e.scrollHeight)}),10)}else v(0)}),[f]);const E=e=>{if(f){const e=c.current;y.isNullOrUndefined(e)?v(0):setTimeout((()=>{v(Math.max(e.clientHeight,e.scrollHeight))}),10)}else v(0)},x=r((()=>!0!==o.add||y.isFunction(i.formGroupHasAddMode)&&!i.formGroupHasAddMode(o.id)?null:e.createElement("button",{type:"button",className:"form-group-tile-add-button",onClick:w,disabled:"add"==u},e.createElement(se,{icon:"add-icon",stroke:"#ffffff"}))),[u,i.formGroupHasAddMode]);r((()=>"add"===u?null:e.createElement("svg",{viewBox:"0 0 11 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M5.89844 1.1626L10.4688 5.70947C10.6797 5.94385 10.6797 6.29541 10.4688 6.50635L9.92969 7.04541C9.71875 7.25635 9.36719 7.25635 9.13281 7.04541L5.5 3.43603L1.89063 7.04541C1.65625 7.25635 1.30469 7.25635 1.09375 7.04541L0.554688 6.50635C0.34375 6.29541 0.34375 5.94385 0.554688 5.70947L5.125 1.1626C5.33594 0.95166 5.6875 0.95166 5.89844 1.1626Z",fill:"#333333"}))),[u]);const w=e=>{e.stopPropagation(),m("add"),b(!0)},M=e=>J(void 0,void 0,void 0,(function*(){y.isFunction(null==i?void 0:i.handleFormGroupCancel)&&(yield Promise.all([null==i?void 0:i.handleFormGroupCancel({formGroup:o})])),m("normal")})),[C,T]=l(!1),k=e=>J(void 0,void 0,void 0,(function*(){if(y.isFunction(null==i?void 0:i.handleFormGroupSave))try{T(!0);const[e]=yield Promise.all([null==i?void 0:i.handleFormGroupSave({formGroup:o})]);if(!1===e)return}finally{T(!1)}m("normal")}));let N="form-group-container";return y.isFunction(i.isFormGroupVisible)&&(i.isFormGroupVisible(o.id)||(N+=" hidden")),N!==p&&h(N),e.createElement(B,{key:`${o.id}-{${d}}`,className:N,expanded:f,onChange:e=>{"add"!==u&&b((e=>!e))},TransitionProps:{unmountOnExit:!0}},e.createElement(A,{className:"form-group-title",expandIcon:"add"!==u?e.createElement(z,null):null},e.createElement("span",{className:"form-group-title-text"},o.title),x()),e.createElement("hr",null),e.createElement($,{className:"form-group-components"},(()=>{if("add"===u){let t;return y.isFunction(i.renderFormGroup)&&(t=i.renderFormGroup(o,"add")),e.createElement(e.Fragment,null,t,e.createElement("hr",null),e.createElement("div",{className:"form-group-add-mode-buttons"},e.createElement("button",{className:"cancel-button",disabled:C,onClick:M},"Cancel"),e.createElement("button",{className:"save-button",disabled:C,onClick:k},"Create")))}{const r=o.controls;let l,a;if(y.isFunction(i.renderFormGroup)){if(l=i.renderFormGroup(o,"normal"),!y.isNullOrUndefined(l))return l;a=i.renderFormGroup(o,"footer")}return e.createElement(e.Fragment,null,e.createElement(Ye,{graphingTile:t,graphingTileIndex:n,graphingTileControls:r,ControlProps:{onUIChange:E}}),a)}})()))})))};he("form-groups-tile",Ze);const Je=({graphingTile:t,graphingTileIndex:n})=>{const r=null==t?void 0:t.tile;if(!r)return null;const[o,i]=l(null),[a,d]=l(0),[c,u]=l(0),[m,p]=l(null),[h,g]=l(null),[v,f]=l(null),[b,y]=l([]);s((()=>{let e=[];const t=Math.ceil(r.controls.length/r.controlsPerPage);if(t>0)for(let n=0;n<t;n++){const t={pageIndex:n,controls:[]};for(let e=0;e<r.controlsPerPage;e++){const o=n*r.controlsPerPage+e;if(o>=r.controls.length)break;t.controls.push(r.controls[o])}e.push(t)}d(t),u(0),p(null),g(null),f(null),y(e)}),r.controls);const E=e=>{let t=e-1;t<0&&(t=a-1),g(t)},x=e=>{e.stopPropagation(),E(c),f(null),p(null)},w=e=>{e.stopPropagation()},M=e=>{e.stopPropagation()},C=e=>{if(e.stopPropagation(),null!==o)return;const t=c;let n=c-1;n<0&&(n=a-1),p(t),u(n),g(null),f(t);const r=setTimeout((()=>{E(n),f(null),p(null),setTimeout((function(){i(null)}),300)}),300);i(r)},T=e=>{let t=e+1;t>=a&&(t=0),f(t)},k=e=>{e.stopPropagation(),g(null),T(c),p(null)},N=e=>{e.stopPropagation()},O=e=>{e.stopPropagation()},S=e=>{if(e.stopPropagation(),null!==o)return;const t=c;let n=c+1;n>=a&&(n=0),p(t),u(n),g(t),f(null);const r=setTimeout((()=>{g(null),T(n),p(null),setTimeout((function(){i(null)}),300)}),300);i(r)},P={background:t.getBackground()};return e.createElement("div",{className:"horizontal-tile-component",style:P},e.createElement("div",{className:"horizontal-tile-pages-container"},b.map(((r,o)=>{let i="horizontal-tile-page-container";return o===c?i+=" active":o===h?i+=" navigating-from-left":o===v&&(i+=" navigating-from-right"),o===m&&(i+=" previous"),e.createElement("div",{key:`horizontal-tile-page-${o}`,className:i},e.createElement(Ye,{graphingTile:t,graphingTileIndex:n,graphingTileControls:r.controls}))})),e.createElement("div",{className:"horizontal-tile-page-container background",style:P}),a<=1?null:e.createElement(e.Fragment,null,e.createElement("button",{type:"button",className:"navigate-button navigate-left-button",onMouseEnter:x,onMouseLeave:w,onMouseDown:M,onClick:C},e.createElement("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M7.40991 10.643L2.82991 6.05298L7.40991 1.46298L5.99991 0.0529785L-8.80003e-05 6.05298L5.99991 12.053L7.40991 10.643Z",fill:"#828282"}))),e.createElement("button",{type:"button",className:"navigate-button navigate-right-button",onMouseEnter:k,onMouseLeave:N,onMouseDown:O,onClick:S},e.createElement("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M0.589843 1.46298L5.16984 6.05298L0.589844 10.643L1.99984 12.053L7.99984 6.05298L1.99984 0.0529785L0.589843 1.46298Z",fill:"#828282"}))))),a<=1?null:e.createElement("div",{className:"horizontal-tile-paginators-container"},Array.from(Array(a).keys()).map((t=>{let n="paginator-anchor";return t===c&&(n+=" active"),e.createElement("a",{key:`horizontal-tile-page-index-${t}`,className:n,onMouseEnter:e=>{e.stopPropagation(),t!==c&&(t<c?(g(t),f(null)):(g(null),f(t)),p(null))},onMouseLeave:e=>{e.stopPropagation()},onMouseDown:e=>{e.stopPropagation()},onClick:e=>{if(e.stopPropagation(),t===c)return;const n=c,r=t;p(n),u(r),n<r?g(n):f(n)}})}))))};he("horizontal-tile",Je);const Qe=({graphingTile:t})=>{const n=null==t?void 0:t.tile;if(!n)return null;const[r,o]=l(""),[i,a]=l(null),[d,c]=l([]),u=me();s((()=>{const e=Object.keys(n.states);if(c(e.map((e=>{var t;return{label:null===(t=n.states[e])||void 0===t?void 0:t.title,value:e}}))),e&&e.length>0){const t=e[0];m(t)}else o(""),a(null)}),[n.states]);const m=e=>{o(e),a(n.states[e])};return e.createElement("div",{className:"selectable-states-tile-component"},e.createElement("div",{className:"selectable-states-tile-header"},e.createElement("div",{className:"selected-state-tile-title"},e.createElement("h6",null,null==i?void 0:i.title)),e.createElement("div",{className:"selectable-states-dropdown-container"},e.createElement(ie,{options:d,label:"Select",value:r,handleChange:e=>{var t;m(null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value),(null==u?void 0:u.handleSelectableStatesTileChange)&&(null==u||u.handleSelectableStatesTileChange(e))}}))),e.createElement("div",{className:"selected-state-tile-container"},i?e.createElement(ye,{tilePrefix:r,graphingTiles:i.tiles,responsive:i.responsive,columns:i.columns,containerPadding:i.containerPadding,referenceMargin:i.referenceMargin,referenceWidth:i.referenceWidth}):null))};he("selectable-states-tile",Qe);const et=({graphingTile:t,graphingTileIndex:n})=>{const r=null==t?void 0:t.tile;if(!r)return null;const o=me(),i=e=>{y.isFunction(o.handleUIChange)&&o.handleUIChange(e)};return e.createElement("div",{className:"simple-form-tile-component"},(()=>{if(!y.isArray(r.controls)||r.controls.length<0)return null;const o=r.controls;return e.createElement(Ye,{graphingTile:t,graphingTileIndex:n,graphingTileControls:o,ControlProps:{onUIChange:i}})})())};he("simple-form-tile",et);const tt=({graphingTile:t,graphingTileIndex:n})=>{const r=null==t?void 0:t.tile;if(!r)return null;const o=[r.control],i={background:t.getBackground()};return e.createElement("div",{className:"single-tile-component",style:i},e.createElement(Ye,{graphingTile:t,graphingTileIndex:n,graphingTileControls:o}))};he("single-tile",tt);const nt=({graphingTile:t,graphingTileIndex:n})=>{const r=null==t?void 0:t.tile;if(!r)return null;const o=r.controls;return e.createElement("div",{className:"vertical-tile-component"},e.createElement(Ye,{graphingTile:t,graphingTileIndex:n,graphingTileControls:o}))};function rt(e,t){const n=me(),r=null==e?void 0:e.control,[o,i]=l(null);return s((()=>{if(!(r&&(n.data&&n.data[r.dataKey]||t)))return;const e=null!=t?t:n.data[r.dataKey];i(e)}),[r,t,n.data]),{context:n,settings:r,data:o}}he("vertical-tile",nt);const ot={};function it(e,t){ot[e]=t}function lt(e){const t=ot[e];return t?new t:null}function at(e){const t=[];return e.forEach((e=>{const n=lt(e);n&&t.push(n)})),t}const st=(e,t,n)=>!(!y.isNullOrUndefined(n)&&""!==(null==n?void 0:n.trim())&&"normal"!==n&&"hover"!==n&&(y.isNullOrUndefined(t)||""===(null==t?void 0:t.trim())))&&(!y.isNullOrUndefined(t)&&""!==(null==t?void 0:t.trim())||!y.isNullOrUndefined(e)&&"warning"!==(null==e?void 0:e.error_0)),dt=(e,t)=>{let n=!1,r=!1;return Object.entries(e).forEach((([e,t])=>{const o=null==t?void 0:t.error;n=n||st(o),r=r||!0===(null==o?void 0:o.mandatory)})),y.isFunction(t)&&t(n,r),{hasErrors:n,hasMandatoryErrors:r}},ct=(e,t)=>J(void 0,void 0,void 0,(function*(){var n;const r=(t||{})[e.key];if(!y.isArray(r))return;const o={count:0};return!0===(null===(n=null==e?void 0:e.originalEvent)||void 0===n?void 0:n.noValidate)||r.forEach(((t,n)=>{var r;const i=lt(null!==(r=null==e?void 0:e.validatorType)&&void 0!==r?r:t.type);if(y.isNullOrUndefined(i))return;e.validatorData&&(i.validatorData=e.validatorData);const l=i.validate(t,e.value);o.mandatory=!0===t.mandatory||"AsAtDate"===e.validatorType,o.errors=l,y.isArray(l)&&l.length>0&&l.forEach(((n,r)=>{o[`error_${r}`]=i.getErrorMessage(t,e.control,n),o.count+=1}))})),o})),ut=(e,t,n,r,o)=>J(void 0,void 0,void 0,(function*(){var i;if(y.isNullOrUndefined(e)||y.isNullOrUndefined(t))return{hasErrors:!1,hasMandatoryErrors:!1};let l;y.isNullOrUndefined(n)?r((e=>(l=Object.assign({},e),e))):l=Object.assign({},n);const a=[];return null===(i=null==e?void 0:e.tiles)||void 0===i||i.forEach((e=>{var n,r,o,i,s;switch(null===(n=null==e?void 0:e.tile)||void 0===n?void 0:n.tileType){case"form-groups-tile":null===(o=null===(r=null==e?void 0:e.tile)||void 0===r?void 0:r.formGroups)||void 0===o||o.forEach((e=>{var n,r;(null===(n=null==e?void 0:e.controls)||void 0===n?void 0:n.length)&&(null===(r=null==e?void 0:e.controls)||void 0===r||r.forEach((e=>{var n,r;if(!(null===(n=null==e?void 0:e.control)||void 0===n?void 0:n.dataKey)||(null==e?void 0:e.control.readOnly))return;const o=l[null===(r=null==e?void 0:e.control)||void 0===r?void 0:r.dataKey];if(o.readOnly||o.hidden)return;a.push(J(void 0,void 0,void 0,(function*(){var n,r;const i=yield ct({originalEvent:null,control:null==e?void 0:e.control,key:null===(n=null==e?void 0:e.control)||void 0===n?void 0:n.dataKey,value:null==o?void 0:o.value},t);!y.isNullOrUndefined(i)&&i.count>0&&(l[null===(r=null==e?void 0:e.control)||void 0===r?void 0:r.dataKey].error=i)})))})))}));break;case"simple-form-tile":null===(s=null===(i=null==e?void 0:e.tile)||void 0===i?void 0:i.controls)||void 0===s||s.forEach((e=>J(void 0,void 0,void 0,(function*(){var n,r;if(!(null===(n=null==e?void 0:e.control)||void 0===n?void 0:n.dataKey)||(null==e?void 0:e.control.readOnly))return;const o=l[null===(r=null==e?void 0:e.control)||void 0===r?void 0:r.dataKey];if(o.readOnly||o.hidden)return;a.push(J(void 0,void 0,void 0,(function*(){var n,r;const i=yield ct({originalEvent:null,control:null==e?void 0:e.control,key:null===(n=null==e?void 0:e.control)||void 0===n?void 0:n.dataKey,value:null==o?void 0:o.value},t);!y.isNullOrUndefined(i)&&i.count>0&&(l[null===(r=null==e?void 0:e.control)||void 0===r?void 0:r.dataKey].error=i)})))}))));break;default:return}})),yield Promise.all(a),r(l),dt(l,o)})),mt=()=>{const[e,t]=l(0),[n,o]=l({});return{updatingCount:e,updatingFlags:n,setUpdating:r((e=>{t((e=>e+1)),o((t=>Object.assign(Object.assign({},t),{[e]:!0})))}),[e,n]),unsetUpdating:r((e=>{t((e=>e-1)),o((t=>Object.assign(Object.assign({},t),{[e]:!1})))}),[e,n])}},pt=(e,t,n,o,i)=>{const a=me(),[d,c]=l(t),[u,m]=l(null),[p,h]=l(null),[g,v]=l(null),[f,b]=l(!1),y=r((()=>new Promise((t=>{if(f)return void t(f);const n={};We(`graphingForm.validateForm.${e}`,{callback:(e,r)=>{n.hasErrors=!0===(null==n?void 0:n.hasErrors)||e,n.hasMandatoryErrors=1==(null==n?void 0:n.hasMandatoryErrors)||r;const o=!n.hasErrors&&!n.hasMandatoryErrors;o||!0===i||b(!0),t(o)}})}))),[f,e]);s((()=>{if(!n)return;J(void 0,void 0,void 0,(function*(){yield o(null,t,v,(()=>{}),(()=>{}),n),c(t);const e=t.tiles[0];m(e);const r={};e.tile.controls.forEach((e=>{r[e.control.dataKey]=e})),h(r)}))}),[t,n]);const[E,x]=l(!1),[w,M]=l(!1),C=r(((e,t)=>{const n=!0===t;x(!0===e),M(n)}),[]),[T,k]=l(null),N=r((e=>J(void 0,void 0,void 0,(function*(){var n,r;if(!t||!g||!T)return{hasErrors:!1,hasMandatoryErrors:!1};const{hasErrors:o,hasMandatoryErrors:i}=yield ut(t,g,null,k,C);return(null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.callback)&&(null===(r=null==e?void 0:e.detail)||void 0===r||r.callback(o,i)),{hasErrors:o,hasMandatoryErrors:i}}))),[t,g,T,C]);He(`graphingForm.validateForm.${e}`,N);const{updatingCount:O,updatingFlags:S,setUpdating:P,unsetUpdating:F}=mt();return{context:a,settings:d,graphingTile:u,graphingControls:p,inputSchemas:g,data:T,setData:k,updatingCount:O,updatingFlags:S,setUpdating:P,unsetUpdating:F,hasErrors:E,hasMandatoryErrors:w,handleSetHasErrors:C,canSubmit:y}};class ht{constructor(){}getErrorMessage(e,t,n){if(y.isNullOrUndefined(n))return n;if(!y.isNullOrUndefined(null==t?void 0:t.validationErrorMessages)&&!y.isNullOrUndefined(t.validationErrorMessages[n])&&y.isString(t.validationErrorMessages[n])&&""!==t.validationErrorMessages[n].trim())return t.validationErrorMessages[n];switch(n){case"mandatory":return"This field is mandatory. Please ensure it is not empty or invalid";case"required":return"This field is required. Please ensure it is not empty or invalid";case"mbRequired":return"warning";case"enum":return y.isArray(null==e?void 0:e.enum)&&e.enum.length>0?`Value must be in this list: ${e.enum.filter((e=>!y.isNullOrUndefined(e)&&""!==e)).join(", ")}`:"Value must be in enum list";case"as-at-future":return"Your current value's as at date must not be in the future"}return n}validate(e,t){const n=this.validateInputValue(e,t);return!0!==(null==e?void 0:e.mbRequired)||this.validateMbRequired(e,t)||n.push("mbRequired"),n}validateInputValue(e,t){const n=[];return!0!==(null==e?void 0:e.mandatory)||this.validateMandatory(e,t)||n.push("mandatory"),!0!==(null==e?void 0:e.required)||this.validateRequired(e,t)||n.push("required"),y.isArray(null==e?void 0:e.enum)&&(null==e?void 0:e.enum.length)>0&&!this.validateEnum(null==e?void 0:e.enum,t)&&n.push("enum"),n}validateMandatory(e,t){return!y.isNullOrUndefined(t)}validateRequired(e,t){return this.validateMandatory(e,t)}validateMbRequired(e,t){return this.validateMandatory(e,t)}validateEnum(e,t){return!(y.isArray(e)&&0!==e.length&&!y.isNullOrUndefined(t))||e.includes(t)}}class gt extends ht{validateInputValue(e,t){return super.validateInputValue(e,t)}}it("Address",gt);class vt extends ht{validateInputValue(e,t){const n=super.validateInputValue(e,t);if(n.length>0)return n;if(E.isValid(t)){const e=new Date(t),r=E.todayUtc();e.getTime()>r.getTime()&&n.push("as-at-future")}return n}validateMandatory(e,t){return!!super.validateMandatory(e,t)&&E.isValid(t)}}it("AsAtDate",vt);class ft extends ht{validateInputValue(e,t){const n=super.validateInputValue(e,t);return t=x.parse(t),x.isValid(e.min)&&!this.validateMin(e.min,t)&&n.push("min"),x.isValid(e.max)&&!this.validateMax(e.max,t)&&n.push("max"),n}getErrorMessage(e,t,n){switch(n){case"min":return`Data not saved. The value must be greater than or equal to ${x.getCurrencyText(e.min,!1,e.decimalPlaces||2,"")}`;case"max":return`Data not saved. The value must be less than or equal to ${x.getCurrencyText(e.max,!1,e.decimalPlaces||2,"")}`;default:return super.getErrorMessage(e,t,n)}}validateMin(e,t){return!x.isValid(e)||!x.isValid(t)||t>=e}validateMax(e,t){return!x.isValid(e)||!x.isValid(t)||t<=e}}it("Number",ft);class bt extends ft{validateInputValue(e,t){return super.validateInputValue(e,t)}getErrorMessage(e,t,n){switch(n){case"min":return`Data not saved. The value must be greater than or equal to ${x.getCurrencyText(e.min,!1,e.decimalPlaces||2)}`;case"max":return`Data not saved. The value must be less than or equal to ${x.getCurrencyText(e.max,!1,e.decimalPlaces||2)}`;default:return super.getErrorMessage(e,t,n)}}}it("Currency",bt);class yt extends ht{getErrorMessage(e,t,n){var r,o,i,l;switch(n=super.getErrorMessage(e,t,n)){case"min":if(E.isValid(null===(r=this.validatorData)||void 0===r?void 0:r.min)){const e=E.parse(null===(o=this.validatorData)||void 0===o?void 0:o.min);return`Value cannot be before ${E.format(e,"DD/MM/yyyy")}`}break;case"max":if(E.isValid(null===(i=this.validatorData)||void 0===i?void 0:i.max)){const e=E.parse(null===(l=this.validatorData)||void 0===l?void 0:l.max);return`Value cannot be after ${E.format(e,"DD/MM/yyyy")}`}}return n}validateInputValue(e,t){var n,r,o,i;const l=super.validateInputValue(e,t);if(0===l.length&&E.isValid(t)){const e=E.parse(t);if(E.isValid(null===(n=this.validatorData)||void 0===n?void 0:n.min)){const t=E.parse(null===(r=this.validatorData)||void 0===r?void 0:r.min);(null==t?void 0:t.getTime())>(null==e?void 0:e.getTime())&&l.push("min")}if(E.isValid(null===(o=this.validatorData)||void 0===o?void 0:o.max)){const t=E.parse(null===(i=this.validatorData)||void 0===i?void 0:i.max);(null==t?void 0:t.getTime())<(null==e?void 0:e.getTime())&&l.push("max")}}return l}validateMandatory(e,t){return!!super.validateMandatory(e,t)&&E.isValid(t)}}it("Date",yt);class Et extends ht{validateInputValue(e,t){const n=super.validateInputValue(e,t);return!y.isNullOrUndefined(e.minLength)&&b.isValid(e.minLength)&&e.minLength>0&&!this.validateMinLength(e.minLength,t)&&n.push("minLength"),!y.isNullOrUndefined(e.maxLength)&&b.isValid(e.maxLength)&&e.maxLength>0&&!this.validateMaxLength(e.maxLength,t)&&n.push("maxLength"),!y.isNullOrUndefined(e.match)&&y.isString(e.match)&&e.match.length>0&&!this.validateMatch(e.match,t)&&n.push("match"),n}getErrorMessage(e,t,n){const r=super.getErrorMessage(e,t,n);switch(r){case"minLength":return`Data not saved. Minimum ${e.minLength} characters are required`;case"maxLength":return`Data not saved. Maximum ${e.maxLength} characters are allowed`;case"match":return"Data not saved. This field contains invalid characters";default:return r}}validateMinLength(e,t){return!(!(!b.isValid(e)||e<=0||y.isNullOrUndefined(t))&&y.isString(t))||t.length>=e}validateMaxLength(e,t){return!(!(!b.isValid(e)||e<=0||y.isNullOrUndefined(t))&&y.isString(t))||t.length<=e}validateMatch(e,t){if(y.isNullOrUndefined(e)||!y.isString(e)||""===e.trim())return!0;if(y.isNullOrUndefined(t)||!y.isString(t)||""===t.trim())return!0;const n=e.match(/(\/?)(.+)\1([a-z]*)/i),r=n[2],o=n[3];return new RegExp(r,o).test(t)}validateMandatory(e,t){return!!super.validateMandatory(e,t)&&(y.isString(t)&&t.length>0&&""!==t.trim())}}it("String",Et);class xt extends Et{validateInputValue(e,t){return super.validateInputValue(e,t)}}it("Notes",xt);class wt extends ht{validateInputValue(e,t){return super.validateInputValue(e,t)}}it("ObjectId",wt);class Mt extends ht{validateInputValue(e,t){return super.validateInputValue(e,t)}}it("[ObjectId]",Mt);class Ct extends ht{validateInputValue(e,t){return super.validateInputValue(e,t)}validateMandatory(e,t){var n,r,o;if(!super.validateMandatory(e,t))return!1;switch(null==t?void 0:t.ownershipType){case"Sole":return 1===(null===(n=null==t?void 0:t.owners)||void 0===n?void 0:n.length);case"Joint":return 2===(null===(r=null==t?void 0:t.owners)||void 0===r?void 0:r.length);case"Other":return(null===(o=null==t?void 0:t.owners)||void 0===o?void 0:o.length)>=1}return!1}}it("Ownership",Ct);class Tt extends ft{validateInputValue(e,t){return super.validateInputValue(e,t)}getErrorMessage(e,t,n){switch(n){case"min":return`Data not saved. The value must be greater than or equal to ${x.getCurrencyText(e.min,!1,e.decimalPlaces||2,"")}%`;case"max":return`Data not saved. The value must be less than or equal to ${x.getCurrencyText(e.max,!1,e.decimalPlaces||2,"")}%`;default:return super.getErrorMessage(e,t,n)}}}it("Percentage",Tt);class kt extends ht{validateInputValue(e,t){return super.validateInputValue(e,t)}}it("SelectBoolean",kt);class Nt extends ht{validateInputValue(e,t){return super.validateInputValue(e,t)}validateMandatory(e,t){return!!super.validateMandatory(e,t)&&(y.isString(t)&&t.length>0&&""!==t.trim()&&null!==b.parse(t))}}it("SelectNumber",Nt);class Ot extends ht{validateInputValue(e,t){return super.validateInputValue(e,t)}validateMandatory(e,t){return!y.isNullOrUndefined(t)&&""!==t.trim()&&this.validateEnum(e.enum,t)}}it("Select",Ot);const St=(e,t,n)=>{Ne(e,t),Ke(e,n)},Pt=()=>{const e=It.pop();e&&(e.classList.add("moorr-modal-container-closing"),setTimeout((()=>{e&&(H.unmountComponentAtNode(e),e.remove())}),300))};let Ft=class{constructor(e){this._props=e}open(){const t=this._props;return new Promise(((n,r)=>{let o,i;"function"==typeof t.onClose&&(o=t.onClose),t.onClose=e=>{o&&o(e),n({dismissed:!1,result:e}),t.showModal=!1,Pt()},"function"==typeof t.onDismiss&&(i=t.onClose),t.onDismiss=()=>{i&&i(),n({dismissed:!0}),t.showModal=!1,Pt()},t.showModal=!0;let l=e.createElement(ce,{stylePrefix:"MoorrReactMuiModal"},e.createElement(this.getComponent(),t));It.push(this._container=document.createElement("div")),this._container.className="moorr-modal-container",document.body.appendChild(this._container),H.render(l,this._container)}))}};const It=[],Dt={},Lt=T((e=>({modal:{display:"flex",alignItems:"center",justifyContent:"center"},paper:{width:825,backgroundColor:e.palette.background.paper,borderRadius:"5px",boxShadow:e.shadows[5],padding:e.spacing(2,4,3)}}))),Ut=t=>{const n=Lt(),r={};t.fixedWidth&&(r.width=t.fixedWidth),t.fixedHeight&&(r.height=t.fixedHeight);let o=n.paper+" moorr-modal-content-container";t.contentClassName&&(o+=" "+t.contentClassName);const[i,a]=l(!1),[d,c]=l(!1);s((()=>{c(!i&&!1!==t.showModal)}),[i,d,t.showModal]);const u=e=>{a(!0),(null==t?void 0:t.onDismiss)&&t.onDismiss(e)};let m=n.modal;switch(m+=" moorr-modal-container",t.effect){case"fade":m+=" moorr-fade-modal";break;case"slide":m+=" moorr-slide-modal"}return i&&(m+=" moorr-modal-closing"),e.createElement(F,{disableEnforceFocus:!0,className:m,open:d,onClose:u,closeAfterTransition:!0,BackdropComponent:I,BackdropProps:{timeout:300,onClick:e=>{e.preventDefault(),e.stopPropagation(),y.isFunction(t.onBackdropClick)?t.onBackdropClick(e):u("backdrop")}}},(()=>{switch(t.effect){case"fade":default:return e.createElement(D,{in:d},e.createElement("div",{className:o,style:r},t.children));case"slide":return e.createElement(p,{in:d,direction:"left",timeout:300},e.createElement("div",{className:o},t.children))}})())},Vt=(t,n)=>{(t=>{W(t,{icon:e.createElement(G,{sx:{color:"#EB5757"}}),style:{color:"#EB5757",backgroundColor:"#FCECEC",border:"2px solid #EB5757",fontFamily:'"Poppins", sans-serif',borderRadius:"0.7em",marginLeft:"-100px"},closeButton:()=>e.createElement(q,{sx:{color:"#EB5757"}})})})(n)},jt=t=>e.createElement(Ut,{effect:"fade",contentClassName:`${t.className}-content-container`,fixedWidth:t.widthValue,fixedHeight:t.heightValue,showModal:t.showModal,onClose:t.onClose,onDismiss:t.onDismiss,onBackdropClick:t.onBackdropClick},e.createElement("div",{className:`${t.className} moorr-modal-container`},e.createElement("div",{className:"moorr-modal-header"},t.renderHeader),e.createElement("div",{className:"moorr-modal-body"},t.renderBody),!1===t.hasFooter?null:e.createElement("div",{className:"moorr-modal-footer"},e.createElement("div",{className:"left-buttons"},t.renderLeftButtons),e.createElement("div",{className:"status-message"},t.renderStatusMessage),e.createElement("div",{className:"right-buttons"},t.renderRightButtons)))),Rt=t=>{const{className:n,onDismiss:o,showModal:i,onClose:l,icon:a,title:s,body:d,closeLabel:c}=t,u=r((()=>{l(!1)}),[l]);r((()=>{l(!0)}),[l]);const p=r((()=>y.isString(d)?e.createElement(m,{paragraph:!0},d):y.isArray(d)&&d.length>0?d.map(((t,n)=>{const r=`paragraph-${n}`;if(y.isString(t)||!y.isNullOrUndefined(t))return e.createElement(m,{paragraph:!0,key:r},t)})):y.isNullOrUndefined(d)?e.createElement(m,{paragraph:!0},"Please alert to continue."):d),[d]),f=r((()=>e.createElement(h,{sx:{marginBottom:"0.5rem","& > .MuiTypography-root.MuiTypography-paragraph":{fontFamily:"Poppins,sans-serif",fontSize:"14px !important",fontWeight:400,lineHeight:"20px"},"& > .MuiTypography-root.MuiTypography-paragraph .MuiTypography-root.MuiTypography-body1":{fontFamily:"inherit !important",fontSize:"inherit !important",fontWeight:"inherit",lineHeight:"inherit"},"& > .MuiTypography-root.MuiTypography-paragraph strong.MuiTypography-root.MuiTypography-body1":{fontWeight:"600 !important"}}},p())),[p]),b=r((()=>y.isString(s)||!y.isNullOrUndefined(s)?s:"Alert"),[s]),E=r((()=>e.createElement(h,{sx:{position:"relative",marginBottom:"0.5rem","& > .MuiSvgIcon-root":{color:"#541868",fontSize:"2rem"}}},null!=a?a:e.createElement(g,null),e.createElement(m,{variant:"h6",sx:{color:"#541868",fontFamily:"Poppins,sans-serif",fontSize:"16px !important",fontWeight:400,lineHeight:22}},b()),e.createElement(v,{onClick:u,sx:{position:"absolute",top:"-0.5rem",right:"-0.5rem"},"data-testid":"dismiss"},e.createElement(q,{sx:{fontSize:"1rem"}})))),[a,b,u]),x=r((()=>{const t=c||"Dismiss";return e.createElement(Q,{handleClick:u,label:t,"data-testid":`${w.toKebabCase(t)}`})}),[c,u]);return e.createElement(jt,{className:"alert-modal"+(n?" "+n:""),widthValue:"400px",showModal:!0===i,onDismiss:o,onBackdropClick:u,renderHeader:E(),renderBody:f(),renderStatusMessage:x()})};class Bt extends Ft{constructor(e){super(e)}getComponent(){return Rt}}Dt.alert=Bt;const At=t=>{const{className:n,onDismiss:o,showModal:i,onClose:l,icon:a,title:s,body:d,cancelLabel:c,confirmLabel:u}=t,p=r((()=>{l(!1)}),[l]),f=r((()=>{l(!0)}),[l]),b=r((()=>y.isString(d)?e.createElement(m,{paragraph:!0},d):y.isArray(d)&&d.length>0?d.map(((t,n)=>{const r=`paragraph-${n}`;if(y.isString(t)||!y.isNullOrUndefined(t))return e.createElement(m,{paragraph:!0,key:r},t)})):y.isNullOrUndefined(d)?e.createElement(m,{paragraph:!0},"Please confirm to continue."):d),[d]),E=r((()=>e.createElement(h,{sx:{marginBottom:"0.5rem","& > .MuiTypography-root.MuiTypography-paragraph":{fontFamily:"Poppins,sans-serif",fontSize:"14px !important",fontWeight:400,lineHeight:"20px"},"& > .MuiTypography-root.MuiTypography-paragraph .MuiTypography-root.MuiTypography-body1":{fontFamily:"inherit !important",fontSize:"inherit !important",fontWeight:"inherit",lineHeight:"inherit"},"& > .MuiTypography-root.MuiTypography-paragraph strong.MuiTypography-root.MuiTypography-body1":{fontWeight:"600 !important"}}},b())),[b]),x=r((()=>y.isString(s)||!y.isNullOrUndefined(s)?s:"Confirm"),[s]),M=r((()=>e.createElement(h,{sx:{position:"relative",marginBottom:"0.5rem","& > .MuiSvgIcon-root":{color:"#541868",fontSize:"2rem"}}},null!=a?a:e.createElement(g,null),e.createElement(m,{variant:"h6",sx:{color:"#541868",fontFamily:"Poppins,sans-serif",fontSize:"16px !important",fontWeight:400,lineHeight:22}},x()),e.createElement(v,{onClick:p,sx:{position:"absolute",top:"-0.5rem",right:"-0.5rem"}},e.createElement(q,{sx:{fontSize:"1rem"},"data-testid":"dismiss"})))),[a,x,p]),C=r((()=>{const t=c||"Cancel";return e.createElement(te,{handleClick:p,label:t,"data-testid":`${w.toKebabCase(t)}`})}),[c,p]),T=r((()=>{const t=u||"Dismiss";return e.createElement(Q,{handleClick:f,label:t,"data-testid":`${w.toKebabCase(t)}`})}),[u,f]);return e.createElement(jt,{className:"confirm-modal"+(n?" "+n:""),widthValue:"400px",showModal:!0===i,onDismiss:o,onBackdropClick:p,renderHeader:M(),renderBody:E(),renderLeftButtons:C(),renderRightButtons:T()})};class $t extends Ft{constructor(e){super(e)}getComponent(){return At}}Dt.confirm=$t;const zt=t=>{const{className:n,header:r,body:o,leftButtonLabel:i,rightButtonLabel:l,hiddenClose:a,width:s}=t,d=e=>{e.stopPropagation(),t.onDismiss()};return e.createElement(jt,{className:"opti-info-modal"+(n?" "+n:""),widthValue:null!=s?s:"554px",showModal:!0===t.showModal,onDismiss:t.onDismiss,renderBody:e.createElement(h,{sx:{display:"flex",flexDirection:"row",position:"relative"}},e.createElement(h,{sx:{position:"absolute",right:"12px",top:"12px",cursor:"pointer"}},e.createElement("svg",{onClick:t.onDismiss,width:"20",height:"20",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M16.8564 6.35381L12.2707 10.9395L16.8976 15.5664L15.5609 16.903L10.9341 12.2762L6.36889 16.8414L5.13506 15.6075L9.70023 11.0424L5.07337 6.4155L6.41002 5.07885L11.0369 9.70571L15.6226 5.11998L16.8564 6.35381Z",fill:"#541868"}))),e.createElement(h,{sx:{width:"60px",background:"#541868",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px",flexShrink:0}}),e.createElement(h,{sx:{position:"absolute",top:"11.81px",left:"12px",borderRadius:"50% 50% 0% 50%",padding:"5px",background:"white"}},e.createElement("img",{style:{height:"50px",background:"#66E84B",borderRadius:"50% 50% 0% 50%",padding:"5px"},src:"/assets/img/opti/Opti-Blinked.gif"})),e.createElement(h,{sx:{padding:"1rem 1rem 1rem 1.5rem"}},e.createElement(h,{sx:{color:"#541868",fontSize:"16px",lineHeight:"22.4px",fontWeight:400}},r),e.createElement(h,{sx:{marginTop:"1rem"}},o),e.createElement(h,{className:"opti-info-modal-buttons",sx:{textAlign:"right",marginTop:"1rem"}},i&&e.createElement(f,{className:"opti-info-modal-button-left",style:{marginRight:"5px"},variant:"contained",color:"primary",onClick:()=>{},"data-testid":`${w.toKebabCase(i)}`},i),!a&&e.createElement(Q,{label:"Close",handleClick:d,"data-testid":"close"}))))})};class Ht extends Ft{constructor(e){super(e)}getComponent(){return zt}}Dt.optiInfo=Ht;const Wt=e=>{var t,n,r,o,i;const l=null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.modal;if(!l||!Dt[l])return Promise.reject("invalid-modal");const a=new Dt[l]((null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.props)||{}).open();(null===(r=null==e?void 0:e.detail)||void 0===r?void 0:r.then)&&a.then((t=>{var n;try{null===(n=null==e?void 0:e.detail)||void 0===n||n.then(t)}catch(e){console.error(e)}})),(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.catch)&&a.catch(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.catch),a.finally((()=>{var t,n;if(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.finally)try{null===(n=null==e?void 0:e.detail)||void 0===n||n.finally()}catch(e){console.error(e)}})),(null==e?void 0:e.detail)&&((null==e?void 0:e.detail).promise=a)};document&&(document.removeEventListener("openModal",Wt),document.addEventListener("openModal",Wt));const Gt=(e,t)=>{const[n,o]=l(null),i=a(null),d=r((e=>{if(!e)return;const n=Object.assign({},e.contentRect.toJSON());b.isValid(t)&&t>0?(clearTimeout(i.current),i.current=setTimeout((()=>{o(n)}),t)):o(n)}),[t]);return s((()=>{const t=e.current;let n;return t&&(n=new ResizeObserver((([e])=>d(e))),n.observe(t)),()=>{n&&t&&(n.unobserve(t),n.disconnect())}}),[e.current]),n},qt=o({}),Kt=()=>i(qt),_t=()=>({context:Kt()}),Yt=(e,t,n)=>{var o,i;const{context:a}=_t();s((()=>{var e,t;y.mutexRelease(null!==(t=null===(e=null==a?void 0:a.sectionContext)||void 0===e?void 0:e.updateSessionId)&&void 0!==t?t:"default")}),[null===(o=null==a?void 0:a.sectionContext)||void 0===o?void 0:o.updateSessionId]);const[d,c]=l(0),u=r((()=>{c((e=>e+1))}),[]),[m,p]=l(!1),[h,g]=l(!1),v=r(((e,t)=>{const n=!0===t;p(!0===e),g(n)}),[]),f=r((n=>J(void 0,void 0,void 0,(function*(){if(y.isFunction(t)){const[e]=yield Promise.all([t(n)]);if(!e)return}return a.onMoveBack&&a.onMoveBack({section:e,data:n})}))),[h,t,a.onMoveBack]),[b,E]=l(!1),[x,w]=l(!1),[M,C]=l(null);s((()=>{x&&a.onMoveNext&&a.onMoveNext({section:e,data:M})}),[x,M]);const T=r((e=>J(void 0,void 0,void 0,(function*(){var t,r;try{E(!0),yield y.delay(350),yield y.mutex(null!==(r=null===(t=null==a?void 0:a.sectionContext)||void 0===t?void 0:t.updateSessionId)&&void 0!==r?r:"default",(()=>J(void 0,void 0,void 0,(function*(){if(yield y.delay(350),y.isFunction(n)){const[t]=yield Promise.all([n(e)]);if(!t)return}else if(m||h)return;w(!0),C(e)}))))}finally{E(!1)}}))),[null===(i=null==a?void 0:a.sectionContext)||void 0===i?void 0:i.updateSessionId,m,h,n]),{updatingCount:k,updatingFlags:N,setUpdating:O,unsetUpdating:S}=mt();return{context:a.sectionContext,sectionStep:d,nextSectionStep:u,hasErrors:m,hasMandatoryErrors:h,handleSetHasErrors:v,moveBack:f,moveNext:T,awaitingMoveNext:b,updatingCount:k,updatingFlags:N,setUpdating:O,unsetUpdating:S}},Xt=(e,t,n)=>{const[o,i]=l(t),[a,d]=l(null),[c,u]=l(null),[m,p]=l(null),[h,g]=l(!1),v=r((()=>new Promise((t=>{if(h)return void t(h);const n={};We(`wizardSection.validateForm.${e}`,{callback:(e,r)=>{n.hasErrors=!0===(null==n?void 0:n.hasErrors)||e,n.hasMandatoryErrors=1==(null==n?void 0:n.hasMandatoryErrors)||r;const o=!n.hasErrors&&!n.hasMandatoryErrors;o||g(!0),t(o)}})}))),[h,e]),{context:f,sectionStep:b,nextSectionStep:y,updatingCount:E,updatingFlags:x,setUpdating:w,unsetUpdating:M,hasErrors:C,hasMandatoryErrors:T,handleSetHasErrors:k,moveBack:N,moveNext:O,awaitingMoveNext:S}=Yt(e,void 0,v);s((()=>{if(!(null==f?void 0:f.validationSchemas))return;J(void 0,void 0,void 0,(function*(){yield n(null,t,p,(()=>{}),(()=>{}),f.validationSchemas),i(t);const e=t.tiles[0];d(e);const r={};e.tile.controls.forEach((e=>{r[e.control.dataKey]=e})),u(r)}))}),[t,null==f?void 0:f.validationSchemas]);const[P,F]=l(null),I=r((e=>J(void 0,void 0,void 0,(function*(){var n,r;if(!t||!m||!P)return{hasErrors:!1,hasMandatoryErrors:!1};const{hasErrors:o,hasMandatoryErrors:i}=yield ut(t,m,null,F,k);return(null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.callback)&&(null===(r=null==e?void 0:e.detail)||void 0===r||r.callback(o,i)),{hasErrors:o,hasMandatoryErrors:i}}))),[t,m,P,k]);return He(`wizardSection.validateForm.${e}`,I),{context:f,sectionStep:b,nextSectionStep:y,settings:o,graphingTile:a,graphingControls:c,inputSchemas:m,data:P,setData:F,updatingCount:E,updatingFlags:x,setUpdating:w,unsetUpdating:M,hasErrors:C,hasMandatoryErrors:T,handleSetHasErrors:k,moveBack:N,moveNext:O,awaitingMoveNext:S}},Zt=e=>{const[t,n]=l(e),[r,o]=l(null),[i,a]=l(null);return s((()=>{n(e);const t=e.tiles[0];o(t);const r={};t.tile.controls.forEach((e=>{r[e.control.dataKey]=e})),a(r)}),[e]),{settings:t,graphingTile:r,graphingControls:i}},Jt=t(((t,n)=>{var{stepIndex:r,sectionStep:o,onNextSectionStep:i,onStepIncrease:l,enterTimeout:a,onEntered:s,children:d}=t,c=Z(t,["stepIndex","sectionStep","onNextSectionStep","onStepIncrease","enterTimeout","onEntered","children"]);return e.createElement(_,{in:o>=r,timeout:{enter:null!=a?a:600},mountOnEnter:!0,onEntered:()=>{i&&i(),s&&s()}},e.createElement(K,Object.assign({},c,{ref:n}),d))})),Qt=t(((t,o)=>{var i,l,{section:a,children:d,animate:c,animateIn:m,animateOut:p,animateEasing:h,animateDuration:g,maxWidth:v,sx:f}=t,E=Z(t,["section","children","animate","animateIn","animateOut","animateEasing","animateDuration","maxWidth","sx"]);const x=u("(max-width: 700px)"),w=Kt();s((()=>{w.setSectionMaxWidth(null!=v?v:0)}),[v]);const M=n((()=>{var e;let t={position:"absolute",height:"100%",top:0,overflowY:"auto",overflowX:"hidden","&::-webkit-scrollbar":{width:"6px",height:"6px"},"&::-webkit-scrollbar-thumb":{backgroundColor:"#a98bb3",borderRadius:"6px"},"&::-webkit-scrollbar-thumb:hover":{backgroundColor:"rgb(118, 70, 134)"},"&::-webkit-scrollbar-track":{background:"rgba(118, 70, 134, 0.15)",borderRadius:"6px"}};if(!x&&b.isValid(v)&&v>0&&!y.isNullOrUndefined(null===(e=w.containerRect)||void 0===e?void 0:e.width)&&w.containerRect.width>v){const e=Math.floor((w.containerRect.width-v)/2);t=Object.assign(Object.assign({},t),{left:e,width:`calc(100% - ${e}px)`})}else t=Object.assign(Object.assign({},t),{left:0,width:"100%",padding:x?"0 0.75rem":"0"});return t}),[x,v,null===(i=w.containerRect)||void 0===i?void 0:i.width]),C=n((()=>{var e;let t=Object.assign(Object.assign({},f),{width:"100%"});return b.isValid(v)&&v>0&&!y.isNullOrUndefined(null===(e=w.containerRect)||void 0===e?void 0:e.width)&&w.containerRect.width>v&&(t=Object.assign(Object.assign({},t),{maxWidth:v})),t}),[f,v,null===(l=w.containerRect)||void 0===l?void 0:l.width]),T=r((()=>e.createElement(K,Object.assign({},E,{ref:o,className:`wizard-section wizard-section-${a}`,sx:M}),e.createElement(K,{sx:C},d))),[a,M,C,d,E]),k=n((()=>{var e;return null!==(e=null!=c?c:w.animate)&&void 0!==e?e:"fade"}),[w.animate,c]),N=n((()=>({enter:!1!==m?null!=g?g:300:0,exit:!1!==p?null!=g?g:300:0})),[m,p,g]),O=n((()=>null!=h?h:"ease-in-out"),[]),S=r((()=>e.createElement(_,{easing:O,timeout:N,in:w.section===a,mountOnEnter:!0,unmountOnExit:!0,onEnter:e=>{e.style.opacity="0"},onEntering:e=>{e.style.opacity="1"},onEntered:e=>{e.style.opacity="",e.style.transition="",w.setSectionMaxWidth(null!=v?v:0)}},T())),[O,N,w.section,a,T]),P=n((()=>{switch(k){case"scroll-up":return"back"!==w.moveDirection?w.section===a?"up":"down":w.section===a?"down":"up";case"scroll-down":return"back"!==w.moveDirection?w.section===a?"down":"up":w.section===a?"up":"down";case"scroll-left":return"back"!==w.moveDirection?w.section===a?"left":"right":w.section===a?"right":"left";case"scroll-right":return"back"!==w.moveDirection?w.section===a?"right":"left":w.section===a?"left":"right"}}),[w.section,w.moveDirection,a,k]),F=r((()=>e.createElement(Y,{container:w.containerRef.current,direction:P,easing:O,timeout:N,in:w.section===a,mountOnEnter:!0,unmountOnExit:!0,onEnter:e=>{var t,n,r,o;switch(P){case"up":e.style.transform=e.style.webkitTransform=`translateY(${null===(t=w.containerRect)||void 0===t?void 0:t.height}px)`;break;case"down":e.style.transform=e.style.webkitTransform=`translateY(-${null===(n=w.containerRect)||void 0===n?void 0:n.height}px)`;break;case"left":e.style.transform=e.style.webkitTransform=`translateX(${null===(r=w.containerRect)||void 0===r?void 0:r.width}px)`;break;case"right":e.style.transform=e.style.webkitTransform=`translateX(-${null===(o=w.containerRect)||void 0===o?void 0:o.height}px)`}},onEntering:e=>{switch(P){case"up":case"down":e.style.transform=e.style.webkitTransform="translateY(0)";break;case"left":case"right":e.style.transform=e.style.webkitTransform="translateX(0)"}},onEntered:e=>{e.style.transform="",e.style.webkitTransform="",e.style.transition="",w.setSectionMaxWidth(null!=v?v:0)}},T())),[O,N,w.section,a,P,w.containerRect,T]),I=r((()=>{switch(k){case"fade":return S();case"scroll-up":case"scroll-down":case"scroll-left":case"scroll-right":return F()}return w.section!==a?null:T()}),[w.section,a,k,S,F,T]);return e.createElement(e.Fragment,null,I())})),en=t((({children:t,initialSection:o,animate:i,avatar:c,isAvatarVisible:u,sx:m,onMoveBack:p,onMoveNext:h,onSectionChange:g,sectionContext:v},f)=>{const E=a(null),x=Gt(E),[w,M]=l(o);s((()=>{o&&g&&g(o)}),[o]);const[C,T]=l(null),[k,N]=l(),O=a(null),S=Gt(O),P=r(((e,t)=>{e!==w&&(M(e),T(null!=t?t:null),g&&g(e))}),[w,g]),F=n((()=>({containerRef:E,containerRect:x,section:w,moveDirection:C,onMoveBack:p,onMoveNext:h,changeSection:P,setSectionMaxWidth:N,animate:i,sectionContext:v})),[x,w,C,p,h,P,i,v]);d(f,(()=>({section:w,context:F})),[w,F]);const I=n((()=>{if(y.isNullOrUndefined(x))return null;if(y.isNullOrUndefined(c)||y.isNullOrUndefined(S))return null;let e={display:"inline-block",position:"absolute"};return e=y.isFunction(u)&&!u(w)?Object.assign(Object.assign({},e),{opacity:0}):Object.assign(Object.assign({},e),{opacity:1}),b.isValid(k)&&k>0&&(e=Object.assign(Object.assign({},e),{left:Math.floor((x.width-k)/2)-S.width})),e}),[x,c,u,S,k]),D=r((()=>y.isNullOrUndefined(k)||0===k||y.isNullOrUndefined(I)?null:c),[k,c,I]);return e.createElement(K,{ref:E,sx:Object.assign({position:"relative"},m)},e.createElement(qt.Provider,{value:F},e.createElement(K,{ref:O,sx:I},D()),t))}));export{gt as AddressValidator,Bt as AlertModal,vt as AsAtDateValidator,X as Button,$t as ConfirmModal,bt as CurrencyValidator,yt as DateValidator,ie as Dropdown,jt as FadeModal,De as FormGroupModel,Ze as FormGroupsTile,je as FormGroupsTileModel,Fe as FormInputModel,ue as GraphingContext,_e as GraphingControl,Pe as GraphingControlModel,Ie as GraphingControlSettingsModel,Ge as GraphingGrid,Xe as GraphingPage,Te as GraphingSettingsModel,ge as GraphingTile,Ye as GraphingTileControls,Le as GraphingTileModel,Ce as GraphingTileSettingsModel,ye as GraphingTiles,Je as HorizontalTile,Re as HorizontalTileModel,Ft as Modal,Ut as MoorrModal,Ve as MultipleControlsTileModel,xt as NotesValidator,ft as NumberValidator,wt as ObjectIdValidator,Mt as ObjectIdsValidator,Ht as OptiInfoModal,Ct as OwnershipValidator,Tt as PercentageValidator,Q as PrimaryButton,ee as QtyButton,te as SecondaryButton,kt as SelectBooleanValidator,ne as SelectButton,Nt as SelectNumberValidator,Ot as SelectValidator,Qe as SelectableStatesTile,Be as SelectableStatesTileModel,et as SimpleFormTile,Ae as SimpleFormTileModel,Ue as SingleControlTileModel,tt as SingleTile,$e as SingleTileModel,Et as StringValidator,ce as StylesProvider,se as SvgIcon,ht as Validator,nt as VerticalTile,ze as VerticalTileModel,en as Wizard,Qt as WizardSection,Jt as WizardSectionStep,dt as checkDataForErrors,Oe as createGraphingControl,Se as createGraphingControls,we as createGraphingTile,Me as createGraphingTiles,lt as createValidator,at as createValidators,We as dispatchRootEvent,st as hasInputError,Dt as modals,It as modalsStack,Ne as registerGraphingControl,Ke as registerGraphingControlComponent,St as registerGraphingFrameworkComponent,xe as registerGraphingTile,he as registerGraphingTileComponent,ae as registerSvgIconComponent,it as registerValidator,Vt as toastMessage,me as useGraphingContext,pt as useGraphingForm,rt as useGraphingFramework,Gt as useResizeObserver,He as useRootEventListener,mt as useUpdateTracker,_t as useWizard,Kt as useWizardContext,Zt as useWizardForm,Xt as useWizardFormSection,Yt as useWizardSection,ut as validateData,ct as validateInput};
1
+ import e,{forwardRef as t,useMemo as n,useCallback as r,createContext as o,useContext as i,useState as l,useRef as a,useEffect as s,useImperativeHandle as d}from"react";import c from"@mui/material/Button";import{useMediaQuery as u,Typography as m,Slide as p,Box as h,Icon as g,IconButton as v,Button as f}from"@mui/material";import{integers as b,utils as y,dates as E,decimals as x,strings as w}from"moorr-common";import M from"@mui/material/IconButton";import C from"@material-ui/core/MenuItem";import{makeStyles as T,createStyles as k,withStyles as N,StylesProvider as O}from"@material-ui/core/styles";import S from"@material-ui/core/TextField";import{StylesProvider as P,Modal as F,Backdrop as I,Fade as D}from"@material-ui/core";import{createGenerateClassName as L,StylesProvider as V}from"@material-ui/styles";import{v4 as U}from"uuid";import B,{Responsive as j}from"react-grid-layout";import R from"@mui/material/Accordion";import A from"@mui/material/AccordionSummary";import $ from"@mui/material/AccordionDetails";import z from"@mui/icons-material/ExpandMore";import H from"react-dom";import{toast as W}from"react-toastify";import G from"@mui/icons-material/Cancel";import q from"@mui/icons-material/Close";import K from"@mui/icons-material/CheckCircle";import _ from"@mui/material/Box";import Y from"@mui/material/Fade";import X from"@mui/material/Slide";const Z=({type:t,label:n})=>(t||(t="button"),e.createElement("button",{type:t,className:"moorr-button"},e.createElement("span",null,n)));function J(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function Q(e,t,n,r){return new(n||(n=Promise))((function(o,i){function l(e){try{s(r.next(e))}catch(e){i(e)}}function a(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(l,a)}s((r=r.apply(e,t||[])).next())}))}const ee=t(((t,r)=>{var{style:o={},handleClick:i,label:l,disabled:a}=t,s=J(t,["style","handleClick","label","disabled"]);const d=u("(max-width: 600px)"),m=n((()=>d?"8rem":"172px"),[d]);return e.createElement(c,Object.assign({},s,{ref:r,disabled:a,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,style:Object.assign(Object.assign(Object.assign({},!a&&{backgroundColor:"#541868"}),{color:"#FFFFFF",fontWeight:400,fontSize:"14px",width:m,height:"39px",borderRadius:"48px",textTransform:"capitalize"}),o),onClick:i,variant:"contained"}),l)})),te=t(((t,o)=>{var{sx:i,item:l,label:a,qty:s,disabled:d,highlight:u,onSelectItem:p}=t,h=J(t,["sx","item","label","qty","disabled","highlight","onSelectItem"]);const g=n((()=>({width:"27px",height:"27px",color:"#FFFFFF",flexShrink:0})),[]),v=n((()=>{const e=Object.assign(Object.assign({},i),{flexGrow:1,fontFamily:"Poppins",fontSize:"14px",fontWeight:400,lineHeight:"9px",minHeight:"42px",border:"1px solid #EDEDEE",borderRadius:"10rem",textTransform:"none",gap:"0.5rem","&:hover > button":{opacity:1}});return s>0?Object.assign(Object.assign({},e),{backgroundColor:"#66e84b",borderColor:"#541868",color:"#541868","&:hover":{backgroundColor:"#66e84b",borderColor:"#541868",color:"#541868"}}):Object.assign(Object.assign({},e),{backgroundColor:"#FBFBFD",borderColor:!0===u?"#541868":"#EDEDEE",color:"#000000","&:hover":{backgroundColor:"#66e84b",borderColor:"#66e84b",color:"#ffffff"}})}),[s,i]),f=r((e=>Q(void 0,void 0,void 0,(function*(){e.stopPropagation(),e.preventDefault(),y.isFunction(p)&&s<=0&&(yield Promise.all([p(l,1)]))}))),[s,p]),E=r((()=>!b.isValid(s)||s<=0?null:e.createElement(M,{disabled:d,sx:Object.assign(Object.assign({},g),{backgroundColor:"#E37D7D",opacity:0,"&:hover":{backgroundColor:"#E37D7D"},"&:active":{backgroundColor:"#E37D7D"}}),onClick:()=>p&&p(l,Math.max(0,s-1))},"-")),[d,g,s,p]),x=r((()=>!b.isValid(s)||s<=0?null:e.createElement(M,{disabled:d,sx:Object.assign(Object.assign({},g),{backgroundColor:"#541868",opacity:0,"&:hover":{backgroundColor:"#541868"},"&:active":{backgroundColor:"#541868"}}),onClick:()=>p&&p(l,s+1)},"+")),[d,g,s,p]),w=r((()=>{let t,n;return!b.isValid(s)||s<=0?(t=1,n=0):(t=`${s}`,n=1),e.createElement(m,{variant:"body1",component:"span",sx:{color:"#541868",fontWeight:700,fontSize:"14px",lineHeight:"20px",flexShrink:0,opacity:n}},t)}),[s]);return e.createElement(c,Object.assign({},h,{ref:o,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,disabled:d,sx:v,onClick:f}),E(),e.createElement(m,{variant:"body1",component:"span",sx:{flexGrow:1}},null!=a?a:l),x(),w())})),ne=t(((t,r)=>{var{style:o={},handleClick:i,label:l,disabled:a}=t,s=J(t,["style","handleClick","label","disabled"]);const d=u("(max-width: 600px)"),m=n((()=>d?"8rem":"172px"),[d]);return e.createElement(c,Object.assign({},s,{ref:r,disabled:a,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,style:Object.assign(Object.assign(Object.assign({},!a&&{backgroundColor:"#D4C5D9"}),{color:"#541868",fontWeight:400,fontSize:"14px",width:m,height:"39px",borderRadius:"48px",textTransform:"capitalize"}),o),onClick:i,variant:"contained"}),l)})),re=t(((t,o)=>{var{sx:i,item:l,label:a,itemSelected:s,onSelectItem:d}=t,u=J(t,["sx","item","label","itemSelected","onSelectItem"]);const p=n((()=>{const e=Object.assign(Object.assign({},i),{flexGrow:1,fontFamily:"Poppins",fontSize:"13px",fontWeight:400,lineHeight:"18px",border:"1px solid #EDEDEE",borderRadius:"10rem",textTransform:"none"});return s?Object.assign(Object.assign({},e),{backgroundColor:"#66e84b",borderColor:"#541868",color:"#541868","&:hover":{backgroundColor:"#66e84b",borderColor:"#541868",color:"#541868"}}):Object.assign(Object.assign({},e),{backgroundColor:"#fbfbfd",borderColor:"#EDEDEE",color:"#000000","&:hover":{backgroundColor:"#66e84b",borderColor:"#66e84b",color:"#ffffff"}})}),[s,i]),h=r((e=>Q(void 0,void 0,void 0,(function*(){e.stopPropagation(),e.preventDefault(),y.isFunction(d)&&(yield Promise.all([d(l)]))}))),[d]);return e.createElement(c,Object.assign({},u,{ref:o,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,sx:p,onClick:h}),e.createElement(m,{variant:"body1",component:"span",sx:{flexGrow:1}},null!=a?a:l))})),oe=e=>({root:{"&:hover:not($disabled):not($focused):not($error) $notchedOutline":{},"&$checked":{color:"var(--primary-color)"},"& .vldt-MuiSelect-select.vldt-MuiSelect-select":{color:"var(--grey-color-2)"}},disabled:{},focused:{},error:{},notchedOutline:{},checked:{},notchedOutlineMBRequired:{flex:3,borderColor:"blue",borderWidth:2},fieldSetMBRequired:{"& fieldset":{flex:3,borderColor:"blue",borderWidth:2}},fieldSetErrorField:{"& fieldset":{borderColor:"var(--error-color)"}},blue:{color:"blue"}});T(oe);const ie=T((()=>k({root:{overflow:"hidden",display:"flex",alignItems:"center","&.start":{flexDirection:"row"},"&.top":{flexDirection:"column"},"& .Mui-disabled":{backgroundColor:"var(--grey-color-3)",cursor:"not-allowed",borderRadius:"4px"}},label:{flex:2},field:{flex:3},required:{color:"red"},menuItem:{color:"var(--grey-color-2)","&:hover":{backgroundColor:"var(--primary-color-scale-25)",color:"var(--grey-color-2)"}},menuItemSelected:{color:"var(--grey-color-2)"},mandatory:{border:"red 2px solid",borderRadius:"4px"}})));var le=N(oe)((({handleChange:t,value:n,disabled:r=!1,name:o,className:i,classes:l,size:a,menuItemLabel:s,options:d,labelPlacement:c="start",label:u,required:m=!1,isMBRequiredField:p,fullWidth:h,selectIconComponent:g})=>{const{root:v,focused:f,error:b,notchedOutline:y,notchedOutlineMBRequired:E}=l,x=ie();let w;return g&&(w={IconComponent:g}),e.createElement(S,{fullWidth:!1!==h,id:"outlined-basic",variant:"outlined",value:n,onChange:t,disabled:r,name:o,className:[i].join(" "),InputProps:{classes:{root:v,focused:f,error:b,notchedOutline:!p||n&&0!==(null==n?void 0:n.length)?!m||n&&0!==(null==n?void 0:n.length)?y:x.mandatory:E}},color:"primary",size:a||"small",select:!0,SelectProps:w,defaultValue:""},e.createElement(C,{value:"",disabled:!0},e.createElement("em",null,s)),d&&d.map(((t,n)=>"-separator-"===t?e.createElement(C,{key:`separator-${n}`,value:"",disabled:!0},e.createElement("em",null,"-----------")):e.createElement(C,{key:`menu-item-${n}-${t.value||t}`,value:t.value||t},t.label||t))))}));const ae={};function se(e,t){e&&t&&(ae[e]=t)}const de=({className:t,icon:n,width:r,height:o,fill:i,stroke:l,accent:a,dropShadow:s})=>{if(y.isNullOrUndefined(n))return null;const d=ae[n]||null;return d?e.createElement(d,{className:t,fill:i,width:r,height:o,stroke:l,accent:a,dropShadow:s}):null},ce={};var ue=({stylePrefix:t,children:n})=>{let r;if(t)r=ce[t]?ce[t]:ce[t]=L({seed:t});else{const e=`MoorrStylesProvider-${U()}-`;r=L({seed:e})}return e.createElement(V,{generateClassName:r,injectFirst:!0},e.createElement(P,{generateClassName:r,injectFirst:!0},e.createElement(O,{generateClassName:r},n)))};const me=o({});function pe(){return i(me)}const he={};function ge(e,t){e&&t&&(he[e]=t)}const ve=({graphingTile:t,graphingTileIndex:n})=>{var r;if(!(null===(r=null==t?void 0:t.tile)||void 0===r?void 0:r.tileType))return null;const o=he[t.tile.tileType]||null;return o?e.createElement(o,{graphingTile:t,graphingTileIndex:n}):null},fe=[20,20],be={lg:600,sm:0},ye={lg:8,sm:2},Ee=({tilePrefix:t,responsive:n,columns:r,containerPadding:o,referenceMargin:i,referenceWidth:d,graphingTiles:c})=>{const u=pe(),[m,p]=l(null),[h,g]=l(null),[v,f]=l(null),[b,E]=l(null),x=a(null),w=()=>{const e=(null==x?void 0:x.current)?(null==x?void 0:x.current).getBoundingClientRect().width:null;E(e);const t=k(e);p(t)};let M;const C=e=>{w(),clearTimeout(M),M=setTimeout((()=>{w()}),300)};s((()=>{w()}),[x]),s((()=>(window.addEventListener("resize",C),()=>{window.removeEventListener("resize",C)})),[]),s((()=>{if(n){if(!Array.isArray(c)||0===c.length)return void f({lg:[]});const e=c.map(((e,n)=>({x:e.x,y:e.y,w:isNaN(e.w)?1:e.w,h:isNaN(e.h)?1:e.h,i:`${t?t+"_":""}tile_${n}`})));f({lg:e})}else{if(!Array.isArray(c)||0===c.length)return void g([]);g(c.map(((e,n)=>({x:e.x,y:e.y,w:isNaN(e.w)?1:e.w,h:isNaN(e.h)?1:e.h,i:`${t?t+"_":""}tile_${n}`,static:!0}))))}}),[c]);const T=()=>null==c?void 0:c.map(((n,r)=>{if(!n.tile||!n.visible)return null;if(y.isFunction(u.isTileVisible)&&n.tile.id&&!u.isTileVisible(n.tile.id))return null;let o="graphing-tile-container";n.tile.id&&(o+=` ${n.tile.id}`),!1!==n.border&&(o+=" bordered"),n.autoHeight&&(o+=" auto-height");const i=`${t?t+"_":""}tile_${r}`;return e.createElement("div",{className:o,key:i},e.createElement(ve,{graphingTile:n,graphingTileIndex:r}))})),k=e=>{if(!i||isNaN(i)||i<=0||!d||isNaN(d)||d<=0||null==e)return fe;const t=e/d*i;return[t,t]};return e.createElement("div",{ref:x,className:"graphing-tiles-container"},(()=>{if(!b||!m)return null;if(!1!==n){if(!v)return null;const t=[o||0,0];return e.createElement(j,{width:b,breakpoints:be,cols:r||ye,rowHeight:1,layouts:v,containerPadding:t,margin:m,isDraggable:!1},T())}return h?e.createElement(B,{width:b,cols:9,rowHeight:50,margin:m,isDraggable:!1,layout:h},T()):null})())},xe={};function we(e,t){xe[e]=t}function Me(e){const t=xe[null==e?void 0:e.tileType];return t?new t(e):null}function Ce(e){const t=[];return e.forEach((e=>{const n=Me(e);n&&t.push(n)})),t}class Te{constructor(e){this.x=e.x,this.y=e.y,this.w=e.w,this.h=e.h,this.border=!0===e.border,this.background=e.background||null,this.autoHeight=!0===e.autoHeight,this.tile=Me(e.tile),this.visible=!1!==e.visible}getBackground(){return this.background||"#FFFFFF"}}class ke{constructor(e){this.title=e.title||"",this.infoIconUrl=e.infoUrl,this.infoIconHref=e.infoHref,this.responsive=!1!==e.responsive,this.columns=e.columns||{lg:8,sm:2},this.containerPadding=e.containerPadding||0,this.referenceMargin=e.referenceMargin||null,this.referenceWidth=e.referenceWidth||null,this.tiles=[],Array.isArray(e.tiles)&&e.tiles.forEach((e=>{this.tiles.push(new Te(e))}))}}const Ne={};function Oe(e,t){Ne[e]=t}function Se(e){const t=Ne[null==e?void 0:e.controlType];return t?new t(e):null}function Pe(e){const t=[];return e.forEach((e=>{const n=Se(e);n&&t.push(n)})),t}class Fe{constructor(e){this.controlType=e.controlType,this.dataKey=e.dataKey}}class Ie extends Fe{constructor(e){super(e),this.inputLabel=e.inputLabel||"",this.readOnly=!0===e.readOnly,this.readOnlyBorderless=!0===e.readOnlyBorderless,this.hasAsAtDate=!1===e.hasAsAtDate||!0===e.hasAsAtDate?e.hasAsAtDate:null,this.staticAsAtDate=!0===e.staticAsAtDate,this.validationSchemaPath=(y.isArray(e.validationSchemaPath)?e.validationSchemaPath:[]).filter((e=>y.isString(e))),this.validationErrorMessages=e.validationErrorMessages||{}}}class De{constructor(e){this.border=e.border,this.background=e.background||null,this.control=Se(e.control)}getBackground(e){return this.background||(null==e?void 0:e.background)||"#FFFFFF"}}class Le{constructor(e){this.id=e.id||"",this.title=e.title||"",this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new De(e))})),this.add=!0===e.add}}class Ve{constructor(e){this.id=e.id,this.tileType=e.tileType}}class Ue extends Ve{constructor(e){super(e),this.control=new De(e.control)}}class Be extends Ve{constructor(e){super(e),this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new De(e))}))}}class je extends Ve{constructor(e){super(e),y.isArray(e.formGroups)&&e.formGroups.length>0?this.formGroups=e.formGroups.map((e=>new Le(e))):this.formGroups=[]}}we("form-groups-tile",je);class Re extends Be{constructor(e){super(e),this.controlsPerPage=e.controlsPerPage,(isNaN(this.controlsPerPage)||this.controlsPerPage<=1)&&(this.controlsPerPage=1)}}we("horizontal-tile",Re);class Ae extends Be{constructor(e){super(e),this.states={};for(const t in e.states){const n=e.states[t];n&&(this.states[t]=new ke(n))}}}we("selectable-states-tile",Ae);class $e extends Ve{constructor(e){super(e),this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new De(e))}))}}we("simple-form-tile",$e);class ze extends Ue{constructor(e){super(e)}}we("single-tile",ze);class He extends Be{constructor(e){super(e)}}we("vertical-tile",He);const We=(e,t,n)=>{s((()=>{const n=document.querySelector("#react-root");return null==n||n.addEventListener(e,t),()=>{null==n||n.removeEventListener(e,t)}}),null!=n?n:[t])},Ge=(e,t)=>{const n=document.querySelector("#react-root");null==n||n.dispatchEvent(new CustomEvent(e,{detail:null!=t?t:{}}))},qe=({})=>{const{settings:t,handleUIReady:n}=pe(),[o,i]=l(null),[a,d]=l([]),[c,u]=l(!1);s((()=>{setTimeout((()=>{window.dispatchEvent(new Event("resize")),setTimeout((()=>{u(!0),y.isFunction(n)&&n()}),300)}),300)}),[]);const m=r((e=>{var t,n,r,o,i,l,s,c,u,m,p;if(!(null==a?void 0:a.length)||!(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.id))return;const h=a.find((t=>{var n,r;return(null===(n=t.tile)||void 0===n?void 0:n.id)===(null===(r=null==e?void 0:e.detail)||void 0===r?void 0:r.id)}));if(!h)return;y.isNullOrUndefined(null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.x)||(h.x=null===(r=null==e?void 0:e.detail)||void 0===r?void 0:r.x),y.isNullOrUndefined(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.y)||(h.y=null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.y),y.isNullOrUndefined(null===(l=null==e?void 0:e.detail)||void 0===l?void 0:l.w)||(h.w=null===(s=null==e?void 0:e.detail)||void 0===s?void 0:s.w),y.isNullOrUndefined(null===(c=null==e?void 0:e.detail)||void 0===c?void 0:c.h)||(h.h=null===(u=null==e?void 0:e.detail)||void 0===u?void 0:u.h),y.isNullOrUndefined(null===(m=null==e?void 0:e.detail)||void 0===m?void 0:m.visible)||(h.visible=null===(p=null==e?void 0:e.detail)||void 0===p?void 0:p.visible);const g=a.map((e=>new Te(e)));d(g)}),[a]);We("graphingGrid.updateTile",m),s((()=>{var e;t?(i(new ke(t)),d(null===(e=t.tiles)||void 0===e?void 0:e.map((e=>new Te(e))))):i(null)}),[t]);const p=()=>(null==t?void 0:t.infoIconUrl)&&t.infoIconHref?e.createElement("a",{className:"information-anchor",href:t.infoIconHref,target:"_blank"},e.createElement("img",{alt:null==t?void 0:t.title,src:null==t?void 0:t.infoIconUrl})):null;if(!o)return null;let h="graphing-grid-container";return c&&(h+=" in"),e.createElement(e.Fragment,null,e.createElement("div",{className:h},y.isNullOrUndefined(null==t?void 0:t.title)?null:e.createElement(e.Fragment,null,e.createElement("h2",{className:"graphing-grid-title"},null==t?void 0:t.title,p()),e.createElement("hr",{className:"graphing-grid-hr"})),e.createElement(Ee,{graphingTiles:a,responsive:o.responsive,columns:o.columns,containerPadding:o.containerPadding,referenceMargin:o.referenceMargin,referenceWidth:o.referenceWidth})))},Ke={};function _e(e,t){e&&t&&(Ke[e]=t)}const Ye=({graphingTile:t,graphingTileIndex:n,graphingTileControl:r,ControlProps:o})=>{var i;if(!(null===(i=null==r?void 0:r.control)||void 0===i?void 0:i.controlType))return null;const l=Ke[r.control.controlType]||null;return l?e.createElement(l,Object.assign({graphingTile:t,graphingTileIndex:n,graphingTileControl:r},o)):null},Xe=({graphingTile:t,graphingTileIndex:n,graphingTileControls:r,ControlProps:o})=>{var i,l;let a="graphing-tile-controls-container";return(null===(i=null==t?void 0:t.tile)||void 0===i?void 0:i.tileType)&&(a+=" "+(null===(l=null==t?void 0:t.tile)||void 0===l?void 0:l.tileType)),e.createElement("div",{className:a},null==r?void 0:r.map(((r,i)=>{var l,a;if(!r.control)return null;let s="graphing-tile-control-container";(null===(l=r.control)||void 0===l?void 0:l.controlType)&&(s+=" "+(null===(a=r.control)||void 0===a?void 0:a.controlType)),!1!==r.border&&(s+=" bordered");const d=`control_${n}_${i}`;return e.createElement("div",{className:s,key:d},e.createElement(Ye,{graphingTile:t,graphingTileIndex:n,graphingTileControl:r,ControlProps:o}))})))},Ze=({className:t,context:n})=>e.createElement(me.Provider,{value:n},e.createElement("div",{className:t},e.createElement(qe,null))),Je=({graphingTile:t,graphingTileIndex:n})=>{const o=null==t?void 0:t.tile;if(!o)return null;const i=pe();return e.createElement("div",{className:"form-groups-tile-component"},!y.isArray(o.formGroups)||o.formGroups.length<0?null:o.formGroups.map(((o,d)=>{const c=a(null),[u,m]=l("normal"),[p,h]=l("form-group-container");s((()=>{E()}),[p,u]);const[g,v]=l(0),[f,b]=l(!0);s((()=>{if(f){const e=c.current;y.isNullOrUndefined(e)?v(0):setTimeout((()=>{v(e.scrollHeight)}),10)}else v(0)}),[f]);const E=e=>{if(f){const e=c.current;y.isNullOrUndefined(e)?v(0):setTimeout((()=>{v(Math.max(e.clientHeight,e.scrollHeight))}),10)}else v(0)},x=r((()=>!0!==o.add||y.isFunction(i.formGroupHasAddMode)&&!i.formGroupHasAddMode(o.id)?null:e.createElement("button",{type:"button",className:"form-group-tile-add-button",onClick:w,disabled:"add"==u},e.createElement(de,{icon:"add-icon",stroke:"#ffffff"}))),[u,i.formGroupHasAddMode]);r((()=>"add"===u?null:e.createElement("svg",{viewBox:"0 0 11 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M5.89844 1.1626L10.4688 5.70947C10.6797 5.94385 10.6797 6.29541 10.4688 6.50635L9.92969 7.04541C9.71875 7.25635 9.36719 7.25635 9.13281 7.04541L5.5 3.43603L1.89063 7.04541C1.65625 7.25635 1.30469 7.25635 1.09375 7.04541L0.554688 6.50635C0.34375 6.29541 0.34375 5.94385 0.554688 5.70947L5.125 1.1626C5.33594 0.95166 5.6875 0.95166 5.89844 1.1626Z",fill:"#333333"}))),[u]);const w=e=>{e.stopPropagation(),m("add"),b(!0)},M=e=>Q(void 0,void 0,void 0,(function*(){y.isFunction(null==i?void 0:i.handleFormGroupCancel)&&(yield Promise.all([null==i?void 0:i.handleFormGroupCancel({formGroup:o})])),m("normal")})),[C,T]=l(!1),k=e=>Q(void 0,void 0,void 0,(function*(){if(y.isFunction(null==i?void 0:i.handleFormGroupSave))try{T(!0);const[e]=yield Promise.all([null==i?void 0:i.handleFormGroupSave({formGroup:o})]);if(!1===e)return}finally{T(!1)}m("normal")}));let N="form-group-container";return y.isFunction(i.isFormGroupVisible)&&(i.isFormGroupVisible(o.id)||(N+=" hidden")),N!==p&&h(N),e.createElement(R,{key:`${o.id}-{${d}}`,className:N,expanded:f,onChange:e=>{"add"!==u&&b((e=>!e))},TransitionProps:{unmountOnExit:!0}},e.createElement(A,{className:"form-group-title",expandIcon:"add"!==u?e.createElement(z,null):null},e.createElement("span",{className:"form-group-title-text"},o.title),x()),e.createElement("hr",null),e.createElement($,{className:"form-group-components"},(()=>{if("add"===u){let t;return y.isFunction(i.renderFormGroup)&&(t=i.renderFormGroup(o,"add")),e.createElement(e.Fragment,null,t,e.createElement("hr",null),e.createElement("div",{className:"form-group-add-mode-buttons"},e.createElement("button",{className:"cancel-button",disabled:C,onClick:M},"Cancel"),e.createElement("button",{className:"save-button",disabled:C,onClick:k},"Create")))}{const r=o.controls;let l,a;if(y.isFunction(i.renderFormGroup)){if(l=i.renderFormGroup(o,"normal"),!y.isNullOrUndefined(l))return l;a=i.renderFormGroup(o,"footer")}return e.createElement(e.Fragment,null,e.createElement(Xe,{graphingTile:t,graphingTileIndex:n,graphingTileControls:r,ControlProps:{onUIChange:E}}),a)}})()))})))};ge("form-groups-tile",Je);const Qe=({graphingTile:t,graphingTileIndex:n})=>{const r=null==t?void 0:t.tile;if(!r)return null;const[o,i]=l(null),[a,d]=l(0),[c,u]=l(0),[m,p]=l(null),[h,g]=l(null),[v,f]=l(null),[b,y]=l([]);s((()=>{let e=[];const t=Math.ceil(r.controls.length/r.controlsPerPage);if(t>0)for(let n=0;n<t;n++){const t={pageIndex:n,controls:[]};for(let e=0;e<r.controlsPerPage;e++){const o=n*r.controlsPerPage+e;if(o>=r.controls.length)break;t.controls.push(r.controls[o])}e.push(t)}d(t),u(0),p(null),g(null),f(null),y(e)}),r.controls);const E=e=>{let t=e-1;t<0&&(t=a-1),g(t)},x=e=>{e.stopPropagation(),E(c),f(null),p(null)},w=e=>{e.stopPropagation()},M=e=>{e.stopPropagation()},C=e=>{if(e.stopPropagation(),null!==o)return;const t=c;let n=c-1;n<0&&(n=a-1),p(t),u(n),g(null),f(t);const r=setTimeout((()=>{E(n),f(null),p(null),setTimeout((function(){i(null)}),300)}),300);i(r)},T=e=>{let t=e+1;t>=a&&(t=0),f(t)},k=e=>{e.stopPropagation(),g(null),T(c),p(null)},N=e=>{e.stopPropagation()},O=e=>{e.stopPropagation()},S=e=>{if(e.stopPropagation(),null!==o)return;const t=c;let n=c+1;n>=a&&(n=0),p(t),u(n),g(t),f(null);const r=setTimeout((()=>{g(null),T(n),p(null),setTimeout((function(){i(null)}),300)}),300);i(r)},P={background:t.getBackground()};return e.createElement("div",{className:"horizontal-tile-component",style:P},e.createElement("div",{className:"horizontal-tile-pages-container"},b.map(((r,o)=>{let i="horizontal-tile-page-container";return o===c?i+=" active":o===h?i+=" navigating-from-left":o===v&&(i+=" navigating-from-right"),o===m&&(i+=" previous"),e.createElement("div",{key:`horizontal-tile-page-${o}`,className:i},e.createElement(Xe,{graphingTile:t,graphingTileIndex:n,graphingTileControls:r.controls}))})),e.createElement("div",{className:"horizontal-tile-page-container background",style:P}),a<=1?null:e.createElement(e.Fragment,null,e.createElement("button",{type:"button",className:"navigate-button navigate-left-button",onMouseEnter:x,onMouseLeave:w,onMouseDown:M,onClick:C},e.createElement("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M7.40991 10.643L2.82991 6.05298L7.40991 1.46298L5.99991 0.0529785L-8.80003e-05 6.05298L5.99991 12.053L7.40991 10.643Z",fill:"#828282"}))),e.createElement("button",{type:"button",className:"navigate-button navigate-right-button",onMouseEnter:k,onMouseLeave:N,onMouseDown:O,onClick:S},e.createElement("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M0.589843 1.46298L5.16984 6.05298L0.589844 10.643L1.99984 12.053L7.99984 6.05298L1.99984 0.0529785L0.589843 1.46298Z",fill:"#828282"}))))),a<=1?null:e.createElement("div",{className:"horizontal-tile-paginators-container"},Array.from(Array(a).keys()).map((t=>{let n="paginator-anchor";return t===c&&(n+=" active"),e.createElement("a",{key:`horizontal-tile-page-index-${t}`,className:n,onMouseEnter:e=>{e.stopPropagation(),t!==c&&(t<c?(g(t),f(null)):(g(null),f(t)),p(null))},onMouseLeave:e=>{e.stopPropagation()},onMouseDown:e=>{e.stopPropagation()},onClick:e=>{if(e.stopPropagation(),t===c)return;const n=c,r=t;p(n),u(r),n<r?g(n):f(n)}})}))))};ge("horizontal-tile",Qe);const et=({graphingTile:t})=>{const n=null==t?void 0:t.tile;if(!n)return null;const[r,o]=l(""),[i,a]=l(null),[d,c]=l([]),u=pe();s((()=>{const e=Object.keys(n.states);if(c(e.map((e=>{var t;return{label:null===(t=n.states[e])||void 0===t?void 0:t.title,value:e}}))),e&&e.length>0){const t=e[0];m(t)}else o(""),a(null)}),[n.states]);const m=e=>{o(e),a(n.states[e])};return e.createElement("div",{className:"selectable-states-tile-component"},e.createElement("div",{className:"selectable-states-tile-header"},e.createElement("div",{className:"selected-state-tile-title"},e.createElement("h6",null,null==i?void 0:i.title)),e.createElement("div",{className:"selectable-states-dropdown-container"},e.createElement(le,{options:d,label:"Select",value:r,handleChange:e=>{var t;m(null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value),(null==u?void 0:u.handleSelectableStatesTileChange)&&(null==u||u.handleSelectableStatesTileChange(e))}}))),e.createElement("div",{className:"selected-state-tile-container"},i?e.createElement(Ee,{tilePrefix:r,graphingTiles:i.tiles,responsive:i.responsive,columns:i.columns,containerPadding:i.containerPadding,referenceMargin:i.referenceMargin,referenceWidth:i.referenceWidth}):null))};ge("selectable-states-tile",et);const tt=({graphingTile:t,graphingTileIndex:n})=>{const r=null==t?void 0:t.tile;if(!r)return null;const o=pe(),i=e=>{y.isFunction(o.handleUIChange)&&o.handleUIChange(e)};return e.createElement("div",{className:"simple-form-tile-component"},(()=>{if(!y.isArray(r.controls)||r.controls.length<0)return null;const o=r.controls;return e.createElement(Xe,{graphingTile:t,graphingTileIndex:n,graphingTileControls:o,ControlProps:{onUIChange:i}})})())};ge("simple-form-tile",tt);const nt=({graphingTile:t,graphingTileIndex:n})=>{const r=null==t?void 0:t.tile;if(!r)return null;const o=[r.control],i={background:t.getBackground()};return e.createElement("div",{className:"single-tile-component",style:i},e.createElement(Xe,{graphingTile:t,graphingTileIndex:n,graphingTileControls:o}))};ge("single-tile",nt);const rt=({graphingTile:t,graphingTileIndex:n})=>{const r=null==t?void 0:t.tile;if(!r)return null;const o=r.controls;return e.createElement("div",{className:"vertical-tile-component"},e.createElement(Xe,{graphingTile:t,graphingTileIndex:n,graphingTileControls:o}))};function ot(e,t){const n=pe(),r=null==e?void 0:e.control,[o,i]=l(null);return s((()=>{if(!(r&&(n.data&&n.data[r.dataKey]||t)))return;const e=null!=t?t:n.data[r.dataKey];i(e)}),[r,t,n.data]),{context:n,settings:r,data:o}}ge("vertical-tile",rt);const it={};function lt(e,t){it[e]=t}function at(e){const t=it[e];return t?new t:null}function st(e){const t=[];return e.forEach((e=>{const n=at(e);n&&t.push(n)})),t}const dt=(e,t,n)=>!(!y.isNullOrUndefined(n)&&""!==(null==n?void 0:n.trim())&&"normal"!==n&&"hover"!==n&&(y.isNullOrUndefined(t)||""===(null==t?void 0:t.trim())))&&(!y.isNullOrUndefined(t)&&""!==(null==t?void 0:t.trim())||!y.isNullOrUndefined(e)&&"warning"!==(null==e?void 0:e.error_0)),ct=(e,t)=>{let n=!1,r=!1;return Object.entries(e).forEach((([e,t])=>{const o=null==t?void 0:t.error;n=n||dt(o),r=r||!0===(null==o?void 0:o.mandatory)})),y.isFunction(t)&&t(n,r),{hasErrors:n,hasMandatoryErrors:r}},ut=(e,t)=>Q(void 0,void 0,void 0,(function*(){var n;const r=(t||{})[e.key];if(!y.isArray(r))return;const o={count:0};return!0===(null===(n=null==e?void 0:e.originalEvent)||void 0===n?void 0:n.noValidate)||r.forEach(((t,n)=>{var r;const i=at(null!==(r=null==e?void 0:e.validatorType)&&void 0!==r?r:t.type);if(y.isNullOrUndefined(i))return;e.validatorData&&(i.validatorData=e.validatorData);const l=i.validate(t,e.value);o.mandatory=!0===t.mandatory||"AsAtDate"===e.validatorType,o.errors=l,y.isArray(l)&&l.length>0&&l.forEach(((n,r)=>{o[`error_${r}`]=i.getErrorMessage(t,e.control,n),o.count+=1}))})),o})),mt=(e,t,n,r,o)=>Q(void 0,void 0,void 0,(function*(){var i;if(y.isNullOrUndefined(e)||y.isNullOrUndefined(t))return{hasErrors:!1,hasMandatoryErrors:!1};let l;y.isNullOrUndefined(n)?r((e=>(l=Object.assign({},e),e))):l=Object.assign({},n);const a=[];return null===(i=null==e?void 0:e.tiles)||void 0===i||i.forEach((e=>{var n,r,o,i,s;switch(null===(n=null==e?void 0:e.tile)||void 0===n?void 0:n.tileType){case"form-groups-tile":null===(o=null===(r=null==e?void 0:e.tile)||void 0===r?void 0:r.formGroups)||void 0===o||o.forEach((e=>{var n,r;(null===(n=null==e?void 0:e.controls)||void 0===n?void 0:n.length)&&(null===(r=null==e?void 0:e.controls)||void 0===r||r.forEach((e=>{var n,r;if(!(null===(n=null==e?void 0:e.control)||void 0===n?void 0:n.dataKey)||(null==e?void 0:e.control.readOnly))return;const o=l[null===(r=null==e?void 0:e.control)||void 0===r?void 0:r.dataKey];if(o.readOnly||o.hidden)return;a.push(Q(void 0,void 0,void 0,(function*(){var n,r;const i=yield ut({originalEvent:null,control:null==e?void 0:e.control,key:null===(n=null==e?void 0:e.control)||void 0===n?void 0:n.dataKey,value:null==o?void 0:o.value},t);!y.isNullOrUndefined(i)&&i.count>0&&(l[null===(r=null==e?void 0:e.control)||void 0===r?void 0:r.dataKey].error=i)})))})))}));break;case"simple-form-tile":null===(s=null===(i=null==e?void 0:e.tile)||void 0===i?void 0:i.controls)||void 0===s||s.forEach((e=>Q(void 0,void 0,void 0,(function*(){var n,r;if(!(null===(n=null==e?void 0:e.control)||void 0===n?void 0:n.dataKey)||(null==e?void 0:e.control.readOnly))return;const o=l[null===(r=null==e?void 0:e.control)||void 0===r?void 0:r.dataKey];if(o.readOnly||o.hidden)return;a.push(Q(void 0,void 0,void 0,(function*(){var n,r;const i=yield ut({originalEvent:null,control:null==e?void 0:e.control,key:null===(n=null==e?void 0:e.control)||void 0===n?void 0:n.dataKey,value:null==o?void 0:o.value},t);!y.isNullOrUndefined(i)&&i.count>0&&(l[null===(r=null==e?void 0:e.control)||void 0===r?void 0:r.dataKey].error=i)})))}))));break;default:return}})),yield Promise.all(a),r(l),ct(l,o)})),pt=()=>{const[e,t]=l(0),[n,o]=l({});return{updatingCount:e,updatingFlags:n,setUpdating:r((e=>{t((e=>e+1)),o((t=>Object.assign(Object.assign({},t),{[e]:!0})))}),[e,n]),unsetUpdating:r((e=>{t((e=>e-1)),o((t=>Object.assign(Object.assign({},t),{[e]:!1})))}),[e,n])}},ht=(e,t,n,o,i,a)=>{const d=pe(),[c,u]=l(t),[m,p]=l(null),[h,g]=l(null),[v,f]=l(null),[b,y]=l(null),[E,x]=l(!1),w=r((()=>new Promise((t=>{if(E)return void t(E);const n={};Ge(`graphingForm.validateForm.${e}`,{callback:(e,r)=>{n.hasErrors=!0===(null==n?void 0:n.hasErrors)||e,n.hasMandatoryErrors=1==(null==n?void 0:n.hasMandatoryErrors)||r;const o=!n.hasErrors&&!n.hasMandatoryErrors;o||!0===i||x(!0),t(o)}})}))),[E,e]);s((()=>{if(!n)return;Q(void 0,void 0,void 0,(function*(){yield o(null,t,f,y,null!=a?a:()=>{},n),u(t);const e=t.tiles[0];p(e);const r={};e.tile.controls.forEach((e=>{r[e.control.dataKey]=e})),g(r)}))}),[t,n]);const[M,C]=l(!1),[T,k]=l(!1),N=r(((e,t)=>{const n=!0===t;C(!0===e),k(n)}),[]),[O,S]=l(null),P=r((e=>Q(void 0,void 0,void 0,(function*(){var n,r;if(!t||!v||!O)return{hasErrors:!1,hasMandatoryErrors:!1};const{hasErrors:o,hasMandatoryErrors:i}=yield mt(t,v,null,S,N);return(null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.callback)&&(null===(r=null==e?void 0:e.detail)||void 0===r||r.callback(o,i)),{hasErrors:o,hasMandatoryErrors:i}}))),[t,v,O,N]);We(`graphingForm.validateForm.${e}`,P);const{updatingCount:F,updatingFlags:I,setUpdating:D,unsetUpdating:L}=pt();return{context:d,settings:c,graphingTile:m,graphingControls:h,inputSchemas:v,dropdownValues:b,data:O,setData:S,updatingCount:F,updatingFlags:I,setUpdating:D,unsetUpdating:L,hasErrors:M,hasMandatoryErrors:T,handleSetHasErrors:N,canSubmit:w}};class gt{constructor(){}getErrorMessage(e,t,n){if(y.isNullOrUndefined(n))return n;if(!y.isNullOrUndefined(null==t?void 0:t.validationErrorMessages)&&!y.isNullOrUndefined(t.validationErrorMessages[n])&&y.isString(t.validationErrorMessages[n])&&""!==t.validationErrorMessages[n].trim())return t.validationErrorMessages[n];switch(n){case"mandatory":return"This field is mandatory. Please ensure it is not empty or invalid";case"required":return"This field is required. Please ensure it is not empty or invalid";case"mbRequired":return"warning";case"enum":return y.isArray(null==e?void 0:e.enum)&&e.enum.length>0?`Value must be in this list: ${e.enum.filter((e=>!y.isNullOrUndefined(e)&&""!==e)).join(", ")}`:"Value must be in enum list";case"as-at-future":return"Your current value's as at date must not be in the future"}return n}validate(e,t){const n=this.validateInputValue(e,t);return!0!==(null==e?void 0:e.mbRequired)||this.validateMbRequired(e,t)||n.push("mbRequired"),n}validateInputValue(e,t){const n=[];return!0!==(null==e?void 0:e.mandatory)||this.validateMandatory(e,t)||n.push("mandatory"),!0!==(null==e?void 0:e.required)||this.validateRequired(e,t)||n.push("required"),y.isArray(null==e?void 0:e.enum)&&(null==e?void 0:e.enum.length)>0&&!this.validateEnum(null==e?void 0:e.enum,t)&&n.push("enum"),n}validateMandatory(e,t){return!y.isNullOrUndefined(t)}validateRequired(e,t){return this.validateMandatory(e,t)}validateMbRequired(e,t){return this.validateMandatory(e,t)}validateEnum(e,t){return!(y.isArray(e)&&0!==e.length&&!y.isNullOrUndefined(t))||e.includes(t)}}class vt extends gt{validateInputValue(e,t){return super.validateInputValue(e,t)}}lt("Address",vt);class ft extends gt{validateInputValue(e,t){const n=super.validateInputValue(e,t);if(n.length>0)return n;if(E.isValid(t)){const e=new Date(t),r=E.todayUtc();e.getTime()>r.getTime()&&n.push("as-at-future")}return n}validateMandatory(e,t){return!!super.validateMandatory(e,t)&&E.isValid(t)}}lt("AsAtDate",ft);class bt extends gt{validateInputValue(e,t){const n=super.validateInputValue(e,t);return t=x.parse(t),x.isValid(e.min)&&!this.validateMin(e.min,t)&&n.push("min"),x.isValid(e.max)&&!this.validateMax(e.max,t)&&n.push("max"),n}getErrorMessage(e,t,n){switch(n){case"min":return`Data not saved. The value must be greater than or equal to ${x.getCurrencyText(e.min,!1,e.decimalPlaces||2,"")}`;case"max":return`Data not saved. The value must be less than or equal to ${x.getCurrencyText(e.max,!1,e.decimalPlaces||2,"")}`;default:return super.getErrorMessage(e,t,n)}}validateMin(e,t){return!x.isValid(e)||!x.isValid(t)||t>=e}validateMax(e,t){return!x.isValid(e)||!x.isValid(t)||t<=e}}lt("Number",bt);class yt extends bt{validateInputValue(e,t){return super.validateInputValue(e,t)}getErrorMessage(e,t,n){switch(n){case"min":return`Data not saved. The value must be greater than or equal to ${x.getCurrencyText(e.min,!1,e.decimalPlaces||2)}`;case"max":return`Data not saved. The value must be less than or equal to ${x.getCurrencyText(e.max,!1,e.decimalPlaces||2)}`;default:return super.getErrorMessage(e,t,n)}}}lt("Currency",yt);class Et extends gt{getErrorMessage(e,t,n){var r,o,i,l;switch(n=super.getErrorMessage(e,t,n)){case"min":if(E.isValid(null===(r=this.validatorData)||void 0===r?void 0:r.min)){const e=E.parse(null===(o=this.validatorData)||void 0===o?void 0:o.min);return`Value cannot be before ${E.format(e,"DD/MM/yyyy")}`}break;case"max":if(E.isValid(null===(i=this.validatorData)||void 0===i?void 0:i.max)){const e=E.parse(null===(l=this.validatorData)||void 0===l?void 0:l.max);return`Value cannot be after ${E.format(e,"DD/MM/yyyy")}`}}return n}validateInputValue(e,t){var n,r,o,i;const l=super.validateInputValue(e,t);if(0===l.length&&E.isValid(t)){const e=E.parse(t);if(E.isValid(null===(n=this.validatorData)||void 0===n?void 0:n.min)){const t=E.parse(null===(r=this.validatorData)||void 0===r?void 0:r.min);(null==t?void 0:t.getTime())>(null==e?void 0:e.getTime())&&l.push("min")}if(E.isValid(null===(o=this.validatorData)||void 0===o?void 0:o.max)){const t=E.parse(null===(i=this.validatorData)||void 0===i?void 0:i.max);(null==t?void 0:t.getTime())<(null==e?void 0:e.getTime())&&l.push("max")}}return l}validateMandatory(e,t){return!!super.validateMandatory(e,t)&&E.isValid(t)}}lt("Date",Et);class xt extends gt{validateInputValue(e,t){const n=super.validateInputValue(e,t);return!y.isNullOrUndefined(e.minLength)&&b.isValid(e.minLength)&&e.minLength>0&&!this.validateMinLength(e.minLength,t)&&n.push("minLength"),!y.isNullOrUndefined(e.maxLength)&&b.isValid(e.maxLength)&&e.maxLength>0&&!this.validateMaxLength(e.maxLength,t)&&n.push("maxLength"),!y.isNullOrUndefined(e.match)&&y.isString(e.match)&&e.match.length>0&&!this.validateMatch(e.match,t)&&n.push("match"),n}getErrorMessage(e,t,n){const r=super.getErrorMessage(e,t,n);switch(r){case"minLength":return`Data not saved. Minimum ${e.minLength} characters are required`;case"maxLength":return`Data not saved. Maximum ${e.maxLength} characters are allowed`;case"match":return"Data not saved. This field contains invalid characters";default:return r}}validateMinLength(e,t){return!(!(!b.isValid(e)||e<=0||y.isNullOrUndefined(t))&&y.isString(t))||t.length>=e}validateMaxLength(e,t){return!(!(!b.isValid(e)||e<=0||y.isNullOrUndefined(t))&&y.isString(t))||t.length<=e}validateMatch(e,t){if(y.isNullOrUndefined(e)||!y.isString(e)||""===e.trim())return!0;if(y.isNullOrUndefined(t)||!y.isString(t)||""===t.trim())return!0;const n=e.match(/(\/?)(.+)\1([a-z]*)/i),r=n[2],o=n[3];return new RegExp(r,o).test(t)}validateMandatory(e,t){return!!super.validateMandatory(e,t)&&(y.isString(t)&&t.length>0&&""!==t.trim())}}lt("String",xt);class wt extends xt{validateInputValue(e,t){return super.validateInputValue(e,t)}}lt("Notes",wt);class Mt extends gt{validateInputValue(e,t){return super.validateInputValue(e,t)}}lt("ObjectId",Mt);class Ct extends gt{validateInputValue(e,t){return super.validateInputValue(e,t)}}lt("[ObjectId]",Ct);class Tt extends gt{validateInputValue(e,t){return super.validateInputValue(e,t)}validateMandatory(e,t){var n,r,o;if(!super.validateMandatory(e,t))return!1;switch(null==t?void 0:t.ownershipType){case"Sole":return 1===(null===(n=null==t?void 0:t.owners)||void 0===n?void 0:n.length);case"Joint":return 2===(null===(r=null==t?void 0:t.owners)||void 0===r?void 0:r.length);case"Other":return(null===(o=null==t?void 0:t.owners)||void 0===o?void 0:o.length)>=1}return!1}}lt("Ownership",Tt);class kt extends bt{validateInputValue(e,t){return super.validateInputValue(e,t)}getErrorMessage(e,t,n){switch(n){case"min":return`Data not saved. The value must be greater than or equal to ${x.getCurrencyText(e.min,!1,e.decimalPlaces||2,"")}%`;case"max":return`Data not saved. The value must be less than or equal to ${x.getCurrencyText(e.max,!1,e.decimalPlaces||2,"")}%`;default:return super.getErrorMessage(e,t,n)}}}lt("Percentage",kt);class Nt extends gt{validateInputValue(e,t){return super.validateInputValue(e,t)}}lt("SelectBoolean",Nt);class Ot extends gt{validateInputValue(e,t){return super.validateInputValue(e,t)}validateMandatory(e,t){return!!super.validateMandatory(e,t)&&(y.isString(t)&&t.length>0&&""!==t.trim()&&null!==b.parse(t))}}lt("SelectNumber",Ot);class St extends gt{validateInputValue(e,t){return super.validateInputValue(e,t)}validateMandatory(e,t){return!y.isNullOrUndefined(t)&&""!==t.trim()&&this.validateEnum(e.enum,t)}}lt("Select",St);const Pt=(e,t,n)=>{Oe(e,t),_e(e,n)},Ft=()=>{const e=Dt.pop();e&&(e.classList.add("moorr-modal-container-closing"),setTimeout((()=>{e&&(H.unmountComponentAtNode(e),e.remove())}),300))};let It=class{constructor(e){this._props=e}open(){const t=this._props;return new Promise(((n,r)=>{let o,i;"function"==typeof t.onClose&&(o=t.onClose),t.onClose=e=>{o&&o(e),n({dismissed:!1,result:e}),t.showModal=!1,Ft()},"function"==typeof t.onDismiss&&(i=t.onClose),t.onDismiss=()=>{i&&i(),n({dismissed:!0}),t.showModal=!1,Ft()},t.showModal=!0;let l=e.createElement(ue,{stylePrefix:"MoorrReactMuiModal"},e.createElement(this.getComponent(),t));Dt.push(this._container=document.createElement("div")),this._container.className="moorr-modal-container",document.body.appendChild(this._container),H.render(l,this._container)}))}};const Dt=[],Lt={},Vt=T((e=>({modal:{display:"flex",alignItems:"center",justifyContent:"center"},paper:{width:825,backgroundColor:e.palette.background.paper,borderRadius:"5px",boxShadow:e.shadows[5],padding:e.spacing(2,4,3)}}))),Ut=t=>{const n=Vt(),r={};t.fixedWidth&&(r.width=t.fixedWidth),t.fixedHeight&&(r.height=t.fixedHeight);let o=n.paper+" moorr-modal-content-container";t.contentClassName&&(o+=" "+t.contentClassName);const[i,a]=l(!1),[d,c]=l(!1);s((()=>{c(!i&&!1!==t.showModal)}),[i,d,t.showModal]);const u=e=>{a(!0),(null==t?void 0:t.onDismiss)&&t.onDismiss(e)};let m=n.modal;switch(m+=" moorr-modal-container",t.effect){case"fade":m+=" moorr-fade-modal";break;case"slide":m+=" moorr-slide-modal"}return i&&(m+=" moorr-modal-closing"),e.createElement(F,{disableEnforceFocus:!0,className:m,open:d,onClose:u,closeAfterTransition:!0,BackdropComponent:I,BackdropProps:{timeout:300,onClick:e=>{e.preventDefault(),e.stopPropagation(),y.isFunction(t.onBackdropClick)?t.onBackdropClick(e):u("backdrop")}}},(()=>{switch(t.effect){case"fade":default:return e.createElement(D,{in:d},e.createElement("div",{className:o,style:r},t.children));case"slide":return e.createElement(p,{in:d,direction:"left",timeout:300},e.createElement("div",{className:o},t.children))}})())},Bt=(t,n)=>{switch(t){default:case"info":case"warning":case"error":(t=>{W(t,{icon:e.createElement(G,{sx:{color:"#EB5757"}}),style:{color:"#EB5757",backgroundColor:"#FCECEC",border:"2px solid #EB5757",fontFamily:'"Poppins", sans-serif',borderRadius:"0.7em",marginLeft:"-100px"},closeButton:()=>e.createElement(q,{sx:{color:"#EB5757"}})})})(n);break;case"success":(t=>{W(t,{icon:e.createElement(K,{sx:{color:"#1B5E20"}}),style:{color:"#1B5E20",backgroundColor:"#E8F5E9",border:"2px solid #1B5E20",fontFamily:'"Poppins", sans-serif',borderRadius:"0.7em",marginLeft:"-100px"},closeButton:()=>e.createElement(q,{sx:{color:"#1B5E20"}})})})(n)}},jt=t=>e.createElement(Ut,{effect:"fade",contentClassName:`${t.className}-content-container`,fixedWidth:t.widthValue,fixedHeight:t.heightValue,showModal:t.showModal,onClose:t.onClose,onDismiss:t.onDismiss,onBackdropClick:t.onBackdropClick},e.createElement("div",{className:`${t.className} moorr-modal-container`},e.createElement("div",{className:"moorr-modal-header"},t.renderHeader),e.createElement("div",{className:"moorr-modal-body"},t.renderBody),!1===t.hasFooter?null:e.createElement("div",{className:"moorr-modal-footer"},e.createElement("div",{className:"left-buttons"},t.renderLeftButtons),e.createElement("div",{className:"status-message"},t.renderStatusMessage),e.createElement("div",{className:"right-buttons"},t.renderRightButtons)))),Rt=t=>{const{className:n,onDismiss:o,showModal:i,onClose:l,icon:a,title:s,body:d,closeLabel:c}=t,u=r((()=>{l(!1)}),[l]);r((()=>{l(!0)}),[l]);const p=r((()=>y.isString(d)?e.createElement(m,{paragraph:!0},d):y.isArray(d)&&d.length>0?d.map(((t,n)=>{const r=`paragraph-${n}`;if(y.isString(t)||!y.isNullOrUndefined(t))return e.createElement(m,{paragraph:!0,key:r},t)})):y.isNullOrUndefined(d)?e.createElement(m,{paragraph:!0},"Please alert to continue."):d),[d]),f=r((()=>e.createElement(h,{sx:{marginBottom:"0.5rem","& > .MuiTypography-root.MuiTypography-paragraph":{fontFamily:"Poppins,sans-serif",fontSize:"14px !important",fontWeight:400,lineHeight:"20px"},"& > .MuiTypography-root.MuiTypography-paragraph .MuiTypography-root.MuiTypography-body1":{fontFamily:"inherit !important",fontSize:"inherit !important",fontWeight:"inherit",lineHeight:"inherit"},"& > .MuiTypography-root.MuiTypography-paragraph strong.MuiTypography-root.MuiTypography-body1":{fontWeight:"600 !important"}}},p())),[p]),b=r((()=>y.isString(s)||!y.isNullOrUndefined(s)?s:"Alert"),[s]),E=r((()=>e.createElement(h,{sx:{position:"relative",marginBottom:"0.5rem","& > .MuiSvgIcon-root":{color:"#541868",fontSize:"2rem"}}},null!=a?a:e.createElement(g,null),e.createElement(m,{variant:"h6",sx:{color:"#541868",fontFamily:"Poppins,sans-serif",fontSize:"16px !important",fontWeight:400,lineHeight:22}},b()),e.createElement(v,{onClick:u,sx:{position:"absolute",top:"-0.5rem",right:"-0.5rem"},"data-testid":"dismiss"},e.createElement(q,{sx:{fontSize:"1rem"}})))),[a,b,u]),x=r((()=>{const t=c||"Dismiss";return e.createElement(ee,{handleClick:u,label:t,"data-testid":`${w.toKebabCase(t)}`})}),[c,u]);return e.createElement(jt,{className:"alert-modal"+(n?" "+n:""),widthValue:"400px",showModal:!0===i,onDismiss:o,onBackdropClick:u,renderHeader:E(),renderBody:f(),renderStatusMessage:x()})};class At extends It{constructor(e){super(e)}getComponent(){return Rt}}Lt.alert=At;const $t=t=>{const{className:n,onDismiss:o,showModal:i,onClose:l,icon:a,title:s,body:d,cancelLabel:c,confirmLabel:u}=t,p=r((()=>{l(!1)}),[l]),f=r((()=>{l(!0)}),[l]),b=r((()=>y.isString(d)?e.createElement(m,{paragraph:!0},d):y.isArray(d)&&d.length>0?d.map(((t,n)=>{const r=`paragraph-${n}`;if(y.isString(t)||!y.isNullOrUndefined(t))return e.createElement(m,{paragraph:!0,key:r},t)})):y.isNullOrUndefined(d)?e.createElement(m,{paragraph:!0},"Please confirm to continue."):d),[d]),E=r((()=>e.createElement(h,{sx:{marginBottom:"0.5rem","& > .MuiTypography-root.MuiTypography-paragraph":{fontFamily:"Poppins,sans-serif",fontSize:"14px !important",fontWeight:400,lineHeight:"20px"},"& > .MuiTypography-root.MuiTypography-paragraph .MuiTypography-root.MuiTypography-body1":{fontFamily:"inherit !important",fontSize:"inherit !important",fontWeight:"inherit",lineHeight:"inherit"},"& > .MuiTypography-root.MuiTypography-paragraph strong.MuiTypography-root.MuiTypography-body1":{fontWeight:"600 !important"}}},b())),[b]),x=r((()=>y.isString(s)||!y.isNullOrUndefined(s)?s:"Confirm"),[s]),M=r((()=>e.createElement(h,{sx:{position:"relative",marginBottom:"0.5rem","& > .MuiSvgIcon-root":{color:"#541868",fontSize:"2rem"}}},null!=a?a:e.createElement(g,null),e.createElement(m,{variant:"h6",sx:{color:"#541868",fontFamily:"Poppins,sans-serif",fontSize:"16px !important",fontWeight:400,lineHeight:22}},x()),e.createElement(v,{onClick:p,sx:{position:"absolute",top:"-0.5rem",right:"-0.5rem"}},e.createElement(q,{sx:{fontSize:"1rem"},"data-testid":"dismiss"})))),[a,x,p]),C=r((()=>{const t=c||"Cancel";return e.createElement(ne,{handleClick:p,label:t,"data-testid":`${w.toKebabCase(t)}`})}),[c,p]),T=r((()=>{const t=u||"Dismiss";return e.createElement(ee,{handleClick:f,label:t,"data-testid":`${w.toKebabCase(t)}`})}),[u,f]);return e.createElement(jt,{className:"confirm-modal"+(n?" "+n:""),widthValue:"400px",showModal:!0===i,onDismiss:o,onBackdropClick:p,renderHeader:M(),renderBody:E(),renderLeftButtons:C(),renderRightButtons:T()})};class zt extends It{constructor(e){super(e)}getComponent(){return $t}}Lt.confirm=zt;const Ht=t=>{const{className:n,header:r,body:o,leftButtonLabel:i,rightButtonLabel:l,hiddenClose:a,width:s}=t,d=e=>{e.stopPropagation(),t.onDismiss()};return e.createElement(jt,{className:"opti-info-modal"+(n?" "+n:""),widthValue:null!=s?s:"554px",showModal:!0===t.showModal,onDismiss:t.onDismiss,renderBody:e.createElement(h,{sx:{display:"flex",flexDirection:"row",position:"relative"}},e.createElement(h,{sx:{position:"absolute",right:"12px",top:"12px",cursor:"pointer"}},e.createElement("svg",{onClick:t.onDismiss,width:"20",height:"20",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M16.8564 6.35381L12.2707 10.9395L16.8976 15.5664L15.5609 16.903L10.9341 12.2762L6.36889 16.8414L5.13506 15.6075L9.70023 11.0424L5.07337 6.4155L6.41002 5.07885L11.0369 9.70571L15.6226 5.11998L16.8564 6.35381Z",fill:"#541868"}))),e.createElement(h,{sx:{width:"60px",background:"#541868",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px",flexShrink:0}}),e.createElement(h,{sx:{position:"absolute",top:"11.81px",left:"12px",borderRadius:"50% 50% 0% 50%",padding:"5px",background:"white"}},e.createElement("img",{style:{height:"50px",background:"#66E84B",borderRadius:"50% 50% 0% 50%",padding:"5px"},src:"/assets/img/opti/Opti-Blinked.gif"})),e.createElement(h,{sx:{padding:"1rem 1rem 1rem 1.5rem"}},e.createElement(h,{sx:{color:"#541868",fontSize:"16px",lineHeight:"22.4px",fontWeight:400}},r),e.createElement(h,{sx:{marginTop:"1rem"}},o),e.createElement(h,{className:"opti-info-modal-buttons",sx:{textAlign:"right",marginTop:"1rem"}},i&&e.createElement(f,{className:"opti-info-modal-button-left",style:{marginRight:"5px"},variant:"contained",color:"primary",onClick:()=>{},"data-testid":`${w.toKebabCase(i)}`},i),!a&&e.createElement(ee,{label:"Close",handleClick:d,"data-testid":"close"}))))})};class Wt extends It{constructor(e){super(e)}getComponent(){return Ht}}Lt.optiInfo=Wt;const Gt=e=>{var t,n,r,o,i;const l=null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.modal;if(!l||!Lt[l])return Promise.reject("invalid-modal");const a=new Lt[l]((null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.props)||{}).open();(null===(r=null==e?void 0:e.detail)||void 0===r?void 0:r.then)&&a.then((t=>{var n;try{null===(n=null==e?void 0:e.detail)||void 0===n||n.then(t)}catch(e){console.error(e)}})),(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.catch)&&a.catch(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.catch),a.finally((()=>{var t,n;if(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.finally)try{null===(n=null==e?void 0:e.detail)||void 0===n||n.finally()}catch(e){console.error(e)}})),(null==e?void 0:e.detail)&&((null==e?void 0:e.detail).promise=a)};document&&(document.removeEventListener("openModal",Gt),document.addEventListener("openModal",Gt));const qt=(e,t)=>{const[n,o]=l(null),i=a(null),d=r((e=>{if(!e)return;const n=Object.assign({},e.contentRect.toJSON());b.isValid(t)&&t>0?(clearTimeout(i.current),i.current=setTimeout((()=>{o(n)}),t)):o(n)}),[t]);return s((()=>{const t=e.current;let n;return t&&(n=new ResizeObserver((([e])=>d(e))),n.observe(t)),()=>{n&&t&&(n.unobserve(t),n.disconnect())}}),[e.current]),n},Kt=o({}),_t=()=>i(Kt),Yt=()=>({context:_t()}),Xt=(e,t,n)=>{var o,i;const{context:a}=Yt();s((()=>{var e,t;y.mutexRelease(null!==(t=null===(e=null==a?void 0:a.sectionContext)||void 0===e?void 0:e.updateSessionId)&&void 0!==t?t:"default")}),[null===(o=null==a?void 0:a.sectionContext)||void 0===o?void 0:o.updateSessionId]);const[d,c]=l(0),u=r((()=>{c((e=>e+1))}),[]),[m,p]=l(!1),[h,g]=l(!1),v=r(((e,t)=>{const n=!0===t;p(!0===e),g(n)}),[]),f=r((n=>Q(void 0,void 0,void 0,(function*(){if(y.isFunction(t)){const[e]=yield Promise.all([t(n)]);if(!e)return}return a.onMoveBack&&a.onMoveBack({section:e,data:n})}))),[h,t,a.onMoveBack]),[b,E]=l(!1),[x,w]=l(!1),[M,C]=l(null);s((()=>{x&&a.onMoveNext&&a.onMoveNext({section:e,data:M})}),[x,M]);const T=r((e=>Q(void 0,void 0,void 0,(function*(){var t,r;try{E(!0),yield y.delay(350),yield y.mutex(null!==(r=null===(t=null==a?void 0:a.sectionContext)||void 0===t?void 0:t.updateSessionId)&&void 0!==r?r:"default",(()=>Q(void 0,void 0,void 0,(function*(){if(yield y.delay(350),y.isFunction(n)){const[t]=yield Promise.all([n(e)]);if(!t)return}else if(m||h)return;w(!0),C(e)}))))}finally{E(!1)}}))),[null===(i=null==a?void 0:a.sectionContext)||void 0===i?void 0:i.updateSessionId,m,h,n]),{updatingCount:k,updatingFlags:N,setUpdating:O,unsetUpdating:S}=pt();return{context:a.sectionContext,sectionStep:d,nextSectionStep:u,hasErrors:m,hasMandatoryErrors:h,handleSetHasErrors:v,moveBack:f,moveNext:T,awaitingMoveNext:b,updatingCount:k,updatingFlags:N,setUpdating:O,unsetUpdating:S}},Zt=(e,t,n)=>{const[o,i]=l(t),[a,d]=l(null),[c,u]=l(null),[m,p]=l(null),[h,g]=l(!1),v=r((()=>new Promise((t=>{if(h)return void t(h);const n={};Ge(`wizardSection.validateForm.${e}`,{callback:(e,r)=>{n.hasErrors=!0===(null==n?void 0:n.hasErrors)||e,n.hasMandatoryErrors=1==(null==n?void 0:n.hasMandatoryErrors)||r;const o=!n.hasErrors&&!n.hasMandatoryErrors;o||g(!0),t(o)}})}))),[h,e]),{context:f,sectionStep:b,nextSectionStep:y,updatingCount:E,updatingFlags:x,setUpdating:w,unsetUpdating:M,hasErrors:C,hasMandatoryErrors:T,handleSetHasErrors:k,moveBack:N,moveNext:O,awaitingMoveNext:S}=Xt(e,void 0,v);s((()=>{if(!(null==f?void 0:f.validationSchemas))return;Q(void 0,void 0,void 0,(function*(){yield n(null,t,p,(()=>{}),(()=>{}),f.validationSchemas),i(t);const e=t.tiles[0];d(e);const r={};e.tile.controls.forEach((e=>{r[e.control.dataKey]=e})),u(r)}))}),[t,null==f?void 0:f.validationSchemas]);const[P,F]=l(null),I=r((e=>Q(void 0,void 0,void 0,(function*(){var n,r;if(!t||!m||!P)return{hasErrors:!1,hasMandatoryErrors:!1};const{hasErrors:o,hasMandatoryErrors:i}=yield mt(t,m,null,F,k);return(null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.callback)&&(null===(r=null==e?void 0:e.detail)||void 0===r||r.callback(o,i)),{hasErrors:o,hasMandatoryErrors:i}}))),[t,m,P,k]);return We(`wizardSection.validateForm.${e}`,I),{context:f,sectionStep:b,nextSectionStep:y,settings:o,graphingTile:a,graphingControls:c,inputSchemas:m,data:P,setData:F,updatingCount:E,updatingFlags:x,setUpdating:w,unsetUpdating:M,hasErrors:C,hasMandatoryErrors:T,handleSetHasErrors:k,moveBack:N,moveNext:O,awaitingMoveNext:S}},Jt=e=>{const[t,n]=l(e),[r,o]=l(null),[i,a]=l(null);return s((()=>{n(e);const t=e.tiles[0];o(t);const r={};t.tile.controls.forEach((e=>{r[e.control.dataKey]=e})),a(r)}),[e]),{settings:t,graphingTile:r,graphingControls:i}},Qt=t(((t,n)=>{var{stepIndex:r,sectionStep:o,onNextSectionStep:i,onStepIncrease:l,enterTimeout:a,onEntered:s,children:d}=t,c=J(t,["stepIndex","sectionStep","onNextSectionStep","onStepIncrease","enterTimeout","onEntered","children"]);return e.createElement(Y,{in:o>=r,timeout:{enter:null!=a?a:600},mountOnEnter:!0,onEntered:()=>{i&&i(),s&&s()}},e.createElement(_,Object.assign({},c,{ref:n}),d))})),en=t(((t,o)=>{var i,l,{section:a,children:d,animate:c,animateIn:m,animateOut:p,animateEasing:h,animateDuration:g,maxWidth:v,sx:f}=t,E=J(t,["section","children","animate","animateIn","animateOut","animateEasing","animateDuration","maxWidth","sx"]);const x=u("(max-width: 700px)"),w=_t();s((()=>{w.setSectionMaxWidth(null!=v?v:0)}),[v]);const M=n((()=>{var e;let t={position:"absolute",height:"100%",top:0,overflowY:"auto",overflowX:"hidden","&::-webkit-scrollbar":{width:"6px",height:"6px"},"&::-webkit-scrollbar-thumb":{backgroundColor:"#a98bb3",borderRadius:"6px"},"&::-webkit-scrollbar-thumb:hover":{backgroundColor:"rgb(118, 70, 134)"},"&::-webkit-scrollbar-track":{background:"rgba(118, 70, 134, 0.15)",borderRadius:"6px"}};if(!x&&b.isValid(v)&&v>0&&!y.isNullOrUndefined(null===(e=w.containerRect)||void 0===e?void 0:e.width)&&w.containerRect.width>v){const e=Math.floor((w.containerRect.width-v)/2);t=Object.assign(Object.assign({},t),{left:e,width:`calc(100% - ${e}px)`})}else t=Object.assign(Object.assign({},t),{left:0,width:"100%",padding:x?"0 0.75rem":"0"});return t}),[x,v,null===(i=w.containerRect)||void 0===i?void 0:i.width]),C=n((()=>{var e;let t=Object.assign(Object.assign({},f),{width:"100%"});return b.isValid(v)&&v>0&&!y.isNullOrUndefined(null===(e=w.containerRect)||void 0===e?void 0:e.width)&&w.containerRect.width>v&&(t=Object.assign(Object.assign({},t),{maxWidth:v})),t}),[f,v,null===(l=w.containerRect)||void 0===l?void 0:l.width]),T=r((()=>e.createElement(_,Object.assign({},E,{ref:o,className:`wizard-section wizard-section-${a}`,sx:M}),e.createElement(_,{sx:C},d))),[a,M,C,d,E]),k=n((()=>{var e;return null!==(e=null!=c?c:w.animate)&&void 0!==e?e:"fade"}),[w.animate,c]),N=n((()=>({enter:!1!==m?null!=g?g:300:0,exit:!1!==p?null!=g?g:300:0})),[m,p,g]),O=n((()=>null!=h?h:"ease-in-out"),[]),S=r((()=>e.createElement(Y,{easing:O,timeout:N,in:w.section===a,mountOnEnter:!0,unmountOnExit:!0,onEnter:e=>{e.style.opacity="0"},onEntering:e=>{e.style.opacity="1"},onEntered:e=>{e.style.opacity="",e.style.transition="",w.setSectionMaxWidth(null!=v?v:0)}},T())),[O,N,w.section,a,T]),P=n((()=>{switch(k){case"scroll-up":return"back"!==w.moveDirection?w.section===a?"up":"down":w.section===a?"down":"up";case"scroll-down":return"back"!==w.moveDirection?w.section===a?"down":"up":w.section===a?"up":"down";case"scroll-left":return"back"!==w.moveDirection?w.section===a?"left":"right":w.section===a?"right":"left";case"scroll-right":return"back"!==w.moveDirection?w.section===a?"right":"left":w.section===a?"left":"right"}}),[w.section,w.moveDirection,a,k]),F=r((()=>e.createElement(X,{container:w.containerRef.current,direction:P,easing:O,timeout:N,in:w.section===a,mountOnEnter:!0,unmountOnExit:!0,onEnter:e=>{var t,n,r,o;switch(P){case"up":e.style.transform=e.style.webkitTransform=`translateY(${null===(t=w.containerRect)||void 0===t?void 0:t.height}px)`;break;case"down":e.style.transform=e.style.webkitTransform=`translateY(-${null===(n=w.containerRect)||void 0===n?void 0:n.height}px)`;break;case"left":e.style.transform=e.style.webkitTransform=`translateX(${null===(r=w.containerRect)||void 0===r?void 0:r.width}px)`;break;case"right":e.style.transform=e.style.webkitTransform=`translateX(-${null===(o=w.containerRect)||void 0===o?void 0:o.height}px)`}},onEntering:e=>{switch(P){case"up":case"down":e.style.transform=e.style.webkitTransform="translateY(0)";break;case"left":case"right":e.style.transform=e.style.webkitTransform="translateX(0)"}},onEntered:e=>{e.style.transform="",e.style.webkitTransform="",e.style.transition="",w.setSectionMaxWidth(null!=v?v:0)}},T())),[O,N,w.section,a,P,w.containerRect,T]),I=r((()=>{switch(k){case"fade":return S();case"scroll-up":case"scroll-down":case"scroll-left":case"scroll-right":return F()}return w.section!==a?null:T()}),[w.section,a,k,S,F,T]);return e.createElement(e.Fragment,null,I())})),tn=t((({children:t,initialSection:o,animate:i,avatar:c,isAvatarVisible:u,sx:m,onMoveBack:p,onMoveNext:h,onSectionChange:g,sectionContext:v},f)=>{const E=a(null),x=qt(E),[w,M]=l(o);s((()=>{o&&g&&g(o)}),[o]);const[C,T]=l(null),[k,N]=l(),O=a(null),S=qt(O),P=r(((e,t)=>{e!==w&&(M(e),T(null!=t?t:null),g&&g(e))}),[w,g]),F=n((()=>({containerRef:E,containerRect:x,section:w,moveDirection:C,onMoveBack:p,onMoveNext:h,changeSection:P,setSectionMaxWidth:N,animate:i,sectionContext:v})),[x,w,C,p,h,P,i,v]);d(f,(()=>({section:w,context:F})),[w,F]);const I=n((()=>{if(y.isNullOrUndefined(x))return null;if(y.isNullOrUndefined(c)||y.isNullOrUndefined(S))return null;let e={display:"inline-block",position:"absolute"};return e=y.isFunction(u)&&!u(w)?Object.assign(Object.assign({},e),{opacity:0}):Object.assign(Object.assign({},e),{opacity:1}),b.isValid(k)&&k>0&&(e=Object.assign(Object.assign({},e),{left:Math.floor((x.width-k)/2)-S.width})),e}),[x,c,u,S,k]),D=r((()=>y.isNullOrUndefined(k)||0===k||y.isNullOrUndefined(I)?null:c),[k,c,I]);return e.createElement(_,{ref:E,sx:Object.assign({position:"relative"},m)},e.createElement(Kt.Provider,{value:F},e.createElement(_,{ref:O,sx:I},D()),t))}));export{vt as AddressValidator,At as AlertModal,ft as AsAtDateValidator,Z as Button,zt as ConfirmModal,yt as CurrencyValidator,Et as DateValidator,le as Dropdown,jt as FadeModal,Le as FormGroupModel,Je as FormGroupsTile,je as FormGroupsTileModel,Ie as FormInputModel,me as GraphingContext,Ye as GraphingControl,Fe as GraphingControlModel,De as GraphingControlSettingsModel,qe as GraphingGrid,Ze as GraphingPage,ke as GraphingSettingsModel,ve as GraphingTile,Xe as GraphingTileControls,Ve as GraphingTileModel,Te as GraphingTileSettingsModel,Ee as GraphingTiles,Qe as HorizontalTile,Re as HorizontalTileModel,It as Modal,Ut as MoorrModal,Be as MultipleControlsTileModel,wt as NotesValidator,bt as NumberValidator,Mt as ObjectIdValidator,Ct as ObjectIdsValidator,Wt as OptiInfoModal,Tt as OwnershipValidator,kt as PercentageValidator,ee as PrimaryButton,te as QtyButton,ne as SecondaryButton,Nt as SelectBooleanValidator,re as SelectButton,Ot as SelectNumberValidator,St as SelectValidator,et as SelectableStatesTile,Ae as SelectableStatesTileModel,tt as SimpleFormTile,$e as SimpleFormTileModel,Ue as SingleControlTileModel,nt as SingleTile,ze as SingleTileModel,xt as StringValidator,ue as StylesProvider,de as SvgIcon,gt as Validator,rt as VerticalTile,He as VerticalTileModel,tn as Wizard,en as WizardSection,Qt as WizardSectionStep,ct as checkDataForErrors,Se as createGraphingControl,Pe as createGraphingControls,Me as createGraphingTile,Ce as createGraphingTiles,at as createValidator,st as createValidators,Ge as dispatchRootEvent,dt as hasInputError,Lt as modals,Dt as modalsStack,Oe as registerGraphingControl,_e as registerGraphingControlComponent,Pt as registerGraphingFrameworkComponent,we as registerGraphingTile,ge as registerGraphingTileComponent,se as registerSvgIconComponent,lt as registerValidator,Bt as toastMessage,pe as useGraphingContext,ht as useGraphingForm,ot as useGraphingFramework,qt as useResizeObserver,We as useRootEventListener,pt as useUpdateTracker,Yt as useWizard,_t as useWizardContext,Jt as useWizardForm,Zt as useWizardFormSection,Xt as useWizardSection,mt as validateData,ut as validateInput};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moorr-react-mui",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
4
4
  "description": "Moorr React MUI Common Library",
5
5
  "scripts": {
6
6
  "_clear": "rimraf index.* && rimraf typings/* && rimraf cjs/*",