@financica/ubl 0.16.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.18.0
4
+
5
+ ### Added
6
+
7
+ - **The serializer writes the whole of EN 16931.** Every business term the model holds now goes out at its place in the UBL 2.1 sequence: the tax point date (BT-7) and its code (BT-8), the VAT accounting currency (BT-6) with the second `cac:TaxTotal` carrying BT-111, the buyer accounting reference (BT-19), the reference set (order BT-13/BT-14, contract BT-12, project BT-11, receiving advice BT-15, despatch BT-16, tender BT-17 and invoiced object BT-18, the last two as typed `cac:AdditionalDocumentReference`s, and BT-26 on the billing reference), party identifications, legal form and contacts, the payee (BG-10), the tax representative (BG-11), delivery with its party, location id and address (BG-13), payment means with credit transfer, direct debit and card details (BG-16; on a credit note BT-9 rides in the first one as `cbc:PaymentDueDate`), document allowances and charges with their VAT category (BG-20/BG-21) and BT-107/BT-108 in the monetary total, line allowances and charges (BG-27/BG-28), the price discount (BT-147/BT-148), the exemption reason code (BT-121), attachment descriptions and text-only document references, and per line the note (BT-127), object identifier (BT-128), order line reference (BT-132), accounting reference (BT-133), buyer, seller and standard item identifiers, commodity classifications, origin country and attributes. Line-level tax totals stay unwritten: BIS Billing 3.0 forbids them.
8
+ - **The serializer checks the arithmetic.** Beyond the mandatory fields it now throws `UblBuildError`, naming the rule and the model path, for a document whose figures break BR-CO-3, BR-CO-10 to BR-CO-13, BR-CO-15, BR-CO-16, BR-53, the BR-S-08 family, or Peppol's R040 (allowance percentage) and R120 (line net against quantity, price and line allowances), and for a payment means without a code, a credit transfer without an account or a direct debit without a mandate. These all failed at the access point before, after the document had left.
9
+ - **`buildTaxTotals` takes `allowanceCharges`.** Each document-level item joins the VAT subtotal of its own category and feeds BT-107/BT-108, so BT-109 is BT-106 − BT-107 + BT-108. **`allocateAcrossTaxCategories(amount, lines, template)`** splits one amount across the categories the lines use, pro rata by line net with the cent remainders on the largest shares, for a shipping charge or an invoice-wide discount on a mixed-rate invoice.
10
+ - **The parser reads the same set**, so a document survives parse → serialize → parse unchanged: payee, tax representative, delivery party and location id, tax currency and BT-111, accounting references, despatch, receipt, tender and object references, line note, order line reference, standard item id, classifications, origin country, mandate debited account and card details, and a credit note's due date from its payment means. The model gains the matching fields (`UblSchemedId`, `UblPriceAllowance`, `UblCommodityClassification`; `payee`, `taxRepresentative`, `taxCurrency`, `accountingCost`, `receivingAdviceReference`, `despatchReference`, `tenderReference`, `invoicedObjectId`; `UblDelivery.locationId`/`partyName`; `UblPaymentMeans.debitedAccount`/`cardNumber`/`cardHolder`; `UblTaxTotal.taxAmountInTaxCurrency`; on a line `note`, `objectIdentifier`, `orderLineReference`, `accountingCost`, `standardItemId`, `commodityClassifications`, `originCountryCode`, `priceAllowance`).
11
+
12
+ ### Changed
13
+
14
+ - **BREAKING: a price discount is `UblLine.priceAllowance`, not an entry of `allowanceCharges`.** `cac:Price/cac:AllowanceCharge` (BT-147/BT-148) used to be merged into the line's allowance list, which lost where it came from and could not be written back. `allowanceCharges` now holds only BG-27/BG-28; `discountAmount` still counts both, and `normalizeUblResponse` still lists the price discount in `extra.allowance_charges`, so the DTO is unchanged.
15
+
16
+ ## 0.17.0
17
+
18
+ ### Changed
19
+
20
+ - **BREAKING: one UBL model for the parser, the serializer and the build helpers.** `UblInvoice` (root export, re-exported from `@financica/ubl/build`) replaces the build-side `UblDocument`, which remains as a deprecated alias for one release. On the parsed model: `UblParty.endpointId`/`endpointSchemeId` → `endpoint: { value, scheme? }`; `companyId: string` + `companyIdSchemeId` → `companyId: { value, scheme? }`; `UblLine.taxPercent`/`taxCategoryId`/`taxSchemeId` → `taxCategory: { id?, percent?, schemeId?, exemptionReason?, exemptionReasonCode? }` (same object on `UblAllowanceCharge`); `UblTaxSubtotal.taxPercent`/`taxCategoryId`/`taxSchemeId`/`taxExemptionReason` → `category` (same shape); the top-level `taxSubtotals` → `taxTotal: { taxAmount?, subtotals }`, where `taxAmount` is BT-110 as the document states it (never summed from the subtotals); `UblLine.baseQuantity` (BT-149) is now read. On the build side: `supplier`/`customer` → `seller`/`buyer`, `vatNumber` → `vatId`, `legalName` → `registrationName`, `priceAmount` → `unitPrice` (the per-unit price; the serializer writes `PriceAmount = unitPrice × baseQuantity`, and `deriveUnitPrice` returns `{ unitPrice, baseQuantity? }`), line `name` → `description` (written as `cbc:Description`, and as `cbc:Name` unless `itemName` is set), attachment `base64` → `base64Content`, `precedingInvoiceId` → `billingReference.invoiceId`, `UblPeriod` → `UblInvoicePeriod`, `documentType: "invoice" | "creditNote"` → `"Invoice" | "CreditNote"`, and every absent output field is an absent key instead of `null` (`buildCompanyId`, `parsePeppolEndpoint`, `resolveVatEndpoint`, `resolveCompanyIdScheme` return `undefined`; `buildSupplierParty`/`buildCustomerParty`/`normalizeAddress` omit absent keys). Caller-input types (`UblSupplier`, `UblCustomer`, `AddressInput`, `CustomerTaxIdInput`) still accept `null`. `buildTaxTotals` throws `UblBuildError` for a line without a `taxCategory`. `normalizeUblResponse` produces the same `InvoiceExtractionDTO`; only the `extra.tax_subtotals` passthrough changes shape (each entry is now `{ taxableAmount?, taxAmount?, category? }`).
21
+ - **BREAKING: `serializeUblDocument` validates and throws `UblBuildError`.** Also exported as `serializeUblInvoice` (the preferred name). Because the model is permissive, the serializer enforces what EN 16931 / Peppol BIS Billing 3.0 make mandatory and throws the new `UblBuildError` (exported from the root and `/build`, `name` set, `readonly cause?`) naming the BT and model path: document `id`, `issueDate`, `currency`, `seller.name`, `buyer.name`, an `endpoint.scheme` on any endpoint, at least one line, per line `quantity`, `unitCode`, `unitPrice`, `lineExtensionAmount`, `taxCategory.id` (and `taxCategory.percent` unless the category is `O`), `taxTotal.taxAmount`, `monetaryTotal.lineExtensionAmount`/`taxExclusiveAmount`/`taxInclusiveAmount`/`payableAmount`, and per VAT subtotal its `taxableAmount`, `taxAmount` and `category`. An attachment needs `filename`, `mimeCode` and `base64Content`; an attachment with only `externalUri` is written as `cac:ExternalReference`. `customizationId`, `profileId` and `invoiceTypeCode` are written when set (defaulting to the BIS values), so a parsed document re-serializes faithfully.
22
+
3
23
  ## 0.16.0
