chordia-ui 4.0.8 → 5.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/DataTable2.cjs.js +1 -1
- package/dist/DataTable2.cjs.js.map +1 -1
- package/dist/DataTable2.es.js +760 -739
- package/dist/DataTable2.es.js.map +1 -1
- package/dist/IntegrationCard.cjs.js +1 -1
- package/dist/IntegrationCard.cjs.js.map +1 -1
- package/dist/IntegrationCard.es.js +11 -10
- package/dist/IntegrationCard.es.js.map +1 -1
- package/dist/components/data.cjs.js +1 -1
- package/dist/components/data.cjs.js.map +1 -1
- package/dist/components/data.es.js +25 -25
- package/dist/components/data.es.js.map +1 -1
- package/dist/components/notifications.cjs.js +1 -1
- package/dist/components/notifications.cjs.js.map +1 -1
- package/dist/components/notifications.es.js +6 -3
- package/dist/components/notifications.es.js.map +1 -1
- package/package.json +1 -1
- package/src/components/data/DataTable.jsx +1 -1
- package/src/components/data/DataTable2.jsx +42 -0
- package/src/components/layout/IntegrationCard.jsx +2 -1
- package/src/components/notifications/NotificationItem.jsx +3 -0
package/dist/DataTable2.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const n=require("react/jsx-runtime"),l=require("react"),H=require("./sortable.esm.cjs.js"),W=require("lucide-react"),yt=require("react-dom"),$t=require("./CustomFilterChips.cjs.js");require("motion/react");require("recharts");require("./AgentLiftAnalysisCard.cjs.js");require("./TourGuideTooltip.cjs.js");function Pt({dateRangePicker:s,onWeekToDate:a,exportConfig:u,filterChipsConfig:p,trailingActions:S}){const[b,c]=l.useState(!1),y=l.useRef(null),B=l.useRef(null);l.useEffect(()=>{const j=v=>{B.current&&!B.current.contains(v.target)&&y.current&&!y.current.contains(v.target)&&c(!1)};if(b)return document.addEventListener("mousedown",j),()=>{document.removeEventListener("mousedown",j)}},[b]);const F=()=>{c(j=>!j)},k=j=>{c(!1),u!=null&&u.onExport&&u.onExport(j)},P=(()=>{if(!(p!=null&&p.filters))return!1;const j=p.filters,v=p.customFilters||[],N=Object.entries(j).some(([R,E])=>!!(Array.isArray(E)&&E.length||typeof E=="string"&&E.trim()!==""||E&&typeof E=="object"&&(E.min!=null||E.max!=null))),A=v.some(R=>R.active);return N||A})();return n.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[a&&n.jsxs("button",{onClick:a,className:"inline-flex items-center gap-2 rounded-lg border border-gray-300 bg-white/80 px-4 py-2.5 transition-colors hover:bg-white text-sm font-medium text-gray-900",style:{fontFamily:"var(--font-sans)"},children:[n.jsx(W.CalendarClock,{size:16}),n.jsx("span",{children:"Week to Date"})]}),s&&n.jsx(l.Suspense,{fallback:n.jsxs("div",{className:"inline-flex items-center gap-2 rounded-lg border border-gray-300 bg-white/80 px-4 py-2.5 text-sm font-medium text-gray-400",children:[n.jsx(W.CalendarClock,{size:16}),n.jsx("span",{children:"Loading..."})]}),children:s}),u&&n.jsxs("div",{className:"relative",children:[n.jsxs("button",{ref:y,onClick:F,disabled:u.isExporting,className:"inline-flex items-center justify-between gap-2 rounded-lg border border-gray-300 bg-white/80 px-4 py-2.5 transition-colors hover:bg-white text-sm font-medium text-gray-900 disabled:opacity-50 disabled:cursor-not-allowed min-w-[120px]",style:{fontFamily:"var(--font-sans)"},children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(W.Download,{size:16}),n.jsx("span",{children:u.isExporting?"Exporting...":"Export"})]}),n.jsx(W.ChevronDown,{size:16})]}),b&&n.jsx("div",{ref:B,className:"absolute top-full right-0 mt-2 bg-white rounded-lg shadow-lg border border-gray-200 py-1 z-50 min-w-[120px]",children:(u.types||["csv"]).map(j=>n.jsxs("button",{onClick:()=>k(j),className:"w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 transition-colors",style:{fontFamily:"var(--font-sans)"},children:["Export ",j.toUpperCase()]},j))})]}),(P||S)&&n.jsxs(n.Fragment,{children:[P&&n.jsx("div",{className:"h-9 mt-1 w-px bg-gray-300 flex-shrink-0"}),n.jsxs("div",{className:"flex items-center gap-3 justify-end",children:[P&&p&&n.jsx($t.CustomFilterChips,{filters:p.filters,onChange:p.onChange,onClear:p.onClear,customFilters:p.customFilters||[],fieldOptions:p.fieldOptions||{}}),S&&n.jsx("div",{className:"flex-shrink-0",children:S})]})]})]})}function bt(s){if(s==null)return NaN;const a=String(s).replace(/[,$%]|pp/gi,"").trim(),u=parseFloat(a);return Number.isFinite(u)?u:NaN}function mn(s){if(s==null)return NaN;const a=String(s).trim(),u=a.match(/^(\d+):(\d+)(?::(\d+))?$/);if(u){const F=+u[1],k=+u[2],D=u[3]!=null?+u[3]:null;return D!=null?F*3600+k*60+D:F*60+k}let p=0,S=!1;const b=a.match(/(\d+)\s*d\b/i),c=a.match(/(\d+)\s*h\b/i),y=a.match(/(\d+)\s*m(?!s)\b/i),B=a.match(/(\d+)\s*s\b/i);return b&&(p+=+b[1]*86400,S=!0),c&&(p+=+c[1]*3600,S=!0),y&&(p+=+y[1]*60,S=!0),B&&(p+=+B[1],S=!0),S?p:NaN}function xn(s){if(!s)return null;const a=String(s).trim(),u=a.match(/^(\d{1,2})\/(\d{1,2})\/(\d{2,4})$/);if(u){const S=u[3].length===2?2e3+ +u[3]:+u[3],b=new Date(S,+u[1]-1,+u[2]);return isNaN(b.getTime())?null:b}const p=new Date(a);return isNaN(p.getTime())?null:p}function gn(s){if(!s||s.length===0)return"text";const a=s.slice(0,25),u=p=>a.every(p);return u(p=>/^\d{1,2}\/\d{1,2}\/\d{2,4}$/.test(p)||/^\d{4}-\d{2}-\d{2}/.test(p))?"date":u(p=>/^\d+\s*[dhms]\b/i.test(p)||/^\d+:\d+(:\d+)?$/.test(p))?"duration":u(p=>/^-?[\d,.]+(%|pp)?$/i.test(p))?"number":"text"}function qe(s){return s?Array.isArray(s)?s.length>0:s.type==="range"?s.min!==""&&s.min!==void 0&&s.min!==null||s.max!==""&&s.max!==void 0&&s.max!==null:s.type==="durationRange"?s.minSec!==""&&s.minSec!=null||s.maxSec!==""&&s.maxSec!=null:s.type==="scoreRange"?Array.isArray(s.values)&&s.values.length>0||s.min!==""&&s.min!=null||s.max!==""&&s.max!=null:s.type==="dateRange"?!!(s.from||s.to):!1:!1}function Ot(s){if(s==null||s===""||isNaN(s))return"";const a=Number(s),u=Math.floor(a/3600),p=Math.floor(a%3600/60),S=Math.floor(a%60);return u>0?`${u}h ${p}m`:p>0?`${p}m ${S}s`:`${S}s`}function yn(s){if(!s)return"";if(Array.isArray(s))return s.length===0?"":String(s[0]);if(s.type==="range"){const a=s.min!==""&&s.min!=null?s.min:null,u=s.max!==""&&s.max!=null?s.max:null;return a!=null&&u!=null?`${a} – ${u}`:a!=null?`≥ ${a}`:u!=null?`≤ ${u}`:""}if(s.type==="durationRange"){const a=s.minSec!==""&&s.minSec!=null?Ot(s.minSec):null,u=s.maxSec!==""&&s.maxSec!=null?Ot(s.maxSec):null;return a&&u?`${a} – ${u}`:a?`≥ ${a}`:u?`≤ ${u}`:""}if(s.type==="scoreRange"){if(Array.isArray(s.values)&&s.values.length>0)return s.values.slice().sort((p,S)=>p-S).join(", ");const a=s.min!==""&&s.min!=null?s.min:null,u=s.max!==""&&s.max!=null?s.max:null;return a!=null&&u!=null?`${a} – ${u}`:a!=null?`≥ ${a}`:u!=null?`≤ ${u}`:""}return s.type==="dateRange"?s.from&&s.to?`${s.from} – ${s.to}`:s.from?`from ${s.from}`:s.to?`to ${s.to}`:"":""}function bn(s){return Array.isArray(s)?Math.max(0,s.length-1):0}function Sn(s){return Array.isArray(s)?s.slice(1).map(String).join(", "):""}function vn({count:s,values:a}){const[u,p]=l.useState(!1);return n.jsxs("span",{onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",height:22,minWidth:22,padding:"0 6px",background:"#D8D8D8",color:"#0B0B0B",borderRadius:14,fontSize:12,fontWeight:500,lineHeight:1,cursor:"pointer"},children:["+",s,u&&n.jsx("span",{role:"tooltip",style:{position:"absolute",bottom:"calc(100% + 6px)",left:"50%",transform:"translateX(-50%)",background:"#1E2125",color:"#FFFFFF",fontFamily:"var(--font-sans)",fontSize:12,fontWeight:400,lineHeight:"20px",padding:"6px 10px",borderRadius:8,whiteSpace:"nowrap",pointerEvents:"none",zIndex:100,boxShadow:"0 6px 16px rgba(11, 11, 11, 0.18)"},children:a})]})}function wn({leftLabel:s,rightLabel:a,leftValue:u,rightValue:p,onLeftChange:S,onRightChange:b,type:c="number",placeholderLeft:y="Min",placeholderRight:B="Max"}){const F={width:"100%",height:32,borderRadius:8,border:"1px solid #D9D9D9",background:"#FFFFFF",padding:"0 10px",fontFamily:"var(--font-sans)",fontSize:14,color:"#0B0B0B",outline:"none",boxSizing:"border-box"},k={fontSize:12,color:"#676767",marginBottom:4,fontFamily:"var(--font-sans)"};return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[n.jsx("span",{style:k,children:s}),n.jsx("input",{type:c,value:u,onChange:D=>S(D.target.value),placeholder:y,style:F})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[n.jsx("span",{style:k,children:a}),n.jsx("input",{type:c,value:p,onChange:D=>b(D.target.value),placeholder:B,style:F})]})]})}const Tt=[{id:"0-60",label:"0 to 60 Sec",minSec:0,maxSec:60},{id:"60-120",label:"1m to 2 m",minSec:60,maxSec:120},{id:"120-180",label:"2m to 3 m",minSec:120,maxSec:180},{id:"180-240",label:"3m to 4m",minSec:180,maxSec:240},{id:"240-300",label:"4m to 5m",minSec:240,maxSec:300},{id:"300+",label:"5 mins and above",minSec:300,maxSec:null}];function Lt(s){if(s==null||s==="")return null;const a=String(s).trim().match(/^(\d{1,3}):(\d{2})$/);if(a)return Number(a[1])*60+Number(a[2]);const u=Number(s);return Number.isFinite(u)?u:null}function xt({children:s}){return n.jsx("div",{style:{fontSize:14,fontWeight:600,color:"#0B0B0B",lineHeight:"20px",padding:"4px 0 2px",fontFamily:"var(--font-sans)"},children:s})}function gt({minValue:s,maxValue:a,onMinChange:u,onMaxChange:p,inputType:S="number",inputMode:b="decimal",step:c,placeholder:y="0.0",unit:B}){const F={width:"100%",height:30,border:"1px solid #ACADAD",borderRadius:4,padding:"6px 10px",fontSize:13,color:"#0B0B0B",fontFamily:"var(--font-sans)",outline:"none",boxSizing:"border-box"};return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[n.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:8},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,flex:1,minWidth:0},children:[n.jsx("span",{style:{fontSize:12,color:"#2E3236",fontFamily:"var(--font-sans)"},children:"Min From"}),n.jsx("input",{type:S,inputMode:b,step:c,placeholder:y,value:s,onChange:k=>u(k.target.value),style:F})]}),n.jsx("span",{style:{fontSize:12,fontWeight:600,color:"#323232",paddingBottom:8,fontFamily:"var(--font-sans)"},children:"to"}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,flex:1,minWidth:0},children:[n.jsx("span",{style:{fontSize:12,color:"#2E3236",fontFamily:"var(--font-sans)"},children:"Max"}),n.jsx("input",{type:S,inputMode:b,step:c,placeholder:y,value:a,onChange:k=>p(k.target.value),style:F})]})]}),B&&n.jsxs("span",{style:{fontSize:11,color:"#676767",fontFamily:"var(--font-sans)"},children:["Enter durations in ",B==="sec"?"seconds":B]})]})}function Fn({column:s,columnId:a,filterType:u="text",position:p,popoverRef:S,distinctValues:b,initialValue:c,onApply:y,onCancel:B,onSearch:F=null,searchMinChars:k=3}){const D=u==="text",P=u==="number",j=u==="date",v=u==="duration",N=u==="score",A=/duration/i.test(String((s==null?void 0:s.label)||a||"")),R=l.useMemo(()=>{if(!N||!Array.isArray(b)||b.length===0)return!1;let h=1/0,m=-1/0;for(const x of b){const w=bt(x);Number.isFinite(w)&&(w<h&&(h=w),w>m&&(m=w))}return Number.isFinite(h)&&Number.isFinite(m)&&h>=0&&m<=5},[N,b]),[E,ae]=l.useState(()=>D?new Set(Array.isArray(c)?c:[]):new Set),[me,q]=l.useState(""),[Y,K]=l.useState(()=>P&&(c==null?void 0:c.type)==="range"&&c.min!=null?c.min:""),[Q,te]=l.useState(()=>P&&(c==null?void 0:c.type)==="range"&&c.max!=null?c.max:""),[I,ce]=l.useState(new Set),[V,O]=l.useState(()=>v&&(c==null?void 0:c.type)==="durationRange"&&c.minSec!=null&&c.minSec!==""?String(c.minSec):""),[U,de]=l.useState(()=>v&&(c==null?void 0:c.type)==="durationRange"&&c.maxSec!=null&&c.maxSec!==""?String(c.maxSec):""),[ue,Ke]=l.useState(()=>N&&(c==null?void 0:c.type)==="scoreRange"&&Array.isArray(c.values)?new Set(c.values):new Set),[We,je]=l.useState(()=>N&&(c==null?void 0:c.type)==="scoreRange"&&c.min!=null&&c.min!==""?String(c.min):""),[xe,ke]=l.useState(()=>N&&(c==null?void 0:c.type)==="scoreRange"&&c.max!=null&&c.max!==""?String(c.max):""),[Ge,X]=l.useState(()=>j&&(c==null?void 0:c.type)==="dateRange"&&c.from||""),[T,ne]=l.useState(()=>j&&(c==null?void 0:c.type)==="dateRange"&&c.to||"");l.useEffect(()=>{D&&ae(new Set(Array.isArray(c)?c:[]))},[a,D]);const[ee,re]=l.useState(null),[J,Se]=l.useState(!1),ge=l.useRef(0),se=me.trim(),M=D&&typeof F=="function"&&se.length>=k;l.useEffect(()=>{if(!D||typeof F!="function")return;if(se.length<k){re(null),Se(!1);return}const h=++ge.current;Se(!0);const m=setTimeout(async()=>{try{const x=await F(se);if(h!==ge.current)return;const w=Array.isArray(x)?x.map(L=>L&&typeof L=="object"?L.label??L.value:L).filter(L=>L!=null&&L!=="").map(String):[];re(w)}catch{h===ge.current&&re([])}finally{h===ge.current&&Se(!1)}},300);return()=>clearTimeout(m)},[D,F,se,k]);const ye=l.useMemo(()=>{const h=se.toLowerCase(),m=M?ee||[]:h?b.filter(w=>String(w).toLowerCase().includes(h)):b,x=new Map;for(const w of m)x.set(String(w),w);for(const w of E)x.set(String(w),w);return Array.from(x.values()).sort((w,L)=>{const oe=E.has(w),Xe=E.has(L);return oe!==Xe?oe?-1:1:String(w).localeCompare(String(L))})},[b,se,E,M,ee]),Oe=h=>{ae(m=>{const x=new Set(m);return x.has(h)?x.delete(h):x.add(h),x})},Te=()=>{D&&ae(new Set),P&&(K(""),te("")),v&&(ce(new Set),O(""),de("")),N&&(Ke(new Set),je(""),ke("")),j&&(X(""),ne("")),q("")},ve=h=>{ce(m=>{const x=new Set(m);return x.has(h)?x.delete(h):x.add(h),x})},be=h=>{Ke(m=>{const x=new Set(m);return x.has(h)?x.delete(h):x.add(h),x})},Ue=()=>{if(D)return y(Array.from(E));if(P)return y({type:"range",min:Y===""?"":Number(Y),max:Q===""?"":Number(Q)});if(v){const h=Lt(V),m=Lt(U),x=h!=null||m!=null;let w="",L="";if(x)w=h??"",L=m??"";else if(I.size>0){const oe=Tt.filter(Z=>I.has(Z.id));w=Math.min(...oe.map(Z=>Z.minSec)),L=oe.some(Z=>Z.maxSec==null)?"":Math.max(...oe.map(Z=>Z.maxSec))}return y({type:"durationRange",minSec:w,maxSec:L})}if(N){const h=We===""?null:Number(We),m=xe===""?null:Number(xe);return h!=null||m!=null?y({type:"scoreRange",values:[],min:h!=null&&Number.isFinite(h)?h:"",max:m!=null&&Number.isFinite(m)?m:""}):y({type:"scoreRange",values:Array.from(ue).sort((w,L)=>w-L),min:"",max:""})}if(j)return y({type:"dateRange",from:Ge,to:T})};return n.jsxs("div",{ref:S,role:"dialog","aria-label":`Filter ${s.label||a}`,style:{position:"fixed",top:p.top,left:p.left,zIndex:50,width:D?240:220,background:"#FFFFFF",border:"1px solid #E6E6E6",borderRadius:10,padding:12,display:"flex",flexDirection:"column",gap:10,boxShadow:"0 8px 24px rgba(11, 11, 11, 0.10)",fontFamily:"var(--font-sans)"},children:[D&&n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{background:"#D8D8D8",height:32,borderRadius:10,padding:1,display:"flex",alignItems:"center"},children:n.jsxs("div",{style:{background:"#FFFFFF",flex:1,height:30,borderRadius:10,display:"flex",alignItems:"center",gap:8,padding:"0 8px"},children:[n.jsx(W.Search,{size:16,color:"#989898",strokeWidth:2}),n.jsx("input",{autoFocus:!0,type:"text",value:me,onChange:h=>q(h.target.value),placeholder:"Search",style:{flex:1,border:"none",outline:"none",background:"transparent",fontSize:14,color:"#0B0B0B",minWidth:0,fontFamily:"var(--font-sans)"}})]})}),n.jsx("div",{style:{maxHeight:220,overflowY:"auto",display:"flex",flexDirection:"column",gap:4},children:typeof F=="function"&&se.length>0&&se.length<k?n.jsx("div",{style:{fontSize:13,color:"#676767",padding:"8px 4px",textAlign:"center"},children:`Type at least ${k} characters to search`}):J?n.jsx("div",{style:{fontSize:13,color:"#676767",padding:"8px 4px",textAlign:"center"},children:"Searching…"}):ye.length===0?n.jsx("div",{style:{fontSize:13,color:"#676767",padding:"8px 4px",textAlign:"center"},children:"No values"}):ye.map(h=>{const m=E.has(h);return n.jsxs("label",{style:{display:"flex",alignItems:"center",gap:12,padding:"6px 4px",cursor:"pointer",borderRadius:6},children:[n.jsx("span",{style:{width:20,height:20,borderRadius:4,display:"inline-flex",alignItems:"center",justifyContent:"center",background:m?"#0B0B0B":"#FFFFFF",border:`1px solid ${m?"#0B0B0B":"#676767"}`,flexShrink:0},children:m&&n.jsx(W.Check,{size:14,color:"#FFFFFF",strokeWidth:3})}),n.jsx("input",{type:"checkbox",checked:m,onChange:()=>Oe(h),style:{position:"absolute",opacity:0,pointerEvents:"none"},tabIndex:-1}),n.jsx("span",{onClick:x=>{x.preventDefault(),Oe(h)},style:{fontSize:14,lineHeight:"20px",color:"#0B0B0B",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h})]},h)})})]}),P&&n.jsxs(n.Fragment,{children:[n.jsx(xt,{children:s.label||"Filter"}),n.jsx(gt,{minValue:Y,maxValue:Q,onMinChange:K,onMaxChange:te,placeholder:A?"00":"0.0",unit:A?"sec":void 0})]}),v&&n.jsxs(n.Fragment,{children:[n.jsx(xt,{children:s.label||"Duration"}),s.filterShowPresets===!0&&n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:Tt.map(h=>{const m=I.has(h.id);return n.jsxs("div",{role:"checkbox","aria-checked":m,tabIndex:0,onClick:()=>ve(h.id),onKeyDown:x=>{(x.key===" "||x.key==="Enter")&&(x.preventDefault(),ve(h.id))},style:{display:"flex",alignItems:"center",gap:12,cursor:"pointer",userSelect:"none"},children:[n.jsx("span",{style:{width:20,height:20,borderRadius:4,display:"inline-flex",alignItems:"center",justifyContent:"center",background:m?"#0B0B0B":"#FFFFFF",border:`1px solid ${m?"#0B0B0B":"#676767"}`,flexShrink:0},children:m&&n.jsx(W.Check,{size:14,color:"#FFFFFF",strokeWidth:3})}),n.jsx("span",{style:{fontSize:14,lineHeight:"20px",color:"#0B0B0B",fontFamily:"var(--font-sans)"},children:h.label})]},h.id)})}),n.jsx("div",{style:{height:1,background:"#D9D9D9",margin:"0 -12px"}}),n.jsx("div",{style:{fontSize:14,fontWeight:500,color:"#0B0B0B",lineHeight:"20px",padding:"4px 0",fontFamily:"var(--font-sans)"},children:"Custom Range"})]}),n.jsx(gt,{minValue:V,maxValue:U,onMinChange:O,onMaxChange:de,inputType:"number",inputMode:"numeric",placeholder:"00",unit:"sec"})]}),N&&n.jsxs(n.Fragment,{children:[n.jsx(xt,{children:s.label||"Score"}),R&&s.filterShowPresets===!0&&n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[1,2,3,4,5].map(h=>{const m=ue.has(h);return n.jsxs("div",{role:"checkbox","aria-checked":m,tabIndex:0,onClick:()=>be(h),onKeyDown:x=>{(x.key===" "||x.key==="Enter")&&(x.preventDefault(),be(h))},style:{display:"flex",alignItems:"center",gap:12,cursor:"pointer",userSelect:"none"},children:[n.jsx("span",{style:{width:20,height:20,borderRadius:4,display:"inline-flex",alignItems:"center",justifyContent:"center",background:m?"#0B0B0B":"#FFFFFF",border:`1px solid ${m?"#0B0B0B":"#676767"}`,flexShrink:0},children:m&&n.jsx(W.Check,{size:14,color:"#FFFFFF",strokeWidth:3})}),n.jsx("span",{style:{fontSize:14,lineHeight:"20px",color:"#0B0B0B",fontFamily:"var(--font-sans)"},children:h})]},h)})}),n.jsx("div",{style:{height:1,background:"#D9D9D9",margin:"0 -12px"}})]}),R&&s.filterShowPresets===!0&&n.jsx("div",{style:{fontSize:14,fontWeight:500,color:"#0B0B0B",lineHeight:"20px",padding:"4px 0",fontFamily:"var(--font-sans)"},children:"Custom Range"}),n.jsx(gt,{minValue:We,maxValue:xe,onMinChange:je,onMaxChange:ke,step:"0.1"})]}),j&&n.jsx(wn,{leftLabel:"From",rightLabel:"To",leftValue:Ge,rightValue:T,onLeftChange:X,onRightChange:ne,type:"date",placeholderLeft:"",placeholderRight:""}),n.jsx("div",{style:{height:1,background:"#D9D9D9",margin:"0 -12px"}}),n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[n.jsx("button",{type:"button",onClick:Te,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",fontSize:14,fontWeight:500,color:"#323232",fontFamily:"var(--font-sans)"},children:v&&s.filterShowPresets===!0||N&&R&&s.filterShowPresets===!0?"View All":"Reset"}),n.jsx("button",{type:"button",onClick:Ue,style:{background:"#0B0B0B",color:"#FFFFFF",border:"none",borderRadius:10,height:28,padding:"0 14px",fontSize:14,fontWeight:500,cursor:"pointer",fontFamily:"var(--font-sans)"},children:"Apply"})]})]})}const jn=()=>({userData:{email:"anonymous"}}),kn=s=>n.jsx("img",{...s});function Cn({children:s,content:a,direction:u="top",align:p="center",styling:S,indicatorColor:b}){const c=typeof a=="string"?a:a!=null?String(a):"",y=typeof b=="string"&&(b.startsWith("#")||b.startsWith("rgb")||b.startsWith("hsl")||b.startsWith("var("))?b:"var(--Grey-Strong, #2E3236)",[B,F]=l.useState(!1),[k,D]=l.useState(!1),[P,j]=l.useState({top:0,left:0,arrowLeft:0,placement:"top"}),v=l.useRef(null),N=l.useRef(null);if(!c)return s;l.useEffect(()=>{D(!0)},[]);const A=l.useCallback(()=>{if(!v.current||!N.current||typeof window>"u")return;const R=v.current.getBoundingClientRect(),E=N.current.getBoundingClientRect(),ae=window.innerWidth,me=window.innerHeight,q=8,Y=10,K=E.width,Q=E.height,te=R.top,I=me-R.bottom,ce=u==="bottom"?"bottom":"top";let V=ce;ce==="top"&&te<Q+Y+q&&I>te?V="bottom":ce==="bottom"&&I<Q+Y+q&&te>I&&(V="top");let O=R.left+R.width/2;p==="start"&&(O=R.left),p==="end"&&(O=R.right);let U=V==="top"?R.top-Q-Y:R.bottom+Y,de=p==="start"?O:p==="end"?O-K:O-K/2;U=Math.max(q,Math.min(U,me-Q-q)),de=Math.max(q,Math.min(de,ae-K-q));const ue=Math.max(10,Math.min(O-de,K-10));j({top:U,left:de,arrowLeft:ue,placement:V})},[p,u]);return l.useEffect(()=>{if(!B||!k)return;A();const R=()=>A();return window.addEventListener("resize",R),window.addEventListener("scroll",R,!0),()=>{window.removeEventListener("resize",R),window.removeEventListener("scroll",R,!0)}},[B,k,A]),n.jsxs("span",{ref:v,style:{display:"block",width:"100%"},onMouseEnter:()=>F(!0),onMouseLeave:()=>F(!1),children:[s,B&&k&&yt.createPortal(n.jsxs("span",{ref:N,style:{position:"fixed",top:`${P.top}px`,left:`${P.left}px`,background:"var(--Grey-Strong, #2E3236)",color:"var(--Grey-White, #FFF)",fontSize:"12px",lineHeight:1.3,fontWeight:500,padding:"8px 10px",borderRadius:"6px",whiteSpace:"normal",maxWidth:"320px",width:"max-content",boxShadow:"0 6px 18px rgba(0, 0, 0, 0.2)",zIndex:99999,pointerEvents:"none",...typeof S=="object"?S:{}},children:[c,n.jsx("span",{style:{position:"absolute",left:`${P.arrowLeft}px`,transform:"translateX(-50%)",width:0,height:0,borderLeft:"6px solid transparent",borderRight:"6px solid transparent",...P.placement==="top"?{top:"100%",borderTop:`7px solid ${y}`}:{bottom:"100%",borderBottom:`7px solid ${y}`}}})]}),document.body)]})}function Dn({data:s=[],columns:a=[],initialPageSize:u=10,onRowClick:p,totalCount:S=null,page:b=null,pageSize:c=null,onPageChange:y=null,onPageSizeChange:B=null,onFilterChange:F=null,columnFilters:k=null,onMaxColumnsError:D=null,onSort:P=null,sortFields:j=[],tableId:v=null,isLoading:N=!1,filtersConfig:A=null,columnResizeMinWidth:R=120,columnResizeMaxWidth:E=280,onVisibleColumnsChange:ae=null,hideColumnPicker:me=!1,selectable:q=!1,selectedRowIds:Y=null,onSelectionChange:K=null,getRowId:Q=null}){var Wt;const{userData:te}=jn(),I=(te==null?void 0:te.email)||"anonymous",ce=l.memo(({children:e,content:t,className:o=""})=>{const i=l.useRef(null),[r,f]=l.useState(!1);l.useEffect(()=>{const g=()=>{if(i.current){const _=i.current.scrollWidth>i.current.clientWidth;f(_)}};g();const z=setTimeout(g,0);return window.addEventListener("resize",g),()=>{clearTimeout(z),window.removeEventListener("resize",g)}},[e,t]);const d=n.jsx("span",{className:`truncate block ${o}`,ref:i,children:e});return r&&t?n.jsx(Cn,{content:t,styling:"bg-green-2 text-gray-900 px-3 py-2 text-sm rounded-lg shadow-md border border-gray-300 max-w-xs whitespace-normal",indicatorColor:"bg-green-2",direction:"top",children:d}):d});ce.displayName="TruncatedCell";const V=S!==null&&y!==null,O=F!==null,U=P!==null,[de,ue]=l.useState(1),[Ke,We]=l.useState(u),je=b!==null?b:de,xe=c!==null?c:Ke,ke=e=>{y?y(e):ue(e)},Ge=e=>{B?B(e):We(e)},X=50,T="action",ne=l.useRef(!1),ee=l.useMemo(()=>v?`dataTable_columns_${v}:${I}`:`dataTable_columns_${a.map(t=>t.id||t.key).sort().join("_")}:${I}`,[v,a,I]),re=l.useMemo(()=>v?`dataTable_manual_change_${v}:${I}`:null,[v,I]);l.useCallback((e,t)=>{if(typeof window>"u"||!e||!t||t.length===0)return null;try{const o=localStorage.getItem(e);if(o){const r=JSON.parse(o).filter(f=>t.some(d=>(d.id||d.key)===f));if(r.length>0)return r}}catch(o){console.warn("Failed to load saved columns from localStorage:",o)}return null},[]);const[J,Se]=l.useState({}),[ge,se]=l.useState(""),[M,ye]=l.useState(null),[Oe,Te]=l.useState({top:0,left:0}),ve=l.useRef(null),be=l.useRef({}),[Ue,h]=l.useState(null),[m,x]=l.useState("asc"),w=l.useCallback((e,t)=>{const o=qe(t);Se(i=>{const r={...i};return o?r[e]=t:delete r[e],r}),y?y(1):ue(1),O&&F&&F(o?{...J,[e]:t}:Object.fromEntries(Object.entries(J).filter(([i])=>i!==e)))},[J,F,O,y]),L=l.useCallback(()=>{Se({}),se(""),y?y(1):ue(1),O&&F&&F({})},[F,O,y]),oe=l.useCallback(e=>{const t=a.find(r=>(r.id||r.key)===e);if(t&&Array.isArray(t.filterOptions)){const r=new Set,f=[];for(const d of t.filterOptions){if(d==null||d==="")continue;const g=typeof d=="object"?JSON.stringify(d):String(d);r.has(g)||(r.add(g),f.push(g))}return f.sort((d,g)=>d.localeCompare(g))}if(!s||s.length===0)return[];const o=new Set,i=[];for(const r of s){const f=r[e];if(f==null)continue;const d=typeof f=="object"?JSON.stringify(f):String(f);o.has(d)||(o.add(d),i.push(d))}return i.sort((r,f)=>r.localeCompare(f))},[s,a]),Xe=l.useCallback(e=>{const t=a.find(o=>G(o)===e);return t&&t.filterType?t.filterType:gn(oe(e))},[a,oe]),Z=l.useCallback(e=>{const i=typeof window<"u"?window.innerWidth:1/0;let r=e.left;return r+280>i-8&&(r=Math.max(8,e.right-280)),{top:e.bottom+6,left:r}},[]),It=l.useCallback((e,t)=>{if(!t){ye(e);return}const o=t.getBoundingClientRect();Te(Z(o)),ye(i=>i===e?null:e)},[Z]);l.useEffect(()=>{if(!M)return;const e=t=>{if(ve.current&&ve.current.contains(t.target))return;const o=be.current[M];o&&o.contains(t.target)||Object.values(be.current).some(r=>r&&r.contains(t.target))||ye(null)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[M]),l.useEffect(()=>{if(!M)return;const e=()=>{const t=be.current[M];if(!t)return;const o=t.getBoundingClientRect();Te(Z(o))};return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[M,Z]),l.useLayoutEffect(()=>{if(!M)return;const e=ve.current,t=be.current[M];if(!e||!t)return;const o=e.offsetWidth,i=t.getBoundingClientRect(),r=8,f=typeof window<"u"?window.innerWidth:1/0;if(!(i.left+o>f-r))return;const g=Math.max(r,i.right-o);Te(z=>z.left===g?z:{...z,left:g})},[M,Oe.top]);const St=l.useCallback(e=>!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([,t])=>t==null?!1:typeof t=="string"?t.trim()!=="":!0)),[]),vt=l.useCallback((e,t)=>{const o=Object.keys(e||{}),i=Object.keys(t||{});return o.length!==i.length?!1:o.every(r=>e[r]===t[r])},[]);l.useEffect(()=>{if(!O||k===null)return;const e=St(k);Se(t=>vt(t,e)?t:e)},[O,k,St,vt]),l.useCallback((e,t)=>e==="csat_score"&&t==="evaluation.csat_score"?t:e,[]);const Le=U&&j.length>0?j[0][0]:Ue,Je=U&&j.length>0?j[0][1]:m,[Rn,wt]=l.useState(()=>a.map(e=>e.id||e.key)),ie=l.useCallback(e=>{if(!e||e.length===0)return e;let t=Array.from(new Set(e));t.length>X&&(t=t.slice(0,X));const i=a.map(d=>d.id||d.key).includes(T);return!t.includes(T)&&i&&(t.length>=X?t=[...t.slice(0,X-1),T]:t=[...t,T]),[...t.filter(d=>d!==T),T]},[a]),[$,$e]=l.useState(()=>{if(typeof window<"u"&&v)try{if(localStorage.getItem(`dataTable_manual_change_${v}:${I}`)==="true"){const i=localStorage.getItem(`dataTable_columns_${v}:${I}`);if(i){const r=JSON.parse(i);if(Array.isArray(r)&&r.length>0){ne.current=!0;const f=r.filter(d=>a.some(g=>(g.id||g.key)===d));if(f.length>0)return f.slice(0,X)}}}}catch(o){console.warn("Failed to load saved columns from localStorage:",o)}const t=a.map(o=>o.id||o.key).slice(0,X);return ie(t)}),[le,at]=l.useState(!1),[fe,Ce]=l.useState([]),[Ft,_t]=l.useState({top:0,left:0,width:0}),[Ye,De]=l.useState(new Set),[Qe,Re]=l.useState(new Set),pe=l.useRef({}),Ze=l.useRef(null);Ze.current===null&&(Ze.current=[...$]);const[he,ct]=l.useState(null),[Ht,Ve]=l.useState(null),Ee=l.useRef(null),dt=l.useRef(null),ut=l.useRef(null),[jt,ft]=l.useState(null),[pt,qt]=l.useState({}),Kt=l.useRef(null),et=l.useRef(null),G=e=>e.id||e.key,tt=l.useCallback(e=>{if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){const t=e.trim();if(t.endsWith("px")){const i=parseFloat(t);return Number.isFinite(i)?i:null}const o=parseFloat(t);return Number.isFinite(o)&&`${o}`===t?o:null}return null},[]),kt=l.useCallback((e,t)=>pt[e]!=null?`${pt[e]}px`:typeof t=="number"?`${t}px`:t||"auto",[pt]),nt=l.useCallback(e=>{if(!et.current)return;const{columnId:t,startX:o,startWidth:i,minWidth:r,maxWidth:f}=et.current,d=e.clientX-o,g=Math.round(i+d),z=Math.min(f,Math.max(r,g));qt(_=>({..._,[t]:z}))},[]),Pe=l.useCallback(()=>{et.current=null,document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",nt),document.removeEventListener("mouseup",Pe)},[nt]),Gt=l.useCallback((e,t,o)=>{var Ne;e.preventDefault(),e.stopPropagation();const i=t.id||t.key,r=tt(t.minWidth)??R,f=tt(t.maxWidth)??E,d=Math.min(r,f),g=Math.max(r,f),z=((Ne=e.currentTarget.closest("th"))==null?void 0:Ne.getBoundingClientRect().width)||0,_=tt(o),He=_??Math.max(d,Math.round(z)||d),Be=Math.min(g,Math.max(d,He));et.current={columnId:i,startX:e.clientX,startWidth:Be,minWidth:d,maxWidth:g},document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",nt),document.addEventListener("mouseup",Pe)},[E,R,nt,Pe,tt]);l.useEffect(()=>()=>Pe(),[Pe]);const Ut=H.useSensors(H.useSensor(H.PointerSensor),H.useSensor(H.KeyboardSensor,{coordinateGetter:H.sortableKeyboardCoordinates})),Xt=e=>{const{active:t,over:o}=e;if(o&&t.id!==o.id){if(t.id===T||o.id===T){Et("Cannot drop columns on the Action column"),ft(null);return}ne.current=!0,$e(i=>{const r=i.indexOf(t.id),f=i.indexOf(o.id);if(r!==-1&&f!==-1){const d=H.arrayMove(i,r,f),g=ie(d);return Mt(g),g}return i}),wt(i=>{const r=i.indexOf(t.id),f=i.indexOf(o.id);return H.arrayMove(i,r,f)})}ft(null)},Jt=e=>{ft(e.active.id)},rt=l.useMemo(()=>{if(O)return s||[];if(!s||s.length===0)return[];const e=ge.trim().toLowerCase(),t=Object.entries(J).filter(([,o])=>qe(o));return s.filter(o=>{for(const[i,r]of t){const f=o[i];if(f==null)return!1;if(Array.isArray(r)){const d=String(f);if(!r.some(g=>String(g)===d))return!1;continue}if(r.type==="range"){const d=bt(f);if(isNaN(d)||r.min!==""&&r.min!=null&&d<Number(r.min)||r.max!==""&&r.max!=null&&d>Number(r.max))return!1;continue}if(r.type==="durationRange"){const d=mn(f);if(isNaN(d)||r.minSec!==""&&r.minSec!=null&&d<Number(r.minSec)||r.maxSec!==""&&r.maxSec!=null&&d>Number(r.maxSec))return!1;continue}if(r.type==="scoreRange"){const d=bt(f);if(isNaN(d))return!1;if(Array.isArray(r.values)&&r.values.length>0){const g=Math.floor(d);if(!r.values.includes(g))return!1;continue}if(r.min!==""&&r.min!=null&&d<Number(r.min)||r.max!==""&&r.max!=null&&d>Number(r.max))return!1;continue}if(r.type==="dateRange"){const d=xn(f);if(!d)return!1;if(r.from){const g=new Date(r.from+"T00:00:00");if(d<g)return!1}if(r.to){const g=new Date(r.to+"T23:59:59");if(d>g)return!1}continue}}return!(e&&!Object.values(o).some(r=>r==null?!1:String(r).toLowerCase().includes(e)))})},[s,J,ge,O]),Ie=l.useMemo(()=>U||!Le?rt:[...rt].sort((e,t)=>{const o=e[Le],i=t[Le];if(o==null)return 1;if(i==null)return-1;if(typeof o=="number"&&typeof i=="number")return Je==="asc"?o-i:i-o;const r=String(o).toLowerCase(),f=String(i).toLowerCase();return Je==="asc"?r.localeCompare(f):f.localeCompare(r)}),[rt,Le,Je,U]),Me=l.useMemo(()=>{if(V)return Ie;{const e=(je-1)*xe,t=e+xe;return Ie.slice(e,t)}},[Ie,je,xe,V]),ht=l.useCallback((e,t)=>Q?Q(e,t):(e==null?void 0:e.id)??t,[Q]),we=l.useMemo(()=>new Set(Array.isArray(Y)?Y:[]),[Y]),Fe=l.useMemo(()=>Me.map((e,t)=>ht(e,t)),[Me,ht]),Ct=l.useMemo(()=>Fe.reduce((e,t)=>we.has(t)?e+1:e,0),[Fe,we]),st=Fe.length>0&&Ct===Fe.length,Yt=Ct>0&&!st,Qt=l.useCallback(e=>{if(!K)return;const t=new Set(we);t.has(e)?t.delete(e):t.add(e),K(Array.from(t))},[K,we]),Zt=l.useCallback(()=>{if(!K)return;const e=new Set(we);st?Fe.forEach(t=>e.delete(t)):Fe.forEach(t=>e.add(t)),K(Array.from(e))},[K,we,st,Fe]),Dt=({checked:e,indeterminate:t=!1,onToggle:o,ariaLabel:i})=>n.jsx("span",{role:"checkbox","aria-checked":t?"mixed":e,"aria-label":i,tabIndex:0,onClick:r=>{r.stopPropagation(),o()},onKeyDown:r=>{(r.key===" "||r.key==="Enter")&&(r.preventDefault(),r.stopPropagation(),o())},style:{width:16,height:16,borderRadius:5,display:"inline-flex",alignItems:"center",justifyContent:"center",background:e||t?"#0B0B0B":"#FFFFFF",border:`1px solid ${e||t?"#0B0B0B":"#676767"}`,cursor:"pointer",flexShrink:0},children:t?n.jsx(W.Minus,{size:11,color:"#FFFFFF",strokeWidth:3}):e?n.jsx(W.Check,{size:11,color:"#FFFFFF",strokeWidth:3}):null}),ot=44,Rt=e=>{U&&P?(P(e),y?y(1):ue(1)):(Ue===e?x(m==="asc"?"desc":"asc"):(h(e),x("asc")),ke(1))},Vt=(e,t)=>{const o=(t||"").split(/\s+/).map(i=>i.trim()).filter(Boolean);w(e,o)},Et=e=>{ut.current||(typeof D=="function"&&D(e),ut.current=setTimeout(()=>{ut.current=null},3e3))},Mt=l.useCallback(e=>{if(typeof window<"u"&&ee&&e.length>0&&ne.current)try{localStorage.setItem(ee,JSON.stringify(e)),re&&localStorage.setItem(re,"true")}catch(t){console.warn("Failed to save columns to localStorage:",t)}},[ee,re]),zt=250,it=()=>{Object.values(pe.current).forEach(e=>clearTimeout(e)),pe.current={}},en=()=>{const e=fe.filter(t=>!Qe.has(t));return Ye.forEach(t=>{e.includes(t)||e.push(t)}),ie(e)},tn=e=>{if(e===T)return;if(pe.current[e]){clearTimeout(pe.current[e]),delete pe.current[e],De(o=>{const i=new Set(o);return i.delete(e),i}),Re(o=>{const i=new Set(o);return i.delete(e),i});return}if(fe.includes(e)){if(fe.length-Qe.size<=1)return;Re(i=>new Set(i).add(e)),pe.current[e]=setTimeout(()=>{Ce(i=>i.filter(r=>r!==e)),Re(i=>{const r=new Set(i);return r.delete(e),r}),delete pe.current[e]},zt)}else{if(fe.length+Ye.size>=X){Et("Maximum 9 column selection allowed");return}De(i=>new Set(i).add(e)),pe.current[e]=setTimeout(()=>{Ce(i=>ie([...i,e])),De(i=>{const r=new Set(i);return r.delete(e),r}),delete pe.current[e]},zt)}},nn=(e,t)=>{fe[t]!==T&&ct(t)},rn=()=>{ct(null),Ve(null)},sn=(e,t)=>{e.preventDefault(),he!==null&&he!==t&&Ve(t)},on=()=>{Ve(null)},ln=(e,t)=>{e.preventDefault(),he!==null&&he!==t&&fe[t]!==T&&fe[he]!==T&&Ce(o=>{const i=H.arrayMove(o,he,t);return ie(i)}),ct(null),Ve(null)};l.useEffect(()=>{wt(e=>{const t=$.filter(r=>e.includes(r)),o=$.filter(r=>!e.includes(r)),i=e.filter(r=>!$.includes(r));return[...t,...o,...i]})},[$]),l.useEffect(()=>{if(typeof window<"u"&&ee&&$.length>0&&ne.current)try{const e=ie($);localStorage.setItem(ee,JSON.stringify(e)),re&&localStorage.setItem(re,"true")}catch(e){console.warn("Failed to save columns to localStorage:",e)}},[$,ee,re]),l.useEffect(()=>{ae&&ae($.filter(e=>e!==T))},[$,ae]),l.useEffect(()=>{if(a.length>0&&$.length===0){if(typeof window<"u"&&v)try{if(localStorage.getItem(`dataTable_manual_change_${v}:${I}`)==="true"){const o=localStorage.getItem(`dataTable_columns_${v}:${I}`);if(o){const i=JSON.parse(o);if(Array.isArray(i)&&i.length>0){const r=i.filter(f=>a.some(d=>(d.id||d.key)===f));if(r.length>0){ne.current=!0,$e(r.slice(0,X));return}}}}}catch(t){console.warn("Failed to load saved columns from localStorage:",t)}const e=a.map(t=>t.id||t.key);$e(ie(e.slice(0,X)))}},[a,v,I,ie]);const ze=l.useMemo(()=>{const e=$.map(t=>a.find(o=>G(o)===t)).filter(Boolean);return ie(e.map(G)).map(t=>a.find(o=>G(o)===t)).filter(Boolean)},[a,$]);l.useMemo(()=>ze.some(e=>e.filterable===!0),[ze]),l.useEffect(()=>{if(!le||!Ee.current)return;const e=()=>{if(Ee.current){const t=Ee.current.getBoundingClientRect(),o=217,i=Math.max(8,t.right-o);_t({top:t.bottom,left:i,width:Math.max(t.width||220,220)})}};return e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[le]),l.useEffect(()=>{const e=t=>{le&&Ee.current&&!Ee.current.contains(t.target)&&dt.current&&!dt.current.contains(t.target)&&at(!1)};if(le)return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[le]),l.useEffect(()=>{le&&(it(),Ce($),De(new Set),Re(new Set))},[le,$]),l.useEffect(()=>()=>it(),[]),$.length===1?(Wt=a.find(e=>(e.id||e.key)===$[0]))!=null&&Wt.label:`${$.length}`;function an({column:e,isHeaderRow:t=!0}){const o=G(e),i=o===T,r=kt(o,e.width),[f,d]=l.useState(!1),{attributes:g,listeners:z,setNodeRef:_,transform:He,transition:Be,isDragging:Ne}=H.useSortable({id:o}),dn={transform:H.CSS.Transform.toString(He),transition:Be,opacity:Ne?.5:1,width:r,minWidth:r};let Ae=!1;if(U&&j.length>0){const C=j[0][0];(C===o||C==="csat_score"&&o==="evaluation.csat_score")&&(Ae=!0)}else Ae=Le===o;const un=Je==="asc",fn=e.filterable===!0;if(!t)return n.jsx("th",{style:{width:r,minWidth:r,backgroundColor:"var(--primary-foreground)",borderRight:"1px solid #e6e6e6",borderBottom:"1px solid #e6e6e6",boxSizing:"border-box"},className:"sticky top-[57px] z-10 border-b border-[var(--border-strong)] px-4 py-2 text-left",children:fn?n.jsxs("div",{className:"relative",children:[n.jsx(Filter,{size:12,className:"absolute left-2 top-1/2 -translate-y-1/2 text-[var(--text-faint)] pointer-events-none"}),n.jsx("input",{type:"text",placeholder:"Filter...",value:J[o]||"",onChange:C=>{C.stopPropagation(),Vt(o,C.target.value)},onKeyDown:C=>C.stopPropagation(),onMouseDown:C=>C.stopPropagation(),className:"w-full pl-7 pr-2 py-1.5 text-xs border border-[var(--border)] rounded text-[var(--text-ink)] placeholder:text-[var(--text-faint)] focus:outline-none focus:border-[var(--border-hover)] focus:ring-1 focus:ring-[var(--focus)] transition-colors",style:{fontFamily:"var(--font-sans)",backgroundColor:"var(--primary-foreground)"},autoComplete:"off"})]}):n.jsx("div",{className:"h-[34px]"})});const mt=M===o,lt=qe(J[o]),pn=e.sortable!==!1&&(f||Ae),hn=e.filterable!==!1&&!i&&(f||mt||lt);return n.jsxs("th",{ref:_,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{...dn,padding:"0 12px",height:36,textAlign:i?"center":"left",fontWeight:500,fontSize:"14px",letterSpacing:"normal",textTransform:"none",color:"#0b0b0b",cursor:e.sortable!==!1?"pointer":"default",width:r,...typeof r=="string"&&r.endsWith("px")?{maxWidth:r}:{},borderRight:"1px solid #e6e6e6",boxSizing:"border-box",userSelect:"none",whiteSpace:"nowrap",wordBreak:"normal",overflowWrap:"normal",verticalAlign:"middle",background:f||mt?"#e6e6e6":"#f2f2f0",borderBottom:"1px solid #e6e6e6",position:"sticky",top:0,zIndex:10,fontFamily:"var(--font-sans)",transition:"background 100ms ease"},children:[!i&&n.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",transform:"translateY(-50%)",width:1,height:16,background:"#e6e6e6",pointerEvents:"none",zIndex:1}}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",justifyContent:i?"center":"flex-start",position:"relative",minHeight:20,minWidth:0,width:"100%",overflow:"hidden"},children:[!i&&n.jsx("div",{...g,...z,style:{cursor:"grab",color:"rgba(11, 11, 11, 0.36)",display:"inline-flex",alignItems:"center",visibility:f?"visible":"hidden",flexShrink:0},children:n.jsx(W.GripVertical,{size:14})}),n.jsx("span",{onClick:()=>e.sortable!==!1&&Rt(o),title:typeof e.label=="string"?e.label:void 0,style:{cursor:e.sortable!==!1?"pointer":"default",flex:i?"none":1,minWidth:0,lineHeight:"20px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.label}),pn&&n.jsx("button",{type:"button",onClick:C=>{C.stopPropagation(),Rt(o)},title:"Sort",style:{background:"transparent",border:"none",padding:4,borderRadius:4,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:Ae?"#0b0b0b":"rgba(11, 11, 11, 0.55)",flexShrink:0},children:Ae?un?n.jsx(W.ArrowUp,{size:14,strokeWidth:1.75}):n.jsx(W.ArrowDown,{size:14,strokeWidth:1.75}):n.jsx(W.ArrowUpDown,{size:14,strokeWidth:1.75})}),hn&&n.jsxs("button",{type:"button",ref:C=>{be.current[o]=C},onClick:C=>{C.stopPropagation(),It(o,C.currentTarget)},title:"Filter",style:{position:"relative",background:mt||lt?"#D8D8D8":"transparent",border:"none",padding:4,borderRadius:4,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:lt?"#0b0b0b":"rgba(11, 11, 11, 0.7)",flexShrink:0},children:[n.jsx(W.ListFilter,{size:14,strokeWidth:1.75}),lt&&n.jsx("span",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,width:6,height:6,borderRadius:"50%",background:"#0B0B0B"}})]})]}),!i&&n.jsx("span",{"aria-hidden":"true",style:{position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",width:1,height:16,background:"#e6e6e6",pointerEvents:"none",zIndex:1}}),!i&&n.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":`Resize ${e.label||o} column`,title:"Drag to resize column",onMouseDown:C=>Gt(C,e,r),onClick:C=>C.stopPropagation(),onMouseEnter:C=>{C.currentTarget.style.background="rgba(30, 33, 37, 0.18)"},onMouseLeave:C=>{C.currentTarget.style.background="transparent"},style:{position:"absolute",top:0,right:-2,width:4,height:"100%",cursor:"col-resize",zIndex:4,background:"transparent"}})]})}const Bt=jt?a.find(e=>G(e)===jt):null,Nt=({col:e,columnId:t,isSelected:o,draggable:i,isAction:r,actualIndex:f})=>{const d=i&&he===f,g=i&&Ht===f&&he!==null&&he!==f;o?Qe.has(t):Ye.has(t);const z=o?!Qe.has(t):Ye.has(t);return n.jsxs("div",{draggable:i,onDragStart:i?_=>nn(_,f):void 0,onDragEnd:i?rn:void 0,onDragOver:i?_=>sn(_,f):void 0,onDragLeave:i?on:void 0,onDrop:i?_=>ln(_,f):void 0,onClick:()=>{r||tn(t)},style:{display:"flex",alignItems:"center",gap:4,padding:"2px 0",cursor:r?"default":i?"grab":"pointer",opacity:d?.5:1,background:g?"#F2F2F0":"transparent",borderRadius:6},children:[n.jsx("span",{style:{width:16,height:16,display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#989898",visibility:i?"visible":"hidden",flexShrink:0},children:n.jsx(W.GripVertical,{size:14,strokeWidth:1.75})}),n.jsx("span",{style:{width:20,height:20,borderRadius:4,display:"inline-flex",alignItems:"center",justifyContent:"center",background:z?"#0B0B0B":"#FFFFFF",border:`1px solid ${z?"#0B0B0B":"#676767"}`,flexShrink:0,marginLeft:8},children:z&&n.jsx(W.Check,{size:14,color:"#FFFFFF",strokeWidth:3})}),n.jsx("span",{style:{flex:1,fontFamily:"var(--font-sans)",fontSize:14,lineHeight:"20px",color:"#0B0B0B",marginLeft:8},children:e.label})]})},cn=le?n.jsxs("div",{ref:dt,style:{position:"fixed",top:`${Ft.top}px`,left:`${Ft.left}px`,width:217,maxHeight:320,zIndex:49,background:"#FFFFFF",border:"1px solid #E6E6E6",borderRadius:10,overflow:"hidden",display:"flex",flexDirection:"column",fontFamily:"var(--font-sans)",boxShadow:"0 8px 24px rgba(11, 11, 11, 0.08)"},children:[n.jsxs("div",{style:{flex:1,minHeight:0,overflowY:"auto",padding:12,display:"flex",flexDirection:"column",gap:12},children:[fe.map((e,t)=>{if(e===T)return null;const o=a.find(i=>G(i)===e);return o?n.jsx(l.Fragment,{children:Nt({col:o,columnId:e,isSelected:!0,draggable:!0,isAction:!1,actualIndex:t})},`selected-${e}-${t}`):null}),a.filter(e=>{const t=G(e);return t!==T&&!fe.includes(t)}).map(e=>{const t=G(e);return n.jsx(l.Fragment,{children:Nt({col:e,columnId:t,isSelected:!1,draggable:!1,isAction:!1,actualIndex:-1})},`unselected-${t}`)})]}),n.jsxs("div",{style:{flexShrink:0,borderTop:"1px solid #D9D9D9",padding:"8px 12px",background:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"space-between",height:46,boxSizing:"border-box"},children:[n.jsx("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation();const t=Ze.current?[...Ze.current]:a.map(G).slice(0,X),o=ie(t);if(ne.current=!1,it(),Ce(o),$e(o),De(new Set),Re(new Set),typeof window<"u"&&ee)try{localStorage.removeItem(ee)}catch{}},style:{background:"transparent",border:"none",padding:0,cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:14,fontWeight:500,color:"#323232"},children:"Reset"}),n.jsx("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),it();const t=en();Ce(t),De(new Set),Re(new Set),ne.current=!0,$e(t),Mt(t),at(!1)},style:{background:"#2E3236",color:"#FFFFFF",border:"none",borderRadius:10,height:28,padding:"0 14px",fontFamily:"var(--font-sans)",fontSize:14,fontWeight:600,cursor:"pointer"},children:"Apply"})]})]}):null,_e=M?a.find(e=>G(e)===M):null,At=_e?n.jsx(Fn,{column:_e,columnId:M,filterType:Xe(M),position:Oe,popoverRef:ve,distinctValues:oe(M),initialValue:J[M],onSearch:typeof _e.onFilterSearch=="function"?_e.onFilterSearch:null,searchMinChars:_e.filterSearchMinChars??3,onApply:e=>{w(M,e),ye(null)},onCancel:()=>ye(null)},M):null;return n.jsxs("div",{className:"w-full",children:[At&&yt.createPortal(At,document.body),a.length>0&&(A||!me)&&n.jsx("div",{className:"pt-2 pb-1",style:{position:"sticky",zIndex:35,backgroundColor:"var(--primary-foreground)"},children:n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:16,flexWrap:"wrap"},children:[A&&n.jsx("div",{style:{marginRight:"auto"},children:n.jsx(Pt,{dateRangePicker:A.dateRangePicker,onWeekToDate:A.onWeekToDate,exportConfig:A.exportConfig,filterChipsConfig:A.filterChipsConfig,trailingActions:A.trailingActions})}),(A==null?void 0:A.rightActions)&&n.jsx("div",{style:{display:"flex",alignItems:"center",gap:12,flexShrink:0},children:A.rightActions}),!me&&n.jsxs("div",{style:{position:"relative"},children:[n.jsxs("button",{ref:Ee,type:"button",onClick:()=>at(!le),style:{display:"inline-flex",alignItems:"center",gap:10,height:32,padding:"0 16px",background:"#FFFFFF",border:"1px solid #D9D9D9",borderRadius:10,cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:14,fontWeight:600,color:"#2E3236",whiteSpace:"nowrap"},children:[n.jsx(W.Settings2,{size:20,strokeWidth:1.75}),"Columns"]}),le&&yt.createPortal(cn,document.body)]})]})}),Object.keys(J).length>0&&n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",padding:"8px 0"},children:[Object.entries(J).map(([e,t])=>{const o=a.find(d=>G(d)===e);if(!o||!qe(t))return null;const i=yn(t),r=bn(t),f=Sn(t);return n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8,height:28,padding:"0 12px",borderRadius:20,border:"1px solid #B2B2B0",background:"#F2F2F0",fontFamily:"var(--font-sans)",fontSize:14,lineHeight:"20px",color:"#0B0B0B",whiteSpace:"nowrap"},children:[n.jsxs("span",{children:[n.jsxs("span",{style:{color:"#676767"},children:[o.label,": "]}),n.jsx("span",{children:i})]}),r>0&&n.jsx(vn,{count:r,values:f}),n.jsx("button",{type:"button",onClick:()=>w(e,[]),"aria-label":`Remove ${o.label} filter`,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",display:"inline-flex",color:"#676767"},children:n.jsx(W.X,{size:14,strokeWidth:2})})]},`chip-${e}`)}),n.jsx("button",{type:"button",onClick:L,style:{marginLeft:"auto",background:"transparent",border:"none",padding:"0 4px",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:14,fontWeight:500,color:"#323232"},children:"Reset"})]}),a.length>0&&ze.length>0?n.jsxs(H.DndContext,{sensors:Ut,collisionDetection:H.closestCenter,onDragStart:Jt,onDragEnd:Xt,children:[n.jsxs("div",{style:{borderRadius:8,border:"1px solid #E6E6E6",overflow:"hidden",background:"var(--primary-foreground)",position:"relative",top:"0.5rem",...N?{minHeight:320}:{}},children:[N&&n.jsx("div",{style:{position:"absolute",inset:0,background:"rgba(255, 255, 255, 0.9)",backdropFilter:"blur(2px)",zIndex:20,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderRadius:"14px"},children:n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px"},children:[n.jsx("p",{style:{fontSize:"13px",color:"rgba(30, 33, 37, 0.6)",margin:0},children:"Loading..."}),n.jsx(kn,{src:"/BrandLoading.gif",alt:"Loading",width:50,height:50,unoptimized:!0,className:"mt-1"})]})}),n.jsx("div",{className:"overflow-x-auto custom-thin-scrollbar-hidden",ref:Kt,style:{maxHeight:"500px",overflowY:"auto",position:"relative",zIndex:1},children:n.jsxs("table",{style:{width:"auto",minWidth:"100%",tableLayout:"fixed",borderCollapse:"collapse",fontSize:"13px",fontFamily:"var(--font-sans)",border:"1px solid #e6e6e6",boxSizing:"border-box"},children:[n.jsx("thead",{children:n.jsxs("tr",{children:[q&&n.jsx("th",{style:{width:ot,minWidth:ot,padding:"10px 8px",textAlign:"center",verticalAlign:"middle",background:"#f2f2f0",borderRight:"1px solid #e6e6e6",borderBottom:"1px solid #e6e6e6",position:"sticky",top:0,zIndex:10,boxSizing:"border-box"},children:n.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",lineHeight:0},children:n.jsx(Dt,{checked:st,indeterminate:Yt,onToggle:Zt,ariaLabel:"Select all rows on this page"})})}),n.jsx(H.SortableContext,{items:$,strategy:H.horizontalListSortingStrategy,children:ze.map(e=>n.jsx(an,{column:e,isHeaderRow:!0},`header-${G(e)}`))})]})}),n.jsx("tbody",{children:!N&&Me.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:ze.length+(q?1:0),style:{padding:"32px",textAlign:"center",color:"rgba(30, 33, 37, 0.42)",fontSize:"12px",fontFamily:"var(--font-sans)"},children:"No results found"})}):!N&&Me.length>0?Me.map((e,t)=>{const o=ht(e,t),i=q&&we.has(o);return n.jsxs("tr",{"data-row-id":e.id||t,style:{borderBottom:"1px solid #e6e6e6",cursor:p?"pointer":"default",transition:"background 0.15s ease",background:i?"#F2F4F7":"transparent"},onClick:p?r=>{r.stopPropagation(),p(e,t)}:void 0,onMouseEnter:r=>{r.currentTarget.style.background="#E6E6E6"},onMouseLeave:r=>{r.currentTarget.style.background=i?"#F2F4F7":"transparent"},children:[q&&n.jsx("td",{onClick:r=>r.stopPropagation(),style:{width:ot,minWidth:ot,padding:"10px 8px",textAlign:"center",verticalAlign:"middle",borderRight:"1px solid #e6e6e6",boxSizing:"border-box"},children:n.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",lineHeight:0},children:n.jsx(Dt,{checked:i,onToggle:()=>Qt(o),ariaLabel:"Select row"})})}),ze.map(r=>{const f=G(r),d=kt(f,r.width),g=e[f],z=r.render?r.render(g,e):g,_=d&&d!=="auto",He=typeof z=="string"&&z.trim()!=="",Be=_&&He,Ne=Be?n.jsx(ce,{content:z,children:z}):z;return n.jsx("td",{style:{padding:"10px 14px",color:"rgba(30, 33, 37, 0.78)",fontSize:"13px",borderRight:"1px solid #e6e6e6",boxSizing:"border-box",width:d,fontFamily:"var(--font-sans)",...Be&&{maxWidth:d||"200px"}},children:Ne},f)})]},t)}):null})]})})]}),n.jsx(H.DragOverlay,{children:Bt?n.jsx("div",{className:"bg-[var(--paper-high)] border border-[var(--border-strong)] rounded px-4 py-2 shadow-lg",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(W.GripVertical,{size:14,className:"text-[var(--text-faint)]"}),n.jsx("span",{className:"text-sm font-semibold text-[var(--text-ink)]",children:Bt.label})]})}):null})]}):null,(()=>{const e=!O&&(ge.trim()!==""||Object.values(J).some(o=>qe(o))),t=V?e?Ie.length:S:Ie.length;return t<=0?null:n.jsx($t.Pagination,{page:je,pageSizeOptions:[5,10,20,50,100],pageSize:xe,totalCount:t,currentDataLength:Me.length,onPageChange:ke,onPageSizeChange:o=>{Ge(o),ke(1)},showPageSizeSelector:!0})})()]})}exports.DataTable2=Dn;exports.DataTableFilters=Pt;
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime"),l=require("react"),H=require("./sortable.esm.cjs.js"),T=require("lucide-react"),bt=require("react-dom"),Pt=require("./CustomFilterChips.cjs.js");require("motion/react");require("recharts");require("./AgentLiftAnalysisCard.cjs.js");require("./TourGuideTooltip.cjs.js");function It({dateRangePicker:s,onWeekToDate:a,exportConfig:u,filterChipsConfig:p,trailingActions:v}){const[S,c]=l.useState(!1),y=l.useRef(null),N=l.useRef(null);l.useEffect(()=>{const j=b=>{N.current&&!N.current.contains(b.target)&&y.current&&!y.current.contains(b.target)&&c(!1)};if(S)return document.addEventListener("mousedown",j),()=>{document.removeEventListener("mousedown",j)}},[S]);const F=()=>{c(j=>!j)},k=j=>{c(!1),u!=null&&u.onExport&&u.onExport(j)},I=(()=>{if(!(p!=null&&p.filters))return!1;const j=p.filters,b=p.customFilters||[],W=Object.entries(j).some(([R,z])=>!!(Array.isArray(z)&&z.length||typeof z=="string"&&z.trim()!==""||z&&typeof z=="object"&&(z.min!=null||z.max!=null))),O=b.some(R=>R.active);return W||O})();return n.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[a&&n.jsxs("button",{onClick:a,className:"inline-flex items-center gap-2 rounded-lg border border-gray-300 bg-white/80 px-4 py-2.5 transition-colors hover:bg-white text-sm font-medium text-gray-900",style:{fontFamily:"var(--font-sans)"},children:[n.jsx(T.CalendarClock,{size:16}),n.jsx("span",{children:"Week to Date"})]}),s&&n.jsx(l.Suspense,{fallback:n.jsxs("div",{className:"inline-flex items-center gap-2 rounded-lg border border-gray-300 bg-white/80 px-4 py-2.5 text-sm font-medium text-gray-400",children:[n.jsx(T.CalendarClock,{size:16}),n.jsx("span",{children:"Loading..."})]}),children:s}),u&&n.jsxs("div",{className:"relative",children:[n.jsxs("button",{ref:y,onClick:F,disabled:u.isExporting,className:"inline-flex items-center justify-between gap-2 rounded-lg border border-gray-300 bg-white/80 px-4 py-2.5 transition-colors hover:bg-white text-sm font-medium text-gray-900 disabled:opacity-50 disabled:cursor-not-allowed min-w-[120px]",style:{fontFamily:"var(--font-sans)"},children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(T.Download,{size:16}),n.jsx("span",{children:u.isExporting?"Exporting...":"Export"})]}),n.jsx(T.ChevronDown,{size:16})]}),S&&n.jsx("div",{ref:N,className:"absolute top-full right-0 mt-2 bg-white rounded-lg shadow-lg border border-gray-200 py-1 z-50 min-w-[120px]",children:(u.types||["csv"]).map(j=>n.jsxs("button",{onClick:()=>k(j),className:"w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 transition-colors",style:{fontFamily:"var(--font-sans)"},children:["Export ",j.toUpperCase()]},j))})]}),(I||v)&&n.jsxs(n.Fragment,{children:[I&&n.jsx("div",{className:"h-9 mt-1 w-px bg-gray-300 flex-shrink-0"}),n.jsxs("div",{className:"flex items-center gap-3 justify-end",children:[I&&p&&n.jsx(Pt.CustomFilterChips,{filters:p.filters,onChange:p.onChange,onClear:p.onClear,customFilters:p.customFilters||[],fieldOptions:p.fieldOptions||{}}),v&&n.jsx("div",{className:"flex-shrink-0",children:v})]})]})]})}function St(s){if(s==null)return NaN;const a=String(s).replace(/[,$%]|pp/gi,"").trim(),u=parseFloat(a);return Number.isFinite(u)?u:NaN}function xn(s){if(s==null)return NaN;const a=String(s).trim(),u=a.match(/^(\d+):(\d+)(?::(\d+))?$/);if(u){const F=+u[1],k=+u[2],D=u[3]!=null?+u[3]:null;return D!=null?F*3600+k*60+D:F*60+k}let p=0,v=!1;const S=a.match(/(\d+)\s*d\b/i),c=a.match(/(\d+)\s*h\b/i),y=a.match(/(\d+)\s*m(?!s)\b/i),N=a.match(/(\d+)\s*s\b/i);return S&&(p+=+S[1]*86400,v=!0),c&&(p+=+c[1]*3600,v=!0),y&&(p+=+y[1]*60,v=!0),N&&(p+=+N[1],v=!0),v?p:NaN}function gn(s){if(!s)return null;const a=String(s).trim(),u=a.match(/^(\d{1,2})\/(\d{1,2})\/(\d{2,4})$/);if(u){const v=u[3].length===2?2e3+ +u[3]:+u[3],S=new Date(v,+u[1]-1,+u[2]);return isNaN(S.getTime())?null:S}const p=new Date(a);return isNaN(p.getTime())?null:p}function yn(s){if(!s||s.length===0)return"text";const a=s.slice(0,25),u=p=>a.every(p);return u(p=>/^\d{1,2}\/\d{1,2}\/\d{2,4}$/.test(p)||/^\d{4}-\d{2}-\d{2}/.test(p))?"date":u(p=>/^\d+\s*[dhms]\b/i.test(p)||/^\d+:\d+(:\d+)?$/.test(p))?"duration":u(p=>/^-?[\d,.]+(%|pp)?$/i.test(p))?"number":"text"}function Ke(s){return s?Array.isArray(s)?s.length>0:s.type==="range"?s.min!==""&&s.min!==void 0&&s.min!==null||s.max!==""&&s.max!==void 0&&s.max!==null:s.type==="durationRange"?s.minSec!==""&&s.minSec!=null||s.maxSec!==""&&s.maxSec!=null:s.type==="scoreRange"?Array.isArray(s.values)&&s.values.length>0||s.min!==""&&s.min!=null||s.max!==""&&s.max!=null:s.type==="dateRange"?!!(s.from||s.to):!1:!1}function Tt(s){if(s==null||s===""||isNaN(s))return"";const a=Number(s),u=Math.floor(a/3600),p=Math.floor(a%3600/60),v=Math.floor(a%60);return u>0?`${u}h ${p}m`:p>0?`${p}m ${v}s`:`${v}s`}function bn(s){if(!s)return"";if(Array.isArray(s))return s.length===0?"":String(s[0]);if(s.type==="range"){const a=s.min!==""&&s.min!=null?s.min:null,u=s.max!==""&&s.max!=null?s.max:null;return a!=null&&u!=null?`${a} – ${u}`:a!=null?`≥ ${a}`:u!=null?`≤ ${u}`:""}if(s.type==="durationRange"){const a=s.minSec!==""&&s.minSec!=null?Tt(s.minSec):null,u=s.maxSec!==""&&s.maxSec!=null?Tt(s.maxSec):null;return a&&u?`${a} – ${u}`:a?`≥ ${a}`:u?`≤ ${u}`:""}if(s.type==="scoreRange"){if(Array.isArray(s.values)&&s.values.length>0)return s.values.slice().sort((p,v)=>p-v).join(", ");const a=s.min!==""&&s.min!=null?s.min:null,u=s.max!==""&&s.max!=null?s.max:null;return a!=null&&u!=null?`${a} – ${u}`:a!=null?`≥ ${a}`:u!=null?`≤ ${u}`:""}return s.type==="dateRange"?s.from&&s.to?`${s.from} – ${s.to}`:s.from?`from ${s.from}`:s.to?`to ${s.to}`:"":""}function Sn(s){return Array.isArray(s)?Math.max(0,s.length-1):0}function vn(s){return Array.isArray(s)?s.slice(1).map(String).join(", "):""}function wn({count:s,values:a}){const[u,p]=l.useState(!1);return n.jsxs("span",{onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",height:22,minWidth:22,padding:"0 6px",background:"#D8D8D8",color:"#0B0B0B",borderRadius:14,fontSize:12,fontWeight:500,lineHeight:1,cursor:"pointer"},children:["+",s,u&&n.jsx("span",{role:"tooltip",style:{position:"absolute",bottom:"calc(100% + 6px)",left:"50%",transform:"translateX(-50%)",background:"#1E2125",color:"#FFFFFF",fontFamily:"var(--font-sans)",fontSize:12,fontWeight:400,lineHeight:"20px",padding:"6px 10px",borderRadius:8,whiteSpace:"nowrap",pointerEvents:"none",zIndex:100,boxShadow:"0 6px 16px rgba(11, 11, 11, 0.18)"},children:a})]})}function Fn({leftLabel:s,rightLabel:a,leftValue:u,rightValue:p,onLeftChange:v,onRightChange:S,type:c="number",placeholderLeft:y="Min",placeholderRight:N="Max"}){const F={width:"100%",height:32,borderRadius:8,border:"1px solid #D9D9D9",background:"#FFFFFF",padding:"0 10px",fontFamily:"var(--font-sans)",fontSize:14,color:"#0B0B0B",outline:"none",boxSizing:"border-box"},k={fontSize:12,color:"#676767",marginBottom:4,fontFamily:"var(--font-sans)"};return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[n.jsx("span",{style:k,children:s}),n.jsx("input",{type:c,value:u,onChange:D=>v(D.target.value),placeholder:y,style:F})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[n.jsx("span",{style:k,children:a}),n.jsx("input",{type:c,value:p,onChange:D=>S(D.target.value),placeholder:N,style:F})]})]})}const $t=[{id:"0-60",label:"0 to 60 Sec",minSec:0,maxSec:60},{id:"60-120",label:"1m to 2 m",minSec:60,maxSec:120},{id:"120-180",label:"2m to 3 m",minSec:120,maxSec:180},{id:"180-240",label:"3m to 4m",minSec:180,maxSec:240},{id:"240-300",label:"4m to 5m",minSec:240,maxSec:300},{id:"300+",label:"5 mins and above",minSec:300,maxSec:null}];function Lt(s){if(s==null||s==="")return null;const a=String(s).trim().match(/^(\d{1,3}):(\d{2})$/);if(a)return Number(a[1])*60+Number(a[2]);const u=Number(s);return Number.isFinite(u)?u:null}function gt({children:s}){return n.jsx("div",{style:{fontSize:14,fontWeight:600,color:"#0B0B0B",lineHeight:"20px",padding:"4px 0 2px",fontFamily:"var(--font-sans)"},children:s})}function yt({minValue:s,maxValue:a,onMinChange:u,onMaxChange:p,inputType:v="number",inputMode:S="decimal",step:c,placeholder:y="0.0",unit:N}){const F={width:"100%",height:30,border:"1px solid #ACADAD",borderRadius:4,padding:"6px 10px",fontSize:13,color:"#0B0B0B",fontFamily:"var(--font-sans)",outline:"none",boxSizing:"border-box"};return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[n.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:8},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,flex:1,minWidth:0},children:[n.jsx("span",{style:{fontSize:12,color:"#2E3236",fontFamily:"var(--font-sans)"},children:"Min From"}),n.jsx("input",{type:v,inputMode:S,step:c,placeholder:y,value:s,onChange:k=>u(k.target.value),style:F})]}),n.jsx("span",{style:{fontSize:12,fontWeight:600,color:"#323232",paddingBottom:8,fontFamily:"var(--font-sans)"},children:"to"}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,flex:1,minWidth:0},children:[n.jsx("span",{style:{fontSize:12,color:"#2E3236",fontFamily:"var(--font-sans)"},children:"Max"}),n.jsx("input",{type:v,inputMode:S,step:c,placeholder:y,value:a,onChange:k=>p(k.target.value),style:F})]})]}),N&&n.jsxs("span",{style:{fontSize:11,color:"#676767",fontFamily:"var(--font-sans)"},children:["Enter durations in ",N==="sec"?"seconds":N]})]})}function jn({column:s,columnId:a,filterType:u="text",position:p,popoverRef:v,distinctValues:S,initialValue:c,onApply:y,onCancel:N,onSearch:F=null,searchMinChars:k=3}){const D=u==="text",I=u==="number",j=u==="date",b=u==="duration",W=u==="score",O=/duration/i.test(String((s==null?void 0:s.label)||a||"")),R=l.useMemo(()=>{if(!W||!Array.isArray(S)||S.length===0)return!1;let h=1/0,m=-1/0;for(const x of S){const w=St(x);Number.isFinite(w)&&(w<h&&(h=w),w>m&&(m=w))}return Number.isFinite(h)&&Number.isFinite(m)&&h>=0&&m<=5},[W,S]),[z,ie]=l.useState(()=>D?new Set(Array.isArray(c)?c:[]):new Set),[pe,K]=l.useState(""),[Y,U]=l.useState(()=>I&&(c==null?void 0:c.type)==="range"&&c.min!=null?c.min:""),[Q,re]=l.useState(()=>I&&(c==null?void 0:c.type)==="range"&&c.max!=null?c.max:""),[E,le]=l.useState(new Set),[ne,$]=l.useState(()=>b&&(c==null?void 0:c.type)==="durationRange"&&c.minSec!=null&&c.minSec!==""?String(c.minSec):""),[J,ae]=l.useState(()=>b&&(c==null?void 0:c.type)==="durationRange"&&c.maxSec!=null&&c.maxSec!==""?String(c.maxSec):""),[ce,Ue]=l.useState(()=>W&&(c==null?void 0:c.type)==="scoreRange"&&Array.isArray(c.values)?new Set(c.values):new Set),[$e,Fe]=l.useState(()=>W&&(c==null?void 0:c.type)==="scoreRange"&&c.min!=null&&c.min!==""?String(c.min):""),[he,je]=l.useState(()=>W&&(c==null?void 0:c.type)==="scoreRange"&&c.max!=null&&c.max!==""?String(c.max):""),[Ge,G]=l.useState(()=>j&&(c==null?void 0:c.type)==="dateRange"&&c.from||""),[L,Z]=l.useState(()=>j&&(c==null?void 0:c.type)==="dateRange"&&c.to||"");l.useEffect(()=>{D&&ie(new Set(Array.isArray(c)?c:[]))},[a,D]);const[Le,V]=l.useState(null),[me,q]=l.useState(!1),xe=l.useRef(0),ee=pe.trim(),Xe=D&&typeof F=="function"&&ee.length>=k;l.useEffect(()=>{if(!D||typeof F!="function")return;if(ee.length<k){V(null),q(!1);return}const h=++xe.current;q(!0);const m=setTimeout(async()=>{try{const x=await F(ee);if(h!==xe.current)return;const w=Array.isArray(x)?x.map(M=>M&&typeof M=="object"?M.label??M.value:M).filter(M=>M!=null&&M!=="").map(String):[];V(w)}catch{h===xe.current&&V([])}finally{h===xe.current&&q(!1)}},300);return()=>clearTimeout(m)},[D,F,ee,k]);const B=l.useMemo(()=>{const h=ee.toLowerCase(),m=Xe?Le||[]:h?S.filter(w=>String(w).toLowerCase().includes(h)):S,x=new Map;for(const w of m)x.set(String(w),w);for(const w of z)x.set(String(w),w);return Array.from(x.values()).sort((w,M)=>{const ye=String(w)==="NA",Ce=String(M)==="NA";if(ye!==Ce)return ye?-1:1;const te=z.has(w),De=z.has(M);return te!==De?te?-1:1:String(w).localeCompare(String(M))})},[S,ee,z,Xe,Le]),ge=h=>{ie(m=>{const x=new Set(m);return x.has(h)?x.delete(h):x.add(h),x})},Je=()=>{D&&ie(new Set),I&&(U(""),re("")),b&&(le(new Set),$(""),ae("")),W&&(Ue(new Set),Fe(""),je("")),j&&(G(""),Z("")),K("")},ke=h=>{le(m=>{const x=new Set(m);return x.has(h)?x.delete(h):x.add(h),x})},be=h=>{Ue(m=>{const x=new Set(m);return x.has(h)?x.delete(h):x.add(h),x})},Se=()=>{if(D)return y(Array.from(z));if(I)return y({type:"range",min:Y===""?"":Number(Y),max:Q===""?"":Number(Q)});if(b){const h=Lt(ne),m=Lt(J),x=h!=null||m!=null;let w="",M="";if(x)w=h??"",M=m??"";else if(E.size>0){const ye=$t.filter(te=>E.has(te.id));w=Math.min(...ye.map(te=>te.minSec)),M=ye.some(te=>te.maxSec==null)?"":Math.max(...ye.map(te=>te.maxSec))}return y({type:"durationRange",minSec:w,maxSec:M})}if(W){const h=$e===""?null:Number($e),m=he===""?null:Number(he);return h!=null||m!=null?y({type:"scoreRange",values:[],min:h!=null&&Number.isFinite(h)?h:"",max:m!=null&&Number.isFinite(m)?m:""}):y({type:"scoreRange",values:Array.from(ce).sort((w,M)=>w-M),min:"",max:""})}if(j)return y({type:"dateRange",from:Ge,to:L})};return n.jsxs("div",{ref:v,role:"dialog","aria-label":`Filter ${s.label||a}`,style:{position:"fixed",top:p.top,left:p.left,zIndex:50,width:D?240:220,background:"#FFFFFF",border:"1px solid #E6E6E6",borderRadius:10,padding:12,display:"flex",flexDirection:"column",gap:10,boxShadow:"0 8px 24px rgba(11, 11, 11, 0.10)",fontFamily:"var(--font-sans)"},children:[D&&n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{background:"#D8D8D8",height:32,borderRadius:10,padding:1,display:"flex",alignItems:"center"},children:n.jsxs("div",{style:{background:"#FFFFFF",flex:1,height:30,borderRadius:10,display:"flex",alignItems:"center",gap:8,padding:"0 8px"},children:[n.jsx(T.Search,{size:16,color:"#989898",strokeWidth:2}),n.jsx("input",{autoFocus:!0,type:"text",value:pe,onChange:h=>K(h.target.value),placeholder:"Search",style:{flex:1,border:"none",outline:"none",background:"transparent",fontSize:14,color:"#0B0B0B",minWidth:0,fontFamily:"var(--font-sans)"}})]})}),n.jsx("div",{style:{maxHeight:220,overflowY:"auto",display:"flex",flexDirection:"column",gap:4},children:typeof F=="function"&&ee.length>0&&ee.length<k?n.jsx("div",{style:{fontSize:13,color:"#676767",padding:"8px 4px",textAlign:"center"},children:`Type at least ${k} characters to search`}):me?n.jsx("div",{style:{fontSize:13,color:"#676767",padding:"8px 4px",textAlign:"center"},children:"Searching…"}):B.length===0?n.jsx("div",{style:{fontSize:13,color:"#676767",padding:"8px 4px",textAlign:"center"},children:"No values"}):B.map(h=>{const m=z.has(h);return n.jsxs("label",{style:{display:"flex",alignItems:"center",gap:12,padding:"6px 4px",cursor:"pointer",borderRadius:6},children:[n.jsx("span",{style:{width:20,height:20,borderRadius:4,display:"inline-flex",alignItems:"center",justifyContent:"center",background:m?"#0B0B0B":"#FFFFFF",border:`1px solid ${m?"#0B0B0B":"#676767"}`,flexShrink:0},children:m&&n.jsx(T.Check,{size:14,color:"#FFFFFF",strokeWidth:3})}),n.jsx("input",{type:"checkbox",checked:m,onChange:()=>ge(h),style:{position:"absolute",opacity:0,pointerEvents:"none"},tabIndex:-1}),n.jsx("span",{onClick:x=>{x.preventDefault(),ge(h)},style:{fontSize:14,lineHeight:"20px",color:"#0B0B0B",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h})]},h)})})]}),I&&n.jsxs(n.Fragment,{children:[n.jsx(gt,{children:s.label||"Filter"}),n.jsx(yt,{minValue:Y,maxValue:Q,onMinChange:U,onMaxChange:re,placeholder:O?"00":"0.0",unit:O?"sec":void 0})]}),b&&n.jsxs(n.Fragment,{children:[n.jsx(gt,{children:s.label||"Duration"}),s.filterShowPresets===!0&&n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:$t.map(h=>{const m=E.has(h.id);return n.jsxs("div",{role:"checkbox","aria-checked":m,tabIndex:0,onClick:()=>ke(h.id),onKeyDown:x=>{(x.key===" "||x.key==="Enter")&&(x.preventDefault(),ke(h.id))},style:{display:"flex",alignItems:"center",gap:12,cursor:"pointer",userSelect:"none"},children:[n.jsx("span",{style:{width:20,height:20,borderRadius:4,display:"inline-flex",alignItems:"center",justifyContent:"center",background:m?"#0B0B0B":"#FFFFFF",border:`1px solid ${m?"#0B0B0B":"#676767"}`,flexShrink:0},children:m&&n.jsx(T.Check,{size:14,color:"#FFFFFF",strokeWidth:3})}),n.jsx("span",{style:{fontSize:14,lineHeight:"20px",color:"#0B0B0B",fontFamily:"var(--font-sans)"},children:h.label})]},h.id)})}),n.jsx("div",{style:{height:1,background:"#D9D9D9",margin:"0 -12px"}}),n.jsx("div",{style:{fontSize:14,fontWeight:500,color:"#0B0B0B",lineHeight:"20px",padding:"4px 0",fontFamily:"var(--font-sans)"},children:"Custom Range"})]}),n.jsx(yt,{minValue:ne,maxValue:J,onMinChange:$,onMaxChange:ae,inputType:"number",inputMode:"numeric",placeholder:"00",unit:"sec"})]}),W&&n.jsxs(n.Fragment,{children:[n.jsx(gt,{children:s.label||"Score"}),R&&s.filterShowPresets===!0&&n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[1,2,3,4,5].map(h=>{const m=ce.has(h);return n.jsxs("div",{role:"checkbox","aria-checked":m,tabIndex:0,onClick:()=>be(h),onKeyDown:x=>{(x.key===" "||x.key==="Enter")&&(x.preventDefault(),be(h))},style:{display:"flex",alignItems:"center",gap:12,cursor:"pointer",userSelect:"none"},children:[n.jsx("span",{style:{width:20,height:20,borderRadius:4,display:"inline-flex",alignItems:"center",justifyContent:"center",background:m?"#0B0B0B":"#FFFFFF",border:`1px solid ${m?"#0B0B0B":"#676767"}`,flexShrink:0},children:m&&n.jsx(T.Check,{size:14,color:"#FFFFFF",strokeWidth:3})}),n.jsx("span",{style:{fontSize:14,lineHeight:"20px",color:"#0B0B0B",fontFamily:"var(--font-sans)"},children:h})]},h)})}),n.jsx("div",{style:{height:1,background:"#D9D9D9",margin:"0 -12px"}})]}),R&&s.filterShowPresets===!0&&n.jsx("div",{style:{fontSize:14,fontWeight:500,color:"#0B0B0B",lineHeight:"20px",padding:"4px 0",fontFamily:"var(--font-sans)"},children:"Custom Range"}),n.jsx(yt,{minValue:$e,maxValue:he,onMinChange:Fe,onMaxChange:je,step:"0.1"})]}),j&&n.jsx(Fn,{leftLabel:"From",rightLabel:"To",leftValue:Ge,rightValue:L,onLeftChange:G,onRightChange:Z,type:"date",placeholderLeft:"",placeholderRight:""}),n.jsx("div",{style:{height:1,background:"#D9D9D9",margin:"0 -12px"}}),n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[n.jsx("button",{type:"button",onClick:Je,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",fontSize:14,fontWeight:500,color:"#323232",fontFamily:"var(--font-sans)"},children:b&&s.filterShowPresets===!0||W&&R&&s.filterShowPresets===!0?"View All":"Reset"}),n.jsx("button",{type:"button",onClick:Se,style:{background:"#0B0B0B",color:"#FFFFFF",border:"none",borderRadius:10,height:28,padding:"0 14px",fontSize:14,fontWeight:500,cursor:"pointer",fontFamily:"var(--font-sans)"},children:"Apply"})]})]})}const kn=()=>({userData:{email:"anonymous"}}),Cn=s=>n.jsx("img",{...s});function Dn({children:s,content:a,direction:u="top",align:p="center",styling:v,indicatorColor:S}){const c=typeof a=="string"?a:a!=null?String(a):"",y=typeof S=="string"&&(S.startsWith("#")||S.startsWith("rgb")||S.startsWith("hsl")||S.startsWith("var("))?S:"var(--Grey-Strong, #2E3236)",[N,F]=l.useState(!1),[k,D]=l.useState(!1),[I,j]=l.useState({top:0,left:0,arrowLeft:0,placement:"top"}),b=l.useRef(null),W=l.useRef(null);if(!c)return s;l.useEffect(()=>{D(!0)},[]);const O=l.useCallback(()=>{if(!b.current||!W.current||typeof window>"u")return;const R=b.current.getBoundingClientRect(),z=W.current.getBoundingClientRect(),ie=window.innerWidth,pe=window.innerHeight,K=8,Y=10,U=z.width,Q=z.height,re=R.top,E=pe-R.bottom,le=u==="bottom"?"bottom":"top";let ne=le;le==="top"&&re<Q+Y+K&&E>re?ne="bottom":le==="bottom"&&E<Q+Y+K&&re>E&&(ne="top");let $=R.left+R.width/2;p==="start"&&($=R.left),p==="end"&&($=R.right);let J=ne==="top"?R.top-Q-Y:R.bottom+Y,ae=p==="start"?$:p==="end"?$-U:$-U/2;J=Math.max(K,Math.min(J,pe-Q-K)),ae=Math.max(K,Math.min(ae,ie-U-K));const ce=Math.max(10,Math.min($-ae,U-10));j({top:J,left:ae,arrowLeft:ce,placement:ne})},[p,u]);return l.useEffect(()=>{if(!N||!k)return;O();const R=()=>O();return window.addEventListener("resize",R),window.addEventListener("scroll",R,!0),()=>{window.removeEventListener("resize",R),window.removeEventListener("scroll",R,!0)}},[N,k,O]),n.jsxs("span",{ref:b,style:{display:"block",width:"100%"},onMouseEnter:()=>F(!0),onMouseLeave:()=>F(!1),children:[s,N&&k&&bt.createPortal(n.jsxs("span",{ref:W,style:{position:"fixed",top:`${I.top}px`,left:`${I.left}px`,background:"var(--Grey-Strong, #2E3236)",color:"var(--Grey-White, #FFF)",fontSize:"12px",lineHeight:1.3,fontWeight:500,padding:"8px 10px",borderRadius:"6px",whiteSpace:"normal",maxWidth:"320px",width:"max-content",boxShadow:"0 6px 18px rgba(0, 0, 0, 0.2)",zIndex:99999,pointerEvents:"none",...typeof v=="object"?v:{}},children:[c,n.jsx("span",{style:{position:"absolute",left:`${I.arrowLeft}px`,transform:"translateX(-50%)",width:0,height:0,borderLeft:"6px solid transparent",borderRight:"6px solid transparent",...I.placement==="top"?{top:"100%",borderTop:`7px solid ${y}`}:{bottom:"100%",borderBottom:`7px solid ${y}`}}})]}),document.body)]})}function Rn({data:s=[],columns:a=[],initialPageSize:u=10,onRowClick:p,totalCount:v=null,page:S=null,pageSize:c=null,onPageChange:y=null,onPageSizeChange:N=null,onFilterChange:F=null,columnFilters:k=null,onMaxColumnsError:D=null,onSort:I=null,sortFields:j=[],tableId:b=null,isLoading:W=!1,filtersConfig:O=null,columnResizeMinWidth:R=120,columnResizeMaxWidth:z=280,onVisibleColumnsChange:ie=null,hideColumnPicker:pe=!1,selectable:K=!1,selectedRowIds:Y=null,onSelectionChange:U=null,getRowId:Q=null}){var Ot;const{userData:re}=kn(),E=(re==null?void 0:re.email)||"anonymous",le=l.memo(({children:e,content:t,className:o=""})=>{const i=l.useRef(null),[r,f]=l.useState(!1);l.useEffect(()=>{const g=()=>{if(i.current){const _=i.current.scrollWidth>i.current.clientWidth;f(_)}};g();const A=setTimeout(g,0);return window.addEventListener("resize",g),()=>{clearTimeout(A),window.removeEventListener("resize",g)}},[e,t]);const d=n.jsx("span",{className:`truncate block ${o}`,ref:i,children:e});return r&&t?n.jsx(Dn,{content:t,styling:"bg-green-2 text-gray-900 px-3 py-2 text-sm rounded-lg shadow-md border border-gray-300 max-w-xs whitespace-normal",indicatorColor:"bg-green-2",direction:"top",children:d}):d});le.displayName="TruncatedCell";const ne=v!==null&&y!==null,$=F!==null,J=I!==null,[ae,ce]=l.useState(1),[Ue,$e]=l.useState(u),Fe=S!==null?S:ae,he=c!==null?c:Ue,je=e=>{y?y(e):ce(e)},Ge=e=>{N?N(e):$e(e)},G=50,L="action",Z=l.useRef(!1),Le=l.useRef(null),V=l.useMemo(()=>b?`dataTable_columns_${b}:${E}`:`dataTable_columns_${a.map(t=>t.id||t.key).sort().join("_")}:${E}`,[b,a,E]),me=l.useMemo(()=>b?`dataTable_manual_change_${b}:${E}`:null,[b,E]);l.useCallback((e,t)=>{if(typeof window>"u"||!e||!t||t.length===0)return null;try{const o=localStorage.getItem(e);if(o){const r=JSON.parse(o).filter(f=>t.some(d=>(d.id||d.key)===f));if(r.length>0)return r}}catch(o){console.warn("Failed to load saved columns from localStorage:",o)}return null},[]);const[q,xe]=l.useState({}),[ee,Xe]=l.useState(""),[B,ge]=l.useState(null),[Je,ke]=l.useState({top:0,left:0}),be=l.useRef(null),Se=l.useRef({}),[h,m]=l.useState(null),[x,w]=l.useState("asc"),M=l.useCallback((e,t)=>{const o=Ke(t);xe(i=>{const r={...i};return o?r[e]=t:delete r[e],r}),y?y(1):ce(1),$&&F&&F(o?{...q,[e]:t}:Object.fromEntries(Object.entries(q).filter(([i])=>i!==e)))},[q,F,$,y]),ye=l.useCallback(()=>{xe({}),Xe(""),y?y(1):ce(1),$&&F&&F({})},[F,$,y]),Ce=l.useCallback(e=>{const t=a.find(r=>(r.id||r.key)===e);if(t&&Array.isArray(t.filterOptions)){const r=new Set,f=[];for(const d of t.filterOptions){if(d==null||d==="")continue;const g=typeof d=="object"?JSON.stringify(d):String(d);r.has(g)||(r.add(g),f.push(g))}return f.sort((d,g)=>d.localeCompare(g))}if(!s||s.length===0)return[];const o=new Set,i=[];for(const r of s){const f=r[e];if(f==null)continue;const d=typeof f=="object"?JSON.stringify(f):String(f);o.has(d)||(o.add(d),i.push(d))}return i.sort((r,f)=>r.localeCompare(f))},[s,a]),te=l.useCallback(e=>{const t=a.find(o=>X(o)===e);return t&&t.filterType?t.filterType:yn(Ce(e))},[a,Ce]),De=l.useCallback(e=>{const i=typeof window<"u"?window.innerWidth:1/0;let r=e.left;return r+280>i-8&&(r=Math.max(8,e.right-280)),{top:e.bottom+6,left:r}},[]),_t=l.useCallback((e,t)=>{if(!t){ge(e);return}const o=t.getBoundingClientRect();ke(De(o)),ge(i=>i===e?null:e)},[De]);l.useEffect(()=>{if(!B)return;const e=t=>{if(be.current&&be.current.contains(t.target))return;const o=Se.current[B];o&&o.contains(t.target)||Object.values(Se.current).some(r=>r&&r.contains(t.target))||ge(null)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[B]),l.useEffect(()=>{if(!B)return;const e=()=>{const t=Se.current[B];if(!t)return;const o=t.getBoundingClientRect();ke(De(o))};return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[B,De]),l.useLayoutEffect(()=>{if(!B)return;const e=be.current,t=Se.current[B];if(!e||!t)return;const o=e.offsetWidth,i=t.getBoundingClientRect(),r=8,f=typeof window<"u"?window.innerWidth:1/0;if(!(i.left+o>f-r))return;const g=Math.max(r,i.right-o);ke(A=>A.left===g?A:{...A,left:g})},[B,Je.top]);const vt=l.useCallback(e=>!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([,t])=>t==null?!1:typeof t=="string"?t.trim()!=="":!0)),[]),wt=l.useCallback((e,t)=>{const o=Object.keys(e||{}),i=Object.keys(t||{});return o.length!==i.length?!1:o.every(r=>e[r]===t[r])},[]);l.useEffect(()=>{if(!$||k===null)return;const e=vt(k);xe(t=>wt(t,e)?t:e)},[$,k,vt,wt]),l.useCallback((e,t)=>e==="csat_score"&&t==="evaluation.csat_score"?t:e,[]);const Pe=J&&j.length>0?j[0][0]:h,Ye=J&&j.length>0?j[0][1]:x,[En,Ft]=l.useState(()=>a.map(e=>e.id||e.key)),se=l.useCallback(e=>{if(!e||e.length===0)return e;let t=Array.from(new Set(e));t.length>G&&(t=t.slice(0,G));const i=a.map(d=>d.id||d.key).includes(L);return!t.includes(L)&&i&&(t.length>=G?t=[...t.slice(0,G-1),L]:t=[...t,L]),[...t.filter(d=>d!==L),L]},[a]),[P,Re]=l.useState(()=>{if(typeof window<"u"&&b)try{if(localStorage.getItem(`dataTable_manual_change_${b}:${E}`)==="true"){const i=localStorage.getItem(`dataTable_columns_${b}:${E}`);if(i){const r=JSON.parse(i);if(Array.isArray(r)&&r.length>0){Z.current=!0;const f=r.filter(d=>a.some(g=>(g.id||g.key)===d));if(f.length>0)return f.slice(0,G)}}}}catch(o){console.warn("Failed to load saved columns from localStorage:",o)}const t=a.map(o=>o.id||o.key).slice(0,G);return se(t)}),[oe,ct]=l.useState(!1),[de,Ee]=l.useState([]),[jt,Ht]=l.useState({top:0,left:0,width:0}),[Qe,Me]=l.useState(new Set),[Ze,ze]=l.useState(new Set),ue=l.useRef({}),Ve=l.useRef(null);Ve.current===null&&(Ve.current=[...P]);const[fe,dt]=l.useState(null),[qt,et]=l.useState(null),Be=l.useRef(null),ut=l.useRef(null),ft=l.useRef(null),[kt,pt]=l.useState(null),[ht,Kt]=l.useState({}),Ut=l.useRef(null),tt=l.useRef(null),X=e=>e.id||e.key,nt=l.useCallback(e=>{if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){const t=e.trim();if(t.endsWith("px")){const i=parseFloat(t);return Number.isFinite(i)?i:null}const o=parseFloat(t);return Number.isFinite(o)&&`${o}`===t?o:null}return null},[]),Ct=l.useCallback((e,t)=>ht[e]!=null?`${ht[e]}px`:typeof t=="number"?`${t}px`:t||"auto",[ht]),rt=l.useCallback(e=>{if(!tt.current)return;const{columnId:t,startX:o,startWidth:i,minWidth:r,maxWidth:f}=tt.current,d=e.clientX-o,g=Math.round(i+d),A=Math.min(f,Math.max(r,g));Kt(_=>({..._,[t]:A}))},[]),Ie=l.useCallback(()=>{tt.current=null,document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",rt),document.removeEventListener("mouseup",Ie)},[rt]),Gt=l.useCallback((e,t,o)=>{var Oe;e.preventDefault(),e.stopPropagation();const i=t.id||t.key,r=nt(t.minWidth)??R,f=nt(t.maxWidth)??z,d=Math.min(r,f),g=Math.max(r,f),A=((Oe=e.currentTarget.closest("th"))==null?void 0:Oe.getBoundingClientRect().width)||0,_=nt(o),qe=_??Math.max(d,Math.round(A)||d),We=Math.min(g,Math.max(d,qe));tt.current={columnId:i,startX:e.clientX,startWidth:We,minWidth:d,maxWidth:g},document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",rt),document.addEventListener("mouseup",Ie)},[z,R,rt,Ie,nt]);l.useEffect(()=>()=>Ie(),[Ie]);const Xt=H.useSensors(H.useSensor(H.PointerSensor),H.useSensor(H.KeyboardSensor,{coordinateGetter:H.sortableKeyboardCoordinates})),Jt=e=>{const{active:t,over:o}=e;if(o&&t.id!==o.id){if(t.id===L||o.id===L){Mt("Cannot drop columns on the Action column"),pt(null);return}Z.current=!0,Re(i=>{const r=i.indexOf(t.id),f=i.indexOf(o.id);if(r!==-1&&f!==-1){const d=H.arrayMove(i,r,f),g=se(d);return zt(g),g}return i}),Ft(i=>{const r=i.indexOf(t.id),f=i.indexOf(o.id);return H.arrayMove(i,r,f)})}pt(null)},Yt=e=>{pt(e.active.id)},st=l.useMemo(()=>{if($)return s||[];if(!s||s.length===0)return[];const e=ee.trim().toLowerCase(),t=Object.entries(q).filter(([,o])=>Ke(o));return s.filter(o=>{for(const[i,r]of t){const f=o[i];if(f==null)return!1;if(Array.isArray(r)){const d=String(f);if(!r.some(g=>String(g)===d))return!1;continue}if(r.type==="range"){const d=St(f);if(isNaN(d)||r.min!==""&&r.min!=null&&d<Number(r.min)||r.max!==""&&r.max!=null&&d>Number(r.max))return!1;continue}if(r.type==="durationRange"){const d=xn(f);if(isNaN(d)||r.minSec!==""&&r.minSec!=null&&d<Number(r.minSec)||r.maxSec!==""&&r.maxSec!=null&&d>Number(r.maxSec))return!1;continue}if(r.type==="scoreRange"){const d=St(f);if(isNaN(d))return!1;if(Array.isArray(r.values)&&r.values.length>0){const g=Math.floor(d);if(!r.values.includes(g))return!1;continue}if(r.min!==""&&r.min!=null&&d<Number(r.min)||r.max!==""&&r.max!=null&&d>Number(r.max))return!1;continue}if(r.type==="dateRange"){const d=gn(f);if(!d)return!1;if(r.from){const g=new Date(r.from+"T00:00:00");if(d<g)return!1}if(r.to){const g=new Date(r.to+"T23:59:59");if(d>g)return!1}continue}}return!(e&&!Object.values(o).some(r=>r==null?!1:String(r).toLowerCase().includes(e)))})},[s,q,ee,$]),_e=l.useMemo(()=>J||!Pe?st:[...st].sort((e,t)=>{const o=e[Pe],i=t[Pe];if(o==null)return 1;if(i==null)return-1;if(typeof o=="number"&&typeof i=="number")return Ye==="asc"?o-i:i-o;const r=String(o).toLowerCase(),f=String(i).toLowerCase();return Ye==="asc"?r.localeCompare(f):f.localeCompare(r)}),[st,Pe,Ye,J]),Ae=l.useMemo(()=>{if(ne)return _e;{const e=(Fe-1)*he,t=e+he;return _e.slice(e,t)}},[_e,Fe,he,ne]),mt=l.useCallback((e,t)=>Q?Q(e,t):(e==null?void 0:e.id)??t,[Q]),ve=l.useMemo(()=>new Set(Array.isArray(Y)?Y:[]),[Y]),we=l.useMemo(()=>Ae.map((e,t)=>mt(e,t)),[Ae,mt]),Dt=l.useMemo(()=>we.reduce((e,t)=>ve.has(t)?e+1:e,0),[we,ve]),ot=we.length>0&&Dt===we.length,Qt=Dt>0&&!ot,Zt=l.useCallback(e=>{if(!U)return;const t=new Set(ve);t.has(e)?t.delete(e):t.add(e),U(Array.from(t))},[U,ve]),Vt=l.useCallback(()=>{if(!U)return;const e=new Set(ve);ot?we.forEach(t=>e.delete(t)):we.forEach(t=>e.add(t)),U(Array.from(e))},[U,ve,ot,we]),Rt=({checked:e,indeterminate:t=!1,onToggle:o,ariaLabel:i})=>n.jsx("span",{role:"checkbox","aria-checked":t?"mixed":e,"aria-label":i,tabIndex:0,onClick:r=>{r.stopPropagation(),o()},onKeyDown:r=>{(r.key===" "||r.key==="Enter")&&(r.preventDefault(),r.stopPropagation(),o())},style:{width:16,height:16,borderRadius:5,display:"inline-flex",alignItems:"center",justifyContent:"center",background:e||t?"#0B0B0B":"#FFFFFF",border:`1px solid ${e||t?"#0B0B0B":"#676767"}`,cursor:"pointer",flexShrink:0},children:t?n.jsx(T.Minus,{size:11,color:"#FFFFFF",strokeWidth:3}):e?n.jsx(T.Check,{size:11,color:"#FFFFFF",strokeWidth:3}):null}),it=44,Et=e=>{J&&I?(I(e),y?y(1):ce(1)):(h===e?w(x==="asc"?"desc":"asc"):(m(e),w("asc")),je(1))},en=(e,t)=>{const o=(t||"").split(/\s+/).map(i=>i.trim()).filter(Boolean);M(e,o)},Mt=e=>{ft.current||(typeof D=="function"&&D(e),ft.current=setTimeout(()=>{ft.current=null},3e3))},zt=l.useCallback(e=>{if(typeof window<"u"&&V&&e.length>0&&Z.current)try{localStorage.setItem(V,JSON.stringify(e)),me&&localStorage.setItem(me,"true")}catch(t){console.warn("Failed to save columns to localStorage:",t)}},[V,me]),Bt=250,lt=()=>{Object.values(ue.current).forEach(e=>clearTimeout(e)),ue.current={}},tn=()=>{const e=de.filter(t=>!Ze.has(t));return Qe.forEach(t=>{e.includes(t)||e.push(t)}),se(e)},nn=e=>{if(e===L)return;if(ue.current[e]){clearTimeout(ue.current[e]),delete ue.current[e],Me(o=>{const i=new Set(o);return i.delete(e),i}),ze(o=>{const i=new Set(o);return i.delete(e),i});return}if(de.includes(e)){if(de.length-Ze.size<=1)return;ze(i=>new Set(i).add(e)),ue.current[e]=setTimeout(()=>{Ee(i=>i.filter(r=>r!==e)),ze(i=>{const r=new Set(i);return r.delete(e),r}),delete ue.current[e]},Bt)}else{if(de.length+Qe.size>=G){Mt("Maximum 9 column selection allowed");return}Me(i=>new Set(i).add(e)),ue.current[e]=setTimeout(()=>{Ee(i=>se([...i,e])),Me(i=>{const r=new Set(i);return r.delete(e),r}),delete ue.current[e]},Bt)}},rn=(e,t)=>{de[t]!==L&&dt(t)},sn=()=>{dt(null),et(null)},on=(e,t)=>{e.preventDefault(),fe!==null&&fe!==t&&et(t)},ln=()=>{et(null)},an=(e,t)=>{e.preventDefault(),fe!==null&&fe!==t&&de[t]!==L&&de[fe]!==L&&Ee(o=>{const i=H.arrayMove(o,fe,t);return se(i)}),dt(null),et(null)};l.useEffect(()=>{Ft(e=>{const t=P.filter(r=>e.includes(r)),o=P.filter(r=>!e.includes(r)),i=e.filter(r=>!P.includes(r));return[...t,...o,...i]})},[P]),l.useEffect(()=>{if(typeof window<"u"&&V&&P.length>0&&Z.current)try{const e=se(P);localStorage.setItem(V,JSON.stringify(e)),me&&localStorage.setItem(me,"true")}catch(e){console.warn("Failed to save columns to localStorage:",e)}},[P,V,me]),l.useEffect(()=>{ie&&ie(P.filter(e=>e!==L))},[P,ie]),l.useEffect(()=>{if(a.length>0&&P.length===0){if(typeof window<"u"&&b)try{if(localStorage.getItem(`dataTable_manual_change_${b}:${E}`)==="true"){const o=localStorage.getItem(`dataTable_columns_${b}:${E}`);if(o){const i=JSON.parse(o);if(Array.isArray(i)&&i.length>0){const r=i.filter(f=>a.some(d=>(d.id||d.key)===f));if(r.length>0){Z.current=!0,Re(r.slice(0,G));return}}}}}catch(t){console.warn("Failed to load saved columns from localStorage:",t)}const e=a.map(t=>t.id||t.key);Re(se(e.slice(0,G)))}},[a,b,E,se]),l.useEffect(()=>{if(!(typeof window>"u"||!b)&&!(!a||a.length===0)&&Le.current!==E&&(Le.current=E,!Z.current))try{if(!(localStorage.getItem(`dataTable_manual_change_${b}:${E}`)==="true"))return;const t=localStorage.getItem(`dataTable_columns_${b}:${E}`);if(!t)return;const o=JSON.parse(t);if(!Array.isArray(o)||o.length===0)return;const i=o.filter(r=>a.some(f=>(f.id||f.key)===r));i.length>0&&(Z.current=!0,Re(i.slice(0,G)))}catch(e){console.warn("Failed to re-load saved columns after user resolved:",e)}},[E,b,a]);const Ne=l.useMemo(()=>{const e=P.map(t=>a.find(o=>X(o)===t)).filter(Boolean);return se(e.map(X)).map(t=>a.find(o=>X(o)===t)).filter(Boolean)},[a,P]);l.useMemo(()=>Ne.some(e=>e.filterable===!0),[Ne]),l.useEffect(()=>{if(!oe||!Be.current)return;const e=()=>{if(Be.current){const t=Be.current.getBoundingClientRect(),o=217,i=Math.max(8,t.right-o);Ht({top:t.bottom,left:i,width:Math.max(t.width||220,220)})}};return e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[oe]),l.useEffect(()=>{const e=t=>{oe&&Be.current&&!Be.current.contains(t.target)&&ut.current&&!ut.current.contains(t.target)&&ct(!1)};if(oe)return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[oe]),l.useEffect(()=>{oe&&(lt(),Ee(P),Me(new Set),ze(new Set))},[oe,P]),l.useEffect(()=>()=>lt(),[]),P.length===1?(Ot=a.find(e=>(e.id||e.key)===P[0]))!=null&&Ot.label:`${P.length}`;function cn({column:e,isHeaderRow:t=!0}){const o=X(e),i=o===L,r=Ct(o,e.width),[f,d]=l.useState(!1),{attributes:g,listeners:A,setNodeRef:_,transform:qe,transition:We,isDragging:Oe}=H.useSortable({id:o}),un={transform:H.CSS.Transform.toString(qe),transition:We,opacity:Oe?.5:1,width:r,minWidth:r};let Te=!1;if(J&&j.length>0){const C=j[0][0];(C===o||C==="csat_score"&&o==="evaluation.csat_score")&&(Te=!0)}else Te=Pe===o;const fn=Ye==="asc",pn=e.filterable===!0;if(!t)return n.jsx("th",{style:{width:r,minWidth:r,backgroundColor:"var(--primary-foreground)",borderRight:"1px solid #e6e6e6",borderBottom:"1px solid #e6e6e6",boxSizing:"border-box"},className:"sticky top-[57px] z-10 border-b border-[var(--border-strong)] px-4 py-2 text-left",children:pn?n.jsxs("div",{className:"relative",children:[n.jsx(Filter,{size:12,className:"absolute left-2 top-1/2 -translate-y-1/2 text-[var(--text-faint)] pointer-events-none"}),n.jsx("input",{type:"text",placeholder:"Filter...",value:q[o]||"",onChange:C=>{C.stopPropagation(),en(o,C.target.value)},onKeyDown:C=>C.stopPropagation(),onMouseDown:C=>C.stopPropagation(),className:"w-full pl-7 pr-2 py-1.5 text-xs border border-[var(--border)] rounded text-[var(--text-ink)] placeholder:text-[var(--text-faint)] focus:outline-none focus:border-[var(--border-hover)] focus:ring-1 focus:ring-[var(--focus)] transition-colors",style:{fontFamily:"var(--font-sans)",backgroundColor:"var(--primary-foreground)"},autoComplete:"off"})]}):n.jsx("div",{className:"h-[34px]"})});const xt=B===o,at=Ke(q[o]),hn=e.sortable!==!1&&(f||Te),mn=e.filterable!==!1&&!i&&(f||xt||at);return n.jsxs("th",{ref:_,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{...un,padding:"0 12px",height:36,textAlign:i?"center":"left",fontWeight:500,fontSize:"14px",letterSpacing:"normal",textTransform:"none",color:"#0b0b0b",cursor:e.sortable!==!1?"pointer":"default",width:r,...typeof r=="string"&&r.endsWith("px")?{maxWidth:r}:{},borderRight:"1px solid #e6e6e6",boxSizing:"border-box",userSelect:"none",whiteSpace:"nowrap",wordBreak:"normal",overflowWrap:"normal",verticalAlign:"middle",background:f||xt?"#e6e6e6":"#f2f2f0",borderBottom:"1px solid #e6e6e6",position:"sticky",top:0,zIndex:10,fontFamily:"var(--font-sans)",transition:"background 100ms ease"},children:[!i&&n.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",transform:"translateY(-50%)",width:1,height:16,background:"#e6e6e6",pointerEvents:"none",zIndex:1}}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",justifyContent:i?"center":"flex-start",position:"relative",minHeight:20,minWidth:0,width:"100%",overflow:"hidden"},children:[!i&&n.jsx("div",{...g,...A,style:{cursor:"grab",color:"rgba(11, 11, 11, 0.36)",display:"inline-flex",alignItems:"center",visibility:f?"visible":"hidden",flexShrink:0},children:n.jsx(T.GripVertical,{size:14})}),n.jsx("span",{onClick:()=>e.sortable!==!1&&Et(o),title:typeof e.label=="string"?e.label:void 0,style:{cursor:e.sortable!==!1?"pointer":"default",flex:i?"none":1,minWidth:0,lineHeight:"20px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.label}),hn&&n.jsx("button",{type:"button",onClick:C=>{C.stopPropagation(),Et(o)},title:"Sort",style:{background:"transparent",border:"none",padding:4,borderRadius:4,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:Te?"#0b0b0b":"rgba(11, 11, 11, 0.55)",flexShrink:0},children:Te?fn?n.jsx(T.ArrowUp,{size:14,strokeWidth:1.75}):n.jsx(T.ArrowDown,{size:14,strokeWidth:1.75}):n.jsx(T.ArrowUpDown,{size:14,strokeWidth:1.75})}),mn&&n.jsxs("button",{type:"button",ref:C=>{Se.current[o]=C},onClick:C=>{C.stopPropagation(),_t(o,C.currentTarget)},title:"Filter",style:{position:"relative",background:xt||at?"#D8D8D8":"transparent",border:"none",padding:4,borderRadius:4,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:at?"#0b0b0b":"rgba(11, 11, 11, 0.7)",flexShrink:0},children:[n.jsx(T.ListFilter,{size:14,strokeWidth:1.75}),at&&n.jsx("span",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,width:6,height:6,borderRadius:"50%",background:"#0B0B0B"}})]})]}),!i&&n.jsx("span",{"aria-hidden":"true",style:{position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",width:1,height:16,background:"#e6e6e6",pointerEvents:"none",zIndex:1}}),!i&&n.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":`Resize ${e.label||o} column`,title:"Drag to resize column",onMouseDown:C=>Gt(C,e,r),onClick:C=>C.stopPropagation(),onMouseEnter:C=>{C.currentTarget.style.background="rgba(30, 33, 37, 0.18)"},onMouseLeave:C=>{C.currentTarget.style.background="transparent"},style:{position:"absolute",top:0,right:-2,width:4,height:"100%",cursor:"col-resize",zIndex:4,background:"transparent"}})]})}const At=kt?a.find(e=>X(e)===kt):null,Nt=({col:e,columnId:t,isSelected:o,draggable:i,isAction:r,actualIndex:f})=>{const d=i&&fe===f,g=i&&qt===f&&fe!==null&&fe!==f;o?Ze.has(t):Qe.has(t);const A=o?!Ze.has(t):Qe.has(t);return n.jsxs("div",{draggable:i,onDragStart:i?_=>rn(_,f):void 0,onDragEnd:i?sn:void 0,onDragOver:i?_=>on(_,f):void 0,onDragLeave:i?ln:void 0,onDrop:i?_=>an(_,f):void 0,onClick:()=>{r||nn(t)},style:{display:"flex",alignItems:"center",gap:4,padding:"2px 0",cursor:r?"default":i?"grab":"pointer",opacity:d?.5:1,background:g?"#F2F2F0":"transparent",borderRadius:6},children:[n.jsx("span",{style:{width:16,height:16,display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#989898",visibility:i?"visible":"hidden",flexShrink:0},children:n.jsx(T.GripVertical,{size:14,strokeWidth:1.75})}),n.jsx("span",{style:{width:20,height:20,borderRadius:4,display:"inline-flex",alignItems:"center",justifyContent:"center",background:A?"#0B0B0B":"#FFFFFF",border:`1px solid ${A?"#0B0B0B":"#676767"}`,flexShrink:0,marginLeft:8},children:A&&n.jsx(T.Check,{size:14,color:"#FFFFFF",strokeWidth:3})}),n.jsx("span",{style:{flex:1,fontFamily:"var(--font-sans)",fontSize:14,lineHeight:"20px",color:"#0B0B0B",marginLeft:8},children:e.label})]})},dn=oe?n.jsxs("div",{ref:ut,style:{position:"fixed",top:`${jt.top}px`,left:`${jt.left}px`,width:217,maxHeight:320,zIndex:49,background:"#FFFFFF",border:"1px solid #E6E6E6",borderRadius:10,overflow:"hidden",display:"flex",flexDirection:"column",fontFamily:"var(--font-sans)",boxShadow:"0 8px 24px rgba(11, 11, 11, 0.08)"},children:[n.jsxs("div",{style:{flex:1,minHeight:0,overflowY:"auto",padding:12,display:"flex",flexDirection:"column",gap:12},children:[de.map((e,t)=>{if(e===L)return null;const o=a.find(i=>X(i)===e);return o?n.jsx(l.Fragment,{children:Nt({col:o,columnId:e,isSelected:!0,draggable:!0,isAction:!1,actualIndex:t})},`selected-${e}-${t}`):null}),a.filter(e=>{const t=X(e);return t!==L&&!de.includes(t)}).map(e=>{const t=X(e);return n.jsx(l.Fragment,{children:Nt({col:e,columnId:t,isSelected:!1,draggable:!1,isAction:!1,actualIndex:-1})},`unselected-${t}`)})]}),n.jsxs("div",{style:{flexShrink:0,borderTop:"1px solid #D9D9D9",padding:"8px 12px",background:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"space-between",height:46,boxSizing:"border-box"},children:[n.jsx("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation();const t=Ve.current?[...Ve.current]:a.map(X).slice(0,G),o=se(t);if(Z.current=!1,lt(),Ee(o),Re(o),Me(new Set),ze(new Set),typeof window<"u"&&V)try{localStorage.removeItem(V)}catch{}},style:{background:"transparent",border:"none",padding:0,cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:14,fontWeight:500,color:"#323232"},children:"Reset"}),n.jsx("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),lt();const t=tn();Ee(t),Me(new Set),ze(new Set),Z.current=!0,Re(t),zt(t),ct(!1)},style:{background:"#2E3236",color:"#FFFFFF",border:"none",borderRadius:10,height:28,padding:"0 14px",fontFamily:"var(--font-sans)",fontSize:14,fontWeight:600,cursor:"pointer"},children:"Apply"})]})]}):null,He=B?a.find(e=>X(e)===B):null,Wt=He?n.jsx(jn,{column:He,columnId:B,filterType:te(B),position:Je,popoverRef:be,distinctValues:Ce(B),initialValue:q[B],onSearch:typeof He.onFilterSearch=="function"?He.onFilterSearch:null,searchMinChars:He.filterSearchMinChars??3,onApply:e=>{M(B,e),ge(null)},onCancel:()=>ge(null)},B):null;return n.jsxs("div",{className:"w-full",children:[Wt&&bt.createPortal(Wt,document.body),a.length>0&&(O||!pe)&&n.jsx("div",{className:"pt-2 pb-1",style:{position:"sticky",zIndex:35,backgroundColor:"var(--primary-foreground)"},children:n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:16,flexWrap:"wrap"},children:[O&&n.jsx("div",{style:{marginRight:"auto"},children:n.jsx(It,{dateRangePicker:O.dateRangePicker,onWeekToDate:O.onWeekToDate,exportConfig:O.exportConfig,filterChipsConfig:O.filterChipsConfig,trailingActions:O.trailingActions})}),(O==null?void 0:O.rightActions)&&n.jsx("div",{style:{display:"flex",alignItems:"center",gap:12,flexShrink:0},children:O.rightActions}),!pe&&n.jsxs("div",{style:{position:"relative"},children:[n.jsxs("button",{ref:Be,type:"button",onClick:()=>ct(!oe),style:{display:"inline-flex",alignItems:"center",gap:10,height:32,padding:"0 16px",background:"#FFFFFF",border:"1px solid #D9D9D9",borderRadius:10,cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:14,fontWeight:600,color:"#2E3236",whiteSpace:"nowrap"},children:[n.jsx(T.Settings2,{size:20,strokeWidth:1.75}),"Columns"]}),oe&&bt.createPortal(dn,document.body)]})]})}),Object.keys(q).length>0&&n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",padding:"8px 0"},children:[Object.entries(q).map(([e,t])=>{const o=a.find(d=>X(d)===e);if(!o||!Ke(t))return null;const i=bn(t),r=Sn(t),f=vn(t);return n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8,height:28,padding:"0 12px",borderRadius:20,border:"1px solid #B2B2B0",background:"#F2F2F0",fontFamily:"var(--font-sans)",fontSize:14,lineHeight:"20px",color:"#0B0B0B",whiteSpace:"nowrap"},children:[n.jsxs("span",{children:[n.jsxs("span",{style:{color:"#676767"},children:[o.label,": "]}),n.jsx("span",{children:i})]}),r>0&&n.jsx(wn,{count:r,values:f}),n.jsx("button",{type:"button",onClick:()=>M(e,[]),"aria-label":`Remove ${o.label} filter`,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",display:"inline-flex",color:"#676767"},children:n.jsx(T.X,{size:14,strokeWidth:2})})]},`chip-${e}`)}),n.jsx("button",{type:"button",onClick:ye,style:{marginLeft:"auto",background:"transparent",border:"none",padding:"0 4px",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:14,fontWeight:500,color:"#323232"},children:"Reset"})]}),a.length>0&&Ne.length>0?n.jsxs(H.DndContext,{sensors:Xt,collisionDetection:H.closestCenter,onDragStart:Yt,onDragEnd:Jt,children:[n.jsxs("div",{style:{borderRadius:8,border:"1px solid #E6E6E6",overflow:"hidden",background:"var(--primary-foreground)",position:"relative",top:"0.5rem",...W?{minHeight:320}:{}},children:[W&&n.jsx("div",{style:{position:"absolute",inset:0,background:"rgba(255, 255, 255, 0.9)",backdropFilter:"blur(2px)",zIndex:20,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderRadius:"14px"},children:n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px"},children:[n.jsx("p",{style:{fontSize:"13px",color:"rgba(30, 33, 37, 0.6)",margin:0},children:"Loading..."}),n.jsx(Cn,{src:"/BrandLoading.gif",alt:"Loading",width:50,height:50,unoptimized:!0,className:"mt-1"})]})}),n.jsx("div",{className:"overflow-x-auto custom-thin-scrollbar-hidden",ref:Ut,style:{maxHeight:"500px",overflowY:"auto",position:"relative",zIndex:1},children:n.jsxs("table",{style:{width:"auto",minWidth:"100%",tableLayout:"fixed",borderCollapse:"collapse",fontSize:"13px",fontFamily:"var(--font-sans)",border:"1px solid #e6e6e6",boxSizing:"border-box"},children:[n.jsx("thead",{children:n.jsxs("tr",{children:[K&&n.jsx("th",{style:{width:it,minWidth:it,padding:"10px 8px",textAlign:"center",verticalAlign:"middle",background:"#f2f2f0",borderRight:"1px solid #e6e6e6",borderBottom:"1px solid #e6e6e6",position:"sticky",top:0,zIndex:10,boxSizing:"border-box"},children:n.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",lineHeight:0},children:n.jsx(Rt,{checked:ot,indeterminate:Qt,onToggle:Vt,ariaLabel:"Select all rows on this page"})})}),n.jsx(H.SortableContext,{items:P,strategy:H.horizontalListSortingStrategy,children:Ne.map(e=>n.jsx(cn,{column:e,isHeaderRow:!0},`header-${X(e)}`))})]})}),n.jsx("tbody",{children:!W&&Ae.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:Ne.length+(K?1:0),style:{padding:"32px",textAlign:"center",color:"rgba(30, 33, 37, 0.42)",fontSize:"12px",fontFamily:"var(--font-sans)"},children:"No results found"})}):!W&&Ae.length>0?Ae.map((e,t)=>{const o=mt(e,t),i=K&&ve.has(o);return n.jsxs("tr",{"data-row-id":e.id||t,style:{borderBottom:"1px solid #e6e6e6",cursor:p?"pointer":"default",transition:"background 0.15s ease",background:i?"#F2F4F7":"transparent"},onClick:p?r=>{r.stopPropagation(),p(e,t)}:void 0,onMouseEnter:r=>{r.currentTarget.style.background="#E6E6E6"},onMouseLeave:r=>{r.currentTarget.style.background=i?"#F2F4F7":"transparent"},children:[K&&n.jsx("td",{onClick:r=>r.stopPropagation(),style:{width:it,minWidth:it,padding:"10px 8px",textAlign:"center",verticalAlign:"middle",borderRight:"1px solid #e6e6e6",boxSizing:"border-box"},children:n.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",lineHeight:0},children:n.jsx(Rt,{checked:i,onToggle:()=>Zt(o),ariaLabel:"Select row"})})}),Ne.map(r=>{const f=X(r),d=Ct(f,r.width),g=e[f],A=r.render?r.render(g,e):g,_=d&&d!=="auto",qe=typeof A=="string"&&A.trim()!=="",We=_&&qe,Oe=We?n.jsx(le,{content:A,children:A}):A;return n.jsx("td",{style:{padding:"10px 14px",color:"rgba(30, 33, 37, 0.78)",fontSize:"13px",borderRight:"1px solid #e6e6e6",boxSizing:"border-box",width:d,fontFamily:"var(--font-sans)",...We&&{maxWidth:d||"200px"}},children:Oe},f)})]},t)}):null})]})})]}),n.jsx(H.DragOverlay,{children:At?n.jsx("div",{className:"bg-[var(--paper-high)] border border-[var(--border-strong)] rounded px-4 py-2 shadow-lg",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(T.GripVertical,{size:14,className:"text-[var(--text-faint)]"}),n.jsx("span",{className:"text-sm font-semibold text-[var(--text-ink)]",children:At.label})]})}):null})]}):null,(()=>{const e=!$&&(ee.trim()!==""||Object.values(q).some(o=>Ke(o))),t=ne?e?_e.length:v:_e.length;return t<=0?null:n.jsx(Pt.Pagination,{page:Fe,pageSizeOptions:[5,10,20,50,100],pageSize:he,totalCount:t,currentDataLength:Ae.length,onPageChange:je,onPageSizeChange:o=>{Ge(o),je(1)},showPageSizeSelector:!0})})()]})}exports.DataTable2=Rn;exports.DataTableFilters=It;
|
|
2
2
|
//# sourceMappingURL=DataTable2.cjs.js.map
|