@3sc/common-component 0.0.550 → 0.0.551
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-CT0MJah4.js → index-A4jLlGUH.js} +45 -31
- package/dist/{index-CT0MJah4.js.map → index-A4jLlGUH.js.map} +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/{nl-eokt00Ng.js → nl-BMbUSY91.js} +2 -2
- package/dist/{nl-eokt00Ng.js.map → nl-BMbUSY91.js.map} +1 -1
- package/dist/{tr-L0AFjdcW.js → tr-DacYx66j.js} +2 -2
- package/dist/{tr-L0AFjdcW.js.map → tr-DacYx66j.js.map} +1 -1
- package/package.json +1 -1
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-
|
|
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-A4jLlGUH.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[Av]=this[Av]={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 jv(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 Iv(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 g=d&&u-d;return g?Math.round(p*1e3/g):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)},Nv=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},$v=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 Bv(e,t,n){let r=!E4(t);return e&&(r||n==!1)?O4(e,t):t}const Lv=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(Lv(u),Lv(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 _v=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=Pv(Bv(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=_v(e);let i=o.data;const a=Xt.from(o.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:u}=o,d,f,p,g,m;function y(){g&&g(),m&&m(),o.cancelToken&&o.cancelToken.unsubscribe(d),o.signal&&o.signal.removeEventListener("abort",d)}let b=new XMLHttpRequest;b.open(o.method.toUpperCase(),o.url,!0),b.timeout=o.timeout;function 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};Iv(function(O){n(O),y()},function(O){r(O),y()},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||Dv;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,m]=Cl(u,!0),b.addEventListener("progress",p)),c&&b.upload&&([f,g]=Cl(c),b.upload.addEventListener("progress",f),b.upload.addEventListener("loadend",g)),(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 k=w4(o.url);if(k&&$t.protocols.indexOf(k)===-1){r(new Le("Unsupported protocol "+k+":",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()}},Fv=(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})},Wv=64*1024,{isFunction:Tl}=H,j4=(({Request:e,Response:t})=>({Request:e,Response:t}))(H.global),{ReadableStream:Vv,TextEncoder:zv}=H.global,Hv=(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(Vv),c=o&&(typeof zv=="function"?(m=>y=>m.encode(y))(new zv):async m=>new Uint8Array(await new n(m).arrayBuffer())),u=i&&l&&Hv(()=>{let m=!1;const y=new n($t.origin,{body:new Vv,method:"POST",get duplex(){return m=!0,"half"}}).headers.has("Content-Type");return m&&!y}),d=a&&l&&Hv(()=>H.isReadableStream(new r("").body)),f={stream:d&&(m=>m.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!f[m]&&(f[m]=(y,b)=>{let S=y&&y[m];if(S)return S.call(y);throw new Le(`Response type '${m}' is not supported`,Le.ERR_NOT_SUPPORT,b)})});const p=async m=>{if(m==null)return 0;if(H.isBlob(m))return m.size;if(H.isSpecCompliantForm(m))return(await new n($t.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(H.isArrayBufferView(m)||H.isArrayBuffer(m))return m.byteLength;if(H.isURLSearchParams(m)&&(m=m+""),H.isString(m))return(await c(m)).byteLength},g=async(m,y)=>{const b=H.toFiniteNumber(m.getContentLength());return b??p(y)};return async m=>{let{url:y,method:b,data:S,signal:k,cancelToken:w,timeout:x,onDownloadProgress:v,onUploadProgress:C,responseType:O,headers:M,withCredentials:D="same-origin",fetchOptions:A}=_v(m),$=t||fetch;O=O?(O+"").toLowerCase():"text";let T=M4([k,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 g(M,S))!==0){let R=new n(y,{method:"POST",body:S,duplex:"half"}),V;if(H.isFormData(S)&&(V=R.headers.get("content-type"))&&M.setContentType(V),R.body){const[q,Z]=Nv(B,Cl($v(C)));S=Fv(R.body,Wv,q,Z)}}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(y,W);let Y=await(i?$(j,A):$(y,W));const U=d&&(O==="stream"||O==="response");if(d&&(v||U&&I)){const R={};["status","statusText","headers"].forEach(ne=>{R[ne]=Y[ne]});const V=H.toFiniteNumber(Y.headers.get("content-length")),[q,Z]=v&&Nv(V,Cl($v(v),!0))||[];Y=new r(Fv(Y.body,Wv,q,()=>{Z&&Z(),I&&I()}),R)}O=O||"text";let F=await f[H.findKey(f,O)||"text"](Y,m);return!U&&I&&I(),await new Promise((R,V)=>{Iv(R,V,{data:F,headers:Xt.from(Y.headers),status:Y.status,statusText:Y.statusText,config:m,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,m,j),{cause:L.cause||L}):Le.from(L,L&&L.code,m,j)}}},N4=new Map,Uv=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};Uv();const nf={http:r4,xhr:P4,fetch:{get:Uv}};H.forEach(nf,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Yv=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(Yv).join(`
|
|
255
255
|
`):" "+Yv(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 qv={getAdapter:B4,adapters:nf};function rf(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Qo(null,e)}function Gv(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),qv.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 jv(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 Kv="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 Xv={};kl.transitional=function(t,n,r){function o(i,a){return"[Axios v"+Kv+"] 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&&!Xv[a]&&(Xv[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 Mv,response:new Mv}}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"],m=>{delete i[m]}),n.headers=Xt.concat(a,i);const l=[];let c=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(c=c&&y.synchronous,l.unshift(y.fulfilled,y.rejected))});const u=[];this.interceptors.response.forEach(function(y){u.push(y.fulfilled,y.rejected)});let d,f=0,p;if(!c){const m=[Gv.bind(this),void 0];for(m.unshift(...l),m.push(...u),p=m.length,d=Promise.resolve(n);f<p;)d=d.then(m[f++],m[f++]);return d}p=l.length;let g=n;for(;f<p;){const m=l[f++],y=l[f++];try{g=m(g)}catch(b){y.call(this,b);break}}try{d=Gv.call(this,g)}catch(m){return Promise.reject(m)}for(f=0,p=u.length;f<p;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=Qr(this.defaults,t);const n=Bv(t.baseURL,t.url,t.allowAbsoluteUrls);return Pv(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 Zv(e){const t=new eo(e),n=pv(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 Zv(Qr(e,o))},n}const ft=Zv(Si);ft.Axios=eo,ft.CanceledError=Qo,ft.CancelToken=_4,ft.isCancel=jv,ft.VERSION=Kv,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=>Rv(H.isHTMLForm(e)?new FormData(e):e),ft.getAdapter=qv.getAdapter,ft.HttpStatusCode=of,ft.default=ft;const{Axios:U$,AxiosError:Y$,CanceledError:q$,isCancel:G$,CancelToken:K$,VERSION:X$,all:Z$,Cancel:J$,isAxiosError:Q$,spread:e8,toFormData:t8,AxiosHeaders:n8,HttpStatusCode:r8,formToJSON:o8,getAdapter:s8,mergeConfig:i8}=ft,sf={BASE_URL:"https://qa.3sc.ai/api",VERSION:"/v1"},Ti={headers:{"Content-Type":"application/json"},withCredentials:!0},Jv=ft.create({baseURL:sf.BASE_URL,axiosConfig:Ti});Jv.interceptors.request.use(function(e){return e},function(e){return Promise.reject(e)}),Jv.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"},Qv={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})),e2={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 t2={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}=Qv,{TENANT_IDS:Q4,BU_IDS:eN}=t2,Ml=async({baseUrl:e,payload:t})=>{console.log("setting api",e,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),g=JSON.parse(localStorage.getItem(ur.SETTINGS));let m=p.reduce((w,x)=>w?.[x],g)||null;const y=dr(m?.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=>!y[C.key]),v=m&&m?.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=m?.columns?.map(O=>O?.children&&!O.children[i]?{...O,children:{...O.children,[i]:C?.[O?.key]?.children[i]}}:O)}(async()=>{try{const O={...g||{platform:{theme:"light"}}},M=m?.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=(m?.columns&&nN(y,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=y[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)},n2=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}},r2=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]=E.useState(!1),[g,m]=E.useState(0),[y,b]=E.useState(0),[S,k]=E.useState(0),[w,x]=E.useState(null),v=E.useRef(null),C=E.useCallback(T=>{if(!t&&(x(i),a&&a(),p(!0),m(T),b(0),v.current)){const j=v.current.previousSibling;j&&b(j.clientWidth)}},[t,i,a]),O=E.useCallback(()=>{t||(f&&l&&w===i&&l(S),p(!1),x(null))},[t,l,w,i,S,f]),M=E.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=g-j;let W=y-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"),k(W)},[t,f,g,y,n,r]);E.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]),E.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=E.useCallback(()=>{document.addEventListener("mousemove",M),document.addEventListener("mouseup",O),document.addEventListener("touchmove",M),document.addEventListener("touchend",O)},[M,O]),A=E.useCallback(()=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",O),document.removeEventListener("touchmove",M),document.removeEventListener("touchend",O)},[M,O]);E.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)"),E.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 h.jsx(h.Fragment,{children:e?h.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})}):h.jsx(h.Fragment,{children:i?h.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:h.jsx(se,{sx:{maxWidth:"auto",whiteSpace:"normal"},children:h.jsx(lt,{sx:{fontSize:"1.1rem",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none"},children:o})})}):h.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},te(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=te(lt)(({theme:e})=>({color:e.palette.primary.notifyTextColor,fontSize:"1.1rem"})),oN=te(t0)(({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=te(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=te(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"}}));te(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=te(m0)(({theme:e})=>({minHeight:"2rem","& .MuiTabs-indicator":{height:"0.1rem",backgroundColor:e.palette.primary.notifyActiveText}})),cf=te(n0)(({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=te(sm)(({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=te(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 h.jsx(lN,{...t,children:e})}to.propTypes={children:s.node};const cN=te(l0)(()=>({"&:last-child td":{borderBottom:"none"}}));function Rr({children:e,...t}){return h.jsx(cN,{...t,children:e})}Rr.propTypes={children:s.node};const o2=E.memo(({row:e,isSelected:t,isHigh:n,onRowClick:r,children:o})=>h.jsx(Rr,{sx:i=>({backgroundColor:t||n?i.palette.primary.appBackground:i.palette.primary.notifyBackground}),onClick:()=>r?.(e),children:o},e?.fhi)),s2=E.memo(({nestedData:e,nestedColumn:t,t:n})=>e?.length?h.jsx(h.Fragment,{children:e.map((r,o)=>h.jsx(Rr,{children:t.map((i,a)=>h.jsx(to,{style:i?.style,children:h.jsx(Dl,{isRenderCellContent:!!i?.cellRenderer,column:i,row:r})},a))},`nested-${o}`))}):h.jsx(Rr,{children:h.jsx(to,{colSpan:t.length,children:h.jsx(Dr,{sx:{textAlign:"center"},children:n(cr.NRF)})})})),i2=(e,t,n,r,o,i)=>{const[a,l]=E.useState({isOpen:!1,column:null}),c=(p,g,m)=>{l({isOpen:p.currentTarget,column:g,isChild:!!m})},u=()=>{l({isOpen:!1,column:null,isChild:!1})},d=async()=>{u();const p=e.map(g=>{if(a?.isChild&&Array.isArray(g.children)){const m=g.children.map(b=>b.key===a.column?.key?{...b,isHidden:!0}:b),y=m.every(b=>b.isHidden);return{...g,isHidden:y?!0:g.isHidden,children:m}}return g.key===a.column?.key?{...g,isHidden:!0}:g});f({updatedColumns:p})},f=async({updatedColumns:p})=>{t({type:je.SET_GRID_DATA,payload:{visibleGridColumns:p}});const g=r.split("/").filter(Boolean),m=JSON.parse(localStorage.getItem(ur.SETTINGS));let y=g.reduce((C,O)=>C?.[O],m)||null,b=ki({columns:p,childUniqueKey:i});const S=dr(y?.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={...m||{platform:{theme:"light"}}},x=y?.pageSize??o;let v=w;for(let C=0;C<g.length;C++){const O=g[C];C===g.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=>h.jsx(sr,{...i,styles:{...i.styles,iconPrimary:i?.styles?.variant=="filled"}}),select:i=>h.jsx(se,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"},width:i.styles?.width},children:h.jsx(uv,{...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)}},a2=({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(g,m)=>{if(!m)return;const y=m.split("/").filter(Boolean),b="settings",k={...JSON.parse(localStorage.getItem(b))||{}};let w=k;for(let x=0;x<y.length;x++){const v=y[x];x===y.length-1?w[v]={...w[v]||{},pageSize:g}:(w[v]={...w[v]||{}},w=w[v])}localStorage.setItem(b,JSON.stringify(k)),await Ml({baseUrl:n,payload:k})},f=a===0?0:(o-1)*i+1,p=Math.min(o*i,a);return h.jsxs(se,{sx:{display:"flex",p:"1rem 1.5rem"},children:[h.jsxs(se,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"0.5rem",width:"100%"},children:[h.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})}),h.jsx(se,{sx:{"& .MuiInputBase-input":{padding:"0rem 0.8rem!important"},width:"6rem"},children:h.jsx(Xo,{options:U4,value:i,onChange:async g=>{c(g),d(g?.value,t)}})})]}),h.jsx(Km,{count:Math.ceil(a/i),page:o,onChange:async(g,m)=>{l(m)},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}=E.useContext(an);return h.jsx(Ys,{open:!!e,anchorEl:e,onClose:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:h.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:h.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 l2=({sortKey:e,sortField:t,sortDir:n,handleSortClick:r})=>{const o=i=>h.jsx(xa,{onClick:r,sx:{padding:"0.2rem"},draggable:!1,children:h.jsx(Gt,{url:i})});return h.jsx(h.Fragment,{children:o(t===e?n==="asc"?ze.AscSort:ze.DescSort:ze.Unsort)})};l2.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 h.jsxs(se,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},draggable:!1,children:[h.jsx(se,{sx:{fontWeight:"bold",fontSize:"1.1rem",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"0.5rem",textAlign:"center"},children:h.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??""})}),h.jsxs(se,{sx:{display:"flex",alignItems:"center"},draggable:!1,children:[c&&h.jsx(l2,{sortKey:e?`${e?.key}|${t?.key}`:t?.key,sortField:u,sortDir:d,handleSortClick:()=>f({column:t,sortDir:d,sortField:u,parent:e})}),i&&h.jsx(xa,{draggable:!1,onClick:p=>r(p,t,e),sx:{padding:"0.2rem"},children:h.jsx(Gt,{url:ze.Menu})})]})]})}ff.propTypes={column:s.object.isRequired,sort:s.object.isRequired,handleMenuClick:s.func,isManageable:s.bool};function c2({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}=E.useContext(yi),g=E.useContext(Ko),{selectedColumn:m,handleMenuClick:y,handleClose:b,handleHideClick:S,columnUpdaterFunction:k}=i2(p,g,a,l,r?.rowPerPage,c),w=o?.isManageable,x=o?.isResizable,v=n?.length>0,C=E.useRef(null),O=E.useRef(null),M=45,D=10,A=n?.length,[$,T]=E.useState({start:0,end:10}),[j,I]=E.useState(null),[B,L]=E.useState(null),[W,Y]=E.useState(null);let U=null;const F=E.useRef(0),R=E.useRef(!1),V=E.useRef(null),q=n2(i?.column?.definitions||[]),Z=i?.isNested,ne=i?.data||[],G=i?.hashKey,[J,ie]=E.useState(0);E.useEffect(()=>{if(C.current){const K=()=>{ie(C.current.offsetHeight)};return K(),window.addEventListener("resize",K),()=>window.removeEventListener("resize",K)}},[n]),E.useEffect(()=>{const re=C.current?.querySelector("thead");if(!re)return;const ge=()=>{Y(null)};return re?.addEventListener("mousedown",ge),()=>{re?.removeEventListener("mousedown",ge)}},[]);const ae=(K,re)=>{if(R.current){K.preventDefault();return}I(re),Y(null),K.dataTransfer.setData("colIndex",re);const ge=p[re],be=ge?.label,fe=document.createElement("div");fe.textContent=be,Object.assign(fe.style,{display:"flex",alignItems:"center",justifyContent:"center",padding:"1.5rem 2.5rem",minWidth:ge?.style?.minWidth,maxWidth:ge?.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;K.dataTransfer.setDragImage(fe,Ae/2,Ne/2),requestAnimationFrame(()=>{document.body.removeChild(fe)})},_=(K,re)=>{K.preventDefault(),L(re),we(K)},z=async(K,re)=>{if(K.preventDefault(),clearInterval(U),j===null||j===re)return;const ge=[...p],[be]=ge.splice(j,1);ge.splice(re,0,be);const fe=p.slice().sort((Ne,Ue)=>Ne.sequenceId-Ue.sequenceId).map(Ne=>Ne.sequenceId),Ae=ge.map((Ne,Ue)=>({...Ne,sequenceId:fe[Ue]??Ne.sequenceId}));k({updatedColumns:Ae}),I(null),L(null)},N=()=>{I(null),L(null)},oe=(K,re,ge,be)=>{if(!K)return null;const fe=K?.isMandatory&&K?.isSticky,Ae=parseFloat(K?.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,ye=B==re||p?.[B]?.isMandatory,yt=Ye=>{K.isMandatory?(Ye.preventDefault(),Ye.dataTransfer.dropEffect="none"):(Ye.preventDefault(),Ye.dataTransfer.dropEffect="move"),_?.(Ye,re)},ct=Ye=>{K.isMandatory||z?.(Ye,re)};return be&&`${be?.key}${K?.key}${re}`,h.jsx(to,{rowSpan:K?.children?1:2,colSpan:K?.children?.filter(Ye=>!Ye?.isHidden)?.length,style:K?.style,draggable:ge&&!K?.isMandatory,onDragStart:ge&&!K?.isMandatory?Ye=>ae(Ye,re):Ye=>{Ye.preventDefault()},onDragOver:ge&&!K?.isMandatory?yt:void 0,onDrop:ge&&!K?.isMandatory?ct:void 0,onDragEnd:ge&&!K?.isMandatory?N:void 0,sx:{...K?.isSticky&&{boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...K.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...K?.key==="volume_value"&&{borderLeft:"1px solid"}},...Ue&&{border:`0.1rem solid ${f.palette.brandColor.lightBlue}!important`},...fe&&{position:"sticky",left:Ne,zIndex:3},cursor:ye?"not-allowed":ge&&!K?.isMandatory?"grab":"default"},children:h.jsx(ff,{parent:be,column:K,sort:t,handleMenuClick:y,isManageable:ge})},re)},ee=E.useCallback((K,re,ge,be)=>{if(!K)return null;const fe=K?.isMandatory&&K?.isSticky,Ae=parseFloat(K?.style?.minWidth?.toString().replace("rem",""))||7.5;ge===0&&(F.current=0);const Ne=fe?ge===0?0:`${F.current}rem`:void 0;return fe&&(F.current+=Ae),h.jsxs(to,{colSpan:1,style:K?.style,className:`${K?.label}`,sx:{position:"relative",...K.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...K?.key==="volume_value"&&{borderLeft:"1px solid"}},...K?.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)&&h.jsx(se,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none",zIndex:1}}),h.jsx(Dl,{isRenderCellContent:!!K?.cellRenderer,column:K,row:re,parent:be})]},ge)},[e?.selectedRow,f]),le=(K,re,ge,be)=>h.jsx(h.Fragment,{children:K&&ge&&!K?.isMandatory?h.jsx(se,{resizeStart:()=>{K?.isMandatory&&!K?.isResizable||(R.current=!0)},resizeEnd:fe=>{K?.isMandatory&&!K?.isResizable||fe<=20||(R.current=!1,a2({index:re,visibleGridColumns:p,width:fe,columnUpdaterFunction:k}))},component:K?.children||K?.isMandatory?Do:r2,rowSpan:K?.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},...!K?.isMandatory&&{"&:hover::after":{content:'""',position:"absolute",top:0,left:"50%",transform:"translateX(-50%)",width:"0.2rem",height:`${J}px`,backgroundColor:f.palette.primary.notifyBorderColor,zIndex:1}}}}):null}),Oe=E.useCallback((K,re,ge,be,fe,Ae,Ne)=>h.jsx(h.Fragment,{children:re&&be&&!re?.isMandatory?h.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===K?.fhi||K?.isHigh)&&h.jsx(se,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none"}})},`resize-${ge}_${Ne}`):null}),[e?.selectedRow,f]),we=K=>{const re=C.current,{left:ge,right:be}=re.getBoundingClientRect(),fe=50,Ae=K.clientX>be-fe?1:K.clientX<ge+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=K=>K?.map((re,ge)=>{const be=$.start+ge,fe=re[G],Ae=ne?.[fe],Ne=e?.selectedRow&&e?.selectedRow?.fhi===re?.fhi,Ue=re?.isHigh;return h.jsxs(E.Fragment,{children:[h.jsx(o2,{row:re,isSelected:Ne,isHigh:Ue,onRowClick:e?.onRowClick,children:p.map((ye,yt)=>ye?.isHidden||ye?.isVisible===!1?null:ye?.children?ye.children.map((ct,Ye)=>ct?.isHidden?null:h.jsxs(E.Fragment,{children:[ee(ct,re,Ye,ye),x&&Oe(re,ct,Ye,w,ye,"",be)]},`col-${yt}-${Ye}`)):h.jsxs(E.Fragment,{children:[ee(ye,re,yt),x&&Oe(re,ye,yt,w,"","",be)]},`col-${yt}`))}),Z&&Ae&&h.jsx(s2,{nestedData:Ae,nestedColumn:q,t:d})]},`row-${be}`)}),Re=()=>{const K=O.current;if(!K)return;const re=K.scrollTop,ge=K.clientHeight,be=Math.floor(re/M)-D,fe=Math.ceil(ge/M)+2*D,Ae=Math.max(0,Math.min(A-1,be)),Ne=Math.max(Ae,Math.min(A,Ae+fe));T(Ue=>Ue.start===Ae&&Ue.end===Ne?Ue:{start:Ae,end:Ne})};E.useEffect(()=>{let K;const re=()=>{K&&cancelAnimationFrame(K),K=requestAnimationFrame(()=>{Re()})},ge=O.current;if(!(!ge||!u))return Re(),ge.addEventListener("scroll",re),()=>{cancelAnimationFrame(K),ge.removeEventListener("scroll",re)}},[A]);const Fe=$.start*M,Pe=(A-$.end)*M,de=u?n?.slice($.start,$.end):n;return v?h.jsxs(h.Fragment,{children:[h.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:h.jsxs(iu,{ref:C,stickyHeader:!0,"aria-label":"sticky table",sx:{backgroundColor:K=>K.palette.primary.notifyBackground},children:[h.jsxs(uu,{children:[h.jsx(Rr,{sx:{position:"sticky",top:0,zIndex:3,backgroundColor:K=>K.palette.primary.notifyBackground},children:p.map((K,re)=>K?.isHidden||K?.isVisible===!1?null:h.jsxs(E.Fragment,{children:[oe(K,re,w),le(K,re,w)]},re))}),h.jsx(Rr,{draggable:!1,sx:{position:"sticky",top:"2.5rem",backgroundColor:f.palette.primary.notifyBackground,zIndex:2},children:p.flatMap((K,re)=>K?.isHidden||!K?.children||K?.isVisible===!1?[]:K.children.map((ge,be)=>ge?.isHidden?null:h.jsxs(E.Fragment,{children:[oe(ge,be,w,K),x&&le(ge,be,w)]},`${re}-${be}`)))})]}),h.jsxs(au,{children:[u&&h.jsx("tr",{style:{height:Fe}}),Ie(de),u&&h.jsx("tr",{style:{height:Pe}})]})]})}),r&&h.jsx(uf,{pagination:r,gridPath:l,baseUrl:a,t:d}),h.jsx(df,{menuOpen:m?.isOpen,handleClose:b,onHideClick:S})]}):h.jsx(Dr,{sx:{textAlign:"center"},children:d(cr.NRF)})}c2.propTypes={sort:s.object,data:s.array,pagination:s.object,columns:s.object,nested:s.object};function u2(e){return ov(e?.style?.width??e?.style?.minWidth??e?.style?.maxWidth)||0}const d2=e=>e?.isHidden||e?.isVisible===!1;function pN(e){const t=E.useMemo(()=>{let o=0;return e.flatMap((i,a)=>{if(d2(i))return[];if(Array.isArray(i.children)&&i.children.length){const u=i.children.filter(d=>!d2(d));return u.length?u.map(d=>{const f=u2(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=u2(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=E.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]=E.useState(null),[c,u]=E.useState(null),d=E.useCallback((b,S)=>{if(n.current){b.preventDefault();return}l(S),b.dataTransfer.setData("colIndex",S);const k=e[S],w=document.createElement("div");w.textContent=k?.label,Object.assign(w.style,{display:"flex",alignItems:"center",justifyContent:"center",padding:"1.5rem 2.5rem",minWidth:k?.style?.minWidth,maxWidth:k?.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=E.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=E.useCallback(async(b,S)=>{if(b.preventDefault(),o(),a===null||a===S||e?.[S]?.isMandatory)return;const k=[...e],[w]=k.splice(a,1);k.splice(S,0,w);const x=[...e].sort((C,O)=>C.sequenceId-O.sequenceId).map(C=>C.sequenceId),v=k.map((C,O)=>({...C,sequenceId:x[O]??C.sequenceId}));t({updatedColumns:v}),l(null),u(null)},[a,e,t,o]),g=E.useCallback(()=>{o(),l(null),u(null)},[o]),m=b=>!b?.isMandatory,y=E.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:g,isDraggable:m,isInvalidDrop:y}}const f2=50,mN=10,gN=50;function yN(e){const t=E.useRef(null),n=E.useCallback(()=>{t.current&&(clearInterval(t.current),t.current=null)},[]);return{startAutoScroll:E.useCallback(o=>{const i=e.current;if(!i)return;const{left:a,right:l}=i.getBoundingClientRect(),c=o>l-f2?1:o<a+f2?-1:0;if(c===0){n();return}t.current||(t.current=setInterval(()=>{i.scrollLeft+=c*mN},gN))},[e,n]),stopAutoScroll:n}}const pf=E.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:g,handleMenuClick:m}){const y=it(),b=l===n,S=r&&!t?.isMandatory,k=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 h.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 ${y.palette.brandColor.lightBlue}!important`},...k&&{position:"sticky",left:i,zIndex:3},cursor:c(n)?"not-allowed":S?"grab":"default"},children:h.jsx(ff,{parent:o,column:t,sort:g,handleMenuClick:m,isManageable:r})},n)}),hf=E.memo(function({column:t,index:n,isManageable:r,tableHeight:o,onResizeStart:i,onResizeEnd:a}){const l=it();return!t||!r||t?.isMandatory?null:h.jsx(se,{component:t?.children||t?.isMandatory?Do:r2,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=E.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:g,onDrop:m,onDragEnd:y,isResizingRef:b,columnUpdaterFunction:S,visibleGridColumns:k}){const w=it(),x={draggedColIndex:d,isInvalidDrop:f,onDragStart:p,onDragOver:g,onDrop:m,onDragEnd:y},v=(O,M)=>({onResizeStart:()=>{O?.isMandatory&&!O?.isResizable||(b.current=!0)},onResizeEnd:D=>{O?.isMandatory&&!O?.isResizable||D<=20||(b.current=!1,a2({index:M,visibleGridColumns:k,width:D,columnUpdaterFunction:S}))}}),C=E.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 h.jsxs(uu,{children:[h.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 h.jsxs(E.Fragment,{children:[h.jsx(pf,{column:D,index:O._originalIndex,isManageable:r,stickyLeft:c(O),sort:a,handleMenuClick:l,...x}),o&&h.jsx(hf,{column:D,index:O._originalIndex,isManageable:r,tableHeight:i,...v(D,O._originalIndex)})]},`sticky-p-${M}`)}),h.jsx("th",{style:{minWidth:u,width:u,padding:0,border:"none"}}),C.map((O,M)=>h.jsxs(E.Fragment,{children:[h.jsx(pf,{column:O.column,index:O.firstChild._originalIndex,colSpanOverride:O.colSpan,isManageable:r,stickyLeft:c(O.firstChild),sort:a,handleMenuClick:l,...x}),o&&h.jsx(hf,{column:O.column,index:O.firstChild._originalIndex,isManageable:r,tableHeight:i,...v(O.column,O.firstChild._originalIndex)})]},`parent-${O.key}`))]}),h.jsxs(Rr,{draggable:!1,sx:{position:"sticky",top:"2.5rem",backgroundColor:w.palette.primary.notifyBackground,zIndex:2},children:[h.jsx("th",{style:{minWidth:u,width:u,padding:0,border:"none"}}),n?.map((O,M)=>O._parent&&h.jsxs(E.Fragment,{children:[h.jsx(pf,{column:O,index:O._originalIndex,isManageable:r,parent:O._parent,stickyLeft:c(O),sort:a,handleMenuClick:l,...x}),o&&h.jsx(hf,{column:O,index:O._originalIndex,isManageable:r,tableHeight:i,...v(O,O._originalIndex)})]},`child-${O.sequenceId??M}`))]})]})}),vN=()=>h.jsx(se,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none",zIndex:1}}),p2=E.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 h.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&&h.jsx(vN,{}),h.jsx(Dl,{isRenderCellContent:!!t?.cellRenderer,column:t,row:n,parent:o})]},r)}),xN=E.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:g,offsetX:m,t:y}){const b=it(),S=E.useCallback((k,w,x)=>{if(!k||!i||k?.isMandatory)return null;const v=c&&c?.fhi===w?.fhi||w?.isHigh;return h.jsx(Do,{className:"column_resizer_body",sx:{width:"1rem",maxWidth:"1rem",minWidth:"1rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${b.palette.primary.notifyBorderColor}`},children:v&&h.jsx("div",{style:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none"}})},`resize-${x}`)},[i,c,b]);return h.jsxs(au,{children:[h.jsx("tr",{style:{height:a}}),t?.map((k,w)=>{const x=c&&c?.fhi===k?.fhi,v=k?.isHigh,C=d?.[k[p]];return h.jsxs(E.Fragment,{children:[h.jsxs(o2,{row:k,isSelected:x,isHigh:v,children:[n.map((O,M)=>h.jsxs(E.Fragment,{children:[h.jsx(p2,{column:O,row:k,cellKey:M,parent:O._parent,stickyLeft:g(O),isSelected:x,isHigh:v}),o&&S(O,k,`sticky-${M}-${w}`)]},`sticky-${O.sequenceId??M}`)),h.jsx("td",{style:{minWidth:m,width:m,padding:0,border:"none"}}),r.map((O,M)=>h.jsxs(E.Fragment,{children:[h.jsx(p2,{column:O,row:k,cellKey:M,parent:O._parent,stickyLeft:g(O),isSelected:x,isHigh:v}),o&&S(O,k,`${M}-${w}`)]},`col-${O?._parent?.key??O.key}-${M}`))]}),u&&C&&h.jsx(s2,{nestedData:C,nestedColumn:f,t:y})]},`row-${w}`)}),h.jsx("tr",{style:{height:l}})]})});function wN({rowCount:e,rowHeight:t,scrollTop:n,overscan:r=5}){const o=ov("40rem");return E.useMemo(()=>{const i=e*t,a=Math.max(0,Math.floor(n/t)-r),l=Math.ceil(o/t)+r*2,c=Math.min(e,a+l),u=a*t;return{totalHeight:i,startIndex:a,endIndex:c,offsetY:u}},[e,t,o,n,r])}function SN({columnWidths:e,containerRef:t,scrollLeft:n,overscan:r=2}){const o=E.useRef(0),[i,a]=E.useState(0);E.useEffect(()=>{const u=t.current;if(!u)return;const d=new ResizeObserver(f=>{const p=f[0].contentRect;p.width!==o.current&&(o.current=p.width,a(p.width))});return d.observe(u),()=>d.disconnect()},[e]);const l=E.useMemo(()=>e.map(u=>{const d=Number(u);return Number.isFinite(d)&&d>0?d:0}),[e]),c=E.useMemo(()=>{const u=new Array(l.length);let d=0;for(let f=0;f<l.length;f++)u[f]=d,d+=l[f];return u},[l]);return E.useMemo(()=>{const u=n+i;let d=0;for(let p=0;p<l.length;p++)if(c[p]+l[p]>n){d=Math.max(0,p-r);break}let f=d;for(;f<l.length&&c[f]<u;)f++;return f=Math.min(l.length,f+r),{startIndex:d,endIndex:f,offsetX:c[d]||0,viewportWidth:i,viewportWidthRef:o}},[l,c,i,n,r])}const mf=45;function CN({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}=E.useContext(yi),g=E.useContext(Ko),{selectedColumn:m,handleMenuClick:y,handleClose:b,handleHideClick:S,columnUpdaterFunction:k}=i2(p,g,a,l,r?.rowPerPage,c),w=o?.isManageable,x=o?.isResizable,v=E.useRef(null),C=E.useRef(null),O=E.useRef(!1),M=E.useRef(0),D=E.useRef(0),A=E.useRef(!1),[,$]=E.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:k,isResizingRef:O,startAutoScroll:I,stopAutoScroll:B}),V=K=>{const re=K.currentTarget.scrollTop,ge=K.currentTarget.scrollLeft;A.current||(A.current=!0,requestAnimationFrame(()=>{M.current=re,D.current=ge,$({}),A.current=!1}))},q=E.useMemo(()=>j.filter(K=>K.isSticky&&!K.isCenterTable),[j]),Z=E.useMemo(()=>j.filter(K=>K.isSticky&&K.isCenterTable||!K.isSticky),[j]),ne=E.useMemo(()=>Z.map(K=>K.width),[Z]),{startIndex:G,endIndex:J}=wN({rowCount:n.length,rowHeight:mf,scrollTop:M.current,overscan:15}),{startIndex:ie,endIndex:ae,offsetX:_,viewportWidth:z,viewportWidthRef:N}=SN({columnWidths:ne,containerRef:C,scrollLeft:D.current,overscan:2}),oe=E.useMemo(()=>Z.slice(ie,ae),[Z,ie,ae]),ee=G*mf,le=(n?.length-J)*mf,[Oe,we]=E.useState(0);E.useEffect(()=>{const K=v.current;if(!K)return;const re=new ResizeObserver(()=>we(K.offsetHeight));return re.observe(K),()=>re.disconnect()},[]);const Ie=n2(i?.column?.definitions||[]),Re=i?.isNested,Fe=i?.data||[],Pe=i?.hashKey,de=n?.slice(G,J);return n?.length?h.jsxs(h.Fragment,{children:[h.jsx(cu,{ref:C,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:h.jsxs(iu,{ref:v,stickyHeader:!0,"aria-label":"sticky table",sx:{backgroundColor:f.palette.primary.notifyBackground},children:[h.jsx(bN,{offsetX:_,stickyGridColumns:q,virtualisedColumns:oe,isManageable:w,isResizable:x,tableHeight:Oe,sort:t,handleMenuClick:y,getStickyLeft:T,draggedColIndex:L,isInvalidDrop:W,onDragStart:Y,onDragOver:U,onDrop:F,onDragEnd:R,isResizingRef:O,columnUpdaterFunction:k,visibleGridColumns:p}),h.jsx(xN,{offsetX:_,visibleRows:de,stickyGridColumns:q,virtualisedColumns:oe,isVirtualizedTable:u,isResizable:x,isManageable:w,topSpacerHeight:ee,bottomSpacerHeight:le,selectedRow:e?.selectedRow,isNested:Re,nestedRow:Fe,nestedColumn:Ie,hashKey:Pe,getStickyLeft:T,t:d})]})}),r&&h.jsx(uf,{pagination:r,gridPath:l,baseUrl:a,t:d}),h.jsx(df,{menuOpen:m?.isOpen,handleClose:b,onHideClick:S})]}):h.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=E.useContext(Ko),{t:l}=E.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 E.useEffect(()=>{u?.length&&e?.data?.length&&a?.({type:je.SET_GRID_DATA,payload:{visibleGridColumns:u}})},[u,e?.data]),h.jsx(h.Fragment,{children:c?h.jsx(CN,{...e,gridPath:n,baseUrl:r,childUniqueKey:o,t:l}):h.jsx(c2,{...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:h.jsxs(se,{sx:{borderRadius:2,overflow:"hidden"},children:[h.jsx(nr,{variant:"text",width:"100%",height:60,sx:r}),Array.from({length:10}).map((i,a)=>h.jsx(se,{sx:{display:"flex",alignItems:"center",padding:"0.5rem",gap:"3rem"},children:Array.from({length:5}).map((l,c)=>h.jsx(se,{sx:{flex:1},children:h.jsx(nr,{variant:"text",height:45,sx:r})},c))},a))]}),toolbar:h.jsx(h.Fragment,{children:h.jsxs(He,{direction:"row",justifyContent:"space-between",sx:{display:"flex",gap:"1rem"},children:[h.jsxs(He,{direction:"row",gap:"1rem",children:[h.jsx(nr,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),h.jsx(nr,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),h.jsx(nr,{variant:"text",width:"15.2rem",height:"5rem",sx:r})]}),h.jsxs(He,{direction:"row",gap:"1rem",children:[h.jsx(nr,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),h.jsx(nr,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),h.jsx(nr,{variant:"text",width:"3.5rem",height:"5rem",sx:r})]})]})})}[e]},TN=({customTools:e})=>{const t=e?.filter(r=>r?.type===e2.PRIMARY)?.sort((r,o)=>r.sequenceId-o.sequenceId),n=e?.filter(r=>r?.type===e2.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}=TN({customTools:e}),[i,a]=E.useState(r),l=o?.length>0,{t:c}=E.useContext(an),u=f=>{f?a([...r,...o]):setTimeout(()=>{a(r)},100)},d=()=>{const f=!t;n(f),u(f)};return E.useEffect(()=>{u(t)},[e]),h.jsxs(h.Fragment,{children:[t&&h.jsx("div",{style:{position:"fixed",left:0,width:"100vw",height:"4rem",zIndex:998}}),h.jsxs(se,{sx:{display:"flex",alignItems:"center",gap:"0.8rem",flexWrap:"nowrap",maxWidth:"100%",whiteSpace:"nowrap",zIndex:999},children:[h.jsx(fM,{mode:"popLayout",children:i.map((f,p)=>h.jsx(zo.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},layout:!0,children:h.jsx(se,{sx:{flexShrink:0,minWidth:"fit-content"},children:uN(f)})},`${f.id}_${p}`))}),l&&h.jsx(se,{sx:{paddingLeft:t?"0.5rem":0},children:h.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}=E.useContext(an),u=E.useContext(Ko),{visibleGridColumns:d,triggerApi:f}=E.useContext(yi),[p,g]=E.useState([]),[m,y]=E.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)||[];E.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;g(O)}},[d]);const k=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}})}};E.useEffect(()=>{f&&k(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 h.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:[h.jsxs(se,{sx:{display:"flex",flexDirection:"row",gap:"0.6rem",alignItems:"center"},children:[e?.search?.isRequired&&h.jsx(cv,{...e?.search,iconUrl:ze.Search}),e?.refresh?.isRequired&&h.jsx(sr,{...e?.refresh,styles:{variant:"filled",icon:ze.Refresh,colorType:"empty",width:"3.2rem",height:"3.2rem"}}),e?.groupBy?.isRequired&&h.jsx(se,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:h.jsx(Xo,{styles:{icon:ze.Group},...e.groupBy})}),t&&h.jsx(se,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:h.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)=>h.jsx(E.Fragment,{children:v.render()},v.id))]}),h.jsxs(se,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"0.6rem"},children:[S?.length>0&&S.map((v,C)=>h.jsx(E.Fragment,{children:v.render()},v.id)),n&&h.jsx(g2,{customTools:n,setIsExpanded:y,isExpanded:m}),e?.save?.isRequired&&h.jsx(se,{sx:{px:"0.5rem"},children:h.jsx(sr,{label:m?"":"Save",styles:{icon:ze.Save,colorType:"empty"},...e?.save})}),e?.upload?.isRequired&&h.jsx(sr,{...e?.upload,styles:{variant:m?"outlined":"filled",icon:m?ze.UploadDark:ze.Upload,iconPrimary:!m,colorType:"secondary",isAnimate:!0}}),e?.download?.isRequired&&h.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 gf({tableProps:e,toolbarProps:t,isDefaultConfig:n,isLoading:r}){const o=e.columns?.isManageable;return h.jsx(sv,{children:r?h.jsxs(h.Fragment,{children:[t&&h.jsx(m2,{type:"toolbar"}),e&&h.jsx(m2,{type:"grid"})]}):h.jsxs(se,{sx:{position:"sticky"},children:[t&&h.jsx(y2,{...t,isManageable:o,pageSize:e?.pagination?.rowPerPage,gridData:e?.data}),h.jsx(h2,{tableProps:e,isDefaultConfig:n,gridPath:t?.gridPath||"",baseUrl:t?.baseUrl||"",childUniqueKey:t?.childUniqueKey||""})]})})}gf.propTypes={tableProps:s.object.isRequired,toolbarProps:s.object,isDefaultConfig:s.bool};const b2=({list:e,handleLinkClick:t})=>{const n=it(),{t:r}=E.useContext(an),o=({list:i})=>i?.sort((a,l)=>a.order-l.order)?.map((a,l)=>a?.link?h.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):h.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 h.jsx(hm,{separator:h.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}=E.useContext(an),a=n?.filterBtnProps?.disabled;return h.jsxs(h.Fragment,{children:[h.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:[h.jsx(b2,{...e}),h.jsxs(He,{direction:"row",gap:"1rem",alignItems:"center",children:[r,t&&h.jsx(fv,{...t}),n?.filterBtnProps&&h.jsxs(He,{direction:"row",children:[h.jsx(Mo,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"2rem!important",opacity:"1!important",borderColor:o.palette.primary.notifyBorderColor}}),h.jsxs(He,{direction:"row",alignItems:"center",gap:"0.5rem",onClick:n?.filterBtnProps?.onFilterClick,sx:{opacity:a?.5:1,cursor:a?"not-allowed":"pointer"},children:[h.jsx(Gt,{url:ze.Filter}),h.jsx(lt,{sx:{fontSize:"1.1rem",color:o.palette.primary.notifyActiveText},children:i(n?.filterBtnProps?.label)})]})]})]})]}),h.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:h.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:[h.jsxs(lt,{sx:{fontSize:"1.2rem",fontWeight:"500",color:o.palette.primary.notifyActiveText},children:[n?.labels?.description||i("Filters")," :"]}),h.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:h.jsx(He,{direction:"row",gap:"1.2rem",sx:{overflow:"visible"},children:n?.filterItems?.map((l,c)=>h.jsx(h.Fragment,{children:h.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:[h.jsx(se,{component:"img",src:ze.FilterClose,sx:{position:"absolute",top:"-0.4rem",right:"-0.6rem",cursor:"pointer"},onClick:()=>n?.onFilterChipClose(l)}),h.jsx(lt,{sx:{fontSize:"1rem",color:o.palette.primary.notifyTextColor},children:l?.filterLabel})]},c)}))})}),h.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 h.jsx(rn,{children:h.jsx(v2,{...e})})}x2.propTypes={headerProps:s.object.isRequired};const yf=E.createContext(null),w2=E.createContext(null);function S2({children:e}){const[t,n]=E.useReducer(kN,EN);return h.jsx(yf.Provider,{value:t,children:h.jsx(w2.Provider,{value:n,children:e})})}function kN(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 EN={loading:!1,data:[],error:"",isMarkAllAsRead:{count:0,boo:!1},mode:!1,activeTab:0},{TENANT_ID:bf,BU_ID:vf}=Qv,{TENANT_IDS:xf,BU_IDS:wf}=t2,ON=async e=>{try{const t=localStorage.getItem("i18nextLng"),n=`${e}${Ol.NOTIFICATION}/v1?${bf}=${xf}&${vf}=${wf}&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}?${bf}=${xf}&${vf}=${wf}&lang=${r}`;return await ft.put(o,t,Ti)}catch(r){return r}},PN=async({baseUrl:e,id:t,snopId:n})=>{try{const r=localStorage.getItem("i18nextLng"),o=`${e}${Ol.NOTIFICATION}${sf.VERSION}?${bf}=${xf}&${vf}=${wf}&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=E.useContext(w2),[n,r]=E.useState(!1),[o,i]=E.useState(!1),[a,l]=E.useState(!1),[c,u]=E.useState({}),[d,f]=E.useState(null),[p,g]=E.useState(1),m=E.useRef(!1),{loading:y,data:b,isMarkAllAsRead:S,mode:k,activeTab:w}=E.useContext(yf),[x,v]=E.useState([]);E.useEffect(()=>{v(b)},[b]);const C=E.useCallback(async()=>{if(!(m.current||!e))try{t({type:je.LOADING,loading:!0}),t({type:je.SUCCESS,data:[]});const j=await ON(e);if(j.status===es.UNAUTHORIZED){m.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:rv(I),boo:rv(I)>0}}),t({type:je.LOADING,loading:!1})}}catch(j){j?.response?.status===es.UNAUTHORIZED&&(m.current=!0),t({type:je.ERROR,error:cr.SWR}),t({type:je.LOADING,loading:!1})}},[e,t]),O=j=>{const I=(b||[]).filter(B=>k?!B.isRead:!0);return{0:I,1:I.filter(B=>B?.type==="INFO"),2:I.filter(B=>B?.type==="ERROR")}};E.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 PN({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=k?b||[]:(x||[]).filter(I=>!I.isRead);t({type:je.SET_MODE,mode:!k}),v(j),g(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:y,tabData:O()[w],data:x,mode:k,handleTabChange:$,toggleAlertMode:T,page:p,setPage:g,isMarkAllAsRead:S}};var k2,E2,O2;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 MN=function(t){return P.createElement("svg",Sf({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 DN=({count:e})=>(it(),h.jsxs(h.Fragment,{children:[h.jsx(se,{sx:{gap:"0.5rem",display:"flex",justifyContent:"center",alignItems:"center","& svg":{transform:"scale(1)"}},children:h.jsx(MN,{style:{scale:1.2}})}),h.jsx(iN,{badgeContent:e!=0?"":null,color:"error"})]}));function P2({children:e,handleClose:t,open:n,isMainDialog:r}){return h.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 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 RN=function(t){return P.createElement("svg",Cf({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 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 AN=function(t){return P.createElement("svg",Tf({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 kf(){return kf=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},kf.apply(null,arguments)}var jN=function(t){return P.createElement("svg",kf({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 h.jsxs(se,{className:"cards",sx:{pt:" 0.8rem"},children:[h.jsx(He,{display:"flex",flexDirection:"row",alignItems:"start",justifyContent:"space-between",gap:1,children:h.jsx(Vc,{sx:{width:"calc(100% - 2%)","& .MuiBadge-badge":{backgroundColor:"#6041EA",height:"0.5rem",minWidth:"0.5rem"}},variant:"dot",invisible:t?.isRead,children:h.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)})})}),h.jsx(He,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:h.jsxs(He,{display:"flex",flexDirection:"row",justifyContent:"start",gap:1,sx:{p:"0.5rem 0"},children:[t?.isNotificationDetails&&h.jsx(Rl,{icon:h.jsx(AN,{className:`${c==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:n,label:i===t?.id?h.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&&h.jsx(Rl,{icon:h.jsx(jN,{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&&h.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&&h.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"})]})}),h.jsxs(He,{display:"flex",flexDirection:"row",alignItems:"center",gap:.35,children:[h.jsx(Dr,{sx:{fontSize:"0.8rem"},children:a(t?.product)}),h.jsx(Dr,{color:l.palette.primary.notifyTextColor,children:"•"}),h.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}=E.useContext(yf),l=E.useRef(null),[c,u]=E.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),g=E.useMemo(()=>o?a?.count?e?.filter(x=>!x.isRead):[]:e||[],[e,o,a]),m=g.slice(c.start,c.end),y=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})},k=({url:x})=>{window.open(x,"_blank")},w=E.useMemo(()=>UI(m),[m]);return E.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]),g.length||i("CONTAINER_MESSAGE"),h.jsxs(se,{ref:l,sx:{height:"100%",overflowY:"auto"},children:[h.jsx(se,{style:{height:y}}),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 h.jsxs(E.Fragment,{children:[x!==p&&h.jsx(sN,{children:$}),v.map((T,j)=>h.jsx(j2,{item:T,handleCTAClicked:k,handleShowDetails:()=>n(T.id,T.snopId),handleRead:()=>t([T.id],T.snopId),clickId:r,t:i},`${T.id}_${j}`))]},x)}),h.jsx(se,{style:{height:b}})]})};N2.propTypes={data:s.array,handleRead:s.func,handleShowDetails:s.func};const IN=({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:g,toggleAlertMode:m}=T2({});return h.jsxs(h.Fragment,{children:[h.jsxs(se,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,pt:2},children:[h.jsx(lt,{variant:"h2",sx:{fontSize:"1.2rem",color:y=>y.palette.primary.notifyTextColor},children:i("NOTIFICATION")}),h.jsx(se,{onClick:e,children:h.jsx(Gt,{url:ze.Refresh,alt:"refresh",sx:{cursor:"pointer"}})})]}),h.jsx(se,{sx:{borderBottom:1,m:"1.2rem 1.2rem 0 1.2rem",borderColor:y=>y.palette.primary.notifyBorderColor},children:h.jsxs(aN,{value:l,onChange:g,children:[h.jsx(cf,{label:h.jsx(se,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:h.jsx(lt,{component:"span",sx:{fontWeight:500,fontSize:"1rem"},children:i("ALL",{count:c?.filter(y=>!y?.isRead)?.length||0})})})}),h.jsx(cf,{label:h.jsx(se,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:h.jsx(lt,{component:"span",sx:{fontWeight:500,fontSize:"1rem"},children:i("INFO",{count:c?.filter(y=>y?.type==="INFO"&&!y?.isRead)?.length||0})})}),sx:{color:y=>y.palette.brandColor.blue}}),h.jsx(cf,{label:h.jsx(se,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:i("ERROR",{count:c?.filter(y=>y?.type==="ERROR"&&!y?.isRead)?.length||0})}),sx:{color:y=>y.palette.brandColor.red}})]})}),h.jsx(Xc,{dividers:!0,sx:{p:0,...a&&!u.length&&{alignItems:"center",justifyContent:"center"},flexGrow:1,overflowY:"auto",mx:"1.2rem",borderColor:y=>y.palette.primary.notifyBorderColor},tabIndex:-1,children:a&&!u.length?h.jsx(se,{sx:{height:300,display:"flex",justifyContent:"center",alignItems:"center"},children:h.jsx(vo,{size:30,sx:{color:y=>y.palette.primary.notifyIconColor}})}):h.jsx(h.Fragment,{children:h.jsx(N2,{data:u,handleShowDetails:t,handleRead:r,clickId:n,page:f,setPage:p,mode:d,t:i})})}),h.jsxs(Kc,{sx:{justifyContent:"space-between",px:"1.2rem"},children:[h.jsxs(He,{direction:"row",gap:1,children:[h.jsx(Dr,{sx:{fontSize:"1rem"},children:i("SHOW_UNREAD")}),h.jsx(oN,{disabled:a,checked:d,onChange:m})]}),h.jsx(Na,{variant:"outlined",className:"view-all",onClick:o,startIcon:h.jsx(RN,{}),disabled:!c?.filter(y=>!y?.isRead)?.length,style:{backgroundColor:"transparent"},sx:{fontSize:"1rem",fontWeight:"300",p:0,border:"none",textTransform:"none",color:y=>y.palette.primary.notifyTextColor,"&:hover":{color:y=>y.palette.primary.notifyActiveText,background:"transparent",boxShadow:"none",border:"none"},"&.Mui-disabled":{opacity:.5,color:y=>`${y.palette.primary.notifyActiveText}!important`,background:"transparent",boxShadow:"none",border:"none"}},children:i("READ_ALL")})]})]})},NN=({data:e,handleClose:t,t:n})=>{const[r,o]=E.useState(1),[i,a]=E.useState(10),[l,c]=E.useState(e?.notificationDetails?.length||0),[u,d]=E.useState("sku_name"),[f,p]=E.useState("asc"),[g,m]=E.useState([]),[y,b]=E.useState("");return E.useEffect(()=>{if((y||u)&&e?.notificationDetails?.length){const S=zI(e?.notificationDetails,V4,y);if(u){const k=HI(S,u,f);m(Ud(k,r,i)),c(k?.length||0);return}m(Ud(S,r,i)),c(S?.length||0);return}m(Ud(e?.notificationDetails,r,i)),c(e?.notificationDetails?.length)},[y,e,r,i,f,u]),h.jsxs(h.Fragment,{children:[h.jsxs(He,{direction:"row",justifyContent:"space-between",sx:{padding:"1.5rem 2rem",borderBottom:"0.1rem solid",borderColor:S=>S.palette.primary.notifyBorderColor},children:[h.jsx(lt,{component:"h2",sx:{fontSize:"1.4rem",color:S=>S.palette.primary.notifyActiveText},children:n(e?.message)||e?.message}),h.jsx(se,{onClick:t,sx:{cursor:"pointer"},children:h.jsx(Gt,{url:ze.CloseCircle})})]}),h.jsx(Xc,{children:h.jsx(gf,{t:n,tableProps:{data:g,columns:{...rN({t:n}),isManageable:!1},sort:{sortField:u,sortDir:f,onSort:S=>{const k=S?.column?.key;p(w=>u===k&&w==="asc"?"desc":"asc"),d(k)}},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 k=S.target.value;k&&o(1),b(k)},placeholder:`${n("SEARCH")}...`}}}})}),h.jsx(Kc,{sx:{padding:"1.5rem 2rem"}})]})},$N=({baseUrl:e,t})=>{const{alertDialogProps:n,showDetailsProps:r,fetchNotification:o,isMarkAllAsRead:i}=T2({baseUrl:e});return h.jsxs(h.Fragment,{children:[h.jsx(se,{sx:{display:"flex",justifyContent:"center",cursor:"pointer",marginTop:"0.6rem"},onClick:()=>{o(),n?.setOpen?.(!0)},children:h.jsx(DN,{count:i.count})}),h.jsx(P2,{...n,children:h.jsx(IN,{...n,t})}),h.jsx(P2,{...r,children:h.jsx(NN,{...r,t})})]})},BN=({baseUrl:e,t})=>h.jsx(rn,{children:h.jsx(S2,{children:h.jsx($N,{baseUrl:e,t})})}),LN=({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 g=it();return h.jsx(se,{sx:{position:"relative",overflow:"hidden"},children:h.jsxs(Vs,{container:!0,sx:{height:"100%"},children:[h.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&&h.jsx(h.Fragment,{children:h.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&&h.jsxs(Vs,{item:!0,sx:{width:u?"90%":d?.drawerWidth||"25%",position:n?"relative":"absolute",top:0,right:0,height:"calc(100vh - 7rem)",backgroundColor:g.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 ${g.palette.primary.notifyBorderColor}`,display:"flex",flexDirection:"column"},children:[h.jsxs(He,{direction:"row",alignItems:"center",sx:{width:"100%",flexShrink:0,paddingBottom:"0.8rem",px:2,pt:"0.8rem",borderBottom:m=>`0.1rem solid ${m.palette.primary.notifyBorderColor}`},children:[!u&&f&&h.jsxs(h.Fragment,{children:[h.jsx(se,{component:"img",src:ze.Merge,sx:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer"},onClick:l}),h.jsx(Mo,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"auto!important",borderColor:g.palette.primary.notifyBorderColor}})]}),h.jsxs(He,{direction:"row",justifyContent:"space-between",alignItems:"center",flexGrow:1,children:[h.jsxs(He,{direction:"row",gap:"0.5rem",alignItems:"center",sx:{cursor:"pointer"},children:[p&&h.jsx(se,{onClick:a,children:h.jsx(Gt,{url:ze.CrossLight})}),h.jsx(lt,{sx:{fontSize:"1.2rem",color:g.palette.primary.notifyTextColor},children:o})]}),h.jsx(He,{direction:"row",gap:"0.5rem",alignItems:"center",children:i&&h.jsx(se,{onClick:c,sx:{cursor:"pointer"},children:h.jsx(se,{component:"img",src:u?ze.Collapse:ze.Expand})})})]})]}),h.jsx(se,{sx:{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},overflow:"auto",px:2},children:e})]})]})})},$2=({layoutChildren:e,layoutProps:t})=>h.jsx(rn,{children:h.jsx(LN,{...e,...t})});$2.propTypes={layoutChildren:s.object.isRequired,layoutProps:s.object.isRequired};const B2=({parentProps:e,childProps:t})=>{const n=it();return h.jsxs(He,{sx:{background:n.palette.primary.notifyBackground,border:`0.1rem solid ${n.palette.primary.notifyBorderColor}`,borderRadius:"1rem",position:"relative",overflow:"hidden"},children:[h.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}),h.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:h.jsx(se,{sx:{p:"1rem"},children:t.content})})]})};B2.propTypes={parentProps:s.object.isRequired,childProps:s.object.isRequired};const L2=({accordionProps:e})=>h.jsx(rn,{children:h.jsx(S2,{children:h.jsx(B2,{...e})})});L2.propTypes={accordionProps:s.object.isRequired};const _2=E.createContext(null),_N=_2.Provider,FN=()=>{const e=E.useContext(_2);return e||console.warn("useAnalytics used outside AnalyticsProvider"),e};ut.Accordion=L2,ut.AnalyticsProvider=_N,ut.Button=sr,ut.Checkbox=dl,ut.DatePicker=e9,ut.Grid=gf,ut.Header=x2,ut.InputField=cv,ut.Loader=p9,ut.Notification=BN,ut.Select=uv,ut.SliderLayout=$2,ut.Switch=fv,ut.TextField=hl,ut.ToastProvider=l9,ut.TranslationContext=an,ut.toast=o9,ut.useAnalytics=FN,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"],m=>{delete i[m]}),n.headers=Xt.concat(a,i);const l=[];let c=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(c=c&&y.synchronous,l.unshift(y.fulfilled,y.rejected))});const u=[];this.interceptors.response.forEach(function(y){u.push(y.fulfilled,y.rejected)});let d,f=0,p;if(!c){const m=[Gv.bind(this),void 0];for(m.unshift(...l),m.push(...u),p=m.length,d=Promise.resolve(n);f<p;)d=d.then(m[f++],m[f++]);return d}p=l.length;let g=n;for(;f<p;){const m=l[f++],y=l[f++];try{g=m(g)}catch(b){y.call(this,b);break}}try{d=Gv.call(this,g)}catch(m){return Promise.reject(m)}for(f=0,p=u.length;f<p;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=Qr(this.defaults,t);const n=Bv(t.baseURL,t.url,t.allowAbsoluteUrls);return Pv(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 Zv(e){const t=new eo(e),n=pv(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 Zv(Qr(e,o))},n}const ft=Zv(Si);ft.Axios=eo,ft.CanceledError=Qo,ft.CancelToken=_4,ft.isCancel=jv,ft.VERSION=Kv,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=>Rv(H.isHTMLForm(e)?new FormData(e):e),ft.getAdapter=qv.getAdapter,ft.HttpStatusCode=of,ft.default=ft;const{Axios:U$,AxiosError:Y$,CanceledError:q$,isCancel:G$,CancelToken:K$,VERSION:X$,all:Z$,Cancel:J$,isAxiosError:Q$,spread:e8,toFormData:t8,AxiosHeaders:n8,HttpStatusCode:r8,formToJSON:o8,getAdapter:s8,mergeConfig:i8}=ft,sf={BASE_URL:"https://qa.3sc.ai/api",VERSION:"/v1"},Ti={headers:{"Content-Type":"application/json"},withCredentials:!0},Jv=ft.create({baseURL:sf.BASE_URL,axiosConfig:Ti});Jv.interceptors.request.use(function(e){return e},function(e){return Promise.reject(e)}),Jv.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"},Qv={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})),e2={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 t2={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}=Qv,{TENANT_IDS:Q4,BU_IDS:eN}=t2,Ml=async({baseUrl:e,payload:t})=>{console.log("setting api",e,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),g=JSON.parse(localStorage.getItem(ur.SETTINGS));let m=p.reduce((w,x)=>w?.[x],g)||null;const y=dr(m?.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=>!y[C.key]),v=m&&m?.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=m?.columns?.map(O=>O?.children&&!O.children[i]?{...O,children:{...O.children,[i]:C?.[O?.key]?.children[i]}}:O)}(async()=>{try{const O={...g||{platform:{theme:"light"}}},M=m?.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=(m?.columns&&nN(y,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=y[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)},n2=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}},r2=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]=E.useState(!1),[g,m]=E.useState(0),[y,b]=E.useState(0),[S,k]=E.useState(0),[w,x]=E.useState(null),v=E.useRef(null),C=E.useCallback(T=>{if(!t&&(x(i),a&&a(),p(!0),m(T),b(0),v.current)){const j=v.current.previousSibling;j&&b(j.clientWidth)}},[t,i,a]),O=E.useCallback(()=>{t||(f&&l&&w===i&&l(S),p(!1),x(null))},[t,l,w,i,S,f]),M=E.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=g-j;let W=y-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"),k(W)},[t,f,g,y,n,r]);E.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]),E.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=E.useCallback(()=>{document.addEventListener("mousemove",M),document.addEventListener("mouseup",O),document.addEventListener("touchmove",M),document.addEventListener("touchend",O)},[M,O]),A=E.useCallback(()=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",O),document.removeEventListener("touchmove",M),document.removeEventListener("touchend",O)},[M,O]);E.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)"),E.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 h.jsx(h.Fragment,{children:e?h.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})}):h.jsx(h.Fragment,{children:i?h.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:h.jsx(se,{sx:{maxWidth:"auto",whiteSpace:"normal"},children:h.jsx(lt,{sx:{fontSize:"1.1rem",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none"},children:o})})}):h.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},te(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=te(lt)(({theme:e})=>({color:e.palette.primary.notifyTextColor,fontSize:"1.1rem"})),oN=te(t0)(({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=te(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=te(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"}}));te(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=te(m0)(({theme:e})=>({minHeight:"2rem","& .MuiTabs-indicator":{height:"0.1rem",backgroundColor:e.palette.primary.notifyActiveText}})),cf=te(n0)(({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=te(sm)(({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=te(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 h.jsx(lN,{...t,children:e})}to.propTypes={children:s.node};const cN=te(l0)(()=>({"&:last-child td":{borderBottom:"none"}}));function Rr({children:e,...t}){return h.jsx(cN,{...t,children:e})}Rr.propTypes={children:s.node};const o2=E.memo(({row:e,isSelected:t,isHigh:n,onRowClick:r,children:o})=>h.jsx(Rr,{sx:i=>({backgroundColor:t||n?i.palette.primary.appBackground:i.palette.primary.notifyBackground}),onClick:()=>r?.(e),children:o},e?.fhi)),s2=E.memo(({nestedData:e,nestedColumn:t,t:n})=>e?.length?h.jsx(h.Fragment,{children:e.map((r,o)=>h.jsx(Rr,{children:t.map((i,a)=>h.jsx(to,{style:i?.style,children:h.jsx(Dl,{isRenderCellContent:!!i?.cellRenderer,column:i,row:r})},a))},`nested-${o}`))}):h.jsx(Rr,{children:h.jsx(to,{colSpan:t.length,children:h.jsx(Dr,{sx:{textAlign:"center"},children:n(cr.NRF)})})})),i2=(e,t,n,r,o,i)=>{const[a,l]=E.useState({isOpen:!1,column:null}),c=(p,g,m)=>{l({isOpen:p.currentTarget,column:g,isChild:!!m})},u=()=>{l({isOpen:!1,column:null,isChild:!1})},d=async()=>{u();const p=e.map(g=>{if(a?.isChild&&Array.isArray(g.children)){const m=g.children.map(b=>b.key===a.column?.key?{...b,isHidden:!0}:b),y=m.every(b=>b.isHidden);return{...g,isHidden:y?!0:g.isHidden,children:m}}return g.key===a.column?.key?{...g,isHidden:!0}:g});f({updatedColumns:p})},f=async({updatedColumns:p})=>{t({type:je.SET_GRID_DATA,payload:{visibleGridColumns:p}});const g=r.split("/").filter(Boolean),m=JSON.parse(localStorage.getItem(ur.SETTINGS));let y=g.reduce((C,O)=>C?.[O],m)||null,b=ki({columns:p,childUniqueKey:i});const S=dr(y?.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={...m||{platform:{theme:"light"}}},x=y?.pageSize??o;let v=w;for(let C=0;C<g.length;C++){const O=g[C];C===g.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=>h.jsx(sr,{...i,styles:{...i.styles,iconPrimary:i?.styles?.variant=="filled"}}),select:i=>h.jsx(se,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"},width:i.styles?.width},children:h.jsx(uv,{...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)}},a2=({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(g,m)=>{if(!m)return;const y=m.split("/").filter(Boolean),b="settings",k={...JSON.parse(localStorage.getItem(b))||{}};let w=k;for(let x=0;x<y.length;x++){const v=y[x];x===y.length-1?w[v]={...w[v]||{},pageSize:g}:(w[v]={...w[v]||{}},w=w[v])}localStorage.setItem(b,JSON.stringify(k)),await Ml({baseUrl:n,payload:k})},f=a===0?0:(o-1)*i+1,p=Math.min(o*i,a);return h.jsxs(se,{sx:{display:"flex",p:"1rem 1.5rem"},children:[h.jsxs(se,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"0.5rem",width:"100%"},children:[h.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})}),h.jsx(se,{sx:{"& .MuiInputBase-input":{padding:"0rem 0.8rem!important"},width:"6rem"},children:h.jsx(Xo,{options:U4,value:i,onChange:async g=>{c(g),d(g?.value,t)}})})]}),h.jsx(Km,{count:Math.ceil(a/i),page:o,onChange:async(g,m)=>{l(m)},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}=E.useContext(an);return h.jsx(Ys,{open:!!e,anchorEl:e,onClose:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:h.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:h.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 l2=({sortKey:e,sortField:t,sortDir:n,handleSortClick:r})=>{const o=i=>h.jsx(xa,{onClick:r,sx:{padding:"0.2rem"},draggable:!1,children:h.jsx(Gt,{url:i})});return h.jsx(h.Fragment,{children:o(t===e?n==="asc"?ze.AscSort:ze.DescSort:ze.Unsort)})};l2.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 h.jsxs(se,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},draggable:!1,children:[h.jsx(se,{sx:{fontWeight:"bold",fontSize:"1.1rem",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"0.5rem",textAlign:"center"},children:h.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??""})}),h.jsxs(se,{sx:{display:"flex",alignItems:"center"},draggable:!1,children:[c&&h.jsx(l2,{sortKey:e?`${e?.key}|${t?.key}`:t?.key,sortField:u,sortDir:d,handleSortClick:()=>f({column:t,sortDir:d,sortField:u,parent:e})}),i&&h.jsx(xa,{draggable:!1,onClick:p=>r(p,t,e),sx:{padding:"0.2rem"},children:h.jsx(Gt,{url:ze.Menu})})]})]})}ff.propTypes={column:s.object.isRequired,sort:s.object.isRequired,handleMenuClick:s.func,isManageable:s.bool};function c2({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}=E.useContext(yi),g=E.useContext(Ko),{selectedColumn:m,handleMenuClick:y,handleClose:b,handleHideClick:S,columnUpdaterFunction:k}=i2(p,g,a,l,r?.rowPerPage,c),w=o?.isManageable,x=o?.isResizable,v=n?.length>0,C=E.useRef(null),O=E.useRef(null),M=45,D=10,A=n?.length,[$,T]=E.useState({start:0,end:10}),[j,I]=E.useState(null),[B,L]=E.useState(null),[W,Y]=E.useState(null);let U=null;const F=E.useRef(0),R=E.useRef(!1),V=E.useRef(null),q=n2(i?.column?.definitions||[]),Z=i?.isNested,ne=i?.data||[],G=i?.hashKey,[J,ie]=E.useState(0);E.useEffect(()=>{if(C.current){const K=()=>{ie(C.current.offsetHeight)};return K(),window.addEventListener("resize",K),()=>window.removeEventListener("resize",K)}},[n]),E.useEffect(()=>{const re=C.current?.querySelector("thead");if(!re)return;const ge=()=>{Y(null)};return re?.addEventListener("mousedown",ge),()=>{re?.removeEventListener("mousedown",ge)}},[]);const ae=(K,re)=>{if(R.current){K.preventDefault();return}I(re),Y(null),K.dataTransfer.setData("colIndex",re);const ge=p[re],be=ge?.label,fe=document.createElement("div");fe.textContent=be,Object.assign(fe.style,{display:"flex",alignItems:"center",justifyContent:"center",padding:"1.5rem 2.5rem",minWidth:ge?.style?.minWidth,maxWidth:ge?.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;K.dataTransfer.setDragImage(fe,Ae/2,Ne/2),requestAnimationFrame(()=>{document.body.removeChild(fe)})},_=(K,re)=>{K.preventDefault(),L(re),we(K)},z=async(K,re)=>{if(K.preventDefault(),clearInterval(U),j===null||j===re)return;const ge=[...p],[be]=ge.splice(j,1);ge.splice(re,0,be);const fe=p.slice().sort((Ne,Ue)=>Ne.sequenceId-Ue.sequenceId).map(Ne=>Ne.sequenceId),Ae=ge.map((Ne,Ue)=>({...Ne,sequenceId:fe[Ue]??Ne.sequenceId}));k({updatedColumns:Ae}),I(null),L(null)},N=()=>{I(null),L(null)},oe=(K,re,ge,be)=>{if(!K)return null;const fe=K?.isMandatory&&K?.isSticky,Ae=parseFloat(K?.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,ye=B==re||p?.[B]?.isMandatory,yt=Ye=>{K.isMandatory?(Ye.preventDefault(),Ye.dataTransfer.dropEffect="none"):(Ye.preventDefault(),Ye.dataTransfer.dropEffect="move"),_?.(Ye,re)},ct=Ye=>{K.isMandatory||z?.(Ye,re)};return be&&`${be?.key}${K?.key}${re}`,h.jsx(to,{rowSpan:K?.children?1:2,colSpan:K?.children?.filter(Ye=>!Ye?.isHidden)?.length,style:K?.style,draggable:ge&&!K?.isMandatory,onDragStart:ge&&!K?.isMandatory?Ye=>ae(Ye,re):Ye=>{Ye.preventDefault()},onDragOver:ge&&!K?.isMandatory?yt:void 0,onDrop:ge&&!K?.isMandatory?ct:void 0,onDragEnd:ge&&!K?.isMandatory?N:void 0,sx:{...K?.isSticky&&{boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...K.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...K?.key==="volume_value"&&{borderLeft:"1px solid"}},...Ue&&{border:`0.1rem solid ${f.palette.brandColor.lightBlue}!important`},...fe&&{position:"sticky",left:Ne,zIndex:3},cursor:ye?"not-allowed":ge&&!K?.isMandatory?"grab":"default"},children:h.jsx(ff,{parent:be,column:K,sort:t,handleMenuClick:y,isManageable:ge})},re)},ee=E.useCallback((K,re,ge,be)=>{if(!K)return null;const fe=K?.isMandatory&&K?.isSticky,Ae=parseFloat(K?.style?.minWidth?.toString().replace("rem",""))||7.5;ge===0&&(F.current=0);const Ne=fe?ge===0?0:`${F.current}rem`:void 0;return fe&&(F.current+=Ae),h.jsxs(to,{colSpan:1,style:K?.style,className:`${K?.label}`,sx:{position:"relative",...K.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...K?.key==="volume_value"&&{borderLeft:"1px solid"}},...K?.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)&&h.jsx(se,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none",zIndex:1}}),h.jsx(Dl,{isRenderCellContent:!!K?.cellRenderer,column:K,row:re,parent:be})]},ge)},[e?.selectedRow,f]),le=(K,re,ge,be)=>h.jsx(h.Fragment,{children:K&&ge&&!K?.isMandatory?h.jsx(se,{resizeStart:()=>{K?.isMandatory&&!K?.isResizable||(R.current=!0)},resizeEnd:fe=>{K?.isMandatory&&!K?.isResizable||fe<=20||(R.current=!1,a2({index:re,visibleGridColumns:p,width:fe,columnUpdaterFunction:k}))},component:K?.children||K?.isMandatory?Do:r2,rowSpan:K?.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},...!K?.isMandatory&&{"&:hover::after":{content:'""',position:"absolute",top:0,left:"50%",transform:"translateX(-50%)",width:"0.2rem",height:`${J}px`,backgroundColor:f.palette.primary.notifyBorderColor,zIndex:1}}}}):null}),Oe=E.useCallback((K,re,ge,be,fe,Ae,Ne)=>h.jsx(h.Fragment,{children:re&&be&&!re?.isMandatory?h.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===K?.fhi||K?.isHigh)&&h.jsx(se,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none"}})},`resize-${ge}_${Ne}`):null}),[e?.selectedRow,f]),we=K=>{const re=C.current,{left:ge,right:be}=re.getBoundingClientRect(),fe=50,Ae=K.clientX>be-fe?1:K.clientX<ge+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=K=>K?.map((re,ge)=>{const be=$.start+ge,fe=re[G],Ae=ne?.[fe],Ne=e?.selectedRow&&e?.selectedRow?.fhi===re?.fhi,Ue=re?.isHigh;return h.jsxs(E.Fragment,{children:[h.jsx(o2,{row:re,isSelected:Ne,isHigh:Ue,onRowClick:e?.onRowClick,children:p.map((ye,yt)=>ye?.isHidden||ye?.isVisible===!1?null:ye?.children?ye.children.map((ct,Ye)=>ct?.isHidden?null:h.jsxs(E.Fragment,{children:[ee(ct,re,Ye,ye),x&&Oe(re,ct,Ye,w,ye,"",be)]},`col-${yt}-${Ye}`)):h.jsxs(E.Fragment,{children:[ee(ye,re,yt),x&&Oe(re,ye,yt,w,"","",be)]},`col-${yt}`))}),Z&&Ae&&h.jsx(s2,{nestedData:Ae,nestedColumn:q,t:d})]},`row-${be}`)}),Re=()=>{const K=O.current;if(!K)return;const re=K.scrollTop,ge=K.clientHeight,be=Math.floor(re/M)-D,fe=Math.ceil(ge/M)+2*D,Ae=Math.max(0,Math.min(A-1,be)),Ne=Math.max(Ae,Math.min(A,Ae+fe));T(Ue=>Ue.start===Ae&&Ue.end===Ne?Ue:{start:Ae,end:Ne})};E.useEffect(()=>{let K;const re=()=>{K&&cancelAnimationFrame(K),K=requestAnimationFrame(()=>{Re()})},ge=O.current;if(!(!ge||!u))return Re(),ge.addEventListener("scroll",re),()=>{cancelAnimationFrame(K),ge.removeEventListener("scroll",re)}},[A]);const Fe=$.start*M,Pe=(A-$.end)*M,de=u?n?.slice($.start,$.end):n;return v?h.jsxs(h.Fragment,{children:[h.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:h.jsxs(iu,{ref:C,stickyHeader:!0,"aria-label":"sticky table",sx:{backgroundColor:K=>K.palette.primary.notifyBackground},children:[h.jsxs(uu,{children:[h.jsx(Rr,{sx:{position:"sticky",top:0,zIndex:3,backgroundColor:K=>K.palette.primary.notifyBackground},children:p.map((K,re)=>K?.isHidden||K?.isVisible===!1?null:h.jsxs(E.Fragment,{children:[oe(K,re,w),le(K,re,w)]},re))}),h.jsx(Rr,{draggable:!1,sx:{position:"sticky",top:"2.5rem",backgroundColor:f.palette.primary.notifyBackground,zIndex:2},children:p.flatMap((K,re)=>K?.isHidden||!K?.children||K?.isVisible===!1?[]:K.children.map((ge,be)=>ge?.isHidden?null:h.jsxs(E.Fragment,{children:[oe(ge,be,w,K),x&&le(ge,be,w)]},`${re}-${be}`)))})]}),h.jsxs(au,{children:[u&&h.jsx("tr",{style:{height:Fe}}),Ie(de),u&&h.jsx("tr",{style:{height:Pe}})]})]})}),r&&h.jsx(uf,{pagination:r,gridPath:l,baseUrl:a,t:d}),h.jsx(df,{menuOpen:m?.isOpen,handleClose:b,onHideClick:S})]}):h.jsx(Dr,{sx:{textAlign:"center"},children:d(cr.NRF)})}c2.propTypes={sort:s.object,data:s.array,pagination:s.object,columns:s.object,nested:s.object};function u2(e){return ov(e?.style?.width??e?.style?.minWidth??e?.style?.maxWidth)||0}const d2=e=>e?.isHidden||e?.isVisible===!1;function pN(e){const t=E.useMemo(()=>{let o=0;return e.flatMap((i,a)=>{if(d2(i))return[];if(Array.isArray(i.children)&&i.children.length){const u=i.children.filter(d=>!d2(d));return u.length?u.map(d=>{const f=u2(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=u2(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=E.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]=E.useState(null),[c,u]=E.useState(null),d=E.useCallback((b,S)=>{if(n.current){b.preventDefault();return}l(S),b.dataTransfer.setData("colIndex",S);const k=e[S],w=document.createElement("div");w.textContent=k?.label,Object.assign(w.style,{display:"flex",alignItems:"center",justifyContent:"center",padding:"1.5rem 2.5rem",minWidth:k?.style?.minWidth,maxWidth:k?.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=E.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=E.useCallback(async(b,S)=>{if(b.preventDefault(),o(),a===null||a===S||e?.[S]?.isMandatory)return;const k=[...e],[w]=k.splice(a,1);k.splice(S,0,w);const x=[...e].sort((C,O)=>C.sequenceId-O.sequenceId).map(C=>C.sequenceId),v=k.map((C,O)=>({...C,sequenceId:x[O]??C.sequenceId}));t({updatedColumns:v}),l(null),u(null)},[a,e,t,o]),g=E.useCallback(()=>{o(),l(null),u(null)},[o]),m=b=>!b?.isMandatory,y=E.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:g,isDraggable:m,isInvalidDrop:y}}const f2=50,mN=10,gN=50;function yN(e){const t=E.useRef(null),n=E.useCallback(()=>{t.current&&(clearInterval(t.current),t.current=null)},[]);return{startAutoScroll:E.useCallback(o=>{const i=e.current;if(!i)return;const{left:a,right:l}=i.getBoundingClientRect(),c=o>l-f2?1:o<a+f2?-1:0;if(c===0){n();return}t.current||(t.current=setInterval(()=>{i.scrollLeft+=c*mN},gN))},[e,n]),stopAutoScroll:n}}const pf=E.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:g,handleMenuClick:m}){const y=it(),b=l===n,S=r&&!t?.isMandatory,k=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 h.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 ${y.palette.brandColor.lightBlue}!important`},...k&&{position:"sticky",left:i,zIndex:3},cursor:c(n)?"not-allowed":S?"grab":"default"},children:h.jsx(ff,{parent:o,column:t,sort:g,handleMenuClick:m,isManageable:r})},n)}),hf=E.memo(function({column:t,index:n,isManageable:r,tableHeight:o,onResizeStart:i,onResizeEnd:a}){const l=it();return!t||!r||t?.isMandatory?null:h.jsx(se,{component:t?.children||t?.isMandatory?Do:r2,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=E.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:g,onDrop:m,onDragEnd:y,isResizingRef:b,columnUpdaterFunction:S,visibleGridColumns:k}){const w=it(),x={draggedColIndex:d,isInvalidDrop:f,onDragStart:p,onDragOver:g,onDrop:m,onDragEnd:y},v=(O,M)=>({onResizeStart:()=>{O?.isMandatory&&!O?.isResizable||(b.current=!0)},onResizeEnd:D=>{O?.isMandatory&&!O?.isResizable||D<=20||(b.current=!1,a2({index:M,visibleGridColumns:k,width:D,columnUpdaterFunction:S}))}}),C=E.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 h.jsxs(uu,{children:[h.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 h.jsxs(E.Fragment,{children:[h.jsx(pf,{column:D,index:O._originalIndex,isManageable:r,stickyLeft:c(O),sort:a,handleMenuClick:l,...x}),o&&h.jsx(hf,{column:D,index:O._originalIndex,isManageable:r,tableHeight:i,...v(D,O._originalIndex)})]},`sticky-p-${M}`)}),h.jsx("th",{style:{minWidth:u,width:u,padding:0,border:"none"}}),C.map((O,M)=>h.jsxs(E.Fragment,{children:[h.jsx(pf,{column:O.column,index:O.firstChild._originalIndex,colSpanOverride:O.colSpan,isManageable:r,stickyLeft:c(O.firstChild),sort:a,handleMenuClick:l,...x}),o&&h.jsx(hf,{column:O.column,index:O.firstChild._originalIndex,isManageable:r,tableHeight:i,...v(O.column,O.firstChild._originalIndex)})]},`parent-${O.key}`))]}),h.jsxs(Rr,{draggable:!1,sx:{position:"sticky",top:"2.5rem",backgroundColor:w.palette.primary.notifyBackground,zIndex:2},children:[h.jsx("th",{style:{minWidth:u,width:u,padding:0,border:"none"}}),n?.map((O,M)=>O._parent&&h.jsxs(E.Fragment,{children:[h.jsx(pf,{column:O,index:O._originalIndex,isManageable:r,parent:O._parent,stickyLeft:c(O),sort:a,handleMenuClick:l,...x}),o&&h.jsx(hf,{column:O,index:O._originalIndex,isManageable:r,tableHeight:i,...v(O,O._originalIndex)})]},`child-${O?._parent?.key??O.key}-${M}`))]})]})}),vN=()=>h.jsx(se,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none",zIndex:1}}),p2=E.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 h.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&&h.jsx(vN,{}),h.jsx(Dl,{isRenderCellContent:!!t?.cellRenderer,column:t,row:n,parent:o})]},r)}),xN=E.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:g,offsetX:m,t:y}){const b=it(),S=E.useCallback((k,w,x)=>{if(!k||!i||k?.isMandatory)return null;const v=c&&c?.fhi===w?.fhi||w?.isHigh;return h.jsx(Do,{className:"column_resizer_body",sx:{width:"1rem",maxWidth:"1rem",minWidth:"1rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${b.palette.primary.notifyBorderColor}`},children:v&&h.jsx("div",{style:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none"}})},`resize-${x}`)},[i,c,b]);return h.jsxs(au,{children:[h.jsx("tr",{style:{height:a}}),t?.map((k,w)=>{const x=c&&c?.fhi===k?.fhi,v=k?.isHigh,C=d?.[k[p]];return h.jsxs(E.Fragment,{children:[h.jsxs(o2,{row:k,isSelected:x,isHigh:v,children:[n.map((O,M)=>h.jsxs(E.Fragment,{children:[h.jsx(p2,{column:O,row:k,cellKey:M,parent:O._parent,stickyLeft:g(O),isSelected:x,isHigh:v}),o&&S(O,k,`sticky-${M}-${w}`)]},`sticky-${O.sequenceId??M}`)),h.jsx("td",{style:{minWidth:m,width:m,padding:0,border:"none"}}),r.map((O,M)=>h.jsxs(E.Fragment,{children:[h.jsx(p2,{column:O,row:k,cellKey:M,parent:O._parent,stickyLeft:g(O),isSelected:x,isHigh:v}),o&&S(O,k,`${M}-${w}`)]},`col-${O?._parent?.key??O.key}-${M}`))]}),u&&C&&h.jsx(s2,{nestedData:C,nestedColumn:f,t:y})]},`row-${w}`)}),h.jsx("tr",{style:{height:l}})]})});function wN({rowCount:e,rowHeight:t,scrollTop:n,overscan:r=5}){const o=ov("40rem");return E.useMemo(()=>{const i=e*t,a=Math.max(0,Math.floor(n/t)-r),l=Math.ceil(o/t)+r*2,c=Math.min(e,a+l),u=a*t;return{totalHeight:i,startIndex:a,endIndex:c,offsetY:u}},[e,t,o,n,r])}function SN({columnWidths:e,containerRef:t,scrollLeft:n,overscan:r=2}){const o=E.useRef(0),[i,a]=E.useState(0);E.useEffect(()=>{const u=t.current;if(!u)return;const d=new ResizeObserver(f=>{const p=f[0].contentRect;p.width!==o.current&&(o.current=p.width,a(p.width))});return d.observe(u),()=>d.disconnect()},[e]);const l=E.useMemo(()=>e.map(u=>{const d=Number(u);return Number.isFinite(d)&&d>0?d:0}),[e]),c=E.useMemo(()=>{const u=new Array(l.length);let d=0;for(let f=0;f<l.length;f++)u[f]=d,d+=l[f];return u},[l]);return E.useMemo(()=>{const u=n+i;let d=0;for(let p=0;p<l.length;p++)if(c[p]+l[p]>n){d=Math.max(0,p-r);break}let f=d;for(;f<l.length&&c[f]<u;)f++;return f=Math.min(l.length,f+r),{startIndex:d,endIndex:f,offsetX:c[d]||0,viewportWidth:i,viewportWidthRef:o}},[l,c,i,n,r])}const mf=45;function CN({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}=E.useContext(yi),g=E.useContext(Ko),{selectedColumn:m,handleMenuClick:y,handleClose:b,handleHideClick:S,columnUpdaterFunction:k}=i2(p,g,a,l,r?.rowPerPage,c),w=o?.isManageable,x=o?.isResizable,v=E.useRef(null),C=E.useRef(null),O=E.useRef(!1),M=E.useRef(0),D=E.useRef(0),A=E.useRef(!1),[,$]=E.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:k,isResizingRef:O,startAutoScroll:I,stopAutoScroll:B}),V=K=>{const re=K.currentTarget.scrollTop,ge=K.currentTarget.scrollLeft;A.current||(A.current=!0,requestAnimationFrame(()=>{M.current=re,D.current=ge,$({}),A.current=!1}))},q=E.useMemo(()=>j.filter(K=>K.isSticky&&!K.isCenterTable),[j]),Z=E.useMemo(()=>j.filter(K=>K.isSticky&&K.isCenterTable||!K.isSticky),[j]),ne=E.useMemo(()=>Z.map(K=>K.width),[Z]),{startIndex:G,endIndex:J}=wN({rowCount:n.length,rowHeight:mf,scrollTop:M.current,overscan:15}),{startIndex:ie,endIndex:ae,offsetX:_,viewportWidth:z,viewportWidthRef:N}=SN({columnWidths:ne,containerRef:C,scrollLeft:D.current,overscan:2}),oe=E.useMemo(()=>Z.slice(ie,ae),[Z,ie,ae]),ee=G*mf,le=(n?.length-J)*mf,[Oe,we]=E.useState(0);E.useEffect(()=>{const K=v.current;if(!K)return;const re=new ResizeObserver(()=>we(K.offsetHeight));return re.observe(K),()=>re.disconnect()},[]);const Ie=n2(i?.column?.definitions||[]),Re=i?.isNested,Fe=i?.data||[],Pe=i?.hashKey,de=n?.slice(G,J);return n?.length?h.jsxs(h.Fragment,{children:[h.jsx(cu,{ref:C,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:h.jsxs(iu,{ref:v,stickyHeader:!0,"aria-label":"sticky table",sx:{backgroundColor:f.palette.primary.notifyBackground},children:[h.jsx(bN,{offsetX:_,stickyGridColumns:q,virtualisedColumns:oe,isManageable:w,isResizable:x,tableHeight:Oe,sort:t,handleMenuClick:y,getStickyLeft:T,draggedColIndex:L,isInvalidDrop:W,onDragStart:Y,onDragOver:U,onDrop:F,onDragEnd:R,isResizingRef:O,columnUpdaterFunction:k,visibleGridColumns:p}),h.jsx(xN,{offsetX:_,visibleRows:de,stickyGridColumns:q,virtualisedColumns:oe,isVirtualizedTable:u,isResizable:x,isManageable:w,topSpacerHeight:ee,bottomSpacerHeight:le,selectedRow:e?.selectedRow,isNested:Re,nestedRow:Fe,nestedColumn:Ie,hashKey:Pe,getStickyLeft:T,t:d})]})}),r&&h.jsx(uf,{pagination:r,gridPath:l,baseUrl:a,t:d}),h.jsx(df,{menuOpen:m?.isOpen,handleClose:b,onHideClick:S})]}):h.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=E.useContext(Ko),{t:l}=E.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 E.useEffect(()=>{u?.length&&e?.data?.length&&a?.({type:je.SET_GRID_DATA,payload:{visibleGridColumns:u}})},[u,e?.data]),h.jsx(h.Fragment,{children:c?h.jsx(CN,{...e,gridPath:n,baseUrl:r,childUniqueKey:o,t:l}):h.jsx(c2,{...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:h.jsxs(se,{sx:{borderRadius:2,overflow:"hidden"},children:[h.jsx(nr,{variant:"text",width:"100%",height:60,sx:r}),Array.from({length:10}).map((i,a)=>h.jsx(se,{sx:{display:"flex",alignItems:"center",padding:"0.5rem",gap:"3rem"},children:Array.from({length:5}).map((l,c)=>h.jsx(se,{sx:{flex:1},children:h.jsx(nr,{variant:"text",height:45,sx:r})},c))},a))]}),toolbar:h.jsx(h.Fragment,{children:h.jsxs(He,{direction:"row",justifyContent:"space-between",sx:{display:"flex",gap:"1rem"},children:[h.jsxs(He,{direction:"row",gap:"1rem",children:[h.jsx(nr,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),h.jsx(nr,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),h.jsx(nr,{variant:"text",width:"15.2rem",height:"5rem",sx:r})]}),h.jsxs(He,{direction:"row",gap:"1rem",children:[h.jsx(nr,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),h.jsx(nr,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),h.jsx(nr,{variant:"text",width:"3.5rem",height:"5rem",sx:r})]})]})})}[e]},TN=({customTools:e})=>{const t=e?.filter(r=>r?.type===e2.PRIMARY)?.sort((r,o)=>r.sequenceId-o.sequenceId),n=e?.filter(r=>r?.type===e2.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}=TN({customTools:e}),[i,a]=E.useState(r),l=o?.length>0,{t:c}=E.useContext(an),u=f=>{f?a([...r,...o]):setTimeout(()=>{a(r)},100)},d=()=>{const f=!t;n(f),u(f)};return E.useEffect(()=>{u(t)},[e]),h.jsxs(h.Fragment,{children:[t&&h.jsx("div",{style:{position:"fixed",left:0,width:"100vw",height:"4rem",zIndex:998}}),h.jsxs(se,{sx:{display:"flex",alignItems:"center",gap:"0.8rem",flexWrap:"nowrap",maxWidth:"100%",whiteSpace:"nowrap",zIndex:999},children:[h.jsx(fM,{mode:"popLayout",children:i.map((f,p)=>h.jsx(zo.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},layout:!0,children:h.jsx(se,{sx:{flexShrink:0,minWidth:"fit-content"},children:uN(f)})},`${f.id}_${p}`))}),l&&h.jsx(se,{sx:{paddingLeft:t?"0.5rem":0},children:h.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}=E.useContext(an),u=E.useContext(Ko),{visibleGridColumns:d,triggerApi:f}=E.useContext(yi),[p,g]=E.useState([]),[m,y]=E.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)||[];E.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;g(O)}},[d]);const k=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}})}};E.useEffect(()=>{f&&k(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 h.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:[h.jsxs(se,{sx:{display:"flex",flexDirection:"row",gap:"0.6rem",alignItems:"center"},children:[e?.search?.isRequired&&h.jsx(cv,{...e?.search,iconUrl:ze.Search}),e?.refresh?.isRequired&&h.jsx(sr,{...e?.refresh,styles:{variant:"filled",icon:ze.Refresh,colorType:"empty",width:"3.2rem",height:"3.2rem"}}),e?.groupBy?.isRequired&&h.jsx(se,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:h.jsx(Xo,{styles:{icon:ze.Group},...e.groupBy})}),t&&h.jsx(se,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:h.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)=>h.jsx(E.Fragment,{children:v.render()},v.id))]}),h.jsxs(se,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"0.6rem"},children:[S?.length>0&&S.map((v,C)=>h.jsx(E.Fragment,{children:v.render()},v.id)),n&&h.jsx(g2,{customTools:n,setIsExpanded:y,isExpanded:m}),e?.save?.isRequired&&h.jsx(se,{sx:{px:"0.5rem"},children:h.jsx(sr,{label:m?"":"Save",styles:{icon:ze.Save,colorType:"empty"},...e?.save})}),e?.upload?.isRequired&&h.jsx(sr,{...e?.upload,styles:{variant:m?"outlined":"filled",icon:m?ze.UploadDark:ze.Upload,iconPrimary:!m,colorType:"secondary",isAnimate:!0}}),e?.download?.isRequired&&h.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 gf({tableProps:e,toolbarProps:t,isDefaultConfig:n,isLoading:r}){const o=e.columns?.isManageable;return h.jsx(sv,{children:r?h.jsxs(h.Fragment,{children:[t&&h.jsx(m2,{type:"toolbar"}),e&&h.jsx(m2,{type:"grid"})]}):h.jsxs(se,{sx:{position:"sticky"},children:[t&&h.jsx(y2,{...t,isManageable:o,pageSize:e?.pagination?.rowPerPage,gridData:e?.data}),h.jsx(h2,{tableProps:e,isDefaultConfig:n,gridPath:t?.gridPath||"",baseUrl:t?.baseUrl||"",childUniqueKey:t?.childUniqueKey||""})]})})}gf.propTypes={tableProps:s.object.isRequired,toolbarProps:s.object,isDefaultConfig:s.bool};const b2=({list:e,handleLinkClick:t})=>{const n=it(),{t:r}=E.useContext(an),o=({list:i})=>i?.sort((a,l)=>a.order-l.order)?.map((a,l)=>a?.link?h.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):h.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 h.jsx(hm,{separator:h.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}=E.useContext(an),a=n?.filterBtnProps?.disabled;return h.jsxs(h.Fragment,{children:[h.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:[h.jsx(b2,{...e}),h.jsxs(He,{direction:"row",gap:"1rem",alignItems:"center",children:[r,t&&h.jsx(fv,{...t}),n?.filterBtnProps&&h.jsxs(He,{direction:"row",children:[h.jsx(Mo,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"2rem!important",opacity:"1!important",borderColor:o.palette.primary.notifyBorderColor}}),h.jsxs(He,{direction:"row",alignItems:"center",gap:"0.5rem",onClick:n?.filterBtnProps?.onFilterClick,sx:{opacity:a?.5:1,cursor:a?"not-allowed":"pointer"},children:[h.jsx(Gt,{url:ze.Filter}),h.jsx(lt,{sx:{fontSize:"1.1rem",color:o.palette.primary.notifyActiveText},children:i(n?.filterBtnProps?.label)})]})]})]})]}),h.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:h.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:[h.jsxs(lt,{sx:{fontSize:"1.2rem",fontWeight:"500",color:o.palette.primary.notifyActiveText},children:[n?.labels?.description||i("Filters")," :"]}),h.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:h.jsx(He,{direction:"row",gap:"1.2rem",sx:{overflow:"visible"},children:n?.filterItems?.map((l,c)=>h.jsx(h.Fragment,{children:h.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:[h.jsx(se,{component:"img",src:ze.FilterClose,sx:{position:"absolute",top:"-0.4rem",right:"-0.6rem",cursor:"pointer"},onClick:()=>n?.onFilterChipClose(l)}),h.jsx(lt,{sx:{fontSize:"1rem",color:o.palette.primary.notifyTextColor},children:l?.filterLabel})]},c)}))})}),h.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 h.jsx(rn,{children:h.jsx(v2,{...e})})}x2.propTypes={headerProps:s.object.isRequired};const yf=E.createContext(null),w2=E.createContext(null);function S2({children:e}){const[t,n]=E.useReducer(kN,EN);return h.jsx(yf.Provider,{value:t,children:h.jsx(w2.Provider,{value:n,children:e})})}function kN(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 EN={loading:!1,data:[],error:"",isMarkAllAsRead:{count:0,boo:!1},mode:!1,activeTab:0},{TENANT_ID:bf,BU_ID:vf}=Qv,{TENANT_IDS:xf,BU_IDS:wf}=t2,ON=async e=>{try{const t=localStorage.getItem("i18nextLng"),n=`${e}${Ol.NOTIFICATION}/v1?${bf}=${xf}&${vf}=${wf}&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}?${bf}=${xf}&${vf}=${wf}&lang=${r}`;return await ft.put(o,t,Ti)}catch(r){return r}},PN=async({baseUrl:e,id:t,snopId:n})=>{try{const r=localStorage.getItem("i18nextLng"),o=`${e}${Ol.NOTIFICATION}${sf.VERSION}?${bf}=${xf}&${vf}=${wf}&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=E.useContext(w2),[n,r]=E.useState(!1),[o,i]=E.useState(!1),[a,l]=E.useState(!1),[c,u]=E.useState({}),[d,f]=E.useState(null),[p,g]=E.useState(1),m=E.useRef(!1),{loading:y,data:b,isMarkAllAsRead:S,mode:k,activeTab:w}=E.useContext(yf),[x,v]=E.useState([]);E.useEffect(()=>{v(b)},[b]);const C=E.useCallback(async()=>{if(!(m.current||!e))try{t({type:je.LOADING,loading:!0}),t({type:je.SUCCESS,data:[]});const j=await ON(e);if(j.status===es.UNAUTHORIZED){m.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:rv(I),boo:rv(I)>0}}),t({type:je.LOADING,loading:!1})}}catch(j){j?.response?.status===es.UNAUTHORIZED&&(m.current=!0),t({type:je.ERROR,error:cr.SWR}),t({type:je.LOADING,loading:!1})}},[e,t]),O=j=>{const I=(b||[]).filter(B=>k?!B.isRead:!0);return{0:I,1:I.filter(B=>B?.type==="INFO"),2:I.filter(B=>B?.type==="ERROR")}};E.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 PN({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=k?b||[]:(x||[]).filter(I=>!I.isRead);t({type:je.SET_MODE,mode:!k}),v(j),g(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:y,tabData:O()[w],data:x,mode:k,handleTabChange:$,toggleAlertMode:T,page:p,setPage:g,isMarkAllAsRead:S}};var k2,E2,O2;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 MN=function(t){return P.createElement("svg",Sf({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 DN=({count:e})=>(it(),h.jsxs(h.Fragment,{children:[h.jsx(se,{sx:{gap:"0.5rem",display:"flex",justifyContent:"center",alignItems:"center","& svg":{transform:"scale(1)"}},children:h.jsx(MN,{style:{scale:1.2}})}),h.jsx(iN,{badgeContent:e!=0?"":null,color:"error"})]}));function P2({children:e,handleClose:t,open:n,isMainDialog:r}){return h.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 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 RN=function(t){return P.createElement("svg",Cf({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 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 AN=function(t){return P.createElement("svg",Tf({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 kf(){return kf=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},kf.apply(null,arguments)}var jN=function(t){return P.createElement("svg",kf({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 h.jsxs(se,{className:"cards",sx:{pt:" 0.8rem"},children:[h.jsx(He,{display:"flex",flexDirection:"row",alignItems:"start",justifyContent:"space-between",gap:1,children:h.jsx(Vc,{sx:{width:"calc(100% - 2%)","& .MuiBadge-badge":{backgroundColor:"#6041EA",height:"0.5rem",minWidth:"0.5rem"}},variant:"dot",invisible:t?.isRead,children:h.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)})})}),h.jsx(He,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:h.jsxs(He,{display:"flex",flexDirection:"row",justifyContent:"start",gap:1,sx:{p:"0.5rem 0"},children:[t?.isNotificationDetails&&h.jsx(Rl,{icon:h.jsx(AN,{className:`${c==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:n,label:i===t?.id?h.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&&h.jsx(Rl,{icon:h.jsx(jN,{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&&h.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&&h.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"})]})}),h.jsxs(He,{display:"flex",flexDirection:"row",alignItems:"center",gap:.35,children:[h.jsx(Dr,{sx:{fontSize:"0.8rem"},children:a(t?.product)}),h.jsx(Dr,{color:l.palette.primary.notifyTextColor,children:"•"}),h.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}=E.useContext(yf),l=E.useRef(null),[c,u]=E.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),g=E.useMemo(()=>o?a?.count?e?.filter(x=>!x.isRead):[]:e||[],[e,o,a]),m=g.slice(c.start,c.end),y=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})},k=({url:x})=>{window.open(x,"_blank")},w=E.useMemo(()=>UI(m),[m]);return E.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]),g.length||i("CONTAINER_MESSAGE"),h.jsxs(se,{ref:l,sx:{height:"100%",overflowY:"auto"},children:[h.jsx(se,{style:{height:y}}),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 h.jsxs(E.Fragment,{children:[x!==p&&h.jsx(sN,{children:$}),v.map((T,j)=>h.jsx(j2,{item:T,handleCTAClicked:k,handleShowDetails:()=>n(T.id,T.snopId),handleRead:()=>t([T.id],T.snopId),clickId:r,t:i},`${T.id}_${j}`))]},x)}),h.jsx(se,{style:{height:b}})]})};N2.propTypes={data:s.array,handleRead:s.func,handleShowDetails:s.func};const IN=({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:g,toggleAlertMode:m}=T2({});return h.jsxs(h.Fragment,{children:[h.jsxs(se,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,pt:2},children:[h.jsx(lt,{variant:"h2",sx:{fontSize:"1.2rem",color:y=>y.palette.primary.notifyTextColor},children:i("NOTIFICATION")}),h.jsx(se,{onClick:e,children:h.jsx(Gt,{url:ze.Refresh,alt:"refresh",sx:{cursor:"pointer"}})})]}),h.jsx(se,{sx:{borderBottom:1,m:"1.2rem 1.2rem 0 1.2rem",borderColor:y=>y.palette.primary.notifyBorderColor},children:h.jsxs(aN,{value:l,onChange:g,children:[h.jsx(cf,{label:h.jsx(se,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:h.jsx(lt,{component:"span",sx:{fontWeight:500,fontSize:"1rem"},children:i("ALL",{count:c?.filter(y=>!y?.isRead)?.length||0})})})}),h.jsx(cf,{label:h.jsx(se,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:h.jsx(lt,{component:"span",sx:{fontWeight:500,fontSize:"1rem"},children:i("INFO",{count:c?.filter(y=>y?.type==="INFO"&&!y?.isRead)?.length||0})})}),sx:{color:y=>y.palette.brandColor.blue}}),h.jsx(cf,{label:h.jsx(se,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:i("ERROR",{count:c?.filter(y=>y?.type==="ERROR"&&!y?.isRead)?.length||0})}),sx:{color:y=>y.palette.brandColor.red}})]})}),h.jsx(Xc,{dividers:!0,sx:{p:0,...a&&!u.length&&{alignItems:"center",justifyContent:"center"},flexGrow:1,overflowY:"auto",mx:"1.2rem",borderColor:y=>y.palette.primary.notifyBorderColor},tabIndex:-1,children:a&&!u.length?h.jsx(se,{sx:{height:300,display:"flex",justifyContent:"center",alignItems:"center"},children:h.jsx(vo,{size:30,sx:{color:y=>y.palette.primary.notifyIconColor}})}):h.jsx(h.Fragment,{children:h.jsx(N2,{data:u,handleShowDetails:t,handleRead:r,clickId:n,page:f,setPage:p,mode:d,t:i})})}),h.jsxs(Kc,{sx:{justifyContent:"space-between",px:"1.2rem"},children:[h.jsxs(He,{direction:"row",gap:1,children:[h.jsx(Dr,{sx:{fontSize:"1rem"},children:i("SHOW_UNREAD")}),h.jsx(oN,{disabled:a,checked:d,onChange:m})]}),h.jsx(Na,{variant:"outlined",className:"view-all",onClick:o,startIcon:h.jsx(RN,{}),disabled:!c?.filter(y=>!y?.isRead)?.length,style:{backgroundColor:"transparent"},sx:{fontSize:"1rem",fontWeight:"300",p:0,border:"none",textTransform:"none",color:y=>y.palette.primary.notifyTextColor,"&:hover":{color:y=>y.palette.primary.notifyActiveText,background:"transparent",boxShadow:"none",border:"none"},"&.Mui-disabled":{opacity:.5,color:y=>`${y.palette.primary.notifyActiveText}!important`,background:"transparent",boxShadow:"none",border:"none"}},children:i("READ_ALL")})]})]})},NN=({data:e,handleClose:t,t:n})=>{const[r,o]=E.useState(1),[i,a]=E.useState(10),[l,c]=E.useState(e?.notificationDetails?.length||0),[u,d]=E.useState("sku_name"),[f,p]=E.useState("asc"),[g,m]=E.useState([]),[y,b]=E.useState("");return E.useEffect(()=>{if((y||u)&&e?.notificationDetails?.length){const S=zI(e?.notificationDetails,V4,y);if(u){const k=HI(S,u,f);m(Ud(k,r,i)),c(k?.length||0);return}m(Ud(S,r,i)),c(S?.length||0);return}m(Ud(e?.notificationDetails,r,i)),c(e?.notificationDetails?.length)},[y,e,r,i,f,u]),h.jsxs(h.Fragment,{children:[h.jsxs(He,{direction:"row",justifyContent:"space-between",sx:{padding:"1.5rem 2rem",borderBottom:"0.1rem solid",borderColor:S=>S.palette.primary.notifyBorderColor},children:[h.jsx(lt,{component:"h2",sx:{fontSize:"1.4rem",color:S=>S.palette.primary.notifyActiveText},children:n(e?.message)||e?.message}),h.jsx(se,{onClick:t,sx:{cursor:"pointer"},children:h.jsx(Gt,{url:ze.CloseCircle})})]}),h.jsx(Xc,{children:h.jsx(gf,{t:n,tableProps:{data:g,columns:{...rN({t:n}),isManageable:!1},sort:{sortField:u,sortDir:f,onSort:S=>{const k=S?.column?.key;p(w=>u===k&&w==="asc"?"desc":"asc"),d(k)}},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 k=S.target.value;k&&o(1),b(k)},placeholder:`${n("SEARCH")}...`}}}})}),h.jsx(Kc,{sx:{padding:"1.5rem 2rem"}})]})},$N=({baseUrl:e,t})=>{const{alertDialogProps:n,showDetailsProps:r,fetchNotification:o,isMarkAllAsRead:i}=T2({baseUrl:e});return h.jsxs(h.Fragment,{children:[h.jsx(se,{sx:{display:"flex",justifyContent:"center",cursor:"pointer",marginTop:"0.6rem"},onClick:()=>{o(),n?.setOpen?.(!0)},children:h.jsx(DN,{count:i.count})}),h.jsx(P2,{...n,children:h.jsx(IN,{...n,t})}),h.jsx(P2,{...r,children:h.jsx(NN,{...r,t})})]})},BN=({baseUrl:e,t})=>h.jsx(rn,{children:h.jsx(S2,{children:h.jsx($N,{baseUrl:e,t})})}),LN=({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 g=it();return h.jsx(se,{sx:{position:"relative",overflow:"hidden"},children:h.jsxs(Vs,{container:!0,sx:{height:"100%"},children:[h.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&&h.jsx(h.Fragment,{children:h.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&&h.jsxs(Vs,{item:!0,sx:{width:u?"90%":d?.drawerWidth||"25%",position:n?"relative":"absolute",top:0,right:0,height:"calc(100vh - 7rem)",backgroundColor:g.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 ${g.palette.primary.notifyBorderColor}`,display:"flex",flexDirection:"column"},children:[h.jsxs(He,{direction:"row",alignItems:"center",sx:{width:"100%",flexShrink:0,paddingBottom:"0.8rem",px:2,pt:"0.8rem",borderBottom:m=>`0.1rem solid ${m.palette.primary.notifyBorderColor}`},children:[!u&&f&&h.jsxs(h.Fragment,{children:[h.jsx(se,{component:"img",src:ze.Merge,sx:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer"},onClick:l}),h.jsx(Mo,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"auto!important",borderColor:g.palette.primary.notifyBorderColor}})]}),h.jsxs(He,{direction:"row",justifyContent:"space-between",alignItems:"center",flexGrow:1,children:[h.jsxs(He,{direction:"row",gap:"0.5rem",alignItems:"center",sx:{cursor:"pointer"},children:[p&&h.jsx(se,{onClick:a,children:h.jsx(Gt,{url:ze.CrossLight})}),h.jsx(lt,{sx:{fontSize:"1.2rem",color:g.palette.primary.notifyTextColor},children:o})]}),h.jsx(He,{direction:"row",gap:"0.5rem",alignItems:"center",children:i&&h.jsx(se,{onClick:c,sx:{cursor:"pointer"},children:h.jsx(se,{component:"img",src:u?ze.Collapse:ze.Expand})})})]})]}),h.jsx(se,{sx:{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},overflow:"auto",px:2},children:e})]})]})})},$2=({layoutChildren:e,layoutProps:t})=>h.jsx(rn,{children:h.jsx(LN,{...e,...t})});$2.propTypes={layoutChildren:s.object.isRequired,layoutProps:s.object.isRequired};const B2=({parentProps:e,childProps:t})=>{const n=it();return h.jsxs(He,{sx:{background:n.palette.primary.notifyBackground,border:`0.1rem solid ${n.palette.primary.notifyBorderColor}`,borderRadius:"1rem",position:"relative",overflow:"hidden"},children:[h.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}),h.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:h.jsx(se,{sx:{p:"1rem"},children:t.content})})]})};B2.propTypes={parentProps:s.object.isRequired,childProps:s.object.isRequired};const L2=({accordionProps:e})=>h.jsx(rn,{children:h.jsx(S2,{children:h.jsx(B2,{...e})})});L2.propTypes={accordionProps:s.object.isRequired};const _2=E.createContext(null),_N=_2.Provider,FN=()=>{const e=E.useContext(_2);return e||console.warn("useAnalytics used outside AnalyticsProvider"),e};ut.Accordion=L2,ut.AnalyticsProvider=_N,ut.Button=sr,ut.Checkbox=dl,ut.DatePicker=e9,ut.Grid=gf,ut.Header=x2,ut.InputField=cv,ut.Loader=p9,ut.Notification=BN,ut.Select=uv,ut.SliderLayout=$2,ut.Switch=fv,ut.TextField=hl,ut.ToastProvider=l9,ut.TranslationContext=an,ut.toast=o9,ut.useAnalytics=FN,Object.defineProperty(ut,Symbol.toStringTag,{value:"Module"})}));
|
|
257
257
|
//# sourceMappingURL=index.umd.js.map
|