import { r as __exportAll } from "./chunk-olfrzTEO.js";
import { B as lazy, H as number, I as _enum, J as datetime, L as any, R as array, U as object, V as literal, W as string, a as BaseDocumentHeaderSchema, b as generateId, c as baseCreateDocument, f as createAction, g as createState, h as createReducer, l as baseLoadFromInput, o as BaseDocumentStateSchema, s as baseActions, u as baseSaveToFileHandle, v as defaultBaseState, x as isDocumentAction, z as boolean } from "./dist-uUUuTqM0.js";
//#region document-models/invoice/v1/gen/document-model.ts
const documentModel = {
	id: "powerhouse/invoice",
	name: "Invoice",
	author: {
		name: "Powerhouse",
		website: "https://powerhouse.inc"
	},
	extension: "",
	description: "The Invoice document model that allows a contributor to request compensation based on their contributions.",
	specifications: [{
		state: {
			local: {
				schema: "",
				examples: [],
				initialValue: ""
			},
			global: {
				schema: "type InvoiceState {\n  status: Status!\n  invoiceNo: String!\n  dateIssued: Date\n  dateDue: Date\n  dateDelivered: Date\n  issuer: LegalEntity!\n  payer: LegalEntity!\n  currency: String!\n  lineItems: [InvoiceLineItem!]!\n  totalPriceTaxExcl: Float!\n  totalPriceTaxIncl: Float!\n  notes: String\n  rejections: [Rejection!]!\n  payments: [Payment!]!\n  payAfter: DateTime\n  invoiceTags: [InvoiceTag!]!   # e.g. {'xero-payment-account', '090', 'PowerhouseUSD'}\n  exported: ExportedData!\n  closureReason: ClosureReason\n}\n\nenum ClosureReason {\n  UNDERPAID\n  OVERPAID\n  CANCELLED\n}\n\ntype Rejection {\n  id: OID!\n  reason: String!\n  final: Boolean!\n}\n\ntype ExportedData {\n  timestamp: DateTime   # ISO 8601 timestamp of the export\n  exportedLineItems: [[String!]!]!   # CSV Format\n}\n\ntype Payment {\n  id: OID!\n  processorRef: String\n  paymentDate: DateTime\n  txnRef: String\n  confirmed: Boolean!\n  issue: String\n  amount: Float\n}\n\ntype Token {\n  evmAddress: String\n  symbol: String\n  chainName: String\n  chainId: String\n  rpc: String\n}\n\ntype LegalEntity {\n  id: LegalEntityId\n  name: String\n  address: Address\n  contactInfo: ContactInfo\n  country: String\n  paymentRouting: PaymentRouting\n}\n\ntype Address {\n  streetAddress: String\n  extendedAddress: String\n  city: String\n  postalCode: String\n  country: String\n  stateProvince: String\n}\n\ntype ContactInfo {\n  tel: String\n  email: String\n}\n\ntype PaymentRouting {\n  bank: Bank\n  wallet: InvoiceWallet\n}\n\ntype Bank {\n  name: String!\n  address: Address!\n  ABA: String\n  BIC: String\n  SWIFT: String\n  accountNum: String!\n  accountType: InvoiceAccountType\n  beneficiary: String\n  intermediaryBank: IntermediaryBank\n  memo: String\n}\n\ntype IntermediaryBank {\n  name: String!\n  address: Address!\n  ABA: String\n  BIC: String\n  SWIFT: String\n  accountNum: String!\n  accountType: InvoiceAccountType\n  beneficiary: String\n  memo: String\n}\n\ntype InvoiceWallet {\n  rpc: String\n  chainName: String\n  chainId: String\n  address: String\n}\n\ntype InvoiceLineItem {\n  id: OID!\n  description: String!\n  taxPercent: Float!\n  quantity: Float!\n  currency: String!\n  unitPriceTaxExcl: Float!\n  unitPriceTaxIncl: Float!\n  totalPriceTaxExcl: Float!\n  totalPriceTaxIncl: Float!\n  lineItemTag: [InvoiceTag!]\n}\n\ntype InvoiceTag {\n  dimension: String!  # \"xero-expense-account\", \"xero-payment-account\", \"accounting-period\", ...\n  value: String!      # \"627\", ..., \"090\", ..., \"2025/05\", \"2025/Q1\", ...\n  label: String       # \"Marketing\", ..., \"Business Bank\", ..., \"May 2025\"\n}\n\ntype LegalEntityId {\n  taxId: String\n  corpRegId: String\n}\n\nenum Status {\n  DRAFT\n  ISSUED\n  CANCELLED\n  ACCEPTED\n  REJECTED\n  PAYMENTSCHEDULED\n  PAYMENTSENT\n  PAYMENTISSUE\n  PAYMENTRECEIVED\n  PAYMENTCLOSED\n}\n\nenum InvoiceAccountType {\n  CHECKING\n  SAVINGS\n  TRUST\n  WALLET\n}\n\nenum InvoiceAccountTypeInput {\n  CHECKING\n  SAVINGS\n  TRUST\n  WALLET\n}",
				examples: [],
				initialValue: "{\n  \"status\": \"DRAFT\",\n  \"invoiceNo\": \"\",\n  \"dateIssued\": null,\n  \"dateDue\": null,\n  \"dateDelivered\": null,\n  \"issuer\": {\n    \"id\": null,\n    \"name\": null,\n    \"address\": null,\n    \"contactInfo\": null,\n    \"country\": null,\n    \"paymentRouting\": null\n  },\n  \"payer\": {\n    \"id\": null,\n    \"name\": null,\n    \"address\": null,\n    \"contactInfo\": null,\n    \"country\": null,\n    \"paymentRouting\": null\n  },\n  \"currency\": \"\",\n  \"lineItems\": [],\n  \"totalPriceTaxExcl\": 0,\n  \"totalPriceTaxIncl\": 0,\n  \"notes\": null,\n  \"rejections\": [],\n  \"payments\": [],\n  \"payAfter\": null,\n  \"invoiceTags\": [],\n  \"exported\": {\n    \"timestamp\": null,\n    \"exportedLineItems\": []\n  },\n  \"closureReason\": null\n}"
			}
		},
		modules: [
			{
				id: "general",
				name: "general",
				operations: [
					{
						id: "d955a93b-113a-4bce-a39c-a35fab0507dd",
						name: "EDIT_INVOICE",
						scope: "global",
						errors: [],
						schema: "input EditInvoiceInput {\n    invoiceNo: String\n    dateIssued: String\n    dateDelivered: String\n    dateDue: String\n    currency: String\n    notes: String\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					},
					{
						id: "be51fbde-c3ae-4c9c-bb40-5108eeaad248",
						name: "ADD_PAYMENT",
						scope: "global",
						errors: [],
						schema: "input AddPaymentInput {\n  id: OID!\n  processorRef: String\n  paymentDate: DateTime\n  txnRef: String\n  confirmed: Boolean!\n  issue: String\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					},
					{
						id: "2e59c939-146e-4b32-b099-fde474a5ddf0",
						name: "EDIT_PAYMENT_DATA",
						scope: "global",
						errors: [],
						schema: "input EditPaymentDataInput {\n  id: OID!\n  processorRef: String\n  paymentDate: DateTime\n  txnRef: String\n  confirmed: Boolean!\n  issue: String\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					},
					{
						id: "4fefc092-7c18-4c45-8dd3-1d793a4078f4",
						name: "EDIT_STATUS",
						scope: "global",
						errors: [],
						schema: "input EditStatusInput {\n  status: Status!\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					},
					{
						id: "6e0f6dc6-d60d-4b44-9890-78d4a21dbb80",
						name: "SET_EXPORTED_DATA",
						scope: "global",
						errors: [],
						schema: "input SetExportedDataInput {\n  timestamp: DateTime!\n  exportedLineItems: [[String!]!]! \n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					}
				],
				description: ""
			},
			{
				id: "parties",
				name: "parties",
				operations: [
					{
						id: "189cf7f9-30cd-4200-9397-c1a97a439c00",
						name: "EDIT_ISSUER_BANK",
						scope: "global",
						errors: [],
						schema: "input EditIssuerBankInput {\n  name: String\n    streetAddress: String\n    extendedAddress: String\n    city: String\n    postalCode: String\n    country: String\n    stateProvince: String\n    ABA: String\n    BIC: String\n    SWIFT: String\n    accountNum: String\n    accountType: InvoiceAccountTypeInput\n    beneficiary: String\n    memo: String\n    # intermediaryBank\n    nameIntermediary: String\n    streetAddressIntermediary: String\n    extendedAddressIntermediary: String\n    cityIntermediary: String\n    postalCodeIntermediary: String\n    countryIntermediary: String\n    stateProvinceIntermediary: String\n    ABAIntermediary: String\n    BICIntermediary: String\n    SWIFTIntermediary: String\n    accountNumIntermediary: String\n    accountTypeIntermediary: InvoiceAccountTypeInput\n    beneficiaryIntermediary: String\n    memoIntermediary: String\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					},
					{
						id: "787305ae-aa44-41ea-b35b-4f3cac559a93",
						name: "EDIT_ISSUER",
						scope: "global",
						errors: [],
						schema: "input EditIssuerInput {\n    id: String\n    name: String\n    streetAddress: String\n    extendedAddress: String\n    city: String\n    postalCode: String\n    country: String\n    stateProvince: String\n    tel: String\n    email: String\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					},
					{
						id: "ccdd1700-0064-4076-8685-5422e172f96c",
						name: "EDIT_ISSUER_WALLET",
						scope: "global",
						errors: [],
						schema: "input EditIssuerWalletInput {\n    rpc: String\n    chainName: String\n    chainId: String\n    address: String\n}\n\n",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					},
					{
						id: "a07a88ac-d080-4644-ae35-82bbca61ebc5",
						name: "EDIT_PAYER_BANK",
						scope: "global",
						errors: [],
						schema: "input EditPayerBankInput {\n    name: String\n    streetAddress: String\n    extendedAddress: String\n    city: String\n    postalCode: String\n    country: String\n    stateProvince: String\n    ABA: String\n    BIC: String\n    SWIFT: String\n    accountNum: String\n    accountType: InvoiceAccountTypeInput\n    beneficiary: String\n    memo: String\n    # intermediaryBank\n    nameIntermediary: String\n    streetAddressIntermediary: String\n    extendedAddressIntermediary: String\n    cityIntermediary: String\n    postalCodeIntermediary: String\n    countryIntermediary: String\n    stateProvinceIntermediary: String\n    ABAIntermediary: String\n    BICIntermediary: String\n    SWIFTIntermediary: String\n    accountNumIntermediary: String\n    accountTypeIntermediary: InvoiceAccountTypeInput\n    beneficiaryIntermediary: String\n    memoIntermediary: String\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					},
					{
						id: "56dd2085-353c-4db0-886e-3e37dd744b4b",
						name: "EDIT_PAYER",
						scope: "global",
						errors: [],
						schema: "input EditPayerInput {\n    id: String\n    name: String\n    streetAddress: String\n    extendedAddress: String\n    city: String\n    postalCode: String\n    country: String\n    stateProvince: String\n    tel: String\n    email: String\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					},
					{
						id: "ef795dfb-4fd8-4f8d-87cb-f978e5f8e356",
						name: "EDIT_PAYER_WALLET",
						scope: "global",
						errors: [],
						schema: "input EditPayerWalletInput {\n    rpc: String\n    chainName: String\n    chainId: String\n    address: String\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					}
				],
				description: ""
			},
			{
				id: "items",
				name: "items",
				operations: [
					{
						id: "9017ff01-001c-418c-8f22-cbbddc8f584b",
						name: "ADD_LINE_ITEM",
						scope: "global",
						errors: [],
						schema: "input AddLineItemInput {\n    id: OID!\n    description: String!\n    taxPercent: Float!\n    quantity: Float!\n    currency: String! # Default can be USD\n    unitPriceTaxExcl: Float!\n    unitPriceTaxIncl: Float!\n    totalPriceTaxExcl: Float!\n    totalPriceTaxIncl: Float!\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					},
					{
						id: "c174028c-1e74-4d48-963c-fd7197900445",
						name: "DELETE_LINE_ITEM",
						scope: "global",
						errors: [],
						schema: "input DeleteLineItemInput {\n  id: OID!\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					},
					{
						id: "0347ff31-bf1b-4b0e-942b-8bd73be27840",
						name: "EDIT_LINE_ITEM",
						scope: "global",
						errors: [],
						schema: "input EditLineItemInput {\n    id: OID!\n    description: String\n    taxPercent: Float\n    quantity: Float\n    currency: String\n    unitPriceTaxExcl: Float\n    unitPriceTaxIncl: Float\n    totalPriceTaxExcl: Float\n    totalPriceTaxIncl: Float\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					},
					{
						id: "17eb26fb-00ed-4aff-8dbb-1b6b9558a71f",
						name: "SET_INVOICE_TAG",
						scope: "global",
						errors: [],
						schema: "input SetInvoiceTagInput {\n  dimension: String!\n  value: String!\n  label: String\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					},
					{
						id: "bf4b2e6e-b95a-4e5c-959f-76cd6a2cfb1d",
						name: "SET_LINE_ITEM_TAG",
						scope: "global",
						errors: [],
						schema: "input SetLineItemTagInput {\n  lineItemId: OID!\n  dimension: String!\n  value: String!\n  label: String\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					}
				],
				description: ""
			},
			{
				id: "transitions",
				name: "transitions",
				operations: [
					{
						id: "90ecb375-322a-4f19-aca6-35e9e4a7bdb5",
						name: "ACCEPT",
						scope: "global",
						errors: [],
						schema: "input AcceptInput {\n  payAfter: DateTime\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					},
					{
						id: "5cd41d30-affc-422d-aed1-f5cf8a4990e1",
						name: "CANCEL",
						scope: "global",
						errors: [],
						schema: "input CancelInput {\n  \"Add your inputs here\"\n  _placeholder: String\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					},
					{
						id: "da2e6a51-138d-4e82-994c-427564eaf621",
						name: "CLOSE_PAYMENT",
						scope: "global",
						errors: [],
						schema: "input ClosePaymentInput {\n  closureReason: ClosureReasonInput\n}\n\nenum ClosureReasonInput {\n  UNDERPAID\n  OVERPAID\n  CANCELLED\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					},
					{
						id: "55ae1d4d-3e93-4d74-80e9-e47b66deadbd",
						name: "CONFIRM_PAYMENT",
						scope: "global",
						errors: [],
						schema: "input ConfirmPaymentInput {\n  id: OID!       # Payment ID\n  amount: Float!\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					},
					{
						id: "08f6a81b-37ba-4eba-907d-b363c9047bb8",
						name: "ISSUE",
						scope: "global",
						errors: [],
						schema: "input IssueInput {\n  invoiceNo: String!\n  dateIssued: String!\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					},
					{
						id: "2e0e9b10-9a70-4551-848f-624d1a3401a5",
						name: "REAPPROVE_PAYMENT",
						scope: "global",
						errors: [],
						schema: "input ReapprovePaymentInput {\n  \"Add your inputs here\"\n  _placeholder: String\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					},
					{
						id: "5d3bc4a6-395d-4318-8f23-4e6437f63e0c",
						name: "REGISTER_PAYMENT_TX",
						scope: "global",
						errors: [],
						schema: "input RegisterPaymentTxInput {\n  id: OID!       # Payment ID\n  timestamp: DateTime!\n  txRef: String!\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					},
					{
						id: "f7df69c9-40a3-42ba-926c-66b3bdd87481",
						name: "REINSTATE",
						scope: "global",
						errors: [],
						schema: "input ReinstateInput {\n  \"Add your inputs here\"\n  _placeholder: String\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					},
					{
						id: "80519119-50b4-45aa-b074-34e3046e4fe2",
						name: "REJECT",
						scope: "global",
						errors: [],
						schema: "input RejectInput {\n  id: OID! # New Rejection ID\n  reason: String!\n  final: Boolean!\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					},
					{
						id: "cb11b7d4-60af-4351-9ee0-5e2897418adf",
						name: "REPORT_PAYMENT_ISSUE",
						scope: "global",
						errors: [],
						schema: "input ReportPaymentIssueInput {\n  id: OID!       # Payment ID\n  issue: String!\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					},
					{
						id: "986336a4-0b51-4c84-8f3b-3a9f5071d429",
						name: "RESET",
						scope: "global",
						errors: [],
						schema: "input ResetInput {\n  \"Add your inputs here\"\n  _placeholder: String\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					},
					{
						id: "d0a0803c-eeb3-40e2-b548-79f957e1d00b",
						name: "SCHEDULE_PAYMENT",
						scope: "global",
						errors: [],
						schema: "input SchedulePaymentInput {\n  id: OID!\n  processorRef: String!\n  paymentDate: DateTime\n}",
						reducer: "",
						examples: [],
						template: "",
						description: ""
					}
				],
				description: ""
			}
		],
		version: 1,
		changeLog: []
	}]
};
//#endregion
//#region document-models/invoice/v1/src/reducers/general.ts
/**
* Converts a date string to ISO datetime format if it's not already in that format
* Handles both date-only (YYYY-MM-DD) and datetime (YYYY-MM-DDTHH:mm:ss.sssZ) strings
*/
function ensureDatetimeFormat$1(dateStr) {
	if (!dateStr || dateStr.trim() === "") return null;
	if (dateStr.includes("T")) return dateStr;
	return `${dateStr}T00:00:00.000Z`;
}
const invoiceGeneralOperations = {
	editInvoiceOperation(state, action) {
		const newState = { ...state };
		newState.currency = action.input.currency ?? state.currency;
		newState.dateDue = action.input.dateDue !== void 0 ? ensureDatetimeFormat$1(action.input.dateDue) : state.dateDue;
		newState.dateIssued = action.input.dateIssued !== void 0 ? ensureDatetimeFormat$1(action.input.dateIssued) : state.dateIssued;
		newState.dateDelivered = action.input.dateDelivered !== void 0 ? ensureDatetimeFormat$1(action.input.dateDelivered) : state.dateDelivered;
		newState.invoiceNo = action.input.invoiceNo ?? state.invoiceNo;
		newState.notes = action.input.notes ?? state.notes;
		Object.assign(state, newState);
	},
	editStatusOperation(state, action) {
		if (state.status === "DRAFT" && action.input.status !== "DRAFT" && action.input.status !== "CANCELLED") {
			const wallet = state.issuer?.paymentRouting?.wallet;
			if (!wallet?.address || !wallet.chainName && !wallet.chainId) throw new Error("Issuer wallet address and chain must be set before moving out of DRAFT");
		}
		state.status = action.input.status;
	},
	editPaymentDataOperation(state, action) {
		const payment = state.payments.find((payment) => payment.id === action.input.id);
		if (payment) {
			payment.processorRef = action.input.processorRef ?? payment.processorRef;
			payment.paymentDate = action.input.paymentDate ?? payment.paymentDate;
			payment.txnRef = action.input.txnRef ?? payment.txnRef;
			payment.confirmed = action.input.confirmed ?? payment.confirmed;
			payment.issue = action.input.issue ?? payment.issue;
		}
	},
	addPaymentOperation(state, action) {
		const payment = {
			id: action.input.id,
			processorRef: action.input.processorRef ?? "",
			paymentDate: ensureDatetimeFormat$1(action.input.paymentDate) ?? null,
			txnRef: action.input.txnRef ?? "",
			confirmed: action.input.confirmed ?? false,
			issue: action.input.issue ?? "",
			amount: 0
		};
		state.payments.push(payment);
	},
	setExportedDataOperation(state, action) {
		state.exported = {
			timestamp: action.input.timestamp,
			exportedLineItems: action.input.exportedLineItems
		};
	}
};
//#endregion
//#region document-models/invoice/v1/src/reducers/parties.ts
function getStateValue(input, currentValue) {
	return input === void 0 ? currentValue : input;
}
const invoicePartiesOperations = {
	editIssuerOperation(state, action) {
		if ("address" in state.issuer && ("city" in action.input || "country" in action.input || "extendedAddress" in action.input || "postalCode" in action.input || "stateProvince" in action.input || "streetAddress" in action.input)) state.issuer.address = {
			...state.issuer.address,
			city: action.input.city !== void 0 ? action.input.city : state.issuer.address?.city ?? null,
			country: action.input.country !== void 0 ? action.input.country : state.issuer.address?.country ?? null,
			extendedAddress: action.input.extendedAddress !== void 0 ? action.input.extendedAddress : state.issuer.address?.extendedAddress ?? null,
			postalCode: action.input.postalCode !== void 0 ? action.input.postalCode : state.issuer.address?.postalCode ?? null,
			stateProvince: action.input.stateProvince !== void 0 ? action.input.stateProvince : state.issuer.address?.stateProvince ?? null,
			streetAddress: action.input.streetAddress !== void 0 ? action.input.streetAddress : state.issuer.address?.streetAddress ?? null
		};
		if ("contactInfo" in state.issuer && ("tel" in action.input || "email" in action.input)) state.issuer.contactInfo = {
			...state.issuer.contactInfo,
			tel: action.input.tel !== void 0 ? action.input.tel : state.issuer.contactInfo?.tel ?? null,
			email: action.input.email !== void 0 ? action.input.email : state.issuer.contactInfo?.email ?? null
		};
		if ("country" in action.input) state.issuer.country = action.input.country !== void 0 ? action.input.country : state.issuer.country ?? null;
		if ("id" in action.input) state.issuer.id = action.input.id ? {
			corpRegId: action.input.id,
			taxId: null
		} : null;
		if ("name" in action.input) state.issuer.name = action.input.name !== void 0 ? action.input.name : state.issuer.name ?? null;
	},
	editIssuerBankOperation(state, action) {
		if (!state.issuer.paymentRouting) state.issuer.paymentRouting = {
			bank: null,
			wallet: null
		};
		state.issuer.paymentRouting.bank = {
			ABA: getStateValue(action.input.ABA, state.issuer.paymentRouting.bank?.ABA ?? null),
			BIC: getStateValue(action.input.BIC, state.issuer.paymentRouting.bank?.BIC ?? null),
			SWIFT: getStateValue(action.input.SWIFT, state.issuer.paymentRouting.bank?.SWIFT ?? null),
			accountNum: action.input.accountNum ?? state.issuer.paymentRouting.bank?.accountNum ?? "",
			accountType: getStateValue(action.input.accountType, state.issuer.paymentRouting.bank?.accountType ?? null),
			address: {
				city: getStateValue(action.input.city, state.issuer.paymentRouting.bank?.address.city ?? null),
				country: getStateValue(action.input.country, state.issuer.paymentRouting.bank?.address.country ?? null),
				extendedAddress: getStateValue(action.input.extendedAddress, state.issuer.paymentRouting.bank?.address.extendedAddress ?? null),
				postalCode: getStateValue(action.input.postalCode, state.issuer.paymentRouting.bank?.address.postalCode ?? null),
				stateProvince: getStateValue(action.input.stateProvince, state.issuer.paymentRouting.bank?.address.stateProvince ?? null),
				streetAddress: getStateValue(action.input.streetAddress, state.issuer.paymentRouting.bank?.address.streetAddress ?? null)
			},
			beneficiary: getStateValue(action.input.beneficiary, state.issuer.paymentRouting.bank?.beneficiary ?? null),
			name: action.input.name ?? state.issuer.paymentRouting.bank?.name ?? "",
			memo: getStateValue(action.input.memo, state.issuer.paymentRouting.bank?.memo ?? null),
			intermediaryBank: {
				ABA: getStateValue(action.input.ABAIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.ABA ?? null),
				BIC: getStateValue(action.input.BICIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.BIC ?? null),
				SWIFT: getStateValue(action.input.SWIFTIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.SWIFT ?? null),
				accountNum: action.input.accountNumIntermediary ?? state.issuer.paymentRouting.bank?.intermediaryBank?.accountNum ?? "",
				accountType: getStateValue(action.input.accountTypeIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.accountType ?? null),
				address: {
					city: getStateValue(action.input.cityIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address.city ?? null),
					country: getStateValue(action.input.countryIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address.country ?? null),
					extendedAddress: getStateValue(action.input.extendedAddressIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address.extendedAddress ?? null),
					postalCode: getStateValue(action.input.postalCodeIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address.postalCode ?? null),
					stateProvince: getStateValue(action.input.stateProvinceIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address.stateProvince ?? null),
					streetAddress: getStateValue(action.input.streetAddressIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address.streetAddress ?? null)
				},
				beneficiary: getStateValue(action.input.beneficiaryIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.beneficiary ?? null),
				name: action.input.nameIntermediary ?? state.issuer.paymentRouting.bank?.intermediaryBank?.name ?? "",
				memo: getStateValue(action.input.memoIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.memo ?? null)
			}
		};
	},
	editIssuerWalletOperation(state, action) {
		if (!state.issuer.paymentRouting) state.issuer.paymentRouting = {
			bank: null,
			wallet: null
		};
		state.issuer.paymentRouting.wallet = {
			address: action.input.address ?? state.issuer.paymentRouting.wallet?.address ?? null,
			chainId: action.input.chainId ?? state.issuer.paymentRouting.wallet?.chainId ?? null,
			chainName: action.input.chainName ?? state.issuer.paymentRouting.wallet?.chainName ?? null,
			rpc: action.input.rpc ?? state.issuer.paymentRouting.wallet?.rpc ?? null
		};
	},
	editPayerOperation(state, action) {
		if ("address" in state.payer && ("city" in action.input || "country" in action.input || "extendedAddress" in action.input || "postalCode" in action.input || "stateProvince" in action.input || "streetAddress" in action.input)) state.payer.address = {
			...state.payer.address,
			city: action.input.city !== void 0 ? action.input.city : state.payer.address?.city ?? null,
			country: action.input.country !== void 0 ? action.input.country : state.payer.address?.country ?? null,
			extendedAddress: action.input.extendedAddress !== void 0 ? action.input.extendedAddress : state.payer.address?.extendedAddress ?? null,
			postalCode: action.input.postalCode !== void 0 ? action.input.postalCode : state.payer.address?.postalCode ?? null,
			stateProvince: action.input.stateProvince !== void 0 ? action.input.stateProvince : state.payer.address?.stateProvince ?? null,
			streetAddress: action.input.streetAddress !== void 0 ? action.input.streetAddress : state.payer.address?.streetAddress ?? null
		};
		if ("contactInfo" in state.payer && ("tel" in action.input || "email" in action.input)) state.payer.contactInfo = {
			...state.payer.contactInfo,
			tel: action.input.tel !== void 0 ? action.input.tel : state.payer.contactInfo?.tel ?? null,
			email: action.input.email !== void 0 ? action.input.email : state.payer.contactInfo?.email ?? null
		};
		if ("country" in action.input) state.payer.country = action.input.country !== void 0 ? action.input.country : state.payer.country ?? null;
		if ("id" in action.input) state.payer.id = action.input.id ? {
			taxId: action.input.id,
			corpRegId: null
		} : null;
		if ("name" in action.input) state.payer.name = action.input.name !== void 0 ? action.input.name : state.payer.name ?? null;
	},
	editPayerBankOperation(state, action) {
		if (!state.payer.paymentRouting) state.payer.paymentRouting = {
			bank: null,
			wallet: null
		};
		state.payer.paymentRouting.bank = {
			ABA: getStateValue(action.input.ABA, state.payer.paymentRouting.bank?.ABA ?? null),
			BIC: getStateValue(action.input.BIC, state.payer.paymentRouting.bank?.BIC ?? null),
			SWIFT: getStateValue(action.input.SWIFT, state.payer.paymentRouting.bank?.SWIFT ?? null),
			accountNum: action.input.accountNum ?? state.payer.paymentRouting.bank?.accountNum ?? "",
			accountType: getStateValue(action.input.accountType, state.payer.paymentRouting.bank?.accountType ?? null),
			address: {
				city: getStateValue(action.input.city, state.payer.paymentRouting.bank?.address.city ?? null),
				country: getStateValue(action.input.country, state.payer.paymentRouting.bank?.address.country ?? null),
				extendedAddress: getStateValue(action.input.extendedAddress, state.payer.paymentRouting.bank?.address.extendedAddress ?? null),
				postalCode: getStateValue(action.input.postalCode, state.payer.paymentRouting.bank?.address.postalCode ?? null),
				stateProvince: getStateValue(action.input.stateProvince, state.payer.paymentRouting.bank?.address.stateProvince ?? null),
				streetAddress: getStateValue(action.input.streetAddress, state.payer.paymentRouting.bank?.address.streetAddress ?? null)
			},
			beneficiary: getStateValue(action.input.beneficiary, state.payer.paymentRouting.bank?.beneficiary ?? null),
			name: action.input.name ?? state.payer.paymentRouting.bank?.name ?? "",
			memo: getStateValue(action.input.memo, state.payer.paymentRouting.bank?.memo ?? null),
			intermediaryBank: {
				ABA: getStateValue(action.input.ABAIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.ABA ?? null),
				BIC: getStateValue(action.input.BICIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.BIC ?? null),
				SWIFT: getStateValue(action.input.SWIFTIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.SWIFT ?? null),
				accountNum: action.input.accountNumIntermediary ?? state.payer.paymentRouting.bank?.intermediaryBank?.accountNum ?? "",
				accountType: getStateValue(action.input.accountTypeIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.accountType ?? null),
				address: {
					city: getStateValue(action.input.cityIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.address.city ?? null),
					country: getStateValue(action.input.countryIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.address.country ?? null),
					extendedAddress: getStateValue(action.input.extendedAddressIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.address.extendedAddress ?? null),
					postalCode: getStateValue(action.input.postalCodeIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.address.postalCode ?? null),
					stateProvince: getStateValue(action.input.stateProvinceIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.address.stateProvince ?? null),
					streetAddress: getStateValue(action.input.streetAddressIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.address.streetAddress ?? null)
				},
				beneficiary: getStateValue(action.input.beneficiaryIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.beneficiary ?? null),
				name: action.input.nameIntermediary ?? state.payer.paymentRouting.bank?.intermediaryBank?.name ?? "",
				memo: getStateValue(action.input.memoIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.memo ?? null)
			}
		};
	},
	editPayerWalletOperation(state, action) {
		if (!state.payer.paymentRouting) state.payer.paymentRouting = {
			bank: null,
			wallet: null
		};
		state.payer.paymentRouting.wallet = {
			address: action.input.address ?? state.payer.paymentRouting.wallet?.address ?? null,
			chainId: action.input.chainId ?? state.payer.paymentRouting.wallet?.chainId ?? null,
			chainName: action.input.chainName ?? state.payer.paymentRouting.wallet?.chainName ?? null,
			rpc: action.input.rpc ?? state.payer.paymentRouting.wallet?.rpc ?? null
		};
	}
};
//#endregion
//#region document-models/invoice/v1/src/reducers/items.ts
const invoiceItemsOperations = {
	addLineItemOperation(state, action) {
		const item = {
			...action.input,
			lineItemTag: []
		};
		if (state.lineItems.find((x) => x.id === item.id)) throw new Error("Duplicate input.id");
		validatePrices(item);
		state.lineItems.push(item);
		updateTotals(state);
	},
	editLineItemOperation(state, action) {
		const stateItem = state.lineItems.find((x) => x.id === action.input.id);
		if (!stateItem) throw new Error("Item matching input.id not found");
		const sanitizedInput = Object.fromEntries(Object.entries(action.input).filter(([, value]) => value !== null));
		if ("lineItemTag" in action.input) sanitizedInput.lineItemTag = action.input.lineItemTag ?? [];
		const nextItem = {
			...stateItem,
			...sanitizedInput
		};
		validatePrices(nextItem);
		applyInvariants(state, nextItem);
		Object.assign(stateItem, nextItem);
		updateTotals(state);
	},
	deleteLineItemOperation(state, action) {
		state.lineItems = state.lineItems.filter((x) => x.id !== action.input.id);
		updateTotals(state);
	},
	setLineItemTagOperation(state, action) {
		const stateItem = state.lineItems.find((x) => x.id === action.input.lineItemId);
		if (!stateItem) throw new Error("Item matching input.id not found");
		const existingTag = stateItem.lineItemTag?.find((tag) => tag.dimension === action.input.dimension);
		if (existingTag) {
			existingTag.value = action.input.value;
			existingTag.label = action.input.label || null;
		} else {
			const newTag = {
				dimension: action.input.dimension,
				value: action.input.value,
				label: action.input.label || null
			};
			if (!stateItem.lineItemTag) stateItem.lineItemTag = [];
			stateItem.lineItemTag?.push(newTag);
		}
	},
	setInvoiceTagOperation(state, action) {
		const existingTag = state.invoiceTags?.find((tag) => tag.dimension === action.input.dimension);
		if (existingTag) {
			existingTag.value = action.input.value;
			existingTag.label = action.input.label || null;
		} else {
			const newTag = {
				dimension: action.input.dimension,
				value: action.input.value,
				label: action.input.label || null
			};
			if (!state.invoiceTags) state.invoiceTags = [];
			state.invoiceTags.push(newTag);
		}
	}
};
function updateTotals(state) {
	state.totalPriceTaxExcl = state.lineItems.reduce((total, lineItem) => {
		return total + lineItem.quantity * lineItem.unitPriceTaxExcl;
	}, 0);
	state.totalPriceTaxIncl = state.lineItems.reduce((total, lineItem) => {
		return total + lineItem.quantity * lineItem.unitPriceTaxIncl;
	}, 0);
}
function validatePrices(item) {
	const EPSILON = 1e-5;
	const calcPriceIncl = item.quantity * item.unitPriceTaxIncl;
	const calcPriceExcl = item.quantity * item.unitPriceTaxExcl;
	const taxRate = item.taxPercent / 100;
	const isClose = (a, b) => Math.abs(a - b) < EPSILON;
	const expectedUnitPriceExcl = item.unitPriceTaxIncl / (1 + taxRate);
	if (!isClose(item.unitPriceTaxExcl, expectedUnitPriceExcl)) throw new Error("Tax inclusive/exclusive unit prices failed comparison.");
	if (!isClose(calcPriceIncl, item.totalPriceTaxIncl)) throw new Error("Calculated unitPriceTaxIncl does not match input total");
	if (!isClose(calcPriceExcl, item.totalPriceTaxExcl)) throw new Error("Calculated unitPriceTaxExcl does not match input total");
	if (!isClose(calcPriceExcl, calcPriceIncl / (1 + taxRate))) throw new Error("Tax inclusive/exclusive totals failed comparison.");
}
const applyInvariants = (state, nextItem) => {
	const EPSILON = 1e-5;
	const isClose = (a, b) => Math.abs(a - b) < EPSILON;
	const hasChanged = (oldValue, newValue) => !isClose(oldValue, newValue);
	if (!state.lineItems.find((item) => item.id === nextItem.id)) return;
	const taxRate = nextItem.taxPercent / 100;
	if (hasChanged(nextItem.quantity * nextItem.unitPriceTaxExcl, nextItem.totalPriceTaxExcl)) {
		nextItem.unitPriceTaxExcl = nextItem.totalPriceTaxExcl / nextItem.quantity;
		nextItem.unitPriceTaxIncl = nextItem.unitPriceTaxExcl * (1 + taxRate);
		nextItem.totalPriceTaxIncl = nextItem.quantity * nextItem.unitPriceTaxIncl;
	}
	if (hasChanged(nextItem.quantity * nextItem.unitPriceTaxIncl, nextItem.totalPriceTaxIncl)) {
		nextItem.unitPriceTaxIncl = nextItem.totalPriceTaxIncl / nextItem.quantity;
		nextItem.unitPriceTaxExcl = nextItem.unitPriceTaxIncl / (1 + taxRate);
		nextItem.totalPriceTaxExcl = nextItem.quantity * nextItem.unitPriceTaxExcl;
	}
	if (hasChanged(nextItem.unitPriceTaxExcl * (1 + taxRate), nextItem.unitPriceTaxIncl)) {
		nextItem.unitPriceTaxIncl = nextItem.unitPriceTaxExcl * (1 + taxRate);
		nextItem.totalPriceTaxExcl = nextItem.quantity * nextItem.unitPriceTaxExcl;
		nextItem.totalPriceTaxIncl = nextItem.quantity * nextItem.unitPriceTaxIncl;
	}
	if (hasChanged(nextItem.unitPriceTaxIncl / (1 + taxRate), nextItem.unitPriceTaxExcl)) {
		nextItem.unitPriceTaxExcl = nextItem.unitPriceTaxIncl / (1 + taxRate);
		nextItem.totalPriceTaxExcl = nextItem.quantity * nextItem.unitPriceTaxExcl;
		nextItem.totalPriceTaxIncl = nextItem.quantity * nextItem.unitPriceTaxIncl;
	}
};
//#endregion
//#region document-models/invoice/v1/src/reducers/transitions.ts
/**
* Converts a date string to ISO datetime format if it's not already in that format
* Handles both date-only (YYYY-MM-DD) and datetime (YYYY-MM-DDTHH:mm:ss.sssZ) strings
*/
function ensureDatetimeFormat(dateStr) {
	if (!dateStr || dateStr.trim() === "") return null;
	if (dateStr.includes("T")) return dateStr;
	return `${dateStr}T00:00:00.000Z`;
}
const permittedTransitions = {
	DRAFT: ["CANCELLED", "ISSUED"],
	CANCELLED: ["DRAFT"],
	ISSUED: ["REJECTED", "ACCEPTED"],
	REJECTED: ["ISSUED"],
	ACCEPTED: ["PAYMENTSCHEDULED", "PAYMENTCLOSED"],
	PAYMENTSCHEDULED: [
		"PAYMENTSENT",
		"PAYMENTISSUE",
		"PAYMENTCLOSED"
	],
	PAYMENTSENT: ["PAYMENTISSUE", "PAYMENTRECEIVED"],
	PAYMENTISSUE: ["ACCEPTED", "PAYMENTCLOSED"],
	PAYMENTRECEIVED: ["PAYMENTISSUE"],
	PAYMENTCLOSED: ["ACCEPTED"]
};
const invoiceTransitionsOperations = {
	cancelOperation(state) {
		if (permittedTransitions[state.status].includes("CANCELLED")) state.status = "CANCELLED";
		else throw new Error(`Invalid transition from ${state.status} to CANCELLED`);
	},
	issueOperation(state, action) {
		if (!action.input.invoiceNo || !action.input.dateIssued) throw new Error("Invoice number and date issued are required");
		const wallet = state.issuer?.paymentRouting?.wallet;
		if ([
			"USDS",
			"DAI",
			"USDC"
		].includes(state.currency.toUpperCase()) && (!wallet?.address || !wallet.chainName && !wallet.chainId)) throw new Error("Issuer wallet address and chain must be set before issuing an invoice");
		if (permittedTransitions[state.status].includes("ISSUED")) {
			state.status = "ISSUED";
			state.invoiceNo = action.input.invoiceNo;
			state.dateIssued = ensureDatetimeFormat(action.input.dateIssued) || action.input.dateIssued;
		} else throw new Error(`Invalid transition from ${state.status} to ISSUED`);
	},
	resetOperation(state) {
		if (permittedTransitions[state.status].includes("DRAFT")) state.status = "DRAFT";
		else throw new Error(`Invalid transition from ${state.status} to DRAFT`);
	},
	rejectOperation(state, action) {
		if (!action.input.id || !action.input.reason) throw new Error("Reason, ID and final are required");
		if (permittedTransitions[state.status].includes("REJECTED")) {
			state.status = "REJECTED";
			const rejection = {
				id: action.input.id,
				reason: action.input.reason,
				final: action.input.final
			};
			state.rejections.push(rejection);
		} else throw new Error(`Invalid transition from ${state.status} to REJECTED`);
	},
	acceptOperation(state, action) {
		if (!action.input.payAfter) throw new Error("Pay after is required");
		if (permittedTransitions[state.status].includes("ACCEPTED")) {
			state.status = "ACCEPTED";
			state.payAfter = action.input.payAfter;
		} else throw new Error(`Invalid transition from ${state.status} to ACCEPTED`);
	},
	reinstateOperation(state) {
		if (state.rejections.find((rejection) => rejection.final === true)) throw new Error("Cannot reinstate an invoice that has been rejected");
		if (permittedTransitions[state.status].includes("ISSUED")) state.status = "ISSUED";
		else throw new Error(`Invalid transition from ${state.status} to ISSUED`);
	},
	schedulePaymentOperation(state, action) {
		if (!action.input.id || !action.input.processorRef) throw new Error("ID and processorRef are required");
		if (permittedTransitions[state.status].includes("PAYMENTSCHEDULED")) {
			state.status = "PAYMENTSCHEDULED";
			state.payments.push({
				id: action.input.id,
				processorRef: action.input.processorRef,
				paymentDate: action.input.paymentDate,
				txnRef: "",
				confirmed: false,
				issue: "",
				amount: 0
			});
		} else throw new Error(`Invalid transition from ${state.status} to PAYMENTSCHEDULED`);
	},
	reapprovePaymentOperation(state) {
		if (permittedTransitions[state.status].includes("ACCEPTED")) state.status = "ACCEPTED";
		else throw new Error(`Invalid transition from ${state.status} to ACCEPTED`);
	},
	registerPaymentTxOperation(state, action) {
		if (permittedTransitions[state.status].includes("PAYMENTSENT")) {
			state.status = "PAYMENTSENT";
			const payment = state.payments.find((payment) => payment.id === action.input.id);
			if (!payment) throw new Error("Payment not found");
			payment.txnRef = action.input.txRef;
			payment.paymentDate = action.input.timestamp;
		} else throw new Error(`Invalid transition from ${state.status} to PAYMENTSENT`);
	},
	reportPaymentIssueOperation(state, action) {
		if (!action.input.id || !action.input.issue) throw new Error("ID and issue are required");
		if (permittedTransitions[state.status].includes("PAYMENTISSUE")) {
			state.status = "PAYMENTISSUE";
			const payment = state.payments.find((payment) => payment.id === action.input.id);
			if (!payment) throw new Error("Payment not found");
			payment.issue = action.input.issue;
		} else throw new Error(`Invalid transition from ${state.status} to PAYMENTISSUE`);
	},
	confirmPaymentOperation(state, action) {
		if (!action.input.id || !action.input.amount) throw new Error("ID and amount are required");
		if (permittedTransitions[state.status].includes("PAYMENTRECEIVED")) {
			state.status = "PAYMENTRECEIVED";
			const payment = state.payments.find((payment) => payment.id === action.input.id);
			if (!payment) throw new Error("Payment not found");
			payment.confirmed = true;
			payment.amount = action.input.amount;
		} else throw new Error(`Invalid transition from ${state.status} to PAYMENTRECEIVED`);
	},
	closePaymentOperation(state, action) {
		if (!action.input.closureReason) throw new Error("Closure reason is required");
		if (permittedTransitions[state.status].includes("PAYMENTCLOSED")) {
			state.status = "PAYMENTCLOSED";
			state.closureReason = action.input.closureReason;
		} else throw new Error(`Invalid transition from ${state.status} to PAYMENTCLOSED`);
	}
};
//#endregion
//#region document-models/invoice/v1/gen/schema/zod.ts
const isDefinedNonNullAny = (v) => v !== void 0 && v !== null;
const definedNonNullAnySchema = any().refine((v) => isDefinedNonNullAny(v));
const ClosureReasonSchema = _enum([
	"CANCELLED",
	"OVERPAID",
	"UNDERPAID"
]);
const ClosureReasonInputSchema = _enum([
	"CANCELLED",
	"OVERPAID",
	"UNDERPAID"
]);
const InvoiceAccountTypeSchema = _enum([
	"CHECKING",
	"SAVINGS",
	"TRUST",
	"WALLET"
]);
const InvoiceAccountTypeInputSchema = _enum([
	"CHECKING",
	"SAVINGS",
	"TRUST",
	"WALLET"
]);
const StatusSchema = _enum([
	"ACCEPTED",
	"CANCELLED",
	"DRAFT",
	"ISSUED",
	"PAYMENTCLOSED",
	"PAYMENTISSUE",
	"PAYMENTRECEIVED",
	"PAYMENTSCHEDULED",
	"PAYMENTSENT",
	"REJECTED"
]);
function AcceptInputSchema() {
	return object({ payAfter: datetime().nullish() });
}
function AddLineItemInputSchema() {
	return object({
		currency: string(),
		description: string(),
		id: string(),
		quantity: number(),
		taxPercent: number(),
		totalPriceTaxExcl: number(),
		totalPriceTaxIncl: number(),
		unitPriceTaxExcl: number(),
		unitPriceTaxIncl: number()
	});
}
function AddPaymentInputSchema() {
	return object({
		confirmed: boolean(),
		id: string(),
		issue: string().nullish(),
		paymentDate: datetime().nullish(),
		processorRef: string().nullish(),
		txnRef: string().nullish()
	});
}
function AddressSchema() {
	return object({
		__typename: literal("Address").optional(),
		city: string().nullish(),
		country: string().nullish(),
		extendedAddress: string().nullish(),
		postalCode: string().nullish(),
		stateProvince: string().nullish(),
		streetAddress: string().nullish()
	});
}
function BankSchema() {
	return object({
		__typename: literal("Bank").optional(),
		ABA: string().nullish(),
		BIC: string().nullish(),
		SWIFT: string().nullish(),
		accountNum: string(),
		accountType: InvoiceAccountTypeSchema.nullish(),
		address: lazy(() => AddressSchema()),
		beneficiary: string().nullish(),
		intermediaryBank: lazy(() => IntermediaryBankSchema().nullish()),
		memo: string().nullish(),
		name: string()
	});
}
function CancelInputSchema() {
	return object({ _placeholder: string().nullish() });
}
function ClosePaymentInputSchema() {
	return object({ closureReason: ClosureReasonInputSchema.nullish() });
}
function ConfirmPaymentInputSchema() {
	return object({
		amount: number(),
		id: string()
	});
}
function ContactInfoSchema() {
	return object({
		__typename: literal("ContactInfo").optional(),
		email: string().nullish(),
		tel: string().nullish()
	});
}
function DeleteLineItemInputSchema() {
	return object({ id: string() });
}
function EditInvoiceInputSchema() {
	return object({
		currency: string().nullish(),
		dateDelivered: string().nullish(),
		dateDue: string().nullish(),
		dateIssued: string().nullish(),
		invoiceNo: string().nullish(),
		notes: string().nullish()
	});
}
function EditIssuerBankInputSchema() {
	return object({
		ABA: string().nullish(),
		ABAIntermediary: string().nullish(),
		BIC: string().nullish(),
		BICIntermediary: string().nullish(),
		SWIFT: string().nullish(),
		SWIFTIntermediary: string().nullish(),
		accountNum: string().nullish(),
		accountNumIntermediary: string().nullish(),
		accountType: InvoiceAccountTypeInputSchema.nullish(),
		accountTypeIntermediary: InvoiceAccountTypeInputSchema.nullish(),
		beneficiary: string().nullish(),
		beneficiaryIntermediary: string().nullish(),
		city: string().nullish(),
		cityIntermediary: string().nullish(),
		country: string().nullish(),
		countryIntermediary: string().nullish(),
		extendedAddress: string().nullish(),
		extendedAddressIntermediary: string().nullish(),
		memo: string().nullish(),
		memoIntermediary: string().nullish(),
		name: string().nullish(),
		nameIntermediary: string().nullish(),
		postalCode: string().nullish(),
		postalCodeIntermediary: string().nullish(),
		stateProvince: string().nullish(),
		stateProvinceIntermediary: string().nullish(),
		streetAddress: string().nullish(),
		streetAddressIntermediary: string().nullish()
	});
}
function EditIssuerInputSchema() {
	return object({
		city: string().nullish(),
		country: string().nullish(),
		email: string().nullish(),
		extendedAddress: string().nullish(),
		id: string().nullish(),
		name: string().nullish(),
		postalCode: string().nullish(),
		stateProvince: string().nullish(),
		streetAddress: string().nullish(),
		tel: string().nullish()
	});
}
function EditIssuerWalletInputSchema() {
	return object({
		address: string().nullish(),
		chainId: string().nullish(),
		chainName: string().nullish(),
		rpc: string().nullish()
	});
}
function EditLineItemInputSchema() {
	return object({
		currency: string().nullish(),
		description: string().nullish(),
		id: string(),
		quantity: number().nullish(),
		taxPercent: number().nullish(),
		totalPriceTaxExcl: number().nullish(),
		totalPriceTaxIncl: number().nullish(),
		unitPriceTaxExcl: number().nullish(),
		unitPriceTaxIncl: number().nullish()
	});
}
function EditPayerBankInputSchema() {
	return object({
		ABA: string().nullish(),
		ABAIntermediary: string().nullish(),
		BIC: string().nullish(),
		BICIntermediary: string().nullish(),
		SWIFT: string().nullish(),
		SWIFTIntermediary: string().nullish(),
		accountNum: string().nullish(),
		accountNumIntermediary: string().nullish(),
		accountType: InvoiceAccountTypeInputSchema.nullish(),
		accountTypeIntermediary: InvoiceAccountTypeInputSchema.nullish(),
		beneficiary: string().nullish(),
		beneficiaryIntermediary: string().nullish(),
		city: string().nullish(),
		cityIntermediary: string().nullish(),
		country: string().nullish(),
		countryIntermediary: string().nullish(),
		extendedAddress: string().nullish(),
		extendedAddressIntermediary: string().nullish(),
		memo: string().nullish(),
		memoIntermediary: string().nullish(),
		name: string().nullish(),
		nameIntermediary: string().nullish(),
		postalCode: string().nullish(),
		postalCodeIntermediary: string().nullish(),
		stateProvince: string().nullish(),
		stateProvinceIntermediary: string().nullish(),
		streetAddress: string().nullish(),
		streetAddressIntermediary: string().nullish()
	});
}
function EditPayerInputSchema() {
	return object({
		city: string().nullish(),
		country: string().nullish(),
		email: string().nullish(),
		extendedAddress: string().nullish(),
		id: string().nullish(),
		name: string().nullish(),
		postalCode: string().nullish(),
		stateProvince: string().nullish(),
		streetAddress: string().nullish(),
		tel: string().nullish()
	});
}
function EditPayerWalletInputSchema() {
	return object({
		address: string().nullish(),
		chainId: string().nullish(),
		chainName: string().nullish(),
		rpc: string().nullish()
	});
}
function EditPaymentDataInputSchema() {
	return object({
		confirmed: boolean(),
		id: string(),
		issue: string().nullish(),
		paymentDate: datetime().nullish(),
		processorRef: string().nullish(),
		txnRef: string().nullish()
	});
}
function EditStatusInputSchema() {
	return object({ status: StatusSchema });
}
function ExportedDataSchema() {
	return object({
		__typename: literal("ExportedData").optional(),
		exportedLineItems: array(array(string())),
		timestamp: datetime().nullish()
	});
}
function IntermediaryBankSchema() {
	return object({
		__typename: literal("IntermediaryBank").optional(),
		ABA: string().nullish(),
		BIC: string().nullish(),
		SWIFT: string().nullish(),
		accountNum: string(),
		accountType: InvoiceAccountTypeSchema.nullish(),
		address: lazy(() => AddressSchema()),
		beneficiary: string().nullish(),
		memo: string().nullish(),
		name: string()
	});
}
function InvoiceLineItemSchema() {
	return object({
		__typename: literal("InvoiceLineItem").optional(),
		currency: string(),
		description: string(),
		id: string(),
		lineItemTag: array(lazy(() => InvoiceTagSchema())).nullish(),
		quantity: number(),
		taxPercent: number(),
		totalPriceTaxExcl: number(),
		totalPriceTaxIncl: number(),
		unitPriceTaxExcl: number(),
		unitPriceTaxIncl: number()
	});
}
function InvoiceStateSchema() {
	return object({
		__typename: literal("InvoiceState").optional(),
		closureReason: ClosureReasonSchema.nullish(),
		currency: string(),
		dateDelivered: datetime().nullish(),
		dateDue: datetime().nullish(),
		dateIssued: datetime().nullish(),
		exported: lazy(() => ExportedDataSchema()),
		invoiceNo: string(),
		invoiceTags: array(lazy(() => InvoiceTagSchema())),
		issuer: lazy(() => LegalEntitySchema()),
		lineItems: array(lazy(() => InvoiceLineItemSchema())),
		notes: string().nullish(),
		payAfter: datetime().nullish(),
		payer: lazy(() => LegalEntitySchema()),
		payments: array(lazy(() => PaymentSchema())),
		rejections: array(lazy(() => RejectionSchema())),
		status: StatusSchema,
		totalPriceTaxExcl: number(),
		totalPriceTaxIncl: number()
	});
}
function InvoiceTagSchema() {
	return object({
		__typename: literal("InvoiceTag").optional(),
		dimension: string(),
		label: string().nullish(),
		value: string()
	});
}
function InvoiceWalletSchema() {
	return object({
		__typename: literal("InvoiceWallet").optional(),
		address: string().nullish(),
		chainId: string().nullish(),
		chainName: string().nullish(),
		rpc: string().nullish()
	});
}
function IssueInputSchema() {
	return object({
		dateIssued: string(),
		invoiceNo: string()
	});
}
function LegalEntitySchema() {
	return object({
		__typename: literal("LegalEntity").optional(),
		address: lazy(() => AddressSchema().nullish()),
		contactInfo: lazy(() => ContactInfoSchema().nullish()),
		country: string().nullish(),
		id: lazy(() => LegalEntityIdSchema().nullish()),
		name: string().nullish(),
		paymentRouting: lazy(() => PaymentRoutingSchema().nullish())
	});
}
function LegalEntityIdSchema() {
	return object({
		__typename: literal("LegalEntityId").optional(),
		corpRegId: string().nullish(),
		taxId: string().nullish()
	});
}
function PaymentSchema() {
	return object({
		__typename: literal("Payment").optional(),
		amount: number().nullish(),
		confirmed: boolean(),
		id: string(),
		issue: string().nullish(),
		paymentDate: datetime().nullish(),
		processorRef: string().nullish(),
		txnRef: string().nullish()
	});
}
function PaymentRoutingSchema() {
	return object({
		__typename: literal("PaymentRouting").optional(),
		bank: lazy(() => BankSchema().nullish()),
		wallet: lazy(() => InvoiceWalletSchema().nullish())
	});
}
function ReapprovePaymentInputSchema() {
	return object({ _placeholder: string().nullish() });
}
function RegisterPaymentTxInputSchema() {
	return object({
		id: string(),
		timestamp: datetime(),
		txRef: string()
	});
}
function ReinstateInputSchema() {
	return object({ _placeholder: string().nullish() });
}
function RejectInputSchema() {
	return object({
		final: boolean(),
		id: string(),
		reason: string()
	});
}
function RejectionSchema() {
	return object({
		__typename: literal("Rejection").optional(),
		final: boolean(),
		id: string(),
		reason: string()
	});
}
function ReportPaymentIssueInputSchema() {
	return object({
		id: string(),
		issue: string()
	});
}
function ResetInputSchema() {
	return object({ _placeholder: string().nullish() });
}
function SchedulePaymentInputSchema() {
	return object({
		id: string(),
		paymentDate: datetime().nullish(),
		processorRef: string()
	});
}
function SetExportedDataInputSchema() {
	return object({
		exportedLineItems: array(array(string())),
		timestamp: datetime()
	});
}
function SetInvoiceTagInputSchema() {
	return object({
		dimension: string(),
		label: string().nullish(),
		value: string()
	});
}
function SetLineItemTagInputSchema() {
	return object({
		dimension: string(),
		label: string().nullish(),
		lineItemId: string(),
		value: string()
	});
}
function TokenSchema() {
	return object({
		__typename: literal("Token").optional(),
		chainId: string().nullish(),
		chainName: string().nullish(),
		evmAddress: string().nullish(),
		rpc: string().nullish(),
		symbol: string().nullish()
	});
}
//#endregion
//#region document-models/invoice/v1/gen/reducer.ts
const stateReducer = (state, action, dispatch) => {
	if (isDocumentAction(action)) return state;
	switch (action.type) {
		case "EDIT_INVOICE":
			EditInvoiceInputSchema().parse(action.input);
			invoiceGeneralOperations.editInvoiceOperation(state[action.scope], action, dispatch);
			break;
		case "ADD_PAYMENT":
			AddPaymentInputSchema().parse(action.input);
			invoiceGeneralOperations.addPaymentOperation(state[action.scope], action, dispatch);
			break;
		case "EDIT_PAYMENT_DATA":
			EditPaymentDataInputSchema().parse(action.input);
			invoiceGeneralOperations.editPaymentDataOperation(state[action.scope], action, dispatch);
			break;
		case "EDIT_STATUS":
			EditStatusInputSchema().parse(action.input);
			invoiceGeneralOperations.editStatusOperation(state[action.scope], action, dispatch);
			break;
		case "SET_EXPORTED_DATA":
			SetExportedDataInputSchema().parse(action.input);
			invoiceGeneralOperations.setExportedDataOperation(state[action.scope], action, dispatch);
			break;
		case "EDIT_ISSUER_BANK":
			EditIssuerBankInputSchema().parse(action.input);
			invoicePartiesOperations.editIssuerBankOperation(state[action.scope], action, dispatch);
			break;
		case "EDIT_ISSUER":
			EditIssuerInputSchema().parse(action.input);
			invoicePartiesOperations.editIssuerOperation(state[action.scope], action, dispatch);
			break;
		case "EDIT_ISSUER_WALLET":
			EditIssuerWalletInputSchema().parse(action.input);
			invoicePartiesOperations.editIssuerWalletOperation(state[action.scope], action, dispatch);
			break;
		case "EDIT_PAYER_BANK":
			EditPayerBankInputSchema().parse(action.input);
			invoicePartiesOperations.editPayerBankOperation(state[action.scope], action, dispatch);
			break;
		case "EDIT_PAYER":
			EditPayerInputSchema().parse(action.input);
			invoicePartiesOperations.editPayerOperation(state[action.scope], action, dispatch);
			break;
		case "EDIT_PAYER_WALLET":
			EditPayerWalletInputSchema().parse(action.input);
			invoicePartiesOperations.editPayerWalletOperation(state[action.scope], action, dispatch);
			break;
		case "ADD_LINE_ITEM":
			AddLineItemInputSchema().parse(action.input);
			invoiceItemsOperations.addLineItemOperation(state[action.scope], action, dispatch);
			break;
		case "DELETE_LINE_ITEM":
			DeleteLineItemInputSchema().parse(action.input);
			invoiceItemsOperations.deleteLineItemOperation(state[action.scope], action, dispatch);
			break;
		case "EDIT_LINE_ITEM":
			EditLineItemInputSchema().parse(action.input);
			invoiceItemsOperations.editLineItemOperation(state[action.scope], action, dispatch);
			break;
		case "SET_INVOICE_TAG":
			SetInvoiceTagInputSchema().parse(action.input);
			invoiceItemsOperations.setInvoiceTagOperation(state[action.scope], action, dispatch);
			break;
		case "SET_LINE_ITEM_TAG":
			SetLineItemTagInputSchema().parse(action.input);
			invoiceItemsOperations.setLineItemTagOperation(state[action.scope], action, dispatch);
			break;
		case "ACCEPT":
			AcceptInputSchema().parse(action.input);
			invoiceTransitionsOperations.acceptOperation(state[action.scope], action, dispatch);
			break;
		case "CANCEL":
			CancelInputSchema().parse(action.input);
			invoiceTransitionsOperations.cancelOperation(state[action.scope], action, dispatch);
			break;
		case "CLOSE_PAYMENT":
			ClosePaymentInputSchema().parse(action.input);
			invoiceTransitionsOperations.closePaymentOperation(state[action.scope], action, dispatch);
			break;
		case "CONFIRM_PAYMENT":
			ConfirmPaymentInputSchema().parse(action.input);
			invoiceTransitionsOperations.confirmPaymentOperation(state[action.scope], action, dispatch);
			break;
		case "ISSUE":
			IssueInputSchema().parse(action.input);
			invoiceTransitionsOperations.issueOperation(state[action.scope], action, dispatch);
			break;
		case "REAPPROVE_PAYMENT":
			ReapprovePaymentInputSchema().parse(action.input);
			invoiceTransitionsOperations.reapprovePaymentOperation(state[action.scope], action, dispatch);
			break;
		case "REGISTER_PAYMENT_TX":
			RegisterPaymentTxInputSchema().parse(action.input);
			invoiceTransitionsOperations.registerPaymentTxOperation(state[action.scope], action, dispatch);
			break;
		case "REINSTATE":
			ReinstateInputSchema().parse(action.input);
			invoiceTransitionsOperations.reinstateOperation(state[action.scope], action, dispatch);
			break;
		case "REJECT":
			RejectInputSchema().parse(action.input);
			invoiceTransitionsOperations.rejectOperation(state[action.scope], action, dispatch);
			break;
		case "REPORT_PAYMENT_ISSUE":
			ReportPaymentIssueInputSchema().parse(action.input);
			invoiceTransitionsOperations.reportPaymentIssueOperation(state[action.scope], action, dispatch);
			break;
		case "RESET":
			ResetInputSchema().parse(action.input);
			invoiceTransitionsOperations.resetOperation(state[action.scope], action, dispatch);
			break;
		case "SCHEDULE_PAYMENT":
			SchedulePaymentInputSchema().parse(action.input);
			invoiceTransitionsOperations.schedulePaymentOperation(state[action.scope], action, dispatch);
			break;
		default: return state;
	}
};
const reducer = createReducer(stateReducer);
//#endregion
//#region document-models/invoice/v1/gen/general/creators.ts
var creators_exports$3 = /* @__PURE__ */ __exportAll({
	addPayment: () => addPayment,
	editInvoice: () => editInvoice,
	editPaymentData: () => editPaymentData,
	editStatus: () => editStatus,
	setExportedData: () => setExportedData
});
const editInvoice = (input) => createAction("EDIT_INVOICE", { ...input }, void 0, EditInvoiceInputSchema, "global");
const addPayment = (input) => createAction("ADD_PAYMENT", { ...input }, void 0, AddPaymentInputSchema, "global");
const editPaymentData = (input) => createAction("EDIT_PAYMENT_DATA", { ...input }, void 0, EditPaymentDataInputSchema, "global");
const editStatus = (input) => createAction("EDIT_STATUS", { ...input }, void 0, EditStatusInputSchema, "global");
const setExportedData = (input) => createAction("SET_EXPORTED_DATA", { ...input }, void 0, SetExportedDataInputSchema, "global");
//#endregion
//#region document-models/invoice/v1/gen/parties/creators.ts
var creators_exports$2 = /* @__PURE__ */ __exportAll({
	editIssuer: () => editIssuer,
	editIssuerBank: () => editIssuerBank,
	editIssuerWallet: () => editIssuerWallet,
	editPayer: () => editPayer,
	editPayerBank: () => editPayerBank,
	editPayerWallet: () => editPayerWallet
});
const editIssuerBank = (input) => createAction("EDIT_ISSUER_BANK", { ...input }, void 0, EditIssuerBankInputSchema, "global");
const editIssuer = (input) => createAction("EDIT_ISSUER", { ...input }, void 0, EditIssuerInputSchema, "global");
const editIssuerWallet = (input) => createAction("EDIT_ISSUER_WALLET", { ...input }, void 0, EditIssuerWalletInputSchema, "global");
const editPayerBank = (input) => createAction("EDIT_PAYER_BANK", { ...input }, void 0, EditPayerBankInputSchema, "global");
const editPayer = (input) => createAction("EDIT_PAYER", { ...input }, void 0, EditPayerInputSchema, "global");
const editPayerWallet = (input) => createAction("EDIT_PAYER_WALLET", { ...input }, void 0, EditPayerWalletInputSchema, "global");
//#endregion
//#region document-models/invoice/v1/gen/items/creators.ts
var creators_exports$1 = /* @__PURE__ */ __exportAll({
	addLineItem: () => addLineItem,
	deleteLineItem: () => deleteLineItem,
	editLineItem: () => editLineItem,
	setInvoiceTag: () => setInvoiceTag,
	setLineItemTag: () => setLineItemTag
});
const addLineItem = (input) => createAction("ADD_LINE_ITEM", { ...input }, void 0, AddLineItemInputSchema, "global");
const deleteLineItem = (input) => createAction("DELETE_LINE_ITEM", { ...input }, void 0, DeleteLineItemInputSchema, "global");
const editLineItem = (input) => createAction("EDIT_LINE_ITEM", { ...input }, void 0, EditLineItemInputSchema, "global");
const setInvoiceTag = (input) => createAction("SET_INVOICE_TAG", { ...input }, void 0, SetInvoiceTagInputSchema, "global");
const setLineItemTag = (input) => createAction("SET_LINE_ITEM_TAG", { ...input }, void 0, SetLineItemTagInputSchema, "global");
//#endregion
//#region document-models/invoice/v1/gen/transitions/creators.ts
var creators_exports = /* @__PURE__ */ __exportAll({
	accept: () => accept,
	cancel: () => cancel,
	closePayment: () => closePayment,
	confirmPayment: () => confirmPayment,
	issue: () => issue,
	reapprovePayment: () => reapprovePayment,
	registerPaymentTx: () => registerPaymentTx,
	reinstate: () => reinstate,
	reject: () => reject,
	reportPaymentIssue: () => reportPaymentIssue,
	reset: () => reset,
	schedulePayment: () => schedulePayment
});
const accept = (input) => createAction("ACCEPT", { ...input }, void 0, AcceptInputSchema, "global");
const cancel = (input) => createAction("CANCEL", { ...input }, void 0, CancelInputSchema, "global");
const closePayment = (input) => createAction("CLOSE_PAYMENT", { ...input }, void 0, ClosePaymentInputSchema, "global");
const confirmPayment = (input) => createAction("CONFIRM_PAYMENT", { ...input }, void 0, ConfirmPaymentInputSchema, "global");
const issue = (input) => createAction("ISSUE", { ...input }, void 0, IssueInputSchema, "global");
const reapprovePayment = (input) => createAction("REAPPROVE_PAYMENT", { ...input }, void 0, ReapprovePaymentInputSchema, "global");
const registerPaymentTx = (input) => createAction("REGISTER_PAYMENT_TX", { ...input }, void 0, RegisterPaymentTxInputSchema, "global");
const reinstate = (input) => createAction("REINSTATE", { ...input }, void 0, ReinstateInputSchema, "global");
const reject = (input) => createAction("REJECT", { ...input }, void 0, RejectInputSchema, "global");
const reportPaymentIssue = (input) => createAction("REPORT_PAYMENT_ISSUE", { ...input }, void 0, ReportPaymentIssueInputSchema, "global");
const reset = (input) => createAction("RESET", { ...input }, void 0, ResetInputSchema, "global");
const schedulePayment = (input) => createAction("SCHEDULE_PAYMENT", { ...input }, void 0, SchedulePaymentInputSchema, "global");
//#endregion
//#region document-models/invoice/v1/actions.ts
/** Actions for the Invoice document model */
const actions = {
	...baseActions,
	...creators_exports$3,
	...creators_exports$2,
	...creators_exports$1,
	...creators_exports
};
//#endregion
//#region document-models/invoice/v1/gen/document-type.ts
const invoiceDocumentType = "powerhouse/invoice";
//#endregion
//#region document-models/invoice/v1/gen/document-schema.ts
/** Schema for validating the header object of a Invoice document */
const InvoiceDocumentHeaderSchema = BaseDocumentHeaderSchema.extend({ documentType: literal(invoiceDocumentType) });
/** Schema for validating the state object of a Invoice document */
const InvoicePHStateSchema = BaseDocumentStateSchema.extend({ global: InvoiceStateSchema() });
const InvoiceDocumentSchema = object({
	header: InvoiceDocumentHeaderSchema,
	state: InvoicePHStateSchema,
	initialState: InvoicePHStateSchema
});
/** Simple helper function to check if a state object is a Invoice document state object */
function isInvoiceState(state) {
	return InvoicePHStateSchema.safeParse(state).success;
}
/** Simple helper function to assert that a document state object is a Invoice document state object */
function assertIsInvoiceState(state) {
	InvoicePHStateSchema.parse(state);
}
/** Simple helper function to check if a document is a Invoice document */
function isInvoiceDocument(document) {
	return InvoiceDocumentSchema.safeParse(document).success;
}
/** Simple helper function to assert that a document is a Invoice document */
function assertIsInvoiceDocument(document) {
	InvoiceDocumentSchema.parse(document);
}
//#endregion
//#region document-models/invoice/v1/gen/utils.ts
const initialGlobalState = {
	status: "DRAFT",
	invoiceNo: "",
	dateIssued: null,
	dateDue: null,
	dateDelivered: null,
	issuer: {
		id: null,
		name: null,
		address: null,
		contactInfo: null,
		country: null,
		paymentRouting: null
	},
	payer: {
		id: null,
		name: null,
		address: null,
		contactInfo: null,
		country: null,
		paymentRouting: null
	},
	currency: "",
	lineItems: [],
	totalPriceTaxExcl: 0,
	totalPriceTaxIncl: 0,
	notes: null,
	rejections: [],
	payments: [],
	payAfter: null,
	invoiceTags: [],
	exported: {
		timestamp: null,
		exportedLineItems: []
	},
	closureReason: null
};
const initialLocalState = {};
const utils$1 = {
	fileExtension: "",
	createState(state) {
		return {
			...defaultBaseState(),
			global: {
				...initialGlobalState,
				...state?.global
			},
			local: {
				...initialLocalState,
				...state?.local
			}
		};
	},
	createDocument(state) {
		const document = baseCreateDocument(utils$1.createState, state);
		document.header.documentType = invoiceDocumentType;
		document.header.id = generateId();
		return document;
	},
	saveToFileHandle(document, input) {
		return baseSaveToFileHandle(document, input);
	},
	loadFromInput(input) {
		return baseLoadFromInput(input, reducer);
	},
	isStateOfType(state) {
		return isInvoiceState(state);
	},
	assertIsStateOfType(state) {
		return assertIsInvoiceState(state);
	},
	isDocumentOfType(document) {
		return isInvoiceDocument(document);
	},
	assertIsDocumentOfType(document) {
		return assertIsInvoiceDocument(document);
	}
};
//#endregion
//#region document-models/invoice/v1/src/utils.ts
var utils_exports = /* @__PURE__ */ __exportAll({});
//#endregion
//#region document-models/invoice/v1/utils.ts
/** Utils for the Invoice document model */
const utils = {
	...utils$1,
	...utils_exports
};
//#endregion
//#region document-models/invoice/v1/module.ts
/** Document model module for the Invoice document type */
const Invoice = {
	version: 1,
	reducer,
	actions,
	utils,
	documentModel: createState(defaultBaseState(), documentModel)
};
//#endregion
export { CancelInputSchema as $, deleteLineItem as A, RegisterPaymentTxInputSchema as At, editPayerWallet as B, StatusSchema as Bt, reinstate as C, InvoiceWalletSchema as Ct, schedulePayment as D, PaymentRoutingSchema as Dt, reset as E, LegalEntitySchema as Et, editIssuer as F, ResetInputSchema as Ft, editStatus as G, creators_exports$3 as H, definedNonNullAnySchema as Ht, editIssuerBank as I, SchedulePaymentInputSchema as It, AcceptInputSchema as J, setExportedData as K, editIssuerWallet as L, SetExportedDataInputSchema as Lt, setInvoiceTag as M, RejectInputSchema as Mt, setLineItemTag as N, RejectionSchema as Nt, addLineItem as O, PaymentSchema as Ot, creators_exports$2 as P, ReportPaymentIssueInputSchema as Pt, BankSchema as Q, editPayer as R, SetInvoiceTagInputSchema as Rt, registerPaymentTx as S, InvoiceTagSchema as St, reportPaymentIssue as T, LegalEntityIdSchema as Tt, editInvoice as U, isDefinedNonNullAny as Ut, addPayment as V, TokenSchema as Vt, editPaymentData as W, documentModel as Wt, AddPaymentInputSchema as X, AddLineItemInputSchema as Y, AddressSchema as Z, closePayment as _, IntermediaryBankSchema as _t, utils$1 as a, DeleteLineItemInputSchema as at, issue as b, InvoiceLineItemSchema as bt, InvoicePHStateSchema as c, EditIssuerInputSchema as ct, isInvoiceDocument as d, EditPayerBankInputSchema as dt, ClosePaymentInputSchema as et, isInvoiceState as f, EditPayerInputSchema as ft, cancel as g, ExportedDataSchema as gt, accept as h, EditStatusInputSchema as ht, initialLocalState as i, ContactInfoSchema as it, editLineItem as j, ReinstateInputSchema as jt, creators_exports$1 as k, ReapprovePaymentInputSchema as kt, assertIsInvoiceDocument as l, EditIssuerWalletInputSchema as lt, actions as m, EditPaymentDataInputSchema as mt, utils as n, ClosureReasonSchema as nt, InvoiceDocumentHeaderSchema as o, EditInvoiceInputSchema as ot, invoiceDocumentType as p, EditPayerWalletInputSchema as pt, reducer as q, initialGlobalState as r, ConfirmPaymentInputSchema as rt, InvoiceDocumentSchema as s, EditIssuerBankInputSchema as st, Invoice as t, ClosureReasonInputSchema as tt, assertIsInvoiceState as u, EditLineItemInputSchema as ut, confirmPayment as v, InvoiceAccountTypeInputSchema as vt, reject as w, IssueInputSchema as wt, reapprovePayment as x, InvoiceStateSchema as xt, creators_exports as y, InvoiceAccountTypeSchema as yt, editPayerBank as z, SetLineItemTagInputSchema as zt };

//# sourceMappingURL=module-DXiftdEs.js.map