4
24
 
5
25
  ### Changed
package/README.md CHANGED
@@ -5,7 +5,7 @@ TypeScript toolkit for [UBL (Universal Business Language)](https://www.oasis-ope
5
5
  The package is split into two entry points:
6
6
 
7
7
  - `@financica/ubl` — the parse side: read UBL XML into typed objects (`parseUblInvoice`, `normalizeUblResponse`, MLR parsing).
8
- - `@financica/ubl/build` — the build side: assemble a `UblDocument` and serialize it to Peppol BIS Billing 3.0 XML.
8
+ - `@financica/ubl/build` — the build side: assemble a `UblInvoice` (the same model the parser produces) and serialize it to Peppol BIS Billing 3.0 XML.
9
9
 
10
10
  ## Installation
11
11
 
@@ -62,59 +62,55 @@ Handles UTF-8 BOM stripping automatically.
62
62
 
63
63
  ### Build UBL XML
64
64
 
65
- Construct a `UblDocument`, a vendor-neutral mirror of the Peppol BIS Billing 3.0
66
- fields, and serialize it with `serializeUblDocument`.
65
+ Construct a `UblInvoice` — the same model `parseUblInvoice` returns — and
66
+ serialize it with `serializeUblInvoice`. The model is permissive (the parser
67
+ reads whatever a document states); the serializer enforces what EN 16931 /
68
+ Peppol BIS make mandatory and throws `UblBuildError`, naming the field, when
69
+ something is missing.
67
70
 
68
71
  ```typescript
69
- import { serializeUblDocument, type UblDocument } from "@financica/ubl/build";
72
+ import { serializeUblInvoice, type UblInvoice } from "@financica/ubl/build";
70
73
 
71
- const doc: UblDocument = {
72
- documentType: "invoice",
74
+ const doc: UblInvoice = {
75
+ documentType: "Invoice",
73
76
  id: "INV-001",
74
77
  issueDate: "2026-01-15",
75
78
  dueDate: "2026-02-14",
76
- note: null,
77
79
  currency: "EUR",
78
- buyerReference: null,
79
- precedingInvoiceId: null,
80
- supplier: {
80
+ seller: {
81
81
  endpoint: { scheme: "0208", value: "0800279001" },
82
82
  name: "Acme BV",
83
- legalName: "Acme BV",
84
- vatNumber: "BE0800279001",
83
+ registrationName: "Acme BV",
84
+ vatId: "BE0800279001",
85
85
  companyId: { value: "0800279001", scheme: "0208" },
86
86
  address: {
87
87
  street: "Rue de la Loi 1",
88
- additionalStreet: null,
89
88
  city: "Brussels",
90
89
  postalZone: "1000",
91
- countrySubentity: null,
92
90
  countryCode: "BE",
93
91
  },
94
92
  },
95
- customer: {
93
+ buyer: {
96
94
  endpoint: { scheme: "0208", value: "0123456789" },
97
95
  name: "Globex SA",
98
- legalName: "Globex SA",
99
- vatNumber: "BE0123456789",
96
+ registrationName: "Globex SA",
97
+ vatId: "BE0123456789",
100
98
  companyId: { value: "0123456789", scheme: "0208" },
101
99
  address: {
102
100
  street: "Avenue Louise 50",
103
- additionalStreet: null,
104
101
  city: "Brussels",
105
102
  postalZone: "1050",
106
- countrySubentity: null,
107
103
  countryCode: "BE",
108
104
  },
109
105
  },
110
106
  lines: [
111
107
  {
112
108
  id: "1",
113
- name: "Consulting services",
109
+ description: "Consulting services",
114
110
  quantity: 1,
115
111
  unitCode: "C62",
116
112
  lineExtensionAmount: 100,
117
- priceAmount: 100,
113
+ unitPrice: 100,
118
114
  taxCategory: { id: "S", percent: 21 },
119
115
  },
120
116
  ],
@@ -130,14 +126,13 @@ const doc: UblDocument = {
130
126
  taxInclusiveAmount: 121,
131
127
  payableAmount: 121,
132
128
  },
133
- attachments: [],
134
129
  };
135
130
 
136
- const xml = serializeUblDocument(doc);
131
+ const xml = serializeUblInvoice(doc);
137
132
  ```
138
133
 
139
- Set `documentType: "creditNote"` (with `precedingInvoiceId` referencing the
140
- original invoice) to emit a `CreditNote` instead.
134
+ Set `documentType: "CreditNote"` (with `billingReference: { invoiceId }`
135
+ referencing the original invoice) to emit a `CreditNote` instead.
141
136
 
142
137
  For a document that is already paid, pass the settled gross amount as
143
138
  `prepaidAmount` (BT-113) so `payableAmount` (BT-115) reports what is actually
@@ -155,6 +150,50 @@ const { taxTotal, monetaryTotal } = buildTaxTotals(doc.lines, { prepaidAmount: 1
155
150
  `taxInclusiveAmount - prepaidAmount + payableRoundingAmount` (BR-CO-16) and does
156
151
  not clamp it: an overpayment yields a negative `payableAmount`.
157
152
 
153
+ Document-level allowances and charges (BG-20/BG-21) go through the same
154
+ helper so each one lands in the VAT breakdown of its own category and feeds
155
+ BT-107/BT-108. `allocateAcrossTaxCategories` splits one amount (a shipping
156
+ charge, an invoice-wide discount) across the categories the lines use, pro
157
+ rata, so a mixed-rate invoice stays right:
158
+
159
+ ```ts
160
+ import { allocateAcrossTaxCategories, buildTaxTotals } from "@financica/ubl/build";
161
+
162
+ const allowanceCharges = allocateAcrossTaxCategories(20, lines, {
163
+ chargeIndicator: true,
164
+ reason: "Shipping",
165
+ reasonCode: "FC",
166
+ });
167
+ const { taxTotal, monetaryTotal } = buildTaxTotals(lines, { allowanceCharges });
168
+ const xml = serializeUblInvoice({
169
+ ...doc,
170
+ allowanceCharges,
171
+ lines,
172
+ taxTotal,
173
+ monetaryTotal,
174
+ });
175
+ ```
176
+
177
+ ### What the serializer writes
178
+
179
+ Every EN 16931 business term the model holds, at its place in the UBL 2.1
180
+ sequence: the header terms (BT-1 to BT-9, BT-19, BT-6 with BT-111), the
181
+ references (BT-10 to BT-18, BT-25/BT-26), the seller and buyer with
182
+ identifications, legal form and contacts, the payee (BG-10), the tax
183
+ representative (BG-11), delivery (BG-13), payment means (BG-16 with credit
184
+ transfer, direct debit and card details), payment terms, document and line
185
+ allowances and charges (BG-20/21, BG-27/28), the price discount (BT-147/148),
186
+ the VAT breakdown, the monetary totals, attachments and document references
187
+ (BG-24), and lines with their note, references, item identifiers,
188
+ classification, origin and attributes. Line-level tax totals are not written;
189
+ BIS Billing 3.0 forbids them.
190
+
191
+ Besides the mandatory fields, `serializeUblInvoice` checks the document's
192
+ arithmetic before anything leaves: BR-CO-10 to BR-CO-13, BR-CO-15, BR-CO-16,
193
+ the BR-S-08 family, BR-CO-3, BR-53 and Peppol's R040 and R120. A document
194
+ that would be rejected by an access point throws `UblBuildError` naming the
195
+ rule and the model path instead.
196
+
158
197
  The build subpath also exports
159
198
  helpers such as `buildSupplierParty`, `buildTaxTotals`, `buildCompanyId`,
160
199
  `buildPdfAttachment`, and Peppol identifier utilities (`resolveVatEndpoint`,
@@ -167,7 +206,9 @@ helpers such as `buildSupplierParty`, `buildTaxTotals`, `buildCompanyId`,
167
206
 
168
207
  ## Parsed fields
169
208
 
170
- Parties (seller/buyer), addresses, contacts, endpoint IDs, line items with quantities/prices/tax, allowance/charge at both header and line level, tax subtotals, monetary totals, payment means (including multiple), payment terms, invoice period, delivery information, order/contract/project references, notes, and embedded attachments.
209
+ Everything the serializer writes (above), read back into the same model, plus
210
+ what documents in the wild add: line-level tax totals (E-FFF), a second
211
+ `cac:TaxTotal` in the accounting currency, and a reason on the price discount.
171
212
 
172
213
  ## Development
173
214
 
@@ -1,3 +1,4 @@
1
+ import { C as UblTaxSubtotal, S as UblTaxCategory, T as UblBuildError, _ as UblParty, a as UblBillingReference, b as UblPriceAllowance, c as UblContact, d as UblEndpoint, f as UblInvoice, g as UblMonetaryTotal, h as UblLine, i as UblAttachment, l as UblDelivery, m as UblItemProperty, n as UblAddress, o as UblCommodityClassification, p as UblInvoicePeriod, r as UblAllowanceCharge, s as UblCompanyId, u as UblDocumentReference, v as UblPartyIdentification, w as UblTaxTotal, x as UblSchemedId, y as UblPaymentMeans } from "../types-DpwX8-Ix.js";
1
2
  //#region src/build/ubl/constants.d.ts
2
3
  /** Peppol BIS Billing 3.0 / EN 16931 identifiers and fixed code values. */
3
4
  /** EN 16931 + Peppol BIS Billing 3.0 customization (BT-24). */
@@ -19,178 +20,29 @@ declare const NS_CREDIT_NOTE = "urn:oasis:names:specification:ubl:schema:xsd:Cre
19
20
  declare const NS_CAC = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2";
20
21
  declare const NS_CBC = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2";
21
22
  //#endregion
22
- //#region src/build/ubl/types.d.ts
23
+ //#region src/build/ubl/serialize.d.ts
23
24
  /**
24
- * A vendor-neutral model of a Peppol BIS Billing 3.0 document.
25
+ * Serialize a {@link UblInvoice} into a Peppol BIS Billing 3.0 XML string.
25
26
  *
26
- * This is the intermediate representation the builders in `../` (and, for
27
- * Stripe data, `stripe-ubl`) produce; `./serialize.ts` turns it into UBL XML.
28
- * It is deliberately a thin, construction-oriented mirror of the UBL fields we
29
- * populate — not a full UBL object graph.
30
- */
31
- interface UblAddress {
32
- /** `cbc:StreetName` (BT-35). */
33
- street: string | null;
34
- /** `cbc:AdditionalStreetName` (BT-36). */
35
- additionalStreet: string | null;
36
- /** `cbc:CityName` (BT-37). */
37
- city: string | null;
38
- /** `cbc:PostalZone` (BT-38). */
39
- postalZone: string | null;
40
- /** `cbc:CountrySubentity` (BT-39). */
41
- countrySubentity: string | null;
42
- /** `cac:Country/cbc:IdentificationCode` (BT-40) — ISO 3166-1 alpha-2. */
43
- countryCode: string | null;
44
- }
45
- /** Peppol participant identifier, e.g. scheme `0208`, value `0800279001`. */
46
- interface UblEndpoint {
47
- scheme: string;
48
- value: string;
49
- }
50
- /** Legal registration identifier, e.g. a Belgian enterprise number. */
51
- interface UblCompanyId {
52
- value: string;
53
- /** ICD scheme (e.g. `0208` for the Belgian CBE), when known. */
54
- scheme?: string | null;
55
- }
56
- interface UblParty {
57
- /** `cbc:EndpointID` (BT-49/BT-34) — the Peppol routing identifier. */
58
- endpoint: UblEndpoint | null;
59
- /** `cac:PartyName/cbc:Name` (BT-27/BT-44). */
60
- name: string;
61
- address: UblAddress;
62
- /** `cac:PartyTaxScheme/cbc:CompanyID` with `VAT` scheme (BT-31/BT-48). */
63
- vatNumber: string | null;
64
- /** `cac:PartyLegalEntity/cbc:RegistrationName` (BT-27/BT-44). Defaults to `name`. */
65
- legalName: string | null;
66
- /** `cac:PartyLegalEntity/cbc:CompanyID` (BT-30/BT-47). */
67
- companyId: UblCompanyId | null;
68
- }
69
- /**
70
- * VAT breakdown category. `id` is a UNCL5305 code:
71
- * - `S` Standard rate
72
- * - `Z` Zero-rated goods
73
- * - `E` Exempt from VAT
74
- * - `AE` VAT reverse charge
75
- * - `O` Services outside scope of tax
76
- * - `K` Intra-community supply
77
- * - `G` Export outside the EU
78
- */
79
- interface UblTaxCategory {
80
- id: string;
81
- percent: number;
82
- /** Required by EN 16931 (BR-E-10/BR-AE-10/…) for non-`S`/`Z` categories. */
83
- exemptionReason?: string | null | undefined;
84
- }
85
- interface UblLine {
86
- /** `cbc:ID` (BT-126) — line identifier. */
87
- id: string;
88
- /** `cac:Item/cbc:Name` (BT-153). */
89
- name: string;
90
- /** `cbc:InvoicedQuantity` / `cbc:CreditedQuantity` (BT-129). */
91
- quantity: number;
92
- /** UN/ECE Rec 20 unit code (BT-130). */
93
- unitCode: string;
94
- /** `cbc:LineExtensionAmount` (BT-131) — net of VAT, after line discounts. */
95
- lineExtensionAmount: number;
96
- /** `cac:Price/cbc:PriceAmount` (BT-146) — net unit price. */
97
- priceAmount: number;
98
- /**
99
- * `cac:Price/cbc:BaseQuantity` (BT-149) — the number of units `priceAmount`
100
- * covers. Omitted means 1. Set it when the net doesn't divide evenly into
101
- * cents, so `quantity × (priceAmount ÷ baseQuantity)` reproduces the line
102
- * net exactly (PEPPOL-EN16931-R120); see `deriveUnitPrice`.
103
- */
104
- baseQuantity?: number | undefined;
105
- /** `cac:InvoicePeriod` (BT-134/BT-135) — the line's own service period. */
106
- invoicePeriod?: UblPeriod | null;
107
- taxCategory: UblTaxCategory;
108
- }
109
- interface UblTaxSubtotal {
110
- /** `cbc:TaxableAmount` (BT-116). */
111
- taxableAmount: number;
112
- /** `cbc:TaxAmount` (BT-117). */
113
- taxAmount: number;
114
- category: UblTaxCategory;
115
- }
116
- interface UblTaxTotal {
117
- /** `cbc:TaxAmount` (BT-110) — sum of subtotal tax amounts. */
118
- taxAmount: number;
119
- subtotals: UblTaxSubtotal[];
120
- }
121
- interface UblMonetaryTotal {
122
- /** BT-106 — sum of line net amounts. */
123
- lineExtensionAmount: number;
124
- /** BT-109 — total without VAT. */
125
- taxExclusiveAmount: number;
126
- /** BT-112 — total with VAT. */
127
- taxInclusiveAmount: number;
128
- /**
129
- * BT-113 — sum of amounts paid in advance. **Gross (VAT-inclusive)**, since
130
- * BR-CO-16 subtracts it directly from BT-112. Omitted when absent or zero.
131
- */
132
- prepaidAmount?: number;
133
- /** BT-114 — rounding applied to the payable amount. Omitted when absent or zero. */
134
- payableRoundingAmount?: number;
135
- /**
136
- * BT-115 — amount due for payment, i.e. the *outstanding* amount.
137
- * BR-CO-16: `BT-115 = BT-112 − BT-113 + BT-114`.
138
- */
139
- payableAmount: number;
140
- }
141
- /** An embedded supporting document (BG-24), e.g. the rendered PDF. */
142
- interface UblAttachment {
143
- /** `cac:AdditionalDocumentReference/cbc:ID` (BT-122). */
144
- id: string;
145
- /** `cbc:EmbeddedDocumentBinaryObject/@filename`. */
146
- filename: string;
147
- /** MIME type, e.g. `application/pdf`. */
148
- mimeCode: string;
149
- /** Base64-encoded document bytes. */
150
- base64: string;
151
- }
152
- /**
153
- * A service period: BT-73/BT-74 on the document, BT-134/BT-135 on a line.
154
- * Either bound may stand alone — UBL allows a half-open period — but a period
155
- * with neither is omitted entirely.
27
+ * Writes every EN 16931 business term the model holds, at its position in the
28
+ * UBL 2.1 sequence: the header terms (`customizationId`, `profileId` and
29
+ * `invoiceTypeCode` default to the BIS values), the references (BT-10 to
30
+ * BT-19), the parties with identifications, legal form and contacts, the
31
+ * payee and tax representative, delivery, payment means, payment terms,
32
+ * document and line allowances and charges, the VAT breakdown (plus BT-111 in
33
+ * the accounting currency), the monetary totals, attachments and document
34
+ * references, and lines with their item identifiers, classifications,
35
+ * properties, price discount and classified VAT category. Line-level tax
36
+ * totals are not emitted: BIS Billing 3.0 forbids them.
37
+ *
38
+ * @throws {UblBuildError} when a field EN 16931 / Peppol BIS makes mandatory
39
+ * is missing (naming the BT and the model path), or when the document's
40
+ * arithmetic breaks a business rule: BR-CO-3, BR-CO-10 to BR-CO-13, BR-CO-15,
41
+ * BR-CO-16, BR-53, the BR-S-08 family, PEPPOL-EN16931-R040 and R120.
156
42
  */
157
- interface UblPeriod {
158
- /** `YYYY-MM-DD`. */
159
- startDate: string | null;
160
- /** `YYYY-MM-DD`, inclusive. */
161
- endDate: string | null;
162
- }
163
- interface UblDocument {
164
- documentType: "invoice" | "creditNote";
165
- /** Invoice / credit note number (BT-1). */
166
- id: string;
167
- /** Issue date (BT-2), `YYYY-MM-DD`. */
168
- issueDate: string;
169
- /** Payment due date (BT-9). Invoices only. */
170
- dueDate: string | null;
171
- /** Free-text note (BT-22). */
172
- note: string | null;
173
- /** Payment terms note (BT-20, `cac:PaymentTerms/cbc:Note`). */
174
- paymentTermsNote?: string | null;
175
- /** Document currency (BT-5). */
176
- currency: string;
177
- /** Buyer reference (BT-10). */
178
- buyerReference: string | null;
179
- /** Invoicing period (BT-73/BT-74). */
180
- invoicePeriod?: UblPeriod | null;
181
- /** For credit notes: the referenced original invoice number (BT-25). */
182
- precedingInvoiceId: string | null;
183
- supplier: UblParty;
184
- customer: UblParty;
185
- lines: UblLine[];
186
- taxTotal: UblTaxTotal;
187
- monetaryTotal: UblMonetaryTotal;
188
- attachments: UblAttachment[];
189
- }
190
- //#endregion
191
- //#region src/build/ubl/serialize.d.ts
192
- /** Serialize a {@link UblDocument} into a Peppol BIS Billing 3.0 XML string. */
193
- declare const serializeUblDocument: (doc: UblDocument) => string;
43
+ declare const serializeUblInvoice: (doc: UblInvoice) => string;
44
+ /** Alias of {@link serializeUblInvoice}, kept under the historical name. */
45
+ declare const serializeUblDocument: typeof serializeUblInvoice;
194
46
  //#endregion
195
47
  //#region src/build/address.d.ts
196
48
  /**
@@ -215,7 +67,7 @@ interface AddressInput {
215
67
  }
216
68
  /**
217
69
  * Normalize a free-form address (Stripe shape, custom shape, or an internal
218
- * shape) into a {@link UblAddress}.
70
+ * shape) into a {@link UblAddress}. An absent part is an absent key.
219
71
  *
220
72
  * Accepts both `line1`/`postal_code`/`country` (Stripe) and `street`/`zip_code`
221
73
  * (legacy/internal) keys. Falls back to `fallbackCountryCode` when the address
@@ -265,7 +117,7 @@ interface UblSupplier {
265
117
  /** Peppol participant identifier in `scheme:value` form (e.g. `"0208:0793904121"`). */
266
118
  peppolID?: string | null;
267
119
  }
268
- /** Convert a {@link UblSupplier} into the supplier (seller) party. */
120
+ /** Convert a {@link UblSupplier} into the seller party (`cac:AccountingSupplierParty`). */
269
121
  declare const buildSupplierParty: (supplier: UblSupplier) => UblParty;
270
122
  /**
271
123
  * Caller-provided customer (buyer) data, normalized into a stable shape.
@@ -296,7 +148,7 @@ interface UblCustomer {
296
148
  vatNumber?: string | null;
297
149
  }
298
150
  /**
299
- * Convert a {@link UblCustomer} into the customer (buyer) party.
151
+ * Convert a {@link UblCustomer} into the buyer party (`cac:AccountingCustomerParty`).
300
152
  *
301
153
  * The Peppol `EndpointID` (BT-49) — which routes the document — is resolved in
302
154
  * priority order: an explicit `endpointOverride` (e.g. a confirmed-registered
@@ -322,9 +174,9 @@ declare const buildPdfAttachment: (params: {
322
174
  }) => UblAttachment;
323
175
  /**
324
176
  * Replace each attachment's base64 payload with `[omitted]` plus a length, so a
325
- * {@link UblDocument} is safe to log or persist for audit.
177
+ * {@link UblInvoice} is safe to log or persist for audit.
326
178
  */
327
- declare const sanitizeUblDocumentForAudit: (doc: UblDocument) => UblDocument;
179
+ declare const sanitizeUblDocumentForAudit: (doc: UblInvoice) => UblInvoice;
328
180
  //#endregion
329
181
  //#region src/build/identifiers.d.ts
330
182
  /**
@@ -339,22 +191,22 @@ declare const normalizeCompanyNumberForCountry: (countryCode: string | null | un
339
191
  * `@financica/peppol`'s country profiles.
340
192
  *
341
193
  * Falls back to inspecting the number's country prefix (e.g. `BE0793904121`).
342
- * Returns `null` when the scheme can't be determined, in which case the
194
+ * Returns `undefined` when the scheme can't be determined, in which case the
343
195
  * CompanyID is emitted without a `schemeID` attribute.
344
196
  */
345
197
  declare const resolveCompanyIdScheme: (params: {
346
198
  countryCode: string | null;
347
199
  companyNumber: string | null;
348
- }) => string | null;
200
+ }) => string | undefined;
349
201
  /**
350
202
  * Build the `cac:PartyLegalEntity/cbc:CompanyID` value for a party, with the
351
- * country-appropriate ICD scheme when known. Returns `null` when there is no
203
+ * country-appropriate ICD scheme when known. Returns `undefined` when there is no
352
204
  * company number.
353
205
  */
354
206
  declare const buildCompanyId: (params: {
355
207
  countryCode: string | null;
356
208
  companyNumber: string | null;
357
- }) => UblCompanyId | null;
209
+ }) => UblCompanyId | undefined;
358
210
  /**
359
211
  * Resolve the Peppol participant identifier for a VAT number, deriving the EAS
360
212
  * scheme from the number's own country prefix (falling back to `countryCode`).
@@ -362,25 +214,25 @@ declare const buildCompanyId: (params: {
362
214
  * `BE0206582284` → `{ scheme: "9925", value: "BE0206582284" }`
363
215
  *
364
216
  * The scheme comes from `@financica/peppol`'s country resolution, so countries
365
- * that route on their registry number alone (Norway, Denmark) yield `null`
217
+ * that route on their registry number alone (Norway, Denmark) yield `undefined`
366
218
  * here — their VAT number is not a Peppol participant identifier.
367
219
  *
368
220
  * The value keeps its country prefix, matching how participants register (the
369
- * Peppol directory lists this party as `9925:be0206582284`). Returns `null`
221
+ * Peppol directory lists this party as `9925:be0206582284`). Returns `undefined`
370
222
  * when the country has no VAT EAS scheme or the input is empty.
371
223
  */
