dts-universal-report-module 1.0.0

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.js ADDED
@@ -0,0 +1,115 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),u=require("react"),_i=require("xlsx"),w=require("@mui/icons-material"),o=require("@mui/material"),gn=require("react-dom"),$i=require("@emotion/react"),dt=require("react-dnd"),io=require("react-dnd-html5-backend");function bn(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const zr=bn(u),yr=bn(_i);function Fi(e){return e==null?"null":Array.isArray(e)?"array":typeof e=="object"?"object":typeof e=="number"?"number":typeof e=="boolean"?"boolean":typeof e=="string"?"string":"mixed"}function Ur(e){if(!Array.isArray(e)||e.length===0)return[];const r=new Set;e.forEach(i=>{typeof i=="object"&&i!==null&&Object.keys(i).forEach(a=>r.add(a))});const n=[];return r.forEach(i=>{const a=new Set;let l=0;e.forEach(x=>{typeof x=="object"&&x!==null&&i in x&&(l++,a.add(Fi(x[i])))});const c=l===e.length,d=a.size>1&&!a.has("null");let f="mixed";if(a.size===1)f=Array.from(a)[0];else if(a.size===2&&a.has("null")){const x=Array.from(a).filter(m=>m!=="null");x.length===1&&(f=x[0])}n.push({name:i,type:f,required:c,hasConflict:d})}),n.sort((i,a)=>i.name.localeCompare(a.name))}function Vi(e){return e.some(r=>r.hasConflict)}function Ct(e){if(!e)return"";const n=e.replace(/[_-]/g," ").replace(/([a-z])([A-Z])/g,"$1 $2");return n.charAt(0).toUpperCase()+n.slice(1)}function Co(e){return e==null}function Ni(e){return(r,n,i)=>{const a=Co(r),l=Co(n);if(a&&l)return 0;if(a)return 1;if(l)return-1;let c=0;switch(e){case"number":const d=Number(r),f=Number(n);c=d-f;break;case"boolean":c=(r?1:0)-(n?1:0);break;case"string":c=String(r).localeCompare(String(n));break;case"array":case"object":c=JSON.stringify(r).localeCompare(JSON.stringify(n));break;case"mixed":case"null":default:c=String(r).localeCompare(String(n));break}return i==="asc"?c:-c}}function Li(e,r,n){if(!n||n.length===0)return e;const i=[...n].sort((a,l)=>a.priority-l.priority);return[...e].sort((a,l)=>{for(const c of i){const d=r.find(m=>m.name===c.column);if(!d)continue;const x=Ni(d.type)(a[c.column],l[c.column],c.direction);if(x!==0)return x}return 0})}function Hi(e){return e===null?"asc":e==="asc"?"desc":null}function Ui(e){return e==="string"||e==="boolean"}function Gi(e){return e.filter(r=>Ui(r.type))}function Yi(e,r){const n={};return r.forEach(i=>{if(i.type==="number"){const a=e.map(l=>l[i.name]).filter(l=>typeof l=="number");a.length>0&&(n[i.name]=a.reduce((l,c)=>l+c,0))}}),n}function qi(e,r,n){if(!n.enabled||n.levels.length===0)return e;const i=yn(e,n.levels,r);return Sn(i,n.collapsedGroups||[])}function yn(e,r,n,i="",a=0){if(a>=r.length)return e;const l=r[a].column,c=new Map;e.forEach(x=>{const m=x[l],b=m==null?"(empty)":String(m);c.has(b)||c.set(b,[]),c.get(b).push(x)});const d=[];return Array.from(c.keys()).sort().forEach(x=>{const m=c.get(x),b=`${l}:${x}`,g=i?`${i}|${b}`:b,v=Yi(m,n),C=a<r.length-1?yn(m,r,n,g,a+1):m,p={key:g,level:a,column:l,value:x,rowCount:m.length,aggregates:v,children:C};d.push(p)}),d}function Sn(e,r,n=[]){for(const i of e)if("key"in i&&"level"in i&&"children"in i){const a=r.includes(i.key);n.push({isGroupHeader:!0,groupKey:i.key,groupLevel:i.level,groupColumn:i.column,groupValue:i.value,rowCount:i.rowCount,aggregates:i.aggregates,isCollapsed:a}),!a&&i.children&&Sn(i.children,r,n)}else n.push(i);return n}function Ji(e,r){const n=e.collapsedGroups||[],i=n.includes(r)?n.filter(a=>a!==r):[...n,r];return{...e,collapsedGroups:i}}function Ki(e,r){return e==null?"":typeof e=="number"?`Σ ${e.toLocaleString()}`:String(e)}function Xi(e,r,n){return`${r}: ${n}`}function lr(e,r){if(!r||!r.enabled||!r.levels||r.levels.length===0)return[...e];const n=r.levels.map(a=>a.column),i=e.filter(a=>!n.includes(a));return[...n,...i]}function vn(e,r,n){if(!r||!r.enabled||!r.levels||r.levels.length===0)return[...e];const i=r.levels.map(l=>l.column),a=e.filter(l=>!i.includes(l));if(n){const l=[],c=new Set(i),d=new Set(a);let f=0;for(const x of n)c.has(x)?l.push(x):d.has(x)&&f<a.length?(l.push(a[f]),f++):d.has(x)||l.push(x);for(let x=f;x<a.length;x++)l.includes(a[x])||l.push(a[x]);return l}return[...e]}function Gr(e){const r={},n=[],i={};return e.forEach(a=>{r[a.name]=!0,n.push(a.name),i[a.name]=150}),{id:"default-view",name:"Default View",description:"Unfiltered, unsorted baseline view",isDefault:!0,snapshot:{filters:[],sortStack:[],columnVisibility:r,columnOrder:n,columnWidths:i,grouping:null}}}function Qi(e,r,n,i,a,l,c,d){const f={},x=[],m={};n.forEach(v=>{f[v.name]=!0,x.push(v.name),m[v.name]=150});const g=vn(a||x,c||null,d||x);return{filters:e||[],sortStack:r||[],columnVisibility:i||f,columnOrder:g,columnWidths:l||m,grouping:c||null}}function Zi(e,r){const n=f=>{if(f==null)return f;if(Array.isArray(f))return f.map(x=>n(x));if(typeof f=="object"){const x={};return Object.keys(f).sort().forEach(m=>{x[m]=n(f[m])}),x}return f},i=f=>JSON.stringify(n(f));if(i(e.filters)!==i(r.filters)||i(e.sortStack)!==i(r.sortStack)||i(e.columnVisibility)!==i(r.columnVisibility))return!0;const a=[...e.columnOrder||[]].sort().join(","),l=[...r.columnOrder||[]].sort().join(",");if(a!==l)return!1;const c=[...r.columnOrder||[]].sort().join(",");if((r.columnOrder||[]).join(",")!==c){if((e.columnOrder||[]).join(",")!==(r.columnOrder||[]).join(","))return!0}else{const f=[...e.columnOrder||[]].sort().join(",");if((e.columnOrder||[]).join(",")!==f)return!0}return i(e.columnWidths)!==i(r.columnWidths)||i(e.grouping)!==i(r.grouping)}function es(e){return!e||e.length===0?"None":e.sort((r,n)=>r.priority-n.priority).map(r=>`${r.column} ${r.direction==="asc"?"↑":"↓"}`).join(", ")}function ts(e,r){var p,T,s;const n=[],i=JSON.stringify(e.filters),a=JSON.stringify(r.filters);if(i!==a){const k=e.filters.length,D=r.filters.length;k>D?n.push({category:"filters",label:"Filters Added",description:`${k-D} new filter${k-D>1?"s":""} added`}):k<D?n.push({category:"filters",label:"Filters Removed",description:`${D-k} filter${D-k>1?"s":""} removed`}):n.push({category:"filters",label:"Filters Modified",description:"Filter conditions have been changed"})}const l=JSON.stringify(e.sortStack),c=JSON.stringify(r.sortStack);if(l!==c){const k=e.sortStack.length,D=r.sortStack.length;k>D?n.push({category:"sorting",label:"Sorting Added",description:`${k-D} new sort rule${k-D>1?"s":""} added`}):k<D?n.push({category:"sorting",label:"Sorting Removed",description:`${D-k} sort rule${D-k>1?"s":""} removed`}):n.push({category:"sorting",label:"Sorting Modified",description:"Sort rules or order have been changed"})}const d=JSON.stringify(e.columnVisibility),f=JSON.stringify(r.columnVisibility);if(d!==f){const k=Object.values(e.columnVisibility).filter(A=>A).length,D=Object.values(r.columnVisibility).filter(A=>A).length;k>D?n.push({category:"visibility",label:"Columns Shown",description:`${k-D} column${k-D>1?"s":""} made visible`}):k<D?n.push({category:"visibility",label:"Columns Hidden",description:`${D-k} column${D-k>1?"s":""} hidden`}):n.push({category:"visibility",label:"Column Visibility Changed",description:"Column visibility settings have been modified"})}const x=JSON.stringify(e.columnOrder),m=JSON.stringify(r.columnOrder);x!==m&&n.push({category:"order",label:"Column Order Changed",description:"Columns have been reordered"});const b=JSON.stringify(e.columnWidths),g=JSON.stringify(r.columnWidths);if(b!==g){const k=Object.keys(e.columnWidths).filter(D=>e.columnWidths[D]!==r.columnWidths[D]).length;n.push({category:"widths",label:"Column Widths Adjusted",description:`${k} column width${k>1?"s":""} modified`})}const v=JSON.stringify(e.grouping),C=JSON.stringify(r.grouping);if(v!==C){const k=(p=e.grouping)==null?void 0:p.enabled,D=(T=r.grouping)==null?void 0:T.enabled;if(k&&!D){const A=((s=e.grouping)==null?void 0:s.levels.length)||0;n.push({category:"grouping",label:"Grouping Applied",description:`${A} grouping level${A>1?"s":""} added`})}else!k&&D?n.push({category:"grouping",label:"Grouping Removed",description:"All grouping has been cleared"}):n.push({category:"grouping",label:"Grouping Modified",description:"Grouping configuration has been changed"})}return n}const Cn="urm_report_";function rs(e,r){try{const n=`${Cn}${e}`;localStorage.setItem(n,JSON.stringify(r))}catch(n){console.error("Failed to save report state:",n)}}function os(e){try{const r=`${Cn}${e}`,n=localStorage.getItem(r);return n?JSON.parse(n):null}catch(r){return console.error("Failed to load report state:",r),null}}function Er(e,r,n=0){const i=[];for(const a of e){const l=r.includes(a.key);if(i.push({type:"group",key:a.key,level:n,column:a.column,value:a.value,rowCount:a.rowCount,aggregates:a.aggregates,collapsed:l}),!l&&a.children&&a.children.length>0){const c=a.children[0];if(ns(c)){const d=a.children,f=Er(d,r,n+1);i.push(...f)}else{const d=a.children;for(const f of d)i.push({type:"row",parentGroupKey:a.key,level:n+1,data:f})}}}return i}function ns(e){return e&&typeof e=="object"&&"key"in e&&"level"in e&&"column"in e&&"value"in e&&"rowCount"in e&&"aggregates"in e&&"children"in e}function so(e){return e.filter(r=>r.type==="row").map(r=>r.type==="row"?r.data:null).filter(r=>r!==null)}function ao(e,r){const n=new Date,i=n.getFullYear(),a=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0"),c=`${i}-${a}-${l}`;return`${e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}_${c}.${r}`}function jo(e,r,n,i,a,l,c){let d,f;l?(d={...l},f=c||r.map(m=>m.name)):a?(d={...a.snapshot.columnVisibility},f=c||[...a.snapshot.columnOrder]):(d={},f=[],r.forEach(m=>{d[m.name]=!0,f.push(m.name)}));const x=Object.entries(d).filter(([m,b])=>!b).map(([m,b])=>m);return{data:e,schema:r,appliedFilters:n,appliedSortStack:i,columnVisibility:d,columnOrder:f,grouping:(a==null?void 0:a.snapshot.grouping)??null,hiddenColumns:x,viewMeta:a?{id:a.id,name:a.name,isDefault:a.isDefault}:void 0}}function wo(e,r="export",n){const{data:i,columnOrder:a,grouping:l}=e,c=a.filter(b=>e.columnVisibility[b]);let d;if(l&&l.enabled){const b=Er(i);d=so(b)}else d=i;const f=c.join(","),x=d.map(b=>c.map(g=>{const v=b[g];if(v==null)return"";const C=String(v);return C.includes(",")||C.includes('"')||C.includes(`
2
+ `)?`"${C.replace(/"/g,'""')}"`:C}).join(",")),m=[f,...x].join(`
3
+ `);jn(m,ao(r,"csv"),"text/csv;charset=utf-8;")}function ko(e,r="export",n){const{data:i,columnOrder:a,grouping:l}=e,c=a.filter(b=>e.columnVisibility[b]);let d;if(l&&l.enabled){const b=Er(i);d=so(b)}else d=i;const f=[c,...d.map(b=>c.map(g=>b[g]??""))],x=yr.utils.aoa_to_sheet(f),m=yr.utils.book_new();yr.utils.book_append_sheet(m,x,"Data"),yr.writeFile(m,ao(r,"xlsx"))}function To(e,r="export",n){const{data:i,appliedFilters:a,appliedSortStack:l,viewMeta:c,hiddenColumns:d,columnOrder:f,grouping:x}=e;let m;if(x&&x.enabled){const v=Er(i);m=so(v)}else m=i;const b={meta:{exportedAt:new Date().toISOString(),reportName:r,view:(c==null?void 0:c.name)||"Default View",filters:a.map(v=>({field:v.column,operator:v.operator,value:v.value})),sortStack:l.map(v=>({field:v.column,direction:v.direction,priority:v.priority})),grouping:x||{},hiddenColumns:d,columnOrder:f,exportConfig:n||{scope:"visible"}},data:m},g=JSON.stringify(b,null,2);jn(g,ao(r,"json"),"application/json;charset=utf-8;")}function jn(e,r,n){const i=new Blob([e],{type:n}),a=URL.createObjectURL(i),l=document.createElement("a");l.href=a,l.download=r,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(a)}const zo=10;function is(e,r){const n=r.trim();if(!n)return e;const i=e.findIndex(l=>l.query.toLowerCase()===n.toLowerCase());let a;return i!==-1?a=[{...e[i],lastUsed:Date.now()},...e.slice(0,i),...e.slice(i+1)]:a=[{query:n,isFavourite:!1,lastUsed:Date.now()},...e],a.length>zo&&(a=[...a].sort((c,d)=>c.isFavourite&&!d.isFavourite?-1:!c.isFavourite&&d.isFavourite?1:d.lastUsed-c.lastUsed).slice(0,zo)),a}function ss(e,r){return e.map(n=>n.query===r?{...n,isFavourite:!n.isFavourite}:n)}function as(e,r){return e.filter(n=>n.query!==r)}function ls(e){const r=e.filter(i=>i.isFavourite).sort((i,a)=>a.lastUsed-i.lastUsed),n=e.filter(i=>!i.isFavourite).sort((i,a)=>a.lastUsed-i.lastUsed);return[...r,...n]}const cs={owner:["view_report","edit_columns","edit_filters","edit_sorting","edit_views","create_views","delete_views","delete_report","export_data"],editor:["view_report","edit_columns","edit_filters","edit_sorting","edit_views","create_views","delete_views","export_data"],viewer:["view_report","export_data"]};function ds(e,r){return!e||e.owner===r?"owner":e.editors.includes(r)?"editor":(e.viewers.includes(r),"viewer")}function Xe(e,r){return cs[r].includes(e)}function Qe(e){return`You do not have permission to ${{view_report:"view this report",edit_columns:"modify columns",edit_filters:"modify filters",edit_sorting:"modify sorting",edit_views:"edit views",create_views:"create views",delete_views:"delete views",delete_report:"delete this report",export_data:"export data"}[e]||"perform this action"}.`}function us(e){return e==="viewer"}const Eo=1e3;function fs(){return`EVT_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}function wn(e,r,n,i,a,l){return{id:fs(),user:r,reportId:e,feature:n,action:i,timestamp:new Date().toISOString(),previousState:a,newState:l}}function kn(e,r){const n=[r,...e];return n.length>Eo?n.slice(0,Eo):n}function ps(e){return{filter_added:"Filter Added",filter_removed:"Filter Removed",filter_updated:"Filter Updated",filter_cleared:"All Filters Cleared",sort_level_added:"Sort Level Added",sort_level_removed:"Sort Level Removed",sort_reordered:"Sort Reordered",sort_cleared:"All Sorting Cleared",group_level_added:"Group Level Added",group_level_removed:"Group Level Removed",group_reordered:"Group Reordered",group_cleared:"All Grouping Cleared",column_hidden:"Column Hidden",column_shown:"Column Shown",column_reordered:"Columns Reordered",column_resized:"Column Resized",view_created:"View Created",view_updated:"View Updated",view_deleted:"View Deleted",view_set_default:"View Set as Default",view_switched:"View Switched",theme_changed:"Theme Changed",export_triggered:"Export Triggered",export_csv:"Exported as CSV",export_excel:"Exported as Excel",export_json:"Exported as JSON",preset_created:"Preset Created",preset_applied:"Preset Applied",preset_deleted:"Preset Deleted",preset_link_copied:"Preset Link Copied",error_occurred:"Error Occurred"}[e]||e}function xs(e){return{filters:"Filters",sorting:"Sorting",grouping:"Grouping",columns:"Columns",views:"Views",theme:"Theme",export:"Export",presets:"Presets",system:"System"}[e]||e}function hs(e){return{filters:"bg-blue-100 text-blue-800 border-blue-200",sorting:"bg-purple-100 text-purple-800 border-purple-200",grouping:"bg-green-100 text-green-800 border-green-200",columns:"bg-orange-100 text-orange-800 border-orange-200",views:"bg-pink-100 text-pink-800 border-pink-200",theme:"bg-gray-100 text-gray-800 border-gray-200",export:"bg-cyan-100 text-cyan-800 border-cyan-200",presets:"bg-indigo-100 text-indigo-800 border-indigo-200",system:"bg-red-100 text-red-800 border-red-200"}[e]||"bg-gray-100 text-gray-800 border-gray-200"}function ms(e){const r=new Date(e),i=new Date().getTime()-r.getTime(),a=Math.floor(i/6e4),l=Math.floor(i/36e5),c=Math.floor(i/864e5);return a<1?"Just now":a<60?`${a} minute${a>1?"s":""} ago`:l<24?`${l} hour${l>1?"s":""} ago`:c<7?`${c} day${c>1?"s":""} ago`:r.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}function Io(e){return e==null?"None":typeof e=="string"||typeof e=="number"||typeof e=="boolean"?String(e):JSON.stringify(e,null,2)}const Bo=100;function gs(){return`preset_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}function bs(e){var l;const r=(l=e.views)==null?void 0:l.find(c=>c.id===e.activeViewId),n=r==null?void 0:r.snapshot.columnOrder,i=e.columnOrder||[],a=vn(i,e.grouping||null,n);return{filters:e.filters?[...e.filters]:[],sortStack:e.sortStack?[...e.sortStack]:[],columnVisibility:e.columnVisibility?{...e.columnVisibility}:{},columnOrder:a,columnWidths:e.columnWidths?{...e.columnWidths}:{},grouping:e.grouping?{...e.grouping}:null,activeViewId:e.activeViewId}}function ys(e,r,n,i){return{id:gs(),name:e,description:r,createdBy:n,createdAt:Date.now(),config:i}}function Ss(e,r){const n=e||[];if(n.length>=Bo)throw new Error(`Maximum of ${Bo} presets reached. Please delete old presets first.`);return[...n,r]}function Do(e,r){return(e||[]).filter(i=>i.id!==r)}function Oo(e,r){if(e)return e.find(n=>n.id===r)}function Yr(e,r){return`${window.location.origin+window.location.pathname}?mode=viewer&reportId=${e}&preset=${r}`}function Ao(e){window.open(e,"_blank","noopener,noreferrer")}function vs(e,r,n,i){const a=encodeURIComponent(`Shared Report Preset: ${r}`);let l=`I'm sharing a report preset with you:
4
+
5
+ `;l+=`Preset Name: ${r}
6
+ `,i&&(l+=`Description: ${i}
7
+ `),l+=`
8
+ Click the link below to view the report with this configuration:
9
+ ${n}
10
+
11
+ `,l+="This link will load the report with pre-configured filters, sorting, and column settings.";const c=encodeURIComponent(l);return`mailto:${e.join(",")}?subject=${a}&body=${c}`}function Cs(){return typeof window>"u"?null:new URLSearchParams(window.location.search).get("preset")}function js(e){const r=e.columnOrder,n=lr(r,e.grouping);return{filters:e.filters.length>0?[...e.filters]:void 0,sortStack:e.sortStack.length>0?[...e.sortStack]:void 0,columnVisibility:{...e.columnVisibility},columnOrder:n,columnWidths:{...e.columnWidths},grouping:e.grouping?{...e.grouping}:null,activeViewId:e.activeViewId}}async function Ro(e){try{if(navigator.clipboard&&navigator.clipboard.writeText)return await navigator.clipboard.writeText(e),!0}catch(r){console.warn("Clipboard API blocked, using fallback method:",r)}try{const r=document.createElement("textarea");r.value=e,r.style.position="fixed",r.style.top="0",r.style.left="0",r.style.width="2em",r.style.height="2em",r.style.padding="0",r.style.border="none",r.style.outline="none",r.style.boxShadow="none",r.style.background="transparent",r.style.opacity="0",document.body.appendChild(r),r.focus(),r.select();let n=!1;try{n=document.execCommand("copy")}catch(i){console.error("execCommand copy failed:",i)}return document.body.removeChild(r),n}catch(r){return console.error("Fallback copy method failed:",r),!1}}function ws(e,r){return{totalRows:e.length,totalColumns:r.length}}const ks={MAX_CACHE_ENTRIES:3};function Ts(e,r){let n=null;return function(...a){const l=()=>{n=null,e(...a)};n&&clearTimeout(n),n=setTimeout(l,r)}}class Sr{constructor(r=ks.MAX_CACHE_ENTRIES){this.cache=new Map,this.maxEntries=r}get(r){const n=this.cache.get(r);return n?n.value:null}set(r,n){var i;if(this.cache.size>=this.maxEntries&&!this.cache.has(r)){const a=(i=Array.from(this.cache.entries()).sort((l,c)=>l[1].timestamp-c[1].timestamp)[0])==null?void 0:i[0];a&&this.cache.delete(a)}this.cache.set(r,{key:r,value:n,timestamp:Date.now()})}has(r){return this.cache.has(r)}clear(){this.cache.clear()}size(){return this.cache.size}}class zs{constructor(){this.metrics=new Map}start(r){this.metrics.set(r,performance.now())}end(r){const n=this.metrics.get(r);if(!n)return 0;const i=performance.now()-n;return this.metrics.delete(r),i}measure(r,n){this.start(r);const i=n(),a=this.end(r);return{result:i,duration:a}}async measureAsync(r,n){this.start(r);const i=await n(),a=this.end(r);return{result:i,duration:a}}}function ct(e,r,n,i){const a=n instanceof Error?n.message:n,l={type:e,context:r,message:a,details:i,timestamp:Date.now(),recoverable:Es(e,r)};return process.env.NODE_ENV==="development"&&console.error("[Report Error]",{type:e,context:r,message:a,details:i}),l}function Es(e,r){return e==="ui"||e==="processing"&&["filters","sorting","grouping","columns"].includes(r)?!0:e!=="system"}function Is(e){const n={filters:"There was an issue applying filters",sorting:"Sorting could not be applied",grouping:"Grouping configuration failed",columns:"Column configuration could not be updated",views:"View operation failed",presets:"Preset could not be applied",export:"Export failed",upload:"File upload failed",search:"Search operation failed"}[e.context]||"An error occurred";return e.recoverable?`${n}. Your previous state has been restored.`:`${n}. Please refresh the page.`}function Bs(e){return{filters:e.filters?[...e.filters]:void 0,sortStack:e.sortStack?[...e.sortStack]:void 0,grouping:e.grouping?{...e.grouping}:void 0,columnVisibility:e.columnVisibility?{...e.columnVisibility}:void 0,columnOrder:e.columnOrder?[...e.columnOrder]:void 0,columnWidths:e.columnWidths?{...e.columnWidths}:void 0,activeViewId:e.activeViewId}}function Ds(e,r,n){n(e.id,{filters:r.filters,sortStack:r.sortStack,grouping:r.grouping,columnVisibility:r.columnVisibility,columnOrder:r.columnOrder,columnWidths:r.columnWidths,activeViewId:r.activeViewId})}function Os(e,r,n){return["equals","contains","starts_with","ends_with","gt","gte","lt","lte"].includes(r)&&(n==null||n==="")?{isValid:!1,errorMessage:"Value is required for this operator"}:e==="number"&&["gt","gte","lt","lte","equals"].includes(r)&&isNaN(Number(n))?{isValid:!1,errorMessage:"Value must be a valid number"}:e==="date"&&n&&isNaN(Date.parse(n))?{isValid:!1,errorMessage:"Value must be a valid date"}:{isValid:!0}}function Tn(e,r){const n=[],i=[],a=new Set(r.map(l=>l.name));return e.forEach(l=>{a.has(l.column)?n.push(l):i.push(l.column)}),{validRules:n,invalidColumns:i}}function zn(e,r){if(!e||!e.levels||e.levels.length===0)return{validGrouping:null,invalidColumns:[]};const n=new Set(r.map(l=>l.name)),i=[],a=[];return e.levels.forEach(l=>{n.has(l.column)?i.push(l):a.push(l.column)}),i.length===0?{validGrouping:null,invalidColumns:a}:{validGrouping:{...e,levels:i},invalidColumns:a}}function As(e,r){const n=[],i=new Set(r.map(l=>l.name)),a={...e};if(a.filters&&Array.isArray(a.filters)){const l=a.filters.filter(c=>{const d=i.has(c.column);return d||n.push(`Filter for column "${c.column}" ignored (column not found)`),d});a.filters=l.length>0?l:void 0}if(a.sortStack&&Array.isArray(a.sortStack)){const{validRules:l,invalidColumns:c}=Tn(a.sortStack,r);c.length>0&&n.push(`Sort rules for columns ignored: ${c.join(", ")}`),a.sortStack=l.length>0?l:void 0}if(a.grouping){const{validGrouping:l,invalidColumns:c}=zn(a.grouping,r);c.length>0&&n.push(`Grouping for columns ignored: ${c.join(", ")}`),a.grouping=l}if(a.columnVisibility){const l={};Object.entries(a.columnVisibility).forEach(([c,d])=>{i.has(c)?l[c]=d:n.push(`Column visibility for "${c}" ignored (column not found)`)}),a.columnVisibility=Object.keys(l).length>0?l:void 0}if(a.columnOrder&&Array.isArray(a.columnOrder)){const l=a.columnOrder.filter(c=>{const d=i.has(c);return d||n.push(`Column "${c}" in order ignored (column not found)`),d});a.columnOrder=l.length>0?l:void 0}if(a.columnWidths){const l={};Object.entries(a.columnWidths).forEach(([c,d])=>{i.has(c)?l[c]=d:n.push(`Column width for "${c}" ignored (column not found)`)}),a.columnWidths=Object.keys(l).length>0?l:void 0}return{sanitizedConfig:a,warnings:n}}function Rs(e,r){return ct("processing","export",e,{retryAvailable:!!(r!=null&&r.onRetry)})}function Mo(e,r,n,i){const a=wn(e,r,"system","error_occurred",null,{errorType:n.type,errorContext:n.context,errorMessage:n.message,recoverable:n.recoverable,timestamp:n.timestamp});return kn(i||[],a)}function Ms(e){return e==null}function Ps(e,r){const{operator:n,value:i}=r;if(n==="NULL")return e==null;if(n==="NOT_NULL")return e!=null;if(Ms(e))return!1;switch(n){case"equals":return String(e)===String(i);case"contains":return String(e).toLowerCase().includes(String(i).toLowerCase());case"startsWith":return String(e).toLowerCase().startsWith(String(i).toLowerCase());case"endsWith":return String(e).toLowerCase().endsWith(String(i).toLowerCase());case"gt":return Number(e)>Number(i);case"lt":return Number(e)<Number(i);case"gte":return Number(e)>=Number(i);case"lte":return Number(e)<=Number(i);case"isTrue":return e===!0;case"isFalse":return e===!1;default:return!0}}function Ws(e,r){return!r||r.length===0?e:e.filter(n=>r.every(i=>Ps(n[i.column],i)))}function Po(e){switch(e){case"string":return[{value:"equals",label:"Equals"},{value:"contains",label:"Contains"},{value:"startsWith",label:"Starts with"},{value:"endsWith",label:"Ends with"},{value:"NULL",label:"Is NULL"},{value:"NOT_NULL",label:"Is NOT NULL"}];case"number":return[{value:"equals",label:"="},{value:"gt",label:">"},{value:"lt",label:"<"},{value:"gte",label:"≥"},{value:"lte",label:"≤"}];case"boolean":return[{value:"isTrue",label:"Is true"},{value:"isFalse",label:"Is false"},{value:"NULL",label:"Is NULL"},{value:"NOT_NULL",label:"Is NOT NULL"}];case"mixed":case"null":case"array":case"object":default:return[]}}function vr(e){return e!=="isTrue"&&e!=="isFalse"&&e!=="NULL"&&e!=="NOT_NULL"}function _s({data:e,filters:r}){return{filteredData:u.useMemo(()=>!r||r.length===0?e:Ws(e,r),[e,r])}}function En(e,r,n,i){if(!n||n.trim()==="")return e;const a=n.toLowerCase().trim(),l=r.filter(c=>i.includes(c.name));return e.filter(c=>l.some(d=>{const f=c[d.name];return f==null?!1:String(f).toLowerCase().includes(a)}))}function $s({data:e,searchQuery:r,schema:n,visibleColumns:i}){return{searchedData:u.useMemo(()=>!r||r.trim()===""?e:En(e,n,r,i),[e,r,n,i])}}function Fs({data:e,sortStack:r,schema:n}){return{sortedData:u.useMemo(()=>!r||r.length===0?e:Li(e,n,r),[e,r,n])}}function Vs({data:e,grouping:r,schema:n}){const i=u.useMemo(()=>!r||!r.enabled||r.levels.length===0?e:qi(e,n,r),[e,r,n]),a=(r==null?void 0:r.enabled)&&((r==null?void 0:r.levels.length)||0)>0;return{groupedData:i,isGrouped:a}}function Ns({schema:e,columnVisibility:r,columnOrder:n}){const i=u.useMemo(()=>n.filter(d=>r[d]!==!1),[n,r]),a=u.useMemo(()=>Object.entries(r).filter(([d,f])=>!f).map(([d,f])=>d),[r]),l=u.useMemo(()=>n.map(d=>e.find(x=>x.name===d)||{name:d,type:"string"}),[n,e]),c=u.useMemo(()=>i.map(d=>e.find(x=>x.name===d)||{name:d,type:"string"}),[i,e]);return{visibleColumns:i,hiddenColumns:a,allColumns:l,visibleColumnSchemas:c,hiddenCount:a.length}}function Ls({views:e,activeViewId:r,currentState:n}){const i=u.useMemo(()=>e.find(x=>x.id===r),[e,r]),a=u.useMemo(()=>i?Zi(n,i.snapshot):!1,[i,n]),l=u.useMemo(()=>e.find(x=>x.isDefault),[e]),c=u.useMemo(()=>e.filter(x=>!x.isDefault&&!x.isDeleted),[e]),d=u.useMemo(()=>e.filter(x=>x.isFavorite&&!x.isDeleted),[e]),f=u.useMemo(()=>e.filter(x=>x.isDeleted),[e]);return{activeView:i,isDirty:a,defaultView:l,customViews:c,favoriteViews:d,deletedViews:f,isDefaultView:(i==null?void 0:i.isDefault)||!1}}function Hs({data:e,enabled:r=!1,pageSize:n=100,initialPage:i=1}){const[a,l]=u.useState(i),c=e.length,d=Math.ceil(c/n),f=u.useMemo(()=>{if(!r)return e;const v=(a-1)*n,C=v+n;return e.slice(v,C)},[e,r,a,n]),x=u.useCallback(v=>{const C=Math.max(1,Math.min(v,d));l(C)},[d]),m=u.useCallback(()=>{a<d&&l(a+1)},[a,d]),b=u.useCallback(()=>{a>1&&l(a-1)},[a]),g=u.useCallback(()=>{l(1)},[]);return{paginatedData:f,currentPage:a,totalPages:d,pageSize:n,totalRows:c,goToPage:x,nextPage:m,prevPage:b,resetPage:g,hasNextPage:a<d,hasPrevPage:a>1}}function Us(e){const{rawData:r,schema:n,filters:i,sortStack:a,grouping:l,searchQuery:c,columnVisibility:d,columnOrder:f,columnWidths:x,views:m,activeViewId:b,pagination:g}=e,v=u.useMemo(()=>({filters:i,sortStack:a,grouping:l,columnVisibility:d,columnOrder:f,columnWidths:x}),[i,a,l,d,f,x]),C=Ls({views:m,activeViewId:b,currentState:v}),p=Ns({schema:n,columnVisibility:d,columnOrder:f}),{filteredData:T}=_s({data:r,filters:i}),{sortedData:s}=Fs({data:T,sortStack:a,schema:n}),{groupedData:k,isGrouped:D}=Vs({data:s,grouping:l,schema:n}),{searchedData:A}=$s({data:k,searchQuery:c,schema:n,visibleColumns:p.visibleColumns}),S=Hs({data:A,enabled:(g==null?void 0:g.enabled)||!1,pageSize:(g==null?void 0:g.pageSize)||100,initialPage:(g==null?void 0:g.currentPage)||1}),R=g!=null&&g.enabled?S.paginatedData:A,Y=u.useMemo(()=>({totalRows:r.length,filteredRows:T.length,sortedRows:s.length,groupedRows:D?k.length:s.length,searchedRows:A.length,visibleRows:R.length,hiddenColumns:p.hiddenCount,activeFilters:i.length,activeSorts:a.length,isGrouped:D}),[r.length,T.length,s.length,k.length,A.length,R.length,p.hiddenCount,i.length,a.length,D]);return{data:R,filteredData:T,sortedData:s,groupedData:k,searchedData:A,viewEngine:C,columnEngine:p,paginationEngine:S,metrics:Y,isGrouped:D,isPaginated:(g==null?void 0:g.enabled)||!1}}const St="user-demo-001";function Gs(e={}){var go,bo,yo,So,vo;const{mode:r="builder",autoLoad:n=!0,initialData:i,config:a={}}=e,[l,c]=u.useState([]),[d,f]=u.useState(""),[x,m]=u.useState(!1),[b,g]=u.useState(!1),[v,C]=u.useState({message:"",severity:"info",open:!1}),p=(y,j="info")=>{C({message:y,severity:j,open:!0})},T=()=>C(y=>({...y,open:!1})),s=l.find(y=>y.id===d),[k,D]=u.useState("idle"),[A,S]=u.useState(!1),[R,Y]=u.useState(!1),[_,K]=u.useState(!1),[V,te]=u.useState(!1),[h,F]=u.useState(!1),[W,E]=u.useState(!1),[H,de]=u.useState(void 0),[ue,Be]=u.useState(null),[O,N]=u.useState(null),[Q,X]=u.useState(!1),[Z,re]=u.useState(!1),[J,q]=u.useState(null),[oe,ie]=u.useState(!1),[se,ve]=u.useState(!1),[$,De]=u.useState({enabled:!1,levels:[],collapsedGroups:[]}),[Ae,et]=u.useState(""),[tt,Fe]=u.useState(new Set),[Le,Me]=u.useState(1),[ft,At]=u.useState(10),[pt,xt]=u.useState(!1),[ht,rt]=u.useState(!1),[Rt,ot]=u.useState(!1),[Gt,kt]=u.useState(!1),[Te,nt]=u.useState(null),[qe,it]=u.useState(null),[Mt,mt]=u.useState(!1),[Je,hr]=u.useState(null),[Tt,Yt]=u.useState(null);u.useRef(new zs),u.useRef(new Sr),u.useRef(new Sr),u.useRef(new Sr),u.useRef(new Sr);const[Pt,zt]=u.useState(null),gt=u.useRef(null),ye=u.useMemo(()=>s?ds(s.permissions,St):"owner",[s]),qt=us(ye),Jt=u.useMemo(()=>!(s!=null&&s.uploadedData)||!(s!=null&&s.schema)?{totalRows:0,totalColumns:0}:ws(s.uploadedData,s.schema),[s==null?void 0:s.uploadedData,s==null?void 0:s.schema]),Ke=u.useCallback(()=>{s&&(gt.current=Bs(s))},[s]),P=u.useCallback((y,j)=>{c(z=>z.map(I=>I.id===y?{...I,...j}:I))},[]),He=u.useCallback(y=>{if(!s)return;zt(y);const j=Mo(s.id,St,y,s.auditHistory||[]);P(s.id,{auditHistory:j}),p(y.message,"error"),y.recoverable&&gt.current&&setTimeout(()=>{Ds(s,gt.current,P),p("Previous state restored","success")},100)},[s,P]),le=u.useCallback((y,j,z,I)=>{if(!s)return;const G=wn(s.id,St,y,j,z,I),ee=s.auditHistory||[],Se=kn(ee,G);setTimeout(()=>{P(s.id,{auditHistory:Se})},0)},[s,P]);u.useEffect(()=>{if(s!=null&&s.schemaLocked&&s.schema&&(!s.views||s.views.length===0)){const y=Gr(s.schema);P(s.id,{views:[y],activeViewId:y.id,filters:y.snapshot.filters,sortStack:y.snapshot.sortStack,columnVisibility:y.snapshot.columnVisibility,columnOrder:y.snapshot.columnOrder,columnWidths:y.snapshot.columnWidths,grouping:y.snapshot.grouping})}},[s==null?void 0:s.schemaLocked,s==null?void 0:s.schema,s==null?void 0:s.id,P]),u.useEffect(()=>{if(i&&n&&!b&&l.length===0){const y={id:`auto-report-${Date.now()}`,name:r==="viewer"?"Data View":"Imported Data",description:"Auto-generated from external data",schemaLocked:!0,uploadedData:i,schema:Ur(i),permissions:{owner:St,editors:[],viewers:[]}};c([y]),f(y.id),g(!0),D("confirmed")}},[i,n,b,l.length,r]);const Oe=(go=s==null?void 0:s.views)==null?void 0:go.find(y=>y.id===s.activeViewId),fe=Us({rawData:(s==null?void 0:s.uploadedData)||[],schema:(s==null?void 0:s.schema)||[],filters:(s==null?void 0:s.filters)||[],sortStack:(s==null?void 0:s.sortStack)||[],grouping:(s==null?void 0:s.grouping)||null,searchQuery:Ae||"",columnVisibility:(s==null?void 0:s.columnVisibility)||(Oe==null?void 0:Oe.snapshot.columnVisibility)||{},columnOrder:(s==null?void 0:s.columnOrder)||(Oe==null?void 0:Oe.snapshot.columnOrder)||[],columnWidths:(s==null?void 0:s.columnWidths)||(Oe==null?void 0:Oe.snapshot.columnWidths)||{},views:(s==null?void 0:s.views)||[],activeViewId:(s==null?void 0:s.activeViewId)||"",pagination:{enabled:!0,pageSize:ft,currentPage:Le}}),{data:Ue=[],searchedData:bt=[],groupedData:Pe=[],metrics:Kt={totalRows:0,searchedRows:0,isGrouped:!1},isGrouped:Wt=!1,paginationEngine:je}=fe||{},U=((bo=fe.viewEngine)==null?void 0:bo.activeView)||Oe,st=((yo=fe.viewEngine)==null?void 0:yo.isDirty)||!1;u.useEffect(()=>{if(!(!U||!s)&&!s.columnOrder){const y=U.snapshot.columnOrder,j=lr(y,U.snapshot.grouping);P(s.id,{columnOrder:j})}},[s==null?void 0:s.activeViewId]);const We=u.useMemo(()=>!(s!=null&&s.schema)||!U?null:Qi(s.filters||[],s.sortStack||[],s.schema,s.columnVisibility,s.columnOrder,s.columnWidths,s.grouping,U.snapshot.columnOrder),[s==null?void 0:s.filters,s==null?void 0:s.sortStack,s==null?void 0:s.schema,s==null?void 0:s.columnVisibility,s==null?void 0:s.columnOrder,s==null?void 0:s.columnWidths,s==null?void 0:s.grouping,U]),Xt=u.useMemo(()=>!U||!We||!st?[]:ts(We,U.snapshot),[U,We,st]),Qt=u.useCallback((y,j,z)=>{const I={id:`report-${Date.now()}`,name:y,description:j,schemaLocked:!1,permissions:{owner:St,editors:[],viewers:[]}};if(z&&Array.isArray(z)&&z.length>0){const G=Ur(z),ee=Gr(G);I.uploadedData=z,I.schema=G,I.schemaLocked=!0,I.views=[ee],I.activeViewId=ee.id,I.sortStack=ee.snapshot.sortStack,I.filters=ee.snapshot.filters,I.columnVisibility=ee.snapshot.columnVisibility,I.columnOrder=ee.snapshot.columnOrder,I.columnWidths=ee.snapshot.columnWidths,I.grouping=ee.snapshot.grouping}c(G=>[...G,I]),f(I.id),m(!1),D("confirmed")},[]),Zt=u.useCallback(y=>{s&&(D("uploading"),setTimeout(()=>{const j=Ur(y);P(s.id,{uploadedData:y,schema:j,uploadError:void 0}),D("preview")},500))},[s,P]),er=u.useCallback(y=>{s&&(P(s.id,{uploadError:y}),D("idle"))},[s,P]),tr=u.useCallback(()=>{s&&(P(s.id,{uploadError:void 0,uploadedData:void 0,schema:void 0}),D("idle"))},[s,P]),rr=u.useCallback(()=>{s&&(P(s.id,{schemaLocked:!0}),D("confirmed"))},[s,P]),_t=u.useCallback(y=>{if(!s)return;if(!Xe("edit_sorting",ye)){p(Qe("edit_sorting"),"error");return}const j=s.sortStack??[],z=j.find(I=>I.column===y);if(z){const I=Hi(z.direction);if(I===null){const G=j.filter(ee=>ee.column!==y).map((ee,Se)=>({...ee,priority:Se+1}));P(s.id,{sortStack:G.length>0?G:void 0})}else{const G=j.map(ee=>ee.column===y?{...ee,direction:I}:ee);P(s.id,{sortStack:G})}}else{if(j.length>=3)return;const I={column:y,direction:"asc",priority:j.length+1};P(s.id,{sortStack:[...j,I]})}},[s,ye,P]),_e=u.useCallback(y=>{if(s)if(s.schema){const{validRules:j,invalidColumns:z}=Tn(y,s.schema);z.length>0&&p(`Removed invalid sort columns: ${z.join(", ")}`),Ke();try{P(s.id,{sortStack:j.length>0?j:void 0})}catch(I){const G=ct("processing","sorting",I);He(G)}}else P(s.id,{sortStack:y.length>0?y:void 0})},[s,P,Ke,He]),Et=u.useCallback(y=>{if(!s)return;const j=s.sortStack??[],z=j.find(I=>I.column===y);if(!(z&&z.direction==="asc"))if(z){const I=j.map(G=>G.column===y?{...G,direction:"asc"}:G);P(s.id,{sortStack:I})}else{if(j.length>=3)return;const I={column:y,direction:"asc",priority:j.length+1};P(s.id,{sortStack:[...j,I]})}},[s,P]),or=u.useCallback(y=>{if(!s)return;const j=s.sortStack??[],z=j.find(I=>I.column===y);if(!(z&&z.direction==="desc"))if(z){const I=j.map(G=>G.column===y?{...G,direction:"desc"}:G);P(s.id,{sortStack:I})}else{if(j.length>=3)return;const I={column:y,direction:"desc",priority:j.length+1};P(s.id,{sortStack:[...j,I]})}},[s,P]),at=u.useCallback(y=>{var z;if(!s)return;if(!Xe("edit_filters",ye)){p(Qe("edit_filters"),"error");return}const j=(z=s.schema)==null?void 0:z.find(I=>I.name===y.column);if(j&&y.value!==void 0){const I=Os(j.type,y.operator,y.value);if(!I.isValid){p(I.errorMessage||"Invalid filter value","error");return}}Ke();try{const I=s.filters??[];le("filters","filter_added",I,[...I,y]),P(s.id,{filters:[...I,y]})}catch(I){const G=ct("processing","filters",I);He(G)}},[s,ye,P,Ke,He,le]),nr=u.useCallback((y,j)=>{if(!s)return;if(!Xe("edit_filters",ye)){p(Qe("edit_filters"),"error");return}const z=s.filters??[],I=[...z];le("filters","filter_updated",z[y],j),I[y]=j,P(s.id,{filters:I})},[s,ye,P,le]),It=u.useCallback(y=>{if(!s)return;if(!Xe("edit_filters",ye)){p(Qe("edit_filters"),"error");return}const j=s.filters??[],z=j.filter((I,G)=>G!==y);le("filters","filter_removed",j[y],null),P(s.id,{filters:z.length>0?z:void 0})},[s,ye,P,le]),M=u.useCallback(()=>{if(!s)return;if(!Xe("edit_filters",ye)){p(Qe("edit_filters"),"error");return}const y=s.filters??[];le("filters","filter_cleared",y,null),P(s.id,{filters:void 0})},[s,ye,P,le]),L=u.useCallback(y=>{var G;if(!s)return;const j=(G=s.views)==null?void 0:G.find(ee=>ee.id===y);if(!j)return;const z=j.snapshot.columnOrder,I=lr(z,j.snapshot.grouping);P(s.id,{filters:j.snapshot.filters.length>0?[...j.snapshot.filters]:void 0,sortStack:j.snapshot.sortStack.length>0?[...j.snapshot.sortStack]:void 0,columnVisibility:{...j.snapshot.columnVisibility},columnOrder:I,columnWidths:{...j.snapshot.columnWidths},grouping:j.snapshot.grouping,activeViewId:y}),Fe(new Set),K(!1)},[s,P]),ae=u.useCallback((y,j,z)=>{if(!(s!=null&&s.schema)||!We)return;const I={id:`view-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,name:y,description:j||void 0,isDefault:z,isFavorite:!1,isDeleted:!1,createdAt:Date.now(),updatedAt:Date.now(),snapshot:{...We}},G=s.views??[],ee=z?G.map(Se=>({...Se,isDefault:!1})):G;P(s.id,{views:[...ee,I],activeViewId:I.id}),p(`"${y}" view created`,"success")},[s,We,P]),$e=u.useCallback(()=>{var j;if(!U||!We||U.isDefault||!s)return;const y=(j=s.views)==null?void 0:j.map(z=>z.id===U.id?{...z,snapshot:{...We}}:z);P(s.id,{views:y}),p(`"${U.name}" view updated`,"success")},[U,We,s,P]),ce=u.useCallback(()=>{te(!0)},[]),Bt=u.useCallback(()=>{if(!U||!s)return;const y=U.snapshot.columnOrder,j=lr(y,U.snapshot.grouping);P(s.id,{filters:U.snapshot.filters.length>0?[...U.snapshot.filters]:void 0,sortStack:U.snapshot.sortStack.length>0?[...U.snapshot.sortStack]:void 0,columnVisibility:{...U.snapshot.columnVisibility},columnOrder:j,columnWidths:{...U.snapshot.columnWidths},grouping:U.snapshot.grouping}),p("Changes reverted to last saved state","success")},[U,s,P]),Lr=u.useCallback(y=>{if(!(s!=null&&s.views))return;const j=s.views.map(I=>({...I,isDefault:I.id===y}));P(s.id,{views:j});const z=s.views.find(I=>I.id===y);z&&p(`"${z.name}" set as default view`,"success")},[s,P]),mr=u.useCallback(y=>{if(!(s!=null&&s.views))return;const j=s.views.map(I=>I.id===y?{...I,isFavorite:!I.isFavorite,updatedAt:Date.now()}:I);P(s.id,{views:j});const z=s.views.find(I=>I.id===y);z&&!z.isFavorite?p(`"${z.name}" added to favorites`,"success"):z&&p(`"${z.name}" removed from favorites`,"info")},[s,P]),gr=u.useCallback(y=>{if(!(s!=null&&s.views))return;const j=s.views.map(ee=>ee.id===y?{...ee,isDeleted:!0,updatedAt:Date.now()}:ee),z=s.activeViewId===y,I=j.find(ee=>ee.isDefault&&!ee.isDeleted);P(s.id,{views:j,activeViewId:z&&I?I.id:s.activeViewId,filters:z&&I?I.snapshot.filters.length>0?I.snapshot.filters:void 0:s.filters,sortStack:z&&I?I.snapshot.sortStack.length>0?I.snapshot.sortStack:void 0:s.sortStack});const G=s.views.find(ee=>ee.id===y);G&&p(`"${G.name}" moved to Recently Deleted`,"info")},[s,P]),ze=u.useCallback(y=>{if(!(s!=null&&s.views))return;const j=s.views.map(I=>I.id===y?{...I,isDeleted:!1,updatedAt:Date.now()}:I);P(s.id,{views:j});const z=s.views.find(I=>I.id===y);z&&p(`"${z.name}" restored`,"success")},[s,P]),Ie=u.useCallback(y=>{if(!(s!=null&&s.views))return;const j=s.views.find(Re=>Re.id===y),z=s.views.filter(Re=>!Re.isDeleted||Re.id===y);if((j==null?void 0:j.isDefault)&&z.filter(Re=>Re.isDefault).length===1){p("Cannot delete the last default view","error");return}const G=s.views.filter(Re=>Re.id!==y),ee=s.activeViewId===y,Se=G.find(Re=>Re.isDefault&&!Re.isDeleted);P(s.id,{views:G,activeViewId:ee&&Se?Se.id:s.activeViewId,filters:ee&&Se?Se.snapshot.filters.length>0?Se.snapshot.filters:void 0:s.filters,sortStack:ee&&Se?Se.snapshot.sortStack.length>0?Se.snapshot.sortStack:void 0:s.sortStack}),j&&p(`"${j.name}" permanently deleted`,"success")},[s,P]),yt=u.useCallback(y=>{Be(y),F(!0),K(!1)},[]),Hr=u.useCallback((y,j)=>{if(!ue||!(s!=null&&s.views))return;const z=s.views.map(I=>I.id===ue?{...I,name:y,description:j||void 0}:I);P(s.id,{views:z}),Be(null)},[ue,s,P]),Qn=u.useCallback(y=>{N(y),E(!0),K(!1)},[]),Zn=u.useCallback(()=>{if(!O||!(s!=null&&s.views))return;const y=s.views.filter(I=>I.id!==O),j=s.activeViewId===O,z=y.find(I=>I.isDefault);P(s.id,{views:y,activeViewId:j&&z?z.id:s.activeViewId,filters:j&&z?z.snapshot.filters.length>0?z.snapshot.filters:void 0:s.filters,sortStack:j&&z?z.snapshot.sortStack.length>0?z.snapshot.sortStack:void 0:s.sortStack}),N(null),E(!1)},[O,s,P]);u.useEffect(()=>{je!=null&&je.resetPage?je.resetPage():Me(1)},[s==null?void 0:s.filters,Ae,s==null?void 0:s.activeViewId]),u.useEffect(()=>{je&&je.currentPage!==Le&&Me(je.currentPage)},[je==null?void 0:je.currentPage]);const ei=u.useCallback(y=>{je!=null&&je.goToPage&&je.goToPage(y),Me(y)},[je]),ti=u.useCallback(y=>{const j=(Le-1)*ft,z=Math.floor(j/y)+1;At(y),Me(z)},[Le,ft]),ri=u.useCallback((y,j)=>{if(!s)return;if(!Xe("edit_columns",ye)){p(Qe("edit_columns"),"error");return}const I={...s.columnVisibility||(U==null?void 0:U.snapshot.columnVisibility)||{},[y]:j};P(s.id,{columnVisibility:I})},[s,U,ye,P]),oi=u.useCallback(y=>{if(s){if(!Xe("edit_columns",ye)){p(Qe("edit_columns"),"error");return}P(s.id,{columnOrder:y})}},[s,ye,P]),ni=u.useCallback((y,j)=>{if(!s)return;if(!Xe("edit_columns",ye)){p(Qe("edit_columns"),"error");return}const I={...s.columnWidths||(U==null?void 0:U.snapshot.columnWidths)||{},[y]:j};P(s.id,{columnWidths:I})},[s,U,ye,P]),ii=u.useCallback(y=>{if(!s)return;const z=(s.filters??[]).filter(I=>I.column!==y);P(s.id,{filters:z.length>0?z:void 0})},[s,P]),si=u.useCallback(()=>{if(!U||!(s!=null&&s.schema))return;const y={},j=[],z={};s.schema.forEach(I=>{y[I.name]=!0,j.push(I.name),z[I.name]=150}),P(s.id,{columnVisibility:y,columnOrder:j,columnWidths:z,filters:void 0,sortStack:void 0}),p("Reset to default layout - all filters and sorts cleared","success")},[U,s,P]),mo=u.useCallback(Ts(y=>{et(y)},300),[]),ai=u.useCallback(y=>{mo(y)},[mo]),li=u.useCallback(y=>{if(!y.trim()||!s)return;const j=s.searchHistory||[],z=is(j,y);P(s.id,{searchHistory:z})},[s,P]),ci=u.useCallback(y=>{if(!s)return;const j=s.searchHistory||[],z=ss(j,y);P(s.id,{searchHistory:z})},[s,P]),di=u.useCallback(y=>{if(!s)return;const j=s.searchHistory||[],z=as(j,y);P(s.id,{searchHistory:z})},[s,P]),ui=u.useCallback(y=>{Fe(j=>{const z=new Set(j);return z.has(y)?z.delete(y):z.add(y),z})},[]),fi=u.useCallback((y,j)=>{if(y){const z=new Set;for(let I=0;I<j;I++)z.add(I);Fe(z)}else Fe(new Set)},[]),pi=u.useCallback((y,j)=>{Fe(z=>{const I=new Set(z),G=Math.min(y,j),ee=Math.max(y,j);for(let Se=G;Se<=ee;Se++)I.add(Se);return I})},[]),xi=u.useCallback(()=>{Fe(new Set)},[]),hi=u.useCallback(y=>{if(s){if(!Xe("edit_columns",ye)){p(Qe("edit_columns"),"error");return}if(y&&s.schema){const{validGrouping:j,invalidColumns:z}=zn(y,s.schema);z.length>0&&p(`Removed invalid grouping columns: ${z.join(", ")}`,"warning"),Ke();try{const I=s.grouping;j===null?le("grouping","group_cleared",I,null):I?le("grouping","group_reordered",I,j):le("grouping","group_level_added",null,j);const G=(U==null?void 0:U.snapshot.columnOrder)||s.columnOrder||[],ee=lr(G,j);P(s.id,{grouping:j,columnOrder:ee}),JSON.stringify(ee)!==JSON.stringify(s.columnOrder)&&le("columns","column_reordered",s.columnOrder,ee),ve(!1)}catch(I){const G=ct("processing","grouping",I);He(G)}}else{const j=s.grouping;le("grouping","group_cleared",j,null);const z=(U==null?void 0:U.snapshot.columnOrder)||s.columnOrder||[];P(s.id,{grouping:y,columnOrder:[...z]}),JSON.stringify(z)!==JSON.stringify(s.columnOrder)&&le("columns","column_reordered",s.columnOrder,z),ve(!1)}}},[s,U,ye,P,Ke,He,le]),mi=u.useCallback(y=>{if(!s)return;const j=s.grouping;if(!j)return;const z=Ji(j,y);P(s.id,{grouping:z})},[s,P]),gi=u.useCallback(()=>{mt(!0)},[]),$t=u.useCallback(y=>{s!=null&&s.schema&&(X(!0),setTimeout(()=>{try{let j;y.scope==="visible"?j=bt:j=s.uploadedData||[];let z;y.columnScope==="all"?(z={},s.schema.forEach(Re=>{z[Re.name]=!0})):z=s.columnVisibility||(U==null?void 0:U.snapshot.columnVisibility)||{};const I=s.columnOrder||(U==null?void 0:U.snapshot.columnOrder),G=jo(j,s.schema,s.filters??[],s.sortStack??[],U,z,I),ee=s.name;let Se;switch(y.format){case"csv":wo(G,ee,y),Se="export_csv";break;case"excel":ko(G,ee,y),Se="export_excel";break;case"json":To(G,ee,y),Se="export_json";break}le("export",Se,null,{format:y.format,scope:y.scope,columnScope:y.columnScope,rowCount:j.length,viewName:(U==null?void 0:U.name)||"Default View"}),p(`Export completed successfully (${y.format.toUpperCase()})`,"success")}catch(j){const z=Rs(j,{onRetry:()=>$t(y)});p(`Export failed: ${z.message}`,{action:{label:"Retry",onClick:()=>$t(y)}});const I=Mo(s.id,St,z,s.auditHistory||[]);P(s.id,{auditHistory:I}),console.error("Export error:",j)}finally{X(!1)}},500))},[s,U,bt,P,le]),bi=u.useCallback(y=>{if(s!=null&&s.schema){if(st&&U&&!U.isDefault){q(y.format),re(!0),mt(!1);return}$t(y),mt(!1)}},[s,U,st,$t]),br=u.useCallback(y=>{$t({format:y,scope:"visible",columnScope:"visible"})},[$t]),yi=u.useCallback(()=>{J&&br(J),re(!1),q(null)},[J,br]),Si=u.useCallback(()=>{$e(),J&&br(J),re(!1),q(null)},[$e,J,br]),vi=u.useCallback(()=>{re(!1),q(null)},[]),Ci=u.useCallback(y=>{!(s!=null&&s.schema)||tt.size===0||(X(!0),setTimeout(()=>{try{const j=Array.from(tt).sort((G,ee)=>G-ee).map(G=>Pe[G]).filter(G=>G!==void 0),z=jo(j,s.schema,s.filters??[],s.sortStack??[],U),I=`${s.name.toLowerCase().replace(/\s+/g,"_")}_selected_export`;switch(y){case"csv":wo(z,I);break;case"excel":ko(z,I);break;case"json":To(z,I);break}p(`Exported ${j.length} selected rows`,"info")}catch(j){p("Export failed. Please try again.","error"),console.error("Export error:",j)}finally{X(!1)}},500))},[s,U,tt,Pe]),ji=u.useCallback(()=>{if(!Xe("edit_filters",ye)){p(Qe("edit_filters"),"error");return}rt(!0)},[ye]),wi=u.useCallback((y,j,z)=>{if(s)try{const I=bs(s),G=ys(y,j,St,I),ee=Ss(s.presets,G);P(s.id,{presets:ee});const Se=Yr(s.id,G.id);if(le("presets","preset_created",null,{presetId:G.id,name:G.name}),z&&z.length>0){const Re=vs(z,y,Se,j);window.location.href=Re,p(`Preset created! Opening email client to share with ${z.length} recipient${z.length>1?"s":""}...`,"success")}nt({preset:G,url:Se}),rt(!1),ot(!0),p(`Preset "${y}" created successfully`,"success")}catch(I){p(I instanceof Error?I.message:"Failed to create preset","error")}},[s,P,le]),ki=u.useCallback(async()=>{if(!Te)return;await Ro(Te.url)?(le("presets","preset_link_copied",null,{presetId:Te.preset.id}),p("Link copied to clipboard","success")):p("Failed to copy link","error")},[Te,le]),Ti=u.useCallback(()=>{Te&&(Ao(Te.url),le("presets","preset_link_opened",null,{presetId:Te.preset.id}),p("Opening preset in new tab...","info"))},[Te,le]),zi=u.useCallback(()=>{if(!Te||!s)return;const y=Te.preset.id,j=Te.preset.name,z=Do(s.presets,y);P(s.id,{presets:z}),le("presets","preset_deleted",{presetId:y,name:j},null),qe===y&&it(null),ot(!1),nt(null),p(`Preset "${j}" deleted`,"success")},[Te,s,qe,P,le]),Ei=u.useCallback(()=>{it(null),p("Exited preset view","info")},[]),Ii=u.useCallback(()=>{kt(!0)},[]),Bi=u.useCallback(y=>{if(!s)return;const j=Yr(s.id,y);Ao(j),le("presets","preset_link_opened",null,{presetId:y}),p("Opening preset in new tab...","info")},[s,le]),Di=u.useCallback(async(y,j)=>{if(!s)return;const z=Yr(s.id,y);await Ro(z)?(le("presets","preset_link_copied",null,{presetId:y}),p(`Link for "${j}" copied to clipboard`,"success")):p("Failed to copy link. Please try the manual copy method.","error")},[s,le]),Oi=u.useCallback((y,j)=>{if(!s)return;const z=Do(s.presets,y);P(s.id,{presets:z}),le("presets","preset_deleted",{presetId:y,name:j},null),qe===y&&it(null),(Te==null?void 0:Te.preset.id)===y&&(ot(!1),nt(null)),p(`Preset "${j}" deleted`,"success")},[s,qe,Te,P,le]);u.useEffect(()=>{if(!s)return;const y=Cs();if(y&&s.presets&&s.schemaLocked&&s.schema){const j=Oo(s.presets,y);if(j){const{sanitizedConfig:z,warnings:I}=As(j.config,s.schema);I.length>0&&I.forEach(ee=>p(ee,"warning"));const G=js(z);P(s.id,G),it(y),le("presets","preset_applied",null,{presetId:j.id,name:j.name}),p(`Loaded preset: ${j.name}`,"info")}else p("Preset not found","info")}},[s==null?void 0:s.schemaLocked]);const Ai=qe?Oo(s==null?void 0:s.presets,qe):void 0;u.useEffect(()=>{s!=null&&s.views&&s.views.length>0&&s.activeViewId&&rs(s.id,{views:s.views,activeViewId:s.activeViewId})},[s==null?void 0:s.views,s==null?void 0:s.activeViewId,s==null?void 0:s.id]),u.useEffect(()=>{if(s!=null&&s.schemaLocked&&s.schema&&(!s.views||s.views.length===0)){const y=os(s.id);if(y&&y.views.length>0){const j=y.views.find(z=>z.id===y.activeViewId);if(j)P(s.id,{views:y.views,activeViewId:y.activeViewId,filters:j.snapshot.filters.length>0?j.snapshot.filters:void 0,sortStack:j.snapshot.sortStack.length>0?j.snapshot.sortStack:void 0});else{const z=y.views.find(I=>I.isDefault)||Gr(s.schema);P(s.id,{views:y.views,activeViewId:z.id,filters:z.snapshot.filters.length>0?z.snapshot.filters:void 0,sortStack:z.snapshot.sortStack.length>0?z.snapshot.sortStack:void 0})}}}},[s==null?void 0:s.schemaLocked,s==null?void 0:s.schema,s==null?void 0:s.id]);const Ri=u.useCallback(y=>{de(y),S(!0)},[]),Mi=u.useCallback(()=>{S(!1),de(void 0)},[]),Pi=(So=s==null?void 0:s.views)==null?void 0:So.find(y=>y.id===ue),Wi=(vo=s==null?void 0:s.views)==null?void 0:vo.find(y=>y.id===O);return{reports:l,activeReport:s,activeReportId:d,setActiveReportId:f,isModalOpen:x,setIsModalOpen:m,createReport:Qt,updateReport:P,uploadState:k,handleFileUpload:Zt,handleUploadError:er,handleRetry:tr,handleConfirm:rr,paginatedData:Ue,processedData:bt,displayData:Pe,tableMetrics:Kt,isGrouped:Wt,tableEngine:fe,activeView:U,isDirty:st,currentTableState:We,viewChanges:Xt,filters:s==null?void 0:s.filters,showFilterPanel:A,setShowFilterPanel:S,filterFocusColumn:H,handleAddFilter:at,handleUpdateFilter:nr,handleRemoveFilter:It,handleClearAllFilters:M,handleOpenFilterForColumn:Ri,handleCloseFilterPanel:Mi,handleClearFiltersForColumn:ii,sortStack:s==null?void 0:s.sortStack,showSortPanel:R,setShowSortPanel:Y,handleSort:_t,handleUpdateSortStack:_e,handleSortAscending:Et,handleSortDescending:or,views:s==null?void 0:s.views,showManageViews:_,setShowManageViews:K,showCreateViewModal:V,setShowCreateViewModal:te,showEditViewModal:h,setShowEditViewModal:F,showDeleteConfirmation:W,setShowDeleteConfirmation:E,editingView:Pi,deletingView:Wi,editingViewId:ue,deletingViewId:O,handleSelectView:L,handleCreateView:ae,handleUpdateCurrentView:$e,handleSaveAsNewView:ce,handleRevertChanges:Bt,handleToggleDefault:Lr,handleToggleFavorite:mr,handleSoftDelete:gr,handleRestoreView:ze,handlePermanentDelete:Ie,handleEditView:yt,handleSaveEditView:Hr,handleDeleteView:Qn,handleConfirmDelete:Zn,showManageColumns:oe,setShowManageColumns:ie,columnVisibility:s==null?void 0:s.columnVisibility,columnOrder:s==null?void 0:s.columnOrder,columnWidths:s==null?void 0:s.columnWidths,handleUpdateColumnVisibility:ri,handleUpdateColumnOrder:oi,handleUpdateColumnWidth:ni,handleResetColumnLayout:si,showGroupPanel:se,setShowGroupPanel:ve,grouping:s==null?void 0:s.grouping,groupingState:$,handleGroup:hi,handleToggleGroupCollapse:mi,searchQuery:Ae,searchHistory:ls((s==null?void 0:s.searchHistory)||[]),handleSearchChange:ai,handleAddToSearchHistory:li,handleToggleSearchFavourite:ci,handleDeleteSearchHistory:di,selectedRowIds:tt,handleToggleRowSelection:ui,handleToggleAllRows:fi,handleRangeSelection:pi,handleClearSelection:xi,currentPage:Le,pageSize:ft,paginationEngine:je,handlePageChange:ei,handlePageSizeChange:ti,isExporting:Q,showExportModal:Mt,setShowExportModal:mt,showDirtyExportWarning:Z,handleExport:gi,handleExportWithConfig:bi,handleExportSelected:Ci,handleExportAnyway:yi,handleSaveAndExport:Si,handleCancelExport:vi,showAuditHistory:pt,setShowAuditHistory:xt,auditHistory:s==null?void 0:s.auditHistory,showCreatePreset:ht,setShowCreatePreset:rt,showShareLink:Rt,setShowShareLink:ot,showManagePresets:Gt,setShowManagePresets:kt,generatedPreset:Te,activePreset:Ai,activePresetId:qe,handleOpenSharePreset:ji,handleOpenManagePresets:Ii,handleCreatePreset:wi,handleCopyPresetLink:ki,handleOpenPreset:Ti,handleDeletePreset:zi,handleClearActivePreset:Ei,handleOpenPresetById:Bi,handleCopyPresetLinkById:Di,handleDeletePresetById:Oi,userRole:ye,isViewerRole:qt,currentUserId:St,featureLimitWarning:Tt,setFeatureLimitWarning:Yt,datasetMeta:Jt,reportError:Pt,setReportError:zt,handleError:He,schema:s==null?void 0:s.schema,hasSchemaConflicts:s!=null&&s.schema?Vi(s.schema):!1,snack:v,handleSnackClose:T,showSnack:p}}const In=u.createContext(void 0);function lo(e){const{children:r,initialData:n,data:i,mode:a="builder",autoLoad:l=!0,config:c}=e,f=Gs({mode:a,autoLoad:l,initialData:i||n,config:c});return t.jsx(In.Provider,{value:f,children:r})}function co(){const e=u.useContext(In);if(e===void 0)throw new Error("useReportContext must be used within a ReportProvider. Wrap your component tree with <ReportProvider>...</ReportProvider>");return e}function Ys({onCreateReport:e}){return t.jsx(o.Box,{component:"header",sx:{position:"sticky",top:0,zIndex:50,borderBottom:"1px solid",borderColor:"divider",bgcolor:"background.paper"},children:t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:3,height:64},children:[t.jsx(o.Typography,{variant:"h6",component:"h1",sx:{fontWeight:500,fontSize:"1.375rem",color:"text.primary",letterSpacing:"-0.01em"},children:"Reports"}),t.jsx(o.Box,{sx:{display:"flex",alignItems:"center",gap:1.5},children:t.jsx(o.Button,{variant:"contained",startIcon:t.jsx(w.Add,{sx:{fontSize:18}}),onClick:e,sx:{borderRadius:"20px",px:3,textTransform:"none",fontWeight:500,fontSize:"0.875rem",bgcolor:"primary.main",color:"primary.contrastText",py:.75,boxShadow:"none","&:hover":{bgcolor:"primary.dark",boxShadow:2},"&:active":{boxShadow:"none"}},children:"New Report"})})]})})}function qs({reports:e,activeReportId:r,onTabClick:n}){if(e.length===0)return null;const i=e.findIndex(a=>a.id===r);return t.jsx(o.Box,{sx:{position:"sticky",top:64,zIndex:40,borderBottom:1,borderColor:"divider",bgcolor:"background.paper",px:3,pt:.75},children:t.jsx(o.Tabs,{value:i>=0?i:0,onChange:(a,l)=>n(e[l].id),variant:"standard",sx:{minHeight:40,"& .MuiTabs-indicator":{height:3,bgcolor:"#0b57d0"},"& .MuiTabs-flexContainer":{gap:2.5}},children:e.map(a=>t.jsx(o.Tab,{label:t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[a.name,t.jsx(o.Tooltip,{title:a.description||"No description",arrow:!0,placement:"top",children:t.jsx(w.InfoOutlined,{sx:{fontSize:16,opacity:.5,verticalAlign:"middle",flexShrink:0}})})]}),sx:{textTransform:"none",fontWeight:400,fontSize:"0.9375rem",minHeight:40,py:.5,px:0,minWidth:"auto",color:"#5f6368",transition:"color 0.15s ease","&.Mui-selected":{color:"#0b57d0",fontWeight:500},"&:hover":{color:"#202124"}}},a.id))})})}function Ot(e,...r){const n=new URL(`https://mui.com/production-error/?code=${e}`);return r.forEach(i=>n.searchParams.append("args[]",i)),`Minified MUI error #${e}; visit ${n} for the full message.`}const Js="$$material";function Ks(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Cr={exports:{}},jr={exports:{}},pe={};/** @license React v16.13.1
12
+ * react-is.production.min.js
13
+ *
14
+ * Copyright (c) Facebook, Inc. and its affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */var Wo;function Xs(){if(Wo)return pe;Wo=1;var e=typeof Symbol=="function"&&Symbol.for,r=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,i=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,l=e?Symbol.for("react.profiler"):60114,c=e?Symbol.for("react.provider"):60109,d=e?Symbol.for("react.context"):60110,f=e?Symbol.for("react.async_mode"):60111,x=e?Symbol.for("react.concurrent_mode"):60111,m=e?Symbol.for("react.forward_ref"):60112,b=e?Symbol.for("react.suspense"):60113,g=e?Symbol.for("react.suspense_list"):60120,v=e?Symbol.for("react.memo"):60115,C=e?Symbol.for("react.lazy"):60116,p=e?Symbol.for("react.block"):60121,T=e?Symbol.for("react.fundamental"):60117,s=e?Symbol.for("react.responder"):60118,k=e?Symbol.for("react.scope"):60119;function D(S){if(typeof S=="object"&&S!==null){var R=S.$$typeof;switch(R){case r:switch(S=S.type,S){case f:case x:case i:case l:case a:case b:return S;default:switch(S=S&&S.$$typeof,S){case d:case m:case C:case v:case c:return S;default:return R}}case n:return R}}}function A(S){return D(S)===x}return pe.AsyncMode=f,pe.ConcurrentMode=x,pe.ContextConsumer=d,pe.ContextProvider=c,pe.Element=r,pe.ForwardRef=m,pe.Fragment=i,pe.Lazy=C,pe.Memo=v,pe.Portal=n,pe.Profiler=l,pe.StrictMode=a,pe.Suspense=b,pe.isAsyncMode=function(S){return A(S)||D(S)===f},pe.isConcurrentMode=A,pe.isContextConsumer=function(S){return D(S)===d},pe.isContextProvider=function(S){return D(S)===c},pe.isElement=function(S){return typeof S=="object"&&S!==null&&S.$$typeof===r},pe.isForwardRef=function(S){return D(S)===m},pe.isFragment=function(S){return D(S)===i},pe.isLazy=function(S){return D(S)===C},pe.isMemo=function(S){return D(S)===v},pe.isPortal=function(S){return D(S)===n},pe.isProfiler=function(S){return D(S)===l},pe.isStrictMode=function(S){return D(S)===a},pe.isSuspense=function(S){return D(S)===b},pe.isValidElementType=function(S){return typeof S=="string"||typeof S=="function"||S===i||S===x||S===l||S===a||S===b||S===g||typeof S=="object"&&S!==null&&(S.$$typeof===C||S.$$typeof===v||S.$$typeof===c||S.$$typeof===d||S.$$typeof===m||S.$$typeof===T||S.$$typeof===s||S.$$typeof===k||S.$$typeof===p)},pe.typeOf=D,pe}var xe={};/** @license React v16.13.1
19
+ * react-is.development.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var _o;function Qs(){return _o||(_o=1,process.env.NODE_ENV!=="production"&&(function(){var e=typeof Symbol=="function"&&Symbol.for,r=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,i=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,l=e?Symbol.for("react.profiler"):60114,c=e?Symbol.for("react.provider"):60109,d=e?Symbol.for("react.context"):60110,f=e?Symbol.for("react.async_mode"):60111,x=e?Symbol.for("react.concurrent_mode"):60111,m=e?Symbol.for("react.forward_ref"):60112,b=e?Symbol.for("react.suspense"):60113,g=e?Symbol.for("react.suspense_list"):60120,v=e?Symbol.for("react.memo"):60115,C=e?Symbol.for("react.lazy"):60116,p=e?Symbol.for("react.block"):60121,T=e?Symbol.for("react.fundamental"):60117,s=e?Symbol.for("react.responder"):60118,k=e?Symbol.for("react.scope"):60119;function D($){return typeof $=="string"||typeof $=="function"||$===i||$===x||$===l||$===a||$===b||$===g||typeof $=="object"&&$!==null&&($.$$typeof===C||$.$$typeof===v||$.$$typeof===c||$.$$typeof===d||$.$$typeof===m||$.$$typeof===T||$.$$typeof===s||$.$$typeof===k||$.$$typeof===p)}function A($){if(typeof $=="object"&&$!==null){var De=$.$$typeof;switch(De){case r:var Ae=$.type;switch(Ae){case f:case x:case i:case l:case a:case b:return Ae;default:var et=Ae&&Ae.$$typeof;switch(et){case d:case m:case C:case v:case c:return et;default:return De}}case n:return De}}}var S=f,R=x,Y=d,_=c,K=r,V=m,te=i,h=C,F=v,W=n,E=l,H=a,de=b,ue=!1;function Be($){return ue||(ue=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),O($)||A($)===f}function O($){return A($)===x}function N($){return A($)===d}function Q($){return A($)===c}function X($){return typeof $=="object"&&$!==null&&$.$$typeof===r}function Z($){return A($)===m}function re($){return A($)===i}function J($){return A($)===C}function q($){return A($)===v}function oe($){return A($)===n}function ie($){return A($)===l}function se($){return A($)===a}function ve($){return A($)===b}xe.AsyncMode=S,xe.ConcurrentMode=R,xe.ContextConsumer=Y,xe.ContextProvider=_,xe.Element=K,xe.ForwardRef=V,xe.Fragment=te,xe.Lazy=h,xe.Memo=F,xe.Portal=W,xe.Profiler=E,xe.StrictMode=H,xe.Suspense=de,xe.isAsyncMode=Be,xe.isConcurrentMode=O,xe.isContextConsumer=N,xe.isContextProvider=Q,xe.isElement=X,xe.isForwardRef=Z,xe.isFragment=re,xe.isLazy=J,xe.isMemo=q,xe.isPortal=oe,xe.isProfiler=ie,xe.isStrictMode=se,xe.isSuspense=ve,xe.isValidElementType=D,xe.typeOf=A})()),xe}var $o;function Bn(){return $o||($o=1,process.env.NODE_ENV==="production"?jr.exports=Xs():jr.exports=Qs()),jr.exports}/*
26
+ object-assign
27
+ (c) Sindre Sorhus
28
+ @license MIT
29
+ */var qr,Fo;function Zs(){if(Fo)return qr;Fo=1;var e=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function i(l){if(l==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(l)}function a(){try{if(!Object.assign)return!1;var l=new String("abc");if(l[5]="de",Object.getOwnPropertyNames(l)[0]==="5")return!1;for(var c={},d=0;d<10;d++)c["_"+String.fromCharCode(d)]=d;var f=Object.getOwnPropertyNames(c).map(function(m){return c[m]});if(f.join("")!=="0123456789")return!1;var x={};return"abcdefghijklmnopqrst".split("").forEach(function(m){x[m]=m}),Object.keys(Object.assign({},x)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return qr=a()?Object.assign:function(l,c){for(var d,f=i(l),x,m=1;m<arguments.length;m++){d=Object(arguments[m]);for(var b in d)r.call(d,b)&&(f[b]=d[b]);if(e){x=e(d);for(var g=0;g<x.length;g++)n.call(d,x[g])&&(f[x[g]]=d[x[g]])}}return f},qr}var Jr,Vo;function uo(){if(Vo)return Jr;Vo=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Jr=e,Jr}var Kr,No;function Dn(){return No||(No=1,Kr=Function.call.bind(Object.prototype.hasOwnProperty)),Kr}var Xr,Lo;function ea(){if(Lo)return Xr;Lo=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var r=uo(),n={},i=Dn();e=function(l){var c="Warning: "+l;typeof console<"u"&&console.error(c);try{throw new Error(c)}catch{}}}function a(l,c,d,f,x){if(process.env.NODE_ENV!=="production"){for(var m in l)if(i(l,m)){var b;try{if(typeof l[m]!="function"){var g=Error((f||"React class")+": "+d+" type `"+m+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof l[m]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw g.name="Invariant Violation",g}b=l[m](c,m,f,d,null,r)}catch(C){b=C}if(b&&!(b instanceof Error)&&e((f||"React class")+": type specification of "+d+" `"+m+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof b+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),b instanceof Error&&!(b.message in n)){n[b.message]=!0;var v=x?x():"";e("Failed "+d+" type: "+b.message+(v??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Xr=a,Xr}var Qr,Ho;function ta(){if(Ho)return Qr;Ho=1;var e=Bn(),r=Zs(),n=uo(),i=Dn(),a=ea(),l=function(){};process.env.NODE_ENV!=="production"&&(l=function(d){var f="Warning: "+d;typeof console<"u"&&console.error(f);try{throw new Error(f)}catch{}});function c(){return null}return Qr=function(d,f){var x=typeof Symbol=="function"&&Symbol.iterator,m="@@iterator";function b(O){var N=O&&(x&&O[x]||O[m]);if(typeof N=="function")return N}var g="<<anonymous>>",v={array:s("array"),bigint:s("bigint"),bool:s("boolean"),func:s("function"),number:s("number"),object:s("object"),string:s("string"),symbol:s("symbol"),any:k(),arrayOf:D,element:A(),elementType:S(),instanceOf:R,node:V(),objectOf:_,oneOf:Y,oneOfType:K,shape:h,exact:F};function C(O,N){return O===N?O!==0||1/O===1/N:O!==O&&N!==N}function p(O,N){this.message=O,this.data=N&&typeof N=="object"?N:{},this.stack=""}p.prototype=Error.prototype;function T(O){if(process.env.NODE_ENV!=="production")var N={},Q=0;function X(re,J,q,oe,ie,se,ve){if(oe=oe||g,se=se||q,ve!==n){if(f){var $=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw $.name="Invariant Violation",$}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var De=oe+":"+q;!N[De]&&Q<3&&(l("You are manually calling a React.PropTypes validation function for the `"+se+"` prop on `"+oe+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),N[De]=!0,Q++)}}return J[q]==null?re?J[q]===null?new p("The "+ie+" `"+se+"` is marked as required "+("in `"+oe+"`, but its value is `null`.")):new p("The "+ie+" `"+se+"` is marked as required in "+("`"+oe+"`, but its value is `undefined`.")):null:O(J,q,oe,ie,se)}var Z=X.bind(null,!1);return Z.isRequired=X.bind(null,!0),Z}function s(O){function N(Q,X,Z,re,J,q){var oe=Q[X],ie=H(oe);if(ie!==O){var se=de(oe);return new p("Invalid "+re+" `"+J+"` of type "+("`"+se+"` supplied to `"+Z+"`, expected ")+("`"+O+"`."),{expectedType:O})}return null}return T(N)}function k(){return T(c)}function D(O){function N(Q,X,Z,re,J){if(typeof O!="function")return new p("Property `"+J+"` of component `"+Z+"` has invalid PropType notation inside arrayOf.");var q=Q[X];if(!Array.isArray(q)){var oe=H(q);return new p("Invalid "+re+" `"+J+"` of type "+("`"+oe+"` supplied to `"+Z+"`, expected an array."))}for(var ie=0;ie<q.length;ie++){var se=O(q,ie,Z,re,J+"["+ie+"]",n);if(se instanceof Error)return se}return null}return T(N)}function A(){function O(N,Q,X,Z,re){var J=N[Q];if(!d(J)){var q=H(J);return new p("Invalid "+Z+" `"+re+"` of type "+("`"+q+"` supplied to `"+X+"`, expected a single ReactElement."))}return null}return T(O)}function S(){function O(N,Q,X,Z,re){var J=N[Q];if(!e.isValidElementType(J)){var q=H(J);return new p("Invalid "+Z+" `"+re+"` of type "+("`"+q+"` supplied to `"+X+"`, expected a single ReactElement type."))}return null}return T(O)}function R(O){function N(Q,X,Z,re,J){if(!(Q[X]instanceof O)){var q=O.name||g,oe=Be(Q[X]);return new p("Invalid "+re+" `"+J+"` of type "+("`"+oe+"` supplied to `"+Z+"`, expected ")+("instance of `"+q+"`."))}return null}return T(N)}function Y(O){if(!Array.isArray(O))return process.env.NODE_ENV!=="production"&&(arguments.length>1?l("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):l("Invalid argument supplied to oneOf, expected an array.")),c;function N(Q,X,Z,re,J){for(var q=Q[X],oe=0;oe<O.length;oe++)if(C(q,O[oe]))return null;var ie=JSON.stringify(O,function(ve,$){var De=de($);return De==="symbol"?String($):$});return new p("Invalid "+re+" `"+J+"` of value `"+String(q)+"` "+("supplied to `"+Z+"`, expected one of "+ie+"."))}return T(N)}function _(O){function N(Q,X,Z,re,J){if(typeof O!="function")return new p("Property `"+J+"` of component `"+Z+"` has invalid PropType notation inside objectOf.");var q=Q[X],oe=H(q);if(oe!=="object")return new p("Invalid "+re+" `"+J+"` of type "+("`"+oe+"` supplied to `"+Z+"`, expected an object."));for(var ie in q)if(i(q,ie)){var se=O(q,ie,Z,re,J+"."+ie,n);if(se instanceof Error)return se}return null}return T(N)}function K(O){if(!Array.isArray(O))return process.env.NODE_ENV!=="production"&&l("Invalid argument supplied to oneOfType, expected an instance of array."),c;for(var N=0;N<O.length;N++){var Q=O[N];if(typeof Q!="function")return l("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ue(Q)+" at index "+N+"."),c}function X(Z,re,J,q,oe){for(var ie=[],se=0;se<O.length;se++){var ve=O[se],$=ve(Z,re,J,q,oe,n);if($==null)return null;$.data&&i($.data,"expectedType")&&ie.push($.data.expectedType)}var De=ie.length>0?", expected one of type ["+ie.join(", ")+"]":"";return new p("Invalid "+q+" `"+oe+"` supplied to "+("`"+J+"`"+De+"."))}return T(X)}function V(){function O(N,Q,X,Z,re){return W(N[Q])?null:new p("Invalid "+Z+" `"+re+"` supplied to "+("`"+X+"`, expected a ReactNode."))}return T(O)}function te(O,N,Q,X,Z){return new p((O||"React class")+": "+N+" type `"+Q+"."+X+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+Z+"`.")}function h(O){function N(Q,X,Z,re,J){var q=Q[X],oe=H(q);if(oe!=="object")return new p("Invalid "+re+" `"+J+"` of type `"+oe+"` "+("supplied to `"+Z+"`, expected `object`."));for(var ie in O){var se=O[ie];if(typeof se!="function")return te(Z,re,J,ie,de(se));var ve=se(q,ie,Z,re,J+"."+ie,n);if(ve)return ve}return null}return T(N)}function F(O){function N(Q,X,Z,re,J){var q=Q[X],oe=H(q);if(oe!=="object")return new p("Invalid "+re+" `"+J+"` of type `"+oe+"` "+("supplied to `"+Z+"`, expected `object`."));var ie=r({},Q[X],O);for(var se in ie){var ve=O[se];if(i(O,se)&&typeof ve!="function")return te(Z,re,J,se,de(ve));if(!ve)return new p("Invalid "+re+" `"+J+"` key `"+se+"` supplied to `"+Z+"`.\nBad object: "+JSON.stringify(Q[X],null," ")+`
30
+ Valid keys: `+JSON.stringify(Object.keys(O),null," "));var $=ve(q,se,Z,re,J+"."+se,n);if($)return $}return null}return T(N)}function W(O){switch(typeof O){case"number":case"string":case"undefined":return!0;case"boolean":return!O;case"object":if(Array.isArray(O))return O.every(W);if(O===null||d(O))return!0;var N=b(O);if(N){var Q=N.call(O),X;if(N!==O.entries){for(;!(X=Q.next()).done;)if(!W(X.value))return!1}else for(;!(X=Q.next()).done;){var Z=X.value;if(Z&&!W(Z[1]))return!1}}else return!1;return!0;default:return!1}}function E(O,N){return O==="symbol"?!0:N?N["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&N instanceof Symbol:!1}function H(O){var N=typeof O;return Array.isArray(O)?"array":O instanceof RegExp?"object":E(N,O)?"symbol":N}function de(O){if(typeof O>"u"||O===null)return""+O;var N=H(O);if(N==="object"){if(O instanceof Date)return"date";if(O instanceof RegExp)return"regexp"}return N}function ue(O){var N=de(O);switch(N){case"array":case"object":return"an "+N;case"boolean":case"date":case"regexp":return"a "+N;default:return N}}function Be(O){return!O.constructor||!O.constructor.name?g:O.constructor.name}return v.checkPropTypes=a,v.resetWarningCache=a.resetWarningCache,v.PropTypes=v,v},Qr}var Zr,Uo;function ra(){if(Uo)return Zr;Uo=1;var e=uo();function r(){}function n(){}return n.resetWarningCache=r,Zr=function(){function i(c,d,f,x,m,b){if(b!==e){var g=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw g.name="Invariant Violation",g}}i.isRequired=i;function a(){return i}var l={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:a,element:i,elementType:i,instanceOf:a,node:i,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:r};return l.PropTypes=l,l},Zr}var Go;function oa(){if(Go)return Cr.exports;if(Go=1,process.env.NODE_ENV!=="production"){var e=Bn(),r=!0;Cr.exports=ta()(e.isElement,r)}else Cr.exports=ra()();return Cr.exports}var na=oa();const ir=Ks(na);var wr={exports:{}},ge={};/**
31
+ * @license React
32
+ * react-is.production.js
33
+ *
34
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
35
+ *
36
+ * This source code is licensed under the MIT license found in the
37
+ * LICENSE file in the root directory of this source tree.
38
+ */var Yo;function ia(){if(Yo)return ge;Yo=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),x=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),g=Symbol.for("react.view_transition"),v=Symbol.for("react.client.reference");function C(p){if(typeof p=="object"&&p!==null){var T=p.$$typeof;switch(T){case e:switch(p=p.type,p){case n:case a:case i:case f:case x:case g:return p;default:switch(p=p&&p.$$typeof,p){case c:case d:case b:case m:return p;case l:return p;default:return T}}case r:return T}}}return ge.ContextConsumer=l,ge.ContextProvider=c,ge.Element=e,ge.ForwardRef=d,ge.Fragment=n,ge.Lazy=b,ge.Memo=m,ge.Portal=r,ge.Profiler=a,ge.StrictMode=i,ge.Suspense=f,ge.SuspenseList=x,ge.isContextConsumer=function(p){return C(p)===l},ge.isContextProvider=function(p){return C(p)===c},ge.isElement=function(p){return typeof p=="object"&&p!==null&&p.$$typeof===e},ge.isForwardRef=function(p){return C(p)===d},ge.isFragment=function(p){return C(p)===n},ge.isLazy=function(p){return C(p)===b},ge.isMemo=function(p){return C(p)===m},ge.isPortal=function(p){return C(p)===r},ge.isProfiler=function(p){return C(p)===a},ge.isStrictMode=function(p){return C(p)===i},ge.isSuspense=function(p){return C(p)===f},ge.isSuspenseList=function(p){return C(p)===x},ge.isValidElementType=function(p){return typeof p=="string"||typeof p=="function"||p===n||p===a||p===i||p===f||p===x||typeof p=="object"&&p!==null&&(p.$$typeof===b||p.$$typeof===m||p.$$typeof===c||p.$$typeof===l||p.$$typeof===d||p.$$typeof===v||p.getModuleId!==void 0)},ge.typeOf=C,ge}var be={};/**
39
+ * @license React
40
+ * react-is.development.js
41
+ *
42
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
43
+ *
44
+ * This source code is licensed under the MIT license found in the
45
+ * LICENSE file in the root directory of this source tree.
46
+ */var qo;function sa(){return qo||(qo=1,process.env.NODE_ENV!=="production"&&(function(){function e(p){if(typeof p=="object"&&p!==null){var T=p.$$typeof;switch(T){case r:switch(p=p.type,p){case i:case l:case a:case x:case m:case v:return p;default:switch(p=p&&p.$$typeof,p){case d:case f:case g:case b:return p;case c:return p;default:return T}}case n:return T}}}var r=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),b=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),v=Symbol.for("react.view_transition"),C=Symbol.for("react.client.reference");be.ContextConsumer=c,be.ContextProvider=d,be.Element=r,be.ForwardRef=f,be.Fragment=i,be.Lazy=g,be.Memo=b,be.Portal=n,be.Profiler=l,be.StrictMode=a,be.Suspense=x,be.SuspenseList=m,be.isContextConsumer=function(p){return e(p)===c},be.isContextProvider=function(p){return e(p)===d},be.isElement=function(p){return typeof p=="object"&&p!==null&&p.$$typeof===r},be.isForwardRef=function(p){return e(p)===f},be.isFragment=function(p){return e(p)===i},be.isLazy=function(p){return e(p)===g},be.isMemo=function(p){return e(p)===b},be.isPortal=function(p){return e(p)===n},be.isProfiler=function(p){return e(p)===l},be.isStrictMode=function(p){return e(p)===a},be.isSuspense=function(p){return e(p)===x},be.isSuspenseList=function(p){return e(p)===m},be.isValidElementType=function(p){return typeof p=="string"||typeof p=="function"||p===i||p===l||p===a||p===x||p===m||typeof p=="object"&&p!==null&&(p.$$typeof===g||p.$$typeof===b||p.$$typeof===d||p.$$typeof===c||p.$$typeof===f||p.$$typeof===C||p.getModuleId!==void 0)},be.typeOf=e})()),be}var Jo;function aa(){return Jo||(Jo=1,process.env.NODE_ENV==="production"?wr.exports=ia():wr.exports=sa()),wr.exports}var On=aa();function vt(e){if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function An(e){if(zr.isValidElement(e)||On.isValidElementType(e)||!vt(e))return e;const r={};return Object.keys(e).forEach(n=>{r[n]=An(e[n])}),r}function Ne(e,r,n={clone:!0}){const i=n.clone?{...e}:e;return vt(e)&&vt(r)&&Object.keys(r).forEach(a=>{zr.isValidElement(r[a])||On.isValidElementType(r[a])?i[a]=r[a]:vt(r[a])&&Object.prototype.hasOwnProperty.call(e,a)&&vt(e[a])?i[a]=Ne(e[a],r[a],n):n.clone?i[a]=vt(r[a])?An(r[a]):r[a]:i[a]=r[a]}),i}const la=e=>{const r=Object.keys(e).map(n=>({key:n,val:e[n]}))||[];return r.sort((n,i)=>n.val-i.val),r.reduce((n,i)=>({...n,[i.key]:i.val}),{})};function ca(e){const{values:r={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:n="px",step:i=5,...a}=e,l=la(r),c=Object.keys(l);function d(g){return`@media (min-width:${typeof r[g]=="number"?r[g]:g}${n})`}function f(g){return`@media (max-width:${(typeof r[g]=="number"?r[g]:g)-i/100}${n})`}function x(g,v){const C=c.indexOf(v);return`@media (min-width:${typeof r[g]=="number"?r[g]:g}${n}) and (max-width:${(C!==-1&&typeof r[c[C]]=="number"?r[c[C]]:v)-i/100}${n})`}function m(g){return c.indexOf(g)+1<c.length?x(g,c[c.indexOf(g)+1]):d(g)}function b(g){const v=c.indexOf(g);return v===0?d(c[1]):v===c.length-1?f(c[v]):x(g,c[c.indexOf(g)+1]).replace("@media","@media not all and")}return{keys:c,values:l,up:d,down:f,between:x,only:m,not:b,unit:n,...a}}function Ko(e,r){if(!e.containerQueries)return r;const n=Object.keys(r).filter(i=>i.startsWith("@container")).sort((i,a)=>{var c,d;const l=/min-width:\s*([0-9.]+)/;return+(((c=i.match(l))==null?void 0:c[1])||0)-+(((d=a.match(l))==null?void 0:d[1])||0)});return n.length?n.reduce((i,a)=>{const l=r[a];return delete i[a],i[a]=l,i},{...r}):r}function da(e,r){return r==="@"||r.startsWith("@")&&(e.some(n=>r.startsWith(`@${n}`))||!!r.match(/^@\d/))}function ua(e,r){const n=r.match(/^@([^/]+)?\/?(.+)?$/);if(!n){if(process.env.NODE_ENV!=="production")throw new Error(`MUI: The provided shorthand ${`(${r})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.
47
+ For example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.`);return null}const[,i,a]=n,l=Number.isNaN(+i)?i||0:+i;return e.containerQueries(a).up(l)}function fa(e){const r=(l,c)=>l.replace("@media",c?`@container ${c}`:"@container");function n(l,c){l.up=(...d)=>r(e.breakpoints.up(...d),c),l.down=(...d)=>r(e.breakpoints.down(...d),c),l.between=(...d)=>r(e.breakpoints.between(...d),c),l.only=(...d)=>r(e.breakpoints.only(...d),c),l.not=(...d)=>{const f=r(e.breakpoints.not(...d),c);return f.includes("not all and")?f.replace("not all and ","").replace("min-width:","width<").replace("max-width:","width>").replace("and","or"):f}}const i={},a=l=>(n(i,l),i);return n(a),{...e,containerQueries:a}}const pa={borderRadius:4},wt=process.env.NODE_ENV!=="production"?ir.oneOfType([ir.number,ir.string,ir.object,ir.array]):{};function ur(e,r){return r?Ne(e,r,{clone:!1}):e}const Ir={xs:0,sm:600,md:900,lg:1200,xl:1536},Xo={keys:["xs","sm","md","lg","xl"],up:e=>`@media (min-width:${Ir[e]}px)`},xa={containerQueries:e=>({up:r=>{let n=typeof r=="number"?r:Ir[r]||r;return typeof n=="number"&&(n=`${n}px`),e?`@container ${e} (min-width:${n})`:`@container (min-width:${n})`}})};function ut(e,r,n){const i=e.theme||{};if(Array.isArray(r)){const l=i.breakpoints||Xo;return r.reduce((c,d,f)=>(c[l.up(l.keys[f])]=n(r[f]),c),{})}if(typeof r=="object"){const l=i.breakpoints||Xo;return Object.keys(r).reduce((c,d)=>{if(da(l.keys,d)){const f=ua(i.containerQueries?i:xa,d);f&&(c[f]=n(r[d],d))}else if(Object.keys(l.values||Ir).includes(d)){const f=l.up(d);c[f]=n(r[d],d)}else{const f=d;c[f]=r[f]}return c},{})}return n(r)}function ha(e={}){var n;return((n=e.keys)==null?void 0:n.reduce((i,a)=>{const l=e.up(a);return i[l]={},i},{}))||{}}function Qo(e,r){return e.reduce((n,i)=>{const a=n[i];return(!a||Object.keys(a).length===0)&&delete n[i],n},r)}function Rn(e){if(typeof e!="string")throw new Error(process.env.NODE_ENV!=="production"?"MUI: `capitalize(string)` expects a string argument.":Ot(7));return e.charAt(0).toUpperCase()+e.slice(1)}function Br(e,r,n=!0){if(!r||typeof r!="string")return null;if(e&&e.vars&&n){const i=`vars.${r}`.split(".").reduce((a,l)=>a&&a[l]?a[l]:null,e);if(i!=null)return i}return r.split(".").reduce((i,a)=>i&&i[a]!=null?i[a]:null,e)}function Tr(e,r,n,i=n){let a;return typeof e=="function"?a=e(n):Array.isArray(e)?a=e[n]||i:a=Br(e,n)||i,r&&(a=r(a,i,e)),a}function Ee(e){const{prop:r,cssProperty:n=e.prop,themeKey:i,transform:a}=e,l=c=>{if(c[r]==null)return null;const d=c[r],f=c.theme,x=Br(f,i)||{};return ut(c,d,b=>{let g=Tr(x,a,b);return b===g&&typeof b=="string"&&(g=Tr(x,a,`${r}${b==="default"?"":Rn(b)}`,b)),n===!1?g:{[n]:g}})};return l.propTypes=process.env.NODE_ENV!=="production"?{[r]:wt}:{},l.filterProps=[r],l}function ma(e){const r={};return n=>(r[n]===void 0&&(r[n]=e(n)),r[n])}const ga={m:"margin",p:"padding"},ba={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},Zo={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},ya=ma(e=>{if(e.length>2)if(Zo[e])e=Zo[e];else return[e];const[r,n]=e.split(""),i=ga[r],a=ba[n]||"";return Array.isArray(a)?a.map(l=>i+l):[i+a]}),Dr=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],Or=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"],Sa=[...Dr,...Or];function pr(e,r,n,i){const a=Br(e,r,!0)??n;return typeof a=="number"||typeof a=="string"?l=>typeof l=="string"?l:(process.env.NODE_ENV!=="production"&&typeof l!="number"&&console.error(`MUI: Expected ${i} argument to be a number or a string, got ${l}.`),typeof a=="string"?a.startsWith("var(")&&l===0?0:a.startsWith("var(")&&l===1?a:`calc(${l} * ${a})`:a*l):Array.isArray(a)?l=>{if(typeof l=="string")return l;const c=Math.abs(l);process.env.NODE_ENV!=="production"&&(Number.isInteger(c)?c>a.length-1&&console.error([`MUI: The value provided (${c}) overflows.`,`The supported values are: ${JSON.stringify(a)}.`,`${c} > ${a.length-1}, you need to add the missing values.`].join(`
48
+ `)):console.error([`MUI: The \`theme.${r}\` array type cannot be combined with non integer values.You should either use an integer value that can be used as index, or define the \`theme.${r}\` as a number.`].join(`
49
+ `)));const d=a[c];return l>=0?d:typeof d=="number"?-d:typeof d=="string"&&d.startsWith("var(")?`calc(-1 * ${d})`:`-${d}`}:typeof a=="function"?a:(process.env.NODE_ENV!=="production"&&console.error([`MUI: The \`theme.${r}\` value (${a}) is invalid.`,"It should be a number, an array or a function."].join(`
50
+ `)),()=>{})}function fo(e){return pr(e,"spacing",8,"spacing")}function xr(e,r){return typeof r=="string"||r==null?r:e(r)}function va(e,r){return n=>e.reduce((i,a)=>(i[a]=xr(r,n),i),{})}function Ca(e,r,n,i){if(!r.includes(n))return null;const a=ya(n),l=va(a,i),c=e[n];return ut(e,c,l)}function Mn(e,r){const n=fo(e.theme);return Object.keys(e).map(i=>Ca(e,r,i,n)).reduce(ur,{})}function we(e){return Mn(e,Dr)}we.propTypes=process.env.NODE_ENV!=="production"?Dr.reduce((e,r)=>(e[r]=wt,e),{}):{};we.filterProps=Dr;function ke(e){return Mn(e,Or)}ke.propTypes=process.env.NODE_ENV!=="production"?Or.reduce((e,r)=>(e[r]=wt,e),{}):{};ke.filterProps=Or;process.env.NODE_ENV!=="production"&&Sa.reduce((e,r)=>(e[r]=wt,e),{});function Pn(e=8,r=fo({spacing:e})){if(e.mui)return e;const n=(...i)=>(process.env.NODE_ENV!=="production"&&(i.length<=4||console.error(`MUI: Too many arguments provided, expected between 0 and 4, got ${i.length}`)),(i.length===0?[1]:i).map(l=>{const c=r(l);return typeof c=="number"?`${c}px`:c}).join(" "));return n.mui=!0,n}function Ar(...e){const r=e.reduce((i,a)=>(a.filterProps.forEach(l=>{i[l]=a}),i),{}),n=i=>Object.keys(i).reduce((a,l)=>r[l]?ur(a,r[l](i)):a,{});return n.propTypes=process.env.NODE_ENV!=="production"?e.reduce((i,a)=>Object.assign(i,a.propTypes),{}):{},n.filterProps=e.reduce((i,a)=>i.concat(a.filterProps),[]),n}function Ge(e){return typeof e!="number"?e:`${e}px solid`}function Ye(e,r){return Ee({prop:e,themeKey:"borders",transform:r})}const ja=Ye("border",Ge),wa=Ye("borderTop",Ge),ka=Ye("borderRight",Ge),Ta=Ye("borderBottom",Ge),za=Ye("borderLeft",Ge),Ea=Ye("borderColor"),Ia=Ye("borderTopColor"),Ba=Ye("borderRightColor"),Da=Ye("borderBottomColor"),Oa=Ye("borderLeftColor"),Aa=Ye("outline",Ge),Ra=Ye("outlineColor"),Rr=e=>{if(e.borderRadius!==void 0&&e.borderRadius!==null){const r=pr(e.theme,"shape.borderRadius",4,"borderRadius"),n=i=>({borderRadius:xr(r,i)});return ut(e,e.borderRadius,n)}return null};Rr.propTypes=process.env.NODE_ENV!=="production"?{borderRadius:wt}:{};Rr.filterProps=["borderRadius"];Ar(ja,wa,ka,Ta,za,Ea,Ia,Ba,Da,Oa,Rr,Aa,Ra);const Mr=e=>{if(e.gap!==void 0&&e.gap!==null){const r=pr(e.theme,"spacing",8,"gap"),n=i=>({gap:xr(r,i)});return ut(e,e.gap,n)}return null};Mr.propTypes=process.env.NODE_ENV!=="production"?{gap:wt}:{};Mr.filterProps=["gap"];const Pr=e=>{if(e.columnGap!==void 0&&e.columnGap!==null){const r=pr(e.theme,"spacing",8,"columnGap"),n=i=>({columnGap:xr(r,i)});return ut(e,e.columnGap,n)}return null};Pr.propTypes=process.env.NODE_ENV!=="production"?{columnGap:wt}:{};Pr.filterProps=["columnGap"];const Wr=e=>{if(e.rowGap!==void 0&&e.rowGap!==null){const r=pr(e.theme,"spacing",8,"rowGap"),n=i=>({rowGap:xr(r,i)});return ut(e,e.rowGap,n)}return null};Wr.propTypes=process.env.NODE_ENV!=="production"?{rowGap:wt}:{};Wr.filterProps=["rowGap"];const Ma=Ee({prop:"gridColumn"}),Pa=Ee({prop:"gridRow"}),Wa=Ee({prop:"gridAutoFlow"}),_a=Ee({prop:"gridAutoColumns"}),$a=Ee({prop:"gridAutoRows"}),Fa=Ee({prop:"gridTemplateColumns"}),Va=Ee({prop:"gridTemplateRows"}),Na=Ee({prop:"gridTemplateAreas"}),La=Ee({prop:"gridArea"});Ar(Mr,Pr,Wr,Ma,Pa,Wa,_a,$a,Fa,Va,Na,La);function Ut(e,r){return r==="grey"?r:e}const Ha=Ee({prop:"color",themeKey:"palette",transform:Ut}),Ua=Ee({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:Ut}),Ga=Ee({prop:"backgroundColor",themeKey:"palette",transform:Ut});Ar(Ha,Ua,Ga);function Ve(e){return e<=1&&e!==0?`${e*100}%`:e}const Ya=Ee({prop:"width",transform:Ve}),po=e=>{if(e.maxWidth!==void 0&&e.maxWidth!==null){const r=n=>{var a,l,c,d,f;const i=((c=(l=(a=e.theme)==null?void 0:a.breakpoints)==null?void 0:l.values)==null?void 0:c[n])||Ir[n];return i?((f=(d=e.theme)==null?void 0:d.breakpoints)==null?void 0:f.unit)!=="px"?{maxWidth:`${i}${e.theme.breakpoints.unit}`}:{maxWidth:i}:{maxWidth:Ve(n)}};return ut(e,e.maxWidth,r)}return null};po.filterProps=["maxWidth"];const qa=Ee({prop:"minWidth",transform:Ve}),Ja=Ee({prop:"height",transform:Ve}),Ka=Ee({prop:"maxHeight",transform:Ve}),Xa=Ee({prop:"minHeight",transform:Ve});Ee({prop:"size",cssProperty:"width",transform:Ve});Ee({prop:"size",cssProperty:"height",transform:Ve});const Qa=Ee({prop:"boxSizing"});Ar(Ya,po,qa,Ja,Ka,Xa,Qa);const _r={border:{themeKey:"borders",transform:Ge},borderTop:{themeKey:"borders",transform:Ge},borderRight:{themeKey:"borders",transform:Ge},borderBottom:{themeKey:"borders",transform:Ge},borderLeft:{themeKey:"borders",transform:Ge},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:Ge},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:Rr},color:{themeKey:"palette",transform:Ut},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:Ut},backgroundColor:{themeKey:"palette",transform:Ut},p:{style:ke},pt:{style:ke},pr:{style:ke},pb:{style:ke},pl:{style:ke},px:{style:ke},py:{style:ke},padding:{style:ke},paddingTop:{style:ke},paddingRight:{style:ke},paddingBottom:{style:ke},paddingLeft:{style:ke},paddingX:{style:ke},paddingY:{style:ke},paddingInline:{style:ke},paddingInlineStart:{style:ke},paddingInlineEnd:{style:ke},paddingBlock:{style:ke},paddingBlockStart:{style:ke},paddingBlockEnd:{style:ke},m:{style:we},mt:{style:we},mr:{style:we},mb:{style:we},ml:{style:we},mx:{style:we},my:{style:we},margin:{style:we},marginTop:{style:we},marginRight:{style:we},marginBottom:{style:we},marginLeft:{style:we},marginX:{style:we},marginY:{style:we},marginInline:{style:we},marginInlineStart:{style:we},marginInlineEnd:{style:we},marginBlock:{style:we},marginBlockStart:{style:we},marginBlockEnd:{style:we},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:Mr},rowGap:{style:Wr},columnGap:{style:Pr},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:Ve},maxWidth:{style:po},minWidth:{transform:Ve},height:{transform:Ve},maxHeight:{transform:Ve},minHeight:{transform:Ve},boxSizing:{},font:{themeKey:"font"},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}};function Za(...e){const r=e.reduce((i,a)=>i.concat(Object.keys(a)),[]),n=new Set(r);return e.every(i=>n.size===Object.keys(i).length)}function el(e,r){return typeof e=="function"?e(r):e}function tl(){function e(n,i,a,l){const c={[n]:i,theme:a},d=l[n];if(!d)return{[n]:i};const{cssProperty:f=n,themeKey:x,transform:m,style:b}=d;if(i==null)return null;if(x==="typography"&&i==="inherit")return{[n]:i};const g=Br(a,x)||{};return b?b(c):ut(c,i,C=>{let p=Tr(g,m,C);return C===p&&typeof C=="string"&&(p=Tr(g,m,`${n}${C==="default"?"":Rn(C)}`,C)),f===!1?p:{[f]:p}})}function r(n){const{sx:i,theme:a={},nested:l}=n||{};if(!i)return null;const c=a.unstable_sxConfig??_r;function d(f){let x=f;if(typeof f=="function")x=f(a);else if(typeof f!="object")return f;if(!x)return null;const m=ha(a.breakpoints),b=Object.keys(m);let g=m;return Object.keys(x).forEach(v=>{const C=el(x[v],a);if(C!=null)if(typeof C=="object")if(c[v])g=ur(g,e(v,C,a,c));else{const p=ut({theme:a},C,T=>({[v]:T}));Za(p,C)?g[v]=r({sx:C,theme:a,nested:!0}):g=ur(g,p)}else g=ur(g,e(v,C,a,c))}),!l&&a.modularCssLayers?{"@layer sx":Ko(a,Qo(b,g))}:Ko(a,Qo(b,g))}return Array.isArray(i)?i.map(d):d(i)}return r}const $r=tl();$r.filterProps=["sx"];function rl(e,r){var i;const n=this;if(n.vars){if(!((i=n.colorSchemes)!=null&&i[e])||typeof n.getColorSchemeSelector!="function")return{};let a=n.getColorSchemeSelector(e);return a==="&"?r:((a.includes("data-")||a.includes("."))&&(a=`*:where(${a.replace(/\s*&$/,"")}) &`),{[a]:r})}return n.palette.mode===e?r:{}}function Wn(e={},...r){const{breakpoints:n={},palette:i={},spacing:a,shape:l={},...c}=e,d=ca(n),f=Pn(a);let x=Ne({breakpoints:d,direction:"ltr",components:{},palette:{mode:"light",...i},spacing:f,shape:{...pa,...l}},c);return x=fa(x),x.applyStyles=rl,x=r.reduce((m,b)=>Ne(m,b),x),x.unstable_sxConfig={..._r,...c==null?void 0:c.unstable_sxConfig},x.unstable_sx=function(b){return $r({sx:b,theme:this})},x}function ol(e){return Object.keys(e).length===0}function nl(e=null){const r=zr.useContext($i.ThemeContext);return!r||ol(r)?e:r}const il=Wn();function sl(e=il){return nl(e)}const en=e=>e,al=()=>{let e=en;return{configure(r){e=r},generate(r){return e(r)},reset(){e=en}}},ll=al(),cl={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function dl(e,r,n="Mui"){const i=cl[r];return i?`${n}-${i}`:`${ll.generate(e)}-${r}`}function ul(e,r=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(r,Math.min(e,n))}function xo(e,r=0,n=1){return process.env.NODE_ENV!=="production"&&(e<r||e>n)&&console.error(`MUI: The value provided ${e} is out of range [${r}, ${n}].`),ul(e,r,n)}function fl(e){e=e.slice(1);const r=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(r);return n&&n[0].length===1&&(n=n.map(i=>i+i)),process.env.NODE_ENV!=="production"&&e.length!==e.trim().length&&console.error(`MUI: The color: "${e}" is invalid. Make sure the color input doesn't contain leading/trailing space.`),n?`rgb${n.length===4?"a":""}(${n.map((i,a)=>a<3?parseInt(i,16):Math.round(parseInt(i,16)/255*1e3)/1e3).join(", ")})`:""}function jt(e){if(e.type)return e;if(e.charAt(0)==="#")return jt(fl(e));const r=e.indexOf("("),n=e.substring(0,r);if(!["rgb","rgba","hsl","hsla","color"].includes(n))throw new Error(process.env.NODE_ENV!=="production"?`MUI: Unsupported \`${e}\` color.
51
+ The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().`:Ot(9,e));let i=e.substring(r+1,e.length-1),a;if(n==="color"){if(i=i.split(" "),a=i.shift(),i.length===4&&i[3].charAt(0)==="/"&&(i[3]=i[3].slice(1)),!["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].includes(a))throw new Error(process.env.NODE_ENV!=="production"?`MUI: unsupported \`${a}\` color space.
52
+ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.`:Ot(10,a))}else i=i.split(",");return i=i.map(l=>parseFloat(l)),{type:n,values:i,colorSpace:a}}const pl=e=>{const r=jt(e);return r.values.slice(0,3).map((n,i)=>r.type.includes("hsl")&&i!==0?`${n}%`:n).join(" ")},cr=(e,r)=>{try{return pl(e)}catch{return r&&process.env.NODE_ENV!=="production"&&console.warn(r),e}};function Fr(e){const{type:r,colorSpace:n}=e;let{values:i}=e;return r.includes("rgb")?i=i.map((a,l)=>l<3?parseInt(a,10):a):r.includes("hsl")&&(i[1]=`${i[1]}%`,i[2]=`${i[2]}%`),r.includes("color")?i=`${n} ${i.join(" ")}`:i=`${i.join(", ")}`,`${r}(${i})`}function _n(e){e=jt(e);const{values:r}=e,n=r[0],i=r[1]/100,a=r[2]/100,l=i*Math.min(a,1-a),c=(x,m=(x+n/30)%12)=>a-l*Math.max(Math.min(m-3,9-m,1),-1);let d="rgb";const f=[Math.round(c(0)*255),Math.round(c(8)*255),Math.round(c(4)*255)];return e.type==="hsla"&&(d+="a",f.push(r[3])),Fr({type:d,values:f})}function ro(e){e=jt(e);let r=e.type==="hsl"||e.type==="hsla"?jt(_n(e)).values:e.values;return r=r.map(n=>(e.type!=="color"&&(n/=255),n<=.03928?n/12.92:((n+.055)/1.055)**2.4)),Number((.2126*r[0]+.7152*r[1]+.0722*r[2]).toFixed(3))}function tn(e,r){const n=ro(e),i=ro(r);return(Math.max(n,i)+.05)/(Math.min(n,i)+.05)}function ne(e,r){return e=jt(e),r=xo(r),(e.type==="rgb"||e.type==="hsl")&&(e.type+="a"),e.type==="color"?e.values[3]=`/${r}`:e.values[3]=r,Fr(e)}function Dt(e,r,n){try{return ne(e,r)}catch{return n&&process.env.NODE_ENV!=="production"&&console.warn(n),e}}function Vr(e,r){if(e=jt(e),r=xo(r),e.type.includes("hsl"))e.values[2]*=1-r;else if(e.type.includes("rgb")||e.type.includes("color"))for(let n=0;n<3;n+=1)e.values[n]*=1-r;return Fr(e)}function he(e,r,n){try{return Vr(e,r)}catch{return n&&process.env.NODE_ENV!=="production"&&console.warn(n),e}}function Nr(e,r){if(e=jt(e),r=xo(r),e.type.includes("hsl"))e.values[2]+=(100-e.values[2])*r;else if(e.type.includes("rgb"))for(let n=0;n<3;n+=1)e.values[n]+=(255-e.values[n])*r;else if(e.type.includes("color"))for(let n=0;n<3;n+=1)e.values[n]+=(1-e.values[n])*r;return Fr(e)}function me(e,r,n){try{return Nr(e,r)}catch{return n&&process.env.NODE_ENV!=="production"&&console.warn(n),e}}function xl(e,r=.15){return ro(e)>.5?Vr(e,r):Nr(e,r)}function kr(e,r,n){try{return xl(e,r)}catch{return e}}function hl(e=""){function r(...i){if(!i.length)return"";const a=i[0];return typeof a=="string"&&!a.match(/(#|\(|\)|(-?(\d*\.)?\d+)(px|em|%|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc))|^(-?(\d*\.)?\d+)$|(\d+ \d+ \d+)/)?`, var(--${e?`${e}-`:""}${a}${r(...i.slice(1))})`:`, ${a}`}return(i,...a)=>`var(--${e?`${e}-`:""}${i}${r(...a)})`}const rn=(e,r,n,i=[])=>{let a=e;r.forEach((l,c)=>{c===r.length-1?Array.isArray(a)?a[Number(l)]=n:a&&typeof a=="object"&&(a[l]=n):a&&typeof a=="object"&&(a[l]||(a[l]=i.includes(l)?[]:{}),a=a[l])})},ml=(e,r,n)=>{function i(a,l=[],c=[]){Object.entries(a).forEach(([d,f])=>{(!n||n&&!n([...l,d]))&&f!=null&&(typeof f=="object"&&Object.keys(f).length>0?i(f,[...l,d],Array.isArray(f)?[...c,d]:c):r([...l,d],f,c))})}i(e)},gl=(e,r)=>typeof r=="number"?["lineHeight","fontWeight","opacity","zIndex"].some(i=>e.includes(i))||e[e.length-1].toLowerCase().includes("opacity")?r:`${r}px`:r;function eo(e,r){const{prefix:n,shouldSkipGeneratingVar:i}=r||{},a={},l={},c={};return ml(e,(d,f,x)=>{if((typeof f=="string"||typeof f=="number")&&(!i||!i(d,f))){const m=`--${n?`${n}-`:""}${d.join("-")}`,b=gl(d,f);Object.assign(a,{[m]:b}),rn(l,d,`var(${m})`,x),rn(c,d,`var(${m}, ${b})`,x)}},d=>d[0]==="vars"),{css:a,vars:l,varsWithDefaults:c}}function bl(e,r={}){const{getSelector:n=s,disableCssColorScheme:i,colorSchemeSelector:a,enableContrastVars:l}=r,{colorSchemes:c={},components:d,defaultColorScheme:f="light",...x}=e,{vars:m,css:b,varsWithDefaults:g}=eo(x,r);let v=g;const C={},{[f]:p,...T}=c;if(Object.entries(T||{}).forEach(([A,S])=>{const{vars:R,css:Y,varsWithDefaults:_}=eo(S,r);v=Ne(v,_),C[A]={css:Y,vars:R}}),p){const{css:A,vars:S,varsWithDefaults:R}=eo(p,r);v=Ne(v,R),C[f]={css:A,vars:S}}function s(A,S){var Y,_;let R=a;if(a==="class"&&(R=".%s"),a==="data"&&(R="[data-%s]"),a!=null&&a.startsWith("data-")&&!a.includes("%s")&&(R=`[${a}="%s"]`),A){if(R==="media")return e.defaultColorScheme===A?":root":{[`@media (prefers-color-scheme: ${((_=(Y=c[A])==null?void 0:Y.palette)==null?void 0:_.mode)||A})`]:{":root":S}};if(R)return e.defaultColorScheme===A?`:root, ${R.replace("%s",String(A))}`:R.replace("%s",String(A))}return":root"}return{vars:v,generateThemeVars:()=>{let A={...m};return Object.entries(C).forEach(([,{vars:S}])=>{A=Ne(A,S)}),A},generateStyleSheets:()=>{var K,V;const A=[],S=e.defaultColorScheme||"light";function R(te,h){Object.keys(h).length&&A.push(typeof te=="string"?{[te]:{...h}}:te)}R(n(void 0,{...b}),b);const{[S]:Y,..._}=C;if(Y){const{css:te}=Y,h=(V=(K=c[S])==null?void 0:K.palette)==null?void 0:V.mode,F=!i&&h?{colorScheme:h,...te}:{...te};R(n(S,{...F}),F)}return Object.entries(_).forEach(([te,{css:h}])=>{var E,H;const F=(H=(E=c[te])==null?void 0:E.palette)==null?void 0:H.mode,W=!i&&F?{colorScheme:F,...h}:{...h};R(n(te,{...W}),W)}),l&&A.push({":root":{"--__l-threshold":"0.7","--__l":"clamp(0, (l / var(--__l-threshold) - 1) * -infinity, 1)","--__a":"clamp(0.87, (l / var(--__l-threshold) - 1) * -infinity, 1)"}}),A}}}function yl(e){return function(n){return e==="media"?(process.env.NODE_ENV!=="production"&&n!=="light"&&n!=="dark"&&console.error(`MUI: @media (prefers-color-scheme) supports only 'light' or 'dark', but receive '${n}'.`),`@media (prefers-color-scheme: ${n})`):e?e.startsWith("data-")&&!e.includes("%s")?`[${e}="${n}"] &`:e==="class"?`.${n} &`:e==="data"?`[data-${n}] &`:`${e.replace("%s",n)} &`:"&"}}const fr={black:"#000",white:"#fff"},Sl={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},Ft={50:"#f3e5f5",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",700:"#7b1fa2"},Vt={300:"#e57373",400:"#ef5350",500:"#f44336",700:"#d32f2f",800:"#c62828"},sr={300:"#ffb74d",400:"#ffa726",500:"#ff9800",700:"#f57c00",900:"#e65100"},Nt={50:"#e3f2fd",200:"#90caf9",400:"#42a5f5",700:"#1976d2",800:"#1565c0"},Lt={300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",700:"#0288d1",900:"#01579b"},Ht={300:"#81c784",400:"#66bb6a",500:"#4caf50",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"};function $n(){return{text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:fr.white,default:fr.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}}}const Fn=$n();function Vn(){return{text:{primary:fr.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:fr.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}}}const oo=Vn();function on(e,r,n,i){const a=i.light||i,l=i.dark||i*1.5;e[r]||(e.hasOwnProperty(n)?e[r]=e[n]:r==="light"?e.light=Nr(e.main,a):r==="dark"&&(e.dark=Vr(e.main,l)))}function nn(e,r,n,i,a){const l=a.light||a,c=a.dark||a*1.5;r[n]||(r.hasOwnProperty(i)?r[n]=r[i]:n==="light"?r.light=`color-mix(in ${e}, ${r.main}, #fff ${(l*100).toFixed(0)}%)`:n==="dark"&&(r.dark=`color-mix(in ${e}, ${r.main}, #000 ${(c*100).toFixed(0)}%)`))}function vl(e="light"){return e==="dark"?{main:Nt[200],light:Nt[50],dark:Nt[400]}:{main:Nt[700],light:Nt[400],dark:Nt[800]}}function Cl(e="light"){return e==="dark"?{main:Ft[200],light:Ft[50],dark:Ft[400]}:{main:Ft[500],light:Ft[300],dark:Ft[700]}}function jl(e="light"){return e==="dark"?{main:Vt[500],light:Vt[300],dark:Vt[700]}:{main:Vt[700],light:Vt[400],dark:Vt[800]}}function wl(e="light"){return e==="dark"?{main:Lt[400],light:Lt[300],dark:Lt[700]}:{main:Lt[700],light:Lt[500],dark:Lt[900]}}function kl(e="light"){return e==="dark"?{main:Ht[400],light:Ht[300],dark:Ht[700]}:{main:Ht[800],light:Ht[500],dark:Ht[900]}}function Tl(e="light"){return e==="dark"?{main:sr[400],light:sr[300],dark:sr[700]}:{main:"#ed6c02",light:sr[500],dark:sr[900]}}function zl(e){return`oklch(from ${e} var(--__l) 0 h / var(--__a))`}function ho(e){const{mode:r="light",contrastThreshold:n=3,tonalOffset:i=.2,colorSpace:a,...l}=e,c=e.primary||vl(r),d=e.secondary||Cl(r),f=e.error||jl(r),x=e.info||wl(r),m=e.success||kl(r),b=e.warning||Tl(r);function g(T){if(a)return zl(T);const s=tn(T,oo.text.primary)>=n?oo.text.primary:Fn.text.primary;if(process.env.NODE_ENV!=="production"){const k=tn(T,s);k<3&&console.error([`MUI: The contrast ratio of ${k}:1 for ${s} on ${T}`,"falls below the WCAG recommended absolute minimum contrast ratio of 3:1.","https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-contrast"].join(`
53
+ `))}return s}const v=({color:T,name:s,mainShade:k=500,lightShade:D=300,darkShade:A=700})=>{if(T={...T},!T.main&&T[k]&&(T.main=T[k]),!T.hasOwnProperty("main"))throw new Error(process.env.NODE_ENV!=="production"?`MUI: The color${s?` (${s})`:""} provided to augmentColor(color) is invalid.
54
+ The color object needs to have a \`main\` property or a \`${k}\` property.`:Ot(11,s?` (${s})`:"",k));if(typeof T.main!="string")throw new Error(process.env.NODE_ENV!=="production"?`MUI: The color${s?` (${s})`:""} provided to augmentColor(color) is invalid.
55
+ \`color.main\` should be a string, but \`${JSON.stringify(T.main)}\` was provided instead.
56
+
57
+ Did you intend to use one of the following approaches?
58
+
59
+ import { green } from "@mui/material/colors";
60
+
61
+ const theme1 = createTheme({ palette: {
62
+ primary: green,
63
+ } });
64
+
65
+ const theme2 = createTheme({ palette: {
66
+ primary: { main: green[500] },
67
+ } });`:Ot(12,s?` (${s})`:"",JSON.stringify(T.main)));return a?(nn(a,T,"light",D,i),nn(a,T,"dark",A,i)):(on(T,"light",D,i),on(T,"dark",A,i)),T.contrastText||(T.contrastText=g(T.main)),T};let C;return r==="light"?C=$n():r==="dark"&&(C=Vn()),process.env.NODE_ENV!=="production"&&(C||console.error(`MUI: The palette mode \`${r}\` is not supported.`)),Ne({common:{...fr},mode:r,primary:v({color:c,name:"primary"}),secondary:v({color:d,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:v({color:f,name:"error"}),warning:v({color:b,name:"warning"}),info:v({color:x,name:"info"}),success:v({color:m,name:"success"}),grey:Sl,contrastThreshold:n,getContrastText:g,augmentColor:v,tonalOffset:i,...C},l)}function El(e){const r={};return Object.entries(e).forEach(i=>{const[a,l]=i;typeof l=="object"&&(r[a]=`${l.fontStyle?`${l.fontStyle} `:""}${l.fontVariant?`${l.fontVariant} `:""}${l.fontWeight?`${l.fontWeight} `:""}${l.fontStretch?`${l.fontStretch} `:""}${l.fontSize||""}${l.lineHeight?`/${l.lineHeight} `:""}${l.fontFamily||""}`)}),r}function Il(e,r){return{toolbar:{minHeight:56,[e.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[e.up("sm")]:{minHeight:64}},...r}}function Bl(e){return Math.round(e*1e5)/1e5}const sn={textTransform:"uppercase"},an='"Roboto", "Helvetica", "Arial", sans-serif';function Dl(e,r){const{fontFamily:n=an,fontSize:i=14,fontWeightLight:a=300,fontWeightRegular:l=400,fontWeightMedium:c=500,fontWeightBold:d=700,htmlFontSize:f=16,allVariants:x,pxToRem:m,...b}=typeof r=="function"?r(e):r;process.env.NODE_ENV!=="production"&&(typeof i!="number"&&console.error("MUI: `fontSize` is required to be a number."),typeof f!="number"&&console.error("MUI: `htmlFontSize` is required to be a number."));const g=i/14,v=m||(T=>`${T/f*g}rem`),C=(T,s,k,D,A)=>({fontFamily:n,fontWeight:T,fontSize:v(s),lineHeight:k,...n===an?{letterSpacing:`${Bl(D/s)}em`}:{},...A,...x}),p={h1:C(a,96,1.167,-1.5),h2:C(a,60,1.2,-.5),h3:C(l,48,1.167,0),h4:C(l,34,1.235,.25),h5:C(l,24,1.334,0),h6:C(c,20,1.6,.15),subtitle1:C(l,16,1.75,.15),subtitle2:C(c,14,1.57,.1),body1:C(l,16,1.5,.15),body2:C(l,14,1.43,.15),button:C(c,14,1.75,.4,sn),caption:C(l,12,1.66,.4),overline:C(l,12,2.66,1,sn),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return Ne({htmlFontSize:f,pxToRem:v,fontFamily:n,fontSize:i,fontWeightLight:a,fontWeightRegular:l,fontWeightMedium:c,fontWeightBold:d,...p},b,{clone:!1})}const Ol=.2,Al=.14,Rl=.12;function Ce(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,${Ol})`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,${Al})`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,${Rl})`].join(",")}const Ml=["none",Ce(0,2,1,-1,0,1,1,0,0,1,3,0),Ce(0,3,1,-2,0,2,2,0,0,1,5,0),Ce(0,3,3,-2,0,3,4,0,0,1,8,0),Ce(0,2,4,-1,0,4,5,0,0,1,10,0),Ce(0,3,5,-1,0,5,8,0,0,1,14,0),Ce(0,3,5,-1,0,6,10,0,0,1,18,0),Ce(0,4,5,-2,0,7,10,1,0,2,16,1),Ce(0,5,5,-3,0,8,10,1,0,3,14,2),Ce(0,5,6,-3,0,9,12,1,0,3,16,2),Ce(0,6,6,-3,0,10,14,1,0,4,18,3),Ce(0,6,7,-4,0,11,15,1,0,4,20,3),Ce(0,7,8,-4,0,12,17,2,0,5,22,4),Ce(0,7,8,-4,0,13,19,2,0,5,24,4),Ce(0,7,9,-4,0,14,21,2,0,5,26,4),Ce(0,8,9,-5,0,15,22,2,0,6,28,5),Ce(0,8,10,-5,0,16,24,2,0,6,30,5),Ce(0,8,11,-5,0,17,26,2,0,6,32,5),Ce(0,9,11,-5,0,18,28,2,0,7,34,6),Ce(0,9,12,-6,0,19,29,2,0,7,36,6),Ce(0,10,13,-6,0,20,31,3,0,8,38,7),Ce(0,10,13,-6,0,21,33,3,0,8,40,7),Ce(0,10,14,-6,0,22,35,3,0,8,42,7),Ce(0,11,14,-7,0,23,36,3,0,9,44,8),Ce(0,11,15,-7,0,24,38,3,0,9,46,8)],Pl={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},Wl={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function ln(e){return`${Math.round(e)}ms`}function _l(e){if(!e)return 0;const r=e/36;return Math.min(Math.round((4+15*r**.25+r/5)*10),3e3)}function $l(e){const r={...Pl,...e.easing},n={...Wl,...e.duration};return{getAutoHeightDuration:_l,create:(a=["all"],l={})=>{const{duration:c=n.standard,easing:d=r.easeInOut,delay:f=0,...x}=l;if(process.env.NODE_ENV!=="production"){const m=g=>typeof g=="string",b=g=>!Number.isNaN(parseFloat(g));!m(a)&&!Array.isArray(a)&&console.error('MUI: Argument "props" must be a string or Array.'),!b(c)&&!m(c)&&console.error(`MUI: Argument "duration" must be a number or a string but found ${c}.`),m(d)||console.error('MUI: Argument "easing" must be a string.'),!b(f)&&!m(f)&&console.error('MUI: Argument "delay" must be a number or a string.'),typeof l!="object"&&console.error(["MUI: Secong argument of transition.create must be an object.","Arguments should be either `create('prop1', options)` or `create(['prop1', 'prop2'], options)`"].join(`
68
+ `)),Object.keys(x).length!==0&&console.error(`MUI: Unrecognized argument(s) [${Object.keys(x).join(",")}].`)}return(Array.isArray(a)?a:[a]).map(m=>`${m} ${typeof c=="string"?c:ln(c)} ${d} ${typeof f=="string"?f:ln(f)}`).join(",")},...e,easing:r,duration:n}}const Fl={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function Vl(e){return vt(e)||typeof e>"u"||typeof e=="string"||typeof e=="boolean"||typeof e=="number"||Array.isArray(e)}function Nn(e={}){const r={...e};function n(i){const a=Object.entries(i);for(let l=0;l<a.length;l++){const[c,d]=a[l];!Vl(d)||c.startsWith("unstable_")?delete i[c]:vt(d)&&(i[c]={...d},n(i[c]))}}return n(r),`import { unstable_createBreakpoints as createBreakpoints, createTransitions } from '@mui/material/styles';
69
+
70
+ const theme = ${JSON.stringify(r,null,2)};
71
+
72
+ theme.breakpoints = createBreakpoints(theme.breakpoints || {});
73
+ theme.transitions = createTransitions(theme.transitions || {});
74
+
75
+ export default theme;`}function cn(e){return typeof e=="number"?`${(e*100).toFixed(0)}%`:`calc((${e}) * 100%)`}const Nl=e=>{if(!Number.isNaN(+e))return+e;const r=e.match(/\d*\.?\d+/g);if(!r)return 0;let n=0;for(let i=0;i<r.length;i+=1)n+=+r[i];return n};function Ll(e){Object.assign(e,{alpha(r,n){const i=this||e;return i.colorSpace?`oklch(from ${r} l c h / ${typeof n=="string"?`calc(${n})`:n})`:i.vars?`rgba(${r.replace(/var\(--([^,\s)]+)(?:,[^)]+)?\)+/g,"var(--$1Channel)")} / ${typeof n=="string"?`calc(${n})`:n})`:ne(r,Nl(n))},lighten(r,n){const i=this||e;return i.colorSpace?`color-mix(in ${i.colorSpace}, ${r}, #fff ${cn(n)})`:Nr(r,n)},darken(r,n){const i=this||e;return i.colorSpace?`color-mix(in ${i.colorSpace}, ${r}, #000 ${cn(n)})`:Vr(r,n)}})}function no(e={},...r){const{breakpoints:n,mixins:i={},spacing:a,palette:l={},transitions:c={},typography:d={},shape:f,colorSpace:x,...m}=e;if(e.vars&&e.generateThemeVars===void 0)throw new Error(process.env.NODE_ENV!=="production"?"MUI: `vars` is a private field used for CSS variables support.\nPlease use another name or follow the [docs](https://mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.":Ot(20));const b=ho({...l,colorSpace:x}),g=Wn(e);let v=Ne(g,{mixins:Il(g.breakpoints,i),palette:b,shadows:Ml.slice(),typography:Dl(b,d),transitions:$l(c),zIndex:{...Fl}});if(v=Ne(v,m),v=r.reduce((C,p)=>Ne(C,p),v),process.env.NODE_ENV!=="production"){const C=["active","checked","completed","disabled","error","expanded","focused","focusVisible","required","selected"],p=(T,s)=>{let k;for(k in T){const D=T[k];if(C.includes(k)&&Object.keys(D).length>0){if(process.env.NODE_ENV!=="production"){const A=dl("",k);console.error([`MUI: The \`${s}\` component increases the CSS specificity of the \`${k}\` internal state.`,"You can not override it like this: ",JSON.stringify(T,null,2),"",`Instead, you need to use the '&.${A}' syntax:`,JSON.stringify({root:{[`&.${A}`]:D}},null,2),"","https://mui.com/r/state-classes-guide"].join(`
76
+ `))}T[k]={}}}};Object.keys(v.components).forEach(T=>{const s=v.components[T].styleOverrides;s&&T.startsWith("Mui")&&p(s,T)})}return v.unstable_sxConfig={..._r,...m==null?void 0:m.unstable_sxConfig},v.unstable_sx=function(p){return $r({sx:p,theme:this})},v.toRuntimeSource=Nn,Ll(v),v}function Hl(e){let r;return e<1?r=5.11916*e**2:r=4.5*Math.log(e+1)+2,Math.round(r*10)/1e3}const Ul=[...Array(25)].map((e,r)=>{if(r===0)return"none";const n=Hl(r);return`linear-gradient(rgba(255 255 255 / ${n}), rgba(255 255 255 / ${n}))`});function Ln(e){return{inputPlaceholder:e==="dark"?.5:.42,inputUnderline:e==="dark"?.7:.42,switchTrackDisabled:e==="dark"?.2:.12,switchTrack:e==="dark"?.3:.38}}function Hn(e){return e==="dark"?Ul:[]}function Gl(e){const{palette:r={mode:"light"},opacity:n,overlays:i,colorSpace:a,...l}=e,c=ho({...r,colorSpace:a});return{palette:c,opacity:{...Ln(c.mode),...n},overlays:i||Hn(c.mode),...l}}function Yl(e){var r;return!!e[0].match(/(cssVarPrefix|colorSchemeSelector|modularCssLayers|rootSelector|typography|mixins|breakpoints|direction|transitions)/)||!!e[0].match(/sxConfig$/)||e[0]==="palette"&&!!((r=e[1])!=null&&r.match(/(mode|contrastThreshold|tonalOffset)/))}const ql=e=>[...[...Array(25)].map((r,n)=>`--${e?`${e}-`:""}overlays-${n}`),`--${e?`${e}-`:""}palette-AppBar-darkBg`,`--${e?`${e}-`:""}palette-AppBar-darkColor`],Jl=e=>(r,n)=>{const i=e.rootSelector||":root",a=e.colorSchemeSelector;let l=a;if(a==="class"&&(l=".%s"),a==="data"&&(l="[data-%s]"),a!=null&&a.startsWith("data-")&&!a.includes("%s")&&(l=`[${a}="%s"]`),e.defaultColorScheme===r){if(r==="dark"){const c={};return ql(e.cssVarPrefix).forEach(d=>{c[d]=n[d],delete n[d]}),l==="media"?{[i]:n,"@media (prefers-color-scheme: dark)":{[i]:c}}:l?{[l.replace("%s",r)]:c,[`${i}, ${l.replace("%s",r)}`]:n}:{[i]:{...n,...c}}}if(l&&l!=="media")return`${i}, ${l.replace("%s",String(r))}`}else if(r){if(l==="media")return{[`@media (prefers-color-scheme: ${String(r)})`]:{[i]:n}};if(l)return l.replace("%s",String(r))}return i};function Kl(e,r){r.forEach(n=>{e[n]||(e[n]={})})}function B(e,r,n){!e[r]&&n&&(e[r]=n)}function dr(e){return typeof e!="string"||!e.startsWith("hsl")?e:_n(e)}function lt(e,r){`${r}Channel`in e||(e[`${r}Channel`]=cr(dr(e[r]),`MUI: Can't create \`palette.${r}Channel\` because \`palette.${r}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().
77
+ To suppress this warning, you need to explicitly provide the \`palette.${r}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}function Xl(e){return typeof e=="number"?`${e}px`:typeof e=="string"||typeof e=="function"||Array.isArray(e)?e:"8px"}const Ze=e=>{try{return e()}catch{}},Ql=(e="mui")=>hl(e);function to(e,r,n,i,a){if(!n)return;n=n===!0?{}:n;const l=a==="dark"?"dark":"light";if(!i){r[a]=Gl({...n,palette:{mode:l,...n==null?void 0:n.palette},colorSpace:e});return}const{palette:c,...d}=no({...i,palette:{mode:l,...n==null?void 0:n.palette},colorSpace:e});return r[a]={...n,palette:c,opacity:{...Ln(l),...n==null?void 0:n.opacity},overlays:(n==null?void 0:n.overlays)||Hn(l)},d}function Zl(e={},...r){const{colorSchemes:n={light:!0},defaultColorScheme:i,disableCssColorScheme:a=!1,cssVarPrefix:l="mui",nativeColor:c=!1,shouldSkipGeneratingVar:d=Yl,colorSchemeSelector:f=n.light&&n.dark?"media":void 0,rootSelector:x=":root",...m}=e,b=Object.keys(n)[0],g=i||(n.light&&b!=="light"?"light":b),v=Ql(l),{[g]:C,light:p,dark:T,...s}=n,k={...s};let D=C;if((g==="dark"&&!("dark"in n)||g==="light"&&!("light"in n))&&(D=!0),!D)throw new Error(process.env.NODE_ENV!=="production"?`MUI: The \`colorSchemes.${g}\` option is either missing or invalid.`:Ot(21,g));let A;c&&(A="oklch");const S=to(A,k,D,m,g);p&&!k.light&&to(A,k,p,void 0,"light"),T&&!k.dark&&to(A,k,T,void 0,"dark");let R={defaultColorScheme:g,...S,cssVarPrefix:l,colorSchemeSelector:f,rootSelector:x,getCssVar:v,colorSchemes:k,font:{...El(S.typography),...S.font},spacing:Xl(m.spacing)};Object.keys(R.colorSchemes).forEach(te=>{const h=R.colorSchemes[te].palette,F=E=>{const H=E.split("-"),de=H[1],ue=H[2];return v(E,h[de][ue])};h.mode==="light"&&(B(h.common,"background","#fff"),B(h.common,"onBackground","#000")),h.mode==="dark"&&(B(h.common,"background","#000"),B(h.common,"onBackground","#fff"));function W(E,H,de){if(A){let ue;return E===Dt&&(ue=`transparent ${((1-de)*100).toFixed(0)}%`),E===he&&(ue=`#000 ${(de*100).toFixed(0)}%`),E===me&&(ue=`#fff ${(de*100).toFixed(0)}%`),`color-mix(in ${A}, ${H}, ${ue})`}return E(H,de)}if(Kl(h,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),h.mode==="light"){B(h.Alert,"errorColor",W(he,h.error.light,.6)),B(h.Alert,"infoColor",W(he,h.info.light,.6)),B(h.Alert,"successColor",W(he,h.success.light,.6)),B(h.Alert,"warningColor",W(he,h.warning.light,.6)),B(h.Alert,"errorFilledBg",F("palette-error-main")),B(h.Alert,"infoFilledBg",F("palette-info-main")),B(h.Alert,"successFilledBg",F("palette-success-main")),B(h.Alert,"warningFilledBg",F("palette-warning-main")),B(h.Alert,"errorFilledColor",Ze(()=>h.getContrastText(h.error.main))),B(h.Alert,"infoFilledColor",Ze(()=>h.getContrastText(h.info.main))),B(h.Alert,"successFilledColor",Ze(()=>h.getContrastText(h.success.main))),B(h.Alert,"warningFilledColor",Ze(()=>h.getContrastText(h.warning.main))),B(h.Alert,"errorStandardBg",W(me,h.error.light,.9)),B(h.Alert,"infoStandardBg",W(me,h.info.light,.9)),B(h.Alert,"successStandardBg",W(me,h.success.light,.9)),B(h.Alert,"warningStandardBg",W(me,h.warning.light,.9)),B(h.Alert,"errorIconColor",F("palette-error-main")),B(h.Alert,"infoIconColor",F("palette-info-main")),B(h.Alert,"successIconColor",F("palette-success-main")),B(h.Alert,"warningIconColor",F("palette-warning-main")),B(h.AppBar,"defaultBg",F("palette-grey-100")),B(h.Avatar,"defaultBg",F("palette-grey-400")),B(h.Button,"inheritContainedBg",F("palette-grey-300")),B(h.Button,"inheritContainedHoverBg",F("palette-grey-A100")),B(h.Chip,"defaultBorder",F("palette-grey-400")),B(h.Chip,"defaultAvatarColor",F("palette-grey-700")),B(h.Chip,"defaultIconColor",F("palette-grey-700")),B(h.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),B(h.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),B(h.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),B(h.LinearProgress,"primaryBg",W(me,h.primary.main,.62)),B(h.LinearProgress,"secondaryBg",W(me,h.secondary.main,.62)),B(h.LinearProgress,"errorBg",W(me,h.error.main,.62)),B(h.LinearProgress,"infoBg",W(me,h.info.main,.62)),B(h.LinearProgress,"successBg",W(me,h.success.main,.62)),B(h.LinearProgress,"warningBg",W(me,h.warning.main,.62)),B(h.Skeleton,"bg",A?W(Dt,h.text.primary,.11):`rgba(${F("palette-text-primaryChannel")} / 0.11)`),B(h.Slider,"primaryTrack",W(me,h.primary.main,.62)),B(h.Slider,"secondaryTrack",W(me,h.secondary.main,.62)),B(h.Slider,"errorTrack",W(me,h.error.main,.62)),B(h.Slider,"infoTrack",W(me,h.info.main,.62)),B(h.Slider,"successTrack",W(me,h.success.main,.62)),B(h.Slider,"warningTrack",W(me,h.warning.main,.62));const E=A?W(he,h.background.default,.6825):kr(h.background.default,.8);B(h.SnackbarContent,"bg",E),B(h.SnackbarContent,"color",Ze(()=>A?oo.text.primary:h.getContrastText(E))),B(h.SpeedDialAction,"fabHoverBg",kr(h.background.paper,.15)),B(h.StepConnector,"border",F("palette-grey-400")),B(h.StepContent,"border",F("palette-grey-400")),B(h.Switch,"defaultColor",F("palette-common-white")),B(h.Switch,"defaultDisabledColor",F("palette-grey-100")),B(h.Switch,"primaryDisabledColor",W(me,h.primary.main,.62)),B(h.Switch,"secondaryDisabledColor",W(me,h.secondary.main,.62)),B(h.Switch,"errorDisabledColor",W(me,h.error.main,.62)),B(h.Switch,"infoDisabledColor",W(me,h.info.main,.62)),B(h.Switch,"successDisabledColor",W(me,h.success.main,.62)),B(h.Switch,"warningDisabledColor",W(me,h.warning.main,.62)),B(h.TableCell,"border",W(me,W(Dt,h.divider,1),.88)),B(h.Tooltip,"bg",W(Dt,h.grey[700],.92))}if(h.mode==="dark"){B(h.Alert,"errorColor",W(me,h.error.light,.6)),B(h.Alert,"infoColor",W(me,h.info.light,.6)),B(h.Alert,"successColor",W(me,h.success.light,.6)),B(h.Alert,"warningColor",W(me,h.warning.light,.6)),B(h.Alert,"errorFilledBg",F("palette-error-dark")),B(h.Alert,"infoFilledBg",F("palette-info-dark")),B(h.Alert,"successFilledBg",F("palette-success-dark")),B(h.Alert,"warningFilledBg",F("palette-warning-dark")),B(h.Alert,"errorFilledColor",Ze(()=>h.getContrastText(h.error.dark))),B(h.Alert,"infoFilledColor",Ze(()=>h.getContrastText(h.info.dark))),B(h.Alert,"successFilledColor",Ze(()=>h.getContrastText(h.success.dark))),B(h.Alert,"warningFilledColor",Ze(()=>h.getContrastText(h.warning.dark))),B(h.Alert,"errorStandardBg",W(he,h.error.light,.9)),B(h.Alert,"infoStandardBg",W(he,h.info.light,.9)),B(h.Alert,"successStandardBg",W(he,h.success.light,.9)),B(h.Alert,"warningStandardBg",W(he,h.warning.light,.9)),B(h.Alert,"errorIconColor",F("palette-error-main")),B(h.Alert,"infoIconColor",F("palette-info-main")),B(h.Alert,"successIconColor",F("palette-success-main")),B(h.Alert,"warningIconColor",F("palette-warning-main")),B(h.AppBar,"defaultBg",F("palette-grey-900")),B(h.AppBar,"darkBg",F("palette-background-paper")),B(h.AppBar,"darkColor",F("palette-text-primary")),B(h.Avatar,"defaultBg",F("palette-grey-600")),B(h.Button,"inheritContainedBg",F("palette-grey-800")),B(h.Button,"inheritContainedHoverBg",F("palette-grey-700")),B(h.Chip,"defaultBorder",F("palette-grey-700")),B(h.Chip,"defaultAvatarColor",F("palette-grey-300")),B(h.Chip,"defaultIconColor",F("palette-grey-300")),B(h.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),B(h.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),B(h.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),B(h.LinearProgress,"primaryBg",W(he,h.primary.main,.5)),B(h.LinearProgress,"secondaryBg",W(he,h.secondary.main,.5)),B(h.LinearProgress,"errorBg",W(he,h.error.main,.5)),B(h.LinearProgress,"infoBg",W(he,h.info.main,.5)),B(h.LinearProgress,"successBg",W(he,h.success.main,.5)),B(h.LinearProgress,"warningBg",W(he,h.warning.main,.5)),B(h.Skeleton,"bg",A?W(Dt,h.text.primary,.13):`rgba(${F("palette-text-primaryChannel")} / 0.13)`),B(h.Slider,"primaryTrack",W(he,h.primary.main,.5)),B(h.Slider,"secondaryTrack",W(he,h.secondary.main,.5)),B(h.Slider,"errorTrack",W(he,h.error.main,.5)),B(h.Slider,"infoTrack",W(he,h.info.main,.5)),B(h.Slider,"successTrack",W(he,h.success.main,.5)),B(h.Slider,"warningTrack",W(he,h.warning.main,.5));const E=A?W(me,h.background.default,.985):kr(h.background.default,.98);B(h.SnackbarContent,"bg",E),B(h.SnackbarContent,"color",Ze(()=>A?Fn.text.primary:h.getContrastText(E))),B(h.SpeedDialAction,"fabHoverBg",kr(h.background.paper,.15)),B(h.StepConnector,"border",F("palette-grey-600")),B(h.StepContent,"border",F("palette-grey-600")),B(h.Switch,"defaultColor",F("palette-grey-300")),B(h.Switch,"defaultDisabledColor",F("palette-grey-600")),B(h.Switch,"primaryDisabledColor",W(he,h.primary.main,.55)),B(h.Switch,"secondaryDisabledColor",W(he,h.secondary.main,.55)),B(h.Switch,"errorDisabledColor",W(he,h.error.main,.55)),B(h.Switch,"infoDisabledColor",W(he,h.info.main,.55)),B(h.Switch,"successDisabledColor",W(he,h.success.main,.55)),B(h.Switch,"warningDisabledColor",W(he,h.warning.main,.55)),B(h.TableCell,"border",W(he,W(Dt,h.divider,1),.68)),B(h.Tooltip,"bg",W(Dt,h.grey[700],.92))}lt(h.background,"default"),lt(h.background,"paper"),lt(h.common,"background"),lt(h.common,"onBackground"),lt(h,"divider"),Object.keys(h).forEach(E=>{const H=h[E];E!=="tonalOffset"&&H&&typeof H=="object"&&(H.main&&B(h[E],"mainChannel",cr(dr(H.main))),H.light&&B(h[E],"lightChannel",cr(dr(H.light))),H.dark&&B(h[E],"darkChannel",cr(dr(H.dark))),H.contrastText&&B(h[E],"contrastTextChannel",cr(dr(H.contrastText))),E==="text"&&(lt(h[E],"primary"),lt(h[E],"secondary")),E==="action"&&(H.active&&lt(h[E],"active"),H.selected&&lt(h[E],"selected")))})}),R=r.reduce((te,h)=>Ne(te,h),R);const Y={prefix:l,disableCssColorScheme:a,shouldSkipGeneratingVar:d,getSelector:Jl(R),enableContrastVars:c},{vars:_,generateThemeVars:K,generateStyleSheets:V}=bl(R,Y);return R.vars=_,Object.entries(R.colorSchemes[R.defaultColorScheme]).forEach(([te,h])=>{R[te]=h}),R.generateThemeVars=K,R.generateStyleSheets=V,R.generateSpacing=function(){return Pn(m.spacing,fo(this))},R.getColorSchemeSelector=yl(f),R.spacing=R.generateSpacing(),R.shouldSkipGeneratingVar=d,R.unstable_sxConfig={..._r,...m==null?void 0:m.unstable_sxConfig},R.unstable_sx=function(h){return $r({sx:h,theme:this})},R.toRuntimeSource=Nn,R}function dn(e,r,n){e.colorSchemes&&n&&(e.colorSchemes[r]={...n!==!0&&n,palette:ho({...n===!0?{}:n.palette,mode:r})})}function ec(e={},...r){const{palette:n,cssVariables:i=!1,colorSchemes:a=n?void 0:{light:!0},defaultColorScheme:l=n==null?void 0:n.mode,...c}=e,d=l||"light",f=a==null?void 0:a[d],x={...a,...n?{[d]:{...typeof f!="boolean"&&f,palette:n}}:void 0};if(i===!1){if(!("colorSchemes"in e))return no(e,...r);let m=n;"palette"in e||x[d]&&(x[d]!==!0?m=x[d].palette:d==="dark"&&(m={mode:"dark"}));const b=no({...e,palette:m},...r);return b.defaultColorScheme=d,b.colorSchemes=x,b.palette.mode==="light"&&(b.colorSchemes.light={...x.light!==!0&&x.light,palette:b.palette},dn(b,"dark",x.dark)),b.palette.mode==="dark"&&(b.colorSchemes.dark={...x.dark!==!0&&x.dark,palette:b.palette},dn(b,"light",x.light)),b}return!n&&!("light"in x)&&d==="light"&&(x.light=!0),Zl({...c,colorSchemes:x,defaultColorScheme:d,...typeof i!="boolean"&&i},...r)}const tc=ec();function rc(){const e=sl(tc);return process.env.NODE_ENV!=="production"&&zr.useDebugValue(e),e[Js]||e}function oc({isOpen:e,onClose:r,onCreate:n}){const[i,a]=u.useState(""),[l,c]=u.useState(""),[d,f]=u.useState(null),[x,m]=u.useState(null),[b,g]=u.useState(!1),[v,C]=u.useState(""),p=u.useRef(null),T=async S=>{if(C(""),!S.name.endsWith(".json")){C("Please upload a JSON file");return}try{const R=await S.text(),Y=JSON.parse(R);if(!Array.isArray(Y)){C("JSON must be an array of objects");return}f(S),m(Y)}catch{C("Invalid JSON format")}},s=S=>{S.preventDefault();const R=S.dataTransfer.files[0];R&&T(R)},k=()=>{i.trim()&&x&&(n(i.trim(),l.trim(),x),D())},D=()=>{a(""),c(""),f(null),m(null),C(""),r()},A=!i.trim()||!x;return t.jsxs(t.Fragment,{children:[t.jsxs(o.Dialog,{open:e,onClose:D,maxWidth:"xs",fullWidth:!0,PaperProps:{sx:{borderRadius:"12px",width:480,boxShadow:"0 8px 16px 4px rgba(60, 64, 67, 0.12), 0 4px 16px 0px rgba(60, 64, 67, 0.08), 0 0 0 1px rgba(60, 64, 67, 0.05)"}},children:[t.jsxs(o.DialogTitle,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:3,py:2.5,fontWeight:500,fontSize:"1.125rem",color:"text.primary",letterSpacing:"-0.01em",borderBottom:"1px solid",borderColor:"divider"},children:["Create new report",t.jsx(o.IconButton,{onClick:D,size:"small",sx:{color:"text.secondary",borderRadius:1,"&:hover":{bgcolor:"action.hover",color:"text.primary"}},children:t.jsx(w.Close,{sx:{fontSize:18}})})]}),t.jsx(o.DialogContent,{sx:{px:3,pt:2,pb:2},children:t.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:2},children:[t.jsx(o.TextField,{label:"Report name",required:!0,fullWidth:!0,value:i,onChange:S=>a(S.target.value),placeholder:"Enter report name",autoFocus:!0,sx:{"& .MuiInputBase-root":{fontSize:"0.875rem",borderRadius:1,color:"text.primary"},"& .MuiInputLabel-root":{fontSize:"0.875rem",color:"text.secondary","&.Mui-focused":{color:"primary.main"}},"& .MuiOutlinedInput-root":{"& fieldset":{borderColor:"divider"},"&:hover fieldset":{borderColor:"text.secondary"},"&.Mui-focused fieldset":{borderColor:"primary.main",borderWidth:2}}}}),t.jsx(o.TextField,{label:"Description (optional)",fullWidth:!0,multiline:!0,rows:2,value:l,onChange:S=>c(S.target.value),placeholder:"Add details about this report",sx:{"& .MuiInputBase-root":{fontSize:"0.875rem",borderRadius:1,color:"text.primary"},"& .MuiInputLabel-root":{fontSize:"0.875rem",color:"text.secondary","&.Mui-focused":{color:"primary.main"}},"& .MuiOutlinedInput-root":{"& fieldset":{borderColor:"divider"},"&:hover fieldset":{borderColor:"text.secondary"},"&.Mui-focused fieldset":{borderColor:"primary.main",borderWidth:2}}}}),t.jsxs(o.Box,{children:[t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75,mb:1.25},children:[t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:500,fontSize:"0.875rem",color:"text.primary"},children:"Data source"}),t.jsx(o.IconButton,{size:"small",onClick:()=>g(!0),sx:{p:.25,color:"text.secondary","&:hover":{bgcolor:"action.hover"}},children:t.jsx(w.Info,{sx:{fontSize:16}})})]}),t.jsxs(o.Box,{onDrop:s,onDragOver:S=>S.preventDefault(),onClick:()=>{var S;return(S=p.current)==null?void 0:S.click()},sx:{position:"relative",border:"1.5px",borderStyle:x?"solid":"dashed",borderColor:x?"success.main":v?"error.main":"primary.main",borderRadius:2,p:3,textAlign:"center",cursor:"pointer",bgcolor:x?S=>ne(S.palette.success.main,.04):v?S=>ne(S.palette.error.main,.04):S=>ne(S.palette.primary.main,.04),transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)","&:hover":{bgcolor:x?S=>ne(S.palette.success.main,.08):v?S=>ne(S.palette.error.main,.08):S=>ne(S.palette.primary.main,.08),borderColor:x?"success.dark":v?"error.dark":"primary.dark"}},children:[t.jsx("input",{ref:p,type:"file",accept:".json",style:{display:"none"},onChange:S=>{var R;return((R=S.target.files)==null?void 0:R[0])&&T(S.target.files[0])}}),x?t.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:.75,animation:"fadeIn 0.2s ease-in","@keyframes fadeIn":{from:{opacity:0,transform:"scale(0.98)"},to:{opacity:1,transform:"scale(1)"}}},children:[t.jsx(o.Box,{sx:{width:40,height:40,borderRadius:"50%",bgcolor:S=>ne(S.palette.success.main,.1),display:"flex",alignItems:"center",justifyContent:"center",mb:.5},children:t.jsx(w.CheckCircle,{sx:{fontSize:24,color:"success.main"}})}),t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:500,color:"success.main",fontSize:"0.875rem"},children:d==null?void 0:d.name}),t.jsx(o.Typography,{variant:"caption",sx:{color:"success.dark",fontSize:"0.75rem"},children:"Ready to create"})]}):t.jsxs(o.Box,{children:[t.jsx(o.Box,{sx:{width:48,height:48,borderRadius:"50%",bgcolor:S=>ne(S.palette.primary.main,.1),display:"flex",alignItems:"center",justifyContent:"center",mx:"auto",mb:1.5},children:t.jsx(w.CloudUpload,{sx:{fontSize:28,color:"primary.main"}})}),t.jsx(o.Typography,{variant:"body2",sx:{color:"text.primary",fontSize:"0.875rem",fontWeight:500,mb:.25},children:"Upload JSON file"}),t.jsx(o.Typography,{variant:"caption",sx:{color:"text.secondary",fontSize:"0.75rem",display:"block"},children:"Click to browse or drag and drop"}),v&&t.jsx(o.Box,{sx:{mt:1.25,p:.75,borderRadius:1,bgcolor:S=>ne(S.palette.error.main,.08),border:1,borderColor:S=>ne(S.palette.error.main,.2)},children:t.jsx(o.Typography,{variant:"caption",sx:{color:"error.main",fontSize:"0.6875rem",fontWeight:500},children:v})})]})]})]})]})}),t.jsxs(o.DialogActions,{sx:{px:3,py:2,gap:1},children:[t.jsx(o.Button,{onClick:D,variant:"text",sx:{textTransform:"none",color:"primary.main",fontWeight:500,fontSize:"0.875rem",borderRadius:"4px",px:2,py:.625,minWidth:64,"&:hover":{bgcolor:S=>ne(S.palette.primary.main,.04)}},children:"Cancel"}),t.jsx(o.Button,{onClick:k,disabled:A,variant:"contained",disableElevation:!0,sx:{textTransform:"none",fontWeight:500,fontSize:"0.875rem",bgcolor:"primary.main",color:"primary.contrastText",borderRadius:"4px",px:2.5,py:.625,minWidth:64,"&:hover":{bgcolor:"primary.dark",boxShadow:2},"&:disabled":{bgcolor:"action.disabledBackground",color:"action.disabled"}},children:"Create"})]})]}),t.jsxs(o.Dialog,{open:b,onClose:()=>g(!1),maxWidth:"sm",PaperProps:{sx:{borderRadius:3,width:560,maxHeight:"80vh",boxShadow:8}},children:[t.jsxs(o.DialogTitle,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:3,py:2,fontWeight:500,fontSize:"1.25rem",color:"text.primary",letterSpacing:"-0.01em"},children:["JSON format guide",t.jsx(o.IconButton,{onClick:()=>g(!1),size:"small",sx:{color:"text.secondary","&:hover":{bgcolor:"action.hover"}},children:t.jsx(w.Close,{sx:{fontSize:20}})})]}),t.jsx(o.DialogContent,{sx:{px:3,py:2},children:t.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:2.5},children:[t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"subtitle2",sx:{fontWeight:500,mb:.75,color:"text.primary",fontSize:"0.875rem"},children:"Required format"}),t.jsx(o.Typography,{variant:"body2",sx:{color:"text.secondary",fontSize:"0.8125rem",lineHeight:1.5},children:"Your JSON file must be an array of objects. Each object represents a row, and all should have the same field names."})]}),t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"subtitle2",sx:{fontWeight:500,mb:.75,color:"text.primary",fontSize:"0.875rem"},children:"Example structure"}),t.jsx(o.Box,{component:"pre",sx:{bgcolor:"action.hover",border:1,borderColor:"divider",p:2,borderRadius:1,overflow:"auto",maxHeight:200,fontSize:"0.75rem",fontFamily:"monospace",lineHeight:1.5,color:"text.primary"},children:`[
78
+ {
79
+ "id": 1,
80
+ "customerName": "John Smith",
81
+ "email": "john@example.com",
82
+ "totalSpent": 1250.50,
83
+ "orderCount": 8,
84
+ "memberSince": "2024-01-15",
85
+ "status": "active"
86
+ },
87
+ {
88
+ "id": 2,
89
+ "customerName": "Sarah Johnson",
90
+ "email": "sarah@example.com",
91
+ "totalSpent": 3420.00,
92
+ "orderCount": 15,
93
+ "memberSince": "2023-11-20",
94
+ "status": "active"
95
+ },
96
+ {
97
+ "id": 3,
98
+ "customerName": "Mike Davis",
99
+ "email": "mike@example.com",
100
+ "totalSpent": 890.25,
101
+ "orderCount": 5,
102
+ "memberSince": "2024-03-10",
103
+ "status": "inactive"
104
+ }
105
+ ]`})]}),t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"subtitle2",sx:{fontWeight:500,mb:.75,color:"text.primary",fontSize:"0.875rem"},children:"Supported data types"}),t.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5},children:t.jsx(o.Typography,{variant:"body2",sx:{fontSize:"0.8125rem",color:"text.secondary"},children:"• Text, numbers, booleans, dates, and null values"})})]}),t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"subtitle2",sx:{fontWeight:500,mb:.75,color:"text.primary",fontSize:"0.875rem"},children:"Guidelines"}),t.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5},children:[t.jsx(o.Typography,{variant:"body2",sx:{fontSize:"0.8125rem",color:"text.secondary"},children:"• Must be valid JSON with array format"}),t.jsx(o.Typography,{variant:"body2",sx:{fontSize:"0.8125rem",color:"text.secondary"},children:"• All objects should have consistent field names"}),t.jsx(o.Typography,{variant:"body2",sx:{fontSize:"0.8125rem",color:"text.secondary"},children:'• Field names auto-format (e.g., "customerName" → "Customer Name")'})]})]})]})}),t.jsx(o.DialogActions,{sx:{px:3,py:2},children:t.jsx(o.Button,{onClick:()=>g(!1),variant:"contained",disableElevation:!0,sx:{textTransform:"none",fontWeight:500,fontSize:"0.875rem",bgcolor:"primary.main",color:"primary.contrastText",borderRadius:"4px",px:2.5,py:.625,minWidth:64,"&:hover":{bgcolor:"primary.dark",boxShadow:2}},children:"Got it"})})]})]})}function nc({isOpen:e,onClose:r}){return e?t.jsxs(o.Dialog,{open:e,onClose:r,maxWidth:"md",fullWidth:!0,PaperProps:{sx:{mt:8,borderRadius:"12px",boxShadow:"0 8px 16px 4px rgba(60, 64, 67, 0.12), 0 4px 16px 0px rgba(60, 64, 67, 0.08), 0 0 0 1px rgba(60, 64, 67, 0.05)"}},children:[t.jsxs(o.DialogTitle,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",pb:1},children:["JSON Format Guide",t.jsx(o.IconButton,{onClick:r,size:"small",sx:{color:"text.secondary"},children:t.jsx(w.Close,{sx:{fontSize:20}})})]}),t.jsx(o.DialogContent,{dividers:!0,children:t.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:3,py:1},children:[t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"subtitle2",gutterBottom:!0,children:"Expected JSON Structure"}),t.jsxs(o.Typography,{variant:"body2",color:"text.secondary",children:["The uploaded JSON must be an ",t.jsx("strong",{children:"array of objects"}),". Each object represents a single row in your report, and the keys of each object become the column names."]})]}),t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"subtitle2",gutterBottom:!0,children:"Example JSON"}),t.jsx(o.Paper,{elevation:0,sx:{p:2,bgcolor:"action.hover",border:1,borderColor:"divider",borderRadius:1,overflowX:"auto"},children:t.jsx(o.Box,{component:"pre",sx:{fontSize:"caption.fontSize",fontFamily:"monospace",m:0},children:`[
106
+ {
107
+ "Active Sessions": 33,
108
+ "Active State": true,
109
+ "Email": "alex@example.com",
110
+ "Last Login": "2024-08-22",
111
+ "Product Name": "Analytics Pro",
112
+ "Region": "Europe",
113
+ "Subscription Type": "Basic"
114
+ }
115
+ ]`})})]}),t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"subtitle2",gutterBottom:!0,children:"Supported Column Types"}),t.jsx(o.Typography,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:"The system automatically detects column types from your data:"}),t.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1},children:[t.jsxs(o.Box,{sx:{display:"flex",gap:1},children:[t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:500,minWidth:80},children:"Number:"}),t.jsxs(o.Typography,{variant:"body2",color:"text.secondary",children:["Numeric values (e.g., ",t.jsx(o.Box,{component:"code",sx:{bgcolor:"action.hover",px:.5,borderRadius:.5,fontFamily:"monospace",fontSize:"caption.fontSize"},children:"33"}),", ",t.jsx(o.Box,{component:"code",sx:{bgcolor:"action.hover",px:.5,borderRadius:.5,fontFamily:"monospace",fontSize:"caption.fontSize"},children:"42.5"}),")"]})]}),t.jsxs(o.Box,{sx:{display:"flex",gap:1},children:[t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:500,minWidth:80},children:"Boolean:"}),t.jsxs(o.Typography,{variant:"body2",color:"text.secondary",children:["True/false values (e.g., ",t.jsx(o.Box,{component:"code",sx:{bgcolor:"action.hover",px:.5,borderRadius:.5,fontFamily:"monospace",fontSize:"caption.fontSize"},children:"true"}),", ",t.jsx(o.Box,{component:"code",sx:{bgcolor:"action.hover",px:.5,borderRadius:.5,fontFamily:"monospace",fontSize:"caption.fontSize"},children:"false"}),")"]})]}),t.jsxs(o.Box,{sx:{display:"flex",gap:1},children:[t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:500,minWidth:80},children:"String:"}),t.jsxs(o.Typography,{variant:"body2",color:"text.secondary",children:["Text values (e.g., ",t.jsx(o.Box,{component:"code",sx:{bgcolor:"action.hover",px:.5,borderRadius:.5,fontFamily:"monospace",fontSize:"caption.fontSize"},children:'"Europe"'}),", ",t.jsx(o.Box,{component:"code",sx:{bgcolor:"action.hover",px:.5,borderRadius:.5,fontFamily:"monospace",fontSize:"caption.fontSize"},children:'"Analytics Pro"'}),")"]})]}),t.jsxs(o.Box,{sx:{display:"flex",gap:1},children:[t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:500,minWidth:80},children:"Date:"}),t.jsxs(o.Typography,{variant:"body2",color:"text.secondary",children:["ISO date strings (e.g., ",t.jsx(o.Box,{component:"code",sx:{bgcolor:"action.hover",px:.5,borderRadius:.5,fontFamily:"monospace",fontSize:"caption.fontSize"},children:'"2024-08-22"'}),")"]})]})]})]}),t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"subtitle2",gutterBottom:!0,children:"Notes"}),t.jsxs(o.Box,{component:"ul",sx:{m:0,pl:2.5,"& li":{fontSize:"body2.fontSize",color:"text.secondary",mb:.5}},children:[t.jsx("li",{children:"Each object in the array represents one row in the report."}),t.jsx("li",{children:"The keys of the JSON objects become report columns."}),t.jsx("li",{children:"All objects should have consistent keys for proper column detection."}),t.jsx("li",{children:"Column names are case-sensitive and preserve spacing."})]})]})]})}),t.jsx(o.DialogActions,{sx:{px:3,py:1.75,borderTop:"1px solid #e8eaed",bgcolor:"#f8f9fa",gap:1.25,justifyContent:"flex-end"},children:t.jsx(o.Button,{onClick:r,variant:"contained",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,bgcolor:"#1967d2",color:"#ffffff",px:3,py:.875,minHeight:36,borderRadius:"4px",boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15)",transition:"all 0.2s ease","&:hover":{bgcolor:"#1557b0",boxShadow:"0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15)"},"&:active":{boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3)",transform:"translateY(1px)"}},children:"Got it"})})]}):null}function ic({onFileUpload:e,onError:r,isUploading:n}){const[i,a]=u.useState(!1),[l,c]=u.useState(""),[d,f]=u.useState(!1),x=u.useRef(null),m=async s=>{if(!s.name.endsWith(".json")){r("Please upload a valid JSON file");return}c(s.name);try{const k=await s.text(),D=JSON.parse(k);if(!Array.isArray(D)){r("JSON must be an array of objects");return}if(D.length===0){r("JSON array is empty");return}e(D)}catch{r("Invalid JSON format. Please check your file and try again.")}finally{c("")}},b=s=>{s.preventDefault(),a(!0)},g=s=>{s.preventDefault(),a(!1)},v=s=>{s.preventDefault(),a(!1);const k=s.dataTransfer.files[0];k&&m(k)},C=()=>{var s;(s=x.current)==null||s.click()},p=s=>{var D;const k=(D=s.target.files)==null?void 0:D[0];k&&m(k)},T=s=>{s.stopPropagation(),f(!0)};return t.jsxs(t.Fragment,{children:[t.jsxs(o.Box,{onDragOver:b,onDragLeave:g,onDrop:v,onClick:C,sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:400,border:2,borderStyle:"dashed",borderColor:i?"primary.main":"divider",bgcolor:i?s=>ne(s.palette.primary.main,.12):"transparent",borderRadius:1,px:2,py:6,cursor:"pointer",transition:"all 0.2s",opacity:n?.5:1,pointerEvents:n?"none":"auto","&:hover":{borderColor:i?"primary.main":"text.secondary"}},children:[t.jsx(o.Box,{component:"input",ref:x,type:"file",accept:".json",onChange:p,sx:{display:"none"}}),n?t.jsxs(t.Fragment,{children:[t.jsx(o.CircularProgress,{size:32,sx:{mb:2}}),t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:500,mb:.5},children:"Uploading..."}),l&&t.jsx(o.Typography,{variant:"caption",color:"text.secondary",children:l})]}):t.jsxs(t.Fragment,{children:[t.jsx(o.Box,{sx:{width:64,height:64,borderRadius:"50%",bgcolor:s=>ne(s.palette.primary.main,.12),display:"flex",alignItems:"center",justifyContent:"center",mb:2},children:t.jsx(w.UploadFile,{sx:{fontSize:32,color:"primary.main"}})}),t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:1,mb:1.5},children:[t.jsx(o.Button,{variant:"contained",sx:{fontWeight:500},children:"Upload Data (JSON)"}),t.jsx(o.IconButton,{onClick:T,size:"small",sx:{border:1,borderColor:"divider","&:hover":{borderColor:"text.secondary",bgcolor:"action.hover"}},title:"View JSON format guide",children:t.jsx(w.InfoOutlined,{sx:{fontSize:16}})})]}),t.jsx(o.Typography,{variant:"body2",color:"text.secondary",sx:{textAlign:"center",maxWidth:500},children:"Upload structured JSON data to generate your report."}),t.jsx(o.Typography,{variant:"caption",color:"text.secondary",sx:{mt:1},children:"Click to browse or drag and drop a JSON file here"})]})]}),t.jsx(nc,{isOpen:d,onClose:()=>f(!1)})]})}function sc({schema:e,onConfirm:r,hasConflicts:n}){return t.jsxs(o.Paper,{sx:{border:2,borderColor:"divider",p:3},children:[t.jsxs(o.Box,{sx:{mb:2},children:[t.jsx(o.Typography,{variant:"h6",sx:{fontWeight:600,mb:.5},children:"Schema Preview"}),t.jsx(o.Typography,{variant:"body2",color:"text.secondary",children:"Review the detected schema before generating your table"})]}),n&&t.jsxs(o.Alert,{severity:"warning",sx:{mb:2},children:[t.jsx(o.AlertTitle,{sx:{fontWeight:600},children:"Schema Conflict Detected"}),"Some columns have inconsistent data types across rows. Please resolve these conflicts before proceeding."]}),t.jsx(o.TableContainer,{sx:{mb:3},children:t.jsxs(o.Table,{children:[t.jsx(o.TableHead,{children:t.jsxs(o.TableRow,{sx:{bgcolor:"action.hover"},children:[t.jsx(o.TableCell,{sx:{fontWeight:600,textTransform:"uppercase",fontSize:"caption.fontSize"},children:"Column Name"}),t.jsx(o.TableCell,{sx:{fontWeight:600,textTransform:"uppercase",fontSize:"caption.fontSize"},children:"Detected Type"}),t.jsx(o.TableCell,{sx:{fontWeight:600,textTransform:"uppercase",fontSize:"caption.fontSize"},children:"Status"})]})}),t.jsx(o.TableBody,{children:e.map(i=>t.jsxs(o.TableRow,{sx:{bgcolor:i.hasConflict?a=>ne(a.palette.warning.main,.12):"transparent"},children:[t.jsxs(o.TableCell,{sx:{fontWeight:500},children:[i.name,i.hasConflict&&t.jsx(o.Box,{component:"span",sx:{ml:1,color:"warning.main"},children:"⚠"})]}),t.jsx(o.TableCell,{children:t.jsx(o.Chip,{label:i.type,size:"small",sx:{bgcolor:"action.hover"}})}),t.jsx(o.TableCell,{children:t.jsx(o.Chip,{label:i.required?"Required":"Optional",size:"small",color:i.required?"success":"default"})})]},i.name))})]})}),t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",pt:2,borderTop:1,borderColor:"divider"},children:[t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[t.jsx(w.Lock,{sx:{fontSize:16}}),t.jsx(o.Typography,{variant:"body2",color:"text.secondary",children:"Schema will be locked for this report"})]}),t.jsx(o.Button,{variant:"contained",onClick:r,disabled:n,sx:{fontWeight:500},children:"Generate Table"})]})]})}function ac({error:e,onRetry:r}){return t.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:400,border:2,borderColor:"error.light",bgcolor:n=>ne(n.palette.error.main,.12),borderRadius:1,px:2,py:6},children:[t.jsx(o.Box,{sx:{width:64,height:64,borderRadius:"50%",bgcolor:n=>ne(n.palette.error.main,.3),display:"flex",alignItems:"center",justifyContent:"center",mb:2},children:t.jsx(w.ErrorOutline,{color:"error",sx:{fontSize:32}})}),t.jsx(o.Typography,{variant:"h6",color:"error.main",sx:{fontWeight:600,mb:1},children:"Upload Failed"}),t.jsx(o.Typography,{variant:"body2",color:"error.main",sx:{textAlign:"center",maxWidth:500,mb:3},children:e}),t.jsx(o.Button,{variant:"contained",color:"error",startIcon:t.jsx(w.Upload,{sx:{fontSize:16}}),onClick:r,sx:{fontWeight:500},children:"Try Again"})]})}function Un({title:e,description:r,showIcon:n=!0}){return t.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"60vh",px:3,py:8},children:[n&&t.jsx(o.Box,{sx:{width:80,height:80,borderRadius:"50%",bgcolor:i=>ne(i.palette.primary.main,.1),display:"flex",alignItems:"center",justifyContent:"center",mb:3},children:t.jsx(w.Description,{sx:{fontSize:36,color:"primary.main"}})}),t.jsx(o.Typography,{variant:"h5",sx:{fontWeight:500,mb:1,color:"text.primary",fontSize:"1.125rem"},children:e}),t.jsx(o.Typography,{variant:"body1",sx:{textAlign:"center",maxWidth:520,color:"text.secondary",fontSize:"0.875rem",lineHeight:1.5},children:r})]})}function lc({value:e,onChange:r,searchHistory:n,onAddToHistory:i,onToggleFavourite:a,onDeleteHistory:l,disabled:c}){const[d,f]=u.useState(!1),[x,m]=u.useState(!1),[b,g]=u.useState(-1),v=u.useRef(null),C=u.useRef(null);u.useEffect(()=>{function _(K){v.current&&!v.current.contains(K.target)&&(f(!1),m(!1))}return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[]);const p=u.useCallback(()=>{m(!0),g(-1),n.length>0&&f(!0)},[n.length]),T=u.useCallback(_=>{r(_),g(-1)},[r]),s=u.useCallback(_=>{var K;r(_),i(_),f(!1),(K=C.current)==null||K.blur()},[r,i]),k=u.useCallback(_=>{g(-1),s(_)},[s]),D=u.useCallback(_=>{var K;_.key==="Enter"?b>=0&&b<n.length?(_.preventDefault(),k(n[b].query)):e.trim()&&s(e.trim()):_.key==="Escape"?(f(!1),g(-1),(K=C.current)==null||K.blur()):_.key==="ArrowDown"?(_.preventDefault(),n.length>0&&(d||f(!0),g(V=>V<n.length-1?V+1:V))):_.key==="ArrowUp"&&(_.preventDefault(),g(V=>V>0?V-1:-1))},[b,n,e,d,k,s]),A=u.useCallback(()=>{var _;r(""),(_=C.current)==null||_.focus()},[r]),S=u.useMemo(()=>n.filter(_=>_.isFavourite),[n]),R=u.useMemo(()=>n.filter(_=>!_.isFavourite),[n]),Y=d&&n.length>0;return t.jsxs(o.Box,{sx:{position:"relative",width:256},ref:v,children:[t.jsx(o.TextField,{inputRef:C,size:"small",fullWidth:!0,value:e,onChange:_=>T(_.target.value),onFocus:p,onKeyDown:D,placeholder:"Search all columns...",disabled:c,sx:{"& .MuiOutlinedInput-root":{borderRadius:"28px",fontSize:"0.875rem",bgcolor:"#f1f3f4","& fieldset":{borderColor:"transparent",transition:"all 0.15s ease"},"&:hover":{bgcolor:"#e8eaed"},"&:hover fieldset":{borderColor:"transparent"},"&.Mui-focused":{bgcolor:"background.paper"},"&.Mui-focused fieldset":{borderColor:"#0b57d0",borderWidth:2}}},InputProps:{startAdornment:t.jsx(o.InputAdornment,{position:"start",children:t.jsx(w.Search,{sx:{fontSize:16,color:"text.secondary"}})}),endAdornment:e?t.jsx(o.InputAdornment,{position:"end",children:t.jsx(o.IconButton,{size:"small",onClick:A,edge:"end",children:t.jsx(w.Close,{sx:{fontSize:16}})})}):null}}),Y&&t.jsxs(o.Paper,{sx:{position:"absolute",zIndex:50,mt:.5,width:"100%",maxHeight:384,overflowY:"auto"},elevation:3,children:[S.length>0&&t.jsxs(o.Box,{sx:{py:1},children:[t.jsx(o.Typography,{variant:"caption",sx:{px:1.5,py:.75,display:"block",fontWeight:600,textTransform:"uppercase",color:"text.secondary",letterSpacing:"0.05em"},children:"Favourite Searches"}),S.map((_,K)=>t.jsx(un,{entry:_,isSelected:b===K,onClick:()=>k(_.query),onToggleFavourite:()=>a(_.query),onDelete:()=>l(_.query)},`fav-${_.query}`))]}),R.length>0&&t.jsxs(o.Box,{sx:{py:1},children:[S.length>0&&t.jsx(o.Divider,{}),t.jsx(o.Typography,{variant:"caption",sx:{px:1.5,py:.75,display:"block",fontWeight:600,textTransform:"uppercase",color:"text.secondary",letterSpacing:"0.05em"},children:"Recent Searches"}),R.map((_,K)=>{const V=S.length+K;return t.jsx(un,{entry:_,isSelected:b===V,onClick:()=>k(_.query),onToggleFavourite:()=>a(_.query),onDelete:()=>l(_.query)},`recent-${_.query}`)})]})]})]})}const un=u.memo(function({entry:r,isSelected:n,onClick:i,onToggleFavourite:a,onDelete:l}){const c=u.useCallback(f=>{f.stopPropagation(),a()},[a]),d=u.useCallback(f=>{f.stopPropagation(),l()},[l]);return t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:1.5,py:1,cursor:"pointer",bgcolor:n?f=>ne(f.palette.primary.main,.12):"transparent","&:hover":{bgcolor:n?f=>ne(f.palette.primary.main,.12):"action.hover"}},children:[t.jsx(o.Box,{sx:{flex:1,minWidth:0},onClick:i,children:t.jsx(o.Typography,{variant:"body2",noWrap:!0,children:r.query})}),t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5,ml:1},children:[t.jsx(o.IconButton,{size:"small",onClick:c,title:r.isFavourite?"Remove from favourites":"Add to favourites",sx:{p:.5},children:r.isFavourite?t.jsx(w.Star,{sx:{fontSize:14,color:"warning.light"}}):t.jsx(w.StarBorder,{sx:{fontSize:14,color:"action.disabled"}})}),t.jsx(o.IconButton,{size:"small",onClick:d,title:"Delete from history",sx:{p:.5,"&:hover":{color:"error.main"}},children:t.jsx(w.Delete,{sx:{fontSize:14,opacity:.5}})})]})]})});function cc({views:e,activeViewId:r,isDirty:n,onSelectView:i,onCreateView:a,onManageViews:l,onToggleDefault:c,onToggleFavorite:d,onRestoreView:f,onPermanentDelete:x,isReadOnly:m}){const b=rc(),[g,v]=u.useState(!1),[C,p]=u.useState(!1),[T,s]=u.useState({top:0,left:0}),k=u.useRef(null),D=u.useRef(null),A=e.find(E=>E.id===r),S=A==null?void 0:A.isDefault,R=e.filter(E=>E.isDefault&&!E.isDeleted),Y=e.filter(E=>!E.isDefault&&!E.isDeleted).sort((E,H)=>(H.updatedAt||0)-(E.updatedAt||0)),_=e.filter(E=>E.isFavorite&&!E.isDeleted).sort((E,H)=>(H.updatedAt||0)-(E.updatedAt||0)),K=e.filter(E=>E.isDeleted);u.useEffect(()=>{if(g&&D.current){const E=D.current.getBoundingClientRect();s({top:E.bottom+window.scrollY+8,left:E.left+window.scrollX})}},[g]),u.useEffect(()=>{const E=H=>{k.current&&!k.current.contains(H.target)&&D.current&&!D.current.contains(H.target)&&v(!1)};return g&&document.addEventListener("mousedown",E),()=>{document.removeEventListener("mousedown",E)}},[g]);const V=E=>{i(E),v(!1)},te=(E,H=!1)=>t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,py:1,fontSize:"body2.fontSize",backgroundColor:r===E.id?b.palette.primary.light+"20":"transparent",transition:"background-color 0.2s","&:hover":{backgroundColor:r===E.id?b.palette.primary.light+"20":b.palette.grey[50]}},children:[t.jsxs(o.Button,{onClick:()=>V(E.id),sx:{display:"flex",alignItems:"center",gap:1,flex:1,textAlign:"left",minWidth:0,textTransform:"none",justifyContent:"flex-start",color:"inherit",p:0,"&:hover":{backgroundColor:"transparent"}},children:[r===E.id&&t.jsx(w.Check,{sx:{fontSize:16,flexShrink:0}}),r!==E.id&&t.jsx(o.Box,{sx:{width:"16px",flexShrink:0}}),t.jsx(o.Typography,{sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:r===E.id?b.palette.primary.dark:b.palette.text.primary,fontWeight:r===E.id?500:400},children:E.name}),H&&t.jsx(o.Typography,{component:"span",sx:{fontSize:"caption.fontSize",color:b.palette.text.secondary,backgroundColor:b.palette.grey[100],px:1,py:.25,borderRadius:1,flexShrink:0},children:"Default"})]}),t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5,flexShrink:0},children:[d&&t.jsx(o.IconButton,{onClick:de=>{de.stopPropagation(),d(E.id)},size:"small",sx:{p:.5,transition:"background-color 0.2s","&:hover":{backgroundColor:b.palette.grey[200]}},title:E.isFavorite?"Remove from favorites":"Add to favorites",children:t.jsx(w.Star,{sx:{fontSize:16}})}),c&&!E.isDefault&&t.jsx(o.IconButton,{onClick:de=>{de.stopPropagation(),c(E.id)},size:"small",sx:{p:.5,transition:"background-color 0.2s","&:hover":{backgroundColor:b.palette.grey[200]}},title:"Set as default",children:t.jsx(w.RadioButtonUnchecked,{sx:{fontSize:16}})})]})]},E.id),h=E=>t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,py:1,fontSize:"body2.fontSize",backgroundColor:b.palette.grey[50]},children:[t.jsx(o.Typography,{sx:{color:b.palette.text.secondary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:E.name}),t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5,flexShrink:0},children:[f&&t.jsx(o.IconButton,{onClick:H=>{H.stopPropagation(),f(E.id)},size:"small",sx:{p:.5,transition:"background-color 0.2s","&:hover":{backgroundColor:b.palette.grey[200]}},title:"Restore view",children:t.jsx(w.Undo,{sx:{fontSize:16,color:"success.main"}})}),x&&t.jsx(o.IconButton,{onClick:H=>{H.stopPropagation(),x(E.id)},size:"small",sx:{p:.5,transition:"background-color 0.2s","&:hover":{backgroundColor:b.palette.grey[200]}},title:"Delete permanently",children:t.jsx(w.Delete,{sx:{fontSize:16,color:"error.main"}})})]})]},E.id),F=n||!S,W=n;return t.jsxs(o.Box,{sx:{position:"relative"},children:[t.jsxs(o.Button,{ref:D,onClick:()=>v(!g),sx:{display:"flex",alignItems:"center",gap:.75,px:1.5,py:.625,fontSize:"0.8125rem",fontWeight:500,borderRadius:1,border:1,borderColor:F?"warning.main":"divider",background:"transparent",color:"inherit",cursor:"pointer",whiteSpace:"nowrap",transition:"border-color 0.15s ease, background-color 0.15s ease",textTransform:"none",mr:.5,"&:hover":{bgcolor:E=>ne(E.palette.primary.main,.04),borderColor:F?"warning.dark":"primary.main"}},children:[W&&t.jsx(o.Box,{component:"span",sx:{width:8,height:8,borderRadius:"50%",bgcolor:"warning.main",flexShrink:0}}),t.jsx(o.Typography,{component:"span",sx:{color:"text.secondary",fontSize:"inherit",letterSpacing:0},children:"View: "}),t.jsx(o.Typography,{component:"span",sx:{fontWeight:600,fontSize:"inherit",color:"text.primary"},children:(A==null?void 0:A.name)||"Default View"}),t.jsx(w.KeyboardArrowDown,{sx:{fontSize:16,color:"text.secondary",ml:.25,flexShrink:0}})]}),g&&gn.createPortal(t.jsxs(o.Box,{ref:k,sx:{position:"fixed",width:"320px",backgroundColor:b.palette.background.paper,border:`1px solid ${b.palette.divider}`,borderRadius:1,boxShadow:b.shadows[8],zIndex:50,maxHeight:"500px",overflowY:"auto",top:T.top,left:T.left},children:[R.length>0&&t.jsxs(o.Box,{sx:{py:.5},children:[t.jsx(o.Typography,{sx:{px:2,py:1,fontSize:"caption.fontSize",fontWeight:600,color:b.palette.text.secondary,textTransform:"uppercase",letterSpacing:"0.05em"},children:"Default Views"}),R.map(E=>te(E,!0))]}),_.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(o.Box,{sx:{borderTop:`1px solid ${b.palette.divider}`}}),t.jsxs(o.Box,{sx:{py:.5},children:[t.jsxs(o.Box,{sx:{px:2,py:1,fontSize:"caption.fontSize",fontWeight:600,color:b.palette.text.secondary,textTransform:"uppercase",letterSpacing:"0.05em",display:"flex",alignItems:"center",gap:.5},children:[t.jsx(w.Star,{sx:{fontSize:12,color:"warning.light"}}),t.jsx(o.Typography,{component:"span",sx:{fontSize:"inherit",fontWeight:"inherit"},children:"Favorite Views"})]}),_.map(E=>te(E))]})]}),Y.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(o.Box,{sx:{borderTop:`1px solid ${b.palette.divider}`}}),t.jsxs(o.Box,{sx:{py:.5},children:[t.jsx(o.Typography,{sx:{px:2,py:1,fontSize:"caption.fontSize",fontWeight:600,color:b.palette.text.secondary,textTransform:"uppercase",letterSpacing:"0.05em"},children:"Custom Views"}),Y.map(E=>te(E))]})]}),K.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(o.Box,{sx:{borderTop:`1px solid ${b.palette.divider}`}}),t.jsxs(o.Box,{sx:{py:.5},children:[t.jsxs(o.Button,{onClick:()=>p(!C),sx:{width:"100%",px:2,py:1,fontSize:"caption.fontSize",fontWeight:600,color:b.palette.text.secondary,textTransform:"uppercase",letterSpacing:"0.05em",display:"flex",alignItems:"center",justifyContent:"space-between",transition:"background-color 0.2s","&:hover":{backgroundColor:b.palette.grey[50]}},children:[t.jsxs(o.Typography,{component:"span",sx:{fontSize:"inherit",fontWeight:"inherit"},children:["Recently Deleted (",K.length,")"]}),t.jsx(w.ChevronRight,{sx:{fontSize:16}})]}),C&&t.jsx(o.Box,{sx:{backgroundColor:b.palette.grey[50]},children:K.map(E=>h(E))})]})]}),t.jsx(o.Box,{sx:{borderTop:`1px solid ${b.palette.divider}`}}),t.jsxs(o.Button,{onClick:()=>{a(),v(!1)},sx:{width:"100%",display:"flex",alignItems:"center",gap:1,px:2,py:1,fontSize:"body2.fontSize",color:b.palette.text.primary,textTransform:"none",justifyContent:"flex-start",transition:"background-color 0.2s","&:hover":{backgroundColor:b.palette.grey[50]}},children:[t.jsx(w.Add,{sx:{fontSize:16}}),t.jsx(o.Typography,{component:"span",sx:{fontSize:"inherit"},children:"Create New Report View"})]}),t.jsxs(o.Button,{onClick:()=>{l(),v(!1)},sx:{width:"100%",display:"flex",alignItems:"center",gap:1,px:2,py:1,fontSize:"body2.fontSize",color:b.palette.text.primary,textTransform:"none",justifyContent:"flex-start",transition:"background-color 0.2s","&:hover":{backgroundColor:b.palette.grey[50]}},children:[t.jsx(w.Settings,{sx:{fontSize:16}}),t.jsx(o.Typography,{component:"span",sx:{fontSize:"inherit"},children:"View Setup"})]})]}),document.body)]})}function dc({onClick:e,hiddenCount:r,hasCustomOrder:n}){const i=r>0||n;return t.jsxs(o.Button,{onClick:e,variant:"text",size:"small",startIcon:t.jsx(w.ViewColumn,{sx:{fontSize:18}}),sx:{color:i?"#0b57d0":"text.secondary",textTransform:"none",fontWeight:i?500:400,fontSize:"0.875rem",px:1.5,py:0,height:36,minWidth:"auto",borderRadius:"18px",border:i?"1px solid #d3e3fd":"1px solid transparent",bgcolor:i?"#e8f0fe":"transparent",transition:"all 0.15s ease","&:hover":{bgcolor:i?"#d3e3fd":a=>ne(a.palette.text.primary,.06),color:i?"#0b57d0":"text.primary"}},children:["Columns",i&&t.jsx(o.Box,{component:"span",sx:{ml:.5,width:18,height:18,display:"inline-flex",alignItems:"center",justifyContent:"center",bgcolor:"#0b57d0",color:"#fff",borderRadius:"50%",fontSize:"0.65rem",fontWeight:700,lineHeight:1},children:r>0?r:"✓"})]})}function uc({columnName:e,columnType:r="string",currentSort:n,hasFilters:i,isInSortStack:a,position:l,onSort:c,onRemoveSort:d,onSortAscending:f,onSortDescending:x,onFilter:m,onClearFilter:b,onHideColumn:g,onManageColumns:v,onManageViews:C,onResetLayout:p,onClose:T}){const s=u.useRef(null);u.useEffect(()=>{const D=S=>{s.current&&!s.current.contains(S.target)&&T()},A=S=>{S.key==="Escape"&&T()};return document.addEventListener("mousedown",D),document.addEventListener("keydown",A),()=>{document.removeEventListener("mousedown",D),document.removeEventListener("keydown",A)}},[T]);const k=()=>n?n.direction==="asc"?r==="number"?"(0→9)":r==="boolean"?"(False→True)":"(A→Z)":r==="number"?"(9→0)":r==="boolean"?"(True→False)":"(Z→A)":"";return gn.createPortal(t.jsxs(o.Paper,{ref:s,sx:{position:"fixed",left:`${l.x}px`,top:`${l.y}px`,zIndex:100,minWidth:240},elevation:3,children:[t.jsxs(o.Box,{sx:{px:2,py:1},children:[t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:1},children:[t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:500},children:"Sorting"}),t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[t.jsx(o.IconButton,{size:"small",onClick:()=>{f?f(e):(n==null?void 0:n.direction)!=="asc"&&(c(e),(n==null?void 0:n.direction)==="desc"&&setTimeout(()=>c(e),0))},title:"Sort Ascending",sx:{p:.75},children:t.jsx(w.ArrowUpward,{color:(n==null?void 0:n.direction)==="asc"?"primary":void 0,sx:{fontSize:16}})}),t.jsx(o.IconButton,{size:"small",onClick:()=>{x?x(e):n?n.direction==="asc"&&c(e):(c(e),setTimeout(()=>c(e),0))},title:"Sort Descending",sx:{p:.75},children:t.jsx(w.ArrowDownward,{color:(n==null?void 0:n.direction)==="desc"?"primary":void 0,sx:{fontSize:16}})}),t.jsx(o.IconButton,{size:"small",onClick:()=>d(e),title:"Clear sorting",disabled:!n,sx:{p:.75,"&:hover":{color:"error.main"}},children:t.jsx(w.Close,{sx:{fontSize:16}})})]})]}),n&&t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:1,mt:.5},children:[t.jsx(o.Typography,{variant:"caption",color:"text.secondary",children:k()}),t.jsx(o.Chip,{label:`Level ${n.priority}`,size:"small",color:"primary",sx:{height:20,fontSize:"caption.fontSize"}})]})]}),t.jsx(o.Divider,{}),t.jsxs(o.MenuList,{dense:!0,children:[t.jsxs(o.MenuItem,{onClick:()=>{m(e),T()},children:[t.jsx(w.FilterList,{sx:{fontSize:16,mr:1}}),"Filter this column",i&&t.jsx(o.Chip,{label:"Active",size:"small",color:"primary",sx:{ml:"auto",height:20,fontSize:"caption.fontSize"}})]}),i&&t.jsxs(o.MenuItem,{onClick:()=>{b(e),T()},sx:{color:"warning.main"},children:[t.jsx(w.FilterListOff,{sx:{fontSize:16,mr:1}}),"Clear Filters"]})]}),t.jsx(o.Divider,{}),t.jsx(o.MenuList,{dense:!0,children:t.jsxs(o.MenuItem,{onClick:()=>{g(e),T()},children:[t.jsx(w.VisibilityOff,{sx:{fontSize:16,mr:1}}),"Hide column"]})}),t.jsx(o.Divider,{}),t.jsxs(o.MenuList,{dense:!0,children:[t.jsxs(o.MenuItem,{onClick:()=>{v(),T()},children:[t.jsx(w.Settings,{sx:{fontSize:16,mr:1}}),"Column Settings"]}),t.jsxs(o.MenuItem,{onClick:()=>{C(),T()},children:[t.jsx(w.Description,{sx:{fontSize:16,mr:1}}),"View Setup"]}),t.jsxs(o.MenuItem,{onClick:()=>{p(),T()},children:[t.jsx(w.Undo,{sx:{fontSize:16,mr:1}}),"Reset to Default Layout"]})]})]}),document.body)}const fc=150,fn="COLUMN_HEADER",pc=u.memo(function({column:r,index:n,sortRule:i,hasFilters:a,isInSortStack:l,width:c,onColumnClick:d,onMoveColumn:f,onResizeStart:x,onSort:m,onRemoveSort:b,onSortAscending:g,onSortDescending:v,onOpenFilterForColumn:C,onClearFiltersForColumn:p,onHideColumn:T,onManageColumns:s,onManageViews:k,onResetLayout:D}){const A=u.useRef(null),[S,R]=u.useState(!1),[Y,_]=u.useState({x:0,y:0}),[{handlerId:K,isOver:V},te]=dt.useDrop({accept:fn,collect(O){return{handlerId:O.getHandlerId(),isOver:O.isOver()}},hover(O,N){var oe;if(!A.current)return;const Q=O.index,X=n;if(Q===X)return;const Z=(oe=A.current)==null?void 0:oe.getBoundingClientRect(),re=(Z.right-Z.left)/2,J=N.getClientOffset(),q=((J==null?void 0:J.x)??0)-Z.left;Q<X&&q<re||Q>X&&q>re||(f(Q,X),O.index=X)}}),[{isDragging:h},F]=dt.useDrag({type:fn,item:()=>({index:n,columnName:r.name}),collect:O=>({isDragging:O.isDragging()})});F(te(A));const W=u.useCallback(O=>{O.preventDefault(),O.stopPropagation(),_({x:O.clientX,y:O.clientY}),R(!0)},[]),E=u.useCallback(()=>{R(!1)},[]),H=u.useCallback(()=>{d(r.name)},[d,r.name]),de=u.useCallback(O=>{O.stopPropagation(),C(r.name)},[C,r.name]),ue=u.useCallback(()=>i?t.jsxs(o.Box,{sx:{display:"inline-flex",alignItems:"center",ml:.5,gap:.25,color:"#0b57d0"},children:[i.direction==="asc"?t.jsx(w.ArrowUpward,{sx:{fontSize:13,color:"#0b57d0"}}):t.jsx(w.ArrowDownward,{sx:{fontSize:13,color:"#0b57d0"}}),t.jsx(o.Box,{sx:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:16,height:16,bgcolor:"#0b57d0",color:"#fff",fontSize:"0.6rem",fontWeight:700,borderRadius:"50%",lineHeight:1},children:i.priority})]}):null,[i]),Be=u.useCallback(()=>a?t.jsx(o.Box,{onClick:de,title:"Active filters on this column",sx:{ml:.75,width:7,height:7,borderRadius:"50%",bgcolor:"#0b57d0",cursor:"pointer",flexShrink:0,"&:hover":{transform:"scale(1.25)"},transition:"transform 0.12s ease"}}):null,[a,de]);return t.jsxs(t.Fragment,{children:[t.jsxs(o.TableCell,{ref:A,"data-handler-id":K,"data-column-index":n,onClick:H,onContextMenu:W,sx:{position:"sticky",top:0,zIndex:5,textAlign:"left",fontSize:"0.8125rem",fontWeight:400,textTransform:"none",letterSpacing:0,whiteSpace:"nowrap",cursor:"pointer",userSelect:"none",color:"#5f6368",opacity:h?.25:1,transition:"background-color 0.12s ease, opacity 0.15s ease",bgcolor:V?O=>ne(O.palette.primary.main,.06):"#f8f9fa",borderBottom:"none",py:0,px:2,height:44,"&:hover":{bgcolor:"#e8eaed",color:"#3c4043"},width:c?`${c}px`:`${fc}px`},children:[t.jsxs(o.Box,{sx:{display:"inline-flex",alignItems:"center"},children:[Ct(r.name),ue(),Be()]}),t.jsx(o.Box,{sx:{position:"absolute",right:0,top:0,height:"100%",width:8,cursor:"col-resize",zIndex:10,"&:hover":{bgcolor:"primary.light"}},onMouseDown:O=>{O.stopPropagation(),x(O,r.name)},onClick:O=>O.stopPropagation()}),V&&t.jsx(o.Box,{sx:{position:"absolute",left:0,top:0,bottom:0,width:4,bgcolor:"primary.main"}})]}),S&&t.jsx(uc,{columnName:r.name,columnType:r.type,currentSort:i,hasFilters:a,isInSortStack:l,position:Y,onSort:m,onRemoveSort:b,onSortAscending:g,onSortDescending:v,onFilter:C,onClearFilter:p,onHideColumn:T,onManageColumns:s,onManageViews:k,onResetLayout:D,onClose:E})]})});function xc({selectedCount:e,onExportSelected:r,onClearSelection:n}){const[i,a]=u.useState(null);if(e===0)return null;const l=f=>{a(f.currentTarget)},c=f=>{r(f),a(null)},d=()=>{a(null)};return t.jsx(o.Box,{sx:{position:"fixed",bottom:24,left:"50%",transform:"translateX(-50%)",zIndex:50},children:t.jsxs(o.Box,{sx:{bgcolor:"warning.main",color:"warning.contrastText",boxShadow:3,borderRadius:2,px:3,py:1.5,display:"flex",alignItems:"center",gap:2},children:[t.jsxs(o.Typography,{variant:"body2",sx:{fontWeight:500},children:[e," ",e===1?"row":"rows"," selected"]}),t.jsx(o.Divider,{orientation:"vertical",flexItem:!0,sx:{bgcolor:"warning.light",opacity:.5}}),t.jsx(o.Button,{onClick:l,startIcon:t.jsx(w.Download,{sx:{fontSize:16}}),size:"small",sx:{bgcolor:f=>ne(f.palette.warning.dark,.3),color:"warning.contrastText","&:hover":{bgcolor:f=>ne(f.palette.warning.dark,.5)},textTransform:"none"},children:"Export Selected"}),t.jsxs(o.Menu,{anchorEl:i,open:!!i,onClose:d,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},children:[t.jsx(o.MenuItem,{onClick:()=>c("csv"),children:"Export as CSV"}),t.jsx(o.MenuItem,{onClick:()=>c("excel"),children:"Export as Excel"}),t.jsx(o.MenuItem,{onClick:()=>c("json"),children:"Export as JSON"})]}),t.jsx(o.Divider,{orientation:"vertical",flexItem:!0,sx:{bgcolor:"primary.light",opacity:.5}}),t.jsx(o.Button,{onClick:n,startIcon:t.jsx(w.Close,{sx:{fontSize:16}}),size:"small",sx:{color:"warning.contrastText","&:hover":{bgcolor:f=>ne(f.palette.warning.dark,.3)},textTransform:"none"},children:"Clear Selection"})]})})}const pn=[10,25,50,100];function hc({currentPage:e,pageSize:r,totalRows:n,onPageChange:i,onPageSizeChange:a}){const l=Math.ceil(n/r);if(n<=Math.min(...pn))return null;const c=()=>{e>1&&i(e-1)},d=()=>{e<l&&i(e+1)},f=(e-1)*r+1,x=Math.min(e*r,n);return t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:3,px:2,py:1,borderTop:"1px solid",borderColor:"divider",bgcolor:"background.paper",minHeight:48},children:[t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[t.jsx(o.Typography,{variant:"caption",sx:{fontSize:"0.8125rem",color:"text.secondary",fontWeight:400},children:"Rows per page:"}),t.jsx(o.Select,{value:r,onChange:m=>a(Number(m.target.value)),size:"small",MenuProps:{PaperProps:{sx:{maxHeight:300}},anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"}},sx:{minWidth:70,fontSize:"0.8125rem",color:"text.primary","& .MuiSelect-select":{py:.5,px:1.5},"& .MuiOutlinedInput-notchedOutline":{borderColor:"divider"}},children:pn.map(m=>t.jsx(o.MenuItem,{value:m,sx:{fontSize:"0.8125rem"},children:m},m))})]}),t.jsxs(o.Typography,{variant:"caption",sx:{fontSize:"0.8125rem",color:"text.secondary",fontWeight:400},children:[f,"–",x," of ",n]}),t.jsxs(o.Typography,{variant:"caption",sx:{fontSize:"0.8125rem",color:"text.secondary",fontWeight:400},children:["Page ",e," of ",l]}),t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[t.jsx(o.IconButton,{onClick:c,disabled:e===1,size:"small",title:"Previous page",sx:{p:.75,color:"text.secondary","&:hover":{bgcolor:"action.hover"},"&.Mui-disabled":{color:"action.disabled"}},children:t.jsx(w.ChevronLeft,{sx:{fontSize:20}})}),t.jsx(o.IconButton,{onClick:d,disabled:e===l,size:"small",title:"Next page",sx:{p:.75,color:"text.secondary","&:hover":{bgcolor:"action.hover"},"&.Mui-disabled":{color:"action.disabled"}},children:t.jsx(w.ChevronRight,{sx:{fontSize:20}})})]})]})}function mc(){return t.jsx(o.Chip,{icon:t.jsx(w.Visibility,{sx:{fontSize:14}}),label:"View Only",size:"small",variant:"outlined",sx:{bgcolor:"action.hover",borderColor:"divider",fontSize:"caption.fontSize",fontWeight:500}})}function gc(e,r){if(e==null||e==="")return"—";if(r==="boolean")return e?"True":"False";if(r==="object"||r==="array")try{return JSON.stringify(e,null,2)}catch{return String(e)}return String(e)}function bc({open:e,onClose:r,row:n,schema:i,reportName:a}){if(!n)return null;const l=i.filter(c=>c.name in n);return t.jsxs(o.Dialog,{open:e,onClose:r,maxWidth:"md",fullWidth:!0,PaperProps:{sx:{borderRadius:"12px",overflow:"hidden",boxShadow:"0 8px 16px 4px rgba(60, 64, 67, 0.12), 0 4px 16px 0px rgba(60, 64, 67, 0.08), 0 0 0 1px rgba(60, 64, 67, 0.05)"}},children:[t.jsxs(o.Box,{sx:{px:3,py:2,bgcolor:"#f8f9fa",borderBottom:"1px solid #e8eaed",display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0},children:[t.jsxs(o.Stack,{direction:"row",spacing:1.5,alignItems:"center",children:[t.jsx(o.Box,{sx:{width:36,height:36,borderRadius:"8px",bgcolor:"#e8f0fe",display:"flex",alignItems:"center",justifyContent:"center"},children:t.jsx(w.Visibility,{sx:{fontSize:18,color:"#1967d2"}})}),t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"h6",sx:{fontSize:"1.125rem",fontWeight:500,color:"#202124",letterSpacing:"0",lineHeight:1.5},children:"Record Detail"}),a&&t.jsx(o.Typography,{variant:"caption",sx:{fontSize:"0.8125rem",color:"#5f6368"},children:a})]})]}),t.jsx(o.IconButton,{size:"small",onClick:r,sx:{p:.75,color:"#5f6368",transition:"all 0.2s ease","&:hover":{bgcolor:"#f1f3f4",color:"#202124"}},children:t.jsx(w.Close,{sx:{fontSize:20}})})]}),t.jsx(o.DialogContent,{sx:{p:3,bgcolor:"#ffffff"},children:t.jsx(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:2},children:l.map(c=>{const d=n[c.name],f=gc(d,c.type),x=f==="—";return t.jsxs(o.Box,{sx:{p:2,borderRadius:"8px",border:"1px solid #e8eaed",bgcolor:"#ffffff",transition:"all 0.2s ease","&:hover":{bgcolor:"#f8f9fa",borderColor:"#dadce0"}},children:[t.jsxs(o.Stack,{direction:"row",alignItems:"center",spacing:.75,mb:1,children:[t.jsx(o.Typography,{variant:"caption",sx:{color:"#5f6368",fontSize:"0.6875rem",fontWeight:600,letterSpacing:"0.1em",textTransform:"uppercase",flex:1},children:Ct(c.name)}),t.jsx(o.Chip,{label:c.type.toUpperCase(),size:"small",sx:{height:18,fontSize:"0.625rem",fontWeight:600,fontFamily:"monospace",bgcolor:"#f1f3f4",color:"#5f6368","& .MuiChip-label":{px:.75}}})]}),t.jsx(o.Typography,{variant:"body2",sx:{color:x?"#bdc1c6":"#3c4043",fontStyle:x?"italic":"normal",fontSize:"0.875rem",wordBreak:"break-word",whiteSpace:c.type==="object"||c.type==="array"?"pre-wrap":"normal",fontFamily:c.type==="number"?"monospace":"inherit",fontWeight:c.type==="number"?500:400},children:f})]},c.name)})})}),t.jsx(o.DialogActions,{sx:{px:3,py:1.75,borderTop:"1px solid #e8eaed",bgcolor:"#f8f9fa",gap:1.25,justifyContent:"flex-end"},children:t.jsx(o.Button,{onClick:r,variant:"contained",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,bgcolor:"#1967d2",color:"#ffffff",px:3,py:.875,minHeight:36,borderRadius:"4px",boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15)",transition:"all 0.2s ease","&:hover":{bgcolor:"#1557b0",boxShadow:"0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15)"},"&:active":{boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3)",transform:"translateY(1px)"}},children:"Close"})})]})}function yc({open:e,onClose:r,onConfirm:n,rowPreview:i}){return t.jsxs(o.Dialog,{open:e,onClose:r,maxWidth:"xs",fullWidth:!0,PaperProps:{sx:{borderRadius:"12px",boxShadow:"0 8px 16px 4px rgba(60, 64, 67, 0.12), 0 4px 16px 0px rgba(60, 64, 67, 0.08), 0 0 0 1px rgba(60, 64, 67, 0.05)"}},children:[t.jsxs(o.Box,{sx:{px:3,pt:2.5,pb:1.5,display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[t.jsxs(o.Stack,{direction:"row",spacing:1.5,alignItems:"flex-start",children:[t.jsx(o.Box,{sx:{width:40,height:40,borderRadius:"50%",bgcolor:"#fce8e6",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t.jsx(w.WarningAmberRounded,{sx:{fontSize:22,color:"#d93025"}})}),t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"h6",sx:{fontSize:"1.125rem",fontWeight:500,color:"#202124",letterSpacing:"0",lineHeight:1.5,mb:.5},children:"Delete record?"}),t.jsxs(o.Typography,{variant:"body2",sx:{fontSize:"0.875rem",color:"#5f6368"},children:[i?`"${i}"`:"This record"," will be permanently removed."]})]})]}),t.jsx(o.IconButton,{size:"small",onClick:r,sx:{p:.75,color:"#5f6368",transition:"all 0.2s ease","&:hover":{bgcolor:"#f1f3f4",color:"#202124"}},children:t.jsx(w.Close,{sx:{fontSize:20}})})]}),t.jsx(o.DialogContent,{sx:{px:3,pb:2},children:t.jsx(o.Box,{sx:{p:2,borderRadius:"8px",bgcolor:"#fce8e6",border:"1px solid #f28b82"},children:t.jsx(o.Typography,{variant:"body2",sx:{fontSize:"0.8125rem",color:"#d93025",fontWeight:500},children:"This action cannot be undone. The record will be deleted from this report immediately."})})}),t.jsxs(o.DialogActions,{sx:{px:3,py:1.75,borderTop:"1px solid #e8eaed",bgcolor:"#f8f9fa",gap:1.25,justifyContent:"flex-end"},children:[t.jsx(o.Button,{onClick:r,variant:"text",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,color:"#5f6368",px:3,py:.875,minHeight:36,borderRadius:"4px",transition:"all 0.2s ease","&:hover":{bgcolor:"#e8eaed",color:"#202124"}},children:"Cancel"}),t.jsx(o.Button,{onClick:()=>{n(),r()},variant:"contained",startIcon:t.jsx(w.DeleteForever,{sx:{fontSize:18}}),sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,bgcolor:"#d93025",color:"#ffffff",px:3,py:.875,minHeight:36,borderRadius:"4px",boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15)",transition:"all 0.2s ease","&:hover":{bgcolor:"#b3190e",boxShadow:"0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15)"},"&:active":{boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3)",transform:"translateY(1px)"}},children:"Delete record"})]})]})}function Sc({open:e,onClose:r,onSave:n,row:i,schema:a,reportName:l}){const[c,d]=u.useState({});if(u.useEffect(()=>{e&&i&&d({...i})},[e,i]),!i)return null;const f=a.filter(g=>g.name in i),x=(g,v)=>{d(C=>({...C,[g]:v}))},m=()=>{const g={...c};f.forEach(v=>{const C=c[v.name];if(v.type==="number"){const p=Number(C);g[v.name]=isNaN(p)?i[v.name]:p}else v.type==="boolean"&&(g[v.name]=!!C)}),n(g),r()},b=g=>{const v=c[g.name],C=Ct(g.name);return g.type==="boolean"?t.jsx(o.FormControlLabel,{control:t.jsx(o.Switch,{checked:!!v,onChange:p=>x(g.name,p.target.checked),size:"small",sx:{"& .MuiSwitch-switchBase.Mui-checked":{color:"#1967d2"},"& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track":{bgcolor:"#1967d2"}}}),label:t.jsx(o.Typography,{variant:"body2",sx:{fontSize:"0.875rem",color:"#3c4043",fontWeight:500},children:C}),sx:{m:0}},g.name):t.jsx(o.TextField,{label:C,value:v??"",onChange:p=>x(g.name,p.target.value),type:g.type==="number"?"number":"text",size:"small",fullWidth:!0,variant:"outlined",InputLabelProps:g.type==="string"&&String(v).match(/^\d{4}-\d{2}-\d{2}/)?{shrink:!0}:void 0,sx:{"& .MuiOutlinedInput-root":{fontSize:"0.875rem",borderRadius:"4px",bgcolor:"#ffffff","& fieldset":{borderColor:"#dadce0"},"&:hover fieldset":{borderColor:"#1967d2"},"&.Mui-focused fieldset":{borderColor:"#1967d2",borderWidth:"2px"}},"& .MuiInputLabel-root":{fontSize:"0.875rem",color:"#5f6368","&.Mui-focused":{color:"#1967d2"}},"& .MuiInputBase-input":{color:"#3c4043"}}},g.name)};return t.jsxs(o.Dialog,{open:e,onClose:r,maxWidth:"md",fullWidth:!0,PaperProps:{sx:{borderRadius:"12px",overflow:"hidden",boxShadow:"0 8px 16px 4px rgba(60, 64, 67, 0.12), 0 4px 16px 0px rgba(60, 64, 67, 0.08), 0 0 0 1px rgba(60, 64, 67, 0.05)"}},children:[t.jsxs(o.Box,{sx:{px:3,py:2,bgcolor:"#f8f9fa",borderBottom:"1px solid #e8eaed",display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0},children:[t.jsxs(o.Stack,{direction:"row",spacing:1.5,alignItems:"center",children:[t.jsx(o.Box,{sx:{width:36,height:36,borderRadius:"8px",bgcolor:"#fef7e0",display:"flex",alignItems:"center",justifyContent:"center"},children:t.jsx(w.Edit,{sx:{fontSize:18,color:"#ea8600"}})}),t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"h6",sx:{fontSize:"1.125rem",fontWeight:500,color:"#202124",letterSpacing:"0",lineHeight:1.5},children:"Edit Record"}),l&&t.jsx(o.Typography,{variant:"caption",sx:{fontSize:"0.8125rem",color:"#5f6368"},children:l})]})]}),t.jsx(o.IconButton,{size:"small",onClick:r,sx:{p:.75,color:"#5f6368",transition:"all 0.2s ease","&:hover":{bgcolor:"#f1f3f4",color:"#202124"}},children:t.jsx(w.Close,{sx:{fontSize:20}})})]}),t.jsx(o.DialogContent,{sx:{p:3,bgcolor:"#ffffff"},children:t.jsx(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:2.5},children:f.map(g=>t.jsx(o.Box,{sx:g.type==="boolean"?{gridColumn:"1 / -1"}:{},children:b(g)},g.name))})}),t.jsxs(o.DialogActions,{sx:{px:3,py:1.75,borderTop:"1px solid #e8eaed",bgcolor:"#f8f9fa",gap:1.25,justifyContent:"flex-end"},children:[t.jsx(o.Button,{onClick:r,variant:"text",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,color:"#5f6368",px:3,py:.875,minHeight:36,borderRadius:"4px",transition:"all 0.2s ease","&:hover":{bgcolor:"#e8eaed",color:"#202124"}},children:"Cancel"}),t.jsx(o.Button,{onClick:m,variant:"contained",startIcon:t.jsx(w.Save,{sx:{fontSize:18}}),sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,bgcolor:"#1967d2",color:"#ffffff",px:3,py:.875,minHeight:36,borderRadius:"4px",boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15)",transition:"all 0.2s ease","&:hover":{bgcolor:"#1557b0",boxShadow:"0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15)"},"&:active":{boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3)",transform:"translateY(1px)"}},children:"Save Changes"})]})]})}const vc=160,Cc={active:{bg:"#e6f4ea",color:"#137333"},completed:{bg:"#e6f4ea",color:"#137333"},approved:{bg:"#e6f4ea",color:"#137333"},success:{bg:"#e6f4ea",color:"#137333"},done:{bg:"#e6f4ea",color:"#137333"},contract:{bg:"#e8f0fe",color:"#0b57d0"},"in progress":{bg:"#e8f0fe",color:"#0b57d0"},"in review":{bg:"#e8f0fe",color:"#0b57d0"},review:{bg:"#e8f0fe",color:"#0b57d0"},pending:{bg:"#e8f0fe",color:"#0b57d0"},"on leave":{bg:"#fce8e6",color:"#c5221f"},"on hold":{bg:"#fef7e0",color:"#b06000"},probation:{bg:"#fef7e0",color:"#b06000"},cancelled:{bg:"#fce8e6",color:"#c5221f"},rejected:{bg:"#fce8e6",color:"#c5221f"},blocked:{bg:"#fce8e6",color:"#c5221f"},inactive:{bg:"#f1f3f4",color:"#5f6368"},"not started":{bg:"#f1f3f4",color:"#5f6368"},paused:{bg:"#f1f3f4",color:"#5f6368"}},jc={low:"#5f6368",medium:"#b06000",high:"#e8710a",critical:"#c5221f",urgent:"#c5221f"};function wc(e){const r=e.toLowerCase().trim(),n=Cc[r]||{bg:"#f1f3f4",color:"#5f6368"};return t.jsx(o.Box,{component:"span",sx:{display:"inline-flex",alignItems:"center",px:1.25,py:.375,borderRadius:"12px",fontSize:"0.75rem",fontWeight:500,bgcolor:n.bg,color:n.color,whiteSpace:"nowrap",lineHeight:1.6,letterSpacing:"0.01em"},children:e})}function kc(e){const r=e.toLowerCase().trim(),n=jc[r];return n?t.jsx(o.Box,{component:"span",sx:{color:n,fontWeight:500,fontSize:"inherit"},children:e}):e}function Tc(e){return t.jsx(o.Box,{component:"span",sx:{color:"#0b57d0",fontFamily:'"Roboto Mono", "Courier New", monospace',fontSize:"0.8125rem",fontWeight:400,letterSpacing:"0.04em"},children:e})}function zc(e,r){if(r==null||r==="")return t.jsx(o.Box,{component:"span",sx:{color:"#bdc1c6"},children:"—"});const n=String(r),i=e.name.toLowerCase().replace(/[_\s-]/g,"");return/\b(status|state|stage|employmenttype|contracttype|availability)\b/.test(e.name.toLowerCase())?wc(n):/\b(priority|severity|urgency|importance|criticality)\b/.test(e.name.toLowerCase())?kc(n):/(\bid\b|id$|_id$|code$|ref$|no$|num$)/.test(i)||/^[A-Z]{2,8}-\d{2,}$/.test(n)?Tc(n):e.type==="number"&&typeof r=="number"?r.toLocaleString():typeof r=="boolean"?r?"Yes":"No":typeof r=="object"?JSON.stringify(r):n}function Ec({schema:e,data:r,sortStack:n=[],filters:i=[],views:a=[],activeViewId:l="",isDirty:c=!1,isExporting:d=!1,columnVisibility:f={},columnOrder:x=[],columnWidths:m={},grouping:b=null,onSort:g,onSortAscending:v,onSortDescending:C,onOpenFilters:p,onOpenSort:T,onOpenFilterForColumn:s,onSelectView:k,onCreateView:D,onManageViews:A,onUpdateCurrentView:S,onSaveAsNewView:R,onToggleDefault:Y,onToggleFavorite:_,onRestoreView:K,onPermanentDelete:V,onExport:te,onOpenColumns:h,onUpdateColumnWidth:F,onUpdateColumnOrder:W,onUpdateColumnVisibility:E,onClearFiltersForColumn:H,onResetLayout:de,onOpenGroup:ue,onToggleGroupCollapse:Be,onOpenAuditHistory:O,onOpenSharePreset:N,searchQuery:Q,searchHistory:X=[],onAddToSearchHistory:Z,onToggleSearchFavourite:re,onDeleteSearchHistory:J,selectedRowIds:q=new Set,onSearchChange:oe,onToggleRowSelection:ie,onToggleAllRows:se,onRangeSelection:ve,onClearSelection:$,onExportSelected:De,currentPage:Ae=1,pageSize:et=10,totalRowsBeforePagination:tt=r.length,onPageChange:Fe,onPageSizeChange:Le,isReadOnly:Me=!1,userRole:ft,reportName:At,onEditRow:pt,onDuplicateRow:xt,onDeleteRow:ht}){const[rt,Rt]=u.useState(null),[ot,Gt]=u.useState(0),[kt,Te]=u.useState(0),[nt,qe]=u.useState(null),[it,Mt]=u.useState(null),[mt,Je]=u.useState(null),[hr,Tt]=u.useState(!1),[Yt,Pt]=u.useState(!1),[zt,gt]=u.useState(null),[ye,qt]=u.useState(""),[Jt,Ke]=u.useState(!1),[P,He]=u.useState(null),[le,Oe]=u.useState(null),[fe,Ue]=u.useState(null);u.useRef(null);const bt=u.useMemo(()=>x.length>0?x.map(M=>e.find(L=>L.name===M)).filter(M=>M!==void 0):e,[x,e]),Pe=u.useMemo(()=>bt.filter(M=>f[M.name]!==!1),[bt,f]),Kt=u.useMemo(()=>e.filter(M=>f[M.name]===!1).length,[e,f]),Wt=u.useMemo(()=>e.map(M=>M.name),[e]),je=u.useMemo(()=>JSON.stringify(x)!==JSON.stringify(Wt),[x,Wt]),U=u.useCallback((M,L)=>{M.preventDefault(),M.stopPropagation(),Rt(L),Gt(M.clientX),Te(m[L]||150)},[m]);u.useEffect(()=>{if(!rt)return;const M=ae=>{const $e=ae.clientX-ot,ce=Math.max(100,kt+$e);F==null||F(rt,ce)},L=()=>{Rt(null)};return document.addEventListener("mousemove",M),document.addEventListener("mouseup",L),()=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",L)}},[rt,ot,kt,F]);const st=u.useCallback(M=>M==null?"-":typeof M=="object"?JSON.stringify(M):typeof M=="boolean"?M?"true":"false":String(M),[]);u.useCallback(M=>{const L=n.find(ae=>ae.column===M);return L?t.jsxs(o.Box,{sx:{display:"inline-flex",alignItems:"center",ml:.5,gap:.25},children:[L.direction==="asc"?t.jsx(w.ArrowUpward,{sx:{fontSize:14}}):t.jsx(w.ArrowDownward,{sx:{fontSize:14}}),t.jsx(o.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:16,height:16,bgcolor:"primary.main",color:"primary.contrastText",fontSize:"caption.fontSize",fontWeight:"bold",borderRadius:"50%"},children:L.priority})]}):null},[n]),u.useCallback(M=>i.some(ae=>ae.column===M)?t.jsx(o.IconButton,{size:"small",onClick:ae=>{ae.stopPropagation(),s==null||s(M)},sx:{ml:.5,p:.25,color:"primary.main","&:hover":{color:"primary.main"}},title:"Active filters on this column",children:t.jsx(w.FilterList,{sx:{fontSize:14}})}):null,[i,s]);const We=u.useCallback(M=>{g&&g(M)},[g]),Xt=u.useCallback((M,L)=>{if(!W)return;const ae=[...x.length>0?x:e.map(ce=>ce.name)],[$e]=ae.splice(M,1);ae.splice(L,0,$e),W(ae)},[W,x,e]),Qt=u.useCallback(M=>{if(!g)return;const L=n.find(ae=>ae.column===M);(!L||L.direction!=="asc")&&g(M)},[g,n]),Zt=u.useCallback(M=>{if(!g)return;const L=n.find(ae=>ae.column===M);L?L.direction==="asc"&&g(M):(g(M),setTimeout(()=>g(M),0))},[g,n]),er=u.useCallback(M=>{if(!g)return;const L=n.find(ae=>ae.column===M);L&&(L.direction==="asc"?(g(M),setTimeout(()=>g(M),0)):L.direction==="desc"&&g(M))},[g,n]),tr=u.useCallback(M=>{E&&E(M,!1)},[E]),rr=(b==null?void 0:b.enabled)&&r.length>0&&r[0]&&"isGroupHeader"in r[0],_t=u.useMemo(()=>Pe.map(M=>M.name),[Pe]),_e=u.useMemo(()=>Q&&Q.trim()?En(r,e,Q,_t):r,[r,e,Q,_t]);u.useEffect(()=>{const M=L=>{!se||!$||L.target instanceof HTMLInputElement||L.target instanceof HTMLTextAreaElement||((L.ctrlKey||L.metaKey)&&L.key==="a"&&(L.preventDefault(),se(!0,_e.length)),L.key==="Escape"&&(L.preventDefault(),$()))};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[se,$,_e.length]);const Et=u.useCallback((M,L)=>{ie&&(L.shiftKey&&nt!==null?(L.preventDefault(),ve&&ve(nt,M)):(ie(M),qe(M)))},[ie,nt,ve]),or=u.useMemo(()=>_e.length>0&&q.size>0&&_e.every((M,L)=>q.has(L)),[_e,q]);q.size>0;const at=ie&&se,nr=u.useCallback(M=>{var $e;const L=M.groupLevel,ae=L*24;return t.jsx(o.TableRow,{onClick:()=>Be==null?void 0:Be(M.groupKey),sx:{bgcolor:"action.hover","&:hover":{bgcolor:"action.selected"},cursor:"pointer",borderTop:2,borderColor:"divider"},children:t.jsx(o.TableCell,{colSpan:Pe.length+(at?1:0),sx:{pl:`${ae+24}px`},children:t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[M.isCollapsed?t.jsx(w.ChevronRight,{sx:{fontSize:16}}):t.jsx(w.KeyboardArrowDown,{sx:{fontSize:16}}),t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:600},children:Xi(L,(($e=b==null?void 0:b.levels[L])==null?void 0:$e.column)||"",M.groupValue)}),t.jsxs(o.Box,{sx:{px:1,py:.25,fontSize:"caption.fontSize",fontWeight:500,bgcolor:ce=>ne(ce.palette.primary.main,.12),color:"primary.main",borderRadius:2},children:[M.rowCount," ",M.rowCount===1?"row":"rows"]}),Object.keys(M.aggregates).length>0&&t.jsx(o.Typography,{variant:"caption",sx:{ml:1,color:"text.secondary"},children:Object.entries(M.aggregates).map(([ce,Bt])=>Ki(Bt)).filter(Boolean).join(" • ")})]})})},M.groupKey)},[Pe,at,b,Be]),It=u.useCallback((M,L)=>{const ae=q.has(L),$e=it===L;return t.jsxs(o.TableRow,{"data-row-index":L,onMouseEnter:()=>Mt(L),onMouseLeave:()=>Mt(null),onClick:ce=>{!ie||ce.target.closest("[data-row-action]")||Et(L,ce)},onContextMenu:ce=>{ce.preventDefault(),ce.stopPropagation(),Ue({mouseX:ce.clientX,mouseY:ce.clientY,row:M,rowIndex:L})},sx:{height:52,cursor:"pointer",bgcolor:ae?ce=>ne(ce.palette.warning.main,.12):"background.paper",transition:"background-color 0.12s ease","&:hover":{bgcolor:ae?ce=>ne(ce.palette.warning.main,.2):"#f8f9fa"},borderBottom:"1px solid",borderColor:"divider"},children:[Pe.map((ce,Bt)=>t.jsx(o.TableCell,{sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",py:0,px:2,fontSize:"0.875rem",fontWeight:400,color:"#202124",borderBottom:"none",minWidth:m[ce.name]?`${m[ce.name]}px`:`${vc}px`},children:zc(ce,M[ce.name])},ce.name)),t.jsx(o.TableCell,{"data-row-action":"true",onClick:ce=>ce.stopPropagation(),sx:{position:"sticky",right:0,width:40,minWidth:40,maxWidth:40,p:0,border:"none",bgcolor:"transparent",opacity:$e?1:0,transition:"opacity 0.12s ease",zIndex:2,verticalAlign:"middle"},children:t.jsx(o.IconButton,{size:"small",onClick:ce=>{ce.stopPropagation(),ce.preventDefault(),Ue({anchorEl:ce.currentTarget,row:M,rowIndex:L})},sx:{color:"text.secondary","&:hover":{bgcolor:ce=>ne(ce.palette.text.primary,.08),color:"text.primary"}},children:t.jsx(w.MoreVert,{sx:{fontSize:18}})})})]},L)},[q,it,Et,Pe,m,st,pt,xt,ht,ie,Je,Tt,Ue]);return t.jsxs(dt.DndProvider,{backend:io.HTML5Backend,children:[t.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[at&&De&&$&&t.jsx(xc,{selectedCount:q.size,onExportSelected:De,onClearSelection:$}),t.jsxs(o.Box,{sx:{position:"sticky",top:0,zIndex:10,bgcolor:"background.paper",borderBottom:"1px solid",borderColor:"divider",px:2,py:0,height:56,display:"flex",alignItems:"center",gap:.5},children:[Me&&t.jsx(mc,{}),oe&&Z&&re&&J&&t.jsx(o.Box,{sx:{flexGrow:1,maxWidth:480,minWidth:240},children:t.jsx(lc,{value:Q||"",onChange:oe,searchHistory:X,onAddToHistory:Z,onToggleFavourite:re,onDeleteHistory:J,disabled:Me})}),t.jsx(o.Box,{sx:{flexGrow:1}}),k&&D&&A&&S&&a.length>0&&t.jsx(cc,{views:a||[],activeViewId:l||"",isDirty:c,onSelectView:k,onCreateView:D,onManageViews:A,onToggleDefault:Y,onToggleFavorite:_,onRestoreView:K,onPermanentDelete:V,isReadOnly:Me}),t.jsx(o.Divider,{orientation:"vertical",flexItem:!0,sx:{mx:.5,my:1}}),!Me&&T&&t.jsxs(o.Button,{onClick:T,variant:"text",size:"small",startIcon:t.jsx(w.SwapVert,{sx:{fontSize:18}}),sx:{color:n.length>0?"#0b57d0":"text.secondary",textTransform:"none",fontWeight:n.length>0?500:400,fontSize:"0.875rem",px:1.5,py:0,height:36,minWidth:"auto",borderRadius:"18px",border:n.length>0?"1px solid #d3e3fd":"1px solid transparent",bgcolor:n.length>0?"#e8f0fe":"transparent",transition:"all 0.15s ease","&:hover":{bgcolor:n.length>0?"#d3e3fd":M=>ne(M.palette.text.primary,.06),color:n.length>0?"#0b57d0":"text.primary"}},children:["Sort",n.length>0&&t.jsx(o.Box,{component:"span",sx:{ml:.5,width:18,height:18,display:"inline-flex",alignItems:"center",justifyContent:"center",bgcolor:"#0b57d0",color:"#fff",borderRadius:"50%",fontSize:"0.65rem",fontWeight:700,lineHeight:1},children:n.length})]}),!Me&&p&&t.jsxs(o.Button,{onClick:p,variant:"text",size:"small",startIcon:t.jsx(w.FilterList,{sx:{fontSize:18}}),sx:{color:i.length>0?"#0b57d0":"text.secondary",textTransform:"none",fontWeight:i.length>0?500:400,fontSize:"0.875rem",px:1.5,py:0,height:36,minWidth:"auto",borderRadius:"18px",border:i.length>0?"1px solid #d3e3fd":"1px solid transparent",bgcolor:i.length>0?"#e8f0fe":"transparent",transition:"all 0.15s ease","&:hover":{bgcolor:i.length>0?"#d3e3fd":M=>ne(M.palette.text.primary,.06),color:i.length>0?"#0b57d0":"text.primary"}},children:["Filter",i.length>0&&t.jsx(o.Box,{component:"span",sx:{ml:.5,width:18,height:18,display:"inline-flex",alignItems:"center",justifyContent:"center",bgcolor:"#0b57d0",color:"#fff",borderRadius:"50%",fontSize:"0.65rem",fontWeight:700,lineHeight:1},children:i.length})]}),!Me&&h&&t.jsx(dc,{onClick:h,hiddenCount:Kt,hasCustomOrder:je}),t.jsx(o.Divider,{orientation:"vertical",flexItem:!0,sx:{mx:.5,my:1}}),te&&t.jsx(o.Tooltip,{title:"Export",children:t.jsx(o.IconButton,{onClick:te,disabled:d,size:"small",sx:{color:"text.secondary",borderRadius:1,transition:"color 0.15s ease, background-color 0.15s ease","&:hover":{bgcolor:M=>ne(M.palette.text.primary,.06),color:"text.primary"}},children:t.jsx(w.Download,{sx:{fontSize:18}})})}),t.jsx(o.Divider,{orientation:"vertical",flexItem:!0,sx:{mx:.5,my:1}}),!Me&&ue&&t.jsx(o.Tooltip,{title:"Group",children:t.jsx(o.IconButton,{onClick:ue,size:"small",sx:{color:"text.secondary",borderRadius:1,transition:"color 0.15s ease, background-color 0.15s ease","&:hover":{bgcolor:M=>ne(M.palette.text.primary,.06),color:"text.primary"}},children:t.jsx(w.Layers,{sx:{fontSize:18}})})}),O&&t.jsx(o.Tooltip,{title:"Audit History",children:t.jsx(o.IconButton,{onClick:O,size:"small",sx:{color:"text.secondary",borderRadius:1,transition:"color 0.15s ease, background-color 0.15s ease","&:hover":{bgcolor:M=>ne(M.palette.text.primary,.06),color:"text.primary"}},children:t.jsx(w.History,{sx:{fontSize:18}})})}),N&&t.jsx(o.Tooltip,{title:"Share Report State",children:t.jsx(o.IconButton,{onClick:N,size:"small",sx:{color:"text.secondary",borderRadius:1,transition:"color 0.15s ease, background-color 0.15s ease","&:hover":{bgcolor:M=>ne(M.palette.text.primary,.06),color:"text.primary"}},children:t.jsx(w.Share,{sx:{fontSize:18}})})})]}),t.jsxs(o.Box,{sx:{position:"relative",overflow:"hidden",flex:1,display:"flex",flexDirection:"column"},children:[t.jsx(o.Box,{sx:{flex:1,overflowY:"auto",overflowX:"auto",position:"relative",bgcolor:"background.paper","&::-webkit-scrollbar":{width:8,height:8},"&::-webkit-scrollbar-track":{bgcolor:"transparent"},"&::-webkit-scrollbar-thumb":{bgcolor:M=>M.palette.mode==="dark"?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",borderRadius:4,"&:hover":{bgcolor:M=>M.palette.mode==="dark"?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"}}},children:t.jsxs(o.Table,{sx:{tableLayout:"fixed",borderCollapse:"collapse",width:"100%",minWidth:"100%"},stickyHeader:!0,children:[t.jsx(o.TableHead,{children:t.jsxs(o.TableRow,{sx:{height:44,bgcolor:"transparent",borderBottom:"1px solid",borderColor:"divider"},children:[Pe.map((M,L)=>t.jsx(pc,{column:M,index:L,sortRule:n.find(ae=>ae.column===M.name),hasFilters:i.some(ae=>ae.column===M.name),isInSortStack:n.some(ae=>ae.column===M.name),width:m[M.name],onColumnClick:We,onMoveColumn:Xt,onResizeStart:U,onSort:We,onRemoveSort:er,onSortAscending:Qt,onSortDescending:Zt,onOpenFilterForColumn:s||(()=>{}),onClearFiltersForColumn:H||(()=>{}),onHideColumn:tr,onManageColumns:h||(()=>{}),onManageViews:A||(()=>{}),onResetLayout:de||(()=>{})},M.name)),t.jsx(o.TableCell,{sx:{position:"sticky",top:0,right:0,width:40,minWidth:40,p:0,border:"none",bgcolor:"#f8f9fa",zIndex:6}})]})}),t.jsx(o.TableBody,{children:_e.length===0?t.jsx(o.TableRow,{children:t.jsx(o.TableCell,{colSpan:Pe.length+(at?1:0),align:"center",sx:{py:4},children:t.jsx(o.Typography,{variant:"body2",color:"text.secondary",children:"No data matches the current filters"})})}):rr?_e.map((M,L)=>M.isGroupHeader?nr(M):It(M,L)):_e.map((M,L)=>It(M,L))})]})}),Fe&&Le&&t.jsx(hc,{currentPage:Ae,pageSize:et,totalRows:tt,onPageChange:Fe,onPageSizeChange:Le}),!(Fe&&Le)&&t.jsx(o.Box,{sx:{px:3,py:1.5,bgcolor:"action.hover",borderTop:1,borderColor:"divider"},children:t.jsxs(o.Typography,{variant:"body2",color:"text.secondary",children:["Showing ",_e.length," ",_e.length===1?"row":"rows"]})})]})]}),t.jsxs(o.Popover,{open:!!fe,onClose:()=>Ue(null),anchorEl:(fe==null?void 0:fe.anchorEl)||null,anchorReference:fe!=null&&fe.anchorEl?"anchorEl":"anchorPosition",anchorPosition:fe&&!fe.anchorEl?{top:fe.mouseY,left:fe.mouseX}:void 0,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:fe!=null&&fe.anchorEl?{vertical:"top",horizontal:"right"}:{vertical:"top",horizontal:"left"},PaperProps:{sx:{minWidth:176,py:.5,borderRadius:1.5,boxShadow:3}},children:[t.jsxs(o.MenuItem,{dense:!0,onClick:()=>{fe&&(Je(fe.row),Tt(!0)),Ue(null)},sx:{py:1,px:2,gap:1.5},children:[t.jsx(w.Visibility,{sx:{fontSize:18,color:"text.secondary"}}),t.jsx(o.Typography,{variant:"body2",children:"View"})]}),t.jsxs(o.MenuItem,{dense:!0,onClick:()=>{fe&&(He(fe.row),Oe(fe.rowIndex),Ke(!0)),Ue(null)},sx:{py:1,px:2,gap:1.5},children:[t.jsx(w.Edit,{sx:{fontSize:18,color:"text.secondary"}}),t.jsx(o.Typography,{variant:"body2",children:"Edit"})]}),t.jsxs(o.MenuItem,{dense:!0,onClick:()=>{fe&&(xt==null||xt(fe.rowIndex,fe.row)),Ue(null)},sx:{py:1,px:2,gap:1.5},children:[t.jsx(w.ContentCopy,{sx:{fontSize:18,color:"text.secondary"}}),t.jsx(o.Typography,{variant:"body2",children:"Duplicate"})]}),t.jsx(o.Divider,{sx:{my:.5}}),t.jsxs(o.MenuItem,{dense:!0,onClick:()=>{if(fe){gt(fe.rowIndex);const M=Object.values(fe.row).find(L=>L!=null&&L!=="");qt(M?String(M):""),Pt(!0)}Ue(null)},sx:{py:1,px:2,gap:1.5,color:"error.main"},children:[t.jsx(w.Delete,{sx:{fontSize:18,color:"error.main"}}),t.jsx(o.Typography,{variant:"body2",color:"error.main",children:"Delete"})]})]}),t.jsx(bc,{open:hr,onClose:()=>{Tt(!1),Je(null)},row:mt,schema:e,reportName:At}),t.jsx(Sc,{open:Jt,onClose:()=>{Ke(!1),He(null),Oe(null)},onSave:M=>{le!==null&&(pt==null||pt(le,M))},row:P,schema:e,reportName:At}),t.jsx(yc,{open:Yt,onClose:()=>{Pt(!1),gt(null)},onConfirm:()=>{zt!==null&&(ht==null||ht(zt))},rowPreview:ye})]})}function Ic({schema:e,filters:r,onAddFilter:n,onRemoveFilter:i,onUpdateFilter:a,onClearAll:l,onClose:c,focusColumn:d}){const[f,x]=u.useState(""),[m,b]=u.useState(""),[g,v]=u.useState(""),[C,p]=u.useState([]);u.useEffect(()=>{p([...r])},[r]),u.useEffect(()=>{d&&x(d)},[d]);const T=u.useCallback(()=>{x(""),b(""),v("")},[]),s=u.useMemo(()=>e.filter(V=>V.type!=="mixed"&&V.type!=="null"&&V.type!=="array"&&V.type!=="object"),[e]),k=e.find(V=>V.name===f),D=u.useMemo(()=>k?Po(k.type):[],[k]),A=u.useCallback(()=>!(!f||!m||vr(m)&&!g.trim()),[f,m,g]),S=u.useCallback(()=>{if(!A())return;const V={column:f,operator:m};if(vr(m)){const te=k==null?void 0:k.type;V.value=te==="number"?Number(g):g}p([...C,V]),T()},[A,f,m,k,g,C,T]),R=u.useCallback(V=>{p(C.filter((te,h)=>h!==V))},[C]),Y=u.useCallback(()=>{l(),C.forEach(V=>n(V)),c()},[C,n,l,c]),_=u.useCallback(()=>{p([...r]),T(),c()},[r,T,c]),K=u.useCallback(V=>{var W;const te=e.find(E=>E.name===V.column);if(!te)return"";const F=((W=Po(te.type).find(E=>E.value===V.operator))==null?void 0:W.label)||V.operator;return vr(V.operator)?`${V.column} ${F.toLowerCase()} "${V.value}"`:`${V.column} ${F.toLowerCase()}`},[e]);return t.jsx(o.Box,{onClick:_,sx:{position:"fixed",top:0,left:0,right:0,bottom:0,bgcolor:"rgba(0, 0, 0, 0.4)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1300,animation:"fadeIn 0.225s cubic-bezier(0.4, 0, 0.2, 1)","@keyframes fadeIn":{from:{opacity:0},to:{opacity:1}}},children:t.jsxs(o.Paper,{onClick:V=>V.stopPropagation(),elevation:0,sx:{position:"relative",width:520,maxWidth:"calc(100vw - 120px)",maxHeight:"min(520px, calc(100vh - 280px))",display:"flex",flexDirection:"column",borderRadius:"12px",bgcolor:"#ffffff",outline:"none",boxShadow:"0 8px 16px 4px rgba(60, 64, 67, 0.12), 0 4px 16px 0px rgba(60, 64, 67, 0.08), 0 0 0 1px rgba(60, 64, 67, 0.05)",animation:"slideIn 0.225s cubic-bezier(0.4, 0, 0.2, 1)","@keyframes slideIn":{from:{opacity:0,transform:"scale(0.95) translateY(-12px)"},to:{opacity:1,transform:"scale(1) translateY(0)"}}},children:[t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:3,py:2,borderBottom:"1px solid #e8eaed",flexShrink:0},children:[t.jsx(o.Typography,{variant:"h6",sx:{fontSize:"1.125rem",fontWeight:500,color:"#202124",letterSpacing:"0",lineHeight:1.5},children:"Filter columns"}),t.jsx(o.IconButton,{onClick:_,size:"small",sx:{p:.75,color:"#5f6368",transition:"all 0.2s ease","&:hover":{bgcolor:"#f1f3f4",color:"#202124"}},children:t.jsx(w.Close,{sx:{fontSize:20}})})]}),t.jsxs(o.Box,{sx:{flex:1,overflow:"auto",px:3,py:2.5,"&::-webkit-scrollbar":{width:8},"&::-webkit-scrollbar-track":{bgcolor:"transparent"},"&::-webkit-scrollbar-thumb":{bgcolor:"#dadce0",borderRadius:4,"&:hover":{bgcolor:"#bdc1c6"}}},children:[t.jsxs(o.Box,{sx:{mb:2.5},children:[t.jsx(o.Typography,{variant:"overline",sx:{fontSize:"0.6875rem",fontWeight:600,color:"#5f6368",letterSpacing:"0.1em",mb:1.5,display:"block",textTransform:"uppercase"},children:"Add filter"}),t.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1.75},children:[t.jsxs(o.FormControl,{size:"small",fullWidth:!0,children:[t.jsx(o.InputLabel,{sx:{fontSize:"0.875rem",color:"#5f6368","&.Mui-focused":{color:"#1967d2"}},children:"Column"}),t.jsx(o.Select,{value:f,onChange:V=>{x(V.target.value),b(""),v("")},label:"Column",sx:{fontSize:"0.875rem",height:40,borderRadius:"4px",bgcolor:"#ffffff","& .MuiOutlinedInput-notchedOutline":{borderColor:"#dadce0",transition:"border-color 0.2s ease"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#1967d2"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#1967d2",borderWidth:"2px"}},children:s.map(V=>t.jsxs(o.MenuItem,{value:V.name,sx:{fontSize:"0.875rem",color:"#3c4043",py:1,"&:hover":{bgcolor:"#f1f3f4"},"&.Mui-selected":{bgcolor:"#e8f0fe","&:hover":{bgcolor:"#d2e3fc"}}},children:[Ct(V.name)," (",V.type,")"]},V.name))})]}),f&&t.jsxs(o.FormControl,{size:"small",fullWidth:!0,children:[t.jsx(o.InputLabel,{sx:{fontSize:"0.875rem",color:"#5f6368","&.Mui-focused":{color:"#1967d2"}},children:"Operator"}),t.jsx(o.Select,{value:m,onChange:V=>{b(V.target.value),v("")},label:"Operator",sx:{fontSize:"0.875rem",height:40,borderRadius:"4px",bgcolor:"#ffffff","& .MuiOutlinedInput-notchedOutline":{borderColor:"#dadce0",transition:"border-color 0.2s ease"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#1967d2"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#1967d2",borderWidth:"2px"}},children:D.map(V=>t.jsx(o.MenuItem,{value:V.value,sx:{fontSize:"0.875rem",color:"#3c4043",py:1,"&:hover":{bgcolor:"#f1f3f4"},"&.Mui-selected":{bgcolor:"#e8f0fe","&:hover":{bgcolor:"#d2e3fc"}}},children:V.label},V.value))})]}),m&&vr(m)&&t.jsx(o.TextField,{size:"small",fullWidth:!0,type:(k==null?void 0:k.type)==="number"?"number":"text",value:g,onChange:V=>v(V.target.value),label:"Value",placeholder:"Enter value...",sx:{"& .MuiInputLabel-root":{fontSize:"0.875rem",color:"#5f6368","&.Mui-focused":{color:"#1967d2"}},"& .MuiOutlinedInput-root":{fontSize:"0.875rem",height:40,borderRadius:"4px",bgcolor:"#ffffff","& fieldset":{borderColor:"#dadce0",transition:"border-color 0.2s ease"},"&:hover fieldset":{borderColor:"#1967d2"},"&.Mui-focused fieldset":{borderColor:"#1967d2",borderWidth:"2px"}},"& .MuiInputBase-input":{py:1,color:"#3c4043"}}})]}),t.jsx(o.Button,{onClick:S,disabled:!A(),sx:{mt:1.5,textTransform:"none",fontSize:"0.875rem",fontWeight:500,color:"#1967d2",p:0,justifyContent:"flex-start",transition:"color 0.2s ease","&:hover":{bgcolor:"transparent",color:"#1557b0",textDecoration:"underline"},"&.Mui-disabled":{color:"#bdc1c6"}},children:"+ Add another filter"})]}),C.length>0&&t.jsxs(o.Box,{children:[t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1.5},children:[t.jsxs(o.Typography,{variant:"overline",sx:{fontSize:"0.6875rem",fontWeight:600,color:"#5f6368",letterSpacing:"0.1em",textTransform:"uppercase"},children:["Active filters (",C.length,")"]}),t.jsx(o.Button,{onClick:()=>p([]),sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,color:"#d93025",p:0,minWidth:"auto",transition:"color 0.2s ease","&:hover":{bgcolor:"transparent",color:"#b3190e",textDecoration:"underline"}},children:"Clear all"})]}),t.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1},children:C.map((V,te)=>t.jsx(o.Chip,{label:K(V),onDelete:()=>R(te),sx:{bgcolor:"#e8f0fe",color:"#1967d2",fontSize:"0.875rem",fontWeight:400,height:32,borderRadius:"16px",border:"1px solid #d2e3fc",transition:"all 0.2s ease","&:hover":{bgcolor:"#d2e3fc",borderColor:"#aecbfa"},"& .MuiChip-label":{px:1.5,color:"#1967d2"},"& .MuiChip-deleteIcon":{color:"#1967d2",fontSize:18,transition:"all 0.2s ease","&:hover":{color:"#1557b0"}}}},te))})]})]}),t.jsxs(o.Box,{sx:{px:3,py:2,borderTop:"1px solid #e8eaed",display:"flex",gap:1.5,justifyContent:"flex-end",flexShrink:0,bgcolor:"#f8f9fa"},children:[t.jsx(o.Button,{onClick:_,variant:"text",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,color:"#5f6368",px:3,py:1,minHeight:36,borderRadius:"4px",transition:"all 0.2s ease","&:hover":{bgcolor:"#e8eaed",color:"#202124"}},children:"Cancel"}),t.jsx(o.Button,{onClick:Y,variant:"contained",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,bgcolor:"#1967d2",color:"#ffffff",px:3,py:1,minHeight:36,borderRadius:"4px",boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15)",transition:"all 0.2s ease","&:hover":{bgcolor:"#1557b0",boxShadow:"0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15)"},"&:active":{boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3)",transform:"translateY(1px)"}},children:"Apply filter"})]})]})})}const xn="SORT_RULE";function Bc({rule:e,index:r,onToggleDirection:n,onRemove:i,onMove:a}){const l=u.useRef(null),[{handlerId:c},d]=dt.useDrop({accept:xn,collect(m){return{handlerId:m.getHandlerId()}},hover(m,b){var k;if(!l.current)return;const g=m.index,v=r;if(g===v)return;const C=(k=l.current)==null?void 0:k.getBoundingClientRect(),p=(C.bottom-C.top)/2,T=b.getClientOffset(),s=((T==null?void 0:T.y)??0)-C.top;g<v&&s<p||g>v&&s>p||(a(g,v),m.index=v)}}),[{isDragging:f},x]=dt.useDrag({type:xn,item:()=>({index:r}),collect:m=>({isDragging:m.isDragging()})});return x(d(l)),t.jsxs(o.Box,{ref:l,"data-handler-id":c,sx:{display:"flex",alignItems:"center",gap:1.25,px:2,py:1.25,borderRadius:"8px",bgcolor:"#ffffff",border:"1px solid #e8eaed",opacity:f?.4:1,cursor:"move",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)","&:hover":{bgcolor:"#f8f9fa",borderColor:"#dadce0",boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.1), 0 1px 3px 1px rgba(60, 64, 67, 0.05)",transform:"translateY(-1px)"}},children:[t.jsx(o.Chip,{label:e.priority,size:"small",sx:{width:26,height:26,fontSize:"0.75rem",fontWeight:600,bgcolor:"#1967d2",color:"#ffffff",boxShadow:"0 1px 2px 0 rgba(25, 103, 210, 0.3)","& .MuiChip-label":{px:0}}}),t.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:"3px",cursor:"grab",px:.5,opacity:.6,transition:"opacity 0.2s ease","&:hover":{opacity:1},"&:active":{cursor:"grabbing"}},children:[t.jsx(o.Box,{sx:{width:"4px",height:"4px",borderRadius:"50%",bgcolor:"#5f6368"}}),t.jsx(o.Box,{sx:{width:"4px",height:"4px",borderRadius:"50%",bgcolor:"#5f6368"}}),t.jsx(o.Box,{sx:{width:"4px",height:"4px",borderRadius:"50%",bgcolor:"#5f6368"}})]}),t.jsx(o.Typography,{variant:"body2",sx:{fontSize:"0.875rem",fontWeight:400,color:"#3c4043",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:"0 0 100px",lineHeight:1.5},children:e.column}),t.jsx(o.FormControl,{size:"small",sx:{flex:1,minWidth:100},children:t.jsxs(o.Select,{value:e.direction,onChange:m=>n(r,m.target.value),sx:{fontSize:"0.875rem",height:36,borderRadius:"4px",bgcolor:"#ffffff","& .MuiOutlinedInput-notchedOutline":{borderColor:"#dadce0",transition:"border-color 0.2s ease"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#1967d2"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#1967d2",borderWidth:"2px"},"& .MuiSelect-select":{py:.875,color:"#3c4043",fontWeight:400}},children:[t.jsx(o.MenuItem,{value:"asc",sx:{fontSize:"0.875rem",color:"#3c4043","&:hover":{bgcolor:"#f1f3f4"},"&.Mui-selected":{bgcolor:"#e8f0fe","&:hover":{bgcolor:"#d2e3fc"}}},children:"Ascending"}),t.jsx(o.MenuItem,{value:"desc",sx:{fontSize:"0.875rem",color:"#3c4043","&:hover":{bgcolor:"#f1f3f4"},"&.Mui-selected":{bgcolor:"#e8f0fe","&:hover":{bgcolor:"#d2e3fc"}}},children:"Descending"})]})}),t.jsx(o.IconButton,{onClick:()=>i(r),size:"small",sx:{p:.5,color:"#5f6368",transition:"all 0.2s ease","&:hover":{color:"#d93025",bgcolor:"rgba(217, 48, 37, 0.08)",transform:"scale(1.1)"}},children:t.jsx(w.Close,{sx:{fontSize:18}})})]})}function Dc({schema:e,sortStack:r,onUpdateSortStack:n,onClose:i}){const[a,l]=u.useState(""),[c,d]=u.useState([]);u.useEffect(()=>{d([...r])},[r]);const f=u.useCallback(()=>!(c.length>=3||!a||c.some(s=>s.column===a)),[c,a]),x=u.useCallback(()=>{if(!f())return;const s=c.length+1,k={column:a,direction:"asc",priority:s};d([...c,k]),l("")},[f,a,c]),m=u.useCallback(s=>{const D=c.filter((A,S)=>S!==s).map((A,S)=>({...A,priority:S+1}));d(D)},[c]),b=u.useCallback((s,k)=>{const D=[...c];D[s]={...D[s],direction:k},d(D)},[c]),g=u.useCallback((s,k)=>{const D=[...c],[A]=D.splice(s,1);D.splice(k,0,A);const S=D.map((R,Y)=>({...R,priority:Y+1}));d(S)},[c]),v=u.useCallback(()=>{d([])},[]),C=u.useCallback(()=>{n(c),i()},[c,n,i]),p=u.useCallback(()=>{d([...r]),l(""),i()},[r,i]),T=e.filter(s=>!c.some(k=>k.column===s.name));return t.jsx(dt.DndProvider,{backend:io.HTML5Backend,children:t.jsx(o.Box,{onClick:p,sx:{position:"fixed",top:0,left:0,right:0,bottom:0,bgcolor:"rgba(0, 0, 0, 0.4)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1300,animation:"fadeIn 0.225s cubic-bezier(0.4, 0, 0.2, 1)","@keyframes fadeIn":{from:{opacity:0},to:{opacity:1}}},children:t.jsxs(o.Paper,{onClick:s=>s.stopPropagation(),elevation:0,sx:{position:"relative",width:480,maxWidth:"calc(100vw - 120px)",maxHeight:"min(440px, calc(100vh - 280px))",display:"flex",flexDirection:"column",borderRadius:"12px",bgcolor:"#ffffff",outline:"none",boxShadow:"0 8px 16px 4px rgba(60, 64, 67, 0.12), 0 4px 16px 0px rgba(60, 64, 67, 0.08), 0 0 0 1px rgba(60, 64, 67, 0.05)",animation:"slideIn 0.225s cubic-bezier(0.4, 0, 0.2, 1)","@keyframes slideIn":{from:{opacity:0,transform:"scale(0.95) translateY(-12px)"},to:{opacity:1,transform:"scale(1) translateY(0)"}}},children:[t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:3,py:2,borderBottom:"1px solid #e8eaed",flexShrink:0},children:[t.jsx(o.Typography,{variant:"h6",sx:{fontSize:"1.125rem",fontWeight:500,color:"#202124",letterSpacing:"0",lineHeight:1.5},children:"Sort columns"}),t.jsx(o.IconButton,{onClick:p,size:"small",sx:{p:.75,color:"#5f6368",transition:"all 0.2s ease","&:hover":{bgcolor:"#f1f3f4",color:"#202124"}},children:t.jsx(w.Close,{sx:{fontSize:20}})})]}),t.jsxs(o.Box,{sx:{flex:1,overflow:"auto",px:3,py:2.5,"&::-webkit-scrollbar":{width:8},"&::-webkit-scrollbar-track":{bgcolor:"transparent"},"&::-webkit-scrollbar-thumb":{bgcolor:"#dadce0",borderRadius:4,"&:hover":{bgcolor:"#bdc1c6"}}},children:[t.jsxs(o.Box,{sx:{mb:2.5},children:[t.jsx(o.Typography,{variant:"overline",sx:{fontSize:"0.6875rem",fontWeight:600,color:"#5f6368",letterSpacing:"0.1em",mb:1.5,display:"block",textTransform:"uppercase"},children:"Add sort level"}),t.jsxs(o.FormControl,{size:"small",fullWidth:!0,disabled:c.length>=3,children:[t.jsx(o.InputLabel,{sx:{fontSize:"0.875rem",color:"#5f6368","&.Mui-focused":{color:"#1967d2"}},children:"Select column..."}),t.jsx(o.Select,{value:a,onChange:s=>l(s.target.value),label:"Select column...",sx:{fontSize:"0.875rem",height:40,borderRadius:"4px",bgcolor:"#ffffff","& .MuiOutlinedInput-notchedOutline":{borderColor:"#dadce0",transition:"border-color 0.2s ease"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#1967d2"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#1967d2",borderWidth:"2px"},"&.Mui-disabled":{bgcolor:"#f8f9fa"}},children:T.map(s=>t.jsx(o.MenuItem,{value:s.name,sx:{fontSize:"0.875rem",color:"#3c4043",py:1,"&:hover":{bgcolor:"#f1f3f4"},"&.Mui-selected":{bgcolor:"#e8f0fe","&:hover":{bgcolor:"#d2e3fc"}}},children:Ct(s.name)},s.name))})]}),t.jsx(o.Button,{onClick:x,disabled:!f(),sx:{mt:1.5,textTransform:"none",fontSize:"0.875rem",fontWeight:500,color:"#1967d2",p:0,justifyContent:"flex-start",minHeight:"auto",transition:"color 0.2s ease","&:hover":{bgcolor:"transparent",color:"#1557b0",textDecoration:"underline"},"&.Mui-disabled":{color:"#bdc1c6"}},children:"+ Add sort column"})]}),c.length>0&&t.jsxs(o.Box,{children:[t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1.5},children:[t.jsxs(o.Typography,{variant:"overline",sx:{fontSize:"0.6875rem",fontWeight:600,color:"#5f6368",letterSpacing:"0.1em",textTransform:"uppercase"},children:["Sorted sequence (",c.length,"/3)"]}),t.jsx(o.Button,{onClick:v,sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,color:"#d93025",p:0,minWidth:"auto",minHeight:"auto",transition:"color 0.2s ease","&:hover":{bgcolor:"transparent",color:"#b3190e",textDecoration:"underline"}},children:"Clear all"})]}),t.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1.25},children:c.map((s,k)=>t.jsx(Bc,{rule:s,index:k,onToggleDirection:b,onRemove:m,onMove:g},`${s.column}-${k}`))})]})]}),t.jsxs(o.Box,{sx:{px:3,py:2,borderTop:"1px solid #e8eaed",display:"flex",gap:1.5,justifyContent:"flex-end",flexShrink:0,bgcolor:"#f8f9fa"},children:[t.jsx(o.Button,{onClick:p,variant:"text",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,color:"#5f6368",px:3,py:1,minHeight:36,borderRadius:"4px",transition:"all 0.2s ease","&:hover":{bgcolor:"#e8eaed",color:"#202124"}},children:"Cancel"}),t.jsx(o.Button,{onClick:C,variant:"contained",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,bgcolor:"#1967d2",color:"#ffffff",px:3,py:1,minHeight:36,borderRadius:"4px",boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15)",transition:"all 0.2s ease","&:hover":{bgcolor:"#1557b0",boxShadow:"0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15)"},"&:active":{boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3)",transform:"translateY(1px)"}},children:"Apply sort"})]})]})})})}function Oc({views:e,activeViewId:r,onSelectView:n,onCreateView:i,onEditView:a,onDeleteView:l,onRestoreView:c,onPermanentDelete:d,onClose:f}){return t.jsxs(o.Dialog,{open:!0,onClose:f,maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{mt:8,borderRadius:"12px",boxShadow:"0 8px 16px 4px rgba(60, 64, 67, 0.12), 0 4px 16px 0px rgba(60, 64, 67, 0.08), 0 0 0 1px rgba(60, 64, 67, 0.05)"}},children:[t.jsxs(o.DialogTitle,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",pb:1},children:["Manage Views",t.jsx(o.IconButton,{onClick:f,size:"small",sx:{color:"text.secondary"},children:t.jsx(w.Close,{sx:{fontSize:20}})})]}),t.jsxs(o.DialogContent,{children:[t.jsx(o.Box,{sx:{mb:2},children:t.jsx(o.Button,{onClick:i,variant:"contained",startIcon:t.jsx(w.Add,{sx:{fontSize:16}}),size:"small",children:"Create New Report View"})}),t.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.map(x=>t.jsx(o.Paper,{sx:{p:2,border:1,borderColor:x.isDeleted?"error.light":r===x.id?"primary.main":"divider",bgcolor:x.isDeleted?m=>ne(m.palette.error.main,.12):r===x.id?m=>ne(m.palette.primary.main,.12):"background.paper",opacity:x.isDeleted?.75:1,cursor:x.isDeleted?"default":"pointer","&:hover":x.isDeleted?{}:{bgcolor:"action.hover"}},onClick:()=>!x.isDeleted&&n(x.id),elevation:0,children:t.jsxs(o.Box,{sx:{display:"flex",alignItems:"flex-start",gap:1.5},children:[t.jsxs(o.Box,{sx:{flex:1},children:[t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:500,textDecoration:x.isDeleted?"line-through":"none",color:x.isDeleted?"text.secondary":"text.primary"},children:x.name}),x.isDeleted&&t.jsx(o.Chip,{label:"Deleted",size:"small",color:"error",sx:{height:20}}),x.isDefault&&t.jsx(o.Chip,{label:"Default",size:"small",color:"primary",sx:{height:20}}),x.isFavorite&&t.jsx(o.Chip,{label:"★ Favorite",size:"small",sx:{height:20}})]}),x.description&&t.jsx(o.Typography,{variant:"caption",color:"text.secondary",children:x.description})]}),t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[!x.isDeleted&&t.jsxs(t.Fragment,{children:[t.jsx(o.IconButton,{size:"small",onClick:m=>{m.stopPropagation(),a(x.id)},title:"Edit view",children:t.jsx(w.Edit,{sx:{fontSize:16}})}),t.jsx(o.IconButton,{size:"small",onClick:m=>{m.stopPropagation(),l(x.id)},title:"Delete view",sx:{"&:hover":{color:"error.main"}},children:t.jsx(w.Delete,{sx:{fontSize:16}})})]}),x.isDeleted&&c&&t.jsx(o.IconButton,{size:"small",onClick:m=>{m.stopPropagation(),c(x.id)},title:"Restore view",sx:{color:"success.main"},children:t.jsx(w.Undo,{sx:{fontSize:16}})}),x.isDeleted&&d&&t.jsx(o.IconButton,{size:"small",onClick:m=>{m.stopPropagation(),d(x.id)},title:"Delete permanently",sx:{color:"error.main"},children:t.jsx(w.Delete,{sx:{fontSize:16}})})]})]})},x.id))})]}),t.jsx(o.DialogActions,{sx:{px:3,py:1.75,borderTop:"1px solid #e8eaed",bgcolor:"#f8f9fa",gap:1.25,justifyContent:"flex-end"},children:t.jsx(o.Button,{onClick:f,variant:"contained",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,bgcolor:"#1967d2",color:"#ffffff",px:3,py:.875,minHeight:36,borderRadius:"4px",boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15)",transition:"all 0.2s ease","&:hover":{bgcolor:"#1557b0",boxShadow:"0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15)"},"&:active":{boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3)",transform:"translateY(1px)"}},children:"Close"})})]})}function hn({currentSnapshot:e,onSave:r,onClose:n,isEditMode:i=!1,initialName:a="",initialDescription:l="",initialIsDefault:c=!1}){const[d,f]=u.useState(a),[x,m]=u.useState(l),[b,g]=u.useState(c),v=()=>{d.trim()&&(r(d.trim(),x.trim(),b),n())},C=T=>{T.key==="Enter"&&!T.shiftKey?v():T.key==="Escape"&&n()},p=()=>i&&a?`Update ${a} view`:"Create New Report View";return t.jsxs(o.Dialog,{open:!0,onClose:n,maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{mt:8,borderRadius:"12px",boxShadow:"0 8px 16px 4px rgba(60, 64, 67, 0.12), 0 4px 16px 0px rgba(60, 64, 67, 0.08), 0 0 0 1px rgba(60, 64, 67, 0.05)"}},children:[t.jsxs(o.DialogTitle,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",pb:1},children:[p(),t.jsx(o.IconButton,{onClick:n,size:"small",sx:{color:"text.secondary"},children:t.jsx(w.Close,{sx:{fontSize:20}})})]}),t.jsx(o.DialogContent,{children:t.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:2,pt:1},children:[t.jsx(o.TextField,{label:"View Name",required:!0,value:d,onChange:T=>f(T.target.value),onKeyDown:C,placeholder:"e.g., Active Users",autoFocus:!0,fullWidth:!0,size:"small"}),t.jsx(o.TextField,{label:"Description (optional)",value:x,onChange:T=>m(T.target.value),placeholder:"Brief description of this view",multiline:!0,rows:2,fullWidth:!0,size:"small"}),t.jsxs(o.Paper,{sx:{p:2,bgcolor:"action.hover"},variant:"outlined",children:[t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:500,mb:1},children:"This view will capture:"}),t.jsxs(o.Box,{component:"ul",sx:{m:0,pl:2,"& li":{fontSize:"body2.fontSize",color:"text.secondary"}},children:[t.jsxs("li",{children:[e.filters.length," filter",e.filters.length!==1?"s":""]}),t.jsxs("li",{children:["Sorting: ",es(e.sortStack)]}),t.jsx("li",{children:"Column order & visibility"})]})]}),!i&&t.jsx(o.FormControlLabel,{control:t.jsx(o.Checkbox,{checked:b,onChange:T=>g(T.target.checked),size:"small"}),label:t.jsx(o.Typography,{variant:"body2",children:"Set as default view"})})]})}),t.jsxs(o.DialogActions,{sx:{px:3,py:1.75,borderTop:"1px solid #e8eaed",bgcolor:"#f8f9fa",gap:1.25,justifyContent:"flex-end"},children:[t.jsx(o.Button,{onClick:n,variant:"text",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,color:"#5f6368",px:3,py:.875,minHeight:36,borderRadius:"4px",transition:"all 0.2s ease","&:hover":{bgcolor:"#e8eaed",color:"#202124"}},children:"Cancel"}),t.jsx(o.Button,{onClick:v,disabled:!d.trim(),variant:"contained",startIcon:t.jsx(w.Save,{sx:{fontSize:18}}),sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,bgcolor:"#1967d2",color:"#ffffff",px:3,py:.875,minHeight:36,borderRadius:"4px",boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15)",transition:"all 0.2s ease","&:hover":{bgcolor:"#1557b0",boxShadow:"0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15)"},"&:active":{boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3)",transform:"translateY(1px)"},"&.Mui-disabled":{bgcolor:"#e8eaed",color:"#bdc1c6"}},children:i?"Save Changes":"Create Report View"})]})]})}function Ac({viewName:e,onConfirm:r,onCancel:n}){return t.jsxs(o.Dialog,{open:!0,onClose:n,maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{mt:8,borderRadius:"12px",boxShadow:"0 8px 16px 4px rgba(60, 64, 67, 0.12), 0 4px 16px 0px rgba(60, 64, 67, 0.08), 0 0 0 1px rgba(60, 64, 67, 0.05)"}},children:[t.jsxs(o.DialogTitle,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",pb:1},children:["Delete View",t.jsx(o.IconButton,{onClick:n,size:"small",sx:{color:"text.secondary"},children:t.jsx(w.Close,{sx:{fontSize:20}})})]}),t.jsx(o.DialogContent,{children:t.jsxs(o.Box,{sx:{display:"flex",alignItems:"flex-start",gap:1.5,mt:1},children:[t.jsx(w.Warning,{color:"error",sx:{fontSize:20,flexShrink:0}}),t.jsxs(o.Box,{children:[t.jsxs(o.Typography,{variant:"body2",sx:{mb:1},children:["Are you sure you want to delete the view ",t.jsxs("strong",{children:['"',e,'"']}),"?"]}),t.jsx(o.Typography,{variant:"body2",color:"text.secondary",children:"This action cannot be undone."})]})]})}),t.jsxs(o.DialogActions,{sx:{px:3,py:1.75,borderTop:"1px solid #e8eaed",bgcolor:"#f8f9fa",gap:1.25,justifyContent:"flex-end"},children:[t.jsx(o.Button,{onClick:n,variant:"text",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,color:"#5f6368",px:3,py:.875,minHeight:36,borderRadius:"4px",transition:"all 0.2s ease","&:hover":{bgcolor:"#e8eaed",color:"#202124"}},children:"Cancel"}),t.jsx(o.Button,{onClick:r,variant:"contained",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,bgcolor:"#d93025",color:"#ffffff",px:3,py:.875,minHeight:36,borderRadius:"4px",boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15)",transition:"all 0.2s ease","&:hover":{bgcolor:"#b3190e",boxShadow:"0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15)"},"&:active":{boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3)",transform:"translateY(1px)"}},children:"Delete View"})]})]})}const Gn=80,Yn=600,mn="COLUMN";function Rc({column:e,index:r,isVisible:n,width:i,onToggleVisibility:a,onWidthChange:l,moveColumn:c}){const d=u.useRef(null),[f,x]=u.useState(i.toString()),[{handlerId:m},b]=dt.useDrop({accept:mn,collect(s){return{handlerId:s.getHandlerId()}},hover(s,k){var K;if(!d.current)return;const D=s.index,A=r;if(D===A)return;const S=(K=d.current)==null?void 0:K.getBoundingClientRect(),R=(S.bottom-S.top)/2,Y=k.getClientOffset(),_=((Y==null?void 0:Y.y)??0)-S.top;D<A&&_<R||D>A&&_>R||(c(D,A),s.index=A)}}),[{isDragging:g},v]=dt.useDrag({type:mn,item:()=>({index:r}),collect:s=>({isDragging:s.isDragging()})});v(b(d));const C=()=>{const s=parseInt(f);if(isNaN(s)){x(i.toString());return}const k=Math.max(Gn,Math.min(Yn,s));x(k.toString()),l(e.name,k)},p=s=>{(s===""||/^\d+$/.test(s))&&x(s)},T=s=>({string:"#1967d2",number:"#188038",boolean:"#9334e6",array:"#ea8600",object:"#d93025",null:"#5f6368",mixed:"#5f6368"})[s]||"#5f6368";return t.jsxs(o.TableRow,{ref:d,"data-handler-id":m,sx:{opacity:g?.4:1,bgcolor:n?"#ffffff":"#f8f9fa",transition:"all 0.2s ease","&:hover":{bgcolor:n?"#f8f9fa":"#f1f3f4"},cursor:"move",height:56,borderBottom:"1px solid #e8eaed"},children:[t.jsx(o.TableCell,{sx:{py:1.5,px:2.5,borderBottom:"none"},children:t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:1.25},children:[t.jsx(o.Box,{sx:{color:"#5f6368",cursor:"grab",opacity:.6,transition:"opacity 0.2s ease","&:hover":{opacity:1},"&:active":{cursor:"grabbing"}},children:t.jsx(w.DragIndicator,{sx:{fontSize:20}})}),t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:400,fontSize:"0.875rem",color:n?"#3c4043":"#5f6368"},children:Ct(e.name)})]})}),t.jsx(o.TableCell,{sx:{py:1.5,px:2.5,borderBottom:"none"},children:t.jsx(o.Chip,{label:e.type.toUpperCase(),size:"small",sx:{height:22,fontSize:"0.6875rem",fontWeight:600,bgcolor:`${T(e.type)}15`,color:T(e.type),border:`1px solid ${T(e.type)}30`,"& .MuiChip-label":{px:1}}})}),t.jsx(o.TableCell,{sx:{py:1.5,px:2.5,borderBottom:"none"},children:t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[t.jsx(o.TextField,{type:"text",value:f,onChange:s=>p(s.target.value),onBlur:C,placeholder:"150",size:"small",sx:{width:80,"& .MuiOutlinedInput-root":{height:32,fontSize:"0.8125rem",borderRadius:"4px",bgcolor:"#ffffff","& fieldset":{borderColor:"#dadce0"},"&:hover fieldset":{borderColor:"#1967d2"},"&.Mui-focused fieldset":{borderColor:"#1967d2",borderWidth:"2px"}},"& .MuiInputBase-input":{py:.5,px:1.25,color:"#3c4043"}}}),t.jsx(o.Typography,{variant:"caption",sx:{fontSize:"0.75rem",color:"#5f6368"},children:"px"})]})}),t.jsx(o.TableCell,{sx:{py:1.5,px:2.5,borderBottom:"none"},children:t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:1.25},children:[t.jsx(o.IconButton,{onClick:()=>a(e.name,!n),title:n?"Hide column":"Show column",size:"small",sx:{p:.75,color:n?"#1967d2":"#5f6368",transition:"all 0.2s ease","&:hover":{bgcolor:"#f1f3f4",color:n?"#1557b0":"#1967d2"}},children:n?t.jsx(w.Visibility,{sx:{fontSize:20}}):t.jsx(w.VisibilityOff,{sx:{fontSize:20}})}),t.jsx(o.Chip,{label:n?"Visible":"Hidden",size:"small",sx:{height:22,fontSize:"0.6875rem",fontWeight:500,bgcolor:n?"#e6f4ea":"#f1f3f4",color:n?"#188038":"#5f6368","& .MuiChip-label":{px:1}}})]})})]})}function Mc({schema:e,columnVisibility:r,columnOrder:n,columnWidths:i={},views:a=[],activeViewId:l="",onUpdateColumnVisibility:c,onUpdateColumnOrder:d,onUpdateColumnWidth:f,onResetLayout:x,onSaveToCurrentView:m,onSaveToAllViews:b,onSelectView:g,onClose:v}){const[C,p]=u.useState(!1),[T,s]=u.useState(n),[k,D]=u.useState("all"),[A,S]=u.useState(null),R=(E,H)=>{const de=[...T],[ue]=de.splice(E,1);de.splice(H,0,ue),s(de),d(de)},Y=()=>{x(),p(!1)},K=T.map(E=>e.find(H=>H.name===E)).filter(E=>E!==void 0).filter(E=>{const H=r[E.name]??!0;return k==="active"?H:k==="hidden"?!H:!0}),V=Object.values(r).filter(E=>E).length,te=e.length,h=a.find(E=>E.id===l),F=a.filter(E=>!E.isDeleted),W=u.useMemo(()=>{if(!h)return!1;const E=h.snapshot,H=JSON.stringify(r)!==JSON.stringify(E.columnVisibility),de=JSON.stringify(n)!==JSON.stringify(E.columnOrder),ue=JSON.stringify(i)!==JSON.stringify(E.columnWidths);return H||de||ue},[h,r,n,i]);return t.jsx(dt.DndProvider,{backend:io.HTML5Backend,children:t.jsx(o.Box,{onClick:v,sx:{position:"fixed",top:0,left:0,right:0,bottom:0,bgcolor:"rgba(0, 0, 0, 0.4)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1300,animation:"fadeIn 0.225s cubic-bezier(0.4, 0, 0.2, 1)","@keyframes fadeIn":{from:{opacity:0},to:{opacity:1}}},children:t.jsxs(o.Paper,{onClick:E=>E.stopPropagation(),elevation:0,sx:{position:"relative",width:720,maxWidth:"calc(100vw - 120px)",maxHeight:"min(760px, calc(100vh - 200px))",display:"flex",flexDirection:"column",borderRadius:"12px",bgcolor:"#ffffff",outline:"none",boxShadow:"0 8px 16px 4px rgba(60, 64, 67, 0.12), 0 4px 16px 0px rgba(60, 64, 67, 0.08), 0 0 0 1px rgba(60, 64, 67, 0.05)",animation:"slideIn 0.225s cubic-bezier(0.4, 0, 0.2, 1)","@keyframes slideIn":{from:{opacity:0,transform:"scale(0.95) translateY(-12px)"},to:{opacity:1,transform:"scale(1) translateY(0)"}}},children:[t.jsxs(o.Box,{sx:{px:3,pt:2,pb:1.5,borderBottom:"1px solid #e8eaed",flexShrink:0},children:[t.jsxs(o.Box,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",mb:1.5},children:[t.jsxs(o.Box,{sx:{flex:1},children:[t.jsx(o.Typography,{variant:"h6",sx:{fontSize:"1.125rem",fontWeight:500,color:"#202124",letterSpacing:"0",lineHeight:1.5},children:"Manage columns"}),t.jsxs(o.Typography,{variant:"body2",sx:{fontSize:"0.8125rem",color:"#5f6368",mt:.5},children:[V," of ",te," columns visible • Drag to reorder"]})]}),F.length>0&&g&&t.jsxs(o.Box,{sx:{ml:2},children:[t.jsx(o.Typography,{variant:"caption",sx:{fontSize:"0.6875rem",color:"#5f6368",mb:.75,display:"block",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.1em"},children:"View:"}),t.jsx(o.Button,{onClick:E=>S(E.currentTarget),variant:"outlined",size:"small",endIcon:t.jsx(w.KeyboardArrowDown,{sx:{fontSize:18}}),sx:{minWidth:180,justifyContent:"space-between",textTransform:"none",fontSize:"0.875rem",fontWeight:400,color:"#3c4043",borderColor:"#dadce0",py:.75,px:1.5,"&:hover":{borderColor:"#1967d2",bgcolor:"#f8f9fa"}},children:t.jsx(o.Box,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis"},children:(h==null?void 0:h.name)||"Select View"})}),t.jsx(o.Menu,{anchorEl:A,open:!!A,onClose:()=>S(null),PaperProps:{sx:{mt:.5,borderRadius:"8px",boxShadow:"0 2px 6px rgba(60, 64, 67, 0.15)"}},children:F.map(E=>t.jsx(o.MenuItem,{onClick:()=>{g(E.id),S(null)},selected:E.id===l,sx:{fontSize:"0.875rem",color:"#3c4043",py:1,px:2,"&:hover":{bgcolor:"#f1f3f4"},"&.Mui-selected":{bgcolor:"#e8f0fe","&:hover":{bgcolor:"#d2e3fc"}}},children:E.name},E.id))})]}),t.jsx(o.IconButton,{onClick:v,size:"small",sx:{ml:2,p:.75,color:"#5f6368",transition:"all 0.2s ease","&:hover":{bgcolor:"#f1f3f4",color:"#202124"}},children:t.jsx(w.Close,{sx:{fontSize:20}})})]}),t.jsxs(o.Tabs,{value:k,onChange:(E,H)=>D(H),sx:{minHeight:36,mt:.5,"& .MuiTabs-indicator":{bgcolor:"#1967d2",height:3}},children:[t.jsx(o.Tab,{label:"All",value:"all",sx:{minHeight:36,py:.75,fontSize:"0.875rem",fontWeight:500,textTransform:"none",color:"#5f6368","&.Mui-selected":{color:"#1967d2"}}}),t.jsx(o.Tab,{label:"Visible",value:"active",sx:{minHeight:36,py:.75,fontSize:"0.875rem",fontWeight:500,textTransform:"none",color:"#5f6368","&.Mui-selected":{color:"#1967d2"}}}),t.jsx(o.Tab,{label:"Hidden",value:"hidden",sx:{minHeight:36,py:.75,fontSize:"0.875rem",fontWeight:500,textTransform:"none",color:"#5f6368","&.Mui-selected":{color:"#1967d2"}}})]})]}),t.jsx(o.Box,{sx:{flex:1,overflow:"auto","&::-webkit-scrollbar":{width:8,height:8},"&::-webkit-scrollbar-track":{bgcolor:"transparent"},"&::-webkit-scrollbar-thumb":{bgcolor:"#dadce0",borderRadius:4,"&:hover":{bgcolor:"#bdc1c6"}}},children:t.jsxs(o.Table,{stickyHeader:!0,sx:{minWidth:650},children:[t.jsx(o.TableHead,{children:t.jsxs(o.TableRow,{children:[t.jsx(o.TableCell,{sx:{fontWeight:600,textTransform:"uppercase",fontSize:"0.6875rem",color:"#5f6368",bgcolor:"#f8f9fa",letterSpacing:"0.1em",py:1.5,px:2.5,borderBottom:"1px solid #e8eaed"},children:"Column name"}),t.jsx(o.TableCell,{sx:{fontWeight:600,textTransform:"uppercase",fontSize:"0.6875rem",color:"#5f6368",bgcolor:"#f8f9fa",letterSpacing:"0.1em",py:1.5,px:2.5,borderBottom:"1px solid #e8eaed"},children:"Type"}),t.jsx(o.TableCell,{sx:{fontWeight:600,textTransform:"uppercase",fontSize:"0.6875rem",color:"#5f6368",bgcolor:"#f8f9fa",letterSpacing:"0.1em",py:1.5,px:2.5,borderBottom:"1px solid #e8eaed"},children:t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:["Width",t.jsx(o.Tooltip,{title:`Column width in pixels (min: ${Gn}px, max: ${Yn}px)`,arrow:!0,placement:"top",children:t.jsx(w.InfoOutlined,{sx:{fontSize:14,color:"#5f6368",cursor:"help"}})})]})}),t.jsx(o.TableCell,{sx:{fontWeight:600,textTransform:"uppercase",fontSize:"0.6875rem",color:"#5f6368",bgcolor:"#f8f9fa",letterSpacing:"0.1em",py:1.5,px:2.5,borderBottom:"1px solid #e8eaed"},children:"Visibility"})]})}),t.jsx(o.TableBody,{children:K.length===0?t.jsx(o.TableRow,{children:t.jsx(o.TableCell,{colSpan:4,align:"center",sx:{py:6,borderBottom:"none"},children:t.jsx(o.Typography,{variant:"body2",sx:{fontSize:"0.875rem",color:"#5f6368"},children:"No columns in this category"})})}):K.map((E,H)=>t.jsx(Rc,{column:E,index:H,isVisible:r[E.name]??!0,width:i[E.name]||150,onToggleVisibility:c,onWidthChange:f||(()=>{}),moveColumn:R},E.name))})]})}),t.jsxs(o.Box,{sx:{px:3,py:1.75,borderTop:"1px solid #e8eaed",display:"flex",justifyContent:"space-between",alignItems:"center",flexShrink:0,bgcolor:"#f8f9fa"},children:[t.jsx(o.Button,{onClick:()=>p(!0),disabled:!W,variant:"outlined",startIcon:t.jsx(w.Undo,{sx:{fontSize:18}}),sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,color:"#5f6368",borderColor:"#dadce0",px:2.5,py:.875,minHeight:36,borderRadius:"4px","&:hover":{borderColor:"#1967d2",bgcolor:"#ffffff",color:"#1967d2"},"&.Mui-disabled":{color:"#bdc1c6",borderColor:"#e8eaed"}},children:"Reset to default"}),t.jsxs(o.Stack,{direction:"row",spacing:1.25,children:[m&&t.jsx(o.Button,{onClick:()=>{m(),v()},disabled:!W,variant:"contained",startIcon:t.jsx(w.Save,{sx:{fontSize:18}}),sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,bgcolor:"#1967d2",color:"#ffffff",px:2.5,py:.875,minHeight:36,borderRadius:"4px",boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15)",transition:"all 0.2s ease","&:hover":{bgcolor:"#1557b0",boxShadow:"0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15)"},"&:active":{boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3)",transform:"translateY(1px)"},"&.Mui-disabled":{bgcolor:"#e8eaed",color:"#bdc1c6"}},children:"Save to current view"}),b&&t.jsx(o.Button,{onClick:()=>{b(),v()},disabled:!W,variant:"contained",startIcon:t.jsx(w.GridView,{sx:{fontSize:18}}),sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,bgcolor:"#188038",color:"#ffffff",px:2.5,py:.875,minHeight:36,borderRadius:"4px",boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15)",transition:"all 0.2s ease","&:hover":{bgcolor:"#0d652d",boxShadow:"0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15)"},"&:active":{boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3)",transform:"translateY(1px)"},"&.Mui-disabled":{bgcolor:"#e8eaed",color:"#bdc1c6"}},children:"Save to all views"})]})]}),C&&t.jsx(o.Box,{onClick:()=>p(!1),sx:{position:"fixed",top:0,left:0,right:0,bottom:0,bgcolor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1400},children:t.jsxs(o.Paper,{onClick:E=>E.stopPropagation(),elevation:0,sx:{width:400,maxWidth:"90vw",borderRadius:"12px",bgcolor:"#ffffff",boxShadow:"0 8px 16px 4px rgba(60, 64, 67, 0.12), 0 4px 16px 0px rgba(60, 64, 67, 0.08), 0 0 0 1px rgba(60, 64, 67, 0.05)"},children:[t.jsxs(o.Box,{sx:{px:3,py:2.5},children:[t.jsx(o.Typography,{variant:"h6",sx:{fontSize:"1rem",fontWeight:500,color:"#202124",mb:1.5},children:"Reset column layout?"}),t.jsx(o.Typography,{variant:"body2",sx:{fontSize:"0.875rem",color:"#5f6368",lineHeight:1.5},children:"This will restore default visibility, order, and widths for all columns."})]}),t.jsxs(o.Box,{sx:{px:3,py:2,borderTop:"1px solid #e8eaed",display:"flex",gap:1.5,justifyContent:"flex-end",bgcolor:"#f8f9fa"},children:[t.jsx(o.Button,{onClick:()=>p(!1),variant:"text",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,color:"#5f6368",px:3,py:1,borderRadius:"4px","&:hover":{bgcolor:"#e8eaed",color:"#202124"}},children:"Cancel"}),t.jsx(o.Button,{onClick:Y,variant:"contained",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,bgcolor:"#d93025",color:"#ffffff",px:3,py:1,borderRadius:"4px",boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3)","&:hover":{bgcolor:"#b3190e",boxShadow:"0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15)"},"&:active":{boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3)",transform:"translateY(1px)"}},children:"Reset layout"})]})]})})]})})})}function Pc({schema:e,grouping:r,onApply:n,onClose:i}){var S;const[a,l]=u.useState(r||{enabled:!1,levels:[],collapsedGroups:[]}),[c,d]=u.useState(""),[f,x]=u.useState(null),m=u.useMemo(()=>Gi(e),[e]),b=u.useMemo(()=>m.filter(R=>!a.levels.some((Y,_)=>Y.column===R.name&&_!==f)),[m,a.levels,f]),g=a.levels.length<3&&b.length>0,v=u.useCallback(()=>{!g||!c||(l({...a,levels:[...a.levels,{column:c}],enabled:!0}),d(""))},[g,c,a]),C=u.useCallback(R=>{const Y=a.levels.filter((_,K)=>K!==R);if(Y.length===0){n(null),i();return}l({...a,levels:Y,enabled:Y.length>0})},[a,n,i]),p=u.useCallback(R=>{x(R),d(a.levels[R].column)},[a.levels]),T=u.useCallback(()=>{if(f===null||!c)return;const R=[...a.levels];R[f]={column:c},l({...a,levels:R}),x(null),d("")},[f,c,a]),s=u.useCallback(()=>{x(null),d("")},[]),k=u.useCallback((R,Y)=>{const _=Y==="up"?R-1:R+1;if(_<0||_>=a.levels.length)return;const K=[...a.levels],[V]=K.splice(R,1);K.splice(_,0,V),l({...a,levels:K})},[a]),D=u.useCallback(()=>{n(null),i()},[n,i]),A=u.useCallback(()=>{a.levels.length===0?n(null):n({...a,enabled:!0,collapsedGroups:(r==null?void 0:r.collapsedGroups)||[]}),i()},[a,r,n,i]);return t.jsx(o.Box,{onClick:i,sx:{position:"fixed",top:0,left:0,right:0,bottom:0,bgcolor:"rgba(0, 0, 0, 0.4)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1300,animation:"fadeIn 0.225s cubic-bezier(0.4, 0, 0.2, 1)","@keyframes fadeIn":{from:{opacity:0},to:{opacity:1}}},children:t.jsxs(o.Paper,{onClick:R=>R.stopPropagation(),elevation:0,sx:{position:"relative",width:540,maxWidth:"calc(100vw - 120px)",maxHeight:"min(560px, calc(100vh - 280px))",display:"flex",flexDirection:"column",borderRadius:"12px",bgcolor:"#ffffff",outline:"none",boxShadow:"0 8px 16px 4px rgba(60, 64, 67, 0.12), 0 4px 16px 0px rgba(60, 64, 67, 0.08), 0 0 0 1px rgba(60, 64, 67, 0.05)",animation:"slideIn 0.225s cubic-bezier(0.4, 0, 0.2, 1)","@keyframes slideIn":{from:{opacity:0,transform:"scale(0.95) translateY(-12px)"},to:{opacity:1,transform:"scale(1) translateY(0)"}}},children:[t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:3,py:2,borderBottom:"1px solid #e8eaed",flexShrink:0},children:[t.jsx(o.Typography,{variant:"h6",sx:{fontSize:"1.125rem",fontWeight:500,color:"#202124",letterSpacing:"0",lineHeight:1.5},children:"Group configuration"}),t.jsx(o.IconButton,{onClick:i,size:"small",sx:{p:.75,color:"#5f6368",transition:"all 0.2s ease","&:hover":{bgcolor:"#f1f3f4",color:"#202124"}},children:t.jsx(w.Close,{sx:{fontSize:20}})})]}),t.jsx(o.Box,{sx:{flex:1,overflow:"auto",px:3,py:2.5,"&::-webkit-scrollbar":{width:8},"&::-webkit-scrollbar-track":{bgcolor:"transparent"},"&::-webkit-scrollbar-thumb":{bgcolor:"#dadce0",borderRadius:4,"&:hover":{bgcolor:"#bdc1c6"}}},children:t.jsxs(o.Stack,{spacing:2.5,children:[f===null&&t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"overline",sx:{fontSize:"0.6875rem",fontWeight:600,color:"#5f6368",letterSpacing:"0.1em",mb:1.5,display:"block",textTransform:"uppercase"},children:"Add group level"}),t.jsx(o.FormControl,{fullWidth:!0,size:"small",sx:{mb:1.5},children:t.jsxs(o.Select,{value:c,onChange:R=>d(R.target.value),disabled:!g,displayEmpty:!0,sx:{fontSize:"0.875rem",height:40,borderRadius:"4px",bgcolor:"#ffffff","& .MuiOutlinedInput-notchedOutline":{borderColor:"#dadce0",transition:"border-color 0.2s ease"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#1967d2"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#1967d2",borderWidth:"2px"},"&.Mui-disabled":{bgcolor:"#f8f9fa"}},children:[t.jsx(o.MenuItem,{value:"",sx:{fontSize:"0.875rem",color:"#5f6368"},children:"Select a column..."}),b.map(R=>t.jsxs(o.MenuItem,{value:R.name,sx:{fontSize:"0.875rem",color:"#3c4043",py:1,"&:hover":{bgcolor:"#f1f3f4"},"&.Mui-selected":{bgcolor:"#e8f0fe","&:hover":{bgcolor:"#d2e3fc"}}},children:[Ct(R.name)," (",R.type.toUpperCase(),")"]},R.name))]})}),t.jsx(o.Button,{onClick:v,disabled:!g||!c,variant:"outlined",startIcon:t.jsx(w.Add,{sx:{fontSize:18}}),fullWidth:!0,sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,color:"#1967d2",borderColor:"#dadce0",py:1,transition:"all 0.2s ease","&:hover":{borderColor:"#1967d2",bgcolor:"#f8f9fa"},"&.Mui-disabled":{color:"#bdc1c6",borderColor:"#e8eaed"}},children:"Add group level"}),a.levels.length===3&&t.jsx(o.Typography,{variant:"caption",color:"text.secondary",sx:{display:"block",textAlign:"center",mt:1.5,fontSize:"0.75rem",color:"#5f6368"},children:"Maximum group levels (3) reached"}),m.length===0&&t.jsx(o.Typography,{variant:"body2",color:"text.secondary",sx:{textAlign:"center",py:2,fontSize:"0.875rem",color:"#5f6368"},children:"No groupable columns available. Only STRING and BOOLEAN columns can be grouped."})]}),f!==null&&t.jsxs(o.Alert,{severity:"warning",sx:{borderRadius:"8px",border:"1px solid #fdd663",bgcolor:"#fef7e0","& .MuiAlert-icon":{color:"#ea8600"}},children:[t.jsxs(o.Typography,{variant:"body2",sx:{fontWeight:500,mb:1.5,fontSize:"0.875rem",color:"#3c4043"},children:["Edit Group Level ",f+1]}),t.jsx(o.FormControl,{fullWidth:!0,size:"small",sx:{mb:1.5},children:t.jsxs(o.Select,{value:c,onChange:R=>d(R.target.value),sx:{fontSize:"0.875rem",height:40,borderRadius:"4px",bgcolor:"#ffffff","& .MuiOutlinedInput-notchedOutline":{borderColor:"#dadce0"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#1967d2"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#1967d2",borderWidth:"2px"}},children:[t.jsx(o.MenuItem,{value:"",sx:{fontSize:"0.875rem"},children:"Select a column..."}),t.jsxs(o.MenuItem,{value:a.levels[f].column,sx:{fontSize:"0.875rem","&.Mui-selected":{bgcolor:"#e8f0fe"}},children:[a.levels[f].column," (",(S=e.find(R=>R.name===a.levels[f].column))==null?void 0:S.type.toUpperCase(),")"]}),b.filter(R=>R.name!==a.levels[f].column).map(R=>t.jsxs(o.MenuItem,{value:R.name,sx:{fontSize:"0.875rem","&.Mui-selected":{bgcolor:"#e8f0fe"}},children:[Ct(R.name)," (",R.type.toUpperCase(),")"]},R.name))]})}),t.jsxs(o.Stack,{direction:"row",spacing:1.5,children:[t.jsx(o.Button,{onClick:T,disabled:!c,variant:"contained",fullWidth:!0,size:"small",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,bgcolor:"#ea8600",color:"#ffffff",py:.875,boxShadow:"none","&:hover":{bgcolor:"#c96e00",boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3)"}},children:"Save"}),t.jsx(o.Button,{onClick:s,variant:"outlined",fullWidth:!0,size:"small",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,color:"#5f6368",borderColor:"#dadce0",py:.875,"&:hover":{borderColor:"#bdc1c6",bgcolor:"#f8f9fa"}},children:"Cancel"})]})]}),a.levels.length>0&&f===null&&t.jsxs(o.Box,{children:[t.jsxs(o.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:1.5},children:[t.jsx(o.Typography,{variant:"overline",sx:{fontSize:"0.6875rem",fontWeight:600,color:"#5f6368",letterSpacing:"0.1em",textTransform:"uppercase"},children:"Active group levels"}),t.jsx(o.Button,{onClick:D,size:"small",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,color:"#d93025",p:0,minWidth:"auto","&:hover":{bgcolor:"transparent",color:"#b3190e",textDecoration:"underline"}},children:"Clear all"})]}),t.jsx(o.Stack,{spacing:1.5,children:a.levels.map((R,Y)=>{const _=e.find(K=>K.name===R.column);return t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:1.5,p:2,borderRadius:"8px",bgcolor:"#ffffff",border:"1px solid #e8eaed",transition:"all 0.2s ease","&:hover":{bgcolor:"#f8f9fa",borderColor:"#dadce0",boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.1)"}},children:[t.jsx(o.Chip,{label:`L${Y+1}`,size:"small",sx:{width:40,height:28,fontWeight:600,fontSize:"0.75rem",bgcolor:"#1967d2",color:"#ffffff",boxShadow:"0 1px 2px 0 rgba(25, 103, 210, 0.3)"}}),t.jsxs(o.Box,{sx:{flex:1},children:[t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:500,fontSize:"0.875rem",color:"#3c4043"},children:R.column}),t.jsx(o.Typography,{variant:"caption",sx:{fontSize:"0.75rem",color:"#5f6368"},children:_==null?void 0:_.type.toUpperCase()})]}),t.jsxs(o.Stack,{direction:"row",spacing:.5,children:[t.jsx(o.IconButton,{size:"small",onClick:()=>k(Y,"up"),disabled:Y===0,sx:{color:"#5f6368","&:hover":{bgcolor:"#f1f3f4"},"&.Mui-disabled":{color:"#e8eaed"}},children:t.jsx(w.KeyboardArrowUp,{sx:{fontSize:18}})}),t.jsx(o.IconButton,{size:"small",onClick:()=>k(Y,"down"),disabled:Y===a.levels.length-1,sx:{color:"#5f6368","&:hover":{bgcolor:"#f1f3f4"},"&.Mui-disabled":{color:"#e8eaed"}},children:t.jsx(w.KeyboardArrowDown,{sx:{fontSize:18}})}),t.jsx(o.IconButton,{size:"small",onClick:()=>p(Y),sx:{color:"#5f6368","&:hover":{bgcolor:"#f1f3f4",color:"#1967d2"}},children:t.jsx(w.Edit,{sx:{fontSize:18}})}),t.jsx(o.IconButton,{size:"small",onClick:()=>C(Y),sx:{color:"#5f6368","&:hover":{bgcolor:"rgba(217, 48, 37, 0.08)",color:"#d93025"}},children:t.jsx(w.Delete,{sx:{fontSize:18}})})]})]},Y)})})]})]})}),t.jsxs(o.Box,{sx:{px:3,py:2,borderTop:"1px solid #e8eaed",display:"flex",gap:1.5,justifyContent:"flex-end",flexShrink:0,bgcolor:"#f8f9fa"},children:[t.jsx(o.Button,{onClick:i,variant:"text",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,color:"#5f6368",px:3,py:1,minHeight:36,borderRadius:"4px",transition:"all 0.2s ease","&:hover":{bgcolor:"#e8eaed",color:"#202124"}},children:"Cancel"}),t.jsx(o.Button,{onClick:A,variant:"contained",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,bgcolor:"#1967d2",color:"#ffffff",px:3,py:1,minHeight:36,borderRadius:"4px",boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15)",transition:"all 0.2s ease","&:hover":{bgcolor:"#1557b0",boxShadow:"0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15)"},"&:active":{boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3)",transform:"translateY(1px)"}},children:"Apply grouping"})]})]})})}const Wc={filters:w.FilterList,sorting:w.UnfoldMore,visibility:w.Visibility,order:w.ViewColumn,widths:w.Straighten,grouping:w.Layers};function _c({changes:e,onClose:r}){const n=i=>({filters:"primary",sorting:"secondary",visibility:"success",order:"warning",widths:"info",grouping:"error"})[i]||"default";return t.jsxs(o.Dialog,{open:!0,onClose:r,maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{mt:8,borderRadius:"12px",boxShadow:"0 8px 16px 4px rgba(60, 64, 67, 0.12), 0 4px 16px 0px rgba(60, 64, 67, 0.08), 0 0 0 1px rgba(60, 64, 67, 0.05)"}},children:[t.jsxs(o.DialogTitle,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",pb:1},children:["View Changes Summary",t.jsx(o.IconButton,{onClick:r,size:"small",sx:{color:"text.secondary"},children:t.jsx(w.Close,{sx:{fontSize:20}})})]}),t.jsx(o.DialogContent,{dividers:!0,children:e.length===0?t.jsx(o.Box,{sx:{textAlign:"center",py:4},children:t.jsx(o.Typography,{variant:"body2",color:"text.secondary",children:"No changes detected"})}):t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"The following modifications have been made to this view:"}),t.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:e.map((i,a)=>{const l=Wc[i.category];return t.jsxs(o.Paper,{elevation:0,sx:{display:"flex",gap:1.5,p:1.5,border:1,borderColor:"divider",borderRadius:1},children:[t.jsx(o.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,borderRadius:1,bgcolor:`${n(i.category)}.lighter`,color:`${n(i.category)}.main`,flexShrink:0},children:t.jsx(l,{sx:{fontSize:16}})}),t.jsxs(o.Box,{sx:{flex:1,minWidth:0},children:[t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:500},children:i.label}),t.jsx(o.Typography,{variant:"caption",color:"text.secondary",children:i.description})]})]},a)})})]})}),t.jsx(o.DialogActions,{sx:{px:3,py:1.75,borderTop:"1px solid #e8eaed",bgcolor:"#f8f9fa",gap:1.25,justifyContent:"flex-end"},children:t.jsx(o.Button,{onClick:r,variant:"contained",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,bgcolor:"#1967d2",color:"#ffffff",px:3,py:.875,minHeight:36,borderRadius:"4px",boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15)",transition:"all 0.2s ease","&:hover":{bgcolor:"#1557b0",boxShadow:"0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15)"},"&:active":{boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3)",transform:"translateY(1px)"}},children:"Close"})})]})}function $c({viewName:e,isDefaultView:r,changes:n=[],onSaveToCurrentView:i,onSaveAsNewView:a,onCancel:l}){const[c,d]=u.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsx(o.Box,{sx:{width:"100%",flexShrink:0,bgcolor:"#e8f0fe",borderBottom:"1px solid #d3e3fd",zIndex:10},children:t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:3,py:1.25},children:[t.jsxs(o.Typography,{variant:"body2",sx:{fontWeight:400,fontSize:"0.875rem",color:"#3c4043"},children:['Unsaved changes to "',e,'"']}),t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[t.jsx(o.Button,{onClick:l,variant:"text",size:"small",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,px:2,py:.625,borderRadius:"18px",color:"#5f6368",bgcolor:"transparent",minHeight:32,"&:hover":{bgcolor:"rgba(60, 64, 67, 0.08)",color:"#202124"}},children:"Discard"}),t.jsx(o.Button,{onClick:a,variant:"contained",size:"small",disableElevation:!0,sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,px:2.5,py:.625,borderRadius:"18px",bgcolor:"#0b57d0",color:"#fff",minHeight:32,boxShadow:"none","&:hover":{bgcolor:"#0842a0",boxShadow:"0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px rgba(60, 64, 67, 0.15)"}},children:"Save as new view"})]})]})}),c&&t.jsx(_c,{changes:n,onClose:()=>d(!1)})]})}function Fc({onExportAnyway:e,onSaveAndExport:r,onCancel:n}){return t.jsx(o.Box,{sx:{mb:2,mx:3,mt:2},children:t.jsxs(o.Alert,{severity:"warning",icon:t.jsx(w.Warning,{sx:{fontSize:20}}),action:t.jsx(o.IconButton,{size:"small",onClick:n,sx:{color:"warning.main"},children:t.jsx(w.Close,{sx:{fontSize:20}})}),sx:{alignItems:"flex-start"},children:[t.jsx(o.Typography,{variant:"subtitle2",sx:{fontWeight:600,mb:.5},children:"You are exporting with unsaved view changes"}),t.jsx(o.Typography,{variant:"body2",sx:{mb:1.5},children:"Your current view has unsaved changes. Choose how to proceed:"}),t.jsxs(o.Box,{sx:{display:"flex",gap:1},children:[t.jsx(o.Button,{onClick:r,variant:"contained",color:"primary",startIcon:t.jsx(w.Save,{sx:{fontSize:14}}),size:"small",children:"Save View & Export"}),t.jsx(o.Button,{onClick:e,variant:"contained",color:"warning",startIcon:t.jsx(w.Download,{sx:{fontSize:14}}),size:"small",children:"Export Anyway"})]})]})})}function Vc({auditHistory:e,onClose:r}){const[n,i]=u.useState(new Set),a=c=>{i(d=>{const f=new Set(d);return f.has(c)?f.delete(c):f.add(c),f})},l=[...e].sort((c,d)=>new Date(d.timestamp).getTime()-new Date(c.timestamp).getTime());return t.jsx(o.Box,{onClick:r,sx:{position:"fixed",top:0,left:0,right:0,bottom:0,bgcolor:"rgba(0, 0, 0, 0.4)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1300,animation:"fadeIn 0.225s cubic-bezier(0.4, 0, 0.2, 1)","@keyframes fadeIn":{from:{opacity:0},to:{opacity:1}}},children:t.jsxs(o.Paper,{onClick:c=>c.stopPropagation(),elevation:0,sx:{position:"relative",width:680,maxWidth:"calc(100vw - 120px)",maxHeight:"min(720px, calc(100vh - 280px))",display:"flex",flexDirection:"column",borderRadius:"12px",bgcolor:"#ffffff",outline:"none",boxShadow:"0 8px 16px 4px rgba(60, 64, 67, 0.12), 0 4px 16px 0px rgba(60, 64, 67, 0.08), 0 0 0 1px rgba(60, 64, 67, 0.05)",animation:"slideIn 0.225s cubic-bezier(0.4, 0, 0.2, 1)","@keyframes slideIn":{from:{opacity:0,transform:"scale(0.95) translateY(-12px)"},to:{opacity:1,transform:"scale(1) translateY(0)"}}},children:[t.jsxs(o.Box,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",px:3,py:2,borderBottom:"1px solid #e8eaed",flexShrink:0},children:[t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"h6",sx:{fontSize:"1.125rem",fontWeight:500,color:"#202124",letterSpacing:"0",lineHeight:1.5},children:"Audit history"}),t.jsxs(o.Typography,{variant:"caption",sx:{fontSize:"0.8125rem",color:"#5f6368",mt:.5,display:"block"},children:[l.length," event",l.length!==1?"s":""," recorded"]})]}),t.jsx(o.IconButton,{onClick:r,size:"small",sx:{p:.75,color:"#5f6368",transition:"all 0.2s ease","&:hover":{bgcolor:"#f1f3f4",color:"#202124"}},children:t.jsx(w.Close,{sx:{fontSize:20}})})]}),t.jsx(o.Box,{sx:{flex:1,overflow:"auto",px:3,py:2.5,"&::-webkit-scrollbar":{width:8},"&::-webkit-scrollbar-track":{bgcolor:"transparent"},"&::-webkit-scrollbar-thumb":{bgcolor:"#dadce0",borderRadius:4,"&:hover":{bgcolor:"#bdc1c6"}}},children:l.length===0?t.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",py:8,textAlign:"center"},children:[t.jsx(w.AccessTime,{sx:{fontSize:64,color:"#e8eaed",mb:2}}),t.jsx(o.Typography,{variant:"body2",sx:{fontSize:"0.875rem",color:"#5f6368",mb:.5},children:"No audit events recorded yet"}),t.jsx(o.Typography,{variant:"caption",sx:{fontSize:"0.75rem",color:"#bdc1c6"},children:"Changes to this report will appear here"})]}):t.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:l.map(c=>{const d=n.has(c.id),f=hs(c.feature);return t.jsxs(o.Paper,{elevation:0,sx:{border:"1px solid #e8eaed",borderRadius:"8px",overflow:"hidden",transition:"all 0.2s ease","&:hover":{boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.1)",borderColor:"#dadce0"}},children:[t.jsxs(o.Box,{onClick:()=>a(c.id),sx:{px:2.5,py:1.75,display:"flex",alignItems:"center",gap:1.5,cursor:"pointer",bgcolor:"#ffffff",transition:"background-color 0.2s ease","&:hover":{bgcolor:"#f8f9fa"}},children:[t.jsx(o.Box,{sx:{flexShrink:0,color:"#5f6368",transition:"transform 0.2s ease",transform:"rotate(0deg)"},children:d?t.jsx(w.KeyboardArrowDown,{sx:{fontSize:20}}):t.jsx(w.ChevronRight,{sx:{fontSize:20}})}),t.jsx(o.Chip,{label:xs(c.feature),size:"small",sx:{height:24,fontSize:"0.6875rem",fontWeight:600,bgcolor:`${f}15`,color:f,border:`1px solid ${f}30`,"& .MuiChip-label":{px:1}}}),t.jsx(o.Typography,{variant:"body2",sx:{flex:1,fontWeight:400,fontSize:"0.875rem",color:"#3c4043"},children:ps(c.action)}),t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75,flexShrink:0},children:[t.jsx(w.AccessTime,{sx:{fontSize:16,color:"#5f6368",opacity:.6}}),t.jsx(o.Typography,{variant:"caption",sx:{fontSize:"0.75rem",color:"#5f6368"},children:ms(c.timestamp)})]}),c.user&&t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75,flexShrink:0},children:[t.jsx(w.Person,{sx:{fontSize:16,color:"#5f6368",opacity:.6}}),t.jsx(o.Typography,{variant:"caption",sx:{fontSize:"0.75rem",color:"#5f6368"},children:c.user})]})]}),t.jsx(o.Collapse,{in:d,timeout:200,children:t.jsxs(o.Box,{sx:{px:2.5,pb:2,pt:1.5,borderTop:"1px solid #e8eaed",bgcolor:"#f8f9fa"},children:[c.previousState&&t.jsxs(o.Box,{sx:{mb:2},children:[t.jsx(o.Typography,{variant:"caption",sx:{fontWeight:600,fontSize:"0.6875rem",color:"#5f6368",textTransform:"uppercase",letterSpacing:"0.1em",mb:1,display:"block"},children:"Previous state"}),t.jsx(o.Box,{component:"pre",sx:{fontSize:"0.75rem",fontFamily:'"Roboto Mono", "Courier New", monospace',bgcolor:"#ffffff",border:"1px solid #dadce0",borderRadius:"4px",p:1.5,overflow:"auto",maxHeight:200,color:"#3c4043",lineHeight:1.6,"&::-webkit-scrollbar":{width:6,height:6},"&::-webkit-scrollbar-track":{bgcolor:"transparent"},"&::-webkit-scrollbar-thumb":{bgcolor:"#dadce0",borderRadius:3}},children:Io(c.previousState)})]}),c.newState&&t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"caption",sx:{fontWeight:600,fontSize:"0.6875rem",color:"#5f6368",textTransform:"uppercase",letterSpacing:"0.1em",mb:1,display:"block"},children:"New state"}),t.jsx(o.Box,{component:"pre",sx:{fontSize:"0.75rem",fontFamily:'"Roboto Mono", "Courier New", monospace',bgcolor:"#ffffff",border:"1px solid #dadce0",borderRadius:"4px",p:1.5,overflow:"auto",maxHeight:200,color:"#3c4043",lineHeight:1.6,"&::-webkit-scrollbar":{width:6,height:6},"&::-webkit-scrollbar-track":{bgcolor:"transparent"},"&::-webkit-scrollbar-thumb":{bgcolor:"#dadce0",borderRadius:3}},children:Io(c.newState)})]})]})})]},c.id)})})})]})})}function Nc({onSave:e,onClose:r}){const[n,i]=u.useState(""),[a,l]=u.useState(""),[c,d]=u.useState(""),[f,x]=u.useState([]),[m,b]=u.useState(""),[g,v]=u.useState(""),C=S=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(S),p=()=>{const S=c.trim();if(S){if(!C(S)){v("Please enter a valid email address");return}if(f.includes(S)){v("This email is already added");return}x([...f,S]),d(""),v("")}},T=S=>{x(f.filter(R=>R!==S))},s=S=>{S.key==="Enter"&&(S.preventDefault(),p())},k=()=>{if(!n.trim()){b("Preset name is required");return}e(n.trim(),a.trim(),f.length>0?f:void 0)},D=S=>{i(S),m&&b("")},A=S=>{d(S),g&&v("")};return t.jsx(o.Box,{onClick:r,sx:{position:"fixed",top:0,left:0,right:0,bottom:0,bgcolor:"rgba(0, 0, 0, 0.4)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1300,animation:"fadeIn 0.225s cubic-bezier(0.4, 0, 0.2, 1)","@keyframes fadeIn":{from:{opacity:0},to:{opacity:1}}},children:t.jsxs(o.Paper,{onClick:S=>S.stopPropagation(),elevation:0,sx:{position:"relative",width:540,maxWidth:"calc(100vw - 120px)",maxHeight:"min(480px, calc(100vh - 280px))",display:"flex",flexDirection:"column",borderRadius:"12px",bgcolor:"#ffffff",outline:"none",boxShadow:"0 8px 16px 4px rgba(60, 64, 67, 0.12), 0 4px 16px 0px rgba(60, 64, 67, 0.08), 0 0 0 1px rgba(60, 64, 67, 0.05)",animation:"slideIn 0.225s cubic-bezier(0.4, 0, 0.2, 1)","@keyframes slideIn":{from:{opacity:0,transform:"scale(0.95) translateY(-12px)"},to:{opacity:1,transform:"scale(1) translateY(0)"}}},children:[t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:3,py:2,borderBottom:"1px solid #e8eaed",flexShrink:0},children:[t.jsx(o.Typography,{variant:"h6",sx:{fontSize:"1.125rem",fontWeight:500,color:"#202124",letterSpacing:"0",lineHeight:1.5},children:"Create shareable preset"}),t.jsx(o.IconButton,{onClick:r,size:"small",sx:{p:.75,color:"#5f6368",transition:"all 0.2s ease","&:hover":{bgcolor:"#f1f3f4",color:"#202124"}},children:t.jsx(w.Close,{sx:{fontSize:20}})})]}),t.jsx(o.Box,{sx:{flex:1,overflow:"auto",px:3,py:2.5,"&::-webkit-scrollbar":{width:8},"&::-webkit-scrollbar-track":{bgcolor:"transparent"},"&::-webkit-scrollbar-thumb":{bgcolor:"#dadce0",borderRadius:4,"&:hover":{bgcolor:"#bdc1c6"}}},children:t.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:2.5},children:[t.jsx(o.Alert,{severity:"info",icon:t.jsx(w.Info,{sx:{fontSize:20}}),sx:{borderRadius:"8px",border:"1px solid #d2e3fc",bgcolor:"#e8f0fe","& .MuiAlert-icon":{color:"#1967d2"},"& .MuiAlert-message":{fontSize:"0.8125rem",color:"#3c4043",lineHeight:1.5}},children:"This preset will capture filters, sorting, grouping, column configuration, and the active view. The actual data is not saved or shared."}),t.jsx(o.Typography,{variant:"body2",sx:{fontSize:"0.875rem",color:"#5f6368",lineHeight:1.6},children:"Save the current report configuration and generate a shareable link that others can use to view the same filters, sorting, and column layout."}),t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"caption",sx:{fontSize:"0.6875rem",fontWeight:600,color:"#5f6368",letterSpacing:"0.1em",mb:1,display:"block",textTransform:"uppercase"},children:"Preset name *"}),t.jsx(o.TextField,{required:!0,value:n,onChange:S=>D(S.target.value),placeholder:"e.g., Q4 Active Users Report",error:!!m,helperText:m,autoFocus:!0,fullWidth:!0,size:"small",sx:{"& .MuiOutlinedInput-root":{fontSize:"0.875rem",borderRadius:"4px",bgcolor:"#ffffff","& fieldset":{borderColor:"#dadce0"},"&:hover fieldset":{borderColor:"#1967d2"},"&.Mui-focused fieldset":{borderColor:"#1967d2",borderWidth:"2px"},"&.Mui-error fieldset":{borderColor:"#d93025"}},"& .MuiInputBase-input":{py:1.25,color:"#3c4043"},"& .MuiFormHelperText-root":{fontSize:"0.75rem",color:"#d93025",mt:.75}}})]}),t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"caption",sx:{fontSize:"0.6875rem",fontWeight:600,color:"#5f6368",letterSpacing:"0.1em",mb:1,display:"block",textTransform:"uppercase"},children:"Description (optional)"}),t.jsx(o.TextField,{value:a,onChange:S=>l(S.target.value),placeholder:"Briefly describe what this preset shows...",multiline:!0,rows:3,fullWidth:!0,size:"small",sx:{"& .MuiOutlinedInput-root":{fontSize:"0.875rem",borderRadius:"4px",bgcolor:"#ffffff","& fieldset":{borderColor:"#dadce0"},"&:hover fieldset":{borderColor:"#1967d2"},"&.Mui-focused fieldset":{borderColor:"#1967d2",borderWidth:"2px"}},"& .MuiInputBase-input":{py:1.25,color:"#3c4043",lineHeight:1.6}}})]}),t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"caption",sx:{fontSize:"0.6875rem",fontWeight:600,color:"#5f6368",letterSpacing:"0.1em",mb:1,display:"block",textTransform:"uppercase"},children:"Share with (optional)"}),t.jsxs(o.Box,{sx:{display:"flex",gap:1,alignItems:"flex-start"},children:[t.jsx(o.TextField,{value:c,onChange:S=>A(S.target.value),onKeyPress:s,placeholder:"Enter email address",error:!!g,helperText:g,fullWidth:!0,size:"small",InputProps:{startAdornment:t.jsx(w.Email,{sx:{fontSize:18,color:"#5f6368",mr:1}})},sx:{"& .MuiOutlinedInput-root":{fontSize:"0.875rem",borderRadius:"4px",bgcolor:"#ffffff","& fieldset":{borderColor:"#dadce0"},"&:hover fieldset":{borderColor:"#1967d2"},"&.Mui-focused fieldset":{borderColor:"#1967d2",borderWidth:"2px"},"&.Mui-error fieldset":{borderColor:"#d93025"}},"& .MuiInputBase-input":{py:1.25,color:"#3c4043"},"& .MuiFormHelperText-root":{fontSize:"0.75rem",color:"#d93025",mt:.75}}}),t.jsx(o.Button,{onClick:p,variant:"outlined",startIcon:t.jsx(w.Add,{sx:{fontSize:18}}),sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,color:"#1967d2",borderColor:"#dadce0",px:2,py:1.25,minHeight:40,borderRadius:"4px",flexShrink:0,"&:hover":{borderColor:"#1967d2",bgcolor:"#f8f9fa"}},children:"Add"})]}),f.length>0&&t.jsx(o.Box,{sx:{display:"flex",flexWrap:"wrap",gap:1,mt:1.5},children:f.map(S=>t.jsx(o.Chip,{label:S,onDelete:()=>T(S),deleteIcon:t.jsx(w.Delete,{sx:{fontSize:16}}),sx:{bgcolor:"#e8f0fe",color:"#1967d2",fontSize:"0.8125rem",height:28,"& .MuiChip-deleteIcon":{color:"#1967d2","&:hover":{color:"#1557b0"}}}},S))}),t.jsx(o.Typography,{variant:"caption",sx:{fontSize:"0.75rem",color:"#5f6368",mt:1,display:"block",lineHeight:1.5},children:f.length>0?`An email with the shareable link will be sent to ${f.length} recipient${f.length>1?"s":""}`:"Add email addresses to send the shareable link automatically"})]})]})}),t.jsxs(o.Box,{sx:{px:3,py:2,borderTop:"1px solid #e8eaed",display:"flex",gap:1.5,justifyContent:"flex-end",flexShrink:0,bgcolor:"#f8f9fa"},children:[t.jsx(o.Button,{onClick:r,variant:"text",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,color:"#5f6368",px:3,py:1,minHeight:36,borderRadius:"4px",transition:"all 0.2s ease","&:hover":{bgcolor:"#e8eaed",color:"#202124"}},children:"Cancel"}),t.jsx(o.Button,{onClick:k,variant:"contained",startIcon:t.jsx(w.Share,{sx:{fontSize:18}}),sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,bgcolor:"#1967d2",color:"#ffffff",px:3,py:1,minHeight:36,borderRadius:"4px",boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15)",transition:"all 0.2s ease","&:hover":{bgcolor:"#1557b0",boxShadow:"0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15)"},"&:active":{boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3)",transform:"translateY(1px)"}},children:"Create & share"})]})]})})}function Lc({presetName:e,shareUrl:r,onCopyLink:n,onOpenPreset:i,onDeletePreset:a,onClose:l}){const[c,d]=u.useState(!1),f=()=>{n(),d(!0),setTimeout(()=>d(!1),2e3)};return t.jsx(o.Box,{onClick:l,sx:{position:"fixed",top:0,left:0,right:0,bottom:0,bgcolor:"rgba(0, 0, 0, 0.4)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1300,animation:"fadeIn 0.225s cubic-bezier(0.4, 0, 0.2, 1)","@keyframes fadeIn":{from:{opacity:0},to:{opacity:1}}},children:t.jsxs(o.Paper,{onClick:x=>x.stopPropagation(),elevation:0,sx:{position:"relative",width:580,maxWidth:"calc(100vw - 120px)",maxHeight:"min(480px, calc(100vh - 280px))",display:"flex",flexDirection:"column",borderRadius:"12px",bgcolor:"#ffffff",outline:"none",boxShadow:"0 8px 16px 4px rgba(60, 64, 67, 0.12), 0 4px 16px 0px rgba(60, 64, 67, 0.08), 0 0 0 1px rgba(60, 64, 67, 0.05)",animation:"slideIn 0.225s cubic-bezier(0.4, 0, 0.2, 1)","@keyframes slideIn":{from:{opacity:0,transform:"scale(0.95) translateY(-12px)"},to:{opacity:1,transform:"scale(1) translateY(0)"}}},children:[t.jsxs(o.Box,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",px:3,py:2,borderBottom:"1px solid #e8eaed",flexShrink:0},children:[t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"h6",sx:{fontSize:"1.125rem",fontWeight:500,color:"#202124",letterSpacing:"0",lineHeight:1.5},children:"Shareable link generated"}),t.jsxs(o.Typography,{variant:"caption",sx:{fontSize:"0.8125rem",color:"#5f6368",mt:.5,display:"block"},children:["Preset: ",e]})]}),t.jsx(o.IconButton,{onClick:l,size:"small",sx:{p:.75,color:"#5f6368",transition:"all 0.2s ease","&:hover":{bgcolor:"#f1f3f4",color:"#202124"}},children:t.jsx(w.Close,{sx:{fontSize:20}})})]}),t.jsx(o.Box,{sx:{flex:1,overflow:"auto",px:3,py:2.5,"&::-webkit-scrollbar":{width:8},"&::-webkit-scrollbar-track":{bgcolor:"transparent"},"&::-webkit-scrollbar-thumb":{bgcolor:"#dadce0",borderRadius:4,"&:hover":{bgcolor:"#bdc1c6"}}},children:t.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:2.5},children:[t.jsxs(o.Alert,{severity:"success",icon:t.jsx(w.Check,{sx:{fontSize:20}}),sx:{borderRadius:"8px",border:"1px solid #ceead6",bgcolor:"#e6f4ea","& .MuiAlert-icon":{color:"#188038"},"& .MuiAlert-message":{fontSize:"0.875rem",color:"#3c4043"}},children:[t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:500,fontSize:"0.875rem",color:"#3c4043",mb:.5},children:"Preset created successfully!"}),t.jsx(o.Typography,{variant:"body2",sx:{fontSize:"0.8125rem",color:"#5f6368",lineHeight:1.5},children:"Share the link below with anyone who needs access to this report configuration."})]}),t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"caption",sx:{fontSize:"0.6875rem",fontWeight:600,color:"#5f6368",letterSpacing:"0.1em",mb:1.5,display:"block",textTransform:"uppercase"},children:"Shareable URL"}),t.jsxs(o.Box,{sx:{display:"flex",gap:1.5},children:[t.jsx(o.TextField,{value:r,size:"small",fullWidth:!0,InputProps:{readOnly:!0},onClick:x=>x.target.select(),sx:{"& .MuiOutlinedInput-root":{fontSize:"0.8125rem",borderRadius:"4px",bgcolor:"#f8f9fa",fontFamily:'"Roboto Mono", "Courier New", monospace',"& fieldset":{borderColor:"#dadce0"},"&:hover fieldset":{borderColor:"#1967d2"},"&.Mui-focused fieldset":{borderColor:"#1967d2",borderWidth:"2px"}},"& .MuiInputBase-input":{py:1.25,color:"#1967d2",cursor:"pointer"}}}),t.jsx(o.Button,{onClick:f,variant:"contained",startIcon:c?t.jsx(w.Check,{sx:{fontSize:18}}):t.jsx(w.ContentCopy,{sx:{fontSize:18}}),sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,bgcolor:c?"#188038":"#1967d2",color:"#ffffff",px:3,py:1.25,minWidth:110,borderRadius:"4px",boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15)",transition:"all 0.2s ease","&:hover":{bgcolor:c?"#0d652d":"#1557b0",boxShadow:"0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15)"},"&:active":{boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3)",transform:"translateY(1px)"}},children:c?"Copied!":"Copy"})]})]}),t.jsxs(o.Box,{sx:{display:"flex",gap:1.5},children:[t.jsx(o.Button,{onClick:i,variant:"outlined",startIcon:t.jsx(w.OpenInNew,{sx:{fontSize:18}}),fullWidth:!0,sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,color:"#1967d2",borderColor:"#dadce0",py:1,borderRadius:"4px",transition:"all 0.2s ease","&:hover":{borderColor:"#1967d2",bgcolor:"#f8f9fa"}},children:"Open link"}),t.jsx(o.Button,{onClick:a,variant:"outlined",startIcon:t.jsx(w.Delete,{sx:{fontSize:18}}),fullWidth:!0,sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,color:"#d93025",borderColor:"#dadce0",py:1,borderRadius:"4px",transition:"all 0.2s ease","&:hover":{borderColor:"#d93025",bgcolor:"rgba(217, 48, 37, 0.04)"}},children:"Delete preset"})]})]})}),t.jsx(o.Box,{sx:{px:3,py:2,borderTop:"1px solid #e8eaed",display:"flex",gap:1.5,justifyContent:"flex-end",flexShrink:0,bgcolor:"#f8f9fa"},children:t.jsx(o.Button,{onClick:l,variant:"contained",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,bgcolor:"#1967d2",color:"#ffffff",px:3,py:1,minHeight:36,borderRadius:"4px",boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15)",transition:"all 0.2s ease","&:hover":{bgcolor:"#1557b0",boxShadow:"0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15)"},"&:active":{boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3)",transform:"translateY(1px)"}},children:"Done"})})]})})}function Hc({presetName:e,onClear:r}){return t.jsx(o.Chip,{icon:t.jsx(w.Link,{sx:{fontSize:14}}),label:t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:["Preset: ",t.jsx(o.Box,{component:"span",sx:{fontWeight:600},children:e})]}),onDelete:r,deleteIcon:t.jsx(o.IconButton,{size:"small",title:"Exit preset view",sx:{p:0},children:t.jsx(w.Close,{sx:{fontSize:14}})}),sx:{bgcolor:n=>ne(n.palette.primary.main,.12),borderColor:"primary.light",border:1,fontSize:"body2.fontSize",fontWeight:500,"& .MuiChip-deleteIcon":{color:"primary.main","&:hover":{color:"primary.main"}}}})}function Uc({presets:e,reportId:r,onOpenPreset:n,onCopyLink:i,onDeletePreset:a,onClose:l}){const[c,d]=u.useState(null),f=(m,b)=>{i(m,b),d(m),setTimeout(()=>d(null),2e3)},x=m=>new Date(m).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"});return t.jsx(o.Box,{onClick:l,sx:{position:"fixed",top:0,left:0,right:0,bottom:0,bgcolor:"rgba(0, 0, 0, 0.4)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1300,animation:"fadeIn 0.225s cubic-bezier(0.4, 0, 0.2, 1)","@keyframes fadeIn":{from:{opacity:0},to:{opacity:1}}},children:t.jsxs(o.Paper,{onClick:m=>m.stopPropagation(),elevation:0,sx:{position:"relative",width:680,maxWidth:"calc(100vw - 120px)",maxHeight:"min(720px, calc(100vh - 200px))",display:"flex",flexDirection:"column",borderRadius:"12px",bgcolor:"#ffffff",outline:"none",boxShadow:"0 8px 16px 4px rgba(60, 64, 67, 0.12), 0 4px 16px 0px rgba(60, 64, 67, 0.08), 0 0 0 1px rgba(60, 64, 67, 0.05)",animation:"slideIn 0.225s cubic-bezier(0.4, 0, 0.2, 1)","@keyframes slideIn":{from:{opacity:0,transform:"scale(0.95) translateY(-12px)"},to:{opacity:1,transform:"scale(1) translateY(0)"}}},children:[t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:3,py:2,borderBottom:"1px solid #e8eaed",flexShrink:0},children:[t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"h6",sx:{fontSize:"1.125rem",fontWeight:500,color:"#202124",letterSpacing:"0",lineHeight:1.5},children:"Manage Presets"}),t.jsxs(o.Typography,{variant:"caption",sx:{fontSize:"0.8125rem",color:"#5f6368",mt:.5,display:"block"},children:[e.length," saved ",e.length===1?"preset":"presets"]})]}),t.jsx(o.IconButton,{onClick:l,size:"small",sx:{p:.75,color:"#5f6368",transition:"all 0.2s ease","&:hover":{bgcolor:"#f1f3f4",color:"#202124"}},children:t.jsx(w.Close,{sx:{fontSize:20}})})]}),t.jsx(o.Box,{sx:{flex:1,overflow:"auto",px:3,py:2,"&::-webkit-scrollbar":{width:8},"&::-webkit-scrollbar-track":{bgcolor:"transparent"},"&::-webkit-scrollbar-thumb":{bgcolor:"#dadce0",borderRadius:4,"&:hover":{bgcolor:"#bdc1c6"}}},children:e.length===0?t.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",py:8},children:[t.jsx(w.Share,{sx:{fontSize:48,color:"#dadce0",mb:2}}),t.jsx(o.Typography,{variant:"body1",sx:{fontSize:"0.875rem",color:"#5f6368",textAlign:"center"},children:"No presets created yet"}),t.jsx(o.Typography,{variant:"body2",sx:{fontSize:"0.8125rem",color:"#80868b",textAlign:"center",mt:.5},children:"Create a preset to share report configurations"})]}):t.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:2},children:e.map(m=>t.jsxs(o.Paper,{elevation:0,sx:{p:2.5,border:"1px solid #e8eaed",borderRadius:"8px",bgcolor:"#ffffff",transition:"all 0.2s ease","&:hover":{borderColor:"#dadce0",boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.1), 0 1px 3px 1px rgba(60, 64, 67, 0.05)"}},children:[t.jsx(o.Box,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",mb:1.5},children:t.jsxs(o.Box,{sx:{flex:1,minWidth:0},children:[t.jsx(o.Typography,{variant:"h6",sx:{fontSize:"0.9375rem",fontWeight:500,color:"#202124",mb:.5},children:m.name}),m.description&&t.jsx(o.Typography,{variant:"body2",sx:{fontSize:"0.8125rem",color:"#5f6368",lineHeight:1.5},children:m.description})]})}),t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:1.5,mb:2},children:[t.jsx(o.Chip,{label:`Created ${x(m.createdAt)}`,size:"small",sx:{height:22,fontSize:"0.75rem",bgcolor:"#f1f3f4",color:"#5f6368","& .MuiChip-label":{px:1}}}),t.jsx(o.Chip,{label:`By ${m.createdBy}`,size:"small",sx:{height:22,fontSize:"0.75rem",bgcolor:"#f1f3f4",color:"#5f6368","& .MuiChip-label":{px:1}}})]}),t.jsx(o.Divider,{sx:{my:1.5,borderColor:"#f1f3f4"}}),t.jsxs(o.Box,{sx:{display:"flex",gap:1},children:[t.jsx(o.Button,{onClick:()=>n(m.id),variant:"outlined",size:"small",startIcon:t.jsx(w.OpenInNew,{sx:{fontSize:16}}),sx:{textTransform:"none",fontSize:"0.8125rem",fontWeight:500,color:"#1967d2",borderColor:"#dadce0",px:1.5,py:.75,borderRadius:"4px","&:hover":{borderColor:"#1967d2",bgcolor:"#f8f9fa"}},children:"Open"}),t.jsx(o.Button,{onClick:()=>f(m.id,m.name),variant:"outlined",size:"small",startIcon:c===m.id?t.jsx(w.Check,{sx:{fontSize:16}}):t.jsx(w.ContentCopy,{sx:{fontSize:16}}),sx:{textTransform:"none",fontSize:"0.8125rem",fontWeight:500,color:c===m.id?"#188038":"#5f6368",borderColor:"#dadce0",px:1.5,py:.75,borderRadius:"4px","&:hover":{borderColor:"#5f6368",bgcolor:"#f8f9fa"}},children:c===m.id?"Copied!":"Copy link"}),t.jsx(o.Button,{onClick:()=>a(m.id,m.name),variant:"outlined",size:"small",startIcon:t.jsx(w.Delete,{sx:{fontSize:16}}),sx:{textTransform:"none",fontSize:"0.8125rem",fontWeight:500,color:"#d93025",borderColor:"#dadce0",px:1.5,py:.75,borderRadius:"4px","&:hover":{borderColor:"#d93025",bgcolor:"rgba(217, 48, 37, 0.04)"}},children:"Delete"})]})]},m.id))})}),t.jsx(o.Box,{sx:{px:3,py:1.75,borderTop:"1px solid #e8eaed",bgcolor:"#f8f9fa",gap:1.25,justifyContent:"flex-end",display:"flex"},children:t.jsx(o.Button,{onClick:l,variant:"contained",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,bgcolor:"#1967d2",color:"#ffffff",px:3,py:.875,minHeight:36,borderRadius:"4px",boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15)",transition:"all 0.2s ease","&:hover":{bgcolor:"#1557b0",boxShadow:"0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15)"},"&:active":{boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3)",transform:"translateY(1px)"}},children:"Close"})})]})})}function Gc({totalRows:e,visibleRows:r,hasGrouping:n,visibleColumnsCount:i,totalColumnsCount:a,onExport:l,onClose:c}){const[d,f]=u.useState("csv"),[x,m]=u.useState("visible"),[b,g]=u.useState("visible"),v=e>5e4,C=x==="visible"?r:e,p=b==="visible"?i:a,T=()=>{l({format:d,scope:x,columnScope:b}),c()},s={csv:"CSV",excel:"Excel (.xlsx)",json:"JSON"};return t.jsx(o.Box,{onClick:c,sx:{position:"fixed",top:0,left:0,right:0,bottom:0,bgcolor:"rgba(0, 0, 0, 0.4)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1300,animation:"fadeIn 0.225s cubic-bezier(0.4, 0, 0.2, 1)","@keyframes fadeIn":{from:{opacity:0},to:{opacity:1}}},children:t.jsxs(o.Paper,{onClick:k=>k.stopPropagation(),elevation:0,sx:{position:"relative",width:480,maxWidth:"calc(100vw - 120px)",maxHeight:"min(620px, calc(100vh - 280px))",display:"flex",flexDirection:"column",borderRadius:"12px",bgcolor:"#ffffff",outline:"none",boxShadow:"0 8px 16px 4px rgba(60, 64, 67, 0.12), 0 4px 16px 0px rgba(60, 64, 67, 0.08), 0 0 0 1px rgba(60, 64, 67, 0.05)",animation:"slideIn 0.225s cubic-bezier(0.4, 0, 0.2, 1)","@keyframes slideIn":{from:{opacity:0,transform:"scale(0.95) translateY(-12px)"},to:{opacity:1,transform:"scale(1) translateY(0)"}}},children:[t.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:3,py:2,borderBottom:"1px solid #e8eaed",flexShrink:0},children:[t.jsx(o.Typography,{variant:"h6",sx:{fontSize:"1.125rem",fontWeight:500,color:"#202124",letterSpacing:"0",lineHeight:1.5},children:"Export report"}),t.jsx(o.IconButton,{onClick:c,size:"small",sx:{p:.75,color:"#5f6368",transition:"all 0.2s ease","&:hover":{bgcolor:"#f1f3f4",color:"#202124"}},children:t.jsx(w.Close,{sx:{fontSize:20}})})]}),t.jsx(o.Box,{sx:{flex:1,overflow:"auto",px:3,py:2.5,"&::-webkit-scrollbar":{width:8},"&::-webkit-scrollbar-track":{bgcolor:"transparent"},"&::-webkit-scrollbar-thumb":{bgcolor:"#dadce0",borderRadius:4,"&:hover":{bgcolor:"#bdc1c6"}}},children:t.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:2.5},children:[v&&t.jsxs(o.Alert,{severity:"warning",icon:t.jsx(w.Warning,{sx:{fontSize:20}}),sx:{borderRadius:"8px",border:"1px solid #fdd663",bgcolor:"#fef7e0","& .MuiAlert-icon":{color:"#ea8600"},"& .MuiAlertTitle-root":{fontSize:"0.875rem",fontWeight:500,color:"#3c4043",mb:.5},"& .MuiAlert-message":{fontSize:"0.8125rem",color:"#5f6368"}},children:[t.jsx(o.AlertTitle,{children:"Large dataset warning"}),"This export contains over 50,000 rows. Processing may take a few moments."]}),t.jsxs(o.FormControl,{component:"fieldset",children:[t.jsx(o.FormLabel,{component:"legend",sx:{fontSize:"0.6875rem",fontWeight:600,color:"#5f6368",letterSpacing:"0.1em",mb:1.5,textTransform:"uppercase"},children:"Format"}),t.jsxs(o.RadioGroup,{value:d,onChange:k=>f(k.target.value),children:[t.jsx(o.FormControlLabel,{value:"csv",control:t.jsx(o.Radio,{size:"small",sx:{color:"#5f6368","&.Mui-checked":{color:"#1967d2"}}}),label:t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:500,fontSize:"0.875rem",color:"#3c4043"},children:"CSV"}),t.jsx(o.Typography,{variant:"caption",sx:{fontSize:"0.75rem",color:"#5f6368"},children:"Comma-separated values, compatible with Excel"})]}),sx:{mb:1.25,alignItems:"flex-start",px:1.5,py:1,borderRadius:"8px",transition:"background-color 0.2s ease","&:hover":{bgcolor:"#f8f9fa"}}}),t.jsx(o.FormControlLabel,{value:"excel",control:t.jsx(o.Radio,{size:"small",sx:{color:"#5f6368","&.Mui-checked":{color:"#1967d2"}}}),label:t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:500,fontSize:"0.875rem",color:"#3c4043"},children:"Excel (.xlsx)"}),t.jsx(o.Typography,{variant:"caption",sx:{fontSize:"0.75rem",color:"#5f6368"},children:"Native Excel format with formatting support"})]}),sx:{mb:1.25,alignItems:"flex-start",px:1.5,py:1,borderRadius:"8px",transition:"background-color 0.2s ease","&:hover":{bgcolor:"#f8f9fa"}}}),t.jsx(o.FormControlLabel,{value:"json",control:t.jsx(o.Radio,{size:"small",sx:{color:"#5f6368","&.Mui-checked":{color:"#1967d2"}}}),label:t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:500,fontSize:"0.875rem",color:"#3c4043"},children:"JSON"}),t.jsx(o.Typography,{variant:"caption",sx:{fontSize:"0.75rem",color:"#5f6368"},children:"Structured data with metadata and filters"})]}),sx:{alignItems:"flex-start",px:1.5,py:1,borderRadius:"8px",transition:"background-color 0.2s ease","&:hover":{bgcolor:"#f8f9fa"}}})]})]}),t.jsxs(o.FormControl,{component:"fieldset",children:[t.jsx(o.FormLabel,{component:"legend",sx:{fontSize:"0.6875rem",fontWeight:600,color:"#5f6368",letterSpacing:"0.1em",mb:1.5,textTransform:"uppercase"},children:"Rows"}),t.jsxs(o.RadioGroup,{value:x,onChange:k=>m(k.target.value),children:[t.jsx(o.FormControlLabel,{value:"visible",control:t.jsx(o.Radio,{size:"small",sx:{color:"#5f6368","&.Mui-checked":{color:"#1967d2"}}}),label:t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:500,fontSize:"0.875rem",color:"#3c4043"},children:"Visible rows"}),t.jsxs(o.Typography,{variant:"caption",sx:{fontSize:"0.75rem",color:"#5f6368"},children:["Export ",r.toLocaleString()," rows (filtered and searched)"]})]}),sx:{mb:1.25,alignItems:"flex-start",px:1.5,py:1,borderRadius:"8px",transition:"background-color 0.2s ease","&:hover":{bgcolor:"#f8f9fa"}}}),t.jsx(o.FormControlLabel,{value:"all",control:t.jsx(o.Radio,{size:"small",sx:{color:"#5f6368","&.Mui-checked":{color:"#1967d2"}}}),label:t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:500,fontSize:"0.875rem",color:"#3c4043"},children:"All rows"}),t.jsxs(o.Typography,{variant:"caption",sx:{fontSize:"0.75rem",color:"#5f6368"},children:["Export ",e.toLocaleString()," rows (complete original dataset)"]})]}),sx:{alignItems:"flex-start",px:1.5,py:1,borderRadius:"8px",transition:"background-color 0.2s ease","&:hover":{bgcolor:"#f8f9fa"}}})]})]}),t.jsxs(o.FormControl,{component:"fieldset",children:[t.jsx(o.FormLabel,{component:"legend",sx:{fontSize:"0.6875rem",fontWeight:600,color:"#5f6368",letterSpacing:"0.1em",mb:1.5,textTransform:"uppercase"},children:"Columns"}),t.jsxs(o.RadioGroup,{value:b,onChange:k=>g(k.target.value),children:[t.jsx(o.FormControlLabel,{value:"visible",control:t.jsx(o.Radio,{size:"small",sx:{color:"#5f6368","&.Mui-checked":{color:"#1967d2"}}}),label:t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:500,fontSize:"0.875rem",color:"#3c4043"},children:"Visible columns only"}),t.jsxs(o.Typography,{variant:"caption",sx:{fontSize:"0.75rem",color:"#5f6368"},children:["Export ",i," visible columns"]})]}),sx:{mb:1.25,alignItems:"flex-start",px:1.5,py:1,borderRadius:"8px",transition:"background-color 0.2s ease","&:hover":{bgcolor:"#f8f9fa"}}}),t.jsx(o.FormControlLabel,{value:"all",control:t.jsx(o.Radio,{size:"small",sx:{color:"#5f6368","&.Mui-checked":{color:"#1967d2"}}}),label:t.jsxs(o.Box,{children:[t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:500,fontSize:"0.875rem",color:"#3c4043"},children:"All columns"}),t.jsxs(o.Typography,{variant:"caption",sx:{fontSize:"0.75rem",color:"#5f6368"},children:["Export all ",a," columns (including hidden)"]})]}),sx:{alignItems:"flex-start",px:1.5,py:1,borderRadius:"8px",transition:"background-color 0.2s ease","&:hover":{bgcolor:"#f8f9fa"}}})]})]}),t.jsxs(o.Box,{sx:{pt:1},children:[t.jsx(o.Divider,{sx:{mb:2,borderColor:"#e8eaed"}}),t.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1.25},children:[t.jsxs(o.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[t.jsx(o.Typography,{variant:"body2",sx:{fontSize:"0.875rem",color:"#5f6368"},children:"Format:"}),t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:500,fontSize:"0.875rem",color:"#3c4043"},children:s[d]})]}),t.jsxs(o.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[t.jsx(o.Typography,{variant:"body2",sx:{fontSize:"0.875rem",color:"#5f6368"},children:"Rows to export:"}),t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:500,fontSize:"0.875rem",color:"#3c4043"},children:C.toLocaleString()})]}),t.jsxs(o.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[t.jsx(o.Typography,{variant:"body2",sx:{fontSize:"0.875rem",color:"#5f6368"},children:"Columns to export:"}),t.jsx(o.Typography,{variant:"body2",sx:{fontWeight:500,fontSize:"0.875rem",color:"#3c4043"},children:p})]})]})]})]})}),t.jsxs(o.Box,{sx:{px:3,py:2,borderTop:"1px solid #e8eaed",display:"flex",gap:1.5,justifyContent:"flex-end",flexShrink:0,bgcolor:"#f8f9fa"},children:[t.jsx(o.Button,{onClick:c,variant:"text",sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,color:"#5f6368",px:3,py:1,minHeight:36,borderRadius:"4px",transition:"all 0.2s ease","&:hover":{bgcolor:"#e8eaed",color:"#202124"}},children:"Cancel"}),t.jsxs(o.Button,{onClick:T,variant:"contained",startIcon:t.jsx(w.Download,{sx:{fontSize:18}}),sx:{textTransform:"none",fontSize:"0.875rem",fontWeight:500,bgcolor:"#1967d2",color:"#ffffff",px:3,py:1,minHeight:36,borderRadius:"4px",boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15)",transition:"all 0.2s ease","&:hover":{bgcolor:"#1557b0",boxShadow:"0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15)"},"&:active":{boxShadow:"0 1px 2px 0 rgba(60, 64, 67, 0.3)",transform:"translateY(1px)"}},children:["Download ",s[d]]})]})]})})}function Yc({warning:e,onDismiss:r}){return t.jsx(o.Box,{sx:{position:"fixed",top:16,right:16,zIndex:50,maxWidth:448},children:t.jsxs(o.Alert,{severity:"warning",icon:t.jsx(w.Warning,{sx:{fontSize:20}}),action:t.jsx(o.IconButton,{size:"small",onClick:r,sx:{color:"warning.main"},children:t.jsx(w.Close,{sx:{fontSize:16}})}),sx:{borderLeft:4,borderColor:"warning.main",boxShadow:3},children:[t.jsx(o.AlertTitle,{sx:{fontWeight:600},children:"Feature Limit Reached"}),t.jsx(o.Box,{sx:{fontSize:"body2.fontSize",mb:1},children:e.message}),t.jsxs(o.Box,{sx:{fontSize:"caption.fontSize",opacity:.9},children:["Please remove some ",e.type==="filter"?"filters":e.type==="sort"?"sort levels":"grouping levels"," before adding more."]})]})})}function qc({error:e,onDismiss:r,autoDismiss:n=!0,autoDismissDelay:i=5e3}){u.useEffect(()=>{if(n){const d=setTimeout(()=>{r()},i);return()=>clearTimeout(d)}},[n,i,r]);const l=(()=>{switch(e.type){case"system":return{severity:"error",icon:t.jsx(w.Cancel,{sx:{fontSize:20}})};case"processing":return{severity:"warning",icon:t.jsx(w.Warning,{sx:{fontSize:20}})};case"ui":default:return{severity:"info",icon:t.jsx(w.InfoOutlined,{sx:{fontSize:20}})}}})(),c=Is(e);return t.jsx(o.Box,{sx:{position:"fixed",top:16,right:16,zIndex:50,maxWidth:448},children:t.jsxs(o.Alert,{severity:l.severity,icon:l.icon,action:t.jsx(o.IconButton,{size:"small",onClick:r,sx:{color:`${l.severity}.main`},children:t.jsx(w.Close,{sx:{fontSize:16}})}),sx:{borderLeft:4,borderColor:`${l.severity}.main`,boxShadow:3},children:[t.jsxs(o.AlertTitle,{sx:{fontWeight:600},children:[e.context.charAt(0).toUpperCase()+e.context.slice(1)," Error"]}),t.jsx(o.Box,{sx:{fontSize:"body2.fontSize"},children:c}),e.details&&process.env.NODE_ENV==="development"&&t.jsx(o.Box,{component:"pre",sx:{fontSize:"caption.fontSize",mt:1,fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:JSON.stringify(e.details,null,2)})]})})}class Jc extends u.Component{constructor(r){super(r),this.handleReset=()=>{this.setState({hasError:!1,error:null})},this.state={hasError:!1,error:null}}static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,n){console.error("[ErrorBoundary] Caught error:",r,n),this.props.onError&&this.props.onError(r,n)}render(){var r,n;return this.state.hasError?this.props.fallback?this.props.fallback:t.jsx(o.Paper,{sx:{bgcolor:i=>ne(i.palette.error.main,.12),border:1,borderColor:"error.light",borderRadius:2,p:3,m:2},children:t.jsxs(o.Box,{sx:{display:"flex",alignItems:"flex-start",gap:1.5},children:[t.jsx(w.Warning,{color:"error",sx:{fontSize:24,flexShrink:0}}),t.jsxs(o.Box,{sx:{flex:1},children:[t.jsx(o.Typography,{variant:"h6",sx:{color:"error.main",fontWeight:600},children:this.props.context?`${this.props.context} Error`:"Something went wrong"}),t.jsx(o.Typography,{variant:"body2",sx:{color:"error.main",mt:1},children:((r=this.state.error)==null?void 0:r.message)||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&t.jsx(o.Box,{component:"pre",sx:{mt:1.5,fontSize:"caption.fontSize",color:"error.main",bgcolor:i=>ne(i.palette.error.main,.12),p:1.5,borderRadius:1,overflow:"auto",maxHeight:160},children:(n=this.state.error)==null?void 0:n.stack}),t.jsx(o.Button,{onClick:this.handleReset,variant:"contained",color:"error",startIcon:t.jsx(w.Refresh,{sx:{fontSize:16}}),sx:{mt:2},children:"Try Again"})]})]})}):this.props.children}}function ar({children:e,feature:r,onError:n}){return t.jsx(Jc,{context:r,onError:(i,a)=>{n&&n(i)},fallback:t.jsxs(o.Alert,{severity:"warning",sx:{m:1},icon:t.jsx(w.Warning,{sx:{fontSize:20}}),children:[t.jsxs(o.AlertTitle,{children:[r," temporarily unavailable"]}),"Other features continue to work normally"]}),children:e})}function qn({reportEngine:e}){var mr,gr;const{activeReport:r,paginatedData:n,processedData:i,tableMetrics:a,tableEngine:l,activeView:c,isDirty:d,currentTableState:f,viewChanges:x,showFilterPanel:m,setShowFilterPanel:b,filterFocusColumn:g,handleAddFilter:v,handleUpdateFilter:C,handleRemoveFilter:p,handleClearAllFilters:T,handleOpenFilterForColumn:s,handleCloseFilterPanel:k,handleClearFiltersForColumn:D,showSortPanel:A,setShowSortPanel:S,handleSort:R,handleUpdateSortStack:Y,handleSortAscending:_,handleSortDescending:K,showManageViews:V,setShowManageViews:te,showCreateViewModal:h,setShowCreateViewModal:F,showEditViewModal:W,setShowEditViewModal:E,showDeleteConfirmation:H,setShowDeleteConfirmation:de,editingView:ue,deletingView:Be,handleSelectView:O,handleCreateView:N,handleUpdateCurrentView:Q,handleSaveAsNewView:X,handleRevertChanges:Z,handleToggleDefault:re,handleToggleFavorite:J,handleSoftDelete:q,handleRestoreView:oe,handlePermanentDelete:ie,handleEditView:se,handleSaveEditView:ve,handleConfirmDelete:$,showManageColumns:De,setShowManageColumns:Ae,handleUpdateColumnVisibility:et,handleUpdateColumnOrder:tt,handleUpdateColumnWidth:Fe,handleResetColumnLayout:Le,showGroupPanel:Me,setShowGroupPanel:ft,handleGroup:At,handleToggleGroupCollapse:pt,searchQuery:xt,searchHistory:ht,handleSearchChange:rt,handleAddToSearchHistory:Rt,handleToggleSearchFavourite:ot,handleDeleteSearchHistory:Gt,selectedRowIds:kt,handleToggleRowSelection:Te,handleToggleAllRows:nt,handleRangeSelection:qe,handleClearSelection:it,currentPage:Mt,pageSize:mt,paginationEngine:Je,handlePageChange:hr,handlePageSizeChange:Tt,isExporting:Yt,showExportModal:Pt,setShowExportModal:zt,showDirtyExportWarning:gt,handleExport:ye,handleExportWithConfig:qt,handleExportSelected:Jt,handleExportAnyway:Ke,handleSaveAndExport:P,handleCancelExport:He,showAuditHistory:le,setShowAuditHistory:Oe,showCreatePreset:fe,setShowCreatePreset:Ue,showShareLink:bt,setShowShareLink:Pe,showManagePresets:Kt,setShowManagePresets:Wt,generatedPreset:je,activePreset:U,handleOpenSharePreset:st,handleOpenManagePresets:We,handleCreatePreset:Xt,handleCopyPresetLink:Qt,handleOpenPreset:Zt,handleDeletePreset:er,handleClearActivePreset:tr,handleOpenPresetById:rr,handleCopyPresetLinkById:_t,handleDeletePresetById:_e,isViewerRole:Et,userRole:or,featureLimitWarning:at,setFeatureLimitWarning:nr,reportError:It,setReportError:M,handleError:L,updateReport:ae,showSnack:$e}=e,ce=u.useCallback((ze,Ie)=>{if(!(r!=null&&r.uploadedData))return;const yt=[...r.uploadedData];yt[ze]=Ie,ae(r.id,{uploadedData:yt})},[r,ae]),Bt=u.useCallback(ze=>{if(!(r!=null&&r.uploadedData))return;const Ie=r.uploadedData.filter((yt,Hr)=>Hr!==ze);ae(r.id,{uploadedData:Ie})},[r,ae]),Lr=u.useCallback((ze,Ie)=>{if(!(r!=null&&r.uploadedData))return;const yt=[...r.uploadedData];yt.splice(ze+1,0,{...Ie}),ae(r.id,{uploadedData:yt})},[r,ae]);return!r||!r.schemaLocked||!r.schema||!r.uploadedData||!r.views?null:t.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,overflow:"hidden",position:"relative"},children:[!Et&&d&&c&&t.jsx($c,{viewName:c.name,isDefaultView:c.isDefault,changes:x,onSaveToCurrentView:c.isDefault?void 0:Q,onSaveAsNewView:X,onCancel:Z}),t.jsxs(o.Box,{id:"table-content-area",sx:{flex:1,minHeight:0,overflow:"hidden",display:"flex",flexDirection:"column",position:"relative"},children:[at&&t.jsx(Yc,{warning:at,onDismiss:()=>nr(null)}),It&&t.jsx(qc,{error:It,onDismiss:()=>M(null)}),gt&&t.jsx(Fc,{onExportAnyway:Ke,onSaveAndExport:P,onCancel:He}),t.jsx(Ec,{schema:r.schema,data:n,sortStack:r.sortStack,filters:r.filters,views:r.views,activeViewId:r.activeViewId,isDirty:d,isExporting:Yt,columnVisibility:r.columnVisibility||(c==null?void 0:c.snapshot.columnVisibility),columnOrder:r.columnOrder||(c==null?void 0:c.snapshot.columnOrder),columnWidths:r.columnWidths||(c==null?void 0:c.snapshot.columnWidths),grouping:r.grouping,onSort:R,onSortAscending:_,onSortDescending:K,onOpenFilters:()=>b(!0),onOpenSort:()=>S(!0),onOpenFilterForColumn:s,onSelectView:O,onCreateView:()=>F(!0),onManageViews:()=>te(!0),onUpdateCurrentView:Q,onSaveAsNewView:X,onToggleDefault:re,onToggleFavorite:J,onRestoreView:oe,onPermanentDelete:ie,onExport:ye,onOpenColumns:()=>Ae(!0),onUpdateColumnWidth:Fe,onUpdateColumnOrder:tt,onUpdateColumnVisibility:et,onClearFiltersForColumn:D,onResetLayout:Le,onOpenGroup:()=>ft(!0),onToggleGroupCollapse:pt,onOpenAuditHistory:()=>Oe(!0),onOpenSharePreset:st,searchQuery:xt,searchHistory:ht,onAddToSearchHistory:Rt,onToggleSearchFavourite:ot,onDeleteSearchHistory:Gt,selectedRowIds:kt,onSearchChange:rt,onToggleRowSelection:Te,onToggleAllRows:nt,onRangeSelection:qe,onClearSelection:it,onExportSelected:Jt,currentPage:(Je==null?void 0:Je.currentPage)||Mt,pageSize:(Je==null?void 0:Je.pageSize)||mt,onPageChange:hr,onPageSizeChange:Tt,totalRowsBeforePagination:(a==null?void 0:a.searchedRows)||i.length,isReadOnly:Et,userRole:or,reportName:r.name,onEditRow:ce,onDeleteRow:Bt,onDuplicateRow:Lr})]}),m&&t.jsx(ar,{feature:"Filters",onError:ze=>{const Ie=ct("ui","filters",ze);L(Ie)},children:t.jsx(Ic,{schema:r.schema,filters:r.filters??[],onAddFilter:v,onUpdateFilter:C,onRemoveFilter:p,onClearAll:T,onClose:k,focusColumn:g})}),A&&t.jsx(ar,{feature:"Sorting",onError:ze=>{const Ie=ct("ui","sorting",ze);L(Ie)},children:t.jsx(Dc,{schema:r.schema,sortStack:r.sortStack??[],onUpdateSortStack:Y,onClose:()=>S(!1)})}),V&&t.jsx(ar,{feature:"Views",onError:ze=>{const Ie=ct("ui","views",ze);L(Ie)},children:t.jsx(Oc,{views:r.views,activeViewId:r.activeViewId??"",onSelectView:O,onCreateView:()=>{te(!1),F(!0)},onEditView:se,onDeleteView:q,onRestoreView:oe,onPermanentDelete:ie,onClose:()=>te(!1)})}),h&&f&&t.jsx(hn,{currentSnapshot:f,onSave:N,onClose:()=>F(!1)}),W&&ue&&t.jsx(hn,{currentSnapshot:ue.snapshot,onSave:ve,onClose:()=>{E(!1)},isEditMode:!0,initialName:ue.name,initialDescription:ue.description,initialIsDefault:ue.isDefault}),H&&Be&&t.jsx(Ac,{viewName:Be.name,onConfirm:$,onCancel:()=>{de(!1)}}),De&&c&&t.jsx(Mc,{schema:r.schema,columnVisibility:r.columnVisibility||c.snapshot.columnVisibility,columnOrder:r.columnOrder||c.snapshot.columnOrder,columnWidths:r.columnWidths||c.snapshot.columnWidths,views:r.views,activeViewId:r.activeViewId,onUpdateColumnVisibility:et,onUpdateColumnOrder:tt,onUpdateColumnWidth:Fe,onResetLayout:Le,onSelectView:ze=>{O(ze)},onSaveToCurrentView:()=>{Ae(!1)},onSaveToAllViews:()=>{if(c){const ze=r.views.map(Ie=>({...Ie,snapshot:{...Ie.snapshot,columnVisibility:c.snapshot.columnVisibility,columnOrder:c.snapshot.columnOrder,columnWidths:c.snapshot.columnWidths}}));ae(r.id,{views:ze}),$e("Column configuration applied to all views","success")}Ae(!1)},onClose:()=>Ae(!1)}),Me&&t.jsx(ar,{feature:"Grouping",onError:ze=>{const Ie=ct("ui","grouping",ze);L(Ie)},children:t.jsx(Pc,{schema:r.schema,grouping:r.grouping||null,onApply:At,onClose:()=>ft(!1)})}),le&&t.jsx(Vc,{auditHistory:r.auditHistory||[],onClose:()=>Oe(!1)}),fe&&t.jsx(Nc,{onSave:Xt,onClose:()=>Ue(!1)}),bt&&je&&t.jsx(Lc,{presetName:je.preset.name,shareUrl:je.url,onCopyLink:Qt,onOpenPreset:Zt,onDeletePreset:er,onClose:()=>{Pe(!1)}}),Kt&&t.jsx(Uc,{presets:r.presets||[],reportId:r.id,onOpenPreset:rr,onCopyLink:_t,onDeletePreset:_e,onClose:()=>Wt(!1)}),U&&t.jsx(o.Box,{sx:{mt:2},children:t.jsx(Hc,{presetName:U.name,onClear:tr})}),Pt&&t.jsx(ar,{feature:"Export",onError:ze=>{const Ie=ct("ui","export",ze);L(Ie)},children:t.jsx(Gc,{totalRows:(a==null?void 0:a.totalRows)||((mr=r.uploadedData)==null?void 0:mr.length)||0,visibleRows:(a==null?void 0:a.searchedRows)||i.length,visibleColumnsCount:((gr=l==null?void 0:l.columnEngine)==null?void 0:gr.visibleColumns.length)||r.schema.length,totalColumnsCount:r.schema.length,hasGrouping:(a==null?void 0:a.isGrouped)||!1,onExport:qt,onClose:()=>{zt(!1)}})})]})}function Jn({open:e,message:r,severity:n,onClose:i}){return t.jsx(o.Snackbar,{open:e,autoHideDuration:4e3,onClose:i,anchorOrigin:{vertical:"top",horizontal:"right"},children:t.jsx(o.Alert,{onClose:i,severity:n,variant:"filled",sx:{width:"100%",boxShadow:3},children:r})})}function Kn(){const e=co(),{reports:r,activeReportId:n,activeReport:i,uploadState:a,schema:l,hasSchemaConflicts:c,isModalOpen:d,setIsModalOpen:f,setActiveReportId:x,createReport:m,handleFileUpload:b,handleUploadError:g,handleRetry:v,handleConfirm:C,snack:p,handleSnackClose:T}=e;return t.jsxs(o.Box,{sx:{height:"100%",display:"flex",flexDirection:"column",overflow:"hidden"},children:[t.jsx(Ys,{onCreateReport:()=>f(!0)}),t.jsx(qs,{reports:r,activeReportId:n,onTabClick:x}),t.jsx(o.Box,{component:"main",sx:{flex:1,overflow:"hidden",display:"flex",flexDirection:"column",m:0,p:0},children:r.length===0?t.jsx(Un,{title:"No reports yet",description:"Create your first report to start analyzing your data."}):i?t.jsx(t.Fragment,{children:i.schemaLocked&&i.schema&&i.uploadedData&&i.views?t.jsx(qn,{reportEngine:e}):t.jsx(o.Box,{sx:{p:3},children:a==="preview"&&i.schema&&i.uploadedData?t.jsx(sc,{schema:i.schema,onConfirm:C,hasConflicts:c}):i.uploadError?t.jsx(ac,{error:i.uploadError,onRetry:v}):t.jsx(ic,{onFileUpload:b,onError:g,isUploading:a==="uploading"})})}):null}),t.jsx(oc,{isOpen:d,onClose:()=>f(!1),onCreate:m}),t.jsx(Jn,{open:p.open,message:p.message,severity:p.severity,onClose:T})]})}function Kc(){return t.jsx(lo,{children:t.jsx(Kn,{})})}function Xn(){const e=co(),{snack:r,handleSnackClose:n}=e;return t.jsxs(o.Box,{sx:{minHeight:"100vh"},children:[t.jsx(o.Box,{component:"main",children:e.activeReport?t.jsx(qn,{reportEngine:e}):t.jsx(Un,{title:"No report data",description:"This viewer requires report data to be loaded."})}),t.jsx(Jn,{open:r.open,message:r.message,severity:r.severity,onClose:n})]})}function Xc({data:e,autoLoad:r=!0,config:n}){return t.jsx(lo,{data:e,mode:"viewer",autoLoad:r,config:n,children:t.jsx(Xn,{})})}exports.URMBuilder=Kc;exports.URMBuilderRaw=Kn;exports.URMProvider=lo;exports.URMViewer=Xc;exports.URMViewerRaw=Xn;exports.useURMContext=co;