@ingestro/importer-react 4.3.0 → 4.5.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/chunk-3IKZH76S.js +1 -0
- package/chunk-AINUNGZU.js +1 -0
- package/chunk-CQHSLEFA.js +1 -0
- package/{chunk-CFY6K4PV.js → chunk-EE3NEC6Z.js} +1 -1
- package/{chunk-Z3TOBUAQ.js → chunk-MJ4XZSRH.js} +1 -1
- package/{chunk-XENVJ4YE.js → chunk-OPYMH566.js} +1 -1
- package/index.d.ts +1 -0
- package/index.js +536 -509
- package/package.json +6 -24
- package/workers/hooks/index.js +1 -1
- package/workers/javascript/index.js +1 -1
- package/workers/mapping/index.js +1 -1
- package/workers/matchValues/index.js +1 -1
- package/workers/parseData/index.js +1 -1
- package/workers/searchAndReplace/index.js +1 -1
- package/chunk-AQ2NVI46.js +0 -1
- package/chunk-EK7ODJWE.js +0 -1
- package/chunk-ME2M2B24.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var h=Object.create;var f=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var m=(a,b)=>()=>(a&&(b=a(a=0)),b);var n=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports),o=(a,b)=>{for(var c in b)f(a,c,{get:b[c],enumerable:!0})},e=(a,b,c,g)=>{if(b&&typeof b=="object"||typeof b=="function")for(let d of j(b))!l.call(a,d)&&d!==c&&f(a,d,{get:()=>b[d],enumerable:!(g=i(b,d))||g.enumerable});return a},p=(a,b,c)=>(e(a,b,"default"),c&&e(c,b,"default")),q=(a,b,c)=>(c=a!=null?h(k(a)):{},e(b||!a||!a.__esModule?f(c,"default",{value:a,enumerable:!0}):c,a)),r=a=>e(f({},"__esModule",{value:!0}),a);export{m as a,n as b,o as c,p as d,q as e,r as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as a}from"./chunk-CQHSLEFA.js";var n=class p extends a{constructor({description:t,key:e,example:i,label:l,type:r,options:u,validators:d,alternativeMatches:h,columnSize:m,isMultiSelection:g,allowCustomOptions:y,allowedCustomOptionTypes:s,creator:C,baseKey:M,baseKeyCounter:c,hidden:O,optionMappingConfiguration:b,...w}){super({description:t,key:e,example:i,label:l,type:r,validators:d,alternativeMatches:h,columnSize:m,creator:C,baseKey:M,baseKeyCounter:c,hidden:O,optionMappingConfiguration:b,...w});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 e=this.options[t];this.optionTypeMap.set(e.value,e.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(i=>i.serialize()),alternativeMatches:this.getAlternativeMatches(),columnSize:this.getColumnSize(),columnWidth:this.getColumnWidth(),outputFormat:this.getOutputFormat(),numberFormat:this.getNumberFormat(),baseKey:this.getBaseKey(),baseKeyCounter:this.getBaseKeyCounter(),creator:this.getCreator(),hidden:this.isHidden(),disabled:this.isDisabled(),optionMappingConfiguration:this.getOptionMappingConfiguration()},e=this.getOptions();return{...t,options:e,isMultiSelection:this.isMultiSelection,allowCustomOptions:this.allowCustomOptions,allowedCustomOptionTypes:this.allowedCustomOptionTypes?[...this.allowedCustomOptionTypes]:void 0}};this.getIsMultiSelection=()=>this.isMultiSelection;this.getAllowCustomOptions=()=>this.allowCustomOptions;this.getAllowedCustomOptionTypes=()=>this.allowedCustomOptionTypes?[...this.allowedCustomOptionTypes]:void 0;this.options=u?.map(o=>({...o,baseKey:o?.baseKey||o.value,baseKeyCounter:o.baseKeyCounter||0,alternativeMatches:o.alternativeMatches.filter(T=>T!==o.label),validations:o.validations||[]})),this.isMultiSelection=g,this.allowCustomOptions=y,this.allowedCustomOptionTypes=s?[...s]:void 0}clone(){let t=this.serialize();return new p({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,hidden:t.hidden,disabled:t.disabled,optionMappingConfiguration:t.optionMappingConfiguration})}},K=n;export{K as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as g}from"./chunk-J5WOZVPO.js";import{isNil as $,escapeRegExp as rt,isString as it,isArray as nt}from"lodash";import fe from"numbro";import{isNil as ge}from"lodash";var p=class t{static{this.currencySymbol={eu:"\u20AC",us:"$"}}static{this.percentageSymbol="%"}static{this.maxSafeNumberLength=17}static convertToFormat(e,r){if(e==null||e===""||typeof e=="string"&&e.trim()==="")return"";let i="";if(typeof e=="string"){let u=this.convertStringToNumber(e,{targetFormat:r?.targetFormat});if(u===null)return e;i=u}else if(typeof e=="number"){let u=e;r?.adornment==="percentage"&&(u=e*100,u=Number(u.toFixed(10))),i=u.toString()}else throw new Error(`[convertToFormat] unsupported type of the "value" - ${typeof e}`);let[n,o]=i.split("."),s=r?.decimalDigits||o?.length||0,l="";try{l=fe(i).format({thousandSeparated:!0,mantissa:s})}catch{return i}if(r?.targetFormat==="eu"){let u=l.replace(/,/g,"$").replace(/\./g,",").replace(/\$/g,".");return this.appendAdornment(u,r)}return this.appendAdornment(l,r)}static detectNumberFormat(e,r){let i=[];for(let l=0;l<e.length;l++)(e[l]===","||e[l]===".")&&i.push(e[l]);if(i.length===0)return;let n=e.replace(/([+\-EUR€SD$%\s])/g,"");if(i.length===1){let[l,u]=n.split(i[0]);return l.length>3?i[0]===","?"eu":"us":l.replace(/0/g,"")===""?i[0]===","?"eu":"us":u.length===3?r?.targetFormat?r?.targetFormat:r?.resolveUncertainty===!1?void 0:i[0]===","?"us":"eu":i[0]===","?"eu":"us"}let o=/^([1-9]\d{0,2})(\.\d{3})*(,\d+)?$/,s=/^([1-9]\d{0,2})(,\d{3})*(\.\d+)?$/;return o.test(n)?"eu":s.test(n)?"us":null}static convertToUsWithDecimal(e,r){let i=e,n=t.getDelimiters(e),o=e.replace(/([+\-EUR€SD$%\s])/g,"");if(n.length===1){let[s,l]=o.split(n[0]);if(l.length===3)return r==="us"?i=`${e}`?.replace(/,/g,""):i=`${e}`?.replace(/\./g,"$")?.replace(/,/,".").replace(/\$/g,""),i}return this.replaceDelimiter(e)}static{this.convertStringToNumber=(e,r)=>{if(typeof e=="number")return`${e}`;if(typeof e!="string")return null;let i=e.trim().replace(/([EUR€SD$%\s])/g,"");if(i==="")return e;let n=r?.format||this.detectNumberFormat(i,{targetFormat:r?.targetFormat}),o="";if(n===null||(n==="us"?o=i.replace(/,/g,""):o=i.replace(/\./g,"$").replace(/,/,".").replace(/\$/g,""),o.length>t.maxSafeNumberLength&&(o=o.slice(0,t.maxSafeNumberLength),o.at(-1)==="."&&(o=o.slice(0,t.maxSafeNumberLength-1))),isNaN(Number(o))))return null;if(r?.adornment==="percentage"&&e.includes("%")){let s=Number(o)/100;o=Number(s.toFixed(10)).toString()}return o}}static hasDecimalPart(e,r){if(typeof e=="number")return e%1!==0;let i=e.trim(),n=r||this.detectNumberFormat(i);return n===null?!1:n==="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 i=0;i<e.length;i++)(e[i]===","||e[i]===".")&&r.push(e[i]);return r}static replaceDelimiter(e){let r=e,i=t.detectNumberFormat(`${e}`);return ge(i)?null:(i==="eu"?r=`${e}`?.replace(/\./g,"$")?.replace(/,/,".").replace(/\$/g,""):r=`${e}`?.replace(/,/g,""),r)}};var N=()=>g.getInstance().getTruthyWords(),O=()=>g.getInstance().getFalsyWords(),yt=()=>g.getInstance().getBooleanOptionToRender(),Et=[...N(),...O()];import{isArray as ye,isNil as Ee,isObject as be}from"lodash";var R=class{constructor(){this.parse=(e,r)=>Ee(e)||ye(e)||be(e)?null:N().includes(`${e}`.toLowerCase())?!0:O().includes(`${e}`.toLowerCase())?!1:e===""?null:`${e}`}},K=R;import{isArray as W,isBoolean as B,isNil as k,isObject as G}from"lodash";var A=class{constructor(){this.parseSingle=(e,r)=>k(e)||G(e)||W(e)?null:B(e)?JSON.stringify(e):_({value:e,dataModel:r.dataModel,isTrim:!0});this.parseMultiple=(e,r)=>W(e)?e.map(i=>_({value:i,dataModel:r.dataModel,isTrim:!0})):k(e)||G(e)||e===""?null:B(e)?[JSON.stringify(e)]:[_({value:e,dataModel:r.dataModel,isTrim:!0})];this.parse=(e,r)=>r.dataModel.getIsMultiSelection()&&!r.forceSingle?this.parseMultiple(e,r):this.parseSingle(e,r)}},q=A;import{isArray as _e,isBoolean as Me,isNil as he,isObject as Te}from"lodash";var C=class{constructor(){this.parse=(e,r)=>he(e)||_e(e)||Te(e)?null:Me(e)?JSON.stringify(e):e===""?null:a(`${e}`)}},Q=C;import{isArray as De,isBoolean as Ie,isNil as Ne,isObject as Oe}from"lodash";var S=class{constructor(){this.parse=(e,r)=>Ne(e)?null:Ie(e)?e?"1":"0":Oe(e)||De(e)||e===""||a(e)===null?null:this.valueParser(e,r)}},M=S;var U=class extends M{constructor(){super(...arguments);this.valueParser=(r,i)=>{let n=p.convertStringToNumber(r,{format:i?.numberFormat});return n===null?a(`${r}`):Number(n)}}},Z=U;var P=class extends M{constructor(){super(...arguments);this.valueParser=(r,i)=>{let n=p.convertStringToNumber(r,{format:i?.numberFormat});return n===null?a(`${r}`):Number(n)}}},z=P;import{isArray as Re,isBoolean as Ae,isNil as Ce,isNumber as Se,isObject as Ue}from"lodash";var V=class{constructor(){this.parse=(e,r)=>{if(Ce(e)||Ue(e)||Re(e))return null;if(Ae(e))return JSON.stringify(e);if(Se(e))return e;if(e===""||a(e)===null)return null;let i=p.convertStringToNumber(e,{adornment:"percentage"});return i===null?a(`${e}`):Number(i)}}},J=V;import{isArray as Pe,isBoolean as Ve,isNil as xe,isObject as Fe}from"lodash";var x=class{constructor(){this.parse=(e,r)=>{if(xe(e)||Pe(e)||Fe(e))return null;if(Ve(e))return JSON.stringify(e);if(e===""||a(e)===null)return null;let i=p.convertStringToNumber(e,{format:r?.numberFormat});return i===null?a(`${e}`):Number(i)}}},j=x;import{parse as ee,format as te,isMatch as Le}from"date-fns";import f from"moment";var y="dd.MM.yyyy HH:mm:ss:SSS";var X="DD.MM.YYYY HH:mm:ss:SSS",v="DD.MM.YYYY HH:mm:ss:SSSZ";var h={date_dmy:"dd.MM.yyyy",date_mdy:"MM.dd.yyyy",date_iso:"yyyy-MM-dd",datetime:"yyyy-MM-dd HH:mm:ss",time_hm:"hh:mm aaa",time_hms:"hh:mm:ss aaa",time_hm_24:"HH:mm",time_hms_24:"HH:mm:ss"},re={time_hm:"hh:mm a",time_hms:"hh:mm:ss a",time_hm_24:"HH:mm",time_hms_24:"HH:mm:ss"},Xt=t=>{try{return te(ee(t,y,new Date),"dd.MM.yyyy")}catch{return t}},He=(t,e,r,i)=>{try{if(typeof t=="string"){if(i===!1||isNaN(Date.parse(t))&&!$e(t))return t;let n=r||["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","dd/MM/yyyy","dd-MM-yyyy HH:mm:ss","dd-MM-yyyy HH:mm","yyyy-MM-dd'T'HH:mm:ssZ","yyyy-MM-dd'T'HH:mm:ss","yyyy-MM-dd","yyyy-MM-dd HH:mm:ss","dd-MM-yyyy"],o;for(let s=0;s<n.length;++s)if(Le(t,n[s])){o=n[s];break}if(o)return te(ee(t,o,new Date),e||y);throw new Error("not found format")}else throw new Error("not date string")}catch{return t}},we=["YYYY-MM-DDTHH:mm:ss.SSSZ","X","x"],ie=(t,e)=>{t===null&&(t=""),t=/^\d{3,}$/.test(t)?parseInt(t,10):t;let r=/^\d{1,2}$/.test(t);r&&(t+=":00");let i=f(t,we,!0).isValid()?f(t):f(t,e),n=i.isValid(),o=f(t,e,!0).isValid()&&!r;return t===""&&(n=!0,o=!0),n&&!o?i.format(e):t},vt=(t,e)=>{let r=()=>f.parseZone(t).format(e);try{if(typeof t=="string"){if(f(t,e,!0).isValid())return e.includes("Z")?r():f.utc(t,e).format(e);if(f(t).isValid())return e.includes("Z")?r():f.utc(t).format(e);throw new Error("not found format")}else throw new Error("not date string")}catch{return t}},er=(t,e)=>{switch(e){case"date_dmy":case"date_mdy":case"date_iso":case"datetime":return He(t,h[e],[h[e]]);default:return t}},$e=t=>{let[e,r,i]=t?.split(" ")?.[0]?.split(/[./-]/);return!!(Number(i)&&Number(r)<=12&&Number(e)<=31)};import{parse as Ye,format as Ke}from"date-fns";import{isArray as We,isBoolean as Be,isNil as ke,isObject as Ge}from"lodash";import D from"moment";var qe=/([+-](?:0\d|1[0-4]):?[0-5]\d|Z)$/i,F=class{constructor(){this.parse=(e,r)=>{if(ke(e)||We(e)||Ge(e))return null;if(Be(e))return JSON.stringify(e);let i=r?.dataModel?.getType();if(!i)return a(`${e}`);if(typeof e=="string"){if(e==="")return null;try{if(r?.dataModel?.getType()==="date"){let n=r?.dataModel?.getOutputFormat(),o=e.match(qe),l=!!(o?o[0]:"");if((l?D.parseZone(e,n,!0):D(e,n,!0)).isValid())return e;let m=l?D.parseZone(e,v):D(e,X);if(m.isValid())return m.format(n);throw new Error("invalid date")}else{let n=h[i];if(!n)return a(`${e}`);let o=Ye(e,y,new Date);return Ke(o,n)}}catch{let o=re[i];return o?a(ie(e,o)):a(`${e}`)}}else return a(`${e}`)}}},ne=F;import{isArray as Qe}from"lodash";var L=class{constructor({validation:e,regex:r,fields:i,errorMessage:n}){this.getValidation=()=>this.validation;this.getRegex=()=>this.regex;this.getFields=()=>this.fields;this.getErrorMessage=()=>this.errorMessage;this.serialize=()=>({validation:this.getValidation(),fields:this.getFields(),regex:this.getRegex(),errorMessage:this.getErrorMessage()});this.validation=e,this.regex=r,this.fields=i??[],this.errorMessage=n}},mr=L;var I=class t{constructor({description:e,key:r,example:i,label:n,type:o,validators:s,mappingValidation:l,alternativeMatches:u,columnSize:m,creator:d,baseKey:c,baseKeyCounter:ae,outputFormat:le,numberFormat:ue,hidden:me,disabled:pe,optionMappingConfiguration:de,columnWidth:ce}){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=()=>t.getOutputFormat(this.outputFormat);this.getValidators=()=>this.validators;this.getColumnSize=()=>this.columnSize;this.getColumnWidth=()=>this.columnWidth;this.getIsRequired=()=>!!this.validators.find(r=>r.getValidation()==="REQUIRED");this.getIsUnique=()=>!!this.validators.find(r=>r.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:r,baseKeyCounter:i,creator:n})=>{this.baseKey=r,this.key=e,this.baseKeyCounter=i,this.creator=n};this.isDropdown=()=>t.isTypeDropdown(this.getType());this.isCategoryType=()=>t.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(),isMultiSelection:this.getIsMultiSelection(),numberFormat:this.getNumberFormat(),baseKey:this.getBaseKey(),baseKeyCounter:this.getBaseKeyCounter(),creator:this.getCreator(),hidden:this.isHidden(),disabled:this.isDisabled(),optionMappingConfiguration:this.getOptionMappingConfiguration()});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 t({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,hidden:e.hidden,disabled:e.disabled,optionMappingConfiguration:e.optionMappingConfiguration})};this.isHidden=()=>this.hidden;this.getOptionMappingConfiguration=()=>this.optionMappingConfiguration;this.description=e,this.key=r,this.example=i,this.label=n,this.type=o,this.validators=s??[],this.mappingValidation=l,this.alternativeMatches=u?[...u.filter(E=>E!==n&&E!==r)?.map(E=>E?.toString())]:[],this.columnSize=m,this.creator=d,this.baseKey=c||r,this.baseKeyCounter=ae||0,this.outputFormat=le||"",this.numberFormat=ue||"eu",this.hidden=me??!1,this.disabled=pe??!1,this.optionMappingConfiguration=de,this.columnWidth=ce}static{this.getOutputFormat=e=>(e||"DD.MM.YYYY").replace(/d/g,"D").replace(/e|E/g,"")}static{this.isTypeDropdown=e=>t.isTypeCategory(e)||e==="boolean"}static{this.isTypeCategory=e=>e==="single-select"||e==="currency_code"||e==="country_code_alpha_2"||e==="country_code_alpha_3"}};var Ze=new Z,ze=new z,Je=new j,je=new J,Xe=new K,ve=new q,et=new Q,tt=new ne,w=class{static{this.parse=(e,r)=>{let i;switch(r?.dataModel?.getType()){case"int":i=Ze;break;case"float":i=ze;break;case"boolean":i=Xe;break;case"single-select":case"currency_code":case"country_code_alpha_2":case"country_code_alpha_3":i=ve;break;case"percentage":i=je;break;case"currency_eur":case"currency_usd":i=Je;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=tt;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=et;break}return i.parse(e,r)}}static{this.parseRawValueToDisplayValue=(e,r)=>{let i=e;if(r.isNumeric)i=p.convertToFormat(e,{targetFormat:r.numberFormat||"eu",adornment:r.type==="percentage"?"percentage":void 0}),["currency_eur","currency_usd"].includes(r.type)&&(r.type==="currency_usd"?i=`$${i}`:i=`${i} \u20AC`);else if(r.type==="boolean"){let o=g.getInstance().getOptionsForReviewEntries().find(s=>`${s.value}`.includes(`${e}`));o&&(i=`${o.label}`)}else if(I.isTypeCategory(r.type))if(r.isMultiSelection){if(Qe(e)){let n=r.options?.filter(o=>e.some(s=>H(o,s)));n&&(i=n.map(o=>o.label).join(", "))}}else{let n=r.options?.find(o=>H(o,e));n&&(i=`${n?.label}`)}return`${i}`}}static{this.parseDisplayValueToRawValue=(e,r)=>{if(r.isNumeric){let i=p.convertToUsWithDecimal(`${e}`,r.numberFormat??"eu");if(i===null)return e;let n=p.convertStringToNumber(i,{format:"us"});return n!==null?Number(n):e}else return e}}},oe=w;var Kr=t=>Number(t).toLocaleString("de-DE"),Wr=(t,e)=>{let{value:r,isExact:i,columns:n,isEmptyValues:o}=e;if(o)return $(t)||t==="";if(nt(t)&&n[0]?.isMultiSelection){let l=n[0],u=t.map(m=>{let d=l.options?.find(c=>`${c.value}`==`${m}`);return d?d.label:`${m}`}).join(", ");return i?u===r:u.toLowerCase().includes(r.toLowerCase())}let s=oe.parseRawValueToDisplayValue(t,n[0]);return i&&!$(t)&&s===r?!0:!!(!i&&!$(t)&&s?.toLowerCase()?.includes(r?.toLowerCase()))},Br=(t,e,r,i)=>{let n=t.map(m=>{let d=i.options?.find(c=>`${c.value}`==`${m}`);return d?d.label:`${m}`}),o=e.split(",").map(m=>m.trim()).filter(Boolean);if(o.length===0)return t;let s=-1;for(let m=0;m<=n.length-o.length;m++){let d=!0;for(let c=0;c<o.length;c++)if(n[m+c].toLowerCase()!==o[c].toLowerCase()){d=!1;break}if(d){s=m;break}}if(s===-1)return t;let l=[...t.slice(0,s),...r,...t.slice(s+o.length)],u=new Set;return l.filter(m=>{let d=`${m}`;return u.has(d)?!1:(u.add(d),!0)})},kr=(t,e,r)=>{let i=new RegExp(rt(e),"gi");return`${t}`.replace(i,r)},Gr=t=>typeof t=="string"?t.replace(/(\r\n|\n|\r)/gm,""):t,qr=(t,e)=>e?e.map((r,i)=>t.map(n=>({rowIndex:i,valid:!0,key:n.key,value:r[n.key]}))):[],a=t=>{if(it(t)){let e=t.trimEnd();return e===""?null:e}return t};var se=t=>t.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(),Y=t=>t?.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{isInteger as ot,isNumber as st}from"lodash";var ei=(t,e,r)=>{for(let i=0;i<t.length;i++){let n=t[i].getKey(),o=e;if(r&&(n=Y(n),o=Y(o)),n===o)return t[i]}return null},ti=(t,e)=>{for(let r=0;r<e.length;r++)if(e[r].getKey()===t)return r;return-1},H=(t,e)=>`${t.value}`==`${e}`,at=(t,e)=>{let r=0;for(let i=0;i<e.length;i++){let n=e[i],o="baseKeyCounter";n?.[o]&&t===n?.["baseKey"]&&r<(n?.[o]??0)&&(r=n?.[o]||0)}return r},lt=(t,e)=>!t.some(r=>r.baseKey===e),ri=(t,e,r=!0)=>{let i=r?se(t):t,n=at(i,e)+1,o=i;return lt(e,i)?n--:n>0&&(o=`${i}_${n}`),{key:{value:o,baseKey:i,baseKeyCounter:n}}},_=({value:t,dataModel:e,isTrim:r})=>{let i=e.getOptionTypeMap(),n=t!==void 0?i.get(t):void 0;if(!n&&typeof t=="number"&&(n=i.get(String(t))),!n&&typeof t=="string"){let o=Number(t);isNaN(o)||(n=i.get(o))}if(n=n??"string",t===""&&i.has(t))return t;if(n==="int"){let o=Number(t);return!isNaN(o)&&ot(o)?o:r?a(`${t}`):`${t}`}else if(n==="float"){if(st(t))return t;let o=`${t}`.replace(/,/,"."),s=p.convertStringToNumber(`${o}`,{format:"us"});return s===null?r?a(`${t}`):`${t}`:Number(s)}else return r?a(`${t}`):`${t}`};export{p as a,N as b,O as c,yt as d,Et as e,Y as f,ei as g,ti as h,H as i,ri as j,_ as k,re as l,Xt as m,ie as n,vt as o,er as p,mr as q,I as r,oe as s,Kr as t,Wr as u,Br as v,kr as w,Gr as x,qr as y,a as z};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Rr,b as bi}from"./chunk-EK7ODJWE.js";var Ai=Rr((wg,Fi)=>{"use strict";Fi.exports=(function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(n,a,i){r.o(n,a)||Object.defineProperty(n,a,{enumerable:!0,get:i})},r.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,a){if(1&a&&(n=r(n)),8&a||4&a&&typeof n=="object"&&n&&n.__esModule)return n;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:n}),2&a&&typeof n!="string")for(var o in n)r.d(i,o,function(s){return n[s]}.bind(null,o));return i},r.n=function(n){var a=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(a,"a",a),a},r.o=function(n,a){return Object.prototype.hasOwnProperty.call(n,a)},r.p="",r(r.s=32)})([function(e,t){var r;r=(function(){return this})();try{r=r||Function("return this")()||(0,eval)("this")}catch{typeof window=="object"&&(r=window)}e.exports=r},function(e,t,r){"use strict";var n=r(6),a=Object.keys||function(p){var m=[];for(var h in p)m.push(h);return m};e.exports=_;var i=r(5);i.inherits=r(2);var o=r(23),s=r(14);i.inherits(_,o);for(var c=a(s.prototype),f=0;f<c.length;f++){var l=c[f];_.prototype[l]||(_.prototype[l]=s.prototype[l])}function _(p){if(!(this instanceof _))return new _(p);o.call(this,p),s.call(this,p),p&&p.readable===!1&&(this.readable=!1),p&&p.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,p&&p.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",v)}function v(){this.allowHalfOpen||this._writableState.ended||n.nextTick(x,this)}function x(p){p.end()}Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(_.prototype,"destroyed",{get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(p){this._readableState!==void 0&&this._writableState!==void 0&&(this._readableState.destroyed=p,this._writableState.destroyed=p)}}),_.prototype._destroy=function(p,m){this.push(null),this.end(),n.nextTick(m,p)}},function(e,t){typeof Object.create=="function"?e.exports=function(r,n){r.super_=n,r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(r,n){r.super_=n;var a=function(){};a.prototype=n.prototype,r.prototype=new a,r.prototype.constructor=r}},function(e,t,r){"use strict";(function(n){var a=r(38),i=r(39),o=r(40);function s(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function c(d,w){if(s()<w)throw new RangeError("Invalid typed array length");return f.TYPED_ARRAY_SUPPORT?(d=new Uint8Array(w)).__proto__=f.prototype:(d===null&&(d=new f(w)),d.length=w),d}function f(d,w,E){if(!(f.TYPED_ARRAY_SUPPORT||this instanceof f))return new f(d,w,E);if(typeof d=="number"){if(typeof w=="string")throw new Error("If encoding is specified then the first argument must be a string");return v(this,d)}return l(this,d,w,E)}function l(d,w,E,b){if(typeof w=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&w instanceof ArrayBuffer?(function(D,T,ne,le){if(T.byteLength,ne<0||T.byteLength<ne)throw new RangeError("'offset' is out of bounds");if(T.byteLength<ne+(le||0))throw new RangeError("'length' is out of bounds");return T=ne===void 0&&le===void 0?new Uint8Array(T):le===void 0?new Uint8Array(T,ne):new Uint8Array(T,ne,le),f.TYPED_ARRAY_SUPPORT?(D=T).__proto__=f.prototype:D=x(D,T),D})(d,w,E,b):typeof w=="string"?(function(D,T,ne){if(typeof ne=="string"&&ne!==""||(ne="utf8"),!f.isEncoding(ne))throw new TypeError('"encoding" must be a valid string encoding');var le=0|m(T,ne),he=(D=c(D,le)).write(T,ne);return he!==le&&(D=D.slice(0,he)),D})(d,w,E):(function(D,T){if(f.isBuffer(T)){var ne=0|p(T.length);return(D=c(D,ne)).length===0||T.copy(D,0,0,ne),D}if(T){if(typeof ArrayBuffer<"u"&&T.buffer instanceof ArrayBuffer||"length"in T)return typeof T.length!="number"||(function(le){return le!=le})(T.length)?c(D,0):x(D,T);if(T.type==="Buffer"&&o(T.data))return x(D,T.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")})(d,w)}function _(d){if(typeof d!="number")throw new TypeError('"size" argument must be a number');if(d<0)throw new RangeError('"size" argument must not be negative')}function v(d,w){if(_(w),d=c(d,w<0?0:0|p(w)),!f.TYPED_ARRAY_SUPPORT)for(var E=0;E<w;++E)d[E]=0;return d}function x(d,w){var E=w.length<0?0:0|p(w.length);d=c(d,E);for(var b=0;b<E;b+=1)d[b]=255&w[b];return d}function p(d){if(d>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|d}function m(d,w){if(f.isBuffer(d))return d.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(d)||d instanceof ArrayBuffer))return d.byteLength;typeof d!="string"&&(d=""+d);var E=d.length;if(E===0)return 0;for(var b=!1;;)switch(w){case"ascii":case"latin1":case"binary":return E;case"utf8":case"utf-8":case void 0:return re(d).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*E;case"hex":return E>>>1;case"base64":return ee(d).length;default:if(b)return re(d).length;w=(""+w).toLowerCase(),b=!0}}function h(d,w,E){var b=d[w];d[w]=d[E],d[E]=b}function u(d,w,E,b,D){if(d.length===0)return-1;if(typeof E=="string"?(b=E,E=0):E>2147483647?E=2147483647:E<-2147483648&&(E=-2147483648),E=+E,isNaN(E)&&(E=D?0:d.length-1),E<0&&(E=d.length+E),E>=d.length){if(D)return-1;E=d.length-1}else if(E<0){if(!D)return-1;E=0}if(typeof w=="string"&&(w=f.from(w,b)),f.isBuffer(w))return w.length===0?-1:y(d,w,E,b,D);if(typeof w=="number")return w&=255,f.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?D?Uint8Array.prototype.indexOf.call(d,w,E):Uint8Array.prototype.lastIndexOf.call(d,w,E):y(d,[w],E,b,D);throw new TypeError("val must be string, number or Buffer")}function y(d,w,E,b,D){var T,ne=1,le=d.length,he=w.length;if(b!==void 0&&((b=String(b).toLowerCase())==="ucs2"||b==="ucs-2"||b==="utf16le"||b==="utf-16le")){if(d.length<2||w.length<2)return-1;ne=2,le/=2,he/=2,E/=2}function we(Pe,Ce){return ne===1?Pe[Ce]:Pe.readUInt16BE(Ce*ne)}if(D){var ye=-1;for(T=E;T<le;T++)if(we(d,T)===we(w,ye===-1?0:T-ye)){if(ye===-1&&(ye=T),T-ye+1===he)return ye*ne}else ye!==-1&&(T-=T-ye),ye=-1}else for(E+he>le&&(E=le-he),T=E;T>=0;T--){for(var _e=!0,Ne=0;Ne<he;Ne++)if(we(d,T+Ne)!==we(w,Ne)){_e=!1;break}if(_e)return T}return-1}function g(d,w,E,b){E=Number(E)||0;var D=d.length-E;b?(b=Number(b))>D&&(b=D):b=D;var T=w.length;if(T%2!=0)throw new TypeError("Invalid hex string");b>T/2&&(b=T/2);for(var ne=0;ne<b;++ne){var le=parseInt(w.substr(2*ne,2),16);if(isNaN(le))return ne;d[E+ne]=le}return ne}function k(d,w,E,b){return ue(re(w,d.length-E),d,E,b)}function P(d,w,E,b){return ue((function(D){for(var T=[],ne=0;ne<D.length;++ne)T.push(255&D.charCodeAt(ne));return T})(w),d,E,b)}function C(d,w,E,b){return P(d,w,E,b)}function S(d,w,E,b){return ue(ee(w),d,E,b)}function A(d,w,E,b){return ue((function(D,T){for(var ne,le,he,we=[],ye=0;ye<D.length&&!((T-=2)<0);++ye)le=(ne=D.charCodeAt(ye))>>8,he=ne%256,we.push(he),we.push(le);return we})(w,d.length-E),d,E,b)}function R(d,w,E){return w===0&&E===d.length?a.fromByteArray(d):a.fromByteArray(d.slice(w,E))}function F(d,w,E){E=Math.min(d.length,E);for(var b=[],D=w;D<E;){var T,ne,le,he,we=d[D],ye=null,_e=we>239?4:we>223?3:we>191?2:1;if(D+_e<=E)switch(_e){case 1:we<128&&(ye=we);break;case 2:(192&(T=d[D+1]))==128&&(he=(31&we)<<6|63&T)>127&&(ye=he);break;case 3:T=d[D+1],ne=d[D+2],(192&T)==128&&(192&ne)==128&&(he=(15&we)<<12|(63&T)<<6|63&ne)>2047&&(he<55296||he>57343)&&(ye=he);break;case 4:T=d[D+1],ne=d[D+2],le=d[D+3],(192&T)==128&&(192&ne)==128&&(192&le)==128&&(he=(15&we)<<18|(63&T)<<12|(63&ne)<<6|63&le)>65535&&he<1114112&&(ye=he)}ye===null?(ye=65533,_e=1):ye>65535&&(ye-=65536,b.push(ye>>>10&1023|55296),ye=56320|1023&ye),b.push(ye),D+=_e}return(function(Ne){var Pe=Ne.length;if(Pe<=N)return String.fromCharCode.apply(String,Ne);for(var Ce="",te=0;te<Pe;)Ce+=String.fromCharCode.apply(String,Ne.slice(te,te+=N));return Ce})(b)}t.Buffer=f,t.SlowBuffer=function(d){return+d!=d&&(d=0),f.alloc(+d)},t.INSPECT_MAX_BYTES=50,f.TYPED_ARRAY_SUPPORT=n.TYPED_ARRAY_SUPPORT!==void 0?n.TYPED_ARRAY_SUPPORT:(function(){try{var d=new Uint8Array(1);return d.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},d.foo()===42&&typeof d.subarray=="function"&&d.subarray(1,1).byteLength===0}catch{return!1}})(),t.kMaxLength=s(),f.poolSize=8192,f._augment=function(d){return d.__proto__=f.prototype,d},f.from=function(d,w,E){return l(null,d,w,E)},f.TYPED_ARRAY_SUPPORT&&(f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&f[Symbol.species]===f&&Object.defineProperty(f,Symbol.species,{value:null,configurable:!0})),f.alloc=function(d,w,E){return(function(b,D,T,ne){return _(D),D<=0?c(b,D):T!==void 0?typeof ne=="string"?c(b,D).fill(T,ne):c(b,D).fill(T):c(b,D)})(null,d,w,E)},f.allocUnsafe=function(d){return v(null,d)},f.allocUnsafeSlow=function(d){return v(null,d)},f.isBuffer=function(d){return!(d==null||!d._isBuffer)},f.compare=function(d,w){if(!f.isBuffer(d)||!f.isBuffer(w))throw new TypeError("Arguments must be Buffers");if(d===w)return 0;for(var E=d.length,b=w.length,D=0,T=Math.min(E,b);D<T;++D)if(d[D]!==w[D]){E=d[D],b=w[D];break}return E<b?-1:b<E?1:0},f.isEncoding=function(d){switch(String(d).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},f.concat=function(d,w){if(!o(d))throw new TypeError('"list" argument must be an Array of Buffers');if(d.length===0)return f.alloc(0);var E;if(w===void 0)for(w=0,E=0;E<d.length;++E)w+=d[E].length;var b=f.allocUnsafe(w),D=0;for(E=0;E<d.length;++E){var T=d[E];if(!f.isBuffer(T))throw new TypeError('"list" argument must be an Array of Buffers');T.copy(b,D),D+=T.length}return b},f.byteLength=m,f.prototype._isBuffer=!0,f.prototype.swap16=function(){var d=this.length;if(d%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var w=0;w<d;w+=2)h(this,w,w+1);return this},f.prototype.swap32=function(){var d=this.length;if(d%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var w=0;w<d;w+=4)h(this,w,w+3),h(this,w+1,w+2);return this},f.prototype.swap64=function(){var d=this.length;if(d%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var w=0;w<d;w+=8)h(this,w,w+7),h(this,w+1,w+6),h(this,w+2,w+5),h(this,w+3,w+4);return this},f.prototype.toString=function(){var d=0|this.length;return d===0?"":arguments.length===0?F(this,0,d):function(w,E,b){var D=!1;if((E===void 0||E<0)&&(E=0),E>this.length||((b===void 0||b>this.length)&&(b=this.length),b<=0)||(b>>>=0)<=(E>>>=0))return"";for(w||(w="utf8");;)switch(w){case"hex":return z(this,E,b);case"utf8":case"utf-8":return F(this,E,b);case"ascii":return I(this,E,b);case"latin1":case"binary":return X(this,E,b);case"base64":return R(this,E,b);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return q(this,E,b);default:if(D)throw new TypeError("Unknown encoding: "+w);w=(w+"").toLowerCase(),D=!0}}.apply(this,arguments)},f.prototype.equals=function(d){if(!f.isBuffer(d))throw new TypeError("Argument must be a Buffer");return this===d||f.compare(this,d)===0},f.prototype.inspect=function(){var d="",w=t.INSPECT_MAX_BYTES;return this.length>0&&(d=this.toString("hex",0,w).match(/.{2}/g).join(" "),this.length>w&&(d+=" ... ")),"<Buffer "+d+">"},f.prototype.compare=function(d,w,E,b,D){if(!f.isBuffer(d))throw new TypeError("Argument must be a Buffer");if(w===void 0&&(w=0),E===void 0&&(E=d?d.length:0),b===void 0&&(b=0),D===void 0&&(D=this.length),w<0||E>d.length||b<0||D>this.length)throw new RangeError("out of range index");if(b>=D&&w>=E)return 0;if(b>=D)return-1;if(w>=E)return 1;if(w>>>=0,E>>>=0,b>>>=0,D>>>=0,this===d)return 0;for(var T=D-b,ne=E-w,le=Math.min(T,ne),he=this.slice(b,D),we=d.slice(w,E),ye=0;ye<le;++ye)if(he[ye]!==we[ye]){T=he[ye],ne=we[ye];break}return T<ne?-1:ne<T?1:0},f.prototype.includes=function(d,w,E){return this.indexOf(d,w,E)!==-1},f.prototype.indexOf=function(d,w,E){return u(this,d,w,E,!0)},f.prototype.lastIndexOf=function(d,w,E){return u(this,d,w,E,!1)},f.prototype.write=function(d,w,E,b){if(w===void 0)b="utf8",E=this.length,w=0;else if(E===void 0&&typeof w=="string")b=w,E=this.length,w=0;else{if(!isFinite(w))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");w|=0,isFinite(E)?(E|=0,b===void 0&&(b="utf8")):(b=E,E=void 0)}var D=this.length-w;if((E===void 0||E>D)&&(E=D),d.length>0&&(E<0||w<0)||w>this.length)throw new RangeError("Attempt to write outside buffer bounds");b||(b="utf8");for(var T=!1;;)switch(b){case"hex":return g(this,d,w,E);case"utf8":case"utf-8":return k(this,d,w,E);case"ascii":return P(this,d,w,E);case"latin1":case"binary":return C(this,d,w,E);case"base64":return S(this,d,w,E);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,d,w,E);default:if(T)throw new TypeError("Unknown encoding: "+b);b=(""+b).toLowerCase(),T=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var N=4096;function I(d,w,E){var b="";E=Math.min(d.length,E);for(var D=w;D<E;++D)b+=String.fromCharCode(127&d[D]);return b}function X(d,w,E){var b="";E=Math.min(d.length,E);for(var D=w;D<E;++D)b+=String.fromCharCode(d[D]);return b}function z(d,w,E){var b=d.length;(!w||w<0)&&(w=0),(!E||E<0||E>b)&&(E=b);for(var D="",T=w;T<E;++T)D+=Y(d[T]);return D}function q(d,w,E){for(var b=d.slice(w,E),D="",T=0;T<b.length;T+=2)D+=String.fromCharCode(b[T]+256*b[T+1]);return D}function Q(d,w,E){if(d%1!=0||d<0)throw new RangeError("offset is not uint");if(d+w>E)throw new RangeError("Trying to access beyond buffer length")}function Z(d,w,E,b,D,T){if(!f.isBuffer(d))throw new TypeError('"buffer" argument must be a Buffer instance');if(w>D||w<T)throw new RangeError('"value" argument is out of bounds');if(E+b>d.length)throw new RangeError("Index out of range")}function ce(d,w,E,b){w<0&&(w=65535+w+1);for(var D=0,T=Math.min(d.length-E,2);D<T;++D)d[E+D]=(w&255<<8*(b?D:1-D))>>>8*(b?D:1-D)}function K(d,w,E,b){w<0&&(w=4294967295+w+1);for(var D=0,T=Math.min(d.length-E,4);D<T;++D)d[E+D]=w>>>8*(b?D:3-D)&255}function L(d,w,E,b,D,T){if(E+b>d.length)throw new RangeError("Index out of range");if(E<0)throw new RangeError("Index out of range")}function H(d,w,E,b,D){return D||L(d,0,E,4),i.write(d,w,E,b,23,4),E+4}function G(d,w,E,b,D){return D||L(d,0,E,8),i.write(d,w,E,b,52,8),E+8}f.prototype.slice=function(d,w){var E,b=this.length;if(d=~~d,w=w===void 0?b:~~w,d<0?(d+=b)<0&&(d=0):d>b&&(d=b),w<0?(w+=b)<0&&(w=0):w>b&&(w=b),w<d&&(w=d),f.TYPED_ARRAY_SUPPORT)(E=this.subarray(d,w)).__proto__=f.prototype;else{var D=w-d;E=new f(D,void 0);for(var T=0;T<D;++T)E[T]=this[T+d]}return E},f.prototype.readUIntLE=function(d,w,E){d|=0,w|=0,E||Q(d,w,this.length);for(var b=this[d],D=1,T=0;++T<w&&(D*=256);)b+=this[d+T]*D;return b},f.prototype.readUIntBE=function(d,w,E){d|=0,w|=0,E||Q(d,w,this.length);for(var b=this[d+--w],D=1;w>0&&(D*=256);)b+=this[d+--w]*D;return b},f.prototype.readUInt8=function(d,w){return w||Q(d,1,this.length),this[d]},f.prototype.readUInt16LE=function(d,w){return w||Q(d,2,this.length),this[d]|this[d+1]<<8},f.prototype.readUInt16BE=function(d,w){return w||Q(d,2,this.length),this[d]<<8|this[d+1]},f.prototype.readUInt32LE=function(d,w){return w||Q(d,4,this.length),(this[d]|this[d+1]<<8|this[d+2]<<16)+16777216*this[d+3]},f.prototype.readUInt32BE=function(d,w){return w||Q(d,4,this.length),16777216*this[d]+(this[d+1]<<16|this[d+2]<<8|this[d+3])},f.prototype.readIntLE=function(d,w,E){d|=0,w|=0,E||Q(d,w,this.length);for(var b=this[d],D=1,T=0;++T<w&&(D*=256);)b+=this[d+T]*D;return b>=(D*=128)&&(b-=Math.pow(2,8*w)),b},f.prototype.readIntBE=function(d,w,E){d|=0,w|=0,E||Q(d,w,this.length);for(var b=w,D=1,T=this[d+--b];b>0&&(D*=256);)T+=this[d+--b]*D;return T>=(D*=128)&&(T-=Math.pow(2,8*w)),T},f.prototype.readInt8=function(d,w){return w||Q(d,1,this.length),128&this[d]?-1*(255-this[d]+1):this[d]},f.prototype.readInt16LE=function(d,w){w||Q(d,2,this.length);var E=this[d]|this[d+1]<<8;return 32768&E?4294901760|E:E},f.prototype.readInt16BE=function(d,w){w||Q(d,2,this.length);var E=this[d+1]|this[d]<<8;return 32768&E?4294901760|E:E},f.prototype.readInt32LE=function(d,w){return w||Q(d,4,this.length),this[d]|this[d+1]<<8|this[d+2]<<16|this[d+3]<<24},f.prototype.readInt32BE=function(d,w){return w||Q(d,4,this.length),this[d]<<24|this[d+1]<<16|this[d+2]<<8|this[d+3]},f.prototype.readFloatLE=function(d,w){return w||Q(d,4,this.length),i.read(this,d,!0,23,4)},f.prototype.readFloatBE=function(d,w){return w||Q(d,4,this.length),i.read(this,d,!1,23,4)},f.prototype.readDoubleLE=function(d,w){return w||Q(d,8,this.length),i.read(this,d,!0,52,8)},f.prototype.readDoubleBE=function(d,w){return w||Q(d,8,this.length),i.read(this,d,!1,52,8)},f.prototype.writeUIntLE=function(d,w,E,b){d=+d,w|=0,E|=0,b||Z(this,d,w,E,Math.pow(2,8*E)-1,0);var D=1,T=0;for(this[w]=255&d;++T<E&&(D*=256);)this[w+T]=d/D&255;return w+E},f.prototype.writeUIntBE=function(d,w,E,b){d=+d,w|=0,E|=0,b||Z(this,d,w,E,Math.pow(2,8*E)-1,0);var D=E-1,T=1;for(this[w+D]=255&d;--D>=0&&(T*=256);)this[w+D]=d/T&255;return w+E},f.prototype.writeUInt8=function(d,w,E){return d=+d,w|=0,E||Z(this,d,w,1,255,0),f.TYPED_ARRAY_SUPPORT||(d=Math.floor(d)),this[w]=255&d,w+1},f.prototype.writeUInt16LE=function(d,w,E){return d=+d,w|=0,E||Z(this,d,w,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[w]=255&d,this[w+1]=d>>>8):ce(this,d,w,!0),w+2},f.prototype.writeUInt16BE=function(d,w,E){return d=+d,w|=0,E||Z(this,d,w,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[w]=d>>>8,this[w+1]=255&d):ce(this,d,w,!1),w+2},f.prototype.writeUInt32LE=function(d,w,E){return d=+d,w|=0,E||Z(this,d,w,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[w+3]=d>>>24,this[w+2]=d>>>16,this[w+1]=d>>>8,this[w]=255&d):K(this,d,w,!0),w+4},f.prototype.writeUInt32BE=function(d,w,E){return d=+d,w|=0,E||Z(this,d,w,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[w]=d>>>24,this[w+1]=d>>>16,this[w+2]=d>>>8,this[w+3]=255&d):K(this,d,w,!1),w+4},f.prototype.writeIntLE=function(d,w,E,b){if(d=+d,w|=0,!b){var D=Math.pow(2,8*E-1);Z(this,d,w,E,D-1,-D)}var T=0,ne=1,le=0;for(this[w]=255&d;++T<E&&(ne*=256);)d<0&&le===0&&this[w+T-1]!==0&&(le=1),this[w+T]=(d/ne>>0)-le&255;return w+E},f.prototype.writeIntBE=function(d,w,E,b){if(d=+d,w|=0,!b){var D=Math.pow(2,8*E-1);Z(this,d,w,E,D-1,-D)}var T=E-1,ne=1,le=0;for(this[w+T]=255&d;--T>=0&&(ne*=256);)d<0&&le===0&&this[w+T+1]!==0&&(le=1),this[w+T]=(d/ne>>0)-le&255;return w+E},f.prototype.writeInt8=function(d,w,E){return d=+d,w|=0,E||Z(this,d,w,1,127,-128),f.TYPED_ARRAY_SUPPORT||(d=Math.floor(d)),d<0&&(d=255+d+1),this[w]=255&d,w+1},f.prototype.writeInt16LE=function(d,w,E){return d=+d,w|=0,E||Z(this,d,w,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[w]=255&d,this[w+1]=d>>>8):ce(this,d,w,!0),w+2},f.prototype.writeInt16BE=function(d,w,E){return d=+d,w|=0,E||Z(this,d,w,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[w]=d>>>8,this[w+1]=255&d):ce(this,d,w,!1),w+2},f.prototype.writeInt32LE=function(d,w,E){return d=+d,w|=0,E||Z(this,d,w,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[w]=255&d,this[w+1]=d>>>8,this[w+2]=d>>>16,this[w+3]=d>>>24):K(this,d,w,!0),w+4},f.prototype.writeInt32BE=function(d,w,E){return d=+d,w|=0,E||Z(this,d,w,4,2147483647,-2147483648),d<0&&(d=4294967295+d+1),f.TYPED_ARRAY_SUPPORT?(this[w]=d>>>24,this[w+1]=d>>>16,this[w+2]=d>>>8,this[w+3]=255&d):K(this,d,w,!1),w+4},f.prototype.writeFloatLE=function(d,w,E){return H(this,d,w,!0,E)},f.prototype.writeFloatBE=function(d,w,E){return H(this,d,w,!1,E)},f.prototype.writeDoubleLE=function(d,w,E){return G(this,d,w,!0,E)},f.prototype.writeDoubleBE=function(d,w,E){return G(this,d,w,!1,E)},f.prototype.copy=function(d,w,E,b){if(E||(E=0),b||b===0||(b=this.length),w>=d.length&&(w=d.length),w||(w=0),b>0&&b<E&&(b=E),b===E||d.length===0||this.length===0)return 0;if(w<0)throw new RangeError("targetStart out of bounds");if(E<0||E>=this.length)throw new RangeError("sourceStart out of bounds");if(b<0)throw new RangeError("sourceEnd out of bounds");b>this.length&&(b=this.length),d.length-w<b-E&&(b=d.length-w+E);var D,T=b-E;if(this===d&&E<w&&w<b)for(D=T-1;D>=0;--D)d[D+w]=this[D+E];else if(T<1e3||!f.TYPED_ARRAY_SUPPORT)for(D=0;D<T;++D)d[D+w]=this[D+E];else Uint8Array.prototype.set.call(d,this.subarray(E,E+T),w);return T},f.prototype.fill=function(d,w,E,b){if(typeof d=="string"){if(typeof w=="string"?(b=w,w=0,E=this.length):typeof E=="string"&&(b=E,E=this.length),d.length===1){var D=d.charCodeAt(0);D<256&&(d=D)}if(b!==void 0&&typeof b!="string")throw new TypeError("encoding must be a string");if(typeof b=="string"&&!f.isEncoding(b))throw new TypeError("Unknown encoding: "+b)}else typeof d=="number"&&(d&=255);if(w<0||this.length<w||this.length<E)throw new RangeError("Out of range index");if(E<=w)return this;var T;if(w>>>=0,E=E===void 0?this.length:E>>>0,d||(d=0),typeof d=="number")for(T=w;T<E;++T)this[T]=d;else{var ne=f.isBuffer(d)?d:re(new f(d,b).toString()),le=ne.length;for(T=0;T<E-w;++T)this[T+w]=ne[T%le]}return this};var B=/[^+\/0-9A-Za-z-_]/g;function Y(d){return d<16?"0"+d.toString(16):d.toString(16)}function re(d,w){var E;w=w||1/0;for(var b=d.length,D=null,T=[],ne=0;ne<b;++ne){if((E=d.charCodeAt(ne))>55295&&E<57344){if(!D){if(E>56319){(w-=3)>-1&&T.push(239,191,189);continue}if(ne+1===b){(w-=3)>-1&&T.push(239,191,189);continue}D=E;continue}if(E<56320){(w-=3)>-1&&T.push(239,191,189),D=E;continue}E=65536+(D-55296<<10|E-56320)}else D&&(w-=3)>-1&&T.push(239,191,189);if(D=null,E<128){if((w-=1)<0)break;T.push(E)}else if(E<2048){if((w-=2)<0)break;T.push(E>>6|192,63&E|128)}else if(E<65536){if((w-=3)<0)break;T.push(E>>12|224,E>>6&63|128,63&E|128)}else{if(!(E<1114112))throw new Error("Invalid code point");if((w-=4)<0)break;T.push(E>>18|240,E>>12&63|128,E>>6&63|128,63&E|128)}}return T}function ee(d){return a.toByteArray((function(w){if((w=(function(E){return E.trim?E.trim():E.replace(/^\s+|\s+$/g,"")})(w).replace(B,"")).length<2)return"";for(;w.length%4!=0;)w+="=";return w})(d))}function ue(d,w,E,b){for(var D=0;D<b&&!(D+E>=w.length||D>=d.length);++D)w[D+E]=d[D];return D}}).call(this,r(0))},function(e,t){var r,n,a=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(h){if(r===setTimeout)return setTimeout(h,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(h,0);try{return r(h,0)}catch{try{return r.call(null,h,0)}catch{return r.call(this,h,0)}}}(function(){try{r=typeof setTimeout=="function"?setTimeout:i}catch{r=i}try{n=typeof clearTimeout=="function"?clearTimeout:o}catch{n=o}})();var c,f=[],l=!1,_=-1;function v(){l&&c&&(l=!1,c.length?f=c.concat(f):_=-1,f.length&&x())}function x(){if(!l){var h=s(v);l=!0;for(var u=f.length;u;){for(c=f,f=[];++_<u;)c&&c[_].run();_=-1,u=f.length}c=null,l=!1,(function(y){if(n===clearTimeout)return clearTimeout(y);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(y);try{n(y)}catch{try{return n.call(null,y)}catch{return n.call(this,y)}}})(h)}}function p(h,u){this.fun=h,this.array=u}function m(){}a.nextTick=function(h){var u=new Array(arguments.length-1);if(arguments.length>1)for(var y=1;y<arguments.length;y++)u[y-1]=arguments[y];f.push(new p(h,u)),f.length!==1||l||s(x)},p.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=m,a.addListener=m,a.once=m,a.off=m,a.removeListener=m,a.removeAllListeners=m,a.emit=m,a.prependListener=m,a.prependOnceListener=m,a.listeners=function(h){return[]},a.binding=function(h){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(h){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},function(e,t,r){(function(n){function a(i){return Object.prototype.toString.call(i)}t.isArray=function(i){return Array.isArray?Array.isArray(i):a(i)==="[object Array]"},t.isBoolean=function(i){return typeof i=="boolean"},t.isNull=function(i){return i===null},t.isNullOrUndefined=function(i){return i==null},t.isNumber=function(i){return typeof i=="number"},t.isString=function(i){return typeof i=="string"},t.isSymbol=function(i){return typeof i=="symbol"},t.isUndefined=function(i){return i===void 0},t.isRegExp=function(i){return a(i)==="[object RegExp]"},t.isObject=function(i){return typeof i=="object"&&i!==null},t.isDate=function(i){return a(i)==="[object Date]"},t.isError=function(i){return a(i)==="[object Error]"||i instanceof Error},t.isFunction=function(i){return typeof i=="function"},t.isPrimitive=function(i){return i===null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||typeof i=="symbol"||i===void 0},t.isBuffer=n.isBuffer}).call(this,r(3).Buffer)},function(e,t,r){"use strict";(function(n){!n.version||n.version.indexOf("v0.")===0||n.version.indexOf("v1.")===0&&n.version.indexOf("v1.8.")!==0?e.exports={nextTick:function(a,i,o,s){if(typeof a!="function")throw new TypeError('"callback" argument must be a function');var c,f,l=arguments.length;switch(l){case 0:case 1:return n.nextTick(a);case 2:return n.nextTick(function(){a.call(null,i)});case 3:return n.nextTick(function(){a.call(null,i,o)});case 4:return n.nextTick(function(){a.call(null,i,o,s)});default:for(c=new Array(l-1),f=0;f<c.length;)c[f++]=arguments[f];return n.nextTick(function(){a.apply(null,c)})}}}:e.exports=n}).call(this,r(4))},function(e,t,r){var n=r(3),a=n.Buffer;function i(s,c){for(var f in s)c[f]=s[f]}function o(s,c,f){return a(s,c,f)}a.from&&a.alloc&&a.allocUnsafe&&a.allocUnsafeSlow?e.exports=n:(i(n,t),t.Buffer=o),i(a,o),o.from=function(s,c,f){if(typeof s=="number")throw new TypeError("Argument must not be a number");return a(s,c,f)},o.alloc=function(s,c,f){if(typeof s!="number")throw new TypeError("Argument must be a number");var l=a(s);return c!==void 0?typeof f=="string"?l.fill(c,f):l.fill(c):l.fill(0),l},o.allocUnsafe=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return a(s)},o.allocUnsafeSlow=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return n.SlowBuffer(s)}},function(e,t,r){var n=r(17)(Object,"create");e.exports=n},function(e,t,r){var n=r(31);e.exports=function(a,i){for(var o=a.length;o--;)if(n(a[o][0],i))return o;return-1}},function(e,t,r){var n=r(96);e.exports=function(a,i){var o=a.__data__;return n(i)?o[typeof i=="string"?"string":"hash"]:o.map}},function(e,t,r){(function(n){var a=n!==void 0&&n||typeof self<"u"&&self||window,i=Function.prototype.apply;function o(s,c){this._id=s,this._clearFn=c}t.setTimeout=function(){return new o(i.call(setTimeout,a,arguments),clearTimeout)},t.setInterval=function(){return new o(i.call(setInterval,a,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(s){s&&s.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(a,this._id)},t.enroll=function(s,c){clearTimeout(s._idleTimeoutId),s._idleTimeout=c},t.unenroll=function(s){clearTimeout(s._idleTimeoutId),s._idleTimeout=-1},t._unrefActive=t.active=function(s){clearTimeout(s._idleTimeoutId);var c=s._idleTimeout;c>=0&&(s._idleTimeoutId=setTimeout(function(){s._onTimeout&&s._onTimeout()},c))},r(35),t.setImmediate=typeof self<"u"&&self.setImmediate||n!==void 0&&n.setImmediate||this&&this.setImmediate,t.clearImmediate=typeof self<"u"&&self.clearImmediate||n!==void 0&&n.clearImmediate||this&&this.clearImmediate}).call(this,r(0))},function(e,t){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(o){return typeof o=="function"}function a(o){return typeof o=="object"&&o!==null}function i(o){return o===void 0}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(o){if(!(function(s){return typeof s=="number"})(o)||o<0||isNaN(o))throw TypeError("n must be a positive number");return this._maxListeners=o,this},r.prototype.emit=function(o){var s,c,f,l,_,v;if(this._events||(this._events={}),o==="error"&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if((s=arguments[1])instanceof Error)throw s;var x=new Error('Uncaught, unspecified "error" event. ('+s+")");throw x.context=s,x}if(i(c=this._events[o]))return!1;if(n(c))switch(arguments.length){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:l=Array.prototype.slice.call(arguments,1),c.apply(this,l)}else if(a(c))for(l=Array.prototype.slice.call(arguments,1),f=(v=c.slice()).length,_=0;_<f;_++)v[_].apply(this,l);return!0},r.prototype.addListener=function(o,s){var c;if(!n(s))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",o,n(s.listener)?s.listener:s),this._events[o]?a(this._events[o])?this._events[o].push(s):this._events[o]=[this._events[o],s]:this._events[o]=s,a(this._events[o])&&!this._events[o].warned&&(c=i(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&c>0&&this._events[o].length>c&&(this._events[o].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[o].length),typeof console.trace=="function"&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(o,s){if(!n(s))throw TypeError("listener must be a function");var c=!1;function f(){this.removeListener(o,f),c||(c=!0,s.apply(this,arguments))}return f.listener=s,this.on(o,f),this},r.prototype.removeListener=function(o,s){var c,f,l,_;if(!n(s))throw TypeError("listener must be a function");if(!this._events||!this._events[o])return this;if(l=(c=this._events[o]).length,f=-1,c===s||n(c.listener)&&c.listener===s)delete this._events[o],this._events.removeListener&&this.emit("removeListener",o,s);else if(a(c)){for(_=l;_-- >0;)if(c[_]===s||c[_].listener&&c[_].listener===s){f=_;break}if(f<0)return this;c.length===1?(c.length=0,delete this._events[o]):c.splice(f,1),this._events.removeListener&&this.emit("removeListener",o,s)}return this},r.prototype.removeAllListeners=function(o){var s,c;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[o]&&delete this._events[o],this;if(arguments.length===0){for(s in this._events)s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events={},this}if(n(c=this._events[o]))this.removeListener(o,c);else if(c)for(;c.length;)this.removeListener(o,c[c.length-1]);return delete this._events[o],this},r.prototype.listeners=function(o){return this._events&&this._events[o]?n(this._events[o])?[this._events[o]]:this._events[o].slice():[]},r.prototype.listenerCount=function(o){if(this._events){var s=this._events[o];if(n(s))return 1;if(s)return s.length}return 0},r.listenerCount=function(o,s){return o.listenerCount(s)}},function(e,t,r){(t=e.exports=r(23)).Stream=t,t.Readable=t,t.Writable=r(14),t.Duplex=r(1),t.Transform=r(27),t.PassThrough=r(45)},function(e,t,r){"use strict";(function(n,a,i){var o=r(6);function s(F){var N=this;this.next=null,this.entry=null,this.finish=function(){(function(I,X,z){var q=I.entry;for(I.entry=null;q;){var Q=q.callback;X.pendingcb--,Q(void 0),q=q.next}X.corkedRequestsFree?X.corkedRequestsFree.next=I:X.corkedRequestsFree=I})(N,F)}}e.exports=g;var c,f=!n.browser&&["v0.10","v0.9."].indexOf(n.version.slice(0,5))>-1?a:o.nextTick;g.WritableState=y;var l=r(5);l.inherits=r(2);var _,v={deprecate:r(44)},x=r(24),p=r(7).Buffer,m=i.Uint8Array||function(){},h=r(25);function u(){}function y(F,N){c=c||r(1),F=F||{};var I=N instanceof c;this.objectMode=!!F.objectMode,I&&(this.objectMode=this.objectMode||!!F.writableObjectMode);var X=F.highWaterMark,z=F.writableHighWaterMark,q=this.objectMode?16:16384;this.highWaterMark=X||X===0?X:I&&(z||z===0)?z:q,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Q=F.decodeStrings===!1;this.decodeStrings=!Q,this.defaultEncoding=F.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Z){(function(ce,K){var L=ce._writableState,H=L.sync,G=L.writecb;if((function(Y){Y.writing=!1,Y.writecb=null,Y.length-=Y.writelen,Y.writelen=0})(L),K)(function(Y,re,ee,ue,d){--re.pendingcb,ee?(o.nextTick(d,ue),o.nextTick(R,Y,re),Y._writableState.errorEmitted=!0,Y.emit("error",ue)):(d(ue),Y._writableState.errorEmitted=!0,Y.emit("error",ue),R(Y,re))})(ce,L,H,K,G);else{var B=S(L);B||L.corked||L.bufferProcessing||!L.bufferedRequest||C(ce,L),H?f(P,ce,L,B,G):P(ce,L,B,G)}})(N,Z)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function g(F){if(c=c||r(1),!(_.call(g,this)||this instanceof c))return new g(F);this._writableState=new y(F,this),this.writable=!0,F&&(typeof F.write=="function"&&(this._write=F.write),typeof F.writev=="function"&&(this._writev=F.writev),typeof F.destroy=="function"&&(this._destroy=F.destroy),typeof F.final=="function"&&(this._final=F.final)),x.call(this)}function k(F,N,I,X,z,q,Q){N.writelen=X,N.writecb=Q,N.writing=!0,N.sync=!0,I?F._writev(z,N.onwrite):F._write(z,q,N.onwrite),N.sync=!1}function P(F,N,I,X){I||(function(z,q){q.length===0&&q.needDrain&&(q.needDrain=!1,z.emit("drain"))})(F,N),N.pendingcb--,X(),R(F,N)}function C(F,N){N.bufferProcessing=!0;var I=N.bufferedRequest;if(F._writev&&I&&I.next){var X=N.bufferedRequestCount,z=new Array(X),q=N.corkedRequestsFree;q.entry=I;for(var Q=0,Z=!0;I;)z[Q]=I,I.isBuf||(Z=!1),I=I.next,Q+=1;z.allBuffers=Z,k(F,N,!0,N.length,z,"",q.finish),N.pendingcb++,N.lastBufferedRequest=null,q.next?(N.corkedRequestsFree=q.next,q.next=null):N.corkedRequestsFree=new s(N),N.bufferedRequestCount=0}else{for(;I;){var ce=I.chunk,K=I.encoding,L=I.callback;if(k(F,N,!1,N.objectMode?1:ce.length,ce,K,L),I=I.next,N.bufferedRequestCount--,N.writing)break}I===null&&(N.lastBufferedRequest=null)}N.bufferedRequest=I,N.bufferProcessing=!1}function S(F){return F.ending&&F.length===0&&F.bufferedRequest===null&&!F.finished&&!F.writing}function A(F,N){F._final(function(I){N.pendingcb--,I&&F.emit("error",I),N.prefinished=!0,F.emit("prefinish"),R(F,N)})}function R(F,N){var I=S(N);return I&&((function(X,z){z.prefinished||z.finalCalled||(typeof X._final=="function"?(z.pendingcb++,z.finalCalled=!0,o.nextTick(A,X,z)):(z.prefinished=!0,X.emit("prefinish")))})(F,N),N.pendingcb===0&&(N.finished=!0,F.emit("finish"))),I}l.inherits(g,x),y.prototype.getBuffer=function(){for(var F=this.bufferedRequest,N=[];F;)N.push(F),F=F.next;return N},(function(){try{Object.defineProperty(y.prototype,"buffer",{get:v.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})(),typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(_=Function.prototype[Symbol.hasInstance],Object.defineProperty(g,Symbol.hasInstance,{value:function(F){return!!_.call(this,F)||this===g&&F&&F._writableState instanceof y}})):_=function(F){return F instanceof this},g.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},g.prototype.write=function(F,N,I){var X=this._writableState,z=!1,q=!X.objectMode&&(function(Q){return p.isBuffer(Q)||Q instanceof m})(F);return q&&!p.isBuffer(F)&&(F=(function(Q){return p.from(Q)})(F)),typeof N=="function"&&(I=N,N=null),q?N="buffer":N||(N=X.defaultEncoding),typeof I!="function"&&(I=u),X.ended?(function(Q,Z){var ce=new Error("write after end");Q.emit("error",ce),o.nextTick(Z,ce)})(this,I):(q||(function(Q,Z,ce,K){var L=!0,H=!1;return ce===null?H=new TypeError("May not write null values to stream"):typeof ce=="string"||ce===void 0||Z.objectMode||(H=new TypeError("Invalid non-string/buffer chunk")),H&&(Q.emit("error",H),o.nextTick(K,H),L=!1),L})(this,X,F,I))&&(X.pendingcb++,z=(function(Q,Z,ce,K,L,H){if(!ce){var G=(function(ee,ue,d){return ee.objectMode||ee.decodeStrings===!1||typeof ue!="string"||(ue=p.from(ue,d)),ue})(Z,K,L);K!==G&&(ce=!0,L="buffer",K=G)}var B=Z.objectMode?1:K.length;Z.length+=B;var Y=Z.length<Z.highWaterMark;if(Y||(Z.needDrain=!0),Z.writing||Z.corked){var re=Z.lastBufferedRequest;Z.lastBufferedRequest={chunk:K,encoding:L,isBuf:ce,callback:H,next:null},re?re.next=Z.lastBufferedRequest:Z.bufferedRequest=Z.lastBufferedRequest,Z.bufferedRequestCount+=1}else k(Q,Z,!1,B,K,L,H);return Y})(this,X,q,F,N,I)),z},g.prototype.cork=function(){this._writableState.corked++},g.prototype.uncork=function(){var F=this._writableState;F.corked&&(F.corked--,F.writing||F.corked||F.finished||F.bufferProcessing||!F.bufferedRequest||C(this,F))},g.prototype.setDefaultEncoding=function(F){if(typeof F=="string"&&(F=F.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((F+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+F);return this._writableState.defaultEncoding=F,this},Object.defineProperty(g.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),g.prototype._write=function(F,N,I){I(new Error("_write() is not implemented"))},g.prototype._writev=null,g.prototype.end=function(F,N,I){var X=this._writableState;typeof F=="function"?(I=F,F=null,N=null):typeof N=="function"&&(I=N,N=null),F!=null&&this.write(F,N),X.corked&&(X.corked=1,this.uncork()),X.ending||X.finished||(function(z,q,Q){q.ending=!0,R(z,q),Q&&(q.finished?o.nextTick(Q):z.once("finish",Q)),q.ended=!0,z.writable=!1})(this,X,I)},Object.defineProperty(g.prototype,"destroyed",{get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(F){this._writableState&&(this._writableState.destroyed=F)}}),g.prototype.destroy=h.destroy,g.prototype._undestroy=h.undestroy,g.prototype._destroy=function(F,N){this.end(),N(F)}}).call(this,r(4),r(11).setImmediate,r(0))},function(e,t,r){(function(n,a,i){e.exports=(function o(s,c,f){function l(x,p){if(!c[x]){if(!s[x]){var m=typeof _dereq_=="function"&&_dereq_;if(!p&&m)return m(x,!0);if(_)return _(x,!0);var h=new Error("Cannot find module '"+x+"'");throw h.code="MODULE_NOT_FOUND",h}var u=c[x]={exports:{}};s[x][0].call(u.exports,function(y){return l(s[x][1][y]||y)},u,u.exports,o,s,c,f)}return c[x].exports}for(var _=typeof _dereq_=="function"&&_dereq_,v=0;v<f.length;v++)l(f[v]);return l})({1:[function(o,s,c){"use strict";s.exports=function(f){var l=f._SomePromiseArray;function _(v){var x=new l(v),p=x.promise();return x.setHowMany(1),x.setUnwrap(),x.init(),p}f.any=function(v){return _(v)},f.prototype.any=function(){return _(this)}}},{}],2:[function(o,s,c){"use strict";var f;try{throw new Error}catch(u){f=u}var l=o("./schedule"),_=o("./queue"),v=o("./util");function x(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new _(16),this._normalQueue=new _(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var u=this;this.drainQueues=function(){u._drainQueues()},this._schedule=l}function p(u,y,g){this._lateQueue.push(u,y,g),this._queueTick()}function m(u,y,g){this._normalQueue.push(u,y,g),this._queueTick()}function h(u){this._normalQueue._pushOne(u),this._queueTick()}x.prototype.setScheduler=function(u){var y=this._schedule;return this._schedule=u,this._customScheduler=!0,y},x.prototype.hasCustomScheduler=function(){return this._customScheduler},x.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},x.prototype.disableTrampolineIfNecessary=function(){v.hasDevTools&&(this._trampolineEnabled=!1)},x.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},x.prototype.fatalError=function(u,y){y?(n.stderr.write("Fatal "+(u instanceof Error?u.stack:u)+`
|
|
1
|
+
import{b as Rr,e as bi}from"./chunk-3IKZH76S.js";var Ai=Rr((wg,Fi)=>{"use strict";Fi.exports=(function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(n,a,i){r.o(n,a)||Object.defineProperty(n,a,{enumerable:!0,get:i})},r.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,a){if(1&a&&(n=r(n)),8&a||4&a&&typeof n=="object"&&n&&n.__esModule)return n;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:n}),2&a&&typeof n!="string")for(var o in n)r.d(i,o,function(s){return n[s]}.bind(null,o));return i},r.n=function(n){var a=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(a,"a",a),a},r.o=function(n,a){return Object.prototype.hasOwnProperty.call(n,a)},r.p="",r(r.s=32)})([function(e,t){var r;r=(function(){return this})();try{r=r||Function("return this")()||(0,eval)("this")}catch{typeof window=="object"&&(r=window)}e.exports=r},function(e,t,r){"use strict";var n=r(6),a=Object.keys||function(p){var m=[];for(var h in p)m.push(h);return m};e.exports=_;var i=r(5);i.inherits=r(2);var o=r(23),s=r(14);i.inherits(_,o);for(var c=a(s.prototype),f=0;f<c.length;f++){var l=c[f];_.prototype[l]||(_.prototype[l]=s.prototype[l])}function _(p){if(!(this instanceof _))return new _(p);o.call(this,p),s.call(this,p),p&&p.readable===!1&&(this.readable=!1),p&&p.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,p&&p.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",v)}function v(){this.allowHalfOpen||this._writableState.ended||n.nextTick(x,this)}function x(p){p.end()}Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(_.prototype,"destroyed",{get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(p){this._readableState!==void 0&&this._writableState!==void 0&&(this._readableState.destroyed=p,this._writableState.destroyed=p)}}),_.prototype._destroy=function(p,m){this.push(null),this.end(),n.nextTick(m,p)}},function(e,t){typeof Object.create=="function"?e.exports=function(r,n){r.super_=n,r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(r,n){r.super_=n;var a=function(){};a.prototype=n.prototype,r.prototype=new a,r.prototype.constructor=r}},function(e,t,r){"use strict";(function(n){var a=r(38),i=r(39),o=r(40);function s(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function c(d,w){if(s()<w)throw new RangeError("Invalid typed array length");return f.TYPED_ARRAY_SUPPORT?(d=new Uint8Array(w)).__proto__=f.prototype:(d===null&&(d=new f(w)),d.length=w),d}function f(d,w,E){if(!(f.TYPED_ARRAY_SUPPORT||this instanceof f))return new f(d,w,E);if(typeof d=="number"){if(typeof w=="string")throw new Error("If encoding is specified then the first argument must be a string");return v(this,d)}return l(this,d,w,E)}function l(d,w,E,b){if(typeof w=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&w instanceof ArrayBuffer?(function(D,T,ne,le){if(T.byteLength,ne<0||T.byteLength<ne)throw new RangeError("'offset' is out of bounds");if(T.byteLength<ne+(le||0))throw new RangeError("'length' is out of bounds");return T=ne===void 0&&le===void 0?new Uint8Array(T):le===void 0?new Uint8Array(T,ne):new Uint8Array(T,ne,le),f.TYPED_ARRAY_SUPPORT?(D=T).__proto__=f.prototype:D=x(D,T),D})(d,w,E,b):typeof w=="string"?(function(D,T,ne){if(typeof ne=="string"&&ne!==""||(ne="utf8"),!f.isEncoding(ne))throw new TypeError('"encoding" must be a valid string encoding');var le=0|m(T,ne),he=(D=c(D,le)).write(T,ne);return he!==le&&(D=D.slice(0,he)),D})(d,w,E):(function(D,T){if(f.isBuffer(T)){var ne=0|p(T.length);return(D=c(D,ne)).length===0||T.copy(D,0,0,ne),D}if(T){if(typeof ArrayBuffer<"u"&&T.buffer instanceof ArrayBuffer||"length"in T)return typeof T.length!="number"||(function(le){return le!=le})(T.length)?c(D,0):x(D,T);if(T.type==="Buffer"&&o(T.data))return x(D,T.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")})(d,w)}function _(d){if(typeof d!="number")throw new TypeError('"size" argument must be a number');if(d<0)throw new RangeError('"size" argument must not be negative')}function v(d,w){if(_(w),d=c(d,w<0?0:0|p(w)),!f.TYPED_ARRAY_SUPPORT)for(var E=0;E<w;++E)d[E]=0;return d}function x(d,w){var E=w.length<0?0:0|p(w.length);d=c(d,E);for(var b=0;b<E;b+=1)d[b]=255&w[b];return d}function p(d){if(d>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|d}function m(d,w){if(f.isBuffer(d))return d.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(d)||d instanceof ArrayBuffer))return d.byteLength;typeof d!="string"&&(d=""+d);var E=d.length;if(E===0)return 0;for(var b=!1;;)switch(w){case"ascii":case"latin1":case"binary":return E;case"utf8":case"utf-8":case void 0:return re(d).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*E;case"hex":return E>>>1;case"base64":return ee(d).length;default:if(b)return re(d).length;w=(""+w).toLowerCase(),b=!0}}function h(d,w,E){var b=d[w];d[w]=d[E],d[E]=b}function u(d,w,E,b,D){if(d.length===0)return-1;if(typeof E=="string"?(b=E,E=0):E>2147483647?E=2147483647:E<-2147483648&&(E=-2147483648),E=+E,isNaN(E)&&(E=D?0:d.length-1),E<0&&(E=d.length+E),E>=d.length){if(D)return-1;E=d.length-1}else if(E<0){if(!D)return-1;E=0}if(typeof w=="string"&&(w=f.from(w,b)),f.isBuffer(w))return w.length===0?-1:y(d,w,E,b,D);if(typeof w=="number")return w&=255,f.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?D?Uint8Array.prototype.indexOf.call(d,w,E):Uint8Array.prototype.lastIndexOf.call(d,w,E):y(d,[w],E,b,D);throw new TypeError("val must be string, number or Buffer")}function y(d,w,E,b,D){var T,ne=1,le=d.length,he=w.length;if(b!==void 0&&((b=String(b).toLowerCase())==="ucs2"||b==="ucs-2"||b==="utf16le"||b==="utf-16le")){if(d.length<2||w.length<2)return-1;ne=2,le/=2,he/=2,E/=2}function we(Pe,Ce){return ne===1?Pe[Ce]:Pe.readUInt16BE(Ce*ne)}if(D){var ye=-1;for(T=E;T<le;T++)if(we(d,T)===we(w,ye===-1?0:T-ye)){if(ye===-1&&(ye=T),T-ye+1===he)return ye*ne}else ye!==-1&&(T-=T-ye),ye=-1}else for(E+he>le&&(E=le-he),T=E;T>=0;T--){for(var _e=!0,Ne=0;Ne<he;Ne++)if(we(d,T+Ne)!==we(w,Ne)){_e=!1;break}if(_e)return T}return-1}function g(d,w,E,b){E=Number(E)||0;var D=d.length-E;b?(b=Number(b))>D&&(b=D):b=D;var T=w.length;if(T%2!=0)throw new TypeError("Invalid hex string");b>T/2&&(b=T/2);for(var ne=0;ne<b;++ne){var le=parseInt(w.substr(2*ne,2),16);if(isNaN(le))return ne;d[E+ne]=le}return ne}function k(d,w,E,b){return ue(re(w,d.length-E),d,E,b)}function P(d,w,E,b){return ue((function(D){for(var T=[],ne=0;ne<D.length;++ne)T.push(255&D.charCodeAt(ne));return T})(w),d,E,b)}function C(d,w,E,b){return P(d,w,E,b)}function S(d,w,E,b){return ue(ee(w),d,E,b)}function A(d,w,E,b){return ue((function(D,T){for(var ne,le,he,we=[],ye=0;ye<D.length&&!((T-=2)<0);++ye)le=(ne=D.charCodeAt(ye))>>8,he=ne%256,we.push(he),we.push(le);return we})(w,d.length-E),d,E,b)}function R(d,w,E){return w===0&&E===d.length?a.fromByteArray(d):a.fromByteArray(d.slice(w,E))}function F(d,w,E){E=Math.min(d.length,E);for(var b=[],D=w;D<E;){var T,ne,le,he,we=d[D],ye=null,_e=we>239?4:we>223?3:we>191?2:1;if(D+_e<=E)switch(_e){case 1:we<128&&(ye=we);break;case 2:(192&(T=d[D+1]))==128&&(he=(31&we)<<6|63&T)>127&&(ye=he);break;case 3:T=d[D+1],ne=d[D+2],(192&T)==128&&(192&ne)==128&&(he=(15&we)<<12|(63&T)<<6|63&ne)>2047&&(he<55296||he>57343)&&(ye=he);break;case 4:T=d[D+1],ne=d[D+2],le=d[D+3],(192&T)==128&&(192&ne)==128&&(192&le)==128&&(he=(15&we)<<18|(63&T)<<12|(63&ne)<<6|63&le)>65535&&he<1114112&&(ye=he)}ye===null?(ye=65533,_e=1):ye>65535&&(ye-=65536,b.push(ye>>>10&1023|55296),ye=56320|1023&ye),b.push(ye),D+=_e}return(function(Ne){var Pe=Ne.length;if(Pe<=N)return String.fromCharCode.apply(String,Ne);for(var Ce="",te=0;te<Pe;)Ce+=String.fromCharCode.apply(String,Ne.slice(te,te+=N));return Ce})(b)}t.Buffer=f,t.SlowBuffer=function(d){return+d!=d&&(d=0),f.alloc(+d)},t.INSPECT_MAX_BYTES=50,f.TYPED_ARRAY_SUPPORT=n.TYPED_ARRAY_SUPPORT!==void 0?n.TYPED_ARRAY_SUPPORT:(function(){try{var d=new Uint8Array(1);return d.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},d.foo()===42&&typeof d.subarray=="function"&&d.subarray(1,1).byteLength===0}catch{return!1}})(),t.kMaxLength=s(),f.poolSize=8192,f._augment=function(d){return d.__proto__=f.prototype,d},f.from=function(d,w,E){return l(null,d,w,E)},f.TYPED_ARRAY_SUPPORT&&(f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&f[Symbol.species]===f&&Object.defineProperty(f,Symbol.species,{value:null,configurable:!0})),f.alloc=function(d,w,E){return(function(b,D,T,ne){return _(D),D<=0?c(b,D):T!==void 0?typeof ne=="string"?c(b,D).fill(T,ne):c(b,D).fill(T):c(b,D)})(null,d,w,E)},f.allocUnsafe=function(d){return v(null,d)},f.allocUnsafeSlow=function(d){return v(null,d)},f.isBuffer=function(d){return!(d==null||!d._isBuffer)},f.compare=function(d,w){if(!f.isBuffer(d)||!f.isBuffer(w))throw new TypeError("Arguments must be Buffers");if(d===w)return 0;for(var E=d.length,b=w.length,D=0,T=Math.min(E,b);D<T;++D)if(d[D]!==w[D]){E=d[D],b=w[D];break}return E<b?-1:b<E?1:0},f.isEncoding=function(d){switch(String(d).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},f.concat=function(d,w){if(!o(d))throw new TypeError('"list" argument must be an Array of Buffers');if(d.length===0)return f.alloc(0);var E;if(w===void 0)for(w=0,E=0;E<d.length;++E)w+=d[E].length;var b=f.allocUnsafe(w),D=0;for(E=0;E<d.length;++E){var T=d[E];if(!f.isBuffer(T))throw new TypeError('"list" argument must be an Array of Buffers');T.copy(b,D),D+=T.length}return b},f.byteLength=m,f.prototype._isBuffer=!0,f.prototype.swap16=function(){var d=this.length;if(d%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var w=0;w<d;w+=2)h(this,w,w+1);return this},f.prototype.swap32=function(){var d=this.length;if(d%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var w=0;w<d;w+=4)h(this,w,w+3),h(this,w+1,w+2);return this},f.prototype.swap64=function(){var d=this.length;if(d%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var w=0;w<d;w+=8)h(this,w,w+7),h(this,w+1,w+6),h(this,w+2,w+5),h(this,w+3,w+4);return this},f.prototype.toString=function(){var d=0|this.length;return d===0?"":arguments.length===0?F(this,0,d):function(w,E,b){var D=!1;if((E===void 0||E<0)&&(E=0),E>this.length||((b===void 0||b>this.length)&&(b=this.length),b<=0)||(b>>>=0)<=(E>>>=0))return"";for(w||(w="utf8");;)switch(w){case"hex":return z(this,E,b);case"utf8":case"utf-8":return F(this,E,b);case"ascii":return I(this,E,b);case"latin1":case"binary":return X(this,E,b);case"base64":return R(this,E,b);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return q(this,E,b);default:if(D)throw new TypeError("Unknown encoding: "+w);w=(w+"").toLowerCase(),D=!0}}.apply(this,arguments)},f.prototype.equals=function(d){if(!f.isBuffer(d))throw new TypeError("Argument must be a Buffer");return this===d||f.compare(this,d)===0},f.prototype.inspect=function(){var d="",w=t.INSPECT_MAX_BYTES;return this.length>0&&(d=this.toString("hex",0,w).match(/.{2}/g).join(" "),this.length>w&&(d+=" ... ")),"<Buffer "+d+">"},f.prototype.compare=function(d,w,E,b,D){if(!f.isBuffer(d))throw new TypeError("Argument must be a Buffer");if(w===void 0&&(w=0),E===void 0&&(E=d?d.length:0),b===void 0&&(b=0),D===void 0&&(D=this.length),w<0||E>d.length||b<0||D>this.length)throw new RangeError("out of range index");if(b>=D&&w>=E)return 0;if(b>=D)return-1;if(w>=E)return 1;if(w>>>=0,E>>>=0,b>>>=0,D>>>=0,this===d)return 0;for(var T=D-b,ne=E-w,le=Math.min(T,ne),he=this.slice(b,D),we=d.slice(w,E),ye=0;ye<le;++ye)if(he[ye]!==we[ye]){T=he[ye],ne=we[ye];break}return T<ne?-1:ne<T?1:0},f.prototype.includes=function(d,w,E){return this.indexOf(d,w,E)!==-1},f.prototype.indexOf=function(d,w,E){return u(this,d,w,E,!0)},f.prototype.lastIndexOf=function(d,w,E){return u(this,d,w,E,!1)},f.prototype.write=function(d,w,E,b){if(w===void 0)b="utf8",E=this.length,w=0;else if(E===void 0&&typeof w=="string")b=w,E=this.length,w=0;else{if(!isFinite(w))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");w|=0,isFinite(E)?(E|=0,b===void 0&&(b="utf8")):(b=E,E=void 0)}var D=this.length-w;if((E===void 0||E>D)&&(E=D),d.length>0&&(E<0||w<0)||w>this.length)throw new RangeError("Attempt to write outside buffer bounds");b||(b="utf8");for(var T=!1;;)switch(b){case"hex":return g(this,d,w,E);case"utf8":case"utf-8":return k(this,d,w,E);case"ascii":return P(this,d,w,E);case"latin1":case"binary":return C(this,d,w,E);case"base64":return S(this,d,w,E);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,d,w,E);default:if(T)throw new TypeError("Unknown encoding: "+b);b=(""+b).toLowerCase(),T=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var N=4096;function I(d,w,E){var b="";E=Math.min(d.length,E);for(var D=w;D<E;++D)b+=String.fromCharCode(127&d[D]);return b}function X(d,w,E){var b="";E=Math.min(d.length,E);for(var D=w;D<E;++D)b+=String.fromCharCode(d[D]);return b}function z(d,w,E){var b=d.length;(!w||w<0)&&(w=0),(!E||E<0||E>b)&&(E=b);for(var D="",T=w;T<E;++T)D+=Y(d[T]);return D}function q(d,w,E){for(var b=d.slice(w,E),D="",T=0;T<b.length;T+=2)D+=String.fromCharCode(b[T]+256*b[T+1]);return D}function Q(d,w,E){if(d%1!=0||d<0)throw new RangeError("offset is not uint");if(d+w>E)throw new RangeError("Trying to access beyond buffer length")}function Z(d,w,E,b,D,T){if(!f.isBuffer(d))throw new TypeError('"buffer" argument must be a Buffer instance');if(w>D||w<T)throw new RangeError('"value" argument is out of bounds');if(E+b>d.length)throw new RangeError("Index out of range")}function ce(d,w,E,b){w<0&&(w=65535+w+1);for(var D=0,T=Math.min(d.length-E,2);D<T;++D)d[E+D]=(w&255<<8*(b?D:1-D))>>>8*(b?D:1-D)}function K(d,w,E,b){w<0&&(w=4294967295+w+1);for(var D=0,T=Math.min(d.length-E,4);D<T;++D)d[E+D]=w>>>8*(b?D:3-D)&255}function L(d,w,E,b,D,T){if(E+b>d.length)throw new RangeError("Index out of range");if(E<0)throw new RangeError("Index out of range")}function H(d,w,E,b,D){return D||L(d,0,E,4),i.write(d,w,E,b,23,4),E+4}function G(d,w,E,b,D){return D||L(d,0,E,8),i.write(d,w,E,b,52,8),E+8}f.prototype.slice=function(d,w){var E,b=this.length;if(d=~~d,w=w===void 0?b:~~w,d<0?(d+=b)<0&&(d=0):d>b&&(d=b),w<0?(w+=b)<0&&(w=0):w>b&&(w=b),w<d&&(w=d),f.TYPED_ARRAY_SUPPORT)(E=this.subarray(d,w)).__proto__=f.prototype;else{var D=w-d;E=new f(D,void 0);for(var T=0;T<D;++T)E[T]=this[T+d]}return E},f.prototype.readUIntLE=function(d,w,E){d|=0,w|=0,E||Q(d,w,this.length);for(var b=this[d],D=1,T=0;++T<w&&(D*=256);)b+=this[d+T]*D;return b},f.prototype.readUIntBE=function(d,w,E){d|=0,w|=0,E||Q(d,w,this.length);for(var b=this[d+--w],D=1;w>0&&(D*=256);)b+=this[d+--w]*D;return b},f.prototype.readUInt8=function(d,w){return w||Q(d,1,this.length),this[d]},f.prototype.readUInt16LE=function(d,w){return w||Q(d,2,this.length),this[d]|this[d+1]<<8},f.prototype.readUInt16BE=function(d,w){return w||Q(d,2,this.length),this[d]<<8|this[d+1]},f.prototype.readUInt32LE=function(d,w){return w||Q(d,4,this.length),(this[d]|this[d+1]<<8|this[d+2]<<16)+16777216*this[d+3]},f.prototype.readUInt32BE=function(d,w){return w||Q(d,4,this.length),16777216*this[d]+(this[d+1]<<16|this[d+2]<<8|this[d+3])},f.prototype.readIntLE=function(d,w,E){d|=0,w|=0,E||Q(d,w,this.length);for(var b=this[d],D=1,T=0;++T<w&&(D*=256);)b+=this[d+T]*D;return b>=(D*=128)&&(b-=Math.pow(2,8*w)),b},f.prototype.readIntBE=function(d,w,E){d|=0,w|=0,E||Q(d,w,this.length);for(var b=w,D=1,T=this[d+--b];b>0&&(D*=256);)T+=this[d+--b]*D;return T>=(D*=128)&&(T-=Math.pow(2,8*w)),T},f.prototype.readInt8=function(d,w){return w||Q(d,1,this.length),128&this[d]?-1*(255-this[d]+1):this[d]},f.prototype.readInt16LE=function(d,w){w||Q(d,2,this.length);var E=this[d]|this[d+1]<<8;return 32768&E?4294901760|E:E},f.prototype.readInt16BE=function(d,w){w||Q(d,2,this.length);var E=this[d+1]|this[d]<<8;return 32768&E?4294901760|E:E},f.prototype.readInt32LE=function(d,w){return w||Q(d,4,this.length),this[d]|this[d+1]<<8|this[d+2]<<16|this[d+3]<<24},f.prototype.readInt32BE=function(d,w){return w||Q(d,4,this.length),this[d]<<24|this[d+1]<<16|this[d+2]<<8|this[d+3]},f.prototype.readFloatLE=function(d,w){return w||Q(d,4,this.length),i.read(this,d,!0,23,4)},f.prototype.readFloatBE=function(d,w){return w||Q(d,4,this.length),i.read(this,d,!1,23,4)},f.prototype.readDoubleLE=function(d,w){return w||Q(d,8,this.length),i.read(this,d,!0,52,8)},f.prototype.readDoubleBE=function(d,w){return w||Q(d,8,this.length),i.read(this,d,!1,52,8)},f.prototype.writeUIntLE=function(d,w,E,b){d=+d,w|=0,E|=0,b||Z(this,d,w,E,Math.pow(2,8*E)-1,0);var D=1,T=0;for(this[w]=255&d;++T<E&&(D*=256);)this[w+T]=d/D&255;return w+E},f.prototype.writeUIntBE=function(d,w,E,b){d=+d,w|=0,E|=0,b||Z(this,d,w,E,Math.pow(2,8*E)-1,0);var D=E-1,T=1;for(this[w+D]=255&d;--D>=0&&(T*=256);)this[w+D]=d/T&255;return w+E},f.prototype.writeUInt8=function(d,w,E){return d=+d,w|=0,E||Z(this,d,w,1,255,0),f.TYPED_ARRAY_SUPPORT||(d=Math.floor(d)),this[w]=255&d,w+1},f.prototype.writeUInt16LE=function(d,w,E){return d=+d,w|=0,E||Z(this,d,w,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[w]=255&d,this[w+1]=d>>>8):ce(this,d,w,!0),w+2},f.prototype.writeUInt16BE=function(d,w,E){return d=+d,w|=0,E||Z(this,d,w,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[w]=d>>>8,this[w+1]=255&d):ce(this,d,w,!1),w+2},f.prototype.writeUInt32LE=function(d,w,E){return d=+d,w|=0,E||Z(this,d,w,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[w+3]=d>>>24,this[w+2]=d>>>16,this[w+1]=d>>>8,this[w]=255&d):K(this,d,w,!0),w+4},f.prototype.writeUInt32BE=function(d,w,E){return d=+d,w|=0,E||Z(this,d,w,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[w]=d>>>24,this[w+1]=d>>>16,this[w+2]=d>>>8,this[w+3]=255&d):K(this,d,w,!1),w+4},f.prototype.writeIntLE=function(d,w,E,b){if(d=+d,w|=0,!b){var D=Math.pow(2,8*E-1);Z(this,d,w,E,D-1,-D)}var T=0,ne=1,le=0;for(this[w]=255&d;++T<E&&(ne*=256);)d<0&&le===0&&this[w+T-1]!==0&&(le=1),this[w+T]=(d/ne>>0)-le&255;return w+E},f.prototype.writeIntBE=function(d,w,E,b){if(d=+d,w|=0,!b){var D=Math.pow(2,8*E-1);Z(this,d,w,E,D-1,-D)}var T=E-1,ne=1,le=0;for(this[w+T]=255&d;--T>=0&&(ne*=256);)d<0&&le===0&&this[w+T+1]!==0&&(le=1),this[w+T]=(d/ne>>0)-le&255;return w+E},f.prototype.writeInt8=function(d,w,E){return d=+d,w|=0,E||Z(this,d,w,1,127,-128),f.TYPED_ARRAY_SUPPORT||(d=Math.floor(d)),d<0&&(d=255+d+1),this[w]=255&d,w+1},f.prototype.writeInt16LE=function(d,w,E){return d=+d,w|=0,E||Z(this,d,w,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[w]=255&d,this[w+1]=d>>>8):ce(this,d,w,!0),w+2},f.prototype.writeInt16BE=function(d,w,E){return d=+d,w|=0,E||Z(this,d,w,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[w]=d>>>8,this[w+1]=255&d):ce(this,d,w,!1),w+2},f.prototype.writeInt32LE=function(d,w,E){return d=+d,w|=0,E||Z(this,d,w,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[w]=255&d,this[w+1]=d>>>8,this[w+2]=d>>>16,this[w+3]=d>>>24):K(this,d,w,!0),w+4},f.prototype.writeInt32BE=function(d,w,E){return d=+d,w|=0,E||Z(this,d,w,4,2147483647,-2147483648),d<0&&(d=4294967295+d+1),f.TYPED_ARRAY_SUPPORT?(this[w]=d>>>24,this[w+1]=d>>>16,this[w+2]=d>>>8,this[w+3]=255&d):K(this,d,w,!1),w+4},f.prototype.writeFloatLE=function(d,w,E){return H(this,d,w,!0,E)},f.prototype.writeFloatBE=function(d,w,E){return H(this,d,w,!1,E)},f.prototype.writeDoubleLE=function(d,w,E){return G(this,d,w,!0,E)},f.prototype.writeDoubleBE=function(d,w,E){return G(this,d,w,!1,E)},f.prototype.copy=function(d,w,E,b){if(E||(E=0),b||b===0||(b=this.length),w>=d.length&&(w=d.length),w||(w=0),b>0&&b<E&&(b=E),b===E||d.length===0||this.length===0)return 0;if(w<0)throw new RangeError("targetStart out of bounds");if(E<0||E>=this.length)throw new RangeError("sourceStart out of bounds");if(b<0)throw new RangeError("sourceEnd out of bounds");b>this.length&&(b=this.length),d.length-w<b-E&&(b=d.length-w+E);var D,T=b-E;if(this===d&&E<w&&w<b)for(D=T-1;D>=0;--D)d[D+w]=this[D+E];else if(T<1e3||!f.TYPED_ARRAY_SUPPORT)for(D=0;D<T;++D)d[D+w]=this[D+E];else Uint8Array.prototype.set.call(d,this.subarray(E,E+T),w);return T},f.prototype.fill=function(d,w,E,b){if(typeof d=="string"){if(typeof w=="string"?(b=w,w=0,E=this.length):typeof E=="string"&&(b=E,E=this.length),d.length===1){var D=d.charCodeAt(0);D<256&&(d=D)}if(b!==void 0&&typeof b!="string")throw new TypeError("encoding must be a string");if(typeof b=="string"&&!f.isEncoding(b))throw new TypeError("Unknown encoding: "+b)}else typeof d=="number"&&(d&=255);if(w<0||this.length<w||this.length<E)throw new RangeError("Out of range index");if(E<=w)return this;var T;if(w>>>=0,E=E===void 0?this.length:E>>>0,d||(d=0),typeof d=="number")for(T=w;T<E;++T)this[T]=d;else{var ne=f.isBuffer(d)?d:re(new f(d,b).toString()),le=ne.length;for(T=0;T<E-w;++T)this[T+w]=ne[T%le]}return this};var B=/[^+\/0-9A-Za-z-_]/g;function Y(d){return d<16?"0"+d.toString(16):d.toString(16)}function re(d,w){var E;w=w||1/0;for(var b=d.length,D=null,T=[],ne=0;ne<b;++ne){if((E=d.charCodeAt(ne))>55295&&E<57344){if(!D){if(E>56319){(w-=3)>-1&&T.push(239,191,189);continue}if(ne+1===b){(w-=3)>-1&&T.push(239,191,189);continue}D=E;continue}if(E<56320){(w-=3)>-1&&T.push(239,191,189),D=E;continue}E=65536+(D-55296<<10|E-56320)}else D&&(w-=3)>-1&&T.push(239,191,189);if(D=null,E<128){if((w-=1)<0)break;T.push(E)}else if(E<2048){if((w-=2)<0)break;T.push(E>>6|192,63&E|128)}else if(E<65536){if((w-=3)<0)break;T.push(E>>12|224,E>>6&63|128,63&E|128)}else{if(!(E<1114112))throw new Error("Invalid code point");if((w-=4)<0)break;T.push(E>>18|240,E>>12&63|128,E>>6&63|128,63&E|128)}}return T}function ee(d){return a.toByteArray((function(w){if((w=(function(E){return E.trim?E.trim():E.replace(/^\s+|\s+$/g,"")})(w).replace(B,"")).length<2)return"";for(;w.length%4!=0;)w+="=";return w})(d))}function ue(d,w,E,b){for(var D=0;D<b&&!(D+E>=w.length||D>=d.length);++D)w[D+E]=d[D];return D}}).call(this,r(0))},function(e,t){var r,n,a=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(h){if(r===setTimeout)return setTimeout(h,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(h,0);try{return r(h,0)}catch{try{return r.call(null,h,0)}catch{return r.call(this,h,0)}}}(function(){try{r=typeof setTimeout=="function"?setTimeout:i}catch{r=i}try{n=typeof clearTimeout=="function"?clearTimeout:o}catch{n=o}})();var c,f=[],l=!1,_=-1;function v(){l&&c&&(l=!1,c.length?f=c.concat(f):_=-1,f.length&&x())}function x(){if(!l){var h=s(v);l=!0;for(var u=f.length;u;){for(c=f,f=[];++_<u;)c&&c[_].run();_=-1,u=f.length}c=null,l=!1,(function(y){if(n===clearTimeout)return clearTimeout(y);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(y);try{n(y)}catch{try{return n.call(null,y)}catch{return n.call(this,y)}}})(h)}}function p(h,u){this.fun=h,this.array=u}function m(){}a.nextTick=function(h){var u=new Array(arguments.length-1);if(arguments.length>1)for(var y=1;y<arguments.length;y++)u[y-1]=arguments[y];f.push(new p(h,u)),f.length!==1||l||s(x)},p.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=m,a.addListener=m,a.once=m,a.off=m,a.removeListener=m,a.removeAllListeners=m,a.emit=m,a.prependListener=m,a.prependOnceListener=m,a.listeners=function(h){return[]},a.binding=function(h){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(h){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},function(e,t,r){(function(n){function a(i){return Object.prototype.toString.call(i)}t.isArray=function(i){return Array.isArray?Array.isArray(i):a(i)==="[object Array]"},t.isBoolean=function(i){return typeof i=="boolean"},t.isNull=function(i){return i===null},t.isNullOrUndefined=function(i){return i==null},t.isNumber=function(i){return typeof i=="number"},t.isString=function(i){return typeof i=="string"},t.isSymbol=function(i){return typeof i=="symbol"},t.isUndefined=function(i){return i===void 0},t.isRegExp=function(i){return a(i)==="[object RegExp]"},t.isObject=function(i){return typeof i=="object"&&i!==null},t.isDate=function(i){return a(i)==="[object Date]"},t.isError=function(i){return a(i)==="[object Error]"||i instanceof Error},t.isFunction=function(i){return typeof i=="function"},t.isPrimitive=function(i){return i===null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||typeof i=="symbol"||i===void 0},t.isBuffer=n.isBuffer}).call(this,r(3).Buffer)},function(e,t,r){"use strict";(function(n){!n.version||n.version.indexOf("v0.")===0||n.version.indexOf("v1.")===0&&n.version.indexOf("v1.8.")!==0?e.exports={nextTick:function(a,i,o,s){if(typeof a!="function")throw new TypeError('"callback" argument must be a function');var c,f,l=arguments.length;switch(l){case 0:case 1:return n.nextTick(a);case 2:return n.nextTick(function(){a.call(null,i)});case 3:return n.nextTick(function(){a.call(null,i,o)});case 4:return n.nextTick(function(){a.call(null,i,o,s)});default:for(c=new Array(l-1),f=0;f<c.length;)c[f++]=arguments[f];return n.nextTick(function(){a.apply(null,c)})}}}:e.exports=n}).call(this,r(4))},function(e,t,r){var n=r(3),a=n.Buffer;function i(s,c){for(var f in s)c[f]=s[f]}function o(s,c,f){return a(s,c,f)}a.from&&a.alloc&&a.allocUnsafe&&a.allocUnsafeSlow?e.exports=n:(i(n,t),t.Buffer=o),i(a,o),o.from=function(s,c,f){if(typeof s=="number")throw new TypeError("Argument must not be a number");return a(s,c,f)},o.alloc=function(s,c,f){if(typeof s!="number")throw new TypeError("Argument must be a number");var l=a(s);return c!==void 0?typeof f=="string"?l.fill(c,f):l.fill(c):l.fill(0),l},o.allocUnsafe=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return a(s)},o.allocUnsafeSlow=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return n.SlowBuffer(s)}},function(e,t,r){var n=r(17)(Object,"create");e.exports=n},function(e,t,r){var n=r(31);e.exports=function(a,i){for(var o=a.length;o--;)if(n(a[o][0],i))return o;return-1}},function(e,t,r){var n=r(96);e.exports=function(a,i){var o=a.__data__;return n(i)?o[typeof i=="string"?"string":"hash"]:o.map}},function(e,t,r){(function(n){var a=n!==void 0&&n||typeof self<"u"&&self||window,i=Function.prototype.apply;function o(s,c){this._id=s,this._clearFn=c}t.setTimeout=function(){return new o(i.call(setTimeout,a,arguments),clearTimeout)},t.setInterval=function(){return new o(i.call(setInterval,a,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(s){s&&s.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(a,this._id)},t.enroll=function(s,c){clearTimeout(s._idleTimeoutId),s._idleTimeout=c},t.unenroll=function(s){clearTimeout(s._idleTimeoutId),s._idleTimeout=-1},t._unrefActive=t.active=function(s){clearTimeout(s._idleTimeoutId);var c=s._idleTimeout;c>=0&&(s._idleTimeoutId=setTimeout(function(){s._onTimeout&&s._onTimeout()},c))},r(35),t.setImmediate=typeof self<"u"&&self.setImmediate||n!==void 0&&n.setImmediate||this&&this.setImmediate,t.clearImmediate=typeof self<"u"&&self.clearImmediate||n!==void 0&&n.clearImmediate||this&&this.clearImmediate}).call(this,r(0))},function(e,t){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(o){return typeof o=="function"}function a(o){return typeof o=="object"&&o!==null}function i(o){return o===void 0}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(o){if(!(function(s){return typeof s=="number"})(o)||o<0||isNaN(o))throw TypeError("n must be a positive number");return this._maxListeners=o,this},r.prototype.emit=function(o){var s,c,f,l,_,v;if(this._events||(this._events={}),o==="error"&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if((s=arguments[1])instanceof Error)throw s;var x=new Error('Uncaught, unspecified "error" event. ('+s+")");throw x.context=s,x}if(i(c=this._events[o]))return!1;if(n(c))switch(arguments.length){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:l=Array.prototype.slice.call(arguments,1),c.apply(this,l)}else if(a(c))for(l=Array.prototype.slice.call(arguments,1),f=(v=c.slice()).length,_=0;_<f;_++)v[_].apply(this,l);return!0},r.prototype.addListener=function(o,s){var c;if(!n(s))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",o,n(s.listener)?s.listener:s),this._events[o]?a(this._events[o])?this._events[o].push(s):this._events[o]=[this._events[o],s]:this._events[o]=s,a(this._events[o])&&!this._events[o].warned&&(c=i(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&c>0&&this._events[o].length>c&&(this._events[o].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[o].length),typeof console.trace=="function"&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(o,s){if(!n(s))throw TypeError("listener must be a function");var c=!1;function f(){this.removeListener(o,f),c||(c=!0,s.apply(this,arguments))}return f.listener=s,this.on(o,f),this},r.prototype.removeListener=function(o,s){var c,f,l,_;if(!n(s))throw TypeError("listener must be a function");if(!this._events||!this._events[o])return this;if(l=(c=this._events[o]).length,f=-1,c===s||n(c.listener)&&c.listener===s)delete this._events[o],this._events.removeListener&&this.emit("removeListener",o,s);else if(a(c)){for(_=l;_-- >0;)if(c[_]===s||c[_].listener&&c[_].listener===s){f=_;break}if(f<0)return this;c.length===1?(c.length=0,delete this._events[o]):c.splice(f,1),this._events.removeListener&&this.emit("removeListener",o,s)}return this},r.prototype.removeAllListeners=function(o){var s,c;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[o]&&delete this._events[o],this;if(arguments.length===0){for(s in this._events)s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events={},this}if(n(c=this._events[o]))this.removeListener(o,c);else if(c)for(;c.length;)this.removeListener(o,c[c.length-1]);return delete this._events[o],this},r.prototype.listeners=function(o){return this._events&&this._events[o]?n(this._events[o])?[this._events[o]]:this._events[o].slice():[]},r.prototype.listenerCount=function(o){if(this._events){var s=this._events[o];if(n(s))return 1;if(s)return s.length}return 0},r.listenerCount=function(o,s){return o.listenerCount(s)}},function(e,t,r){(t=e.exports=r(23)).Stream=t,t.Readable=t,t.Writable=r(14),t.Duplex=r(1),t.Transform=r(27),t.PassThrough=r(45)},function(e,t,r){"use strict";(function(n,a,i){var o=r(6);function s(F){var N=this;this.next=null,this.entry=null,this.finish=function(){(function(I,X,z){var q=I.entry;for(I.entry=null;q;){var Q=q.callback;X.pendingcb--,Q(void 0),q=q.next}X.corkedRequestsFree?X.corkedRequestsFree.next=I:X.corkedRequestsFree=I})(N,F)}}e.exports=g;var c,f=!n.browser&&["v0.10","v0.9."].indexOf(n.version.slice(0,5))>-1?a:o.nextTick;g.WritableState=y;var l=r(5);l.inherits=r(2);var _,v={deprecate:r(44)},x=r(24),p=r(7).Buffer,m=i.Uint8Array||function(){},h=r(25);function u(){}function y(F,N){c=c||r(1),F=F||{};var I=N instanceof c;this.objectMode=!!F.objectMode,I&&(this.objectMode=this.objectMode||!!F.writableObjectMode);var X=F.highWaterMark,z=F.writableHighWaterMark,q=this.objectMode?16:16384;this.highWaterMark=X||X===0?X:I&&(z||z===0)?z:q,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Q=F.decodeStrings===!1;this.decodeStrings=!Q,this.defaultEncoding=F.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Z){(function(ce,K){var L=ce._writableState,H=L.sync,G=L.writecb;if((function(Y){Y.writing=!1,Y.writecb=null,Y.length-=Y.writelen,Y.writelen=0})(L),K)(function(Y,re,ee,ue,d){--re.pendingcb,ee?(o.nextTick(d,ue),o.nextTick(R,Y,re),Y._writableState.errorEmitted=!0,Y.emit("error",ue)):(d(ue),Y._writableState.errorEmitted=!0,Y.emit("error",ue),R(Y,re))})(ce,L,H,K,G);else{var B=S(L);B||L.corked||L.bufferProcessing||!L.bufferedRequest||C(ce,L),H?f(P,ce,L,B,G):P(ce,L,B,G)}})(N,Z)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function g(F){if(c=c||r(1),!(_.call(g,this)||this instanceof c))return new g(F);this._writableState=new y(F,this),this.writable=!0,F&&(typeof F.write=="function"&&(this._write=F.write),typeof F.writev=="function"&&(this._writev=F.writev),typeof F.destroy=="function"&&(this._destroy=F.destroy),typeof F.final=="function"&&(this._final=F.final)),x.call(this)}function k(F,N,I,X,z,q,Q){N.writelen=X,N.writecb=Q,N.writing=!0,N.sync=!0,I?F._writev(z,N.onwrite):F._write(z,q,N.onwrite),N.sync=!1}function P(F,N,I,X){I||(function(z,q){q.length===0&&q.needDrain&&(q.needDrain=!1,z.emit("drain"))})(F,N),N.pendingcb--,X(),R(F,N)}function C(F,N){N.bufferProcessing=!0;var I=N.bufferedRequest;if(F._writev&&I&&I.next){var X=N.bufferedRequestCount,z=new Array(X),q=N.corkedRequestsFree;q.entry=I;for(var Q=0,Z=!0;I;)z[Q]=I,I.isBuf||(Z=!1),I=I.next,Q+=1;z.allBuffers=Z,k(F,N,!0,N.length,z,"",q.finish),N.pendingcb++,N.lastBufferedRequest=null,q.next?(N.corkedRequestsFree=q.next,q.next=null):N.corkedRequestsFree=new s(N),N.bufferedRequestCount=0}else{for(;I;){var ce=I.chunk,K=I.encoding,L=I.callback;if(k(F,N,!1,N.objectMode?1:ce.length,ce,K,L),I=I.next,N.bufferedRequestCount--,N.writing)break}I===null&&(N.lastBufferedRequest=null)}N.bufferedRequest=I,N.bufferProcessing=!1}function S(F){return F.ending&&F.length===0&&F.bufferedRequest===null&&!F.finished&&!F.writing}function A(F,N){F._final(function(I){N.pendingcb--,I&&F.emit("error",I),N.prefinished=!0,F.emit("prefinish"),R(F,N)})}function R(F,N){var I=S(N);return I&&((function(X,z){z.prefinished||z.finalCalled||(typeof X._final=="function"?(z.pendingcb++,z.finalCalled=!0,o.nextTick(A,X,z)):(z.prefinished=!0,X.emit("prefinish")))})(F,N),N.pendingcb===0&&(N.finished=!0,F.emit("finish"))),I}l.inherits(g,x),y.prototype.getBuffer=function(){for(var F=this.bufferedRequest,N=[];F;)N.push(F),F=F.next;return N},(function(){try{Object.defineProperty(y.prototype,"buffer",{get:v.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})(),typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(_=Function.prototype[Symbol.hasInstance],Object.defineProperty(g,Symbol.hasInstance,{value:function(F){return!!_.call(this,F)||this===g&&F&&F._writableState instanceof y}})):_=function(F){return F instanceof this},g.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},g.prototype.write=function(F,N,I){var X=this._writableState,z=!1,q=!X.objectMode&&(function(Q){return p.isBuffer(Q)||Q instanceof m})(F);return q&&!p.isBuffer(F)&&(F=(function(Q){return p.from(Q)})(F)),typeof N=="function"&&(I=N,N=null),q?N="buffer":N||(N=X.defaultEncoding),typeof I!="function"&&(I=u),X.ended?(function(Q,Z){var ce=new Error("write after end");Q.emit("error",ce),o.nextTick(Z,ce)})(this,I):(q||(function(Q,Z,ce,K){var L=!0,H=!1;return ce===null?H=new TypeError("May not write null values to stream"):typeof ce=="string"||ce===void 0||Z.objectMode||(H=new TypeError("Invalid non-string/buffer chunk")),H&&(Q.emit("error",H),o.nextTick(K,H),L=!1),L})(this,X,F,I))&&(X.pendingcb++,z=(function(Q,Z,ce,K,L,H){if(!ce){var G=(function(ee,ue,d){return ee.objectMode||ee.decodeStrings===!1||typeof ue!="string"||(ue=p.from(ue,d)),ue})(Z,K,L);K!==G&&(ce=!0,L="buffer",K=G)}var B=Z.objectMode?1:K.length;Z.length+=B;var Y=Z.length<Z.highWaterMark;if(Y||(Z.needDrain=!0),Z.writing||Z.corked){var re=Z.lastBufferedRequest;Z.lastBufferedRequest={chunk:K,encoding:L,isBuf:ce,callback:H,next:null},re?re.next=Z.lastBufferedRequest:Z.bufferedRequest=Z.lastBufferedRequest,Z.bufferedRequestCount+=1}else k(Q,Z,!1,B,K,L,H);return Y})(this,X,q,F,N,I)),z},g.prototype.cork=function(){this._writableState.corked++},g.prototype.uncork=function(){var F=this._writableState;F.corked&&(F.corked--,F.writing||F.corked||F.finished||F.bufferProcessing||!F.bufferedRequest||C(this,F))},g.prototype.setDefaultEncoding=function(F){if(typeof F=="string"&&(F=F.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((F+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+F);return this._writableState.defaultEncoding=F,this},Object.defineProperty(g.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),g.prototype._write=function(F,N,I){I(new Error("_write() is not implemented"))},g.prototype._writev=null,g.prototype.end=function(F,N,I){var X=this._writableState;typeof F=="function"?(I=F,F=null,N=null):typeof N=="function"&&(I=N,N=null),F!=null&&this.write(F,N),X.corked&&(X.corked=1,this.uncork()),X.ending||X.finished||(function(z,q,Q){q.ending=!0,R(z,q),Q&&(q.finished?o.nextTick(Q):z.once("finish",Q)),q.ended=!0,z.writable=!1})(this,X,I)},Object.defineProperty(g.prototype,"destroyed",{get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(F){this._writableState&&(this._writableState.destroyed=F)}}),g.prototype.destroy=h.destroy,g.prototype._undestroy=h.undestroy,g.prototype._destroy=function(F,N){this.end(),N(F)}}).call(this,r(4),r(11).setImmediate,r(0))},function(e,t,r){(function(n,a,i){e.exports=(function o(s,c,f){function l(x,p){if(!c[x]){if(!s[x]){var m=typeof _dereq_=="function"&&_dereq_;if(!p&&m)return m(x,!0);if(_)return _(x,!0);var h=new Error("Cannot find module '"+x+"'");throw h.code="MODULE_NOT_FOUND",h}var u=c[x]={exports:{}};s[x][0].call(u.exports,function(y){return l(s[x][1][y]||y)},u,u.exports,o,s,c,f)}return c[x].exports}for(var _=typeof _dereq_=="function"&&_dereq_,v=0;v<f.length;v++)l(f[v]);return l})({1:[function(o,s,c){"use strict";s.exports=function(f){var l=f._SomePromiseArray;function _(v){var x=new l(v),p=x.promise();return x.setHowMany(1),x.setUnwrap(),x.init(),p}f.any=function(v){return _(v)},f.prototype.any=function(){return _(this)}}},{}],2:[function(o,s,c){"use strict";var f;try{throw new Error}catch(u){f=u}var l=o("./schedule"),_=o("./queue"),v=o("./util");function x(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new _(16),this._normalQueue=new _(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var u=this;this.drainQueues=function(){u._drainQueues()},this._schedule=l}function p(u,y,g){this._lateQueue.push(u,y,g),this._queueTick()}function m(u,y,g){this._normalQueue.push(u,y,g),this._queueTick()}function h(u){this._normalQueue._pushOne(u),this._queueTick()}x.prototype.setScheduler=function(u){var y=this._schedule;return this._schedule=u,this._customScheduler=!0,y},x.prototype.hasCustomScheduler=function(){return this._customScheduler},x.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},x.prototype.disableTrampolineIfNecessary=function(){v.hasDevTools&&(this._trampolineEnabled=!1)},x.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},x.prototype.fatalError=function(u,y){y?(n.stderr.write("Fatal "+(u instanceof Error?u.stack:u)+`
|
|
2
2
|
`),n.exit(2)):this.throwLater(u)},x.prototype.throwLater=function(u,y){if(arguments.length===1&&(y=u,u=function(){throw y}),typeof setTimeout<"u")setTimeout(function(){u(y)},0);else try{this._schedule(function(){u(y)})}catch{throw new Error(`No async scheduler available
|
|
3
3
|
|
|
4
4
|
See http://goo.gl/MqrFmX
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as F}from"./chunk-AQ2NVI46.js";import{e as O,f as c,r as w,s as M}from"./chunk-ME2M2B24.js";import{isEmpty as k,uniq as W}from"lodash";var A=0,y=class{constructor({sheet:e,columnKey:t,rows:s,id:o,notSetUnique:a=!1,label:r,refJoinSheetColum:n}){this.removed=!1;this.label="";this.parsedDate=!1;this.getColumnKey=()=>this.columnKey;this.getId=()=>this.id;this.getSheet=()=>this.sheet;this.getRows=()=>this.rows;this.getUniqueRows=()=>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.getRefJoinSheetColum=()=>this.refJoinSheetColum;this.columnKey=t.trim(),this.sheet=e,this.rows=k(s)?[""]:s,typeof o>"u"?(A++,this.id=`${t}-${A}`):this.id=o,a?this.uniques=[]:this.uniques=W(this.getRows()),r&&(this.label=r),this.refJoinSheetColum=n}setRows(e){this.rows=e}setParsedDate(e){this.parsedDate=e}hasParsedDate(){return this.parsedDate}},g=y;var D=class extends g{constructor({sheet:t,sheetColumns:s,rows:o,id:a,columnKey:r}){super({columnKey:r,rows:o,sheet:t,id:a});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}},J=D;var T=["?",",","@"];import{isNaN as X,minBy as G,isString as Q,isEqual as Y,isEmpty as b,isNil as K}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(a=>{a.setSpreadSheet(this)})}setNumberFormat(e){this.globalNumberFormat=e.global,this.columnsNumberFormat=e.columns}getNumberFormat(){return{global:this.globalNumberFormat,columns:this.columnsNumberFormat}}},_=x;var B=0,R=class{constructor({data:e,name:t,isNotSetColumn:s,id:o}){this.selected=!1;this.isManualSelectHeader=!1;this.columns=[];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 _({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.setColumns(),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 a=this.addedColumns[o];if(a?.sourceCell){let r=`${a.sourceCell.row},${a.sourceCell.col}`;this.usedSourceCells.delete(r)}for(let r=0;r<this.data.length;r++)this.data[r].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 a=0;a<this.data.length;a++)this.data[a].length>o&&this.data[a].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.getDataTransform=()=>this.data.map((e,t)=>({data:e,index:t,length:e.filter(s=>s).length}));this.getMaxLengthColumns=()=>this.getDataTransform().reduce((s,o)=>Math.max(s,o.data?.filter(a=>!b(a)&&!T.some(r=>r===a.toString()?.trim()&&a.toString()?.startsWith(r))).length),0);this.setHeaderByAutoDetection=()=>{let e=this.getMaxLengthColumns(),t=this.getDataTransform(),s=[];for(let a=0;a<(t.length>50?50:t.length);a++){let r=t[a],n=r.length===e;r.data.filter(h=>!O.includes(Q(h)?h.toLowerCase():h)&&X(Number(h))).length===e&&n&&s.push(r)}let o=s.length===1?s[0].index:G(s,a=>a.length)?.index??0;this.setHeaderRowIndex(o)};this.getHeaderRowIndex=()=>this.headerRowIndex;this.getHeaderRow=()=>this.data[this.headerRowIndex]?.filter(e=>!!e);this.getColumns=()=>this.columns.filter(e=>!e.isRemoved());this.getSortedColumns=()=>[...this.getColumns()].sort((e,t)=>c(e.getColumnKey())<c(t.getColumnKey())?-1:c(e.getColumnKey())>c(t.getColumnKey())?1:0);this.getColumnsWithRemoved=()=>this.columns.filter(e=>e.getType()!==1);this.getColumn=(e,t)=>this.columns.find(s=>t?c(s.getColumnKey())===c(`${e}`):s.getColumnKey()===e);this.getColumnsByKey=(e,t)=>this.columns.filter(s=>t?c(s.getColumnKey())===c(`${e}`):s.getColumnKey()===e);this.getValues=()=>{let e=this.data.filter((s,o)=>o>this.headerRowIndex);if(b(e))return[[]];let t=[];for(let s=0;s<e.length;s++){let o=[];for(let a=0;a<this.data[this.headerRowIndex].length;a++)K(this.data[this.headerRowIndex][a])||o.push(this.parseValue(e[s][a]));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.getDataAsResults=()=>{let e=[],t=this.getColumnsWithRemoved(),s=this.data.filter((o,a)=>a>this.headerRowIndex);for(let o=0;o<s.length;o++){let a=s[o];e[o]={};for(let r=0;r<t.length;r++){let n=a?.[r];if(!b(n)&&!K(n)){let i=t[r].getColumnKey();e[o][i]=this.parseValue(n)}}}return e};this.addColumn=e=>{this.columns.push(new g({columnKey:`${e}`,sheet:this,rows:this.getRowsByColumnIndex(this.getColumnIndex(e))}))};this.removeColumn=e=>{this.columns.find(t=>t.getColumnKey()===e)?.remove()};this.removeColumnByIndex=e=>{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 a=o[e]??"";t.push(this.parseValue(a))}}return t};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 g({columnKey:`${o}`,sheet:this,rows:this.getRowsByColumnIndex(s)}))}this.columns=t}else this.columns=[]};this.getColumnIndex=e=>this.data[this.headerRowIndex].findIndex(o=>Y(`${o}`,`${e}`));this.parseValue=e=>typeof e=="string"?e.trim():e;this.data=e,this.name=t,typeof o>"u"?(B++,this.id=`${t}-${B}`):this.id=o,s||this.setColumns(),this.modifiedData=this.getDataAsResults()}getModifiedData(){return this.modifiedData}mergedModifiedData(e){let t=[],s=this.getColumns();for(let o=0;o<s.length;o++){let a=s[o],r=[];if(!a.isRemoved()){for(let n=0;n<e.length;n++){t[n]||(t[n]=[]);let i=e[n][o];t[n][o]=i,r[n]=i}a.setRows(r)}}this.setData(t)}},P=R;var N=class extends P{constructor({joinedData:t,sheets:s,mappings:o,mappingIndexes:a}){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 a=t-s.getColumns().length;return o.getColumns().filter((r,n)=>this.joinHistory[this.joinHistory.length-1].mappingIndexes.every(i=>i.target!==n))[a]};this.setJoinColumns=(t,s)=>{let o=this.data[this.headerRowIndex];if(!o){this.columns=[];return}let a=[];for(let r=0;r<o.length;++r){let n=o[r],i=s.findIndex(u=>u.source===r),h=this.columns[r]&&this.columns[r].getType()===1;if(i>=0||h){let u=t[i],d;h&&i>=0?d=[...this.columns[r].getJoinedSheetColumns(),u.target]:h?d=this.columns[r].getJoinedSheetColumns():d=[u.source.getRefJoinSheetColum()??u.source,u.target],a.push(new J({columnKey:`${n}`,sheetColumns:d,sheet:this,rows:this.getRowsByColumnIndex(r)}))}else{let u=this.columns[r]?this.columns[r].getRefJoinSheetColum()??this.columns[r]:this.findRefJoinSheetColumn(r);a.push(new g({columnKey:`${n}`,sheet:u.getSheet(),rows:this.getRowsByColumnIndex(r),refJoinSheetColum:u}))}}this.columns=a};this.getJoinedSheets=()=>this.sheets;this.getType=()=>1;this.joinSheet=(t,s,o,a)=>{this.setData(t.data),this.sheets.push(s),this.joinHistory.push({mappingIndexes:a,type:t.type,row:t.data.length,col:this.data[this.headerRowIndex]?.length??0}),this.setJoinColumns(o,a)};this.getJoinColumns=()=>this.columns.filter(t=>t.getType()===1);this.getJoinHistory=()=>this.joinHistory;this.headerRowIndex=0,this.joinHistory.push({mappingIndexes:a,type:t.type,row:t.data.length,col:this.data[this.headerRowIndex]?.length??0}),this.sheets=s,this.setJoinColumns(o,a)}},Re=N;var L=({rowA:l,rowB:e},t)=>t.every(s=>{let o=`${l[s.source]??""}`,a=`${e[s.target]??""}`;return o===a&&o!==""&&a!==""}),Z=(l,e,t)=>{let s=[],o=l.headerRow,a=e.headerRow;for(let r=0;r<o.length;++r)s.push(o[r]);for(let r=0;r<a.length;++r)t.every(n=>n.target!==r)&&s.push(a[r]);return s},Fe=async(l,e)=>{let t=l.values,s=e.values,o=l.headerRow,a=e.headerRow,r=[...o,...a],n=[];n.push(r);for(let i=0;i<t.length;++i)n.push([...t[i],...s[0]]);return{data:n,type:"ADD_TO_ALL_ROWS"}},Ae=async(l,e)=>{let t=l.values,s=e.values,o=l.headerRow,a=e.headerRow,r=[...o,...a],n=[];n.push(r);for(let i=0;i<t.length;++i)n.push([...t[i],...a.map(()=>"")]);for(let i=0;i<s.length;++i)n.push([...o.map(()=>""),...s[i]]);return{data:n,type:"JOIN_WITHOUT_COLUMNS"}},Je=async(l,e,t)=>{let s=l.values,o=e.values,a=[],r=[],n={},i=Z(l,e,t);a.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 p=o[m];L({rowA:d,rowB:p},t)&&(n[m]=!0,u=!0,a.push([...d,...p.filter((C,E)=>t.every(U=>U.target!==E))]))}u||r.push([...d,...e.headerRow.filter((m,p)=>t.every(C=>C.target!==p)).map(()=>"")])}for(let h=0;h<o.length;++h){if(n[h])continue;let u=o[h],d=l.headerRow.map(()=>"");t.forEach(m=>{d[m.source]=u[m.target]}),r.push([...d,...u.filter((m,p)=>t.every(C=>C.target!==p))])}return r.forEach(h=>{a.push(h)}),{data:a,type:"JOIN_ON_COLUMNS"}},Te=async(l,e,t)=>{let s=e.headerRow.filter((n,i)=>t.every(h=>h.target!==i)),a=[[...l.headerRow,...s]];for(let n=0;n<l.values.length;++n){let i=[...l.values[n],...s.map(()=>"")];a.push(i)}let r=e.values;for(let n=0;n<r.length;++n){let i=l.headerRow.map(()=>""),h=[];for(let u=0;u<e.headerRow.length;++u){let d=t.find(m=>m.target===u);d?i[d.source]=r[n][u]:h.push(r[n][u])}a.push([...i,...h])}return{data:a,type:"APPEND_TO_COLUMNS"}},He=async(l,e,t)=>{let s=l.values,o=e.values,a=s.length+o.length,r=0,n={};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 p=o[m];if(L({rowA:h,rowB:p},t)&&(u=m,d++,d===2))break}d===1&&u!==null&&(r+=1,n[u]=!0)}for(let i=0;i<o.length;i++)n[i]&&(r+=1);return{count:r,total:a}};var v=class{constructor({sheetColumn:e,matchedDataModel:t,detectedNumberFormats:s}){this.getOptionValue=(e,t)=>{if(!t)if(this.matchedDataModel.dataModel){let s=this.sheetColumn.columnKey,a=this.detectedNumberFormats.columns.find(r=>r.column===s)?.numberFormat||this.detectedNumberFormats.global;return M.parse(e,{dataModel:this.matchedDataModel.dataModel,isParseFromSheet:!0,numberFormat:a})}else return e;for(let s=0;s<t.length;s++)if(`${t[s]?.sheetOption}`==`${e}`)return this.matchedDataModel.dataModel&&this.matchedDataModel.dataModel.getIsMultiSelection()?M.parse(t[s]?.dataModelOptions,{dataModel:this.matchedDataModel.dataModel,isParseFromSheet:!0}):this.matchedDataModel.dataModel?M.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];t.push(this.getOptionValue(o,this.matchedOptions))}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++)this.matchedDataModel.dataModel?.getIsMultiSelection()?this.matchedDataModel.matchedOptions?.[o].dataModelOptions&&this.matchedOptions.push(this.matchedDataModel.matchedOptions?.[o]):this.matchedDataModel.matchedOptions?.[o].dataModelOption!==void 0&&this.matchedDataModel.matchedOptions?.[o].dataModelOption!==null&&this.matchedOptions.push(this.matchedDataModel.matchedOptions?.[o])}}},z=v;var V=class{constructor(e){this.matchedColumns=[];this.parseValues=()=>{let e=[];this.matchedColumns.forEach(t=>{let s=t.matchedDataModel,a=new z({sheetColumn:t.sheetColumn,matchedDataModel:s,detectedNumberFormats:this.detectedNumberFormats}).getValues(),r=s.dataModel.getKey();a.forEach((n,i)=>{e[i]?e[i][r]=n:e[i]={[r]:n}})});for(let t=0;t<e.length;++t)for(let s=0;s<this.columns.length;++s){let a=this.columns[s].key;e[t][a]===void 0&&(e[t][a]=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??[]}},$=V;var We=({matching:l,detectedNumberFormats:e,columns:t})=>new $({matching:l,detectedNumberFormats:e,columns:t}).getValues();import*as j from"comlink";var f=class{static{this.serialize=e=>e.serialize()}static{this.deSerialize=e=>w.isTypeCategory(e.type)?new F({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||!1,hidden:e.hidden,disabled:e.disabled,optionMappingConfiguration:e.optionMappingConfiguration}):new w({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,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?f.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?f.deSerialize(t.matchedDataModel.dataModel):t.matchedDataModel.dataModel,matchedOptions:t.matchedDataModel.matchedOptions}:t.matchedDataModel})),detectedNumberFormats:e.detectedNumberFormats,columns:e.columns})}};j.transferHandlers.set("Matching",{canHandle:l=>!!(typeof l=="object"&&l.matching),serialize:l=>S.serialize(l),deserialize:l=>S.deserialize(l)});export{g as a,_ as b,P as c,Re as d,Fe as e,Ae as f,Je as g,Te as h,He as i,We as j,f as k};
|
|
1
|
+
import{a as F}from"./chunk-AINUNGZU.js";import{e as O,f as c,r as w,s as M}from"./chunk-CQHSLEFA.js";import{isEmpty as k,uniq as W}from"lodash";var A=0,y=class{constructor({sheet:e,columnKey:t,rows:s,id:o,notSetUnique:a=!1,label:r,refJoinSheetColum:n}){this.removed=!1;this.label="";this.parsedDate=!1;this.getColumnKey=()=>this.columnKey;this.getId=()=>this.id;this.getSheet=()=>this.sheet;this.getRows=()=>this.rows;this.getUniqueRows=()=>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.getRefJoinSheetColum=()=>this.refJoinSheetColum;this.columnKey=t.trim(),this.sheet=e,this.rows=k(s)?[""]:s,typeof o>"u"?(A++,this.id=`${t}-${A}`):this.id=o,a?this.uniques=[]:this.uniques=W(this.getRows()),r&&(this.label=r),this.refJoinSheetColum=n}setRows(e){this.rows=e}setParsedDate(e){this.parsedDate=e}hasParsedDate(){return this.parsedDate}},g=y;var D=class extends g{constructor({sheet:t,sheetColumns:s,rows:o,id:a,columnKey:r}){super({columnKey:r,rows:o,sheet:t,id:a});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}},J=D;var T=["?",",","@"];import{isNaN as X,minBy as G,isString as Q,isEqual as Y,isEmpty as b,isNil as K}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(a=>{a.setSpreadSheet(this)})}setNumberFormat(e){this.globalNumberFormat=e.global,this.columnsNumberFormat=e.columns}getNumberFormat(){return{global:this.globalNumberFormat,columns:this.columnsNumberFormat}}},_=x;var B=0,R=class{constructor({data:e,name:t,isNotSetColumn:s,id:o}){this.selected=!1;this.isManualSelectHeader=!1;this.columns=[];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 _({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.setColumns(),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 a=this.addedColumns[o];if(a?.sourceCell){let r=`${a.sourceCell.row},${a.sourceCell.col}`;this.usedSourceCells.delete(r)}for(let r=0;r<this.data.length;r++)this.data[r].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 a=0;a<this.data.length;a++)this.data[a].length>o&&this.data[a].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.getDataTransform=()=>this.data.map((e,t)=>({data:e,index:t,length:e.filter(s=>s).length}));this.getMaxLengthColumns=()=>this.getDataTransform().reduce((s,o)=>Math.max(s,o.data?.filter(a=>!b(a)&&!T.some(r=>r===a.toString()?.trim()&&a.toString()?.startsWith(r))).length),0);this.setHeaderByAutoDetection=()=>{let e=this.getMaxLengthColumns(),t=this.getDataTransform(),s=[];for(let a=0;a<(t.length>50?50:t.length);a++){let r=t[a],n=r.length===e;r.data.filter(h=>!O.includes(Q(h)?h.toLowerCase():h)&&X(Number(h))).length===e&&n&&s.push(r)}let o=s.length===1?s[0].index:G(s,a=>a.length)?.index??0;this.setHeaderRowIndex(o)};this.getHeaderRowIndex=()=>this.headerRowIndex;this.getHeaderRow=()=>this.data[this.headerRowIndex]?.filter(e=>!!e);this.getColumns=()=>this.columns.filter(e=>!e.isRemoved());this.getSortedColumns=()=>[...this.getColumns()].sort((e,t)=>c(e.getColumnKey())<c(t.getColumnKey())?-1:c(e.getColumnKey())>c(t.getColumnKey())?1:0);this.getColumnsWithRemoved=()=>this.columns.filter(e=>e.getType()!==1);this.getColumn=(e,t)=>this.columns.find(s=>t?c(s.getColumnKey())===c(`${e}`):s.getColumnKey()===e);this.getColumnsByKey=(e,t)=>this.columns.filter(s=>t?c(s.getColumnKey())===c(`${e}`):s.getColumnKey()===e);this.getValues=()=>{let e=this.data.filter((s,o)=>o>this.headerRowIndex);if(b(e))return[[]];let t=[];for(let s=0;s<e.length;s++){let o=[];for(let a=0;a<this.data[this.headerRowIndex].length;a++)K(this.data[this.headerRowIndex][a])||o.push(this.parseValue(e[s][a]));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.getDataAsResults=()=>{let e=[],t=this.getColumnsWithRemoved(),s=this.data.filter((o,a)=>a>this.headerRowIndex);for(let o=0;o<s.length;o++){let a=s[o];e[o]={};for(let r=0;r<t.length;r++){let n=a?.[r];if(!b(n)&&!K(n)){let i=t[r].getColumnKey();e[o][i]=this.parseValue(n)}}}return e};this.addColumn=e=>{this.columns.push(new g({columnKey:`${e}`,sheet:this,rows:this.getRowsByColumnIndex(this.getColumnIndex(e))}))};this.removeColumn=e=>{this.columns.find(t=>t.getColumnKey()===e)?.remove()};this.removeColumnByIndex=e=>{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 a=o[e]??"";t.push(this.parseValue(a))}}return t};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 g({columnKey:`${o}`,sheet:this,rows:this.getRowsByColumnIndex(s)}))}this.columns=t}else this.columns=[]};this.getColumnIndex=e=>this.data[this.headerRowIndex].findIndex(o=>Y(`${o}`,`${e}`));this.parseValue=e=>typeof e=="string"?e.trim():e;this.data=e,this.name=t,typeof o>"u"?(B++,this.id=`${t}-${B}`):this.id=o,s||this.setColumns(),this.modifiedData=this.getDataAsResults()}getModifiedData(){return this.modifiedData}mergedModifiedData(e){let t=[],s=this.getColumns();for(let o=0;o<s.length;o++){let a=s[o],r=[];if(!a.isRemoved()){for(let n=0;n<e.length;n++){t[n]||(t[n]=[]);let i=e[n][o];t[n][o]=i,r[n]=i}a.setRows(r)}}this.setData(t)}},P=R;var N=class extends P{constructor({joinedData:t,sheets:s,mappings:o,mappingIndexes:a}){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 a=t-s.getColumns().length;return o.getColumns().filter((r,n)=>this.joinHistory[this.joinHistory.length-1].mappingIndexes.every(i=>i.target!==n))[a]};this.setJoinColumns=(t,s)=>{let o=this.data[this.headerRowIndex];if(!o){this.columns=[];return}let a=[];for(let r=0;r<o.length;++r){let n=o[r],i=s.findIndex(u=>u.source===r),h=this.columns[r]&&this.columns[r].getType()===1;if(i>=0||h){let u=t[i],d;h&&i>=0?d=[...this.columns[r].getJoinedSheetColumns(),u.target]:h?d=this.columns[r].getJoinedSheetColumns():d=[u.source.getRefJoinSheetColum()??u.source,u.target],a.push(new J({columnKey:`${n}`,sheetColumns:d,sheet:this,rows:this.getRowsByColumnIndex(r)}))}else{let u=this.columns[r]?this.columns[r].getRefJoinSheetColum()??this.columns[r]:this.findRefJoinSheetColumn(r);a.push(new g({columnKey:`${n}`,sheet:u.getSheet(),rows:this.getRowsByColumnIndex(r),refJoinSheetColum:u}))}}this.columns=a};this.getJoinedSheets=()=>this.sheets;this.getType=()=>1;this.joinSheet=(t,s,o,a)=>{this.setData(t.data),this.sheets.push(s),this.joinHistory.push({mappingIndexes:a,type:t.type,row:t.data.length,col:this.data[this.headerRowIndex]?.length??0}),this.setJoinColumns(o,a)};this.getJoinColumns=()=>this.columns.filter(t=>t.getType()===1);this.getJoinHistory=()=>this.joinHistory;this.headerRowIndex=0,this.joinHistory.push({mappingIndexes:a,type:t.type,row:t.data.length,col:this.data[this.headerRowIndex]?.length??0}),this.sheets=s,this.setJoinColumns(o,a)}},Re=N;var L=({rowA:l,rowB:e},t)=>t.every(s=>{let o=`${l[s.source]??""}`,a=`${e[s.target]??""}`;return o===a&&o!==""&&a!==""}),Z=(l,e,t)=>{let s=[],o=l.headerRow,a=e.headerRow;for(let r=0;r<o.length;++r)s.push(o[r]);for(let r=0;r<a.length;++r)t.every(n=>n.target!==r)&&s.push(a[r]);return s},Fe=async(l,e)=>{let t=l.values,s=e.values,o=l.headerRow,a=e.headerRow,r=[...o,...a],n=[];n.push(r);for(let i=0;i<t.length;++i)n.push([...t[i],...s[0]]);return{data:n,type:"ADD_TO_ALL_ROWS"}},Ae=async(l,e)=>{let t=l.values,s=e.values,o=l.headerRow,a=e.headerRow,r=[...o,...a],n=[];n.push(r);for(let i=0;i<t.length;++i)n.push([...t[i],...a.map(()=>"")]);for(let i=0;i<s.length;++i)n.push([...o.map(()=>""),...s[i]]);return{data:n,type:"JOIN_WITHOUT_COLUMNS"}},Je=async(l,e,t)=>{let s=l.values,o=e.values,a=[],r=[],n={},i=Z(l,e,t);a.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 p=o[m];L({rowA:d,rowB:p},t)&&(n[m]=!0,u=!0,a.push([...d,...p.filter((S,E)=>t.every(U=>U.target!==E))]))}u||r.push([...d,...e.headerRow.filter((m,p)=>t.every(S=>S.target!==p)).map(()=>"")])}for(let h=0;h<o.length;++h){if(n[h])continue;let u=o[h],d=l.headerRow.map(()=>"");t.forEach(m=>{d[m.source]=u[m.target]}),r.push([...d,...u.filter((m,p)=>t.every(S=>S.target!==p))])}return r.forEach(h=>{a.push(h)}),{data:a,type:"JOIN_ON_COLUMNS"}},Te=async(l,e,t)=>{let s=e.headerRow.filter((n,i)=>t.every(h=>h.target!==i)),a=[[...l.headerRow,...s]];for(let n=0;n<l.values.length;++n){let i=[...l.values[n],...s.map(()=>"")];a.push(i)}let r=e.values;for(let n=0;n<r.length;++n){let i=l.headerRow.map(()=>""),h=[];for(let u=0;u<e.headerRow.length;++u){let d=t.find(m=>m.target===u);d?i[d.source]=r[n][u]:h.push(r[n][u])}a.push([...i,...h])}return{data:a,type:"APPEND_TO_COLUMNS"}},He=async(l,e,t)=>{let s=l.values,o=e.values,a=s.length+o.length,r=0,n={};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 p=o[m];if(L({rowA:h,rowB:p},t)&&(u=m,d++,d===2))break}d===1&&u!==null&&(r+=1,n[u]=!0)}for(let i=0;i<o.length;i++)n[i]&&(r+=1);return{count:r,total:a}};var v=class{constructor({sheetColumn:e,matchedDataModel:t,detectedNumberFormats:s}){this.getOptionValue=(e,t)=>{if(!t)if(this.matchedDataModel.dataModel){let s=this.sheetColumn.columnKey,a=this.detectedNumberFormats.columns.find(r=>r.column===s)?.numberFormat||this.detectedNumberFormats.global;return M.parse(e,{dataModel:this.matchedDataModel.dataModel,isParseFromSheet:!0,numberFormat:a})}else return e;for(let s=0;s<t.length;s++)if(`${t[s]?.sheetOption}`==`${e}`)return this.matchedDataModel.dataModel&&this.matchedDataModel.dataModel.getIsMultiSelection()?M.parse(t[s]?.dataModelOptions,{dataModel:this.matchedDataModel.dataModel,isParseFromSheet:!0}):this.matchedDataModel.dataModel?M.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];t.push(this.getOptionValue(o,this.matchedOptions))}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++)this.matchedDataModel.dataModel?.getIsMultiSelection()?this.matchedDataModel.matchedOptions?.[o].dataModelOptions&&this.matchedOptions.push(this.matchedDataModel.matchedOptions?.[o]):this.matchedDataModel.matchedOptions?.[o].dataModelOption!==void 0&&this.matchedDataModel.matchedOptions?.[o].dataModelOption!==null&&this.matchedOptions.push(this.matchedDataModel.matchedOptions?.[o])}}},z=v;var V=class{constructor(e){this.matchedColumns=[];this.parseValues=()=>{let e=[];this.matchedColumns.forEach(t=>{let s=t.matchedDataModel,a=new z({sheetColumn:t.sheetColumn,matchedDataModel:s,detectedNumberFormats:this.detectedNumberFormats}).getValues(),r=s.dataModel.getKey();a.forEach((n,i)=>{e[i]?e[i][r]=n:e[i]={[r]:n}})});for(let t=0;t<e.length;++t)for(let s=0;s<this.columns.length;++s){let a=this.columns[s].key;e[t][a]===void 0&&(e[t][a]=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??[]}},$=V;var We=({matching:l,detectedNumberFormats:e,columns:t})=>new $({matching:l,detectedNumberFormats:e,columns:t}).getValues();import*as j from"comlink";var f=class{static{this.serialize=e=>e.serialize()}static{this.deSerialize=e=>w.isTypeCategory(e.type)?new F({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 w({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,numberFormat:e.numberFormat,hidden:e.hidden,disabled:e.disabled,optionMappingConfiguration:e.optionMappingConfiguration})}};var C=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?f.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?f.deSerialize(t.matchedDataModel.dataModel):t.matchedDataModel.dataModel,matchedOptions:t.matchedDataModel.matchedOptions}:t.matchedDataModel})),detectedNumberFormats:e.detectedNumberFormats,columns:e.columns})}};j.transferHandlers.set("Matching",{canHandle:l=>!!(typeof l=="object"&&l.matching),serialize:l=>C.serialize(l),deserialize:l=>C.deserialize(l)});export{g as a,_ as b,P as c,Re as d,Fe as e,Ae as f,Je as g,Te as h,He as i,We as j,f as k};
|