@likable-hair/cciaa-service 0.1.2 → 0.1.4

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.
@@ -1,10 +1,10 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var R=(n=>(n.COMPANY_SUMMARY_FETCH_FAILED="COMPANY_SUMMARY_FETCH_FAILED",n.FINANCIALS_FETCH_FAILED="FINANCIALS_FETCH_FAILED",n.SHARES_FETCH_FAILED="SHARES_FETCH_FAILED",n.PERSONA_DATA_FETCH_FAILED="PERSONA_DATA_FETCH_FAILED",n.PERSON_CORPORATE_HOLDINGS_FETCH_FAILED="PERSON_CORPORATE_HOLDINGS_FETCH_FAILED",n.CORPORATE_HOLDINGS_NOT_FOUND="CORPORATE_HOLDINGS_NOT_FOUND",n.PROTESTS_FETCH_FAILED="PROTESTS_FETCH_FAILED",n.MISSING_CCIAA_OR_REA="MISSING_CCIAA_OR_REA",n.COMPANY_NOT_FOUND="COMPANY_NOT_FOUND",n.PERSONA_DATA_NOT_FOUND="PERSONA_DATA_NOT_FOUND",n.INSUFFICIENT_CREDIT="INSUFFICIENT_CREDIT",n.SERVICE_UNAVAILABLE="SERVICE_UNAVAILABLE",n.HTTP_ERROR="HTTP_ERROR",n.BAD_REQUEST="BAD_REQUEST",n.XML_PARSE_ERROR="XML_PARSE_ERROR",n.XBRL_EMPTY="XBRL_EMPTY",n.XBRL_DECODE_ERROR="XBRL_DECODE_ERROR",n.XBRL_MAPPING_ERROR="XBRL_MAPPING_ERROR",n))(R||{});const A={COMPANY_SUMMARY_FETCH_FAILED:"Errore nel recupero anagrafica impresa",FINANCIALS_FETCH_FAILED:"Errore nel recupero dati finanziari",PERSONA_DATA_FETCH_FAILED:"Errore nel recupero dati persona",SHARES_FETCH_FAILED:"Errore nel recupero quote societarie",PROTESTS_FETCH_FAILED:"Errore nel recupero protesti",PERSON_CORPORATE_HOLDINGS_FETCH_FAILED:"Errore nel recupero partecipazioni societarie",CORPORATE_HOLDINGS_NOT_FOUND:"Partecipazioni societarie non trovate",MISSING_CCIAA_OR_REA:"Impossibile recuperare quote societarie: CCIAA o REA mancanti",COMPANY_NOT_FOUND:"Impresa non trovata",SERVICE_UNAVAILABLE:"Servizio temporaneamente non disponibile",HTTP_ERROR:"Errore HTTP del servizio",BAD_REQUEST:"Richiesta non valida",XML_PARSE_ERROR:"Errore nel parsing XML",XBRL_EMPTY:"Impossibile recuperare i dati finanziari. Errore nel recupero del file XBRL.",XBRL_DECODE_ERROR:"Impossibile recuperare i dati finanziari. Errore nella decodifica del file XBRL.",XBRL_MAPPING_ERROR:"Impossibile recuperare i dati finanziari. Errore nella mappaggio del file XBRL.",INSUFFICIENT_CREDIT:"Credito insufficiente per procedere",PERSONA_DATA_NOT_FOUND:"Dati persona non trovati"};function I(n,e,t,r){n.push({code:e,fields:t,message:r})}class Pn{async mapAnagraficaImpresaToCompanySummary(e,t=[]){return e?(e.Denominazione||I(t,R.COMPANY_SUMMARY_FETCH_FAILED,["companyName"],A.COMPANY_SUMMARY_FETCH_FAILED),e.PIva||I(t,R.COMPANY_SUMMARY_FETCH_FAILED,["vatNumber"],A.COMPANY_SUMMARY_FETCH_FAILED),e.Cciaa||I(t,R.COMPANY_SUMMARY_FETCH_FAILED,[],A.COMPANY_SUMMARY_FETCH_FAILED),{companyName:e.Denominazione||"",companyFiscalCode:e.CodFisc||"",companyVatNumber:e.PIva||"",companyLegalFormCode:e.NatGiu||"",companyLegalFormDescription:e.DescNatGiu||"",companyCciaaCode:e.Cciaa||"",companyCciaaDescription:e.DescCciaa||"",companyReaNumber:e.NRea||0,companyStatusCode:e.StatoAttivita||"",companyStatusDescription:e.DescStatoAttivita||"",companyRegistryStatusCode:e.StatoAttivitaReg||"",companyRegistryStatusDescription:e.DescStatoAttivitaReg||"",companySourceCode:e.Fonte||"",companySourceDescription:e.DescFonte||"",companyDeclaredActivity:e.AttivitaDichiarata||"",companyAtecoCode:e.ClassificazioneAteco?.CodAttivita||"",companyAtecoDescription:e.ClassificazioneAteco?.DescAttivita||"",companyAtecoClassificationCode:e.ClassificazioneAteco?.CodCodifica||0,companyAtecoClassificationDescription:e.ClassificazioneAteco?.DescCodifica||"",companyProvinceCode:e.IndirizzoSede?.SglPrvSede||"",companyProvinceDescription:e.IndirizzoSede?.DescPrvSede||"",companyMunicipalityCode:e.IndirizzoSede?.CodComSede||"",companyMunicipalityDescription:e.IndirizzoSede?.DescComSede||"",companyToponymCode:e.IndirizzoSede?.CodToponSede||"",companyToponymDescription:e.IndirizzoSede?.DescToponSede||"",companyStreet:e.IndirizzoSede?.ViaSede||"",companyStreetNumber:String(e.IndirizzoSede?.NCivicoSede||""),companyPostalCode:e.IndirizzoSede?.CapSede||0,companyPec:e.IndirizzoPostaCertificata||"",companyProfit:null,companyRevenue:null,companyIncorporationDate:null,companyShares:null,aiwsError:t}):(I(t,R.COMPANY_SUMMARY_FETCH_FAILED,[],A.COMPANY_SUMMARY_FETCH_FAILED),{companyName:"",companyFiscalCode:"",companyVatNumber:"",companyLegalFormCode:"",companyLegalFormDescription:"",companyCciaaCode:"",companyCciaaDescription:"",companyReaNumber:0,companyStatusCode:"",companyStatusDescription:"",companyRegistryStatusCode:"",companyRegistryStatusDescription:"",companySourceCode:"",companySourceDescription:"",companyDeclaredActivity:"",companyAtecoCode:"",companyAtecoDescription:"",companyAtecoClassificationCode:0,companyAtecoClassificationDescription:"",companyProvinceCode:"",companyProvinceDescription:"",companyMunicipalityCode:"",companyMunicipalityDescription:"",companyToponymCode:"",companyToponymDescription:"",companyStreet:"",companyStreetNumber:"",companyPostalCode:0,companyPec:"",companyProfit:null,companyRevenue:null,companyIncorporationDate:null,companyShares:null,aiwsError:t})}async mapRegistroImpresaToCompanyAdministrativeSummary(e){const t=e.Risposta.dati;return{identification:{activityStatus:{text:t["blocchi-impresa"]["dati-identificativi"]["stato-attivita"]["#text"],code:t["blocchi-impresa"]["dati-identificativi"]["stato-attivita"].c},legalForm:{text:t["blocchi-impresa"]["dati-identificativi"]["forma-giuridica"]["#text"],code:t["blocchi-impresa"]["dati-identificativi"]["forma-giuridica"].c},locationAddress:{street:t["blocchi-impresa"]["dati-identificativi"]["indirizzo-localizzazione"].via,streetNumber:t["blocchi-impresa"]["dati-identificativi"]["indirizzo-localizzazione"]["n-civico"],city:t["blocchi-impresa"]["dati-identificativi"]["indirizzo-localizzazione"].comune,province:t["blocchi-impresa"]["dati-identificativi"]["indirizzo-localizzazione"].provincia,postalCode:t["blocchi-impresa"]["dati-identificativi"]["indirizzo-localizzazione"].cap,topographyCode:t["blocchi-impresa"]["dati-identificativi"]["indirizzo-localizzazione"]["c-toponimo"],topographyName:t["blocchi-impresa"]["dati-identificativi"]["indirizzo-localizzazione"].toponimo},certifiedEmail:t["blocchi-impresa"]["dati-identificativi"]["indirizzo-posta-certificata"],representatives:{representative:t["blocchi-impresa"]["dati-identificativi"]["persone-rappresentanti"]["persona-rappresentante"]},isInterchamberOffice:t["blocchi-impresa"]["dati-identificativi"]["f-sede-intercamerale"],sourceCode:t["blocchi-impresa"]["dati-identificativi"]["c-fonte"],sourceName:t["blocchi-impresa"]["dati-identificativi"].fonte,subjectType:t["blocchi-impresa"]["dati-identificativi"]["tipo-soggetto"],subjectTypeDescription:t["blocchi-impresa"]["dati-identificativi"]["descrizione-tipo-soggetto"],companyType:t["blocchi-impresa"]["dati-identificativi"]["tipo-impresa"],companyTypeDescription:t["blocchi-impresa"]["dati-identificativi"]["descrizione-tipo-impresa"],registrationDate:t["blocchi-impresa"]["dati-identificativi"]["dt-iscrizione-ri"],constitutionDate:t["blocchi-impresa"]["dati-identificativi"]["dt-atto-costituzione"],lastProtocolDate:t["blocchi-impresa"]["dati-identificativi"]["dt-ultimo-protocollo"],lastProtocolProcessedDate:t["blocchi-impresa"]["dati-identificativi"]["dt-mod-ultimo-protocollo-evaso"],companyName:t["blocchi-impresa"]["dati-identificativi"].denominazione,taxCode:t["blocchi-impresa"]["dati-identificativi"]["c-fiscale"],vatNumber:t["blocchi-impresa"]["dati-identificativi"]["partita-iva"],chamberCode:t["blocchi-impresa"]["dati-identificativi"]["c-cciaa-competente"],chamberName:t["blocchi-impresa"]["dati-identificativi"]["cciaa-competente"],chamberAbbreviation:t["blocchi-impresa"]["dati-identificativi"].cciaa,reaNumber:t["blocchi-impresa"]["dati-identificativi"]["n-rea"]},activitySummary:{mainActivityDescription:t["blocchi-impresa"]["sintesi-attivita"]["attivita-prevalente-r"],atecoClassification:{activityCode:t["blocchi-impresa"]["sintesi-attivita"]["classificazione-ateco"]?t["blocchi-impresa"]["sintesi-attivita"]["classificazione-ateco"]["c-attivita"]:"",naceCode:t["blocchi-impresa"]["sintesi-attivita"]["classificazione-ateco"]?t["blocchi-impresa"]["sintesi-attivita"]["classificazione-ateco"]["c-nace"]:""},startDate:t["blocchi-impresa"]["sintesi-attivita"]["dt-inizio"]},officePersons:{person:t["blocchi-impresa"]["persone-sede"].persona},administrationControl:t["blocchi-impresa"]["amministrazione-controllo"]}}}const xr=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",cs=xr+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",ls="["+xr+"]["+cs+"]*",us=new RegExp("^"+ls+"$");function _r(n,e){const t=[];let r=e.exec(n);for(;r;){const i=[];i.startIndex=e.lastIndex-r[0].length;const s=r.length;for(let o=0;o<s;o++)i.push(r[o]);t.push(i),r=e.exec(n)}return t}const It=function(n){const e=us.exec(n);return!(e===null||typeof e>"u")};function fs(n){return typeof n<"u"}const ds={allowBooleanAttributes:!1,unpairedTags:[]};function hs(n,e){e=Object.assign({},ds,e);const t=[];let r=!1,i=!1;n[0]==="\uFEFF"&&(n=n.substr(1));for(let s=0;s<n.length;s++)if(n[s]==="<"&&n[s+1]==="?"){if(s+=2,s=Ln(n,s),s.err)return s}else if(n[s]==="<"){let o=s;if(s++,n[s]==="!"){s=Dn(n,s);continue}else{let a=!1;n[s]==="/"&&(a=!0,s++);let c="";for(;s<n.length&&n[s]!==">"&&n[s]!==" "&&n[s]!==" "&&n[s]!==`
2
- `&&n[s]!=="\r";s++)c+=n[s];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),s--),!Ss(c)){let f;return c.trim().length===0?f="Invalid space after '<'.":f="Tag '"+c+"' is an invalid name.",x("InvalidTag",f,$(n,s))}const l=ys(n,s);if(l===!1)return x("InvalidAttr","Attributes for '"+c+"' have open quote.",$(n,s));let u=l.value;if(s=l.index,u[u.length-1]==="/"){const f=s-u.length;u=u.substring(0,u.length-1);const m=Vn(u,e);if(m===!0)r=!0;else return x(m.err.code,m.err.msg,$(n,f+m.err.line))}else if(a)if(l.tagClosed){if(u.trim().length>0)return x("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",$(n,o));if(t.length===0)return x("InvalidTag","Closing tag '"+c+"' has not been opened.",$(n,o));{const f=t.pop();if(c!==f.tagName){let m=$(n,f.tagStartPos);return x("InvalidTag","Expected closing tag '"+f.tagName+"' (opened in line "+m.line+", col "+m.col+") instead of closing tag '"+c+"'.",$(n,o))}t.length==0&&(i=!0)}}else return x("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",$(n,s));else{const f=Vn(u,e);if(f!==!0)return x(f.err.code,f.err.msg,$(n,s-u.length+f.err.line));if(i===!0)return x("InvalidXml","Multiple possible root nodes found.",$(n,s));e.unpairedTags.indexOf(c)!==-1||t.push({tagName:c,tagStartPos:o}),r=!0}for(s++;s<n.length;s++)if(n[s]==="<")if(n[s+1]==="!"){s++,s=Dn(n,s);continue}else if(n[s+1]==="?"){if(s=Ln(n,++s),s.err)return s}else break;else if(n[s]==="&"){const f=ws(n,s);if(f==-1)return x("InvalidChar","char '&' is not expected.",$(n,s));s=f}else if(i===!0&&!zn(n[s]))return x("InvalidXml","Extra text at the end",$(n,s));n[s]==="<"&&s--}}else{if(zn(n[s]))continue;return x("InvalidChar","char '"+n[s]+"' is not expected.",$(n,s))}if(r){if(t.length==1)return x("InvalidTag","Unclosed tag '"+t[0].tagName+"'.",$(n,t[0].tagStartPos));if(t.length>0)return x("InvalidXml","Invalid '"+JSON.stringify(t.map(s=>s.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return x("InvalidXml","Start tag expected.",1);return!0}function zn(n){return n===" "||n===" "||n===`
3
- `||n==="\r"}function Ln(n,e){const t=e;for(;e<n.length;e++)if(n[e]=="?"||n[e]==" "){const r=n.substr(t,e-t);if(e>5&&r==="xml")return x("InvalidXml","XML declaration allowed only at the start of the document.",$(n,e));if(n[e]=="?"&&n[e+1]==">"){e++;break}else continue}return e}function Dn(n,e){if(n.length>e+5&&n[e+1]==="-"&&n[e+2]==="-"){for(e+=3;e<n.length;e++)if(n[e]==="-"&&n[e+1]==="-"&&n[e+2]===">"){e+=2;break}}else if(n.length>e+8&&n[e+1]==="D"&&n[e+2]==="O"&&n[e+3]==="C"&&n[e+4]==="T"&&n[e+5]==="Y"&&n[e+6]==="P"&&n[e+7]==="E"){let t=1;for(e+=8;e<n.length;e++)if(n[e]==="<")t++;else if(n[e]===">"&&(t--,t===0))break}else if(n.length>e+9&&n[e+1]==="["&&n[e+2]==="C"&&n[e+3]==="D"&&n[e+4]==="A"&&n[e+5]==="T"&&n[e+6]==="A"&&n[e+7]==="["){for(e+=8;e<n.length;e++)if(n[e]==="]"&&n[e+1]==="]"&&n[e+2]===">"){e+=2;break}}return e}const ms='"',ps="'";function ys(n,e){let t="",r="",i=!1;for(;e<n.length;e++){if(n[e]===ms||n[e]===ps)r===""?r=n[e]:r!==n[e]||(r="");else if(n[e]===">"&&r===""){i=!0;break}t+=n[e]}return r!==""?!1:{value:t,index:e,tagClosed:i}}const gs=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Vn(n,e){const t=_r(n,gs),r={};for(let i=0;i<t.length;i++){if(t[i][1].length===0)return x("InvalidAttr","Attribute '"+t[i][2]+"' has no space in starting.",Be(t[i]));if(t[i][3]!==void 0&&t[i][4]===void 0)return x("InvalidAttr","Attribute '"+t[i][2]+"' is without value.",Be(t[i]));if(t[i][3]===void 0&&!e.allowBooleanAttributes)return x("InvalidAttr","boolean attribute '"+t[i][2]+"' is not allowed.",Be(t[i]));const s=t[i][2];if(!Ts(s))return x("InvalidAttr","Attribute '"+s+"' is an invalid name.",Be(t[i]));if(!Object.prototype.hasOwnProperty.call(r,s))r[s]=1;else return x("InvalidAttr","Attribute '"+s+"' is repeated.",Be(t[i]))}return!0}function Es(n,e){let t=/\d/;for(n[e]==="x"&&(e++,t=/[\da-fA-F]/);e<n.length;e++){if(n[e]===";")return e;if(!n[e].match(t))break}return-1}function ws(n,e){if(e++,n[e]===";")return-1;if(n[e]==="#")return e++,Es(n,e);let t=0;for(;e<n.length;e++,t++)if(!(n[e].match(/\w/)&&t<20)){if(n[e]===";")break;return-1}return e}function x(n,e,t){return{err:{code:n,msg:e,line:t.line||t,col:t.col}}}function Ts(n){return It(n)}function Ss(n){return It(n)}function $(n,e){const t=n.substring(0,e).split(/\r?\n/);return{line:t.length,col:t[t.length-1].length+1}}function Be(n){return n.startIndex+n[1].length}const Ns={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(n,e){return e},attributeValueProcessor:function(n,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(n,e,t){return n},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0};function Pr(n){return typeof n=="boolean"?{enabled:n,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,allowedTags:null,tagFilter:null}:typeof n=="object"&&n!==null?{enabled:n.enabled!==!1,maxEntitySize:n.maxEntitySize??1e4,maxExpansionDepth:n.maxExpansionDepth??10,maxTotalExpansions:n.maxTotalExpansions??1e3,maxExpandedLength:n.maxExpandedLength??1e5,allowedTags:n.allowedTags??null,tagFilter:n.tagFilter??null}:Pr(!0)}const Os=function(n){const e=Object.assign({},Ns,n);return e.processEntities=Pr(e.processEntities),e};let Nt;typeof Symbol!="function"?Nt="@@xmlMetadata":Nt=Symbol("XML Node Metadata");class he{constructor(e){this.tagname=e,this.child=[],this[":@"]=Object.create(null)}add(e,t){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e,t){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child}),t!==void 0&&(this.child[this.child.length-1][Nt]={startIndex:t})}static getMetaDataSymbol(){return Nt}}class bs{constructor(e){this.suppressValidationErr=!e,this.options=e}readDocType(e,t){const r=Object.create(null);if(e[t+3]==="O"&&e[t+4]==="C"&&e[t+5]==="T"&&e[t+6]==="Y"&&e[t+7]==="P"&&e[t+8]==="E"){t=t+9;let i=1,s=!1,o=!1,a="";for(;t<e.length;t++)if(e[t]==="<"&&!o){if(s&&Ee(e,"!ENTITY",t)){t+=7;let c,l;if([c,l,t]=this.readEntityExp(e,t+1,this.suppressValidationErr),l.indexOf("&")===-1){const u=c.replace(/[.\-+*:]/g,"\\.");r[c]={regx:RegExp(`&${u};`,"g"),val:l}}}else if(s&&Ee(e,"!ELEMENT",t)){t+=8;const{index:c}=this.readElementExp(e,t+1);t=c}else if(s&&Ee(e,"!ATTLIST",t))t+=8;else if(s&&Ee(e,"!NOTATION",t)){t+=9;const{index:c}=this.readNotationExp(e,t+1,this.suppressValidationErr);t=c}else if(Ee(e,"!--",t))o=!0;else throw new Error("Invalid DOCTYPE");i++,a=""}else if(e[t]===">"){if(o?e[t-1]==="-"&&e[t-2]==="-"&&(o=!1,i--):i--,i===0)break}else e[t]==="["?s=!0:a+=e[t];if(i!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:t}}readEntityExp(e,t){t=Z(e,t);let r="";for(;t<e.length&&!/\s/.test(e[t])&&e[t]!=='"'&&e[t]!=="'";)r+=e[t],t++;if(We(r),t=Z(e,t),!this.suppressValidationErr){if(e.substring(t,t+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(e[t]==="%")throw new Error("Parameter entities are not supported")}let i="";if([t,i]=this.readIdentifierVal(e,t,"entity"),this.options.enabled!==!1&&this.options.maxEntitySize&&i.length>this.options.maxEntitySize)throw new Error(`Entity "${r}" size (${i.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return t--,[r,i,t]}readNotationExp(e,t){t=Z(e,t);let r="";for(;t<e.length&&!/\s/.test(e[t]);)r+=e[t],t++;!this.suppressValidationErr&&We(r),t=Z(e,t);const i=e.substring(t,t+6).toUpperCase();if(!this.suppressValidationErr&&i!=="SYSTEM"&&i!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${i}"`);t+=i.length,t=Z(e,t);let s=null,o=null;if(i==="PUBLIC")[t,s]=this.readIdentifierVal(e,t,"publicIdentifier"),t=Z(e,t),(e[t]==='"'||e[t]==="'")&&([t,o]=this.readIdentifierVal(e,t,"systemIdentifier"));else if(i==="SYSTEM"&&([t,o]=this.readIdentifierVal(e,t,"systemIdentifier"),!this.suppressValidationErr&&!o))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:r,publicIdentifier:s,systemIdentifier:o,index:--t}}readIdentifierVal(e,t,r){let i="";const s=e[t];if(s!=='"'&&s!=="'")throw new Error(`Expected quoted string, found "${s}"`);for(t++;t<e.length&&e[t]!==s;)i+=e[t],t++;if(e[t]!==s)throw new Error(`Unterminated ${r} value`);return t++,[t,i]}readElementExp(e,t){t=Z(e,t);let r="";for(;t<e.length&&!/\s/.test(e[t]);)r+=e[t],t++;if(!this.suppressValidationErr&&!It(r))throw new Error(`Invalid element name: "${r}"`);t=Z(e,t);let i="";if(e[t]==="E"&&Ee(e,"MPTY",t))t+=4;else if(e[t]==="A"&&Ee(e,"NY",t))t+=2;else if(e[t]==="("){for(t++;t<e.length&&e[t]!==")";)i+=e[t],t++;if(e[t]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${e[t]}"`);return{elementName:r,contentModel:i.trim(),index:t}}readAttlistExp(e,t){t=Z(e,t);let r="";for(;t<e.length&&!/\s/.test(e[t]);)r+=e[t],t++;We(r),t=Z(e,t);let i="";for(;t<e.length&&!/\s/.test(e[t]);)i+=e[t],t++;if(!We(i))throw new Error(`Invalid attribute name: "${i}"`);t=Z(e,t);let s="";if(e.substring(t,t+8).toUpperCase()==="NOTATION"){if(s="NOTATION",t+=8,t=Z(e,t),e[t]!=="(")throw new Error(`Expected '(', found "${e[t]}"`);t++;let a=[];for(;t<e.length&&e[t]!==")";){let c="";for(;t<e.length&&e[t]!=="|"&&e[t]!==")";)c+=e[t],t++;if(c=c.trim(),!We(c))throw new Error(`Invalid notation name: "${c}"`);a.push(c),e[t]==="|"&&(t++,t=Z(e,t))}if(e[t]!==")")throw new Error("Unterminated list of notations");t++,s+=" ("+a.join("|")+")"}else{for(;t<e.length&&!/\s/.test(e[t]);)s+=e[t],t++;const a=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!a.includes(s.toUpperCase()))throw new Error(`Invalid attribute type: "${s}"`)}t=Z(e,t);let o="";return e.substring(t,t+8).toUpperCase()==="#REQUIRED"?(o="#REQUIRED",t+=8):e.substring(t,t+7).toUpperCase()==="#IMPLIED"?(o="#IMPLIED",t+=7):[t,o]=this.readIdentifierVal(e,t,"ATTLIST"),{elementName:r,attributeName:i,attributeType:s,defaultValue:o,index:t}}}const Z=(n,e)=>{for(;e<n.length&&/\s/.test(n[e]);)e++;return e};function Ee(n,e,t){for(let r=0;r<e.length;r++)if(e[r]!==n[t+r+1])return!1;return!0}function We(n){if(It(n))return n;throw new Error(`Invalid entity name ${n}`)}const Cs=/^[-+]?0x[a-fA-F0-9]+$/,Rs=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,As={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Is(n,e={}){if(e=Object.assign({},As,e),!n||typeof n!="string")return n;let t=n.trim();if(e.skipLike!==void 0&&e.skipLike.test(t))return n;if(n==="0")return 0;if(e.hex&&Cs.test(t))return Ms(t,16);if(t.includes("e")||t.includes("E"))return ks(n,t,e);{const r=Rs.exec(t);if(r){const i=r[1]||"",s=r[2];let o=Fs(r[3]);const a=i?n[s.length+1]===".":n[s.length]===".";if(!e.leadingZeros&&(s.length>1||s.length===1&&!a))return n;{const c=Number(t),l=String(c);if(c===0)return c;if(l.search(/[eE]/)!==-1)return e.eNotation?c:n;if(t.indexOf(".")!==-1)return l==="0"||l===o||l===`${i}${o}`?c:n;let u=s?o:t;return s?u===l||i+u===l?c:n:u===l||u===i+l?c:n}}else return n}}const vs=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function ks(n,e,t){if(!t.eNotation)return n;const r=e.match(vs);if(r){let i=r[1]||"";const s=r[3].indexOf("e")===-1?"E":"e",o=r[2],a=i?n[o.length+1]===s:n[o.length]===s;return o.length>1&&a?n:o.length===1&&(r[3].startsWith(`.${s}`)||r[3][0]===s)?Number(e):t.leadingZeros&&!a?(e=(r[1]||"")+r[3],Number(e)):n}else return n}function Fs(n){return n&&n.indexOf(".")!==-1&&(n=n.replace(/0+$/,""),n==="."?n="0":n[0]==="."?n="0"+n:n[n.length-1]==="."&&(n=n.substring(0,n.length-1))),n}function Ms(n,e){if(parseInt)return parseInt(n,e);if(Number.parseInt)return Number.parseInt(n,e);if(window&&window.parseInt)return window.parseInt(n,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function xs(n){return typeof n=="function"?n:Array.isArray(n)?e=>{for(const t of n)if(typeof t=="string"&&e===t||t instanceof RegExp&&t.test(e))return!0}:()=>!1}class _s{constructor(e){if(this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,r)=>Un(r,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,r)=>Un(r,16,"&#x")}},this.addExternalEntities=Ps,this.parseXml=Us,this.parseTextData=zs,this.resolveNameSpace=Ls,this.buildAttributesMap=Vs,this.isItStopNode=Ws,this.replaceEntitiesValue=Hs,this.readStopNodeData=Zs,this.saveTextToParentTag=Bs,this.addChild=$s,this.ignoreAttributesFn=xs(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let t=0;t<this.options.stopNodes.length;t++){const r=this.options.stopNodes[t];typeof r=="string"&&(r.startsWith("*.")?this.stopNodesWildcard.add(r.substring(2)):this.stopNodesExact.add(r))}}}}function Ps(n){const e=Object.keys(n);for(let t=0;t<e.length;t++){const r=e[t],i=r.replace(/[.\-+*:]/g,"\\.");this.lastEntities[r]={regex:new RegExp("&"+i+";","g"),val:n[r]}}}function zs(n,e,t,r,i,s,o){if(n!==void 0&&(this.options.trimValues&&!r&&(n=n.trim()),n.length>0)){o||(n=this.replaceEntitiesValue(n,e,t));const a=this.options.tagValueProcessor(e,n,t,i,s);return a==null?n:typeof a!=typeof n||a!==n?a:this.options.trimValues?tn(n,this.options.parseTagValue,this.options.numberParseOptions):n.trim()===n?tn(n,this.options.parseTagValue,this.options.numberParseOptions):n}}function Ls(n){if(this.options.removeNSPrefix){const e=n.split(":"),t=n.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(n=t+e[1])}return n}const Ds=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Vs(n,e,t){if(this.options.ignoreAttributes!==!0&&typeof n=="string"){const r=_r(n,Ds),i=r.length,s={};for(let o=0;o<i;o++){const a=this.resolveNameSpace(r[o][1]);if(this.ignoreAttributesFn(a,e))continue;let c=r[o][4],l=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(l=this.options.transformAttributeName(l)),l==="__proto__"&&(l="#__proto__"),c!==void 0){this.options.trimValues&&(c=c.trim()),c=this.replaceEntitiesValue(c,t,e);const u=this.options.attributeValueProcessor(a,c,e);u==null?s[l]=c:typeof u!=typeof c||u!==c?s[l]=u:s[l]=tn(c,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(s[l]=!0)}if(!Object.keys(s).length)return;if(this.options.attributesGroupName){const o={};return o[this.options.attributesGroupName]=s,o}return s}}const Us=function(n){n=n.replace(/\r\n?/g,`
4
- `);const e=new he("!xml");let t=e,r="",i="";this.entityExpansionCount=0,this.currentExpandedLength=0;const s=new bs(this.options.processEntities);for(let o=0;o<n.length;o++)if(n[o]==="<")if(n[o+1]==="/"){const c=Se(n,">",o,"Closing Tag is not closed.");let l=n.substring(o+2,c).trim();if(this.options.removeNSPrefix){const m=l.indexOf(":");m!==-1&&(l=l.substr(m+1))}this.options.transformTagName&&(l=this.options.transformTagName(l)),t&&(r=this.saveTextToParentTag(r,t,i));const u=i.substring(i.lastIndexOf(".")+1);if(l&&this.options.unpairedTags.indexOf(l)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${l}>`);let f=0;u&&this.options.unpairedTags.indexOf(u)!==-1?(f=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):f=i.lastIndexOf("."),i=i.substring(0,f),t=this.tagsNodeStack.pop(),r="",o=c}else if(n[o+1]==="?"){let c=en(n,o,!1,"?>");if(!c)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,t,i),!(this.options.ignoreDeclaration&&c.tagName==="?xml"||this.options.ignorePiTags)){const l=new he(c.tagName);l.add(this.options.textNodeName,""),c.tagName!==c.tagExp&&c.attrExpPresent&&(l[":@"]=this.buildAttributesMap(c.tagExp,i,c.tagName)),this.addChild(t,l,i,o)}o=c.closeIndex+1}else if(n.substr(o+1,3)==="!--"){const c=Se(n,"-->",o+4,"Comment is not closed.");if(this.options.commentPropName){const l=n.substring(o+4,c-2);r=this.saveTextToParentTag(r,t,i),t.add(this.options.commentPropName,[{[this.options.textNodeName]:l}])}o=c}else if(n.substr(o+1,2)==="!D"){const c=s.readDocType(n,o);this.docTypeEntities=c.entities,o=c.i}else if(n.substr(o+1,2)==="!["){const c=Se(n,"]]>",o,"CDATA is not closed.")-2,l=n.substring(o+9,c);r=this.saveTextToParentTag(r,t,i);let u=this.parseTextData(l,t.tagname,i,!0,!1,!0,!0);u==null&&(u=""),this.options.cdataPropName?t.add(this.options.cdataPropName,[{[this.options.textNodeName]:l}]):t.add(this.options.textNodeName,u),o=c+2}else{let c=en(n,o,this.options.removeNSPrefix),l=c.tagName;const u=c.rawTagName;let f=c.tagExp,m=c.attrExpPresent,y=c.closeIndex;if(this.options.transformTagName){const p=this.options.transformTagName(l);f===l&&(f=p),l=p}if(this.options.strictReservedNames&&(l===this.options.commentPropName||l===this.options.cdataPropName))throw new Error(`Invalid tag name: ${l}`);t&&r&&t.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,t,i,!1));const h=t;h&&this.options.unpairedTags.indexOf(h.tagname)!==-1&&(t=this.tagsNodeStack.pop(),i=i.substring(0,i.lastIndexOf("."))),l!==e.tagname&&(i+=i?"."+l:l);const E=o;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,i,l)){let p="";if(f.length>0&&f.lastIndexOf("/")===f.length-1)l[l.length-1]==="/"?(l=l.substr(0,l.length-1),i=i.substr(0,i.length-1),f=l):f=f.substr(0,f.length-1),o=c.closeIndex;else if(this.options.unpairedTags.indexOf(l)!==-1)o=c.closeIndex;else{const v=this.readStopNodeData(n,u,y+1);if(!v)throw new Error(`Unexpected end of ${u}`);o=v.i,p=v.tagContent}const N=new he(l);l!==f&&m&&(N[":@"]=this.buildAttributesMap(f,i,l)),p&&(p=this.parseTextData(p,l,i,!0,m,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),N.add(this.options.textNodeName,p),this.addChild(t,N,i,E)}else{if(f.length>0&&f.lastIndexOf("/")===f.length-1){if(l[l.length-1]==="/"?(l=l.substr(0,l.length-1),i=i.substr(0,i.length-1),f=l):f=f.substr(0,f.length-1),this.options.transformTagName){const N=this.options.transformTagName(l);f===l&&(f=N),l=N}const p=new he(l);l!==f&&m&&(p[":@"]=this.buildAttributesMap(f,i,l)),this.addChild(t,p,i,E),i=i.substr(0,i.lastIndexOf("."))}else if(this.options.unpairedTags.indexOf(l)!==-1){const p=new he(l);l!==f&&m&&(p[":@"]=this.buildAttributesMap(f,i)),this.addChild(t,p,i,E),i=i.substr(0,i.lastIndexOf(".")),o=c.closeIndex;continue}else{const p=new he(l);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(t),l!==f&&m&&(p[":@"]=this.buildAttributesMap(f,i,l)),this.addChild(t,p,i,E),t=p}r="",o=y}}else r+=n[o];return e.child};function $s(n,e,t,r){this.options.captureMetaData||(r=void 0);const i=this.options.updateTag(e.tagname,t,e[":@"]);i===!1||(typeof i=="string"&&(e.tagname=i),n.addChild(e,r))}const Hs=function(n,e,t){if(n.indexOf("&")===-1)return n;const r=this.options.processEntities;if(!r.enabled||r.allowedTags&&!r.allowedTags.includes(e)||r.tagFilter&&!r.tagFilter(e,t))return n;for(let i in this.docTypeEntities){const s=this.docTypeEntities[i],o=n.match(s.regx);if(o){if(this.entityExpansionCount+=o.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions)throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);const a=n.length;if(n=n.replace(s.regx,s.val),r.maxExpandedLength&&(this.currentExpandedLength+=n.length-a,this.currentExpandedLength>r.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${r.maxExpandedLength}`)}}if(n.indexOf("&")===-1)return n;for(let i in this.lastEntities){const s=this.lastEntities[i];n=n.replace(s.regex,s.val)}if(n.indexOf("&")===-1)return n;if(this.options.htmlEntities)for(let i in this.htmlEntities){const s=this.htmlEntities[i];n=n.replace(s.regex,s.val)}return n=n.replace(this.ampEntity.regex,this.ampEntity.val),n};function Bs(n,e,t,r){return n&&(r===void 0&&(r=e.child.length===0),n=this.parseTextData(n,e.tagname,t,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,r),n!==void 0&&n!==""&&e.add(this.options.textNodeName,n),n=""),n}function Ws(n,e,t,r){return!!(e&&e.has(r)||n&&n.has(t))}function qs(n,e,t=">"){let r,i="";for(let s=e;s<n.length;s++){let o=n[s];if(r)o===r&&(r="");else if(o==='"'||o==="'")r=o;else if(o===t[0])if(t[1]){if(n[s+1]===t[1])return{data:i,index:s}}else return{data:i,index:s};else o===" "&&(o=" ");i+=o}}function Se(n,e,t,r){const i=n.indexOf(e,t);if(i===-1)throw new Error(r);return i+e.length-1}function en(n,e,t,r=">"){const i=qs(n,e+1,r);if(!i)return;let s=i.data;const o=i.index,a=s.search(/\s/);let c=s,l=!0;a!==-1&&(c=s.substring(0,a),s=s.substring(a+1).trimStart());const u=c;if(t){const f=c.indexOf(":");f!==-1&&(c=c.substr(f+1),l=c!==i.data.substr(f+1))}return{tagName:c,tagExp:s,closeIndex:o,attrExpPresent:l,rawTagName:u}}function Zs(n,e,t){const r=t;let i=1;for(;t<n.length;t++)if(n[t]==="<")if(n[t+1]==="/"){const s=Se(n,">",t,`${e} is not closed`);if(n.substring(t+2,s).trim()===e&&(i--,i===0))return{tagContent:n.substring(r,t),i:s};t=s}else if(n[t+1]==="?")t=Se(n,"?>",t+1,"StopNode is not closed.");else if(n.substr(t+1,3)==="!--")t=Se(n,"-->",t+3,"StopNode is not closed.");else if(n.substr(t+1,2)==="![")t=Se(n,"]]>",t,"StopNode is not closed.")-2;else{const s=en(n,t,">");s&&((s&&s.tagName)===e&&s.tagExp[s.tagExp.length-1]!=="/"&&i++,t=s.closeIndex)}}function tn(n,e,t){if(e&&typeof n=="string"){const r=n.trim();return r==="true"?!0:r==="false"?!1:Is(n,t)}else return fs(n)?n:""}function Un(n,e,t){const r=Number.parseInt(n,e);return r>=0&&r<=1114111?String.fromCodePoint(r):t+n+";"}const $t=he.getMetaDataSymbol();function Ys(n,e){return zr(n,e)}function zr(n,e,t){let r;const i={};for(let s=0;s<n.length;s++){const o=n[s],a=js(o);let c="";if(t===void 0?c=a:c=t+"."+a,a===e.textNodeName)r===void 0?r=o[a]:r+=""+o[a];else{if(a===void 0)continue;if(o[a]){let l=zr(o[a],e,c);const u=Js(l,e);o[":@"]?Gs(l,o[":@"],c,e):Object.keys(l).length===1&&l[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?l=l[e.textNodeName]:Object.keys(l).length===0&&(e.alwaysCreateTextNode?l[e.textNodeName]="":l=""),o[$t]!==void 0&&typeof l=="object"&&l!==null&&(l[$t]=o[$t]),i[a]!==void 0&&Object.prototype.hasOwnProperty.call(i,a)?(Array.isArray(i[a])||(i[a]=[i[a]]),i[a].push(l)):e.isArray(a,c,u)?i[a]=[l]:i[a]=l}}}return typeof r=="string"?r.length>0&&(i[e.textNodeName]=r):r!==void 0&&(i[e.textNodeName]=r),i}function js(n){const e=Object.keys(n);for(let t=0;t<e.length;t++){const r=e[t];if(r!==":@")return r}}function Gs(n,e,t,r){if(e){const i=Object.keys(e),s=i.length;for(let o=0;o<s;o++){const a=i[o];r.isArray(a,t+"."+a,!0,!0)?n[a]=[e[a]]:n[a]=e[a]}}}function Js(n,e){const{textNodeName:t}=e,r=Object.keys(n).length;return!!(r===0||r===1&&(n[t]||typeof n[t]=="boolean"||n[t]===0))}class Lr{constructor(e){this.externalEntities={},this.options=Os(e)}parse(e,t){if(typeof e!="string"&&e.toString)e=e.toString();else if(typeof e!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(t){t===!0&&(t={});const s=hs(e,t);if(s!==!0)throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`)}const r=new _s(this.options);r.addExternalEntities(this.externalEntities);const i=r.parseXml(e);return this.options.preserveOrder||i===void 0?i:Ys(i,this.options)}addEntity(e,t){if(t.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(t==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}static getMetaDataSymbol(){return he.getMetaDataSymbol()}}class Xs{async getFinancialValues(e,t){const r=e?.Risposta?.dati;if(!r)return I(t,R.XBRL_EMPTY,["companyProfit","companyRevenue"],A.XBRL_EMPTY),null;let i;try{i=Buffer.from(r,"base64").toString("utf-8")}catch(u){return console.log(u),I(t,R.XBRL_DECODE_ERROR,["companyProfit","companyRevenue"],A.XBRL_DECODE_ERROR),null}const s=new Lr({ignoreAttributes:!1,attributeNamePrefix:""});let o;try{o=s.parse(i)}catch(u){return console.log(u),I(t,R.XML_PARSE_ERROR,["companyProfit","companyRevenue"],A.XML_PARSE_ERROR),null}if(!o?.xbrl)return I(t,R.XBRL_MAPPING_ERROR,["companyProfit","companyRevenue"],A.XBRL_MAPPING_ERROR),null;const a=o.xbrl,c=this.findByContext(a,"itcc-ci:UtilePerditaEsercizio","cntxCorr_d"),l=this.findByContext(a,"itcc-ci:ValoreProduzioneRicaviVenditePrestazioni","cntxCorr_d");return{companyProfit:c?Number(c["#text"]):0,companyRevenue:l?Number(l["#text"]):0}}findByContext(e,t,r){const i=e[t];return i?(Array.isArray(i)?i:[i]).find(o=>o.contextRef===r)??null:null}}const Ks={PERSONA:"person",IMPRESA:"company",ALTRO:"other"};class Qs{parseAddress(e){if(e)return{street:e.via,number:e["n-civico"],city:e.comune,province:e.provincia,cap:e.cap}}parseCapital(e){return parseFloat(e.replace(".","").replace(",","."))}async getShares(e,t){const r=[],i=Array.isArray(e)?e:[e];for(const s of i){const o=this.parseCapital(s["composizione-quote"]["valore-nominale"]),a=Array.isArray(s.titolari.titolare)?s.titolari.titolare:[s.titolari.titolare];for(const c of a){const l={type:Ks[c["anagrafica-titolare"].tipo],fiscalCode:c["anagrafica-titolare"]["c-fiscale"],firstName:c["anagrafica-titolare"].nome||c["anagrafica-titolare"].denominazione,lastName:c["anagrafica-titolare"].cognome,shareValue:o,sharePercentage:o/t*100,isRepresentative:c["f-rappresentante"]==="S",address:this.parseAddress(c.domicilio)};r.push(l)}}return r}}class Re extends Error{}class eo extends Re{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class to extends Re{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class no extends Re{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class Fe extends Re{}class Dr extends Re{constructor(e){super(`Invalid unit ${e}`)}}class L extends Re{}class de extends Re{constructor(){super("Zone is an abstract class")}}const g="numeric",re="short",G="long",Ot={year:g,month:g,day:g},Vr={year:g,month:re,day:g},ro={year:g,month:re,day:g,weekday:re},Ur={year:g,month:G,day:g},$r={year:g,month:G,day:g,weekday:G},Hr={hour:g,minute:g},Br={hour:g,minute:g,second:g},Wr={hour:g,minute:g,second:g,timeZoneName:re},qr={hour:g,minute:g,second:g,timeZoneName:G},Zr={hour:g,minute:g,hourCycle:"h23"},Yr={hour:g,minute:g,second:g,hourCycle:"h23"},jr={hour:g,minute:g,second:g,hourCycle:"h23",timeZoneName:re},Gr={hour:g,minute:g,second:g,hourCycle:"h23",timeZoneName:G},Jr={year:g,month:g,day:g,hour:g,minute:g},Xr={year:g,month:g,day:g,hour:g,minute:g,second:g},Kr={year:g,month:re,day:g,hour:g,minute:g},Qr={year:g,month:re,day:g,hour:g,minute:g,second:g},io={year:g,month:re,day:g,weekday:re,hour:g,minute:g},ei={year:g,month:G,day:g,hour:g,minute:g,timeZoneName:re},ti={year:g,month:G,day:g,hour:g,minute:g,second:g,timeZoneName:re},ni={year:g,month:G,day:g,weekday:G,hour:g,minute:g,timeZoneName:G},ri={year:g,month:G,day:g,weekday:G,hour:g,minute:g,second:g,timeZoneName:G};class Ke{get type(){throw new de}get name(){throw new de}get ianaName(){return this.name}get isUniversal(){throw new de}offsetName(e,t){throw new de}formatOffset(e,t){throw new de}offset(e){throw new de}equals(e){throw new de}get isValid(){throw new de}}let Ht=null;class vt extends Ke{static get instance(){return Ht===null&&(Ht=new vt),Ht}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return mi(e,t,r)}formatOffset(e,t){return Je(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}const nn=new Map;function so(n){let e=nn.get(n);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),nn.set(n,e)),e}const oo={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function ao(n,e){const t=n.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,i,s,o,a,c,l,u]=r;return[o,i,s,a,c,l,u]}function co(n,e){const t=n.formatToParts(e),r=[];for(let i=0;i<t.length;i++){const{type:s,value:o}=t[i],a=oo[s];s==="era"?r[a]=o:S(a)||(r[a]=parseInt(o,10))}return r}const Bt=new Map;class ce extends Ke{static create(e){let t=Bt.get(e);return t===void 0&&Bt.set(e,t=new ce(e)),t}static resetCache(){Bt.clear(),nn.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=ce.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return mi(e,t,r,this.name)}formatOffset(e,t){return Je(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const r=so(this.name);let[i,s,o,a,c,l,u]=r.formatToParts?co(r,t):ao(r,t);a==="BC"&&(i=-Math.abs(i)+1);const m=Ft({year:i,month:s,day:o,hour:c===24?0:c,minute:l,second:u,millisecond:0});let y=+t;const h=y%1e3;return y-=h>=0?h:1e3+h,(m-y)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let $n={};function lo(n,e={}){const t=JSON.stringify([n,e]);let r=$n[t];return r||(r=new Intl.ListFormat(n,e),$n[t]=r),r}const rn=new Map;function sn(n,e={}){const t=JSON.stringify([n,e]);let r=rn.get(t);return r===void 0&&(r=new Intl.DateTimeFormat(n,e),rn.set(t,r)),r}const on=new Map;function uo(n,e={}){const t=JSON.stringify([n,e]);let r=on.get(t);return r===void 0&&(r=new Intl.NumberFormat(n,e),on.set(t,r)),r}const an=new Map;function fo(n,e={}){const{base:t,...r}=e,i=JSON.stringify([n,r]);let s=an.get(i);return s===void 0&&(s=new Intl.RelativeTimeFormat(n,e),an.set(i,s)),s}let Ye=null;function ho(){return Ye||(Ye=new Intl.DateTimeFormat().resolvedOptions().locale,Ye)}const cn=new Map;function ii(n){let e=cn.get(n);return e===void 0&&(e=new Intl.DateTimeFormat(n).resolvedOptions(),cn.set(n,e)),e}const ln=new Map;function mo(n){let e=ln.get(n);if(!e){const t=new Intl.Locale(n);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,"minimalDays"in e||(e={...si,...e}),ln.set(n,e)}return e}function po(n){const e=n.indexOf("-x-");e!==-1&&(n=n.substring(0,e));const t=n.indexOf("-u-");if(t===-1)return[n];{let r,i;try{r=sn(n).resolvedOptions(),i=n}catch{const c=n.substring(0,t);r=sn(c).resolvedOptions(),i=c}const{numberingSystem:s,calendar:o}=r;return[i,s,o]}}function yo(n,e,t){return(t||e)&&(n.includes("-u-")||(n+="-u"),t&&(n+=`-ca-${t}`),e&&(n+=`-nu-${e}`)),n}function go(n){const e=[];for(let t=1;t<=12;t++){const r=w.utc(2009,t,1);e.push(n(r))}return e}function Eo(n){const e=[];for(let t=1;t<=7;t++){const r=w.utc(2016,11,13+t);e.push(n(r))}return e}function ut(n,e,t,r){const i=n.listingMode();return i==="error"?null:i==="en"?t(e):r(e)}function wo(n){return n.numberingSystem&&n.numberingSystem!=="latn"?!1:n.numberingSystem==="latn"||!n.locale||n.locale.startsWith("en")||ii(n.locale).numberingSystem==="latn"}class To{constructor(e,t,r){this.padTo=r.padTo||0,this.floor=r.floor||!1;const{padTo:i,floor:s,...o}=r;if(!t||Object.keys(o).length>0){const a={useGrouping:!1,...r};r.padTo>0&&(a.minimumIntegerDigits=r.padTo),this.inf=uo(e,a)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{const t=this.floor?Math.floor(e):Nn(e,3);return P(t,this.padTo)}}}class So{constructor(e,t,r){this.opts=r,this.originalZone=void 0;let i;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const o=-1*(e.offset/60),a=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&ce.create(a).valid?(i=a,this.dt=e):(i="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,i=e.zone.name):(i="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const s={...this.opts};s.timeZone=s.timeZone||i,this.dtf=sn(t,s)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){const r=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:r}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class No{constructor(e,t,r){this.opts={style:"long",...r},!t&&di()&&(this.rtf=fo(e,r))}format(e,t){return this.rtf?this.rtf.format(e,t):Wo(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const si={firstDay:1,minimalDays:4,weekend:[6,7]};class C{static fromOpts(e){return C.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,r,i,s=!1){const o=e||F.defaultLocale,a=o||(s?"en-US":ho()),c=t||F.defaultNumberingSystem,l=r||F.defaultOutputCalendar,u=fn(i)||F.defaultWeekSettings;return new C(a,c,l,u,o)}static resetCache(){Ye=null,rn.clear(),on.clear(),an.clear(),cn.clear(),ln.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:r,weekSettings:i}={}){return C.create(e,t,r,i)}constructor(e,t,r,i,s){const[o,a,c]=po(e);this.locale=o,this.numberingSystem=t||a||null,this.outputCalendar=r||c||null,this.weekSettings=i,this.intl=yo(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=s,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=wo(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:C.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,fn(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return ut(this,e,gi,()=>{const r=this.intl==="ja"||this.intl.startsWith("ja-");t&=!r;const i=t?{month:e,day:"numeric"}:{month:e},s=t?"format":"standalone";if(!this.monthsCache[s][e]){const o=r?a=>this.dtFormatter(a,i).format():a=>this.extract(a,i,"month");this.monthsCache[s][e]=go(o)}return this.monthsCache[s][e]})}weekdays(e,t=!1){return ut(this,e,Ti,()=>{const r=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},i=t?"format":"standalone";return this.weekdaysCache[i][e]||(this.weekdaysCache[i][e]=Eo(s=>this.extract(s,r,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return ut(this,void 0,()=>Si,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[w.utc(2016,11,13,9),w.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return ut(this,e,Ni,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[w.utc(-40,1,1),w.utc(2017,1,1)].map(r=>this.extract(r,t,"era"))),this.eraCache[e]})}extract(e,t,r){const i=this.dtFormatter(e,t),s=i.formatToParts(),o=s.find(a=>a.type.toLowerCase()===r);return o?o.value:null}numberFormatter(e={}){return new To(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new So(e,this.intl,t)}relFormatter(e={}){return new No(this.intl,this.isEnglish(),e)}listFormatter(e={}){return lo(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||ii(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:hi()?mo(this.locale):si}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let Wt=null;class H extends Ke{static get utcInstance(){return Wt===null&&(Wt=new H(0)),Wt}static instance(e){return e===0?H.utcInstance:new H(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new H(Mt(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Je(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Je(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Je(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class Oo extends Ke{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function pe(n,e){if(S(n)||n===null)return e;if(n instanceof Ke)return n;if(vo(n)){const t=n.toLowerCase();return t==="default"?e:t==="local"||t==="system"?vt.instance:t==="utc"||t==="gmt"?H.utcInstance:H.parseSpecifier(t)||ce.create(n)}else return ye(n)?H.instance(n):typeof n=="object"&&"offset"in n&&typeof n.offset=="function"?n:new Oo(n)}const En={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Hn={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},bo=En.hanidec.replace(/[\[|\]]/g,"").split("");function Co(n){let e=parseInt(n,10);if(isNaN(e)){e="";for(let t=0;t<n.length;t++){const r=n.charCodeAt(t);if(n[t].search(En.hanidec)!==-1)e+=bo.indexOf(n[t]);else for(const i in Hn){const[s,o]=Hn[i];r>=s&&r<=o&&(e+=r-s)}}return parseInt(e,10)}else return e}const un=new Map;function Ro(){un.clear()}function ee({numberingSystem:n},e=""){const t=n||"latn";let r=un.get(t);r===void 0&&(r=new Map,un.set(t,r));let i=r.get(e);return i===void 0&&(i=new RegExp(`${En[t]}${e}`),r.set(e,i)),i}let Bn=()=>Date.now(),Wn="system",qn=null,Zn=null,Yn=null,jn=60,Gn,Jn=null;class F{static get now(){return Bn}static set now(e){Bn=e}static set defaultZone(e){Wn=e}static get defaultZone(){return pe(Wn,vt.instance)}static get defaultLocale(){return qn}static set defaultLocale(e){qn=e}static get defaultNumberingSystem(){return Zn}static set defaultNumberingSystem(e){Zn=e}static get defaultOutputCalendar(){return Yn}static set defaultOutputCalendar(e){Yn=e}static get defaultWeekSettings(){return Jn}static set defaultWeekSettings(e){Jn=fn(e)}static get twoDigitCutoffYear(){return jn}static set twoDigitCutoffYear(e){jn=e%100}static get throwOnInvalid(){return Gn}static set throwOnInvalid(e){Gn=e}static resetCaches(){C.resetCache(),ce.resetCache(),w.resetCache(),Ro()}}class ne{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const oi=[0,31,59,90,120,151,181,212,243,273,304,334],ai=[0,31,60,91,121,152,182,213,244,274,305,335];function K(n,e){return new ne("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${n}, which is invalid`)}function wn(n,e,t){const r=new Date(Date.UTC(n,e-1,t));n<100&&n>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);const i=r.getUTCDay();return i===0?7:i}function ci(n,e,t){return t+(Qe(n)?ai:oi)[e-1]}function li(n,e){const t=Qe(n)?ai:oi,r=t.findIndex(s=>s<e),i=e-t[r];return{month:r+1,day:i}}function Tn(n,e){return(n-e+7)%7+1}function bt(n,e=4,t=1){const{year:r,month:i,day:s}=n,o=ci(r,i,s),a=Tn(wn(r,i,s),t);let c=Math.floor((o-a+14-e)/7),l;return c<1?(l=r-1,c=Xe(l,e,t)):c>Xe(r,e,t)?(l=r+1,c=1):l=r,{weekYear:l,weekNumber:c,weekday:a,...xt(n)}}function Xn(n,e=4,t=1){const{weekYear:r,weekNumber:i,weekday:s}=n,o=Tn(wn(r,1,e),t),a=Me(r);let c=i*7+s-o-7+e,l;c<1?(l=r-1,c+=Me(l)):c>a?(l=r+1,c-=Me(r)):l=r;const{month:u,day:f}=li(l,c);return{year:l,month:u,day:f,...xt(n)}}function qt(n){const{year:e,month:t,day:r}=n,i=ci(e,t,r);return{year:e,ordinal:i,...xt(n)}}function Kn(n){const{year:e,ordinal:t}=n,{month:r,day:i}=li(e,t);return{year:e,month:r,day:i,...xt(n)}}function Qn(n,e){if(!S(n.localWeekday)||!S(n.localWeekNumber)||!S(n.localWeekYear)){if(!S(n.weekday)||!S(n.weekNumber)||!S(n.weekYear))throw new Fe("Cannot mix locale-based week fields with ISO-based week fields");return S(n.localWeekday)||(n.weekday=n.localWeekday),S(n.localWeekNumber)||(n.weekNumber=n.localWeekNumber),S(n.localWeekYear)||(n.weekYear=n.localWeekYear),delete n.localWeekday,delete n.localWeekNumber,delete n.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function Ao(n,e=4,t=1){const r=kt(n.weekYear),i=Q(n.weekNumber,1,Xe(n.weekYear,e,t)),s=Q(n.weekday,1,7);return r?i?s?!1:K("weekday",n.weekday):K("week",n.weekNumber):K("weekYear",n.weekYear)}function Io(n){const e=kt(n.year),t=Q(n.ordinal,1,Me(n.year));return e?t?!1:K("ordinal",n.ordinal):K("year",n.year)}function ui(n){const e=kt(n.year),t=Q(n.month,1,12),r=Q(n.day,1,Ct(n.year,n.month));return e?t?r?!1:K("day",n.day):K("month",n.month):K("year",n.year)}function fi(n){const{hour:e,minute:t,second:r,millisecond:i}=n,s=Q(e,0,23)||e===24&&t===0&&r===0&&i===0,o=Q(t,0,59),a=Q(r,0,59),c=Q(i,0,999);return s?o?a?c?!1:K("millisecond",i):K("second",r):K("minute",t):K("hour",e)}function S(n){return typeof n>"u"}function ye(n){return typeof n=="number"}function kt(n){return typeof n=="number"&&n%1===0}function vo(n){return typeof n=="string"}function ko(n){return Object.prototype.toString.call(n)==="[object Date]"}function di(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function hi(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Fo(n){return Array.isArray(n)?n:[n]}function er(n,e,t){if(n.length!==0)return n.reduce((r,i)=>{const s=[e(i),i];return r&&t(r[0],s[0])===r[0]?r:s},null)[1]}function Mo(n,e){return e.reduce((t,r)=>(t[r]=n[r],t),{})}function _e(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function fn(n){if(n==null)return null;if(typeof n!="object")throw new L("Week settings must be an object");if(!Q(n.firstDay,1,7)||!Q(n.minimalDays,1,7)||!Array.isArray(n.weekend)||n.weekend.some(e=>!Q(e,1,7)))throw new L("Invalid week settings");return{firstDay:n.firstDay,minimalDays:n.minimalDays,weekend:Array.from(n.weekend)}}function Q(n,e,t){return kt(n)&&n>=e&&n<=t}function xo(n,e){return n-e*Math.floor(n/e)}function P(n,e=2){const t=n<0;let r;return t?r="-"+(""+-n).padStart(e,"0"):r=(""+n).padStart(e,"0"),r}function me(n){if(!(S(n)||n===null||n===""))return parseInt(n,10)}function we(n){if(!(S(n)||n===null||n===""))return parseFloat(n)}function Sn(n){if(!(S(n)||n===null||n==="")){const e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function Nn(n,e,t="round"){const r=10**e;switch(t){case"expand":return n>0?Math.ceil(n*r)/r:Math.floor(n*r)/r;case"trunc":return Math.trunc(n*r)/r;case"round":return Math.round(n*r)/r;case"floor":return Math.floor(n*r)/r;case"ceil":return Math.ceil(n*r)/r;default:throw new RangeError(`Value rounding ${t} is out of range`)}}function Qe(n){return n%4===0&&(n%100!==0||n%400===0)}function Me(n){return Qe(n)?366:365}function Ct(n,e){const t=xo(e-1,12)+1,r=n+(e-t)/12;return t===2?Qe(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Ft(n){let e=Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond);return n.year<100&&n.year>=0&&(e=new Date(e),e.setUTCFullYear(n.year,n.month-1,n.day)),+e}function tr(n,e,t){return-Tn(wn(n,1,e),t)+e-1}function Xe(n,e=4,t=1){const r=tr(n,e,t),i=tr(n+1,e,t);return(Me(n)-r+i)/7}function dn(n){return n>99?n:n>F.twoDigitCutoffYear?1900+n:2e3+n}function mi(n,e,t,r=null){const i=new Date(n),s={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(s.timeZone=r);const o={timeZoneName:e,...s},a=new Intl.DateTimeFormat(t,o).formatToParts(i).find(c=>c.type.toLowerCase()==="timezonename");return a?a.value:null}function Mt(n,e){let t=parseInt(n,10);Number.isNaN(t)&&(t=0);const r=parseInt(e,10)||0,i=t<0||Object.is(t,-0)?-r:r;return t*60+i}function pi(n){const e=Number(n);if(typeof n=="boolean"||n===""||!Number.isFinite(e))throw new L(`Invalid unit value ${n}`);return e}function Rt(n,e){const t={};for(const r in n)if(_e(n,r)){const i=n[r];if(i==null)continue;t[e(r)]=pi(i)}return t}function Je(n,e){const t=Math.trunc(Math.abs(n/60)),r=Math.trunc(Math.abs(n%60)),i=n>=0?"+":"-";switch(e){case"short":return`${i}${P(t,2)}:${P(r,2)}`;case"narrow":return`${i}${t}${r>0?`:${r}`:""}`;case"techie":return`${i}${P(t,2)}${P(r,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function xt(n){return Mo(n,["hour","minute","second","millisecond"])}const _o=["January","February","March","April","May","June","July","August","September","October","November","December"],yi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Po=["J","F","M","A","M","J","J","A","S","O","N","D"];function gi(n){switch(n){case"narrow":return[...Po];case"short":return[...yi];case"long":return[..._o];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const Ei=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],wi=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],zo=["M","T","W","T","F","S","S"];function Ti(n){switch(n){case"narrow":return[...zo];case"short":return[...wi];case"long":return[...Ei];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Si=["AM","PM"],Lo=["Before Christ","Anno Domini"],Do=["BC","AD"],Vo=["B","A"];function Ni(n){switch(n){case"narrow":return[...Vo];case"short":return[...Do];case"long":return[...Lo];default:return null}}function Uo(n){return Si[n.hour<12?0:1]}function $o(n,e){return Ti(e)[n.weekday-1]}function Ho(n,e){return gi(e)[n.month-1]}function Bo(n,e){return Ni(e)[n.year<0?0:1]}function Wo(n,e,t="always",r=!1){const i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},s=["hours","minutes","seconds"].indexOf(n)===-1;if(t==="auto"&&s){const f=n==="days";switch(e){case 1:return f?"tomorrow":`next ${i[n][0]}`;case-1:return f?"yesterday":`last ${i[n][0]}`;case 0:return f?"today":`this ${i[n][0]}`}}const o=Object.is(e,-0)||e<0,a=Math.abs(e),c=a===1,l=i[n],u=r?c?l[1]:l[2]||l[1]:c?i[n][0]:n;return o?`${a} ${u} ago`:`in ${a} ${u}`}function nr(n,e){let t="";for(const r of n)r.literal?t+=r.val:t+=e(r.val);return t}const qo={D:Ot,DD:Vr,DDD:Ur,DDDD:$r,t:Hr,tt:Br,ttt:Wr,tttt:qr,T:Zr,TT:Yr,TTT:jr,TTTT:Gr,f:Jr,ff:Kr,fff:ei,ffff:ni,F:Xr,FF:Qr,FFF:ti,FFFF:ri};class V{static create(e,t={}){return new V(e,t)}static parseFormat(e){let t=null,r="",i=!1;const s=[];for(let o=0;o<e.length;o++){const a=e.charAt(o);a==="'"?((r.length>0||i)&&s.push({literal:i||/^\s+$/.test(r),val:r===""?"'":r}),t=null,r="",i=!i):i||a===t?r+=a:(r.length>0&&s.push({literal:/^\s+$/.test(r),val:r}),r=a,t=a)}return r.length>0&&s.push({literal:i||/^\s+$/.test(r),val:r}),s}static macroTokenToFormatOpts(e){return qo[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,r=void 0){if(this.opts.forceSimple)return P(e,t);const i={...this.opts};return t>0&&(i.padTo=t),r&&(i.signDisplay=r),this.loc.numberFormatter(i).format(e)}formatDateTimeFromString(e,t){const r=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",s=(y,h)=>this.loc.extract(e,y,h),o=y=>e.isOffsetFixed&&e.offset===0&&y.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,y.format):"",a=()=>r?Uo(e):s({hour:"numeric",hourCycle:"h12"},"dayperiod"),c=(y,h)=>r?Ho(e,y):s(h?{month:y}:{month:y,day:"numeric"},"month"),l=(y,h)=>r?$o(e,y):s(h?{weekday:y}:{weekday:y,month:"long",day:"numeric"},"weekday"),u=y=>{const h=V.macroTokenToFormatOpts(y);return h?this.formatWithSystemDefault(e,h):y},f=y=>r?Bo(e,y):s({era:y},"era"),m=y=>{switch(y){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return a();case"d":return i?s({day:"numeric"},"day"):this.num(e.day);case"dd":return i?s({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return l("short",!0);case"cccc":return l("long",!0);case"ccccc":return l("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return l("short",!1);case"EEEE":return l("long",!1);case"EEEEE":return l("narrow",!1);case"L":return i?s({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return i?s({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return c("short",!0);case"LLLL":return c("long",!0);case"LLLLL":return c("narrow",!0);case"M":return i?s({month:"numeric"},"month"):this.num(e.month);case"MM":return i?s({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return c("short",!1);case"MMMM":return c("long",!1);case"MMMMM":return c("narrow",!1);case"y":return i?s({year:"numeric"},"year"):this.num(e.year);case"yy":return i?s({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return i?s({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return i?s({year:"numeric"},"year"):this.num(e.year,6);case"G":return f("short");case"GG":return f("long");case"GGGGG":return f("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return u(y)}};return nr(V.parseFormat(t),m)}formatDurationFromString(e,t){const r=this.opts.signMode==="negativeLargestOnly"?-1:1,i=u=>{switch(u[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},s=(u,f)=>m=>{const y=i(m);if(y){const h=f.isNegativeDuration&&y!==f.largestUnit?r:1;let E;return this.opts.signMode==="negativeLargestOnly"&&y!==f.largestUnit?E="never":this.opts.signMode==="all"?E="always":E="auto",this.num(u.get(y)*h,m.length,E)}else return m},o=V.parseFormat(t),a=o.reduce((u,{literal:f,val:m})=>f?u:u.concat(m),[]),c=e.shiftTo(...a.map(i).filter(u=>u)),l={isNegativeDuration:c<0,largestUnit:Object.keys(c.values)[0]};return nr(o,s(c,l))}}const Oi=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function ze(...n){const e=n.reduce((t,r)=>t+r.source,"");return RegExp(`^${e}$`)}function Le(...n){return e=>n.reduce(([t,r,i],s)=>{const[o,a,c]=s(e,i);return[{...t,...o},a||r,c]},[{},null,1]).slice(0,2)}function De(n,...e){if(n==null)return[null,null];for(const[t,r]of e){const i=t.exec(n);if(i)return r(i)}return[null,null]}function bi(...n){return(e,t)=>{const r={};let i;for(i=0;i<n.length;i++)r[n[i]]=me(e[t+i]);return[r,null,t+i]}}const Ci=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,Zo=`(?:${Ci.source}?(?:\\[(${Oi.source})\\])?)?`,On=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Ri=RegExp(`${On.source}${Zo}`),bn=RegExp(`(?:[Tt]${Ri.source})?`),Yo=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,jo=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Go=/(\d{4})-?(\d{3})/,Jo=bi("weekYear","weekNumber","weekDay"),Xo=bi("year","ordinal"),Ko=/(\d{4})-(\d\d)-(\d\d)/,Ai=RegExp(`${On.source} ?(?:${Ci.source}|(${Oi.source}))?`),Qo=RegExp(`(?: ${Ai.source})?`);function xe(n,e,t){const r=n[e];return S(r)?t:me(r)}function ea(n,e){return[{year:xe(n,e),month:xe(n,e+1,1),day:xe(n,e+2,1)},null,e+3]}function Ve(n,e){return[{hours:xe(n,e,0),minutes:xe(n,e+1,0),seconds:xe(n,e+2,0),milliseconds:Sn(n[e+3])},null,e+4]}function et(n,e){const t=!n[e]&&!n[e+1],r=Mt(n[e+1],n[e+2]),i=t?null:H.instance(r);return[{},i,e+3]}function tt(n,e){const t=n[e]?ce.create(n[e]):null;return[{},t,e+1]}const ta=RegExp(`^T?${On.source}$`),na=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function ra(n){const[e,t,r,i,s,o,a,c,l]=n,u=e[0]==="-",f=c&&c[0]==="-",m=(y,h=!1)=>y!==void 0&&(h||y&&u)?-y:y;return[{years:m(we(t)),months:m(we(r)),weeks:m(we(i)),days:m(we(s)),hours:m(we(o)),minutes:m(we(a)),seconds:m(we(c),c==="-0"),milliseconds:m(Sn(l),f)}]}const ia={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Cn(n,e,t,r,i,s,o){const a={year:e.length===2?dn(me(e)):me(e),month:yi.indexOf(t)+1,day:me(r),hour:me(i),minute:me(s)};return o&&(a.second=me(o)),n&&(a.weekday=n.length>3?Ei.indexOf(n)+1:wi.indexOf(n)+1),a}const sa=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function oa(n){const[,e,t,r,i,s,o,a,c,l,u,f]=n,m=Cn(e,i,r,t,s,o,a);let y;return c?y=ia[c]:l?y=0:y=Mt(u,f),[m,new H(y)]}function aa(n){return n.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const ca=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,la=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,ua=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function rr(n){const[,e,t,r,i,s,o,a]=n;return[Cn(e,i,r,t,s,o,a),H.utcInstance]}function fa(n){const[,e,t,r,i,s,o,a]=n;return[Cn(e,a,t,r,i,s,o),H.utcInstance]}const da=ze(Yo,bn),ha=ze(jo,bn),ma=ze(Go,bn),pa=ze(Ri),Ii=Le(ea,Ve,et,tt),ya=Le(Jo,Ve,et,tt),ga=Le(Xo,Ve,et,tt),Ea=Le(Ve,et,tt);function wa(n){return De(n,[da,Ii],[ha,ya],[ma,ga],[pa,Ea])}function Ta(n){return De(aa(n),[sa,oa])}function Sa(n){return De(n,[ca,rr],[la,rr],[ua,fa])}function Na(n){return De(n,[na,ra])}const Oa=Le(Ve);function ba(n){return De(n,[ta,Oa])}const Ca=ze(Ko,Qo),Ra=ze(Ai),Aa=Le(Ve,et,tt);function Ia(n){return De(n,[Ca,Ii],[Ra,Aa])}const ir="Invalid Duration",vi={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},va={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...vi},J=146097/400,Ie=146097/4800,ka={years:{quarters:4,months:12,weeks:J/7,days:J,hours:J*24,minutes:J*24*60,seconds:J*24*60*60,milliseconds:J*24*60*60*1e3},quarters:{months:3,weeks:J/28,days:J/4,hours:J*24/4,minutes:J*24*60/4,seconds:J*24*60*60/4,milliseconds:J*24*60*60*1e3/4},months:{weeks:Ie/7,days:Ie,hours:Ie*24,minutes:Ie*24*60,seconds:Ie*24*60*60,milliseconds:Ie*24*60*60*1e3},...vi},Ne=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Fa=Ne.slice(0).reverse();function ae(n,e,t=!1){const r={values:t?e.values:{...n.values,...e.values||{}},loc:n.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||n.conversionAccuracy,matrix:e.matrix||n.matrix};return new O(r)}function ki(n,e){let t=e.milliseconds??0;for(const r of Fa.slice(1))e[r]&&(t+=e[r]*n[r].milliseconds);return t}function sr(n,e){const t=ki(n,e)<0?-1:1;Ne.reduceRight((r,i)=>{if(S(e[i]))return r;if(r){const s=e[r]*t,o=n[i][r],a=Math.floor(s/o);e[i]+=a*t,e[r]-=a*o*t}return i},null),Ne.reduce((r,i)=>{if(S(e[i]))return r;if(r){const s=e[r]%1;e[r]-=s,e[i]+=s*n[r][i]}return i},null)}function or(n){const e={};for(const[t,r]of Object.entries(n))r!==0&&(e[t]=r);return e}class O{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let r=t?ka:va;e.matrix&&(r=e.matrix),this.values=e.values,this.loc=e.loc||C.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=r,this.isLuxonDuration=!0}static fromMillis(e,t){return O.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new L(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new O({values:Rt(e,O.normalizeUnit),loc:C.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(ye(e))return O.fromMillis(e);if(O.isDuration(e))return e;if(typeof e=="object")return O.fromObject(e);throw new L(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[r]=Na(e);return r?O.fromObject(r,t):O.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[r]=ba(e);return r?O.fromObject(r,t):O.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new L("need to specify a reason the Duration is invalid");const r=e instanceof ne?e:new ne(e,t);if(F.throwOnInvalid)throw new no(r);return new O({invalid:r})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new Dr(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const r={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?V.create(this.loc,r).formatDurationFromString(this,e):ir}toHuman(e={}){if(!this.isValid)return ir;const t=e.showZeros!==!1,r=Ne.map(i=>{const s=this.values[i];return S(s)||s===0&&!t?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:i.slice(0,-1)}).format(s)}).filter(i=>i);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(r)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=Nn(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},w.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?ki(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=O.fromDurationLike(e),r={};for(const i of Ne)(_e(t.values,i)||_e(this.values,i))&&(r[i]=t.get(i)+this.get(i));return ae(this,{values:r},!0)}minus(e){if(!this.isValid)return this;const t=O.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const r of Object.keys(this.values))t[r]=pi(e(this.values[r],r));return ae(this,{values:t},!0)}get(e){return this[O.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...Rt(e,O.normalizeUnit)};return ae(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:r,matrix:i}={}){const o={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:i,conversionAccuracy:r};return ae(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return sr(this.matrix,e),ae(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=or(this.normalize().shiftToAll().toObject());return ae(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>O.normalizeUnit(o));const t={},r={},i=this.toObject();let s;for(const o of Ne)if(e.indexOf(o)>=0){s=o;let a=0;for(const l in r)a+=this.matrix[l][o]*r[l],r[l]=0;ye(i[o])&&(a+=i[o]);const c=Math.trunc(a);t[o]=c,r[o]=(a*1e3-c*1e3)/1e3}else ye(i[o])&&(r[o]=i[o]);for(const o in r)r[o]!==0&&(t[s]+=o===s?r[o]:r[o]/this.matrix[s][o]);return sr(this.matrix,t),ae(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return ae(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;const e=or(this.values);return ae(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(r,i){return r===void 0||r===0?i===void 0||i===0:r===i}for(const r of Ne)if(!t(this.values[r],e.values[r]))return!1;return!0}}const ve="Invalid Interval";function Ma(n,e){return!n||!n.isValid?k.invalid("missing or invalid start"):!e||!e.isValid?k.invalid("missing or invalid end"):e<n?k.invalid("end before start",`The end of an interval must be after its start, but you had start=${n.toISO()} and end=${e.toISO()}`):null}class k{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new L("need to specify a reason the Interval is invalid");const r=e instanceof ne?e:new ne(e,t);if(F.throwOnInvalid)throw new to(r);return new k({invalid:r})}static fromDateTimes(e,t){const r=qe(e),i=qe(t),s=Ma(r,i);return s??new k({start:r,end:i})}static after(e,t){const r=O.fromDurationLike(t),i=qe(e);return k.fromDateTimes(i,i.plus(r))}static before(e,t){const r=O.fromDurationLike(t),i=qe(e);return k.fromDateTimes(i.minus(r),i)}static fromISO(e,t){const[r,i]=(e||"").split("/",2);if(r&&i){let s,o;try{s=w.fromISO(r,t),o=s.isValid}catch{o=!1}let a,c;try{a=w.fromISO(i,t),c=a.isValid}catch{c=!1}if(o&&c)return k.fromDateTimes(s,a);if(o){const l=O.fromISO(i,t);if(l.isValid)return k.after(s,l)}else if(c){const l=O.fromISO(r,t);if(l.isValid)return k.before(a,l)}}return k.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;const r=this.start.startOf(e,t);let i;return t?.useLocaleWeeks?i=this.end.reconfigure({locale:r.locale}):i=this.end,i=i.startOf(e,t),Math.floor(i.diff(r,e).get(e))+(i.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?k.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(qe).filter(o=>this.contains(o)).sort((o,a)=>o.toMillis()-a.toMillis()),r=[];let{s:i}=this,s=0;for(;i<this.e;){const o=t[s]||this.e,a=+o>+this.e?this.e:o;r.push(k.fromDateTimes(i,a)),i=a,s+=1}return r}splitBy(e){const t=O.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:r}=this,i=1,s;const o=[];for(;r<this.e;){const a=this.start.plus(t.mapUnits(c=>c*i));s=+a>+this.e?this.e:a,o.push(k.fromDateTimes(r,s)),r=s,i+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,r=this.e<e.e?this.e:e.e;return t>=r?null:k.fromDateTimes(t,r)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,r=this.e>e.e?this.e:e.e;return k.fromDateTimes(t,r)}static merge(e){const[t,r]=e.sort((i,s)=>i.s-s.s).reduce(([i,s],o)=>s?s.overlaps(o)||s.abutsStart(o)?[i,s.union(o)]:[i.concat([s]),o]:[i,o],[[],null]);return r&&t.push(r),t}static xor(e){let t=null,r=0;const i=[],s=e.map(c=>[{time:c.s,type:"s"},{time:c.e,type:"e"}]),o=Array.prototype.concat(...s),a=o.sort((c,l)=>c.time-l.time);for(const c of a)r+=c.type==="s"?1:-1,r===1?t=c.time:(t&&+t!=+c.time&&i.push(k.fromDateTimes(t,c.time)),t=null);return k.merge(i)}difference(...e){return k.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:ve}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=Ot,t={}){return this.isValid?V.create(this.s.loc.clone(t),e).formatInterval(this):ve}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:ve}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:ve}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:ve}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:ve}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):O.invalid(this.invalidReason)}mapEndpoints(e){return k.fromDateTimes(e(this.s),e(this.e))}}class ft{static hasDST(e=F.defaultZone){const t=w.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return ce.isValidZone(e)}static normalizeZone(e){return pe(e,F.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||C.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||C.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||C.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:r=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||C.create(t,r,s)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||C.create(t,r,s)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:r=null,locObj:i=null}={}){return(i||C.create(t,r,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:i=null}={}){return(i||C.create(t,r,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return C.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return C.create(t,null,"gregory").eras(e)}static features(){return{relative:di(),localeWeek:hi()}}}function ar(n,e){const t=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=t(e)-t(n);return Math.floor(O.fromMillis(r).as("days"))}function xa(n,e,t){const r=[["years",(c,l)=>l.year-c.year],["quarters",(c,l)=>l.quarter-c.quarter+(l.year-c.year)*4],["months",(c,l)=>l.month-c.month+(l.year-c.year)*12],["weeks",(c,l)=>{const u=ar(c,l);return(u-u%7)/7}],["days",ar]],i={},s=n;let o,a;for(const[c,l]of r)t.indexOf(c)>=0&&(o=c,i[c]=l(n,e),a=s.plus(i),a>e?(i[c]--,n=s.plus(i),n>e&&(a=n,i[c]--,n=s.plus(i))):n=a);return[n,i,a,o]}function _a(n,e,t,r){let[i,s,o,a]=xa(n,e,t);const c=e-i,l=t.filter(f=>["hours","minutes","seconds","milliseconds"].indexOf(f)>=0);l.length===0&&(o<e&&(o=i.plus({[a]:1})),o!==i&&(s[a]=(s[a]||0)+c/(o-i)));const u=O.fromObject(s,r);return l.length>0?O.fromMillis(c,r).shiftTo(...l).plus(u):u}const Pa="missing Intl.DateTimeFormat.formatToParts support";function b(n,e=t=>t){return{regex:n,deser:([t])=>e(Co(t))}}const za=" ",Fi=`[ ${za}]`,Mi=new RegExp(Fi,"g");function La(n){return n.replace(/\./g,"\\.?").replace(Mi,Fi)}function cr(n){return n.replace(/\./g,"").replace(Mi," ").toLowerCase()}function te(n,e){return n===null?null:{regex:RegExp(n.map(La).join("|")),deser:([t])=>n.findIndex(r=>cr(t)===cr(r))+e}}function lr(n,e){return{regex:n,deser:([,t,r])=>Mt(t,r),groups:e}}function dt(n){return{regex:n,deser:([e])=>e}}function Da(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Va(n,e){const t=ee(e),r=ee(e,"{2}"),i=ee(e,"{3}"),s=ee(e,"{4}"),o=ee(e,"{6}"),a=ee(e,"{1,2}"),c=ee(e,"{1,3}"),l=ee(e,"{1,6}"),u=ee(e,"{1,9}"),f=ee(e,"{2,4}"),m=ee(e,"{4,6}"),y=p=>({regex:RegExp(Da(p.val)),deser:([N])=>N,literal:!0}),E=(p=>{if(n.literal)return y(p);switch(p.val){case"G":return te(e.eras("short"),0);case"GG":return te(e.eras("long"),0);case"y":return b(l);case"yy":return b(f,dn);case"yyyy":return b(s);case"yyyyy":return b(m);case"yyyyyy":return b(o);case"M":return b(a);case"MM":return b(r);case"MMM":return te(e.months("short",!0),1);case"MMMM":return te(e.months("long",!0),1);case"L":return b(a);case"LL":return b(r);case"LLL":return te(e.months("short",!1),1);case"LLLL":return te(e.months("long",!1),1);case"d":return b(a);case"dd":return b(r);case"o":return b(c);case"ooo":return b(i);case"HH":return b(r);case"H":return b(a);case"hh":return b(r);case"h":return b(a);case"mm":return b(r);case"m":return b(a);case"q":return b(a);case"qq":return b(r);case"s":return b(a);case"ss":return b(r);case"S":return b(c);case"SSS":return b(i);case"u":return dt(u);case"uu":return dt(a);case"uuu":return b(t);case"a":return te(e.meridiems(),0);case"kkkk":return b(s);case"kk":return b(f,dn);case"W":return b(a);case"WW":return b(r);case"E":case"c":return b(t);case"EEE":return te(e.weekdays("short",!1),1);case"EEEE":return te(e.weekdays("long",!1),1);case"ccc":return te(e.weekdays("short",!0),1);case"cccc":return te(e.weekdays("long",!0),1);case"Z":case"ZZ":return lr(new RegExp(`([+-]${a.source})(?::(${r.source}))?`),2);case"ZZZ":return lr(new RegExp(`([+-]${a.source})(${r.source})?`),2);case"z":return dt(/[a-z_+-/]{1,256}?/i);case" ":return dt(/[^\S\n\r]/);default:return y(p)}})(n)||{invalidReason:Pa};return E.token=n,E}const Ua={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function $a(n,e,t){const{type:r,value:i}=n;if(r==="literal"){const c=/^\s+$/.test(i);return{literal:!c,val:c?" ":i}}const s=e[r];let o=r;r==="hour"&&(e.hour12!=null?o=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?o="hour12":o="hour24":o=t.hour12?"hour12":"hour24");let a=Ua[o];if(typeof a=="object"&&(a=a[s]),a)return{literal:!1,val:a}}function Ha(n){return[`^${n.map(t=>t.regex).reduce((t,r)=>`${t}(${r.source})`,"")}$`,n]}function Ba(n,e,t){const r=n.match(e);if(r){const i={};let s=1;for(const o in t)if(_e(t,o)){const a=t[o],c=a.groups?a.groups+1:1;!a.literal&&a.token&&(i[a.token.val[0]]=a.deser(r.slice(s,s+c))),s+=c}return[r,i]}else return[r,{}]}function Wa(n){const e=s=>{switch(s){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let t=null,r;return S(n.z)||(t=ce.create(n.z)),S(n.Z)||(t||(t=new H(n.Z)),r=n.Z),S(n.q)||(n.M=(n.q-1)*3+1),S(n.h)||(n.h<12&&n.a===1?n.h+=12:n.h===12&&n.a===0&&(n.h=0)),n.G===0&&n.y&&(n.y=-n.y),S(n.u)||(n.S=Sn(n.u)),[Object.keys(n).reduce((s,o)=>{const a=e(o);return a&&(s[a]=n[o]),s},{}),t,r]}let Zt=null;function qa(){return Zt||(Zt=w.fromMillis(1555555555555)),Zt}function Za(n,e){if(n.literal)return n;const t=V.macroTokenToFormatOpts(n.val),r=zi(t,e);return r==null||r.includes(void 0)?n:r}function xi(n,e){return Array.prototype.concat(...n.map(t=>Za(t,e)))}class _i{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=xi(V.parseFormat(t),e),this.units=this.tokens.map(r=>Va(r,e)),this.disqualifyingUnit=this.units.find(r=>r.invalidReason),!this.disqualifyingUnit){const[r,i]=Ha(this.units);this.regex=RegExp(r,"i"),this.handlers=i}}explainFromTokens(e){if(this.isValid){const[t,r]=Ba(e,this.regex,this.handlers),[i,s,o]=r?Wa(r):[null,null,void 0];if(_e(r,"a")&&_e(r,"H"))throw new Fe("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:r,result:i,zone:s,specificOffset:o}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function Pi(n,e,t){return new _i(n,t).explainFromTokens(e)}function Ya(n,e,t){const{result:r,zone:i,specificOffset:s,invalidReason:o}=Pi(n,e,t);return[r,i,s,o]}function zi(n,e){if(!n)return null;const r=V.create(e,n).dtFormatter(qa()),i=r.formatToParts(),s=r.resolvedOptions();return i.map(o=>$a(o,n,s))}const Yt="Invalid DateTime",ur=864e13;function je(n){return new ne("unsupported zone",`the zone "${n.name}" is not supported`)}function jt(n){return n.weekData===null&&(n.weekData=bt(n.c)),n.weekData}function Gt(n){return n.localWeekData===null&&(n.localWeekData=bt(n.c,n.loc.getMinDaysInFirstWeek(),n.loc.getStartOfWeek())),n.localWeekData}function Te(n,e){const t={ts:n.ts,zone:n.zone,c:n.c,o:n.o,loc:n.loc,invalid:n.invalid};return new w({...t,...e,old:t})}function Li(n,e,t){let r=n-e*60*1e3;const i=t.offset(r);if(e===i)return[r,e];r-=(i-e)*60*1e3;const s=t.offset(r);return i===s?[r,i]:[n-Math.min(i,s)*60*1e3,Math.max(i,s)]}function ht(n,e){n+=e*60*1e3;const t=new Date(n);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function yt(n,e,t){return Li(Ft(n),e,t)}function fr(n,e){const t=n.o,r=n.c.year+Math.trunc(e.years),i=n.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,s={...n.c,year:r,month:i,day:Math.min(n.c.day,Ct(r,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=O.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),a=Ft(s);let[c,l]=Li(a,t,n.zone);return o!==0&&(c+=o,l=n.zone.offset(c)),{ts:c,o:l}}function ke(n,e,t,r,i,s){const{setZone:o,zone:a}=t;if(n&&Object.keys(n).length!==0||e){const c=e||a,l=w.fromObject(n,{...t,zone:c,specificOffset:s});return o?l:l.setZone(a)}else return w.invalid(new ne("unparsable",`the input "${i}" can't be parsed as ${r}`))}function mt(n,e,t=!0){return n.isValid?V.create(C.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function Jt(n,e,t){const r=n.c.year>9999||n.c.year<0;let i="";if(r&&n.c.year>=0&&(i+="+"),i+=P(n.c.year,r?6:4),t==="year")return i;if(e){if(i+="-",i+=P(n.c.month),t==="month")return i;i+="-"}else if(i+=P(n.c.month),t==="month")return i;return i+=P(n.c.day),i}function dr(n,e,t,r,i,s,o){let a=!t||n.c.millisecond!==0||n.c.second!==0,c="";switch(o){case"day":case"month":case"year":break;default:if(c+=P(n.c.hour),o==="hour")break;if(e){if(c+=":",c+=P(n.c.minute),o==="minute")break;a&&(c+=":",c+=P(n.c.second))}else{if(c+=P(n.c.minute),o==="minute")break;a&&(c+=P(n.c.second))}if(o==="second")break;a&&(!r||n.c.millisecond!==0)&&(c+=".",c+=P(n.c.millisecond,3))}return i&&(n.isOffsetFixed&&n.offset===0&&!s?c+="Z":n.o<0?(c+="-",c+=P(Math.trunc(-n.o/60)),c+=":",c+=P(Math.trunc(-n.o%60))):(c+="+",c+=P(Math.trunc(n.o/60)),c+=":",c+=P(Math.trunc(n.o%60)))),s&&(c+="["+n.zone.ianaName+"]"),c}const Di={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},ja={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Ga={ordinal:1,hour:0,minute:0,second:0,millisecond:0},gt=["year","month","day","hour","minute","second","millisecond"],Ja=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Xa=["year","ordinal","hour","minute","second","millisecond"];function Et(n){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[n.toLowerCase()];if(!e)throw new Dr(n);return e}function hr(n){switch(n.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Et(n)}}function Ka(n){if(Ge===void 0&&(Ge=F.now()),n.type!=="iana")return n.offset(Ge);const e=n.name;let t=hn.get(e);return t===void 0&&(t=n.offset(Ge),hn.set(e,t)),t}function mr(n,e){const t=pe(e.zone,F.defaultZone);if(!t.isValid)return w.invalid(je(t));const r=C.fromObject(e);let i,s;if(S(n.year))i=F.now();else{for(const c of gt)S(n[c])&&(n[c]=Di[c]);const o=ui(n)||fi(n);if(o)return w.invalid(o);const a=Ka(t);[i,s]=yt(n,a,t)}return new w({ts:i,zone:t,loc:r,o:s})}function pr(n,e,t){const r=S(t.round)?!0:t.round,i=S(t.rounding)?"trunc":t.rounding,s=(a,c)=>(a=Nn(a,r||t.calendary?0:2,t.calendary?"round":i),e.loc.clone(t).relFormatter(t).format(a,c)),o=a=>t.calendary?e.hasSame(n,a)?0:e.startOf(a).diff(n.startOf(a),a).get(a):e.diff(n,a).get(a);if(t.unit)return s(o(t.unit),t.unit);for(const a of t.units){const c=o(a);if(Math.abs(c)>=1)return s(c,a)}return s(n>e?-0:0,t.units[t.units.length-1])}function yr(n){let e={},t;return n.length>0&&typeof n[n.length-1]=="object"?(e=n[n.length-1],t=Array.from(n).slice(0,n.length-1)):t=Array.from(n),[e,t]}let Ge;const hn=new Map;class w{constructor(e){const t=e.zone||F.defaultZone;let r=e.invalid||(Number.isNaN(e.ts)?new ne("invalid input"):null)||(t.isValid?null:je(t));this.ts=S(e.ts)?F.now():e.ts;let i=null,s=null;if(!r)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[i,s]=[e.old.c,e.old.o];else{const a=ye(e.o)&&!e.old?e.o:t.offset(this.ts);i=ht(this.ts,a),r=Number.isNaN(i.year)?new ne("invalid input"):null,i=r?null:i,s=r?null:a}this._zone=t,this.loc=e.loc||C.create(),this.invalid=r,this.weekData=null,this.localWeekData=null,this.c=i,this.o=s,this.isLuxonDateTime=!0}static now(){return new w({})}static local(){const[e,t]=yr(arguments),[r,i,s,o,a,c,l]=t;return mr({year:r,month:i,day:s,hour:o,minute:a,second:c,millisecond:l},e)}static utc(){const[e,t]=yr(arguments),[r,i,s,o,a,c,l]=t;return e.zone=H.utcInstance,mr({year:r,month:i,day:s,hour:o,minute:a,second:c,millisecond:l},e)}static fromJSDate(e,t={}){const r=ko(e)?e.valueOf():NaN;if(Number.isNaN(r))return w.invalid("invalid input");const i=pe(t.zone,F.defaultZone);return i.isValid?new w({ts:r,zone:i,loc:C.fromObject(t)}):w.invalid(je(i))}static fromMillis(e,t={}){if(ye(e))return e<-ur||e>ur?w.invalid("Timestamp out of range"):new w({ts:e,zone:pe(t.zone,F.defaultZone),loc:C.fromObject(t)});throw new L(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(ye(e))return new w({ts:e*1e3,zone:pe(t.zone,F.defaultZone),loc:C.fromObject(t)});throw new L("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const r=pe(t.zone,F.defaultZone);if(!r.isValid)return w.invalid(je(r));const i=C.fromObject(t),s=Rt(e,hr),{minDaysInFirstWeek:o,startOfWeek:a}=Qn(s,i),c=F.now(),l=S(t.specificOffset)?r.offset(c):t.specificOffset,u=!S(s.ordinal),f=!S(s.year),m=!S(s.month)||!S(s.day),y=f||m,h=s.weekYear||s.weekNumber;if((y||u)&&h)throw new Fe("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(m&&u)throw new Fe("Can't mix ordinal dates with month/day");const E=h||s.weekday&&!y;let p,N,v=ht(c,l);E?(p=Ja,N=ja,v=bt(v,o,a)):u?(p=Xa,N=Ga,v=qt(v)):(p=gt,N=Di);let M=!1;for(const le of p){const at=s[le];S(at)?M?s[le]=N[le]:s[le]=v[le]:M=!0}const z=E?Ao(s,o,a):u?Io(s):ui(s),B=z||fi(s);if(B)return w.invalid(B);const oe=E?Xn(s,o,a):u?Kn(s):s,[W,$e]=yt(oe,l,r),se=new w({ts:W,zone:r,o:$e,loc:i});return s.weekday&&y&&e.weekday!==se.weekday?w.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${se.toISO()}`):se.isValid?se:w.invalid(se.invalid)}static fromISO(e,t={}){const[r,i]=wa(e);return ke(r,i,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[r,i]=Ta(e);return ke(r,i,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[r,i]=Sa(e);return ke(r,i,t,"HTTP",t)}static fromFormat(e,t,r={}){if(S(e)||S(t))throw new L("fromFormat requires an input string and a format");const{locale:i=null,numberingSystem:s=null}=r,o=C.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0}),[a,c,l,u]=Ya(o,e,t);return u?w.invalid(u):ke(a,c,r,`format ${t}`,e,l)}static fromString(e,t,r={}){return w.fromFormat(e,t,r)}static fromSQL(e,t={}){const[r,i]=Ia(e);return ke(r,i,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new L("need to specify a reason the DateTime is invalid");const r=e instanceof ne?e:new ne(e,t);if(F.throwOnInvalid)throw new eo(r);return new w({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const r=zi(e,C.fromObject(t));return r?r.map(i=>i?i.val:null).join(""):null}static expandFormat(e,t={}){return xi(V.parseFormat(e),C.fromObject(t)).map(i=>i.val).join("")}static resetCache(){Ge=void 0,hn.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?jt(this).weekYear:NaN}get weekNumber(){return this.isValid?jt(this).weekNumber:NaN}get weekday(){return this.isValid?jt(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Gt(this).weekday:NaN}get localWeekNumber(){return this.isValid?Gt(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Gt(this).weekYear:NaN}get ordinal(){return this.isValid?qt(this.c).ordinal:NaN}get monthShort(){return this.isValid?ft.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?ft.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?ft.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?ft.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,r=Ft(this.c),i=this.zone.offset(r-e),s=this.zone.offset(r+e),o=this.zone.offset(r-i*t),a=this.zone.offset(r-s*t);if(o===a)return[this];const c=r-o*t,l=r-a*t,u=ht(c,o),f=ht(l,a);return u.hour===f.hour&&u.minute===f.minute&&u.second===f.second&&u.millisecond===f.millisecond?[Te(this,{ts:c}),Te(this,{ts:l})]:[this]}get isInLeapYear(){return Qe(this.year)}get daysInMonth(){return Ct(this.year,this.month)}get daysInYear(){return this.isValid?Me(this.year):NaN}get weeksInWeekYear(){return this.isValid?Xe(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Xe(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:r,calendar:i}=V.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:r,outputCalendar:i}}toUTC(e=0,t={}){return this.setZone(H.instance(e),t)}toLocal(){return this.setZone(F.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:r=!1}={}){if(e=pe(e,F.defaultZone),e.equals(this.zone))return this;if(e.isValid){let i=this.ts;if(t||r){const s=e.offset(this.ts),o=this.toObject();[i]=yt(o,s,e)}return Te(this,{ts:i,zone:e})}else return w.invalid(je(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:r}={}){const i=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:r});return Te(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=Rt(e,hr),{minDaysInFirstWeek:r,startOfWeek:i}=Qn(t,this.loc),s=!S(t.weekYear)||!S(t.weekNumber)||!S(t.weekday),o=!S(t.ordinal),a=!S(t.year),c=!S(t.month)||!S(t.day),l=a||c,u=t.weekYear||t.weekNumber;if((l||o)&&u)throw new Fe("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&o)throw new Fe("Can't mix ordinal dates with month/day");let f;s?f=Xn({...bt(this.c,r,i),...t},r,i):S(t.ordinal)?(f={...this.toObject(),...t},S(t.day)&&(f.day=Math.min(Ct(f.year,f.month),f.day))):f=Kn({...qt(this.c),...t});const[m,y]=yt(f,this.o,this.zone);return Te(this,{ts:m,o:y})}plus(e){if(!this.isValid)return this;const t=O.fromDurationLike(e);return Te(this,fr(this,t))}minus(e){if(!this.isValid)return this;const t=O.fromDurationLike(e).negate();return Te(this,fr(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const r={},i=O.normalizeUnit(e);switch(i){case"years":r.month=1;case"quarters":case"months":r.day=1;case"weeks":case"days":r.hour=0;case"hours":r.minute=0;case"minutes":r.second=0;case"seconds":r.millisecond=0;break}if(i==="weeks")if(t){const s=this.loc.getStartOfWeek(),{weekday:o}=this;o<s&&(r.weekNumber=this.weekNumber-1),r.weekday=s}else r.weekday=1;if(i==="quarters"){const s=Math.ceil(this.month/3);r.month=(s-1)*3+1}return this.set(r)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?V.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Yt}toLocaleString(e=Ot,t={}){return this.isValid?V.create(this.loc.clone(t),e).formatDateTime(this):Yt}toLocaleParts(e={}){return this.isValid?V.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:r=!1,includeOffset:i=!0,extendedZone:s=!1,precision:o="milliseconds"}={}){if(!this.isValid)return null;o=Et(o);const a=e==="extended";let c=Jt(this,a,o);return gt.indexOf(o)>=3&&(c+="T"),c+=dr(this,a,t,r,i,s,o),c}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?Jt(this,e==="extended",Et(t)):null}toISOWeekDate(){return mt(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:r=!0,includePrefix:i=!1,extendedZone:s=!1,format:o="extended",precision:a="milliseconds"}={}){return this.isValid?(a=Et(a),(i&&gt.indexOf(a)>=3?"T":"")+dr(this,o==="extended",t,e,r,s,a)):null}toRFC2822(){return mt(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return mt(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Jt(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:r=!0}={}){let i="HH:mm:ss.SSS";return(t||e)&&(r&&(i+=" "),t?i+="z":e&&(i+="ZZ")),mt(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Yt}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",r={}){if(!this.isValid||!e.isValid)return O.invalid("created by diffing an invalid DateTime");const i={locale:this.locale,numberingSystem:this.numberingSystem,...r},s=Fo(t).map(O.normalizeUnit),o=e.valueOf()>this.valueOf(),a=o?this:e,c=o?e:this,l=_a(a,c,s,i);return o?l.negate():l}diffNow(e="milliseconds",t={}){return this.diff(w.now(),e,t)}until(e){return this.isValid?k.fromDateTimes(this,e):this}hasSame(e,t,r){if(!this.isValid)return!1;const i=e.valueOf(),s=this.setZone(e.zone,{keepLocalTime:!0});return s.startOf(t,r)<=i&&i<=s.endOf(t,r)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||w.fromObject({},{zone:this.zone}),r=e.padding?this<t?-e.padding:e.padding:0;let i=["years","months","days","hours","minutes","seconds"],s=e.unit;return Array.isArray(e.unit)&&(i=e.unit,s=void 0),pr(t,this.plus(r),{...e,numeric:"always",units:i,unit:s})}toRelativeCalendar(e={}){return this.isValid?pr(e.base||w.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(w.isDateTime))throw new L("min requires all arguments be DateTimes");return er(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(w.isDateTime))throw new L("max requires all arguments be DateTimes");return er(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,r={}){const{locale:i=null,numberingSystem:s=null}=r,o=C.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});return Pi(o,e,t)}static fromStringExplain(e,t,r={}){return w.fromFormatExplain(e,t,r)}static buildFormatParser(e,t={}){const{locale:r=null,numberingSystem:i=null}=t,s=C.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});return new _i(s,e)}static fromFormatParser(e,t,r={}){if(S(e)||S(t))throw new L("fromFormatParser requires an input string and a format parser");const{locale:i=null,numberingSystem:s=null}=r,o=C.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});if(!o.equals(t.locale))throw new L(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${t.locale}`);const{result:a,zone:c,specificOffset:l,invalidReason:u}=t.explainFromTokens(e);return u?w.invalid(u):ke(a,c,r,`format ${t.format}`,e,l)}static get DATE_SHORT(){return Ot}static get DATE_MED(){return Vr}static get DATE_MED_WITH_WEEKDAY(){return ro}static get DATE_FULL(){return Ur}static get DATE_HUGE(){return $r}static get TIME_SIMPLE(){return Hr}static get TIME_WITH_SECONDS(){return Br}static get TIME_WITH_SHORT_OFFSET(){return Wr}static get TIME_WITH_LONG_OFFSET(){return qr}static get TIME_24_SIMPLE(){return Zr}static get TIME_24_WITH_SECONDS(){return Yr}static get TIME_24_WITH_SHORT_OFFSET(){return jr}static get TIME_24_WITH_LONG_OFFSET(){return Gr}static get DATETIME_SHORT(){return Jr}static get DATETIME_SHORT_WITH_SECONDS(){return Xr}static get DATETIME_MED(){return Kr}static get DATETIME_MED_WITH_SECONDS(){return Qr}static get DATETIME_MED_WITH_WEEKDAY(){return io}static get DATETIME_FULL(){return ei}static get DATETIME_FULL_WITH_SECONDS(){return ti}static get DATETIME_HUGE(){return ni}static get DATETIME_HUGE_WITH_SECONDS(){return ri}}function qe(n){if(w.isDateTime(n))return n;if(n&&n.valueOf&&ye(n.valueOf()))return w.fromJSDate(n);if(n&&typeof n=="object")return w.fromObject(n);throw new L(`Unknown datetime argument: ${n}, of type ${typeof n}`)}const Qa=["dd/MM/yyyy","d/M/yyyy","dd-MM-yyyy","d-M-yyyy","yyyy-MM-dd","yyyy/MM/dd","dd/MM/yyyy HH:mm:ss","yyyy-MM-dd HH:mm:ss"];function D(n){if(!n)return null;const e=n.trim();if(!e)return null;const t=w.fromISO(e);if(t.isValid)return t;for(const s of Qa){const o=w.fromFormat(e,s);if(o.isValid)return o}const r=w.fromRFC2822(e);if(r.isValid)return r;const i=w.fromHTTP(e);return i.isValid?i:null}class _t{parser=new Lr({ignoreAttributes:!1,attributeNamePrefix:""});constructor(){}checkResponseStatus(e){const{status:t,data:r,errors:i}=e;if(t>=200&&t<300)return!0;let s;const o=this.extractXmlData(r);if(o)try{s=this.parseXml(o,i)||void 0}catch(c){console.log("Error parsing error response XML:",c)}const a=s?.Risposta?.Testata?.Messaggio?.DescrizioneErrore;switch(t){case 400:return I(i,R.BAD_REQUEST,[],A.BAD_REQUEST+(a?`: ${a}`:"")),!1;case 402:return I(i,R.INSUFFICIENT_CREDIT,[],A.INSUFFICIENT_CREDIT),!1;case 404:return I(i,R.COMPANY_NOT_FOUND,[],A.COMPANY_NOT_FOUND),!1;case 503:return I(i,R.SERVICE_UNAVAILABLE,[],A.SERVICE_UNAVAILABLE),!1;case 500:return I(i,R.HTTP_ERROR,[],A.HTTP_ERROR+(a?`: ${a}`:"")),!1;default:return I(i,R.HTTP_ERROR,[],A.HTTP_ERROR+(a?`: ${a}`:"")),!1}}parseXml(e,t){try{return this.parser.parse(e)}catch(r){return console.log(r),I(t,R.XML_PARSE_ERROR,[],A.XML_PARSE_ERROR),null}}extractXmlData(e){return typeof e=="string"?e:e instanceof ArrayBuffer?new TextDecoder().decode(new Uint8Array(e)):ArrayBuffer.isView(e)?new TextDecoder().decode(e):null}}class ec extends _t{constructor(e){super(),this.client=e}async getCompanySummaryByVatNumber(e,t){try{const r=await this.client.get("/registroimprese/imprese/ricerca/partitaiva",{params:{partitaIva:e,fSoloSedi:"S",responseType:"text"}});if(!this.checkResponseStatus({status:r.status,data:r.data,errors:t}))return null;const i=this.parseXml(r.data,t);if(!i)return null;const s=i.Risposta?.ListaImpreseRI?.Impresa?.AnagraficaImpresa;return s?new Pn().mapAnagraficaImpresaToCompanySummary(s):(I(t,R.COMPANY_NOT_FOUND,["vatNumber"],A.COMPANY_NOT_FOUND),null)}catch(r){return console.log(r),I(t,R.COMPANY_SUMMARY_FETCH_FAILED,["vatNumber"],A.COMPANY_SUMMARY_FETCH_FAILED),null}}async getFinancialsByVatNumber(e,t){try{const r=await this.client.get("/registroimprese/bilanci/xbrl/codicefiscale",{params:{codiceFiscale:e,allXbrl:"S",responseType:"text"}});if(!this.checkResponseStatus({status:r.status,data:r.data,errors:t}))return null;const i=this.parseXml(r.data,t);return i?await new Xs().getFinancialValues(i,t):null}catch(r){return console.log(r),I(t,R.FINANCIALS_FETCH_FAILED,["vatNumber"],A.FINANCIALS_FETCH_FAILED),null}}async getSharesByRea(e,t,r){try{const i=await this.client.get("/registroimprese/output/impresa/soci/nrea/xml",{params:{cciaa:e,nRea:t},responseType:"text"});if(!this.checkResponseStatus({status:i.status,data:i.data,errors:r}))return[];const s=this.parseXml(i.data,r);if(!s)return[];const o=new Qs,a=o.parseCapital(s.Risposta.dati["blocchi-impresa"]["sintesi-cifre-impresa"]["capitale-sociale"].sottoscritto.ammontare),c=s.Risposta.dati["blocchi-impresa"]["elenco-soci"].riquadri.riquadro;return o.getShares(c,a)}catch(i){return console.log(i),I(r,R.SHARES_FETCH_FAILED,["companyShares"],A.SHARES_FETCH_FAILED),[]}}async getCompanyByRea(e,t,r,i){try{const s=await this.client.get("/registroimprese/output/impresa/blocchi/nrea/xml",{params:{cciaa:e,nRea:t,blocco:r},responseType:"text"});if(!this.checkResponseStatus({status:s.status,data:s.data,errors:i}))return;const o=this.parseXml(s.data,i);if(!o)return;const a=new Pn;if(r==="AMM")return await a.mapRegistroImpresaToCompanyAdministrativeSummary(o)}catch(s){console.log(s),I(i,R.HTTP_ERROR,["companyIncorporationDate"],A.HTTP_ERROR)}}async getCompany(e){const t=[],r=await this.getCompanySummaryByVatNumber(e,t);if(!r)return null;const i=await this.getFinancialsByVatNumber(e,t)??{companyRevenue:0,companyProfit:0};let s=[];r.companyCciaaCode&&r.companyReaNumber?s=await this.getSharesByRea(r.companyCciaaCode,r.companyReaNumber,t):I(t,R.MISSING_CCIAA_OR_REA,[],A.MISSING_CCIAA_OR_REA);let o;r.companyCciaaCode&&r.companyReaNumber?o=await this.getCompanyByRea(r.companyCciaaCode,r.companyReaNumber,"AMM",t):I(t,R.MISSING_CCIAA_OR_REA,[],A.MISSING_CCIAA_OR_REA);const a=o?.identification.constitutionDate;return{...r,...i,companyShares:s,companyIncorporationDate:D(a),aiwsError:t}}}function Vi(n,e){return function(){return n.apply(e,arguments)}}const{toString:tc}=Object.prototype,{getPrototypeOf:Rn}=Object,{iterator:Pt,toStringTag:Ui}=Symbol,zt=(n=>e=>{const t=tc.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),ie=n=>(n=n.toLowerCase(),e=>zt(e)===n),Lt=n=>e=>typeof e===n,{isArray:Ue}=Array,Pe=Lt("undefined");function nt(n){return n!==null&&!Pe(n)&&n.constructor!==null&&!Pe(n.constructor)&&Y(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const $i=ie("ArrayBuffer");function nc(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&$i(n.buffer),e}const rc=Lt("string"),Y=Lt("function"),Hi=Lt("number"),rt=n=>n!==null&&typeof n=="object",ic=n=>n===!0||n===!1,wt=n=>{if(zt(n)!=="object")return!1;const e=Rn(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Ui in n)&&!(Pt in n)},sc=n=>{if(!rt(n)||nt(n))return!1;try{return Object.keys(n).length===0&&Object.getPrototypeOf(n)===Object.prototype}catch{return!1}},oc=ie("Date"),ac=ie("File"),cc=ie("Blob"),lc=ie("FileList"),uc=n=>rt(n)&&Y(n.pipe),fc=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||Y(n.append)&&((e=zt(n))==="formdata"||e==="object"&&Y(n.toString)&&n.toString()==="[object FormData]"))},dc=ie("URLSearchParams"),[hc,mc,pc,yc]=["ReadableStream","Request","Response","Headers"].map(ie),gc=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function it(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let r,i;if(typeof n!="object"&&(n=[n]),Ue(n))for(r=0,i=n.length;r<i;r++)e.call(null,n[r],r,n);else{if(nt(n))return;const s=t?Object.getOwnPropertyNames(n):Object.keys(n),o=s.length;let a;for(r=0;r<o;r++)a=s[r],e.call(null,n[a],a,n)}}function Bi(n,e){if(nt(n))return null;e=e.toLowerCase();const t=Object.keys(n);let r=t.length,i;for(;r-- >0;)if(i=t[r],e===i.toLowerCase())return i;return null}const Oe=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Wi=n=>!Pe(n)&&n!==Oe;function mn(){const{caseless:n,skipUndefined:e}=Wi(this)&&this||{},t={},r=(i,s)=>{if(s==="__proto__"||s==="constructor"||s==="prototype")return;const o=n&&Bi(t,s)||s;wt(t[o])&&wt(i)?t[o]=mn(t[o],i):wt(i)?t[o]=mn({},i):Ue(i)?t[o]=i.slice():(!e||!Pe(i))&&(t[o]=i)};for(let i=0,s=arguments.length;i<s;i++)arguments[i]&&it(arguments[i],r);return t}const Ec=(n,e,t,{allOwnKeys:r}={})=>(it(e,(i,s)=>{t&&Y(i)?Object.defineProperty(n,s,{value:Vi(i,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(n,s,{value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),n),wc=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),Tc=(n,e,t,r)=>{n.prototype=Object.create(e.prototype,r),Object.defineProperty(n.prototype,"constructor",{value:n,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},Sc=(n,e,t,r)=>{let i,s,o;const a={};if(e=e||{},n==null)return e;do{for(i=Object.getOwnPropertyNames(n),s=i.length;s-- >0;)o=i[s],(!r||r(o,n,e))&&!a[o]&&(e[o]=n[o],a[o]=!0);n=t!==!1&&Rn(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},Nc=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const r=n.indexOf(e,t);return r!==-1&&r===t},Oc=n=>{if(!n)return null;if(Ue(n))return n;let e=n.length;if(!Hi(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},bc=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&Rn(Uint8Array)),Cc=(n,e)=>{const r=(n&&n[Pt]).call(n);let i;for(;(i=r.next())&&!i.done;){const s=i.value;e.call(n,s[0],s[1])}},Rc=(n,e)=>{let t;const r=[];for(;(t=n.exec(e))!==null;)r.push(t);return r},Ac=ie("HTMLFormElement"),Ic=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,r,i){return r.toUpperCase()+i}),gr=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),vc=ie("RegExp"),qi=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),r={};it(t,(i,s)=>{let o;(o=e(i,s,n))!==!1&&(r[s]=o||i)}),Object.defineProperties(n,r)},kc=n=>{qi(n,(e,t)=>{if(Y(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const r=n[t];if(Y(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},Fc=(n,e)=>{const t={},r=i=>{i.forEach(s=>{t[s]=!0})};return Ue(n)?r(n):r(String(n).split(e)),t},Mc=()=>{},xc=(n,e)=>n!=null&&Number.isFinite(n=+n)?n:e;function _c(n){return!!(n&&Y(n.append)&&n[Ui]==="FormData"&&n[Pt])}const Pc=n=>{const e=new Array(10),t=(r,i)=>{if(rt(r)){if(e.indexOf(r)>=0)return;if(nt(r))return r;if(!("toJSON"in r)){e[i]=r;const s=Ue(r)?[]:{};return it(r,(o,a)=>{const c=t(o,i+1);!Pe(c)&&(s[a]=c)}),e[i]=void 0,s}}return r};return t(n,0)},zc=ie("AsyncFunction"),Lc=n=>n&&(rt(n)||Y(n))&&Y(n.then)&&Y(n.catch),Zi=((n,e)=>n?setImmediate:e?((t,r)=>(Oe.addEventListener("message",({source:i,data:s})=>{i===Oe&&s===t&&r.length&&r.shift()()},!1),i=>{r.push(i),Oe.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Y(Oe.postMessage)),Dc=typeof queueMicrotask<"u"?queueMicrotask.bind(Oe):typeof process<"u"&&process.nextTick||Zi,Vc=n=>n!=null&&Y(n[Pt]),d={isArray:Ue,isArrayBuffer:$i,isBuffer:nt,isFormData:fc,isArrayBufferView:nc,isString:rc,isNumber:Hi,isBoolean:ic,isObject:rt,isPlainObject:wt,isEmptyObject:sc,isReadableStream:hc,isRequest:mc,isResponse:pc,isHeaders:yc,isUndefined:Pe,isDate:oc,isFile:ac,isBlob:cc,isRegExp:vc,isFunction:Y,isStream:uc,isURLSearchParams:dc,isTypedArray:bc,isFileList:lc,forEach:it,merge:mn,extend:Ec,trim:gc,stripBOM:wc,inherits:Tc,toFlatObject:Sc,kindOf:zt,kindOfTest:ie,endsWith:Nc,toArray:Oc,forEachEntry:Cc,matchAll:Rc,isHTMLForm:Ac,hasOwnProperty:gr,hasOwnProp:gr,reduceDescriptors:qi,freezeMethods:kc,toObjectSet:Fc,toCamelCase:Ic,noop:Mc,toFiniteNumber:xc,findKey:Bi,global:Oe,isContextDefined:Wi,isSpecCompliantForm:_c,toJSONObject:Pc,isAsyncFn:zc,isThenable:Lc,setImmediate:Zi,asap:Dc,isIterable:Vc};let T=class Yi extends Error{static from(e,t,r,i,s,o){const a=new Yi(e.message,t||e.code,r,i,s);return a.cause=e,a.name=e.name,o&&Object.assign(a,o),a}constructor(e,t,r,i,s){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),s&&(this.response=s,this.status=s.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:d.toJSONObject(this.config),code:this.code,status:this.status}}};T.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";T.ERR_BAD_OPTION="ERR_BAD_OPTION";T.ECONNABORTED="ECONNABORTED";T.ETIMEDOUT="ETIMEDOUT";T.ERR_NETWORK="ERR_NETWORK";T.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";T.ERR_DEPRECATED="ERR_DEPRECATED";T.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";T.ERR_BAD_REQUEST="ERR_BAD_REQUEST";T.ERR_CANCELED="ERR_CANCELED";T.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";T.ERR_INVALID_URL="ERR_INVALID_URL";const Uc=null;function pn(n){return d.isPlainObject(n)||d.isArray(n)}function ji(n){return d.endsWith(n,"[]")?n.slice(0,-2):n}function Er(n,e,t){return n?n.concat(e).map(function(i,s){return i=ji(i),!t&&s?"["+i+"]":i}).join(t?".":""):e}function $c(n){return d.isArray(n)&&!n.some(pn)}const Hc=d.toFlatObject(d,{},null,function(e){return/^is[A-Z]/.test(e)});function Dt(n,e,t){if(!d.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=d.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(E,p){return!d.isUndefined(p[E])});const r=t.metaTokens,i=t.visitor||u,s=t.dots,o=t.indexes,c=(t.Blob||typeof Blob<"u"&&Blob)&&d.isSpecCompliantForm(e);if(!d.isFunction(i))throw new TypeError("visitor must be a function");function l(h){if(h===null)return"";if(d.isDate(h))return h.toISOString();if(d.isBoolean(h))return h.toString();if(!c&&d.isBlob(h))throw new T("Blob is not supported. Use a Buffer instead.");return d.isArrayBuffer(h)||d.isTypedArray(h)?c&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function u(h,E,p){let N=h;if(h&&!p&&typeof h=="object"){if(d.endsWith(E,"{}"))E=r?E:E.slice(0,-2),h=JSON.stringify(h);else if(d.isArray(h)&&$c(h)||(d.isFileList(h)||d.endsWith(E,"[]"))&&(N=d.toArray(h)))return E=ji(E),N.forEach(function(M,z){!(d.isUndefined(M)||M===null)&&e.append(o===!0?Er([E],z,s):o===null?E:E+"[]",l(M))}),!1}return pn(h)?!0:(e.append(Er(p,E,s),l(h)),!1)}const f=[],m=Object.assign(Hc,{defaultVisitor:u,convertValue:l,isVisitable:pn});function y(h,E){if(!d.isUndefined(h)){if(f.indexOf(h)!==-1)throw Error("Circular reference detected in "+E.join("."));f.push(h),d.forEach(h,function(N,v){(!(d.isUndefined(N)||N===null)&&i.call(e,N,d.isString(v)?v.trim():v,E,m))===!0&&y(N,E?E.concat(v):[v])}),f.pop()}}if(!d.isObject(n))throw new TypeError("data must be an object");return y(n),e}function wr(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function An(n,e){this._pairs=[],n&&Dt(n,this,e)}const Gi=An.prototype;Gi.append=function(e,t){this._pairs.push([e,t])};Gi.toString=function(e){const t=e?function(r){return e.call(this,r,wr)}:wr;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function Bc(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ji(n,e,t){if(!e)return n;const r=t&&t.encode||Bc,i=d.isFunction(t)?{serialize:t}:t,s=i&&i.serialize;let o;if(s?o=s(e,i):o=d.isURLSearchParams(e)?e.toString():new An(e,i).toString(r),o){const a=n.indexOf("#");a!==-1&&(n=n.slice(0,a)),n+=(n.indexOf("?")===-1?"?":"&")+o}return n}class Tr{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){d.forEach(this.handlers,function(r){r!==null&&e(r)})}}const In={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Wc=typeof URLSearchParams<"u"?URLSearchParams:An,qc=typeof FormData<"u"?FormData:null,Zc=typeof Blob<"u"?Blob:null,Yc={isBrowser:!0,classes:{URLSearchParams:Wc,FormData:qc,Blob:Zc},protocols:["http","https","file","blob","url","data"]},vn=typeof window<"u"&&typeof document<"u",yn=typeof navigator=="object"&&navigator||void 0,jc=vn&&(!yn||["ReactNative","NativeScript","NS"].indexOf(yn.product)<0),Gc=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Jc=vn&&window.location.href||"http://localhost",Xc=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:vn,hasStandardBrowserEnv:jc,hasStandardBrowserWebWorkerEnv:Gc,navigator:yn,origin:Jc},Symbol.toStringTag,{value:"Module"})),U={...Xc,...Yc};function Kc(n,e){return Dt(n,new U.classes.URLSearchParams,{visitor:function(t,r,i,s){return U.isNode&&d.isBuffer(t)?(this.append(r,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},...e})}function Qc(n){return d.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function el(n){const e={},t=Object.keys(n);let r;const i=t.length;let s;for(r=0;r<i;r++)s=t[r],e[s]=n[s];return e}function Xi(n){function e(t,r,i,s){let o=t[s++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=s>=t.length;return o=!o&&d.isArray(i)?i.length:o,c?(d.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!a):((!i[o]||!d.isObject(i[o]))&&(i[o]=[]),e(t,r,i[o],s)&&d.isArray(i[o])&&(i[o]=el(i[o])),!a)}if(d.isFormData(n)&&d.isFunction(n.entries)){const t={};return d.forEachEntry(n,(r,i)=>{e(Qc(r),i,t,0)}),t}return null}function tl(n,e,t){if(d.isString(n))try{return(e||JSON.parse)(n),d.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}const st={transitional:In,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",i=r.indexOf("application/json")>-1,s=d.isObject(e);if(s&&d.isHTMLForm(e)&&(e=new FormData(e)),d.isFormData(e))return i?JSON.stringify(Xi(e)):e;if(d.isArrayBuffer(e)||d.isBuffer(e)||d.isStream(e)||d.isFile(e)||d.isBlob(e)||d.isReadableStream(e))return e;if(d.isArrayBufferView(e))return e.buffer;if(d.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Kc(e,this.formSerializer).toString();if((a=d.isFileList(e))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Dt(a?{"files[]":e}:e,c&&new c,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),tl(e)):e}],transformResponse:[function(e){const t=this.transitional||st.transitional,r=t&&t.forcedJSONParsing,i=this.responseType==="json";if(d.isResponse(e)||d.isReadableStream(e))return e;if(e&&d.isString(e)&&(r&&!this.responseType||i)){const o=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(a){if(o)throw a.name==="SyntaxError"?T.from(a,T.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:U.classes.FormData,Blob:U.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};d.forEach(["delete","get","head","post","put","patch"],n=>{st.headers[n]={}});const nl=d.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),rl=n=>{const e={};let t,r,i;return n&&n.split(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var R=(n=>(n.COMPANY_SUMMARY_FETCH_FAILED="COMPANY_SUMMARY_FETCH_FAILED",n.FINANCIALS_FETCH_FAILED="FINANCIALS_FETCH_FAILED",n.SHARES_FETCH_FAILED="SHARES_FETCH_FAILED",n.PERSONA_DATA_FETCH_FAILED="PERSONA_DATA_FETCH_FAILED",n.PERSON_CORPORATE_HOLDINGS_FETCH_FAILED="PERSON_CORPORATE_HOLDINGS_FETCH_FAILED",n.CORPORATE_HOLDINGS_NOT_FOUND="CORPORATE_HOLDINGS_NOT_FOUND",n.PROTESTS_FETCH_FAILED="PROTESTS_FETCH_FAILED",n.MISSING_CCIAA_OR_REA="MISSING_CCIAA_OR_REA",n.COMPANY_NOT_FOUND="COMPANY_NOT_FOUND",n.PERSONA_DATA_NOT_FOUND="PERSONA_DATA_NOT_FOUND",n.INSUFFICIENT_CREDIT="INSUFFICIENT_CREDIT",n.SERVICE_UNAVAILABLE="SERVICE_UNAVAILABLE",n.HTTP_ERROR="HTTP_ERROR",n.BAD_REQUEST="BAD_REQUEST",n.XML_PARSE_ERROR="XML_PARSE_ERROR",n.XBRL_EMPTY="XBRL_EMPTY",n.XBRL_DECODE_ERROR="XBRL_DECODE_ERROR",n.XBRL_MAPPING_ERROR="XBRL_MAPPING_ERROR",n))(R||{});const A={COMPANY_SUMMARY_FETCH_FAILED:"Errore nel recupero anagrafica impresa",FINANCIALS_FETCH_FAILED:"Errore nel recupero dati finanziari",PERSONA_DATA_FETCH_FAILED:"Errore nel recupero dati persona",SHARES_FETCH_FAILED:"Errore nel recupero quote societarie",PROTESTS_FETCH_FAILED:"Errore nel recupero protesti",PERSON_CORPORATE_HOLDINGS_FETCH_FAILED:"Errore nel recupero partecipazioni societarie",CORPORATE_HOLDINGS_NOT_FOUND:"Partecipazioni societarie non trovate",MISSING_CCIAA_OR_REA:"Impossibile recuperare quote societarie: CCIAA o REA mancanti",COMPANY_NOT_FOUND:"Impresa non trovata",SERVICE_UNAVAILABLE:"Servizio temporaneamente non disponibile",HTTP_ERROR:"Errore HTTP del servizio",BAD_REQUEST:"Richiesta non valida",XML_PARSE_ERROR:"Errore nel parsing XML",XBRL_EMPTY:"Impossibile recuperare i dati finanziari. Errore nel recupero del file XBRL.",XBRL_DECODE_ERROR:"Impossibile recuperare i dati finanziari. Errore nella decodifica del file XBRL.",XBRL_MAPPING_ERROR:"Impossibile recuperare i dati finanziari. Errore nella mappaggio del file XBRL.",INSUFFICIENT_CREDIT:"Credito insufficiente per procedere",PERSONA_DATA_NOT_FOUND:"Dati persona non trovati"};function I(n,e,t,r){n.push({code:e,fields:t,message:r})}class _n{async mapAnagraficaImpresaToCompanySummary(e,t=[]){return e?(e.Denominazione||I(t,R.COMPANY_SUMMARY_FETCH_FAILED,["companyName"],A.COMPANY_SUMMARY_FETCH_FAILED),e.PIva||I(t,R.COMPANY_SUMMARY_FETCH_FAILED,["vatNumber"],A.COMPANY_SUMMARY_FETCH_FAILED),e.Cciaa||I(t,R.COMPANY_SUMMARY_FETCH_FAILED,[],A.COMPANY_SUMMARY_FETCH_FAILED),{companyName:e.Denominazione||"",companyFiscalCode:e.CodFisc||"",companyVatNumber:e.PIva||"",companyLegalFormCode:e.NatGiu||"",companyLegalFormDescription:e.DescNatGiu||"",companyCciaaCode:e.Cciaa||"",companyCciaaDescription:e.DescCciaa||"",companyReaNumber:e.NRea||0,companyStatusCode:e.StatoAttivita||"",companyStatusDescription:e.DescStatoAttivita||"",companyRegistryStatusCode:e.StatoAttivitaReg||"",companyRegistryStatusDescription:e.DescStatoAttivitaReg||"",companySourceCode:e.Fonte||"",companySourceDescription:e.DescFonte||"",companyDeclaredActivity:e.AttivitaDichiarata||"",companyAtecoCode:e.ClassificazioneAteco?.CodAttivita||"",companyAtecoDescription:e.ClassificazioneAteco?.DescAttivita||"",companyAtecoClassificationCode:e.ClassificazioneAteco?.CodCodifica||0,companyAtecoClassificationDescription:e.ClassificazioneAteco?.DescCodifica||"",companyProvinceCode:e.IndirizzoSede?.SglPrvSede||"",companyProvinceDescription:e.IndirizzoSede?.DescPrvSede||"",companyMunicipalityCode:e.IndirizzoSede?.CodComSede||"",companyMunicipalityDescription:e.IndirizzoSede?.DescComSede||"",companyToponymCode:e.IndirizzoSede?.CodToponSede||"",companyToponymDescription:e.IndirizzoSede?.DescToponSede||"",companyStreet:e.IndirizzoSede?.ViaSede||"",companyStreetNumber:String(e.IndirizzoSede?.NCivicoSede||""),companyPostalCode:e.IndirizzoSede?.CapSede||0,companyPec:e.IndirizzoPostaCertificata||"",companyProfit:null,companyRevenue:null,companyIncorporationDate:null,companyShares:null,aiwsError:t}):(I(t,R.COMPANY_SUMMARY_FETCH_FAILED,[],A.COMPANY_SUMMARY_FETCH_FAILED),{companyName:"",companyFiscalCode:"",companyVatNumber:"",companyLegalFormCode:"",companyLegalFormDescription:"",companyCciaaCode:"",companyCciaaDescription:"",companyReaNumber:0,companyStatusCode:"",companyStatusDescription:"",companyRegistryStatusCode:"",companyRegistryStatusDescription:"",companySourceCode:"",companySourceDescription:"",companyDeclaredActivity:"",companyAtecoCode:"",companyAtecoDescription:"",companyAtecoClassificationCode:0,companyAtecoClassificationDescription:"",companyProvinceCode:"",companyProvinceDescription:"",companyMunicipalityCode:"",companyMunicipalityDescription:"",companyToponymCode:"",companyToponymDescription:"",companyStreet:"",companyStreetNumber:"",companyPostalCode:0,companyPec:"",companyProfit:null,companyRevenue:null,companyIncorporationDate:null,companyShares:null,aiwsError:t})}async mapRegistroImpresaToCompanyAdministrativeSummary(e){const t=e.Risposta.dati;return{identification:{activityStatus:{text:t["blocchi-impresa"]["dati-identificativi"]["stato-attivita"]["#text"],code:t["blocchi-impresa"]["dati-identificativi"]["stato-attivita"].c},legalForm:{text:t["blocchi-impresa"]["dati-identificativi"]["forma-giuridica"]["#text"],code:t["blocchi-impresa"]["dati-identificativi"]["forma-giuridica"].c},locationAddress:{street:t["blocchi-impresa"]["dati-identificativi"]["indirizzo-localizzazione"].via,streetNumber:t["blocchi-impresa"]["dati-identificativi"]["indirizzo-localizzazione"]["n-civico"],city:t["blocchi-impresa"]["dati-identificativi"]["indirizzo-localizzazione"].comune,province:t["blocchi-impresa"]["dati-identificativi"]["indirizzo-localizzazione"].provincia,postalCode:t["blocchi-impresa"]["dati-identificativi"]["indirizzo-localizzazione"].cap,topographyCode:t["blocchi-impresa"]["dati-identificativi"]["indirizzo-localizzazione"]["c-toponimo"],topographyName:t["blocchi-impresa"]["dati-identificativi"]["indirizzo-localizzazione"].toponimo},certifiedEmail:t["blocchi-impresa"]["dati-identificativi"]["indirizzo-posta-certificata"],representatives:{representative:t["blocchi-impresa"]["dati-identificativi"]["persone-rappresentanti"]["persona-rappresentante"]},isInterchamberOffice:t["blocchi-impresa"]["dati-identificativi"]["f-sede-intercamerale"],sourceCode:t["blocchi-impresa"]["dati-identificativi"]["c-fonte"],sourceName:t["blocchi-impresa"]["dati-identificativi"].fonte,subjectType:t["blocchi-impresa"]["dati-identificativi"]["tipo-soggetto"],subjectTypeDescription:t["blocchi-impresa"]["dati-identificativi"]["descrizione-tipo-soggetto"],companyType:t["blocchi-impresa"]["dati-identificativi"]["tipo-impresa"],companyTypeDescription:t["blocchi-impresa"]["dati-identificativi"]["descrizione-tipo-impresa"],registrationDate:t["blocchi-impresa"]["dati-identificativi"]["dt-iscrizione-ri"],constitutionDate:t["blocchi-impresa"]["dati-identificativi"]["dt-atto-costituzione"],lastProtocolDate:t["blocchi-impresa"]["dati-identificativi"]["dt-ultimo-protocollo"],lastProtocolProcessedDate:t["blocchi-impresa"]["dati-identificativi"]["dt-mod-ultimo-protocollo-evaso"],companyName:t["blocchi-impresa"]["dati-identificativi"].denominazione,taxCode:t["blocchi-impresa"]["dati-identificativi"]["c-fiscale"],vatNumber:t["blocchi-impresa"]["dati-identificativi"]["partita-iva"],chamberCode:t["blocchi-impresa"]["dati-identificativi"]["c-cciaa-competente"],chamberName:t["blocchi-impresa"]["dati-identificativi"]["cciaa-competente"],chamberAbbreviation:t["blocchi-impresa"]["dati-identificativi"].cciaa,reaNumber:t["blocchi-impresa"]["dati-identificativi"]["n-rea"]},activitySummary:{mainActivityDescription:t["blocchi-impresa"]["sintesi-attivita"]["attivita-prevalente-r"],atecoClassification:{activityCode:t["blocchi-impresa"]["sintesi-attivita"]["classificazione-ateco"]?t["blocchi-impresa"]["sintesi-attivita"]["classificazione-ateco"]["c-attivita"]:"",naceCode:t["blocchi-impresa"]["sintesi-attivita"]["classificazione-ateco"]?t["blocchi-impresa"]["sintesi-attivita"]["classificazione-ateco"]["c-nace"]:""},startDate:t["blocchi-impresa"]["sintesi-attivita"]["dt-inizio"]},officePersons:{person:t["blocchi-impresa"]["persone-sede"].persona},administrationControl:t["blocchi-impresa"]["amministrazione-controllo"]}}}const xr=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",cs=xr+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",ls="["+xr+"]["+cs+"]*",us=new RegExp("^"+ls+"$");function Pr(n,e){const t=[];let r=e.exec(n);for(;r;){const i=[];i.startIndex=e.lastIndex-r[0].length;const s=r.length;for(let o=0;o<s;o++)i.push(r[o]);t.push(i),r=e.exec(n)}return t}const It=function(n){const e=us.exec(n);return!(e===null||typeof e>"u")};function fs(n){return typeof n<"u"}const ds={allowBooleanAttributes:!1,unpairedTags:[]};function hs(n,e){e=Object.assign({},ds,e);const t=[];let r=!1,i=!1;n[0]==="\uFEFF"&&(n=n.substr(1));for(let s=0;s<n.length;s++)if(n[s]==="<"&&n[s+1]==="?"){if(s+=2,s=Dn(n,s),s.err)return s}else if(n[s]==="<"){let o=s;if(s++,n[s]==="!"){s=Ln(n,s);continue}else{let a=!1;n[s]==="/"&&(a=!0,s++);let c="";for(;s<n.length&&n[s]!==">"&&n[s]!==" "&&n[s]!==" "&&n[s]!==`
2
+ `&&n[s]!=="\r";s++)c+=n[s];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),s--),!Ss(c)){let f;return c.trim().length===0?f="Invalid space after '<'.":f="Tag '"+c+"' is an invalid name.",P("InvalidTag",f,H(n,s))}const l=ys(n,s);if(l===!1)return P("InvalidAttr","Attributes for '"+c+"' have open quote.",H(n,s));let u=l.value;if(s=l.index,u[u.length-1]==="/"){const f=s-u.length;u=u.substring(0,u.length-1);const y=Vn(u,e);if(y===!0)r=!0;else return P(y.err.code,y.err.msg,H(n,f+y.err.line))}else if(a)if(l.tagClosed){if(u.trim().length>0)return P("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",H(n,o));if(t.length===0)return P("InvalidTag","Closing tag '"+c+"' has not been opened.",H(n,o));{const f=t.pop();if(c!==f.tagName){let y=H(n,f.tagStartPos);return P("InvalidTag","Expected closing tag '"+f.tagName+"' (opened in line "+y.line+", col "+y.col+") instead of closing tag '"+c+"'.",H(n,o))}t.length==0&&(i=!0)}}else return P("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",H(n,s));else{const f=Vn(u,e);if(f!==!0)return P(f.err.code,f.err.msg,H(n,s-u.length+f.err.line));if(i===!0)return P("InvalidXml","Multiple possible root nodes found.",H(n,s));e.unpairedTags.indexOf(c)!==-1||t.push({tagName:c,tagStartPos:o}),r=!0}for(s++;s<n.length;s++)if(n[s]==="<")if(n[s+1]==="!"){s++,s=Ln(n,s);continue}else if(n[s+1]==="?"){if(s=Dn(n,++s),s.err)return s}else break;else if(n[s]==="&"){const f=ws(n,s);if(f==-1)return P("InvalidChar","char '&' is not expected.",H(n,s));s=f}else if(i===!0&&!zn(n[s]))return P("InvalidXml","Extra text at the end",H(n,s));n[s]==="<"&&s--}}else{if(zn(n[s]))continue;return P("InvalidChar","char '"+n[s]+"' is not expected.",H(n,s))}if(r){if(t.length==1)return P("InvalidTag","Unclosed tag '"+t[0].tagName+"'.",H(n,t[0].tagStartPos));if(t.length>0)return P("InvalidXml","Invalid '"+JSON.stringify(t.map(s=>s.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return P("InvalidXml","Start tag expected.",1);return!0}function zn(n){return n===" "||n===" "||n===`
3
+ `||n==="\r"}function Dn(n,e){const t=e;for(;e<n.length;e++)if(n[e]=="?"||n[e]==" "){const r=n.substr(t,e-t);if(e>5&&r==="xml")return P("InvalidXml","XML declaration allowed only at the start of the document.",H(n,e));if(n[e]=="?"&&n[e+1]==">"){e++;break}else continue}return e}function Ln(n,e){if(n.length>e+5&&n[e+1]==="-"&&n[e+2]==="-"){for(e+=3;e<n.length;e++)if(n[e]==="-"&&n[e+1]==="-"&&n[e+2]===">"){e+=2;break}}else if(n.length>e+8&&n[e+1]==="D"&&n[e+2]==="O"&&n[e+3]==="C"&&n[e+4]==="T"&&n[e+5]==="Y"&&n[e+6]==="P"&&n[e+7]==="E"){let t=1;for(e+=8;e<n.length;e++)if(n[e]==="<")t++;else if(n[e]===">"&&(t--,t===0))break}else if(n.length>e+9&&n[e+1]==="["&&n[e+2]==="C"&&n[e+3]==="D"&&n[e+4]==="A"&&n[e+5]==="T"&&n[e+6]==="A"&&n[e+7]==="["){for(e+=8;e<n.length;e++)if(n[e]==="]"&&n[e+1]==="]"&&n[e+2]===">"){e+=2;break}}return e}const ms='"',ps="'";function ys(n,e){let t="",r="",i=!1;for(;e<n.length;e++){if(n[e]===ms||n[e]===ps)r===""?r=n[e]:r!==n[e]||(r="");else if(n[e]===">"&&r===""){i=!0;break}t+=n[e]}return r!==""?!1:{value:t,index:e,tagClosed:i}}const gs=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Vn(n,e){const t=Pr(n,gs),r={};for(let i=0;i<t.length;i++){if(t[i][1].length===0)return P("InvalidAttr","Attribute '"+t[i][2]+"' has no space in starting.",Be(t[i]));if(t[i][3]!==void 0&&t[i][4]===void 0)return P("InvalidAttr","Attribute '"+t[i][2]+"' is without value.",Be(t[i]));if(t[i][3]===void 0&&!e.allowBooleanAttributes)return P("InvalidAttr","boolean attribute '"+t[i][2]+"' is not allowed.",Be(t[i]));const s=t[i][2];if(!Ts(s))return P("InvalidAttr","Attribute '"+s+"' is an invalid name.",Be(t[i]));if(!Object.prototype.hasOwnProperty.call(r,s))r[s]=1;else return P("InvalidAttr","Attribute '"+s+"' is repeated.",Be(t[i]))}return!0}function Es(n,e){let t=/\d/;for(n[e]==="x"&&(e++,t=/[\da-fA-F]/);e<n.length;e++){if(n[e]===";")return e;if(!n[e].match(t))break}return-1}function ws(n,e){if(e++,n[e]===";")return-1;if(n[e]==="#")return e++,Es(n,e);let t=0;for(;e<n.length;e++,t++)if(!(n[e].match(/\w/)&&t<20)){if(n[e]===";")break;return-1}return e}function P(n,e,t){return{err:{code:n,msg:e,line:t.line||t,col:t.col}}}function Ts(n){return It(n)}function Ss(n){return It(n)}function H(n,e){const t=n.substring(0,e).split(/\r?\n/);return{line:t.length,col:t[t.length-1].length+1}}function Be(n){return n.startIndex+n[1].length}const Ns={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(n,e){return e},attributeValueProcessor:function(n,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(n,e,t){return n},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0};function _r(n){return typeof n=="boolean"?{enabled:n,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,allowedTags:null,tagFilter:null}:typeof n=="object"&&n!==null?{enabled:n.enabled!==!1,maxEntitySize:n.maxEntitySize??1e4,maxExpansionDepth:n.maxExpansionDepth??10,maxTotalExpansions:n.maxTotalExpansions??1e3,maxExpandedLength:n.maxExpandedLength??1e5,allowedTags:n.allowedTags??null,tagFilter:n.tagFilter??null}:_r(!0)}const Os=function(n){const e=Object.assign({},Ns,n);return e.processEntities=_r(e.processEntities),e};let Nt;typeof Symbol!="function"?Nt="@@xmlMetadata":Nt=Symbol("XML Node Metadata");class he{constructor(e){this.tagname=e,this.child=[],this[":@"]=Object.create(null)}add(e,t){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e,t){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child}),t!==void 0&&(this.child[this.child.length-1][Nt]={startIndex:t})}static getMetaDataSymbol(){return Nt}}class bs{constructor(e){this.suppressValidationErr=!e,this.options=e}readDocType(e,t){const r=Object.create(null);if(e[t+3]==="O"&&e[t+4]==="C"&&e[t+5]==="T"&&e[t+6]==="Y"&&e[t+7]==="P"&&e[t+8]==="E"){t=t+9;let i=1,s=!1,o=!1,a="";for(;t<e.length;t++)if(e[t]==="<"&&!o){if(s&&Ee(e,"!ENTITY",t)){t+=7;let c,l;if([c,l,t]=this.readEntityExp(e,t+1,this.suppressValidationErr),l.indexOf("&")===-1){const u=c.replace(/[.\-+*:]/g,"\\.");r[c]={regx:RegExp(`&${u};`,"g"),val:l}}}else if(s&&Ee(e,"!ELEMENT",t)){t+=8;const{index:c}=this.readElementExp(e,t+1);t=c}else if(s&&Ee(e,"!ATTLIST",t))t+=8;else if(s&&Ee(e,"!NOTATION",t)){t+=9;const{index:c}=this.readNotationExp(e,t+1,this.suppressValidationErr);t=c}else if(Ee(e,"!--",t))o=!0;else throw new Error("Invalid DOCTYPE");i++,a=""}else if(e[t]===">"){if(o?e[t-1]==="-"&&e[t-2]==="-"&&(o=!1,i--):i--,i===0)break}else e[t]==="["?s=!0:a+=e[t];if(i!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:t}}readEntityExp(e,t){t=Z(e,t);let r="";for(;t<e.length&&!/\s/.test(e[t])&&e[t]!=='"'&&e[t]!=="'";)r+=e[t],t++;if(We(r),t=Z(e,t),!this.suppressValidationErr){if(e.substring(t,t+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(e[t]==="%")throw new Error("Parameter entities are not supported")}let i="";if([t,i]=this.readIdentifierVal(e,t,"entity"),this.options.enabled!==!1&&this.options.maxEntitySize&&i.length>this.options.maxEntitySize)throw new Error(`Entity "${r}" size (${i.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return t--,[r,i,t]}readNotationExp(e,t){t=Z(e,t);let r="";for(;t<e.length&&!/\s/.test(e[t]);)r+=e[t],t++;!this.suppressValidationErr&&We(r),t=Z(e,t);const i=e.substring(t,t+6).toUpperCase();if(!this.suppressValidationErr&&i!=="SYSTEM"&&i!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${i}"`);t+=i.length,t=Z(e,t);let s=null,o=null;if(i==="PUBLIC")[t,s]=this.readIdentifierVal(e,t,"publicIdentifier"),t=Z(e,t),(e[t]==='"'||e[t]==="'")&&([t,o]=this.readIdentifierVal(e,t,"systemIdentifier"));else if(i==="SYSTEM"&&([t,o]=this.readIdentifierVal(e,t,"systemIdentifier"),!this.suppressValidationErr&&!o))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:r,publicIdentifier:s,systemIdentifier:o,index:--t}}readIdentifierVal(e,t,r){let i="";const s=e[t];if(s!=='"'&&s!=="'")throw new Error(`Expected quoted string, found "${s}"`);for(t++;t<e.length&&e[t]!==s;)i+=e[t],t++;if(e[t]!==s)throw new Error(`Unterminated ${r} value`);return t++,[t,i]}readElementExp(e,t){t=Z(e,t);let r="";for(;t<e.length&&!/\s/.test(e[t]);)r+=e[t],t++;if(!this.suppressValidationErr&&!It(r))throw new Error(`Invalid element name: "${r}"`);t=Z(e,t);let i="";if(e[t]==="E"&&Ee(e,"MPTY",t))t+=4;else if(e[t]==="A"&&Ee(e,"NY",t))t+=2;else if(e[t]==="("){for(t++;t<e.length&&e[t]!==")";)i+=e[t],t++;if(e[t]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${e[t]}"`);return{elementName:r,contentModel:i.trim(),index:t}}readAttlistExp(e,t){t=Z(e,t);let r="";for(;t<e.length&&!/\s/.test(e[t]);)r+=e[t],t++;We(r),t=Z(e,t);let i="";for(;t<e.length&&!/\s/.test(e[t]);)i+=e[t],t++;if(!We(i))throw new Error(`Invalid attribute name: "${i}"`);t=Z(e,t);let s="";if(e.substring(t,t+8).toUpperCase()==="NOTATION"){if(s="NOTATION",t+=8,t=Z(e,t),e[t]!=="(")throw new Error(`Expected '(', found "${e[t]}"`);t++;let a=[];for(;t<e.length&&e[t]!==")";){let c="";for(;t<e.length&&e[t]!=="|"&&e[t]!==")";)c+=e[t],t++;if(c=c.trim(),!We(c))throw new Error(`Invalid notation name: "${c}"`);a.push(c),e[t]==="|"&&(t++,t=Z(e,t))}if(e[t]!==")")throw new Error("Unterminated list of notations");t++,s+=" ("+a.join("|")+")"}else{for(;t<e.length&&!/\s/.test(e[t]);)s+=e[t],t++;const a=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!a.includes(s.toUpperCase()))throw new Error(`Invalid attribute type: "${s}"`)}t=Z(e,t);let o="";return e.substring(t,t+8).toUpperCase()==="#REQUIRED"?(o="#REQUIRED",t+=8):e.substring(t,t+7).toUpperCase()==="#IMPLIED"?(o="#IMPLIED",t+=7):[t,o]=this.readIdentifierVal(e,t,"ATTLIST"),{elementName:r,attributeName:i,attributeType:s,defaultValue:o,index:t}}}const Z=(n,e)=>{for(;e<n.length&&/\s/.test(n[e]);)e++;return e};function Ee(n,e,t){for(let r=0;r<e.length;r++)if(e[r]!==n[t+r+1])return!1;return!0}function We(n){if(It(n))return n;throw new Error(`Invalid entity name ${n}`)}const Cs=/^[-+]?0x[a-fA-F0-9]+$/,Rs=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,As={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Is(n,e={}){if(e=Object.assign({},As,e),!n||typeof n!="string")return n;let t=n.trim();if(e.skipLike!==void 0&&e.skipLike.test(t))return n;if(n==="0")return 0;if(e.hex&&Cs.test(t))return Ms(t,16);if(t.includes("e")||t.includes("E"))return ks(n,t,e);{const r=Rs.exec(t);if(r){const i=r[1]||"",s=r[2];let o=Fs(r[3]);const a=i?n[s.length+1]===".":n[s.length]===".";if(!e.leadingZeros&&(s.length>1||s.length===1&&!a))return n;{const c=Number(t),l=String(c);if(c===0)return c;if(l.search(/[eE]/)!==-1)return e.eNotation?c:n;if(t.indexOf(".")!==-1)return l==="0"||l===o||l===`${i}${o}`?c:n;let u=s?o:t;return s?u===l||i+u===l?c:n:u===l||u===i+l?c:n}}else return n}}const vs=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function ks(n,e,t){if(!t.eNotation)return n;const r=e.match(vs);if(r){let i=r[1]||"";const s=r[3].indexOf("e")===-1?"E":"e",o=r[2],a=i?n[o.length+1]===s:n[o.length]===s;return o.length>1&&a?n:o.length===1&&(r[3].startsWith(`.${s}`)||r[3][0]===s)?Number(e):t.leadingZeros&&!a?(e=(r[1]||"")+r[3],Number(e)):n}else return n}function Fs(n){return n&&n.indexOf(".")!==-1&&(n=n.replace(/0+$/,""),n==="."?n="0":n[0]==="."?n="0"+n:n[n.length-1]==="."&&(n=n.substring(0,n.length-1))),n}function Ms(n,e){if(parseInt)return parseInt(n,e);if(Number.parseInt)return Number.parseInt(n,e);if(window&&window.parseInt)return window.parseInt(n,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function xs(n){return typeof n=="function"?n:Array.isArray(n)?e=>{for(const t of n)if(typeof t=="string"&&e===t||t instanceof RegExp&&t.test(e))return!0}:()=>!1}class Ps{constructor(e){if(this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,r)=>Un(r,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,r)=>Un(r,16,"&#x")}},this.addExternalEntities=_s,this.parseXml=Us,this.parseTextData=zs,this.resolveNameSpace=Ds,this.buildAttributesMap=Vs,this.isItStopNode=Ws,this.replaceEntitiesValue=Hs,this.readStopNodeData=Zs,this.saveTextToParentTag=Bs,this.addChild=$s,this.ignoreAttributesFn=xs(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let t=0;t<this.options.stopNodes.length;t++){const r=this.options.stopNodes[t];typeof r=="string"&&(r.startsWith("*.")?this.stopNodesWildcard.add(r.substring(2)):this.stopNodesExact.add(r))}}}}function _s(n){const e=Object.keys(n);for(let t=0;t<e.length;t++){const r=e[t],i=r.replace(/[.\-+*:]/g,"\\.");this.lastEntities[r]={regex:new RegExp("&"+i+";","g"),val:n[r]}}}function zs(n,e,t,r,i,s,o){if(n!==void 0&&(this.options.trimValues&&!r&&(n=n.trim()),n.length>0)){o||(n=this.replaceEntitiesValue(n,e,t));const a=this.options.tagValueProcessor(e,n,t,i,s);return a==null?n:typeof a!=typeof n||a!==n?a:this.options.trimValues?tn(n,this.options.parseTagValue,this.options.numberParseOptions):n.trim()===n?tn(n,this.options.parseTagValue,this.options.numberParseOptions):n}}function Ds(n){if(this.options.removeNSPrefix){const e=n.split(":"),t=n.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(n=t+e[1])}return n}const Ls=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Vs(n,e,t){if(this.options.ignoreAttributes!==!0&&typeof n=="string"){const r=Pr(n,Ls),i=r.length,s={};for(let o=0;o<i;o++){const a=this.resolveNameSpace(r[o][1]);if(this.ignoreAttributesFn(a,e))continue;let c=r[o][4],l=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(l=this.options.transformAttributeName(l)),l==="__proto__"&&(l="#__proto__"),c!==void 0){this.options.trimValues&&(c=c.trim()),c=this.replaceEntitiesValue(c,t,e);const u=this.options.attributeValueProcessor(a,c,e);u==null?s[l]=c:typeof u!=typeof c||u!==c?s[l]=u:s[l]=tn(c,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(s[l]=!0)}if(!Object.keys(s).length)return;if(this.options.attributesGroupName){const o={};return o[this.options.attributesGroupName]=s,o}return s}}const Us=function(n){n=n.replace(/\r\n?/g,`
4
+ `);const e=new he("!xml");let t=e,r="",i="";this.entityExpansionCount=0,this.currentExpandedLength=0;const s=new bs(this.options.processEntities);for(let o=0;o<n.length;o++)if(n[o]==="<")if(n[o+1]==="/"){const c=Se(n,">",o,"Closing Tag is not closed.");let l=n.substring(o+2,c).trim();if(this.options.removeNSPrefix){const y=l.indexOf(":");y!==-1&&(l=l.substr(y+1))}this.options.transformTagName&&(l=this.options.transformTagName(l)),t&&(r=this.saveTextToParentTag(r,t,i));const u=i.substring(i.lastIndexOf(".")+1);if(l&&this.options.unpairedTags.indexOf(l)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${l}>`);let f=0;u&&this.options.unpairedTags.indexOf(u)!==-1?(f=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):f=i.lastIndexOf("."),i=i.substring(0,f),t=this.tagsNodeStack.pop(),r="",o=c}else if(n[o+1]==="?"){let c=en(n,o,!1,"?>");if(!c)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,t,i),!(this.options.ignoreDeclaration&&c.tagName==="?xml"||this.options.ignorePiTags)){const l=new he(c.tagName);l.add(this.options.textNodeName,""),c.tagName!==c.tagExp&&c.attrExpPresent&&(l[":@"]=this.buildAttributesMap(c.tagExp,i,c.tagName)),this.addChild(t,l,i,o)}o=c.closeIndex+1}else if(n.substr(o+1,3)==="!--"){const c=Se(n,"-->",o+4,"Comment is not closed.");if(this.options.commentPropName){const l=n.substring(o+4,c-2);r=this.saveTextToParentTag(r,t,i),t.add(this.options.commentPropName,[{[this.options.textNodeName]:l}])}o=c}else if(n.substr(o+1,2)==="!D"){const c=s.readDocType(n,o);this.docTypeEntities=c.entities,o=c.i}else if(n.substr(o+1,2)==="!["){const c=Se(n,"]]>",o,"CDATA is not closed.")-2,l=n.substring(o+9,c);r=this.saveTextToParentTag(r,t,i);let u=this.parseTextData(l,t.tagname,i,!0,!1,!0,!0);u==null&&(u=""),this.options.cdataPropName?t.add(this.options.cdataPropName,[{[this.options.textNodeName]:l}]):t.add(this.options.textNodeName,u),o=c+2}else{let c=en(n,o,this.options.removeNSPrefix),l=c.tagName;const u=c.rawTagName;let f=c.tagExp,y=c.attrExpPresent,g=c.closeIndex;if(this.options.transformTagName){const m=this.options.transformTagName(l);f===l&&(f=m),l=m}if(this.options.strictReservedNames&&(l===this.options.commentPropName||l===this.options.cdataPropName))throw new Error(`Invalid tag name: ${l}`);t&&r&&t.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,t,i,!1));const h=t;h&&this.options.unpairedTags.indexOf(h.tagname)!==-1&&(t=this.tagsNodeStack.pop(),i=i.substring(0,i.lastIndexOf("."))),l!==e.tagname&&(i+=i?"."+l:l);const p=o;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,i,l)){let m="";if(f.length>0&&f.lastIndexOf("/")===f.length-1)l[l.length-1]==="/"?(l=l.substr(0,l.length-1),i=i.substr(0,i.length-1),f=l):f=f.substr(0,f.length-1),o=c.closeIndex;else if(this.options.unpairedTags.indexOf(l)!==-1)o=c.closeIndex;else{const v=this.readStopNodeData(n,u,g+1);if(!v)throw new Error(`Unexpected end of ${u}`);o=v.i,m=v.tagContent}const S=new he(l);l!==f&&y&&(S[":@"]=this.buildAttributesMap(f,i,l)),m&&(m=this.parseTextData(m,l,i,!0,y,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),S.add(this.options.textNodeName,m),this.addChild(t,S,i,p)}else{if(f.length>0&&f.lastIndexOf("/")===f.length-1){if(l[l.length-1]==="/"?(l=l.substr(0,l.length-1),i=i.substr(0,i.length-1),f=l):f=f.substr(0,f.length-1),this.options.transformTagName){const S=this.options.transformTagName(l);f===l&&(f=S),l=S}const m=new he(l);l!==f&&y&&(m[":@"]=this.buildAttributesMap(f,i,l)),this.addChild(t,m,i,p),i=i.substr(0,i.lastIndexOf("."))}else if(this.options.unpairedTags.indexOf(l)!==-1){const m=new he(l);l!==f&&y&&(m[":@"]=this.buildAttributesMap(f,i)),this.addChild(t,m,i,p),i=i.substr(0,i.lastIndexOf(".")),o=c.closeIndex;continue}else{const m=new he(l);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(t),l!==f&&y&&(m[":@"]=this.buildAttributesMap(f,i,l)),this.addChild(t,m,i,p),t=m}r="",o=g}}else r+=n[o];return e.child};function $s(n,e,t,r){this.options.captureMetaData||(r=void 0);const i=this.options.updateTag(e.tagname,t,e[":@"]);i===!1||(typeof i=="string"&&(e.tagname=i),n.addChild(e,r))}const Hs=function(n,e,t){if(n.indexOf("&")===-1)return n;const r=this.options.processEntities;if(!r.enabled||r.allowedTags&&!r.allowedTags.includes(e)||r.tagFilter&&!r.tagFilter(e,t))return n;for(let i in this.docTypeEntities){const s=this.docTypeEntities[i],o=n.match(s.regx);if(o){if(this.entityExpansionCount+=o.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions)throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);const a=n.length;if(n=n.replace(s.regx,s.val),r.maxExpandedLength&&(this.currentExpandedLength+=n.length-a,this.currentExpandedLength>r.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${r.maxExpandedLength}`)}}if(n.indexOf("&")===-1)return n;for(let i in this.lastEntities){const s=this.lastEntities[i];n=n.replace(s.regex,s.val)}if(n.indexOf("&")===-1)return n;if(this.options.htmlEntities)for(let i in this.htmlEntities){const s=this.htmlEntities[i];n=n.replace(s.regex,s.val)}return n=n.replace(this.ampEntity.regex,this.ampEntity.val),n};function Bs(n,e,t,r){return n&&(r===void 0&&(r=e.child.length===0),n=this.parseTextData(n,e.tagname,t,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,r),n!==void 0&&n!==""&&e.add(this.options.textNodeName,n),n=""),n}function Ws(n,e,t,r){return!!(e&&e.has(r)||n&&n.has(t))}function qs(n,e,t=">"){let r,i="";for(let s=e;s<n.length;s++){let o=n[s];if(r)o===r&&(r="");else if(o==='"'||o==="'")r=o;else if(o===t[0])if(t[1]){if(n[s+1]===t[1])return{data:i,index:s}}else return{data:i,index:s};else o===" "&&(o=" ");i+=o}}function Se(n,e,t,r){const i=n.indexOf(e,t);if(i===-1)throw new Error(r);return i+e.length-1}function en(n,e,t,r=">"){const i=qs(n,e+1,r);if(!i)return;let s=i.data;const o=i.index,a=s.search(/\s/);let c=s,l=!0;a!==-1&&(c=s.substring(0,a),s=s.substring(a+1).trimStart());const u=c;if(t){const f=c.indexOf(":");f!==-1&&(c=c.substr(f+1),l=c!==i.data.substr(f+1))}return{tagName:c,tagExp:s,closeIndex:o,attrExpPresent:l,rawTagName:u}}function Zs(n,e,t){const r=t;let i=1;for(;t<n.length;t++)if(n[t]==="<")if(n[t+1]==="/"){const s=Se(n,">",t,`${e} is not closed`);if(n.substring(t+2,s).trim()===e&&(i--,i===0))return{tagContent:n.substring(r,t),i:s};t=s}else if(n[t+1]==="?")t=Se(n,"?>",t+1,"StopNode is not closed.");else if(n.substr(t+1,3)==="!--")t=Se(n,"-->",t+3,"StopNode is not closed.");else if(n.substr(t+1,2)==="![")t=Se(n,"]]>",t,"StopNode is not closed.")-2;else{const s=en(n,t,">");s&&((s&&s.tagName)===e&&s.tagExp[s.tagExp.length-1]!=="/"&&i++,t=s.closeIndex)}}function tn(n,e,t){if(e&&typeof n=="string"){const r=n.trim();return r==="true"?!0:r==="false"?!1:Is(n,t)}else return fs(n)?n:""}function Un(n,e,t){const r=Number.parseInt(n,e);return r>=0&&r<=1114111?String.fromCodePoint(r):t+n+";"}const $t=he.getMetaDataSymbol();function Ys(n,e){return zr(n,e)}function zr(n,e,t){let r;const i={};for(let s=0;s<n.length;s++){const o=n[s],a=js(o);let c="";if(t===void 0?c=a:c=t+"."+a,a===e.textNodeName)r===void 0?r=o[a]:r+=""+o[a];else{if(a===void 0)continue;if(o[a]){let l=zr(o[a],e,c);const u=Js(l,e);o[":@"]?Gs(l,o[":@"],c,e):Object.keys(l).length===1&&l[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?l=l[e.textNodeName]:Object.keys(l).length===0&&(e.alwaysCreateTextNode?l[e.textNodeName]="":l=""),o[$t]!==void 0&&typeof l=="object"&&l!==null&&(l[$t]=o[$t]),i[a]!==void 0&&Object.prototype.hasOwnProperty.call(i,a)?(Array.isArray(i[a])||(i[a]=[i[a]]),i[a].push(l)):e.isArray(a,c,u)?i[a]=[l]:i[a]=l}}}return typeof r=="string"?r.length>0&&(i[e.textNodeName]=r):r!==void 0&&(i[e.textNodeName]=r),i}function js(n){const e=Object.keys(n);for(let t=0;t<e.length;t++){const r=e[t];if(r!==":@")return r}}function Gs(n,e,t,r){if(e){const i=Object.keys(e),s=i.length;for(let o=0;o<s;o++){const a=i[o];r.isArray(a,t+"."+a,!0,!0)?n[a]=[e[a]]:n[a]=e[a]}}}function Js(n,e){const{textNodeName:t}=e,r=Object.keys(n).length;return!!(r===0||r===1&&(n[t]||typeof n[t]=="boolean"||n[t]===0))}class Dr{constructor(e){this.externalEntities={},this.options=Os(e)}parse(e,t){if(typeof e!="string"&&e.toString)e=e.toString();else if(typeof e!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(t){t===!0&&(t={});const s=hs(e,t);if(s!==!0)throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`)}const r=new Ps(this.options);r.addExternalEntities(this.externalEntities);const i=r.parseXml(e);return this.options.preserveOrder||i===void 0?i:Ys(i,this.options)}addEntity(e,t){if(t.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(t==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}static getMetaDataSymbol(){return he.getMetaDataSymbol()}}class Xs{async getFinancialValues(e,t){const r=e?.Risposta?.dati;if(!r)return I(t,R.XBRL_EMPTY,["companyProfit","companyRevenue"],A.XBRL_EMPTY),null;let i;try{i=Buffer.from(r,"base64").toString("utf-8")}catch(u){return console.log(u),I(t,R.XBRL_DECODE_ERROR,["companyProfit","companyRevenue"],A.XBRL_DECODE_ERROR),null}const s=new Dr({ignoreAttributes:!1,attributeNamePrefix:""});let o;try{o=s.parse(i)}catch(u){return console.log(u),I(t,R.XML_PARSE_ERROR,["companyProfit","companyRevenue"],A.XML_PARSE_ERROR),null}if(!o?.xbrl)return I(t,R.XBRL_MAPPING_ERROR,["companyProfit","companyRevenue"],A.XBRL_MAPPING_ERROR),null;const a=o.xbrl,c=this.findByContext(a,"itcc-ci:UtilePerditaEsercizio","cntxCorr_d"),l=this.findByContext(a,"itcc-ci:ValoreProduzioneRicaviVenditePrestazioni","cntxCorr_d");return{companyProfit:c?Number(c["#text"]):0,companyRevenue:l?Number(l["#text"]):0}}findByContext(e,t,r){const i=e[t];return i?(Array.isArray(i)?i:[i]).find(o=>o.contextRef===r)??null:null}}const Ks={PERSONA:"person",IMPRESA:"company",ALTRO:"other"};class Qs{parseAddress(e){if(e)return{street:e.via,number:e["n-civico"],city:e.comune,province:e.provincia,cap:e.cap}}parseCapital(e){return parseFloat(e.replace(".","").replace(",","."))}async getShares(e,t){const r=[],i=Array.isArray(e)?e:[e];for(const s of i){const o=this.parseCapital(s["composizione-quote"]["valore-nominale"]),a=Array.isArray(s.titolari.titolare)?s.titolari.titolare:[s.titolari.titolare];for(const c of a){const l={type:Ks[c["anagrafica-titolare"].tipo],fiscalCode:c["anagrafica-titolare"]["c-fiscale"],firstName:c["anagrafica-titolare"].nome||c["anagrafica-titolare"].denominazione,lastName:c["anagrafica-titolare"].cognome,shareValue:o,sharePercentage:o/t*100,isRepresentative:c["f-rappresentante"]==="S",address:this.parseAddress(c.domicilio)};r.push(l)}}return r}}class Re extends Error{}class eo extends Re{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class to extends Re{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class no extends Re{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class Fe extends Re{}class Lr extends Re{constructor(e){super(`Invalid unit ${e}`)}}class V extends Re{}class de extends Re{constructor(){super("Zone is an abstract class")}}const E="numeric",re="short",G="long",Ot={year:E,month:E,day:E},Vr={year:E,month:re,day:E},ro={year:E,month:re,day:E,weekday:re},Ur={year:E,month:G,day:E},$r={year:E,month:G,day:E,weekday:G},Hr={hour:E,minute:E},Br={hour:E,minute:E,second:E},Wr={hour:E,minute:E,second:E,timeZoneName:re},qr={hour:E,minute:E,second:E,timeZoneName:G},Zr={hour:E,minute:E,hourCycle:"h23"},Yr={hour:E,minute:E,second:E,hourCycle:"h23"},jr={hour:E,minute:E,second:E,hourCycle:"h23",timeZoneName:re},Gr={hour:E,minute:E,second:E,hourCycle:"h23",timeZoneName:G},Jr={year:E,month:E,day:E,hour:E,minute:E},Xr={year:E,month:E,day:E,hour:E,minute:E,second:E},Kr={year:E,month:re,day:E,hour:E,minute:E},Qr={year:E,month:re,day:E,hour:E,minute:E,second:E},io={year:E,month:re,day:E,weekday:re,hour:E,minute:E},ei={year:E,month:G,day:E,hour:E,minute:E,timeZoneName:re},ti={year:E,month:G,day:E,hour:E,minute:E,second:E,timeZoneName:re},ni={year:E,month:G,day:E,weekday:G,hour:E,minute:E,timeZoneName:G},ri={year:E,month:G,day:E,weekday:G,hour:E,minute:E,second:E,timeZoneName:G};class Ke{get type(){throw new de}get name(){throw new de}get ianaName(){return this.name}get isUniversal(){throw new de}offsetName(e,t){throw new de}formatOffset(e,t){throw new de}offset(e){throw new de}equals(e){throw new de}get isValid(){throw new de}}let Ht=null;class vt extends Ke{static get instance(){return Ht===null&&(Ht=new vt),Ht}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return mi(e,t,r)}formatOffset(e,t){return Je(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}const nn=new Map;function so(n){let e=nn.get(n);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),nn.set(n,e)),e}const oo={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function ao(n,e){const t=n.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,i,s,o,a,c,l,u]=r;return[o,i,s,a,c,l,u]}function co(n,e){const t=n.formatToParts(e),r=[];for(let i=0;i<t.length;i++){const{type:s,value:o}=t[i],a=oo[s];s==="era"?r[a]=o:N(a)||(r[a]=parseInt(o,10))}return r}const Bt=new Map;class ce extends Ke{static create(e){let t=Bt.get(e);return t===void 0&&Bt.set(e,t=new ce(e)),t}static resetCache(){Bt.clear(),nn.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=ce.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return mi(e,t,r,this.name)}formatOffset(e,t){return Je(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const r=so(this.name);let[i,s,o,a,c,l,u]=r.formatToParts?co(r,t):ao(r,t);a==="BC"&&(i=-Math.abs(i)+1);const y=Ft({year:i,month:s,day:o,hour:c===24?0:c,minute:l,second:u,millisecond:0});let g=+t;const h=g%1e3;return g-=h>=0?h:1e3+h,(y-g)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let $n={};function lo(n,e={}){const t=JSON.stringify([n,e]);let r=$n[t];return r||(r=new Intl.ListFormat(n,e),$n[t]=r),r}const rn=new Map;function sn(n,e={}){const t=JSON.stringify([n,e]);let r=rn.get(t);return r===void 0&&(r=new Intl.DateTimeFormat(n,e),rn.set(t,r)),r}const on=new Map;function uo(n,e={}){const t=JSON.stringify([n,e]);let r=on.get(t);return r===void 0&&(r=new Intl.NumberFormat(n,e),on.set(t,r)),r}const an=new Map;function fo(n,e={}){const{base:t,...r}=e,i=JSON.stringify([n,r]);let s=an.get(i);return s===void 0&&(s=new Intl.RelativeTimeFormat(n,e),an.set(i,s)),s}let Ye=null;function ho(){return Ye||(Ye=new Intl.DateTimeFormat().resolvedOptions().locale,Ye)}const cn=new Map;function ii(n){let e=cn.get(n);return e===void 0&&(e=new Intl.DateTimeFormat(n).resolvedOptions(),cn.set(n,e)),e}const ln=new Map;function mo(n){let e=ln.get(n);if(!e){const t=new Intl.Locale(n);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,"minimalDays"in e||(e={...si,...e}),ln.set(n,e)}return e}function po(n){const e=n.indexOf("-x-");e!==-1&&(n=n.substring(0,e));const t=n.indexOf("-u-");if(t===-1)return[n];{let r,i;try{r=sn(n).resolvedOptions(),i=n}catch{const c=n.substring(0,t);r=sn(c).resolvedOptions(),i=c}const{numberingSystem:s,calendar:o}=r;return[i,s,o]}}function yo(n,e,t){return(t||e)&&(n.includes("-u-")||(n+="-u"),t&&(n+=`-ca-${t}`),e&&(n+=`-nu-${e}`)),n}function go(n){const e=[];for(let t=1;t<=12;t++){const r=w.utc(2009,t,1);e.push(n(r))}return e}function Eo(n){const e=[];for(let t=1;t<=7;t++){const r=w.utc(2016,11,13+t);e.push(n(r))}return e}function ut(n,e,t,r){const i=n.listingMode();return i==="error"?null:i==="en"?t(e):r(e)}function wo(n){return n.numberingSystem&&n.numberingSystem!=="latn"?!1:n.numberingSystem==="latn"||!n.locale||n.locale.startsWith("en")||ii(n.locale).numberingSystem==="latn"}class To{constructor(e,t,r){this.padTo=r.padTo||0,this.floor=r.floor||!1;const{padTo:i,floor:s,...o}=r;if(!t||Object.keys(o).length>0){const a={useGrouping:!1,...r};r.padTo>0&&(a.minimumIntegerDigits=r.padTo),this.inf=uo(e,a)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{const t=this.floor?Math.floor(e):Nn(e,3);return z(t,this.padTo)}}}class So{constructor(e,t,r){this.opts=r,this.originalZone=void 0;let i;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const o=-1*(e.offset/60),a=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&ce.create(a).valid?(i=a,this.dt=e):(i="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,i=e.zone.name):(i="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const s={...this.opts};s.timeZone=s.timeZone||i,this.dtf=sn(t,s)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){const r=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:r}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class No{constructor(e,t,r){this.opts={style:"long",...r},!t&&di()&&(this.rtf=fo(e,r))}format(e,t){return this.rtf?this.rtf.format(e,t):Wo(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const si={firstDay:1,minimalDays:4,weekend:[6,7]};class C{static fromOpts(e){return C.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,r,i,s=!1){const o=e||M.defaultLocale,a=o||(s?"en-US":ho()),c=t||M.defaultNumberingSystem,l=r||M.defaultOutputCalendar,u=fn(i)||M.defaultWeekSettings;return new C(a,c,l,u,o)}static resetCache(){Ye=null,rn.clear(),on.clear(),an.clear(),cn.clear(),ln.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:r,weekSettings:i}={}){return C.create(e,t,r,i)}constructor(e,t,r,i,s){const[o,a,c]=po(e);this.locale=o,this.numberingSystem=t||a||null,this.outputCalendar=r||c||null,this.weekSettings=i,this.intl=yo(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=s,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=wo(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:C.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,fn(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return ut(this,e,gi,()=>{const r=this.intl==="ja"||this.intl.startsWith("ja-");t&=!r;const i=t?{month:e,day:"numeric"}:{month:e},s=t?"format":"standalone";if(!this.monthsCache[s][e]){const o=r?a=>this.dtFormatter(a,i).format():a=>this.extract(a,i,"month");this.monthsCache[s][e]=go(o)}return this.monthsCache[s][e]})}weekdays(e,t=!1){return ut(this,e,Ti,()=>{const r=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},i=t?"format":"standalone";return this.weekdaysCache[i][e]||(this.weekdaysCache[i][e]=Eo(s=>this.extract(s,r,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return ut(this,void 0,()=>Si,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[w.utc(2016,11,13,9),w.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return ut(this,e,Ni,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[w.utc(-40,1,1),w.utc(2017,1,1)].map(r=>this.extract(r,t,"era"))),this.eraCache[e]})}extract(e,t,r){const i=this.dtFormatter(e,t),s=i.formatToParts(),o=s.find(a=>a.type.toLowerCase()===r);return o?o.value:null}numberFormatter(e={}){return new To(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new So(e,this.intl,t)}relFormatter(e={}){return new No(this.intl,this.isEnglish(),e)}listFormatter(e={}){return lo(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||ii(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:hi()?mo(this.locale):si}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let Wt=null;class B extends Ke{static get utcInstance(){return Wt===null&&(Wt=new B(0)),Wt}static instance(e){return e===0?B.utcInstance:new B(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new B(Mt(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Je(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Je(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Je(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class Oo extends Ke{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function pe(n,e){if(N(n)||n===null)return e;if(n instanceof Ke)return n;if(vo(n)){const t=n.toLowerCase();return t==="default"?e:t==="local"||t==="system"?vt.instance:t==="utc"||t==="gmt"?B.utcInstance:B.parseSpecifier(t)||ce.create(n)}else return ye(n)?B.instance(n):typeof n=="object"&&"offset"in n&&typeof n.offset=="function"?n:new Oo(n)}const En={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Hn={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},bo=En.hanidec.replace(/[\[|\]]/g,"").split("");function Co(n){let e=parseInt(n,10);if(isNaN(e)){e="";for(let t=0;t<n.length;t++){const r=n.charCodeAt(t);if(n[t].search(En.hanidec)!==-1)e+=bo.indexOf(n[t]);else for(const i in Hn){const[s,o]=Hn[i];r>=s&&r<=o&&(e+=r-s)}}return parseInt(e,10)}else return e}const un=new Map;function Ro(){un.clear()}function ee({numberingSystem:n},e=""){const t=n||"latn";let r=un.get(t);r===void 0&&(r=new Map,un.set(t,r));let i=r.get(e);return i===void 0&&(i=new RegExp(`${En[t]}${e}`),r.set(e,i)),i}let Bn=()=>Date.now(),Wn="system",qn=null,Zn=null,Yn=null,jn=60,Gn,Jn=null;class M{static get now(){return Bn}static set now(e){Bn=e}static set defaultZone(e){Wn=e}static get defaultZone(){return pe(Wn,vt.instance)}static get defaultLocale(){return qn}static set defaultLocale(e){qn=e}static get defaultNumberingSystem(){return Zn}static set defaultNumberingSystem(e){Zn=e}static get defaultOutputCalendar(){return Yn}static set defaultOutputCalendar(e){Yn=e}static get defaultWeekSettings(){return Jn}static set defaultWeekSettings(e){Jn=fn(e)}static get twoDigitCutoffYear(){return jn}static set twoDigitCutoffYear(e){jn=e%100}static get throwOnInvalid(){return Gn}static set throwOnInvalid(e){Gn=e}static resetCaches(){C.resetCache(),ce.resetCache(),w.resetCache(),Ro()}}class ne{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const oi=[0,31,59,90,120,151,181,212,243,273,304,334],ai=[0,31,60,91,121,152,182,213,244,274,305,335];function K(n,e){return new ne("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${n}, which is invalid`)}function wn(n,e,t){const r=new Date(Date.UTC(n,e-1,t));n<100&&n>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);const i=r.getUTCDay();return i===0?7:i}function ci(n,e,t){return t+(Qe(n)?ai:oi)[e-1]}function li(n,e){const t=Qe(n)?ai:oi,r=t.findIndex(s=>s<e),i=e-t[r];return{month:r+1,day:i}}function Tn(n,e){return(n-e+7)%7+1}function bt(n,e=4,t=1){const{year:r,month:i,day:s}=n,o=ci(r,i,s),a=Tn(wn(r,i,s),t);let c=Math.floor((o-a+14-e)/7),l;return c<1?(l=r-1,c=Xe(l,e,t)):c>Xe(r,e,t)?(l=r+1,c=1):l=r,{weekYear:l,weekNumber:c,weekday:a,...xt(n)}}function Xn(n,e=4,t=1){const{weekYear:r,weekNumber:i,weekday:s}=n,o=Tn(wn(r,1,e),t),a=Me(r);let c=i*7+s-o-7+e,l;c<1?(l=r-1,c+=Me(l)):c>a?(l=r+1,c-=Me(r)):l=r;const{month:u,day:f}=li(l,c);return{year:l,month:u,day:f,...xt(n)}}function qt(n){const{year:e,month:t,day:r}=n,i=ci(e,t,r);return{year:e,ordinal:i,...xt(n)}}function Kn(n){const{year:e,ordinal:t}=n,{month:r,day:i}=li(e,t);return{year:e,month:r,day:i,...xt(n)}}function Qn(n,e){if(!N(n.localWeekday)||!N(n.localWeekNumber)||!N(n.localWeekYear)){if(!N(n.weekday)||!N(n.weekNumber)||!N(n.weekYear))throw new Fe("Cannot mix locale-based week fields with ISO-based week fields");return N(n.localWeekday)||(n.weekday=n.localWeekday),N(n.localWeekNumber)||(n.weekNumber=n.localWeekNumber),N(n.localWeekYear)||(n.weekYear=n.localWeekYear),delete n.localWeekday,delete n.localWeekNumber,delete n.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function Ao(n,e=4,t=1){const r=kt(n.weekYear),i=Q(n.weekNumber,1,Xe(n.weekYear,e,t)),s=Q(n.weekday,1,7);return r?i?s?!1:K("weekday",n.weekday):K("week",n.weekNumber):K("weekYear",n.weekYear)}function Io(n){const e=kt(n.year),t=Q(n.ordinal,1,Me(n.year));return e?t?!1:K("ordinal",n.ordinal):K("year",n.year)}function ui(n){const e=kt(n.year),t=Q(n.month,1,12),r=Q(n.day,1,Ct(n.year,n.month));return e?t?r?!1:K("day",n.day):K("month",n.month):K("year",n.year)}function fi(n){const{hour:e,minute:t,second:r,millisecond:i}=n,s=Q(e,0,23)||e===24&&t===0&&r===0&&i===0,o=Q(t,0,59),a=Q(r,0,59),c=Q(i,0,999);return s?o?a?c?!1:K("millisecond",i):K("second",r):K("minute",t):K("hour",e)}function N(n){return typeof n>"u"}function ye(n){return typeof n=="number"}function kt(n){return typeof n=="number"&&n%1===0}function vo(n){return typeof n=="string"}function ko(n){return Object.prototype.toString.call(n)==="[object Date]"}function di(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function hi(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Fo(n){return Array.isArray(n)?n:[n]}function er(n,e,t){if(n.length!==0)return n.reduce((r,i)=>{const s=[e(i),i];return r&&t(r[0],s[0])===r[0]?r:s},null)[1]}function Mo(n,e){return e.reduce((t,r)=>(t[r]=n[r],t),{})}function Pe(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function fn(n){if(n==null)return null;if(typeof n!="object")throw new V("Week settings must be an object");if(!Q(n.firstDay,1,7)||!Q(n.minimalDays,1,7)||!Array.isArray(n.weekend)||n.weekend.some(e=>!Q(e,1,7)))throw new V("Invalid week settings");return{firstDay:n.firstDay,minimalDays:n.minimalDays,weekend:Array.from(n.weekend)}}function Q(n,e,t){return kt(n)&&n>=e&&n<=t}function xo(n,e){return n-e*Math.floor(n/e)}function z(n,e=2){const t=n<0;let r;return t?r="-"+(""+-n).padStart(e,"0"):r=(""+n).padStart(e,"0"),r}function me(n){if(!(N(n)||n===null||n===""))return parseInt(n,10)}function we(n){if(!(N(n)||n===null||n===""))return parseFloat(n)}function Sn(n){if(!(N(n)||n===null||n==="")){const e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function Nn(n,e,t="round"){const r=10**e;switch(t){case"expand":return n>0?Math.ceil(n*r)/r:Math.floor(n*r)/r;case"trunc":return Math.trunc(n*r)/r;case"round":return Math.round(n*r)/r;case"floor":return Math.floor(n*r)/r;case"ceil":return Math.ceil(n*r)/r;default:throw new RangeError(`Value rounding ${t} is out of range`)}}function Qe(n){return n%4===0&&(n%100!==0||n%400===0)}function Me(n){return Qe(n)?366:365}function Ct(n,e){const t=xo(e-1,12)+1,r=n+(e-t)/12;return t===2?Qe(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Ft(n){let e=Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond);return n.year<100&&n.year>=0&&(e=new Date(e),e.setUTCFullYear(n.year,n.month-1,n.day)),+e}function tr(n,e,t){return-Tn(wn(n,1,e),t)+e-1}function Xe(n,e=4,t=1){const r=tr(n,e,t),i=tr(n+1,e,t);return(Me(n)-r+i)/7}function dn(n){return n>99?n:n>M.twoDigitCutoffYear?1900+n:2e3+n}function mi(n,e,t,r=null){const i=new Date(n),s={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(s.timeZone=r);const o={timeZoneName:e,...s},a=new Intl.DateTimeFormat(t,o).formatToParts(i).find(c=>c.type.toLowerCase()==="timezonename");return a?a.value:null}function Mt(n,e){let t=parseInt(n,10);Number.isNaN(t)&&(t=0);const r=parseInt(e,10)||0,i=t<0||Object.is(t,-0)?-r:r;return t*60+i}function pi(n){const e=Number(n);if(typeof n=="boolean"||n===""||!Number.isFinite(e))throw new V(`Invalid unit value ${n}`);return e}function Rt(n,e){const t={};for(const r in n)if(Pe(n,r)){const i=n[r];if(i==null)continue;t[e(r)]=pi(i)}return t}function Je(n,e){const t=Math.trunc(Math.abs(n/60)),r=Math.trunc(Math.abs(n%60)),i=n>=0?"+":"-";switch(e){case"short":return`${i}${z(t,2)}:${z(r,2)}`;case"narrow":return`${i}${t}${r>0?`:${r}`:""}`;case"techie":return`${i}${z(t,2)}${z(r,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function xt(n){return Mo(n,["hour","minute","second","millisecond"])}const Po=["January","February","March","April","May","June","July","August","September","October","November","December"],yi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],_o=["J","F","M","A","M","J","J","A","S","O","N","D"];function gi(n){switch(n){case"narrow":return[..._o];case"short":return[...yi];case"long":return[...Po];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const Ei=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],wi=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],zo=["M","T","W","T","F","S","S"];function Ti(n){switch(n){case"narrow":return[...zo];case"short":return[...wi];case"long":return[...Ei];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Si=["AM","PM"],Do=["Before Christ","Anno Domini"],Lo=["BC","AD"],Vo=["B","A"];function Ni(n){switch(n){case"narrow":return[...Vo];case"short":return[...Lo];case"long":return[...Do];default:return null}}function Uo(n){return Si[n.hour<12?0:1]}function $o(n,e){return Ti(e)[n.weekday-1]}function Ho(n,e){return gi(e)[n.month-1]}function Bo(n,e){return Ni(e)[n.year<0?0:1]}function Wo(n,e,t="always",r=!1){const i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},s=["hours","minutes","seconds"].indexOf(n)===-1;if(t==="auto"&&s){const f=n==="days";switch(e){case 1:return f?"tomorrow":`next ${i[n][0]}`;case-1:return f?"yesterday":`last ${i[n][0]}`;case 0:return f?"today":`this ${i[n][0]}`}}const o=Object.is(e,-0)||e<0,a=Math.abs(e),c=a===1,l=i[n],u=r?c?l[1]:l[2]||l[1]:c?i[n][0]:n;return o?`${a} ${u} ago`:`in ${a} ${u}`}function nr(n,e){let t="";for(const r of n)r.literal?t+=r.val:t+=e(r.val);return t}const qo={D:Ot,DD:Vr,DDD:Ur,DDDD:$r,t:Hr,tt:Br,ttt:Wr,tttt:qr,T:Zr,TT:Yr,TTT:jr,TTTT:Gr,f:Jr,ff:Kr,fff:ei,ffff:ni,F:Xr,FF:Qr,FFF:ti,FFFF:ri};class U{static create(e,t={}){return new U(e,t)}static parseFormat(e){let t=null,r="",i=!1;const s=[];for(let o=0;o<e.length;o++){const a=e.charAt(o);a==="'"?((r.length>0||i)&&s.push({literal:i||/^\s+$/.test(r),val:r===""?"'":r}),t=null,r="",i=!i):i||a===t?r+=a:(r.length>0&&s.push({literal:/^\s+$/.test(r),val:r}),r=a,t=a)}return r.length>0&&s.push({literal:i||/^\s+$/.test(r),val:r}),s}static macroTokenToFormatOpts(e){return qo[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,r=void 0){if(this.opts.forceSimple)return z(e,t);const i={...this.opts};return t>0&&(i.padTo=t),r&&(i.signDisplay=r),this.loc.numberFormatter(i).format(e)}formatDateTimeFromString(e,t){const r=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",s=(g,h)=>this.loc.extract(e,g,h),o=g=>e.isOffsetFixed&&e.offset===0&&g.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,g.format):"",a=()=>r?Uo(e):s({hour:"numeric",hourCycle:"h12"},"dayperiod"),c=(g,h)=>r?Ho(e,g):s(h?{month:g}:{month:g,day:"numeric"},"month"),l=(g,h)=>r?$o(e,g):s(h?{weekday:g}:{weekday:g,month:"long",day:"numeric"},"weekday"),u=g=>{const h=U.macroTokenToFormatOpts(g);return h?this.formatWithSystemDefault(e,h):g},f=g=>r?Bo(e,g):s({era:g},"era"),y=g=>{switch(g){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return a();case"d":return i?s({day:"numeric"},"day"):this.num(e.day);case"dd":return i?s({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return l("short",!0);case"cccc":return l("long",!0);case"ccccc":return l("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return l("short",!1);case"EEEE":return l("long",!1);case"EEEEE":return l("narrow",!1);case"L":return i?s({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return i?s({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return c("short",!0);case"LLLL":return c("long",!0);case"LLLLL":return c("narrow",!0);case"M":return i?s({month:"numeric"},"month"):this.num(e.month);case"MM":return i?s({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return c("short",!1);case"MMMM":return c("long",!1);case"MMMMM":return c("narrow",!1);case"y":return i?s({year:"numeric"},"year"):this.num(e.year);case"yy":return i?s({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return i?s({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return i?s({year:"numeric"},"year"):this.num(e.year,6);case"G":return f("short");case"GG":return f("long");case"GGGGG":return f("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return u(g)}};return nr(U.parseFormat(t),y)}formatDurationFromString(e,t){const r=this.opts.signMode==="negativeLargestOnly"?-1:1,i=u=>{switch(u[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},s=(u,f)=>y=>{const g=i(y);if(g){const h=f.isNegativeDuration&&g!==f.largestUnit?r:1;let p;return this.opts.signMode==="negativeLargestOnly"&&g!==f.largestUnit?p="never":this.opts.signMode==="all"?p="always":p="auto",this.num(u.get(g)*h,y.length,p)}else return y},o=U.parseFormat(t),a=o.reduce((u,{literal:f,val:y})=>f?u:u.concat(y),[]),c=e.shiftTo(...a.map(i).filter(u=>u)),l={isNegativeDuration:c<0,largestUnit:Object.keys(c.values)[0]};return nr(o,s(c,l))}}const Oi=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function ze(...n){const e=n.reduce((t,r)=>t+r.source,"");return RegExp(`^${e}$`)}function De(...n){return e=>n.reduce(([t,r,i],s)=>{const[o,a,c]=s(e,i);return[{...t,...o},a||r,c]},[{},null,1]).slice(0,2)}function Le(n,...e){if(n==null)return[null,null];for(const[t,r]of e){const i=t.exec(n);if(i)return r(i)}return[null,null]}function bi(...n){return(e,t)=>{const r={};let i;for(i=0;i<n.length;i++)r[n[i]]=me(e[t+i]);return[r,null,t+i]}}const Ci=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,Zo=`(?:${Ci.source}?(?:\\[(${Oi.source})\\])?)?`,On=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Ri=RegExp(`${On.source}${Zo}`),bn=RegExp(`(?:[Tt]${Ri.source})?`),Yo=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,jo=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Go=/(\d{4})-?(\d{3})/,Jo=bi("weekYear","weekNumber","weekDay"),Xo=bi("year","ordinal"),Ko=/(\d{4})-(\d\d)-(\d\d)/,Ai=RegExp(`${On.source} ?(?:${Ci.source}|(${Oi.source}))?`),Qo=RegExp(`(?: ${Ai.source})?`);function xe(n,e,t){const r=n[e];return N(r)?t:me(r)}function ea(n,e){return[{year:xe(n,e),month:xe(n,e+1,1),day:xe(n,e+2,1)},null,e+3]}function Ve(n,e){return[{hours:xe(n,e,0),minutes:xe(n,e+1,0),seconds:xe(n,e+2,0),milliseconds:Sn(n[e+3])},null,e+4]}function et(n,e){const t=!n[e]&&!n[e+1],r=Mt(n[e+1],n[e+2]),i=t?null:B.instance(r);return[{},i,e+3]}function tt(n,e){const t=n[e]?ce.create(n[e]):null;return[{},t,e+1]}const ta=RegExp(`^T?${On.source}$`),na=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function ra(n){const[e,t,r,i,s,o,a,c,l]=n,u=e[0]==="-",f=c&&c[0]==="-",y=(g,h=!1)=>g!==void 0&&(h||g&&u)?-g:g;return[{years:y(we(t)),months:y(we(r)),weeks:y(we(i)),days:y(we(s)),hours:y(we(o)),minutes:y(we(a)),seconds:y(we(c),c==="-0"),milliseconds:y(Sn(l),f)}]}const ia={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Cn(n,e,t,r,i,s,o){const a={year:e.length===2?dn(me(e)):me(e),month:yi.indexOf(t)+1,day:me(r),hour:me(i),minute:me(s)};return o&&(a.second=me(o)),n&&(a.weekday=n.length>3?Ei.indexOf(n)+1:wi.indexOf(n)+1),a}const sa=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function oa(n){const[,e,t,r,i,s,o,a,c,l,u,f]=n,y=Cn(e,i,r,t,s,o,a);let g;return c?g=ia[c]:l?g=0:g=Mt(u,f),[y,new B(g)]}function aa(n){return n.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const ca=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,la=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,ua=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function rr(n){const[,e,t,r,i,s,o,a]=n;return[Cn(e,i,r,t,s,o,a),B.utcInstance]}function fa(n){const[,e,t,r,i,s,o,a]=n;return[Cn(e,a,t,r,i,s,o),B.utcInstance]}const da=ze(Yo,bn),ha=ze(jo,bn),ma=ze(Go,bn),pa=ze(Ri),Ii=De(ea,Ve,et,tt),ya=De(Jo,Ve,et,tt),ga=De(Xo,Ve,et,tt),Ea=De(Ve,et,tt);function wa(n){return Le(n,[da,Ii],[ha,ya],[ma,ga],[pa,Ea])}function Ta(n){return Le(aa(n),[sa,oa])}function Sa(n){return Le(n,[ca,rr],[la,rr],[ua,fa])}function Na(n){return Le(n,[na,ra])}const Oa=De(Ve);function ba(n){return Le(n,[ta,Oa])}const Ca=ze(Ko,Qo),Ra=ze(Ai),Aa=De(Ve,et,tt);function Ia(n){return Le(n,[Ca,Ii],[Ra,Aa])}const ir="Invalid Duration",vi={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},va={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...vi},J=146097/400,Ie=146097/4800,ka={years:{quarters:4,months:12,weeks:J/7,days:J,hours:J*24,minutes:J*24*60,seconds:J*24*60*60,milliseconds:J*24*60*60*1e3},quarters:{months:3,weeks:J/28,days:J/4,hours:J*24/4,minutes:J*24*60/4,seconds:J*24*60*60/4,milliseconds:J*24*60*60*1e3/4},months:{weeks:Ie/7,days:Ie,hours:Ie*24,minutes:Ie*24*60,seconds:Ie*24*60*60,milliseconds:Ie*24*60*60*1e3},...vi},Ne=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Fa=Ne.slice(0).reverse();function ae(n,e,t=!1){const r={values:t?e.values:{...n.values,...e.values||{}},loc:n.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||n.conversionAccuracy,matrix:e.matrix||n.matrix};return new O(r)}function ki(n,e){let t=e.milliseconds??0;for(const r of Fa.slice(1))e[r]&&(t+=e[r]*n[r].milliseconds);return t}function sr(n,e){const t=ki(n,e)<0?-1:1;Ne.reduceRight((r,i)=>{if(N(e[i]))return r;if(r){const s=e[r]*t,o=n[i][r],a=Math.floor(s/o);e[i]+=a*t,e[r]-=a*o*t}return i},null),Ne.reduce((r,i)=>{if(N(e[i]))return r;if(r){const s=e[r]%1;e[r]-=s,e[i]+=s*n[r][i]}return i},null)}function or(n){const e={};for(const[t,r]of Object.entries(n))r!==0&&(e[t]=r);return e}class O{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let r=t?ka:va;e.matrix&&(r=e.matrix),this.values=e.values,this.loc=e.loc||C.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=r,this.isLuxonDuration=!0}static fromMillis(e,t){return O.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new V(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new O({values:Rt(e,O.normalizeUnit),loc:C.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(ye(e))return O.fromMillis(e);if(O.isDuration(e))return e;if(typeof e=="object")return O.fromObject(e);throw new V(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[r]=Na(e);return r?O.fromObject(r,t):O.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[r]=ba(e);return r?O.fromObject(r,t):O.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new V("need to specify a reason the Duration is invalid");const r=e instanceof ne?e:new ne(e,t);if(M.throwOnInvalid)throw new no(r);return new O({invalid:r})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new Lr(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const r={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?U.create(this.loc,r).formatDurationFromString(this,e):ir}toHuman(e={}){if(!this.isValid)return ir;const t=e.showZeros!==!1,r=Ne.map(i=>{const s=this.values[i];return N(s)||s===0&&!t?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:i.slice(0,-1)}).format(s)}).filter(i=>i);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(r)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=Nn(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},w.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?ki(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=O.fromDurationLike(e),r={};for(const i of Ne)(Pe(t.values,i)||Pe(this.values,i))&&(r[i]=t.get(i)+this.get(i));return ae(this,{values:r},!0)}minus(e){if(!this.isValid)return this;const t=O.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const r of Object.keys(this.values))t[r]=pi(e(this.values[r],r));return ae(this,{values:t},!0)}get(e){return this[O.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...Rt(e,O.normalizeUnit)};return ae(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:r,matrix:i}={}){const o={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:i,conversionAccuracy:r};return ae(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return sr(this.matrix,e),ae(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=or(this.normalize().shiftToAll().toObject());return ae(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>O.normalizeUnit(o));const t={},r={},i=this.toObject();let s;for(const o of Ne)if(e.indexOf(o)>=0){s=o;let a=0;for(const l in r)a+=this.matrix[l][o]*r[l],r[l]=0;ye(i[o])&&(a+=i[o]);const c=Math.trunc(a);t[o]=c,r[o]=(a*1e3-c*1e3)/1e3}else ye(i[o])&&(r[o]=i[o]);for(const o in r)r[o]!==0&&(t[s]+=o===s?r[o]:r[o]/this.matrix[s][o]);return sr(this.matrix,t),ae(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return ae(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;const e=or(this.values);return ae(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(r,i){return r===void 0||r===0?i===void 0||i===0:r===i}for(const r of Ne)if(!t(this.values[r],e.values[r]))return!1;return!0}}const ve="Invalid Interval";function Ma(n,e){return!n||!n.isValid?F.invalid("missing or invalid start"):!e||!e.isValid?F.invalid("missing or invalid end"):e<n?F.invalid("end before start",`The end of an interval must be after its start, but you had start=${n.toISO()} and end=${e.toISO()}`):null}class F{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new V("need to specify a reason the Interval is invalid");const r=e instanceof ne?e:new ne(e,t);if(M.throwOnInvalid)throw new to(r);return new F({invalid:r})}static fromDateTimes(e,t){const r=qe(e),i=qe(t),s=Ma(r,i);return s??new F({start:r,end:i})}static after(e,t){const r=O.fromDurationLike(t),i=qe(e);return F.fromDateTimes(i,i.plus(r))}static before(e,t){const r=O.fromDurationLike(t),i=qe(e);return F.fromDateTimes(i.minus(r),i)}static fromISO(e,t){const[r,i]=(e||"").split("/",2);if(r&&i){let s,o;try{s=w.fromISO(r,t),o=s.isValid}catch{o=!1}let a,c;try{a=w.fromISO(i,t),c=a.isValid}catch{c=!1}if(o&&c)return F.fromDateTimes(s,a);if(o){const l=O.fromISO(i,t);if(l.isValid)return F.after(s,l)}else if(c){const l=O.fromISO(r,t);if(l.isValid)return F.before(a,l)}}return F.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;const r=this.start.startOf(e,t);let i;return t?.useLocaleWeeks?i=this.end.reconfigure({locale:r.locale}):i=this.end,i=i.startOf(e,t),Math.floor(i.diff(r,e).get(e))+(i.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?F.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(qe).filter(o=>this.contains(o)).sort((o,a)=>o.toMillis()-a.toMillis()),r=[];let{s:i}=this,s=0;for(;i<this.e;){const o=t[s]||this.e,a=+o>+this.e?this.e:o;r.push(F.fromDateTimes(i,a)),i=a,s+=1}return r}splitBy(e){const t=O.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:r}=this,i=1,s;const o=[];for(;r<this.e;){const a=this.start.plus(t.mapUnits(c=>c*i));s=+a>+this.e?this.e:a,o.push(F.fromDateTimes(r,s)),r=s,i+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,r=this.e<e.e?this.e:e.e;return t>=r?null:F.fromDateTimes(t,r)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,r=this.e>e.e?this.e:e.e;return F.fromDateTimes(t,r)}static merge(e){const[t,r]=e.sort((i,s)=>i.s-s.s).reduce(([i,s],o)=>s?s.overlaps(o)||s.abutsStart(o)?[i,s.union(o)]:[i.concat([s]),o]:[i,o],[[],null]);return r&&t.push(r),t}static xor(e){let t=null,r=0;const i=[],s=e.map(c=>[{time:c.s,type:"s"},{time:c.e,type:"e"}]),o=Array.prototype.concat(...s),a=o.sort((c,l)=>c.time-l.time);for(const c of a)r+=c.type==="s"?1:-1,r===1?t=c.time:(t&&+t!=+c.time&&i.push(F.fromDateTimes(t,c.time)),t=null);return F.merge(i)}difference(...e){return F.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:ve}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=Ot,t={}){return this.isValid?U.create(this.s.loc.clone(t),e).formatInterval(this):ve}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:ve}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:ve}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:ve}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:ve}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):O.invalid(this.invalidReason)}mapEndpoints(e){return F.fromDateTimes(e(this.s),e(this.e))}}class ft{static hasDST(e=M.defaultZone){const t=w.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return ce.isValidZone(e)}static normalizeZone(e){return pe(e,M.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||C.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||C.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||C.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:r=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||C.create(t,r,s)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||C.create(t,r,s)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:r=null,locObj:i=null}={}){return(i||C.create(t,r,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:i=null}={}){return(i||C.create(t,r,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return C.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return C.create(t,null,"gregory").eras(e)}static features(){return{relative:di(),localeWeek:hi()}}}function ar(n,e){const t=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=t(e)-t(n);return Math.floor(O.fromMillis(r).as("days"))}function xa(n,e,t){const r=[["years",(c,l)=>l.year-c.year],["quarters",(c,l)=>l.quarter-c.quarter+(l.year-c.year)*4],["months",(c,l)=>l.month-c.month+(l.year-c.year)*12],["weeks",(c,l)=>{const u=ar(c,l);return(u-u%7)/7}],["days",ar]],i={},s=n;let o,a;for(const[c,l]of r)t.indexOf(c)>=0&&(o=c,i[c]=l(n,e),a=s.plus(i),a>e?(i[c]--,n=s.plus(i),n>e&&(a=n,i[c]--,n=s.plus(i))):n=a);return[n,i,a,o]}function Pa(n,e,t,r){let[i,s,o,a]=xa(n,e,t);const c=e-i,l=t.filter(f=>["hours","minutes","seconds","milliseconds"].indexOf(f)>=0);l.length===0&&(o<e&&(o=i.plus({[a]:1})),o!==i&&(s[a]=(s[a]||0)+c/(o-i)));const u=O.fromObject(s,r);return l.length>0?O.fromMillis(c,r).shiftTo(...l).plus(u):u}const _a="missing Intl.DateTimeFormat.formatToParts support";function b(n,e=t=>t){return{regex:n,deser:([t])=>e(Co(t))}}const za=" ",Fi=`[ ${za}]`,Mi=new RegExp(Fi,"g");function Da(n){return n.replace(/\./g,"\\.?").replace(Mi,Fi)}function cr(n){return n.replace(/\./g,"").replace(Mi," ").toLowerCase()}function te(n,e){return n===null?null:{regex:RegExp(n.map(Da).join("|")),deser:([t])=>n.findIndex(r=>cr(t)===cr(r))+e}}function lr(n,e){return{regex:n,deser:([,t,r])=>Mt(t,r),groups:e}}function dt(n){return{regex:n,deser:([e])=>e}}function La(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Va(n,e){const t=ee(e),r=ee(e,"{2}"),i=ee(e,"{3}"),s=ee(e,"{4}"),o=ee(e,"{6}"),a=ee(e,"{1,2}"),c=ee(e,"{1,3}"),l=ee(e,"{1,6}"),u=ee(e,"{1,9}"),f=ee(e,"{2,4}"),y=ee(e,"{4,6}"),g=m=>({regex:RegExp(La(m.val)),deser:([S])=>S,literal:!0}),p=(m=>{if(n.literal)return g(m);switch(m.val){case"G":return te(e.eras("short"),0);case"GG":return te(e.eras("long"),0);case"y":return b(l);case"yy":return b(f,dn);case"yyyy":return b(s);case"yyyyy":return b(y);case"yyyyyy":return b(o);case"M":return b(a);case"MM":return b(r);case"MMM":return te(e.months("short",!0),1);case"MMMM":return te(e.months("long",!0),1);case"L":return b(a);case"LL":return b(r);case"LLL":return te(e.months("short",!1),1);case"LLLL":return te(e.months("long",!1),1);case"d":return b(a);case"dd":return b(r);case"o":return b(c);case"ooo":return b(i);case"HH":return b(r);case"H":return b(a);case"hh":return b(r);case"h":return b(a);case"mm":return b(r);case"m":return b(a);case"q":return b(a);case"qq":return b(r);case"s":return b(a);case"ss":return b(r);case"S":return b(c);case"SSS":return b(i);case"u":return dt(u);case"uu":return dt(a);case"uuu":return b(t);case"a":return te(e.meridiems(),0);case"kkkk":return b(s);case"kk":return b(f,dn);case"W":return b(a);case"WW":return b(r);case"E":case"c":return b(t);case"EEE":return te(e.weekdays("short",!1),1);case"EEEE":return te(e.weekdays("long",!1),1);case"ccc":return te(e.weekdays("short",!0),1);case"cccc":return te(e.weekdays("long",!0),1);case"Z":case"ZZ":return lr(new RegExp(`([+-]${a.source})(?::(${r.source}))?`),2);case"ZZZ":return lr(new RegExp(`([+-]${a.source})(${r.source})?`),2);case"z":return dt(/[a-z_+-/]{1,256}?/i);case" ":return dt(/[^\S\n\r]/);default:return g(m)}})(n)||{invalidReason:_a};return p.token=n,p}const Ua={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function $a(n,e,t){const{type:r,value:i}=n;if(r==="literal"){const c=/^\s+$/.test(i);return{literal:!c,val:c?" ":i}}const s=e[r];let o=r;r==="hour"&&(e.hour12!=null?o=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?o="hour12":o="hour24":o=t.hour12?"hour12":"hour24");let a=Ua[o];if(typeof a=="object"&&(a=a[s]),a)return{literal:!1,val:a}}function Ha(n){return[`^${n.map(t=>t.regex).reduce((t,r)=>`${t}(${r.source})`,"")}$`,n]}function Ba(n,e,t){const r=n.match(e);if(r){const i={};let s=1;for(const o in t)if(Pe(t,o)){const a=t[o],c=a.groups?a.groups+1:1;!a.literal&&a.token&&(i[a.token.val[0]]=a.deser(r.slice(s,s+c))),s+=c}return[r,i]}else return[r,{}]}function Wa(n){const e=s=>{switch(s){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let t=null,r;return N(n.z)||(t=ce.create(n.z)),N(n.Z)||(t||(t=new B(n.Z)),r=n.Z),N(n.q)||(n.M=(n.q-1)*3+1),N(n.h)||(n.h<12&&n.a===1?n.h+=12:n.h===12&&n.a===0&&(n.h=0)),n.G===0&&n.y&&(n.y=-n.y),N(n.u)||(n.S=Sn(n.u)),[Object.keys(n).reduce((s,o)=>{const a=e(o);return a&&(s[a]=n[o]),s},{}),t,r]}let Zt=null;function qa(){return Zt||(Zt=w.fromMillis(1555555555555)),Zt}function Za(n,e){if(n.literal)return n;const t=U.macroTokenToFormatOpts(n.val),r=zi(t,e);return r==null||r.includes(void 0)?n:r}function xi(n,e){return Array.prototype.concat(...n.map(t=>Za(t,e)))}class Pi{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=xi(U.parseFormat(t),e),this.units=this.tokens.map(r=>Va(r,e)),this.disqualifyingUnit=this.units.find(r=>r.invalidReason),!this.disqualifyingUnit){const[r,i]=Ha(this.units);this.regex=RegExp(r,"i"),this.handlers=i}}explainFromTokens(e){if(this.isValid){const[t,r]=Ba(e,this.regex,this.handlers),[i,s,o]=r?Wa(r):[null,null,void 0];if(Pe(r,"a")&&Pe(r,"H"))throw new Fe("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:r,result:i,zone:s,specificOffset:o}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function _i(n,e,t){return new Pi(n,t).explainFromTokens(e)}function Ya(n,e,t){const{result:r,zone:i,specificOffset:s,invalidReason:o}=_i(n,e,t);return[r,i,s,o]}function zi(n,e){if(!n)return null;const r=U.create(e,n).dtFormatter(qa()),i=r.formatToParts(),s=r.resolvedOptions();return i.map(o=>$a(o,n,s))}const Yt="Invalid DateTime",ur=864e13;function je(n){return new ne("unsupported zone",`the zone "${n.name}" is not supported`)}function jt(n){return n.weekData===null&&(n.weekData=bt(n.c)),n.weekData}function Gt(n){return n.localWeekData===null&&(n.localWeekData=bt(n.c,n.loc.getMinDaysInFirstWeek(),n.loc.getStartOfWeek())),n.localWeekData}function Te(n,e){const t={ts:n.ts,zone:n.zone,c:n.c,o:n.o,loc:n.loc,invalid:n.invalid};return new w({...t,...e,old:t})}function Di(n,e,t){let r=n-e*60*1e3;const i=t.offset(r);if(e===i)return[r,e];r-=(i-e)*60*1e3;const s=t.offset(r);return i===s?[r,i]:[n-Math.min(i,s)*60*1e3,Math.max(i,s)]}function ht(n,e){n+=e*60*1e3;const t=new Date(n);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function yt(n,e,t){return Di(Ft(n),e,t)}function fr(n,e){const t=n.o,r=n.c.year+Math.trunc(e.years),i=n.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,s={...n.c,year:r,month:i,day:Math.min(n.c.day,Ct(r,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=O.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),a=Ft(s);let[c,l]=Di(a,t,n.zone);return o!==0&&(c+=o,l=n.zone.offset(c)),{ts:c,o:l}}function ke(n,e,t,r,i,s){const{setZone:o,zone:a}=t;if(n&&Object.keys(n).length!==0||e){const c=e||a,l=w.fromObject(n,{...t,zone:c,specificOffset:s});return o?l:l.setZone(a)}else return w.invalid(new ne("unparsable",`the input "${i}" can't be parsed as ${r}`))}function mt(n,e,t=!0){return n.isValid?U.create(C.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function Jt(n,e,t){const r=n.c.year>9999||n.c.year<0;let i="";if(r&&n.c.year>=0&&(i+="+"),i+=z(n.c.year,r?6:4),t==="year")return i;if(e){if(i+="-",i+=z(n.c.month),t==="month")return i;i+="-"}else if(i+=z(n.c.month),t==="month")return i;return i+=z(n.c.day),i}function dr(n,e,t,r,i,s,o){let a=!t||n.c.millisecond!==0||n.c.second!==0,c="";switch(o){case"day":case"month":case"year":break;default:if(c+=z(n.c.hour),o==="hour")break;if(e){if(c+=":",c+=z(n.c.minute),o==="minute")break;a&&(c+=":",c+=z(n.c.second))}else{if(c+=z(n.c.minute),o==="minute")break;a&&(c+=z(n.c.second))}if(o==="second")break;a&&(!r||n.c.millisecond!==0)&&(c+=".",c+=z(n.c.millisecond,3))}return i&&(n.isOffsetFixed&&n.offset===0&&!s?c+="Z":n.o<0?(c+="-",c+=z(Math.trunc(-n.o/60)),c+=":",c+=z(Math.trunc(-n.o%60))):(c+="+",c+=z(Math.trunc(n.o/60)),c+=":",c+=z(Math.trunc(n.o%60)))),s&&(c+="["+n.zone.ianaName+"]"),c}const Li={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},ja={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Ga={ordinal:1,hour:0,minute:0,second:0,millisecond:0},gt=["year","month","day","hour","minute","second","millisecond"],Ja=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Xa=["year","ordinal","hour","minute","second","millisecond"];function Et(n){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[n.toLowerCase()];if(!e)throw new Lr(n);return e}function hr(n){switch(n.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Et(n)}}function Ka(n){if(Ge===void 0&&(Ge=M.now()),n.type!=="iana")return n.offset(Ge);const e=n.name;let t=hn.get(e);return t===void 0&&(t=n.offset(Ge),hn.set(e,t)),t}function mr(n,e){const t=pe(e.zone,M.defaultZone);if(!t.isValid)return w.invalid(je(t));const r=C.fromObject(e);let i,s;if(N(n.year))i=M.now();else{for(const c of gt)N(n[c])&&(n[c]=Li[c]);const o=ui(n)||fi(n);if(o)return w.invalid(o);const a=Ka(t);[i,s]=yt(n,a,t)}return new w({ts:i,zone:t,loc:r,o:s})}function pr(n,e,t){const r=N(t.round)?!0:t.round,i=N(t.rounding)?"trunc":t.rounding,s=(a,c)=>(a=Nn(a,r||t.calendary?0:2,t.calendary?"round":i),e.loc.clone(t).relFormatter(t).format(a,c)),o=a=>t.calendary?e.hasSame(n,a)?0:e.startOf(a).diff(n.startOf(a),a).get(a):e.diff(n,a).get(a);if(t.unit)return s(o(t.unit),t.unit);for(const a of t.units){const c=o(a);if(Math.abs(c)>=1)return s(c,a)}return s(n>e?-0:0,t.units[t.units.length-1])}function yr(n){let e={},t;return n.length>0&&typeof n[n.length-1]=="object"?(e=n[n.length-1],t=Array.from(n).slice(0,n.length-1)):t=Array.from(n),[e,t]}let Ge;const hn=new Map;class w{constructor(e){const t=e.zone||M.defaultZone;let r=e.invalid||(Number.isNaN(e.ts)?new ne("invalid input"):null)||(t.isValid?null:je(t));this.ts=N(e.ts)?M.now():e.ts;let i=null,s=null;if(!r)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[i,s]=[e.old.c,e.old.o];else{const a=ye(e.o)&&!e.old?e.o:t.offset(this.ts);i=ht(this.ts,a),r=Number.isNaN(i.year)?new ne("invalid input"):null,i=r?null:i,s=r?null:a}this._zone=t,this.loc=e.loc||C.create(),this.invalid=r,this.weekData=null,this.localWeekData=null,this.c=i,this.o=s,this.isLuxonDateTime=!0}static now(){return new w({})}static local(){const[e,t]=yr(arguments),[r,i,s,o,a,c,l]=t;return mr({year:r,month:i,day:s,hour:o,minute:a,second:c,millisecond:l},e)}static utc(){const[e,t]=yr(arguments),[r,i,s,o,a,c,l]=t;return e.zone=B.utcInstance,mr({year:r,month:i,day:s,hour:o,minute:a,second:c,millisecond:l},e)}static fromJSDate(e,t={}){const r=ko(e)?e.valueOf():NaN;if(Number.isNaN(r))return w.invalid("invalid input");const i=pe(t.zone,M.defaultZone);return i.isValid?new w({ts:r,zone:i,loc:C.fromObject(t)}):w.invalid(je(i))}static fromMillis(e,t={}){if(ye(e))return e<-ur||e>ur?w.invalid("Timestamp out of range"):new w({ts:e,zone:pe(t.zone,M.defaultZone),loc:C.fromObject(t)});throw new V(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(ye(e))return new w({ts:e*1e3,zone:pe(t.zone,M.defaultZone),loc:C.fromObject(t)});throw new V("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const r=pe(t.zone,M.defaultZone);if(!r.isValid)return w.invalid(je(r));const i=C.fromObject(t),s=Rt(e,hr),{minDaysInFirstWeek:o,startOfWeek:a}=Qn(s,i),c=M.now(),l=N(t.specificOffset)?r.offset(c):t.specificOffset,u=!N(s.ordinal),f=!N(s.year),y=!N(s.month)||!N(s.day),g=f||y,h=s.weekYear||s.weekNumber;if((g||u)&&h)throw new Fe("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(y&&u)throw new Fe("Can't mix ordinal dates with month/day");const p=h||s.weekday&&!g;let m,S,v=ht(c,l);p?(m=Ja,S=ja,v=bt(v,o,a)):u?(m=Xa,S=Ga,v=qt(v)):(m=gt,S=Li);let k=!1;for(const le of m){const at=s[le];N(at)?k?s[le]=S[le]:s[le]=v[le]:k=!0}const x=p?Ao(s,o,a):u?Io(s):ui(s),D=x||fi(s);if(D)return w.invalid(D);const oe=p?Xn(s,o,a):u?Kn(s):s,[W,$e]=yt(oe,l,r),se=new w({ts:W,zone:r,o:$e,loc:i});return s.weekday&&g&&e.weekday!==se.weekday?w.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${se.toISO()}`):se.isValid?se:w.invalid(se.invalid)}static fromISO(e,t={}){const[r,i]=wa(e);return ke(r,i,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[r,i]=Ta(e);return ke(r,i,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[r,i]=Sa(e);return ke(r,i,t,"HTTP",t)}static fromFormat(e,t,r={}){if(N(e)||N(t))throw new V("fromFormat requires an input string and a format");const{locale:i=null,numberingSystem:s=null}=r,o=C.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0}),[a,c,l,u]=Ya(o,e,t);return u?w.invalid(u):ke(a,c,r,`format ${t}`,e,l)}static fromString(e,t,r={}){return w.fromFormat(e,t,r)}static fromSQL(e,t={}){const[r,i]=Ia(e);return ke(r,i,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new V("need to specify a reason the DateTime is invalid");const r=e instanceof ne?e:new ne(e,t);if(M.throwOnInvalid)throw new eo(r);return new w({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const r=zi(e,C.fromObject(t));return r?r.map(i=>i?i.val:null).join(""):null}static expandFormat(e,t={}){return xi(U.parseFormat(e),C.fromObject(t)).map(i=>i.val).join("")}static resetCache(){Ge=void 0,hn.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?jt(this).weekYear:NaN}get weekNumber(){return this.isValid?jt(this).weekNumber:NaN}get weekday(){return this.isValid?jt(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Gt(this).weekday:NaN}get localWeekNumber(){return this.isValid?Gt(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Gt(this).weekYear:NaN}get ordinal(){return this.isValid?qt(this.c).ordinal:NaN}get monthShort(){return this.isValid?ft.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?ft.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?ft.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?ft.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,r=Ft(this.c),i=this.zone.offset(r-e),s=this.zone.offset(r+e),o=this.zone.offset(r-i*t),a=this.zone.offset(r-s*t);if(o===a)return[this];const c=r-o*t,l=r-a*t,u=ht(c,o),f=ht(l,a);return u.hour===f.hour&&u.minute===f.minute&&u.second===f.second&&u.millisecond===f.millisecond?[Te(this,{ts:c}),Te(this,{ts:l})]:[this]}get isInLeapYear(){return Qe(this.year)}get daysInMonth(){return Ct(this.year,this.month)}get daysInYear(){return this.isValid?Me(this.year):NaN}get weeksInWeekYear(){return this.isValid?Xe(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Xe(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:r,calendar:i}=U.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:r,outputCalendar:i}}toUTC(e=0,t={}){return this.setZone(B.instance(e),t)}toLocal(){return this.setZone(M.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:r=!1}={}){if(e=pe(e,M.defaultZone),e.equals(this.zone))return this;if(e.isValid){let i=this.ts;if(t||r){const s=e.offset(this.ts),o=this.toObject();[i]=yt(o,s,e)}return Te(this,{ts:i,zone:e})}else return w.invalid(je(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:r}={}){const i=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:r});return Te(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=Rt(e,hr),{minDaysInFirstWeek:r,startOfWeek:i}=Qn(t,this.loc),s=!N(t.weekYear)||!N(t.weekNumber)||!N(t.weekday),o=!N(t.ordinal),a=!N(t.year),c=!N(t.month)||!N(t.day),l=a||c,u=t.weekYear||t.weekNumber;if((l||o)&&u)throw new Fe("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&o)throw new Fe("Can't mix ordinal dates with month/day");let f;s?f=Xn({...bt(this.c,r,i),...t},r,i):N(t.ordinal)?(f={...this.toObject(),...t},N(t.day)&&(f.day=Math.min(Ct(f.year,f.month),f.day))):f=Kn({...qt(this.c),...t});const[y,g]=yt(f,this.o,this.zone);return Te(this,{ts:y,o:g})}plus(e){if(!this.isValid)return this;const t=O.fromDurationLike(e);return Te(this,fr(this,t))}minus(e){if(!this.isValid)return this;const t=O.fromDurationLike(e).negate();return Te(this,fr(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const r={},i=O.normalizeUnit(e);switch(i){case"years":r.month=1;case"quarters":case"months":r.day=1;case"weeks":case"days":r.hour=0;case"hours":r.minute=0;case"minutes":r.second=0;case"seconds":r.millisecond=0;break}if(i==="weeks")if(t){const s=this.loc.getStartOfWeek(),{weekday:o}=this;o<s&&(r.weekNumber=this.weekNumber-1),r.weekday=s}else r.weekday=1;if(i==="quarters"){const s=Math.ceil(this.month/3);r.month=(s-1)*3+1}return this.set(r)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?U.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Yt}toLocaleString(e=Ot,t={}){return this.isValid?U.create(this.loc.clone(t),e).formatDateTime(this):Yt}toLocaleParts(e={}){return this.isValid?U.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:r=!1,includeOffset:i=!0,extendedZone:s=!1,precision:o="milliseconds"}={}){if(!this.isValid)return null;o=Et(o);const a=e==="extended";let c=Jt(this,a,o);return gt.indexOf(o)>=3&&(c+="T"),c+=dr(this,a,t,r,i,s,o),c}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?Jt(this,e==="extended",Et(t)):null}toISOWeekDate(){return mt(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:r=!0,includePrefix:i=!1,extendedZone:s=!1,format:o="extended",precision:a="milliseconds"}={}){return this.isValid?(a=Et(a),(i&&gt.indexOf(a)>=3?"T":"")+dr(this,o==="extended",t,e,r,s,a)):null}toRFC2822(){return mt(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return mt(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Jt(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:r=!0}={}){let i="HH:mm:ss.SSS";return(t||e)&&(r&&(i+=" "),t?i+="z":e&&(i+="ZZ")),mt(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Yt}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",r={}){if(!this.isValid||!e.isValid)return O.invalid("created by diffing an invalid DateTime");const i={locale:this.locale,numberingSystem:this.numberingSystem,...r},s=Fo(t).map(O.normalizeUnit),o=e.valueOf()>this.valueOf(),a=o?this:e,c=o?e:this,l=Pa(a,c,s,i);return o?l.negate():l}diffNow(e="milliseconds",t={}){return this.diff(w.now(),e,t)}until(e){return this.isValid?F.fromDateTimes(this,e):this}hasSame(e,t,r){if(!this.isValid)return!1;const i=e.valueOf(),s=this.setZone(e.zone,{keepLocalTime:!0});return s.startOf(t,r)<=i&&i<=s.endOf(t,r)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||w.fromObject({},{zone:this.zone}),r=e.padding?this<t?-e.padding:e.padding:0;let i=["years","months","days","hours","minutes","seconds"],s=e.unit;return Array.isArray(e.unit)&&(i=e.unit,s=void 0),pr(t,this.plus(r),{...e,numeric:"always",units:i,unit:s})}toRelativeCalendar(e={}){return this.isValid?pr(e.base||w.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(w.isDateTime))throw new V("min requires all arguments be DateTimes");return er(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(w.isDateTime))throw new V("max requires all arguments be DateTimes");return er(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,r={}){const{locale:i=null,numberingSystem:s=null}=r,o=C.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});return _i(o,e,t)}static fromStringExplain(e,t,r={}){return w.fromFormatExplain(e,t,r)}static buildFormatParser(e,t={}){const{locale:r=null,numberingSystem:i=null}=t,s=C.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});return new Pi(s,e)}static fromFormatParser(e,t,r={}){if(N(e)||N(t))throw new V("fromFormatParser requires an input string and a format parser");const{locale:i=null,numberingSystem:s=null}=r,o=C.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});if(!o.equals(t.locale))throw new V(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${t.locale}`);const{result:a,zone:c,specificOffset:l,invalidReason:u}=t.explainFromTokens(e);return u?w.invalid(u):ke(a,c,r,`format ${t.format}`,e,l)}static get DATE_SHORT(){return Ot}static get DATE_MED(){return Vr}static get DATE_MED_WITH_WEEKDAY(){return ro}static get DATE_FULL(){return Ur}static get DATE_HUGE(){return $r}static get TIME_SIMPLE(){return Hr}static get TIME_WITH_SECONDS(){return Br}static get TIME_WITH_SHORT_OFFSET(){return Wr}static get TIME_WITH_LONG_OFFSET(){return qr}static get TIME_24_SIMPLE(){return Zr}static get TIME_24_WITH_SECONDS(){return Yr}static get TIME_24_WITH_SHORT_OFFSET(){return jr}static get TIME_24_WITH_LONG_OFFSET(){return Gr}static get DATETIME_SHORT(){return Jr}static get DATETIME_SHORT_WITH_SECONDS(){return Xr}static get DATETIME_MED(){return Kr}static get DATETIME_MED_WITH_SECONDS(){return Qr}static get DATETIME_MED_WITH_WEEKDAY(){return io}static get DATETIME_FULL(){return ei}static get DATETIME_FULL_WITH_SECONDS(){return ti}static get DATETIME_HUGE(){return ni}static get DATETIME_HUGE_WITH_SECONDS(){return ri}}function qe(n){if(w.isDateTime(n))return n;if(n&&n.valueOf&&ye(n.valueOf()))return w.fromJSDate(n);if(n&&typeof n=="object")return w.fromObject(n);throw new V(`Unknown datetime argument: ${n}, of type ${typeof n}`)}const Qa=["dd/MM/yyyy","d/M/yyyy","dd-MM-yyyy","d-M-yyyy","yyyy-MM-dd","yyyy/MM/dd","dd/MM/yyyy HH:mm:ss","yyyy-MM-dd HH:mm:ss"];function L(n){if(!n)return null;const e=n.trim();if(!e)return null;const t=w.fromISO(e);if(t.isValid)return t;for(const s of Qa){const o=w.fromFormat(e,s);if(o.isValid)return o}const r=w.fromRFC2822(e);if(r.isValid)return r;const i=w.fromHTTP(e);return i.isValid?i:null}class Pt{parser=new Dr({ignoreAttributes:!1,attributeNamePrefix:""});constructor(){}checkResponseStatus(e){const{status:t,data:r,errors:i}=e;if(t>=200&&t<300)return!0;let s;const o=this.extractXmlData(r);if(o)try{s=this.parseXml(o,i)||void 0}catch(c){console.log("Error parsing error response XML:",c)}const a=s?.Risposta?.Testata?.Messaggio?.DescrizioneErrore;switch(t){case 400:return I(i,R.BAD_REQUEST,[],A.BAD_REQUEST+(a?`: ${a}`:"")),!1;case 402:return I(i,R.INSUFFICIENT_CREDIT,[],A.INSUFFICIENT_CREDIT),!1;case 404:return I(i,R.COMPANY_NOT_FOUND,[],A.COMPANY_NOT_FOUND),!1;case 503:return I(i,R.SERVICE_UNAVAILABLE,[],A.SERVICE_UNAVAILABLE),!1;case 500:return I(i,R.HTTP_ERROR,[],A.HTTP_ERROR+(a?`: ${a}`:"")),!1;default:return I(i,R.HTTP_ERROR,[],A.HTTP_ERROR+(a?`: ${a}`:"")),!1}}parseXml(e,t){try{return this.parser.parse(e)}catch(r){return console.log(r),I(t,R.XML_PARSE_ERROR,[],A.XML_PARSE_ERROR),null}}extractXmlData(e){return typeof e=="string"?e:e instanceof ArrayBuffer?new TextDecoder().decode(new Uint8Array(e)):ArrayBuffer.isView(e)?new TextDecoder().decode(e):null}}class ec extends Pt{constructor(e){super(),this.client=e}async getCompanySummaryByVatNumber(e,t){try{const r=await this.client.get("/registroimprese/imprese/ricerca/partitaiva",{params:{partitaIva:e,fSoloSedi:"S",responseType:"text"}});if(!this.checkResponseStatus({status:r.status,data:r.data,errors:t}))return null;const i=this.parseXml(r.data,t);if(!i)return null;const s=i.Risposta?.ListaImpreseRI?.Impresa?.AnagraficaImpresa;return s?new _n().mapAnagraficaImpresaToCompanySummary(s):(I(t,R.COMPANY_NOT_FOUND,["vatNumber"],A.COMPANY_NOT_FOUND),null)}catch(r){return console.log(r),I(t,R.COMPANY_SUMMARY_FETCH_FAILED,["vatNumber"],A.COMPANY_SUMMARY_FETCH_FAILED),null}}async getFinancialsByVatNumber(e,t){try{const r=await this.client.get("/registroimprese/bilanci/xbrl/codicefiscale",{params:{codiceFiscale:e,allXbrl:"S",responseType:"text"}});if(!this.checkResponseStatus({status:r.status,data:r.data,errors:t}))return null;const i=this.parseXml(r.data,t);return i?await new Xs().getFinancialValues(i,t):null}catch(r){return console.log(r),I(t,R.FINANCIALS_FETCH_FAILED,["vatNumber"],A.FINANCIALS_FETCH_FAILED),null}}async getSharesByRea(e,t,r){try{const i=await this.client.get("/registroimprese/output/impresa/soci/nrea/xml",{params:{cciaa:e,nRea:t},responseType:"text"});if(!this.checkResponseStatus({status:i.status,data:i.data,errors:r}))return[];const s=this.parseXml(i.data,r);if(!s)return[];const o=new Qs,a=o.parseCapital(s.Risposta.dati["blocchi-impresa"]["sintesi-cifre-impresa"]["capitale-sociale"].sottoscritto.ammontare),c=s.Risposta.dati["blocchi-impresa"]["elenco-soci"].riquadri.riquadro;return o.getShares(c,a)}catch(i){return console.log(i),I(r,R.SHARES_FETCH_FAILED,["companyShares"],A.SHARES_FETCH_FAILED),[]}}async getCompanyByRea(e,t,r,i){try{const s=await this.client.get("/registroimprese/output/impresa/blocchi/nrea/xml",{params:{cciaa:e,nRea:t,blocco:r},responseType:"text"});if(!this.checkResponseStatus({status:s.status,data:s.data,errors:i}))return;const o=this.parseXml(s.data,i);if(!o)return;const a=new _n;if(r==="AMM")return await a.mapRegistroImpresaToCompanyAdministrativeSummary(o)}catch(s){console.log(s),I(i,R.HTTP_ERROR,["companyIncorporationDate"],A.HTTP_ERROR)}}async getCompany(e){const t=[],r=await this.getCompanySummaryByVatNumber(e,t);if(!r)return null;const i=await this.getFinancialsByVatNumber(e,t)??{companyRevenue:0,companyProfit:0};let s=[];r.companyCciaaCode&&r.companyReaNumber?s=await this.getSharesByRea(r.companyCciaaCode,r.companyReaNumber,t):I(t,R.MISSING_CCIAA_OR_REA,[],A.MISSING_CCIAA_OR_REA);let o;r.companyCciaaCode&&r.companyReaNumber?o=await this.getCompanyByRea(r.companyCciaaCode,r.companyReaNumber,"AMM",t):I(t,R.MISSING_CCIAA_OR_REA,[],A.MISSING_CCIAA_OR_REA);const a=o?.identification.constitutionDate;return{...r,...i,companyShares:s,companyIncorporationDate:L(a),aiwsError:t}}}function Vi(n,e){return function(){return n.apply(e,arguments)}}const{toString:tc}=Object.prototype,{getPrototypeOf:Rn}=Object,{iterator:_t,toStringTag:Ui}=Symbol,zt=(n=>e=>{const t=tc.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),ie=n=>(n=n.toLowerCase(),e=>zt(e)===n),Dt=n=>e=>typeof e===n,{isArray:Ue}=Array,_e=Dt("undefined");function nt(n){return n!==null&&!_e(n)&&n.constructor!==null&&!_e(n.constructor)&&Y(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const $i=ie("ArrayBuffer");function nc(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&$i(n.buffer),e}const rc=Dt("string"),Y=Dt("function"),Hi=Dt("number"),rt=n=>n!==null&&typeof n=="object",ic=n=>n===!0||n===!1,wt=n=>{if(zt(n)!=="object")return!1;const e=Rn(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Ui in n)&&!(_t in n)},sc=n=>{if(!rt(n)||nt(n))return!1;try{return Object.keys(n).length===0&&Object.getPrototypeOf(n)===Object.prototype}catch{return!1}},oc=ie("Date"),ac=ie("File"),cc=ie("Blob"),lc=ie("FileList"),uc=n=>rt(n)&&Y(n.pipe),fc=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||Y(n.append)&&((e=zt(n))==="formdata"||e==="object"&&Y(n.toString)&&n.toString()==="[object FormData]"))},dc=ie("URLSearchParams"),[hc,mc,pc,yc]=["ReadableStream","Request","Response","Headers"].map(ie),gc=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function it(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let r,i;if(typeof n!="object"&&(n=[n]),Ue(n))for(r=0,i=n.length;r<i;r++)e.call(null,n[r],r,n);else{if(nt(n))return;const s=t?Object.getOwnPropertyNames(n):Object.keys(n),o=s.length;let a;for(r=0;r<o;r++)a=s[r],e.call(null,n[a],a,n)}}function Bi(n,e){if(nt(n))return null;e=e.toLowerCase();const t=Object.keys(n);let r=t.length,i;for(;r-- >0;)if(i=t[r],e===i.toLowerCase())return i;return null}const Oe=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Wi=n=>!_e(n)&&n!==Oe;function mn(){const{caseless:n,skipUndefined:e}=Wi(this)&&this||{},t={},r=(i,s)=>{if(s==="__proto__"||s==="constructor"||s==="prototype")return;const o=n&&Bi(t,s)||s;wt(t[o])&&wt(i)?t[o]=mn(t[o],i):wt(i)?t[o]=mn({},i):Ue(i)?t[o]=i.slice():(!e||!_e(i))&&(t[o]=i)};for(let i=0,s=arguments.length;i<s;i++)arguments[i]&&it(arguments[i],r);return t}const Ec=(n,e,t,{allOwnKeys:r}={})=>(it(e,(i,s)=>{t&&Y(i)?Object.defineProperty(n,s,{value:Vi(i,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(n,s,{value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),n),wc=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),Tc=(n,e,t,r)=>{n.prototype=Object.create(e.prototype,r),Object.defineProperty(n.prototype,"constructor",{value:n,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},Sc=(n,e,t,r)=>{let i,s,o;const a={};if(e=e||{},n==null)return e;do{for(i=Object.getOwnPropertyNames(n),s=i.length;s-- >0;)o=i[s],(!r||r(o,n,e))&&!a[o]&&(e[o]=n[o],a[o]=!0);n=t!==!1&&Rn(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},Nc=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const r=n.indexOf(e,t);return r!==-1&&r===t},Oc=n=>{if(!n)return null;if(Ue(n))return n;let e=n.length;if(!Hi(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},bc=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&Rn(Uint8Array)),Cc=(n,e)=>{const r=(n&&n[_t]).call(n);let i;for(;(i=r.next())&&!i.done;){const s=i.value;e.call(n,s[0],s[1])}},Rc=(n,e)=>{let t;const r=[];for(;(t=n.exec(e))!==null;)r.push(t);return r},Ac=ie("HTMLFormElement"),Ic=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,r,i){return r.toUpperCase()+i}),gr=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),vc=ie("RegExp"),qi=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),r={};it(t,(i,s)=>{let o;(o=e(i,s,n))!==!1&&(r[s]=o||i)}),Object.defineProperties(n,r)},kc=n=>{qi(n,(e,t)=>{if(Y(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const r=n[t];if(Y(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},Fc=(n,e)=>{const t={},r=i=>{i.forEach(s=>{t[s]=!0})};return Ue(n)?r(n):r(String(n).split(e)),t},Mc=()=>{},xc=(n,e)=>n!=null&&Number.isFinite(n=+n)?n:e;function Pc(n){return!!(n&&Y(n.append)&&n[Ui]==="FormData"&&n[_t])}const _c=n=>{const e=new Array(10),t=(r,i)=>{if(rt(r)){if(e.indexOf(r)>=0)return;if(nt(r))return r;if(!("toJSON"in r)){e[i]=r;const s=Ue(r)?[]:{};return it(r,(o,a)=>{const c=t(o,i+1);!_e(c)&&(s[a]=c)}),e[i]=void 0,s}}return r};return t(n,0)},zc=ie("AsyncFunction"),Dc=n=>n&&(rt(n)||Y(n))&&Y(n.then)&&Y(n.catch),Zi=((n,e)=>n?setImmediate:e?((t,r)=>(Oe.addEventListener("message",({source:i,data:s})=>{i===Oe&&s===t&&r.length&&r.shift()()},!1),i=>{r.push(i),Oe.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Y(Oe.postMessage)),Lc=typeof queueMicrotask<"u"?queueMicrotask.bind(Oe):typeof process<"u"&&process.nextTick||Zi,Vc=n=>n!=null&&Y(n[_t]),d={isArray:Ue,isArrayBuffer:$i,isBuffer:nt,isFormData:fc,isArrayBufferView:nc,isString:rc,isNumber:Hi,isBoolean:ic,isObject:rt,isPlainObject:wt,isEmptyObject:sc,isReadableStream:hc,isRequest:mc,isResponse:pc,isHeaders:yc,isUndefined:_e,isDate:oc,isFile:ac,isBlob:cc,isRegExp:vc,isFunction:Y,isStream:uc,isURLSearchParams:dc,isTypedArray:bc,isFileList:lc,forEach:it,merge:mn,extend:Ec,trim:gc,stripBOM:wc,inherits:Tc,toFlatObject:Sc,kindOf:zt,kindOfTest:ie,endsWith:Nc,toArray:Oc,forEachEntry:Cc,matchAll:Rc,isHTMLForm:Ac,hasOwnProperty:gr,hasOwnProp:gr,reduceDescriptors:qi,freezeMethods:kc,toObjectSet:Fc,toCamelCase:Ic,noop:Mc,toFiniteNumber:xc,findKey:Bi,global:Oe,isContextDefined:Wi,isSpecCompliantForm:Pc,toJSONObject:_c,isAsyncFn:zc,isThenable:Dc,setImmediate:Zi,asap:Lc,isIterable:Vc};let T=class Yi extends Error{static from(e,t,r,i,s,o){const a=new Yi(e.message,t||e.code,r,i,s);return a.cause=e,a.name=e.name,o&&Object.assign(a,o),a}constructor(e,t,r,i,s){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),s&&(this.response=s,this.status=s.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:d.toJSONObject(this.config),code:this.code,status:this.status}}};T.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";T.ERR_BAD_OPTION="ERR_BAD_OPTION";T.ECONNABORTED="ECONNABORTED";T.ETIMEDOUT="ETIMEDOUT";T.ERR_NETWORK="ERR_NETWORK";T.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";T.ERR_DEPRECATED="ERR_DEPRECATED";T.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";T.ERR_BAD_REQUEST="ERR_BAD_REQUEST";T.ERR_CANCELED="ERR_CANCELED";T.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";T.ERR_INVALID_URL="ERR_INVALID_URL";const Uc=null;function pn(n){return d.isPlainObject(n)||d.isArray(n)}function ji(n){return d.endsWith(n,"[]")?n.slice(0,-2):n}function Er(n,e,t){return n?n.concat(e).map(function(i,s){return i=ji(i),!t&&s?"["+i+"]":i}).join(t?".":""):e}function $c(n){return d.isArray(n)&&!n.some(pn)}const Hc=d.toFlatObject(d,{},null,function(e){return/^is[A-Z]/.test(e)});function Lt(n,e,t){if(!d.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=d.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(p,m){return!d.isUndefined(m[p])});const r=t.metaTokens,i=t.visitor||u,s=t.dots,o=t.indexes,c=(t.Blob||typeof Blob<"u"&&Blob)&&d.isSpecCompliantForm(e);if(!d.isFunction(i))throw new TypeError("visitor must be a function");function l(h){if(h===null)return"";if(d.isDate(h))return h.toISOString();if(d.isBoolean(h))return h.toString();if(!c&&d.isBlob(h))throw new T("Blob is not supported. Use a Buffer instead.");return d.isArrayBuffer(h)||d.isTypedArray(h)?c&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function u(h,p,m){let S=h;if(h&&!m&&typeof h=="object"){if(d.endsWith(p,"{}"))p=r?p:p.slice(0,-2),h=JSON.stringify(h);else if(d.isArray(h)&&$c(h)||(d.isFileList(h)||d.endsWith(p,"[]"))&&(S=d.toArray(h)))return p=ji(p),S.forEach(function(k,x){!(d.isUndefined(k)||k===null)&&e.append(o===!0?Er([p],x,s):o===null?p:p+"[]",l(k))}),!1}return pn(h)?!0:(e.append(Er(m,p,s),l(h)),!1)}const f=[],y=Object.assign(Hc,{defaultVisitor:u,convertValue:l,isVisitable:pn});function g(h,p){if(!d.isUndefined(h)){if(f.indexOf(h)!==-1)throw Error("Circular reference detected in "+p.join("."));f.push(h),d.forEach(h,function(S,v){(!(d.isUndefined(S)||S===null)&&i.call(e,S,d.isString(v)?v.trim():v,p,y))===!0&&g(S,p?p.concat(v):[v])}),f.pop()}}if(!d.isObject(n))throw new TypeError("data must be an object");return g(n),e}function wr(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function An(n,e){this._pairs=[],n&&Lt(n,this,e)}const Gi=An.prototype;Gi.append=function(e,t){this._pairs.push([e,t])};Gi.toString=function(e){const t=e?function(r){return e.call(this,r,wr)}:wr;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function Bc(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ji(n,e,t){if(!e)return n;const r=t&&t.encode||Bc,i=d.isFunction(t)?{serialize:t}:t,s=i&&i.serialize;let o;if(s?o=s(e,i):o=d.isURLSearchParams(e)?e.toString():new An(e,i).toString(r),o){const a=n.indexOf("#");a!==-1&&(n=n.slice(0,a)),n+=(n.indexOf("?")===-1?"?":"&")+o}return n}class Tr{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){d.forEach(this.handlers,function(r){r!==null&&e(r)})}}const In={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Wc=typeof URLSearchParams<"u"?URLSearchParams:An,qc=typeof FormData<"u"?FormData:null,Zc=typeof Blob<"u"?Blob:null,Yc={isBrowser:!0,classes:{URLSearchParams:Wc,FormData:qc,Blob:Zc},protocols:["http","https","file","blob","url","data"]},vn=typeof window<"u"&&typeof document<"u",yn=typeof navigator=="object"&&navigator||void 0,jc=vn&&(!yn||["ReactNative","NativeScript","NS"].indexOf(yn.product)<0),Gc=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Jc=vn&&window.location.href||"http://localhost",Xc=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:vn,hasStandardBrowserEnv:jc,hasStandardBrowserWebWorkerEnv:Gc,navigator:yn,origin:Jc},Symbol.toStringTag,{value:"Module"})),$={...Xc,...Yc};function Kc(n,e){return Lt(n,new $.classes.URLSearchParams,{visitor:function(t,r,i,s){return $.isNode&&d.isBuffer(t)?(this.append(r,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},...e})}function Qc(n){return d.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function el(n){const e={},t=Object.keys(n);let r;const i=t.length;let s;for(r=0;r<i;r++)s=t[r],e[s]=n[s];return e}function Xi(n){function e(t,r,i,s){let o=t[s++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=s>=t.length;return o=!o&&d.isArray(i)?i.length:o,c?(d.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!a):((!i[o]||!d.isObject(i[o]))&&(i[o]=[]),e(t,r,i[o],s)&&d.isArray(i[o])&&(i[o]=el(i[o])),!a)}if(d.isFormData(n)&&d.isFunction(n.entries)){const t={};return d.forEachEntry(n,(r,i)=>{e(Qc(r),i,t,0)}),t}return null}function tl(n,e,t){if(d.isString(n))try{return(e||JSON.parse)(n),d.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}const st={transitional:In,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",i=r.indexOf("application/json")>-1,s=d.isObject(e);if(s&&d.isHTMLForm(e)&&(e=new FormData(e)),d.isFormData(e))return i?JSON.stringify(Xi(e)):e;if(d.isArrayBuffer(e)||d.isBuffer(e)||d.isStream(e)||d.isFile(e)||d.isBlob(e)||d.isReadableStream(e))return e;if(d.isArrayBufferView(e))return e.buffer;if(d.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Kc(e,this.formSerializer).toString();if((a=d.isFileList(e))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Lt(a?{"files[]":e}:e,c&&new c,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),tl(e)):e}],transformResponse:[function(e){const t=this.transitional||st.transitional,r=t&&t.forcedJSONParsing,i=this.responseType==="json";if(d.isResponse(e)||d.isReadableStream(e))return e;if(e&&d.isString(e)&&(r&&!this.responseType||i)){const o=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(a){if(o)throw a.name==="SyntaxError"?T.from(a,T.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:$.classes.FormData,Blob:$.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};d.forEach(["delete","get","head","post","put","patch"],n=>{st.headers[n]={}});const nl=d.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),rl=n=>{const e={};let t,r,i;return n&&n.split(`
5
5
  `).forEach(function(o){i=o.indexOf(":"),t=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!t||e[t]&&nl[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)}),e},Sr=Symbol("internals");function Ze(n){return n&&String(n).trim().toLowerCase()}function Tt(n){return n===!1||n==null?n:d.isArray(n)?n.map(Tt):String(n)}function il(n){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=t.exec(n);)e[r[1]]=r[2];return e}const sl=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function Xt(n,e,t,r,i){if(d.isFunction(r))return r.call(this,e,t);if(i&&(e=t),!!d.isString(e)){if(d.isString(r))return e.indexOf(r)!==-1;if(d.isRegExp(r))return r.test(e)}}function ol(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}function al(n,e){const t=d.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(n,r+t,{value:function(i,s,o){return this[r].call(this,e,i,s,o)},configurable:!0})})}let j=class{constructor(e){e&&this.set(e)}set(e,t,r){const i=this;function s(a,c,l){const u=Ze(c);if(!u)throw new Error("header name must be a non-empty string");const f=d.findKey(i,u);(!f||i[f]===void 0||l===!0||l===void 0&&i[f]!==!1)&&(i[f||c]=Tt(a))}const o=(a,c)=>d.forEach(a,(l,u)=>s(l,u,c));if(d.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(d.isString(e)&&(e=e.trim())&&!sl(e))o(rl(e),t);else if(d.isObject(e)&&d.isIterable(e)){let a={},c,l;for(const u of e){if(!d.isArray(u))throw TypeError("Object iterator must return a key-value pair");a[l=u[0]]=(c=a[l])?d.isArray(c)?[...c,u[1]]:[c,u[1]]:u[1]}o(a,t)}else e!=null&&s(t,e,r);return this}get(e,t){if(e=Ze(e),e){const r=d.findKey(this,e);if(r){const i=this[r];if(!t)return i;if(t===!0)return il(i);if(d.isFunction(t))return t.call(this,i,r);if(d.isRegExp(t))return t.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Ze(e),e){const r=d.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||Xt(this,this[r],r,t)))}return!1}delete(e,t){const r=this;let i=!1;function s(o){if(o=Ze(o),o){const a=d.findKey(r,o);a&&(!t||Xt(r,r[a],a,t))&&(delete r[a],i=!0)}}return d.isArray(e)?e.forEach(s):s(e),i}clear(e){const t=Object.keys(this);let r=t.length,i=!1;for(;r--;){const s=t[r];(!e||Xt(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const t=this,r={};return d.forEach(this,(i,s)=>{const o=d.findKey(r,s);if(o){t[o]=Tt(i),delete t[s];return}const a=e?ol(s):String(s).trim();a!==s&&delete t[s],t[a]=Tt(i),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return d.forEach(this,(r,i)=>{r!=null&&r!==!1&&(t[i]=e&&d.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
6
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[Sr]=this[Sr]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Ze(o);r[a]||(al(i,o),r[a]=!0)}return d.isArray(e)?e.forEach(s):s(e),this}};j.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);d.reduceDescriptors(j.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(r){this[t]=r}}});d.freezeMethods(j);function Kt(n,e){const t=this||st,r=e||t,i=j.from(r.headers);let s=r.data;return d.forEach(n,function(a){s=a.call(t,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function Ki(n){return!!(n&&n.__CANCEL__)}let ot=class extends T{constructor(e,t,r){super(e??"canceled",T.ERR_CANCELED,t,r),this.name="CanceledError",this.__CANCEL__=!0}};function Qi(n,e,t){const r=t.config.validateStatus;!t.status||!r||r(t.status)?n(t):e(new T("Request failed with status code "+t.status,[T.ERR_BAD_REQUEST,T.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function cl(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function ll(n,e){n=n||10;const t=new Array(n),r=new Array(n);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(c){const l=Date.now(),u=r[s];o||(o=l),t[i]=c,r[i]=l;let f=s,m=0;for(;f!==i;)m+=t[f++],f=f%n;if(i=(i+1)%n,i===s&&(s=(s+1)%n),l-o<e)return;const y=u&&l-u;return y?Math.round(m*1e3/y):void 0}}function ul(n,e){let t=0,r=1e3/e,i,s;const o=(l,u=Date.now())=>{t=u,i=null,s&&(clearTimeout(s),s=null),n(...l)};return[(...l)=>{const u=Date.now(),f=u-t;f>=r?o(l,u):(i=l,s||(s=setTimeout(()=>{s=null,o(i)},r-f)))},()=>i&&o(i)]}const At=(n,e,t=3)=>{let r=0;const i=ll(50,250);return ul(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,c=o-r,l=i(c),u=o<=a;r=o;const f={loaded:o,total:a,progress:a?o/a:void 0,bytes:c,rate:l||void 0,estimated:l&&a&&u?(a-o)/l:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};n(f)},t)},Nr=(n,e)=>{const t=n!=null;return[r=>e[0]({lengthComputable:t,total:n,loaded:r}),e[1]]},Or=n=>(...e)=>d.asap(()=>n(...e)),fl=U.hasStandardBrowserEnv?((n,e)=>t=>(t=new URL(t,U.origin),n.protocol===t.protocol&&n.host===t.host&&(e||n.port===t.port)))(new URL(U.origin),U.navigator&&/(msie|trident)/i.test(U.navigator.userAgent)):()=>!0,dl=U.hasStandardBrowserEnv?{write(n,e,t,r,i,s,o){if(typeof document>"u")return;const a=[`${n}=${encodeURIComponent(e)}`];d.isNumber(t)&&a.push(`expires=${new Date(t).toUTCString()}`),d.isString(r)&&a.push(`path=${r}`),d.isString(i)&&a.push(`domain=${i}`),s===!0&&a.push("secure"),d.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(n){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+n+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(n){this.write(n,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function hl(n){return typeof n!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function ml(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function es(n,e,t){let r=!hl(e);return n&&(r||t==!1)?ml(n,e):e}const br=n=>n instanceof j?{...n}:n;function Ce(n,e){e=e||{};const t={};function r(l,u,f,m){return d.isPlainObject(l)&&d.isPlainObject(u)?d.merge.call({caseless:m},l,u):d.isPlainObject(u)?d.merge({},u):d.isArray(u)?u.slice():u}function i(l,u,f,m){if(d.isUndefined(u)){if(!d.isUndefined(l))return r(void 0,l,f,m)}else return r(l,u,f,m)}function s(l,u){if(!d.isUndefined(u))return r(void 0,u)}function o(l,u){if(d.isUndefined(u)){if(!d.isUndefined(l))return r(void 0,l)}else return r(void 0,u)}function a(l,u,f){if(f in e)return r(l,u);if(f in n)return r(void 0,l)}const c={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,u,f)=>i(br(l),br(u),f,!0)};return d.forEach(Object.keys({...n,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const f=d.hasOwnProp(c,u)?c[u]:i,m=f(n[u],e[u],u);d.isUndefined(m)&&f!==a||(t[u]=m)}),t}const ts=n=>{const e=Ce({},n);let{data:t,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;if(e.headers=o=j.from(o),e.url=Ji(es(e.baseURL,e.url,e.allowAbsoluteUrls),n.params,n.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),d.isFormData(t)){if(U.hasStandardBrowserEnv||U.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(d.isFunction(t.getHeaders)){const c=t.getHeaders(),l=["content-type","content-length"];Object.entries(c).forEach(([u,f])=>{l.includes(u.toLowerCase())&&o.set(u,f)})}}if(U.hasStandardBrowserEnv&&(r&&d.isFunction(r)&&(r=r(e)),r||r!==!1&&fl(e.url))){const c=i&&s&&dl.read(s);c&&o.set(i,c)}return e},pl=typeof XMLHttpRequest<"u",yl=pl&&function(n){return new Promise(function(t,r){const i=ts(n);let s=i.data;const o=j.from(i.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:l}=i,u,f,m,y,h;function E(){y&&y(),h&&h(),i.cancelToken&&i.cancelToken.unsubscribe(u),i.signal&&i.signal.removeEventListener("abort",u)}let p=new XMLHttpRequest;p.open(i.method.toUpperCase(),i.url,!0),p.timeout=i.timeout;function N(){if(!p)return;const M=j.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders()),B={data:!a||a==="text"||a==="json"?p.responseText:p.response,status:p.status,statusText:p.statusText,headers:M,config:n,request:p};Qi(function(W){t(W),E()},function(W){r(W),E()},B),p=null}"onloadend"in p?p.onloadend=N:p.onreadystatechange=function(){!p||p.readyState!==4||p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0)||setTimeout(N)},p.onabort=function(){p&&(r(new T("Request aborted",T.ECONNABORTED,n,p)),p=null)},p.onerror=function(z){const B=z&&z.message?z.message:"Network Error",oe=new T(B,T.ERR_NETWORK,n,p);oe.event=z||null,r(oe),p=null},p.ontimeout=function(){let z=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const B=i.transitional||In;i.timeoutErrorMessage&&(z=i.timeoutErrorMessage),r(new T(z,B.clarifyTimeoutError?T.ETIMEDOUT:T.ECONNABORTED,n,p)),p=null},s===void 0&&o.setContentType(null),"setRequestHeader"in p&&d.forEach(o.toJSON(),function(z,B){p.setRequestHeader(B,z)}),d.isUndefined(i.withCredentials)||(p.withCredentials=!!i.withCredentials),a&&a!=="json"&&(p.responseType=i.responseType),l&&([m,h]=At(l,!0),p.addEventListener("progress",m)),c&&p.upload&&([f,y]=At(c),p.upload.addEventListener("progress",f),p.upload.addEventListener("loadend",y)),(i.cancelToken||i.signal)&&(u=M=>{p&&(r(!M||M.type?new ot(null,n,p):M),p.abort(),p=null)},i.cancelToken&&i.cancelToken.subscribe(u),i.signal&&(i.signal.aborted?u():i.signal.addEventListener("abort",u)));const v=cl(i.url);if(v&&U.protocols.indexOf(v)===-1){r(new T("Unsupported protocol "+v+":",T.ERR_BAD_REQUEST,n));return}p.send(s||null)})},gl=(n,e)=>{const{length:t}=n=n?n.filter(Boolean):[];if(e||t){let r=new AbortController,i;const s=function(l){if(!i){i=!0,a();const u=l instanceof Error?l:this.reason;r.abort(u instanceof T?u:new ot(u instanceof Error?u.message:u))}};let o=e&&setTimeout(()=>{o=null,s(new T(`timeout of ${e}ms exceeded`,T.ETIMEDOUT))},e);const a=()=>{n&&(o&&clearTimeout(o),o=null,n.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),n=null)};n.forEach(l=>l.addEventListener("abort",s));const{signal:c}=r;return c.unsubscribe=()=>d.asap(a),c}},El=function*(n,e){let t=n.byteLength;if(t<e){yield n;return}let r=0,i;for(;r<t;)i=r+e,yield n.slice(r,i),r=i},wl=async function*(n,e){for await(const t of Tl(n))yield*El(t,e)},Tl=async function*(n){if(n[Symbol.asyncIterator]){yield*n;return}const e=n.getReader();try{for(;;){const{done:t,value:r}=await e.read();if(t)break;yield r}}finally{await e.cancel()}},Cr=(n,e,t,r)=>{const i=wl(n,e);let s=0,o,a=c=>{o||(o=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:l,value:u}=await i.next();if(l){a(),c.close();return}let f=u.byteLength;if(t){let m=s+=f;t(m)}c.enqueue(new Uint8Array(u))}catch(l){throw a(l),l}},cancel(c){return a(c),i.return()}},{highWaterMark:2})},Rr=64*1024,{isFunction:pt}=d,Sl=(({Request:n,Response:e})=>({Request:n,Response:e}))(d.global),{ReadableStream:Ar,TextEncoder:Ir}=d.global,vr=(n,...e)=>{try{return!!n(...e)}catch{return!1}},Nl=n=>{n=d.merge.call({skipUndefined:!0},Sl,n);const{fetch:e,Request:t,Response:r}=n,i=e?pt(e):typeof fetch=="function",s=pt(t),o=pt(r);if(!i)return!1;const a=i&&pt(Ar),c=i&&(typeof Ir=="function"?(h=>E=>h.encode(E))(new Ir):async h=>new Uint8Array(await new t(h).arrayBuffer())),l=s&&a&&vr(()=>{let h=!1;const E=new t(U.origin,{body:new Ar,method:"POST",get duplex(){return h=!0,"half"}}).headers.has("Content-Type");return h&&!E}),u=o&&a&&vr(()=>d.isReadableStream(new r("").body)),f={stream:u&&(h=>h.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(h=>{!f[h]&&(f[h]=(E,p)=>{let N=E&&E[h];if(N)return N.call(E);throw new T(`Response type '${h}' is not supported`,T.ERR_NOT_SUPPORT,p)})});const m=async h=>{if(h==null)return 0;if(d.isBlob(h))return h.size;if(d.isSpecCompliantForm(h))return(await new t(U.origin,{method:"POST",body:h}).arrayBuffer()).byteLength;if(d.isArrayBufferView(h)||d.isArrayBuffer(h))return h.byteLength;if(d.isURLSearchParams(h)&&(h=h+""),d.isString(h))return(await c(h)).byteLength},y=async(h,E)=>{const p=d.toFiniteNumber(h.getContentLength());return p??m(E)};return async h=>{let{url:E,method:p,data:N,signal:v,cancelToken:M,timeout:z,onDownloadProgress:B,onUploadProgress:oe,responseType:W,headers:$e,withCredentials:se="same-origin",fetchOptions:le}=ts(h),at=e||fetch;W=W?(W+"").toLowerCase():"text";let ct=gl([v,M&&M.toAbortSignal()],z),He=null;const ge=ct&&ct.unsubscribe&&(()=>{ct.unsubscribe()});let Fn;try{if(oe&&l&&p!=="get"&&p!=="head"&&(Fn=await y($e,N))!==0){let fe=new t(E,{method:"POST",body:N,duplex:"half"}),Ae;if(d.isFormData(N)&&(Ae=fe.headers.get("content-type"))&&$e.setContentType(Ae),fe.body){const[Ut,lt]=Nr(Fn,At(Or(oe)));N=Cr(fe.body,Rr,Ut,lt)}}d.isString(se)||(se=se?"include":"omit");const q=s&&"credentials"in t.prototype,Mn={...le,signal:ct,method:p.toUpperCase(),headers:$e.normalize().toJSON(),body:N,duplex:"half",credentials:q?se:void 0};He=s&&new t(E,Mn);let ue=await(s?at(He,le):at(E,Mn));const xn=u&&(W==="stream"||W==="response");if(u&&(B||xn&&ge)){const fe={};["status","statusText","headers"].forEach(_n=>{fe[_n]=ue[_n]});const Ae=d.toFiniteNumber(ue.headers.get("content-length")),[Ut,lt]=B&&Nr(Ae,At(Or(B),!0))||[];ue=new r(Cr(ue.body,Rr,Ut,()=>{lt&&lt(),ge&&ge()}),fe)}W=W||"text";let as=await f[d.findKey(f,W)||"text"](ue,h);return!xn&&ge&&ge(),await new Promise((fe,Ae)=>{Qi(fe,Ae,{data:as,headers:j.from(ue.headers),status:ue.status,statusText:ue.statusText,config:h,request:He})})}catch(q){throw ge&&ge(),q&&q.name==="TypeError"&&/Load failed|fetch/i.test(q.message)?Object.assign(new T("Network Error",T.ERR_NETWORK,h,He,q&&q.response),{cause:q.cause||q}):T.from(q,q&&q.code,h,He,q&&q.response)}}},Ol=new Map,ns=n=>{let e=n&&n.env||{};const{fetch:t,Request:r,Response:i}=e,s=[r,i,t];let o=s.length,a=o,c,l,u=Ol;for(;a--;)c=s[a],l=u.get(c),l===void 0&&u.set(c,l=a?new Map:Nl(e)),u=l;return l};ns();const kn={http:Uc,xhr:yl,fetch:{get:ns}};d.forEach(kn,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const kr=n=>`- ${n}`,bl=n=>d.isFunction(n)||n===null||n===!1;function Cl(n,e){n=d.isArray(n)?n:[n];const{length:t}=n;let r,i;const s={};for(let o=0;o<t;o++){r=n[o];let a;if(i=r,!bl(r)&&(i=kn[(a=String(r)).toLowerCase()],i===void 0))throw new T(`Unknown adapter '${a}'`);if(i&&(d.isFunction(i)||(i=i.get(e))))break;s[a||"#"+o]=i}if(!i){const o=Object.entries(s).map(([c,l])=>`adapter ${c} `+(l===!1?"is not supported by the environment":"is not available in the build"));let a=t?o.length>1?`since :
6
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[Sr]=this[Sr]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Ze(o);r[a]||(al(i,o),r[a]=!0)}return d.isArray(e)?e.forEach(s):s(e),this}};j.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);d.reduceDescriptors(j.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(r){this[t]=r}}});d.freezeMethods(j);function Kt(n,e){const t=this||st,r=e||t,i=j.from(r.headers);let s=r.data;return d.forEach(n,function(a){s=a.call(t,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function Ki(n){return!!(n&&n.__CANCEL__)}let ot=class extends T{constructor(e,t,r){super(e??"canceled",T.ERR_CANCELED,t,r),this.name="CanceledError",this.__CANCEL__=!0}};function Qi(n,e,t){const r=t.config.validateStatus;!t.status||!r||r(t.status)?n(t):e(new T("Request failed with status code "+t.status,[T.ERR_BAD_REQUEST,T.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function cl(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function ll(n,e){n=n||10;const t=new Array(n),r=new Array(n);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(c){const l=Date.now(),u=r[s];o||(o=l),t[i]=c,r[i]=l;let f=s,y=0;for(;f!==i;)y+=t[f++],f=f%n;if(i=(i+1)%n,i===s&&(s=(s+1)%n),l-o<e)return;const g=u&&l-u;return g?Math.round(y*1e3/g):void 0}}function ul(n,e){let t=0,r=1e3/e,i,s;const o=(l,u=Date.now())=>{t=u,i=null,s&&(clearTimeout(s),s=null),n(...l)};return[(...l)=>{const u=Date.now(),f=u-t;f>=r?o(l,u):(i=l,s||(s=setTimeout(()=>{s=null,o(i)},r-f)))},()=>i&&o(i)]}const At=(n,e,t=3)=>{let r=0;const i=ll(50,250);return ul(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,c=o-r,l=i(c),u=o<=a;r=o;const f={loaded:o,total:a,progress:a?o/a:void 0,bytes:c,rate:l||void 0,estimated:l&&a&&u?(a-o)/l:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};n(f)},t)},Nr=(n,e)=>{const t=n!=null;return[r=>e[0]({lengthComputable:t,total:n,loaded:r}),e[1]]},Or=n=>(...e)=>d.asap(()=>n(...e)),fl=$.hasStandardBrowserEnv?((n,e)=>t=>(t=new URL(t,$.origin),n.protocol===t.protocol&&n.host===t.host&&(e||n.port===t.port)))(new URL($.origin),$.navigator&&/(msie|trident)/i.test($.navigator.userAgent)):()=>!0,dl=$.hasStandardBrowserEnv?{write(n,e,t,r,i,s,o){if(typeof document>"u")return;const a=[`${n}=${encodeURIComponent(e)}`];d.isNumber(t)&&a.push(`expires=${new Date(t).toUTCString()}`),d.isString(r)&&a.push(`path=${r}`),d.isString(i)&&a.push(`domain=${i}`),s===!0&&a.push("secure"),d.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(n){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+n+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(n){this.write(n,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function hl(n){return typeof n!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function ml(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function es(n,e,t){let r=!hl(e);return n&&(r||t==!1)?ml(n,e):e}const br=n=>n instanceof j?{...n}:n;function Ce(n,e){e=e||{};const t={};function r(l,u,f,y){return d.isPlainObject(l)&&d.isPlainObject(u)?d.merge.call({caseless:y},l,u):d.isPlainObject(u)?d.merge({},u):d.isArray(u)?u.slice():u}function i(l,u,f,y){if(d.isUndefined(u)){if(!d.isUndefined(l))return r(void 0,l,f,y)}else return r(l,u,f,y)}function s(l,u){if(!d.isUndefined(u))return r(void 0,u)}function o(l,u){if(d.isUndefined(u)){if(!d.isUndefined(l))return r(void 0,l)}else return r(void 0,u)}function a(l,u,f){if(f in e)return r(l,u);if(f in n)return r(void 0,l)}const c={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,u,f)=>i(br(l),br(u),f,!0)};return d.forEach(Object.keys({...n,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const f=d.hasOwnProp(c,u)?c[u]:i,y=f(n[u],e[u],u);d.isUndefined(y)&&f!==a||(t[u]=y)}),t}const ts=n=>{const e=Ce({},n);let{data:t,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;if(e.headers=o=j.from(o),e.url=Ji(es(e.baseURL,e.url,e.allowAbsoluteUrls),n.params,n.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),d.isFormData(t)){if($.hasStandardBrowserEnv||$.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(d.isFunction(t.getHeaders)){const c=t.getHeaders(),l=["content-type","content-length"];Object.entries(c).forEach(([u,f])=>{l.includes(u.toLowerCase())&&o.set(u,f)})}}if($.hasStandardBrowserEnv&&(r&&d.isFunction(r)&&(r=r(e)),r||r!==!1&&fl(e.url))){const c=i&&s&&dl.read(s);c&&o.set(i,c)}return e},pl=typeof XMLHttpRequest<"u",yl=pl&&function(n){return new Promise(function(t,r){const i=ts(n);let s=i.data;const o=j.from(i.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:l}=i,u,f,y,g,h;function p(){g&&g(),h&&h(),i.cancelToken&&i.cancelToken.unsubscribe(u),i.signal&&i.signal.removeEventListener("abort",u)}let m=new XMLHttpRequest;m.open(i.method.toUpperCase(),i.url,!0),m.timeout=i.timeout;function S(){if(!m)return;const k=j.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),D={data:!a||a==="text"||a==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:k,config:n,request:m};Qi(function(W){t(W),p()},function(W){r(W),p()},D),m=null}"onloadend"in m?m.onloadend=S:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(S)},m.onabort=function(){m&&(r(new T("Request aborted",T.ECONNABORTED,n,m)),m=null)},m.onerror=function(x){const D=x&&x.message?x.message:"Network Error",oe=new T(D,T.ERR_NETWORK,n,m);oe.event=x||null,r(oe),m=null},m.ontimeout=function(){let x=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const D=i.transitional||In;i.timeoutErrorMessage&&(x=i.timeoutErrorMessage),r(new T(x,D.clarifyTimeoutError?T.ETIMEDOUT:T.ECONNABORTED,n,m)),m=null},s===void 0&&o.setContentType(null),"setRequestHeader"in m&&d.forEach(o.toJSON(),function(x,D){m.setRequestHeader(D,x)}),d.isUndefined(i.withCredentials)||(m.withCredentials=!!i.withCredentials),a&&a!=="json"&&(m.responseType=i.responseType),l&&([y,h]=At(l,!0),m.addEventListener("progress",y)),c&&m.upload&&([f,g]=At(c),m.upload.addEventListener("progress",f),m.upload.addEventListener("loadend",g)),(i.cancelToken||i.signal)&&(u=k=>{m&&(r(!k||k.type?new ot(null,n,m):k),m.abort(),m=null)},i.cancelToken&&i.cancelToken.subscribe(u),i.signal&&(i.signal.aborted?u():i.signal.addEventListener("abort",u)));const v=cl(i.url);if(v&&$.protocols.indexOf(v)===-1){r(new T("Unsupported protocol "+v+":",T.ERR_BAD_REQUEST,n));return}m.send(s||null)})},gl=(n,e)=>{const{length:t}=n=n?n.filter(Boolean):[];if(e||t){let r=new AbortController,i;const s=function(l){if(!i){i=!0,a();const u=l instanceof Error?l:this.reason;r.abort(u instanceof T?u:new ot(u instanceof Error?u.message:u))}};let o=e&&setTimeout(()=>{o=null,s(new T(`timeout of ${e}ms exceeded`,T.ETIMEDOUT))},e);const a=()=>{n&&(o&&clearTimeout(o),o=null,n.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),n=null)};n.forEach(l=>l.addEventListener("abort",s));const{signal:c}=r;return c.unsubscribe=()=>d.asap(a),c}},El=function*(n,e){let t=n.byteLength;if(t<e){yield n;return}let r=0,i;for(;r<t;)i=r+e,yield n.slice(r,i),r=i},wl=async function*(n,e){for await(const t of Tl(n))yield*El(t,e)},Tl=async function*(n){if(n[Symbol.asyncIterator]){yield*n;return}const e=n.getReader();try{for(;;){const{done:t,value:r}=await e.read();if(t)break;yield r}}finally{await e.cancel()}},Cr=(n,e,t,r)=>{const i=wl(n,e);let s=0,o,a=c=>{o||(o=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:l,value:u}=await i.next();if(l){a(),c.close();return}let f=u.byteLength;if(t){let y=s+=f;t(y)}c.enqueue(new Uint8Array(u))}catch(l){throw a(l),l}},cancel(c){return a(c),i.return()}},{highWaterMark:2})},Rr=64*1024,{isFunction:pt}=d,Sl=(({Request:n,Response:e})=>({Request:n,Response:e}))(d.global),{ReadableStream:Ar,TextEncoder:Ir}=d.global,vr=(n,...e)=>{try{return!!n(...e)}catch{return!1}},Nl=n=>{n=d.merge.call({skipUndefined:!0},Sl,n);const{fetch:e,Request:t,Response:r}=n,i=e?pt(e):typeof fetch=="function",s=pt(t),o=pt(r);if(!i)return!1;const a=i&&pt(Ar),c=i&&(typeof Ir=="function"?(h=>p=>h.encode(p))(new Ir):async h=>new Uint8Array(await new t(h).arrayBuffer())),l=s&&a&&vr(()=>{let h=!1;const p=new t($.origin,{body:new Ar,method:"POST",get duplex(){return h=!0,"half"}}).headers.has("Content-Type");return h&&!p}),u=o&&a&&vr(()=>d.isReadableStream(new r("").body)),f={stream:u&&(h=>h.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(h=>{!f[h]&&(f[h]=(p,m)=>{let S=p&&p[h];if(S)return S.call(p);throw new T(`Response type '${h}' is not supported`,T.ERR_NOT_SUPPORT,m)})});const y=async h=>{if(h==null)return 0;if(d.isBlob(h))return h.size;if(d.isSpecCompliantForm(h))return(await new t($.origin,{method:"POST",body:h}).arrayBuffer()).byteLength;if(d.isArrayBufferView(h)||d.isArrayBuffer(h))return h.byteLength;if(d.isURLSearchParams(h)&&(h=h+""),d.isString(h))return(await c(h)).byteLength},g=async(h,p)=>{const m=d.toFiniteNumber(h.getContentLength());return m??y(p)};return async h=>{let{url:p,method:m,data:S,signal:v,cancelToken:k,timeout:x,onDownloadProgress:D,onUploadProgress:oe,responseType:W,headers:$e,withCredentials:se="same-origin",fetchOptions:le}=ts(h),at=e||fetch;W=W?(W+"").toLowerCase():"text";let ct=gl([v,k&&k.toAbortSignal()],x),He=null;const ge=ct&&ct.unsubscribe&&(()=>{ct.unsubscribe()});let Fn;try{if(oe&&l&&m!=="get"&&m!=="head"&&(Fn=await g($e,S))!==0){let fe=new t(p,{method:"POST",body:S,duplex:"half"}),Ae;if(d.isFormData(S)&&(Ae=fe.headers.get("content-type"))&&$e.setContentType(Ae),fe.body){const[Ut,lt]=Nr(Fn,At(Or(oe)));S=Cr(fe.body,Rr,Ut,lt)}}d.isString(se)||(se=se?"include":"omit");const q=s&&"credentials"in t.prototype,Mn={...le,signal:ct,method:m.toUpperCase(),headers:$e.normalize().toJSON(),body:S,duplex:"half",credentials:q?se:void 0};He=s&&new t(p,Mn);let ue=await(s?at(He,le):at(p,Mn));const xn=u&&(W==="stream"||W==="response");if(u&&(D||xn&&ge)){const fe={};["status","statusText","headers"].forEach(Pn=>{fe[Pn]=ue[Pn]});const Ae=d.toFiniteNumber(ue.headers.get("content-length")),[Ut,lt]=D&&Nr(Ae,At(Or(D),!0))||[];ue=new r(Cr(ue.body,Rr,Ut,()=>{lt&&lt(),ge&&ge()}),fe)}W=W||"text";let as=await f[d.findKey(f,W)||"text"](ue,h);return!xn&&ge&&ge(),await new Promise((fe,Ae)=>{Qi(fe,Ae,{data:as,headers:j.from(ue.headers),status:ue.status,statusText:ue.statusText,config:h,request:He})})}catch(q){throw ge&&ge(),q&&q.name==="TypeError"&&/Load failed|fetch/i.test(q.message)?Object.assign(new T("Network Error",T.ERR_NETWORK,h,He,q&&q.response),{cause:q.cause||q}):T.from(q,q&&q.code,h,He,q&&q.response)}}},Ol=new Map,ns=n=>{let e=n&&n.env||{};const{fetch:t,Request:r,Response:i}=e,s=[r,i,t];let o=s.length,a=o,c,l,u=Ol;for(;a--;)c=s[a],l=u.get(c),l===void 0&&u.set(c,l=a?new Map:Nl(e)),u=l;return l};ns();const kn={http:Uc,xhr:yl,fetch:{get:ns}};d.forEach(kn,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const kr=n=>`- ${n}`,bl=n=>d.isFunction(n)||n===null||n===!1;function Cl(n,e){n=d.isArray(n)?n:[n];const{length:t}=n;let r,i;const s={};for(let o=0;o<t;o++){r=n[o];let a;if(i=r,!bl(r)&&(i=kn[(a=String(r)).toLowerCase()],i===void 0))throw new T(`Unknown adapter '${a}'`);if(i&&(d.isFunction(i)||(i=i.get(e))))break;s[a||"#"+o]=i}if(!i){const o=Object.entries(s).map(([c,l])=>`adapter ${c} `+(l===!1?"is not supported by the environment":"is not available in the build"));let a=t?o.length>1?`since :
7
7
  `+o.map(kr).join(`
8
8
  `):" "+kr(o[0]):"as no adapter specified";throw new T("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return i}const rs={getAdapter:Cl,adapters:kn};function Qt(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new ot(null,n)}function Fr(n){return Qt(n),n.headers=j.from(n.headers),n.data=Kt.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),rs.getAdapter(n.adapter||st.adapter,n)(n).then(function(r){return Qt(n),r.data=Kt.call(n,n.transformResponse,r),r.headers=j.from(r.headers),r},function(r){return Ki(r)||(Qt(n),r&&r.response&&(r.response.data=Kt.call(n,n.transformResponse,r.response),r.response.headers=j.from(r.response.headers))),Promise.reject(r)})}const is="1.13.5",Vt={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{Vt[n]=function(r){return typeof r===n||"a"+(e<1?"n ":" ")+n}});const Mr={};Vt.transitional=function(e,t,r){function i(s,o){return"[Axios v"+is+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,a)=>{if(e===!1)throw new T(i(o," has been removed"+(t?" in "+t:"")),T.ERR_DEPRECATED);return t&&!Mr[o]&&(Mr[o]=!0,console.warn(i(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(s,o,a):!0}};Vt.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function Rl(n,e,t){if(typeof n!="object")throw new T("options must be an object",T.ERR_BAD_OPTION_VALUE);const r=Object.keys(n);let i=r.length;for(;i-- >0;){const s=r[i],o=e[s];if(o){const a=n[s],c=a===void 0||o(a,s,n);if(c!==!0)throw new T("option "+s+" must be "+c,T.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new T("Unknown option "+s,T.ERR_BAD_OPTION)}}const St={assertOptions:Rl,validators:Vt},X=St.validators;let be=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Tr,response:new Tr}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=`
9
- `+s):r.stack=s}catch{}}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Ce(this.defaults,t);const{transitional:r,paramsSerializer:i,headers:s}=t;r!==void 0&&St.assertOptions(r,{silentJSONParsing:X.transitional(X.boolean),forcedJSONParsing:X.transitional(X.boolean),clarifyTimeoutError:X.transitional(X.boolean),legacyInterceptorReqResOrdering:X.transitional(X.boolean)},!1),i!=null&&(d.isFunction(i)?t.paramsSerializer={serialize:i}:St.assertOptions(i,{encode:X.function,serialize:X.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),St.assertOptions(t,{baseUrl:X.spelling("baseURL"),withXsrfToken:X.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&d.merge(s.common,s[t.method]);s&&d.forEach(["delete","get","head","post","put","patch","common"],h=>{delete s[h]}),t.headers=j.concat(o,s);const a=[];let c=!0;this.interceptors.request.forEach(function(E){if(typeof E.runWhen=="function"&&E.runWhen(t)===!1)return;c=c&&E.synchronous;const p=t.transitional||In;p&&p.legacyInterceptorReqResOrdering?a.unshift(E.fulfilled,E.rejected):a.push(E.fulfilled,E.rejected)});const l=[];this.interceptors.response.forEach(function(E){l.push(E.fulfilled,E.rejected)});let u,f=0,m;if(!c){const h=[Fr.bind(this),void 0];for(h.unshift(...a),h.push(...l),m=h.length,u=Promise.resolve(t);f<m;)u=u.then(h[f++],h[f++]);return u}m=a.length;let y=t;for(;f<m;){const h=a[f++],E=a[f++];try{y=h(y)}catch(p){E.call(this,p);break}}try{u=Fr.call(this,y)}catch(h){return Promise.reject(h)}for(f=0,m=l.length;f<m;)u=u.then(l[f++],l[f++]);return u}getUri(e){e=Ce(this.defaults,e);const t=es(e.baseURL,e.url,e.allowAbsoluteUrls);return Ji(t,e.params,e.paramsSerializer)}};d.forEach(["delete","get","head","options"],function(e){be.prototype[e]=function(t,r){return this.request(Ce(r||{},{method:e,url:t,data:(r||{}).data}))}});d.forEach(["post","put","patch"],function(e){function t(r){return function(s,o,a){return this.request(Ce(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}be.prototype[e]=t(),be.prototype[e+"Form"]=t(!0)});let Al=class ss{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(s){t=s});const r=this;this.promise.then(i=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{r.subscribe(a),s=a}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},e(function(s,o,a){r.reason||(r.reason=new ot(s,o,a),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=r=>{e.abort(r)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new ss(function(i){e=i}),cancel:e}}};function Il(n){return function(t){return n.apply(null,t)}}function vl(n){return d.isObject(n)&&n.isAxiosError===!0}const gn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(gn).forEach(([n,e])=>{gn[e]=n});function os(n){const e=new be(n),t=Vi(be.prototype.request,e);return d.extend(t,be.prototype,e,{allOwnKeys:!0}),d.extend(t,e,null,{allOwnKeys:!0}),t.create=function(i){return os(Ce(n,i))},t}const _=os(st);_.Axios=be;_.CanceledError=ot;_.CancelToken=Al;_.isCancel=Ki;_.VERSION=is;_.toFormData=Dt;_.AxiosError=T;_.Cancel=_.CanceledError;_.all=function(e){return Promise.all(e)};_.spread=Il;_.isAxiosError=vl;_.mergeConfig=Ce;_.AxiosHeaders=j;_.formToJSON=n=>Xi(d.isHTMLForm(n)?new FormData(n):n);_.getAdapter=rs.getAdapter;_.HttpStatusCode=gn;_.default=_;const{Axios:Ul,AxiosError:$l,CanceledError:Hl,isCancel:Bl,CancelToken:Wl,VERSION:ql,all:Zl,Cancel:Yl,isAxiosError:jl,spread:Gl,toFormData:Jl,AxiosHeaders:Xl,HttpStatusCode:Kl,formToJSON:Ql,getAdapter:eu,mergeConfig:tu}=_;class kl{async mapPersonaDataToCorporateRoles(e){const{personaData:t,errors:r}=e;if(!t)return[];const i=t["blocchi-persona"]["imprese-persona"];if(!i||!i["impresa-persona"])return[];const s=Array.isArray(i["impresa-persona"])?i["impresa-persona"]:[i["impresa-persona"]],o=[],a=t["blocchi-persona"],c={firstname:a["dati-identificativi-persona"]?.nome||null,lastname:a["dati-identificativi-persona"]?.cognome||null,gender:a["dati-identificativi-persona"]?.sesso||null,fiscalCode:a["dati-identificativi-persona"]?.["c-fiscale"]||null,dateOfBirth:D(a["dati-identificativi-persona"]?.["estremi-nascita"]?.dt),municipality:a["dati-identificativi-persona"]?.["estremi-nascita"]?.comune||null,province:a["dati-identificativi-persona"]?.["estremi-nascita"]?.provincia||null,address:a["dati-identificativi-persona"]?.indirizzo?`${a["dati-identificativi-persona"].indirizzo.via} ${a["dati-identificativi-persona"].indirizzo["n-civico"]}`:null,cap:a["dati-identificativi-persona"]?.indirizzo?.cap||null,pec:null,aiwsError:r};for(const l of s){const u=l.persona?.cariche?.carica;if(!u)continue;const f=Array.isArray(u)?u:[u];for(const m of f){const y={companyName:l["dati-identificativi-impresa"].denominazione,companyFiscalCode:l["dati-identificativi-impresa"]["c-fiscale"],companyVatNumber:l["dati-identificativi-impresa"]["c-fiscale"],companyLegalFormCode:l["dati-identificativi-impresa"]["forma-giuridica"]?.c||"",companyLegalFormDescription:l["dati-identificativi-impresa"]["forma-giuridica"]?.["#text"]||"",companyCciaaCode:l["dati-identificativi-impresa"].cciaa,companyCciaaDescription:"",companyReaNumber:parseInt(l["dati-identificativi-impresa"]["n-rea"],10)||0,companyStatusCode:"",companyStatusDescription:"",companyRegistryStatusCode:"",companyRegistryStatusDescription:"",companySourceCode:l["dati-identificativi-impresa"]["c-fonte"]||"",companySourceDescription:l["dati-identificativi-impresa"].fonte||"",companyDeclaredActivity:l["info-attivita"]?.["classificazioni-ateco"]?.["classificazione-ateco"]?Array.isArray(l["info-attivita"]?.["classificazioni-ateco"]?.["classificazione-ateco"])?l["info-attivita"]?.["classificazioni-ateco"]?.["classificazione-ateco"][0]?.attivita:l["info-attivita"]?.["classificazioni-ateco"]?.["classificazione-ateco"]?.attivita:"",companyAtecoCode:l["info-attivita"]?.["classificazioni-ateco"]?.["c-codifica"]||"",companyAtecoDescription:l["info-attivita"]?.["classificazioni-ateco"]?.codifica||"",companyAtecoClassificationCode:parseInt(l["info-attivita"]?.["classificazioni-ateco"]?.["c-codifica"]||"0",10)||0,companyAtecoClassificationDescription:l["info-attivita"]?.["classificazioni-ateco"]?.codifica||"",companyProvinceCode:l["dati-identificativi-impresa"]["indirizzo-localizzazione"]?.provincia||"",companyProvinceDescription:"",companyMunicipalityCode:l["dati-identificativi-impresa"]["indirizzo-localizzazione"]?.["c-comune"]||"",companyMunicipalityDescription:"",companyToponymCode:l["dati-identificativi-impresa"]["indirizzo-localizzazione"]?.["c-toponimo"]||"",companyToponymDescription:"",companyStreet:l["dati-identificativi-impresa"]["indirizzo-localizzazione"]?.via||"",companyStreetNumber:l["dati-identificativi-impresa"]["indirizzo-localizzazione"]?.["n-civico"]||"",companyPostalCode:parseInt(l["dati-identificativi-impresa"]["indirizzo-localizzazione"]?.cap||"0",10)||0,companyPec:l["dati-identificativi-impresa"]["indirizzo-posta-certificata"]||"",companyProfit:null,companyRevenue:null,companyShares:null,companyIncorporationDate:D(l["info-attivita"]?.["dt-inizio-attivita-impresa"]),aiwsError:null};c.pec=l.persona?.["indirizzo-posta-certificata"]||c.pec,o.push({companySummary:y,corporateRole:m["#text"]||"",corporateRoleCode:m["c-carica"]||"",personSummary:c,dateOfAppointment:D(m["dt-atto-nomina"]),durationCode:m["c-durata"]||null,durationDescription:m["descrizione-durata"]||null,balanceSheetDate:D(m["dt-riferimento-bilancio"]),aiwsError:null})}}return o}}class Fl extends _t{constructor(e){super(),this.client=e}async getPersonCorporateRoles(e){const{fiscalCode:t,errors:r}=e;try{const i=await this.client.get("registroimprese/persone/scheda/codicefiscale/xml",{params:{codiceFiscale:t,responseType:"text"}}),s=await this.client.get("registroimprese/persone/scheda/codicefiscale/html",{params:{codiceFiscale:t,responseType:"text"}});if(!this.checkResponseStatus({status:i.status,data:i.data,errors:r}))return null;let o;this.checkResponseStatus({status:s.status,data:s.data,errors:r})&&(o=Buffer.from(s.data,"utf8"));const a=this.parseXml(i.data,r);if(!a)return null;if(a.Risposta.Testata.Riepilogo.NumeroPosizioni===0)return{personCorporateRoles:[],htmlBuffer:void 0};const l=a.Risposta?.dati;return l?{personCorporateRoles:await new kl().mapPersonaDataToCorporateRoles({personaData:l,errors:r}),htmlBuffer:o}:(I(r,R.PERSONA_DATA_NOT_FOUND,["fiscalCode"],A.PERSONA_DATA_NOT_FOUND),null)}catch(i){return console.log(i),I(r,R.PERSONA_DATA_FETCH_FAILED,["fiscalCode"],A.PERSONA_DATA_FETCH_FAILED),null}}}class Ml{async mapVisuraEffettoResponseToProtestReport(e){const{visuraEffettoResponse:t,fiscalCode:r,errors:i}=e;if(!t)return null;const s=c=>c?Array.isArray(c)?c:[c]:[],o=t.AnagraficaNominativo,a=s(t.RegistroProtesti).map(c=>({registerData:{cciaaPublication:c.DatiRegistroProtesti.CciaaPubblicazione,registrationRegisterDate:D(c.DatiRegistroProtesti.DtIscrRegistro)},effectInformation:{protestDate:D(c.InformazioniEffetto.DtLevata),protestProvinceCode:c.InformazioniEffetto.SglPrvLevata,protestProvinceDescription:c.InformazioniEffetto.DescPrvLevata,protestMunicipalityCode:c.InformazioniEffetto.CodComLevata,protestMunicipalityDescription:c.InformazioniEffetto.DescComLevata,billIssueDate:D(c.InformazioniEffetto.DtEmissioneEffetto),billDueDate:D(c.InformazioniEffetto.DtScadenzaEffetto),billTypeCode:c.InformazioniEffetto.CodTipoEffetto,billTypeDescription:c.InformazioniEffetto.DescTipoEffetto,protestAmount:c.InformazioniEffetto.ImportoValutaLevata,protestCurrencyCode:c.InformazioniEffetto.CodValutaLevata,protestCurrencyDescription:c.InformazioniEffetto.DescValutaLevata,nonPaymentReasonCode:c.InformazioniEffetto.CodMancatoPagRepr,nonPaymentReasonDescription:c.InformazioniEffetto.DescMancatoPagRepr,billStatusCode:c.InformazioniEffetto.CodStatoEffetto,billStatusDescription:c.InformazioniEffetto.DescStatoEffetto,repertoryNumber:c.InformazioniEffetto.NRepertorio}}));return{anagraphicKey:o.KAnagrafica,fiscalCode:r||o.CodFisc,holderIdentity:{fullName:o.Nominativo,sourceCode:o.Fonte,fiscalCode:o.CodFisc,residenceProvinceCode:o.SglPrvRes,residenceProvinceDescription:o.DescPrvRes,residenceMunicipalityCode:o.CodComRes,residenceMunicipalityDescription:o.DescComRes,residenceAddress:o.IndirizzoRes},protestEffects:a,totalProtests:a.length,aiwsError:i}}}class xl extends _t{constructor(e){super(),this.client=e}async getPersonProtests(e){const{fiscalCode:t,errors:r}=e;try{const i=await this.client.get("/registroprotesti/protesti/ricerca/nazionale",{params:{nominativo:t,responseType:"text"}});if(!this.checkResponseStatus({status:i.status,data:i.data,errors:r}))return null;const s=this.parseXml(i.data,r);if(!s)return null;if(s.Risposta.Testata.Riepilogo.NumeroPosizioni===0)return[];const a=s.Risposta.ListaAnagrafiche?.AnagraficaNominativo?Array.isArray(s.Risposta.ListaAnagrafiche.AnagraficaNominativo)?s.Risposta.ListaAnagrafiche.AnagraficaNominativo:[s.Risposta.ListaAnagrafiche.AnagraficaNominativo]:[],c=new Ml,l=[];for(const u of a){const f=u.KAnagrafica,m=await this.client.get("/registroprotesti/protesti/visura/effetto/anagrafica/xml",{params:{KAnagrafica:f,responseType:"text"}}),y=await this.client.get("/registroprotesti/protesti/visura/effetto/anagrafica/html",{params:{KAnagrafica:f,responseType:"text"}});if(!this.checkResponseStatus({status:m.status,data:m.data,errors:r}))continue;let h;this.checkResponseStatus({status:y.status,data:y.data,errors:r})&&(h=Buffer.from(y.data,"utf8"));const E=this.parseXml(m.data,r);if(!E)continue;const p=await c.mapVisuraEffettoResponseToProtestReport({visuraEffettoResponse:E.Risposta.VisuraEffetto,fiscalCode:t,errors:r});p&&l.push({protestReport:p,htmlBuffer:h})}return l}catch(i){return console.error("Error fetching protest data:",i),I(r,R.PROTESTS_FETCH_FAILED,[],A.PROTESTS_FETCH_FAILED),null}}}class _l{async mapPartecipazioniDataToCorporateHoldingStructure(e){const{partecipazioniData:t,errors:r}=e;if(!t)return null;const i=m=>m?Array.isArray(m)?m:[m]:[],s=m=>{if(!m)return null;const y=m.trim().replace(/\./g,"").replace(",","."),h=Number(y);return Number.isFinite(h)?h:null},o=t["blocchi-persona"],a=o["dati-identificativi"],c=o["partecipazioni-societa"]?.["anagrafica-titolare"],l=i(a["persone-rappresentanti"]?.["persona-rappresentante"]).map(m=>({firstName:m.nome||null,lastName:m.cognome||null,roleDescription:m.carica||null,isRegistryRepresentative:m["f-rappresentante-ri"]==="S"})),u=i(o["partecipazioni-societa"]?.partecipazioni?.partecipazione).map(m=>{const y=m["estremi-pratica"],h=m["estremi-impresa"],E=m["capitale-sociale"],p=i(m.riquadri?.riquadro).map(N=>({nominalValue:s(N["composizione-quote"]?.["valore-nominale"]),currencyCode:N["composizione-quote"]?.["c-valuta"]||null,currencyDescription:N["composizione-quote"]?.valuta||null,rights:i(N["diritti-partecipazione"]?.["diritto-partecipazione"]).map(v=>({rightTypeCode:v["c-tipo"]||null,rightTypeDescription:v.tipo||null}))}));return{isCurrentSection:m["f-paragrafo-attuale"]==="S",practice:{practiceCode:y?.["c-pratica"]||null,filingTypeCode:y?.["c-tipo-adempimento"]||null,filingTypeDescription:y?.["tipo-adempimento"]||null,deedDate:D(y?.["dt-atto"]),cciaaCode:y?.cciaa||null,filingYear:y?.anno||null,filingNumber:y?.n||null,protocolDate:D(y?.["dt-protocollo"]),depositDate:D(y?.["dt-deposito"])},isLatestShareholdersList:m["f-ultimo-elenco-soci"]==="S",targetCompany:{fiscalCode:h?.["c-fiscale"]||null,companyName:h?.denominazione||null,legalFormCode:h?.["forma-giuridica"]?.c||null,legalFormDescription:h?.["forma-giuridica"]?.["#text"]||null},shareCapital:{currencyCode:E?.["c-valuta"]||null,currencyDescription:E?.valuta||null,amount:s(E?.ammontare)},shareDetails:p}}),f=i(o["tabella-partecipate-impresa"]).flatMap(m=>i(m.partecipata).map(y=>({fiscalCode:y["c-fiscale"]||null,companyName:y.denominazione||null,participationStartDate:D(y["dt-inizio-partecipazione"]),rights:i(y["quote-diritti-impresa"]?.["quota-diritto-impresa"]).map(h=>({rightTypeCode:h["c-tipo-diritto"]||null,rightTypeDescription:h["tipo-diritto"]||null,nominalValue:s(h["valore-nominale"]),capitalPercentage:s(h["percentuale-capitale"])}))})));return{companyIdentity:{sourceCode:a["c-fonte"]||null,sourceDescription:a.fonte||null,subjectTypeCode:a["tipo-soggetto"]||null,subjectTypeDescription:a["descrizione-tipo-soggetto"]||null,companyTypeCode:a["tipo-impresa"]||null,companyTypeDescription:a["descrizione-tipo-impresa"]||null,registrationDate:D(a["dt-iscrizione-ri"]),incorporationDate:D(a["dt-atto-costituzione"]),lastFilingDate:D(a["dt-ultimo-protocollo"]),companyName:a.denominazione||null,fiscalCode:a["c-fiscale"]||null,vatNumber:a["partita-iva"]||null,cciaaCode:a.cciaa||null,reaNumber:a["n-rea"]||null,legalFormCode:a["forma-giuridica"]?.c||null,legalFormDescription:a["forma-giuridica"]?.["#text"]||null,locationAddress:a["indirizzo-localizzazione"]?{municipalityCode:a["indirizzo-localizzazione"]["c-comune"]||null,municipality:a["indirizzo-localizzazione"].comune||null,province:a["indirizzo-localizzazione"].provincia||null,toponymCode:a["indirizzo-localizzazione"]["c-toponimo"]||null,toponym:a["indirizzo-localizzazione"].toponimo||null,street:a["indirizzo-localizzazione"].via||null,streetNumber:a["indirizzo-localizzazione"]["n-civico"]||null,postalCode:a["indirizzo-localizzazione"].cap||null}:null,pec:a["indirizzo-posta-certificata"]||null,representatives:l},holderIdentity:{holderTypeCode:c?.["c-tipo"]||null,holderTypeDescription:c?.tipo||null,fiscalCode:c?.["c-fiscale"]||null,companyName:c?.denominazione||null},participations:u,currentParticipatedCompanies:f,totalCurrentParticipations:s(o["info-blocco-attuale"]?.["n-partecipazioni"])??null,aiwsError:r}}}class Pl extends _t{constructor(e){super(),this.client=e}async getPersonCorporateHoldings(e){const{fiscalCode:t,errors:r}=e;try{const i=await this.client.get("registroimprese/assettiproprietari/partecipazioni/codicefiscale/xml",{params:{codiceFiscale:t,responseType:"text"}}),s=await this.client.get("registroimprese/assettiproprietari/partecipazioni/codicefiscale/html",{params:{codiceFiscale:t,responseType:"text"}});if(!this.checkResponseStatus({status:i.status,data:i.data,errors:r}))return null;let o;this.checkResponseStatus({status:s.status,data:s.data,errors:r})&&(o=Buffer.from(s.data,"utf8"));const a=this.parseXml(i.data,r);if(!a||a.Risposta.Testata.Riepilogo.NumeroPosizioni===0)return null;const l=a.Risposta?.dati;if(!l)return I(r,R.CORPORATE_HOLDINGS_NOT_FOUND,["fiscalCode"],A.CORPORATE_HOLDINGS_NOT_FOUND),null;const f=await new _l().mapPartecipazioniDataToCorporateHoldingStructure({partecipazioniData:l,errors:r});return f?{personCorporateHoldings:f,htmlBuffer:o}:(I(r,R.CORPORATE_HOLDINGS_NOT_FOUND,["fiscalCode"],A.CORPORATE_HOLDINGS_NOT_FOUND),null)}catch(i){return console.log(i),I(r,R.PERSON_CORPORATE_HOLDINGS_FETCH_FAILED,["fiscalCode"],A.PERSON_CORPORATE_HOLDINGS_FETCH_FAILED),null}}}class zl{axiosInstance;companyService;personService;protestService;ownershipStructureService;constructor(e){const t=e.environment==="production"?"https://aiws.infocamere.it/aiws/rest":"https://aiwscl.infocamere.it/aiws/rest";this.axiosInstance=_.create({baseURL:t,headers:{username:e.username,password:e.password,Accept:"application/xml"},validateStatus:()=>!0}),this.companyService=new ec(this.axiosInstance),this.personService=new Fl(this.axiosInstance),this.protestService=new xl(this.axiosInstance),this.ownershipStructureService=new Pl(this.axiosInstance)}}exports.AIWSClient=zl;
9
+ `+s):r.stack=s}catch{}}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Ce(this.defaults,t);const{transitional:r,paramsSerializer:i,headers:s}=t;r!==void 0&&St.assertOptions(r,{silentJSONParsing:X.transitional(X.boolean),forcedJSONParsing:X.transitional(X.boolean),clarifyTimeoutError:X.transitional(X.boolean),legacyInterceptorReqResOrdering:X.transitional(X.boolean)},!1),i!=null&&(d.isFunction(i)?t.paramsSerializer={serialize:i}:St.assertOptions(i,{encode:X.function,serialize:X.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),St.assertOptions(t,{baseUrl:X.spelling("baseURL"),withXsrfToken:X.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&d.merge(s.common,s[t.method]);s&&d.forEach(["delete","get","head","post","put","patch","common"],h=>{delete s[h]}),t.headers=j.concat(o,s);const a=[];let c=!0;this.interceptors.request.forEach(function(p){if(typeof p.runWhen=="function"&&p.runWhen(t)===!1)return;c=c&&p.synchronous;const m=t.transitional||In;m&&m.legacyInterceptorReqResOrdering?a.unshift(p.fulfilled,p.rejected):a.push(p.fulfilled,p.rejected)});const l=[];this.interceptors.response.forEach(function(p){l.push(p.fulfilled,p.rejected)});let u,f=0,y;if(!c){const h=[Fr.bind(this),void 0];for(h.unshift(...a),h.push(...l),y=h.length,u=Promise.resolve(t);f<y;)u=u.then(h[f++],h[f++]);return u}y=a.length;let g=t;for(;f<y;){const h=a[f++],p=a[f++];try{g=h(g)}catch(m){p.call(this,m);break}}try{u=Fr.call(this,g)}catch(h){return Promise.reject(h)}for(f=0,y=l.length;f<y;)u=u.then(l[f++],l[f++]);return u}getUri(e){e=Ce(this.defaults,e);const t=es(e.baseURL,e.url,e.allowAbsoluteUrls);return Ji(t,e.params,e.paramsSerializer)}};d.forEach(["delete","get","head","options"],function(e){be.prototype[e]=function(t,r){return this.request(Ce(r||{},{method:e,url:t,data:(r||{}).data}))}});d.forEach(["post","put","patch"],function(e){function t(r){return function(s,o,a){return this.request(Ce(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}be.prototype[e]=t(),be.prototype[e+"Form"]=t(!0)});let Al=class ss{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(s){t=s});const r=this;this.promise.then(i=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{r.subscribe(a),s=a}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},e(function(s,o,a){r.reason||(r.reason=new ot(s,o,a),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=r=>{e.abort(r)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new ss(function(i){e=i}),cancel:e}}};function Il(n){return function(t){return n.apply(null,t)}}function vl(n){return d.isObject(n)&&n.isAxiosError===!0}const gn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(gn).forEach(([n,e])=>{gn[e]=n});function os(n){const e=new be(n),t=Vi(be.prototype.request,e);return d.extend(t,be.prototype,e,{allOwnKeys:!0}),d.extend(t,e,null,{allOwnKeys:!0}),t.create=function(i){return os(Ce(n,i))},t}const _=os(st);_.Axios=be;_.CanceledError=ot;_.CancelToken=Al;_.isCancel=Ki;_.VERSION=is;_.toFormData=Lt;_.AxiosError=T;_.Cancel=_.CanceledError;_.all=function(e){return Promise.all(e)};_.spread=Il;_.isAxiosError=vl;_.mergeConfig=Ce;_.AxiosHeaders=j;_.formToJSON=n=>Xi(d.isHTMLForm(n)?new FormData(n):n);_.getAdapter=rs.getAdapter;_.HttpStatusCode=gn;_.default=_;const{Axios:Ul,AxiosError:$l,CanceledError:Hl,isCancel:Bl,CancelToken:Wl,VERSION:ql,all:Zl,Cancel:Yl,isAxiosError:jl,spread:Gl,toFormData:Jl,AxiosHeaders:Xl,HttpStatusCode:Kl,formToJSON:Ql,getAdapter:eu,mergeConfig:tu}=_;class kl{async mapPersonaDataToCorporateRoles(e){const{personaData:t,errors:r}=e;if(!t)return[];const i=t["blocchi-persona"]["imprese-persona"];if(!i||!i["impresa-persona"])return[];const s=Array.isArray(i["impresa-persona"])?i["impresa-persona"]:[i["impresa-persona"]],o=[],a=t["blocchi-persona"],c={firstname:a["dati-identificativi-persona"]?.nome||null,lastname:a["dati-identificativi-persona"]?.cognome||null,gender:a["dati-identificativi-persona"]?.sesso||null,fiscalCode:a["dati-identificativi-persona"]?.["c-fiscale"]||null,dateOfBirth:L(a["dati-identificativi-persona"]?.["estremi-nascita"]?.dt),municipality:a["dati-identificativi-persona"]?.["estremi-nascita"]?.comune||null,province:a["dati-identificativi-persona"]?.["estremi-nascita"]?.provincia||null,address:a["dati-identificativi-persona"]?.indirizzo?`${a["dati-identificativi-persona"].indirizzo.via} ${a["dati-identificativi-persona"].indirizzo["n-civico"]}`:null,cap:a["dati-identificativi-persona"]?.indirizzo?.cap||null,pec:null,aiwsError:r};for(const l of s){const u=l.persona?.cariche?.carica;if(!u)continue;const f=Array.isArray(u)?u:[u];for(const y of f){const g={companyName:l["dati-identificativi-impresa"].denominazione,companyFiscalCode:l["dati-identificativi-impresa"]["c-fiscale"],companyVatNumber:l["dati-identificativi-impresa"]["c-fiscale"],companyLegalFormCode:l["dati-identificativi-impresa"]["forma-giuridica"]?.c||"",companyLegalFormDescription:l["dati-identificativi-impresa"]["forma-giuridica"]?.["#text"]||"",companyCciaaCode:l["dati-identificativi-impresa"].cciaa,companyCciaaDescription:"",companyReaNumber:parseInt(l["dati-identificativi-impresa"]["n-rea"],10)||0,companyStatusCode:"",companyStatusDescription:"",companyRegistryStatusCode:"",companyRegistryStatusDescription:"",companySourceCode:l["dati-identificativi-impresa"]["c-fonte"]||"",companySourceDescription:l["dati-identificativi-impresa"].fonte||"",companyDeclaredActivity:l["info-attivita"]?.["classificazioni-ateco"]?.["classificazione-ateco"]?Array.isArray(l["info-attivita"]?.["classificazioni-ateco"]?.["classificazione-ateco"])?l["info-attivita"]?.["classificazioni-ateco"]?.["classificazione-ateco"][0]?.attivita:l["info-attivita"]?.["classificazioni-ateco"]?.["classificazione-ateco"]?.attivita:"",companyAtecoCode:l["info-attivita"]?.["classificazioni-ateco"]?.["c-codifica"]||"",companyAtecoDescription:l["info-attivita"]?.["classificazioni-ateco"]?.codifica||"",companyAtecoClassificationCode:parseInt(l["info-attivita"]?.["classificazioni-ateco"]?.["c-codifica"]||"0",10)||0,companyAtecoClassificationDescription:l["info-attivita"]?.["classificazioni-ateco"]?.codifica||"",companyProvinceCode:l["dati-identificativi-impresa"]["indirizzo-localizzazione"]?.provincia||"",companyProvinceDescription:"",companyMunicipalityCode:l["dati-identificativi-impresa"]["indirizzo-localizzazione"]?.["c-comune"]||"",companyMunicipalityDescription:"",companyToponymCode:l["dati-identificativi-impresa"]["indirizzo-localizzazione"]?.["c-toponimo"]||"",companyToponymDescription:"",companyStreet:l["dati-identificativi-impresa"]["indirizzo-localizzazione"]?.via||"",companyStreetNumber:l["dati-identificativi-impresa"]["indirizzo-localizzazione"]?.["n-civico"]||"",companyPostalCode:parseInt(l["dati-identificativi-impresa"]["indirizzo-localizzazione"]?.cap||"0",10)||0,companyPec:l["dati-identificativi-impresa"]["indirizzo-posta-certificata"]||"",companyProfit:null,companyRevenue:null,companyShares:null,companyIncorporationDate:L(l["info-attivita"]?.["dt-inizio-attivita-impresa"]),aiwsError:null};c.pec=l.persona?.["indirizzo-posta-certificata"]||c.pec,o.push({companySummary:g,corporateRole:y["#text"]||"",corporateRoleCode:y["c-carica"]||"",personSummary:c,dateOfAppointment:L(y["dt-atto-nomina"]),durationCode:y["c-durata"]||null,durationDescription:y["descrizione-durata"]||null,balanceSheetDate:L(y["dt-riferimento-bilancio"]),aiwsError:null})}}return o}}class Fl extends Pt{constructor(e){super(),this.client=e}async getPersonCorporateRoles(e){const{fiscalCode:t,errors:r}=e;try{const i=await this.client.get("registroimprese/persone/scheda/codicefiscale/xml",{params:{codiceFiscale:t,responseType:"text"}}),s=await this.client.get("registroimprese/persone/scheda/codicefiscale/html",{params:{codiceFiscale:t,responseType:"text"}});if(!this.checkResponseStatus({status:i.status,data:i.data,errors:r}))return null;let o;this.checkResponseStatus({status:s.status,data:s.data,errors:r})&&(o=Buffer.from(s.data,"utf8"));const a=this.parseXml(i.data,r);if(!a)return null;if(a.Risposta.Testata.Riepilogo.NumeroPosizioni===0)return{personCorporateRoles:[],htmlBuffer:void 0};const l=a.Risposta?.dati;return l?{personCorporateRoles:await new kl().mapPersonaDataToCorporateRoles({personaData:l,errors:r}),htmlBuffer:o}:(I(r,R.PERSONA_DATA_NOT_FOUND,["fiscalCode"],A.PERSONA_DATA_NOT_FOUND),null)}catch(i){return console.log(i),I(r,R.PERSONA_DATA_FETCH_FAILED,["fiscalCode"],A.PERSONA_DATA_FETCH_FAILED),null}}}class Ml{async mapVisuraEffettoResponseToProtestReport(e){const{visuraEffettoResponse:t,fiscalCode:r,errors:i}=e;if(!t)return null;const s=c=>c?Array.isArray(c)?c:[c]:[],o=t.AnagraficaNominativo,a=s(t.RegistroProtesti).map(c=>({registerData:{cciaaPublication:c.DatiRegistroProtesti.CciaaPubblicazione,registrationRegisterDate:L(c.DatiRegistroProtesti.DtIscrRegistro)},effectInformation:{protestDate:L(c.InformazioniEffetto.DtLevata),protestProvinceCode:c.InformazioniEffetto.SglPrvLevata,protestProvinceDescription:c.InformazioniEffetto.DescPrvLevata,protestMunicipalityCode:c.InformazioniEffetto.CodComLevata,protestMunicipalityDescription:c.InformazioniEffetto.DescComLevata,billIssueDate:L(c.InformazioniEffetto.DtEmissioneEffetto),billDueDate:L(c.InformazioniEffetto.DtScadenzaEffetto),billTypeCode:c.InformazioniEffetto.CodTipoEffetto,billTypeDescription:c.InformazioniEffetto.DescTipoEffetto,protestAmount:c.InformazioniEffetto.ImportoValutaLevata,protestCurrencyCode:c.InformazioniEffetto.CodValutaLevata,protestCurrencyDescription:c.InformazioniEffetto.DescValutaLevata,nonPaymentReasonCode:c.InformazioniEffetto.CodMancatoPagRepr,nonPaymentReasonDescription:c.InformazioniEffetto.DescMancatoPagRepr,billStatusCode:c.InformazioniEffetto.CodStatoEffetto,billStatusDescription:c.InformazioniEffetto.DescStatoEffetto,repertoryNumber:c.InformazioniEffetto.NRepertorio}}));return{anagraphicKey:o.KAnagrafica,fiscalCode:r||o.CodFisc,holderIdentity:{fullName:o.Nominativo,sourceCode:o.Fonte,fiscalCode:o.CodFisc,residenceProvinceCode:o.SglPrvRes,residenceProvinceDescription:o.DescPrvRes,residenceMunicipalityCode:o.CodComRes,residenceMunicipalityDescription:o.DescComRes,residenceAddress:o.IndirizzoRes},protestEffects:a,totalProtests:a.length,aiwsError:i}}}class xl extends Pt{constructor(e){super(),this.client=e}async getPersonProtests(e){const{fiscalCode:t,errors:r}=e;try{const i=await this.client.get("/registroprotesti/protesti/ricerca/nazionale",{params:{nominativo:t,responseType:"text"}});if(!this.checkResponseStatus({status:i.status,data:i.data,errors:r}))return null;const s=this.parseXml(i.data,r);if(!s)return null;if(s.Risposta.Testata.Riepilogo.NumeroPosizioni===0)return[];const a=s.Risposta.ListaAnagrafiche?.AnagraficaNominativo?Array.isArray(s.Risposta.ListaAnagrafiche.AnagraficaNominativo)?s.Risposta.ListaAnagrafiche.AnagraficaNominativo:[s.Risposta.ListaAnagrafiche.AnagraficaNominativo]:[],c=new Ml,l=[];for(const u of a){const f=u.KAnagrafica,y=await this.client.get("/registroprotesti/protesti/visura/effetto/anagrafica/xml",{params:{KAnagrafica:f,responseType:"text"}}),g=await this.client.get("/registroprotesti/protesti/visura/effetto/anagrafica/html",{params:{KAnagrafica:f,responseType:"text"}});if(!this.checkResponseStatus({status:y.status,data:y.data,errors:r}))continue;let h;this.checkResponseStatus({status:g.status,data:g.data,errors:r})&&(h=Buffer.from(g.data,"utf8"));const p=this.parseXml(y.data,r);if(!p)continue;const m=await c.mapVisuraEffettoResponseToProtestReport({visuraEffettoResponse:p.Risposta.VisuraEffetto,fiscalCode:t,errors:r});m&&l.push({protestReport:m,htmlBuffer:h})}return l}catch(i){return console.error("Error fetching protest data:",i),I(r,R.PROTESTS_FETCH_FAILED,[],A.PROTESTS_FETCH_FAILED),null}}}class Pl{async mapPartecipazioniDataToCorporateHoldingStructure(e){const{partecipazioniData:t,errors:r}=e;if(!t)return null;const i=p=>p?Array.isArray(p)?p:[p]:[],s=p=>{if(!p)return null;const m=p.trim().replace(/\./g,"").replace(",","."),S=Number(m);return Number.isFinite(S)?S:null},o=t["blocchi-persona"],a=o["dati-identificativi"],c=o["anagrafica-persona"]?.["dati-identificativi-persona"],l=o["partecipazioni-societa"]?.["anagrafica-titolare"];if(!a&&!c)return r.push({code:R.PERSONA_DATA_NOT_FOUND,message:"Dati identificativi and anagrafica persona are missing in the response"}),null;const u=i(a?.["persone-rappresentanti"]?.["persona-rappresentante"]).map(p=>({firstName:p.nome,lastName:p.cognome,roleDescription:p.carica,isRegistryRepresentative:p["f-rappresentante-ri"]==="S"})),f=a?"company":"person";let y;f==="company"&&a?y={type:"company",companyIdentity:{sourceCode:a["c-fonte"],sourceDescription:a.fonte,subjectTypeCode:a["tipo-soggetto"],subjectTypeDescription:a["descrizione-tipo-soggetto"],companyTypeCode:a["tipo-impresa"],companyTypeDescription:a["descrizione-tipo-impresa"],registrationDate:L(a["dt-iscrizione-ri"]),incorporationDate:L(a["dt-atto-costituzione"]),lastFilingDate:L(a["dt-ultimo-protocollo"]),companyName:a.denominazione,fiscalCode:a["c-fiscale"],vatNumber:a["partita-iva"],cciaaCode:a.cciaa,reaNumber:a["n-rea"],legalFormCode:a["forma-giuridica"]?.c,legalFormDescription:a["forma-giuridica"]?.["#text"]||null,locationAddress:{municipalityCode:a["indirizzo-localizzazione"]["c-comune"]||null,municipality:a["indirizzo-localizzazione"].comune,province:a["indirizzo-localizzazione"].provincia,toponymCode:a["indirizzo-localizzazione"]["c-toponimo"]||null,toponym:a["indirizzo-localizzazione"].toponimo,street:a["indirizzo-localizzazione"].via,streetNumber:a["indirizzo-localizzazione"]["n-civico"],postalCode:a["indirizzo-localizzazione"].cap},pec:a["indirizzo-posta-certificata"]||null,representatives:u}}:y={type:"person",personIdentity:{firstName:c?.nome||"",lastName:c?.cognome||"",fiscalCode:c?.["c-fiscale"]||"",gender:c?.sesso||null,locationAddress:{municipalityCode:c?.indirizzo?.["c-comune"]||null,municipality:c?.indirizzo?.comune||"",province:c?.indirizzo?.provincia||"",toponymCode:c?.indirizzo?.["c-toponimo"]||null,toponym:c?.indirizzo?.toponimo||"",street:c?.indirizzo?.via||"",streetNumber:c?.indirizzo?.["n-civico"]||"",postalCode:c?.indirizzo?.cap||""},dateOfBirth:c?.["estremi-nascita"]?.dt?L(c["estremi-nascita"].dt):null,municipalityOfBirth:c?.["estremi-nascita"]?.comune||"",provinceOfBirth:c?.["estremi-nascita"]?.provincia||""}};const g=i(o["partecipazioni-societa"]?.partecipazioni?.partecipazione).map(p=>{const m=p["estremi-pratica"],S=p["estremi-impresa"],v=p["capitale-sociale"],k=i(p.riquadri?.riquadro).map(x=>({nominalValue:s(x["composizione-quote"]?.["valore-nominale"]),currencyCode:x["composizione-quote"]?.["c-valuta"],currencyDescription:x["composizione-quote"]?.valuta,rights:i(x["diritti-partecipazione"]?.["diritto-partecipazione"]).map(D=>({rightTypeCode:D["c-tipo"],rightTypeDescription:D.tipo}))}));return{isCurrentSection:p["f-paragrafo-attuale"]==="S",practice:{practiceCode:m?.["c-pratica"],filingTypeCode:m?.["c-tipo-adempimento"],filingTypeDescription:m?.["tipo-adempimento"],deedDate:L(m?.["dt-atto"]),cciaaCode:m?.cciaa,filingYear:m?.anno,filingNumber:m?.n,protocolDate:L(m?.["dt-protocollo"]),depositDate:L(m?.["dt-deposito"])},isLatestShareholdersList:p["f-ultimo-elenco-soci"]==="S",targetCompany:{fiscalCode:S?.["c-fiscale"],companyName:S?.denominazione,legalFormCode:S?.["forma-giuridica"]?.c,legalFormDescription:S?.["forma-giuridica"]?.["#text"]||null},shareCapital:{currencyCode:v?.["c-valuta"],currencyDescription:v?.valuta,amount:s(v?.ammontare)},shareDetails:k}}),h=i(o["tabella-partecipate-impresa"]).flatMap(p=>i(p.partecipata).map(m=>({fiscalCode:m["c-fiscale"],companyName:m.denominazione,participationStartDate:L(m["dt-inizio-partecipazione"]),rights:i(m["quote-diritti-impresa"]?.["quota-diritto-impresa"]).map(S=>({rightTypeCode:S["c-tipo-diritto"],rightTypeDescription:S["tipo-diritto"],nominalValue:s(S["valore-nominale"]),capitalPercentage:s(S["percentuale-capitale"])}))})));return{companyOrPersonIdentity:y,holderIdentity:{holderTypeCode:l?.["c-tipo"]||"PF",holderTypeDescription:l?.tipo||"Persona fisica",fiscalCode:l?.["c-fiscale"]||c?.["c-fiscale"]||"",companyName:l?.denominazione||`${c?.cognome||""} ${c?.nome||""}`.trim()},participations:g,currentParticipatedCompanies:h,totalCurrentParticipations:s(o["info-blocco-attuale"]?.["n-partecipazioni"])??null,aiwsError:r}}}class _l extends Pt{constructor(e){super(),this.client=e}async getPersonCorporateHoldings(e){const{fiscalCode:t,errors:r}=e;try{const i=await this.client.get("registroimprese/assettiproprietari/partecipazioni/codicefiscale/xml",{params:{codiceFiscale:t,responseType:"text"}}),s=await this.client.get("registroimprese/assettiproprietari/partecipazioni/codicefiscale/html",{params:{codiceFiscale:t,responseType:"text"}});if(!this.checkResponseStatus({status:i.status,data:i.data,errors:r}))return null;let o;this.checkResponseStatus({status:s.status,data:s.data,errors:r})&&(o=Buffer.from(s.data,"utf8"));const a=this.parseXml(i.data,r);if(!a||a.Risposta.Testata.Riepilogo.NumeroPosizioni===0)return null;const l=a.Risposta?.dati;if(!l)return I(r,R.CORPORATE_HOLDINGS_NOT_FOUND,["fiscalCode"],A.CORPORATE_HOLDINGS_NOT_FOUND),null;const f=await new Pl().mapPartecipazioniDataToCorporateHoldingStructure({partecipazioniData:l,errors:r});return f?{personCorporateHoldings:f,htmlBuffer:o}:(I(r,R.CORPORATE_HOLDINGS_NOT_FOUND,["fiscalCode"],A.CORPORATE_HOLDINGS_NOT_FOUND),null)}catch(i){return console.log(i),I(r,R.PERSON_CORPORATE_HOLDINGS_FETCH_FAILED,["fiscalCode"],A.PERSON_CORPORATE_HOLDINGS_FETCH_FAILED),null}}}class zl{axiosInstance;companyService;personService;protestService;ownershipStructureService;constructor(e){const t=e.environment==="production"?"https://aiws.infocamere.it/aiws/rest":"https://aiwscl.infocamere.it/aiws/rest";this.axiosInstance=_.create({baseURL:t,headers:{username:e.username,password:e.password,Accept:"application/xml"},validateStatus:()=>!0}),this.companyService=new ec(this.axiosInstance),this.personService=new Fl(this.axiosInstance),this.protestService=new xl(this.axiosInstance),this.ownershipStructureService=new _l(this.axiosInstance)}}exports.AIWSClient=zl;
10
10
  //# sourceMappingURL=cciaa-service.cjs.map