@elastic-suite/gally-admin-components
Version:
Components package for gally admin BO
1 lines • 300 kB
JavaScript
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())});import Hn,{forwardRef as Lc}from"react";import{IconButton as Ac,Alert as Mc}from"@mui/material";import{styled as Bc}from"@mui/system";import{useTranslation as Dc}from"next-i18next";import On from"react";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?On.createElement("ion-icon",p({src:_n[o]},i)):o in zn?On.createElement("ion-icon",p({name:zn[o]},i)):On.createElement("ion-icon",p({name:o},i))}var B=kc;var Nc=Bc(Mc)(({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}=Dc("alert");function l(){n==null||n(t)}return Hn.createElement(Nc,{action:Hn.createElement(Ac,{"aria-label":"close",color:"inherit",size:"small",onClick:l},Hn.createElement(B,{name:"close",style:{fontSize:18,padding:"0px"}})),ref:o,severity:i,sx:{mb:s}},a(r))}var Oe=Lc(Oc);import yr from"react";import{Box as Vn}from"@mui/system";import{useTranslation as _c}from"next-i18next";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}=_c("boost"),i=zc(o,t,r,n);return yr.createElement(Vn,{sx:{display:"flex",gap:"4px"}},yr.createElement(Vn,{sx:{backgroundColor:i.boostColor,color:i.boostTextColor,height:"20px",width:"20px",borderRadius:"50%",display:"flex",justifyContent:"center",alignItems:"center"}},yr.createElement(B,{name:i.boostIconName,style:o==="straight"?{width:"14px",height:"14px"}:{width:"14px",height:"8px"}})),t!==void 0&&r!==void 0&&yr.createElement(Vn,{sx:{color:i.boostTextColor,fontFamily:"var(--gally-font)",fontWeight:"500",fontSize:"12px",lineHeight:"18px"}},i.boostText))}var qn=Hc;import As from"react";import{Typography as Vc}from"@mui/material";import{styled as Wn}from"@mui/system";var Ms=Wn("span")({fontWeight:"500",fontSize:"12px",lineHeight:"18px"}),qc=Wn(Ms)(({theme:e})=>({color:e.palette.colors.neutral[500]})),Wc=Wn(Ms)(({theme:e})=>({color:e.palette.colors.neutral[800]}));function Gc(e){let{label:o,last:t}=e;return As.createElement(Vc,null,As.createElement(t?Wc:qc,null,o))}var Gn=Gc;import Bs from"react";import{Breadcrumbs as Xc}from"@mui/material";import{findBreadcrumbLabel as Jc,getSlugArray as $c}from"@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=$c(t).map((n,i,s)=>({key:n,label:Jc(i,s,o.hierarchy),last:s.length<=i+1})).filter(({label:n})=>n);return Bs.createElement(Xc,{"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 Bs.createElement(Gn,p({key:n},i))}))}var Xn=Rc;import Jn from"react";import{styled as Uc}from"@mui/system";import{IconButton as jc,Chip as Kc}from"@mui/material";var Yc=Uc(Kc)(({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 Jn.createElement(Yc,y(p({disabled:o},e),{style:{opacity:1},deleteIcon:Jn.createElement(jc,null,Jn.createElement(B,{name:"close"}))}))}var Ee=Qc;import Zc from"react";import{Box as em}from"@mui/material";function om({onClose:e}){return Zc.createElement(em,{sx:{position:"fixed",width:"100vw",height:"100vh",zIndex:99,left:"0",top:"0"},onClick:e})}var $n=om;import Vt,{forwardRef as tm}from"react";import{FormControlLabel as rm,FormHelperText as nm,Checkbox as im}from"@mui/material";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 Vt.createElement(rm,{componentsProps:{typography:{variant:a?"caption":"body2"}},control:Vt.createElement(im,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:Vt.createElement("div",null,s,Boolean(n)&&Vt.createElement(nm,{error:t},Boolean(r)&&Vt.createElement(B,{name:r,style:{fontSize:18,marginRight:2}}),n)),sx:p({},Boolean(c)&&{marginLeft:"-6px"}),"data-testid":u})}var go=tm(am);import Qf,{useCallback as Zf}from"react";import{useCallback as eo,useLayoutEffect as Am,useMemo as Wt,useRef as Mm,useState as Bm}from"react";import Dm from"next/router";import{useTranslation as ol}from"next-i18next";import Un from"lodash.debounce";import{AuthError as Nm,LoadStatus as qt,defaultPageSize as tl,fetchApi as Om,fetchApiUsingPagination as _m,getListApiParameters as zm,isError as jn,storageRemove as Hm,tokenStorageKey as Vm}from"@elastic-suite/gally-admin-shared";import{useCallback as sm}from"react";import{closeSnackbar as lm,enqueueSnackbar as pm}from"notistack";import{log as dm}from"@elastic-suite/gally-admin-shared";function Ce(e="error"){return sm(o=>dm(o,t=>pm(t,{onShut:lm,variant:e,preventDuplicate:!0})),[e])}import{useCallback as wr,useMemo as el}from"react";import{useRouter as Pm}from"next/router";import{IMainContext as Em,Method as Pr,contentTypeHeader as Fm,getApiUrl as km,getResource as Lm,updatePropertiesAccordingToPath as Zs}from"@elastic-suite/gally-admin-shared";import{createSlice as um}from"@reduxjs/toolkit";var cm={api:null,bundles:null,configurations:null},Ds=um({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=Ds.reducer,gt=e=>e.data.api,Eo=e=>e.data.bundles,Fo=e=>e.data.configurations;import{useDispatch as mm,useSelector as fm}from"react-redux";var ko=()=>mm(),q=fm;import{createSlice as gm}from"@reduxjs/toolkit";var hm={language:"en"},_s=gm({name:"i18n",initialState:hm,reducers:{setLanguage(e,o){e.language=o.payload}}}),{setLanguage:zs}=_s.actions,Hs=_s.reducer,Cr=e=>e.i18n.language;import{createSlice as bm}from"@reduxjs/toolkit";import{LoadStatus as xm}from"@elastic-suite/gally-admin-shared";var Im={menu:{status:xm.IDLE,data:{hierarchy:[]}},menuItemActive:"",sidebarState:!0,sidebarStateTimeout:!1,childrenState:{}},Vs=bm({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=Vs.reducer,Js=e=>e.menu.childrenState,Sr=e=>e.menu.menu.data,$s=e=>e.menu.menuItemActive,vr=e=>e.menu.sidebarState,Rs=e=>e.menu.sidebarStateTimeout;import{combineReducers as Tm,configureStore as Sm}from"@reduxjs/toolkit";import vm from"redux-thunk";import{createSlice as ym}from"@reduxjs/toolkit";var Cm={requestedPath:null},Us=ym({name:"user",initialState:Cm,reducers:{setRequestedPath(e,o){e.requestedPath=o.payload}}}),{setRequestedPath:js}=Us.actions,Ks=Us.reducer,Ys=e=>e.user.requestedPath;var wm=Tm({data:Os,i18n:Hs,menu:Xs,user:Ks}),Qs=e=>Sm({middleware:o=>process.env.NODE_ENV==="development"?o({serializableCheck:{ignoredActionPaths:["payload.error"],ignoredPaths:["menu.menu.error"]}}):[vm],preloadedState:e,reducer:wm});function W(e,o=Em.GRID){let t=q(gt),{pathname:r}=Pm();return el(()=>{let n=Lm(t,e);return y(p({},n),{supportedProperty:(n==null?void 0:n.supportedProperty)instanceof Array?n==null?void 0:n.supportedProperty.map(i=>Zs(i,r,o)):n!=null&&n.supportedProperty?[Zs(n.supportedProperty,r,o)]:n==null?void 0:n.supportedProperty})},[t,r,o,e])}function ht(e){let{supportedOperation:o}=e,t=le(),r=km(e.url),n=wr((l,d)=>t(`${r}/${l}`,void 0,{body:JSON.stringify(d),method:Pr.PATCH,headers:{[Fm]:"application/merge-patch+json"}}),[r,t]),i=wr(l=>t(r,void 0,{body:JSON.stringify(l),method:Pr.POST}),[r,t]),s=wr(l=>t(`${r}/${l.id}`,void 0,{body:JSON.stringify(l),method:Pr.PUT}),[r,t]),a=wr(l=>t(`${r}/${l}`,void 0,{method:Pr.DELETE}),[r,t]);return el(()=>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}=ol("common"),t=Ce(),{t:r}=ol("alert");return eo((n,i,s)=>J(this,null,function*(){try{return yield Om(o.language,n,i,s,e)}catch(a){return e&&a instanceof Nm?(Hm(Vm),Dm.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]=Bm({status:qt.IDLE}),c=eo(h=>{d(b=>y(p({},b),{data:h instanceof Function?h(b.data):h}))},[]),u=eo(()=>{if(n){if(d(h=>({data:h.data,status:qt.LOADING})),!e)return d({data:null,status:qt.SUCCEEDED});s?_m(a,e,o,t,s).then(h=>{d(h)}):a(e,o,t).then(h=>{jn(h)?d({error:h.error,status:qt.FAILED}):d({data:h,status:qt.SUCCEEDED})})}},[n,a,t,e,o,s]),f=Wt(()=>Un(h=>h(),Kn),[]);return Am(()=>{i?f(u):u()},[u,f,i]),[l,c,u]}function ce(e,o=0,t=tl,r,n,i=!1,s=!1){let a=Wt(()=>zm(o,t,r,n),[o,t,r,n]),[l,d,c]=Fe(e,a,void 0,!0,!0,i,s?t:void 0),u=eo(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=tl,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=Mm({}),x=Wt(()=>Un((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=eo((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=eo((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=eo((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=eo(P=>J(this,null,function*(){let A=yield c(P);!jn(A)&&a.data["hydra:member"].length<t&&d()}),[c,d,a,t]),T=Wt(()=>Un((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=eo((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=eo(P=>J(this,null,function*(){l(S=>S.filter(v=>v.id!==P));let A=yield u(P);(jn(A)||a.data["hydra:member"].length===t)&&d()}),[d,u,a,t,l]),L=Wt(()=>{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]}import{useMemo as nl}from"react";import{useTranslation as qm}from"next-i18next";import{getFilter as Wm,getMappings as Gm}from"@elastic-suite/gally-admin-shared";function il(e,o){let{t}=qm("api"),r=nl(()=>Gm(e,o),[e,o]);return nl(()=>r.map(n=>Wm(n,t)),[r,t])}import{useTranslation as Jm}from"next-i18next";import{useMemo as Qn}from"react";import{getFieldHeader as $m}from"@elastic-suite/gally-admin-shared";import{useMemo as Xm}from"react";function al(e){return Xm(()=>{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}=Jm("api"),t=al(e);return Qn(()=>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=>$m(r,o)),[o,t])}var Yn="_other";function sl(e){let o=Zn(e);return Qn(()=>{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 Qn(()=>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])}import{getLocalizedCatalog as Rm}from"@elastic-suite/gally-admin-shared";import{useMemo as Er,useState as pl}from"react";function dl(e){let[o,t]=pl(-1),[r,n]=pl(-1),i=Er(()=>e.find(l=>l.id===o),[o,e]),s=Er(()=>i==null?void 0:i.localizedCatalogs.find(l=>l.id===r),[i,r]),a=Er(()=>e?Rm(e,i,s):null,[i,e,s]);return Er(()=>({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])}import{useEffect as Um}from"react";import{LoadStatus as ei,useSchemaLoader as jm}from"@elastic-suite/gally-admin-shared";function ul(){let e=ko(),o=Ce(),t=jm(),[r]=Fe("extra_bundles",void 0,void 0,!1),[n]=Fe("configurations",void 0,void 0,!1);Um(()=>{t.status===ei.FAILED&&o(t.error),r.status===ei.FAILED&&o(r.error),n.status===ei.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])}import{useEffect as Km,useMemo as Ym,useState as oi}from"react";import{useRouter as Fr}from"next/router";import{getApiFilters as Qm,getAppUrl as Zm,getFilterParameters as ef,getPageParameter as of,getParametersFromUrl as ti,getRouterUrl as ri,getSearchParameter as tf}from"@elastic-suite/gally-admin-shared";function cl(e=0,o,t,r=!0){let n=Fr();Km(()=>{if(r){let i=Zm(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=Fr(),[o,t]=oi(()=>{let r=ri(e.asPath),n=ti(r);return of(n)});return[o,t]}function oo(e){let o=Fr(),[t,r]=oi(()=>{let n=ri(o.asPath),i=ti(n);return ef(e,i)});return[t,r]}function fl(){let e=Fr(),[o,t]=oi(()=>{let r=ri(e.asPath),n=ti(r);return tf(n)});return[o,t]}function gl(...e){return Ym(()=>Qm(Object.assign({},...e)),e)}import{useCallback as hl,useEffect as rf,useMemo as nf,useRef as af,useState as bl}from"react";import{useTranslation as sf}from"next-i18next";import{getFormValidityError as lf}from"@elastic-suite/gally-admin-shared";function me(e,o,t=!1,r,n=!1,i){let[s,a]=bl(""),l=af(null),{t:d}=sf("common"),[c,u]=bl(!1),f=hl((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=lf(T))}return a(C||""),C===null||C===""},[l,r]);rf(()=>{c||f(o,void 0,!0)},[f,o,c]);let h=hl((b,x)=>{c||u(!0),f(b,x),e&&e(b,x)},[e,f,c]);return nf(()=>{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])}import{useCallback as ni,useEffect as pf,useState as df}from"react";import uf from"next/router";import{useTranslation as xl}from"next-i18next";import{AuthError as cf,LoadStatus as kr,fetchGraphql as mf,isError as ff,storageRemove as gf,tokenStorageKey as hf}from"@elastic-suite/gally-admin-shared";function ii(e=!0){let{i18n:o}=xl("common"),t=Ce(),{t:r}=xl("alert");return ni((n,i,s)=>J(this,null,function*(){try{return yield mf(o.language,n,i,s,e)}catch(a){return e&&a instanceof cf?(gf(hf),uf.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]=df({status:kr.IDLE}),a=ni(d=>{s(c=>y(p({},c),{data:d instanceof Function?d(c.data):d}))},[]),l=ni(()=>{r&&(s(d=>({data:d.data,status:kr.LOADING})),n(e,o,t).then(d=>{ff(d)?s({error:d.error,status:kr.FAILED}):s({data:d,status:kr.SUCCEEDED})}))},[r,n,t,e,o]);return pf(()=>{l()},[l]),[i,a,l]}import{useLayoutEffect as bf,useState as Il}from"react";var yl=e=>{let[o,t]=Il(!1),[r,n]=Il(!1);return bf(()=>{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}};import{useTranslation as yf}from"next-i18next";import{useCallback as Cf,useMemo as Tf}from"react";import{getOptionsFromApiSchema as Sf,getOptionsFromResource as vf,getReferencedResource as wf,hasFieldOptions as Pf,isDropdownStaticOptions as Ef,isError as Tl,isReferenceField as Ff}from"@elastic-suite/gally-admin-shared";import{useCallback as Cl,useRef as xf,useState as If}from"react";import{LoadStatus as ai}from"@elastic-suite/gally-admin-shared";function Lr(e=new Map){let o=le(),[t,r]=If(e),n=xf(new Map),i=Ce(),s=Cl((l,d)=>{n.current.set(l,ai.SUCCEEDED),r(c=>{let u=new Map(c);return u.set(l,d),u})},[]);return{fetch:Cl((l,d)=>J(this,null,function*(){if(!n.current.get(l)){n.current.set(l,ai.LOADING);try{let u=yield d(o);s(l,u)}catch(u){i(u),n.current.set(l,ai.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}=yf("options"),i=Cf(s=>{let a=s.property["@id"];return e(a,l=>J(this,null,function*(){var d,c;if(Pf(s)){if(Ef((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(!Tl(u))return Sf(u);throw new Error("error")}else if(Ff(s)){let u=yield l((c=wf(r,s))==null?void 0:c.url);if(!Tl(u))return vf(u);throw new Error("error")}}))},[r,e]);return Tf(()=>{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])}import{useEffect as kf,useMemo as vl,useState as Lf}from"react";import Af from"lodash.debounce";import{isError as Mf,isRuleValid as Bf,isVirtualCategoryEnabled as Df,serializeRule as Nf}from"@elastic-suite/gally-admin-shared";var Of=200;function EE(e,o){let t=q(Eo),r=le(),[n,i]=Lf(null),s=Df(t),a=!(e!=null&&e.isVirtual)||Bf(e==null?void 0:e.virtualRule),l=vl(()=>Af(c=>J(this,null,function*(){let u=yield r("rule_engine_graphql_filters",void 0,{body:JSON.stringify({rule:c}),method:"POST"});Mf(u)||i(u.graphQlFilters)}),Of),[r]);return kf(()=>{s&&(e==null?void 0:e.isVirtual)&&(e==null?void 0:e.virtualRule)&&a&&l(JSON.stringify(Nf(e.virtualRule,o)))},[t,e==null?void 0:e.isVirtual,e==null?void 0:e.virtualRule,l,s,a,o]),[vl(()=>s&&(e==null?void 0:e.isVirtual)&&n?n:null,[e,s,n]),i]}import{useEffect as _f,useState as zf}from"react";import{isError as Hf,isVirtualCategoryEnabled as Vf}from"@elastic-suite/gally-admin-shared";function bt(e){let[o,t]=zf(),r=q(Eo),n=le();return _f(()=>{Vf(r)&&!e&&n("rule_engine_operators").then(i=>{Hf(i)||t(i)})},[r,n,e]),e!=null?e:o}import{useCallback as qf}from"react";import Wf,{useRouter as Gf}from"next/router";import{getRouterPath as Xf}from"@elastic-suite/gally-admin-shared";function Ar(e){var i;let{asPath:o}=Gf(),t=Xf(o),r=(i=e.find(s=>s.url===t))!=null?i:e.find(s=>s.default),n=qf(s=>{let a=e.find(l=>l.id===s);a&&Wf.push(a.url,void 0,{shallow:!0})},[e]);return[r,n]}import{getUser as Jf,storageGet as $f,tokenStorageKey as Rf}from"@elastic-suite/gally-admin-shared";import{useMemo as Uf}from"react";function ze(){let e=$f(Rf);try{return Uf(()=>Jf(e),[e])}catch(o){return null}}import{useEffect as jf,useRef as Kf,useState as Yf}from"react";var wl=()=>{let e=Kf(null),[o,t]=Yf(!1);return jf(()=>{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=Zf((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 Qf.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;import Jt,{forwardRef as hg}from"react";import{DatePicker as bg}from"@mui/x-date-pickers/DatePicker";import{PickersDay as xg,pickersDayClasses as Ll}from"@mui/x-date-pickers/PickersDay";import{styled as Ig}from"@mui/system";import Ao,{forwardRef as cg}from"react";import{FormHelperText as mg,InputLabel as fg}from"@mui/material";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]}}import{DataContentType as Fl,reorderingColumnWidth as rg,stickyColunWidth as ng}from"@elastic-suite/gally-admin-shared";function Dr(e,o,t,r){return y(p(p({minWidth:`${rg}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:`${ng}px`,left:`${e}px`,borderBottomColor:"colors.neutral.300",backgroundColor:"colors.white"},t&&Lo(o)),r===Fl.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===Fl.SELECT&&{overflow:"visible"})}import zr from"react";import ig from"react";import{Tooltip as ag}from"@mui/material";function sg(e){let r=e,{className:o}=r,t=N(r,["className"]);return ig.createElement(ag,y(p({},t),{arrow:!0,classes:{popper:o}}))}var Xo=sg;function lg({title:e,children:o,noStyle:t,withHTMLTitle:r}){return zr.createElement(Xo,{title:typeof e=="string"&&r?zr.createElement("span",{dangerouslySetInnerHTML:{__html:e}}):e,placement:"right"},zr.createElement("span",{style:{display:"inline-block",paddingLeft:t?"":"10px",marginBottom:t?"":"-5px"}},o||zr.createElement(B,{name:"informationCircle",tooltip:!0})))}var G=lg;import{FormControl as pg,InputBase as dg}from"@mui/material";import{styled as Hr}from"@mui/system";var ro=Hr(pg)(({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=Hr(dg,{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=Hr("div")(({theme:e})=>({alignItems:"center",display:"flex","label + &":{marginTop:e.spacing(.5)}})),qr=Hr("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 Ao.createElement(ro,{error:t,fullWidth:r,margin:d,variant:"standard"},Boolean(l||a)&&Ao.createElement(fg,{shrink:!0,htmlFor:s,required:b||u},l,a?Ao.createElement(G,{title:a}):null),Ao.createElement(Vr,{className:"InputText__Wrapper"},Ao.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)&&Ao.createElement(qr,null,f)),Boolean(n)&&Ao.createElement(mg,{"data-testid":x?`${x}ErrorMessage`:null},Boolean(i)&&Ao.createElement(B,{name:i,style:{fontSize:18,marginRight:2}}),n))}var Ie=cg(gg);import{useTranslation as yg}from"next-i18next";var Cg=Ig(xg,{shouldForwardProp:e=>e!=="dayIsBetween"&&e!=="isFirstDay"&&e!=="isLastDay"})(({theme:e})=>({fontWeight:500,[`&&.${Ll.selected}`]:{backgroundColor:e.palette.colors.primary[400],color:"white"},[`&&.${Ll.selected}, &:hover, &:focus`]:{backgroundColor:e.palette.colors.primary[400],color:"white"}}));function Tg(){return Jt.createElement(B,{name:"calendar-outline",style:{fontSize:18,padding:"0px"}})}function Sg(){return Jt.createElement(B,{name:"chevron-down-outline",style:{fontSize:18,padding:"0px"}})}function vg(e,o){let{t}=yg("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 Jt.createElement(bg,{value:r,onChange:l,onError:i,renderDay:(u,f,h)=>Jt.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 Jt.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=hg(vg);import wg,{useCallback as Pg}from"react";import{isValid as Eg}from"date-fns";function Wr(e,o,t,r){return r?r(e,o):!e&&t?"valueMissing":!e||Eg(e)?"":"invalidDate"}function Fg(e){let c=e,{onChange:o,showError:t,additionalValidator:r}=c,n=N(c,["onChange","showError","additionalValidator"]),i=Pg((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 wg.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;import He,{forwardRef as Lg}from"react";import{Box as Ag,FormHelperText as Mg,Grid as li,InputLabel as Bg}from"@mui/material";import{useTranslation as Dg}from"next-i18next";import{styled as Ng}from"@mui/system";import{styled as kg}from"@mui/system";var Mo=kg("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=Ng(Ag)(({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}=Dg("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 He.createElement(Mo,{error:r,fullWidth:i,margin:f},Boolean(u||d)&&He.createElement(Bg,{shrink:!0,htmlFor:l,required:x},u,d?He.createElement(G,{title:d}):null),He.createElement(li,{justifyContent:"flex-start",alignItems:"center",container:!0,sx:{marginTop:u?"4px":"0px"}},He.createElement(Al,{sx:{paddingRight:"20px"}}," ",I("form.from")," "),He.createElement(li,{item:!0,xs:!0},He.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}))),He.createElement(Al,{sx:{paddingRight:"20px",paddingLeft:"20px"}},I("form.to")),He.createElement(li,{item:!0,xs:!0},He.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)&&He.createElement(Mg,{error:r,"data-testid":F?`${F}ErrorMessage`:null},Boolean(a)&&He.createElement(B,{name:a,style:{fontSize:18,marginRight:2}}),s))}var pi=Lg(Og);import _g,{useCallback as zg}from"react";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=zg((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 _g.createElement(pi,y(p(p({},i),l),{ref:a}))}var di=Vg;import Ve,{forwardRef as Wg,useMemo as Gg,useRef as Xg}from"react";import{Autocomplete as Jg,FormControl as $g,ListItem as Rg,ListSubheader as Ug}from"@mui/material";import{useTranslation as jg}from"next-i18next";import{styled as Ml}from"@mui/system";import{getCustomScrollBarStyles as qg}from"@elastic-suite/gally-admin-shared";var $t=Ml("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"},qg(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=Ml($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}=jg("common"),C=Xg(null),I=Gg(()=>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})=>Ve.createElement("li",y(p({},E),{"data-testid":f?`${f}DropdownOption`:null}),Ve.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 Ve.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)=>Ve.createElement(Rg,y(p({},E),{"data-testid":f?`${f}DropdownOption`:null}),D.label),Ve.createElement($g,{fullWidth:r,variant:"standard"},Ve.createElement(Jg,{PaperComponent:x?Gr:$t,clearIcon:Ve.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:Ve.createElement(B,{"data-testid":f?`${f}Button`:null,name:"chevron-down"}),renderGroup:E=>Ve.createElement("li",{key:E.key},Ve.createElement(Ug,{"data-testid":f?`${f}GroupTitle`:null},E.group),Ve.createElement("ul",{style:{padding:0}},E.children)),renderInput:E=>{let z=E,{InputLabelProps:D,InputProps:O}=z,H=N(z,["InputLabelProps","InputProps"]);return Ve.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=Wg(Kg);import Yg,{useCallback as Qg}from"react";function Zg(e){let d=e,{onChange:o,showError:t,additionalValidator:r,replacementErrorsMessages:n}=d,i=N(d,["onChange","showError","additionalValidator","replacementErrorsMessages"]),s=Qg((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 Yg.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;import eh,{useCallback as oh}from"react";function th(e){let d=e,{onChange:o,showError:t,additionalValidator:r,replacementErrorsMessages:n}=d,i=N(d,["onChange","showError","additionalValidator","replacementErrorsMessages"]),s=oh((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 eh.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;import Bo from"react";import{FormControl as rh,FormControlLabel as nh,FormHelperText as ih,InputLabel as ah,Radio as sh,RadioGroup as lh}from"@mui/material";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 Bo.createElement(rh,{variant:"standard",margin:"normal"},Boolean(a||s)&&Bo.createElement(ah,{shrink:!0,style:{position:"relative"},required:d.required},a,Boolean(s)&&Bo.createElement(G,{title:s})),Bo.createElement(lh,y(p({},d),{onChange:(f,h)=>{i(h,f)},defaultValue:l||(d.defaultChecked?c==null?void 0:c.value:null)}),n.map(f=>Bo.createElement(nh,{disabled:f.disabled,key:f.label,value:f.value,control:Bo.createElement(sh,null),label:f.label}))),Boolean(t)&&Bo.createElement(ih,{error:o,sx:{marginTop:"-5px"}},Boolean(r)&&Bo.createElement(B,{name:r,style:{fontSize:18,marginRight:2}}),t))}var ui=ph;import Xr,{useCallback as dh}from"react";function uh(e){let d=e,{onChange:o,showError:t,additionalValidator:r,replacementErrorsMessages:n}=d,i=N(d,["onChange","showError","additionalValidator","replacementErrorsMessages"]),s=dh((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 Xr.createElement(Xr.Fragment,null,Xr.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)})),Xr.createElement(Ie,{style:{display:"none"},inputRef:a}))}var ci=uh;import Ih,{useCallback as yh}from"react";import ho,{forwardRef as fh}from"react";import{FormHelperText as gh,InputLabel as hh}from"@mui/material";import{useTranslation as bh}from"next-i18next";import ch from"react";import{styled as mi}from"@mui/system";function mh(e){let r=e,{margin:o}=r,t=N(r,["margin"]);return ch.createElement("div",p({},t))}var kk=mi(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=mi(Xt)({margin:"0 0.5em"}),Dl=mi(Xt)({margin:"0 0 0 0.5em"});function xh(e,o){let{t}=bh("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 ho.createElement(Mo,{fullWidth:n,margin:u},Boolean(c||l)&&ho.createElement(hh,{shrink:!0,htmlFor:a,required:b},c,l?ho.createElement(G,{title:l}):null),ho.createElement(Vr,{className:"InputText__Wrapper"},t("form.from"),ho.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"),ho.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)&&ho.createElement(qr,null,x)),Boolean(i)&&ho.createElement(gh,{error:r,"data-testid":I?`${I}ErrorMessage`:null},Boolean(s)&&ho.createElement(B,{name:s,style:{fontSize:18,marginRight:2}}),i))}var fi=fh(xh);function Ch(e){let d=e,{onChange:o,showError:t,additionalValidator:r,replacementErrorsMessages:n}=d,i=N(d,["onChange","showError","additionalValidator","replacementErrorsMessages"]),s=yh((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 Ih.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;import bo from"react";import Sh from"@mui/material/Box";import{styled as Nl}from"@mui/system";import Th from"@mui/material/Slider";var Ol=Nl(Th)(({theme:e})=>({".MuiSlider-root":{height:"10px!important"},".MuiSlider-rail":{height:"7px",border:"1px solid",boxSizing:"border-box",borderColor:e.palette.colors.neutral[400],backgroundColor:e.palette.colors.neutral[300],"::after":{content:"''",position:"absolute",top:-1,height:"100%",background:e.palette.colors.primary[400],borderRadius:e.spacing(1),border:"1px solid",borderColor:e.palette.colors.primary[500]}},".MuiSlider-track":{display:"none"},".MuiSlider-valueLabelOpen":{borderRadius:e.spacing(1),backgroundColor:e.palette.colors.primary[100],border:"1px solid",borderColor:e.palette.colors.primary[200],color:e.palette.colors.neutral[900],paddingRight:0,paddingLeft:0,paddingTop:2,paddingBottom:2,fontSize:"14px",width:"34px",fontWeight:"600",top:"-6px","::before":{display:"none"}},".MuiSlider-thumb":{color:e.palette.colors.primary[500],border:"1px solid",borderColor:e.palette.colors.primary[100]}})),_l=Nl("div")(({theme:e})=>({display:"flex",flexDirection:"row",justifyContent:"space-between",color:e.palette.colors.neutral[900],fontWeight:"400",lineHeight:"18px",fontSize:"12px"}));import{FormHelperText as vh,InputLabel as wh}from"@mui/material";var Ph=[-99,0,100];function zl(e){let{error:o,fullWidth:t,helperText:r,helperIcon:n,infoTooltip:i,label:s,margin:a,onChange:l,required:d,value:c,width:u,dataTestId:f}=e;function h(b,x){l&&l(x)}return bo.createElement(ro,{error:o,fullWidth:t,margin:a,variant:"standard"},Boolean(s||i)&&bo.createElement(wh,{shrink:!0,required:d},s,i?bo.createElement(G,{title:i}):null),bo.createElement(Sh,{width:t?void 0:u,sx:{marginTop:s?"4px":0}},bo.createElement(_l,null,Ph.map(b=>bo.createElement("div",{key:b},b))),bo.createElement(Ol,{valueLabelDisplay:"on",max:100,value:c,min:-99,onChange:h,sx:{".MuiSlider-rail":{"::after":{left:c<0?`calc(50% - ${-c/2}%)`:"50%",width:`${Math.abs(c)/2}%`}}},"data-testid":f})),Boolean(r)&&bo.createElement(vh,null,Boolean(n)&&bo.createElement(B,{name:n,style:{fontSize:18,marginRight:2}}),r))}zl.defaultProps={width:376};var hi=zl;import yt from"react";import{FormHelperText as kh,InputLabel as Lh,Switch as Ah}from"@mui/material";import{styled as Eh}from"@mui/system";import{FormControl as Fh}from"@mui/material";var Hl=Eh(Fh)(()=>({fontFamily:"var(--gally-font)",fontStyle:"normal",fontWeight:500,fontSize:"14px",lineHeight:"20px",color:"#151A47",flex:"none",order:0,flexGrow:0,width:"100%"}));function Mh(e){let c=e,{helperIcon:o,helperText:t,infoTooltip:r,label:n,margin:i,onChange:s,required:a}=c,l=N(c,["helperIcon","helperText","infoTooltip","label","margin","onChange","required"]);function d(u){s(u.target.checked,u)}return yt.createElement(Hl,{fullWidth:!0,variant:"standard",margin:i,className:"switch"},n||r?yt.createElement(Lh,{sx:{maxWidth:"90%"},required:a,shrink:!0},n||null,r?yt.createElement(G,{title:r}):null):void 0,yt.createElement(Ah,y(p({},l),{onChange:d,sx:n||r?{marginLeft:"-12px",marginTop:"20px"}:{}})),Boolean(t)&&yt.createElement(kh,null,Boolean(o)&&yt.createElement(B,{name:o,style:{fontSize:18,marginRight:2}}),t))}var Ct=Mh;import Jo,{forwardRef as Bh}from"react";import{FormControl as Dh,FormHelperText as Vl,InputLabel as Nh,TextareaAutosize as Oh}from"@mui/material";import _h from"classnames";function zh(e,o){let C=e,{error:t,fullWidth:r,id:n,label:i,margin:s,maxLength:a,required:l,resizable:d,value:c,helperText:u,helperIcon:f,onChange:h}=C,b=N(C,["error","fullWidth","id","label","margin","maxLength","required","resizable","value","helperText","helperIcon","onChange"]),x=a!=null?a:250,F=String(c!=null?c:"");return Jo.createElement(Dh,{fullWidth:r,margin:s,variant:"standard"},i?Jo.createElement(Nh,{shrink:!0,htmlFor:n,required:l},i):null,Jo.createElement(Oh,y(p({},b),{id:n,required:l,maxLength:x,style:{height:150,minWidth:320,resize:d?"both":"none"},className:_h({"textarea--filled":F.length>0,"textarea--error":t}),value:F,onChange:I=>{h(I.target.value,I)},ref:o})),Jo.createElement("div",{style:{display:"flex",flexDirection:"row"