@3sc/common-component 0.0.474 → 0.0.476
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +23 -17
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -323,5 +323,5 @@ const theme2 = createTheme({ palette: {
|
|
|
323
323
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(o=>r.set(o)),r}static accessor(t){const r=(this[$1]=this[$1]={accessors:{}}).accessors,o=this.prototype;function i(a){const l=Ta(a);r[l]||(XV(o,a),r[l]=!0)}return oe.isArray(t)?t.forEach(i):i(t),this}};yn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),oe.reduceDescriptors(yn.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),oe.freezeMethods(yn);function Mp(e,t){const n=this||Sa,r=t||n,o=yn.from(r.headers);let i=r.data;return oe.forEach(e,function(l){i=l.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function L1(e){return!!(e&&e.__CANCEL__)}function Fs(e,t,n){Ge.call(this,e??"canceled",Ge.ERR_CANCELED,t,n),this.name="CanceledError"}oe.inherits(Fs,Ge,{__CANCEL__:!0});function B1(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Ge("Request failed with status code "+n.status,[Ge.ERR_BAD_REQUEST,Ge.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function ZV(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function JV(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o=0,i=0,a;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=r[i];a||(a=u),n[o]=c,r[o]=u;let f=i,p=0;for(;f!==o;)p+=n[f++],f=f%e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),u-a<t)return;const h=d&&u-d;return h?Math.round(p*1e3/h):void 0}}function QV(e,t){let n=0,r=1e3/t,o,i;const a=(u,d=Date.now())=>{n=d,o=null,i&&(clearTimeout(i),i=null),e.apply(null,u)};return[(...u)=>{const d=Date.now(),f=d-n;f>=r?a(u,d):(o=u,i||(i=setTimeout(()=>{i=null,a(o)},r-f)))},()=>o&&a(o)]}const Ac=(e,t,n=3)=>{let r=0;const o=JV(50,250);return QV(i=>{const a=i.loaded,l=i.lengthComputable?i.total:void 0,c=a-r,u=o(c),d=a<=l;r=a;const f={loaded:a,total:l,progress:l?a/l:void 0,bytes:c,rate:u||void 0,estimated:u&&l&&d?(l-a)/u:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(f)},n)},V1=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},W1=e=>(...t)=>oe.asap(()=>e(...t)),e7=nn.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,nn.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(nn.origin),nn.navigator&&/(msie|trident)/i.test(nn.navigator.userAgent)):()=>!0,t7=nn.hasStandardBrowserEnv?{write(e,t,n,r,o,i){const a=[e+"="+encodeURIComponent(t)];oe.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),oe.isString(r)&&a.push("path="+r),oe.isString(o)&&a.push("domain="+o),i===!0&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function n7(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function r7(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function z1(e,t,n){let r=!n7(t);return e&&(r||n==!1)?r7(e,t):t}const U1=e=>e instanceof yn?{...e}:e;function ko(e,t){t=t||{};const n={};function r(u,d,f,p){return oe.isPlainObject(u)&&oe.isPlainObject(d)?oe.merge.call({caseless:p},u,d):oe.isPlainObject(d)?oe.merge({},d):oe.isArray(d)?d.slice():d}function o(u,d,f,p){if(oe.isUndefined(d)){if(!oe.isUndefined(u))return r(void 0,u,f,p)}else return r(u,d,f,p)}function i(u,d){if(!oe.isUndefined(d))return r(void 0,d)}function a(u,d){if(oe.isUndefined(d)){if(!oe.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function l(u,d,f){if(f in t)return r(u,d);if(f in e)return r(void 0,u)}const c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l,headers:(u,d,f)=>o(U1(u),U1(d),f,!0)};return oe.forEach(Object.keys(Object.assign({},e,t)),function(d){const f=c[d]||o,p=f(e[d],t[d],d);oe.isUndefined(p)&&f!==l||(n[d]=p)}),n}const H1=e=>{const t=ko({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:a,auth:l}=t;t.headers=a=yn.from(a),t.url=j1(z1(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let c;if(oe.isFormData(n)){if(nn.hasStandardBrowserEnv||nn.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((c=a.getContentType())!==!1){const[u,...d]=c?c.split(";").map(f=>f.trim()).filter(Boolean):[];a.setContentType([u||"multipart/form-data",...d].join("; "))}}if(nn.hasStandardBrowserEnv&&(r&&oe.isFunction(r)&&(r=r(t)),r||r!==!1&&e7(t.url))){const u=o&&i&&t7.read(i);u&&a.set(o,u)}return t},o7=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){const o=H1(e);let i=o.data;const a=yn.from(o.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:u}=o,d,f,p,h,y;function g(){h&&h(),y&&y(),o.cancelToken&&o.cancelToken.unsubscribe(d),o.signal&&o.signal.removeEventListener("abort",d)}let b=new XMLHttpRequest;b.open(o.method.toUpperCase(),o.url,!0),b.timeout=o.timeout;function x(){if(!b)return;const w=yn.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),v={data:!l||l==="text"||l==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:w,config:e,request:b};B1(function(E){n(E),g()},function(E){r(E),g()},v),b=null}"onloadend"in b?b.onloadend=x:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(x)},b.onabort=function(){b&&(r(new Ge("Request aborted",Ge.ECONNABORTED,e,b)),b=null)},b.onerror=function(){r(new Ge("Network Error",Ge.ERR_NETWORK,e,b)),b=null},b.ontimeout=function(){let k=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const v=o.transitional||F1;o.timeoutErrorMessage&&(k=o.timeoutErrorMessage),r(new Ge(k,v.clarifyTimeoutError?Ge.ETIMEDOUT:Ge.ECONNABORTED,e,b)),b=null},i===void 0&&a.setContentType(null),"setRequestHeader"in b&&oe.forEach(a.toJSON(),function(k,v){b.setRequestHeader(v,k)}),oe.isUndefined(o.withCredentials)||(b.withCredentials=!!o.withCredentials),l&&l!=="json"&&(b.responseType=o.responseType),u&&([p,y]=Ac(u,!0),b.addEventListener("progress",p)),c&&b.upload&&([f,h]=Ac(c),b.upload.addEventListener("progress",f),b.upload.addEventListener("loadend",h)),(o.cancelToken||o.signal)&&(d=w=>{b&&(r(!w||w.type?new Fs(null,e,b):w),b.abort(),b=null)},o.cancelToken&&o.cancelToken.subscribe(d),o.signal&&(o.signal.aborted?d():o.signal.addEventListener("abort",d)));const C=ZV(o.url);if(C&&nn.protocols.indexOf(C)===-1){r(new Ge("Unsupported protocol "+C+":",Ge.ERR_BAD_REQUEST,e));return}b.send(i||null)})},s7=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,o;const i=function(u){if(!o){o=!0,l();const d=u instanceof Error?u:this.reason;r.abort(d instanceof Ge?d:new Fs(d instanceof Error?d.message:d))}};let a=t&&setTimeout(()=>{a=null,i(new Ge(`timeout ${t} of ms exceeded`,Ge.ETIMEDOUT))},t);const l=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),e=null)};e.forEach(u=>u.addEventListener("abort",i));const{signal:c}=r;return c.unsubscribe=()=>oe.asap(l),c}},i7=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,o;for(;r<n;)o=r+t,yield e.slice(r,o),r=o},a7=async function*(e,t){for await(const n of l7(e))yield*i7(n,t)},l7=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},q1=(e,t,n,r)=>{const o=a7(e,t);let i=0,a,l=c=>{a||(a=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await o.next();if(u){l(),c.close();return}let f=d.byteLength;if(n){let p=i+=f;n(p)}c.enqueue(new Uint8Array(d))}catch(u){throw l(u),u}},cancel(c){return l(c),o.return()}},{highWaterMark:2})},jc=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Y1=jc&&typeof ReadableStream=="function",c7=jc&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),G1=(e,...t)=>{try{return!!e(...t)}catch{return!1}},u7=Y1&&G1(()=>{let e=!1;const t=new Request(nn.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),K1=64*1024,Dp=Y1&&G1(()=>oe.isReadableStream(new Response("").body)),Nc={stream:Dp&&(e=>e.body)};jc&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Nc[t]&&(Nc[t]=oe.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new Ge(`Response type '${t}' is not supported`,Ge.ERR_NOT_SUPPORT,r)})})})(new Response);const d7=async e=>{if(e==null)return 0;if(oe.isBlob(e))return e.size;if(oe.isSpecCompliantForm(e))return(await new Request(nn.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(oe.isArrayBufferView(e)||oe.isArrayBuffer(e))return e.byteLength;if(oe.isURLSearchParams(e)&&(e=e+""),oe.isString(e))return(await c7(e)).byteLength},f7=async(e,t)=>{const n=oe.toFiniteNumber(e.getContentLength());return n??d7(t)},Rp={http:AV,xhr:o7,fetch:jc&&(async e=>{let{url:t,method:n,data:r,signal:o,cancelToken:i,timeout:a,onDownloadProgress:l,onUploadProgress:c,responseType:u,headers:d,withCredentials:f="same-origin",fetchOptions:p}=H1(e);u=u?(u+"").toLowerCase():"text";let h=s7([o,i&&i.toAbortSignal()],a),y;const g=h&&h.unsubscribe&&(()=>{h.unsubscribe()});let b;try{if(c&&u7&&n!=="get"&&n!=="head"&&(b=await f7(d,r))!==0){let v=new Request(t,{method:"POST",body:r,duplex:"half"}),O;if(oe.isFormData(r)&&(O=v.headers.get("content-type"))&&d.setContentType(O),v.body){const[E,P]=V1(b,Ac(W1(c)));r=q1(v.body,K1,E,P)}}oe.isString(f)||(f=f?"include":"omit");const x="credentials"in Request.prototype;y=new Request(t,{...p,signal:h,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:r,duplex:"half",credentials:x?f:void 0});let C=await fetch(y);const w=Dp&&(u==="stream"||u==="response");if(Dp&&(l||w&&g)){const v={};["status","statusText","headers"].forEach(D=>{v[D]=C[D]});const O=oe.toFiniteNumber(C.headers.get("content-length")),[E,P]=l&&V1(O,Ac(W1(l),!0))||[];C=new Response(q1(C.body,K1,E,()=>{P&&P(),g&&g()}),v)}u=u||"text";let k=await Nc[oe.findKey(Nc,u)||"text"](C,e);return!w&&g&&g(),await new Promise((v,O)=>{B1(v,O,{data:k,headers:yn.from(C.headers),status:C.status,statusText:C.statusText,config:e,request:y})})}catch(x){throw g&&g(),x&&x.name==="TypeError"&&/fetch/i.test(x.message)?Object.assign(new Ge("Network Error",Ge.ERR_NETWORK,e,y),{cause:x.cause||x}):Ge.from(x,x&&x.code,e,y)}})};oe.forEach(Rp,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const X1=e=>`- ${e}`,p7=e=>oe.isFunction(e)||e===null||e===!1,Z1={getAdapter:e=>{e=oe.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let i=0;i<t;i++){n=e[i];let a;if(r=n,!p7(n)&&(r=Rp[(a=String(n)).toLowerCase()],r===void 0))throw new Ge(`Unknown adapter '${a}'`);if(r)break;o[a||"#"+i]=r}if(!r){const i=Object.entries(o).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=t?i.length>1?`since :
|
|
324
324
|
`+i.map(X1).join(`
|
|
325
325
|
`):" "+X1(i[0]):"as no adapter specified";throw new Ge("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return r},adapters:Rp};function Ip(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Fs(null,e)}function J1(e){return Ip(e),e.headers=yn.from(e.headers),e.data=Mp.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Z1.getAdapter(e.adapter||Sa.adapter)(e).then(function(r){return Ip(e),r.data=Mp.call(e,e.transformResponse,r),r.headers=yn.from(r.headers),r},function(r){return L1(r)||(Ip(e),r&&r.response&&(r.response.data=Mp.call(e,e.transformResponse,r.response),r.response.headers=yn.from(r.response.headers))),Promise.reject(r)})}const Q1="1.8.4",Fc={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Fc[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const ew={};Fc.transitional=function(t,n,r){function o(i,a){return"[Axios v"+Q1+"] Transitional option '"+i+"'"+a+(r?". "+r:"")}return(i,a,l)=>{if(t===!1)throw new Ge(o(a," has been removed"+(n?" in "+n:"")),Ge.ERR_DEPRECATED);return n&&!ew[a]&&(ew[a]=!0,console.warn(o(a," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,a,l):!0}},Fc.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function h7(e,t,n){if(typeof e!="object")throw new Ge("options must be an object",Ge.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],a=t[i];if(a){const l=e[i],c=l===void 0||a(l,i,e);if(c!==!0)throw new Ge("option "+i+" must be "+c,Ge.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Ge("Unknown option "+i,Ge.ERR_BAD_OPTION)}}const _c={assertOptions:h7,validators:Fc},gr=_c.validators;let Oo=class{constructor(t){this.defaults=t,this.interceptors={request:new N1,response:new N1}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const i=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
326
|
-
`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=ko(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&_c.assertOptions(r,{silentJSONParsing:gr.transitional(gr.boolean),forcedJSONParsing:gr.transitional(gr.boolean),clarifyTimeoutError:gr.transitional(gr.boolean)},!1),o!=null&&(oe.isFunction(o)?n.paramsSerializer={serialize:o}:_c.assertOptions(o,{encode:gr.function,serialize:gr.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),_c.assertOptions(n,{baseUrl:gr.spelling("baseURL"),withXsrfToken:gr.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&oe.merge(i.common,i[n.method]);i&&oe.forEach(["delete","get","head","post","put","patch","common"],y=>{delete i[y]}),n.headers=yn.concat(a,i);const l=[];let c=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(n)===!1||(c=c&&g.synchronous,l.unshift(g.fulfilled,g.rejected))});const u=[];this.interceptors.response.forEach(function(g){u.push(g.fulfilled,g.rejected)});let d,f=0,p;if(!c){const y=[J1.bind(this),void 0];for(y.unshift.apply(y,l),y.push.apply(y,u),p=y.length,d=Promise.resolve(n);f<p;)d=d.then(y[f++],y[f++]);return d}p=l.length;let h=n;for(f=0;f<p;){const y=l[f++],g=l[f++];try{h=y(h)}catch(b){g.call(this,b);break}}try{d=J1.call(this,h)}catch(y){return Promise.reject(y)}for(f=0,p=u.length;f<p;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=ko(this.defaults,t);const n=z1(t.baseURL,t.url,t.allowAbsoluteUrls);return j1(n,t.params,t.paramsSerializer)}};oe.forEach(["delete","get","head","options"],function(t){Oo.prototype[t]=function(n,r){return this.request(ko(r||{},{method:t,url:n,data:(r||{}).data}))}}),oe.forEach(["post","put","patch"],function(t){function n(r){return function(i,a,l){return this.request(ko(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}Oo.prototype[t]=n(),Oo.prototype[t+"Form"]=n(!0)});let m7=class Bw{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(o=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](o);r._listeners=null}),this.promise.then=o=>{let i;const a=new Promise(l=>{r.subscribe(l),i=l}).then(o);return a.cancel=function(){r.unsubscribe(i)},a},t(function(i,a,l){r.reason||(r.reason=new Fs(i,a,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Bw(function(o){t=o}),cancel:t}}};function g7(e){return function(n){return e.apply(null,n)}}function y7(e){return oe.isObject(e)&&e.isAxiosError===!0}const Ap={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ap).forEach(([e,t])=>{Ap[t]=e});function tw(e){const t=new Oo(e),n=x1(Oo.prototype.request,t);return oe.extend(n,Oo.prototype,t,{allOwnKeys:!0}),oe.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return tw(ko(e,o))},n}const Tt=tw(Sa);Tt.Axios=Oo,Tt.CanceledError=Fs,Tt.CancelToken=m7,Tt.isCancel=L1,Tt.VERSION=Q1,Tt.toFormData=Rc,Tt.AxiosError=Ge,Tt.Cancel=Tt.CanceledError,Tt.all=function(t){return Promise.all(t)},Tt.spread=g7,Tt.isAxiosError=y7,Tt.mergeConfig=ko,Tt.AxiosHeaders=yn,Tt.formToJSON=e=>_1(oe.isHTMLForm(e)?new FormData(e):e),Tt.getAdapter=Z1.getAdapter,Tt.HttpStatusCode=Ap,Tt.default=Tt;const{Axios:dz,AxiosError:fz,CanceledError:pz,isCancel:hz,CancelToken:mz,VERSION:gz,all:yz,Cancel:bz,isAxiosError:vz,spread:xz,toFormData:wz,AxiosHeaders:Cz,HttpStatusCode:Sz,formToJSON:Tz,getAdapter:kz,mergeConfig:Oz}=Tt,jp={BASE_URL:"https://qa.3sc.ai/api",VERSION:"/v1"},ka={headers:{"Content-Type":"application/json"},withCredentials:!0},nw=Tt.create({baseURL:jp.BASE_URL,axiosConfig:ka});nw.interceptors.request.use(function(e){return e},function(e){return Promise.reject(e)}),nw.interceptors.response.use(function(e){return e},function(e){return Promise.reject(e)});const Ir={TOKEN:"token",USER:"user",SNOP:"snop",SELECTED_BU:"selected_business_unit",SETTINGS:"settings"},rw={TENANT_ID:"tenant_id",BU_ID:"bu_id"},b7=Object.values({"SKU Name":"sku_name",Node:"node","Channel Name":"channel_name"}),v7=[10,25,50,100],x7={MARK_ALL_READ:"MARK_ALL_READ"},w7=v7.map(e=>({label:e,value:e})),ow={PRIMARY:"PRIMARY",SECONDARY:"SECONDARY"},$c={NOTIFICATION:"/notifications",SETTING:"/configuration/setting"};/*! js-cookie v3.0.5 | MIT */function Lc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var C7={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Np(e,t){function n(o,i,a){if(!(typeof document>"u")){a=Lc({},t,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var l="";for(var c in a)a[c]&&(l+="; "+c,a[c]!==!0&&(l+="="+a[c].split(";")[0]));return document.cookie=o+"="+e.write(i,o)+l}}function r(o){if(!(typeof document>"u"||arguments.length&&!o)){for(var i=document.cookie?document.cookie.split("; "):[],a={},l=0;l<i.length;l++){var c=i[l].split("="),u=c.slice(1).join("=");try{var d=decodeURIComponent(c[0]);if(a[d]=e.read(u,d),o===d)break}catch{}}return o?a[o]:a}}return Object.create({set:n,get:r,remove:function(o,i){n(o,"",Lc({},i,{expires:-1}))},withAttributes:function(o){return Np(this.converter,Lc({},this.attributes,o))},withConverter:function(o){return Np(Lc({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var S7=Np(C7,{path:"/"});const Fp=Tc(Ir.SNOP),_p=Tc(Ir.SELECTED_BU),$p=Tc(Ir.USER);Tc(Ir.SETTINGS);const sw={BU_IDS:_p==null?void 0:_p.business_unit_id,TOKEN:JSON.parse(S7.get(Ir.TOKEN)||null),TENANT_IDS:$p==null?void 0:$p.tenant_id,SNOP_IDS:Fp==null?void 0:Fp.snop_id},{TENANT_ID:T7,BU_ID:k7}=rw,{TENANT_IDS:O7,BU_IDS:E7}=sw,Bc=async({baseUrl:e,payload:t})=>{try{const n=`${e}${$c.SETTING}/v1?${T7}=${O7}&${k7}=${E7}`;return await Tt.post(n,t,ka)}catch(n){return n}},P7=({columns:e,gridPath:t,baseUrl:n,isDefaultConfig:r,pageSize:o=10,childUniqueKey:i,data:a})=>{var w,k,v;const l=a==null?void 0:a.length;let{definitions:c,defaultUserSettings:u,labels:d}=e;const f=Ar(d),p=t.split("/").filter(Boolean),h=JSON.parse(localStorage.getItem(Ir.SETTINGS));let y=p.reduce((O,E)=>O==null?void 0:O[E],h)||null;const g=Ar((y==null?void 0:y.columns)||[]);if(!r&&t&&l){let O=(u&&Lp({definitions:u,childUniqueKey:i}))??Lp({definitions:c,childUniqueKey:i});const E=O.filter(D=>!g[D.key]),P=y&&((w=y==null?void 0:y.columns)==null?void 0:w.some(D=>(D==null?void 0:D.children)&&D.children[i]));if(E.length&&(!y||P==!1)&&l){if(P==!1){const D=Ar(O);O=(k=y==null?void 0:y.columns)==null?void 0:k.map(A=>{var N;return A!=null&&A.children&&!A.children[i]?{...A,children:{...A.children,[i]:(N=D==null?void 0:D[A==null?void 0:A.key])==null?void 0:N.children[i]}}:A})}(async()=>{try{const A={...h||{platform:{theme:"light"}}},N=(y==null?void 0:y.pageSize)??o;let R=A;for(let j=0;j<p.length;j++){const _=p[j];j===p.length-1?R[_]={columns:O,pageSize:N}:(R[_]={...R[_]||{}},R=R[_])}localStorage.setItem(Ir.SETTINGS,JSON.stringify(A)),await Bc({baseUrl:n,payload:A})}catch(D){console.error(D)}})()}}u=((y==null?void 0:y.columns)&&D7(g,u,i))??u??Lp({definitions:c});const b=[],x=Ar(u);for(const O of c){const E=x[O.key]||{},P=f[O.key]||{},D=g[O.key],A=Ar(E.children||[]),N=Ar(P.children||[]);let R={...O,style:D==null?void 0:D.style,...E,...P};(v=O.children)!=null&&v.length&&(R.children=O.children.map(j=>({...j,...A[j.key],...N[j.key]}))),b.push(R)}return b.sort((O,E)=>O.sequenceId-E.sequenceId)},M7=e=>e.sort((t,n)=>t.sequenceId-n.sequenceId),Oa=(e,t)=>e==null?void 0:e.map(n=>({id:n.id,key:n.key,sequenceId:n.sequenceId||n.id,isHidden:n.isHidden||!1,style:n.style||{},...(n==null?void 0:n.children)&&{children:t?{[t]:Oa(n.children)}:Oa(n.children)}})),Ar=e=>Array.isArray(e)&&(e==null?void 0:e.reduce((t,n)=>(t[n.key]=n,t),{})),Lp=({definitions:e,childUniqueKey:t})=>Oa(e,t),D7=(e,t,n)=>t.map(o=>{const i=e[o.key],a=o.children?o.children.map(l=>{var d;const c=Ar(Array.isArray(i==null?void 0:i.children)?i==null?void 0:i.children:(d=i==null?void 0:i.children)==null?void 0:d[n]),u=c==null?void 0:c[l.key];return{...l,sequenceId:(u==null?void 0:u.sequenceId)||l.sequenceId,isHidden:(u==null?void 0:u.isHidden)??l.isHidden}}):void 0;return{...o,sequenceId:(i==null?void 0:i.sequenceId)||o.sequenceId,isHidden:(i==null?void 0:i.isHidden)??o.isHidden,...a?{children:a}:{}}}),R7=({t:e})=>{const t=[{id:1,key:"sku_name",isSortable:!0,isMandatory:!0},{id:2,key:"node",isSortable:!0,isMandatory:!0},{id:3,key:"channel_name",isSortable:!0,isMandatory:!0}],n=[{id:1,key:"sku_name",sequenceId:1,isHidden:!1,style:{width:"20rem",minWidth:"20rem",maxWidth:"20rem"}},{id:2,key:"node",sequenceId:2,isHidden:!1,style:{width:"20rem",minWidth:"20rem",maxWidth:"20rem"}},{id:3,key:"channel_name",sequenceId:3,isHidden:!1,style:{width:"20rem",minWidth:"20rem",maxWidth:"20rem"}}],r=[{id:1,key:"sku_name",label:e(Y8),isLocalizable:!1},{id:2,key:"node",label:e(q8),isLocalizable:!1},{id:3,key:"channel_name",label:e(G8),isLocalizable:!1}];return{definitions:t,defaultUserSettings:n,labels:r}};class Bp extends M.Component{constructor(t){super(t),this.startDrag=this.startDrag.bind(this),this.endDrag=this.endDrag.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.dragging=!1,this.mouseX=0,this.startPos=0,this.startWidthPrev=0,this.lastDraggedWidth=0,this.draggedCol=null,this.resizeRef=M.createRef()}startDrag(){if(!this.props.disabled&&(this.draggedCol=this.props.id,this.props.resizeStart&&this.draggedCol===this.props.id&&this.props.resizeStart(),this.dragging=!0,this.startPos=this.mouseX,this.startWidthPrev=0,this.resizeRef.current)){let t=this.resizeRef.current.previousSibling;t&&(this.startWidthPrev=t.clientWidth)}}endDrag(){this.props.disabled||(this.dragging=!1,this.props.resizeEnd&&this.draggedCol===this.props.id&&this.props.resizeEnd(this.lastDraggedWidth),this.draggedCol=null)}onMouseMove(t){if(this.props.disabled||(this.mouseX=t.touches?t.touches[0].screenX:t.screenX,!this.dragging))return;const n=this.resizeRef.current,r=this.startPos-this.mouseX;let o=this.startWidthPrev-r;(!this.props.minWidth||o>=this.props.minWidth)&&(!this.props.maxWidth||o<=this.props.maxWidth)&&(n.previousSibling.style.width=o+"px",n.previousSibling.style.minWidth=o+"px",n.previousSibling.style.maxWidth=o+"px",n.previousSibling.style.setProperty("--column_resize_before_width",o+"px"),this.lastDraggedWidth=o)}componentDidMount(){const t=this.resizeRef.current;if(t&&(this.props.defaultWidth?(t.previousSibling.style.minWidth=this.props.defaultWidth+"px",t.previousSibling.style.width=this.props.defaultWidth+"px",t.previousSibling.style.maxWidth=this.props.defaultWidth+"px",t.previousSibling.style.setProperty("--column_resize_before_width",this.props.defaultWidth+"px")):this.props.minWidth&&(t.previousSibling.style.minWidth=this.props.minWidth+"px",t.previousSibling.style.width=this.props.minWidth+"px",t.previousSibling.style.maxWidth=this.props.minWidth+"px",t.previousSibling.style.setProperty("--column_resize_before_width",this.props.minWidth+"px"))),this.props.disabled){this.props.defaultWidth&&t&&(t.previousSibling.style.minWidth=this.props.defaultWidth+"px",t.previousSibling.style.width=this.props.defaultWidth+"px",t.previousSibling.style.maxWidth=this.props.defaultWidth+"px",t.previousSibling.style.setProperty("--column_resize_before_width",this.props.defaultWidth+"px")),this.props.maxWidth&&t&&(t.previousSibling.style.maxWidth=this.props.maxWidth+"px");return}this.addEventListenersToDocument()}componentWillUnmount(){this.props.disabled||this.removeEventListenersFromDocument()}componentDidUpdate(t,n){t.disabled&&!this.props.disabled&&this.addEventListenersToDocument(),!t.disabled&&this.props.disabled&&this.removeEventListenersFromDocument()}addEventListenersToDocument(){document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.endDrag),document.addEventListener("touchmove",this.onMouseMove),document.addEventListener("touchend",this.endDrag)}removeEventListenersFromDocument(){document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.endDrag),document.removeEventListener("touchmove",this.onMouseMove),document.removeEventListener("touchend",this.endDrag)}render(){var t={userSelect:"none"};return this.props.disabled||(t.cursor="ew-resize"),this.props.className===""&&(t.width="6px",t.backgroundColor="rgba(0, 0, 0, 0.1)"),M.createElement("th",{ref:this.resizeRef,style:t,disabled:this.props.disabled,rowSpan:this.props.rowSpan?this.props.rowSpan:1,colSpan:this.props.colSpan?this.props.colSpan:1,className:`column_resizer_own_class ${this.props.disabled?"disabled_column_resize":""} ${this.props.className}`,onMouseDown:this.props.disabled?null:this.startDrag,onTouchStart:this.props.disabled?null:this.startDrag})}}Bp.defaultProps={disabled:!1,minWidth:0,className:""},Bp.propTypes={disabled:"boolean",minWidth:"number",className:"string"};function Vp({isRenderCellContent:e,column:t,row:n,parent:r}){const o=n[t.key],i=(o==null?void 0:o.length)>20;return m.jsx(m.Fragment,{children:e?m.jsx(we,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem"},children:t==null?void 0:t.cellRenderer(n,{column:t,parent:r})}):m.jsx(m.Fragment,{children:i?m.jsx(xd,{title:o,placement:"top",componentsProps:{tooltip:{sx:{fontSize:"1rem",padding:"0.5rem 1rem",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"}}},children:m.jsx(we,{sx:{maxWidth:"auto",whiteSpace:"normal"},children:m.jsx(rt,{sx:{fontSize:"1.1rem",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none"},children:o})})}):m.jsx(we,{sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem",m:0},id:t.key,component:"p",children:o??""})})})}Vp.propTypes={isRenderCellContent:s.bool,column:s.object,row:s.object},K(Ml)(({theme:e})=>({"& .MuiPaper-root":{borderRadius:8,border:`1px solid ${e.palette.primary.notifyBorderColor}`,boxShadow:e.shadows[4],padding:"1rem 1rem 0rem 1rem",backgroundColor:e.palette.primary.notifyBackground}}));const Eo=K(rt)(({theme:e})=>({color:e.palette.primary.notifyTextColor,fontSize:"1.1rem"})),I7=K(_g)(({theme:e})=>({width:28,height:16,padding:0,display:"flex","&:active":{"& .MuiSwitch-thumb":{width:15},"& .MuiSwitch-switchBase.Mui-checked":{transform:"translateX(9px)"}},"& .MuiSwitch-switchBase":{padding:2,"&.Mui-checked":{transform:"translateX(12px)",color:"#fff","& + .MuiSwitch-track":{opacity:1,backgroundColor:"#1890ff",...e.applyStyles("dark",{backgroundColor:"#177ddc"})}}},"& .MuiSwitch-thumb":{boxShadow:"0 2px 4px 0 rgb(0 35 11 / 20%)",width:12,height:12,borderRadius:6,transition:e.transitions.create(["width"],{duration:200})},"& .MuiSwitch-track":{borderRadius:16/2,opacity:1,backgroundColor:"rgba(0,0,0,.25)",boxSizing:"border-box",...e.applyStyles("dark",{backgroundColor:"rgba(255,255,255,.35)"})}})),A7=K(Ci)(({theme:e})=>({color:e.palette.primary.notifyTextColor,padding:"0.6rem 0",fontSize:"0.9rem",fontWeight:500,"&::before, &::after":{borderColor:`${e.palette.primary.notifyBorderColor}!important`}})),j7=K(od)(({theme:e})=>({"& .MuiBadge-badge":{right:3.5,top:1.8,border:`0.1rem solid ${e.palette.primary.notifyBackground}`,padding:"0 1.3px",borderRadius:"50%",backgroundColor:"#D44E40",fontSize:"0.725rem",minWidth:"0.7rem",height:"0.7rem"}}));K(Vl)(({theme:e})=>({"& .MuiInputBase-root":{height:"3.52rem"},"& .MuiFormLabel-root":{color:`${e.palette.primary.notifyBorderColor} !important`,fontSize:"1rem",marginTop:"0.4rem"},"& label.Mui-focused":{color:e.palette.primary.notifyTextColor},"& .MuiInput-underline:after":{borderBottomColor:e.palette.primary.notifyBorderColor,borderBottomWidth:"0.1rem"},"& .MuiOutlinedInput-root":{"& fieldset":{borderColor:e.palette.primary.notifyBorderColor,borderWidth:"0.1rem"},"&:hover fieldset":{borderColor:e.palette.primary.notifyBorderColor,borderWidth:"0.1rem"},"&.Mui-focused fieldset":{borderColor:e.palette.primary.notifyBorderColor,borderWidth:"0.1rem"}}}));const N7=K(ty)(({theme:e})=>({minHeight:"2rem","& .MuiTabs-indicator":{height:"0.1rem",backgroundColor:e.palette.primary.notifyActiveText}})),Wp=K($g)(({theme:e})=>({color:e.palette.primary.notifyActiveText,textTransform:"none",fontWeight:"normal",padding:0,fontSize:"1rem",minHeight:"2rem",paddingBottom:"1rem","&.Mui-selected":{fontWeight:"bold",color:e.palette.primary.notifyActiveText}})),Vc=K(td)(({theme:e})=>({"&.MuiChip-outlined":{borderColor:e.palette.primary.notifyBorderColor,color:e.palette.primary.notifyActiveText},height:"2rem",fontSize:"0.9rem",fontWeight:"300",borderColor:e.palette.primary.notifyBorderColor,color:e.palette.primary.notifyActiveText,borderRadius:"0.6rem",padding:"0.2rem","&:hover":{backgroundColor:`${e.palette.brandColor.orange} !important`,color:`${e.palette.brandColor.white} !important`}})),F7=K(Ll)(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"table-cell",[`&.${Cd.head}`]:{color:e.palette.primary.notifyTextColor,backgroundColor:e.palette.primary.notifyBackground,borderColor:e.palette.primary.notifyBorderColor,padding:"0rem",textAlign:"center",lineHeight:"1.5rem"},[`&.${Cd.body}`]:{color:e.palette.primary.notifyTextColor,borderColor:e.palette.primary.notifyBorderColor,padding:"0rem",textAlign:"center"}}));function Ea({children:e,...t}){return m.jsx(F7,{...t,children:e})}Ea.propTypes={children:s.node};const _7=K(Gg)(()=>({"&:last-child td":{borderBottom:"none"}}));function _s({children:e,...t}){return m.jsx(_7,{...t,children:e})}_s.propTypes={children:s.node};const $7=M.memo(({row:e,isSelected:t,isHigh:n,onRowClick:r,children:o})=>m.jsx(_s,{sx:i=>({backgroundColor:t||n?i.palette.primary.appBackground:i.palette.primary.notifyBackground}),onClick:()=>r==null?void 0:r(e),children:o},e==null?void 0:e.fhi)),L7=M.memo(({nestedData:e,nestedColumn:t,t:n})=>e!=null&&e.length?m.jsx(m.Fragment,{children:e.map((r,o)=>m.jsx(_s,{children:t.map((i,a)=>m.jsx(Ea,{style:i==null?void 0:i.style,children:m.jsx(Vp,{isRenderCellContent:!!(i!=null&&i.cellRenderer),column:i,row:r})},a))},`nested-${o}`))}):m.jsx(_s,{children:m.jsx(Ea,{colSpan:t.length,children:m.jsx(Eo,{sx:{textAlign:"center"},children:n(Zr.NRF)})})})),B7=(e,t,n,r,o,i)=>{const[a,l]=M.useState({isOpen:!1,column:null}),c=(p,h,y)=>{l({isOpen:p.currentTarget,column:h,isChild:!!y})},u=()=>{l({isOpen:!1,column:null,isChild:!1})},d=async()=>{u();const p=e.map(h=>{var y;if(a!=null&&a.isChild&&Array.isArray(h.children)){const g=h.children.map(x=>{var C;return x.key===((C=a.column)==null?void 0:C.key)?{...x,isHidden:!0}:x}),b=g.every(x=>x.isHidden);return{...h,isHidden:b?!0:h.isHidden,children:g}}return h.key===((y=a.column)==null?void 0:y.key)?{...h,isHidden:!0}:h});f({updatedColumns:p})},f=async({updatedColumns:p})=>{t({type:Ue.SET_GRID_DATA,payload:{visibleGridColumns:p}});const h=r.split("/").filter(Boolean),y=JSON.parse(localStorage.getItem(Ir.SETTINGS));let g=h.reduce((O,E)=>O==null?void 0:O[E],y)||null,b=Oa(p,i);const x=Ar(g==null?void 0:g.columns);b=b==null?void 0:b.map(O=>{var D,A;const E=(O==null?void 0:O.children)||{},P=((D=x==null?void 0:x[O==null?void 0:O.key])==null?void 0:D.children)||{};return{...O,...(((A=Object.keys(P))==null?void 0:A.length)>0||(E==null?void 0:E[i]))&&{children:{...P,[i]:E==null?void 0:E[i]}}}});const w={...y||{platform:{theme:"light"}}},k=(g==null?void 0:g.pageSize)??o;let v=w;for(let O=0;O<h.length;O++){const E=h[O];O===h.length-1?v[E]={columns:b,pageSize:k}:(v[E]={...v[E]||{}},v=v[E])}localStorage.setItem(Ir.SETTINGS,JSON.stringify(w)),await Bc({baseUrl:n,payload:w})};return{selectedColumn:a,handleMenuClick:c,handleClose:u,handleHideClick:d,columnUpdaterFunction:f}},V7=e=>{if(!e)return null;const{options:t,...n}=e,r=t?"select":"button",o={button:i=>{var a;return m.jsx(Er,{...i,styles:{...i.styles,iconPrimary:((a=i==null?void 0:i.styles)==null?void 0:a.variant)=="filled"}})},select:i=>{var a;return m.jsx(we,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"},width:(a=i.styles)==null?void 0:a.width},children:m.jsx(h1,{...i,options:t})})}};return o[r]?o[r](n):null},W7=({presentSetting:e,gridSetting:t,gridPath:n,childUniqueKey:r})=>{if(!n)return e;const o=n.split("/").filter(Boolean);let i=o.reduce((u,d)=>u==null?void 0:u[d],e)||null,a=Oa(t==null?void 0:t.grid,r);const l=Ar(i==null?void 0:i.columns);a=a==null?void 0:a.map(u=>{var p,h;const d=(u==null?void 0:u.children)||{},f=((p=l==null?void 0:l[u==null?void 0:u.key])==null?void 0:p.children)||{};return{...u,...(((h=Object.keys(f))==null?void 0:h.length)>0||(d==null?void 0:d[r]))&&{children:{...f,[r]:d==null?void 0:d[r]}}}});let c=e;for(let u=0;u<o.length;u++){const d=o[u];u===o.length-1?c[d]={columns:a,pageSize:(t==null?void 0:t.pageSize)??null}:(c[d]=c[d]||{},c=c[d])}return{settingObject:e,defaultUserSettings:a}},z7=async({baseUrl:e,gridSetting:t,childUniqueKey:n,gridPath:r})=>{try{const o=JSON.parse(localStorage.getItem("settings")),{settingObject:i,defaultUserSettings:a}=W7({presentSetting:o,gridSetting:t,gridPath:r,childUniqueKey:n});return localStorage.setItem("settings",JSON.stringify(i)),await Bc({baseUrl:e,payload:i}),a}catch(o){console.error(o)}},U7=({index:e,visibleGridColumns:t,width:n,columnUpdaterFunction:r})=>{if(!t||!t[e])return null;t[e];let o=`${n/10}rem`;const i=t.map((a,l)=>l===e?{...a,style:{...a.style,width:o,minWidth:o,maxWidth:o}}:a);return r({updatedColumns:i}),i[e]},iw=({pagination:e,gridPath:t,baseUrl:n,t:r})=>{const{selectedPage:o,rowPerPage:i,totalRecords:a,onPageChange:l,onPageSizeChange:c}=e,u=It(),d=async(f,p)=>{if(!p)return;const h=p.split("/").filter(Boolean),y="settings",b={...JSON.parse(localStorage.getItem(y))||{}};let x=b;for(let C=0;C<h.length;C++){const w=h[C];C===h.length-1?x[w]={...x[w]||{},pageSize:f}:(x[w]={...x[w]||{}},x=x[w])}localStorage.setItem(y,JSON.stringify(b)),await Bc({baseUrl:n,payload:b})};return m.jsxs(we,{sx:{display:"flex",p:"1rem 1.5rem"},children:[m.jsxs(we,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"0.5rem",width:"100%"},children:[m.jsx(rt,{sx:{fontSize:"1.1rem",color:u.palette.primary.notifyTextColor},children:r("SHOWING_ROWS",{current:Math.min(o*i,a),total:a})}),m.jsx(we,{sx:{"& .MuiInputBase-input":{padding:"0rem 0.8rem!important"},width:"6rem"},children:m.jsx(js,{options:w7,value:i,onChange:async f=>{c(f),d(f==null?void 0:f.value,t)}})})]}),m.jsx(Pg,{count:Math.ceil(a/i),page:o,onChange:async(f,p)=>{l(p)},siblingCount:0,shape:"rounded",sx:{width:"100%","& .MuiPagination-ul":{width:"100%",display:"flex",justifyContent:"flex-end","& li:first-of-type":{border:`0.1rem solid ${u.palette.primary.notifyBorderColor}`,color:u.palette.primary.notifyActiveText,marginRight:"1.5rem",borderRadius:"1rem",width:"3rem",height:"3rem",justifyContent:"center",alignItems:"center",display:"flex"},"& li:last-child":{border:`0.1rem solid ${u.palette.primary.notifyBorderColor}`,color:u.palette.primary.notifyActiveText,marginLeft:"1.5rem",borderRadius:"1rem",width:"3rem",height:"3rem",justifyContent:"center",alignItems:"center",display:"flex"}},"& .MuiPaginationItem-root":{color:"#595959",fontSize:"1.1rem",borderRadius:"1rem",width:"3rem",height:"3rem",justifyContent:"center",alignItems:"center",display:"flex","& .MuiSvgIcon-root":{fontSize:"2.2rem"}},"& .Mui-selected":{color:u.palette.primary.notifyActiveText,backgroundColor:`${u.palette.brandColor.paginationBc} !important`}}})]})};iw.propTypes={pagination:s.object.isRequired};const aw=({menuOpen:e,handleClose:t,onHideClick:n})=>{const r=It();return m.jsx(Pi,{open:!!e,anchorEl:e,onClose:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:m.jsx(we,{sx:{backgroundColor:r.palette.primary.notifyBackground,border:`0.1rem solid ${r.palette.primary.notifyBorderColor}`,minHeight:"2.3rem",display:"flex",justifyContent:"center",alignItems:"center"},children:m.jsx(qn,{onClick:n,disableRipple:!0,sx:{textTransform:"none",fontSize:"1.1rem",p:"0.4rem 1rem",minHeight:"unset",fontWeight:500,color:r.palette.primary.notifyTextColor,backgroundColor:"transparent","&:hover":{backgroundColor:"transparent"},"&:active":{backgroundColor:"transparent"},"&:focus":{backgroundColor:"transparent"}},children:"Hide Column"})})})};aw.propTypes={menuOpen:s.object,handleClose:s.func,onHideClick:s.func};const lw=({sortKey:e,sortField:t,sortDir:n,handleSortClick:r})=>{const o=i=>m.jsx(Nr,{onClick:r,sx:{padding:"0.2rem"},draggable:!1,children:m.jsx(mn,{url:i})});return m.jsx(m.Fragment,{children:o(t===e?n==="asc"?Qe.AscSort:Qe.DescSort:Qe.Unsort)})};lw.propTypes={sortKey:s.string.isRequired,sortField:s.string,sortDir:s.string,handleSortClick:s.func};function cw({parent:e,column:t,sort:n,handleMenuClick:r,isManageable:o}){const i=o&&(!(t!=null&&t.isMandatory)||(t==null?void 0:t.isMandatory)&&(t==null?void 0:t.showHide)===!0),a=t==null?void 0:t.label,l=t==null?void 0:t.isSortable,c=n==null?void 0:n.sortField,u=n==null?void 0:n.sortDir,d=n==null?void 0:n.onSort;return m.jsxs(we,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},draggable:!1,children:[m.jsx(we,{sx:{fontWeight:"bold",fontSize:"1.1rem",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"0.5rem",textAlign:"center"},children:m.jsx(xd,{title:a,placement:"top",componentsProps:{tooltip:{sx:{fontSize:"1rem",padding:"0.6rem 1rem",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"}}},children:a??""})}),m.jsxs(we,{sx:{display:"flex",alignItems:"center"},draggable:!1,children:[l&&m.jsx(lw,{sortKey:e?`${e==null?void 0:e.key}|${t==null?void 0:t.key}`:t==null?void 0:t.key,sortField:c,sortDir:u,handleSortClick:()=>d({column:t,sortDir:u,sortField:c,parent:e})}),i&&m.jsx(Nr,{draggable:!1,onClick:f=>r(f,t,e),sx:{padding:"0.2rem"},children:m.jsx(mn,{url:Qe.Menu})})]})]})}cw.propTypes={column:s.object.isRequired,sort:s.object.isRequired,handleMenuClick:s.func,isManageable:s.bool};function uw({rows:e,sort:t,data:n,pagination:r,columns:o,nested:i,baseUrl:a,gridPath:l,childUniqueKey:c,isVirtualizedTable:u=!1,t:d}){var $e;const f=It(),{visibleGridColumns:p}=M.useContext(Oc),h=M.useContext(xa),{selectedColumn:y,handleMenuClick:g,handleClose:b,handleHideClick:x,columnUpdaterFunction:C}=B7(p,h,a,l,r==null?void 0:r.rowPerPage,c),w=o==null?void 0:o.isManageable,k=o==null?void 0:o.isResizable,v=(n==null?void 0:n.length)>0,O=M.useRef(null),E=M.useRef(null),P=45,D=10,A=n==null?void 0:n.length,[N,R]=M.useState({start:0,end:10}),[j,_]=M.useState({start:0,end:20}),[F,$]=M.useState(null),[B,V]=M.useState(null),[Y,z]=M.useState(null);let H=null;const re=M.useRef(0),ae=M.useRef(!1),I=M.useRef(null),ee=M7((($e=i==null?void 0:i.column)==null?void 0:$e.definitions)||[]),X=i==null?void 0:i.isNested,Z=(i==null?void 0:i.data)||[],ne=i==null?void 0:i.hashKey,[q,J]=M.useState(0),[G,L]=M.useState(null);M.useRef(null);const[Q,de]=M.useState(!1),[ve,me]=M.useState(!1);M.useEffect(()=>{if(O.current){const U=()=>{J(O.current.offsetHeight)};return U(),window.addEventListener("resize",U),()=>window.removeEventListener("resize",U)}},[n]),M.useEffect(()=>{const U=O.current,fe=U==null?void 0:U.querySelector("thead");if(!fe)return;const ie=()=>{z(null)};return fe==null||fe.addEventListener("mousedown",ie),()=>{fe==null||fe.removeEventListener("mousedown",ie)}},[]);const Te=(U,fe)=>{var ye,Oe;if(ae.current){U.preventDefault();return}$(fe),z(null),U.dataTransfer.setData("colIndex",fe);const ie=p[fe],te=ie==null?void 0:ie.label,le=document.createElement("div");le.textContent=te,Object.assign(le.style,{display:"flex",alignItems:"center",justifyContent:"center",padding:"1.5rem 2.5rem",minWidth:(ye=ie==null?void 0:ie.style)==null?void 0:ye.minWidth,maxWidth:(Oe=ie==null?void 0:ie.style)==null?void 0:Oe.maxWidth,fontSize:"1.2rem",fontWeight:"500",color:f.palette.primary.notifyTextColor,background:f.palette.primary.notifyBackground,border:`0.1rem solid ${f.palette.primary.notifyBorderColor}`,borderRadius:"0rem",pointerEvents:"none",position:"absolute",top:"0",left:"0",zIndex:"-1",textAlign:"center",boxSizing:"border-box",boxShadow:"0 1px 4px rgba(0, 0, 0, 0.2)"}),document.body.appendChild(le);const{offsetWidth:he,offsetHeight:Se}=le;U.dataTransfer.setDragImage(le,he/2,Se/2),requestAnimationFrame(()=>{document.body.removeChild(le)})},ue=(U,fe)=>{U.preventDefault(),V(fe),He(U)},ke=async(U,fe)=>{if(U.preventDefault(),clearInterval(H),F===null||F===fe)return;const ie=[...p],[te]=ie.splice(F,1);ie.splice(fe,0,te);const le=p.slice().sort((Se,ye)=>Se.sequenceId-ye.sequenceId).map(Se=>Se.sequenceId),he=ie.map((Se,ye)=>({...Se,sequenceId:le[ye]??Se.sequenceId}));C({updatedColumns:he}),$(null),V(null)},xe=()=>{$(null),V(null)},Ce=(U,fe,ie,te)=>{var Ke,jt,wt,Ht,Ze;if(!U)return null;const le=(U==null?void 0:U.isMandatory)&&(U==null?void 0:U.isSticky),he=parseFloat((jt=(Ke=U==null?void 0:U.style)==null?void 0:Ke.minWidth)==null?void 0:jt.toString().replace("rem",""))||7.5;fe===0&&(re.current=0);const Se=le?fe===0?0:`${re.current}rem`:void 0;le&&(re.current+=he);const ye=F===fe,Oe=B==fe||((wt=p==null?void 0:p[B])==null?void 0:wt.isMandatory),De=Ye=>{U.isMandatory?(Ye.preventDefault(),Ye.dataTransfer.dropEffect="none"):(Ye.preventDefault(),Ye.dataTransfer.dropEffect="move"),ue==null||ue(Ye,fe)},qe=Ye=>{U.isMandatory||ke==null||ke(Ye,fe)};return te&&`${te==null?void 0:te.key}${U==null?void 0:U.key}${fe}`,m.jsx(Ea,{rowSpan:U!=null&&U.children?1:2,colSpan:(Ze=(Ht=U==null?void 0:U.children)==null?void 0:Ht.filter(Ye=>!(Ye!=null&&Ye.isHidden)))==null?void 0:Ze.length,style:U==null?void 0:U.style,draggable:ie&&!(U!=null&&U.isMandatory),onDragStart:ie&&!(U!=null&&U.isMandatory)?Ye=>Te(Ye,fe):Ye=>{Ye.preventDefault()},onDragOver:ie&&!(U!=null&&U.isMandatory)?De:void 0,onDrop:ie&&!(U!=null&&U.isMandatory)?qe:void 0,onDragEnd:ie&&!(U!=null&&U.isMandatory)?xe:void 0,sx:{...(U==null?void 0:U.isSticky)&&{boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...U.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...(U==null?void 0:U.key)==="volume_value"&&{borderLeft:"1px solid"}},...ye&&{border:`0.1rem solid ${f.palette.brandColor.lightBlue}!important`},...le&&{position:"sticky",left:Se,zIndex:3},cursor:Oe?"not-allowed":ie&&!(U!=null&&U.isMandatory)?"grab":"default"},children:m.jsx(cw,{parent:te,column:U,sort:t,handleMenuClick:g,isManageable:ie})},fe)},Be=M.useCallback((U,fe,ie,te)=>{var ye,Oe,De;if(!U)return null;const le=(U==null?void 0:U.isMandatory)&&(U==null?void 0:U.isSticky),he=parseFloat((Oe=(ye=U==null?void 0:U.style)==null?void 0:ye.minWidth)==null?void 0:Oe.toString().replace("rem",""))||7.5;ie===0&&(re.current=0);const Se=le?ie===0?0:`${re.current}rem`:void 0;return le&&(re.current+=he),m.jsxs(Ea,{colSpan:1,style:U==null?void 0:U.style,className:`${U==null?void 0:U.label}`,sx:{position:"relative",...U.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...(U==null?void 0:U.key)==="volume_value"&&{borderLeft:"1px solid"}},...(U==null?void 0:U.isSticky)&&{boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...le&&{position:"sticky",left:Se,zIndex:2,backgroundColor:qe=>{var Ke;return e!=null&&e.selectedRow&&((Ke=e==null?void 0:e.selectedRow)==null?void 0:Ke.fhi)===(fe==null?void 0:fe.fhi)||fe!=null&&fe.isHigh?qe.palette.primary.appBackground:qe.palette.primary.notifyBackground}}},children:[((e==null?void 0:e.selectedRow)&&((De=e==null?void 0:e.selectedRow)==null?void 0:De.fhi)===(fe==null?void 0:fe.fhi)||(fe==null?void 0:fe.isHigh))&&m.jsx(we,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none",zIndex:1}}),m.jsx(Vp,{isRenderCellContent:!!(U!=null&&U.cellRenderer),column:U,row:fe,parent:te})]},ie)},[e==null?void 0:e.selectedRow]),Fe=(U,fe,ie,te)=>m.jsx(m.Fragment,{children:U&&ie&&!(U!=null&&U.isMandatory)?m.jsx(we,{resizeStart:()=>{U!=null&&U.isMandatory&&!(U!=null&&U.isResizable)||(ae.current=!0)},resizeEnd:le=>{U!=null&&U.isMandatory&&!(U!=null&&U.isResizable)||le<=20||(ae.current=!1,U7({index:fe,visibleGridColumns:p,width:le,columnUpdaterFunction:C}))},component:U!=null&&U.children||U!=null&&U.isMandatory?Ll:Bp,rowSpan:U!=null&&U.children?1:2,colSpan:1,id:fe,sx:{width:"1rem",maxWidth:"1rem",minWidth:"1rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${f.palette.primary.notifyBorderColor}`,cursor:"col-resize","&::after":{content:'""',position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"0.15rem",height:"1.5rem",backgroundColor:f.palette.primary.notifyBorderColor,zIndex:1},...!(U!=null&&U.isMandatory)&&{"&:hover::after":{content:'""',position:"absolute",top:0,left:"50%",transform:"translateX(-50%)",width:"0.2rem",height:`${q}px`,backgroundColor:f.palette.primary.notifyBorderColor,zIndex:1}}}}):null}),Ie=M.useCallback((U,fe,ie,te,le,he,Se)=>{var ye;return m.jsx(m.Fragment,{children:fe&&te&&!(fe!=null&&fe.isMandatory)?m.jsx(Ll,{className:"column_resizer_body",sx:{width:"1rem",maxWidth:"1rem",minWidth:"1rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${f.palette.primary.notifyBorderColor}`},children:((e==null?void 0:e.selectedRow)&&((ye=e==null?void 0:e.selectedRow)==null?void 0:ye.fhi)===(U==null?void 0:U.fhi)||(U==null?void 0:U.isHigh))&&m.jsx(we,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none"}})},`resize-${ie}_${Se}`):null})},[e==null?void 0:e.selectedRow]),He=U=>{const fe=O.current,{left:ie,right:te}=fe.getBoundingClientRect(),le=50,he=U.clientX>te-le?1:U.clientX<ie+le?-1:0;he!==0?(I.current&&clearInterval(I.current),I.current=setInterval(()=>{fe.scrollLeft+=he*10},50)):I.current&&(clearInterval(I.current),I.current=null)},tt=U=>U==null?void 0:U.map((fe,ie)=>{var Oe;const te=N.start+ie,le=fe[ne],he=Z==null?void 0:Z[le],Se=(e==null?void 0:e.selectedRow)&&((Oe=e==null?void 0:e.selectedRow)==null?void 0:Oe.fhi)===(fe==null?void 0:fe.fhi),ye=fe==null?void 0:fe.isHigh;return m.jsxs(M.Fragment,{children:[m.jsx($7,{row:fe,isSelected:Se,isHigh:ye,onRowClick:e==null?void 0:e.onRowClick,children:p.map((De,qe)=>De!=null&&De.isHidden||(De==null?void 0:De.isVisible)===!1?null:De!=null&&De.children?De.children.map((Ke,jt)=>Ke!=null&&Ke.isHidden?null:m.jsxs(M.Fragment,{children:[Be(Ke,fe,jt,De),k&&Ie(fe,Ke,jt,w,De,"",te)]},`col-${qe}-${jt}`)):m.jsxs(M.Fragment,{children:[Be(De,fe,qe),k&&Ie(fe,De,qe,w,"","",te)]},`col-${qe}`))}),X&&he&&m.jsx(L7,{nestedData:he,nestedColumn:ee,t:d})]},`row-${te}`)}),ct=()=>{const U=E.current;if(!U)return;const fe=U.scrollTop,ie=U.clientHeight,te=Math.floor(fe/P)-D,le=Math.ceil(ie/P)+2*D,he=Math.max(0,Math.min(A-1,te)),Se=Math.max(he,Math.min(A,he+le));R(ye=>ye.start===he&&ye.end===Se?ye:{start:he,end:Se})};M.useEffect(()=>{let U;const fe=()=>{U&&cancelAnimationFrame(U),U=requestAnimationFrame(()=>{ct()})},ie=E.current;if(!(!ie||!u))return ct(),ie.addEventListener("scroll",fe),()=>{cancelAnimationFrame(U),ie.removeEventListener("scroll",fe)}},[A]);const Ve=N.start*P,ge=(A-N.end)*P,Me=u?n==null?void 0:n.slice(N.start,N.end):n;return v?m.jsxs(m.Fragment,{children:[m.jsx(zg,{ref:E,sx:{willChange:"transform",WebkitTransform:"translateZ(0)",maxHeight:"40rem",whiteSpace:"nowrap",overflow:"auto",width:"100%",border:`0.1rem solid ${f.palette.primary.notifyBorderColor}`,borderRadius:"1.4rem",position:"relative"},children:m.jsxs(Bg,{ref:O,stickyHeader:!0,"aria-label":"sticky table",sx:{backgroundColor:U=>U.palette.primary.notifyBackground},children:[m.jsxs(Hg,{children:[m.jsx(_s,{sx:{position:"sticky",top:0,zIndex:3,backgroundColor:U=>U.palette.primary.notifyBackground},children:p.map((U,fe)=>U!=null&&U.isHidden||(U==null?void 0:U.isVisible)===!1?null:m.jsxs(M.Fragment,{children:[Ce(U,fe,w),Fe(U,fe,w)]},fe))}),m.jsx(_s,{draggable:!1,sx:{position:"sticky",top:"2.5rem",backgroundColor:f.palette.primary.notifyBackground,zIndex:2},children:p.flatMap((U,fe)=>U!=null&&U.isHidden||!(U!=null&&U.children)||(U==null?void 0:U.isVisible)===!1?[]:U.children.map((ie,te)=>ie!=null&&ie.isHidden?null:m.jsxs(M.Fragment,{children:[Ce(ie,te,w,U),k&&Fe(ie,te,w)]},`${fe}-${te}`)))})]}),m.jsxs(Wg,{children:[u&&m.jsx("tr",{style:{height:Ve}}),tt(Me),u&&m.jsx("tr",{style:{height:ge}})]})]})}),r&&m.jsx(iw,{pagination:r,gridPath:l,baseUrl:a,t:d}),m.jsx(aw,{menuOpen:y==null?void 0:y.isOpen,handleClose:b,onHideClick:x})]}):m.jsx(Eo,{sx:{textAlign:"center"},children:d(Zr.NRF)})}uw.propTypes={sort:s.object,data:s.array,pagination:s.object,columns:s.object,nested:s.object};function dw({tableProps:e,isDefaultConfig:t,gridPath:n,baseUrl:r,childUniqueKey:o,t:i}){var u;const{columns:a}=e,l=M.useContext(xa),c=P7({columns:a,gridPath:n,baseUrl:r,isDefaultConfig:t,childUniqueKey:o,pageSize:(u=e==null?void 0:e.pagination)==null?void 0:u.rowPerPage,data:e==null?void 0:e.data});return M.useEffect(()=>{c!=null&&c.length&&(l==null||l({type:Ue.SET_GRID_DATA,payload:{visibleGridColumns:c}}))},[c]),m.jsx(uw,{...e,gridPath:n,baseUrl:r,childUniqueKey:o,t:i})}dw.propTypes={tableProps:s.object.isRequired,mergedColumns:s.array.isRequired};const fw=({type:e})=>{const t=It(),r=(t==null?void 0:t.mode)==="dark"?{bgcolor:"grey.800"}:{};return{grid:m.jsxs(we,{sx:{borderRadius:2,overflow:"hidden"},children:[m.jsx(kr,{variant:"text",width:"100%",height:60,sx:r}),Array.from({length:10}).map((i,a)=>m.jsx(we,{sx:{display:"flex",alignItems:"center",padding:"0.5rem",gap:"3rem"},children:Array.from({length:5}).map((l,c)=>m.jsx(we,{sx:{flex:1},children:m.jsx(kr,{variant:"text",height:45,sx:r})},c))},a))]}),toolbar:m.jsx(m.Fragment,{children:m.jsxs(lt,{direction:"row",justifyContent:"space-between",sx:{display:"flex",gap:"1rem"},children:[m.jsxs(lt,{direction:"row",gap:"1rem",children:[m.jsx(kr,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),m.jsx(kr,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),m.jsx(kr,{variant:"text",width:"15.2rem",height:"5rem",sx:r})]}),m.jsxs(lt,{direction:"row",gap:"1rem",children:[m.jsx(kr,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),m.jsx(kr,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),m.jsx(kr,{variant:"text",width:"3.5rem",height:"5rem",sx:r})]})]})})}[e]},H7=({customTools:e})=>{var r,o;const t=(r=e==null?void 0:e.filter(i=>(i==null?void 0:i.type)===ow.PRIMARY))==null?void 0:r.sort((i,a)=>i.sequenceId-a.sequenceId),n=(o=e==null?void 0:e.filter(i=>(i==null?void 0:i.type)===ow.SECONDARY))==null?void 0:o.sort((i,a)=>i.sequenceId-a.sequenceId);return{primaryButtons:t,secondaryButtons:n}},pw=({customTools:e,isExpanded:t,setIsExpanded:n})=>{const{primaryButtons:r,secondaryButtons:o}=H7({customTools:e}),[i,a]=M.useState(r),l=(o==null?void 0:o.length)>0,c=d=>{d?a([...r,...o]):setTimeout(()=>{a(r)},100)},u=()=>{const d=!t;n(d),c(d)};return M.useEffect(()=>{c(t)},[e]),m.jsxs(m.Fragment,{children:[t&&m.jsx("div",{style:{position:"fixed",left:0,width:"100vw",height:"4rem",zIndex:998}}),m.jsxs(we,{sx:{display:"flex",alignItems:"center",gap:"0.8rem",flexWrap:"nowrap",maxWidth:"100%",whiteSpace:"nowrap",zIndex:999},children:[m.jsx(uI,{mode:"popLayout",children:i.map((d,f)=>m.jsx(Qi.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},layout:!0,children:m.jsx(we,{sx:{flexShrink:0,minWidth:"fit-content"},children:V7(d)})},`${d.id}_${f}`))}),l&&m.jsx(we,{sx:{paddingLeft:t?"0.5rem":0},children:m.jsx(Er,{label:t?"":"More Actions",styles:{iconPrimary:!0,icon:t?Qe.CrossWhite:Qe.More,colorType:t?"danger":""},onClick:u})})]})]})};pw.propTypes={customTools:s.array.isRequired};const hw=({defaultTools:e,isManageable:t,customTools:n,baseUrl:r,gridPath:o,pageSize:i,gridData:a,childUniqueKey:l})=>{var C,w,k,v,O,E;const c=M.useContext(xa),{visibleGridColumns:u,triggerApi:d}=M.useContext(Oc),[f,p]=M.useState([]),[h,y]=M.useState(!1);M.useEffect(()=>{if(u.length){const P={id:99999,sequenceId:99999,isLocalizable:!1,key:"horizons",label:"Horizons",isSortable:!1,isHidden:!0,showChildCheckbox:!0,showCheckbox:!1,isMandatory:!0,showInHierarchy:!0,showHide:!0,children:[]};let D=u.map(N=>(N!=null&&N.children&&N.children.forEach(R=>{P.children.some(_=>_.key===R.key)||P.children.push({...R,showInHierarchy:!0})}),N)).filter(N=>(N==null?void 0:N.id)!==(P==null?void 0:P.id));const A=P.children.length>0?[...D,P]:D;p(A)}},[u]);const g=async P=>{try{await z7({baseUrl:r,gridPath:o,childUniqueKey:l,gridSetting:{grid:P,pageSize:i}})}catch(D){console.error(D)}finally{c({type:Ue.HAS_SETTING_CHANGE,payload:{hasChange:!1}}),c({type:Ue.TRIGGER_API,payload:{triggerApi:!1}})}};M.useEffect(()=>{d&&g(u)},[d]);const b=P=>{var R;const D=P==null?void 0:P.map(j=>j.id),A=(R=P==null?void 0:P.flatMap(j=>j.children||[]))==null?void 0:R.map(j=>j.id),N=f==null?void 0:f.map(j=>{var $,B,V;const _=D==null?void 0:D.includes(j.id);if(Array.isArray(j.children)&&j.children.length>0){const Y=($=j==null?void 0:j.children)==null?void 0:$.map(H=>{var ae;const re=(ae=A==null?void 0:A.includes)==null?void 0:ae.call(A,H.id);return{...H,isHidden:!re}}),z=(B=Y==null?void 0:Y.filter(H=>f==null?void 0:f.some(re=>{var ae;return(ae=re.children)==null?void 0:ae.some(I=>I.id===H.id)})))==null?void 0:B.every(H=>H.isHidden);return{...j,...!((V=j.children[0])!=null&&V.showInHierarchy)&&{isHidden:z||!_},children:Y}}return{...j,isHidden:!_}});c({type:Ue.SET_GRID_DATA,payload:{visibleGridColumns:N}}),c({type:Ue.HAS_SETTING_CHANGE,payload:{hasChange:!0}})},x=()=>f.map(D=>{const A=Array.isArray(D.children)?D.children.filter(N=>!N.isHidden):void 0;return!D.isHidden||D.isHidden&&D.showInHierarchy?{...D,children:A}:null}).filter(Boolean);return m.jsxs(we,{sx:{margin:"1rem 0",position:"relative",zIndex:10,display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"0.6rem",width:"100%"},children:[m.jsxs(we,{sx:{display:"flex",flexDirection:"row",gap:"0.6rem"},children:[((C=e==null?void 0:e.search)==null?void 0:C.isRequired)&&m.jsx(p1,{...e==null?void 0:e.search,iconUrl:Qe.Search}),((w=e==null?void 0:e.refresh)==null?void 0:w.isRequired)&&m.jsx(Er,{...e==null?void 0:e.refresh,styles:{variant:"filled",icon:Qe.Refresh,colorType:"empty",width:"3.2rem",height:"3.2rem"}}),((k=e==null?void 0:e.groupBy)==null?void 0:k.isRequired)&&m.jsx(we,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:m.jsx(js,{styles:{icon:Qe.Group},...e.groupBy})}),t&&m.jsx(we,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:m.jsx(js,{placeholder:"Manage Columns",options:f,value:x(),isMulti:!0,isDraggable:!0,showSearch:!0,isManageColumn:!0,onChange:b,disabled:!a.length,styles:{icon:Qe.Manage}})})]}),m.jsxs(we,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",gap:"0.6rem"},children:[n&&m.jsx(pw,{customTools:n,setIsExpanded:y,isExpanded:h}),((v=e==null?void 0:e.save)==null?void 0:v.isRequired)&&m.jsx(we,{sx:{px:"0.5rem"},children:m.jsx(Er,{label:h?"":"Save",styles:{icon:Qe.Save,colorType:"empty"},...e==null?void 0:e.save})}),((O=e==null?void 0:e.upload)==null?void 0:O.isRequired)&&m.jsx(Er,{...e==null?void 0:e.upload,styles:{variant:h?"outlined":"filled",icon:h?Qe.UploadDark:Qe.Upload,iconPrimary:!h,colorType:"secondary",isAnimate:!0}}),((E=e==null?void 0:e.download)==null?void 0:E.isRequired)&&m.jsx(Er,{...e==null?void 0:e.download,styles:{variant:"outlined",icon:Qe.Download,isAnimate:!0}})]})]})};hw.propTypes={defaultTools:s.object.isRequired,customTools:s.array,isManageable:s.bool,baseUrl:s.string,gridPath:s.gridPath};function zp({tableProps:e,toolbarProps:t,isDefaultConfig:n,isLoading:r,t:o}){var a,l;const i=(a=e.columns)==null?void 0:a.isManageable;return m.jsx(c1,{children:r?m.jsxs(m.Fragment,{children:[t&&m.jsx(fw,{type:"toolbar"}),e&&m.jsx(fw,{type:"grid"})]}):m.jsxs(we,{sx:{position:"sticky"},children:[t&&m.jsx(hw,{...t,isManageable:i,pageSize:(l=e==null?void 0:e.pagination)==null?void 0:l.rowPerPage,gridData:e==null?void 0:e.data,t:o}),m.jsx(dw,{tableProps:e,isDefaultConfig:n,gridPath:(t==null?void 0:t.gridPath)||"",baseUrl:(t==null?void 0:t.baseUrl)||"",childUniqueKey:(t==null?void 0:t.childUniqueKey)||"",t:o})]})})}zp.propTypes={tableProps:s.object.isRequired,toolbarProps:s.object,isDefaultConfig:s.bool};const mw=({list:e,handleLinkClick:t})=>{const n=It(),r=({list:o})=>{var i;return(i=o==null?void 0:o.sort((a,l)=>a.order-l.order))==null?void 0:i.map((a,l)=>a!=null&&a.link?m.jsx(Vr,{component:"h3",sx:{fontSize:"1rem",cursor:"pointer",color:l===(o==null?void 0:o.length)-1?n.palette.brandColor.orange:n.palette.primary.notifyTextColor},href:a==null?void 0:a.link,underline:"hover",onClick:()=>t(a),children:a==null?void 0:a.title},l):m.jsx(rt,{component:"h3",sx:{fontSize:"1rem",color:l===(o==null?void 0:o.length)-1?n.palette.brandColor.orange:n.palette.primary.notifyTextColor},children:a==null?void 0:a.title},l))};return m.jsx(U0,{separator:m.jsx(mn,{url:Qe.ArrowRight}),children:r({list:e})})};mw.propTypes={list:s.array.isRequired,handleLinkClick:s.func};const gw=({breadcrumbProps:e,switchProps:t,filterComponentProps:n,metaDataProps:r})=>{var a,l,c,u,d,f,p,h;const o=It(),i=(a=n==null?void 0:n.filterBtnProps)==null?void 0:a.disabled;return m.jsxs(m.Fragment,{children:[m.jsxs(lt,{sx:{background:o.palette.primary.notifyBackground,borderBottom:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,height:"3rem",p:"0px 1.5rem 0 1.5rem",zIndex:4,position:"relative"},direction:"row",justifyContent:"space-between",alignItems:"center",children:[m.jsx(mw,{...e}),m.jsxs(lt,{direction:"row",gap:"1rem",alignItems:"center",children:[r,t&&m.jsx(b1,{...t}),(n==null?void 0:n.filterBtnProps)&&m.jsxs(lt,{direction:"row",children:[m.jsx(Ci,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"2rem!important",opacity:"1!important",borderColor:o.palette.primary.notifyBorderColor}}),m.jsxs(lt,{direction:"row",alignItems:"center",gap:"0.5rem",onClick:(l=n==null?void 0:n.filterBtnProps)==null?void 0:l.onFilterClick,sx:{opacity:i?.5:1,cursor:i?"not-allowed":"pointer"},children:[m.jsx(mn,{url:Qe.Filter}),m.jsx(rt,{sx:{fontSize:"1.1rem",color:o.palette.primary.notifyActiveText},children:(c=n==null?void 0:n.filterBtnProps)==null?void 0:c.label})]})]})]})]}),m.jsx(Qi.div,{layout:!0,initial:{height:"0rem"},animate:{height:(u=n==null?void 0:n.filterBtnProps)!=null&&u.filterContainerVisible?"5rem":"0rem",opacity:(d=n==null?void 0:n.filterBtnProps)!=null&&d.filterContainerVisible?1:0},transition:{duration:.5,ease:"easeInOut"},style:{background:o.palette.primary.notifyBackground,borderBottom:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,padding:"0px 5.5rem 0 1.5rem",position:"relative",alignItems:"center",display:"flex",overflow:"hidden",width:(f=n==null?void 0:n.filterContainerProps)!=null&&f.isSideDrawerOpen?"75%":"100%"},children:m.jsxs(lt,{sx:{background:o.palette.primary.appBackground,height:"3.8rem",p:"0 2rem",width:"100%",borderRadius:"0.7rem",overflow:"visible"},direction:"row",alignItems:"center",children:[m.jsx(rt,{sx:{fontSize:"1.2rem",fontWeight:"500",color:o.palette.primary.notifyActiveText},children:"Filters:"}),m.jsx(we,{sx:{overflowX:"auto",overflowY:"visible",whiteSpace:"nowrap",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},margin:"0 1rem",padding:"0.5rem 0",flexGrow:1},children:m.jsx(lt,{direction:"row",gap:"1.2rem",sx:{overflow:"visible"},children:(p=n==null?void 0:n.filterItems)==null?void 0:p.map((y,g)=>m.jsx(m.Fragment,{children:m.jsxs(we,{sx:{position:"relative",overflow:"visible",border:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,background:o.palette.primary.notifyBackground,borderRadius:"0.6rem",padding:"0.3rem 1.1rem",display:"inline-block"},children:[m.jsx(we,{component:"img",src:Qe.FilterClose,sx:{position:"absolute",top:"-0.4rem",right:"-0.6rem",cursor:"pointer"},onClick:()=>n==null?void 0:n.onFilterChipClose(y)}),m.jsx(rt,{sx:{fontSize:"1rem",color:o.palette.primary.notifyTextColor},children:y==null?void 0:y.filterLabel})]},g)}))})}),m.jsx(we,{component:rt,sx:{fontSize:"1.1rem",fontWeight:"500",textDecoration:"underline",color:o.palette.brandColor.red,cursor:"pointer"},onClick:(h=n==null?void 0:n.filterContainerProps)==null?void 0:h.onClearClick,children:"Clear"})]})})]})};gw.propTypes={breadcrumbProps:s.object.isRequired,switchProps:s.object};function yw({headerProps:e}){return m.jsx(Ln,{children:m.jsx(gw,{...e})})}yw.propTypes={headerProps:s.object.isRequired};const Up=M.createContext(null),bw=M.createContext(null);function q7({children:e}){const[t,n]=M.useReducer(Y7,G7);return m.jsx(Up.Provider,{value:t,children:m.jsx(bw.Provider,{value:n,children:e})})}function Y7(e,t){var n;switch(t.type){case Ue.LOADING:return{...e,loading:t.loading};case Ue.SUCCESS:return{...e,data:(n=t.data)==null?void 0:n.sort((r,o)=>new Date(o.createdAt)-new Date(r.createdAt))};case Ue.MARK_ALL_AS_READ:return{...e,isMarkAllAsRead:t.isMarkAllAsRead};case Ue.SET_ACTIVE_TAB:return{...e,activeTab:t.activeTab};case Ue.SET_MODE:return{...e,mode:t.mode};case Ue.ERROR:return{...e,error:t.error};default:throw new Error(`${Zr.UNHANDLED}: ${t}`)}}const G7={loading:!1,data:[],error:"",isMarkAllAsRead:{count:0,boo:!1},mode:!1,activeTab:0},{TENANT_ID:Hp,BU_ID:qp}=rw,{TENANT_IDS:Yp,BU_IDS:Gp}=sw,K7=async e=>{try{const t=localStorage.getItem("i18nextLng"),n=`${e}${$c.NOTIFICATION}/v1?${Hp}=${Yp}&${qp}=${Gp}&lang=${t}`;return await Tt.get(n,ka)}catch(t){return t}},vw=async(e,t,n)=>{try{const r=localStorage.getItem("i18nextLng"),o=`${e}${$c.NOTIFICATION}${jp.VERSION}?${Hp}=${Yp}&${qp}=${Gp}&lang=${r}`;return await Tt.put(o,t,ka)}catch(r){return r}},X7=async({baseUrl:e,id:t,snopId:n})=>{try{const r=localStorage.getItem("i18nextLng"),o=`${e}${$c.NOTIFICATION}${jp.VERSION}?${Hp}=${Yp}&${qp}=${Gp}&id=${t}&lang=${r}`;return await Tt.get(o,ka)}catch(r){return r}},$s={OK:200,CREATED:201,NO_CONTENT:204,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,INTERNAL_SERVER_ERROR:500},xw=({baseUrl:e})=>{const t=M.useContext(bw),[n,r]=M.useState(!1),[o,i]=M.useState(!1),[a,l]=M.useState(!1),[c,u]=M.useState({}),[d,f]=M.useState(null),[p,h]=M.useState(1),y=M.useRef(!1),{loading:g,data:b,isMarkAllAsRead:x,mode:C,activeTab:w}=M.useContext(Up),[k,v]=M.useState([]);M.useEffect(()=>{v(b)},[b]);const O=M.useCallback(async()=>{var j,_,F;if(!(y.current||!e))try{t({type:Ue.LOADING,loading:!0}),t({type:Ue.SUCCESS,data:[]});const $=await K7(e);if($.status===$s.UNAUTHORIZED){y.current=!0;return}if($.status===$s.OK){const B=((_=(j=$.data)==null?void 0:j.responseData)==null?void 0:_.response)||[],V=kc(B);t({type:Ue.SET_MODE,mode:!1}),t({type:Ue.SUCCESS,data:kc(V)}),t({type:Ue.MARK_ALL_AS_READ,isMarkAllAsRead:{count:l1(B),boo:l1(B)>0}})}}catch($){((F=$==null?void 0:$.response)==null?void 0:F.status)===$s.UNAUTHORIZED&&(y.current=!0),t({type:Ue.ERROR,error:Zr.SWR})}finally{t({type:Ue.LOADING,loading:!1})}},[e,t]),E=j=>{const _=(b||[]).filter(F=>C?!F.isRead:!0);return{0:_,1:_.filter(F=>(F==null?void 0:F.type)==="INFO"),2:_.filter(F=>(F==null?void 0:F.type)==="ERROR")}};M.useEffect(()=>{O();const j=setInterval(O,3e5);return()=>clearInterval(j)},[O]);const P=async(j,_)=>{var F,$;if(!(!j||!e)){f(j);try{const B=await X7({baseUrl:e,id:j,snopId:_});if(B.status===$s.OK){const V=(($=(F=B.data)==null?void 0:F.responseData)==null?void 0:$.response)||{};u(V||{}),l(!0)}else throw new Error}catch{t({type:Ue.ERROR,error:Zr.SWR})}finally{f(null)}}},D=async(j,_)=>{if(!(!j.length||!e)){t({type:Ue.LOADING,loading:!0});try{if((await vw(e,j,_)).status===$s.OK){const $=b.map(V=>j.includes(V.id)?{...V,isRead:!0}:V),B=$.filter(V=>!V.isRead).length;B===0&&t({type:Ue.SET_MODE,mode:!1}),t({type:Ue.SUCCESS,data:kc($)}),t({type:Ue.MARK_ALL_AS_READ,isMarkAllAsRead:{count:B,boo:B>0}}),setTimeout(()=>{t({type:Ue.LOADING,loading:!1})},200)}}catch{t({type:Ue.ERROR,error:Zr.SWR}),t({type:Ue.LOADING,loading:!1})}}},A=async()=>{if(e){t({type:Ue.LOADING,loading:!0});try{const j=y8(b);if((await vw(e,j,x7.MARK_ALL_READ)).status===$s.OK){const F=b.map($=>({...$,isRead:!0}));t({type:Ue.SET_MODE,mode:!1}),t({type:Ue.SUCCESS,data:kc(F)}),t({type:Ue.MARK_ALL_AS_READ,isMarkAllAsRead:{count:0,boo:!1}}),setTimeout(()=>{t({type:Ue.LOADING,loading:!1})},200)}}catch{t({type:Ue.ERROR,error:Zr.SWR}),t({type:Ue.LOADING,loading:!1})}}},N=(j,_)=>{t({type:Ue.LOADING,loading:!0}),t({type:Ue.SET_ACTIVE_TAB,activeTab:_}),setTimeout(()=>{t({type:Ue.LOADING,loading:!1})},400)},R=()=>{t({type:Ue.LOADING,loading:!0});const j=C?b||[]:(k||[]).filter(_=>!_.isRead);t({type:Ue.SET_MODE,mode:!C}),v(j),h(1),setTimeout(()=>{t({type:Ue.LOADING,loading:!1})},400)};return{fetchNotification:O,showDetailsProps:{open:a,handleClose:()=>l(!1),setOpen:l,data:c,clickId:d},alertDialogProps:{open:n,handleClose:()=>r(!1),onRefresh:O,handleRead:D,handleMarkAllAsRead:A,setOpen:r,handleShowDetails:P,clickId:d,isMainDialog:!0},activeTab:w,loading:g,tabData:E()[w],data:k,mode:C,handleTabChange:N,toggleAlertMode:R,page:p,setPage:h,isMarkAllAsRead:x}};var ww,Cw,Sw;function Kp(){return Kp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Kp.apply(null,arguments)}var Z7=function(t){return S.createElement("svg",Kp({xmlns:"http://www.w3.org/2000/svg",width:16,height:17,fill:"none"},t),ww||(ww=S.createElement("path",{stroke:"#909090",strokeLinecap:"round",strokeMiterlimit:10,d:"M8.013 2.19c-2.206 0-4 1.793-4 4v1.927c0 .406-.173 1.026-.38 1.373l-.766 1.273c-.474.787-.147 1.66.72 1.954 2.873.96 5.973.96 8.846 0a1.335 1.335 0 0 0 .72-1.954l-.766-1.273c-.2-.347-.374-.967-.374-1.373V6.19c0-2.2-1.8-4-4-4Z"})),Cw||(Cw=S.createElement("path",{stroke:"#909090",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10,d:"M9.247 2.383a4.503 4.503 0 0 0-2.467 0 1.324 1.324 0 0 1 2.467 0"})),Sw||(Sw=S.createElement("path",{stroke:"#909090",strokeMiterlimit:10,d:"M10.013 12.957c0 1.1-.9 2-2 2a2.007 2.007 0 0 1-2-2"})))};const J7=({count:e})=>(It(),m.jsxs(m.Fragment,{children:[m.jsx(we,{sx:{gap:"0.5rem",display:"flex",justifyContent:"center",alignItems:"center","& svg":{transform:"scale(1)"}},children:m.jsx(Z7,{style:{scale:2}})}),m.jsx(j7,{badgeContent:e!=0?"":null,color:"error"})]}));function Tw({children:e,handleClose:t,open:n,isMainDialog:r}){return m.jsx(Ml,{open:n,onClose:t,scroll:r?"paper":void 0,fullWidth:!r,maxWidth:r?void 0:"md",PaperProps:{sx:r?{position:"fixed",top:30,right:30,m:0,width:400,height:450,display:"flex",flexDirection:"column",borderRadius:2,boxShadow:6,backgroundColor:o=>o.palette.primary.notifyBackground}:{minHeight:250,maxHeight:500,borderRadius:"1.5rem",boxShadow:6,backgroundColor:o=>o.palette.primary.appBackground}},children:e})}var kw;function Xp(){return Xp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Xp.apply(null,arguments)}var Q7=function(t){return S.createElement("svg",Xp({xmlns:"http://www.w3.org/2000/svg",width:14,height:9,fill:"none",viewBox:"0 0 13 9"},t),kw||(kw=S.createElement("path",{fill:"#A8A8A8",fillRule:"evenodd",d:"M8.954 1.004a.406.406 0 0 1 0 .575L3.537 6.996a.406.406 0 0 1-.574 0L.796 4.829a.406.406 0 1 1 .575-.575l1.879 1.88 5.13-5.13a.406.406 0 0 1 .574 0m3.25 0a.406.406 0 0 1 0 .575L6.787 6.996a.406.406 0 1 1-.574-.575l5.416-5.417a.406.406 0 0 1 .575 0",clipRule:"evenodd"})))},Ow,Ew;function Zp(){return Zp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zp.apply(null,arguments)}var eW=function(t){return S.createElement("svg",Zp({xmlns:"http://www.w3.org/2000/svg",width:12,height:12,fill:"none"},t),Ow||(Ow=S.createElement("path",{stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"round",d:"M7.79 6c0 .99-.8 1.79-1.79 1.79S4.21 6.99 4.21 6 5.01 4.21 6 4.21s1.79.8 1.79 1.79"})),Ew||(Ew=S.createElement("path",{stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"round",d:"M6 10.135c1.765 0 3.41-1.04 4.555-2.84.45-.705.45-1.89 0-2.595C9.41 2.9 7.765 1.86 6 1.86S2.59 2.9 1.445 4.7c-.45.705-.45 1.89 0 2.595 1.145 1.8 2.79 2.84 4.555 2.84"})))},Pw;function Jp(){return Jp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Jp.apply(null,arguments)}var tW=function(t){return S.createElement("svg",Jp({xmlns:"http://www.w3.org/2000/svg",width:9,height:8,fill:"none"},t),Pw||(Pw=S.createElement("path",{fill:"#fff",fillRule:"evenodd",d:"M8.277 1.004a.406.406 0 0 1 0 .575L2.86 6.996a.406.406 0 0 1-.574 0L.119 4.829a.406.406 0 1 1 .575-.575l1.879 1.88 5.13-5.13a.406.406 0 0 1 .574 0",clipRule:"evenodd"})))};const Mw=({type:e,item:t,handleShowDetails:n,handleRead:r,handleCTAClicked:o,clickId:i,t:a})=>{var u,d;const l=It(),c=(d=(u=JSON.parse(localStorage.getItem("settings")))==null?void 0:u.platform)==null?void 0:d.theme;return m.jsxs(we,{className:"cards",sx:{pt:" 0.8rem"},children:[m.jsx(lt,{display:"flex",flexDirection:"row",alignItems:"start",justifyContent:"space-between",gap:1,children:m.jsx(od,{sx:{width:"calc(100% - 2%)","& .MuiBadge-badge":{backgroundColor:"#6041EA",height:"0.5rem",minWidth:"0.5rem"}},variant:"dot",invisible:t==null?void 0:t.isRead,children:m.jsx(Eo,{sx:{color:l.palette.primary.notifyActiveText,whiteSpace:"normal",wordBreak:"break-word"},component:"p",className:["title-card",(t==null?void 0:t.isRead)&&"read"].join(" "),children:a(t==null?void 0:t.message)})})}),m.jsx(lt,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:m.jsxs(lt,{display:"flex",flexDirection:"row",justifyContent:"start",gap:1,sx:{p:"0.5rem 0"},children:[(t==null?void 0:t.isNotificationDetails)&&m.jsx(Vc,{icon:m.jsx(eW,{className:`${c==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:n,label:i===(t==null?void 0:t.id)?m.jsx(Pl,{color:"primary",size:13}):a("SHOW_DETAILS"),component:"button",variant:"filled",clickable:!0,size:"small",sx:{backgroundColor:l.palette.brandColor.orange,color:l.palette.brandColor.white}}),!(t!=null&&t.isRead)&&m.jsx(Vc,{icon:m.jsx(tW,{className:`${c==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:r,label:a("ACKNOWLEDGE"),component:"button",variant:"outlined",clickable:!0,size:"small"}),(t==null?void 0:t.primaryCTAURL)&&m.jsx(Vc,{disabled:t==null?void 0:t.isPrimaryCTAClicked,onClick:()=>o({redirect:t==null?void 0:t.isPrimaryCTARedirect,isClicked:t==null?void 0:t.isPrimaryCTAClicked,url:t==null?void 0:t.primaryCTAURL}),label:a(t==null?void 0:t.primaryCTALabel),component:"button",variant:"outlined",clickable:!0,size:"small"}),(t==null?void 0:t.secondaryCTAURL)&&m.jsx(Vc,{disabled:t==null?void 0:t.isSecondaryCTAClicked,onClick:()=>o({redirect:t==null?void 0:t.isSecondaryCTARedirect,isClicked:t==null?void 0:t.isSecondaryCTAClicked,url:t==null?void 0:t.secondaryCTAURL}),label:a(t==null?void 0:t.secondaryCTALabel),component:"button",variant:"outlined",clickable:!0,size:"small"})]})}),m.jsxs(lt,{display:"flex",flexDirection:"row",alignItems:"center",gap:.35,children:[m.jsx(Eo,{sx:{fontSize:"0.8rem"},children:a(t==null?void 0:t.product)}),m.jsx(Eo,{color:l.palette.primary.notifyTextColor,children:"•"}),m.jsx(Eo,{sx:{fontSize:"0.8rem"},children:g8(t==null?void 0:t.createdAt)})]})]})};Mw.propTypes={type:s.string,title:s.string,subTitle:s.string,isRead:s.bool,handleShowDetails:s.func,handleRead:s.func};const Dw=({data:e,handleRead:t,handleShowDetails:n,clickId:r,mode:o,page:i,setPage:a,t:l})=>{const{isMarkAllAsRead:c}=M.useContext(Up),u=new Date,d=new Intl.DateTimeFormat("en-US",{day:"numeric",month:"long",year:"numeric"}).format(u),[f,p]=M.useState([]),[h,y]=M.useState(!1),[g,b]=M.useState(!0),x=M.useRef(null),C=async k=>{y(!0);const v=e.slice((k-1)*10,k*10);await new Promise(O=>setTimeout(O,1e3)),p(O=>{const E=v.filter(P=>!O.some(D=>D.id===P.id));return[...O,...E]}),y(!1),(f==null?void 0:f.length)>=(e==null?void 0:e.length)&&b(!1)};M.useEffect(()=>{var v;let k=[];o?c!=null&&c.count?k=(v=e==null?void 0:e.filter(O=>!O.isRead))==null?void 0:v.slice(0,10):k=[]:k=e.slice(0,10),(k==null?void 0:k.length)<10&&b(!1),p(k)},[e,o,c]),M.useEffect(()=>{g&&i!==1&&C(i)},[i,e]),M.useEffect(()=>{p([...e])},[e]),M.useEffect(()=>{const k=new IntersectionObserver(v=>{v[0].isIntersecting&&!h&&g&&a(O=>O+1)},{threshold:1});return x.current&&k.observe(x.current),()=>{x.current&&k.unobserve(x.current)}},[h,g]);const w=({redirect:k,isClicked:v,url:O})=>{window.open(O,"_blank")};return m.jsxs(we,{sx:{width:"100%"},children:[Object.entries(x8(f)).map(([k,v])=>{const O=localStorage.getItem("i18nextLng"),E=new Date(k),P=new Intl.DateTimeFormat(O,{month:"long"}).format(E),D=E.getDate(),A=E.getFullYear(),N=`${P} ${D}, ${A}`;return m.jsxs(M.Fragment,{children:[k!==d&&m.jsx(A7,{children:N}),v.map((R,j)=>m.jsx(M.Fragment,{children:m.jsx(Mw,{item:R,handleCTAClicked:w,handleShowDetails:()=>n(R.id,R.snopId),handleRead:()=>t([R.id],R.snopId),clickId:r,t:l})},`${j}_${R.id}`))]},k)}),h&&i>1&&!!(f!=null&&f.length)&&m.jsx(we,{sx:{display:"flex",justifyContent:"center",alignItems:"center",pl:"0.5rem",py:"0.3rem"},children:m.jsx(Pl,{size:20,sx:{color:k=>k.palette.primary.notifyIconColor}})}),!(f!=null&&f.length)&&m.jsx(rt,{sx:{fontSize:"1.1rem",color:k=>k.palette.primary.notifyTextColor,textAlign:"center",px:"0.8rem"},children:l("CONTAINER_MESSAGE")}),m.jsx(we,{ref:x,style:{height:"0.1rem",backgroundColor:"transparent"}})]})};Dw.propTypes={data:s.array,handleRead:s.func,handleShowDetails:s.func};const nW=({onRefresh:e,handleShowDetails:t,clickId:n,handleRead:r,handleMarkAllAsRead:o,t:i})=>{var g,b,x,C;const{loading:a,activeTab:l,data:c,tabData:u,mode:d,page:f,setPage:p,handleTabChange:h,toggleAlertMode:y}=xw({});return m.jsxs(m.Fragment,{children:[m.jsxs(we,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,pt:2},children:[m.jsx(rt,{variant:"h2",sx:{fontSize:"1.2rem",color:w=>w.palette.primary.notifyTextColor},children:i("NOTIFICATION")}),m.jsx(we,{onClick:e,children:m.jsx(mn,{url:Qe.Refresh,alt:"refresh",sx:{cursor:"pointer"}})})]}),m.jsx(we,{sx:{borderBottom:1,m:"1.2rem 1.2rem 0 1.2rem",borderColor:w=>w.palette.primary.notifyBorderColor},children:m.jsxs(N7,{value:l,onChange:h,children:[m.jsx(Wp,{label:m.jsx(we,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:m.jsx(rt,{component:"span",sx:{fontWeight:500,fontSize:"1rem"},children:i("ALL",{count:((g=c==null?void 0:c.filter(w=>!(w!=null&&w.isRead)))==null?void 0:g.length)||0})})})}),m.jsx(Wp,{label:m.jsx(we,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:m.jsx(rt,{component:"span",sx:{fontWeight:500,fontSize:"1rem"},children:i("INFO",{count:((b=c==null?void 0:c.filter(w=>(w==null?void 0:w.type)==="INFO"&&!(w!=null&&w.isRead)))==null?void 0:b.length)||0})})}),sx:{color:w=>w.palette.brandColor.blue}}),m.jsx(Wp,{label:m.jsx(we,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:i("ERROR",{count:((x=c==null?void 0:c.filter(w=>(w==null?void 0:w.type)==="ERROR"&&!(w!=null&&w.isRead)))==null?void 0:x.length)||0})}),sx:{color:w=>w.palette.brandColor.red}})]})}),m.jsx(Rl,{dividers:!0,sx:{p:0,...a&&!u.length&&{alignItems:"center",justifyContent:"center"},flexGrow:1,overflowY:"auto",mx:"1.2rem",borderColor:w=>w.palette.primary.notifyBorderColor},tabIndex:-1,children:a?m.jsx(Pl,{size:30,sx:{color:w=>w.palette.primary.notifyIconColor}}):m.jsx(m.Fragment,{children:m.jsx(Dw,{data:u,handleShowDetails:t,handleRead:r,clickId:n,page:f,setPage:p,mode:d,t:i})})}),m.jsxs(Dl,{sx:{justifyContent:"space-between",px:"1.2rem"},children:[m.jsxs(lt,{direction:"row",gap:1,children:[m.jsx(Eo,{sx:{fontSize:"1rem"},children:i("SHOW_UNREAD")}),m.jsx(I7,{disabled:a,checked:d,onChange:y})]}),m.jsx(qn,{variant:"outlined",className:"view-all",onClick:o,startIcon:m.jsx(Q7,{}),disabled:!((C=c==null?void 0:c.filter(w=>!(w!=null&&w.isRead)))!=null&&C.length),style:{backgroundColor:"transparent"},sx:{fontSize:"1rem",fontWeight:"300",p:0,border:"none",textTransform:"none",color:w=>w.palette.primary.notifyTextColor,"&:hover":{color:w=>w.palette.primary.notifyActiveText,background:"transparent",boxShadow:"none",border:"none"},"&.Mui-disabled":{opacity:.5,color:w=>`${w.palette.primary.notifyActiveText}!important`,background:"transparent",boxShadow:"none",border:"none"}},children:i("READ_ALL")})]})]})},rW=({data:e,handleClose:t,t:n})=>{var x;const[r,o]=M.useState(1),[i,a]=M.useState(10),[l,c]=M.useState(((x=e==null?void 0:e.notificationDetails)==null?void 0:x.length)||0),[u,d]=M.useState("sku_name"),[f,p]=M.useState("asc"),[h,y]=M.useState([]),[g,b]=M.useState("");return M.useEffect(()=>{var C,w;if((g||u)&&((C=e==null?void 0:e.notificationDetails)!=null&&C.length)){const k=b8(e==null?void 0:e.notificationDetails,b7,g);if(u){const v=v8(k,u,f);y(gp(v,r,i)),c((v==null?void 0:v.length)||0);return}y(gp(k,r,i)),c((k==null?void 0:k.length)||0);return}y(gp(e==null?void 0:e.notificationDetails,r,i)),c((w=e==null?void 0:e.notificationDetails)==null?void 0:w.length)},[g,e,r,i,f,u]),m.jsxs(m.Fragment,{children:[m.jsxs(lt,{direction:"row",justifyContent:"space-between",sx:{padding:"1.5rem 2rem",borderBottom:"0.1rem solid",borderColor:C=>C.palette.primary.notifyBorderColor},children:[m.jsx(rt,{component:"h2",sx:{fontSize:"1.4rem",color:C=>C.palette.primary.notifyActiveText},children:n(e==null?void 0:e.message)||(e==null?void 0:e.message)}),m.jsx(we,{onClick:t,sx:{cursor:"pointer"},children:m.jsx(mn,{url:Qe.CloseCircle})})]}),m.jsx(Rl,{children:m.jsx(zp,{t:n,tableProps:{data:h,columns:{...R7({t:n}),isManageable:!1},sort:{sortField:u,sortDir:f,onSort:C=>{var k;const w=(k=C==null?void 0:C.column)==null?void 0:k.key;p(v=>u===w&&v==="asc"?"desc":"asc"),d(w)}},pagination:{selectedPage:r,rowPerPage:i,totalRecords:l,onPageChange:C=>{o(C)},onPageSizeChange:C=>{a(C==null?void 0:C.value),o(1)}}},toolbarProps:{defaultTools:{search:{isRequired:!0,onChange:C=>{const w=C.target.value;w&&o(1),b(w)},placeholder:`${n("SEARCH")}...`}}}})}),m.jsx(Dl,{sx:{padding:"1.5rem 2rem"}})]})},oW=({baseUrl:e,t})=>{const{alertDialogProps:n,showDetailsProps:r,fetchNotification:o,isMarkAllAsRead:i}=xw({baseUrl:e});return m.jsxs(m.Fragment,{children:[m.jsx(we,{sx:{display:"flex",justifyContent:"center",cursor:"pointer",marginTop:"0.6rem"},onClick:()=>{var a;o(),(a=n==null?void 0:n.setOpen)==null||a.call(n,!0)},children:m.jsx(J7,{count:i.count})}),m.jsx(Tw,{...n,children:m.jsx(nW,{...n,t})}),m.jsx(Tw,{...r,children:m.jsx(rW,{...r,t})})]})},sW=({baseUrl:e,t})=>m.jsx(Ln,{children:m.jsx(q7,{children:m.jsx(oW,{baseUrl:e,t})})}),iW=({rightChild:e,leftChild:t,isDrawerMerged:n,isDrawerOpen:r,drawerTitle:o,showExpand:i,onCloseClick:a,onMergeClick:l,onExpandClick:c,isDrawerExpanded:u,styles:d,showMerge:f})=>{const p=It();return m.jsx(we,{sx:{position:"relative",overflow:"hidden"},children:m.jsxs(uo,{container:!0,sx:{height:"100%"},children:[m.jsx(uo,{item:!0,sx:{width:n?d!=null&&d.drawerWidth?`calc(${"100%"-(d==null?void 0:d.drawerWidth)})`:"75%":"100%",position:"relative",zIndex:3,height:"calc(100vh - 7rem)",p:"0rem 1.5rem",overflow:"auto"},children:t}),r&&!n&&m.jsx(m.Fragment,{children:m.jsx(we,{onClick:a,sx:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"#07080B80",backdropFilter:"blur(3px)",zIndex:3,transition:"opacity 0.3s ease-in-out"}})}),e&&m.jsxs(uo,{item:!0,sx:{width:u?"90%":(d==null?void 0:d.drawerWidth)||"25%",position:n?"relative":"absolute",top:0,right:0,height:"calc(100vh - 7rem)",backgroundColor:p.palette.primary.notifyBackground,transform:r?"translateX(0)":"translateX(100%)",transition:"transform 0.4s ease-in-out , width 0.4s ease-in-out",zIndex:4,borderLeft:`0.1rem solid ${p.palette.primary.notifyBorderColor}`,display:"flex",flexDirection:"column"},children:[m.jsxs(lt,{direction:"row",alignItems:"center",sx:{width:"100%",flexShrink:0,paddingBottom:"0.8rem",px:2,pt:"0.8rem",borderBottom:h=>`0.1rem solid ${h.palette.primary.notifyBorderColor}`},children:[!u&&f&&m.jsxs(m.Fragment,{children:[m.jsx(we,{component:"img",src:Qe.Merge,sx:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer"},onClick:l}),m.jsx(Ci,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"auto!important",borderColor:p.palette.primary.notifyBorderColor}})]}),m.jsxs(lt,{direction:"row",justifyContent:"space-between",alignItems:"center",flexGrow:1,children:[m.jsxs(lt,{direction:"row",gap:"0.5rem",alignItems:"center",onClick:a,sx:{cursor:"pointer"},children:[m.jsx(mn,{url:Qe.CrossLight}),m.jsx(rt,{sx:{fontSize:"1.2rem",color:p.palette.primary.notifyTextColor},children:o})]}),m.jsx(lt,{direction:"row",gap:"0.5rem",alignItems:"center",children:i&&m.jsx(we,{onClick:c,sx:{cursor:"pointer"},children:m.jsx(we,{component:"img",src:u?Qe.Collapse:Qe.Expand})})})]})]}),m.jsx(we,{sx:{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},overflow:"auto",px:2},children:e})]})]})})},Rw=({layoutChildren:e,layoutProps:t})=>m.jsx(Ln,{children:m.jsx(iW,{...e,...t})});Rw.propTypes={layoutChildren:s.object.isRequired,layoutProps:s.object.isRequired},xt.Button=Er,xt.Checkbox=lc,xt.DatePicker=P8,xt.Grid=zp,xt.Header=yw,xt.InputField=p1,xt.Loader=H8,xt.Notification=sW,xt.Select=h1,xt.SliderLayout=Rw,xt.Switch=b1,xt.TextField=Sc,xt.ToastProvider=B8,xt.toast=F8,Object.defineProperty(xt,Symbol.toStringTag,{value:"Module"})});
|
|
326
|
+
`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=ko(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&_c.assertOptions(r,{silentJSONParsing:gr.transitional(gr.boolean),forcedJSONParsing:gr.transitional(gr.boolean),clarifyTimeoutError:gr.transitional(gr.boolean)},!1),o!=null&&(oe.isFunction(o)?n.paramsSerializer={serialize:o}:_c.assertOptions(o,{encode:gr.function,serialize:gr.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),_c.assertOptions(n,{baseUrl:gr.spelling("baseURL"),withXsrfToken:gr.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&oe.merge(i.common,i[n.method]);i&&oe.forEach(["delete","get","head","post","put","patch","common"],y=>{delete i[y]}),n.headers=yn.concat(a,i);const l=[];let c=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(n)===!1||(c=c&&g.synchronous,l.unshift(g.fulfilled,g.rejected))});const u=[];this.interceptors.response.forEach(function(g){u.push(g.fulfilled,g.rejected)});let d,f=0,p;if(!c){const y=[J1.bind(this),void 0];for(y.unshift.apply(y,l),y.push.apply(y,u),p=y.length,d=Promise.resolve(n);f<p;)d=d.then(y[f++],y[f++]);return d}p=l.length;let h=n;for(f=0;f<p;){const y=l[f++],g=l[f++];try{h=y(h)}catch(b){g.call(this,b);break}}try{d=J1.call(this,h)}catch(y){return Promise.reject(y)}for(f=0,p=u.length;f<p;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=ko(this.defaults,t);const n=z1(t.baseURL,t.url,t.allowAbsoluteUrls);return j1(n,t.params,t.paramsSerializer)}};oe.forEach(["delete","get","head","options"],function(t){Oo.prototype[t]=function(n,r){return this.request(ko(r||{},{method:t,url:n,data:(r||{}).data}))}}),oe.forEach(["post","put","patch"],function(t){function n(r){return function(i,a,l){return this.request(ko(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}Oo.prototype[t]=n(),Oo.prototype[t+"Form"]=n(!0)});let m7=class Bw{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(o=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](o);r._listeners=null}),this.promise.then=o=>{let i;const a=new Promise(l=>{r.subscribe(l),i=l}).then(o);return a.cancel=function(){r.unsubscribe(i)},a},t(function(i,a,l){r.reason||(r.reason=new Fs(i,a,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Bw(function(o){t=o}),cancel:t}}};function g7(e){return function(n){return e.apply(null,n)}}function y7(e){return oe.isObject(e)&&e.isAxiosError===!0}const Ap={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ap).forEach(([e,t])=>{Ap[t]=e});function tw(e){const t=new Oo(e),n=x1(Oo.prototype.request,t);return oe.extend(n,Oo.prototype,t,{allOwnKeys:!0}),oe.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return tw(ko(e,o))},n}const Tt=tw(Sa);Tt.Axios=Oo,Tt.CanceledError=Fs,Tt.CancelToken=m7,Tt.isCancel=L1,Tt.VERSION=Q1,Tt.toFormData=Rc,Tt.AxiosError=Ge,Tt.Cancel=Tt.CanceledError,Tt.all=function(t){return Promise.all(t)},Tt.spread=g7,Tt.isAxiosError=y7,Tt.mergeConfig=ko,Tt.AxiosHeaders=yn,Tt.formToJSON=e=>_1(oe.isHTMLForm(e)?new FormData(e):e),Tt.getAdapter=Z1.getAdapter,Tt.HttpStatusCode=Ap,Tt.default=Tt;const{Axios:dz,AxiosError:fz,CanceledError:pz,isCancel:hz,CancelToken:mz,VERSION:gz,all:yz,Cancel:bz,isAxiosError:vz,spread:xz,toFormData:wz,AxiosHeaders:Cz,HttpStatusCode:Sz,formToJSON:Tz,getAdapter:kz,mergeConfig:Oz}=Tt,jp={BASE_URL:"https://qa.3sc.ai/api",VERSION:"/v1"},ka={headers:{"Content-Type":"application/json"},withCredentials:!0},nw=Tt.create({baseURL:jp.BASE_URL,axiosConfig:ka});nw.interceptors.request.use(function(e){return e},function(e){return Promise.reject(e)}),nw.interceptors.response.use(function(e){return e},function(e){return Promise.reject(e)});const Ir={TOKEN:"token",USER:"user",SNOP:"snop",SELECTED_BU:"selected_business_unit",SETTINGS:"settings"},rw={TENANT_ID:"tenant_id",BU_ID:"bu_id"},b7=Object.values({"SKU Name":"sku_name",Node:"node","Channel Name":"channel_name"}),v7=[10,25,50,100],x7={MARK_ALL_READ:"MARK_ALL_READ"},w7=v7.map(e=>({label:e,value:e})),ow={PRIMARY:"PRIMARY",SECONDARY:"SECONDARY"},$c={NOTIFICATION:"/notifications",SETTING:"/configuration/setting"};/*! js-cookie v3.0.5 | MIT */function Lc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var C7={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Np(e,t){function n(o,i,a){if(!(typeof document>"u")){a=Lc({},t,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var l="";for(var c in a)a[c]&&(l+="; "+c,a[c]!==!0&&(l+="="+a[c].split(";")[0]));return document.cookie=o+"="+e.write(i,o)+l}}function r(o){if(!(typeof document>"u"||arguments.length&&!o)){for(var i=document.cookie?document.cookie.split("; "):[],a={},l=0;l<i.length;l++){var c=i[l].split("="),u=c.slice(1).join("=");try{var d=decodeURIComponent(c[0]);if(a[d]=e.read(u,d),o===d)break}catch{}}return o?a[o]:a}}return Object.create({set:n,get:r,remove:function(o,i){n(o,"",Lc({},i,{expires:-1}))},withAttributes:function(o){return Np(this.converter,Lc({},this.attributes,o))},withConverter:function(o){return Np(Lc({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var S7=Np(C7,{path:"/"});const Fp=Tc(Ir.SNOP),_p=Tc(Ir.SELECTED_BU),$p=Tc(Ir.USER);Tc(Ir.SETTINGS);const sw={BU_IDS:_p==null?void 0:_p.business_unit_id,TOKEN:JSON.parse(S7.get(Ir.TOKEN)||null),TENANT_IDS:$p==null?void 0:$p.tenant_id,SNOP_IDS:Fp==null?void 0:Fp.snop_id},{TENANT_ID:T7,BU_ID:k7}=rw,{TENANT_IDS:O7,BU_IDS:E7}=sw,Bc=async({baseUrl:e,payload:t})=>{try{const n=`${e}${$c.SETTING}/v1?${T7}=${O7}&${k7}=${E7}`;return await Tt.post(n,t,ka)}catch(n){return n}},P7=({columns:e,gridPath:t,baseUrl:n,isDefaultConfig:r,pageSize:o=10,childUniqueKey:i,data:a})=>{var w,k,v;const l=a==null?void 0:a.length;let{definitions:c,defaultUserSettings:u,labels:d}=e;const f=Ar(d),p=t.split("/").filter(Boolean),h=JSON.parse(localStorage.getItem(Ir.SETTINGS));let y=p.reduce((O,E)=>O==null?void 0:O[E],h)||null;const g=Ar((y==null?void 0:y.columns)||[]);if(!r&&t&&l){let O=(u&&Lp({col:u,childUniqueKey:i,definitions:c}))??Lp({col:c,childUniqueKey:i});const E=O.filter(D=>!g[D.key]),P=y&&((w=y==null?void 0:y.columns)==null?void 0:w.some(D=>(D==null?void 0:D.children)&&D.children[i]));if(l&&(E.length||P===!1)){if(P==!1){const D=Ar(O);O=(k=y==null?void 0:y.columns)==null?void 0:k.map(A=>{var N;return A!=null&&A.children&&!A.children[i]?{...A,children:{...A.children,[i]:(N=D==null?void 0:D[A==null?void 0:A.key])==null?void 0:N.children[i]}}:A})}(async()=>{try{const A={...h||{platform:{theme:"light"}}},N=(y==null?void 0:y.pageSize)??o;let R=A;for(let j=0;j<p.length;j++){const _=p[j];j===p.length-1?R[_]={columns:O,pageSize:N}:(R[_]={...R[_]||{}},R=R[_])}localStorage.setItem(Ir.SETTINGS,JSON.stringify(A)),await Bc({baseUrl:n,payload:A})}catch(D){console.error(D)}})()}}u=((y==null?void 0:y.columns)&&D7(g,u,i))??u??Lp({col:c});const b=[],x=Ar(u);for(const O of c){const E=x[O.key]||{},P=f[O.key]||{},D=g[O.key],A=Ar(E.children||[]),N=Ar(P.children||[]);let R={...O,style:D==null?void 0:D.style,...E,...P};(v=O.children)!=null&&v.length&&(R.children=O.children.map(j=>({...j,...A[j.key],...N[j.key]}))),b.push(R)}return b.sort((O,E)=>O.sequenceId-E.sequenceId)},M7=e=>e.sort((t,n)=>t.sequenceId-n.sequenceId),Oa=({columns:e,childUniqueKey:t,definitions:n})=>{let r=n||e;return e==null?void 0:e.map(o=>{let i=r==null?void 0:r.find(a=>(a==null?void 0:a.key)===(o==null?void 0:o.key));return{id:o.id,key:o.key,sequenceId:o.sequenceId||o.id,isHidden:o.isHidden||!1,style:o.style||(i==null?void 0:i.style)||{},...(o==null?void 0:o.children)&&{children:t?{[t]:Oa({columns:o.children,definitions:i==null?void 0:i.children})}:Oa({columns:o.children,definitions:i==null?void 0:i.children})}}})},Ar=e=>Array.isArray(e)&&(e==null?void 0:e.reduce((t,n)=>(t[n.key]=n,t),{})),Lp=({col:e,childUniqueKey:t,definitions:n})=>Oa({columns:e,childUniqueKey:t,definitions:n}),D7=(e,t,n)=>t.map(o=>{const i=e[o.key],a=o.children?o.children.map(l=>{var d;const c=Ar(Array.isArray(i==null?void 0:i.children)?i==null?void 0:i.children:(d=i==null?void 0:i.children)==null?void 0:d[n]),u=c==null?void 0:c[l.key];return{...l,sequenceId:(u==null?void 0:u.sequenceId)||l.sequenceId,isHidden:(u==null?void 0:u.isHidden)??l.isHidden}}):void 0;return{...o,sequenceId:(i==null?void 0:i.sequenceId)||o.sequenceId,isHidden:(i==null?void 0:i.isHidden)??o.isHidden,...a?{children:a}:{}}}),R7=({t:e})=>{const t=[{id:1,key:"sku_name",isSortable:!0,isMandatory:!0},{id:2,key:"node",isSortable:!0,isMandatory:!0},{id:3,key:"channel_name",isSortable:!0,isMandatory:!0}],n=[{id:1,key:"sku_name",sequenceId:1,isHidden:!1,style:{width:"20rem",minWidth:"20rem",maxWidth:"20rem"}},{id:2,key:"node",sequenceId:2,isHidden:!1,style:{width:"20rem",minWidth:"20rem",maxWidth:"20rem"}},{id:3,key:"channel_name",sequenceId:3,isHidden:!1,style:{width:"20rem",minWidth:"20rem",maxWidth:"20rem"}}],r=[{id:1,key:"sku_name",label:e(Y8),isLocalizable:!1},{id:2,key:"node",label:e(q8),isLocalizable:!1},{id:3,key:"channel_name",label:e(G8),isLocalizable:!1}];return{definitions:t,defaultUserSettings:n,labels:r}};class Bp extends M.Component{constructor(t){super(t),this.startDrag=this.startDrag.bind(this),this.endDrag=this.endDrag.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.dragging=!1,this.mouseX=0,this.startPos=0,this.startWidthPrev=0,this.lastDraggedWidth=0,this.draggedCol=null,this.resizeRef=M.createRef()}startDrag(){if(!this.props.disabled&&(this.draggedCol=this.props.id,this.props.resizeStart&&this.draggedCol===this.props.id&&this.props.resizeStart(),this.dragging=!0,this.startPos=this.mouseX,this.startWidthPrev=0,this.resizeRef.current)){let t=this.resizeRef.current.previousSibling;t&&(this.startWidthPrev=t.clientWidth)}}endDrag(){this.props.disabled||(this.dragging=!1,this.props.resizeEnd&&this.draggedCol===this.props.id&&this.props.resizeEnd(this.lastDraggedWidth),this.draggedCol=null)}onMouseMove(t){if(this.props.disabled||(this.mouseX=t.touches?t.touches[0].screenX:t.screenX,!this.dragging))return;const n=this.resizeRef.current,r=this.startPos-this.mouseX;let o=this.startWidthPrev-r;(!this.props.minWidth||o>=this.props.minWidth)&&(!this.props.maxWidth||o<=this.props.maxWidth)&&(n.previousSibling.style.width=o+"px",n.previousSibling.style.minWidth=o+"px",n.previousSibling.style.maxWidth=o+"px",n.previousSibling.style.setProperty("--column_resize_before_width",o+"px"),this.lastDraggedWidth=o)}componentDidMount(){const t=this.resizeRef.current;if(t&&(this.props.defaultWidth?(t.previousSibling.style.minWidth=this.props.defaultWidth+"px",t.previousSibling.style.width=this.props.defaultWidth+"px",t.previousSibling.style.maxWidth=this.props.defaultWidth+"px",t.previousSibling.style.setProperty("--column_resize_before_width",this.props.defaultWidth+"px")):this.props.minWidth&&(t.previousSibling.style.minWidth=this.props.minWidth+"px",t.previousSibling.style.width=this.props.minWidth+"px",t.previousSibling.style.maxWidth=this.props.minWidth+"px",t.previousSibling.style.setProperty("--column_resize_before_width",this.props.minWidth+"px"))),this.props.disabled){this.props.defaultWidth&&t&&(t.previousSibling.style.minWidth=this.props.defaultWidth+"px",t.previousSibling.style.width=this.props.defaultWidth+"px",t.previousSibling.style.maxWidth=this.props.defaultWidth+"px",t.previousSibling.style.setProperty("--column_resize_before_width",this.props.defaultWidth+"px")),this.props.maxWidth&&t&&(t.previousSibling.style.maxWidth=this.props.maxWidth+"px");return}this.addEventListenersToDocument()}componentWillUnmount(){this.props.disabled||this.removeEventListenersFromDocument()}componentDidUpdate(t,n){t.disabled&&!this.props.disabled&&this.addEventListenersToDocument(),!t.disabled&&this.props.disabled&&this.removeEventListenersFromDocument()}addEventListenersToDocument(){document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.endDrag),document.addEventListener("touchmove",this.onMouseMove),document.addEventListener("touchend",this.endDrag)}removeEventListenersFromDocument(){document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.endDrag),document.removeEventListener("touchmove",this.onMouseMove),document.removeEventListener("touchend",this.endDrag)}render(){var t={userSelect:"none"};return this.props.disabled||(t.cursor="ew-resize"),this.props.className===""&&(t.width="6px",t.backgroundColor="rgba(0, 0, 0, 0.1)"),M.createElement("th",{ref:this.resizeRef,style:t,disabled:this.props.disabled,rowSpan:this.props.rowSpan?this.props.rowSpan:1,colSpan:this.props.colSpan?this.props.colSpan:1,className:`column_resizer_own_class ${this.props.disabled?"disabled_column_resize":""} ${this.props.className}`,onMouseDown:this.props.disabled?null:this.startDrag,onTouchStart:this.props.disabled?null:this.startDrag})}}Bp.defaultProps={disabled:!1,minWidth:0,className:""},Bp.propTypes={disabled:"boolean",minWidth:"number",className:"string"};function Vp({isRenderCellContent:e,column:t,row:n,parent:r}){const o=n[t.key],i=(o==null?void 0:o.length)>20;return m.jsx(m.Fragment,{children:e?m.jsx(we,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem"},children:t==null?void 0:t.cellRenderer(n,{column:t,parent:r})}):m.jsx(m.Fragment,{children:i?m.jsx(xd,{title:o,placement:"top",componentsProps:{tooltip:{sx:{fontSize:"1rem",padding:"0.5rem 1rem",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"}}},children:m.jsx(we,{sx:{maxWidth:"auto",whiteSpace:"normal"},children:m.jsx(rt,{sx:{fontSize:"1.1rem",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none"},children:o})})}):m.jsx(we,{sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem",m:0},id:t.key,component:"p",children:o??""})})})}Vp.propTypes={isRenderCellContent:s.bool,column:s.object,row:s.object},K(Ml)(({theme:e})=>({"& .MuiPaper-root":{borderRadius:8,border:`1px solid ${e.palette.primary.notifyBorderColor}`,boxShadow:e.shadows[4],padding:"1rem 1rem 0rem 1rem",backgroundColor:e.palette.primary.notifyBackground}}));const Eo=K(rt)(({theme:e})=>({color:e.palette.primary.notifyTextColor,fontSize:"1.1rem"})),I7=K(_g)(({theme:e})=>({width:28,height:16,padding:0,display:"flex","&:active":{"& .MuiSwitch-thumb":{width:15},"& .MuiSwitch-switchBase.Mui-checked":{transform:"translateX(9px)"}},"& .MuiSwitch-switchBase":{padding:2,"&.Mui-checked":{transform:"translateX(12px)",color:"#fff","& + .MuiSwitch-track":{opacity:1,backgroundColor:"#1890ff",...e.applyStyles("dark",{backgroundColor:"#177ddc"})}}},"& .MuiSwitch-thumb":{boxShadow:"0 2px 4px 0 rgb(0 35 11 / 20%)",width:12,height:12,borderRadius:6,transition:e.transitions.create(["width"],{duration:200})},"& .MuiSwitch-track":{borderRadius:16/2,opacity:1,backgroundColor:"rgba(0,0,0,.25)",boxSizing:"border-box",...e.applyStyles("dark",{backgroundColor:"rgba(255,255,255,.35)"})}})),A7=K(Ci)(({theme:e})=>({color:e.palette.primary.notifyTextColor,padding:"0.6rem 0",fontSize:"0.9rem",fontWeight:500,"&::before, &::after":{borderColor:`${e.palette.primary.notifyBorderColor}!important`}})),j7=K(od)(({theme:e})=>({"& .MuiBadge-badge":{right:3.5,top:1.8,border:`0.1rem solid ${e.palette.primary.notifyBackground}`,padding:"0 1.3px",borderRadius:"50%",backgroundColor:"#D44E40",fontSize:"0.725rem",minWidth:"0.7rem",height:"0.7rem"}}));K(Vl)(({theme:e})=>({"& .MuiInputBase-root":{height:"3.52rem"},"& .MuiFormLabel-root":{color:`${e.palette.primary.notifyBorderColor} !important`,fontSize:"1rem",marginTop:"0.4rem"},"& label.Mui-focused":{color:e.palette.primary.notifyTextColor},"& .MuiInput-underline:after":{borderBottomColor:e.palette.primary.notifyBorderColor,borderBottomWidth:"0.1rem"},"& .MuiOutlinedInput-root":{"& fieldset":{borderColor:e.palette.primary.notifyBorderColor,borderWidth:"0.1rem"},"&:hover fieldset":{borderColor:e.palette.primary.notifyBorderColor,borderWidth:"0.1rem"},"&.Mui-focused fieldset":{borderColor:e.palette.primary.notifyBorderColor,borderWidth:"0.1rem"}}}));const N7=K(ty)(({theme:e})=>({minHeight:"2rem","& .MuiTabs-indicator":{height:"0.1rem",backgroundColor:e.palette.primary.notifyActiveText}})),Wp=K($g)(({theme:e})=>({color:e.palette.primary.notifyActiveText,textTransform:"none",fontWeight:"normal",padding:0,fontSize:"1rem",minHeight:"2rem",paddingBottom:"1rem","&.Mui-selected":{fontWeight:"bold",color:e.palette.primary.notifyActiveText}})),Vc=K(td)(({theme:e})=>({"&.MuiChip-outlined":{borderColor:e.palette.primary.notifyBorderColor,color:e.palette.primary.notifyActiveText},height:"2rem",fontSize:"0.9rem",fontWeight:"300",borderColor:e.palette.primary.notifyBorderColor,color:e.palette.primary.notifyActiveText,borderRadius:"0.6rem",padding:"0.2rem","&:hover":{backgroundColor:`${e.palette.brandColor.orange} !important`,color:`${e.palette.brandColor.white} !important`}})),F7=K(Ll)(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"table-cell",[`&.${Cd.head}`]:{color:e.palette.primary.notifyTextColor,backgroundColor:e.palette.primary.notifyBackground,borderColor:e.palette.primary.notifyBorderColor,padding:"0rem",textAlign:"center",lineHeight:"1.5rem"},[`&.${Cd.body}`]:{color:e.palette.primary.notifyTextColor,borderColor:e.palette.primary.notifyBorderColor,padding:"0rem",textAlign:"center"}}));function Ea({children:e,...t}){return m.jsx(F7,{...t,children:e})}Ea.propTypes={children:s.node};const _7=K(Gg)(()=>({"&:last-child td":{borderBottom:"none"}}));function _s({children:e,...t}){return m.jsx(_7,{...t,children:e})}_s.propTypes={children:s.node};const $7=M.memo(({row:e,isSelected:t,isHigh:n,onRowClick:r,children:o})=>m.jsx(_s,{sx:i=>({backgroundColor:t||n?i.palette.primary.appBackground:i.palette.primary.notifyBackground}),onClick:()=>r==null?void 0:r(e),children:o},e==null?void 0:e.fhi)),L7=M.memo(({nestedData:e,nestedColumn:t,t:n})=>e!=null&&e.length?m.jsx(m.Fragment,{children:e.map((r,o)=>m.jsx(_s,{children:t.map((i,a)=>m.jsx(Ea,{style:i==null?void 0:i.style,children:m.jsx(Vp,{isRenderCellContent:!!(i!=null&&i.cellRenderer),column:i,row:r})},a))},`nested-${o}`))}):m.jsx(_s,{children:m.jsx(Ea,{colSpan:t.length,children:m.jsx(Eo,{sx:{textAlign:"center"},children:n(Zr.NRF)})})})),B7=(e,t,n,r,o,i)=>{const[a,l]=M.useState({isOpen:!1,column:null}),c=(p,h,y)=>{l({isOpen:p.currentTarget,column:h,isChild:!!y})},u=()=>{l({isOpen:!1,column:null,isChild:!1})},d=async()=>{u();const p=e.map(h=>{var y;if(a!=null&&a.isChild&&Array.isArray(h.children)){const g=h.children.map(x=>{var C;return x.key===((C=a.column)==null?void 0:C.key)?{...x,isHidden:!0}:x}),b=g.every(x=>x.isHidden);return{...h,isHidden:b?!0:h.isHidden,children:g}}return h.key===((y=a.column)==null?void 0:y.key)?{...h,isHidden:!0}:h});f({updatedColumns:p})},f=async({updatedColumns:p})=>{t({type:Ue.SET_GRID_DATA,payload:{visibleGridColumns:p}});const h=r.split("/").filter(Boolean),y=JSON.parse(localStorage.getItem(Ir.SETTINGS));let g=h.reduce((O,E)=>O==null?void 0:O[E],y)||null,b=Oa({columns:p,childUniqueKey:i});const x=Ar(g==null?void 0:g.columns);b=b==null?void 0:b.map(O=>{var D,A;const E=(O==null?void 0:O.children)||{},P=((D=x==null?void 0:x[O==null?void 0:O.key])==null?void 0:D.children)||{};return{...O,...(((A=Object.keys(P))==null?void 0:A.length)>0||(E==null?void 0:E[i]))&&{children:{...P,[i]:E==null?void 0:E[i]}}}});const w={...y||{platform:{theme:"light"}}},k=(g==null?void 0:g.pageSize)??o;let v=w;for(let O=0;O<h.length;O++){const E=h[O];O===h.length-1?v[E]={columns:b,pageSize:k}:(v[E]={...v[E]||{}},v=v[E])}localStorage.setItem(Ir.SETTINGS,JSON.stringify(w)),await Bc({baseUrl:n,payload:w})};return{selectedColumn:a,handleMenuClick:c,handleClose:u,handleHideClick:d,columnUpdaterFunction:f}},V7=e=>{if(!e)return null;const{options:t,...n}=e,r=t?"select":"button",o={button:i=>{var a;return m.jsx(Er,{...i,styles:{...i.styles,iconPrimary:((a=i==null?void 0:i.styles)==null?void 0:a.variant)=="filled"}})},select:i=>{var a;return m.jsx(we,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"},width:(a=i.styles)==null?void 0:a.width},children:m.jsx(h1,{...i,options:t})})}};return o[r]?o[r](n):null},W7=({presentSetting:e,gridSetting:t,gridPath:n,childUniqueKey:r})=>{if(!n)return e;const o=n.split("/").filter(Boolean);let i=o.reduce((u,d)=>u==null?void 0:u[d],e)||null,a=Oa({columns:t==null?void 0:t.grid,childUniqueKey:r});const l=Ar(i==null?void 0:i.columns);a=a==null?void 0:a.map(u=>{var p,h;const d=(u==null?void 0:u.children)||{},f=((p=l==null?void 0:l[u==null?void 0:u.key])==null?void 0:p.children)||{};return{...u,...(((h=Object.keys(f))==null?void 0:h.length)>0||(d==null?void 0:d[r]))&&{children:{...f,[r]:d==null?void 0:d[r]}}}});let c=e;for(let u=0;u<o.length;u++){const d=o[u];u===o.length-1?c[d]={columns:a,pageSize:(t==null?void 0:t.pageSize)??null}:(c[d]=c[d]||{},c=c[d])}return{settingObject:e,defaultUserSettings:a}},z7=async({baseUrl:e,gridSetting:t,childUniqueKey:n,gridPath:r})=>{try{const o=JSON.parse(localStorage.getItem("settings")),{settingObject:i,defaultUserSettings:a}=W7({presentSetting:o,gridSetting:t,gridPath:r,childUniqueKey:n});return localStorage.setItem("settings",JSON.stringify(i)),await Bc({baseUrl:e,payload:i}),a}catch(o){console.error(o)}},U7=({index:e,visibleGridColumns:t,width:n,columnUpdaterFunction:r})=>{if(!t||!t[e])return null;t[e];let o=`${n/10}rem`;const i=t.map((a,l)=>l===e?{...a,style:{...a.style,width:o,minWidth:o,maxWidth:o}}:a);return r({updatedColumns:i}),i[e]},iw=({pagination:e,gridPath:t,baseUrl:n,t:r})=>{const{selectedPage:o,rowPerPage:i,totalRecords:a,onPageChange:l,onPageSizeChange:c}=e,u=It(),d=async(f,p)=>{if(!p)return;const h=p.split("/").filter(Boolean),y="settings",b={...JSON.parse(localStorage.getItem(y))||{}};let x=b;for(let C=0;C<h.length;C++){const w=h[C];C===h.length-1?x[w]={...x[w]||{},pageSize:f}:(x[w]={...x[w]||{}},x=x[w])}localStorage.setItem(y,JSON.stringify(b)),await Bc({baseUrl:n,payload:b})};return m.jsxs(we,{sx:{display:"flex",p:"1rem 1.5rem"},children:[m.jsxs(we,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"0.5rem",width:"100%"},children:[m.jsx(rt,{sx:{fontSize:"1.1rem",color:u.palette.primary.notifyTextColor},children:r("SHOWING_ROWS",{current:Math.min(o*i,a),total:a})}),m.jsx(we,{sx:{"& .MuiInputBase-input":{padding:"0rem 0.8rem!important"},width:"6rem"},children:m.jsx(js,{options:w7,value:i,onChange:async f=>{c(f),d(f==null?void 0:f.value,t)}})})]}),m.jsx(Pg,{count:Math.ceil(a/i),page:o,onChange:async(f,p)=>{l(p)},siblingCount:0,shape:"rounded",sx:{width:"100%","& .MuiPagination-ul":{width:"100%",display:"flex",justifyContent:"flex-end","& li:first-of-type":{border:`0.1rem solid ${u.palette.primary.notifyBorderColor}`,color:u.palette.primary.notifyActiveText,marginRight:"1.5rem",borderRadius:"1rem",width:"3rem",height:"3rem",justifyContent:"center",alignItems:"center",display:"flex"},"& li:last-child":{border:`0.1rem solid ${u.palette.primary.notifyBorderColor}`,color:u.palette.primary.notifyActiveText,marginLeft:"1.5rem",borderRadius:"1rem",width:"3rem",height:"3rem",justifyContent:"center",alignItems:"center",display:"flex"}},"& .MuiPaginationItem-root":{color:"#595959",fontSize:"1.1rem",borderRadius:"1rem",width:"3rem",height:"3rem",justifyContent:"center",alignItems:"center",display:"flex","& .MuiSvgIcon-root":{fontSize:"2.2rem"}},"& .Mui-selected":{color:u.palette.primary.notifyActiveText,backgroundColor:`${u.palette.brandColor.paginationBc} !important`}}})]})};iw.propTypes={pagination:s.object.isRequired};const aw=({menuOpen:e,handleClose:t,onHideClick:n})=>{const r=It();return m.jsx(Pi,{open:!!e,anchorEl:e,onClose:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:m.jsx(we,{sx:{backgroundColor:r.palette.primary.notifyBackground,border:`0.1rem solid ${r.palette.primary.notifyBorderColor}`,minHeight:"2.3rem",display:"flex",justifyContent:"center",alignItems:"center"},children:m.jsx(qn,{onClick:n,disableRipple:!0,sx:{textTransform:"none",fontSize:"1.1rem",p:"0.4rem 1rem",minHeight:"unset",fontWeight:500,color:r.palette.primary.notifyTextColor,backgroundColor:"transparent","&:hover":{backgroundColor:"transparent"},"&:active":{backgroundColor:"transparent"},"&:focus":{backgroundColor:"transparent"}},children:"Hide Column"})})})};aw.propTypes={menuOpen:s.object,handleClose:s.func,onHideClick:s.func};const lw=({sortKey:e,sortField:t,sortDir:n,handleSortClick:r})=>{const o=i=>m.jsx(Nr,{onClick:r,sx:{padding:"0.2rem"},draggable:!1,children:m.jsx(mn,{url:i})});return m.jsx(m.Fragment,{children:o(t===e?n==="asc"?Qe.AscSort:Qe.DescSort:Qe.Unsort)})};lw.propTypes={sortKey:s.string.isRequired,sortField:s.string,sortDir:s.string,handleSortClick:s.func};function cw({parent:e,column:t,sort:n,handleMenuClick:r,isManageable:o}){const i=o&&(!(t!=null&&t.isMandatory)||(t==null?void 0:t.isMandatory)&&(t==null?void 0:t.showHide)===!0),a=t==null?void 0:t.label,l=t==null?void 0:t.isSortable,c=n==null?void 0:n.sortField,u=n==null?void 0:n.sortDir,d=n==null?void 0:n.onSort;return m.jsxs(we,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},draggable:!1,children:[m.jsx(we,{sx:{fontWeight:"bold",fontSize:"1.1rem",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"0.5rem",textAlign:"center"},children:m.jsx(xd,{title:a,placement:"top",componentsProps:{tooltip:{sx:{fontSize:"1rem",padding:"0.6rem 1rem",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"}}},children:a??""})}),m.jsxs(we,{sx:{display:"flex",alignItems:"center"},draggable:!1,children:[l&&m.jsx(lw,{sortKey:e?`${e==null?void 0:e.key}|${t==null?void 0:t.key}`:t==null?void 0:t.key,sortField:c,sortDir:u,handleSortClick:()=>d({column:t,sortDir:u,sortField:c,parent:e})}),i&&m.jsx(Nr,{draggable:!1,onClick:f=>r(f,t,e),sx:{padding:"0.2rem"},children:m.jsx(mn,{url:Qe.Menu})})]})]})}cw.propTypes={column:s.object.isRequired,sort:s.object.isRequired,handleMenuClick:s.func,isManageable:s.bool};function uw({rows:e,sort:t,data:n,pagination:r,columns:o,nested:i,baseUrl:a,gridPath:l,childUniqueKey:c,isVirtualizedTable:u=!1,t:d}){var $e;const f=It(),{visibleGridColumns:p}=M.useContext(Oc),h=M.useContext(xa),{selectedColumn:y,handleMenuClick:g,handleClose:b,handleHideClick:x,columnUpdaterFunction:C}=B7(p,h,a,l,r==null?void 0:r.rowPerPage,c),w=o==null?void 0:o.isManageable,k=o==null?void 0:o.isResizable,v=(n==null?void 0:n.length)>0,O=M.useRef(null),E=M.useRef(null),P=45,D=10,A=n==null?void 0:n.length,[N,R]=M.useState({start:0,end:10}),[j,_]=M.useState({start:0,end:20}),[F,$]=M.useState(null),[B,V]=M.useState(null),[Y,z]=M.useState(null);let H=null;const re=M.useRef(0),ae=M.useRef(!1),I=M.useRef(null),ee=M7((($e=i==null?void 0:i.column)==null?void 0:$e.definitions)||[]),X=i==null?void 0:i.isNested,Z=(i==null?void 0:i.data)||[],ne=i==null?void 0:i.hashKey,[q,J]=M.useState(0),[G,L]=M.useState(null);M.useRef(null);const[Q,de]=M.useState(!1),[ve,me]=M.useState(!1);M.useEffect(()=>{if(O.current){const U=()=>{J(O.current.offsetHeight)};return U(),window.addEventListener("resize",U),()=>window.removeEventListener("resize",U)}},[n]),M.useEffect(()=>{const U=O.current,fe=U==null?void 0:U.querySelector("thead");if(!fe)return;const ie=()=>{z(null)};return fe==null||fe.addEventListener("mousedown",ie),()=>{fe==null||fe.removeEventListener("mousedown",ie)}},[]);const Te=(U,fe)=>{var ye,Oe;if(ae.current){U.preventDefault();return}$(fe),z(null),U.dataTransfer.setData("colIndex",fe);const ie=p[fe],te=ie==null?void 0:ie.label,le=document.createElement("div");le.textContent=te,Object.assign(le.style,{display:"flex",alignItems:"center",justifyContent:"center",padding:"1.5rem 2.5rem",minWidth:(ye=ie==null?void 0:ie.style)==null?void 0:ye.minWidth,maxWidth:(Oe=ie==null?void 0:ie.style)==null?void 0:Oe.maxWidth,fontSize:"1.2rem",fontWeight:"500",color:f.palette.primary.notifyTextColor,background:f.palette.primary.notifyBackground,border:`0.1rem solid ${f.palette.primary.notifyBorderColor}`,borderRadius:"0rem",pointerEvents:"none",position:"absolute",top:"0",left:"0",zIndex:"-1",textAlign:"center",boxSizing:"border-box",boxShadow:"0 1px 4px rgba(0, 0, 0, 0.2)"}),document.body.appendChild(le);const{offsetWidth:he,offsetHeight:Se}=le;U.dataTransfer.setDragImage(le,he/2,Se/2),requestAnimationFrame(()=>{document.body.removeChild(le)})},ue=(U,fe)=>{U.preventDefault(),V(fe),He(U)},ke=async(U,fe)=>{if(U.preventDefault(),clearInterval(H),F===null||F===fe)return;const ie=[...p],[te]=ie.splice(F,1);ie.splice(fe,0,te);const le=p.slice().sort((Se,ye)=>Se.sequenceId-ye.sequenceId).map(Se=>Se.sequenceId),he=ie.map((Se,ye)=>({...Se,sequenceId:le[ye]??Se.sequenceId}));C({updatedColumns:he}),$(null),V(null)},xe=()=>{$(null),V(null)},Ce=(U,fe,ie,te)=>{var Ke,jt,wt,Ht,Ze;if(!U)return null;const le=(U==null?void 0:U.isMandatory)&&(U==null?void 0:U.isSticky),he=parseFloat((jt=(Ke=U==null?void 0:U.style)==null?void 0:Ke.minWidth)==null?void 0:jt.toString().replace("rem",""))||7.5;fe===0&&(re.current=0);const Se=le?fe===0?0:`${re.current}rem`:void 0;le&&(re.current+=he);const ye=F===fe,Oe=B==fe||((wt=p==null?void 0:p[B])==null?void 0:wt.isMandatory),De=Ye=>{U.isMandatory?(Ye.preventDefault(),Ye.dataTransfer.dropEffect="none"):(Ye.preventDefault(),Ye.dataTransfer.dropEffect="move"),ue==null||ue(Ye,fe)},qe=Ye=>{U.isMandatory||ke==null||ke(Ye,fe)};return te&&`${te==null?void 0:te.key}${U==null?void 0:U.key}${fe}`,m.jsx(Ea,{rowSpan:U!=null&&U.children?1:2,colSpan:(Ze=(Ht=U==null?void 0:U.children)==null?void 0:Ht.filter(Ye=>!(Ye!=null&&Ye.isHidden)))==null?void 0:Ze.length,style:U==null?void 0:U.style,draggable:ie&&!(U!=null&&U.isMandatory),onDragStart:ie&&!(U!=null&&U.isMandatory)?Ye=>Te(Ye,fe):Ye=>{Ye.preventDefault()},onDragOver:ie&&!(U!=null&&U.isMandatory)?De:void 0,onDrop:ie&&!(U!=null&&U.isMandatory)?qe:void 0,onDragEnd:ie&&!(U!=null&&U.isMandatory)?xe:void 0,sx:{...(U==null?void 0:U.isSticky)&&{boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...U.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...(U==null?void 0:U.key)==="volume_value"&&{borderLeft:"1px solid"}},...ye&&{border:`0.1rem solid ${f.palette.brandColor.lightBlue}!important`},...le&&{position:"sticky",left:Se,zIndex:3},cursor:Oe?"not-allowed":ie&&!(U!=null&&U.isMandatory)?"grab":"default"},children:m.jsx(cw,{parent:te,column:U,sort:t,handleMenuClick:g,isManageable:ie})},fe)},Be=M.useCallback((U,fe,ie,te)=>{var ye,Oe,De;if(!U)return null;const le=(U==null?void 0:U.isMandatory)&&(U==null?void 0:U.isSticky),he=parseFloat((Oe=(ye=U==null?void 0:U.style)==null?void 0:ye.minWidth)==null?void 0:Oe.toString().replace("rem",""))||7.5;ie===0&&(re.current=0);const Se=le?ie===0?0:`${re.current}rem`:void 0;return le&&(re.current+=he),m.jsxs(Ea,{colSpan:1,style:U==null?void 0:U.style,className:`${U==null?void 0:U.label}`,sx:{position:"relative",...U.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...(U==null?void 0:U.key)==="volume_value"&&{borderLeft:"1px solid"}},...(U==null?void 0:U.isSticky)&&{boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...le&&{position:"sticky",left:Se,zIndex:2,backgroundColor:qe=>{var Ke;return e!=null&&e.selectedRow&&((Ke=e==null?void 0:e.selectedRow)==null?void 0:Ke.fhi)===(fe==null?void 0:fe.fhi)||fe!=null&&fe.isHigh?qe.palette.primary.appBackground:qe.palette.primary.notifyBackground}}},children:[((e==null?void 0:e.selectedRow)&&((De=e==null?void 0:e.selectedRow)==null?void 0:De.fhi)===(fe==null?void 0:fe.fhi)||(fe==null?void 0:fe.isHigh))&&m.jsx(we,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none",zIndex:1}}),m.jsx(Vp,{isRenderCellContent:!!(U!=null&&U.cellRenderer),column:U,row:fe,parent:te})]},ie)},[e==null?void 0:e.selectedRow]),Fe=(U,fe,ie,te)=>m.jsx(m.Fragment,{children:U&&ie&&!(U!=null&&U.isMandatory)?m.jsx(we,{resizeStart:()=>{U!=null&&U.isMandatory&&!(U!=null&&U.isResizable)||(ae.current=!0)},resizeEnd:le=>{U!=null&&U.isMandatory&&!(U!=null&&U.isResizable)||le<=20||(ae.current=!1,U7({index:fe,visibleGridColumns:p,width:le,columnUpdaterFunction:C}))},component:U!=null&&U.children||U!=null&&U.isMandatory?Ll:Bp,rowSpan:U!=null&&U.children?1:2,colSpan:1,id:fe,sx:{width:"1rem",maxWidth:"1rem",minWidth:"1rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${f.palette.primary.notifyBorderColor}`,cursor:"col-resize","&::after":{content:'""',position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"0.15rem",height:"1.5rem",backgroundColor:f.palette.primary.notifyBorderColor,zIndex:1},...!(U!=null&&U.isMandatory)&&{"&:hover::after":{content:'""',position:"absolute",top:0,left:"50%",transform:"translateX(-50%)",width:"0.2rem",height:`${q}px`,backgroundColor:f.palette.primary.notifyBorderColor,zIndex:1}}}}):null}),Ie=M.useCallback((U,fe,ie,te,le,he,Se)=>{var ye;return m.jsx(m.Fragment,{children:fe&&te&&!(fe!=null&&fe.isMandatory)?m.jsx(Ll,{className:"column_resizer_body",sx:{width:"1rem",maxWidth:"1rem",minWidth:"1rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${f.palette.primary.notifyBorderColor}`},children:((e==null?void 0:e.selectedRow)&&((ye=e==null?void 0:e.selectedRow)==null?void 0:ye.fhi)===(U==null?void 0:U.fhi)||(U==null?void 0:U.isHigh))&&m.jsx(we,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none"}})},`resize-${ie}_${Se}`):null})},[e==null?void 0:e.selectedRow]),He=U=>{const fe=O.current,{left:ie,right:te}=fe.getBoundingClientRect(),le=50,he=U.clientX>te-le?1:U.clientX<ie+le?-1:0;he!==0?(I.current&&clearInterval(I.current),I.current=setInterval(()=>{fe.scrollLeft+=he*10},50)):I.current&&(clearInterval(I.current),I.current=null)},tt=U=>U==null?void 0:U.map((fe,ie)=>{var Oe;const te=N.start+ie,le=fe[ne],he=Z==null?void 0:Z[le],Se=(e==null?void 0:e.selectedRow)&&((Oe=e==null?void 0:e.selectedRow)==null?void 0:Oe.fhi)===(fe==null?void 0:fe.fhi),ye=fe==null?void 0:fe.isHigh;return m.jsxs(M.Fragment,{children:[m.jsx($7,{row:fe,isSelected:Se,isHigh:ye,onRowClick:e==null?void 0:e.onRowClick,children:p.map((De,qe)=>De!=null&&De.isHidden||(De==null?void 0:De.isVisible)===!1?null:De!=null&&De.children?De.children.map((Ke,jt)=>Ke!=null&&Ke.isHidden?null:m.jsxs(M.Fragment,{children:[Be(Ke,fe,jt,De),k&&Ie(fe,Ke,jt,w,De,"",te)]},`col-${qe}-${jt}`)):m.jsxs(M.Fragment,{children:[Be(De,fe,qe),k&&Ie(fe,De,qe,w,"","",te)]},`col-${qe}`))}),X&&he&&m.jsx(L7,{nestedData:he,nestedColumn:ee,t:d})]},`row-${te}`)}),ct=()=>{const U=E.current;if(!U)return;const fe=U.scrollTop,ie=U.clientHeight,te=Math.floor(fe/P)-D,le=Math.ceil(ie/P)+2*D,he=Math.max(0,Math.min(A-1,te)),Se=Math.max(he,Math.min(A,he+le));R(ye=>ye.start===he&&ye.end===Se?ye:{start:he,end:Se})};M.useEffect(()=>{let U;const fe=()=>{U&&cancelAnimationFrame(U),U=requestAnimationFrame(()=>{ct()})},ie=E.current;if(!(!ie||!u))return ct(),ie.addEventListener("scroll",fe),()=>{cancelAnimationFrame(U),ie.removeEventListener("scroll",fe)}},[A]);const Ve=N.start*P,ge=(A-N.end)*P,Me=u?n==null?void 0:n.slice(N.start,N.end):n;return v?m.jsxs(m.Fragment,{children:[m.jsx(zg,{ref:E,sx:{willChange:"transform",WebkitTransform:"translateZ(0)",maxHeight:"40rem",whiteSpace:"nowrap",overflow:"auto",width:"100%",border:`0.1rem solid ${f.palette.primary.notifyBorderColor}`,borderRadius:"1.4rem",position:"relative"},children:m.jsxs(Bg,{ref:O,stickyHeader:!0,"aria-label":"sticky table",sx:{backgroundColor:U=>U.palette.primary.notifyBackground},children:[m.jsxs(Hg,{children:[m.jsx(_s,{sx:{position:"sticky",top:0,zIndex:3,backgroundColor:U=>U.palette.primary.notifyBackground},children:p.map((U,fe)=>U!=null&&U.isHidden||(U==null?void 0:U.isVisible)===!1?null:m.jsxs(M.Fragment,{children:[Ce(U,fe,w),Fe(U,fe,w)]},fe))}),m.jsx(_s,{draggable:!1,sx:{position:"sticky",top:"2.5rem",backgroundColor:f.palette.primary.notifyBackground,zIndex:2},children:p.flatMap((U,fe)=>U!=null&&U.isHidden||!(U!=null&&U.children)||(U==null?void 0:U.isVisible)===!1?[]:U.children.map((ie,te)=>ie!=null&&ie.isHidden?null:m.jsxs(M.Fragment,{children:[Ce(ie,te,w,U),k&&Fe(ie,te,w)]},`${fe}-${te}`)))})]}),m.jsxs(Wg,{children:[u&&m.jsx("tr",{style:{height:Ve}}),tt(Me),u&&m.jsx("tr",{style:{height:ge}})]})]})}),r&&m.jsx(iw,{pagination:r,gridPath:l,baseUrl:a,t:d}),m.jsx(aw,{menuOpen:y==null?void 0:y.isOpen,handleClose:b,onHideClick:x})]}):m.jsx(Eo,{sx:{textAlign:"center"},children:d(Zr.NRF)})}uw.propTypes={sort:s.object,data:s.array,pagination:s.object,columns:s.object,nested:s.object};function dw({tableProps:e,isDefaultConfig:t,gridPath:n,baseUrl:r,childUniqueKey:o,t:i}){var u;const{columns:a}=e,l=M.useContext(xa),c=P7({columns:a,gridPath:n,baseUrl:r,isDefaultConfig:t,childUniqueKey:o,pageSize:(u=e==null?void 0:e.pagination)==null?void 0:u.rowPerPage,data:e==null?void 0:e.data});return M.useEffect(()=>{c!=null&&c.length&&(l==null||l({type:Ue.SET_GRID_DATA,payload:{visibleGridColumns:c}}))},[c]),m.jsx(uw,{...e,gridPath:n,baseUrl:r,childUniqueKey:o,t:i})}dw.propTypes={tableProps:s.object.isRequired,mergedColumns:s.array.isRequired};const fw=({type:e})=>{const t=It(),r=(t==null?void 0:t.mode)==="dark"?{bgcolor:"grey.800"}:{};return{grid:m.jsxs(we,{sx:{borderRadius:2,overflow:"hidden"},children:[m.jsx(kr,{variant:"text",width:"100%",height:60,sx:r}),Array.from({length:10}).map((i,a)=>m.jsx(we,{sx:{display:"flex",alignItems:"center",padding:"0.5rem",gap:"3rem"},children:Array.from({length:5}).map((l,c)=>m.jsx(we,{sx:{flex:1},children:m.jsx(kr,{variant:"text",height:45,sx:r})},c))},a))]}),toolbar:m.jsx(m.Fragment,{children:m.jsxs(lt,{direction:"row",justifyContent:"space-between",sx:{display:"flex",gap:"1rem"},children:[m.jsxs(lt,{direction:"row",gap:"1rem",children:[m.jsx(kr,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),m.jsx(kr,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),m.jsx(kr,{variant:"text",width:"15.2rem",height:"5rem",sx:r})]}),m.jsxs(lt,{direction:"row",gap:"1rem",children:[m.jsx(kr,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),m.jsx(kr,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),m.jsx(kr,{variant:"text",width:"3.5rem",height:"5rem",sx:r})]})]})})}[e]},H7=({customTools:e})=>{var r,o;const t=(r=e==null?void 0:e.filter(i=>(i==null?void 0:i.type)===ow.PRIMARY))==null?void 0:r.sort((i,a)=>i.sequenceId-a.sequenceId),n=(o=e==null?void 0:e.filter(i=>(i==null?void 0:i.type)===ow.SECONDARY))==null?void 0:o.sort((i,a)=>i.sequenceId-a.sequenceId);return{primaryButtons:t,secondaryButtons:n}},pw=({customTools:e,isExpanded:t,setIsExpanded:n})=>{const{primaryButtons:r,secondaryButtons:o}=H7({customTools:e}),[i,a]=M.useState(r),l=(o==null?void 0:o.length)>0,c=d=>{d?a([...r,...o]):setTimeout(()=>{a(r)},100)},u=()=>{const d=!t;n(d),c(d)};return M.useEffect(()=>{c(t)},[e]),m.jsxs(m.Fragment,{children:[t&&m.jsx("div",{style:{position:"fixed",left:0,width:"100vw",height:"4rem",zIndex:998}}),m.jsxs(we,{sx:{display:"flex",alignItems:"center",gap:"0.8rem",flexWrap:"nowrap",maxWidth:"100%",whiteSpace:"nowrap",zIndex:999},children:[m.jsx(uI,{mode:"popLayout",children:i.map((d,f)=>m.jsx(Qi.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},layout:!0,children:m.jsx(we,{sx:{flexShrink:0,minWidth:"fit-content"},children:V7(d)})},`${d.id}_${f}`))}),l&&m.jsx(we,{sx:{paddingLeft:t?"0.5rem":0},children:m.jsx(Er,{label:t?"":"More Actions",styles:{iconPrimary:!0,icon:t?Qe.CrossWhite:Qe.More,colorType:t?"danger":""},onClick:u})})]})]})};pw.propTypes={customTools:s.array.isRequired};const hw=({defaultTools:e,isManageable:t,customTools:n,baseUrl:r,gridPath:o,pageSize:i,gridData:a,childUniqueKey:l})=>{var C,w,k,v,O,E;const c=M.useContext(xa),{visibleGridColumns:u,triggerApi:d}=M.useContext(Oc),[f,p]=M.useState([]),[h,y]=M.useState(!1);M.useEffect(()=>{if(u.length){const P={id:99999,sequenceId:99999,isLocalizable:!1,key:"horizons",label:"Horizons",isSortable:!1,isHidden:!0,showChildCheckbox:!0,showCheckbox:!1,isMandatory:!0,showInHierarchy:!0,showHide:!0,children:[]};let D=u.map(N=>(N!=null&&N.children&&N.children.forEach(R=>{P.children.some(_=>_.key===R.key)||P.children.push({...R,showInHierarchy:!0})}),N)).filter(N=>(N==null?void 0:N.id)!==(P==null?void 0:P.id));const A=P.children.length>0?[...D,P]:D;p(A)}},[u]);const g=async P=>{try{await z7({baseUrl:r,gridPath:o,childUniqueKey:l,gridSetting:{grid:P,pageSize:i}})}catch(D){console.error(D)}finally{c({type:Ue.HAS_SETTING_CHANGE,payload:{hasChange:!1}}),c({type:Ue.TRIGGER_API,payload:{triggerApi:!1}})}};M.useEffect(()=>{d&&g(u)},[d]);const b=P=>{var R;const D=P==null?void 0:P.map(j=>j.id),A=(R=P==null?void 0:P.flatMap(j=>j.children||[]))==null?void 0:R.map(j=>j.id),N=f==null?void 0:f.map(j=>{var $,B,V;const _=D==null?void 0:D.includes(j.id);if(Array.isArray(j.children)&&j.children.length>0){const Y=($=j==null?void 0:j.children)==null?void 0:$.map(H=>{var ae;const re=(ae=A==null?void 0:A.includes)==null?void 0:ae.call(A,H.id);return{...H,isHidden:!re}}),z=(B=Y==null?void 0:Y.filter(H=>f==null?void 0:f.some(re=>{var ae;return(ae=re.children)==null?void 0:ae.some(I=>I.id===H.id)})))==null?void 0:B.every(H=>H.isHidden);return{...j,...!((V=j.children[0])!=null&&V.showInHierarchy)&&{isHidden:z||!_},children:Y}}return{...j,isHidden:!_}});c({type:Ue.SET_GRID_DATA,payload:{visibleGridColumns:N}}),c({type:Ue.HAS_SETTING_CHANGE,payload:{hasChange:!0}})},x=()=>f.map(D=>{const A=Array.isArray(D.children)?D.children.filter(N=>!N.isHidden):void 0;return!D.isHidden||D.isHidden&&D.showInHierarchy?{...D,children:A}:null}).filter(Boolean);return m.jsxs(we,{sx:{margin:"1rem 0",position:"relative",zIndex:10,display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"0.6rem",width:"100%"},children:[m.jsxs(we,{sx:{display:"flex",flexDirection:"row",gap:"0.6rem"},children:[((C=e==null?void 0:e.search)==null?void 0:C.isRequired)&&m.jsx(p1,{...e==null?void 0:e.search,iconUrl:Qe.Search}),((w=e==null?void 0:e.refresh)==null?void 0:w.isRequired)&&m.jsx(Er,{...e==null?void 0:e.refresh,styles:{variant:"filled",icon:Qe.Refresh,colorType:"empty",width:"3.2rem",height:"3.2rem"}}),((k=e==null?void 0:e.groupBy)==null?void 0:k.isRequired)&&m.jsx(we,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:m.jsx(js,{styles:{icon:Qe.Group},...e.groupBy})}),t&&m.jsx(we,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:m.jsx(js,{placeholder:"Manage Columns",options:f,value:x(),isMulti:!0,isDraggable:!0,showSearch:!0,isManageColumn:!0,onChange:b,disabled:!a.length,styles:{icon:Qe.Manage}})})]}),m.jsxs(we,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",gap:"0.6rem"},children:[n&&m.jsx(pw,{customTools:n,setIsExpanded:y,isExpanded:h}),((v=e==null?void 0:e.save)==null?void 0:v.isRequired)&&m.jsx(we,{sx:{px:"0.5rem"},children:m.jsx(Er,{label:h?"":"Save",styles:{icon:Qe.Save,colorType:"empty"},...e==null?void 0:e.save})}),((O=e==null?void 0:e.upload)==null?void 0:O.isRequired)&&m.jsx(Er,{...e==null?void 0:e.upload,styles:{variant:h?"outlined":"filled",icon:h?Qe.UploadDark:Qe.Upload,iconPrimary:!h,colorType:"secondary",isAnimate:!0}}),((E=e==null?void 0:e.download)==null?void 0:E.isRequired)&&m.jsx(Er,{...e==null?void 0:e.download,styles:{variant:"outlined",icon:Qe.Download,isAnimate:!0}})]})]})};hw.propTypes={defaultTools:s.object.isRequired,customTools:s.array,isManageable:s.bool,baseUrl:s.string,gridPath:s.gridPath};function zp({tableProps:e,toolbarProps:t,isDefaultConfig:n,isLoading:r,t:o}){var a,l;const i=(a=e.columns)==null?void 0:a.isManageable;return m.jsx(c1,{children:r?m.jsxs(m.Fragment,{children:[t&&m.jsx(fw,{type:"toolbar"}),e&&m.jsx(fw,{type:"grid"})]}):m.jsxs(we,{sx:{position:"sticky"},children:[t&&m.jsx(hw,{...t,isManageable:i,pageSize:(l=e==null?void 0:e.pagination)==null?void 0:l.rowPerPage,gridData:e==null?void 0:e.data,t:o}),m.jsx(dw,{tableProps:e,isDefaultConfig:n,gridPath:(t==null?void 0:t.gridPath)||"",baseUrl:(t==null?void 0:t.baseUrl)||"",childUniqueKey:(t==null?void 0:t.childUniqueKey)||"",t:o})]})})}zp.propTypes={tableProps:s.object.isRequired,toolbarProps:s.object,isDefaultConfig:s.bool};const mw=({list:e,handleLinkClick:t})=>{const n=It(),r=({list:o})=>{var i;return(i=o==null?void 0:o.sort((a,l)=>a.order-l.order))==null?void 0:i.map((a,l)=>a!=null&&a.link?m.jsx(Vr,{component:"h3",sx:{fontSize:"1rem",cursor:"pointer",color:l===(o==null?void 0:o.length)-1?n.palette.brandColor.orange:n.palette.primary.notifyTextColor},href:a==null?void 0:a.link,underline:"hover",onClick:()=>t(a),children:a==null?void 0:a.title},l):m.jsx(rt,{component:"h3",sx:{fontSize:"1rem",color:l===(o==null?void 0:o.length)-1?n.palette.brandColor.orange:n.palette.primary.notifyTextColor},children:a==null?void 0:a.title},l))};return m.jsx(U0,{separator:m.jsx(mn,{url:Qe.ArrowRight}),children:r({list:e})})};mw.propTypes={list:s.array.isRequired,handleLinkClick:s.func};const gw=({breadcrumbProps:e,switchProps:t,filterComponentProps:n,metaDataProps:r})=>{var a,l,c,u,d,f,p,h;const o=It(),i=(a=n==null?void 0:n.filterBtnProps)==null?void 0:a.disabled;return m.jsxs(m.Fragment,{children:[m.jsxs(lt,{sx:{background:o.palette.primary.notifyBackground,borderBottom:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,height:"3rem",p:"0px 1.5rem 0 1.5rem",zIndex:4,position:"relative"},direction:"row",justifyContent:"space-between",alignItems:"center",children:[m.jsx(mw,{...e}),m.jsxs(lt,{direction:"row",gap:"1rem",alignItems:"center",children:[r,t&&m.jsx(b1,{...t}),(n==null?void 0:n.filterBtnProps)&&m.jsxs(lt,{direction:"row",children:[m.jsx(Ci,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"2rem!important",opacity:"1!important",borderColor:o.palette.primary.notifyBorderColor}}),m.jsxs(lt,{direction:"row",alignItems:"center",gap:"0.5rem",onClick:(l=n==null?void 0:n.filterBtnProps)==null?void 0:l.onFilterClick,sx:{opacity:i?.5:1,cursor:i?"not-allowed":"pointer"},children:[m.jsx(mn,{url:Qe.Filter}),m.jsx(rt,{sx:{fontSize:"1.1rem",color:o.palette.primary.notifyActiveText},children:(c=n==null?void 0:n.filterBtnProps)==null?void 0:c.label})]})]})]})]}),m.jsx(Qi.div,{layout:!0,initial:{height:"0rem"},animate:{height:(u=n==null?void 0:n.filterBtnProps)!=null&&u.filterContainerVisible?"5rem":"0rem",opacity:(d=n==null?void 0:n.filterBtnProps)!=null&&d.filterContainerVisible?1:0},transition:{duration:.5,ease:"easeInOut"},style:{background:o.palette.primary.notifyBackground,borderBottom:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,padding:"0px 5.5rem 0 1.5rem",position:"relative",alignItems:"center",display:"flex",overflow:"hidden",width:(f=n==null?void 0:n.filterContainerProps)!=null&&f.isSideDrawerOpen?"75%":"100%"},children:m.jsxs(lt,{sx:{background:o.palette.primary.appBackground,height:"3.8rem",p:"0 2rem",width:"100%",borderRadius:"0.7rem",overflow:"visible"},direction:"row",alignItems:"center",children:[m.jsx(rt,{sx:{fontSize:"1.2rem",fontWeight:"500",color:o.palette.primary.notifyActiveText},children:"Filters:"}),m.jsx(we,{sx:{overflowX:"auto",overflowY:"visible",whiteSpace:"nowrap",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},margin:"0 1rem",padding:"0.5rem 0",flexGrow:1},children:m.jsx(lt,{direction:"row",gap:"1.2rem",sx:{overflow:"visible"},children:(p=n==null?void 0:n.filterItems)==null?void 0:p.map((y,g)=>m.jsx(m.Fragment,{children:m.jsxs(we,{sx:{position:"relative",overflow:"visible",border:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,background:o.palette.primary.notifyBackground,borderRadius:"0.6rem",padding:"0.3rem 1.1rem",display:"inline-block"},children:[m.jsx(we,{component:"img",src:Qe.FilterClose,sx:{position:"absolute",top:"-0.4rem",right:"-0.6rem",cursor:"pointer"},onClick:()=>n==null?void 0:n.onFilterChipClose(y)}),m.jsx(rt,{sx:{fontSize:"1rem",color:o.palette.primary.notifyTextColor},children:y==null?void 0:y.filterLabel})]},g)}))})}),m.jsx(we,{component:rt,sx:{fontSize:"1.1rem",fontWeight:"500",textDecoration:"underline",color:o.palette.brandColor.red,cursor:"pointer"},onClick:(h=n==null?void 0:n.filterContainerProps)==null?void 0:h.onClearClick,children:"Clear"})]})})]})};gw.propTypes={breadcrumbProps:s.object.isRequired,switchProps:s.object};function yw({headerProps:e}){return m.jsx(Ln,{children:m.jsx(gw,{...e})})}yw.propTypes={headerProps:s.object.isRequired};const Up=M.createContext(null),bw=M.createContext(null);function q7({children:e}){const[t,n]=M.useReducer(Y7,G7);return m.jsx(Up.Provider,{value:t,children:m.jsx(bw.Provider,{value:n,children:e})})}function Y7(e,t){var n;switch(t.type){case Ue.LOADING:return{...e,loading:t.loading};case Ue.SUCCESS:return{...e,data:(n=t.data)==null?void 0:n.sort((r,o)=>new Date(o.createdAt)-new Date(r.createdAt))};case Ue.MARK_ALL_AS_READ:return{...e,isMarkAllAsRead:t.isMarkAllAsRead};case Ue.SET_ACTIVE_TAB:return{...e,activeTab:t.activeTab};case Ue.SET_MODE:return{...e,mode:t.mode};case Ue.ERROR:return{...e,error:t.error};default:throw new Error(`${Zr.UNHANDLED}: ${t}`)}}const G7={loading:!1,data:[],error:"",isMarkAllAsRead:{count:0,boo:!1},mode:!1,activeTab:0},{TENANT_ID:Hp,BU_ID:qp}=rw,{TENANT_IDS:Yp,BU_IDS:Gp}=sw,K7=async e=>{try{const t=localStorage.getItem("i18nextLng"),n=`${e}${$c.NOTIFICATION}/v1?${Hp}=${Yp}&${qp}=${Gp}&lang=${t}`;return await Tt.get(n,ka)}catch(t){return t}},vw=async(e,t,n)=>{try{const r=localStorage.getItem("i18nextLng"),o=`${e}${$c.NOTIFICATION}${jp.VERSION}?${Hp}=${Yp}&${qp}=${Gp}&lang=${r}`;return await Tt.put(o,t,ka)}catch(r){return r}},X7=async({baseUrl:e,id:t,snopId:n})=>{try{const r=localStorage.getItem("i18nextLng"),o=`${e}${$c.NOTIFICATION}${jp.VERSION}?${Hp}=${Yp}&${qp}=${Gp}&id=${t}&lang=${r}`;return await Tt.get(o,ka)}catch(r){return r}},$s={OK:200,CREATED:201,NO_CONTENT:204,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,INTERNAL_SERVER_ERROR:500},xw=({baseUrl:e})=>{const t=M.useContext(bw),[n,r]=M.useState(!1),[o,i]=M.useState(!1),[a,l]=M.useState(!1),[c,u]=M.useState({}),[d,f]=M.useState(null),[p,h]=M.useState(1),y=M.useRef(!1),{loading:g,data:b,isMarkAllAsRead:x,mode:C,activeTab:w}=M.useContext(Up),[k,v]=M.useState([]);M.useEffect(()=>{v(b)},[b]);const O=M.useCallback(async()=>{var j,_,F;if(!(y.current||!e))try{t({type:Ue.LOADING,loading:!0}),t({type:Ue.SUCCESS,data:[]});const $=await K7(e);if($.status===$s.UNAUTHORIZED){y.current=!0;return}if($.status===$s.OK){const B=((_=(j=$.data)==null?void 0:j.responseData)==null?void 0:_.response)||[],V=kc(B);t({type:Ue.SET_MODE,mode:!1}),t({type:Ue.SUCCESS,data:kc(V)}),t({type:Ue.MARK_ALL_AS_READ,isMarkAllAsRead:{count:l1(B),boo:l1(B)>0}})}}catch($){((F=$==null?void 0:$.response)==null?void 0:F.status)===$s.UNAUTHORIZED&&(y.current=!0),t({type:Ue.ERROR,error:Zr.SWR})}finally{t({type:Ue.LOADING,loading:!1})}},[e,t]),E=j=>{const _=(b||[]).filter(F=>C?!F.isRead:!0);return{0:_,1:_.filter(F=>(F==null?void 0:F.type)==="INFO"),2:_.filter(F=>(F==null?void 0:F.type)==="ERROR")}};M.useEffect(()=>{O();const j=setInterval(O,3e5);return()=>clearInterval(j)},[O]);const P=async(j,_)=>{var F,$;if(!(!j||!e)){f(j);try{const B=await X7({baseUrl:e,id:j,snopId:_});if(B.status===$s.OK){const V=(($=(F=B.data)==null?void 0:F.responseData)==null?void 0:$.response)||{};u(V||{}),l(!0)}else throw new Error}catch{t({type:Ue.ERROR,error:Zr.SWR})}finally{f(null)}}},D=async(j,_)=>{if(!(!j.length||!e)){t({type:Ue.LOADING,loading:!0});try{if((await vw(e,j,_)).status===$s.OK){const $=b.map(V=>j.includes(V.id)?{...V,isRead:!0}:V),B=$.filter(V=>!V.isRead).length;B===0&&t({type:Ue.SET_MODE,mode:!1}),t({type:Ue.SUCCESS,data:kc($)}),t({type:Ue.MARK_ALL_AS_READ,isMarkAllAsRead:{count:B,boo:B>0}}),setTimeout(()=>{t({type:Ue.LOADING,loading:!1})},200)}}catch{t({type:Ue.ERROR,error:Zr.SWR}),t({type:Ue.LOADING,loading:!1})}}},A=async()=>{if(e){t({type:Ue.LOADING,loading:!0});try{const j=y8(b);if((await vw(e,j,x7.MARK_ALL_READ)).status===$s.OK){const F=b.map($=>({...$,isRead:!0}));t({type:Ue.SET_MODE,mode:!1}),t({type:Ue.SUCCESS,data:kc(F)}),t({type:Ue.MARK_ALL_AS_READ,isMarkAllAsRead:{count:0,boo:!1}}),setTimeout(()=>{t({type:Ue.LOADING,loading:!1})},200)}}catch{t({type:Ue.ERROR,error:Zr.SWR}),t({type:Ue.LOADING,loading:!1})}}},N=(j,_)=>{t({type:Ue.LOADING,loading:!0}),t({type:Ue.SET_ACTIVE_TAB,activeTab:_}),setTimeout(()=>{t({type:Ue.LOADING,loading:!1})},400)},R=()=>{t({type:Ue.LOADING,loading:!0});const j=C?b||[]:(k||[]).filter(_=>!_.isRead);t({type:Ue.SET_MODE,mode:!C}),v(j),h(1),setTimeout(()=>{t({type:Ue.LOADING,loading:!1})},400)};return{fetchNotification:O,showDetailsProps:{open:a,handleClose:()=>l(!1),setOpen:l,data:c,clickId:d},alertDialogProps:{open:n,handleClose:()=>r(!1),onRefresh:O,handleRead:D,handleMarkAllAsRead:A,setOpen:r,handleShowDetails:P,clickId:d,isMainDialog:!0},activeTab:w,loading:g,tabData:E()[w],data:k,mode:C,handleTabChange:N,toggleAlertMode:R,page:p,setPage:h,isMarkAllAsRead:x}};var ww,Cw,Sw;function Kp(){return Kp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Kp.apply(null,arguments)}var Z7=function(t){return S.createElement("svg",Kp({xmlns:"http://www.w3.org/2000/svg",width:16,height:17,fill:"none"},t),ww||(ww=S.createElement("path",{stroke:"#909090",strokeLinecap:"round",strokeMiterlimit:10,d:"M8.013 2.19c-2.206 0-4 1.793-4 4v1.927c0 .406-.173 1.026-.38 1.373l-.766 1.273c-.474.787-.147 1.66.72 1.954 2.873.96 5.973.96 8.846 0a1.335 1.335 0 0 0 .72-1.954l-.766-1.273c-.2-.347-.374-.967-.374-1.373V6.19c0-2.2-1.8-4-4-4Z"})),Cw||(Cw=S.createElement("path",{stroke:"#909090",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10,d:"M9.247 2.383a4.503 4.503 0 0 0-2.467 0 1.324 1.324 0 0 1 2.467 0"})),Sw||(Sw=S.createElement("path",{stroke:"#909090",strokeMiterlimit:10,d:"M10.013 12.957c0 1.1-.9 2-2 2a2.007 2.007 0 0 1-2-2"})))};const J7=({count:e})=>(It(),m.jsxs(m.Fragment,{children:[m.jsx(we,{sx:{gap:"0.5rem",display:"flex",justifyContent:"center",alignItems:"center","& svg":{transform:"scale(1)"}},children:m.jsx(Z7,{style:{scale:2}})}),m.jsx(j7,{badgeContent:e!=0?"":null,color:"error"})]}));function Tw({children:e,handleClose:t,open:n,isMainDialog:r}){return m.jsx(Ml,{open:n,onClose:t,scroll:r?"paper":void 0,fullWidth:!r,maxWidth:r?void 0:"md",PaperProps:{sx:r?{position:"fixed",top:30,right:30,m:0,width:400,height:450,display:"flex",flexDirection:"column",borderRadius:2,boxShadow:6,backgroundColor:o=>o.palette.primary.notifyBackground}:{minHeight:250,maxHeight:500,borderRadius:"1.5rem",boxShadow:6,backgroundColor:o=>o.palette.primary.appBackground}},children:e})}var kw;function Xp(){return Xp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Xp.apply(null,arguments)}var Q7=function(t){return S.createElement("svg",Xp({xmlns:"http://www.w3.org/2000/svg",width:14,height:9,fill:"none",viewBox:"0 0 13 9"},t),kw||(kw=S.createElement("path",{fill:"#A8A8A8",fillRule:"evenodd",d:"M8.954 1.004a.406.406 0 0 1 0 .575L3.537 6.996a.406.406 0 0 1-.574 0L.796 4.829a.406.406 0 1 1 .575-.575l1.879 1.88 5.13-5.13a.406.406 0 0 1 .574 0m3.25 0a.406.406 0 0 1 0 .575L6.787 6.996a.406.406 0 1 1-.574-.575l5.416-5.417a.406.406 0 0 1 .575 0",clipRule:"evenodd"})))},Ow,Ew;function Zp(){return Zp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zp.apply(null,arguments)}var eW=function(t){return S.createElement("svg",Zp({xmlns:"http://www.w3.org/2000/svg",width:12,height:12,fill:"none"},t),Ow||(Ow=S.createElement("path",{stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"round",d:"M7.79 6c0 .99-.8 1.79-1.79 1.79S4.21 6.99 4.21 6 5.01 4.21 6 4.21s1.79.8 1.79 1.79"})),Ew||(Ew=S.createElement("path",{stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"round",d:"M6 10.135c1.765 0 3.41-1.04 4.555-2.84.45-.705.45-1.89 0-2.595C9.41 2.9 7.765 1.86 6 1.86S2.59 2.9 1.445 4.7c-.45.705-.45 1.89 0 2.595 1.145 1.8 2.79 2.84 4.555 2.84"})))},Pw;function Jp(){return Jp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Jp.apply(null,arguments)}var tW=function(t){return S.createElement("svg",Jp({xmlns:"http://www.w3.org/2000/svg",width:9,height:8,fill:"none"},t),Pw||(Pw=S.createElement("path",{fill:"#fff",fillRule:"evenodd",d:"M8.277 1.004a.406.406 0 0 1 0 .575L2.86 6.996a.406.406 0 0 1-.574 0L.119 4.829a.406.406 0 1 1 .575-.575l1.879 1.88 5.13-5.13a.406.406 0 0 1 .574 0",clipRule:"evenodd"})))};const Mw=({type:e,item:t,handleShowDetails:n,handleRead:r,handleCTAClicked:o,clickId:i,t:a})=>{var u,d;const l=It(),c=(d=(u=JSON.parse(localStorage.getItem("settings")))==null?void 0:u.platform)==null?void 0:d.theme;return m.jsxs(we,{className:"cards",sx:{pt:" 0.8rem"},children:[m.jsx(lt,{display:"flex",flexDirection:"row",alignItems:"start",justifyContent:"space-between",gap:1,children:m.jsx(od,{sx:{width:"calc(100% - 2%)","& .MuiBadge-badge":{backgroundColor:"#6041EA",height:"0.5rem",minWidth:"0.5rem"}},variant:"dot",invisible:t==null?void 0:t.isRead,children:m.jsx(Eo,{sx:{color:l.palette.primary.notifyActiveText,whiteSpace:"normal",wordBreak:"break-word"},component:"p",className:["title-card",(t==null?void 0:t.isRead)&&"read"].join(" "),children:a(t==null?void 0:t.message)})})}),m.jsx(lt,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:m.jsxs(lt,{display:"flex",flexDirection:"row",justifyContent:"start",gap:1,sx:{p:"0.5rem 0"},children:[(t==null?void 0:t.isNotificationDetails)&&m.jsx(Vc,{icon:m.jsx(eW,{className:`${c==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:n,label:i===(t==null?void 0:t.id)?m.jsx(Pl,{color:"primary",size:13}):a("SHOW_DETAILS"),component:"button",variant:"filled",clickable:!0,size:"small",sx:{backgroundColor:l.palette.brandColor.orange,color:l.palette.brandColor.white}}),!(t!=null&&t.isRead)&&m.jsx(Vc,{icon:m.jsx(tW,{className:`${c==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:r,label:a("ACKNOWLEDGE"),component:"button",variant:"outlined",clickable:!0,size:"small"}),(t==null?void 0:t.primaryCTAURL)&&m.jsx(Vc,{disabled:t==null?void 0:t.isPrimaryCTAClicked,onClick:()=>o({redirect:t==null?void 0:t.isPrimaryCTARedirect,isClicked:t==null?void 0:t.isPrimaryCTAClicked,url:t==null?void 0:t.primaryCTAURL}),label:a(t==null?void 0:t.primaryCTALabel),component:"button",variant:"outlined",clickable:!0,size:"small"}),(t==null?void 0:t.secondaryCTAURL)&&m.jsx(Vc,{disabled:t==null?void 0:t.isSecondaryCTAClicked,onClick:()=>o({redirect:t==null?void 0:t.isSecondaryCTARedirect,isClicked:t==null?void 0:t.isSecondaryCTAClicked,url:t==null?void 0:t.secondaryCTAURL}),label:a(t==null?void 0:t.secondaryCTALabel),component:"button",variant:"outlined",clickable:!0,size:"small"})]})}),m.jsxs(lt,{display:"flex",flexDirection:"row",alignItems:"center",gap:.35,children:[m.jsx(Eo,{sx:{fontSize:"0.8rem"},children:a(t==null?void 0:t.product)}),m.jsx(Eo,{color:l.palette.primary.notifyTextColor,children:"•"}),m.jsx(Eo,{sx:{fontSize:"0.8rem"},children:g8(t==null?void 0:t.createdAt)})]})]})};Mw.propTypes={type:s.string,title:s.string,subTitle:s.string,isRead:s.bool,handleShowDetails:s.func,handleRead:s.func};const Dw=({data:e,handleRead:t,handleShowDetails:n,clickId:r,mode:o,page:i,setPage:a,t:l})=>{const{isMarkAllAsRead:c}=M.useContext(Up),u=new Date,d=new Intl.DateTimeFormat("en-US",{day:"numeric",month:"long",year:"numeric"}).format(u),[f,p]=M.useState([]),[h,y]=M.useState(!1),[g,b]=M.useState(!0),x=M.useRef(null),C=async k=>{y(!0);const v=e.slice((k-1)*10,k*10);await new Promise(O=>setTimeout(O,1e3)),p(O=>{const E=v.filter(P=>!O.some(D=>D.id===P.id));return[...O,...E]}),y(!1),(f==null?void 0:f.length)>=(e==null?void 0:e.length)&&b(!1)};M.useEffect(()=>{var v;let k=[];o?c!=null&&c.count?k=(v=e==null?void 0:e.filter(O=>!O.isRead))==null?void 0:v.slice(0,10):k=[]:k=e.slice(0,10),(k==null?void 0:k.length)<10&&b(!1),p(k)},[e,o,c]),M.useEffect(()=>{g&&i!==1&&C(i)},[i,e]),M.useEffect(()=>{p([...e])},[e]),M.useEffect(()=>{const k=new IntersectionObserver(v=>{v[0].isIntersecting&&!h&&g&&a(O=>O+1)},{threshold:1});return x.current&&k.observe(x.current),()=>{x.current&&k.unobserve(x.current)}},[h,g]);const w=({redirect:k,isClicked:v,url:O})=>{window.open(O,"_blank")};return m.jsxs(we,{sx:{width:"100%"},children:[Object.entries(x8(f)).map(([k,v])=>{const O=localStorage.getItem("i18nextLng"),E=new Date(k),P=new Intl.DateTimeFormat(O,{month:"long"}).format(E),D=E.getDate(),A=E.getFullYear(),N=`${P} ${D}, ${A}`;return m.jsxs(M.Fragment,{children:[k!==d&&m.jsx(A7,{children:N}),v.map((R,j)=>m.jsx(M.Fragment,{children:m.jsx(Mw,{item:R,handleCTAClicked:w,handleShowDetails:()=>n(R.id,R.snopId),handleRead:()=>t([R.id],R.snopId),clickId:r,t:l})},`${j}_${R.id}`))]},k)}),h&&i>1&&!!(f!=null&&f.length)&&m.jsx(we,{sx:{display:"flex",justifyContent:"center",alignItems:"center",pl:"0.5rem",py:"0.3rem"},children:m.jsx(Pl,{size:20,sx:{color:k=>k.palette.primary.notifyIconColor}})}),!(f!=null&&f.length)&&m.jsx(rt,{sx:{fontSize:"1.1rem",color:k=>k.palette.primary.notifyTextColor,textAlign:"center",px:"0.8rem"},children:l("CONTAINER_MESSAGE")}),m.jsx(we,{ref:x,style:{height:"0.1rem",backgroundColor:"transparent"}})]})};Dw.propTypes={data:s.array,handleRead:s.func,handleShowDetails:s.func};const nW=({onRefresh:e,handleShowDetails:t,clickId:n,handleRead:r,handleMarkAllAsRead:o,t:i})=>{var g,b,x,C;const{loading:a,activeTab:l,data:c,tabData:u,mode:d,page:f,setPage:p,handleTabChange:h,toggleAlertMode:y}=xw({});return m.jsxs(m.Fragment,{children:[m.jsxs(we,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,pt:2},children:[m.jsx(rt,{variant:"h2",sx:{fontSize:"1.2rem",color:w=>w.palette.primary.notifyTextColor},children:i("NOTIFICATION")}),m.jsx(we,{onClick:e,children:m.jsx(mn,{url:Qe.Refresh,alt:"refresh",sx:{cursor:"pointer"}})})]}),m.jsx(we,{sx:{borderBottom:1,m:"1.2rem 1.2rem 0 1.2rem",borderColor:w=>w.palette.primary.notifyBorderColor},children:m.jsxs(N7,{value:l,onChange:h,children:[m.jsx(Wp,{label:m.jsx(we,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:m.jsx(rt,{component:"span",sx:{fontWeight:500,fontSize:"1rem"},children:i("ALL",{count:((g=c==null?void 0:c.filter(w=>!(w!=null&&w.isRead)))==null?void 0:g.length)||0})})})}),m.jsx(Wp,{label:m.jsx(we,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:m.jsx(rt,{component:"span",sx:{fontWeight:500,fontSize:"1rem"},children:i("INFO",{count:((b=c==null?void 0:c.filter(w=>(w==null?void 0:w.type)==="INFO"&&!(w!=null&&w.isRead)))==null?void 0:b.length)||0})})}),sx:{color:w=>w.palette.brandColor.blue}}),m.jsx(Wp,{label:m.jsx(we,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:i("ERROR",{count:((x=c==null?void 0:c.filter(w=>(w==null?void 0:w.type)==="ERROR"&&!(w!=null&&w.isRead)))==null?void 0:x.length)||0})}),sx:{color:w=>w.palette.brandColor.red}})]})}),m.jsx(Rl,{dividers:!0,sx:{p:0,...a&&!u.length&&{alignItems:"center",justifyContent:"center"},flexGrow:1,overflowY:"auto",mx:"1.2rem",borderColor:w=>w.palette.primary.notifyBorderColor},tabIndex:-1,children:a?m.jsx(Pl,{size:30,sx:{color:w=>w.palette.primary.notifyIconColor}}):m.jsx(m.Fragment,{children:m.jsx(Dw,{data:u,handleShowDetails:t,handleRead:r,clickId:n,page:f,setPage:p,mode:d,t:i})})}),m.jsxs(Dl,{sx:{justifyContent:"space-between",px:"1.2rem"},children:[m.jsxs(lt,{direction:"row",gap:1,children:[m.jsx(Eo,{sx:{fontSize:"1rem"},children:i("SHOW_UNREAD")}),m.jsx(I7,{disabled:a,checked:d,onChange:y})]}),m.jsx(qn,{variant:"outlined",className:"view-all",onClick:o,startIcon:m.jsx(Q7,{}),disabled:!((C=c==null?void 0:c.filter(w=>!(w!=null&&w.isRead)))!=null&&C.length),style:{backgroundColor:"transparent"},sx:{fontSize:"1rem",fontWeight:"300",p:0,border:"none",textTransform:"none",color:w=>w.palette.primary.notifyTextColor,"&:hover":{color:w=>w.palette.primary.notifyActiveText,background:"transparent",boxShadow:"none",border:"none"},"&.Mui-disabled":{opacity:.5,color:w=>`${w.palette.primary.notifyActiveText}!important`,background:"transparent",boxShadow:"none",border:"none"}},children:i("READ_ALL")})]})]})},rW=({data:e,handleClose:t,t:n})=>{var x;const[r,o]=M.useState(1),[i,a]=M.useState(10),[l,c]=M.useState(((x=e==null?void 0:e.notificationDetails)==null?void 0:x.length)||0),[u,d]=M.useState("sku_name"),[f,p]=M.useState("asc"),[h,y]=M.useState([]),[g,b]=M.useState("");return M.useEffect(()=>{var C,w;if((g||u)&&((C=e==null?void 0:e.notificationDetails)!=null&&C.length)){const k=b8(e==null?void 0:e.notificationDetails,b7,g);if(u){const v=v8(k,u,f);y(gp(v,r,i)),c((v==null?void 0:v.length)||0);return}y(gp(k,r,i)),c((k==null?void 0:k.length)||0);return}y(gp(e==null?void 0:e.notificationDetails,r,i)),c((w=e==null?void 0:e.notificationDetails)==null?void 0:w.length)},[g,e,r,i,f,u]),m.jsxs(m.Fragment,{children:[m.jsxs(lt,{direction:"row",justifyContent:"space-between",sx:{padding:"1.5rem 2rem",borderBottom:"0.1rem solid",borderColor:C=>C.palette.primary.notifyBorderColor},children:[m.jsx(rt,{component:"h2",sx:{fontSize:"1.4rem",color:C=>C.palette.primary.notifyActiveText},children:n(e==null?void 0:e.message)||(e==null?void 0:e.message)}),m.jsx(we,{onClick:t,sx:{cursor:"pointer"},children:m.jsx(mn,{url:Qe.CloseCircle})})]}),m.jsx(Rl,{children:m.jsx(zp,{t:n,tableProps:{data:h,columns:{...R7({t:n}),isManageable:!1},sort:{sortField:u,sortDir:f,onSort:C=>{var k;const w=(k=C==null?void 0:C.column)==null?void 0:k.key;p(v=>u===w&&v==="asc"?"desc":"asc"),d(w)}},pagination:{selectedPage:r,rowPerPage:i,totalRecords:l,onPageChange:C=>{o(C)},onPageSizeChange:C=>{a(C==null?void 0:C.value),o(1)}}},toolbarProps:{defaultTools:{search:{isRequired:!0,onChange:C=>{const w=C.target.value;w&&o(1),b(w)},placeholder:`${n("SEARCH")}...`}}}})}),m.jsx(Dl,{sx:{padding:"1.5rem 2rem"}})]})},oW=({baseUrl:e,t})=>{const{alertDialogProps:n,showDetailsProps:r,fetchNotification:o,isMarkAllAsRead:i}=xw({baseUrl:e});return m.jsxs(m.Fragment,{children:[m.jsx(we,{sx:{display:"flex",justifyContent:"center",cursor:"pointer",marginTop:"0.6rem"},onClick:()=>{var a;o(),(a=n==null?void 0:n.setOpen)==null||a.call(n,!0)},children:m.jsx(J7,{count:i.count})}),m.jsx(Tw,{...n,children:m.jsx(nW,{...n,t})}),m.jsx(Tw,{...r,children:m.jsx(rW,{...r,t})})]})},sW=({baseUrl:e,t})=>m.jsx(Ln,{children:m.jsx(q7,{children:m.jsx(oW,{baseUrl:e,t})})}),iW=({rightChild:e,leftChild:t,isDrawerMerged:n,isDrawerOpen:r,drawerTitle:o,showExpand:i,onCloseClick:a,onMergeClick:l,onExpandClick:c,isDrawerExpanded:u,styles:d,showMerge:f})=>{const p=It();return m.jsx(we,{sx:{position:"relative",overflow:"hidden"},children:m.jsxs(uo,{container:!0,sx:{height:"100%"},children:[m.jsx(uo,{item:!0,sx:{width:n?d!=null&&d.drawerWidth?`calc(${"100%"-(d==null?void 0:d.drawerWidth)})`:"75%":"100%",position:"relative",zIndex:3,height:"calc(100vh - 7rem)",p:"0rem 1.5rem",overflow:"auto"},children:t}),r&&!n&&m.jsx(m.Fragment,{children:m.jsx(we,{onClick:a,sx:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"#07080B80",backdropFilter:"blur(3px)",zIndex:3,transition:"opacity 0.3s ease-in-out"}})}),e&&m.jsxs(uo,{item:!0,sx:{width:u?"90%":(d==null?void 0:d.drawerWidth)||"25%",position:n?"relative":"absolute",top:0,right:0,height:"calc(100vh - 7rem)",backgroundColor:p.palette.primary.notifyBackground,transform:r?"translateX(0)":"translateX(100%)",transition:"transform 0.4s ease-in-out , width 0.4s ease-in-out",zIndex:4,borderLeft:`0.1rem solid ${p.palette.primary.notifyBorderColor}`,display:"flex",flexDirection:"column"},children:[m.jsxs(lt,{direction:"row",alignItems:"center",sx:{width:"100%",flexShrink:0,paddingBottom:"0.8rem",px:2,pt:"0.8rem",borderBottom:h=>`0.1rem solid ${h.palette.primary.notifyBorderColor}`},children:[!u&&f&&m.jsxs(m.Fragment,{children:[m.jsx(we,{component:"img",src:Qe.Merge,sx:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer"},onClick:l}),m.jsx(Ci,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"auto!important",borderColor:p.palette.primary.notifyBorderColor}})]}),m.jsxs(lt,{direction:"row",justifyContent:"space-between",alignItems:"center",flexGrow:1,children:[m.jsxs(lt,{direction:"row",gap:"0.5rem",alignItems:"center",onClick:a,sx:{cursor:"pointer"},children:[m.jsx(mn,{url:Qe.CrossLight}),m.jsx(rt,{sx:{fontSize:"1.2rem",color:p.palette.primary.notifyTextColor},children:o})]}),m.jsx(lt,{direction:"row",gap:"0.5rem",alignItems:"center",children:i&&m.jsx(we,{onClick:c,sx:{cursor:"pointer"},children:m.jsx(we,{component:"img",src:u?Qe.Collapse:Qe.Expand})})})]})]}),m.jsx(we,{sx:{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},overflow:"auto",px:2},children:e})]})]})})},Rw=({layoutChildren:e,layoutProps:t})=>m.jsx(Ln,{children:m.jsx(iW,{...e,...t})});Rw.propTypes={layoutChildren:s.object.isRequired,layoutProps:s.object.isRequired},xt.Button=Er,xt.Checkbox=lc,xt.DatePicker=P8,xt.Grid=zp,xt.Header=yw,xt.InputField=p1,xt.Loader=H8,xt.Notification=sW,xt.Select=h1,xt.SliderLayout=Rw,xt.Switch=b1,xt.TextField=Sc,xt.ToastProvider=B8,xt.toast=F8,Object.defineProperty(xt,Symbol.toStringTag,{value:"Module"})});
|
|
327
327
|
//# sourceMappingURL=index.umd.js.map
|