@3sc/common-component 0.0.497 → 0.0.499

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
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(o=>r.set(o)),r}static accessor(t){const r=(this[nw]=this[nw]={accessors:{}}).accessors,o=this.prototype;function i(a){const l=Pa(a);r[l]||(x7(o,a),r[l]=!0)}return te.isArray(t)?t.forEach(i):i(t),this}};yn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),te.reduceDescriptors(yn.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),te.freezeMethods(yn);function th(e,t){const n=this||Ma,r=t||n,o=yn.from(r.headers);let i=r.data;return te.forEach(e,function(l){i=l.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function rw(e){return!!(e&&e.__CANCEL__)}function Us(e,t,n){Ge.call(this,e??"canceled",Ge.ERR_CANCELED,t,n),this.name="CanceledError"}te.inherits(Us,Ge,{__CANCEL__:!0});function ow(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Ge("Request failed with status code "+n.status,[Ge.ERR_BAD_REQUEST,Ge.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function w7(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function C7(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o=0,i=0,a;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=r[i];a||(a=u),n[o]=c,r[o]=u;let f=i,p=0;for(;f!==o;)p+=n[f++],f=f%e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),u-a<t)return;const y=d&&u-d;return y?Math.round(p*1e3/y):void 0}}function S7(e,t){let n=0,r=1e3/t,o,i;const a=(u,d=Date.now())=>{n=d,o=null,i&&(clearTimeout(i),i=null),e(...u)};return[(...u)=>{const d=Date.now(),f=d-n;f>=r?a(u,d):(o=u,i||(i=setTimeout(()=>{i=null,a(o)},r-f)))},()=>o&&a(o)]}const Wc=(e,t,n=3)=>{let r=0;const o=C7(50,250);return S7(i=>{const a=i.loaded,l=i.lengthComputable?i.total:void 0,c=a-r,u=o(c),d=a<=l;r=a;const f={loaded:a,total:l,progress:l?a/l:void 0,bytes:c,rate:u||void 0,estimated:u&&l&&d?(l-a)/u:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(f)},n)},sw=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},iw=e=>(...t)=>te.asap(()=>e(...t)),T7=Jt.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Jt.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Jt.origin),Jt.navigator&&/(msie|trident)/i.test(Jt.navigator.userAgent)):()=>!0,E7=Jt.hasStandardBrowserEnv?{write(e,t,n,r,o,i,a){if(typeof document>"u")return;const l=[`${e}=${encodeURIComponent(t)}`];te.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),te.isString(r)&&l.push(`path=${r}`),te.isString(o)&&l.push(`domain=${o}`),i===!0&&l.push("secure"),te.isString(a)&&l.push(`SameSite=${a}`),document.cookie=l.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function O7(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function k7(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function aw(e,t,n){let r=!O7(t);return e&&(r||n==!1)?k7(e,t):t}const lw=e=>e instanceof yn?{...e}:e;function ko(e,t){t=t||{};const n={};function r(u,d,f,p){return te.isPlainObject(u)&&te.isPlainObject(d)?te.merge.call({caseless:p},u,d):te.isPlainObject(d)?te.merge({},d):te.isArray(d)?d.slice():d}function o(u,d,f,p){if(te.isUndefined(d)){if(!te.isUndefined(u))return r(void 0,u,f,p)}else return r(u,d,f,p)}function i(u,d){if(!te.isUndefined(d))return r(void 0,d)}function a(u,d){if(te.isUndefined(d)){if(!te.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function l(u,d,f){if(f in t)return r(u,d);if(f in e)return r(void 0,u)}const c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l,headers:(u,d,f)=>o(lw(u),lw(d),f,!0)};return te.forEach(Object.keys({...e,...t}),function(d){const f=c[d]||o,p=f(e[d],t[d],d);te.isUndefined(p)&&f!==l||(n[d]=p)}),n}const cw=e=>{const t=ko({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:a,auth:l}=t;if(t.headers=a=yn.from(a),t.url=J1(aw(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),te.isFormData(n)){if(Jt.hasStandardBrowserEnv||Jt.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(te.isFunction(n.getHeaders)){const c=n.getHeaders(),u=["content-type","content-length"];Object.entries(c).forEach(([d,f])=>{u.includes(d.toLowerCase())&&a.set(d,f)})}}if(Jt.hasStandardBrowserEnv&&(r&&te.isFunction(r)&&(r=r(t)),r||r!==!1&&T7(t.url))){const c=o&&i&&E7.read(i);c&&a.set(o,c)}return t},M7=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){const o=cw(e);let i=o.data;const a=yn.from(o.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:u}=o,d,f,p,y,m;function h(){y&&y(),m&&m(),o.cancelToken&&o.cancelToken.unsubscribe(d),o.signal&&o.signal.removeEventListener("abort",d)}let b=new XMLHttpRequest;b.open(o.method.toUpperCase(),o.url,!0),b.timeout=o.timeout;function w(){if(!b)return;const x=yn.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),v={data:!l||l==="text"||l==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:x,config:e,request:b};ow(function(k){n(k),h()},function(k){r(k),h()},v),b=null}"onloadend"in b?b.onloadend=w:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(w)},b.onabort=function(){b&&(r(new Ge("Request aborted",Ge.ECONNABORTED,e,b)),b=null)},b.onerror=function(E){const v=E&&E.message?E.message:"Network Error",O=new Ge(v,Ge.ERR_NETWORK,e,b);O.event=E||null,r(O),b=null},b.ontimeout=function(){let E=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const v=o.transitional||ew;o.timeoutErrorMessage&&(E=o.timeoutErrorMessage),r(new Ge(E,v.clarifyTimeoutError?Ge.ETIMEDOUT:Ge.ECONNABORTED,e,b)),b=null},i===void 0&&a.setContentType(null),"setRequestHeader"in b&&te.forEach(a.toJSON(),function(E,v){b.setRequestHeader(v,E)}),te.isUndefined(o.withCredentials)||(b.withCredentials=!!o.withCredentials),l&&l!=="json"&&(b.responseType=o.responseType),u&&([p,m]=Wc(u,!0),b.addEventListener("progress",p)),c&&b.upload&&([f,y]=Wc(c),b.upload.addEventListener("progress",f),b.upload.addEventListener("loadend",y)),(o.cancelToken||o.signal)&&(d=x=>{b&&(r(!x||x.type?new Us(null,e,b):x),b.abort(),b=null)},o.cancelToken&&o.cancelToken.subscribe(d),o.signal&&(o.signal.aborted?d():o.signal.addEventListener("abort",d)));const T=w7(o.url);if(T&&Jt.protocols.indexOf(T)===-1){r(new Ge("Unsupported protocol "+T+":",Ge.ERR_BAD_REQUEST,e));return}b.send(i||null)})},P7=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,o;const i=function(u){if(!o){o=!0,l();const d=u instanceof Error?u:this.reason;r.abort(d instanceof Ge?d:new Us(d instanceof Error?d.message:d))}};let a=t&&setTimeout(()=>{a=null,i(new Ge(`timeout ${t} of ms exceeded`,Ge.ETIMEDOUT))},t);const l=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),e=null)};e.forEach(u=>u.addEventListener("abort",i));const{signal:c}=r;return c.unsubscribe=()=>te.asap(l),c}},D7=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,o;for(;r<n;)o=r+t,yield e.slice(r,o),r=o},R7=async function*(e,t){for await(const n of I7(e))yield*D7(n,t)},I7=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},uw=(e,t,n,r)=>{const o=R7(e,t);let i=0,a,l=c=>{a||(a=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await o.next();if(u){l(),c.close();return}let f=d.byteLength;if(n){let p=i+=f;n(p)}c.enqueue(new Uint8Array(d))}catch(u){throw l(u),u}},cancel(c){return l(c),o.return()}},{highWaterMark:2})},dw=64*1024,{isFunction:zc}=te,A7=(({Request:e,Response:t})=>({Request:e,Response:t}))(te.global),{ReadableStream:fw,TextEncoder:pw}=te.global,hw=(e,...t)=>{try{return!!e(...t)}catch{return!1}},N7=e=>{e=te.merge.call({skipUndefined:!0},A7,e);const{fetch:t,Request:n,Response:r}=e,o=t?zc(t):typeof fetch=="function",i=zc(n),a=zc(r);if(!o)return!1;const l=o&&zc(fw),c=o&&(typeof pw=="function"?(m=>h=>m.encode(h))(new pw):async m=>new Uint8Array(await new n(m).arrayBuffer())),u=i&&l&&hw(()=>{let m=!1;const h=new n(Jt.origin,{body:new fw,method:"POST",get duplex(){return m=!0,"half"}}).headers.has("Content-Type");return m&&!h}),d=a&&l&&hw(()=>te.isReadableStream(new r("").body)),f={stream:d&&(m=>m.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!f[m]&&(f[m]=(h,b)=>{let w=h&&h[m];if(w)return w.call(h);throw new Ge(`Response type '${m}' is not supported`,Ge.ERR_NOT_SUPPORT,b)})});const p=async m=>{if(m==null)return 0;if(te.isBlob(m))return m.size;if(te.isSpecCompliantForm(m))return(await new n(Jt.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(te.isArrayBufferView(m)||te.isArrayBuffer(m))return m.byteLength;if(te.isURLSearchParams(m)&&(m=m+""),te.isString(m))return(await c(m)).byteLength},y=async(m,h)=>{const b=te.toFiniteNumber(m.getContentLength());return b??p(h)};return async m=>{let{url:h,method:b,data:w,signal:T,cancelToken:x,timeout:E,onDownloadProgress:v,onUploadProgress:O,responseType:k,headers:P,withCredentials:R="same-origin",fetchOptions:A}=cw(m),j=t||fetch;k=k?(k+"").toLowerCase():"text";let I=P7([T,x&&x.toAbortSignal()],E),N=null;const _=I&&I.unsubscribe&&(()=>{I.unsubscribe()});let $;try{if(O&&u&&b!=="get"&&b!=="head"&&($=await y(P,w))!==0){let U=new n(h,{method:"POST",body:w,duplex:"half"}),X;if(te.isFormData(w)&&(X=U.headers.get("content-type"))&&P.setContentType(X),U.body){const[re,Q]=sw($,Wc(iw(O)));w=uw(U.body,dw,re,Q)}}te.isString(R)||(R=R?"include":"omit");const B=i&&"credentials"in n.prototype,F={...A,signal:I,method:b.toUpperCase(),headers:P.normalize().toJSON(),body:w,duplex:"half",credentials:B?R:void 0};N=i&&new n(h,F);let L=await(i?j(N,A):j(h,F));const H=d&&(k==="stream"||k==="response");if(d&&(v||H&&_)){const U={};["status","statusText","headers"].forEach(ce=>{U[ce]=L[ce]});const X=te.toFiniteNumber(L.headers.get("content-length")),[re,Q]=v&&sw(X,Wc(iw(v),!0))||[];L=new r(uw(L.body,dw,re,()=>{Q&&Q(),_&&_()}),U)}k=k||"text";let V=await f[te.findKey(f,k)||"text"](L,m);return!H&&_&&_(),await new Promise((U,X)=>{ow(U,X,{data:V,headers:yn.from(L.headers),status:L.status,statusText:L.statusText,config:m,request:N})})}catch(B){throw _&&_(),B&&B.name==="TypeError"&&/Load failed|fetch/i.test(B.message)?Object.assign(new Ge("Network Error",Ge.ERR_NETWORK,m,N),{cause:B.cause||B}):Ge.from(B,B&&B.code,m,N)}}},j7=new Map,mw=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,i=[r,o,n];let a=i.length,l=a,c,u,d=j7;for(;l--;)c=i[l],u=d.get(c),u===void 0&&d.set(c,u=l?new Map:N7(t)),d=u;return u};mw();const nh={http:r7,xhr:M7,fetch:{get:mw}};te.forEach(nh,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const gw=e=>`- ${e}`,_7=e=>te.isFunction(e)||e===null||e===!1;function F7(e,t){e=te.isArray(e)?e:[e];const{length:n}=e;let r,o;const i={};for(let a=0;a<n;a++){r=e[a];let l;if(o=r,!_7(r)&&(o=nh[(l=String(r)).toLowerCase()],o===void 0))throw new Ge(`Unknown adapter '${l}'`);if(o&&(te.isFunction(o)||(o=o.get(t))))break;i[l||"#"+a]=o}if(!o){const a=Object.entries(i).map(([c,u])=>`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build"));let l=n?a.length>1?`since :
324
324
  `+a.map(gw).join(`
325
325
  `):" "+gw(a[0]):"as no adapter specified";throw new Ge("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return o}const yw={getAdapter:F7,adapters:nh};function rh(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Us(null,e)}function bw(e){return rh(e),e.headers=yn.from(e.headers),e.data=th.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),yw.getAdapter(e.adapter||Ma.adapter,e)(e).then(function(r){return rh(e),r.data=th.call(e,e.transformResponse,r),r.headers=yn.from(r.headers),r},function(r){return rw(r)||(rh(e),r&&r.response&&(r.response.data=th.call(e,e.transformResponse,r.response),r.response.headers=yn.from(r.response.headers))),Promise.reject(r)})}const vw="1.13.1",Hc={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Hc[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const xw={};Hc.transitional=function(t,n,r){function o(i,a){return"[Axios v"+vw+"] Transitional option '"+i+"'"+a+(r?". "+r:"")}return(i,a,l)=>{if(t===!1)throw new Ge(o(a," has been removed"+(n?" in "+n:"")),Ge.ERR_DEPRECATED);return n&&!xw[a]&&(xw[a]=!0,console.warn(o(a," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,a,l):!0}},Hc.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function $7(e,t,n){if(typeof e!="object")throw new Ge("options must be an object",Ge.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],a=t[i];if(a){const l=e[i],c=l===void 0||a(l,i,e);if(c!==!0)throw new Ge("option "+i+" must be "+c,Ge.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Ge("Unknown option "+i,Ge.ERR_BAD_OPTION)}}const Uc={assertOptions:$7,validators:Hc},gr=Uc.validators;let Mo=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Q1,response:new Q1}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const i=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
326
- `+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=ko(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&Uc.assertOptions(r,{silentJSONParsing:gr.transitional(gr.boolean),forcedJSONParsing:gr.transitional(gr.boolean),clarifyTimeoutError:gr.transitional(gr.boolean)},!1),o!=null&&(te.isFunction(o)?n.paramsSerializer={serialize:o}:Uc.assertOptions(o,{encode:gr.function,serialize:gr.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Uc.assertOptions(n,{baseUrl:gr.spelling("baseURL"),withXsrfToken:gr.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&te.merge(i.common,i[n.method]);i&&te.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),n.headers=yn.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 m=[bw.bind(this),void 0];for(m.unshift(...l),m.push(...u),p=m.length,d=Promise.resolve(n);f<p;)d=d.then(m[f++],m[f++]);return d}p=l.length;let y=n;for(;f<p;){const m=l[f++],h=l[f++];try{y=m(y)}catch(b){h.call(this,b);break}}try{d=bw.call(this,y)}catch(m){return Promise.reject(m)}for(f=0,p=u.length;f<p;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=ko(this.defaults,t);const n=aw(t.baseURL,t.url,t.allowAbsoluteUrls);return J1(n,t.params,t.paramsSerializer)}};te.forEach(["delete","get","head","options"],function(t){Mo.prototype[t]=function(n,r){return this.request(ko(r||{},{method:t,url:n,data:(r||{}).data}))}}),te.forEach(["post","put","patch"],function(t){function n(r){return function(i,a,l){return this.request(ko(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}Mo.prototype[t]=n(),Mo.prototype[t+"Form"]=n(!0)});let L7=class dC{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(o=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](o);r._listeners=null}),this.promise.then=o=>{let i;const a=new Promise(l=>{r.subscribe(l),i=l}).then(o);return a.cancel=function(){r.unsubscribe(i)},a},t(function(i,a,l){r.reason||(r.reason=new Us(i,a,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new dC(function(o){t=o}),cancel:t}}};function B7(e){return function(n){return e.apply(null,n)}}function V7(e){return te.isObject(e)&&e.isAxiosError===!0}const oh={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(oh).forEach(([e,t])=>{oh[t]=e});function ww(e){const t=new Mo(e),n=F1(Mo.prototype.request,t);return te.extend(n,Mo.prototype,t,{allOwnKeys:!0}),te.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return ww(ko(e,o))},n}const St=ww(Ma);St.Axios=Mo,St.CanceledError=Us,St.CancelToken=L7,St.isCancel=rw,St.VERSION=vw,St.toFormData=Bc,St.AxiosError=Ge,St.Cancel=St.CanceledError,St.all=function(t){return Promise.all(t)},St.spread=B7,St.isAxiosError=V7,St.mergeConfig=ko,St.AxiosHeaders=yn,St.formToJSON=e=>tw(te.isHTMLForm(e)?new FormData(e):e),St.getAdapter=yw.getAdapter,St.HttpStatusCode=oh,St.default=St;const{Axios:_z,AxiosError:Fz,CanceledError:$z,isCancel:Lz,CancelToken:Bz,VERSION:Vz,all:Wz,Cancel:zz,isAxiosError:Hz,spread:Uz,toFormData:qz,AxiosHeaders:Yz,HttpStatusCode:Gz,formToJSON:Kz,getAdapter:Xz,mergeConfig:Zz}=St,sh={BASE_URL:"https://qa.3sc.ai/api",VERSION:"/v1"},Da={headers:{"Content-Type":"application/json"},withCredentials:!0},Cw=St.create({baseURL:sh.BASE_URL,axiosConfig:Da});Cw.interceptors.request.use(function(e){return e},function(e){return Promise.reject(e)}),Cw.interceptors.response.use(function(e){return e},function(e){return Promise.reject(e)});const Ir={TOKEN:"token",USER:"user",SNOP:"snop",SELECTED_BU:"selected_business_unit",SETTINGS:"settings"},Sw={TENANT_ID:"tenant_id",BU_ID:"bu_id"},W7=Object.values({"SKU Name":"sku_name",Node:"node","Channel Name":"channel_name"}),z7=[10,25,50,100],H7={MARK_ALL_READ:"MARK_ALL_READ"},U7=z7.map(e=>({label:e,value:e})),Tw={PRIMARY:"PRIMARY",SECONDARY:"SECONDARY"},qc={NOTIFICATION:"/notifications",SETTING:"/configuration/setting"};/*! js-cookie v3.0.5 | MIT */function Yc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var q7={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 ih(e,t){function n(o,i,a){if(!(typeof document>"u")){a=Yc({},t,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var l="";for(var c in a)a[c]&&(l+="; "+c,a[c]!==!0&&(l+="="+a[c].split(";")[0]));return document.cookie=o+"="+e.write(i,o)+l}}function r(o){if(!(typeof document>"u"||arguments.length&&!o)){for(var i=document.cookie?document.cookie.split("; "):[],a={},l=0;l<i.length;l++){var c=i[l].split("="),u=c.slice(1).join("=");try{var d=decodeURIComponent(c[0]);if(a[d]=e.read(u,d),o===d)break}catch{}}return o?a[o]:a}}return Object.create({set:n,get:r,remove:function(o,i){n(o,"",Yc({},i,{expires:-1}))},withAttributes:function(o){return ih(this.converter,Yc({},this.attributes,o))},withConverter:function(o){return ih(Yc({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var Y7=ih(q7,{path:"/"});const ah=Ac(Ir.SNOP),lh=Ac(Ir.SELECTED_BU),ch=Ac(Ir.USER);Ac(Ir.SETTINGS);const Ew={BU_IDS:lh==null?void 0:lh.business_unit_id,TOKEN:JSON.parse(Y7.get(Ir.TOKEN)||null),TENANT_IDS:ch==null?void 0:ch.tenant_id,SNOP_IDS:ah==null?void 0:ah.snop_id},{TENANT_ID:G7,BU_ID:K7}=Sw,{TENANT_IDS:X7,BU_IDS:Z7}=Ew,Gc=async({baseUrl:e,payload:t})=>{console.log({api:e,payload:t});try{const n=`${e}${qc.SETTING}/v1?${G7}=${X7}&${K7}=${Z7}`;return await St.post(n,t,Da)}catch(n){return n}},J7=({columns:e,gridPath:t,baseUrl:n,isDefaultConfig:r,pageSize:o=10,childUniqueKey:i,data:a})=>{var x,E,v;const l=a==null?void 0:a.length;let{definitions:c,defaultUserSettings:u,labels:d}=e;const f=Ar(d),p=t.split("/").filter(Boolean),y=JSON.parse(localStorage.getItem(Ir.SETTINGS));let m=p.reduce((O,k)=>O==null?void 0:O[k],y)||null;const h=Ar((m==null?void 0:m.columns)||[]);if(!r&&t&&l){let O=(u&&uh({col:u,childUniqueKey:i,definitions:c}))??uh({col:c,childUniqueKey:i});const k=O.filter(R=>!h[R.key]),P=m&&((x=m==null?void 0:m.columns)==null?void 0:x.some(R=>(R==null?void 0:R.children)&&R.children[i]));if(l&&(k.length||i&&P===!1)){if(P==!1&&i.length>0){const R=Ar(O);O=(E=m==null?void 0:m.columns)==null?void 0:E.map(A=>{var j;return A!=null&&A.children&&!A.children[i]?{...A,children:{...A.children,[i]:(j=R==null?void 0:R[A==null?void 0:A.key])==null?void 0:j.children[i]}}:A})}(async()=>{try{console.log({definitions:c,defaultUserSettings:u,labels:d,data:a,missing:k,gridSettingsMap:h,_userSettings:O,_localSetting:y,grid_settings:m});const A={...y||{platform:{theme:"light"}}},j=(m==null?void 0:m.pageSize)??o;let I=A;for(let N=0;N<p.length;N++){const _=p[N];N===p.length-1?I[_]={columns:O,pageSize:j}:(I[_]={...I[_]||{}},I=I[_])}localStorage.setItem(Ir.SETTINGS,JSON.stringify(A)),console.log({"table-helper":n,payload:A,gridPath:t}),await Gc({baseUrl:n,payload:A})}catch(R){console.error(R)}})()}}u=((m==null?void 0:m.columns)&&eW(h,u,i))??u??uh({col:c});const b=[],w=Ar(u);for(const O of c){const k=w[O.key]||{},P=f[O.key]||{},R=h[O.key],A=Ar(k.children||[]),j=Ar(P.children||[]);let I={...O,style:R==null?void 0:R.style,...k,...P};(v=O.children)!=null&&v.length&&(I.children=O.children.map(N=>({...N,...A[N.key],...j[N.key]}))),b.push(I)}return b.sort((O,k)=>O.sequenceId-k.sequenceId)},Q7=e=>e.sort((t,n)=>t.sequenceId-n.sequenceId),Ra=({columns:e,childUniqueKey:t,definitions:n})=>{let r=n||e;return e==null?void 0:e.map(o=>{let i=r==null?void 0:r.find(a=>(a==null?void 0:a.key)===(o==null?void 0:o.key));return{id:o.id,key:o.key,sequenceId:o.sequenceId||o.id,isHidden:o.isHidden||!1,style:o.style||(i==null?void 0:i.style)||{},...(o==null?void 0:o.children)&&{children:t?{[t]:Ra({columns:o.children,definitions:i==null?void 0:i.children})}:Ra({columns:o.children,definitions:i==null?void 0:i.children})}}})},Ar=e=>Array.isArray(e)&&(e==null?void 0:e.reduce((t,n)=>(t[n.key]=n,t),{})),uh=({col:e,childUniqueKey:t,definitions:n})=>Ra({columns:e,childUniqueKey:t,definitions:n}),eW=(e,t,n)=>t.map(o=>{const i=e[o.key],a=o.children?o.children.map(l=>{var d;const c=Ar(Array.isArray(i==null?void 0:i.children)?i==null?void 0:i.children:(d=i==null?void 0:i.children)==null?void 0:d[n]),u=c==null?void 0:c[l.key];return{...l,sequenceId:(u==null?void 0:u.sequenceId)||l.sequenceId,isHidden:(u==null?void 0:u.isHidden)??l.isHidden}}):void 0;return{...o,sequenceId:(i==null?void 0:i.sequenceId)||o.sequenceId,isHidden:(i==null?void 0:i.isHidden)??o.isHidden,...a?{children:a}:{}}}),tW=({t:e})=>{const t=[{id:1,key:"sku_name",isSortable:!0,isMandatory:!0},{id:2,key:"node",isSortable:!0,isMandatory:!0},{id:3,key:"channel_name",isSortable:!0,isMandatory:!0}],n=[{id:1,key:"sku_name",sequenceId:1,isHidden:!1,style:{width:"20rem",minWidth:"20rem",maxWidth:"20rem"}},{id:2,key:"node",sequenceId:2,isHidden:!1,style:{width:"20rem",minWidth:"20rem",maxWidth:"20rem"}},{id:3,key:"channel_name",sequenceId:3,isHidden:!1,style:{width:"20rem",minWidth:"20rem",maxWidth:"20rem"}}],r=[{id:1,key:"sku_name",label:e(y8),isLocalizable:!1},{id:2,key:"node",label:e(g8),isLocalizable:!1},{id:3,key:"channel_name",label:e(b8),isLocalizable:!1}];return{definitions:t,defaultUserSettings:n,labels:r}};class Ow extends D.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=D.createRef()}startDrag(){if(!this.props.disabled&&(this.draggedCol=this.props.id,this.props.resizeStart&&this.draggedCol===this.props.id&&this.props.resizeStart(),this.dragging=!0,this.startPos=this.mouseX,this.startWidthPrev=0,this.resizeRef.current)){let t=this.resizeRef.current.previousSibling;t&&(this.startWidthPrev=t.clientWidth)}}endDrag(){this.props.disabled||(this.dragging=!1,this.props.resizeEnd&&this.draggedCol===this.props.id&&this.props.resizeEnd(this.lastDraggedWidth),this.draggedCol=null)}onMouseMove(t){if(this.props.disabled||(this.mouseX=t.touches?t.touches[0].screenX:t.screenX,!this.dragging))return;const n=this.resizeRef.current,r=this.startPos-this.mouseX;let o=this.startWidthPrev-r;(!this.props.minWidth||o>=this.props.minWidth)&&(!this.props.maxWidth||o<=this.props.maxWidth)&&(n.previousSibling.style.width=o+"px",n.previousSibling.style.minWidth=o+"px",n.previousSibling.style.maxWidth=o+"px",n.previousSibling.style.setProperty("--column_resize_before_width",o+"px"),this.lastDraggedWidth=o)}componentDidMount(){const t=this.resizeRef.current;if(t&&(this.props.defaultWidth?(t.previousSibling.style.minWidth=this.props.defaultWidth+"px",t.previousSibling.style.width=this.props.defaultWidth+"px",t.previousSibling.style.maxWidth=this.props.defaultWidth+"px",t.previousSibling.style.setProperty("--column_resize_before_width",this.props.defaultWidth+"px")):this.props.minWidth&&(t.previousSibling.style.minWidth=this.props.minWidth+"px",t.previousSibling.style.width=this.props.minWidth+"px",t.previousSibling.style.maxWidth=this.props.minWidth+"px",t.previousSibling.style.setProperty("--column_resize_before_width",this.props.minWidth+"px"))),this.props.disabled){this.props.defaultWidth&&t&&(t.previousSibling.style.minWidth=this.props.defaultWidth+"px",t.previousSibling.style.width=this.props.defaultWidth+"px",t.previousSibling.style.maxWidth=this.props.defaultWidth+"px",t.previousSibling.style.setProperty("--column_resize_before_width",this.props.defaultWidth+"px")),this.props.maxWidth&&t&&(t.previousSibling.style.maxWidth=this.props.maxWidth+"px");return}this.addEventListenersToDocument()}componentWillUnmount(){this.props.disabled||this.removeEventListenersFromDocument()}componentDidUpdate(t,n){t.disabled&&!this.props.disabled&&this.addEventListenersToDocument(),!t.disabled&&this.props.disabled&&this.removeEventListenersFromDocument()}addEventListenersToDocument(){document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.endDrag),document.addEventListener("touchmove",this.onMouseMove),document.addEventListener("touchend",this.endDrag)}removeEventListenersFromDocument(){document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.endDrag),document.removeEventListener("touchmove",this.onMouseMove),document.removeEventListener("touchend",this.endDrag)}render(){var t={userSelect:"none"};return this.props.disabled||(t.cursor="ew-resize"),this.props.className===""&&(t.width="6px",t.backgroundColor="rgba(0, 0, 0, 0.1)"),D.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})}}Ow.defaultProps={disabled:!1,minWidth:0,className:""};function dh({isRenderCellContent:e,column:t,row:n,parent:r}){const o=n[t.key],i=(o==null?void 0:o.length)>20;return g.jsx(g.Fragment,{children:e?g.jsx(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem"},children:t==null?void 0:t.cellRenderer(n,{column:t,parent:r})}):g.jsx(g.Fragment,{children:i?g.jsx(Dd,{title:o,placement:"top",componentsProps:{tooltip:{sx:{fontSize:"1rem",padding:"0.5rem 1rem",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"}}},children:g.jsx(Se,{sx:{maxWidth:"auto",whiteSpace:"normal"},children:g.jsx(nt,{sx:{fontSize:"1.1rem",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none"},children:o})})}):g.jsx(Se,{sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem",m:0},id:t.key,component:"p",children:o??""})})})}dh.propTypes={isRenderCellContent:s.bool,column:s.object,row:s.object},Y(jl)(({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 Po=Y(nt)(({theme:e})=>({color:e.palette.primary.notifyTextColor,fontSize:"1.1rem"})),nW=Y(ly)(({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)"})}})),rW=Y(Ii)(({theme:e})=>({color:e.palette.primary.notifyTextColor,padding:"0.6rem 0",fontSize:"0.9rem",fontWeight:500,"&::before, &::after":{borderColor:`${e.palette.primary.notifyBorderColor}!important`}})),oW=Y(hd)(({theme:e})=>({"& .MuiBadge-badge":{right:3.5,top:1.8,border:`0.1rem solid ${e.palette.primary.notifyBackground}`,padding:"0 1.3px",borderRadius:"50%",backgroundColor:"#D44E40",fontSize:"0.725rem",minWidth:"0.7rem",height:"0.7rem"}}));Y(Yl)(({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 sW=Y(Oy)(({theme:e})=>({minHeight:"2rem","& .MuiTabs-indicator":{height:"0.1rem",backgroundColor:e.palette.primary.notifyActiveText}})),fh=Y(cy)(({theme:e})=>({color:e.palette.primary.notifyActiveText,textTransform:"none",fontWeight:"normal",padding:0,fontSize:"1rem",minHeight:"2rem",paddingBottom:"1rem","&.Mui-selected":{fontWeight:"bold",color:e.palette.primary.notifyActiveText}})),Kc=Y(dd)(({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`}})),iW=Y(Ul)(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"table-cell",[`&.${Id.head}`]:{color:e.palette.primary.notifyTextColor,backgroundColor:e.palette.primary.notifyBackground,borderColor:e.palette.primary.notifyBorderColor,padding:"0rem",textAlign:"center",lineHeight:"1.5rem"},[`&.${Id.body}`]:{color:e.palette.primary.notifyTextColor,borderColor:e.palette.primary.notifyBorderColor,padding:"0rem",textAlign:"center"}}));function Ia({children:e,...t}){return g.jsx(iW,{...t,children:e})}Ia.propTypes={children:s.node};const aW=Y(vy)(()=>({"&:last-child td":{borderBottom:"none"}}));function qs({children:e,...t}){return g.jsx(aW,{...t,children:e})}qs.propTypes={children:s.node};const lW=D.memo(({row:e,isSelected:t,isHigh:n,onRowClick:r,children:o})=>g.jsx(qs,{sx:i=>({backgroundColor:t||n?i.palette.primary.appBackground:i.palette.primary.notifyBackground}),onClick:()=>r==null?void 0:r(e),children:o},e==null?void 0:e.fhi)),cW=D.memo(({nestedData:e,nestedColumn:t,t:n})=>e!=null&&e.length?g.jsx(g.Fragment,{children:e.map((r,o)=>g.jsx(qs,{children:t.map((i,a)=>g.jsx(Ia,{style:i==null?void 0:i.style,children:g.jsx(dh,{isRenderCellContent:!!(i!=null&&i.cellRenderer),column:i,row:r})},a))},`nested-${o}`))}):g.jsx(qs,{children:g.jsx(Ia,{colSpan:t.length,children:g.jsx(Po,{sx:{textAlign:"center"},children:n(Jr.NRF)})})})),uW=(e,t,n,r,o,i)=>{const[a,l]=D.useState({isOpen:!1,column:null}),c=(p,y,m)=>{l({isOpen:p.currentTarget,column:y,isChild:!!m})},u=()=>{l({isOpen:!1,column:null,isChild:!1})},d=async()=>{u();const p=e.map(y=>{var m;if(a!=null&&a.isChild&&Array.isArray(y.children)){const h=y.children.map(w=>{var T;return w.key===((T=a.column)==null?void 0:T.key)?{...w,isHidden:!0}:w}),b=h.every(w=>w.isHidden);return{...y,isHidden:b?!0:y.isHidden,children:h}}return y.key===((m=a.column)==null?void 0:m.key)?{...y,isHidden:!0}:y});f({updatedColumns:p})},f=async({updatedColumns:p})=>{t({type:qe.SET_GRID_DATA,payload:{visibleGridColumns:p}});const y=r.split("/").filter(Boolean),m=JSON.parse(localStorage.getItem(Ir.SETTINGS));let h=y.reduce((O,k)=>O==null?void 0:O[k],m)||null,b=Ra({columns:p,childUniqueKey:i});const w=Ar(h==null?void 0:h.columns);b=b==null?void 0:b.map(O=>{var R,A;const k=(O==null?void 0:O.children)||{},P=((R=w==null?void 0:w[O==null?void 0:O.key])==null?void 0:R.children)||{};return{...O,...(((A=Object.keys(P))==null?void 0:A.length)>0||(k==null?void 0:k[i]))&&{children:{...P,[i]:k==null?void 0:k[i]}}}});const x={...m||{platform:{theme:"light"}}},E=(h==null?void 0:h.pageSize)??o;let v=x;for(let O=0;O<y.length;O++){const k=y[O];O===y.length-1?v[k]={columns:b,pageSize:E}:(v[k]={...v[k]||{}},v=v[k])}localStorage.setItem(Ir.SETTINGS,JSON.stringify(x)),console.log({hide:n,payload:x,gridPath:r}),await Gc({baseUrl:n,payload:x})};return{selectedColumn:a,handleMenuClick:c,handleClose:u,handleHideClick:d,columnUpdaterFunction:f}},dW=e=>{if(!e)return null;const{options:t,...n}=e,r=t?"select":"button",o={button:i=>{var a;return g.jsx(Mr,{...i,styles:{...i.styles,iconPrimary:((a=i==null?void 0:i.styles)==null?void 0:a.variant)=="filled"}})},select:i=>{var a;return g.jsx(Se,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"},width:(a=i.styles)==null?void 0:a.width},children:g.jsx(I1,{...i,options:t})})}};return o[r]?o[r](n):null},fW=({presentSetting:e,gridSetting:t,gridPath:n,childUniqueKey:r})=>{if(!n)return e;const o=n.split("/").filter(Boolean);let i=o.reduce((u,d)=>u==null?void 0:u[d],e)||null,a=Ra({columns:t==null?void 0:t.grid,childUniqueKey:r});const l=Ar(i==null?void 0:i.columns);a=a==null?void 0:a.map(u=>{var p,y;const d=(u==null?void 0:u.children)||{},f=((p=l==null?void 0:l[u==null?void 0:u.key])==null?void 0:p.children)||{};return{...u,...(((y=Object.keys(f))==null?void 0:y.length)>0||(d==null?void 0:d[r]))&&{children:{...f,[r]:d==null?void 0:d[r]}}}});let c=e;for(let u=0;u<o.length;u++){const d=o[u];u===o.length-1?c[d]={columns:a,pageSize:(t==null?void 0:t.pageSize)??null}:(c[d]=c[d]||{},c=c[d])}return{settingObject:e,defaultUserSettings:a}},pW=async({baseUrl:e,gridSetting:t,childUniqueKey:n,gridPath:r})=>{try{const o=JSON.parse(localStorage.getItem("settings")),{settingObject:i,defaultUserSettings:a}=fW({presentSetting:o,gridSetting:t,gridPath:r,childUniqueKey:n});return localStorage.setItem("settings",JSON.stringify(i)),console.log({"update-setting":e,payload:i,gridPath:r}),await Gc({baseUrl:e,payload:i}),a}catch(o){console.error(o)}},hW=({index:e,visibleGridColumns:t,width:n,columnUpdaterFunction:r})=>{if(!t||!t[e])return null;t[e];let o=`${n/10}rem`;const i=t.map((a,l)=>l===e?{...a,style:{...a.style,width:o,minWidth:o,maxWidth:o}}:a);return r({updatedColumns:i}),i[e]},kw=({pagination:e,gridPath:t,baseUrl:n,t:r})=>{const{selectedPage:o,rowPerPage:i,totalRecords:a,onPageChange:l,onPageSizeChange:c}=e,u=Ot(),d=async(f,p)=>{if(!p)return;const y=p.split("/").filter(Boolean),m="settings",b={...JSON.parse(localStorage.getItem(m))||{}};let w=b;for(let T=0;T<y.length;T++){const x=y[T];T===y.length-1?w[x]={...w[x]||{},pageSize:f}:(w[x]={...w[x]||{}},w=w[x])}localStorage.setItem(m,JSON.stringify(b)),console.log({pagination:n,payload,gridPath:p}),await Gc({baseUrl:n,payload:b})};return g.jsxs(Se,{sx:{display:"flex",p:"1rem 1.5rem"},children:[g.jsxs(Se,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"0.5rem",width:"100%"},children:[g.jsx(nt,{sx:{fontSize:"1.1rem",color:u.palette.primary.notifyTextColor},children:r("SHOWING_ROWS",{current:Math.min(o*i,a),total:a})}),g.jsx(Se,{sx:{"& .MuiInputBase-input":{padding:"0rem 0.8rem!important"},width:"6rem"},children:g.jsx(Ws,{options:U7,value:i,onChange:async f=>{c(f),d(f==null?void 0:f.value,t)}})})]}),g.jsx(Qg,{count:Math.ceil(a/i),page:o,onChange:async(f,p)=>{l(p)},siblingCount:0,shape:"rounded",sx:{width:"100%","& .MuiPagination-ul":{width:"100%",display:"flex",justifyContent:"flex-end","& li:first-of-type":{border:`0.1rem solid ${u.palette.primary.notifyBorderColor}`,color:u.palette.primary.notifyActiveText,marginRight:"1.5rem",borderRadius:"1rem",width:"3rem",height:"3rem",justifyContent:"center",alignItems:"center",display:"flex"},"& li:last-child":{border:`0.1rem solid ${u.palette.primary.notifyBorderColor}`,color:u.palette.primary.notifyActiveText,marginLeft:"1.5rem",borderRadius:"1rem",width:"3rem",height:"3rem",justifyContent:"center",alignItems:"center",display:"flex"}},"& .MuiPaginationItem-root":{color:"#595959",fontSize:"1.1rem",borderRadius:"1rem",width:"3rem",height:"3rem",justifyContent:"center",alignItems:"center",display:"flex","& .MuiSvgIcon-root":{fontSize:"2.2rem"}},"& .Mui-selected":{color:u.palette.primary.notifyActiveText,backgroundColor:`${u.palette.brandColor.paginationBc} !important`}}})]})};kw.propTypes={pagination:s.object.isRequired};const Mw=({menuOpen:e,handleClose:t,onHideClick:n})=>{const r=Ot();return g.jsx($i,{open:!!e,anchorEl:e,onClose:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:g.jsx(Se,{sx:{backgroundColor:r.palette.primary.notifyBackground,border:`0.1rem solid ${r.palette.primary.notifyBorderColor}`,minHeight:"2.3rem",display:"flex",justifyContent:"center",alignItems:"center"},children:g.jsx(qn,{onClick:n,disableRipple:!0,sx:{textTransform:"none",fontSize:"1.1rem",p:"0.4rem 1rem",minHeight:"unset",fontWeight:500,color:r.palette.primary.notifyTextColor,backgroundColor:"transparent","&:hover":{backgroundColor:"transparent"},"&:active":{backgroundColor:"transparent"},"&:focus":{backgroundColor:"transparent"}},children:"Hide Column"})})})};Mw.propTypes={menuOpen:s.object,handleClose:s.func,onHideClick:s.func};const Pw=({sortKey:e,sortField:t,sortDir:n,handleSortClick:r})=>{const o=i=>g.jsx(_r,{onClick:r,sx:{padding:"0.2rem"},draggable:!1,children:g.jsx(mn,{url:i})});return g.jsx(g.Fragment,{children:o(t===e?n==="asc"?Je.AscSort:Je.DescSort:Je.Unsort)})};Pw.propTypes={sortKey:s.string.isRequired,sortField:s.string,sortDir:s.string,handleSortClick:s.func};function Dw({parent:e,column:t,sort:n,handleMenuClick:r,isManageable:o}){const i=o&&(!(t!=null&&t.isMandatory)||(t==null?void 0:t.isMandatory)&&(t==null?void 0:t.showHide)===!0),a=t==null?void 0:t.label,l=t==null?void 0:t.isSortable,c=n==null?void 0:n.sortField,u=n==null?void 0:n.sortDir,d=n==null?void 0:n.onSort;return g.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},draggable:!1,children:[g.jsx(Se,{sx:{fontWeight:"bold",fontSize:"1.1rem",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"0.5rem",textAlign:"center"},children:g.jsx(Dd,{title:a,placement:"top",componentsProps:{tooltip:{sx:{fontSize:"1rem",padding:"0.6rem 1rem",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"}}},children:a??""})}),g.jsxs(Se,{sx:{display:"flex",alignItems:"center"},draggable:!1,children:[l&&g.jsx(Pw,{sortKey:e?`${e==null?void 0:e.key}|${t==null?void 0:t.key}`:t==null?void 0:t.key,sortField:c,sortDir:u,handleSortClick:()=>d({column:t,sortDir:u,sortField:c,parent:e})}),i&&g.jsx(_r,{draggable:!1,onClick:f=>r(f,t,e),sx:{padding:"0.2rem"},children:g.jsx(mn,{url:Je.Menu})})]})]})}Dw.propTypes={column:s.object.isRequired,sort:s.object.isRequired,handleMenuClick:s.func,isManageable:s.bool};function Rw({rows:e,sort:t,data:n,pagination:r,columns:o,nested:i,baseUrl:a,gridPath:l,childUniqueKey:c,isVirtualizedTable:u=!1,t:d}){var Be;const f=Ot(),{visibleGridColumns:p}=D.useContext(jc),y=D.useContext(Ta),{selectedColumn:m,handleMenuClick:h,handleClose:b,handleHideClick:w,columnUpdaterFunction:T}=uW(p,y,a,l,r==null?void 0:r.rowPerPage,c),x=o==null?void 0:o.isManageable,E=o==null?void 0:o.isResizable,v=(n==null?void 0:n.length)>0,O=D.useRef(null),k=D.useRef(null),P=45,R=10,A=n==null?void 0:n.length,[j,I]=D.useState({start:0,end:10}),[N,_]=D.useState({start:0,end:20}),[$,B]=D.useState(null),[F,L]=D.useState(null),[H,V]=D.useState(null);let U=null;const X=D.useRef(0),re=D.useRef(!1),Q=D.useRef(null),ce=Q7(((Be=i==null?void 0:i.column)==null?void 0:Be.definitions)||[]),oe=i==null?void 0:i.isNested,J=(i==null?void 0:i.data)||[],ie=i==null?void 0:i.hashKey,[se,ne]=D.useState(0),[K,M]=D.useState(null);D.useRef(null);const[G,Z]=D.useState(!1),[he,de]=D.useState(!1);D.useEffect(()=>{if(O.current){const z=()=>{ne(O.current.offsetHeight)};return z(),window.addEventListener("resize",z),()=>window.removeEventListener("resize",z)}},[n]),D.useEffect(()=>{const z=O.current,me=z==null?void 0:z.querySelector("thead");if(!me)return;const le=()=>{V(null)};return me==null||me.addEventListener("mousedown",le),()=>{me==null||me.removeEventListener("mousedown",le)}},[]);const q=(z,me)=>{var xe,ke;if(re.current){z.preventDefault();return}B(me),V(null),z.dataTransfer.setData("colIndex",me);const le=p[me],ee=le==null?void 0:le.label,pe=document.createElement("div");pe.textContent=ee,Object.assign(pe.style,{display:"flex",alignItems:"center",justifyContent:"center",padding:"1.5rem 2.5rem",minWidth:(xe=le==null?void 0:le.style)==null?void 0:xe.minWidth,maxWidth:(ke=le==null?void 0:le.style)==null?void 0:ke.maxWidth,fontSize:"1.2rem",fontWeight:"500",color:f.palette.primary.notifyTextColor,background:f.palette.primary.notifyBackground,border:`0.1rem solid ${f.palette.primary.notifyBorderColor}`,borderRadius:"0rem",pointerEvents:"none",position:"absolute",top:"0",left:"0",zIndex:"-1",textAlign:"center",boxSizing:"border-box",boxShadow:"0 1px 4px rgba(0, 0, 0, 0.2)"}),document.body.appendChild(pe);const{offsetWidth:ge,offsetHeight:Ee}=pe;z.dataTransfer.setDragImage(pe,ge/2,Ee/2),requestAnimationFrame(()=>{document.body.removeChild(pe)})},fe=(z,me)=>{z.preventDefault(),L(me),Ye(z)},Oe=async(z,me)=>{if(z.preventDefault(),clearInterval(U),$===null||$===me)return;const le=[...p],[ee]=le.splice($,1);le.splice(me,0,ee);const pe=p.slice().sort((Ee,xe)=>Ee.sequenceId-xe.sequenceId).map(Ee=>Ee.sequenceId),ge=le.map((Ee,xe)=>({...Ee,sequenceId:pe[xe]??Ee.sequenceId}));T({updatedColumns:ge}),B(null),L(null)},be=()=>{B(null),L(null)},Ce=(z,me,le,ee)=>{var Ke,ze,Qn,Nr,mt;if(!z)return null;const pe=(z==null?void 0:z.isMandatory)&&(z==null?void 0:z.isSticky),ge=parseFloat((ze=(Ke=z==null?void 0:z.style)==null?void 0:Ke.minWidth)==null?void 0:ze.toString().replace("rem",""))||7.5;me===0&&(X.current=0);const Ee=pe?me===0?0:`${X.current}rem`:void 0;pe&&(X.current+=ge);const xe=$===me,ke=F==me||((Qn=p==null?void 0:p[F])==null?void 0:Qn.isMandatory),Te=Qe=>{z.isMandatory?(Qe.preventDefault(),Qe.dataTransfer.dropEffect="none"):(Qe.preventDefault(),Qe.dataTransfer.dropEffect="move"),fe==null||fe(Qe,me)},Ie=Qe=>{z.isMandatory||Oe==null||Oe(Qe,me)};return ee&&`${ee==null?void 0:ee.key}${z==null?void 0:z.key}${me}`,g.jsx(Ia,{rowSpan:z!=null&&z.children?1:2,colSpan:(mt=(Nr=z==null?void 0:z.children)==null?void 0:Nr.filter(Qe=>!(Qe!=null&&Qe.isHidden)))==null?void 0:mt.length,style:z==null?void 0:z.style,draggable:le&&!(z!=null&&z.isMandatory),onDragStart:le&&!(z!=null&&z.isMandatory)?Qe=>q(Qe,me):Qe=>{Qe.preventDefault()},onDragOver:le&&!(z!=null&&z.isMandatory)?Te:void 0,onDrop:le&&!(z!=null&&z.isMandatory)?Ie:void 0,onDragEnd:le&&!(z!=null&&z.isMandatory)?be:void 0,sx:{...(z==null?void 0:z.isSticky)&&{boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...z.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...(z==null?void 0:z.key)==="volume_value"&&{borderLeft:"1px solid"}},...xe&&{border:`0.1rem solid ${f.palette.brandColor.lightBlue}!important`},...pe&&{position:"sticky",left:Ee,zIndex:3},cursor:ke?"not-allowed":le&&!(z!=null&&z.isMandatory)?"grab":"default"},children:g.jsx(Dw,{parent:ee,column:z,sort:t,handleMenuClick:h,isManageable:le})},me)},Ne=D.useCallback((z,me,le,ee)=>{var xe,ke,Te;if(!z)return null;const pe=(z==null?void 0:z.isMandatory)&&(z==null?void 0:z.isSticky),ge=parseFloat((ke=(xe=z==null?void 0:z.style)==null?void 0:xe.minWidth)==null?void 0:ke.toString().replace("rem",""))||7.5;le===0&&(X.current=0);const Ee=pe?le===0?0:`${X.current}rem`:void 0;return pe&&(X.current+=ge),g.jsxs(Ia,{colSpan:1,style:z==null?void 0:z.style,className:`${z==null?void 0:z.label}`,sx:{position:"relative",...z.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...(z==null?void 0:z.key)==="volume_value"&&{borderLeft:"1px solid"}},...(z==null?void 0:z.isSticky)&&{boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...pe&&{position:"sticky",left:Ee,zIndex:2,backgroundColor:Ie=>{var Ke;return e!=null&&e.selectedRow&&((Ke=e==null?void 0:e.selectedRow)==null?void 0:Ke.fhi)===(me==null?void 0:me.fhi)||me!=null&&me.isHigh?Ie.palette.primary.appBackground:Ie.palette.primary.notifyBackground}}},children:[((e==null?void 0:e.selectedRow)&&((Te=e==null?void 0:e.selectedRow)==null?void 0:Te.fhi)===(me==null?void 0:me.fhi)||(me==null?void 0:me.isHigh))&&g.jsx(Se,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none",zIndex:1}}),g.jsx(dh,{isRenderCellContent:!!(z!=null&&z.cellRenderer),column:z,row:me,parent:ee})]},le)},[e==null?void 0:e.selectedRow]),$e=(z,me,le,ee)=>g.jsx(g.Fragment,{children:z&&le&&!(z!=null&&z.isMandatory)?g.jsx(Se,{resizeStart:()=>{z!=null&&z.isMandatory&&!(z!=null&&z.isResizable)||(re.current=!0)},resizeEnd:pe=>{z!=null&&z.isMandatory&&!(z!=null&&z.isResizable)||pe<=20||(re.current=!1,hW({index:me,visibleGridColumns:p,width:pe,columnUpdaterFunction:T}))},component:z!=null&&z.children||z!=null&&z.isMandatory?Ul:Ow,rowSpan:z!=null&&z.children?1:2,colSpan:1,id:me,sx:{width:"1rem",maxWidth:"1rem",minWidth:"1rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${f.palette.primary.notifyBorderColor}`,cursor:"col-resize","&::after":{content:'""',position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"0.15rem",height:"1.5rem",backgroundColor:f.palette.primary.notifyBorderColor,zIndex:1},...!(z!=null&&z.isMandatory)&&{"&:hover::after":{content:'""',position:"absolute",top:0,left:"50%",transform:"translateX(-50%)",width:"0.2rem",height:`${se}px`,backgroundColor:f.palette.primary.notifyBorderColor,zIndex:1}}}}):null}),Ae=D.useCallback((z,me,le,ee,pe,ge,Ee)=>{var xe;return g.jsx(g.Fragment,{children:me&&ee&&!(me!=null&&me.isMandatory)?g.jsx(Ul,{className:"column_resizer_body",sx:{width:"1rem",maxWidth:"1rem",minWidth:"1rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${f.palette.primary.notifyBorderColor}`},children:((e==null?void 0:e.selectedRow)&&((xe=e==null?void 0:e.selectedRow)==null?void 0:xe.fhi)===(z==null?void 0:z.fhi)||(z==null?void 0:z.isHigh))&&g.jsx(Se,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none"}})},`resize-${le}_${Ee}`):null})},[e==null?void 0:e.selectedRow]),Ye=z=>{const me=O.current,{left:le,right:ee}=me.getBoundingClientRect(),pe=50,ge=z.clientX>ee-pe?1:z.clientX<le+pe?-1:0;ge!==0?(Q.current&&clearInterval(Q.current),Q.current=setInterval(()=>{me.scrollLeft+=ge*10},50)):Q.current&&(clearInterval(Q.current),Q.current=null)},ot=z=>z==null?void 0:z.map((me,le)=>{var ke;const ee=j.start+le,pe=me[ie],ge=J==null?void 0:J[pe],Ee=(e==null?void 0:e.selectedRow)&&((ke=e==null?void 0:e.selectedRow)==null?void 0:ke.fhi)===(me==null?void 0:me.fhi),xe=me==null?void 0:me.isHigh;return g.jsxs(D.Fragment,{children:[g.jsx(lW,{row:me,isSelected:Ee,isHigh:xe,onRowClick:e==null?void 0:e.onRowClick,children:p.map((Te,Ie)=>Te!=null&&Te.isHidden||(Te==null?void 0:Te.isVisible)===!1?null:Te!=null&&Te.children?Te.children.map((Ke,ze)=>Ke!=null&&Ke.isHidden?null:g.jsxs(D.Fragment,{children:[Ne(Ke,me,ze,Te),E&&Ae(me,Ke,ze,x,Te,"",ee)]},`col-${Ie}-${ze}`)):g.jsxs(D.Fragment,{children:[Ne(Te,me,Ie),E&&Ae(me,Te,Ie,x,"","",ee)]},`col-${Ie}`))}),oe&&ge&&g.jsx(cW,{nestedData:ge,nestedColumn:ce,t:d})]},`row-${ee}`)}),ct=()=>{const z=k.current;if(!z)return;const me=z.scrollTop,le=z.clientHeight,ee=Math.floor(me/P)-R,pe=Math.ceil(le/P)+2*R,ge=Math.max(0,Math.min(A-1,ee)),Ee=Math.max(ge,Math.min(A,ge+pe));I(xe=>xe.start===ge&&xe.end===Ee?xe:{start:ge,end:Ee})};D.useEffect(()=>{let z;const me=()=>{z&&cancelAnimationFrame(z),z=requestAnimationFrame(()=>{ct()})},le=k.current;if(!(!le||!u))return ct(),le.addEventListener("scroll",me),()=>{cancelAnimationFrame(z),le.removeEventListener("scroll",me)}},[A]);const We=j.start*P,ve=(A-j.end)*P,Pe=u?n==null?void 0:n.slice(j.start,j.end):n;return v?g.jsxs(g.Fragment,{children:[g.jsx(hy,{ref:k,sx:{willChange:"transform",WebkitTransform:"translateZ(0)",maxHeight:"40rem",whiteSpace:"nowrap",overflow:"auto",width:"100%",border:`0.1rem solid ${f.palette.primary.notifyBorderColor}`,borderRadius:"1.4rem",position:"relative"},children:g.jsxs(dy,{ref:O,stickyHeader:!0,"aria-label":"sticky table",sx:{backgroundColor:z=>z.palette.primary.notifyBackground},children:[g.jsxs(gy,{children:[g.jsx(qs,{sx:{position:"sticky",top:0,zIndex:3,backgroundColor:z=>z.palette.primary.notifyBackground},children:p.map((z,me)=>z!=null&&z.isHidden||(z==null?void 0:z.isVisible)===!1?null:g.jsxs(D.Fragment,{children:[Ce(z,me,x),$e(z,me,x)]},me))}),g.jsx(qs,{draggable:!1,sx:{position:"sticky",top:"2.5rem",backgroundColor:f.palette.primary.notifyBackground,zIndex:2},children:p.flatMap((z,me)=>z!=null&&z.isHidden||!(z!=null&&z.children)||(z==null?void 0:z.isVisible)===!1?[]:z.children.map((le,ee)=>le!=null&&le.isHidden?null:g.jsxs(D.Fragment,{children:[Ce(le,ee,x,z),E&&$e(le,ee,x)]},`${me}-${ee}`)))})]}),g.jsxs(py,{children:[u&&g.jsx("tr",{style:{height:We}}),ot(Pe),u&&g.jsx("tr",{style:{height:ve}})]})]})}),r&&g.jsx(kw,{pagination:r,gridPath:l,baseUrl:a,t:d}),g.jsx(Mw,{menuOpen:m==null?void 0:m.isOpen,handleClose:b,onHideClick:w})]}):g.jsx(Po,{sx:{textAlign:"center"},children:d(Jr.NRF)})}Rw.propTypes={sort:s.object,data:s.array,pagination:s.object,columns:s.object,nested:s.object};function Iw({tableProps:e,isDefaultConfig:t,gridPath:n,baseUrl:r,childUniqueKey:o,t:i}){var u;const{columns:a}=e,l=D.useContext(Ta),c=J7({columns:a,gridPath:n,baseUrl:r,isDefaultConfig:t,childUniqueKey:o,pageSize:(u=e==null?void 0:e.pagination)==null?void 0:u.rowPerPage,data:e==null?void 0:e.data});return D.useEffect(()=>{var d;c!=null&&c.length&&((d=e==null?void 0:e.data)!=null&&d.length)&&(l==null||l({type:qe.SET_GRID_DATA,payload:{visibleGridColumns:c}}))},[c,e==null?void 0:e.data]),g.jsx(Rw,{...e,gridPath:n,baseUrl:r,childUniqueKey:o,t:i})}Iw.propTypes={tableProps:s.object.isRequired,mergedColumns:s.array.isRequired};const Aw=({type:e})=>{const t=Ot(),r=(t==null?void 0:t.mode)==="dark"?{bgcolor:"grey.800"}:{};return{grid:g.jsxs(Se,{sx:{borderRadius:2,overflow:"hidden"},children:[g.jsx(Tr,{variant:"text",width:"100%",height:60,sx:r}),Array.from({length:10}).map((i,a)=>g.jsx(Se,{sx:{display:"flex",alignItems:"center",padding:"0.5rem",gap:"3rem"},children:Array.from({length:5}).map((l,c)=>g.jsx(Se,{sx:{flex:1},children:g.jsx(Tr,{variant:"text",height:45,sx:r})},c))},a))]}),toolbar:g.jsx(g.Fragment,{children:g.jsxs(rt,{direction:"row",justifyContent:"space-between",sx:{display:"flex",gap:"1rem"},children:[g.jsxs(rt,{direction:"row",gap:"1rem",children:[g.jsx(Tr,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),g.jsx(Tr,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),g.jsx(Tr,{variant:"text",width:"15.2rem",height:"5rem",sx:r})]}),g.jsxs(rt,{direction:"row",gap:"1rem",children:[g.jsx(Tr,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),g.jsx(Tr,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),g.jsx(Tr,{variant:"text",width:"3.5rem",height:"5rem",sx:r})]})]})})}[e]},mW=({customTools:e})=>{var r,o;const t=(r=e==null?void 0:e.filter(i=>(i==null?void 0:i.type)===Tw.PRIMARY))==null?void 0:r.sort((i,a)=>i.sequenceId-a.sequenceId),n=(o=e==null?void 0:e.filter(i=>(i==null?void 0:i.type)===Tw.SECONDARY))==null?void 0:o.sort((i,a)=>i.sequenceId-a.sequenceId);return{primaryButtons:t,secondaryButtons:n}},Nw=({customTools:e,isExpanded:t,setIsExpanded:n})=>{const{primaryButtons:r,secondaryButtons:o}=mW({customTools:e}),[i,a]=D.useState(r),l=(o==null?void 0:o.length)>0,c=d=>{d?a([...r,...o]):setTimeout(()=>{a(r)},100)},u=()=>{const d=!t;n(d),c(d)};return D.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(Se,{sx:{display:"flex",alignItems:"center",gap:"0.8rem",flexWrap:"nowrap",maxWidth:"100%",whiteSpace:"nowrap",zIndex:999},children:[g.jsx(NN,{mode:"popLayout",children:i.map((d,f)=>g.jsx(Ps.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},layout:!0,children:g.jsx(Se,{sx:{flexShrink:0,minWidth:"fit-content"},children:dW(d)})},`${d.id}_${f}`))}),l&&g.jsx(Se,{sx:{paddingLeft:t?"0.5rem":0},children:g.jsx(Mr,{label:t?"":"More Actions",styles:{iconPrimary:!0,icon:t?Je.CrossWhite:Je.More,colorType:t?"danger":""},onClick:u})})]})]})};Nw.propTypes={customTools:s.array.isRequired};const jw=({defaultTools:e,isManageable:t,customTools:n,baseUrl:r,gridPath:o,pageSize:i,gridData:a,childUniqueKey:l})=>{var T,x,E,v,O,k;const c=D.useContext(Ta),{visibleGridColumns:u,triggerApi:d}=D.useContext(jc),[f,p]=D.useState([]),[y,m]=D.useState(!1);D.useEffect(()=>{if(u.length){const P={id:99999,sequenceId:99999,isLocalizable:!1,key:"horizons",label:"Horizons",isSortable:!1,isHidden:!0,showChildCheckbox:!0,showCheckbox:!1,isMandatory:!0,showInHierarchy:!0,showHide:!0,children:[]};let R=u.map(j=>(j!=null&&j.children&&j.children.forEach(I=>{P.children.some(_=>_.key===I.key)||P.children.push({...I,showInHierarchy:!0})}),j)).filter(j=>(j==null?void 0:j.id)!==(P==null?void 0:P.id));const A=P.children.length>0?[...R,P]:R;p(A)}},[u]);const h=async P=>{try{await pW({baseUrl:r,gridPath:o,childUniqueKey:l,gridSetting:{grid:P,pageSize:i}})}catch(R){console.error(R)}finally{c({type:qe.HAS_SETTING_CHANGE,payload:{hasChange:!1}}),c({type:qe.TRIGGER_API,payload:{triggerApi:!1}})}};D.useEffect(()=>{d&&h(u)},[d]);const b=P=>{var I;const R=P==null?void 0:P.map(N=>N.id),A=(I=P==null?void 0:P.flatMap(N=>N.children||[]))==null?void 0:I.map(N=>N.id),j=f==null?void 0:f.map(N=>{var B,F,L;const _=R==null?void 0:R.includes(N.id);if(Array.isArray(N.children)&&N.children.length>0){const H=(B=N==null?void 0:N.children)==null?void 0:B.map(U=>{var re;const X=(re=A==null?void 0:A.includes)==null?void 0:re.call(A,U.id);return{...U,isHidden:!X}}),V=(F=H==null?void 0:H.filter(U=>f==null?void 0:f.some(X=>{var re;return(re=X.children)==null?void 0:re.some(Q=>Q.id===U.id)})))==null?void 0:F.every(U=>U.isHidden);return{...N,...!((L=N.children[0])!=null&&L.showInHierarchy)&&{isHidden:V||!_},children:H}}return{...N,isHidden:!_}});c({type:qe.SET_GRID_DATA,payload:{visibleGridColumns:j}}),c({type:qe.HAS_SETTING_CHANGE,payload:{hasChange:!0}})},w=()=>f.map(R=>{const A=Array.isArray(R.children)?R.children.filter(j=>!j.isHidden):void 0;return!R.isHidden||R.isHidden&&R.showInHierarchy?{...R,children:A}:null}).filter(Boolean);return g.jsxs(Se,{sx:{margin:"1rem 0",position:"relative",zIndex:10,display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"0.6rem",width:"100%"},children:[g.jsxs(Se,{sx:{display:"flex",flexDirection:"row",gap:"0.6rem"},children:[((T=e==null?void 0:e.search)==null?void 0:T.isRequired)&&g.jsx(R1,{...e==null?void 0:e.search,iconUrl:Je.Search}),((x=e==null?void 0:e.refresh)==null?void 0:x.isRequired)&&g.jsx(Mr,{...e==null?void 0:e.refresh,styles:{variant:"filled",icon:Je.Refresh,colorType:"empty",width:"3.2rem",height:"3.2rem"}}),((E=e==null?void 0:e.groupBy)==null?void 0:E.isRequired)&&g.jsx(Se,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:g.jsx(Ws,{styles:{icon:Je.Group},...e.groupBy})}),t&&g.jsx(Se,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:g.jsx(Ws,{placeholder:"Manage Columns",options:f,value:w(),isMulti:!0,isDraggable:!0,showSearch:!0,isManageColumn:!0,onChange:b,disabled:!a.length,styles:{icon:Je.Manage}})})]}),g.jsxs(Se,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",gap:"0.6rem"},children:[n&&g.jsx(Nw,{customTools:n,setIsExpanded:m,isExpanded:y}),((v=e==null?void 0:e.save)==null?void 0:v.isRequired)&&g.jsx(Se,{sx:{px:"0.5rem"},children:g.jsx(Mr,{label:y?"":"Save",styles:{icon:Je.Save,colorType:"empty"},...e==null?void 0:e.save})}),((O=e==null?void 0:e.upload)==null?void 0:O.isRequired)&&g.jsx(Mr,{...e==null?void 0:e.upload,styles:{variant:y?"outlined":"filled",icon:y?Je.UploadDark:Je.Upload,iconPrimary:!y,colorType:"secondary",isAnimate:!0}}),((k=e==null?void 0:e.download)==null?void 0:k.isRequired)&&g.jsx(Mr,{...e==null?void 0:e.download,styles:{variant:"outlined",icon:Je.Download,isAnimate:!0}})]})]})};jw.propTypes={defaultTools:s.object.isRequired,customTools:s.array,isManageable:s.bool,baseUrl:s.string,gridPath:s.gridPath};function ph({tableProps:e,toolbarProps:t,isDefaultConfig:n,isLoading:r,t:o}){var a,l,c;const i=(a=e.columns)==null?void 0:a.isManageable;return g.jsx(k1,{children:r||!((l=e==null?void 0:e.data)!=null&&l.length)?g.jsxs(g.Fragment,{children:[t&&g.jsx(Aw,{type:"toolbar"}),e&&g.jsx(Aw,{type:"grid"})]}):g.jsxs(Se,{sx:{position:"sticky"},children:[t&&g.jsx(jw,{...t,isManageable:i,pageSize:(c=e==null?void 0:e.pagination)==null?void 0:c.rowPerPage,gridData:e==null?void 0:e.data,t:o}),g.jsx(Iw,{tableProps:e,isDefaultConfig:n,gridPath:(t==null?void 0:t.gridPath)||"",baseUrl:(t==null?void 0:t.baseUrl)||"",childUniqueKey:(t==null?void 0:t.childUniqueKey)||"",t:o})]})})}ph.propTypes={tableProps:s.object.isRequired,toolbarProps:s.object,isDefaultConfig:s.bool};const _w=({list:e,handleLinkClick:t})=>{const n=Ot(),r=({list:o})=>{var i;return(i=o==null?void 0:o.sort((a,l)=>a.order-l.order))==null?void 0:i.map((a,l)=>a!=null&&a.link?g.jsx(Wr,{component:"h3",sx:{fontSize:"1rem",cursor:"pointer",color:l===(o==null?void 0:o.length)-1?n.palette.brandColor.orange:n.palette.primary.notifyTextColor},href:a==null?void 0:a.link,underline:"hover",onClick:()=>t(a),children:a==null?void 0:a.title},l):g.jsx(nt,{component:"h3",sx:{fontSize:"1rem",color:l===(o==null?void 0:o.length)-1?n.palette.brandColor.orange:n.palette.primary.notifyTextColor},children:a==null?void 0:a.title},l))};return g.jsx(mg,{separator:g.jsx(mn,{url:Je.ArrowRight}),children:r({list:e})})};_w.propTypes={list:s.array.isRequired,handleLinkClick:s.func};const Fw=({breadcrumbProps:e,switchProps:t,filterComponentProps:n,metaDataProps:r})=>{var a,l,c,u,d,f,p,y;const o=Ot(),i=(a=n==null?void 0:n.filterBtnProps)==null?void 0:a.disabled;return g.jsxs(g.Fragment,{children:[g.jsxs(rt,{sx:{background:o.palette.primary.notifyBackground,borderBottom:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,height:"3rem",p:"0px 1.5rem 0 1.5rem",zIndex:4,position:"relative"},direction:"row",justifyContent:"space-between",alignItems:"center",children:[g.jsx(_w,{...e}),g.jsxs(rt,{direction:"row",gap:"1rem",alignItems:"center",children:[r,t&&g.jsx(_1,{...t}),(n==null?void 0:n.filterBtnProps)&&g.jsxs(rt,{direction:"row",children:[g.jsx(Ii,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"2rem!important",opacity:"1!important",borderColor:o.palette.primary.notifyBorderColor}}),g.jsxs(rt,{direction:"row",alignItems:"center",gap:"0.5rem",onClick:(l=n==null?void 0:n.filterBtnProps)==null?void 0:l.onFilterClick,sx:{opacity:i?.5:1,cursor:i?"not-allowed":"pointer"},children:[g.jsx(mn,{url:Je.Filter}),g.jsx(nt,{sx:{fontSize:"1.1rem",color:o.palette.primary.notifyActiveText},children:(c=n==null?void 0:n.filterBtnProps)==null?void 0:c.label})]})]})]})]}),g.jsx(Ps.div,{layout:!0,initial:{height:"0rem"},animate:{height:(u=n==null?void 0:n.filterBtnProps)!=null&&u.filterContainerVisible?"5rem":"0rem",opacity:(d=n==null?void 0:n.filterBtnProps)!=null&&d.filterContainerVisible?1:0},transition:{duration:.5,ease:"easeInOut"},style:{background:o.palette.primary.notifyBackground,borderBottom:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,padding:"0px 5.5rem 0 1.5rem",position:"relative",alignItems:"center",display:"flex",overflow:"hidden",width:(f=n==null?void 0:n.filterContainerProps)!=null&&f.isSideDrawerOpen?"75%":"100%"},children:g.jsxs(rt,{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(nt,{sx:{fontSize:"1.2rem",fontWeight:"500",color:o.palette.primary.notifyActiveText},children:"Filters:"}),g.jsx(Se,{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(rt,{direction:"row",gap:"1.2rem",sx:{overflow:"visible"},children:(p=n==null?void 0:n.filterItems)==null?void 0:p.map((m,h)=>g.jsx(g.Fragment,{children:g.jsxs(Se,{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(Se,{component:"img",src:Je.FilterClose,sx:{position:"absolute",top:"-0.4rem",right:"-0.6rem",cursor:"pointer"},onClick:()=>n==null?void 0:n.onFilterChipClose(m)}),g.jsx(nt,{sx:{fontSize:"1rem",color:o.palette.primary.notifyTextColor},children:m==null?void 0:m.filterLabel})]},h)}))})}),g.jsx(Se,{component:nt,sx:{fontSize:"1.1rem",fontWeight:"500",textDecoration:"underline",color:o.palette.brandColor.red,cursor:"pointer"},onClick:(y=n==null?void 0:n.filterContainerProps)==null?void 0:y.onClearClick,children:"Clear"})]})})]})};Fw.propTypes={breadcrumbProps:s.object.isRequired,switchProps:s.object};function $w({headerProps:e}){return g.jsx(En,{children:g.jsx(Fw,{...e})})}$w.propTypes={headerProps:s.object.isRequired};const hh=D.createContext(null),Lw=D.createContext(null);function Bw({children:e}){const[t,n]=D.useReducer(gW,yW);return g.jsx(hh.Provider,{value:t,children:g.jsx(Lw.Provider,{value:n,children:e})})}function gW(e,t){var n;switch(t.type){case qe.LOADING:return{...e,loading:t.loading};case qe.SUCCESS:return{...e,data:(n=t.data)==null?void 0:n.sort((r,o)=>new Date(o.createdAt)-new Date(r.createdAt))};case qe.MARK_ALL_AS_READ:return{...e,isMarkAllAsRead:t.isMarkAllAsRead};case qe.SET_ACTIVE_TAB:return{...e,activeTab:t.activeTab};case qe.SET_MODE:return{...e,mode:t.mode};case qe.ERROR:return{...e,error:t.error};default:throw new Error(`${Jr.UNHANDLED}: ${t}`)}}const yW={loading:!1,data:[],error:"",isMarkAllAsRead:{count:0,boo:!1},mode:!1,activeTab:0},{TENANT_ID:mh,BU_ID:gh}=Sw,{TENANT_IDS:yh,BU_IDS:bh}=Ew,bW=async e=>{try{const t=localStorage.getItem("i18nextLng"),n=`${e}${qc.NOTIFICATION}/v1?${mh}=${yh}&${gh}=${bh}&lang=${t}`;return await St.get(n,Da)}catch(t){return t}},Vw=async(e,t,n)=>{try{const r=localStorage.getItem("i18nextLng"),o=`${e}${qc.NOTIFICATION}${sh.VERSION}?${mh}=${yh}&${gh}=${bh}&lang=${r}`;return await St.put(o,t,Da)}catch(r){return r}},vW=async({baseUrl:e,id:t,snopId:n})=>{try{const r=localStorage.getItem("i18nextLng"),o=`${e}${qc.NOTIFICATION}${sh.VERSION}?${mh}=${yh}&${gh}=${bh}&id=${t}&lang=${r}`;return await St.get(o,Da)}catch(r){return r}},Ys={OK:200,CREATED:201,NO_CONTENT:204,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,INTERNAL_SERVER_ERROR:500},Ww=({baseUrl:e})=>{const t=D.useContext(Lw),[n,r]=D.useState(!1),[o,i]=D.useState(!1),[a,l]=D.useState(!1),[c,u]=D.useState({}),[d,f]=D.useState(null),[p,y]=D.useState(1),m=D.useRef(!1),{loading:h,data:b,isMarkAllAsRead:w,mode:T,activeTab:x}=D.useContext(hh),[E,v]=D.useState([]);D.useEffect(()=>{v(b)},[b]);const O=D.useCallback(async()=>{var N,_,$;if(!(m.current||!e))try{t({type:qe.LOADING,loading:!0}),t({type:qe.SUCCESS,data:[]});const B=await bW(e);if(B.status===Ys.UNAUTHORIZED){m.current=!0;return}if(B.status===Ys.OK){const F=((_=(N=B.data)==null?void 0:N.responseData)==null?void 0:_.response)||[],L=Nc(F);t({type:qe.SET_MODE,mode:!1}),t({type:qe.SUCCESS,data:Nc(L)}),t({type:qe.MARK_ALL_AS_READ,isMarkAllAsRead:{count:O1(F),boo:O1(F)>0}})}}catch(B){(($=B==null?void 0:B.response)==null?void 0:$.status)===Ys.UNAUTHORIZED&&(m.current=!0),t({type:qe.ERROR,error:Jr.SWR})}finally{t({type:qe.LOADING,loading:!1})}},[e,t]),k=N=>{const _=(b||[]).filter($=>T?!$.isRead:!0);return{0:_,1:_.filter($=>($==null?void 0:$.type)==="INFO"),2:_.filter($=>($==null?void 0:$.type)==="ERROR")}};D.useEffect(()=>{O();const N=setInterval(O,3e5);return()=>clearInterval(N)},[O]);const P=async(N,_)=>{var $,B;if(!(!N||!e)){f(N);try{const F=await vW({baseUrl:e,id:N,snopId:_});if(F.status===Ys.OK){const L=((B=($=F.data)==null?void 0:$.responseData)==null?void 0:B.response)||{};u(L||{}),l(!0)}else throw new Error}catch{t({type:qe.ERROR,error:Jr.SWR})}finally{f(null)}}},R=async(N,_)=>{if(!(!N.length||!e)){t({type:qe.LOADING,loading:!0});try{if((await Vw(e,N,_)).status===Ys.OK){const B=b.map(L=>N.includes(L.id)?{...L,isRead:!0}:L),F=B.filter(L=>!L.isRead).length;F===0&&t({type:qe.SET_MODE,mode:!1}),t({type:qe.SUCCESS,data:Nc(B)}),t({type:qe.MARK_ALL_AS_READ,isMarkAllAsRead:{count:F,boo:F>0}}),setTimeout(()=>{t({type:qe.LOADING,loading:!1})},200)}}catch{t({type:qe.ERROR,error:Jr.SWR}),t({type:qe.LOADING,loading:!1})}}},A=async()=>{if(e){t({type:qe.LOADING,loading:!0});try{const N=VV(b);if((await Vw(e,N,H7.MARK_ALL_READ)).status===Ys.OK){const $=b.map(B=>({...B,isRead:!0}));t({type:qe.SET_MODE,mode:!1}),t({type:qe.SUCCESS,data:Nc($)}),t({type:qe.MARK_ALL_AS_READ,isMarkAllAsRead:{count:0,boo:!1}}),setTimeout(()=>{t({type:qe.LOADING,loading:!1})},200)}}catch{t({type:qe.ERROR,error:Jr.SWR}),t({type:qe.LOADING,loading:!1})}}},j=(N,_)=>{t({type:qe.LOADING,loading:!0}),t({type:qe.SET_ACTIVE_TAB,activeTab:_}),setTimeout(()=>{t({type:qe.LOADING,loading:!1})},400)},I=()=>{t({type:qe.LOADING,loading:!0});const N=T?b||[]:(E||[]).filter(_=>!_.isRead);t({type:qe.SET_MODE,mode:!T}),v(N),y(1),setTimeout(()=>{t({type:qe.LOADING,loading:!1})},400)};return{fetchNotification:O,showDetailsProps:{open:a,handleClose:()=>l(!1),setOpen:l,data:c,clickId:d},alertDialogProps:{open:n,handleClose:()=>r(!1),onRefresh:O,handleRead:R,handleMarkAllAsRead:A,setOpen:r,handleShowDetails:P,clickId:d,isMainDialog:!0},activeTab:x,loading:h,tabData:k()[x],data:E,mode:T,handleTabChange:j,toggleAlertMode:I,page:p,setPage:y,isMarkAllAsRead:w}};var zw,Hw,Uw;function vh(){return vh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vh.apply(null,arguments)}var xW=function(t){return S.createElement("svg",vh({xmlns:"http://www.w3.org/2000/svg",width:16,height:17,fill:"none"},t),zw||(zw=S.createElement("path",{stroke:"#909090",strokeLinecap:"round",strokeMiterlimit:10,d:"M8.013 2.19c-2.206 0-4 1.793-4 4v1.927c0 .406-.173 1.026-.38 1.373l-.766 1.273c-.474.787-.147 1.66.72 1.954 2.873.96 5.973.96 8.846 0a1.335 1.335 0 0 0 .72-1.954l-.766-1.273c-.2-.347-.374-.967-.374-1.373V6.19c0-2.2-1.8-4-4-4Z"})),Hw||(Hw=S.createElement("path",{stroke:"#909090",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10,d:"M9.247 2.383a4.503 4.503 0 0 0-2.467 0 1.324 1.324 0 0 1 2.467 0"})),Uw||(Uw=S.createElement("path",{stroke:"#909090",strokeMiterlimit:10,d:"M10.013 12.957c0 1.1-.9 2-2 2a2.007 2.007 0 0 1-2-2"})))};const wW=({count:e})=>(Ot(),g.jsxs(g.Fragment,{children:[g.jsx(Se,{sx:{gap:"0.5rem",display:"flex",justifyContent:"center",alignItems:"center","& svg":{transform:"scale(1)"}},children:g.jsx(xW,{style:{scale:2}})}),g.jsx(oW,{badgeContent:e!=0?"":null,color:"error"})]}));function qw({children:e,handleClose:t,open:n,isMainDialog:r}){return g.jsx(jl,{open:n,onClose:t,scroll:r?"paper":void 0,fullWidth:!r,maxWidth:r?void 0:"md",PaperProps:{sx:r?{position:"fixed",top:30,right:30,m:0,width:400,height:450,display:"flex",flexDirection:"column",borderRadius:2,boxShadow:6,backgroundColor:o=>o.palette.primary.notifyBackground}:{minHeight:250,maxHeight:500,borderRadius:"1.5rem",boxShadow:6,backgroundColor:o=>o.palette.primary.appBackground}},children:e})}var Yw;function xh(){return xh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},xh.apply(null,arguments)}var CW=function(t){return S.createElement("svg",xh({xmlns:"http://www.w3.org/2000/svg",width:14,height:9,fill:"none",viewBox:"0 0 13 9"},t),Yw||(Yw=S.createElement("path",{fill:"#A8A8A8",fillRule:"evenodd",d:"M8.954 1.004a.406.406 0 0 1 0 .575L3.537 6.996a.406.406 0 0 1-.574 0L.796 4.829a.406.406 0 1 1 .575-.575l1.879 1.88 5.13-5.13a.406.406 0 0 1 .574 0m3.25 0a.406.406 0 0 1 0 .575L6.787 6.996a.406.406 0 1 1-.574-.575l5.416-5.417a.406.406 0 0 1 .575 0",clipRule:"evenodd"})))},Gw,Kw;function wh(){return wh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},wh.apply(null,arguments)}var SW=function(t){return S.createElement("svg",wh({xmlns:"http://www.w3.org/2000/svg",width:12,height:12,fill:"none"},t),Gw||(Gw=S.createElement("path",{stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"round",d:"M7.79 6c0 .99-.8 1.79-1.79 1.79S4.21 6.99 4.21 6 5.01 4.21 6 4.21s1.79.8 1.79 1.79"})),Kw||(Kw=S.createElement("path",{stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"round",d:"M6 10.135c1.765 0 3.41-1.04 4.555-2.84.45-.705.45-1.89 0-2.595C9.41 2.9 7.765 1.86 6 1.86S2.59 2.9 1.445 4.7c-.45.705-.45 1.89 0 2.595 1.145 1.8 2.79 2.84 4.555 2.84"})))},Xw;function Ch(){return Ch=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ch.apply(null,arguments)}var TW=function(t){return S.createElement("svg",Ch({xmlns:"http://www.w3.org/2000/svg",width:9,height:8,fill:"none"},t),Xw||(Xw=S.createElement("path",{fill:"#fff",fillRule:"evenodd",d:"M8.277 1.004a.406.406 0 0 1 0 .575L2.86 6.996a.406.406 0 0 1-.574 0L.119 4.829a.406.406 0 1 1 .575-.575l1.879 1.88 5.13-5.13a.406.406 0 0 1 .574 0",clipRule:"evenodd"})))};const Zw=({type:e,item:t,handleShowDetails:n,handleRead:r,handleCTAClicked:o,clickId:i,t:a})=>{var u,d;const l=Ot(),c=(d=(u=JSON.parse(localStorage.getItem("settings")))==null?void 0:u.platform)==null?void 0:d.theme;return g.jsxs(Se,{className:"cards",sx:{pt:" 0.8rem"},children:[g.jsx(rt,{display:"flex",flexDirection:"row",alignItems:"start",justifyContent:"space-between",gap:1,children:g.jsx(hd,{sx:{width:"calc(100% - 2%)","& .MuiBadge-badge":{backgroundColor:"#6041EA",height:"0.5rem",minWidth:"0.5rem"}},variant:"dot",invisible:t==null?void 0:t.isRead,children:g.jsx(Po,{sx:{color:l.palette.primary.notifyActiveText,whiteSpace:"normal",wordBreak:"break-word"},component:"p",className:["title-card",(t==null?void 0:t.isRead)&&"read"].join(" "),children:a(t==null?void 0:t.message)})})}),g.jsx(rt,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:g.jsxs(rt,{display:"flex",flexDirection:"row",justifyContent:"start",gap:1,sx:{p:"0.5rem 0"},children:[(t==null?void 0:t.isNotificationDetails)&&g.jsx(Kc,{icon:g.jsx(SW,{className:`${c==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:n,label:i===(t==null?void 0:t.id)?g.jsx(Mi,{color:"primary",size:13}):a("SHOW_DETAILS"),component:"button",variant:"filled",clickable:!0,size:"small",sx:{backgroundColor:l.palette.brandColor.orange,color:l.palette.brandColor.white}}),!(t!=null&&t.isRead)&&g.jsx(Kc,{icon:g.jsx(TW,{className:`${c==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:r,label:a("ACKNOWLEDGE"),component:"button",variant:"outlined",clickable:!0,size:"small"}),(t==null?void 0:t.primaryCTAURL)&&g.jsx(Kc,{disabled:t==null?void 0:t.isPrimaryCTAClicked,onClick:()=>o({redirect:t==null?void 0:t.isPrimaryCTARedirect,isClicked:t==null?void 0:t.isPrimaryCTAClicked,url:t==null?void 0:t.primaryCTAURL}),label:a(t==null?void 0:t.primaryCTALabel),component:"button",variant:"outlined",clickable:!0,size:"small"}),(t==null?void 0:t.secondaryCTAURL)&&g.jsx(Kc,{disabled:t==null?void 0:t.isSecondaryCTAClicked,onClick:()=>o({redirect:t==null?void 0:t.isSecondaryCTARedirect,isClicked:t==null?void 0:t.isSecondaryCTAClicked,url:t==null?void 0:t.secondaryCTAURL}),label:a(t==null?void 0:t.secondaryCTALabel),component:"button",variant:"outlined",clickable:!0,size:"small"})]})}),g.jsxs(rt,{display:"flex",flexDirection:"row",alignItems:"center",gap:.35,children:[g.jsx(Po,{sx:{fontSize:"0.8rem"},children:a(t==null?void 0:t.product)}),g.jsx(Po,{color:l.palette.primary.notifyTextColor,children:"•"}),g.jsx(Po,{sx:{fontSize:"0.8rem"},children:BV(t==null?void 0:t.createdAt)})]})]})};Zw.propTypes={type:s.string,title:s.string,subTitle:s.string,isRead:s.bool,handleShowDetails:s.func,handleRead:s.func};const Jw=({data:e,handleRead:t,handleShowDetails:n,clickId:r,mode:o,page:i,setPage:a,t:l})=>{const{isMarkAllAsRead:c}=D.useContext(hh),u=new Date,d=new Intl.DateTimeFormat("en-US",{day:"numeric",month:"long",year:"numeric"}).format(u),[f,p]=D.useState([]),[y,m]=D.useState(!1),[h,b]=D.useState(!0),w=D.useRef(null),T=async E=>{m(!0);const v=e.slice((E-1)*10,E*10);await new Promise(O=>setTimeout(O,1e3)),p(O=>{const k=v.filter(P=>!O.some(R=>R.id===P.id));return[...O,...k]}),m(!1),(f==null?void 0:f.length)>=(e==null?void 0:e.length)&&b(!1)};D.useEffect(()=>{var v;let E=[];o?c!=null&&c.count?E=(v=e==null?void 0:e.filter(O=>!O.isRead))==null?void 0:v.slice(0,10):E=[]:E=e.slice(0,10),(E==null?void 0:E.length)<10&&b(!1),p(E)},[e,o,c]),D.useEffect(()=>{h&&i!==1&&T(i)},[i,e]),D.useEffect(()=>{p([...e])},[e]),D.useEffect(()=>{const E=new IntersectionObserver(v=>{v[0].isIntersecting&&!y&&h&&a(O=>O+1)},{threshold:1});return w.current&&E.observe(w.current),()=>{w.current&&E.unobserve(w.current)}},[y,h]);const x=({redirect:E,isClicked:v,url:O})=>{window.open(O,"_blank")};return g.jsxs(Se,{sx:{width:"100%"},children:[Object.entries(HV(f)).map(([E,v])=>{const O=localStorage.getItem("i18nextLng"),k=new Date(E),P=new Intl.DateTimeFormat(O,{month:"long"}).format(k),R=k.getDate(),A=k.getFullYear(),j=`${P} ${R}, ${A}`;return g.jsxs(D.Fragment,{children:[E!==d&&g.jsx(rW,{children:j}),v.map((I,N)=>g.jsx(D.Fragment,{children:g.jsx(Zw,{item:I,handleCTAClicked:x,handleShowDetails:()=>n(I.id,I.snopId),handleRead:()=>t([I.id],I.snopId),clickId:r,t:l})},`${N}_${I.id}`))]},E)}),y&&i>1&&!!(f!=null&&f.length)&&g.jsx(Se,{sx:{display:"flex",justifyContent:"center",alignItems:"center",pl:"0.5rem",py:"0.3rem"},children:g.jsx(Mi,{size:20,sx:{color:E=>E.palette.primary.notifyIconColor}})}),!(f!=null&&f.length)&&g.jsx(nt,{sx:{fontSize:"1.1rem",color:E=>E.palette.primary.notifyTextColor,textAlign:"center",px:"0.8rem"},children:l("CONTAINER_MESSAGE")}),g.jsx(Se,{ref:w,style:{height:"0.1rem",backgroundColor:"transparent"}})]})};Jw.propTypes={data:s.array,handleRead:s.func,handleShowDetails:s.func};const EW=({onRefresh:e,handleShowDetails:t,clickId:n,handleRead:r,handleMarkAllAsRead:o,t:i})=>{var h,b,w,T;const{loading:a,activeTab:l,data:c,tabData:u,mode:d,page:f,setPage:p,handleTabChange:y,toggleAlertMode:m}=Ww({});return g.jsxs(g.Fragment,{children:[g.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,pt:2},children:[g.jsx(nt,{variant:"h2",sx:{fontSize:"1.2rem",color:x=>x.palette.primary.notifyTextColor},children:i("NOTIFICATION")}),g.jsx(Se,{onClick:e,children:g.jsx(mn,{url:Je.Refresh,alt:"refresh",sx:{cursor:"pointer"}})})]}),g.jsx(Se,{sx:{borderBottom:1,m:"1.2rem 1.2rem 0 1.2rem",borderColor:x=>x.palette.primary.notifyBorderColor},children:g.jsxs(sW,{value:l,onChange:y,children:[g.jsx(fh,{label:g.jsx(Se,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:g.jsx(nt,{component:"span",sx:{fontWeight:500,fontSize:"1rem"},children:i("ALL",{count:((h=c==null?void 0:c.filter(x=>!(x!=null&&x.isRead)))==null?void 0:h.length)||0})})})}),g.jsx(fh,{label:g.jsx(Se,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:g.jsx(nt,{component:"span",sx:{fontWeight:500,fontSize:"1rem"},children:i("INFO",{count:((b=c==null?void 0:c.filter(x=>(x==null?void 0:x.type)==="INFO"&&!(x!=null&&x.isRead)))==null?void 0:b.length)||0})})}),sx:{color:x=>x.palette.brandColor.blue}}),g.jsx(fh,{label:g.jsx(Se,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:i("ERROR",{count:((w=c==null?void 0:c.filter(x=>(x==null?void 0:x.type)==="ERROR"&&!(x!=null&&x.isRead)))==null?void 0:w.length)||0})}),sx:{color:x=>x.palette.brandColor.red}})]})}),g.jsx(Fl,{dividers:!0,sx:{p:0,...a&&!u.length&&{alignItems:"center",justifyContent:"center"},flexGrow:1,overflowY:"auto",mx:"1.2rem",borderColor:x=>x.palette.primary.notifyBorderColor},tabIndex:-1,children:a?g.jsx(Mi,{size:30,sx:{color:x=>x.palette.primary.notifyIconColor}}):g.jsx(g.Fragment,{children:g.jsx(Jw,{data:u,handleShowDetails:t,handleRead:r,clickId:n,page:f,setPage:p,mode:d,t:i})})}),g.jsxs(_l,{sx:{justifyContent:"space-between",px:"1.2rem"},children:[g.jsxs(rt,{direction:"row",gap:1,children:[g.jsx(Po,{sx:{fontSize:"1rem"},children:i("SHOW_UNREAD")}),g.jsx(nW,{disabled:a,checked:d,onChange:m})]}),g.jsx(qn,{variant:"outlined",className:"view-all",onClick:o,startIcon:g.jsx(CW,{}),disabled:!((T=c==null?void 0:c.filter(x=>!(x!=null&&x.isRead)))!=null&&T.length),style:{backgroundColor:"transparent"},sx:{fontSize:"1rem",fontWeight:"300",p:0,border:"none",textTransform:"none",color:x=>x.palette.primary.notifyTextColor,"&:hover":{color:x=>x.palette.primary.notifyActiveText,background:"transparent",boxShadow:"none",border:"none"},"&.Mui-disabled":{opacity:.5,color:x=>`${x.palette.primary.notifyActiveText}!important`,background:"transparent",boxShadow:"none",border:"none"}},children:i("READ_ALL")})]})]})},OW=({data:e,handleClose:t,t:n})=>{var w;const[r,o]=D.useState(1),[i,a]=D.useState(10),[l,c]=D.useState(((w=e==null?void 0:e.notificationDetails)==null?void 0:w.length)||0),[u,d]=D.useState("sku_name"),[f,p]=D.useState("asc"),[y,m]=D.useState([]),[h,b]=D.useState("");return D.useEffect(()=>{var T,x;if((h||u)&&((T=e==null?void 0:e.notificationDetails)!=null&&T.length)){const E=WV(e==null?void 0:e.notificationDetails,W7,h);if(u){const v=zV(E,u,f);m(Vp(v,r,i)),c((v==null?void 0:v.length)||0);return}m(Vp(E,r,i)),c((E==null?void 0:E.length)||0);return}m(Vp(e==null?void 0:e.notificationDetails,r,i)),c((x=e==null?void 0:e.notificationDetails)==null?void 0:x.length)},[h,e,r,i,f,u]),g.jsxs(g.Fragment,{children:[g.jsxs(rt,{direction:"row",justifyContent:"space-between",sx:{padding:"1.5rem 2rem",borderBottom:"0.1rem solid",borderColor:T=>T.palette.primary.notifyBorderColor},children:[g.jsx(nt,{component:"h2",sx:{fontSize:"1.4rem",color:T=>T.palette.primary.notifyActiveText},children:n(e==null?void 0:e.message)||(e==null?void 0:e.message)}),g.jsx(Se,{onClick:t,sx:{cursor:"pointer"},children:g.jsx(mn,{url:Je.CloseCircle})})]}),g.jsx(Fl,{children:g.jsx(ph,{t:n,tableProps:{data:y,columns:{...tW({t:n}),isManageable:!1},sort:{sortField:u,sortDir:f,onSort:T=>{var E;const x=(E=T==null?void 0:T.column)==null?void 0:E.key;p(v=>u===x&&v==="asc"?"desc":"asc"),d(x)}},pagination:{selectedPage:r,rowPerPage:i,totalRecords:l,onPageChange:T=>{o(T)},onPageSizeChange:T=>{a(T==null?void 0:T.value),o(1)}}},toolbarProps:{defaultTools:{search:{isRequired:!0,onChange:T=>{const x=T.target.value;x&&o(1),b(x)},placeholder:`${n("SEARCH")}...`}}}})}),g.jsx(_l,{sx:{padding:"1.5rem 2rem"}})]})},kW=({baseUrl:e,t})=>{const{alertDialogProps:n,showDetailsProps:r,fetchNotification:o,isMarkAllAsRead:i}=Ww({baseUrl:e});return g.jsxs(g.Fragment,{children:[g.jsx(Se,{sx:{display:"flex",justifyContent:"center",cursor:"pointer",marginTop:"0.6rem"},onClick:()=>{var a;o(),(a=n==null?void 0:n.setOpen)==null||a.call(n,!0)},children:g.jsx(wW,{count:i.count})}),g.jsx(qw,{...n,children:g.jsx(EW,{...n,t})}),g.jsx(qw,{...r,children:g.jsx(OW,{...r,t})})]})},MW=({baseUrl:e,t})=>g.jsx(En,{children:g.jsx(Bw,{children:g.jsx(kW,{baseUrl:e,t})})}),PW=({rightChild:e,leftChild:t,isDrawerMerged:n,isDrawerOpen:r,drawerTitle:o,showExpand:i,onCloseClick:a,onMergeClick:l,onExpandClick:c,isDrawerExpanded:u,styles:d,showMerge:f})=>{const p=Ot();return g.jsx(Se,{sx:{position:"relative",overflow:"hidden"},children:g.jsxs(fo,{container:!0,sx:{height:"100%"},children:[g.jsx(fo,{item:!0,sx:{width:n?d!=null&&d.drawerWidth?`calc(${"100%"-(d==null?void 0:d.drawerWidth)})`:"75%":"100%",position:"relative",zIndex:3,height:"calc(100vh - 7rem)",p:"0rem 1.5rem",overflow:"auto"},children:t}),r&&!n&&g.jsx(g.Fragment,{children:g.jsx(Se,{onClick:a,sx:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"#07080B80",backdropFilter:"blur(3px)",zIndex:3,transition:"opacity 0.3s ease-in-out"}})}),e&&g.jsxs(fo,{item:!0,sx:{width:u?"90%":(d==null?void 0:d.drawerWidth)||"25%",position:n?"relative":"absolute",top:0,right:0,height:"calc(100vh - 7rem)",backgroundColor:p.palette.primary.notifyBackground,transform:r?"translateX(0)":"translateX(100%)",transition:"transform 0.4s ease-in-out , width 0.4s ease-in-out",zIndex:4,borderLeft:`0.1rem solid ${p.palette.primary.notifyBorderColor}`,display:"flex",flexDirection:"column"},children:[g.jsxs(rt,{direction:"row",alignItems:"center",sx:{width:"100%",flexShrink:0,paddingBottom:"0.8rem",px:2,pt:"0.8rem",borderBottom:y=>`0.1rem solid ${y.palette.primary.notifyBorderColor}`},children:[!u&&f&&g.jsxs(g.Fragment,{children:[g.jsx(Se,{component:"img",src:Je.Merge,sx:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer"},onClick:l}),g.jsx(Ii,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"auto!important",borderColor:p.palette.primary.notifyBorderColor}})]}),g.jsxs(rt,{direction:"row",justifyContent:"space-between",alignItems:"center",flexGrow:1,children:[g.jsxs(rt,{direction:"row",gap:"0.5rem",alignItems:"center",onClick:a,sx:{cursor:"pointer"},children:[g.jsx(mn,{url:Je.CrossLight}),g.jsx(nt,{sx:{fontSize:"1.2rem",color:p.palette.primary.notifyTextColor},children:o})]}),g.jsx(rt,{direction:"row",gap:"0.5rem",alignItems:"center",children:i&&g.jsx(Se,{onClick:c,sx:{cursor:"pointer"},children:g.jsx(Se,{component:"img",src:u?Je.Collapse:Je.Expand})})})]})]}),g.jsx(Se,{sx:{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},overflow:"auto",px:2},children:e})]})]})})},Qw=({layoutChildren:e,layoutProps:t})=>g.jsx(En,{children:g.jsx(PW,{...e,...t})});Qw.propTypes={layoutChildren:s.object.isRequired,layoutProps:s.object.isRequired};const eC=({parentProps:e,childProps:t})=>{const n=Ot();return g.jsxs(rt,{sx:{background:n.palette.primary.notifyBackground,border:`0.1rem solid ${n.palette.primary.notifyBorderColor}`,borderRadius:"1rem",position:"relative",overflow:"hidden"},children:[g.jsx(rt,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{maxHeight:"10rem",p:"1.5rem",cursor:"pointer",zIndex:4},onClick:t.toggleExpand,children:e.content}),g.jsx(Ps.div,{layout:!0,initial:{opacity:0,maxHeight:0},animate:{opacity:t.isExpanded?1:0,maxHeight:t.isExpanded?"50rem":0},transition:{duration:.5,ease:"easeInOut"},style:{background:n.palette.primary.notifyBackground,overflow:"hidden",display:"flex",flexDirection:"column",width:"100%"},children:g.jsx(Se,{sx:{p:"1rem"},children:t.content})})]})};eC.propTypes={parentProps:s.object.isRequired,childProps:s.object.isRequired};const tC=({accordionProps:e})=>g.jsx(En,{children:g.jsx(Bw,{children:g.jsx(eC,{...e})})});tC.propTypes={accordionProps:s.object.isRequired},bt.Accordion=tC,bt.Button=Mr,bt.Checkbox=fc,bt.DatePicker=JV,bt.Grid=ph,bt.Header=$w,bt.InputField=R1,bt.Loader=m8,bt.Notification=MW,bt.Select=I1,bt.SliderLayout=Qw,bt.Switch=_1,bt.TextField=Ic,bt.ToastProvider=u8,bt.toast=i8,Object.defineProperty(bt,Symbol.toStringTag,{value:"Module"})});
326
+ `+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=ko(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&Uc.assertOptions(r,{silentJSONParsing:gr.transitional(gr.boolean),forcedJSONParsing:gr.transitional(gr.boolean),clarifyTimeoutError:gr.transitional(gr.boolean)},!1),o!=null&&(te.isFunction(o)?n.paramsSerializer={serialize:o}:Uc.assertOptions(o,{encode:gr.function,serialize:gr.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Uc.assertOptions(n,{baseUrl:gr.spelling("baseURL"),withXsrfToken:gr.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&te.merge(i.common,i[n.method]);i&&te.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),n.headers=yn.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 m=[bw.bind(this),void 0];for(m.unshift(...l),m.push(...u),p=m.length,d=Promise.resolve(n);f<p;)d=d.then(m[f++],m[f++]);return d}p=l.length;let y=n;for(;f<p;){const m=l[f++],h=l[f++];try{y=m(y)}catch(b){h.call(this,b);break}}try{d=bw.call(this,y)}catch(m){return Promise.reject(m)}for(f=0,p=u.length;f<p;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=ko(this.defaults,t);const n=aw(t.baseURL,t.url,t.allowAbsoluteUrls);return J1(n,t.params,t.paramsSerializer)}};te.forEach(["delete","get","head","options"],function(t){Mo.prototype[t]=function(n,r){return this.request(ko(r||{},{method:t,url:n,data:(r||{}).data}))}}),te.forEach(["post","put","patch"],function(t){function n(r){return function(i,a,l){return this.request(ko(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}Mo.prototype[t]=n(),Mo.prototype[t+"Form"]=n(!0)});let L7=class dC{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(o=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](o);r._listeners=null}),this.promise.then=o=>{let i;const a=new Promise(l=>{r.subscribe(l),i=l}).then(o);return a.cancel=function(){r.unsubscribe(i)},a},t(function(i,a,l){r.reason||(r.reason=new Us(i,a,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new dC(function(o){t=o}),cancel:t}}};function B7(e){return function(n){return e.apply(null,n)}}function V7(e){return te.isObject(e)&&e.isAxiosError===!0}const oh={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(oh).forEach(([e,t])=>{oh[t]=e});function ww(e){const t=new Mo(e),n=F1(Mo.prototype.request,t);return te.extend(n,Mo.prototype,t,{allOwnKeys:!0}),te.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return ww(ko(e,o))},n}const St=ww(Ma);St.Axios=Mo,St.CanceledError=Us,St.CancelToken=L7,St.isCancel=rw,St.VERSION=vw,St.toFormData=Bc,St.AxiosError=Ge,St.Cancel=St.CanceledError,St.all=function(t){return Promise.all(t)},St.spread=B7,St.isAxiosError=V7,St.mergeConfig=ko,St.AxiosHeaders=yn,St.formToJSON=e=>tw(te.isHTMLForm(e)?new FormData(e):e),St.getAdapter=yw.getAdapter,St.HttpStatusCode=oh,St.default=St;const{Axios:_z,AxiosError:Fz,CanceledError:$z,isCancel:Lz,CancelToken:Bz,VERSION:Vz,all:Wz,Cancel:zz,isAxiosError:Hz,spread:Uz,toFormData:qz,AxiosHeaders:Yz,HttpStatusCode:Gz,formToJSON:Kz,getAdapter:Xz,mergeConfig:Zz}=St,sh={BASE_URL:"https://qa.3sc.ai/api",VERSION:"/v1"},Da={headers:{"Content-Type":"application/json"},withCredentials:!0},Cw=St.create({baseURL:sh.BASE_URL,axiosConfig:Da});Cw.interceptors.request.use(function(e){return e},function(e){return Promise.reject(e)}),Cw.interceptors.response.use(function(e){return e},function(e){return Promise.reject(e)});const Ir={TOKEN:"token",USER:"user",SNOP:"snop",SELECTED_BU:"selected_business_unit",SETTINGS:"settings"},Sw={TENANT_ID:"tenant_id",BU_ID:"bu_id"},W7=Object.values({"SKU Name":"sku_name",Node:"node","Channel Name":"channel_name"}),z7=[10,25,50,100],H7={MARK_ALL_READ:"MARK_ALL_READ"},U7=z7.map(e=>({label:e,value:e})),Tw={PRIMARY:"PRIMARY",SECONDARY:"SECONDARY"},qc={NOTIFICATION:"/notifications",SETTING:"/configuration/setting"};/*! js-cookie v3.0.5 | MIT */function Yc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var q7={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 ih(e,t){function n(o,i,a){if(!(typeof document>"u")){a=Yc({},t,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var l="";for(var c in a)a[c]&&(l+="; "+c,a[c]!==!0&&(l+="="+a[c].split(";")[0]));return document.cookie=o+"="+e.write(i,o)+l}}function r(o){if(!(typeof document>"u"||arguments.length&&!o)){for(var i=document.cookie?document.cookie.split("; "):[],a={},l=0;l<i.length;l++){var c=i[l].split("="),u=c.slice(1).join("=");try{var d=decodeURIComponent(c[0]);if(a[d]=e.read(u,d),o===d)break}catch{}}return o?a[o]:a}}return Object.create({set:n,get:r,remove:function(o,i){n(o,"",Yc({},i,{expires:-1}))},withAttributes:function(o){return ih(this.converter,Yc({},this.attributes,o))},withConverter:function(o){return ih(Yc({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var Y7=ih(q7,{path:"/"});const ah=Ac(Ir.SNOP),lh=Ac(Ir.SELECTED_BU),ch=Ac(Ir.USER);Ac(Ir.SETTINGS);const Ew={BU_IDS:lh==null?void 0:lh.business_unit_id,TOKEN:JSON.parse(Y7.get(Ir.TOKEN)||null),TENANT_IDS:ch==null?void 0:ch.tenant_id,SNOP_IDS:ah==null?void 0:ah.snop_id},{TENANT_ID:G7,BU_ID:K7}=Sw,{TENANT_IDS:X7,BU_IDS:Z7}=Ew,Gc=async({baseUrl:e,payload:t})=>{console.log({api:e,payload:t});try{const n=`${e}${qc.SETTING}/v1?${G7}=${X7}&${K7}=${Z7}`;return await St.post(n,t,Da)}catch(n){return n}},J7=({columns:e,gridPath:t,baseUrl:n,isDefaultConfig:r,pageSize:o=10,childUniqueKey:i,data:a})=>{var x,E,v;const l=a==null?void 0:a.length;let{definitions:c,defaultUserSettings:u,labels:d}=e;const f=Ar(d),p=t.split("/").filter(Boolean),y=JSON.parse(localStorage.getItem(Ir.SETTINGS));let m=p.reduce((O,k)=>O==null?void 0:O[k],y)||null;const h=Ar((m==null?void 0:m.columns)||[]);if(!r&&t&&l){let O=(u&&uh({col:u,childUniqueKey:i,definitions:c}))??uh({col:c,childUniqueKey:i});const k=O.filter(R=>!h[R.key]),P=m&&((x=m==null?void 0:m.columns)==null?void 0:x.some(R=>(R==null?void 0:R.children)&&R.children[i]));if(l&&(k.length||i&&P===!1)){if(P==!1&&i.length>0){const R=Ar(O);O=(E=m==null?void 0:m.columns)==null?void 0:E.map(A=>{var j;return A!=null&&A.children&&!A.children[i]?{...A,children:{...A.children,[i]:(j=R==null?void 0:R[A==null?void 0:A.key])==null?void 0:j.children[i]}}:A})}(async()=>{try{console.log({definitions:c,defaultUserSettings:u,labels:d,data:a,missing:k,gridSettingsMap:h,_userSettings:O,_localSetting:y,grid_settings:m,gridPath:t,objectPaths:p});const A={...y||{platform:{theme:"light"}}},j=(m==null?void 0:m.pageSize)??o;let I=A;for(let N=0;N<p.length;N++){const _=p[N];N===p.length-1?I[_]={columns:O,pageSize:j}:(I[_]={...I[_]||{}},I=I[_])}localStorage.setItem(Ir.SETTINGS,JSON.stringify(A)),console.log({"table-helper":n,payload:A,gridPath:t}),await Gc({baseUrl:n,payload:A})}catch(R){console.error(R)}})()}}u=((m==null?void 0:m.columns)&&eW(h,u,i))??u??uh({col:c});const b=[],w=Ar(u);for(const O of c){const k=w[O.key]||{},P=f[O.key]||{},R=h[O.key],A=Ar(k.children||[]),j=Ar(P.children||[]);let I={...O,style:R==null?void 0:R.style,...k,...P};(v=O.children)!=null&&v.length&&(I.children=O.children.map(N=>({...N,...A[N.key],...j[N.key]}))),b.push(I)}return b.sort((O,k)=>O.sequenceId-k.sequenceId)},Q7=e=>e.sort((t,n)=>t.sequenceId-n.sequenceId),Ra=({columns:e,childUniqueKey:t,definitions:n})=>{let r=n||e;return e==null?void 0:e.map(o=>{let i=r==null?void 0:r.find(a=>(a==null?void 0:a.key)===(o==null?void 0:o.key));return{id:o.id,key:o.key,sequenceId:o.sequenceId||o.id,isHidden:o.isHidden||!1,style:o.style||(i==null?void 0:i.style)||{},...(o==null?void 0:o.children)&&{children:t?{[t]:Ra({columns:o.children,definitions:i==null?void 0:i.children})}:Ra({columns:o.children,definitions:i==null?void 0:i.children})}}})},Ar=e=>Array.isArray(e)&&(e==null?void 0:e.reduce((t,n)=>(t[n.key]=n,t),{})),uh=({col:e,childUniqueKey:t,definitions:n})=>Ra({columns:e,childUniqueKey:t,definitions:n}),eW=(e,t,n)=>t.map(o=>{const i=e[o.key],a=o.children?o.children.map(l=>{var d;const c=Ar(Array.isArray(i==null?void 0:i.children)?i==null?void 0:i.children:(d=i==null?void 0:i.children)==null?void 0:d[n]),u=c==null?void 0:c[l.key];return{...l,sequenceId:(u==null?void 0:u.sequenceId)||l.sequenceId,isHidden:(u==null?void 0:u.isHidden)??l.isHidden}}):void 0;return{...o,sequenceId:(i==null?void 0:i.sequenceId)||o.sequenceId,isHidden:(i==null?void 0:i.isHidden)??o.isHidden,...a?{children:a}:{}}}),tW=({t:e})=>{const t=[{id:1,key:"sku_name",isSortable:!0,isMandatory:!0},{id:2,key:"node",isSortable:!0,isMandatory:!0},{id:3,key:"channel_name",isSortable:!0,isMandatory:!0}],n=[{id:1,key:"sku_name",sequenceId:1,isHidden:!1,style:{width:"20rem",minWidth:"20rem",maxWidth:"20rem"}},{id:2,key:"node",sequenceId:2,isHidden:!1,style:{width:"20rem",minWidth:"20rem",maxWidth:"20rem"}},{id:3,key:"channel_name",sequenceId:3,isHidden:!1,style:{width:"20rem",minWidth:"20rem",maxWidth:"20rem"}}],r=[{id:1,key:"sku_name",label:e(y8),isLocalizable:!1},{id:2,key:"node",label:e(g8),isLocalizable:!1},{id:3,key:"channel_name",label:e(b8),isLocalizable:!1}];return{definitions:t,defaultUserSettings:n,labels:r}};class Ow extends D.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=D.createRef()}startDrag(){if(!this.props.disabled&&(this.draggedCol=this.props.id,this.props.resizeStart&&this.draggedCol===this.props.id&&this.props.resizeStart(),this.dragging=!0,this.startPos=this.mouseX,this.startWidthPrev=0,this.resizeRef.current)){let t=this.resizeRef.current.previousSibling;t&&(this.startWidthPrev=t.clientWidth)}}endDrag(){this.props.disabled||(this.dragging=!1,this.props.resizeEnd&&this.draggedCol===this.props.id&&this.props.resizeEnd(this.lastDraggedWidth),this.draggedCol=null)}onMouseMove(t){if(this.props.disabled||(this.mouseX=t.touches?t.touches[0].screenX:t.screenX,!this.dragging))return;const n=this.resizeRef.current,r=this.startPos-this.mouseX;let o=this.startWidthPrev-r;(!this.props.minWidth||o>=this.props.minWidth)&&(!this.props.maxWidth||o<=this.props.maxWidth)&&(n.previousSibling.style.width=o+"px",n.previousSibling.style.minWidth=o+"px",n.previousSibling.style.maxWidth=o+"px",n.previousSibling.style.setProperty("--column_resize_before_width",o+"px"),this.lastDraggedWidth=o)}componentDidMount(){const t=this.resizeRef.current;if(t&&(this.props.defaultWidth?(t.previousSibling.style.minWidth=this.props.defaultWidth+"px",t.previousSibling.style.width=this.props.defaultWidth+"px",t.previousSibling.style.maxWidth=this.props.defaultWidth+"px",t.previousSibling.style.setProperty("--column_resize_before_width",this.props.defaultWidth+"px")):this.props.minWidth&&(t.previousSibling.style.minWidth=this.props.minWidth+"px",t.previousSibling.style.width=this.props.minWidth+"px",t.previousSibling.style.maxWidth=this.props.minWidth+"px",t.previousSibling.style.setProperty("--column_resize_before_width",this.props.minWidth+"px"))),this.props.disabled){this.props.defaultWidth&&t&&(t.previousSibling.style.minWidth=this.props.defaultWidth+"px",t.previousSibling.style.width=this.props.defaultWidth+"px",t.previousSibling.style.maxWidth=this.props.defaultWidth+"px",t.previousSibling.style.setProperty("--column_resize_before_width",this.props.defaultWidth+"px")),this.props.maxWidth&&t&&(t.previousSibling.style.maxWidth=this.props.maxWidth+"px");return}this.addEventListenersToDocument()}componentWillUnmount(){this.props.disabled||this.removeEventListenersFromDocument()}componentDidUpdate(t,n){t.disabled&&!this.props.disabled&&this.addEventListenersToDocument(),!t.disabled&&this.props.disabled&&this.removeEventListenersFromDocument()}addEventListenersToDocument(){document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.endDrag),document.addEventListener("touchmove",this.onMouseMove),document.addEventListener("touchend",this.endDrag)}removeEventListenersFromDocument(){document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.endDrag),document.removeEventListener("touchmove",this.onMouseMove),document.removeEventListener("touchend",this.endDrag)}render(){var t={userSelect:"none"};return this.props.disabled||(t.cursor="ew-resize"),this.props.className===""&&(t.width="6px",t.backgroundColor="rgba(0, 0, 0, 0.1)"),D.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})}}Ow.defaultProps={disabled:!1,minWidth:0,className:""};function dh({isRenderCellContent:e,column:t,row:n,parent:r}){const o=n[t.key],i=(o==null?void 0:o.length)>20;return g.jsx(g.Fragment,{children:e?g.jsx(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem"},children:t==null?void 0:t.cellRenderer(n,{column:t,parent:r})}):g.jsx(g.Fragment,{children:i?g.jsx(Dd,{title:o,placement:"top",componentsProps:{tooltip:{sx:{fontSize:"1rem",padding:"0.5rem 1rem",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"}}},children:g.jsx(Se,{sx:{maxWidth:"auto",whiteSpace:"normal"},children:g.jsx(nt,{sx:{fontSize:"1.1rem",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none"},children:o})})}):g.jsx(Se,{sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem",m:0},id:t.key,component:"p",children:o??""})})})}dh.propTypes={isRenderCellContent:s.bool,column:s.object,row:s.object},Y(jl)(({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 Po=Y(nt)(({theme:e})=>({color:e.palette.primary.notifyTextColor,fontSize:"1.1rem"})),nW=Y(ly)(({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)"})}})),rW=Y(Ii)(({theme:e})=>({color:e.palette.primary.notifyTextColor,padding:"0.6rem 0",fontSize:"0.9rem",fontWeight:500,"&::before, &::after":{borderColor:`${e.palette.primary.notifyBorderColor}!important`}})),oW=Y(hd)(({theme:e})=>({"& .MuiBadge-badge":{right:3.5,top:1.8,border:`0.1rem solid ${e.palette.primary.notifyBackground}`,padding:"0 1.3px",borderRadius:"50%",backgroundColor:"#D44E40",fontSize:"0.725rem",minWidth:"0.7rem",height:"0.7rem"}}));Y(Yl)(({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 sW=Y(Oy)(({theme:e})=>({minHeight:"2rem","& .MuiTabs-indicator":{height:"0.1rem",backgroundColor:e.palette.primary.notifyActiveText}})),fh=Y(cy)(({theme:e})=>({color:e.palette.primary.notifyActiveText,textTransform:"none",fontWeight:"normal",padding:0,fontSize:"1rem",minHeight:"2rem",paddingBottom:"1rem","&.Mui-selected":{fontWeight:"bold",color:e.palette.primary.notifyActiveText}})),Kc=Y(dd)(({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`}})),iW=Y(Ul)(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"table-cell",[`&.${Id.head}`]:{color:e.palette.primary.notifyTextColor,backgroundColor:e.palette.primary.notifyBackground,borderColor:e.palette.primary.notifyBorderColor,padding:"0rem",textAlign:"center",lineHeight:"1.5rem"},[`&.${Id.body}`]:{color:e.palette.primary.notifyTextColor,borderColor:e.palette.primary.notifyBorderColor,padding:"0rem",textAlign:"center"}}));function Ia({children:e,...t}){return g.jsx(iW,{...t,children:e})}Ia.propTypes={children:s.node};const aW=Y(vy)(()=>({"&:last-child td":{borderBottom:"none"}}));function qs({children:e,...t}){return g.jsx(aW,{...t,children:e})}qs.propTypes={children:s.node};const lW=D.memo(({row:e,isSelected:t,isHigh:n,onRowClick:r,children:o})=>g.jsx(qs,{sx:i=>({backgroundColor:t||n?i.palette.primary.appBackground:i.palette.primary.notifyBackground}),onClick:()=>r==null?void 0:r(e),children:o},e==null?void 0:e.fhi)),cW=D.memo(({nestedData:e,nestedColumn:t,t:n})=>e!=null&&e.length?g.jsx(g.Fragment,{children:e.map((r,o)=>g.jsx(qs,{children:t.map((i,a)=>g.jsx(Ia,{style:i==null?void 0:i.style,children:g.jsx(dh,{isRenderCellContent:!!(i!=null&&i.cellRenderer),column:i,row:r})},a))},`nested-${o}`))}):g.jsx(qs,{children:g.jsx(Ia,{colSpan:t.length,children:g.jsx(Po,{sx:{textAlign:"center"},children:n(Jr.NRF)})})})),uW=(e,t,n,r,o,i)=>{const[a,l]=D.useState({isOpen:!1,column:null}),c=(p,y,m)=>{l({isOpen:p.currentTarget,column:y,isChild:!!m})},u=()=>{l({isOpen:!1,column:null,isChild:!1})},d=async()=>{u();const p=e.map(y=>{var m;if(a!=null&&a.isChild&&Array.isArray(y.children)){const h=y.children.map(w=>{var T;return w.key===((T=a.column)==null?void 0:T.key)?{...w,isHidden:!0}:w}),b=h.every(w=>w.isHidden);return{...y,isHidden:b?!0:y.isHidden,children:h}}return y.key===((m=a.column)==null?void 0:m.key)?{...y,isHidden:!0}:y});f({updatedColumns:p})},f=async({updatedColumns:p})=>{t({type:qe.SET_GRID_DATA,payload:{visibleGridColumns:p}});const y=r.split("/").filter(Boolean),m=JSON.parse(localStorage.getItem(Ir.SETTINGS));let h=y.reduce((O,k)=>O==null?void 0:O[k],m)||null,b=Ra({columns:p,childUniqueKey:i});const w=Ar(h==null?void 0:h.columns);b=b==null?void 0:b.map(O=>{var R,A;const k=(O==null?void 0:O.children)||{},P=((R=w==null?void 0:w[O==null?void 0:O.key])==null?void 0:R.children)||{};return{...O,...(((A=Object.keys(P))==null?void 0:A.length)>0||(k==null?void 0:k[i]))&&{children:{...P,[i]:k==null?void 0:k[i]}}}});const x={...m||{platform:{theme:"light"}}},E=(h==null?void 0:h.pageSize)??o;let v=x;for(let O=0;O<y.length;O++){const k=y[O];O===y.length-1?v[k]={columns:b,pageSize:E}:(v[k]={...v[k]||{}},v=v[k])}localStorage.setItem(Ir.SETTINGS,JSON.stringify(x)),console.log({hide:n,payload:x,gridPath:r}),await Gc({baseUrl:n,payload:x})};return{selectedColumn:a,handleMenuClick:c,handleClose:u,handleHideClick:d,columnUpdaterFunction:f}},dW=e=>{if(!e)return null;const{options:t,...n}=e,r=t?"select":"button",o={button:i=>{var a;return g.jsx(Mr,{...i,styles:{...i.styles,iconPrimary:((a=i==null?void 0:i.styles)==null?void 0:a.variant)=="filled"}})},select:i=>{var a;return g.jsx(Se,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"},width:(a=i.styles)==null?void 0:a.width},children:g.jsx(I1,{...i,options:t})})}};return o[r]?o[r](n):null},fW=({presentSetting:e,gridSetting:t,gridPath:n,childUniqueKey:r})=>{if(!n)return e;const o=n.split("/").filter(Boolean);let i=o.reduce((u,d)=>u==null?void 0:u[d],e)||null,a=Ra({columns:t==null?void 0:t.grid,childUniqueKey:r});const l=Ar(i==null?void 0:i.columns);a=a==null?void 0:a.map(u=>{var p,y;const d=(u==null?void 0:u.children)||{},f=((p=l==null?void 0:l[u==null?void 0:u.key])==null?void 0:p.children)||{};return{...u,...(((y=Object.keys(f))==null?void 0:y.length)>0||(d==null?void 0:d[r]))&&{children:{...f,[r]:d==null?void 0:d[r]}}}});let c=e;for(let u=0;u<o.length;u++){const d=o[u];u===o.length-1?c[d]={columns:a,pageSize:(t==null?void 0:t.pageSize)??null}:(c[d]=c[d]||{},c=c[d])}return{settingObject:e,defaultUserSettings:a}},pW=async({baseUrl:e,gridSetting:t,childUniqueKey:n,gridPath:r})=>{try{const o=JSON.parse(localStorage.getItem("settings")),{settingObject:i,defaultUserSettings:a}=fW({presentSetting:o,gridSetting:t,gridPath:r,childUniqueKey:n});return localStorage.setItem("settings",JSON.stringify(i)),console.log({"update-setting":e,payload:i,gridPath:r}),await Gc({baseUrl:e,payload:i}),a}catch(o){console.error(o)}},hW=({index:e,visibleGridColumns:t,width:n,columnUpdaterFunction:r})=>{if(!t||!t[e])return null;t[e];let o=`${n/10}rem`;const i=t.map((a,l)=>l===e?{...a,style:{...a.style,width:o,minWidth:o,maxWidth:o}}:a);return r({updatedColumns:i}),i[e]},kw=({pagination:e,gridPath:t,baseUrl:n,t:r})=>{const{selectedPage:o,rowPerPage:i,totalRecords:a,onPageChange:l,onPageSizeChange:c}=e,u=Ot(),d=async(f,p)=>{if(!p)return;const y=p.split("/").filter(Boolean),m="settings",b={...JSON.parse(localStorage.getItem(m))||{}};let w=b;for(let T=0;T<y.length;T++){const x=y[T];T===y.length-1?w[x]={...w[x]||{},pageSize:f}:(w[x]={...w[x]||{}},w=w[x])}localStorage.setItem(m,JSON.stringify(b)),console.log({pagination:n,payload,gridPath:p}),await Gc({baseUrl:n,payload:b})};return g.jsxs(Se,{sx:{display:"flex",p:"1rem 1.5rem"},children:[g.jsxs(Se,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"0.5rem",width:"100%"},children:[g.jsx(nt,{sx:{fontSize:"1.1rem",color:u.palette.primary.notifyTextColor},children:r("SHOWING_ROWS",{current:Math.min(o*i,a),total:a})}),g.jsx(Se,{sx:{"& .MuiInputBase-input":{padding:"0rem 0.8rem!important"},width:"6rem"},children:g.jsx(Ws,{options:U7,value:i,onChange:async f=>{c(f),d(f==null?void 0:f.value,t)}})})]}),g.jsx(Qg,{count:Math.ceil(a/i),page:o,onChange:async(f,p)=>{l(p)},siblingCount:0,shape:"rounded",sx:{width:"100%","& .MuiPagination-ul":{width:"100%",display:"flex",justifyContent:"flex-end","& li:first-of-type":{border:`0.1rem solid ${u.palette.primary.notifyBorderColor}`,color:u.palette.primary.notifyActiveText,marginRight:"1.5rem",borderRadius:"1rem",width:"3rem",height:"3rem",justifyContent:"center",alignItems:"center",display:"flex"},"& li:last-child":{border:`0.1rem solid ${u.palette.primary.notifyBorderColor}`,color:u.palette.primary.notifyActiveText,marginLeft:"1.5rem",borderRadius:"1rem",width:"3rem",height:"3rem",justifyContent:"center",alignItems:"center",display:"flex"}},"& .MuiPaginationItem-root":{color:"#595959",fontSize:"1.1rem",borderRadius:"1rem",width:"3rem",height:"3rem",justifyContent:"center",alignItems:"center",display:"flex","& .MuiSvgIcon-root":{fontSize:"2.2rem"}},"& .Mui-selected":{color:u.palette.primary.notifyActiveText,backgroundColor:`${u.palette.brandColor.paginationBc} !important`}}})]})};kw.propTypes={pagination:s.object.isRequired};const Mw=({menuOpen:e,handleClose:t,onHideClick:n})=>{const r=Ot();return g.jsx($i,{open:!!e,anchorEl:e,onClose:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:g.jsx(Se,{sx:{backgroundColor:r.palette.primary.notifyBackground,border:`0.1rem solid ${r.palette.primary.notifyBorderColor}`,minHeight:"2.3rem",display:"flex",justifyContent:"center",alignItems:"center"},children:g.jsx(qn,{onClick:n,disableRipple:!0,sx:{textTransform:"none",fontSize:"1.1rem",p:"0.4rem 1rem",minHeight:"unset",fontWeight:500,color:r.palette.primary.notifyTextColor,backgroundColor:"transparent","&:hover":{backgroundColor:"transparent"},"&:active":{backgroundColor:"transparent"},"&:focus":{backgroundColor:"transparent"}},children:"Hide Column"})})})};Mw.propTypes={menuOpen:s.object,handleClose:s.func,onHideClick:s.func};const Pw=({sortKey:e,sortField:t,sortDir:n,handleSortClick:r})=>{const o=i=>g.jsx(_r,{onClick:r,sx:{padding:"0.2rem"},draggable:!1,children:g.jsx(mn,{url:i})});return g.jsx(g.Fragment,{children:o(t===e?n==="asc"?Je.AscSort:Je.DescSort:Je.Unsort)})};Pw.propTypes={sortKey:s.string.isRequired,sortField:s.string,sortDir:s.string,handleSortClick:s.func};function Dw({parent:e,column:t,sort:n,handleMenuClick:r,isManageable:o}){const i=o&&(!(t!=null&&t.isMandatory)||(t==null?void 0:t.isMandatory)&&(t==null?void 0:t.showHide)===!0),a=t==null?void 0:t.label,l=t==null?void 0:t.isSortable,c=n==null?void 0:n.sortField,u=n==null?void 0:n.sortDir,d=n==null?void 0:n.onSort;return g.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},draggable:!1,children:[g.jsx(Se,{sx:{fontWeight:"bold",fontSize:"1.1rem",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"0.5rem",textAlign:"center"},children:g.jsx(Dd,{title:a,placement:"top",componentsProps:{tooltip:{sx:{fontSize:"1rem",padding:"0.6rem 1rem",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"}}},children:a??""})}),g.jsxs(Se,{sx:{display:"flex",alignItems:"center"},draggable:!1,children:[l&&g.jsx(Pw,{sortKey:e?`${e==null?void 0:e.key}|${t==null?void 0:t.key}`:t==null?void 0:t.key,sortField:c,sortDir:u,handleSortClick:()=>d({column:t,sortDir:u,sortField:c,parent:e})}),i&&g.jsx(_r,{draggable:!1,onClick:f=>r(f,t,e),sx:{padding:"0.2rem"},children:g.jsx(mn,{url:Je.Menu})})]})]})}Dw.propTypes={column:s.object.isRequired,sort:s.object.isRequired,handleMenuClick:s.func,isManageable:s.bool};function Rw({rows:e,sort:t,data:n,pagination:r,columns:o,nested:i,baseUrl:a,gridPath:l,childUniqueKey:c,isVirtualizedTable:u=!1,t:d}){var Be;const f=Ot(),{visibleGridColumns:p}=D.useContext(jc),y=D.useContext(Ta),{selectedColumn:m,handleMenuClick:h,handleClose:b,handleHideClick:w,columnUpdaterFunction:T}=uW(p,y,a,l,r==null?void 0:r.rowPerPage,c),x=o==null?void 0:o.isManageable,E=o==null?void 0:o.isResizable,v=(n==null?void 0:n.length)>0,O=D.useRef(null),k=D.useRef(null),P=45,R=10,A=n==null?void 0:n.length,[j,I]=D.useState({start:0,end:10}),[N,_]=D.useState({start:0,end:20}),[$,B]=D.useState(null),[F,L]=D.useState(null),[H,V]=D.useState(null);let U=null;const X=D.useRef(0),re=D.useRef(!1),Q=D.useRef(null),ce=Q7(((Be=i==null?void 0:i.column)==null?void 0:Be.definitions)||[]),oe=i==null?void 0:i.isNested,J=(i==null?void 0:i.data)||[],ie=i==null?void 0:i.hashKey,[se,ne]=D.useState(0),[K,M]=D.useState(null);D.useRef(null);const[G,Z]=D.useState(!1),[he,de]=D.useState(!1);D.useEffect(()=>{if(O.current){const z=()=>{ne(O.current.offsetHeight)};return z(),window.addEventListener("resize",z),()=>window.removeEventListener("resize",z)}},[n]),D.useEffect(()=>{const z=O.current,me=z==null?void 0:z.querySelector("thead");if(!me)return;const le=()=>{V(null)};return me==null||me.addEventListener("mousedown",le),()=>{me==null||me.removeEventListener("mousedown",le)}},[]);const q=(z,me)=>{var xe,ke;if(re.current){z.preventDefault();return}B(me),V(null),z.dataTransfer.setData("colIndex",me);const le=p[me],ee=le==null?void 0:le.label,pe=document.createElement("div");pe.textContent=ee,Object.assign(pe.style,{display:"flex",alignItems:"center",justifyContent:"center",padding:"1.5rem 2.5rem",minWidth:(xe=le==null?void 0:le.style)==null?void 0:xe.minWidth,maxWidth:(ke=le==null?void 0:le.style)==null?void 0:ke.maxWidth,fontSize:"1.2rem",fontWeight:"500",color:f.palette.primary.notifyTextColor,background:f.palette.primary.notifyBackground,border:`0.1rem solid ${f.palette.primary.notifyBorderColor}`,borderRadius:"0rem",pointerEvents:"none",position:"absolute",top:"0",left:"0",zIndex:"-1",textAlign:"center",boxSizing:"border-box",boxShadow:"0 1px 4px rgba(0, 0, 0, 0.2)"}),document.body.appendChild(pe);const{offsetWidth:ge,offsetHeight:Ee}=pe;z.dataTransfer.setDragImage(pe,ge/2,Ee/2),requestAnimationFrame(()=>{document.body.removeChild(pe)})},fe=(z,me)=>{z.preventDefault(),L(me),Ye(z)},Oe=async(z,me)=>{if(z.preventDefault(),clearInterval(U),$===null||$===me)return;const le=[...p],[ee]=le.splice($,1);le.splice(me,0,ee);const pe=p.slice().sort((Ee,xe)=>Ee.sequenceId-xe.sequenceId).map(Ee=>Ee.sequenceId),ge=le.map((Ee,xe)=>({...Ee,sequenceId:pe[xe]??Ee.sequenceId}));T({updatedColumns:ge}),B(null),L(null)},be=()=>{B(null),L(null)},Ce=(z,me,le,ee)=>{var Ke,ze,Qn,Nr,mt;if(!z)return null;const pe=(z==null?void 0:z.isMandatory)&&(z==null?void 0:z.isSticky),ge=parseFloat((ze=(Ke=z==null?void 0:z.style)==null?void 0:Ke.minWidth)==null?void 0:ze.toString().replace("rem",""))||7.5;me===0&&(X.current=0);const Ee=pe?me===0?0:`${X.current}rem`:void 0;pe&&(X.current+=ge);const xe=$===me,ke=F==me||((Qn=p==null?void 0:p[F])==null?void 0:Qn.isMandatory),Te=Qe=>{z.isMandatory?(Qe.preventDefault(),Qe.dataTransfer.dropEffect="none"):(Qe.preventDefault(),Qe.dataTransfer.dropEffect="move"),fe==null||fe(Qe,me)},Ie=Qe=>{z.isMandatory||Oe==null||Oe(Qe,me)};return ee&&`${ee==null?void 0:ee.key}${z==null?void 0:z.key}${me}`,g.jsx(Ia,{rowSpan:z!=null&&z.children?1:2,colSpan:(mt=(Nr=z==null?void 0:z.children)==null?void 0:Nr.filter(Qe=>!(Qe!=null&&Qe.isHidden)))==null?void 0:mt.length,style:z==null?void 0:z.style,draggable:le&&!(z!=null&&z.isMandatory),onDragStart:le&&!(z!=null&&z.isMandatory)?Qe=>q(Qe,me):Qe=>{Qe.preventDefault()},onDragOver:le&&!(z!=null&&z.isMandatory)?Te:void 0,onDrop:le&&!(z!=null&&z.isMandatory)?Ie:void 0,onDragEnd:le&&!(z!=null&&z.isMandatory)?be:void 0,sx:{...(z==null?void 0:z.isSticky)&&{boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...z.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...(z==null?void 0:z.key)==="volume_value"&&{borderLeft:"1px solid"}},...xe&&{border:`0.1rem solid ${f.palette.brandColor.lightBlue}!important`},...pe&&{position:"sticky",left:Ee,zIndex:3},cursor:ke?"not-allowed":le&&!(z!=null&&z.isMandatory)?"grab":"default"},children:g.jsx(Dw,{parent:ee,column:z,sort:t,handleMenuClick:h,isManageable:le})},me)},Ne=D.useCallback((z,me,le,ee)=>{var xe,ke,Te;if(!z)return null;const pe=(z==null?void 0:z.isMandatory)&&(z==null?void 0:z.isSticky),ge=parseFloat((ke=(xe=z==null?void 0:z.style)==null?void 0:xe.minWidth)==null?void 0:ke.toString().replace("rem",""))||7.5;le===0&&(X.current=0);const Ee=pe?le===0?0:`${X.current}rem`:void 0;return pe&&(X.current+=ge),g.jsxs(Ia,{colSpan:1,style:z==null?void 0:z.style,className:`${z==null?void 0:z.label}`,sx:{position:"relative",...z.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...(z==null?void 0:z.key)==="volume_value"&&{borderLeft:"1px solid"}},...(z==null?void 0:z.isSticky)&&{boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...pe&&{position:"sticky",left:Ee,zIndex:2,backgroundColor:Ie=>{var Ke;return e!=null&&e.selectedRow&&((Ke=e==null?void 0:e.selectedRow)==null?void 0:Ke.fhi)===(me==null?void 0:me.fhi)||me!=null&&me.isHigh?Ie.palette.primary.appBackground:Ie.palette.primary.notifyBackground}}},children:[((e==null?void 0:e.selectedRow)&&((Te=e==null?void 0:e.selectedRow)==null?void 0:Te.fhi)===(me==null?void 0:me.fhi)||(me==null?void 0:me.isHigh))&&g.jsx(Se,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none",zIndex:1}}),g.jsx(dh,{isRenderCellContent:!!(z!=null&&z.cellRenderer),column:z,row:me,parent:ee})]},le)},[e==null?void 0:e.selectedRow]),$e=(z,me,le,ee)=>g.jsx(g.Fragment,{children:z&&le&&!(z!=null&&z.isMandatory)?g.jsx(Se,{resizeStart:()=>{z!=null&&z.isMandatory&&!(z!=null&&z.isResizable)||(re.current=!0)},resizeEnd:pe=>{z!=null&&z.isMandatory&&!(z!=null&&z.isResizable)||pe<=20||(re.current=!1,hW({index:me,visibleGridColumns:p,width:pe,columnUpdaterFunction:T}))},component:z!=null&&z.children||z!=null&&z.isMandatory?Ul:Ow,rowSpan:z!=null&&z.children?1:2,colSpan:1,id:me,sx:{width:"1rem",maxWidth:"1rem",minWidth:"1rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${f.palette.primary.notifyBorderColor}`,cursor:"col-resize","&::after":{content:'""',position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"0.15rem",height:"1.5rem",backgroundColor:f.palette.primary.notifyBorderColor,zIndex:1},...!(z!=null&&z.isMandatory)&&{"&:hover::after":{content:'""',position:"absolute",top:0,left:"50%",transform:"translateX(-50%)",width:"0.2rem",height:`${se}px`,backgroundColor:f.palette.primary.notifyBorderColor,zIndex:1}}}}):null}),Ae=D.useCallback((z,me,le,ee,pe,ge,Ee)=>{var xe;return g.jsx(g.Fragment,{children:me&&ee&&!(me!=null&&me.isMandatory)?g.jsx(Ul,{className:"column_resizer_body",sx:{width:"1rem",maxWidth:"1rem",minWidth:"1rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${f.palette.primary.notifyBorderColor}`},children:((e==null?void 0:e.selectedRow)&&((xe=e==null?void 0:e.selectedRow)==null?void 0:xe.fhi)===(z==null?void 0:z.fhi)||(z==null?void 0:z.isHigh))&&g.jsx(Se,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none"}})},`resize-${le}_${Ee}`):null})},[e==null?void 0:e.selectedRow]),Ye=z=>{const me=O.current,{left:le,right:ee}=me.getBoundingClientRect(),pe=50,ge=z.clientX>ee-pe?1:z.clientX<le+pe?-1:0;ge!==0?(Q.current&&clearInterval(Q.current),Q.current=setInterval(()=>{me.scrollLeft+=ge*10},50)):Q.current&&(clearInterval(Q.current),Q.current=null)},ot=z=>z==null?void 0:z.map((me,le)=>{var ke;const ee=j.start+le,pe=me[ie],ge=J==null?void 0:J[pe],Ee=(e==null?void 0:e.selectedRow)&&((ke=e==null?void 0:e.selectedRow)==null?void 0:ke.fhi)===(me==null?void 0:me.fhi),xe=me==null?void 0:me.isHigh;return g.jsxs(D.Fragment,{children:[g.jsx(lW,{row:me,isSelected:Ee,isHigh:xe,onRowClick:e==null?void 0:e.onRowClick,children:p.map((Te,Ie)=>Te!=null&&Te.isHidden||(Te==null?void 0:Te.isVisible)===!1?null:Te!=null&&Te.children?Te.children.map((Ke,ze)=>Ke!=null&&Ke.isHidden?null:g.jsxs(D.Fragment,{children:[Ne(Ke,me,ze,Te),E&&Ae(me,Ke,ze,x,Te,"",ee)]},`col-${Ie}-${ze}`)):g.jsxs(D.Fragment,{children:[Ne(Te,me,Ie),E&&Ae(me,Te,Ie,x,"","",ee)]},`col-${Ie}`))}),oe&&ge&&g.jsx(cW,{nestedData:ge,nestedColumn:ce,t:d})]},`row-${ee}`)}),ct=()=>{const z=k.current;if(!z)return;const me=z.scrollTop,le=z.clientHeight,ee=Math.floor(me/P)-R,pe=Math.ceil(le/P)+2*R,ge=Math.max(0,Math.min(A-1,ee)),Ee=Math.max(ge,Math.min(A,ge+pe));I(xe=>xe.start===ge&&xe.end===Ee?xe:{start:ge,end:Ee})};D.useEffect(()=>{let z;const me=()=>{z&&cancelAnimationFrame(z),z=requestAnimationFrame(()=>{ct()})},le=k.current;if(!(!le||!u))return ct(),le.addEventListener("scroll",me),()=>{cancelAnimationFrame(z),le.removeEventListener("scroll",me)}},[A]);const We=j.start*P,ve=(A-j.end)*P,Pe=u?n==null?void 0:n.slice(j.start,j.end):n;return v?g.jsxs(g.Fragment,{children:[g.jsx(hy,{ref:k,sx:{willChange:"transform",WebkitTransform:"translateZ(0)",maxHeight:"40rem",whiteSpace:"nowrap",overflow:"auto",width:"100%",border:`0.1rem solid ${f.palette.primary.notifyBorderColor}`,borderRadius:"1.4rem",position:"relative"},children:g.jsxs(dy,{ref:O,stickyHeader:!0,"aria-label":"sticky table",sx:{backgroundColor:z=>z.palette.primary.notifyBackground},children:[g.jsxs(gy,{children:[g.jsx(qs,{sx:{position:"sticky",top:0,zIndex:3,backgroundColor:z=>z.palette.primary.notifyBackground},children:p.map((z,me)=>z!=null&&z.isHidden||(z==null?void 0:z.isVisible)===!1?null:g.jsxs(D.Fragment,{children:[Ce(z,me,x),$e(z,me,x)]},me))}),g.jsx(qs,{draggable:!1,sx:{position:"sticky",top:"2.5rem",backgroundColor:f.palette.primary.notifyBackground,zIndex:2},children:p.flatMap((z,me)=>z!=null&&z.isHidden||!(z!=null&&z.children)||(z==null?void 0:z.isVisible)===!1?[]:z.children.map((le,ee)=>le!=null&&le.isHidden?null:g.jsxs(D.Fragment,{children:[Ce(le,ee,x,z),E&&$e(le,ee,x)]},`${me}-${ee}`)))})]}),g.jsxs(py,{children:[u&&g.jsx("tr",{style:{height:We}}),ot(Pe),u&&g.jsx("tr",{style:{height:ve}})]})]})}),r&&g.jsx(kw,{pagination:r,gridPath:l,baseUrl:a,t:d}),g.jsx(Mw,{menuOpen:m==null?void 0:m.isOpen,handleClose:b,onHideClick:w})]}):g.jsx(Po,{sx:{textAlign:"center"},children:d(Jr.NRF)})}Rw.propTypes={sort:s.object,data:s.array,pagination:s.object,columns:s.object,nested:s.object};function Iw({tableProps:e,isDefaultConfig:t,gridPath:n,baseUrl:r,childUniqueKey:o,t:i}){var u;const{columns:a}=e,l=D.useContext(Ta),c=J7({columns:a,gridPath:n,baseUrl:r,isDefaultConfig:t,childUniqueKey:o,pageSize:(u=e==null?void 0:e.pagination)==null?void 0:u.rowPerPage,data:e==null?void 0:e.data});return D.useEffect(()=>{var d;c!=null&&c.length&&((d=e==null?void 0:e.data)!=null&&d.length)&&(l==null||l({type:qe.SET_GRID_DATA,payload:{visibleGridColumns:c}}))},[c,e==null?void 0:e.data]),g.jsx(Rw,{...e,gridPath:n,baseUrl:r,childUniqueKey:o,t:i})}Iw.propTypes={tableProps:s.object.isRequired,mergedColumns:s.array.isRequired};const Aw=({type:e})=>{const t=Ot(),r=(t==null?void 0:t.mode)==="dark"?{bgcolor:"grey.800"}:{};return{grid:g.jsxs(Se,{sx:{borderRadius:2,overflow:"hidden"},children:[g.jsx(Tr,{variant:"text",width:"100%",height:60,sx:r}),Array.from({length:10}).map((i,a)=>g.jsx(Se,{sx:{display:"flex",alignItems:"center",padding:"0.5rem",gap:"3rem"},children:Array.from({length:5}).map((l,c)=>g.jsx(Se,{sx:{flex:1},children:g.jsx(Tr,{variant:"text",height:45,sx:r})},c))},a))]}),toolbar:g.jsx(g.Fragment,{children:g.jsxs(rt,{direction:"row",justifyContent:"space-between",sx:{display:"flex",gap:"1rem"},children:[g.jsxs(rt,{direction:"row",gap:"1rem",children:[g.jsx(Tr,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),g.jsx(Tr,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),g.jsx(Tr,{variant:"text",width:"15.2rem",height:"5rem",sx:r})]}),g.jsxs(rt,{direction:"row",gap:"1rem",children:[g.jsx(Tr,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),g.jsx(Tr,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),g.jsx(Tr,{variant:"text",width:"3.5rem",height:"5rem",sx:r})]})]})})}[e]},mW=({customTools:e})=>{var r,o;const t=(r=e==null?void 0:e.filter(i=>(i==null?void 0:i.type)===Tw.PRIMARY))==null?void 0:r.sort((i,a)=>i.sequenceId-a.sequenceId),n=(o=e==null?void 0:e.filter(i=>(i==null?void 0:i.type)===Tw.SECONDARY))==null?void 0:o.sort((i,a)=>i.sequenceId-a.sequenceId);return{primaryButtons:t,secondaryButtons:n}},Nw=({customTools:e,isExpanded:t,setIsExpanded:n})=>{const{primaryButtons:r,secondaryButtons:o}=mW({customTools:e}),[i,a]=D.useState(r),l=(o==null?void 0:o.length)>0,c=d=>{d?a([...r,...o]):setTimeout(()=>{a(r)},100)},u=()=>{const d=!t;n(d),c(d)};return D.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(Se,{sx:{display:"flex",alignItems:"center",gap:"0.8rem",flexWrap:"nowrap",maxWidth:"100%",whiteSpace:"nowrap",zIndex:999},children:[g.jsx(NN,{mode:"popLayout",children:i.map((d,f)=>g.jsx(Ps.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},layout:!0,children:g.jsx(Se,{sx:{flexShrink:0,minWidth:"fit-content"},children:dW(d)})},`${d.id}_${f}`))}),l&&g.jsx(Se,{sx:{paddingLeft:t?"0.5rem":0},children:g.jsx(Mr,{label:t?"":"More Actions",styles:{iconPrimary:!0,icon:t?Je.CrossWhite:Je.More,colorType:t?"danger":""},onClick:u})})]})]})};Nw.propTypes={customTools:s.array.isRequired};const jw=({defaultTools:e,isManageable:t,customTools:n,baseUrl:r,gridPath:o,pageSize:i,gridData:a,childUniqueKey:l})=>{var T,x,E,v,O,k;const c=D.useContext(Ta),{visibleGridColumns:u,triggerApi:d}=D.useContext(jc),[f,p]=D.useState([]),[y,m]=D.useState(!1);D.useEffect(()=>{if(u.length){const P={id:99999,sequenceId:99999,isLocalizable:!1,key:"horizons",label:"Horizons",isSortable:!1,isHidden:!0,showChildCheckbox:!0,showCheckbox:!1,isMandatory:!0,showInHierarchy:!0,showHide:!0,children:[]};let R=u.map(j=>(j!=null&&j.children&&j.children.forEach(I=>{P.children.some(_=>_.key===I.key)||P.children.push({...I,showInHierarchy:!0})}),j)).filter(j=>(j==null?void 0:j.id)!==(P==null?void 0:P.id));const A=P.children.length>0?[...R,P]:R;p(A)}},[u]);const h=async P=>{try{await pW({baseUrl:r,gridPath:o,childUniqueKey:l,gridSetting:{grid:P,pageSize:i}})}catch(R){console.error(R)}finally{c({type:qe.HAS_SETTING_CHANGE,payload:{hasChange:!1}}),c({type:qe.TRIGGER_API,payload:{triggerApi:!1}})}};D.useEffect(()=>{d&&h(u)},[d]);const b=P=>{var I;const R=P==null?void 0:P.map(N=>N.id),A=(I=P==null?void 0:P.flatMap(N=>N.children||[]))==null?void 0:I.map(N=>N.id),j=f==null?void 0:f.map(N=>{var B,F,L;const _=R==null?void 0:R.includes(N.id);if(Array.isArray(N.children)&&N.children.length>0){const H=(B=N==null?void 0:N.children)==null?void 0:B.map(U=>{var re;const X=(re=A==null?void 0:A.includes)==null?void 0:re.call(A,U.id);return{...U,isHidden:!X}}),V=(F=H==null?void 0:H.filter(U=>f==null?void 0:f.some(X=>{var re;return(re=X.children)==null?void 0:re.some(Q=>Q.id===U.id)})))==null?void 0:F.every(U=>U.isHidden);return{...N,...!((L=N.children[0])!=null&&L.showInHierarchy)&&{isHidden:V||!_},children:H}}return{...N,isHidden:!_}});c({type:qe.SET_GRID_DATA,payload:{visibleGridColumns:j}}),c({type:qe.HAS_SETTING_CHANGE,payload:{hasChange:!0}})},w=()=>f.map(R=>{const A=Array.isArray(R.children)?R.children.filter(j=>!j.isHidden):void 0;return!R.isHidden||R.isHidden&&R.showInHierarchy?{...R,children:A}:null}).filter(Boolean);return g.jsxs(Se,{sx:{margin:"1rem 0",position:"relative",zIndex:10,display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"0.6rem",width:"100%"},children:[g.jsxs(Se,{sx:{display:"flex",flexDirection:"row",gap:"0.6rem"},children:[((T=e==null?void 0:e.search)==null?void 0:T.isRequired)&&g.jsx(R1,{...e==null?void 0:e.search,iconUrl:Je.Search}),((x=e==null?void 0:e.refresh)==null?void 0:x.isRequired)&&g.jsx(Mr,{...e==null?void 0:e.refresh,styles:{variant:"filled",icon:Je.Refresh,colorType:"empty",width:"3.2rem",height:"3.2rem"}}),((E=e==null?void 0:e.groupBy)==null?void 0:E.isRequired)&&g.jsx(Se,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:g.jsx(Ws,{styles:{icon:Je.Group},...e.groupBy})}),t&&g.jsx(Se,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:g.jsx(Ws,{placeholder:"Manage Columns",options:f,value:w(),isMulti:!0,isDraggable:!0,showSearch:!0,isManageColumn:!0,onChange:b,disabled:!a.length,styles:{icon:Je.Manage}})})]}),g.jsxs(Se,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",gap:"0.6rem"},children:[n&&g.jsx(Nw,{customTools:n,setIsExpanded:m,isExpanded:y}),((v=e==null?void 0:e.save)==null?void 0:v.isRequired)&&g.jsx(Se,{sx:{px:"0.5rem"},children:g.jsx(Mr,{label:y?"":"Save",styles:{icon:Je.Save,colorType:"empty"},...e==null?void 0:e.save})}),((O=e==null?void 0:e.upload)==null?void 0:O.isRequired)&&g.jsx(Mr,{...e==null?void 0:e.upload,styles:{variant:y?"outlined":"filled",icon:y?Je.UploadDark:Je.Upload,iconPrimary:!y,colorType:"secondary",isAnimate:!0}}),((k=e==null?void 0:e.download)==null?void 0:k.isRequired)&&g.jsx(Mr,{...e==null?void 0:e.download,styles:{variant:"outlined",icon:Je.Download,isAnimate:!0}})]})]})};jw.propTypes={defaultTools:s.object.isRequired,customTools:s.array,isManageable:s.bool,baseUrl:s.string,gridPath:s.gridPath};function ph({tableProps:e,toolbarProps:t,isDefaultConfig:n,isLoading:r,t:o}){var a,l;const i=(a=e.columns)==null?void 0:a.isManageable;return g.jsx(k1,{children:r?g.jsxs(g.Fragment,{children:[t&&g.jsx(Aw,{type:"toolbar"}),e&&g.jsx(Aw,{type:"grid"})]}):g.jsxs(Se,{sx:{position:"sticky"},children:[t&&g.jsx(jw,{...t,isManageable:i,pageSize:(l=e==null?void 0:e.pagination)==null?void 0:l.rowPerPage,gridData:e==null?void 0:e.data,t:o}),g.jsx(Iw,{tableProps:e,isDefaultConfig:n,gridPath:(t==null?void 0:t.gridPath)||"",baseUrl:(t==null?void 0:t.baseUrl)||"",childUniqueKey:(t==null?void 0:t.childUniqueKey)||"",t:o})]})})}ph.propTypes={tableProps:s.object.isRequired,toolbarProps:s.object,isDefaultConfig:s.bool};const _w=({list:e,handleLinkClick:t})=>{const n=Ot(),r=({list:o})=>{var i;return(i=o==null?void 0:o.sort((a,l)=>a.order-l.order))==null?void 0:i.map((a,l)=>a!=null&&a.link?g.jsx(Wr,{component:"h3",sx:{fontSize:"1rem",cursor:"pointer",color:l===(o==null?void 0:o.length)-1?n.palette.brandColor.orange:n.palette.primary.notifyTextColor},href:a==null?void 0:a.link,underline:"hover",onClick:()=>t(a),children:a==null?void 0:a.title},l):g.jsx(nt,{component:"h3",sx:{fontSize:"1rem",color:l===(o==null?void 0:o.length)-1?n.palette.brandColor.orange:n.palette.primary.notifyTextColor},children:a==null?void 0:a.title},l))};return g.jsx(mg,{separator:g.jsx(mn,{url:Je.ArrowRight}),children:r({list:e})})};_w.propTypes={list:s.array.isRequired,handleLinkClick:s.func};const Fw=({breadcrumbProps:e,switchProps:t,filterComponentProps:n,metaDataProps:r})=>{var a,l,c,u,d,f,p,y;const o=Ot(),i=(a=n==null?void 0:n.filterBtnProps)==null?void 0:a.disabled;return g.jsxs(g.Fragment,{children:[g.jsxs(rt,{sx:{background:o.palette.primary.notifyBackground,borderBottom:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,height:"3rem",p:"0px 1.5rem 0 1.5rem",zIndex:4,position:"relative"},direction:"row",justifyContent:"space-between",alignItems:"center",children:[g.jsx(_w,{...e}),g.jsxs(rt,{direction:"row",gap:"1rem",alignItems:"center",children:[r,t&&g.jsx(_1,{...t}),(n==null?void 0:n.filterBtnProps)&&g.jsxs(rt,{direction:"row",children:[g.jsx(Ii,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"2rem!important",opacity:"1!important",borderColor:o.palette.primary.notifyBorderColor}}),g.jsxs(rt,{direction:"row",alignItems:"center",gap:"0.5rem",onClick:(l=n==null?void 0:n.filterBtnProps)==null?void 0:l.onFilterClick,sx:{opacity:i?.5:1,cursor:i?"not-allowed":"pointer"},children:[g.jsx(mn,{url:Je.Filter}),g.jsx(nt,{sx:{fontSize:"1.1rem",color:o.palette.primary.notifyActiveText},children:(c=n==null?void 0:n.filterBtnProps)==null?void 0:c.label})]})]})]})]}),g.jsx(Ps.div,{layout:!0,initial:{height:"0rem"},animate:{height:(u=n==null?void 0:n.filterBtnProps)!=null&&u.filterContainerVisible?"5rem":"0rem",opacity:(d=n==null?void 0:n.filterBtnProps)!=null&&d.filterContainerVisible?1:0},transition:{duration:.5,ease:"easeInOut"},style:{background:o.palette.primary.notifyBackground,borderBottom:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,padding:"0px 5.5rem 0 1.5rem",position:"relative",alignItems:"center",display:"flex",overflow:"hidden",width:(f=n==null?void 0:n.filterContainerProps)!=null&&f.isSideDrawerOpen?"75%":"100%"},children:g.jsxs(rt,{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(nt,{sx:{fontSize:"1.2rem",fontWeight:"500",color:o.palette.primary.notifyActiveText},children:"Filters:"}),g.jsx(Se,{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(rt,{direction:"row",gap:"1.2rem",sx:{overflow:"visible"},children:(p=n==null?void 0:n.filterItems)==null?void 0:p.map((m,h)=>g.jsx(g.Fragment,{children:g.jsxs(Se,{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(Se,{component:"img",src:Je.FilterClose,sx:{position:"absolute",top:"-0.4rem",right:"-0.6rem",cursor:"pointer"},onClick:()=>n==null?void 0:n.onFilterChipClose(m)}),g.jsx(nt,{sx:{fontSize:"1rem",color:o.palette.primary.notifyTextColor},children:m==null?void 0:m.filterLabel})]},h)}))})}),g.jsx(Se,{component:nt,sx:{fontSize:"1.1rem",fontWeight:"500",textDecoration:"underline",color:o.palette.brandColor.red,cursor:"pointer"},onClick:(y=n==null?void 0:n.filterContainerProps)==null?void 0:y.onClearClick,children:"Clear"})]})})]})};Fw.propTypes={breadcrumbProps:s.object.isRequired,switchProps:s.object};function $w({headerProps:e}){return g.jsx(En,{children:g.jsx(Fw,{...e})})}$w.propTypes={headerProps:s.object.isRequired};const hh=D.createContext(null),Lw=D.createContext(null);function Bw({children:e}){const[t,n]=D.useReducer(gW,yW);return g.jsx(hh.Provider,{value:t,children:g.jsx(Lw.Provider,{value:n,children:e})})}function gW(e,t){var n;switch(t.type){case qe.LOADING:return{...e,loading:t.loading};case qe.SUCCESS:return{...e,data:(n=t.data)==null?void 0:n.sort((r,o)=>new Date(o.createdAt)-new Date(r.createdAt))};case qe.MARK_ALL_AS_READ:return{...e,isMarkAllAsRead:t.isMarkAllAsRead};case qe.SET_ACTIVE_TAB:return{...e,activeTab:t.activeTab};case qe.SET_MODE:return{...e,mode:t.mode};case qe.ERROR:return{...e,error:t.error};default:throw new Error(`${Jr.UNHANDLED}: ${t}`)}}const yW={loading:!1,data:[],error:"",isMarkAllAsRead:{count:0,boo:!1},mode:!1,activeTab:0},{TENANT_ID:mh,BU_ID:gh}=Sw,{TENANT_IDS:yh,BU_IDS:bh}=Ew,bW=async e=>{try{const t=localStorage.getItem("i18nextLng"),n=`${e}${qc.NOTIFICATION}/v1?${mh}=${yh}&${gh}=${bh}&lang=${t}`;return await St.get(n,Da)}catch(t){return t}},Vw=async(e,t,n)=>{try{const r=localStorage.getItem("i18nextLng"),o=`${e}${qc.NOTIFICATION}${sh.VERSION}?${mh}=${yh}&${gh}=${bh}&lang=${r}`;return await St.put(o,t,Da)}catch(r){return r}},vW=async({baseUrl:e,id:t,snopId:n})=>{try{const r=localStorage.getItem("i18nextLng"),o=`${e}${qc.NOTIFICATION}${sh.VERSION}?${mh}=${yh}&${gh}=${bh}&id=${t}&lang=${r}`;return await St.get(o,Da)}catch(r){return r}},Ys={OK:200,CREATED:201,NO_CONTENT:204,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,INTERNAL_SERVER_ERROR:500},Ww=({baseUrl:e})=>{const t=D.useContext(Lw),[n,r]=D.useState(!1),[o,i]=D.useState(!1),[a,l]=D.useState(!1),[c,u]=D.useState({}),[d,f]=D.useState(null),[p,y]=D.useState(1),m=D.useRef(!1),{loading:h,data:b,isMarkAllAsRead:w,mode:T,activeTab:x}=D.useContext(hh),[E,v]=D.useState([]);D.useEffect(()=>{v(b)},[b]);const O=D.useCallback(async()=>{var N,_,$;if(!(m.current||!e))try{t({type:qe.LOADING,loading:!0}),t({type:qe.SUCCESS,data:[]});const B=await bW(e);if(B.status===Ys.UNAUTHORIZED){m.current=!0;return}if(B.status===Ys.OK){const F=((_=(N=B.data)==null?void 0:N.responseData)==null?void 0:_.response)||[],L=Nc(F);t({type:qe.SET_MODE,mode:!1}),t({type:qe.SUCCESS,data:Nc(L)}),t({type:qe.MARK_ALL_AS_READ,isMarkAllAsRead:{count:O1(F),boo:O1(F)>0}})}}catch(B){(($=B==null?void 0:B.response)==null?void 0:$.status)===Ys.UNAUTHORIZED&&(m.current=!0),t({type:qe.ERROR,error:Jr.SWR})}finally{t({type:qe.LOADING,loading:!1})}},[e,t]),k=N=>{const _=(b||[]).filter($=>T?!$.isRead:!0);return{0:_,1:_.filter($=>($==null?void 0:$.type)==="INFO"),2:_.filter($=>($==null?void 0:$.type)==="ERROR")}};D.useEffect(()=>{O();const N=setInterval(O,3e5);return()=>clearInterval(N)},[O]);const P=async(N,_)=>{var $,B;if(!(!N||!e)){f(N);try{const F=await vW({baseUrl:e,id:N,snopId:_});if(F.status===Ys.OK){const L=((B=($=F.data)==null?void 0:$.responseData)==null?void 0:B.response)||{};u(L||{}),l(!0)}else throw new Error}catch{t({type:qe.ERROR,error:Jr.SWR})}finally{f(null)}}},R=async(N,_)=>{if(!(!N.length||!e)){t({type:qe.LOADING,loading:!0});try{if((await Vw(e,N,_)).status===Ys.OK){const B=b.map(L=>N.includes(L.id)?{...L,isRead:!0}:L),F=B.filter(L=>!L.isRead).length;F===0&&t({type:qe.SET_MODE,mode:!1}),t({type:qe.SUCCESS,data:Nc(B)}),t({type:qe.MARK_ALL_AS_READ,isMarkAllAsRead:{count:F,boo:F>0}}),setTimeout(()=>{t({type:qe.LOADING,loading:!1})},200)}}catch{t({type:qe.ERROR,error:Jr.SWR}),t({type:qe.LOADING,loading:!1})}}},A=async()=>{if(e){t({type:qe.LOADING,loading:!0});try{const N=VV(b);if((await Vw(e,N,H7.MARK_ALL_READ)).status===Ys.OK){const $=b.map(B=>({...B,isRead:!0}));t({type:qe.SET_MODE,mode:!1}),t({type:qe.SUCCESS,data:Nc($)}),t({type:qe.MARK_ALL_AS_READ,isMarkAllAsRead:{count:0,boo:!1}}),setTimeout(()=>{t({type:qe.LOADING,loading:!1})},200)}}catch{t({type:qe.ERROR,error:Jr.SWR}),t({type:qe.LOADING,loading:!1})}}},j=(N,_)=>{t({type:qe.LOADING,loading:!0}),t({type:qe.SET_ACTIVE_TAB,activeTab:_}),setTimeout(()=>{t({type:qe.LOADING,loading:!1})},400)},I=()=>{t({type:qe.LOADING,loading:!0});const N=T?b||[]:(E||[]).filter(_=>!_.isRead);t({type:qe.SET_MODE,mode:!T}),v(N),y(1),setTimeout(()=>{t({type:qe.LOADING,loading:!1})},400)};return{fetchNotification:O,showDetailsProps:{open:a,handleClose:()=>l(!1),setOpen:l,data:c,clickId:d},alertDialogProps:{open:n,handleClose:()=>r(!1),onRefresh:O,handleRead:R,handleMarkAllAsRead:A,setOpen:r,handleShowDetails:P,clickId:d,isMainDialog:!0},activeTab:x,loading:h,tabData:k()[x],data:E,mode:T,handleTabChange:j,toggleAlertMode:I,page:p,setPage:y,isMarkAllAsRead:w}};var zw,Hw,Uw;function vh(){return vh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vh.apply(null,arguments)}var xW=function(t){return S.createElement("svg",vh({xmlns:"http://www.w3.org/2000/svg",width:16,height:17,fill:"none"},t),zw||(zw=S.createElement("path",{stroke:"#909090",strokeLinecap:"round",strokeMiterlimit:10,d:"M8.013 2.19c-2.206 0-4 1.793-4 4v1.927c0 .406-.173 1.026-.38 1.373l-.766 1.273c-.474.787-.147 1.66.72 1.954 2.873.96 5.973.96 8.846 0a1.335 1.335 0 0 0 .72-1.954l-.766-1.273c-.2-.347-.374-.967-.374-1.373V6.19c0-2.2-1.8-4-4-4Z"})),Hw||(Hw=S.createElement("path",{stroke:"#909090",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10,d:"M9.247 2.383a4.503 4.503 0 0 0-2.467 0 1.324 1.324 0 0 1 2.467 0"})),Uw||(Uw=S.createElement("path",{stroke:"#909090",strokeMiterlimit:10,d:"M10.013 12.957c0 1.1-.9 2-2 2a2.007 2.007 0 0 1-2-2"})))};const wW=({count:e})=>(Ot(),g.jsxs(g.Fragment,{children:[g.jsx(Se,{sx:{gap:"0.5rem",display:"flex",justifyContent:"center",alignItems:"center","& svg":{transform:"scale(1)"}},children:g.jsx(xW,{style:{scale:2}})}),g.jsx(oW,{badgeContent:e!=0?"":null,color:"error"})]}));function qw({children:e,handleClose:t,open:n,isMainDialog:r}){return g.jsx(jl,{open:n,onClose:t,scroll:r?"paper":void 0,fullWidth:!r,maxWidth:r?void 0:"md",PaperProps:{sx:r?{position:"fixed",top:30,right:30,m:0,width:400,height:450,display:"flex",flexDirection:"column",borderRadius:2,boxShadow:6,backgroundColor:o=>o.palette.primary.notifyBackground}:{minHeight:250,maxHeight:500,borderRadius:"1.5rem",boxShadow:6,backgroundColor:o=>o.palette.primary.appBackground}},children:e})}var Yw;function xh(){return xh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},xh.apply(null,arguments)}var CW=function(t){return S.createElement("svg",xh({xmlns:"http://www.w3.org/2000/svg",width:14,height:9,fill:"none",viewBox:"0 0 13 9"},t),Yw||(Yw=S.createElement("path",{fill:"#A8A8A8",fillRule:"evenodd",d:"M8.954 1.004a.406.406 0 0 1 0 .575L3.537 6.996a.406.406 0 0 1-.574 0L.796 4.829a.406.406 0 1 1 .575-.575l1.879 1.88 5.13-5.13a.406.406 0 0 1 .574 0m3.25 0a.406.406 0 0 1 0 .575L6.787 6.996a.406.406 0 1 1-.574-.575l5.416-5.417a.406.406 0 0 1 .575 0",clipRule:"evenodd"})))},Gw,Kw;function wh(){return wh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},wh.apply(null,arguments)}var SW=function(t){return S.createElement("svg",wh({xmlns:"http://www.w3.org/2000/svg",width:12,height:12,fill:"none"},t),Gw||(Gw=S.createElement("path",{stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"round",d:"M7.79 6c0 .99-.8 1.79-1.79 1.79S4.21 6.99 4.21 6 5.01 4.21 6 4.21s1.79.8 1.79 1.79"})),Kw||(Kw=S.createElement("path",{stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"round",d:"M6 10.135c1.765 0 3.41-1.04 4.555-2.84.45-.705.45-1.89 0-2.595C9.41 2.9 7.765 1.86 6 1.86S2.59 2.9 1.445 4.7c-.45.705-.45 1.89 0 2.595 1.145 1.8 2.79 2.84 4.555 2.84"})))},Xw;function Ch(){return Ch=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ch.apply(null,arguments)}var TW=function(t){return S.createElement("svg",Ch({xmlns:"http://www.w3.org/2000/svg",width:9,height:8,fill:"none"},t),Xw||(Xw=S.createElement("path",{fill:"#fff",fillRule:"evenodd",d:"M8.277 1.004a.406.406 0 0 1 0 .575L2.86 6.996a.406.406 0 0 1-.574 0L.119 4.829a.406.406 0 1 1 .575-.575l1.879 1.88 5.13-5.13a.406.406 0 0 1 .574 0",clipRule:"evenodd"})))};const Zw=({type:e,item:t,handleShowDetails:n,handleRead:r,handleCTAClicked:o,clickId:i,t:a})=>{var u,d;const l=Ot(),c=(d=(u=JSON.parse(localStorage.getItem("settings")))==null?void 0:u.platform)==null?void 0:d.theme;return g.jsxs(Se,{className:"cards",sx:{pt:" 0.8rem"},children:[g.jsx(rt,{display:"flex",flexDirection:"row",alignItems:"start",justifyContent:"space-between",gap:1,children:g.jsx(hd,{sx:{width:"calc(100% - 2%)","& .MuiBadge-badge":{backgroundColor:"#6041EA",height:"0.5rem",minWidth:"0.5rem"}},variant:"dot",invisible:t==null?void 0:t.isRead,children:g.jsx(Po,{sx:{color:l.palette.primary.notifyActiveText,whiteSpace:"normal",wordBreak:"break-word"},component:"p",className:["title-card",(t==null?void 0:t.isRead)&&"read"].join(" "),children:a(t==null?void 0:t.message)})})}),g.jsx(rt,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:g.jsxs(rt,{display:"flex",flexDirection:"row",justifyContent:"start",gap:1,sx:{p:"0.5rem 0"},children:[(t==null?void 0:t.isNotificationDetails)&&g.jsx(Kc,{icon:g.jsx(SW,{className:`${c==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:n,label:i===(t==null?void 0:t.id)?g.jsx(Mi,{color:"primary",size:13}):a("SHOW_DETAILS"),component:"button",variant:"filled",clickable:!0,size:"small",sx:{backgroundColor:l.palette.brandColor.orange,color:l.palette.brandColor.white}}),!(t!=null&&t.isRead)&&g.jsx(Kc,{icon:g.jsx(TW,{className:`${c==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:r,label:a("ACKNOWLEDGE"),component:"button",variant:"outlined",clickable:!0,size:"small"}),(t==null?void 0:t.primaryCTAURL)&&g.jsx(Kc,{disabled:t==null?void 0:t.isPrimaryCTAClicked,onClick:()=>o({redirect:t==null?void 0:t.isPrimaryCTARedirect,isClicked:t==null?void 0:t.isPrimaryCTAClicked,url:t==null?void 0:t.primaryCTAURL}),label:a(t==null?void 0:t.primaryCTALabel),component:"button",variant:"outlined",clickable:!0,size:"small"}),(t==null?void 0:t.secondaryCTAURL)&&g.jsx(Kc,{disabled:t==null?void 0:t.isSecondaryCTAClicked,onClick:()=>o({redirect:t==null?void 0:t.isSecondaryCTARedirect,isClicked:t==null?void 0:t.isSecondaryCTAClicked,url:t==null?void 0:t.secondaryCTAURL}),label:a(t==null?void 0:t.secondaryCTALabel),component:"button",variant:"outlined",clickable:!0,size:"small"})]})}),g.jsxs(rt,{display:"flex",flexDirection:"row",alignItems:"center",gap:.35,children:[g.jsx(Po,{sx:{fontSize:"0.8rem"},children:a(t==null?void 0:t.product)}),g.jsx(Po,{color:l.palette.primary.notifyTextColor,children:"•"}),g.jsx(Po,{sx:{fontSize:"0.8rem"},children:BV(t==null?void 0:t.createdAt)})]})]})};Zw.propTypes={type:s.string,title:s.string,subTitle:s.string,isRead:s.bool,handleShowDetails:s.func,handleRead:s.func};const Jw=({data:e,handleRead:t,handleShowDetails:n,clickId:r,mode:o,page:i,setPage:a,t:l})=>{const{isMarkAllAsRead:c}=D.useContext(hh),u=new Date,d=new Intl.DateTimeFormat("en-US",{day:"numeric",month:"long",year:"numeric"}).format(u),[f,p]=D.useState([]),[y,m]=D.useState(!1),[h,b]=D.useState(!0),w=D.useRef(null),T=async E=>{m(!0);const v=e.slice((E-1)*10,E*10);await new Promise(O=>setTimeout(O,1e3)),p(O=>{const k=v.filter(P=>!O.some(R=>R.id===P.id));return[...O,...k]}),m(!1),(f==null?void 0:f.length)>=(e==null?void 0:e.length)&&b(!1)};D.useEffect(()=>{var v;let E=[];o?c!=null&&c.count?E=(v=e==null?void 0:e.filter(O=>!O.isRead))==null?void 0:v.slice(0,10):E=[]:E=e.slice(0,10),(E==null?void 0:E.length)<10&&b(!1),p(E)},[e,o,c]),D.useEffect(()=>{h&&i!==1&&T(i)},[i,e]),D.useEffect(()=>{p([...e])},[e]),D.useEffect(()=>{const E=new IntersectionObserver(v=>{v[0].isIntersecting&&!y&&h&&a(O=>O+1)},{threshold:1});return w.current&&E.observe(w.current),()=>{w.current&&E.unobserve(w.current)}},[y,h]);const x=({redirect:E,isClicked:v,url:O})=>{window.open(O,"_blank")};return g.jsxs(Se,{sx:{width:"100%"},children:[Object.entries(HV(f)).map(([E,v])=>{const O=localStorage.getItem("i18nextLng"),k=new Date(E),P=new Intl.DateTimeFormat(O,{month:"long"}).format(k),R=k.getDate(),A=k.getFullYear(),j=`${P} ${R}, ${A}`;return g.jsxs(D.Fragment,{children:[E!==d&&g.jsx(rW,{children:j}),v.map((I,N)=>g.jsx(D.Fragment,{children:g.jsx(Zw,{item:I,handleCTAClicked:x,handleShowDetails:()=>n(I.id,I.snopId),handleRead:()=>t([I.id],I.snopId),clickId:r,t:l})},`${N}_${I.id}`))]},E)}),y&&i>1&&!!(f!=null&&f.length)&&g.jsx(Se,{sx:{display:"flex",justifyContent:"center",alignItems:"center",pl:"0.5rem",py:"0.3rem"},children:g.jsx(Mi,{size:20,sx:{color:E=>E.palette.primary.notifyIconColor}})}),!(f!=null&&f.length)&&g.jsx(nt,{sx:{fontSize:"1.1rem",color:E=>E.palette.primary.notifyTextColor,textAlign:"center",px:"0.8rem"},children:l("CONTAINER_MESSAGE")}),g.jsx(Se,{ref:w,style:{height:"0.1rem",backgroundColor:"transparent"}})]})};Jw.propTypes={data:s.array,handleRead:s.func,handleShowDetails:s.func};const EW=({onRefresh:e,handleShowDetails:t,clickId:n,handleRead:r,handleMarkAllAsRead:o,t:i})=>{var h,b,w,T;const{loading:a,activeTab:l,data:c,tabData:u,mode:d,page:f,setPage:p,handleTabChange:y,toggleAlertMode:m}=Ww({});return g.jsxs(g.Fragment,{children:[g.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,pt:2},children:[g.jsx(nt,{variant:"h2",sx:{fontSize:"1.2rem",color:x=>x.palette.primary.notifyTextColor},children:i("NOTIFICATION")}),g.jsx(Se,{onClick:e,children:g.jsx(mn,{url:Je.Refresh,alt:"refresh",sx:{cursor:"pointer"}})})]}),g.jsx(Se,{sx:{borderBottom:1,m:"1.2rem 1.2rem 0 1.2rem",borderColor:x=>x.palette.primary.notifyBorderColor},children:g.jsxs(sW,{value:l,onChange:y,children:[g.jsx(fh,{label:g.jsx(Se,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:g.jsx(nt,{component:"span",sx:{fontWeight:500,fontSize:"1rem"},children:i("ALL",{count:((h=c==null?void 0:c.filter(x=>!(x!=null&&x.isRead)))==null?void 0:h.length)||0})})})}),g.jsx(fh,{label:g.jsx(Se,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:g.jsx(nt,{component:"span",sx:{fontWeight:500,fontSize:"1rem"},children:i("INFO",{count:((b=c==null?void 0:c.filter(x=>(x==null?void 0:x.type)==="INFO"&&!(x!=null&&x.isRead)))==null?void 0:b.length)||0})})}),sx:{color:x=>x.palette.brandColor.blue}}),g.jsx(fh,{label:g.jsx(Se,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:i("ERROR",{count:((w=c==null?void 0:c.filter(x=>(x==null?void 0:x.type)==="ERROR"&&!(x!=null&&x.isRead)))==null?void 0:w.length)||0})}),sx:{color:x=>x.palette.brandColor.red}})]})}),g.jsx(Fl,{dividers:!0,sx:{p:0,...a&&!u.length&&{alignItems:"center",justifyContent:"center"},flexGrow:1,overflowY:"auto",mx:"1.2rem",borderColor:x=>x.palette.primary.notifyBorderColor},tabIndex:-1,children:a?g.jsx(Mi,{size:30,sx:{color:x=>x.palette.primary.notifyIconColor}}):g.jsx(g.Fragment,{children:g.jsx(Jw,{data:u,handleShowDetails:t,handleRead:r,clickId:n,page:f,setPage:p,mode:d,t:i})})}),g.jsxs(_l,{sx:{justifyContent:"space-between",px:"1.2rem"},children:[g.jsxs(rt,{direction:"row",gap:1,children:[g.jsx(Po,{sx:{fontSize:"1rem"},children:i("SHOW_UNREAD")}),g.jsx(nW,{disabled:a,checked:d,onChange:m})]}),g.jsx(qn,{variant:"outlined",className:"view-all",onClick:o,startIcon:g.jsx(CW,{}),disabled:!((T=c==null?void 0:c.filter(x=>!(x!=null&&x.isRead)))!=null&&T.length),style:{backgroundColor:"transparent"},sx:{fontSize:"1rem",fontWeight:"300",p:0,border:"none",textTransform:"none",color:x=>x.palette.primary.notifyTextColor,"&:hover":{color:x=>x.palette.primary.notifyActiveText,background:"transparent",boxShadow:"none",border:"none"},"&.Mui-disabled":{opacity:.5,color:x=>`${x.palette.primary.notifyActiveText}!important`,background:"transparent",boxShadow:"none",border:"none"}},children:i("READ_ALL")})]})]})},OW=({data:e,handleClose:t,t:n})=>{var w;const[r,o]=D.useState(1),[i,a]=D.useState(10),[l,c]=D.useState(((w=e==null?void 0:e.notificationDetails)==null?void 0:w.length)||0),[u,d]=D.useState("sku_name"),[f,p]=D.useState("asc"),[y,m]=D.useState([]),[h,b]=D.useState("");return D.useEffect(()=>{var T,x;if((h||u)&&((T=e==null?void 0:e.notificationDetails)!=null&&T.length)){const E=WV(e==null?void 0:e.notificationDetails,W7,h);if(u){const v=zV(E,u,f);m(Vp(v,r,i)),c((v==null?void 0:v.length)||0);return}m(Vp(E,r,i)),c((E==null?void 0:E.length)||0);return}m(Vp(e==null?void 0:e.notificationDetails,r,i)),c((x=e==null?void 0:e.notificationDetails)==null?void 0:x.length)},[h,e,r,i,f,u]),g.jsxs(g.Fragment,{children:[g.jsxs(rt,{direction:"row",justifyContent:"space-between",sx:{padding:"1.5rem 2rem",borderBottom:"0.1rem solid",borderColor:T=>T.palette.primary.notifyBorderColor},children:[g.jsx(nt,{component:"h2",sx:{fontSize:"1.4rem",color:T=>T.palette.primary.notifyActiveText},children:n(e==null?void 0:e.message)||(e==null?void 0:e.message)}),g.jsx(Se,{onClick:t,sx:{cursor:"pointer"},children:g.jsx(mn,{url:Je.CloseCircle})})]}),g.jsx(Fl,{children:g.jsx(ph,{t:n,tableProps:{data:y,columns:{...tW({t:n}),isManageable:!1},sort:{sortField:u,sortDir:f,onSort:T=>{var E;const x=(E=T==null?void 0:T.column)==null?void 0:E.key;p(v=>u===x&&v==="asc"?"desc":"asc"),d(x)}},pagination:{selectedPage:r,rowPerPage:i,totalRecords:l,onPageChange:T=>{o(T)},onPageSizeChange:T=>{a(T==null?void 0:T.value),o(1)}}},toolbarProps:{defaultTools:{search:{isRequired:!0,onChange:T=>{const x=T.target.value;x&&o(1),b(x)},placeholder:`${n("SEARCH")}...`}}}})}),g.jsx(_l,{sx:{padding:"1.5rem 2rem"}})]})},kW=({baseUrl:e,t})=>{const{alertDialogProps:n,showDetailsProps:r,fetchNotification:o,isMarkAllAsRead:i}=Ww({baseUrl:e});return g.jsxs(g.Fragment,{children:[g.jsx(Se,{sx:{display:"flex",justifyContent:"center",cursor:"pointer",marginTop:"0.6rem"},onClick:()=>{var a;o(),(a=n==null?void 0:n.setOpen)==null||a.call(n,!0)},children:g.jsx(wW,{count:i.count})}),g.jsx(qw,{...n,children:g.jsx(EW,{...n,t})}),g.jsx(qw,{...r,children:g.jsx(OW,{...r,t})})]})},MW=({baseUrl:e,t})=>g.jsx(En,{children:g.jsx(Bw,{children:g.jsx(kW,{baseUrl:e,t})})}),PW=({rightChild:e,leftChild:t,isDrawerMerged:n,isDrawerOpen:r,drawerTitle:o,showExpand:i,onCloseClick:a,onMergeClick:l,onExpandClick:c,isDrawerExpanded:u,styles:d,showMerge:f})=>{const p=Ot();return g.jsx(Se,{sx:{position:"relative",overflow:"hidden"},children:g.jsxs(fo,{container:!0,sx:{height:"100%"},children:[g.jsx(fo,{item:!0,sx:{width:n?d!=null&&d.drawerWidth?`calc(${"100%"-(d==null?void 0:d.drawerWidth)})`:"75%":"100%",position:"relative",zIndex:3,height:"calc(100vh - 7rem)",p:"0rem 1.5rem",overflow:"auto"},children:t}),r&&!n&&g.jsx(g.Fragment,{children:g.jsx(Se,{onClick:a,sx:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"#07080B80",backdropFilter:"blur(3px)",zIndex:3,transition:"opacity 0.3s ease-in-out"}})}),e&&g.jsxs(fo,{item:!0,sx:{width:u?"90%":(d==null?void 0:d.drawerWidth)||"25%",position:n?"relative":"absolute",top:0,right:0,height:"calc(100vh - 7rem)",backgroundColor:p.palette.primary.notifyBackground,transform:r?"translateX(0)":"translateX(100%)",transition:"transform 0.4s ease-in-out , width 0.4s ease-in-out",zIndex:4,borderLeft:`0.1rem solid ${p.palette.primary.notifyBorderColor}`,display:"flex",flexDirection:"column"},children:[g.jsxs(rt,{direction:"row",alignItems:"center",sx:{width:"100%",flexShrink:0,paddingBottom:"0.8rem",px:2,pt:"0.8rem",borderBottom:y=>`0.1rem solid ${y.palette.primary.notifyBorderColor}`},children:[!u&&f&&g.jsxs(g.Fragment,{children:[g.jsx(Se,{component:"img",src:Je.Merge,sx:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer"},onClick:l}),g.jsx(Ii,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"auto!important",borderColor:p.palette.primary.notifyBorderColor}})]}),g.jsxs(rt,{direction:"row",justifyContent:"space-between",alignItems:"center",flexGrow:1,children:[g.jsxs(rt,{direction:"row",gap:"0.5rem",alignItems:"center",onClick:a,sx:{cursor:"pointer"},children:[g.jsx(mn,{url:Je.CrossLight}),g.jsx(nt,{sx:{fontSize:"1.2rem",color:p.palette.primary.notifyTextColor},children:o})]}),g.jsx(rt,{direction:"row",gap:"0.5rem",alignItems:"center",children:i&&g.jsx(Se,{onClick:c,sx:{cursor:"pointer"},children:g.jsx(Se,{component:"img",src:u?Je.Collapse:Je.Expand})})})]})]}),g.jsx(Se,{sx:{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},overflow:"auto",px:2},children:e})]})]})})},Qw=({layoutChildren:e,layoutProps:t})=>g.jsx(En,{children:g.jsx(PW,{...e,...t})});Qw.propTypes={layoutChildren:s.object.isRequired,layoutProps:s.object.isRequired};const eC=({parentProps:e,childProps:t})=>{const n=Ot();return g.jsxs(rt,{sx:{background:n.palette.primary.notifyBackground,border:`0.1rem solid ${n.palette.primary.notifyBorderColor}`,borderRadius:"1rem",position:"relative",overflow:"hidden"},children:[g.jsx(rt,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{maxHeight:"10rem",p:"1.5rem",cursor:"pointer",zIndex:4},onClick:t.toggleExpand,children:e.content}),g.jsx(Ps.div,{layout:!0,initial:{opacity:0,maxHeight:0},animate:{opacity:t.isExpanded?1:0,maxHeight:t.isExpanded?"50rem":0},transition:{duration:.5,ease:"easeInOut"},style:{background:n.palette.primary.notifyBackground,overflow:"hidden",display:"flex",flexDirection:"column",width:"100%"},children:g.jsx(Se,{sx:{p:"1rem"},children:t.content})})]})};eC.propTypes={parentProps:s.object.isRequired,childProps:s.object.isRequired};const tC=({accordionProps:e})=>g.jsx(En,{children:g.jsx(Bw,{children:g.jsx(eC,{...e})})});tC.propTypes={accordionProps:s.object.isRequired},bt.Accordion=tC,bt.Button=Mr,bt.Checkbox=fc,bt.DatePicker=JV,bt.Grid=ph,bt.Header=$w,bt.InputField=R1,bt.Loader=m8,bt.Notification=MW,bt.Select=I1,bt.SliderLayout=Qw,bt.Switch=_1,bt.TextField=Ic,bt.ToastProvider=u8,bt.toast=i8,Object.defineProperty(bt,Symbol.toStringTag,{value:"Module"})});
327
327
  //# sourceMappingURL=index.umd.js.map