372
224
  declare const resolveVatEndpoint: (params: {
373
225
  vatNumber: string | null | undefined;
374
226
  countryCode?: string | null | undefined;
375
- }) => UblEndpoint | null;
227
+ }) => UblEndpoint | undefined;
376
228
  /**
377
229
  * Parse a Peppol participant identifier into a {@link UblEndpoint}.
378
230
  *
379
231
  * Accepts the canonical `scheme:value` form (e.g. `0208:0800279001`). Returns
380
- * `null` for values without an explicit scheme, since `cbc:EndpointID` requires
232
+ * `undefined` for values without an explicit scheme, since `cbc:EndpointID` requires
381
233
  * a `schemeID` and guessing one would mis-route the document.
382
234
  */
383
- declare const parsePeppolEndpoint: (peppolId: string | null | undefined) => UblEndpoint | null;
235
+ declare const parsePeppolEndpoint: (peppolId: string | null | undefined) => UblEndpoint | undefined;
384
236
  interface CustomerTaxIdentifiers {
385
237
  peppolID: string | null;
386
238
  glnNumber: string | null;
@@ -430,28 +282,34 @@ declare const listPeppolReceiverIdentifierCandidates: (customer: Partial<Custome
430
282
  declare const roundCurrency: (value: number) => number;
431
283
  /** Convert an integer cent amount into a 2-decimal currency value. */
432
284
  declare const centsToDecimal: (cents: number) => number;
433
- /** The `cac:Price` pair for a line: BT-146 and the optional BT-149. */
285
+ /** The `cac:Price` pair for a line: the per-unit price and the optional BT-149. */
434
286
  interface UnitPrice {
435
- /** `cbc:PriceAmount` (BT-146). */
436
- priceAmount: number;
437
- /** `cbc:BaseQuantity` (BT-149) — the units `priceAmount` covers. Omitted = 1. */
287
+ /** Net price of one unit (`UblLine.unitPrice`). */
288
+ unitPrice: number;
289
+ /**
290
+ * `cbc:BaseQuantity` (BT-149) — set when the per-unit price is not exact in
291
+ * cents; the serializer then emits `PriceAmount = unitPrice × baseQuantity`
292
+ * (the line net). Omitted = 1.
293
+ */
438
294
  baseQuantity?: number | undefined;
439
295
  }
440
296
  /**
441
297
  * Derive the `cac:Price` for a line whose net total is authoritative.
442
298
  *
443
299
  * Peppol rule PEPPOL-EN16931-R120 checks
444
- * `quantity × (priceAmount ÷ baseQuantity)` against the line net amount within
300
+ * `quantity × (PriceAmount ÷ BaseQuantity)` against the line net amount within
445
301
  * a 0.02 tolerance. Naively rounding `net ÷ quantity` to cents breaks that
446
302
  * whenever the division doesn't land on a cent: 940.00 over 14 units gives
447
303
  * 67.142857…, which rounds to 67.14, and 14 × 67.14 = 939.96 — off by 0.04 and
448
304
  * rejected as a fatal validation error.
449
305
  *
450
306
  * So the cent-rounded unit price is only used when it reproduces the net
451
- * exactly. Otherwise the line is priced as a whole via BT-149 (`priceAmount` =
452
- * the net, `baseQuantity` = the quantity), which is exact at any magnitude
453
- * instead of merely within tolerance — the residual of a rounded unit price
454
- * grows with quantity and would eventually breach 0.02 at any fixed precision.
307
+ * exactly. Otherwise the line is priced as a whole via BT-149: `unitPrice` is
308
+ * the exact (unrounded) `net ÷ quantity` and `baseQuantity` = the quantity, so
309
+ * the serializer writes `PriceAmount` = the net and `BaseQuantity` = the
310
+ * quantity, which is exact at any magnitude instead of merely within tolerance
311
+ * — the residual of a rounded unit price grows with quantity and would
312
+ * eventually breach 0.02 at any fixed precision.
455
313
  */
456
314
  declare const deriveUnitPrice: (netTotal: number, quantity: number) => UnitPrice;
457
315
  //#endregion
@@ -522,6 +380,13 @@ interface BuildTaxTotalsOptions {
522
380
  prepaidAmount?: number;
523
381
  /** BT-114 — rounding applied to the payable amount. */
524
382
  payableRoundingAmount?: number;
383
+ /**
384
+ * Document-level allowances and charges (BG-20/BG-21). Each one joins the
385
+ * VAT breakdown of its own category (BR-S-08: taxable = line nets −
386
+ * allowances + charges) and feeds BT-107/BT-108, so BT-109 is
387
+ * BT-106 − BT-107 + BT-108 (BR-CO-13). Put the same array on the document.
388
+ */
389
+ allowanceCharges?: UblAllowanceCharge[];
525
390
  }
526
391
  /**
527
392
  * Group lines by `(category, percent)` into a VAT breakdown and compute the
@@ -538,8 +403,23 @@ interface BuildTaxTotalsOptions {
538
403
  * invariant holds by construction. The result is *not* clamped: a prepayment
539
404
  * exceeding the total yields a negative payable amount, surfacing the upstream
540
405
  * overpayment rather than hiding it.
406
+ *
407
+ * @throws {UblBuildError} for a line, allowance or charge without a
408
+ * `taxCategory` — there is no VAT breakdown to put it in.
541
409
  */
542
410
  declare const buildTaxTotals: (lines: UblLine[], options?: BuildTaxTotalsOptions) => BuildTaxTotalsResult;
411
+ /**
412
+ * Split one document-level amount into an allowance or charge per VAT
413
+ * category the lines use, pro rata by each category's line nets, so a
414
+ * shipping charge or an invoice-wide discount on a mixed-rate invoice lands in
415
+ * the right VAT subtotals (an ancillary cost follows the supply it belongs to).
416
+ * Cent remainders go to the largest shares so the parts sum to `amount`
417
+ * exactly; categories that receive nothing are omitted. With no positive
418
+ * line net at all the whole amount goes to the first line's category.
419
+ *
420
+ * @throws {UblBuildError} for a line without a `taxCategory`.
421
+ */
422
+ declare const allocateAcrossTaxCategories: (amount: number, lines: UblLine[], template: Pick<UblAllowanceCharge, "chargeIndicator" | "reason" | "reasonCode">) => UblAllowanceCharge[];
543
423
  //#endregion
544
424
  //#region src/build/xml.d.ts
545
425
  /**
@@ -572,5 +452,11 @@ declare const el: (name: string, attrs?: XmlAttrs | null, content?: string | num
572
452
  /** Serialize a root element into a UTF-8 XML document string. */
573
453
  declare const serializeDocument: (root: XmlElement) => string;
574
454
  //#endregion
575
- export { type AddressInput, type BuildTaxTotalsOptions, type BuildTaxTotalsResult, COUNTRY_CODE_LIST_ID, CREDIT_NOTE_TYPE_CODE, type CustomerTaxIdInput, type CustomerTaxIdentifiers, DEFAULT_UNIT_CODE, EXEMPT_TAXABILITY_REASONS, INVOICE_TYPE_CODE, NS_CAC, NS_CBC, NS_CREDIT_NOTE, NS_INVOICE, type SupplierVatStatus, type TaxAmountInfo, UBL_CUSTOMIZATION_ID, UBL_PROFILE_ID, type UblAddress, type UblAttachment, type UblCompanyId, type UblCustomer, type UblDocument, type UblEndpoint, type UblLine, type UblMonetaryTotal, type UblParty, type UblPeriod, type UblSupplier, type UblTaxCategory, type UblTaxSubtotal, type UblTaxTotal, type UnitPrice, VAT_TAX_SCHEME_ID, type XmlAttrs, type XmlElement, buildCompanyId, buildCustomerParty, buildPdfAttachment, buildSupplierParty, buildTaxTotals, centsToDecimal, coerceLinesForSupplierVatStatus, deriveUnitPrice, el, extractCustomerTaxIdentifiers, listPeppolReceiverIdentifierCandidates, normalizeAddress, normalizeCompanyNumberForCountry, parsePeppolEndpoint, reconcileLinesToExclTotal, resolveCompanyIdScheme, resolveTaxCategoryFromTaxAmounts, resolveVatEndpoint, roundCurrency, sanitizeUblDocumentForAudit, serializeDocument, serializeUblDocument, taxCategoryFromReasonOrRate };
455
+ //#region src/build/index.d.ts
456
+ /** @deprecated The build and parse models are one; use {@link UblInvoice}. */
457
+ type UblDocument = UblInvoice;
458
+ /** @deprecated Use {@link UblInvoicePeriod}. */
459
+ type UblPeriod = UblInvoicePeriod;
460
+ //#endregion
461
+ export { type AddressInput, type BuildTaxTotalsOptions, type BuildTaxTotalsResult, COUNTRY_CODE_LIST_ID, CREDIT_NOTE_TYPE_CODE, type CustomerTaxIdInput, type CustomerTaxIdentifiers, DEFAULT_UNIT_CODE, EXEMPT_TAXABILITY_REASONS, INVOICE_TYPE_CODE, NS_CAC, NS_CBC, NS_CREDIT_NOTE, NS_INVOICE, type SupplierVatStatus, type TaxAmountInfo, UBL_CUSTOMIZATION_ID, UBL_PROFILE_ID, type UblAddress, type UblAllowanceCharge, type UblAttachment, type UblBillingReference, UblBuildError, type UblCommodityClassification, type UblCompanyId, type UblContact, type UblCustomer, type UblDelivery, UblDocument, type UblDocumentReference, type UblEndpoint, type UblInvoice, type UblInvoicePeriod, type UblItemProperty, type UblLine, type UblMonetaryTotal, type UblParty, type UblPartyIdentification, type UblPaymentMeans, UblPeriod, type UblPriceAllowance, type UblSchemedId, type UblSupplier, type UblTaxCategory, type UblTaxSubtotal, type UblTaxTotal, type UnitPrice, VAT_TAX_SCHEME_ID, type XmlAttrs, type XmlElement, allocateAcrossTaxCategories, buildCompanyId, buildCustomerParty, buildPdfAttachment, buildSupplierParty, buildTaxTotals, centsToDecimal, coerceLinesForSupplierVatStatus, deriveUnitPrice, el, extractCustomerTaxIdentifiers, listPeppolReceiverIdentifierCandidates, normalizeAddress, normalizeCompanyNumberForCountry, parsePeppolEndpoint, reconcileLinesToExclTotal, resolveCompanyIdScheme, resolveTaxCategoryFromTaxAmounts, resolveVatEndpoint, roundCurrency, sanitizeUblDocumentForAudit, serializeDocument, serializeUblDocument, serializeUblInvoice, taxCategoryFromReasonOrRate };
576
462
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/build/ubl/constants.ts","../../src/build/ubl/types.ts","../../src/build/ubl/serialize.ts","../../src/build/address.ts","../../src/build/party.ts","../../src/build/attachment.ts","../../src/build/identifiers.ts","../../src/build/numeric.ts","../../src/build/tax-category.ts","../../src/build/tax-totals.ts","../../src/build/xml.ts"],"mappings":";;;cAGa;;cAIA;;cAGA;;cAEA;;cAGA;;cAGA;;cAGA;cAEA;cACA;cAEA;cAEA;;;;;;;;;;;UCnBI;;EAEhB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;UAIgB;EAChB;EACA;;;UAIgB;EAChB;;EAEA;;UAGgB;;EAEhB,UAAU;;EAEV;EACA,SAAS;;EAET;;EAEA;;EAEA,WAAW;;;;;;;;;;;;UAaK;EAChB;EACA;;EAEA;;UAGgB;;EAEhB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;EAOA;;EAEA,gBAAgB;EAChB,aAAa;;UAGG;;EAEhB;;EAEA;EACA,UAAU;;UAGM;;EAEhB;EACA,WAAW;;UAGK;;EAEhB;;EAEA;;EAEA;;;;;EAKA;;EAEA;;;;;EAKA;;;UAIgB;;EAEhB;;EAEA;;EAEA;;EAEA;;;;;;;UAQgB;;EAEhB;;EAEA;;UAGgB;EAChB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA,gBAAgB;;EAEhB;EACA,UAAU;EACV,UAAU;EACV,OAAO;EACP,UAAU;EACV,eAAe;EACf,aAAa;;;;;cC6BD,uBAAoB,KAAS;;;;;;;;;;;UC7LzB;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;;;;;cAYY,mBAAgB,SACnB,iCAA+B,oCACN,iCAEhC;;;;;;;;;;;;;;;;;KCxBS;;;;;;;UAQK;;EAEhB;;EAEA;;;;;EAKA,SAAS;;EAET;;EAEA;;EAEA,WAAW;;EAEX;;;cAIY,qBAAkB,UAAc,gBAAc;;;;;;;;UAsB1C;;EAEhB;;EAEA,SAAS;;;;;;;EAOT;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;;;;;;;cAcY,qBAAkB,UACpB,aAAW,mBACF,uBACjB;;;;;;;;cCnGU,qBAAkB;EAC9B;EACA,OAAO;;EAEP;MACG;;;;;cAWS,8BAA2B,KAAS,gBAAc;;;;;;;cCLlD,mCAAgC,wCACN;;;;;;;;;;;cAmB1B,yBAAsB;EAClC;EACA;;;;;;;cAuBY,iBAAc;EAC1B;EACA;MACG;;;;;;;;;;;;;;;cA4BS,qBAAkB;EAC9B;EACA;MACG;;;;;;;;cAyBS,sBAAmB,wCAE7B;UAWc;EAChB;EACA;EACA;EACA;;;;;;;UAQgB;EAChB;EACA;;;;;;;;;cAaY,gCAA6B,iBACxB,4CACf;;;;;;;;;;;;;;;;;;;;cAkDU,yCAAsC,UACxC,QAAQ,yBAAuB;;;;cCtN7B,gBAAa;;cAIb,iBAAc;;UAGV;;EAEhB;;EAEA;;;;;;;;;;;;;;;;;;cAmBY,kBAAe,kBAAoB,qBAAqB;;;;;;;cCvBxD,2BAAyB;UAsBrB;EAChB;EACA;EACA;;;;;;;;;;;;;cAiBY,8BAA2B;EACvC;EACA;EACA;MACG;;;;;;;cA6CS,mCAAgC,YAChC,iBAAe,iBAEzB;;;;;;;cAiCU,kCAA+B,OACpC,WAAS,WACL,mBAAiB,wCAE1B;;;;;;;;;;;;;cCxHU,4BAAyB,OAC9B,WAAS,sCAEd;UAoCc;EAChB,UAAU;EACV,eAAe;;UAGC;;;;;;EAMhB;;EAEA;;;;;;;;;;;;;;;;;;cAmBY,iBAAc,OACnB,WAAS,UACN,0BACR;;;;;;;;;;;KCpFS,WAAW;UAEN;EAChB;EACA,QAAQ;;EAER;;EAEA,WAAW;;;KAIP,YAAY;;;;;;;;cASJ,KAAE,cACF,QACJ,iBAAe,mCACY,gBACjC;;cAgDU,oBAAiB,MAAU"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/build/ubl/constants.ts","../../src/build/ubl/serialize.ts","../../src/build/address.ts","../../src/build/party.ts","../../src/build/attachment.ts","../../src/build/identifiers.ts","../../src/build/numeric.ts","../../src/build/tax-category.ts","../../src/build/tax-totals.ts","../../src/build/xml.ts","../../src/build/index.ts"],"mappings":";;;;cAGa;;cAIA;;cAGA;;cAEA;;cAGA;;cAGA;;cAGA;cAEA;cACA;cAEA;cAEA;;;;;;;;;;;;;;;;;;;;;;cCs2BA,sBAAmB,KAAS;;cAuH5B,6BAAoB;;;;;;;;;;;UCx+BhB;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;;;;;cAYY,mBAAgB,SACnB,iCAA+B,oCACN,iCAEhC;;;;;;;;;;;;;;;;;KCxBS;;;;;;;UAQK;;EAEhB;;EAEA;;;;;EAKA,SAAS;;EAET;;EAEA;;EAEA,WAAW;;EAEX;;;cAIY,qBAAkB,UAAc,gBAAc;;;;;;;;UAsB1C;;EAEhB;;EAEA,SAAS;;;;;;;EAOT;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;;;;;;;cAcY,qBAAkB,UACpB,aAAW,mBACF,uBACjB;;;;;;;;cCnGU,qBAAkB;EAC9B;EACA,OAAO;;EAEP;MACG;;;;;cAWS,8BAA2B,KAAS,eAAa;;;;;;;cCLjD,mCAAgC,wCACN;;;;;;;;;;;cAmB1B,yBAAsB;EAClC;EACA;;;;;;;cAuBY,iBAAc;EAC1B;EACA;MACG;;;;;;;;;;;;;;;cA4BS,qBAAkB;EAC9B;EACA;MACG;;;;;;;;cAyBS,sBAAmB,wCAE7B;UAWc;EAChB;EACA;EACA;EACA;;;;;;;UAQgB;EAChB;EACA;;;;;;;;;cAaY,gCAA6B,iBACxB,4CACf;;;;;;;;;;;;;;;;;;;;cAkDU,yCAAsC,UACxC,QAAQ,yBAAuB;;;;cCtN7B,gBAAa;;cAIb,iBAAc;;UAGV;;EAEhB;;;;;;EAMA;;;;;;;;;;;;;;;;;;;;cAqBY,kBAAe,kBAAoB,qBAAqB;;;;;;;cC7BxD,2BAAyB;UAsBrB;EAChB;EACA;EACA;;;;;;;;;;;;;cAiBY,8BAA2B;EACvC;EACA;EACA;MACG;;;;;;;cA8CS,mCAAgC,YAChC,iBAAe,iBAEzB;;;;;;;cAiCU,kCAA+B,OACpC,WAAS,WACL,mBAAiB,wCAE1B;;;;;;;;;;;;;cCpHU,4BAAyB,OAC9B,WAAS,sCAEd;UAmCc;EAChB,UAAU;EACV,eAAe;;UAGC;;;;;;EAMhB;;EAEA;;;;;;;EAOA,mBAAmB;;;;;;;;;;;;;;;;;;;;;cAsBP,iBAAc,OACnB,WAAS,UACN,0BACR;;;;;;;;;;;;cAkGU,8BAA2B,gBACzB,OACP,WAAS,UACN,KAAK,qEACb;;;;;;;;;;;KCxMS,WAAW;UAEN;EAChB;EACA,QAAQ;;EAER;;EAEA,WAAW;;;KAIP,YAAY;;;;;;;;cASJ,KAAE,cACF,QACJ,iBAAe,mCACY,gBACjC;;cAgDU,oBAAiB,MAAU;;;;KC1C5B,cAAc;;KAEd,YAAY"}