@updog/data-editor 0.1.73 → 0.1.75

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.
Files changed (3) hide show
  1. package/index.d.ts +40 -28
  2. package/index.js +753 -714
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -1195,34 +1195,38 @@ var Ci = () => {
1195
1195
  })]
1196
1196
  });
1197
1197
  }, Mi = (e) => {
1198
- let { checked: t, onChange: n, label: r, description: i, accessory: a, checkboxPosition: o = "start", disabled: s = !1, className: c, id: l, style: u, isCard: d = !1, indeterminate: f = !1, size: p = "md", onClick: m, renderCheckbox: g, children: _, ...v } = e, y = h(), b = l || y, x = p === "sm" ? 14 : 16, S = [
1198
+ let { checked: t, onChange: n, label: r, description: i, accessory: a, checkboxPosition: o = "start", disabled: s = !1, className: c, id: l, style: u, isCard: d = !1, indeterminate: f = !1, size: p = "md", onClick: g, renderCheckbox: _, children: v, ...b } = e, x = h(), S = l || x, T = y(null);
1199
+ m(() => {
1200
+ T.current && (T.current.indeterminate = f);
1201
+ }, [f]);
1202
+ let E = p === "sm" ? 14 : 16, D = [
1199
1203
  "updog-checkbox",
1200
1204
  o === "end" && "updog-checkbox--reverse",
1201
1205
  i && "updog-checkbox--with-description",
1202
1206
  s && "updog-checkbox--disabled",
1203
1207
  d && "updog-checkbox--card",
1204
1208
  c
1205
- ].filter(Boolean).join(" "), T = [
1209
+ ].filter(Boolean).join(" "), O = [
1206
1210
  "updog-checkbox__box",
1207
1211
  `updog-checkbox__box--${p}`,
1208
1212
  t && "updog-checkbox__box--checked",
1209
1213
  f && "updog-checkbox__box--indeterminate"
1210
- ].filter(Boolean).join(" "), E = (e) => {
1214
+ ].filter(Boolean).join(" "), k = (e) => {
1211
1215
  n(e.target.checked, e);
1212
- }, D = (e) => {
1213
- m && m(e);
1214
- }, O = i ? `${b}__desc` : void 0, k = a ? `${b}-accessory` : void 0, A;
1215
- if (_) A = /* @__PURE__ */ C("div", {
1216
+ }, A = (e) => {
1217
+ g && g(e);
1218
+ }, j = i ? `${S}__desc` : void 0, M = a ? `${S}-accessory` : void 0, N;
1219
+ if (v) N = /* @__PURE__ */ C("div", {
1216
1220
  className: "updog-checkbox__children",
1217
- children: _
1221
+ children: v
1218
1222
  });
1219
- else if (g) {
1223
+ else if (_) {
1220
1224
  let { renderCheckbox: t, ...n } = e;
1221
- A = g({
1225
+ N = _({
1222
1226
  ...n,
1223
- checkboxId: b
1227
+ checkboxId: S
1224
1228
  });
1225
- } else A = (r || i) && /* @__PURE__ */ w("div", {
1229
+ } else N = (r || i) && /* @__PURE__ */ w("div", {
1226
1230
  className: "updog-checkbox__content",
1227
1231
  children: [r && /* @__PURE__ */ w("div", {
1228
1232
  className: "updog-checkbox__label-wrapper",
@@ -1230,44 +1234,45 @@ var Ci = () => {
1230
1234
  className: "updog-checkbox__label updog-text--sm",
1231
1235
  children: r
1232
1236
  }), a && /* @__PURE__ */ C("div", {
1233
- id: k,
1237
+ id: M,
1234
1238
  className: "updog-checkbox__accessory",
1235
1239
  children: a
1236
1240
  })]
1237
1241
  }), i && /* @__PURE__ */ C("div", {
1238
1242
  className: "updog-checkbox__description updog-text--sm",
1239
- id: O,
1243
+ id: j,
1240
1244
  children: i
1241
1245
  })]
1242
1246
  });
1243
1247
  return /* @__PURE__ */ w("label", {
1244
- className: S,
1245
- htmlFor: b,
1248
+ className: D,
1249
+ htmlFor: S,
1246
1250
  "data-iscard": d,
1247
1251
  style: u,
1248
- onClick: D,
1252
+ onClick: A,
1249
1253
  children: [
1250
1254
  /* @__PURE__ */ C("input", {
1251
- ...v,
1252
- id: b,
1255
+ ...b,
1256
+ ref: T,
1257
+ id: S,
1253
1258
  type: "checkbox",
1254
1259
  className: "updog-checkbox__input",
1255
1260
  tabIndex: s ? -1 : 0,
1256
1261
  checked: t,
1257
- onChange: E,
1262
+ onChange: k,
1258
1263
  disabled: s,
1259
- "aria-label": !r && typeof v["aria-label"] == "string" ? v["aria-label"] : void 0,
1260
- "aria-describedby": _ ? void 0 : [O, k].filter(Boolean).join(" ") || void 0
1264
+ "aria-label": !r && typeof b["aria-label"] == "string" ? b["aria-label"] : void 0,
1265
+ "aria-describedby": v ? void 0 : [j, M].filter(Boolean).join(" ") || void 0
1261
1266
  }),
1262
- !g && /* @__PURE__ */ C("div", {
1263
- className: T,
1267
+ !_ && /* @__PURE__ */ C("div", {
1268
+ className: O,
1264
1269
  style: { outlineOffset: 1 },
1265
1270
  children: /* @__PURE__ */ C("div", {
1266
1271
  className: "updog-checkbox__icon",
1267
- children: C(f ? ve : F, { size: x })
1272
+ children: C(f ? ve : F, { size: E })
1268
1273
  })
1269
1274
  }),
1270
- A
1275
+ N
1271
1276
  ]
1272
1277
  });
1273
1278
  }, Ni = ({ disabled: e, checkboxPosition: t = "start", color: n = "layer2", className: r, ...i }) => {
@@ -4716,57 +4721,17 @@ var Rs = "backend", zs = "manual", Bs = class {
4716
4721
  for (let r of n) if (e[r] !== t[r]) return !1;
4717
4722
  return !0;
4718
4723
  }
4719
- }, Ks = (e) => e.type === "unique", qs = (e) => e.type === "asyncFunction";
4720
- function Js(e) {
4721
- return e.map((e) => {
4722
- let t = e.validators;
4723
- if (!t?.some((e) => Ks(e) || qs(e))) return e;
4724
- let n = t.filter(Ks);
4725
- n.length > 1 && console.warn(`[updog] column "${e.id}" declares ${n.length} { type: "unique" } validators; using the first, ignoring the rest.`);
4726
- let r = t.filter(qs), i = {
4727
- ...e,
4728
- validators: t.filter((e) => !Ks(e) && !qs(e))
4729
- }, [a] = n;
4730
- return a && (i.uniqueConfig = {
4731
- ...a.message !== void 0 && { message: a.message },
4732
- ...a.fn !== void 0 && { fn: a.fn }
4733
- }), r.length > 0 && (i.asyncConfig = r), i;
4734
- });
4735
- }
4736
- function Ys(e) {
4737
- return e.uniqueConfig !== void 0;
4738
- }
4739
- function Xs(e) {
4740
- return e.some((e) => e.asyncConfig !== void 0 || e.uniqueConfig?.fn !== void 0);
4741
- }
4742
- function Zs(e) {
4743
- return e.map((e) => {
4744
- let { uniqueConfig: t, asyncConfig: n, ...r } = e;
4745
- if (!t && !n) return e;
4746
- let i = [...r.validators ?? []];
4747
- return t && i.push({
4748
- type: "unique",
4749
- ...t.message !== void 0 && { message: t.message },
4750
- ...t.fn !== void 0 && { fn: t.fn }
4751
- }), n && i.push(...n), {
4752
- ...r,
4753
- validators: i
4754
- };
4755
- });
4756
- }
4757
- //#endregion
4758
- //#region src/core/spawnWorker.ts
4759
- var Qs = {
4724
+ }, Ks = {
4760
4725
  filter: "\"use strict\";(()=>{var m=[],b=[],E=[],A=new Uint32Array(0),F=new Uint8Array(0),x=new Uint32Array(0),k=new Uint8Array(0),B=[],O=new Set,U=[],S=[],oe=new Set,ae=new Set,o=2,M=self;self.addEventListener(\"message\",I=>{let e=I.data;switch(e.type){case\"APPEND\":{let t=m.length,n=e.rowIds.length,s=t+n,d=new Uint32Array(s*o);d.set(A),d.set(e.errorBitmask,t*o),A=d;let a=new Uint8Array(s);a.set(F),a.set(e.newFlags,t),F=a;let u=new Uint32Array(s*o);u.set(x),u.set(e.editedBitmask,t*o),x=u;let w=new Uint8Array(s);w.set(k),w.set(e.deletedFlags,t),k=w;for(let f=0;f<n;f++)U[e.rowIds[f]]=t+f,m.push(e.rowIds[f]),b.push(e.rowTexts[f]),E.push(e.rowRawTexts[f]),B.push(e.sourceIds[f]);break}case\"UPDATE_TEXT\":{let t=U[e.rowId];t!==void 0&&(b[t]=e.rowText,E[t]=e.rowRawText);break}case\"UPDATE_TEXT_BATCH\":{for(let t=0;t<e.rowIds.length;t++){let n=U[e.rowIds[t]];n!==void 0&&(b[n]=e.rowTexts[t],E[n]=e.rowRawTexts[t])}break}case\"DELETE\":{let t=new Set;for(let r of e.rowIds){let g=U[r];g!==void 0&&(t.add(g),U[r]=void 0)}if(t.size===0)break;let n=m.length-t.size,s=[],d=[],a=[],u=new Uint32Array(n*o),w=new Uint8Array(n),f=new Uint32Array(n*o),L=new Uint8Array(n),D=[],h=[],y=0;for(let r=0;r<m.length;r++)if(!t.has(r)){s[y]=m[r],d[y]=b[r],a[y]=E[r];for(let g=0;g<o;g++)u[y*o+g]=A[r*o+g],f[y*o+g]=x[r*o+g];w[y]=F[r],L[y]=k[r],D[y]=B[r],h[m[r]]=y,y++}m=s,b=d,E=a,A=u,F=w,x=f,k=L,B=D,U=h;break}case\"INSERT\":{let t=e.positions.length;if(t===0)break;let n=m.length+t,s=new Array(n),d=new Array(n),a=new Array(n),u=new Uint32Array(n*o),w=new Uint8Array(n),f=new Uint32Array(n*o),L=new Uint8Array(n),D=new Array(n);U=[];let h=0,y=0;for(let r=0;r<n;r++){if(h<t&&e.positions[h]===r){s[r]=e.rowIds[h],d[r]=e.rowTexts[h],a[r]=e.rowRawTexts[h];for(let g=0;g<o;g++)u[r*o+g]=e.errorBitmask[h*o+g],f[r*o+g]=e.editedBitmask[h*o+g];w[r]=e.newFlags[h],D[r]=e.sourceIds[h],h++}else{s[r]=m[y],d[r]=b[y],a[r]=E[y];for(let g=0;g<o;g++)u[r*o+g]=A[y*o+g],f[r*o+g]=x[y*o+g];w[r]=F[y],L[r]=k[y],D[r]=B[y],y++}U[s[r]]=r}m=s,b=d,E=a,A=u,F=w,x=f,k=L,B=D;break}case\"UPDATE_SOURCE_VIS\":{e.isVisible?O.delete(e.sourceId):O.add(e.sourceId);break}case\"SET_ALL_FLAGS\":{A=e.errorBitmask,F=e.newFlags,x=e.editedBitmask,k=e.deletedFlags;break}case\"SET_FIELD_ORDER\":{let t=o;if(S=e.fieldOrder,o=e.wordsPerRow,oe=new Set(e.formatterFieldIndices??[]),ae=new Set(e.multiselectFieldIndices??[]),o>t&&m.length>0){let n=m.length,s=new Uint32Array(n*o),d=new Uint32Array(n*o);for(let a=0;a<n;a++)for(let u=0;u<t;u++)s[a*o+u]=A[a*t+u],d[a*o+u]=x[a*t+u];A=s,x=d}break}case\"FILTER\":{try{M.postMessage(we(e.filters,e.generation,e.sort,e.selectedErrorRowIds,e.misplacedRowIds))}catch{M.postMessage({type:\"RESULT\",filteredIds:null,baseFilteredIds:null,generation:e.generation})}break}case\"SORT_ALL\":{try{let t=Z([...m],e.sort);M.postMessage({type:\"SORT_RESULT\",sortedIds:t,generation:e.generation})}catch{M.postMessage({type:\"SORT_RESULT\",sortedIds:[...m],generation:e.generation})}break}case\"DEBUG_DUMP\":{let t={};for(let n=0;n<m.length;n++)t[m[n]]=n;M.postMessage({type:\"DEBUG_DUMP_RESULT\",rowIds:[...m],rowIndexMap:t,rowTextsLen:b.length,rowRawTextsLen:E.length,sourceIdsLen:B.length,errorBitmaskLen:A.length,newFlagsLen:F.length,editedBitmaskLen:x.length,deletedFlagsLen:k.length,wordsPerRow:o,fieldOrder:[...S],hiddenSourceIds:[...O]});break}case\"CLEAR\":{m=[],b=[],E=[],A=new Uint32Array(0),F=new Uint8Array(0),x=new Uint32Array(0),k=new Uint8Array(0),B=[],O.clear(),U=[];break}}});function ue(I,e,t){if(S.length===0)return I;let n=[],s=0,d=1;for(;d<I.length;){let a=I.indexOf(\"\\0\",d);if(a===-1)break;s<S.length&&e.has(S[s])&&n.push(I.substring(d,a)),s++,d=a+1}return n.length===0?\"\":t?\"\\0\"+n.join(\"\\0\")+\"\\0\":n.join(\" \")}function $(I,e){let t=0,n=1;for(;n<I.length;){let s=I.indexOf(\"\\0\",n);if(s===-1)break;if(t===e)return I.substring(n,s);t++,n=s+1}return\"\"}function Y(I,e){return $(oe.has(e)?E[I]:b[I],e)}function fe(I){let e=I.direction===\"asc\"?1:-1;switch(I.sortType){case\"number\":return(t,n)=>{let s=parseFloat(t),d=parseFloat(n),a=t===\"\"||Number.isNaN(s),u=n===\"\"||Number.isNaN(d);return a&&u?0:a?1:u?-1:(s-d)*e};case\"date\":return(t,n)=>!t&&!n?0:t?n?t<n?-1*e:t>n?1*e:0:-1:1;default:{let t=new Intl.Collator(I.locales,{numeric:!0,sensitivity:\"variant\"});return(n,s)=>!n&&!s?0:n?s?t.compare(n,s)*e:-1:1}}}function Z(I,e){let t=e.sortType!==\"text\",n=fe(e),s=I.length,d=new Array(s);for(let w=0;w<s;w++){let f=U[I[w]];f!==void 0&&(d[w]=t?Y(f,e.fieldIdx):$(b[f],e.fieldIdx))}let a=Array.from({length:s},(w,f)=>f);a.sort((w,f)=>n(d[w],d[f]));let u=new Array(s);for(let w=0;w<s;w++)u[w]=I[a[w]];return u}function we(I,e,t,n,s){let{search:d,matchCase:a,matchEntireCell:u,errorMessageFilters:w,showOnlyNewRows:f,showOnlyEditedRows:L,showOnlyEmptyCells:D,showOnlyMisplacedRows:h,showOnlyDeletedRows:y,filterColumns:r,columnValueFilters:g,columnRangeFilters:le,columnDateRangeFilters:de}=I,N=a?d.trim():d.toLowerCase().trim(),_=!!N,W=w.length>0,ee=f||L,v=D,V=h,te=n?new Set(n):null,ne=s?new Set(s):null,G=[];for(let[l,i]of Object.entries(g))if(i.length>0){let c=S.indexOf(l);c!==-1&&G.push({fieldIdx:c,allowed:new Set(i)})}let j=G.length>0,H=[];for(let[l,i]of Object.entries(le))if(i.min!==void 0||i.max!==void 0){let c=S.indexOf(l);c!==-1&&H.push({fieldIdx:c,...i})}let X=H.length>0,z=[];for(let[l,i]of Object.entries(de))if(i.min!==void 0||i.max!==void 0){let c=S.indexOf(l);c!==-1&&z.push({fieldIdx:c,...i})}let q=z.length>0,J=O.size>0,re=k.some(l=>l),P=new Uint32Array(o);if(r)for(let l of r){let i=S.indexOf(l);if(i>=0){let c=i>>>5;c<o&&(P[c]|=1<<(i&31))}}else P.fill(4294967295);let se=_||W||ee||v||V||J||j||X||q||y||re;if(!se&&!t)return{type:\"RESULT\",filteredIds:null,baseFilteredIds:null,generation:e};if(!se&&t){let l=Z([...m],t);return{type:\"RESULT\",filteredIds:l,baseFilteredIds:l,generation:e}}let ce=_&&!u?N.split(/\\s+/):[],K=[],Q=W?[]:K,ie=_&&r?new Set(r):null;for(let l=0;l<m.length;l++){if(y){if(!k[l])continue}else if(k[l])continue;if(!(J&&O.has(B[l]))&&!(f&&!F[l])){if(L){let i=!1,c=l*o;for(let T=0;T<o;T++)if(x[c+T]&P[T]){i=!0;break}if(!i)continue}if(!(V&&!(ne&&ne.has(m[l])))){if(v){let i=!1,c=0,T=1,R=b[l];for(;T<R.length&&c<S.length;){let p=R.indexOf(\"\\0\",T);if(p===-1)break;let C=c>>>5;if(C<o&&P[C]&1<<(c&31)&&T===p){i=!0;break}c++,T=p+1}if(!i)continue}if(j){let i=!0;for(let{fieldIdx:c,allowed:T}of G){let R=$(b[l],c);if(!(ae.has(c)?R.split(\"\").some(C=>T.has(C)):T.has(R))){i=!1;break}}if(!i)continue}if(X){let i=!0;for(let{fieldIdx:c,min:T,max:R}of H){let p=Number(Y(l,c));if(!Number.isFinite(p)){i=!1;break}if(T!==void 0&&p<T){i=!1;break}if(R!==void 0&&p>R){i=!1;break}}if(!i)continue}if(q){let i=!0;for(let{fieldIdx:c,min:T,max:R}of z){let p=Y(l,c);if(!p){i=!1;break}if(T!==void 0&&p<T){i=!1;break}if(R!==void 0&&p>R){i=!1;break}}if(!i)continue}if(_){let i=a?b[l]:b[l].toLowerCase(),c=ie?ue(i,ie,u):i;if(u){if(!c.includes(\"\\0\"+N+\"\\0\"))continue}else{let T=!0;for(let R of ce)if(!c.includes(R)){T=!1;break}if(!T)continue}}K.push(m[l]),W&&te&&te.has(m[l])&&Q.push(m[l])}}}return{type:\"RESULT\",filteredIds:t?Z(Q,t):Q,baseFilteredIds:_||ee||v||V||J||j||X||q||re?K:null,generation:e}}})();\n",
4761
4726
  chatTransform: "\"use strict\";(()=>{function T(n){let{ops:s,rows:a,fields:d}=n,i={};for(let[t,e]of Object.entries(n.ctx.opts))i[t]=new Set(e);let r={opts:i},f=[],g=[];for(let t of s)try{let e=new Function(\"return \"+t.fn)();g.push({action:t.action,fn:e})}catch(e){f.push(`Failed to compile ${t.action} op: ${e instanceof Error?e.message:String(e)}`)}let c=new Map,w=[];for(let[t,e]of a){let l={...e},m=!1;for(let o of g)if(o.action===\"delete\")try{if(o.fn(l,r)){m=!0;break}}catch{}else try{o.fn(l,r)}catch{}if(m){w.push(t);continue}for(let o of d){let y=e[o],u=l[o];if(u!==y){let p=c.get(o);p||(p=[],c.set(o,p)),p.push([t,y,u])}}}let R=[];for(let[t,e]of c)R.push({field:t,changes:e});return{deltas:R,deleteIds:w,errors:f}}var h=self;self.addEventListener(\"message\",n=>{try{let{ops:s,ctx:a,rows:d,fields:i}=n.data,r=T({ops:s,ctx:a,rows:d,fields:i});h.postMessage({type:\"RESULT\",deltas:r.deltas,deleteIds:r.deleteIds,errors:r.errors})}catch(s){h.postMessage({type:\"ERROR\",message:s instanceof Error?s.message:\"Transform worker error\"})}});})();\n",
4762
4727
  parseText: "\"use strict\";(()=>{var Xx=Object.create;var yx=Object.defineProperty;var Yx=Object.getOwnPropertyDescriptor;var xe=Object.getOwnPropertyNames;var ee=Object.getPrototypeOf,te=Object.prototype.hasOwnProperty;var x0=(e,x)=>()=>(x||e((x={exports:{}}).exports,x),x.exports);var re=(e,x,t,a)=>{if(x&&typeof x==\"object\"||typeof x==\"function\")for(let f of xe(x))!te.call(e,f)&&f!==t&&yx(e,f,{get:()=>x[f],enumerable:!(a=Yx(x,f))||a.enumerable});return e};var wx=(e,x,t)=>(t=e!=null?Xx(ee(e)):{},re(x||!e||!e.__esModule?yx(t,\"default\",{value:e,enumerable:!0}):t,e));var Ex=x0((D0,F0)=>{((e,x)=>{typeof define==\"function\"&&define.amd?define([],x):typeof F0==\"object\"&&typeof D0<\"u\"?F0.exports=x():e.Papa=x()})(D0,function e(){var x=typeof self<\"u\"?self:typeof window<\"u\"?window:x!==void 0?x:{},t,a=!x.document&&!!x.postMessage,f=x.IS_PAPA_WORKER||!1,s={},d=0,i={};function h(r){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine=\"\",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(n){var c=B0(n);c.chunkSize=parseInt(c.chunkSize),n.step||n.chunk||(c.chunkSize=null),this._handle=new bx(c),(this._handle.streamer=this)._config=c}.call(this,r),this.parseChunk=function(n,c){var u=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<u){let m=this._config.newline;m||(o=this._config.quoteChar||'\"',m=this._handle.guessLineEndings(n,o)),n=[...n.split(m).slice(u)].join(m)}this.isFirstChunk&&C(this._config.beforeFirstChunk)&&(o=this._config.beforeFirstChunk(n))!==void 0&&(n=o),this.isFirstChunk=!1,this._halted=!1;var u=this._partialLine+n,o=(this._partialLine=\"\",this._handle.parse(u,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(n=o.meta.cursor,u=(this._finished||(this._partialLine=u.substring(n-this._baseIndex),this._baseIndex=n),o&&o.data&&(this._rowCount+=o.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),f)x.postMessage({results:o,workerId:i.WORKER_ID,finished:u});else if(C(this._config.chunk)&&!c){if(this._config.chunk(o,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=o=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(o.data),this._completeResults.errors=this._completeResults.errors.concat(o.errors),this._completeResults.meta=o.meta),this._completed||!u||!C(this._config.complete)||o&&o.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),u||o&&o.meta.paused||this._nextChunk(),o}this._halted=!0},this._sendError=function(n){C(this._config.error)?this._config.error(n):f&&this._config.error&&x.postMessage({workerId:i.WORKER_ID,error:n,finished:!1})}}function g(r){var n;(r=r||{}).chunkSize||(r.chunkSize=i.RemoteChunkSize),h.call(this,r),this._nextChunk=a?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(c){this._input=c,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(n=new XMLHttpRequest,this._config.withCredentials&&(n.withCredentials=this._config.withCredentials),a||(n.onload=s0(this._chunkLoaded,this),n.onerror=s0(this._chunkError,this)),n.open(this._config.downloadRequestBody?\"POST\":\"GET\",this._input,!a),this._config.downloadRequestHeaders){var c,u=this._config.downloadRequestHeaders;for(c in u)n.setRequestHeader(c,u[c])}var o;this._config.chunkSize&&(o=this._start+this._config.chunkSize-1,n.setRequestHeader(\"Range\",\"bytes=\"+this._start+\"-\"+o));try{n.send(this._config.downloadRequestBody)}catch(m){this._chunkError(m.message)}a&&n.status===0&&this._chunkError()}},this._chunkLoaded=function(){n.readyState===4&&(n.status<200||400<=n.status?this._chunkError():(this._start+=this._config.chunkSize||n.responseText.length,this._finished=!this._config.chunkSize||this._start>=(c=>(c=c.getResponseHeader(\"Content-Range\"))!==null?parseInt(c.substring(c.lastIndexOf(\"/\")+1)):-1)(n),this.parseChunk(n.responseText)))},this._chunkError=function(c){c=n.statusText||c,this._sendError(new Error(c))}}function G(r){(r=r||{}).chunkSize||(r.chunkSize=i.LocalChunkSize),h.call(this,r);var n,c,u=typeof FileReader<\"u\";this.stream=function(o){this._input=o,c=o.slice||o.webkitSlice||o.mozSlice,u?((n=new FileReader).onload=s0(this._chunkLoaded,this),n.onerror=s0(this._chunkError,this)):n=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var o=this._input,m=(this._config.chunkSize&&(m=Math.min(this._start+this._config.chunkSize,this._input.size),o=c.call(o,this._start,m)),n.readAsText(o,this._config.encoding));u||this._chunkLoaded({target:{result:m}})},this._chunkLoaded=function(o){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(o.target.result)},this._chunkError=function(){this._sendError(n.error)}}function e0(r){var n;h.call(this,r=r||{}),this.stream=function(c){return n=c,this._nextChunk()},this._nextChunk=function(){var c,u;if(!this._finished)return c=this._config.chunkSize,n=c?(u=n.substring(0,c),n.substring(c)):(u=n,\"\"),this._finished=!n,this.parseChunk(u)}}function S0(r){h.call(this,r=r||{});var n=[],c=!0,u=!1;this.pause=function(){h.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){h.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(o){this._input=o,this._input.on(\"data\",this._streamData),this._input.on(\"end\",this._streamEnd),this._input.on(\"error\",this._streamError)},this._checkIsFinished=function(){u&&n.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),n.length?this.parseChunk(n.shift()):c=!0},this._streamData=s0(function(o){try{n.push(typeof o==\"string\"?o:o.toString(this._config.encoding)),c&&(c=!1,this._checkIsFinished(),this.parseChunk(n.shift()))}catch(m){this._streamError(m)}},this),this._streamError=s0(function(o){this._streamCleanUp(),this._sendError(o)},this),this._streamEnd=s0(function(){this._streamCleanUp(),u=!0,this._streamData(\"\")},this),this._streamCleanUp=s0(function(){this._input.removeListener(\"data\",this._streamData),this._input.removeListener(\"end\",this._streamEnd),this._input.removeListener(\"error\",this._streamError)},this)}function bx(r){var n,c,u,o,m=Math.pow(2,53),M=-m,H=/^\\s*-?(\\d+\\.?|\\.\\d+|\\d+\\.\\d+)([eE][-+]?\\d+)?\\s*$/,Z=/^((\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z))|(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d([+-][0-2]\\d:[0-5]\\d|Z))|(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d([+-][0-2]\\d:[0-5]\\d|Z)))$/,w=this,F=0,b=0,V=!1,p=!1,S=[],l={data:[],errors:[],meta:{}};function j(E){return r.skipEmptyLines===\"greedy\"?E.join(\"\").trim()===\"\":E.length===1&&E[0].length===0}function L(){if(l&&u&&(Q(\"Delimiter\",\"UndetectableDelimiter\",\"Unable to auto-detect delimiting character; defaulted to '\"+i.DefaultDelimiter+\"'\"),u=!1),r.skipEmptyLines&&(l.data=l.data.filter(function(R){return!j(R)})),N()){let R=function(z,B){C(r.transformHeader)&&(z=r.transformHeader(z,B)),S.push(z)};var _=R;if(l)if(Array.isArray(l.data[0])){for(var E=0;N()&&E<l.data.length;E++)l.data[E].forEach(R);l.data.splice(0,1)}else l.data.forEach(R)}function v(R,z){for(var B=r.header?{}:[],I=0;I<R.length;I++){var y=I,K=R[I],K=((k,A)=>(P=>(r.dynamicTypingFunction&&r.dynamicTyping[P]===void 0&&(r.dynamicTyping[P]=r.dynamicTypingFunction(P)),(r.dynamicTyping[P]||r.dynamicTyping)===!0))(k)?A===\"true\"||A===\"TRUE\"||A!==\"false\"&&A!==\"FALSE\"&&((P=>{if(H.test(P)&&(P=parseFloat(P),M<P&&P<m))return 1})(A)?parseFloat(A):Z.test(A)?new Date(A):A===\"\"?null:A):A)(y=r.header?I>=S.length?\"__parsed_extra\":S[I]:y,K=r.transform?r.transform(K,y):K);y===\"__parsed_extra\"?(B[y]=B[y]||[],B[y].push(K)):B[y]=K}return r.header&&(I>S.length?Q(\"FieldMismatch\",\"TooManyFields\",\"Too many fields: expected \"+S.length+\" fields but parsed \"+I,b+z):I<S.length&&Q(\"FieldMismatch\",\"TooFewFields\",\"Too few fields: expected \"+S.length+\" fields but parsed \"+I,b+z)),B}var T;l&&(r.header||r.dynamicTyping||r.transform)&&(T=1,!l.data.length||Array.isArray(l.data[0])?(l.data=l.data.map(v),T=l.data.length):l.data=v(l.data,0),r.header&&l.meta&&(l.meta.fields=S),b+=T)}function N(){return r.header&&S.length===0}function Q(E,v,T,_){E={type:E,code:v,message:T},_!==void 0&&(E.row=_),l.errors.push(E)}C(r.step)&&(o=r.step,r.step=function(E){l=E,N()?L():(L(),l.data.length!==0&&(F+=E.data.length,r.preview&&F>r.preview?c.abort():(l.data=l.data[0],o(l,w))))}),this.parse=function(E,v,T){var _=r.quoteChar||'\"',_=(r.newline||(r.newline=this.guessLineEndings(E,_)),u=!1,r.delimiter?C(r.delimiter)&&(r.delimiter=r.delimiter(E),l.meta.delimiter=r.delimiter):((_=((R,z,B,I,y)=>{var K,k,A,P;y=y||[\",\",\" \",\"|\",\";\",i.RECORD_SEP,i.UNIT_SEP];for(var o0=0;o0<y.length;o0++){for(var t0,b0=y[o0],$=0,r0=0,U=0,W=(A=void 0,new R0({comments:I,delimiter:b0,newline:z,preview:10}).parse(R)),c0=0;c0<W.data.length;c0++)B&&j(W.data[c0])?U++:(t0=W.data[c0].length,r0+=t0,A===void 0?A=t0:0<t0&&($+=Math.abs(t0-A),A=t0));0<W.data.length&&(r0/=W.data.length-U),(k===void 0||$<=k)&&(P===void 0||P<r0)&&1.99<r0&&(k=$,K=b0,P=r0)}return{successful:!!(r.delimiter=K),bestDelimiter:K}})(E,r.newline,r.skipEmptyLines,r.comments,r.delimitersToGuess)).successful?r.delimiter=_.bestDelimiter:(u=!0,r.delimiter=i.DefaultDelimiter),l.meta.delimiter=r.delimiter),B0(r));return r.preview&&r.header&&_.preview++,n=E,c=new R0(_),l=c.parse(n,v,T),L(),V?{meta:{paused:!0}}:l||{meta:{paused:!1}}},this.paused=function(){return V},this.pause=function(){V=!0,c.abort(),n=C(r.chunk)?\"\":n.substring(c.getCharIndex())},this.resume=function(){w.streamer._halted?(V=!1,w.streamer.parseChunk(n,!0)):setTimeout(w.resume,3)},this.aborted=function(){return p},this.abort=function(){p=!0,c.abort(),l.meta.aborted=!0,C(r.complete)&&r.complete(l),n=\"\"},this.guessLineEndings=function(R,_){R=R.substring(0,1048576);var _=new RegExp(h0(_)+\"([^]*?)\"+h0(_),\"gm\"),T=(R=R.replace(_,\"\")).split(\"\\r\"),_=R.split(`\n`),R=1<_.length&&_[0].length<T[0].length;if(T.length===1||R)return`\n`;for(var z=0,B=0;B<T.length;B++)T[B][0]===`\n`&&z++;return z>=T.length/2?`\\r\n`:\"\\r\"}}function h0(r){return r.replace(/[.*+?^${}()|[\\]\\\\]/g,\"\\\\$&\")}function R0(r){var n=(r=r||{}).delimiter,c=r.newline,u=r.comments,o=r.step,m=r.preview,M=r.fastMode,H=null,Z=!1,w=r.quoteChar==null?'\"':r.quoteChar,F=w;if(r.escapeChar!==void 0&&(F=r.escapeChar),(typeof n!=\"string\"||-1<i.BAD_DELIMITERS.indexOf(n))&&(n=\",\"),u===n)throw new Error(\"Comment character same as delimiter\");u===!0?u=\"#\":(typeof u!=\"string\"||-1<i.BAD_DELIMITERS.indexOf(u))&&(u=!1),c!==`\n`&&c!==\"\\r\"&&c!==`\\r\n`&&(c=`\n`);var b=0,V=!1;this.parse=function(p,S,l){if(typeof p!=\"string\")throw new Error(\"Input must be a string\");var j=p.length,L=n.length,N=c.length,Q=u.length,E=C(o),v=[],T=[],_=[],R=b=0;if(!p)return $();if(M||M!==!1&&p.indexOf(w)===-1){for(var z=p.split(c),B=0;B<z.length;B++){if(_=z[B],b+=_.length,B!==z.length-1)b+=c.length;else if(l)return $();if(!u||_.substring(0,Q)!==u){if(E){if(v=[],P(_.split(n)),r0(),V)return $()}else P(_.split(n));if(m&&m<=B)return v=v.slice(0,m),$(!0)}}return $()}for(var I=p.indexOf(n,b),y=p.indexOf(c,b),K=new RegExp(h0(F)+h0(w),\"g\"),k=p.indexOf(w,b);;)if(p[b]===w)for(k=b,b++;;){if((k=p.indexOf(w,k+1))===-1)return l||T.push({type:\"Quotes\",code:\"MissingQuotes\",message:\"Quoted field unterminated\",row:v.length,index:b}),t0();if(k===j-1)return t0(p.substring(b,k).replace(K,w));if(w===F&&p[k+1]===F)k++;else if(w===F||k===0||p[k-1]!==F){I!==-1&&I<k+1&&(I=p.indexOf(n,k+1));var A=o0((y=y!==-1&&y<k+1?p.indexOf(c,k+1):y)===-1?I:Math.min(I,y));if(p.substr(k+1+A,L)===n){_.push(p.substring(b,k).replace(K,w)),p[b=k+1+A+L]!==w&&(k=p.indexOf(w,b)),I=p.indexOf(n,b),y=p.indexOf(c,b);break}if(A=o0(y),p.substring(k+1+A,k+1+A+N)===c){if(_.push(p.substring(b,k).replace(K,w)),b0(k+1+A+N),I=p.indexOf(n,b),k=p.indexOf(w,b),E&&(r0(),V))return $();if(m&&v.length>=m)return $(!0);break}T.push({type:\"Quotes\",code:\"InvalidQuotes\",message:\"Trailing quote on quoted field is malformed\",row:v.length,index:b}),k++}}else if(u&&_.length===0&&p.substring(b,b+Q)===u){if(y===-1)return $();b=y+N,y=p.indexOf(c,b),I=p.indexOf(n,b)}else if(I!==-1&&(I<y||y===-1))_.push(p.substring(b,I)),b=I+L,I=p.indexOf(n,b);else{if(y===-1)break;if(_.push(p.substring(b,y)),b0(y+N),E&&(r0(),V))return $();if(m&&v.length>=m)return $(!0)}return t0();function P(U){v.push(U),R=b}function o0(U){var W=0;return W=U!==-1&&(U=p.substring(k+1,U))&&U.trim()===\"\"?U.length:W}function t0(U){return l||(U===void 0&&(U=p.substring(b)),_.push(U),b=j,P(_),E&&r0()),$()}function b0(U){b=U,P(_),_=[],y=p.indexOf(c,b)}function $(U){if(r.header&&!S&&v.length&&!Z){var W=v[0],c0=Object.create(null),A0=new Set(W);let mx=!1;for(let u0=0;u0<W.length;u0++){let n0=W[u0];if(c0[n0=C(r.transformHeader)?r.transformHeader(n0,u0):n0]){let p0,_x=c0[n0];for(;p0=n0+\"_\"+_x,_x++,A0.has(p0););A0.add(p0),W[u0]=p0,c0[n0]++,mx=!0,(H=H===null?{}:H)[p0]=n0}else c0[n0]=1,W[u0]=n0;A0.add(n0)}Z=!0}return{data:v,errors:T,meta:{delimiter:n,linebreak:c,aborted:V,truncated:!!U,cursor:R+(S||0),renamedHeaders:H}}}function r0(){o($()),v=[],T=[]}},this.abort=function(){V=!0},this.getCharIndex=function(){return b}}function Qx(r){var n=r.data,c=s[n.workerId],u=!1;if(n.error)c.userError(n.error,n.file);else if(n.results&&n.results.data){var o={abort:function(){u=!0,px(n.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:gx,resume:gx};if(C(c.userStep)){for(var m=0;m<n.results.data.length&&(c.userStep({data:n.results.data[m],errors:n.results.errors,meta:n.results.meta},o),!u);m++);delete n.results}else C(c.userChunk)&&(c.userChunk(n.results,o,n.file),delete n.results)}n.finished&&!u&&px(n.workerId,n.results)}function px(r,n){var c=s[r];C(c.userComplete)&&c.userComplete(n),c.terminate(),delete s[r]}function gx(){throw new Error(\"Not implemented.\")}function B0(r){if(typeof r!=\"object\"||r===null)return r;var n,c=Array.isArray(r)?[]:{};for(n in r)c[n]=B0(r[n]);return c}function s0(r,n){return function(){r.apply(n,arguments)}}function C(r){return typeof r==\"function\"}return i.parse=function(r,n){var c=(n=n||{}).dynamicTyping||!1;if(C(c)&&(n.dynamicTypingFunction=c,c={}),n.dynamicTyping=c,n.transform=!!C(n.transform)&&n.transform,!n.worker||!i.WORKERS_SUPPORTED)return c=null,i.NODE_STREAM_INPUT,typeof r==\"string\"?(r=(u=>u.charCodeAt(0)!==65279?u:u.slice(1))(r),c=new(n.download?g:e0)(n)):r.readable===!0&&C(r.read)&&C(r.on)?c=new S0(n):(x.File&&r instanceof File||r instanceof Object)&&(c=new G(n)),c.stream(r);(c=(()=>{var u;return!!i.WORKERS_SUPPORTED&&(u=(()=>{var o=x.URL||x.webkitURL||null,m=e.toString();return i.BLOB_URL||(i.BLOB_URL=o.createObjectURL(new Blob([\"var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; \",\"(\",m,\")();\"],{type:\"text/javascript\"})))})(),(u=new x.Worker(u)).onmessage=Qx,u.id=d++,s[u.id]=u)})()).userStep=n.step,c.userChunk=n.chunk,c.userComplete=n.complete,c.userError=n.error,n.step=C(n.step),n.chunk=C(n.chunk),n.complete=C(n.complete),n.error=C(n.error),delete n.worker,c.postMessage({input:r,config:n,workerId:c.id})},i.unparse=function(r,n){var c=!1,u=!0,o=\",\",m=`\\r\n`,M='\"',H=M+M,Z=!1,w=null,F=!1,b=((()=>{if(typeof n==\"object\"){if(typeof n.delimiter!=\"string\"||i.BAD_DELIMITERS.filter(function(S){return n.delimiter.indexOf(S)!==-1}).length||(o=n.delimiter),typeof n.quotes!=\"boolean\"&&typeof n.quotes!=\"function\"&&!Array.isArray(n.quotes)||(c=n.quotes),typeof n.skipEmptyLines!=\"boolean\"&&typeof n.skipEmptyLines!=\"string\"||(Z=n.skipEmptyLines),typeof n.newline==\"string\"&&(m=n.newline),typeof n.quoteChar==\"string\"&&(M=n.quoteChar),typeof n.header==\"boolean\"&&(u=n.header),Array.isArray(n.columns)){if(n.columns.length===0)throw new Error(\"Option columns is empty\");w=n.columns}n.escapeChar!==void 0&&(H=n.escapeChar+M),n.escapeFormulae instanceof RegExp?F=n.escapeFormulae:typeof n.escapeFormulae==\"boolean\"&&n.escapeFormulae&&(F=/^[=+\\-@\\t\\r].*$/)}})(),new RegExp(h0(M),\"g\"));if(typeof r==\"string\"&&(r=JSON.parse(r)),Array.isArray(r)){if(!r.length||Array.isArray(r[0]))return V(null,r,Z);if(typeof r[0]==\"object\")return V(w||Object.keys(r[0]),r,Z)}else if(typeof r==\"object\")return typeof r.data==\"string\"&&(r.data=JSON.parse(r.data)),Array.isArray(r.data)&&(r.fields||(r.fields=r.meta&&r.meta.fields||w),r.fields||(r.fields=Array.isArray(r.data[0])?r.fields:typeof r.data[0]==\"object\"?Object.keys(r.data[0]):[]),Array.isArray(r.data[0])||typeof r.data[0]==\"object\"||(r.data=[r.data])),V(r.fields||[],r.data||[],Z);throw new Error(\"Unable to serialize unrecognized input\");function V(S,l,j){var L=\"\",N=(typeof S==\"string\"&&(S=JSON.parse(S)),typeof l==\"string\"&&(l=JSON.parse(l)),Array.isArray(S)&&0<S.length),Q=!Array.isArray(l[0]);if(N&&u){for(var E=0;E<S.length;E++)0<E&&(L+=o),L+=p(S[E],E);0<l.length&&(L+=m)}for(var v=0;v<l.length;v++){var T=(N?S:l[v]).length,_=!1,R=N?Object.keys(l[v]).length===0:l[v].length===0;if(j&&!N&&(_=j===\"greedy\"?l[v].join(\"\").trim()===\"\":l[v].length===1&&l[v][0].length===0),j===\"greedy\"&&N){for(var z=[],B=0;B<T;B++){var I=Q?S[B]:B;z.push(l[v][I])}_=z.join(\"\").trim()===\"\"}if(!_){for(var y=0;y<T;y++){0<y&&!R&&(L+=o);var K=N&&Q?S[y]:y;L+=p(l[v][K],y)}v<l.length-1&&(!j||0<T&&!R)&&(L+=m)}}return L}function p(S,l){var j,L;return S==null?\"\":S.constructor===Date?JSON.stringify(S).slice(1,25):(L=!1,F&&typeof S==\"string\"&&F.test(S)&&(S=\"'\"+S,L=!0),j=S.toString().replace(b,H),(L=L||c===!0||typeof c==\"function\"&&c(S,l)||Array.isArray(c)&&c[l]||((N,Q)=>{for(var E=0;E<Q.length;E++)if(-1<N.indexOf(Q[E]))return!0;return!1})(j,i.BAD_DELIMITERS)||-1<j.indexOf(o)||j.charAt(0)===\" \"||j.charAt(j.length-1)===\" \")?M+j+M:j)}},i.RECORD_SEP=\"\",i.UNIT_SEP=\"\",i.BYTE_ORDER_MARK=\"\\uFEFF\",i.BAD_DELIMITERS=[\"\\r\",`\n`,'\"',i.BYTE_ORDER_MARK],i.WORKERS_SUPPORTED=!a&&!!x.Worker,i.NODE_STREAM_INPUT=1,i.LocalChunkSize=10485760,i.RemoteChunkSize=5242880,i.DefaultDelimiter=\",\",i.Parser=R0,i.ParserHandle=bx,i.NetworkStreamer=g,i.FileStreamer=G,i.StringStreamer=e0,i.ReadableStreamStreamer=S0,x.jQuery&&((t=x.jQuery).fn.parse=function(r){var n=r.config||{},c=[];return this.each(function(m){if(!(t(this).prop(\"tagName\").toUpperCase()===\"INPUT\"&&t(this).attr(\"type\").toLowerCase()===\"file\"&&x.FileReader)||!this.files||this.files.length===0)return!0;for(var M=0;M<this.files.length;M++)c.push({file:this.files[M],inputElem:this,instanceConfig:t.extend({},n)})}),u(),this;function u(){if(c.length===0)C(r.complete)&&r.complete();else{var m,M,H,Z,w=c[0];if(C(r.before)){var F=r.before(w.file,w.inputElem);if(typeof F==\"object\"){if(F.action===\"abort\")return m=\"AbortError\",M=w.file,H=w.inputElem,Z=F.reason,void(C(r.error)&&r.error({name:m},M,H,Z));if(F.action===\"skip\")return void o();typeof F.config==\"object\"&&(w.instanceConfig=t.extend(w.instanceConfig,F.config))}else if(F===\"skip\")return void o()}var b=w.instanceConfig.complete;w.instanceConfig.complete=function(V){C(b)&&b(V,w.file,w.inputElem),o()},i.parse(w.file,w.instanceConfig)}}function o(){c.splice(0,1),u()}}),f&&(x.onmessage=function(r){r=r.data,i.WORKER_ID===void 0&&r&&(i.WORKER_ID=r.workerId),typeof r.input==\"string\"?x.postMessage({workerId:i.WORKER_ID,results:i.parse(r.input,r.config),finished:!0}):(x.File&&r.input instanceof File||r.input instanceof Object)&&(r=i.parse(r.input,r.config))&&x.postMessage({workerId:i.WORKER_ID,results:r,finished:!0})}),(g.prototype=Object.create(h.prototype)).constructor=g,(G.prototype=Object.create(h.prototype)).constructor=G,(e0.prototype=Object.create(e0.prototype)).constructor=e0,(S0.prototype=Object.create(h.prototype)).constructor=S0,i})});var Ix=x0(T0=>{\"use strict\";Object.defineProperty(T0,\"__esModule\",{value:!0});T0.default=()=>{throw new Error(\"File system is not available\")}});var i0=x0(L0=>{\"use strict\";Object.defineProperty(L0,\"__esModule\",{value:!0});L0.default=(e,x,t)=>({confidence:t,name:x.name(e),lang:x.language?x.language():void 0})});var Cx=x0(g0=>{\"use strict\";var de=g0&&g0.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(g0,\"__esModule\",{value:!0});var Ox=de(i0()),M0=class{name(){return\"ASCII\"}match(x){let t=x.rawInput;for(let a=0;a<x.rawLen;a++){let f=t[a];if(f<32||f>126)return(0,Ox.default)(x,this,0)}return(0,Ox.default)(x,this,100)}};g0.default=M0});var Rx=x0(m0=>{\"use strict\";var oe=m0&&m0.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(m0,\"__esModule\",{value:!0});var ue=oe(i0()),j0=class{name(){return\"UTF-8\"}match(x){let t=!1,a=0,f=0,s=0,d,i=x.rawInput;x.rawLen>=3&&(i[0]&255)==239&&(i[1]&255)==187&&(i[2]&255)==191&&(t=!0);for(let h=0;h<x.rawLen;h++){let g=i[h];if(g&128){if((g&224)==192)s=1;else if((g&240)==224)s=2;else if((g&248)==240)s=3;else{if(f++,f>5)break;s=0}for(;h++,!(h>=x.rawLen);){if((i[h]&192)!=128){f++;break}if(--s==0){a++;break}}}}if(d=0,t&&f==0)d=100;else if(t&&a>f*10)d=80;else if(a>3&&f==0)d=100;else if(a>0&&f==0)d=80;else if(a==0&&f==0)d=10;else if(a>f*10)d=25;else return null;return(0,ue.default)(x,this,d)}};m0.default=j0});var Bx=x0(X=>{\"use strict\";var le=X&&X.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(X,\"__esModule\",{value:!0});X.UTF_32LE=X.UTF_32BE=X.UTF_16LE=X.UTF_16BE=void 0;var N0=le(i0()),P0=class{name(){return\"UTF-16BE\"}match(x){let t=x.rawInput;return t.length>=2&&(t[0]&255)==254&&(t[1]&255)==255?(0,N0.default)(x,this,100):null}};X.UTF_16BE=P0;var z0=class{name(){return\"UTF-16LE\"}match(x){let t=x.rawInput;return t.length>=2&&(t[0]&255)==255&&(t[1]&255)==254?t.length>=4&&t[2]==0&&t[3]==0?null:(0,N0.default)(x,this,100):null}};X.UTF_16LE=z0;var v0=class{name(){return\"UTF-32\"}getChar(x,t){return-1}match(x){let t=0,a=0,f=!1,s=0,d=x.rawLen/4*4,i=x.rawInput;if(d==0)return null;this.getChar(i,0)==65279&&(f=!0);for(let h=0;h<d;h+=4){let g=this.getChar(i,h);g<0||g>=1114111||g>=55296&&g<=57343?a+=1:t+=1}return f&&a==0?s=100:f&&t>a*10?s=80:t>3&&a==0?s=100:t>0&&a==0?s=80:t>a*10&&(s=25),s==0?null:(0,N0.default)(x,this,s)}},U0=class extends v0{name(){return\"UTF-32BE\"}getChar(x,t){return(x[t+0]&255)<<24|(x[t+1]&255)<<16|(x[t+2]&255)<<8|x[t+3]&255}};X.UTF_32BE=U0;var q0=class extends v0{name(){return\"UTF-32LE\"}getChar(x,t){return(x[t+3]&255)<<24|(x[t+2]&255)<<16|(x[t+1]&255)<<8|x[t+0]&255}};X.UTF_32LE=q0});var Dx=x0(J=>{\"use strict\";var he=J&&J.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(J,\"__esModule\",{value:!0});J.gb_18030=J.euc_kr=J.euc_jp=J.big5=J.sjis=void 0;var be=he(i0());function pe(e,x){let t=(a,f,s,d)=>{if(d<s)return-1;let i=Math.floor(s+d>>>1);return f>a[i]?t(a,f,i+1,d):f<a[i]?t(a,f,s,i-1):i};return t(e,x,0,e.length-1)}var V0=class{constructor(){this.charValue=0,this.index=0,this.nextIndex=0,this.error=!1,this.done=!1}reset(){this.charValue=0,this.index=-1,this.nextIndex=0,this.error=!1,this.done=!1}nextByte(x){return this.nextIndex>=x.rawLen?(this.done=!0,-1):x.rawInput[this.nextIndex++]&255}},d0=class{constructor(){this.commonChars=[]}name(){return\"mbcs\"}match(x){let t=0,a=0,f=0,s=0,d=0,i=new V0;x:{for(i.reset();this.nextChar(i,x);){if(s++,i.error)f++;else{let h=i.charValue&4294967295;h>255&&(t++,this.commonChars!=null&&pe(this.commonChars,h)>=0&&a++)}if(f>=2&&f*5>=t)break x}if(t<=10&&f==0){t==0&&s<10?d=0:d=10;break x}if(t<20*f){d=0;break x}if(this.commonChars==null)d=30+t-20*f,d>100&&(d=100);else{let g=90/Math.log(t/4);d=Math.floor(Math.log(a+1)*g+10),d=Math.min(d,100)}}return d==0?null:(0,be.default)(x,this,d)}nextChar(x,t){return!0}},K0=class extends d0{constructor(){super(...arguments),this.commonChars=[33088,33089,33090,33093,33115,33129,33130,33141,33142,33440,33442,33444,33449,33450,33451,33453,33455,33457,33459,33461,33463,33469,33470,33473,33476,33477,33478,33480,33481,33484,33485,33500,33504,33511,33512,33513,33514,33520,33521,33601,33603,33614,33615,33624,33630,33634,33639,33653,33654,33673,33674,33675,33677,33683,36502,37882,38314]}name(){return\"Shift_JIS\"}language(){return\"ja\"}nextChar(x,t){x.index=x.nextIndex,x.error=!1;let a=x.charValue=x.nextByte(t);if(a<0)return!1;if(a<=127||a>160&&a<=223)return!0;let f=x.nextByte(t);return f<0?!1:(x.charValue=a<<8|f,f>=64&&f<=127||f>=128&&f<=255||(x.error=!0),!0)}};J.sjis=K0;var $0=class extends d0{constructor(){super(...arguments),this.commonChars=[41280,41281,41282,41283,41287,41289,41333,41334,42048,42054,42055,42056,42065,42068,42071,42084,42090,42092,42103,42147,42148,42151,42177,42190,42193,42207,42216,42237,42304,42312,42328,42345,42445,42471,42583,42593,42594,42600,42608,42664,42675,42681,42707,42715,42726,42738,42816,42833,42841,42970,43171,43173,43181,43217,43219,43236,43260,43456,43474,43507,43627,43706,43710,43724,43772,44103,44111,44208,44242,44377,44745,45024,45290,45423,45747,45764,45935,46156,46158,46412,46501,46525,46544,46552,46705,47085,47207,47428,47832,47940,48033,48593,49860,50105,50240,50271]}name(){return\"Big5\"}language(){return\"zh\"}nextChar(x,t){x.index=x.nextIndex,x.error=!1;let a=x.charValue=x.nextByte(t);if(a<0)return!1;if(a<=127||a==255)return!0;let f=x.nextByte(t);return f<0?!1:(x.charValue=x.charValue<<8|f,(f<64||f==127||f==255)&&(x.error=!0),!0)}};J.big5=$0;function Ax(e,x){e.index=e.nextIndex,e.error=!1;let t=0,a=0,f=0;x:{if(t=e.charValue=e.nextByte(x),t<0){e.done=!0;break x}if(t<=141)break x;if(a=e.nextByte(x),e.charValue=e.charValue<<8|a,t>=161&&t<=254){a<161&&(e.error=!0);break x}if(t==142){a<161&&(e.error=!0);break x}t==143&&(f=e.nextByte(x),e.charValue=e.charValue<<8|f,f<161&&(e.error=!0))}return e.done==!1}var W0=class extends d0{constructor(){super(...arguments),this.commonChars=[41377,41378,41379,41382,41404,41418,41419,41430,41431,42146,42148,42150,42152,42154,42155,42156,42157,42159,42161,42163,42165,42167,42169,42171,42173,42175,42176,42177,42179,42180,42182,42183,42184,42185,42186,42187,42190,42191,42192,42206,42207,42209,42210,42212,42216,42217,42218,42219,42220,42223,42226,42227,42402,42403,42404,42406,42407,42410,42413,42415,42416,42419,42421,42423,42424,42425,42431,42435,42438,42439,42440,42441,42443,42448,42453,42454,42455,42462,42464,42465,42469,42473,42474,42475,42476,42477,42483,47273,47572,47854,48072,48880,49079,50410,50940,51133,51896,51955,52188,52689],this.nextChar=Ax}name(){return\"EUC-JP\"}language(){return\"ja\"}};J.euc_jp=W0;var J0=class extends d0{constructor(){super(...arguments),this.commonChars=[45217,45235,45253,45261,45268,45286,45293,45304,45306,45308,45496,45497,45511,45527,45538,45994,46011,46274,46287,46297,46315,46501,46517,46527,46535,46569,46835,47023,47042,47054,47270,47278,47286,47288,47291,47337,47531,47534,47564,47566,47613,47800,47822,47824,47857,48103,48115,48125,48301,48314,48338,48374,48570,48576,48579,48581,48838,48840,48863,48878,48888,48890,49057,49065,49088,49124,49131,49132,49144,49319,49327,49336,49338,49339,49341,49351,49356,49358,49359,49366,49370,49381,49403,49404,49572,49574,49590,49622,49631,49654,49656,50337,50637,50862,51151,51153,51154,51160,51173,51373],this.nextChar=Ax}name(){return\"EUC-KR\"}language(){return\"ko\"}};J.euc_kr=J0;var G0=class extends d0{constructor(){super(...arguments),this.commonChars=[41377,41378,41379,41380,41392,41393,41457,41459,41889,41900,41914,45480,45496,45502,45755,46025,46070,46323,46525,46532,46563,46767,46804,46816,47010,47016,47037,47062,47069,47284,47327,47350,47531,47561,47576,47610,47613,47821,48039,48086,48097,48122,48316,48347,48382,48588,48845,48861,49076,49094,49097,49332,49389,49611,49883,50119,50396,50410,50636,50935,51192,51371,51403,51413,51431,51663,51706,51889,51893,51911,51920,51926,51957,51965,52460,52728,52906,52932,52946,52965,53173,53186,53206,53442,53445,53456,53460,53671,53930,53938,53941,53947,53972,54211,54224,54269,54466,54490,54754,54992]}name(){return\"GB18030\"}language(){return\"zh\"}nextChar(x,t){x.index=x.nextIndex,x.error=!1;let a=0,f=0,s=0,d=0;x:{if(a=x.charValue=x.nextByte(t),a<0){x.done=!0;break x}if(a<=128)break x;if(f=x.nextByte(t),x.charValue=x.charValue<<8|f,a>=129&&a<=254){if(f>=64&&f<=126||f>=80&&f<=254)break x;if(f>=48&&f<=57&&(s=x.nextByte(t),s>=129&&s<=254&&(d=x.nextByte(t),d>=48&&d<=57))){x.charValue=x.charValue<<16|s<<8|d;break x}x.error=!0;break x}}return x.done==!1}};J.gb_18030=G0});var Tx=x0(D=>{\"use strict\";var ge=D&&D.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(D,\"__esModule\",{value:!0});D.KOI8_R=D.windows_1256=D.windows_1251=D.ISO_8859_9=D.ISO_8859_8=D.ISO_8859_7=D.ISO_8859_6=D.ISO_8859_5=D.ISO_8859_2=D.ISO_8859_1=void 0;var Fx=ge(i0()),me=16777215,k0=class{constructor(x,t){this.byteIndex=0,this.ngram=0,this.ngramCount=0,this.hitCount=0,this.spaceChar=32,this.ngramList=x,this.byteMap=t}search(x,t){let a=0;return x[a+32]<=t&&(a+=32),x[a+16]<=t&&(a+=16),x[a+8]<=t&&(a+=8),x[a+4]<=t&&(a+=4),x[a+2]<=t&&(a+=2),x[a+1]<=t&&(a+=1),x[a]>t&&(a-=1),a<0||x[a]!=t?-1:a}lookup(x){this.ngramCount+=1,this.search(this.ngramList,x)>=0&&(this.hitCount+=1)}addByte(x){this.ngram=(this.ngram<<8)+(x&255)&me,this.lookup(this.ngram)}nextByte(x){return this.byteIndex>=x.inputLen?-1:x.inputBytes[this.byteIndex++]&255}parse(x,t){let a,f=!1;for(this.spaceChar=t;(a=this.nextByte(x))>=0;){let d=this.byteMap[a];d!=0&&(d==this.spaceChar&&f||this.addByte(d),f=d==this.spaceChar)}this.addByte(this.spaceChar);let s=this.hitCount/this.ngramCount;return s>.33?98:Math.floor(s*300)}},q=class{constructor(x,t){this.fLang=x,this.fNGrams=t}},_e=e=>Array.isArray(e)&&isFinite(e[0]),Y=class{constructor(){this.spaceChar=32,this.nGramLang=void 0}ngrams(){return[]}byteMap(){return[]}name(x){return\"sbcs\"}language(){return this.nGramLang}match(x){this.nGramLang=void 0;let t=this.ngrams();if(_e(t)){let s=new k0(t,this.byteMap()).parse(x,this.spaceChar);return s<=0?null:(0,Fx.default)(x,this,s)}let a=-1;for(let f=t.length-1;f>=0;f--){let s=t[f],i=new k0(s.fNGrams,this.byteMap()).parse(x,this.spaceChar);i>a&&(a=i,this.nGramLang=s.fLang)}return a<=0?null:(0,Fx.default)(x,this,a)}},H0=class extends Y{byteMap(){return[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,170,32,32,32,32,32,32,32,32,32,32,181,32,32,32,32,186,32,32,32,32,32,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,32,248,249,250,251,252,253,254,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,32,248,249,250,251,252,253,254,255]}ngrams(){return[new q(\"da\",[2122086,2122100,2122853,2123118,2123122,2123375,2123873,2124064,2125157,2125671,2126053,2126697,2126708,2126953,2127465,6383136,6385184,6385252,6386208,6386720,6579488,6579566,6579570,6579572,6627443,6644768,6644837,6647328,6647396,6648352,6648421,6648608,6648864,6713202,6776096,6776174,6776178,6907749,6908960,6909543,7038240,7039845,7103858,7104871,7105637,7169380,7234661,7234848,7235360,7235429,7300896,7302432,7303712,7398688,7479396,7479397,7479411,7496992,7566437,7610483,7628064,7628146,7629164,7759218]),new q(\"de\",[2122094,2122101,2122341,2122849,2122853,2122857,2123113,2123621,2123873,2124142,2125161,2126691,2126693,2127214,2127461,2127471,2127717,2128501,6448498,6514720,6514789,6514804,6578547,6579566,6579570,6580581,6627428,6627443,6646126,6646132,6647328,6648352,6648608,6776174,6841710,6845472,6906728,6907168,6909472,6909541,6911008,7104867,7105637,7217249,7217252,7217267,7234592,7234661,7234848,7235360,7235429,7238757,7479396,7496805,7497065,7562088,7566437,7610468,7628064,7628142,7628146,7695972,7695975,7759218]),new q(\"en\",[2122016,2122094,2122341,2122607,2123375,2123873,2123877,2124142,2125153,2125670,2125938,2126437,2126689,2126708,2126952,2126959,2127720,6383972,6384672,6385184,6385252,6386464,6386720,6386789,6386793,6561889,6561908,6627425,6627443,6627444,6644768,6647412,6648352,6648608,6713202,6840692,6841632,6841714,6906912,6909472,6909543,6909806,6910752,7217249,7217268,7234592,7235360,7238688,7300640,7302688,7303712,7496992,7500576,7544929,7544948,7561577,7566368,7610484,7628146,7628897,7628901,7629167,7630624,7631648]),new q(\"es\",[2122016,2122593,2122607,2122853,2123116,2123118,2123123,2124142,2124897,2124911,2125921,2125935,2125938,2126197,2126437,2126693,2127214,2128160,6365283,6365284,6365285,6365292,6365296,6382441,6382703,6384672,6386208,6386464,6515187,6516590,6579488,6579564,6582048,6627428,6627429,6627436,6646816,6647328,6647412,6648608,6648692,6907246,6943598,7102752,7106419,7217253,7238757,7282788,7282789,7302688,7303712,7303968,7364978,7435621,7495968,7497075,7544932,7544933,7544944,7562528,7628064,7630624,7693600,15953440]),new q(\"fr\",[2122101,2122607,2122849,2122853,2122869,2123118,2123124,2124897,2124901,2125921,2125935,2125938,2126197,2126693,2126703,2127214,2154528,6385268,6386793,6513952,6516590,6579488,6579571,6583584,6627425,6627427,6627428,6627429,6627436,6627440,6627443,6647328,6647412,6648352,6648608,6648864,6649202,6909806,6910752,6911008,7102752,7103776,7103859,7169390,7217252,7234848,7238432,7238688,7302688,7302772,7304562,7435621,7479404,7496992,7544929,7544932,7544933,7544940,7544944,7610468,7628064,7629167,7693600,7696928]),new q(\"it\",[2122092,2122600,2122607,2122853,2122857,2123040,2124140,2124142,2124897,2125925,2125938,2127214,6365283,6365284,6365296,6365299,6386799,6514789,6516590,6579564,6580512,6627425,6627427,6627428,6627433,6627436,6627440,6627443,6646816,6646892,6647412,6648352,6841632,6889569,6889571,6889572,6889587,6906144,6908960,6909472,6909806,7102752,7103776,7104800,7105633,7234848,7235872,7237408,7238757,7282785,7282788,7282793,7282803,7302688,7302757,7366002,7495968,7496992,7563552,7627040,7628064,7629088,7630624,8022383]),new q(\"nl\",[2122092,2122341,2122849,2122853,2122857,2123109,2123118,2123621,2123877,2124142,2125153,2125157,2125680,2126949,2127457,2127461,2127471,2127717,2128489,6381934,6381938,6385184,6385252,6386208,6386720,6514804,6579488,6579566,6579570,6627426,6627446,6645102,6645106,6647328,6648352,6648435,6648864,6776174,6841716,6907168,6909472,6909543,6910752,7217250,7217252,7217253,7217256,7217263,7217270,7234661,7235360,7302756,7303026,7303200,7303712,7562088,7566437,7610468,7628064,7628142,7628146,7758190,7759218,7761775]),new q(\"no\",[2122100,2122102,2122853,2123118,2123122,2123375,2123873,2124064,2125157,2125671,2126053,2126693,2126699,2126703,2126708,2126953,2127465,2155808,6385252,6386208,6386720,6579488,6579566,6579572,6627443,6644768,6647328,6647397,6648352,6648421,6648864,6648948,6713202,6776174,6908779,6908960,6909543,7038240,7039845,7103776,7105637,7169380,7169390,7217267,7234848,7235360,7235429,7237221,7300896,7302432,7303712,7398688,7479411,7496992,7565165,7566437,7610483,7628064,7628142,7628146,7629164,7631904,7631973,7759218]),new q(\"pt\",[2122016,2122607,2122849,2122853,2122863,2123040,2123123,2125153,2125423,2125600,2125921,2125935,2125938,2126197,2126437,2126693,2127213,6365281,6365283,6365284,6365296,6382693,6382703,6384672,6386208,6386273,6386464,6516589,6516590,6578464,6579488,6582048,6582131,6627425,6627428,6647072,6647412,6648608,6648692,6906144,6906721,7169390,7238757,7238767,7282785,7282787,7282788,7282789,7282800,7303968,7364978,7435621,7495968,7497075,7544929,7544932,7544933,7544944,7566433,7628064,7630624,7693600,14905120,15197039]),new q(\"sv\",[2122100,2122102,2122853,2123118,2123510,2123873,2124064,2124142,2124655,2125157,2125667,2126053,2126699,2126703,2126708,2126953,2127457,2127465,2155634,6382693,6385184,6385252,6386208,6386804,6514720,6579488,6579566,6579570,6579572,6644768,6647328,6648352,6648864,6747762,6776174,6909036,6909543,7037216,7105568,7169380,7217267,7233824,7234661,7235360,7235429,7235950,7299944,7302432,7302688,7398688,7479393,7479411,7495968,7564129,7565165,7610483,7627040,7628064,7628146,7629164,7631904,7758194,14971424,16151072])]}name(x){return x&&x.c1Bytes?\"windows-1252\":\"ISO-8859-1\"}};D.ISO_8859_1=H0;var Z0=class extends Y{byteMap(){return[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,177,32,179,32,181,182,32,32,185,186,187,188,32,190,191,32,177,32,179,32,181,182,183,32,185,186,187,188,32,190,191,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,32,248,249,250,251,252,253,254,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,32,248,249,250,251,252,253,254,32]}ngrams(){return[new q(\"cs\",[2122016,2122361,2122863,2124389,2125409,2125413,2125600,2125668,2125935,2125938,2126072,2126447,2126693,2126703,2126708,2126959,2127392,2127481,2128481,6365296,6513952,6514720,6627440,6627443,6627446,6647072,6647533,6844192,6844260,6910836,6972704,7042149,7103776,7104800,7233824,7268640,7269408,7269664,7282800,7300206,7301737,7304052,7304480,7304801,7368548,7368554,7369327,7403621,7562528,7565173,7566433,7566441,7566446,7628146,7630573,7630624,7676016,12477728,14773997,15296623,15540336,15540339,15559968,16278884]),new q(\"hu\",[2122016,2122106,2122341,2123111,2123116,2123365,2123873,2123887,2124147,2124645,2124649,2124790,2124901,2125153,2125157,2125161,2125413,2126714,2126949,2156915,6365281,6365291,6365293,6365299,6384416,6385184,6388256,6447470,6448494,6645625,6646560,6646816,6646885,6647072,6647328,6648421,6648864,6648933,6648948,6781216,6844263,6909556,6910752,7020641,7075450,7169383,7170414,7217249,7233899,7234923,7234925,7238688,7300985,7544929,7567973,7567988,7568097,7596391,7610465,7631904,7659891,8021362,14773792,15299360]),new q(\"pl\",[2122618,2122863,2124064,2124389,2124655,2125153,2125161,2125409,2125417,2125668,2125935,2125938,2126697,2127648,2127721,2127737,2128416,2128481,6365296,6365303,6385257,6514720,6519397,6519417,6582048,6584937,6627440,6627443,6627447,6627450,6645615,6646304,6647072,6647401,6778656,6906144,6907168,6907242,7037216,7039264,7039333,7170405,7233824,7235937,7235941,7282800,7305057,7305065,7368556,7369313,7369327,7369338,7502437,7502457,7563754,7564137,7566433,7825765,7955304,7957792,8021280,8022373,8026400,15955744]),new q(\"ro\",[2122016,2122083,2122593,2122597,2122607,2122613,2122853,2122857,2124897,2125153,2125925,2125938,2126693,2126819,2127214,2144873,2158190,6365283,6365284,6386277,6386720,6386789,6386976,6513010,6516590,6518048,6546208,6579488,6627425,6627427,6627428,6627440,6627443,6644e3,6646048,6646885,6647412,6648692,6889569,6889571,6889572,6889584,6907168,6908192,6909472,7102752,7103776,7106418,7107945,7234848,7238770,7303712,7365998,7496992,7497057,7501088,7594784,7628064,7631477,7660320,7694624,7695392,12216608,15625760])]}name(x){return x&&x.c1Bytes?\"windows-1250\":\"ISO-8859-2\"}};D.ISO_8859_2=Z0;var Q0=class extends Y{byteMap(){return[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,241,242,243,244,245,246,247,248,249,250,251,252,32,254,255,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,32,241,242,243,244,245,246,247,248,249,250,251,252,32,254,255]}ngrams(){return[2150944,2151134,2151646,2152400,2152480,2153168,2153182,2153936,2153941,2154193,2154462,2154464,2154704,2154974,2154978,2155230,2156514,2158050,13688280,13689580,13884960,14015468,14015960,14016994,14017056,14164191,14210336,14211104,14216992,14407133,14407712,14413021,14536736,14538016,14538965,14538991,14540320,14540498,14557394,14557407,14557409,14602784,14602960,14603230,14604576,14605292,14605344,14606818,14671579,14672085,14672088,14672094,14733522,14734804,14803664,14803666,14803672,14806816,14865883,14868e3,14868192,14871584,15196894,15459616]}name(){return\"ISO-8859-5\"}language(){return\"ru\"}};D.ISO_8859_5=Q0;var X0=class extends Y{byteMap(){return[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,32,32,32,32,32,224,225,226,227,228,229,230,231,232,233,234,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32]}ngrams(){return[2148324,2148326,2148551,2152932,2154986,2155748,2156006,2156743,13050055,13091104,13093408,13095200,13100064,13100227,13100231,13100232,13100234,13100236,13100237,13100239,13100243,13100249,13100258,13100261,13100264,13100266,13100320,13100576,13100746,13115591,13181127,13181153,13181156,13181157,13181160,13246663,13574343,13617440,13705415,13748512,13836487,14229703,14279913,14805536,14950599,14993696,15001888,15002144,15016135,15058720,15059232,15066656,15081671,15147207,15189792,15255524,15263264,15278279,15343815,15343845,15343848,15386912,15388960,15394336]}name(){return\"ISO-8859-6\"}language(){return\"ar\"}};D.ISO_8859_6=X0;var Y0=class extends Y{byteMap(){return[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,161,162,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,220,32,221,222,223,32,252,32,253,254,192,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,32,243,244,245,246,247,248,249,250,251,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,32]}ngrams(){return[2154989,2154992,2155497,2155753,2156016,2156320,2157281,2157797,2158049,2158368,2158817,2158831,2158833,2159604,2159605,2159847,2159855,14672160,14754017,14754036,14805280,14806304,14807292,14807584,14936545,15067424,15069728,15147252,15199520,15200800,15278324,15327520,15330014,15331872,15393257,15393268,15525152,15540449,15540453,15540464,15589664,15725088,15725856,15790069,15790575,15793184,15868129,15868133,15868138,15868144,15868148,15983904,15984416,15987951,16048416,16048617,16050157,16050162,16050666,16052e3,16052213,16054765,16379168,16706848]}name(x){return x&&x.c1Bytes?\"windows-1253\":\"ISO-8859-7\"}language(){return\"el\"}};D.ISO_8859_7=Y0;var xx=class extends Y{byteMap(){return[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,181,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,32,32,32,32,32]}ngrams(){return[new q(\"he\",[2154725,2154727,2154729,2154746,2154985,2154990,2155744,2155749,2155753,2155758,2155762,2155769,2155770,2157792,2157796,2158304,2159340,2161132,14744096,14950624,14950625,14950628,14950636,14950638,14950649,15001056,15065120,15068448,15068960,15071264,15071776,15278308,15328288,15328762,15329773,15330592,15331104,15333408,15333920,15474912,15474916,15523872,15524896,15540448,15540449,15540452,15540460,15540462,15540473,15655968,15671524,15787040,15788320,15788525,15920160,16261348,16312813,16378912,16392416,16392417,16392420,16392428,16392430,16392441]),new q(\"he\",[2154725,2154732,2155753,2155756,2155758,2155760,2157040,2157810,2157817,2158053,2158057,2158565,2158569,2160869,2160873,2161376,2161381,2161385,14688484,14688492,14688493,14688506,14738464,14738916,14740512,14741024,14754020,14754029,14754042,14950628,14950633,14950636,14950637,14950639,14950648,14950650,15002656,15065120,15066144,15196192,15327264,15327520,15328288,15474916,15474925,15474938,15528480,15530272,15591913,15591920,15591928,15605988,15605997,15606010,15655200,15655968,15918112,16326884,16326893,16326906,16376864,16441376,16442400,16442857])]}name(x){return x&&x.c1Bytes?\"windows-1255\":\"ISO-8859-8\"}language(){return\"he\"}};D.ISO_8859_8=xx;var ex=class extends Y{byteMap(){return[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,170,32,32,32,32,32,32,32,32,32,32,181,32,32,32,32,186,32,32,32,32,32,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,32,248,249,250,251,252,105,254,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,32,248,249,250,251,252,253,254,255]}ngrams(){return[2122337,2122345,2122357,2122849,2122853,2123621,2123873,2124140,2124641,2124655,2125153,2125676,2126689,2126945,2127461,2128225,6365282,6384416,6384737,6384993,6385184,6385405,6386208,6386273,6386429,6386685,6388065,6449522,6578464,6579488,6580512,6627426,6627435,6644841,6647328,6648352,6648425,6648681,6909029,6909472,6909545,6910496,7102830,7102834,7103776,7103858,7217249,7217250,7217259,7234657,7234661,7234848,7235872,7235950,7273760,7498094,7535982,7759136,7954720,7958386,16608800,16608868,16609021,16642301]}name(x){return x&&x.c1Bytes?\"windows-1254\":\"ISO-8859-9\"}language(){return\"tr\"}};D.ISO_8859_9=ex;var tx=class extends Y{byteMap(){return[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,144,131,32,131,32,32,32,32,32,32,154,32,156,157,158,159,144,32,32,32,32,32,32,32,32,32,154,32,156,157,158,159,32,162,162,188,32,180,32,32,184,32,186,32,32,32,32,191,32,32,179,179,180,181,32,32,184,32,186,32,188,190,190,191,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255]}ngrams(){return[2155040,2155246,2155758,2156512,2156576,2157280,2157294,2158048,2158053,2158305,2158574,2158576,2158816,2159086,2159090,2159342,2160626,2162162,14740968,14742268,14937632,15068156,15068648,15069682,15069728,15212783,15263008,15263776,15269664,15459821,15460384,15465709,15589408,15590688,15591653,15591679,15592992,15593186,15605986,15605999,15606001,15655456,15655648,15655918,15657248,15657980,15658016,15659506,15724267,15724773,15724776,15724782,15786210,15787492,15856352,15856354,15856360,15859488,15918571,15920672,15920880,15924256,16249582,16512288]}name(){return\"windows-1251\"}language(){return\"ru\"}};D.windows_1251=tx;var rx=class extends Y{byteMap(){return[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,129,32,131,32,32,32,32,136,32,138,32,156,141,142,143,144,32,32,32,32,32,32,32,152,32,154,32,156,32,32,159,32,32,32,32,32,32,32,32,32,32,170,32,32,32,32,32,32,32,32,32,32,181,32,32,32,32,32,32,32,32,32,32,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,32,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,32,32,32,32,244,32,32,32,32,249,32,251,252,32,32,255]}ngrams(){return[2148321,2148324,2148551,2153185,2153965,2154977,2155492,2156231,13050055,13091104,13093408,13095200,13099296,13099459,13099463,13099464,13099466,13099468,13099469,13099471,13099475,13099482,13099486,13099491,13099494,13099501,13099808,13100064,13100234,13115591,13181127,13181149,13181153,13181155,13181158,13246663,13574343,13617440,13705415,13748512,13836487,14295239,14344684,14544160,14753991,14797088,14806048,14806304,14885063,14927648,14928160,14935072,14950599,15016135,15058720,15124449,15131680,15474887,15540423,15540451,15540454,15583520,15585568,15590432]}name(){return\"windows-1256\"}language(){return\"ar\"}};D.windows_1256=rx;var nx=class extends Y{byteMap(){return[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,163,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,163,32,32,32,32,32,32,32,32,32,32,32,32,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223]}ngrams(){return[2147535,2148640,2149313,2149327,2150081,2150085,2150338,2150607,2150610,2151105,2151375,2151380,2151631,2152224,2152399,2153153,2153684,2154196,12701385,12702936,12963032,12963529,12964820,12964896,13094688,13181136,13223200,13224224,13226272,13419982,13420832,13424846,13549856,13550880,13552069,13552081,13553440,13553623,13574352,13574355,13574359,13617103,13617696,13618392,13618464,13620180,13621024,13621185,13684684,13685445,13685449,13685455,13812183,13813188,13881632,13882561,13882569,13882583,13944268,13946656,13946834,13948960,14272544,14603471]}name(){return\"KOI8-R\"}language(){return\"ru\"}};D.KOI8_R=nx});var Lx=x0(a0=>{\"use strict\";var ye=a0&&a0.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(a0,\"__esModule\",{value:!0});a0.ISO_2022_CN=a0.ISO_2022_KR=a0.ISO_2022_JP=void 0;var we=ye(i0()),_0=class{constructor(){this.escapeSequences=[]}name(){return\"ISO_2022\"}match(x){let t,a,f,s=0,d=0,i=0,h,g=x.inputBytes,G=x.inputLen;x:for(t=0;t<G;t++){if(g[t]==27){e:for(f=0;f<this.escapeSequences.length;f++){let e0=this.escapeSequences[f];if(G-t<e0.length)continue e;for(a=1;a<e0.length;a++)if(e0[a]!=g[t+a])continue e;s++,t+=e0.length-1;continue x}d++}(g[t]==14||g[t]==15)&&i++}return s==0?null:(h=(100*s-100*d)/(s+d),s+i<5&&(h-=(5-(s+i))*10),h<=0?null:(0,we.default)(x,this,h))}},ax=class extends _0{constructor(){super(...arguments),this.escapeSequences=[[27,36,40,67],[27,36,40,68],[27,36,64],[27,36,65],[27,36,66],[27,38,64],[27,40,66],[27,40,72],[27,40,73],[27,40,74],[27,46,65],[27,46,70]]}name(){return\"ISO-2022-JP\"}language(){return\"ja\"}};a0.ISO_2022_JP=ax;var fx=class extends _0{constructor(){super(...arguments),this.escapeSequences=[[27,36,41,67]]}name(){return\"ISO-2022-KR\"}language(){return\"kr\"}};a0.ISO_2022_KR=fx;var cx=class extends _0{constructor(){super(...arguments),this.escapeSequences=[[27,36,41,65],[27,36,41,71],[27,36,42,72],[27,36,41,69],[27,36,43,73],[27,36,43,74],[27,36,43,75],[27,36,43,76],[27,36,43,77],[27,78],[27,79]]}name(){return\"ISO-2022-CN\"}language(){return\"zh\"}};a0.ISO_2022_CN=cx});var Mx=x0(I0=>{\"use strict\";Object.defineProperty(I0,\"__esModule\",{value:!0});I0.isByteArray=void 0;var Se=e=>e==null||typeof e!=\"object\"?!1:isFinite(e.length)&&e.length>=0;I0.isByteArray=Se});var Px=x0(O=>{\"use strict\";var Ee=O&&O.__createBinding||(Object.create?function(e,x,t,a){a===void 0&&(a=t);var f=Object.getOwnPropertyDescriptor(x,t);(!f||(\"get\"in f?!x.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return x[t]}}),Object.defineProperty(e,a,f)}:function(e,x,t,a){a===void 0&&(a=t),e[a]=x[t]}),ve=O&&O.__setModuleDefault||(Object.create?function(e,x){Object.defineProperty(e,\"default\",{enumerable:!0,value:x})}:function(e,x){e.default=x}),C0=O&&O.__importStar||function(){var e=function(x){return e=Object.getOwnPropertyNames||function(t){var a=[];for(var f in t)Object.prototype.hasOwnProperty.call(t,f)&&(a[a.length]=f);return a},e(x)};return function(x){if(x&&x.__esModule)return x;var t={};if(x!=null)for(var a=e(x),f=0;f<a.length;f++)a[f]!==\"default\"&&Ee(t,x,a[f]);return ve(t,x),t}}(),ix=O&&O.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(O,\"__esModule\",{value:!0});O.detectFileSync=O.detectFile=O.analyse=O.detect=void 0;var jx=ix(Ix()),ke=ix(Cx()),Ie=ix(Rx()),O0=C0(Bx()),y0=C0(Dx()),f0=C0(Tx()),sx=C0(Lx()),Oe=Mx(),Ce=[new Ie.default,new O0.UTF_16BE,new O0.UTF_16LE,new O0.UTF_32BE,new O0.UTF_32LE,new y0.sjis,new y0.big5,new y0.euc_jp,new y0.euc_kr,new y0.gb_18030,new sx.ISO_2022_JP,new sx.ISO_2022_KR,new sx.ISO_2022_CN,new f0.ISO_8859_1,new f0.ISO_8859_2,new f0.ISO_8859_5,new f0.ISO_8859_6,new f0.ISO_8859_7,new f0.ISO_8859_8,new f0.ISO_8859_9,new f0.windows_1251,new f0.windows_1256,new f0.KOI8_R,new ke.default],Re=e=>{let x=(0,O.analyse)(e);return x.length>0?x[0].name:null};O.detect=Re;var Be=e=>{if(!(0,Oe.isByteArray)(e))throw new Error(\"Input must be a byte array, e.g. Buffer or Uint8Array\");let x=[];for(let s=0;s<256;s++)x[s]=0;for(let s=e.length-1;s>=0;s--)x[e[s]&255]++;let t=!1;for(let s=128;s<=159;s+=1)if(x[s]!==0){t=!0;break}let a={byteStats:x,c1Bytes:t,rawInput:e,rawLen:e.length,inputBytes:e,inputLen:e.length};return Ce.map(s=>s.match(a)).filter(s=>!!s).sort((s,d)=>d.confidence-s.confidence)};O.analyse=Be;var Ae=(e,x={})=>new Promise((t,a)=>{let f,s=(0,jx.default)(),d=(h,g)=>{f&&s.closeSync(f),h?a(h):g?t((0,O.detect)(g)):a(new Error(\"No error and no buffer received\"))},i=x?.sampleSize||0;if(i>0){f=s.openSync(e,\"r\");let h=Buffer.allocUnsafe(i);s.read(f,h,0,i,x.offset,(g,G)=>{g?d(g,null):(G<i&&(h=h.subarray(0,G)),d(null,h))});return}s.readFile(e,d)});O.detectFile=Ae;var De=(e,x={})=>{let t=(0,jx.default)();if(x&&x.sampleSize){let a=t.openSync(e,\"r\"),f=Buffer.allocUnsafe(x.sampleSize),s=t.readSync(a,f,0,x.sampleSize,x.offset);return s<x.sampleSize&&(f=f.subarray(0,s)),t.closeSync(a),(0,O.detect)(f)}return(0,O.detect)(t.readFileSync(e))};O.detectFileSync=De;O.default={analyse:O.analyse,detect:O.detect,detectFileSync:O.detectFileSync,detectFile:O.detectFile}});var E0=class extends Error{code;constructor(x,t){super(x),this.name=\"IoError\",this.code=t}},ne=/invalid string length|allocation size overflow|array buffer allocation failed|invalid (?:typed )?array length|out of memory/i,Sx=(e,x)=>{if(e instanceof E0)return e;let t=e instanceof Error?e.message:x;return new E0(t,ne.test(t)?\"TOO_LARGE\":\"PARSE\")};var qx=wx(Ex(),1);var ae=/[\\u200B-\\u200D\\uFEFF\\u2060]/g,fe=/[\\u00A0\\u202F]/g,l0=e=>e.replace(ae,\"\").replace(fe,\" \").normalize(\"NFC\").trim();var vx=e=>e.length>=4&&e[0]===255&&e[1]===254&&e[2]===0&&e[3]===0?{encoding:\"utf-32le\",bomLength:4}:e.length>=3&&e[0]===239&&e[1]===187&&e[2]===191?{encoding:\"utf-8\",bomLength:3}:e.length>=2&&e[0]===255&&e[1]===254?{encoding:\"utf-16le\",bomLength:2}:e.length>=2&&e[0]===254&&e[1]===255?{encoding:\"utf-16be\",bomLength:2}:null;var ce=[\",\",\";\",\" \",\"|\"];var se=(e,x)=>{let t=0,a=!1;for(let f=0;f<e.length;f++){let s=e[f];s==='\"'?a=!a:!a&&s===x&&t++}return t},ie=e=>{let x=e.reduce((t,a)=>t+a,0)/e.length;return e.reduce((t,a)=>t+(a-x)**2,0)/e.length},kx=e=>{let x=e.split(/\\r\\n|\\r|\\n/).filter(s=>s.length>0).slice(0,10),t=\",\",a=1/0,f=!1;for(let s of ce){let d=x.map(g=>se(g,s));if(!(d.length>0&&d.every(g=>g>0)))continue;let h=ie(d);(!f||h<a)&&(t=s,a=h,f=!0)}return t};var zx=wx(Px(),1),Fe=e=>{try{return new TextDecoder(\"utf-8\",{fatal:!0}).decode(e),!0}catch{return!1}},Te=e=>{let x=e.toLowerCase();return x===\"ascii\"?\"utf-8\":x},dx=e=>{if(Fe(e))return\"utf-8\";let x=(0,zx.detect)(e);return x?Te(x):\"windows-1252\"};var ox=e=>new Promise((x,t)=>{let a=new FileReader;a.onload=()=>x(a.result),a.onerror=()=>t(a.error),a.readAsArrayBuffer(e)});var Ux=64*1024,Le=1024*1024,Me=e=>{try{return new TextDecoder(e)}catch{return new TextDecoder(\"windows-1252\")}},je=e=>{for(let x=0;x<e.length;x++)if(e[x]>127)return x;return-1},Pe=e=>{let x=je(e),t=x<0?0:Math.max(0,x-1024);return dx(e.subarray(t,t+Le))},w0=async e=>{let x=new Uint8Array(await ox(e)),t=x.subarray(0,Ux),a=vx(x),f=a?a.encoding:dx(t),s=null;if(f===\"utf-8\")try{s=new TextDecoder(\"utf-8\",{fatal:!0}).decode(x)}catch{f=Pe(x)}s==null&&(s=Me(f).decode(x));let d=kx(s.slice(0,Ux));return{text:s,encoding:f,delimiter:d}};var ze=/^sep=.$/i,ux=(e,x)=>e.length>0&&ze.test(e[0].join(x))?e.slice(1):e;var Nx=async({file:e})=>{let{text:x,delimiter:t}=await w0(e),a=qx.default.parse(x,{header:!1,skipEmptyLines:!1,delimiter:t}),f=a.data;for(let d of f)for(let i=0;i<d.length;i++)d[i]=l0(d[i]);let s=a.errors.map(d=>({code:d.code,row:d.row}));return{kind:\"rows\",rows:ux(f,t),delimiter:t,errors:s}};var Vx=async({file:e})=>{let{text:x}=await w0(e),a=JSON.parse(x).map(i=>{let h={};for(let g of Object.keys(i))h[l0(g)]=i[g];return h}),f=new Set;for(let i of a)for(let h of Object.keys(i))f.add(h);let s=Array.from(f),d=a.map(i=>{let h={};for(let g of s){let G=i[g];h[g]=G!=null?l0(String(G)):\"\"}return h});return{kind:\"records\",headers:s,rows:d}};var Ue=/^[=@+\\-\\t\\r]/,qe=/^[+-][\\d.,'\\s\xA0 ]*$/;function Wx(e){return!Ue.test(e)||qe.test(e)?e:`'${e}`}function Kx(e){let x=Wx(e);return x.includes(\",\")||x.includes('\"')||x.includes(`\n`)||x.includes(\"\\r\")?`\"${x.replace(/\"/g,'\"\"')}\"`:x}function Ne(e,x){let t=x??(e.length>0?Object.keys(e[0]):[]);if(t.length===0)return new Blob([\"\"],{type:\"text/csv\"});let a=t.map(Kx).join(\",\"),f=e.map(d=>t.map(i=>Kx(d[i]??\"\")).join(\",\")),s=f.length>0?`${a}\n${f.join(`\n`)}`:`${a}\n`;return new Blob([`\\uFEFF${s}`],{type:\"text/csv;charset=utf-8\"})}function $x(e){let x=Wx(e);return x.includes(\" \")||x.includes('\"')||x.includes(`\n`)||x.includes(\"\\r\")?`\"${x.replace(/\"/g,'\"\"')}\"`:x}function Ve(e,x){let t=x??(e.length>0?Object.keys(e[0]):[]);if(t.length===0)return new Blob([\"\"],{type:\"text/tab-separated-values\"});let a=t.map($x).join(\" \"),f=e.map(d=>t.map(i=>$x(d[i]??\"\")).join(\" \")),s=f.length>0?`${a}\n${f.join(`\n`)}`:`${a}\n`;return new Blob([`\\uFEFF${s}`],{type:\"text/tab-separated-values;charset=utf-8\"})}function Ke(e){return new Blob([JSON.stringify(e,null,2)],{type:\"application/json;charset=utf-8\"})}function $e(e){return e.replace(/&/g,\"&amp;\").replace(/</g,\"&lt;\").replace(/>/g,\"&gt;\").replace(/\"/g,\"&quot;\").replace(/'/g,\"&apos;\")}function We(e,x){let t=x??(e.length>0?Object.keys(e[0]):[]),a=`<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rows>\n`;for(let f of e){a+=` <row>\n`;for(let s of t){let d=s.replace(/\\s+/g,\"_\");a+=` <${d}>${$e(f[s]??\"\")}</${d}>\n`}a+=` </row>\n`}return a+=\"</rows>\",new Blob([a],{type:\"application/xml;charset=utf-8\"})}var lx=e=>e.columns.map(x=>x.title),Jx=e=>Ne(e.rows,lx(e)),Gx=e=>Ve(e.rows,lx(e)),Hx=e=>Ke(e.rows),Zx=e=>We(e.rows,lx(e));var Je={csv:Nx,json:Vx},Ge={csv:Jx,tsv:Gx,json:Hx,xml:Zx},hx=self;self.addEventListener(\"message\",async e=>{let x=e.data;try{if(x.type===\"PARSE\"&&(x.format===\"csv\"||x.format===\"json\")){let t=await Je[x.format]({file:x.file});hx.postMessage({type:\"PARSED\",result:t,generation:x.generation});return}if(x.type===\"SERIALIZE\"&&x.format!==\"xlsx\"){let t=await Ge[x.format]({rows:x.rows,columns:x.columns});hx.postMessage({type:\"SERIALIZED\",blob:t,generation:x.generation})}}catch(t){let a=Sx(t,\"Text worker error\");hx.postMessage({type:\"ERROR\",message:a.message,code:a.code,generation:x.generation})}});})();\n"
4763
4728
  };
4764
- function $s(e) {
4729
+ function qs(e) {
4765
4730
  if (typeof Worker > "u" || typeof URL > "u" || typeof URL.createObjectURL != "function") throw Error(`Worker API unavailable; cannot spawn "${e}" worker`);
4766
- let t = new Blob([Qs[e]], { type: "application/javascript" }), n = URL.createObjectURL(t), r = new Worker(n);
4731
+ let t = new Blob([Ks[e]], { type: "application/javascript" }), n = URL.createObjectURL(t), r = new Worker(n);
4767
4732
  return URL.revokeObjectURL(n), r;
4768
4733
  }
4769
- async function ec() {
4734
+ async function Js() {
4770
4735
  if (typeof Worker > "u" || typeof URL > "u" || typeof URL.createObjectURL != "function") throw Error("Worker API unavailable; cannot spawn \"sheet\" worker");
4771
4736
  let { SHEET_WORKER_SOURCE: e } = await import("./sheetWorkerSource.generated-BRh0-P0M.js");
4772
4737
  if (!e) throw Error("Sheet worker source not built; run pnpm build:workers");
@@ -4775,14 +4740,14 @@ async function ec() {
4775
4740
  }
4776
4741
  //#endregion
4777
4742
  //#region src/core/FilterEngine.ts
4778
- function tc(e) {
4743
+ function Ys(e) {
4779
4744
  let t = /* @__PURE__ */ new Map();
4780
4745
  return (n) => {
4781
4746
  let r = t.get(n);
4782
4747
  return r === void 0 && (r = e(n), t.set(n, r)), r;
4783
4748
  };
4784
4749
  }
4785
- var nc = class {
4750
+ var Xs = class {
4786
4751
  _sortState = null;
4787
4752
  _showOnlyDeletedRows = !1;
4788
4753
  getFilteredRowIds() {
@@ -4859,7 +4824,7 @@ var nc = class {
4859
4824
  }
4860
4825
  clear() {}
4861
4826
  destroy() {}
4862
- }, rc = class {
4827
+ }, Zs = class {
4863
4828
  filters = {
4864
4829
  search: "",
4865
4830
  matchCase: !1,
@@ -4983,7 +4948,7 @@ var nc = class {
4983
4948
  }
4984
4949
  setColumns(e) {
4985
4950
  this.columnFormatters.clear();
4986
- for (let t of e) t.formatter && this.columnFormatters.set(t.id, tc(t.formatter));
4951
+ for (let t of e) t.formatter && this.columnFormatters.set(t.id, Ys(t.formatter));
4987
4952
  this.fieldOrder = e.map((e) => e.id), this.multiselectFields = new Set(e.filter((e) => e.editor?.type === "multiselect").map((e) => e.id)), this._wordsPerRow = Math.max(2, Math.ceil(this.fieldOrder.length / 32)), this.rowTextCache.clear(), this.filterWorker && this.filterWorker.postMessage({
4988
4953
  type: "SET_FIELD_ORDER",
4989
4954
  fieldOrder: this.fieldOrder,
@@ -5434,7 +5399,7 @@ var nc = class {
5434
5399
  }
5435
5400
  initFilterWorker() {
5436
5401
  if (!(typeof Worker > "u")) try {
5437
- this.filterWorker = $s("filter"), this.filterWorker.onmessage = (e) => {
5402
+ this.filterWorker = qs("filter"), this.filterWorker.onmessage = (e) => {
5438
5403
  let t = e.data;
5439
5404
  if (t.type === "SORT_RESULT") {
5440
5405
  if (t.generation === this._sortGeneration && this._pendingSortResolve) {
@@ -5460,15 +5425,15 @@ var nc = class {
5460
5425
  this._pendingFilterResolve = null, e();
5461
5426
  }
5462
5427
  }
5463
- }, ic = /^[\s\p{Sc}%]+/u, ac = /[\s\p{Sc}%]+$/u, oc = /^\d{1,3}(?: \d{3})+(?:[.,]\d+)?$/, sc = /^[\d.,]+$/;
5464
- function cc(e) {
5428
+ }, Qs = /^[\s\p{Sc}%]+/u, $s = /[\s\p{Sc}%]+$/u, ec = /^\d{1,3}(?: \d{3})+(?:[.,]\d+)?$/, tc = /^[\d.,]+$/;
5429
+ function nc(e) {
5465
5430
  let t = e.trim();
5466
5431
  if (!t) return null;
5467
5432
  let n = !1;
5468
5433
  t.startsWith("(") && t.endsWith(")") && (t = t.slice(1, -1), n = !0);
5469
5434
  let r = !1;
5470
5435
  for (;;) {
5471
- let e = t.replace(ic, "");
5436
+ let e = t.replace(Qs, "");
5472
5437
  if (!r && e.startsWith("-")) {
5473
5438
  r = !0, t = e.slice(1);
5474
5439
  continue;
@@ -5476,38 +5441,38 @@ function cc(e) {
5476
5441
  t = e;
5477
5442
  break;
5478
5443
  }
5479
- return r && (n = !0), t = t.replace(ac, ""), oc.test(t) && (t = t.replace(/ /g, "")), sc.test(t) ? {
5444
+ return r && (n = !0), t = t.replace($s, ""), ec.test(t) && (t = t.replace(/ /g, "")), tc.test(t) ? {
5480
5445
  core: t,
5481
5446
  negative: n
5482
5447
  } : null;
5483
5448
  }
5484
- function lc(e) {
5449
+ function rc(e) {
5485
5450
  let t = new Intl.DateTimeFormat(e, {
5486
5451
  day: "numeric",
5487
5452
  month: "numeric"
5488
5453
  }).formatToParts(new Date(2e3, 11, 31)), n = t.findIndex((e) => e.type === "day"), r = t.findIndex((e) => e.type === "month");
5489
5454
  return n !== -1 && r !== -1 && n < r ? "EU" : "US";
5490
5455
  }
5491
- var uc = lc();
5492
- function dc(e, t, n = 1e3) {
5456
+ var ic = rc();
5457
+ function ac(e, t, n = 1e3) {
5493
5458
  let r = 0, i = 0, a = Math.min(e.length, n);
5494
5459
  for (let n = 0; n < a; n++) {
5495
5460
  let a = e[n];
5496
5461
  for (let e of t) {
5497
5462
  let t = a[e];
5498
5463
  if (typeof t != "string") continue;
5499
- let n = cc(t);
5464
+ let n = nc(t);
5500
5465
  if (!n) continue;
5501
5466
  let o = n.core, s = o.lastIndexOf("."), c = o.lastIndexOf(",");
5502
5467
  if (s !== -1 && c !== -1) return c > s ? "EU" : "US";
5503
5468
  c !== -1 && /,\d{1,2}$/.test(o) ? r++ : s !== -1 && /\.\d{1,2}$/.test(o) && i++;
5504
5469
  }
5505
5470
  }
5506
- return r === i ? uc : r > i ? "EU" : "US";
5471
+ return r === i ? ic : r > i ? "EU" : "US";
5507
5472
  }
5508
- function fc(e, t) {
5473
+ function oc(e, t) {
5509
5474
  if (typeof e != "string") return e;
5510
- let n = cc(e);
5475
+ let n = nc(e);
5511
5476
  if (!n) return e;
5512
5477
  let { core: r, negative: i } = n, a = r;
5513
5478
  t === "EU" ? r.includes(",") ? a = r.replace(/\./g, "").replace(",", ".") : /^\d{1,3}(\.\d{3})+$/.test(r) && (a = r.replace(/\./g, "")) : r.includes(",") && (a = r.replace(/,/g, ""));
@@ -5516,7 +5481,7 @@ function fc(e, t) {
5516
5481
  }
5517
5482
  //#endregion
5518
5483
  //#region src/core/formats/parseImportedDate.ts
5519
- var pc = [
5484
+ var sc = [
5520
5485
  "january",
5521
5486
  "february",
5522
5487
  "march",
@@ -5530,21 +5495,21 @@ var pc = [
5530
5495
  "november",
5531
5496
  "december"
5532
5497
  ];
5533
- function mc(e) {
5498
+ function cc(e) {
5534
5499
  let t = {}, n = Hr.ui.calendar.months, r = Hr.ui.calendar.monthsShort;
5535
- return pc.forEach((e, i) => {
5500
+ return sc.forEach((e, i) => {
5536
5501
  t[n[e].toLowerCase()] = i + 1, t[r[e].toLowerCase()] = i + 1;
5537
- }), e && pc.forEach((n, r) => {
5502
+ }), e && sc.forEach((n, r) => {
5538
5503
  let i = e(`calendar.months.${n}`), a = e(`calendar.monthsShort.${n}`);
5539
5504
  i && (t[i.toLowerCase().replace(/\.$/, "")] = r + 1), a && (t[a.toLowerCase().replace(/\.$/, "")] = r + 1);
5540
5505
  }), t;
5541
5506
  }
5542
- function hc(e, t, n) {
5507
+ function lc(e, t, n) {
5543
5508
  if (t < 1 || t > 12 || n < 1 || n > 31) return null;
5544
5509
  let r = new Date(e, t - 1, n);
5545
5510
  return r.getFullYear() !== e || r.getMonth() !== t - 1 || r.getDate() !== n ? null : `${e}-${String(t).padStart(2, "0")}-${String(n).padStart(2, "0")}`;
5546
5511
  }
5547
- function gc(e, t, n = 1e3) {
5512
+ function uc(e, t, n = 1e3) {
5548
5513
  let r = /^(\d{1,2})[\/.](\d{1,2})[\/.](\d{4})$/, i = Math.min(e.length, n);
5549
5514
  for (let n = 0; n < i; n++) {
5550
5515
  let i = e[n];
@@ -5558,34 +5523,34 @@ function gc(e, t, n = 1e3) {
5558
5523
  if (o > 12) return "US";
5559
5524
  }
5560
5525
  }
5561
- return uc;
5526
+ return ic;
5562
5527
  }
5563
- function _c(e, t, n) {
5528
+ function dc(e, t, n) {
5564
5529
  let r = e.trim();
5565
5530
  if (!r) return null;
5566
5531
  let i = r.match(/^(\d{4})-(\d{2})-(\d{2})$/);
5567
- if (i || (i = r.match(/^(\d{4})\/(\d{2})\/(\d{2})$/), i)) return hc(+i[1], +i[2], +i[3]);
5532
+ if (i || (i = r.match(/^(\d{4})\/(\d{2})\/(\d{2})$/), i)) return lc(+i[1], +i[2], +i[3]);
5568
5533
  if (i = r.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/), i) {
5569
5534
  let e = +i[1], n = +i[2], r = +i[3];
5570
- return e > 12 ? hc(r, n, e) : n > 12 ? hc(r, e, n) : t === "EU" ? hc(r, n, e) : hc(r, e, n);
5535
+ return e > 12 ? lc(r, n, e) : n > 12 ? lc(r, e, n) : t === "EU" ? lc(r, n, e) : lc(r, e, n);
5571
5536
  }
5572
5537
  if (i = r.match(/^(\d{1,2})\s+([A-Za-zÀ-ÖØ-öø-ÿА-яёЁ.]+),?\s+(\d{4})$/), i) {
5573
5538
  let e = n[i[2].toLowerCase().replace(/\.$/, "")];
5574
- if (e !== void 0) return hc(+i[3], e, +i[1]);
5539
+ if (e !== void 0) return lc(+i[3], e, +i[1]);
5575
5540
  }
5576
5541
  if (i = r.match(/^([A-Za-zÀ-ÖØ-öø-ÿА-яёЁ.]+)\s+(\d{1,2}),?\s+(\d{4})$/), i) {
5577
5542
  let e = n[i[1].toLowerCase().replace(/\.$/, "")];
5578
- if (e !== void 0) return hc(+i[3], e, +i[2]);
5543
+ if (e !== void 0) return lc(+i[3], e, +i[2]);
5579
5544
  }
5580
5545
  if (i = r.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/), i) {
5581
5546
  let e = +i[1], n = +i[2], r = +i[3];
5582
- return e > 12 ? hc(r, n, e) : n > 12 ? hc(r, e, n) : t === "EU" ? hc(r, n, e) : hc(r, e, n);
5547
+ return e > 12 ? lc(r, n, e) : n > 12 ? lc(r, e, n) : t === "EU" ? lc(r, n, e) : lc(r, e, n);
5583
5548
  }
5584
5549
  return null;
5585
5550
  }
5586
5551
  //#endregion
5587
5552
  //#region src/core/formulas/FormulaRegistry.ts
5588
- var vc = class {
5553
+ var fc = class {
5589
5554
  formulas = /* @__PURE__ */ new Map();
5590
5555
  register(e) {
5591
5556
  if (this.formulas.has(e.name)) throw Error(`Formula "${e.name}" is already registered`);
@@ -5606,10 +5571,10 @@ var vc = class {
5606
5571
  };
5607
5572
  //#endregion
5608
5573
  //#region src/core/formulas/builtins/text.ts
5609
- function yc(e) {
5574
+ function pc(e) {
5610
5575
  return e == null || e === "" ? null : typeof e == "string" ? e : String(e);
5611
5576
  }
5612
- var bc = {
5577
+ var mc = {
5613
5578
  name: "UPPER",
5614
5579
  label: "Uppercase",
5615
5580
  category: "text",
@@ -5621,10 +5586,10 @@ var bc = {
5621
5586
  },
5622
5587
  kind: "cell",
5623
5588
  compute: (e) => {
5624
- let t = yc(e.value);
5589
+ let t = pc(e.value);
5625
5590
  return t === null ? e.value : t.toUpperCase();
5626
5591
  }
5627
- }, xc = {
5592
+ }, hc = {
5628
5593
  name: "LOWER",
5629
5594
  label: "Lowercase",
5630
5595
  category: "text",
@@ -5636,10 +5601,10 @@ var bc = {
5636
5601
  },
5637
5602
  kind: "cell",
5638
5603
  compute: (e) => {
5639
- let t = yc(e.value);
5604
+ let t = pc(e.value);
5640
5605
  return t === null ? e.value : t.toLowerCase();
5641
5606
  }
5642
- }, Sc = {
5607
+ }, gc = {
5643
5608
  name: "TRIM",
5644
5609
  label: "Trim whitespace",
5645
5610
  category: "text",
@@ -5651,10 +5616,10 @@ var bc = {
5651
5616
  },
5652
5617
  kind: "cell",
5653
5618
  compute: (e) => {
5654
- let t = yc(e.value);
5619
+ let t = pc(e.value);
5655
5620
  return t === null ? e.value : t.replace(/\s+/g, " ").trim();
5656
5621
  }
5657
- }, Cc = {
5622
+ }, _c = {
5658
5623
  name: "CAPITALIZE",
5659
5624
  label: "Capitalize",
5660
5625
  category: "text",
@@ -5666,20 +5631,20 @@ var bc = {
5666
5631
  },
5667
5632
  kind: "cell",
5668
5633
  compute: (e) => {
5669
- let t = yc(e.value);
5634
+ let t = pc(e.value);
5670
5635
  return t === null ? e.value : t.charAt(0).toUpperCase() + t.slice(1);
5671
5636
  }
5672
5637
  };
5673
5638
  //#endregion
5674
5639
  //#region src/core/formulas/builtins/number.ts
5675
- function wc(e) {
5640
+ function vc(e) {
5676
5641
  return e == null || e === "" ? null : typeof e == "string" ? e : String(e);
5677
5642
  }
5678
- function Tc(e) {
5643
+ function yc(e) {
5679
5644
  let t = Number(e);
5680
5645
  return Number.isNaN(t) ? null : t;
5681
5646
  }
5682
- function Ec(e, t, n, r) {
5647
+ function bc(e, t, n, r) {
5683
5648
  return {
5684
5649
  name: e,
5685
5650
  label: t,
@@ -5692,14 +5657,14 @@ function Ec(e, t, n, r) {
5692
5657
  },
5693
5658
  kind: "cell",
5694
5659
  compute: (e) => {
5695
- let t = wc(e.value);
5660
+ let t = vc(e.value);
5696
5661
  if (t === null) return e.value;
5697
- let n = Tc(t);
5662
+ let n = yc(t);
5698
5663
  return n === null ? e.value : String(r(n));
5699
5664
  }
5700
5665
  };
5701
5666
  }
5702
- var Dc = Ec("ROUND", "Round", "(number)", Math.round), Oc = Ec("ROUND_UP", "Round up", "(number)", Math.ceil), kc = Ec("ROUND_DOWN", "Round down", "(number)", Math.floor), Ac = Ec("ABS", "Absolute value", "(number)", Math.abs), jc = {
5667
+ var xc = bc("ROUND", "Round", "(number)", Math.round), Sc = bc("ROUND_UP", "Round up", "(number)", Math.ceil), Cc = bc("ROUND_DOWN", "Round down", "(number)", Math.floor), wc = bc("ABS", "Absolute value", "(number)", Math.abs), Tc = {
5703
5668
  name: "CLEAR",
5704
5669
  label: "Clear",
5705
5670
  category: "text",
@@ -5711,7 +5676,7 @@ var Dc = Ec("ROUND", "Round", "(number)", Math.round), Oc = Ec("ROUND_UP", "Roun
5711
5676
  },
5712
5677
  kind: "cell",
5713
5678
  compute: () => ""
5714
- }, Mc = {
5679
+ }, Ec = {
5715
5680
  name: "MERGE",
5716
5681
  label: "Merge columns",
5717
5682
  category: "text",
@@ -5747,7 +5712,7 @@ var Dc = Ec("ROUND", "Round", "(number)", Math.round), Oc = Ec("ROUND_UP", "Roun
5747
5712
  }
5748
5713
  return i.join(r);
5749
5714
  }
5750
- }, Nc = {
5715
+ }, Dc = {
5751
5716
  name: "SPLIT",
5752
5717
  label: "Split column",
5753
5718
  category: "text",
@@ -5781,7 +5746,7 @@ var Dc = Ec("ROUND", "Round", "(number)", Math.round), Oc = Ec("ROUND_UP", "Roun
5781
5746
  for (let e = 0; e < n.length; e++) o[n[e]] = e < n.length - 1 ? a[e] ?? "" : a.slice(e).join(r);
5782
5747
  return o;
5783
5748
  }
5784
- }, Pc = {
5749
+ }, Oc = {
5785
5750
  name: "CONCAT",
5786
5751
  label: "Concatenate",
5787
5752
  category: "text",
@@ -5800,10 +5765,10 @@ var Dc = Ec("ROUND", "Round", "(number)", Math.round), Oc = Ec("ROUND_UP", "Roun
5800
5765
  };
5801
5766
  //#endregion
5802
5767
  //#region src/core/formulas/builtins/left.ts
5803
- function Fc(e) {
5768
+ function kc(e) {
5804
5769
  return e == null || e === "" ? null : typeof e == "string" ? e : String(e);
5805
5770
  }
5806
- var Ic = {
5771
+ var Ac = {
5807
5772
  name: "LEFT",
5808
5773
  label: "Left",
5809
5774
  category: "text",
@@ -5815,7 +5780,7 @@ var Ic = {
5815
5780
  },
5816
5781
  kind: "cell",
5817
5782
  compute: (e) => {
5818
- let t = e.args ?? [e.value], n = Fc(t[0]);
5783
+ let t = e.args ?? [e.value], n = kc(t[0]);
5819
5784
  if (n === null) return t[0];
5820
5785
  let r = Math.floor(Number(t[1]));
5821
5786
  return r <= 0 ? "" : n.slice(0, r);
@@ -5823,10 +5788,10 @@ var Ic = {
5823
5788
  };
5824
5789
  //#endregion
5825
5790
  //#region src/core/formulas/builtins/right.ts
5826
- function Lc(e) {
5791
+ function jc(e) {
5827
5792
  return e == null || e === "" ? null : typeof e == "string" ? e : String(e);
5828
5793
  }
5829
- var Rc = {
5794
+ var Mc = {
5830
5795
  name: "RIGHT",
5831
5796
  label: "Right",
5832
5797
  category: "text",
@@ -5838,7 +5803,7 @@ var Rc = {
5838
5803
  },
5839
5804
  kind: "cell",
5840
5805
  compute: (e) => {
5841
- let t = e.args ?? [e.value], n = Lc(t[0]);
5806
+ let t = e.args ?? [e.value], n = jc(t[0]);
5842
5807
  if (n === null) return t[0];
5843
5808
  let r = Math.floor(Number(t[1]));
5844
5809
  return r <= 0 ? "" : n.slice(-r);
@@ -5846,10 +5811,10 @@ var Rc = {
5846
5811
  };
5847
5812
  //#endregion
5848
5813
  //#region src/core/formulas/builtins/mid.ts
5849
- function zc(e) {
5814
+ function Nc(e) {
5850
5815
  return e == null || e === "" ? null : typeof e == "string" ? e : String(e);
5851
5816
  }
5852
- var Bc = {
5817
+ var Pc = {
5853
5818
  name: "MID",
5854
5819
  label: "Mid",
5855
5820
  category: "text",
@@ -5861,7 +5826,7 @@ var Bc = {
5861
5826
  },
5862
5827
  kind: "cell",
5863
5828
  compute: (e) => {
5864
- let t = e.args ?? [e.value], n = zc(t[0]);
5829
+ let t = e.args ?? [e.value], n = Nc(t[0]);
5865
5830
  if (n === null) return t[0];
5866
5831
  let r = Math.max(1, Math.floor(Number(t[1]))), i = Math.floor(Number(t[2]));
5867
5832
  return i <= 0 ? "" : n.slice(r - 1, r - 1 + i);
@@ -5869,10 +5834,10 @@ var Bc = {
5869
5834
  };
5870
5835
  //#endregion
5871
5836
  //#region src/core/formulas/builtins/substitute.ts
5872
- function Vc(e) {
5837
+ function Fc(e) {
5873
5838
  return e == null || e === "" ? null : typeof e == "string" ? e : String(e);
5874
5839
  }
5875
- function Hc(e, t, n, r) {
5840
+ function Ic(e, t, n, r) {
5876
5841
  let i = 0, a = 0;
5877
5842
  for (; a <= e.length - t.length;) {
5878
5843
  let o = e.indexOf(t, a);
@@ -5882,7 +5847,7 @@ function Hc(e, t, n, r) {
5882
5847
  }
5883
5848
  return e;
5884
5849
  }
5885
- var Uc = {
5850
+ var Lc = {
5886
5851
  name: "SUBSTITUTE",
5887
5852
  label: "Substitute",
5888
5853
  category: "text",
@@ -5894,21 +5859,21 @@ var Uc = {
5894
5859
  },
5895
5860
  kind: "cell",
5896
5861
  compute: (e) => {
5897
- let t = e.args ?? [e.value], n = Vc(t[0]);
5862
+ let t = e.args ?? [e.value], n = Fc(t[0]);
5898
5863
  if (n === null) return t[0];
5899
5864
  let r = String(t[1] ?? ""), i = String(t[2] ?? ""), a = t[3] === void 0 ? void 0 : Math.floor(Number(t[3]));
5900
- return a === void 0 ? n.split(r).join(i) : Hc(n, r, i, a);
5865
+ return a === void 0 ? n.split(r).join(i) : Ic(n, r, i, a);
5901
5866
  }
5902
5867
  };
5903
5868
  //#endregion
5904
5869
  //#region src/core/formulas/builtins/index.ts
5905
- function Wc() {
5906
- let e = new vc();
5907
- return e.register(bc), e.register(xc), e.register(Sc), e.register(Cc), e.register(Dc), e.register(Oc), e.register(kc), e.register(Ac), e.register(jc), e.register(Mc), e.register(Nc), e.register(Pc), e.register(Ic), e.register(Rc), e.register(Bc), e.register(Uc), e;
5870
+ function Rc() {
5871
+ let e = new fc();
5872
+ return e.register(mc), e.register(hc), e.register(gc), e.register(_c), e.register(xc), e.register(Sc), e.register(Cc), e.register(wc), e.register(Tc), e.register(Ec), e.register(Dc), e.register(Oc), e.register(Ac), e.register(Mc), e.register(Pc), e.register(Lc), e;
5908
5873
  }
5909
5874
  //#endregion
5910
5875
  //#region src/core/formulas/formulaDeltas.ts
5911
- function Gc(e, t, n, r, i) {
5876
+ function zc(e, t, n, r, i) {
5912
5877
  let a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
5913
5878
  for (let s of i) {
5914
5879
  let i = e.getRowById(s);
@@ -5932,7 +5897,7 @@ function Gc(e, t, n, r, i) {
5932
5897
  newValues: o
5933
5898
  }];
5934
5899
  }
5935
- function Kc(e, t, n, r, i) {
5900
+ function Bc(e, t, n, r, i) {
5936
5901
  let a = n.targetFields(r), o = /* @__PURE__ */ new Map();
5937
5902
  for (let e of a) o.set(e, {
5938
5903
  oldValues: /* @__PURE__ */ new Map(),
@@ -5964,6 +5929,46 @@ function Kc(e, t, n, r, i) {
5964
5929
  return s;
5965
5930
  }
5966
5931
  //#endregion
5932
+ //#region src/core/normalizeColumns.ts
5933
+ var Vc = (e) => e.type === "unique", Hc = (e) => e.type === "asyncFunction";
5934
+ function Uc(e) {
5935
+ return e.map((e) => {
5936
+ let t = e.validators;
5937
+ if (!t?.some((e) => Vc(e) || Hc(e))) return e;
5938
+ let n = t.filter(Vc);
5939
+ n.length > 1 && console.warn(`[updog] column "${e.id}" declares ${n.length} { type: "unique" } validators; using the first, ignoring the rest.`);
5940
+ let r = t.filter(Hc), i = {
5941
+ ...e,
5942
+ validators: t.filter((e) => !Vc(e) && !Hc(e))
5943
+ }, [a] = n;
5944
+ return a && (i.uniqueConfig = {
5945
+ ...a.message !== void 0 && { message: a.message },
5946
+ ...a.fn !== void 0 && { fn: a.fn }
5947
+ }), r.length > 0 && (i.asyncConfig = r), i;
5948
+ });
5949
+ }
5950
+ function Wc(e) {
5951
+ return e.uniqueConfig !== void 0;
5952
+ }
5953
+ function Gc(e) {
5954
+ return e.some((e) => e.asyncConfig !== void 0 || e.uniqueConfig?.fn !== void 0);
5955
+ }
5956
+ function Kc(e) {
5957
+ return e.map((e) => {
5958
+ let { uniqueConfig: t, asyncConfig: n, ...r } = e;
5959
+ if (!t && !n) return e;
5960
+ let i = [...r.validators ?? []];
5961
+ return t && i.push({
5962
+ type: "unique",
5963
+ ...t.message !== void 0 && { message: t.message },
5964
+ ...t.fn !== void 0 && { fn: t.fn }
5965
+ }), n && i.push(...n), {
5966
+ ...r,
5967
+ validators: i
5968
+ };
5969
+ });
5970
+ }
5971
+ //#endregion
5967
5972
  //#region src/core/PendingMutations.ts
5968
5973
  var qc = class {
5969
5974
  inflight = /* @__PURE__ */ new Map();
@@ -7457,7 +7462,7 @@ var pl = (e) => {
7457
7462
  return this._mode === "client";
7458
7463
  }
7459
7464
  rowStore = new Yc();
7460
- formulaRegistry = Wc();
7465
+ formulaRegistry = Rc();
7461
7466
  _isLoading = !0;
7462
7467
  sourceManager = new rl();
7463
7468
  sourceLifecycle;
@@ -7704,7 +7709,7 @@ var pl = (e) => {
7704
7709
  };
7705
7710
  orchestrator = new Us(this.bulkMutationHost, { chunkSize: Zo });
7706
7711
  constructor(e = "client", t, n) {
7707
- if (this._mode = e, this.errorHandler = n ?? new Wo(), this.dirtyTracker = new Gs(), this.validationStore = new gl(), this.history = new ps(), e === "client") this.server = null, this.valueIndex = new yl(), this.filterEngine = new rc(() => {
7712
+ if (this._mode = e, this.errorHandler = n ?? new Wo(), this.dirtyTracker = new Gs(), this.validationStore = new gl(), this.history = new ps(), e === "client") this.server = null, this.valueIndex = new yl(), this.filterEngine = new Zs(() => {
7708
7713
  this.snapshotManager.markFilteredCountsDirty(), this.rowStore.invalidateIndex(), this.notify();
7709
7714
  }), this.filterEngine.setReaders(this.filterRowReader, this.flagReader), this.strategy = new Os(this.filterEngine, this.rowStore, this.snapshotManager, this.dirtyTracker, this.sourceManager, () => this.notify(), this);
7710
7715
  else {
@@ -7720,7 +7725,7 @@ var pl = (e) => {
7720
7725
  applyServerRowMeta: (e, t) => this.applyServerRowMeta(e, t)
7721
7726
  }, t.sourceLabel), this.server.setOnChanged(() => {
7722
7727
  this.snapshotManager.markCountsDirty(), this.notify();
7723
- }), this.valueIndex = new vl(), this.filterEngine = new nc(), this.serverCounts = new Xc(), this.editBuilder = new el({
7728
+ }), this.valueIndex = new vl(), this.filterEngine = new Xs(), this.serverCounts = new Xc(), this.editBuilder = new el({
7724
7729
  getPrimaryKey: () => this._primaryKey ?? "",
7725
7730
  getRowById: (e) => this.rowStore.getRowById(e),
7726
7731
  getColumnIds: () => this._effectiveColumns.map((e) => e.id),
@@ -7842,7 +7847,7 @@ var pl = (e) => {
7842
7847
  if (this._lastColumnsInput === e) return;
7843
7848
  this._lastColumnsInput = e;
7844
7849
  let t = [], n = [];
7845
- for (let r of Js(e)) r.id.startsWith("__dynamic__:") ? n.push(r) : t.push(r);
7850
+ for (let r of Uc(e)) r.id.startsWith("__dynamic__:") ? n.push(r) : t.push(r);
7846
7851
  this._schemaColumns = t, this._dynamicColumns = n, this.syncPreLockedColumns(t), this.rebuildEffectiveColumns();
7847
7852
  }
7848
7853
  getDynamicColumns() {
@@ -7850,10 +7855,10 @@ var pl = (e) => {
7850
7855
  }
7851
7856
  getEffectiveColumns = () => this._effectiveColumns;
7852
7857
  setDynamicColumns(e) {
7853
- this._dynamicColumns = Js(e(this._dynamicColumns)), this.rebuildEffectiveColumns();
7858
+ this._dynamicColumns = Uc(e(this._dynamicColumns)), this.rebuildEffectiveColumns();
7854
7859
  }
7855
7860
  addDynamicColumns(e) {
7856
- this._dynamicColumns = [...this._dynamicColumns, ...Js(e)], this.rebuildEffectiveColumns();
7861
+ this._dynamicColumns = [...this._dynamicColumns, ...Uc(e)], this.rebuildEffectiveColumns();
7857
7862
  }
7858
7863
  addColumnOptions(e, t) {
7859
7864
  let n = [...this._addedOptions.get(e) ?? []];
@@ -8563,7 +8568,7 @@ var pl = (e) => {
8563
8568
  };
8564
8569
  recordLearnedSynonyms(e) {
8565
8570
  for (let t of ["columns", "values"]) for (let n of e[t]) {
8566
- let e = `${n.source} ${n.target}`;
8571
+ let e = `${n.source}\u0000${n.target}`;
8567
8572
  this.learnedSynonymKeys[t].has(e) || (this.learnedSynonymKeys[t].add(e), this.learnedSynonyms[t].push(n));
8568
8573
  }
8569
8574
  }
@@ -8610,7 +8615,10 @@ var pl = (e) => {
8610
8615
  return {
8611
8616
  sources: Array.from(e.values()),
8612
8617
  counts: t,
8613
- learnedSynonyms: this.learnedSynonyms
8618
+ learnedSynonyms: {
8619
+ columns: [...this.learnedSynonyms.columns],
8620
+ values: [...this.learnedSynonyms.values]
8621
+ }
8614
8622
  };
8615
8623
  }
8616
8624
  isRowVisible(e) {
@@ -8652,7 +8660,7 @@ var pl = (e) => {
8652
8660
  let a = [];
8653
8661
  for (let o = 0; o < n.length; o++) {
8654
8662
  let s = i.filter((e) => r[o].has(e));
8655
- for (let r of n[o].fields) a.push(...Gc(this.rowStore, r, e, t, s));
8663
+ for (let r of n[o].fields) a.push(...zc(this.rowStore, r, e, t, s));
8656
8664
  }
8657
8665
  return cl(a);
8658
8666
  },
@@ -8666,7 +8674,7 @@ var pl = (e) => {
8666
8674
  code: "transforming",
8667
8675
  allRowIds: a,
8668
8676
  fields: e.targetFields(t),
8669
- computeForRows: (r) => Kc(this.rowStore, n, e, t, r),
8677
+ computeForRows: (r) => Bc(this.rowStore, n, e, t, r),
8670
8678
  buildCommand: f,
8671
8679
  onServerSync: c ? (e) => this.syncFormulaToServer([{
8672
8680
  fields: [n],
@@ -8698,14 +8706,14 @@ var pl = (e) => {
8698
8706
  let a = [];
8699
8707
  for (let o = 0; o < r.length; o++) {
8700
8708
  let s = i.filter((e) => t[o].has(e));
8701
- for (let t of r[o].fields) a.push(...Gc(this.rowStore, t, e, n, s));
8709
+ for (let t of r[o].fields) a.push(...zc(this.rowStore, t, e, n, s));
8702
8710
  }
8703
8711
  return cl(a);
8704
8712
  };
8705
8713
  } else {
8706
8714
  let t = a[0];
8707
8715
  if (!t) return null;
8708
- l = this.filterLockedFields(e.targetFields(n)), c = (r) => Kc(this.rowStore, t, e, n, r);
8716
+ l = this.filterLockedFields(e.targetFields(n)), c = (r) => Bc(this.rowStore, t, e, n, r);
8709
8717
  }
8710
8718
  if (l.length === 0) return null;
8711
8719
  let u = c(o);
@@ -8788,7 +8796,7 @@ var pl = (e) => {
8788
8796
  transformWorker = null;
8789
8797
  initTransformWorker() {
8790
8798
  if (!(typeof Worker > "u")) try {
8791
- this.transformWorker = $s("chatTransform");
8799
+ this.transformWorker = qs("chatTransform");
8792
8800
  } catch (e) {
8793
8801
  this.errorHandler.handleError({
8794
8802
  code: "WORKER_ERROR",
@@ -9371,7 +9379,7 @@ var pl = (e) => {
9371
9379
  }
9372
9380
  t.push(n);
9373
9381
  }
9374
- o.size > 0 && (u = dc(t, [...o.values()])), s.size > 0 && (d = gc(t, [...s.values()]), f = mc(bl));
9382
+ o.size > 0 && (u = ac(t, [...o.values()])), s.size > 0 && (d = uc(t, [...s.values()]), f = cc(bl));
9375
9383
  }
9376
9384
  let p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
9377
9385
  for (let e = 0; e < a.length; e++) {
@@ -9382,8 +9390,8 @@ var pl = (e) => {
9382
9390
  let l = this._effectiveColumns[r + n];
9383
9391
  if (!l) continue;
9384
9392
  let h = i[l.id], g = a[e][n], _ = g;
9385
- if (u !== null && o.has(n)) _ = fc(g, u);
9386
- else if (d !== null && f !== null && s.has(n)) _ = _c(g, d, f) ?? g;
9393
+ if (u !== null && o.has(n)) _ = oc(g, u);
9394
+ else if (d !== null && f !== null && s.has(n)) _ = dc(g, d, f) ?? g;
9387
9395
  else {
9388
9396
  let e = c.get(n);
9389
9397
  if (e && g !== "" && !e.has(g)) continue;
@@ -10877,7 +10885,7 @@ function lu(e, t, n, r) {
10877
10885
  e.setValidator(o);
10878
10886
  }, [e, o]);
10879
10887
  let c = i("dataEditor.validation.alreadyExists"), l = v(() => {
10880
- let n = Xs(t);
10888
+ let n = Gc(t);
10881
10889
  return e.isServer() || !n ? (e.isServer() && n && console.warn("[updog] unique.fn and { type: \"asyncFunction\" } validators are client-mode only and were ignored in server mode"), new Bl()) : new Vl({
10882
10890
  columns: t,
10883
10891
  getRowById: (t) => e.getRowById(t),
@@ -11117,7 +11125,7 @@ var xu = class extends Error {
11117
11125
  sheetWorkerPromise = null;
11118
11126
  generation = 0;
11119
11127
  pending = /* @__PURE__ */ new Map();
11120
- constructor(e = $s, t = ec) {
11128
+ constructor(e = qs, t = Js) {
11121
11129
  this.spawn = e, this.spawnSheet = t;
11122
11130
  }
11123
11131
  async parse(e, t) {
@@ -21681,7 +21689,7 @@ function fy(e, t, n, r, i) {
21681
21689
  //#region src/components/Chat/context/useViewModel.tsx
21682
21690
  var py = 20, my = 3, hy = 300;
21683
21691
  function gy() {
21684
- let { chat: e, store: t, columns: n, primaryKey: r, enableDeleteRow: i } = Z(), a = v(() => Zs(n), [n]), o = y(0), [s, c] = b([]), [l, u] = b("idle"), [d, p] = b(null), h = e?.emptyTitle, g = e?.suggestionsCount ?? my, [_, x] = b(e?.loadSuggestions ? "loading" : "empty"), [S, C] = b([]), w = y(null), T = f((e) => {
21692
+ let { chat: e, store: t, columns: n, primaryKey: r, enableDeleteRow: i } = Z(), a = v(() => Kc(n), [n]), o = y(0), [s, c] = b([]), [l, u] = b("idle"), [d, p] = b(null), h = e?.emptyTitle, g = e?.suggestionsCount ?? my, [_, x] = b(e?.loadSuggestions ? "loading" : "empty"), [S, C] = b([]), w = y(null), T = f((e) => {
21685
21693
  w.current = e;
21686
21694
  }, []), E = f((e) => {
21687
21695
  w.current?.(e);
@@ -22083,7 +22091,7 @@ function Zy(e) {
22083
22091
  let { store: t, setShowUploader: n } = Z(), { t: r } = q();
22084
22092
  return f(async () => {
22085
22093
  let i = await e.import({
22086
- monthTable: mc(r),
22094
+ monthTable: cc(r),
22087
22095
  structuralMismatchMessage: r("dataEditor.validation.structuralMismatch")
22088
22096
  });
22089
22097
  if (i.kind === "failed") {
@@ -22799,8 +22807,20 @@ var tb = ({ leftSlot: e }) => {
22799
22807
  critical: ["crit", "urgent"],
22800
22808
  yes: ["y", "true"],
22801
22809
  no: ["n", "false"]
22802
- }, rb = (e, t) => {
22803
- if (!t) return e;
22810
+ }, rb = {
22811
+ columns: {},
22812
+ values: {}
22813
+ }, ib = /* @__PURE__ */ new WeakMap(), ab = (e) => {
22814
+ if (!e) return rb;
22815
+ let t = ib.get(e);
22816
+ if (t) return t;
22817
+ let n = {
22818
+ columns: e.columns ?? {},
22819
+ values: e.values ?? {}
22820
+ };
22821
+ return ib.set(e, n), n;
22822
+ }, ob = (e, t) => {
22823
+ if (!t || Object.keys(t).length === 0) return e;
22804
22824
  let n = { ...e };
22805
22825
  for (let [e, r] of Object.entries(t)) if (e in n) {
22806
22826
  let t = new Set(n[e]);
@@ -22808,13 +22828,13 @@ var tb = ({ leftSlot: e }) => {
22808
22828
  n[e] = [...t];
22809
22829
  } else n[e] = r;
22810
22830
  return n;
22811
- }, ib = 60, ab = (e) => e.toLowerCase().replace(/[\s_\-.]+/g, "").trim(), ob = (e) => e.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[\s_\-.]+/g, " ").toLowerCase().split(" ").filter(Boolean), sb = (e, t) => {
22812
- let n = new Set(ob(e)), r = new Set(ob(t));
22831
+ }, sb = 60, cb = (e) => e.toLowerCase().replace(/[\s_\-.]+/g, "").trim(), lb = (e) => e.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[\s_\-.]+/g, " ").toLowerCase().split(" ").filter(Boolean), ub = (e, t) => {
22832
+ let n = new Set(lb(e)), r = new Set(lb(t));
22813
22833
  if (n.size === 0 || r.size === 0) return 0;
22814
22834
  let i = 0;
22815
22835
  for (let e of n) r.has(e) && i++;
22816
22836
  return i / Math.max(n.size, r.size);
22817
- }, cb = (e, t) => {
22837
+ }, db = (e, t) => {
22818
22838
  if (e.length === 0) return t.length;
22819
22839
  if (t.length === 0) return e.length;
22820
22840
  e.length > t.length && ([e, t] = [t, e]);
@@ -22829,119 +22849,119 @@ var tb = ({ leftSlot: e }) => {
22829
22849
  }
22830
22850
  }
22831
22851
  return i[n];
22832
- }, lb = (e) => e <= 4 ? 1 : e <= 8 ? 2 : e <= 15 ? 3 : 4, ub = (e, t) => {
22852
+ }, fb = (e) => e <= 4 ? 1 : e <= 8 ? 2 : e <= 15 ? 3 : 4, pb = (e, t) => {
22833
22853
  let n = Math.max(e.length, t.length);
22834
22854
  if (n === 0) return !0;
22835
- let r = lb(n);
22836
- return Math.abs(e.length - t.length) > r ? !1 : cb(e, t) <= r;
22837
- }, db = (e, t) => {
22838
- let n = ab(e), r = ab(t);
22855
+ let r = fb(n);
22856
+ return Math.abs(e.length - t.length) > r ? !1 : db(e, t) <= r;
22857
+ }, mb = (e, t) => {
22858
+ let n = cb(e), r = cb(t);
22839
22859
  return (n.length <= r.length ? n : r).length < 4 ? !1 : n.includes(r) || r.includes(n);
22840
- }, fb = /* @__PURE__ */ new WeakMap(), pb = (e) => {
22841
- let t = fb.get(e);
22860
+ }, hb = /* @__PURE__ */ new WeakMap(), gb = (e) => {
22861
+ let t = hb.get(e);
22842
22862
  if (t) return t;
22843
22863
  let n = /* @__PURE__ */ new Map(), r = 0;
22844
22864
  for (let [t, i] of Object.entries(e)) {
22845
22865
  for (let e of [t, ...i]) {
22846
- let t = ab(e), i = n.get(t);
22866
+ let t = cb(e), i = n.get(t);
22847
22867
  i ? i.includes(r) || i.push(r) : n.set(t, [r]);
22848
22868
  }
22849
22869
  r++;
22850
22870
  }
22851
- return fb.set(e, n), n;
22852
- }, mb = (e, t, n) => {
22853
- let r = pb(n), i = r.get(ab(e));
22871
+ return hb.set(e, n), n;
22872
+ }, _b = (e, t, n) => {
22873
+ let r = gb(n), i = r.get(cb(e));
22854
22874
  if (!i) return !1;
22855
- let a = r.get(ab(t));
22875
+ let a = r.get(cb(t));
22856
22876
  if (!a) return !1;
22857
22877
  for (let e of i) if (a.includes(e)) return !0;
22858
22878
  return !1;
22859
- }, hb = (e, t, n) => {
22860
- let r = ab(e), i = ab(t);
22879
+ }, vb = (e, t, n) => {
22880
+ let r = cb(e), i = cb(t);
22861
22881
  if (r === i) return 100;
22862
- if (n && mb(e, t, n)) return 90;
22863
- if (db(e, t)) return 80;
22864
- let a = sb(e, t);
22865
- return a >= .5 ? 70 : ub(r, i) ? 65 : a > 0 ? Math.round(a * 60) : 0;
22866
- }, gb = (e, t, n, r) => {
22867
- let i = hb(e, t, r), a = hb(e, n, r);
22882
+ if (n && _b(e, t, n)) return 90;
22883
+ if (mb(e, t)) return 80;
22884
+ let a = ub(e, t);
22885
+ return a >= .5 ? 70 : pb(r, i) ? 65 : a > 0 ? Math.round(a * 60) : 0;
22886
+ }, yb = (e, t, n, r) => {
22887
+ let i = vb(e, t, r), a = vb(e, n, r);
22868
22888
  return Math.max(i, a);
22869
- }, _b = /* @__PURE__ */ new WeakMap(), vb = (e) => {
22870
- let t = _b.get(e);
22889
+ }, bb = /* @__PURE__ */ new WeakMap(), xb = (e) => {
22890
+ let t = bb.get(e);
22871
22891
  if (t) return t;
22872
22892
  let n = e.map((e) => ({
22873
22893
  raw: e,
22874
- norm: ab(e),
22875
- words: new Set(ob(e))
22894
+ norm: cb(e),
22895
+ words: new Set(lb(e))
22876
22896
  }));
22877
- return _b.set(e, n), n;
22878
- }, yb = (e, t) => (e.length <= t.length ? e : t).length < 4 ? !1 : e.includes(t) || t.includes(e), bb = (e, t) => {
22897
+ return bb.set(e, n), n;
22898
+ }, Sb = (e, t) => (e.length <= t.length ? e : t).length < 4 ? !1 : e.includes(t) || t.includes(e), Cb = (e, t) => {
22879
22899
  if (e.size === 0 || t.size === 0) return 0;
22880
22900
  let n = 0;
22881
22901
  for (let r of e) t.has(r) && n++;
22882
22902
  return n / Math.max(e.size, t.size);
22883
- }, xb = (e, t) => {
22903
+ }, wb = (e, t) => {
22884
22904
  if (!t) return !1;
22885
22905
  for (let n of e) if (t.includes(n)) return !0;
22886
22906
  return !1;
22887
- }, Sb = (e, t, n = nb, r = ib) => {
22888
- let i = vb(t), a = pb(n), o = ab(e), s = a.get(o), c = null, l, u = 0;
22907
+ }, Tb = (e, t, n = nb, r = sb) => {
22908
+ let i = xb(t), a = gb(n), o = cb(e), s = a.get(o), c = null, l, u = 0;
22889
22909
  for (let t of i) {
22890
22910
  let n = 0;
22891
22911
  if (o === t.norm) n = 100;
22892
- else if (s && xb(s, a.get(t.norm))) n = 90;
22893
- else if (yb(o, t.norm)) n = 80;
22912
+ else if (s && wb(s, a.get(t.norm))) n = 90;
22913
+ else if (Sb(o, t.norm)) n = 80;
22894
22914
  else {
22895
- c ??= new Set(ob(e));
22896
- let r = bb(c, t.words);
22897
- r >= .5 ? n = 70 : ub(o, t.norm) ? n = 65 : r > 0 && (n = Math.round(r * 60));
22915
+ c ??= new Set(lb(e));
22916
+ let r = Cb(c, t.words);
22917
+ r >= .5 ? n = 70 : pb(o, t.norm) ? n = 65 : r > 0 && (n = Math.round(r * 60));
22898
22918
  }
22899
22919
  if (n > u && (u = n, l = t.raw, n === 100)) break;
22900
22920
  }
22901
22921
  return u >= r ? l : void 0;
22902
- }, Cb = (e, t) => {
22903
- let n = rb(nb, t), r = {};
22922
+ }, Eb = (e, t) => {
22923
+ let n = ob(nb, t), r = {};
22904
22924
  for (let [t, { importedValues: i, options: a }] of Object.entries(e)) {
22905
22925
  let e = {};
22906
- for (let t of i) e[t] = Sb(t, a, n);
22926
+ for (let t of i) e[t] = Tb(t, a, n);
22907
22927
  r[t] = e;
22908
22928
  }
22909
22929
  return r;
22910
- }, wb = (e, t, n) => {
22911
- let r = rb(nb, n), i = {};
22930
+ }, Db = (e, t, n) => {
22931
+ let r = ob(nb, n), i = {};
22912
22932
  for (let [n, { importedValues: a, options: o }] of Object.entries(e)) {
22913
22933
  let e = t[n], s = {};
22914
- for (let t of a) e && t in e ? s[t] = e[t] ?? void 0 : s[t] = Sb(t, o, r);
22934
+ for (let t of a) e && t in e ? s[t] = e[t] ?? void 0 : s[t] = Tb(t, o, r);
22915
22935
  i[n] = s;
22916
22936
  }
22917
22937
  return i;
22918
- }, Tb = "action:create", Eb = (e, t, n) => gb(e, t.id, t.title, n), Db = (e, t, n, r, i = 60) => {
22938
+ }, Ob = "action:create", kb = (e, t, n) => yb(e, t.id, t.title, n), Ab = (e, t, n, r, i = 60) => {
22919
22939
  let a = null, o = 0;
22920
22940
  for (let i of t) {
22921
22941
  if (n.has(i.id)) continue;
22922
- let t = Eb(e, i, r);
22942
+ let t = kb(e, i, r);
22923
22943
  t > o && (o = t, a = i);
22924
22944
  }
22925
22945
  if (a && o >= i) return a.id;
22926
- }, Ob = async (e, t, n, r) => {
22946
+ }, jb = async (e, t, n, r) => {
22927
22947
  let i = new Set(t.map((e) => e.id)), a = {}, o = /* @__PURE__ */ new Set();
22928
22948
  if (n) {
22929
22949
  let r = await n(e, t);
22930
22950
  for (let [e, t] of Object.entries(r)) t !== null && i.has(t) && !o.has(t) && (a[e] = t, o.add(t));
22931
22951
  }
22932
- let s = kb(e.filter((e) => !(e in a)), t.filter((e) => !o.has(e.id)), r);
22952
+ let s = Mb(e.filter((e) => !(e in a)), t.filter((e) => !o.has(e.id)), r);
22933
22953
  return {
22934
22954
  ...a,
22935
22955
  ...s
22936
22956
  };
22937
- }, kb = (e, t, n) => {
22938
- let r = rb(nb, n), i = {}, a = /* @__PURE__ */ new Set();
22957
+ }, Mb = (e, t, n) => {
22958
+ let r = ob(nb, n), i = {}, a = /* @__PURE__ */ new Set();
22939
22959
  for (let n of e) {
22940
- let e = ab(n);
22960
+ let e = cb(n);
22941
22961
  for (let r of t) {
22942
22962
  let t = r.id;
22943
22963
  if (a.has(t)) continue;
22944
- let o = ab(t), s = ab(r.title);
22964
+ let o = cb(t), s = cb(r.title);
22945
22965
  if (e === o || e === s) {
22946
22966
  i[n] = t, a.add(t);
22947
22967
  break;
@@ -22952,7 +22972,7 @@ var tb = ({ leftSlot: e }) => {
22952
22972
  let n = 0;
22953
22973
  for (let i of t) {
22954
22974
  if (a.has(i.id)) continue;
22955
- let t = Eb(e, i, r);
22975
+ let t = kb(e, i, r);
22956
22976
  t > n && (n = t);
22957
22977
  }
22958
22978
  return n;
@@ -22961,34 +22981,34 @@ var tb = ({ leftSlot: e }) => {
22961
22981
  score: o(e)
22962
22982
  })).sort((e, t) => t.score - e.score);
22963
22983
  for (let { header: e } of s) {
22964
- let n = Db(e, t, a, r);
22984
+ let n = Ab(e, t, a, r);
22965
22985
  i[e] = n, n && a.add(n);
22966
22986
  }
22967
22987
  return i;
22968
- }, Ab = .5, jb = new Set([
22988
+ }, Nb = .5, Pb = new Set([
22969
22989
  "true",
22970
22990
  "false",
22971
22991
  "yes",
22972
22992
  "no"
22973
- ]), Mb = /^\d{1,4}[-/.]\d{1,2}[-/.]\d{1,4}$/, Nb = /^[-+]?(\d{1,3}([ ,.]\d{3})+|\d+)([.,]\d+)?%?$/, Pb = new Set([
22993
+ ]), Fb = /^\d{1,4}[-/.]\d{1,2}[-/.]\d{1,4}$/, Ib = /^[-+]?(\d{1,3}([ ,.]\d{3})+|\d+)([.,]\d+)?%?$/, Lb = new Set([
22974
22994
  "number",
22975
22995
  "date",
22976
22996
  "bool"
22977
22997
  ]);
22978
- function Fb(e) {
22998
+ function Rb(e) {
22979
22999
  if (e == null) return "empty";
22980
23000
  let t = String(e).trim();
22981
- return t.length === 0 ? "empty" : jb.has(t.toLowerCase()) ? "bool" : Mb.test(t) ? "date" : Nb.test(t) ? "number" : "text";
23001
+ return t.length === 0 ? "empty" : Pb.has(t.toLowerCase()) ? "bool" : Fb.test(t) ? "date" : Ib.test(t) ? "number" : "text";
22982
23002
  }
22983
- function Ib(e) {
23003
+ function zb(e) {
22984
23004
  return e.filter((e) => e != null && String(e).trim().length > 0).length;
22985
23005
  }
22986
- function Lb(e) {
23006
+ function Bb(e) {
22987
23007
  let t = 0;
22988
23008
  for (let n of e) t = Math.max(t, n.length);
22989
23009
  return t;
22990
23010
  }
22991
- function Rb(e) {
23011
+ function Vb(e) {
22992
23012
  let t = /* @__PURE__ */ new Map(), n = 0, r = 0;
22993
23013
  for (let i of e) {
22994
23014
  let e = i.length;
@@ -22998,55 +23018,55 @@ function Rb(e) {
22998
23018
  }
22999
23019
  return r;
23000
23020
  }
23001
- function zb(e, t, n) {
23021
+ function Hb(e, t, n) {
23002
23022
  if (t <= 0) return 0;
23003
- for (let r = 0; r < e.length; r++) if (Ib(e[r]) / t >= n) return r;
23023
+ for (let r = 0; r < e.length; r++) if (zb(e[r]) / t >= n) return r;
23004
23024
  return 0;
23005
23025
  }
23006
- function Bb(e, t, n, r) {
23026
+ function Ub(e, t, n, r) {
23007
23027
  let i = /* @__PURE__ */ new Map();
23008
23028
  for (let a = t; a < n; a++) {
23009
- let t = Fb(e[a]?.[r]);
23029
+ let t = Rb(e[a]?.[r]);
23010
23030
  t !== "empty" && i.set(t, (i.get(t) ?? 0) + 1);
23011
23031
  }
23012
23032
  let a = "empty", o = 0;
23013
23033
  for (let [e, t] of i) t > o && (o = t, a = e);
23014
23034
  return a;
23015
23035
  }
23016
- function Vb(e, t, n, r) {
23036
+ function Wb(e, t, n, r) {
23017
23037
  let i = 0, a = 0;
23018
23038
  for (let o = 0; o < r; o++) {
23019
- let r = Bb(e, t + 1, n, o);
23020
- r !== "empty" && (a++, Fb(e[t]?.[o]) === "text" && Pb.has(r) && i++);
23039
+ let r = Ub(e, t + 1, n, o);
23040
+ r !== "empty" && (a++, Rb(e[t]?.[o]) === "text" && Lb.has(r) && i++);
23021
23041
  }
23022
23042
  return a === 0 ? 0 : i / a;
23023
23043
  }
23024
- function Hb(e, t, n, r) {
23044
+ function Gb(e, t, n, r) {
23025
23045
  let i = 0, a = 0;
23026
23046
  for (let o = 0; o < r; o++) {
23027
- let r = Bb(e, t, n, o);
23047
+ let r = Ub(e, t, n, o);
23028
23048
  if (r !== "empty") for (let s = t; s < n; s++) {
23029
- let t = Fb(e[s]?.[o]);
23049
+ let t = Rb(e[s]?.[o]);
23030
23050
  t !== "empty" && (a++, t === r && i++);
23031
23051
  }
23032
23052
  }
23033
23053
  return a === 0 ? 0 : i / a;
23034
23054
  }
23035
- function Ub(e) {
23036
- let t = e.map(Fb).filter((e) => e !== "empty");
23055
+ function Kb(e) {
23056
+ let t = e.map(Rb).filter((e) => e !== "empty");
23037
23057
  return t.length === 0 ? 0 : 1 - t.filter((e) => e !== "text").length / t.length;
23038
23058
  }
23039
- function Wb(e, t) {
23040
- return t <= 0 ? 0 : Math.min(1, Ib(e) / t);
23059
+ function qb(e, t) {
23060
+ return t <= 0 ? 0 : Math.min(1, zb(e) / t);
23041
23061
  }
23042
- function Gb(e) {
23062
+ function Jb(e) {
23043
23063
  let t = e.map((e) => String(e ?? "").trim().toLowerCase()).filter((e) => e.length > 0);
23044
23064
  return t.length === 0 ? 0 : new Set(t).size / t.length;
23045
23065
  }
23046
- function Kb(e, t, n, r, i) {
23047
- return .45 * Vb(e, t, n, r) + .25 * Hb(e, t + 1, n, r) + .15 * Ub(e[t] ?? []) + .1 * Wb(e[t] ?? [], i) + .05 * Gb(e[t] ?? []);
23066
+ function Yb(e, t, n, r, i) {
23067
+ return .45 * Wb(e, t, n, r) + .25 * Gb(e, t + 1, n, r) + .15 * Kb(e[t] ?? []) + .1 * qb(e[t] ?? [], i) + .05 * Jb(e[t] ?? []);
23048
23068
  }
23049
- function qb(e, t = 100) {
23069
+ function Xb(e, t = 100) {
23050
23070
  if (e.length === 0) return {
23051
23071
  headerRowIndex: 0,
23052
23072
  dataStartIndex: 0,
@@ -23054,7 +23074,7 @@ function qb(e, t = 100) {
23054
23074
  mode: "header",
23055
23075
  review: { kind: "none" }
23056
23076
  };
23057
- let n = Math.min(t, e.length), r = e.slice(0, n), i = Lb(r), a = Rb(r), o = zb(r, a, Ab), s = e[o] ?? [], c = Vb(e, o, n, i), l = Hb(e, o + 1, n, i), u = Ib(s) > 0 && Ub(s) === 0, d = Math.round(Math.max(0, Kb(e, o, n, i, a)) * 100) / 100;
23077
+ let n = Math.min(t, e.length), r = e.slice(0, n), i = Bb(r), a = Vb(r), o = Hb(r, a, Nb), s = e[o] ?? [], c = Wb(e, o, n, i), l = Gb(e, o + 1, n, i), u = zb(s) > 0 && Kb(s) === 0, d = Math.round(Math.max(0, Yb(e, o, n, i, a)) * 100) / 100;
23058
23078
  if (u && c <= .15 && l >= .7) return {
23059
23079
  headerRowIndex: -1,
23060
23080
  dataStartIndex: o,
@@ -23074,7 +23094,7 @@ function qb(e, t = 100) {
23074
23094
  review: f
23075
23095
  };
23076
23096
  }
23077
- function Jb(e) {
23097
+ function Zb(e) {
23078
23098
  let t = /* @__PURE__ */ new Set();
23079
23099
  return e.map((e) => {
23080
23100
  let n = e, r = 2;
@@ -23084,15 +23104,15 @@ function Jb(e) {
23084
23104
  }
23085
23105
  //#endregion
23086
23106
  //#region src/components/DataUploader/core/parser/headerProjection.ts
23087
- var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t) => {
23107
+ var Qb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), $b = (e, t) => {
23088
23108
  let n = 0;
23089
23109
  for (let r = t; r < e.length; r++) n = Math.max(n, e[r].length);
23090
23110
  return n;
23091
- }, Zb = 50, Qb = (e, t, n) => {
23092
- let r = Math.min(e.length, t + Zb);
23111
+ }, ex = 50, tx = (e, t, n) => {
23112
+ let r = Math.min(e.length, t + ex);
23093
23113
  for (let i = t; i < r; i++) {
23094
23114
  let t = e[i];
23095
- if (!t || Yb(t)) continue;
23115
+ if (!t || Qb(t)) continue;
23096
23116
  let r = !0;
23097
23117
  for (let e = 0; e < n; e++) {
23098
23118
  let n = t[e];
@@ -23106,104 +23126,104 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
23106
23126
  return Array.from({ length: n }, (n, i) => {
23107
23127
  for (let n = t; n < r; n++) {
23108
23128
  let t = e[n];
23109
- if (!t || Yb(t)) continue;
23129
+ if (!t || Qb(t)) continue;
23110
23130
  let r = t[i], a = r == null ? "" : String(r).trim();
23111
23131
  if (a !== "") return a;
23112
23132
  }
23113
23133
  return "";
23114
23134
  });
23115
- }, $b = (e, t) => t === e.headerRowIndex ? e.dataStartIndex : t + 1, ex = (e, t, n, r) => {
23135
+ }, nx = (e, t) => t === e.headerRowIndex ? e.dataStartIndex : t + 1, rx = (e, t, n, r) => {
23116
23136
  if (t < 0) {
23117
- let t = Xb(e, n), i = Qb(e, n, t);
23137
+ let t = $b(e, n), i = tx(e, n, t);
23118
23138
  return Array.from({ length: t }, (e, t) => r(t, i[t]));
23119
23139
  }
23120
- let i = e[t] ?? [], a = Math.max(i.length, Xb(e, n)), o = Qb(e, n, a);
23121
- return Jb(Array.from({ length: a }, (e, t) => {
23140
+ let i = e[t] ?? [], a = Math.max(i.length, $b(e, n)), o = tx(e, n, a);
23141
+ return Zb(Array.from({ length: a }, (e, t) => {
23122
23142
  let n = String(i[t] ?? "").trim();
23123
23143
  return n === "" ? r(t, o[t]) : n;
23124
23144
  }));
23125
- }, tx = () => ({
23145
+ }, ix = () => ({
23126
23146
  headerRowIndex: 0,
23127
23147
  dataStartIndex: 1,
23128
23148
  confidence: 1,
23129
23149
  mode: "header",
23130
23150
  review: { kind: "none" }
23131
- }), nx = (e, t) => {
23151
+ }), ax = (e, t) => {
23132
23152
  let n = [e];
23133
23153
  for (let r of t) n.push(e.map((e) => r[e] ?? ""));
23134
23154
  return n;
23135
- }, rx = (e) => {
23155
+ }, ox = (e) => {
23136
23156
  let t = /* @__PURE__ */ new Map();
23137
23157
  for (let n = 0; n < e.length; n++) t.set(e[n], n);
23138
23158
  return t;
23139
- }, ix = (e, t, n) => {
23159
+ }, sx = (e, t, n) => {
23140
23160
  let r = [];
23141
23161
  for (let i = t; i < e.length; i++) {
23142
23162
  let t = e[i];
23143
- if (Yb(t)) continue;
23163
+ if (Qb(t)) continue;
23144
23164
  let a = t[n], o = a == null ? "" : String(a);
23145
23165
  o !== "" && r.push(o);
23146
23166
  }
23147
23167
  return r;
23148
- }, ax = (e, t, n) => {
23168
+ }, cx = (e, t, n) => {
23149
23169
  let r = /* @__PURE__ */ new Set();
23150
23170
  for (let i = t; i < e.length; i++) {
23151
23171
  let t = e[i];
23152
- if (Yb(t)) continue;
23172
+ if (Qb(t)) continue;
23153
23173
  let a = t[n], o = a == null ? "" : String(a);
23154
23174
  o !== "" && r.add(o);
23155
23175
  }
23156
23176
  return [...r];
23157
- }, ox = (e, t) => {
23177
+ }, lx = (e, t) => {
23158
23178
  let n = {};
23159
23179
  for (let r = 0; r < t.length; r++) n[t[r]] = String(e[r] ?? "");
23160
23180
  return n;
23161
- }, sx = (e, t, n, r) => {
23181
+ }, ux = (e, t, n, r) => {
23162
23182
  let i = [];
23163
23183
  for (let a = n; a < e.length && i.length < r; a++) {
23164
23184
  let n = e[a];
23165
- !n || Yb(n) || i.push(ox(n, t));
23185
+ !n || Qb(n) || i.push(lx(n, t));
23166
23186
  }
23167
23187
  return i;
23168
- }, cx = 3e4, lx = (e, t) => new Promise((n, r) => {
23188
+ }, dx = 3e4, fx = (e, t) => new Promise((n, r) => {
23169
23189
  let i = setTimeout(() => r(/* @__PURE__ */ Error(`Hook timed out after ${t}ms`)), t);
23170
23190
  e.then((e) => {
23171
23191
  clearTimeout(i), n(e);
23172
23192
  }, (e) => {
23173
23193
  clearTimeout(i), r(e);
23174
23194
  });
23175
- }), ux = (e, t, n) => {
23195
+ }), px = (e, t, n) => {
23176
23196
  let r = {
23177
23197
  ...e,
23178
23198
  [t]: n
23179
23199
  };
23180
23200
  if (n) for (let e in r) e !== t && r[e] === n && (r[e] = void 0);
23181
23201
  return r;
23182
- }, dx = (e, t, n, r) => {
23202
+ }, mx = (e, t, n, r) => {
23183
23203
  let i = e[t];
23184
23204
  return i ? {
23185
23205
  ...e,
23186
- [t]: ux(i, n, r)
23206
+ [t]: px(i, n, r)
23187
23207
  } : e;
23188
- }, fx = (e, t, n, r) => {
23208
+ }, hx = (e, t, n, r) => {
23189
23209
  let i = e;
23190
23210
  for (let e of r) {
23191
23211
  let r = i[e];
23192
- !r || !(t in r) || (i = dx(i, e, t, n));
23212
+ !r || !(t in r) || (i = mx(i, e, t, n));
23193
23213
  }
23194
23214
  return i;
23195
- }, px = (e, t, n) => {
23215
+ }, gx = (e, t, n) => {
23196
23216
  let r = {};
23197
23217
  for (let i of n) {
23198
23218
  let n = e[i], a = t[i];
23199
23219
  if (!(!n || !a)) for (let e in n) e in r || n[e] === a[e] || (r[e] = n[e]);
23200
23220
  }
23201
23221
  return r;
23202
- }, mx = (e, t) => {
23222
+ }, _x = (e, t) => {
23203
23223
  let n = e;
23204
- for (let r in t) r in e && (n = ux(n, r, t[r]));
23224
+ for (let r in t) r in e && (n = px(n, r, t[r]));
23205
23225
  return n;
23206
- }, hx = (e, t) => {
23226
+ }, vx = (e, t) => {
23207
23227
  let n = /* @__PURE__ */ new Set(), r = [];
23208
23228
  for (let i of t) {
23209
23229
  let t = e[i];
@@ -23213,7 +23233,7 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
23213
23233
  }
23214
23234
  }
23215
23235
  return r;
23216
- }, gx = (e, t) => {
23236
+ }, yx = (e, t) => {
23217
23237
  let n = {};
23218
23238
  for (let r of t) {
23219
23239
  let t = e[r];
@@ -23226,19 +23246,20 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
23226
23246
  }
23227
23247
  }
23228
23248
  return n;
23229
- }, _x = "\0", vx = "", yx = (e) => e.map((e) => `${e.workbookId}${_x}${e.header}`).join(vx), bx = {
23249
+ }, bx = "\0", xx = "", Sx = (e) => e.map((e) => `${e.workbookId}${bx}${e.header}`).join(xx), Cx = {
23230
23250
  byWorkbook: {},
23231
23251
  mappedColumnIds: [],
23232
23252
  headersByColumn: {},
23233
23253
  pendingColumns: [],
23234
23254
  autoMatched: {},
23255
+ baseline: {},
23235
23256
  isMatching: {}
23236
- }, xx = (e, t) => e.length === t.length && e.every((e, n) => e === t[n]), Sx = class {
23257
+ }, wx = (e, t) => e.length === t.length && e.every((e, n) => e === t[n]), Tx = class {
23237
23258
  deps;
23238
23259
  notify;
23239
23260
  workbookIds = [];
23240
23261
  seqByWorkbook = /* @__PURE__ */ new Map();
23241
- _state = bx;
23262
+ _state = Cx;
23242
23263
  constructor(e, t) {
23243
23264
  this.deps = e, this.notify = t;
23244
23265
  }
@@ -23246,7 +23267,7 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
23246
23267
  return this._state;
23247
23268
  }
23248
23269
  withProjections(e, t) {
23249
- let n = hx(t, this.workbookIds), r = gx(t, this.workbookIds), i = xx(n, e.mappedColumnIds), a = i && n.every((t) => {
23270
+ let n = vx(t, this.workbookIds), r = yx(t, this.workbookIds), i = wx(n, e.mappedColumnIds), a = i && n.every((t) => {
23250
23271
  let n = e.headersByColumn[t] ?? [], i = r[t] ?? [];
23251
23272
  return n.length === i.length && n.every((e, t) => e.workbookId === i[t].workbookId && e.header === i[t].header);
23252
23273
  });
@@ -23259,26 +23280,31 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
23259
23280
  }
23260
23281
  autoMatch(e) {
23261
23282
  this.workbookIds = e.map((e) => e.id);
23262
- let t = {}, n = {};
23263
- for (let r of e) {
23264
- let e = kb(r.headers, this.deps.columns, this.deps.extraSynonyms);
23265
- t[r.id] = e, n[r.id] = e, this.seqByWorkbook.set(r.id, (this.seqByWorkbook.get(r.id) ?? 0) + 1);
23283
+ let t = {}, n = {}, r = {};
23284
+ for (let i of e) {
23285
+ let e = Mb(i.headers, this.deps.columns, this.deps.extraSynonyms);
23286
+ t[i.id] = e, n[i.id] = e, r[i.id] = e, this.seqByWorkbook.set(i.id, (this.seqByWorkbook.get(i.id) ?? 0) + 1);
23266
23287
  }
23267
23288
  this._state = this.withProjections({
23268
23289
  ...this._state,
23269
23290
  autoMatched: n,
23291
+ baseline: r,
23270
23292
  isMatching: {}
23271
23293
  }, t);
23272
23294
  }
23273
23295
  autoMatchWorkbook(e, t) {
23274
23296
  if (!this.workbookIds.includes(e)) return;
23275
- let n = kb(t, this.deps.columns, this.deps.extraSynonyms);
23297
+ let n = Mb(t, this.deps.columns, this.deps.extraSynonyms);
23276
23298
  this.seqByWorkbook.set(e, (this.seqByWorkbook.get(e) ?? 0) + 1), this._state = this.withProjections({
23277
23299
  ...this._state,
23278
23300
  autoMatched: {
23279
23301
  ...this._state.autoMatched,
23280
23302
  [e]: n
23281
23303
  },
23304
+ baseline: {
23305
+ ...this._state.baseline,
23306
+ [e]: n
23307
+ },
23282
23308
  isMatching: {
23283
23309
  ...this._state.isMatching,
23284
23310
  [e]: !1
@@ -23294,24 +23320,25 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
23294
23320
  added: n,
23295
23321
  removed: r
23296
23322
  };
23297
- let i = px(this._state.byWorkbook, this._state.autoMatched, this.workbookIds.filter((e) => t.includes(e)));
23323
+ let i = gx(this._state.byWorkbook, this._state.autoMatched, this.workbookIds.filter((e) => t.includes(e)));
23298
23324
  for (let e of r) this.seqByWorkbook.delete(e);
23299
- let a = {}, o = {}, s = {};
23325
+ let a = {}, o = {}, s = {}, c = {};
23300
23326
  for (let t of e) {
23301
23327
  if (!n.includes(t.id)) {
23302
- let e = this._state.byWorkbook[t.id], n = this._state.autoMatched[t.id];
23303
- e && (a[t.id] = e), n && (o[t.id] = n);
23304
- let r = this._state.isMatching[t.id];
23305
- r !== void 0 && (s[t.id] = r);
23328
+ let e = this._state.byWorkbook[t.id], n = this._state.autoMatched[t.id], r = this._state.baseline[t.id];
23329
+ e && (a[t.id] = e), n && (o[t.id] = n), r && (s[t.id] = r);
23330
+ let i = this._state.isMatching[t.id];
23331
+ i !== void 0 && (c[t.id] = i);
23306
23332
  continue;
23307
23333
  }
23308
- let e = kb(t.headers, this.deps.columns, this.deps.extraSynonyms);
23309
- o[t.id] = e, a[t.id] = mx(e, i), this.seqByWorkbook.set(t.id, (this.seqByWorkbook.get(t.id) ?? 0) + 1);
23334
+ let e = Mb(t.headers, this.deps.columns, this.deps.extraSynonyms);
23335
+ o[t.id] = e, s[t.id] = e, a[t.id] = _x(e, i), this.seqByWorkbook.set(t.id, (this.seqByWorkbook.get(t.id) ?? 0) + 1);
23310
23336
  }
23311
23337
  return this.workbookIds = t, this._state = this.withProjections({
23312
23338
  ...this._state,
23313
23339
  autoMatched: o,
23314
- isMatching: s
23340
+ baseline: s,
23341
+ isMatching: c
23315
23342
  }, a), {
23316
23343
  added: n,
23317
23344
  removed: r
@@ -23329,10 +23356,14 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
23329
23356
  }
23330
23357
  };
23331
23358
  try {
23332
- let i = await lx(Ob(t, this.deps.columns, n, this.deps.extraSynonyms), cx);
23359
+ let i = await fx(jb(t, this.deps.columns, n, this.deps.extraSynonyms), dx);
23333
23360
  if (r !== this.seqByWorkbook.get(e)) return;
23334
23361
  this._state = this.withProjections({
23335
23362
  ...this._state,
23363
+ baseline: {
23364
+ ...this._state.baseline,
23365
+ [e]: i
23366
+ },
23336
23367
  isMatching: {
23337
23368
  ...this._state.isMatching,
23338
23369
  [e]: !1
@@ -23355,7 +23386,7 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
23355
23386
  }
23356
23387
  updateMapping(e, t, n, r) {
23357
23388
  this.seqByWorkbook.set(e, (this.seqByWorkbook.get(e) ?? 0) + 1);
23358
- let i = fx(dx(this._state.byWorkbook, e, t, n), t, n, r);
23389
+ let i = hx(mx(this._state.byWorkbook, e, t, n), t, n, r);
23359
23390
  this._state = this.withProjections(this._state, i);
23360
23391
  }
23361
23392
  setPendingColumns(e) {
@@ -23366,15 +23397,15 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
23366
23397
  };
23367
23398
  }
23368
23399
  reset() {
23369
- this.seqByWorkbook.clear(), this.workbookIds = [], this._state = bx;
23400
+ this.seqByWorkbook.clear(), this.workbookIds = [], this._state = Cx;
23370
23401
  }
23371
- }, Cx = (e) => e.hasExistingData || e.columnMatchingCount > 1, wx = (e) => {
23402
+ }, Ex = (e) => e.hasExistingData || e.columnMatchingCount > 1, Dx = (e) => {
23372
23403
  let t = ["select-files"];
23373
23404
  for (let n = 0; n < e.headerReviewCount; n++) t.push("header-selection");
23374
23405
  let n = Math.max(1, e.columnMatchingCount);
23375
23406
  for (let e = 0; e < n; e++) t.push("column-matching");
23376
- return e.hasSelectColumns && t.push("match-values"), e.primaryKeyColumnCount > 0 && Cx(e) && t.push("primary-key"), t;
23377
- }, Tx = {
23407
+ return e.hasSelectColumns && t.push("match-values"), e.primaryKeyColumnCount > 0 && Ex(e) && t.push("primary-key"), t;
23408
+ }, Ox = {
23378
23409
  parser: {
23379
23410
  workbooks: [],
23380
23411
  parsing: null,
@@ -23387,6 +23418,7 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
23387
23418
  headersByColumn: {},
23388
23419
  pendingColumns: [],
23389
23420
  autoMatched: {},
23421
+ baseline: {},
23390
23422
  isMatching: {}
23391
23423
  },
23392
23424
  valueMapping: {
@@ -23418,8 +23450,8 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
23418
23450
  loadingId: null,
23419
23451
  error: null
23420
23452
  }
23421
- }, Ex = class {
23422
- snapshot = Tx;
23453
+ }, kx = class {
23454
+ snapshot = Ox;
23423
23455
  listeners = /* @__PURE__ */ new Set();
23424
23456
  subscribe = (e) => (this.listeners.add(e), () => {
23425
23457
  this.listeners.delete(e);
@@ -23432,7 +23464,7 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
23432
23464
  } catch {}
23433
23465
  });
23434
23466
  }
23435
- }, Dx = class {
23467
+ }, Ax = class {
23436
23468
  enabled;
23437
23469
  taken = /* @__PURE__ */ new Set();
23438
23470
  constructor(e) {
@@ -23457,7 +23489,7 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
23457
23489
  for (let r of this.taken) r !== e && !r.startsWith(t) && n.add(r);
23458
23490
  this.taken = n;
23459
23491
  }
23460
- }, Ox = (e, t, n) => {
23492
+ }, jx = (e, t, n) => {
23461
23493
  if (e[t] !== "column-matching") return null;
23462
23494
  let r = t - e.indexOf("column-matching"), i = n[r];
23463
23495
  return i === void 0 ? null : {
@@ -23465,7 +23497,7 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
23465
23497
  position: r,
23466
23498
  total: n.length
23467
23499
  };
23468
- }, kx = (e, t) => e === t ? !0 : !e || !t ? !1 : e.workbookId === t.workbookId && e.position === t.position && e.total === t.total, Ax = (e, t, n) => {
23500
+ }, Mx = (e, t) => e === t ? !0 : !e || !t ? !1 : e.workbookId === t.workbookId && e.position === t.position && e.total === t.total, Nx = (e, t, n) => {
23469
23501
  if (e[t] !== "header-selection") return null;
23470
23502
  let r = t - e.indexOf("header-selection"), i = n[r];
23471
23503
  return i === void 0 ? null : {
@@ -23473,7 +23505,7 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
23473
23505
  position: r,
23474
23506
  total: n.length
23475
23507
  };
23476
- }, jx = class {
23508
+ }, Px = class {
23477
23509
  _state = {
23478
23510
  activeStepIndex: 0,
23479
23511
  currentStepIndex: 0
@@ -23507,13 +23539,13 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
23507
23539
  currentStepIndex: Math.min(r, t)
23508
23540
  });
23509
23541
  }
23510
- }, Mx = [
23542
+ }, Fx = [
23511
23543
  ",",
23512
23544
  ";",
23513
23545
  "|",
23514
23546
  "\n",
23515
23547
  " "
23516
- ], Nx = (e, t, n) => {
23548
+ ], Ix = (e, t, n) => {
23517
23549
  let r = new Set(n.map((e) => e.trim().toLowerCase())), i = (e) => r.has(e.trim().toLowerCase());
23518
23550
  if (e.trim() === "") return [];
23519
23551
  if (i(e)) return [e.trim()];
@@ -23525,18 +23557,18 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
23525
23557
  a.push(e);
23526
23558
  continue;
23527
23559
  }
23528
- a.push(...Px(e, t, i));
23560
+ a.push(...Lx(e, t, i));
23529
23561
  }
23530
23562
  }
23531
23563
  return a;
23532
- }, Px = (e, t, n) => {
23533
- for (let r of Mx) {
23564
+ }, Lx = (e, t, n) => {
23565
+ for (let r of Fx) {
23534
23566
  if (r === t || !e.includes(r)) continue;
23535
23567
  let i = e.split(r).map((e) => e.trim()).filter((e) => e !== "");
23536
23568
  if (i.length >= 2 && i.every(n)) return i;
23537
23569
  }
23538
23570
  return [e];
23539
- }, Fx = (e, t, n) => {
23571
+ }, Rx = (e, t, n) => {
23540
23572
  let r = new Map(t.map((e) => [e.id, e])), i = [];
23541
23573
  for (let [t, a] of Object.entries(e)) a && i.push({
23542
23574
  csvHeader: t,
@@ -23544,11 +23576,11 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
23544
23576
  column: n.has(a) ? void 0 : r.get(a)
23545
23577
  });
23546
23578
  return i;
23547
- }, Ix = (e) => {
23579
+ }, zx = (e) => {
23548
23580
  let t = [];
23549
23581
  for (let { csvHeader: n, column: r } of e) r?.editor?.type === "number" && t.push(n);
23550
23582
  return t;
23551
- }, Lx = (e, t, n) => {
23583
+ }, Bx = (e, t, n) => {
23552
23584
  let r = {};
23553
23585
  for (let { csvHeader: i, columnId: a, column: o } of t) {
23554
23586
  let t = e[i] ?? "";
@@ -23563,7 +23595,7 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
23563
23595
  continue;
23564
23596
  }
23565
23597
  if (s === "multiselect") {
23566
- let e = n.multiselectDelimiters[a], i = o.editor.options ?? [], s = e ? Nx(t, e, i) : t === "" ? [] : [t], c = [], l = /* @__PURE__ */ new Set();
23598
+ let e = n.multiselectDelimiters[a], i = o.editor.options ?? [], s = e ? Ix(t, e, i) : t === "" ? [] : [t], c = [], l = /* @__PURE__ */ new Set();
23567
23599
  for (let e of s) {
23568
23600
  let t = n.valueMapping[a]?.[e.trim()];
23569
23601
  t !== void 0 && !l.has(t) && (l.add(t), c.push(t));
@@ -23571,16 +23603,16 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
23571
23603
  r[a] = c;
23572
23604
  continue;
23573
23605
  }
23574
- let c = s === "number" ? fc(t, n.numberFormat) : s === "date" ? _c(t, n.dateFormat, n.monthTable) ?? t : t;
23606
+ let c = s === "number" ? oc(t, n.numberFormat) : s === "date" ? dc(t, n.dateFormat, n.monthTable) ?? t : t;
23575
23607
  r[a] = o.transformer ? o.transformer(c) : c;
23576
23608
  }
23577
23609
  return r;
23578
- }, Rx = (e, t, n) => {
23610
+ }, Vx = (e, t, n) => {
23579
23611
  let r = [];
23580
23612
  for (let [i, a] of Object.entries(e)) !a || n.has(a) || t.find((e) => e.id === a)?.editor?.type === "date" && r.push(i);
23581
23613
  return r;
23582
- }, zx = (e) => {
23583
- let t = new Set(e.pendingColumns.map((e) => e.id)), n = Fx(e.columnMapping, e.columns, t), r = e.rawRows ? sx(e.rawRows, e.workbook.headers, e.workbook.dataStartIndex, 1e3) : [], i = dc(r, Ix(n)), a = gc(r, Rx(e.columnMapping, e.columns, t));
23614
+ }, Hx = (e) => {
23615
+ let t = new Set(e.pendingColumns.map((e) => e.id)), n = Rx(e.columnMapping, e.columns, t), r = e.rawRows ? ux(e.rawRows, e.workbook.headers, e.workbook.dataStartIndex, 1e3) : [], i = ac(r, zx(n)), a = uc(r, Vx(e.columnMapping, e.columns, t));
23584
23616
  return {
23585
23617
  columnMapping: e.columnMapping,
23586
23618
  valueMapping: e.valueMapping,
@@ -23591,7 +23623,7 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
23591
23623
  dateFormat: a,
23592
23624
  newColumns: e.pendingColumns
23593
23625
  };
23594
- }, Bx = class {
23626
+ }, Ux = class {
23595
23627
  notify;
23596
23628
  _state = {
23597
23629
  isImporting: !1,
@@ -23635,35 +23667,30 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
23635
23667
  }, this.notify();
23636
23668
  }
23637
23669
  }
23638
- }, Vx = (e) => {
23639
- let t = /* @__PURE__ */ new Map();
23640
- for (let [n, r] of Object.entries(e)) {
23641
- let e = ab(n), i = t.get(e) ?? /* @__PURE__ */ new Set();
23642
- for (let e of r) i.add(ab(e));
23643
- t.set(e, i);
23644
- }
23645
- return t;
23646
- }, Hx = (e, t, n, r) => {
23647
- let i = Vx(r), a = (e, t) => i.get(ab(e))?.has(ab(t)) ?? !1, o = new Map(n.map((e) => [e.id, e])), s = (e, t) => (n, r) => {
23648
- if (ab(n) === ab(r) || a(r, n)) return;
23649
- let i = `${n} ${r}`;
23650
- t.has(i) || (t.add(i), e.push({
23651
- source: n,
23652
- target: r
23670
+ }, Wx = ({ columnMapping: e, baselineColumnMapping: t, valueMapping: n, baselineValueMapping: r, columns: i, knownColumnSynonyms: a, knownValueSynonyms: o }) => {
23671
+ let s = new Map(i.map((e) => [e.id, e])), c = (e, t, n) => (r, i) => {
23672
+ if (cb(r) === cb(i) || _b(r, i, n)) return;
23673
+ let a = `${r}\u0000${i}`;
23674
+ t.has(a) || (t.add(a), e.push({
23675
+ source: r,
23676
+ target: i
23653
23677
  }));
23654
- }, c = {
23678
+ }, l = {
23655
23679
  columns: [],
23656
23680
  values: []
23657
- }, l = s(c.columns, /* @__PURE__ */ new Set());
23658
- for (let [t, n] of Object.entries(e)) {
23659
- if (!n) continue;
23660
- let e = o.get(n);
23661
- e && l(t, e.title);
23681
+ }, u = c(l.columns, /* @__PURE__ */ new Set(), a);
23682
+ for (let [n, r] of Object.entries(e)) {
23683
+ if (!r || t[n] === r) continue;
23684
+ let e = s.get(r);
23685
+ e && u(n, e.title);
23662
23686
  }
23663
- let u = s(c.values, /* @__PURE__ */ new Set());
23664
- for (let e of Object.values(t)) for (let [t, n] of Object.entries(e)) n && u(t, n);
23665
- return c;
23666
- }, Ux = (e) => {
23687
+ let d = c(l.values, /* @__PURE__ */ new Set(), o);
23688
+ for (let [e, t] of Object.entries(n)) {
23689
+ let n = r[e] ?? {};
23690
+ for (let [e, r] of Object.entries(t)) r && n[e] !== r && d(e, r);
23691
+ }
23692
+ return l;
23693
+ }, Gx = (e) => {
23667
23694
  let t = /* @__PURE__ */ new Map(), n = [];
23668
23695
  for (let r of e) for (let e of r.headers) {
23669
23696
  let i = t.get(e);
@@ -23673,17 +23700,17 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
23673
23700
  }, t.set(e, i), n.push(i)), i.workbookIds.includes(r.id) || i.workbookIds.push(r.id);
23674
23701
  }
23675
23702
  return n;
23676
- }, Wx = (e) => e.kind === "remote" ? null : e.file, Gx = (e) => e.origin.kind === "sheet" ? `${e.origin.file.name} - ${e.name}` : e.name, Kx = (e, t) => e.kind === "remote" || t.kind === "remote" ? e.kind === "remote" && t.kind === "remote" && e.sourceId === t.sourceId : e.kind !== t.kind || e.file !== t.file ? !1 : e.kind === "sheet" && t.kind === "sheet" ? e.sheetName === t.sheetName : !0;
23677
- function qx(e, t, n) {
23703
+ }, Kx = (e) => e.kind === "remote" ? null : e.file, qx = (e) => e.origin.kind === "sheet" ? `${e.origin.file.name} - ${e.name}` : e.name, Jx = (e, t) => e.kind === "remote" || t.kind === "remote" ? e.kind === "remote" && t.kind === "remote" && e.sourceId === t.sourceId : e.kind !== t.kind || e.file !== t.file ? !1 : e.kind === "sheet" && t.kind === "sheet" ? e.sheetName === t.sheetName : !0;
23704
+ function Yx(e, t, n) {
23678
23705
  let r = e.length, i = t;
23679
- return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ? Jx(i, i - r) : Jx(r - 1, i - 1)) > 1e3 ? [] : r < i ? Yx(e, i) : Xx(e, i, n);
23706
+ return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ? Xx(i, i - r) : Xx(r - 1, i - 1)) > 1e3 ? [] : r < i ? Zx(e, i) : Qx(e, i, n);
23680
23707
  }
23681
- function Jx(e, t) {
23708
+ function Xx(e, t) {
23682
23709
  let n = Math.min(t, e - t), r = 1;
23683
23710
  for (let t = 1; t <= n; t++) if (r = r * (e - n + t) / t, r > 1e3) return r;
23684
23711
  return r;
23685
23712
  }
23686
- function Yx(e, t) {
23713
+ function Zx(e, t) {
23687
23714
  let n = e.length, r = [], i = [], a = (o) => {
23688
23715
  if (i.length === n) {
23689
23716
  let a = Array(t).fill("");
@@ -23695,7 +23722,7 @@ function Yx(e, t) {
23695
23722
  };
23696
23723
  return a(0), r;
23697
23724
  }
23698
- function Xx(e, t, n) {
23725
+ function Qx(e, t, n) {
23699
23726
  let r = e.length, i = [], a = [], o = (s) => {
23700
23727
  if (a.length === t - 1) {
23701
23728
  let o = [
@@ -23713,27 +23740,27 @@ function Xx(e, t, n) {
23713
23740
  }
23714
23741
  //#endregion
23715
23742
  //#region src/components/DataUploader/core/importing/raggedRows/pruneByValidators.ts
23716
- var Zx = {};
23717
- function Qx(e, t) {
23743
+ var $x = {};
23744
+ function eS(e, t) {
23718
23745
  for (let n of t.validators ?? []) if (!(n.type === "expression" || n.type === "asyncFunction")) {
23719
23746
  if (n.type === "function") {
23720
- if (n.fn(e, Zx) != null) return !1;
23747
+ if (n.fn(e, $x) != null) return !1;
23721
23748
  continue;
23722
23749
  }
23723
- if (Ql(n, e, Zx) != null) return !1;
23750
+ if (Ql(n, e, $x) != null) return !1;
23724
23751
  }
23725
23752
  return !0;
23726
23753
  }
23727
- function $x(e, t) {
23728
- for (let n = 0; n < t.length; n++) if (!Qx(e.cells[n] ?? "", t[n])) return !1;
23754
+ function tS(e, t) {
23755
+ for (let n = 0; n < t.length; n++) if (!eS(e.cells[n] ?? "", t[n])) return !1;
23729
23756
  return !0;
23730
23757
  }
23731
- function eS(e, t) {
23732
- return e.filter((e) => $x(e, t));
23758
+ function nS(e, t) {
23759
+ return e.filter((e) => tS(e, t));
23733
23760
  }
23734
23761
  //#endregion
23735
23762
  //#region src/components/DataUploader/core/importing/raggedRows/computeDisputeSpans.ts
23736
- function tS(e) {
23763
+ function rS(e) {
23737
23764
  if (e.length <= 1) return [];
23738
23765
  let t = e[0].cells.length, n = [], r = -1;
23739
23766
  for (let i = 0; i < t; i++) {
@@ -23750,25 +23777,25 @@ function tS(e) {
23750
23777
  }
23751
23778
  //#endregion
23752
23779
  //#region src/components/DataUploader/core/importing/raggedRows/alignRow.ts
23753
- function nS(e, t, n) {
23754
- let r = qx(e, t.length, n), i = eS(r, t);
23780
+ function iS(e, t, n) {
23781
+ let r = Yx(e, t.length, n), i = nS(r, t);
23755
23782
  return i.length === 1 ? {
23756
23783
  kind: "confident",
23757
23784
  alignment: i[0]
23758
23785
  } : i.length > 1 ? {
23759
23786
  kind: "ambiguous",
23760
23787
  candidates: i,
23761
- disputeSpans: tS(i)
23788
+ disputeSpans: rS(i)
23762
23789
  } : {
23763
23790
  kind: "invalid",
23764
23791
  candidates: r,
23765
- disputeSpans: tS(r)
23792
+ disputeSpans: rS(r)
23766
23793
  };
23767
23794
  }
23768
23795
  //#endregion
23769
23796
  //#region src/components/DataUploader/core/importing/raggedRows/resolveRaggedRow.ts
23770
- function rS(e, t, n) {
23771
- let r = nS(e, t, n);
23797
+ function aS(e, t, n) {
23798
+ let r = iS(e, t, n);
23772
23799
  if (r.kind === "confident") return {
23773
23800
  cells: r.alignment.cells,
23774
23801
  conflictColumns: []
@@ -23787,7 +23814,7 @@ function rS(e, t, n) {
23787
23814
  }
23788
23815
  //#endregion
23789
23816
  //#region src/components/DataUploader/core/importing/scheduler.ts
23790
- var iS = () => typeof MessageChannel > "u" ? new Promise((e) => setTimeout(e, 0)) : new Promise((e) => {
23817
+ var oS = () => typeof MessageChannel > "u" ? new Promise((e) => setTimeout(e, 0)) : new Promise((e) => {
23791
23818
  let { port1: t, port2: n } = new MessageChannel();
23792
23819
  t.onmessage = () => {
23793
23820
  t.close(), e();
@@ -23795,11 +23822,11 @@ var iS = () => typeof MessageChannel > "u" ? new Promise((e) => setTimeout(e, 0)
23795
23822
  });
23796
23823
  //#endregion
23797
23824
  //#region src/components/DataUploader/core/importing/runChunked.ts
23798
- async function aS(e, t) {
23825
+ async function sS(e, t) {
23799
23826
  let { rawRows: n, dataStartIndex: r, chunkSize: i, signal: a } = e, o = [];
23800
23827
  for (let e = r; e < n.length; e++) {
23801
23828
  let t = n[e];
23802
- t && !Yb(t) && o.push(e);
23829
+ t && !Qb(t) && o.push(e);
23803
23830
  }
23804
23831
  let s = 0, c = 0;
23805
23832
  for (; s < o.length;) {
@@ -23814,14 +23841,14 @@ async function aS(e, t) {
23814
23841
  isLastChunk: e >= o.length
23815
23842
  });
23816
23843
  for (let t = s; t < e; t++) n[o[t]] = void 0;
23817
- s = e, c++, s < o.length && await iS();
23844
+ s = e, c++, s < o.length && await oS();
23818
23845
  }
23819
23846
  return "completed";
23820
23847
  }
23821
23848
  //#endregion
23822
23849
  //#region src/components/DataUploader/core/importing/runImport.ts
23823
- var oS = 5e3, sS = async (e) => {
23824
- let t = Wx(e.workbook.origin);
23850
+ var cS = 5e3, lS = async (e) => {
23851
+ let t = Kx(e.workbook.origin);
23825
23852
  if (!t || !e.scaleClient?.onFileImport) return {
23826
23853
  outcome: "completed",
23827
23854
  collapsed: !1
@@ -23834,34 +23861,34 @@ var oS = 5e3, sS = async (e) => {
23834
23861
  return await e.scaleClient.onFileImport({
23835
23862
  file: t,
23836
23863
  mappings: n,
23837
- sourceName: Gx(e.workbook),
23864
+ sourceName: qx(e.workbook),
23838
23865
  signal: e.signal
23839
23866
  }), e.store.reloadServerData(), {
23840
23867
  outcome: "completed",
23841
23868
  collapsed: !1
23842
23869
  };
23843
- }, cS = async (e) => {
23870
+ }, uS = async (e) => {
23844
23871
  let { scaleClient: t, rawRows: n } = e;
23845
23872
  if (!n || !t?.onRowsImport) return {
23846
23873
  outcome: "completed",
23847
23874
  collapsed: !1
23848
23875
  };
23849
- let r = crypto.randomUUID(), i = e.buildMappings(null), a = t.importChunkSize ?? oS, o = new Set(e.pendingColumns.map((e) => e.id)), s = Fx(e.columnMapping, e.columns, o), c = {
23876
+ let r = crypto.randomUUID(), i = e.buildMappings(null), a = t.importChunkSize ?? cS, o = new Set(e.pendingColumns.map((e) => e.id)), s = Rx(e.columnMapping, e.columns, o), c = {
23850
23877
  numberFormat: i.numberFormat,
23851
23878
  dateFormat: i.dateFormat,
23852
23879
  monthTable: e.monthTable,
23853
23880
  valueMapping: e.valueMapping,
23854
23881
  multiselectDelimiters: e.multiselectDelimiters
23855
- }, l = await aS({
23882
+ }, l = await sS({
23856
23883
  rawRows: n,
23857
23884
  dataStartIndex: e.workbook.dataStartIndex,
23858
23885
  chunkSize: a,
23859
23886
  signal: e.signal
23860
23887
  }, async (n, { chunkIndex: a, isLastChunk: o }) => {
23861
- let l = n.map((t) => Lx(ox(t, e.workbook.headers), s, c));
23888
+ let l = n.map((t) => Bx(lx(t, e.workbook.headers), s, c));
23862
23889
  await t.onRowsImport?.({
23863
23890
  importId: r,
23864
- sourceName: Gx(e.workbook),
23891
+ sourceName: qx(e.workbook),
23865
23892
  chunkIndex: a,
23866
23893
  isLastChunk: o,
23867
23894
  rows: l,
@@ -23874,7 +23901,7 @@ var oS = 5e3, sS = async (e) => {
23874
23901
  outcome: l,
23875
23902
  collapsed: !1
23876
23903
  };
23877
- }, lS = async (e) => {
23904
+ }, dS = async (e) => {
23878
23905
  let t = e.rawRows;
23879
23906
  if (!t) return {
23880
23907
  outcome: "completed",
@@ -23883,11 +23910,11 @@ var oS = 5e3, sS = async (e) => {
23883
23910
  let n = new Set(e.pendingColumns.map((e) => e.id));
23884
23911
  e.pendingColumns.length > 0 && e.addDynamicColumns(e.pendingColumns);
23885
23912
  for (let [t, n] of Object.entries(e.pendingOptions)) e.store.addColumnOptions(t, n);
23886
- let r = e.store.registerSource({ name: Gx(e.workbook) });
23887
- e.store.setSourceLoading(r, !0), e.store.recordLearnedSynonyms(Hx(e.columnMapping, e.valueMapping, [...e.columns, ...e.pendingColumns], rb(nb, e.extraSynonyms)));
23888
- let i = e.workbook.headers, a = e.workbook.delimiter ?? ",", o = sx(t, i, e.workbook.dataStartIndex, 1e3), s = Fx(e.columnMapping, e.columns, n), c = {
23889
- numberFormat: dc(o, Ix(s)),
23890
- dateFormat: gc(o, Rx(e.columnMapping, e.columns, n)),
23913
+ let r = e.store.registerSource({ name: qx(e.workbook) });
23914
+ e.store.setSourceLoading(r, !0);
23915
+ let i = e.workbook.headers, a = e.workbook.delimiter ?? ",", o = ux(t, i, e.workbook.dataStartIndex, 1e3), s = Rx(e.columnMapping, e.columns, n), c = {
23916
+ numberFormat: ac(o, zx(s)),
23917
+ dateFormat: uc(o, Vx(e.columnMapping, e.columns, n)),
23891
23918
  monthTable: e.monthTable,
23892
23919
  valueMapping: e.valueMapping,
23893
23920
  multiselectDelimiters: e.multiselectDelimiters
@@ -23897,17 +23924,17 @@ var oS = 5e3, sS = async (e) => {
23897
23924
  id: t,
23898
23925
  title: t
23899
23926
  };
23900
- }), u = 0, d = 0, f = await aS({
23927
+ }), u = 0, d = 0, f = await sS({
23901
23928
  rawRows: t,
23902
23929
  dataStartIndex: e.workbook.dataStartIndex,
23903
- chunkSize: oS,
23930
+ chunkSize: cS,
23904
23931
  signal: e.signal
23905
23932
  }, async (t) => {
23906
23933
  let n = [], o = [];
23907
23934
  for (let r = 0; r < t.length; r++) {
23908
- let u = t[r], d = ox(u, i);
23935
+ let u = t[r], d = lx(u, i);
23909
23936
  if (u.length !== i.length) {
23910
- let { cells: t, conflictColumns: n } = rS(u.map((e) => String(e ?? "")), l, a);
23937
+ let { cells: t, conflictColumns: n } = aS(u.map((e) => String(e ?? "")), l, a);
23911
23938
  if (t.length) {
23912
23939
  let e = {};
23913
23940
  for (let n = 0; n < i.length; n++) e[i[n]] = t[n] ?? "";
@@ -23925,10 +23952,10 @@ var oS = 5e3, sS = async (e) => {
23925
23952
  });
23926
23953
  }
23927
23954
  }
23928
- n.push(Lx(d, s, c));
23955
+ n.push(Bx(d, s, c));
23929
23956
  }
23930
23957
  let { rows: f, rowIds: p, addedCount: m } = e.store.upsertRows(r, n, { anchorKey: e.primaryKey ?? void 0 });
23931
- u += n.length, d += m, await iS(), e.validator.validateRows(f, p);
23958
+ u += n.length, d += m, await oS(), e.validator.validateRows(f, p);
23932
23959
  for (let { localIndex: t, columnIds: n } of o) {
23933
23960
  let r = p[t];
23934
23961
  for (let t of n) {
@@ -23940,41 +23967,51 @@ var oS = 5e3, sS = async (e) => {
23940
23967
  }
23941
23968
  }
23942
23969
  o.length > 0 && e.store.notify();
23943
- }), p = f === "completed" && u > 0 && d === 0;
23970
+ });
23971
+ f === "completed" && e.store.recordLearnedSynonyms(Wx({
23972
+ columnMapping: e.columnMapping,
23973
+ baselineColumnMapping: e.baselineColumnMapping,
23974
+ valueMapping: e.valueMapping,
23975
+ baselineValueMapping: e.baselineValueMapping,
23976
+ columns: [...e.columns, ...e.pendingColumns],
23977
+ knownColumnSynonyms: ob(nb, e.extraSynonyms.columns),
23978
+ knownValueSynonyms: ob(nb, e.extraSynonyms.values)
23979
+ }));
23980
+ let p = f === "completed" && u > 0 && d === 0;
23944
23981
  return await e.store.finalizeSource(r), e.validator.validateUniqueness(), {
23945
23982
  outcome: f,
23946
23983
  collapsed: p
23947
23984
  };
23948
23985
  };
23949
- async function uS(e) {
23950
- return e.scaleClient?.onFileImport ? sS(e) : e.scaleClient?.onRowsImport ? cS(e) : lS(e);
23986
+ async function fS(e) {
23987
+ return e.scaleClient?.onFileImport ? lS(e) : e.scaleClient?.onRowsImport ? uS(e) : dS(e);
23951
23988
  }
23952
23989
  //#endregion
23953
23990
  //#region src/components/DataUploader/core/parser/headerView.ts
23954
- var dS = (e, t, n, r) => {
23955
- let i = $b(t, n);
23991
+ var pS = (e, t, n, r) => {
23992
+ let i = nx(t, n);
23956
23993
  return {
23957
23994
  dataStartIndex: i,
23958
- headers: ex(e, n, i, r)
23995
+ headers: rx(e, n, i, r)
23959
23996
  };
23960
- }, fS = (e) => e.kind === "remote" ? `remote:${e.sourceId}` : `file:${e.file.name}:${e.file.size}:${e.file.lastModified}`, pS = (e, t, n, r) => {
23961
- let { headers: i, dataStartIndex: a } = dS(t.rawRows, t.detection, n, r);
23997
+ }, mS = (e) => e.kind === "remote" ? `remote:${e.sourceId}` : `file:${e.file.name}:${e.file.size}:${e.file.lastModified}`, hS = (e, t, n, r) => {
23998
+ let { headers: i, dataStartIndex: a } = pS(t.rawRows, t.detection, n, r);
23962
23999
  return {
23963
24000
  name: e,
23964
24001
  headers: i,
23965
- rows: sx(t.rawRows, i, a, 15),
24002
+ rows: ux(t.rawRows, i, a, 15),
23966
24003
  totalRows: Math.max(0, t.rawRows.length - a)
23967
24004
  };
23968
- }, mS = (e, t) => {
23969
- let n = qb(e.rows), r = $b(n, n.headerRowIndex), i = ex(e.rows, n.headerRowIndex, r, t);
24005
+ }, gS = (e, t) => {
24006
+ let n = Xb(e.rows), r = nx(n, n.headerRowIndex), i = rx(e.rows, n.headerRowIndex, r, t);
23970
24007
  return {
23971
24008
  name: e.name,
23972
24009
  headers: i,
23973
- rows: sx(e.rows, i, r, 15),
24010
+ rows: ux(e.rows, i, r, 15),
23974
24011
  totalRows: e.totalRows - 1
23975
24012
  };
23976
- }, hS = (e, t, n) => {
23977
- let r = qb(e);
24013
+ }, _S = (e, t, n) => {
24014
+ let r = Xb(e);
23978
24015
  return {
23979
24016
  kind: "parsed",
23980
24017
  grid: {
@@ -23986,19 +24023,19 @@ var dS = (e, t, n, r) => {
23986
24023
  csvErrors: n
23987
24024
  };
23988
24025
  };
23989
- async function gS(e, t, n, r, i = {}) {
24026
+ async function vS(e, t, n, r, i = {}) {
23990
24027
  try {
23991
24028
  if (n === "csv") {
23992
24029
  let n = await e.parse(t, { format: "csv" });
23993
- return n.kind === "rows" ? hS(n.rows, n.delimiter, n.errors) : { kind: "unexpected" };
24030
+ return n.kind === "rows" ? _S(n.rows, n.delimiter, n.errors) : { kind: "unexpected" };
23994
24031
  }
23995
24032
  if (n === "json" || n === "xml") {
23996
24033
  let r = await e.parse(t, { format: n });
23997
24034
  return r.kind === "records" ? {
23998
24035
  kind: "parsed",
23999
24036
  grid: {
24000
- rawRows: nx(r.headers, r.rows),
24001
- detection: tx()
24037
+ rawRows: ax(r.headers, r.rows),
24038
+ detection: ix()
24002
24039
  },
24003
24040
  headerRowIndex: 0,
24004
24041
  csvErrors: []
@@ -24010,8 +24047,8 @@ async function gS(e, t, n, r, i = {}) {
24010
24047
  });
24011
24048
  return !i.sheetName && a.kind === "sheets" ? {
24012
24049
  kind: "sheets",
24013
- previews: a.sheets.map((e) => mS(e, r))
24014
- } : a.kind === "rows" ? hS(a.rows, ",", []) : { kind: "unexpected" };
24050
+ previews: a.sheets.map((e) => gS(e, r))
24051
+ } : a.kind === "rows" ? _S(a.rows, ",", []) : { kind: "unexpected" };
24015
24052
  } catch (e) {
24016
24053
  return {
24017
24054
  kind: "error",
@@ -24022,20 +24059,20 @@ async function gS(e, t, n, r, i = {}) {
24022
24059
  }
24023
24060
  //#endregion
24024
24061
  //#region src/components/DataUploader/core/parser/resolveParseFormat.ts
24025
- var _S = new Set([
24062
+ var yS = new Set([
24026
24063
  "xlsx",
24027
24064
  "xls",
24028
24065
  "xlsb",
24029
24066
  "ods"
24030
- ]), vS = (e) => {
24067
+ ]), bS = (e) => {
24031
24068
  let t = e.split(".").pop()?.toLowerCase();
24032
- return t && _S.has(t) ? "xlsx" : t === "json" ? "json" : t === "xml" ? "xml" : "csv";
24033
- }, yS = 20, bS = {
24069
+ return t && yS.has(t) ? "xlsx" : t === "json" ? "json" : t === "xml" ? "xml" : "csv";
24070
+ }, xS = 20, SS = {
24034
24071
  workbooks: [],
24035
24072
  parsing: null,
24036
24073
  stagedItems: [],
24037
24074
  unionHeaders: []
24038
- }, xS = (e) => e.source.kind === "remote" ? {
24075
+ }, CS = (e) => e.source.kind === "remote" ? {
24039
24076
  kind: "remote",
24040
24077
  sourceId: e.source.sourceId
24041
24078
  } : e.materialize.kind === "sheet" ? {
@@ -24045,7 +24082,7 @@ var _S = new Set([
24045
24082
  } : {
24046
24083
  kind: "file",
24047
24084
  file: e.source.file
24048
- }, SS = class {
24085
+ }, wS = class {
24049
24086
  client;
24050
24087
  synthesize;
24051
24088
  generation = 0;
@@ -24053,7 +24090,7 @@ var _S = new Set([
24053
24090
  stagedSeq = 0;
24054
24091
  queue = [];
24055
24092
  pumping = !1;
24056
- _state = bS;
24093
+ _state = SS;
24057
24094
  constructor(e, t) {
24058
24095
  this.client = e, this.synthesize = t;
24059
24096
  }
@@ -24070,12 +24107,12 @@ var _S = new Set([
24070
24107
  let t = {
24071
24108
  kind: "file",
24072
24109
  file: e
24073
- }, n = fS(t);
24074
- for (let e of this.queue) fS({
24110
+ }, n = mS(t);
24111
+ for (let e of this.queue) mS({
24075
24112
  kind: "file",
24076
24113
  file: e.file
24077
24114
  }) === n && e.resolve(null);
24078
- this.queue = this.queue.filter((e) => fS({
24115
+ this.queue = this.queue.filter((e) => mS({
24079
24116
  kind: "file",
24080
24117
  file: e.file
24081
24118
  }) !== n);
@@ -24093,13 +24130,13 @@ var _S = new Set([
24093
24130
  });
24094
24131
  }
24095
24132
  stageGrid(e, t, n, r) {
24096
- let i = this.readyItem(t, n, pS(n, e, r, this.synthesize), {
24133
+ let i = this.readyItem(t, n, hS(n, e, r, this.synthesize), {
24097
24134
  kind: "grid",
24098
24135
  grid: e,
24099
24136
  headerRowIndex: r
24100
24137
  });
24101
24138
  this.patch({
24102
- stagedItems: [...this.itemsWithoutSource(fS(t)), i],
24139
+ stagedItems: [...this.itemsWithoutSource(mS(t)), i],
24103
24140
  parsing: null
24104
24141
  });
24105
24142
  }
@@ -24115,11 +24152,11 @@ var _S = new Set([
24115
24152
  ok: !1,
24116
24153
  attempt: null
24117
24154
  };
24118
- let t = e.map((e) => xS(e)), n = this._state.workbooks.filter((e) => t.some((t) => Kx(e.origin, t)));
24155
+ let t = e.map((e) => CS(e)), n = this._state.workbooks.filter((e) => t.some((t) => Jx(e.origin, t)));
24119
24156
  n.length !== this._state.workbooks.length && this.setWorkbooks(n);
24120
24157
  for (let t of e) {
24121
- let e = xS(t);
24122
- if (this._state.workbooks.some((t) => Kx(t.origin, e))) continue;
24158
+ let e = CS(t);
24159
+ if (this._state.workbooks.some((t) => Jx(t.origin, e))) continue;
24123
24160
  if (t.materialize.kind === "grid") {
24124
24161
  this.addWorkbook(t.materialize.grid, e, t.name, t.materialize.headerRowIndex);
24125
24162
  continue;
@@ -24127,7 +24164,7 @@ var _S = new Set([
24127
24164
  if (t.source.kind !== "file") continue;
24128
24165
  let { file: n } = t.source, r = ++this.generation;
24129
24166
  this.patch({ parsing: { file: n } });
24130
- let i = await gS(this.client, n, "xlsx", this.synthesize, { sheetName: t.materialize.sheetName });
24167
+ let i = await vS(this.client, n, "xlsx", this.synthesize, { sheetName: t.materialize.sheetName });
24131
24168
  if (r !== this.generation) return {
24132
24169
  ok: !1,
24133
24170
  attempt: null
@@ -24148,7 +24185,7 @@ var _S = new Set([
24148
24185
  }
24149
24186
  removeWorkbook(e) {
24150
24187
  let t = this._state.workbooks.find((t) => t.id === e);
24151
- t && this.setWorkbooks(this._state.workbooks.filter((t) => t.id !== e), { stagedItems: this._state.stagedItems.filter((e) => e.status === "pending" || !Kx(xS(e), t.origin)) });
24188
+ t && this.setWorkbooks(this._state.workbooks.filter((t) => t.id !== e), { stagedItems: this._state.stagedItems.filter((e) => e.status === "pending" || !Jx(CS(e), t.origin)) });
24152
24189
  }
24153
24190
  cancelParse() {
24154
24191
  !this._state.parsing && this.queue.length === 0 || (this.generation++, this.client.cancel(), this.flushQueue(), this.patch({
@@ -24163,7 +24200,7 @@ var _S = new Set([
24163
24200
  });
24164
24201
  }
24165
24202
  reset() {
24166
- this.generation++, this.client.cancel(), this.flushQueue(), this._state = bS;
24203
+ this.generation++, this.client.cancel(), this.flushQueue(), this._state = SS;
24167
24204
  }
24168
24205
  clearWorkbooks() {
24169
24206
  this.setWorkbooks([]);
@@ -24171,7 +24208,7 @@ var _S = new Set([
24171
24208
  takeRawRows(e) {
24172
24209
  let t = this._state.workbooks.find((t) => t.id === e);
24173
24210
  if (!t) return null;
24174
- let n = t.rawRows, r = Math.max(yS, t.dataStartIndex + 1);
24211
+ let n = t.rawRows, r = Math.max(xS, t.dataStartIndex + 1);
24175
24212
  return this.setWorkbooks(this._state.workbooks.map((t) => t.id === e ? {
24176
24213
  ...t,
24177
24214
  rawRows: n.slice(0, r)
@@ -24201,7 +24238,7 @@ var _S = new Set([
24201
24238
  if (!e) break;
24202
24239
  let t = ++this.generation;
24203
24240
  this.patch({ parsing: { file: e.file } });
24204
- let n = vS(e.file.name), r = await gS(this.client, e.file, n, this.synthesize);
24241
+ let n = bS(e.file.name), r = await vS(this.client, e.file, n, this.synthesize);
24205
24242
  if (t !== this.generation) {
24206
24243
  e.resolve(null);
24207
24244
  continue;
@@ -24224,7 +24261,7 @@ var _S = new Set([
24224
24261
  this.queue = [];
24225
24262
  }
24226
24263
  itemsWithoutSource(e) {
24227
- return this._state.stagedItems.filter((t) => fS(t.source) !== e);
24264
+ return this._state.stagedItems.filter((t) => mS(t.source) !== e);
24228
24265
  }
24229
24266
  readyItem(e, t, n, r) {
24230
24267
  return {
@@ -24238,10 +24275,10 @@ var _S = new Set([
24238
24275
  };
24239
24276
  }
24240
24277
  applyOutcome(e, t, n) {
24241
- let r = this.itemsWithoutSource(fS(t));
24278
+ let r = this.itemsWithoutSource(mS(t));
24242
24279
  switch (e.kind) {
24243
24280
  case "parsed": {
24244
- let i = this.readyItem(t, n, pS(n, e.grid, e.headerRowIndex, this.synthesize), {
24281
+ let i = this.readyItem(t, n, hS(n, e.grid, e.headerRowIndex, this.synthesize), {
24245
24282
  kind: "grid",
24246
24283
  grid: e.grid,
24247
24284
  headerRowIndex: e.headerRowIndex
@@ -24283,11 +24320,11 @@ var _S = new Set([
24283
24320
  headerRowIndex: r,
24284
24321
  headers: [],
24285
24322
  dataStartIndex: 0
24286
- }), a = this._state.workbooks.findIndex((e) => Kx(e.origin, t)), o = a >= 0 ? this._state.workbooks.map((e, t) => t === a ? i : e) : [...this._state.workbooks, i];
24323
+ }), a = this._state.workbooks.findIndex((e) => Jx(e.origin, t)), o = a >= 0 ? this._state.workbooks.map((e, t) => t === a ? i : e) : [...this._state.workbooks, i];
24287
24324
  return this.setWorkbooks(o, { parsing: null }), i;
24288
24325
  }
24289
24326
  reproject(e) {
24290
- let { headers: t, dataStartIndex: n } = dS(e.rawRows, e.detection, e.headerRowIndex, this.synthesize);
24327
+ let { headers: t, dataStartIndex: n } = pS(e.rawRows, e.detection, e.headerRowIndex, this.synthesize);
24291
24328
  return {
24292
24329
  ...e,
24293
24330
  headers: t,
@@ -24300,7 +24337,7 @@ var _S = new Set([
24300
24337
  ...n,
24301
24338
  ...t,
24302
24339
  workbooks: e,
24303
- unionHeaders: r ? Ux(e) : n.unionHeaders
24340
+ unionHeaders: r ? Gx(e) : n.unionHeaders
24304
24341
  };
24305
24342
  }
24306
24343
  patch(e) {
@@ -24309,7 +24346,7 @@ var _S = new Set([
24309
24346
  ...e
24310
24347
  };
24311
24348
  }
24312
- }, CS = class {
24349
+ }, TS = class {
24313
24350
  columns;
24314
24351
  _state;
24315
24352
  constructor(e, t) {
@@ -24328,17 +24365,17 @@ var _S = new Set([
24328
24365
  };
24329
24366
  }
24330
24367
  refreshEligible(e) {
24331
- let t = new Set(e), n = this.columns.filter((e) => Ys(e) && t.has(e.id)), r = this._state.eligibleColumns;
24368
+ let t = new Set(e), n = this.columns.filter((e) => Wc(e) && t.has(e.id)), r = this._state.eligibleColumns;
24332
24369
  r.length === n.length && r.every((e, t) => e === n[t]) || (this._state = {
24333
24370
  ...this._state,
24334
24371
  eligibleColumns: n
24335
24372
  });
24336
24373
  }
24337
- }, wS = {
24374
+ }, ES = {
24338
24375
  loadingId: null,
24339
24376
  error: null
24340
- }, TS = class {
24341
- _state = wS;
24377
+ }, DS = class {
24378
+ _state = ES;
24342
24379
  get state() {
24343
24380
  return this._state;
24344
24381
  }
@@ -24360,74 +24397,74 @@ var _S = new Set([
24360
24397
  loadingId: null
24361
24398
  };
24362
24399
  }
24363
- }, ES = (e, t, n) => {
24400
+ }, OS = (e, t, n) => {
24364
24401
  let r = /* @__PURE__ */ new Set();
24365
- for (let i of e) if (i !== "") if (n) for (let e of Nx(i, n, t)) r.add(e);
24402
+ for (let i of e) if (i !== "") if (n) for (let e of Ix(i, n, t)) r.add(e);
24366
24403
  else r.add(i);
24367
24404
  return [...r];
24368
- }, DS = 200, OS = (e, t, n) => {
24405
+ }, kS = 200, AS = (e, t, n) => {
24369
24406
  if (n) return n;
24370
24407
  let r = new Set(t.map((e) => e.trim().toLowerCase())), i = (e) => r.has(e.trim().toLowerCase()), a = /* @__PURE__ */ new Set(), o = [];
24371
24408
  for (let t of e) {
24372
24409
  let e = t.trim();
24373
- if (!(e === "" || a.has(e)) && (a.add(e), o.push(e), o.length >= DS)) break;
24410
+ if (!(e === "" || a.has(e)) && (a.add(e), o.push(e), o.length >= kS)) break;
24374
24411
  }
24375
24412
  if (o.length === 0) return null;
24376
24413
  let s = null, c = 0, l = 0;
24377
- for (let e of Mx) {
24414
+ for (let e of Fx) {
24378
24415
  let n = 0, r = 0;
24379
24416
  for (let a of o) {
24380
24417
  if (i(a) || !a.includes(e)) continue;
24381
24418
  let o = a.split(e).map((e) => e.trim()).filter((e) => e !== "");
24382
24419
  if (o.length < 2) continue;
24383
24420
  let s = 0, c = 0;
24384
- for (let e of o) i(e) ? (s++, c++) : Sb(e, t) !== void 0 && s++;
24421
+ for (let e of o) i(e) ? (s++, c++) : Tb(e, t) !== void 0 && s++;
24385
24422
  s >= 2 && (n++, r += c);
24386
24423
  }
24387
24424
  (n > c || n === c && n > 0 && r > l) && (s = e, c = n, l = r);
24388
24425
  }
24389
24426
  return c > 0 ? s : null;
24390
- }, kS = (e, t) => {
24427
+ }, jS = (e, t) => {
24391
24428
  let n = /* @__PURE__ */ new Map();
24392
24429
  for (let [r, i] of Object.entries(e)) {
24393
24430
  let e = t.find((e) => e.id === r)?.editor?.type;
24394
24431
  e !== "select" && e !== "multiselect" || n.set(r, i);
24395
24432
  }
24396
24433
  return n;
24397
- }, AS = (e, t) => {
24434
+ }, MS = (e, t) => {
24398
24435
  let n = t.editor;
24399
24436
  if (!n || n.type !== "select" && n.type !== "multiselect") return null;
24400
24437
  let r = n.options;
24401
24438
  if (n.type === "multiselect") {
24402
- let t = n.delimiter, i = OS(e, r, t);
24439
+ let t = n.delimiter, i = AS(e, r, t);
24403
24440
  return {
24404
- importedValues: ES(e, r, i),
24441
+ importedValues: OS(e, r, i),
24405
24442
  options: r,
24406
24443
  delimiter: i,
24407
24444
  isMultiselect: !0
24408
24445
  };
24409
24446
  }
24410
24447
  return {
24411
- importedValues: ES(e, r, null),
24448
+ importedValues: OS(e, r, null),
24412
24449
  options: r,
24413
24450
  delimiter: null,
24414
24451
  isMultiselect: !1
24415
24452
  };
24416
- }, jS = (e, t) => {
24453
+ }, NS = (e, t) => {
24417
24454
  let n = /* @__PURE__ */ new Set();
24418
24455
  for (let r of t) {
24419
24456
  let t = e.find((e) => e.id === r.workbookId);
24420
24457
  if (!t) continue;
24421
- let i = rx(t.headers).get(r.header);
24422
- if (i !== void 0) for (let e of ax(t.rawRows, t.dataStartIndex, i)) n.add(e);
24458
+ let i = ox(t.headers).get(r.header);
24459
+ if (i !== void 0) for (let e of cx(t.rawRows, t.dataStartIndex, i)) n.add(e);
24423
24460
  }
24424
24461
  return [...n];
24425
- }, MS = (e, t, n) => {
24462
+ }, PS = (e, t, n) => {
24426
24463
  let r = {}, i = {}, a = {};
24427
- for (let [o, s] of kS(t, n)) {
24464
+ for (let [o, s] of jS(t, n)) {
24428
24465
  let t = n.find((e) => e.id === o);
24429
24466
  if (!t) continue;
24430
- let c = jS(e, s), l = AS(c, t);
24467
+ let c = NS(e, s), l = MS(c, t);
24431
24468
  l && (a[o] = c, l.isMultiselect && (i[o] = l.delimiter), r[o] = {
24432
24469
  importedValues: l.importedValues,
24433
24470
  options: l.options
@@ -24438,27 +24475,27 @@ var _S = new Set([
24438
24475
  delimiters: i,
24439
24476
  rawCellsByColumn: a
24440
24477
  };
24441
- }, NS = (e, t) => {
24478
+ }, FS = (e, t) => {
24442
24479
  let n = {};
24443
24480
  for (let [r, i] of Object.entries(e)) n[r] = {
24444
24481
  ...i,
24445
24482
  ...t[r]
24446
24483
  };
24447
24484
  return n;
24448
- }, PS = (e, t, n, r) => ({
24485
+ }, IS = (e, t, n, r) => ({
24449
24486
  ...e,
24450
24487
  [t]: {
24451
24488
  ...e[t],
24452
24489
  [n]: r
24453
24490
  }
24454
- }), FS = (e, t, n) => IS(e, t, [n]), IS = (e, t, n) => {
24491
+ }), LS = (e, t, n) => RS(e, t, [n]), RS = (e, t, n) => {
24455
24492
  let r = e[t] ?? [], i = new Set(r), a = [];
24456
24493
  for (let e of n) i.has(e) || (i.add(e), a.push(e));
24457
24494
  return a.length === 0 ? e : {
24458
24495
  ...e,
24459
24496
  [t]: [...r, ...a]
24460
24497
  };
24461
- }, LS = (e, t, n, r) => {
24498
+ }, zS = (e, t, n, r) => {
24462
24499
  let i = t[r];
24463
24500
  if (!i || i.length === 0) return null;
24464
24501
  let a = n.find((e) => e.id === r);
@@ -24467,31 +24504,31 @@ var _S = new Set([
24467
24504
  for (let t of i) {
24468
24505
  let n = e.find((e) => e.id === t.workbookId);
24469
24506
  if (!n) continue;
24470
- let r = rx(n.headers).get(t.header);
24471
- r !== void 0 && (s = !0, o.push(...ix(n.rawRows, n.dataStartIndex, r)));
24507
+ let r = ox(n.headers).get(t.header);
24508
+ r !== void 0 && (s = !0, o.push(...sx(n.rawRows, n.dataStartIndex, r)));
24472
24509
  }
24473
24510
  if (!s) return null;
24474
24511
  let c = a.editor.delimiter;
24475
- return { delimiter: OS(o, a.editor.options, c) };
24476
- }, RS = new Intl.Collator(), zS = {
24512
+ return { delimiter: AS(o, a.editor.options, c) };
24513
+ }, BS = new Intl.Collator(), VS = {
24477
24514
  merged: {},
24478
24515
  computed: {},
24479
24516
  multiselectDelimiters: {},
24480
24517
  pendingOptions: {},
24481
24518
  importedValues: {},
24482
24519
  isMatching: !1
24483
- }, BS = (e, t) => {
24520
+ }, HS = (e, t) => {
24484
24521
  let n = [], r = [];
24485
24522
  for (let [r, i] of t) {
24486
24523
  let t = e.get(r);
24487
- (!t || yx(t) !== yx(i)) && n.push([r, i]);
24524
+ (!t || Sx(t) !== Sx(i)) && n.push([r, i]);
24488
24525
  }
24489
24526
  for (let n of e.keys()) t.has(n) || r.push(n);
24490
24527
  return {
24491
24528
  changed: n,
24492
24529
  removed: r
24493
24530
  };
24494
- }, VS = class {
24531
+ }, US = class {
24495
24532
  deps;
24496
24533
  notify;
24497
24534
  seq = 0;
@@ -24501,7 +24538,7 @@ var _S = new Set([
24501
24538
  lastInputs = null;
24502
24539
  cellCache = /* @__PURE__ */ new Map();
24503
24540
  hookOutput = null;
24504
- _state = zS;
24541
+ _state = VS;
24505
24542
  constructor(e, t) {
24506
24543
  this.deps = e, this.notify = t;
24507
24544
  }
@@ -24518,12 +24555,12 @@ var _S = new Set([
24518
24555
  });
24519
24556
  return;
24520
24557
  }
24521
- let n = kS(e.headersByColumn, this.deps.columns), r = this.lastInputs;
24558
+ let n = jS(e.headersByColumn, this.deps.columns), r = this.lastInputs;
24522
24559
  if (this.lastInputs = {
24523
24560
  workbooks: t,
24524
24561
  associations: n
24525
24562
  }, r !== null && r.workbooks === t) {
24526
- let e = BS(r.associations, n);
24563
+ let e = HS(r.associations, n);
24527
24564
  if (e.changed.length === 0 && e.removed.length === 0) return;
24528
24565
  this.recomputeChanged(t, e);
24529
24566
  return;
@@ -24531,14 +24568,14 @@ var _S = new Set([
24531
24568
  this.cellCache.clear(), this.fullRecompute(t, e.headersByColumn);
24532
24569
  }
24533
24570
  fullRecompute(e, t) {
24534
- let { selectData: n, delimiters: r, rawCellsByColumn: i } = MS(e, t, this.deps.columns);
24571
+ let { selectData: n, delimiters: r, rawCellsByColumn: i } = PS(e, t, this.deps.columns);
24535
24572
  this.rawCellsByColumn = i, this.lastSelectData = n;
24536
24573
  for (let [e, t] of this.lastInputs?.associations ?? []) {
24537
24574
  let n = i[e];
24538
- n && this.cellCache.set(yx(t), n);
24575
+ n && this.cellCache.set(Sx(t), n);
24539
24576
  }
24540
24577
  let a = {};
24541
- for (let [e, t] of Object.entries(n)) a[e] = [...t.importedValues].sort(RS.compare);
24578
+ for (let [e, t] of Object.entries(n)) a[e] = [...t.importedValues].sort(BS.compare);
24542
24579
  this.patch({
24543
24580
  multiselectDelimiters: r,
24544
24581
  importedValues: a,
@@ -24551,13 +24588,13 @@ var _S = new Set([
24551
24588
  for (let [s, c] of t.changed) {
24552
24589
  let t = this.deps.columns.find((e) => e.id === s);
24553
24590
  if (!t) continue;
24554
- let l = yx(c), u = this.cellCache.get(l);
24555
- u || (u = jS(e, c), this.cellCache.set(l, u));
24556
- let d = AS(u, t);
24591
+ let l = Sx(c), u = this.cellCache.get(l);
24592
+ u || (u = NS(e, c), this.cellCache.set(l, u));
24593
+ let d = MS(u, t);
24557
24594
  d && (r[s] = u, n[s] = {
24558
24595
  importedValues: d.importedValues,
24559
24596
  options: d.options
24560
- }, d.isMultiselect && (i[s] = d.delimiter), a[s] = [...d.importedValues].sort(RS.compare), o[s] = this.computeMatches({ [s]: n[s] })[s]);
24597
+ }, d.isMultiselect && (i[s] = d.delimiter), a[s] = [...d.importedValues].sort(BS.compare), o[s] = this.computeMatches({ [s]: n[s] })[s]);
24561
24598
  }
24562
24599
  this.lastSelectData = n, this.rawCellsByColumn = r, this.patch({
24563
24600
  multiselectDelimiters: i,
@@ -24566,7 +24603,7 @@ var _S = new Set([
24566
24603
  });
24567
24604
  }
24568
24605
  computeMatches(e) {
24569
- return Object.keys(e).length === 0 ? {} : this.hookOutput ? wb(e, this.hookOutput, this.deps.extraSynonyms) : Cb(e, this.deps.extraSynonyms);
24606
+ return Object.keys(e).length === 0 ? {} : this.hookOutput ? Db(e, this.hookOutput, this.deps.extraSynonyms) : Eb(e, this.deps.extraSynonyms);
24570
24607
  }
24571
24608
  get hasSelectData() {
24572
24609
  return Object.keys(this.lastSelectData).length > 0;
@@ -24577,7 +24614,7 @@ var _S = new Set([
24577
24614
  let t = ++this.seq;
24578
24615
  this.patch({ isMatching: !0 });
24579
24616
  try {
24580
- let n = await lx(Promise.resolve(e(this.lastSelectData)), cx);
24617
+ let n = await fx(Promise.resolve(e(this.lastSelectData)), dx);
24581
24618
  if (t !== this.seq) return;
24582
24619
  this.hookOutput = n, this.patch({
24583
24620
  computed: this.computeMatches(this.lastSelectData),
@@ -24596,7 +24633,7 @@ var _S = new Set([
24596
24633
  this.hookOutput = null, this.cancelHook();
24597
24634
  }
24598
24635
  updateValueMapping(e, t, n) {
24599
- this.manual = PS(this.manual, e, t, n), this.patch({});
24636
+ this.manual = IS(this.manual, e, t, n), this.patch({});
24600
24637
  }
24601
24638
  applyValueMappingBatch(e, t) {
24602
24639
  if (t.length === 0) return;
@@ -24613,7 +24650,7 @@ var _S = new Set([
24613
24650
  [e]: t
24614
24651
  } }, r = this.rawCellsByColumn[e];
24615
24652
  if (r) {
24616
- let i = this.deps.columns.find((t) => t.id === e)?.editor, a = i && (i.type === "select" || i.type === "multiselect") ? i.options : [], o = ES(r, a, t), s = {
24653
+ let i = this.deps.columns.find((t) => t.id === e)?.editor, a = i && (i.type === "select" || i.type === "multiselect") ? i.options : [], o = OS(r, a, t), s = {
24617
24654
  importedValues: o,
24618
24655
  options: a
24619
24656
  };
@@ -24622,7 +24659,7 @@ var _S = new Set([
24622
24659
  [e]: s
24623
24660
  }, n.importedValues = {
24624
24661
  ...this._state.importedValues,
24625
- [e]: [...o].sort(RS.compare)
24662
+ [e]: [...o].sort(BS.compare)
24626
24663
  }, n.computed = {
24627
24664
  ...this._state.computed,
24628
24665
  [e]: this.computeMatches({ [e]: s })[e] ?? {}
@@ -24631,14 +24668,14 @@ var _S = new Set([
24631
24668
  this.patch(n);
24632
24669
  }
24633
24670
  addPendingOption(e, t) {
24634
- let n = FS(this._state.pendingOptions, e, t);
24671
+ let n = LS(this._state.pendingOptions, e, t);
24635
24672
  n !== this._state.pendingOptions && (this._state = {
24636
24673
  ...this._state,
24637
24674
  pendingOptions: n
24638
24675
  });
24639
24676
  }
24640
24677
  addPendingOptions(e, t) {
24641
- let n = IS(this._state.pendingOptions, e, t);
24678
+ let n = RS(this._state.pendingOptions, e, t);
24642
24679
  n !== this._state.pendingOptions && (this._state = {
24643
24680
  ...this._state,
24644
24681
  pendingOptions: n
@@ -24654,19 +24691,19 @@ var _S = new Set([
24654
24691
  };
24655
24692
  this._state = {
24656
24693
  ...t,
24657
- merged: NS(t.computed, this.manual)
24694
+ merged: FS(t.computed, this.manual)
24658
24695
  };
24659
24696
  }
24660
- }, HS = (e, t) => e.length === t.length && e.every((e, n) => e === t[n]), US = (e, t) => e === t ? !0 : e === null || t === null ? !1 : e.workbookId === t.workbookId && e.position === t.position && e.total === t.total, WS = class {
24661
- snapshots = new Ex();
24697
+ }, WS = (e, t) => e.length === t.length && e.every((e, n) => e === t[n]), GS = (e, t) => e === t ? !0 : e === null || t === null ? !1 : e.workbookId === t.workbookId && e.position === t.position && e.total === t.total, KS = class {
24698
+ snapshots = new kx();
24662
24699
  deps;
24663
24700
  parser;
24664
24701
  columnMapping;
24665
24702
  valueMapping;
24666
24703
  primaryKey;
24667
24704
  importRunner;
24668
- remoteSource = new TS();
24669
- navigator = new jx();
24705
+ remoteSource = new DS();
24706
+ navigator = new Px();
24670
24707
  hookGate;
24671
24708
  lastNavInputs = null;
24672
24709
  lastStepIds = [];
@@ -24674,17 +24711,17 @@ var _S = new Set([
24674
24711
  lastNavigation = null;
24675
24712
  importAbort = null;
24676
24713
  constructor(e) {
24677
- this.deps = e, this.parser = new SS(e.createParseClient(), e.synthesizeHeader), this.columnMapping = new Sx({
24714
+ this.deps = e, this.parser = new wS(e.createParseClient(), e.synthesizeHeader), this.columnMapping = new Tx({
24678
24715
  columns: e.columns,
24679
24716
  onColumnMatch: e.onColumnMatch,
24680
- extraSynonyms: e.extraSynonyms
24717
+ extraSynonyms: e.extraSynonyms.columns
24681
24718
  }, () => {
24682
24719
  this.primaryKey.refreshEligible(this.columnMapping.state.mappedColumnIds), this.refreshValueMatch(), this.commit();
24683
- }), this.valueMapping = new VS({
24720
+ }), this.valueMapping = new US({
24684
24721
  columns: e.columns,
24685
24722
  onValueMatch: e.onValueMatch,
24686
- extraSynonyms: e.extraSynonyms
24687
- }, () => this.commit()), this.primaryKey = new CS(e.columns, e.defaultPrimaryKey), this.importRunner = new Bx(() => this.commit()), this.hookGate = new Dx({
24723
+ extraSynonyms: e.extraSynonyms.values
24724
+ }, () => this.commit()), this.primaryKey = new TS(e.columns, e.defaultPrimaryKey), this.importRunner = new Ux(() => this.commit()), this.hookGate = new Ax({
24688
24725
  "column-matching": !!e.onColumnMatch,
24689
24726
  "match-values": !!e.onValueMatch
24690
24727
  }), this.commit();
@@ -24751,7 +24788,7 @@ var _S = new Set([
24751
24788
  this.valueMapping.setDelimiter(e, t), this.commit();
24752
24789
  }
24753
24790
  reapplyMultiselectDelimiter(e) {
24754
- let t = LS(this.parser.state.workbooks, this.columnMapping.state.headersByColumn, this.deps.columns, e);
24791
+ let t = zS(this.parser.state.workbooks, this.columnMapping.state.headersByColumn, this.deps.columns, e);
24755
24792
  t && this.valueMapping.setDelimiter(e, t.delimiter), this.commit();
24756
24793
  }
24757
24794
  addPendingOption(e, t) {
@@ -24787,8 +24824,8 @@ var _S = new Set([
24787
24824
  return t;
24788
24825
  });
24789
24826
  this.parser.stageGrid({
24790
- rawRows: nx(r, i),
24791
- detection: tx()
24827
+ rawRows: ax(r, i),
24828
+ detection: ix()
24792
24829
  }, {
24793
24830
  kind: "remote",
24794
24831
  sourceId: e.id
@@ -24825,7 +24862,7 @@ var _S = new Set([
24825
24862
  try {
24826
24863
  let t = await this.importRunner.run(() => $o(this.deps.store, "importing", Infinity, async () => {
24827
24864
  for (; a < i.length; a++) {
24828
- let { workbook: t, rawRows: r } = i[a], s = await uS({
24865
+ let { workbook: t, rawRows: r } = i[a], s = await fS({
24829
24866
  workbook: t,
24830
24867
  rawRows: r,
24831
24868
  signal: n.signal,
@@ -24836,7 +24873,9 @@ var _S = new Set([
24836
24873
  pendingColumns: this.columnMapping.state.pendingColumns,
24837
24874
  pendingOptions: this.valueMapping.state.pendingOptions,
24838
24875
  columnMapping: this.columnMapping.state.byWorkbook[t.id] ?? {},
24876
+ baselineColumnMapping: this.columnMapping.state.baseline[t.id] ?? {},
24839
24877
  valueMapping: this.valueMapping.state.merged,
24878
+ baselineValueMapping: this.valueMapping.state.computed,
24840
24879
  multiselectDelimiters: this.valueMapping.state.multiselectDelimiters,
24841
24880
  primaryKey: this.primaryKey.state.selected,
24842
24881
  extraSynonyms: this.deps.extraSynonyms,
@@ -24846,7 +24885,7 @@ var _S = new Set([
24846
24885
  buildMappings: (e) => this.buildMappings(t, e)
24847
24886
  });
24848
24887
  if (s.outcome === "cancelled") return "cancelled";
24849
- s.collapsed && o.push(Gx(t)), this.importRunner.markImported(t.id);
24888
+ s.collapsed && o.push(qx(t)), this.importRunner.markImported(t.id);
24850
24889
  }
24851
24890
  return "completed";
24852
24891
  }));
@@ -24872,7 +24911,7 @@ var _S = new Set([
24872
24911
  this.importAbort?.abort();
24873
24912
  }
24874
24913
  buildMappings(e, t) {
24875
- return zx({
24914
+ return Hx({
24876
24915
  rawRows: t,
24877
24916
  workbook: e,
24878
24917
  columnMapping: this.columnMapping.state.byWorkbook[e.id] ?? {},
@@ -24907,7 +24946,7 @@ var _S = new Set([
24907
24946
  maybeRunStepHook() {
24908
24947
  let e = this.lastStepIds[this.navigator.state.activeStepIndex], { workbooks: t, unionHeaders: n } = this.parser.state;
24909
24948
  if (!(t.length === 0 || n.length === 0)) if (e === "column-matching") {
24910
- let e = Ox(this.lastStepIds, this.navigator.state.activeStepIndex, t.map((e) => e.id)), n = e ? t.find((t) => t.id === e.workbookId) : void 0;
24949
+ let e = jx(this.lastStepIds, this.navigator.state.activeStepIndex, t.map((e) => e.id)), n = e ? t.find((t) => t.id === e.workbookId) : void 0;
24911
24950
  n && n.headers.length > 0 && this.hookGate.take("column-matching", n.id) && this.columnMapping.runHook(n.id, n.headers);
24912
24951
  } else e === "match-values" && this.valueMapping.hasSelectData && this.hookGate.take("match-values") && this.valueMapping.runHook();
24913
24952
  }
@@ -24935,7 +24974,7 @@ var _S = new Set([
24935
24974
  if (!this.lastNavInputs || this.lastNavInputs.parser !== r.parser || this.lastNavInputs.mapping !== r.mapping || this.lastNavInputs.eligible !== r.eligible) {
24936
24975
  let i = new Set(t), a = this.deps.columns.some((e) => (e.editor?.type === "select" || e.editor?.type === "multiselect") && i.has(e.id)), o = [];
24937
24976
  for (let t of e.workbooks) t.detection.review.kind !== "none" && o.push(t.id);
24938
- HS(o, this.lastHeaderReviewIds) || (this.lastHeaderReviewIds = o), this.lastStepIds = wx({
24977
+ WS(o, this.lastHeaderReviewIds) || (this.lastHeaderReviewIds = o), this.lastStepIds = Dx({
24939
24978
  headerReviewCount: this.lastHeaderReviewIds.length,
24940
24979
  columnMatchingCount: e.workbooks.length,
24941
24980
  hasSelectColumns: a,
@@ -24950,10 +24989,10 @@ var _S = new Set([
24950
24989
  currentStepIndex: a,
24951
24990
  isFirstStep: i === 0,
24952
24991
  isLastStep: i === this.lastStepIds.length - 1,
24953
- headerReview: Ax(this.lastStepIds, i, this.lastHeaderReviewIds),
24954
- columnMatching: Ox(this.lastStepIds, i, e.workbooks.map((e) => e.id))
24992
+ headerReview: Nx(this.lastStepIds, i, this.lastHeaderReviewIds),
24993
+ columnMatching: jx(this.lastStepIds, i, e.workbooks.map((e) => e.id))
24955
24994
  }, s = this.lastNavigation;
24956
- return s && s.stepIds === o.stepIds && s.activeStepIndex === o.activeStepIndex && s.currentStepIndex === o.currentStepIndex && s.isFirstStep === o.isFirstStep && s.isLastStep === o.isLastStep && US(s.headerReview, o.headerReview) && kx(s.columnMatching, o.columnMatching) ? s : (this.lastNavigation = o, o);
24995
+ return s && s.stepIds === o.stepIds && s.activeStepIndex === o.activeStepIndex && s.currentStepIndex === o.currentStepIndex && s.isFirstStep === o.isFirstStep && s.isLastStep === o.isLastStep && GS(s.headerReview, o.headerReview) && Mx(s.columnMatching, o.columnMatching) ? s : (this.lastNavigation = o, o);
24957
24996
  }
24958
24997
  commit() {
24959
24998
  this.snapshots.commit({
@@ -24966,7 +25005,7 @@ var _S = new Set([
24966
25005
  remoteSource: this.remoteSource.state
24967
25006
  });
24968
25007
  }
24969
- }, GS = (e, t) => {
25008
+ }, qS = (e, t) => {
24970
25009
  let n = /* @__PURE__ */ new Map();
24971
25010
  for (let e of t) {
24972
25011
  let t = e.toLowerCase();
@@ -24992,7 +25031,7 @@ var _S = new Set([
24992
25031
  createdOptions: r,
24993
25032
  updates: i
24994
25033
  };
24995
- }, KS = (e, t) => {
25034
+ }, JS = (e, t) => {
24996
25035
  let n = 0;
24997
25036
  for (let r of e.headers) t[r] && n++;
24998
25037
  return {
@@ -25003,12 +25042,12 @@ var _S = new Set([
25003
25042
  matchedCount: n,
25004
25043
  allMatched: n === e.headers.length
25005
25044
  };
25006
- }, qS = {}, JS = {}, YS = [], XS = () => {
25007
- let { columns: e, enableCreateColumn: t } = Z(), { t: n } = q(), r = zy(), i = Xy(r, Yy), a = Xy(r, Vy), o = i ? a.find((e) => e.id === i.workbookId) ?? null : null, { byWorkbook: s, pendingColumns: c, autoMatched: l, isMatching: u } = Xy(r, Hy), d = o ? s[o.id] ?? qS : qS, p = o?.id ?? null, m = f((e, t) => {
25045
+ }, YS = {}, XS = {}, ZS = [], QS = () => {
25046
+ let { columns: e, enableCreateColumn: t } = Z(), { t: n } = q(), r = zy(), i = Xy(r, Yy), a = Xy(r, Vy), o = i ? a.find((e) => e.id === i.workbookId) ?? null : null, { byWorkbook: s, pendingColumns: c, autoMatched: l, isMatching: u } = Xy(r, Hy), d = o ? s[o.id] ?? YS : YS, p = o?.id ?? null, m = f((e, t) => {
25008
25047
  p !== null && r.updateColumnMapping(p, e, t);
25009
25048
  }, [r, p]), h = f((e) => {
25010
25049
  r.setPendingColumns(e);
25011
- }, [r]), g = v(() => o ? KS(o, d) : null, [o, d]), _ = (i?.total ?? 0) > 1, x = g?.headers ?? YS, [S, w] = b(null), [T, E] = b({}), D = y(null), O = f((e) => T[e] ?? !0, [T]), k = f((e, t) => {
25050
+ }, [r]), g = v(() => o ? JS(o, d) : null, [o, d]), _ = (i?.total ?? 0) > 1, x = g?.headers ?? ZS, [S, w] = b(null), [T, E] = b({}), D = y(null), O = f((e) => T[e] ?? !0, [T]), k = f((e, t) => {
25012
25051
  E((n) => ({
25013
25052
  ...n,
25014
25053
  [e]: t
@@ -25029,7 +25068,7 @@ var _S = new Set([
25029
25068
  }]), m(D.current, n), D.current = null, w(null);
25030
25069
  }, [m, h]), M = f(() => {
25031
25070
  D.current = null, w(null);
25032
- }, []), N = v(() => [...e.map((e) => e.title), ...c.map((e) => e.title)], [e, c]), P = p ? l[p] ?? JS : JS, F = v(() => {
25071
+ }, []), N = v(() => [...e.map((e) => e.title), ...c.map((e) => e.title)], [e, c]), P = p ? l[p] ?? XS : XS, F = v(() => {
25033
25072
  let r = {
25034
25073
  text: n("dataEditor.uploader.matchColumns.bestMatch"),
25035
25074
  color: "green"
@@ -25052,7 +25091,7 @@ var _S = new Set([
25052
25091
  id: `${n}_d`,
25053
25092
  type: "divider"
25054
25093
  }, {
25055
- id: Tb,
25094
+ id: Ob,
25056
25095
  text: a,
25057
25096
  icon: /* @__PURE__ */ C(Se, { size: "1rem" })
25058
25097
  }), [n, s];
@@ -25088,19 +25127,19 @@ var _S = new Set([
25088
25127
  submitCreate: j,
25089
25128
  closeCreate: M
25090
25129
  };
25091
- }, ZS = s(null);
25092
- function QS({ children: e }) {
25093
- let t = XS();
25094
- return /* @__PURE__ */ C(ZS.Provider, {
25130
+ }, $S = s(null);
25131
+ function eC({ children: e }) {
25132
+ let t = QS();
25133
+ return /* @__PURE__ */ C($S.Provider, {
25095
25134
  value: t,
25096
25135
  children: e
25097
25136
  });
25098
25137
  }
25099
- var $S = () => {
25100
- let e = p(ZS);
25138
+ var tC = () => {
25139
+ let e = p($S);
25101
25140
  if (!e) throw Error("useColumnMatching must be used within ColumnMatchingProvider");
25102
25141
  return e;
25103
- }, eC = ({ name: e, fileName: t, size: n = "sm", as: r = "div", className: i }) => /* @__PURE__ */ w(J, {
25142
+ }, nC = ({ name: e, fileName: t, size: n = "sm", as: r = "div", className: i }) => /* @__PURE__ */ w(J, {
25104
25143
  as: r,
25105
25144
  size: n,
25106
25145
  weight: "medium",
@@ -25120,15 +25159,15 @@ var $S = () => {
25120
25159
  tooltipProps: { placement: "bottom-start" },
25121
25160
  children: e
25122
25161
  })]
25123
- }), tC = ({ view: e }) => {
25124
- let { t } = q(), { isMatching: n, isMultiWorkbook: r, isShowMatched: i, setShowMatched: a } = $S(), o = e.allMatched ? "green" : "yellow", s = !n, c = f((t) => {
25162
+ }), rC = ({ view: e }) => {
25163
+ let { t } = q(), { isMatching: n, isMultiWorkbook: r, isShowMatched: i, setShowMatched: a } = tC(), o = e.allMatched ? "green" : "yellow", s = !n, c = f((t) => {
25125
25164
  a(e.workbookId, t);
25126
25165
  }, [a, e.workbookId]);
25127
25166
  return /* @__PURE__ */ C("header", {
25128
25167
  className: "updog__column-matching__header",
25129
25168
  children: /* @__PURE__ */ w("div", {
25130
25169
  className: "updog__column-matching__header-inner",
25131
- children: [r && /* @__PURE__ */ C(eC, {
25170
+ children: [r && /* @__PURE__ */ C(nC, {
25132
25171
  name: e.name,
25133
25172
  fileName: e.fileName,
25134
25173
  className: "updog__column-matching__header-source"
@@ -25172,7 +25211,7 @@ var $S = () => {
25172
25211
  })]
25173
25212
  })
25174
25213
  });
25175
- }, nC = d(({ csvHeader: e, mappedValue: t, options: n, autoMatchId: r, placeholder: i, isMatching: a, onSelectChange: o, onClear: s }) => {
25214
+ }, iC = d(({ csvHeader: e, mappedValue: t, options: n, autoMatchId: r, placeholder: i, isMatching: a, onSelectChange: o, onClear: s }) => {
25176
25215
  let { t: c } = q(), l = h(), u = !t, d = t?.startsWith("__dynamic__:") && !!r && !a, p = u && !a, m = f((t) => {
25177
25216
  o(e, t);
25178
25217
  }, [e, o]), g = f(() => {
@@ -25236,8 +25275,8 @@ var $S = () => {
25236
25275
  })
25237
25276
  ]
25238
25277
  });
25239
- }), rC = ({ view: e }) => {
25240
- let { isMatching: t, isShowMatched: n, placeholder: r, getRowData: i, onSelectChange: a, onClear: o } = $S(), { t: s } = q(), c = n(e.workbookId), l = e.headers.map((e) => ({
25278
+ }), aC = ({ view: e }) => {
25279
+ let { isMatching: t, isShowMatched: n, placeholder: r, getRowData: i, onSelectChange: a, onClear: o } = tC(), { t: s } = q(), c = n(e.workbookId), l = e.headers.map((e) => ({
25241
25280
  csvHeader: e,
25242
25281
  ...i(e)
25243
25282
  })).filter((e) => c || !e.mappedValue);
@@ -25255,7 +25294,7 @@ var $S = () => {
25255
25294
  className: "updog__column-matching__content",
25256
25295
  children: /* @__PURE__ */ C("div", {
25257
25296
  className: "updog__column-matching__content-inner",
25258
- children: l.map(({ csvHeader: e, mappedValue: n, options: i, autoMatchId: s }) => /* @__PURE__ */ C(nC, {
25297
+ children: l.map(({ csvHeader: e, mappedValue: n, options: i, autoMatchId: s }) => /* @__PURE__ */ C(iC, {
25259
25298
  csvHeader: e,
25260
25299
  mappedValue: n,
25261
25300
  options: i,
@@ -25267,8 +25306,8 @@ var $S = () => {
25267
25306
  }, e))
25268
25307
  })
25269
25308
  });
25270
- }, iC = () => {
25271
- let { createModalValues: e, existingNames: t, submitCreate: n, closeCreate: r } = $S();
25309
+ }, oC = () => {
25310
+ let { createModalValues: e, existingNames: t, submitCreate: n, closeCreate: r } = tC();
25272
25311
  return e ? /* @__PURE__ */ C(Lu, {
25273
25312
  open: !0,
25274
25313
  onClose: r,
@@ -25276,23 +25315,23 @@ var $S = () => {
25276
25315
  existingNames: t,
25277
25316
  onSubmit: n
25278
25317
  }) : null;
25279
- }, aC = () => {
25280
- let { view: e } = $S();
25318
+ }, sC = () => {
25319
+ let { view: e } = tC();
25281
25320
  return e ? /* @__PURE__ */ w("div", {
25282
25321
  className: "updog__column-matching",
25283
25322
  children: [
25284
- /* @__PURE__ */ C(tC, { view: e }),
25285
25323
  /* @__PURE__ */ C(rC, { view: e }),
25286
- /* @__PURE__ */ C(iC, {})
25324
+ /* @__PURE__ */ C(aC, { view: e }),
25325
+ /* @__PURE__ */ C(oC, {})
25287
25326
  ]
25288
25327
  }) : null;
25289
- }, oC = () => Xy(zy(), Jy) ? /* @__PURE__ */ C(vu, { children: /* @__PURE__ */ w(gu, { children: [/* @__PURE__ */ C("div", {
25328
+ }, cC = () => Xy(zy(), Jy) ? /* @__PURE__ */ C(vu, { children: /* @__PURE__ */ w(gu, { children: [/* @__PURE__ */ C("div", {
25290
25329
  className: "updog__step-column-matching__content updog__scrollbar",
25291
- children: /* @__PURE__ */ C(QS, { children: /* @__PURE__ */ C(aC, {}) })
25330
+ children: /* @__PURE__ */ C(eC, { children: /* @__PURE__ */ C(sC, {}) })
25292
25331
  }), /* @__PURE__ */ C(tb, {})] }) }) : null;
25293
25332
  //#endregion
25294
25333
  //#region src/components/DataUploader/components/StepHeaderSelection/context/useViewModel.tsx
25295
- function sC(e, t, n, r, i) {
25334
+ function lC(e, t, n, r, i) {
25296
25335
  return v(() => ({
25297
25336
  sample: e,
25298
25337
  columnHeaders: t,
@@ -25309,20 +25348,20 @@ function sC(e, t, n, r, i) {
25309
25348
  }
25310
25349
  //#endregion
25311
25350
  //#region src/components/DataUploader/components/StepHeaderSelection/context/index.tsx
25312
- var cC = s(null);
25313
- function lC({ sample: e, columnHeaders: t, selectedRow: n, selectRow: r, noHeader: i, children: a }) {
25314
- let o = sC(e, t, n, r, i);
25315
- return /* @__PURE__ */ C(cC.Provider, {
25351
+ var uC = s(null);
25352
+ function dC({ sample: e, columnHeaders: t, selectedRow: n, selectRow: r, noHeader: i, children: a }) {
25353
+ let o = lC(e, t, n, r, i);
25354
+ return /* @__PURE__ */ C(uC.Provider, {
25316
25355
  value: o,
25317
25356
  children: a
25318
25357
  });
25319
25358
  }
25320
- var uC = () => {
25321
- let e = p(cC);
25359
+ var fC = () => {
25360
+ let e = p(uC);
25322
25361
  if (!e) throw Error("useHeaderSelection must be used within HeaderSelectionProvider");
25323
25362
  return e;
25324
- }, dC = () => {
25325
- let { sample: e, columnHeaders: t, selectedRow: n, selectRow: r, noHeader: i } = uC(), { headers: a, rows: o } = v(() => {
25363
+ }, pC = () => {
25364
+ let { sample: e, columnHeaders: t, selectedRow: n, selectRow: r, noHeader: i } = fC(), { headers: a, rows: o } = v(() => {
25326
25365
  let n = t.length;
25327
25366
  return {
25328
25367
  headers: t.map((e) => i ? e : ""),
@@ -25342,7 +25381,7 @@ var uC = () => {
25342
25381
  selectedRow: i ? void 0 : n,
25343
25382
  onSelectRow: i ? void 0 : r
25344
25383
  });
25345
- }, fC = () => {
25384
+ }, mC = () => {
25346
25385
  let { t: e } = q(), t = zy(), { headerReview: n } = Xy(t, Gy), r = Xy(t, Vy), i = n ? r.find((e) => e.id === n.workbookId) ?? null : null, a = f((e) => {
25347
25386
  i && t.setHeaderRowIndex(i.id, e);
25348
25387
  }, [t, i]), o = f((e) => {
@@ -25350,7 +25389,7 @@ var uC = () => {
25350
25389
  }, [a, i]);
25351
25390
  if (!i) return null;
25352
25391
  let s = i.rawRows.slice(0, 50), c = i.headerRowIndex < 0, l = c ? void 0 : i.headerRowIndex, u = i.origin.kind === "sheet" ? i.origin.file.name : null;
25353
- return /* @__PURE__ */ C(vu, { children: /* @__PURE__ */ C(gu, { children: /* @__PURE__ */ w(lC, {
25392
+ return /* @__PURE__ */ C(vu, { children: /* @__PURE__ */ C(gu, { children: /* @__PURE__ */ w(dC, {
25354
25393
  sample: s,
25355
25394
  columnHeaders: i.headers,
25356
25395
  selectedRow: l,
@@ -25359,7 +25398,7 @@ var uC = () => {
25359
25398
  children: [/* @__PURE__ */ w("div", {
25360
25399
  className: "updog__step-header-selection__content updog__scrollbar",
25361
25400
  children: [
25362
- /* @__PURE__ */ C(eC, {
25401
+ /* @__PURE__ */ C(nC, {
25363
25402
  as: "h3",
25364
25403
  size: "md",
25365
25404
  name: i.name,
@@ -25374,11 +25413,11 @@ var uC = () => {
25374
25413
  label: e("dataEditor.uploader.headerSelection.noHeaderLabel")
25375
25414
  })
25376
25415
  }),
25377
- /* @__PURE__ */ C(dC, {})
25416
+ /* @__PURE__ */ C(pC, {})
25378
25417
  ]
25379
25418
  }), /* @__PURE__ */ C(tb, {})]
25380
25419
  }) }) });
25381
- }, pC = ({ open: e, existingOptions: t, initialName: n, onClose: r, onSubmit: i }) => {
25420
+ }, hC = ({ open: e, existingOptions: t, initialName: n, onClose: r, onSubmit: i }) => {
25382
25421
  let { t: a } = q();
25383
25422
  return /* @__PURE__ */ C(Bi, {
25384
25423
  open: e,
@@ -25391,7 +25430,7 @@ var uC = () => {
25391
25430
  onSubmit: i
25392
25431
  })
25393
25432
  });
25394
- }, mC = "updog__value-matching__create-divider", hC = ({ options: e, extraOptions: t, enableCustomValue: n, createLabel: r, bestMatch: i }) => {
25433
+ }, gC = "updog__value-matching__create-divider", _C = ({ options: e, extraOptions: t, enableCustomValue: n, createLabel: r, bestMatch: i }) => {
25395
25434
  let a = e.map((e) => ({
25396
25435
  id: e,
25397
25436
  text: e,
@@ -25404,14 +25443,14 @@ var uC = () => {
25404
25443
  text: e
25405
25444
  }));
25406
25445
  return a.push({
25407
- id: mC,
25446
+ id: gC,
25408
25447
  type: "divider"
25409
25448
  }, {
25410
25449
  id: Xo,
25411
25450
  text: r,
25412
25451
  icon: /* @__PURE__ */ C(Se, { size: "1rem" })
25413
25452
  }), a;
25414
- }, gC = (e, t) => {
25453
+ }, vC = (e, t) => {
25415
25454
  let n = e.values.filter((e) => t || e.mapped === void 0);
25416
25455
  return e.values.length > 500 && n.length > 3 ? {
25417
25456
  visible: n.slice(0, 3),
@@ -25420,7 +25459,7 @@ var uC = () => {
25420
25459
  visible: n,
25421
25460
  overflow: 0
25422
25461
  };
25423
- }, _C = () => {
25462
+ }, yC = () => {
25424
25463
  let { columns: e } = Z(), { t } = q(), n = zy(), r = Xy(n, Jy), { mappedColumnIds: i } = Xy(n, Hy), { merged: a, computed: o, multiselectDelimiters: s, pendingOptions: c, importedValues: l, isMatching: u } = Xy(n, Uy), d = f((e, t, r) => n.updateValueMapping(e, t, r), [n]), p = f((e, t) => n.setMultiselectDelimiter(e, t), [n]), h = f((e) => n.reapplyMultiselectDelimiter(e), [n]), g = f((e, t) => n.addPendingOption(e, t), [n]), [_, x] = b({}), [S, C] = b({}), [w, T] = b(null), E = y(!1), D = v(() => {
25425
25464
  if (!r) return [];
25426
25465
  let t = [];
@@ -25469,10 +25508,10 @@ var uC = () => {
25469
25508
  color: "green"
25470
25509
  }, n = t("dataEditor.uploader.matchValues.createOption"), r = {};
25471
25510
  for (let t of D) {
25472
- let i = c[t.columnId] ?? [], a = {}, { visible: s } = gC(t, _[t.columnId] ?? !0);
25511
+ let i = c[t.columnId] ?? [], a = {}, { visible: s } = vC(t, _[t.columnId] ?? !0);
25473
25512
  for (let r of s) {
25474
25513
  let s = o[t.columnId]?.[r.imported];
25475
- a[r.imported] = hC({
25514
+ a[r.imported] = _C({
25476
25515
  options: t.options,
25477
25516
  extraOptions: i,
25478
25517
  enableCustomValue: t.enableCustomValue,
@@ -25492,7 +25531,7 @@ var uC = () => {
25492
25531
  c,
25493
25532
  _,
25494
25533
  t
25495
- ]), k = f((e) => _[e] ?? !0, [_]), A = f((e) => S[e] ?? !1, [S]), j = f((e) => gC(e, _[e.columnId] ?? !0), [_]), M = f((e, t) => O[e]?.[t] ?? [], [O]), N = f((e, t) => {
25534
+ ]), k = f((e) => _[e] ?? !0, [_]), A = f((e) => S[e] ?? !1, [S]), j = f((e) => vC(e, _[e.columnId] ?? !0), [_]), M = f((e, t) => O[e]?.[t] ?? [], [O]), N = f((e, t) => {
25496
25535
  x((n) => ({
25497
25536
  ...n,
25498
25537
  [e]: t
@@ -25544,20 +25583,20 @@ var uC = () => {
25544
25583
  submitCreate: z,
25545
25584
  closeCreate: B
25546
25585
  };
25547
- }, vC = s(null);
25548
- function yC({ children: e }) {
25549
- let t = _C();
25550
- return /* @__PURE__ */ C(vC.Provider, {
25586
+ }, bC = s(null);
25587
+ function xC({ children: e }) {
25588
+ let t = yC();
25589
+ return /* @__PURE__ */ C(bC.Provider, {
25551
25590
  value: t,
25552
25591
  children: e
25553
25592
  });
25554
25593
  }
25555
- var bC = () => {
25556
- let e = p(vC);
25594
+ var SC = () => {
25595
+ let e = p(bC);
25557
25596
  if (!e) throw Error("useValueMatching must be used within ValueMatchingProvider");
25558
25597
  return e;
25559
- }, xC = ({ section: e, panelId: t }) => {
25560
- let { t: n } = q(), { isShowMatched: r, isCollapsed: i, setShowMatched: a, toggleCollapsed: o, isMatching: s } = bC(), c = i(e.columnId), l = !s, u = n(c ? "dataEditor.common.expand" : "dataEditor.common.collapse"), d = f((t) => a(e.columnId, t), [a, e.columnId]), p = f(() => o(e.columnId), [o, e.columnId]);
25598
+ }, CC = ({ section: e, panelId: t }) => {
25599
+ let { t: n } = q(), { isShowMatched: r, isCollapsed: i, setShowMatched: a, toggleCollapsed: o, isMatching: s } = SC(), c = i(e.columnId), l = !s, u = n(c ? "dataEditor.common.expand" : "dataEditor.common.collapse"), d = f((t) => a(e.columnId, t), [a, e.columnId]), p = f(() => o(e.columnId), [o, e.columnId]);
25561
25600
  return /* @__PURE__ */ w("header", {
25562
25601
  className: "updog__value-matching__section-header",
25563
25602
  children: [/* @__PURE__ */ C("div", {
@@ -25604,14 +25643,14 @@ var bC = () => {
25604
25643
  })
25605
25644
  })]
25606
25645
  });
25607
- }, SC = {
25646
+ }, wC = {
25608
25647
  ",": ",",
25609
25648
  ";": ";",
25610
25649
  "|": "|",
25611
25650
  "\n": "\\n",
25612
25651
  " ": "\\t"
25613
- }, CC = (e) => e === null ? "" : SC[e] ?? e, wC = ({ section: e }) => {
25614
- let { t } = q(), { changeDelimiter: n, reapplyDelimiter: r } = bC(), i = y(e.delimiter), a = CC(e.delimiter), [o, s] = b(a), { debouncedValue: c } = Za(o, 300), l = y(a);
25652
+ }, TC = (e) => e === null ? "" : wC[e] ?? e, EC = ({ section: e }) => {
25653
+ let { t } = q(), { changeDelimiter: n, reapplyDelimiter: r } = SC(), i = y(e.delimiter), a = TC(e.delimiter), [o, s] = b(a), { debouncedValue: c } = Za(o, 300), l = y(a);
25615
25654
  m(() => {
25616
25655
  s(a), l.current = a;
25617
25656
  }, [a]), m(() => {
@@ -25654,7 +25693,7 @@ var bC = () => {
25654
25693
  })
25655
25694
  ]
25656
25695
  });
25657
- }, TC = d(({ value: e, options: t, isMatching: n = !1, fluid: r = !1, onSelect: i }) => {
25696
+ }, DC = d(({ value: e, options: t, isMatching: n = !1, fluid: r = !1, onSelect: i }) => {
25658
25697
  let { t: a } = q(), o = h(), s = e.mapped === void 0, c = s && !n, l = f((t) => {
25659
25698
  i(e.imported, t);
25660
25699
  }, [i, e.imported]), u = f(() => {
@@ -25708,28 +25747,28 @@ var bC = () => {
25708
25747
  })
25709
25748
  ]
25710
25749
  });
25711
- }), EC = ({ section: e, value: t }) => {
25712
- let { getSelectOptions: n, selectValue: r, isMatching: i } = bC(), a = f((t, n) => {
25750
+ }), OC = ({ section: e, value: t }) => {
25751
+ let { getSelectOptions: n, selectValue: r, isMatching: i } = SC(), a = f((t, n) => {
25713
25752
  r(e.columnId, t, n);
25714
25753
  }, [r, e.columnId]);
25715
- return /* @__PURE__ */ C(TC, {
25754
+ return /* @__PURE__ */ C(DC, {
25716
25755
  value: t,
25717
25756
  options: n(e.columnId, t.imported),
25718
25757
  isMatching: i,
25719
25758
  onSelect: a
25720
25759
  });
25721
- }, DC = (e, t) => {
25760
+ }, kC = (e, t) => {
25722
25761
  let n = new Map(e.map((e) => [e.imported, e.mapped])), r = [];
25723
25762
  for (let e of t) n.get(e.imported) !== e.mapped && r.push({
25724
25763
  importedValue: e.imported,
25725
25764
  mappedValue: e.mapped
25726
25765
  });
25727
25766
  return r;
25728
- }, OC = ({ scrollTop: e, viewportHeight: t, rowHeight: n, count: r, overscan: i }) => ({
25767
+ }, AC = ({ scrollTop: e, viewportHeight: t, rowHeight: n, count: r, overscan: i }) => ({
25729
25768
  start: Math.max(0, Math.floor(e / n) - i),
25730
25769
  end: Math.min(r, Math.ceil((e + t) / n) + i)
25731
- }), kC = 3.625, AC = 5, jC = 16, MC = ({ values: e, options: t, onSelect: n }) => {
25732
- let r = y(null), [i, a] = b(jC), [o, s] = b({
25770
+ }), jC = 3.625, MC = 5, NC = 16, PC = ({ values: e, options: t, onSelect: n }) => {
25771
+ let r = y(null), [i, a] = b(NC), [o, s] = b({
25733
25772
  start: 0,
25734
25773
  end: 0
25735
25774
  });
@@ -25740,12 +25779,12 @@ var bC = () => {
25740
25779
  let c = f(() => {
25741
25780
  let t = r.current;
25742
25781
  if (!t) return;
25743
- let n = OC({
25782
+ let n = AC({
25744
25783
  scrollTop: t.scrollTop,
25745
25784
  viewportHeight: t.clientHeight,
25746
- rowHeight: kC * i,
25785
+ rowHeight: jC * i,
25747
25786
  count: e.length,
25748
- overscan: AC
25787
+ overscan: MC
25749
25788
  });
25750
25789
  s((e) => e.start === n.start && e.end === n.end ? e : n);
25751
25790
  }, [i, e.length]);
@@ -25765,14 +25804,14 @@ var bC = () => {
25765
25804
  className: "updog__values-drawer__list updog__scrollbar",
25766
25805
  children: /* @__PURE__ */ C("div", {
25767
25806
  className: "updog__values-drawer__list-inner",
25768
- style: { height: `${e.length * kC}rem` },
25807
+ style: { height: `${e.length * jC}rem` },
25769
25808
  children: l.map((e, r) => /* @__PURE__ */ C("div", {
25770
25809
  className: "updog__values-drawer__list-item",
25771
25810
  style: {
25772
- height: `${kC}rem`,
25773
- transform: `translateY(${(o.start + r) * kC}rem)`
25811
+ height: `${jC}rem`,
25812
+ transform: `translateY(${(o.start + r) * jC}rem)`
25774
25813
  },
25775
- children: /* @__PURE__ */ C(TC, {
25814
+ children: /* @__PURE__ */ C(DC, {
25776
25815
  value: e,
25777
25816
  options: t,
25778
25817
  fluid: !0,
@@ -25781,7 +25820,7 @@ var bC = () => {
25781
25820
  }, e.imported))
25782
25821
  })
25783
25822
  });
25784
- }, NC = ({ section: e, onCancel: t, onSave: n }) => {
25823
+ }, FC = ({ section: e, onCancel: t, onSave: n }) => {
25785
25824
  let { t: r } = q(), [i] = b(e.values), [a, o] = b(i), [s] = b(e.delimiter), [c, l] = b([]), [u, d] = b(null), p = v(() => [
25786
25825
  ...e.options,
25787
25826
  ...e.pendingOptions,
@@ -25790,7 +25829,7 @@ var bC = () => {
25790
25829
  e.options,
25791
25830
  e.pendingOptions,
25792
25831
  c
25793
- ]), m = v(() => hC({
25832
+ ]), m = v(() => _C({
25794
25833
  options: e.options,
25795
25834
  extraOptions: [...e.pendingOptions, ...c],
25796
25835
  enableCustomValue: e.enableCustomValue,
@@ -25817,7 +25856,7 @@ var bC = () => {
25817
25856
  }, []), y = f((e) => {
25818
25857
  u !== null && (l((t) => [...t, e]), h(u, e), d(null));
25819
25858
  }, [u, h]), x = f(() => {
25820
- let e = GS(a, p);
25859
+ let e = qS(a, p);
25821
25860
  if (e.updates.length === 0) return;
25822
25861
  let t = new Map(e.updates.map((e) => [e.importedValue, e.mappedValue]));
25823
25862
  l((t) => [...t, ...e.createdOptions]), o((e) => e.map((e) => {
@@ -25829,7 +25868,7 @@ var bC = () => {
25829
25868
  }));
25830
25869
  }, [a, p]), T = f(() => {
25831
25870
  n({
25832
- updates: DC(i, a),
25871
+ updates: kC(i, a),
25833
25872
  delimiter: s,
25834
25873
  createdOptions: c
25835
25874
  });
@@ -25853,7 +25892,7 @@ var bC = () => {
25853
25892
  }) }),
25854
25893
  /* @__PURE__ */ C(La, {
25855
25894
  className: "updog__values-drawer__body",
25856
- children: /* @__PURE__ */ C(MC, {
25895
+ children: /* @__PURE__ */ C(PC, {
25857
25896
  values: a,
25858
25897
  options: m,
25859
25898
  onSelect: g
@@ -25878,7 +25917,7 @@ var bC = () => {
25878
25917
  children: r("dataEditor.common.save")
25879
25918
  })
25880
25919
  ] }),
25881
- u !== null && /* @__PURE__ */ C(pC, {
25920
+ u !== null && /* @__PURE__ */ C(hC, {
25882
25921
  open: !0,
25883
25922
  existingOptions: p,
25884
25923
  initialName: u,
@@ -25886,8 +25925,8 @@ var bC = () => {
25886
25925
  onSubmit: y
25887
25926
  })
25888
25927
  ] });
25889
- }, PC = ({ open: e, onDismiss: t, section: n }) => {
25890
- let { applyValueMappingBatch: r } = bC();
25928
+ }, IC = ({ open: e, onDismiss: t, section: n }) => {
25929
+ let { applyValueMappingBatch: r } = SC();
25891
25930
  return /* @__PURE__ */ C(za, {
25892
25931
  open: e,
25893
25932
  onOpenChange: f((e) => {
@@ -25895,7 +25934,7 @@ var bC = () => {
25895
25934
  }, [t]),
25896
25935
  className: "updog__values-drawer",
25897
25936
  closeOnOutsidePress: !1,
25898
- children: /* @__PURE__ */ C(NC, {
25937
+ children: /* @__PURE__ */ C(FC, {
25899
25938
  section: n,
25900
25939
  onCancel: t,
25901
25940
  onSave: f((e) => {
@@ -25907,8 +25946,8 @@ var bC = () => {
25907
25946
  ])
25908
25947
  })
25909
25948
  });
25910
- }, FC = ({ section: e }) => {
25911
- let { t } = q(), { getVisibleValues: n } = bC(), { visible: r, overflow: i } = n(e), a = r.length === 0, { value: o, setTrue: s, setFalse: c } = Uo(!1);
25949
+ }, LC = ({ section: e }) => {
25950
+ let { t } = q(), { getVisibleValues: n } = SC(), { visible: r, overflow: i } = n(e), a = r.length === 0, { value: o, setTrue: s, setFalse: c } = Uo(!1);
25912
25951
  return /* @__PURE__ */ w("div", {
25913
25952
  className: "updog__value-matching__table",
25914
25953
  children: [
@@ -25929,7 +25968,7 @@ var bC = () => {
25929
25968
  size: "sm",
25930
25969
  weight: "medium",
25931
25970
  children: t("dataEditor.uploader.matchValues.importedValues")
25932
- }), e.isMultiselect && /* @__PURE__ */ C(wC, { section: e })]
25971
+ }), e.isMultiselect && /* @__PURE__ */ C(EC, { section: e })]
25933
25972
  }),
25934
25973
  /* @__PURE__ */ C("div", { className: "updog__value-matching__arrow-spacer" }),
25935
25974
  /* @__PURE__ */ C(J, {
@@ -25942,7 +25981,7 @@ var bC = () => {
25942
25981
  /* @__PURE__ */ C("div", { className: "updog__value-matching__action" })
25943
25982
  ]
25944
25983
  }),
25945
- r.map((t) => /* @__PURE__ */ C(EC, {
25984
+ r.map((t) => /* @__PURE__ */ C(OC, {
25946
25985
  section: e,
25947
25986
  value: t
25948
25987
  }, t.imported)),
@@ -25963,7 +26002,7 @@ var bC = () => {
25963
26002
  onClick: s,
25964
26003
  children: t("dataEditor.uploader.matchValues.showAll")
25965
26004
  }),
25966
- /* @__PURE__ */ C(PC, {
26005
+ /* @__PURE__ */ C(IC, {
25967
26006
  open: o,
25968
26007
  onDismiss: c,
25969
26008
  section: e
@@ -25972,25 +26011,25 @@ var bC = () => {
25972
26011
  })
25973
26012
  ]
25974
26013
  });
25975
- }, IC = ({ section: e }) => {
25976
- let { isCollapsed: t } = bC(), n = !t(e.columnId), r = h();
26014
+ }, RC = ({ section: e }) => {
26015
+ let { isCollapsed: t } = SC(), n = !t(e.columnId), r = h();
25977
26016
  return /* @__PURE__ */ w("div", {
25978
26017
  className: "updog__value-matching__section",
25979
- children: [/* @__PURE__ */ C(xC, {
26018
+ children: [/* @__PURE__ */ C(CC, {
25980
26019
  section: e,
25981
26020
  panelId: r
25982
26021
  }), /* @__PURE__ */ C("div", {
25983
26022
  id: r,
25984
26023
  inert: !n,
25985
26024
  className: E("updog__value-matching__collapsible", n && "updog__value-matching__collapsible--expanded"),
25986
- children: /* @__PURE__ */ C(FC, { section: e })
26025
+ children: /* @__PURE__ */ C(LC, { section: e })
25987
26026
  })]
25988
26027
  });
25989
- }, LC = () => {
25990
- let { sections: e, hasCreateTarget: t, createForOptions: n, createInitialName: r, submitCreate: i, closeCreate: a } = bC();
26028
+ }, zC = () => {
26029
+ let { sections: e, hasCreateTarget: t, createForOptions: n, createInitialName: r, submitCreate: i, closeCreate: a } = SC();
25991
26030
  return /* @__PURE__ */ w("div", {
25992
26031
  className: "updog__value-matching",
25993
- children: [e.map((e) => /* @__PURE__ */ C(IC, { section: e }, e.columnId)), t && /* @__PURE__ */ C(pC, {
26032
+ children: [e.map((e) => /* @__PURE__ */ C(RC, { section: e }, e.columnId)), t && /* @__PURE__ */ C(hC, {
25994
26033
  open: !0,
25995
26034
  existingOptions: n,
25996
26035
  initialName: r,
@@ -25998,13 +26037,13 @@ var bC = () => {
25998
26037
  onSubmit: i
25999
26038
  })]
26000
26039
  });
26001
- }, RC = () => /* @__PURE__ */ C(vu, { children: /* @__PURE__ */ w(gu, { children: [/* @__PURE__ */ C("div", {
26040
+ }, BC = () => /* @__PURE__ */ C(vu, { children: /* @__PURE__ */ w(gu, { children: [/* @__PURE__ */ C("div", {
26002
26041
  className: "updog__step-match-values__content updog__scrollbar",
26003
- children: /* @__PURE__ */ C(yC, { children: /* @__PURE__ */ C(LC, {}) })
26004
- }), /* @__PURE__ */ C(tb, {})] }) }), zC = 20, BC = (e, t) => {
26042
+ children: /* @__PURE__ */ C(xC, { children: /* @__PURE__ */ C(zC, {}) })
26043
+ }), /* @__PURE__ */ C(tb, {})] }) }), VC = 20, HC = (e, t) => {
26005
26044
  let n = /* @__PURE__ */ new Map(), r = (e) => {
26006
26045
  let t = n.get(e.id);
26007
- return t || (t = sx(e.rawRows, e.headers, e.dataStartIndex, zC), n.set(e.id, t)), t;
26046
+ return t || (t = ux(e.rawRows, e.headers, e.dataStartIndex, VC), n.set(e.id, t)), t;
26008
26047
  }, i = {};
26009
26048
  for (let [n, a] of Object.entries(t)) for (let t of a) {
26010
26049
  let a = e.find((e) => e.id === t.workbookId);
@@ -26016,8 +26055,8 @@ var bC = () => {
26016
26055
  }
26017
26056
  }
26018
26057
  return i;
26019
- }, VC = () => {
26020
- let { store: e } = Z(), { t } = q(), n = zy(), r = Xy(n, Vy), { headersByColumn: i } = Xy(n, Hy), { selected: a, eligibleColumns: o } = Xy(n, Wy), s = f((e) => n.setPrimaryKey(e), [n]), c = e.isClient(), l = f(() => s(null), [s]), u = v(() => BC(r, i), [r, i]);
26058
+ }, UC = () => {
26059
+ let { store: e } = Z(), { t } = q(), n = zy(), r = Xy(n, Vy), { headersByColumn: i } = Xy(n, Hy), { selected: a, eligibleColumns: o } = Xy(n, Wy), s = f((e) => n.setPrimaryKey(e), [n]), c = e.isClient(), l = f(() => s(null), [s]), u = v(() => HC(r, i), [r, i]);
26021
26060
  return /* @__PURE__ */ w("div", {
26022
26061
  className: "updog__primary-key-selection updog__scrollbar",
26023
26062
  children: [c && /* @__PURE__ */ w(Xa, {
@@ -26065,10 +26104,10 @@ var bC = () => {
26065
26104
  }, e.id);
26066
26105
  })]
26067
26106
  });
26068
- }, HC = () => /* @__PURE__ */ C(vu, { children: /* @__PURE__ */ w(gu, { children: [/* @__PURE__ */ C(VC, {}), /* @__PURE__ */ C(tb, {})] }) });
26107
+ }, WC = () => /* @__PURE__ */ C(vu, { children: /* @__PURE__ */ w(gu, { children: [/* @__PURE__ */ C(UC, {}), /* @__PURE__ */ C(tb, {})] }) });
26069
26108
  //#endregion
26070
26109
  //#region src/components/DataUploader/hooks/useRemoteSource.ts
26071
- function UC(e) {
26110
+ function GC(e) {
26072
26111
  let { t } = q(), { loadingId: n, error: r } = Xy(e, qy), i = Qy(), a = f((t) => {
26073
26112
  e.loadRemoteSource(t).then(i);
26074
26113
  }, [e, i]);
@@ -26080,8 +26119,8 @@ function UC(e) {
26080
26119
  }
26081
26120
  //#endregion
26082
26121
  //#region src/components/DataUploader/components/StepSelectFiles/context/useViewModel.tsx
26083
- var WC = () => {
26084
- let { columns: e, importFormats: t, remoteSources: n, sampleData: r } = Z(), i = t === !1 ? [] : t, { t: a } = q(), o = zy(), { stagedItems: s } = Xy(o, By), { remoteSourceLoading: c, remoteSourceError: l, handleRemoteSourceSelect: u } = UC(o), d = $y(o), p = f((e) => {
26122
+ var KC = () => {
26123
+ let { columns: e, importFormats: t, remoteSources: n, sampleData: r } = Z(), i = t === !1 ? [] : t, { t: a } = q(), o = zy(), { stagedItems: s } = Xy(o, By), { remoteSourceLoading: c, remoteSourceError: l, handleRemoteSourceSelect: u } = GC(o), d = $y(o), p = f((e) => {
26085
26124
  o.toggleStagedItem(e);
26086
26125
  }, [o]), m = f(() => {
26087
26126
  o.reset();
@@ -26138,19 +26177,19 @@ var WC = () => {
26138
26177
  onExampleDownload: g,
26139
26178
  handleRemoteSourceSelect: u
26140
26179
  };
26141
- }, GC = s(null);
26142
- function KC({ children: e }) {
26143
- let t = WC();
26144
- return /* @__PURE__ */ C(GC.Provider, {
26180
+ }, qC = s(null);
26181
+ function JC({ children: e }) {
26182
+ let t = KC();
26183
+ return /* @__PURE__ */ C(qC.Provider, {
26145
26184
  value: t,
26146
26185
  children: e
26147
26186
  });
26148
26187
  }
26149
- var qC = () => {
26150
- let e = p(GC);
26188
+ var YC = () => {
26189
+ let e = p(qC);
26151
26190
  if (!e) throw Error("useSelectFiles must be used within SelectFilesProvider");
26152
26191
  return e;
26153
- }, JC = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */ C("span", {
26192
+ }, XC = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */ C("span", {
26154
26193
  className: "updog__remote-source-btn__icon",
26155
26194
  dangerouslySetInnerHTML: { __html: e.icon }
26156
26195
  }) : /* @__PURE__ */ C("span", {
@@ -26159,7 +26198,7 @@ var qC = () => {
26159
26198
  src: e.icon,
26160
26199
  alt: e.label
26161
26200
  })
26162
- }), YC = ({ source: e, loading: t, disabled: n, onSelect: r }) => /* @__PURE__ */ C(Y, {
26201
+ }), ZC = ({ source: e, loading: t, disabled: n, onSelect: r }) => /* @__PURE__ */ C(Y, {
26163
26202
  variant: "filled",
26164
26203
  color: "neutral",
26165
26204
  size: "sm",
@@ -26169,11 +26208,11 @@ var qC = () => {
26169
26208
  disabled: !t && n,
26170
26209
  loading: t,
26171
26210
  spinnerPosition: "start",
26172
- startIcon: /* @__PURE__ */ C(JC, { source: e }),
26211
+ startIcon: /* @__PURE__ */ C(XC, { source: e }),
26173
26212
  title: e.description,
26174
26213
  children: e.label
26175
- }), XC = () => {
26176
- let { t: e } = q(), { importFormats: t, remoteSources: n, remoteSourceLoading: r, remoteSourceError: i, handleRemoteSourceSelect: a } = qC(), o = n.length > 0;
26214
+ }), QC = () => {
26215
+ let { t: e } = q(), { importFormats: t, remoteSources: n, remoteSourceLoading: r, remoteSourceError: i, handleRemoteSourceSelect: a } = YC(), o = n.length > 0;
26177
26216
  return /* @__PURE__ */ w("div", {
26178
26217
  className: "updog__source-picker",
26179
26218
  children: [
@@ -26200,7 +26239,7 @@ var qC = () => {
26200
26239
  }),
26201
26240
  o && /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(Ba, {}), /* @__PURE__ */ C("div", {
26202
26241
  className: "updog__source-picker__sources-list",
26203
- children: n.map((e) => /* @__PURE__ */ C(YC, {
26242
+ children: n.map((e) => /* @__PURE__ */ C(ZC, {
26204
26243
  source: e,
26205
26244
  loading: r === e.id,
26206
26245
  disabled: !!r,
@@ -26214,18 +26253,18 @@ var qC = () => {
26214
26253
  })
26215
26254
  ]
26216
26255
  });
26217
- }, ZC = () => /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C("div", {
26256
+ }, $C = () => /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C("div", {
26218
26257
  className: "updog__upload-prompt__icon-container",
26219
26258
  children: /* @__PURE__ */ C(Le, {
26220
26259
  size: "1rem",
26221
26260
  className: "updog__upload-prompt__icon"
26222
26261
  })
26223
- }), /* @__PURE__ */ C(XC, {})] }), QC = ({ onClick: e }) => /* @__PURE__ */ C("div", {
26262
+ }), /* @__PURE__ */ C(QC, {})] }), ew = ({ onClick: e }) => /* @__PURE__ */ C("div", {
26224
26263
  className: "updog__add-files-card",
26225
26264
  onClick: e,
26226
- children: /* @__PURE__ */ C(ZC, {})
26227
- }), $C = () => {
26228
- let { t: e } = q(), { exampleMenuOptions: t, onExampleDownload: n } = qC();
26265
+ children: /* @__PURE__ */ C($C, {})
26266
+ }), tw = () => {
26267
+ let { t: e } = q(), { exampleMenuOptions: t, onExampleDownload: n } = YC();
26229
26268
  return /* @__PURE__ */ C(qa, {
26230
26269
  options: t,
26231
26270
  onSelect: n,
@@ -26237,8 +26276,8 @@ var qC = () => {
26237
26276
  children: e("dataEditor.uploader.uploadFile.downloadExample")
26238
26277
  })
26239
26278
  });
26240
- }, ew = () => {
26241
- let { t: e } = q(), { reset: t } = qC();
26279
+ }, nw = () => {
26280
+ let { t: e } = q(), { reset: t } = YC();
26242
26281
  return /* @__PURE__ */ C(Y, {
26243
26282
  variant: "outlined",
26244
26283
  color: "neutral",
@@ -26246,7 +26285,7 @@ var qC = () => {
26246
26285
  onClick: t,
26247
26286
  children: e("dataEditor.uploader.uploadFile.reset")
26248
26287
  });
26249
- }, tw = ({ item: e, onToggle: t }) => {
26288
+ }, rw = ({ item: e, onToggle: t }) => {
26250
26289
  let { t: n } = q(), r = e.status === "ready", i = e.status === "ready" && e.selected, a = e.status === "ready" ? Math.max(0, e.preview.totalRows) : 0, o = f(() => {
26251
26290
  t(e.id);
26252
26291
  }, [t, e.id]), s = e.status === "ready" && e.materialize.kind === "sheet" && e.source.kind === "file" ? e.source.file.name : null, c = v(() => {
@@ -26298,15 +26337,15 @@ var qC = () => {
26298
26337
  })]
26299
26338
  })
26300
26339
  });
26301
- }, nw = () => {
26302
- let { isBlocked: e, open: t } = qC();
26340
+ }, iw = () => {
26341
+ let { isBlocked: e, open: t } = YC();
26303
26342
  return /* @__PURE__ */ C("div", {
26304
26343
  className: E("updog__step-select-files__upload-area", e && "updog__step-select-files__upload-area--disabled"),
26305
26344
  onClick: e ? void 0 : t,
26306
- children: /* @__PURE__ */ C(ZC, {})
26345
+ children: /* @__PURE__ */ C($C, {})
26307
26346
  });
26308
- }, rw = () => {
26309
- let { t: e } = q(), { getRootProps: t, getInputProps: n, isDragActive: r, open: i, stagedItems: a, toggleItem: o } = qC(), s = a.length > 0;
26347
+ }, aw = () => {
26348
+ let { t: e } = q(), { getRootProps: t, getInputProps: n, isDragActive: r, open: i, stagedItems: a, toggleItem: o } = YC(), s = a.length > 0;
26310
26349
  return /* @__PURE__ */ C(vu, { children: /* @__PURE__ */ w("div", {
26311
26350
  className: "updog__step-select-files__dropzone",
26312
26351
  ...t(),
@@ -26316,19 +26355,19 @@ var qC = () => {
26316
26355
  className: "updog__sheet-preview-wrapper updog__scrollbar",
26317
26356
  children: /* @__PURE__ */ w("div", {
26318
26357
  className: "updog__sheet-preview-grid",
26319
- children: [a.map((e) => /* @__PURE__ */ C(tw, {
26358
+ children: [a.map((e) => /* @__PURE__ */ C(rw, {
26320
26359
  item: e,
26321
26360
  onToggle: o
26322
- }, e.id)), /* @__PURE__ */ C(QC, { onClick: i })]
26361
+ }, e.id)), /* @__PURE__ */ C(ew, { onClick: i })]
26323
26362
  })
26324
- }) : /* @__PURE__ */ C(nw, {}), /* @__PURE__ */ C(tb, { leftSlot: C(s ? ew : $C, {}) })] }),
26363
+ }) : /* @__PURE__ */ C(iw, {}), /* @__PURE__ */ C(tb, { leftSlot: C(s ? nw : tw, {}) })] }),
26325
26364
  r && /* @__PURE__ */ C(_u, {})
26326
26365
  ]
26327
26366
  }) });
26328
- }, iw = () => /* @__PURE__ */ C(KC, { children: /* @__PURE__ */ C(rw, {}) });
26367
+ }, ow = () => /* @__PURE__ */ C(JC, { children: /* @__PURE__ */ C(aw, {}) });
26329
26368
  //#endregion
26330
26369
  //#region src/components/DataUploader/hooks/useUploadFlow.ts
26331
- function aw(e) {
26370
+ function sw(e) {
26332
26371
  let t = y(null);
26333
26372
  t.current === null && (t.current = e());
26334
26373
  let n = t.current;
@@ -26336,11 +26375,11 @@ function aw(e) {
26336
26375
  }
26337
26376
  //#endregion
26338
26377
  //#region src/components/DataUploader/context/index.tsx
26339
- function ow({ children: e }) {
26378
+ function cw({ children: e }) {
26340
26379
  let { store: t, validator: n, columns: r, primaryKey: i, pendingImportFiles: a, setPendingImportFiles: o, onColumnMatch: s, onValueMatch: c, synonyms: l, addDynamicColumns: u, scaleClient: d } = Z(), { t: p } = q(), h = f((e, t) => t ? p("dataEditor.uploader.matchColumns.syntheticColumnValue", {
26341
26380
  index: e + 1,
26342
26381
  value: t
26343
- }) : p("dataEditor.uploader.matchColumns.syntheticColumn", { index: e + 1 }), [p]), g = aw(() => new WS({
26382
+ }) : p("dataEditor.uploader.matchColumns.syntheticColumn", { index: e + 1 }), [p]), g = sw(() => new KS({
26344
26383
  store: t,
26345
26384
  validator: n,
26346
26385
  columns: r,
@@ -26348,7 +26387,7 @@ function ow({ children: e }) {
26348
26387
  scaleClient: d,
26349
26388
  onColumnMatch: s,
26350
26389
  onValueMatch: c,
26351
- extraSynonyms: l,
26390
+ extraSynonyms: ab(l),
26352
26391
  addDynamicColumns: u,
26353
26392
  synthesizeHeader: h,
26354
26393
  hasExistingData: t.getLocalRowCount() > 0,
@@ -26378,27 +26417,27 @@ function ow({ children: e }) {
26378
26417
  }
26379
26418
  //#endregion
26380
26419
  //#region src/components/DataUploader/index.tsx
26381
- var sw = () => {
26420
+ var lw = () => {
26382
26421
  let { stepIds: e, activeStepIndex: t, headerReview: n, columnMatching: r } = Xy(zy(), Gy), i = Iy(), { t: a } = q(), o = v(() => ({
26383
26422
  "select-files": {
26384
26423
  title: a("dataEditor.uploader.steps.selectFiles"),
26385
- content: /* @__PURE__ */ C(iw, {})
26424
+ content: /* @__PURE__ */ C(ow, {})
26386
26425
  },
26387
26426
  "header-selection": {
26388
26427
  title: a("dataEditor.uploader.steps.headerSelection"),
26389
- content: /* @__PURE__ */ C(fC, {})
26428
+ content: /* @__PURE__ */ C(mC, {})
26390
26429
  },
26391
26430
  "column-matching": {
26392
26431
  title: a("dataEditor.uploader.steps.matchColumns"),
26393
- content: /* @__PURE__ */ C(oC, {})
26432
+ content: /* @__PURE__ */ C(cC, {})
26394
26433
  },
26395
26434
  "match-values": {
26396
26435
  title: a("dataEditor.uploader.steps.matchValues"),
26397
- content: /* @__PURE__ */ C(RC, {})
26436
+ content: /* @__PURE__ */ C(BC, {})
26398
26437
  },
26399
26438
  "primary-key": {
26400
26439
  title: a("dataEditor.uploader.steps.primaryKey"),
26401
- content: /* @__PURE__ */ C(HC, {})
26440
+ content: /* @__PURE__ */ C(WC, {})
26402
26441
  }
26403
26442
  }), [a]), s = e[t], c = s ? o[s] : void 0, l = s === "header-selection" && n && n.total > 1 ? a("dataEditor.uploader.steps.headerSelectionOf", {
26404
26443
  current: n.position + 1,
@@ -26416,82 +26455,82 @@ var sw = () => {
26416
26455
  children: c?.content
26417
26456
  })]
26418
26457
  });
26419
- }, cw = () => /* @__PURE__ */ C(ow, { children: /* @__PURE__ */ w("div", {
26458
+ }, uw = () => /* @__PURE__ */ C(cw, { children: /* @__PURE__ */ w("div", {
26420
26459
  className: "updog__data-uploader",
26421
- children: [/* @__PURE__ */ C(sw, {}), /* @__PURE__ */ C(yu, {})]
26422
- }) }), lw = {
26460
+ children: [/* @__PURE__ */ C(lw, {}), /* @__PURE__ */ C(yu, {})]
26461
+ }) }), dw = {
26423
26462
  kty: "EC",
26424
26463
  crv: "P-256",
26425
26464
  x: "wZO1Jxr21FEBDsVMzbTbF8blU2CP17c_eQY7gorO13U",
26426
26465
  y: "Nwr-tXatJZ3DxZqpUG_gOWzmpU6szTqrEL7Gnh5UGwo"
26427
- }, uw = "updog_license_grant", dw = new Set([
26466
+ }, fw = "updog_license_grant", pw = new Set([
26428
26467
  "updog.tech",
26429
26468
  "landing.updog.tech",
26430
26469
  "demo.updog.tech"
26431
26470
  ]);
26432
- function fw() {
26433
- return dw.has(window.location.hostname);
26471
+ function mw() {
26472
+ return pw.has(window.location.hostname);
26434
26473
  }
26435
- function pw() {
26474
+ function hw() {
26436
26475
  return !1;
26437
26476
  }
26438
- function mw() {
26477
+ function gw() {
26439
26478
  return "https://api.updog.tech";
26440
26479
  }
26441
- function hw(e) {
26480
+ function _w(e) {
26442
26481
  let t = e.replace(/-/g, "+").replace(/_/g, "/"), n = t + "=".repeat((4 - t.length % 4) % 4), r = atob(n), i = new Uint8Array(r.length);
26443
26482
  for (let e = 0; e < r.length; e++) i[e] = r.charCodeAt(e);
26444
26483
  return i;
26445
26484
  }
26446
- async function gw(e) {
26485
+ async function vw(e) {
26447
26486
  let t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
26448
26487
  return Array.from(new Uint8Array(n)).map((e) => e.toString(16).padStart(2, "0")).join("");
26449
26488
  }
26450
- var _w = null;
26451
- async function vw() {
26452
- return _w || (_w = await crypto.subtle.importKey("jwk", lw, {
26489
+ var yw = null;
26490
+ async function bw() {
26491
+ return yw || (yw = await crypto.subtle.importKey("jwk", dw, {
26453
26492
  name: "ECDSA",
26454
26493
  namedCurve: "P-256"
26455
- }, !1, ["verify"]), _w);
26494
+ }, !1, ["verify"]), yw);
26456
26495
  }
26457
- function yw() {
26496
+ function xw() {
26458
26497
  try {
26459
- return localStorage.getItem(uw);
26498
+ return localStorage.getItem(fw);
26460
26499
  } catch {
26461
26500
  return null;
26462
26501
  }
26463
26502
  }
26464
- function bw(e) {
26503
+ function Sw(e) {
26465
26504
  try {
26466
- localStorage.setItem(uw, e);
26505
+ localStorage.setItem(fw, e);
26467
26506
  } catch {}
26468
26507
  }
26469
- function xw() {
26508
+ function Cw() {
26470
26509
  try {
26471
- localStorage.removeItem(uw);
26510
+ localStorage.removeItem(fw);
26472
26511
  } catch {}
26473
26512
  }
26474
- async function Sw(e, t, n) {
26513
+ async function ww(e, t, n) {
26475
26514
  let r = e.indexOf(".");
26476
26515
  if (r === -1) return !1;
26477
- let i = e.slice(0, r), a = e.slice(r + 1), o = hw(i), s = hw(a), c = await vw();
26516
+ let i = e.slice(0, r), a = e.slice(r + 1), o = _w(i), s = _w(a), c = await bw();
26478
26517
  if (!await crypto.subtle.verify({
26479
26518
  name: "ECDSA",
26480
26519
  hash: "SHA-256"
26481
26520
  }, c, new Uint8Array(s), new Uint8Array(o))) return !1;
26482
26521
  let l = JSON.parse(new TextDecoder().decode(o));
26483
26522
  if (l.exp <= Math.floor(Date.now() / 1e3)) return !1;
26484
- let u = await gw(t);
26523
+ let u = await vw(t);
26485
26524
  return !(l.key !== u || l.domain !== n);
26486
26525
  }
26487
- async function Cw(e) {
26488
- let t = yw();
26526
+ async function Tw(e) {
26527
+ let t = xw();
26489
26528
  if (!t) return {
26490
26529
  valid: !1,
26491
26530
  errorCode: "license.invalid"
26492
26531
  };
26493
26532
  try {
26494
- if (await Sw(t, e, window.location.hostname.toLowerCase().trim())) return {
26533
+ if (await ww(t, e, window.location.hostname.toLowerCase().trim())) return {
26495
26534
  valid: !0,
26496
26535
  errorCode: null
26497
26536
  };
@@ -26501,23 +26540,23 @@ async function Cw(e) {
26501
26540
  errorCode: "license.invalid"
26502
26541
  };
26503
26542
  }
26504
- async function ww(e, t = !0) {
26505
- if (fw() || pw()) return {
26543
+ async function Ew(e, t = !0) {
26544
+ if (mw() || hw()) return {
26506
26545
  valid: !0,
26507
26546
  errorCode: null
26508
26547
  };
26509
- let n = mw();
26548
+ let n = gw();
26510
26549
  try {
26511
26550
  let r = await fetch(`${n}/v1/validate`, { headers: { "X-API-Key": e } });
26512
26551
  if (r.ok) {
26513
26552
  let e = await r.json();
26514
- return t && e.grant && bw(e.grant), {
26553
+ return t && e.grant && Sw(e.grant), {
26515
26554
  valid: !0,
26516
26555
  errorCode: null
26517
26556
  };
26518
26557
  }
26519
26558
  if (r.status >= 400 && r.status < 500) {
26520
- t && xw();
26559
+ t && Cw();
26521
26560
  try {
26522
26561
  return await r.json();
26523
26562
  } catch {
@@ -26529,7 +26568,7 @@ async function ww(e, t = !0) {
26529
26568
  }
26530
26569
  throw Error(`Server error: ${r.status}`);
26531
26570
  } catch {
26532
- return t ? Cw(e) : {
26571
+ return t ? Tw(e) : {
26533
26572
  valid: !1,
26534
26573
  errorCode: "license.invalid"
26535
26574
  };
@@ -26537,7 +26576,7 @@ async function ww(e, t = !0) {
26537
26576
  }
26538
26577
  //#endregion
26539
26578
  //#region src/hooks/useLicenseValidation.ts
26540
- function Tw(e, t, n = !0) {
26579
+ function Dw(e, t, n = !0) {
26541
26580
  let [r, i] = b({
26542
26581
  isValidating: t,
26543
26582
  isValid: !1,
@@ -26557,7 +26596,7 @@ function Tw(e, t, n = !0) {
26557
26596
  isValidating: !0,
26558
26597
  isValid: !1,
26559
26598
  errorCode: null
26560
- }), ww(e, n).then((e) => {
26599
+ }), Ew(e, n).then((e) => {
26561
26600
  r || i({
26562
26601
  isValidating: !1,
26563
26602
  isValid: e.valid,
@@ -26580,7 +26619,7 @@ function Tw(e, t, n = !0) {
26580
26619
  }
26581
26620
  //#endregion
26582
26621
  //#region src/server/auth/AuthState.ts
26583
- var Ew = class {
26622
+ var Ow = class {
26584
26623
  token = null;
26585
26624
  get() {
26586
26625
  return this.token;
@@ -26591,13 +26630,13 @@ var Ew = class {
26591
26630
  clear() {
26592
26631
  this.token = null;
26593
26632
  }
26594
- }, Dw = class extends Error {
26633
+ }, kw = class extends Error {
26595
26634
  status;
26596
26635
  code;
26597
26636
  constructor(e) {
26598
26637
  super(e.message), this.name = "ScaleHttpError", this.status = e.status, this.code = e.code;
26599
26638
  }
26600
- }, Ow = class {
26639
+ }, Aw = class {
26601
26640
  baseUrl;
26602
26641
  apiKey;
26603
26642
  auth;
@@ -26627,7 +26666,7 @@ var Ew = class {
26627
26666
  signal: r?.signal
26628
26667
  });
26629
26668
  } catch (e) {
26630
- this.notify(new Dw({
26669
+ this.notify(new kw({
26631
26670
  status: 0,
26632
26671
  code: "network",
26633
26672
  message: e instanceof Error ? e.message : String(e)
@@ -26638,7 +26677,7 @@ var Ew = class {
26638
26677
  try {
26639
26678
  e = await s.json();
26640
26679
  } catch {}
26641
- this.notify(new Dw({
26680
+ this.notify(new kw({
26642
26681
  status: s.status,
26643
26682
  code: e.error ?? `http_${s.status}`,
26644
26683
  message: e.message ?? s.statusText
@@ -26649,23 +26688,23 @@ var Ew = class {
26649
26688
  };
26650
26689
  //#endregion
26651
26690
  //#region src/server/endpoints/workspaces.ts
26652
- async function kw(e, t) {
26691
+ async function jw(e, t) {
26653
26692
  return e.post("/workspaces", {
26654
26693
  primaryKey: t.primaryKey,
26655
26694
  columns: t.columns
26656
26695
  }, { signal: t.signal });
26657
26696
  }
26658
- async function Aw(e) {
26697
+ async function Mw(e) {
26659
26698
  try {
26660
26699
  await e.http.delete(`/workspaces/${e.workspaceId}`, { signal: e.signal });
26661
26700
  } catch (e) {
26662
- if (e instanceof Dw && e.status === 404) return;
26701
+ if (e instanceof kw && e.status === 404) return;
26663
26702
  throw e;
26664
26703
  }
26665
26704
  }
26666
26705
  //#endregion
26667
26706
  //#region src/server/endpoints/query.ts
26668
- async function jw(e, t) {
26707
+ async function Nw(e, t) {
26669
26708
  let n = await e.http.post(`/workspaces/${e.workspaceId}/query`, {
26670
26709
  page: {
26671
26710
  limit: t.limit,
@@ -26683,12 +26722,12 @@ async function jw(e, t) {
26683
26722
  }
26684
26723
  //#endregion
26685
26724
  //#region src/server/ScaleClient.ts
26686
- var Mw = class {
26725
+ var Pw = class {
26687
26726
  disposed = !1;
26688
26727
  constructor(e) {
26689
26728
  this.deps = e;
26690
26729
  }
26691
- onQuery = (e) => jw(this.deps, e);
26730
+ onQuery = (e) => Nw(this.deps, e);
26692
26731
  onEdit = async (e) => ({
26693
26732
  rejected: !0,
26694
26733
  reason: "Edits are not yet supported in server mode (v0)."
@@ -26705,7 +26744,7 @@ var Mw = class {
26705
26744
  pageSize = void 0;
26706
26745
  scrollSensitivity = void 0;
26707
26746
  dispose = async () => {
26708
- this.disposed || (this.disposed = !0, await Aw({
26747
+ this.disposed || (this.disposed = !0, await Mw({
26709
26748
  http: this.deps.http,
26710
26749
  workspaceId: this.deps.workspaceId
26711
26750
  }));
@@ -26713,25 +26752,25 @@ var Mw = class {
26713
26752
  };
26714
26753
  //#endregion
26715
26754
  //#region src/server/createScaleClient.ts
26716
- async function Nw(e) {
26717
- let t = new Ew(), n = new Ow({
26755
+ async function Fw(e) {
26756
+ let t = new Ow(), n = new Aw({
26718
26757
  baseUrl: e.url,
26719
26758
  apiKey: e.apiKey,
26720
26759
  auth: t,
26721
26760
  onDegraded: e.onDegraded
26722
- }), { workspaceId: r, accessToken: i } = await kw(n, {
26761
+ }), { workspaceId: r, accessToken: i } = await jw(n, {
26723
26762
  primaryKey: e.primaryKey,
26724
26763
  columns: e.columns,
26725
26764
  signal: e.signal
26726
26765
  });
26727
- return t.set(i), new Mw({
26766
+ return t.set(i), new Pw({
26728
26767
  workspaceId: r,
26729
26768
  http: n
26730
26769
  });
26731
26770
  }
26732
26771
  //#endregion
26733
26772
  //#region src/server/errors.ts
26734
- function Pw(e, t, n) {
26773
+ function Iw(e, t, n) {
26735
26774
  return {
26736
26775
  code: e,
26737
26776
  message: t,
@@ -26741,7 +26780,7 @@ function Pw(e, t, n) {
26741
26780
  }
26742
26781
  //#endregion
26743
26782
  //#region src/hooks/useScaleClient.ts
26744
- function Fw(e) {
26783
+ function Lw(e) {
26745
26784
  let [t, n] = b({ status: "idle" }), r = y(e.columns), i = y(e.primaryKey);
26746
26785
  return m(() => {
26747
26786
  if (!e.enabled) {
@@ -26750,7 +26789,7 @@ function Fw(e) {
26750
26789
  }
26751
26790
  n({ status: "bootstrapping" });
26752
26791
  let t = new AbortController(), a = null;
26753
- return Nw({
26792
+ return Fw({
26754
26793
  url: e.url,
26755
26794
  apiKey: e.apiKey,
26756
26795
  primaryKey: i.current,
@@ -26759,7 +26798,7 @@ function Fw(e) {
26759
26798
  onDegraded: (e) => {
26760
26799
  t.signal.aborted || n({
26761
26800
  status: "failed",
26762
- error: Lw(e)
26801
+ error: zw(e)
26763
26802
  });
26764
26803
  }
26765
26804
  }).then((e) => {
@@ -26774,7 +26813,7 @@ function Fw(e) {
26774
26813
  }).catch((e) => {
26775
26814
  t.signal.aborted || n({
26776
26815
  status: "failed",
26777
- error: Iw(e)
26816
+ error: Rw(e)
26778
26817
  });
26779
26818
  }), () => {
26780
26819
  t.abort(), a?.dispose().catch(() => {});
@@ -26785,30 +26824,30 @@ function Fw(e) {
26785
26824
  e.apiKey
26786
26825
  ]), t;
26787
26826
  }
26788
- function Iw(e) {
26789
- return e instanceof Dw ? e.status === 401 ? Pw(e.code.startsWith("license.") ? e.code : "license.invalid", e.message, e) : e.status === 0 ? Pw("scale.unreachable", e.message, e) : e.status >= 500 ? Pw("scale.server_error", e.message, e) : Pw("scale.bootstrap_failed", e.message, e) : Pw("scale.bootstrap_failed", e instanceof Error ? e.message : String(e), e);
26827
+ function Rw(e) {
26828
+ return e instanceof kw ? e.status === 401 ? Iw(e.code.startsWith("license.") ? e.code : "license.invalid", e.message, e) : e.status === 0 ? Iw("scale.unreachable", e.message, e) : e.status >= 500 ? Iw("scale.server_error", e.message, e) : Iw("scale.bootstrap_failed", e.message, e) : Iw("scale.bootstrap_failed", e instanceof Error ? e.message : String(e), e);
26790
26829
  }
26791
- function Lw(e) {
26792
- return e.status === 0 ? Pw("scale.unreachable", e.message, e) : e.status === 404 ? Pw("scale.workspace_lost", e.message, e) : Pw("scale.server_error", e.message, e);
26830
+ function zw(e) {
26831
+ return e.status === 0 ? Iw("scale.unreachable", e.message, e) : e.status === 404 ? Iw("scale.workspace_lost", e.message, e) : Iw("scale.server_error", e.message, e);
26793
26832
  }
26794
26833
  //#endregion
26795
26834
  //#region src/index.tsx
26796
- function Rw(e) {
26835
+ function Bw(e) {
26797
26836
  return e === !1 ? { licenseGrant: !1 } : { licenseGrant: e?.licenseGrant ?? !0 };
26798
26837
  }
26799
- function zw(e) {
26838
+ function Vw(e) {
26800
26839
  let t = v(() => new Wo(e.onError), [e.onError]);
26801
26840
  return /* @__PURE__ */ C(Ny, {
26802
26841
  errorHandler: t,
26803
26842
  children: /* @__PURE__ */ C(fu, {
26804
26843
  ...e,
26805
26844
  errorHandler: t,
26806
- children: e.showUploader ? /* @__PURE__ */ C(cw, {}) : /* @__PURE__ */ C(ky, {})
26845
+ children: e.showUploader ? /* @__PURE__ */ C(uw, {}) : /* @__PURE__ */ C(ky, {})
26807
26846
  })
26808
26847
  });
26809
26848
  }
26810
- function Bw(e) {
26811
- let t = e.mode ?? "modal", { t: n, rtl: r } = q(), i = r ? "rtl" : "ltr", a = Rw(e.localStorage), o = t === "modal" ? e.open : !0, { isValidating: s, isValid: c, errorCode: l } = Tw(e.apiKey, t === "modal" ? o : !0, a.licenseGrant), u = e.__server != null, d = Fw({
26849
+ function Hw(e) {
26850
+ let t = e.mode ?? "modal", { t: n, rtl: r } = q(), i = r ? "rtl" : "ltr", a = Bw(e.localStorage), o = t === "modal" ? e.open : !0, { isValidating: s, isValid: c, errorCode: l } = Dw(e.apiKey, t === "modal" ? o : !0, a.licenseGrant), u = e.__server != null, d = Lw({
26812
26851
  enabled: !s && c && u,
26813
26852
  url: e.__server?.url ?? "",
26814
26853
  apiKey: e.apiKey,
@@ -26863,7 +26902,7 @@ function Bw(e) {
26863
26902
  code: e,
26864
26903
  message: "License validation failed",
26865
26904
  source: "license"
26866
- } }), F = () => s ? N(n("dataEditor.license.loading")) : c ? u && d.status === "bootstrapping" ? N(n("dataEditor.connecting.label")) : u && d.status === "failed" ? /* @__PURE__ */ C(jy, { error: d.error }) : /* @__PURE__ */ C(zw, { ...M }) : P(l ?? "license.invalid");
26905
+ } }), F = () => s ? N(n("dataEditor.license.loading")) : c ? u && d.status === "bootstrapping" ? N(n("dataEditor.connecting.label")) : u && d.status === "failed" ? /* @__PURE__ */ C(jy, { error: d.error }) : /* @__PURE__ */ C(Vw, { ...M }) : P(l ?? "license.invalid");
26867
26906
  return t === "inline" ? /* @__PURE__ */ C("div", {
26868
26907
  className: "updog__data-editor updog__data-editor-inline",
26869
26908
  dir: i,
@@ -26886,14 +26925,14 @@ function Bw(e) {
26886
26925
  })
26887
26926
  });
26888
26927
  }
26889
- function Vw(e) {
26928
+ function Uw(e) {
26890
26929
  let { translations: t, rtl: n = !1, locale: r = "en", className: i, ...a } = e;
26891
26930
  return /* @__PURE__ */ C(Xr, {
26892
26931
  translations: t,
26893
26932
  rtl: n,
26894
26933
  locale: r,
26895
- children: /* @__PURE__ */ C(Bw, { ...a })
26934
+ children: /* @__PURE__ */ C(Hw, { ...a })
26896
26935
  });
26897
26936
  }
26898
26937
  //#endregion
26899
- export { Vw as DataEditor, ju as downloadExampleFile, Mu as exportDataEditor };
26938
+ export { Uw as DataEditor, ju as downloadExampleFile, Mu as exportDataEditor };