@ingestro/importer-react 4.8.4 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ingestro/importer-react",
3
- "version": "4.8.4",
3
+ "version": "4.9.0",
4
4
  "homepage": "https://docs.ingestro.com",
5
5
  "peerDependencies": {
6
6
  "react": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
@@ -8,31 +8,36 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "@babel/standalone": "7.29.1",
11
- "@emotion/css": "^11.11.2",
12
- "axios": "1.15.0",
13
- "chroma-js": "^2.1.2",
14
- "comlink": "^4.3.1",
15
- "date-fns": "^2.28.0",
11
+ "@emotion/css": "11.13.5",
12
+ "@floating-ui/core": "1.7.5",
13
+ "axios": "1.18.1",
14
+ "chroma-js": "2.6.0",
15
+ "comlink": "4.4.2",
16
+ "date-fns": "2.30.0",
16
17
  "detect-file-encoding-and-language": "2.4.0",
17
18
  "eval5": "1.4.8",
18
- "file-saver": "^2.0.5",
19
- "gtin": "^1.0.2",
19
+ "file-saver": "2.0.5",
20
+ "gtin": "1.0.2",
20
21
  "handsontable": "16.2.0",
21
- "is-promise": "^4.0.0",
22
- "lodash": "^4.17.21",
23
- "match-sorter": "^6.4.0",
24
- "moment": "^2.29.4",
25
- "nanoevents": "^7.0.1",
22
+ "is-promise": "4.0.0",
23
+ "lodash": "4.18.1",
24
+ "match-sorter": "6.4.0",
25
+ "moment": "2.30.1",
26
+ "nanoevents": "7.0.1",
26
27
  "nuvo-exceljs": "4.6.0",
27
- "object-hash": "^3.0.0",
28
+ "object-hash": "3.0.0",
28
29
  "pdfjs-dist": "4.10.38",
29
30
  "prism-code-editor": "5.0.1",
30
31
  "rxjs": "7.8.1",
31
32
  "simplebar": "5.3.9",
32
- "simplebar-core": "^1.3.0",
33
+ "simplebar-core": "1.3.2",
33
34
  "tesseract.js": "7.0.0",
34
- "url-join": "^5.0.0",
35
- "yup": "^0.32.11"
35
+ "url-join": "5.0.0",
36
+ "uuid": "11.1.1",
37
+ "yup": "0.32.11"
38
+ },
39
+ "browser": {
40
+ "@napi-rs/canvas": false
36
41
  },
