@3sc/common-component 0.0.237 → 0.0.239

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.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 o=new this(t);return n.forEach(r=>o.set(r)),o}static accessor(t){const o=(this[P1]=this[P1]={accessors:{}}).accessors,r=this.prototype;function i(a){const l=Ca(a);o[l]||(D8(r,a),o[l]=!0)}return ee.isArray(t)?t.forEach(i):i(t),this}};mn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ee.reduceDescriptors(mn.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(o){this[n]=o}}}),ee.freezeMethods(mn);function wp(e,t){const n=this||wa,o=t||n,r=mn.from(o.headers);let i=o.data;return ee.forEach(e,function(l){i=l.call(n,i,r.normalize(),t?t.status:void 0)}),r.normalize(),i}function M1(e){return!!(e&&e.__CANCEL__)}function Is(e,t,n){ze.call(this,e??"canceled",ze.ERR_CANCELED,t,n),this.name="CanceledError"}ee.inherits(Is,ze,{__CANCEL__:!0});function R1(e,t,n){const o=n.config.validateStatus;!n.status||!o||o(n.status)?e(n):t(new ze("Request failed with status code "+n.status,[ze.ERR_BAD_REQUEST,ze.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function I8(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function A8(e,t){e=e||10;const n=new Array(e),o=new Array(e);let r=0,i=0,a;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=o[i];a||(a=u),n[r]=c,o[r]=u;let f=i,p=0;for(;f!==r;)p+=n[f++],f=f%e;if(r=(r+1)%e,r===i&&(i=(i+1)%e),u-a<t)return;const m=d&&u-d;return m?Math.round(p*1e3/m):void 0}}function j8(e,t){let n=0,o=1e3/t,r,i;const a=(u,d=Date.now())=>{n=d,r=null,i&&(clearTimeout(i),i=null),e.apply(null,u)};return[(...u)=>{const d=Date.now(),f=d-n;f>=o?a(u,d):(r=u,i||(i=setTimeout(()=>{i=null,a(r)},o-f)))},()=>r&&a(r)]}const Pc=(e,t,n=3)=>{let o=0;const r=A8(50,250);return j8(i=>{const a=i.loaded,l=i.lengthComputable?i.total:void 0,c=a-o,u=r(c),d=a<=l;o=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)},D1=(e,t)=>{const n=e!=null;return[o=>t[0]({lengthComputable:n,total:e,loaded:o}),t[1]]},I1=e=>(...t)=>ee.asap(()=>e(...t)),N8=en.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,en.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(en.origin),en.navigator&&/(msie|trident)/i.test(en.navigator.userAgent)):()=>!0,$8=en.hasStandardBrowserEnv?{write(e,t,n,o,r,i){const a=[e+"="+encodeURIComponent(t)];ee.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),ee.isString(o)&&a.push("path="+o),ee.isString(r)&&a.push("domain="+r),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 _8(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function F8(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function A1(e,t,n){let o=!_8(t);return e&&(o||n==!1)?F8(e,t):t}const j1=e=>e instanceof mn?{...e}:e;function Cr(e,t){t=t||{};const n={};function o(u,d,f,p){return ee.isPlainObject(u)&&ee.isPlainObject(d)?ee.merge.call({caseless:p},u,d):ee.isPlainObject(d)?ee.merge({},d):ee.isArray(d)?d.slice():d}function r(u,d,f,p){if(ee.isUndefined(d)){if(!ee.isUndefined(u))return o(void 0,u,f,p)}else return o(u,d,f,p)}function i(u,d){if(!ee.isUndefined(d))return o(void 0,d)}function a(u,d){if(ee.isUndefined(d)){if(!ee.isUndefined(u))return o(void 0,u)}else return o(void 0,d)}function l(u,d,f){if(f in t)return o(u,d);if(f in e)return o(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)=>r(j1(u),j1(d),f,!0)};return ee.forEach(Object.keys(Object.assign({},e,t)),function(d){const f=c[d]||r,p=f(e[d],t[d],d);ee.isUndefined(p)&&f!==l||(n[d]=p)}),n}const N1=e=>{const t=Cr({},e);let{data:n,withXSRFToken:o,xsrfHeaderName:r,xsrfCookieName:i,headers:a,auth:l}=t;t.headers=a=mn.from(a),t.url=T1(A1(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(ee.isFormData(n)){if(en.hasStandardBrowserEnv||en.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(en.hasStandardBrowserEnv&&(o&&ee.isFunction(o)&&(o=o(t)),o||o!==!1&&N8(t.url))){const u=r&&i&&$8.read(i);u&&a.set(r,u)}return t},B8=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,o){const r=N1(e);let i=r.data;const a=mn.from(r.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:u}=r,d,f,p,m,y;function h(){m&&m(),y&&y(),r.cancelToken&&r.cancelToken.unsubscribe(d),r.signal&&r.signal.removeEventListener("abort",d)}let b=new XMLHttpRequest;b.open(r.method.toUpperCase(),r.url,!0),b.timeout=r.timeout;function x(){if(!b)return;const w=mn.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};R1(function(k){n(k),h()},function(k){o(k),h()},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&&(o(new ze("Request aborted",ze.ECONNABORTED,e,b)),b=null)},b.onerror=function(){o(new ze("Network Error",ze.ERR_NETWORK,e,b)),b=null},b.ontimeout=function(){let O=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const v=r.transitional||E1;r.timeoutErrorMessage&&(O=r.timeoutErrorMessage),o(new ze(O,v.clarifyTimeoutError?ze.ETIMEDOUT:ze.ECONNABORTED,e,b)),b=null},i===void 0&&a.setContentType(null),"setRequestHeader"in b&&ee.forEach(a.toJSON(),function(O,v){b.setRequestHeader(v,O)}),ee.isUndefined(r.withCredentials)||(b.withCredentials=!!r.withCredentials),l&&l!=="json"&&(b.responseType=r.responseType),u&&([p,y]=Pc(u,!0),b.addEventListener("progress",p)),c&&b.upload&&([f,m]=Pc(c),b.upload.addEventListener("progress",f),b.upload.addEventListener("loadend",m)),(r.cancelToken||r.signal)&&(d=w=>{b&&(o(!w||w.type?new Is(null,e,b):w),b.abort(),b=null)},r.cancelToken&&r.cancelToken.subscribe(d),r.signal&&(r.signal.aborted?d():r.signal.addEventListener("abort",d)));const T=I8(r.url);if(T&&en.protocols.indexOf(T)===-1){o(new ze("Unsupported protocol "+T+":",ze.ERR_BAD_REQUEST,e));return}b.send(i||null)})},L8=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let o=new AbortController,r;const i=function(u){if(!r){r=!0,l();const d=u instanceof Error?u:this.reason;o.abort(d instanceof ze?d:new Is(d instanceof Error?d.message:d))}};let a=t&&setTimeout(()=>{a=null,i(new ze(`timeout ${t} of ms exceeded`,ze.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}=o;return c.unsubscribe=()=>ee.asap(l),c}},V8=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let o=0,r;for(;o<n;)r=o+t,yield e.slice(o,r),o=r},W8=async function*(e,t){for await(const n of z8(e))yield*V8(n,t)},z8=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:o}=await t.read();if(n)break;yield o}}finally{await t.cancel()}},$1=(e,t,n,o)=>{const r=W8(e,t);let i=0,a,l=c=>{a||(a=!0,o&&o(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await r.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),r.return()}},{highWaterMark:2})},Mc=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",_1=Mc&&typeof ReadableStream=="function",U8=Mc&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),F1=(e,...t)=>{try{return!!e(...t)}catch{return!1}},H8=_1&&F1(()=>{let e=!1;const t=new Request(en.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),B1=64*1024,Cp=_1&&F1(()=>ee.isReadableStream(new Response("").body)),Rc={stream:Cp&&(e=>e.body)};Mc&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Rc[t]&&(Rc[t]=ee.isFunction(e[t])?n=>n[t]():(n,o)=>{throw new ze(`Response type '${t}' is not supported`,ze.ERR_NOT_SUPPORT,o)})})})(new Response);const q8=async e=>{if(e==null)return 0;if(ee.isBlob(e))return e.size;if(ee.isSpecCompliantForm(e))return(await new Request(en.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(ee.isArrayBufferView(e)||ee.isArrayBuffer(e))return e.byteLength;if(ee.isURLSearchParams(e)&&(e=e+""),ee.isString(e))return(await U8(e)).byteLength},Y8=async(e,t)=>{const n=ee.toFiniteNumber(e.getContentLength());return n??q8(t)},Sp={http:h8,xhr:B8,fetch:Mc&&(async e=>{let{url:t,method:n,data:o,signal:r,cancelToken:i,timeout:a,onDownloadProgress:l,onUploadProgress:c,responseType:u,headers:d,withCredentials:f="same-origin",fetchOptions:p}=N1(e);u=u?(u+"").toLowerCase():"text";let m=L8([r,i&&i.toAbortSignal()],a),y;const h=m&&m.unsubscribe&&(()=>{m.unsubscribe()});let b;try{if(c&&H8&&n!=="get"&&n!=="head"&&(b=await Y8(d,o))!==0){let v=new Request(t,{method:"POST",body:o,duplex:"half"}),E;if(ee.isFormData(o)&&(E=v.headers.get("content-type"))&&d.setContentType(E),v.body){const[k,M]=D1(b,Pc(I1(c)));o=$1(v.body,B1,k,M)}}ee.isString(f)||(f=f?"include":"omit");const x="credentials"in Request.prototype;y=new Request(t,{...p,signal:m,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:o,duplex:"half",credentials:x?f:void 0});let T=await fetch(y);const w=Cp&&(u==="stream"||u==="response");if(Cp&&(l||w&&h)){const v={};["status","statusText","headers"].forEach(I=>{v[I]=T[I]});const E=ee.toFiniteNumber(T.headers.get("content-length")),[k,M]=l&&D1(E,Pc(I1(l),!0))||[];T=new Response($1(T.body,B1,k,()=>{M&&M(),h&&h()}),v)}u=u||"text";let O=await Rc[ee.findKey(Rc,u)||"text"](T,e);return!w&&h&&h(),await new Promise((v,E)=>{R1(v,E,{data:O,headers:mn.from(T.headers),status:T.status,statusText:T.statusText,config:e,request:y})})}catch(x){throw h&&h(),x&&x.name==="TypeError"&&/fetch/i.test(x.message)?Object.assign(new ze("Network Error",ze.ERR_NETWORK,e,y),{cause:x.cause||x}):ze.from(x,x&&x.code,e,y)}})};ee.forEach(Sp,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const L1=e=>`- ${e}`,G8=e=>ee.isFunction(e)||e===null||e===!1,V1={getAdapter:e=>{e=ee.isArray(e)?e:[e];const{length:t}=e;let n,o;const r={};for(let i=0;i<t;i++){n=e[i];let a;if(o=n,!G8(n)&&(o=Sp[(a=String(n)).toLowerCase()],o===void 0))throw new ze(`Unknown adapter '${a}'`);if(o)break;r[a||"#"+i]=o}if(!o){const i=Object.entries(r).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(L1).join(`
325
325
  `):" "+L1(i[0]):"as no adapter specified";throw new ze("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return o},adapters:Sp};function Tp(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Is(null,e)}function W1(e){return Tp(e),e.headers=mn.from(e.headers),e.data=wp.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),V1.getAdapter(e.adapter||wa.adapter)(e).then(function(o){return Tp(e),o.data=wp.call(e,e.transformResponse,o),o.headers=mn.from(o.headers),o},function(o){return M1(o)||(Tp(e),o&&o.response&&(o.response.data=wp.call(e,e.transformResponse,o.response),o.response.headers=mn.from(o.response.headers))),Promise.reject(o)})}const z1="1.8.4",Dc={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Dc[e]=function(o){return typeof o===e||"a"+(t<1?"n ":" ")+e}});const U1={};Dc.transitional=function(t,n,o){function r(i,a){return"[Axios v"+z1+"] Transitional option '"+i+"'"+a+(o?". "+o:"")}return(i,a,l)=>{if(t===!1)throw new ze(r(a," has been removed"+(n?" in "+n:"")),ze.ERR_DEPRECATED);return n&&!U1[a]&&(U1[a]=!0,console.warn(r(a," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,a,l):!0}},Dc.spelling=function(t){return(n,o)=>(console.warn(`${o} is likely a misspelling of ${t}`),!0)};function K8(e,t,n){if(typeof e!="object")throw new ze("options must be an object",ze.ERR_BAD_OPTION_VALUE);const o=Object.keys(e);let r=o.length;for(;r-- >0;){const i=o[r],a=t[i];if(a){const l=e[i],c=l===void 0||a(l,i,e);if(c!==!0)throw new ze("option "+i+" must be "+c,ze.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new ze("Unknown option "+i,ze.ERR_BAD_OPTION)}}const Ic={assertOptions:K8,validators:Dc},mo=Ic.validators;let Sr=class{constructor(t){this.defaults=t,this.interceptors={request:new O1,response:new O1}}async request(t,n){try{return await this._request(t,n)}catch(o){if(o instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const i=r.stack?r.stack.replace(/^.+\n/,""):"";try{o.stack?i&&!String(o.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(o.stack+=`
326
- `+i):o.stack=i}catch{}}throw o}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Cr(this.defaults,n);const{transitional:o,paramsSerializer:r,headers:i}=n;o!==void 0&&Ic.assertOptions(o,{silentJSONParsing:mo.transitional(mo.boolean),forcedJSONParsing:mo.transitional(mo.boolean),clarifyTimeoutError:mo.transitional(mo.boolean)},!1),r!=null&&(ee.isFunction(r)?n.paramsSerializer={serialize:r}:Ic.assertOptions(r,{encode:mo.function,serialize:mo.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Ic.assertOptions(n,{baseUrl:mo.spelling("baseURL"),withXsrfToken:mo.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&ee.merge(i.common,i[n.method]);i&&ee.forEach(["delete","get","head","post","put","patch","common"],y=>{delete i[y]}),n.headers=mn.concat(a,i);const l=[];let c=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(n)===!1||(c=c&&h.synchronous,l.unshift(h.fulfilled,h.rejected))});const u=[];this.interceptors.response.forEach(function(h){u.push(h.fulfilled,h.rejected)});let d,f=0,p;if(!c){const y=[W1.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 m=n;for(f=0;f<p;){const y=l[f++],h=l[f++];try{m=y(m)}catch(b){h.call(this,b);break}}try{d=W1.call(this,m)}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=Cr(this.defaults,t);const n=A1(t.baseURL,t.url,t.allowAbsoluteUrls);return T1(n,t.params,t.paramsSerializer)}};ee.forEach(["delete","get","head","options"],function(t){Sr.prototype[t]=function(n,o){return this.request(Cr(o||{},{method:t,url:n,data:(o||{}).data}))}}),ee.forEach(["post","put","patch"],function(t){function n(o){return function(i,a,l){return this.request(Cr(l||{},{method:t,headers:o?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}Sr.prototype[t]=n(),Sr.prototype[t+"Form"]=n(!0)});let X8=class Ow{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 o=this;this.promise.then(r=>{if(!o._listeners)return;let i=o._listeners.length;for(;i-- >0;)o._listeners[i](r);o._listeners=null}),this.promise.then=r=>{let i;const a=new Promise(l=>{o.subscribe(l),i=l}).then(r);return a.cancel=function(){o.unsubscribe(i)},a},t(function(i,a,l){o.reason||(o.reason=new Is(i,a,l),n(o.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=o=>{t.abort(o)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Ow(function(r){t=r}),cancel:t}}};function Z8(e){return function(n){return e.apply(null,n)}}function J8(e){return ee.isObject(e)&&e.isAxiosError===!0}const Op={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(Op).forEach(([e,t])=>{Op[t]=e});function H1(e){const t=new Sr(e),n=u1(Sr.prototype.request,t);return ee.extend(n,Sr.prototype,t,{allOwnKeys:!0}),ee.extend(n,t,null,{allOwnKeys:!0}),n.create=function(r){return H1(Cr(e,r))},n}const St=H1(wa);St.Axios=Sr,St.CanceledError=Is,St.CancelToken=X8,St.isCancel=M1,St.VERSION=z1,St.toFormData=Ec,St.AxiosError=ze,St.Cancel=St.CanceledError,St.all=function(t){return Promise.all(t)},St.spread=Z8,St.isAxiosError=J8,St.mergeConfig=Cr,St.AxiosHeaders=mn,St.formToJSON=e=>k1(ee.isHTMLForm(e)?new FormData(e):e),St.getAdapter=V1.getAdapter,St.HttpStatusCode=Op,St.default=St;const{Axios:jW,AxiosError:NW,CanceledError:$W,isCancel:_W,CancelToken:FW,VERSION:BW,all:LW,Cancel:VW,isAxiosError:WW,spread:zW,toFormData:UW,AxiosHeaders:HW,HttpStatusCode:qW,formToJSON:YW,getAdapter:GW,mergeConfig:KW}=St,Ep={BASE_URL:"https://qa.3sc.ai/api",VERSION:"/v1"};/*! js-cookie v3.0.5 | MIT */function Ac(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}var Q8={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 kp(e,t){function n(r,i,a){if(!(typeof document>"u")){a=Ac({},t,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),r=encodeURIComponent(r).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=r+"="+e.write(i,r)+l}}function o(r){if(!(typeof document>"u"||arguments.length&&!r)){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),r===d)break}catch{}}return r?a[r]:a}}return Object.create({set:n,get:o,remove:function(r,i){n(r,"",Ac({},i,{expires:-1}))},withAttributes:function(r){return kp(this.converter,Ac({},this.attributes,r))},withConverter:function(r){return kp(Ac({},this.converter,r),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var e7=kp(Q8,{path:"/"});const Go={TOKEN:"token",USER:"user",SNOP:"snop",SELECTED_BU:"selected_business_unit",SETTINGS:"settings"},Pp={BEARER:"Bearer",TENANT_ID:"tenant_id",BU_ID:"bu_id",SNOP_ID:"snop_id"},t7=[10,25,50,100],q1={MARK_ALL_READ:"MARK_ALL_READ"},n7=t7.map(e=>({label:e,value:e})),Y1={PRIMARY:"PRIMARY",SECONDARY:"SECONDARY"},Mp=vc(Go.SNOP),Rp=vc(Go.SELECTED_BU),Dp=vc(Go.USER),o7=vc(Go.SETTINGS),Tr={BU_IDS:Rp==null?void 0:Rp.business_unit_id,TOKEN:JSON.parse(e7.get(Go.TOKEN)||null),TENANT_IDS:Dp==null?void 0:Dp.tenant_id,SNOP_IDS:Mp==null?void 0:Mp.snop_id,GRID_SETTINGS:o7},Sa={headers:{"Content-Type":"application/json",Authorization:`${Pp.BEARER} ${Tr.TOKEN}`}},G1=St.create({baseURL:Ep.BASE_URL,axiosConfig:Sa});G1.interceptors.request.use(function(e){return e},function(e){return Promise.reject(e)}),G1.interceptors.response.use(function(e){return e},function(e){return Promise.reject(e)});const jc={NOTIFICATION:"/notifications",SETTING:"/configuration/setting"},{TENANT_ID:r7,BU_ID:s7}=Pp,{TENANT_IDS:i7,BU_IDS:a7}=Tr,Nc=async({baseUrl:e,payload:t})=>{try{const n=`${e}${jc.SETTING}/v1?${r7}=${i7}&${s7}=${a7}`;return await St.post(n,t,Sa)}catch(n){return n}},l7=({columns:e,gridPath:t,baseUrl:n,isDefaultConfig:o,pageSize:r})=>{var y;let{definitions:i,defaultUserSettings:a,labels:l}=e;const c=t.split("/").filter(Boolean);let u=c.reduce((h,b)=>h==null?void 0:h[b],Tr.GRID_SETTINGS)||null;o||!u&&!a&&(async()=>{try{a=K1({definitions:i});let h=Tr.GRID_SETTINGS||{platform:{theme:"light"}};const b=(u==null?void 0:u.pageSize)??r;let x=h;for(let T=0;T<c.length;T++){const w=c[T];T===c.length-1?x[w]={columns:a,pageSize:b}:(x[w]=x[w]||{},x=x[w])}localStorage.setItem(Go.SETTINGS,JSON.stringify(h)),await Nc({baseUrl:n,payload:h})}catch(h){console.error(h)}})(),a=(u==null?void 0:u.columns)??a??K1({definitions:i});const d=a.reduce((h,b)=>(h[b.id]=b,h),{}),f=l.reduce((h,b)=>(h[b.id]=b,h),{}),p=[];for(const h of i){const b=d[h.id]||{},x=f[h.id]||{};let T={...h,...b,...x};if((y=h.children)!=null&&y.length){const w=b.children||[],O=x.children||[];T.children=h.children.map((v,E)=>({...v,...w[E],...O[E]}))}p.push(T)}return p.sort((h,b)=>h.sequenceId-b.sequenceId)},c7=e=>e.sort((t,n)=>t.sequenceId-n.sequenceId),K1=({definitions:e})=>e.map((t,n)=>({id:t.id,key:t.key,sequenceId:t.id,isHidden:!1,style:t.style||{}})),u7=()=>({definitions:[{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}],defaultUserSettings:[{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"}}],labels:[{id:1,key:"sku_name",label:"SKU",isLocalizable:!1},{id:2,key:"node",label:"Node",isLocalizable:!1},{id:3,key:"channel_name",label:"Channel",isLocalizable:!1}]});class Ip extends R.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=R.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,o=this.startPos-this.mouseX;let r=this.startWidthPrev-o;(!this.props.minWidth||r>=this.props.minWidth)&&(!this.props.maxWidth||r<=this.props.maxWidth)&&(n.previousSibling.style.width=r+"px",n.previousSibling.style.minWidth=r+"px",n.previousSibling.style.maxWidth=r+"px",n.previousSibling.style.setProperty("--column_resize_before_width",r+"px"),this.lastDraggedWidth=r)}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)"),R.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})}}Ip.defaultProps={disabled:!1,minWidth:0,className:""},Ip.propTypes={disabled:"boolean",minWidth:"number",className:"string"};const d7=(e,t,n,o)=>{const[r,i]=R.useState({isOpen:!1,column:null}),a=(u,d)=>{i({isOpen:u.currentTarget,column:d})},l=()=>{i({isOpen:!1,column:null})};return{selectedColumn:r,handleMenuClick:a,handleClose:l,handleHideClick:async()=>{l();const u=e.map(f=>{var p;return f.id===((p=r==null?void 0:r.column)==null?void 0:p.id)?{...f,isHidden:!0}:f});t({type:He.SET_GRID_DATA,payload:{visibleGridColumns:u}});let d=Tr.GRID_SETTINGS||{platform:{theme:"light"},grid:{}};d.grid=d.grid||{},d.grid[o]=u,localStorage.setItem(Go.SETTINGS,JSON.stringify(d)),await Nc({baseUrl:n,payload:d})}}},X1=({pagination:e})=>{const{selectedPage:t,rowPerPage:n,totalRecords:o,onPageChange:r,onPageSizeChange:i}=e,a=Nt();return g.jsxs(ge,{sx:{display:"flex",p:"1rem 2rem"},children:[g.jsxs(ge,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"0.5rem",width:"100%"},children:[g.jsx(et,{sx:{fontSize:"1.1rem",color:a.palette.primary.notifyTextColor},children:`Showing ${(t-1)*n+1} to ${Math.min(t*n,o)} of ${o} rows`}),g.jsx(ge,{sx:{"& .MuiInputBase-input":{padding:"0rem 0.8rem!important"},width:"6rem"},children:g.jsx(wc,{options:n7,value:n,onChange:i})}),g.jsx(et,{sx:{fontSize:"1.1rem",color:a.palette.primary.notifyTextColor},children:"records per page"})]}),g.jsx(x0,{count:Math.ceil(o/n),page:t,onChange:(l,c)=>{r(c)},shape:"rounded",sx:{width:"100%","& .MuiPagination-ul":{width:"100%",display:"flex",justifyContent:"flex-end","& li:first-of-type":{border:`0.1rem solid ${a.palette.primary.notifyBorderColor}`,color:a.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 ${a.palette.primary.notifyBorderColor}`,color:a.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:a.palette.primary.notifyActiveText,backgroundColor:`${a.palette.brandColor.paginationBc} !important`}}})]})};X1.propTypes={pagination:s.object.isRequired};function Ap({isRenderCellContent:e,column:t,row:n,parent:o}){const r=n[t.key];return g.jsx(g.Fragment,{children:e?g.jsx(ge,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem"},component:"label",children:t==null?void 0:t.cellRenderer(n,{column:t,parent:o})}):g.jsx(M0,{title:(r==null?void 0:r.length)>20?r:"",arrow:!0,children:g.jsx(ge,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem"},component:"label",children:cV(r)})})})}Ap.propTypes={isRenderCellContent:s.bool,column:s.object,row:s.object};const Z1=({menuOpen:e,handleClose:t,onHideClick:n})=>{const o=Nt();return g.jsx(Ti,{open:!!e,anchorEl:e,onClose:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:g.jsx(ge,{sx:{p:"0.4rem 1rem",backgroundColor:o.palette.primary.notifyBackground,border:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,minHeight:"2.3rem",display:"flex",justifyContent:"center",alignItems:"center"},children:g.jsx(Un,{onClick:n,sx:{textTransform:"none",fontSize:"1.1rem",p:0,minHeight:"unset",fontWeight:"500",color:o.palette.primary.notifyTextColor},children:"Hide Column"})})})};Z1.propTypes={menuOpen:s.object,handleClose:s.func,onHideClick:s.func},H(Ol)(({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 Or=H(et)(({theme:e})=>({color:e.palette.primary.notifyTextColor,fontSize:"1.1rem"})),f7=H(R0)(({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)"})}})),p7=H(bi)(({theme:e})=>({color:e.palette.primary.notifyTextColor,padding:"0.6rem 0",fontSize:"0.9rem",fontWeight:500,"&::before, &::after":{borderColor:`${e.palette.primary.notifyBorderColor}!important`}})),h7=H(ed)(({theme:e})=>({"& .MuiBadge-badge":{right:3.5,top:2.34,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"}}));H($l)(({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 m7=H(K0)(({theme:e})=>({minHeight:"2rem","& .MuiTabs-indicator":{height:"0.1rem",backgroundColor:e.palette.primary.notifyActiveText}})),jp=H(D0)(({theme:e})=>({color:e.palette.primary.notifyActiveText,textTransform:"none",fontWeight:"normal",padding:0,fontSize:"1rem",minHeight:"2rem","&.Mui-selected":{fontWeight:"bold",color:e.palette.primary.notifyActiveText}})),$c=H(Zu)(({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`}})),J1=({sortKey:e,sortField:t,sortDir:n,handleSortClick:o})=>{const r=i=>g.jsx(Do,{onClick:o,sx:{padding:"0.5rem"},children:g.jsx(ge,{component:"img",src:i})});return g.jsx(g.Fragment,{children:r(t===e?n==="asc"?nt.AscSort:nt.DescSort:nt.Unsort)})};J1.propTypes={sortKey:s.string.isRequired,sortField:s.string,sortDir:s.string,handleSortClick:s.func};function Q1({parent:e,column:t,sort:n,handleMenuClick:o,isManageable:r}){const i=t==null?void 0:t.isMandatory,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 g.jsxs(ge,{sx:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.1rem",textAlign:"center",whiteSpace:"normal"},children:[a,g.jsxs(ge,{sx:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[l&&g.jsx(J1,{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})}),r&&!i&&g.jsx(Do,{onClick:f=>o(f,t),sx:{padding:"0.5rem"},children:g.jsx(ge,{component:"img",src:nt.Menu})})]})]})}Q1.propTypes={column:s.object.isRequired,sort:s.object.isRequired,handleMenuClick:s.func,isManageable:s.bool};const g7=H($0)(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"table-cell",[`&.${yd.head}`]:{color:e.palette.primary.notifyTextColor,backgroundColor:e.palette.primary.notifyBackground,borderColor:e.palette.primary.notifyBorderColor,padding:"0.3rem 1rem",textAlign:"center"},[`&.${yd.body}`]:{color:e.palette.primary.notifyTextColor,borderColor:e.palette.primary.notifyBorderColor,padding:"0.3rem 1rem",textAlign:"center"}}));function As({children:e,...t}){return g.jsx(g7,{...t,children:e})}As.propTypes={children:s.node};const y7=H(W0)(()=>({"&:last-child td":{borderBottom:0}}));function js({children:e,...t}){return g.jsx(y7,{...t,children:e})}js.propTypes={children:s.node};function ew({rows:e,sort:t,data:n,pagination:o,columns:r,nested:i,baseUrl:a,gridPath:l}){var W;const c=Nt(),{visibleGridColumns:u}=R.useContext(ya),d=R.useContext(ba),{selectedColumn:f,handleMenuClick:p,handleClose:m,handleHideClick:y}=d7(u,d,a,l),h=r==null?void 0:r.isManageable,b=(n==null?void 0:n.length)>0,x=R.useRef(null),[T,w]=R.useState(null);let O=null;const v=R.useRef(0),E=c7(((W=i==null?void 0:i.column)==null?void 0:W.definitions)||[]),k=i==null?void 0:i.isNested,M=(i==null?void 0:i.data)||[],I=i==null?void 0:i.hashKey;if(!b)return g.jsx(Or,{sx:{textAlign:"center"},children:Yo.NRF});const j=(D,N)=>{w(N),D.dataTransfer.setData("colIndex",N)},F=D=>{D.preventDefault(),V(D)},A=async(D,N)=>{if(D.preventDefault(),clearInterval(O),T===null||T===N)return;const B=[...u],[Y]=B.splice(T,1);B.splice(N,0,Y);const Z=u.slice().sort((oe,X)=>oe.sequenceId-X.sequenceId).map(oe=>oe.sequenceId),q=B.map((oe,X)=>({...oe,sequenceId:Z[X]??oe.sequenceId})),Q={...Tr.GRID_SETTINGS||{platform:{theme:"light"}}},G=l.split("/").filter(Boolean);let ne=Q;for(let oe=0;oe<G.length;oe++){const X=G[oe];if(oe===G.length-1){const re=(o==null?void 0:o.rowPerPage)??null;ne[X]={columns:q,pageSize:re}}else ne[X]=ne[X]||{},ne=ne[X]}localStorage.setItem(Go.SETTINGS,JSON.stringify(Q)),d({type:He.SET_GRID_DATA,payload:{visibleGridColumns:q}}),await Nc({baseUrl:a,payload:Q}),w(null)},V=D=>{const N=x.current,{left:B,right:Y}=N.getBoundingClientRect(),Z=50,q=D.clientX>Y-Z?1:D.clientX<B+Z?-1:0;q!==0?(clearInterval(O),O=setInterval(()=>{N.scrollLeft+=q*10},50)):clearInterval(O)},$=(D,N,B,Y)=>{var G,ne,oe;const Z=(D==null?void 0:D.isMandatory)&&(D==null?void 0:D.isSticky),q=parseFloat((ne=(G=D==null?void 0:D.style)==null?void 0:G.minWidth)==null?void 0:ne.toString().replace("rem",""))||7.5;N===0&&(v.current=0);const Q=Z?N===0?0:`${v.current}rem`:void 0;return Z&&(v.current+=q),g.jsx(As,{rowSpan:D!=null&&D.children?1:2,colSpan:(oe=D==null?void 0:D.children)==null?void 0:oe.length,style:D==null?void 0:D.style,draggable:B&&!Y&&!(D!=null&&D.isMandatory),onDragStart:B?X=>j(X,N):void 0,onDragOver:B?F:void 0,onDrop:B?X=>A(X,N):void 0,sx:{...Z&&{borderRadius:"0rem!important",position:"sticky",left:Q,zIndex:3},...D!=null&&D.children||Y?{borderRadius:"0rem!important",borderRight:X=>`0.1rem solid ${X.palette.primary.notifyBorderColor}`}:{borderLeft:X=>(D==null?void 0:D.key)==="volume_value"&&`0.1rem solid ${X.palette.primary.notifyBorderColor}`,borderRight:X=>(D==null?void 0:D.key)==="volume_value"&&`0.1rem solid ${X.palette.primary.notifyBorderColor}`}},children:g.jsx(Q1,{parent:Y,column:D,sort:t,handleMenuClick:p,isManageable:B})},N)},_=(D,N,B,Y)=>!(D!=null&&D.isMandatory)&&B?g.jsx(ge,{component:Ip,id:N,sx:{width:"4rem",maxWidth:"4rem",minWidth:"4rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${c.palette.primary.notifyBorderColor}`,"&::after":{content:'""',position:"absolute",left:"50%",top:"50%",transform:"translate(0%, -50%)",width:"0.2rem",height:"50%",background:c.palette.primary.notifyBorderColor}},disabled:!B}):null,P=(D,N,B,Y)=>{var G,ne,oe;const Z=(D==null?void 0:D.isMandatory)&&(D==null?void 0:D.isSticky),q=parseFloat((ne=(G=D==null?void 0:D.style)==null?void 0:G.minWidth)==null?void 0:ne.toString().replace("rem",""))||7.5;B===0&&(v.current=0);const Q=Z?B===0?0:`${v.current}rem`:void 0;return Z&&(v.current+=q),g.jsxs(As,{style:D==null?void 0:D.style,className:`${D==null?void 0:D.label}`,sx:{position:"relative",...Z&&{position:"sticky",left:Q,zIndex:2,backgroundColor:X=>{var re;return e&&((re=e==null?void 0:e.selectedRow)==null?void 0:re.fhi)===(N==null?void 0:N.fhi)||N!=null&&N.isHigh?X.palette.primary.appBackground:X.palette.primary.notifyBackground}},...Y?{p:"0rem!important",borderRight:X=>`0.1rem solid ${X.palette.primary.notifyBorderColor}`}:{px:"0rem!important",borderLeft:X=>(D==null?void 0:D.key)==="volume_value"&&`0.1rem solid ${X.palette.primary.notifyBorderColor}`,borderRight:X=>(D==null?void 0:D.key)==="volume_value"&&`0.1rem solid ${X.palette.primary.notifyBorderColor}`}},children:[(e&&((oe=e==null?void 0:e.selectedRow)==null?void 0:oe.fhi)===(N==null?void 0:N.fhi)||(N==null?void 0:N.isHigh))&&g.jsx(ge,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.05rem",background:"linear-gradient(#F9B16E, #F68080)"}}),g.jsx(Ap,{isRenderCellContent:!!(D!=null&&D.cellRenderer),column:D,row:N,parent:Y})]},B)},L=(D,N,B,Y)=>!(D!=null&&D.isMandatory)&&B?g.jsx(As,{className:"column_resizer_body"},`resize-${N}`):null;return g.jsxs(g.Fragment,{children:[g.jsx(_0,{sx:{maxHeight:"100%",whiteSpace:"nowrap",overflow:"auto",width:"100%",border:`0.1rem solid ${c.palette.primary.notifyBorderColor}`,borderRadius:"1.4rem"},children:g.jsxs(A0,{ref:x,stickyHeader:!0,"aria-label":"sticky table",sx:{backgroundColor:D=>D.palette.primary.notifyBackground},children:[g.jsxs(B0,{children:[g.jsx(js,{children:u.map((D,N)=>D!=null&&D.isHidden?null:g.jsxs(R.Fragment,{children:[$(D,N,h),(r==null?void 0:r.isResizable)&&_(D,N,h)]},N))}),g.jsx(js,{children:u.flatMap((D,N)=>D!=null&&D.isHidden||!(D!=null&&D.children)?[]:D.children.map((B,Y)=>g.jsxs(R.Fragment,{children:[$(B,Y,h,D),(r==null?void 0:r.isResizable)&&_(B,Y,h)]},`${N}-${Y}`)))})]}),g.jsx(N0,{children:n.map((D,N)=>{const B=D[I],Y=M==null?void 0:M[B],Z=(Y==null?void 0:Y.length)>0;return g.jsxs(R.Fragment,{children:[g.jsx(js,{sx:{backgroundColor:q=>{var Q;return e&&((Q=e==null?void 0:e.selectedRow)==null?void 0:Q.fhi)===(D==null?void 0:D.fhi)||D!=null&&D.isHigh?q.palette.primary.appBackground:q.palette.primary.notifyBackground}},onClick:()=>e==null?void 0:e.onRowClick(D),children:u.map((q,Q)=>q!=null&&q.isHidden?null:q!=null&&q.children?q.children.map((G,ne)=>g.jsxs(R.Fragment,{children:[P(G,D,ne,q),(r==null?void 0:r.isResizable)&&L(G,ne,h)]},`${Q}-${ne}`)):g.jsxs(R.Fragment,{children:[P(q,D,Q),(r==null?void 0:r.isResizable)&&L(q,Q,h)]},Q))}),k&&Y&&g.jsx(g.Fragment,{children:Z?Y.map((q,Q)=>g.jsx(js,{children:E.map((G,ne)=>g.jsx(As,{style:G==null?void 0:G.style,children:g.jsx(Ap,{isRenderCellContent:!!(G!=null&&G.cellRenderer),column:G,row:q})},ne))},`nested-${Q}`)):g.jsx(js,{children:g.jsx(As,{colSpan:E.length,children:g.jsx(Or,{sx:{textAlign:"center"},children:Yo.NRF})})})})]},N)})})]})}),o&&g.jsx(X1,{pagination:o}),g.jsx(Z1,{menuOpen:f==null?void 0:f.isOpen,handleClose:m,onHideClick:y})]})}ew.propTypes={sort:s.object,data:s.array,pagination:s.object,columns:s.object,nested:s.object};function tw({tableProps:e,isDefaultConfig:t,gridPath:n,baseUrl:o}){var c;const{columns:r}=e,{visibleGridColumns:i=[]}=R.useContext(ya)??{},a=R.useContext(ba),l=R.useMemo(()=>{var u;return l7({columns:r,gridPath:n,baseUrl:o,isDefaultConfig:t,pageSize:(u=e==null?void 0:e.pagination)==null?void 0:u.rowPerPage})},[r,n,o,t,(c=e==null?void 0:e.pagination)==null?void 0:c.rowPerPage]);return R.useMemo(()=>{const u=new Map(i.map(d=>[d.key,d]));return l.map(d=>{const f=u.get(d.key);return{...d,...f&&{isHidden:f.isHidden,sequenceId:f.sequenceId}}})},[l,i]),R.useEffect(()=>{a({type:He.SET_GRID_DATA,payload:{visibleGridColumns:l}})},[l]),g.jsx(ew,{...e,gridPath:n,baseUrl:o})}tw.propTypes={tableProps:s.object.isRequired,mergedColumns:s.array.isRequired};const nw=({type:e})=>{const t=Nt(),o=(t==null?void 0:t.mode)==="dark"?{bgcolor:"grey.800"}:{};return{grid:g.jsxs(ge,{sx:{borderRadius:2,overflow:"hidden"},children:[g.jsx(To,{variant:"text",width:"100%",height:60,sx:o}),Array.from({length:10}).map((i,a)=>g.jsx(ge,{sx:{display:"flex",alignItems:"center",padding:"0.5rem",gap:"3rem"},children:Array.from({length:5}).map((l,c)=>g.jsx(ge,{sx:{flex:1},children:g.jsx(To,{variant:"text",height:45,sx:o})},c))},a))]}),toolbar:g.jsx(g.Fragment,{children:g.jsxs(dt,{direction:"row",justifyContent:"space-between",sx:{display:"flex",gap:"1rem"},children:[g.jsxs(dt,{direction:"row",gap:"1rem",children:[g.jsx(To,{variant:"text",width:"10.2rem",height:"5rem",sx:o}),g.jsx(To,{variant:"text",width:"3.5rem",height:"5rem",sx:o}),g.jsx(To,{variant:"text",width:"15.2rem",height:"5rem",sx:o})]}),g.jsxs(dt,{direction:"row",gap:"1rem",children:[g.jsx(To,{variant:"text",width:"10.2rem",height:"5rem",sx:o}),g.jsx(To,{variant:"text",width:"3.5rem",height:"5rem",sx:o}),g.jsx(To,{variant:"text",width:"3.5rem",height:"5rem",sx:o})]})]})})}[e]},b7=e=>{if(!e)return null;const{options:t,...n}=e,o=t?"select":"button",r={button:i=>g.jsx(hr,{...i}),select:i=>{var a;return g.jsx(ge,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"},width:(a=i.styles)==null?void 0:a.width},children:g.jsx(s1,{...i,options:t})})}};return r[o]?r[o](n):null},v7=({presentSetting:e,gridSetting:t,gridPath:n})=>{var a;if(!n)return e;const o=n.split("/").filter(Boolean),r=(a=t==null?void 0:t.grid)==null?void 0:a.map(({id:l,isHidden:c,isSortable:u,key:d,sequenceId:f})=>({id:l,isHidden:c,isSortable:u,key:d,sequenceId:f}));let i=e;for(let l=0;l<o.length;l++){const c=o[l];l===o.length-1?i[c]={columns:r,pageSize:(t==null?void 0:t.pageSize)??null}:(i[c]=i[c]||{},i=i[c])}return{settingObject:e,defaultUserSettings:r}},x7=async({baseUrl:e,gridSetting:t,gridPath:n})=>{try{const o=JSON.parse(localStorage.getItem("settings")),{settingObject:r,defaultUserSettings:i}=v7({presentSetting:o,gridSetting:t,gridPath:n});return localStorage.setItem("settings",JSON.stringify(r)),await Nc({baseUrl:e,payload:r}),i}catch(o){console.error(o)}},w7=({customTools:e})=>{var o,r;const t=(o=e==null?void 0:e.filter(i=>(i==null?void 0:i.type)===Y1.PRIMARY))==null?void 0:o.sort((i,a)=>i.sequenceId-a.sequenceId),n=(r=e==null?void 0:e.filter(i=>(i==null?void 0:i.type)===Y1.SECONDARY))==null?void 0:r.sort((i,a)=>i.sequenceId-a.sequenceId);return{primaryButtons:t,secondaryButtons:n}},ow=({customTools:e,isExpanded:t,setIsExpanded:n})=>{const{primaryButtons:o,secondaryButtons:r}=w7({customTools:e}),[i,a]=R.useState(o),l=(r==null?void 0:r.length)>0,c=d=>{d?a([...o,...r]):setTimeout(()=>{a(o)},100)},u=()=>{const d=!t;n(d),c(d)};return R.useEffect(()=>{c(t)},[e]),g.jsxs(g.Fragment,{children:[t&&g.jsx("div",{style:{position:"fixed",left:0,width:"100vw",height:"4rem",zIndex:998}}),g.jsxs(ge,{sx:{display:"flex",alignItems:"center",gap:"0.8rem",flexWrap:"nowrap",maxWidth:"100%",whiteSpace:"nowrap",zIndex:999},children:[g.jsx(K3,{mode:"popLayout",children:i.map(d=>g.jsx(Ki.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},layout:!0,children:g.jsx(ge,{sx:{flexShrink:0,minWidth:"fit-content"},children:b7(d)})},d.id))}),l&&g.jsx(ge,{sx:{paddingLeft:t?"0.5rem":0},children:g.jsx(hr,{label:t?"":"More Actions",styles:{icon:t?nt.CrossWhite:nt.More,colorType:t?"danger":""},onClick:u})})]})]})};ow.propTypes={customTools:s.array.isRequired};const rw=({defaultTools:e,isManageable:t,customTools:n,baseUrl:o,gridPath:r,managableColumns:i=[],pageSize:a})=>{var b,x,T,w,O,v;const l=R.useContext(ba),{visibleGridColumns:c,triggerApi:u}=R.useContext(ya),[d,f]=R.useState([]),[p,m]=R.useState(!1);R.useEffect(()=>{if(i.length){const E=i.length?c.filter(k=>i.includes(k.id)):c;f(E)}},[i,c]);const y=async E=>{try{await x7({baseUrl:o,gridPath:r,gridSetting:{grid:E,pageSize:a}})}catch(k){console.error(k)}finally{l({type:He.HAS_SETTING_CHANGE,payload:{hasChange:!1}}),l({type:He.TRIGGER_API,payload:{triggerApi:!1}})}};R.useEffect(()=>{u&&y(c)},[u]);const h=E=>{const k=c.map(M=>d.some(j=>j.id===M.id)?{...M,isHidden:!E.some(j=>j.id===M.id)}:M);l({type:He.SET_GRID_DATA,payload:{visibleGridColumns:k}}),l({type:He.HAS_SETTING_CHANGE,payload:{hasChange:!0}})};return g.jsxs(ge,{sx:{margin:"1rem 0",position:"relative",zIndex:10,display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"0.6rem",width:"100%"},children:[g.jsxs(ge,{sx:{display:"flex",flexDirection:"row",gap:"0.6rem"},children:[((b=e==null?void 0:e.search)==null?void 0:b.isRequired)&&g.jsx(n1,{...e==null?void 0:e.search}),((x=e==null?void 0:e.groupBy)==null?void 0:x.isRequired)&&g.jsx(ge,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:g.jsx(wc,{styles:{icon:nt.Group},...e.groupBy})}),((T=e==null?void 0:e.refresh)==null?void 0:T.isRequired)&&g.jsx(hr,{...e==null?void 0:e.refresh,styles:{variant:"filled",icon:nt.Refresh,colorType:"empty",width:"3.2rem",height:"3.2rem"}}),t&&g.jsx(ge,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:g.jsx(wc,{placeholder:"Manage Columns",options:d,value:d.filter(E=>!E.isHidden),isMulti:!0,isDraggable:!0,showSearch:!0,onChange:h,styles:{icon:nt.Manage}})})]}),g.jsxs(ge,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",gap:"0.6rem"},children:[n&&g.jsx(ow,{customTools:n,setIsExpanded:m,isExpanded:p}),((w=e==null?void 0:e.save)==null?void 0:w.isRequired)&&g.jsx(ge,{sx:{px:"0.5rem"},children:g.jsx(hr,{label:p?"":"Save",styles:{icon:nt.Save,colorType:"empty"},...e==null?void 0:e.save})}),((O=e==null?void 0:e.upload)==null?void 0:O.isRequired)&&g.jsx(hr,{...e==null?void 0:e.upload,styles:{variant:p?"outlined":"filled",icon:p?nt.UploadDark:nt.Upload,colorType:"secondary",isAnimate:!0}}),((v=e==null?void 0:e.download)==null?void 0:v.isRequired)&&g.jsx(hr,{...e==null?void 0:e.download,styles:{variant:"outlined",icon:nt.Download,isAnimate:!0}})]})]})};rw.propTypes={defaultTools:s.object.isRequired,customTools:s.array,isManageable:s.bool,baseUrl:s.string,gridPath:s.gridPath};function Np({tableProps:e,toolbarProps:t,isDefaultConfig:n,isLoading:o}){var i,a;const r=(i=e.columns)==null?void 0:i.isManageable;return g.jsx(r1,{children:o?g.jsxs(g.Fragment,{children:[g.jsx(nw,{type:"toolbar"}),g.jsx(nw,{type:"grid"})]}):g.jsxs(g.Fragment,{children:[t&&g.jsx(rw,{...t,isManageable:r,pageSize:(a=e==null?void 0:e.pagination)==null?void 0:a.rowPerPage}),g.jsx(tw,{tableProps:e,isDefaultConfig:n,gridPath:(t==null?void 0:t.gridPath)||"",baseUrl:(t==null?void 0:t.baseUrl)||""})]})})}Np.propTypes={tableProps:s.object.isRequired,toolbarProps:s.object,isDefaultConfig:s.bool};const sw=({list:e,handleLinkClick:t})=>{const n=Nt(),o=({list:r})=>{var i;return(i=r==null?void 0:r.sort((a,l)=>a.order-l.order))==null?void 0:i.map((a,l)=>a!=null&&a.link?g.jsx(_o,{component:"h3",sx:{fontSize:"1rem",cursor:"pointer",color:l===(r==null?void 0:r.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):g.jsx(et,{component:"h3",sx:{fontSize:"1rem",color:l===(r==null?void 0:r.length)-1?n.palette.brandColor.orange:n.palette.primary.notifyTextColor},children:a==null?void 0:a.title},l))};return g.jsx($g,{separator:g.jsx(ge,{component:"img",src:nt.ArrowRight}),children:o({list:e})})};sw.propTypes={list:s.array.isRequired,handleLinkClick:s.func};const iw=({breadcrumbProps:e,switchProps:t,filterComponentProps:n})=>{var r,i,a,l,c,u;const o=Nt();return g.jsxs(g.Fragment,{children:[g.jsxs(dt,{sx:{background:o.palette.primary.notifyBackground,borderBottom:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,height:"3rem",p:"0px 5.5rem 0 1.5rem",zIndex:4,position:"relative"},direction:"row",justifyContent:"space-between",alignItems:"center",children:[g.jsx(sw,{...e}),g.jsxs(dt,{direction:"row",gap:"1rem",alignItems:"center",children:[t&&g.jsx(c1,{...t}),(n==null?void 0:n.filterBtnProps)&&g.jsxs(dt,{direction:"row",children:[g.jsx(bi,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"2rem!important",opacity:"1!important",borderColor:o.palette.primary.notifyBorderColor}}),g.jsxs(dt,{direction:"row",alignItems:"center",gap:"0.5rem",onClick:(r=n==null?void 0:n.filterBtnProps)==null?void 0:r.onFilterClick,sx:{cursor:"pointer"},children:[g.jsx(ge,{component:"img",src:o.icons.filter}),g.jsx(et,{sx:{fontSize:"1.1rem",color:o.palette.primary.notifyActiveText},children:(i=n==null?void 0:n.filterBtnProps)==null?void 0:i.label})]})]})]})]}),g.jsx(Ki.div,{layout:!0,initial:{height:"0rem"},animate:{height:(a=n==null?void 0:n.filterBtnProps)!=null&&a.filterContainerVisible?"5rem":"0rem",opacity:(l=n==null?void 0:n.filterBtnProps)!=null&&l.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"},children:g.jsxs(dt,{sx:{background:o.palette.primary.appBackground,height:"3.8rem",p:"0 2rem",width:"100%",borderRadius:"0.7rem",overflow:"visible"},direction:"row",alignItems:"center",children:[g.jsx(et,{sx:{fontSize:"1.2rem",fontWeight:"500",color:o.palette.primary.notifyActiveText},children:"Filters:"}),g.jsx(ge,{sx:{overflowX:"auto",overflowY:"visible",whiteSpace:"nowrap",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},margin:"0 1rem",padding:"0.5rem 0",flexGrow:1},children:g.jsx(dt,{direction:"row",gap:"1.2rem",sx:{overflow:"visible"},children:(c=n==null?void 0:n.filterItems)==null?void 0:c.map((d,f)=>g.jsx(g.Fragment,{children:g.jsxs(ge,{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:[g.jsx(ge,{component:"img",src:nt.FilterClose,sx:{position:"absolute",top:"-0.4rem",right:"-0.6rem",cursor:"pointer"},onClick:()=>n==null?void 0:n.onFilterChipClose(d)}),g.jsx(et,{sx:{fontSize:"1rem",color:o.palette.primary.notifyTextColor},children:d==null?void 0:d.filterLabel})]},f)}))})}),g.jsx(ge,{component:et,sx:{fontSize:"1.1rem",fontWeight:"500",textDecoration:"underline",color:o.palette.brandColor.red,cursor:"pointer"},onClick:(u=n==null?void 0:n.filterContainerProps)==null?void 0:u.onClearClick,children:"Clear"})]})})]})};iw.propTypes={breadcrumbProps:s.object.isRequired,switchProps:s.object};function aw({headerProps:e}){return g.jsx(_n,{children:g.jsx(iw,{...e})})}aw.propTypes={headerProps:s.object.isRequired};const $p=R.createContext(null),lw=R.createContext(null);function C7({children:e}){const[t,n]=R.useReducer(S7,T7);return g.jsx($p.Provider,{value:t,children:g.jsx(lw.Provider,{value:n,children:e})})}function S7(e,t){var n;switch(t.type){case He.LOADING:return{...e,loading:t.loading};case He.SUCCESS:return{...e,data:(n=t.data)==null?void 0:n.sort((o,r)=>new Date(r.createdAt)-new Date(o.createdAt))};case He.MARK_ALL_AS_READ:return{...e,isMarkAllAsRead:t.isMarkAllAsRead};case He.ERROR:return{...e,error:t.error};default:throw new Error(`${Yo.UNHANDLED}: ${t}`)}}const T7={loading:!1,data:[],error:"",isMarkAllAsRead:{count:0,boo:!1}},{TENANT_ID:_p,BU_ID:Fp,SNOP_ID:cw}=Pp,{TENANT_IDS:Bp,BU_IDS:Lp}=Tr,O7=async e=>{try{const t=`${e}${jc.NOTIFICATION}/v1?${_p}=${Bp}&${Fp}=${Lp}`;return await St.get(t,Sa)}catch(t){return t}},uw=async(e,t,n)=>{try{const o=n===q1.MARK_ALL_READ?"":`&${cw}=${n}&`,r=`${e}${jc.NOTIFICATION}${Ep.VERSION}?${_p}=${Bp}&${Fp}=${Lp}${o}`;return await St.put(r,t,Sa)}catch(o){return o}},E7=async({baseUrl:e,id:t,snopId:n})=>{try{const o=`${e}${jc.NOTIFICATION}${Ep.VERSION}?${_p}=${Bp}&${Fp}=${Lp}&${cw}=${n}&id=${t}`;return await St.get(o,Sa)}catch(o){return o}},_c={OK:200,CREATED:201,NO_CONTENT:204,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,INTERNAL_SERVER_ERROR:500},dw=({baseUrl:e})=>{const t=R.useContext(lw),[n,o]=R.useState(!1),[r,i]=R.useState(!1),[a,l]=R.useState(!1),[c,u]=R.useState({}),[d,f]=R.useState(null),[p,m]=R.useState(1),[y,h]=R.useState(!1),[b,x]=R.useState(0),{loading:T,data:w,isMarkAllAsRead:O}=R.useContext($p),[v,E]=R.useState([]);R.useEffect(()=>{E(w)},[w]);const k=R.useCallback(async()=>{var $,_;try{t({type:He.LOADING,loading:!0}),t({type:He.SUCCESS,data:[]});const P=await O7(e);if(P.status===_c.OK){const L=((_=($=P.data)==null?void 0:$.responseData)==null?void 0:_.response)||[],W=xc(L);t({type:He.SUCCESS,data:xc(W)}),t({type:He.MARK_ALL_AS_READ,isMarkAllAsRead:{count:o1(L),boo:o1(L)>0}})}}catch{t({type:He.ERROR,error:Yo.SWR})}finally{t({type:He.LOADING,loading:!1})}},[e,t]);R.useEffect(()=>{k();const $=setInterval(k,3e5);return()=>clearInterval($)},[k]);const M=async($,_)=>{var P,L,W;if($){f($);try{const D=await E7({baseUrl:e,id:$,snopId:_});if(D.status===_c.OK){const N=((W=(L=(P=D.data)==null?void 0:P.responseData)==null?void 0:L.response)==null?void 0:W[0])||{};u(N||{}),l(!0)}else throw new Error}catch{t({type:He.ERROR,error:Yo.SWR})}finally{f(null)}}},I=async($,_)=>{if($.length){t({type:He.LOADING,loading:!0});try{if((await uw(e,$,_)).status===_c.OK){const L=w.map(D=>$.includes(D.id)?{...D,isRead:!0}:D),W=L.filter(D=>!D.isRead).length;t({type:He.SUCCESS,data:xc(L)}),t({type:He.MARK_ALL_AS_READ,isMarkAllAsRead:{count:W,boo:W>0}}),setTimeout(()=>{t({type:He.LOADING,loading:!1})},200)}}catch{t({type:He.ERROR,error:Yo.SWR}),t({type:He.LOADING,loading:!1})}}},j=async()=>{t({type:He.LOADING,loading:!0});try{const $=aV(w);if((await uw(e,$,q1.MARK_ALL_READ)).status===_c.OK){const P=w.map(L=>({...L,isRead:!0}));t({type:He.SUCCESS,data:xc(P)}),t({type:He.MARK_ALL_AS_READ,isMarkAllAsRead:{count:0,boo:!1}}),setTimeout(()=>{t({type:He.LOADING,loading:!1})},200)}}catch{t({type:He.ERROR,error:Yo.SWR}),t({type:He.LOADING,loading:!1})}},F=($,_)=>{t({type:He.LOADING,loading:!0}),x(_),setTimeout(()=>{t({type:He.LOADING,loading:!1})},400)},A=$=>{const _=$||w||[];return{0:_,1:_.filter(P=>(P==null?void 0:P.type)==="INFO"),2:_.filter(P=>(P==null?void 0:P.type)==="ERROR")}},V=()=>{t({type:He.LOADING,loading:!0});const $=!y,_=$?(v||[]).filter(P=>!P.isRead):w||[];h($),E(_),m(1),setTimeout(()=>{t({type:He.LOADING,loading:!1})},400)};return{fetchNotification:k,showDetailsProps:{open:a,handleClose:()=>l(!1),setOpen:l,data:c,clickId:d},alertDialogProps:{open:n,handleClose:()=>o(!1),onRefresh:k,handleRead:I,handleMarkAllAsRead:j,setOpen:o,handleShowDetails:M,clickId:d,isMainDialog:!0},activeTab:b,loading:T,tabData:A(v)[b],data:v,mode:y,handleTabChange:F,toggleAlertMode:V,page:p,setPage:m}};var fw,pw,hw,mw;function Vp(){return Vp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Vp.apply(null,arguments)}var k7=function(t){return C.createElement("svg",Vp({xmlns:"http://www.w3.org/2000/svg",width:16,height:18,fill:"none"},t),fw||(fw=C.createElement("path",{stroke:"#666D80",strokeLinecap:"round",strokeMiterlimit:10,d:"M8.013 3.44c-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.373V7.44c0-2.2-1.8-4-4-4Z"})),pw||(pw=C.createElement("path",{stroke:"#666D80",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10,d:"M9.247 3.633a4.503 4.503 0 0 0-2.467 0 1.324 1.324 0 0 1 2.467 0"})),hw||(hw=C.createElement("path",{stroke:"#666D80",strokeMiterlimit:10,d:"M10.014 14.207c0 1.1-.9 2-2 2a2.007 2.007 0 0 1-2-2"})),mw||(mw=C.createElement("circle",{cx:12.266,cy:3,r:2.5,fill:"#E85353",stroke:"#F8FAFB"})))};const P7=({count:e})=>(Nt(),g.jsxs(g.Fragment,{children:[g.jsx(ge,{sx:{gap:"0.5rem",display:"flex",justifyContent:"center",alignItems:"center","& svg":{transform:"scale(1)"}},children:g.jsx(k7,{style:{scale:2}})}),g.jsx(h7,{badgeContent:e==0?"":null,color:"error"})]}));function gw({children:e,handleClose:t,open:n,isMainDialog:o}){return g.jsx(Ol,{open:n,onClose:t,...o?{scroll:"paper",PaperProps:{sx:{position:"fixed",top:30,right:30,m:0,width:400,height:450,display:"flex",flexDirection:"column",borderRadius:2,boxShadow:6,backgroundColor:r=>r.palette.primary.notifyBackground}}}:{fullWidth:!0,maxWidth:"md",sx:{"& .MuiPaper-root":{minHeight:250,maxHeight:500,borderRadius:"1.5rem",boxShadow:6,backgroundColor:r=>r.palette.primary.appBackground}}},children:e})}var yw;function Wp(){return Wp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Wp.apply(null,arguments)}var M7=function(t){return C.createElement("svg",Wp({xmlns:"http://www.w3.org/2000/svg",width:14,height:9,fill:"none",viewBox:"0 0 13 9"},t),yw||(yw=C.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"})))},bw,vw;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 o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},zp.apply(null,arguments)}var R7=function(t){return C.createElement("svg",zp({xmlns:"http://www.w3.org/2000/svg",width:12,height:12,fill:"none"},t),bw||(bw=C.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"})),vw||(vw=C.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"})))},xw;function Up(){return Up=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Up.apply(null,arguments)}var D7=function(t){return C.createElement("svg",Up({xmlns:"http://www.w3.org/2000/svg",width:9,height:8,fill:"none"},t),xw||(xw=C.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 ww=({type:e,item:t,handleShowDetails:n,handleRead:o,handleCTAClicked:r,clickId:i})=>{var c,u;const a=Nt(),l=(u=(c=JSON.parse(localStorage.getItem("settings")))==null?void 0:c.platform)==null?void 0:u.theme;return g.jsxs(ge,{className:"cards",sx:{pt:" 0.8rem"},children:[g.jsx(dt,{display:"flex",flexDirection:"row",alignItems:"start",justifyContent:"space-between",gap:1,children:g.jsx(ed,{sx:{width:"calc(100% - 2%)","& .MuiBadge-badge":{backgroundColor:"#6041EA",height:"0.5rem",minWidth:"0.5rem"}},variant:"dot",className:"badge",invisible:t==null?void 0:t.isRead,children:g.jsx(Or,{sx:{color:a.palette.primary.notifyActiveText},component:"p",className:["title-card",(t==null?void 0:t.isRead)&&"read"].join(" "),children:t==null?void 0:t.message})})}),g.jsx(dt,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:g.jsxs(dt,{display:"flex",flexDirection:"row",justifyContent:"start",gap:1,sx:{p:"0.5rem 0"},children:[(t==null?void 0:t.isNotificationDetails)&&g.jsx($c,{icon:g.jsx(R7,{className:`${l==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:n,label:i===(t==null?void 0:t.id)?g.jsx(Tl,{color:"primary",size:13}):"Show Details",component:"button",variant:"filled",clickable:!0,size:"small",sx:{backgroundColor:a.palette.brandColor.orange,color:a.palette.brandColor.white}}),!(t!=null&&t.isRead)&&g.jsx($c,{icon:g.jsx(D7,{className:`${l==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:o,label:"Acknowledge",component:"button",variant:"outlined",clickable:!0,size:"small"}),(t==null?void 0:t.primaryCTAURL)&&g.jsx($c,{disabled:t==null?void 0:t.isPrimaryCTAClicked,onClick:()=>r({redirect:t==null?void 0:t.isPrimaryCTARedirect,isClicked:t==null?void 0:t.isPrimaryCTAClicked,url:t==null?void 0:t.primaryCTAURL}),label:t==null?void 0:t.primaryCTALabel,component:"button",variant:"outlined",clickable:!0,size:"small"}),(t==null?void 0:t.secondaryCTAURL)&&g.jsx($c,{disabled:t==null?void 0:t.isSecondaryCTAClicked,onClick:()=>r({redirect:t==null?void 0:t.isSecondaryCTARedirect,isClicked:t==null?void 0:t.isSecondaryCTAClicked,url:t==null?void 0:t.secondaryCTAURL}),label:t==null?void 0:t.secondaryCTALabel,component:"button",variant:"outlined",clickable:!0,size:"small"})]})}),g.jsxs(dt,{display:"flex",flexDirection:"row",alignItems:"center",gap:.35,children:[g.jsx(Or,{sx:{fontSize:"0.8rem"},children:t==null?void 0:t.product}),g.jsx(Or,{color:a.palette.primary.notifyTextColor,children:"•"}),g.jsx(Or,{sx:{fontSize:"0.8rem"},children:iV(t==null?void 0:t.createdAt)})]})]})};ww.propTypes={type:s.string,title:s.string,subTitle:s.string,isRead:s.bool,handleShowDetails:s.func,handleRead:s.func};const Cw=({data:e,handleRead:t,handleShowDetails:n,clickId:o,mode:r,page:i,setPage:a})=>{const{isMarkAllAsRead:l}=R.useContext($p),c=new Date,u=new Intl.DateTimeFormat("en-US",{day:"numeric",month:"long",year:"numeric"}).format(c),[d,f]=R.useState([]),[p,m]=R.useState(!1),[y,h]=R.useState(!0),b=R.useRef(null),x=async w=>{m(!0);const O=e.slice((w-1)*10,w*10);await new Promise(v=>setTimeout(v,1e3)),f(v=>{const E=O.filter(k=>!v.some(M=>M.id===k.id));return[...v,...E]}),m(!1),(d==null?void 0:d.length)>=(e==null?void 0:e.length)&&h(!1)};R.useEffect(()=>{var O;let w=[];r?l!=null&&l.count?w=(O=e==null?void 0:e.filter(v=>!v.isRead))==null?void 0:O.slice(0,10):w=[]:w=e.slice(0,10),(w==null?void 0:w.length)<10&&h(!1),f(w)},[e,r,l]),R.useEffect(()=>{y&&i!==1&&x(i)},[i,e]),R.useEffect(()=>{f([...e])},[e]),R.useEffect(()=>{const w=new IntersectionObserver(O=>{O[0].isIntersecting&&!p&&y&&a(v=>v+1)},{threshold:1});return b.current&&w.observe(b.current),()=>{b.current&&w.unobserve(b.current)}},[p,y]);const T=({redirect:w,isClicked:O,url:v})=>{window.open(v,"_blank")};return g.jsxs(ge,{sx:{width:"100%"},children:[Object.entries(lV(d)).map(([w,O])=>g.jsxs(R.Fragment,{children:[w!==u&&g.jsx(p7,{children:w}),O.map((v,E)=>g.jsx(R.Fragment,{children:g.jsx(ww,{item:v,handleCTAClicked:T,handleShowDetails:()=>n(v.id,v.snopId),handleRead:()=>t([v.id],v.snopId),clickId:o})},`${E}_${v.id}`))]},w)),p&&i>1&&!!(d!=null&&d.length)&&g.jsx(ge,{sx:{display:"flex",justifyContent:"center",alignItems:"center",pl:"0.5rem",py:"0.3rem"},children:g.jsx(Tl,{size:20,sx:{color:w=>w.palette.primary.notifyIconColor}})}),!(d!=null&&d.length)&&g.jsx(et,{sx:{fontSize:"1.1rem",color:w=>w.palette.primary.notifyTextColor,textAlign:"center",px:"0.8rem"},children:"You don't have any unread notification here. Use the toggle to switch between read and unread notification."}),g.jsx(ge,{ref:b,style:{height:"0.1rem",backgroundColor:"transparent"}})]})};Cw.propTypes={data:s.array,handleRead:s.func,handleShowDetails:s.func};const I7=({onRefresh:e,handleShowDetails:t,clickId:n,handleRead:o,handleMarkAllAsRead:r})=>{var y,h,b,x;const{loading:i,activeTab:a,data:l,tabData:c,mode:u,page:d,setPage:f,handleTabChange:p,toggleAlertMode:m}=dw({});return g.jsxs(g.Fragment,{children:[g.jsxs(ge,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,pt:2},children:[g.jsx(et,{variant:"h2",sx:{fontSize:"1.2rem",color:T=>T.palette.primary.notifyTextColor},children:"Notifications"}),g.jsx(ge,{component:"img",src:nt.Refresh,alt:"refresh",onClick:e,sx:{cursor:"pointer"}})]}),g.jsx(ge,{sx:{borderBottom:1,m:"1.2rem 1.2rem 0 1.2rem",borderColor:T=>T.palette.primary.notifyBorderColor},children:g.jsxs(m7,{value:a,onChange:p,children:[g.jsx(jp,{label:g.jsxs(ge,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:["All (",g.jsx(et,{component:"span",sx:{fontWeight:"500",fontSize:"1rem"},children:((y=l==null?void 0:l.filter(T=>!(T!=null&&T.isRead)))==null?void 0:y.length)||0}),")"]})}),g.jsx(jp,{label:g.jsxs(ge,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:["Info (",g.jsx(et,{component:"span",sx:{fontWeight:"500",fontSize:"1rem"},children:((h=l==null?void 0:l.filter(T=>(T==null?void 0:T.type)==="INFO"&&!(T!=null&&T.isRead)))==null?void 0:h.length)||0}),")"]}),sx:{color:T=>T.palette.brandColor.blue}}),g.jsx(jp,{label:g.jsxs(ge,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:["Error (",g.jsx(et,{component:"span",sx:{fontWeight:"500",fontSize:"1rem"},children:((b=l==null?void 0:l.filter(T=>(T==null?void 0:T.type)==="ERROR"&&!(T!=null&&T.isRead)))==null?void 0:b.length)||0}),")"]}),sx:{color:T=>T.palette.brandColor.red}})]})}),g.jsx(kl,{dividers:!0,sx:{p:0,...i&&!c.length&&{alignItems:"center",justifyContent:"center"},flexGrow:1,overflowY:"auto",mx:"1.2rem",borderColor:T=>T.palette.primary.notifyBorderColor},tabIndex:-1,children:i?g.jsx(Tl,{size:30,sx:{color:T=>T.palette.primary.notifyIconColor}}):g.jsx(g.Fragment,{children:g.jsx(Cw,{data:c,handleShowDetails:t,handleRead:o,clickId:n,page:d,setPage:f,mode:u})})}),g.jsxs(El,{sx:{justifyContent:"space-between",px:"1.2rem"},children:[g.jsxs(dt,{direction:"row",gap:1,children:[g.jsx(Or,{sx:{fontSize:"1rem"},children:"Only show unread"}),g.jsx(f7,{disabled:i,checked:u,onChange:m})]}),g.jsx(Un,{variant:"outlined",className:"view-all",onClick:r,startIcon:g.jsx(M7,{}),disabled:!((x=l==null?void 0:l.filter(T=>!(T!=null&&T.isRead)))!=null&&x.length),style:{backgroundColor:"transparent"},sx:{fontSize:"1rem",fontWeight:"300",p:0,border:"none",textTransform:"none",color:T=>T.palette.primary.notifyTextColor,"&:hover":{color:T=>T.palette.primary.notifyActiveText,background:"transparent",boxShadow:"none",border:"none"},"&.Mui-disabled":{opacity:.5,color:T=>`${T.palette.primary.notifyActiveText}!important`,background:"transparent",boxShadow:"none",border:"none"}},children:"Mark all as read"})]})]})},A7=({data:e,handleClose:t})=>{var T;const[n,o]=R.useState(1),[r,i]=R.useState(10),[a,l]=R.useState(((T=e==null?void 0:e.notificationDetails)==null?void 0:T.length)||0),[c,u]=R.useState("sku_name"),[d,f]=R.useState("asc"),[p,m]=R.useState(""),y=["sku_name","node","channel_name"],h=R.useMemo(()=>!(e!=null&&e.notificationDetails)||!y.length?[]:p.trim()?e.notificationDetails.filter(w=>y.some(O=>{var v;return(v=w[O])==null?void 0:v.toString().toLowerCase().includes(p.toLowerCase())})):e.notificationDetails,[e,p,y]),b=R.useMemo(()=>c?[...h].sort((w,O)=>{const v=w[c],E=O[c];return v==null?1:E==null?-1:typeof v=="number"&&typeof E=="number"?d==="asc"?v-E:E-v:!isNaN(Date.parse(v))&&!isNaN(Date.parse(E))?d==="asc"?new Date(v).getTime()-new Date(E).getTime():new Date(E).getTime()-new Date(v).getTime():d==="asc"?v.toString().localeCompare(E.toString()):E.toString().localeCompare(v.toString())}):h,[h,c,d]),x=R.useMemo(()=>{const w=(n-1)*r,O=w+r;return b.slice(w,O)},[b,n,r]);return console.log({paginatedData:x}),g.jsxs(g.Fragment,{children:[g.jsxs(dt,{direction:"row",justifyContent:"space-between",sx:{padding:"1.5rem 2rem",borderBottom:"0.1rem solid",borderColor:w=>w.palette.primary.notifyBorderColor},children:[g.jsx(et,{component:"h2",sx:{fontSize:"1.4rem",color:w=>w.palette.primary.notifyActiveText},children:(e==null?void 0:e.message)||""}),g.jsx(ge,{component:"img",src:nt.CloseCircle,onClick:t,sx:{cursor:"pointer"}})]}),g.jsx(kl,{children:g.jsx(Np,{tableProps:{data:x,columns:{...u7(),isManageable:!1},sort:{sortField:c,sortDir:d,onSort:w=>{var v;const O=(v=w==null?void 0:w.column)==null?void 0:v.key;f(E=>c===O&&E==="asc"?"desc":"asc"),u(O)}},pagination:{selectedPage:n,rowPerPage:r,totalRecords:a,onPageChange:w=>{o(w)},onPageSizeChange:w=>{i(w==null?void 0:w.value),o(1)}}},toolbarProps:{defaultTools:{search:{isRequired:!0,onChange:w=>{m(w.target.value)},placeholder:"Search..."}}}})}),g.jsx(El,{sx:{padding:"1.5rem 2rem"}})]})},j7=({baseUrl:e})=>{const{alertDialogProps:t,showDetailsProps:n,fetchNotification:o}=dw({baseUrl:e});return g.jsxs(g.Fragment,{children:[g.jsx(ge,{sx:{display:"flex",justifyContent:"center",cursor:"pointer",marginTop:"0.6rem"},onClick:()=>{var r;o(),(r=t==null?void 0:t.setOpen)==null||r.call(t,!0)},children:g.jsx(P7,{count:0})}),g.jsx(gw,{...t,children:g.jsx(I7,{...t})}),g.jsx(gw,{...n,children:g.jsx(A7,{...n})})]})},N7=({baseUrl:e})=>g.jsx(_n,{children:g.jsx(C7,{children:g.jsx(j7,{baseUrl:e})})}),$7=({rightChild:e,leftChild:t,isDrawerMerged:n,isDrawerOpen:o,drawerTitle:r,showExpand:i,onCloseClick:a,onMergeClick:l,onExpandClick:c,isDrawerExpanded:u,styles:d,showMerge:f})=>{const p=Nt();return g.jsx(ge,{sx:{position:"relative",overflow:"hidden"},children:g.jsxs(ar,{container:!0,sx:{height:"100%"},children:[g.jsx(ar,{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}),o&&!n&&g.jsxs(g.Fragment,{children:[g.jsx(ge,{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"}}),g.jsx(ge,{onClick:a,sx:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"transparent",zIndex:4}})]}),e&&g.jsxs(ar,{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:o?"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:[g.jsxs(dt,{direction:"row",alignItems:"center",sx:{width:"100%",flexShrink:0,paddingBottom:"0.8rem",px:2,pt:"0.8rem",borderBottom:m=>`0.1rem solid ${m.palette.primary.notifyBorderColor}`},children:[!u&&f&&g.jsxs(g.Fragment,{children:[g.jsx(ge,{sx:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer"},onClick:l,children:g.jsx(ge,{component:"img",src:nt.Merge})}),g.jsx(bi,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"auto!important",borderColor:p.palette.primary.notifyBorderColor}})]}),g.jsxs(dt,{direction:"row",justifyContent:"space-between",alignItems:"center",flexGrow:1,children:[g.jsxs(dt,{direction:"row",gap:"0.5rem",alignItems:"center",onClick:a,sx:{cursor:"pointer"},children:[g.jsx(ge,{component:"img",src:p.icons.close}),g.jsx(et,{sx:{fontSize:"1.2rem",color:p.palette.primary.notifyTextColor},children:r})]}),g.jsx(dt,{direction:"row",gap:"0.5rem",alignItems:"center",children:i&&g.jsx(ge,{onClick:c,sx:{cursor:"pointer"},children:g.jsx(ge,{component:"img",src:u?nt.Collapse:nt.Expand})})})]})]}),g.jsx(ge,{sx:{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},overflow:"auto",px:2},children:e})]})]})})},Sw=({layoutChildren:e,layoutProps:t})=>g.jsx(_n,{children:g.jsx($7,{...e,...t})});Sw.propTypes={layoutChildren:s.object.isRequired,layoutProps:s.object.isRequired},vt.Button=hr,vt.Checkbox=oc,vt.DatePicker=rV,vt.Grid=Np,vt.Header=aw,vt.InputField=n1,vt.Loader=MV,vt.Notification=N7,vt.Select=s1,vt.SliderLayout=Sw,vt.Switch=c1,vt.TextField=bc,vt.ToastProvider=TV,vt.toast=xV,Object.defineProperty(vt,Symbol.toStringTag,{value:"Module"})});
326
+ `+i):o.stack=i}catch{}}throw o}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Cr(this.defaults,n);const{transitional:o,paramsSerializer:r,headers:i}=n;o!==void 0&&Ic.assertOptions(o,{silentJSONParsing:mo.transitional(mo.boolean),forcedJSONParsing:mo.transitional(mo.boolean),clarifyTimeoutError:mo.transitional(mo.boolean)},!1),r!=null&&(ee.isFunction(r)?n.paramsSerializer={serialize:r}:Ic.assertOptions(r,{encode:mo.function,serialize:mo.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Ic.assertOptions(n,{baseUrl:mo.spelling("baseURL"),withXsrfToken:mo.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&ee.merge(i.common,i[n.method]);i&&ee.forEach(["delete","get","head","post","put","patch","common"],y=>{delete i[y]}),n.headers=mn.concat(a,i);const l=[];let c=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(n)===!1||(c=c&&h.synchronous,l.unshift(h.fulfilled,h.rejected))});const u=[];this.interceptors.response.forEach(function(h){u.push(h.fulfilled,h.rejected)});let d,f=0,p;if(!c){const y=[W1.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 m=n;for(f=0;f<p;){const y=l[f++],h=l[f++];try{m=y(m)}catch(b){h.call(this,b);break}}try{d=W1.call(this,m)}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=Cr(this.defaults,t);const n=A1(t.baseURL,t.url,t.allowAbsoluteUrls);return T1(n,t.params,t.paramsSerializer)}};ee.forEach(["delete","get","head","options"],function(t){Sr.prototype[t]=function(n,o){return this.request(Cr(o||{},{method:t,url:n,data:(o||{}).data}))}}),ee.forEach(["post","put","patch"],function(t){function n(o){return function(i,a,l){return this.request(Cr(l||{},{method:t,headers:o?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}Sr.prototype[t]=n(),Sr.prototype[t+"Form"]=n(!0)});let X8=class Ow{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 o=this;this.promise.then(r=>{if(!o._listeners)return;let i=o._listeners.length;for(;i-- >0;)o._listeners[i](r);o._listeners=null}),this.promise.then=r=>{let i;const a=new Promise(l=>{o.subscribe(l),i=l}).then(r);return a.cancel=function(){o.unsubscribe(i)},a},t(function(i,a,l){o.reason||(o.reason=new Is(i,a,l),n(o.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=o=>{t.abort(o)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Ow(function(r){t=r}),cancel:t}}};function Z8(e){return function(n){return e.apply(null,n)}}function J8(e){return ee.isObject(e)&&e.isAxiosError===!0}const Op={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(Op).forEach(([e,t])=>{Op[t]=e});function H1(e){const t=new Sr(e),n=u1(Sr.prototype.request,t);return ee.extend(n,Sr.prototype,t,{allOwnKeys:!0}),ee.extend(n,t,null,{allOwnKeys:!0}),n.create=function(r){return H1(Cr(e,r))},n}const St=H1(wa);St.Axios=Sr,St.CanceledError=Is,St.CancelToken=X8,St.isCancel=M1,St.VERSION=z1,St.toFormData=Ec,St.AxiosError=ze,St.Cancel=St.CanceledError,St.all=function(t){return Promise.all(t)},St.spread=Z8,St.isAxiosError=J8,St.mergeConfig=Cr,St.AxiosHeaders=mn,St.formToJSON=e=>k1(ee.isHTMLForm(e)?new FormData(e):e),St.getAdapter=V1.getAdapter,St.HttpStatusCode=Op,St.default=St;const{Axios:jW,AxiosError:NW,CanceledError:$W,isCancel:_W,CancelToken:FW,VERSION:BW,all:LW,Cancel:VW,isAxiosError:WW,spread:zW,toFormData:UW,AxiosHeaders:HW,HttpStatusCode:qW,formToJSON:YW,getAdapter:GW,mergeConfig:KW}=St,Ep={BASE_URL:"https://qa.3sc.ai/api",VERSION:"/v1"};/*! js-cookie v3.0.5 | MIT */function Ac(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}var Q8={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 kp(e,t){function n(r,i,a){if(!(typeof document>"u")){a=Ac({},t,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),r=encodeURIComponent(r).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=r+"="+e.write(i,r)+l}}function o(r){if(!(typeof document>"u"||arguments.length&&!r)){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),r===d)break}catch{}}return r?a[r]:a}}return Object.create({set:n,get:o,remove:function(r,i){n(r,"",Ac({},i,{expires:-1}))},withAttributes:function(r){return kp(this.converter,Ac({},this.attributes,r))},withConverter:function(r){return kp(Ac({},this.converter,r),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var e7=kp(Q8,{path:"/"});const Go={TOKEN:"token",USER:"user",SNOP:"snop",SELECTED_BU:"selected_business_unit",SETTINGS:"settings"},Pp={BEARER:"Bearer",TENANT_ID:"tenant_id",BU_ID:"bu_id",SNOP_ID:"snop_id"},t7=[10,25,50,100],q1={MARK_ALL_READ:"MARK_ALL_READ"},n7=t7.map(e=>({label:e,value:e})),Y1={PRIMARY:"PRIMARY",SECONDARY:"SECONDARY"},Mp=vc(Go.SNOP),Rp=vc(Go.SELECTED_BU),Dp=vc(Go.USER),o7=vc(Go.SETTINGS),Tr={BU_IDS:Rp==null?void 0:Rp.business_unit_id,TOKEN:JSON.parse(e7.get(Go.TOKEN)||null),TENANT_IDS:Dp==null?void 0:Dp.tenant_id,SNOP_IDS:Mp==null?void 0:Mp.snop_id,GRID_SETTINGS:o7},Sa={headers:{"Content-Type":"application/json",Authorization:`${Pp.BEARER} ${Tr.TOKEN}`}},G1=St.create({baseURL:Ep.BASE_URL,axiosConfig:Sa});G1.interceptors.request.use(function(e){return e},function(e){return Promise.reject(e)}),G1.interceptors.response.use(function(e){return e},function(e){return Promise.reject(e)});const jc={NOTIFICATION:"/notifications",SETTING:"/configuration/setting"},{TENANT_ID:r7,BU_ID:s7}=Pp,{TENANT_IDS:i7,BU_IDS:a7}=Tr,Nc=async({baseUrl:e,payload:t})=>{try{const n=`${e}${jc.SETTING}/v1?${r7}=${i7}&${s7}=${a7}`;return await St.post(n,t,Sa)}catch(n){return n}},l7=({columns:e,gridPath:t,baseUrl:n,isDefaultConfig:o,pageSize:r})=>{var y;let{definitions:i,defaultUserSettings:a,labels:l}=e;const c=t.split("/").filter(Boolean);let u=c.reduce((h,b)=>h==null?void 0:h[b],Tr.GRID_SETTINGS)||null;o||!u&&!a&&(async()=>{try{a=K1({definitions:i});let h=Tr.GRID_SETTINGS||{platform:{theme:"light"}};const b=(u==null?void 0:u.pageSize)??r;let x=h;for(let T=0;T<c.length;T++){const w=c[T];T===c.length-1?x[w]={columns:a,pageSize:b}:(x[w]=x[w]||{},x=x[w])}localStorage.setItem(Go.SETTINGS,JSON.stringify(h)),await Nc({baseUrl:n,payload:h})}catch(h){console.error(h)}})(),a=(u==null?void 0:u.columns)??a??K1({definitions:i});const d=a.reduce((h,b)=>(h[b.id]=b,h),{}),f=l.reduce((h,b)=>(h[b.id]=b,h),{}),p=[];for(const h of i){const b=d[h.id]||{},x=f[h.id]||{};let T={...h,...b,...x};if((y=h.children)!=null&&y.length){const w=b.children||[],O=x.children||[];T.children=h.children.map((v,E)=>({...v,...w[E],...O[E]}))}p.push(T)}return p.sort((h,b)=>h.sequenceId-b.sequenceId)},c7=e=>e.sort((t,n)=>t.sequenceId-n.sequenceId),K1=({definitions:e})=>e.map((t,n)=>({id:t.id,key:t.key,sequenceId:t.id,isHidden:!1,style:t.style||{}})),u7=()=>({definitions:[{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}],defaultUserSettings:[{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"}}],labels:[{id:1,key:"sku_name",label:"SKU",isLocalizable:!1},{id:2,key:"node",label:"Node",isLocalizable:!1},{id:3,key:"channel_name",label:"Channel",isLocalizable:!1}]});class Ip extends R.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=R.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,o=this.startPos-this.mouseX;let r=this.startWidthPrev-o;(!this.props.minWidth||r>=this.props.minWidth)&&(!this.props.maxWidth||r<=this.props.maxWidth)&&(n.previousSibling.style.width=r+"px",n.previousSibling.style.minWidth=r+"px",n.previousSibling.style.maxWidth=r+"px",n.previousSibling.style.setProperty("--column_resize_before_width",r+"px"),this.lastDraggedWidth=r)}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)"),R.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})}}Ip.defaultProps={disabled:!1,minWidth:0,className:""},Ip.propTypes={disabled:"boolean",minWidth:"number",className:"string"};const d7=(e,t,n,o)=>{const[r,i]=R.useState({isOpen:!1,column:null}),a=(u,d)=>{i({isOpen:u.currentTarget,column:d})},l=()=>{i({isOpen:!1,column:null})};return{selectedColumn:r,handleMenuClick:a,handleClose:l,handleHideClick:async()=>{l();const u=e.map(f=>{var p;return f.id===((p=r==null?void 0:r.column)==null?void 0:p.id)?{...f,isHidden:!0}:f});t({type:He.SET_GRID_DATA,payload:{visibleGridColumns:u}});let d=Tr.GRID_SETTINGS||{platform:{theme:"light"},grid:{}};d.grid=d.grid||{},d.grid[o]=u,localStorage.setItem(Go.SETTINGS,JSON.stringify(d)),await Nc({baseUrl:n,payload:d})}}},X1=({pagination:e})=>{const{selectedPage:t,rowPerPage:n,totalRecords:o,onPageChange:r,onPageSizeChange:i}=e,a=Nt();return g.jsxs(ge,{sx:{display:"flex",p:"1rem 2rem"},children:[g.jsxs(ge,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"0.5rem",width:"100%"},children:[g.jsx(et,{sx:{fontSize:"1.1rem",color:a.palette.primary.notifyTextColor},children:`Showing ${(t-1)*n+1} to ${Math.min(t*n,o)} of ${o} rows`}),g.jsx(ge,{sx:{"& .MuiInputBase-input":{padding:"0rem 0.8rem!important"},width:"6rem"},children:g.jsx(wc,{options:n7,value:n,onChange:i})}),g.jsx(et,{sx:{fontSize:"1.1rem",color:a.palette.primary.notifyTextColor},children:"records per page"})]}),g.jsx(x0,{count:Math.ceil(o/n),page:t,onChange:(l,c)=>{r(c)},shape:"rounded",sx:{width:"100%","& .MuiPagination-ul":{width:"100%",display:"flex",justifyContent:"flex-end","& li:first-of-type":{border:`0.1rem solid ${a.palette.primary.notifyBorderColor}`,color:a.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 ${a.palette.primary.notifyBorderColor}`,color:a.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:a.palette.primary.notifyActiveText,backgroundColor:`${a.palette.brandColor.paginationBc} !important`}}})]})};X1.propTypes={pagination:s.object.isRequired};function Ap({isRenderCellContent:e,column:t,row:n,parent:o}){const r=n[t.key];return g.jsx(g.Fragment,{children:e?g.jsx(ge,{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:o})}):g.jsx(M0,{title:(r==null?void 0:r.length)>20?r:"",arrow:!0,children:g.jsx(ge,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem"},component:"label",children:cV(r)})})})}Ap.propTypes={isRenderCellContent:s.bool,column:s.object,row:s.object};const Z1=({menuOpen:e,handleClose:t,onHideClick:n})=>{const o=Nt();return g.jsx(Ti,{open:!!e,anchorEl:e,onClose:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:g.jsx(ge,{sx:{p:"0.4rem 1rem",backgroundColor:o.palette.primary.notifyBackground,border:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,minHeight:"2.3rem",display:"flex",justifyContent:"center",alignItems:"center"},children:g.jsx(Un,{onClick:n,sx:{textTransform:"none",fontSize:"1.1rem",p:0,minHeight:"unset",fontWeight:"500",color:o.palette.primary.notifyTextColor},children:"Hide Column"})})})};Z1.propTypes={menuOpen:s.object,handleClose:s.func,onHideClick:s.func},H(Ol)(({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 Or=H(et)(({theme:e})=>({color:e.palette.primary.notifyTextColor,fontSize:"1.1rem"})),f7=H(R0)(({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)"})}})),p7=H(bi)(({theme:e})=>({color:e.palette.primary.notifyTextColor,padding:"0.6rem 0",fontSize:"0.9rem",fontWeight:500,"&::before, &::after":{borderColor:`${e.palette.primary.notifyBorderColor}!important`}})),h7=H(ed)(({theme:e})=>({"& .MuiBadge-badge":{right:3.5,top:2.34,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"}}));H($l)(({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 m7=H(K0)(({theme:e})=>({minHeight:"2rem","& .MuiTabs-indicator":{height:"0.1rem",backgroundColor:e.palette.primary.notifyActiveText}})),jp=H(D0)(({theme:e})=>({color:e.palette.primary.notifyActiveText,textTransform:"none",fontWeight:"normal",padding:0,fontSize:"1rem",minHeight:"2rem","&.Mui-selected":{fontWeight:"bold",color:e.palette.primary.notifyActiveText}})),$c=H(Zu)(({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`}})),J1=({sortKey:e,sortField:t,sortDir:n,handleSortClick:o})=>{const r=i=>g.jsx(Do,{onClick:o,sx:{padding:"0.5rem"},children:g.jsx(ge,{component:"img",src:i})});return g.jsx(g.Fragment,{children:r(t===e?n==="asc"?nt.AscSort:nt.DescSort:nt.Unsort)})};J1.propTypes={sortKey:s.string.isRequired,sortField:s.string,sortDir:s.string,handleSortClick:s.func};function Q1({parent:e,column:t,sort:n,handleMenuClick:o,isManageable:r}){const i=t==null?void 0:t.isMandatory,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 g.jsxs(ge,{sx:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.1rem",textAlign:"center",whiteSpace:"normal"},children:[a,g.jsxs(ge,{sx:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[l&&g.jsx(J1,{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})}),r&&!i&&g.jsx(Do,{onClick:f=>o(f,t),sx:{padding:"0.5rem"},children:g.jsx(ge,{component:"img",src:nt.Menu})})]})]})}Q1.propTypes={column:s.object.isRequired,sort:s.object.isRequired,handleMenuClick:s.func,isManageable:s.bool};const g7=H($0)(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"table-cell",[`&.${yd.head}`]:{color:e.palette.primary.notifyTextColor,backgroundColor:e.palette.primary.notifyBackground,borderColor:e.palette.primary.notifyBorderColor,padding:"0.3rem 1rem",textAlign:"center"},[`&.${yd.body}`]:{color:e.palette.primary.notifyTextColor,borderColor:e.palette.primary.notifyBorderColor,padding:"0.3rem 1rem",textAlign:"center"}}));function As({children:e,...t}){return g.jsx(g7,{...t,children:e})}As.propTypes={children:s.node};const y7=H(W0)(()=>({"&:last-child td":{borderBottom:0}}));function js({children:e,...t}){return g.jsx(y7,{...t,children:e})}js.propTypes={children:s.node};function ew({rows:e,sort:t,data:n,pagination:o,columns:r,nested:i,baseUrl:a,gridPath:l}){var W;const c=Nt(),{visibleGridColumns:u}=R.useContext(ya),d=R.useContext(ba),{selectedColumn:f,handleMenuClick:p,handleClose:m,handleHideClick:y}=d7(u,d,a,l),h=r==null?void 0:r.isManageable,b=(n==null?void 0:n.length)>0,x=R.useRef(null),[T,w]=R.useState(null);let O=null;const v=R.useRef(0),E=c7(((W=i==null?void 0:i.column)==null?void 0:W.definitions)||[]),k=i==null?void 0:i.isNested,M=(i==null?void 0:i.data)||[],I=i==null?void 0:i.hashKey;if(!b)return g.jsx(Or,{sx:{textAlign:"center"},children:Yo.NRF});const j=(D,N)=>{w(N),D.dataTransfer.setData("colIndex",N)},F=D=>{D.preventDefault(),V(D)},A=async(D,N)=>{if(D.preventDefault(),clearInterval(O),T===null||T===N)return;const B=[...u],[Y]=B.splice(T,1);B.splice(N,0,Y);const Z=u.slice().sort((oe,X)=>oe.sequenceId-X.sequenceId).map(oe=>oe.sequenceId),q=B.map((oe,X)=>({...oe,sequenceId:Z[X]??oe.sequenceId})),Q={...Tr.GRID_SETTINGS||{platform:{theme:"light"}}},G=l.split("/").filter(Boolean);let ne=Q;for(let oe=0;oe<G.length;oe++){const X=G[oe];if(oe===G.length-1){const re=(o==null?void 0:o.rowPerPage)??null;ne[X]={columns:q,pageSize:re}}else ne[X]=ne[X]||{},ne=ne[X]}localStorage.setItem(Go.SETTINGS,JSON.stringify(Q)),d({type:He.SET_GRID_DATA,payload:{visibleGridColumns:q}}),await Nc({baseUrl:a,payload:Q}),w(null)},V=D=>{const N=x.current,{left:B,right:Y}=N.getBoundingClientRect(),Z=50,q=D.clientX>Y-Z?1:D.clientX<B+Z?-1:0;q!==0?(clearInterval(O),O=setInterval(()=>{N.scrollLeft+=q*10},50)):clearInterval(O)},$=(D,N,B,Y)=>{var G,ne,oe;const Z=(D==null?void 0:D.isMandatory)&&(D==null?void 0:D.isSticky),q=parseFloat((ne=(G=D==null?void 0:D.style)==null?void 0:G.minWidth)==null?void 0:ne.toString().replace("rem",""))||7.5;N===0&&(v.current=0);const Q=Z?N===0?0:`${v.current}rem`:void 0;return Z&&(v.current+=q),g.jsx(As,{rowSpan:D!=null&&D.children?1:2,colSpan:(oe=D==null?void 0:D.children)==null?void 0:oe.length,style:D==null?void 0:D.style,draggable:B&&!Y&&!(D!=null&&D.isMandatory),onDragStart:B?X=>j(X,N):void 0,onDragOver:B?F:void 0,onDrop:B?X=>A(X,N):void 0,sx:{...Z&&{borderRadius:"0rem!important",position:"sticky",left:Q,zIndex:3},...D!=null&&D.children||Y?{borderRadius:"0rem!important",borderRight:X=>`0.1rem solid ${X.palette.primary.notifyBorderColor}`}:{borderLeft:X=>(D==null?void 0:D.key)==="volume_value"&&`0.1rem solid ${X.palette.primary.notifyBorderColor}`,borderRight:X=>(D==null?void 0:D.key)==="volume_value"&&`0.1rem solid ${X.palette.primary.notifyBorderColor}`}},children:g.jsx(Q1,{parent:Y,column:D,sort:t,handleMenuClick:p,isManageable:B})},N)},_=(D,N,B,Y)=>!(D!=null&&D.isMandatory)&&B?g.jsx(ge,{component:Ip,id:N,sx:{width:"4rem",maxWidth:"4rem",minWidth:"4rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${c.palette.primary.notifyBorderColor}`,"&::after":{content:'""',position:"absolute",left:"50%",top:"50%",transform:"translate(0%, -50%)",width:"0.2rem",height:"50%",background:c.palette.primary.notifyBorderColor}},disabled:!B}):null,P=(D,N,B,Y)=>{var G,ne,oe;const Z=(D==null?void 0:D.isMandatory)&&(D==null?void 0:D.isSticky),q=parseFloat((ne=(G=D==null?void 0:D.style)==null?void 0:G.minWidth)==null?void 0:ne.toString().replace("rem",""))||7.5;B===0&&(v.current=0);const Q=Z?B===0?0:`${v.current}rem`:void 0;return Z&&(v.current+=q),g.jsxs(As,{style:D==null?void 0:D.style,className:`${D==null?void 0:D.label}`,sx:{position:"relative",...Z&&{position:"sticky",left:Q,zIndex:2,backgroundColor:X=>{var re;return e&&((re=e==null?void 0:e.selectedRow)==null?void 0:re.fhi)===(N==null?void 0:N.fhi)||N!=null&&N.isHigh?X.palette.primary.appBackground:X.palette.primary.notifyBackground}},...Y?{p:"0rem!important",borderRight:X=>`0.1rem solid ${X.palette.primary.notifyBorderColor}`}:{px:"0rem!important",borderLeft:X=>(D==null?void 0:D.key)==="volume_value"&&`0.1rem solid ${X.palette.primary.notifyBorderColor}`,borderRight:X=>(D==null?void 0:D.key)==="volume_value"&&`0.1rem solid ${X.palette.primary.notifyBorderColor}`}},children:[(e&&((oe=e==null?void 0:e.selectedRow)==null?void 0:oe.fhi)===(N==null?void 0:N.fhi)||(N==null?void 0:N.isHigh))&&g.jsx(ge,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.05rem",background:"linear-gradient(#F9B16E, #F68080)"}}),g.jsx(Ap,{isRenderCellContent:!!(D!=null&&D.cellRenderer),column:D,row:N,parent:Y})]},B)},L=(D,N,B,Y)=>!(D!=null&&D.isMandatory)&&B?g.jsx(As,{className:"column_resizer_body"},`resize-${N}`):null;return g.jsxs(g.Fragment,{children:[g.jsx(_0,{sx:{maxHeight:"100%",whiteSpace:"nowrap",overflow:"auto",width:"100%",border:`0.1rem solid ${c.palette.primary.notifyBorderColor}`,borderRadius:"1.4rem"},children:g.jsxs(A0,{ref:x,stickyHeader:!0,"aria-label":"sticky table",sx:{backgroundColor:D=>D.palette.primary.notifyBackground},children:[g.jsxs(B0,{children:[g.jsx(js,{children:u.map((D,N)=>D!=null&&D.isHidden?null:g.jsxs(R.Fragment,{children:[$(D,N,h),(r==null?void 0:r.isResizable)&&_(D,N,h)]},N))}),g.jsx(js,{children:u.flatMap((D,N)=>D!=null&&D.isHidden||!(D!=null&&D.children)?[]:D.children.map((B,Y)=>g.jsxs(R.Fragment,{children:[$(B,Y,h,D),(r==null?void 0:r.isResizable)&&_(B,Y,h)]},`${N}-${Y}`)))})]}),g.jsx(N0,{children:n.map((D,N)=>{const B=D[I],Y=M==null?void 0:M[B],Z=(Y==null?void 0:Y.length)>0;return g.jsxs(R.Fragment,{children:[g.jsx(js,{sx:{backgroundColor:q=>{var Q;return e&&((Q=e==null?void 0:e.selectedRow)==null?void 0:Q.fhi)===(D==null?void 0:D.fhi)||D!=null&&D.isHigh?q.palette.primary.appBackground:q.palette.primary.notifyBackground}},onClick:()=>e==null?void 0:e.onRowClick(D),children:u.map((q,Q)=>q!=null&&q.isHidden?null:q!=null&&q.children?q.children.map((G,ne)=>g.jsxs(R.Fragment,{children:[P(G,D,ne,q),(r==null?void 0:r.isResizable)&&L(G,ne,h)]},`${Q}-${ne}`)):g.jsxs(R.Fragment,{children:[P(q,D,Q),(r==null?void 0:r.isResizable)&&L(q,Q,h)]},Q))}),k&&Y&&g.jsx(g.Fragment,{children:Z?Y.map((q,Q)=>g.jsx(js,{children:E.map((G,ne)=>g.jsx(As,{style:G==null?void 0:G.style,children:g.jsx(Ap,{isRenderCellContent:!!(G!=null&&G.cellRenderer),column:G,row:q})},ne))},`nested-${Q}`)):g.jsx(js,{children:g.jsx(As,{colSpan:E.length,children:g.jsx(Or,{sx:{textAlign:"center"},children:Yo.NRF})})})})]},N)})})]})}),o&&g.jsx(X1,{pagination:o}),g.jsx(Z1,{menuOpen:f==null?void 0:f.isOpen,handleClose:m,onHideClick:y})]})}ew.propTypes={sort:s.object,data:s.array,pagination:s.object,columns:s.object,nested:s.object};function tw({tableProps:e,isDefaultConfig:t,gridPath:n,baseUrl:o}){var u;const{columns:r}=e,{visibleGridColumns:i=[]}=R.useContext(ya)??{},a=R.useContext(ba),l=R.useMemo(()=>{var d;return l7({columns:r,gridPath:n,baseUrl:o,isDefaultConfig:t,pageSize:(d=e==null?void 0:e.pagination)==null?void 0:d.rowPerPage})},[r,n,o,t,(u=e==null?void 0:e.pagination)==null?void 0:u.rowPerPage]),c=R.useMemo(()=>{const d=new Map(i.map(f=>[f.key,f]));return l.map(f=>{const p=d.get(f.key);return{...f,...p&&{isHidden:p.isHidden,sequenceId:p.sequenceId}}})},[l,i]);return R.useEffect(()=>{a({type:He.SET_GRID_DATA,payload:{visibleGridColumns:i.length?c:l}})},[l]),g.jsx(ew,{...e,gridPath:n,baseUrl:o})}tw.propTypes={tableProps:s.object.isRequired,mergedColumns:s.array.isRequired};const nw=({type:e})=>{const t=Nt(),o=(t==null?void 0:t.mode)==="dark"?{bgcolor:"grey.800"}:{};return{grid:g.jsxs(ge,{sx:{borderRadius:2,overflow:"hidden"},children:[g.jsx(To,{variant:"text",width:"100%",height:60,sx:o}),Array.from({length:10}).map((i,a)=>g.jsx(ge,{sx:{display:"flex",alignItems:"center",padding:"0.5rem",gap:"3rem"},children:Array.from({length:5}).map((l,c)=>g.jsx(ge,{sx:{flex:1},children:g.jsx(To,{variant:"text",height:45,sx:o})},c))},a))]}),toolbar:g.jsx(g.Fragment,{children:g.jsxs(dt,{direction:"row",justifyContent:"space-between",sx:{display:"flex",gap:"1rem"},children:[g.jsxs(dt,{direction:"row",gap:"1rem",children:[g.jsx(To,{variant:"text",width:"10.2rem",height:"5rem",sx:o}),g.jsx(To,{variant:"text",width:"3.5rem",height:"5rem",sx:o}),g.jsx(To,{variant:"text",width:"15.2rem",height:"5rem",sx:o})]}),g.jsxs(dt,{direction:"row",gap:"1rem",children:[g.jsx(To,{variant:"text",width:"10.2rem",height:"5rem",sx:o}),g.jsx(To,{variant:"text",width:"3.5rem",height:"5rem",sx:o}),g.jsx(To,{variant:"text",width:"3.5rem",height:"5rem",sx:o})]})]})})}[e]},b7=e=>{if(!e)return null;const{options:t,...n}=e,o=t?"select":"button",r={button:i=>g.jsx(hr,{...i}),select:i=>{var a;return g.jsx(ge,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"},width:(a=i.styles)==null?void 0:a.width},children:g.jsx(s1,{...i,options:t})})}};return r[o]?r[o](n):null},v7=({presentSetting:e,gridSetting:t,gridPath:n})=>{var a;if(!n)return e;const o=n.split("/").filter(Boolean),r=(a=t==null?void 0:t.grid)==null?void 0:a.map(({id:l,isHidden:c,isSortable:u,key:d,sequenceId:f})=>({id:l,isHidden:c,isSortable:u,key:d,sequenceId:f}));let i=e;for(let l=0;l<o.length;l++){const c=o[l];l===o.length-1?i[c]={columns:r,pageSize:(t==null?void 0:t.pageSize)??null}:(i[c]=i[c]||{},i=i[c])}return{settingObject:e,defaultUserSettings:r}},x7=async({baseUrl:e,gridSetting:t,gridPath:n})=>{try{const o=JSON.parse(localStorage.getItem("settings")),{settingObject:r,defaultUserSettings:i}=v7({presentSetting:o,gridSetting:t,gridPath:n});return localStorage.setItem("settings",JSON.stringify(r)),await Nc({baseUrl:e,payload:r}),i}catch(o){console.error(o)}},w7=({customTools:e})=>{var o,r;const t=(o=e==null?void 0:e.filter(i=>(i==null?void 0:i.type)===Y1.PRIMARY))==null?void 0:o.sort((i,a)=>i.sequenceId-a.sequenceId),n=(r=e==null?void 0:e.filter(i=>(i==null?void 0:i.type)===Y1.SECONDARY))==null?void 0:r.sort((i,a)=>i.sequenceId-a.sequenceId);return{primaryButtons:t,secondaryButtons:n}},ow=({customTools:e,isExpanded:t,setIsExpanded:n})=>{const{primaryButtons:o,secondaryButtons:r}=w7({customTools:e}),[i,a]=R.useState(o),l=(r==null?void 0:r.length)>0,c=d=>{d?a([...o,...r]):setTimeout(()=>{a(o)},100)},u=()=>{const d=!t;n(d),c(d)};return R.useEffect(()=>{c(t)},[e]),g.jsxs(g.Fragment,{children:[t&&g.jsx("div",{style:{position:"fixed",left:0,width:"100vw",height:"4rem",zIndex:998}}),g.jsxs(ge,{sx:{display:"flex",alignItems:"center",gap:"0.8rem",flexWrap:"nowrap",maxWidth:"100%",whiteSpace:"nowrap",zIndex:999},children:[g.jsx(K3,{mode:"popLayout",children:i.map((d,f)=>g.jsx(Ki.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},layout:!0,children:g.jsx(ge,{sx:{flexShrink:0,minWidth:"fit-content"},children:b7(d)})},`${d.id}_${f}`))}),l&&g.jsx(ge,{sx:{paddingLeft:t?"0.5rem":0},children:g.jsx(hr,{label:t?"":"More Actions",styles:{icon:t?nt.CrossWhite:nt.More,colorType:t?"danger":""},onClick:u})})]})]})};ow.propTypes={customTools:s.array.isRequired};const rw=({defaultTools:e,isManageable:t,customTools:n,baseUrl:o,gridPath:r,managableColumns:i=[],pageSize:a})=>{var b,x,T,w,O,v;const l=R.useContext(ba),{visibleGridColumns:c,triggerApi:u}=R.useContext(ya),[d,f]=R.useState([]),[p,m]=R.useState(!1);R.useEffect(()=>{if(i.length){const E=i.length?c.filter(k=>i.includes(k.id)):c;f(E)}},[i,c]);const y=async E=>{try{await x7({baseUrl:o,gridPath:r,gridSetting:{grid:E,pageSize:a}})}catch(k){console.error(k)}finally{l({type:He.HAS_SETTING_CHANGE,payload:{hasChange:!1}}),l({type:He.TRIGGER_API,payload:{triggerApi:!1}})}};R.useEffect(()=>{u&&y(c)},[u]);const h=E=>{const k=c.map(M=>d.some(j=>j.id===M.id)?{...M,isHidden:!E.some(j=>j.id===M.id)}:M);l({type:He.SET_GRID_DATA,payload:{visibleGridColumns:k}}),l({type:He.HAS_SETTING_CHANGE,payload:{hasChange:!0}})};return g.jsxs(ge,{sx:{margin:"1rem 0",position:"relative",zIndex:10,display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"0.6rem",width:"100%"},children:[g.jsxs(ge,{sx:{display:"flex",flexDirection:"row",gap:"0.6rem"},children:[((b=e==null?void 0:e.search)==null?void 0:b.isRequired)&&g.jsx(n1,{...e==null?void 0:e.search}),((x=e==null?void 0:e.groupBy)==null?void 0:x.isRequired)&&g.jsx(ge,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:g.jsx(wc,{styles:{icon:nt.Group},...e.groupBy})}),((T=e==null?void 0:e.refresh)==null?void 0:T.isRequired)&&g.jsx(hr,{...e==null?void 0:e.refresh,styles:{variant:"filled",icon:nt.Refresh,colorType:"empty",width:"3.2rem",height:"3.2rem"}}),t&&g.jsx(ge,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:g.jsx(wc,{placeholder:"Manage Columns",options:d,value:d.filter(E=>!E.isHidden),isMulti:!0,isDraggable:!0,showSearch:!0,onChange:h,styles:{icon:nt.Manage}})})]}),g.jsxs(ge,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",gap:"0.6rem"},children:[n&&g.jsx(ow,{customTools:n,setIsExpanded:m,isExpanded:p}),((w=e==null?void 0:e.save)==null?void 0:w.isRequired)&&g.jsx(ge,{sx:{px:"0.5rem"},children:g.jsx(hr,{label:p?"":"Save",styles:{icon:nt.Save,colorType:"empty"},...e==null?void 0:e.save})}),((O=e==null?void 0:e.upload)==null?void 0:O.isRequired)&&g.jsx(hr,{...e==null?void 0:e.upload,styles:{variant:p?"outlined":"filled",icon:p?nt.UploadDark:nt.Upload,colorType:"secondary",isAnimate:!0}}),((v=e==null?void 0:e.download)==null?void 0:v.isRequired)&&g.jsx(hr,{...e==null?void 0:e.download,styles:{variant:"outlined",icon:nt.Download,isAnimate:!0}})]})]})};rw.propTypes={defaultTools:s.object.isRequired,customTools:s.array,isManageable:s.bool,baseUrl:s.string,gridPath:s.gridPath};function Np({tableProps:e,toolbarProps:t,isDefaultConfig:n,isLoading:o}){var i,a;const r=(i=e.columns)==null?void 0:i.isManageable;return g.jsx(r1,{children:o?g.jsxs(g.Fragment,{children:[g.jsx(nw,{type:"toolbar"}),g.jsx(nw,{type:"grid"})]}):g.jsxs(g.Fragment,{children:[t&&g.jsx(rw,{...t,isManageable:r,pageSize:(a=e==null?void 0:e.pagination)==null?void 0:a.rowPerPage}),g.jsx(tw,{tableProps:e,isDefaultConfig:n,gridPath:(t==null?void 0:t.gridPath)||"",baseUrl:(t==null?void 0:t.baseUrl)||""})]})})}Np.propTypes={tableProps:s.object.isRequired,toolbarProps:s.object,isDefaultConfig:s.bool};const sw=({list:e,handleLinkClick:t})=>{const n=Nt(),o=({list:r})=>{var i;return(i=r==null?void 0:r.sort((a,l)=>a.order-l.order))==null?void 0:i.map((a,l)=>a!=null&&a.link?g.jsx(_o,{component:"h3",sx:{fontSize:"1rem",cursor:"pointer",color:l===(r==null?void 0:r.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):g.jsx(et,{component:"h3",sx:{fontSize:"1rem",color:l===(r==null?void 0:r.length)-1?n.palette.brandColor.orange:n.palette.primary.notifyTextColor},children:a==null?void 0:a.title},l))};return g.jsx($g,{separator:g.jsx(ge,{component:"img",src:nt.ArrowRight}),children:o({list:e})})};sw.propTypes={list:s.array.isRequired,handleLinkClick:s.func};const iw=({breadcrumbProps:e,switchProps:t,filterComponentProps:n})=>{var r,i,a,l,c,u;const o=Nt();return g.jsxs(g.Fragment,{children:[g.jsxs(dt,{sx:{background:o.palette.primary.notifyBackground,borderBottom:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,height:"3rem",p:"0px 5.5rem 0 1.5rem",zIndex:4,position:"relative"},direction:"row",justifyContent:"space-between",alignItems:"center",children:[g.jsx(sw,{...e}),g.jsxs(dt,{direction:"row",gap:"1rem",alignItems:"center",children:[t&&g.jsx(c1,{...t}),(n==null?void 0:n.filterBtnProps)&&g.jsxs(dt,{direction:"row",children:[g.jsx(bi,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"2rem!important",opacity:"1!important",borderColor:o.palette.primary.notifyBorderColor}}),g.jsxs(dt,{direction:"row",alignItems:"center",gap:"0.5rem",onClick:(r=n==null?void 0:n.filterBtnProps)==null?void 0:r.onFilterClick,sx:{cursor:"pointer"},children:[g.jsx(ge,{component:"img",src:o.icons.filter}),g.jsx(et,{sx:{fontSize:"1.1rem",color:o.palette.primary.notifyActiveText},children:(i=n==null?void 0:n.filterBtnProps)==null?void 0:i.label})]})]})]})]}),g.jsx(Ki.div,{layout:!0,initial:{height:"0rem"},animate:{height:(a=n==null?void 0:n.filterBtnProps)!=null&&a.filterContainerVisible?"5rem":"0rem",opacity:(l=n==null?void 0:n.filterBtnProps)!=null&&l.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"},children:g.jsxs(dt,{sx:{background:o.palette.primary.appBackground,height:"3.8rem",p:"0 2rem",width:"100%",borderRadius:"0.7rem",overflow:"visible"},direction:"row",alignItems:"center",children:[g.jsx(et,{sx:{fontSize:"1.2rem",fontWeight:"500",color:o.palette.primary.notifyActiveText},children:"Filters:"}),g.jsx(ge,{sx:{overflowX:"auto",overflowY:"visible",whiteSpace:"nowrap",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},margin:"0 1rem",padding:"0.5rem 0",flexGrow:1},children:g.jsx(dt,{direction:"row",gap:"1.2rem",sx:{overflow:"visible"},children:(c=n==null?void 0:n.filterItems)==null?void 0:c.map((d,f)=>g.jsx(g.Fragment,{children:g.jsxs(ge,{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:[g.jsx(ge,{component:"img",src:nt.FilterClose,sx:{position:"absolute",top:"-0.4rem",right:"-0.6rem",cursor:"pointer"},onClick:()=>n==null?void 0:n.onFilterChipClose(d)}),g.jsx(et,{sx:{fontSize:"1rem",color:o.palette.primary.notifyTextColor},children:d==null?void 0:d.filterLabel})]},f)}))})}),g.jsx(ge,{component:et,sx:{fontSize:"1.1rem",fontWeight:"500",textDecoration:"underline",color:o.palette.brandColor.red,cursor:"pointer"},onClick:(u=n==null?void 0:n.filterContainerProps)==null?void 0:u.onClearClick,children:"Clear"})]})})]})};iw.propTypes={breadcrumbProps:s.object.isRequired,switchProps:s.object};function aw({headerProps:e}){return g.jsx(_n,{children:g.jsx(iw,{...e})})}aw.propTypes={headerProps:s.object.isRequired};const $p=R.createContext(null),lw=R.createContext(null);function C7({children:e}){const[t,n]=R.useReducer(S7,T7);return g.jsx($p.Provider,{value:t,children:g.jsx(lw.Provider,{value:n,children:e})})}function S7(e,t){var n;switch(t.type){case He.LOADING:return{...e,loading:t.loading};case He.SUCCESS:return{...e,data:(n=t.data)==null?void 0:n.sort((o,r)=>new Date(r.createdAt)-new Date(o.createdAt))};case He.MARK_ALL_AS_READ:return{...e,isMarkAllAsRead:t.isMarkAllAsRead};case He.ERROR:return{...e,error:t.error};default:throw new Error(`${Yo.UNHANDLED}: ${t}`)}}const T7={loading:!1,data:[],error:"",isMarkAllAsRead:{count:0,boo:!1}},{TENANT_ID:_p,BU_ID:Fp,SNOP_ID:cw}=Pp,{TENANT_IDS:Bp,BU_IDS:Lp}=Tr,O7=async e=>{try{const t=`${e}${jc.NOTIFICATION}/v1?${_p}=${Bp}&${Fp}=${Lp}`;return await St.get(t,Sa)}catch(t){return t}},uw=async(e,t,n)=>{try{const o=n===q1.MARK_ALL_READ?"":`&${cw}=${n}&`,r=`${e}${jc.NOTIFICATION}${Ep.VERSION}?${_p}=${Bp}&${Fp}=${Lp}${o}`;return await St.put(r,t,Sa)}catch(o){return o}},E7=async({baseUrl:e,id:t,snopId:n})=>{try{const o=`${e}${jc.NOTIFICATION}${Ep.VERSION}?${_p}=${Bp}&${Fp}=${Lp}&${cw}=${n}&id=${t}`;return await St.get(o,Sa)}catch(o){return o}},_c={OK:200,CREATED:201,NO_CONTENT:204,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,INTERNAL_SERVER_ERROR:500},dw=({baseUrl:e})=>{const t=R.useContext(lw),[n,o]=R.useState(!1),[r,i]=R.useState(!1),[a,l]=R.useState(!1),[c,u]=R.useState({}),[d,f]=R.useState(null),[p,m]=R.useState(1),[y,h]=R.useState(!1),[b,x]=R.useState(0),{loading:T,data:w,isMarkAllAsRead:O}=R.useContext($p),[v,E]=R.useState([]);R.useEffect(()=>{E(w)},[w]);const k=R.useCallback(async()=>{var $,_;try{t({type:He.LOADING,loading:!0}),t({type:He.SUCCESS,data:[]});const P=await O7(e);if(P.status===_c.OK){const L=((_=($=P.data)==null?void 0:$.responseData)==null?void 0:_.response)||[],W=xc(L);t({type:He.SUCCESS,data:xc(W)}),t({type:He.MARK_ALL_AS_READ,isMarkAllAsRead:{count:o1(L),boo:o1(L)>0}})}}catch{t({type:He.ERROR,error:Yo.SWR})}finally{t({type:He.LOADING,loading:!1})}},[e,t]);R.useEffect(()=>{k();const $=setInterval(k,3e5);return()=>clearInterval($)},[k]);const M=async($,_)=>{var P,L,W;if($){f($);try{const D=await E7({baseUrl:e,id:$,snopId:_});if(D.status===_c.OK){const N=((W=(L=(P=D.data)==null?void 0:P.responseData)==null?void 0:L.response)==null?void 0:W[0])||{};u(N||{}),l(!0)}else throw new Error}catch{t({type:He.ERROR,error:Yo.SWR})}finally{f(null)}}},I=async($,_)=>{if($.length){t({type:He.LOADING,loading:!0});try{if((await uw(e,$,_)).status===_c.OK){const L=w.map(D=>$.includes(D.id)?{...D,isRead:!0}:D),W=L.filter(D=>!D.isRead).length;t({type:He.SUCCESS,data:xc(L)}),t({type:He.MARK_ALL_AS_READ,isMarkAllAsRead:{count:W,boo:W>0}}),setTimeout(()=>{t({type:He.LOADING,loading:!1})},200)}}catch{t({type:He.ERROR,error:Yo.SWR}),t({type:He.LOADING,loading:!1})}}},j=async()=>{t({type:He.LOADING,loading:!0});try{const $=aV(w);if((await uw(e,$,q1.MARK_ALL_READ)).status===_c.OK){const P=w.map(L=>({...L,isRead:!0}));t({type:He.SUCCESS,data:xc(P)}),t({type:He.MARK_ALL_AS_READ,isMarkAllAsRead:{count:0,boo:!1}}),setTimeout(()=>{t({type:He.LOADING,loading:!1})},200)}}catch{t({type:He.ERROR,error:Yo.SWR}),t({type:He.LOADING,loading:!1})}},F=($,_)=>{t({type:He.LOADING,loading:!0}),x(_),setTimeout(()=>{t({type:He.LOADING,loading:!1})},400)},A=$=>{const _=$||w||[];return{0:_,1:_.filter(P=>(P==null?void 0:P.type)==="INFO"),2:_.filter(P=>(P==null?void 0:P.type)==="ERROR")}},V=()=>{t({type:He.LOADING,loading:!0});const $=!y,_=$?(v||[]).filter(P=>!P.isRead):w||[];h($),E(_),m(1),setTimeout(()=>{t({type:He.LOADING,loading:!1})},400)};return{fetchNotification:k,showDetailsProps:{open:a,handleClose:()=>l(!1),setOpen:l,data:c,clickId:d},alertDialogProps:{open:n,handleClose:()=>o(!1),onRefresh:k,handleRead:I,handleMarkAllAsRead:j,setOpen:o,handleShowDetails:M,clickId:d,isMainDialog:!0},activeTab:b,loading:T,tabData:A(v)[b],data:v,mode:y,handleTabChange:F,toggleAlertMode:V,page:p,setPage:m}};var fw,pw,hw,mw;function Vp(){return Vp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Vp.apply(null,arguments)}var k7=function(t){return C.createElement("svg",Vp({xmlns:"http://www.w3.org/2000/svg",width:16,height:18,fill:"none"},t),fw||(fw=C.createElement("path",{stroke:"#666D80",strokeLinecap:"round",strokeMiterlimit:10,d:"M8.013 3.44c-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.373V7.44c0-2.2-1.8-4-4-4Z"})),pw||(pw=C.createElement("path",{stroke:"#666D80",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10,d:"M9.247 3.633a4.503 4.503 0 0 0-2.467 0 1.324 1.324 0 0 1 2.467 0"})),hw||(hw=C.createElement("path",{stroke:"#666D80",strokeMiterlimit:10,d:"M10.014 14.207c0 1.1-.9 2-2 2a2.007 2.007 0 0 1-2-2"})),mw||(mw=C.createElement("circle",{cx:12.266,cy:3,r:2.5,fill:"#E85353",stroke:"#F8FAFB"})))};const P7=({count:e})=>(Nt(),g.jsxs(g.Fragment,{children:[g.jsx(ge,{sx:{gap:"0.5rem",display:"flex",justifyContent:"center",alignItems:"center","& svg":{transform:"scale(1)"}},children:g.jsx(k7,{style:{scale:2}})}),g.jsx(h7,{badgeContent:e==0?"":null,color:"error"})]}));function gw({children:e,handleClose:t,open:n,isMainDialog:o}){return g.jsx(Ol,{open:n,onClose:t,...o?{scroll:"paper",PaperProps:{sx:{position:"fixed",top:30,right:30,m:0,width:400,height:450,display:"flex",flexDirection:"column",borderRadius:2,boxShadow:6,backgroundColor:r=>r.palette.primary.notifyBackground}}}:{fullWidth:!0,maxWidth:"md",sx:{"& .MuiPaper-root":{minHeight:250,maxHeight:500,borderRadius:"1.5rem",boxShadow:6,backgroundColor:r=>r.palette.primary.appBackground}}},children:e})}var yw;function Wp(){return Wp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Wp.apply(null,arguments)}var M7=function(t){return C.createElement("svg",Wp({xmlns:"http://www.w3.org/2000/svg",width:14,height:9,fill:"none",viewBox:"0 0 13 9"},t),yw||(yw=C.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"})))},bw,vw;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 o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},zp.apply(null,arguments)}var R7=function(t){return C.createElement("svg",zp({xmlns:"http://www.w3.org/2000/svg",width:12,height:12,fill:"none"},t),bw||(bw=C.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"})),vw||(vw=C.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"})))},xw;function Up(){return Up=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Up.apply(null,arguments)}var D7=function(t){return C.createElement("svg",Up({xmlns:"http://www.w3.org/2000/svg",width:9,height:8,fill:"none"},t),xw||(xw=C.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 ww=({type:e,item:t,handleShowDetails:n,handleRead:o,handleCTAClicked:r,clickId:i})=>{var c,u;const a=Nt(),l=(u=(c=JSON.parse(localStorage.getItem("settings")))==null?void 0:c.platform)==null?void 0:u.theme;return g.jsxs(ge,{className:"cards",sx:{pt:" 0.8rem"},children:[g.jsx(dt,{display:"flex",flexDirection:"row",alignItems:"start",justifyContent:"space-between",gap:1,children:g.jsx(ed,{sx:{width:"calc(100% - 2%)","& .MuiBadge-badge":{backgroundColor:"#6041EA",height:"0.5rem",minWidth:"0.5rem"}},variant:"dot",className:"badge",invisible:t==null?void 0:t.isRead,children:g.jsx(Or,{sx:{color:a.palette.primary.notifyActiveText},component:"p",className:["title-card",(t==null?void 0:t.isRead)&&"read"].join(" "),children:t==null?void 0:t.message})})}),g.jsx(dt,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:g.jsxs(dt,{display:"flex",flexDirection:"row",justifyContent:"start",gap:1,sx:{p:"0.5rem 0"},children:[(t==null?void 0:t.isNotificationDetails)&&g.jsx($c,{icon:g.jsx(R7,{className:`${l==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:n,label:i===(t==null?void 0:t.id)?g.jsx(Tl,{color:"primary",size:13}):"Show Details",component:"button",variant:"filled",clickable:!0,size:"small",sx:{backgroundColor:a.palette.brandColor.orange,color:a.palette.brandColor.white}}),!(t!=null&&t.isRead)&&g.jsx($c,{icon:g.jsx(D7,{className:`${l==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:o,label:"Acknowledge",component:"button",variant:"outlined",clickable:!0,size:"small"}),(t==null?void 0:t.primaryCTAURL)&&g.jsx($c,{disabled:t==null?void 0:t.isPrimaryCTAClicked,onClick:()=>r({redirect:t==null?void 0:t.isPrimaryCTARedirect,isClicked:t==null?void 0:t.isPrimaryCTAClicked,url:t==null?void 0:t.primaryCTAURL}),label:t==null?void 0:t.primaryCTALabel,component:"button",variant:"outlined",clickable:!0,size:"small"}),(t==null?void 0:t.secondaryCTAURL)&&g.jsx($c,{disabled:t==null?void 0:t.isSecondaryCTAClicked,onClick:()=>r({redirect:t==null?void 0:t.isSecondaryCTARedirect,isClicked:t==null?void 0:t.isSecondaryCTAClicked,url:t==null?void 0:t.secondaryCTAURL}),label:t==null?void 0:t.secondaryCTALabel,component:"button",variant:"outlined",clickable:!0,size:"small"})]})}),g.jsxs(dt,{display:"flex",flexDirection:"row",alignItems:"center",gap:.35,children:[g.jsx(Or,{sx:{fontSize:"0.8rem"},children:t==null?void 0:t.product}),g.jsx(Or,{color:a.palette.primary.notifyTextColor,children:"•"}),g.jsx(Or,{sx:{fontSize:"0.8rem"},children:iV(t==null?void 0:t.createdAt)})]})]})};ww.propTypes={type:s.string,title:s.string,subTitle:s.string,isRead:s.bool,handleShowDetails:s.func,handleRead:s.func};const Cw=({data:e,handleRead:t,handleShowDetails:n,clickId:o,mode:r,page:i,setPage:a})=>{const{isMarkAllAsRead:l}=R.useContext($p),c=new Date,u=new Intl.DateTimeFormat("en-US",{day:"numeric",month:"long",year:"numeric"}).format(c),[d,f]=R.useState([]),[p,m]=R.useState(!1),[y,h]=R.useState(!0),b=R.useRef(null),x=async w=>{m(!0);const O=e.slice((w-1)*10,w*10);await new Promise(v=>setTimeout(v,1e3)),f(v=>{const E=O.filter(k=>!v.some(M=>M.id===k.id));return[...v,...E]}),m(!1),(d==null?void 0:d.length)>=(e==null?void 0:e.length)&&h(!1)};R.useEffect(()=>{var O;let w=[];r?l!=null&&l.count?w=(O=e==null?void 0:e.filter(v=>!v.isRead))==null?void 0:O.slice(0,10):w=[]:w=e.slice(0,10),(w==null?void 0:w.length)<10&&h(!1),f(w)},[e,r,l]),R.useEffect(()=>{y&&i!==1&&x(i)},[i,e]),R.useEffect(()=>{f([...e])},[e]),R.useEffect(()=>{const w=new IntersectionObserver(O=>{O[0].isIntersecting&&!p&&y&&a(v=>v+1)},{threshold:1});return b.current&&w.observe(b.current),()=>{b.current&&w.unobserve(b.current)}},[p,y]);const T=({redirect:w,isClicked:O,url:v})=>{window.open(v,"_blank")};return g.jsxs(ge,{sx:{width:"100%"},children:[Object.entries(lV(d)).map(([w,O])=>g.jsxs(R.Fragment,{children:[w!==u&&g.jsx(p7,{children:w}),O.map((v,E)=>g.jsx(R.Fragment,{children:g.jsx(ww,{item:v,handleCTAClicked:T,handleShowDetails:()=>n(v.id,v.snopId),handleRead:()=>t([v.id],v.snopId),clickId:o})},`${E}_${v.id}`))]},w)),p&&i>1&&!!(d!=null&&d.length)&&g.jsx(ge,{sx:{display:"flex",justifyContent:"center",alignItems:"center",pl:"0.5rem",py:"0.3rem"},children:g.jsx(Tl,{size:20,sx:{color:w=>w.palette.primary.notifyIconColor}})}),!(d!=null&&d.length)&&g.jsx(et,{sx:{fontSize:"1.1rem",color:w=>w.palette.primary.notifyTextColor,textAlign:"center",px:"0.8rem"},children:"You don't have any unread notification here. Use the toggle to switch between read and unread notification."}),g.jsx(ge,{ref:b,style:{height:"0.1rem",backgroundColor:"transparent"}})]})};Cw.propTypes={data:s.array,handleRead:s.func,handleShowDetails:s.func};const I7=({onRefresh:e,handleShowDetails:t,clickId:n,handleRead:o,handleMarkAllAsRead:r})=>{var y,h,b,x;const{loading:i,activeTab:a,data:l,tabData:c,mode:u,page:d,setPage:f,handleTabChange:p,toggleAlertMode:m}=dw({});return g.jsxs(g.Fragment,{children:[g.jsxs(ge,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,pt:2},children:[g.jsx(et,{variant:"h2",sx:{fontSize:"1.2rem",color:T=>T.palette.primary.notifyTextColor},children:"Notifications"}),g.jsx(ge,{component:"img",src:nt.Refresh,alt:"refresh",onClick:e,sx:{cursor:"pointer"}})]}),g.jsx(ge,{sx:{borderBottom:1,m:"1.2rem 1.2rem 0 1.2rem",borderColor:T=>T.palette.primary.notifyBorderColor},children:g.jsxs(m7,{value:a,onChange:p,children:[g.jsx(jp,{label:g.jsxs(ge,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:["All (",g.jsx(et,{component:"span",sx:{fontWeight:"500",fontSize:"1rem"},children:((y=l==null?void 0:l.filter(T=>!(T!=null&&T.isRead)))==null?void 0:y.length)||0}),")"]})}),g.jsx(jp,{label:g.jsxs(ge,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:["Info (",g.jsx(et,{component:"span",sx:{fontWeight:"500",fontSize:"1rem"},children:((h=l==null?void 0:l.filter(T=>(T==null?void 0:T.type)==="INFO"&&!(T!=null&&T.isRead)))==null?void 0:h.length)||0}),")"]}),sx:{color:T=>T.palette.brandColor.blue}}),g.jsx(jp,{label:g.jsxs(ge,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:["Error (",g.jsx(et,{component:"span",sx:{fontWeight:"500",fontSize:"1rem"},children:((b=l==null?void 0:l.filter(T=>(T==null?void 0:T.type)==="ERROR"&&!(T!=null&&T.isRead)))==null?void 0:b.length)||0}),")"]}),sx:{color:T=>T.palette.brandColor.red}})]})}),g.jsx(kl,{dividers:!0,sx:{p:0,...i&&!c.length&&{alignItems:"center",justifyContent:"center"},flexGrow:1,overflowY:"auto",mx:"1.2rem",borderColor:T=>T.palette.primary.notifyBorderColor},tabIndex:-1,children:i?g.jsx(Tl,{size:30,sx:{color:T=>T.palette.primary.notifyIconColor}}):g.jsx(g.Fragment,{children:g.jsx(Cw,{data:c,handleShowDetails:t,handleRead:o,clickId:n,page:d,setPage:f,mode:u})})}),g.jsxs(El,{sx:{justifyContent:"space-between",px:"1.2rem"},children:[g.jsxs(dt,{direction:"row",gap:1,children:[g.jsx(Or,{sx:{fontSize:"1rem"},children:"Only show unread"}),g.jsx(f7,{disabled:i,checked:u,onChange:m})]}),g.jsx(Un,{variant:"outlined",className:"view-all",onClick:r,startIcon:g.jsx(M7,{}),disabled:!((x=l==null?void 0:l.filter(T=>!(T!=null&&T.isRead)))!=null&&x.length),style:{backgroundColor:"transparent"},sx:{fontSize:"1rem",fontWeight:"300",p:0,border:"none",textTransform:"none",color:T=>T.palette.primary.notifyTextColor,"&:hover":{color:T=>T.palette.primary.notifyActiveText,background:"transparent",boxShadow:"none",border:"none"},"&.Mui-disabled":{opacity:.5,color:T=>`${T.palette.primary.notifyActiveText}!important`,background:"transparent",boxShadow:"none",border:"none"}},children:"Mark all as read"})]})]})},A7=({data:e,handleClose:t})=>{var T;const[n,o]=R.useState(1),[r,i]=R.useState(10),[a,l]=R.useState(((T=e==null?void 0:e.notificationDetails)==null?void 0:T.length)||0),[c,u]=R.useState("sku_name"),[d,f]=R.useState("asc"),[p,m]=R.useState(""),y=["sku_name","node","channel_name"],h=R.useMemo(()=>!(e!=null&&e.notificationDetails)||!y.length?[]:p.trim()?e.notificationDetails.filter(w=>y.some(O=>{var v;return(v=w[O])==null?void 0:v.toString().toLowerCase().includes(p.toLowerCase())})):e.notificationDetails,[e,p,y]),b=R.useMemo(()=>c?[...h].sort((w,O)=>{const v=w[c],E=O[c];return v==null?1:E==null?-1:typeof v=="number"&&typeof E=="number"?d==="asc"?v-E:E-v:!isNaN(Date.parse(v))&&!isNaN(Date.parse(E))?d==="asc"?new Date(v).getTime()-new Date(E).getTime():new Date(E).getTime()-new Date(v).getTime():d==="asc"?v.toString().localeCompare(E.toString()):E.toString().localeCompare(v.toString())}):h,[h,c,d]),x=R.useMemo(()=>{const w=(n-1)*r,O=w+r;return b.slice(w,O)},[b,n,r]);return console.log({paginatedData:x}),g.jsxs(g.Fragment,{children:[g.jsxs(dt,{direction:"row",justifyContent:"space-between",sx:{padding:"1.5rem 2rem",borderBottom:"0.1rem solid",borderColor:w=>w.palette.primary.notifyBorderColor},children:[g.jsx(et,{component:"h2",sx:{fontSize:"1.4rem",color:w=>w.palette.primary.notifyActiveText},children:(e==null?void 0:e.message)||""}),g.jsx(ge,{component:"img",src:nt.CloseCircle,onClick:t,sx:{cursor:"pointer"}})]}),g.jsx(kl,{children:g.jsx(Np,{tableProps:{data:x,columns:{...u7(),isManageable:!1},sort:{sortField:c,sortDir:d,onSort:w=>{var v;const O=(v=w==null?void 0:w.column)==null?void 0:v.key;f(E=>c===O&&E==="asc"?"desc":"asc"),u(O)}},pagination:{selectedPage:n,rowPerPage:r,totalRecords:a,onPageChange:w=>{o(w)},onPageSizeChange:w=>{i(w==null?void 0:w.value),o(1)}}},toolbarProps:{defaultTools:{search:{isRequired:!0,onChange:w=>{m(w.target.value)},placeholder:"Search..."}}}})}),g.jsx(El,{sx:{padding:"1.5rem 2rem"}})]})},j7=({baseUrl:e})=>{const{alertDialogProps:t,showDetailsProps:n,fetchNotification:o}=dw({baseUrl:e});return g.jsxs(g.Fragment,{children:[g.jsx(ge,{sx:{display:"flex",justifyContent:"center",cursor:"pointer",marginTop:"0.6rem"},onClick:()=>{var r;o(),(r=t==null?void 0:t.setOpen)==null||r.call(t,!0)},children:g.jsx(P7,{count:0})}),g.jsx(gw,{...t,children:g.jsx(I7,{...t})}),g.jsx(gw,{...n,children:g.jsx(A7,{...n})})]})},N7=({baseUrl:e})=>g.jsx(_n,{children:g.jsx(C7,{children:g.jsx(j7,{baseUrl:e})})}),$7=({rightChild:e,leftChild:t,isDrawerMerged:n,isDrawerOpen:o,drawerTitle:r,showExpand:i,onCloseClick:a,onMergeClick:l,onExpandClick:c,isDrawerExpanded:u,styles:d,showMerge:f})=>{const p=Nt();return g.jsx(ge,{sx:{position:"relative",overflow:"hidden"},children:g.jsxs(ar,{container:!0,sx:{height:"100%"},children:[g.jsx(ar,{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}),o&&!n&&g.jsxs(g.Fragment,{children:[g.jsx(ge,{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"}}),g.jsx(ge,{onClick:a,sx:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"transparent",zIndex:4}})]}),e&&g.jsxs(ar,{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:o?"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:[g.jsxs(dt,{direction:"row",alignItems:"center",sx:{width:"100%",flexShrink:0,paddingBottom:"0.8rem",px:2,pt:"0.8rem",borderBottom:m=>`0.1rem solid ${m.palette.primary.notifyBorderColor}`},children:[!u&&f&&g.jsxs(g.Fragment,{children:[g.jsx(ge,{sx:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer"},onClick:l,children:g.jsx(ge,{component:"img",src:nt.Merge})}),g.jsx(bi,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"auto!important",borderColor:p.palette.primary.notifyBorderColor}})]}),g.jsxs(dt,{direction:"row",justifyContent:"space-between",alignItems:"center",flexGrow:1,children:[g.jsxs(dt,{direction:"row",gap:"0.5rem",alignItems:"center",onClick:a,sx:{cursor:"pointer"},children:[g.jsx(ge,{component:"img",src:p.icons.close}),g.jsx(et,{sx:{fontSize:"1.2rem",color:p.palette.primary.notifyTextColor},children:r})]}),g.jsx(dt,{direction:"row",gap:"0.5rem",alignItems:"center",children:i&&g.jsx(ge,{onClick:c,sx:{cursor:"pointer"},children:g.jsx(ge,{component:"img",src:u?nt.Collapse:nt.Expand})})})]})]}),g.jsx(ge,{sx:{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},overflow:"auto",px:2},children:e})]})]})})},Sw=({layoutChildren:e,layoutProps:t})=>g.jsx(_n,{children:g.jsx($7,{...e,...t})});Sw.propTypes={layoutChildren:s.object.isRequired,layoutProps:s.object.isRequired},vt.Button=hr,vt.Checkbox=oc,vt.DatePicker=rV,vt.Grid=Np,vt.Header=aw,vt.InputField=n1,vt.Loader=MV,vt.Notification=N7,vt.Select=s1,vt.SliderLayout=Sw,vt.Switch=c1,vt.TextField=bc,vt.ToastProvider=TV,vt.toast=xV,Object.defineProperty(vt,Symbol.toStringTag,{value:"Module"})});
327
327
  //# sourceMappingURL=index.umd.js.map