@likable-hair/cciaa-service 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,11 @@
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
- `).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,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
- `+o.map(kr).join(`
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(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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function Mr(t,e){return function(){return t.apply(e,arguments)}}const{toString:cs}=Object.prototype,{getPrototypeOf:wn}=Object,{iterator:kt,toStringTag:xr}=Symbol,Ft=(t=>e=>{const n=cs.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),ce=t=>(t=t.toLowerCase(),e=>Ft(e)===t),zt=t=>e=>typeof e===t,{isArray:He}=Array,Ve=zt("undefined");function tt(t){return t!==null&&!Ve(t)&&t.constructor!==null&&!Ve(t.constructor)&&J(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const _r=ce("ArrayBuffer");function us(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&_r(t.buffer),e}const fs=zt("string"),J=zt("function"),Dr=zt("number"),nt=t=>t!==null&&typeof t=="object",ds=t=>t===!0||t===!1,Et=t=>{if(Ft(t)!=="object")return!1;const e=wn(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(xr in t)&&!(kt in t)},hs=t=>{if(!nt(t)||tt(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},ms=ce("Date"),ps=ce("File"),ys=ce("Blob"),gs=ce("FileList"),Es=t=>nt(t)&&J(t.pipe),ws=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||J(t.append)&&((e=Ft(t))==="formdata"||e==="object"&&J(t.toString)&&t.toString()==="[object FormData]"))},Ts=ce("URLSearchParams"),[Ss,Ns,Os,bs]=["ReadableStream","Request","Response","Headers"].map(ce),Cs=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function rt(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,i;if(typeof t!="object"&&(t=[t]),He(t))for(r=0,i=t.length;r<i;r++)e.call(null,t[r],r,t);else{if(tt(t))return;const s=n?Object.getOwnPropertyNames(t):Object.keys(t),o=s.length;let a;for(r=0;r<o;r++)a=s[r],e.call(null,t[a],a,t)}}function Pr(t,e){if(tt(t))return null;e=e.toLowerCase();const n=Object.keys(t);let r=n.length,i;for(;r-- >0;)if(i=n[r],e===i.toLowerCase())return i;return null}const Ae=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Lr=t=>!Ve(t)&&t!==Ae;function tn(){const{caseless:t,skipUndefined:e}=Lr(this)&&this||{},n={},r=(i,s)=>{if(s==="__proto__"||s==="constructor"||s==="prototype")return;const o=t&&Pr(n,s)||s;Et(n[o])&&Et(i)?n[o]=tn(n[o],i):Et(i)?n[o]=tn({},i):He(i)?n[o]=i.slice():(!e||!Ve(i))&&(n[o]=i)};for(let i=0,s=arguments.length;i<s;i++)arguments[i]&&rt(arguments[i],r);return n}const As=(t,e,n,{allOwnKeys:r}={})=>(rt(e,(i,s)=>{n&&J(i)?Object.defineProperty(t,s,{value:Mr(i,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,s,{value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),t),Rs=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Is=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},vs=(t,e,n,r)=>{let i,s,o;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!r||r(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=n!==!1&&wn(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},ks=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},Fs=t=>{if(!t)return null;if(He(t))return t;let e=t.length;if(!Dr(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},zs=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&wn(Uint8Array)),Ms=(t,e)=>{const r=(t&&t[kt]).call(t);let i;for(;(i=r.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},xs=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},_s=ce("HTMLFormElement"),Ds=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),_n=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Ps=ce("RegExp"),Vr=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};rt(n,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(r[s]=o||i)}),Object.defineProperties(t,r)},Ls=t=>{Vr(t,(e,n)=>{if(J(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(J(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Vs=(t,e)=>{const n={},r=i=>{i.forEach(s=>{n[s]=!0})};return He(t)?r(t):r(String(t).split(e)),n},Us=()=>{},Hs=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function $s(t){return!!(t&&J(t.append)&&t[xr]==="FormData"&&t[kt])}const Bs=t=>{const e=new Array(10),n=(r,i)=>{if(nt(r)){if(e.indexOf(r)>=0)return;if(tt(r))return r;if(!("toJSON"in r)){e[i]=r;const s=He(r)?[]:{};return rt(r,(o,a)=>{const l=n(o,i+1);!Ve(l)&&(s[a]=l)}),e[i]=void 0,s}}return r};return n(t,0)},qs=ce("AsyncFunction"),Ws=t=>t&&(nt(t)||J(t))&&J(t.then)&&J(t.catch),Ur=((t,e)=>t?setImmediate:e?((n,r)=>(Ae.addEventListener("message",({source:i,data:s})=>{i===Ae&&s===n&&r.length&&r.shift()()},!1),i=>{r.push(i),Ae.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",J(Ae.postMessage)),Ys=typeof queueMicrotask<"u"?queueMicrotask.bind(Ae):typeof process<"u"&&process.nextTick||Ur,Zs=t=>t!=null&&J(t[kt]),d={isArray:He,isArrayBuffer:_r,isBuffer:tt,isFormData:ws,isArrayBufferView:us,isString:fs,isNumber:Dr,isBoolean:ds,isObject:nt,isPlainObject:Et,isEmptyObject:hs,isReadableStream:Ss,isRequest:Ns,isResponse:Os,isHeaders:bs,isUndefined:Ve,isDate:ms,isFile:ps,isBlob:ys,isRegExp:Ps,isFunction:J,isStream:Es,isURLSearchParams:Ts,isTypedArray:zs,isFileList:gs,forEach:rt,merge:tn,extend:As,trim:Cs,stripBOM:Rs,inherits:Is,toFlatObject:vs,kindOf:Ft,kindOfTest:ce,endsWith:ks,toArray:Fs,forEachEntry:Ms,matchAll:xs,isHTMLForm:_s,hasOwnProperty:_n,hasOwnProp:_n,reduceDescriptors:Vr,freezeMethods:Ls,toObjectSet:Vs,toCamelCase:Ds,noop:Us,toFiniteNumber:Hs,findKey:Pr,global:Ae,isContextDefined:Lr,isSpecCompliantForm:$s,toJSONObject:Bs,isAsyncFn:qs,isThenable:Ws,setImmediate:Ur,asap:Ys,isIterable:Zs};let O=class Hr extends Error{static from(e,n,r,i,s,o){const a=new Hr(e.message,n||e.code,r,i,s);return a.cause=e,a.name=e.name,o&&Object.assign(a,o),a}constructor(e,n,r,i,s){super(e),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),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}}};O.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";O.ERR_BAD_OPTION="ERR_BAD_OPTION";O.ECONNABORTED="ECONNABORTED";O.ETIMEDOUT="ETIMEDOUT";O.ERR_NETWORK="ERR_NETWORK";O.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";O.ERR_DEPRECATED="ERR_DEPRECATED";O.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";O.ERR_BAD_REQUEST="ERR_BAD_REQUEST";O.ERR_CANCELED="ERR_CANCELED";O.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";O.ERR_INVALID_URL="ERR_INVALID_URL";const js=null;function nn(t){return d.isPlainObject(t)||d.isArray(t)}function $r(t){return d.endsWith(t,"[]")?t.slice(0,-2):t}function Dn(t,e,n){return t?t.concat(e).map(function(i,s){return i=$r(i),!n&&s?"["+i+"]":i}).join(n?".":""):e}function Gs(t){return d.isArray(t)&&!t.some(nn)}const Xs=d.toFlatObject(d,{},null,function(e){return/^is[A-Z]/.test(e)});function Mt(t,e,n){if(!d.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=d.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,h){return!d.isUndefined(h[g])});const r=n.metaTokens,i=n.visitor||u,s=n.dots,o=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&d.isSpecCompliantForm(e);if(!d.isFunction(i))throw new TypeError("visitor must be a function");function c(m){if(m===null)return"";if(d.isDate(m))return m.toISOString();if(d.isBoolean(m))return m.toString();if(!l&&d.isBlob(m))throw new O("Blob is not supported. Use a Buffer instead.");return d.isArrayBuffer(m)||d.isTypedArray(m)?l&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function u(m,g,h){let S=m;if(m&&!h&&typeof m=="object"){if(d.endsWith(g,"{}"))g=r?g:g.slice(0,-2),m=JSON.stringify(m);else if(d.isArray(m)&&Gs(m)||(d.isFileList(m)||d.endsWith(g,"[]"))&&(S=d.toArray(m)))return g=$r(g),S.forEach(function(M,_){!(d.isUndefined(M)||M===null)&&e.append(o===!0?Dn([g],_,s):o===null?g:g+"[]",c(M))}),!1}return nn(m)?!0:(e.append(Dn(h,g,s),c(m)),!1)}const f=[],p=Object.assign(Xs,{defaultVisitor:u,convertValue:c,isVisitable:nn});function E(m,g){if(!d.isUndefined(m)){if(f.indexOf(m)!==-1)throw Error("Circular reference detected in "+g.join("."));f.push(m),d.forEach(m,function(S,z){(!(d.isUndefined(S)||S===null)&&i.call(e,S,d.isString(z)?z.trim():z,g,p))===!0&&E(S,g?g.concat(z):[z])}),f.pop()}}if(!d.isObject(t))throw new TypeError("data must be an object");return E(t),e}function Pn(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Tn(t,e){this._pairs=[],t&&Mt(t,this,e)}const Br=Tn.prototype;Br.append=function(e,n){this._pairs.push([e,n])};Br.toString=function(e){const n=e?function(r){return e.call(this,r,Pn)}:Pn;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function Js(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function qr(t,e,n){if(!e)return t;const r=n&&n.encode||Js,i=d.isFunction(n)?{serialize:n}:n,s=i&&i.serialize;let o;if(s?o=s(e,i):o=d.isURLSearchParams(e)?e.toString():new Tn(e,i).toString(r),o){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}class Ln{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,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 Sn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Ks=typeof URLSearchParams<"u"?URLSearchParams:Tn,Qs=typeof FormData<"u"?FormData:null,eo=typeof Blob<"u"?Blob:null,to={isBrowser:!0,classes:{URLSearchParams:Ks,FormData:Qs,Blob:eo},protocols:["http","https","file","blob","url","data"]},Nn=typeof window<"u"&&typeof document<"u",rn=typeof navigator=="object"&&navigator||void 0,no=Nn&&(!rn||["ReactNative","NativeScript","NS"].indexOf(rn.product)<0),ro=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",io=Nn&&window.location.href||"http://localhost",so=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Nn,hasStandardBrowserEnv:no,hasStandardBrowserWebWorkerEnv:ro,navigator:rn,origin:io},Symbol.toStringTag,{value:"Module"})),W={...so,...to};function oo(t,e){return Mt(t,new W.classes.URLSearchParams,{visitor:function(n,r,i,s){return W.isNode&&d.isBuffer(n)?(this.append(r,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},...e})}function ao(t){return d.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function lo(t){const e={},n=Object.keys(t);let r;const i=n.length;let s;for(r=0;r<i;r++)s=n[r],e[s]=t[s];return e}function Wr(t){function e(n,r,i,s){let o=n[s++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),l=s>=n.length;return o=!o&&d.isArray(i)?i.length:o,l?(d.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!a):((!i[o]||!d.isObject(i[o]))&&(i[o]=[]),e(n,r,i[o],s)&&d.isArray(i[o])&&(i[o]=lo(i[o])),!a)}if(d.isFormData(t)&&d.isFunction(t.entries)){const n={};return d.forEachEntry(t,(r,i)=>{e(ao(r),i,n,0)}),n}return null}function co(t,e,n){if(d.isString(t))try{return(e||JSON.parse)(t),d.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const it={transitional:Sn,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.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(Wr(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 n.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 oo(e,this.formSerializer).toString();if((a=d.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Mt(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||i?(n.setContentType("application/json",!1),co(e)):e}],transformResponse:[function(e){const n=this.transitional||it.transitional,r=n&&n.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=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(a){if(o)throw a.name==="SyntaxError"?O.from(a,O.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:W.classes.FormData,Blob:W.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"],t=>{it.headers[t]={}});const uo=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"]),fo=t=>{const e={};let n,r,i;return t&&t.split(`
2
+ `).forEach(function(o){i=o.indexOf(":"),n=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!n||e[n]&&uo[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},Vn=Symbol("internals");function Ye(t){return t&&String(t).trim().toLowerCase()}function wt(t){return t===!1||t==null?t:d.isArray(t)?t.map(wt):String(t)}function ho(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const mo=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function $t(t,e,n,r,i){if(d.isFunction(r))return r.call(this,e,n);if(i&&(e=n),!!d.isString(e)){if(d.isString(r))return e.indexOf(r)!==-1;if(d.isRegExp(r))return r.test(e)}}function po(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function yo(t,e){const n=d.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(i,s,o){return this[r].call(this,e,i,s,o)},configurable:!0})})}let K=class{constructor(e){e&&this.set(e)}set(e,n,r){const i=this;function s(a,l,c){const u=Ye(l);if(!u)throw new Error("header name must be a non-empty string");const f=d.findKey(i,u);(!f||i[f]===void 0||c===!0||c===void 0&&i[f]!==!1)&&(i[f||l]=wt(a))}const o=(a,l)=>d.forEach(a,(c,u)=>s(c,u,l));if(d.isPlainObject(e)||e instanceof this.constructor)o(e,n);else if(d.isString(e)&&(e=e.trim())&&!mo(e))o(fo(e),n);else if(d.isObject(e)&&d.isIterable(e)){let a={},l,c;for(const u of e){if(!d.isArray(u))throw TypeError("Object iterator must return a key-value pair");a[c=u[0]]=(l=a[c])?d.isArray(l)?[...l,u[1]]:[l,u[1]]:u[1]}o(a,n)}else e!=null&&s(n,e,r);return this}get(e,n){if(e=Ye(e),e){const r=d.findKey(this,e);if(r){const i=this[r];if(!n)return i;if(n===!0)return ho(i);if(d.isFunction(n))return n.call(this,i,r);if(d.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Ye(e),e){const r=d.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||$t(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let i=!1;function s(o){if(o=Ye(o),o){const a=d.findKey(r,o);a&&(!n||$t(r,r[a],a,n))&&(delete r[a],i=!0)}}return d.isArray(e)?e.forEach(s):s(e),i}clear(e){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const s=n[r];(!e||$t(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const n=this,r={};return d.forEach(this,(i,s)=>{const o=d.findKey(r,s);if(o){n[o]=wt(i),delete n[s];return}const a=e?po(s):String(s).trim();a!==s&&delete n[s],n[a]=wt(i),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return d.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=e&&d.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
3
+ `)}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,...n){const r=new this(e);return n.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[Vn]=this[Vn]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Ye(o);r[a]||(yo(i,o),r[a]=!0)}return d.isArray(e)?e.forEach(s):s(e),this}};K.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);d.reduceDescriptors(K.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});d.freezeMethods(K);function Bt(t,e){const n=this||it,r=e||n,i=K.from(r.headers);let s=r.data;return d.forEach(t,function(a){s=a.call(n,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function Yr(t){return!!(t&&t.__CANCEL__)}let st=class extends O{constructor(e,n,r){super(e??"canceled",O.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function Zr(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new O("Request failed with status code "+n.status,[O.ERR_BAD_REQUEST,O.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function go(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Eo(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),u=r[s];o||(o=c),n[i]=l,r[i]=c;let f=s,p=0;for(;f!==i;)p+=n[f++],f=f%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),c-o<e)return;const E=u&&c-u;return E?Math.round(p*1e3/E):void 0}}function wo(t,e){let n=0,r=1e3/e,i,s;const o=(c,u=Date.now())=>{n=u,i=null,s&&(clearTimeout(s),s=null),t(...c)};return[(...c)=>{const u=Date.now(),f=u-n;f>=r?o(c,u):(i=c,s||(s=setTimeout(()=>{s=null,o(i)},r-f)))},()=>i&&o(i)]}const bt=(t,e,n=3)=>{let r=0;const i=Eo(50,250);return wo(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,l=o-r,c=i(l),u=o<=a;r=o;const f={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&u?(a-o)/c:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(f)},n)},Un=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},Hn=t=>(...e)=>d.asap(()=>t(...e)),To=W.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,W.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(W.origin),W.navigator&&/(msie|trident)/i.test(W.navigator.userAgent)):()=>!0,So=W.hasStandardBrowserEnv?{write(t,e,n,r,i,s,o){if(typeof document>"u")return;const a=[`${t}=${encodeURIComponent(e)}`];d.isNumber(n)&&a.push(`expires=${new Date(n).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(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function No(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Oo(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function jr(t,e,n){let r=!No(e);return t&&(r||n==!1)?Oo(t,e):e}const $n=t=>t instanceof K?{...t}:t;function ke(t,e){e=e||{};const n={};function r(c,u,f,p){return d.isPlainObject(c)&&d.isPlainObject(u)?d.merge.call({caseless:p},c,u):d.isPlainObject(u)?d.merge({},u):d.isArray(u)?u.slice():u}function i(c,u,f,p){if(d.isUndefined(u)){if(!d.isUndefined(c))return r(void 0,c,f,p)}else return r(c,u,f,p)}function s(c,u){if(!d.isUndefined(u))return r(void 0,u)}function o(c,u){if(d.isUndefined(u)){if(!d.isUndefined(c))return r(void 0,c)}else return r(void 0,u)}function a(c,u,f){if(f in e)return r(c,u);if(f in t)return r(void 0,c)}const l={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:(c,u,f)=>i($n(c),$n(u),f,!0)};return d.forEach(Object.keys({...t,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const f=d.hasOwnProp(l,u)?l[u]:i,p=f(t[u],e[u],u);d.isUndefined(p)&&f!==a||(n[u]=p)}),n}const Gr=t=>{const e=ke({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;if(e.headers=o=K.from(o),e.url=qr(jr(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),d.isFormData(n)){if(W.hasStandardBrowserEnv||W.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(d.isFunction(n.getHeaders)){const l=n.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([u,f])=>{c.includes(u.toLowerCase())&&o.set(u,f)})}}if(W.hasStandardBrowserEnv&&(r&&d.isFunction(r)&&(r=r(e)),r||r!==!1&&To(e.url))){const l=i&&s&&So.read(s);l&&o.set(i,l)}return e},bo=typeof XMLHttpRequest<"u",Co=bo&&function(t){return new Promise(function(n,r){const i=Gr(t);let s=i.data;const o=K.from(i.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:c}=i,u,f,p,E,m;function g(){E&&E(),m&&m(),i.cancelToken&&i.cancelToken.unsubscribe(u),i.signal&&i.signal.removeEventListener("abort",u)}let h=new XMLHttpRequest;h.open(i.method.toUpperCase(),i.url,!0),h.timeout=i.timeout;function S(){if(!h)return;const M=K.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),x={data:!a||a==="text"||a==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:M,config:t,request:h};Zr(function(L){n(L),g()},function(L){r(L),g()},x),h=null}"onloadend"in h?h.onloadend=S:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(S)},h.onabort=function(){h&&(r(new O("Request aborted",O.ECONNABORTED,t,h)),h=null)},h.onerror=function(_){const x=_&&_.message?_.message:"Network Error",Z=new O(x,O.ERR_NETWORK,t,h);Z.event=_||null,r(Z),h=null},h.ontimeout=function(){let _=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const x=i.transitional||Sn;i.timeoutErrorMessage&&(_=i.timeoutErrorMessage),r(new O(_,x.clarifyTimeoutError?O.ETIMEDOUT:O.ECONNABORTED,t,h)),h=null},s===void 0&&o.setContentType(null),"setRequestHeader"in h&&d.forEach(o.toJSON(),function(_,x){h.setRequestHeader(x,_)}),d.isUndefined(i.withCredentials)||(h.withCredentials=!!i.withCredentials),a&&a!=="json"&&(h.responseType=i.responseType),c&&([p,m]=bt(c,!0),h.addEventListener("progress",p)),l&&h.upload&&([f,E]=bt(l),h.upload.addEventListener("progress",f),h.upload.addEventListener("loadend",E)),(i.cancelToken||i.signal)&&(u=M=>{h&&(r(!M||M.type?new st(null,t,h):M),h.abort(),h=null)},i.cancelToken&&i.cancelToken.subscribe(u),i.signal&&(i.signal.aborted?u():i.signal.addEventListener("abort",u)));const z=go(i.url);if(z&&W.protocols.indexOf(z)===-1){r(new O("Unsupported protocol "+z+":",O.ERR_BAD_REQUEST,t));return}h.send(s||null)})},Ao=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,i;const s=function(c){if(!i){i=!0,a();const u=c instanceof Error?c:this.reason;r.abort(u instanceof O?u:new st(u instanceof Error?u.message:u))}};let o=e&&setTimeout(()=>{o=null,s(new O(`timeout of ${e}ms exceeded`,O.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),t=null)};t.forEach(c=>c.addEventListener("abort",s));const{signal:l}=r;return l.unsubscribe=()=>d.asap(a),l}},Ro=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let r=0,i;for(;r<n;)i=r+e,yield t.slice(r,i),r=i},Io=async function*(t,e){for await(const n of vo(t))yield*Ro(n,e)},vo=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)break;yield r}}finally{await e.cancel()}},Bn=(t,e,n,r)=>{const i=Io(t,e);let s=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:c,value:u}=await i.next();if(c){a(),l.close();return}let f=u.byteLength;if(n){let p=s+=f;n(p)}l.enqueue(new Uint8Array(u))}catch(c){throw a(c),c}},cancel(l){return a(l),i.return()}},{highWaterMark:2})},qn=64*1024,{isFunction:dt}=d,ko=(({Request:t,Response:e})=>({Request:t,Response:e}))(d.global),{ReadableStream:Wn,TextEncoder:Yn}=d.global,Zn=(t,...e)=>{try{return!!t(...e)}catch{return!1}},Fo=t=>{t=d.merge.call({skipUndefined:!0},ko,t);const{fetch:e,Request:n,Response:r}=t,i=e?dt(e):typeof fetch=="function",s=dt(n),o=dt(r);if(!i)return!1;const a=i&&dt(Wn),l=i&&(typeof Yn=="function"?(m=>g=>m.encode(g))(new Yn):async m=>new Uint8Array(await new n(m).arrayBuffer())),c=s&&a&&Zn(()=>{let m=!1;const g=new n(W.origin,{body:new Wn,method:"POST",get duplex(){return m=!0,"half"}}).headers.has("Content-Type");return m&&!g}),u=o&&a&&Zn(()=>d.isReadableStream(new r("").body)),f={stream:u&&(m=>m.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!f[m]&&(f[m]=(g,h)=>{let S=g&&g[m];if(S)return S.call(g);throw new O(`Response type '${m}' is not supported`,O.ERR_NOT_SUPPORT,h)})});const p=async m=>{if(m==null)return 0;if(d.isBlob(m))return m.size;if(d.isSpecCompliantForm(m))return(await new n(W.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(d.isArrayBufferView(m)||d.isArrayBuffer(m))return m.byteLength;if(d.isURLSearchParams(m)&&(m=m+""),d.isString(m))return(await l(m)).byteLength},E=async(m,g)=>{const h=d.toFiniteNumber(m.getContentLength());return h??p(g)};return async m=>{let{url:g,method:h,data:S,signal:z,cancelToken:M,timeout:_,onDownloadProgress:x,onUploadProgress:Z,responseType:L,headers:me,withCredentials:Q="same-origin",fetchOptions:ue}=Gr(m),Ne=e||fetch;L=L?(L+"").toLowerCase():"text";let y=Ao([z,M&&M.toAbortSignal()],_),T=null;const R=y&&y.unsubscribe&&(()=>{y.unsubscribe()});let fe;try{if(Z&&c&&h!=="get"&&h!=="head"&&(fe=await E(me,S))!==0){let ye=new n(g,{method:"POST",body:S,duplex:"half"}),ze;if(d.isFormData(S)&&(ze=ye.headers.get("content-type"))&&me.setContentType(ze),ye.body){const[Ht,ft]=Un(fe,bt(Hn(Z)));S=Bn(ye.body,qn,Ht,ft)}}d.isString(Q)||(Q=Q?"include":"omit");const B=s&&"credentials"in n.prototype,zn={...ue,signal:y,method:h.toUpperCase(),headers:me.normalize().toJSON(),body:S,duplex:"half",credentials:B?Q:void 0};T=s&&new n(g,zn);let pe=await(s?Ne(T,ue):Ne(g,zn));const Mn=u&&(L==="stream"||L==="response");if(u&&(x||Mn&&R)){const ye={};["status","statusText","headers"].forEach(xn=>{ye[xn]=pe[xn]});const ze=d.toFiniteNumber(pe.headers.get("content-length")),[Ht,ft]=x&&Un(ze,bt(Hn(x),!0))||[];pe=new r(Bn(pe.body,qn,Ht,()=>{ft&&ft(),R&&R()}),ye)}L=L||"text";let ls=await f[d.findKey(f,L)||"text"](pe,m);return!Mn&&R&&R(),await new Promise((ye,ze)=>{Zr(ye,ze,{data:ls,headers:K.from(pe.headers),status:pe.status,statusText:pe.statusText,config:m,request:T})})}catch(B){throw R&&R(),B&&B.name==="TypeError"&&/Load failed|fetch/i.test(B.message)?Object.assign(new O("Network Error",O.ERR_NETWORK,m,T,B&&B.response),{cause:B.cause||B}):O.from(B,B&&B.code,m,T,B&&B.response)}}},zo=new Map,Xr=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:i}=e,s=[r,i,n];let o=s.length,a=o,l,c,u=zo;for(;a--;)l=s[a],c=u.get(l),c===void 0&&u.set(l,c=a?new Map:Fo(e)),u=c;return c};Xr();const On={http:js,xhr:Co,fetch:{get:Xr}};d.forEach(On,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const jn=t=>`- ${t}`,Mo=t=>d.isFunction(t)||t===null||t===!1;function xo(t,e){t=d.isArray(t)?t:[t];const{length:n}=t;let r,i;const s={};for(let o=0;o<n;o++){r=t[o];let a;if(i=r,!Mo(r)&&(i=On[(a=String(r)).toLowerCase()],i===void 0))throw new O(`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(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=n?o.length>1?`since :
4
+ `+o.map(jn).join(`
5
+ `):" "+jn(o[0]):"as no adapter specified";throw new O("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return i}const Jr={getAdapter:xo,adapters:On};function qt(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new st(null,t)}function Gn(t){return qt(t),t.headers=K.from(t.headers),t.data=Bt.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Jr.getAdapter(t.adapter||it.adapter,t)(t).then(function(r){return qt(t),r.data=Bt.call(t,t.transformResponse,r),r.headers=K.from(r.headers),r},function(r){return Yr(r)||(qt(t),r&&r.response&&(r.response.data=Bt.call(t,t.transformResponse,r.response),r.response.headers=K.from(r.response.headers))),Promise.reject(r)})}const Kr="1.13.5",xt={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{xt[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const Xn={};xt.transitional=function(e,n,r){function i(s,o){return"[Axios v"+Kr+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,a)=>{if(e===!1)throw new O(i(o," has been removed"+(n?" in "+n:"")),O.ERR_DEPRECATED);return n&&!Xn[o]&&(Xn[o]=!0,console.warn(i(o," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(s,o,a):!0}};xt.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function _o(t,e,n){if(typeof t!="object")throw new O("options must be an object",O.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let i=r.length;for(;i-- >0;){const s=r[i],o=e[s];if(o){const a=t[s],l=a===void 0||o(a,s,t);if(l!==!0)throw new O("option "+s+" must be "+l,O.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new O("Unknown option "+s,O.ERR_BAD_OPTION)}}const Tt={assertOptions:_o,validators:xt},te=Tt.validators;let ve=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Ln,response:new Ln}}async request(e,n){try{return await this._request(e,n)}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+=`
6
+ `+s):r.stack=s}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=ke(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&Tt.assertOptions(r,{silentJSONParsing:te.transitional(te.boolean),forcedJSONParsing:te.transitional(te.boolean),clarifyTimeoutError:te.transitional(te.boolean),legacyInterceptorReqResOrdering:te.transitional(te.boolean)},!1),i!=null&&(d.isFunction(i)?n.paramsSerializer={serialize:i}:Tt.assertOptions(i,{encode:te.function,serialize:te.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Tt.assertOptions(n,{baseUrl:te.spelling("baseURL"),withXsrfToken:te.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=s&&d.merge(s.common,s[n.method]);s&&d.forEach(["delete","get","head","post","put","patch","common"],m=>{delete s[m]}),n.headers=K.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(g){if(typeof g.runWhen=="function"&&g.runWhen(n)===!1)return;l=l&&g.synchronous;const h=n.transitional||Sn;h&&h.legacyInterceptorReqResOrdering?a.unshift(g.fulfilled,g.rejected):a.push(g.fulfilled,g.rejected)});const c=[];this.interceptors.response.forEach(function(g){c.push(g.fulfilled,g.rejected)});let u,f=0,p;if(!l){const m=[Gn.bind(this),void 0];for(m.unshift(...a),m.push(...c),p=m.length,u=Promise.resolve(n);f<p;)u=u.then(m[f++],m[f++]);return u}p=a.length;let E=n;for(;f<p;){const m=a[f++],g=a[f++];try{E=m(E)}catch(h){g.call(this,h);break}}try{u=Gn.call(this,E)}catch(m){return Promise.reject(m)}for(f=0,p=c.length;f<p;)u=u.then(c[f++],c[f++]);return u}getUri(e){e=ke(this.defaults,e);const n=jr(e.baseURL,e.url,e.allowAbsoluteUrls);return qr(n,e.params,e.paramsSerializer)}};d.forEach(["delete","get","head","options"],function(e){ve.prototype[e]=function(n,r){return this.request(ke(r||{},{method:e,url:n,data:(r||{}).data}))}});d.forEach(["post","put","patch"],function(e){function n(r){return function(s,o,a){return this.request(ke(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}ve.prototype[e]=n(),ve.prototype[e+"Form"]=n(!0)});let Do=class Qr{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=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 st(s,o,a),n(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 n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new Qr(function(i){e=i}),cancel:e}}};function Po(t){return function(n){return t.apply(null,n)}}function Lo(t){return d.isObject(t)&&t.isAxiosError===!0}const sn={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(sn).forEach(([t,e])=>{sn[e]=t});function ei(t){const e=new ve(t),n=Mr(ve.prototype.request,e);return d.extend(n,ve.prototype,e,{allOwnKeys:!0}),d.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return ei(ke(t,i))},n}const U=ei(it);U.Axios=ve;U.CanceledError=st;U.CancelToken=Do;U.isCancel=Yr;U.VERSION=Kr;U.toFormData=Mt;U.AxiosError=O;U.Cancel=U.CanceledError;U.all=function(e){return Promise.all(e)};U.spread=Po;U.isAxiosError=Lo;U.mergeConfig=ke;U.AxiosHeaders=K;U.formToJSON=t=>Wr(d.isHTMLForm(t)?new FormData(t):t);U.getAdapter=Jr.getAdapter;U.HttpStatusCode=sn;U.default=U;const{Axios:$c,AxiosError:Bc,CanceledError:qc,isCancel:Wc,CancelToken:Yc,VERSION:Zc,all:jc,Cancel:Gc,isAxiosError:Xc,spread:Jc,toFormData:Kc,AxiosHeaders:Qc,HttpStatusCode:eu,formToJSON:tu,getAdapter:nu,mergeConfig:ru}=U;var A=(t=>(t.COMPANY_SUMMARY_FETCH_FAILED="COMPANY_SUMMARY_FETCH_FAILED",t.BALANCE_SHEET_FETCH_FAILED="BALANCE_SHEET_FETCH_FAILED",t.SHARES_FETCH_FAILED="SHARES_FETCH_FAILED",t.PERSONA_DATA_FETCH_FAILED="PERSONA_DATA_FETCH_FAILED",t.PERSON_CORPORATE_HOLDINGS_FETCH_FAILED="PERSON_CORPORATE_HOLDINGS_FETCH_FAILED",t.CORPORATE_HOLDINGS_NOT_FOUND="CORPORATE_HOLDINGS_NOT_FOUND",t.PROTESTS_FETCH_FAILED="PROTESTS_FETCH_FAILED",t.MISSING_CCIAA_OR_REA="MISSING_CCIAA_OR_REA",t.COMPANY_NOT_FOUND="COMPANY_NOT_FOUND",t.PERSONA_DATA_NOT_FOUND="PERSONA_DATA_NOT_FOUND",t.INSUFFICIENT_CREDIT="INSUFFICIENT_CREDIT",t.SERVICE_UNAVAILABLE="SERVICE_UNAVAILABLE",t.HTTP_ERROR="HTTP_ERROR",t.BAD_REQUEST="BAD_REQUEST",t.XML_PARSE_ERROR="XML_PARSE_ERROR",t.XBRL_EMPTY="XBRL_EMPTY",t.XBRL_DECODE_ERROR="XBRL_DECODE_ERROR",t.XBRL_MAPPING_ERROR="XBRL_MAPPING_ERROR",t))(A||{});const k={COMPANY_SUMMARY_FETCH_FAILED:"Errore nel recupero anagrafica impresa",BALANCE_SHEET_FETCH_FAILED:"Errore nel recupero dati di bilancio",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 di bilancio. Errore nel recupero del file XBRL.",XBRL_DECODE_ERROR:"Impossibile recuperare i dati di bilancio. Errore nella decodifica del file XBRL.",XBRL_MAPPING_ERROR:"Impossibile recuperare i dati di bilancio. Errore nella mappaggio del file XBRL.",INSUFFICIENT_CREDIT:"Credito insufficiente per procedere",PERSONA_DATA_NOT_FOUND:"Dati persona non trovati"};function F(t,e,n,r){t.push({code:e,fields:n,message:r})}class Jn{toYesNoFlag(e){return e==="S"?!0:e==="N"?!1:void 0}getXmlText(e){return e?e._text??e["#text"]??null:null}toArray(e){return e?Array.isArray(e)?e:[e]:[]}toSingleOrNull(e){return e?Array.isArray(e)?e[0]??null:e:null}mapAddress(e){return e?{street:e.via??null,streetNumber:e["n-civico"]??null,city:e.comune??null,province:e.provincia??null,postalCode:e.cap??null,topographyCode:e["c-toponimo"]??null,topographyName:e.toponimo??null}:null}mapShareCapital(e){return e?{currencyCode:e["c-valuta"]??null,currencyName:e.valuta??null,amount:e.ammontare??null,subscribedAmount:e.sottoscritto?.ammontare??null,paidAmount:e.versato?.ammontare??null}:null}async mapAnagraficaImpresaToCompanySummary(e,n=[]){return e?(e.Denominazione||F(n,A.COMPANY_SUMMARY_FETCH_FAILED,["companyName"],k.COMPANY_SUMMARY_FETCH_FAILED),e.PIva||F(n,A.COMPANY_SUMMARY_FETCH_FAILED,["vatNumber"],k.COMPANY_SUMMARY_FETCH_FAILED),e.Cciaa||F(n,A.COMPANY_SUMMARY_FETCH_FAILED,[],k.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:n}):(F(n,A.COMPANY_SUMMARY_FETCH_FAILED,[],k.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:n})}async mapBlocchiImpresaToCompanyRegistryBlocksSummary(e){const n=e.Risposta.dati,r=n["blocchi-impresa"],i=r["dati-identificativi"],s=r["sintesi-attivita"],o=s?.["classificazione-ateco"],a=i?.["persone-rappresentanti"]?.["persona-rappresentante"],l=a?this.toArray(a).map(y=>({lastName:y.cognome??null,firstName:y.nome??null,role:y.carica??null,isRegisteredRepresentative:this.toYesNoFlag(y["f-rappresentante-ri"])})):null,c=r["sintesi-cifre-impresa"],u=r["info-sede"],f=r["estremi-atto-costituzione"],p=r["info-attivita"],E=r["storia-addetti"],m=r["albi-ruoli-licenze"],g=r["persone-sede"],h=r["elenco-soci"],S=r["tabella-elenco-soci"],z=r.mad,M=r.trascrizioni,_=r["storia-sedi-precedenti"],x=r["iscrizione-ri"],Z=r["info-statuto"],L=r["amministrazione-controllo"],me=r["info-patrimoniali-finanziarie"],Q=r["procedure-concorsuali"],ue=r["ta-fusioni-scissioni-subentri"],Ne=y=>({informationTypeCode:y["c-tipo-informazione"]??null,informationType:y["tipo-informazione"]??null,year:y.anno??null,declarationDate:y["dt-dichiarazione"]??null,surveyDate:y["dt-rilevazione"]??null,monthlyDetails:this.toArray(y["info-mesi"]?.["info-mese"]).map(T=>({monthCode:T["c-mese"]??null,numEmployees:T["n-dipendenti"]??null,numSelfEmployed:T["n-indipendenti"]??null,total:T["n-totale"]??null})),contractDistribution:y["distribuzione-dipendenti"]??null,workingHoursDistribution:null,qualificationDistribution:null});return{recognition:{positionId:String(n.Riconoscimento?.IdentificativoPosizione??""),returnedOutput:n.Riconoscimento?.OutputRestituiti??null},identification:{activityStatus:{text:i?.["stato-attivita"]?.["#text"]??null,code:i?.["stato-attivita"]?.c??null},legalForm:{text:i?.["forma-giuridica"]?.["#text"]??null,code:i?.["forma-giuridica"]?.c??null},locationAddress:{street:i?.["indirizzo-localizzazione"]?.via??null,streetNumber:i?.["indirizzo-localizzazione"]?.["n-civico"]??null,city:i?.["indirizzo-localizzazione"]?.comune??null,province:i?.["indirizzo-localizzazione"]?.provincia??null,postalCode:i?.["indirizzo-localizzazione"]?.cap??null,topographyCode:i?.["indirizzo-localizzazione"]?.["c-toponimo"]??null,topographyName:i?.["indirizzo-localizzazione"]?.toponimo??null},certifiedEmail:i?.["indirizzo-posta-certificata"]??null,representatives:{representative:l},isInterchamberOffice:this.toYesNoFlag(i?.["f-sede-intercamerale"])??null,sourceCode:i?.["c-fonte"]??null,sourceName:i?.fonte??null,subjectType:i?.["tipo-soggetto"]??null,subjectTypeDescription:i?.["descrizione-tipo-soggetto"]??null,companyType:i?.["tipo-impresa"]??null,companyTypeDescription:i?.["descrizione-tipo-impresa"]??null,registrationDate:i?.["dt-iscrizione-ri"]??null,constitutionDate:i?.["dt-atto-costituzione"]??null,lastProtocolDate:i?.["dt-ultimo-protocollo"]??null,lastProtocolProcessedDate:i?.["dt-mod-ultimo-protocollo-evaso"]??null,companyName:i?.denominazione??null,taxCode:i?.["c-fiscale"]??null,vatNumber:i?.["partita-iva"]??null,chamberCode:i?.["c-cciaa-competente"]??null,chamberName:i?.["cciaa-competente"]??null,chamberAbbreviation:i?.cciaa??null,reaNumber:i?.["n-rea"]??null},activitySummary:{mainActivityDescription:s?.["attivita-prevalente-r"]??null,atecoClassification:{activityCode:o?.["c-attivita"]??null,activityDescription:o?.attivita??null,referenceDate:o?.["dt-riferimento"]??null,relevanceCode:o?.["c-importanza"]??null,relevanceDescription:o?.importanza??null,sourceCode:o?.["c-fonte"]??null,sourceDescription:o?.fonte??null,naceCode:o?.["c-nace"]??"",startDate:o?.["dt-inizio"]??null},startDate:s?.["dt-inizio"]??null,aaActivityDescription:s?.["attivita-aa-r"]??null,agriculturalActivityDescription:s?.["attivita-agricola-r"]??null,environmentalRegistersFlag:this.toYesNoFlag(s?.["f-albi-registri-ambientali"])??null,importExportFlag:this.toYesNoFlag(s?.["f-import-export"])??null,networkContractFlag:this.toYesNoFlag(s?.["f-contratto-rete"])??null,pursuedActivityDescription:s?.["attivita-esercitata-r"]??null,qualityCertificationsFlag:this.toYesNoFlag(s?.["f-certificazioni-qualita"])??null,ratingScore:s?.["punteggio-rating-legalita"]??null,registersAndEnvironmentalRolesFlag:this.toYesNoFlag(s?.["f-albi-ruoli-licenze"])??null,soaCertificationsFlag:this.toYesNoFlag(s?.["f-certificazioni-qualita"])??null},financialSummary:c?{numLocalizations:c["n-localizzazioni"]??null,numAdministrators:c["n-amministratori"]??null,numAuditors:c["n-sindaci"]??null,numOfficeHolders:c["n-titolari-cariche"]??null,numShareholders:c["n-soci"]??null,employeesDate:c["dt-addetti"]??null,numEmployees:c["n-addetti"]??null,numHeadquartersTransfers:c["n-trasferimenti-sede"]??null,numShareTransfers:c["n-trasferimenti-quote"]??null,yearlyFilings:c["pratiche-anno"]?{startDate:c["pratiche-anno"]?.["dt-inizio"]??null,count:c["pratiche-anno"]?.n??null}:null,shareCapital:this.mapShareCapital(c["capitale-sociale"])}:null,headquartersInfo:u?{certifiedEmail:u["indirizzo-posta-certificata"]??null,reaRegistration:u["dati-iscrizione-rea-rd"]?{reaNumber:u["dati-iscrizione-rea-rd"]?.["n-rea"]??null}:null,vatNumber:u["partita-iva"]?._text??null,transferOrigin:u["provenienza-trasferimento"]?{chamberCode:u["provenienza-trasferimento"]?.cciaa??null,reaNumber:u["provenienza-trasferimento"]?.["n-rea"]??null}:null}:null,incorporationActDetails:f?{typeCode:f["c-tipo"]??null,type:f.tipo??null,repertoryNumber:f["n-repertorio"]??null,notary:f.notaio??null,notaryLocality:f["localita-notaio"]??null,notaryProvince:f["provincia-notaio"]??null}:null,activityInfo:p?{companyStartDate:p["dt-inizio-attivita-impresa"]??null,primaryActivity:p["attivita-esercitata"]??null,secondaryActivity:p["attivita-secondaria-esercitata"]??null,atecoClassifications:this.toSingleOrNull(p["classificazioni-ateco"])?{codingCode:this.toSingleOrNull(p["classificazioni-ateco"])?.["c-codifica"]??null,coding:this.toSingleOrNull(p["classificazioni-ateco"])?.codifica??null,classifications:this.toArray(this.toSingleOrNull(p["classificazioni-ateco"])?.["classificazione-ateco"]).map(y=>({activityCode:y["c-attivita"]??null,activity:y.attivita??null,relevanceCode:y["c-importanza"]??null,relevance:y.importanza??null,sourceCode:y["c-fonte"]??null,source:y.fonte??null}))}:null,certifications:p.certificazioni?{lastUpdateDate:p.certificazioni["dt-ultima-modifica"]??null,certifications:this.toArray(p.certificazioni.certificazione).map(y=>({accreditationSchemaCode:y["c-schema-accreditamento"]??null,accreditationSchema:y["schema-accreditamento"]??null,referenceStandard:y["norma-riferimento"]??null,certificateNumber:y["n-certificato"]??null,issueDate:y["dt-emissione"]??null,expiryDate:y["dt-scadenza"]??null,certifierName:y["denominazione-odc"]??null,certifierTaxCode:y["c-fiscale-odc"]??null}))}:null,companyEmployees:this.toArray(p["addetti-impresa"]).map(Ne),employeesByMunicipality:this.toArray(p["addetti-comuni"]).flatMap(y=>this.toArray(y["addetti-comune"])).map(y=>({municipalityCode:y["c-comune"]??null,municipality:y.comune??null,province:y.provincia??null,localUnits:this.toArray(y["pro-localizzazioni"]?.["pro-localizzazione"]).map(T=>String(T)),monthlyDetails:this.toArray(y["info-mesi"]?.["info-mese"]).map(T=>({monthCode:T["c-mese"]??null,numEmployees:T["n-dipendenti"]??null,numSelfEmployed:T["n-indipendenti"]??null,total:T["n-totale"]??null})),averageValues:y["valori-medi"]?{employees:y["valori-medi"]?.["valore-medio-dipendenti"]??null,selfEmployed:y["valori-medi"]?.["valore-medio-indipendenti"]??null,total:y["valori-medi"]?.["valore-medio-totale"]??null}:null}))}:null,workforceHistory:E?{entries:this.toArray(E["addetti-impresa"]).map(Ne)}:null,licensesAndRegisters:m?{environmentalDeclarations:this.toArray(m["dichiarazioni-ambientali"]?.["dichiarazione-ambientale"]).map(y=>({typeCode:y["c-tipo"]??null,type:y.tipo??null,sourceCode:y["c-fonte"]??null,source:y.fonte??null,provinceSection:y["provincia-sezione"]??null,number:y.n??null,extraFields:Object.entries(y).reduce((T,[R,fe])=>(["c-tipo","tipo","c-fonte","fonte","provincia-sezione","n"].includes(R)||(T[R]=fe),T),{})}))}:null,officePeople:{people:this.toArray(g?.persona).map(y=>({index:y.progressivo??null,isRegisteredRepresentative:y["f-rappresentante-ri"]??null,isAdministrator:y["f-amministratore"]??null,isAuditor:y["f-sindaco"]??null,physicalPerson:y["persona-fisica"]?{lastName:y["persona-fisica"].cognome??null,firstName:y["persona-fisica"].nome??null,taxCode:y["persona-fisica"]["c-fiscale"]??null,gender:y["persona-fisica"].sesso??null,birthInfo:y["persona-fisica"]["estremi-nascita"]?{date:y["persona-fisica"]["estremi-nascita"]?.dt??null,city:y["persona-fisica"]["estremi-nascita"]?.comune??null,province:y["persona-fisica"]["estremi-nascita"]?.provincia??null}:null}:null,legalPerson:y["persona-giuridica"]?{name:y["persona-giuridica"].denominazione??null,taxCode:y["persona-giuridica"]["c-fiscale"]??null}:null,certifiedEmail:y["indirizzo-posta-certificata"]??null,address:this.mapAddress(y.indirizzo),roleAssignmentGroups:this.toArray(y["atti-conferimento-cariche"]?.["atto-conferimento-cariche"]).map(T=>({groupIndex:T["p-gruppo-cariche"]??null,roles:{role:this.toArray(T.cariche?.carica).map(R=>({roleIndex:R["p-carica"]??null,roleCode:R["c-carica"]??null,registrationDate:null,appointmentDate:R["dt-atto-nomina"]??null,durationCode:R["c-durata"]??null,durationDescription:R["descrizione-durata"]??null,referenceBalanceDate:R["dt-riferimento-bilancio"]??null,presentationDate:null}))}}))}))},shareholdersList:h?{shareholdersReferenceDate:h["dt-soci-titolari-al"]??null,isLatestShareholdersList:h["f-ultimo-elenco-soci"]??null,practiceDetails:h["estremi-pratica"]?{practiceCode:h["estremi-pratica"]?.["c-pratica"]??null,filingTypeCode:h["estremi-pratica"]?.["c-tipo-adempimento"]??null,filingType:h["estremi-pratica"]?.["tipo-adempimento"]??null,deedDate:h["estremi-pratica"]?.["dt-atto"]??null,chamberCode:h["estremi-pratica"]?.cciaa??null,year:h["estremi-pratica"]?.anno??null,number:h["estremi-pratica"]?.n??null,protocolDate:h["estremi-pratica"]?.["dt-protocollo"]??null,filingDate:h["estremi-pratica"]?.["dt-deposito"]??null}:null,shareCapital:this.mapShareCapital(h["capitale-sociale"]),frames:this.toArray(h.riquadri?.riquadro).map(y=>({composition:y["composizione-quote"]?{currencyCode:y["composizione-quote"]["c-valuta"]??null,currencyName:y["composizione-quote"].valuta??null,nominalValue:y["composizione-quote"]["valore-nominale"]??null,paidValue:y["composizione-quote"]["valore-versato"]??null}:null,holders:this.toArray(y.titolari?.titolare).map(T=>({isRepresentative:T["f-rappresentante"]??null,domicile:this.mapAddress(T.domicilio),holderIdentity:T["anagrafica-titolare"]?{typeCode:T["anagrafica-titolare"]?.["c-tipo"]??null,type:T["anagrafica-titolare"]?.tipo??null,taxCode:T["anagrafica-titolare"]?.["c-fiscale"]??null,name:T["anagrafica-titolare"]?.denominazione??null,lastName:T["anagrafica-titolare"]?.cognome??null,firstName:T["anagrafica-titolare"]?.nome??null}:null,participationRight:T["diritto-partecipazione"]?{rightTypeCode:T["diritto-partecipazione"]?.["c-tipo"]??null,rightType:T["diritto-partecipazione"]?.tipo??null}:null}))})),notes:this.toArray(h.note).join(`
7
+ `)||null}:null,shareholdersTable:{shareholders:this.toArray(S?.soci?.socio)},changesHistory:{sessions:this.toArray(z?.["sessioni-rd-rea"]?.["sessione-rd-rea"]).map(y=>({movementCode:y["c-movimentazione"]??null,movement:y.movimentazione??null,filingDate:y["dt-denuncia"]??null,changes:this.toArray(y.modifiche?.modifica).map(T=>({paragraphCode:T["p-modifica"]??null,effectiveDate:T["dt-effetto"]??null,typeCode:T["c-tipo"]??null,type:T.tipo??null,changeCode:T["c-modifica"]??null,changeCodeDescription:T["descrizione-c-modifica"]??null,text:this.getXmlText(T)??null}))}))},filingsTranscriptions:{protocols:this.toArray(M?.["protocolli-ri"]?.["protocollo-ri"]).map(y=>({protocolNumber:y["n-protocollo"]??null,officeProtocolNumber:y["n-protocollo-ufficio"]??null,year:y.anno??null,protocolDate:y["dt-protocollo"]??null,extraFields:Object.entries(y).reduce((T,[R,fe])=>(["n-protocollo","n-protocollo-ufficio","anno","dt-protocollo"].includes(R)||(T[R]=fe),T),{})}))},previousHeadquartersHistory:{entries:this.toArray(_?.["storia-sede-precedente"]).map(y=>({chamberCode:y.cciaa??null,reaNumber:y["n-rea"]??null,changesHistory:{sessions:this.toArray(y.mad?.["sessioni-rd-rea"]?.["sessione-rd-rea"]).map(T=>({movementCode:T["c-movimentazione"]??null,movement:T.movimentazione??null,filingDate:T["dt-denuncia"]??null,changes:this.toArray(T.modifiche?.modifica).map(R=>({paragraphCode:R["p-modifica"]??null,effectiveDate:R["dt-effetto"]??null,typeCode:R["c-tipo"]??null,type:R.tipo??null,changeCode:R["c-modifica"]??null,changeCodeDescription:R["descrizione-c-modifica"]??null,text:this.getXmlText(R)??null}))}))},filingsTranscriptions:{protocols:this.toArray(y.trascrizioni?.["protocolli-ri"]?.["protocollo-ri"]).map(T=>({protocolNumber:T["n-protocollo"]??null,officeProtocolNumber:T["n-protocollo-ufficio"]??null,year:T.anno??null,protocolDate:T["dt-protocollo"]??null,extraFields:Object.entries(T).reduce((R,[fe,B])=>(["n-protocollo","n-protocollo-ufficio","anno","dt-protocollo"].includes(fe)||(R[fe]=B),R),{})}))}}))},registerEnrollment:x?{enrollmentNumber:x["n-iscrizione-ri"]??null,provinceCode:x["provincia-ri"]??null,chamberName:x["cciaa-competente"]??null,enrollmentDate:x["dt-iscrizione"]??null,sections:this.toArray(x.sezioni?.sezione)}:null,bylawsInfo:Z?{incorporationDate:Z["dt-atto-costituzione"]??null,companyEndDate:Z["durata-societa"]?.["dt-termine"]??null,corporatePurpose:Z["oggetto-sociale"]??null,bylawsPowers:Z.poteri?.["poteri-statuto"]??null}:null,governanceAndControl:L?{administrationSystem:L["sistema-amministrazione"]?{code:L["sistema-amministrazione"]?.c??null,text:this.getXmlText(L["sistema-amministrazione"])}:null,administrativeForms:this.toArray(L["forme-amministrative"]?.["forma-amministrativa"]),activeAdministrativeForms:this.toArray(L["forme-amministrative-in-carica"]?.["forma-amministrativa-in-carica"])}:null,financialAssetInfo:me?{shareCapital:this.mapShareCapital(me["capitale-sociale"])}:null,insolvencyProcedures:Q?{hasInfo:Q["f-presenza-info"]??null}:null,mergersSplitsTransfers:{companySuccessions:this.toArray(ue?.["subentri-impresa"]?.subentri?.subentro)}}}}const Vo={PERSONA:"person",IMPRESA:"company",ALTRO:"other"};class Uo{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,n){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 l of a){const c={type:Vo[l["anagrafica-titolare"].tipo],fiscalCode:l["anagrafica-titolare"]["c-fiscale"],firstName:l["anagrafica-titolare"].nome||l["anagrafica-titolare"].denominazione,lastName:l["anagrafica-titolare"].cognome,shareValue:o,sharePercentage:o/n*100,isRepresentative:l["f-rappresentante"]==="S",address:this.parseAddress(l.domicilio)};r.push(c)}}return r}}class Fe extends Error{}class Ho extends Fe{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class $o extends Fe{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class Bo extends Fe{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class De extends Fe{}class ti extends Fe{constructor(e){super(`Invalid unit ${e}`)}}class q extends Fe{}class ge extends Fe{constructor(){super("Zone is an abstract class")}}const w="numeric",le="short",ee="long",Ct={year:w,month:w,day:w},ni={year:w,month:le,day:w},qo={year:w,month:le,day:w,weekday:le},ri={year:w,month:ee,day:w},ii={year:w,month:ee,day:w,weekday:ee},si={hour:w,minute:w},oi={hour:w,minute:w,second:w},ai={hour:w,minute:w,second:w,timeZoneName:le},li={hour:w,minute:w,second:w,timeZoneName:ee},ci={hour:w,minute:w,hourCycle:"h23"},ui={hour:w,minute:w,second:w,hourCycle:"h23"},fi={hour:w,minute:w,second:w,hourCycle:"h23",timeZoneName:le},di={hour:w,minute:w,second:w,hourCycle:"h23",timeZoneName:ee},hi={year:w,month:w,day:w,hour:w,minute:w},mi={year:w,month:w,day:w,hour:w,minute:w,second:w},pi={year:w,month:le,day:w,hour:w,minute:w},yi={year:w,month:le,day:w,hour:w,minute:w,second:w},Wo={year:w,month:le,day:w,weekday:le,hour:w,minute:w},gi={year:w,month:ee,day:w,hour:w,minute:w,timeZoneName:le},Ei={year:w,month:ee,day:w,hour:w,minute:w,second:w,timeZoneName:le},wi={year:w,month:ee,day:w,weekday:ee,hour:w,minute:w,timeZoneName:ee},Ti={year:w,month:ee,day:w,weekday:ee,hour:w,minute:w,second:w,timeZoneName:ee};class ot{get type(){throw new ge}get name(){throw new ge}get ianaName(){return this.name}get isUniversal(){throw new ge}offsetName(e,n){throw new ge}formatOffset(e,n){throw new ge}offset(e){throw new ge}equals(e){throw new ge}get isValid(){throw new ge}}let Wt=null;class _t extends ot{static get instance(){return Wt===null&&(Wt=new _t),Wt}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:n,locale:r}){return Fi(e,n,r)}formatOffset(e,n){return Qe(this.offset(e),n)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}const on=new Map;function Yo(t){let e=on.get(t);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),on.set(t,e)),e}const Zo={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function jo(t,e){const n=t.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n),[,i,s,o,a,l,c,u]=r;return[o,i,s,a,l,c,u]}function Go(t,e){const n=t.formatToParts(e),r=[];for(let i=0;i<n.length;i++){const{type:s,value:o}=n[i],a=Zo[s];s==="era"?r[a]=o:b(a)||(r[a]=parseInt(o,10))}return r}const Yt=new Map;class he extends ot{static create(e){let n=Yt.get(e);return n===void 0&&Yt.set(e,n=new he(e)),n}static resetCache(){Yt.clear(),on.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=he.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:n,locale:r}){return Fi(e,n,r,this.name)}formatOffset(e,n){return Qe(this.offset(e),n)}offset(e){if(!this.valid)return NaN;const n=new Date(e);if(isNaN(n))return NaN;const r=Yo(this.name);let[i,s,o,a,l,c,u]=r.formatToParts?Go(r,n):jo(r,n);a==="BC"&&(i=-Math.abs(i)+1);const p=Pt({year:i,month:s,day:o,hour:l===24?0:l,minute:c,second:u,millisecond:0});let E=+n;const m=E%1e3;return E-=m>=0?m:1e3+m,(p-E)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let Kn={};function Xo(t,e={}){const n=JSON.stringify([t,e]);let r=Kn[n];return r||(r=new Intl.ListFormat(t,e),Kn[n]=r),r}const an=new Map;function ln(t,e={}){const n=JSON.stringify([t,e]);let r=an.get(n);return r===void 0&&(r=new Intl.DateTimeFormat(t,e),an.set(n,r)),r}const cn=new Map;function Jo(t,e={}){const n=JSON.stringify([t,e]);let r=cn.get(n);return r===void 0&&(r=new Intl.NumberFormat(t,e),cn.set(n,r)),r}const un=new Map;function Ko(t,e={}){const{base:n,...r}=e,i=JSON.stringify([t,r]);let s=un.get(i);return s===void 0&&(s=new Intl.RelativeTimeFormat(t,e),un.set(i,s)),s}let Xe=null;function Qo(){return Xe||(Xe=new Intl.DateTimeFormat().resolvedOptions().locale,Xe)}const fn=new Map;function Si(t){let e=fn.get(t);return e===void 0&&(e=new Intl.DateTimeFormat(t).resolvedOptions(),fn.set(t,e)),e}const dn=new Map;function ea(t){let e=dn.get(t);if(!e){const n=new Intl.Locale(t);e="getWeekInfo"in n?n.getWeekInfo():n.weekInfo,"minimalDays"in e||(e={...Ni,...e}),dn.set(t,e)}return e}function ta(t){const e=t.indexOf("-x-");e!==-1&&(t=t.substring(0,e));const n=t.indexOf("-u-");if(n===-1)return[t];{let r,i;try{r=ln(t).resolvedOptions(),i=t}catch{const l=t.substring(0,n);r=ln(l).resolvedOptions(),i=l}const{numberingSystem:s,calendar:o}=r;return[i,s,o]}}function na(t,e,n){return(n||e)&&(t.includes("-u-")||(t+="-u"),n&&(t+=`-ca-${n}`),e&&(t+=`-nu-${e}`)),t}function ra(t){const e=[];for(let n=1;n<=12;n++){const r=N.utc(2009,n,1);e.push(t(r))}return e}function ia(t){const e=[];for(let n=1;n<=7;n++){const r=N.utc(2016,11,13+n);e.push(t(r))}return e}function ht(t,e,n,r){const i=t.listingMode();return i==="error"?null:i==="en"?n(e):r(e)}function sa(t){return t.numberingSystem&&t.numberingSystem!=="latn"?!1:t.numberingSystem==="latn"||!t.locale||t.locale.startsWith("en")||Si(t.locale).numberingSystem==="latn"}class oa{constructor(e,n,r){this.padTo=r.padTo||0,this.floor=r.floor||!1;const{padTo:i,floor:s,...o}=r;if(!n||Object.keys(o).length>0){const a={useGrouping:!1,...r};r.padTo>0&&(a.minimumIntegerDigits=r.padTo),this.inf=Jo(e,a)}}format(e){if(this.inf){const n=this.floor?Math.floor(e):e;return this.inf.format(n)}else{const n=this.floor?Math.floor(e):In(e,3);return H(n,this.padTo)}}}class aa{constructor(e,n,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&&he.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=ln(n,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(n=>{if(n.type==="timeZoneName"){const r=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...n,value:r}}else return n}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class la{constructor(e,n,r){this.opts={style:"long",...r},!n&&vi()&&(this.rtf=Ko(e,r))}format(e,n){return this.rtf?this.rtf.format(e,n):ka(n,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,n){return this.rtf?this.rtf.formatToParts(e,n):[]}}const Ni={firstDay:1,minimalDays:4,weekend:[6,7]};class v{static fromOpts(e){return v.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,n,r,i,s=!1){const o=e||P.defaultLocale,a=o||(s?"en-US":Qo()),l=n||P.defaultNumberingSystem,c=r||P.defaultOutputCalendar,u=mn(i)||P.defaultWeekSettings;return new v(a,l,c,u,o)}static resetCache(){Xe=null,an.clear(),cn.clear(),un.clear(),fn.clear(),dn.clear()}static fromObject({locale:e,numberingSystem:n,outputCalendar:r,weekSettings:i}={}){return v.create(e,n,r,i)}constructor(e,n,r,i,s){const[o,a,l]=ta(e);this.locale=o,this.numberingSystem=n||a||null,this.outputCalendar=r||l||null,this.weekSettings=i,this.intl=na(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=sa(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),n=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&n?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:v.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,mn(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,n=!1){return ht(this,e,xi,()=>{const r=this.intl==="ja"||this.intl.startsWith("ja-");n&=!r;const i=n?{month:e,day:"numeric"}:{month:e},s=n?"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]=ra(o)}return this.monthsCache[s][e]})}weekdays(e,n=!1){return ht(this,e,Pi,()=>{const r=n?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},i=n?"format":"standalone";return this.weekdaysCache[i][e]||(this.weekdaysCache[i][e]=ia(s=>this.extract(s,r,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return ht(this,void 0,()=>Li,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[N.utc(2016,11,13,9),N.utc(2016,11,13,19)].map(n=>this.extract(n,e,"dayperiod"))}return this.meridiemCache})}eras(e){return ht(this,e,Vi,()=>{const n={era:e};return this.eraCache[e]||(this.eraCache[e]=[N.utc(-40,1,1),N.utc(2017,1,1)].map(r=>this.extract(r,n,"era"))),this.eraCache[e]})}extract(e,n,r){const i=this.dtFormatter(e,n),s=i.formatToParts(),o=s.find(a=>a.type.toLowerCase()===r);return o?o.value:null}numberFormatter(e={}){return new oa(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,n={}){return new aa(e,this.intl,n)}relFormatter(e={}){return new la(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Xo(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||Si(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:ki()?ea(this.locale):Ni}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 Zt=null;class G extends ot{static get utcInstance(){return Zt===null&&(Zt=new G(0)),Zt}static instance(e){return e===0?G.utcInstance:new G(e)}static parseSpecifier(e){if(e){const n=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(n)return new G(Lt(n[1],n[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Qe(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Qe(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,n){return Qe(this.fixed,n)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class ca extends ot{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 Te(t,e){if(b(t)||t===null)return e;if(t instanceof ot)return t;if(pa(t)){const n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?_t.instance:n==="utc"||n==="gmt"?G.utcInstance:G.parseSpecifier(n)||he.create(t)}else return Se(t)?G.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new ca(t)}const bn={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Qn={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]},ua=bn.hanidec.replace(/[\[|\]]/g,"").split("");function fa(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let n=0;n<t.length;n++){const r=t.charCodeAt(n);if(t[n].search(bn.hanidec)!==-1)e+=ua.indexOf(t[n]);else for(const i in Qn){const[s,o]=Qn[i];r>=s&&r<=o&&(e+=r-s)}}return parseInt(e,10)}else return e}const hn=new Map;function da(){hn.clear()}function se({numberingSystem:t},e=""){const n=t||"latn";let r=hn.get(n);r===void 0&&(r=new Map,hn.set(n,r));let i=r.get(e);return i===void 0&&(i=new RegExp(`${bn[n]}${e}`),r.set(e,i)),i}let er=()=>Date.now(),tr="system",nr=null,rr=null,ir=null,sr=60,or,ar=null;class P{static get now(){return er}static set now(e){er=e}static set defaultZone(e){tr=e}static get defaultZone(){return Te(tr,_t.instance)}static get defaultLocale(){return nr}static set defaultLocale(e){nr=e}static get defaultNumberingSystem(){return rr}static set defaultNumberingSystem(e){rr=e}static get defaultOutputCalendar(){return ir}static set defaultOutputCalendar(e){ir=e}static get defaultWeekSettings(){return ar}static set defaultWeekSettings(e){ar=mn(e)}static get twoDigitCutoffYear(){return sr}static set twoDigitCutoffYear(e){sr=e%100}static get throwOnInvalid(){return or}static set throwOnInvalid(e){or=e}static resetCaches(){v.resetCache(),he.resetCache(),N.resetCache(),da()}}class ae{constructor(e,n){this.reason=e,this.explanation=n}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const Oi=[0,31,59,90,120,151,181,212,243,273,304,334],bi=[0,31,60,91,121,152,182,213,244,274,305,335];function re(t,e){return new ae("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function Cn(t,e,n){const r=new Date(Date.UTC(t,e-1,n));t<100&&t>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);const i=r.getUTCDay();return i===0?7:i}function Ci(t,e,n){return n+(at(t)?bi:Oi)[e-1]}function Ai(t,e){const n=at(t)?bi:Oi,r=n.findIndex(s=>s<e),i=e-n[r];return{month:r+1,day:i}}function An(t,e){return(t-e+7)%7+1}function At(t,e=4,n=1){const{year:r,month:i,day:s}=t,o=Ci(r,i,s),a=An(Cn(r,i,s),n);let l=Math.floor((o-a+14-e)/7),c;return l<1?(c=r-1,l=et(c,e,n)):l>et(r,e,n)?(c=r+1,l=1):c=r,{weekYear:c,weekNumber:l,weekday:a,...Vt(t)}}function lr(t,e=4,n=1){const{weekYear:r,weekNumber:i,weekday:s}=t,o=An(Cn(r,1,e),n),a=Pe(r);let l=i*7+s-o-7+e,c;l<1?(c=r-1,l+=Pe(c)):l>a?(c=r+1,l-=Pe(r)):c=r;const{month:u,day:f}=Ai(c,l);return{year:c,month:u,day:f,...Vt(t)}}function jt(t){const{year:e,month:n,day:r}=t,i=Ci(e,n,r);return{year:e,ordinal:i,...Vt(t)}}function cr(t){const{year:e,ordinal:n}=t,{month:r,day:i}=Ai(e,n);return{year:e,month:r,day:i,...Vt(t)}}function ur(t,e){if(!b(t.localWeekday)||!b(t.localWeekNumber)||!b(t.localWeekYear)){if(!b(t.weekday)||!b(t.weekNumber)||!b(t.weekYear))throw new De("Cannot mix locale-based week fields with ISO-based week fields");return b(t.localWeekday)||(t.weekday=t.localWeekday),b(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),b(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function ha(t,e=4,n=1){const r=Dt(t.weekYear),i=ie(t.weekNumber,1,et(t.weekYear,e,n)),s=ie(t.weekday,1,7);return r?i?s?!1:re("weekday",t.weekday):re("week",t.weekNumber):re("weekYear",t.weekYear)}function ma(t){const e=Dt(t.year),n=ie(t.ordinal,1,Pe(t.year));return e?n?!1:re("ordinal",t.ordinal):re("year",t.year)}function Ri(t){const e=Dt(t.year),n=ie(t.month,1,12),r=ie(t.day,1,Rt(t.year,t.month));return e?n?r?!1:re("day",t.day):re("month",t.month):re("year",t.year)}function Ii(t){const{hour:e,minute:n,second:r,millisecond:i}=t,s=ie(e,0,23)||e===24&&n===0&&r===0&&i===0,o=ie(n,0,59),a=ie(r,0,59),l=ie(i,0,999);return s?o?a?l?!1:re("millisecond",i):re("second",r):re("minute",n):re("hour",e)}function b(t){return typeof t>"u"}function Se(t){return typeof t=="number"}function Dt(t){return typeof t=="number"&&t%1===0}function pa(t){return typeof t=="string"}function ya(t){return Object.prototype.toString.call(t)==="[object Date]"}function vi(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function ki(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function ga(t){return Array.isArray(t)?t:[t]}function fr(t,e,n){if(t.length!==0)return t.reduce((r,i)=>{const s=[e(i),i];return r&&n(r[0],s[0])===r[0]?r:s},null)[1]}function Ea(t,e){return e.reduce((n,r)=>(n[r]=t[r],n),{})}function Ue(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function mn(t){if(t==null)return null;if(typeof t!="object")throw new q("Week settings must be an object");if(!ie(t.firstDay,1,7)||!ie(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!ie(e,1,7)))throw new q("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function ie(t,e,n){return Dt(t)&&t>=e&&t<=n}function wa(t,e){return t-e*Math.floor(t/e)}function H(t,e=2){const n=t<0;let r;return n?r="-"+(""+-t).padStart(e,"0"):r=(""+t).padStart(e,"0"),r}function Ee(t){if(!(b(t)||t===null||t===""))return parseInt(t,10)}function Oe(t){if(!(b(t)||t===null||t===""))return parseFloat(t)}function Rn(t){if(!(b(t)||t===null||t==="")){const e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function In(t,e,n="round"){const r=10**e;switch(n){case"expand":return t>0?Math.ceil(t*r)/r:Math.floor(t*r)/r;case"trunc":return Math.trunc(t*r)/r;case"round":return Math.round(t*r)/r;case"floor":return Math.floor(t*r)/r;case"ceil":return Math.ceil(t*r)/r;default:throw new RangeError(`Value rounding ${n} is out of range`)}}function at(t){return t%4===0&&(t%100!==0||t%400===0)}function Pe(t){return at(t)?366:365}function Rt(t,e){const n=wa(e-1,12)+1,r=t+(e-n)/12;return n===2?at(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function Pt(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function dr(t,e,n){return-An(Cn(t,1,e),n)+e-1}function et(t,e=4,n=1){const r=dr(t,e,n),i=dr(t+1,e,n);return(Pe(t)-r+i)/7}function pn(t){return t>99?t:t>P.twoDigitCutoffYear?1900+t:2e3+t}function Fi(t,e,n,r=null){const i=new Date(t),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(n,o).formatToParts(i).find(l=>l.type.toLowerCase()==="timezonename");return a?a.value:null}function Lt(t,e){let n=parseInt(t,10);Number.isNaN(n)&&(n=0);const r=parseInt(e,10)||0,i=n<0||Object.is(n,-0)?-r:r;return n*60+i}function zi(t){const e=Number(t);if(typeof t=="boolean"||t===""||!Number.isFinite(e))throw new q(`Invalid unit value ${t}`);return e}function It(t,e){const n={};for(const r in t)if(Ue(t,r)){const i=t[r];if(i==null)continue;n[e(r)]=zi(i)}return n}function Qe(t,e){const n=Math.trunc(Math.abs(t/60)),r=Math.trunc(Math.abs(t%60)),i=t>=0?"+":"-";switch(e){case"short":return`${i}${H(n,2)}:${H(r,2)}`;case"narrow":return`${i}${n}${r>0?`:${r}`:""}`;case"techie":return`${i}${H(n,2)}${H(r,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Vt(t){return Ea(t,["hour","minute","second","millisecond"])}const Ta=["January","February","March","April","May","June","July","August","September","October","November","December"],Mi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Sa=["J","F","M","A","M","J","J","A","S","O","N","D"];function xi(t){switch(t){case"narrow":return[...Sa];case"short":return[...Mi];case"long":return[...Ta];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 _i=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Di=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Na=["M","T","W","T","F","S","S"];function Pi(t){switch(t){case"narrow":return[...Na];case"short":return[...Di];case"long":return[..._i];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Li=["AM","PM"],Oa=["Before Christ","Anno Domini"],ba=["BC","AD"],Ca=["B","A"];function Vi(t){switch(t){case"narrow":return[...Ca];case"short":return[...ba];case"long":return[...Oa];default:return null}}function Aa(t){return Li[t.hour<12?0:1]}function Ra(t,e){return Pi(e)[t.weekday-1]}function Ia(t,e){return xi(e)[t.month-1]}function va(t,e){return Vi(e)[t.year<0?0:1]}function ka(t,e,n="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(t)===-1;if(n==="auto"&&s){const f=t==="days";switch(e){case 1:return f?"tomorrow":`next ${i[t][0]}`;case-1:return f?"yesterday":`last ${i[t][0]}`;case 0:return f?"today":`this ${i[t][0]}`}}const o=Object.is(e,-0)||e<0,a=Math.abs(e),l=a===1,c=i[t],u=r?l?c[1]:c[2]||c[1]:l?i[t][0]:t;return o?`${a} ${u} ago`:`in ${a} ${u}`}function hr(t,e){let n="";for(const r of t)r.literal?n+=r.val:n+=e(r.val);return n}const Fa={D:Ct,DD:ni,DDD:ri,DDDD:ii,t:si,tt:oi,ttt:ai,tttt:li,T:ci,TT:ui,TTT:fi,TTTT:di,f:hi,ff:pi,fff:gi,ffff:wi,F:mi,FF:yi,FFF:Ei,FFFF:Ti};class Y{static create(e,n={}){return new Y(e,n)}static parseFormat(e){let n=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}),n=null,r="",i=!i):i||a===n?r+=a:(r.length>0&&s.push({literal:/^\s+$/.test(r),val:r}),r=a,n=a)}return r.length>0&&s.push({literal:i||/^\s+$/.test(r),val:r}),s}static macroTokenToFormatOpts(e){return Fa[e]}constructor(e,n){this.opts=n,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,n){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...n}).format()}dtFormatter(e,n={}){return this.loc.dtFormatter(e,{...this.opts,...n})}formatDateTime(e,n){return this.dtFormatter(e,n).format()}formatDateTimeParts(e,n){return this.dtFormatter(e,n).formatToParts()}formatInterval(e,n){return this.dtFormatter(e.start,n).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,n){return this.dtFormatter(e,n).resolvedOptions()}num(e,n=0,r=void 0){if(this.opts.forceSimple)return H(e,n);const i={...this.opts};return n>0&&(i.padTo=n),r&&(i.signDisplay=r),this.loc.numberFormatter(i).format(e)}formatDateTimeFromString(e,n){const r=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",s=(E,m)=>this.loc.extract(e,E,m),o=E=>e.isOffsetFixed&&e.offset===0&&E.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,E.format):"",a=()=>r?Aa(e):s({hour:"numeric",hourCycle:"h12"},"dayperiod"),l=(E,m)=>r?Ia(e,E):s(m?{month:E}:{month:E,day:"numeric"},"month"),c=(E,m)=>r?Ra(e,E):s(m?{weekday:E}:{weekday:E,month:"long",day:"numeric"},"weekday"),u=E=>{const m=Y.macroTokenToFormatOpts(E);return m?this.formatWithSystemDefault(e,m):E},f=E=>r?va(e,E):s({era:E},"era"),p=E=>{switch(E){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 c("short",!0);case"cccc":return c("long",!0);case"ccccc":return c("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return c("short",!1);case"EEEE":return c("long",!1);case"EEEEE":return c("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 l("short",!0);case"LLLL":return l("long",!0);case"LLLLL":return l("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 l("short",!1);case"MMMM":return l("long",!1);case"MMMMM":return l("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(E)}};return hr(Y.parseFormat(n),p)}formatDurationFromString(e,n){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)=>p=>{const E=i(p);if(E){const m=f.isNegativeDuration&&E!==f.largestUnit?r:1;let g;return this.opts.signMode==="negativeLargestOnly"&&E!==f.largestUnit?g="never":this.opts.signMode==="all"?g="always":g="auto",this.num(u.get(E)*m,p.length,g)}else return p},o=Y.parseFormat(n),a=o.reduce((u,{literal:f,val:p})=>f?u:u.concat(p),[]),l=e.shiftTo(...a.map(i).filter(u=>u)),c={isNegativeDuration:l<0,largestUnit:Object.keys(l.values)[0]};return hr(o,s(l,c))}}const Ui=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function $e(...t){const e=t.reduce((n,r)=>n+r.source,"");return RegExp(`^${e}$`)}function Be(...t){return e=>t.reduce(([n,r,i],s)=>{const[o,a,l]=s(e,i);return[{...n,...o},a||r,l]},[{},null,1]).slice(0,2)}function qe(t,...e){if(t==null)return[null,null];for(const[n,r]of e){const i=n.exec(t);if(i)return r(i)}return[null,null]}function Hi(...t){return(e,n)=>{const r={};let i;for(i=0;i<t.length;i++)r[t[i]]=Ee(e[n+i]);return[r,null,n+i]}}const $i=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,za=`(?:${$i.source}?(?:\\[(${Ui.source})\\])?)?`,vn=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Bi=RegExp(`${vn.source}${za}`),kn=RegExp(`(?:[Tt]${Bi.source})?`),Ma=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,xa=/(\d{4})-?W(\d\d)(?:-?(\d))?/,_a=/(\d{4})-?(\d{3})/,Da=Hi("weekYear","weekNumber","weekDay"),Pa=Hi("year","ordinal"),La=/(\d{4})-(\d\d)-(\d\d)/,qi=RegExp(`${vn.source} ?(?:${$i.source}|(${Ui.source}))?`),Va=RegExp(`(?: ${qi.source})?`);function Le(t,e,n){const r=t[e];return b(r)?n:Ee(r)}function Ua(t,e){return[{year:Le(t,e),month:Le(t,e+1,1),day:Le(t,e+2,1)},null,e+3]}function We(t,e){return[{hours:Le(t,e,0),minutes:Le(t,e+1,0),seconds:Le(t,e+2,0),milliseconds:Rn(t[e+3])},null,e+4]}function lt(t,e){const n=!t[e]&&!t[e+1],r=Lt(t[e+1],t[e+2]),i=n?null:G.instance(r);return[{},i,e+3]}function ct(t,e){const n=t[e]?he.create(t[e]):null;return[{},n,e+1]}const Ha=RegExp(`^T?${vn.source}$`),$a=/^-?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 Ba(t){const[e,n,r,i,s,o,a,l,c]=t,u=e[0]==="-",f=l&&l[0]==="-",p=(E,m=!1)=>E!==void 0&&(m||E&&u)?-E:E;return[{years:p(Oe(n)),months:p(Oe(r)),weeks:p(Oe(i)),days:p(Oe(s)),hours:p(Oe(o)),minutes:p(Oe(a)),seconds:p(Oe(l),l==="-0"),milliseconds:p(Rn(c),f)}]}const qa={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Fn(t,e,n,r,i,s,o){const a={year:e.length===2?pn(Ee(e)):Ee(e),month:Mi.indexOf(n)+1,day:Ee(r),hour:Ee(i),minute:Ee(s)};return o&&(a.second=Ee(o)),t&&(a.weekday=t.length>3?_i.indexOf(t)+1:Di.indexOf(t)+1),a}const Wa=/^(?:(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 Ya(t){const[,e,n,r,i,s,o,a,l,c,u,f]=t,p=Fn(e,i,r,n,s,o,a);let E;return l?E=qa[l]:c?E=0:E=Lt(u,f),[p,new G(E)]}function Za(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const ja=/^(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$/,Ga=/^(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$/,Xa=/^(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 mr(t){const[,e,n,r,i,s,o,a]=t;return[Fn(e,i,r,n,s,o,a),G.utcInstance]}function Ja(t){const[,e,n,r,i,s,o,a]=t;return[Fn(e,a,n,r,i,s,o),G.utcInstance]}const Ka=$e(Ma,kn),Qa=$e(xa,kn),el=$e(_a,kn),tl=$e(Bi),Wi=Be(Ua,We,lt,ct),nl=Be(Da,We,lt,ct),rl=Be(Pa,We,lt,ct),il=Be(We,lt,ct);function sl(t){return qe(t,[Ka,Wi],[Qa,nl],[el,rl],[tl,il])}function ol(t){return qe(Za(t),[Wa,Ya])}function al(t){return qe(t,[ja,mr],[Ga,mr],[Xa,Ja])}function ll(t){return qe(t,[$a,Ba])}const cl=Be(We);function ul(t){return qe(t,[Ha,cl])}const fl=$e(La,Va),dl=$e(qi),hl=Be(We,lt,ct);function ml(t){return qe(t,[fl,Wi],[dl,hl])}const pr="Invalid Duration",Yi={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}},pl={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},...Yi},ne=146097/400,Me=146097/4800,yl={years:{quarters:4,months:12,weeks:ne/7,days:ne,hours:ne*24,minutes:ne*24*60,seconds:ne*24*60*60,milliseconds:ne*24*60*60*1e3},quarters:{months:3,weeks:ne/28,days:ne/4,hours:ne*24/4,minutes:ne*24*60/4,seconds:ne*24*60*60/4,milliseconds:ne*24*60*60*1e3/4},months:{weeks:Me/7,days:Me,hours:Me*24,minutes:Me*24*60,seconds:Me*24*60*60,milliseconds:Me*24*60*60*1e3},...Yi},Re=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],gl=Re.slice(0).reverse();function de(t,e,n=!1){const r={values:n?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new C(r)}function Zi(t,e){let n=e.milliseconds??0;for(const r of gl.slice(1))e[r]&&(n+=e[r]*t[r].milliseconds);return n}function yr(t,e){const n=Zi(t,e)<0?-1:1;Re.reduceRight((r,i)=>{if(b(e[i]))return r;if(r){const s=e[r]*n,o=t[i][r],a=Math.floor(s/o);e[i]+=a*n,e[r]-=a*o*n}return i},null),Re.reduce((r,i)=>{if(b(e[i]))return r;if(r){const s=e[r]%1;e[r]-=s,e[i]+=s*t[r][i]}return i},null)}function gr(t){const e={};for(const[n,r]of Object.entries(t))r!==0&&(e[n]=r);return e}class C{constructor(e){const n=e.conversionAccuracy==="longterm"||!1;let r=n?yl:pl;e.matrix&&(r=e.matrix),this.values=e.values,this.loc=e.loc||v.create(),this.conversionAccuracy=n?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=r,this.isLuxonDuration=!0}static fromMillis(e,n){return C.fromObject({milliseconds:e},n)}static fromObject(e,n={}){if(e==null||typeof e!="object")throw new q(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new C({values:It(e,C.normalizeUnit),loc:v.fromObject(n),conversionAccuracy:n.conversionAccuracy,matrix:n.matrix})}static fromDurationLike(e){if(Se(e))return C.fromMillis(e);if(C.isDuration(e))return e;if(typeof e=="object")return C.fromObject(e);throw new q(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,n){const[r]=ll(e);return r?C.fromObject(r,n):C.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,n){const[r]=ul(e);return r?C.fromObject(r,n):C.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,n=null){if(!e)throw new q("need to specify a reason the Duration is invalid");const r=e instanceof ae?e:new ae(e,n);if(P.throwOnInvalid)throw new Bo(r);return new C({invalid:r})}static normalizeUnit(e){const n={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(!n)throw new ti(e);return n}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,n={}){const r={...n,floor:n.round!==!1&&n.floor!==!1};return this.isValid?Y.create(this.loc,r).formatDurationFromString(this,e):pr}toHuman(e={}){if(!this.isValid)return pr;const n=e.showZeros!==!1,r=Re.map(i=>{const s=this.values[i];return b(s)||s===0&&!n?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+=In(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const n=this.toMillis();return n<0||n>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},N.fromMillis(n,{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?Zi(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const n=C.fromDurationLike(e),r={};for(const i of Re)(Ue(n.values,i)||Ue(this.values,i))&&(r[i]=n.get(i)+this.get(i));return de(this,{values:r},!0)}minus(e){if(!this.isValid)return this;const n=C.fromDurationLike(e);return this.plus(n.negate())}mapUnits(e){if(!this.isValid)return this;const n={};for(const r of Object.keys(this.values))n[r]=zi(e(this.values[r],r));return de(this,{values:n},!0)}get(e){return this[C.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const n={...this.values,...It(e,C.normalizeUnit)};return de(this,{values:n})}reconfigure({locale:e,numberingSystem:n,conversionAccuracy:r,matrix:i}={}){const o={loc:this.loc.clone({locale:e,numberingSystem:n}),matrix:i,conversionAccuracy:r};return de(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return yr(this.matrix,e),de(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=gr(this.normalize().shiftToAll().toObject());return de(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>C.normalizeUnit(o));const n={},r={},i=this.toObject();let s;for(const o of Re)if(e.indexOf(o)>=0){s=o;let a=0;for(const c in r)a+=this.matrix[c][o]*r[c],r[c]=0;Se(i[o])&&(a+=i[o]);const l=Math.trunc(a);n[o]=l,r[o]=(a*1e3-l*1e3)/1e3}else Se(i[o])&&(r[o]=i[o]);for(const o in r)r[o]!==0&&(n[s]+=o===s?r[o]:r[o]/this.matrix[s][o]);return yr(this.matrix,n),de(this,{values:n},!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 n of Object.keys(this.values))e[n]=this.values[n]===0?0:-this.values[n];return de(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;const e=gr(this.values);return de(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 n(r,i){return r===void 0||r===0?i===void 0||i===0:r===i}for(const r of Re)if(!n(this.values[r],e.values[r]))return!1;return!0}}const xe="Invalid Interval";function El(t,e){return!t||!t.isValid?D.invalid("missing or invalid start"):!e||!e.isValid?D.invalid("missing or invalid end"):e<t?D.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null}class D{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,n=null){if(!e)throw new q("need to specify a reason the Interval is invalid");const r=e instanceof ae?e:new ae(e,n);if(P.throwOnInvalid)throw new $o(r);return new D({invalid:r})}static fromDateTimes(e,n){const r=Ze(e),i=Ze(n),s=El(r,i);return s??new D({start:r,end:i})}static after(e,n){const r=C.fromDurationLike(n),i=Ze(e);return D.fromDateTimes(i,i.plus(r))}static before(e,n){const r=C.fromDurationLike(n),i=Ze(e);return D.fromDateTimes(i.minus(r),i)}static fromISO(e,n){const[r,i]=(e||"").split("/",2);if(r&&i){let s,o;try{s=N.fromISO(r,n),o=s.isValid}catch{o=!1}let a,l;try{a=N.fromISO(i,n),l=a.isValid}catch{l=!1}if(o&&l)return D.fromDateTimes(s,a);if(o){const c=C.fromISO(i,n);if(c.isValid)return D.after(s,c)}else if(l){const c=C.fromISO(r,n);if(c.isValid)return D.before(a,c)}}return D.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",n){if(!this.isValid)return NaN;const r=this.start.startOf(e,n);let i;return n?.useLocaleWeeks?i=this.end.reconfigure({locale:r.locale}):i=this.end,i=i.startOf(e,n),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:n}={}){return this.isValid?D.fromDateTimes(e||this.s,n||this.e):this}splitAt(...e){if(!this.isValid)return[];const n=e.map(Ze).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=n[s]||this.e,a=+o>+this.e?this.e:o;r.push(D.fromDateTimes(i,a)),i=a,s+=1}return r}splitBy(e){const n=C.fromDurationLike(e);if(!this.isValid||!n.isValid||n.as("milliseconds")===0)return[];let{s:r}=this,i=1,s;const o=[];for(;r<this.e;){const a=this.start.plus(n.mapUnits(l=>l*i));s=+a>+this.e?this.e:a,o.push(D.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 n=this.s>e.s?this.s:e.s,r=this.e<e.e?this.e:e.e;return n>=r?null:D.fromDateTimes(n,r)}union(e){if(!this.isValid)return this;const n=this.s<e.s?this.s:e.s,r=this.e>e.e?this.e:e.e;return D.fromDateTimes(n,r)}static merge(e){const[n,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&&n.push(r),n}static xor(e){let n=null,r=0;const i=[],s=e.map(l=>[{time:l.s,type:"s"},{time:l.e,type:"e"}]),o=Array.prototype.concat(...s),a=o.sort((l,c)=>l.time-c.time);for(const l of a)r+=l.type==="s"?1:-1,r===1?n=l.time:(n&&+n!=+l.time&&i.push(D.fromDateTimes(n,l.time)),n=null);return D.merge(i)}difference(...e){return D.xor([this].concat(e)).map(n=>this.intersection(n)).filter(n=>n&&!n.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:xe}[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=Ct,n={}){return this.isValid?Y.create(this.s.loc.clone(n),e).formatInterval(this):xe}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:xe}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:xe}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:xe}toFormat(e,{separator:n=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${n}${this.e.toFormat(e)}`:xe}toDuration(e,n){return this.isValid?this.e.diff(this.s,e,n):C.invalid(this.invalidReason)}mapEndpoints(e){return D.fromDateTimes(e(this.s),e(this.e))}}class mt{static hasDST(e=P.defaultZone){const n=N.now().setZone(e).set({month:12});return!e.isUniversal&&n.offset!==n.set({month:6}).offset}static isValidIANAZone(e){return he.isValidZone(e)}static normalizeZone(e){return Te(e,P.defaultZone)}static getStartOfWeek({locale:e=null,locObj:n=null}={}){return(n||v.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:n=null}={}){return(n||v.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:n=null}={}){return(n||v.create(e)).getWeekendDays().slice()}static months(e="long",{locale:n=null,numberingSystem:r=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||v.create(n,r,s)).months(e)}static monthsFormat(e="long",{locale:n=null,numberingSystem:r=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||v.create(n,r,s)).months(e,!0)}static weekdays(e="long",{locale:n=null,numberingSystem:r=null,locObj:i=null}={}){return(i||v.create(n,r,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:n=null,numberingSystem:r=null,locObj:i=null}={}){return(i||v.create(n,r,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return v.create(e).meridiems()}static eras(e="short",{locale:n=null}={}){return v.create(n,null,"gregory").eras(e)}static features(){return{relative:vi(),localeWeek:ki()}}}function Er(t,e){const n=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=n(e)-n(t);return Math.floor(C.fromMillis(r).as("days"))}function wl(t,e,n){const r=[["years",(l,c)=>c.year-l.year],["quarters",(l,c)=>c.quarter-l.quarter+(c.year-l.year)*4],["months",(l,c)=>c.month-l.month+(c.year-l.year)*12],["weeks",(l,c)=>{const u=Er(l,c);return(u-u%7)/7}],["days",Er]],i={},s=t;let o,a;for(const[l,c]of r)n.indexOf(l)>=0&&(o=l,i[l]=c(t,e),a=s.plus(i),a>e?(i[l]--,t=s.plus(i),t>e&&(a=t,i[l]--,t=s.plus(i))):t=a);return[t,i,a,o]}function Tl(t,e,n,r){let[i,s,o,a]=wl(t,e,n);const l=e-i,c=n.filter(f=>["hours","minutes","seconds","milliseconds"].indexOf(f)>=0);c.length===0&&(o<e&&(o=i.plus({[a]:1})),o!==i&&(s[a]=(s[a]||0)+l/(o-i)));const u=C.fromObject(s,r);return c.length>0?C.fromMillis(l,r).shiftTo(...c).plus(u):u}const Sl="missing Intl.DateTimeFormat.formatToParts support";function I(t,e=n=>n){return{regex:t,deser:([n])=>e(fa(n))}}const Nl=" ",ji=`[ ${Nl}]`,Gi=new RegExp(ji,"g");function Ol(t){return t.replace(/\./g,"\\.?").replace(Gi,ji)}function wr(t){return t.replace(/\./g,"").replace(Gi," ").toLowerCase()}function oe(t,e){return t===null?null:{regex:RegExp(t.map(Ol).join("|")),deser:([n])=>t.findIndex(r=>wr(n)===wr(r))+e}}function Tr(t,e){return{regex:t,deser:([,n,r])=>Lt(n,r),groups:e}}function pt(t){return{regex:t,deser:([e])=>e}}function bl(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Cl(t,e){const n=se(e),r=se(e,"{2}"),i=se(e,"{3}"),s=se(e,"{4}"),o=se(e,"{6}"),a=se(e,"{1,2}"),l=se(e,"{1,3}"),c=se(e,"{1,6}"),u=se(e,"{1,9}"),f=se(e,"{2,4}"),p=se(e,"{4,6}"),E=h=>({regex:RegExp(bl(h.val)),deser:([S])=>S,literal:!0}),g=(h=>{if(t.literal)return E(h);switch(h.val){case"G":return oe(e.eras("short"),0);case"GG":return oe(e.eras("long"),0);case"y":return I(c);case"yy":return I(f,pn);case"yyyy":return I(s);case"yyyyy":return I(p);case"yyyyyy":return I(o);case"M":return I(a);case"MM":return I(r);case"MMM":return oe(e.months("short",!0),1);case"MMMM":return oe(e.months("long",!0),1);case"L":return I(a);case"LL":return I(r);case"LLL":return oe(e.months("short",!1),1);case"LLLL":return oe(e.months("long",!1),1);case"d":return I(a);case"dd":return I(r);case"o":return I(l);case"ooo":return I(i);case"HH":return I(r);case"H":return I(a);case"hh":return I(r);case"h":return I(a);case"mm":return I(r);case"m":return I(a);case"q":return I(a);case"qq":return I(r);case"s":return I(a);case"ss":return I(r);case"S":return I(l);case"SSS":return I(i);case"u":return pt(u);case"uu":return pt(a);case"uuu":return I(n);case"a":return oe(e.meridiems(),0);case"kkkk":return I(s);case"kk":return I(f,pn);case"W":return I(a);case"WW":return I(r);case"E":case"c":return I(n);case"EEE":return oe(e.weekdays("short",!1),1);case"EEEE":return oe(e.weekdays("long",!1),1);case"ccc":return oe(e.weekdays("short",!0),1);case"cccc":return oe(e.weekdays("long",!0),1);case"Z":case"ZZ":return Tr(new RegExp(`([+-]${a.source})(?::(${r.source}))?`),2);case"ZZZ":return Tr(new RegExp(`([+-]${a.source})(${r.source})?`),2);case"z":return pt(/[a-z_+-/]{1,256}?/i);case" ":return pt(/[^\S\n\r]/);default:return E(h)}})(t)||{invalidReason:Sl};return g.token=t,g}const Al={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 Rl(t,e,n){const{type:r,value:i}=t;if(r==="literal"){const l=/^\s+$/.test(i);return{literal:!l,val:l?" ":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=n.hour12?"hour12":"hour24");let a=Al[o];if(typeof a=="object"&&(a=a[s]),a)return{literal:!1,val:a}}function Il(t){return[`^${t.map(n=>n.regex).reduce((n,r)=>`${n}(${r.source})`,"")}$`,t]}function vl(t,e,n){const r=t.match(e);if(r){const i={};let s=1;for(const o in n)if(Ue(n,o)){const a=n[o],l=a.groups?a.groups+1:1;!a.literal&&a.token&&(i[a.token.val[0]]=a.deser(r.slice(s,s+l))),s+=l}return[r,i]}else return[r,{}]}function kl(t){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 n=null,r;return b(t.z)||(n=he.create(t.z)),b(t.Z)||(n||(n=new G(t.Z)),r=t.Z),b(t.q)||(t.M=(t.q-1)*3+1),b(t.h)||(t.h<12&&t.a===1?t.h+=12:t.h===12&&t.a===0&&(t.h=0)),t.G===0&&t.y&&(t.y=-t.y),b(t.u)||(t.S=Rn(t.u)),[Object.keys(t).reduce((s,o)=>{const a=e(o);return a&&(s[a]=t[o]),s},{}),n,r]}let Gt=null;function Fl(){return Gt||(Gt=N.fromMillis(1555555555555)),Gt}function zl(t,e){if(t.literal)return t;const n=Y.macroTokenToFormatOpts(t.val),r=Qi(n,e);return r==null||r.includes(void 0)?t:r}function Xi(t,e){return Array.prototype.concat(...t.map(n=>zl(n,e)))}class Ji{constructor(e,n){if(this.locale=e,this.format=n,this.tokens=Xi(Y.parseFormat(n),e),this.units=this.tokens.map(r=>Cl(r,e)),this.disqualifyingUnit=this.units.find(r=>r.invalidReason),!this.disqualifyingUnit){const[r,i]=Il(this.units);this.regex=RegExp(r,"i"),this.handlers=i}}explainFromTokens(e){if(this.isValid){const[n,r]=vl(e,this.regex,this.handlers),[i,s,o]=r?kl(r):[null,null,void 0];if(Ue(r,"a")&&Ue(r,"H"))throw new De("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:n,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 Ki(t,e,n){return new Ji(t,n).explainFromTokens(e)}function Ml(t,e,n){const{result:r,zone:i,specificOffset:s,invalidReason:o}=Ki(t,e,n);return[r,i,s,o]}function Qi(t,e){if(!t)return null;const r=Y.create(e,t).dtFormatter(Fl()),i=r.formatToParts(),s=r.resolvedOptions();return i.map(o=>Rl(o,t,s))}const Xt="Invalid DateTime",Sr=864e13;function Je(t){return new ae("unsupported zone",`the zone "${t.name}" is not supported`)}function Jt(t){return t.weekData===null&&(t.weekData=At(t.c)),t.weekData}function Kt(t){return t.localWeekData===null&&(t.localWeekData=At(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function be(t,e){const n={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new N({...n,...e,old:n})}function es(t,e,n){let r=t-e*60*1e3;const i=n.offset(r);if(e===i)return[r,e];r-=(i-e)*60*1e3;const s=n.offset(r);return i===s?[r,i]:[t-Math.min(i,s)*60*1e3,Math.max(i,s)]}function yt(t,e){t+=e*60*1e3;const n=new Date(t);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds()}}function St(t,e,n){return es(Pt(t),e,n)}function Nr(t,e){const n=t.o,r=t.c.year+Math.trunc(e.years),i=t.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,s={...t.c,year:r,month:i,day:Math.min(t.c.day,Rt(r,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=C.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=Pt(s);let[l,c]=es(a,n,t.zone);return o!==0&&(l+=o,c=t.zone.offset(l)),{ts:l,o:c}}function _e(t,e,n,r,i,s){const{setZone:o,zone:a}=n;if(t&&Object.keys(t).length!==0||e){const l=e||a,c=N.fromObject(t,{...n,zone:l,specificOffset:s});return o?c:c.setZone(a)}else return N.invalid(new ae("unparsable",`the input "${i}" can't be parsed as ${r}`))}function gt(t,e,n=!0){return t.isValid?Y.create(v.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(t,e):null}function Qt(t,e,n){const r=t.c.year>9999||t.c.year<0;let i="";if(r&&t.c.year>=0&&(i+="+"),i+=H(t.c.year,r?6:4),n==="year")return i;if(e){if(i+="-",i+=H(t.c.month),n==="month")return i;i+="-"}else if(i+=H(t.c.month),n==="month")return i;return i+=H(t.c.day),i}function Or(t,e,n,r,i,s,o){let a=!n||t.c.millisecond!==0||t.c.second!==0,l="";switch(o){case"day":case"month":case"year":break;default:if(l+=H(t.c.hour),o==="hour")break;if(e){if(l+=":",l+=H(t.c.minute),o==="minute")break;a&&(l+=":",l+=H(t.c.second))}else{if(l+=H(t.c.minute),o==="minute")break;a&&(l+=H(t.c.second))}if(o==="second")break;a&&(!r||t.c.millisecond!==0)&&(l+=".",l+=H(t.c.millisecond,3))}return i&&(t.isOffsetFixed&&t.offset===0&&!s?l+="Z":t.o<0?(l+="-",l+=H(Math.trunc(-t.o/60)),l+=":",l+=H(Math.trunc(-t.o%60))):(l+="+",l+=H(Math.trunc(t.o/60)),l+=":",l+=H(Math.trunc(t.o%60)))),s&&(l+="["+t.zone.ianaName+"]"),l}const ts={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},xl={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},_l={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Nt=["year","month","day","hour","minute","second","millisecond"],Dl=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Pl=["year","ordinal","hour","minute","second","millisecond"];function Ot(t){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"}[t.toLowerCase()];if(!e)throw new ti(t);return e}function br(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Ot(t)}}function Ll(t){if(Ke===void 0&&(Ke=P.now()),t.type!=="iana")return t.offset(Ke);const e=t.name;let n=yn.get(e);return n===void 0&&(n=t.offset(Ke),yn.set(e,n)),n}function Cr(t,e){const n=Te(e.zone,P.defaultZone);if(!n.isValid)return N.invalid(Je(n));const r=v.fromObject(e);let i,s;if(b(t.year))i=P.now();else{for(const l of Nt)b(t[l])&&(t[l]=ts[l]);const o=Ri(t)||Ii(t);if(o)return N.invalid(o);const a=Ll(n);[i,s]=St(t,a,n)}return new N({ts:i,zone:n,loc:r,o:s})}function Ar(t,e,n){const r=b(n.round)?!0:n.round,i=b(n.rounding)?"trunc":n.rounding,s=(a,l)=>(a=In(a,r||n.calendary?0:2,n.calendary?"round":i),e.loc.clone(n).relFormatter(n).format(a,l)),o=a=>n.calendary?e.hasSame(t,a)?0:e.startOf(a).diff(t.startOf(a),a).get(a):e.diff(t,a).get(a);if(n.unit)return s(o(n.unit),n.unit);for(const a of n.units){const l=o(a);if(Math.abs(l)>=1)return s(l,a)}return s(t>e?-0:0,n.units[n.units.length-1])}function Rr(t){let e={},n;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],n=Array.from(t).slice(0,t.length-1)):n=Array.from(t),[e,n]}let Ke;const yn=new Map;class N{constructor(e){const n=e.zone||P.defaultZone;let r=e.invalid||(Number.isNaN(e.ts)?new ae("invalid input"):null)||(n.isValid?null:Je(n));this.ts=b(e.ts)?P.now():e.ts;let i=null,s=null;if(!r)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(n))[i,s]=[e.old.c,e.old.o];else{const a=Se(e.o)&&!e.old?e.o:n.offset(this.ts);i=yt(this.ts,a),r=Number.isNaN(i.year)?new ae("invalid input"):null,i=r?null:i,s=r?null:a}this._zone=n,this.loc=e.loc||v.create(),this.invalid=r,this.weekData=null,this.localWeekData=null,this.c=i,this.o=s,this.isLuxonDateTime=!0}static now(){return new N({})}static local(){const[e,n]=Rr(arguments),[r,i,s,o,a,l,c]=n;return Cr({year:r,month:i,day:s,hour:o,minute:a,second:l,millisecond:c},e)}static utc(){const[e,n]=Rr(arguments),[r,i,s,o,a,l,c]=n;return e.zone=G.utcInstance,Cr({year:r,month:i,day:s,hour:o,minute:a,second:l,millisecond:c},e)}static fromJSDate(e,n={}){const r=ya(e)?e.valueOf():NaN;if(Number.isNaN(r))return N.invalid("invalid input");const i=Te(n.zone,P.defaultZone);return i.isValid?new N({ts:r,zone:i,loc:v.fromObject(n)}):N.invalid(Je(i))}static fromMillis(e,n={}){if(Se(e))return e<-Sr||e>Sr?N.invalid("Timestamp out of range"):new N({ts:e,zone:Te(n.zone,P.defaultZone),loc:v.fromObject(n)});throw new q(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,n={}){if(Se(e))return new N({ts:e*1e3,zone:Te(n.zone,P.defaultZone),loc:v.fromObject(n)});throw new q("fromSeconds requires a numerical input")}static fromObject(e,n={}){e=e||{};const r=Te(n.zone,P.defaultZone);if(!r.isValid)return N.invalid(Je(r));const i=v.fromObject(n),s=It(e,br),{minDaysInFirstWeek:o,startOfWeek:a}=ur(s,i),l=P.now(),c=b(n.specificOffset)?r.offset(l):n.specificOffset,u=!b(s.ordinal),f=!b(s.year),p=!b(s.month)||!b(s.day),E=f||p,m=s.weekYear||s.weekNumber;if((E||u)&&m)throw new De("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(p&&u)throw new De("Can't mix ordinal dates with month/day");const g=m||s.weekday&&!E;let h,S,z=yt(l,c);g?(h=Dl,S=xl,z=At(z,o,a)):u?(h=Pl,S=_l,z=jt(z)):(h=Nt,S=ts);let M=!1;for(const ue of h){const Ne=s[ue];b(Ne)?M?s[ue]=S[ue]:s[ue]=z[ue]:M=!0}const _=g?ha(s,o,a):u?ma(s):Ri(s),x=_||Ii(s);if(x)return N.invalid(x);const Z=g?lr(s,o,a):u?cr(s):s,[L,me]=St(Z,c,r),Q=new N({ts:L,zone:r,o:me,loc:i});return s.weekday&&E&&e.weekday!==Q.weekday?N.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${Q.toISO()}`):Q.isValid?Q:N.invalid(Q.invalid)}static fromISO(e,n={}){const[r,i]=sl(e);return _e(r,i,n,"ISO 8601",e)}static fromRFC2822(e,n={}){const[r,i]=ol(e);return _e(r,i,n,"RFC 2822",e)}static fromHTTP(e,n={}){const[r,i]=al(e);return _e(r,i,n,"HTTP",n)}static fromFormat(e,n,r={}){if(b(e)||b(n))throw new q("fromFormat requires an input string and a format");const{locale:i=null,numberingSystem:s=null}=r,o=v.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0}),[a,l,c,u]=Ml(o,e,n);return u?N.invalid(u):_e(a,l,r,`format ${n}`,e,c)}static fromString(e,n,r={}){return N.fromFormat(e,n,r)}static fromSQL(e,n={}){const[r,i]=ml(e);return _e(r,i,n,"SQL",e)}static invalid(e,n=null){if(!e)throw new q("need to specify a reason the DateTime is invalid");const r=e instanceof ae?e:new ae(e,n);if(P.throwOnInvalid)throw new Ho(r);return new N({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,n={}){const r=Qi(e,v.fromObject(n));return r?r.map(i=>i?i.val:null).join(""):null}static expandFormat(e,n={}){return Xi(Y.parseFormat(e),v.fromObject(n)).map(i=>i.val).join("")}static resetCache(){Ke=void 0,yn.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?Kt(this).weekday:NaN}get localWeekNumber(){return this.isValid?Kt(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Kt(this).weekYear:NaN}get ordinal(){return this.isValid?jt(this.c).ordinal:NaN}get monthShort(){return this.isValid?mt.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?mt.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?mt.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?mt.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,n=6e4,r=Pt(this.c),i=this.zone.offset(r-e),s=this.zone.offset(r+e),o=this.zone.offset(r-i*n),a=this.zone.offset(r-s*n);if(o===a)return[this];const l=r-o*n,c=r-a*n,u=yt(l,o),f=yt(c,a);return u.hour===f.hour&&u.minute===f.minute&&u.second===f.second&&u.millisecond===f.millisecond?[be(this,{ts:l}),be(this,{ts:c})]:[this]}get isInLeapYear(){return at(this.year)}get daysInMonth(){return Rt(this.year,this.month)}get daysInYear(){return this.isValid?Pe(this.year):NaN}get weeksInWeekYear(){return this.isValid?et(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?et(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:n,numberingSystem:r,calendar:i}=Y.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:n,numberingSystem:r,outputCalendar:i}}toUTC(e=0,n={}){return this.setZone(G.instance(e),n)}toLocal(){return this.setZone(P.defaultZone)}setZone(e,{keepLocalTime:n=!1,keepCalendarTime:r=!1}={}){if(e=Te(e,P.defaultZone),e.equals(this.zone))return this;if(e.isValid){let i=this.ts;if(n||r){const s=e.offset(this.ts),o=this.toObject();[i]=St(o,s,e)}return be(this,{ts:i,zone:e})}else return N.invalid(Je(e))}reconfigure({locale:e,numberingSystem:n,outputCalendar:r}={}){const i=this.loc.clone({locale:e,numberingSystem:n,outputCalendar:r});return be(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const n=It(e,br),{minDaysInFirstWeek:r,startOfWeek:i}=ur(n,this.loc),s=!b(n.weekYear)||!b(n.weekNumber)||!b(n.weekday),o=!b(n.ordinal),a=!b(n.year),l=!b(n.month)||!b(n.day),c=a||l,u=n.weekYear||n.weekNumber;if((c||o)&&u)throw new De("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(l&&o)throw new De("Can't mix ordinal dates with month/day");let f;s?f=lr({...At(this.c,r,i),...n},r,i):b(n.ordinal)?(f={...this.toObject(),...n},b(n.day)&&(f.day=Math.min(Rt(f.year,f.month),f.day))):f=cr({...jt(this.c),...n});const[p,E]=St(f,this.o,this.zone);return be(this,{ts:p,o:E})}plus(e){if(!this.isValid)return this;const n=C.fromDurationLike(e);return be(this,Nr(this,n))}minus(e){if(!this.isValid)return this;const n=C.fromDurationLike(e).negate();return be(this,Nr(this,n))}startOf(e,{useLocaleWeeks:n=!1}={}){if(!this.isValid)return this;const r={},i=C.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(n){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,n){return this.isValid?this.plus({[e]:1}).startOf(e,n).minus(1):this}toFormat(e,n={}){return this.isValid?Y.create(this.loc.redefaultToEN(n)).formatDateTimeFromString(this,e):Xt}toLocaleString(e=Ct,n={}){return this.isValid?Y.create(this.loc.clone(n),e).formatDateTime(this):Xt}toLocaleParts(e={}){return this.isValid?Y.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:n=!1,suppressMilliseconds:r=!1,includeOffset:i=!0,extendedZone:s=!1,precision:o="milliseconds"}={}){if(!this.isValid)return null;o=Ot(o);const a=e==="extended";let l=Qt(this,a,o);return Nt.indexOf(o)>=3&&(l+="T"),l+=Or(this,a,n,r,i,s,o),l}toISODate({format:e="extended",precision:n="day"}={}){return this.isValid?Qt(this,e==="extended",Ot(n)):null}toISOWeekDate(){return gt(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:n=!1,includeOffset:r=!0,includePrefix:i=!1,extendedZone:s=!1,format:o="extended",precision:a="milliseconds"}={}){return this.isValid?(a=Ot(a),(i&&Nt.indexOf(a)>=3?"T":"")+Or(this,o==="extended",n,e,r,s,a)):null}toRFC2822(){return gt(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return gt(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Qt(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:n=!1,includeOffsetSpace:r=!0}={}){let i="HH:mm:ss.SSS";return(n||e)&&(r&&(i+=" "),n?i+="z":e&&(i+="ZZ")),gt(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Xt}[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 n={...this.c};return e.includeConfig&&(n.outputCalendar=this.outputCalendar,n.numberingSystem=this.loc.numberingSystem,n.locale=this.loc.locale),n}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,n="milliseconds",r={}){if(!this.isValid||!e.isValid)return C.invalid("created by diffing an invalid DateTime");const i={locale:this.locale,numberingSystem:this.numberingSystem,...r},s=ga(n).map(C.normalizeUnit),o=e.valueOf()>this.valueOf(),a=o?this:e,l=o?e:this,c=Tl(a,l,s,i);return o?c.negate():c}diffNow(e="milliseconds",n={}){return this.diff(N.now(),e,n)}until(e){return this.isValid?D.fromDateTimes(this,e):this}hasSame(e,n,r){if(!this.isValid)return!1;const i=e.valueOf(),s=this.setZone(e.zone,{keepLocalTime:!0});return s.startOf(n,r)<=i&&i<=s.endOf(n,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 n=e.base||N.fromObject({},{zone:this.zone}),r=e.padding?this<n?-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),Ar(n,this.plus(r),{...e,numeric:"always",units:i,unit:s})}toRelativeCalendar(e={}){return this.isValid?Ar(e.base||N.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(N.isDateTime))throw new q("min requires all arguments be DateTimes");return fr(e,n=>n.valueOf(),Math.min)}static max(...e){if(!e.every(N.isDateTime))throw new q("max requires all arguments be DateTimes");return fr(e,n=>n.valueOf(),Math.max)}static fromFormatExplain(e,n,r={}){const{locale:i=null,numberingSystem:s=null}=r,o=v.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});return Ki(o,e,n)}static fromStringExplain(e,n,r={}){return N.fromFormatExplain(e,n,r)}static buildFormatParser(e,n={}){const{locale:r=null,numberingSystem:i=null}=n,s=v.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});return new Ji(s,e)}static fromFormatParser(e,n,r={}){if(b(e)||b(n))throw new q("fromFormatParser requires an input string and a format parser");const{locale:i=null,numberingSystem:s=null}=r,o=v.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});if(!o.equals(n.locale))throw new q(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${n.locale}`);const{result:a,zone:l,specificOffset:c,invalidReason:u}=n.explainFromTokens(e);return u?N.invalid(u):_e(a,l,r,`format ${n.format}`,e,c)}static get DATE_SHORT(){return Ct}static get DATE_MED(){return ni}static get DATE_MED_WITH_WEEKDAY(){return qo}static get DATE_FULL(){return ri}static get DATE_HUGE(){return ii}static get TIME_SIMPLE(){return si}static get TIME_WITH_SECONDS(){return oi}static get TIME_WITH_SHORT_OFFSET(){return ai}static get TIME_WITH_LONG_OFFSET(){return li}static get TIME_24_SIMPLE(){return ci}static get TIME_24_WITH_SECONDS(){return ui}static get TIME_24_WITH_SHORT_OFFSET(){return fi}static get TIME_24_WITH_LONG_OFFSET(){return di}static get DATETIME_SHORT(){return hi}static get DATETIME_SHORT_WITH_SECONDS(){return mi}static get DATETIME_MED(){return pi}static get DATETIME_MED_WITH_SECONDS(){return yi}static get DATETIME_MED_WITH_WEEKDAY(){return Wo}static get DATETIME_FULL(){return gi}static get DATETIME_FULL_WITH_SECONDS(){return Ei}static get DATETIME_HUGE(){return wi}static get DATETIME_HUGE_WITH_SECONDS(){return Ti}}function Ze(t){if(N.isDateTime(t))return t;if(t&&t.valueOf&&Se(t.valueOf()))return N.fromJSDate(t);if(t&&typeof t=="object")return N.fromObject(t);throw new q(`Unknown datetime argument: ${t}, of type ${typeof t}`)}const Vl=["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 $(t){if(!t)return null;const e=t.trim();if(!e)return null;const n=N.fromISO(e);if(n.isValid)return n;for(const s of Vl){const o=N.fromFormat(e,s);if(o.isValid)return o}const r=N.fromRFC2822(e);if(r.isValid)return r;const i=N.fromHTTP(e);return i.isValid?i:null}const ns=":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",Ul=ns+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Hl="["+ns+"]["+Ul+"]*",$l=new RegExp("^"+Hl+"$");function rs(t,e){const n=[];let r=e.exec(t);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]);n.push(i),r=e.exec(t)}return n}const Ut=function(t){const e=$l.exec(t);return!(e===null||typeof e>"u")};function Bl(t){return typeof t<"u"}const ql={allowBooleanAttributes:!1,unpairedTags:[]};function Wl(t,e){e=Object.assign({},ql,e);const n=[];let r=!1,i=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let s=0;s<t.length;s++)if(t[s]==="<"&&t[s+1]==="?"){if(s+=2,s=vr(t,s),s.err)return s}else if(t[s]==="<"){let o=s;if(s++,t[s]==="!"){s=kr(t,s);continue}else{let a=!1;t[s]==="/"&&(a=!0,s++);let l="";for(;s<t.length&&t[s]!==">"&&t[s]!==" "&&t[s]!==" "&&t[s]!==`
8
+ `&&t[s]!=="\r";s++)l+=t[s];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),s--),!Ql(l)){let f;return l.trim().length===0?f="Invalid space after '<'.":f="Tag '"+l+"' is an invalid name.",V("InvalidTag",f,j(t,s))}const c=jl(t,s);if(c===!1)return V("InvalidAttr","Attributes for '"+l+"' have open quote.",j(t,s));let u=c.value;if(s=c.index,u[u.length-1]==="/"){const f=s-u.length;u=u.substring(0,u.length-1);const p=Fr(u,e);if(p===!0)r=!0;else return V(p.err.code,p.err.msg,j(t,f+p.err.line))}else if(a)if(c.tagClosed){if(u.trim().length>0)return V("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",j(t,o));if(n.length===0)return V("InvalidTag","Closing tag '"+l+"' has not been opened.",j(t,o));{const f=n.pop();if(l!==f.tagName){let p=j(t,f.tagStartPos);return V("InvalidTag","Expected closing tag '"+f.tagName+"' (opened in line "+p.line+", col "+p.col+") instead of closing tag '"+l+"'.",j(t,o))}n.length==0&&(i=!0)}}else return V("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",j(t,s));else{const f=Fr(u,e);if(f!==!0)return V(f.err.code,f.err.msg,j(t,s-u.length+f.err.line));if(i===!0)return V("InvalidXml","Multiple possible root nodes found.",j(t,s));e.unpairedTags.indexOf(l)!==-1||n.push({tagName:l,tagStartPos:o}),r=!0}for(s++;s<t.length;s++)if(t[s]==="<")if(t[s+1]==="!"){s++,s=kr(t,s);continue}else if(t[s+1]==="?"){if(s=vr(t,++s),s.err)return s}else break;else if(t[s]==="&"){const f=Jl(t,s);if(f==-1)return V("InvalidChar","char '&' is not expected.",j(t,s));s=f}else if(i===!0&&!Ir(t[s]))return V("InvalidXml","Extra text at the end",j(t,s));t[s]==="<"&&s--}}else{if(Ir(t[s]))continue;return V("InvalidChar","char '"+t[s]+"' is not expected.",j(t,s))}if(r){if(n.length==1)return V("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",j(t,n[0].tagStartPos));if(n.length>0)return V("InvalidXml","Invalid '"+JSON.stringify(n.map(s=>s.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return V("InvalidXml","Start tag expected.",1);return!0}function Ir(t){return t===" "||t===" "||t===`
9
+ `||t==="\r"}function vr(t,e){const n=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){const r=t.substr(n,e-n);if(e>5&&r==="xml")return V("InvalidXml","XML declaration allowed only at the start of the document.",j(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function kr(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let n=1;for(e+=8;e<t.length;e++)if(t[e]==="<")n++;else if(t[e]===">"&&(n--,n===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}const Yl='"',Zl="'";function jl(t,e){let n="",r="",i=!1;for(;e<t.length;e++){if(t[e]===Yl||t[e]===Zl)r===""?r=t[e]:r!==t[e]||(r="");else if(t[e]===">"&&r===""){i=!0;break}n+=t[e]}return r!==""?!1:{value:n,index:e,tagClosed:i}}const Gl=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Fr(t,e){const n=rs(t,Gl),r={};for(let i=0;i<n.length;i++){if(n[i][1].length===0)return V("InvalidAttr","Attribute '"+n[i][2]+"' has no space in starting.",je(n[i]));if(n[i][3]!==void 0&&n[i][4]===void 0)return V("InvalidAttr","Attribute '"+n[i][2]+"' is without value.",je(n[i]));if(n[i][3]===void 0&&!e.allowBooleanAttributes)return V("InvalidAttr","boolean attribute '"+n[i][2]+"' is not allowed.",je(n[i]));const s=n[i][2];if(!Kl(s))return V("InvalidAttr","Attribute '"+s+"' is an invalid name.",je(n[i]));if(!Object.prototype.hasOwnProperty.call(r,s))r[s]=1;else return V("InvalidAttr","Attribute '"+s+"' is repeated.",je(n[i]))}return!0}function Xl(t,e){let n=/\d/;for(t[e]==="x"&&(e++,n=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(n))break}return-1}function Jl(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,Xl(t,e);let n=0;for(;e<t.length;e++,n++)if(!(t[e].match(/\w/)&&n<20)){if(t[e]===";")break;return-1}return e}function V(t,e,n){return{err:{code:t,msg:e,line:n.line||n,col:n.col}}}function Kl(t){return Ut(t)}function Ql(t){return Ut(t)}function j(t,e){const n=t.substring(0,e).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function je(t){return t.startIndex+t[1].length}const ec={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(t,e){return e},attributeValueProcessor:function(t,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(t,e,n){return t},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0};function is(t){return typeof t=="boolean"?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,allowedTags:null,tagFilter:null}:typeof t=="object"&&t!==null?{enabled:t.enabled!==!1,maxEntitySize:t.maxEntitySize??1e4,maxExpansionDepth:t.maxExpansionDepth??10,maxTotalExpansions:t.maxTotalExpansions??1e3,maxExpandedLength:t.maxExpandedLength??1e5,allowedTags:t.allowedTags??null,tagFilter:t.tagFilter??null}:is(!0)}const tc=function(t){const e=Object.assign({},ec,t);return e.processEntities=is(e.processEntities),e};let vt;typeof Symbol!="function"?vt="@@xmlMetadata":vt=Symbol("XML Node Metadata");class we{constructor(e){this.tagname=e,this.child=[],this[":@"]=Object.create(null)}add(e,n){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:n})}addChild(e,n){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}),n!==void 0&&(this.child[this.child.length-1][vt]={startIndex:n})}static getMetaDataSymbol(){return vt}}class nc{constructor(e){this.suppressValidationErr=!e,this.options=e}readDocType(e,n){const r=Object.create(null);if(e[n+3]==="O"&&e[n+4]==="C"&&e[n+5]==="T"&&e[n+6]==="Y"&&e[n+7]==="P"&&e[n+8]==="E"){n=n+9;let i=1,s=!1,o=!1,a="";for(;n<e.length;n++)if(e[n]==="<"&&!o){if(s&&Ce(e,"!ENTITY",n)){n+=7;let l,c;if([l,c,n]=this.readEntityExp(e,n+1,this.suppressValidationErr),c.indexOf("&")===-1){const u=l.replace(/[.\-+*:]/g,"\\.");r[l]={regx:RegExp(`&${u};`,"g"),val:c}}}else if(s&&Ce(e,"!ELEMENT",n)){n+=8;const{index:l}=this.readElementExp(e,n+1);n=l}else if(s&&Ce(e,"!ATTLIST",n))n+=8;else if(s&&Ce(e,"!NOTATION",n)){n+=9;const{index:l}=this.readNotationExp(e,n+1,this.suppressValidationErr);n=l}else if(Ce(e,"!--",n))o=!0;else throw new Error("Invalid DOCTYPE");i++,a=""}else if(e[n]===">"){if(o?e[n-1]==="-"&&e[n-2]==="-"&&(o=!1,i--):i--,i===0)break}else e[n]==="["?s=!0:a+=e[n];if(i!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:n}}readEntityExp(e,n){n=X(e,n);let r="";for(;n<e.length&&!/\s/.test(e[n])&&e[n]!=='"'&&e[n]!=="'";)r+=e[n],n++;if(Ge(r),n=X(e,n),!this.suppressValidationErr){if(e.substring(n,n+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(e[n]==="%")throw new Error("Parameter entities are not supported")}let i="";if([n,i]=this.readIdentifierVal(e,n,"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 n--,[r,i,n]}readNotationExp(e,n){n=X(e,n);let r="";for(;n<e.length&&!/\s/.test(e[n]);)r+=e[n],n++;!this.suppressValidationErr&&Ge(r),n=X(e,n);const i=e.substring(n,n+6).toUpperCase();if(!this.suppressValidationErr&&i!=="SYSTEM"&&i!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${i}"`);n+=i.length,n=X(e,n);let s=null,o=null;if(i==="PUBLIC")[n,s]=this.readIdentifierVal(e,n,"publicIdentifier"),n=X(e,n),(e[n]==='"'||e[n]==="'")&&([n,o]=this.readIdentifierVal(e,n,"systemIdentifier"));else if(i==="SYSTEM"&&([n,o]=this.readIdentifierVal(e,n,"systemIdentifier"),!this.suppressValidationErr&&!o))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:r,publicIdentifier:s,systemIdentifier:o,index:--n}}readIdentifierVal(e,n,r){let i="";const s=e[n];if(s!=='"'&&s!=="'")throw new Error(`Expected quoted string, found "${s}"`);for(n++;n<e.length&&e[n]!==s;)i+=e[n],n++;if(e[n]!==s)throw new Error(`Unterminated ${r} value`);return n++,[n,i]}readElementExp(e,n){n=X(e,n);let r="";for(;n<e.length&&!/\s/.test(e[n]);)r+=e[n],n++;if(!this.suppressValidationErr&&!Ut(r))throw new Error(`Invalid element name: "${r}"`);n=X(e,n);let i="";if(e[n]==="E"&&Ce(e,"MPTY",n))n+=4;else if(e[n]==="A"&&Ce(e,"NY",n))n+=2;else if(e[n]==="("){for(n++;n<e.length&&e[n]!==")";)i+=e[n],n++;if(e[n]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${e[n]}"`);return{elementName:r,contentModel:i.trim(),index:n}}readAttlistExp(e,n){n=X(e,n);let r="";for(;n<e.length&&!/\s/.test(e[n]);)r+=e[n],n++;Ge(r),n=X(e,n);let i="";for(;n<e.length&&!/\s/.test(e[n]);)i+=e[n],n++;if(!Ge(i))throw new Error(`Invalid attribute name: "${i}"`);n=X(e,n);let s="";if(e.substring(n,n+8).toUpperCase()==="NOTATION"){if(s="NOTATION",n+=8,n=X(e,n),e[n]!=="(")throw new Error(`Expected '(', found "${e[n]}"`);n++;let a=[];for(;n<e.length&&e[n]!==")";){let l="";for(;n<e.length&&e[n]!=="|"&&e[n]!==")";)l+=e[n],n++;if(l=l.trim(),!Ge(l))throw new Error(`Invalid notation name: "${l}"`);a.push(l),e[n]==="|"&&(n++,n=X(e,n))}if(e[n]!==")")throw new Error("Unterminated list of notations");n++,s+=" ("+a.join("|")+")"}else{for(;n<e.length&&!/\s/.test(e[n]);)s+=e[n],n++;const a=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!a.includes(s.toUpperCase()))throw new Error(`Invalid attribute type: "${s}"`)}n=X(e,n);let o="";return e.substring(n,n+8).toUpperCase()==="#REQUIRED"?(o="#REQUIRED",n+=8):e.substring(n,n+7).toUpperCase()==="#IMPLIED"?(o="#IMPLIED",n+=7):[n,o]=this.readIdentifierVal(e,n,"ATTLIST"),{elementName:r,attributeName:i,attributeType:s,defaultValue:o,index:n}}}const X=(t,e)=>{for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function Ce(t,e,n){for(let r=0;r<e.length;r++)if(e[r]!==t[n+r+1])return!1;return!0}function Ge(t){if(Ut(t))return t;throw new Error(`Invalid entity name ${t}`)}const rc=/^[-+]?0x[a-fA-F0-9]+$/,ic=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,sc={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function oc(t,e={}){if(e=Object.assign({},sc,e),!t||typeof t!="string")return t;let n=t.trim();if(e.skipLike!==void 0&&e.skipLike.test(n))return t;if(t==="0")return 0;if(e.hex&&rc.test(n))return uc(n,16);if(n.includes("e")||n.includes("E"))return lc(t,n,e);{const r=ic.exec(n);if(r){const i=r[1]||"",s=r[2];let o=cc(r[3]);const a=i?t[s.length+1]===".":t[s.length]===".";if(!e.leadingZeros&&(s.length>1||s.length===1&&!a))return t;{const l=Number(n),c=String(l);if(l===0)return l;if(c.search(/[eE]/)!==-1)return e.eNotation?l:t;if(n.indexOf(".")!==-1)return c==="0"||c===o||c===`${i}${o}`?l:t;let u=s?o:n;return s?u===c||i+u===c?l:t:u===c||u===i+c?l:t}}else return t}}const ac=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function lc(t,e,n){if(!n.eNotation)return t;const r=e.match(ac);if(r){let i=r[1]||"";const s=r[3].indexOf("e")===-1?"E":"e",o=r[2],a=i?t[o.length+1]===s:t[o.length]===s;return o.length>1&&a?t:o.length===1&&(r[3].startsWith(`.${s}`)||r[3][0]===s)?Number(e):n.leadingZeros&&!a?(e=(r[1]||"")+r[3],Number(e)):t}else return t}function cc(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substring(0,t.length-1))),t}function uc(t,e){if(parseInt)return parseInt(t,e);if(Number.parseInt)return Number.parseInt(t,e);if(window&&window.parseInt)return window.parseInt(t,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function fc(t){return typeof t=="function"?t:Array.isArray(t)?e=>{for(const n of t)if(typeof n=="string"&&e===n||n instanceof RegExp&&n.test(e))return!0}:()=>!1}class dc{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:(n,r)=>zr(r,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,r)=>zr(r,16,"&#x")}},this.addExternalEntities=hc,this.parseXml=Ec,this.parseTextData=mc,this.resolveNameSpace=pc,this.buildAttributesMap=gc,this.isItStopNode=Nc,this.replaceEntitiesValue=Tc,this.readStopNodeData=bc,this.saveTextToParentTag=Sc,this.addChild=wc,this.ignoreAttributesFn=fc(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 n=0;n<this.options.stopNodes.length;n++){const r=this.options.stopNodes[n];typeof r=="string"&&(r.startsWith("*.")?this.stopNodesWildcard.add(r.substring(2)):this.stopNodesExact.add(r))}}}}function hc(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n],i=r.replace(/[.\-+*:]/g,"\\.");this.lastEntities[r]={regex:new RegExp("&"+i+";","g"),val:t[r]}}}function mc(t,e,n,r,i,s,o){if(t!==void 0&&(this.options.trimValues&&!r&&(t=t.trim()),t.length>0)){o||(t=this.replaceEntitiesValue(t,e,n));const a=this.options.tagValueProcessor(e,t,n,i,s);return a==null?t:typeof a!=typeof t||a!==t?a:this.options.trimValues?En(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?En(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function pc(t){if(this.options.removeNSPrefix){const e=t.split(":"),n=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=n+e[1])}return t}const yc=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function gc(t,e,n){if(this.options.ignoreAttributes!==!0&&typeof t=="string"){const r=rs(t,yc),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 l=r[o][4],c=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(c=this.options.transformAttributeName(c)),c==="__proto__"&&(c="#__proto__"),l!==void 0){this.options.trimValues&&(l=l.trim()),l=this.replaceEntitiesValue(l,n,e);const u=this.options.attributeValueProcessor(a,l,e);u==null?s[c]=l:typeof u!=typeof l||u!==l?s[c]=u:s[c]=En(l,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(s[c]=!0)}if(!Object.keys(s).length)return;if(this.options.attributesGroupName){const o={};return o[this.options.attributesGroupName]=s,o}return s}}const Ec=function(t){t=t.replace(/\r\n?/g,`
10
+ `);const e=new we("!xml");let n=e,r="",i="";this.entityExpansionCount=0,this.currentExpandedLength=0;const s=new nc(this.options.processEntities);for(let o=0;o<t.length;o++)if(t[o]==="<")if(t[o+1]==="/"){const l=Ie(t,">",o,"Closing Tag is not closed.");let c=t.substring(o+2,l).trim();if(this.options.removeNSPrefix){const p=c.indexOf(":");p!==-1&&(c=c.substr(p+1))}this.options.transformTagName&&(c=this.options.transformTagName(c)),n&&(r=this.saveTextToParentTag(r,n,i));const u=i.substring(i.lastIndexOf(".")+1);if(c&&this.options.unpairedTags.indexOf(c)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${c}>`);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),n=this.tagsNodeStack.pop(),r="",o=l}else if(t[o+1]==="?"){let l=gn(t,o,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,i),!(this.options.ignoreDeclaration&&l.tagName==="?xml"||this.options.ignorePiTags)){const c=new we(l.tagName);c.add(this.options.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&(c[":@"]=this.buildAttributesMap(l.tagExp,i,l.tagName)),this.addChild(n,c,i,o)}o=l.closeIndex+1}else if(t.substr(o+1,3)==="!--"){const l=Ie(t,"-->",o+4,"Comment is not closed.");if(this.options.commentPropName){const c=t.substring(o+4,l-2);r=this.saveTextToParentTag(r,n,i),n.add(this.options.commentPropName,[{[this.options.textNodeName]:c}])}o=l}else if(t.substr(o+1,2)==="!D"){const l=s.readDocType(t,o);this.docTypeEntities=l.entities,o=l.i}else if(t.substr(o+1,2)==="!["){const l=Ie(t,"]]>",o,"CDATA is not closed.")-2,c=t.substring(o+9,l);r=this.saveTextToParentTag(r,n,i);let u=this.parseTextData(c,n.tagname,i,!0,!1,!0,!0);u==null&&(u=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:c}]):n.add(this.options.textNodeName,u),o=l+2}else{let l=gn(t,o,this.options.removeNSPrefix),c=l.tagName;const u=l.rawTagName;let f=l.tagExp,p=l.attrExpPresent,E=l.closeIndex;if(this.options.transformTagName){const h=this.options.transformTagName(c);f===c&&(f=h),c=h}if(this.options.strictReservedNames&&(c===this.options.commentPropName||c===this.options.cdataPropName))throw new Error(`Invalid tag name: ${c}`);n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,i,!1));const m=n;m&&this.options.unpairedTags.indexOf(m.tagname)!==-1&&(n=this.tagsNodeStack.pop(),i=i.substring(0,i.lastIndexOf("."))),c!==e.tagname&&(i+=i?"."+c:c);const g=o;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,i,c)){let h="";if(f.length>0&&f.lastIndexOf("/")===f.length-1)c[c.length-1]==="/"?(c=c.substr(0,c.length-1),i=i.substr(0,i.length-1),f=c):f=f.substr(0,f.length-1),o=l.closeIndex;else if(this.options.unpairedTags.indexOf(c)!==-1)o=l.closeIndex;else{const z=this.readStopNodeData(t,u,E+1);if(!z)throw new Error(`Unexpected end of ${u}`);o=z.i,h=z.tagContent}const S=new we(c);c!==f&&p&&(S[":@"]=this.buildAttributesMap(f,i,c)),h&&(h=this.parseTextData(h,c,i,!0,p,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),S.add(this.options.textNodeName,h),this.addChild(n,S,i,g)}else{if(f.length>0&&f.lastIndexOf("/")===f.length-1){if(c[c.length-1]==="/"?(c=c.substr(0,c.length-1),i=i.substr(0,i.length-1),f=c):f=f.substr(0,f.length-1),this.options.transformTagName){const S=this.options.transformTagName(c);f===c&&(f=S),c=S}const h=new we(c);c!==f&&p&&(h[":@"]=this.buildAttributesMap(f,i,c)),this.addChild(n,h,i,g),i=i.substr(0,i.lastIndexOf("."))}else if(this.options.unpairedTags.indexOf(c)!==-1){const h=new we(c);c!==f&&p&&(h[":@"]=this.buildAttributesMap(f,i)),this.addChild(n,h,i,g),i=i.substr(0,i.lastIndexOf(".")),o=l.closeIndex;continue}else{const h=new we(c);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(n),c!==f&&p&&(h[":@"]=this.buildAttributesMap(f,i,c)),this.addChild(n,h,i,g),n=h}r="",o=E}}else r+=t[o];return e.child};function wc(t,e,n,r){this.options.captureMetaData||(r=void 0);const i=this.options.updateTag(e.tagname,n,e[":@"]);i===!1||(typeof i=="string"&&(e.tagname=i),t.addChild(e,r))}const Tc=function(t,e,n){if(t.indexOf("&")===-1)return t;const r=this.options.processEntities;if(!r.enabled||r.allowedTags&&!r.allowedTags.includes(e)||r.tagFilter&&!r.tagFilter(e,n))return t;for(let i in this.docTypeEntities){const s=this.docTypeEntities[i],o=t.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=t.length;if(t=t.replace(s.regx,s.val),r.maxExpandedLength&&(this.currentExpandedLength+=t.length-a,this.currentExpandedLength>r.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${r.maxExpandedLength}`)}}if(t.indexOf("&")===-1)return t;for(let i in this.lastEntities){const s=this.lastEntities[i];t=t.replace(s.regex,s.val)}if(t.indexOf("&")===-1)return t;if(this.options.htmlEntities)for(let i in this.htmlEntities){const s=this.htmlEntities[i];t=t.replace(s.regex,s.val)}return t=t.replace(this.ampEntity.regex,this.ampEntity.val),t};function Sc(t,e,n,r){return t&&(r===void 0&&(r=e.child.length===0),t=this.parseTextData(t,e.tagname,n,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,r),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function Nc(t,e,n,r){return!!(e&&e.has(r)||t&&t.has(n))}function Oc(t,e,n=">"){let r,i="";for(let s=e;s<t.length;s++){let o=t[s];if(r)o===r&&(r="");else if(o==='"'||o==="'")r=o;else if(o===n[0])if(n[1]){if(t[s+1]===n[1])return{data:i,index:s}}else return{data:i,index:s};else o===" "&&(o=" ");i+=o}}function Ie(t,e,n,r){const i=t.indexOf(e,n);if(i===-1)throw new Error(r);return i+e.length-1}function gn(t,e,n,r=">"){const i=Oc(t,e+1,r);if(!i)return;let s=i.data;const o=i.index,a=s.search(/\s/);let l=s,c=!0;a!==-1&&(l=s.substring(0,a),s=s.substring(a+1).trimStart());const u=l;if(n){const f=l.indexOf(":");f!==-1&&(l=l.substr(f+1),c=l!==i.data.substr(f+1))}return{tagName:l,tagExp:s,closeIndex:o,attrExpPresent:c,rawTagName:u}}function bc(t,e,n){const r=n;let i=1;for(;n<t.length;n++)if(t[n]==="<")if(t[n+1]==="/"){const s=Ie(t,">",n,`${e} is not closed`);if(t.substring(n+2,s).trim()===e&&(i--,i===0))return{tagContent:t.substring(r,n),i:s};n=s}else if(t[n+1]==="?")n=Ie(t,"?>",n+1,"StopNode is not closed.");else if(t.substr(n+1,3)==="!--")n=Ie(t,"-->",n+3,"StopNode is not closed.");else if(t.substr(n+1,2)==="![")n=Ie(t,"]]>",n,"StopNode is not closed.")-2;else{const s=gn(t,n,">");s&&((s&&s.tagName)===e&&s.tagExp[s.tagExp.length-1]!=="/"&&i++,n=s.closeIndex)}}function En(t,e,n){if(e&&typeof t=="string"){const r=t.trim();return r==="true"?!0:r==="false"?!1:oc(t,n)}else return Bl(t)?t:""}function zr(t,e,n){const r=Number.parseInt(t,e);return r>=0&&r<=1114111?String.fromCodePoint(r):n+t+";"}const en=we.getMetaDataSymbol();function Cc(t,e){return ss(t,e)}function ss(t,e,n){let r;const i={};for(let s=0;s<t.length;s++){const o=t[s],a=Ac(o);let l="";if(n===void 0?l=a:l=n+"."+a,a===e.textNodeName)r===void 0?r=o[a]:r+=""+o[a];else{if(a===void 0)continue;if(o[a]){let c=ss(o[a],e,l);const u=Ic(c,e);o[":@"]?Rc(c,o[":@"],l,e):Object.keys(c).length===1&&c[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?c=c[e.textNodeName]:Object.keys(c).length===0&&(e.alwaysCreateTextNode?c[e.textNodeName]="":c=""),o[en]!==void 0&&typeof c=="object"&&c!==null&&(c[en]=o[en]),i[a]!==void 0&&Object.prototype.hasOwnProperty.call(i,a)?(Array.isArray(i[a])||(i[a]=[i[a]]),i[a].push(c)):e.isArray(a,l,u)?i[a]=[c]:i[a]=c}}}return typeof r=="string"?r.length>0&&(i[e.textNodeName]=r):r!==void 0&&(i[e.textNodeName]=r),i}function Ac(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];if(r!==":@")return r}}function Rc(t,e,n,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,n+"."+a,!0,!0)?t[a]=[e[a]]:t[a]=e[a]}}}function Ic(t,e){const{textNodeName:n}=e,r=Object.keys(t).length;return!!(r===0||r===1&&(t[n]||typeof t[n]=="boolean"||t[n]===0))}class os{constructor(e){this.externalEntities={},this.options=tc(e)}parse(e,n){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(n){n===!0&&(n={});const s=Wl(e,n);if(s!==!0)throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`)}const r=new dc(this.options);r.addExternalEntities(this.externalEntities);const i=r.parseXml(e);return this.options.preserveOrder||i===void 0?i:Cc(i,this.options)}addEntity(e,n){if(n.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(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=n}static getMetaDataSymbol(){return we.getMetaDataSymbol()}}class ut{parser=new os({ignoreAttributes:!1,attributeNamePrefix:""});constructor(){}checkResponseStatus(e){const{status:n,data:r,errors:i}=e;if(n>=200&&n<300)return!0;let s;const o=this.extractXmlData(r);if(o)try{s=this.parseXml(o,i)||void 0}catch(l){console.log("Error parsing error response XML:",l)}const a=s?.Risposta?.Testata?.Messaggio?.DescrizioneErrore;switch(n){case 400:return F(i,A.BAD_REQUEST,[],k.BAD_REQUEST+(a?`: ${a}`:"")),!1;case 402:return F(i,A.INSUFFICIENT_CREDIT,[],k.INSUFFICIENT_CREDIT),!1;case 404:return F(i,A.COMPANY_NOT_FOUND,[],k.COMPANY_NOT_FOUND),!1;case 503:return F(i,A.SERVICE_UNAVAILABLE,[],k.SERVICE_UNAVAILABLE),!1;case 500:return F(i,A.HTTP_ERROR,[],k.HTTP_ERROR+(a?`: ${a}`:"")),!1;default:return F(i,A.HTTP_ERROR,[],k.HTTP_ERROR+(a?`: ${a}`:"")),!1}}parseXml(e,n){try{return this.parser.parse(e)}catch(r){return console.log(r),F(n,A.XML_PARSE_ERROR,[],k.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 vc{async getBalanceSheetValues(e,n){const r=e?.Risposta?.dati;if(!r)return F(n,A.XBRL_EMPTY,["companyProfit","companyRevenue"],k.XBRL_EMPTY),null;let i;try{i=Buffer.from(r,"base64").toString("utf-8")}catch(u){return console.log(u),F(n,A.XBRL_DECODE_ERROR,["companyProfit","companyRevenue"],k.XBRL_DECODE_ERROR),null}const s=new os({ignoreAttributes:!1,attributeNamePrefix:""});let o;try{o=s.parse(i)}catch(u){return console.log(u),F(n,A.XML_PARSE_ERROR,["companyProfit","companyRevenue"],k.XML_PARSE_ERROR),null}if(!o?.xbrl)return F(n,A.XBRL_MAPPING_ERROR,["companyProfit","companyRevenue"],k.XBRL_MAPPING_ERROR),null;const a=o.xbrl,l=this.findByContext(a,"itcc-ci:UtilePerditaEsercizio","cntxCorr_d"),c=this.findByContext(a,"itcc-ci:ValoreProduzioneRicaviVenditePrestazioni","cntxCorr_d");return{companyProfit:l?Number(l["#text"]):0,companyRevenue:c?Number(c["#text"]):0}}findByContext(e,n,r){const i=e[n];return i?(Array.isArray(i)?i:[i]).find(o=>o.contextRef===r)??null:null}}class as extends ut{constructor(e){super(),this.client=e}async getBalanceSheetByVatNumber(e,n){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:n}))return null;const i=this.parseXml(r.data,n);return i?await new vc().getBalanceSheetValues(i,n):null}catch(r){return console.log(r),F(n,A.BALANCE_SHEET_FETCH_FAILED,["vatNumber"],k.BALANCE_SHEET_FETCH_FAILED),null}}}const kc={AMM:"AMM"};class Fc extends ut{constructor(e){super(),this.client=e}isValidRiquadro(e){if(!e||typeof e!="object")return!1;const n=e;return!!(n["composizione-quote"]?.["valore-nominale"]&&n.titolari?.titolare)}async getCompanySummaryByVatNumber(e,n){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:n}))return null;const i=this.parseXml(r.data,n);if(!i)return null;const s=i.Risposta?.ListaImpreseRI?.Impresa?.AnagraficaImpresa;return s?new Jn().mapAnagraficaImpresaToCompanySummary(s):(F(n,A.COMPANY_NOT_FOUND,["vatNumber"],k.COMPANY_NOT_FOUND),null)}catch(r){return console.log(r),F(n,A.COMPANY_SUMMARY_FETCH_FAILED,["vatNumber"],k.COMPANY_SUMMARY_FETCH_FAILED),null}}async getSharesByRea(e,n,r){try{const i=await this.client.get("/registroimprese/output/impresa/soci/nrea/xml",{params:{cciaa:e,nRea:n},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 Uo,a=s.Risposta.dati["blocchi-impresa"]["sintesi-cifre-impresa"]?.["capitale-sociale"]?.sottoscritto?.ammontare;if(!a)return F(r,A.SHARES_FETCH_FAILED,["companyShares"],k.SHARES_FETCH_FAILED),[];const l=o.parseCapital(a),c=s.Risposta.dati["blocchi-impresa"]["elenco-soci"]?.riquadri?.riquadro;if(!c)return[];const f=(Array.isArray(c)?c:[c]).filter(p=>this.isValidRiquadro(p));return f.length===0?[]:o.getShares(f,l)}catch(i){return console.log(i),F(r,A.SHARES_FETCH_FAILED,["companyShares"],k.SHARES_FETCH_FAILED),[]}}async getCompanyBlocks(e){const{rea:n,fiscalCode:r,blocco:i,errors:s}=e;if(!n&&!r){F(s,A.MISSING_CCIAA_OR_REA,[],k.MISSING_CCIAA_OR_REA);return}let o;Array.isArray(i)?o=i.join(","):o=i;const a="/registroimprese/output/impresa/blocchi/nrea/xml",l="/registroimprese/output/impresa/blocchi/codicefiscale/xml";try{let c;if(n){const{cciaa:p,nRea:E}=n;c=await this.client.get(a,{params:{cciaa:p,nRea:E,blocco:o},responseType:"text"})}else c=await this.client.get(l,{params:{codiceFiscale:r,blocco:o},responseType:"text"});if(!this.checkResponseStatus({status:c.status,data:c.data,errors:s}))return;const u=this.parseXml(c.data,s);return u?await new Jn().mapBlocchiImpresaToCompanyRegistryBlocksSummary(u):void 0}catch(c){console.log(c),F(s,A.HTTP_ERROR,["companyIncorporationDate"],k.HTTP_ERROR)}}async getCompany(e){const n=[],r=await this.getCompanySummaryByVatNumber(e,n);if(!r)return null;const s=await new as(this.client).getBalanceSheetByVatNumber(e,n)??{companyRevenue:0,companyProfit:0};let o=[];r.companyCciaaCode&&r.companyReaNumber?o=await this.getSharesByRea(r.companyCciaaCode,r.companyReaNumber,n):F(n,A.MISSING_CCIAA_OR_REA,[],k.MISSING_CCIAA_OR_REA);let a;r.companyCciaaCode&&r.companyReaNumber?a=await this.getCompanyBlocks({rea:{cciaa:r.companyCciaaCode,nRea:r.companyReaNumber},blocco:kc.AMM,errors:n}):F(n,A.MISSING_CCIAA_OR_REA,[],k.MISSING_CCIAA_OR_REA);const l=a?.identification.constitutionDate;return{...r,...s,companyShares:o,companyIncorporationDate:$(l),aiwsError:n}}}class zc{async mapPersonaDataToCorporateRoles(e){const{personaData:n,errors:r}=e;if(!n)return[];const i=n["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=n["blocchi-persona"],l={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:$(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 c of s){const u=c.persona?.cariche?.carica;if(!u)continue;const f=Array.isArray(u)?u:[u];for(const p of f){const E={companyName:c["dati-identificativi-impresa"].denominazione,companyFiscalCode:c["dati-identificativi-impresa"]["c-fiscale"],companyVatNumber:c["dati-identificativi-impresa"]["c-fiscale"],companyLegalFormCode:c["dati-identificativi-impresa"]["forma-giuridica"]?.c||"",companyLegalFormDescription:c["dati-identificativi-impresa"]["forma-giuridica"]?.["#text"]||"",companyCciaaCode:c["dati-identificativi-impresa"].cciaa,companyCciaaDescription:"",companyReaNumber:parseInt(c["dati-identificativi-impresa"]["n-rea"],10)||0,companyStatusCode:"",companyStatusDescription:"",companyRegistryStatusCode:"",companyRegistryStatusDescription:"",companySourceCode:c["dati-identificativi-impresa"]["c-fonte"]||"",companySourceDescription:c["dati-identificativi-impresa"].fonte||"",companyDeclaredActivity:c["info-attivita"]?.["classificazioni-ateco"]?.["classificazione-ateco"]?c["info-attivita"]?.["classificazioni-ateco"]?.["classificazione-ateco"][0]?.attivita??null:null,companyAtecoCode:c["info-attivita"]?.["classificazioni-ateco"]?.["c-codifica"]||"",companyAtecoDescription:c["info-attivita"]?.["classificazioni-ateco"]?.codifica||"",companyAtecoClassificationCode:parseInt(c["info-attivita"]?.["classificazioni-ateco"]?.["c-codifica"]||"0",10)||0,companyAtecoClassificationDescription:c["info-attivita"]?.["classificazioni-ateco"]?.codifica||"",companyProvinceCode:c["dati-identificativi-impresa"]["indirizzo-localizzazione"]?.provincia||"",companyProvinceDescription:"",companyMunicipalityCode:c["dati-identificativi-impresa"]["indirizzo-localizzazione"]?.["c-comune"]||"",companyMunicipalityDescription:"",companyToponymCode:c["dati-identificativi-impresa"]["indirizzo-localizzazione"]?.["c-toponimo"]||"",companyToponymDescription:"",companyStreet:c["dati-identificativi-impresa"]["indirizzo-localizzazione"]?.via||"",companyStreetNumber:c["dati-identificativi-impresa"]["indirizzo-localizzazione"]?.["n-civico"]||"",companyPostalCode:parseInt(c["dati-identificativi-impresa"]["indirizzo-localizzazione"]?.cap||"0",10)||0,companyPec:c["dati-identificativi-impresa"]["indirizzo-posta-certificata"]||"",companyProfit:null,companyRevenue:null,companyShares:null,companyIncorporationDate:$(c["info-attivita"]?.["dt-inizio-attivita-impresa"]),aiwsError:null};l.pec=c.persona?.["indirizzo-posta-certificata"]||l.pec,o.push({companySummary:E,corporateRole:p["#text"]||"",corporateRoleCode:p["c-carica"]||"",personSummary:l,dateOfAppointment:$(p["dt-atto-nomina"]),durationCode:p["c-durata"]||null,durationDescription:p["descrizione-durata"]||null,balanceSheetDate:$(p["dt-riferimento-bilancio"]),aiwsError:null})}}return o}}class Mc extends ut{constructor(e){super(),this.client=e}async getPersonCorporateRoles(e){const{fiscalCode:n,errors:r}=e;try{const i=await this.client.get("registroimprese/persone/scheda/codicefiscale/xml",{params:{codiceFiscale:n,responseType:"text"}}),s=await this.client.get("registroimprese/persone/scheda/codicefiscale/html",{params:{codiceFiscale:n,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 c=a.Risposta?.dati;return c?{personCorporateRoles:await new zc().mapPersonaDataToCorporateRoles({personaData:c,errors:r}),htmlBuffer:o}:(F(r,A.PERSONA_DATA_NOT_FOUND,["fiscalCode"],k.PERSONA_DATA_NOT_FOUND),null)}catch(i){return console.log(i),F(r,A.PERSONA_DATA_FETCH_FAILED,["fiscalCode"],k.PERSONA_DATA_FETCH_FAILED),null}}}class xc{async mapVisuraEffettoResponseToProtestReport(e){const{visuraEffettoResponse:n,fiscalCode:r,errors:i}=e;if(!n)return null;const s=l=>l?Array.isArray(l)?l:[l]:[],o=n.AnagraficaNominativo,a=s(n.RegistroProtesti).map(l=>({registerData:{cciaaPublication:l.DatiRegistroProtesti.CciaaPubblicazione,registrationRegisterDate:$(l.DatiRegistroProtesti.DtIscrRegistro)},effectInformation:{protestDate:$(l.InformazioniEffetto.DtLevata),protestProvinceCode:l.InformazioniEffetto.SglPrvLevata,protestProvinceDescription:l.InformazioniEffetto.DescPrvLevata,protestMunicipalityCode:l.InformazioniEffetto.CodComLevata,protestMunicipalityDescription:l.InformazioniEffetto.DescComLevata,billIssueDate:$(l.InformazioniEffetto.DtEmissioneEffetto),billDueDate:$(l.InformazioniEffetto.DtScadenzaEffetto),billTypeCode:l.InformazioniEffetto.CodTipoEffetto,billTypeDescription:l.InformazioniEffetto.DescTipoEffetto,protestAmount:l.InformazioniEffetto.ImportoValutaLevata,protestCurrencyCode:l.InformazioniEffetto.CodValutaLevata,protestCurrencyDescription:l.InformazioniEffetto.DescValutaLevata,nonPaymentReasonCode:l.InformazioniEffetto.CodMancatoPagRepr,nonPaymentReasonDescription:l.InformazioniEffetto.DescMancatoPagRepr,billStatusCode:l.InformazioniEffetto.CodStatoEffetto,billStatusDescription:l.InformazioniEffetto.DescStatoEffetto,repertoryNumber:l.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 _c extends ut{constructor(e){super(),this.client=e}async getPersonProtests(e){const{fiscalCode:n,errors:r}=e;try{const i=await this.client.get("/registroprotesti/protesti/ricerca/nazionale",{params:{nominativo:n,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]:[],l=new xc,c=[];for(const u of a){const f=u.KAnagrafica,p=await this.client.get("/registroprotesti/protesti/visura/effetto/anagrafica/xml",{params:{KAnagrafica:f,responseType:"text"}}),E=await this.client.get("/registroprotesti/protesti/visura/effetto/anagrafica/html",{params:{KAnagrafica:f,responseType:"text"}});if(!this.checkResponseStatus({status:p.status,data:p.data,errors:r}))continue;let m;this.checkResponseStatus({status:E.status,data:E.data,errors:r})&&(m=Buffer.from(E.data,"utf8"));const g=this.parseXml(p.data,r);if(!g)continue;const h=await l.mapVisuraEffettoResponseToProtestReport({visuraEffettoResponse:g.Risposta.VisuraEffetto,fiscalCode:n,errors:r});h&&c.push({protestReport:h,htmlBuffer:m})}return c}catch(i){return console.error("Error fetching protest data:",i),F(r,A.PROTESTS_FETCH_FAILED,[],k.PROTESTS_FETCH_FAILED),null}}}class Dc{async mapPartecipazioniDataToCorporateHoldingStructure(e){const{partecipazioniData:n,errors:r}=e;if(!n)return null;const i=g=>g?Array.isArray(g)?g:[g]:[],s=g=>{if(!g)return null;const h=g.trim().replace(/\./g,"").replace(",","."),S=Number(h);return Number.isFinite(S)?S:null},o=n["blocchi-persona"],a=o["dati-identificativi"],l=o["anagrafica-persona"]?.["dati-identificativi-persona"],c=o["partecipazioni-societa"]?.["anagrafica-titolare"];if(!a&&!l)return r.push({code:A.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(g=>({firstName:g.nome,lastName:g.cognome,roleDescription:g.carica,isRegistryRepresentative:g["f-rappresentante-ri"]==="S"})),f=a?"company":"person";let p;f==="company"&&a?p={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:$(a["dt-iscrizione-ri"]),incorporationDate:$(a["dt-atto-costituzione"]),lastFilingDate:$(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}}:p={type:"person",personIdentity:{firstName:l?.nome||"",lastName:l?.cognome||"",fiscalCode:l?.["c-fiscale"]||"",gender:l?.sesso||null,locationAddress:{municipalityCode:l?.indirizzo?.["c-comune"]||null,municipality:l?.indirizzo?.comune||"",province:l?.indirizzo?.provincia||"",toponymCode:l?.indirizzo?.["c-toponimo"]||null,toponym:l?.indirizzo?.toponimo||"",street:l?.indirizzo?.via||"",streetNumber:l?.indirizzo?.["n-civico"]||"",postalCode:l?.indirizzo?.cap||""},dateOfBirth:l?.["estremi-nascita"]?.dt?$(l["estremi-nascita"].dt):null,municipalityOfBirth:l?.["estremi-nascita"]?.comune||"",provinceOfBirth:l?.["estremi-nascita"]?.provincia||""}};const E=i(o["partecipazioni-societa"]?.partecipazioni?.partecipazione).map(g=>{const h=g["estremi-pratica"],S=g["estremi-impresa"],z=g["capitale-sociale"],M=i(g.riquadri?.riquadro).map(_=>({nominalValue:s(_["composizione-quote"]?.["valore-nominale"]),currencyCode:_["composizione-quote"]?.["c-valuta"],currencyDescription:_["composizione-quote"]?.valuta,rights:i(_["diritti-partecipazione"]?.["diritto-partecipazione"]).map(x=>({rightTypeCode:x["c-tipo"]??null,rightTypeDescription:x.tipo??null}))}));return{isCurrentSection:g["f-paragrafo-attuale"]==="S",practice:{practiceCode:h?.["c-pratica"],filingTypeCode:h?.["c-tipo-adempimento"],filingTypeDescription:h?.["tipo-adempimento"],deedDate:$(h?.["dt-atto"]),cciaaCode:h?.cciaa,filingYear:h?.anno,filingNumber:h?.n,protocolDate:$(h?.["dt-protocollo"]),depositDate:$(h?.["dt-deposito"])},isLatestShareholdersList:g["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:z?.["c-valuta"],currencyDescription:z?.valuta,amount:s(z?.ammontare)},shareDetails:M}}),m=i(o["tabella-partecipate-impresa"]).flatMap(g=>i(g.partecipata).map(h=>({fiscalCode:h["c-fiscale"],companyName:h.denominazione,participationStartDate:$(h["dt-inizio-partecipazione"]),rights:i(h["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:p,holderIdentity:{holderTypeCode:c?.["c-tipo"]||"PF",holderTypeDescription:c?.tipo||"Persona fisica",fiscalCode:c?.["c-fiscale"]||l?.["c-fiscale"]||"",companyName:c?.denominazione||`${l?.cognome||""} ${l?.nome||""}`.trim()},participations:E,currentParticipatedCompanies:m,totalCurrentParticipations:s(o["info-blocco-attuale"]?.["n-partecipazioni"])??null,aiwsError:r}}}class Pc extends ut{constructor(e){super(),this.client=e}async getPersonCorporateHoldings(e){const{fiscalCode:n,errors:r}=e;try{const i=await this.client.get("registroimprese/assettiproprietari/partecipazioni/codicefiscale/xml",{params:{codiceFiscale:n,responseType:"text"}}),s=await this.client.get("registroimprese/assettiproprietari/partecipazioni/codicefiscale/html",{params:{codiceFiscale:n,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 c=a.Risposta?.dati;if(!c)return F(r,A.CORPORATE_HOLDINGS_NOT_FOUND,["fiscalCode"],k.CORPORATE_HOLDINGS_NOT_FOUND),null;const f=await new Dc().mapPartecipazioniDataToCorporateHoldingStructure({partecipazioniData:c,errors:r});return f?{personCorporateHoldings:f,htmlBuffer:o}:(F(r,A.CORPORATE_HOLDINGS_NOT_FOUND,["fiscalCode"],k.CORPORATE_HOLDINGS_NOT_FOUND),null)}catch(i){return console.log(i),F(r,A.PERSON_CORPORATE_HOLDINGS_FETCH_FAILED,["fiscalCode"],k.PERSON_CORPORATE_HOLDINGS_FETCH_FAILED),null}}}class Lc{axiosInstance;companyService;personService;protestService;ownershipStructureService;balanceSheetService;constructor(e){const n=e.environment==="production"?"https://aiws.infocamere.it/aiws/rest":"https://aiwscl.infocamere.it/aiws/rest";this.axiosInstance=U.create({baseURL:n,headers:{username:e.username,password:e.password,Accept:"application/xml"},validateStatus:()=>!0}),this.companyService=new Fc(this.axiosInstance),this.personService=new Mc(this.axiosInstance),this.protestService=new _c(this.axiosInstance),this.ownershipStructureService=new Pc(this.axiosInstance),this.balanceSheetService=new as(this.axiosInstance)}}exports.AIWSClient=Lc;
10
11
  //# sourceMappingURL=cciaa-service.cjs.map