37
42
  "exports": {
38
43
  ".": {
@@ -1 +1 @@
1
- import{a as s,b as m}from"../../chunk-GEB7CZLW.js";import{d as a,e as g}from"../../chunk-AAZKUHPZ.js";import"../../chunk-3IKZH76S.js";import{isEmpty as p,isNil as v,isUndefined as R}from"lodash";import{expose as h}from"comlink";var I=(n,t,o,f,r)=>{p(n)||Object.keys(n).forEach(e=>{let l=a(r,e);R(n[e].value)||(f[t][e]=n[e].value);let d=g(e,r.filter(i=>!i.isHidden()));v(n[e].info)||d<0||n[e].info?.forEach(i=>{if(!l?.isDisabled()&&i.level===m)return;let c={rowIndex:t,colIndex:d,popover:{message:i.message,level:i.level||s}};(o[t]?.length??0)===0?o[t]=[c]:o[t].push(c)})})},E=async({initResults:n,dataInfos:t,initialValues:o},f)=>{for(let r=0;r<n.length;r++)I(n[r][0],n[r][1],t,o,f);return{dataInfos:t,initialValues:o}},b=async({initialValues:n,key:t,result:o,colIndex:f})=>{let r={};for(let e=0;e<o.length;e++)if(R(o[e][0].value)||n[o[e][1]]&&(n[o[e][1]][t]=o[e][0].value),o?.[e]?.[0]?.info&&f>=0){let l=o?.[e]?.[0]?.info??[],d={message:o?.[e]?.[0]?.info?.[0]?.message??"",level:o?.[e]?.[0]?.info?.[0]?.level??s};for(let c=0;c<l?.length;c++)if(l[c].level!==m){d={message:o?.[e]?.[0]?.info?.[c]?.message??"",level:o?.[e]?.[0]?.info?.[c]?.level??s};break}let i={rowIndex:o[e][1],colIndex:f,popover:d};i.popover.level!==m&&n[o[e][1]]&&((r[o[e][1]]?.length??0)===0?r[o[e][1]]=[i]:r[o[e][1]].push(i))}return{dataInfos:r,initialValues:n}},x=async({dataInfos:n,columnDataInfos:t})=>{let o=Object.keys(t);for(let f=0;f<o.length;f++){let r=o[f];t?.[r]?.length>0&&(n[r]||(n[r]=[]),n[r].push(...t[r]))}return{dataInfos:n}},D=()=>!0;h({check:D,handleOnEntryInit:E,handleColumnHooks:b,integrateColumnHooksData:x});
1
+ import{a as s,b as m}from"../../chunk-GEB7CZLW.js";import{d as a,e as g}from"../../chunk-REPANPD5.js";import"../../chunk-3IKZH76S.js";import{isEmpty as p,isNil as v,isUndefined as R}from"lodash";import{expose as h}from"comlink";var I=(n,t,o,f,r)=>{p(n)||Object.keys(n).forEach(e=>{let l=a(r,e);R(n[e].value)||(f[t][e]=n[e].value);let d=g(e,r.filter(i=>!i.isHidden()));v(n[e].info)||d<0||n[e].info?.forEach(i=>{if(!l?.isDisabled()&&i.level===m)return;let c={rowIndex:t,colIndex:d,popover:{message:i.message,level:i.level||s}};(o[t]?.length??0)===0?o[t]=[c]:o[t].push(c)})})},E=async({initResults:n,dataInfos:t,initialValues:o},f)=>{for(let r=0;r<n.length;r++)I(n[r][0],n[r][1],t,o,f);return{dataInfos:t,initialValues:o}},b=async({initialValues:n,key:t,result:o,colIndex:f})=>{let r={};for(let e=0;e<o.length;e++)if(R(o[e][0].value)||n[o[e][1]]&&(n[o[e][1]][t]=o[e][0].value),o?.[e]?.[0]?.info&&f>=0){let l=o?.[e]?.[0]?.info??[],d={message:o?.[e]?.[0]?.info?.[0]?.message??"",level:o?.[e]?.[0]?.info?.[0]?.level??s};for(let c=0;c<l?.length;c++)if(l[c].level!==m){d={message:o?.[e]?.[0]?.info?.[c]?.message??"",level:o?.[e]?.[0]?.info?.[c]?.level??s};break}let i={rowIndex:o[e][1],colIndex:f,popover:d};i.popover.level!==m&&n[o[e][1]]&&((r[o[e][1]]?.length??0)===0?r[o[e][1]]=[i]:r[o[e][1]].push(i))}return{dataInfos:r,initialValues:n}},x=async({dataInfos:n,columnDataInfos:t})=>{let o=Object.keys(t);for(let f=0;f<o.length;f++){let r=o[f];t?.[r]?.length>0&&(n[r]||(n[r]=[]),n[r].push(...t[r]))}return{dataInfos:n}},D=()=>!0;h({check:D,handleOnEntryInit:E,handleColumnHooks:b,integrateColumnHooksData:x});
@@ -1 +1 @@
1
- import{d as r}from"../../chunk-4HB6YDED.js";import"../../chunk-J5WOZVPO.js";import"../../chunk-3IKZH76S.js";import{expose as m}from"comlink";m(r);
1
+ import{F as r}from"../../chunk-EKOU24TN.js";import"../../chunk-J5WOZVPO.js";import"../../chunk-3IKZH76S.js";import{expose as m}from"comlink";m(r);
@@ -1 +1 @@
1
- import{e as o,f as t,g as m,h as n,i,j as r}from"../../chunk-BVFFBQFD.js";import"../../chunk-SKUCMMIT.js";import"../../chunk-TS3BDFZ6.js";import"../../chunk-AAZKUHPZ.js";import"../../chunk-J5WOZVPO.js";import"../../chunk-3IKZH76S.js";import{expose as e}from"comlink";var p=()=>!0;e({check:p,getValues:r,addToAllRows:o,joinWithoutColumns:t,joinOnColumns:m,appendToColumns:n,countMatching:i});
1
+ import{e as o,f as t,g as m,h as n,i,j as r}from"../../chunk-JORVN4P2.js";import"../../chunk-WOBUOLP3.js";import"../../chunk-WKADKRGH.js";import"../../chunk-REPANPD5.js";import"../../chunk-J5WOZVPO.js";import"../../chunk-3IKZH76S.js";import{expose as e}from"comlink";var p=()=>!0;e({check:p,getValues:r,addToAllRows:o,joinWithoutColumns:t,joinOnColumns:m,appendToColumns:n,countMatching:i});
@@ -1 +1 @@
1
- import{C as m,r as e,s as t,t as r,u as o,v as c,w as n,x as s,y as h}from"../../chunk-TS3BDFZ6.js";import"../../chunk-3IKZH76S.js";import{expose as v}from"comlink";var S=()=>!0;v({convertCsv2Sheet:e,convertExcel2Sheet:s,convertJson2Sheet:r,convertXLS2Sheet:o,convertXML2Sheet:c,jsonParser:t,parseDateFormat:m,convertPdf2Sheets:n,convertNumbers2Sheet:h,check:S});
1
+ import{A as h,D as v,r as e,s as t,t as r,u as o,v as c,w as n,x as m,y as s}from"../../chunk-WKADKRGH.js";import"../../chunk-3IKZH76S.js";import{expose as S}from"comlink";var p=()=>!0;S({convertCsv2Sheet:e,convertExcel2Sheet:m,convertJson2Sheet:r,convertXLS2Sheet:o,convertXML2Sheet:c,jsonParser:t,parseDateFormat:v,convertPdf2Sheets:n,convertNumbers2Sheet:s,buildXmlTree:h,check:p});
@@ -1 +1 @@
1
- import{e as o}from"../../chunk-VGA4QZVR.js";import"../../chunk-SKUCMMIT.js";import"../../chunk-TS3BDFZ6.js";import"../../chunk-AAZKUHPZ.js";import"../../chunk-J5WOZVPO.js";import"../../chunk-3IKZH76S.js";import*as e from"comlink";var m=()=>!0;e.expose({check:m,getCountBySearchValue:o});
1
+ import{e as o,h as e}from"../../chunk-QXD6LKS7.js";import"../../chunk-WOBUOLP3.js";import"../../chunk-WKADKRGH.js";import"../../chunk-REPANPD5.js";import"../../chunk-J5WOZVPO.js";import"../../chunk-3IKZH76S.js";import*as m from"comlink";var r=()=>!0;m.expose({check:r,getCountBySearchValue:o,getRowsToRemove:e});
package/chunk-4HB6YDED.js DELETED
@@ -1 +0,0 @@
1
- import{a as v}from"./chunk-J5WOZVPO.js";var W=h=>!h||typeof h!="string"?"":h.replace(/<[^>]*>/g,""),F=(h,n,d)=>{let e=h,s=[...n,{label:"rowIndex",key:"rowIndex"}];for(let c of s){let{label:m,key:a}=c,o=m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),t=[],r,u=/(['"])((?:(?!\1)[^\\]|\\.)*)(\1)/g;for(;(r=u.exec(e))!==null;)t.push({start:r.index,end:r.index+r[0].length});let l=p=>t.some(i=>p>=i.start&&p<i.end),g=[new RegExp(`@${o}\\b`,"g"),new RegExp(`@${o}(?=\\W|$)`,"g")];for(let p of g){let i,f="",y=0;for(p.lastIndex=0;(i=p.exec(e))!==null;){let b=i.index;f+=e.substring(y,b),l(b)?f+=i[0]:a==="rowIndex"?f+=`row.${a}`:f+=`row["${a.trim()}"]`,y=p.lastIndex,i.index===p.lastIndex&&p.lastIndex++}for(f+=e.substring(y),e=f,t.length=0,u.lastIndex=0;(r=u.exec(e))!==null;)t.push({start:r.index,end:r.index+r[0].length})}}if(d){let c=v.getInstance().getTruthyWords(),m=v.getInstance().getFalsyWords(),a=[],o,t=/(['"])((?:(?!\1)[^\\]|\\.)*)(\1)/g;for(;(o=t.exec(e))!==null;)a.push({start:o.index,end:o.index+o[0].length});let r=l=>a.some(g=>l>=g.start&&l<g.end),u=(l,g,p)=>{let i=l;for(let f of g){let b=String(f).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),x=new RegExp(`\\b${b}\\b`,"gi"),w="",$=0,I;for(x.lastIndex=0;(I=x.exec(i))!==null;){let S=I.index;w+=i.substring($,S),r(S)?w+=p:w+=I[0],$=x.lastIndex,I.index===x.lastIndex&&x.lastIndex++}w+=i.substring($),i=w}return i};e=u(e,c,"true"),e=u(e,m,"false")}return e},D=h=>h.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&").replace(/@/g,"[@]");import{Interpreter as R}from"eval5";import*as V from"@babel/standalone";var E=class{constructor(){this.formula="";this.outputData=[];this.initialize=()=>Promise.resolve();this.cleanupData=()=>{this.outputData=[]};this.setFormula=n=>(this.formula=n,Promise.resolve());this.check=()=>!0;this.parse=async(n,d,e)=>{this.outputData=[];let s=F(this.formula,d,e),c=this.generateInputValues(n,d),m=c?.[0];await this.validateFunction([m],d,s);let a=this.replaceNullishCoalescingWithLogicalOr(s),o=this.transpileToES5(a);for(let t=0;t<c.length;t++)try{let r={$$inputs:{...c[t],rowIndex:t+1}},g=new R(r,{timeout:5e3}).evaluate(o)(r.$$inputs),p=g===void 0?"":g;this.outputData[t]=[JSON.parse(JSON.stringify(p))]}catch(r){throw new Error(`Error in row ${t+1}: ${r instanceof Error?r.message:"Check your formula"}`)}return this.outputData};this.validateFunction=async(n,d,e)=>{let s=[...d.map(t=>t.key.trim()),"rowIndex"],c=e||this.formula;if(c){let t=/row\.([a-zA-Z_][\w$]*)/g,r=c.matchAll(t);for(let u of r){let l=u[1];if(!s.includes(l))throw new Error(`Invalid variable: row.${l} is not a valid column reference`)}}let m=n[0],a=this.replaceNullishCoalescingWithLogicalOr(e||this.formula),o=this.transpileToES5(a);try{let t={$$inputs:{...m,rowIndex:0}},l=new R(t,{timeout:5e3}).evaluate(o)(t.$$inputs),g=l===void 0?"":l;this.outputData[0]=[JSON.parse(JSON.stringify(g))]}catch(t){let r=t instanceof Error?t.message:"Invalid Syntax";throw Error(r)}};this.generateInputValues=(n,d)=>{let e=[];for(let s=0;s<n.length;++s)e[s]={},d.forEach((c,m)=>{let a=n[s],o=c.key.trim(),u=(Array.isArray(a)?a[m]:a[o])??"";e[s][o]=u}),e[s].rowIndex=s;return e};this.replaceNullishCoalescingWithLogicalOr=n=>n.replace(/\?\?/g,"||");this.transpileToES5=n=>{try{let e=V.transform(n,{presets:[["env",{targets:{ie:"11"},modules:!1}]],compact:!1,comments:!1}).code||n;return e=e.replace(/^["']use strict["'];?\s*/i,"").trim().replace(/;$/,""),e}catch{return n}}}};export{W as a,F as b,D as c,E as d};
package/chunk-AAZKUHPZ.js DELETED
@@ -1 +0,0 @@
1
- var c=n=>n.trim()?.replace(/[-!$%^&*()+|~=`{}\[\]:";'<>?,.\/]/g,"")?.replace(/^_+/,"")?.replace(/_+$/,"")?.replace(/(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0]|\ud83c[\udffb-\udfff])?)*/g,"")?.replace(/ /g,"_")?.replace(/ß/g,"ss")?.replace(/ä/g,"ae")?.replace(/ö/g,"oe")?.replace(/ü/g,"ue")?.toLowerCase(),l=n=>n?.replace(/[-!$%^&*()_+|~=`{}\\[\]:";'<>?,.\\/]/g," ")?.replace(/(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0]|\ud83c[\udffb-\udfff])?)*/g," ")?.toLowerCase();import{isNil as f}from"lodash";var p=class n{static{this.currencySymbol={eu:"\u20AC",us:"$"}}static{this.percentageSymbol="%"}static{this.maxSafeNumberLength=Number.MAX_SAFE_INTEGER}static convertToFormat(e,r){if(e==null||e===""||typeof e=="string"&&e.trim()==="")return"";let t="";if(typeof e=="string"){let a=this.convertStringToNumber(e,{targetFormat:r?.targetFormat});if(a===null)return e;t=a}else if(typeof e=="number"){let a=e;r?.adornment==="percentage"&&(a=e*100,a=Number(a.toFixed(10))),t=a.toString()}else throw new Error(`[convertToFormat] unsupported type of the "value" - ${typeof e}`);/[eE]/.test(t)&&(t=n.expandScientificNotation(t));let[o,i]=t.split("."),u=r?.decimalDigits||i?.length||0,s="";try{let a=Number(t);if(!isFinite(a))return t;s=n.formatUS(a,u)}catch{return t}if(r?.targetFormat==="eu"){let a=s.replace(/,/g,"$").replace(/\./g,",").replace(/\$/g,".");return this.appendAdornment(a,r)}return this.appendAdornment(s,r)}static detectNumberFormat(e,r){let t=[];for(let s=0;s<e.length;s++)(e[s]===","||e[s]===".")&&t.push(e[s]);if(t.length===0)return;let o=e.replace(/([+\-EUR€SD$%\s])/g,"");if(t.length===1){let[s,a]=o.split(t[0]);return s.length>3?t[0]===","?"eu":"us":s.replace(/0/g,"")===""?t[0]===","?"eu":"us":a.length===3?r?.targetFormat?r?.targetFormat:r?.resolveUncertainty===!1?void 0:t[0]===","?"us":"eu":t[0]===","?"eu":"us"}let i=/^([1-9]\d{0,2})(\.\d{3})*(,\d+)?$/,u=/^([1-9]\d{0,2})(,\d{3})*(\.\d+)?$/;return i.test(o)?"eu":u.test(o)?"us":null}static convertToUsWithDecimal(e,r){let t=e,o=n.getDelimiters(e),i=e.replace(/([+\-EUR€SD$%\s])/g,"");if(o.length===1){let[u,s]=i.split(o[0]);if(s.length===3)return r==="us"?t=`${e}`?.replace(/,/g,""):t=`${e}`?.replace(/\./g,"$")?.replace(/,/,".").replace(/\$/g,""),t}return this.replaceDelimiter(e)}static{this.convertStringToNumber=(e,r)=>{if(typeof e=="number")return`${e}`;if(typeof e!="string")return null;let t=e.trim().replace(/([EUR€SD$%\s])/g,"");if(t==="")return e;let o=this.detectNumberFormat(t,{targetFormat:r?.format??r?.targetFormat}),i="";if(o===null||(o==="us"||f(o)?i=t.replace(/,/g,""):i=t.replace(/\./g,"$").replace(/,/,".").replace(/\$/g,""),i.length>n.maxSafeNumberLength&&(i=i.slice(0,n.maxSafeNumberLength),i.at(-1)==="."&&(i=i.slice(0,n.maxSafeNumberLength-1))),isNaN(Number(i))))return null;if(r?.adornment==="percentage"&&e.includes("%")){let u=Number(i)/100;i=Number(u.toFixed(10)).toString()}return i}}static hasDecimalPart(e,r){if(typeof e=="number")return e%1!==0;let t=e.trim(),o=r||this.detectNumberFormat(t);return o===null?!1:o==="us"?e.includes("."):e.includes(",")}static appendAdornment(e,r){return r?.adornment==="currency"?r.symbol==="us"?`${this.currencySymbol.us}${e}`:`${e} ${this.currencySymbol[r.symbol??"eu"]}`:r?.adornment==="percentage"?`${e} ${this.percentageSymbol}`:e}static getDelimiters(e){let r=[];for(let t=0;t<e.length;t++)(e[t]===","||e[t]===".")&&r.push(e[t]);return r}static expandScientificNotation(e){let r=e.match(/^([+-]?)(\d+)\.?(\d*)[eE]([+-]?\d+)$/);if(!r)return e;let[,t,o,i,u]=r,s=parseInt(u,10),a=o+i,m=o.length+s;return(m<=0?-m:m>=a.length?m-a.length:0)>1e3?e:m<=0?`${t}0.${"0".repeat(-m)}${a}`:m>=a.length?`${t}${a}${"0".repeat(m-a.length)}`:`${t}${a.slice(0,m)}.${a.slice(m)}`}static formatUS(e,r){return new Intl.NumberFormat("en-US",{useGrouping:!0,minimumFractionDigits:r,maximumFractionDigits:r}).format(e)}static replaceDelimiter(e){let r=e,t=n.detectNumberFormat(`${e}`);return f(t)?null:(t==="eu"?r=`${e}`?.replace(/\./g,"$")?.replace(/,/,".").replace(/\$/g,""):r=`${e}`?.replace(/,/g,""),r)}};import{isInteger as b,isNumber as y,isString as _}from"lodash";var d=n=>{if(_(n)){let e=n.trimEnd();return e===""?null:e}return n},P=(n,e,r)=>{for(let t=0;t<n.length;t++){let o=n[t].getKey(),i=e;if(r&&(o=l(o),i=l(i)),o===i)return n[t]}return null},M=(n,e)=>{for(let r=0;r<e.length;r++)if(e[r].getKey()===n)return r;return-1},T=(n,e)=>`${n.value}`==`${e}`,N=(n,e)=>{let r=0;for(let t=0;t<e.length;t++){let o=e[t],i="baseKeyCounter";o?.[i]&&n===o?.["baseKey"]&&r<(o?.[i]??0)&&(r=o?.[i]||0)}return r},h=(n,e)=>!n.some(r=>r.baseKey===e),C=(n,e,r=!0)=>{let t=r?c(n):n,o=N(t,e)+1,i=t;return h(e,t)?o--:o>0&&(i=`${t}_${o}`),{key:{value:i,baseKey:t,baseKeyCounter:o}}},K=({value:n,dataModel:e,isTrim:r})=>{let t=e.getOptionTypeMap(),o=n!==void 0?t.get(n):void 0;if(!o&&typeof n=="number"&&(o=t.get(String(n))),!o&&typeof n=="string"){let i=Number(n);isNaN(i)||(o=t.get(i))}if(o=o??"string",n===""&&t.has(n))return n;if(o==="int"){let i=Number(n);return!isNaN(i)&&b(i)?i:r?d(`${n}`):`${n}`}else if(o==="float"){if(y(n))return n;let i=`${n}`.replace(/,/,"."),u=p.convertStringToNumber(`${i}`,{format:"us"});return u===null?r?d(`${n}`):`${n}`:Number(u)}else return r?d(`${n}`):`${n}`};export{p as a,l as b,d as c,P as d,M as e,T as f,C as g,K as h};
package/chunk-BVFFBQFD.js DELETED
@@ -1 +0,0 @@
1
- import{d as F,i as y,j as c,r as w}from"./chunk-SKUCMMIT.js";import{B as J,C as P,d as O,k as A,m as T}from"./chunk-TS3BDFZ6.js";import{b as p}from"./chunk-AAZKUHPZ.js";import{isEmpty as Q,uniq as X}from"lodash";var H=0,I=class{constructor({sheet:e,columnKey:t,rows:s,id:o,label:r,refJoinSheetColum:a}){this.removed=!1;this.label="";this.rawRowsBeforeDateParse=null;this.dateRowsByInputFormat=new Map;this.getColumnKey=()=>this.columnKey;this.getId=()=>this.id;this.getSheet=()=>this.sheet;this.getRows=()=>this.rows;this.getUniqueRows=()=>(this.uniques===void 0&&(this.uniques=X(this.getRows())),this.uniques);this.remove=()=>{this.removed=!0};this.unRemove=()=>{this.removed=!1};this.isRemoved=()=>this.removed;this.getType=()=>0;this.getFileName=()=>this.sheet.getSheetFileName();this.toJSON=()=>({columnKey:this.columnKey,id:this.id,rows:this.rows,type:this.getType()});this.equal=e=>this.getId()===e.getId();this.keyEqual=e=>this.columnKey===e.columnKey;this.setIndex=e=>{this.index=e};this.getIndex=()=>this.index;this.normalizeInputFormatKey=e=>{let t=typeof e=="string"?e.trim():"";return t!==""?t:null};this.dateInputFormatCacheKey=e=>this.normalizeInputFormatKey(e)??"\0auto";this.needsDateFormatParse=e=>!this.dateRowsByInputFormat.has(this.dateInputFormatCacheKey(e));this.hasParsedDateForInputFormat=e=>!this.needsDateFormatParse(e);this.getParsedRowsForInputFormat=e=>this.dateRowsByInputFormat.get(this.dateInputFormatCacheKey(e));this.getRowsForDateInputFormatParse=()=>this.rawRowsBeforeDateParse??this.rows;this.applyDateInputFormatParse=(e,t)=>{let s=this.getRowsForDateInputFormatParse();if(e.length!==s.length)throw new Error(`SheetColumn.applyDateInputFormatParse: parsed row count (${e.length}) must match source row count (${s.length}) for column "${this.columnKey}".`);this.dateRowsByInputFormat.set(this.dateInputFormatCacheKey(t),e)};this.getRefJoinSheetColum=()=>this.refJoinSheetColum;this.columnKey=t.trim(),this.sheet=e,Object.defineProperty(this,"sheet",{value:e,enumerable:!1,writable:!0,configurable:!0}),this.rows=Q(s)?[""]:s,this.rawRowsBeforeDateParse=[...this.rows],typeof o>"u"?(H++,this.id=`${t}-${H}`):this.id=o,r&&(this.label=r),Object.defineProperty(this,"refJoinSheetColum",{value:a,enumerable:!1,writable:!0,configurable:!0})}setRows(e){this.rows=e,this.uniques=void 0}},f=I;var b=class extends f{constructor({sheet:t,sheetColumns:s,rows:o,id:r,columnKey:a}){super({columnKey:a,rows:o,sheet:t,id:r});this.getType=()=>1;this.getJoinedSheetColumns=()=>this.sheetColumns;this.toJSON=()=>({columnKey:this.columnKey,id:this.id,rows:this.rows,sheetColumns:this.sheetColumns.map(t=>t.toJSON()),type:this.getType()});this.sheetColumns=s}},B=b;var _=["?",",","@"];import{isNaN as ee,minBy as te,isString as se,isEqual as oe,isEmpty as L,isNil as re}from"lodash";var x=class{constructor({sheets:e,filename:t,type:s,fileSize:o}){this.globalNumberFormat="eu";this.columnsNumberFormat=[];this.addSheet=e=>{this.sheets.push(e)};this.isSelected=()=>{for(let e=0;e<this.sheets.length;e++)if(this.sheets[e].isSelected())return!0;return!1};this.getSheets=()=>this.sheets;this.getSelectedSheets=()=>this.sheets.filter(e=>e.isSelected());this.getFilename=()=>this.filename;this.selectAllSheet=e=>this.sheets.forEach(t=>{t.setSelected(e)});this.getType=()=>this.type;this.getFileSize=()=>{let e=this.fileSize/1e6;return Number(parseFloat(`${e}`).toFixed(4))};this.sheets=e,this.filename=t,this.type=s,this.fileSize=o??0,this.sheets.forEach(r=>{r.setSpreadSheet(this)})}setNumberFormat(e){this.globalNumberFormat=e.global,this.columnsNumberFormat=e.columns}getNumberFormat(){return{global:this.globalNumberFormat,columns:this.columnsNumberFormat}}},z=x;var $=0,R=class{constructor({data:e,name:t,isNotSetColumn:s,id:o}){this.selected=!1;this.isManualSelectHeader=!1;this.columns=[];this.columnsInitialized=!1;this.headerRowIndex=0;this.transposed=!1;this.headerRowIndexes=[];this.addedColumns=[];this.usedSourceCells=new Set;this.mergedHeadersActive=!1;this.mergedRowsBackup=null;this.availableRows=null;this.spreadSheet=new z({filename:"",sheets:[],type:"xlsx",fileSize:0});this.getId=()=>this.id;this.setSpreadSheet=e=>{this.spreadSheet=e};this.getSpreadSheet=()=>this.spreadSheet;this.setSelected=e=>{this.selected=e};this.isSelected=()=>this.selected;this.setHeaderRowIndex=e=>{this.headerRowIndex=e,this.columnsInitialized=!1,this.mergedHeadersActive||(this.headerRowIndexes=[e])};this.setTransposed=e=>{this.transposed=e};this.getTransposed=()=>this.transposed;this.setHeaderRowIndexes=e=>{this.headerRowIndexes=[...e]};this.getHeaderRowIndexes=()=>this.headerRowIndexes.length>0?this.headerRowIndexes:[this.headerRowIndex];this.addAddedColumn=e=>{if(this.addedColumns.push(e),e.sourceCell){let o=`${e.sourceCell.row},${e.sourceCell.col}`;this.usedSourceCells.add(o)}let t=this.data[this.headerRowIndex],s=this.data.length>0?Math.max(...this.data.map(o=>o.length)):0;t&&t.push(e.columnName);for(let o=0;o<this.data.length;o++)if(o!==this.headerRowIndex){for(;this.data[o].length<s;)this.data[o].push("");o<this.headerRowIndex?this.data[o].push(""):this.data[o].push(e.value)}this.setColumns()};this.removeAddedColumn=e=>{let s=(this.data[this.headerRowIndex]?.length||0)-this.addedColumns.length,o=e-s;if(o<0||o>=this.addedColumns.length)return;let r=this.addedColumns[o];if(r?.sourceCell){let a=`${r.sourceCell.row},${r.sourceCell.col}`;this.usedSourceCells.delete(a)}for(let a=0;a<this.data.length;a++)this.data[a].splice(e,1);this.addedColumns.splice(o,1),this.setColumns()};this.removeColumnFromData=e=>{if(!(e<0))for(let t=0;t<this.data.length;t++)this.data[t].length>e&&this.data[t].splice(e,1)};this.clearAddedColumns=()=>{if(this.addedColumns.length>0){let t=(this.data[this.headerRowIndex]?.length||0)-this.addedColumns.length;for(let s=this.addedColumns.length-1;s>=0;s--){let o=t+s;for(let r=0;r<this.data.length;r++)this.data[r].length>o&&this.data[r].splice(o,1)}}this.addedColumns=[],this.usedSourceCells.clear(),this.setColumns()};this.isSourceCellUsed=(e,t)=>{let s=`${e},${t}`;return this.usedSourceCells.has(s)};this.getAddedColumnBySourceCell=(e,t)=>this.addedColumns.find(s=>s.sourceCell&&s.sourceCell.row===e&&s.sourceCell.col===t);this.getAddedColumns=()=>this.addedColumns;this.setMergedHeadersActive=e=>{this.mergedHeadersActive=e};this.isMergedHeadersActive=()=>this.mergedHeadersActive;this.setMergedRowsBackup=e=>{this.mergedRowsBackup=e};this.getMergedRowsBackup=()=>this.mergedRowsBackup;this.setAvailableRows=e=>{this.availableRows=e};this.getAvailableRows=()=>this.availableRows;this.isLoneWhitelistCharacter=e=>{let t=e.toString()?.trim()??"";return _.some(s=>t===s)};this.isSignificantCell=e=>!L(e)&&!this.isLoneWhitelistCharacter(e);this.collapseAdjacentDuplicates=e=>e.filter((t,s)=>s===0||`${t}`!=`${e[s-1]}`);this.getSignificantCells=e=>{let t=(e??[]).filter(this.isSignificantCell);return this.collapseAdjacentDuplicates(t)};this.getDataTransform=()=>this.data.map((e,t)=>({data:e,index:t,length:this.getSignificantCells(e).length}));this.getMaxLengthColumns=()=>this.getDataTransform().reduce((t,s)=>Math.max(t,s.length),0);this.isHeaderLikeCell=e=>!F.includes(se(e)?e.toLowerCase():e)&&ee(Number(e));this.countHeaderLikeCells=e=>this.getSignificantCells(e).filter(this.isHeaderLikeCell).length;this.setHeaderByAutoDetection=()=>{let t=this.getMaxLengthColumns(),s=this.getDataTransform().slice(0,50).filter(r=>r.length===t&&this.countHeaderLikeCells(r.data)===t),o=s.length===1?s[0].index:te(s,r=>r.length)?.index??0;this.setHeaderRowIndex(o)};this.getHeaderRowIndex=()=>this.headerRowIndex;this.getHeaderRow=()=>this.data[this.headerRowIndex]?.filter(e=>!!e);this.getColumns=()=>(this.ensureColumnsBuilt(),this.columns.filter(e=>!e.isRemoved()));this.getSortedColumns=()=>[...this.getColumns()].sort((e,t)=>p(e.getColumnKey())<p(t.getColumnKey())?-1:p(e.getColumnKey())>p(t.getColumnKey())?1:0);this.getColumnsWithRemoved=()=>(this.ensureColumnsBuilt(),this.columns.filter(e=>e.getType()!==1));this.getColumn=(e,t)=>(this.ensureColumnsBuilt(),this.columns.find(s=>t?p(s.getColumnKey())===p(`${e}`):s.getColumnKey()===e));this.getColumnsByKey=(e,t)=>(this.ensureColumnsBuilt(),this.columns.filter(s=>t?p(s.getColumnKey())===p(`${e}`):s.getColumnKey()===e));this.getValues=()=>{let e=this.data.filter((s,o)=>o>this.headerRowIndex);if(L(e))return[[]];let t=[];for(let s=0;s<e.length;s++){let o=[];for(let r=0;r<this.data[this.headerRowIndex].length;r++)re(this.data[this.headerRowIndex][r])||o.push(this.parseValue(e[s][r]));t.push(o)}return t};this.getData=()=>this.data;this.getName=()=>this.name;this.getDisplayName=({t:e})=>{if(this.getName()?.length>0)return this.getName();switch(this.spreadSheet.getType()){case"json":return`${e("txt_default_sheet_prefix_name")} 1`;case"csv":return`${e("txt_default_sheet_prefix_name")} 1`;default:return""}};this.getSheetFileName=()=>`${this.spreadSheet.getFilename()}`;this.getIsManualSelectHeader=()=>this.isManualSelectHeader;this.setIsManualSelectHeader=()=>{this.isManualSelectHeader=!0};this.clearIsManualSelectHeader=()=>{this.isManualSelectHeader=!1};this.addColumn=e=>{this.ensureColumnsBuilt(),this.columns.push(new f({columnKey:`${e}`,sheet:this,rows:this.getRowsByColumnIndex(this.getColumnIndex(e))}))};this.removeColumn=e=>{this.ensureColumnsBuilt(),this.columns.find(t=>t.getColumnKey()===e)?.remove()};this.removeColumnByIndex=e=>{this.ensureColumnsBuilt(),this.columns.find((t,s)=>s===e)?.remove()};this.setData=e=>{this.data=e};this.toJSON=()=>({name:this.name,id:this.id,type:this.getType(),values:this.getValues(),headerRow:this.getHeaderRow()});this.equal=e=>this.id===e.getId();this.getType=()=>0;this.getRowsByColumnIndex=e=>{if(e===-1)return[];let t=[];for(let s=0;s<this.data.length;s++){let o=this.data[s];if(s>this.headerRowIndex){let r=o[e]??"";t.push(this.parseValue(r))}}return t};this.ensureColumnsBuilt=()=>{this.columnsInitialized||this.setColumns()};this.setColumns=()=>{let e=this.data[this.headerRowIndex];if(e){let t=[];for(let s=0;s<e.length;++s){let o=e[s];o&&t.push(new f({columnKey:`${o}`,sheet:this,rows:this.getRowsByColumnIndex(s)}))}this.columns=t}else this.columns=[];this.columnsInitialized=!0};this.getColumnIndex=e=>this.data[this.headerRowIndex].findIndex(o=>oe(`${o}`,`${e}`));this.parseValue=e=>typeof e=="string"?e.trim():e;this.data=e,this.name=t,typeof o>"u"?($++,this.id=`${t}-${$}`):this.id=o,this.columnsInitialized=!!s}},E=R;var V=class extends E{constructor({joinedData:t,sheets:s,mappings:o,mappingIndexes:r}){super({data:t.data,name:"join-sheet",isNotSetColumn:!0});this.sheets=[];this.joinHistory=[];this.findRefJoinSheetColumn=t=>{let s=this.sheets.length===2?this.sheets[0]:this,o=this.sheets[this.sheets.length-1];if(t<s.getColumns().length)return s.getColumns()[t];let r=t-s.getColumns().length;return o.getColumns().filter((a,l)=>this.joinHistory[this.joinHistory.length-1].mappingIndexes.every(i=>i.target!==l))[r]};this.setJoinColumns=(t,s)=>{let o=this.data[this.headerRowIndex];if(!o){this.columns=[];return}let r=[];for(let a=0;a<o.length;++a){let l=o[a],i=s.findIndex(u=>u.source===a),h=this.columns[a]&&this.columns[a].getType()===1;if(i>=0||h){let u=t[i],d;h&&i>=0?d=[...this.columns[a].getJoinedSheetColumns(),u.target]:h?d=this.columns[a].getJoinedSheetColumns():d=[u.source.getRefJoinSheetColum()??u.source,u.target],r.push(new B({columnKey:`${l}`,sheetColumns:d,sheet:this,rows:this.getRowsByColumnIndex(a)}))}else{let u=this.columns[a]?this.columns[a].getRefJoinSheetColum()??this.columns[a]:this.findRefJoinSheetColumn(a);r.push(new f({columnKey:`${l}`,sheet:u.getSheet(),rows:this.getRowsByColumnIndex(a),refJoinSheetColum:u}))}}this.columns=r};this.getJoinedSheets=()=>this.sheets;this.getType=()=>1;this.joinSheet=(t,s,o,r)=>{this.setData(t.data),this.sheets.push(s),this.joinHistory.push({mappingIndexes:r,type:t.type,row:t.data.length,col:this.data[this.headerRowIndex]?.length??0}),this.setJoinColumns(o,r)};this.getJoinColumns=()=>this.columns.filter(t=>t.getType()===1);this.getJoinHistory=()=>this.joinHistory;this.headerRowIndex=0,this.joinHistory.push({mappingIndexes:r,type:t.type,row:t.data.length,col:this.data[this.headerRowIndex]?.length??0}),this.sheets=s,this.setJoinColumns(o,r)}},Je=V;var j=({rowA:n,rowB:e},t)=>t.every(s=>{let o=`${n[s.source]??""}`,r=`${e[s.target]??""}`;return o===r&&o!==""&&r!==""}),ae=(n,e,t)=>{let s=[],o=n.headerRow,r=e.headerRow;for(let a=0;a<o.length;++a)s.push(o[a]);for(let a=0;a<r.length;++a)t.every(l=>l.target!==a)&&s.push(r[a]);return s},Ke=async(n,e)=>{let t=n.values,s=e.values,o=n.headerRow,r=e.headerRow,a=[...o,...r],l=[];l.push(a);for(let i=0;i<t.length;++i)l.push([...t[i],...s[0]]);return{data:l,type:"ADD_TO_ALL_ROWS"}},ze=async(n,e)=>{let t=n.values,s=e.values,o=n.headerRow,r=e.headerRow,a=[...o,...r],l=[];l.push(a);for(let i=0;i<t.length;++i)l.push([...t[i],...r.map(()=>"")]);for(let i=0;i<s.length;++i)l.push([...o.map(()=>""),...s[i]]);return{data:l,type:"JOIN_WITHOUT_COLUMNS"}},Le=async(n,e,t)=>{let s=n.values,o=e.values,r=[],a=[],l={},i=ae(n,e,t);r.push(i);for(let h=0;h<s.length;++h){let u=!1,d=s[h];for(let m=0;m<o.length;++m){let g=o[m];j({rowA:d,rowB:g},t)&&(l[m]=!0,u=!0,r.push([...d,...g.filter((M,Y)=>t.every(G=>G.target!==Y))]))}u||a.push([...d,...e.headerRow.filter((m,g)=>t.every(M=>M.target!==g)).map(()=>"")])}for(let h=0;h<o.length;++h){if(l[h])continue;let u=o[h],d=n.headerRow.map(()=>"");t.forEach(m=>{d[m.source]=u[m.target]}),a.push([...d,...u.filter((m,g)=>t.every(M=>M.target!==g))])}return a.forEach(h=>{r.push(h)}),{data:r,type:"JOIN_ON_COLUMNS"}},$e=async(n,e,t)=>{let s=e.headerRow.filter((l,i)=>t.every(h=>h.target!==i)),r=[[...n.headerRow,...s]];for(let l=0;l<n.values.length;++l){let i=[...n.values[l],...s.map(()=>"")];r.push(i)}let a=e.values;for(let l=0;l<a.length;++l){let i=n.headerRow.map(()=>""),h=[];for(let u=0;u<e.headerRow.length;++u){let d=t.find(m=>m.target===u);d?i[d.source]=a[l][u]:h.push(a[l][u])}r.push([...i,...h])}return{data:r,type:"APPEND_TO_COLUMNS"}},Ee=async(n,e,t)=>{let s=n.values,o=e.values,r=s.length+o.length,a=0,l={};for(let i=0;i<s.length;i++){let h=s[i],u=null,d=0;for(let m=0;m<o.length;m++){let g=o[m];if(j({rowA:h,rowB:g},t)&&(u=m,d++,d===2))break}d===1&&u!==null&&(a+=1,l[u]=!0)}for(let i=0;i<o.length;i++)l[i]&&(a+=1);return{count:a,total:r}};import{isNil as ie}from"lodash";var k=(n,e)=>{if(e.getType()!=="date")return c.parse(n,{dataModel:e});if(A(n))return null;let t=`${n}`,s=e.getInputFormat();return T(s)?O(t)?c.parse(t,{dataModel:e}):J(t,s)?c.parse(P([t],s)[0],{dataModel:e}):t:c.parse(t,{dataModel:e})};var N=class{constructor({sheetColumn:e,matchedDataModel:t,detectedNumberFormats:s}){this.parseSheetValue=(e,t)=>t.dataModel.getType()==="date"?k(e,t.dataModel):c.parse(e,t);this.getOptionValue=(e,t)=>{if(!t)if(this.matchedDataModel.dataModel){let s=this.sheetColumn.columnKey,r=this.detectedNumberFormats.columns.find(a=>a.column===s)?.numberFormat||this.detectedNumberFormats.global;return this.parseSheetValue(e,{dataModel:this.matchedDataModel.dataModel,isParseFromSheet:!0,numberFormat:r})}else return e;for(let s=0;s<t.length;s++)if(`${t[s]?.sheetOption}`==`${e}`){let o=!ie(t[s]?.dataModelOptions)&&(t[s]?.dataModelOptions?.length??0)>0;if(t[s]?.autoPreserved===!0&&t[s]?.dataModelOption==null&&!o){if(this.matchedDataModel.dataModel instanceof w){let r=`${e}`,a=this.matchedDataModel.dataModel.getOptions().find(l=>l.label===r||l.value===r);if(a)return c.parse(a.value,{dataModel:this.matchedDataModel.dataModel,isParseFromSheet:!0})}return e}return this.matchedDataModel.dataModel&&this.matchedDataModel.dataModel.getIsMultiSelection()?c.parse(t[s]?.dataModelOptions,{dataModel:this.matchedDataModel.dataModel,isParseFromSheet:!0}):this.matchedDataModel.dataModel?c.parse(t[s]?.dataModelOption,{dataModel:this.matchedDataModel.dataModel,isParseFromSheet:!0}):t[s]?.dataModelOption}};this.getValues=()=>{let e=this.sheetColumn.rows,t=[];for(let s=0;s<e.length;s++){let o=e[s],r=this.getOptionValue(o,this.matchedOptions);t.push(r)}return t};if(this.sheetColumn=e,this.matchedDataModel=t,this.matchedOptions=void 0,this.detectedNumberFormats=s||{global:"eu",columns:[]},this.matchedDataModel.matchedOptions){this.matchedOptions=[];for(let o=0;o<(this.matchedDataModel.matchedOptions?.length??0);o++){let r=this.matchedDataModel.matchedOptions[o];this.matchedDataModel.dataModel?.getIsMultiSelection()?r.dataModelOptions&&this.matchedOptions.push(r):r.dataModelOption!==void 0&&r.dataModelOption!==null?this.matchedOptions.push(r):r.autoPreserved===!0&&!r.userCleared&&this.matchedOptions.push(r)}}}},U=N;var v=class{constructor(e){this.matchedColumns=[];this.parseValues=()=>{let e=[];this.matchedColumns.forEach(t=>{let s=t.matchedDataModel,r=new U({sheetColumn:t.sheetColumn,matchedDataModel:s,detectedNumberFormats:this.detectedNumberFormats}).getValues(),a=s.dataModel.getKey();r.forEach((l,i)=>{e[i]?e[i][a]=l:e[i]={[a]:l}})});for(let t=0;t<e.length;++t)for(let s=0;s<this.columns.length;++s){let r=this.columns[s].key;e[t][r]===void 0&&(e[t][r]=null)}return e};this.getValues=()=>(this.matchedColumns=[],this.matching.filter(t=>t.matchedDataModel?.dataModel).forEach(t=>{this.matchedColumns.push({sheetColumn:t.sheetColumn,matchedDataModel:t.matchedDataModel})}),this.parseValues());let{matching:t,detectedNumberFormats:s}=e;this.matching=t,this.detectedNumberFormats=s||{global:"eu",columns:[]},this.columns=e.columns??[]}},W=v;var pt=({matching:n,detectedNumberFormats:e,columns:t})=>new W({matching:n,detectedNumberFormats:e,columns:t}).getValues();import*as q from"comlink";var C=class{static{this.serialize=e=>e.serialize()}static{this.deSerialize=e=>y.isTypeCategory(e.type)?new w({description:e.description,example:e.example,key:e.key,label:e.label,type:e.type,options:e.options,validators:[],alternativeMatches:e.alternativeMatches,columnSize:e.columnSize,isMultiSelection:e.isMultiSelection??!1,allowCustomOptions:e.allowCustomOptions,allowedCustomOptionTypes:e.allowedCustomOptionTypes,hidden:e.hidden,disabled:e.disabled,optionMappingConfiguration:e.optionMappingConfiguration}):new y({description:e.description,example:e.example,key:e.key,label:e.label,type:e.type,validators:[],alternativeMatches:e.alternativeMatches,columnSize:e.columnSize,outputFormat:e.outputFormat,inputFormat:e.inputFormat,numberFormat:e.numberFormat,hidden:e.hidden,disabled:e.disabled,optionMappingConfiguration:e.optionMappingConfiguration})}};var S=class{static{this.serialize=e=>{let t={matching:[],detectedNumberFormats:e.detectedNumberFormats,columns:e.columns};return t.matching=e.matching.map(s=>({sheetColumn:s.sheetColumn,matchedDataModel:s.matchedDataModel?{dataModel:s.matchedDataModel.dataModel?C.serialize(s.matchedDataModel.dataModel):s.matchedDataModel.dataModel,matchedOptions:s.matchedDataModel.matchedOptions}:s.matchedDataModel})),[t,[]]}}static{this.deserialize=e=>({matching:e.matching.map(t=>({sheetColumn:t.sheetColumn,matchedDataModel:t.matchedDataModel?{dataModel:t.matchedDataModel.dataModel?C.deSerialize(t.matchedDataModel.dataModel):t.matchedDataModel.dataModel,matchedOptions:t.matchedDataModel.matchedOptions}:t.matchedDataModel})),detectedNumberFormats:e.detectedNumberFormats,columns:e.columns})}};q.transferHandlers.set("Matching",{canHandle:n=>!!(n!==null&&typeof n=="object"&&n.matching),serialize:n=>S.serialize(n),deserialize:n=>S.deserialize(n)});export{f as a,z as b,E as c,Je as d,Ke as e,ze as f,Le as g,$e as h,Ee as i,pt as j,C as k};
package/chunk-SKUCMMIT.js DELETED
@@ -1 +0,0 @@
1
- import{B as T,C as V,a as G,b as q,c as Z,d as J,e as j,f as ee,h as te,l as re,m as f}from"./chunk-TS3BDFZ6.js";import{a as m,c as a,f as x,h as b}from"./chunk-AAZKUHPZ.js";import{a as g}from"./chunk-J5WOZVPO.js";var U=class{constructor({validation:e,regex:t,fields:i,errorMessage:o,operator:n,value:s}){this.getValidation=()=>this.validation;this.getRegex=()=>this.regex;this.getFields=()=>this.fields;this.getErrorMessage=()=>this.errorMessage;this.getOperator=()=>this.operator;this.getValue=()=>this.value;this.serialize=()=>({validation:this.getValidation(),fields:this.getFields(),regex:this.getRegex(),errorMessage:this.getErrorMessage(),operator:this.getOperator(),value:this.getValue()});this.validation=e,this.regex=t,this.fields=i??[],this.errorMessage=o,this.operator=n,this.value=s}},ht=U;var h=class r{constructor({description:e,key:t,example:i,label:o,type:n,validators:s,mappingValidation:y,alternativeMatches:c,columnSize:l,creator:p,baseKey:u,baseKeyCounter:E,outputFormat:M,inputFormat:O,numberFormat:D,hidden:S,disabled:P,optionMappingConfiguration:R,columnWidth:I,excludeFromAutoMatching:_}){this.getDescription=()=>this.description;this.getKey=()=>this.key;this.getExample=()=>this.example;this.getLabel=()=>this.label;this.setLabel=e=>{this.label=e};this.getType=()=>this.type;this.getOutputFormat=()=>r.getOutputFormat(this.outputFormat);this.getInputFormat=()=>this.inputFormat;this.getValidators=()=>this.validators;this.getColumnSize=()=>this.columnSize;this.getColumnWidth=()=>this.columnWidth;this.getIsRequired=()=>!!this.validators.find(t=>t.getValidation()==="REQUIRED");this.getIsUnique=()=>!!this.validators.find(t=>t.getValidation()==="UNIQUE");this.getIsUniqueAndRequired=()=>this.getIsRequired()===!0&&this.getIsUnique()===!0;this.hasMappingValidation=()=>!!(this.mappingValidation&&this.mappingValidation.logic&&this.mappingValidation.logic.trim().length>0);this.getMappingValidation=()=>this.mappingValidation||void 0;this.getAlternativeMatches=()=>this.alternativeMatches.filter(e=>!!e);this.getCreator=()=>this.creator;this.getBaseKey=()=>this.baseKey;this.getBaseKeyCounter=()=>this.baseKeyCounter;this.setCustomKey=({key:e,baseKey:t,baseKeyCounter:i,creator:o})=>{this.baseKey=t,this.key=e,this.baseKeyCounter=i,this.creator=o};this.isDropdown=()=>r.isTypeDropdown(this.getType());this.isCategoryType=()=>r.isTypeCategory(this.getType());this.isBooleanType=()=>this.type==="boolean";this.serialize=()=>({description:this.getDescription(),example:this.getExample(),key:this.getKey(),label:this.getLabel(),type:this.getType(),validators:[],alternativeMatches:this.getAlternativeMatches(),columnSize:this.getColumnSize(),columnWidth:this.getColumnWidth(),outputFormat:this.getOutputFormat(),inputFormat:this.getInputFormat(),isMultiSelection:this.getIsMultiSelection(),numberFormat:this.getNumberFormat(),baseKey:this.getBaseKey(),baseKeyCounter:this.getBaseKeyCounter(),creator:this.getCreator(),hidden:this.isHidden(),disabled:this.isDisabled(),optionMappingConfiguration:this.getOptionMappingConfiguration(),excludeFromAutoMatching:this.isExcludedFromAutoMatching()});this.getIsMultiSelection=()=>!1;this.getNumberFormat=()=>this.numberFormat;this.isDisabled=()=>this.disabled;this.isNumeric=()=>this.type==="int"||this.type==="float"||this.type==="currency_eur"||this.type==="currency_usd"||this.type==="percentage";this.isCurrency=()=>this.type==="currency_eur"||this.type==="currency_usd";this.baseClone=()=>{let e=this.serialize();return new r({description:e.description,example:e.example,key:e.key,label:e.label,type:e.type,validators:this.getValidators(),alternativeMatches:e.alternativeMatches,columnSize:e.columnSize,columnWidth:e.columnWidth,baseKey:e.baseKey,baseKeyCounter:e.baseKeyCounter,creator:e.creator,numberFormat:e.numberFormat,outputFormat:e.outputFormat,inputFormat:e.inputFormat,hidden:e.hidden,disabled:e.disabled,optionMappingConfiguration:e.optionMappingConfiguration,excludeFromAutoMatching:e.excludeFromAutoMatching})};this.isHidden=()=>this.hidden;this.isExcludedFromAutoMatching=()=>this.excludeFromAutoMatching;this.getOptionMappingConfiguration=()=>this.optionMappingConfiguration;this.description=e,this.key=t,this.example=i,this.label=o,this.type=n,this.validators=s??[],this.mappingValidation=y,this.alternativeMatches=c?[...c.filter(d=>d!==o&&d!==t)?.map(d=>d?.toString())]:[],this.columnSize=l,this.creator=p,this.baseKey=u||t,this.baseKeyCounter=E||0,this.outputFormat=M||"",this.inputFormat=O??null,this.numberFormat=D||"eu",this.hidden=S??!1,this.disabled=P??!1,this.optionMappingConfiguration=R,this.columnWidth=I,this.excludeFromAutoMatching=_??!1}static{this.getOutputFormat=e=>(e||"DD.MM.YYYY").replace(/d/g,"D").replace(/e|E/g,"")}static{this.isTypeDropdown=e=>r.isTypeCategory(e)||e==="boolean"}static{this.isTypeCategory=e=>e==="single-select"||e==="currency_code"||e==="country_code_alpha_2"||e==="country_code_alpha_3"}};import{isNil as z,escapeRegExp as Mt,isArray as gt}from"lodash";var N=()=>g.getInstance().getTruthyWords(),L=()=>g.getInstance().getFalsyWords(),Rt=()=>g.getInstance().getBooleanOptionToRender(),It=[...N(),...L()];import{isArray as Ae,isNil as Oe,isObject as De}from"lodash";var H=class{constructor(){this.parse=(e,t)=>Oe(e)||Ae(e)||De(e)?null:N().includes(`${e}`.toLowerCase())?!0:L().includes(`${e}`.toLowerCase())?!1:e===""?null:`${e}`}},oe=H;import{isArray as ne,isBoolean as se,isNil as ae,isObject as le}from"lodash";var Y=class{constructor(){this.parseSingle=(e,t)=>ae(e)||le(e)||ne(e)?null:se(e)?JSON.stringify(e):b({value:e,dataModel:t.dataModel,isTrim:!0});this.parseMultiple=(e,t)=>ne(e)?e.map(i=>b({value:i,dataModel:t.dataModel,isTrim:!0})):ae(e)||le(e)||e===""?null:se(e)?[JSON.stringify(e)]:[b({value:e,dataModel:t.dataModel,isTrim:!0})];this.parse=(e,t)=>t.dataModel.getIsMultiSelection()&&!t.forceSingle?this.parseMultiple(e,t):this.parseSingle(e,t)}},pe=Y;import{isArray as Se,isBoolean as Pe,isNil as Re,isObject as Ie}from"lodash";var w=class{constructor(){this.parse=(e,t)=>{if(Re(e)||Se(e)||Ie(e))return null;if(Pe(e))return JSON.stringify(e);if(e==="")return null;let i=`${e}`;return a(/[eE]/.test(i)?m.expandScientificNotation(i):i)}}},ue=w;import{isArray as _e,isBoolean as xe,isNil as Ve,isObject as Ue}from"lodash";var v=class{constructor(){this.parse=(e,t)=>Ve(e)?null:xe(e)?e?"1":"0":Ue(e)||_e(e)||e===""||a(e)===null?null:this.valueParser(e,t)}},C=v;var $=class extends C{constructor(){super(...arguments);this.valueParser=(t,i)=>{let o=m.convertStringToNumber(t,{format:i?.numberFormat});return o===null?a(`${t}`):Number(o)}}},me=$;var W=class extends C{constructor(){super(...arguments);this.valueParser=(t,i)=>{let o=m.convertStringToNumber(t,{format:i?.numberFormat});return o===null?a(`${t}`):Number(o)}}},de=W;import{isArray as Fe,isBoolean as Ne,isNil as Le,isNumber as He,isObject as Ye}from"lodash";var K=class{constructor(){this.parse=(e,t)=>{if(Le(e)||Ye(e)||Fe(e))return null;if(Ne(e))return JSON.stringify(e);if(He(e))return e;if(e===""||a(e)===null)return null;let i=m.convertStringToNumber(e,{adornment:"percentage"});return i===null?a(`${e}`):Number(i)}}},ye=K;import{isArray as we,isBoolean as ve,isNil as $e,isObject as We}from"lodash";var X=class{constructor(){this.parse=(e,t)=>{if($e(e)||we(e)||We(e))return null;if(ve(e))return JSON.stringify(e);if(e===""||a(e)===null)return null;let i=m.convertStringToNumber(e,{format:t?.numberFormat});return i===null?a(`${e}`):Number(i)}}},ce=X;var Me=["dd.MM.yyyy HH:mm","dd.MM.yyyy","dd/MM/yyyy HH:mm:ss","dd/MM/yyyy HH:mm","dd/MM/yyyy","dd-MM-yyyy HH:mm:ss","dd-MM-yyyy HH:mm","yyyy-MM-dd'T'HH:mm:ss","yyyy-MM-dd","yyyy-dd-MM","yyyy-MM-dd HH:mm:ss","dd-MM-yyyy","MM-dd-yyyy","MM/dd/yyyy","MM.dd.yyyy","yyyy/MM/dd","yyyyMMdd","dd MMM yyyy","dd MMMM yyyy","MM-dd-yyyy HH:mm:ss","MM/dd/yyyy HH:mm:ss","yyyy-MM-dd HH:mm","MM-dd-yyyy HH:mm","MM/dd/yyyy HH:mm","dd-MMM-yyyy","MMM yyyy","MMMM yyyy","MMMM d, yyyy","MMM d, yyyy","MM dd yyyy","yyyy-MM-dd'T'HH:mm:ss.SSS","yyyy-MM-dd'T'HH:mm:ss.SSSxxx","yyyy.MM.dd","yyyy MM dd","yyyy/dd/MM","yyyy.dd.MM","dd yyyy MM","dd.yyyy.MM","dd-yyyy-MM","yyyy dd MM","MM yyyy dd","dd/yyyy/MM","MM/yyyy/dd"],Ke=["dd.MM.yyyy","dd/MM/yyyy","dd-MM-yyyy","MM.dd.yyyy","MM/dd/yyyy","MM-dd-yyyy","yyyy.MM.dd","yyyy/MM/dd","yyyy-MM-dd","yyyy.dd.MM","yyyy/dd/MM","yyyy-dd-MM","dd MMM yyyy","dd MMMM yyyy","MMM dd, yyyy","MMMM dd, yyyy","MMM dd yyyy","yyyy MMM dd"],Xe=["ddMMyyyy","MMddyyyy","yyyyMMdd"],Be=[""," HH:mm"," HH:mm:ss"],ke=["yyyy-MM-dd","yyyy-dd-MM"],ze=["'T'HH:mm:ss","'T'HH:mm:ss.SSS","'T'HH:mm:ss.SSSxxx"],Qe=[...Ke.flatMap(r=>Be.map(e=>`${r}${e}`)),...Xe,...ke.flatMap(r=>ze.map(e=>`${r}${e}`))],Ge=new Set(Me),ge=new Set([...Me,...Qe.filter(r=>!Ge.has(r))]);var qe={YYYY:"yyyy",YY:"yy",MMMM:"MMMM",MMM:"MMM",MM:"MM",M:"M",DD:"dd",D:"d",HH:"HH",H:"H",hh:"hh",h:"h",mm:"mm",m:"m",ss:"ss",s:"s",SSS:"SSS",SS:"SS",S:"S",A:"a",a:"a",XXXXX:"XXXXX",XXXX:"XXXX",XXX:"XXX",XX:"XX",X:"X",xxxxx:"xxxxx",xxxx:"xxxx",xxx:"xxx",xx:"xx",x:"x",ZZ:"xxx",Z:"X"},fe=r=>r.replace(/'/g,"''"),Ze=r=>{let e="",t=0;for(;t<r.length;){let i=r[t];if(i==="'"){t+=1;let o="";for(;t<r.length;)if(r[t]==="'")if(r[t+1]==="'")o+="'",t+=2;else{t+=1;break}else o+=r[t],t+=1;e+=`'${fe(o)}'`;continue}if(i==="["){t+=1;let o="";for(;t<r.length;)if(r[t]==="]")if(r[t+1]==="]")o+="]",t+=2;else{t+=1;break}else o+=r[t],t+=1;e+=`'${fe(o)}'`;continue}if(i==="T"){e+="'T'",t+=1;continue}if(/[A-Za-z]/.test(i)){let o=1;for(;r[t+o]===i;)o++;let n=r.slice(t,t+o);e+=qe[n]??n,t+=o}else e+=i,t+=1}return e},Je=r=>{if(!f(r))return!1;let e=Ze(r.trim());return ge.has(e)},cr=r=>{if(!f(r))return null;let e=r.trim();return Je(e)?e:null},je=({sourceRows:r,inputFormat:e})=>{let t=e.trim(),i=0,o=0;for(let n=0;n<r.length;n++){let s=r[n];re(s)&&(o+=1,T(s.trim(),t)||(i+=1))}return{mismatchCount:i,totalCount:o}},Mr=(r,e)=>{let t=e.trim();if(T(r,t))return!1;let i=r.trim();return/^\d{4}-\d{2}-\d{2}/.test(i)?!!(t.includes("/")||t.includes(".")&&!t.includes("/")):!1},gr=({columnKey:r,sourceRows:e,inputFormat:t})=>{let{mismatchCount:i,totalCount:o}=je({sourceRows:e,inputFormat:t});i!==0&&console.warn(`Ingestro: Column '${r}': ${i} of ${o} cells did not match inputFormat '${t.trim()}'.`)};import{parse as et,format as tt}from"date-fns";import{isArray as rt,isBoolean as it,isNil as ot,isObject as nt}from"lodash";import A from"moment";var Te=/([+-](?:0\d|1[0-4]):?[0-5]\d|Z)$/i,he=(r,e)=>{let o=!!r.match(Te)?A.parseZone(r,e,!0):A(r,e,!0);return o.isValid()&&o.format(e)===r},B=class{constructor(){this.parse=(e,t)=>{if(ot(e)||rt(e)||nt(e))return null;if(it(e))return JSON.stringify(e);let i=t?.dataModel?.getType();if(!i)return a(`${e}`);if(typeof e=="string"){if(e==="")return null;try{if(t?.dataModel?.getType()==="date"){let o=t?.dataModel?.getOutputFormat(),n=t?.dataModel?.getInputFormat(),s=`${e}`,y=!1;if(f(n)&&!t?.skipDeclaredInputFormatNormalization){let u=J(s);if(T(s,n)||u)u||(s=`${V([s],n)[0]}`),y=!0;else{let M=V([s],n)[0];if(M===s)return he(s,o)?s:a(s);s=`${M}`,y=!0}}if(!y&&he(s,o))return s;let p=!!s.match(Te)?A.parseZone(s,Z):A(s,q);if(p.isValid())return p.format(o);throw new Error("invalid date")}else{let o=j[i];if(!o)return a(`${e}`);let n=et(e,G,new Date);return tt(n,o)}}catch{let n=ee[i];return n?a(te(e,n)):a(`${e}`)}}else return a(`${e}`)}}},Ee=B;import{isArray as st}from"lodash";var at=new me,lt=new de,pt=new ce,ut=new ye,mt=new oe,dt=new pe,yt=new ue,ct=new Ee,k=class{static{this.parse=(e,t)=>{let i;switch(t?.dataModel?.getType()){case"int":i=at;break;case"float":i=lt;break;case"boolean":i=mt;break;case"single-select":case"currency_code":case"country_code_alpha_2":case"country_code_alpha_3":i=dt;break;case"percentage":i=ut;break;case"currency_eur":case"currency_usd":i=pt;break;case"date":case"date_dmy":case"date_mdy":case"date_iso":case"datetime":case"time_hms":case"time_hms_24":case"time_hm":case"time_hm_24":i=ct;break;case"email":case"url_www":case"url_https":case"url":case"phone":case"zip_code_de":case"bic":case"vat_eu":case"gtin":case"iban":default:i=yt;break}return i.parse(e,t)}}static{this.parseRawValueToDisplayValue=(e,t)=>{let i=e;if(t.isNumeric)i=m.convertToFormat(e,{targetFormat:t.numberFormat||"eu",adornment:t.type==="percentage"?"percentage":void 0}),["currency_eur","currency_usd"].includes(t.type)&&(t.type==="currency_usd"?i=`$${i}`:i=`${i} \u20AC`);else if(t.type==="boolean"){let n=g.getInstance().getOptionsForReviewEntries().find(s=>`${s.value}`.includes(`${e}`));n&&(i=`${n.label}`)}else if(h.isTypeCategory(t.type))if(t.isMultiSelection){if(st(e)){let o=t.options?.filter(n=>e.some(s=>x(n,s)));o&&(i=o.map(n=>n.label).join(", "))}}else{let o=t.options?.find(n=>x(n,e));o&&(i=`${o?.label}`)}return`${i}`}}static{this.parseDisplayValueToRawValue=(e,t)=>{if(t.isNumeric){let i=m.convertToUsWithDecimal(`${e}`,t.numberFormat??"eu");if(i===null)return e;let o=m.convertStringToNumber(i,{format:"us"});return o!==null?Number(o):e}else return e}}},be=k;var Zr=(r,e)=>Number(r).toLocaleString(e??"de-DE"),ft={de:"de-DE",en:"en-US",es:"es-ES",fr:"fr-FR",it:"it-IT",nl:"nl-NL",pl:"pl-PL",pt:"pt-PT",sv:"sv-SE",cz:"cs-CZ",dk:"da-DK",hu:"hu-HU",lt:"lt-LT",no:"nb-NO",ru:"ru-RU",sk:"sk-SK",zh:"zh-CN"},Jr=r=>r?ft[r]??"de-DE":"de-DE",jr=(r,e)=>{let{value:t,isExact:i,columns:o,isEmptyValues:n}=e;if(n)return z(r)||r==="";if(gt(r)&&o[0]?.isMultiSelection){let y=o[0],c=r.map(l=>{let p=y.options?.find(u=>`${u.value}`==`${l}`);return p?p.label:`${l}`}).join(", ");return i?c===t:c.toLowerCase().includes(t.toLowerCase())}let s=be.parseRawValueToDisplayValue(r,o[0]);return i&&!z(r)&&s===t?!0:!!(!i&&!z(r)&&s?.toLowerCase()?.includes(t?.toLowerCase()))},ei=(r,e,t,i)=>{let o=r.map(l=>{let p=i.options?.find(u=>`${u.value}`==`${l}`);return p?p.label:`${l}`}),n=e.split(",").map(l=>l.trim()).filter(Boolean);if(n.length===0)return r;let s=-1;for(let l=0;l<=o.length-n.length;l++){let p=!0;for(let u=0;u<n.length;u++)if(o[l+u].toLowerCase()!==n[u].toLowerCase()){p=!1;break}if(p){s=l;break}}if(s===-1)return r;let y=[...r.slice(0,s),...t,...r.slice(s+n.length)],c=new Set;return y.filter(l=>{let p=`${l}`;return c.has(p)?!1:(c.add(p),!0)})},ti=(r,e,t)=>{let i=new RegExp(Mt(e),"gi");return`${r}`.replace(i,t)},ri=r=>typeof r=="string"?r.replace(/(\r\n|\n|\r)/gm,""):r,ii=(r,e)=>e?e.map((t,i)=>r.map(o=>({rowIndex:i,valid:!0,key:o.key,value:t[o.key]}))):[];var Q=class r extends h{constructor({description:t,key:i,example:o,label:n,type:s,options:y,validators:c,alternativeMatches:l,columnSize:p,isMultiSelection:u,allowCustomOptions:E,allowedCustomOptionTypes:M,preserveUnmappedOptions:O,creator:D,baseKey:S,baseKeyCounter:P,hidden:R,optionMappingConfiguration:I,..._}){super({description:t,key:i,example:o,label:n,type:s,validators:c,alternativeMatches:l,columnSize:p,creator:D,baseKey:S,baseKeyCounter:P,hidden:R,optionMappingConfiguration:I,..._});this.optionTypeMap=null;this.getOptions=()=>this.options;this.getOptionTypeMap=()=>{if(!this.optionTypeMap){this.optionTypeMap=new Map;for(let t=0;t<this.options.length;t++){let i=this.options[t];this.optionTypeMap.set(i.value,i.type??"string")}}return this.optionTypeMap};this.setOptions=t=>{this.options=t,this.optionTypeMap=null};this.serialize=()=>{let t={description:this.getDescription(),example:this.getExample(),isRequired:this.getIsRequired(),key:this.getKey(),label:this.getLabel(),type:this.getType(),validators:this.getValidators().map(o=>o.serialize()),alternativeMatches:this.getAlternativeMatches(),columnSize:this.getColumnSize(),columnWidth:this.getColumnWidth(),outputFormat:this.getOutputFormat(),inputFormat:this.getInputFormat(),numberFormat:this.getNumberFormat(),baseKey:this.getBaseKey(),baseKeyCounter:this.getBaseKeyCounter(),creator:this.getCreator(),hidden:this.isHidden(),disabled:this.isDisabled(),optionMappingConfiguration:this.getOptionMappingConfiguration(),excludeFromAutoMatching:this.isExcludedFromAutoMatching()},i=this.getOptions();return{...t,options:i,isMultiSelection:this.isMultiSelection,allowCustomOptions:this.allowCustomOptions,allowedCustomOptionTypes:this.allowedCustomOptionTypes?[...this.allowedCustomOptionTypes]:void 0,preserveUnmappedOptions:this.preserveUnmappedOptions}};this.getIsMultiSelection=()=>this.isMultiSelection;this.getAllowCustomOptions=()=>this.allowCustomOptions;this.getAllowedCustomOptionTypes=()=>this.allowedCustomOptionTypes?[...this.allowedCustomOptionTypes]:void 0;this.getPreserveUnmappedOptions=()=>this.preserveUnmappedOptions;this.options=y?.map(d=>({...d,baseKey:d?.baseKey||d.value,baseKeyCounter:d.baseKeyCounter||0,alternativeMatches:d.alternativeMatches.filter(Ce=>Ce!==d.label),validations:d.validations||[]})),this.isMultiSelection=u,this.allowCustomOptions=E,this.allowedCustomOptionTypes=M?[...M]:void 0,this.preserveUnmappedOptions=O}clone(){let t=this.serialize();return new r({description:t.description,example:t.example,key:t.key,label:t.label,type:t.type,options:t.options,validators:this.getValidators(),alternativeMatches:t.alternativeMatches,columnSize:t.columnSize,columnWidth:t.columnWidth,isMultiSelection:t.isMultiSelection,allowCustomOptions:t.allowCustomOptions,allowedCustomOptionTypes:t.allowedCustomOptionTypes,preserveUnmappedOptions:t.preserveUnmappedOptions,hidden:t.hidden,disabled:t.disabled,optionMappingConfiguration:t.optionMappingConfiguration,excludeFromAutoMatching:t.excludeFromAutoMatching})}},pi=Q;export{N as a,L as b,Rt as c,It as d,cr as e,Mr as f,gr as g,ht as h,h as i,be as j,Zr as k,Jr as l,jr as m,ei as n,ti as o,ri as p,ii as q,pi as r};