@rechargeapps/storefront-client 1.26.0 → 1.28.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/dist/cjs/api/address.js +13 -8
- package/dist/cjs/api/address.js.map +1 -1
- package/dist/cjs/api/auth.js +1 -1
- package/dist/cjs/api/subscription.js +8 -4
- package/dist/cjs/api/subscription.js.map +1 -1
- package/dist/cjs/utils/request.js +1 -1
- package/dist/esm/api/address.js +13 -8
- package/dist/esm/api/address.js.map +1 -1
- package/dist/esm/api/auth.js +1 -1
- package/dist/esm/api/subscription.js +8 -4
- package/dist/esm/api/subscription.js.map +1 -1
- package/dist/esm/utils/request.js +1 -1
- package/dist/index.d.ts +18 -14
- package/dist/umd/recharge-client.min.js +3 -3
- package/package.json +1 -1
package/dist/cjs/api/address.js
CHANGED
|
@@ -31,22 +31,27 @@ async function createAddress(session, createRequest) {
|
|
|
31
31
|
);
|
|
32
32
|
return address;
|
|
33
33
|
}
|
|
34
|
-
async function updateAddress(session, id, updateRequest) {
|
|
34
|
+
async function updateAddress(session, id, updateRequest, query) {
|
|
35
35
|
const { address } = await request.rechargeApiRequest(
|
|
36
36
|
"put",
|
|
37
37
|
`/addresses`,
|
|
38
|
-
{ id, data: updateRequest },
|
|
38
|
+
{ id, data: updateRequest, query },
|
|
39
39
|
request.getInternalSession(session, "updateAddress")
|
|
40
40
|
);
|
|
41
41
|
return address;
|
|
42
42
|
}
|
|
43
|
-
async function applyDiscountToAddress(session, id, discountCode) {
|
|
44
|
-
return updateAddress(
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
async function applyDiscountToAddress(session, id, discountCode, query) {
|
|
44
|
+
return updateAddress(
|
|
45
|
+
request.getInternalSession(session, "applyDiscountToAddress"),
|
|
46
|
+
id,
|
|
47
|
+
{
|
|
48
|
+
discounts: [{ code: discountCode }]
|
|
49
|
+
},
|
|
50
|
+
query
|
|
51
|
+
);
|
|
47
52
|
}
|
|
48
|
-
async function removeDiscountsFromAddress(session, id) {
|
|
49
|
-
return updateAddress(request.getInternalSession(session, "removeDiscountsFromAddress"), id, { discounts: [] });
|
|
53
|
+
async function removeDiscountsFromAddress(session, id, query) {
|
|
54
|
+
return updateAddress(request.getInternalSession(session, "removeDiscountsFromAddress"), id, { discounts: [] }, query);
|
|
50
55
|
}
|
|
51
56
|
function deleteAddress(session, id) {
|
|
52
57
|
return request.rechargeApiRequest("delete", `/addresses`, { id }, request.getInternalSession(session, "deleteAddress"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.js","sources":["../../../src/api/address.ts"],"sourcesContent":["import { getInternalSession, rechargeApiRequest } from '../utils/request';\nimport {\n AddressResponse,\n AddressListParams,\n CreateAddressRequest,\n UpdateAddressRequest,\n AddressListResponse,\n MergeAddressesRequest,\n SkipFutureChargeAddressRequest,\n SkipFutureChargeAddressResponse,\n GetAddressOptions,\n Session,\n} from '../types';\n\n/** Returns all addresses from the store, or addresses for the customer given in the parameter. */\nexport function listAddresses(session: Session, query?: AddressListParams) {\n return rechargeApiRequest<AddressListResponse>(\n 'get',\n `/addresses`,\n { query },\n getInternalSession(session, 'listAddresses')\n );\n}\n\n/** Retrieves address for customer based on specified address id. */\nexport async function getAddress(session: Session, id: string | number, options?: GetAddressOptions) {\n const { address } = await rechargeApiRequest<AddressResponse>(\n 'get',\n `/addresses`,\n {\n id,\n query: { include: options?.include },\n },\n getInternalSession(session, 'getAddress')\n );\n return address;\n}\n\n/** Create a new address for a customer. */\nexport async function createAddress(session: Session, createRequest: CreateAddressRequest) {\n const { address } = await rechargeApiRequest<AddressResponse>(\n 'post',\n `/addresses`,\n { data: { customer_id: session.customerId ? Number(session.customerId) : undefined, ...createRequest } },\n getInternalSession(session, 'createAddress')\n );\n return address;\n}\n\n/** Updates an existing address to match the specified parameters. */\nexport async function updateAddress(session: Session
|
|
1
|
+
{"version":3,"file":"address.js","sources":["../../../src/api/address.ts"],"sourcesContent":["import { getInternalSession, rechargeApiRequest } from '../utils/request';\nimport {\n AddressResponse,\n AddressListParams,\n CreateAddressRequest,\n UpdateAddressRequest,\n AddressListResponse,\n MergeAddressesRequest,\n SkipFutureChargeAddressRequest,\n SkipFutureChargeAddressResponse,\n GetAddressOptions,\n Session,\n UpdateAddressParams,\n} from '../types';\n\n/** Returns all addresses from the store, or addresses for the customer given in the parameter. */\nexport function listAddresses(session: Session, query?: AddressListParams) {\n return rechargeApiRequest<AddressListResponse>(\n 'get',\n `/addresses`,\n { query },\n getInternalSession(session, 'listAddresses')\n );\n}\n\n/** Retrieves address for customer based on specified address id. */\nexport async function getAddress(session: Session, id: string | number, options?: GetAddressOptions) {\n const { address } = await rechargeApiRequest<AddressResponse>(\n 'get',\n `/addresses`,\n {\n id,\n query: { include: options?.include },\n },\n getInternalSession(session, 'getAddress')\n );\n return address;\n}\n\n/** Create a new address for a customer. */\nexport async function createAddress(session: Session, createRequest: CreateAddressRequest) {\n const { address } = await rechargeApiRequest<AddressResponse>(\n 'post',\n `/addresses`,\n { data: { customer_id: session.customerId ? Number(session.customerId) : undefined, ...createRequest } },\n getInternalSession(session, 'createAddress')\n );\n return address;\n}\n\n/** Updates an existing address to match the specified parameters. */\nexport async function updateAddress(\n session: Session,\n id: string | number,\n updateRequest: UpdateAddressRequest,\n query?: UpdateAddressParams\n) {\n const { address } = await rechargeApiRequest<AddressResponse>(\n 'put',\n `/addresses`,\n { id, data: updateRequest, query },\n getInternalSession(session, 'updateAddress')\n );\n return address;\n}\n\n/** Apply discount code to an address. Addresses are currently limited to a single discount. */\nexport async function applyDiscountToAddress(\n session: Session,\n id: string | number,\n discountCode: string,\n query?: UpdateAddressParams\n) {\n return updateAddress(\n getInternalSession(session, 'applyDiscountToAddress'),\n id,\n {\n discounts: [{ code: discountCode }],\n },\n query\n );\n}\n\n/** Removes all discounts from an address. */\nexport async function removeDiscountsFromAddress(session: Session, id: string | number, query?: UpdateAddressParams) {\n return updateAddress(getInternalSession(session, 'removeDiscountsFromAddress'), id, { discounts: [] }, query);\n}\n\n/** Deletes an address. Only Addresses with no active Subscriptions can be deleted. */\nexport function deleteAddress(session: Session, id: string | number) {\n return rechargeApiRequest<void>('delete', `/addresses`, { id }, getInternalSession(session, 'deleteAddress'));\n}\n\n/**\n * Merges up to 10 source addresses into 1 target address.\n */\nexport async function mergeAddresses(session: Session, mergeRequest: MergeAddressesRequest) {\n const { address } = await rechargeApiRequest<AddressResponse>(\n 'post',\n `/addresses/merge`,\n {\n data: mergeRequest,\n },\n getInternalSession(session, 'mergeAddresses')\n );\n return address;\n}\n\n/**\n * Skip a Charge in the future for one or multiple Subscriptions associated with the Address.\n */\nexport async function skipFutureCharge(\n session: Session,\n id: string | number,\n skipRequest: SkipFutureChargeAddressRequest\n) {\n const { charge } = await rechargeApiRequest<SkipFutureChargeAddressResponse>(\n 'post',\n `/addresses/${id}/charges/skip`,\n {\n data: skipRequest,\n },\n getInternalSession(session, 'skipFutureCharge')\n );\n return charge;\n}\n"],"names":["rechargeApiRequest","getInternalSession"],"mappings":";;;;AAgBgB,SAAA,aAAA,CAAc,SAAkB,KAA2B,EAAA;AACzE,EAAO,OAAAA,0BAAA;AAAA,IACL,KAAA;AAAA,IACA,CAAA,UAAA,CAAA;AAAA,IACA,EAAE,KAAM,EAAA;AAAA,IACRC,0BAAA,CAAmB,SAAS,eAAe,CAAA;AAAA,GAC7C,CAAA;AACF,CAAA;AAGsB,eAAA,UAAA,CAAW,OAAkB,EAAA,EAAA,EAAqB,OAA6B,EAAA;AACnG,EAAM,MAAA,EAAE,OAAQ,EAAA,GAAI,MAAMD,0BAAA;AAAA,IACxB,KAAA;AAAA,IACA,CAAA,UAAA,CAAA;AAAA,IACA;AAAA,MACE,EAAA;AAAA,MACA,KAAO,EAAA,EAAE,OAAS,EAAA,OAAA,EAAS,OAAQ,EAAA;AAAA,KACrC;AAAA,IACAC,0BAAA,CAAmB,SAAS,YAAY,CAAA;AAAA,GAC1C,CAAA;AACA,EAAO,OAAA,OAAA,CAAA;AACT,C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KAAK,CAAA,CAAA;AAC9G,CAAA;AAGgB,SAAA,aAAA,CAAc,SAAkB,EAAqB,EAAA;AACnE,EAAO,OAAAD,0BAAA,CAAyB,UAAU,CAAc,UAAA,CAAA,EAAA,EAAE,IAAM,EAAAC,0BAAA,CAAmB,OAAS,EAAA,eAAe,CAAC,CAAA,CAAA;AAC9G,CAAA;AAKsB,eAAA,cAAA,CAAe,SAAkB,YAAqC,EAAA;AAC1F,EAAM,MAAA,EAAE,OAAQ,EAAA,GAAI,MAAMD,0BAAA;AAAA,IACxB,MAAA;AAAA,IACA,CAAA,gBAAA,CAAA;AAAA,IACA;AAAA,MACE,IAAM,EAAA,YAAA;AAAA,KACR;AAAA,IACAC,0BAAA,CAAmB,SAAS,gBAAgB,CAAA;AAAA,GAC9C,CAAA;AACA,EAAO,OAAA,OAAA,CAAA;AACT,CAAA;AAKsB,eAAA,gBAAA,CACpB,OACA,EAAA,EAAA,EACA,WACA,EAAA;AACA,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,MAAMD,0BAAA;AAAA,IACvB,MAAA;AAAA,IACA,cAAc,EAAE,CAAA,aAAA,CAAA;AAAA,IAChB;AAAA,MACE,IAAM,EAAA,WAAA;AAAA,KACR;AAAA,IACAC,0BAAA,CAAmB,SAAS,kBAAkB,CAAA;AAAA,GAChD,CAAA;AACA,EAAO,OAAA,MAAA,CAAA;AACT;;;;;;;;;;;;"}
|
package/dist/cjs/api/auth.js
CHANGED
|
@@ -142,7 +142,7 @@ async function rechargeAdminRequest(method, url, { id, query, data, headers } =
|
|
|
142
142
|
...storefrontAccessToken ? { "X-Recharge-Storefront-Access-Token": storefrontAccessToken } : {},
|
|
143
143
|
...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
|
|
144
144
|
...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
|
|
145
|
-
"X-Recharge-Sdk-Version": "1.
|
|
145
|
+
"X-Recharge-Sdk-Version": "1.28.0",
|
|
146
146
|
...headers ? headers : {}
|
|
147
147
|
};
|
|
148
148
|
return request.request(method, `${rechargeBaseUrl}${url}`, { id, query, data, headers: reqHeaders });
|
|
@@ -136,15 +136,19 @@ async function createSubscriptions(session, createRequestBulk, query) {
|
|
|
136
136
|
}
|
|
137
137
|
const bulkSubscriptionMapperPartial = partial(subscription.bulkSubscriptionCreateMapper, customerId);
|
|
138
138
|
const requestData = createRequestBulk.map(bulkSubscriptionMapperPartial);
|
|
139
|
+
let localQuery = void 0;
|
|
140
|
+
if (query?.allow_onetimes !== void 0) {
|
|
141
|
+
localQuery = { allow_onetimes: query.allow_onetimes };
|
|
142
|
+
}
|
|
139
143
|
const { subscriptions } = await request.rechargeApiRequest(
|
|
140
144
|
"post",
|
|
141
145
|
`/addresses/${addressId}/subscriptions-bulk`,
|
|
142
146
|
{
|
|
143
|
-
data: { subscriptions: requestData },
|
|
147
|
+
data: { subscriptions: requestData, commit_update: !!query?.commit },
|
|
144
148
|
headers: {
|
|
145
149
|
"X-Recharge-Version": "2021-01"
|
|
146
150
|
},
|
|
147
|
-
query
|
|
151
|
+
query: localQuery
|
|
148
152
|
},
|
|
149
153
|
request.getInternalSession(session, "createSubscriptions")
|
|
150
154
|
);
|
|
@@ -169,7 +173,7 @@ async function updateSubscriptions(session, addressId, updateRequestBulk, query)
|
|
|
169
173
|
"put",
|
|
170
174
|
`/addresses/${addressId}/subscriptions-bulk`,
|
|
171
175
|
{
|
|
172
|
-
data: { subscriptions: requestData },
|
|
176
|
+
data: { subscriptions: requestData, commit_update: !!query?.commit },
|
|
173
177
|
headers: {
|
|
174
178
|
"X-Recharge-Version": "2021-01"
|
|
175
179
|
},
|
|
@@ -196,7 +200,7 @@ async function deleteSubscriptions(session, addressId, deleteRequestBulk, query)
|
|
|
196
200
|
"delete",
|
|
197
201
|
`/addresses/${addressId}/subscriptions-bulk`,
|
|
198
202
|
{
|
|
199
|
-
data: { subscriptions: deleteRequestBulk, send_email: query?.send_email
|
|
203
|
+
data: { subscriptions: deleteRequestBulk, send_email: !!query?.send_email, commit_update: !!query?.commit },
|
|
200
204
|
headers: {
|
|
201
205
|
"X-Recharge-Version": "2021-01"
|
|
202
206
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription.js","sources":["../../../src/api/subscription.ts"],"sourcesContent":["import partial from 'lodash.partial';\nimport { getInternalSession, rechargeApiRequest } from '../utils/request';\nimport {\n CancelSubscriptionRequest,\n CreateSubscriptionRequest,\n Subscription,\n SubscriptionsResponse,\n SubscriptionListParams,\n UpdateSubscriptionRequest,\n UpdateSubscriptionParams,\n GetSubscriptionOptions,\n BasicSubscriptionParams,\n Subscription_2021_01,\n UpdateSubscriptionsRequest,\n UpdateSubscriptionsParams,\n Session,\n ChargeResponse,\n CreateRecipientAddress,\n Onetime,\n IsoDateString,\n CreateSubscriptionsParams,\n CreateSubscriptionsRequest,\n DeleteSubscriptionsParams,\n DeleteSubscriptionsRequest,\n UpdateSubscriptionChargeDateParams,\n} from '../types';\nimport {\n bulkSubscriptionCreateMapper,\n bulkSubscriptionUpdateMapper,\n subscriptionMapperOldToNew,\n} from '../mappers/subscription';\n\nexport async function getSubscription(\n session: Session,\n id: string | number,\n options?: GetSubscriptionOptions\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'get',\n `/subscriptions`,\n {\n id,\n query: { include: options?.include },\n },\n getInternalSession(session, 'getSubscription')\n );\n return subscription;\n}\n\nexport function listSubscriptions(session: Session, query?: SubscriptionListParams): Promise<SubscriptionsResponse> {\n return rechargeApiRequest<SubscriptionsResponse>(\n 'get',\n `/subscriptions`,\n { query },\n getInternalSession(session, 'listSubscriptions')\n );\n}\n\n/**\n * When creating a subscription via API, order_interval_frequency and charge_interval_frequency values do not necessarily\n * need to match the values set in the respective Plans. The product, however, does need to have at least one Plan in order\n * to be added to a subscription.\n */\nexport async function createSubscription(\n session: Session,\n createRequest: CreateSubscriptionRequest,\n query?: BasicSubscriptionParams\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'post',\n `/subscriptions`,\n {\n data: createRequest,\n query,\n },\n getInternalSession(session, 'createSubscription')\n );\n return subscription;\n}\n\n/**\n * Updating parameters like frequency, charge_interval_frequency, order_interval_frequency, order_interval_unit will cause our algorithm to automatically recalculate the next charge date (next_charge_scheduled_at).\n * WARNING: This update will remove skipped and manually changed charges.\n * If you want to change the next charge date (next_charge_scheduled_at) we recommend you to update these parameters first.\n * When updating order_interval_unit OR order_interval_frequency OR charge_interval_frequency all three parameters are required.\n */\nexport async function updateSubscription(\n session: Session,\n id: string | number,\n updateRequest: UpdateSubscriptionRequest,\n query?: UpdateSubscriptionParams\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'put',\n `/subscriptions`,\n {\n id,\n data: updateRequest,\n query,\n },\n getInternalSession(session, 'updateSubscription')\n );\n return subscription;\n}\n\n/**\n * If there are two active subscriptions with the same address_id, and you update their\n * next_charge_date parameters to match, their charges will get merged into a new charge\n * with a new id\n */\nexport async function updateSubscriptionChargeDate(\n session: Session,\n id: string | number,\n date: IsoDateString,\n query?: UpdateSubscriptionChargeDateParams\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'post',\n `/subscriptions/${id}/set_next_charge_date`,\n {\n data: { date },\n query,\n },\n getInternalSession(session, 'updateSubscriptionChargeDate')\n );\n return subscription;\n}\n\nexport async function updateSubscriptionAddress(\n session: Session,\n id: string | number,\n address_id: string | number\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'post',\n `/subscriptions/${id}/change_address`,\n {\n data: { address_id },\n },\n getInternalSession(session, 'updateSubscriptionAddress')\n );\n return subscription;\n}\n\n/**\n * An involuntary subscription cancelled due to max retries reached will trigger the\n * charge/max_retries_reached webhook. If this leads to the subscription being cancelled,\n * the subscription/cancelled webhook will trigger.\n */\nexport async function cancelSubscription(\n session: Session,\n id: string | number,\n cancelRequest: CancelSubscriptionRequest,\n query?: BasicSubscriptionParams\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'post',\n `/subscriptions/${id}/cancel`,\n {\n data: cancelRequest,\n query,\n },\n getInternalSession(session, 'cancelSubscription')\n );\n return subscription;\n}\n\n/**\n * When activating subscription, following attributes will be set to null: cancelled_at, cancellation_reason\n * and cancellation_reason_comments.\n */\nexport async function activateSubscription(\n session: Session,\n id: string | number,\n query?: BasicSubscriptionParams\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'post',\n `/subscriptions/${id}/activate`,\n { query },\n getInternalSession(session, 'activateSubscription')\n );\n return subscription;\n}\n\n/* Skip charge associated with a subscription. */\nexport async function skipSubscriptionCharge(session: Session, id: number | string, date: IsoDateString) {\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/subscriptions/${id}/charges/skip`,\n {\n data: {\n date,\n subscription_id: `${id}`,\n },\n },\n getInternalSession(session, 'skipSubscriptionCharge')\n );\n return charge;\n}\n\n/**\n * Gift a subscription to another person. This creates onetime products for the recipient and skips that subscription for the customer.\n * When the gifted onetime ships the recipient receives and email notification.\n */\nexport async function skipGiftSubscriptionCharge(\n session: Session,\n subscriptionIds: Array<number | string>,\n recipientAddress: CreateRecipientAddress\n) {\n const { onetimes } = await rechargeApiRequest<{ onetimes: Onetime[] }>(\n 'post',\n '/purchase_items/skip_gift',\n {\n data: {\n purchase_item_ids: subscriptionIds.map(Number),\n recipient_address: recipientAddress,\n },\n },\n getInternalSession(session, 'skipGiftSubscriptionCharge')\n );\n\n return onetimes;\n}\n\n/**\n * Bulk create new subscriptions.\n * Must all be for the same address.\n * There is a limit of 20 subscriptions per request.\n */\nexport async function createSubscriptions(\n session: Session,\n createRequestBulk: CreateSubscriptionsRequest[],\n query?: CreateSubscriptionsParams\n): Promise<Subscription[]> {\n // validate size\n const length = createRequestBulk.length;\n if (length < 1 || length > 21) {\n throw new Error('Number of subscriptions must be between 1 and 20.');\n }\n // validate customerId\n const { customerId } = session;\n if (!customerId) {\n throw new Error('No customerId in session.');\n }\n // validate addressId\n const addressId = createRequestBulk[0].address_id;\n if (!createRequestBulk.every(createRequest => createRequest.address_id === addressId)) {\n throw new Error('All subscriptions must have the same address_id.');\n }\n const bulkSubscriptionMapperPartial = partial(bulkSubscriptionCreateMapper, customerId);\n const requestData = createRequestBulk.map(bulkSubscriptionMapperPartial);\n const { subscriptions } = await rechargeApiRequest<{ subscriptions: Subscription_2021_01[] }>(\n 'post',\n `/addresses/${addressId}/subscriptions-bulk`,\n {\n data: { subscriptions: requestData },\n headers: {\n 'X-Recharge-Version': '2021-01',\n },\n query,\n },\n getInternalSession(session, 'createSubscriptions')\n );\n return subscriptions.map(subscriptionMapperOldToNew);\n}\n\n/**\n * Bulk update subscriptions.\n * Must all be for the same address.\n * There is a limit of 20 subscriptions per request.\n * Same rules apply as a single subscription update\n */\nexport async function updateSubscriptions(\n session: Session,\n addressId: string | number,\n updateRequestBulk: UpdateSubscriptionsRequest[],\n query?: UpdateSubscriptionsParams\n): Promise<Subscription[]> {\n // validate size\n const length = updateRequestBulk.length;\n if (length < 1 || length > 21) {\n throw new Error('Number of subscriptions must be between 1 and 20.');\n }\n // validate customerId\n const { customerId } = session;\n if (!customerId) {\n throw new Error('No customerId in session.');\n }\n const bulkSubscriptionMapperPartial = partial(bulkSubscriptionUpdateMapper, !!query?.force_update);\n const requestData = updateRequestBulk.map(bulkSubscriptionMapperPartial);\n // setup query params\n let localQuery: { allow_onetimes?: boolean } | undefined = undefined;\n if (query?.allow_onetimes !== undefined) {\n localQuery = { allow_onetimes: query.allow_onetimes };\n }\n const { subscriptions } = await rechargeApiRequest<{ subscriptions: Subscription_2021_01[] }>(\n 'put',\n `/addresses/${addressId}/subscriptions-bulk`,\n {\n data: { subscriptions: requestData },\n headers: {\n 'X-Recharge-Version': '2021-01',\n },\n query: localQuery,\n },\n getInternalSession(session, 'updateSubscriptions')\n );\n return subscriptions.map(subscriptionMapperOldToNew);\n}\n\n/**\n * @internal\n * Bulk delete subscriptions.\n * Must all be for the same address.\n * There is a limit of 20 subscriptions per request.\n */\nexport async function deleteSubscriptions(\n session: Session,\n addressId: string | number,\n deleteRequestBulk: DeleteSubscriptionsRequest[],\n query?: DeleteSubscriptionsParams\n): Promise<void> {\n // validate size\n const length = deleteRequestBulk.length;\n if (length < 1 || length > 21) {\n throw new Error('Number of subscriptions must be between 1 and 20.');\n }\n // validate customerId\n const { customerId } = session;\n if (!customerId) {\n throw new Error('No customerId in session.');\n }\n // setup query params\n let localQuery: { allow_onetimes?: boolean } | undefined = undefined;\n if (query?.allow_onetimes !== undefined) {\n localQuery = { allow_onetimes: query.allow_onetimes };\n }\n await rechargeApiRequest<{ subscriptions: Subscription_2021_01[] }>(\n 'delete',\n `/addresses/${addressId}/subscriptions-bulk`,\n {\n data: { subscriptions: deleteRequestBulk, send_email: query?.send_email ?? false },\n headers: {\n 'X-Recharge-Version': '2021-01',\n },\n query: localQuery,\n },\n getInternalSession(session, 'deleteSubscriptions')\n );\n return undefined;\n}\n"],"names":["rechargeApiRequest","getInternalSession","bulkSubscriptionCreateMapper","subscriptionMapperOldToNew","bulkSubscriptionUpdateMapper"],"mappings":";;;;;;AAgCsB,eAAA,eAAA,CACpB,OACA,EAAA,EAAA,EACA,OACuB,EAAA;AACvB,EAAM,MAAA,EAAE,YAAa,EAAA,GAAI,MAAMA,0BAAA;AAAA,IAC7B,KAAA;AAAA,IACA,CAAA,cAAA,CAAA;AAAA,IACA;AAAA,MACE,EAAA;AAAA,MACA,KAAO,EAAA,EAAE,OAAS,EAAA,OAAA,EAAS,OAAQ,EAAA;AAAA,KACrC;AAAA,IACAC,0BAAA,CAAmB,SAAS,iBAAiB,CAAA;AAAA,GAC/C,CAAA;AACA,EAAO,OAAA,YAAA,CAAA;AACT,CAAA;AAEgB,SAAA,iBAAA,CAAkB,SAAkB,KAAgE,EAAA;AAClH,EAAO,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IACvB;AAAA,MACE,MAAM,EAAE,aAAA,EAAe,mBAAmB,UAAY,EAAA,KAAA,EAAO,cAAc,KAAM,EAAA;AAAA,MACjF,OAAS,EAAA;AAAA,QACP,oBAAsB,EAAA,SAAA;AAAA,OACxB;AAAA,MACA,KAAO,EAAA,UAAA;AAAA,KACT;AAAA,IACAC,0BAAA,CAAmB,SAAS,qBAAqB,CAAA;AAAA,GACnD,CAAA;AACA,EAAO,OAAA,KAAA,CAAA,CAAA;AACT;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"subscription.js","sources":["../../../src/api/subscription.ts"],"sourcesContent":["import partial from 'lodash.partial';\nimport { getInternalSession, rechargeApiRequest } from '../utils/request';\nimport {\n CancelSubscriptionRequest,\n CreateSubscriptionRequest,\n Subscription,\n SubscriptionsResponse,\n SubscriptionListParams,\n UpdateSubscriptionRequest,\n UpdateSubscriptionParams,\n GetSubscriptionOptions,\n BasicSubscriptionParams,\n Subscription_2021_01,\n UpdateSubscriptionsRequest,\n UpdateSubscriptionsParams,\n Session,\n ChargeResponse,\n CreateRecipientAddress,\n Onetime,\n IsoDateString,\n CreateSubscriptionsParams,\n CreateSubscriptionsRequest,\n DeleteSubscriptionsParams,\n DeleteSubscriptionsRequest,\n UpdateSubscriptionChargeDateParams,\n} from '../types';\nimport {\n bulkSubscriptionCreateMapper,\n bulkSubscriptionUpdateMapper,\n subscriptionMapperOldToNew,\n} from '../mappers/subscription';\n\nexport async function getSubscription(\n session: Session,\n id: string | number,\n options?: GetSubscriptionOptions\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'get',\n `/subscriptions`,\n {\n id,\n query: { include: options?.include },\n },\n getInternalSession(session, 'getSubscription')\n );\n return subscription;\n}\n\nexport function listSubscriptions(session: Session, query?: SubscriptionListParams): Promise<SubscriptionsResponse> {\n return rechargeApiRequest<SubscriptionsResponse>(\n 'get',\n `/subscriptions`,\n { query },\n getInternalSession(session, 'listSubscriptions')\n );\n}\n\n/**\n * When creating a subscription via API, order_interval_frequency and charge_interval_frequency values do not necessarily\n * need to match the values set in the respective Plans. The product, however, does need to have at least one Plan in order\n * to be added to a subscription.\n */\nexport async function createSubscription(\n session: Session,\n createRequest: CreateSubscriptionRequest,\n query?: BasicSubscriptionParams\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'post',\n `/subscriptions`,\n {\n data: createRequest,\n query,\n },\n getInternalSession(session, 'createSubscription')\n );\n return subscription;\n}\n\n/**\n * Updating parameters like frequency, charge_interval_frequency, order_interval_frequency, order_interval_unit will cause our algorithm to automatically recalculate the next charge date (next_charge_scheduled_at).\n * WARNING: This update will remove skipped and manually changed charges.\n * If you want to change the next charge date (next_charge_scheduled_at) we recommend you to update these parameters first.\n * When updating order_interval_unit OR order_interval_frequency OR charge_interval_frequency all three parameters are required.\n */\nexport async function updateSubscription(\n session: Session,\n id: string | number,\n updateRequest: UpdateSubscriptionRequest,\n query?: UpdateSubscriptionParams\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'put',\n `/subscriptions`,\n {\n id,\n data: updateRequest,\n query,\n },\n getInternalSession(session, 'updateSubscription')\n );\n return subscription;\n}\n\n/**\n * If there are two active subscriptions with the same address_id, and you update their\n * next_charge_date parameters to match, their charges will get merged into a new charge\n * with a new id\n */\nexport async function updateSubscriptionChargeDate(\n session: Session,\n id: string | number,\n date: IsoDateString,\n query?: UpdateSubscriptionChargeDateParams\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'post',\n `/subscriptions/${id}/set_next_charge_date`,\n {\n data: { date },\n query,\n },\n getInternalSession(session, 'updateSubscriptionChargeDate')\n );\n return subscription;\n}\n\nexport async function updateSubscriptionAddress(\n session: Session,\n id: string | number,\n address_id: string | number\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'post',\n `/subscriptions/${id}/change_address`,\n {\n data: { address_id },\n },\n getInternalSession(session, 'updateSubscriptionAddress')\n );\n return subscription;\n}\n\n/**\n * An involuntary subscription cancelled due to max retries reached will trigger the\n * charge/max_retries_reached webhook. If this leads to the subscription being cancelled,\n * the subscription/cancelled webhook will trigger.\n */\nexport async function cancelSubscription(\n session: Session,\n id: string | number,\n cancelRequest: CancelSubscriptionRequest,\n query?: BasicSubscriptionParams\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'post',\n `/subscriptions/${id}/cancel`,\n {\n data: cancelRequest,\n query,\n },\n getInternalSession(session, 'cancelSubscription')\n );\n return subscription;\n}\n\n/**\n * When activating subscription, following attributes will be set to null: cancelled_at, cancellation_reason\n * and cancellation_reason_comments.\n */\nexport async function activateSubscription(\n session: Session,\n id: string | number,\n query?: BasicSubscriptionParams\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'post',\n `/subscriptions/${id}/activate`,\n { query },\n getInternalSession(session, 'activateSubscription')\n );\n return subscription;\n}\n\n/* Skip charge associated with a subscription. */\nexport async function skipSubscriptionCharge(session: Session, id: number | string, date: IsoDateString) {\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/subscriptions/${id}/charges/skip`,\n {\n data: {\n date,\n subscription_id: `${id}`,\n },\n },\n getInternalSession(session, 'skipSubscriptionCharge')\n );\n return charge;\n}\n\n/**\n * Gift a subscription to another person. This creates onetime products for the recipient and skips that subscription for the customer.\n * When the gifted onetime ships the recipient receives and email notification.\n */\nexport async function skipGiftSubscriptionCharge(\n session: Session,\n subscriptionIds: Array<number | string>,\n recipientAddress: CreateRecipientAddress\n) {\n const { onetimes } = await rechargeApiRequest<{ onetimes: Onetime[] }>(\n 'post',\n '/purchase_items/skip_gift',\n {\n data: {\n purchase_item_ids: subscriptionIds.map(Number),\n recipient_address: recipientAddress,\n },\n },\n getInternalSession(session, 'skipGiftSubscriptionCharge')\n );\n\n return onetimes;\n}\n\n/**\n * Bulk create new subscriptions.\n * Must all be for the same address.\n * There is a limit of 20 subscriptions per request.\n */\nexport async function createSubscriptions(\n session: Session,\n createRequestBulk: CreateSubscriptionsRequest[],\n query?: CreateSubscriptionsParams\n): Promise<Subscription[]> {\n // validate size\n const length = createRequestBulk.length;\n if (length < 1 || length > 21) {\n throw new Error('Number of subscriptions must be between 1 and 20.');\n }\n // validate customerId\n const { customerId } = session;\n if (!customerId) {\n throw new Error('No customerId in session.');\n }\n // validate addressId\n const addressId = createRequestBulk[0].address_id;\n if (!createRequestBulk.every(createRequest => createRequest.address_id === addressId)) {\n throw new Error('All subscriptions must have the same address_id.');\n }\n const bulkSubscriptionMapperPartial = partial(bulkSubscriptionCreateMapper, customerId);\n const requestData = createRequestBulk.map(bulkSubscriptionMapperPartial);\n // setup query params\n let localQuery: { allow_onetimes?: boolean } | undefined = undefined;\n if (query?.allow_onetimes !== undefined) {\n localQuery = { allow_onetimes: query.allow_onetimes };\n }\n const { subscriptions } = await rechargeApiRequest<{ subscriptions: Subscription_2021_01[] }>(\n 'post',\n `/addresses/${addressId}/subscriptions-bulk`,\n {\n data: { subscriptions: requestData, commit_update: !!query?.commit },\n headers: {\n 'X-Recharge-Version': '2021-01',\n },\n query: localQuery,\n },\n getInternalSession(session, 'createSubscriptions')\n );\n return subscriptions.map(subscriptionMapperOldToNew);\n}\n\n/**\n * Bulk update subscriptions.\n * Must all be for the same address.\n * There is a limit of 20 subscriptions per request.\n * Same rules apply as a single subscription update\n */\nexport async function updateSubscriptions(\n session: Session,\n addressId: string | number,\n updateRequestBulk: UpdateSubscriptionsRequest[],\n query?: UpdateSubscriptionsParams\n): Promise<Subscription[]> {\n // validate size\n const length = updateRequestBulk.length;\n if (length < 1 || length > 21) {\n throw new Error('Number of subscriptions must be between 1 and 20.');\n }\n // validate customerId\n const { customerId } = session;\n if (!customerId) {\n throw new Error('No customerId in session.');\n }\n const bulkSubscriptionMapperPartial = partial(bulkSubscriptionUpdateMapper, !!query?.force_update);\n const requestData = updateRequestBulk.map(bulkSubscriptionMapperPartial);\n // setup query params\n let localQuery: { allow_onetimes?: boolean } | undefined = undefined;\n if (query?.allow_onetimes !== undefined) {\n localQuery = { allow_onetimes: query.allow_onetimes };\n }\n const { subscriptions } = await rechargeApiRequest<{ subscriptions: Subscription_2021_01[] }>(\n 'put',\n `/addresses/${addressId}/subscriptions-bulk`,\n {\n data: { subscriptions: requestData, commit_update: !!query?.commit },\n headers: {\n 'X-Recharge-Version': '2021-01',\n },\n query: localQuery,\n },\n getInternalSession(session, 'updateSubscriptions')\n );\n return subscriptions.map(subscriptionMapperOldToNew);\n}\n\n/**\n * @internal\n * Bulk delete subscriptions.\n * Must all be for the same address.\n * There is a limit of 20 subscriptions per request.\n */\nexport async function deleteSubscriptions(\n session: Session,\n addressId: string | number,\n deleteRequestBulk: DeleteSubscriptionsRequest[],\n query?: DeleteSubscriptionsParams\n): Promise<void> {\n // validate size\n const length = deleteRequestBulk.length;\n if (length < 1 || length > 21) {\n throw new Error('Number of subscriptions must be between 1 and 20.');\n }\n // validate customerId\n const { customerId } = session;\n if (!customerId) {\n throw new Error('No customerId in session.');\n }\n // setup query params\n let localQuery: { allow_onetimes?: boolean } | undefined = undefined;\n if (query?.allow_onetimes !== undefined) {\n localQuery = { allow_onetimes: query.allow_onetimes };\n }\n await rechargeApiRequest<{ subscriptions: Subscription_2021_01[] }>(\n 'delete',\n `/addresses/${addressId}/subscriptions-bulk`,\n {\n data: { subscriptions: deleteRequestBulk, send_email: !!query?.send_email, commit_update: !!query?.commit },\n headers: {\n 'X-Recharge-Version': '2021-01',\n },\n query: localQuery,\n },\n getInternalSession(session, 'deleteSubscriptions')\n );\n return undefined;\n}\n"],"names":["rechargeApiRequest","getInternalSession","bulkSubscriptionCreateMapper","subscriptionMapperOldToNew","bulkSubscriptionUpdateMapper"],"mappings":";;;;;;AAgCsB,eAAA,eAAA,CACpB,OACA,EAAA,EAAA,EACA,OACuB,EAAA;AACvB,EAAM,MA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AAA,iBAAA,EACA,KACe,EAAA;AAEf,EAAA,MAAM,SAAS,iBAAkB,CAAA,MAAA,CAAA;AACjC,EAAI,IAAA,MAAA,GAAS,CAAK,IAAA,MAAA,GAAS,EAAI,EAAA;AAC7B,IAAM,MAAA,IAAI,MAAM,mDAAmD,CAAA,CAAA;AAAA,GACrE;AAEA,EAAM,MAAA,EAAE,YAAe,GAAA,OAAA,CAAA;AACvB,EAAA,IAAI,CAAC,UAAY,EAAA;AACf,IAAM,MAAA,IAAI,MAAM,2BAA2B,CAAA,CAAA;AAAA,GAC7C;AAEA,EAAA,IAAI,UAAuD,GAAA,KAAA,CAAA,CAAA;AAC3D,EAAI,IAAA,KAAA,EAAO,mBAAmB,KAAW,CAAA,EAAA;AACvC,IAAa,UAAA,GAAA,EAAE,cAAgB,EAAA,KAAA,CAAM,cAAe,EAAA,CAAA;AAAA,GACtD;AACA,EAAM,MAAAH,0BAAA;AAAA,IACJ,QAAA;AAAA,IACA,cAAc,SAAS,CAAA,mBAAA,CAAA;AAAA,IACvB;AAAA,MACE,IAAM,EAAA,EAAE,aAAe,EAAA,iBAAA,EAAmB,UAAY,EAAA,CAAC,CAAC,KAAA,EAAO,UAAY,EAAA,aAAA,EAAe,CAAC,CAAC,OAAO,MAAO,EAAA;AAAA,MAC1G,OAAS,EAAA;AAAA,QACP,oBAAsB,EAAA,SAAA;AAAA,OACxB;AAAA,MACA,KAAO,EAAA,UAAA;AAAA,KACT;AAAA,IACAC,0BAAA,CAAmB,SAAS,qBAAqB,CAAA;AAAA,GACnD,CAAA;AACA,EAAO,OAAA,KAAA,CAAA,CAAA;AACT;;;;;;;;;;;;;;;;"}
|
|
@@ -35,7 +35,7 @@ async function rechargeApiRequest(method, url, { id, query, data, headers } = {}
|
|
|
35
35
|
"X-Recharge-Sdk-Fn": session.internalFnCall,
|
|
36
36
|
...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
|
|
37
37
|
...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
|
|
38
|
-
"X-Recharge-Sdk-Version": "1.
|
|
38
|
+
"X-Recharge-Sdk-Version": "1.28.0",
|
|
39
39
|
"X-Request-Id": session.internalRequestId,
|
|
40
40
|
...headers ? headers : {}
|
|
41
41
|
};
|
package/dist/esm/api/address.js
CHANGED
|
@@ -29,22 +29,27 @@ async function createAddress(session, createRequest) {
|
|
|
29
29
|
);
|
|
30
30
|
return address;
|
|
31
31
|
}
|
|
32
|
-
async function updateAddress(session, id, updateRequest) {
|
|
32
|
+
async function updateAddress(session, id, updateRequest, query) {
|
|
33
33
|
const { address } = await rechargeApiRequest(
|
|
34
34
|
"put",
|
|
35
35
|
`/addresses`,
|
|
36
|
-
{ id, data: updateRequest },
|
|
36
|
+
{ id, data: updateRequest, query },
|
|
37
37
|
getInternalSession(session, "updateAddress")
|
|
38
38
|
);
|
|
39
39
|
return address;
|
|
40
40
|
}
|
|
41
|
-
async function applyDiscountToAddress(session, id, discountCode) {
|
|
42
|
-
return updateAddress(
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
async function applyDiscountToAddress(session, id, discountCode, query) {
|
|
42
|
+
return updateAddress(
|
|
43
|
+
getInternalSession(session, "applyDiscountToAddress"),
|
|
44
|
+
id,
|
|
45
|
+
{
|
|
46
|
+
discounts: [{ code: discountCode }]
|
|
47
|
+
},
|
|
48
|
+
query
|
|
49
|
+
);
|
|
45
50
|
}
|
|
46
|
-
async function removeDiscountsFromAddress(session, id) {
|
|
47
|
-
return updateAddress(getInternalSession(session, "removeDiscountsFromAddress"), id, { discounts: [] });
|
|
51
|
+
async function removeDiscountsFromAddress(session, id, query) {
|
|
52
|
+
return updateAddress(getInternalSession(session, "removeDiscountsFromAddress"), id, { discounts: [] }, query);
|
|
48
53
|
}
|
|
49
54
|
function deleteAddress(session, id) {
|
|
50
55
|
return rechargeApiRequest("delete", `/addresses`, { id }, getInternalSession(session, "deleteAddress"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.js","sources":["../../../src/api/address.ts"],"sourcesContent":["import { getInternalSession, rechargeApiRequest } from '../utils/request';\nimport {\n AddressResponse,\n AddressListParams,\n CreateAddressRequest,\n UpdateAddressRequest,\n AddressListResponse,\n MergeAddressesRequest,\n SkipFutureChargeAddressRequest,\n SkipFutureChargeAddressResponse,\n GetAddressOptions,\n Session,\n} from '../types';\n\n/** Returns all addresses from the store, or addresses for the customer given in the parameter. */\nexport function listAddresses(session: Session, query?: AddressListParams) {\n return rechargeApiRequest<AddressListResponse>(\n 'get',\n `/addresses`,\n { query },\n getInternalSession(session, 'listAddresses')\n );\n}\n\n/** Retrieves address for customer based on specified address id. */\nexport async function getAddress(session: Session, id: string | number, options?: GetAddressOptions) {\n const { address } = await rechargeApiRequest<AddressResponse>(\n 'get',\n `/addresses`,\n {\n id,\n query: { include: options?.include },\n },\n getInternalSession(session, 'getAddress')\n );\n return address;\n}\n\n/** Create a new address for a customer. */\nexport async function createAddress(session: Session, createRequest: CreateAddressRequest) {\n const { address } = await rechargeApiRequest<AddressResponse>(\n 'post',\n `/addresses`,\n { data: { customer_id: session.customerId ? Number(session.customerId) : undefined, ...createRequest } },\n getInternalSession(session, 'createAddress')\n );\n return address;\n}\n\n/** Updates an existing address to match the specified parameters. */\nexport async function updateAddress(session: Session
|
|
1
|
+
{"version":3,"file":"address.js","sources":["../../../src/api/address.ts"],"sourcesContent":["import { getInternalSession, rechargeApiRequest } from '../utils/request';\nimport {\n AddressResponse,\n AddressListParams,\n CreateAddressRequest,\n UpdateAddressRequest,\n AddressListResponse,\n MergeAddressesRequest,\n SkipFutureChargeAddressRequest,\n SkipFutureChargeAddressResponse,\n GetAddressOptions,\n Session,\n UpdateAddressParams,\n} from '../types';\n\n/** Returns all addresses from the store, or addresses for the customer given in the parameter. */\nexport function listAddresses(session: Session, query?: AddressListParams) {\n return rechargeApiRequest<AddressListResponse>(\n 'get',\n `/addresses`,\n { query },\n getInternalSession(session, 'listAddresses')\n );\n}\n\n/** Retrieves address for customer based on specified address id. */\nexport async function getAddress(session: Session, id: string | number, options?: GetAddressOptions) {\n const { address } = await rechargeApiRequest<AddressResponse>(\n 'get',\n `/addresses`,\n {\n id,\n query: { include: options?.include },\n },\n getInternalSession(session, 'getAddress')\n );\n return address;\n}\n\n/** Create a new address for a customer. */\nexport async function createAddress(session: Session, createRequest: CreateAddressRequest) {\n const { address } = await rechargeApiRequest<AddressResponse>(\n 'post',\n `/addresses`,\n { data: { customer_id: session.customerId ? Number(session.customerId) : undefined, ...createRequest } },\n getInternalSession(session, 'createAddress')\n );\n return address;\n}\n\n/** Updates an existing address to match the specified parameters. */\nexport async function updateAddress(\n session: Session,\n id: string | number,\n updateRequest: UpdateAddressRequest,\n query?: UpdateAddressParams\n) {\n const { address } = await rechargeApiRequest<AddressResponse>(\n 'put',\n `/addresses`,\n { id, data: updateRequest, query },\n getInternalSession(session, 'updateAddress')\n );\n return address;\n}\n\n/** Apply discount code to an address. Addresses are currently limited to a single discount. */\nexport async function applyDiscountToAddress(\n session: Session,\n id: string | number,\n discountCode: string,\n query?: UpdateAddressParams\n) {\n return updateAddress(\n getInternalSession(session, 'applyDiscountToAddress'),\n id,\n {\n discounts: [{ code: discountCode }],\n },\n query\n );\n}\n\n/** Removes all discounts from an address. */\nexport async function removeDiscountsFromAddress(session: Session, id: string | number, query?: UpdateAddressParams) {\n return updateAddress(getInternalSession(session, 'removeDiscountsFromAddress'), id, { discounts: [] }, query);\n}\n\n/** Deletes an address. Only Addresses with no active Subscriptions can be deleted. */\nexport function deleteAddress(session: Session, id: string | number) {\n return rechargeApiRequest<void>('delete', `/addresses`, { id }, getInternalSession(session, 'deleteAddress'));\n}\n\n/**\n * Merges up to 10 source addresses into 1 target address.\n */\nexport async function mergeAddresses(session: Session, mergeRequest: MergeAddressesRequest) {\n const { address } = await rechargeApiRequest<AddressResponse>(\n 'post',\n `/addresses/merge`,\n {\n data: mergeRequest,\n },\n getInternalSession(session, 'mergeAddresses')\n );\n return address;\n}\n\n/**\n * Skip a Charge in the future for one or multiple Subscriptions associated with the Address.\n */\nexport async function skipFutureCharge(\n session: Session,\n id: string | number,\n skipRequest: SkipFutureChargeAddressRequest\n) {\n const { charge } = await rechargeApiRequest<SkipFutureChargeAddressResponse>(\n 'post',\n `/addresses/${id}/charges/skip`,\n {\n data: skipRequest,\n },\n getInternalSession(session, 'skipFutureCharge')\n );\n return charge;\n}\n"],"names":[],"mappings":";;AAgBgB,SAAA,aAAA,CAAc,SAAkB,KAA2B,EAAA;AACzE,EAAO,OAAA,kBAAA;AAAA,IACL,KAAA;AAAA,IACA,CAAA,UAAA,CAAA;AAAA,IACA,EAAE,KAAM,EAAA;AAAA,IACR,kBAAA,CAAmB,SAAS,eAAe,CAAA;AAAA,GAC7C,CAAA;AACF,CAAA;AAGsB,eAAA,UAAA,CAAW,OAAkB,EAAA,EAAA,EAAqB,OAA6B,EAAA;AACnG,EAAM,MAAA,EAAE,OAAQ,EAAA,GAAI,MAAM,kBAAA;AAAA,IACxB,KAAA;AAAA,IACA,CAAA,UAAA,CAAA;AAAA,IACA;AAAA,MACE,EAAA;AAAA,MACA,KAAO,EAAA,EAAE,OAAS,EAAA,OAAA,EAAS,OAAQ,EAAA;AAAA,KACrC;AAAA,IACA,kBAAA,CAAmB,SAAS,YAAY,CAAA;AAAA,GAC1C,CAAA;AACA,EAAO,OAAA,OAAA,CAAA;AACT,CAAA;AAGsB,eAAA,aAAA,CAAc,SAAkB,aAAqC,EAAA;AACzF,EAAM,MAAA,EAAE,OAAQ,EAAA,GAAI,MAAM,kBAAA;AAAA,IACxB,MAAA;AAAA,IACA,CAAA,UAAA,CAAA;AAAA,IACA,EAAE,IAAA,EAAM,EAAE,WAAA,EAAa,OAAQ,CAAA,UAAA,GAAa,MAAO,CAAA,OAAA,CAAQ,UAAU,CAAA,GAAI,KAAW,CAAA,EAAA,GAAG,eAAgB,EAAA;AAAA,IACvG,kBAAA,CAAmB,SAAS,eAAe,CAAA;AAAA,GAC7C,CAAA;AACA,EAAO,OAAA,OA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AM,EAAA,YAAA;AAAA,KACR;AAAA,IACA,kBAAA,CAAmB,SAAS,gBAAgB,CAAA;AAAA,GAC9C,CAAA;AACA,EAAO,OAAA,OAAA,CAAA;AACT,CAAA;AAKsB,eAAA,gBAAA,CACpB,OACA,EAAA,EAAA,EACA,WACA,EAAA;AACA,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,MAAM,kBAAA;AAAA,IACvB,MAAA;AAAA,IACA,cAAc,EAAE,CAAA,aAAA,CAAA;AAAA,IAChB;AAAA,MACE,IAAM,EAAA,WAAA;AAAA,KACR;AAAA,IACA,kBAAA,CAAmB,SAAS,kBAAkB,CAAA;AAAA,GAChD,CAAA;AACA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
|
package/dist/esm/api/auth.js
CHANGED
|
@@ -140,7 +140,7 @@ async function rechargeAdminRequest(method, url, { id, query, data, headers } =
|
|
|
140
140
|
...storefrontAccessToken ? { "X-Recharge-Storefront-Access-Token": storefrontAccessToken } : {},
|
|
141
141
|
...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
|
|
142
142
|
...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
|
|
143
|
-
"X-Recharge-Sdk-Version": "1.
|
|
143
|
+
"X-Recharge-Sdk-Version": "1.28.0",
|
|
144
144
|
...headers ? headers : {}
|
|
145
145
|
};
|
|
146
146
|
return request(method, `${rechargeBaseUrl}${url}`, { id, query, data, headers: reqHeaders });
|
|
@@ -134,15 +134,19 @@ async function createSubscriptions(session, createRequestBulk, query) {
|
|
|
134
134
|
}
|
|
135
135
|
const bulkSubscriptionMapperPartial = partial(bulkSubscriptionCreateMapper, customerId);
|
|
136
136
|
const requestData = createRequestBulk.map(bulkSubscriptionMapperPartial);
|
|
137
|
+
let localQuery = void 0;
|
|
138
|
+
if (query?.allow_onetimes !== void 0) {
|
|
139
|
+
localQuery = { allow_onetimes: query.allow_onetimes };
|
|
140
|
+
}
|
|
137
141
|
const { subscriptions } = await rechargeApiRequest(
|
|
138
142
|
"post",
|
|
139
143
|
`/addresses/${addressId}/subscriptions-bulk`,
|
|
140
144
|
{
|
|
141
|
-
data: { subscriptions: requestData },
|
|
145
|
+
data: { subscriptions: requestData, commit_update: !!query?.commit },
|
|
142
146
|
headers: {
|
|
143
147
|
"X-Recharge-Version": "2021-01"
|
|
144
148
|
},
|
|
145
|
-
query
|
|
149
|
+
query: localQuery
|
|
146
150
|
},
|
|
147
151
|
getInternalSession(session, "createSubscriptions")
|
|
148
152
|
);
|
|
@@ -167,7 +171,7 @@ async function updateSubscriptions(session, addressId, updateRequestBulk, query)
|
|
|
167
171
|
"put",
|
|
168
172
|
`/addresses/${addressId}/subscriptions-bulk`,
|
|
169
173
|
{
|
|
170
|
-
data: { subscriptions: requestData },
|
|
174
|
+
data: { subscriptions: requestData, commit_update: !!query?.commit },
|
|
171
175
|
headers: {
|
|
172
176
|
"X-Recharge-Version": "2021-01"
|
|
173
177
|
},
|
|
@@ -194,7 +198,7 @@ async function deleteSubscriptions(session, addressId, deleteRequestBulk, query)
|
|
|
194
198
|
"delete",
|
|
195
199
|
`/addresses/${addressId}/subscriptions-bulk`,
|
|
196
200
|
{
|
|
197
|
-
data: { subscriptions: deleteRequestBulk, send_email: query?.send_email
|
|
201
|
+
data: { subscriptions: deleteRequestBulk, send_email: !!query?.send_email, commit_update: !!query?.commit },
|
|
198
202
|
headers: {
|
|
199
203
|
"X-Recharge-Version": "2021-01"
|
|
200
204
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription.js","sources":["../../../src/api/subscription.ts"],"sourcesContent":["import partial from 'lodash.partial';\nimport { getInternalSession, rechargeApiRequest } from '../utils/request';\nimport {\n CancelSubscriptionRequest,\n CreateSubscriptionRequest,\n Subscription,\n SubscriptionsResponse,\n SubscriptionListParams,\n UpdateSubscriptionRequest,\n UpdateSubscriptionParams,\n GetSubscriptionOptions,\n BasicSubscriptionParams,\n Subscription_2021_01,\n UpdateSubscriptionsRequest,\n UpdateSubscriptionsParams,\n Session,\n ChargeResponse,\n CreateRecipientAddress,\n Onetime,\n IsoDateString,\n CreateSubscriptionsParams,\n CreateSubscriptionsRequest,\n DeleteSubscriptionsParams,\n DeleteSubscriptionsRequest,\n UpdateSubscriptionChargeDateParams,\n} from '../types';\nimport {\n bulkSubscriptionCreateMapper,\n bulkSubscriptionUpdateMapper,\n subscriptionMapperOldToNew,\n} from '../mappers/subscription';\n\nexport async function getSubscription(\n session: Session,\n id: string | number,\n options?: GetSubscriptionOptions\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'get',\n `/subscriptions`,\n {\n id,\n query: { include: options?.include },\n },\n getInternalSession(session, 'getSubscription')\n );\n return subscription;\n}\n\nexport function listSubscriptions(session: Session, query?: SubscriptionListParams): Promise<SubscriptionsResponse> {\n return rechargeApiRequest<SubscriptionsResponse>(\n 'get',\n `/subscriptions`,\n { query },\n getInternalSession(session, 'listSubscriptions')\n );\n}\n\n/**\n * When creating a subscription via API, order_interval_frequency and charge_interval_frequency values do not necessarily\n * need to match the values set in the respective Plans. The product, however, does need to have at least one Plan in order\n * to be added to a subscription.\n */\nexport async function createSubscription(\n session: Session,\n createRequest: CreateSubscriptionRequest,\n query?: BasicSubscriptionParams\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'post',\n `/subscriptions`,\n {\n data: createRequest,\n query,\n },\n getInternalSession(session, 'createSubscription')\n );\n return subscription;\n}\n\n/**\n * Updating parameters like frequency, charge_interval_frequency, order_interval_frequency, order_interval_unit will cause our algorithm to automatically recalculate the next charge date (next_charge_scheduled_at).\n * WARNING: This update will remove skipped and manually changed charges.\n * If you want to change the next charge date (next_charge_scheduled_at) we recommend you to update these parameters first.\n * When updating order_interval_unit OR order_interval_frequency OR charge_interval_frequency all three parameters are required.\n */\nexport async function updateSubscription(\n session: Session,\n id: string | number,\n updateRequest: UpdateSubscriptionRequest,\n query?: UpdateSubscriptionParams\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'put',\n `/subscriptions`,\n {\n id,\n data: updateRequest,\n query,\n },\n getInternalSession(session, 'updateSubscription')\n );\n return subscription;\n}\n\n/**\n * If there are two active subscriptions with the same address_id, and you update their\n * next_charge_date parameters to match, their charges will get merged into a new charge\n * with a new id\n */\nexport async function updateSubscriptionChargeDate(\n session: Session,\n id: string | number,\n date: IsoDateString,\n query?: UpdateSubscriptionChargeDateParams\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'post',\n `/subscriptions/${id}/set_next_charge_date`,\n {\n data: { date },\n query,\n },\n getInternalSession(session, 'updateSubscriptionChargeDate')\n );\n return subscription;\n}\n\nexport async function updateSubscriptionAddress(\n session: Session,\n id: string | number,\n address_id: string | number\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'post',\n `/subscriptions/${id}/change_address`,\n {\n data: { address_id },\n },\n getInternalSession(session, 'updateSubscriptionAddress')\n );\n return subscription;\n}\n\n/**\n * An involuntary subscription cancelled due to max retries reached will trigger the\n * charge/max_retries_reached webhook. If this leads to the subscription being cancelled,\n * the subscription/cancelled webhook will trigger.\n */\nexport async function cancelSubscription(\n session: Session,\n id: string | number,\n cancelRequest: CancelSubscriptionRequest,\n query?: BasicSubscriptionParams\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'post',\n `/subscriptions/${id}/cancel`,\n {\n data: cancelRequest,\n query,\n },\n getInternalSession(session, 'cancelSubscription')\n );\n return subscription;\n}\n\n/**\n * When activating subscription, following attributes will be set to null: cancelled_at, cancellation_reason\n * and cancellation_reason_comments.\n */\nexport async function activateSubscription(\n session: Session,\n id: string | number,\n query?: BasicSubscriptionParams\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'post',\n `/subscriptions/${id}/activate`,\n { query },\n getInternalSession(session, 'activateSubscription')\n );\n return subscription;\n}\n\n/* Skip charge associated with a subscription. */\nexport async function skipSubscriptionCharge(session: Session, id: number | string, date: IsoDateString) {\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/subscriptions/${id}/charges/skip`,\n {\n data: {\n date,\n subscription_id: `${id}`,\n },\n },\n getInternalSession(session, 'skipSubscriptionCharge')\n );\n return charge;\n}\n\n/**\n * Gift a subscription to another person. This creates onetime products for the recipient and skips that subscription for the customer.\n * When the gifted onetime ships the recipient receives and email notification.\n */\nexport async function skipGiftSubscriptionCharge(\n session: Session,\n subscriptionIds: Array<number | string>,\n recipientAddress: CreateRecipientAddress\n) {\n const { onetimes } = await rechargeApiRequest<{ onetimes: Onetime[] }>(\n 'post',\n '/purchase_items/skip_gift',\n {\n data: {\n purchase_item_ids: subscriptionIds.map(Number),\n recipient_address: recipientAddress,\n },\n },\n getInternalSession(session, 'skipGiftSubscriptionCharge')\n );\n\n return onetimes;\n}\n\n/**\n * Bulk create new subscriptions.\n * Must all be for the same address.\n * There is a limit of 20 subscriptions per request.\n */\nexport async function createSubscriptions(\n session: Session,\n createRequestBulk: CreateSubscriptionsRequest[],\n query?: CreateSubscriptionsParams\n): Promise<Subscription[]> {\n // validate size\n const length = createRequestBulk.length;\n if (length < 1 || length > 21) {\n throw new Error('Number of subscriptions must be between 1 and 20.');\n }\n // validate customerId\n const { customerId } = session;\n if (!customerId) {\n throw new Error('No customerId in session.');\n }\n // validate addressId\n const addressId = createRequestBulk[0].address_id;\n if (!createRequestBulk.every(createRequest => createRequest.address_id === addressId)) {\n throw new Error('All subscriptions must have the same address_id.');\n }\n const bulkSubscriptionMapperPartial = partial(bulkSubscriptionCreateMapper, customerId);\n const requestData = createRequestBulk.map(bulkSubscriptionMapperPartial);\n const { subscriptions } = await rechargeApiRequest<{ subscriptions: Subscription_2021_01[] }>(\n 'post',\n `/addresses/${addressId}/subscriptions-bulk`,\n {\n data: { subscriptions: requestData },\n headers: {\n 'X-Recharge-Version': '2021-01',\n },\n query,\n },\n getInternalSession(session, 'createSubscriptions')\n );\n return subscriptions.map(subscriptionMapperOldToNew);\n}\n\n/**\n * Bulk update subscriptions.\n * Must all be for the same address.\n * There is a limit of 20 subscriptions per request.\n * Same rules apply as a single subscription update\n */\nexport async function updateSubscriptions(\n session: Session,\n addressId: string | number,\n updateRequestBulk: UpdateSubscriptionsRequest[],\n query?: UpdateSubscriptionsParams\n): Promise<Subscription[]> {\n // validate size\n const length = updateRequestBulk.length;\n if (length < 1 || length > 21) {\n throw new Error('Number of subscriptions must be between 1 and 20.');\n }\n // validate customerId\n const { customerId } = session;\n if (!customerId) {\n throw new Error('No customerId in session.');\n }\n const bulkSubscriptionMapperPartial = partial(bulkSubscriptionUpdateMapper, !!query?.force_update);\n const requestData = updateRequestBulk.map(bulkSubscriptionMapperPartial);\n // setup query params\n let localQuery: { allow_onetimes?: boolean } | undefined = undefined;\n if (query?.allow_onetimes !== undefined) {\n localQuery = { allow_onetimes: query.allow_onetimes };\n }\n const { subscriptions } = await rechargeApiRequest<{ subscriptions: Subscription_2021_01[] }>(\n 'put',\n `/addresses/${addressId}/subscriptions-bulk`,\n {\n data: { subscriptions: requestData },\n headers: {\n 'X-Recharge-Version': '2021-01',\n },\n query: localQuery,\n },\n getInternalSession(session, 'updateSubscriptions')\n );\n return subscriptions.map(subscriptionMapperOldToNew);\n}\n\n/**\n * @internal\n * Bulk delete subscriptions.\n * Must all be for the same address.\n * There is a limit of 20 subscriptions per request.\n */\nexport async function deleteSubscriptions(\n session: Session,\n addressId: string | number,\n deleteRequestBulk: DeleteSubscriptionsRequest[],\n query?: DeleteSubscriptionsParams\n): Promise<void> {\n // validate size\n const length = deleteRequestBulk.length;\n if (length < 1 || length > 21) {\n throw new Error('Number of subscriptions must be between 1 and 20.');\n }\n // validate customerId\n const { customerId } = session;\n if (!customerId) {\n throw new Error('No customerId in session.');\n }\n // setup query params\n let localQuery: { allow_onetimes?: boolean } | undefined = undefined;\n if (query?.allow_onetimes !== undefined) {\n localQuery = { allow_onetimes: query.allow_onetimes };\n }\n await rechargeApiRequest<{ subscriptions: Subscription_2021_01[] }>(\n 'delete',\n `/addresses/${addressId}/subscriptions-bulk`,\n {\n data: { subscriptions: deleteRequestBulk, send_email: query?.send_email ?? false },\n headers: {\n 'X-Recharge-Version': '2021-01',\n },\n query: localQuery,\n },\n getInternalSession(session, 'deleteSubscriptions')\n );\n return undefined;\n}\n"],"names":[],"mappings":";;;;AAgCsB,eAAA,eAAA,CACpB,OACA,EAAA,EAAA,EACA,OACuB,EAAA;AACvB,EAAM,MAAA,EAAE,YAAa,EAAA,GAAI,MAAM,kBAAA;AAAA,IAC7B,KAAA;AAAA,IACA,CAAA,cAAA,CAAA;AAAA,IACA;AAAA,MACE,EAAA;AAAA,MACA,KAAO,EAAA,EAAE,OAAS,EAAA,OAAA,EAAS,OAAQ,EAAA;AAAA,KACrC;AAAA,IACA,kBAAA,CAAmB,SAAS,iBAAiB,CAAA;AAAA,GAC/C,CAAA;AACA,EAAO,OAAA,YAAA,CAAA;AACT,CAAA;AAEgB,SAAA,iBAAA,CAAkB,SAAkB,KAAgE,EAAA;AAClH,EAAO,OAAA,kBAAA;AAAA,IACL,KAAA;AAAA,IACA,CAAA,cAAA,CAAA;AAAA,IACA,EAAE,KAAM,EAAA;AAAA,IACR,kBAAA,CAAmB,SAAS,mBAAmB,CAAA;AAAA,GACjD,CAAA;AACF,CAAA;AAOsB,eAAA,kBAAA,CACpB,OACA,EAAA,aAAA,EACA,KACuB,EAAA;AACvB,EAAM,MAAA,EAAE,YAAa,EAAA,GAAI,MAAM,kBAAA;AAAA,IAC7B,MAAA;AAAA,IACA,CAAA,cAAA,CAAA;AAAA,IACA;AAAA,MACE,IAAM,EAAA,aAAA;AAAA,MACN,KAAA;AAAA,KACF;AAAA,IACA,kBAAA,CAAmB,SAAS,oBAAoB,CAAA;AAAA,GAClD,CAAA;AACA,EAAO,OAAA,YAAA,CAAA;AACT,CAAA;AAQA,eAAsB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D,CAAA;AAQA,eAAsB,mBACpB,CAAA,OAAA,EACA,SACA,EAAA,iBAAA,EACA,KACe,EAAA;AAEf,EAAA,MAAM,SAAS,iBAAkB,CAAA,MAAA,CAAA;AACjC,EAAI,IAAA,MAAA,GAAS,CAAK,IAAA,MAAA,GAAS,EAAI,EAAA;AAC7B,IAAM,MAAA,IAAI,MAAM,mDAAmD,CAAA,CAAA;AAAA,GACrE;AAEA,EAAM,MAAA,EAAE,YAAe,GAAA,OAAA,CAAA;AACvB,EAAA,IAAI,CAAC,UAAY,EAAA;AACf,IAAM,MAAA,IAAI,MAAM,2BAA2B,CAAA,CAAA;AAAA,GAC7C;AAEA,EAAA,IAAI,UAAuD,GAAA,KAAA,CAAA,CAAA;AAC3D,EAAI,IAAA,KAAA,EAAO,mBAAmB,KAAW,CAAA,EAAA;AACvC,IAAa,UAAA,GAAA,EAAE,cAAgB,EAAA,KAAA,CAAM,cAAe,EAAA,CAAA;AAAA,GACtD;AACA,EAAM,MAAA,kBAAA;AAAA,IACJ,QAAA;AAAA,IACA,cAAc,SAAS,CAAA,mBAAA,CAAA;AAAA,IACvB;AAAA,MACE,MAAM,EAAE,aAAA,EAAe,mBAAmB,UAAY,EAAA,KAAA,EAAO,cAAc,KAAM,EAAA;AAAA,MACjF,OAAS,EAAA;AAAA,QACP,oBAAsB,EAAA,SAAA;AAAA,OACxB;AAAA,MACA,KAAO,EAAA,UAAA;AAAA,KACT;AAAA,IACA,kBAAA,CAAmB,SAAS,qBAAqB,CAAA;AAAA,GACnD,CAAA;AACA,EAAO,OAAA,KAAA,CAAA,CAAA;AACT;;;;"}
|
|
1
|
+
{"version":3,"file":"subscription.js","sources":["../../../src/api/subscription.ts"],"sourcesContent":["import partial from 'lodash.partial';\nimport { getInternalSession, rechargeApiRequest } from '../utils/request';\nimport {\n CancelSubscriptionRequest,\n CreateSubscriptionRequest,\n Subscription,\n SubscriptionsResponse,\n SubscriptionListParams,\n UpdateSubscriptionRequest,\n UpdateSubscriptionParams,\n GetSubscriptionOptions,\n BasicSubscriptionParams,\n Subscription_2021_01,\n UpdateSubscriptionsRequest,\n UpdateSubscriptionsParams,\n Session,\n ChargeResponse,\n CreateRecipientAddress,\n Onetime,\n IsoDateString,\n CreateSubscriptionsParams,\n CreateSubscriptionsRequest,\n DeleteSubscriptionsParams,\n DeleteSubscriptionsRequest,\n UpdateSubscriptionChargeDateParams,\n} from '../types';\nimport {\n bulkSubscriptionCreateMapper,\n bulkSubscriptionUpdateMapper,\n subscriptionMapperOldToNew,\n} from '../mappers/subscription';\n\nexport async function getSubscription(\n session: Session,\n id: string | number,\n options?: GetSubscriptionOptions\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'get',\n `/subscriptions`,\n {\n id,\n query: { include: options?.include },\n },\n getInternalSession(session, 'getSubscription')\n );\n return subscription;\n}\n\nexport function listSubscriptions(session: Session, query?: SubscriptionListParams): Promise<SubscriptionsResponse> {\n return rechargeApiRequest<SubscriptionsResponse>(\n 'get',\n `/subscriptions`,\n { query },\n getInternalSession(session, 'listSubscriptions')\n );\n}\n\n/**\n * When creating a subscription via API, order_interval_frequency and charge_interval_frequency values do not necessarily\n * need to match the values set in the respective Plans. The product, however, does need to have at least one Plan in order\n * to be added to a subscription.\n */\nexport async function createSubscription(\n session: Session,\n createRequest: CreateSubscriptionRequest,\n query?: BasicSubscriptionParams\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'post',\n `/subscriptions`,\n {\n data: createRequest,\n query,\n },\n getInternalSession(session, 'createSubscription')\n );\n return subscription;\n}\n\n/**\n * Updating parameters like frequency, charge_interval_frequency, order_interval_frequency, order_interval_unit will cause our algorithm to automatically recalculate the next charge date (next_charge_scheduled_at).\n * WARNING: This update will remove skipped and manually changed charges.\n * If you want to change the next charge date (next_charge_scheduled_at) we recommend you to update these parameters first.\n * When updating order_interval_unit OR order_interval_frequency OR charge_interval_frequency all three parameters are required.\n */\nexport async function updateSubscription(\n session: Session,\n id: string | number,\n updateRequest: UpdateSubscriptionRequest,\n query?: UpdateSubscriptionParams\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'put',\n `/subscriptions`,\n {\n id,\n data: updateRequest,\n query,\n },\n getInternalSession(session, 'updateSubscription')\n );\n return subscription;\n}\n\n/**\n * If there are two active subscriptions with the same address_id, and you update their\n * next_charge_date parameters to match, their charges will get merged into a new charge\n * with a new id\n */\nexport async function updateSubscriptionChargeDate(\n session: Session,\n id: string | number,\n date: IsoDateString,\n query?: UpdateSubscriptionChargeDateParams\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'post',\n `/subscriptions/${id}/set_next_charge_date`,\n {\n data: { date },\n query,\n },\n getInternalSession(session, 'updateSubscriptionChargeDate')\n );\n return subscription;\n}\n\nexport async function updateSubscriptionAddress(\n session: Session,\n id: string | number,\n address_id: string | number\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'post',\n `/subscriptions/${id}/change_address`,\n {\n data: { address_id },\n },\n getInternalSession(session, 'updateSubscriptionAddress')\n );\n return subscription;\n}\n\n/**\n * An involuntary subscription cancelled due to max retries reached will trigger the\n * charge/max_retries_reached webhook. If this leads to the subscription being cancelled,\n * the subscription/cancelled webhook will trigger.\n */\nexport async function cancelSubscription(\n session: Session,\n id: string | number,\n cancelRequest: CancelSubscriptionRequest,\n query?: BasicSubscriptionParams\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'post',\n `/subscriptions/${id}/cancel`,\n {\n data: cancelRequest,\n query,\n },\n getInternalSession(session, 'cancelSubscription')\n );\n return subscription;\n}\n\n/**\n * When activating subscription, following attributes will be set to null: cancelled_at, cancellation_reason\n * and cancellation_reason_comments.\n */\nexport async function activateSubscription(\n session: Session,\n id: string | number,\n query?: BasicSubscriptionParams\n): Promise<Subscription> {\n const { subscription } = await rechargeApiRequest<{ subscription: Subscription }>(\n 'post',\n `/subscriptions/${id}/activate`,\n { query },\n getInternalSession(session, 'activateSubscription')\n );\n return subscription;\n}\n\n/* Skip charge associated with a subscription. */\nexport async function skipSubscriptionCharge(session: Session, id: number | string, date: IsoDateString) {\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/subscriptions/${id}/charges/skip`,\n {\n data: {\n date,\n subscription_id: `${id}`,\n },\n },\n getInternalSession(session, 'skipSubscriptionCharge')\n );\n return charge;\n}\n\n/**\n * Gift a subscription to another person. This creates onetime products for the recipient and skips that subscription for the customer.\n * When the gifted onetime ships the recipient receives and email notification.\n */\nexport async function skipGiftSubscriptionCharge(\n session: Session,\n subscriptionIds: Array<number | string>,\n recipientAddress: CreateRecipientAddress\n) {\n const { onetimes } = await rechargeApiRequest<{ onetimes: Onetime[] }>(\n 'post',\n '/purchase_items/skip_gift',\n {\n data: {\n purchase_item_ids: subscriptionIds.map(Number),\n recipient_address: recipientAddress,\n },\n },\n getInternalSession(session, 'skipGiftSubscriptionCharge')\n );\n\n return onetimes;\n}\n\n/**\n * Bulk create new subscriptions.\n * Must all be for the same address.\n * There is a limit of 20 subscriptions per request.\n */\nexport async function createSubscriptions(\n session: Session,\n createRequestBulk: CreateSubscriptionsRequest[],\n query?: CreateSubscriptionsParams\n): Promise<Subscription[]> {\n // validate size\n const length = createRequestBulk.length;\n if (length < 1 || length > 21) {\n throw new Error('Number of subscriptions must be between 1 and 20.');\n }\n // validate customerId\n const { customerId } = session;\n if (!customerId) {\n throw new Error('No customerId in session.');\n }\n // validate addressId\n const addressId = createRequestBulk[0].address_id;\n if (!createRequestBulk.every(createRequest => createRequest.address_id === addressId)) {\n throw new Error('All subscriptions must have the same address_id.');\n }\n const bulkSubscriptionMapperPartial = partial(bulkSubscriptionCreateMapper, customerId);\n const requestData = createRequestBulk.map(bulkSubscriptionMapperPartial);\n // setup query params\n let localQuery: { allow_onetimes?: boolean } | undefined = undefined;\n if (query?.allow_onetimes !== undefined) {\n localQuery = { allow_onetimes: query.allow_onetimes };\n }\n const { subscriptions } = await rechargeApiRequest<{ subscriptions: Subscription_2021_01[] }>(\n 'post',\n `/addresses/${addressId}/subscriptions-bulk`,\n {\n data: { subscriptions: requestData, commit_update: !!query?.commit },\n headers: {\n 'X-Recharge-Version': '2021-01',\n },\n query: localQuery,\n },\n getInternalSession(session, 'createSubscriptions')\n );\n return subscriptions.map(subscriptionMapperOldToNew);\n}\n\n/**\n * Bulk update subscriptions.\n * Must all be for the same address.\n * There is a limit of 20 subscriptions per request.\n * Same rules apply as a single subscription update\n */\nexport async function updateSubscriptions(\n session: Session,\n addressId: string | number,\n updateRequestBulk: UpdateSubscriptionsRequest[],\n query?: UpdateSubscriptionsParams\n): Promise<Subscription[]> {\n // validate size\n const length = updateRequestBulk.length;\n if (length < 1 || length > 21) {\n throw new Error('Number of subscriptions must be between 1 and 20.');\n }\n // validate customerId\n const { customerId } = session;\n if (!customerId) {\n throw new Error('No customerId in session.');\n }\n const bulkSubscriptionMapperPartial = partial(bulkSubscriptionUpdateMapper, !!query?.force_update);\n const requestData = updateRequestBulk.map(bulkSubscriptionMapperPartial);\n // setup query params\n let localQuery: { allow_onetimes?: boolean } | undefined = undefined;\n if (query?.allow_onetimes !== undefined) {\n localQuery = { allow_onetimes: query.allow_onetimes };\n }\n const { subscriptions } = await rechargeApiRequest<{ subscriptions: Subscription_2021_01[] }>(\n 'put',\n `/addresses/${addressId}/subscriptions-bulk`,\n {\n data: { subscriptions: requestData, commit_update: !!query?.commit },\n headers: {\n 'X-Recharge-Version': '2021-01',\n },\n query: localQuery,\n },\n getInternalSession(session, 'updateSubscriptions')\n );\n return subscriptions.map(subscriptionMapperOldToNew);\n}\n\n/**\n * @internal\n * Bulk delete subscriptions.\n * Must all be for the same address.\n * There is a limit of 20 subscriptions per request.\n */\nexport async function deleteSubscriptions(\n session: Session,\n addressId: string | number,\n deleteRequestBulk: DeleteSubscriptionsRequest[],\n query?: DeleteSubscriptionsParams\n): Promise<void> {\n // validate size\n const length = deleteRequestBulk.length;\n if (length < 1 || length > 21) {\n throw new Error('Number of subscriptions must be between 1 and 20.');\n }\n // validate customerId\n const { customerId } = session;\n if (!customerId) {\n throw new Error('No customerId in session.');\n }\n // setup query params\n let localQuery: { allow_onetimes?: boolean } | undefined = undefined;\n if (query?.allow_onetimes !== undefined) {\n localQuery = { allow_onetimes: query.allow_onetimes };\n }\n await rechargeApiRequest<{ subscriptions: Subscription_2021_01[] }>(\n 'delete',\n `/addresses/${addressId}/subscriptions-bulk`,\n {\n data: { subscriptions: deleteRequestBulk, send_email: !!query?.send_email, commit_update: !!query?.commit },\n headers: {\n 'X-Recharge-Version': '2021-01',\n },\n query: localQuery,\n },\n getInternalSession(session, 'deleteSubscriptions')\n );\n return undefined;\n}\n"],"names":[],"mappings":";;;;AAgCsB,eAAA,eAAA,CACpB,OACA,EAAA,EAAA,EACA,OACuB,EAAA;AACvB,EAAM,MAAA,EAAE,YAAa,EAAA,GAAI,MAAM,kBAAA;AAAA,IAC7B,KAAA;AAAA,IACA,CAAA,cAAA,CAAA;AAAA,IACA;AAAA,MACE,EAAA;AAAA,MACA,KAAO,EAAA,EAAE,OAAS,EAAA,OAAA,EAAS,OAAQ,EAAA;AAAA,KACrC;AAAA,IACA,kBAAA,CAAmB,SAAS,iBAAiB,CAAA;AAAA,GAC/C,CAAA;AACA,EAAO,OAAA,YAAA,CAAA;AACT,CAAA;AAEgB,SAAA,iBAAA,CAAkB,SAAkB,KAAgE,EAAA;AAClH,EAAO,OAAA,kBAAA;AAAA,IACL,KAAA;AAAA,IACA,CAAA,cAAA,CAAA;AAAA,IACA,EAAE,KAAM,EAAA;AAAA,IACR,kBAAA,CAAmB,SAAS,mBAAmB,CAAA;AAAA,GACjD,CAAA;AACF,CAAA;AAOsB,eAAA,kBAAA,CACpB,OACA,EAAA,aAAA,EACA,KACuB,EAAA;AACvB,EAAM,MAAA,EAAE,YAAa,EAAA,GAAI,MAAM,kBAAA;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aAAe,EAAA,iBAAA,EAAmB,UAAY,EAAA,CAAC,CAAC,KAAA,EAAO,UAAY,EAAA,aAAA,EAAe,CAAC,CAAC,OAAO,MAAO,EAAA;AAAA,MAC1G,OAAS,EAAA;AAAA,QACP,oBAAsB,EAAA,SAAA;AAAA,OACxB;AAAA,MACA,KAAO,EAAA,UAAA;AAAA,KACT;AAAA,IACA,kBAAA,CAAmB,SAAS,qBAAqB,CAAA;AAAA,GACnD,CAAA;AACA,EAAO,OAAA,KAAA,CAAA,CAAA;AACT;;;;"}
|
|
@@ -33,7 +33,7 @@ async function rechargeApiRequest(method, url, { id, query, data, headers } = {}
|
|
|
33
33
|
"X-Recharge-Sdk-Fn": session.internalFnCall,
|
|
34
34
|
...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
|
|
35
35
|
...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
|
|
36
|
-
"X-Recharge-Sdk-Version": "1.
|
|
36
|
+
"X-Recharge-Sdk-Version": "1.28.0",
|
|
37
37
|
"X-Request-Id": session.internalRequestId,
|
|
38
38
|
...headers ? headers : {}
|
|
39
39
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -772,28 +772,26 @@ interface BasicSubscriptionParams {
|
|
|
772
772
|
/** If set to True, updates will also be applied to CANCELLED subscriptions. If null or False, only ACTIVE subscriptions will be updated. */
|
|
773
773
|
force_update?: boolean;
|
|
774
774
|
}
|
|
775
|
+
interface UpdateSubscriptionParams extends BasicSubscriptionParams {
|
|
776
|
+
}
|
|
775
777
|
interface UpdateSubscriptionChargeDateParams extends BasicSubscriptionParams {
|
|
776
778
|
/** If set to true the subscription will trigger a pause event/webhook. */
|
|
777
779
|
pause?: boolean;
|
|
778
780
|
}
|
|
779
|
-
interface
|
|
781
|
+
interface BulkSubscriptionParams {
|
|
780
782
|
/** Allows onetimes to be updated with subscriptions */
|
|
781
783
|
allow_onetimes?: boolean;
|
|
784
|
+
/** Controls whether the QUEUED charges linked to the subscription should be regenerated upon subscription update. By default the flag is set to false which will delay charge regeneration 5 seconds. This enables running multiple calls to perform changes and receive responses much faster since the API won’t wait for a charge regeneration to complete. Setting this parameter to true will cause charge regeneration to complete before returning a response. */
|
|
785
|
+
commit?: boolean;
|
|
782
786
|
}
|
|
783
|
-
interface
|
|
784
|
-
/** If set to True, updates will also be applied to CANCELLED subscriptions. If null or False, only ACTIVE subscriptions will be updated. */
|
|
785
|
-
force_update?: boolean;
|
|
786
|
-
/** Allows onetimes to be updated with subscriptions */
|
|
787
|
-
allow_onetimes?: boolean;
|
|
787
|
+
interface CreateSubscriptionsParams extends BulkSubscriptionParams {
|
|
788
788
|
}
|
|
789
|
-
interface
|
|
789
|
+
interface UpdateSubscriptionsParams extends BulkSubscriptionParams {
|
|
790
790
|
/** If set to True, updates will also be applied to CANCELLED subscriptions. If null or False, only ACTIVE subscriptions will be updated. */
|
|
791
791
|
force_update?: boolean;
|
|
792
792
|
}
|
|
793
793
|
/** @internal */
|
|
794
|
-
interface DeleteSubscriptionsParams {
|
|
795
|
-
/** Allows onetimes to be updated with subscriptions */
|
|
796
|
-
allow_onetimes?: boolean;
|
|
794
|
+
interface DeleteSubscriptionsParams extends BulkSubscriptionParams {
|
|
797
795
|
/** When your store setting indicates that cancellation emails should be sent, this value determines if subscription cancellation emails should be sent. If set to true, cancellation emails will be sent for each of the specified subscriptions. If set to false, cancellation emails will not be sent for any of the specified subscriptions. */
|
|
798
796
|
send_email?: boolean;
|
|
799
797
|
}
|
|
@@ -1348,6 +1346,10 @@ interface CreateAddressRequest {
|
|
|
1348
1346
|
interface CreateRecipientAddress extends Omit<CreateAddressRequest, 'customer_id' | 'discounts' | 'order_attributes' | 'order_notes' | 'payment_method_id' | 'presentment_currency' | 'shipping_lines_override'> {
|
|
1349
1347
|
email: string;
|
|
1350
1348
|
}
|
|
1349
|
+
interface UpdateAddressParams {
|
|
1350
|
+
/** Controls whether the charges linked to the address should be regenerated upon address update. By default the flag is set to false which will delay charge regeneration 5 seconds. This enables running multiple calls to perform changes and receive responses much faster since the API won’t wait for a charge regeneration to complete. Setting this parameter to true will cause charge regeneration to complete before returning a response. */
|
|
1351
|
+
commit?: boolean;
|
|
1352
|
+
}
|
|
1351
1353
|
interface UpdateAddressRequest extends Omit<Partial<CreateAddressRequest>, 'presentment_currency' | 'customer_id' | 'discounts'> {
|
|
1352
1354
|
discounts?: {
|
|
1353
1355
|
code: string;
|
|
@@ -1820,6 +1822,8 @@ interface ProductSearchParams_2022_06 extends ListParams<SortBy> {
|
|
|
1820
1822
|
external_variant_ids?: (string | number)[];
|
|
1821
1823
|
/** Required. Product search version. */
|
|
1822
1824
|
format_version: '2022-06';
|
|
1825
|
+
/** If true, return only products that have a bundle product */
|
|
1826
|
+
has_bundle_product?: boolean;
|
|
1823
1827
|
/** If true, return only products that have at least one non-deleted plan in Recharge */
|
|
1824
1828
|
has_plans?: boolean;
|
|
1825
1829
|
/** Accepts either an external_product_id or an external_variant_id. Must perform exact match. */
|
|
@@ -2748,11 +2752,11 @@ declare function getAddress(session: Session, id: string | number, options?: Get
|
|
|
2748
2752
|
/** Create a new address for a customer. */
|
|
2749
2753
|
declare function createAddress(session: Session, createRequest: CreateAddressRequest): Promise<Address>;
|
|
2750
2754
|
/** Updates an existing address to match the specified parameters. */
|
|
2751
|
-
declare function updateAddress(session: Session, id: string | number, updateRequest: UpdateAddressRequest): Promise<Address>;
|
|
2755
|
+
declare function updateAddress(session: Session, id: string | number, updateRequest: UpdateAddressRequest, query?: UpdateAddressParams): Promise<Address>;
|
|
2752
2756
|
/** Apply discount code to an address. Addresses are currently limited to a single discount. */
|
|
2753
|
-
declare function applyDiscountToAddress(session: Session, id: string | number, discountCode: string): Promise<Address>;
|
|
2757
|
+
declare function applyDiscountToAddress(session: Session, id: string | number, discountCode: string, query?: UpdateAddressParams): Promise<Address>;
|
|
2754
2758
|
/** Removes all discounts from an address. */
|
|
2755
|
-
declare function removeDiscountsFromAddress(session: Session, id: string | number): Promise<Address>;
|
|
2759
|
+
declare function removeDiscountsFromAddress(session: Session, id: string | number, query?: UpdateAddressParams): Promise<Address>;
|
|
2756
2760
|
/** Deletes an address. Only Addresses with no active Subscriptions can be deleted. */
|
|
2757
2761
|
declare function deleteAddress(session: Session, id: string | number): Promise<void>;
|
|
2758
2762
|
/**
|
|
@@ -2980,4 +2984,4 @@ declare const api: {
|
|
|
2980
2984
|
};
|
|
2981
2985
|
declare function initRecharge(opt?: InitOptions): void;
|
|
2982
2986
|
|
|
2983
|
-
export { type ActivateMembershipRequest, type AddToCartCallbackSettings, type AddonSettings, type Address, type AddressIncludes, type AddressListParams, type AddressListResponse, type AddressResponse, type AddressSortBy, type AnalyticsData, type ApplyCreditOptions, type AssociatedAddress, type BasicSubscriptionParams, type BooleanLike, type BooleanNumbers, type BooleanString, type BooleanStringNumbers, type BundleAppProxy, type BundleData, type BundlePriceRule, type BundleProduct, type BundleProductLayoutSettings, type BundlePurchaseItem, type BundlePurchaseItemParams, type BundleSelection, type BundleSelectionAppProxy, type BundleSelectionItem, type BundleSelectionItemRequiredCreateProps, type BundleSelectionListParams, type BundleSelectionsResponse, type BundleSelectionsSortBy, type BundleTemplateSettings, type BundleTemplateType, type BundleTranslations, type BundleVariant, type BundleVariantOptionSource, type BundleVariantRange, type BundleVariantSelectionDefault, type CDNBaseWidgetSettings, type CDNBundleSettings, type CDNBundleVariant, type CDNBundleVariantOptionSource, type CDNPlan, type CDNProduct, type CDNProductAndSettings, type CDNProductKeyObject, type CDNProductQuery_2020_12, type CDNProductQuery_2022_06, type CDNProductRaw, type CDNProductResource, type CDNProductResponseType, type CDNProductType, type CDNProductVariant_2022_06, type CDNProduct_2022_06, type CDNProductsAndSettings, type CDNProductsAndSettingsResource, type CDNStoreSettings, type CDNSubscriptionOption, type CDNVariant, type CDNVersion, type CDNWidgetSettings, type CDNWidgetSettingsRaw, type CDNWidgetSettingsResource, type CRUDRequestOptions, type CancelMembershipRequest, type CancelSubscriptionRequest, type ChangeMembershipRequest, type ChannelSettings, type Charge, type ChargeIncludes, type ChargeListParams, type ChargeListResponse, type ChargeResponse, type ChargeSortBy, type ChargeStatus, type Collection, type CollectionListParams, type CollectionTypes, type CollectionsResponse, type CollectionsSortBy, type ColorString, type CreateAddressRequest, type CreateBundleSelectionRequest, type CreateMetafieldRequest, type CreateOnetimeRequest, type CreatePaymentMethodRequest, type CreateRecipientAddress, type CreateSubscriptionRequest, type CreateSubscriptionsParams, type CreateSubscriptionsRequest, type CreditAccount, type CreditAccountIncludes, type CreditAccountListParams, type CreditAccountType, type CreditAccountsResponse, type CreditAccountsSortBy, type CreditSummaryIncludes, type CrossSellsSettings, type Customer, type CustomerCreditSummary, type CustomerDeliveryScheduleParams, type CustomerDeliveryScheduleResponse, type CustomerIncludes, type CustomerNotification, type CustomerNotificationOptions, type CustomerNotificationTemplate, type CustomerNotificationType, type CustomerPortalAccessOptions, type CustomerPortalAccessResponse, type CustomerPortalSettings, type DeleteSubscriptionsParams, type DeleteSubscriptionsRequest, type Delivery, type DeliveryLineItem, type DeliveryOrder, type DeliveryPaymentMethod, type Discount, type DiscountType, type DynamicBundleItemAppProxy, type DynamicBundlePropertiesAppProxy, type ExternalAttributeSchema, type ExternalId, type ExternalTransactionId, type FirstOption, type GetAddressOptions, type GetChargeOptions, type GetCreditSummaryOptions, type GetCustomerOptions, type GetMembershipProgramOptions, type GetPaymentMethodOptions, type GetRequestOptions, type GetSubscriptionOptions, type GiftPurchase, type GiftPurchasesParams, type GiftPurchasesResponse, type HTMLString, type InitOptions, type InternalSession, type IntervalUnit, type IsoDateString, type LineItem, type ListParams, type LoginResponse, type Membership, type MembershipBenefit, type MembershipIncludes, type MembershipListParams, type MembershipListResponse, type MembershipProgram, type MembershipProgramIncludes, type MembershipProgramListParams, type MembershipProgramListResponse, type MembershipProgramResponse, type MembershipProgramSortBy, type MembershipProgramStatus, type MembershipResponse, type MembershipStatus, type MembershipsSortBy, type MergeAddressesRequest, type Metafield, type MetafieldOptionalCreateProps, type MetafieldOwnerResource, type MetafieldRequiredCreateProps, type Method, type Modifier, type MultiStepSettings, type OfferAttributes, type OnePageSettings, type Onetime, type OnetimeListParams, type OnetimeOptionalCreateProps, type OnetimeRequiredCreateProps, type OnetimeSubscription, type OnetimesResponse, type OnetimesSortBy, type Order, type OrderIncludes, type OrderListParams, type OrderSortBy, type OrderStatus, type OrderType, type OrdersResponse, type PasswordlessCodeResponse, type PasswordlessOptions, type PasswordlessValidateResponse, type PaymentDetails, type PaymentMethod, type PaymentMethodIncludes, type PaymentMethodListParams, type PaymentMethodOptionalCreateProps, type PaymentMethodRequiredCreateProps, type PaymentMethodSortBy, type PaymentMethodStatus, type PaymentMethodsResponse, type PaymentType, type Plan, type PlanListParams, type PlanSortBy, type PlanType, type PlansResponse, type ProcessorName, type ProductImage, type ProductInclude, type ProductListResponse, type ProductOption, type ProductSearchParams_2020_12, type ProductSearchParams_2022_06, type ProductSearchResponse_2020_12, type ProductSearchResponse_2022_06, type ProductSearchType, type ProductSource, type ProductValueOption, type ProductVariant_2020_12, type ProductVariant_2022_06, type Product_2020_12, type Product_2022_06, type Property, type PublishStatus, type RecurringSubscription, type ReferralInfo, type ReferralUrl, type Request, type RequestHeaders, type RequestOptions, type SellingPlan, type SellingPlanGroup, type Session, type ShippingCountriesOptions, type ShippingCountriesResponse, type ShippingCountry, type ShippingLine, type ShippingProvince, type ShopifyUpdatePaymentInfoOptions, type SkipChargeParams, type SkipFutureChargeAddressRequest, type SkipFutureChargeAddressResponse, type SortBy, type SortField, type SortKeys, type StepSettings, type StepSettingsCommon, type StepSettingsTypes, type StoreSettings, type StorefrontEnvironment, type StorefrontOptions, type StorefrontPurchaseOption, type SubType, type Subscription, type SubscriptionBase, type SubscriptionCancelled, type SubscriptionIncludes, type SubscriptionListParams, type SubscriptionOption, type SubscriptionOptionalCreateProps, type SubscriptionPreferences, type SubscriptionRequiredCreateProps, type SubscriptionSortBy, type SubscriptionStatus, type Subscription_2021_01, type SubscriptionsResponse, type TaxLine, type Translations, type UpdateAddressRequest, type UpdateBundlePurchaseItem, type UpdateBundleSelectionRequest, type UpdateCustomerRequest, type UpdateMetafieldRequest, type UpdateOnetimeRequest, type UpdatePaymentMethodRequest, type UpdateSubscriptionChargeDateParams, type UpdateSubscriptionParams, type UpdateSubscriptionRequest, type UpdateSubscriptionsParams, type UpdateSubscriptionsRequest, type VariantSelector, type VariantSelectorStepSetting, type WidgetIconColor, type WidgetTemplateType, type WidgetVisibility, activateMembership, activateSubscription, api, applyDiscountToAddress, applyDiscountToCharge, cancelMembership, cancelSubscription, changeMembership, createAddress, createBundleSelection, createMetafield, createOnetime, createPaymentMethod, createSubscription, createSubscriptions, deleteAddress, deleteBundleSelection, deleteMetafield, deleteOnetime, deleteSubscriptions, getActiveChurnLandingPageURL, getAddress, getBundleId, getBundleSelection, getCDNBundleSettings, getCDNProduct, getCDNProductAndSettings, getCDNProducts, getCDNProductsAndSettings, getCDNStoreSettings, getCDNWidgetSettings, getCharge, getCollection, getCreditSummary, getCustomer, getCustomerPortalAccess, getDeliverySchedule, getDynamicBundleItems, getGiftPurchase, getGiftRedemptionLandingPageURL, getMembership, getMembershipProgram, getOnetime, getOrder, getPaymentMethod, getPlan, getShippingCountries, getStoreSettings, getSubscription, initRecharge, type intervalUnit, listAddresses, listBundleSelections, listCharges, listCollectionProducts, listCollections, listCreditAccounts, listGiftPurchases, listMembershipPrograms, listMemberships, listOnetimes, listOrders, listPaymentMethods, listPlans, listSubscriptions, loginCustomerPortal, loginShopifyApi, loginShopifyAppProxy, loginWithShopifyCustomerAccount, loginWithShopifyStorefront, type membershipIncludes, mergeAddresses, processCharge, productSearch, removeDiscountsFromAddress, removeDiscountsFromCharge, resetCDNCache, sendCustomerNotification, sendPasswordlessCode, sendPasswordlessCodeAppProxy, setApplyCreditsToNextCharge, skipCharge, skipFutureCharge, skipGiftSubscriptionCharge, skipSubscriptionCharge, unskipCharge, updateAddress, updateBundle, updateBundleSelection, updateCustomer, updateMetafield, updateOnetime, updatePaymentMethod, updateSubscription, updateSubscriptionAddress, updateSubscriptionChargeDate, updateSubscriptions, validateBundle, validateBundleSelection, validateDynamicBundle, validatePasswordlessCode, validatePasswordlessCodeAppProxy };
|
|
2987
|
+
export { type ActivateMembershipRequest, type AddToCartCallbackSettings, type AddonSettings, type Address, type AddressIncludes, type AddressListParams, type AddressListResponse, type AddressResponse, type AddressSortBy, type AnalyticsData, type ApplyCreditOptions, type AssociatedAddress, type BasicSubscriptionParams, type BooleanLike, type BooleanNumbers, type BooleanString, type BooleanStringNumbers, type BulkSubscriptionParams, type BundleAppProxy, type BundleData, type BundlePriceRule, type BundleProduct, type BundleProductLayoutSettings, type BundlePurchaseItem, type BundlePurchaseItemParams, type BundleSelection, type BundleSelectionAppProxy, type BundleSelectionItem, type BundleSelectionItemRequiredCreateProps, type BundleSelectionListParams, type BundleSelectionsResponse, type BundleSelectionsSortBy, type BundleTemplateSettings, type BundleTemplateType, type BundleTranslations, type BundleVariant, type BundleVariantOptionSource, type BundleVariantRange, type BundleVariantSelectionDefault, type CDNBaseWidgetSettings, type CDNBundleSettings, type CDNBundleVariant, type CDNBundleVariantOptionSource, type CDNPlan, type CDNProduct, type CDNProductAndSettings, type CDNProductKeyObject, type CDNProductQuery_2020_12, type CDNProductQuery_2022_06, type CDNProductRaw, type CDNProductResource, type CDNProductResponseType, type CDNProductType, type CDNProductVariant_2022_06, type CDNProduct_2022_06, type CDNProductsAndSettings, type CDNProductsAndSettingsResource, type CDNStoreSettings, type CDNSubscriptionOption, type CDNVariant, type CDNVersion, type CDNWidgetSettings, type CDNWidgetSettingsRaw, type CDNWidgetSettingsResource, type CRUDRequestOptions, type CancelMembershipRequest, type CancelSubscriptionRequest, type ChangeMembershipRequest, type ChannelSettings, type Charge, type ChargeIncludes, type ChargeListParams, type ChargeListResponse, type ChargeResponse, type ChargeSortBy, type ChargeStatus, type Collection, type CollectionListParams, type CollectionTypes, type CollectionsResponse, type CollectionsSortBy, type ColorString, type CreateAddressRequest, type CreateBundleSelectionRequest, type CreateMetafieldRequest, type CreateOnetimeRequest, type CreatePaymentMethodRequest, type CreateRecipientAddress, type CreateSubscriptionRequest, type CreateSubscriptionsParams, type CreateSubscriptionsRequest, type CreditAccount, type CreditAccountIncludes, type CreditAccountListParams, type CreditAccountType, type CreditAccountsResponse, type CreditAccountsSortBy, type CreditSummaryIncludes, type CrossSellsSettings, type Customer, type CustomerCreditSummary, type CustomerDeliveryScheduleParams, type CustomerDeliveryScheduleResponse, type CustomerIncludes, type CustomerNotification, type CustomerNotificationOptions, type CustomerNotificationTemplate, type CustomerNotificationType, type CustomerPortalAccessOptions, type CustomerPortalAccessResponse, type CustomerPortalSettings, type DeleteSubscriptionsParams, type DeleteSubscriptionsRequest, type Delivery, type DeliveryLineItem, type DeliveryOrder, type DeliveryPaymentMethod, type Discount, type DiscountType, type DynamicBundleItemAppProxy, type DynamicBundlePropertiesAppProxy, type ExternalAttributeSchema, type ExternalId, type ExternalTransactionId, type FirstOption, type GetAddressOptions, type GetChargeOptions, type GetCreditSummaryOptions, type GetCustomerOptions, type GetMembershipProgramOptions, type GetPaymentMethodOptions, type GetRequestOptions, type GetSubscriptionOptions, type GiftPurchase, type GiftPurchasesParams, type GiftPurchasesResponse, type HTMLString, type InitOptions, type InternalSession, type IntervalUnit, type IsoDateString, type LineItem, type ListParams, type LoginResponse, type Membership, type MembershipBenefit, type MembershipIncludes, type MembershipListParams, type MembershipListResponse, type MembershipProgram, type MembershipProgramIncludes, type MembershipProgramListParams, type MembershipProgramListResponse, type MembershipProgramResponse, type MembershipProgramSortBy, type MembershipProgramStatus, type MembershipResponse, type MembershipStatus, type MembershipsSortBy, type MergeAddressesRequest, type Metafield, type MetafieldOptionalCreateProps, type MetafieldOwnerResource, type MetafieldRequiredCreateProps, type Method, type Modifier, type MultiStepSettings, type OfferAttributes, type OnePageSettings, type Onetime, type OnetimeListParams, type OnetimeOptionalCreateProps, type OnetimeRequiredCreateProps, type OnetimeSubscription, type OnetimesResponse, type OnetimesSortBy, type Order, type OrderIncludes, type OrderListParams, type OrderSortBy, type OrderStatus, type OrderType, type OrdersResponse, type PasswordlessCodeResponse, type PasswordlessOptions, type PasswordlessValidateResponse, type PaymentDetails, type PaymentMethod, type PaymentMethodIncludes, type PaymentMethodListParams, type PaymentMethodOptionalCreateProps, type PaymentMethodRequiredCreateProps, type PaymentMethodSortBy, type PaymentMethodStatus, type PaymentMethodsResponse, type PaymentType, type Plan, type PlanListParams, type PlanSortBy, type PlanType, type PlansResponse, type ProcessorName, type ProductImage, type ProductInclude, type ProductListResponse, type ProductOption, type ProductSearchParams_2020_12, type ProductSearchParams_2022_06, type ProductSearchResponse_2020_12, type ProductSearchResponse_2022_06, type ProductSearchType, type ProductSource, type ProductValueOption, type ProductVariant_2020_12, type ProductVariant_2022_06, type Product_2020_12, type Product_2022_06, type Property, type PublishStatus, type RecurringSubscription, type ReferralInfo, type ReferralUrl, type Request, type RequestHeaders, type RequestOptions, type SellingPlan, type SellingPlanGroup, type Session, type ShippingCountriesOptions, type ShippingCountriesResponse, type ShippingCountry, type ShippingLine, type ShippingProvince, type ShopifyUpdatePaymentInfoOptions, type SkipChargeParams, type SkipFutureChargeAddressRequest, type SkipFutureChargeAddressResponse, type SortBy, type SortField, type SortKeys, type StepSettings, type StepSettingsCommon, type StepSettingsTypes, type StoreSettings, type StorefrontEnvironment, type StorefrontOptions, type StorefrontPurchaseOption, type SubType, type Subscription, type SubscriptionBase, type SubscriptionCancelled, type SubscriptionIncludes, type SubscriptionListParams, type SubscriptionOption, type SubscriptionOptionalCreateProps, type SubscriptionPreferences, type SubscriptionRequiredCreateProps, type SubscriptionSortBy, type SubscriptionStatus, type Subscription_2021_01, type SubscriptionsResponse, type TaxLine, type Translations, type UpdateAddressParams, type UpdateAddressRequest, type UpdateBundlePurchaseItem, type UpdateBundleSelectionRequest, type UpdateCustomerRequest, type UpdateMetafieldRequest, type UpdateOnetimeRequest, type UpdatePaymentMethodRequest, type UpdateSubscriptionChargeDateParams, type UpdateSubscriptionParams, type UpdateSubscriptionRequest, type UpdateSubscriptionsParams, type UpdateSubscriptionsRequest, type VariantSelector, type VariantSelectorStepSetting, type WidgetIconColor, type WidgetTemplateType, type WidgetVisibility, activateMembership, activateSubscription, api, applyDiscountToAddress, applyDiscountToCharge, cancelMembership, cancelSubscription, changeMembership, createAddress, createBundleSelection, createMetafield, createOnetime, createPaymentMethod, createSubscription, createSubscriptions, deleteAddress, deleteBundleSelection, deleteMetafield, deleteOnetime, deleteSubscriptions, getActiveChurnLandingPageURL, getAddress, getBundleId, getBundleSelection, getCDNBundleSettings, getCDNProduct, getCDNProductAndSettings, getCDNProducts, getCDNProductsAndSettings, getCDNStoreSettings, getCDNWidgetSettings, getCharge, getCollection, getCreditSummary, getCustomer, getCustomerPortalAccess, getDeliverySchedule, getDynamicBundleItems, getGiftPurchase, getGiftRedemptionLandingPageURL, getMembership, getMembershipProgram, getOnetime, getOrder, getPaymentMethod, getPlan, getShippingCountries, getStoreSettings, getSubscription, initRecharge, type intervalUnit, listAddresses, listBundleSelections, listCharges, listCollectionProducts, listCollections, listCreditAccounts, listGiftPurchases, listMembershipPrograms, listMemberships, listOnetimes, listOrders, listPaymentMethods, listPlans, listSubscriptions, loginCustomerPortal, loginShopifyApi, loginShopifyAppProxy, loginWithShopifyCustomerAccount, loginWithShopifyStorefront, type membershipIncludes, mergeAddresses, processCharge, productSearch, removeDiscountsFromAddress, removeDiscountsFromCharge, resetCDNCache, sendCustomerNotification, sendPasswordlessCode, sendPasswordlessCodeAppProxy, setApplyCreditsToNextCharge, skipCharge, skipFutureCharge, skipGiftSubscriptionCharge, skipSubscriptionCharge, unskipCharge, updateAddress, updateBundle, updateBundleSelection, updateCustomer, updateMetafield, updateOnetime, updatePaymentMethod, updateSubscription, updateSubscriptionAddress, updateSubscriptionChargeDate, updateSubscriptions, validateBundle, validateBundleSelection, validateDynamicBundle, validatePasswordlessCode, validatePasswordlessCodeAppProxy };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// recharge-client-1.
|
|
1
|
+
// recharge-client-1.28.0.min.js | MIT License | © Recharge Inc.
|
|
2
2
|
(function(U,be){typeof exports=="object"&&typeof module<"u"?module.exports=be():typeof define=="function"&&define.amd?define(be):(U=typeof globalThis<"u"?globalThis:U||self,U.recharge=be())})(this,function(){"use strict";var U=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function be(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Ys(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var L=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof L<"u"&&L,G={searchParams:"URLSearchParams"in L,iterable:"Symbol"in L&&"iterator"in Symbol,blob:"FileReader"in L&&"Blob"in L&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in L,arrayBuffer:"ArrayBuffer"in L};function Ks(t){return t&&DataView.prototype.isPrototypeOf(t)}if(G.arrayBuffer)var Zs=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],Js=ArrayBuffer.isView||function(t){return t&&Zs.indexOf(Object.prototype.toString.call(t))>-1};function ht(t){if(typeof t!="string"&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||t==="")throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function rn(t){return typeof t!="string"&&(t=String(t)),t}function nn(t){var e={next:function(){var r=t.shift();return{done:r===void 0,value:r}}};return G.iterable&&(e[Symbol.iterator]=function(){return e}),e}function N(t){this.map={},t instanceof N?t.forEach(function(e,r){this.append(r,e)},this):Array.isArray(t)?t.forEach(function(e){this.append(e[0],e[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}N.prototype.append=function(t,e){t=ht(t),e=rn(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},N.prototype.delete=function(t){delete this.map[ht(t)]},N.prototype.get=function(t){return t=ht(t),this.has(t)?this.map[t]:null},N.prototype.has=function(t){return this.map.hasOwnProperty(ht(t))},N.prototype.set=function(t,e){this.map[ht(t)]=rn(e)},N.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},N.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),nn(t)},N.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),nn(t)},N.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),nn(t)},G.iterable&&(N.prototype[Symbol.iterator]=N.prototype.entries);function an(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function Ui(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function Qs(t){var e=new FileReader,r=Ui(e);return e.readAsArrayBuffer(t),r}function ef(t){var e=new FileReader,r=Ui(e);return e.readAsText(t),r}function tf(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}function Li(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function ki(){return this.bodyUsed=!1,this._initBody=function(t){this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?typeof t=="string"?this._bodyText=t:G.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:G.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:G.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():G.arrayBuffer&&G.blob&&Ks(t)?(this._bodyArrayBuffer=Li(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):G.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||Js(t))?this._bodyArrayBuffer=Li(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||(typeof t=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):G.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},G.blob&&(this.blob=function(){var t=an(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var t=an(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(Qs)}),this.text=function(){var t=an(this);if(t)return t;if(this._bodyBlob)return ef(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(tf(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},G.formData&&(this.formData=function(){return this.text().then(af)}),this.json=function(){return this.text().then(JSON.parse)},this}var rf=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function nf(t){var e=t.toUpperCase();return rf.indexOf(e)>-1?e:t}function $e(t,e){if(!(this instanceof $e))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e=e||{};var r=e.body;if(t instanceof $e){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new N(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,!r&&t._bodyInit!=null&&(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",(e.headers||!this.headers)&&(this.headers=new N(e.headers)),this.method=nf(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&r)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(r),(this.method==="GET"||this.method==="HEAD")&&(e.cache==="no-store"||e.cache==="no-cache")){var n=/([?&])_=[^&]*/;if(n.test(this.url))this.url=this.url.replace(n,"$1_="+new Date().getTime());else{var i=/\?/;this.url+=(i.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}$e.prototype.clone=function(){return new $e(this,{body:this._bodyInit})};function af(t){var e=new FormData;return t.trim().split("&").forEach(function(r){if(r){var n=r.split("="),i=n.shift().replace(/\+/g," "),a=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(a))}}),e}function of(t){var e=new N,r=t.replace(/\r?\n[\t ]+/g," ");return r.split("\r").map(function(n){return n.indexOf(`
|
|
3
3
|
`)===0?n.substr(1,n.length):n}).forEach(function(n){var i=n.split(":"),a=i.shift().trim();if(a){var o=i.join(":").trim();e.append(a,o)}}),e}ki.call($e.prototype);function Y(t,e){if(!(this instanceof Y))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e||(e={}),this.type="default",this.status=e.status===void 0?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText=e.statusText===void 0?"":""+e.statusText,this.headers=new N(e.headers),this.url=e.url||"",this._initBody(t)}ki.call(Y.prototype),Y.prototype.clone=function(){return new Y(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new N(this.headers),url:this.url})},Y.error=function(){var t=new Y(null,{status:0,statusText:""});return t.type="error",t};var uf=[301,302,303,307,308];Y.redirect=function(t,e){if(uf.indexOf(e)===-1)throw new RangeError("Invalid status code");return new Y(null,{status:e,headers:{location:t}})};var Ee=L.DOMException;try{new Ee}catch{Ee=function(e,r){this.message=e,this.name=r;var n=Error(e);this.stack=n.stack},Ee.prototype=Object.create(Error.prototype),Ee.prototype.constructor=Ee}function qi(t,e){return new Promise(function(r,n){var i=new $e(t,e);if(i.signal&&i.signal.aborted)return n(new Ee("Aborted","AbortError"));var a=new XMLHttpRequest;function o(){a.abort()}a.onload=function(){var f={status:a.status,statusText:a.statusText,headers:of(a.getAllResponseHeaders()||"")};f.url="responseURL"in a?a.responseURL:f.headers.get("X-Request-URL");var c="response"in a?a.response:a.responseText;setTimeout(function(){r(new Y(c,f))},0)},a.onerror=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},a.ontimeout=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},a.onabort=function(){setTimeout(function(){n(new Ee("Aborted","AbortError"))},0)};function u(f){try{return f===""&&L.location.href?L.location.href:f}catch{return f}}a.open(i.method,u(i.url),!0),i.credentials==="include"?a.withCredentials=!0:i.credentials==="omit"&&(a.withCredentials=!1),"responseType"in a&&(G.blob?a.responseType="blob":G.arrayBuffer&&i.headers.get("Content-Type")&&i.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(a.responseType="arraybuffer")),e&&typeof e.headers=="object"&&!(e.headers instanceof N)?Object.getOwnPropertyNames(e.headers).forEach(function(f){a.setRequestHeader(f,rn(e.headers[f]))}):i.headers.forEach(function(f,c){a.setRequestHeader(c,f)}),i.signal&&(i.signal.addEventListener("abort",o),a.onreadystatechange=function(){a.readyState===4&&i.signal.removeEventListener("abort",o)}),a.send(typeof i._bodyInit>"u"?null:i._bodyInit)})}qi.polyfill=!0,L.fetch||(L.fetch=qi,L.Headers=N,L.Request=$e,L.Response=Y),self.fetch.bind(self);let sf="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",ji=(t=21)=>{let e="",r=t;for(;r--;)e+=sf[Math.random()*64|0];return e};var ff=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==i||o.enumerable!==!0)return!1}return!0},Vi=typeof Symbol<"u"&&Symbol,cf=ff,lf=function(){return typeof Vi!="function"||typeof Symbol!="function"||typeof Vi("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:cf()},Gi={foo:{}},hf=Object,pf=function(){return{__proto__:Gi}.foo===Gi.foo&&!({__proto__:null}instanceof hf)},df="Function.prototype.bind called on incompatible ",on=Array.prototype.slice,yf=Object.prototype.toString,gf="[object Function]",vf=function(e){var r=this;if(typeof r!="function"||yf.call(r)!==gf)throw new TypeError(df+r);for(var n=on.call(arguments,1),i,a=function(){if(this instanceof i){var l=r.apply(this,n.concat(on.call(arguments)));return Object(l)===l?l:this}else return r.apply(e,n.concat(on.call(arguments)))},o=Math.max(0,r.length-n.length),u=[],f=0;f<o;f++)u.push("$"+f);if(i=Function("binder","return function ("+u.join(",")+"){ return binder.apply(this,arguments); }")(a),r.prototype){var c=function(){};c.prototype=r.prototype,i.prototype=new c,c.prototype=null}return i},_f=vf,un=Function.prototype.bind||_f,mf=un,wf=mf.call(Function.call,Object.prototype.hasOwnProperty),P,ke=SyntaxError,Hi=Function,qe=TypeError,sn=function(t){try{return Hi('"use strict"; return ('+t+").constructor;")()}catch{}},Ae=Object.getOwnPropertyDescriptor;if(Ae)try{Ae({},"")}catch{Ae=null}var fn=function(){throw new qe},bf=Ae?function(){try{return arguments.callee,fn}catch{try{return Ae(arguments,"callee").get}catch{return fn}}}():fn,je=lf(),$f=pf(),B=Object.getPrototypeOf||($f?function(t){return t.__proto__}:null),Ve={},Ef=typeof Uint8Array>"u"||!B?P:B(Uint8Array),Se={"%AggregateError%":typeof AggregateError>"u"?P:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?P:ArrayBuffer,"%ArrayIteratorPrototype%":je&&B?B([][Symbol.iterator]()):P,"%AsyncFromSyncIteratorPrototype%":P,"%AsyncFunction%":Ve,"%AsyncGenerator%":Ve,"%AsyncGeneratorFunction%":Ve,"%AsyncIteratorPrototype%":Ve,"%Atomics%":typeof Atomics>"u"?P:Atomics,"%BigInt%":typeof BigInt>"u"?P:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?P:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?P:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?P:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?P:Float32Array,"%Float64Array%":typeof Float64Array>"u"?P:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?P:FinalizationRegistry,"%Function%":Hi,"%GeneratorFunction%":Ve,"%Int8Array%":typeof Int8Array>"u"?P:Int8Array,"%Int16Array%":typeof Int16Array>"u"?P:Int16Array,"%Int32Array%":typeof Int32Array>"u"?P:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":je&&B?B(B([][Symbol.iterator]())):P,"%JSON%":typeof JSON=="object"?JSON:P,"%Map%":typeof Map>"u"?P:Map,"%MapIteratorPrototype%":typeof Map>"u"||!je||!B?P:B(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?P:Promise,"%Proxy%":typeof Proxy>"u"?P:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?P:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?P:Set,"%SetIteratorPrototype%":typeof Set>"u"||!je||!B?P:B(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?P:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":je&&B?B(""[Symbol.iterator]()):P,"%Symbol%":je?Symbol:P,"%SyntaxError%":ke,"%ThrowTypeError%":bf,"%TypedArray%":Ef,"%TypeError%":qe,"%Uint8Array%":typeof Uint8Array>"u"?P:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?P:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?P:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?P:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?P:WeakMap,"%WeakRef%":typeof WeakRef>"u"?P:WeakRef,"%WeakSet%":typeof WeakSet>"u"?P:WeakSet};if(B)try{null.error}catch(t){var Af=B(B(t));Se["%Error.prototype%"]=Af}var Sf=function t(e){var r;if(e==="%AsyncFunction%")r=sn("async function () {}");else if(e==="%GeneratorFunction%")r=sn("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=sn("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&B&&(r=B(i.prototype))}return Se[e]=r,r},Wi={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},pt=un,Xt=wf,Of=pt.call(Function.call,Array.prototype.concat),If=pt.call(Function.apply,Array.prototype.splice),Xi=pt.call(Function.call,String.prototype.replace),zt=pt.call(Function.call,String.prototype.slice),xf=pt.call(Function.call,RegExp.prototype.exec),Pf=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Tf=/\\(\\)?/g,Rf=function(e){var r=zt(e,0,1),n=zt(e,-1);if(r==="%"&&n!=="%")throw new ke("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new ke("invalid intrinsic syntax, expected opening `%`");var i=[];return Xi(e,Pf,function(a,o,u,f){i[i.length]=u?Xi(f,Tf,"$1"):o||a}),i},Ff=function(e,r){var n=e,i;if(Xt(Wi,n)&&(i=Wi[n],n="%"+i[0]+"%"),Xt(Se,n)){var a=Se[n];if(a===Ve&&(a=Sf(n)),typeof a>"u"&&!r)throw new qe("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:a}}throw new ke("intrinsic "+e+" does not exist!")},cn=function(e,r){if(typeof e!="string"||e.length===0)throw new qe("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new qe('"allowMissing" argument must be a boolean');if(xf(/^%?[^%]*%?$/,e)===null)throw new ke("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Rf(e),i=n.length>0?n[0]:"",a=Ff("%"+i+"%",r),o=a.name,u=a.value,f=!1,c=a.alias;c&&(i=c[0],If(n,Of([0,1],c)));for(var l=1,s=!0;l<n.length;l+=1){var h=n[l],y=zt(h,0,1),w=zt(h,-1);if((y==='"'||y==="'"||y==="`"||w==='"'||w==="'"||w==="`")&&y!==w)throw new ke("property names with quotes must have matching quotes");if((h==="constructor"||!s)&&(f=!0),i+="."+h,o="%"+i+"%",Xt(Se,o))u=Se[o];else if(u!=null){if(!(h in u)){if(!r)throw new qe("base intrinsic for "+e+" exists, but the property is not available.");return}if(Ae&&l+1>=n.length){var S=Ae(u,h);s=!!S,s&&"get"in S&&!("originalValue"in S.get)?u=S.get:u=u[h]}else s=Xt(u,h),u=u[h];s&&!f&&(Se[o]=u)}}return u},zi={exports:{}};(function(t){var e=un,r=cn,n=r("%Function.prototype.apply%"),i=r("%Function.prototype.call%"),a=r("%Reflect.apply%",!0)||e.call(i,n),o=r("%Object.getOwnPropertyDescriptor%",!0),u=r("%Object.defineProperty%",!0),f=r("%Math.max%");if(u)try{u({},"a",{value:1})}catch{u=null}t.exports=function(s){var h=a(e,i,arguments);if(o&&u){var y=o(h,"length");y.configurable&&u(h,"length",{value:1+f(0,s.length-(arguments.length-1))})}return h};var c=function(){return a(e,n,arguments)};u?u(t.exports,"apply",{value:c}):t.exports.apply=c})(zi);var Mf=zi.exports,Yi=cn,Ki=Mf,Cf=Ki(Yi("String.prototype.indexOf")),Nf=function(e,r){var n=Yi(e,!!r);return typeof n=="function"&&Cf(e,".prototype.")>-1?Ki(n):n},Ge=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},K=[],X=[],Bf=typeof Uint8Array<"u"?Uint8Array:Array,ln=!1;function Zi(){ln=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,r=t.length;e<r;++e)K[e]=t[e],X[t.charCodeAt(e)]=e;X["-".charCodeAt(0)]=62,X["_".charCodeAt(0)]=63}function Df(t){ln||Zi();var e,r,n,i,a,o,u=t.length;if(u%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a=t[u-2]==="="?2:t[u-1]==="="?1:0,o=new Bf(u*3/4-a),n=a>0?u-4:u;var f=0;for(e=0,r=0;e<n;e+=4,r+=3)i=X[t.charCodeAt(e)]<<18|X[t.charCodeAt(e+1)]<<12|X[t.charCodeAt(e+2)]<<6|X[t.charCodeAt(e+3)],o[f++]=i>>16&255,o[f++]=i>>8&255,o[f++]=i&255;return a===2?(i=X[t.charCodeAt(e)]<<2|X[t.charCodeAt(e+1)]>>4,o[f++]=i&255):a===1&&(i=X[t.charCodeAt(e)]<<10|X[t.charCodeAt(e+1)]<<4|X[t.charCodeAt(e+2)]>>2,o[f++]=i>>8&255,o[f++]=i&255),o}function Uf(t){return K[t>>18&63]+K[t>>12&63]+K[t>>6&63]+K[t&63]}function Lf(t,e,r){for(var n,i=[],a=e;a<r;a+=3)n=(t[a]<<16)+(t[a+1]<<8)+t[a+2],i.push(Uf(n));return i.join("")}function Ji(t){ln||Zi();for(var e,r=t.length,n=r%3,i="",a=[],o=16383,u=0,f=r-n;u<f;u+=o)a.push(Lf(t,u,u+o>f?f:u+o));return n===1?(e=t[r-1],i+=K[e>>2],i+=K[e<<4&63],i+="=="):n===2&&(e=(t[r-2]<<8)+t[r-1],i+=K[e>>10],i+=K[e>>4&63],i+=K[e<<2&63],i+="="),a.push(i),a.join("")}function Yt(t,e,r,n,i){var a,o,u=i*8-n-1,f=(1<<u)-1,c=f>>1,l=-7,s=r?i-1:0,h=r?-1:1,y=t[e+s];for(s+=h,a=y&(1<<-l)-1,y>>=-l,l+=u;l>0;a=a*256+t[e+s],s+=h,l-=8);for(o=a&(1<<-l)-1,a>>=-l,l+=n;l>0;o=o*256+t[e+s],s+=h,l-=8);if(a===0)a=1-c;else{if(a===f)return o?NaN:(y?-1:1)*(1/0);o=o+Math.pow(2,n),a=a-c}return(y?-1:1)*o*Math.pow(2,a-n)}function Qi(t,e,r,n,i,a){var o,u,f,c=a*8-i-1,l=(1<<c)-1,s=l>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:a-1,w=n?1:-1,S=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,o=l):(o=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-o))<1&&(o--,f*=2),o+s>=1?e+=h/f:e+=h*Math.pow(2,1-s),e*f>=2&&(o++,f/=2),o+s>=l?(u=0,o=l):o+s>=1?(u=(e*f-1)*Math.pow(2,i),o=o+s):(u=e*Math.pow(2,s-1)*Math.pow(2,i),o=0));i>=8;t[r+y]=u&255,y+=w,u/=256,i-=8);for(o=o<<i|u,c+=i;c>0;t[r+y]=o&255,y+=w,o/=256,c-=8);t[r+y-w]|=S*128}var kf={}.toString,ea=Array.isArray||function(t){return kf.call(t)=="[object Array]"};/*!
|
|
4
4
|
* The buffer module from node.js, for the browser.
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
`)+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function wn(t){return Array.isArray(t)}function ar(t){return typeof t=="boolean"}function dt(t){return t===null}function $a(t){return t==null}function bn(t){return typeof t=="number"}function yt(t){return typeof t=="string"}function Ea(t){return typeof t=="symbol"}function Q(t){return t===void 0}function gt(t){return Pe(t)&&$n(t)==="[object RegExp]"}function Pe(t){return typeof t=="object"&&t!==null}function or(t){return Pe(t)&&$n(t)==="[object Date]"}function vt(t){return Pe(t)&&($n(t)==="[object Error]"||t instanceof Error)}function _t(t){return typeof t=="function"}function Aa(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||typeof t>"u"}function Sa(t){return d.isBuffer(t)}function $n(t){return Object.prototype.toString.call(t)}function En(t){return t<10?"0"+t.toString(10):t.toString(10)}var Xc=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function zc(){var t=new Date,e=[En(t.getHours()),En(t.getMinutes()),En(t.getSeconds())].join(":");return[t.getDate(),Xc[t.getMonth()],e].join(" ")}function Oa(){console.log("%s - %s",zc(),rr.apply(null,arguments))}function An(t,e){if(!e||!Pe(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}function Ia(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Te=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;function Sn(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');if(Te&&t[Te]){var e=t[Te];if(typeof e!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,Te,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var r,n,i=new Promise(function(u,f){r=u,n=f}),a=[],o=0;o<arguments.length;o++)a.push(arguments[o]);a.push(function(u,f){u?n(u):r(f)});try{t.apply(this,a)}catch(u){n(u)}return i}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Te&&Object.defineProperty(e,Te,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,wa(t))}Sn.custom=Te;function Yc(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}function xa(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');function e(){for(var r=[],n=0;n<arguments.length;n++)r.push(arguments[n]);var i=r.pop();if(typeof i!="function")throw new TypeError("The last argument must be of type Function");var a=this,o=function(){return i.apply(a,arguments)};t.apply(this,r).then(function(u){Xe.nextTick(o.bind(null,null,u))},function(u){Xe.nextTick(Yc.bind(null,u,o))})}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,wa(t)),e}var Kc={inherits:ma,_extend:An,log:Oa,isBuffer:Sa,isPrimitive:Aa,isFunction:_t,isError:vt,isDate:or,isObject:Pe,isRegExp:gt,isUndefined:Q,isSymbol:Ea,isString:yt,isNumber:bn,isNullOrUndefined:$a,isNull:dt,isBoolean:ar,isArray:wn,inspect:J,deprecate:gn,format:rr,debuglog:ba,promisify:Sn,callbackify:xa},Zc=Object.freeze({__proto__:null,_extend:An,callbackify:xa,debuglog:ba,default:Kc,deprecate:gn,format:rr,inherits:ma,inspect:J,isArray:wn,isBoolean:ar,isBuffer:Sa,isDate:or,isError:vt,isFunction:_t,isNull:dt,isNullOrUndefined:$a,isNumber:bn,isObject:Pe,isPrimitive:Aa,isRegExp:gt,isString:yt,isSymbol:Ea,isUndefined:Q,log:Oa,promisify:Sn}),Jc=Ys(Zc),Qc=Jc.inspect,On=typeof Map=="function"&&Map.prototype,In=Object.getOwnPropertyDescriptor&&On?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,ur=On&&In&&typeof In.get=="function"?In.get:null,Pa=On&&Map.prototype.forEach,xn=typeof Set=="function"&&Set.prototype,Pn=Object.getOwnPropertyDescriptor&&xn?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,sr=xn&&Pn&&typeof Pn.get=="function"?Pn.get:null,Ta=xn&&Set.prototype.forEach,el=typeof WeakMap=="function"&&WeakMap.prototype,mt=el?WeakMap.prototype.has:null,tl=typeof WeakSet=="function"&&WeakSet.prototype,wt=tl?WeakSet.prototype.has:null,rl=typeof WeakRef=="function"&&WeakRef.prototype,Ra=rl?WeakRef.prototype.deref:null,nl=Boolean.prototype.valueOf,il=Object.prototype.toString,al=Function.prototype.toString,ol=String.prototype.match,Tn=String.prototype.slice,pe=String.prototype.replace,ul=String.prototype.toUpperCase,Fa=String.prototype.toLowerCase,Ma=RegExp.prototype.test,Ca=Array.prototype.concat,ee=Array.prototype.join,sl=Array.prototype.slice,Na=Math.floor,Rn=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Fn=Object.getOwnPropertySymbols,Mn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ze=typeof Symbol=="function"&&typeof Symbol.iterator=="object",k=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ze||"symbol")?Symbol.toStringTag:null,Ba=Object.prototype.propertyIsEnumerable,Da=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function Ua(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||Ma.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-Na(-t):Na(t);if(n!==t){var i=String(n),a=Tn.call(e,i.length+1);return pe.call(i,r,"$&_")+"."+pe.call(pe.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return pe.call(e,r,"$&_")}var Cn=Qc,La=Cn.custom,ka=Va(La)?La:null,fl=function t(e,r,n,i){var a=r||{};if(de(a,"quoteStyle")&&a.quoteStyle!=="single"&&a.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(de(a,"maxStringLength")&&(typeof a.maxStringLength=="number"?a.maxStringLength<0&&a.maxStringLength!==1/0:a.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=de(a,"customInspect")?a.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(de(a,"indent")&&a.indent!==null&&a.indent!==" "&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(de(a,"numericSeparator")&&typeof a.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var u=a.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return Ha(e,a);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var f=String(e);return u?Ua(e,f):f}if(typeof e=="bigint"){var c=String(e)+"n";return u?Ua(e,c):c}var l=typeof a.depth>"u"?5:a.depth;if(typeof n>"u"&&(n=0),n>=l&&l>0&&typeof e=="object")return Nn(e)?"[Array]":"[Object]";var s=Il(a,n);if(typeof i>"u")i=[];else if(Ga(i,e)>=0)return"[Circular]";function h(z,me,lt){if(me&&(i=sl.call(i),i.push(me)),lt){var we={depth:a.depth};return de(a,"quoteStyle")&&(we.quoteStyle=a.quoteStyle),t(z,we,n+1,i)}return t(z,a,n+1,i)}if(typeof e=="function"&&!ja(e)){var y=_l(e),w=fr(e,h);return"[Function"+(y?": "+y:" (anonymous)")+"]"+(w.length>0?" { "+ee.call(w,", ")+" }":"")}if(Va(e)){var S=ze?pe.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Mn.call(e);return typeof e=="object"&&!ze?bt(S):S}if(Al(e)){for(var O="<"+Fa.call(String(e.nodeName)),b=e.attributes||[],E=0;E<b.length;E++)O+=" "+b[E].name+"="+qa(cl(b[E].value),"double",a);return O+=">",e.childNodes&&e.childNodes.length&&(O+="..."),O+="</"+Fa.call(String(e.nodeName))+">",O}if(Nn(e)){if(e.length===0)return"[]";var p=fr(e,h);return s&&!Ol(p)?"["+Dn(p,s)+"]":"[ "+ee.call(p,", ")+" ]"}if(hl(e)){var I=fr(e,h);return!("cause"in Error.prototype)&&"cause"in e&&!Ba.call(e,"cause")?"{ ["+String(e)+"] "+ee.call(Ca.call("[cause]: "+h(e.cause),I),", ")+" }":I.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+ee.call(I,", ")+" }"}if(typeof e=="object"&&o){if(ka&&typeof e[ka]=="function"&&Cn)return Cn(e,{depth:l-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(ml(e)){var T=[];return Pa&&Pa.call(e,function(z,me){T.push(h(me,e,!0)+" => "+h(z,e))}),Wa("Map",ur.call(e),T,s)}if($l(e)){var F=[];return Ta&&Ta.call(e,function(z){F.push(h(z,e))}),Wa("Set",sr.call(e),F,s)}if(wl(e))return Bn("WeakMap");if(El(e))return Bn("WeakSet");if(bl(e))return Bn("WeakRef");if(dl(e))return bt(h(Number(e)));if(gl(e))return bt(h(Rn.call(e)));if(yl(e))return bt(nl.call(e));if(pl(e))return bt(h(String(e)));if(!ll(e)&&!ja(e)){var _=fr(e,h),g=Da?Da(e)===Object.prototype:e instanceof Object||e.constructor===Object,v=e instanceof Object?"":"null prototype",A=!g&&k&&Object(e)===e&&k in e?Tn.call(ye(e),8,-1):v?"Object":"",x=g||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",M=x+(A||v?"["+ee.call(Ca.call([],A||[],v||[]),": ")+"] ":"");return _.length===0?M+"{}":s?M+"{"+Dn(_,s)+"}":M+"{ "+ee.call(_,", ")+" }"}return String(e)};function qa(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function cl(t){return pe.call(String(t),/"/g,""")}function Nn(t){return ye(t)==="[object Array]"&&(!k||!(typeof t=="object"&&k in t))}function ll(t){return ye(t)==="[object Date]"&&(!k||!(typeof t=="object"&&k in t))}function ja(t){return ye(t)==="[object RegExp]"&&(!k||!(typeof t=="object"&&k in t))}function hl(t){return ye(t)==="[object Error]"&&(!k||!(typeof t=="object"&&k in t))}function pl(t){return ye(t)==="[object String]"&&(!k||!(typeof t=="object"&&k in t))}function dl(t){return ye(t)==="[object Number]"&&(!k||!(typeof t=="object"&&k in t))}function yl(t){return ye(t)==="[object Boolean]"&&(!k||!(typeof t=="object"&&k in t))}function Va(t){if(ze)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!Mn)return!1;try{return Mn.call(t),!0}catch{}return!1}function gl(t){if(!t||typeof t!="object"||!Rn)return!1;try{return Rn.call(t),!0}catch{}return!1}var vl=Object.prototype.hasOwnProperty||function(t){return t in this};function de(t,e){return vl.call(t,e)}function ye(t){return il.call(t)}function _l(t){if(t.name)return t.name;var e=ol.call(al.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function Ga(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}function ml(t){if(!ur||!t||typeof t!="object")return!1;try{ur.call(t);try{sr.call(t)}catch{return!0}return t instanceof Map}catch{}return!1}function wl(t){if(!mt||!t||typeof t!="object")return!1;try{mt.call(t,mt);try{wt.call(t,wt)}catch{return!0}return t instanceof WeakMap}catch{}return!1}function bl(t){if(!Ra||!t||typeof t!="object")return!1;try{return Ra.call(t),!0}catch{}return!1}function $l(t){if(!sr||!t||typeof t!="object")return!1;try{sr.call(t);try{ur.call(t)}catch{return!0}return t instanceof Set}catch{}return!1}function El(t){if(!wt||!t||typeof t!="object")return!1;try{wt.call(t,wt);try{mt.call(t,mt)}catch{return!0}return t instanceof WeakSet}catch{}return!1}function Al(t){return!t||typeof t!="object"?!1:typeof HTMLElement<"u"&&t instanceof HTMLElement?!0:typeof t.nodeName=="string"&&typeof t.getAttribute=="function"}function Ha(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return Ha(Tn.call(t,0,e.maxStringLength),e)+n}var i=pe.call(pe.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Sl);return qa(i,"single",e)}function Sl(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+ul.call(e.toString(16))}function bt(t){return"Object("+t+")"}function Bn(t){return t+" { ? }"}function Wa(t,e,r,n){var i=n?Dn(r,n):ee.call(r,", ");return t+" ("+e+") {"+i+"}"}function Ol(t){for(var e=0;e<t.length;e++)if(Ga(t[e],`
|
|
18
18
|
`)>=0)return!1;return!0}function Il(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=ee.call(Array(t.indent+1)," ");else return null;return{base:r,prev:ee.call(Array(e+1),r)}}function Dn(t,e){if(t.length===0)return"";var r=`
|
|
19
19
|
`+e.prev+e.base;return r+ee.call(t,","+r)+`
|
|
20
|
-
`+e.prev}function fr(t,e){var r=Nn(t),n=[];if(r){n.length=t.length;for(var i=0;i<t.length;i++)n[i]=de(t,i)?e(t[i],t):""}var a=typeof Fn=="function"?Fn(t):[],o;if(ze){o={};for(var u=0;u<a.length;u++)o["$"+a[u]]=a[u]}for(var f in t)de(t,f)&&(r&&String(Number(f))===f&&f<t.length||ze&&o["$"+f]instanceof Symbol||(Ma.call(/[^\w$]/,f)?n.push(e(f,t)+": "+e(t[f],t)):n.push(f+": "+e(t[f],t))));if(typeof Fn=="function")for(var c=0;c<a.length;c++)Ba.call(t,a[c])&&n.push("["+e(a[c])+"]: "+e(t[a[c]],t));return n}var Un=cn,Ye=Nf,xl=fl,Pl=Un("%TypeError%"),cr=Un("%WeakMap%",!0),lr=Un("%Map%",!0),Tl=Ye("WeakMap.prototype.get",!0),Rl=Ye("WeakMap.prototype.set",!0),Fl=Ye("WeakMap.prototype.has",!0),Ml=Ye("Map.prototype.get",!0),Cl=Ye("Map.prototype.set",!0),Nl=Ye("Map.prototype.has",!0),Ln=function(t,e){for(var r=t,n;(n=r.next)!==null;r=n)if(n.key===e)return r.next=n.next,n.next=t.next,t.next=n,n},Bl=function(t,e){var r=Ln(t,e);return r&&r.value},Dl=function(t,e,r){var n=Ln(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},Ul=function(t,e){return!!Ln(t,e)},Ll=function(){var e,r,n,i={assert:function(a){if(!i.has(a))throw new Pl("Side channel does not contain "+xl(a))},get:function(a){if(cr&&a&&(typeof a=="object"||typeof a=="function")){if(e)return Tl(e,a)}else if(lr){if(r)return Ml(r,a)}else if(n)return Bl(n,a)},has:function(a){if(cr&&a&&(typeof a=="object"||typeof a=="function")){if(e)return Fl(e,a)}else if(lr){if(r)return Nl(r,a)}else if(n)return Ul(n,a);return!1},set:function(a,o){cr&&a&&(typeof a=="object"||typeof a=="function")?(e||(e=new cr),Rl(e,a,o)):lr?(r||(r=new lr),Cl(r,a,o)):(n||(n={key:{},next:null}),Dl(n,a,o))}};return i},kl=String.prototype.replace,ql=/%20/g,kn={RFC1738:"RFC1738",RFC3986:"RFC3986"},Xa={default:kn.RFC3986,formatters:{RFC1738:function(t){return kl.call(t,ql,"+")},RFC3986:function(t){return String(t)}},RFC1738:kn.RFC1738,RFC3986:kn.RFC3986},jl=Xa,qn=Object.prototype.hasOwnProperty,Re=Array.isArray,te=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),Vl=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(Re(n)){for(var i=[],a=0;a<n.length;++a)typeof n[a]<"u"&&i.push(n[a]);r.obj[r.prop]=i}}},za=function(e,r){for(var n=r&&r.plainObjects?Object.create(null):{},i=0;i<e.length;++i)typeof e[i]<"u"&&(n[i]=e[i]);return n},Gl=function t(e,r,n){if(!r)return e;if(typeof r!="object"){if(Re(e))e.push(r);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!qn.call(Object.prototype,r))&&(e[r]=!0);else return[e,r];return e}if(!e||typeof e!="object")return[e].concat(r);var i=e;return Re(e)&&!Re(r)&&(i=za(e,n)),Re(e)&&Re(r)?(r.forEach(function(a,o){if(qn.call(e,o)){var u=e[o];u&&typeof u=="object"&&a&&typeof a=="object"?e[o]=t(u,a,n):e.push(a)}else e[o]=a}),e):Object.keys(r).reduce(function(a,o){var u=r[o];return qn.call(a,o)?a[o]=t(a[o],u,n):a[o]=u,a},i)},Hl=function(e,r){return Object.keys(r).reduce(function(n,i){return n[i]=r[i],n},e)},Wl=function(t,e,r){var n=t.replace(/\+/g," ");if(r==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},Xl=function(e,r,n,i,a){if(e.length===0)return e;var o=e;if(typeof e=="symbol"?o=Symbol.prototype.toString.call(e):typeof e!="string"&&(o=String(e)),n==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(l){return"%26%23"+parseInt(l.slice(2),16)+"%3B"});for(var u="",f=0;f<o.length;++f){var c=o.charCodeAt(f);if(c===45||c===46||c===95||c===126||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||a===jl.RFC1738&&(c===40||c===41)){u+=o.charAt(f);continue}if(c<128){u=u+te[c];continue}if(c<2048){u=u+(te[192|c>>6]+te[128|c&63]);continue}if(c<55296||c>=57344){u=u+(te[224|c>>12]+te[128|c>>6&63]+te[128|c&63]);continue}f+=1,c=65536+((c&1023)<<10|o.charCodeAt(f)&1023),u+=te[240|c>>18]+te[128|c>>12&63]+te[128|c>>6&63]+te[128|c&63]}return u},zl=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i<r.length;++i)for(var a=r[i],o=a.obj[a.prop],u=Object.keys(o),f=0;f<u.length;++f){var c=u[f],l=o[c];typeof l=="object"&&l!==null&&n.indexOf(l)===-1&&(r.push({obj:o,prop:c}),n.push(l))}return Vl(r),e},Yl=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Kl=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Zl=function(e,r){return[].concat(e,r)},Jl=function(e,r){if(Re(e)){for(var n=[],i=0;i<e.length;i+=1)n.push(r(e[i]));return n}return r(e)},Ql={arrayToObject:za,assign:Hl,combine:Zl,compact:zl,decode:Wl,encode:Xl,isBuffer:Kl,isRegExp:Yl,maybeMap:Jl,merge:Gl},Ya=Ll,hr=Ql,$t=Xa,eh=Object.prototype.hasOwnProperty,Ka={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},oe=Array.isArray,th=Array.prototype.push,Za=function(t,e){th.apply(t,oe(e)?e:[e])},rh=Date.prototype.toISOString,Ja=$t.default,q={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:hr.encode,encodeValuesOnly:!1,format:Ja,formatter:$t.formatters[Ja],indices:!1,serializeDate:function(e){return rh.call(e)},skipNulls:!1,strictNullHandling:!1},nh=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},jn={},ih=function t(e,r,n,i,a,o,u,f,c,l,s,h,y,w,S,O){for(var b=e,E=O,p=0,I=!1;(E=E.get(jn))!==void 0&&!I;){var T=E.get(e);if(p+=1,typeof T<"u"){if(T===p)throw new RangeError("Cyclic object value");I=!0}typeof E.get(jn)>"u"&&(p=0)}if(typeof f=="function"?b=f(r,b):b instanceof Date?b=s(b):n==="comma"&&oe(b)&&(b=hr.maybeMap(b,function(we){return we instanceof Date?s(we):we})),b===null){if(a)return u&&!w?u(r,q.encoder,S,"key",h):r;b=""}if(nh(b)||hr.isBuffer(b)){if(u){var F=w?r:u(r,q.encoder,S,"key",h);return[y(F)+"="+y(u(b,q.encoder,S,"value",h))]}return[y(r)+"="+y(String(b))]}var _=[];if(typeof b>"u")return _;var g;if(n==="comma"&&oe(b))w&&u&&(b=hr.maybeMap(b,u)),g=[{value:b.length>0?b.join(",")||null:void 0}];else if(oe(f))g=f;else{var v=Object.keys(b);g=c?v.sort(c):v}for(var A=i&&oe(b)&&b.length===1?r+"[]":r,x=0;x<g.length;++x){var M=g[x],z=typeof M=="object"&&typeof M.value<"u"?M.value:b[M];if(!(o&&z===null)){var me=oe(b)?typeof n=="function"?n(A,M):A:A+(l?"."+M:"["+M+"]");O.set(e,p);var lt=Ya();lt.set(jn,O),Za(_,t(z,me,n,i,a,o,n==="comma"&&w&&oe(b)?null:u,f,c,l,s,h,y,w,S,lt))}}return _},ah=function(e){if(!e)return q;if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var r=e.charset||q.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=$t.default;if(typeof e.format<"u"){if(!eh.call($t.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var i=$t.formatters[n],a=q.filter;return(typeof e.filter=="function"||oe(e.filter))&&(a=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:q.addQueryPrefix,allowDots:typeof e.allowDots>"u"?q.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:q.charsetSentinel,delimiter:typeof e.delimiter>"u"?q.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:q.encode,encoder:typeof e.encoder=="function"?e.encoder:q.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:q.encodeValuesOnly,filter:a,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:q.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:q.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:q.strictNullHandling}},oh=function(t,e){var r=t,n=ah(e),i,a;typeof n.filter=="function"?(a=n.filter,r=a("",r)):oe(n.filter)&&(a=n.filter,i=a);var o=[];if(typeof r!="object"||r===null)return"";var u;e&&e.arrayFormat in Ka?u=e.arrayFormat:e&&"indices"in e?u=e.indices?"indices":"repeat":u="indices";var f=Ka[u];if(e&&"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var c=f==="comma"&&e&&e.commaRoundTrip;i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var l=Ya(),s=0;s<i.length;++s){var h=i[s];n.skipNulls&&r[h]===null||Za(o,ih(r[h],h,f,c,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,l))}var y=o.join(n.delimiter),w=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?w+="utf8=%26%2310003%3B&":w+="utf8=%E2%9C%93&"),y.length>0?w+y:""},uh=be(oh);let Qa={storeIdentifier:"",environment:"prod"};function sh(t){Qa=t}function W(){return Qa}const fh=(t,e="")=>{switch(t){case"prod":return"https://api.rechargeapps.com";case"stage":return"https://api.stage.rechargeapps.com";case"preprod":case"prestage":return`${e}/api`}},ch=(t,e="")=>{switch(t){case"prod":return"https://admin.rechargeapps.com";case"stage":return"https://admin.stage.rechargeapps.com";case"preprod":case"prestage":return e}},lh=t=>{switch(t){case"prod":case"preprod":return"https://static.rechargecdn.com";case"stage":case"prestage":return"https://static.stage.rechargecdn.com"}},hh="/tools/recurring";class pr{constructor(e,r){this.name="RechargeRequestError",this.message=e,this.status=r}}function ph(t){return uh(t,{encode:!1,indices:!1,arrayFormat:"comma"})}function m(t,e){return{...t,internalFnCall:t.internalFnCall??e,internalRequestId:t.internalRequestId??ji()}}async function dr(t,e,r={}){const n=W();return ue(t,`${lh(n.environment)}/store/${n.storeIdentifier}${e}`,r)}async function $(t,e,{id:r,query:n,data:i,headers:a}={},o){const{environment:u,environmentUri:f,storeIdentifier:c,loginRetryFn:l,appName:s,appVersion:h}=W(),y=o.apiToken,w=fh(u,f),S={"X-Recharge-Access-Token":y,"X-Recharge-Version":"2021-11","X-Recharge-Sdk-Fn":o.internalFnCall,...s?{"X-Recharge-Sdk-App-Name":s}:{},...h?{"X-Recharge-Sdk-App-Version":h}:{},"X-Recharge-Sdk-Version":"1.26.0","X-Request-Id":o.internalRequestId,...a||{}},O={shop_url:c,...n};try{return await ue(t,`${w}${e}`,{id:r,query:O,data:i,headers:S})}catch(b){if(l&&b instanceof pr&&b.status===401)return l().then(E=>{if(E)return ue(t,`${w}${e}`,{id:r,query:O,data:i,headers:{...S,"X-Recharge-Access-Token":E.apiToken}});throw b});throw b}}async function Ke(t,e,r={}){return ue(t,`${hh}${e}`,r)}async function ue(t,e,{id:r,query:n,data:i,headers:a}={}){let o=e.trim();if(r&&(o=[o,`${r}`.trim()].join("/")),n){let s;[o,s]=o.split("?");const h=[s,ph(n)].join("&").replace(/^&/,"");o=`${o}${h?`?${h}`:""}`}let u;i&&t!=="get"&&(u=JSON.stringify(i));const f={Accept:"application/json","Content-Type":"application/json","X-Recharge-App":"storefront-client",...a||{}},c=await fetch(o,{method:t,headers:f,body:u});let l;try{l=await c.json()}catch{}if(!c.ok)throw l&&l.error?new pr(l.error,c.status):l&&l.errors?new pr(JSON.stringify(l.errors),c.status):new pr("A connection error occurred while making the request");return l}function dh(t,e){return $("get","/addresses",{query:e},m(t,"listAddresses"))}async function yh(t,e,r){const{address:n}=await $("get","/addresses",{id:e,query:{include:r?.include}},m(t,"getAddress"));return n}async function gh(t,e){const{address:r}=await $("post","/addresses",{data:{customer_id:t.customerId?Number(t.customerId):void 0,...e}},m(t,"createAddress"));return r}async function Vn(t,e,r){const{address:n}=await $("put","/addresses",{id:e,data:r},m(t,"updateAddress"));return n}async function vh(t,e,r){return Vn(m(t,"applyDiscountToAddress"),e,{discounts:[{code:r}]})}async function _h(t,e){return Vn(m(t,"removeDiscountsFromAddress"),e,{discounts:[]})}function mh(t,e){return $("delete","/addresses",{id:e},m(t,"deleteAddress"))}async function wh(t,e){const{address:r}=await $("post","/addresses/merge",{data:e},m(t,"mergeAddresses"));return r}async function bh(t,e,r){const{charge:n}=await $("post",`/addresses/${e}/charges/skip`,{data:r},m(t,"skipFutureCharge"));return n}var $h=Object.freeze({__proto__:null,applyDiscountToAddress:vh,createAddress:gh,deleteAddress:mh,getAddress:yh,listAddresses:dh,mergeAddresses:wh,removeDiscountsFromAddress:_h,skipFutureCharge:bh,updateAddress:Vn});async function Eh(){const{storefrontAccessToken:t}=W(),e={};t&&(e["X-Recharge-Storefront-Access-Token"]=t);const r=await Ke("get","/access",{headers:e});return{apiToken:r.api_token,customerId:r.customer_id,message:r.message}}async function Ah(t,e){return eo(t,e)}async function eo(t,e){const{storeIdentifier:r}=W(),{api_token:n,customer_id:i,message:a}=await Et("post","/shopify_storefront_access",{data:{customer_token:e,storefront_token:t,shop_url:r}});return n?{apiToken:n,customerId:i,message:a}:null}async function Sh(t){const{storeIdentifier:e}=W(),{api_token:r,customer_id:n,message:i}=await Et("post","/shopify_customer_account_api_access",{data:{customer_token:t,shop_url:e}});return r?{apiToken:r,customerId:n,message:i}:null}async function Oh(t,e={}){const{storeIdentifier:r}=W(),n=await Et("post","/attempt_login",{data:{email:t,shop:r,...e}});if(n.errors)throw new Error(n.errors);return n.session_token}async function Ih(t,e={}){const{storefrontAccessToken:r}=W(),n={};r&&(n["X-Recharge-Storefront-Access-Token"]=r);const i=await Ke("post","/attempt_login",{data:{email:t,...e},headers:n});if(i.errors)throw new Error(i.errors);return i.session_token}async function xh(t,e,r){const{storeIdentifier:n}=W(),i=await Et("post","/validate_login",{data:{code:r,email:t,session_token:e,shop:n}});if(i.errors)throw new Error(i.errors);return{apiToken:i.api_token,customerId:i.customer_id}}async function Ph(t,e,r){const{storefrontAccessToken:n}=W(),i={};n&&(i["X-Recharge-Storefront-Access-Token"]=n);const a=await Ke("post","/validate_login",{data:{code:r,email:t,session_token:e},headers:i});if(a.errors)throw new Error(a.errors);return{apiToken:a.api_token,customerId:a.customer_id}}function Th(){const{customerHash:t}=W(),{pathname:e,search:r}=window.location,n=new URLSearchParams(r).get("token"),i=e.split("/").filter(Boolean),a=i.findIndex(u=>u==="portal"),o=a!==-1?i[a+1]:t;if(!n||!o)throw new Error("Not in context of Recharge Customer Portal or URL did not contain correct params");return{customerHash:o,token:n}}async function Rh(){const{customerHash:t,token:e}=Th(),{storeIdentifier:r}=W(),n=await Et("post",`/customers/${t}/access`,{data:{token:e,shop:r}});return{apiToken:n.api_token,customerId:n.customer_id}}async function Et(t,e,{id:r,query:n,data:i,headers:a}={}){const{environment:o,environmentUri:u,storefrontAccessToken:f,appName:c,appVersion:l}=W(),s=ch(o,u),h={...f?{"X-Recharge-Storefront-Access-Token":f}:{},...c?{"X-Recharge-Sdk-App-Name":c}:{},...l?{"X-Recharge-Sdk-App-Version":l}:{},"X-Recharge-Sdk-Version":"1.26.0",...a||{}};return ue(t,`${s}${e}`,{id:r,query:n,data:i,headers:h})}var Fh=Object.freeze({__proto__:null,loginCustomerPortal:Rh,loginShopifyApi:Ah,loginShopifyAppProxy:Eh,loginWithShopifyCustomerAccount:Sh,loginWithShopifyStorefront:eo,sendPasswordlessCode:Oh,sendPasswordlessCodeAppProxy:Ih,validatePasswordlessCode:xh,validatePasswordlessCodeAppProxy:Ph}),to={},Gn={},se={},Mh=typeof U=="object"&&U&&U.Object===Object&&U,ro=Mh,Ch=ro,Nh=typeof self=="object"&&self&&self.Object===Object&&self,Bh=Ch||Nh||Function("return this")(),fe=Bh,Dh=fe,Uh=Dh.Symbol,yr=Uh,no=yr,io=Object.prototype,Lh=io.hasOwnProperty,kh=io.toString,At=no?no.toStringTag:void 0;function qh(t){var e=Lh.call(t,At),r=t[At];try{t[At]=void 0;var n=!0}catch{}var i=kh.call(t);return n&&(e?t[At]=r:delete t[At]),i}var jh=qh,Vh=Object.prototype,Gh=Vh.toString;function Hh(t){return Gh.call(t)}var Wh=Hh,ao=yr,Xh=jh,zh=Wh,Yh="[object Null]",Kh="[object Undefined]",oo=ao?ao.toStringTag:void 0;function Zh(t){return t==null?t===void 0?Kh:Yh:oo&&oo in Object(t)?Xh(t):zh(t)}var ge=Zh;function Jh(t){return t!=null&&typeof t=="object"}var ve=Jh,Qh=ge,ep=ve,tp="[object Number]";function rp(t){return typeof t=="number"||ep(t)&&Qh(t)==tp}var gr=rp,C={};function np(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Ze=np,ip=ge,ap=Ze,op="[object AsyncFunction]",up="[object Function]",sp="[object GeneratorFunction]",fp="[object Proxy]";function cp(t){if(!ap(t))return!1;var e=ip(t);return e==up||e==sp||e==op||e==fp}var Hn=cp,lp=fe,hp=lp["__core-js_shared__"],pp=hp,Wn=pp,uo=function(){var t=/[^.]+$/.exec(Wn&&Wn.keys&&Wn.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function dp(t){return!!uo&&uo in t}var yp=dp,gp=Function.prototype,vp=gp.toString;function _p(t){if(t!=null){try{return vp.call(t)}catch{}try{return t+""}catch{}}return""}var so=_p,mp=Hn,wp=yp,bp=Ze,$p=so,Ep=/[\\^$.*+?()[\]{}|]/g,Ap=/^\[object .+?Constructor\]$/,Sp=Function.prototype,Op=Object.prototype,Ip=Sp.toString,xp=Op.hasOwnProperty,Pp=RegExp("^"+Ip.call(xp).replace(Ep,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Tp(t){if(!bp(t)||wp(t))return!1;var e=mp(t)?Pp:Ap;return e.test($p(t))}var Rp=Tp;function Fp(t,e){return t?.[e]}var Mp=Fp,Cp=Rp,Np=Mp;function Bp(t,e){var r=Np(t,e);return Cp(r)?r:void 0}var Fe=Bp,Dp=Fe,Up=function(){try{var t=Dp(Object,"defineProperty");return t({},"",{}),t}catch{}}(),fo=Up,co=fo;function Lp(t,e,r){e=="__proto__"&&co?co(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var lo=Lp;function kp(t,e){return t===e||t!==t&&e!==e}var vr=kp,qp=lo,jp=vr,Vp=Object.prototype,Gp=Vp.hasOwnProperty;function Hp(t,e,r){var n=t[e];(!(Gp.call(t,e)&&jp(n,r))||r===void 0&&!(e in t))&&qp(t,e,r)}var Wp=Hp,Xp=Wp,zp=lo;function Yp(t,e,r,n){var i=!r;r||(r={});for(var a=-1,o=e.length;++a<o;){var u=e[a],f=n?n(r[u],t[u],u,r,t):void 0;f===void 0&&(f=t[u]),i?zp(r,u,f):Xp(r,u,f)}return r}var Kp=Yp;function Zp(t){return t}var _r=Zp;function Jp(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var Qp=Jp,ed=Qp,ho=Math.max;function td(t,e,r){return e=ho(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,a=ho(n.length-e,0),o=Array(a);++i<a;)o[i]=n[e+i];i=-1;for(var u=Array(e+1);++i<e;)u[i]=n[i];return u[e]=r(o),ed(t,this,u)}}var rd=td;function nd(t){return function(){return t}}var id=nd,ad=id,po=fo,od=_r,ud=po?function(t,e){return po(t,"toString",{configurable:!0,enumerable:!1,value:ad(e),writable:!0})}:od,sd=ud,fd=800,cd=16,ld=Date.now;function hd(t){var e=0,r=0;return function(){var n=ld(),i=cd-(n-r);if(r=n,i>0){if(++e>=fd)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var pd=hd,dd=sd,yd=pd,gd=yd(dd),vd=gd,_d=_r,md=rd,wd=vd;function bd(t,e){return wd(md(t,e,_d),t+"")}var $d=bd,Ed=9007199254740991;function Ad(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Ed}var Xn=Ad,Sd=Hn,Od=Xn;function Id(t){return t!=null&&Od(t.length)&&!Sd(t)}var St=Id,xd=9007199254740991,Pd=/^(?:0|[1-9]\d*)$/;function Td(t,e){var r=typeof t;return e=e??xd,!!e&&(r=="number"||r!="symbol"&&Pd.test(t))&&t>-1&&t%1==0&&t<e}var zn=Td,Rd=vr,Fd=St,Md=zn,Cd=Ze;function Nd(t,e,r){if(!Cd(r))return!1;var n=typeof e;return(n=="number"?Fd(r)&&Md(e,r.length):n=="string"&&e in r)?Rd(r[e],t):!1}var yo=Nd,Bd=$d,Dd=yo;function Ud(t){return Bd(function(e,r){var n=-1,i=r.length,a=i>1?r[i-1]:void 0,o=i>2?r[2]:void 0;for(a=t.length>3&&typeof a=="function"?(i--,a):void 0,o&&Dd(r[0],r[1],o)&&(a=i<3?void 0:a,i=1),e=Object(e);++n<i;){var u=r[n];u&&t(e,u,n,a)}return e})}var Ld=Ud;function kd(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var go=kd,qd=ge,jd=ve,Vd="[object Arguments]";function Gd(t){return jd(t)&&qd(t)==Vd}var Hd=Gd,vo=Hd,Wd=ve,_o=Object.prototype,Xd=_o.hasOwnProperty,zd=_o.propertyIsEnumerable,Yd=vo(function(){return arguments}())?vo:function(t){return Wd(t)&&Xd.call(t,"callee")&&!zd.call(t,"callee")},mo=Yd,Kd=Array.isArray,V=Kd,mr={exports:{}};function Zd(){return!1}var Jd=Zd;mr.exports,function(t,e){var r=fe,n=Jd,i=e&&!e.nodeType&&e,a=i&&!0&&t&&!t.nodeType&&t,o=a&&a.exports===i,u=o?r.Buffer:void 0,f=u?u.isBuffer:void 0,c=f||n;t.exports=c}(mr,mr.exports);var wo=mr.exports,Qd=ge,ey=Xn,ty=ve,ry="[object Arguments]",ny="[object Array]",iy="[object Boolean]",ay="[object Date]",oy="[object Error]",uy="[object Function]",sy="[object Map]",fy="[object Number]",cy="[object Object]",ly="[object RegExp]",hy="[object Set]",py="[object String]",dy="[object WeakMap]",yy="[object ArrayBuffer]",gy="[object DataView]",vy="[object Float32Array]",_y="[object Float64Array]",my="[object Int8Array]",wy="[object Int16Array]",by="[object Int32Array]",$y="[object Uint8Array]",Ey="[object Uint8ClampedArray]",Ay="[object Uint16Array]",Sy="[object Uint32Array]",R={};R[vy]=R[_y]=R[my]=R[wy]=R[by]=R[$y]=R[Ey]=R[Ay]=R[Sy]=!0,R[ry]=R[ny]=R[yy]=R[iy]=R[gy]=R[ay]=R[oy]=R[uy]=R[sy]=R[fy]=R[cy]=R[ly]=R[hy]=R[py]=R[dy]=!1;function Oy(t){return ty(t)&&ey(t.length)&&!!R[Qd(t)]}var Iy=Oy;function xy(t){return function(e){return t(e)}}var Py=xy,wr={exports:{}};wr.exports,function(t,e){var r=ro,n=e&&!e.nodeType&&e,i=n&&!0&&t&&!t.nodeType&&t,a=i&&i.exports===n,o=a&&r.process,u=function(){try{var f=i&&i.require&&i.require("util").types;return f||o&&o.binding&&o.binding("util")}catch{}}();t.exports=u}(wr,wr.exports);var Ty=wr.exports,Ry=Iy,Fy=Py,bo=Ty,$o=bo&&bo.isTypedArray,My=$o?Fy($o):Ry,Eo=My,Cy=go,Ny=mo,By=V,Dy=wo,Uy=zn,Ly=Eo,ky=Object.prototype,qy=ky.hasOwnProperty;function jy(t,e){var r=By(t),n=!r&&Ny(t),i=!r&&!n&&Dy(t),a=!r&&!n&&!i&&Ly(t),o=r||n||i||a,u=o?Cy(t.length,String):[],f=u.length;for(var c in t)(e||qy.call(t,c))&&!(o&&(c=="length"||i&&(c=="offset"||c=="parent")||a&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Uy(c,f)))&&u.push(c);return u}var Ao=jy,Vy=Object.prototype;function Gy(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Vy;return t===r}var So=Gy;function Hy(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Wy=Hy,Xy=Ze,zy=So,Yy=Wy,Ky=Object.prototype,Zy=Ky.hasOwnProperty;function Jy(t){if(!Xy(t))return Yy(t);var e=zy(t),r=[];for(var n in t)n=="constructor"&&(e||!Zy.call(t,n))||r.push(n);return r}var Qy=Jy,eg=Ao,tg=Qy,rg=St;function ng(t){return rg(t)?eg(t,!0):tg(t)}var ig=ng,ag=Kp,og=Ld,ug=ig,sg=og(function(t,e){ag(e,ug(e),t)}),fg=sg,cg=fg,br={},Me={};function lg(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(!e(t[r],r,t))return!1;return!0}var hg=lg;function pg(t){return function(e,r,n){for(var i=-1,a=Object(e),o=n(e),u=o.length;u--;){var f=o[t?u:++i];if(r(a[f],f,a)===!1)break}return e}}var dg=pg,yg=dg,gg=yg(),vg=gg;function _g(t,e){return function(r){return t(e(r))}}var mg=_g,wg=mg,bg=wg(Object.keys,Object),$g=bg,Eg=So,Ag=$g,Sg=Object.prototype,Og=Sg.hasOwnProperty;function Ig(t){if(!Eg(t))return Ag(t);var e=[];for(var r in Object(t))Og.call(t,r)&&r!="constructor"&&e.push(r);return e}var xg=Ig,Pg=Ao,Tg=xg,Rg=St;function Fg(t){return Rg(t)?Pg(t):Tg(t)}var $r=Fg,Mg=vg,Cg=$r;function Ng(t,e){return t&&Mg(t,e,Cg)}var Bg=Ng,Dg=St;function Ug(t,e){return function(r,n){if(r==null)return r;if(!Dg(r))return t(r,n);for(var i=r.length,a=e?i:-1,o=Object(r);(e?a--:++a<i)&&n(o[a],a,o)!==!1;);return r}}var Lg=Ug,kg=Bg,qg=Lg,jg=qg(kg),Yn=jg,Vg=Yn;function Gg(t,e){var r=!0;return Vg(t,function(n,i,a){return r=!!e(n,i,a),r}),r}var Hg=Gg;function Wg(){this.__data__=[],this.size=0}var Xg=Wg,zg=vr;function Yg(t,e){for(var r=t.length;r--;)if(zg(t[r][0],e))return r;return-1}var Er=Yg,Kg=Er,Zg=Array.prototype,Jg=Zg.splice;function Qg(t){var e=this.__data__,r=Kg(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():Jg.call(e,r,1),--this.size,!0}var ev=Qg,tv=Er;function rv(t){var e=this.__data__,r=tv(e,t);return r<0?void 0:e[r][1]}var nv=rv,iv=Er;function av(t){return iv(this.__data__,t)>-1}var ov=av,uv=Er;function sv(t,e){var r=this.__data__,n=uv(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var fv=sv,cv=Xg,lv=ev,hv=nv,pv=ov,dv=fv;function Je(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Je.prototype.clear=cv,Je.prototype.delete=lv,Je.prototype.get=hv,Je.prototype.has=pv,Je.prototype.set=dv;var Ar=Je,yv=Ar;function gv(){this.__data__=new yv,this.size=0}var vv=gv;function _v(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var mv=_v;function wv(t){return this.__data__.get(t)}var bv=wv;function $v(t){return this.__data__.has(t)}var Ev=$v,Av=Fe,Sv=fe,Ov=Av(Sv,"Map"),Kn=Ov,Iv=Fe,xv=Iv(Object,"create"),Sr=xv,Oo=Sr;function Pv(){this.__data__=Oo?Oo(null):{},this.size=0}var Tv=Pv;function Rv(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Fv=Rv,Mv=Sr,Cv="__lodash_hash_undefined__",Nv=Object.prototype,Bv=Nv.hasOwnProperty;function Dv(t){var e=this.__data__;if(Mv){var r=e[t];return r===Cv?void 0:r}return Bv.call(e,t)?e[t]:void 0}var Uv=Dv,Lv=Sr,kv=Object.prototype,qv=kv.hasOwnProperty;function jv(t){var e=this.__data__;return Lv?e[t]!==void 0:qv.call(e,t)}var Vv=jv,Gv=Sr,Hv="__lodash_hash_undefined__";function Wv(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Gv&&e===void 0?Hv:e,this}var Xv=Wv,zv=Tv,Yv=Fv,Kv=Uv,Zv=Vv,Jv=Xv;function Qe(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Qe.prototype.clear=zv,Qe.prototype.delete=Yv,Qe.prototype.get=Kv,Qe.prototype.has=Zv,Qe.prototype.set=Jv;var Qv=Qe,Io=Qv,e_=Ar,t_=Kn;function r_(){this.size=0,this.__data__={hash:new Io,map:new(t_||e_),string:new Io}}var n_=r_;function i_(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var a_=i_,o_=a_;function u_(t,e){var r=t.__data__;return o_(e)?r[typeof e=="string"?"string":"hash"]:r.map}var Or=u_,s_=Or;function f_(t){var e=s_(this,t).delete(t);return this.size-=e?1:0,e}var c_=f_,l_=Or;function h_(t){return l_(this,t).get(t)}var p_=h_,d_=Or;function y_(t){return d_(this,t).has(t)}var g_=y_,v_=Or;function __(t,e){var r=v_(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var m_=__,w_=n_,b_=c_,$_=p_,E_=g_,A_=m_;function et(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}et.prototype.clear=w_,et.prototype.delete=b_,et.prototype.get=$_,et.prototype.has=E_,et.prototype.set=A_;var Zn=et,S_=Ar,O_=Kn,I_=Zn,x_=200;function P_(t,e){var r=this.__data__;if(r instanceof S_){var n=r.__data__;if(!O_||n.length<x_-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new I_(n)}return r.set(t,e),this.size=r.size,this}var T_=P_,R_=Ar,F_=vv,M_=mv,C_=bv,N_=Ev,B_=T_;function tt(t){var e=this.__data__=new R_(t);this.size=e.size}tt.prototype.clear=F_,tt.prototype.delete=M_,tt.prototype.get=C_,tt.prototype.has=N_,tt.prototype.set=B_;var xo=tt,D_="__lodash_hash_undefined__";function U_(t){return this.__data__.set(t,D_),this}var L_=U_;function k_(t){return this.__data__.has(t)}var q_=k_,j_=Zn,V_=L_,G_=q_;function Ir(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new j_;++e<r;)this.add(t[e])}Ir.prototype.add=Ir.prototype.push=V_,Ir.prototype.has=G_;var H_=Ir;function W_(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}var X_=W_;function z_(t,e){return t.has(e)}var Y_=z_,K_=H_,Z_=X_,J_=Y_,Q_=1,em=2;function tm(t,e,r,n,i,a){var o=r&Q_,u=t.length,f=e.length;if(u!=f&&!(o&&f>u))return!1;var c=a.get(t),l=a.get(e);if(c&&l)return c==e&&l==t;var s=-1,h=!0,y=r&em?new K_:void 0;for(a.set(t,e),a.set(e,t);++s<u;){var w=t[s],S=e[s];if(n)var O=o?n(S,w,s,e,t,a):n(w,S,s,t,e,a);if(O!==void 0){if(O)continue;h=!1;break}if(y){if(!Z_(e,function(b,E){if(!J_(y,E)&&(w===b||i(w,b,r,n,a)))return y.push(E)})){h=!1;break}}else if(!(w===S||i(w,S,r,n,a))){h=!1;break}}return a.delete(t),a.delete(e),h}var Po=tm,rm=fe,nm=rm.Uint8Array,im=nm;function am(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}var om=am;function um(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var sm=um,To=yr,Ro=im,fm=vr,cm=Po,lm=om,hm=sm,pm=1,dm=2,ym="[object Boolean]",gm="[object Date]",vm="[object Error]",_m="[object Map]",mm="[object Number]",wm="[object RegExp]",bm="[object Set]",$m="[object String]",Em="[object Symbol]",Am="[object ArrayBuffer]",Sm="[object DataView]",Fo=To?To.prototype:void 0,Jn=Fo?Fo.valueOf:void 0;function Om(t,e,r,n,i,a,o){switch(r){case Sm:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Am:return!(t.byteLength!=e.byteLength||!a(new Ro(t),new Ro(e)));case ym:case gm:case mm:return fm(+t,+e);case vm:return t.name==e.name&&t.message==e.message;case wm:case $m:return t==e+"";case _m:var u=lm;case bm:var f=n±if(u||(u=hm),t.size!=e.size&&!f)return!1;var c=o.get(t);if(c)return c==e;n|=dm,o.set(t,e);var l=cm(u(t),u(e),n,i,a,o);return o.delete(t),l;case Em:if(Jn)return Jn.call(t)==Jn.call(e)}return!1}var Im=Om;function xm(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}var Pm=xm,Tm=Pm,Rm=V;function Fm(t,e,r){var n=e(t);return Rm(t)?n:Tm(n,r(t))}var Mm=Fm;function Cm(t,e){for(var r=-1,n=t==null?0:t.length,i=0,a=[];++r<n;){var o=t[r];e(o,r,t)&&(a[i++]=o)}return a}var Nm=Cm;function Bm(){return[]}var Dm=Bm,Um=Nm,Lm=Dm,km=Object.prototype,qm=km.propertyIsEnumerable,Mo=Object.getOwnPropertySymbols,jm=Mo?function(t){return t==null?[]:(t=Object(t),Um(Mo(t),function(e){return qm.call(t,e)}))}:Lm,Vm=jm,Gm=Mm,Hm=Vm,Wm=$r;function Xm(t){return Gm(t,Wm,Hm)}var zm=Xm,Co=zm,Ym=1,Km=Object.prototype,Zm=Km.hasOwnProperty;function Jm(t,e,r,n,i,a){var o=r&Ym,u=Co(t),f=u.length,c=Co(e),l=c.length;if(f!=l&&!o)return!1;for(var s=f;s--;){var h=u[s];if(!(o?h in e:Zm.call(e,h)))return!1}var y=a.get(t),w=a.get(e);if(y&&w)return y==e&&w==t;var S=!0;a.set(t,e),a.set(e,t);for(var O=o;++s<f;){h=u[s];var b=t[h],E=e[h];if(n)var p=o?n(E,b,h,e,t,a):n(b,E,h,t,e,a);if(!(p===void 0?b===E||i(b,E,r,n,a):p)){S=!1;break}O||(O=h=="constructor")}if(S&&!O){var I=t.constructor,T=e.constructor;I!=T&&"constructor"in t&&"constructor"in e&&!(typeof I=="function"&&I instanceof I&&typeof T=="function"&&T instanceof T)&&(S=!1)}return a.delete(t),a.delete(e),S}var Qm=Jm,ew=Fe,tw=fe,rw=ew(tw,"DataView"),nw=rw,iw=Fe,aw=fe,ow=iw(aw,"Promise"),uw=ow,sw=Fe,fw=fe,cw=sw(fw,"Set"),lw=cw,hw=Fe,pw=fe,dw=hw(pw,"WeakMap"),yw=dw,Qn=nw,ei=Kn,ti=uw,ri=lw,ni=yw,No=ge,rt=so,Bo="[object Map]",gw="[object Object]",Do="[object Promise]",Uo="[object Set]",Lo="[object WeakMap]",ko="[object DataView]",vw=rt(Qn),_w=rt(ei),mw=rt(ti),ww=rt(ri),bw=rt(ni),Ce=No;(Qn&&Ce(new Qn(new ArrayBuffer(1)))!=ko||ei&&Ce(new ei)!=Bo||ti&&Ce(ti.resolve())!=Do||ri&&Ce(new ri)!=Uo||ni&&Ce(new ni)!=Lo)&&(Ce=function(t){var e=No(t),r=e==gw?t.constructor:void 0,n=r?rt(r):"";if(n)switch(n){case vw:return ko;case _w:return Bo;case mw:return Do;case ww:return Uo;case bw:return Lo}return e});var $w=Ce,ii=xo,Ew=Po,Aw=Im,Sw=Qm,qo=$w,jo=V,Vo=wo,Ow=Eo,Iw=1,Go="[object Arguments]",Ho="[object Array]",xr="[object Object]",xw=Object.prototype,Wo=xw.hasOwnProperty;function Pw(t,e,r,n,i,a){var o=jo(t),u=jo(e),f=o?Ho:qo(t),c=u?Ho:qo(e);f=f==Go?xr:f,c=c==Go?xr:c;var l=f==xr,s=c==xr,h=f==c;if(h&&Vo(t)){if(!Vo(e))return!1;o=!0,l=!1}if(h&&!l)return a||(a=new ii),o||Ow(t)?Ew(t,e,r,n,i,a):Aw(t,e,f,r,n,i,a);if(!(r&Iw)){var y=l&&Wo.call(t,"__wrapped__"),w=s&&Wo.call(e,"__wrapped__");if(y||w){var S=y?t.value():t,O=w?e.value():e;return a||(a=new ii),i(S,O,r,n,a)}}return h?(a||(a=new ii),Sw(t,e,r,n,i,a)):!1}var Tw=Pw,Rw=Tw,Xo=ve;function zo(t,e,r,n,i){return t===e?!0:t==null||e==null||!Xo(t)&&!Xo(e)?t!==t&&e!==e:Rw(t,e,r,n,zo,i)}var Yo=zo,Fw=xo,Mw=Yo,Cw=1,Nw=2;function Bw(t,e,r,n){var i=r.length,a=i,o=!n;if(t==null)return!a;for(t=Object(t);i--;){var u=r[i];if(o&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++i<a;){u=r[i];var f=u[0],c=t[f],l=u[1];if(o&&u[2]){if(c===void 0&&!(f in t))return!1}else{var s=new Fw;if(n)var h=n(c,l,f,t,e,s);if(!(h===void 0?Mw(l,c,Cw|Nw,n,s):h))return!1}}return!0}var Dw=Bw,Uw=Ze;function Lw(t){return t===t&&!Uw(t)}var Ko=Lw,kw=Ko,qw=$r;function jw(t){for(var e=qw(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,kw(i)]}return e}var Vw=jw;function Gw(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var Zo=Gw,Hw=Dw,Ww=Vw,Xw=Zo;function zw(t){var e=Ww(t);return e.length==1&&e[0][2]?Xw(e[0][0],e[0][1]):function(r){return r===t||Hw(r,t,e)}}var Yw=zw,Kw=ge,Zw=ve,Jw="[object Symbol]";function Qw(t){return typeof t=="symbol"||Zw(t)&&Kw(t)==Jw}var Pr=Qw,e0=V,t0=Pr,r0=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n0=/^\w*$/;function i0(t,e){if(e0(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||t0(t)?!0:n0.test(t)||!r0.test(t)||e!=null&&t in Object(e)}var ai=i0,Jo=Zn,a0="Expected a function";function oi(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(a0);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=t.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(oi.Cache||Jo),r}oi.Cache=Jo;var o0=oi,u0=o0,s0=500;function f0(t){var e=u0(t,function(n){return r.size===s0&&r.clear(),n}),r=e.cache;return e}var c0=f0,l0=c0,h0=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,p0=/\\(\\)?/g,d0=l0(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(h0,function(r,n,i,a){e.push(i?a.replace(p0,"$1"):n||r)}),e}),y0=d0;function g0(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var ui=g0,Qo=yr,v0=ui,_0=V,m0=Pr,w0=1/0,eu=Qo?Qo.prototype:void 0,tu=eu?eu.toString:void 0;function ru(t){if(typeof t=="string")return t;if(_0(t))return v0(t,ru)+"";if(m0(t))return tu?tu.call(t):"";var e=t+"";return e=="0"&&1/t==-w0?"-0":e}var b0=ru,$0=b0;function E0(t){return t==null?"":$0(t)}var A0=E0,S0=V,O0=ai,I0=y0,x0=A0;function P0(t,e){return S0(t)?t:O0(t,e)?[t]:I0(x0(t))}var nu=P0,T0=Pr,R0=1/0;function F0(t){if(typeof t=="string"||T0(t))return t;var e=t+"";return e=="0"&&1/t==-R0?"-0":e}var Tr=F0,M0=nu,C0=Tr;function N0(t,e){e=M0(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[C0(e[r++])];return r&&r==n?t:void 0}var iu=N0,B0=iu;function D0(t,e,r){var n=t==null?void 0:B0(t,e);return n===void 0?r:n}var U0=D0;function L0(t,e){return t!=null&&e in Object(t)}var k0=L0,q0=nu,j0=mo,V0=V,G0=zn,H0=Xn,W0=Tr;function X0(t,e,r){e=q0(e,t);for(var n=-1,i=e.length,a=!1;++n<i;){var o=W0(e[n]);if(!(a=t!=null&&r(t,o)))break;t=t[o]}return a||++n!=i?a:(i=t==null?0:t.length,!!i&&H0(i)&&G0(o,i)&&(V0(t)||j0(t)))}var z0=X0,Y0=k0,K0=z0;function Z0(t,e){return t!=null&&K0(t,e,Y0)}var J0=Z0,Q0=Yo,eb=U0,tb=J0,rb=ai,nb=Ko,ib=Zo,ab=Tr,ob=1,ub=2;function sb(t,e){return rb(t)&&nb(e)?ib(ab(t),e):function(r){var n=eb(r,t);return n===void 0&&n===e?tb(r,t):Q0(e,n,ob|ub)}}var fb=sb;function cb(t){return function(e){return e?.[t]}}var lb=cb,hb=iu;function pb(t){return function(e){return hb(e,t)}}var db=pb,yb=lb,gb=db,vb=ai,_b=Tr;function mb(t){return vb(t)?yb(_b(t)):gb(t)}var wb=mb,bb=Yw,$b=fb,Eb=_r,Ab=V,Sb=wb;function Ob(t){return typeof t=="function"?t:t==null?Eb:typeof t=="object"?Ab(t)?$b(t[0],t[1]):bb(t):Sb(t)}var au=Ob,Ib=hg,xb=Hg,Pb=au,Tb=V,Rb=yo;function Fb(t,e,r){var n=Tb(t)?Ib:xb;return r&&Rb(t,e,r)&&(e=void 0),n(t,Pb(e))}var si=Fb;Object.defineProperty(Me,"__esModule",{value:!0}),Me.calculatePadding=Bb,Me.slicePadding=Db;var Mb=si,Cb=Nb(Mb);function Nb(t){return t&&t.__esModule?t:{default:t}}function Bb(t){switch(t%4){case 0:return 0;case 1:return 3;case 2:return 2;case 3:return 1;default:return null}}function Db(t,e){var r=t.slice(e),n=(0,Cb.default)(r.buffer(),function(i){return i===0});if(n!==!0)throw new Error("XDR Read Error: invalid padding")}Object.defineProperty(br,"__esModule",{value:!0}),br.Cursor=void 0;var Ub=function(){function t(e,r){for(var n=0;n<r.length;n++){var i=r[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),Lb=Me;function kb(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var fi=function(){function t(e){kb(this,t),e instanceof d||(e=typeof e=="number"?d.alloc(e):d.from(e)),this._setBuffer(e),this.rewind()}return Ub(t,[{key:"_setBuffer",value:function(r){this._buffer=r,this.length=r.length}},{key:"buffer",value:function(){return this._buffer}},{key:"tap",value:function(r){return r(this),this}},{key:"clone",value:function(r){var n=new this.constructor(this.buffer());return n.seek(arguments.length===0?this.tell():r),n}},{key:"tell",value:function(){return this._index}},{key:"seek",value:function(r,n){return arguments.length===1&&(n=r,r="="),r==="+"?this._index+=n:r==="-"?this._index-=n:this._index=n,this}},{key:"rewind",value:function(){return this.seek(0)}},{key:"eof",value:function(){return this.tell()===this.buffer().length}},{key:"write",value:function(r,n,i){return this.seek("+",this.buffer().write(r,this.tell(),n,i))}},{key:"fill",value:function(r,n){return arguments.length===1&&(n=this.buffer().length-this.tell()),this.buffer().fill(r,this.tell(),this.tell()+n),this.seek("+",n),this}},{key:"slice",value:function(r){arguments.length===0&&(r=this.length-this.tell());var n=new this.constructor(this.buffer().slice(this.tell(),this.tell()+r));return this.seek("+",r),n}},{key:"copyFrom",value:function(r){var n=r instanceof d?r:r.buffer();return n.copy(this.buffer(),this.tell(),0,n.length),this.seek("+",n.length),this}},{key:"concat",value:function(r){r.forEach(function(i,a){i instanceof t&&(r[a]=i.buffer())}),r.unshift(this.buffer());var n=d.concat(r);return this._setBuffer(n),this}},{key:"toString",value:function(r,n){arguments.length===0?(r="utf8",n=this.buffer().length-this.tell()):arguments.length===1&&(n=this.buffer().length-this.tell());var i=this.buffer().toString(r,this.tell(),this.tell()+n);return this.seek("+",n),i}},{key:"writeBufferPadded",value:function(r){var n=(0,Lb.calculatePadding)(r.length),i=d.alloc(n);return this.copyFrom(new t(r)).copyFrom(new t(i))}}]),t}();[[1,["readInt8","readUInt8"]],[2,["readInt16BE","readInt16LE","readUInt16BE","readUInt16LE"]],[4,["readInt32BE","readInt32LE","readUInt32BE","readUInt32LE","readFloatBE","readFloatLE"]],[8,["readDoubleBE","readDoubleLE"]]].forEach(function(t){t[1].forEach(function(e){fi.prototype[e]=function(){var n=this.buffer()[e](this.tell());return this.seek("+",t[0]),n}})}),[[1,["writeInt8","writeUInt8"]],[2,["writeInt16BE","writeInt16LE","writeUInt16BE","writeUInt16LE"]],[4,["writeInt32BE","writeInt32LE","writeUInt32BE","writeUInt32LE","writeFloatBE","writeFloatLE"]],[8,["writeDoubleBE","writeDoubleLE"]]].forEach(function(t){t[1].forEach(function(e){fi.prototype[e]=function(n){return this.buffer()[e](n,this.tell()),this.seek("+",t[0]),this}})}),br.Cursor=fi,Object.defineProperty(C,"__esModule",{value:!0}),C.default=Xb;var qb=cg,ou=su(qb),jb=Hn,Vb=su(jb),uu=br;function su(t){return t&&t.__esModule?t:{default:t}}var Gb=Math.pow(2,16),Hb={toXDR:function(e){var r=new uu.Cursor(Gb);this.write(e,r);var n=r.tell();return r.rewind(),r.slice(n).buffer()},fromXDR:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"raw",n=void 0;switch(r){case"raw":n=e;break;case"hex":n=d.from(e,"hex");break;case"base64":n=d.from(e,"base64");break;default:throw new Error("Invalid format "+r+', must be "raw", "hex", "base64"')}var i=new uu.Cursor(n),a=this.read(i);return a},validateXDR:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"raw";try{return this.fromXDR(e,r),!0}catch{return!1}}},Wb={toXDR:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"raw",r=this.constructor.toXDR(this);switch(e){case"raw":return r;case"hex":return r.toString("hex");case"base64":return r.toString("base64");default:throw new Error("Invalid format "+e+', must be "raw", "hex", "base64"')}}};function Xb(t){(0,ou.default)(t,Hb),(0,Vb.default)(t)&&(0,ou.default)(t.prototype,Wb)}Object.defineProperty(se,"__esModule",{value:!0}),se.Int=void 0;var zb=gr,fu=cu(zb),Yb=C,Kb=cu(Yb);function cu(t){return t&&t.__esModule?t:{default:t}}var Ot=se.Int={read:function(e){return e.readInt32BE()},write:function(e,r){if(!(0,fu.default)(e))throw new Error("XDR Write Error: not a number");if(Math.floor(e)!==e)throw new Error("XDR Write Error: not an integer");r.writeInt32BE(e)},isValid:function(e){return!(0,fu.default)(e)||Math.floor(e)!==e?!1:e>=Ot.MIN_VALUE&&e<=Ot.MAX_VALUE}};Ot.MAX_VALUE=Math.pow(2,31)-1,Ot.MIN_VALUE=-Math.pow(2,31),(0,Kb.default)(Ot);var Rr={};function Zb(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var lu={exports:{}};(function(t){/**
|
|
20
|
+
`+e.prev}function fr(t,e){var r=Nn(t),n=[];if(r){n.length=t.length;for(var i=0;i<t.length;i++)n[i]=de(t,i)?e(t[i],t):""}var a=typeof Fn=="function"?Fn(t):[],o;if(ze){o={};for(var u=0;u<a.length;u++)o["$"+a[u]]=a[u]}for(var f in t)de(t,f)&&(r&&String(Number(f))===f&&f<t.length||ze&&o["$"+f]instanceof Symbol||(Ma.call(/[^\w$]/,f)?n.push(e(f,t)+": "+e(t[f],t)):n.push(f+": "+e(t[f],t))));if(typeof Fn=="function")for(var c=0;c<a.length;c++)Ba.call(t,a[c])&&n.push("["+e(a[c])+"]: "+e(t[a[c]],t));return n}var Un=cn,Ye=Nf,xl=fl,Pl=Un("%TypeError%"),cr=Un("%WeakMap%",!0),lr=Un("%Map%",!0),Tl=Ye("WeakMap.prototype.get",!0),Rl=Ye("WeakMap.prototype.set",!0),Fl=Ye("WeakMap.prototype.has",!0),Ml=Ye("Map.prototype.get",!0),Cl=Ye("Map.prototype.set",!0),Nl=Ye("Map.prototype.has",!0),Ln=function(t,e){for(var r=t,n;(n=r.next)!==null;r=n)if(n.key===e)return r.next=n.next,n.next=t.next,t.next=n,n},Bl=function(t,e){var r=Ln(t,e);return r&&r.value},Dl=function(t,e,r){var n=Ln(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},Ul=function(t,e){return!!Ln(t,e)},Ll=function(){var e,r,n,i={assert:function(a){if(!i.has(a))throw new Pl("Side channel does not contain "+xl(a))},get:function(a){if(cr&&a&&(typeof a=="object"||typeof a=="function")){if(e)return Tl(e,a)}else if(lr){if(r)return Ml(r,a)}else if(n)return Bl(n,a)},has:function(a){if(cr&&a&&(typeof a=="object"||typeof a=="function")){if(e)return Fl(e,a)}else if(lr){if(r)return Nl(r,a)}else if(n)return Ul(n,a);return!1},set:function(a,o){cr&&a&&(typeof a=="object"||typeof a=="function")?(e||(e=new cr),Rl(e,a,o)):lr?(r||(r=new lr),Cl(r,a,o)):(n||(n={key:{},next:null}),Dl(n,a,o))}};return i},kl=String.prototype.replace,ql=/%20/g,kn={RFC1738:"RFC1738",RFC3986:"RFC3986"},Xa={default:kn.RFC3986,formatters:{RFC1738:function(t){return kl.call(t,ql,"+")},RFC3986:function(t){return String(t)}},RFC1738:kn.RFC1738,RFC3986:kn.RFC3986},jl=Xa,qn=Object.prototype.hasOwnProperty,Re=Array.isArray,te=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),Vl=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(Re(n)){for(var i=[],a=0;a<n.length;++a)typeof n[a]<"u"&&i.push(n[a]);r.obj[r.prop]=i}}},za=function(e,r){for(var n=r&&r.plainObjects?Object.create(null):{},i=0;i<e.length;++i)typeof e[i]<"u"&&(n[i]=e[i]);return n},Gl=function t(e,r,n){if(!r)return e;if(typeof r!="object"){if(Re(e))e.push(r);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!qn.call(Object.prototype,r))&&(e[r]=!0);else return[e,r];return e}if(!e||typeof e!="object")return[e].concat(r);var i=e;return Re(e)&&!Re(r)&&(i=za(e,n)),Re(e)&&Re(r)?(r.forEach(function(a,o){if(qn.call(e,o)){var u=e[o];u&&typeof u=="object"&&a&&typeof a=="object"?e[o]=t(u,a,n):e.push(a)}else e[o]=a}),e):Object.keys(r).reduce(function(a,o){var u=r[o];return qn.call(a,o)?a[o]=t(a[o],u,n):a[o]=u,a},i)},Hl=function(e,r){return Object.keys(r).reduce(function(n,i){return n[i]=r[i],n},e)},Wl=function(t,e,r){var n=t.replace(/\+/g," ");if(r==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},Xl=function(e,r,n,i,a){if(e.length===0)return e;var o=e;if(typeof e=="symbol"?o=Symbol.prototype.toString.call(e):typeof e!="string"&&(o=String(e)),n==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(l){return"%26%23"+parseInt(l.slice(2),16)+"%3B"});for(var u="",f=0;f<o.length;++f){var c=o.charCodeAt(f);if(c===45||c===46||c===95||c===126||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||a===jl.RFC1738&&(c===40||c===41)){u+=o.charAt(f);continue}if(c<128){u=u+te[c];continue}if(c<2048){u=u+(te[192|c>>6]+te[128|c&63]);continue}if(c<55296||c>=57344){u=u+(te[224|c>>12]+te[128|c>>6&63]+te[128|c&63]);continue}f+=1,c=65536+((c&1023)<<10|o.charCodeAt(f)&1023),u+=te[240|c>>18]+te[128|c>>12&63]+te[128|c>>6&63]+te[128|c&63]}return u},zl=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i<r.length;++i)for(var a=r[i],o=a.obj[a.prop],u=Object.keys(o),f=0;f<u.length;++f){var c=u[f],l=o[c];typeof l=="object"&&l!==null&&n.indexOf(l)===-1&&(r.push({obj:o,prop:c}),n.push(l))}return Vl(r),e},Yl=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Kl=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Zl=function(e,r){return[].concat(e,r)},Jl=function(e,r){if(Re(e)){for(var n=[],i=0;i<e.length;i+=1)n.push(r(e[i]));return n}return r(e)},Ql={arrayToObject:za,assign:Hl,combine:Zl,compact:zl,decode:Wl,encode:Xl,isBuffer:Kl,isRegExp:Yl,maybeMap:Jl,merge:Gl},Ya=Ll,hr=Ql,$t=Xa,eh=Object.prototype.hasOwnProperty,Ka={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},oe=Array.isArray,th=Array.prototype.push,Za=function(t,e){th.apply(t,oe(e)?e:[e])},rh=Date.prototype.toISOString,Ja=$t.default,q={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:hr.encode,encodeValuesOnly:!1,format:Ja,formatter:$t.formatters[Ja],indices:!1,serializeDate:function(e){return rh.call(e)},skipNulls:!1,strictNullHandling:!1},nh=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},jn={},ih=function t(e,r,n,i,a,o,u,f,c,l,s,h,y,w,S,O){for(var b=e,E=O,p=0,I=!1;(E=E.get(jn))!==void 0&&!I;){var T=E.get(e);if(p+=1,typeof T<"u"){if(T===p)throw new RangeError("Cyclic object value");I=!0}typeof E.get(jn)>"u"&&(p=0)}if(typeof f=="function"?b=f(r,b):b instanceof Date?b=s(b):n==="comma"&&oe(b)&&(b=hr.maybeMap(b,function(we){return we instanceof Date?s(we):we})),b===null){if(a)return u&&!w?u(r,q.encoder,S,"key",h):r;b=""}if(nh(b)||hr.isBuffer(b)){if(u){var F=w?r:u(r,q.encoder,S,"key",h);return[y(F)+"="+y(u(b,q.encoder,S,"value",h))]}return[y(r)+"="+y(String(b))]}var _=[];if(typeof b>"u")return _;var g;if(n==="comma"&&oe(b))w&&u&&(b=hr.maybeMap(b,u)),g=[{value:b.length>0?b.join(",")||null:void 0}];else if(oe(f))g=f;else{var v=Object.keys(b);g=c?v.sort(c):v}for(var A=i&&oe(b)&&b.length===1?r+"[]":r,x=0;x<g.length;++x){var M=g[x],z=typeof M=="object"&&typeof M.value<"u"?M.value:b[M];if(!(o&&z===null)){var me=oe(b)?typeof n=="function"?n(A,M):A:A+(l?"."+M:"["+M+"]");O.set(e,p);var lt=Ya();lt.set(jn,O),Za(_,t(z,me,n,i,a,o,n==="comma"&&w&&oe(b)?null:u,f,c,l,s,h,y,w,S,lt))}}return _},ah=function(e){if(!e)return q;if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var r=e.charset||q.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=$t.default;if(typeof e.format<"u"){if(!eh.call($t.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var i=$t.formatters[n],a=q.filter;return(typeof e.filter=="function"||oe(e.filter))&&(a=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:q.addQueryPrefix,allowDots:typeof e.allowDots>"u"?q.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:q.charsetSentinel,delimiter:typeof e.delimiter>"u"?q.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:q.encode,encoder:typeof e.encoder=="function"?e.encoder:q.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:q.encodeValuesOnly,filter:a,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:q.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:q.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:q.strictNullHandling}},oh=function(t,e){var r=t,n=ah(e),i,a;typeof n.filter=="function"?(a=n.filter,r=a("",r)):oe(n.filter)&&(a=n.filter,i=a);var o=[];if(typeof r!="object"||r===null)return"";var u;e&&e.arrayFormat in Ka?u=e.arrayFormat:e&&"indices"in e?u=e.indices?"indices":"repeat":u="indices";var f=Ka[u];if(e&&"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var c=f==="comma"&&e&&e.commaRoundTrip;i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var l=Ya(),s=0;s<i.length;++s){var h=i[s];n.skipNulls&&r[h]===null||Za(o,ih(r[h],h,f,c,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,l))}var y=o.join(n.delimiter),w=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?w+="utf8=%26%2310003%3B&":w+="utf8=%E2%9C%93&"),y.length>0?w+y:""},uh=be(oh);let Qa={storeIdentifier:"",environment:"prod"};function sh(t){Qa=t}function W(){return Qa}const fh=(t,e="")=>{switch(t){case"prod":return"https://api.rechargeapps.com";case"stage":return"https://api.stage.rechargeapps.com";case"preprod":case"prestage":return`${e}/api`}},ch=(t,e="")=>{switch(t){case"prod":return"https://admin.rechargeapps.com";case"stage":return"https://admin.stage.rechargeapps.com";case"preprod":case"prestage":return e}},lh=t=>{switch(t){case"prod":case"preprod":return"https://static.rechargecdn.com";case"stage":case"prestage":return"https://static.stage.rechargecdn.com"}},hh="/tools/recurring";class pr{constructor(e,r){this.name="RechargeRequestError",this.message=e,this.status=r}}function ph(t){return uh(t,{encode:!1,indices:!1,arrayFormat:"comma"})}function m(t,e){return{...t,internalFnCall:t.internalFnCall??e,internalRequestId:t.internalRequestId??ji()}}async function dr(t,e,r={}){const n=W();return ue(t,`${lh(n.environment)}/store/${n.storeIdentifier}${e}`,r)}async function $(t,e,{id:r,query:n,data:i,headers:a}={},o){const{environment:u,environmentUri:f,storeIdentifier:c,loginRetryFn:l,appName:s,appVersion:h}=W(),y=o.apiToken,w=fh(u,f),S={"X-Recharge-Access-Token":y,"X-Recharge-Version":"2021-11","X-Recharge-Sdk-Fn":o.internalFnCall,...s?{"X-Recharge-Sdk-App-Name":s}:{},...h?{"X-Recharge-Sdk-App-Version":h}:{},"X-Recharge-Sdk-Version":"1.28.0","X-Request-Id":o.internalRequestId,...a||{}},O={shop_url:c,...n};try{return await ue(t,`${w}${e}`,{id:r,query:O,data:i,headers:S})}catch(b){if(l&&b instanceof pr&&b.status===401)return l().then(E=>{if(E)return ue(t,`${w}${e}`,{id:r,query:O,data:i,headers:{...S,"X-Recharge-Access-Token":E.apiToken}});throw b});throw b}}async function Ke(t,e,r={}){return ue(t,`${hh}${e}`,r)}async function ue(t,e,{id:r,query:n,data:i,headers:a}={}){let o=e.trim();if(r&&(o=[o,`${r}`.trim()].join("/")),n){let s;[o,s]=o.split("?");const h=[s,ph(n)].join("&").replace(/^&/,"");o=`${o}${h?`?${h}`:""}`}let u;i&&t!=="get"&&(u=JSON.stringify(i));const f={Accept:"application/json","Content-Type":"application/json","X-Recharge-App":"storefront-client",...a||{}},c=await fetch(o,{method:t,headers:f,body:u});let l;try{l=await c.json()}catch{}if(!c.ok)throw l&&l.error?new pr(l.error,c.status):l&&l.errors?new pr(JSON.stringify(l.errors),c.status):new pr("A connection error occurred while making the request");return l}function dh(t,e){return $("get","/addresses",{query:e},m(t,"listAddresses"))}async function yh(t,e,r){const{address:n}=await $("get","/addresses",{id:e,query:{include:r?.include}},m(t,"getAddress"));return n}async function gh(t,e){const{address:r}=await $("post","/addresses",{data:{customer_id:t.customerId?Number(t.customerId):void 0,...e}},m(t,"createAddress"));return r}async function Vn(t,e,r,n){const{address:i}=await $("put","/addresses",{id:e,data:r,query:n},m(t,"updateAddress"));return i}async function vh(t,e,r,n){return Vn(m(t,"applyDiscountToAddress"),e,{discounts:[{code:r}]},n)}async function _h(t,e,r){return Vn(m(t,"removeDiscountsFromAddress"),e,{discounts:[]},r)}function mh(t,e){return $("delete","/addresses",{id:e},m(t,"deleteAddress"))}async function wh(t,e){const{address:r}=await $("post","/addresses/merge",{data:e},m(t,"mergeAddresses"));return r}async function bh(t,e,r){const{charge:n}=await $("post",`/addresses/${e}/charges/skip`,{data:r},m(t,"skipFutureCharge"));return n}var $h=Object.freeze({__proto__:null,applyDiscountToAddress:vh,createAddress:gh,deleteAddress:mh,getAddress:yh,listAddresses:dh,mergeAddresses:wh,removeDiscountsFromAddress:_h,skipFutureCharge:bh,updateAddress:Vn});async function Eh(){const{storefrontAccessToken:t}=W(),e={};t&&(e["X-Recharge-Storefront-Access-Token"]=t);const r=await Ke("get","/access",{headers:e});return{apiToken:r.api_token,customerId:r.customer_id,message:r.message}}async function Ah(t,e){return eo(t,e)}async function eo(t,e){const{storeIdentifier:r}=W(),{api_token:n,customer_id:i,message:a}=await Et("post","/shopify_storefront_access",{data:{customer_token:e,storefront_token:t,shop_url:r}});return n?{apiToken:n,customerId:i,message:a}:null}async function Sh(t){const{storeIdentifier:e}=W(),{api_token:r,customer_id:n,message:i}=await Et("post","/shopify_customer_account_api_access",{data:{customer_token:t,shop_url:e}});return r?{apiToken:r,customerId:n,message:i}:null}async function Oh(t,e={}){const{storeIdentifier:r}=W(),n=await Et("post","/attempt_login",{data:{email:t,shop:r,...e}});if(n.errors)throw new Error(n.errors);return n.session_token}async function Ih(t,e={}){const{storefrontAccessToken:r}=W(),n={};r&&(n["X-Recharge-Storefront-Access-Token"]=r);const i=await Ke("post","/attempt_login",{data:{email:t,...e},headers:n});if(i.errors)throw new Error(i.errors);return i.session_token}async function xh(t,e,r){const{storeIdentifier:n}=W(),i=await Et("post","/validate_login",{data:{code:r,email:t,session_token:e,shop:n}});if(i.errors)throw new Error(i.errors);return{apiToken:i.api_token,customerId:i.customer_id}}async function Ph(t,e,r){const{storefrontAccessToken:n}=W(),i={};n&&(i["X-Recharge-Storefront-Access-Token"]=n);const a=await Ke("post","/validate_login",{data:{code:r,email:t,session_token:e},headers:i});if(a.errors)throw new Error(a.errors);return{apiToken:a.api_token,customerId:a.customer_id}}function Th(){const{customerHash:t}=W(),{pathname:e,search:r}=window.location,n=new URLSearchParams(r).get("token"),i=e.split("/").filter(Boolean),a=i.findIndex(u=>u==="portal"),o=a!==-1?i[a+1]:t;if(!n||!o)throw new Error("Not in context of Recharge Customer Portal or URL did not contain correct params");return{customerHash:o,token:n}}async function Rh(){const{customerHash:t,token:e}=Th(),{storeIdentifier:r}=W(),n=await Et("post",`/customers/${t}/access`,{data:{token:e,shop:r}});return{apiToken:n.api_token,customerId:n.customer_id}}async function Et(t,e,{id:r,query:n,data:i,headers:a}={}){const{environment:o,environmentUri:u,storefrontAccessToken:f,appName:c,appVersion:l}=W(),s=ch(o,u),h={...f?{"X-Recharge-Storefront-Access-Token":f}:{},...c?{"X-Recharge-Sdk-App-Name":c}:{},...l?{"X-Recharge-Sdk-App-Version":l}:{},"X-Recharge-Sdk-Version":"1.28.0",...a||{}};return ue(t,`${s}${e}`,{id:r,query:n,data:i,headers:h})}var Fh=Object.freeze({__proto__:null,loginCustomerPortal:Rh,loginShopifyApi:Ah,loginShopifyAppProxy:Eh,loginWithShopifyCustomerAccount:Sh,loginWithShopifyStorefront:eo,sendPasswordlessCode:Oh,sendPasswordlessCodeAppProxy:Ih,validatePasswordlessCode:xh,validatePasswordlessCodeAppProxy:Ph}),to={},Gn={},se={},Mh=typeof U=="object"&&U&&U.Object===Object&&U,ro=Mh,Ch=ro,Nh=typeof self=="object"&&self&&self.Object===Object&&self,Bh=Ch||Nh||Function("return this")(),fe=Bh,Dh=fe,Uh=Dh.Symbol,yr=Uh,no=yr,io=Object.prototype,Lh=io.hasOwnProperty,kh=io.toString,At=no?no.toStringTag:void 0;function qh(t){var e=Lh.call(t,At),r=t[At];try{t[At]=void 0;var n=!0}catch{}var i=kh.call(t);return n&&(e?t[At]=r:delete t[At]),i}var jh=qh,Vh=Object.prototype,Gh=Vh.toString;function Hh(t){return Gh.call(t)}var Wh=Hh,ao=yr,Xh=jh,zh=Wh,Yh="[object Null]",Kh="[object Undefined]",oo=ao?ao.toStringTag:void 0;function Zh(t){return t==null?t===void 0?Kh:Yh:oo&&oo in Object(t)?Xh(t):zh(t)}var ge=Zh;function Jh(t){return t!=null&&typeof t=="object"}var ve=Jh,Qh=ge,ep=ve,tp="[object Number]";function rp(t){return typeof t=="number"||ep(t)&&Qh(t)==tp}var gr=rp,C={};function np(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Ze=np,ip=ge,ap=Ze,op="[object AsyncFunction]",up="[object Function]",sp="[object GeneratorFunction]",fp="[object Proxy]";function cp(t){if(!ap(t))return!1;var e=ip(t);return e==up||e==sp||e==op||e==fp}var Hn=cp,lp=fe,hp=lp["__core-js_shared__"],pp=hp,Wn=pp,uo=function(){var t=/[^.]+$/.exec(Wn&&Wn.keys&&Wn.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function dp(t){return!!uo&&uo in t}var yp=dp,gp=Function.prototype,vp=gp.toString;function _p(t){if(t!=null){try{return vp.call(t)}catch{}try{return t+""}catch{}}return""}var so=_p,mp=Hn,wp=yp,bp=Ze,$p=so,Ep=/[\\^$.*+?()[\]{}|]/g,Ap=/^\[object .+?Constructor\]$/,Sp=Function.prototype,Op=Object.prototype,Ip=Sp.toString,xp=Op.hasOwnProperty,Pp=RegExp("^"+Ip.call(xp).replace(Ep,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Tp(t){if(!bp(t)||wp(t))return!1;var e=mp(t)?Pp:Ap;return e.test($p(t))}var Rp=Tp;function Fp(t,e){return t?.[e]}var Mp=Fp,Cp=Rp,Np=Mp;function Bp(t,e){var r=Np(t,e);return Cp(r)?r:void 0}var Fe=Bp,Dp=Fe,Up=function(){try{var t=Dp(Object,"defineProperty");return t({},"",{}),t}catch{}}(),fo=Up,co=fo;function Lp(t,e,r){e=="__proto__"&&co?co(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var lo=Lp;function kp(t,e){return t===e||t!==t&&e!==e}var vr=kp,qp=lo,jp=vr,Vp=Object.prototype,Gp=Vp.hasOwnProperty;function Hp(t,e,r){var n=t[e];(!(Gp.call(t,e)&&jp(n,r))||r===void 0&&!(e in t))&&qp(t,e,r)}var Wp=Hp,Xp=Wp,zp=lo;function Yp(t,e,r,n){var i=!r;r||(r={});for(var a=-1,o=e.length;++a<o;){var u=e[a],f=n?n(r[u],t[u],u,r,t):void 0;f===void 0&&(f=t[u]),i?zp(r,u,f):Xp(r,u,f)}return r}var Kp=Yp;function Zp(t){return t}var _r=Zp;function Jp(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var Qp=Jp,ed=Qp,ho=Math.max;function td(t,e,r){return e=ho(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,a=ho(n.length-e,0),o=Array(a);++i<a;)o[i]=n[e+i];i=-1;for(var u=Array(e+1);++i<e;)u[i]=n[i];return u[e]=r(o),ed(t,this,u)}}var rd=td;function nd(t){return function(){return t}}var id=nd,ad=id,po=fo,od=_r,ud=po?function(t,e){return po(t,"toString",{configurable:!0,enumerable:!1,value:ad(e),writable:!0})}:od,sd=ud,fd=800,cd=16,ld=Date.now;function hd(t){var e=0,r=0;return function(){var n=ld(),i=cd-(n-r);if(r=n,i>0){if(++e>=fd)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var pd=hd,dd=sd,yd=pd,gd=yd(dd),vd=gd,_d=_r,md=rd,wd=vd;function bd(t,e){return wd(md(t,e,_d),t+"")}var $d=bd,Ed=9007199254740991;function Ad(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Ed}var Xn=Ad,Sd=Hn,Od=Xn;function Id(t){return t!=null&&Od(t.length)&&!Sd(t)}var St=Id,xd=9007199254740991,Pd=/^(?:0|[1-9]\d*)$/;function Td(t,e){var r=typeof t;return e=e??xd,!!e&&(r=="number"||r!="symbol"&&Pd.test(t))&&t>-1&&t%1==0&&t<e}var zn=Td,Rd=vr,Fd=St,Md=zn,Cd=Ze;function Nd(t,e,r){if(!Cd(r))return!1;var n=typeof e;return(n=="number"?Fd(r)&&Md(e,r.length):n=="string"&&e in r)?Rd(r[e],t):!1}var yo=Nd,Bd=$d,Dd=yo;function Ud(t){return Bd(function(e,r){var n=-1,i=r.length,a=i>1?r[i-1]:void 0,o=i>2?r[2]:void 0;for(a=t.length>3&&typeof a=="function"?(i--,a):void 0,o&&Dd(r[0],r[1],o)&&(a=i<3?void 0:a,i=1),e=Object(e);++n<i;){var u=r[n];u&&t(e,u,n,a)}return e})}var Ld=Ud;function kd(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var go=kd,qd=ge,jd=ve,Vd="[object Arguments]";function Gd(t){return jd(t)&&qd(t)==Vd}var Hd=Gd,vo=Hd,Wd=ve,_o=Object.prototype,Xd=_o.hasOwnProperty,zd=_o.propertyIsEnumerable,Yd=vo(function(){return arguments}())?vo:function(t){return Wd(t)&&Xd.call(t,"callee")&&!zd.call(t,"callee")},mo=Yd,Kd=Array.isArray,V=Kd,mr={exports:{}};function Zd(){return!1}var Jd=Zd;mr.exports,function(t,e){var r=fe,n=Jd,i=e&&!e.nodeType&&e,a=i&&!0&&t&&!t.nodeType&&t,o=a&&a.exports===i,u=o?r.Buffer:void 0,f=u?u.isBuffer:void 0,c=f||n;t.exports=c}(mr,mr.exports);var wo=mr.exports,Qd=ge,ey=Xn,ty=ve,ry="[object Arguments]",ny="[object Array]",iy="[object Boolean]",ay="[object Date]",oy="[object Error]",uy="[object Function]",sy="[object Map]",fy="[object Number]",cy="[object Object]",ly="[object RegExp]",hy="[object Set]",py="[object String]",dy="[object WeakMap]",yy="[object ArrayBuffer]",gy="[object DataView]",vy="[object Float32Array]",_y="[object Float64Array]",my="[object Int8Array]",wy="[object Int16Array]",by="[object Int32Array]",$y="[object Uint8Array]",Ey="[object Uint8ClampedArray]",Ay="[object Uint16Array]",Sy="[object Uint32Array]",R={};R[vy]=R[_y]=R[my]=R[wy]=R[by]=R[$y]=R[Ey]=R[Ay]=R[Sy]=!0,R[ry]=R[ny]=R[yy]=R[iy]=R[gy]=R[ay]=R[oy]=R[uy]=R[sy]=R[fy]=R[cy]=R[ly]=R[hy]=R[py]=R[dy]=!1;function Oy(t){return ty(t)&&ey(t.length)&&!!R[Qd(t)]}var Iy=Oy;function xy(t){return function(e){return t(e)}}var Py=xy,wr={exports:{}};wr.exports,function(t,e){var r=ro,n=e&&!e.nodeType&&e,i=n&&!0&&t&&!t.nodeType&&t,a=i&&i.exports===n,o=a&&r.process,u=function(){try{var f=i&&i.require&&i.require("util").types;return f||o&&o.binding&&o.binding("util")}catch{}}();t.exports=u}(wr,wr.exports);var Ty=wr.exports,Ry=Iy,Fy=Py,bo=Ty,$o=bo&&bo.isTypedArray,My=$o?Fy($o):Ry,Eo=My,Cy=go,Ny=mo,By=V,Dy=wo,Uy=zn,Ly=Eo,ky=Object.prototype,qy=ky.hasOwnProperty;function jy(t,e){var r=By(t),n=!r&&Ny(t),i=!r&&!n&&Dy(t),a=!r&&!n&&!i&&Ly(t),o=r||n||i||a,u=o?Cy(t.length,String):[],f=u.length;for(var c in t)(e||qy.call(t,c))&&!(o&&(c=="length"||i&&(c=="offset"||c=="parent")||a&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Uy(c,f)))&&u.push(c);return u}var Ao=jy,Vy=Object.prototype;function Gy(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Vy;return t===r}var So=Gy;function Hy(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Wy=Hy,Xy=Ze,zy=So,Yy=Wy,Ky=Object.prototype,Zy=Ky.hasOwnProperty;function Jy(t){if(!Xy(t))return Yy(t);var e=zy(t),r=[];for(var n in t)n=="constructor"&&(e||!Zy.call(t,n))||r.push(n);return r}var Qy=Jy,eg=Ao,tg=Qy,rg=St;function ng(t){return rg(t)?eg(t,!0):tg(t)}var ig=ng,ag=Kp,og=Ld,ug=ig,sg=og(function(t,e){ag(e,ug(e),t)}),fg=sg,cg=fg,br={},Me={};function lg(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(!e(t[r],r,t))return!1;return!0}var hg=lg;function pg(t){return function(e,r,n){for(var i=-1,a=Object(e),o=n(e),u=o.length;u--;){var f=o[t?u:++i];if(r(a[f],f,a)===!1)break}return e}}var dg=pg,yg=dg,gg=yg(),vg=gg;function _g(t,e){return function(r){return t(e(r))}}var mg=_g,wg=mg,bg=wg(Object.keys,Object),$g=bg,Eg=So,Ag=$g,Sg=Object.prototype,Og=Sg.hasOwnProperty;function Ig(t){if(!Eg(t))return Ag(t);var e=[];for(var r in Object(t))Og.call(t,r)&&r!="constructor"&&e.push(r);return e}var xg=Ig,Pg=Ao,Tg=xg,Rg=St;function Fg(t){return Rg(t)?Pg(t):Tg(t)}var $r=Fg,Mg=vg,Cg=$r;function Ng(t,e){return t&&Mg(t,e,Cg)}var Bg=Ng,Dg=St;function Ug(t,e){return function(r,n){if(r==null)return r;if(!Dg(r))return t(r,n);for(var i=r.length,a=e?i:-1,o=Object(r);(e?a--:++a<i)&&n(o[a],a,o)!==!1;);return r}}var Lg=Ug,kg=Bg,qg=Lg,jg=qg(kg),Yn=jg,Vg=Yn;function Gg(t,e){var r=!0;return Vg(t,function(n,i,a){return r=!!e(n,i,a),r}),r}var Hg=Gg;function Wg(){this.__data__=[],this.size=0}var Xg=Wg,zg=vr;function Yg(t,e){for(var r=t.length;r--;)if(zg(t[r][0],e))return r;return-1}var Er=Yg,Kg=Er,Zg=Array.prototype,Jg=Zg.splice;function Qg(t){var e=this.__data__,r=Kg(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():Jg.call(e,r,1),--this.size,!0}var ev=Qg,tv=Er;function rv(t){var e=this.__data__,r=tv(e,t);return r<0?void 0:e[r][1]}var nv=rv,iv=Er;function av(t){return iv(this.__data__,t)>-1}var ov=av,uv=Er;function sv(t,e){var r=this.__data__,n=uv(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var fv=sv,cv=Xg,lv=ev,hv=nv,pv=ov,dv=fv;function Je(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Je.prototype.clear=cv,Je.prototype.delete=lv,Je.prototype.get=hv,Je.prototype.has=pv,Je.prototype.set=dv;var Ar=Je,yv=Ar;function gv(){this.__data__=new yv,this.size=0}var vv=gv;function _v(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var mv=_v;function wv(t){return this.__data__.get(t)}var bv=wv;function $v(t){return this.__data__.has(t)}var Ev=$v,Av=Fe,Sv=fe,Ov=Av(Sv,"Map"),Kn=Ov,Iv=Fe,xv=Iv(Object,"create"),Sr=xv,Oo=Sr;function Pv(){this.__data__=Oo?Oo(null):{},this.size=0}var Tv=Pv;function Rv(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Fv=Rv,Mv=Sr,Cv="__lodash_hash_undefined__",Nv=Object.prototype,Bv=Nv.hasOwnProperty;function Dv(t){var e=this.__data__;if(Mv){var r=e[t];return r===Cv?void 0:r}return Bv.call(e,t)?e[t]:void 0}var Uv=Dv,Lv=Sr,kv=Object.prototype,qv=kv.hasOwnProperty;function jv(t){var e=this.__data__;return Lv?e[t]!==void 0:qv.call(e,t)}var Vv=jv,Gv=Sr,Hv="__lodash_hash_undefined__";function Wv(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Gv&&e===void 0?Hv:e,this}var Xv=Wv,zv=Tv,Yv=Fv,Kv=Uv,Zv=Vv,Jv=Xv;function Qe(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Qe.prototype.clear=zv,Qe.prototype.delete=Yv,Qe.prototype.get=Kv,Qe.prototype.has=Zv,Qe.prototype.set=Jv;var Qv=Qe,Io=Qv,e_=Ar,t_=Kn;function r_(){this.size=0,this.__data__={hash:new Io,map:new(t_||e_),string:new Io}}var n_=r_;function i_(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var a_=i_,o_=a_;function u_(t,e){var r=t.__data__;return o_(e)?r[typeof e=="string"?"string":"hash"]:r.map}var Or=u_,s_=Or;function f_(t){var e=s_(this,t).delete(t);return this.size-=e?1:0,e}var c_=f_,l_=Or;function h_(t){return l_(this,t).get(t)}var p_=h_,d_=Or;function y_(t){return d_(this,t).has(t)}var g_=y_,v_=Or;function __(t,e){var r=v_(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var m_=__,w_=n_,b_=c_,$_=p_,E_=g_,A_=m_;function et(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}et.prototype.clear=w_,et.prototype.delete=b_,et.prototype.get=$_,et.prototype.has=E_,et.prototype.set=A_;var Zn=et,S_=Ar,O_=Kn,I_=Zn,x_=200;function P_(t,e){var r=this.__data__;if(r instanceof S_){var n=r.__data__;if(!O_||n.length<x_-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new I_(n)}return r.set(t,e),this.size=r.size,this}var T_=P_,R_=Ar,F_=vv,M_=mv,C_=bv,N_=Ev,B_=T_;function tt(t){var e=this.__data__=new R_(t);this.size=e.size}tt.prototype.clear=F_,tt.prototype.delete=M_,tt.prototype.get=C_,tt.prototype.has=N_,tt.prototype.set=B_;var xo=tt,D_="__lodash_hash_undefined__";function U_(t){return this.__data__.set(t,D_),this}var L_=U_;function k_(t){return this.__data__.has(t)}var q_=k_,j_=Zn,V_=L_,G_=q_;function Ir(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new j_;++e<r;)this.add(t[e])}Ir.prototype.add=Ir.prototype.push=V_,Ir.prototype.has=G_;var H_=Ir;function W_(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}var X_=W_;function z_(t,e){return t.has(e)}var Y_=z_,K_=H_,Z_=X_,J_=Y_,Q_=1,em=2;function tm(t,e,r,n,i,a){var o=r&Q_,u=t.length,f=e.length;if(u!=f&&!(o&&f>u))return!1;var c=a.get(t),l=a.get(e);if(c&&l)return c==e&&l==t;var s=-1,h=!0,y=r&em?new K_:void 0;for(a.set(t,e),a.set(e,t);++s<u;){var w=t[s],S=e[s];if(n)var O=o?n(S,w,s,e,t,a):n(w,S,s,t,e,a);if(O!==void 0){if(O)continue;h=!1;break}if(y){if(!Z_(e,function(b,E){if(!J_(y,E)&&(w===b||i(w,b,r,n,a)))return y.push(E)})){h=!1;break}}else if(!(w===S||i(w,S,r,n,a))){h=!1;break}}return a.delete(t),a.delete(e),h}var Po=tm,rm=fe,nm=rm.Uint8Array,im=nm;function am(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}var om=am;function um(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var sm=um,To=yr,Ro=im,fm=vr,cm=Po,lm=om,hm=sm,pm=1,dm=2,ym="[object Boolean]",gm="[object Date]",vm="[object Error]",_m="[object Map]",mm="[object Number]",wm="[object RegExp]",bm="[object Set]",$m="[object String]",Em="[object Symbol]",Am="[object ArrayBuffer]",Sm="[object DataView]",Fo=To?To.prototype:void 0,Jn=Fo?Fo.valueOf:void 0;function Om(t,e,r,n,i,a,o){switch(r){case Sm:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Am:return!(t.byteLength!=e.byteLength||!a(new Ro(t),new Ro(e)));case ym:case gm:case mm:return fm(+t,+e);case vm:return t.name==e.name&&t.message==e.message;case wm:case $m:return t==e+"";case _m:var u=lm;case bm:var f=n±if(u||(u=hm),t.size!=e.size&&!f)return!1;var c=o.get(t);if(c)return c==e;n|=dm,o.set(t,e);var l=cm(u(t),u(e),n,i,a,o);return o.delete(t),l;case Em:if(Jn)return Jn.call(t)==Jn.call(e)}return!1}var Im=Om;function xm(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}var Pm=xm,Tm=Pm,Rm=V;function Fm(t,e,r){var n=e(t);return Rm(t)?n:Tm(n,r(t))}var Mm=Fm;function Cm(t,e){for(var r=-1,n=t==null?0:t.length,i=0,a=[];++r<n;){var o=t[r];e(o,r,t)&&(a[i++]=o)}return a}var Nm=Cm;function Bm(){return[]}var Dm=Bm,Um=Nm,Lm=Dm,km=Object.prototype,qm=km.propertyIsEnumerable,Mo=Object.getOwnPropertySymbols,jm=Mo?function(t){return t==null?[]:(t=Object(t),Um(Mo(t),function(e){return qm.call(t,e)}))}:Lm,Vm=jm,Gm=Mm,Hm=Vm,Wm=$r;function Xm(t){return Gm(t,Wm,Hm)}var zm=Xm,Co=zm,Ym=1,Km=Object.prototype,Zm=Km.hasOwnProperty;function Jm(t,e,r,n,i,a){var o=r&Ym,u=Co(t),f=u.length,c=Co(e),l=c.length;if(f!=l&&!o)return!1;for(var s=f;s--;){var h=u[s];if(!(o?h in e:Zm.call(e,h)))return!1}var y=a.get(t),w=a.get(e);if(y&&w)return y==e&&w==t;var S=!0;a.set(t,e),a.set(e,t);for(var O=o;++s<f;){h=u[s];var b=t[h],E=e[h];if(n)var p=o?n(E,b,h,e,t,a):n(b,E,h,t,e,a);if(!(p===void 0?b===E||i(b,E,r,n,a):p)){S=!1;break}O||(O=h=="constructor")}if(S&&!O){var I=t.constructor,T=e.constructor;I!=T&&"constructor"in t&&"constructor"in e&&!(typeof I=="function"&&I instanceof I&&typeof T=="function"&&T instanceof T)&&(S=!1)}return a.delete(t),a.delete(e),S}var Qm=Jm,ew=Fe,tw=fe,rw=ew(tw,"DataView"),nw=rw,iw=Fe,aw=fe,ow=iw(aw,"Promise"),uw=ow,sw=Fe,fw=fe,cw=sw(fw,"Set"),lw=cw,hw=Fe,pw=fe,dw=hw(pw,"WeakMap"),yw=dw,Qn=nw,ei=Kn,ti=uw,ri=lw,ni=yw,No=ge,rt=so,Bo="[object Map]",gw="[object Object]",Do="[object Promise]",Uo="[object Set]",Lo="[object WeakMap]",ko="[object DataView]",vw=rt(Qn),_w=rt(ei),mw=rt(ti),ww=rt(ri),bw=rt(ni),Ce=No;(Qn&&Ce(new Qn(new ArrayBuffer(1)))!=ko||ei&&Ce(new ei)!=Bo||ti&&Ce(ti.resolve())!=Do||ri&&Ce(new ri)!=Uo||ni&&Ce(new ni)!=Lo)&&(Ce=function(t){var e=No(t),r=e==gw?t.constructor:void 0,n=r?rt(r):"";if(n)switch(n){case vw:return ko;case _w:return Bo;case mw:return Do;case ww:return Uo;case bw:return Lo}return e});var $w=Ce,ii=xo,Ew=Po,Aw=Im,Sw=Qm,qo=$w,jo=V,Vo=wo,Ow=Eo,Iw=1,Go="[object Arguments]",Ho="[object Array]",xr="[object Object]",xw=Object.prototype,Wo=xw.hasOwnProperty;function Pw(t,e,r,n,i,a){var o=jo(t),u=jo(e),f=o?Ho:qo(t),c=u?Ho:qo(e);f=f==Go?xr:f,c=c==Go?xr:c;var l=f==xr,s=c==xr,h=f==c;if(h&&Vo(t)){if(!Vo(e))return!1;o=!0,l=!1}if(h&&!l)return a||(a=new ii),o||Ow(t)?Ew(t,e,r,n,i,a):Aw(t,e,f,r,n,i,a);if(!(r&Iw)){var y=l&&Wo.call(t,"__wrapped__"),w=s&&Wo.call(e,"__wrapped__");if(y||w){var S=y?t.value():t,O=w?e.value():e;return a||(a=new ii),i(S,O,r,n,a)}}return h?(a||(a=new ii),Sw(t,e,r,n,i,a)):!1}var Tw=Pw,Rw=Tw,Xo=ve;function zo(t,e,r,n,i){return t===e?!0:t==null||e==null||!Xo(t)&&!Xo(e)?t!==t&&e!==e:Rw(t,e,r,n,zo,i)}var Yo=zo,Fw=xo,Mw=Yo,Cw=1,Nw=2;function Bw(t,e,r,n){var i=r.length,a=i,o=!n;if(t==null)return!a;for(t=Object(t);i--;){var u=r[i];if(o&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++i<a;){u=r[i];var f=u[0],c=t[f],l=u[1];if(o&&u[2]){if(c===void 0&&!(f in t))return!1}else{var s=new Fw;if(n)var h=n(c,l,f,t,e,s);if(!(h===void 0?Mw(l,c,Cw|Nw,n,s):h))return!1}}return!0}var Dw=Bw,Uw=Ze;function Lw(t){return t===t&&!Uw(t)}var Ko=Lw,kw=Ko,qw=$r;function jw(t){for(var e=qw(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,kw(i)]}return e}var Vw=jw;function Gw(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var Zo=Gw,Hw=Dw,Ww=Vw,Xw=Zo;function zw(t){var e=Ww(t);return e.length==1&&e[0][2]?Xw(e[0][0],e[0][1]):function(r){return r===t||Hw(r,t,e)}}var Yw=zw,Kw=ge,Zw=ve,Jw="[object Symbol]";function Qw(t){return typeof t=="symbol"||Zw(t)&&Kw(t)==Jw}var Pr=Qw,e0=V,t0=Pr,r0=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n0=/^\w*$/;function i0(t,e){if(e0(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||t0(t)?!0:n0.test(t)||!r0.test(t)||e!=null&&t in Object(e)}var ai=i0,Jo=Zn,a0="Expected a function";function oi(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(a0);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=t.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(oi.Cache||Jo),r}oi.Cache=Jo;var o0=oi,u0=o0,s0=500;function f0(t){var e=u0(t,function(n){return r.size===s0&&r.clear(),n}),r=e.cache;return e}var c0=f0,l0=c0,h0=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,p0=/\\(\\)?/g,d0=l0(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(h0,function(r,n,i,a){e.push(i?a.replace(p0,"$1"):n||r)}),e}),y0=d0;function g0(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var ui=g0,Qo=yr,v0=ui,_0=V,m0=Pr,w0=1/0,eu=Qo?Qo.prototype:void 0,tu=eu?eu.toString:void 0;function ru(t){if(typeof t=="string")return t;if(_0(t))return v0(t,ru)+"";if(m0(t))return tu?tu.call(t):"";var e=t+"";return e=="0"&&1/t==-w0?"-0":e}var b0=ru,$0=b0;function E0(t){return t==null?"":$0(t)}var A0=E0,S0=V,O0=ai,I0=y0,x0=A0;function P0(t,e){return S0(t)?t:O0(t,e)?[t]:I0(x0(t))}var nu=P0,T0=Pr,R0=1/0;function F0(t){if(typeof t=="string"||T0(t))return t;var e=t+"";return e=="0"&&1/t==-R0?"-0":e}var Tr=F0,M0=nu,C0=Tr;function N0(t,e){e=M0(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[C0(e[r++])];return r&&r==n?t:void 0}var iu=N0,B0=iu;function D0(t,e,r){var n=t==null?void 0:B0(t,e);return n===void 0?r:n}var U0=D0;function L0(t,e){return t!=null&&e in Object(t)}var k0=L0,q0=nu,j0=mo,V0=V,G0=zn,H0=Xn,W0=Tr;function X0(t,e,r){e=q0(e,t);for(var n=-1,i=e.length,a=!1;++n<i;){var o=W0(e[n]);if(!(a=t!=null&&r(t,o)))break;t=t[o]}return a||++n!=i?a:(i=t==null?0:t.length,!!i&&H0(i)&&G0(o,i)&&(V0(t)||j0(t)))}var z0=X0,Y0=k0,K0=z0;function Z0(t,e){return t!=null&&K0(t,e,Y0)}var J0=Z0,Q0=Yo,eb=U0,tb=J0,rb=ai,nb=Ko,ib=Zo,ab=Tr,ob=1,ub=2;function sb(t,e){return rb(t)&&nb(e)?ib(ab(t),e):function(r){var n=eb(r,t);return n===void 0&&n===e?tb(r,t):Q0(e,n,ob|ub)}}var fb=sb;function cb(t){return function(e){return e?.[t]}}var lb=cb,hb=iu;function pb(t){return function(e){return hb(e,t)}}var db=pb,yb=lb,gb=db,vb=ai,_b=Tr;function mb(t){return vb(t)?yb(_b(t)):gb(t)}var wb=mb,bb=Yw,$b=fb,Eb=_r,Ab=V,Sb=wb;function Ob(t){return typeof t=="function"?t:t==null?Eb:typeof t=="object"?Ab(t)?$b(t[0],t[1]):bb(t):Sb(t)}var au=Ob,Ib=hg,xb=Hg,Pb=au,Tb=V,Rb=yo;function Fb(t,e,r){var n=Tb(t)?Ib:xb;return r&&Rb(t,e,r)&&(e=void 0),n(t,Pb(e))}var si=Fb;Object.defineProperty(Me,"__esModule",{value:!0}),Me.calculatePadding=Bb,Me.slicePadding=Db;var Mb=si,Cb=Nb(Mb);function Nb(t){return t&&t.__esModule?t:{default:t}}function Bb(t){switch(t%4){case 0:return 0;case 1:return 3;case 2:return 2;case 3:return 1;default:return null}}function Db(t,e){var r=t.slice(e),n=(0,Cb.default)(r.buffer(),function(i){return i===0});if(n!==!0)throw new Error("XDR Read Error: invalid padding")}Object.defineProperty(br,"__esModule",{value:!0}),br.Cursor=void 0;var Ub=function(){function t(e,r){for(var n=0;n<r.length;n++){var i=r[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),Lb=Me;function kb(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var fi=function(){function t(e){kb(this,t),e instanceof d||(e=typeof e=="number"?d.alloc(e):d.from(e)),this._setBuffer(e),this.rewind()}return Ub(t,[{key:"_setBuffer",value:function(r){this._buffer=r,this.length=r.length}},{key:"buffer",value:function(){return this._buffer}},{key:"tap",value:function(r){return r(this),this}},{key:"clone",value:function(r){var n=new this.constructor(this.buffer());return n.seek(arguments.length===0?this.tell():r),n}},{key:"tell",value:function(){return this._index}},{key:"seek",value:function(r,n){return arguments.length===1&&(n=r,r="="),r==="+"?this._index+=n:r==="-"?this._index-=n:this._index=n,this}},{key:"rewind",value:function(){return this.seek(0)}},{key:"eof",value:function(){return this.tell()===this.buffer().length}},{key:"write",value:function(r,n,i){return this.seek("+",this.buffer().write(r,this.tell(),n,i))}},{key:"fill",value:function(r,n){return arguments.length===1&&(n=this.buffer().length-this.tell()),this.buffer().fill(r,this.tell(),this.tell()+n),this.seek("+",n),this}},{key:"slice",value:function(r){arguments.length===0&&(r=this.length-this.tell());var n=new this.constructor(this.buffer().slice(this.tell(),this.tell()+r));return this.seek("+",r),n}},{key:"copyFrom",value:function(r){var n=r instanceof d?r:r.buffer();return n.copy(this.buffer(),this.tell(),0,n.length),this.seek("+",n.length),this}},{key:"concat",value:function(r){r.forEach(function(i,a){i instanceof t&&(r[a]=i.buffer())}),r.unshift(this.buffer());var n=d.concat(r);return this._setBuffer(n),this}},{key:"toString",value:function(r,n){arguments.length===0?(r="utf8",n=this.buffer().length-this.tell()):arguments.length===1&&(n=this.buffer().length-this.tell());var i=this.buffer().toString(r,this.tell(),this.tell()+n);return this.seek("+",n),i}},{key:"writeBufferPadded",value:function(r){var n=(0,Lb.calculatePadding)(r.length),i=d.alloc(n);return this.copyFrom(new t(r)).copyFrom(new t(i))}}]),t}();[[1,["readInt8","readUInt8"]],[2,["readInt16BE","readInt16LE","readUInt16BE","readUInt16LE"]],[4,["readInt32BE","readInt32LE","readUInt32BE","readUInt32LE","readFloatBE","readFloatLE"]],[8,["readDoubleBE","readDoubleLE"]]].forEach(function(t){t[1].forEach(function(e){fi.prototype[e]=function(){var n=this.buffer()[e](this.tell());return this.seek("+",t[0]),n}})}),[[1,["writeInt8","writeUInt8"]],[2,["writeInt16BE","writeInt16LE","writeUInt16BE","writeUInt16LE"]],[4,["writeInt32BE","writeInt32LE","writeUInt32BE","writeUInt32LE","writeFloatBE","writeFloatLE"]],[8,["writeDoubleBE","writeDoubleLE"]]].forEach(function(t){t[1].forEach(function(e){fi.prototype[e]=function(n){return this.buffer()[e](n,this.tell()),this.seek("+",t[0]),this}})}),br.Cursor=fi,Object.defineProperty(C,"__esModule",{value:!0}),C.default=Xb;var qb=cg,ou=su(qb),jb=Hn,Vb=su(jb),uu=br;function su(t){return t&&t.__esModule?t:{default:t}}var Gb=Math.pow(2,16),Hb={toXDR:function(e){var r=new uu.Cursor(Gb);this.write(e,r);var n=r.tell();return r.rewind(),r.slice(n).buffer()},fromXDR:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"raw",n=void 0;switch(r){case"raw":n=e;break;case"hex":n=d.from(e,"hex");break;case"base64":n=d.from(e,"base64");break;default:throw new Error("Invalid format "+r+', must be "raw", "hex", "base64"')}var i=new uu.Cursor(n),a=this.read(i);return a},validateXDR:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"raw";try{return this.fromXDR(e,r),!0}catch{return!1}}},Wb={toXDR:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"raw",r=this.constructor.toXDR(this);switch(e){case"raw":return r;case"hex":return r.toString("hex");case"base64":return r.toString("base64");default:throw new Error("Invalid format "+e+', must be "raw", "hex", "base64"')}}};function Xb(t){(0,ou.default)(t,Hb),(0,Vb.default)(t)&&(0,ou.default)(t.prototype,Wb)}Object.defineProperty(se,"__esModule",{value:!0}),se.Int=void 0;var zb=gr,fu=cu(zb),Yb=C,Kb=cu(Yb);function cu(t){return t&&t.__esModule?t:{default:t}}var Ot=se.Int={read:function(e){return e.readInt32BE()},write:function(e,r){if(!(0,fu.default)(e))throw new Error("XDR Write Error: not a number");if(Math.floor(e)!==e)throw new Error("XDR Write Error: not an integer");r.writeInt32BE(e)},isValid:function(e){return!(0,fu.default)(e)||Math.floor(e)!==e?!1:e>=Ot.MIN_VALUE&&e<=Ot.MAX_VALUE}};Ot.MAX_VALUE=Math.pow(2,31)-1,Ot.MIN_VALUE=-Math.pow(2,31),(0,Kb.default)(Ot);var Rr={};function Zb(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var lu={exports:{}};(function(t){/**
|
|
21
21
|
* @license Long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
|
|
22
22
|
* Released under the Apache License, Version 2.0
|
|
23
23
|
* see: https://github.com/dcodeIO/Long.js for details
|
|
24
24
|
*/(function(e,r){typeof Zb=="function"&&t&&t.exports?t.exports=r():(e.dcodeIO=e.dcodeIO||{}).Long=r()})(U,function(){function e(l,s,h){this.low=l|0,this.high=s|0,this.unsigned=!!h}e.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=function(s){return(s&&s.__isLong__)===!0};var r={},n={};e.fromInt=function(s,h){var y,w;return h?(s=s>>>0,0<=s&&s<256&&(w=n[s],w)?w:(y=new e(s,(s|0)<0?-1:0,!0),0<=s&&s<256&&(n[s]=y),y)):(s=s|0,-128<=s&&s<128&&(w=r[s],w)?w:(y=new e(s,s<0?-1:0,!1),-128<=s&&s<128&&(r[s]=y),y))},e.fromNumber=function(s,h){return h=!!h,isNaN(s)||!isFinite(s)?e.ZERO:!h&&s<=-f?e.MIN_VALUE:!h&&s+1>=f?e.MAX_VALUE:h&&s>=u?e.MAX_UNSIGNED_VALUE:s<0?e.fromNumber(-s,h).negate():new e(s%o|0,s/o|0,h)},e.fromBits=function(s,h,y){return new e(s,h,y)},e.fromString=function(s,h,y){if(s.length===0)throw Error("number format error: empty string");if(s==="NaN"||s==="Infinity"||s==="+Infinity"||s==="-Infinity")return e.ZERO;if(typeof h=="number"&&(y=h,h=!1),y=y||10,y<2||36<y)throw Error("radix out of range: "+y);var w;if((w=s.indexOf("-"))>0)throw Error('number format error: interior "-" character: '+s);if(w===0)return e.fromString(s.substring(1),h,y).negate();for(var S=e.fromNumber(Math.pow(y,8)),O=e.ZERO,b=0;b<s.length;b+=8){var E=Math.min(8,s.length-b),p=parseInt(s.substring(b,b+E),y);if(E<8){var I=e.fromNumber(Math.pow(y,E));O=O.multiply(I).add(e.fromNumber(p))}else O=O.multiply(S),O=O.add(e.fromNumber(p))}return O.unsigned=h,O},e.fromValue=function(s){return s instanceof e?s:typeof s=="number"?e.fromNumber(s):typeof s=="string"?e.fromString(s):new e(s.low,s.high,s.unsigned)};var i=65536,a=1<<24,o=i*i,u=o*o,f=u/2,c=e.fromInt(a);return e.ZERO=e.fromInt(0),e.UZERO=e.fromInt(0,!0),e.ONE=e.fromInt(1),e.UONE=e.fromInt(1,!0),e.NEG_ONE=e.fromInt(-1),e.MAX_VALUE=e.fromBits(-1,2147483647,!1),e.MAX_UNSIGNED_VALUE=e.fromBits(-1,-1,!0),e.MIN_VALUE=e.fromBits(0,-2147483648,!1),e.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},e.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*o+(this.low>>>0):this.high*o+(this.low>>>0)},e.prototype.toString=function(s){if(s=s||10,s<2||36<s)throw RangeError("radix out of range: "+s);if(this.isZero())return"0";var h;if(this.isNegative())if(this.equals(e.MIN_VALUE)){var y=e.fromNumber(s),w=this.divide(y);return h=w.multiply(y).subtract(this),w.toString(s)+h.toInt().toString(s)}else return"-"+this.negate().toString(s);var S=e.fromNumber(Math.pow(s,6),this.unsigned);h=this;for(var O="";;){var b=h.divide(S),E=h.subtract(b.multiply(S)).toInt()>>>0,p=E.toString(s);if(h=b,h.isZero())return p+O;for(;p.length<6;)p="0"+p;O=""+p+O}},e.prototype.getHighBits=function(){return this.high},e.prototype.getHighBitsUnsigned=function(){return this.high>>>0},e.prototype.getLowBits=function(){return this.low},e.prototype.getLowBitsUnsigned=function(){return this.low>>>0},e.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equals(e.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var s=this.high!=0?this.high:this.low,h=31;h>0&&!(s&1<<h);h--);return this.high!=0?h+33:h+1},e.prototype.isZero=function(){return this.high===0&&this.low===0},e.prototype.isNegative=function(){return!this.unsigned&&this.high<0},e.prototype.isPositive=function(){return this.unsigned||this.high>=0},e.prototype.isOdd=function(){return(this.low&1)===1},e.prototype.isEven=function(){return(this.low&1)===0},e.prototype.equals=function(s){return e.isLong(s)||(s=e.fromValue(s)),this.unsigned!==s.unsigned&&this.high>>>31===1&&s.high>>>31===1?!1:this.high===s.high&&this.low===s.low},e.eq=e.prototype.equals,e.prototype.notEquals=function(s){return!this.equals(s)},e.neq=e.prototype.notEquals,e.prototype.lessThan=function(s){return this.compare(s)<0},e.prototype.lt=e.prototype.lessThan,e.prototype.lessThanOrEqual=function(s){return this.compare(s)<=0},e.prototype.lte=e.prototype.lessThanOrEqual,e.prototype.greaterThan=function(s){return this.compare(s)>0},e.prototype.gt=e.prototype.greaterThan,e.prototype.greaterThanOrEqual=function(s){return this.compare(s)>=0},e.prototype.gte=e.prototype.greaterThanOrEqual,e.prototype.compare=function(s){if(e.isLong(s)||(s=e.fromValue(s)),this.equals(s))return 0;var h=this.isNegative(),y=s.isNegative();return h&&!y?-1:!h&&y?1:this.unsigned?s.high>>>0>this.high>>>0||s.high===this.high&&s.low>>>0>this.low>>>0?-1:1:this.subtract(s).isNegative()?-1:1},e.prototype.negate=function(){return!this.unsigned&&this.equals(e.MIN_VALUE)?e.MIN_VALUE:this.not().add(e.ONE)},e.prototype.neg=e.prototype.negate,e.prototype.add=function(s){e.isLong(s)||(s=e.fromValue(s));var h=this.high>>>16,y=this.high&65535,w=this.low>>>16,S=this.low&65535,O=s.high>>>16,b=s.high&65535,E=s.low>>>16,p=s.low&65535,I=0,T=0,F=0,_=0;return _+=S+p,F+=_>>>16,_&=65535,F+=w+E,T+=F>>>16,F&=65535,T+=y+b,I+=T>>>16,T&=65535,I+=h+O,I&=65535,e.fromBits(F<<16|_,I<<16|T,this.unsigned)},e.prototype.subtract=function(s){return e.isLong(s)||(s=e.fromValue(s)),this.add(s.negate())},e.prototype.sub=e.prototype.subtract,e.prototype.multiply=function(s){if(this.isZero()||(e.isLong(s)||(s=e.fromValue(s)),s.isZero()))return e.ZERO;if(this.equals(e.MIN_VALUE))return s.isOdd()?e.MIN_VALUE:e.ZERO;if(s.equals(e.MIN_VALUE))return this.isOdd()?e.MIN_VALUE:e.ZERO;if(this.isNegative())return s.isNegative()?this.negate().multiply(s.negate()):this.negate().multiply(s).negate();if(s.isNegative())return this.multiply(s.negate()).negate();if(this.lessThan(c)&&s.lessThan(c))return e.fromNumber(this.toNumber()*s.toNumber(),this.unsigned);var h=this.high>>>16,y=this.high&65535,w=this.low>>>16,S=this.low&65535,O=s.high>>>16,b=s.high&65535,E=s.low>>>16,p=s.low&65535,I=0,T=0,F=0,_=0;return _+=S*p,F+=_>>>16,_&=65535,F+=w*p,T+=F>>>16,F&=65535,F+=S*E,T+=F>>>16,F&=65535,T+=y*p,I+=T>>>16,T&=65535,T+=w*E,I+=T>>>16,T&=65535,T+=S*b,I+=T>>>16,T&=65535,I+=h*p+y*E+w*b+S*O,I&=65535,e.fromBits(F<<16|_,I<<16|T,this.unsigned)},e.prototype.mul=e.prototype.multiply,e.prototype.divide=function(s){if(e.isLong(s)||(s=e.fromValue(s)),s.isZero())throw new Error("division by zero");if(this.isZero())return this.unsigned?e.UZERO:e.ZERO;var h,y,w;if(this.equals(e.MIN_VALUE)){if(s.equals(e.ONE)||s.equals(e.NEG_ONE))return e.MIN_VALUE;if(s.equals(e.MIN_VALUE))return e.ONE;var S=this.shiftRight(1);return h=S.divide(s).shiftLeft(1),h.equals(e.ZERO)?s.isNegative()?e.ONE:e.NEG_ONE:(y=this.subtract(s.multiply(h)),w=h.add(y.divide(s)),w)}else if(s.equals(e.MIN_VALUE))return this.unsigned?e.UZERO:e.ZERO;if(this.isNegative())return s.isNegative()?this.negate().divide(s.negate()):this.negate().divide(s).negate();if(s.isNegative())return this.divide(s.negate()).negate();for(w=e.ZERO,y=this;y.greaterThanOrEqual(s);){h=Math.max(1,Math.floor(y.toNumber()/s.toNumber()));for(var O=Math.ceil(Math.log(h)/Math.LN2),b=O<=48?1:Math.pow(2,O-48),E=e.fromNumber(h),p=E.multiply(s);p.isNegative()||p.greaterThan(y);)h-=b,E=e.fromNumber(h,this.unsigned),p=E.multiply(s);E.isZero()&&(E=e.ONE),w=w.add(E),y=y.subtract(p)}return w},e.prototype.div=e.prototype.divide,e.prototype.modulo=function(s){return e.isLong(s)||(s=e.fromValue(s)),this.subtract(this.divide(s).multiply(s))},e.prototype.mod=e.prototype.modulo,e.prototype.not=function(){return e.fromBits(~this.low,~this.high,this.unsigned)},e.prototype.and=function(s){return e.isLong(s)||(s=e.fromValue(s)),e.fromBits(this.low&s.low,this.high&s.high,this.unsigned)},e.prototype.or=function(s){return e.isLong(s)||(s=e.fromValue(s)),e.fromBits(this.low|s.low,this.high|s.high,this.unsigned)},e.prototype.xor=function(s){return e.isLong(s)||(s=e.fromValue(s)),e.fromBits(this.low^s.low,this.high^s.high,this.unsigned)},e.prototype.shiftLeft=function(s){return e.isLong(s)&&(s=s.toInt()),(s&=63)===0?this:s<32?e.fromBits(this.low<<s,this.high<<s|this.low>>>32-s,this.unsigned):e.fromBits(0,this.low<<s-32,this.unsigned)},e.prototype.shl=e.prototype.shiftLeft,e.prototype.shiftRight=function(s){return e.isLong(s)&&(s=s.toInt()),(s&=63)===0?this:s<32?e.fromBits(this.low>>>s|this.high<<32-s,this.high>>s,this.unsigned):e.fromBits(this.high>>s-32,this.high>=0?0:-1,this.unsigned)},e.prototype.shr=e.prototype.shiftRight,e.prototype.shiftRightUnsigned=function(s){if(e.isLong(s)&&(s=s.toInt()),s&=63,s===0)return this;var h=this.high;if(s<32){var y=this.low;return e.fromBits(y>>>s|h<<32-s,h>>>s,this.unsigned)}else return s===32?e.fromBits(h,0,this.unsigned):e.fromBits(h>>>s-32,0,this.unsigned)},e.prototype.shru=e.prototype.shiftRightUnsigned,e.prototype.toSigned=function(){return this.unsigned?new e(this.low,this.high,!1):this},e.prototype.toUnsigned=function(){return this.unsigned?this:new e(this.low,this.high,!0)},e})})(lu);var hu=lu.exports;Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.Hyper=void 0;var Jb=function(){function t(e,r){for(var n=0;n<r.length;n++){var i=r[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),pu=function t(e,r,n){e===null&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,r);if(i===void 0){var a=Object.getPrototypeOf(e);return a===null?void 0:t(a,r,n)}else{if("value"in i)return i.value;var o=i.get;return o===void 0?void 0:o.call(n)}},Qb=hu,It=du(Qb),e1=C,t1=du(e1);function du(t){return t&&t.__esModule?t:{default:t}}function r1(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n1(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:t}function i1(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var xt=Rr.Hyper=function(t){i1(e,t),Jb(e,null,[{key:"read",value:function(n){var i=n.readInt32BE(),a=n.readInt32BE();return this.fromBits(a,i)}},{key:"write",value:function(n,i){if(!(n instanceof this))throw new Error("XDR Write Error: "+n+" is not a Hyper");i.writeInt32BE(n.high),i.writeInt32BE(n.low)}},{key:"fromString",value:function(n){if(!/^-?\d+$/.test(n))throw new Error("Invalid hyper string: "+n);var i=pu(e.__proto__||Object.getPrototypeOf(e),"fromString",this).call(this,n,!1);return new this(i.low,i.high)}},{key:"fromBits",value:function(n,i){var a=pu(e.__proto__||Object.getPrototypeOf(e),"fromBits",this).call(this,n,i,!1);return new this(a.low,a.high)}},{key:"isValid",value:function(n){return n instanceof this}}]);function e(r,n){return r1(this,e),n1(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,r,n,!1))}return e}(It.default);(0,t1.default)(xt),xt.MAX_VALUE=new xt(It.default.MAX_VALUE.low,It.default.MAX_VALUE.high),xt.MIN_VALUE=new xt(It.default.MIN_VALUE.low,It.default.MIN_VALUE.high);var Ne={};Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.UnsignedInt=void 0;var a1=gr,yu=gu(a1),o1=C,u1=gu(o1);function gu(t){return t&&t.__esModule?t:{default:t}}var Pt=Ne.UnsignedInt={read:function(e){return e.readUInt32BE()},write:function(e,r){if(!(0,yu.default)(e))throw new Error("XDR Write Error: not a number");if(Math.floor(e)!==e)throw new Error("XDR Write Error: not an integer");if(e<0)throw new Error("XDR Write Error: negative number "+e);r.writeUInt32BE(e)},isValid:function(e){return!(0,yu.default)(e)||Math.floor(e)!==e?!1:e>=Pt.MIN_VALUE&&e<=Pt.MAX_VALUE}};Pt.MAX_VALUE=Math.pow(2,32)-1,Pt.MIN_VALUE=0,(0,u1.default)(Pt);var Fr={};Object.defineProperty(Fr,"__esModule",{value:!0}),Fr.UnsignedHyper=void 0;var s1=function(){function t(e,r){for(var n=0;n<r.length;n++){var i=r[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),vu=function t(e,r,n){e===null&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,r);if(i===void 0){var a=Object.getPrototypeOf(e);return a===null?void 0:t(a,r,n)}else{if("value"in i)return i.value;var o=i.get;return o===void 0?void 0:o.call(n)}},f1=hu,Tt=_u(f1),c1=C,l1=_u(c1);function _u(t){return t&&t.__esModule?t:{default:t}}function h1(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function p1(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:t}function d1(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var Rt=Fr.UnsignedHyper=function(t){d1(e,t),s1(e,null,[{key:"read",value:function(n){var i=n.readInt32BE(),a=n.readInt32BE();return this.fromBits(a,i)}},{key:"write",value:function(n,i){if(!(n instanceof this))throw new Error("XDR Write Error: "+n+" is not an UnsignedHyper");i.writeInt32BE(n.high),i.writeInt32BE(n.low)}},{key:"fromString",value:function(n){if(!/^\d+$/.test(n))throw new Error("Invalid hyper string: "+n);var i=vu(e.__proto__||Object.getPrototypeOf(e),"fromString",this).call(this,n,!0);return new this(i.low,i.high)}},{key:"fromBits",value:function(n,i){var a=vu(e.__proto__||Object.getPrototypeOf(e),"fromBits",this).call(this,n,i,!0);return new this(a.low,a.high)}},{key:"isValid",value:function(n){return n instanceof this}}]);function e(r,n){return h1(this,e),p1(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,r,n,!0))}return e}(Tt.default);(0,l1.default)(Rt),Rt.MAX_VALUE=new Rt(Tt.default.MAX_UNSIGNED_VALUE.low,Tt.default.MAX_UNSIGNED_VALUE.high),Rt.MIN_VALUE=new Rt(Tt.default.MIN_VALUE.low,Tt.default.MIN_VALUE.high);var Mr={};Object.defineProperty(Mr,"__esModule",{value:!0}),Mr.Float=void 0;var y1=gr,mu=wu(y1),g1=C,v1=wu(g1);function wu(t){return t&&t.__esModule?t:{default:t}}var _1=Mr.Float={read:function(e){return e.readFloatBE()},write:function(e,r){if(!(0,mu.default)(e))throw new Error("XDR Write Error: not a number");r.writeFloatBE(e)},isValid:function(e){return(0,mu.default)(e)}};(0,v1.default)(_1);var Cr={};Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.Double=void 0;var m1=gr,bu=$u(m1),w1=C,b1=$u(w1);function $u(t){return t&&t.__esModule?t:{default:t}}var $1=Cr.Double={read:function(e){return e.readDoubleBE()},write:function(e,r){if(!(0,bu.default)(e))throw new Error("XDR Write Error: not a number");r.writeDoubleBE(e)},isValid:function(e){return(0,bu.default)(e)}};(0,b1.default)($1);var Nr={};Object.defineProperty(Nr,"__esModule",{value:!0}),Nr.Quadruple=void 0;var E1=C,A1=S1(E1);function S1(t){return t&&t.__esModule?t:{default:t}}var O1=Nr.Quadruple={read:function(){throw new Error("XDR Read Error: quadruple not supported")},write:function(){throw new Error("XDR Write Error: quadruple not supported")},isValid:function(){return!1}};(0,A1.default)(O1);var Ft={},I1=ge,x1=ve,P1="[object Boolean]";function T1(t){return t===!0||t===!1||x1(t)&&I1(t)==P1}var R1=T1;Object.defineProperty(Ft,"__esModule",{value:!0}),Ft.Bool=void 0;var F1=R1,M1=Au(F1),Eu=se,C1=C,N1=Au(C1);function Au(t){return t&&t.__esModule?t:{default:t}}var B1=Ft.Bool={read:function(e){var r=Eu.Int.read(e);switch(r){case 0:return!1;case 1:return!0;default:throw new Error("XDR Read Error: Got "+r+" when trying to read a bool")}},write:function(e,r){var n=e?1:0;return Eu.Int.write(n,r)},isValid:function(e){return(0,M1.default)(e)}};(0,N1.default)(B1);var Br={},D1=ge,U1=V,L1=ve,k1="[object String]";function q1(t){return typeof t=="string"||!U1(t)&&L1(t)&&D1(t)==k1}var Su=q1;Object.defineProperty(Br,"__esModule",{value:!0}),Br.String=void 0;var j1=function(){function t(e,r){for(var n=0;n<r.length;n++){var i=r[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),V1=Su,Ou=ci(V1),G1=V,H1=ci(G1),Iu=se,W1=Ne,xu=Me,X1=C,z1=ci(X1);function ci(t){return t&&t.__esModule?t:{default:t}}function Y1(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var K1=Br.String=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:W1.UnsignedInt.MAX_VALUE;Y1(this,t),this._maxLength=e}return j1(t,[{key:"read",value:function(r){var n=Iu.Int.read(r);if(n>this._maxLength)throw new Error("XDR Read Error: Saw "+n+" length String,"+("max allowed is "+this._maxLength));var i=(0,xu.calculatePadding)(n),a=r.slice(n);return(0,xu.slicePadding)(r,i),a.buffer()}},{key:"readString",value:function(r){return this.read(r).toString("utf8")}},{key:"write",value:function(r,n){if(r.length>this._maxLength)throw new Error("XDR Write Error: Got "+r.length+" bytes,"+("max allows is "+this._maxLength));var i=void 0;(0,Ou.default)(r)?i=d.from(r,"utf8"):i=d.from(r),Iu.Int.write(i.length,n),n.writeBufferPadded(i)}},{key:"isValid",value:function(r){var n=void 0;if((0,Ou.default)(r))n=d.from(r,"utf8");else if((0,H1.default)(r)||d.isBuffer(r))n=d.from(r);else return!1;return n.length<=this._maxLength}}]),t}();(0,z1.default)(K1.prototype);var Dr={};Object.defineProperty(Dr,"__esModule",{value:!0}),Dr.Opaque=void 0;var Z1=function(){function t(e,r){for(var n=0;n<r.length;n++){var i=r[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),Pu=Me,J1=C,Q1=e$(J1);function e$(t){return t&&t.__esModule?t:{default:t}}function t$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r$=Dr.Opaque=function(){function t(e){t$(this,t),this._length=e,this._padding=(0,Pu.calculatePadding)(e)}return Z1(t,[{key:"read",value:function(r){var n=r.slice(this._length);return(0,Pu.slicePadding)(r,this._padding),n.buffer()}},{key:"write",value:function(r,n){if(r.length!==this._length)throw new Error("XDR Write Error: Got "+r.length+" bytes, expected "+this._length);n.writeBufferPadded(r)}},{key:"isValid",value:function(r){return d.isBuffer(r)&&r.length===this._length}}]),t}();(0,Q1.default)(r$.prototype);var Ur={};Object.defineProperty(Ur,"__esModule",{value:!0}),Ur.VarOpaque=void 0;var n$=function(){function t(e,r){for(var n=0;n<r.length;n++){var i=r[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),Tu=se,i$=Ne,Ru=Me,a$=C,o$=u$(a$);function u$(t){return t&&t.__esModule?t:{default:t}}function s$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var f$=Ur.VarOpaque=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:i$.UnsignedInt.MAX_VALUE;s$(this,t),this._maxLength=e}return n$(t,[{key:"read",value:function(r){var n=Tu.Int.read(r);if(n>this._maxLength)throw new Error("XDR Read Error: Saw "+n+" length VarOpaque,"+("max allowed is "+this._maxLength));var i=(0,Ru.calculatePadding)(n),a=r.slice(n);return(0,Ru.slicePadding)(r,i),a.buffer()}},{key:"write",value:function(r,n){if(r.length>this._maxLength)throw new Error("XDR Write Error: Got "+r.length+" bytes,"+("max allows is "+this._maxLength));Tu.Int.write(r.length,n),n.writeBufferPadded(r)}},{key:"isValid",value:function(r){return d.isBuffer(r)&&r.length<=this._maxLength}}]),t}();(0,o$.default)(f$.prototype);var Lr={};function c$(t,e){for(var r=-1,n=t==null?0:t.length;++r<n&&e(t[r],r,t)!==!1;);return t}var l$=c$,h$=_r;function p$(t){return typeof t=="function"?t:h$}var Fu=p$,d$=l$,y$=Yn,g$=Fu,v$=V;function _$(t,e){var r=v$(t)?d$:y$;return r(t,g$(e))}var m$=_$,nt=m$,w$=/\s/;function b$(t){for(var e=t.length;e--&&w$.test(t.charAt(e)););return e}var $$=b$,E$=$$,A$=/^\s+/;function S$(t){return t&&t.slice(0,E$(t)+1).replace(A$,"")}var O$=S$,I$=O$,Mu=Ze,x$=Pr,Cu=0/0,P$=/^[-+]0x[0-9a-f]+$/i,T$=/^0b[01]+$/i,R$=/^0o[0-7]+$/i,F$=parseInt;function M$(t){if(typeof t=="number")return t;if(x$(t))return Cu;if(Mu(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Mu(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=I$(t);var r=T$.test(t);return r||R$.test(t)?F$(t.slice(2),r?2:8):P$.test(t)?Cu:+t}var C$=M$,N$=C$,Nu=1/0,B$=17976931348623157e292;function D$(t){if(!t)return t===0?t:0;if(t=N$(t),t===Nu||t===-Nu){var e=t<0?-1:1;return e*B$}return t===t?t:0}var U$=D$,L$=U$;function k$(t){var e=L$(t),r=e%1;return e===e?r?e-r:e:0}var q$=k$,j$=go,V$=Fu,G$=q$,H$=9007199254740991,li=4294967295,W$=Math.min;function X$(t,e){if(t=G$(t),t<1||t>H$)return[];var r=li,n=W$(t,li);e=V$(e),t-=li;for(var i=j$(n,e);++r<t;)e(r);return i}var Bu=X$;Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.Array=void 0;var z$=function(){function t(e,r){for(var n=0;n<r.length;n++){var i=r[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),Y$=si,K$=Mt(Y$),Z$=nt,J$=Mt(Z$),Q$=Bu,eE=Mt(Q$),tE=V,Du=Mt(tE),rE=C,nE=Mt(rE);function Mt(t){return t&&t.__esModule?t:{default:t}}function iE(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var aE=Lr.Array=function(){function t(e,r){iE(this,t),this._childType=e,this._length=r}return z$(t,[{key:"read",value:function(r){var n=this;return(0,eE.default)(this._length,function(){return n._childType.read(r)})}},{key:"write",value:function(r,n){var i=this;if(!(0,Du.default)(r))throw new Error("XDR Write Error: value is not array");if(r.length!==this._length)throw new Error("XDR Write Error: Got array of size "+r.length+","+("expected "+this._length));(0,J$.default)(r,function(a){return i._childType.write(a,n)})}},{key:"isValid",value:function(r){var n=this;return!(0,Du.default)(r)||r.length!==this._length?!1:(0,K$.default)(r,function(i){return n._childType.isValid(i)})}}]),t}();(0,nE.default)(aE.prototype);var kr={};Object.defineProperty(kr,"__esModule",{value:!0}),kr.VarArray=void 0;var oE=function(){function t(e,r){for(var n=0;n<r.length;n++){var i=r[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),uE=si,sE=Ct(uE),fE=nt,cE=Ct(fE),lE=Bu,hE=Ct(lE),pE=V,Uu=Ct(pE),dE=Ne,Lu=se,yE=C,gE=Ct(yE);function Ct(t){return t&&t.__esModule?t:{default:t}}function vE(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var _E=kr.VarArray=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:dE.UnsignedInt.MAX_VALUE;vE(this,t),this._childType=e,this._maxLength=r}return oE(t,[{key:"read",value:function(r){var n=this,i=Lu.Int.read(r);if(i>this._maxLength)throw new Error("XDR Read Error: Saw "+i+" length VarArray,"+("max allowed is "+this._maxLength));return(0,hE.default)(i,function(){return n._childType.read(r)})}},{key:"write",value:function(r,n){var i=this;if(!(0,Uu.default)(r))throw new Error("XDR Write Error: value is not array");if(r.length>this._maxLength)throw new Error("XDR Write Error: Got array of size "+r.length+","+("max allowed is "+this._maxLength));Lu.Int.write(r.length,n),(0,cE.default)(r,function(a){return i._childType.write(a,n)})}},{key:"isValid",value:function(r){var n=this;return!(0,Uu.default)(r)||r.length>this._maxLength?!1:(0,sE.default)(r,function(i){return n._childType.isValid(i)})}}]),t}();(0,gE.default)(_E.prototype);var qr={};function mE(t){return t===null}var wE=mE;function bE(t){return t===void 0}var Nt=bE;Object.defineProperty(qr,"__esModule",{value:!0}),qr.Option=void 0;var $E=function(){function t(e,r){for(var n=0;n<r.length;n++){var i=r[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),EE=wE,ku=hi(EE),AE=Nt,qu=hi(AE),ju=Ft,SE=C,OE=hi(SE);function hi(t){return t&&t.__esModule?t:{default:t}}function IE(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var xE=qr.Option=function(){function t(e){IE(this,t),this._childType=e}return $E(t,[{key:"read",value:function(r){if(ju.Bool.read(r))return this._childType.read(r)}},{key:"write",value:function(r,n){var i=!((0,ku.default)(r)||(0,qu.default)(r));ju.Bool.write(i,n),i&&this._childType.write(r,n)}},{key:"isValid",value:function(r){return(0,ku.default)(r)||(0,qu.default)(r)?!0:this._childType.isValid(r)}}]),t}();(0,OE.default)(xE.prototype);var Bt={};Object.defineProperty(Bt,"__esModule",{value:!0}),Bt.Void=void 0;var PE=Nt,Vu=Gu(PE),TE=C,RE=Gu(TE);function Gu(t){return t&&t.__esModule?t:{default:t}}var FE=Bt.Void={read:function(){},write:function(e){if(!(0,Vu.default)(e))throw new Error("XDR Write Error: trying to write value to a void slot")},isValid:function(e){return(0,Vu.default)(e)}};(0,RE.default)(FE);var jr={},ME=ui;function CE(t,e){return ME(e,function(r){return t[r]})}var NE=CE,BE=NE,DE=$r;function UE(t){return t==null?[]:BE(t,DE(t))}var LE=UE;Object.defineProperty(jr,"__esModule",{value:!0}),jr.Enum=void 0;var kE=function(){function t(e,r){for(var n=0;n<r.length;n++){var i=r[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),qE=nt,jE=pi(qE),VE=LE,GE=pi(VE),Hu=se,HE=C,WE=pi(HE);function pi(t){return t&&t.__esModule?t:{default:t}}function XE(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:t}function zE(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function Wu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var YE=jr.Enum=function(){function t(e,r){Wu(this,t),this.name=e,this.value=r}return kE(t,null,[{key:"read",value:function(r){var n=Hu.Int.read(r);if(!this._byValue.has(n))throw new Error("XDR Read Error: Unknown "+this.enumName+" member for value "+n);return this._byValue.get(n)}},{key:"write",value:function(r,n){if(!(r instanceof this))throw new Error("XDR Write Error: Unknown "+r+" is not a "+this.enumName);Hu.Int.write(r.value,n)}},{key:"isValid",value:function(r){return r instanceof this}},{key:"members",value:function(){return this._members}},{key:"values",value:function(){return(0,GE.default)(this._members)}},{key:"fromName",value:function(r){var n=this._members[r];if(!n)throw new Error(r+" is not a member of "+this.enumName);return n}},{key:"fromValue",value:function(r){var n=this._byValue.get(r);if(!n)throw new Error(r+" is not a value of any member of "+this.enumName);return n}},{key:"create",value:function(r,n,i){var a=function(o){zE(u,o);function u(){return Wu(this,u),XE(this,(u.__proto__||Object.getPrototypeOf(u)).apply(this,arguments))}return u}(t);return a.enumName=n,r.results[n]=a,a._members={},a._byValue=new Map,(0,jE.default)(i,function(o,u){var f=new a(u,o);a._members[u]=f,a._byValue.set(o,f),a[u]=function(){return f}}),a}}]),t}();(0,WE.default)(YE);var Vr={},KE=Yn,ZE=St;function JE(t,e){var r=-1,n=ZE(t)?Array(t.length):[];return KE(t,function(i,a,o){n[++r]=e(i,a,o)}),n}var QE=JE,eA=ui,tA=au,rA=QE,nA=V;function iA(t,e){var r=nA(t)?eA:rA;return r(t,tA(e))}var aA=iA;function oA(t){for(var e=-1,r=t==null?0:t.length,n={};++e<r;){var i=t[e];n[i[0]]=i[1]}return n}var uA=oA,Dt={};Object.defineProperty(Dt,"__esModule",{value:!0});var sA=function(){function t(e,r){for(var n=0;n<r.length;n++){var i=r[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function fA(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Dt.Reference=function(){function t(){fA(this,t)}return sA(t,[{key:"resolve",value:function(){throw new Error("implement resolve in child class")}}]),t}(),Object.defineProperty(Vr,"__esModule",{value:!0}),Vr.Struct=void 0;var Gr=function(){function t(e,r){var n=[],i=!0,a=!1,o=void 0;try{for(var u=e[Symbol.iterator](),f;!(i=(f=u.next()).done)&&(n.push(f.value),!(r&&n.length===r));i=!0);}catch(c){a=!0,o=c}finally{try{!i&&u.return&&u.return()}finally{if(a)throw o}}return n}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),cA=function(){function t(e,r){for(var n=0;n<r.length;n++){var i=r[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),lA=nt,Xu=Ut(lA),hA=aA,pA=Ut(hA),dA=Nt,yA=Ut(dA),gA=uA,vA=Ut(gA),_A=Dt,mA=C,wA=Ut(mA);function Ut(t){return t&&t.__esModule?t:{default:t}}function bA(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:t}function $A(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function zu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var EA=Vr.Struct=function(){function t(e){zu(this,t),this._attributes=e||{}}return cA(t,null,[{key:"read",value:function(r){var n=(0,pA.default)(this._fields,function(i){var a=Gr(i,2),o=a[0],u=a[1],f=u.read(r);return[o,f]});return new this((0,vA.default)(n))}},{key:"write",value:function(r,n){if(!(r instanceof this))throw new Error("XDR Write Error: "+r+" is not a "+this.structName);(0,Xu.default)(this._fields,function(i){var a=Gr(i,2),o=a[0],u=a[1],f=r._attributes[o];u.write(f,n)})}},{key:"isValid",value:function(r){return r instanceof this}},{key:"create",value:function(r,n,i){var a=function(o){$A(u,o);function u(){return zu(this,u),bA(this,(u.__proto__||Object.getPrototypeOf(u)).apply(this,arguments))}return u}(t);return a.structName=n,r.results[n]=a,a._fields=i.map(function(o){var u=Gr(o,2),f=u[0],c=u[1];return c instanceof _A.Reference&&(c=c.resolve(r)),[f,c]}),(0,Xu.default)(a._fields,function(o){var u=Gr(o,1),f=u[0];a.prototype[f]=AA(f)}),a}}]),t}();(0,wA.default)(EA);function AA(t){return function(r){return(0,yA.default)(r)||(this._attributes[t]=r),this._attributes[t]}}var Hr={};Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.Union=void 0;var SA=function(){function t(e,r){var n=[],i=!0,a=!1,o=void 0;try{for(var u=e[Symbol.iterator](),f;!(i=(f=u.next()).done)&&(n.push(f.value),!(r&&n.length===r));i=!0);}catch(c){a=!0,o=c}finally{try{!i&&u.return&&u.return()}finally{if(a)throw o}}return n}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),OA=function(){function t(e,r){for(var n=0;n<r.length;n++){var i=r[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),IA=nt,Wr=zr(IA),xA=Nt,Yu=zr(xA),PA=Su,Ku=zr(PA),Xr=Bt,di=Dt,TA=C,RA=zr(TA);function zr(t){return t&&t.__esModule?t:{default:t}}function FA(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:t}function MA(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function Zu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var CA=Hr.Union=function(){function t(e,r){Zu(this,t),this.set(e,r)}return OA(t,[{key:"set",value:function(r,n){(0,Ku.default)(r)&&(r=this.constructor._switchOn.fromName(r)),this._switch=r,this._arm=this.constructor.armForSwitch(this._switch),this._armType=this.constructor.armTypeForArm(this._arm),this._value=n}},{key:"get",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this._arm;if(this._arm!==Xr.Void&&this._arm!==r)throw new Error(r+" not set");return this._value}},{key:"switch",value:function(){return this._switch}},{key:"arm",value:function(){return this._arm}},{key:"armType",value:function(){return this._armType}},{key:"value",value:function(){return this._value}}],[{key:"armForSwitch",value:function(r){if(this._switches.has(r))return this._switches.get(r);if(this._defaultArm)return this._defaultArm;throw new Error("Bad union switch: "+r)}},{key:"armTypeForArm",value:function(r){return r===Xr.Void?Xr.Void:this._arms[r]}},{key:"read",value:function(r){var n=this._switchOn.read(r),i=this.armForSwitch(n),a=this.armTypeForArm(i),o=void 0;return(0,Yu.default)(a)?o=i.read(r):o=a.read(r),new this(n,o)}},{key:"write",value:function(r,n){if(!(r instanceof this))throw new Error("XDR Write Error: "+r+" is not a "+this.unionName);this._switchOn.write(r.switch(),n),r.armType().write(r.value(),n)}},{key:"isValid",value:function(r){return r instanceof this}},{key:"create",value:function(r,n,i){var a=function(u){MA(f,u);function f(){return Zu(this,f),FA(this,(f.__proto__||Object.getPrototypeOf(f)).apply(this,arguments))}return f}(t);a.unionName=n,r.results[n]=a,i.switchOn instanceof di.Reference?a._switchOn=i.switchOn.resolve(r):a._switchOn=i.switchOn,a._switches=new Map,a._arms={},(0,Wr.default)(i.arms,function(u,f){u instanceof di.Reference&&(u=u.resolve(r)),a._arms[f]=u});var o=i.defaultArm;return o instanceof di.Reference&&(o=o.resolve(r)),a._defaultArm=o,(0,Wr.default)(i.switches,function(u){var f=SA(u,2),c=f[0],l=f[1];(0,Ku.default)(c)&&(c=a._switchOn.fromName(c)),a._switches.set(c,l)}),(0,Yu.default)(a._switchOn.values)||(0,Wr.default)(a._switchOn.values(),function(u){a[u.name]=function(f){return new a(u,f)},a.prototype[u.name]=function(c){return this.set(u,c)}}),(0,Wr.default)(a._arms,function(u,f){u!==Xr.Void&&(a.prototype[f]=function(){return this.get(f)})}),a}}]),t}();(0,RA.default)(CA),function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=se;Object.keys(e).forEach(function(p){p==="default"||p==="__esModule"||Object.defineProperty(t,p,{enumerable:!0,get:function(){return e[p]}})});var r=Rr;Object.keys(r).forEach(function(p){p==="default"||p==="__esModule"||Object.defineProperty(t,p,{enumerable:!0,get:function(){return r[p]}})});var n=Ne;Object.keys(n).forEach(function(p){p==="default"||p==="__esModule"||Object.defineProperty(t,p,{enumerable:!0,get:function(){return n[p]}})});var i=Fr;Object.keys(i).forEach(function(p){p==="default"||p==="__esModule"||Object.defineProperty(t,p,{enumerable:!0,get:function(){return i[p]}})});var a=Mr;Object.keys(a).forEach(function(p){p==="default"||p==="__esModule"||Object.defineProperty(t,p,{enumerable:!0,get:function(){return a[p]}})});var o=Cr;Object.keys(o).forEach(function(p){p==="default"||p==="__esModule"||Object.defineProperty(t,p,{enumerable:!0,get:function(){return o[p]}})});var u=Nr;Object.keys(u).forEach(function(p){p==="default"||p==="__esModule"||Object.defineProperty(t,p,{enumerable:!0,get:function(){return u[p]}})});var f=Ft;Object.keys(f).forEach(function(p){p==="default"||p==="__esModule"||Object.defineProperty(t,p,{enumerable:!0,get:function(){return f[p]}})});var c=Br;Object.keys(c).forEach(function(p){p==="default"||p==="__esModule"||Object.defineProperty(t,p,{enumerable:!0,get:function(){return c[p]}})});var l=Dr;Object.keys(l).forEach(function(p){p==="default"||p==="__esModule"||Object.defineProperty(t,p,{enumerable:!0,get:function(){return l[p]}})});var s=Ur;Object.keys(s).forEach(function(p){p==="default"||p==="__esModule"||Object.defineProperty(t,p,{enumerable:!0,get:function(){return s[p]}})});var h=Lr;Object.keys(h).forEach(function(p){p==="default"||p==="__esModule"||Object.defineProperty(t,p,{enumerable:!0,get:function(){return h[p]}})});var y=kr;Object.keys(y).forEach(function(p){p==="default"||p==="__esModule"||Object.defineProperty(t,p,{enumerable:!0,get:function(){return y[p]}})});var w=qr;Object.keys(w).forEach(function(p){p==="default"||p==="__esModule"||Object.defineProperty(t,p,{enumerable:!0,get:function(){return w[p]}})});var S=Bt;Object.keys(S).forEach(function(p){p==="default"||p==="__esModule"||Object.defineProperty(t,p,{enumerable:!0,get:function(){return S[p]}})});var O=jr;Object.keys(O).forEach(function(p){p==="default"||p==="__esModule"||Object.defineProperty(t,p,{enumerable:!0,get:function(){return O[p]}})});var b=Vr;Object.keys(b).forEach(function(p){p==="default"||p==="__esModule"||Object.defineProperty(t,p,{enumerable:!0,get:function(){return b[p]}})});var E=Hr;Object.keys(E).forEach(function(p){p==="default"||p==="__esModule"||Object.defineProperty(t,p,{enumerable:!0,get:function(){return E[p]}})})}(Gn);var Ju={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=function(){function _(g,v){for(var A=0;A<v.length;A++){var x=v[A];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(g,x.key,x)}}return function(g,v,A){return v&&_(g.prototype,v),A&&_(g,A),g}}(),r=Dt;Object.keys(r).forEach(function(_){_==="default"||_==="__esModule"||Object.defineProperty(t,_,{enumerable:!0,get:function(){return r[_]}})}),t.config=w;var n=Nt,i=l(n),a=nt,o=l(a),u=Gn,f=c(u);function c(_){if(_&&_.__esModule)return _;var g={};if(_!=null)for(var v in _)Object.prototype.hasOwnProperty.call(_,v)&&(g[v]=_[v]);return g.default=_,g}function l(_){return _&&_.__esModule?_:{default:_}}function s(_,g){if(!(_ instanceof g))throw new TypeError("Cannot call a class as a function")}function h(_,g){if(!_)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return g&&(typeof g=="object"||typeof g=="function")?g:_}function y(_,g){if(typeof g!="function"&&g!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof g);_.prototype=Object.create(g&&g.prototype,{constructor:{value:_,enumerable:!1,writable:!0,configurable:!0}}),g&&(Object.setPrototypeOf?Object.setPrototypeOf(_,g):_.__proto__=g)}function w(_){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(_){var v=new F(g);_(v),v.resolve()}return g}var S=function(_){y(g,_);function g(v){s(this,g);var A=h(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));return A.name=v,A}return e(g,[{key:"resolve",value:function(A){var x=A.definitions[this.name];return x.resolve(A)}}]),g}(r.Reference),O=function(_){y(g,_);function g(v,A){var x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;s(this,g);var M=h(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));return M.childReference=v,M.length=A,M.variable=x,M}return e(g,[{key:"resolve",value:function(A){var x=this.childReference,M=this.length;return x instanceof r.Reference&&(x=x.resolve(A)),M instanceof r.Reference&&(M=M.resolve(A)),this.variable?new f.VarArray(x,M):new f.Array(x,M)}}]),g}(r.Reference),b=function(_){y(g,_);function g(v){s(this,g);var A=h(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));return A.childReference=v,A.name=v.name,A}return e(g,[{key:"resolve",value:function(A){var x=this.childReference;return x instanceof r.Reference&&(x=x.resolve(A)),new f.Option(x)}}]),g}(r.Reference),E=function(_){y(g,_);function g(v,A){s(this,g);var x=h(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));return x.sizedType=v,x.length=A,x}return e(g,[{key:"resolve",value:function(A){var x=this.length;return x instanceof r.Reference&&(x=x.resolve(A)),new this.sizedType(x)}}]),g}(r.Reference),p=function(){function _(g,v,A){s(this,_),this.constructor=g,this.name=v,this.config=A}return e(_,[{key:"resolve",value:function(v){return this.name in v.results?v.results[this.name]:this.constructor(v,this.name,this.config)}}]),_}();function I(_,g,v){return v instanceof r.Reference&&(v=v.resolve(_)),_.results[g]=v,v}function T(_,g,v){return _.results[g]=v,v}var F=function(){function _(g){s(this,_),this._destination=g,this._definitions={}}return e(_,[{key:"enum",value:function(v,A){var x=new p(f.Enum.create,v,A);this.define(v,x)}},{key:"struct",value:function(v,A){var x=new p(f.Struct.create,v,A);this.define(v,x)}},{key:"union",value:function(v,A){var x=new p(f.Union.create,v,A);this.define(v,x)}},{key:"typedef",value:function(v,A){var x=new p(I,v,A);this.define(v,x)}},{key:"const",value:function(v,A){var x=new p(T,v,A);this.define(v,x)}},{key:"void",value:function(){return f.Void}},{key:"bool",value:function(){return f.Bool}},{key:"int",value:function(){return f.Int}},{key:"hyper",value:function(){return f.Hyper}},{key:"uint",value:function(){return f.UnsignedInt}},{key:"uhyper",value:function(){return f.UnsignedHyper}},{key:"float",value:function(){return f.Float}},{key:"double",value:function(){return f.Double}},{key:"quadruple",value:function(){return f.Quadruple}},{key:"string",value:function(v){return new E(f.String,v)}},{key:"opaque",value:function(v){return new E(f.Opaque,v)}},{key:"varOpaque",value:function(v){return new E(f.VarOpaque,v)}},{key:"array",value:function(v,A){return new O(v,A)}},{key:"varArray",value:function(v,A){return new O(v,A,!0)}},{key:"option",value:function(v){return new b(v)}},{key:"define",value:function(v,A){if((0,i.default)(this._destination[v]))this._definitions[v]=A;else throw new Error("XDRTypes Error:"+v+" is already defined")}},{key:"lookup",value:function(v){return new S(v)}},{key:"resolve",value:function(){var v=this;(0,o.default)(this._definitions,function(A){A.resolve({definitions:v._definitions,results:v._destination})})}}]),_}()})(Ju),function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Gn;Object.keys(e).forEach(function(n){n==="default"||n==="__esModule"||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})});var r=Ju;Object.keys(r).forEach(function(n){n==="default"||n==="__esModule"||Object.defineProperty(t,n,{enumerable:!0,get:function(){return r[n]}})})}(to);var yi=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},j=(t,e,r)=>(yi(t,e,"read from private field"),r?r.call(t):e.get(t)),Be=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},gi=(t,e,r,n)=>(yi(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),_e=(t,e,r)=>(yi(t,e,"access private method"),r),re,ne,Lt,vi,Qu,_i,es,Yr,mi,it,kt;function NA(t){const e={variantId:ce.Uint64.fromString(t.variantId.toString()),version:t.version||Math.floor(Date.now()/1e3),items:t.items.map(n=>new ce.BundleItem({collectionId:ce.Uint64.fromString(n.collectionId.toString()),productId:ce.Uint64.fromString(n.productId.toString()),variantId:ce.Uint64.fromString(n.variantId.toString()),sku:n.sku||"",quantity:n.quantity,ext:new ce.BundleItemExt(0)})),ext:new ce.BundleExt(0)},r=new ce.Bundle(e);return ce.BundleEnvelope.envelopeTypeBundle(r).toXDR("base64")}const ce=to.config(t=>{t.enum("EnvelopeType",{envelopeTypeBundle:0}),t.typedef("Uint32",t.uint()),t.typedef("Uint64",t.uhyper()),t.union("BundleItemExt",{switchOn:t.int(),switchName:"v",switches:[[0,t.void()]],arms:{}}),t.struct("BundleItem",[["collectionId",t.lookup("Uint64")],["productId",t.lookup("Uint64")],["variantId",t.lookup("Uint64")],["sku",t.string()],["quantity",t.lookup("Uint32")],["ext",t.lookup("BundleItemExt")]]),t.union("BundleExt",{switchOn:t.int(),switchName:"v",switches:[[0,t.void()]],arms:{}}),t.struct("Bundle",[["variantId",t.lookup("Uint64")],["items",t.varArray(t.lookup("BundleItem"),500)],["version",t.lookup("Uint32")],["ext",t.lookup("BundleExt")]]),t.union("BundleEnvelope",{switchOn:t.lookup("EnvelopeType"),switchName:"type",switches:[["envelopeTypeBundle","v1"]],arms:{v1:t.lookup("Bundle")}})});class BA{constructor(e,r){Be(this,vi),Be(this,_i),Be(this,Yr),Be(this,it),Be(this,re,void 0),Be(this,ne,void 0),Be(this,Lt,void 0),gi(this,re,_e(this,vi,Qu).call(this,r)),gi(this,Lt,_e(this,_i,es).call(this,r)),gi(this,ne,e)}isInitialDataValid(){if(!j(this,Lt))throw"Bundle data does not exist for the given product.";if(!j(this,re))throw"Bundle settings do not exist for the given product.";if(!Array.isArray(j(this,ne))||!j(this,ne).length)throw"No bundle selection items provided.";return!0}isValidVariant(e){if(!j(this,re)?.variantsSettings[e])throw`The ${e} bundle variant is invalid.`;return!0}isSelectionInVariantRange(e){const r=j(this,ne).reduce((i,a)=>i+a.quantity,0),n=j(this,re)?.variantsSettings[e].ranges||[];if(!_e(this,Yr,mi).call(this,n,r))throw"The total number of products does not fall within the required variant range.";return!0}areItemsInMaxPerItemBound(){const e=j(this,re)?.bundleSettings.maxPerItem||0,r=j(this,ne).filter(({quantity:n})=>n>e);if(e&&r.length)throw`The selected products (${_e(this,it,kt).call(this,r.map(({externalProductId:n})=>n)).join(", ")}) exceed the maximum limit of ${e} items per product.`;return!0}areSelectedCollectionsValid(e){const r=j(this,re)?.variantsSettings[e],n=j(this,ne).filter(({collectionId:i})=>!r?.optionSources[i]);if(n.length)throw`The collections (${_e(this,it,kt).call(this,n.map(({collectionId:i})=>i)).join(", ")}) are no longer valid for the bundle variant (${e}).`;return!0}areItemsQuantitiesValidForTheCollection(e){const r=j(this,ne).reduce((a,o)=>(a[o.collectionId]=o.quantity+(a[o.collectionId]||0),a),{}),n=j(this,re)?.variantsSettings[e],i=Object.values(n?.optionSources||{}).filter(a=>{const o=r[a.collectionId]||0;return!_e(this,Yr,mi).call(this,[a],o)});if(!n||i.length)throw`The selection exceeds the limits for the collections (${_e(this,it,kt).call(this,i.map(({collectionId:a})=>a)).join(", ")}).`;return!0}areSelectedProductsValid(e){const r=j(this,re)?.variantsSettings[e]?.optionSources||{},n=Object.values(r).reduce((a,o)=>{const u=j(this,Lt)?.collections[o.collectionId];return u&&(a[o.collectionId]=u),a},{});if(!Object.values(n).length)throw`No collections found for the bundle variant (${e}).`;const i=j(this,ne).filter(({externalProductId:a,collectionId:o})=>!n[o]?.products[a]);if(i.length)throw`The products (${_e(this,it,kt).call(this,i.map(({externalProductId:a})=>a)).join(", ")}) are no longer valid for the bundle product.`;return!0}isBundleSelectionValid(e){return this.isInitialDataValid(),this.isValidVariant(e),this.isSelectionInVariantRange(e),this.areItemsInMaxPerItemBound(),this.areSelectedCollectionsValid(e),this.areItemsQuantitiesValidForTheCollection(e),this.areSelectedProductsValid(e),!0}}re=new WeakMap,ne=new WeakMap,Lt=new WeakMap,vi=new WeakSet,Qu=function(t){try{const e=t.bundle_settings;return{bundleSettings:{maxPerItem:e.max_quantity_per_variant,isCustomizable:e.is_customizable},variantsSettings:e.variants.reduce((r,n)=>{if(!n.enabled)return r;let i=[{min:n.items_count,max:n.items_count}];return n.items_count||(i=n.ranges.map(({quantity_max:a,quantity_min:o})=>({min:o,max:a}))),r[n.external_variant_id]={externalVariantId:n.external_variant_id,optionSources:n.option_sources.reduce((a,o)=>(a[o.option_source_id]={min:o.quantity_min,max:o.quantity_max,collectionId:o.option_source_id},a),{}),ranges:i},r},{})}}catch{return null}},_i=new WeakSet,es=function(t){try{const e=Object.values(t.collections).reduce((r,n)=>(r[n.id]={...n,products:n.products.reduce((i,a)=>(i[a.id]=a,i),{})},r),{});return{...t,collections:e}}catch{return null}},Yr=new WeakSet,mi=function(t,e){return!!t.filter(({min:r,max:n})=>{const i=r??e,a=n??e;return i<=e&&e<=a}).length},it=new WeakSet,kt=function(t){return Array.from(new Set(t))};const ts="/bundling-storefront-manager";function DA(){return Math.ceil(Date.now()/1e3)}async function UA(){try{const{timestamp:t}=await Ke("get",`${ts}/t`);return t}catch(t){return console.error(`Fetch failed: ${t}. Using client-side date.`),DA()}}async function LA(t){const e=W(),r=await rs(t);if(r!==!0)throw new Error(r);const n=await UA(),i=NA({variantId:t.externalVariantId,version:n,items:t.selections.map(a=>({collectionId:a.collectionId,productId:a.externalProductId,variantId:a.externalVariantId,quantity:a.quantity,sku:""}))});try{const a=await Ke("post",`${ts}/api/v1/bundles`,{data:{bundle:i},headers:{Origin:`https://${e.storeIdentifier}`}});if(!a.id||a.code!==200)throw new Error(`1: failed generating rb_id: ${JSON.stringify(a)}`);return a.id}catch(a){throw new Error(`2: failed generating rb_id ${a}`)}}function kA(t,e){const r=ns(t);if(r!==!0)throw new Error(`Dynamic Bundle is invalid. ${r}`);const n=`${ji(9)}:${t.externalProductId}`;return t.selections.map(i=>{const a={id:i.externalVariantId,quantity:i.quantity,properties:{_rc_bundle:n,_rc_bundle_variant:t.externalVariantId,_rc_bundle_parent:e,_rc_bundle_collection_id:i.collectionId}};return i.sellingPlan?a.selling_plan=i.sellingPlan:i.shippingIntervalFrequency&&(a.properties.shipping_interval_frequency=i.shippingIntervalFrequency,a.properties.shipping_interval_unit_type=i.shippingIntervalUnitType,a.id=`${i.discountedVariantId}`),a})}async function rs(t){try{return t?!0:"Bundle is not defined"}catch(e){return`Error fetching bundle settings: ${e}`}}async function qA(t){try{const e=await Ke("get",`/bundle-data/${t.externalProductId}`);return{valid:new BA(t.selections,e).isBundleSelectionValid(t.externalVariantId)}}catch(e){return{valid:!1,error:String(e)}}}const jA={day:["day","days","Days"],days:["day","days","Days"],Days:["day","days","Days"],week:["week","weeks","Weeks"],weeks:["week","weeks","Weeks"],Weeks:["week","weeks","Weeks"],month:["month","months","Months"],months:["month","months","Months"],Months:["month","months","Months"]};function ns(t){if(!t)return"No bundle defined.";if(t.selections.length===0)return"No selections defined.";const{shippingIntervalFrequency:e,shippingIntervalUnitType:r}=t.selections.find(n=>n.shippingIntervalFrequency||n.shippingIntervalUnitType)||{};if(e||r){if(!e||!r)return"Shipping intervals do not match on selections.";{const n=jA[r];for(let i=0;i<t.selections.length;i++){const{shippingIntervalFrequency:a,shippingIntervalUnitType:o}=t.selections[i];if(a&&a!==e||o&&!n.includes(o))return"Shipping intervals do not match on selections."}}}return!0}async function VA(t,e){const{bundle_selection:r}=await $("get","/bundle_selections",{id:e},m(t,"getBundleSelection"));return r}function GA(t,e){return $("get","/bundle_selections",{query:e},m(t,"listBundleSelections"))}async function HA(t,e){const{bundle_selection:r}=await $("post","/bundle_selections",{data:e},m(t,"createBundleSelection"));return r}async function WA(t,e,r){const{bundle_selection:n}=await $("put","/bundle_selections",{id:e,data:r},m(t,"updateBundleSelection"));return n}function XA(t,e){return $("delete","/bundle_selections",{id:e},m(t,"deleteBundleSelection"))}async function zA(t,e,r,n){const{subscription:i}=await $("put","/bundles",{id:e,data:r,query:n},m(t,"updateBundle"));return i}var YA=Object.freeze({__proto__:null,createBundleSelection:HA,deleteBundleSelection:XA,getBundleId:LA,getBundleSelection:VA,getDynamicBundleItems:kA,listBundleSelections:GA,updateBundle:zA,updateBundleSelection:WA,validateBundle:rs,validateBundleSelection:qA,validateDynamicBundle:ns}),KA=200,wi="__lodash_hash_undefined__",ZA=1/0,is=9007199254740991,JA="[object Arguments]",QA="[object Function]",eS="[object GeneratorFunction]",tS="[object Symbol]",rS=/[\\^$.*+?()[\]{}|]/g,nS=/^\[object .+?Constructor\]$/,iS=/^(?:0|[1-9]\d*)$/,aS=typeof U=="object"&&U&&U.Object===Object&&U,oS=typeof self=="object"&&self&&self.Object===Object&&self,bi=aS||oS||Function("return this")();function uS(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function sS(t,e){var r=t?t.length:0;return!!r&&lS(t,e,0)>-1}function fS(t,e,r){for(var n=-1,i=t?t.length:0;++n<i;)if(r(e,t[n]))return!0;return!1}function as(t,e){for(var r=-1,n=t?t.length:0,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}function $i(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}function cS(t,e,r,n){for(var i=t.length,a=r+(n?1:-1);n?a--:++a<i;)if(e(t[a],a,t))return a;return-1}function lS(t,e,r){if(e!==e)return cS(t,hS,r);for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}function hS(t){return t!==t}function pS(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function dS(t){return function(e){return t(e)}}function yS(t,e){return t.has(e)}function gS(t,e){return t?.[e]}function vS(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function os(t,e){return function(r){return t(e(r))}}var _S=Array.prototype,mS=Function.prototype,Kr=Object.prototype,Ei=bi["__core-js_shared__"],us=function(){var t=/[^.]+$/.exec(Ei&&Ei.keys&&Ei.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),ss=mS.toString,at=Kr.hasOwnProperty,Ai=Kr.toString,wS=RegExp("^"+ss.call(at).replace(rS,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),fs=bi.Symbol,bS=os(Object.getPrototypeOf,Object),$S=Kr.propertyIsEnumerable,ES=_S.splice,cs=fs?fs.isConcatSpreadable:void 0,Si=Object.getOwnPropertySymbols,ls=Math.max,AS=ps(bi,"Map"),qt=ps(Object,"create");function De(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function SS(){this.__data__=qt?qt(null):{}}function OS(t){return this.has(t)&&delete this.__data__[t]}function IS(t){var e=this.__data__;if(qt){var r=e[t];return r===wi?void 0:r}return at.call(e,t)?e[t]:void 0}function xS(t){var e=this.__data__;return qt?e[t]!==void 0:at.call(e,t)}function PS(t,e){var r=this.__data__;return r[t]=qt&&e===void 0?wi:e,this}De.prototype.clear=SS,De.prototype.delete=OS,De.prototype.get=IS,De.prototype.has=xS,De.prototype.set=PS;function ot(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function TS(){this.__data__=[]}function RS(t){var e=this.__data__,r=Jr(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():ES.call(e,r,1),!0}function FS(t){var e=this.__data__,r=Jr(e,t);return r<0?void 0:e[r][1]}function MS(t){return Jr(this.__data__,t)>-1}function CS(t,e){var r=this.__data__,n=Jr(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ot.prototype.clear=TS,ot.prototype.delete=RS,ot.prototype.get=FS,ot.prototype.has=MS,ot.prototype.set=CS;function ut(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function NS(){this.__data__={hash:new De,map:new(AS||ot),string:new De}}function BS(t){return Qr(this,t).delete(t)}function DS(t){return Qr(this,t).get(t)}function US(t){return Qr(this,t).has(t)}function LS(t,e){return Qr(this,t).set(t,e),this}ut.prototype.clear=NS,ut.prototype.delete=BS,ut.prototype.get=DS,ut.prototype.has=US,ut.prototype.set=LS;function Zr(t){var e=-1,r=t?t.length:0;for(this.__data__=new ut;++e<r;)this.add(t[e])}function kS(t){return this.__data__.set(t,wi),this}function qS(t){return this.__data__.has(t)}Zr.prototype.add=Zr.prototype.push=kS,Zr.prototype.has=qS;function jS(t,e){var r=Oi(t)||ds(t)?pS(t.length,String):[],n=r.length,i=!!n;for(var a in t)(e||at.call(t,a))&&!(i&&(a=="length"||eO(a,n)))&&r.push(a);return r}function Jr(t,e){for(var r=t.length;r--;)if(uO(t[r][0],e))return r;return-1}function VS(t,e,r,n){var i=-1,a=sS,o=!0,u=t.length,f=[],c=e.length;if(!u)return f;r&&(e=as(e,dS(r))),n?(a=fS,o=!1):e.length>=KA&&(a=yS,o=!1,e=new Zr(e));e:for(;++i<u;){var l=t[i],s=r?r(l):l;if(l=n||l!==0?l:0,o&&s===s){for(var h=c;h--;)if(e[h]===s)continue e;f.push(l)}else a(e,s,n)||f.push(l)}return f}function hs(t,e,r,n,i){var a=-1,o=t.length;for(r||(r=QS),i||(i=[]);++a<o;){var u=t[a];e>0&&r(u)?e>1?hs(u,e-1,r,n,i):$i(i,u):n||(i[i.length]=u)}return i}function GS(t,e,r){var n=e(t);return Oi(t)?n:$i(n,r(t))}function HS(t){if(!Ii(t)||rO(t))return!1;var e=gs(t)||vS(t)?wS:nS;return e.test(oO(t))}function WS(t){if(!Ii(t))return iO(t);var e=nO(t),r=[];for(var n in t)n=="constructor"&&(e||!at.call(t,n))||r.push(n);return r}function XS(t,e){return t=Object(t),zS(t,e,function(r,n){return n in t})}function zS(t,e,r){for(var n=-1,i=e.length,a={};++n<i;){var o=e[n],u=t[o];r(u,o)&&(a[o]=u)}return a}function YS(t,e){return e=ls(e===void 0?t.length-1:e,0),function(){for(var r=arguments,n=-1,i=ls(r.length-e,0),a=Array(i);++n<i;)a[n]=r[e+n];n=-1;for(var o=Array(e+1);++n<e;)o[n]=r[n];return o[e]=a,uS(t,this,o)}}function KS(t){return GS(t,lO,JS)}function Qr(t,e){var r=t.__data__;return tO(e)?r[typeof e=="string"?"string":"hash"]:r.map}function ps(t,e){var r=gS(t,e);return HS(r)?r:void 0}var ZS=Si?os(Si,Object):_s,JS=Si?function(t){for(var e=[];t;)$i(e,ZS(t)),t=bS(t);return e}:_s;function QS(t){return Oi(t)||ds(t)||!!(cs&&t&&t[cs])}function eO(t,e){return e=e??is,!!e&&(typeof t=="number"||iS.test(t))&&t>-1&&t%1==0&&t<e}function tO(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function rO(t){return!!us&&us in t}function nO(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Kr;return t===r}function iO(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}function aO(t){if(typeof t=="string"||cO(t))return t;var e=t+"";return e=="0"&&1/t==-ZA?"-0":e}function oO(t){if(t!=null){try{return ss.call(t)}catch{}try{return t+""}catch{}}return""}function uO(t,e){return t===e||t!==t&&e!==e}function ds(t){return sO(t)&&at.call(t,"callee")&&(!$S.call(t,"callee")||Ai.call(t)==JA)}var Oi=Array.isArray;function ys(t){return t!=null&&fO(t.length)&&!gs(t)}function sO(t){return vs(t)&&ys(t)}function gs(t){var e=Ii(t)?Ai.call(t):"";return e==QA||e==eS}function fO(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=is}function Ii(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function vs(t){return!!t&&typeof t=="object"}function cO(t){return typeof t=="symbol"||vs(t)&&Ai.call(t)==tS}function lO(t){return ys(t)?jS(t,!0):WS(t)}var hO=YS(function(t,e){return t==null?{}:(e=as(hs(e,1),aO),XS(t,VS(KS(t),e)))});function _s(){return[]}var pO=hO,xi=be(pO);function dO(t){try{return JSON.parse(t)}catch{return t}}function yO(t){return Object.entries(t).reduce((e,[r,n])=>({...e,[r]:dO(n)}),{})}const ms=t=>typeof t=="string"?t!=="0"&&t!=="false":!!t;function ws(t){const e=yO(t),r=e.auto_inject===void 0?!0:e.auto_inject,n=e.display_on??[],i=e.first_option==="autodeliver";return{...xi(e,["display_on","first_option"]),auto_inject:r,valid_pages:n,is_subscription_first:i,autoInject:r,validPages:n,isSubscriptionFirst:i}}function bs(t){const e=t.subscription_options?.storefront_purchase_options==="subscription_only";return{...t,is_subscription_only:e,isSubscriptionOnly:e}}function gO(t){return t.map(e=>{const r={};return Object.entries(e).forEach(([n,i])=>{r[n]=bs(i)}),r})}const Pi="2020-12",vO={store_currency:{currency_code:"USD",currency_symbol:"$",decimal_separator:".",thousands_separator:",",currency_symbol_location:"left"}},jt=new Map;function en(t,e){return jt.has(t)||jt.set(t,e()),jt.get(t)}async function Ti(t,e){const r=e?.version??"2020-12",{product:n}=await en(`product.${t}.${r}`,()=>dr("get",`/product/${r}/${t}.json`));return r==="2020-12"?bs(n):n}async function $s(){return await en("storeSettings",()=>dr("get",`/${Pi}/store_settings.json`).catch(()=>vO))}async function Es(){const{widget_settings:t}=await en("widgetSettings",()=>dr("get",`/${Pi}/widget_settings.json`));return ws(t)}async function As(){const{products:t,widget_settings:e,store_settings:r,meta:n}=await en("productsAndSettings",()=>dr("get",`/product/${Pi}/products.json`));return n?.status==="error"?Promise.reject(n.message):{products:gO(t),widget_settings:ws(e),store_settings:r??{}}}async function _O(){const{products:t}=await As();return t}async function mO(t){const[e,r,n]=await Promise.all([Ti(t),$s(),Es()]);return{product:e,store_settings:r,widget_settings:n,storeSettings:r,widgetSettings:n}}async function wO(t){const{bundle_product:e}=await Ti(t);return e}async function Ss(){return Array.from(jt.keys()).forEach(t=>jt.delete(t))}var bO=Object.freeze({__proto__:null,getCDNBundleSettings:wO,getCDNProduct:Ti,getCDNProductAndSettings:mO,getCDNProducts:_O,getCDNProductsAndSettings:As,getCDNStoreSettings:$s,getCDNWidgetSettings:Es,resetCDNCache:Ss});async function $O(t,e,r){const{charge:n}=await $("get","/charges",{id:e,query:{include:r?.include}},m(t,"getCharge"));return n}function EO(t,e){return $("get","/charges",{query:e},m(t,"listCharges"))}async function AO(t,e,r){const{charge:n}=await $("post",`/charges/${e}/apply_discount`,{data:{discount_code:r}},m(t,"applyDiscountToCharge"));return n}async function SO(t,e){const{charge:r}=await $("post",`/charges/${e}/remove_discount`,{},m(t,"removeDiscountsFromCharge"));return r}async function OO(t,e,r,n){const{charge:i}=await $("post",`/charges/${e}/skip`,{query:n,data:{purchase_item_ids:r.map(a=>Number(a))}},m(t,"skipCharge"));return i}async function IO(t,e,r,n){const{charge:i}=await $("post",`/charges/${e}/unskip`,{query:n,data:{purchase_item_ids:r.map(a=>Number(a))}},m(t,"unskipCharge"));return i}async function xO(t,e){const{charge:r}=await $("post",`/charges/${e}/process`,{},m(t,"processCharge"));return r}var PO=Object.freeze({__proto__:null,applyDiscountToCharge:AO,getCharge:$O,listCharges:EO,processCharge:xO,removeDiscountsFromCharge:SO,skipCharge:OO,unskipCharge:IO});async function Os(t,e){if(!["2020-12","2022-06"].includes(e.format_version))throw new Error("Missing or unsupported format_version.");return $("get","/product_search",{query:e,headers:{"X-Recharge-Version":"2021-01"}},m(t,"productSearch"))}var TO=Object.freeze({__proto__:null,productSearch:Os});async function Is(t,e){const{collection:r}=await $("get","/collections",{id:e},m(t,"getCollection"));return r}function RO(t,e){return $("get","/collections",{query:e},m(t,"listCollections"))}async function FO(t,e,r){if(!["2020-12","2022-06"].includes(r.format_version))throw new Error("Missing or unsupported format_version.");const n=m(t,"listCollectionProducts"),[{sort_order:i,manual_sort_order:a},{products:o}]=await Promise.all([Is(n,e),Os(n,{...r,collection_ids:[e],limit:250})]);if(i==="manual")return{products:a.reduce((u,f)=>{const c=o.find(l=>l.external_product_id===f);return c&&u.push(c),u},[])};{const u=MO(i);return{products:o.slice().sort(u)}}}function xs(t,e){const r=t.external_created_at,n=e.external_created_at;return r<n?-1:n>r?1:0}function Ps(t,e){const r=t.external_product_id,n=e.external_product_id;return r<n?-1:n>r?1:0}function Ts(t,e){const r=t.title.toLowerCase(),n=e.title.toLowerCase();return r<n?-1:n>r?1:0}function MO(t){switch(t){case"created_at-asc":return xs;case"created_at-desc":return(e,r)=>xs(r,e);case"id-asc":return Ps;case"id-desc":return(e,r)=>Ps(r,e);case"title-asc":return Ts;case"title-desc":return(e,r)=>Ts(r,e)}}var CO=Object.freeze({__proto__:null,getCollection:Is,listCollectionProducts:FO,listCollections:RO});async function NO(t,e){const r=t.customerId;if(!r)throw new Error("Not logged in.");const{customer:n}=await $("get","/customers",{id:r,query:{include:e?.include}},m(t,"getCustomer"));return n}async function Rs(t,e){const r=t.customerId;if(!r)throw new Error("Not logged in.");const{customer:n}=await $("put","/customers",{id:r,data:e},m(t,"updateCustomer"));return n}async function BO(t,e){const r=t.customerId;if(!r)throw new Error("Not logged in.");const{deliveries:n}=await $("get",`/customers/${r}/delivery_schedule`,{query:e},m(t,"getDeliverySchedule"));return n}async function Ri(t,e){return $("get","/portal_access",{query:e},m(t,"getCustomerPortalAccess"))}async function DO(t,e,r){const{base_url:n,customer_hash:i,temp_token:a}=await Ri(m(t,"getActiveChurnLandingPageURL"));return`${n.replace("portal","pages")}${i}/subscriptions/${e}/cancel?token=${a}&subscription=${e}&redirect_to=${r}`}async function UO(t,e,r){const{base_url:n,customer_hash:i,temp_token:a}=await Ri(m(t,"getGiftRedemptionLandingPageURL"));return`${n.replace("portal","pages")}${i}/gifts/${e}?token=${a}&redirect_to=${r}`}const LO={SHOPIFY_UPDATE_PAYMENT_INFO:{type:"email",template_type:"shopify_update_payment_information"}};async function kO(t,e,r){const n=t.customerId;if(!n)throw new Error("Not logged in.");const i=LO[e];if(!i)throw new Error("Notification not supported.");return $("post",`/customers/${n}/notifications`,{data:{...i,template_vars:r}},m(t,"sendCustomerNotification"))}async function qO(t,e){const r=t.customerId;if(!r)throw new Error("Not logged in.");const{credit_summary:n}=await $("get",`/customers/${r}/credit_summary`,{query:{include:e?.include}},m(t,"getCreditSummary"));return n}var jO=Object.freeze({__proto__:null,getActiveChurnLandingPageURL:DO,getCreditSummary:qO,getCustomer:NO,getCustomerPortalAccess:Ri,getDeliverySchedule:BO,getGiftRedemptionLandingPageURL:UO,sendCustomerNotification:kO,updateCustomer:Rs});async function VO(t,e){const r=t.customerId;if(!r)throw new Error("Not logged in.");const{credit_summary:n}=await $("get",`/customers/${r}/credit_summary`,{query:{include:e?.include}},m(t,"getCreditSummary"));return n}function GO(t,{recurring:e}){if(!t.customerId)throw new Error("Not logged in.");const r={};return e!==void 0&&(r.apply_credit_to_next_recurring_charge=e),Rs(m(t,"setApplyCreditsToNextCharge"),r)}async function HO(t,e){const r=t.customerId;if(!r)throw new Error("Not logged in.");return await $("get","/credit_accounts",{query:{customer_id:r,...e}},m(t,"listCreditAccounts"))}var WO=Object.freeze({__proto__:null,getCreditSummary:VO,listCreditAccounts:HO,setApplyCreditsToNextCharge:GO});function XO(t,e){if(!t.customerId)throw new Error("Not logged in.");return $("get","/gift_purchases",{query:e},m(t,"listGiftPurchases"))}async function zO(t,e){if(!t.customerId)throw new Error("Not logged in.");const{gift_purchase:r}=await $("get","/gift_purchases",{id:e},m(t,"getGiftPurchase"));return r}var YO=Object.freeze({__proto__:null,getGiftPurchase:zO,listGiftPurchases:XO});async function KO(t,e){const{membership:r}=await $("get","/memberships",{id:e},m(t,"getMembership"));return r}function ZO(t,e){return $("get","/memberships",{query:e},m(t,"listMemberships"))}async function JO(t,e,r){const{membership:n}=await $("post",`/memberships/${e}/cancel`,{data:r},m(t,"cancelMembership"));return n}async function QO(t,e,r){const{membership:n}=await $("post",`/memberships/${e}/activate`,{data:r},m(t,"activateMembership"));return n}async function eI(t,e,r){const{membership:n}=await $("post",`/memberships/${e}/change`,{data:r},m(t,"changeMembership"));return n}var tI=Object.freeze({__proto__:null,activateMembership:QO,cancelMembership:JO,changeMembership:eI,getMembership:KO,listMemberships:ZO});async function rI(t,e,r){const{membership_program:n}=await $("get","/membership_programs",{id:e,query:{include:r?.include}},m(t,"getMembershipProgram"));return n}function nI(t,e){return $("get","/membership_programs",{query:e},m(t,"listMembershipPrograms"))}var iI=Object.freeze({__proto__:null,getMembershipProgram:rI,listMembershipPrograms:nI});async function aI(t,e){const{metafield:r}=await $("post","/metafields",{data:{metafield:e}},m(t,"createMetafield"));return r}async function oI(t,e,r){const{metafield:n}=await $("put","/metafields",{id:e,data:{metafield:r}},m(t,"updateMetafield"));return n}function uI(t,e){return $("delete","/metafields",{id:e},m(t,"deleteMetafield"))}var sI=Object.freeze({__proto__:null,createMetafield:aI,deleteMetafield:uI,updateMetafield:oI});async function fI(t,e){const{onetime:r}=await $("get","/onetimes",{id:e},m(t,"getOnetime"));return r}function cI(t,e){return $("get","/onetimes",{query:e},m(t,"listOnetimes"))}async function lI(t,e){const{onetime:r}=await $("post","/onetimes",{data:e},m(t,"createOnetime"));return r}async function hI(t,e,r){const{onetime:n}=await $("put","/onetimes",{id:e,data:r},m(t,"updateOnetime"));return n}function pI(t,e){return $("delete","/onetimes",{id:e},m(t,"deleteOnetime"))}var dI=Object.freeze({__proto__:null,createOnetime:lI,deleteOnetime:pI,getOnetime:fI,listOnetimes:cI,updateOnetime:hI});async function yI(t,e){const{order:r}=await $("get","/orders",{id:e},m(t,"getOrder"));return r}function gI(t,e){return $("get","/orders",{query:e},m(t,"listOrders"))}var vI=Object.freeze({__proto__:null,getOrder:yI,listOrders:gI});async function _I(t,e,r){const{payment_method:n}=await $("get","/payment_methods",{id:e,query:{include:r?.include}},m(t,"getPaymentMethod"));return n}async function mI(t,e){const{payment_method:r}=await $("post","/payment_methods",{data:{...e,customer_id:t.customerId}},m(t,"createPaymentMethod"));return r}async function wI(t,e,r){const{payment_method:n}=await $("put","/payment_methods",{id:e,data:r},m(t,"updatePaymentMethod"));return n}function bI(t,e){return $("get","/payment_methods",{query:e},m(t,"listPaymentMethods"))}var $I=Object.freeze({__proto__:null,createPaymentMethod:mI,getPaymentMethod:_I,listPaymentMethods:bI,updatePaymentMethod:wI});async function EI(t,e){const{plan:r}=await $("get","/plans",{id:e},m(t,"getPlan"));return r}function AI(t,e){return $("get","/plans",{query:e},m(t,"listPlans"))}var SI=Object.freeze({__proto__:null,getPlan:EI,listPlans:AI});async function OI(t,e){return await $("get","/shop/shipping_countries",{query:e,headers:{"X-Recharge-Version":"2021-01"}},m(t,"getShippingCountries"))}async function II(t){return await $("get","/shop/settings",{headers:{"X-Recharge-Version":"2021-01"}},m(t,"getStoreSettings"))}var xI=Object.freeze({__proto__:null,getShippingCountries:OI,getStoreSettings:II}),PI="Expected a function",Fs="__lodash_placeholder__",Ue=1,tn=2,TI=4,st=8,Vt=16,Le=32,Gt=64,Ms=128,RI=256,Cs=512,Ns=1/0,FI=9007199254740991,MI=17976931348623157e292,Bs=0/0,CI=[["ary",Ms],["bind",Ue],["bindKey",tn],["curry",st],["curryRight",Vt],["flip",Cs],["partial",Le],["partialRight",Gt],["rearg",RI]],NI="[object Function]",BI="[object GeneratorFunction]",DI="[object Symbol]",UI=/[\\^$.*+?()[\]{}|]/g,LI=/^\s+|\s+$/g,kI=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,qI=/\{\n\/\* \[wrapped with (.+)\] \*/,jI=/,? & /,VI=/^[-+]0x[0-9a-f]+$/i,GI=/^0b[01]+$/i,HI=/^\[object .+?Constructor\]$/,WI=/^0o[0-7]+$/i,XI=/^(?:0|[1-9]\d*)$/,zI=parseInt,YI=typeof U=="object"&&U&&U.Object===Object&&U,KI=typeof self=="object"&&self&&self.Object===Object&&self,Ht=YI||KI||Function("return this")();function Fi(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function ZI(t,e){for(var r=-1,n=t?t.length:0;++r<n&&e(t[r],r,t)!==!1;);return t}function JI(t,e){var r=t?t.length:0;return!!r&&e2(t,e,0)>-1}function QI(t,e,r,n){for(var i=t.length,a=r+(n?1:-1);n?a--:++a<i;)if(e(t[a],a,t))return a;return-1}function e2(t,e,r){if(e!==e)return QI(t,t2,r);for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}function t2(t){return t!==t}function r2(t,e){for(var r=t.length,n=0;r--;)t[r]===e&&n++;return n}function n2(t,e){return t?.[e]}function i2(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function Mi(t,e){for(var r=-1,n=t.length,i=0,a=[];++r<n;){var o=t[r];(o===e||o===Fs)&&(t[r]=Fs,a[i++]=r)}return a}var a2=Function.prototype,Ds=Object.prototype,Ci=Ht["__core-js_shared__"],Us=function(){var t=/[^.]+$/.exec(Ci&&Ci.keys&&Ci.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Ls=a2.toString,o2=Ds.hasOwnProperty,ks=Ds.toString,u2=RegExp("^"+Ls.call(o2).replace(UI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),s2=Object.create,ft=Math.max,f2=Math.min,qs=function(){var t=Vs(Object,"defineProperty"),e=Vs.name;return e&&e.length>2?t:void 0}();function c2(t){return ct(t)?s2(t):{}}function l2(t){if(!ct(t)||E2(t))return!1;var e=I2(t)||i2(t)?u2:HI;return e.test(S2(t))}function h2(t,e){return e=ft(e===void 0?t.length-1:e,0),function(){for(var r=arguments,n=-1,i=ft(r.length-e,0),a=Array(i);++n<i;)a[n]=r[e+n];n=-1;for(var o=Array(e+1);++n<e;)o[n]=r[n];return o[e]=a,Fi(t,this,o)}}function p2(t,e,r,n){for(var i=-1,a=t.length,o=r.length,u=-1,f=e.length,c=ft(a-o,0),l=Array(f+c),s=!n;++u<f;)l[u]=e[u];for(;++i<o;)(s||i<a)&&(l[r[i]]=t[i]);for(;c--;)l[u++]=t[i++];return l}function d2(t,e,r,n){for(var i=-1,a=t.length,o=-1,u=r.length,f=-1,c=e.length,l=ft(a-u,0),s=Array(l+c),h=!n;++i<l;)s[i]=t[i];for(var y=i;++f<c;)s[y+f]=e[f];for(;++o<u;)(h||i<a)&&(s[y+r[o]]=t[i++]);return s}function y2(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}function g2(t,e,r){var n=e&Ue,i=Wt(t);function a(){var o=this&&this!==Ht&&this instanceof a?i:t;return o.apply(n?r:this,arguments)}return a}function Wt(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var r=c2(t.prototype),n=t.apply(r,e);return ct(n)?n:r}}function v2(t,e,r){var n=Wt(t);function i(){for(var a=arguments.length,o=Array(a),u=a,f=Bi(i);u--;)o[u]=arguments[u];var c=a<3&&o[0]!==f&&o[a-1]!==f?[]:Mi(o,f);if(a-=c.length,a<r)return js(t,e,Ni,i.placeholder,void 0,o,c,void 0,void 0,r-a);var l=this&&this!==Ht&&this instanceof i?n:t;return Fi(l,this,o)}return i}function Ni(t,e,r,n,i,a,o,u,f,c){var l=e&Ms,s=e&Ue,h=e&tn,y=e&(st|Vt),w=e&Cs,S=h?void 0:Wt(t);function O(){for(var b=arguments.length,E=Array(b),p=b;p--;)E[p]=arguments[p];if(y)var I=Bi(O),T=r2(E,I);if(n&&(E=p2(E,n,i,y)),a&&(E=d2(E,a,o,y)),b-=T,y&&b<c){var F=Mi(E,I);return js(t,e,Ni,O.placeholder,r,E,F,u,f,c-b)}var _=s?r:this,g=h?_[t]:t;return b=E.length,u?E=A2(E,u):w&&b>1&&E.reverse(),l&&f<b&&(E.length=f),this&&this!==Ht&&this instanceof O&&(g=S||Wt(g)),g.apply(_,E)}return O}function _2(t,e,r,n){var i=e&Ue,a=Wt(t);function o(){for(var u=-1,f=arguments.length,c=-1,l=n.length,s=Array(l+f),h=this&&this!==Ht&&this instanceof o?a:t;++c<l;)s[c]=n[c];for(;f--;)s[c++]=arguments[++u];return Fi(h,i?r:this,s)}return o}function js(t,e,r,n,i,a,o,u,f,c){var l=e&st,s=l?o:void 0,h=l?void 0:o,y=l?a:void 0,w=l?void 0:a;e|=l?Le:Gt,e&=~(l?Gt:Le),e&TI||(e&=~(Ue|tn));var S=r(t,e,i,y,s,w,h,u,f,c);return S.placeholder=n,Gs(S,t,e)}function m2(t,e,r,n,i,a,o,u){var f=e&tn;if(!f&&typeof t!="function")throw new TypeError(PI);var c=n?n.length:0;if(c||(e&=~(Le|Gt),n=i=void 0),o=o===void 0?o:ft(Hs(o),0),u=u===void 0?u:Hs(u),c-=i?i.length:0,e&Gt){var l=n,s=i;n=i=void 0}var h=[t,e,r,n,i,l,s,a,o,u];if(t=h[0],e=h[1],r=h[2],n=h[3],i=h[4],u=h[9]=h[9]==null?f?0:t.length:ft(h[9]-c,0),!u&&e&(st|Vt)&&(e&=~(st|Vt)),!e||e==Ue)var y=g2(t,e,r);else e==st||e==Vt?y=v2(t,e,u):(e==Le||e==(Ue|Le))&&!i.length?y=_2(t,e,r,n):y=Ni.apply(void 0,h);return Gs(y,t,e)}function Bi(t){var e=t;return e.placeholder}function Vs(t,e){var r=n2(t,e);return l2(r)?r:void 0}function w2(t){var e=t.match(qI);return e?e[1].split(jI):[]}function b2(t,e){var r=e.length,n=r-1;return e[n]=(r>1?"& ":"")+e[n],e=e.join(r>2?", ":" "),t.replace(kI,`{
|
|
25
25
|
/* [wrapped with `+e+`] */
|
|
26
|
-
`)}function $2(t,e){return e=e??FI,!!e&&(typeof t=="number"||XI.test(t))&&t>-1&&t%1==0&&t<e}function E2(t){return!!Us&&Us in t}function A2(t,e){for(var r=t.length,n=f2(e.length,r),i=y2(t);n--;){var a=e[n];t[n]=$2(a,r)?i[a]:void 0}return t}var Gs=qs?function(t,e,r){var n=e+"";return qs(t,"toString",{configurable:!0,enumerable:!1,value:F2(b2(n,O2(w2(n),r)))})}:M2;function S2(t){if(t!=null){try{return Ls.call(t)}catch{}try{return t+""}catch{}}return""}function O2(t,e){return ZI(CI,function(r){var n="_."+r[0];e&r[1]&&!JI(t,n)&&t.push(n)}),t.sort()}var Di=h2(function(t,e){var r=Mi(e,Bi(Di));return m2(t,Le,void 0,e,r)});function I2(t){var e=ct(t)?ks.call(t):"";return e==NI||e==BI}function ct(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function x2(t){return!!t&&typeof t=="object"}function P2(t){return typeof t=="symbol"||x2(t)&&ks.call(t)==DI}function T2(t){if(!t)return t===0?t:0;if(t=R2(t),t===Ns||t===-Ns){var e=t<0?-1:1;return e*MI}return t===t?t:0}function Hs(t){var e=T2(t),r=e%1;return e===e?r?e-r:e:0}function R2(t){if(typeof t=="number")return t;if(P2(t))return Bs;if(ct(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=ct(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(LI,"");var r=GI.test(t);return r||WI.test(t)?zI(t.slice(2),r?2:8):VI.test(t)?Bs:+t}function F2(t){return function(){return t}}function M2(t){return t}Di.placeholder={};var C2=Di,Ws=be(C2);function N2(t,e){return{...xi(e,["address_id","external_variant_id","external_product_id","charge_interval_frequency","order_interval_frequency","price","status"]),customer_id:parseInt(t,10),shopify_variant_id:e.external_variant_id.ecommerce?parseInt(e.external_variant_id.ecommerce,10):void 0,...e.charge_interval_frequency?{charge_interval_frequency:`${e.charge_interval_frequency}`}:{},...e.order_interval_frequency?{order_interval_frequency:`${e.order_interval_frequency}`}:{},status:e.status?e.status.toUpperCase():void 0}}function B2(t,e){return{...xi(e,["external_variant_id","external_product_id","charge_interval_frequency","order_interval_frequency","price","use_external_variant_defaults"]),shopify_variant_id:e.external_variant_id?.ecommerce?parseInt(e.external_variant_id.ecommerce,10):void 0,...e.charge_interval_frequency?{charge_interval_frequency:`${e.charge_interval_frequency}`}:void 0,...e.order_interval_frequency?{order_interval_frequency:`${e.order_interval_frequency}`}:void 0,force_update:t}}function Xs(t){const{id:e,address_id:r,customer_id:n,analytics_data:i,cancellation_reason:a,cancellation_reason_comments:o,cancelled_at:u,charge_interval_frequency:f,created_at:c,expire_after_specific_number_of_charges:l,shopify_product_id:s,shopify_variant_id:h,has_queued_charges:y,is_prepaid:w,is_skippable:S,is_swappable:O,max_retries_reached:b,next_charge_scheduled_at:E,order_day_of_month:p,order_day_of_week:I,order_interval_frequency:T,order_interval_unit:F,presentment_currency:_,price:g,product_title:v,properties:A,quantity:x,sku:M,sku_override:z,status:me,updated_at:lt,variant_title:we}=t;return{id:e,address_id:r,customer_id:n,analytics_data:i,cancellation_reason:a,cancellation_reason_comments:o,cancelled_at:u,charge_interval_frequency:parseInt(f,10),created_at:c,expire_after_specific_number_of_charges:l,external_product_id:{ecommerce:`${s}`},external_variant_id:{ecommerce:`${h}`},has_queued_charges:ms(y),is_prepaid:w,is_skippable:S,is_swappable:O,max_retries_reached:ms(b),next_charge_scheduled_at:E,order_day_of_month:p,order_day_of_week:I,order_interval_frequency:parseInt(T,10),order_interval_unit:F,presentment_currency:_,price:`${g}`,product_title:v??"",properties:A,quantity:x,sku:M,sku_override:z,status:me.toLowerCase(),updated_at:lt,variant_title:we}}async function D2(t,e,r){const{subscription:n}=await $("get","/subscriptions",{id:e,query:{include:r?.include}},m(t,"getSubscription"));return n}function U2(t,e){return $("get","/subscriptions",{query:e},m(t,"listSubscriptions"))}async function L2(t,e,r){const{subscription:n}=await $("post","/subscriptions",{data:e,query:r},m(t,"createSubscription"));return n}async function k2(t,e,r,n){const{subscription:i}=await $("put","/subscriptions",{id:e,data:r,query:n},m(t,"updateSubscription"));return i}async function q2(t,e,r,n){const{subscription:i}=await $("post",`/subscriptions/${e}/set_next_charge_date`,{data:{date:r},query:n},m(t,"updateSubscriptionChargeDate"));return i}async function j2(t,e,r){const{subscription:n}=await $("post",`/subscriptions/${e}/change_address`,{data:{address_id:r}},m(t,"updateSubscriptionAddress"));return n}async function V2(t,e,r,n){const{subscription:i}=await $("post",`/subscriptions/${e}/cancel`,{data:r,query:n},m(t,"cancelSubscription"));return i}async function G2(t,e,r){const{subscription:n}=await $("post",`/subscriptions/${e}/activate`,{query:r},m(t,"activateSubscription"));return n}async function H2(t,e,r){const{charge:n}=await $("post",`/subscriptions/${e}/charges/skip`,{data:{date:r,subscription_id:`${e}`}},m(t,"skipSubscriptionCharge"));return n}async function W2(t,e,r){const{onetimes:n}=await $("post","/purchase_items/skip_gift",{data:{purchase_item_ids:e.map(Number),recipient_address:r}},m(t,"skipGiftSubscriptionCharge"));return n}async function X2(t,e,r){const n=e.length;if(n<1||n>21)throw new Error("Number of subscriptions must be between 1 and 20.");const{customerId:i}=t;if(!i)throw new Error("No customerId in session.");const a=e[0].address_id;if(!e.every(
|
|
26
|
+
`)}function $2(t,e){return e=e??FI,!!e&&(typeof t=="number"||XI.test(t))&&t>-1&&t%1==0&&t<e}function E2(t){return!!Us&&Us in t}function A2(t,e){for(var r=t.length,n=f2(e.length,r),i=y2(t);n--;){var a=e[n];t[n]=$2(a,r)?i[a]:void 0}return t}var Gs=qs?function(t,e,r){var n=e+"";return qs(t,"toString",{configurable:!0,enumerable:!1,value:F2(b2(n,O2(w2(n),r)))})}:M2;function S2(t){if(t!=null){try{return Ls.call(t)}catch{}try{return t+""}catch{}}return""}function O2(t,e){return ZI(CI,function(r){var n="_."+r[0];e&r[1]&&!JI(t,n)&&t.push(n)}),t.sort()}var Di=h2(function(t,e){var r=Mi(e,Bi(Di));return m2(t,Le,void 0,e,r)});function I2(t){var e=ct(t)?ks.call(t):"";return e==NI||e==BI}function ct(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function x2(t){return!!t&&typeof t=="object"}function P2(t){return typeof t=="symbol"||x2(t)&&ks.call(t)==DI}function T2(t){if(!t)return t===0?t:0;if(t=R2(t),t===Ns||t===-Ns){var e=t<0?-1:1;return e*MI}return t===t?t:0}function Hs(t){var e=T2(t),r=e%1;return e===e?r?e-r:e:0}function R2(t){if(typeof t=="number")return t;if(P2(t))return Bs;if(ct(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=ct(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(LI,"");var r=GI.test(t);return r||WI.test(t)?zI(t.slice(2),r?2:8):VI.test(t)?Bs:+t}function F2(t){return function(){return t}}function M2(t){return t}Di.placeholder={};var C2=Di,Ws=be(C2);function N2(t,e){return{...xi(e,["address_id","external_variant_id","external_product_id","charge_interval_frequency","order_interval_frequency","price","status"]),customer_id:parseInt(t,10),shopify_variant_id:e.external_variant_id.ecommerce?parseInt(e.external_variant_id.ecommerce,10):void 0,...e.charge_interval_frequency?{charge_interval_frequency:`${e.charge_interval_frequency}`}:{},...e.order_interval_frequency?{order_interval_frequency:`${e.order_interval_frequency}`}:{},status:e.status?e.status.toUpperCase():void 0}}function B2(t,e){return{...xi(e,["external_variant_id","external_product_id","charge_interval_frequency","order_interval_frequency","price","use_external_variant_defaults"]),shopify_variant_id:e.external_variant_id?.ecommerce?parseInt(e.external_variant_id.ecommerce,10):void 0,...e.charge_interval_frequency?{charge_interval_frequency:`${e.charge_interval_frequency}`}:void 0,...e.order_interval_frequency?{order_interval_frequency:`${e.order_interval_frequency}`}:void 0,force_update:t}}function Xs(t){const{id:e,address_id:r,customer_id:n,analytics_data:i,cancellation_reason:a,cancellation_reason_comments:o,cancelled_at:u,charge_interval_frequency:f,created_at:c,expire_after_specific_number_of_charges:l,shopify_product_id:s,shopify_variant_id:h,has_queued_charges:y,is_prepaid:w,is_skippable:S,is_swappable:O,max_retries_reached:b,next_charge_scheduled_at:E,order_day_of_month:p,order_day_of_week:I,order_interval_frequency:T,order_interval_unit:F,presentment_currency:_,price:g,product_title:v,properties:A,quantity:x,sku:M,sku_override:z,status:me,updated_at:lt,variant_title:we}=t;return{id:e,address_id:r,customer_id:n,analytics_data:i,cancellation_reason:a,cancellation_reason_comments:o,cancelled_at:u,charge_interval_frequency:parseInt(f,10),created_at:c,expire_after_specific_number_of_charges:l,external_product_id:{ecommerce:`${s}`},external_variant_id:{ecommerce:`${h}`},has_queued_charges:ms(y),is_prepaid:w,is_skippable:S,is_swappable:O,max_retries_reached:ms(b),next_charge_scheduled_at:E,order_day_of_month:p,order_day_of_week:I,order_interval_frequency:parseInt(T,10),order_interval_unit:F,presentment_currency:_,price:`${g}`,product_title:v??"",properties:A,quantity:x,sku:M,sku_override:z,status:me.toLowerCase(),updated_at:lt,variant_title:we}}async function D2(t,e,r){const{subscription:n}=await $("get","/subscriptions",{id:e,query:{include:r?.include}},m(t,"getSubscription"));return n}function U2(t,e){return $("get","/subscriptions",{query:e},m(t,"listSubscriptions"))}async function L2(t,e,r){const{subscription:n}=await $("post","/subscriptions",{data:e,query:r},m(t,"createSubscription"));return n}async function k2(t,e,r,n){const{subscription:i}=await $("put","/subscriptions",{id:e,data:r,query:n},m(t,"updateSubscription"));return i}async function q2(t,e,r,n){const{subscription:i}=await $("post",`/subscriptions/${e}/set_next_charge_date`,{data:{date:r},query:n},m(t,"updateSubscriptionChargeDate"));return i}async function j2(t,e,r){const{subscription:n}=await $("post",`/subscriptions/${e}/change_address`,{data:{address_id:r}},m(t,"updateSubscriptionAddress"));return n}async function V2(t,e,r,n){const{subscription:i}=await $("post",`/subscriptions/${e}/cancel`,{data:r,query:n},m(t,"cancelSubscription"));return i}async function G2(t,e,r){const{subscription:n}=await $("post",`/subscriptions/${e}/activate`,{query:r},m(t,"activateSubscription"));return n}async function H2(t,e,r){const{charge:n}=await $("post",`/subscriptions/${e}/charges/skip`,{data:{date:r,subscription_id:`${e}`}},m(t,"skipSubscriptionCharge"));return n}async function W2(t,e,r){const{onetimes:n}=await $("post","/purchase_items/skip_gift",{data:{purchase_item_ids:e.map(Number),recipient_address:r}},m(t,"skipGiftSubscriptionCharge"));return n}async function X2(t,e,r){const n=e.length;if(n<1||n>21)throw new Error("Number of subscriptions must be between 1 and 20.");const{customerId:i}=t;if(!i)throw new Error("No customerId in session.");const a=e[0].address_id;if(!e.every(l=>l.address_id===a))throw new Error("All subscriptions must have the same address_id.");const o=Ws(N2,i),u=e.map(o);let f;r?.allow_onetimes!==void 0&&(f={allow_onetimes:r.allow_onetimes});const{subscriptions:c}=await $("post",`/addresses/${a}/subscriptions-bulk`,{data:{subscriptions:u,commit_update:!!r?.commit},headers:{"X-Recharge-Version":"2021-01"},query:f},m(t,"createSubscriptions"));return c.map(Xs)}async function z2(t,e,r,n){const i=r.length;if(i<1||i>21)throw new Error("Number of subscriptions must be between 1 and 20.");const{customerId:a}=t;if(!a)throw new Error("No customerId in session.");const o=Ws(B2,!!n?.force_update),u=r.map(o);let f;n?.allow_onetimes!==void 0&&(f={allow_onetimes:n.allow_onetimes});const{subscriptions:c}=await $("put",`/addresses/${e}/subscriptions-bulk`,{data:{subscriptions:u,commit_update:!!n?.commit},headers:{"X-Recharge-Version":"2021-01"},query:f},m(t,"updateSubscriptions"));return c.map(Xs)}async function Y2(t,e,r,n){const i=r.length;if(i<1||i>21)throw new Error("Number of subscriptions must be between 1 and 20.");const{customerId:a}=t;if(!a)throw new Error("No customerId in session.");let o;n?.allow_onetimes!==void 0&&(o={allow_onetimes:n.allow_onetimes}),await $("delete",`/addresses/${e}/subscriptions-bulk`,{data:{subscriptions:r,send_email:!!n?.send_email,commit_update:!!n?.commit},headers:{"X-Recharge-Version":"2021-01"},query:o},m(t,"deleteSubscriptions"))}var K2=Object.freeze({__proto__:null,activateSubscription:G2,cancelSubscription:V2,createSubscription:L2,createSubscriptions:X2,deleteSubscriptions:Y2,getSubscription:D2,listSubscriptions:U2,skipGiftSubscriptionCharge:W2,skipSubscriptionCharge:H2,updateSubscription:k2,updateSubscriptionAddress:j2,updateSubscriptionChargeDate:q2,updateSubscriptions:z2});const Z2={get(t,e){return ue("get",t,e)},post(t,e){return ue("post",t,e)},put(t,e){return ue("put",t,e)},delete(t,e){return ue("delete",t,e)}};function J2(t){if(t)return t;if(window?.Shopify?.shop)return window.Shopify.shop;let e=window?.domain;if(!e){const r=location?.href.match(/(?:http[s]*:\/\/)*(.*?)\.(?=admin\.rechargeapps\.com)/i)?.[1].replace(/-sp$/,"");r&&(e=`${r}.myshopify.com`)}if(e)return e;throw new Error("No storeIdentifier was passed into init.")}function Q2(t={}){const e=t,{storefrontAccessToken:r}=t;if(r&&!r.startsWith("strfnt"))throw new Error("Incorrect storefront access token used. See https://storefront.rechargepayments.com/client/docs/getting_started/package_setup/#initialization-- for more information.");sh({storeIdentifier:J2(t.storeIdentifier),loginRetryFn:t.loginRetryFn,storefrontAccessToken:r,appName:t.appName,appVersion:t.appVersion,environment:e.environment?e.environment:"prod",environmentUri:e.environmentUri,customerHash:e.customerHash}),Ss()}const zs={init:Q2,api:Z2,address:$h,auth:Fh,bundle:YA,charge:PO,cdn:bO,collection:CO,credit:WO,customer:jO,gift:YO,membership:tI,membershipProgram:iI,metafield:sI,onetime:dI,order:vI,paymentMethod:$I,plan:SI,product:TO,store:xI,subscription:K2};try{zs.init()}catch{}return zs});
|