@fileflow/sdk 0.1.30 → 0.1.32

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.
@@ -0,0 +1,64 @@
1
+ "use strict";const l=require("react/jsx-runtime"),P=require("react"),C=require("./index-CQzYw3WX.js");function xt(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const je=xt(P);/**
2
+ * @license lucide-react v0.563.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const wt=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Ct=C.createLucideIcon("arrow-right",wt);/**
7
+ * @license lucide-react v0.563.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const St=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],yt=C.createLucideIcon("check",St);/**
12
+ * @license lucide-react v0.563.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const Rt=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],_t=C.createLucideIcon("chevron-left",Rt);/**
17
+ * @license lucide-react v0.563.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const Ft=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],jt=C.createLucideIcon("circle-question-mark",Ft);/**
22
+ * @license lucide-react v0.563.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const It=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],$t=C.createLucideIcon("file-spreadsheet",It);/**
27
+ * @license lucide-react v0.563.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const Mt=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],Nt=C.createLucideIcon("file",Mt);/**
32
+ * @license lucide-react v0.563.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */const Vt=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],Pt=C.createLucideIcon("pen",Vt);/**
37
+ * @license lucide-react v0.563.0 - ISC
38
+ *
39
+ * This source code is licensed under the ISC license.
40
+ * See the LICENSE file in the root directory of this source tree.
41
+ */const kt=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Et=C.createLucideIcon("trash-2",kt),Oe={sessionId:null,status:"idle",step:"upload",schema:null,file:null,fileName:null,fileSize:null,headers:[],rows:[],totalRows:0,sampleRows:[],mappings:[],unmappedSource:[],unmappedTarget:[],validationResults:null,errorsByRow:new Map,isLoading:!1,error:null,editingCell:null,editedRows:new Set};function qe(e,o){var r;const t=[],n=(e==null?void 0:e.trim())||"";if(o.required&&!n)return t.push({rowIndex:0,columnKey:o.key,value:n,severity:"error",validatorType:"required",message:`${o.label} is required`}),t;if(!n)return t;switch(o.type){case"email":{if(!/^[^\s@]+@[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*\.[a-zA-Z]{2,}$/.test(n))t.push({rowIndex:0,columnKey:o.key,value:n,severity:"error",validatorType:"type",message:"Invalid email format"});else{const i=(r=n.split("@")[1])==null?void 0:r.toLowerCase(),f={"gmial.com":"gmail.com","gmal.com":"gmail.com","gmai.com":"gmail.com","gamil.com":"gmail.com","gnail.com":"gmail.com","gmail.co":"gmail.com","gmail.cm":"gmail.com","gmil.com":"gmail.com","gmaill.com":"gmail.com","yaho.com":"yahoo.com","yahooo.com":"yahoo.com","yahoo.co":"yahoo.com","hotmal.com":"hotmail.com","hotmial.com":"hotmail.com","hotmai.com":"hotmail.com","hotmail.co":"hotmail.com","outlok.com":"outlook.com","outloo.com":"outlook.com","outlook.co":"outlook.com"};i&&f[i]&&t.push({rowIndex:0,columnKey:o.key,value:n,severity:"warning",validatorType:"type",message:`Possible typo: did you mean @${f[i]}?`,suggestion:`${n.split("@")[0]}@${f[i]}`})}break}case"url":/^https?:\/\/.+/.test(n)||t.push({rowIndex:0,columnKey:o.key,value:n,severity:"error",validatorType:"type",message:"Invalid URL format"});break;case"integer":/^-?\d+$/.test(n)||t.push({rowIndex:0,columnKey:o.key,value:n,severity:"error",validatorType:"type",message:"Must be a whole number"});break;case"number":case"float":/^-?\d+(\.\d+)?$/.test(n)||t.push({rowIndex:0,columnKey:o.key,value:n,severity:"error",validatorType:"type",message:"Must be a valid number"});break;case"phone":n.replace(/\D/g,"").length<10&&t.push({rowIndex:0,columnKey:o.key,value:n,severity:"warning",validatorType:"type",message:"Invalid phone number"});break}if(o.validators)for(const s of o.validators){const i=s.severity==="info"?"warning":s.severity||"error",f=s.params||{};switch(s.type){case"minLength":{const u=f.value??0;n.length<u&&t.push({rowIndex:0,columnKey:o.key,value:n,severity:i,validatorType:s.type,message:s.message||`Must be at least ${u} characters`});break}case"maxLength":{const u=f.value??1/0;n.length>u&&t.push({rowIndex:0,columnKey:o.key,value:n,severity:i,validatorType:s.type,message:s.message||`Must be at most ${u} characters`});break}case"min":{const u=parseFloat(n),d=f.value??-1/0;!isNaN(u)&&u<d&&t.push({rowIndex:0,columnKey:o.key,value:n,severity:i,validatorType:s.type,message:s.message||`Must be at least ${d}`});break}case"max":{const u=parseFloat(n),d=f.value??1/0;!isNaN(u)&&u>d&&t.push({rowIndex:0,columnKey:o.key,value:n,severity:i,validatorType:s.type,message:s.message||`Must be at most ${d}`});break}case"pattern":{const u=f.regex??f.pattern??".*";new RegExp(u).test(n)||t.push({rowIndex:0,columnKey:o.key,value:n,severity:i,validatorType:s.type,message:s.message||"Format is invalid"});break}case"enum":{const u=f.values||[];u.map(g=>g.toLowerCase()).includes(n.toLowerCase())||t.push({rowIndex:0,columnKey:o.key,value:n,severity:i,validatorType:s.type,message:s.message||`Must be one of: ${u.slice(0,5).join(", ")}${u.length>5?"...":""}`});break}case"custom":{const u=f.validatorName;if(u==="commaSeparatedEnum"){const d=f.allowedValues||[],g=n.split(",").map(a=>a.trim().toLowerCase()).filter(a=>a),p=d.map(a=>a.toLowerCase()),c=g.filter(a=>!p.includes(a));c.length>0&&t.push({rowIndex:0,columnKey:o.key,value:n,severity:i,validatorType:s.type,message:s.message||`Invalid values: ${c.join(", ")}. Must be comma-separated values from: ${d.slice(0,5).join(", ")}${d.length>5?"...":""}`})}if(u==="commaSeparatedEmails"){const g=n.split(",").map(p=>p.trim()).filter(p=>p).filter(p=>!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(p));g.length>0&&t.push({rowIndex:0,columnKey:o.key,value:n,severity:i,validatorType:s.type,message:`Invalid email(s): ${g.join(", ")}`})}break}}}return t}function ve(e,o,t){var x;const n=[];for(const v of e)for(const w of t){if(!w.targetKey)continue;const j=o.columns.find(V=>V.key===w.targetKey);if(!j)continue;const F=v.data[w.targetKey]||v.data[w.sourceColumn]||"",$=qe(String(F),j);for(const V of $)n.push({...V,rowIndex:v.rowIndex})}const r=((x=o.options)==null?void 0:x.uniqueKeys)||[];for(const v of r){const w=t.find(F=>F.targetKey===v);if(!w)continue;const j=new Map;for(const F of e){const $=String(F.data[v]||F.data[w.sourceColumn]||"").toLowerCase().trim();if(!$)continue;const V=j.get($)||[];V.push(F.rowIndex),j.set($,V)}for(const[F,$]of j.entries())if($.length>1)for(const V of $.slice(1))n.push({rowIndex:V,columnKey:v,value:F,severity:"warning",validatorType:"unique",message:`Duplicate ${v} value`})}const s=new Map;for(const v of n){const w=s.get(v.rowIndex)||[];w.push(v),s.set(v.rowIndex,w)}const i=n.filter(v=>v.severity==="error").length,f=n.filter(v=>v.severity==="warning").length,u=n.filter(v=>v.severity==="info").length,d=new Set(n.filter(v=>v.severity==="error").map(v=>v.rowIndex)),g=e.length,p=g-d.size,c={};for(const v of n){c[v.columnKey]||(c[v.columnKey]={columnKey:v.columnKey,errorCount:0,warningCount:0,infoCount:0,mostCommonError:void 0});const w=c[v.columnKey];v.severity==="error"?w.errorCount++:v.severity==="warning"?w.warningCount++:w.infoCount++,w.mostCommonError||(w.mostCommonError=v.message)}const a={};for(const v of n)a[v.validatorType]=(a[v.validatorType]||0)+1;const m=[];for(const v of r){const w=t.find(F=>F.targetKey===v);if(!w)continue;const j=new Map;for(const F of e){const $=String(F.data[v]||F.data[w.sourceColumn]||"").toLowerCase().trim();if(!$)continue;const V=j.get($)||[];V.push(F.rowIndex),j.set($,V)}for(const[F,$]of j.entries())$.length>1&&m.push({columnKey:v,value:F,rowIndices:$})}const h={byColumn:c,byType:a,duplicates:m.length>0?m:void 0};return{validationResults:{isValid:i===0,totalRows:g,validRows:p,errorCount:i,warningCount:f,infoCount:u,errors:n,summary:h},errorsByRow:s}}const ee=C.create((e,o)=>({...Oe,setSchema:t=>e({schema:t}),setSessionId:t=>e({sessionId:t}),setFile:t=>e({file:t,fileName:t.name,fileSize:t.size,error:null}),setParsedData:t=>e({headers:t.headers,rows:t.rows,totalRows:t.totalRows,sampleRows:t.sampleRows}),setMappings:t=>e({mappings:t}),updateMapping:(t,n)=>e(r=>({mappings:r.mappings.map(i=>i.sourceColumn===t?{...i,targetKey:n,isAutoMapped:!1}:i)})),setUnmapped:(t,n)=>e({unmappedSource:t,unmappedTarget:n}),setValidationResults:t=>{if(!t){e({validationResults:null,errorsByRow:new Map});return}const n=new Map;for(const r of t.errors){const s=n.get(r.rowIndex)||[];s.push(r),n.set(r.rowIndex,s)}e({validationResults:t,errorsByRow:n})},revalidate:()=>{const t=o();if(!t.schema||!t.validationResults)return;const{validationResults:n,errorsByRow:r}=ve(t.rows,t.schema,t.mappings);e({validationResults:n,errorsByRow:r})},setStep:t=>e({step:t}),nextStep:()=>{const t=["upload","mapping","validation","review","complete"],n=t.indexOf(o().step);n<t.length-1&&e({step:t[n+1]})},previousStep:()=>{const t=["upload","mapping","validation","review","complete"],n=t.indexOf(o().step);n>0&&e({step:t[n-1]})},startEditing:(t,n)=>e({editingCell:{rowIndex:t,columnKey:n}}),stopEditing:()=>e({editingCell:null}),updateCell:(t,n,r)=>{const s=o(),i=[...s.rows],f=i.find(d=>d.rowIndex===t);f&&(f.data={...f.data,[n]:String(r)});const u=new Set(s.editedRows);if(u.add(t),e({rows:i,editedRows:u,editingCell:null}),s.schema&&s.validationResults){const{validationResults:d,errorsByRow:g}=ve(i,s.schema,s.mappings);e({validationResults:d,errorsByRow:g})}},deleteRow:t=>{const n=o(),s=n.rows.filter(i=>i.rowIndex!==t).map((i,f)=>({...i,rowIndex:f}));if(e({rows:s,totalRows:s.length}),n.schema&&n.validationResults){const{validationResults:i,errorsByRow:f}=ve(s,n.schema,n.mappings);e({validationResults:i,errorsByRow:f})}},setStatus:t=>e({status:t}),setLoading:t=>e({isLoading:t}),setError:t=>e({error:t}),reset:()=>e(Oe)})),Ue=({onFileSelect:e,maxSize:o=50*1024*1024,acceptedTypes:t=[".csv",".xlsx",".xls"]})=>{const{file:n,fileName:r,fileSize:s,setFile:i,error:f,setError:u,isLoading:d}=ee(),g=P.useCallback((x,v)=>{if(v.length>0){u("Invalid file type or file too large");return}if(x.length>0){const w=x[0];i(w),e==null||e(w)}},[e,i,u]),{getRootProps:p,getInputProps:c,isDragActive:a}=C.useDropzone({onDrop:g,accept:{"text/csv":[".csv"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":[".xlsx"],"application/vnd.ms-excel":[".xls"]},maxSize:o,multiple:!1,disabled:d}),m=x=>x<1024?`${x} B`:x<1024*1024?`${(x/1024).toFixed(1)} KB`:`${(x/(1024*1024)).toFixed(1)} MB`,h=x=>{x.stopPropagation(),ee.getState().reset()};return n?l.jsx("div",{className:"ff-p-4 ff-rounded-xl ff-border",style:{backgroundColor:"var(--ff-success-light)",borderColor:"var(--ff-success)"},children:l.jsxs("div",{className:"ff-flex ff-items-center ff-gap-3",children:[l.jsx("div",{className:"ff-p-2 ff-rounded-lg",style:{backgroundColor:"rgba(41, 142, 51, 0.15)"},children:l.jsx(Nt,{className:"ff-w-6 ff-h-6",style:{color:"var(--ff-success)"}})}),l.jsxs("div",{className:"ff-flex-1 ff-min-w-0",children:[l.jsx("p",{className:"ff-font-medium ff-truncate",style:{color:"var(--ff-success-dark)"},children:r}),l.jsx("p",{className:"ff-text-sm",style:{color:"var(--ff-success)"},children:m(s||0)})]}),l.jsx("button",{onClick:h,className:"ff-p-1.5 ff-rounded-full ff-transition-colors",style:{color:"var(--ff-success)"},"aria-label":"Remove file",children:l.jsx(C.X,{className:"ff-w-5 ff-h-5"})})]})}):l.jsxs("div",{className:"ff-space-y-6",children:[l.jsxs("div",{...p(),className:C.clsx("ff-dropzone",a&&"ff-dropzone-active",d&&"ff-opacity-50 ff-cursor-not-allowed"),children:[l.jsx("input",{...c()}),l.jsx("div",{className:"ff-dropzone-icon-wrapper",children:l.jsx(C.Upload,{className:"ff-dropzone-icon"})}),l.jsx("h3",{className:"ff-dropzone-text",children:a?"Drop your file here":"Upload your file"}),l.jsx("p",{className:"ff-dropzone-hint",children:"Drag and drop or click to select"}),l.jsx("label",{className:"ff-inline-block",children:l.jsx("span",{className:C.clsx("ff-btn ff-btn-primary",d&&"ff-opacity-50 ff-cursor-wait"),children:d?"Processing...":"Choose file"})}),l.jsxs("p",{className:"ff-dropzone-formats",children:["Supports ",t.join(", ")," up to ",m(o)]})]}),f&&l.jsxs("div",{className:"ff-flex ff-items-center ff-gap-2 ff-p-4 ff-rounded-lg ff-text-sm",style:{backgroundColor:"var(--ff-error-light)",color:"var(--ff-error)"},children:[l.jsx(C.CircleAlert,{className:"ff-w-4 ff-h-4 ff-flex-shrink-0"}),l.jsx("p",{children:f})]})]})},Xe=({onMappingChange:e})=>{const{mappings:o,schema:t,unmappedSource:n,updateMapping:r}=ee(),s=(t==null?void 0:t.columns)||[],i=(p,c)=>{const a=c===""?null:c;r(p,a),e==null||e(p,a)},f=p=>p>=.85?"var(--ff-success)":p>=.6?"var(--ff-warning)":"var(--ff-error)",u=p=>p>=.85?"High":p>=.6?"Medium":"Low",g=new Set(o.filter(p=>p.targetKey!==null).map(p=>p.targetKey));return l.jsxs("div",{className:"ff-space-y-4",children:[l.jsxs("div",{className:"ff-mapping-header",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"ff-mapping-title",children:"Column Mapping"}),l.jsx("p",{className:"ff-mapping-subtitle",children:"Match your file columns to the expected fields"})]}),l.jsxs("div",{className:"ff-mapping-legend",children:[l.jsxs("span",{className:"ff-mapping-legend-item",children:[l.jsx("span",{className:"ff-mapping-legend-dot",style:{backgroundColor:"var(--ff-success)"}}),l.jsx("span",{style:{color:"var(--ff-text-secondary)"},children:"Mapped"})]}),l.jsxs("span",{className:"ff-mapping-legend-item",children:[l.jsx("span",{className:"ff-mapping-legend-dot",style:{backgroundColor:"var(--ff-warning)"}}),l.jsx("span",{style:{color:"var(--ff-text-secondary)"},children:"Review"})]}),l.jsxs("span",{className:"ff-mapping-legend-item",children:[l.jsx("span",{className:"ff-mapping-legend-dot",style:{backgroundColor:"var(--ff-gray-70)"}}),l.jsx("span",{style:{color:"var(--ff-text-secondary)"},children:"Unmapped"})]})]})]}),l.jsx("div",{className:"ff-space-y-2",children:o.map(p=>{s.find(m=>m.key===p.targetKey);const c=p.targetKey!==null,a=p.confidence>=.85;return l.jsxs("div",{className:C.clsx("ff-mapping-row",c&&a&&"ff-mapping-row-success",c&&!a&&"ff-mapping-row-warning"),children:[l.jsx("div",{className:"ff-flex-1",children:l.jsx("div",{className:"ff-mapping-source",children:p.sourceColumn})}),l.jsx("div",{className:"ff-mapping-arrow",children:l.jsx(Ct,{className:"ff-w-5 ff-h-5"})}),l.jsx("div",{className:"ff-flex-1 ff-mapping-target",children:l.jsxs("select",{value:p.targetKey||"",onChange:m=>i(p.sourceColumn,m.target.value),className:"ff-input",children:[l.jsx("option",{value:"",children:"-- Do not import --"}),s.map(m=>l.jsxs("option",{value:m.key,disabled:g.has(m.key)&&p.targetKey!==m.key,children:[m.label," (",m.type,")",m.required?" *":""]},m.key))]})}),l.jsx("div",{className:"ff-mapping-status",children:c?a?l.jsx(yt,{className:"ff-w-5 ff-h-5",style:{color:"var(--ff-success)"}}):l.jsx(jt,{className:"ff-w-5 ff-h-5",style:{color:"var(--ff-warning)"}}):l.jsx("span",{className:"ff-w-5 ff-h-5"})}),p.confidence>0&&l.jsxs("div",{className:"ff-confidence",style:{color:f(p.confidence)},children:[l.jsxs("span",{children:[Math.round(p.confidence*100),"%"]}),l.jsxs("span",{style:{color:"var(--ff-text-muted)"},children:["(",u(p.confidence),")"]})]})]},p.sourceColumn)})}),(()=>{const p=s.filter(c=>c.required&&!g.has(c.key));return p.length>0?l.jsxs("div",{className:"ff-flex ff-items-start ff-gap-2 ff-p-4 ff-rounded-lg",style:{backgroundColor:"var(--ff-warning-light)",borderColor:"var(--ff-warning)"},children:[l.jsx(C.CircleAlert,{className:"ff-w-5 ff-h-5 ff-flex-shrink-0 ff-mt-0.5",style:{color:"var(--ff-warning)"}}),l.jsxs("div",{children:[l.jsx("p",{className:"ff-text-sm ff-font-medium",style:{color:"var(--ff-warning-dark)"},children:"Required fields not mapped"}),l.jsx("p",{className:"ff-text-sm ff-mt-1",style:{color:"var(--ff-warning)"},children:p.map(c=>c.label).join(", ")})]})]}):null})()]})};/**
42
+ * table-core
43
+ *
44
+ * Copyright (c) TanStack
45
+ *
46
+ * This source code is licensed under the MIT license found in the
47
+ * LICENSE.md file in the root directory of this source tree.
48
+ *
49
+ * @license MIT
50
+ */function bt(){return{accessor:(e,o)=>typeof e=="function"?{...o,accessorFn:e}:{...o,accessorKey:e},display:e=>e,group:e=>e}}function W(e,o){return typeof e=="function"?e(o):e}function G(e,o){return t=>{o.setState(n=>({...n,[e]:W(t,n[e])}))}}function me(e){return e instanceof Function}function Lt(e){return Array.isArray(e)&&e.every(o=>typeof o=="number")}function Dt(e,o){const t=[],n=r=>{r.forEach(s=>{t.push(s);const i=o(s);i!=null&&i.length&&n(i)})};return n(e),t}function S(e,o,t){let n=[],r;return s=>{let i;t.key&&t.debug&&(i=Date.now());const f=e(s);if(!(f.length!==n.length||f.some((g,p)=>n[p]!==g)))return r;n=f;let d;if(t.key&&t.debug&&(d=Date.now()),r=o(...f),t==null||t.onChange==null||t.onChange(r),t.key&&t.debug&&t!=null&&t.debug()){const g=Math.round((Date.now()-i)*100)/100,p=Math.round((Date.now()-d)*100)/100,c=p/16,a=(m,h)=>{for(m=String(m);m.length<h;)m=" "+m;return m};console.info(`%c⏱ ${a(p,5)} /${a(g,5)} ms`,`
51
+ font-size: .6rem;
52
+ font-weight: bold;
53
+ color: hsl(${Math.max(0,Math.min(120-120*c,120))}deg 100% 31%);`,t==null?void 0:t.key)}return r}}function y(e,o,t,n){return{debug:()=>{var r;return(r=e==null?void 0:e.debugAll)!=null?r:e[o]},key:process.env.NODE_ENV==="development"&&t,onChange:n}}function zt(e,o,t,n){const r=()=>{var i;return(i=s.getValue())!=null?i:e.options.renderFallbackValue},s={id:`${o.id}_${t.id}`,row:o,column:t,getValue:()=>o.getValue(n),renderValue:r,getContext:S(()=>[e,t,o,s],(i,f,u,d)=>({table:i,column:f,row:u,cell:d,getValue:d.getValue,renderValue:d.renderValue}),y(e.options,"debugCells","cell.getContext"))};return e._features.forEach(i=>{i.createCell==null||i.createCell(s,t,o,e)},{}),s}function At(e,o,t,n){var r,s;const f={...e._getDefaultColumnDef(),...o},u=f.accessorKey;let d=(r=(s=f.id)!=null?s:u?typeof String.prototype.replaceAll=="function"?u.replaceAll(".","_"):u.replace(/\./g,"_"):void 0)!=null?r:typeof f.header=="string"?f.header:void 0,g;if(f.accessorFn?g=f.accessorFn:u&&(u.includes(".")?g=c=>{let a=c;for(const h of u.split(".")){var m;a=(m=a)==null?void 0:m[h],process.env.NODE_ENV!=="production"&&a===void 0&&console.warn(`"${h}" in deeply nested key "${u}" returned undefined.`)}return a}:g=c=>c[f.accessorKey]),!d)throw process.env.NODE_ENV!=="production"?new Error(f.accessorFn?"Columns require an id when using an accessorFn":"Columns require an id when using a non-string header"):new Error;let p={id:`${String(d)}`,accessorFn:g,parent:n,depth:t,columnDef:f,columns:[],getFlatColumns:S(()=>[!0],()=>{var c;return[p,...(c=p.columns)==null?void 0:c.flatMap(a=>a.getFlatColumns())]},y(e.options,"debugColumns","column.getFlatColumns")),getLeafColumns:S(()=>[e._getOrderColumnsFn()],c=>{var a;if((a=p.columns)!=null&&a.length){let m=p.columns.flatMap(h=>h.getLeafColumns());return c(m)}return[p]},y(e.options,"debugColumns","column.getLeafColumns"))};for(const c of e._features)c.createColumn==null||c.createColumn(p,e);return p}const L="debugHeaders";function Te(e,o,t){var n;let s={id:(n=t.id)!=null?n:o.id,column:o,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const i=[],f=u=>{u.subHeaders&&u.subHeaders.length&&u.subHeaders.map(f),i.push(u)};return f(s),i},getContext:()=>({table:e,header:s,column:o})};return e._features.forEach(i=>{i.createHeader==null||i.createHeader(s,e)}),s}const Ht={createTable:e=>{e.getHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n,r)=>{var s,i;const f=(s=n==null?void 0:n.map(p=>t.find(c=>c.id===p)).filter(Boolean))!=null?s:[],u=(i=r==null?void 0:r.map(p=>t.find(c=>c.id===p)).filter(Boolean))!=null?i:[],d=t.filter(p=>!(n!=null&&n.includes(p.id))&&!(r!=null&&r.includes(p.id)));return ce(o,[...f,...d,...u],e)},y(e.options,L,"getHeaderGroups")),e.getCenterHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n,r)=>(t=t.filter(s=>!(n!=null&&n.includes(s.id))&&!(r!=null&&r.includes(s.id))),ce(o,t,e,"center")),y(e.options,L,"getCenterHeaderGroups")),e.getLeftHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(o,t,n)=>{var r;const s=(r=n==null?void 0:n.map(i=>t.find(f=>f.id===i)).filter(Boolean))!=null?r:[];return ce(o,s,e,"left")},y(e.options,L,"getLeftHeaderGroups")),e.getRightHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(o,t,n)=>{var r;const s=(r=n==null?void 0:n.map(i=>t.find(f=>f.id===i)).filter(Boolean))!=null?r:[];return ce(o,s,e,"right")},y(e.options,L,"getRightHeaderGroups")),e.getFooterGroups=S(()=>[e.getHeaderGroups()],o=>[...o].reverse(),y(e.options,L,"getFooterGroups")),e.getLeftFooterGroups=S(()=>[e.getLeftHeaderGroups()],o=>[...o].reverse(),y(e.options,L,"getLeftFooterGroups")),e.getCenterFooterGroups=S(()=>[e.getCenterHeaderGroups()],o=>[...o].reverse(),y(e.options,L,"getCenterFooterGroups")),e.getRightFooterGroups=S(()=>[e.getRightHeaderGroups()],o=>[...o].reverse(),y(e.options,L,"getRightFooterGroups")),e.getFlatHeaders=S(()=>[e.getHeaderGroups()],o=>o.map(t=>t.headers).flat(),y(e.options,L,"getFlatHeaders")),e.getLeftFlatHeaders=S(()=>[e.getLeftHeaderGroups()],o=>o.map(t=>t.headers).flat(),y(e.options,L,"getLeftFlatHeaders")),e.getCenterFlatHeaders=S(()=>[e.getCenterHeaderGroups()],o=>o.map(t=>t.headers).flat(),y(e.options,L,"getCenterFlatHeaders")),e.getRightFlatHeaders=S(()=>[e.getRightHeaderGroups()],o=>o.map(t=>t.headers).flat(),y(e.options,L,"getRightFlatHeaders")),e.getCenterLeafHeaders=S(()=>[e.getCenterFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),y(e.options,L,"getCenterLeafHeaders")),e.getLeftLeafHeaders=S(()=>[e.getLeftFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),y(e.options,L,"getLeftLeafHeaders")),e.getRightLeafHeaders=S(()=>[e.getRightFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),y(e.options,L,"getRightLeafHeaders")),e.getLeafHeaders=S(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(o,t,n)=>{var r,s,i,f,u,d;return[...(r=(s=o[0])==null?void 0:s.headers)!=null?r:[],...(i=(f=t[0])==null?void 0:f.headers)!=null?i:[],...(u=(d=n[0])==null?void 0:d.headers)!=null?u:[]].map(g=>g.getLeafHeaders()).flat()},y(e.options,L,"getLeafHeaders"))}};function ce(e,o,t,n){var r,s;let i=0;const f=function(c,a){a===void 0&&(a=1),i=Math.max(i,a),c.filter(m=>m.getIsVisible()).forEach(m=>{var h;(h=m.columns)!=null&&h.length&&f(m.columns,a+1)},0)};f(e);let u=[];const d=(c,a)=>{const m={depth:a,id:[n,`${a}`].filter(Boolean).join("_"),headers:[]},h=[];c.forEach(x=>{const v=[...h].reverse()[0],w=x.column.depth===m.depth;let j,F=!1;if(w&&x.column.parent?j=x.column.parent:(j=x.column,F=!0),v&&(v==null?void 0:v.column)===j)v.subHeaders.push(x);else{const $=Te(t,j,{id:[n,a,j.id,x==null?void 0:x.id].filter(Boolean).join("_"),isPlaceholder:F,placeholderId:F?`${h.filter(V=>V.column===j).length}`:void 0,depth:a,index:h.length});$.subHeaders.push(x),h.push($)}m.headers.push(x),x.headerGroup=m}),u.push(m),a>0&&d(h,a-1)},g=o.map((c,a)=>Te(t,c,{depth:i,index:a}));d(g,i-1),u.reverse();const p=c=>c.filter(m=>m.column.getIsVisible()).map(m=>{let h=0,x=0,v=[0];m.subHeaders&&m.subHeaders.length?(v=[],p(m.subHeaders).forEach(j=>{let{colSpan:F,rowSpan:$}=j;h+=F,v.push($)})):h=1;const w=Math.min(...v);return x=x+w,m.colSpan=h,m.rowSpan=x,{colSpan:h,rowSpan:x}});return p((r=(s=u[0])==null?void 0:s.headers)!=null?r:[]),u}const Pe=(e,o,t,n,r,s,i)=>{let f={id:o,index:n,original:t,depth:r,parentId:i,_valuesCache:{},_uniqueValuesCache:{},getValue:u=>{if(f._valuesCache.hasOwnProperty(u))return f._valuesCache[u];const d=e.getColumn(u);if(d!=null&&d.accessorFn)return f._valuesCache[u]=d.accessorFn(f.original,n),f._valuesCache[u]},getUniqueValues:u=>{if(f._uniqueValuesCache.hasOwnProperty(u))return f._uniqueValuesCache[u];const d=e.getColumn(u);if(d!=null&&d.accessorFn)return d.columnDef.getUniqueValues?(f._uniqueValuesCache[u]=d.columnDef.getUniqueValues(f.original,n),f._uniqueValuesCache[u]):(f._uniqueValuesCache[u]=[f.getValue(u)],f._uniqueValuesCache[u])},renderValue:u=>{var d;return(d=f.getValue(u))!=null?d:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>Dt(f.subRows,u=>u.subRows),getParentRow:()=>f.parentId?e.getRow(f.parentId,!0):void 0,getParentRows:()=>{let u=[],d=f;for(;;){const g=d.getParentRow();if(!g)break;u.push(g),d=g}return u.reverse()},getAllCells:S(()=>[e.getAllLeafColumns()],u=>u.map(d=>zt(e,f,d,d.id)),y(e.options,"debugRows","getAllCells")),_getAllCellsByColumnId:S(()=>[f.getAllCells()],u=>u.reduce((d,g)=>(d[g.column.id]=g,d),{}),y(e.options,"debugRows","getAllCellsByColumnId"))};for(let u=0;u<e._features.length;u++){const d=e._features[u];d==null||d.createRow==null||d.createRow(f,e)}return f},Gt={createColumn:(e,o)=>{e._getFacetedRowModel=o.options.getFacetedRowModel&&o.options.getFacetedRowModel(o,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():o.getPreFilteredRowModel(),e._getFacetedUniqueValues=o.options.getFacetedUniqueValues&&o.options.getFacetedUniqueValues(o,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=o.options.getFacetedMinMaxValues&&o.options.getFacetedMinMaxValues(o,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},Ze=(e,o,t)=>{var n,r;const s=t==null||(n=t.toString())==null?void 0:n.toLowerCase();return!!(!((r=e.getValue(o))==null||(r=r.toString())==null||(r=r.toLowerCase())==null)&&r.includes(s))};Ze.autoRemove=e=>T(e);const We=(e,o,t)=>{var n;return!!(!((n=e.getValue(o))==null||(n=n.toString())==null)&&n.includes(t))};We.autoRemove=e=>T(e);const Qe=(e,o,t)=>{var n;return((n=e.getValue(o))==null||(n=n.toString())==null?void 0:n.toLowerCase())===(t==null?void 0:t.toLowerCase())};Qe.autoRemove=e=>T(e);const Ye=(e,o,t)=>{var n;return(n=e.getValue(o))==null?void 0:n.includes(t)};Ye.autoRemove=e=>T(e);const Je=(e,o,t)=>!t.some(n=>{var r;return!((r=e.getValue(o))!=null&&r.includes(n))});Je.autoRemove=e=>T(e)||!(e!=null&&e.length);const et=(e,o,t)=>t.some(n=>{var r;return(r=e.getValue(o))==null?void 0:r.includes(n)});et.autoRemove=e=>T(e)||!(e!=null&&e.length);const tt=(e,o,t)=>e.getValue(o)===t;tt.autoRemove=e=>T(e);const nt=(e,o,t)=>e.getValue(o)==t;nt.autoRemove=e=>T(e);const ke=(e,o,t)=>{let[n,r]=t;const s=e.getValue(o);return s>=n&&s<=r};ke.resolveFilterValue=e=>{let[o,t]=e,n=typeof o!="number"?parseFloat(o):o,r=typeof t!="number"?parseFloat(t):t,s=o===null||Number.isNaN(n)?-1/0:n,i=t===null||Number.isNaN(r)?1/0:r;if(s>i){const f=s;s=i,i=f}return[s,i]};ke.autoRemove=e=>T(e)||T(e[0])&&T(e[1]);const X={includesString:Ze,includesStringSensitive:We,equalsString:Qe,arrIncludes:Ye,arrIncludesAll:Je,arrIncludesSome:et,equals:tt,weakEquals:nt,inNumberRange:ke};function T(e){return e==null||e===""}const Ot={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:G("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,o)=>{e.getAutoFilterFn=()=>{const t=o.getCoreRowModel().flatRows[0],n=t==null?void 0:t.getValue(e.id);return typeof n=="string"?X.includesString:typeof n=="number"?X.inNumberRange:typeof n=="boolean"||n!==null&&typeof n=="object"?X.equals:Array.isArray(n)?X.arrIncludes:X.weakEquals},e.getFilterFn=()=>{var t,n;return me(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(t=(n=o.options.filterFns)==null?void 0:n[e.columnDef.filterFn])!=null?t:X[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,n,r;return((t=e.columnDef.enableColumnFilter)!=null?t:!0)&&((n=o.options.enableColumnFilters)!=null?n:!0)&&((r=o.options.enableFilters)!=null?r:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var t;return(t=o.getState().columnFilters)==null||(t=t.find(n=>n.id===e.id))==null?void 0:t.value},e.getFilterIndex=()=>{var t,n;return(t=(n=o.getState().columnFilters)==null?void 0:n.findIndex(r=>r.id===e.id))!=null?t:-1},e.setFilterValue=t=>{o.setColumnFilters(n=>{const r=e.getFilterFn(),s=n==null?void 0:n.find(g=>g.id===e.id),i=W(t,s?s.value:void 0);if(Be(r,i,e)){var f;return(f=n==null?void 0:n.filter(g=>g.id!==e.id))!=null?f:[]}const u={id:e.id,value:i};if(s){var d;return(d=n==null?void 0:n.map(g=>g.id===e.id?u:g))!=null?d:[]}return n!=null&&n.length?[...n,u]:[u]})}},createRow:(e,o)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=o=>{const t=e.getAllLeafColumns(),n=r=>{var s;return(s=W(o,r))==null?void 0:s.filter(i=>{const f=t.find(u=>u.id===i.id);if(f){const u=f.getFilterFn();if(Be(u,i.value,f))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(n)},e.resetColumnFilters=o=>{var t,n;e.setColumnFilters(o?[]:(t=(n=e.initialState)==null?void 0:n.columnFilters)!=null?t:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function Be(e,o,t){return(e&&e.autoRemove?e.autoRemove(o,t):!1)||typeof o>"u"||typeof o=="string"&&!o}const Tt=(e,o,t)=>t.reduce((n,r)=>{const s=r.getValue(e);return n+(typeof s=="number"?s:0)},0),Bt=(e,o,t)=>{let n;return t.forEach(r=>{const s=r.getValue(e);s!=null&&(n>s||n===void 0&&s>=s)&&(n=s)}),n},Kt=(e,o,t)=>{let n;return t.forEach(r=>{const s=r.getValue(e);s!=null&&(n<s||n===void 0&&s>=s)&&(n=s)}),n},qt=(e,o,t)=>{let n,r;return t.forEach(s=>{const i=s.getValue(e);i!=null&&(n===void 0?i>=i&&(n=r=i):(n>i&&(n=i),r<i&&(r=i)))}),[n,r]},Ut=(e,o)=>{let t=0,n=0;if(o.forEach(r=>{let s=r.getValue(e);s!=null&&(s=+s)>=s&&(++t,n+=s)}),t)return n/t},Xt=(e,o)=>{if(!o.length)return;const t=o.map(s=>s.getValue(e));if(!Lt(t))return;if(t.length===1)return t[0];const n=Math.floor(t.length/2),r=t.sort((s,i)=>s-i);return t.length%2!==0?r[n]:(r[n-1]+r[n])/2},Zt=(e,o)=>Array.from(new Set(o.map(t=>t.getValue(e))).values()),Wt=(e,o)=>new Set(o.map(t=>t.getValue(e))).size,Qt=(e,o)=>o.length,xe={sum:Tt,min:Bt,max:Kt,extent:qt,mean:Ut,median:Xt,unique:Zt,uniqueCount:Wt,count:Qt},Yt={getDefaultColumnDef:()=>({aggregatedCell:e=>{var o,t;return(o=(t=e.getValue())==null||t.toString==null?void 0:t.toString())!=null?o:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:G("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,o)=>{e.toggleGrouping=()=>{o.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(n=>n!==e.id):[...t??[],e.id])},e.getCanGroup=()=>{var t,n;return((t=e.columnDef.enableGrouping)!=null?t:!0)&&((n=o.options.enableGrouping)!=null?n:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var t;return(t=o.getState().grouping)==null?void 0:t.includes(e.id)},e.getGroupedIndex=()=>{var t;return(t=o.getState().grouping)==null?void 0:t.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const t=o.getCoreRowModel().flatRows[0],n=t==null?void 0:t.getValue(e.id);if(typeof n=="number")return xe.sum;if(Object.prototype.toString.call(n)==="[object Date]")return xe.extent},e.getAggregationFn=()=>{var t,n;if(!e)throw new Error;return me(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(t=(n=o.options.aggregationFns)==null?void 0:n[e.columnDef.aggregationFn])!=null?t:xe[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=o=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(o),e.resetGrouping=o=>{var t,n;e.setGrouping(o?[]:(t=(n=e.initialState)==null?void 0:n.grouping)!=null?t:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,o)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=t=>{if(e._groupingValuesCache.hasOwnProperty(t))return e._groupingValuesCache[t];const n=o.getColumn(t);return n!=null&&n.columnDef.getGroupingValue?(e._groupingValuesCache[t]=n.columnDef.getGroupingValue(e.original),e._groupingValuesCache[t]):e.getValue(t)},e._groupingValuesCache={}},createCell:(e,o,t,n)=>{e.getIsGrouped=()=>o.getIsGrouped()&&o.id===t.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&o.getIsGrouped(),e.getIsAggregated=()=>{var r;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((r=t.subRows)!=null&&r.length)}}};function Jt(e,o,t){if(!(o!=null&&o.length)||!t)return e;const n=e.filter(s=>!o.includes(s.id));return t==="remove"?n:[...o.map(s=>e.find(i=>i.id===s)).filter(Boolean),...n]}const en={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:G("columnOrder",e)}),createColumn:(e,o)=>{e.getIndex=S(t=>[ue(o,t)],t=>t.findIndex(n=>n.id===e.id),y(o.options,"debugColumns","getIndex")),e.getIsFirstColumn=t=>{var n;return((n=ue(o,t)[0])==null?void 0:n.id)===e.id},e.getIsLastColumn=t=>{var n;const r=ue(o,t);return((n=r[r.length-1])==null?void 0:n.id)===e.id}},createTable:e=>{e.setColumnOrder=o=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(o),e.resetColumnOrder=o=>{var t;e.setColumnOrder(o?[]:(t=e.initialState.columnOrder)!=null?t:[])},e._getOrderColumnsFn=S(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(o,t,n)=>r=>{let s=[];if(!(o!=null&&o.length))s=r;else{const i=[...o],f=[...r];for(;f.length&&i.length;){const u=i.shift(),d=f.findIndex(g=>g.id===u);d>-1&&s.push(f.splice(d,1)[0])}s=[...s,...f]}return Jt(s,t,n)},y(e.options,"debugTable","_getOrderColumnsFn"))}},we=()=>({left:[],right:[]}),tn={getInitialState:e=>({columnPinning:we(),...e}),getDefaultOptions:e=>({onColumnPinningChange:G("columnPinning",e)}),createColumn:(e,o)=>{e.pin=t=>{const n=e.getLeafColumns().map(r=>r.id).filter(Boolean);o.setColumnPinning(r=>{var s,i;if(t==="right"){var f,u;return{left:((f=r==null?void 0:r.left)!=null?f:[]).filter(p=>!(n!=null&&n.includes(p))),right:[...((u=r==null?void 0:r.right)!=null?u:[]).filter(p=>!(n!=null&&n.includes(p))),...n]}}if(t==="left"){var d,g;return{left:[...((d=r==null?void 0:r.left)!=null?d:[]).filter(p=>!(n!=null&&n.includes(p))),...n],right:((g=r==null?void 0:r.right)!=null?g:[]).filter(p=>!(n!=null&&n.includes(p)))}}return{left:((s=r==null?void 0:r.left)!=null?s:[]).filter(p=>!(n!=null&&n.includes(p))),right:((i=r==null?void 0:r.right)!=null?i:[]).filter(p=>!(n!=null&&n.includes(p)))}})},e.getCanPin=()=>e.getLeafColumns().some(n=>{var r,s,i;return((r=n.columnDef.enablePinning)!=null?r:!0)&&((s=(i=o.options.enableColumnPinning)!=null?i:o.options.enablePinning)!=null?s:!0)}),e.getIsPinned=()=>{const t=e.getLeafColumns().map(f=>f.id),{left:n,right:r}=o.getState().columnPinning,s=t.some(f=>n==null?void 0:n.includes(f)),i=t.some(f=>r==null?void 0:r.includes(f));return s?"left":i?"right":!1},e.getPinnedIndex=()=>{var t,n;const r=e.getIsPinned();return r?(t=(n=o.getState().columnPinning)==null||(n=n[r])==null?void 0:n.indexOf(e.id))!=null?t:-1:0}},createRow:(e,o)=>{e.getCenterVisibleCells=S(()=>[e._getAllVisibleCells(),o.getState().columnPinning.left,o.getState().columnPinning.right],(t,n,r)=>{const s=[...n??[],...r??[]];return t.filter(i=>!s.includes(i.column.id))},y(o.options,"debugRows","getCenterVisibleCells")),e.getLeftVisibleCells=S(()=>[e._getAllVisibleCells(),o.getState().columnPinning.left],(t,n)=>(n??[]).map(s=>t.find(i=>i.column.id===s)).filter(Boolean).map(s=>({...s,position:"left"})),y(o.options,"debugRows","getLeftVisibleCells")),e.getRightVisibleCells=S(()=>[e._getAllVisibleCells(),o.getState().columnPinning.right],(t,n)=>(n??[]).map(s=>t.find(i=>i.column.id===s)).filter(Boolean).map(s=>({...s,position:"right"})),y(o.options,"debugRows","getRightVisibleCells"))},createTable:e=>{e.setColumnPinning=o=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(o),e.resetColumnPinning=o=>{var t,n;return e.setColumnPinning(o?we():(t=(n=e.initialState)==null?void 0:n.columnPinning)!=null?t:we())},e.getIsSomeColumnsPinned=o=>{var t;const n=e.getState().columnPinning;if(!o){var r,s;return!!((r=n.left)!=null&&r.length||(s=n.right)!=null&&s.length)}return!!((t=n[o])!=null&&t.length)},e.getLeftLeafColumns=S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(o,t)=>(t??[]).map(n=>o.find(r=>r.id===n)).filter(Boolean),y(e.options,"debugColumns","getLeftLeafColumns")),e.getRightLeafColumns=S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(o,t)=>(t??[]).map(n=>o.find(r=>r.id===n)).filter(Boolean),y(e.options,"debugColumns","getRightLeafColumns")),e.getCenterLeafColumns=S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n)=>{const r=[...t??[],...n??[]];return o.filter(s=>!r.includes(s.id))},y(e.options,"debugColumns","getCenterLeafColumns"))}};function nn(e){return e||(typeof document<"u"?document:null)}const ge={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Ce=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),on={getDefaultColumnDef:()=>ge,getInitialState:e=>({columnSizing:{},columnSizingInfo:Ce(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:G("columnSizing",e),onColumnSizingInfoChange:G("columnSizingInfo",e)}),createColumn:(e,o)=>{e.getSize=()=>{var t,n,r;const s=o.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:ge.minSize,(n=s??e.columnDef.size)!=null?n:ge.size),(r=e.columnDef.maxSize)!=null?r:ge.maxSize)},e.getStart=S(t=>[t,ue(o,t),o.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((r,s)=>r+s.getSize(),0),y(o.options,"debugColumns","getStart")),e.getAfter=S(t=>[t,ue(o,t),o.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((r,s)=>r+s.getSize(),0),y(o.options,"debugColumns","getAfter")),e.resetSize=()=>{o.setColumnSizing(t=>{let{[e.id]:n,...r}=t;return r})},e.getCanResize=()=>{var t,n;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((n=o.options.enableColumnResizing)!=null?n:!0)},e.getIsResizing=()=>o.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,o)=>{e.getSize=()=>{let t=0;const n=r=>{if(r.subHeaders.length)r.subHeaders.forEach(n);else{var s;t+=(s=r.column.getSize())!=null?s:0}};return n(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=t=>{const n=o.getColumn(e.column.id),r=n==null?void 0:n.getCanResize();return s=>{if(!n||!r||(s.persist==null||s.persist(),Se(s)&&s.touches&&s.touches.length>1))return;const i=e.getSize(),f=e?e.getLeafHeaders().map(v=>[v.column.id,v.column.getSize()]):[[n.id,n.getSize()]],u=Se(s)?Math.round(s.touches[0].clientX):s.clientX,d={},g=(v,w)=>{typeof w=="number"&&(o.setColumnSizingInfo(j=>{var F,$;const V=o.options.columnResizeDirection==="rtl"?-1:1,K=(w-((F=j==null?void 0:j.startOffset)!=null?F:0))*V,Z=Math.max(K/(($=j==null?void 0:j.startSize)!=null?$:0),-.999999);return j.columnSizingStart.forEach(re=>{let[z,O]=re;d[z]=Math.round(Math.max(O+O*Z,0)*100)/100}),{...j,deltaOffset:K,deltaPercentage:Z}}),(o.options.columnResizeMode==="onChange"||v==="end")&&o.setColumnSizing(j=>({...j,...d})))},p=v=>g("move",v),c=v=>{g("end",v),o.setColumnSizingInfo(w=>({...w,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},a=nn(t),m={moveHandler:v=>p(v.clientX),upHandler:v=>{a==null||a.removeEventListener("mousemove",m.moveHandler),a==null||a.removeEventListener("mouseup",m.upHandler),c(v.clientX)}},h={moveHandler:v=>(v.cancelable&&(v.preventDefault(),v.stopPropagation()),p(v.touches[0].clientX),!1),upHandler:v=>{var w;a==null||a.removeEventListener("touchmove",h.moveHandler),a==null||a.removeEventListener("touchend",h.upHandler),v.cancelable&&(v.preventDefault(),v.stopPropagation()),c((w=v.touches[0])==null?void 0:w.clientX)}},x=rn()?{passive:!1}:!1;Se(s)?(a==null||a.addEventListener("touchmove",h.moveHandler,x),a==null||a.addEventListener("touchend",h.upHandler,x)):(a==null||a.addEventListener("mousemove",m.moveHandler,x),a==null||a.addEventListener("mouseup",m.upHandler,x)),o.setColumnSizingInfo(v=>({...v,startOffset:u,startSize:i,deltaOffset:0,deltaPercentage:0,columnSizingStart:f,isResizingColumn:n.id}))}}},createTable:e=>{e.setColumnSizing=o=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(o),e.setColumnSizingInfo=o=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(o),e.resetColumnSizing=o=>{var t;e.setColumnSizing(o?{}:(t=e.initialState.columnSizing)!=null?t:{})},e.resetHeaderSizeInfo=o=>{var t;e.setColumnSizingInfo(o?Ce():(t=e.initialState.columnSizingInfo)!=null?t:Ce())},e.getTotalSize=()=>{var o,t;return(o=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((n,r)=>n+r.getSize(),0))!=null?o:0},e.getLeftTotalSize=()=>{var o,t;return(o=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((n,r)=>n+r.getSize(),0))!=null?o:0},e.getCenterTotalSize=()=>{var o,t;return(o=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((n,r)=>n+r.getSize(),0))!=null?o:0},e.getRightTotalSize=()=>{var o,t;return(o=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((n,r)=>n+r.getSize(),0))!=null?o:0}}};let pe=null;function rn(){if(typeof pe=="boolean")return pe;let e=!1;try{const o={get passive(){return e=!0,!1}},t=()=>{};window.addEventListener("test",t,o),window.removeEventListener("test",t)}catch{e=!1}return pe=e,pe}function Se(e){return e.type==="touchstart"}const sn={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:G("columnVisibility",e)}),createColumn:(e,o)=>{e.toggleVisibility=t=>{e.getCanHide()&&o.setColumnVisibility(n=>({...n,[e.id]:t??!e.getIsVisible()}))},e.getIsVisible=()=>{var t,n;const r=e.columns;return(t=r.length?r.some(s=>s.getIsVisible()):(n=o.getState().columnVisibility)==null?void 0:n[e.id])!=null?t:!0},e.getCanHide=()=>{var t,n;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((n=o.options.enableHiding)!=null?n:!0)},e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,o)=>{e._getAllVisibleCells=S(()=>[e.getAllCells(),o.getState().columnVisibility],t=>t.filter(n=>n.column.getIsVisible()),y(o.options,"debugRows","_getAllVisibleCells")),e.getVisibleCells=S(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,n,r)=>[...t,...n,...r],y(o.options,"debugRows","getVisibleCells"))},createTable:e=>{const o=(t,n)=>S(()=>[n(),n().filter(r=>r.getIsVisible()).map(r=>r.id).join("_")],r=>r.filter(s=>s.getIsVisible==null?void 0:s.getIsVisible()),y(e.options,"debugColumns",t));e.getVisibleFlatColumns=o("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=o("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=o("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=o("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=o("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var n;e.setColumnVisibility(t?{}:(n=e.initialState.columnVisibility)!=null?n:{})},e.toggleAllColumnsVisible=t=>{var n;t=(n=t)!=null?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((r,s)=>({...r,[s.id]:t||!(s.getCanHide!=null&&s.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var n;e.toggleAllColumnsVisible((n=t.target)==null?void 0:n.checked)}}};function ue(e,o){return o?o==="center"?e.getCenterVisibleLeafColumns():o==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const ln={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},an={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:G("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:o=>{var t;const n=(t=e.getCoreRowModel().flatRows[0])==null||(t=t._getAllCellsByColumnId()[o.id])==null?void 0:t.getValue();return typeof n=="string"||typeof n=="number"}}),createColumn:(e,o)=>{e.getCanGlobalFilter=()=>{var t,n,r,s;return((t=e.columnDef.enableGlobalFilter)!=null?t:!0)&&((n=o.options.enableGlobalFilter)!=null?n:!0)&&((r=o.options.enableFilters)!=null?r:!0)&&((s=o.options.getColumnCanGlobalFilter==null?void 0:o.options.getColumnCanGlobalFilter(e))!=null?s:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>X.includesString,e.getGlobalFilterFn=()=>{var o,t;const{globalFilterFn:n}=e.options;return me(n)?n:n==="auto"?e.getGlobalAutoFilterFn():(o=(t=e.options.filterFns)==null?void 0:t[n])!=null?o:X[n]},e.setGlobalFilter=o=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(o)},e.resetGlobalFilter=o=>{e.setGlobalFilter(o?void 0:e.initialState.globalFilter)}}},un={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:G("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let o=!1,t=!1;e._autoResetExpanded=()=>{var n,r;if(!o){e._queue(()=>{o=!0});return}if((n=(r=e.options.autoResetAll)!=null?r:e.options.autoResetExpanded)!=null?n:!e.options.manualExpanding){if(t)return;t=!0,e._queue(()=>{e.resetExpanded(),t=!1})}},e.setExpanded=n=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(n),e.toggleAllRowsExpanded=n=>{n??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=n=>{var r,s;e.setExpanded(n?{}:(r=(s=e.initialState)==null?void 0:s.expanded)!=null?r:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(n=>n.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>n=>{n.persist==null||n.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const n=e.getState().expanded;return n===!0||Object.values(n).some(Boolean)},e.getIsAllRowsExpanded=()=>{const n=e.getState().expanded;return typeof n=="boolean"?n===!0:!(!Object.keys(n).length||e.getRowModel().flatRows.some(r=>!r.getIsExpanded()))},e.getExpandedDepth=()=>{let n=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(s=>{const i=s.split(".");n=Math.max(n,i.length)}),n},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,o)=>{e.toggleExpanded=t=>{o.setExpanded(n=>{var r;const s=n===!0?!0:!!(n!=null&&n[e.id]);let i={};if(n===!0?Object.keys(o.getRowModel().rowsById).forEach(f=>{i[f]=!0}):i=n,t=(r=t)!=null?r:!s,!s&&t)return{...i,[e.id]:!0};if(s&&!t){const{[e.id]:f,...u}=i;return u}return n})},e.getIsExpanded=()=>{var t;const n=o.getState().expanded;return!!((t=o.options.getIsRowExpanded==null?void 0:o.options.getIsRowExpanded(e))!=null?t:n===!0||n!=null&&n[e.id])},e.getCanExpand=()=>{var t,n,r;return(t=o.options.getRowCanExpand==null?void 0:o.options.getRowCanExpand(e))!=null?t:((n=o.options.enableExpanding)!=null?n:!0)&&!!((r=e.subRows)!=null&&r.length)},e.getIsAllParentsExpanded=()=>{let t=!0,n=e;for(;t&&n.parentId;)n=o.getRow(n.parentId,!0),t=n.getIsExpanded();return t},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},Ie=0,$e=10,ye=()=>({pageIndex:Ie,pageSize:$e}),fn={getInitialState:e=>({...e,pagination:{...ye(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:G("pagination",e)}),createTable:e=>{let o=!1,t=!1;e._autoResetPageIndex=()=>{var n,r;if(!o){e._queue(()=>{o=!0});return}if((n=(r=e.options.autoResetAll)!=null?r:e.options.autoResetPageIndex)!=null?n:!e.options.manualPagination){if(t)return;t=!0,e._queue(()=>{e.resetPageIndex(),t=!1})}},e.setPagination=n=>{const r=s=>W(n,s);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(r)},e.resetPagination=n=>{var r;e.setPagination(n?ye():(r=e.initialState.pagination)!=null?r:ye())},e.setPageIndex=n=>{e.setPagination(r=>{let s=W(n,r.pageIndex);const i=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return s=Math.max(0,Math.min(s,i)),{...r,pageIndex:s}})},e.resetPageIndex=n=>{var r,s;e.setPageIndex(n?Ie:(r=(s=e.initialState)==null||(s=s.pagination)==null?void 0:s.pageIndex)!=null?r:Ie)},e.resetPageSize=n=>{var r,s;e.setPageSize(n?$e:(r=(s=e.initialState)==null||(s=s.pagination)==null?void 0:s.pageSize)!=null?r:$e)},e.setPageSize=n=>{e.setPagination(r=>{const s=Math.max(1,W(n,r.pageSize)),i=r.pageSize*r.pageIndex,f=Math.floor(i/s);return{...r,pageIndex:f,pageSize:s}})},e.setPageCount=n=>e.setPagination(r=>{var s;let i=W(n,(s=e.options.pageCount)!=null?s:-1);return typeof i=="number"&&(i=Math.max(-1,i)),{...r,pageCount:i}}),e.getPageOptions=S(()=>[e.getPageCount()],n=>{let r=[];return n&&n>0&&(r=[...new Array(n)].fill(null).map((s,i)=>i)),r},y(e.options,"debugTable","getPageOptions")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:n}=e.getState().pagination,r=e.getPageCount();return r===-1?!0:r===0?!1:n<r-1},e.previousPage=()=>e.setPageIndex(n=>n-1),e.nextPage=()=>e.setPageIndex(n=>n+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var n;return(n=e.options.pageCount)!=null?n:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var n;return(n=e.options.rowCount)!=null?n:e.getPrePaginationRowModel().rows.length}}},Re=()=>({top:[],bottom:[]}),dn={getInitialState:e=>({rowPinning:Re(),...e}),getDefaultOptions:e=>({onRowPinningChange:G("rowPinning",e)}),createRow:(e,o)=>{e.pin=(t,n,r)=>{const s=n?e.getLeafRows().map(u=>{let{id:d}=u;return d}):[],i=r?e.getParentRows().map(u=>{let{id:d}=u;return d}):[],f=new Set([...i,e.id,...s]);o.setRowPinning(u=>{var d,g;if(t==="bottom"){var p,c;return{top:((p=u==null?void 0:u.top)!=null?p:[]).filter(h=>!(f!=null&&f.has(h))),bottom:[...((c=u==null?void 0:u.bottom)!=null?c:[]).filter(h=>!(f!=null&&f.has(h))),...Array.from(f)]}}if(t==="top"){var a,m;return{top:[...((a=u==null?void 0:u.top)!=null?a:[]).filter(h=>!(f!=null&&f.has(h))),...Array.from(f)],bottom:((m=u==null?void 0:u.bottom)!=null?m:[]).filter(h=>!(f!=null&&f.has(h)))}}return{top:((d=u==null?void 0:u.top)!=null?d:[]).filter(h=>!(f!=null&&f.has(h))),bottom:((g=u==null?void 0:u.bottom)!=null?g:[]).filter(h=>!(f!=null&&f.has(h)))}})},e.getCanPin=()=>{var t;const{enableRowPinning:n,enablePinning:r}=o.options;return typeof n=="function"?n(e):(t=n??r)!=null?t:!0},e.getIsPinned=()=>{const t=[e.id],{top:n,bottom:r}=o.getState().rowPinning,s=t.some(f=>n==null?void 0:n.includes(f)),i=t.some(f=>r==null?void 0:r.includes(f));return s?"top":i?"bottom":!1},e.getPinnedIndex=()=>{var t,n;const r=e.getIsPinned();if(!r)return-1;const s=(t=r==="top"?o.getTopRows():o.getBottomRows())==null?void 0:t.map(i=>{let{id:f}=i;return f});return(n=s==null?void 0:s.indexOf(e.id))!=null?n:-1}},createTable:e=>{e.setRowPinning=o=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(o),e.resetRowPinning=o=>{var t,n;return e.setRowPinning(o?Re():(t=(n=e.initialState)==null?void 0:n.rowPinning)!=null?t:Re())},e.getIsSomeRowsPinned=o=>{var t;const n=e.getState().rowPinning;if(!o){var r,s;return!!((r=n.top)!=null&&r.length||(s=n.bottom)!=null&&s.length)}return!!((t=n[o])!=null&&t.length)},e._getPinnedRows=(o,t,n)=>{var r;return((r=e.options.keepPinnedRows)==null||r?(t??[]).map(i=>{const f=e.getRow(i,!0);return f.getIsAllParentsExpanded()?f:null}):(t??[]).map(i=>o.find(f=>f.id===i))).filter(Boolean).map(i=>({...i,position:n}))},e.getTopRows=S(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(o,t)=>e._getPinnedRows(o,t,"top"),y(e.options,"debugRows","getTopRows")),e.getBottomRows=S(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(o,t)=>e._getPinnedRows(o,t,"bottom"),y(e.options,"debugRows","getBottomRows")),e.getCenterRows=S(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(o,t,n)=>{const r=new Set([...t??[],...n??[]]);return o.filter(s=>!r.has(s.id))},y(e.options,"debugRows","getCenterRows"))}},cn={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:G("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=o=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(o),e.resetRowSelection=o=>{var t;return e.setRowSelection(o?{}:(t=e.initialState.rowSelection)!=null?t:{})},e.toggleAllRowsSelected=o=>{e.setRowSelection(t=>{o=typeof o<"u"?o:!e.getIsAllRowsSelected();const n={...t},r=e.getPreGroupedRowModel().flatRows;return o?r.forEach(s=>{s.getCanSelect()&&(n[s.id]=!0)}):r.forEach(s=>{delete n[s.id]}),n})},e.toggleAllPageRowsSelected=o=>e.setRowSelection(t=>{const n=typeof o<"u"?o:!e.getIsAllPageRowsSelected(),r={...t};return e.getRowModel().rows.forEach(s=>{Me(r,s.id,n,!0,e)}),r}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=S(()=>[e.getState().rowSelection,e.getCoreRowModel()],(o,t)=>Object.keys(o).length?_e(e,t):{rows:[],flatRows:[],rowsById:{}},y(e.options,"debugTable","getSelectedRowModel")),e.getFilteredSelectedRowModel=S(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(o,t)=>Object.keys(o).length?_e(e,t):{rows:[],flatRows:[],rowsById:{}},y(e.options,"debugTable","getFilteredSelectedRowModel")),e.getGroupedSelectedRowModel=S(()=>[e.getState().rowSelection,e.getSortedRowModel()],(o,t)=>Object.keys(o).length?_e(e,t):{rows:[],flatRows:[],rowsById:{}},y(e.options,"debugTable","getGroupedSelectedRowModel")),e.getIsAllRowsSelected=()=>{const o=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState();let n=!!(o.length&&Object.keys(t).length);return n&&o.some(r=>r.getCanSelect()&&!t[r.id])&&(n=!1),n},e.getIsAllPageRowsSelected=()=>{const o=e.getPaginationRowModel().flatRows.filter(r=>r.getCanSelect()),{rowSelection:t}=e.getState();let n=!!o.length;return n&&o.some(r=>!t[r.id])&&(n=!1),n},e.getIsSomeRowsSelected=()=>{var o;const t=Object.keys((o=e.getState().rowSelection)!=null?o:{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const o=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:o.filter(t=>t.getCanSelect()).some(t=>t.getIsSelected()||t.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>o=>{e.toggleAllRowsSelected(o.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>o=>{e.toggleAllPageRowsSelected(o.target.checked)}},createRow:(e,o)=>{e.toggleSelected=(t,n)=>{const r=e.getIsSelected();o.setRowSelection(s=>{var i;if(t=typeof t<"u"?t:!r,e.getCanSelect()&&r===t)return s;const f={...s};return Me(f,e.id,t,(i=n==null?void 0:n.selectChildren)!=null?i:!0,o),f})},e.getIsSelected=()=>{const{rowSelection:t}=o.getState();return Ee(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=o.getState();return Ne(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=o.getState();return Ne(e,t)==="all"},e.getCanSelect=()=>{var t;return typeof o.options.enableRowSelection=="function"?o.options.enableRowSelection(e):(t=o.options.enableRowSelection)!=null?t:!0},e.getCanSelectSubRows=()=>{var t;return typeof o.options.enableSubRowSelection=="function"?o.options.enableSubRowSelection(e):(t=o.options.enableSubRowSelection)!=null?t:!0},e.getCanMultiSelect=()=>{var t;return typeof o.options.enableMultiRowSelection=="function"?o.options.enableMultiRowSelection(e):(t=o.options.enableMultiRowSelection)!=null?t:!0},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return n=>{var r;t&&e.toggleSelected((r=n.target)==null?void 0:r.checked)}}}},Me=(e,o,t,n,r)=>{var s;const i=r.getRow(o,!0);t?(i.getCanMultiSelect()||Object.keys(e).forEach(f=>delete e[f]),i.getCanSelect()&&(e[o]=!0)):delete e[o],n&&(s=i.subRows)!=null&&s.length&&i.getCanSelectSubRows()&&i.subRows.forEach(f=>Me(e,f.id,t,n,r))};function _e(e,o){const t=e.getState().rowSelection,n=[],r={},s=function(i,f){return i.map(u=>{var d;const g=Ee(u,t);if(g&&(n.push(u),r[u.id]=u),(d=u.subRows)!=null&&d.length&&(u={...u,subRows:s(u.subRows)}),g)return u}).filter(Boolean)};return{rows:s(o.rows),flatRows:n,rowsById:r}}function Ee(e,o){var t;return(t=o[e.id])!=null?t:!1}function Ne(e,o,t){var n;if(!((n=e.subRows)!=null&&n.length))return!1;let r=!0,s=!1;return e.subRows.forEach(i=>{if(!(s&&!r)&&(i.getCanSelect()&&(Ee(i,o)?s=!0:r=!1),i.subRows&&i.subRows.length)){const f=Ne(i,o);f==="all"?s=!0:(f==="some"&&(s=!0),r=!1)}}),r?"all":s?"some":!1}const Ve=/([0-9]+)/gm,gn=(e,o,t)=>ot(Q(e.getValue(t)).toLowerCase(),Q(o.getValue(t)).toLowerCase()),pn=(e,o,t)=>ot(Q(e.getValue(t)),Q(o.getValue(t))),mn=(e,o,t)=>be(Q(e.getValue(t)).toLowerCase(),Q(o.getValue(t)).toLowerCase()),hn=(e,o,t)=>be(Q(e.getValue(t)),Q(o.getValue(t))),vn=(e,o,t)=>{const n=e.getValue(t),r=o.getValue(t);return n>r?1:n<r?-1:0},xn=(e,o,t)=>be(e.getValue(t),o.getValue(t));function be(e,o){return e===o?0:e>o?1:-1}function Q(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function ot(e,o){const t=e.split(Ve).filter(Boolean),n=o.split(Ve).filter(Boolean);for(;t.length&&n.length;){const r=t.shift(),s=n.shift(),i=parseInt(r,10),f=parseInt(s,10),u=[i,f].sort();if(isNaN(u[0])){if(r>s)return 1;if(s>r)return-1;continue}if(isNaN(u[1]))return isNaN(i)?-1:1;if(i>f)return 1;if(f>i)return-1}return t.length-n.length}const ae={alphanumeric:gn,alphanumericCaseSensitive:pn,text:mn,textCaseSensitive:hn,datetime:vn,basic:xn},wn={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:G("sorting",e),isMultiSortEvent:o=>o.shiftKey}),createColumn:(e,o)=>{e.getAutoSortingFn=()=>{const t=o.getFilteredRowModel().flatRows.slice(10);let n=!1;for(const r of t){const s=r==null?void 0:r.getValue(e.id);if(Object.prototype.toString.call(s)==="[object Date]")return ae.datetime;if(typeof s=="string"&&(n=!0,s.split(Ve).length>1))return ae.alphanumeric}return n?ae.text:ae.basic},e.getAutoSortDir=()=>{const t=o.getFilteredRowModel().flatRows[0];return typeof(t==null?void 0:t.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var t,n;if(!e)throw new Error;return me(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(t=(n=o.options.sortingFns)==null?void 0:n[e.columnDef.sortingFn])!=null?t:ae[e.columnDef.sortingFn]},e.toggleSorting=(t,n)=>{const r=e.getNextSortingOrder(),s=typeof t<"u"&&t!==null;o.setSorting(i=>{const f=i==null?void 0:i.find(a=>a.id===e.id),u=i==null?void 0:i.findIndex(a=>a.id===e.id);let d=[],g,p=s?t:r==="desc";if(i!=null&&i.length&&e.getCanMultiSort()&&n?f?g="toggle":g="add":i!=null&&i.length&&u!==i.length-1?g="replace":f?g="toggle":g="replace",g==="toggle"&&(s||r||(g="remove")),g==="add"){var c;d=[...i,{id:e.id,desc:p}],d.splice(0,d.length-((c=o.options.maxMultiSortColCount)!=null?c:Number.MAX_SAFE_INTEGER))}else g==="toggle"?d=i.map(a=>a.id===e.id?{...a,desc:p}:a):g==="remove"?d=i.filter(a=>a.id!==e.id):d=[{id:e.id,desc:p}];return d})},e.getFirstSortDir=()=>{var t,n;return((t=(n=e.columnDef.sortDescFirst)!=null?n:o.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=t=>{var n,r;const s=e.getFirstSortDir(),i=e.getIsSorted();return i?i!==s&&((n=o.options.enableSortingRemoval)==null||n)&&(!(t&&(r=o.options.enableMultiRemove)!=null)||r)?!1:i==="desc"?"asc":"desc":s},e.getCanSort=()=>{var t,n;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((n=o.options.enableSorting)!=null?n:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var t,n;return(t=(n=e.columnDef.enableMultiSort)!=null?n:o.options.enableMultiSort)!=null?t:!!e.accessorFn},e.getIsSorted=()=>{var t;const n=(t=o.getState().sorting)==null?void 0:t.find(r=>r.id===e.id);return n?n.desc?"desc":"asc":!1},e.getSortIndex=()=>{var t,n;return(t=(n=o.getState().sorting)==null?void 0:n.findIndex(r=>r.id===e.id))!=null?t:-1},e.clearSorting=()=>{o.setSorting(t=>t!=null&&t.length?t.filter(n=>n.id!==e.id):[])},e.getToggleSortingHandler=()=>{const t=e.getCanSort();return n=>{t&&(n.persist==null||n.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?o.options.isMultiSortEvent==null?void 0:o.options.isMultiSortEvent(n):!1))}}},createTable:e=>{e.setSorting=o=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(o),e.resetSorting=o=>{var t,n;e.setSorting(o?[]:(t=(n=e.initialState)==null?void 0:n.sorting)!=null?t:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},Cn=[Ht,sn,en,tn,Gt,Ot,ln,an,wn,Yt,un,fn,dn,cn,on];function Sn(e){var o,t;process.env.NODE_ENV!=="production"&&(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");const n=[...Cn,...(o=e._features)!=null?o:[]];let r={_features:n};const s=r._features.reduce((c,a)=>Object.assign(c,a.getDefaultOptions==null?void 0:a.getDefaultOptions(r)),{}),i=c=>r.options.mergeOptions?r.options.mergeOptions(s,c):{...s,...c};let u={...{},...(t=e.initialState)!=null?t:{}};r._features.forEach(c=>{var a;u=(a=c.getInitialState==null?void 0:c.getInitialState(u))!=null?a:u});const d=[];let g=!1;const p={_features:n,options:{...s,...e},initialState:u,_queue:c=>{d.push(c),g||(g=!0,Promise.resolve().then(()=>{for(;d.length;)d.shift()();g=!1}).catch(a=>setTimeout(()=>{throw a})))},reset:()=>{r.setState(r.initialState)},setOptions:c=>{const a=W(c,r.options);r.options=i(a)},getState:()=>r.options.state,setState:c=>{r.options.onStateChange==null||r.options.onStateChange(c)},_getRowId:(c,a,m)=>{var h;return(h=r.options.getRowId==null?void 0:r.options.getRowId(c,a,m))!=null?h:`${m?[m.id,a].join("."):a}`},getCoreRowModel:()=>(r._getCoreRowModel||(r._getCoreRowModel=r.options.getCoreRowModel(r)),r._getCoreRowModel()),getRowModel:()=>r.getPaginationRowModel(),getRow:(c,a)=>{let m=(a?r.getPrePaginationRowModel():r.getRowModel()).rowsById[c];if(!m&&(m=r.getCoreRowModel().rowsById[c],!m))throw process.env.NODE_ENV!=="production"?new Error(`getRow could not find row with ID: ${c}`):new Error;return m},_getDefaultColumnDef:S(()=>[r.options.defaultColumn],c=>{var a;return c=(a=c)!=null?a:{},{header:m=>{const h=m.header.column.columnDef;return h.accessorKey?h.accessorKey:h.accessorFn?h.id:null},cell:m=>{var h,x;return(h=(x=m.renderValue())==null||x.toString==null?void 0:x.toString())!=null?h:null},...r._features.reduce((m,h)=>Object.assign(m,h.getDefaultColumnDef==null?void 0:h.getDefaultColumnDef()),{}),...c}},y(e,"debugColumns","_getDefaultColumnDef")),_getColumnDefs:()=>r.options.columns,getAllColumns:S(()=>[r._getColumnDefs()],c=>{const a=function(m,h,x){return x===void 0&&(x=0),m.map(v=>{const w=At(r,v,x,h),j=v;return w.columns=j.columns?a(j.columns,w,x+1):[],w})};return a(c)},y(e,"debugColumns","getAllColumns")),getAllFlatColumns:S(()=>[r.getAllColumns()],c=>c.flatMap(a=>a.getFlatColumns()),y(e,"debugColumns","getAllFlatColumns")),_getAllFlatColumnsById:S(()=>[r.getAllFlatColumns()],c=>c.reduce((a,m)=>(a[m.id]=m,a),{}),y(e,"debugColumns","getAllFlatColumnsById")),getAllLeafColumns:S(()=>[r.getAllColumns(),r._getOrderColumnsFn()],(c,a)=>{let m=c.flatMap(h=>h.getLeafColumns());return a(m)},y(e,"debugColumns","getAllLeafColumns")),getColumn:c=>{const a=r._getAllFlatColumnsById()[c];return process.env.NODE_ENV!=="production"&&!a&&console.error(`[Table] Column with id '${c}' does not exist.`),a}};Object.assign(r,p);for(let c=0;c<r._features.length;c++){const a=r._features[c];a==null||a.createTable==null||a.createTable(r)}return r}function yn(){return e=>S(()=>[e.options.data],o=>{const t={rows:[],flatRows:[],rowsById:{}},n=function(r,s,i){s===void 0&&(s=0);const f=[];for(let d=0;d<r.length;d++){const g=Pe(e,e._getRowId(r[d],d,i),r[d],d,s,void 0,i==null?void 0:i.id);if(t.flatRows.push(g),t.rowsById[g.id]=g,f.push(g),e.options.getSubRows){var u;g.originalSubRows=e.options.getSubRows(r[d],d),(u=g.originalSubRows)!=null&&u.length&&(g.subRows=n(g.originalSubRows,s+1,g))}}return f};return t.rows=n(o),t},y(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function Rn(e){const o=[],t=n=>{var r;o.push(n),(r=n.subRows)!=null&&r.length&&n.getIsExpanded()&&n.subRows.forEach(t)};return e.rows.forEach(t),{rows:o,flatRows:e.flatRows,rowsById:e.rowsById}}function _n(e,o,t){return t.options.filterFromLeafRows?Fn(e,o,t):jn(e,o,t)}function Fn(e,o,t){var n;const r=[],s={},i=(n=t.options.maxLeafRowFilterDepth)!=null?n:100,f=function(u,d){d===void 0&&(d=0);const g=[];for(let c=0;c<u.length;c++){var p;let a=u[c];const m=Pe(t,a.id,a.original,a.index,a.depth,void 0,a.parentId);if(m.columnFilters=a.columnFilters,(p=a.subRows)!=null&&p.length&&d<i){if(m.subRows=f(a.subRows,d+1),a=m,o(a)&&!m.subRows.length){g.push(a),s[a.id]=a,r.push(a);continue}if(o(a)||m.subRows.length){g.push(a),s[a.id]=a,r.push(a);continue}}else a=m,o(a)&&(g.push(a),s[a.id]=a,r.push(a))}return g};return{rows:f(e),flatRows:r,rowsById:s}}function jn(e,o,t){var n;const r=[],s={},i=(n=t.options.maxLeafRowFilterDepth)!=null?n:100,f=function(u,d){d===void 0&&(d=0);const g=[];for(let c=0;c<u.length;c++){let a=u[c];if(o(a)){var p;if((p=a.subRows)!=null&&p.length&&d<i){const h=Pe(t,a.id,a.original,a.index,a.depth,void 0,a.parentId);h.subRows=f(a.subRows,d+1),a=h}g.push(a),r.push(a),s[a.id]=a}}return g};return{rows:f(e),flatRows:r,rowsById:s}}function In(){return e=>S(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(o,t,n)=>{if(!o.rows.length||!(t!=null&&t.length)&&!n){for(let c=0;c<o.flatRows.length;c++)o.flatRows[c].columnFilters={},o.flatRows[c].columnFiltersMeta={};return o}const r=[],s=[];(t??[]).forEach(c=>{var a;const m=e.getColumn(c.id);if(!m)return;const h=m.getFilterFn();if(!h){process.env.NODE_ENV!=="production"&&console.warn(`Could not find a valid 'column.filterFn' for column with the ID: ${m.id}.`);return}r.push({id:c.id,filterFn:h,resolvedValue:(a=h.resolveFilterValue==null?void 0:h.resolveFilterValue(c.value))!=null?a:c.value})});const i=(t??[]).map(c=>c.id),f=e.getGlobalFilterFn(),u=e.getAllLeafColumns().filter(c=>c.getCanGlobalFilter());n&&f&&u.length&&(i.push("__global__"),u.forEach(c=>{var a;s.push({id:c.id,filterFn:f,resolvedValue:(a=f.resolveFilterValue==null?void 0:f.resolveFilterValue(n))!=null?a:n})}));let d,g;for(let c=0;c<o.flatRows.length;c++){const a=o.flatRows[c];if(a.columnFilters={},r.length)for(let m=0;m<r.length;m++){d=r[m];const h=d.id;a.columnFilters[h]=d.filterFn(a,h,d.resolvedValue,x=>{a.columnFiltersMeta[h]=x})}if(s.length){for(let m=0;m<s.length;m++){g=s[m];const h=g.id;if(g.filterFn(a,h,g.resolvedValue,x=>{a.columnFiltersMeta[h]=x})){a.columnFilters.__global__=!0;break}}a.columnFilters.__global__!==!0&&(a.columnFilters.__global__=!1)}}const p=c=>{for(let a=0;a<i.length;a++)if(c.columnFilters[i[a]]===!1)return!1;return!0};return _n(o.rows,p,e)},y(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function $n(e){return o=>S(()=>[o.getState().pagination,o.getPrePaginationRowModel(),o.options.paginateExpandedRows?void 0:o.getState().expanded],(t,n)=>{if(!n.rows.length)return n;const{pageSize:r,pageIndex:s}=t;let{rows:i,flatRows:f,rowsById:u}=n;const d=r*s,g=d+r;i=i.slice(d,g);let p;o.options.paginateExpandedRows?p={rows:i,flatRows:f,rowsById:u}:p=Rn({rows:i,flatRows:f,rowsById:u}),p.flatRows=[];const c=a=>{p.flatRows.push(a),a.subRows.length&&a.subRows.forEach(c)};return p.rows.forEach(c),p},y(o.options,"debugTable","getPaginationRowModel"))}function Mn(){return e=>S(()=>[e.getState().sorting,e.getPreSortedRowModel()],(o,t)=>{if(!t.rows.length||!(o!=null&&o.length))return t;const n=e.getState().sorting,r=[],s=n.filter(u=>{var d;return(d=e.getColumn(u.id))==null?void 0:d.getCanSort()}),i={};s.forEach(u=>{const d=e.getColumn(u.id);d&&(i[u.id]={sortUndefined:d.columnDef.sortUndefined,invertSorting:d.columnDef.invertSorting,sortingFn:d.getSortingFn()})});const f=u=>{const d=u.map(g=>({...g}));return d.sort((g,p)=>{for(let a=0;a<s.length;a+=1){var c;const m=s[a],h=i[m.id],x=h.sortUndefined,v=(c=m==null?void 0:m.desc)!=null?c:!1;let w=0;if(x){const j=g.getValue(m.id),F=p.getValue(m.id),$=j===void 0,V=F===void 0;if($||V){if(x==="first")return $?-1:1;if(x==="last")return $?1:-1;w=$&&V?0:$?x:-x}}if(w===0&&(w=h.sortingFn(g,p,m.id)),w!==0)return v&&(w*=-1),h.invertSorting&&(w*=-1),w}return g.index-p.index}),d.forEach(g=>{var p;r.push(g),(p=g.subRows)!=null&&p.length&&(g.subRows=f(g.subRows))}),d};return{rows:f(t.rows),flatRows:r,rowsById:t.rowsById}},y(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/**
54
+ * react-table
55
+ *
56
+ * Copyright (c) TanStack
57
+ *
58
+ * This source code is licensed under the MIT license found in the
59
+ * LICENSE.md file in the root directory of this source tree.
60
+ *
61
+ * @license MIT
62
+ */function Ke(e,o){return e?Nn(e)?je.createElement(e,o):e:null}function Nn(e){return Vn(e)||typeof e=="function"||Pn(e)}function Vn(e){return typeof e=="function"&&(()=>{const o=Object.getPrototypeOf(e);return o.prototype&&o.prototype.isReactComponent})()}function Pn(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function kn(e){const o={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=je.useState(()=>({current:Sn(o)})),[n,r]=je.useState(()=>t.current.initialState);return t.current.setOptions(s=>({...s,...e,state:{...n,...e.state},onStateChange:i=>{r(i),e.onStateChange==null||e.onStateChange(i)}})),t.current}const rt=({editable:e=!0,deletable:o=!0,pageSize:t=25,onCellEdit:n,onRowDelete:r})=>{const{rows:s,schema:i,mappings:f,errorsByRow:u,editingCell:d,startEditing:g,stopEditing:p,updateCell:c,deleteRow:a}=ee(),[m,h]=P.useState([]),[x,v]=P.useState(""),[w,j]=P.useState(""),[F,$]=P.useState(null),[V]=P.useState("onChange"),K=P.useMemo(()=>f.filter(R=>R.targetKey!==null).map(R=>{const _=i==null?void 0:i.columns.find(I=>I.key===R.targetKey);return{sourceColumn:R.sourceColumn,targetKey:R.targetKey,label:(_==null?void 0:_.label)||R.targetKey,type:(_==null?void 0:_.type)||"string"}}),[f,i]),Z=P.useCallback((R,_)=>{const I=u.get(R);return I==null?void 0:I.find(Y=>Y.columnKey===_)},[u]),re=P.useCallback((R,_)=>{if(!i)return null;const I=i.columns.find(le=>le.key===_);if(!I)return null;const b=qe(R,I).find(le=>le.severity==="error");return b?b.message:null},[i]),z=(R,_,I)=>{j(I),$(null),g(R,_)},O=(R,_)=>{j(R);const I=re(R,_);$(I)},se=()=>{F||(d&&(c(d.rowIndex,d.columnKey,w),n==null||n(d.rowIndex,d.columnKey,w)),$(null),p())},A=()=>{j(""),$(null),p()},fe=R=>{a(R),r==null||r(R)},te=bt(),ne=P.useMemo(()=>[te.accessor("rowIndex",{header:"#",size:o?80:60,enableResizing:!1,cell:R=>{const _=R.getValue();return l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[l.jsx("span",{className:"ff-font-mono ff-text-xs",style:{color:"var(--ff-text-muted)"},children:_+1}),o&&l.jsx("button",{onClick:I=>{I.stopPropagation(),fe(_)},title:"Delete row",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"4px",borderRadius:"4px",cursor:"pointer",color:"#8e8d89",background:"transparent",border:"none",transition:"color 0.15s, background-color 0.15s",marginLeft:"2px",flexShrink:0},onMouseEnter:I=>{I.currentTarget.style.color="#d43338",I.currentTarget.style.backgroundColor="#fcdede"},onMouseLeave:I=>{I.currentTarget.style.color="#8e8d89",I.currentTarget.style.backgroundColor="transparent"},children:l.jsx(Et,{style:{width:"14px",height:"14px",display:"block"}})})]})}}),...K.map(R=>te.accessor(_=>_.data[R.targetKey]||_.data[R.sourceColumn],{id:R.targetKey,header:R.label,size:150,minSize:80,cell:_=>{const I=_.row.original.rowIndex,Y=String(_.getValue()??""),b=Z(I,R.targetKey);return(d==null?void 0:d.rowIndex)===I&&(d==null?void 0:d.columnKey)===R.targetKey?l.jsxs("div",{className:"ff-min-w-[280px]",children:[l.jsxs("div",{className:"ff-flex ff-items-center ff-gap-2",children:[l.jsx("input",{type:"text",value:w,onChange:J=>O(J.target.value,R.targetKey),onKeyDown:J=>{J.key==="Enter"&&!F&&se(),J.key==="Escape"&&A()},className:C.clsx("ff-input ff-py-2 ff-px-3 ff-text-sm ff-flex-1 ff-min-w-[160px]",F&&"ff-input-error"),autoFocus:!0}),l.jsx("button",{onClick:se,disabled:!!F,className:"ff-btn ff-btn-primary ff-btn-sm ff-flex-shrink-0",style:F?{opacity:.5,cursor:"not-allowed"}:void 0,children:"Save"}),l.jsx("button",{onClick:A,className:"ff-btn ff-btn-secondary ff-btn-sm ff-flex-shrink-0",children:"Cancel"})]}),F&&l.jsx("p",{className:"ff-text-xs ff-mt-1",style:{color:"var(--ff-error)"},children:F})]}):l.jsxs("div",{className:C.clsx("ff-group ff-flex ff-items-center ff-gap-2",(b==null?void 0:b.severity)==="error"&&"ff-cell-error",(b==null?void 0:b.severity)==="warning"&&"ff-cell-warning"),children:[l.jsx("span",{className:"ff-flex-1 ff-truncate",children:Y||l.jsx("span",{style:{color:"var(--ff-text-muted)"},children:"—"})}),b&&l.jsxs("div",{className:"ff-relative ff-group/tooltip",children:[b.severity==="error"?l.jsx(C.CircleAlert,{className:"ff-w-4 ff-h-4",style:{color:"var(--ff-error)"}}):l.jsx(C.TriangleAlert,{className:"ff-w-4 ff-h-4",style:{color:"var(--ff-warning)"}}),l.jsxs("div",{className:"ff-tooltip ff-bottom-full ff-left-1/2 ff-transform ff--translate-x-1/2 ff-mb-2 ff-w-48 group-hover/tooltip:ff-tooltip-visible",children:[b.message,b.suggestion&&l.jsx("span",{className:"ff-block ff-mt-1",style:{color:"var(--ff-text-muted)"},children:b.suggestion})]})]}),e&&l.jsx("button",{onClick:()=>z(I,R.targetKey,Y),className:"ff-opacity-0 group-hover:ff-opacity-100 ff-p-1 ff-rounded ff-transition-opacity ff-edit-btn",children:l.jsx(Pt,{className:"ff-w-3 ff-h-3"})})]})}}))],[K,d,w,F,e,o,Z,te]),E=kn({data:s,columns:ne,columnResizeMode:V,enableColumnResizing:!0,state:{sorting:m,globalFilter:x},onSortingChange:h,onGlobalFilterChange:v,getCoreRowModel:yn(),getPaginationRowModel:$n(),getSortedRowModel:Mn(),getFilteredRowModel:In(),initialState:{pagination:{pageSize:t}}});return l.jsxs("div",{className:"ff-space-y-4",children:[l.jsxs("div",{className:"ff-flex ff-items-center ff-justify-between",children:[l.jsx("input",{type:"text",value:x,onChange:R=>v(R.target.value),placeholder:"Search all columns...",className:"ff-input ff-max-w-xs"}),l.jsxs("div",{className:"ff-text-sm",style:{color:"var(--ff-text-muted)"},children:[E.getFilteredRowModel().rows.length," rows"]})]}),l.jsx("div",{className:"ff-table-container ff-max-h-[500px]",children:l.jsxs("table",{className:"ff-table",style:{width:E.getCenterTotalSize()},children:[l.jsx("thead",{children:E.getHeaderGroups().map(R=>l.jsx("tr",{children:R.headers.map(_=>l.jsxs("th",{style:{width:_.getSize(),position:"relative"},onClick:_.column.getCanSort()?_.column.getToggleSortingHandler():void 0,className:C.clsx(_.column.getCanSort()&&"ff-cursor-pointer ff-select-none"),children:[l.jsxs("div",{className:"ff-flex ff-items-center ff-gap-1",children:[Ke(_.column.columnDef.header,_.getContext()),_.column.getIsSorted()&&l.jsx("span",{children:_.column.getIsSorted()==="asc"?"↑":"↓"})]}),_.column.getCanResize()&&l.jsx("div",{onMouseDown:_.getResizeHandler(),onTouchStart:_.getResizeHandler(),className:"ff-resize-handle",style:{position:"absolute",right:0,top:0,height:"100%",width:"5px",cursor:"col-resize",userSelect:"none",touchAction:"none"}})]},_.id))},R.id))}),l.jsx("tbody",{children:E.getRowModel().rows.map(R=>{const _=u.has(R.original.rowIndex);return l.jsx("tr",{className:C.clsx(_&&"ff-row-error"),children:R.getVisibleCells().map(I=>l.jsx("td",{style:{width:I.column.getSize()},children:Ke(I.column.columnDef.cell,I.getContext())},I.id))},R.id)})})]})}),l.jsxs("div",{className:"ff-flex ff-items-center ff-justify-between ff-px-2",children:[l.jsxs("div",{className:"ff-text-sm",style:{color:"var(--ff-text-muted)"},children:["Page ",E.getState().pagination.pageIndex+1," of ",E.getPageCount()]}),l.jsxs("div",{className:"ff-flex ff-items-center ff-gap-2",children:[l.jsxs("button",{onClick:()=>E.previousPage(),disabled:!E.getCanPreviousPage(),className:"ff-btn ff-btn-secondary ff-btn-sm",children:[l.jsx(_t,{className:"ff-w-4 ff-h-4"}),"Previous"]}),l.jsxs("button",{onClick:()=>E.nextPage(),disabled:!E.getCanNextPage(),className:"ff-btn ff-btn-secondary ff-btn-sm",children:["Next",l.jsx(C.ChevronRight,{className:"ff-w-4 ff-h-4"})]})]})]})]})},st=({showDetails:e=!0})=>{const{validationResults:o}=ee();if(!o)return null;const{isValid:t,totalRows:n,validRows:r,errorCount:s,warningCount:i,infoCount:f,summary:u}=o,d=Math.round(r/n*100);return l.jsxs("div",{className:"ff-space-y-4",children:[l.jsxs("div",{className:"ff-flex ff-items-center ff-gap-4 ff-p-4 ff-rounded-lg ff-border",style:{backgroundColor:t?"var(--ff-success-light)":"var(--ff-error-light)",borderColor:t?"var(--ff-success)":"var(--ff-error)"},children:[t?l.jsx(C.CircleCheckBig,{className:"ff-w-8 ff-h-8",style:{color:"var(--ff-success)"}}):l.jsx(C.CircleX,{className:"ff-w-8 ff-h-8",style:{color:"var(--ff-error)"}}),l.jsxs("div",{children:[l.jsx("h3",{className:"ff-text-lg ff-font-semibold",style:{color:t?"var(--ff-success-dark)":"var(--ff-error-dark)"},children:t?"Validation Passed":"Validation Failed"}),l.jsxs("p",{className:"ff-text-sm",style:{color:t?"var(--ff-success)":"var(--ff-error)"},children:[r," of ",n," rows are valid (",d,"%)"]})]})]}),l.jsxs("div",{className:"ff-grid ff-grid-cols-4 ff-gap-4",children:[l.jsxs("div",{className:"ff-border ff-rounded-lg ff-p-4 ff-text-center",style:{backgroundColor:"var(--ff-bg-primary)",borderColor:"var(--ff-border-light)"},children:[l.jsx("p",{className:"ff-text-2xl ff-font-bold",style:{color:"var(--ff-text-primary)"},children:n}),l.jsx("p",{className:"ff-text-sm",style:{color:"var(--ff-text-muted)"},children:"Total Rows"})]}),l.jsxs("div",{className:"ff-border ff-rounded-lg ff-p-4 ff-text-center",style:{backgroundColor:"var(--ff-success-light)",borderColor:"var(--ff-success)"},children:[l.jsx("p",{className:"ff-text-2xl ff-font-bold",style:{color:"var(--ff-success-dark)"},children:r}),l.jsx("p",{className:"ff-text-sm",style:{color:"var(--ff-success)"},children:"Valid Rows"})]}),l.jsxs("div",{className:"ff-border ff-rounded-lg ff-p-4 ff-text-center",style:{backgroundColor:"var(--ff-error-light)",borderColor:"var(--ff-error)"},children:[l.jsx("p",{className:"ff-text-2xl ff-font-bold",style:{color:"var(--ff-error-dark)"},children:s}),l.jsx("p",{className:"ff-text-sm",style:{color:"var(--ff-error)"},children:"Errors"})]}),l.jsxs("div",{className:"ff-border ff-rounded-lg ff-p-4 ff-text-center",style:{backgroundColor:"var(--ff-warning-light)",borderColor:"var(--ff-warning)"},children:[l.jsx("p",{className:"ff-text-2xl ff-font-bold",style:{color:"var(--ff-warning-dark)"},children:i}),l.jsx("p",{className:"ff-text-sm",style:{color:"var(--ff-warning)"},children:"Warnings"})]})]}),e&&u.byColumn&&Object.keys(u.byColumn).length>0&&l.jsxs("div",{className:"ff-border ff-rounded-xl ff-overflow-hidden",style:{backgroundColor:"var(--ff-bg-primary)",borderColor:"var(--ff-border-light)"},children:[l.jsx("div",{className:"ff-px-4 ff-py-3",style:{backgroundColor:"var(--ff-bg-secondary)"},children:l.jsx("h4",{className:"ff-font-medium ff-text-sm",style:{color:"var(--ff-text-secondary)"},children:"Issues by Column"})}),l.jsx("div",{children:Object.entries(u.byColumn).filter(([,g])=>g.errorCount>0||g.warningCount>0).map(([g,p],c,a)=>l.jsxs("div",{className:"ff-flex ff-items-center ff-justify-between ff-px-4 ff-py-3",style:{borderTop:c>0?"1px solid var(--ff-border-light)":void 0},children:[l.jsxs("div",{className:"ff-flex-1 ff-min-w-0 ff-mr-4",children:[l.jsx("p",{className:"ff-font-medium ff-text-sm",style:{color:"var(--ff-text-primary)"},children:p.columnKey}),p.mostCommonError&&l.jsx("p",{className:"ff-text-sm ff-truncate",style:{color:"var(--ff-text-muted)"},children:p.mostCommonError})]}),l.jsxs("div",{className:"ff-flex ff-items-center ff-gap-2 ff-flex-shrink-0",children:[p.errorCount>0&&l.jsxs("span",{className:"ff-badge ff-badge-error ff-whitespace-nowrap",children:[l.jsx(C.CircleX,{className:"ff-w-3 ff-h-3 ff-mr-1"}),p.errorCount," ",p.errorCount===1?"error":"errors"]}),p.warningCount>0&&l.jsxs("span",{className:"ff-badge ff-badge-warning ff-whitespace-nowrap",children:[l.jsx(C.TriangleAlert,{className:"ff-w-3 ff-h-3 ff-mr-1"}),p.warningCount," ",p.warningCount===1?"warning":"warnings"]})]})]},g))})]}),e&&u.duplicates&&u.duplicates.length>0&&l.jsx("div",{className:"ff-border ff-rounded-lg ff-p-4",style:{backgroundColor:"var(--ff-warning-light)",borderColor:"var(--ff-warning)"},children:l.jsxs("div",{className:"ff-flex ff-items-start ff-gap-3",children:[l.jsx(C.TriangleAlert,{className:"ff-w-5 ff-h-5 ff-flex-shrink-0 ff-mt-0.5",style:{color:"var(--ff-warning)"}}),l.jsxs("div",{children:[l.jsx("h4",{className:"ff-font-medium",style:{color:"var(--ff-warning-dark)"},children:"Duplicate Values Found"}),l.jsxs("ul",{className:"ff-mt-2 ff-space-y-1 ff-text-sm",style:{color:"var(--ff-warning-dark)"},children:[u.duplicates.slice(0,5).map((g,p)=>l.jsxs("li",{children:[l.jsx("span",{className:"ff-font-mono",children:g.columnKey}),': "',String(g.value),'" appears'," ",g.rowIndices.length," times (rows"," ",g.rowIndices.slice(0,3).map(c=>c+1).join(", "),g.rowIndices.length>3?"...":"",")"]},p)),u.duplicates.length>5&&l.jsxs("li",{style:{color:"var(--ff-warning)"},children:["... and ",u.duplicates.length-5," more duplicate groups"]})]})]})]})})]})},Fe=["upload","mapping","validation","complete"],En=({template:e,schema:o,mode:t="modal",theme:n,useShadowDom:r=!1,error:s,onComplete:i,onCancel:f,onError:u})=>{const{step:d,sessionId:g,file:p,rows:c,mappings:a,validationResults:m,isLoading:h,error:x,setSchema:v,setSessionId:w,setParsedData:j,setMappings:F,setUnmapped:$,setValidationResults:V,setStep:K,nextStep:Z,previousStep:re,setLoading:z,setError:O,reset:se}=ee(),[A,fe]=P.useState(null),[te,ne]=P.useState(null),[E,R]=P.useState(0),[_,I]=P.useState(""),[Y,b]=P.useState(null),[le,J]=P.useState(null),[ie,Le]=P.useState([]);P.useEffect(()=>{if(ne(null),e)if(C.templateExists(e)){const M=C.getTemplateSchema(e);M?fe(M):(ne(`Failed to load template "${e}"`),u==null||u(new Error(`Failed to load template "${e}"`)))}else{const M=`Template "${e}" not found. Available templates: ${C.VALID_TEMPLATE_IDS.join(", ")}`;ne(M),u==null||u(new Error(M))}else if(o)fe(o);else{const M=`No template or schema provided. Please specify a template (${C.VALID_TEMPLATE_IDS.join(", ")}) or provide a custom schema.`;ne(M),u==null||u(new Error(M))}},[e,o,u]),P.useEffect(()=>{A&&(v(A),De(A))},[A]);const De=async M=>{try{z(!0);const k=await C.getClient().createImportSession(M);w(k.sessionId)}catch(N){const k=N;O(k.message),u==null||u(k)}finally{z(!1)}},lt=M=>{const N=[];let k="",H=!1;for(let q=0;q<M.length;q++){const D=M[q];D==='"'?H&&M[q+1]==='"'?(k+='"',q++):H=!H:D===","&&!H?(N.push(k.trim()),k=""):k+=D}return N.push(k.trim()),N},it=P.useCallback(async M=>{if(g)try{z(!0),O(null),F([]),$([],[]),V(null),R(10),I("Uploading file...");const N=C.getClient();R(20),I("Uploading to server...");const k=await N.uploadFile(g,M);R(40),I("Parsing all rows...");const q=(await M.text()).split(`
63
+ `).filter(U=>U.trim()),D=k.data.headers,B=q.slice(1).map((U,de)=>{const He=lt(U),Ge={};return D.forEach((ht,vt)=>{Ge[ht]=He[vt]||""}),{rowIndex:de,data:Ge,rawData:He}});R(60),I("Processing rows..."),j({headers:D,rows:B,totalRows:B.length,sampleRows:B.slice(0,5)}),R(80),I("Matching columns..."),K("mapping"),await at(),R(100),I("Done")}catch(N){O(`Failed to process the uploaded file: ${N.message}`)}finally{z(!1),R(0),I("")}},[g]),at=async()=>{if(g)try{z(!0);const N=await C.getClient().matchColumns(g);F(N.mappings),$(N.unmappedSource,N.unmappedTarget)}catch(M){O(`Column matching failed: ${M.message}`)}finally{z(!1)}},ut=async()=>{if(g)try{z(!0),O(null);const N=await C.getClient().validateImport(g);V(N.validation),Z()}catch(M){O(`Validation failed: ${M.message}`)}finally{z(!1)}},ft=async()=>{if(g)try{z(!0),O(null),b(null);const M=[...c];Le(M);const H=await C.getClient().completeImport(g,{skipInvalidRows:!0,acknowledgeWarnings:!0});J(H),K("complete"),i==null||i(H)}catch(M){b(M.message),K("complete")}finally{z(!1)}},he=()=>{se(),f==null||f()},dt=()=>{b(null),J(null),Le([]),R(0),I(""),se(),A&&(v(A),De(A))},oe=()=>Fe.indexOf(d),ct=()=>{switch(d){case"upload":return p!==null;case"mapping":return a.length>0&&a.some(M=>M.targetKey!==null);case"validation":return m!==null&&m.errorCount===0;default:return!1}},gt=async()=>{switch(d){case"mapping":await ut();break;case"validation":await ft();break;default:Z()}},pt=d==="upload"&&h&&E>0||d==="mapping"&&h&&E>0;if(te)return l.jsx(C.StyleProvider,{theme:n,useShadowDom:r,children:l.jsx("div",{className:"ff-container ff-bg-white ff-rounded-xl ff-shadow-xl ff-overflow-hidden ff-p-6",children:l.jsxs("div",{className:"ff-flex ff-flex-col ff-items-center ff-justify-center ff-py-8",children:[l.jsx("div",{className:"ff-w-16 ff-h-16 ff-rounded-full ff-flex ff-items-center ff-justify-center ff-mb-4",style:{backgroundColor:"var(--ff-error-light)"},children:l.jsx(C.X,{className:"ff-w-10 ff-h-10",style:{color:"var(--ff-error)"}})}),l.jsx("h3",{className:"ff-text-xl ff-font-semibold ff-mb-2",style:{color:"var(--ff-text-primary)"},children:"Configuration Error"}),l.jsx("p",{className:"ff-text-center ff-max-w-md ff-mb-4",style:{color:"var(--ff-text-muted)"},children:te}),f&&l.jsx("button",{onClick:he,className:"ff-btn ff-btn-secondary",children:"Close"})]})})});if(!A)return l.jsx(C.StyleProvider,{theme:n,useShadowDom:r,children:l.jsx("div",{className:"ff-container ff-bg-white ff-rounded-xl ff-shadow-xl ff-overflow-hidden ff-p-6",children:l.jsxs("div",{className:"ff-flex ff-flex-col ff-items-center ff-justify-center ff-py-8",children:[l.jsx(C.LoaderCircle,{className:"ff-w-10 ff-h-10 ff-animate-spin ff-mb-4",style:{color:"var(--ff-primary-90)"}}),l.jsx("p",{style:{color:"var(--ff-text-muted)"},children:"Loading template..."})]})})});const mt=t==="embed"?"ff-container ff-embed":"ff-container ff-modal",ze=s||Y,Ae=l.jsx(l.Fragment,{children:l.jsxs("div",{className:mt,children:[l.jsxs("div",{className:"ff-modal-header",children:[l.jsxs("div",{className:"ff-modal-header-left",children:[l.jsxs("div",{className:"ff-flex ff-items-center ff-gap-3",children:[l.jsx("div",{className:"ff-modal-icon",children:l.jsx($t,{})}),l.jsx("h2",{className:"ff-modal-title",children:"Import Data"})]}),l.jsx("div",{className:"ff-steps ff-ml-4",children:Fe.map((M,N)=>l.jsxs(P.Fragment,{children:[l.jsx("div",{className:C.clsx("ff-step",oe()===N&&"ff-step-active",oe()>N&&"ff-step-complete",oe()<N&&"ff-step-pending"),children:oe()>N?"✓":N+1}),N<Fe.length-1&&l.jsx("div",{className:C.clsx("ff-step-connector",oe()>N&&"ff-step-connector-complete")})]},M))})]}),l.jsx("button",{onClick:he,className:"ff-modal-close",children:l.jsx(C.X,{className:"ff-w-5 ff-h-5"})})]}),l.jsxs("div",{className:"ff-modal-body",children:[x&&l.jsx("div",{className:"ff-mb-4 ff-p-4 ff-border ff-rounded-lg ff-text-sm",style:{backgroundColor:"var(--ff-error-light)",borderColor:"var(--ff-error)",color:"var(--ff-error)"},children:x}),d==="upload"&&l.jsx("div",{className:"ff-py-4",children:l.jsx("div",{className:"ff-max-w-xl ff-mx-auto",children:h&&E>0?l.jsxs("div",{className:"ff-p-8 ff-text-center",children:[l.jsx(C.LoaderCircle,{className:"ff-w-10 ff-h-10 ff-animate-spin ff-mx-auto ff-mb-4",style:{color:"var(--ff-primary-90)"}}),l.jsx("p",{className:"ff-font-medium ff-mb-2",style:{color:"var(--ff-text-primary)"},children:_}),l.jsx("div",{className:"ff-progress ff-w-full ff-max-w-xs ff-mx-auto ff-mb-2",children:l.jsx("div",{className:"ff-progress-bar",style:{width:`${E}%`,transition:"width 0.3s ease"}})}),l.jsxs("p",{className:"ff-text-sm",style:{color:"var(--ff-text-muted)"},children:[E,"% complete"]})]}):l.jsx(Ue,{onFileSelect:it})})}),d==="mapping"&&(h&&E>0?l.jsxs("div",{className:"ff-py-12 ff-text-center",children:[l.jsx(C.LoaderCircle,{className:"ff-w-10 ff-h-10 ff-animate-spin ff-mx-auto ff-mb-4",style:{color:"var(--ff-primary-90)"}}),l.jsx("p",{className:"ff-font-medium ff-mb-3",style:{color:"var(--ff-text-primary)"},children:_}),l.jsx("div",{className:"ff-progress ff-w-full ff-max-w-xs ff-mx-auto ff-mb-2",children:l.jsx("div",{className:"ff-progress-bar",style:{width:`${E}%`,transition:"width 0.3s ease"}})}),l.jsxs("p",{className:"ff-text-sm",style:{color:"var(--ff-text-muted)"},children:[E,"% complete"]})]}):l.jsx(Xe,{})),d==="validation"&&l.jsxs("div",{className:"ff-space-y-6",children:[l.jsx(st,{}),l.jsx(rt,{editable:!0})]}),d==="complete"&&l.jsx("div",{className:"ff-flex ff-flex-col ff-items-center ff-justify-center ff-py-8",children:ze?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"ff-w-16 ff-h-16 ff-rounded-full ff-flex ff-items-center ff-justify-center ff-mb-4",style:{backgroundColor:"var(--ff-error-light)"},children:l.jsx(C.X,{className:"ff-w-10 ff-h-10",style:{color:"var(--ff-error)"}})}),l.jsx("h3",{className:"ff-text-xl ff-font-semibold ff-mb-2",style:{color:"var(--ff-text-primary)"},children:"Import Failed"}),l.jsx("p",{className:"ff-text-center ff-max-w-md ff-mb-4",style:{color:"var(--ff-text-muted)"},children:ze})]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"ff-w-20 ff-h-20 ff-rounded-2xl ff-flex ff-items-center ff-justify-center ff-mb-6",style:{backgroundColor:"var(--ff-success-light)"},children:l.jsx(C.CircleCheckBig,{className:"ff-w-10 ff-h-10",style:{color:"var(--ff-success)"}})}),l.jsx("h3",{className:"ff-text-xl ff-font-semibold ff-mb-2",style:{color:"var(--ff-text-primary)"},children:"Import Complete!"}),l.jsx("p",{className:"ff-mb-6",style:{color:"var(--ff-text-muted)"},children:"Your data has been successfully imported."}),l.jsxs("div",{className:"ff-flex ff-gap-6 ff-mb-6",children:[l.jsxs("div",{className:"ff-text-center ff-px-6 ff-py-3 ff-rounded-xl ff-border",style:{borderColor:"var(--ff-success)",backgroundColor:"var(--ff-success-light)"},children:[l.jsx("p",{className:"ff-text-2xl ff-font-bold",style:{color:"var(--ff-success-dark)"},children:ie.length}),l.jsx("p",{className:"ff-text-sm",style:{color:"var(--ff-success)"},children:"Rows Imported"})]}),l.jsxs("div",{className:"ff-text-center ff-px-6 ff-py-3 ff-rounded-xl ff-border",style:{borderColor:"var(--ff-border-light)",backgroundColor:"var(--ff-bg-primary)"},children:[l.jsx("p",{className:"ff-text-2xl ff-font-bold",style:{color:"var(--ff-text-primary)"},children:a.filter(M=>M.targetKey!==null).length}),l.jsx("p",{className:"ff-text-sm",style:{color:"var(--ff-text-muted)"},children:"Columns Mapped"})]})]}),ie.length>0&&(()=>{const M=ie.slice(0,5),N=M[0],k=(N==null?void 0:N.data)||N,H=Object.keys(typeof k=="object"?k:{}).slice(0,6),q=(A==null?void 0:A.columns)||[];return H.length===0?null:l.jsxs("div",{className:"ff-w-full ff-mb-6",children:[l.jsx("p",{className:"ff-text-xs ff-font-semibold ff-uppercase ff-tracking-wider ff-mb-2",style:{color:"var(--ff-text-muted)"},children:"Imported Data Preview"}),l.jsx("div",{className:"ff-table-container ff-max-h-[250px]",children:l.jsxs("table",{className:"ff-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{style:{width:40},children:"#"}),H.map(D=>{const B=q.find(U=>U.key===D);return l.jsx("th",{children:(B==null?void 0:B.label)||D},D)}),H.length<Object.keys(typeof k=="object"?k:{}).length&&l.jsx("th",{children:"..."})]})}),l.jsx("tbody",{children:M.map((D,B)=>{const U=(D==null?void 0:D.data)||D;return l.jsxs("tr",{children:[l.jsx("td",{children:l.jsx("span",{className:"ff-font-mono ff-text-xs",style:{color:"var(--ff-text-muted)"},children:B+1})}),H.map(de=>l.jsx("td",{children:l.jsx("span",{className:"ff-text-sm ff-truncate ff-block ff-max-w-[150px]",children:String((U==null?void 0:U[de])??"—")})},de)),H.length<Object.keys(typeof k=="object"?k:{}).length&&l.jsx("td",{children:l.jsx("span",{style:{color:"var(--ff-text-muted)"},children:"..."})})]},B)})})]})}),ie.length>5&&l.jsxs("p",{className:"ff-text-xs ff-mt-1",style:{color:"var(--ff-text-muted)"},children:["Showing ",M.length," of ",ie.length," imported rows"]})]})})()]})})]}),l.jsx("div",{className:"ff-modal-footer",children:d==="complete"?l.jsxs(l.Fragment,{children:[f?l.jsx("button",{onClick:he,className:"ff-btn ff-btn-ghost",children:"Close"}):l.jsx("div",{}),l.jsx("button",{onClick:dt,className:"ff-btn ff-btn-primary",children:"Start New Import"})]}):l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:re,disabled:oe()===0||h,className:"ff-btn ff-btn-ghost",children:"Back"}),!pt&&l.jsx("button",{onClick:gt,disabled:!ct()||h,className:"ff-btn ff-btn-primary",children:h?l.jsxs(l.Fragment,{children:[l.jsx(C.LoaderCircle,{className:"ff-w-4 ff-h-4 ff-animate-spin"})," Processing..."]}):d==="validation"?m&&m.errorCount>0?`Fix ${m.errorCount} error${m.errorCount>1?"s":""} to continue`:"Complete Import":"Continue"})]})})]})});return l.jsx(C.StyleProvider,{theme:n,useShadowDom:r,children:t==="modal"?l.jsx("div",{className:"ff-overlay",children:Ae}):Ae})};exports.ColumnMapper=Xe;exports.DataTable=rt;exports.FileUploader=Ue;exports.ImportWizard=En;exports.ValidationSummary=st;exports.useImportStore=ee;
64
+ //# sourceMappingURL=ImportWizard-4E5fcskQ.js.map