UNPKG

@elastic-suite/gally-admin-components

Version:
1 lines 326 kB
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var Pc=Object.defineProperty,Ec=Object.defineProperties;var Fc=Object.getOwnPropertyDescriptors;var Ir=Object.getOwnPropertySymbols;var ks=Object.prototype.hasOwnProperty,Ls=Object.prototype.propertyIsEnumerable;var Fs=(e,o,t)=>o in e?Pc(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,p=(e,o)=>{for(var t in o||(o={}))ks.call(o,t)&&Fs(e,t,o[t]);if(Ir)for(var t of Ir(o))Ls.call(o,t)&&Fs(e,t,o[t]);return e},y=(e,o)=>Ec(e,Fc(o));var N=(e,o)=>{var t={};for(var r in e)ks.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&Ir)for(var r of Ir(e))o.indexOf(r)<0&&Ls.call(e,r)&&(t[r]=e[r]);return t};var J=(e,o,t)=>new Promise((r,n)=>{var i=l=>{try{a(t.next(l))}catch(d){n(d)}},s=l=>{try{a(t.throw(l))}catch(d){n(d)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(i,s);a((t=t.apply(e,o)).next())});var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _material = require('@mui/material');var _system = require('@mui/system');var _nexti18next = require('next-i18next');var _n={dashboard:"/images/home2.svg",arrow:"/images/arrow.svg",telescope:"/images/telescope-outline.svg","push-pin":"/images/push-pin.svg"},zn={analyze:"analytics",informationCircle:"information-circle-outline",merchandize:"funnel-outline",minus:"remove-circle",monitoring:"list",more:"add-circle",settings:"settings-outline"},vw=[...Object.keys(_n),...Object.keys(zn)];function kc(e){let s=e,{name:o,tooltip:t}=s,r=N(s,["name","tooltip"]),n=t?{color:"#8187B9",width:"20px",height:"20px",display:"flex"}:{},i=y(p({},r),{style:p(p({},n),r.style)});return o in _n?_react2.default.createElement("ion-icon",p({src:_n[o]},i)):o in zn?_react2.default.createElement("ion-icon",p({name:zn[o]},i)):_react2.default.createElement("ion-icon",p({name:o},i))}var B=kc;var Nc=_system.styled.call(void 0, (0, _material.Alert))(({severity:e,theme:o})=>y(p(p(p({padding:`6px ${o.spacing(2)}`,background:o.palette.colors.neutral[200],border:`1px solid ${o.palette.colors.neutral[300]}`,color:o.palette.colors.neutral[600],borderRadius:8,alignItems:"center"},e==="success"&&{background:o.palette.success.light,color:o.palette.success.main}),e==="warning"&&{background:o.palette.warning.light,color:o.palette.warning.main}),e==="error"&&{background:o.palette.error.light,color:o.palette.error.main}),{"& .MuiAlert-icon":{color:"inherit",marginRight:o.spacing(1)},"& .MuiAlert-message":{padding:0,fontWeight:400,fontSize:"12px",lineHeight:"18px",whiteSpace:"pre-line"},"& .MuiAlert-action":{paddingLeft:"10px",paddingTop:0,paddingBottom:0,paddingRight:0}}));function Oc(e,o){let{id:t,message:r,onShut:n,variant:i="info",mb:s=2}=e,{t:a}=_nexti18next.useTranslation.call(void 0, "alert");function l(){n==null||n(t)}return _react2.default.createElement(Nc,{action:_react2.default.createElement(_material.IconButton,{"aria-label":"close",color:"inherit",size:"small",onClick:l},_react2.default.createElement(B,{name:"close",style:{fontSize:18,padding:"0px"}})),ref:o,severity:i,sx:{mb:s}},a(r))}var Oe=_react.forwardRef.call(void 0, Oc);function zc(e,o,t,r){let n=r("boost",{count:o});switch(e){case"up":return{boostText:` x${t} ( ${o} ${n}) `,boostColor:"success.light",boostTextColor:"success.main",boostIconName:"trending-up-outline"};case"down":return{boostText:` x${t} ( ${o} ${n}) `,boostColor:"error.light",boostTextColor:"error.main",boostIconName:"trending-down-outline"};case"straight":return{boostText:"no boost",boostColor:"neutral.light",boostTextColor:"colors.neutral.600",boostIconName:"arrow-forward-outline"}}}function Hc(e){let{type:o,boostNumber:t,boostMultiplicator:r}=e,{t:n}=_nexti18next.useTranslation.call(void 0, "boost"),i=zc(o,t,r,n);return _react2.default.createElement(_system.Box,{sx:{display:"flex",gap:"4px"}},_react2.default.createElement(_system.Box,{sx:{backgroundColor:i.boostColor,color:i.boostTextColor,height:"20px",width:"20px",borderRadius:"50%",display:"flex",justifyContent:"center",alignItems:"center"}},_react2.default.createElement(B,{name:i.boostIconName,style:o==="straight"?{width:"14px",height:"14px"}:{width:"14px",height:"8px"}})),t!==void 0&&r!==void 0&&_react2.default.createElement(_system.Box,{sx:{color:i.boostTextColor,fontFamily:"var(--gally-font)",fontWeight:"500",fontSize:"12px",lineHeight:"18px"}},i.boostText))}var qn=Hc;var Ms=_system.styled.call(void 0, "span")({fontWeight:"500",fontSize:"12px",lineHeight:"18px"}),qc=_system.styled.call(void 0, Ms)(({theme:e})=>({color:e.palette.colors.neutral[500]})),Wc=_system.styled.call(void 0, Ms)(({theme:e})=>({color:e.palette.colors.neutral[800]}));function Gc(e){let{label:o,last:t}=e;return _react2.default.createElement(_material.Typography,null,_react2.default.createElement(t?Wc:qc,null,o))}var Gn=Gc;var _gallyadminshared = require('@elastic-suite/gally-admin-shared');function Rc(e){let{menu:o,slug:t}=e;if(!t||t.length===0||o.hierarchy.length===0)return null;let r=_gallyadminshared.getSlugArray.call(void 0, t).map((n,i,s)=>({key:n,label:_gallyadminshared.findBreadcrumbLabel.call(void 0, i,s,o.hierarchy),last:s.length<=i+1})).filter(({label:n})=>n);return _react2.default.createElement(_material.Breadcrumbs,{"aria-label":"breadcrumb",sx:{color:"colors.neutral.500"},"data-testid":"breadcrumbs"},r.map(s=>{var a=s,{key:n}=a,i=N(a,["key"]);return _react2.default.createElement(Gn,p({key:n},i))}))}var Xn=Rc;var Yc=_system.styled.call(void 0, (0, _material.Chip))(({theme:e,disabled:o})=>({display:"inline-flex",height:"26px",color:e.palette.colors.neutral[900],fontFamily:"var(--gally-font)",fontWeight:o?400:600,fontSize:o?14:12,lineHeight:"18px",textAlign:"center",alignItems:"center",padding:`2px ${e.spacing(1)}`,background:e.palette.colors.neutral[300],borderRadius:"13px",cursor:"default","&.MuiChip-colorPrimary":{color:e.palette.colors.secondary[600],background:e.palette.colors.secondary[100]},"&.MuiChip-colorSuccess":{color:e.palette.success.main,background:e.palette.success.light},"&.MuiChip-colorWarning":{color:e.palette.warning.main,background:e.palette.warning.light},"&.MuiChip-colorError":{color:e.palette.error.main,background:e.palette.error.light},"&.MuiChip-sizeSmall":{height:"20px"},"& .MuiChip-label":{padding:0},"& .MuiChip-deleteIcon":{color:"inherit",margin:`0 0 0 ${e.spacing(.5)}`,padding:0,fontSize:"14px","&:hover":{color:"inherit",opacity:.5}}}));function Qc(e){let{disabled:o}=e;return _react2.default.createElement(Yc,y(p({disabled:o},e),{style:{opacity:1},deleteIcon:_react2.default.createElement(_material.IconButton,null,_react2.default.createElement(B,{name:"close"}))}))}var Ee=Qc;function om({onClose:e}){return _react2.default.createElement(_material.Box,{sx:{position:"fixed",width:"100vw",height:"100vh",zIndex:99,left:"0",top:"0"},onClick:e})}var $n=om;function am(e,o){let b=e,{error:t,helperIcon:r,helperText:n,disabled:i,label:s,list:a,onChange:l,onClick:d,small:c,dataTestId:u}=b,f=N(b,["error","helperIcon","helperText","disabled","label","list","onChange","onClick","small","dataTestId"]);function h(x){l&&l(x.target.checked,x)}return _react2.default.createElement(_material.FormControlLabel,{componentsProps:{typography:{variant:a?"caption":"body2"}},control:_react2.default.createElement(_material.Checkbox,y(p({},f),{inputRef:o,onChange:h,sx:p(p({},Boolean(a)&&{marginBottom:"-9px",marginTop:"-9px",fontSize:"12px"}),Boolean(c)&&{padding:0,marginLeft:"6px",marginRight:"6px"})})),onClick:d,disabled:i,label:_react2.default.createElement("div",null,s,Boolean(n)&&_react2.default.createElement(_material.FormHelperText,{error:t},Boolean(r)&&_react2.default.createElement(B,{name:r,style:{fontSize:18,marginRight:2}}),n)),sx:p({},Boolean(c)&&{marginLeft:"-6px"}),"data-testid":u})}var go=_react.forwardRef.call(void 0, am);var _router = require('next/router'); var _router2 = _interopRequireDefault(_router);var _lodashdebounce = require('lodash.debounce'); var _lodashdebounce2 = _interopRequireDefault(_lodashdebounce);var _notistack = require('notistack');function Ce(e="error"){return _react.useCallback.call(void 0, o=>_gallyadminshared.log.call(void 0, o,t=>_notistack.enqueueSnackbar.call(void 0, t,{onShut:_notistack.closeSnackbar,variant:e,preventDuplicate:!0})),[e])}var _toolkit = require('@reduxjs/toolkit');var cm={api:null,bundles:null,configurations:null},Ds=_toolkit.createSlice.call(void 0, {name:"data",initialState:cm,reducers:{setData(e,o){e.api=o.payload.api,e.bundles=o.payload.bundles,e.configurations=o.payload.configurations}}}),{setData:Ns}=Ds.actions,Os= exports.dataReducer =Ds.reducer,gt= exports.selectApi =e=>e.data.api,Eo= exports.selectBundles =e=>e.data.bundles,Fo= exports.selectConfiguration =e=>e.data.configurations;var _reactredux = require('react-redux');var ko=()=>_reactredux.useDispatch.call(void 0, ),q= exports.useAppSelector =_reactredux.useSelector;var hm={language:"en"},_s=_toolkit.createSlice.call(void 0, {name:"i18n",initialState:hm,reducers:{setLanguage(e,o){e.language=o.payload}}}),{setLanguage:zs}=_s.actions,Hs= exports.i18nReducer =_s.reducer,Cr= exports.selectLanguage =e=>e.i18n.language;var Im={menu:{status:_gallyadminshared.LoadStatus.IDLE,data:{hierarchy:[]}},menuItemActive:"",sidebarState:!0,sidebarStateTimeout:!1,childrenState:{}},Vs=_toolkit.createSlice.call(void 0, {name:"menu",initialState:Im,reducers:{setChildState(e,o){e.childrenState[o.payload.code]=o.payload.value},setMenu(e,o){e.menu=p(p({},e.menu),o.payload)},setMenuItemActive(e,o){e.menuItemActive=o.payload},setSidebarState(e,o){e.sidebarState=o.payload},setSidebarStateTimeout(e,o){e.sidebarStateTimeout=o.payload}}}),{setChildState:qs,setMenu:Tr,setMenuItemActive:Ws,setSidebarState:Rn,setSidebarStateTimeout:Gs}=Vs.actions,Xs= exports.menuReducer =Vs.reducer,Js= exports.selectChildrenState =e=>e.menu.childrenState,Sr= exports.selectMenu =e=>e.menu.menu.data,$s= exports.selectMenuItemActive =e=>e.menu.menuItemActive,vr= exports.selectSidebarState =e=>e.menu.sidebarState,Rs= exports.selectSidebarStateTimeout =e=>e.menu.sidebarStateTimeout;var _reduxthunk = require('redux-thunk'); var _reduxthunk2 = _interopRequireDefault(_reduxthunk);var Cm={requestedPath:null},Us=_toolkit.createSlice.call(void 0, {name:"user",initialState:Cm,reducers:{setRequestedPath(e,o){e.requestedPath=o.payload}}}),{setRequestedPath:js}=Us.actions,Ks= exports.userReducer =Us.reducer,Ys= exports.selectRequestedPath =e=>e.user.requestedPath;var wm=_toolkit.combineReducers.call(void 0, {data:Os,i18n:Hs,menu:Xs,user:Ks}),Qs= exports.setupStore =e=>_toolkit.configureStore.call(void 0, {middleware:o=>process.env.NODE_ENV==="development"?o({serializableCheck:{ignoredActionPaths:["payload.error"],ignoredPaths:["menu.menu.error"]}}):[_reduxthunk2.default],preloadedState:e,reducer:wm});function W(e,o=_gallyadminshared.IMainContext.GRID){let t=q(gt),{pathname:r}=_router.useRouter.call(void 0, );return _react.useMemo.call(void 0, ()=>{let n=_gallyadminshared.getResource.call(void 0, t,e);return y(p({},n),{supportedProperty:(n==null?void 0:n.supportedProperty)instanceof Array?n==null?void 0:n.supportedProperty.map(i=>_gallyadminshared.updatePropertiesAccordingToPath.call(void 0, i,r,o)):n!=null&&n.supportedProperty?[_gallyadminshared.updatePropertiesAccordingToPath.call(void 0, n.supportedProperty,r,o)]:n==null?void 0:n.supportedProperty})},[t,r,o,e])}function ht(e){let{supportedOperation:o}=e,t=le(),r=_gallyadminshared.getApiUrl.call(void 0, e.url),n=_react.useCallback.call(void 0, (l,d)=>t(`${r}/${l}`,void 0,{body:JSON.stringify(d),method:_gallyadminshared.Method.PATCH,headers:{[_gallyadminshared.contentTypeHeader]:"application/merge-patch+json"}}),[r,t]),i=_react.useCallback.call(void 0, l=>t(r,void 0,{body:JSON.stringify(l),method:_gallyadminshared.Method.POST}),[r,t]),s=_react.useCallback.call(void 0, l=>t(`${r}/${l.id}`,void 0,{body:JSON.stringify(l),method:_gallyadminshared.Method.PUT}),[r,t]),a=_react.useCallback.call(void 0, l=>t(`${r}/${l}`,void 0,{method:_gallyadminshared.Method.DELETE}),[r,t]);return _react.useMemo.call(void 0, ()=>o.reduce((l,d)=>(typeof d["@type"]=="string"?l.update=n:d["@type"]instanceof Array&&d["@type"].length===2&&typeof d["@type"][1]=="string"&&(d["@type"][1].indexOf("//schema.org/CreateAction")!==-1?l.create=i:d["@type"][1].indexOf("//schema.org/ReplaceAction")!==-1?l.replace=s:d["@type"][1].indexOf("//schema.org/DeleteAction")!==-1&&(l.remove=a)),l),{}),[i,a,s,o,n])}var Kn=1e3;function le(e=!0){let{i18n:o}=_nexti18next.useTranslation.call(void 0, "common"),t=Ce(),{t:r}=_nexti18next.useTranslation.call(void 0, "alert");return _react.useCallback.call(void 0, (n,i,s)=>J(this,null,function*(){try{return yield _gallyadminshared.fetchApi.call(void 0, o.language,n,i,s,e)}catch(a){return e&&a instanceof _gallyadminshared.AuthError?(_gallyadminshared.storageRemove.call(void 0, _gallyadminshared.tokenStorageKey),_router2.default.push("/login"),t(r("Expired JWT Token"))):t(a),{error:a}}}),[o.language,t,e,r])}function Fe(e,o,t,r=!0,n=!0,i=!1,s){let a=le(r),[l,d]=_react.useState.call(void 0, {status:_gallyadminshared.LoadStatus.IDLE}),c=_react.useCallback.call(void 0, h=>{d(b=>y(p({},b),{data:h instanceof Function?h(b.data):h}))},[]),u=_react.useCallback.call(void 0, ()=>{if(n){if(d(h=>({data:h.data,status:_gallyadminshared.LoadStatus.LOADING})),!e)return d({data:null,status:_gallyadminshared.LoadStatus.SUCCEEDED});s?_gallyadminshared.fetchApiUsingPagination.call(void 0, a,e,o,t,s).then(h=>{d(h)}):a(e,o,t).then(h=>{_gallyadminshared.isError.call(void 0, h)?d({error:h.error,status:_gallyadminshared.LoadStatus.FAILED}):d({data:h,status:_gallyadminshared.LoadStatus.SUCCEEDED})})}},[n,a,t,e,o,s]),f=_react.useMemo.call(void 0, ()=>_lodashdebounce2.default.call(void 0, h=>h(),Kn),[]);return _react.useLayoutEffect.call(void 0, ()=>{i?f(u):u()},[u,f,i]),[l,c,u]}function ce(e,o=0,t=_gallyadminshared.defaultPageSize,r,n,i=!1,s=!1){let a=_react.useMemo.call(void 0, ()=>_gallyadminshared.getListApiParameters.call(void 0, o,t,r,n),[o,t,r,n]),[l,d,c]=Fe(e,a,void 0,!0,!0,i,s?t:void 0),u=_react.useCallback.call(void 0, f=>{d(h=>y(p({},h),{"hydra:member":f instanceof Function?f(h["hydra:member"]):f}))},[d]);return[l,u,c]}function rl(e,o=0,t=_gallyadminshared.defaultPageSize,r,n,i,s=!1){let[a,l,d]=ce(i||e,o,t,r,n,s),{create:c,remove:u,replace:f,update:h}=ht(e),b=_react.useRef.call(void 0, {}),x=_react.useMemo.call(void 0, ()=>_lodashdebounce2.default.call(void 0, (P=!0)=>J(this,null,function*(){if(P){let A=Object.entries(b.current).map(([S,v])=>(delete b.current[S],h(S,v)));yield Promise.all(A),d()}}),Kn),[d,h]),F=_react.useCallback.call(void 0, (P,A,S=!0)=>{P in b.current?b.current[P]=p(p({},b.current[P]),A):b.current[P]=A,l(v=>v.map(M=>M.id===P?p(p({},M),A):M)),x(S)},[x,l]),C=_react.useCallback.call(void 0, (P,A)=>J(this,null,function*(){l(v=>v.map(M=>P.includes(M.id)?p(p({},M),A):M));let S=P.map(v=>h(v,A));yield Promise.all(S),d()}),[d,h,l]),I=_react.useCallback.call(void 0, (P,A)=>J(this,null,function*(){l(v=>v.map(M=>P.includes(M.id)?p(p({},M),A):M));let S=P.map(v=>f(p({id:v},A)));yield Promise.all(S),d()}),[d,f,l]),g=_react.useCallback.call(void 0, P=>J(this,null,function*(){let A=yield c(P);!_gallyadminshared.isError.call(void 0, A)&&a.data["hydra:member"].length<t&&d()}),[c,d,a,t]),T=_react.useMemo.call(void 0, ()=>_lodashdebounce2.default.call(void 0, (P=!0)=>J(this,null,function*(){if(P){let A=Object.entries(b.current).map(([S,v])=>(delete b.current[S],f(v)));yield Promise.all(A),d()}}),Kn),[d,f]),w=_react.useCallback.call(void 0, (P,A=!0)=>{let S=P.id;S in b.current?b.current[S]=p(p({},b.current[S]),P):b.current[S]=P,l(v=>v.map(M=>M.id===P.id?p(p({},M),P):M)),T(A)},[T,l]),k=_react.useCallback.call(void 0, P=>J(this,null,function*(){l(S=>S.filter(v=>v.id!==P));let A=yield u(P);(_gallyadminshared.isError.call(void 0, A)||a.data["hydra:member"].length===t)&&d()}),[d,u,a,t,l]),L=_react.useMemo.call(void 0, ()=>{let P={};return h&&(P.update=F,P.massUpdate=C),c&&(P.create=g),f&&(P.replace=w,P.massReplace=I),u&&(P.remove=k),P},[c,g,k,w,F,C,I,u,f,h]);return[a,L,l]}function il(e,o){let{t}=_nexti18next.useTranslation.call(void 0, "api"),r=_react.useMemo.call(void 0, ()=>_gallyadminshared.getMappings.call(void 0, e,o),[e,o]);return _react.useMemo.call(void 0, ()=>r.map(n=>_gallyadminshared.getFilter.call(void 0, n,t)),[r,t])}function al(e){return _react.useMemo.call(void 0, ()=>{let t=e.supportedProperty.map(r=>{var n;return((n=r==null?void 0:r.gally)==null?void 0:n.input)==="rangeDate"?y(p({},r),{title:"doubleDatePicker"}):r}).reduce((r,n)=>{var s;let i=(s=n==null?void 0:n.gally)==null?void 0:s.rangeDateId;return r.some(a=>{var l,d;return((l=a==null?void 0:a.gally)==null?void 0:l.rangeDateId)===i&&((d=a==null?void 0:a.gally)==null?void 0:d.rangeDateId)})||r.push(n),r},[]);return y(p({},e),{supportedProperty:t})},[e])}function Zn(e){let{t:o}=_nexti18next.useTranslation.call(void 0, "api"),t=al(e);return _react.useMemo.call(void 0, ()=>t.supportedProperty.filter(r=>{var n;return(n=r.gally)==null?void 0:n.visible}).sort((r,n)=>{var i,s;return((i=r.gally)==null?void 0:i.position)-((s=n.gally)==null?void 0:s.position)}).map(r=>_gallyadminshared.getFieldHeader.call(void 0, r,o)),[o,t])}var Yn="_other";function sl(e){let o=Zn(e);return _react.useMemo.call(void 0, ()=>{let t=o.reduce((r,s)=>{var a=s,{gridHeaderInfoTooltip:n}=a,i=N(a,["gridHeaderInfoTooltip"]);var c,u;let l=i.fieldset,d=(u=(c=e.gally)==null?void 0:c.fieldset)==null?void 0:u[l];return l&&d?l in r?r[l].children.push(i):r[l]=y(p({},d),{code:l,children:[i]}):r[Yn].children.push(i),r},{[Yn]:{code:Yn,children:[],position:1/0}});return Object.values(t).sort((r,n)=>(r==null?void 0:r.position)-(n==null?void 0:n.position))},[o,e])}function ll(e){return _react.useMemo.call(void 0, ()=>e.supportedProperty.filter(o=>{var t,r;return((t=o.gally)==null?void 0:t.visible)&&((r=o.gally)==null?void 0:r.editable)&&o.writeable}).map(o=>({id:o.title,label:o.property.label,value:o})),[e])}function dl(e){let[o,t]=_react.useState.call(void 0, -1),[r,n]=_react.useState.call(void 0, -1),i=_react.useMemo.call(void 0, ()=>e.find(l=>l.id===o),[o,e]),s=_react.useMemo.call(void 0, ()=>i==null?void 0:i.localizedCatalogs.find(l=>l.id===r),[i,r]),a=_react.useMemo.call(void 0, ()=>e?_gallyadminshared.getLocalizedCatalog.call(void 0, e,i,s):null,[i,e,s]);return _react.useMemo.call(void 0, ()=>({catalog:i,catalogId:o,catalogs:e,localizedCatalog:s,localizedCatalogId:r,localizedCatalogWithDefault:a,localizedCatalogIdWithDefault:a?String(a==null?void 0:a.id):"",setCatalogId:t,setLocalizedCatalogId:n}),[i,o,e,s,r,a,t,n])}function ul(){let e=ko(),o=Ce(),t=_gallyadminshared.useSchemaLoader.call(void 0, ),[r]=Fe("extra_bundles",void 0,void 0,!1),[n]=Fe("configurations",void 0,void 0,!1);_react.useEffect.call(void 0, ()=>{t.status===_gallyadminshared.LoadStatus.FAILED&&o(t.error),r.status===_gallyadminshared.LoadStatus.FAILED&&o(r.error),n.status===_gallyadminshared.LoadStatus.FAILED&&o(n.error),t.data&&r.data&&n.data&&e(Ns({api:t.data,bundles:r.data["hydra:member"].map(i=>i.name),configurations:Object.fromEntries(n.data["hydra:member"].map(i=>[i.id,i.value]))}))},[t,r,n,e,o])}function cl(e=0,o,t,r=!0){let n=_router.useRouter.call(void 0, );_react.useEffect.call(void 0, ()=>{if(r){let i=_gallyadminshared.getAppUrl.call(void 0, n.asPath,e,o,t);n.asPath!==i.pathname+i.search&&n.push(i.href,void 0,{shallow:!0})}},[r,o,e,n,t])}function ml(){let e=_router.useRouter.call(void 0, ),[o,t]=_react.useState.call(void 0, ()=>{let r=_gallyadminshared.getRouterUrl.call(void 0, e.asPath),n=_gallyadminshared.getParametersFromUrl.call(void 0, r);return _gallyadminshared.getPageParameter.call(void 0, n)});return[o,t]}function oo(e){let o=_router.useRouter.call(void 0, ),[t,r]=_react.useState.call(void 0, ()=>{let n=_gallyadminshared.getRouterUrl.call(void 0, o.asPath),i=_gallyadminshared.getParametersFromUrl.call(void 0, n);return _gallyadminshared.getFilterParameters.call(void 0, e,i)});return[t,r]}function fl(){let e=_router.useRouter.call(void 0, ),[o,t]=_react.useState.call(void 0, ()=>{let r=_gallyadminshared.getRouterUrl.call(void 0, e.asPath),n=_gallyadminshared.getParametersFromUrl.call(void 0, r);return _gallyadminshared.getSearchParameter.call(void 0, n)});return[o,t]}function gl(...e){return _react.useMemo.call(void 0, ()=>_gallyadminshared.getApiFilters.call(void 0, Object.assign({},...e)),e)}function me(e,o,t=!1,r,n=!1,i){let[s,a]=_react.useState.call(void 0, ""),l=_react.useRef.call(void 0, null),{t:d}=_nexti18next.useTranslation.call(void 0, "common"),[c,u]=_react.useState.call(void 0, !1),f=_react.useCallback.call(void 0, (b,x,F)=>{var I,g;let C=null;if(r&&(C=r(b,x),(I=l.current)==null||I.setCustomValidity(C)),(C===null||C==="")&&((x==null?void 0:x.target)||F&&l.current)){let T=F&&l.current?l.current.validity:(g=x==null?void 0:x.target)==null?void 0:g.validity;T!=null&&T.valid||(C=_gallyadminshared.getFormValidityError.call(void 0, T))}return a(C||""),C===null||C===""},[l,r]);_react.useEffect.call(void 0, ()=>{c||f(o,void 0,!0)},[f,o,c]);let h=_react.useCallback.call(void 0, (b,x)=>{c||u(!0),f(b,x),e&&e(b,x)},[e,f,c]);return _react.useMemo.call(void 0, ()=>{let b={error:n?!1:t?Boolean(s):!1,onChange:h,ref:l};return n?(b.helperIcon="",b.helperText=""):s&&t&&(b.helperIcon="close",b.helperText=d(`formError.${(i==null?void 0:i[s])||s}`)),[b,x=>{var F;a(x),(F=l.current)==null||F.setCustomValidity(x)}]},[s,h,d,n,t,i])}function ii(e=!0){let{i18n:o}=_nexti18next.useTranslation.call(void 0, "common"),t=Ce(),{t:r}=_nexti18next.useTranslation.call(void 0, "alert");return _react.useCallback.call(void 0, (n,i,s)=>J(this,null,function*(){try{return yield _gallyadminshared.fetchGraphql.call(void 0, o.language,n,i,s,e)}catch(a){return e&&a instanceof _gallyadminshared.AuthError?(_gallyadminshared.storageRemove.call(void 0, _gallyadminshared.tokenStorageKey),_router2.default.push("/login"),t(r("Expired JWT Token"))):t(a),{error:a}}}),[o.language,t,e,r])}function to(e,o,t,r=!0){let n=ii(),[i,s]=_react.useState.call(void 0, {status:_gallyadminshared.LoadStatus.IDLE}),a=_react.useCallback.call(void 0, d=>{s(c=>y(p({},c),{data:d instanceof Function?d(c.data):d}))},[]),l=_react.useCallback.call(void 0, ()=>{r&&(s(d=>({data:d.data,status:_gallyadminshared.LoadStatus.LOADING})),n(e,o,t).then(d=>{_gallyadminshared.isError.call(void 0, d)?s({error:d.error,status:_gallyadminshared.LoadStatus.FAILED}):s({data:d,status:_gallyadminshared.LoadStatus.SUCCEEDED})}))},[r,n,t,e,o]);return _react.useEffect.call(void 0, ()=>{l()},[l]),[i,a,l]}var yl=e=>{let[o,t]=_react.useState.call(void 0, !1),[r,n]=_react.useState.call(void 0, !1);return _react.useLayoutEffect.call(void 0, ()=>{function i(){if(e){let s=e.scrollWidth>e.clientWidth;if(t(s),s){let a=l=>{n(l.target.scrollLeft>0)};return e.addEventListener("scroll",a),()=>e.removeEventListener("scroll",a)}}}i()},[e]),{isOverflow:o,shadow:r}};function Lr(e=new Map){let o=le(),[t,r]=_react.useState.call(void 0, e),n=_react.useRef.call(void 0, new Map),i=Ce(),s=_react.useCallback.call(void 0, (l,d)=>{n.current.set(l,_gallyadminshared.LoadStatus.SUCCEEDED),r(c=>{let u=new Map(c);return u.set(l,d),u})},[]);return{fetch:_react.useCallback.call(void 0, (l,d)=>J(this,null,function*(){if(!n.current.get(l)){n.current.set(l,_gallyadminshared.LoadStatus.LOADING);try{let u=yield d(o);s(l,u)}catch(u){i(u),n.current.set(l,_gallyadminshared.LoadStatus.FAILED)}}}),[o,s,i]),map:t,setMap:r,statuses:n}}function Sl(){let{fetch:e,map:o,statuses:t}=Lr(),r=q(gt),{t:n}=_nexti18next.useTranslation.call(void 0, "options"),i=_react.useCallback.call(void 0, s=>{let a=s.property["@id"];return e(a,l=>J(this,null,function*(){var d,c;if(_gallyadminshared.hasFieldOptions.call(void 0, s)){if(_gallyadminshared.isDropdownStaticOptions.call(void 0, (d=s.gally)==null?void 0:d.options))return s.gally.options.values.map(h=>y(p({},h),{label:h==null?void 0:h.label}));let u=yield l(s.gally.options.api_rest);if(!_gallyadminshared.isError.call(void 0, u))return _gallyadminshared.getOptionsFromApiSchema.call(void 0, u);throw new Error("error")}else if(_gallyadminshared.isReferenceField.call(void 0, s)){let u=yield l((c=_gallyadminshared.getReferencedResource.call(void 0, r,s))==null?void 0:c.url);if(!_gallyadminshared.isError.call(void 0, u))return _gallyadminshared.getOptionsFromResource.call(void 0, u);throw new Error("error")}}))},[r,e]);return _react.useMemo.call(void 0, ()=>{let s=new Map(o);return s.forEach(a=>a.forEach(l=>{l.label=n(l.label)})),{fieldOptions:s,load:i,statuses:t}},[i,o,t,n])}var Of=200;function EE(e,o){let t=q(Eo),r=le(),[n,i]=_react.useState.call(void 0, null),s=_gallyadminshared.isVirtualCategoryEnabled.call(void 0, t),a=!(e!=null&&e.isVirtual)||_gallyadminshared.isRuleValid.call(void 0, e==null?void 0:e.virtualRule),l=_react.useMemo.call(void 0, ()=>_lodashdebounce2.default.call(void 0, c=>J(this,null,function*(){let u=yield r("rule_engine_graphql_filters",void 0,{body:JSON.stringify({rule:c}),method:"POST"});_gallyadminshared.isError.call(void 0, u)||i(u.graphQlFilters)}),Of),[r]);return _react.useEffect.call(void 0, ()=>{s&&(e==null?void 0:e.isVirtual)&&(e==null?void 0:e.virtualRule)&&a&&l(JSON.stringify(_gallyadminshared.serializeRule.call(void 0, e.virtualRule,o)))},[t,e==null?void 0:e.isVirtual,e==null?void 0:e.virtualRule,l,s,a,o]),[_react.useMemo.call(void 0, ()=>s&&(e==null?void 0:e.isVirtual)&&n?n:null,[e,s,n]),i]}function bt(e){let[o,t]=_react.useState.call(void 0, ),r=q(Eo),n=le();return _react.useEffect.call(void 0, ()=>{_gallyadminshared.isVirtualCategoryEnabled.call(void 0, r)&&!e&&n("rule_engine_operators").then(i=>{_gallyadminshared.isError.call(void 0, i)||t(i)})},[r,n,e]),e!=null?e:o}function Ar(e){var i;let{asPath:o}=_router.useRouter.call(void 0, ),t=_gallyadminshared.getRouterPath.call(void 0, o),r=(i=e.find(s=>s.url===t))!=null?i:e.find(s=>s.default),n=_react.useCallback.call(void 0, s=>{let a=e.find(l=>l.id===s);a&&_router2.default.push(a.url,void 0,{shallow:!0})},[e]);return[r,n]}function ze(){let e=_gallyadminshared.storageGet.call(void 0, _gallyadminshared.tokenStorageKey);try{return _react.useMemo.call(void 0, ()=>_gallyadminshared.getUser.call(void 0, e),[e])}catch(o){return null}}var wl=()=>{let e=_react.useRef.call(void 0, null),[o,t]=_react.useState.call(void 0, !1);return _react.useEffect.call(void 0, ()=>{let r=new MutationObserver(()=>{var n;t(Boolean((n=e.current)==null?void 0:n.checkValidity()))});return r.observe(e.current,{childList:!0,subtree:!0,attributes:!0}),()=>r.disconnect()},[e]),{formRef:e,formIsValid:o}};function eg(e){let l=e,{onChange:o,showError:t,additionalValidator:r}=l,n=N(l,["onChange","showError","additionalValidator"]),i=_react.useCallback.call(void 0, (u,f)=>r?r(u,f):"",[r]),[d]=me(o,n.checked,t,i,n.disabled),c=d,{ref:s}=c,a=N(c,["ref"]);return _react2.default.createElement(go,y(p(p({},n),a),{error:(n==null?void 0:n.error)||(a==null?void 0:a.error),helperIcon:(n==null?void 0:n.helperIcon)||(a==null?void 0:a.helperIcon),helperText:(n==null?void 0:n.helperText)||(a==null?void 0:a.helperText),ref:s}))}var og=eg;var _DatePicker = require('@mui/x-date-pickers/DatePicker');var _PickersDay = require('@mui/x-date-pickers/PickersDay');function Pl(e,o){let t;function r(n){return n.id===e.id?(t=n,!0):n.children&&n.children.length>0?n.children.some(r):!1}return o.some(r),t!=null?t:o[0]}function xt(e){let o=[],t=e.filter(r=>r.sticky).length;return e.filter(r=>r.sticky).map((r,n)=>o.push(p({isLastSticky:!(n<t-1)},r))),o}function Mr(e,o,t,r){t(e.target.checked?r.concat(o):r.filter(n=>n!==o))}function Lo(e){return p({borderBottomColor:"colors.neutral.300",borderRight:"2px solid",borderRightColor:"colors.neutral.600"},e&&{boxShadow:"5px 0 460px -10px",clipPath:"inset(0px -15px 0px 0px)"})}function Gt(e,o){let{required:t,type:r}=o;return r==="number"?e===""&&!t?null:Number(e):e}function tg(e){return{fromDate:e==null?void 0:e.fromDate,toDate:e==null?void 0:e.toDate}}function Br(e,o){var r;if(!e)return null;let t={};return(r=o==null?void 0:o.data)==null||r["hydra:member"].forEach(n=>{var i;t[`${n.value}Limitations`]=(i=e[`${n.value}Limitations`])!=null?i:[]}),y(p({},t),{requestTypes:e.requestTypes})}function El(e,o){var r,n;let[t]=ce(e&&(e==null?void 0:e.input)==="requestType"?(n=(r=e==null?void 0:e.requestTypeConfigurations)==null?void 0:r.limitationTypeOptionsApi)!=null?n:"boost_limitation_type_options":e&&typeof e=="string"?e:void 0);if(!e)return null;if(typeof e=="string")return Br(o,t);switch(e==null?void 0:e.input){case"requestType":return Br(o,t);case"rangeDate":return tg(o);default:return o==null?void 0:o[e.name]}}function Dr(e,o,t,r){return y(p(p({minWidth:`${_gallyadminshared.reorderingColumnWidth}px`},!e&&{borderRight:"none"}),e&&t&&Lo(r)),{backgroundColor:"colors.white",zIndex:"1",left:`${o}px`})}var kl={fontSize:"x-large",position:"absolute",left:"18.75%",right:"18.75%",top:"36.33%",bottom:"36.33%",color:"colors.white",display:"flex",alignItems:"center","&:hover":{color:"colors.neutral.500",cursor:"grab"}};function Nr(e,o,t,r){return p(p({zIndex:"1",minWidth:`${_gallyadminshared.stickyColunWidth}px`,left:`${e}px`,borderBottomColor:"colors.neutral.300",backgroundColor:"colors.white"},t&&Lo(o)),r===_gallyadminshared.DataContentType.SELECT&&{overflow:"visible"})}function Or(e,o,t,r){return p({left:`${o}px`,borderBottomColor:"colors.neutral.300",backgroundColor:"colors.white",zIndex:"1"},e&&r===0&&Lo(t))}function _r(e){return p({backgroundColor:"colors.white",borderBottomColor:"colors.neutral.300"},e===_gallyadminshared.DataContentType.SELECT&&{overflow:"visible"})}function sg(e){let r=e,{className:o}=r,t=N(r,["className"]);return _react2.default.createElement(_material.Tooltip,y(p({},t),{arrow:!0,classes:{popper:o}}))}var Xo=sg;function lg({title:e,children:o,noStyle:t,withHTMLTitle:r}){return _react2.default.createElement(Xo,{title:typeof e=="string"&&r?_react2.default.createElement("span",{dangerouslySetInnerHTML:{__html:e}}):e,placement:"right"},_react2.default.createElement("span",{style:{display:"inline-block",paddingLeft:t?"":"10px",marginBottom:t?"":"-5px"}},o||_react2.default.createElement(B,{name:"informationCircle",tooltip:!0})))}var G=lg;var ro=_system.styled.call(void 0, (0, _material.FormControl))(({fullWidth:e,theme:o})=>p({"& .MuiFormLabel-root":{color:o.palette.colors.neutral[900]},"& .MuiFormLabel-root.Mui-error":{color:o.palette.colors.neutral[900]},"& label":{position:"relative"}},e&&{".MuiInputBase-root":{width:"100%",maxWidth:"initial"}})),ug=["dirty","small","transparent"],Xt=_system.styled.call(void 0, _material.InputBase,{shouldForwardProp:e=>!ug.includes(e)})(({dirty:e,inputProps:o,small:t,theme:r,transparent:n,type:i,value:s})=>{let a;return i==="number"&&(a="3em"),o!=null&&o.max&&(a=`${Math.max(String(o.max).length,3)}em`),o!=null&&o.maxLength&&(a=`${Math.max(o.maxLength,3)}em`),y(p(p(p(p(p({minHeight:"40px",borderRadius:8,borderStyle:"solid",borderWidth:"1px",borderColor:r.palette.colors.neutral[300],padding:`3px ${r.spacing(2)}`,minWidth:a?"unset":180,backgroundColor:r.palette.colors.white,color:r.palette.colors.neutral[900],fontSize:14,lineHeight:0,fontWeight:400,transition:"border-color 0.3s linear"},Boolean(s)&&{borderColor:r.palette.colors.neutral[400]}),t===!1&&{".MuiAutocomplete-input":{width:"auto!important"}}),Boolean(t)&&{minHeight:"26px",minWidth:"initial",width:"max-content",paddingTop:0,paddingBottom:0,paddingLeft:r.spacing(1),paddingRight:r.spacing(1),borderRadius:"13px"}),Boolean(n)&&{background:"transparent",border:"0"}),Boolean(e)&&{fontWeight:"bold"}),{"& .MuiInputBase-input":p(p({padding:0,width:a,"&::placeholder":{color:r.palette.colors.neutral[600],opacity:1},"&.Mui-disabled":{color:r.palette.colors.neutral[600],WebkitTextFillColor:r.palette.colors.neutral[600],"&.MuiInputBase-inputAdornedEnd":{color:r.palette.colors.neutral[500],WebkitTextFillColor:r.palette.colors.neutral[500]}}},Boolean(t)&&{width:"72px",fontSize:"12px",fontWeight:"bold"}),t===!1&&{fontWeight:"bold",fontSize:"12px"}),"&:hover":{borderColor:r.palette.colors.neutral[400]},"&:focus-within":p({borderColor:r.palette.colors.neutral[600]},Boolean(n)&&{backgroundColor:"rgba(0, 0, 0, 0.075)"}),"& .MuiInputBase-input::placeholder":p({color:r.palette.colors.neutral[600],opacity:1},Boolean(t)&&{fontWeight:"normal"}),"&.MuiInputBase-colorSuccess":{borderColor:r.palette.success.main},"&.MuiInputBase-colorError":{borderColor:r.palette.error.main},"&.Mui-error":{borderColor:r.palette.error.main},"&.Mui-disabled":{borderColor:r.palette.colors.neutral[300],backgroundColor:r.palette.colors.neutral[300]},"& .MuiInputAdornment-root":{fontSize:14,color:r.palette.colors.neutral[900]},"&.MuiAutocomplete-inputRoot":{maxWidth:"400px"},"& .MuiAutocomplete-endAdornment":{top:0,right:"12px",height:"100%",display:"flex",alignItems:"center"},"& .MuiAutocomplete-popupIndicator ion-icon, & .MuiAutocomplete-clearIndicator ion-icon":{fontSize:14,color:r.palette.colors.neutral[900]},"& .MuiAutocomplete-tag":{marginTop:"2px",marginBottom:"2px"}})}),Vr=_system.styled.call(void 0, "div")(({theme:e})=>({alignItems:"center",display:"flex","label + &":{marginTop:e.spacing(.5)}})),qr=_system.styled.call(void 0, "span")(({theme:e})=>({fontFamily:"var(--gally-font)",fontSize:"14px",fontWeight:400,lineHeight:"20px",textAlign:"center",color:e.palette.colors.neutral[600],marginLeft:e.spacing(1)}));function gg(e,o){let g=e,{error:t,fullWidth:r,helperText:n,helperIcon:i,id:s,infoTooltip:a,label:l,margin:d,onChange:c,required:u,suffix:f,value:h,requiredLabel:b,dataTestId:x,inputProps:F}=g,C=N(g,["error","fullWidth","helperText","helperIcon","id","infoTooltip","label","margin","onChange","required","suffix","value","requiredLabel","dataTestId","inputProps"]);function I(T){let{value:w}=T.target;c&&c(Gt(w,e),T)}return _react2.default.createElement(ro,{error:t,fullWidth:r,margin:d,variant:"standard"},Boolean(l||a)&&_react2.default.createElement(_material.InputLabel,{shrink:!0,htmlFor:s,required:b||u},l,a?_react2.default.createElement(G,{title:a}):null),_react2.default.createElement(Vr,{className:"InputText__Wrapper"},_react2.default.createElement(Xt,p({id:s,onChange:I,required:u,ref:o,value:(h!=null?h:"").toString(),inputProps:y(p({},F),{"data-testid":x})},C)),Boolean(f)&&_react2.default.createElement(qr,null,f)),Boolean(n)&&_react2.default.createElement(_material.FormHelperText,{"data-testid":x?`${x}ErrorMessage`:null},Boolean(i)&&_react2.default.createElement(B,{name:i,style:{fontSize:18,marginRight:2}}),n))}var Ie=_react.forwardRef.call(void 0, gg);var Cg=_system.styled.call(void 0, _PickersDay.PickersDay,{shouldForwardProp:e=>e!=="dayIsBetween"&&e!=="isFirstDay"&&e!=="isLastDay"})(({theme:e})=>({fontWeight:500,[`&&.${_PickersDay.pickersDayClasses.selected}`]:{backgroundColor:e.palette.colors.primary[400],color:"white"},[`&&.${_PickersDay.pickersDayClasses.selected}, &:hover, &:focus`]:{backgroundColor:e.palette.colors.primary[400],color:"white"}}));function Tg(){return _react2.default.createElement(B,{name:"calendar-outline",style:{fontSize:18,padding:"0px"}})}function Sg(){return _react2.default.createElement(B,{name:"chevron-down-outline",style:{fontSize:18,padding:"0px"}})}function vg(e,o){let{t}=_nexti18next.useTranslation.call(void 0, "common"),c=e,{value:r,onChange:n,onError:i,dataTestId:s}=c,a=N(c,["value","onChange","onError","dataTestId"]);function l(u){let f=u;u instanceof Date&&(f=new Date(Date.UTC(u.getFullYear(),u.getMonth(),u.getDate()))),n(f)}return _react2.default.createElement(_DatePicker.DatePicker,{value:r,onChange:l,onError:i,renderDay:(u,f,h)=>_react2.default.createElement(Cg,p({},h)),components:{OpenPickerIcon:Tg,SwitchViewIcon:Sg},inputRef:o,renderInput:u=>{let g=u,{InputProps:f,inputProps:h}=g,b=N(g,["InputProps","inputProps"]),{onChange:x,readOnly:F,type:C,value:I}=h;return _react2.default.createElement(Ie,y(p(p(p({},f),b),a),{onChange:(T,w)=>x(w),placeholder:t("date.placeholder"),readOnly:F,ref:u.ref,type:C,value:I,dataTestId:s}))}})}var It=_react.forwardRef.call(void 0, vg);var _datefns = require('date-fns');function Wr(e,o,t,r){return r?r(e,o):!e&&t?"valueMissing":!e||_datefns.isValid.call(void 0, e)?"":"invalidDate"}function Fg(e){let c=e,{onChange:o,showError:t,additionalValidator:r}=c,n=N(c,["onChange","showError","additionalValidator"]),i=_react.useCallback.call(void 0, (b,x)=>Wr(b,x,n.required,r),[r,n.required]),[u,...f]=me(o,n.value,t,i,n.disabled),h=u,{ref:s}=h,a=N(h,["ref"]),[l]=f;function d(b){l(b)}return _react2.default.createElement(It,y(p(p({},n),a),{error:(n==null?void 0:n.error)||(a==null?void 0:a.error),helperIcon:(n==null?void 0:n.helperIcon)||(a==null?void 0:a.helperIcon),helperText:(n==null?void 0:n.helperText)||(a==null?void 0:a.helperText),onError:d,ref:s}))}var si=Fg;var Mo=_system.styled.call(void 0, "div")(({fullWidth:e,margin:o,theme:t})=>p(p(p(p({display:"inline-flex",flexDirection:"column",position:"relative",minWidth:0,padding:0,margin:0,border:0,verticalAlign:"top","& .MuiFormLabel-root":{color:t.palette.colors.neutral[900],fontFamily:"var(--gally-font)",padding:0,display:"block",transformOrigin:"top left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"133%",position:"relative",left:0,top:0,transform:"none",fontWeight:500,lineHeight:"20px",fontSize:"14px"},"& .MuiFormLabel-root.Mui-error":{color:t.palette.colors.neutral[900]}},o==="normal"&&{marginTop:16,marginBottom:8}),o==="dense"&&{marginTop:8,marginBottom:4}),e&&{width:"100%"}),e&&{".MuiInputBase-root":{width:"100%",maxWidth:"initial"}}));var Al=_system.styled.call(void 0, (0, _material.Box))(({theme:e})=>({fontWeight:500,fontFamily:"var(--gally-font)",fontSize:"14px",lineHeight:"20px",color:e.palette.colors.neutral[600]}));function Og(e,o){let L=e,{value:t,error:r,errors:n,fullWidth:i,helperText:s,helperIcon:a,id:l,infoTooltip:d,inputProps:c,label:u,margin:f,onChange:h,onError:b,required:x,dataTestId:F}=L,C=N(L,["value","error","errors","fullWidth","helperText","helperIcon","id","infoTooltip","inputProps","label","margin","onChange","onError","required","dataTestId"]),{t:I}=_nexti18next.useTranslation.call(void 0, "common");function g(P){h(y(p({},t),{fromDate:P}))}function T(P){h(y(p({},t),{toDate:P}))}function w(P){b&&b(y(p({},n),{from:P}))}function k(P){b&&b(y(p({},n),{to:P}))}return _react2.default.createElement(Mo,{error:r,fullWidth:i,margin:f},Boolean(u||d)&&_react2.default.createElement(_material.InputLabel,{shrink:!0,htmlFor:l,required:x},u,d?_react2.default.createElement(G,{title:d}):null),_react2.default.createElement(_material.Grid,{justifyContent:"flex-start",alignItems:"center",container:!0,sx:{marginTop:u?"4px":"0px"}},_react2.default.createElement(Al,{sx:{paddingRight:"20px"}}," ",I("form.from")," "),_react2.default.createElement(_material.Grid,{item:!0,xs:!0},_react2.default.createElement(It,y(p({},C),{required:x,error:r,fullWidth:i,inputProps:c,value:t==null?void 0:t.fromDate,onChange:g,onError:w,ref:o,dataTestId:F?`${F}Start`:null}))),_react2.default.createElement(Al,{sx:{paddingRight:"20px",paddingLeft:"20px"}},I("form.to")),_react2.default.createElement(_material.Grid,{item:!0,xs:!0},_react2.default.createElement(It,y(p({},C),{required:x,error:r,fullWidth:i,inputProps:c,value:t==null?void 0:t.toDate,onChange:T,onError:k,dataTestId:F?`${F}End`:null})))),Boolean(s)&&_react2.default.createElement(_material.FormHelperText,{error:r,"data-testid":F?`${F}ErrorMessage`:null},Boolean(a)&&_react2.default.createElement(B,{name:a,style:{fontSize:18,marginRight:2}}),s))}var pi=_react.forwardRef.call(void 0, Og);function Hg(e,o,t,r){if(r)return r(e,o);if(t&&(!e.fromDate||!e.toDate))return"valueMissing";let n=typeof e.fromDate=="string"?new Date(e.fromDate):e.fromDate,i=typeof e.toDate=="string"?new Date(e.toDate):e.toDate,s=Wr(n);if(s)return s;let a=Wr(i);return a||(!e.toDate||!e.fromDate||n<=i?"":"doubleDatePickerRange")}function Vg(e){let d=e,{onChange:o,showError:t,additionalValidator:r,replacementErrorsMessages:n}=d,i=N(d,["onChange","showError","additionalValidator","replacementErrorsMessages"]),s=_react.useCallback.call(void 0, (f,h)=>Hg(f,h,i.required,r),[r,i.required]),[c]=me(o,i.value,t,s,i.disabled,n),u=c,{ref:a}=u,l=N(u,["ref"]);return _react2.default.createElement(pi,y(p(p({},i),l),{ref:a}))}var di=Vg;var $t=_system.styled.call(void 0, "div")(({theme:e})=>y(p({minWidth:"180px",background:e.palette.colors.white,border:`1px solid ${e.palette.colors.neutral[300]}`,borderRadius:8,margin:"4px 0",overflow:"auto"},_gallyadminshared.getCustomScrollBarStyles.call(void 0, e)),{"& .MuiAutocomplete-listbox":{padding:0},"& .MuiAutocomplete-listbox .MuiAutocomplete-option":{listStyle:"none",padding:"8px 12px",cursor:"default",fontWeight:400,fontSize:12,lineHeight:"18px",color:e.palette.colors.neutral[800],'&[aria-selected="true"]':{backgroundColor:"transparent",fontWeight:"bold"},"&.Mui-focused":{backgroundColor:e.palette.colors.neutral[200]},'&[aria-disabled="true"]':{color:e.palette.colors.neutral[400]},'&.Mui-focused:not([aria-disabled="true"])':{backgroundColor:e.palette.colors.neutral[200]}}})),Gr=_system.styled.call(void 0, $t)({"& .MuiAutocomplete-listbox .MuiAutocomplete-option":{padding:"5px 12px"}});function Kg(e,o){var v,M;let S=e,{disabled:t,fullWidth:r,limitTags:n,multiple:i,onChange:s,options:a,style:l,value:d,useGroups:c,objectKeyValue:u,dataTestId:f}=S,h=N(S,["disabled","fullWidth","limitTags","multiple","onChange","options","style","value","useGroups","objectKeyValue","dataTestId"]),{required:b,small:x}=h,{t:F}=_nexti18next.useTranslation.call(void 0, "common"),C=_react.useRef.call(void 0, null),I=_react.useMemo.call(void 0, ()=>new Map(a.map(E=>[E.value,E])),[a]),g=d instanceof Array?d.map(E=>typeof E=="object"?I.get(E[u]):I.get(E)):d instanceof Object&&u?(v=I.get(d[u]))!=null?v:null:(M=I.get(d))!=null?M:null;function T(E,D){let O=y(p({},E),{target:(o||C).current});setTimeout(()=>{!D&&!b?s(null,O):D instanceof Array?s(D.map(({value:H})=>u?{[u]:H}:H),O):D&&s(u?{[u]:D.value}:D.value,O)},0)}let w=F("form.clear"),k=F("form.close"),L=F("form.open"),P,A;return i?(P=(E,{label:D},{selected:O})=>_react2.default.createElement("li",y(p({},E),{"data-testid":f?`${f}DropdownOption`:null}),_react2.default.createElement(go,{checked:O,label:D,list:!0,onClick:H=>H.preventDefault(),dataTestId:f?`${f}Checkbox`:null})),A=(E,D)=>E.filter(O=>O).map((O,H)=>{var z;return _react2.default.createElement(Ee,p({key:(z=O.id)!=null?z:String(O.value),label:O.label,size:x?"small":"medium","data-testid":f?`${f}Tag`:null},D({index:H})))})):P=(E,D)=>_react2.default.createElement(_material.ListItem,y(p({},E),{"data-testid":f?`${f}DropdownOption`:null}),D.label),_react2.default.createElement(_material.FormControl,{fullWidth:r,variant:"standard"},_react2.default.createElement(_material.Autocomplete,{PaperComponent:x?Gr:$t,clearIcon:_react2.default.createElement(B,{name:"close"}),clearText:w,closeText:k,componentsProps:{popper:{placement:"bottom-start"}},disableClearable:b,disableCloseOnSelect:i,disabled:t,getOptionDisabled:E=>E.disabled,limitTags:n,multiple:i,onChange:T,openText:L,options:a,groupBy:c?E=>E.id:void 0,getOptionLabel:c?E=>E.label:void 0,popupIcon:_react2.default.createElement(B,{"data-testid":f?`${f}Button`:null,name:"chevron-down"}),renderGroup:E=>_react2.default.createElement("li",{key:E.key},_react2.default.createElement(_material.ListSubheader,{"data-testid":f?`${f}GroupTitle`:null},E.group),_react2.default.createElement("ul",{style:{padding:0}},E.children)),renderInput:E=>{let z=E,{InputLabelProps:D,InputProps:O}=z,H=N(z,["InputLabelProps","InputProps"]);return _react2.default.createElement(Ie,y(p(p(p({},y(p({},h),{required:!1})),H),O),{fullWidth:r,inputRef:o||C,requiredLabel:b,dataTestId:f?`${f}InputText`:null}))},renderOption:P,renderTags:A,style:p({width:"fit-content"},l),value:g,selectOnFocus:!1,"data-testid":f}))}var Me=_react.forwardRef.call(void 0, Kg);function Zg(e){let d=e,{onChange:o,showError:t,additionalValidator:r,replacementErrorsMessages:n}=d,i=N(d,["onChange","showError","additionalValidator","replacementErrorsMessages"]),s=_react.useCallback.call(void 0, (f,h)=>r?r(f,h):i.required&&(f===void 0||f===""||f.length===0)?"valueMissing":"",[r,i.required]),[c]=me(o,i.value,t,s,i.disabled,n),u=c,{ref:a}=u,l=N(u,["ref"]);return _react2.default.createElement(Me,y(p(p({},i),l),{error:(i==null?void 0:i.error)||(l==null?void 0:l.error),helperIcon:(i==null?void 0:i.helperIcon)||(l==null?void 0:l.helperIcon),helperText:(i==null?void 0:i.helperText)||(l==null?void 0:l.helperText),ref:a}))}var pe=Zg;function th(e){let d=e,{onChange:o,showError:t,additionalValidator:r,replacementErrorsMessages:n}=d,i=N(d,["onChange","showError","additionalValidator","replacementErrorsMessages"]),s=_react.useCallback.call(void 0, (f,h)=>r?r(f,h):"",[r]),[c]=me(o,i.value,t,s,i.disabled,n),u=c,{ref:a}=u,l=N(u,["ref"]);return _react2.default.createElement(Ie,y(p(p({},i),l),{error:(i==null?void 0:i.error)||(l==null?void 0:l.error),helperIcon:(i==null?void 0:i.helperIcon)||(l==null?void 0:l.helperIcon),helperText:(i==null?void 0:i.helperText)||(l==null?void 0:l.helperText),inputRef:a,ref:null}))}var Te=th;function ph(e){let u=e,{error:o,helperText:t,helperIcon:r,options:n,onChange:i,infoTooltip:s,label:a,defaultValue:l}=u,d=N(u,["error","helperText","helperIcon","options","onChange","infoTooltip","label","defaultValue"]),c=n.find(f=>f.default);return _react2.default.createElement(_material.FormControl,{variant:"standard",margin:"normal"},Boolean(a||s)&&_react2.default.createElement(_material.InputLabel,{shrink:!0,style:{position:"relative"},required:d.required},a,Boolean(s)&&_react2.default.createElement(G,{title:s})),_react2.default.createElement(_material.RadioGroup,y(p({},d),{onChange:(f,h)=>{i(h,f)},defaultValue:l||(d.defaultChecked?c==null?void 0:c.value:null)}),n.map(f=>_react2.default.createElement(_material.FormControlLabel,{disabled:f.disabled,key:f.label,value:f.value,control:_react2.default.createElement(_material.Radio,null),label:f.label}))),Boolean(t)&&_react2.default.createElement(_material.FormHelperText,{error:o,sx:{marginTop:"-5px"}},Boolean(r)&&_react2.default.createElement(B,{name:r,style:{fontSize:18,marginRight:2}}),t))}var ui=ph;function uh(e){let d=e,{onChange:o,showError:t,additionalValidator:r,replacementErrorsMessages:n}=d,i=N(d,["onChange","showError","additionalValidator","replacementErrorsMessages"]),s=_react.useCallback.call(void 0, (f,h)=>r?r(f,h):i.required&&!f?"valueMissing":"",[r,i.required]),[c]=me(o,i.value,t,s,!1,n),u=c,{ref:a}=u,l=N(u,["ref"]);return _react2.default.createElement(_react2.default.Fragment,null,_react2.default.createElement(ui,y(p(p({},i),l),{error:(i==null?void 0:i.error)||(l==null?void 0:l.error),helperIcon:(i==null?void 0:i.helperIcon)||(l==null?void 0:l.helperIcon),helperText:(i==null?void 0:i.helperText)||(l==null?void 0:l.helperText)})),_react2.default.createElement(Ie,{style:{display:"none"},inputRef:a}))}var ci=uh;function mh(e){let r=e,{margin:o}=r,t=N(r,["margin"]);return _react2.default.createElement("div",p({},t))}var kk=_system.styled.call(void 0, mh)(({margin:e,theme:o})=>y(p(p({position:"relative"},e==="dense"&&{marginTop:o.spacing(1),marginBottom:o.spacing(.5)}),e==="normal"&&{marginTop:o.spacing(2),marginBottom:o.spacing(1)}),{"& label":{position:"absolute",left:0,top:0},"& .MuiFormLabel-root":{color:o.palette.colors.neutral[900]},"& .MuiFormLabel-root.Mui-error":{color:o.palette.colors.neutral[900]}})),Bl=_system.styled.call(void 0, Xt)({margin:"0 0.5em"}),Dl=_system.styled.call(void 0, Xt)({margin:"0 0 0 0.5em"});function xh(e,o){let{t}=_nexti18next.useTranslation.call(void 0, "common"),S=e,{error:r,fullWidth:n,helperText:i,helperIcon:s,id:a,infoTooltip:l,inputProps:d,label:c,margin:u="none",onChange:f,placeholder:h=[],required:b,suffix:x,value:F,type:C="number",dataTestId:I}=S,g=N(S,["error","fullWidth","helperText","helperIcon","id","infoTooltip","inputProps","label","margin","onChange","placeholder","required","suffix","value","type","dataTestId"]),[T,w]=h,[k,L]=F;function P(v){let{value:M}=v.target;f&&f([Gt(M,e),L],v)}function A(v){let{value:M}=v.target;f&&f([k,Gt(M,e)],v)}return _react2.default.createElement(Mo,{fullWidth:n,margin:u},Boolean(c||l)&&_react2.default.createElement(_material.InputLabel,{shrink:!0,htmlFor:a,required:b},c,l?_react2.default.createElement(G,{title:l}):null),_react2.default.createElement(Vr,{className:"InputText__Wrapper"},t("form.from"),_react2.default.createElement(Bl,y(p({error:r,id:a,onChange:P,required:b},g),{type:C,inputProps:y(p({},d),{max:L,"data-testid":I?`${I}First`:null}),placeholder:T,value:k?String(k):"",inputRef:o})),t("form.to"),_react2.default.createElement(Dl,y(p({error:r,onChange:A,required:b},g),{type:C,inputProps:y(p({},d),{min:k,"data-testid":I?`${I}Second`:null}),placeholder:w,value:L?String(L):""})),Boolean(x)&&_react2.default.createElement(qr,null,x)),Boolean(i)&&_react2.default.createElement(_material.FormHelperText,{error:r,"data-testid":I?`${I}ErrorMessage`:null},Boolean(s)&&_react2.default.createElement(B,{name:s,style:{fontSize:18,marginRight:2}}),i))}var fi=_react.forwardRef.call(void 0, xh);function Ch(e){let d=e,{onChange:o,showError:t,additionalValidator:r,replacementErrorsMessages:n}=d,i=N(d,["onChange","showError","additionalValidator","replacementErrorsMessages"]),s=_react.useCallback.call(void 0, (f,h)=>r?r(f,h):i.required&&(!f[0]&&f[0]!==0||!f[1]&&f[1]!==0)?"valueMissing":"",[r,i.required]),[c]=me(o,i.value,t,s,i.disabled,n),u=c,{ref:a}=u,l=N(u,["ref"]);return _react2.default.createElement(fi,y(p(p({},i),l),{error:(i==null?void 0:i.error)||(l==null?void 0:l.error),helperIcon:(i==null?void 0:i.helperIcon)||(l==null?void 0:l.helperIcon),helperText:(i==null?void 0:i.helperText)||(l==null?void 0:l.helperText),ref:a}))}var gi=Ch;var _Box = require('@mui/material/Box'); var _Box2 = _interopRequireDefault(_Box);var _Slider = require('@mui/material/Slider'); var _Slider2 = _interopRequireDefault(_Slider);var Ol=_system.styled.c