'use strict'; var crypto = require('crypto'); var fastXmlParser = require('fast-xml-parser'); var i=class extends Error{constructor(t){super("Invalid Invoice"+(t?.length?`: ${t[0].message}`:""));t&&(this.errors=t);}};var o={attributeNamePrefix:"$_",ignoreAttributes:!1,format:!0},n=class{constructor(e){this.DocumentType=1;this.UUID=crypto.randomUUID();this.ElectronicPossibilityAgreementReference="";this.LocalCurrencyCode="CZK";this.CurrRate="1";this.RefCurrRate="1";this.$_xmlns="http://isdoc.cz/namespace/2013";this.$_version="6.0.1";if(typeof e=="string"||e instanceof Buffer){let t=new fastXmlParser.XMLParser(o).parse(e);if(t.Invoice)this.assign(t.Invoice,!1);else throw new i}else typeof e=="object"&&this.assign(e);}assign(e,t=!0){typeof e.DocumentType=="string"&&(e.DocumentType={invoice:1,"credit note":2,"debit note":3,"proforma invoice":4,"advance invoice":5,"advance credit note":6,simplified:7}[e.DocumentType]),Object.assign(this,e),t&&this.validate();}validate(e){return !0}toXML(e=!0){let t={$_xmlns:this.$_xmlns,$_version:this.$_version,DocumentType:this.DocumentType,SubDocumentType:this.SubDocumentType,SubDocumentTypeOrigin:this.SubDocumentTypeOrigin,TargetConsolidator:this.TargetConsolidator,ClientOnTargetConsolidator:this.ClientOnTargetConsolidator,ClientBankAccount:this.ClientBankAccount,ID:this.ID,ID36:this.ID36,UUID:this.UUID,EgovFlag:this.EgovFlag,ISDS_ID:this.ISDS_ID,FileReference:this.FileReference,ReferenceNumber:this.ReferenceNumber,EgovClassifiers:this.EgovClassifiers,IssuingSystem:this.IssuingSystem,IssueDate:this.IssueDate,TaxPointDate:this.TaxPointDate,VATApplicable:this.VATApplicable,ElectronicPossibilityAgreementReference:this.ElectronicPossibilityAgreementReference,Note:this.Note,LocalCurrencyCode:this.LocalCurrencyCode,ForeignCurrencyCode:this.ForeignCurrencyCode,CurrRate:this.CurrRate,RefCurrRate:this.RefCurrRate,Extensions:this.Extensions,AccountingSupplierParty:this.AccountingSupplierParty,SellerSupplierParty:this.SellerSupplierParty,AnonymousCustomerParty:this.AnonymousCustomerParty,AccountingCustomerParty:this.AccountingCustomerParty,BuyerCustomerParty:this.BuyerCustomerParty,OrderReferences:this.OrderReferences,DeliveryNoteReferences:this.DeliveryNoteReferences,OriginalDocumentReferences:this.OriginalDocumentReferences,ContractReferences:this.ContractReferences,Delivery:this.Delivery,InvoiceLines:this.InvoiceLines,NonTaxedDeposits:this.NonTaxedDeposits,TaxedDeposits:this.TaxedDeposits,TaxTotal:this.TaxTotal,LegalMonetaryTotal:this.LegalMonetaryTotal,PaymentMeans:this.PaymentMeans,SupplementsList:this.SupplementsList},l={...o,tagValueProcessor:(y,r)=>r instanceof Date?r.toISOString().substring(0,10):r},s=` `+new fastXmlParser.XMLBuilder(l).build({Invoice:t});return e&&this.validate(s),s}toJSON(){return JSON.stringify({...this},null,2)}}; module.exports = n; //# sourceMappingURL=out.js.map //# sourceMappingURL=index.cjs.map