@3sc/common-component 0.0.555 → 0.0.557

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as t, i as e, B as i, C as o, D as r, G as c, H as d, I as n, L as l, N as u, S as x, h as A, g as S, T, e as f, f as h, t as y, u as C } from "./index-Dl-ja_fK.js";
1
+ import { A as t, i as e, B as i, C as o, D as r, G as c, H as d, I as n, L as l, N as u, S as x, h as A, g as S, T, e as f, f as h, t as y, u as C } from "./index-QgT4vAFB.js";
2
2
  export {
3
3
  t as Accordion,
4
4
  e as AnalyticsProvider,
package/dist/index.umd.js CHANGED
@@ -253,5 +253,5 @@ To suppress this warning, you need to explicitly provide the \`palette.${t}Chann
253
253
  `)}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[Rv]=this[Rv]={accessors:{}}).accessors,o=this.prototype;function i(a){const l=Ci(a);r[l]||(x4(o,a),r[l]=!0)}return H.isArray(t)?t.forEach(i):i(t),this}};Xt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),H.reduceDescriptors(Xt.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),H.freezeMethods(Xt);function tf(e,t){const n=this||Si,r=t||n,o=Xt.from(r.headers);let i=r.data;return H.forEach(e,function(l){i=l.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function Av(e){return!!(e&&e.__CANCEL__)}function Qo(e,t,n){Le.call(this,e??"canceled",Le.ERR_CANCELED,t,n),this.name="CanceledError"}H.inherits(Qo,Le,{__CANCEL__:!0});function jv(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Le("Request failed with status code "+n.status,[Le.ERR_BAD_REQUEST,Le.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function w4(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function S4(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 m=d&&u-d;return m?Math.round(p*1e3/m):void 0}}function C4(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 Cl=(e,t,n=3)=>{let r=0;const o=S4(50,250);return C4(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)},Iv=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Nv=e=>(...t)=>H.asap(()=>e(...t)),T4=$t.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,$t.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL($t.origin),$t.navigator&&/(msie|trident)/i.test($t.navigator.userAgent)):()=>!0,k4=$t.hasStandardBrowserEnv?{write(e,t,n,r,o,i,a){if(typeof document>"u")return;const l=[`${e}=${encodeURIComponent(t)}`];H.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),H.isString(r)&&l.push(`path=${r}`),H.isString(o)&&l.push(`domain=${o}`),i===!0&&l.push("secure"),H.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 E4(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function O4(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function $v(e,t,n){let r=!E4(t);return e&&(r||n==!1)?O4(e,t):t}const Bv=e=>e instanceof Xt?{...e}:e;function Qr(e,t){t=t||{};const n={};function r(u,d,f,p){return H.isPlainObject(u)&&H.isPlainObject(d)?H.merge.call({caseless:p},u,d):H.isPlainObject(d)?H.merge({},d):H.isArray(d)?d.slice():d}function o(u,d,f,p){if(H.isUndefined(d)){if(!H.isUndefined(u))return r(void 0,u,f,p)}else return r(u,d,f,p)}function i(u,d){if(!H.isUndefined(d))return r(void 0,d)}function a(u,d){if(H.isUndefined(d)){if(!H.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(Bv(u),Bv(d),f,!0)};return H.forEach(Object.keys({...e,...t}),function(d){const f=c[d]||o,p=f(e[d],t[d],d);H.isUndefined(p)&&f!==l||(n[d]=p)}),n}const Lv=e=>{const t=Qr({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:a,auth:l}=t;if(t.headers=a=Xt.from(a),t.url=Ov($v(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),H.isFormData(n)){if($t.hasStandardBrowserEnv||$t.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(H.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($t.hasStandardBrowserEnv&&(r&&H.isFunction(r)&&(r=r(t)),r||r!==!1&&T4(t.url))){const c=o&&i&&k4.read(i);c&&a.set(o,c)}return t},P4=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){const o=Lv(e);let i=o.data;const a=Xt.from(o.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:u}=o,d,f,p,m,h;function g(){m&&m(),h&&h(),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 S(){if(!b)return;const w=Xt.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),v={data:!l||l==="text"||l==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:w,config:e,request:b};jv(function(O){n(O),g()},function(O){r(O),g()},v),b=null}"onloadend"in b?b.onloadend=S:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(S)},b.onabort=function(){b&&(r(new Le("Request aborted",Le.ECONNABORTED,e,b)),b=null)},b.onerror=function(x){const v=x&&x.message?x.message:"Network Error",C=new Le(v,Le.ERR_NETWORK,e,b);C.event=x||null,r(C),b=null},b.ontimeout=function(){let x=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const v=o.transitional||Mv;o.timeoutErrorMessage&&(x=o.timeoutErrorMessage),r(new Le(x,v.clarifyTimeoutError?Le.ETIMEDOUT:Le.ECONNABORTED,e,b)),b=null},i===void 0&&a.setContentType(null),"setRequestHeader"in b&&H.forEach(a.toJSON(),function(x,v){b.setRequestHeader(v,x)}),H.isUndefined(o.withCredentials)||(b.withCredentials=!!o.withCredentials),l&&l!=="json"&&(b.responseType=o.responseType),u&&([p,h]=Cl(u,!0),b.addEventListener("progress",p)),c&&b.upload&&([f,m]=Cl(c),b.upload.addEventListener("progress",f),b.upload.addEventListener("loadend",m)),(o.cancelToken||o.signal)&&(d=w=>{b&&(r(!w||w.type?new Qo(null,e,b):w),b.abort(),b=null)},o.cancelToken&&o.cancelToken.subscribe(d),o.signal&&(o.signal.aborted?d():o.signal.addEventListener("abort",d)));const E=w4(o.url);if(E&&$t.protocols.indexOf(E)===-1){r(new Le("Unsupported protocol "+E+":",Le.ERR_BAD_REQUEST,e));return}b.send(i||null)})},M4=(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 Le?d:new Qo(d instanceof Error?d.message:d))}};let a=t&&setTimeout(()=>{a=null,i(new Le(`timeout ${t} of ms exceeded`,Le.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=()=>H.asap(l),c}},D4=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},R4=async function*(e,t){for await(const n of A4(e))yield*D4(n,t)},A4=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()}},_v=(e,t,n,r)=>{const o=R4(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})},Fv=64*1024,{isFunction:Tl}=H,j4=(({Request:e,Response:t})=>({Request:e,Response:t}))(H.global),{ReadableStream:Wv,TextEncoder:Vv}=H.global,zv=(e,...t)=>{try{return!!e(...t)}catch{return!1}},I4=e=>{e=H.merge.call({skipUndefined:!0},j4,e);const{fetch:t,Request:n,Response:r}=e,o=t?Tl(t):typeof fetch=="function",i=Tl(n),a=Tl(r);if(!o)return!1;const l=o&&Tl(Wv),c=o&&(typeof Vv=="function"?(h=>g=>h.encode(g))(new Vv):async h=>new Uint8Array(await new n(h).arrayBuffer())),u=i&&l&&zv(()=>{let h=!1;const g=new n($t.origin,{body:new Wv,method:"POST",get duplex(){return h=!0,"half"}}).headers.has("Content-Type");return h&&!g}),d=a&&l&&zv(()=>H.isReadableStream(new r("").body)),f={stream:d&&(h=>h.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(h=>{!f[h]&&(f[h]=(g,b)=>{let S=g&&g[h];if(S)return S.call(g);throw new Le(`Response type '${h}' is not supported`,Le.ERR_NOT_SUPPORT,b)})});const p=async h=>{if(h==null)return 0;if(H.isBlob(h))return h.size;if(H.isSpecCompliantForm(h))return(await new n($t.origin,{method:"POST",body:h}).arrayBuffer()).byteLength;if(H.isArrayBufferView(h)||H.isArrayBuffer(h))return h.byteLength;if(H.isURLSearchParams(h)&&(h=h+""),H.isString(h))return(await c(h)).byteLength},m=async(h,g)=>{const b=H.toFiniteNumber(h.getContentLength());return b??p(g)};return async h=>{let{url:g,method:b,data:S,signal:E,cancelToken:w,timeout:x,onDownloadProgress:v,onUploadProgress:C,responseType:O,headers:M,withCredentials:D="same-origin",fetchOptions:A}=Lv(h),$=t||fetch;O=O?(O+"").toLowerCase():"text";let T=M4([E,w&&w.toAbortSignal()],x),j=null;const I=T&&T.unsubscribe&&(()=>{T.unsubscribe()});let B;try{if(C&&u&&b!=="get"&&b!=="head"&&(B=await m(M,S))!==0){let R=new n(g,{method:"POST",body:S,duplex:"half"}),V;if(H.isFormData(S)&&(V=R.headers.get("content-type"))&&M.setContentType(V),R.body){const[q,X]=Iv(B,Cl(Nv(C)));S=_v(R.body,Fv,q,X)}}H.isString(D)||(D=D?"include":"omit");const L=i&&"credentials"in n.prototype,W={...A,signal:T,method:b.toUpperCase(),headers:M.normalize().toJSON(),body:S,duplex:"half",credentials:L?D:void 0};j=i&&new n(g,W);let Y=await(i?$(j,A):$(g,W));const U=d&&(O==="stream"||O==="response");if(d&&(v||U&&I)){const R={};["status","statusText","headers"].forEach(te=>{R[te]=Y[te]});const V=H.toFiniteNumber(Y.headers.get("content-length")),[q,X]=v&&Iv(V,Cl(Nv(v),!0))||[];Y=new r(_v(Y.body,Fv,q,()=>{X&&X(),I&&I()}),R)}O=O||"text";let F=await f[H.findKey(f,O)||"text"](Y,h);return!U&&I&&I(),await new Promise((R,V)=>{jv(R,V,{data:F,headers:Xt.from(Y.headers),status:Y.status,statusText:Y.statusText,config:h,request:j})})}catch(L){throw I&&I(),L&&L.name==="TypeError"&&/Load failed|fetch/i.test(L.message)?Object.assign(new Le("Network Error",Le.ERR_NETWORK,h,j),{cause:L.cause||L}):Le.from(L,L&&L.code,h,j)}}},N4=new Map,Hv=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=N4;for(;l--;)c=i[l],u=d.get(c),u===void 0&&d.set(c,u=l?new Map:I4(t)),d=u;return u};Hv();const nf={http:r4,xhr:P4,fetch:{get:Hv}};H.forEach(nf,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Uv=e=>`- ${e}`,$4=e=>H.isFunction(e)||e===null||e===!1;function B4(e,t){e=H.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,!$4(r)&&(o=nf[(l=String(r)).toLowerCase()],o===void 0))throw new Le(`Unknown adapter '${l}'`);if(o&&(H.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 :
254
254
  `+a.map(Uv).join(`
255
255
  `):" "+Uv(a[0]):"as no adapter specified";throw new Le("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return o}const Yv={getAdapter:B4,adapters:nf};function rf(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Qo(null,e)}function qv(e){return rf(e),e.headers=Xt.from(e.headers),e.data=tf.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Yv.getAdapter(e.adapter||Si.adapter,e)(e).then(function(r){return rf(e),r.data=tf.call(e,e.transformResponse,r),r.headers=Xt.from(r.headers),r},function(r){return Av(r)||(rf(e),r&&r.response&&(r.response.data=tf.call(e,e.transformResponse,r.response),r.response.headers=Xt.from(r.response.headers))),Promise.reject(r)})}const Gv="1.13.2",kl={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{kl[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Kv={};kl.transitional=function(t,n,r){function o(i,a){return"[Axios v"+Gv+"] Transitional option '"+i+"'"+a+(r?". "+r:"")}return(i,a,l)=>{if(t===!1)throw new Le(o(a," has been removed"+(n?" in "+n:"")),Le.ERR_DEPRECATED);return n&&!Kv[a]&&(Kv[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}},kl.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function L4(e,t,n){if(typeof e!="object")throw new Le("options must be an object",Le.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 Le("option "+i+" must be "+c,Le.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Le("Unknown option "+i,Le.ERR_BAD_OPTION)}}const El={assertOptions:L4,validators:kl},Kn=El.validators;let eo=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Pv,response:new Pv}}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+=`
256
- `+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Qr(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&El.assertOptions(r,{silentJSONParsing:Kn.transitional(Kn.boolean),forcedJSONParsing:Kn.transitional(Kn.boolean),clarifyTimeoutError:Kn.transitional(Kn.boolean)},!1),o!=null&&(H.isFunction(o)?n.paramsSerializer={serialize:o}:El.assertOptions(o,{encode:Kn.function,serialize:Kn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),El.assertOptions(n,{baseUrl:Kn.spelling("baseURL"),withXsrfToken:Kn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&H.merge(i.common,i[n.method]);i&&H.forEach(["delete","get","head","post","put","patch","common"],h=>{delete i[h]}),n.headers=Xt.concat(a,i);const l=[];let c=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(n)===!1||(c=c&&g.synchronous,l.unshift(g.fulfilled,g.rejected))});const u=[];this.interceptors.response.forEach(function(g){u.push(g.fulfilled,g.rejected)});let d,f=0,p;if(!c){const h=[qv.bind(this),void 0];for(h.unshift(...l),h.push(...u),p=h.length,d=Promise.resolve(n);f<p;)d=d.then(h[f++],h[f++]);return d}p=l.length;let m=n;for(;f<p;){const h=l[f++],g=l[f++];try{m=h(m)}catch(b){g.call(this,b);break}}try{d=qv.call(this,m)}catch(h){return Promise.reject(h)}for(f=0,p=u.length;f<p;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=Qr(this.defaults,t);const n=$v(t.baseURL,t.url,t.allowAbsoluteUrls);return Ov(n,t.params,t.paramsSerializer)}};H.forEach(["delete","get","head","options"],function(t){eo.prototype[t]=function(n,r){return this.request(Qr(r||{},{method:t,url:n,data:(r||{}).data}))}}),H.forEach(["post","put","patch"],function(t){function n(r){return function(i,a,l){return this.request(Qr(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}eo.prototype[t]=n(),eo.prototype[t+"Form"]=n(!0)});let _4=class W2{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 Qo(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 W2(function(o){t=o}),cancel:t}}};function F4(e){return function(n){return e.apply(null,n)}}function W4(e){return H.isObject(e)&&e.isAxiosError===!0}const of={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(of).forEach(([e,t])=>{of[t]=e});function Xv(e){const t=new eo(e),n=fv(eo.prototype.request,t);return H.extend(n,eo.prototype,t,{allOwnKeys:!0}),H.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return Xv(Qr(e,o))},n}const ft=Xv(Si);ft.Axios=eo,ft.CanceledError=Qo,ft.CancelToken=_4,ft.isCancel=Av,ft.VERSION=Gv,ft.toFormData=wl,ft.AxiosError=Le,ft.Cancel=ft.CanceledError,ft.all=function(t){return Promise.all(t)},ft.spread=F4,ft.isAxiosError=W4,ft.mergeConfig=Qr,ft.AxiosHeaders=Xt,ft.formToJSON=e=>Dv(H.isHTMLForm(e)?new FormData(e):e),ft.getAdapter=Yv.getAdapter,ft.HttpStatusCode=of,ft.default=ft;const{Axios:Y$,AxiosError:q$,CanceledError:G$,isCancel:K$,CancelToken:X$,VERSION:Z$,all:J$,Cancel:Q$,isAxiosError:e8,spread:t8,toFormData:n8,AxiosHeaders:r8,HttpStatusCode:o8,formToJSON:s8,getAdapter:i8,mergeConfig:a8}=ft,sf={BASE_URL:"https://qa.3sc.ai/api",VERSION:"/v1"},Ti={headers:{"Content-Type":"application/json"},withCredentials:!0},Zv=ft.create({baseURL:sf.BASE_URL,axiosConfig:Ti});Zv.interceptors.request.use(function(e){return e},function(e){return Promise.reject(e)}),Zv.interceptors.response.use(function(e){return e},function(e){return Promise.reject(e)});const ur={TOKEN:"token",USER:"user",SNOP:"snop",SELECTED_BU:"selected_business_unit",SETTINGS:"settings"},Jv={TENANT_ID:"tenant_id",BU_ID:"bu_id"},V4=Object.values({"SKU Name":"sku_name",Node:"node","Channel Name":"channel_name"}),z4=[10,25,50,100],H4={MARK_ALL_READ:"MARK_ALL_READ"},U4=z4.map(e=>({label:e,value:e})),Qv={PRIMARY:"PRIMARY",SECONDARY:"SECONDARY"},Ol={NOTIFICATION:"/notifications",SETTING:"/configuration/setting"};function Pl(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 Y4={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 af(e,t){function n(o,i,a){if(!(typeof document>"u")){a=Pl({},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,"",Pl({},i,{expires:-1}))},withAttributes:function(o){return af(this.converter,Pl({},this.attributes,o))},withConverter:function(o){return af(Pl({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var q4=af(Y4,{path:"/"});const G4=ml(ur.SNOP),K4=ml(ur.SELECTED_BU),X4=ml(ur.USER);ml(ur.SETTINGS);const e2={BU_IDS:K4?.business_unit_id,TOKEN:JSON.parse(q4.get(ur.TOKEN)||null),TENANT_IDS:X4?.tenant_id,SNOP_IDS:G4?.snop_id},{TENANT_ID:Z4,BU_ID:J4}=Jv,{TENANT_IDS:Q4,BU_IDS:eN}=e2,Ml=async({baseUrl:e,payload:t})=>{try{const n=`${e}${Ol.SETTING}/v1?${Z4}=${Q4}&${J4}=${eN}`;return await ft.post(n,t,Ti)}catch(n){return n}},tN=({columns:e,gridPath:t,baseUrl:n,isDefaultConfig:r,pageSize:o=10,childUniqueKey:i,data:a})=>{const l=a?.length;let{definitions:c,defaultUserSettings:u,labels:d}=e;const f=dr(d),p=t.split("/").filter(Boolean),m=JSON.parse(localStorage.getItem(ur.SETTINGS));let h=p.reduce((w,x)=>w?.[x],m)||null;const g=dr(h?.columns||[]);if(!r&&t&&l){let w=(u&&lf({col:u,childUniqueKey:i,definitions:c}))??lf({col:c,childUniqueKey:i});const x=w.filter(C=>!g[C.key]),v=h&&h?.columns?.some(C=>C?.children&&C.children[i]);if(l&&(x.length||i&&v===!1)){if(v==!1&&i.length>0){const C=dr(w);w=h?.columns?.map(O=>O?.children&&!O.children[i]?{...O,children:{...O.children,[i]:C?.[O?.key]?.children[i]}}:O)}(async()=>{try{const O={...m||{platform:{theme:"light"}}},M=h?.pageSize??o;let D=O;for(let A=0;A<p.length;A++){const $=p[A];A===p.length-1?D[$]={columns:w,pageSize:M}:(D[$]={...D[$]||{}},D=D[$])}localStorage.setItem(ur.SETTINGS,JSON.stringify(O)),await Ml({baseUrl:n,payload:O})}catch(C){console.error(C)}})()}}u=(h?.columns&&nN(g,u,i))??u??lf({col:c});const b=[],S=dr(u);for(const w of c){const x=S[w.key]||{},v=f[w.key]||{},C=g[w.key],O=dr(x.children||[]),M=dr(v.children||[]);let D={...w,style:C?.style,...x,...v};w.children?.length&&(D.children=w.children.map(A=>({...A,...O[A.key],...M[A.key]}))),b.push(D)}return b.sort((w,x)=>w.sequenceId-x.sequenceId)},t2=e=>e.sort((t,n)=>t.sequenceId-n.sequenceId),ki=({columns:e,childUniqueKey:t,definitions:n})=>{let r=n||e;return e?.map(o=>{let i=r?.find(a=>a?.key===o?.key);return{id:o.id,key:o.key,sequenceId:o.sequenceId||o.id,isHidden:o.isHidden||!1,style:o.style||i?.style||{},...o?.children&&{children:t?{[t]:ki({columns:o.children,definitions:i?.children})}:ki({columns:o.children,definitions:i?.children})}}})},dr=e=>Array.isArray(e)&&e?.reduce((t,n)=>(t[n.key]=n,t),{}),lf=({col:e,childUniqueKey:t,definitions:n})=>ki({columns:e,childUniqueKey:t,definitions:n}),nN=(e,t,n)=>t.map(o=>{const i=e[o.key],a=o.children?o.children.map(l=>{const u=dr(Array.isArray(i?.children)?i?.children:i?.children?.[n])?.[l.key];return{...l,sequenceId:u?.sequenceId||l.sequenceId,isHidden:u?.isHidden??l.isHidden}}):void 0;return{...o,sequenceId:i?.sequenceId||o.sequenceId,isHidden:i?.isHidden??o.isHidden,...a?{children:a}:{}}}),rN=({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(y9),isLocalizable:!1},{id:2,key:"node",label:e(g9),isLocalizable:!1},{id:3,key:"channel_name",label:e(b9),isLocalizable:!1}];return{definitions:t,defaultUserSettings:n,labels:r}},n2=e=>{let{disabled:t=!1,minWidth:n=0,maxWidth:r,className:o="",id:i,resizeStart:a,resizeEnd:l,defaultWidth:c,rowSpan:u=1,colSpan:d=1}=e;const[f,p]=k.useState(!1),[m,h]=k.useState(0),[g,b]=k.useState(0),[S,E]=k.useState(0),[w,x]=k.useState(null),v=k.useRef(null),C=k.useCallback(T=>{if(!t&&(x(i),a&&a(),p(!0),h(T),b(0),v.current)){const j=v.current.previousSibling;j&&b(j.clientWidth)}},[t,i,a]),O=k.useCallback(()=>{t||(f&&l&&w===i&&l(S),p(!1),x(null))},[t,l,w,i,S,f]),M=k.useCallback(T=>{if(t)return;const j=T instanceof TouchEvent?T.touches[0].screenX:T.screenX;if(!f)return;const I=v.current;if(!I||!I.previousSibling)return;const B=I.previousSibling,L=m-j;let W=g-L;n!==void 0&&W<n&&(W=n),r!==void 0&&W>r&&(W=r),B.style.width=W+"px",B.style.minWidth=W+"px",B.style.maxWidth=W+"px",B.style.setProperty("--column_resize_before_width",W+"px"),E(W)},[t,f,m,g,n,r]);k.useEffect(()=>{const T=v.current;if(T&&T.previousSibling){const j=T.previousSibling;c?(j.style.minWidth=c+"px",j.style.width=c+"px",j.style.maxWidth=c+"px",j.style.setProperty("--column_resize_before_width",c+"px")):n&&(j.style.minWidth=n+"px",j.style.width=n+"px",j.style.maxWidth=n+"px",j.style.setProperty("--column_resize_before_width",n+"px"))}},[c,n]),k.useEffect(()=>{const T=v.current;if(t&&T&&T.previousSibling){const j=T.previousSibling;c&&(j.style.minWidth=c+"px",j.style.width=c+"px",j.style.maxWidth=c+"px",j.style.setProperty("--column_resize_before_width",c+"px")),r&&(j.style.maxWidth=r+"px")}},[t,c,r]);const D=k.useCallback(()=>{document.addEventListener("mousemove",M),document.addEventListener("mouseup",O),document.addEventListener("touchmove",M),document.addEventListener("touchend",O)},[M,O]),A=k.useCallback(()=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",O),document.removeEventListener("touchmove",M),document.removeEventListener("touchend",O)},[M,O]);k.useEffect(()=>(t||D(),()=>{A()}),[t,D,A]);const $={userSelect:"none"};return t||($.cursor="ew-resize"),o===""&&($.width="6px",$.backgroundColor="rgba(0, 0, 0, 0.1)"),k.createElement("th",{ref:v,style:$,rowSpan:u,colSpan:d,className:"column_resizer_own_class ".concat(t?"disabled_column_resize":""," ").concat(o),onMouseDown:t?void 0:T=>C(T.screenX),onTouchStart:t?void 0:T=>C(T.touches[0].screenX)})};function Dl({isRenderCellContent:e,column:t,row:n,parent:r}){const o=n[t.key],i=o?.length>20;return y.jsx(y.Fragment,{children:e?y.jsx(se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem"},children:t?.cellRenderer(n,{column:t,parent:r})}):y.jsx(y.Fragment,{children:i?y.jsx(Ha,{title:o,placement:"top",componentsProps:{tooltip:{sx:{fontSize:"1rem",padding:"0.5rem 1rem",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"}}},children:y.jsx(se,{sx:{maxWidth:"auto",whiteSpace:"normal"},children:y.jsx(lt,{sx:{fontSize:"1.1rem",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none"},children:o})})}):y.jsx(se,{sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem",m:0},id:t.key,component:"p",children:o??""})})})}Dl.propTypes={isRenderCellContent:s.bool,column:s.object,row:s.object},ee(Gc)(({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 Dr=ee(lt)(({theme:e})=>({color:e.palette.primary.notifyTextColor,fontSize:"1.1rem"})),oN=ee(e0)(({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)"})}})),sN=ee(Mo)(({theme:e})=>({color:e.palette.primary.notifyTextColor,padding:"0.6rem 0",fontSize:"0.9rem",fontWeight:500,"&::before, &::after":{borderColor:`${e.palette.primary.notifyBorderColor}!important`}})),iN=ee(Vc)(({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"}}));ee(fu)(({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 aN=ee(h0)(({theme:e})=>({minHeight:"2rem","& .MuiTabs-indicator":{height:"0.1rem",backgroundColor:e.palette.primary.notifyActiveText}})),cf=ee(t0)(({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}})),Rl=ee(om)(({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`}})),lN=ee(Do)(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"table-cell",[`&.${lu.head}`]:{color:e.palette.primary.notifyTextColor,backgroundColor:e.palette.primary.notifyBackground,borderColor:e.palette.primary.notifyBorderColor,padding:"0rem",textAlign:"center",lineHeight:"1.5rem"},[`&.${lu.body}`]:{color:e.palette.primary.notifyTextColor,borderColor:e.palette.primary.notifyBorderColor,padding:"0rem",textAlign:"center"}}));function to({children:e,...t}){return y.jsx(lN,{...t,children:e})}to.propTypes={children:s.node};const cN=ee(a0)(()=>({"&:last-child td":{borderBottom:"none"}}));function Rr({children:e,...t}){return y.jsx(cN,{...t,children:e})}Rr.propTypes={children:s.node};const r2=k.memo(({row:e,isSelected:t,isHigh:n,onRowClick:r,children:o})=>y.jsx(Rr,{sx:i=>({backgroundColor:t||n?i.palette.primary.appBackground:i.palette.primary.notifyBackground}),onClick:()=>r?.(e),children:o},e?.fhi)),o2=k.memo(({nestedData:e,nestedColumn:t,t:n})=>e?.length?y.jsx(y.Fragment,{children:e.map((r,o)=>y.jsx(Rr,{children:t.map((i,a)=>y.jsx(to,{style:i?.style,children:y.jsx(Dl,{isRenderCellContent:!!i?.cellRenderer,column:i,row:r})},a))},`nested-${o}`))}):y.jsx(Rr,{children:y.jsx(to,{colSpan:t.length,children:y.jsx(Dr,{sx:{textAlign:"center"},children:n(cr.NRF)})})})),s2=(e,t,n,r,o,i)=>{const[a,l]=k.useState({isOpen:!1,column:null}),c=(p,m,h)=>{l({isOpen:p.currentTarget,column:m,isChild:!!h})},u=()=>{l({isOpen:!1,column:null,isChild:!1})},d=async()=>{u();const p=e.map(m=>{if(a?.isChild&&Array.isArray(m.children)){const h=m.children.map(b=>b.key===a.column?.key?{...b,isHidden:!0}:b),g=h.every(b=>b.isHidden);return{...m,isHidden:g?!0:m.isHidden,children:h}}return m.key===a.column?.key?{...m,isHidden:!0}:m});f({updatedColumns:p})},f=async({updatedColumns:p})=>{t({type:je.SET_GRID_DATA,payload:{visibleGridColumns:p}});const m=r.split("/").filter(Boolean),h=JSON.parse(localStorage.getItem(ur.SETTINGS));let g=m.reduce((C,O)=>C?.[O],h)||null,b=ki({columns:p,childUniqueKey:i});const S=dr(g?.columns);b=b?.map(C=>{const O=C?.children||{},M=S?.[C?.key]?.children||{};return{...C,...(Object.keys(M)?.length>0||O?.[i])&&{children:{...M,[i]:O?.[i]}}}});const w={...h||{platform:{theme:"light"}}},x=g?.pageSize??o;let v=w;for(let C=0;C<m.length;C++){const O=m[C];C===m.length-1?v[O]={columns:b,pageSize:x}:(v[O]={...v[O]||{}},v=v[O])}localStorage.setItem(ur.SETTINGS,JSON.stringify(w)),await Ml({baseUrl:n,payload:w})};return{selectedColumn:a,handleMenuClick:c,handleClose:u,handleHideClick:d,columnUpdaterFunction:f}},uN=e=>{if(!e)return null;const{options:t,...n}=e,r=t?"select":"button",o={button:i=>y.jsx(sr,{...i,styles:{...i.styles,iconPrimary:i?.styles?.variant=="filled"}}),select:i=>y.jsx(se,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"},width:i.styles?.width},children:y.jsx(cv,{...i,options:t})})};return o[r]?o[r](n):null},dN=({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?.[d],e)||null,a=ki({columns:t?.grid,childUniqueKey:r});const l=dr(i?.columns);a=a?.map(u=>{const d=u?.children||{},f=l?.[u?.key]?.children||{};return{...u,...(Object.keys(f)?.length>0||d?.[r])&&{children:{...f,[r]: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?.pageSize??null}:(c[d]=c[d]||{},c=c[d])}return{settingObject:e,defaultUserSettings:a}},fN=async({baseUrl:e,gridSetting:t,childUniqueKey:n,gridPath:r})=>{try{const o=JSON.parse(localStorage.getItem("settings")),{settingObject:i,defaultUserSettings:a}=dN({presentSetting:o,gridSetting:t,gridPath:r,childUniqueKey:n});return localStorage.setItem("settings",JSON.stringify(i)),await Ml({baseUrl:e,payload:i}),a}catch(o){console.error(o)}},i2=({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]},uf=({pagination:e,gridPath:t,baseUrl:n,t:r})=>{const{selectedPage:o,rowPerPage:i,totalRecords:a,onPageChange:l,onPageSizeChange:c}=e,u=it(),d=async(m,h)=>{if(!h)return;const g=h.split("/").filter(Boolean),b="settings",E={...JSON.parse(localStorage.getItem(b))||{}};let w=E;for(let x=0;x<g.length;x++){const v=g[x];x===g.length-1?w[v]={...w[v]||{},pageSize:m}:(w[v]={...w[v]||{}},w=w[v])}localStorage.setItem(b,JSON.stringify(E)),await Ml({baseUrl:n,payload:E})},f=a===0?0:(o-1)*i+1,p=Math.min(o*i,a);return y.jsxs(se,{sx:{display:"flex",p:"1rem 1.5rem"},children:[y.jsxs(se,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"0.5rem",width:"100%"},children:[y.jsx(lt,{sx:{fontSize:"1.1rem",color:u.palette.primary.notifyTextColor},children:r("SHOWING_ROWS",{start:f,end:p,current:Math.min(o*i,a),total:a})}),y.jsx(se,{sx:{"& .MuiInputBase-input":{padding:"0rem 0.8rem!important"},width:"6rem"},children:y.jsx(Xo,{options:U4,value:i,onChange:async m=>{c(m),d(m?.value,t)}})})]}),y.jsx(Gm,{count:Math.ceil(a/i),page:o,onChange:async(m,h)=>{l(h)},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`}}})]})};uf.propTypes={pagination:s.object.isRequired};const df=({menuOpen:e,handleClose:t,onHideClick:n})=>{const r=it(),{t:o}=k.useContext(an);return y.jsx(Ys,{open:!!e,anchorEl:e,onClose:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:y.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:y.jsx(Na,{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:o("LABEL_HIDE_COLUMN")})})})};df.propTypes={menuOpen:s.object,handleClose:s.func,onHideClick:s.func};const a2=({sortKey:e,sortField:t,sortDir:n,handleSortClick:r})=>{const o=i=>y.jsx(xa,{onClick:r,sx:{padding:"0.2rem"},draggable:!1,children:y.jsx(Gt,{url:i})});return y.jsx(y.Fragment,{children:o(t===e?n==="asc"?ze.AscSort:ze.DescSort:ze.Unsort)})};a2.propTypes={sortKey:s.string.isRequired,sortField:s.string,sortDir:s.string,handleSortClick:s.func};function ff({parent:e,column:t,sort:n,handleMenuClick:r,isManageable:o}){const i=o&&(!t?.isMandatory||t?.isMandatory&&t?.showHide===!0),a=t?.label,l=t?.helpText,c=t?.isSortable,u=n?.sortField,d=n?.sortDir,f=n?.onSort;return y.jsxs(se,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},draggable:!1,children:[y.jsx(se,{sx:{fontWeight:"bold",fontSize:"1.1rem",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"0.5rem",textAlign:"center"},children:y.jsx(Ha,{title:l??a,placement:"top",componentsProps:{tooltip:{sx:{fontSize:"1rem",padding:"0.6rem 1rem",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"}}},children:a??""})}),y.jsxs(se,{sx:{display:"flex",alignItems:"center"},draggable:!1,children:[c&&y.jsx(a2,{sortKey:e?`${e?.key}|${t?.key}`:t?.key,sortField:u,sortDir:d,handleSortClick:()=>f({column:t,sortDir:d,sortField:u,parent:e})}),i&&y.jsx(xa,{draggable:!1,onClick:p=>r(p,t,e),sx:{padding:"0.2rem"},children:y.jsx(Gt,{url:ze.Menu})})]})]})}ff.propTypes={column:s.object.isRequired,sort:s.object.isRequired,handleMenuClick:s.func,isManageable:s.bool};function l2({rows:e,sort:t,data:n,pagination:r,columns:o,nested:i,baseUrl:a,gridPath:l,childUniqueKey:c,isVirtualizedTable:u=!1,t:d}){const f=it(),{visibleGridColumns:p}=k.useContext(yi),m=k.useContext(Ko),{selectedColumn:h,handleMenuClick:g,handleClose:b,handleHideClick:S,columnUpdaterFunction:E}=s2(p,m,a,l,r?.rowPerPage,c),w=o?.isManageable,x=o?.isResizable,v=n?.length>0,C=k.useRef(null),O=k.useRef(null),M=45,D=10,A=n?.length,[$,T]=k.useState({start:0,end:10}),[j,I]=k.useState(null),[B,L]=k.useState(null),[W,Y]=k.useState(null);let U=null;const F=k.useRef(0),R=k.useRef(!1),V=k.useRef(null),q=t2(i?.column?.definitions||[]),X=i?.isNested,te=i?.data||[],G=i?.hashKey,[Z,ie]=k.useState(0);k.useEffect(()=>{if(C.current){const ne=()=>{ie(C.current.offsetHeight)};return ne(),window.addEventListener("resize",ne),()=>window.removeEventListener("resize",ne)}},[n]),k.useEffect(()=>{const re=C.current?.querySelector("thead");if(!re)return;const ue=()=>{Y(null)};return re?.addEventListener("mousedown",ue),()=>{re?.removeEventListener("mousedown",ue)}},[]);const ae=(ne,re)=>{if(R.current){ne.preventDefault();return}I(re),Y(null),ne.dataTransfer.setData("colIndex",re);const ue=p[re],ye=ue?.label,fe=document.createElement("div");fe.textContent=ye,Object.assign(fe.style,{display:"flex",alignItems:"center",justifyContent:"center",padding:"1.5rem 2.5rem",minWidth:ue?.style?.minWidth,maxWidth:ue?.style?.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(fe);const{offsetWidth:Ae,offsetHeight:Ne}=fe;ne.dataTransfer.setDragImage(fe,Ae/2,Ne/2),requestAnimationFrame(()=>{document.body.removeChild(fe)})},_=(ne,re)=>{ne.preventDefault(),L(re),we(ne)},z=async(ne,re)=>{if(ne.preventDefault(),clearInterval(U),j===null||j===re)return;const ue=[...p],[ye]=ue.splice(j,1);ue.splice(re,0,ye);const fe=p.slice().sort((Ne,Ue)=>Ne.sequenceId-Ue.sequenceId).map(Ne=>Ne.sequenceId),Ae=ue.map((Ne,Ue)=>({...Ne,sequenceId:fe[Ue]??Ne.sequenceId}));E({updatedColumns:Ae}),I(null),L(null)},N=()=>{I(null),L(null)},oe=(ne,re,ue,ye)=>{if(!ne)return null;const fe=ne?.isMandatory&&ne?.isSticky,Ae=parseFloat(ne?.style?.minWidth?.toString().replace("rem",""))||7.5;re===0&&(F.current=0);const Ne=fe?re===0?0:`${F.current}rem`:void 0;fe&&(F.current+=Ae);const Ue=j===re,be=B==re||p?.[B]?.isMandatory,yt=Ye=>{ne.isMandatory?(Ye.preventDefault(),Ye.dataTransfer.dropEffect="none"):(Ye.preventDefault(),Ye.dataTransfer.dropEffect="move"),_?.(Ye,re)},ct=Ye=>{ne.isMandatory||z?.(Ye,re)};return ye&&`${ye?.key}${ne?.key}${re}`,y.jsx(to,{rowSpan:ne?.children?1:2,colSpan:ne?.children?.filter(Ye=>!Ye?.isHidden)?.length,style:ne?.style,draggable:ue&&!ne?.isMandatory,onDragStart:ue&&!ne?.isMandatory?Ye=>ae(Ye,re):Ye=>{Ye.preventDefault()},onDragOver:ue&&!ne?.isMandatory?yt:void 0,onDrop:ue&&!ne?.isMandatory?ct:void 0,onDragEnd:ue&&!ne?.isMandatory?N:void 0,sx:{...ne?.isSticky&&{boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...ne.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...ne?.key==="volume_value"&&{borderLeft:"1px solid"}},...Ue&&{border:`0.1rem solid ${f.palette.brandColor.lightBlue}!important`},...fe&&{position:"sticky",left:Ne,zIndex:3},cursor:be?"not-allowed":ue&&!ne?.isMandatory?"grab":"default"},children:y.jsx(ff,{parent:ye,column:ne,sort:t,handleMenuClick:g,isManageable:ue})},re)},Q=k.useCallback((ne,re,ue,ye)=>{if(!ne)return null;const fe=ne?.isMandatory&&ne?.isSticky,Ae=parseFloat(ne?.style?.minWidth?.toString().replace("rem",""))||7.5;ue===0&&(F.current=0);const Ne=fe?ue===0?0:`${F.current}rem`:void 0;return fe&&(F.current+=Ae),y.jsxs(to,{colSpan:1,style:ne?.style,className:`${ne?.label}`,sx:{position:"relative",...ne.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...ne?.key==="volume_value"&&{borderLeft:"1px solid"}},...ne?.isSticky&&{boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...fe&&{position:"sticky",left:Ne,zIndex:2,backgroundColor:Ue=>e?.selectedRow&&e?.selectedRow?.fhi===re?.fhi||re?.isHigh?Ue.palette.primary.appBackground:Ue.palette.primary.notifyBackground}},children:[(e?.selectedRow&&e?.selectedRow?.fhi===re?.fhi||re?.isHigh)&&y.jsx(se,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none",zIndex:1}}),y.jsx(Dl,{isRenderCellContent:!!ne?.cellRenderer,column:ne,row:re,parent:ye})]},ue)},[e?.selectedRow,f]),le=(ne,re,ue,ye)=>y.jsx(y.Fragment,{children:ne&&ue&&!ne?.isMandatory?y.jsx(se,{resizeStart:()=>{ne?.isMandatory&&!ne?.isResizable||(R.current=!0)},resizeEnd:fe=>{ne?.isMandatory&&!ne?.isResizable||fe<=20||(R.current=!1,i2({index:re,visibleGridColumns:p,width:fe,columnUpdaterFunction:E}))},component:ne?.children||ne?.isMandatory?Do:n2,rowSpan:ne?.children?1:2,colSpan:1,id:re,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},...!ne?.isMandatory&&{"&:hover::after":{content:'""',position:"absolute",top:0,left:"50%",transform:"translateX(-50%)",width:"0.2rem",height:`${Z}px`,backgroundColor:f.palette.primary.notifyBorderColor,zIndex:1}}}}):null}),Oe=k.useCallback((ne,re,ue,ye,fe,Ae,Ne)=>y.jsx(y.Fragment,{children:re&&ye&&!re?.isMandatory?y.jsx(Do,{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?.selectedRow&&e?.selectedRow?.fhi===ne?.fhi||ne?.isHigh)&&y.jsx(se,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none"}})},`resize-${ue}_${Ne}`):null}),[e?.selectedRow,f]),we=ne=>{const re=C.current,{left:ue,right:ye}=re.getBoundingClientRect(),fe=50,Ae=ne.clientX>ye-fe?1:ne.clientX<ue+fe?-1:0;Ae!==0?(V.current&&clearInterval(V.current),V.current=setInterval(()=>{re.scrollLeft+=Ae*10},50)):V.current&&(clearInterval(V.current),V.current=null)},Ie=ne=>ne?.map((re,ue)=>{const ye=$.start+ue,fe=re[G],Ae=te?.[fe],Ne=e?.selectedRow&&e?.selectedRow?.fhi===re?.fhi,Ue=re?.isHigh;return y.jsxs(k.Fragment,{children:[y.jsx(r2,{row:re,isSelected:Ne,isHigh:Ue,onRowClick:e?.onRowClick,children:p.map((be,yt)=>be?.isHidden||be?.isVisible===!1?null:be?.children?be.children.map((ct,Ye)=>ct?.isHidden?null:y.jsxs(k.Fragment,{children:[Q(ct,re,Ye,be),x&&Oe(re,ct,Ye,w,be,"",ye)]},`col-${yt}-${Ye}`)):y.jsxs(k.Fragment,{children:[Q(be,re,yt),x&&Oe(re,be,yt,w,"","",ye)]},`col-${yt}`))}),X&&Ae&&y.jsx(o2,{nestedData:Ae,nestedColumn:q,t:d})]},`row-${ye}`)}),Re=()=>{const ne=O.current;if(!ne)return;const re=ne.scrollTop,ue=ne.clientHeight,ye=Math.floor(re/M)-D,fe=Math.ceil(ue/M)+2*D,Ae=Math.max(0,Math.min(A-1,ye)),Ne=Math.max(Ae,Math.min(A,Ae+fe));T(Ue=>Ue.start===Ae&&Ue.end===Ne?Ue:{start:Ae,end:Ne})};k.useEffect(()=>{let ne;const re=()=>{ne&&cancelAnimationFrame(ne),ne=requestAnimationFrame(()=>{Re()})},ue=O.current;if(!(!ue||!u))return Re(),ue.addEventListener("scroll",re),()=>{cancelAnimationFrame(ne),ue.removeEventListener("scroll",re)}},[A]);const Fe=$.start*M,Pe=(A-$.end)*M,pe=u?n?.slice($.start,$.end):n;return v?y.jsxs(y.Fragment,{children:[y.jsx(cu,{ref:O,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:y.jsxs(iu,{ref:C,stickyHeader:!0,"aria-label":"sticky table",sx:{backgroundColor:ne=>ne.palette.primary.notifyBackground},children:[y.jsxs(uu,{children:[y.jsx(Rr,{sx:{position:"sticky",top:0,zIndex:3,backgroundColor:ne=>ne.palette.primary.notifyBackground},children:p.map((ne,re)=>ne?.isHidden||ne?.isVisible===!1?null:y.jsxs(k.Fragment,{children:[oe(ne,re,w),le(ne,re,w)]},re))}),y.jsx(Rr,{draggable:!1,sx:{position:"sticky",top:"2.5rem",backgroundColor:f.palette.primary.notifyBackground,zIndex:2},children:p.flatMap((ne,re)=>ne?.isHidden||!ne?.children||ne?.isVisible===!1?[]:ne.children.map((ue,ye)=>ue?.isHidden?null:y.jsxs(k.Fragment,{children:[oe(ue,ye,w,ne),x&&le(ue,ye,w)]},`${re}-${ye}`)))})]}),y.jsxs(au,{children:[u&&y.jsx("tr",{style:{height:Fe}}),Ie(pe),u&&y.jsx("tr",{style:{height:Pe}})]})]})}),r&&y.jsx(uf,{pagination:r,gridPath:l,baseUrl:a,t:d}),y.jsx(df,{menuOpen:h?.isOpen,handleClose:b,onHideClick:S})]}):y.jsx(Dr,{sx:{textAlign:"center"},children:d(cr.NRF)})}l2.propTypes={sort:s.object,data:s.array,pagination:s.object,columns:s.object,nested:s.object};function c2(e){return rv(e?.style?.width??e?.style?.minWidth??e?.style?.maxWidth)||0}const u2=e=>e?.isHidden||e?.isVisible===!1;function pN(e){const t=k.useMemo(()=>{let o=0;return e.flatMap((i,a)=>{if(u2(i))return[];if(Array.isArray(i.children)&&i.children.length){const u=i.children.filter(d=>!u2(d));return u.length?u.map(d=>{const f=c2(d),p={...d,_parent:i,_originalIndex:a,width:f,start:o,end:o+f,isSticky:!!(d?.isSticky??i?.isSticky)};return o+=f,p}):[]}const l=c2(i);if(l===0)return[];const c={...i,_parent:null,_originalIndex:a,width:l,start:o,end:o+l,isSticky:!!i?.isSticky};return o+=l,c})},[e]),n=k.useMemo(()=>{let o=0;const i={};return t.forEach(a=>{a.isSticky&&(i[a.sequenceId]=o,o+=a.width)}),i},[t]);return{columnsMeta:t,stickyOffsets:n,getStickyLeft:o=>{if(!o?.isMandatory||!o?.isSticky)return;const i=n[o.sequenceId];return i===0?0:`${i}px`}}}function hN({visibleGridColumns:e,columnUpdaterFunction:t,isResizingRef:n,startAutoScroll:r,stopAutoScroll:o}){const i=it(),[a,l]=k.useState(null),[c,u]=k.useState(null),d=k.useCallback((b,S)=>{if(n.current){b.preventDefault();return}l(S),b.dataTransfer.setData("colIndex",S);const E=e[S],w=document.createElement("div");w.textContent=E?.label,Object.assign(w.style,{display:"flex",alignItems:"center",justifyContent:"center",padding:"1.5rem 2.5rem",minWidth:E?.style?.minWidth,maxWidth:E?.style?.maxWidth,fontSize:"1.2rem",fontWeight:"500",color:i.palette.primary.notifyTextColor,background:i.palette.primary.notifyBackground,border:`0.1rem solid ${i.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(w);const{offsetWidth:x,offsetHeight:v}=w;b.dataTransfer.setDragImage(w,x/2,v/2),requestAnimationFrame(()=>document.body.removeChild(w))},[n,e,i]),f=k.useCallback((b,S)=>{if(b.preventDefault(),e?.[S]?.isMandatory){b.dataTransfer.dropEffect="none";return}b.dataTransfer.dropEffect="move",u(S),r(b.clientX)},[r,e]),p=k.useCallback(async(b,S)=>{if(b.preventDefault(),o(),a===null||a===S||e?.[S]?.isMandatory)return;const E=[...e],[w]=E.splice(a,1);E.splice(S,0,w);const x=[...e].sort((C,O)=>C.sequenceId-O.sequenceId).map(C=>C.sequenceId),v=E.map((C,O)=>({...C,sequenceId:x[O]??C.sequenceId}));t({updatedColumns:v}),l(null),u(null)},[a,e,t,o]),m=k.useCallback(()=>{o(),l(null),u(null)},[o]),h=b=>!b?.isMandatory,g=k.useCallback(b=>c===null||a===null?!1:!!(e?.[b]?.isMandatory||e?.[c]?.isMandatory),[c,a,e]);return{draggedColIndex:a,dragOverIndex:c,handleDragStart:d,handleDragOver:f,handleDrop:p,handleDragEnd:m,isDraggable:h,isInvalidDrop:g}}const d2=50,mN=10,gN=50;function yN(e){const t=k.useRef(null),n=k.useCallback(()=>{t.current&&(clearInterval(t.current),t.current=null)},[]);return{startAutoScroll:k.useCallback(o=>{const i=e.current;if(!i)return;const{left:a,right:l}=i.getBoundingClientRect(),c=o>l-d2?1:o<a+d2?-1:0;if(c===0){n();return}t.current||(t.current=setInterval(()=>{i.scrollLeft+=c*mN},gN))},[e,n]),stopAutoScroll:n}}const pf=k.memo(function({column:t,index:n,isManageable:r,parent:o,stickyLeft:i,colSpanOverride:a,draggedColIndex:l,isInvalidDrop:c,onDragStart:u,onDragOver:d,onDrop:f,onDragEnd:p,sort:m,handleMenuClick:h}){const g=it(),b=l===n,S=r&&!t?.isMandatory,E=t?.isMandatory&&t?.isSticky,w=o&&o.children?.find(C=>!C?.isHidden&&C?.isVisible!==!1)?.key===t?.key,x=!o&&Array.isArray(t?.children)&&t.children.some(C=>!C?.isHidden&&C?.isVisible!==!1),v=a??t.children?.filter(C=>!C?.isHidden)?.length;return y.jsx(to,{rowSpan:t?.children?1:2,colSpan:v,style:t?.style,draggable:S,onDragStart:S?C=>u(C,n):C=>C.preventDefault(),onDragOver:S?C=>d(C,n):void 0,onDrop:S?C=>f(C,n):void 0,onDragEnd:S?p:void 0,sx:{...t?.isSticky&&{boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...t.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...(w||x)&&{borderLeft:"0.1rem solid"}},...b&&{border:`0.1rem solid ${g.palette.brandColor.lightBlue}!important`},...E&&{position:"sticky",left:i,zIndex:3},cursor:c(n)?"not-allowed":S?"grab":"default"},children:y.jsx(ff,{parent:o,column:t,sort:m,handleMenuClick:h,isManageable:r})},n)}),hf=k.memo(function({column:t,index:n,isManageable:r,tableHeight:o,onResizeStart:i,onResizeEnd:a}){const l=it();return!t||!r||t?.isMandatory?null:y.jsx(se,{component:t?.children||t?.isMandatory?Do:n2,rowSpan:t?.children?1:2,colSpan:1,id:n,resizeStart:i,resizeEnd:a,sx:{width:"1rem",maxWidth:"1rem",minWidth:"1rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${l.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:l.palette.primary.notifyBorderColor,zIndex:1},"&:hover::after":{content:'""',position:"absolute",top:0,left:"50%",transform:"translateX(-50%)",width:"0.2rem",height:`${o}px`,backgroundColor:l.palette.primary.notifyBorderColor,zIndex:1}}})}),bN=k.memo(function({stickyGridColumns:t,virtualisedColumns:n,isManageable:r,isResizable:o,tableHeight:i,sort:a,handleMenuClick:l,getStickyLeft:c,offsetX:u,draggedColIndex:d,isInvalidDrop:f,onDragStart:p,onDragOver:m,onDrop:h,onDragEnd:g,isResizingRef:b,columnUpdaterFunction:S,visibleGridColumns:E}){const w=it(),x={draggedColIndex:d,isInvalidDrop:f,onDragStart:p,onDragOver:m,onDrop:h,onDragEnd:g},v=(O,M)=>({onResizeStart:()=>{O?.isMandatory&&!O?.isResizable||(b.current=!0)},onResizeEnd:D=>{O?.isMandatory&&!O?.isResizable||D<=20||(b.current=!1,i2({index:M,visibleGridColumns:E,width:D,columnUpdaterFunction:S}))}}),C=k.useMemo(()=>{const O=[];return n.forEach(M=>{const D=M._parent?.key??M.key,A=O[O.length-1];A&&A.key===D?A.colSpan+=1:O.push({key:D,column:M._parent??M,colSpan:1,firstChild:M})}),O},[n]);return y.jsxs(uu,{children:[y.jsxs(Rr,{sx:{position:"sticky",top:0,zIndex:3,backgroundColor:w.palette.primary.notifyBackground},children:[t.map((O,M)=>{const D=O._parent??O;return y.jsxs(k.Fragment,{children:[y.jsx(pf,{column:D,index:O._originalIndex,isManageable:r,stickyLeft:c(O),sort:a,handleMenuClick:l,...x}),o&&y.jsx(hf,{column:D,index:O._originalIndex,isManageable:r,tableHeight:i,...v(D,O._originalIndex)})]},`sticky-p-${M}`)}),y.jsx("th",{style:{minWidth:u,width:u,padding:0,border:"none"}}),C.map((O,M)=>y.jsxs(k.Fragment,{children:[y.jsx(pf,{column:O.column,index:O.firstChild._originalIndex,colSpanOverride:O.colSpan,isManageable:r,stickyLeft:c(O.firstChild),sort:a,handleMenuClick:l,...x}),o&&y.jsx(hf,{column:O.column,index:O.firstChild._originalIndex,isManageable:r,tableHeight:i,...v(O.column,O.firstChild._originalIndex)})]},`parent-${O.key}`))]}),y.jsxs(Rr,{draggable:!1,sx:{position:"sticky",top:"2.5rem",backgroundColor:w.palette.primary.notifyBackground,zIndex:2},children:[y.jsx("th",{style:{minWidth:u,width:u,padding:0,border:"none"}}),n?.map((O,M)=>O._parent&&y.jsxs(k.Fragment,{children:[y.jsx(pf,{column:O,index:O._originalIndex,isManageable:r,parent:O._parent,stickyLeft:c(O),sort:a,handleMenuClick:l,...x}),o&&y.jsx(hf,{column:O,index:O._originalIndex,isManageable:r,tableHeight:i,...v(O,O._originalIndex)})]},`child-${O?._parent?.key??O.key}-${M}`))]})]})}),vN=()=>y.jsx(se,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none",zIndex:1}}),f2=k.memo(function({column:t,row:n,cellKey:r,parent:o,stickyLeft:i,isSelected:a,isHigh:l}){const c=it(),u=t?.isMandatory&&t?.isSticky,d=a||l,f=o&&o.children?.find(p=>!p?.isHidden&&p?.isVisible!==!1)?.key===t?.key;return y.jsxs(to,{colSpan:1,style:t?.style,className:`${t?.label}`,sx:{position:"relative",...t.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...f&&{borderLeft:"0.1rem solid"}},...t?.isSticky&&{boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...u&&{position:"sticky",left:i,zIndex:2,backgroundColor:d?c.palette.primary.appBackground:c.palette.primary.notifyBackground}},children:[d&&y.jsx(vN,{}),y.jsx(Dl,{isRenderCellContent:!!t?.cellRenderer,column:t,row:n,parent:o})]},r)});function xN({actualIndex:e,extraHeight:t,measureRow:n,resetRow:r}){return useEffect(()=>(n(e,t),()=>r(e)),[e,t]),null}const wN=k.memo(function({visibleRows:t,stickyGridColumns:n,virtualisedColumns:r,isResizable:o,isManageable:i,topSpacerHeight:a,bottomSpacerHeight:l,selectedRow:c,isNested:u,nestedRow:d,nestedColumn:f,hashKey:p,getStickyLeft:m,offsetX:h,rightSpacerWidth:g,rowStart:b,defaultRowHeight:S,measureRow:E,resetRow:w,t:x}){const v=it(),C=k.useCallback((O,M,D)=>{if(!O||!i||O?.isMandatory)return null;const A=c&&c?.fhi===M?.fhi||M?.isHigh;return y.jsx(Do,{className:"column_resizer_body",sx:{width:"1rem",maxWidth:"1rem",minWidth:"1rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${v.palette.primary.notifyBorderColor}`},children:A&&y.jsx("div",{style:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none"}})},`resize-${D}`)},[i,c,v]);return y.jsxs(au,{children:[y.jsx("tr",{style:{height:a}}),t?.map((O,M)=>{const D=b+M,A=c&&c?.fhi===O?.fhi,$=O?.isHigh,T=d?.[O[p]];return y.jsxs(k.Fragment,{children:[y.jsxs(r2,{row:O,isSelected:A,isHigh:$,children:[n.map((j,I)=>y.jsxs(k.Fragment,{children:[y.jsx(f2,{column:j,row:O,cellKey:I,parent:j._parent,stickyLeft:m(j),isSelected:A,isHigh:$}),o&&C(j,O,`sticky-${I}-${D}`)]},`sticky-${j.sequenceId??I}`)),y.jsx("td",{style:{minWidth:h,width:h,padding:0,border:"none"}}),r.map((j,I)=>y.jsxs(k.Fragment,{children:[y.jsx(f2,{column:j,row:O,cellKey:I,parent:j._parent,stickyLeft:m(j),isSelected:A,isHigh:$}),o&&C(j,O,`${I}-${D}`)]},`col-${j?._parent?.key??j.key}-${I}`))]}),u&&T&&y.jsxs(y.Fragment,{children:[y.jsx(xN,{actualIndex:D,extraHeight:T.length*S,measureRow:E,resetRow:w}),y.jsx(o2,{nestedData:T,nestedColumn:f,t:x})]})]},`row-${D}`)}),y.jsx("tr",{style:{height:l}})]})});function SN({rowCount:e,defaultRowHeight:t,scrollTop:n,containerRef:r,overscan:o=5}){const i=k.useRef(0),[a,l]=k.useState(()=>rv("40rem"));k.useEffect(()=>{const m=r?.current;if(!m)return;const h=m.clientHeight;h&&h!==i.current&&(i.current=h,l(h));const g=new ResizeObserver(b=>{const S=b[0].contentRect;S.height!==i.current&&(i.current=S.height,l(S.height))});return g.observe(m),()=>g.disconnect()},[]);const[c,u]=k.useState({}),d=(m,h)=>{u(g=>g[m]===h?g:{...g,[m]:h})},f=m=>{u(h=>{if(!(m in h))return h;const g={...h};return delete g[m],g})},p=k.useMemo(()=>{const m=new Array(e+1);m[0]=0;for(let h=0;h<e;h++)m[h+1]=m[h]+(c[h]??t);return m},[c,e,t]);return k.useMemo(()=>{const m=p[e],h=n+a;let g=0,b=e-1,S=0;for(;g<=b;){const w=g+b>>1;p[w+1]>n?(S=w,b=w-1):g=w+1}S=Math.max(0,S-o),g=S,b=e-1;let E=e;for(;g<=b;){const w=g+b>>1;p[w]>=h?(E=w,b=w-1):g=w+1}return E=Math.min(e,E+o),{startIndex:S,endIndex:E,topSpacerHeight:p[S],bottomSpacerHeight:m-p[E],totalHeight:m,measureRow:d,resetRow:f}},[p,e,a,n,o])}function CN({columnWidths:e,scrollLeft:t,overscan:n=2}){const r=k.useRef(0),[o,i]=k.useState(0),a=k.useRef(null),l=k.useCallback(f=>{if(a.current?.disconnect(),!f)return;const p=f.clientWidth;p&&(r.current=p,i(p)),a.current=new ResizeObserver(m=>{const h=m[0].contentRect;h.width!==r.current&&(r.current=h.width,i(h.width))}),a.current.observe(f)},[]),c=k.useMemo(()=>e.map(f=>{const p=Number(f);return Number.isFinite(p)&&p>0?p:0}),[e]),u=k.useMemo(()=>{const f=new Array(c.length+1);f[0]=0;for(let p=0;p<c.length;p++)f[p+1]=f[p]+c[p];return f},[c]);return{...k.useMemo(()=>{const f=t+o,p=u[c.length];let m=0,h=c.length-1,g=c.length;for(;m<=h;){const S=m+h>>1;u[S+1]>t?(g=S,h=S-1):m=S+1}g=Math.max(0,g-n),m=g,h=c.length-1;let b=c.length;for(;m<=h;){const S=m+h>>1;u[S]>=f?(b=S,h=S-1):m=S+1}return b=Math.min(c.length,b+n),{startIndex:g,endIndex:b,offsetX:u[g]||0,rightSpacerWidth:p-u[b],viewportWidth:o}},[c,u,o,t,n]),measuredRef:l}}const p2=45;function TN({rows:e,sort:t,data:n,pagination:r,columns:o,nested:i,baseUrl:a,gridPath:l,childUniqueKey:c,isVirtualizedTable:u=!1,t:d}){const f=it(),{visibleGridColumns:p}=k.useContext(yi),m=k.useContext(Ko),{selectedColumn:h,handleMenuClick:g,handleClose:b,handleHideClick:S,columnUpdaterFunction:E}=s2(p,m,a,l,r?.rowPerPage,c),w=o?.isManageable,x=o?.isResizable,v=k.useRef(null),C=k.useRef(null),O=k.useRef(!1),M=k.useRef(0),D=k.useRef(0),A=k.useRef(!1),[,$]=k.useState({}),{getStickyLeft:T,columnsMeta:j}=pN(p),{startAutoScroll:I,stopAutoScroll:B}=yN(v),{draggedColIndex:L,isInvalidDrop:W,handleDragStart:Y,handleDragOver:U,handleDrop:F,handleDragEnd:R}=hN({visibleGridColumns:p,columnUpdaterFunction:E,isResizingRef:O,startAutoScroll:I,stopAutoScroll:B});console.log({visibleGridColumns:p,columnsMeta:j});const V=ue=>{const ye=ue.currentTarget.scrollTop,fe=ue.currentTarget.scrollLeft;A.current||(A.current=!0,requestAnimationFrame(()=>{M.current=ye,D.current=fe,$({}),A.current=!1}))},q=k.useMemo(()=>j.filter(ue=>ue.isSticky&&!ue.isCenterTable),[j]),X=k.useMemo(()=>j.filter(ue=>ue.isSticky&&ue.isCenterTable||!ue.isSticky),[j]),te=k.useMemo(()=>X.map(ue=>ue.width),[X]),{startIndex:G,endIndex:Z,topSpacerHeight:ie,bottomSpacerHeight:ae,measureRow:_,resetRow:z}=SN({rowCount:n.length,defaultRowHeight:p2,scrollTop:M.current,containerRef:C,overscan:15}),{startIndex:N,endIndex:oe,offsetX:Q,measuredRef:le}=CN({columnWidths:te,scrollLeft:D.current,overscan:2}),Oe=k.useMemo(()=>X.slice(N,oe),[X,N,oe]),[we,Ie]=k.useState(0);k.useEffect(()=>{const ue=v.current;if(!ue)return;const ye=new ResizeObserver(()=>Ie(ue.offsetHeight));return ye.observe(ue),()=>ye.disconnect()},[]);const Re=t2(i?.column?.definitions||[]),Fe=i?.isNested,Pe=i?.data||[],pe=i?.hashKey,ne=n?.slice(G,Z),re=k.useCallback(ue=>{C.current=ue,le(ue)},[le]);return n?.length?y.jsxs(y.Fragment,{children:[y.jsx(cu,{ref:re,onScroll:V,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:y.jsxs(iu,{ref:v,stickyHeader:!0,"aria-label":"sticky table",sx:{backgroundColor:f.palette.primary.notifyBackground},children:[y.jsx(bN,{offsetX:Q,stickyGridColumns:q,virtualisedColumns:Oe,isManageable:w,isResizable:x,tableHeight:we,sort:t,handleMenuClick:g,getStickyLeft:T,draggedColIndex:L,isInvalidDrop:W,onDragStart:Y,onDragOver:U,onDrop:F,onDragEnd:R,isResizingRef:O,columnUpdaterFunction:E}),y.jsx(wN,{offsetX:Q,rowStart:G,defaultRowHeight:p2,measureRow:_,resetRow:z,visibleRows:ne,stickyGridColumns:q,virtualisedColumns:Oe,isResizable:x,isManageable:w,topSpacerHeight:ie,bottomSpacerHeight:ae,selectedRow:e?.selectedRow,isNested:Fe,nestedRow:Pe,nestedColumn:Re,hashKey:pe,getStickyLeft:T,t:d})]})}),r&&y.jsx(uf,{pagination:r,gridPath:l,baseUrl:a,t:d}),y.jsx(df,{menuOpen:h?.isOpen,handleClose:b,onHideClick:S})]}):y.jsx(Dr,{sx:{textAlign:"center"},children:d(cr.NRF)})}function h2({tableProps:e,isDefaultConfig:t,gridPath:n,baseUrl:r,childUniqueKey:o}){const{columns:i}=e,a=k.useContext(Ko),{t:l}=k.useContext(an),c=!!e?.isVirtualizedTable,u=tN({columns:i,gridPath:n,baseUrl:r,isDefaultConfig:t,childUniqueKey:o,pageSize:e?.pagination?.rowPerPage,data:e?.data});return k.useEffect(()=>{u?.length&&e?.data?.length&&a?.({type:je.SET_GRID_DATA,payload:{visibleGridColumns:u}})},[u,e?.data]),y.jsx(y.Fragment,{children:c?y.jsx(TN,{...e,gridPath:n,baseUrl:r,childUniqueKey:o,t:l}):y.jsx(l2,{...e,gridPath:n,baseUrl:r,childUniqueKey:o,t:l})})}h2.propTypes={tableProps:s.object.isRequired,mergedColumns:s.array.isRequired};const m2=({type:e})=>{const r=it()?.mode==="dark"?{bgcolor:"grey.800"}:{};return{grid:y.jsxs(se,{sx:{borderRadius:2,overflow:"hidden"},children:[y.jsx(nr,{variant:"text",width:"100%",height:60,sx:r}),Array.from({length:10}).map((i,a)=>y.jsx(se,{sx:{display:"flex",alignItems:"center",padding:"0.5rem",gap:"3rem"},children:Array.from({length:5}).map((l,c)=>y.jsx(se,{sx:{flex:1},children:y.jsx(nr,{variant:"text",height:45,sx:r})},c))},a))]}),toolbar:y.jsx(y.Fragment,{children:y.jsxs(He,{direction:"row",justifyContent:"space-between",sx:{display:"flex",gap:"1rem"},children:[y.jsxs(He,{direction:"row",gap:"1rem",children:[y.jsx(nr,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),y.jsx(nr,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),y.jsx(nr,{variant:"text",width:"15.2rem",height:"5rem",sx:r})]}),y.jsxs(He,{direction:"row",gap:"1rem",children:[y.jsx(nr,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),y.jsx(nr,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),y.jsx(nr,{variant:"text",width:"3.5rem",height:"5rem",sx:r})]})]})})}[e]},kN=({customTools:e})=>{const t=e?.filter(r=>r?.type===Qv.PRIMARY)?.sort((r,o)=>r.sequenceId-o.sequenceId),n=e?.filter(r=>r?.type===Qv.SECONDARY)?.sort((r,o)=>r.sequenceId-o.sequenceId);return{primaryButtons:t,secondaryButtons:n}},g2=({customTools:e,isExpanded:t,setIsExpanded:n})=>{const{primaryButtons:r,secondaryButtons:o}=kN({customTools:e}),[i,a]=k.useState(r),l=o?.length>0,{t:c}=k.useContext(an),u=f=>{f?a([...r,...o]):setTimeout(()=>{a(r)},100)},d=()=>{const f=!t;n(f),u(f)};return k.useEffect(()=>{u(t)},[e]),y.jsxs(y.Fragment,{children:[t&&y.jsx("div",{style:{position:"fixed",left:0,width:"100vw",height:"4rem",zIndex:998}}),y.jsxs(se,{sx:{display:"flex",alignItems:"center",gap:"0.8rem",flexWrap:"nowrap",maxWidth:"100%",whiteSpace:"nowrap",zIndex:999},children:[y.jsx(fM,{mode:"popLayout",children:i.map((f,p)=>y.jsx(zo.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},layout:!0,children:y.jsx(se,{sx:{flexShrink:0,minWidth:"fit-content"},children:uN(f)})},`${f.id}_${p}`))}),l&&y.jsx(se,{sx:{paddingLeft:t?"0.5rem":0},children:y.jsx(sr,{label:t?"":c("LABEL_MORE_ACTIONS"),styles:{iconPrimary:!0,icon:t?ze.CrossWhite:ze.More,colorType:t?"danger":""},onClick:d})})]})]})};g2.propTypes={customTools:s.array.isRequired};const y2=({defaultTools:e,isManageable:t,customTools:n,baseUrl:r,gridPath:o,pageSize:i,gridData:a,childUniqueKey:l})=>{const{t:c}=k.useContext(an),u=k.useContext(Ko),{visibleGridColumns:d,triggerApi:f}=k.useContext(yi),[p,m]=k.useState([]),[h,g]=k.useState(!1),b=n?.filter(v=>v.position==="left").sort((v,C)=>v.sequenceId-C.sequenceId)||[],S=n?.filter(v=>v.position==="right").sort((v,C)=>v.sequenceId-C.sequenceId)||[];k.useEffect(()=>{if(d.length){const v={id:99999,sequenceId:99999,isLocalizable:!1,key:"horizons",label:c("Horizons"),isSortable:!1,isHidden:!0,showChildCheckbox:!0,showCheckbox:!1,isMandatory:!0,showInHierarchy:!0,showHide:!0,children:[]};let C=d.map(M=>(M?.children&&M.children.forEach(D=>{v.children.some($=>$.key===D.key)||v.children.push({...D,showInHierarchy:!0})}),M)).filter(M=>M?.id!==v?.id);const O=v.children.length>0?[...C,v]:C;m(O)}},[d]);const E=async v=>{try{await fN({baseUrl:r,gridPath:o,childUniqueKey:l,gridSetting:{grid:v,pageSize:i}})}catch(C){console.error(C)}finally{u({type:je.HAS_SETTING_CHANGE,payload:{hasChange:!1}}),u({type:je.TRIGGER_API,payload:{triggerApi:!1}})}};k.useEffect(()=>{f&&E(d)},[f]);const w=v=>{const C=v?.map(D=>D.id),O=v?.flatMap(D=>D.children||[])?.map(D=>D.id),M=p?.map(D=>{const A=C?.includes(D.id);if(Array.isArray(D.children)&&D.children.length>0){const T=D?.children?.map(I=>{const B=O?.includes?.(I.id);return{...I,isHidden:!B}}),j=T?.filter(I=>p?.some(B=>B.children?.some(L=>L.id===I.id)))?.every(I=>I.isHidden);return{...D,...!D.children[0]?.showInHierarchy&&{isHidden:j||!A},children:T}}return{...D,isHidden:!A}});u({type:je.SET_GRID_DATA,payload:{visibleGridColumns:M}}),u({type:je.HAS_SETTING_CHANGE,payload:{hasChange:!0}})},x=()=>p.map(C=>{const O=Array.isArray(C.children)?C.children.filter(M=>!M.isHidden):void 0;return!C.isHidden||C.isHidden&&C.showInHierarchy?{...C,children:O}:null}).filter(Boolean);return y.jsxs(se,{sx:{margin:"1rem 0",position:"relative",zIndex:10,display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"0.6rem",width:"100%"},children:[y.jsxs(se,{sx:{display:"flex",flexDirection:"row",gap:"0.6rem",alignItems:"center"},children:[e?.search?.isRequired&&y.jsx(lv,{...e?.search,iconUrl:ze.Search}),e?.refresh?.isRequired&&y.jsx(sr,{...e?.refresh,styles:{variant:"filled",icon:ze.Refresh,colorType:"empty",width:"3.2rem",height:"3.2rem"}}),e?.groupBy?.isRequired&&y.jsx(se,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:y.jsx(Xo,{styles:{icon:ze.Group},...e.groupBy})}),t&&y.jsx(se,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:y.jsx(Xo,{placeholder:c("LABEL_MANAGE_COLUMN"),options:p,value:x(),isMulti:!0,isDraggable:!0,showSearch:!0,isManageColumn:!0,onChange:w,disabled:!a.length,styles:{icon:ze.Manage}})}),b?.length>0&&b.map((v,C)=>y.jsx(k.Fragment,{children:v.render()},v.id))]}),y.jsxs(se,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"0.6rem"},children:[S?.length>0&&S.map((v,C)=>y.jsx(k.Fragment,{children:v.render()},v.id)),n&&y.jsx(g2,{customTools:n,setIsExpanded:g,isExpanded:h}),e?.save?.isRequired&&y.jsx(se,{sx:{px:"0.5rem"},children:y.jsx(sr,{label:h?"":"Save",styles:{icon:ze.Save,colorType:"empty"},...e?.save})}),e?.upload?.isRequired&&y.jsx(sr,{...e?.upload,styles:{variant:h?"outlined":"filled",icon:h?ze.UploadDark:ze.Upload,iconPrimary:!h,colorType:"secondary",isAnimate:!0}}),e?.download?.isRequired&&y.jsx(sr,{...e?.download,styles:{variant:"outlined",icon:ze.Download,isAnimate:!0}})]})]})};y2.propTypes={defaultTools:s.object.isRequired,customTools:s.array,isManageable:s.bool,baseUrl:s.string,gridPath:s.gridPath};function mf({tableProps:e,toolbarProps:t,isDefaultConfig:n,isLoading:r}){const o=e.columns?.isManageable;return y.jsx(ov,{children:r?y.jsxs(y.Fragment,{children:[t&&y.jsx(m2,{type:"toolbar"}),e&&y.jsx(m2,{type:"grid"})]}):y.jsxs(se,{sx:{position:"sticky"},children:[t&&y.jsx(y2,{...t,isManageable:o,pageSize:e?.pagination?.rowPerPage,gridData:e?.data}),y.jsx(h2,{tableProps:e,isDefaultConfig:n,gridPath:t?.gridPath||"",baseUrl:t?.baseUrl||"",childUniqueKey:t?.childUniqueKey||""})]})})}mf.propTypes={tableProps:s.object.isRequired,toolbarProps:s.object,isDefaultConfig:s.bool};const b2=({list:e,handleLinkClick:t})=>{const n=it(),{t:r}=k.useContext(an),o=({list:i})=>i?.sort((a,l)=>a.order-l.order)?.map((a,l)=>a?.link?y.jsx(Hr,{component:"h3",sx:{fontSize:"1rem",cursor:"pointer",color:l===i?.length-1?n.palette.brandColor.orange:n.palette.primary.notifyTextColor},href:a?.link,underline:"hover",onClick:()=>t(a),children:r(a?.title)},l):y.jsx(lt,{component:"h3",sx:{fontSize:"1rem",color:l===i?.length-1?n.palette.brandColor.orange:n.palette.primary.notifyTextColor},children:r(a?.title)},l));return y.jsx(pm,{separator:y.jsx(Gt,{url:ze.ArrowRight}),children:o({list:e})})};b2.propTypes={list:s.array.isRequired,handleLinkClick:s.func};const v2=({breadcrumbProps:e,switchProps:t,filterComponentProps:n,metaDataProps:r})=>{const o=it(),{t:i}=k.useContext(an),a=n?.filterBtnProps?.disabled;return y.jsxs(y.Fragment,{children:[y.jsxs(He,{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:[y.jsx(b2,{...e}),y.jsxs(He,{direction:"row",gap:"1rem",alignItems:"center",children:[r,t&&y.jsx(dv,{...t}),n?.filterBtnProps&&y.jsxs(He,{direction:"row",children:[y.jsx(Mo,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"2rem!important",opacity:"1!important",borderColor:o.palette.primary.notifyBorderColor}}),y.jsxs(He,{direction:"row",alignItems:"center",gap:"0.5rem",onClick:n?.filterBtnProps?.onFilterClick,sx:{opacity:a?.5:1,cursor:a?"not-allowed":"pointer"},children:[y.jsx(Gt,{url:ze.Filter}),y.jsx(lt,{sx:{fontSize:"1.1rem",color:o.palette.primary.notifyActiveText},children:i(n?.filterBtnProps?.label)})]})]})]})]}),y.jsx(zo.div,{layout:!0,initial:{height:"0rem"},animate:{height:n?.filterBtnProps?.filterContainerVisible?"5rem":"0rem",opacity:n?.filterBtnProps?.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:n?.filterContainerProps?.isSideDrawerOpen?"75%":"100%"},children:y.jsxs(He,{sx:{background:o.palette.primary.appBackground,height:"3.8rem",p:"0 2rem",width:"100%",borderRadius:"0.7rem",overflow:"visible"},direction:"row",alignItems:"center",children:[y.jsxs(lt,{sx:{fontSize:"1.2rem",fontWeight:"500",color:o.palette.primary.notifyActiveText},children:[n?.labels?.description||i("Filters")," :"]}),y.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:y.jsx(He,{direction:"row",gap:"1.2rem",sx:{overflow:"visible"},children:n?.filterItems?.map((l,c)=>y.jsx(y.Fragment,{children:y.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:[y.jsx(se,{component:"img",src:ze.FilterClose,sx:{position:"absolute",top:"-0.4rem",right:"-0.6rem",cursor:"pointer"},onClick:()=>n?.onFilterChipClose(l)}),y.jsx(lt,{sx:{fontSize:"1rem",color:o.palette.primary.notifyTextColor},children:l?.filterLabel})]},c)}))})}),y.jsx(se,{component:lt,sx:{fontSize:"1.1rem",fontWeight:"500",textDecoration:"underline",color:o.palette.brandColor.red,cursor:"pointer"},onClick:n?.filterContainerProps?.onClearClick,children:n?.labels?.button||i("Clear")})]})})]})};v2.propTypes={breadcrumbProps:s.object.isRequired,switchProps:s.object};function x2({headerProps:e}){return y.jsx(rn,{children:y.jsx(v2,{...e})})}x2.propTypes={headerProps:s.object.isRequired};const gf=k.createContext(null),w2=k.createContext(null);function S2({children:e}){const[t,n]=k.useReducer(EN,ON);return y.jsx(gf.Provider,{value:t,children:y.jsx(w2.Provider,{value:n,children:e})})}function EN(e,t){switch(t.type){case je.LOADING:return{...e,loading:t.loading};case je.SUCCESS:return{...e,data:t.data?.sort((n,r)=>new Date(r.createdAt)-new Date(n.createdAt))};case je.MARK_ALL_AS_READ:return{...e,isMarkAllAsRead:t.isMarkAllAsRead};case je.SET_ACTIVE_TAB:return{...e,activeTab:t.activeTab};case je.SET_MODE:return{...e,mode:t.mode};case je.ERROR:return{...e,error:t.error};default:throw new Error(`${cr.UNHANDLED}: ${t}`)}}const ON={loading:!1,data:[],error:"",isMarkAllAsRead:{count:0,boo:!1},mode:!1,activeTab:0},{TENANT_ID:yf,BU_ID:bf}=Jv,{TENANT_IDS:vf,BU_IDS:xf}=e2,PN=async e=>{try{const t=localStorage.getItem("i18nextLng"),n=`${e}${Ol.NOTIFICATION}/v1?${yf}=${vf}&${bf}=${xf}&lang=${t}`;return await ft.get(n,Ti)}catch(t){return t}},C2=async(e,t,n)=>{try{const r=localStorage.getItem("i18nextLng"),o=`${e}${Ol.NOTIFICATION}${sf.VERSION}?${yf}=${vf}&${bf}=${xf}&lang=${r}`;return await ft.put(o,t,Ti)}catch(r){return r}},MN=async({baseUrl:e,id:t,snopId:n})=>{try{const r=localStorage.getItem("i18nextLng"),o=`${e}${Ol.NOTIFICATION}${sf.VERSION}?${yf}=${vf}&${bf}=${xf}&id=${t}&lang=${r}`;return await ft.get(o,Ti)}catch(r){return r}},es={OK:200,CREATED:201,NO_CONTENT:204,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,INTERNAL_SERVER_ERROR:500},T2=({baseUrl:e})=>{const t=k.useContext(w2),[n,r]=k.useState(!1),[o,i]=k.useState(!1),[a,l]=k.useState(!1),[c,u]=k.useState({}),[d,f]=k.useState(null),[p,m]=k.useState(1),h=k.useRef(!1),{loading:g,data:b,isMarkAllAsRead:S,mode:E,activeTab:w}=k.useContext(gf),[x,v]=k.useState([]);k.useEffect(()=>{v(b)},[b]);const C=k.useCallback(async()=>{if(!(h.current||!e))try{t({type:je.LOADING,loading:!0}),t({type:je.SUCCESS,data:[]});const j=await PN(e);if(j.status===es.UNAUTHORIZED){h.current=!0;return}if(j.status===es.OK){const I=j.data?.responseData?.response||[],B=gl(I);t({type:je.SET_MODE,mode:!1}),t({type:je.SUCCESS,data:gl(B)}),t({type:je.MARK_ALL_AS_READ,isMarkAllAsRead:{count:nv(I),boo:nv(I)>0}}),t({type:je.LOADING,loading:!1})}}catch(j){j?.response?.status===es.UNAUTHORIZED&&(h.current=!0),t({type:je.ERROR,error:cr.SWR}),t({type:je.LOADING,loading:!1})}},[e,t]),O=j=>{const I=(b||[]).filter(B=>E?!B.isRead:!0);return{0:I,1:I.filter(B=>B?.type==="INFO"),2:I.filter(B=>B?.type==="ERROR")}};k.useEffect(()=>{C();const j=setInterval(C,3e5);return()=>clearInterval(j)},[C]);const M=async(j,I)=>{if(!(!j||!e)){f(j);try{const B=await MN({baseUrl:e,id:j,snopId:I});if(B.status===es.OK){const L=B.data?.responseData?.response||{};u(L||{}),l(!0)}else throw new Error}catch{t({type:je.ERROR,error:cr.SWR})}finally{f(null)}}},D=async(j,I)=>{if(!(!j.length||!e)){t({type:je.LOADING,loading:!0});try{if((await C2(e,j,I)).status===es.OK){const L=b.map(Y=>j.includes(Y.id)?{...Y,isRead:!0}:Y),W=L.filter(Y=>!Y.isRead).length;W===0&&t({type:je.SET_MODE,mode:!1}),t({type:je.SUCCESS,data:gl(L)}),t({type:je.MARK_ALL_AS_READ,isMarkAllAsRead:{count:W,boo:W>0}}),setTimeout(()=>{t({type:je.LOADING,loading:!1})},200)}}catch{t({type:je.ERROR,error:cr.SWR}),t({type:je.LOADING,loading:!1})}}},A=async()=>{if(e){t({type:je.LOADING,loading:!0});try{const j=VI(b);if((await C2(e,j,H4.MARK_ALL_READ)).status===es.OK){const B=b.map(L=>({...L,isRead:!0}));t({type:je.SET_MODE,mode:!1}),t({type:je.SUCCESS,data:gl(B)}),t({type:je.MARK_ALL_AS_READ,isMarkAllAsRead:{count:0,boo:!1}}),setTimeout(()=>{t({type:je.LOADING,loading:!1})},200)}}catch{t({type:je.ERROR,error:cr.SWR}),t({type:je.LOADING,loading:!1})}}},$=(j,I)=>{t({type:je.LOADING,loading:!0}),t({type:je.SET_ACTIVE_TAB,activeTab:I}),setTimeout(()=>{t({type:je.LOADING,loading:!1})},400)},T=()=>{t({type:je.LOADING,loading:!0});const j=E?b||[]:(x||[]).filter(I=>!I.isRead);t({type:je.SET_MODE,mode:!E}),v(j),m(1),setTimeout(()=>{t({type:je.LOADING,loading:!1})},400)};return{fetchNotification:C,showDetailsProps:{open:a,handleClose:()=>l(!1),setOpen:l,data:c,clickId:d},alertDialogProps:{open:n,handleClose:()=>r(!1),onRefresh:C,handleRead:D,handleMarkAllAsRead:A,setOpen:r,handleShowDetails:M,clickId:d,isMainDialog:!0},activeTab:w,loading:g,tabData:O()[w],data:x,mode:E,handleTabChange:$,toggleAlertMode:T,page:p,setPage:m,isMarkAllAsRead:S}};var k2,E2,O2;function wf(){return wf=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},wf.apply(null,arguments)}var DN=function(t){return P.createElement("svg",wf({xmlns:"http://www.w3.org/2000/svg",width:16,height:17,fill:"none"},t),k2||(k2=P.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"})),E2||(E2=P.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"})),O2||(O2=P.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 RN=({count:e})=>(it(),y.jsxs(y.Fragment,{children:[y.jsx(se,{sx:{gap:"0.5rem",display:"flex",justifyContent:"center",alignItems:"center","& svg":{transform:"scale(1)"}},children:y.jsx(DN,{style:{scale:1.2}})}),y.jsx(iN,{badgeContent:e!=0?"":null,color:"error"})]}));function P2({children:e,handleClose:t,open:n,isMainDialog:r}){return y.jsx(Gc,{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 M2;function Sf(){return Sf=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},Sf.apply(null,arguments)}var AN=function(t){return P.createElement("svg",Sf({xmlns:"http://www.w3.org/2000/svg",width:14,height:9,fill:"none",viewBox:"0 0 13 9"},t),M2||(M2=P.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"})))},D2,R2;function Cf(){return Cf=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},Cf.apply(null,arguments)}var jN=function(t){return P.createElement("svg",Cf({xmlns:"http://www.w3.org/2000/svg",width:12,height:12,fill:"none"},t),D2||(D2=P.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"})),R2||(R2=P.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"})))},A2;function Tf(){return Tf=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},Tf.apply(null,arguments)}var IN=function(t){return P.createElement("svg",Tf({xmlns:"http://www.w3.org/2000/svg",width:9,height:8,fill:"none"},t),A2||(A2=P.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 j2=({type:e,item:t,handleShowDetails:n,handleRead:r,handleCTAClicked:o,clickId:i,t:a})=>{const l=it(),c=JSON.parse(localStorage.getItem("settings"))?.platform?.theme;return y.jsxs(se,{className:"cards",sx:{pt:" 0.8rem"},children:[y.jsx(He,{display:"flex",flexDirection:"row",alignItems:"start",justifyContent:"space-between",gap:1,children:y.jsx(Vc,{sx:{width:"calc(100% - 2%)","& .MuiBadge-badge":{backgroundColor:"#6041EA",height:"0.5rem",minWidth:"0.5rem"}},variant:"dot",invisible:t?.isRead,children:y.jsx(Dr,{sx:{color:l.palette.primary.notifyActiveText,whiteSpace:"normal",wordBreak:"break-word"},component:"p",className:["title-card",t?.isRead&&"read"].join(" "),children:a(t?.message)})})}),y.jsx(He,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:y.jsxs(He,{display:"flex",flexDirection:"row",justifyContent:"start",gap:1,sx:{p:"0.5rem 0"},children:[t?.isNotificationDetails&&y.jsx(Rl,{icon:y.jsx(jN,{className:`${c==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:n,label:i===t?.id?y.jsx(vo,{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?.isRead&&y.jsx(Rl,{icon:y.jsx(IN,{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?.primaryCTAURL&&y.jsx(Rl,{disabled:t?.isPrimaryCTAClicked,onClick:()=>o({redirect:t?.isPrimaryCTARedirect,isClicked:t?.isPrimaryCTAClicked,url:t?.primaryCTAURL}),label:a(t?.primaryCTALabel),component:"button",variant:"outlined",clickable:!0,size:"small"}),t?.secondaryCTAURL&&y.jsx(Rl,{disabled:t?.isSecondaryCTAClicked,onClick:()=>o({redirect:t?.isSecondaryCTARedirect,isClicked:t?.isSecondaryCTAClicked,url:t?.secondaryCTAURL}),label:a(t?.secondaryCTALabel),component:"button",variant:"outlined",clickable:!0,size:"small"})]})}),y.jsxs(He,{display:"flex",flexDirection:"row",alignItems:"center",gap:.35,children:[y.jsx(Dr,{sx:{fontSize:"0.8rem"},children:a(t?.product)}),y.jsx(Dr,{color:l.palette.primary.notifyTextColor,children:"•"}),y.jsx(Dr,{sx:{fontSize:"0.8rem"},children:WI(t?.createdAt,a)})]})]})};j2.propTypes={type:s.string,title:s.string,subTitle:s.string,isRead:s.bool,handleShowDetails:s.func,handleRead:s.func};const Al=60,I2=2,N2=({data:e,handleRead:t,handleShowDetails:n,clickId:r,mode:o,t:i})=>{const{isMarkAllAsRead:a}=k.useContext(gf),l=k.useRef(null),[c,u]=k.useState({start:0,end:4}),d=e?.length,f=new Date,p=new Intl.DateTimeFormat("en-US",{day:"numeric",month:"long",year:"numeric"}).format(f),m=k.useMemo(()=>o?a?.count?e?.filter(x=>!x.isRead):[]:e||[],[e,o,a]),h=m.slice(c.start,c.end),g=c.start*Al,b=(d-c.end)*Al,S=()=>{const x=l.current;if(!x)return;const v=x.scrollTop,C=x.clientHeight,O=Math.floor(v/Al)-I2,M=Math.ceil(C/Al)+2*I2,D=Math.max(0,Math.min(d-1,O)),A=Math.max(D,Math.min(d,D+M));u($=>$.start===D&&$.end===A?$:{start:D,end:A})},E=({url:x})=>{window.open(x,"_blank")},w=k.useMemo(()=>UI(h),[h]);return k.useEffect(()=>{let x;const v=()=>{x&&cancelAnimationFrame(x),x=requestAnimationFrame(()=>{S()})},C=l.current;if(C)return S(),C.addEventListener("scroll",v),()=>{cancelAnimationFrame(x),C.removeEventListener("scroll",v)}},[d]),m.length||i("CONTAINER_MESSAGE"),y.jsxs(se,{ref:l,sx:{height:"100%",overflowY:"auto"},children:[y.jsx(se,{style:{height:g}}),Object.entries(w).map(([x,v])=>{const C=localStorage.getItem("i18nextLng"),O=new Date(x),M=new Intl.DateTimeFormat(C,{month:"long"}).format(O),D=O.getDate(),A=O.getFullYear(),$=`${M} ${D}, ${A}`;return y.jsxs(k.Fragment,{children:[x!==p&&y.jsx(sN,{children:$}),v.map((T,j)=>y.jsx(j2,{item:T,handleCTAClicked:E,handleShowDetails:()=>n(T.id,T.snopId),handleRead:()=>t([T.id],T.snopId),clickId:r,t:i},`${T.id}_${j}`))]},x)}),y.jsx(se,{style:{height:b}})]})};N2.propTypes={data:s.array,handleRead:s.func,handleShowDetails:s.func};const NN=({onRefresh:e,handleShowDetails:t,clickId:n,handleRead:r,handleMarkAllAsRead:o,t:i})=>{const{loading:a,activeTab:l,data:c,tabData:u,mode:d,page:f,setPage:p,handleTabChange:m,toggleAlertMode:h}=T2({});return y.jsxs(y.Fragment,{children:[y.jsxs(se,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,pt:2},children:[y.jsx(lt,{variant:"h2",sx:{fontSize:"1.2rem",color:g=>g.palette.primary.notifyTextColor},children:i("NOTIFICATION")}),y.jsx(se,{onClick:e,children:y.jsx(Gt,{url:ze.Refresh,alt:"refresh",sx:{cursor:"pointer"}})})]}),y.jsx(se,{sx:{borderBottom:1,m:"1.2rem 1.2rem 0 1.2rem",borderColor:g=>g.palette.primary.notifyBorderColor},children:y.jsxs(aN,{value:l,onChange:m,children:[y.jsx(cf,{label:y.jsx(se,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:y.jsx(lt,{component:"span",sx:{fontWeight:500,fontSize:"1rem"},children:i("ALL",{count:c?.filter(g=>!g?.isRead)?.length||0})})})}),y.jsx(cf,{label:y.jsx(se,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:y.jsx(lt,{component:"span",sx:{fontWeight:500,fontSize:"1rem"},children:i("INFO",{count:c?.filter(g=>g?.type==="INFO"&&!g?.isRead)?.length||0})})}),sx:{color:g=>g.palette.brandColor.blue}}),y.jsx(cf,{label:y.jsx(se,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:i("ERROR",{count:c?.filter(g=>g?.type==="ERROR"&&!g?.isRead)?.length||0})}),sx:{color:g=>g.palette.brandColor.red}})]})}),y.jsx(Xc,{dividers:!0,sx:{p:0,...a&&!u.length&&{alignItems:"center",justifyContent:"center"},flexGrow:1,overflowY:"auto",mx:"1.2rem",borderColor:g=>g.palette.primary.notifyBorderColor},tabIndex:-1,children:a&&!u.length?y.jsx(se,{sx:{height:300,display:"flex",justifyContent:"center",alignItems:"center"},children:y.jsx(vo,{size:30,sx:{color:g=>g.palette.primary.notifyIconColor}})}):y.jsx(y.Fragment,{children:y.jsx(N2,{data:u,handleShowDetails:t,handleRead:r,clickId:n,page:f,setPage:p,mode:d,t:i})})}),y.jsxs(Kc,{sx:{justifyContent:"space-between",px:"1.2rem"},children:[y.jsxs(He,{direction:"row",gap:1,children:[y.jsx(Dr,{sx:{fontSize:"1rem"},children:i("SHOW_UNREAD")}),y.jsx(oN,{disabled:a,checked:d,onChange:h})]}),y.jsx(Na,{variant:"outlined",className:"view-all",onClick:o,startIcon:y.jsx(AN,{}),disabled:!c?.filter(g=>!g?.isRead)?.length,style:{backgroundColor:"transparent"},sx:{fontSize:"1rem",fontWeight:"300",p:0,border:"none",textTransform:"none",color:g=>g.palette.primary.notifyTextColor,"&:hover":{color:g=>g.palette.primary.notifyActiveText,background:"transparent",boxShadow:"none",border:"none"},"&.Mui-disabled":{opacity:.5,color:g=>`${g.palette.primary.notifyActiveText}!important`,background:"transparent",boxShadow:"none",border:"none"}},children:i("READ_ALL")})]})]})},$N=({data:e,handleClose:t,t:n})=>{const[r,o]=k.useState(1),[i,a]=k.useState(10),[l,c]=k.useState(e?.notificationDetails?.length||0),[u,d]=k.useState("sku_name"),[f,p]=k.useState("asc"),[m,h]=k.useState([]),[g,b]=k.useState("");return k.useEffect(()=>{if((g||u)&&e?.notificationDetails?.length){const S=zI(e?.notificationDetails,V4,g);if(u){const E=HI(S,u,f);h(Ud(E,r,i)),c(E?.length||0);return}h(Ud(S,r,i)),c(S?.length||0);return}h(Ud(e?.notificationDetails,r,i)),c(e?.notificationDetails?.length)},[g,e,r,i,f,u]),y.jsxs(y.Fragment,{children:[y.jsxs(He,{direction:"row",justifyContent:"space-between",sx:{padding:"1.5rem 2rem",borderBottom:"0.1rem solid",borderColor:S=>S.palette.primary.notifyBorderColor},children:[y.jsx(lt,{component:"h2",sx:{fontSize:"1.4rem",color:S=>S.palette.primary.notifyActiveText},children:n(e?.message)||e?.message}),y.jsx(se,{onClick:t,sx:{cursor:"pointer"},children:y.jsx(Gt,{url:ze.CloseCircle})})]}),y.jsx(Xc,{children:y.jsx(mf,{t:n,tableProps:{data:m,columns:{...rN({t:n}),isManageable:!1},sort:{sortField:u,sortDir:f,onSort:S=>{const E=S?.column?.key;p(w=>u===E&&w==="asc"?"desc":"asc"),d(E)}},pagination:{selectedPage:r,rowPerPage:i,totalRecords:l,onPageChange:S=>{o(S)},onPageSizeChange:S=>{a(S?.value),o(1)}}},toolbarProps:{defaultTools:{search:{isRequired:!0,onChange:S=>{const E=S.target.value;E&&o(1),b(E)},placeholder:`${n("SEARCH")}...`}}}})}),y.jsx(Kc,{sx:{padding:"1.5rem 2rem"}})]})},BN=({baseUrl:e,t})=>{const{alertDialogProps:n,showDetailsProps:r,fetchNotification:o,isMarkAllAsRead:i}=T2({baseUrl:e});return y.jsxs(y.Fragment,{children:[y.jsx(se,{sx:{display:"flex",justifyContent:"center",cursor:"pointer",marginTop:"0.6rem"},onClick:()=>{o(),n?.setOpen?.(!0)},children:y.jsx(RN,{count:i.count})}),y.jsx(P2,{...n,children:y.jsx(NN,{...n,t})}),y.jsx(P2,{...r,children:y.jsx($N,{...r,t})})]})},LN=({baseUrl:e,t})=>y.jsx(rn,{children:y.jsx(S2,{children:y.jsx(BN,{baseUrl:e,t})})}),_N=({rightChild:e,leftChild:t,isDrawerMerged:n,isDrawerOpen:r,drawerTitle:o,showExpand:i,onCloseClick:a,onMergeClick:l,onExpandClick:c,isDrawerExpanded:u,styles:d,showMerge:f,isCloseVisible:p=!0})=>{const m=it();return y.jsx(se,{sx:{position:"relative",overflow:"hidden"},children:y.jsxs(Vs,{container:!0,sx:{height:"100%"},children:[y.jsx(Vs,{item:!0,sx:{width:n?d?.drawerWidth?`calc(${"100%"-d?.drawerWidth})`:"75%":"100%",position:"relative",zIndex:3,height:"calc(100vh - 7rem)",p:"0rem 1.5rem",overflow:"auto"},children:t}),r&&!n&&y.jsx(y.Fragment,{children:y.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&&y.jsxs(Vs,{item:!0,sx:{width:u?"90%":d?.drawerWidth||"25%",position:n?"relative":"absolute",top:0,right:0,height:"calc(100vh - 7rem)",backgroundColor:m.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 ${m.palette.primary.notifyBorderColor}`,display:"flex",flexDirection:"column"},children:[y.jsxs(He,{direction:"row",alignItems:"center",sx:{width:"100%",flexShrink:0,paddingBottom:"0.8rem",px:2,pt:"0.8rem",borderBottom:h=>`0.1rem solid ${h.palette.primary.notifyBorderColor}`},children:[!u&&f&&y.jsxs(y.Fragment,{children:[y.jsx(se,{component:"img",src:ze.Merge,sx:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer"},onClick:l}),y.jsx(Mo,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"auto!important",borderColor:m.palette.primary.notifyBorderColor}})]}),y.jsxs(He,{direction:"row",justifyContent:"space-between",alignItems:"center",flexGrow:1,children:[y.jsxs(He,{direction:"row",gap:"0.5rem",alignItems:"center",sx:{cursor:"pointer"},children:[p&&y.jsx(se,{onClick:a,children:y.jsx(Gt,{url:ze.CrossLight})}),y.jsx(lt,{sx:{fontSize:"1.2rem",color:m.palette.primary.notifyTextColor},children:o})]}),y.jsx(He,{direction:"row",gap:"0.5rem",alignItems:"center",children:i&&y.jsx(se,{onClick:c,sx:{cursor:"pointer"},children:y.jsx(se,{component:"img",src:u?ze.Collapse:ze.Expand})})})]})]}),y.jsx(se,{sx:{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},overflow:"auto",px:2},children:e})]})]})})},$2=({layoutChildren:e,layoutProps:t})=>y.jsx(rn,{children:y.jsx(_N,{...e,...t})});$2.propTypes={layoutChildren:s.object.isRequired,layoutProps:s.object.isRequired};const B2=({parentProps:e,childProps:t})=>{const n=it();return y.jsxs(He,{sx:{background:n.palette.primary.notifyBackground,border:`0.1rem solid ${n.palette.primary.notifyBorderColor}`,borderRadius:"1rem",position:"relative",overflow:"hidden"},children:[y.jsx(He,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{maxHeight:"10rem",p:"1.5rem",cursor:"pointer",zIndex:4},onClick:t.toggleExpand,children:e.content}),y.jsx(zo.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:y.jsx(se,{sx:{p:"1rem"},children:t.content})})]})};B2.propTypes={parentProps:s.object.isRequired,childProps:s.object.isRequired};const L2=({accordionProps:e})=>y.jsx(rn,{children:y.jsx(S2,{children:y.jsx(B2,{...e})})});L2.propTypes={accordionProps:s.object.isRequired};const _2=k.createContext(null),FN=_2.Provider,WN=()=>{const e=k.useContext(_2);return e||console.warn("useAnalytics used outside AnalyticsProvider"),e};ut.Accordion=L2,ut.AnalyticsProvider=FN,ut.Button=sr,ut.Checkbox=dl,ut.DatePicker=e9,ut.Grid=mf,ut.Header=x2,ut.InputField=lv,ut.Loader=p9,ut.Notification=LN,ut.Select=cv,ut.SliderLayout=$2,ut.Switch=dv,ut.TextField=hl,ut.ToastProvider=l9,ut.TranslationContext=an,ut.toast=o9,ut.useAnalytics=WN,Object.defineProperty(ut,Symbol.toStringTag,{value:"Module"})}));
256
+ `+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Qr(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&El.assertOptions(r,{silentJSONParsing:Kn.transitional(Kn.boolean),forcedJSONParsing:Kn.transitional(Kn.boolean),clarifyTimeoutError:Kn.transitional(Kn.boolean)},!1),o!=null&&(H.isFunction(o)?n.paramsSerializer={serialize:o}:El.assertOptions(o,{encode:Kn.function,serialize:Kn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),El.assertOptions(n,{baseUrl:Kn.spelling("baseURL"),withXsrfToken:Kn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&H.merge(i.common,i[n.method]);i&&H.forEach(["delete","get","head","post","put","patch","common"],h=>{delete i[h]}),n.headers=Xt.concat(a,i);const l=[];let c=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(n)===!1||(c=c&&g.synchronous,l.unshift(g.fulfilled,g.rejected))});const u=[];this.interceptors.response.forEach(function(g){u.push(g.fulfilled,g.rejected)});let d,f=0,p;if(!c){const h=[qv.bind(this),void 0];for(h.unshift(...l),h.push(...u),p=h.length,d=Promise.resolve(n);f<p;)d=d.then(h[f++],h[f++]);return d}p=l.length;let m=n;for(;f<p;){const h=l[f++],g=l[f++];try{m=h(m)}catch(b){g.call(this,b);break}}try{d=qv.call(this,m)}catch(h){return Promise.reject(h)}for(f=0,p=u.length;f<p;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=Qr(this.defaults,t);const n=$v(t.baseURL,t.url,t.allowAbsoluteUrls);return Ov(n,t.params,t.paramsSerializer)}};H.forEach(["delete","get","head","options"],function(t){eo.prototype[t]=function(n,r){return this.request(Qr(r||{},{method:t,url:n,data:(r||{}).data}))}}),H.forEach(["post","put","patch"],function(t){function n(r){return function(i,a,l){return this.request(Qr(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}eo.prototype[t]=n(),eo.prototype[t+"Form"]=n(!0)});let _4=class W2{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 Qo(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 W2(function(o){t=o}),cancel:t}}};function F4(e){return function(n){return e.apply(null,n)}}function W4(e){return H.isObject(e)&&e.isAxiosError===!0}const of={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(of).forEach(([e,t])=>{of[t]=e});function Xv(e){const t=new eo(e),n=fv(eo.prototype.request,t);return H.extend(n,eo.prototype,t,{allOwnKeys:!0}),H.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return Xv(Qr(e,o))},n}const ft=Xv(Si);ft.Axios=eo,ft.CanceledError=Qo,ft.CancelToken=_4,ft.isCancel=Av,ft.VERSION=Gv,ft.toFormData=wl,ft.AxiosError=Le,ft.Cancel=ft.CanceledError,ft.all=function(t){return Promise.all(t)},ft.spread=F4,ft.isAxiosError=W4,ft.mergeConfig=Qr,ft.AxiosHeaders=Xt,ft.formToJSON=e=>Dv(H.isHTMLForm(e)?new FormData(e):e),ft.getAdapter=Yv.getAdapter,ft.HttpStatusCode=of,ft.default=ft;const{Axios:Y$,AxiosError:q$,CanceledError:G$,isCancel:K$,CancelToken:X$,VERSION:Z$,all:J$,Cancel:Q$,isAxiosError:e8,spread:t8,toFormData:n8,AxiosHeaders:r8,HttpStatusCode:o8,formToJSON:s8,getAdapter:i8,mergeConfig:a8}=ft,sf={BASE_URL:"https://qa.3sc.ai/api",VERSION:"/v1"},Ti={headers:{"Content-Type":"application/json"},withCredentials:!0},Zv=ft.create({baseURL:sf.BASE_URL,axiosConfig:Ti});Zv.interceptors.request.use(function(e){return e},function(e){return Promise.reject(e)}),Zv.interceptors.response.use(function(e){return e},function(e){return Promise.reject(e)});const ur={TOKEN:"token",USER:"user",SNOP:"snop",SELECTED_BU:"selected_business_unit",SETTINGS:"settings"},Jv={TENANT_ID:"tenant_id",BU_ID:"bu_id"},V4=Object.values({"SKU Name":"sku_name",Node:"node","Channel Name":"channel_name"}),z4=[10,25,50,100],H4={MARK_ALL_READ:"MARK_ALL_READ"},U4=z4.map(e=>({label:e,value:e})),Qv={PRIMARY:"PRIMARY",SECONDARY:"SECONDARY"},Ol={NOTIFICATION:"/notifications",SETTING:"/configuration/setting"};function Pl(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 Y4={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 af(e,t){function n(o,i,a){if(!(typeof document>"u")){a=Pl({},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,"",Pl({},i,{expires:-1}))},withAttributes:function(o){return af(this.converter,Pl({},this.attributes,o))},withConverter:function(o){return af(Pl({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var q4=af(Y4,{path:"/"});const G4=ml(ur.SNOP),K4=ml(ur.SELECTED_BU),X4=ml(ur.USER);ml(ur.SETTINGS);const e2={BU_IDS:K4?.business_unit_id,TOKEN:JSON.parse(q4.get(ur.TOKEN)||null),TENANT_IDS:X4?.tenant_id,SNOP_IDS:G4?.snop_id},{TENANT_ID:Z4,BU_ID:J4}=Jv,{TENANT_IDS:Q4,BU_IDS:eN}=e2,Ml=async({baseUrl:e,payload:t})=>{try{const n=`${e}${Ol.SETTING}/v1?${Z4}=${Q4}&${J4}=${eN}`;return await ft.post(n,t,Ti)}catch(n){return n}},tN=({columns:e,gridPath:t,baseUrl:n,isDefaultConfig:r,pageSize:o=10,childUniqueKey:i,data:a})=>{const l=a?.length;let{definitions:c,defaultUserSettings:u,labels:d}=e;const f=dr(d),p=t.split("/").filter(Boolean),m=JSON.parse(localStorage.getItem(ur.SETTINGS));let h=p.reduce((w,x)=>w?.[x],m)||null;const g=dr(h?.columns||[]);if(!r&&t&&l){let w=(u&&lf({col:u,childUniqueKey:i,definitions:c}))??lf({col:c,childUniqueKey:i});const x=w.filter(C=>!g[C.key]),v=h&&h?.columns?.some(C=>C?.children&&C.children[i]);if(l&&(x.length||i&&v===!1)){if(v==!1&&i.length>0){const C=dr(w);w=h?.columns?.map(O=>O?.children&&!O.children[i]?{...O,children:{...O.children,[i]:C?.[O?.key]?.children[i]}}:O)}(async()=>{try{const O={...m||{platform:{theme:"light"}}},M=h?.pageSize??o;let D=O;for(let A=0;A<p.length;A++){const $=p[A];A===p.length-1?D[$]={columns:w,pageSize:M}:(D[$]={...D[$]||{}},D=D[$])}localStorage.setItem(ur.SETTINGS,JSON.stringify(O)),await Ml({baseUrl:n,payload:O})}catch(C){console.error(C)}})()}}u=(h?.columns&&nN(g,u,i))??u??lf({col:c});const b=[],S=dr(u);for(const w of c){const x=S[w.key]||{},v=f[w.key]||{},C=g[w.key],O=dr(x.children||[]),M=dr(v.children||[]);let D={...w,style:C?.style,...x,...v};w.children?.length&&(D.children=w.children.map(A=>({...A,...O[A.key],...M[A.key]}))),b.push(D)}return b.sort((w,x)=>w.sequenceId-x.sequenceId)},t2=e=>e.sort((t,n)=>t.sequenceId-n.sequenceId),ki=({columns:e,childUniqueKey:t,definitions:n})=>{let r=n||e;return e?.map(o=>{let i=r?.find(a=>a?.key===o?.key);return{id:o.id,key:o.key,sequenceId:o.sequenceId||o.id,isHidden:o.isHidden||!1,style:o.style||i?.style||{},...o?.children&&{children:t?{[t]:ki({columns:o.children,definitions:i?.children})}:ki({columns:o.children,definitions:i?.children})}}})},dr=e=>Array.isArray(e)&&e?.reduce((t,n)=>(t[n.key]=n,t),{}),lf=({col:e,childUniqueKey:t,definitions:n})=>ki({columns:e,childUniqueKey:t,definitions:n}),nN=(e,t,n)=>t.map(o=>{const i=e[o.key],a=o.children?o.children.map(l=>{const u=dr(Array.isArray(i?.children)?i?.children:i?.children?.[n])?.[l.key];return{...l,sequenceId:u?.sequenceId||l.sequenceId,isHidden:u?.isHidden??l.isHidden}}):void 0;return{...o,sequenceId:i?.sequenceId||o.sequenceId,isHidden:i?.isHidden??o.isHidden,...a?{children:a}:{}}}),rN=({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(y9),isLocalizable:!1},{id:2,key:"node",label:e(g9),isLocalizable:!1},{id:3,key:"channel_name",label:e(b9),isLocalizable:!1}];return{definitions:t,defaultUserSettings:n,labels:r}},n2=e=>{let{disabled:t=!1,minWidth:n=0,maxWidth:r,className:o="",id:i,resizeStart:a,resizeEnd:l,defaultWidth:c,rowSpan:u=1,colSpan:d=1}=e;const[f,p]=k.useState(!1),[m,h]=k.useState(0),[g,b]=k.useState(0),[S,E]=k.useState(0),[w,x]=k.useState(null),v=k.useRef(null),C=k.useCallback(T=>{if(!t&&(x(i),a&&a(),p(!0),h(T),b(0),v.current)){const j=v.current.previousSibling;j&&b(j.clientWidth)}},[t,i,a]),O=k.useCallback(()=>{t||(f&&l&&w===i&&l(S),p(!1),x(null))},[t,l,w,i,S,f]),M=k.useCallback(T=>{if(t)return;const j=T instanceof TouchEvent?T.touches[0].screenX:T.screenX;if(!f)return;const I=v.current;if(!I||!I.previousSibling)return;const B=I.previousSibling,L=m-j;let W=g-L;n!==void 0&&W<n&&(W=n),r!==void 0&&W>r&&(W=r),B.style.width=W+"px",B.style.minWidth=W+"px",B.style.maxWidth=W+"px",B.style.setProperty("--column_resize_before_width",W+"px"),E(W)},[t,f,m,g,n,r]);k.useEffect(()=>{const T=v.current;if(T&&T.previousSibling){const j=T.previousSibling;c?(j.style.minWidth=c+"px",j.style.width=c+"px",j.style.maxWidth=c+"px",j.style.setProperty("--column_resize_before_width",c+"px")):n&&(j.style.minWidth=n+"px",j.style.width=n+"px",j.style.maxWidth=n+"px",j.style.setProperty("--column_resize_before_width",n+"px"))}},[c,n]),k.useEffect(()=>{const T=v.current;if(t&&T&&T.previousSibling){const j=T.previousSibling;c&&(j.style.minWidth=c+"px",j.style.width=c+"px",j.style.maxWidth=c+"px",j.style.setProperty("--column_resize_before_width",c+"px")),r&&(j.style.maxWidth=r+"px")}},[t,c,r]);const D=k.useCallback(()=>{document.addEventListener("mousemove",M),document.addEventListener("mouseup",O),document.addEventListener("touchmove",M),document.addEventListener("touchend",O)},[M,O]),A=k.useCallback(()=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",O),document.removeEventListener("touchmove",M),document.removeEventListener("touchend",O)},[M,O]);k.useEffect(()=>(t||D(),()=>{A()}),[t,D,A]);const $={userSelect:"none"};return t||($.cursor="ew-resize"),o===""&&($.width="6px",$.backgroundColor="rgba(0, 0, 0, 0.1)"),k.createElement("th",{ref:v,style:$,rowSpan:u,colSpan:d,className:"column_resizer_own_class ".concat(t?"disabled_column_resize":""," ").concat(o),onMouseDown:t?void 0:T=>C(T.screenX),onTouchStart:t?void 0:T=>C(T.touches[0].screenX)})};function Dl({isRenderCellContent:e,column:t,row:n,parent:r}){const o=n[t.key],i=o?.length>20;return y.jsx(y.Fragment,{children:e?y.jsx(se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem"},children:t?.cellRenderer(n,{column:t,parent:r})}):y.jsx(y.Fragment,{children:i?y.jsx(Ha,{title:o,placement:"top",componentsProps:{tooltip:{sx:{fontSize:"1rem",padding:"0.5rem 1rem",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"}}},children:y.jsx(se,{sx:{maxWidth:"auto",whiteSpace:"normal"},children:y.jsx(lt,{sx:{fontSize:"1.1rem",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none"},children:o})})}):y.jsx(se,{sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem",m:0},id:t.key,component:"p",children:o??""})})})}Dl.propTypes={isRenderCellContent:s.bool,column:s.object,row:s.object},ee(Gc)(({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 Dr=ee(lt)(({theme:e})=>({color:e.palette.primary.notifyTextColor,fontSize:"1.1rem"})),oN=ee(e0)(({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)"})}})),sN=ee(Mo)(({theme:e})=>({color:e.palette.primary.notifyTextColor,padding:"0.6rem 0",fontSize:"0.9rem",fontWeight:500,"&::before, &::after":{borderColor:`${e.palette.primary.notifyBorderColor}!important`}})),iN=ee(Vc)(({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"}}));ee(fu)(({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 aN=ee(h0)(({theme:e})=>({minHeight:"2rem","& .MuiTabs-indicator":{height:"0.1rem",backgroundColor:e.palette.primary.notifyActiveText}})),cf=ee(t0)(({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}})),Rl=ee(om)(({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`}})),lN=ee(Do)(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"table-cell",[`&.${lu.head}`]:{color:e.palette.primary.notifyTextColor,backgroundColor:e.palette.primary.notifyBackground,borderColor:e.palette.primary.notifyBorderColor,padding:"0rem",textAlign:"center",lineHeight:"1.5rem"},[`&.${lu.body}`]:{color:e.palette.primary.notifyTextColor,borderColor:e.palette.primary.notifyBorderColor,padding:"0rem",textAlign:"center"}}));function to({children:e,...t}){return y.jsx(lN,{...t,children:e})}to.propTypes={children:s.node};const cN=ee(a0)(()=>({"&:last-child td":{borderBottom:"none"}}));function Rr({children:e,...t}){return y.jsx(cN,{...t,children:e})}Rr.propTypes={children:s.node};const r2=k.memo(({row:e,isSelected:t,isHigh:n,onRowClick:r,children:o,sxProps:i})=>y.jsx(Rr,{sx:a=>({backgroundColor:t||n?a.palette.primary.appBackground:a.palette.primary.notifyBackground,...i}),onClick:()=>r?.(e),children:o},e?.fhi)),o2=k.memo(({nestedData:e,nestedColumn:t,t:n})=>e?.length?y.jsx(y.Fragment,{children:e.map((r,o)=>y.jsx(Rr,{children:t.map((i,a)=>y.jsx(to,{style:i?.style,children:y.jsx(Dl,{isRenderCellContent:!!i?.cellRenderer,column:i,row:r})},a))},`nested-${o}`))}):y.jsx(Rr,{children:y.jsx(to,{colSpan:t.length,children:y.jsx(Dr,{sx:{textAlign:"center"},children:n(cr.NRF)})})})),s2=(e,t,n,r,o,i)=>{const[a,l]=k.useState({isOpen:!1,column:null}),c=(p,m,h)=>{l({isOpen:p.currentTarget,column:m,isChild:!!h})},u=()=>{l({isOpen:!1,column:null,isChild:!1})},d=async()=>{u();const p=e.map(m=>{if(a?.isChild&&Array.isArray(m.children)){const h=m.children.map(b=>b.key===a.column?.key?{...b,isHidden:!0}:b),g=h.every(b=>b.isHidden);return{...m,isHidden:g?!0:m.isHidden,children:h}}return m.key===a.column?.key?{...m,isHidden:!0}:m});f({updatedColumns:p})},f=async({updatedColumns:p})=>{t({type:je.SET_GRID_DATA,payload:{visibleGridColumns:p}});const m=r.split("/").filter(Boolean),h=JSON.parse(localStorage.getItem(ur.SETTINGS));let g=m.reduce((C,O)=>C?.[O],h)||null,b=ki({columns:p,childUniqueKey:i});const S=dr(g?.columns);b=b?.map(C=>{const O=C?.children||{},M=S?.[C?.key]?.children||{};return{...C,...(Object.keys(M)?.length>0||O?.[i])&&{children:{...M,[i]:O?.[i]}}}});const w={...h||{platform:{theme:"light"}}},x=g?.pageSize??o;let v=w;for(let C=0;C<m.length;C++){const O=m[C];C===m.length-1?v[O]={columns:b,pageSize:x}:(v[O]={...v[O]||{}},v=v[O])}localStorage.setItem(ur.SETTINGS,JSON.stringify(w)),await Ml({baseUrl:n,payload:w})};return{selectedColumn:a,handleMenuClick:c,handleClose:u,handleHideClick:d,columnUpdaterFunction:f}},uN=e=>{if(!e)return null;const{options:t,...n}=e,r=t?"select":"button",o={button:i=>y.jsx(sr,{...i,styles:{...i.styles,iconPrimary:i?.styles?.variant=="filled"}}),select:i=>y.jsx(se,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"},width:i.styles?.width},children:y.jsx(cv,{...i,options:t})})};return o[r]?o[r](n):null},dN=({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?.[d],e)||null,a=ki({columns:t?.grid,childUniqueKey:r});const l=dr(i?.columns);a=a?.map(u=>{const d=u?.children||{},f=l?.[u?.key]?.children||{};return{...u,...(Object.keys(f)?.length>0||d?.[r])&&{children:{...f,[r]: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?.pageSize??null}:(c[d]=c[d]||{},c=c[d])}return{settingObject:e,defaultUserSettings:a}},fN=async({baseUrl:e,gridSetting:t,childUniqueKey:n,gridPath:r})=>{try{const o=JSON.parse(localStorage.getItem("settings")),{settingObject:i,defaultUserSettings:a}=dN({presentSetting:o,gridSetting:t,gridPath:r,childUniqueKey:n});return localStorage.setItem("settings",JSON.stringify(i)),await Ml({baseUrl:e,payload:i}),a}catch(o){console.error(o)}},i2=({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]},uf=({pagination:e,gridPath:t,baseUrl:n,t:r})=>{const{selectedPage:o,rowPerPage:i,totalRecords:a,onPageChange:l,onPageSizeChange:c}=e,u=it(),d=async(m,h)=>{if(!h)return;const g=h.split("/").filter(Boolean),b="settings",E={...JSON.parse(localStorage.getItem(b))||{}};let w=E;for(let x=0;x<g.length;x++){const v=g[x];x===g.length-1?w[v]={...w[v]||{},pageSize:m}:(w[v]={...w[v]||{}},w=w[v])}localStorage.setItem(b,JSON.stringify(E)),await Ml({baseUrl:n,payload:E})},f=a===0?0:(o-1)*i+1,p=Math.min(o*i,a);return y.jsxs(se,{sx:{display:"flex",p:"1rem 1.5rem"},children:[y.jsxs(se,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"0.5rem",width:"100%"},children:[y.jsx(lt,{sx:{fontSize:"1.1rem",color:u.palette.primary.notifyTextColor},children:r("SHOWING_ROWS",{start:f,end:p,current:Math.min(o*i,a),total:a})}),y.jsx(se,{sx:{"& .MuiInputBase-input":{padding:"0rem 0.8rem!important"},width:"6rem"},children:y.jsx(Xo,{options:U4,value:i,onChange:async m=>{c(m),d(m?.value,t)}})})]}),y.jsx(Gm,{count:Math.ceil(a/i),page:o,onChange:async(m,h)=>{l(h)},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`}}})]})};uf.propTypes={pagination:s.object.isRequired};const df=({menuOpen:e,handleClose:t,onHideClick:n})=>{const r=it(),{t:o}=k.useContext(an);return y.jsx(Ys,{open:!!e,anchorEl:e,onClose:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:y.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:y.jsx(Na,{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:o("LABEL_HIDE_COLUMN")})})})};df.propTypes={menuOpen:s.object,handleClose:s.func,onHideClick:s.func};const a2=({sortKey:e,sortField:t,sortDir:n,handleSortClick:r})=>{const o=i=>y.jsx(xa,{onClick:r,sx:{padding:"0.2rem"},draggable:!1,children:y.jsx(Gt,{url:i})});return y.jsx(y.Fragment,{children:o(t===e?n==="asc"?ze.AscSort:ze.DescSort:ze.Unsort)})};a2.propTypes={sortKey:s.string.isRequired,sortField:s.string,sortDir:s.string,handleSortClick:s.func};function ff({parent:e,column:t,sort:n,handleMenuClick:r,isManageable:o}){const i=o&&(!t?.isMandatory||t?.isMandatory&&t?.showHide===!0),a=t?.label,l=t?.helpText,c=t?.isSortable,u=n?.sortField,d=n?.sortDir,f=n?.onSort;return y.jsxs(se,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},draggable:!1,children:[y.jsx(se,{sx:{fontWeight:"bold",fontSize:"1.1rem",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"0.5rem",textAlign:"center"},children:y.jsx(Ha,{title:l??a,placement:"top",componentsProps:{tooltip:{sx:{fontSize:"1rem",padding:"0.6rem 1rem",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"}}},children:a??""})}),y.jsxs(se,{sx:{display:"flex",alignItems:"center"},draggable:!1,children:[c&&y.jsx(a2,{sortKey:e?`${e?.key}|${t?.key}`:t?.key,sortField:u,sortDir:d,handleSortClick:()=>f({column:t,sortDir:d,sortField:u,parent:e})}),i&&y.jsx(xa,{draggable:!1,onClick:p=>r(p,t,e),sx:{padding:"0.2rem"},children:y.jsx(Gt,{url:ze.Menu})})]})]})}ff.propTypes={column:s.object.isRequired,sort:s.object.isRequired,handleMenuClick:s.func,isManageable:s.bool};function l2({rows:e,sort:t,data:n,pagination:r,columns:o,nested:i,baseUrl:a,gridPath:l,childUniqueKey:c,isVirtualizedTable:u=!1,t:d}){const f=it(),{visibleGridColumns:p}=k.useContext(yi),m=k.useContext(Ko),{selectedColumn:h,handleMenuClick:g,handleClose:b,handleHideClick:S,columnUpdaterFunction:E}=s2(p,m,a,l,r?.rowPerPage,c),w=o?.isManageable,x=o?.isResizable,v=n?.length>0,C=k.useRef(null),O=k.useRef(null),M=45,D=10,A=n?.length,[$,T]=k.useState({start:0,end:10}),[j,I]=k.useState(null),[B,L]=k.useState(null),[W,Y]=k.useState(null);let U=null;const F=k.useRef(0),R=k.useRef(!1),V=k.useRef(null),q=t2(i?.column?.definitions||[]),X=i?.isNested,te=i?.data||[],G=i?.hashKey,[Z,ie]=k.useState(0);k.useEffect(()=>{if(C.current){const ne=()=>{ie(C.current.offsetHeight)};return ne(),window.addEventListener("resize",ne),()=>window.removeEventListener("resize",ne)}},[n]),k.useEffect(()=>{const re=C.current?.querySelector("thead");if(!re)return;const ue=()=>{Y(null)};return re?.addEventListener("mousedown",ue),()=>{re?.removeEventListener("mousedown",ue)}},[]);const ae=(ne,re)=>{if(R.current){ne.preventDefault();return}I(re),Y(null),ne.dataTransfer.setData("colIndex",re);const ue=p[re],ye=ue?.label,fe=document.createElement("div");fe.textContent=ye,Object.assign(fe.style,{display:"flex",alignItems:"center",justifyContent:"center",padding:"1.5rem 2.5rem",minWidth:ue?.style?.minWidth,maxWidth:ue?.style?.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(fe);const{offsetWidth:Ae,offsetHeight:Ne}=fe;ne.dataTransfer.setDragImage(fe,Ae/2,Ne/2),requestAnimationFrame(()=>{document.body.removeChild(fe)})},_=(ne,re)=>{ne.preventDefault(),L(re),we(ne)},z=async(ne,re)=>{if(ne.preventDefault(),clearInterval(U),j===null||j===re)return;const ue=[...p],[ye]=ue.splice(j,1);ue.splice(re,0,ye);const fe=p.slice().sort((Ne,Ue)=>Ne.sequenceId-Ue.sequenceId).map(Ne=>Ne.sequenceId),Ae=ue.map((Ne,Ue)=>({...Ne,sequenceId:fe[Ue]??Ne.sequenceId}));E({updatedColumns:Ae}),I(null),L(null)},N=()=>{I(null),L(null)},oe=(ne,re,ue,ye)=>{if(!ne)return null;const fe=ne?.isMandatory&&ne?.isSticky,Ae=parseFloat(ne?.style?.minWidth?.toString().replace("rem",""))||7.5;re===0&&(F.current=0);const Ne=fe?re===0?0:`${F.current}rem`:void 0;fe&&(F.current+=Ae);const Ue=j===re,be=B==re||p?.[B]?.isMandatory,yt=Ye=>{ne.isMandatory?(Ye.preventDefault(),Ye.dataTransfer.dropEffect="none"):(Ye.preventDefault(),Ye.dataTransfer.dropEffect="move"),_?.(Ye,re)},ct=Ye=>{ne.isMandatory||z?.(Ye,re)};return ye&&`${ye?.key}${ne?.key}${re}`,y.jsx(to,{rowSpan:ne?.children?1:2,colSpan:ne?.children?.filter(Ye=>!Ye?.isHidden)?.length,style:ne?.style,draggable:ue&&!ne?.isMandatory,onDragStart:ue&&!ne?.isMandatory?Ye=>ae(Ye,re):Ye=>{Ye.preventDefault()},onDragOver:ue&&!ne?.isMandatory?yt:void 0,onDrop:ue&&!ne?.isMandatory?ct:void 0,onDragEnd:ue&&!ne?.isMandatory?N:void 0,sx:{...ne?.isSticky&&{boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...ne.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...ne?.key==="volume_value"&&{borderLeft:"1px solid"}},...Ue&&{border:`0.1rem solid ${f.palette.brandColor.lightBlue}!important`},...fe&&{position:"sticky",left:Ne,zIndex:3},cursor:be?"not-allowed":ue&&!ne?.isMandatory?"grab":"default"},children:y.jsx(ff,{parent:ye,column:ne,sort:t,handleMenuClick:g,isManageable:ue})},re)},Q=k.useCallback((ne,re,ue,ye)=>{if(!ne)return null;const fe=ne?.isMandatory&&ne?.isSticky,Ae=parseFloat(ne?.style?.minWidth?.toString().replace("rem",""))||7.5;ue===0&&(F.current=0);const Ne=fe?ue===0?0:`${F.current}rem`:void 0;return fe&&(F.current+=Ae),y.jsxs(to,{colSpan:1,style:ne?.style,className:`${ne?.label}`,sx:{position:"relative",...ne.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...ne?.key==="volume_value"&&{borderLeft:"1px solid"}},...ne?.isSticky&&{boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...fe&&{position:"sticky",left:Ne,zIndex:2,backgroundColor:Ue=>e?.selectedRow&&e?.selectedRow?.fhi===re?.fhi||re?.isHigh?Ue.palette.primary.appBackground:Ue.palette.primary.notifyBackground}},children:[(e?.selectedRow&&e?.selectedRow?.fhi===re?.fhi||re?.isHigh)&&y.jsx(se,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none",zIndex:1}}),y.jsx(Dl,{isRenderCellContent:!!ne?.cellRenderer,column:ne,row:re,parent:ye})]},ue)},[e?.selectedRow,f]),le=(ne,re,ue,ye)=>y.jsx(y.Fragment,{children:ne&&ue&&!ne?.isMandatory?y.jsx(se,{resizeStart:()=>{ne?.isMandatory&&!ne?.isResizable||(R.current=!0)},resizeEnd:fe=>{ne?.isMandatory&&!ne?.isResizable||fe<=20||(R.current=!1,i2({index:re,visibleGridColumns:p,width:fe,columnUpdaterFunction:E}))},component:ne?.children||ne?.isMandatory?Do:n2,rowSpan:ne?.children?1:2,colSpan:1,id:re,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},...!ne?.isMandatory&&{"&:hover::after":{content:'""',position:"absolute",top:0,left:"50%",transform:"translateX(-50%)",width:"0.2rem",height:`${Z}px`,backgroundColor:f.palette.primary.notifyBorderColor,zIndex:1}}}}):null}),Oe=k.useCallback((ne,re,ue,ye,fe,Ae,Ne)=>y.jsx(y.Fragment,{children:re&&ye&&!re?.isMandatory?y.jsx(Do,{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?.selectedRow&&e?.selectedRow?.fhi===ne?.fhi||ne?.isHigh)&&y.jsx(se,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none"}})},`resize-${ue}_${Ne}`):null}),[e?.selectedRow,f]),we=ne=>{const re=C.current,{left:ue,right:ye}=re.getBoundingClientRect(),fe=50,Ae=ne.clientX>ye-fe?1:ne.clientX<ue+fe?-1:0;Ae!==0?(V.current&&clearInterval(V.current),V.current=setInterval(()=>{re.scrollLeft+=Ae*10},50)):V.current&&(clearInterval(V.current),V.current=null)},Ie=ne=>ne?.map((re,ue)=>{const ye=$.start+ue,fe=re[G],Ae=te?.[fe],Ne=e?.selectedRow&&e?.selectedRow?.fhi===re?.fhi,Ue=re?.isHigh;return y.jsxs(k.Fragment,{children:[y.jsx(r2,{row:re,isSelected:Ne,isHigh:Ue,onRowClick:e?.onRowClick,children:p.map((be,yt)=>be?.isHidden||be?.isVisible===!1?null:be?.children?be.children.map((ct,Ye)=>ct?.isHidden?null:y.jsxs(k.Fragment,{children:[Q(ct,re,Ye,be),x&&Oe(re,ct,Ye,w,be,"",ye)]},`col-${yt}-${Ye}`)):y.jsxs(k.Fragment,{children:[Q(be,re,yt),x&&Oe(re,be,yt,w,"","",ye)]},`col-${yt}`))}),X&&Ae&&y.jsx(o2,{nestedData:Ae,nestedColumn:q,t:d})]},`row-${ye}`)}),Re=()=>{const ne=O.current;if(!ne)return;const re=ne.scrollTop,ue=ne.clientHeight,ye=Math.floor(re/M)-D,fe=Math.ceil(ue/M)+2*D,Ae=Math.max(0,Math.min(A-1,ye)),Ne=Math.max(Ae,Math.min(A,Ae+fe));T(Ue=>Ue.start===Ae&&Ue.end===Ne?Ue:{start:Ae,end:Ne})};k.useEffect(()=>{let ne;const re=()=>{ne&&cancelAnimationFrame(ne),ne=requestAnimationFrame(()=>{Re()})},ue=O.current;if(!(!ue||!u))return Re(),ue.addEventListener("scroll",re),()=>{cancelAnimationFrame(ne),ue.removeEventListener("scroll",re)}},[A]);const Fe=$.start*M,Pe=(A-$.end)*M,pe=u?n?.slice($.start,$.end):n;return v?y.jsxs(y.Fragment,{children:[y.jsx(cu,{ref:O,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:y.jsxs(iu,{ref:C,stickyHeader:!0,"aria-label":"sticky table",sx:{backgroundColor:ne=>ne.palette.primary.notifyBackground},children:[y.jsxs(uu,{children:[y.jsx(Rr,{sx:{position:"sticky",top:0,zIndex:3,backgroundColor:ne=>ne.palette.primary.notifyBackground},children:p.map((ne,re)=>ne?.isHidden||ne?.isVisible===!1?null:y.jsxs(k.Fragment,{children:[oe(ne,re,w),le(ne,re,w)]},re))}),y.jsx(Rr,{draggable:!1,sx:{position:"sticky",top:"2.5rem",backgroundColor:f.palette.primary.notifyBackground,zIndex:2},children:p.flatMap((ne,re)=>ne?.isHidden||!ne?.children||ne?.isVisible===!1?[]:ne.children.map((ue,ye)=>ue?.isHidden?null:y.jsxs(k.Fragment,{children:[oe(ue,ye,w,ne),x&&le(ue,ye,w)]},`${re}-${ye}`)))})]}),y.jsxs(au,{children:[u&&y.jsx("tr",{style:{height:Fe}}),Ie(pe),u&&y.jsx("tr",{style:{height:Pe}})]})]})}),r&&y.jsx(uf,{pagination:r,gridPath:l,baseUrl:a,t:d}),y.jsx(df,{menuOpen:h?.isOpen,handleClose:b,onHideClick:S})]}):y.jsx(Dr,{sx:{textAlign:"center"},children:d(cr.NRF)})}l2.propTypes={sort:s.object,data:s.array,pagination:s.object,columns:s.object,nested:s.object};function c2(e){return rv(e?.style?.width??e?.style?.minWidth??e?.style?.maxWidth)||0}const u2=e=>e?.isHidden||e?.isVisible===!1;function pN(e){const t=k.useMemo(()=>{let o=0;return e.flatMap((i,a)=>{if(u2(i))return[];if(Array.isArray(i.children)&&i.children.length){const u=i.children.filter(d=>!u2(d));return u.length?u.map(d=>{const f=c2(d),p={...d,_parent:i,_originalIndex:a,width:f,start:o,end:o+f,isSticky:!!(d?.isSticky??i?.isSticky)};return o+=f,p}):[]}const l=c2(i);if(l===0)return[];const c={...i,_parent:null,_originalIndex:a,width:l,start:o,end:o+l,isSticky:!!i?.isSticky};return o+=l,c})},[e]),n=k.useMemo(()=>{let o=0;const i={};return t.forEach(a=>{a.isSticky&&(i[a.sequenceId]=o,o+=a.width)}),i},[t]);return{columnsMeta:t,stickyOffsets:n,getStickyLeft:o=>{if(!o?.isMandatory||!o?.isSticky)return;const i=n[o.sequenceId];return i===0?0:`${i}px`}}}function hN({visibleGridColumns:e,columnUpdaterFunction:t,isResizingRef:n,startAutoScroll:r,stopAutoScroll:o}){const i=it(),[a,l]=k.useState(null),[c,u]=k.useState(null),d=k.useCallback((b,S)=>{if(n.current){b.preventDefault();return}l(S),b.dataTransfer.setData("colIndex",S);const E=e[S],w=document.createElement("div");w.textContent=E?.label,Object.assign(w.style,{display:"flex",alignItems:"center",justifyContent:"center",padding:"1.5rem 2.5rem",minWidth:E?.style?.minWidth,maxWidth:E?.style?.maxWidth,fontSize:"1.2rem",fontWeight:"500",color:i.palette.primary.notifyTextColor,background:i.palette.primary.notifyBackground,border:`0.1rem solid ${i.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(w);const{offsetWidth:x,offsetHeight:v}=w;b.dataTransfer.setDragImage(w,x/2,v/2),requestAnimationFrame(()=>document.body.removeChild(w))},[n,e,i]),f=k.useCallback((b,S)=>{if(b.preventDefault(),e?.[S]?.isMandatory){b.dataTransfer.dropEffect="none";return}b.dataTransfer.dropEffect="move",u(S),r(b.clientX)},[r,e]),p=k.useCallback(async(b,S)=>{if(b.preventDefault(),o(),a===null||a===S||e?.[S]?.isMandatory)return;const E=[...e],[w]=E.splice(a,1);E.splice(S,0,w);const x=[...e].sort((C,O)=>C.sequenceId-O.sequenceId).map(C=>C.sequenceId),v=E.map((C,O)=>({...C,sequenceId:x[O]??C.sequenceId}));t({updatedColumns:v}),l(null),u(null)},[a,e,t,o]),m=k.useCallback(()=>{o(),l(null),u(null)},[o]),h=b=>!b?.isMandatory,g=k.useCallback(b=>c===null||a===null?!1:!!(e?.[b]?.isMandatory||e?.[c]?.isMandatory),[c,a,e]);return{draggedColIndex:a,dragOverIndex:c,handleDragStart:d,handleDragOver:f,handleDrop:p,handleDragEnd:m,isDraggable:h,isInvalidDrop:g}}const d2=50,mN=10,gN=50;function yN(e){const t=k.useRef(null),n=k.useCallback(()=>{t.current&&(clearInterval(t.current),t.current=null)},[]);return{startAutoScroll:k.useCallback(o=>{const i=e.current;if(!i)return;const{left:a,right:l}=i.getBoundingClientRect(),c=o>l-d2?1:o<a+d2?-1:0;if(c===0){n();return}t.current||(t.current=setInterval(()=>{i.scrollLeft+=c*mN},gN))},[e,n]),stopAutoScroll:n}}const pf=k.memo(function({column:t,index:n,isManageable:r,parent:o,stickyLeft:i,colSpanOverride:a,draggedColIndex:l,isInvalidDrop:c,onDragStart:u,onDragOver:d,onDrop:f,onDragEnd:p,sort:m,handleMenuClick:h}){const g=it(),b=l===n,S=r&&!t?.isMandatory,E=t?.isMandatory&&t?.isSticky,w=o&&o.children?.find(C=>!C?.isHidden&&C?.isVisible!==!1)?.key===t?.key,x=!o&&Array.isArray(t?.children)&&t.children.some(C=>!C?.isHidden&&C?.isVisible!==!1),v=a??t.children?.filter(C=>!C?.isHidden)?.length;return y.jsx(to,{rowSpan:t?.children?1:2,colSpan:v,style:t?.style,draggable:S,onDragStart:S?C=>u(C,n):C=>C.preventDefault(),onDragOver:S?C=>d(C,n):void 0,onDrop:S?C=>f(C,n):void 0,onDragEnd:S?p:void 0,sx:{...t?.isSticky&&{boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...t.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...(w||x)&&{borderLeft:"0.1rem solid"}},...b&&{border:`0.1rem solid ${g.palette.brandColor.lightBlue}!important`},...E&&{position:"sticky",left:i,zIndex:3},cursor:c(n)?"not-allowed":S?"grab":"default"},children:y.jsx(ff,{parent:o,column:t,sort:m,handleMenuClick:h,isManageable:r})},n)}),hf=k.memo(function({column:t,index:n,isManageable:r,tableHeight:o,onResizeStart:i,onResizeEnd:a}){const l=it();return!t||!r||t?.isMandatory?null:y.jsx(se,{component:t?.children||t?.isMandatory?Do:n2,rowSpan:t?.children?1:2,colSpan:1,id:n,resizeStart:i,resizeEnd:a,sx:{width:"1rem",maxWidth:"1rem",minWidth:"1rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${l.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:l.palette.primary.notifyBorderColor,zIndex:1},"&:hover::after":{content:'""',position:"absolute",top:0,left:"50%",transform:"translateX(-50%)",width:"0.2rem",height:`${o}px`,backgroundColor:l.palette.primary.notifyBorderColor,zIndex:1}}})}),bN=k.memo(function({stickyGridColumns:t,virtualisedColumns:n,isManageable:r,isResizable:o,tableHeight:i,sort:a,handleMenuClick:l,getStickyLeft:c,offsetX:u,draggedColIndex:d,isInvalidDrop:f,onDragStart:p,onDragOver:m,onDrop:h,onDragEnd:g,isResizingRef:b,columnUpdaterFunction:S,visibleGridColumns:E}){const w=it(),x={draggedColIndex:d,isInvalidDrop:f,onDragStart:p,onDragOver:m,onDrop:h,onDragEnd:g},v=(O,M)=>({onResizeStart:()=>{O?.isMandatory&&!O?.isResizable||(b.current=!0)},onResizeEnd:D=>{O?.isMandatory&&!O?.isResizable||D<=20||(b.current=!1,i2({index:M,visibleGridColumns:E,width:D,columnUpdaterFunction:S}))}}),C=k.useMemo(()=>{const O=[];return n.forEach(M=>{const D=M._parent?.key??M.key,A=O[O.length-1];A&&A.key===D?A.colSpan+=1:O.push({key:D,column:M._parent??M,colSpan:1,firstChild:M})}),O},[n]);return y.jsxs(uu,{children:[y.jsxs(Rr,{sx:{position:"sticky",top:0,zIndex:3,backgroundColor:w.palette.primary.notifyBackground},children:[t.map((O,M)=>{const D=O._parent??O;return y.jsxs(k.Fragment,{children:[y.jsx(pf,{column:D,index:O._originalIndex,isManageable:r,stickyLeft:c(O),sort:a,handleMenuClick:l,...x}),o&&y.jsx(hf,{column:D,index:O._originalIndex,isManageable:r,tableHeight:i,...v(D,O._originalIndex)})]},`sticky-p-${M}`)}),y.jsx("th",{style:{minWidth:u,width:u,padding:0,border:"none"}}),C.map((O,M)=>y.jsxs(k.Fragment,{children:[y.jsx(pf,{column:O.column,index:O.firstChild._originalIndex,colSpanOverride:O.colSpan,isManageable:r,stickyLeft:c(O.firstChild),sort:a,handleMenuClick:l,...x}),o&&y.jsx(hf,{column:O.column,index:O.firstChild._originalIndex,isManageable:r,tableHeight:i,...v(O.column,O.firstChild._originalIndex)})]},`parent-${O.key}`))]}),y.jsxs(Rr,{draggable:!1,sx:{position:"sticky",top:"2.5rem",backgroundColor:w.palette.primary.notifyBackground,zIndex:2},children:[y.jsx("th",{style:{minWidth:u,width:u,padding:0,border:"none"}}),n?.map((O,M)=>O._parent&&y.jsxs(k.Fragment,{children:[y.jsx(pf,{column:O,index:O._originalIndex,isManageable:r,parent:O._parent,stickyLeft:c(O),sort:a,handleMenuClick:l,...x}),o&&y.jsx(hf,{column:O,index:O._originalIndex,isManageable:r,tableHeight:i,...v(O,O._originalIndex)})]},`child-${O?._parent?.key??O.key}-${M}`))]})]})}),vN=()=>y.jsx(se,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none",zIndex:1}}),f2=k.memo(function({column:t,row:n,cellKey:r,parent:o,stickyLeft:i,isSelected:a,isHigh:l}){const c=it(),u=t?.isMandatory&&t?.isSticky,d=a||l,f=o&&o.children?.find(p=>!p?.isHidden&&p?.isVisible!==!1)?.key===t?.key;return y.jsxs(to,{colSpan:1,style:t?.style,className:`${t?.label}`,sx:{position:"relative",...t.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...f&&{borderLeft:"0.1rem solid"}},...t?.isSticky&&{boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...u&&{position:"sticky",left:i,zIndex:2,backgroundColor:d?c.palette.primary.appBackground:c.palette.primary.notifyBackground}},children:[d&&y.jsx(vN,{}),y.jsx(Dl,{isRenderCellContent:!!t?.cellRenderer,column:t,row:n,parent:o})]},r)});function xN({actualIndex:e,extraHeight:t,measureRow:n,resetRow:r}){return useEffect(()=>(n(e,t),()=>r(e)),[e,t]),null}const wN=k.memo(function({visibleRows:t,stickyGridColumns:n,virtualisedColumns:r,isResizable:o,isManageable:i,topSpacerHeight:a,bottomSpacerHeight:l,selectedRow:c,isNested:u,nestedRow:d,nestedColumn:f,hashKey:p,getStickyLeft:m,offsetX:h,rightSpacerWidth:g,rowStart:b,defaultRowHeight:S,measureRow:E,resetRow:w,t:x}){const v=it(),C=k.useCallback((O,M,D)=>{if(!O||!i||O?.isMandatory)return null;const A=c&&c?.fhi===M?.fhi||M?.isHigh;return y.jsx(Do,{className:"column_resizer_body",sx:{width:"1rem",maxWidth:"1rem",minWidth:"1rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${v.palette.primary.notifyBorderColor}`},children:A&&y.jsx("div",{style:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none"}})},`resize-${D}`)},[i,c,v]);return y.jsxs(au,{children:[y.jsx("tr",{style:{height:a}}),t?.map((O,M)=>{const D=b+M,A=c&&c?.fhi===O?.fhi,$=O?.isHigh,T=d?.[O[p]];return y.jsxs(k.Fragment,{children:[y.jsxs(r2,{row:O,isSelected:A,isHigh:$,sxProps:{height:"3.5rem","& td, & th":{height:"3.5rem"}},children:[n.map((j,I)=>y.jsxs(k.Fragment,{children:[y.jsx(f2,{column:j,row:O,cellKey:I,parent:j._parent,stickyLeft:m(j),isSelected:A,isHigh:$}),o&&C(j,O,`sticky-${I}-${D}`)]},`sticky-${j.sequenceId??I}`)),y.jsx("td",{style:{minWidth:h,width:h,padding:0,border:"none"}}),r.map((j,I)=>y.jsxs(k.Fragment,{children:[y.jsx(f2,{column:j,row:O,cellKey:I,parent:j._parent,stickyLeft:m(j),isSelected:A,isHigh:$}),o&&C(j,O,`${I}-${D}`)]},`col-${j?._parent?.key??j.key}-${I}`))]}),u&&T&&y.jsxs(y.Fragment,{children:[y.jsx(xN,{actualIndex:D,extraHeight:T.length*S,measureRow:E,resetRow:w}),y.jsx(o2,{nestedData:T,nestedColumn:f,t:x})]})]},`row-${D}`)}),y.jsx("tr",{style:{height:l}})]})});function SN({rowCount:e,defaultRowHeight:t,scrollTop:n,containerRef:r,overscan:o=5}){const i=k.useRef(0),[a,l]=k.useState(()=>rv("40rem"));k.useEffect(()=>{const m=r?.current;if(!m)return;const h=m.clientHeight;h&&h!==i.current&&(i.current=h,l(h));const g=new ResizeObserver(b=>{const S=b[0].contentRect;S.height!==i.current&&(i.current=S.height,l(S.height))});return g.observe(m),()=>g.disconnect()},[]);const[c,u]=k.useState({}),d=(m,h)=>{u(g=>g[m]===h?g:{...g,[m]:h})},f=m=>{u(h=>{if(!(m in h))return h;const g={...h};return delete g[m],g})},p=k.useMemo(()=>{const m=new Array(e+1);m[0]=0;for(let h=0;h<e;h++)m[h+1]=m[h]+(c[h]??t);return m},[c,e,t]);return k.useMemo(()=>{const m=p[e],h=n+a;let g=0,b=e-1,S=0;for(;g<=b;){const w=g+b>>1;p[w+1]>n?(S=w,b=w-1):g=w+1}S=Math.max(0,S-o),g=S,b=e-1;let E=e;for(;g<=b;){const w=g+b>>1;p[w]>=h?(E=w,b=w-1):g=w+1}return E=Math.min(e,E+o),{startIndex:S,endIndex:E,topSpacerHeight:p[S],bottomSpacerHeight:m-p[E],totalHeight:m,measureRow:d,resetRow:f}},[p,e,a,n,o])}function CN({columnWidths:e,scrollLeft:t,overscan:n=2}){const r=k.useRef(0),[o,i]=k.useState(0),a=k.useRef(null),l=k.useCallback(f=>{if(a.current?.disconnect(),!f)return;const p=f.clientWidth;p&&(r.current=p,i(p)),a.current=new ResizeObserver(m=>{const h=m[0].contentRect;h.width!==r.current&&(r.current=h.width,i(h.width))}),a.current.observe(f)},[]),c=k.useMemo(()=>e.map(f=>{const p=Number(f);return Number.isFinite(p)&&p>0?p:0}),[e]),u=k.useMemo(()=>{const f=new Array(c.length+1);f[0]=0;for(let p=0;p<c.length;p++)f[p+1]=f[p]+c[p];return f},[c]);return{...k.useMemo(()=>{const f=t+o,p=u[c.length];let m=0,h=c.length-1,g=c.length;for(;m<=h;){const S=m+h>>1;u[S+1]>t?(g=S,h=S-1):m=S+1}g=Math.max(0,g-n),m=g,h=c.length-1;let b=c.length;for(;m<=h;){const S=m+h>>1;u[S]>=f?(b=S,h=S-1):m=S+1}return b=Math.min(c.length,b+n),{startIndex:g,endIndex:b,offsetX:u[g]||0,rightSpacerWidth:p-u[b],viewportWidth:o}},[c,u,o,t,n]),measuredRef:l}}const p2=45;function TN({rows:e,sort:t,data:n,pagination:r,columns:o,nested:i,baseUrl:a,gridPath:l,childUniqueKey:c,isVirtualizedTable:u=!1,t:d}){const f=it(),{visibleGridColumns:p}=k.useContext(yi),m=k.useContext(Ko),{selectedColumn:h,handleMenuClick:g,handleClose:b,handleHideClick:S,columnUpdaterFunction:E}=s2(p,m,a,l,r?.rowPerPage,c),w=o?.isManageable,x=o?.isResizable,v=k.useRef(null),C=k.useRef(null),O=k.useRef(!1),M=k.useRef(0),D=k.useRef(0),A=k.useRef(!1),[,$]=k.useState({}),{getStickyLeft:T,columnsMeta:j}=pN(p),{startAutoScroll:I,stopAutoScroll:B}=yN(v),{draggedColIndex:L,isInvalidDrop:W,handleDragStart:Y,handleDragOver:U,handleDrop:F,handleDragEnd:R}=hN({visibleGridColumns:p,columnUpdaterFunction:E,isResizingRef:O,startAutoScroll:I,stopAutoScroll:B});console.log({visibleGridColumns:p,columnsMeta:j});const V=ue=>{const ye=ue.currentTarget.scrollTop,fe=ue.currentTarget.scrollLeft;A.current||(A.current=!0,requestAnimationFrame(()=>{M.current=ye,D.current=fe,$({}),A.current=!1}))},q=k.useMemo(()=>j.filter(ue=>ue.isSticky&&!ue.isCenterTable),[j]),X=k.useMemo(()=>j.filter(ue=>ue.isSticky&&ue.isCenterTable||!ue.isSticky),[j]),te=k.useMemo(()=>X.map(ue=>ue.width),[X]),{startIndex:G,endIndex:Z,topSpacerHeight:ie,bottomSpacerHeight:ae,measureRow:_,resetRow:z}=SN({rowCount:n.length,defaultRowHeight:p2,scrollTop:M.current,containerRef:C,overscan:15}),{startIndex:N,endIndex:oe,offsetX:Q,measuredRef:le}=CN({columnWidths:te,scrollLeft:D.current,overscan:2}),Oe=k.useMemo(()=>X.slice(N,oe),[X,N,oe]),[we,Ie]=k.useState(0);k.useEffect(()=>{const ue=v.current;if(!ue)return;const ye=new ResizeObserver(()=>Ie(ue.offsetHeight));return ye.observe(ue),()=>ye.disconnect()},[]);const Re=t2(i?.column?.definitions||[]),Fe=i?.isNested,Pe=i?.data||[],pe=i?.hashKey,ne=n?.slice(G,Z),re=k.useCallback(ue=>{C.current=ue,le(ue)},[le]);return n?.length?y.jsxs(y.Fragment,{children:[y.jsx(cu,{ref:re,onScroll:V,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:y.jsxs(iu,{ref:v,stickyHeader:!0,"aria-label":"sticky table",sx:{backgroundColor:f.palette.primary.notifyBackground},children:[y.jsx(bN,{offsetX:Q,stickyGridColumns:q,virtualisedColumns:Oe,isManageable:w,isResizable:x,tableHeight:we,sort:t,handleMenuClick:g,getStickyLeft:T,draggedColIndex:L,isInvalidDrop:W,onDragStart:Y,onDragOver:U,onDrop:F,onDragEnd:R,isResizingRef:O,visibleGridColumns:p,columnUpdaterFunction:E}),y.jsx(wN,{offsetX:Q,rowStart:G,defaultRowHeight:p2,measureRow:_,resetRow:z,visibleRows:ne,stickyGridColumns:q,virtualisedColumns:Oe,isResizable:x,isManageable:w,topSpacerHeight:ie,bottomSpacerHeight:ae,selectedRow:e?.selectedRow,isNested:Fe,nestedRow:Pe,nestedColumn:Re,hashKey:pe,getStickyLeft:T,t:d})]})}),r&&y.jsx(uf,{pagination:r,gridPath:l,baseUrl:a,t:d}),y.jsx(df,{menuOpen:h?.isOpen,handleClose:b,onHideClick:S})]}):y.jsx(Dr,{sx:{textAlign:"center"},children:d(cr.NRF)})}function h2({tableProps:e,isDefaultConfig:t,gridPath:n,baseUrl:r,childUniqueKey:o}){const{columns:i}=e,a=k.useContext(Ko),{t:l}=k.useContext(an),c=!!e?.isVirtualizedTable,u=tN({columns:i,gridPath:n,baseUrl:r,isDefaultConfig:t,childUniqueKey:o,pageSize:e?.pagination?.rowPerPage,data:e?.data});return k.useEffect(()=>{u?.length&&e?.data?.length&&a?.({type:je.SET_GRID_DATA,payload:{visibleGridColumns:u}})},[u,e?.data]),y.jsx(y.Fragment,{children:c?y.jsx(TN,{...e,gridPath:n,baseUrl:r,childUniqueKey:o,t:l}):y.jsx(l2,{...e,gridPath:n,baseUrl:r,childUniqueKey:o,t:l})})}h2.propTypes={tableProps:s.object.isRequired,mergedColumns:s.array.isRequired};const m2=({type:e})=>{const r=it()?.mode==="dark"?{bgcolor:"grey.800"}:{};return{grid:y.jsxs(se,{sx:{borderRadius:2,overflow:"hidden"},children:[y.jsx(nr,{variant:"text",width:"100%",height:60,sx:r}),Array.from({length:10}).map((i,a)=>y.jsx(se,{sx:{display:"flex",alignItems:"center",padding:"0.5rem",gap:"3rem"},children:Array.from({length:5}).map((l,c)=>y.jsx(se,{sx:{flex:1},children:y.jsx(nr,{variant:"text",height:45,sx:r})},c))},a))]}),toolbar:y.jsx(y.Fragment,{children:y.jsxs(He,{direction:"row",justifyContent:"space-between",sx:{display:"flex",gap:"1rem"},children:[y.jsxs(He,{direction:"row",gap:"1rem",children:[y.jsx(nr,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),y.jsx(nr,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),y.jsx(nr,{variant:"text",width:"15.2rem",height:"5rem",sx:r})]}),y.jsxs(He,{direction:"row",gap:"1rem",children:[y.jsx(nr,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),y.jsx(nr,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),y.jsx(nr,{variant:"text",width:"3.5rem",height:"5rem",sx:r})]})]})})}[e]},kN=({customTools:e})=>{const t=e?.filter(r=>r?.type===Qv.PRIMARY)?.sort((r,o)=>r.sequenceId-o.sequenceId),n=e?.filter(r=>r?.type===Qv.SECONDARY)?.sort((r,o)=>r.sequenceId-o.sequenceId);return{primaryButtons:t,secondaryButtons:n}},g2=({customTools:e,isExpanded:t,setIsExpanded:n})=>{const{primaryButtons:r,secondaryButtons:o}=kN({customTools:e}),[i,a]=k.useState(r),l=o?.length>0,{t:c}=k.useContext(an),u=f=>{f?a([...r,...o]):setTimeout(()=>{a(r)},100)},d=()=>{const f=!t;n(f),u(f)};return k.useEffect(()=>{u(t)},[e]),y.jsxs(y.Fragment,{children:[t&&y.jsx("div",{style:{position:"fixed",left:0,width:"100vw",height:"4rem",zIndex:998}}),y.jsxs(se,{sx:{display:"flex",alignItems:"center",gap:"0.8rem",flexWrap:"nowrap",maxWidth:"100%",whiteSpace:"nowrap",zIndex:999},children:[y.jsx(fM,{mode:"popLayout",children:i.map((f,p)=>y.jsx(zo.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},layout:!0,children:y.jsx(se,{sx:{flexShrink:0,minWidth:"fit-content"},children:uN(f)})},`${f.id}_${p}`))}),l&&y.jsx(se,{sx:{paddingLeft:t?"0.5rem":0},children:y.jsx(sr,{label:t?"":c("LABEL_MORE_ACTIONS"),styles:{iconPrimary:!0,icon:t?ze.CrossWhite:ze.More,colorType:t?"danger":""},onClick:d})})]})]})};g2.propTypes={customTools:s.array.isRequired};const y2=({defaultTools:e,isManageable:t,customTools:n,baseUrl:r,gridPath:o,pageSize:i,gridData:a,childUniqueKey:l})=>{const{t:c}=k.useContext(an),u=k.useContext(Ko),{visibleGridColumns:d,triggerApi:f}=k.useContext(yi),[p,m]=k.useState([]),[h,g]=k.useState(!1),b=n?.filter(v=>v.position==="left").sort((v,C)=>v.sequenceId-C.sequenceId)||[],S=n?.filter(v=>v.position==="right").sort((v,C)=>v.sequenceId-C.sequenceId)||[];k.useEffect(()=>{if(d.length){const v={id:99999,sequenceId:99999,isLocalizable:!1,key:"horizons",label:c("Horizons"),isSortable:!1,isHidden:!0,showChildCheckbox:!0,showCheckbox:!1,isMandatory:!0,showInHierarchy:!0,showHide:!0,children:[]};let C=d.map(M=>(M?.children&&M.children.forEach(D=>{v.children.some($=>$.key===D.key)||v.children.push({...D,showInHierarchy:!0})}),M)).filter(M=>M?.id!==v?.id);const O=v.children.length>0?[...C,v]:C;m(O)}},[d]);const E=async v=>{try{await fN({baseUrl:r,gridPath:o,childUniqueKey:l,gridSetting:{grid:v,pageSize:i}})}catch(C){console.error(C)}finally{u({type:je.HAS_SETTING_CHANGE,payload:{hasChange:!1}}),u({type:je.TRIGGER_API,payload:{triggerApi:!1}})}};k.useEffect(()=>{f&&E(d)},[f]);const w=v=>{const C=v?.map(D=>D.id),O=v?.flatMap(D=>D.children||[])?.map(D=>D.id),M=p?.map(D=>{const A=C?.includes(D.id);if(Array.isArray(D.children)&&D.children.length>0){const T=D?.children?.map(I=>{const B=O?.includes?.(I.id);return{...I,isHidden:!B}}),j=T?.filter(I=>p?.some(B=>B.children?.some(L=>L.id===I.id)))?.every(I=>I.isHidden);return{...D,...!D.children[0]?.showInHierarchy&&{isHidden:j||!A},children:T}}return{...D,isHidden:!A}});u({type:je.SET_GRID_DATA,payload:{visibleGridColumns:M}}),u({type:je.HAS_SETTING_CHANGE,payload:{hasChange:!0}})},x=()=>p.map(C=>{const O=Array.isArray(C.children)?C.children.filter(M=>!M.isHidden):void 0;return!C.isHidden||C.isHidden&&C.showInHierarchy?{...C,children:O}:null}).filter(Boolean);return y.jsxs(se,{sx:{margin:"1rem 0",position:"relative",zIndex:10,display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"0.6rem",width:"100%"},children:[y.jsxs(se,{sx:{display:"flex",flexDirection:"row",gap:"0.6rem",alignItems:"center"},children:[e?.search?.isRequired&&y.jsx(lv,{...e?.search,iconUrl:ze.Search}),e?.refresh?.isRequired&&y.jsx(sr,{...e?.refresh,styles:{variant:"filled",icon:ze.Refresh,colorType:"empty",width:"3.2rem",height:"3.2rem"}}),e?.groupBy?.isRequired&&y.jsx(se,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:y.jsx(Xo,{styles:{icon:ze.Group},...e.groupBy})}),t&&y.jsx(se,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:y.jsx(Xo,{placeholder:c("LABEL_MANAGE_COLUMN"),options:p,value:x(),isMulti:!0,isDraggable:!0,showSearch:!0,isManageColumn:!0,onChange:w,disabled:!a.length,styles:{icon:ze.Manage}})}),b?.length>0&&b.map((v,C)=>y.jsx(k.Fragment,{children:v.render()},v.id))]}),y.jsxs(se,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"0.6rem"},children:[S?.length>0&&S.map((v,C)=>y.jsx(k.Fragment,{children:v.render()},v.id)),n&&y.jsx(g2,{customTools:n,setIsExpanded:g,isExpanded:h}),e?.save?.isRequired&&y.jsx(se,{sx:{px:"0.5rem"},children:y.jsx(sr,{label:h?"":"Save",styles:{icon:ze.Save,colorType:"empty"},...e?.save})}),e?.upload?.isRequired&&y.jsx(sr,{...e?.upload,styles:{variant:h?"outlined":"filled",icon:h?ze.UploadDark:ze.Upload,iconPrimary:!h,colorType:"secondary",isAnimate:!0}}),e?.download?.isRequired&&y.jsx(sr,{...e?.download,styles:{variant:"outlined",icon:ze.Download,isAnimate:!0}})]})]})};y2.propTypes={defaultTools:s.object.isRequired,customTools:s.array,isManageable:s.bool,baseUrl:s.string,gridPath:s.gridPath};function mf({tableProps:e,toolbarProps:t,isDefaultConfig:n,isLoading:r}){const o=e.columns?.isManageable;return y.jsx(ov,{children:r?y.jsxs(y.Fragment,{children:[t&&y.jsx(m2,{type:"toolbar"}),e&&y.jsx(m2,{type:"grid"})]}):y.jsxs(se,{sx:{position:"sticky"},children:[t&&y.jsx(y2,{...t,isManageable:o,pageSize:e?.pagination?.rowPerPage,gridData:e?.data}),y.jsx(h2,{tableProps:e,isDefaultConfig:n,gridPath:t?.gridPath||"",baseUrl:t?.baseUrl||"",childUniqueKey:t?.childUniqueKey||""})]})})}mf.propTypes={tableProps:s.object.isRequired,toolbarProps:s.object,isDefaultConfig:s.bool};const b2=({list:e,handleLinkClick:t})=>{const n=it(),{t:r}=k.useContext(an),o=({list:i})=>i?.sort((a,l)=>a.order-l.order)?.map((a,l)=>a?.link?y.jsx(Hr,{component:"h3",sx:{fontSize:"1rem",cursor:"pointer",color:l===i?.length-1?n.palette.brandColor.orange:n.palette.primary.notifyTextColor},href:a?.link,underline:"hover",onClick:()=>t(a),children:r(a?.title)},l):y.jsx(lt,{component:"h3",sx:{fontSize:"1rem",color:l===i?.length-1?n.palette.brandColor.orange:n.palette.primary.notifyTextColor},children:r(a?.title)},l));return y.jsx(pm,{separator:y.jsx(Gt,{url:ze.ArrowRight}),children:o({list:e})})};b2.propTypes={list:s.array.isRequired,handleLinkClick:s.func};const v2=({breadcrumbProps:e,switchProps:t,filterComponentProps:n,metaDataProps:r})=>{const o=it(),{t:i}=k.useContext(an),a=n?.filterBtnProps?.disabled;return y.jsxs(y.Fragment,{children:[y.jsxs(He,{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:[y.jsx(b2,{...e}),y.jsxs(He,{direction:"row",gap:"1rem",alignItems:"center",children:[r,t&&y.jsx(dv,{...t}),n?.filterBtnProps&&y.jsxs(He,{direction:"row",children:[y.jsx(Mo,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"2rem!important",opacity:"1!important",borderColor:o.palette.primary.notifyBorderColor}}),y.jsxs(He,{direction:"row",alignItems:"center",gap:"0.5rem",onClick:n?.filterBtnProps?.onFilterClick,sx:{opacity:a?.5:1,cursor:a?"not-allowed":"pointer"},children:[y.jsx(Gt,{url:ze.Filter}),y.jsx(lt,{sx:{fontSize:"1.1rem",color:o.palette.primary.notifyActiveText},children:i(n?.filterBtnProps?.label)})]})]})]})]}),y.jsx(zo.div,{layout:!0,initial:{height:"0rem"},animate:{height:n?.filterBtnProps?.filterContainerVisible?"5rem":"0rem",opacity:n?.filterBtnProps?.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:n?.filterContainerProps?.isSideDrawerOpen?"75%":"100%"},children:y.jsxs(He,{sx:{background:o.palette.primary.appBackground,height:"3.8rem",p:"0 2rem",width:"100%",borderRadius:"0.7rem",overflow:"visible"},direction:"row",alignItems:"center",children:[y.jsxs(lt,{sx:{fontSize:"1.2rem",fontWeight:"500",color:o.palette.primary.notifyActiveText},children:[n?.labels?.description||i("Filters")," :"]}),y.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:y.jsx(He,{direction:"row",gap:"1.2rem",sx:{overflow:"visible"},children:n?.filterItems?.map((l,c)=>y.jsx(y.Fragment,{children:y.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:[y.jsx(se,{component:"img",src:ze.FilterClose,sx:{position:"absolute",top:"-0.4rem",right:"-0.6rem",cursor:"pointer"},onClick:()=>n?.onFilterChipClose(l)}),y.jsx(lt,{sx:{fontSize:"1rem",color:o.palette.primary.notifyTextColor},children:l?.filterLabel})]},c)}))})}),y.jsx(se,{component:lt,sx:{fontSize:"1.1rem",fontWeight:"500",textDecoration:"underline",color:o.palette.brandColor.red,cursor:"pointer"},onClick:n?.filterContainerProps?.onClearClick,children:n?.labels?.button||i("Clear")})]})})]})};v2.propTypes={breadcrumbProps:s.object.isRequired,switchProps:s.object};function x2({headerProps:e}){return y.jsx(rn,{children:y.jsx(v2,{...e})})}x2.propTypes={headerProps:s.object.isRequired};const gf=k.createContext(null),w2=k.createContext(null);function S2({children:e}){const[t,n]=k.useReducer(EN,ON);return y.jsx(gf.Provider,{value:t,children:y.jsx(w2.Provider,{value:n,children:e})})}function EN(e,t){switch(t.type){case je.LOADING:return{...e,loading:t.loading};case je.SUCCESS:return{...e,data:t.data?.sort((n,r)=>new Date(r.createdAt)-new Date(n.createdAt))};case je.MARK_ALL_AS_READ:return{...e,isMarkAllAsRead:t.isMarkAllAsRead};case je.SET_ACTIVE_TAB:return{...e,activeTab:t.activeTab};case je.SET_MODE:return{...e,mode:t.mode};case je.ERROR:return{...e,error:t.error};default:throw new Error(`${cr.UNHANDLED}: ${t}`)}}const ON={loading:!1,data:[],error:"",isMarkAllAsRead:{count:0,boo:!1},mode:!1,activeTab:0},{TENANT_ID:yf,BU_ID:bf}=Jv,{TENANT_IDS:vf,BU_IDS:xf}=e2,PN=async e=>{try{const t=localStorage.getItem("i18nextLng"),n=`${e}${Ol.NOTIFICATION}/v1?${yf}=${vf}&${bf}=${xf}&lang=${t}`;return await ft.get(n,Ti)}catch(t){return t}},C2=async(e,t,n)=>{try{const r=localStorage.getItem("i18nextLng"),o=`${e}${Ol.NOTIFICATION}${sf.VERSION}?${yf}=${vf}&${bf}=${xf}&lang=${r}`;return await ft.put(o,t,Ti)}catch(r){return r}},MN=async({baseUrl:e,id:t,snopId:n})=>{try{const r=localStorage.getItem("i18nextLng"),o=`${e}${Ol.NOTIFICATION}${sf.VERSION}?${yf}=${vf}&${bf}=${xf}&id=${t}&lang=${r}`;return await ft.get(o,Ti)}catch(r){return r}},es={OK:200,CREATED:201,NO_CONTENT:204,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,INTERNAL_SERVER_ERROR:500},T2=({baseUrl:e})=>{const t=k.useContext(w2),[n,r]=k.useState(!1),[o,i]=k.useState(!1),[a,l]=k.useState(!1),[c,u]=k.useState({}),[d,f]=k.useState(null),[p,m]=k.useState(1),h=k.useRef(!1),{loading:g,data:b,isMarkAllAsRead:S,mode:E,activeTab:w}=k.useContext(gf),[x,v]=k.useState([]);k.useEffect(()=>{v(b)},[b]);const C=k.useCallback(async()=>{if(!(h.current||!e))try{t({type:je.LOADING,loading:!0}),t({type:je.SUCCESS,data:[]});const j=await PN(e);if(j.status===es.UNAUTHORIZED){h.current=!0;return}if(j.status===es.OK){const I=j.data?.responseData?.response||[],B=gl(I);t({type:je.SET_MODE,mode:!1}),t({type:je.SUCCESS,data:gl(B)}),t({type:je.MARK_ALL_AS_READ,isMarkAllAsRead:{count:nv(I),boo:nv(I)>0}}),t({type:je.LOADING,loading:!1})}}catch(j){j?.response?.status===es.UNAUTHORIZED&&(h.current=!0),t({type:je.ERROR,error:cr.SWR}),t({type:je.LOADING,loading:!1})}},[e,t]),O=j=>{const I=(b||[]).filter(B=>E?!B.isRead:!0);return{0:I,1:I.filter(B=>B?.type==="INFO"),2:I.filter(B=>B?.type==="ERROR")}};k.useEffect(()=>{C();const j=setInterval(C,3e5);return()=>clearInterval(j)},[C]);const M=async(j,I)=>{if(!(!j||!e)){f(j);try{const B=await MN({baseUrl:e,id:j,snopId:I});if(B.status===es.OK){const L=B.data?.responseData?.response||{};u(L||{}),l(!0)}else throw new Error}catch{t({type:je.ERROR,error:cr.SWR})}finally{f(null)}}},D=async(j,I)=>{if(!(!j.length||!e)){t({type:je.LOADING,loading:!0});try{if((await C2(e,j,I)).status===es.OK){const L=b.map(Y=>j.includes(Y.id)?{...Y,isRead:!0}:Y),W=L.filter(Y=>!Y.isRead).length;W===0&&t({type:je.SET_MODE,mode:!1}),t({type:je.SUCCESS,data:gl(L)}),t({type:je.MARK_ALL_AS_READ,isMarkAllAsRead:{count:W,boo:W>0}}),setTimeout(()=>{t({type:je.LOADING,loading:!1})},200)}}catch{t({type:je.ERROR,error:cr.SWR}),t({type:je.LOADING,loading:!1})}}},A=async()=>{if(e){t({type:je.LOADING,loading:!0});try{const j=VI(b);if((await C2(e,j,H4.MARK_ALL_READ)).status===es.OK){const B=b.map(L=>({...L,isRead:!0}));t({type:je.SET_MODE,mode:!1}),t({type:je.SUCCESS,data:gl(B)}),t({type:je.MARK_ALL_AS_READ,isMarkAllAsRead:{count:0,boo:!1}}),setTimeout(()=>{t({type:je.LOADING,loading:!1})},200)}}catch{t({type:je.ERROR,error:cr.SWR}),t({type:je.LOADING,loading:!1})}}},$=(j,I)=>{t({type:je.LOADING,loading:!0}),t({type:je.SET_ACTIVE_TAB,activeTab:I}),setTimeout(()=>{t({type:je.LOADING,loading:!1})},400)},T=()=>{t({type:je.LOADING,loading:!0});const j=E?b||[]:(x||[]).filter(I=>!I.isRead);t({type:je.SET_MODE,mode:!E}),v(j),m(1),setTimeout(()=>{t({type:je.LOADING,loading:!1})},400)};return{fetchNotification:C,showDetailsProps:{open:a,handleClose:()=>l(!1),setOpen:l,data:c,clickId:d},alertDialogProps:{open:n,handleClose:()=>r(!1),onRefresh:C,handleRead:D,handleMarkAllAsRead:A,setOpen:r,handleShowDetails:M,clickId:d,isMainDialog:!0},activeTab:w,loading:g,tabData:O()[w],data:x,mode:E,handleTabChange:$,toggleAlertMode:T,page:p,setPage:m,isMarkAllAsRead:S}};var k2,E2,O2;function wf(){return wf=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},wf.apply(null,arguments)}var DN=function(t){return P.createElement("svg",wf({xmlns:"http://www.w3.org/2000/svg",width:16,height:17,fill:"none"},t),k2||(k2=P.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"})),E2||(E2=P.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"})),O2||(O2=P.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 RN=({count:e})=>(it(),y.jsxs(y.Fragment,{children:[y.jsx(se,{sx:{gap:"0.5rem",display:"flex",justifyContent:"center",alignItems:"center","& svg":{transform:"scale(1)"}},children:y.jsx(DN,{style:{scale:1.2}})}),y.jsx(iN,{badgeContent:e!=0?"":null,color:"error"})]}));function P2({children:e,handleClose:t,open:n,isMainDialog:r}){return y.jsx(Gc,{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 M2;function Sf(){return Sf=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},Sf.apply(null,arguments)}var AN=function(t){return P.createElement("svg",Sf({xmlns:"http://www.w3.org/2000/svg",width:14,height:9,fill:"none",viewBox:"0 0 13 9"},t),M2||(M2=P.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"})))},D2,R2;function Cf(){return Cf=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},Cf.apply(null,arguments)}var jN=function(t){return P.createElement("svg",Cf({xmlns:"http://www.w3.org/2000/svg",width:12,height:12,fill:"none"},t),D2||(D2=P.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"})),R2||(R2=P.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"})))},A2;function Tf(){return Tf=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},Tf.apply(null,arguments)}var IN=function(t){return P.createElement("svg",Tf({xmlns:"http://www.w3.org/2000/svg",width:9,height:8,fill:"none"},t),A2||(A2=P.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 j2=({type:e,item:t,handleShowDetails:n,handleRead:r,handleCTAClicked:o,clickId:i,t:a})=>{const l=it(),c=JSON.parse(localStorage.getItem("settings"))?.platform?.theme;return y.jsxs(se,{className:"cards",sx:{pt:" 0.8rem"},children:[y.jsx(He,{display:"flex",flexDirection:"row",alignItems:"start",justifyContent:"space-between",gap:1,children:y.jsx(Vc,{sx:{width:"calc(100% - 2%)","& .MuiBadge-badge":{backgroundColor:"#6041EA",height:"0.5rem",minWidth:"0.5rem"}},variant:"dot",invisible:t?.isRead,children:y.jsx(Dr,{sx:{color:l.palette.primary.notifyActiveText,whiteSpace:"normal",wordBreak:"break-word"},component:"p",className:["title-card",t?.isRead&&"read"].join(" "),children:a(t?.message)})})}),y.jsx(He,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:y.jsxs(He,{display:"flex",flexDirection:"row",justifyContent:"start",gap:1,sx:{p:"0.5rem 0"},children:[t?.isNotificationDetails&&y.jsx(Rl,{icon:y.jsx(jN,{className:`${c==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:n,label:i===t?.id?y.jsx(vo,{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?.isRead&&y.jsx(Rl,{icon:y.jsx(IN,{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?.primaryCTAURL&&y.jsx(Rl,{disabled:t?.isPrimaryCTAClicked,onClick:()=>o({redirect:t?.isPrimaryCTARedirect,isClicked:t?.isPrimaryCTAClicked,url:t?.primaryCTAURL}),label:a(t?.primaryCTALabel),component:"button",variant:"outlined",clickable:!0,size:"small"}),t?.secondaryCTAURL&&y.jsx(Rl,{disabled:t?.isSecondaryCTAClicked,onClick:()=>o({redirect:t?.isSecondaryCTARedirect,isClicked:t?.isSecondaryCTAClicked,url:t?.secondaryCTAURL}),label:a(t?.secondaryCTALabel),component:"button",variant:"outlined",clickable:!0,size:"small"})]})}),y.jsxs(He,{display:"flex",flexDirection:"row",alignItems:"center",gap:.35,children:[y.jsx(Dr,{sx:{fontSize:"0.8rem"},children:a(t?.product)}),y.jsx(Dr,{color:l.palette.primary.notifyTextColor,children:"•"}),y.jsx(Dr,{sx:{fontSize:"0.8rem"},children:WI(t?.createdAt,a)})]})]})};j2.propTypes={type:s.string,title:s.string,subTitle:s.string,isRead:s.bool,handleShowDetails:s.func,handleRead:s.func};const Al=60,I2=2,N2=({data:e,handleRead:t,handleShowDetails:n,clickId:r,mode:o,t:i})=>{const{isMarkAllAsRead:a}=k.useContext(gf),l=k.useRef(null),[c,u]=k.useState({start:0,end:4}),d=e?.length,f=new Date,p=new Intl.DateTimeFormat("en-US",{day:"numeric",month:"long",year:"numeric"}).format(f),m=k.useMemo(()=>o?a?.count?e?.filter(x=>!x.isRead):[]:e||[],[e,o,a]),h=m.slice(c.start,c.end),g=c.start*Al,b=(d-c.end)*Al,S=()=>{const x=l.current;if(!x)return;const v=x.scrollTop,C=x.clientHeight,O=Math.floor(v/Al)-I2,M=Math.ceil(C/Al)+2*I2,D=Math.max(0,Math.min(d-1,O)),A=Math.max(D,Math.min(d,D+M));u($=>$.start===D&&$.end===A?$:{start:D,end:A})},E=({url:x})=>{window.open(x,"_blank")},w=k.useMemo(()=>UI(h),[h]);return k.useEffect(()=>{let x;const v=()=>{x&&cancelAnimationFrame(x),x=requestAnimationFrame(()=>{S()})},C=l.current;if(C)return S(),C.addEventListener("scroll",v),()=>{cancelAnimationFrame(x),C.removeEventListener("scroll",v)}},[d]),m.length||i("CONTAINER_MESSAGE"),y.jsxs(se,{ref:l,sx:{height:"100%",overflowY:"auto"},children:[y.jsx(se,{style:{height:g}}),Object.entries(w).map(([x,v])=>{const C=localStorage.getItem("i18nextLng"),O=new Date(x),M=new Intl.DateTimeFormat(C,{month:"long"}).format(O),D=O.getDate(),A=O.getFullYear(),$=`${M} ${D}, ${A}`;return y.jsxs(k.Fragment,{children:[x!==p&&y.jsx(sN,{children:$}),v.map((T,j)=>y.jsx(j2,{item:T,handleCTAClicked:E,handleShowDetails:()=>n(T.id,T.snopId),handleRead:()=>t([T.id],T.snopId),clickId:r,t:i},`${T.id}_${j}`))]},x)}),y.jsx(se,{style:{height:b}})]})};N2.propTypes={data:s.array,handleRead:s.func,handleShowDetails:s.func};const NN=({onRefresh:e,handleShowDetails:t,clickId:n,handleRead:r,handleMarkAllAsRead:o,t:i})=>{const{loading:a,activeTab:l,data:c,tabData:u,mode:d,page:f,setPage:p,handleTabChange:m,toggleAlertMode:h}=T2({});return y.jsxs(y.Fragment,{children:[y.jsxs(se,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,pt:2},children:[y.jsx(lt,{variant:"h2",sx:{fontSize:"1.2rem",color:g=>g.palette.primary.notifyTextColor},children:i("NOTIFICATION")}),y.jsx(se,{onClick:e,children:y.jsx(Gt,{url:ze.Refresh,alt:"refresh",sx:{cursor:"pointer"}})})]}),y.jsx(se,{sx:{borderBottom:1,m:"1.2rem 1.2rem 0 1.2rem",borderColor:g=>g.palette.primary.notifyBorderColor},children:y.jsxs(aN,{value:l,onChange:m,children:[y.jsx(cf,{label:y.jsx(se,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:y.jsx(lt,{component:"span",sx:{fontWeight:500,fontSize:"1rem"},children:i("ALL",{count:c?.filter(g=>!g?.isRead)?.length||0})})})}),y.jsx(cf,{label:y.jsx(se,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:y.jsx(lt,{component:"span",sx:{fontWeight:500,fontSize:"1rem"},children:i("INFO",{count:c?.filter(g=>g?.type==="INFO"&&!g?.isRead)?.length||0})})}),sx:{color:g=>g.palette.brandColor.blue}}),y.jsx(cf,{label:y.jsx(se,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:i("ERROR",{count:c?.filter(g=>g?.type==="ERROR"&&!g?.isRead)?.length||0})}),sx:{color:g=>g.palette.brandColor.red}})]})}),y.jsx(Xc,{dividers:!0,sx:{p:0,...a&&!u.length&&{alignItems:"center",justifyContent:"center"},flexGrow:1,overflowY:"auto",mx:"1.2rem",borderColor:g=>g.palette.primary.notifyBorderColor},tabIndex:-1,children:a&&!u.length?y.jsx(se,{sx:{height:300,display:"flex",justifyContent:"center",alignItems:"center"},children:y.jsx(vo,{size:30,sx:{color:g=>g.palette.primary.notifyIconColor}})}):y.jsx(y.Fragment,{children:y.jsx(N2,{data:u,handleShowDetails:t,handleRead:r,clickId:n,page:f,setPage:p,mode:d,t:i})})}),y.jsxs(Kc,{sx:{justifyContent:"space-between",px:"1.2rem"},children:[y.jsxs(He,{direction:"row",gap:1,children:[y.jsx(Dr,{sx:{fontSize:"1rem"},children:i("SHOW_UNREAD")}),y.jsx(oN,{disabled:a,checked:d,onChange:h})]}),y.jsx(Na,{variant:"outlined",className:"view-all",onClick:o,startIcon:y.jsx(AN,{}),disabled:!c?.filter(g=>!g?.isRead)?.length,style:{backgroundColor:"transparent"},sx:{fontSize:"1rem",fontWeight:"300",p:0,border:"none",textTransform:"none",color:g=>g.palette.primary.notifyTextColor,"&:hover":{color:g=>g.palette.primary.notifyActiveText,background:"transparent",boxShadow:"none",border:"none"},"&.Mui-disabled":{opacity:.5,color:g=>`${g.palette.primary.notifyActiveText}!important`,background:"transparent",boxShadow:"none",border:"none"}},children:i("READ_ALL")})]})]})},$N=({data:e,handleClose:t,t:n})=>{const[r,o]=k.useState(1),[i,a]=k.useState(10),[l,c]=k.useState(e?.notificationDetails?.length||0),[u,d]=k.useState("sku_name"),[f,p]=k.useState("asc"),[m,h]=k.useState([]),[g,b]=k.useState("");return k.useEffect(()=>{if((g||u)&&e?.notificationDetails?.length){const S=zI(e?.notificationDetails,V4,g);if(u){const E=HI(S,u,f);h(Ud(E,r,i)),c(E?.length||0);return}h(Ud(S,r,i)),c(S?.length||0);return}h(Ud(e?.notificationDetails,r,i)),c(e?.notificationDetails?.length)},[g,e,r,i,f,u]),y.jsxs(y.Fragment,{children:[y.jsxs(He,{direction:"row",justifyContent:"space-between",sx:{padding:"1.5rem 2rem",borderBottom:"0.1rem solid",borderColor:S=>S.palette.primary.notifyBorderColor},children:[y.jsx(lt,{component:"h2",sx:{fontSize:"1.4rem",color:S=>S.palette.primary.notifyActiveText},children:n(e?.message)||e?.message}),y.jsx(se,{onClick:t,sx:{cursor:"pointer"},children:y.jsx(Gt,{url:ze.CloseCircle})})]}),y.jsx(Xc,{children:y.jsx(mf,{t:n,tableProps:{data:m,columns:{...rN({t:n}),isManageable:!1},sort:{sortField:u,sortDir:f,onSort:S=>{const E=S?.column?.key;p(w=>u===E&&w==="asc"?"desc":"asc"),d(E)}},pagination:{selectedPage:r,rowPerPage:i,totalRecords:l,onPageChange:S=>{o(S)},onPageSizeChange:S=>{a(S?.value),o(1)}}},toolbarProps:{defaultTools:{search:{isRequired:!0,onChange:S=>{const E=S.target.value;E&&o(1),b(E)},placeholder:`${n("SEARCH")}...`}}}})}),y.jsx(Kc,{sx:{padding:"1.5rem 2rem"}})]})},BN=({baseUrl:e,t})=>{const{alertDialogProps:n,showDetailsProps:r,fetchNotification:o,isMarkAllAsRead:i}=T2({baseUrl:e});return y.jsxs(y.Fragment,{children:[y.jsx(se,{sx:{display:"flex",justifyContent:"center",cursor:"pointer",marginTop:"0.6rem"},onClick:()=>{o(),n?.setOpen?.(!0)},children:y.jsx(RN,{count:i.count})}),y.jsx(P2,{...n,children:y.jsx(NN,{...n,t})}),y.jsx(P2,{...r,children:y.jsx($N,{...r,t})})]})},LN=({baseUrl:e,t})=>y.jsx(rn,{children:y.jsx(S2,{children:y.jsx(BN,{baseUrl:e,t})})}),_N=({rightChild:e,leftChild:t,isDrawerMerged:n,isDrawerOpen:r,drawerTitle:o,showExpand:i,onCloseClick:a,onMergeClick:l,onExpandClick:c,isDrawerExpanded:u,styles:d,showMerge:f,isCloseVisible:p=!0})=>{const m=it();return y.jsx(se,{sx:{position:"relative",overflow:"hidden"},children:y.jsxs(Vs,{container:!0,sx:{height:"100%"},children:[y.jsx(Vs,{item:!0,sx:{width:n?d?.drawerWidth?`calc(${"100%"-d?.drawerWidth})`:"75%":"100%",position:"relative",zIndex:3,height:"calc(100vh - 7rem)",p:"0rem 1.5rem",overflow:"auto"},children:t}),r&&!n&&y.jsx(y.Fragment,{children:y.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&&y.jsxs(Vs,{item:!0,sx:{width:u?"90%":d?.drawerWidth||"25%",position:n?"relative":"absolute",top:0,right:0,height:"calc(100vh - 7rem)",backgroundColor:m.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 ${m.palette.primary.notifyBorderColor}`,display:"flex",flexDirection:"column"},children:[y.jsxs(He,{direction:"row",alignItems:"center",sx:{width:"100%",flexShrink:0,paddingBottom:"0.8rem",px:2,pt:"0.8rem",borderBottom:h=>`0.1rem solid ${h.palette.primary.notifyBorderColor}`},children:[!u&&f&&y.jsxs(y.Fragment,{children:[y.jsx(se,{component:"img",src:ze.Merge,sx:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer"},onClick:l}),y.jsx(Mo,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"auto!important",borderColor:m.palette.primary.notifyBorderColor}})]}),y.jsxs(He,{direction:"row",justifyContent:"space-between",alignItems:"center",flexGrow:1,children:[y.jsxs(He,{direction:"row",gap:"0.5rem",alignItems:"center",sx:{cursor:"pointer"},children:[p&&y.jsx(se,{onClick:a,children:y.jsx(Gt,{url:ze.CrossLight})}),y.jsx(lt,{sx:{fontSize:"1.2rem",color:m.palette.primary.notifyTextColor},children:o})]}),y.jsx(He,{direction:"row",gap:"0.5rem",alignItems:"center",children:i&&y.jsx(se,{onClick:c,sx:{cursor:"pointer"},children:y.jsx(se,{component:"img",src:u?ze.Collapse:ze.Expand})})})]})]}),y.jsx(se,{sx:{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},overflow:"auto",px:2},children:e})]})]})})},$2=({layoutChildren:e,layoutProps:t})=>y.jsx(rn,{children:y.jsx(_N,{...e,...t})});$2.propTypes={layoutChildren:s.object.isRequired,layoutProps:s.object.isRequired};const B2=({parentProps:e,childProps:t})=>{const n=it();return y.jsxs(He,{sx:{background:n.palette.primary.notifyBackground,border:`0.1rem solid ${n.palette.primary.notifyBorderColor}`,borderRadius:"1rem",position:"relative",overflow:"hidden"},children:[y.jsx(He,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{maxHeight:"10rem",p:"1.5rem",cursor:"pointer",zIndex:4},onClick:t.toggleExpand,children:e.content}),y.jsx(zo.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:y.jsx(se,{sx:{p:"1rem"},children:t.content})})]})};B2.propTypes={parentProps:s.object.isRequired,childProps:s.object.isRequired};const L2=({accordionProps:e})=>y.jsx(rn,{children:y.jsx(S2,{children:y.jsx(B2,{...e})})});L2.propTypes={accordionProps:s.object.isRequired};const _2=k.createContext(null),FN=_2.Provider,WN=()=>{const e=k.useContext(_2);return e||console.warn("useAnalytics used outside AnalyticsProvider"),e};ut.Accordion=L2,ut.AnalyticsProvider=FN,ut.Button=sr,ut.Checkbox=dl,ut.DatePicker=e9,ut.Grid=mf,ut.Header=x2,ut.InputField=lv,ut.Loader=p9,ut.Notification=LN,ut.Select=cv,ut.SliderLayout=$2,ut.Switch=dv,ut.TextField=hl,ut.ToastProvider=l9,ut.TranslationContext=an,ut.toast=o9,ut.useAnalytics=WN,Object.defineProperty(ut,Symbol.toStringTag,{value:"Module"})}));
257
257
  //# sourceMappingURL=index.umd.js.map