@rechargeapps/storefront-client 1.90.0 → 1.91.1
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/auth.js +1 -1
- package/dist/cjs/api/bundleData.js +1 -1
- package/dist/cjs/api/customer.js +4 -2
- package/dist/cjs/api/customer.js.map +1 -1
- package/dist/cjs/utils/request.js +1 -1
- package/dist/esm/api/auth.js +1 -1
- package/dist/esm/api/bundleData.js +1 -1
- package/dist/esm/api/customer.js +4 -2
- package/dist/esm/api/customer.js.map +1 -1
- package/dist/esm/utils/request.js +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/umd/recharge-client.min.js +3 -3
- package/package.json +1 -1
package/dist/cjs/api/auth.js
CHANGED
|
@@ -190,7 +190,7 @@ async function rechargeAdminRequest(method, url, { id, query, data, headers } =
|
|
|
190
190
|
...storefrontAccessToken ? { "X-Recharge-Storefront-Access-Token": storefrontAccessToken } : {},
|
|
191
191
|
...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
|
|
192
192
|
...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
|
|
193
|
-
"X-Recharge-Sdk-Version": "1.
|
|
193
|
+
"X-Recharge-Sdk-Version": "1.91.1",
|
|
194
194
|
...headers ? headers : {}
|
|
195
195
|
};
|
|
196
196
|
return request.request(method, `${rechargeBaseUrl}${url}`, { id, query, data, headers: reqHeaders });
|
|
@@ -16,7 +16,7 @@ async function loadFromOnlineStore(id, country_code) {
|
|
|
16
16
|
const { appName, appVersion } = options.getOptions();
|
|
17
17
|
const headers = {
|
|
18
18
|
"X-Recharge-Sdk-Fn": "loadFromOnlineStore",
|
|
19
|
-
"X-Recharge-Sdk-Version": "1.
|
|
19
|
+
"X-Recharge-Sdk-Version": "1.91.1",
|
|
20
20
|
...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
|
|
21
21
|
...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {}
|
|
22
22
|
};
|
package/dist/cjs/api/customer.js
CHANGED
|
@@ -63,7 +63,9 @@ async function getActiveChurnLandingPageURL(session, subscriptionId, redirectURL
|
|
|
63
63
|
return `${base_url.replace(
|
|
64
64
|
"portal",
|
|
65
65
|
"pages"
|
|
66
|
-
)}${customer_hash}/subscriptions/${subscriptionId}/cancel?token=${temp_token}&subscription=${subscriptionId}&redirect_to=${
|
|
66
|
+
)}${customer_hash}/subscriptions/${subscriptionId}/cancel?token=${temp_token}&subscription=${subscriptionId}&redirect_to=${encodeURIComponent(
|
|
67
|
+
redirectURL
|
|
68
|
+
)}`;
|
|
67
69
|
}
|
|
68
70
|
async function getFailedPaymentMethodRecoveryLandingPageURL(session) {
|
|
69
71
|
const { base_url, customer_hash, temp_token } = await getCustomerPortalAccess(
|
|
@@ -81,7 +83,7 @@ async function getGiftRedemptionLandingPageURL(session, giftId, redirectURL) {
|
|
|
81
83
|
return `${base_url.replace(
|
|
82
84
|
"portal",
|
|
83
85
|
"pages"
|
|
84
|
-
)}${customer_hash}/gifts/${giftId}?token=${temp_token}&redirect_to=${redirectURL}`;
|
|
86
|
+
)}${customer_hash}/gifts/${giftId}?token=${temp_token}&redirect_to=${encodeURIComponent(redirectURL)}`;
|
|
85
87
|
}
|
|
86
88
|
const customerNotificationMap = {
|
|
87
89
|
SHOPIFY_UPDATE_PAYMENT_INFO: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customer.js","sources":["../../../src/api/customer.ts"],"sourcesContent":["import {\n Customer,\n CustomerCreditSummary,\n CustomerDeliveryScheduleParams,\n CustomerDeliveryScheduleResponse,\n CustomerNotification,\n CustomerNotificationOptions,\n CustomerNotificationTemplate,\n CustomerNotificationType,\n CustomerPortalAccessOptions,\n CustomerPortalAccessResponse,\n Delivery,\n GetCreditSummaryOptions,\n GetCustomerOptions,\n Session,\n UpdateCustomerRequest,\n} from '../types';\nimport { getInternalSession, rechargeApiRequest } from '../utils/request';\nimport { encodePathSegment } from '../utils/url';\n\nexport async function getCustomer(session: Session, options?: GetCustomerOptions): Promise<Customer> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { customer } = await rechargeApiRequest<{ customer: Customer }>(\n 'get',\n `/customers`,\n {\n id,\n query: { include: options?.include },\n },\n getInternalSession(session, 'getCustomer')\n );\n return customer;\n}\n\nexport async function updateCustomer(session: Session, updateRequest: UpdateCustomerRequest): Promise<Customer> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { customer } = await rechargeApiRequest<{ customer: Customer }>(\n 'put',\n `/customers`,\n { id, data: updateRequest },\n getInternalSession(session, 'updateCustomer')\n );\n return customer;\n}\n\nexport async function getDeliverySchedule(\n session: Session,\n query?: CustomerDeliveryScheduleParams\n): Promise<Delivery[]> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { deliveries } = await rechargeApiRequest<CustomerDeliveryScheduleResponse>(\n 'get',\n `/customers/${encodePathSegment(id)}/delivery_schedule`,\n { query },\n getInternalSession(session, 'getDeliverySchedule')\n );\n return deliveries;\n}\n\nexport async function getCustomerPortalAccess(\n session: Session,\n query?: CustomerPortalAccessOptions\n): Promise<CustomerPortalAccessResponse> {\n return rechargeApiRequest<CustomerPortalAccessResponse>(\n 'get',\n '/portal_access',\n { query },\n getInternalSession(session, 'getCustomerPortalAccess')\n );\n}\n\nexport async function getActiveChurnLandingPageURL(\n session: Session,\n subscriptionId: string | number,\n redirectURL: string\n): Promise<string> {\n if (subscriptionId === undefined || subscriptionId === '') {\n throw new Error('Subscription ID is required');\n }\n const { base_url, customer_hash, temp_token } = await getCustomerPortalAccess(\n getInternalSession(session, 'getActiveChurnLandingPageURL')\n );\n return `${base_url.replace(\n 'portal',\n 'pages'\n )}${customer_hash}/subscriptions/${subscriptionId}/cancel?token=${temp_token}&subscription=${subscriptionId}&redirect_to=${redirectURL}`;\n}\n\nexport async function getFailedPaymentMethodRecoveryLandingPageURL(session: Session): Promise<string> {\n const { base_url, customer_hash, temp_token } = await getCustomerPortalAccess(\n getInternalSession(session, 'getFailedPaymentMethodRecoveryLandingPageURL')\n );\n return `${base_url.replace('portal', 'pages')}account/payment-methods?token=${temp_token}&hash=${customer_hash}`;\n}\n\nexport async function getGiftRedemptionLandingPageURL(\n session: Session,\n giftId: string | number,\n redirectURL: string\n): Promise<string> {\n if (giftId === undefined || giftId === '') {\n throw new Error('Gift ID is required');\n }\n const { base_url, customer_hash, temp_token } = await getCustomerPortalAccess(\n getInternalSession(session, 'getGiftRedemptionLandingPageURL')\n );\n return `${base_url.replace(\n 'portal',\n 'pages'\n )}${customer_hash}/gifts/${giftId}?token=${temp_token}&redirect_to=${redirectURL}`;\n}\n\nconst customerNotificationMap: Record<\n CustomerNotification,\n { type: CustomerNotificationType; template_type: CustomerNotificationTemplate }\n> = {\n SHOPIFY_UPDATE_PAYMENT_INFO: {\n type: 'email',\n template_type: 'shopify_update_payment_information',\n },\n SHOPIFY_MIGRATE_PAYMENT_INFO: {\n type: 'email',\n template_type: 'shopify_migrate_payment_information',\n },\n};\n\nexport async function sendCustomerNotification<T extends CustomerNotification>(\n session: Session,\n notification: CustomerNotification,\n options?: CustomerNotificationOptions<T>\n): Promise<void> {\n const customerId = session.customerId;\n if (!customerId) {\n throw new Error('Not logged in.');\n }\n // Own-property check: a plain-object lookup resolves inherited keys such as\n // `__proto__`/`constructor` to truthy prototype values, bypassing this guard\n // (H1-3889216 / SEC-4002; same class as the CDN/bundle maps fixed in SEC-3996).\n if (!Object.prototype.hasOwnProperty.call(customerNotificationMap, notification)) {\n throw new Error('Notification not supported.');\n }\n const data = customerNotificationMap[notification];\n return rechargeApiRequest<void>(\n 'post',\n `/customers/${encodePathSegment(customerId)}/notifications`,\n {\n data: {\n ...data,\n template_vars: options,\n },\n },\n getInternalSession(session, 'sendCustomerNotification')\n );\n}\n\n/** @deprecated Use `getCreditSummary` on credit instead */\nexport async function getCreditSummary(\n session: Session,\n options?: GetCreditSummaryOptions\n): Promise<CustomerCreditSummary> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { credit_summary } = await rechargeApiRequest<{ credit_summary: CustomerCreditSummary }>(\n 'get',\n `/customers/${encodePathSegment(id)}/credit_summary`,\n {\n query: { include: options?.include },\n },\n getInternalSession(session, 'getCreditSummary')\n );\n return credit_summary;\n}\n"],"names":["rechargeApiRequest","getInternalSession","encodePathSegment"],"mappings":";;;;;AAoBsB,eAAA,WAAA,CAAY,SAAkB,OAAiD,EAAA;AACnG,EAAA,MAAM,KAAK,OAAQ,CAAA,UAAA,CAAA;AACnB,EAAA,IAAI,CAAC,EAAI,EAAA;AACP,IAAM,MAAA,IAAI,MAAM,gBAAgB,CAAA,CAAA;AAAA,GAClC;AACA,EAAM,MAAA,EAAE,QAAS,EAAA,GAAI,MAAMA,0BAAA;AAAA,IACzB,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,aAAa,CAAA;AAAA,GAC3C,CAAA;AACA,EAAO,OAAA,QAAA,CAAA;AACT,CAAA;AAEsB,eAAA,cAAA,CAAe,SAAkB,aAAyD,EAAA;AAC9G,EAAA,MAAM,KAAK,OAAQ,CAAA,UAAA,CAAA;AACnB,EAAA,IAAI,CAAC,EAAI,EAAA;AACP,IAAM,MAAA,IAAI,MAAM,gBAAgB,CAAA,CAAA;AAAA,GAClC;AACA,EAAM,MAAA,EAAE,QAAS,EAAA,GAAI,MAAMD,0BAAA;AAAA,IACzB,KAAA;AAAA,IACA,CAAA,UAAA,CAAA;AAAA,IACA,EAAE,EAAI,EAAA,IAAA,EAAM,aAAc,EAAA;AAAA,IAC1BC,0BAAA,CAAmB,SAAS,gBAAgB,CAAA;AAAA,GAC9C,CAAA;AACA,EAAO,OAAA,QAAA,CAAA;AACT,CAAA;AAEsB,eAAA,mBAAA,CACpB,SACA,KACqB,EAAA;AACrB,EAAA,MAAM,KAAK,OAAQ,CAAA,UAAA,CAAA;AACnB,EAAA,IAAI,CAAC,EAAI,EAAA;AACP,IAAM,MAAA,IAAI,MAAM,gBAAgB,CAAA,CAAA;AAAA,GAClC;AACA,EAAM,MAAA,EAAE,UAAW,EAAA,GAAI,MAAMD,0BAAA;AAAA,IAC3B,KAAA;AAAA,IACA,CAAA,WAAA,EAAcE,qBAAkB,CAAA,EAAE,CAAC,CAAA,kBAAA,CAAA;AAAA,IACnC,EAAE,KAAM,EAAA;AAAA,IACRD,0BAAA,CAAmB,SAAS,qBAAqB,CAAA;AAAA,GACnD,CAAA;AACA,EAAO,OAAA,UAAA,CAAA;AACT,CAAA;AAEsB,eAAA,uBAAA,CACpB,SACA,KACuC,EAAA;AACvC,EAAO,OAAAD,0BAAA;AAAA,IACL,KAAA;AAAA,IACA,gBAAA;AAAA,IACA,EAAE,KAAM,EAAA;AAAA,IACRC,0BAAA,CAAmB,SAAS,yBAAyB,CAAA;AAAA,GACvD,CAAA;AACF,CAAA;AAEsB,eAAA,4BAAA,CACpB,OACA,EAAA,cAAA,EACA,WACiB,EAAA;AACjB,EAAI,IAAA,cAAA,KAAmB,KAAa,CAAA,IAAA,cAAA,KAAmB,EAAI,EAAA;AACzD,IAAM,MAAA,IAAI,MAAM,6BAA6B,CAAA,CAAA;AAAA,GAC/C;AACA,EAAA,MAAM,EAAE,QAAA,EAAU,aAAe,EAAA,UAAA,KAAe,MAAM,uBAAA;AAAA,IACpDA,0BAAA,CAAmB,SAAS,8BAA8B,CAAA;AAAA,GAC5D,CAAA;AACA,EAAA,OAAO,GAAG,QAAS,CAAA,OAAA;AAAA,IACjB,QAAA;AAAA,IACA,OAAA;AAAA,GACD,
|
|
1
|
+
{"version":3,"file":"customer.js","sources":["../../../src/api/customer.ts"],"sourcesContent":["import {\n Customer,\n CustomerCreditSummary,\n CustomerDeliveryScheduleParams,\n CustomerDeliveryScheduleResponse,\n CustomerNotification,\n CustomerNotificationOptions,\n CustomerNotificationTemplate,\n CustomerNotificationType,\n CustomerPortalAccessOptions,\n CustomerPortalAccessResponse,\n Delivery,\n GetCreditSummaryOptions,\n GetCustomerOptions,\n Session,\n UpdateCustomerRequest,\n} from '../types';\nimport { getInternalSession, rechargeApiRequest } from '../utils/request';\nimport { encodePathSegment } from '../utils/url';\n\nexport async function getCustomer(session: Session, options?: GetCustomerOptions): Promise<Customer> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { customer } = await rechargeApiRequest<{ customer: Customer }>(\n 'get',\n `/customers`,\n {\n id,\n query: { include: options?.include },\n },\n getInternalSession(session, 'getCustomer')\n );\n return customer;\n}\n\nexport async function updateCustomer(session: Session, updateRequest: UpdateCustomerRequest): Promise<Customer> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { customer } = await rechargeApiRequest<{ customer: Customer }>(\n 'put',\n `/customers`,\n { id, data: updateRequest },\n getInternalSession(session, 'updateCustomer')\n );\n return customer;\n}\n\nexport async function getDeliverySchedule(\n session: Session,\n query?: CustomerDeliveryScheduleParams\n): Promise<Delivery[]> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { deliveries } = await rechargeApiRequest<CustomerDeliveryScheduleResponse>(\n 'get',\n `/customers/${encodePathSegment(id)}/delivery_schedule`,\n { query },\n getInternalSession(session, 'getDeliverySchedule')\n );\n return deliveries;\n}\n\nexport async function getCustomerPortalAccess(\n session: Session,\n query?: CustomerPortalAccessOptions\n): Promise<CustomerPortalAccessResponse> {\n return rechargeApiRequest<CustomerPortalAccessResponse>(\n 'get',\n '/portal_access',\n { query },\n getInternalSession(session, 'getCustomerPortalAccess')\n );\n}\n\nexport async function getActiveChurnLandingPageURL(\n session: Session,\n subscriptionId: string | number,\n redirectURL: string\n): Promise<string> {\n if (subscriptionId === undefined || subscriptionId === '') {\n throw new Error('Subscription ID is required');\n }\n const { base_url, customer_hash, temp_token } = await getCustomerPortalAccess(\n getInternalSession(session, 'getActiveChurnLandingPageURL')\n );\n return `${base_url.replace(\n 'portal',\n 'pages'\n )}${customer_hash}/subscriptions/${subscriptionId}/cancel?token=${temp_token}&subscription=${subscriptionId}&redirect_to=${encodeURIComponent(\n redirectURL\n )}`;\n}\n\nexport async function getFailedPaymentMethodRecoveryLandingPageURL(session: Session): Promise<string> {\n const { base_url, customer_hash, temp_token } = await getCustomerPortalAccess(\n getInternalSession(session, 'getFailedPaymentMethodRecoveryLandingPageURL')\n );\n return `${base_url.replace('portal', 'pages')}account/payment-methods?token=${temp_token}&hash=${customer_hash}`;\n}\n\nexport async function getGiftRedemptionLandingPageURL(\n session: Session,\n giftId: string | number,\n redirectURL: string\n): Promise<string> {\n if (giftId === undefined || giftId === '') {\n throw new Error('Gift ID is required');\n }\n const { base_url, customer_hash, temp_token } = await getCustomerPortalAccess(\n getInternalSession(session, 'getGiftRedemptionLandingPageURL')\n );\n return `${base_url.replace(\n 'portal',\n 'pages'\n )}${customer_hash}/gifts/${giftId}?token=${temp_token}&redirect_to=${encodeURIComponent(redirectURL)}`;\n}\n\nconst customerNotificationMap: Record<\n CustomerNotification,\n { type: CustomerNotificationType; template_type: CustomerNotificationTemplate }\n> = {\n SHOPIFY_UPDATE_PAYMENT_INFO: {\n type: 'email',\n template_type: 'shopify_update_payment_information',\n },\n SHOPIFY_MIGRATE_PAYMENT_INFO: {\n type: 'email',\n template_type: 'shopify_migrate_payment_information',\n },\n};\n\nexport async function sendCustomerNotification<T extends CustomerNotification>(\n session: Session,\n notification: CustomerNotification,\n options?: CustomerNotificationOptions<T>\n): Promise<void> {\n const customerId = session.customerId;\n if (!customerId) {\n throw new Error('Not logged in.');\n }\n // Own-property check: a plain-object lookup resolves inherited keys such as\n // `__proto__`/`constructor` to truthy prototype values, bypassing this guard\n // (H1-3889216 / SEC-4002; same class as the CDN/bundle maps fixed in SEC-3996).\n if (!Object.prototype.hasOwnProperty.call(customerNotificationMap, notification)) {\n throw new Error('Notification not supported.');\n }\n const data = customerNotificationMap[notification];\n return rechargeApiRequest<void>(\n 'post',\n `/customers/${encodePathSegment(customerId)}/notifications`,\n {\n data: {\n ...data,\n template_vars: options,\n },\n },\n getInternalSession(session, 'sendCustomerNotification')\n );\n}\n\n/** @deprecated Use `getCreditSummary` on credit instead */\nexport async function getCreditSummary(\n session: Session,\n options?: GetCreditSummaryOptions\n): Promise<CustomerCreditSummary> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { credit_summary } = await rechargeApiRequest<{ credit_summary: CustomerCreditSummary }>(\n 'get',\n `/customers/${encodePathSegment(id)}/credit_summary`,\n {\n query: { include: options?.include },\n },\n getInternalSession(session, 'getCreditSummary')\n );\n return credit_summary;\n}\n"],"names":["rechargeApiRequest","getInternalSession","encodePathSegment"],"mappings":";;;;;AAoBsB,eAAA,WAAA,CAAY,SAAkB,OAAiD,EAAA;AACnG,EAAA,MAAM,KAAK,OAAQ,CAAA,UAAA,CAAA;AACnB,EAAA,IAAI,CAAC,EAAI,EAAA;AACP,IAAM,MAAA,IAAI,MAAM,gBAAgB,CAAA,CAAA;AAAA,GAClC;AACA,EAAM,MAAA,EAAE,QAAS,EAAA,GAAI,MAAMA,0BAAA;AAAA,IACzB,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,aAAa,CAAA;AAAA,GAC3C,CAAA;AACA,EAAO,OAAA,QAAA,CAAA;AACT,CAAA;AAEsB,eAAA,cAAA,CAAe,SAAkB,aAAyD,EAAA;AAC9G,EAAA,MAAM,KAAK,OAAQ,CAAA,UAAA,CAAA;AACnB,EAAA,IAAI,CAAC,EAAI,EAAA;AACP,IAAM,MAAA,IAAI,MAAM,gBAAgB,CAAA,CAAA;AAAA,GAClC;AACA,EAAM,MAAA,EAAE,QAAS,EAAA,GAAI,MAAMD,0BAAA;AAAA,IACzB,KAAA;AAAA,IACA,CAAA,UAAA,CAAA;AAAA,IACA,EAAE,EAAI,EAAA,IAAA,EAAM,aAAc,EAAA;AAAA,IAC1BC,0BAAA,CAAmB,SAAS,gBAAgB,CAAA;AAAA,GAC9C,CAAA;AACA,EAAO,OAAA,QAAA,CAAA;AACT,CAAA;AAEsB,eAAA,mBAAA,CACpB,SACA,KACqB,EAAA;AACrB,EAAA,MAAM,KAAK,OAAQ,CAAA,UAAA,CAAA;AACnB,EAAA,IAAI,CAAC,EAAI,EAAA;AACP,IAAM,MAAA,IAAI,MAAM,gBAAgB,CAAA,CAAA;AAAA,GAClC;AACA,EAAM,MAAA,EAAE,UAAW,EAAA,GAAI,MAAMD,0BAAA;AAAA,IAC3B,KAAA;AAAA,IACA,CAAA,WAAA,EAAcE,qBAAkB,CAAA,EAAE,CAAC,CAAA,kBAAA,CAAA;AAAA,IACnC,EAAE,KAAM,EAAA;AAAA,IACRD,0BAAA,CAAmB,SAAS,qBAAqB,CAAA;AAAA,GACnD,CAAA;AACA,EAAO,OAAA,UAAA,CAAA;AACT,CAAA;AAEsB,eAAA,uBAAA,CACpB,SACA,KACuC,EAAA;AACvC,EAAO,OAAAD,0BAAA;AAAA,IACL,KAAA;AAAA,IACA,gBAAA;AAAA,IACA,EAAE,KAAM,EAAA;AAAA,IACRC,0BAAA,CAAmB,SAAS,yBAAyB,CAAA;AAAA,GACvD,CAAA;AACF,CAAA;AAEsB,eAAA,4BAAA,CACpB,OACA,EAAA,cAAA,EACA,WACiB,EAAA;AACjB,EAAI,IAAA,cAAA,KAAmB,KAAa,CAAA,IAAA,cAAA,KAAmB,EAAI,EAAA;AACzD,IAAM,MAAA,IAAI,MAAM,6BAA6B,CAAA,CAAA;AAAA,GAC/C;AACA,EAAA,MAAM,EAAE,QAAA,EAAU,aAAe,EAAA,UAAA,KAAe,MAAM,uBAAA;AAAA,IACpDA,0BAAA,CAAmB,SAAS,8BAA8B,CAAA;AAAA,GAC5D,CAAA;AACA,EAAA,OAAO,GAAG,QAAS,CAAA,OAAA;AAAA,IACjB,QAAA;AAAA,IACA,OAAA;AAAA,GACD,GAAG,aAAa,CAAA,eAAA,EAAkB,cAAc,CAAiB,cAAA,EAAA,UAAU,CAAiB,cAAA,EAAA,cAAc,CAAgB,aAAA,EAAA,kBAAA;AAAA,IACzH,WAAA;AAAA,GACD,CAAA,CAAA,CAAA;AACH,CAAA;AAEA,eAAsB,6CAA6C,OAAmC,EAAA;AACpG,EAAA,MAAM,EAAE,QAAA,EAAU,aAAe,EAAA,UAAA,KAAe,MAAM,uBAAA;AAAA,IACpDA,0BAAA,CAAmB,SAAS,8CAA8C,CAAA;AAAA,GAC5E,CAAA;AACA,EAAO,OAAA,CAAA,EAAG,SAAS,OAAQ,CAAA,QAAA,EAAU,OAAO,CAAC,CAAA,8BAAA,EAAiC,UAAU,CAAA,MAAA,EAAS,aAAa,CAAA,CAAA,CAAA;AAChH,CAAA;AAEsB,eAAA,+BAAA,CACpB,OACA,EAAA,MAAA,EACA,WACiB,EAAA;AACjB,EAAI,IAAA,MAAA,KAAW,KAAa,CAAA,IAAA,MAAA,KAAW,EAAI,EAAA;AACzC,IAAM,MAAA,IAAI,MAAM,qBAAqB,CAAA,CAAA;AAAA,GACvC;AACA,EAAA,MAAM,EAAE,QAAA,EAAU,aAAe,EAAA,UAAA,KAAe,MAAM,uBAAA;AAAA,IACpDA,0BAAA,CAAmB,SAAS,iCAAiC,CAAA;AAAA,GAC/D,CAAA;AACA,EAAA,OAAO,GAAG,QAAS,CAAA,OAAA;AAAA,IACjB,QAAA;AAAA,IACA,OAAA;AAAA,GACD,CAAG,EAAA,aAAa,CAAU,OAAA,EAAA,MAAM,UAAU,UAAU,CAAA,aAAA,EAAgB,kBAAmB,CAAA,WAAW,CAAC,CAAA,CAAA,CAAA;AACtG,CAAA;AAEA,MAAM,uBAGF,GAAA;AAAA,EACF,2BAA6B,EAAA;AAAA,IAC3B,IAAM,EAAA,OAAA;AAAA,IACN,aAAe,EAAA,oCAAA;AAAA,GACjB;AAAA,EACA,4BAA8B,EAAA;AAAA,IAC5B,IAAM,EAAA,OAAA;AAAA,IACN,aAAe,EAAA,qCAAA;AAAA,GACjB;AACF,CAAA,CAAA;AAEsB,eAAA,wBAAA,CACpB,OACA,EAAA,YAAA,EACA,OACe,EAAA;AACf,EAAA,MAAM,aAAa,OAAQ,CAAA,UAAA,CAAA;AAC3B,EAAA,IAAI,CAAC,UAAY,EAAA;AACf,IAAM,MAAA,IAAI,MAAM,gBAAgB,CAAA,CAAA;AAAA,GAClC;AAIA,EAAA,IAAI,CAAC,MAAO,CAAA,SAAA,CAAU,eAAe,IAAK,CAAA,uBAAA,EAAyB,YAAY,CAAG,EAAA;AAChF,IAAM,MAAA,IAAI,MAAM,6BAA6B,CAAA,CAAA;AAAA,GAC/C;AACA,EAAM,MAAA,IAAA,GAAO,wBAAwB,YAAY,CAAA,CAAA;AACjD,EAAO,OAAAD,0BAAA;AAAA,IACL,MAAA;AAAA,IACA,CAAA,WAAA,EAAcE,qBAAkB,CAAA,UAAU,CAAC,CAAA,cAAA,CAAA;AAAA,IAC3C;AAAA,MACE,IAAM,EAAA;AAAA,QACJ,GAAG,IAAA;AAAA,QACH,aAAe,EAAA,OAAA;AAAA,OACjB;AAAA,KACF;AAAA,IACAD,0BAAA,CAAmB,SAAS,0BAA0B,CAAA;AAAA,GACxD,CAAA;AACF;;;;;;;;;;;"}
|
|
@@ -51,7 +51,7 @@ async function rechargeApiRequest(method, url, { id, query, data, headers } = {}
|
|
|
51
51
|
"X-Recharge-Sdk-Fn": session.internalFnCall,
|
|
52
52
|
...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
|
|
53
53
|
...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
|
|
54
|
-
"X-Recharge-Sdk-Version": "1.
|
|
54
|
+
"X-Recharge-Sdk-Version": "1.91.1",
|
|
55
55
|
"X-Request-Id": session.internalRequestId,
|
|
56
56
|
...session.tmp_fn_identifier ? { "X-Recharge-Sdk-Fn-Identifier": session.tmp_fn_identifier } : {},
|
|
57
57
|
...headers ? headers : {}
|
package/dist/esm/api/auth.js
CHANGED
|
@@ -188,7 +188,7 @@ async function rechargeAdminRequest(method, url, { id, query, data, headers } =
|
|
|
188
188
|
...storefrontAccessToken ? { "X-Recharge-Storefront-Access-Token": storefrontAccessToken } : {},
|
|
189
189
|
...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
|
|
190
190
|
...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
|
|
191
|
-
"X-Recharge-Sdk-Version": "1.
|
|
191
|
+
"X-Recharge-Sdk-Version": "1.91.1",
|
|
192
192
|
...headers ? headers : {}
|
|
193
193
|
};
|
|
194
194
|
return request(method, `${rechargeBaseUrl}${url}`, { id, query, data, headers: reqHeaders });
|
|
@@ -14,7 +14,7 @@ async function loadFromOnlineStore(id, country_code) {
|
|
|
14
14
|
const { appName, appVersion } = getOptions();
|
|
15
15
|
const headers = {
|
|
16
16
|
"X-Recharge-Sdk-Fn": "loadFromOnlineStore",
|
|
17
|
-
"X-Recharge-Sdk-Version": "1.
|
|
17
|
+
"X-Recharge-Sdk-Version": "1.91.1",
|
|
18
18
|
...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
|
|
19
19
|
...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {}
|
|
20
20
|
};
|
package/dist/esm/api/customer.js
CHANGED
|
@@ -61,7 +61,9 @@ async function getActiveChurnLandingPageURL(session, subscriptionId, redirectURL
|
|
|
61
61
|
return `${base_url.replace(
|
|
62
62
|
"portal",
|
|
63
63
|
"pages"
|
|
64
|
-
)}${customer_hash}/subscriptions/${subscriptionId}/cancel?token=${temp_token}&subscription=${subscriptionId}&redirect_to=${
|
|
64
|
+
)}${customer_hash}/subscriptions/${subscriptionId}/cancel?token=${temp_token}&subscription=${subscriptionId}&redirect_to=${encodeURIComponent(
|
|
65
|
+
redirectURL
|
|
66
|
+
)}`;
|
|
65
67
|
}
|
|
66
68
|
async function getFailedPaymentMethodRecoveryLandingPageURL(session) {
|
|
67
69
|
const { base_url, customer_hash, temp_token } = await getCustomerPortalAccess(
|
|
@@ -79,7 +81,7 @@ async function getGiftRedemptionLandingPageURL(session, giftId, redirectURL) {
|
|
|
79
81
|
return `${base_url.replace(
|
|
80
82
|
"portal",
|
|
81
83
|
"pages"
|
|
82
|
-
)}${customer_hash}/gifts/${giftId}?token=${temp_token}&redirect_to=${redirectURL}`;
|
|
84
|
+
)}${customer_hash}/gifts/${giftId}?token=${temp_token}&redirect_to=${encodeURIComponent(redirectURL)}`;
|
|
83
85
|
}
|
|
84
86
|
const customerNotificationMap = {
|
|
85
87
|
SHOPIFY_UPDATE_PAYMENT_INFO: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customer.js","sources":["../../../src/api/customer.ts"],"sourcesContent":["import {\n Customer,\n CustomerCreditSummary,\n CustomerDeliveryScheduleParams,\n CustomerDeliveryScheduleResponse,\n CustomerNotification,\n CustomerNotificationOptions,\n CustomerNotificationTemplate,\n CustomerNotificationType,\n CustomerPortalAccessOptions,\n CustomerPortalAccessResponse,\n Delivery,\n GetCreditSummaryOptions,\n GetCustomerOptions,\n Session,\n UpdateCustomerRequest,\n} from '../types';\nimport { getInternalSession, rechargeApiRequest } from '../utils/request';\nimport { encodePathSegment } from '../utils/url';\n\nexport async function getCustomer(session: Session, options?: GetCustomerOptions): Promise<Customer> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { customer } = await rechargeApiRequest<{ customer: Customer }>(\n 'get',\n `/customers`,\n {\n id,\n query: { include: options?.include },\n },\n getInternalSession(session, 'getCustomer')\n );\n return customer;\n}\n\nexport async function updateCustomer(session: Session, updateRequest: UpdateCustomerRequest): Promise<Customer> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { customer } = await rechargeApiRequest<{ customer: Customer }>(\n 'put',\n `/customers`,\n { id, data: updateRequest },\n getInternalSession(session, 'updateCustomer')\n );\n return customer;\n}\n\nexport async function getDeliverySchedule(\n session: Session,\n query?: CustomerDeliveryScheduleParams\n): Promise<Delivery[]> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { deliveries } = await rechargeApiRequest<CustomerDeliveryScheduleResponse>(\n 'get',\n `/customers/${encodePathSegment(id)}/delivery_schedule`,\n { query },\n getInternalSession(session, 'getDeliverySchedule')\n );\n return deliveries;\n}\n\nexport async function getCustomerPortalAccess(\n session: Session,\n query?: CustomerPortalAccessOptions\n): Promise<CustomerPortalAccessResponse> {\n return rechargeApiRequest<CustomerPortalAccessResponse>(\n 'get',\n '/portal_access',\n { query },\n getInternalSession(session, 'getCustomerPortalAccess')\n );\n}\n\nexport async function getActiveChurnLandingPageURL(\n session: Session,\n subscriptionId: string | number,\n redirectURL: string\n): Promise<string> {\n if (subscriptionId === undefined || subscriptionId === '') {\n throw new Error('Subscription ID is required');\n }\n const { base_url, customer_hash, temp_token } = await getCustomerPortalAccess(\n getInternalSession(session, 'getActiveChurnLandingPageURL')\n );\n return `${base_url.replace(\n 'portal',\n 'pages'\n )}${customer_hash}/subscriptions/${subscriptionId}/cancel?token=${temp_token}&subscription=${subscriptionId}&redirect_to=${redirectURL}`;\n}\n\nexport async function getFailedPaymentMethodRecoveryLandingPageURL(session: Session): Promise<string> {\n const { base_url, customer_hash, temp_token } = await getCustomerPortalAccess(\n getInternalSession(session, 'getFailedPaymentMethodRecoveryLandingPageURL')\n );\n return `${base_url.replace('portal', 'pages')}account/payment-methods?token=${temp_token}&hash=${customer_hash}`;\n}\n\nexport async function getGiftRedemptionLandingPageURL(\n session: Session,\n giftId: string | number,\n redirectURL: string\n): Promise<string> {\n if (giftId === undefined || giftId === '') {\n throw new Error('Gift ID is required');\n }\n const { base_url, customer_hash, temp_token } = await getCustomerPortalAccess(\n getInternalSession(session, 'getGiftRedemptionLandingPageURL')\n );\n return `${base_url.replace(\n 'portal',\n 'pages'\n )}${customer_hash}/gifts/${giftId}?token=${temp_token}&redirect_to=${redirectURL}`;\n}\n\nconst customerNotificationMap: Record<\n CustomerNotification,\n { type: CustomerNotificationType; template_type: CustomerNotificationTemplate }\n> = {\n SHOPIFY_UPDATE_PAYMENT_INFO: {\n type: 'email',\n template_type: 'shopify_update_payment_information',\n },\n SHOPIFY_MIGRATE_PAYMENT_INFO: {\n type: 'email',\n template_type: 'shopify_migrate_payment_information',\n },\n};\n\nexport async function sendCustomerNotification<T extends CustomerNotification>(\n session: Session,\n notification: CustomerNotification,\n options?: CustomerNotificationOptions<T>\n): Promise<void> {\n const customerId = session.customerId;\n if (!customerId) {\n throw new Error('Not logged in.');\n }\n // Own-property check: a plain-object lookup resolves inherited keys such as\n // `__proto__`/`constructor` to truthy prototype values, bypassing this guard\n // (H1-3889216 / SEC-4002; same class as the CDN/bundle maps fixed in SEC-3996).\n if (!Object.prototype.hasOwnProperty.call(customerNotificationMap, notification)) {\n throw new Error('Notification not supported.');\n }\n const data = customerNotificationMap[notification];\n return rechargeApiRequest<void>(\n 'post',\n `/customers/${encodePathSegment(customerId)}/notifications`,\n {\n data: {\n ...data,\n template_vars: options,\n },\n },\n getInternalSession(session, 'sendCustomerNotification')\n );\n}\n\n/** @deprecated Use `getCreditSummary` on credit instead */\nexport async function getCreditSummary(\n session: Session,\n options?: GetCreditSummaryOptions\n): Promise<CustomerCreditSummary> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { credit_summary } = await rechargeApiRequest<{ credit_summary: CustomerCreditSummary }>(\n 'get',\n `/customers/${encodePathSegment(id)}/credit_summary`,\n {\n query: { include: options?.include },\n },\n getInternalSession(session, 'getCreditSummary')\n );\n return credit_summary;\n}\n"],"names":[],"mappings":";;;AAoBsB,eAAA,WAAA,CAAY,SAAkB,OAAiD,EAAA;AACnG,EAAA,MAAM,KAAK,OAAQ,CAAA,UAAA,CAAA;AACnB,EAAA,IAAI,CAAC,EAAI,EAAA;AACP,IAAM,MAAA,IAAI,MAAM,gBAAgB,CAAA,CAAA;AAAA,GAClC;AACA,EAAM,MAAA,EAAE,QAAS,EAAA,GAAI,MAAM,kBAAA;AAAA,IACzB,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,aAAa,CAAA;AAAA,GAC3C,CAAA;AACA,EAAO,OAAA,QAAA,CAAA;AACT,CAAA;AAEsB,eAAA,cAAA,CAAe,SAAkB,aAAyD,EAAA;AAC9G,EAAA,MAAM,KAAK,OAAQ,CAAA,UAAA,CAAA;AACnB,EAAA,IAAI,CAAC,EAAI,EAAA;AACP,IAAM,MAAA,IAAI,MAAM,gBAAgB,CAAA,CAAA;AAAA,GAClC;AACA,EAAM,MAAA,EAAE,QAAS,EAAA,GAAI,MAAM,kBAAA;AAAA,IACzB,KAAA;AAAA,IACA,CAAA,UAAA,CAAA;AAAA,IACA,EAAE,EAAI,EAAA,IAAA,EAAM,aAAc,EAAA;AAAA,IAC1B,kBAAA,CAAmB,SAAS,gBAAgB,CAAA;AAAA,GAC9C,CAAA;AACA,EAAO,OAAA,QAAA,CAAA;AACT,CAAA;AAEsB,eAAA,mBAAA,CACpB,SACA,KACqB,EAAA;AACrB,EAAA,MAAM,KAAK,OAAQ,CAAA,UAAA,CAAA;AACnB,EAAA,IAAI,CAAC,EAAI,EAAA;AACP,IAAM,MAAA,IAAI,MAAM,gBAAgB,CAAA,CAAA;AAAA,GAClC;AACA,EAAM,MAAA,EAAE,UAAW,EAAA,GAAI,MAAM,kBAAA;AAAA,IAC3B,KAAA;AAAA,IACA,CAAA,WAAA,EAAc,iBAAkB,CAAA,EAAE,CAAC,CAAA,kBAAA,CAAA;AAAA,IACnC,EAAE,KAAM,EAAA;AAAA,IACR,kBAAA,CAAmB,SAAS,qBAAqB,CAAA;AAAA,GACnD,CAAA;AACA,EAAO,OAAA,UAAA,CAAA;AACT,CAAA;AAEsB,eAAA,uBAAA,CACpB,SACA,KACuC,EAAA;AACvC,EAAO,OAAA,kBAAA;AAAA,IACL,KAAA;AAAA,IACA,gBAAA;AAAA,IACA,EAAE,KAAM,EAAA;AAAA,IACR,kBAAA,CAAmB,SAAS,yBAAyB,CAAA;AAAA,GACvD,CAAA;AACF,CAAA;AAEsB,eAAA,4BAAA,CACpB,OACA,EAAA,cAAA,EACA,WACiB,EAAA;AACjB,EAAI,IAAA,cAAA,KAAmB,KAAa,CAAA,IAAA,cAAA,KAAmB,EAAI,EAAA;AACzD,IAAM,MAAA,IAAI,MAAM,6BAA6B,CAAA,CAAA;AAAA,GAC/C;AACA,EAAA,MAAM,EAAE,QAAA,EAAU,aAAe,EAAA,UAAA,KAAe,MAAM,uBAAA;AAAA,IACpD,kBAAA,CAAmB,SAAS,8BAA8B,CAAA;AAAA,GAC5D,CAAA;AACA,EAAA,OAAO,GAAG,QAAS,CAAA,OAAA;AAAA,IACjB,QAAA;AAAA,IACA,OAAA;AAAA,GACD,
|
|
1
|
+
{"version":3,"file":"customer.js","sources":["../../../src/api/customer.ts"],"sourcesContent":["import {\n Customer,\n CustomerCreditSummary,\n CustomerDeliveryScheduleParams,\n CustomerDeliveryScheduleResponse,\n CustomerNotification,\n CustomerNotificationOptions,\n CustomerNotificationTemplate,\n CustomerNotificationType,\n CustomerPortalAccessOptions,\n CustomerPortalAccessResponse,\n Delivery,\n GetCreditSummaryOptions,\n GetCustomerOptions,\n Session,\n UpdateCustomerRequest,\n} from '../types';\nimport { getInternalSession, rechargeApiRequest } from '../utils/request';\nimport { encodePathSegment } from '../utils/url';\n\nexport async function getCustomer(session: Session, options?: GetCustomerOptions): Promise<Customer> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { customer } = await rechargeApiRequest<{ customer: Customer }>(\n 'get',\n `/customers`,\n {\n id,\n query: { include: options?.include },\n },\n getInternalSession(session, 'getCustomer')\n );\n return customer;\n}\n\nexport async function updateCustomer(session: Session, updateRequest: UpdateCustomerRequest): Promise<Customer> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { customer } = await rechargeApiRequest<{ customer: Customer }>(\n 'put',\n `/customers`,\n { id, data: updateRequest },\n getInternalSession(session, 'updateCustomer')\n );\n return customer;\n}\n\nexport async function getDeliverySchedule(\n session: Session,\n query?: CustomerDeliveryScheduleParams\n): Promise<Delivery[]> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { deliveries } = await rechargeApiRequest<CustomerDeliveryScheduleResponse>(\n 'get',\n `/customers/${encodePathSegment(id)}/delivery_schedule`,\n { query },\n getInternalSession(session, 'getDeliverySchedule')\n );\n return deliveries;\n}\n\nexport async function getCustomerPortalAccess(\n session: Session,\n query?: CustomerPortalAccessOptions\n): Promise<CustomerPortalAccessResponse> {\n return rechargeApiRequest<CustomerPortalAccessResponse>(\n 'get',\n '/portal_access',\n { query },\n getInternalSession(session, 'getCustomerPortalAccess')\n );\n}\n\nexport async function getActiveChurnLandingPageURL(\n session: Session,\n subscriptionId: string | number,\n redirectURL: string\n): Promise<string> {\n if (subscriptionId === undefined || subscriptionId === '') {\n throw new Error('Subscription ID is required');\n }\n const { base_url, customer_hash, temp_token } = await getCustomerPortalAccess(\n getInternalSession(session, 'getActiveChurnLandingPageURL')\n );\n return `${base_url.replace(\n 'portal',\n 'pages'\n )}${customer_hash}/subscriptions/${subscriptionId}/cancel?token=${temp_token}&subscription=${subscriptionId}&redirect_to=${encodeURIComponent(\n redirectURL\n )}`;\n}\n\nexport async function getFailedPaymentMethodRecoveryLandingPageURL(session: Session): Promise<string> {\n const { base_url, customer_hash, temp_token } = await getCustomerPortalAccess(\n getInternalSession(session, 'getFailedPaymentMethodRecoveryLandingPageURL')\n );\n return `${base_url.replace('portal', 'pages')}account/payment-methods?token=${temp_token}&hash=${customer_hash}`;\n}\n\nexport async function getGiftRedemptionLandingPageURL(\n session: Session,\n giftId: string | number,\n redirectURL: string\n): Promise<string> {\n if (giftId === undefined || giftId === '') {\n throw new Error('Gift ID is required');\n }\n const { base_url, customer_hash, temp_token } = await getCustomerPortalAccess(\n getInternalSession(session, 'getGiftRedemptionLandingPageURL')\n );\n return `${base_url.replace(\n 'portal',\n 'pages'\n )}${customer_hash}/gifts/${giftId}?token=${temp_token}&redirect_to=${encodeURIComponent(redirectURL)}`;\n}\n\nconst customerNotificationMap: Record<\n CustomerNotification,\n { type: CustomerNotificationType; template_type: CustomerNotificationTemplate }\n> = {\n SHOPIFY_UPDATE_PAYMENT_INFO: {\n type: 'email',\n template_type: 'shopify_update_payment_information',\n },\n SHOPIFY_MIGRATE_PAYMENT_INFO: {\n type: 'email',\n template_type: 'shopify_migrate_payment_information',\n },\n};\n\nexport async function sendCustomerNotification<T extends CustomerNotification>(\n session: Session,\n notification: CustomerNotification,\n options?: CustomerNotificationOptions<T>\n): Promise<void> {\n const customerId = session.customerId;\n if (!customerId) {\n throw new Error('Not logged in.');\n }\n // Own-property check: a plain-object lookup resolves inherited keys such as\n // `__proto__`/`constructor` to truthy prototype values, bypassing this guard\n // (H1-3889216 / SEC-4002; same class as the CDN/bundle maps fixed in SEC-3996).\n if (!Object.prototype.hasOwnProperty.call(customerNotificationMap, notification)) {\n throw new Error('Notification not supported.');\n }\n const data = customerNotificationMap[notification];\n return rechargeApiRequest<void>(\n 'post',\n `/customers/${encodePathSegment(customerId)}/notifications`,\n {\n data: {\n ...data,\n template_vars: options,\n },\n },\n getInternalSession(session, 'sendCustomerNotification')\n );\n}\n\n/** @deprecated Use `getCreditSummary` on credit instead */\nexport async function getCreditSummary(\n session: Session,\n options?: GetCreditSummaryOptions\n): Promise<CustomerCreditSummary> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { credit_summary } = await rechargeApiRequest<{ credit_summary: CustomerCreditSummary }>(\n 'get',\n `/customers/${encodePathSegment(id)}/credit_summary`,\n {\n query: { include: options?.include },\n },\n getInternalSession(session, 'getCreditSummary')\n );\n return credit_summary;\n}\n"],"names":[],"mappings":";;;AAoBsB,eAAA,WAAA,CAAY,SAAkB,OAAiD,EAAA;AACnG,EAAA,MAAM,KAAK,OAAQ,CAAA,UAAA,CAAA;AACnB,EAAA,IAAI,CAAC,EAAI,EAAA;AACP,IAAM,MAAA,IAAI,MAAM,gBAAgB,CAAA,CAAA;AAAA,GAClC;AACA,EAAM,MAAA,EAAE,QAAS,EAAA,GAAI,MAAM,kBAAA;AAAA,IACzB,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,aAAa,CAAA;AAAA,GAC3C,CAAA;AACA,EAAO,OAAA,QAAA,CAAA;AACT,CAAA;AAEsB,eAAA,cAAA,CAAe,SAAkB,aAAyD,EAAA;AAC9G,EAAA,MAAM,KAAK,OAAQ,CAAA,UAAA,CAAA;AACnB,EAAA,IAAI,CAAC,EAAI,EAAA;AACP,IAAM,MAAA,IAAI,MAAM,gBAAgB,CAAA,CAAA;AAAA,GAClC;AACA,EAAM,MAAA,EAAE,QAAS,EAAA,GAAI,MAAM,kBAAA;AAAA,IACzB,KAAA;AAAA,IACA,CAAA,UAAA,CAAA;AAAA,IACA,EAAE,EAAI,EAAA,IAAA,EAAM,aAAc,EAAA;AAAA,IAC1B,kBAAA,CAAmB,SAAS,gBAAgB,CAAA;AAAA,GAC9C,CAAA;AACA,EAAO,OAAA,QAAA,CAAA;AACT,CAAA;AAEsB,eAAA,mBAAA,CACpB,SACA,KACqB,EAAA;AACrB,EAAA,MAAM,KAAK,OAAQ,CAAA,UAAA,CAAA;AACnB,EAAA,IAAI,CAAC,EAAI,EAAA;AACP,IAAM,MAAA,IAAI,MAAM,gBAAgB,CAAA,CAAA;AAAA,GAClC;AACA,EAAM,MAAA,EAAE,UAAW,EAAA,GAAI,MAAM,kBAAA;AAAA,IAC3B,KAAA;AAAA,IACA,CAAA,WAAA,EAAc,iBAAkB,CAAA,EAAE,CAAC,CAAA,kBAAA,CAAA;AAAA,IACnC,EAAE,KAAM,EAAA;AAAA,IACR,kBAAA,CAAmB,SAAS,qBAAqB,CAAA;AAAA,GACnD,CAAA;AACA,EAAO,OAAA,UAAA,CAAA;AACT,CAAA;AAEsB,eAAA,uBAAA,CACpB,SACA,KACuC,EAAA;AACvC,EAAO,OAAA,kBAAA;AAAA,IACL,KAAA;AAAA,IACA,gBAAA;AAAA,IACA,EAAE,KAAM,EAAA;AAAA,IACR,kBAAA,CAAmB,SAAS,yBAAyB,CAAA;AAAA,GACvD,CAAA;AACF,CAAA;AAEsB,eAAA,4BAAA,CACpB,OACA,EAAA,cAAA,EACA,WACiB,EAAA;AACjB,EAAI,IAAA,cAAA,KAAmB,KAAa,CAAA,IAAA,cAAA,KAAmB,EAAI,EAAA;AACzD,IAAM,MAAA,IAAI,MAAM,6BAA6B,CAAA,CAAA;AAAA,GAC/C;AACA,EAAA,MAAM,EAAE,QAAA,EAAU,aAAe,EAAA,UAAA,KAAe,MAAM,uBAAA;AAAA,IACpD,kBAAA,CAAmB,SAAS,8BAA8B,CAAA;AAAA,GAC5D,CAAA;AACA,EAAA,OAAO,GAAG,QAAS,CAAA,OAAA;AAAA,IACjB,QAAA;AAAA,IACA,OAAA;AAAA,GACD,GAAG,aAAa,CAAA,eAAA,EAAkB,cAAc,CAAiB,cAAA,EAAA,UAAU,CAAiB,cAAA,EAAA,cAAc,CAAgB,aAAA,EAAA,kBAAA;AAAA,IACzH,WAAA;AAAA,GACD,CAAA,CAAA,CAAA;AACH,CAAA;AAEA,eAAsB,6CAA6C,OAAmC,EAAA;AACpG,EAAA,MAAM,EAAE,QAAA,EAAU,aAAe,EAAA,UAAA,KAAe,MAAM,uBAAA;AAAA,IACpD,kBAAA,CAAmB,SAAS,8CAA8C,CAAA;AAAA,GAC5E,CAAA;AACA,EAAO,OAAA,CAAA,EAAG,SAAS,OAAQ,CAAA,QAAA,EAAU,OAAO,CAAC,CAAA,8BAAA,EAAiC,UAAU,CAAA,MAAA,EAAS,aAAa,CAAA,CAAA,CAAA;AAChH,CAAA;AAEsB,eAAA,+BAAA,CACpB,OACA,EAAA,MAAA,EACA,WACiB,EAAA;AACjB,EAAI,IAAA,MAAA,KAAW,KAAa,CAAA,IAAA,MAAA,KAAW,EAAI,EAAA;AACzC,IAAM,MAAA,IAAI,MAAM,qBAAqB,CAAA,CAAA;AAAA,GACvC;AACA,EAAA,MAAM,EAAE,QAAA,EAAU,aAAe,EAAA,UAAA,KAAe,MAAM,uBAAA;AAAA,IACpD,kBAAA,CAAmB,SAAS,iCAAiC,CAAA;AAAA,GAC/D,CAAA;AACA,EAAA,OAAO,GAAG,QAAS,CAAA,OAAA;AAAA,IACjB,QAAA;AAAA,IACA,OAAA;AAAA,GACD,CAAG,EAAA,aAAa,CAAU,OAAA,EAAA,MAAM,UAAU,UAAU,CAAA,aAAA,EAAgB,kBAAmB,CAAA,WAAW,CAAC,CAAA,CAAA,CAAA;AACtG,CAAA;AAEA,MAAM,uBAGF,GAAA;AAAA,EACF,2BAA6B,EAAA;AAAA,IAC3B,IAAM,EAAA,OAAA;AAAA,IACN,aAAe,EAAA,oCAAA;AAAA,GACjB;AAAA,EACA,4BAA8B,EAAA;AAAA,IAC5B,IAAM,EAAA,OAAA;AAAA,IACN,aAAe,EAAA,qCAAA;AAAA,GACjB;AACF,CAAA,CAAA;AAEsB,eAAA,wBAAA,CACpB,OACA,EAAA,YAAA,EACA,OACe,EAAA;AACf,EAAA,MAAM,aAAa,OAAQ,CAAA,UAAA,CAAA;AAC3B,EAAA,IAAI,CAAC,UAAY,EAAA;AACf,IAAM,MAAA,IAAI,MAAM,gBAAgB,CAAA,CAAA;AAAA,GAClC;AAIA,EAAA,IAAI,CAAC,MAAO,CAAA,SAAA,CAAU,eAAe,IAAK,CAAA,uBAAA,EAAyB,YAAY,CAAG,EAAA;AAChF,IAAM,MAAA,IAAI,MAAM,6BAA6B,CAAA,CAAA;AAAA,GAC/C;AACA,EAAM,MAAA,IAAA,GAAO,wBAAwB,YAAY,CAAA,CAAA;AACjD,EAAO,OAAA,kBAAA;AAAA,IACL,MAAA;AAAA,IACA,CAAA,WAAA,EAAc,iBAAkB,CAAA,UAAU,CAAC,CAAA,cAAA,CAAA;AAAA,IAC3C;AAAA,MACE,IAAM,EAAA;AAAA,QACJ,GAAG,IAAA;AAAA,QACH,aAAe,EAAA,OAAA;AAAA,OACjB;AAAA,KACF;AAAA,IACA,kBAAA,CAAmB,SAAS,0BAA0B,CAAA;AAAA,GACxD,CAAA;AACF;;;;"}
|
|
@@ -49,7 +49,7 @@ async function rechargeApiRequest(method, url, { id, query, data, headers } = {}
|
|
|
49
49
|
"X-Recharge-Sdk-Fn": session.internalFnCall,
|
|
50
50
|
...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
|
|
51
51
|
...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
|
|
52
|
-
"X-Recharge-Sdk-Version": "1.
|
|
52
|
+
"X-Recharge-Sdk-Version": "1.91.1",
|
|
53
53
|
"X-Request-Id": session.internalRequestId,
|
|
54
54
|
...session.tmp_fn_identifier ? { "X-Recharge-Sdk-Fn-Identifier": session.tmp_fn_identifier } : {},
|
|
55
55
|
...headers ? headers : {}
|
package/dist/index.d.ts
CHANGED
|
@@ -1665,6 +1665,12 @@ interface CancelSubscriptionRequest {
|
|
|
1665
1665
|
cancellation_reason: string;
|
|
1666
1666
|
cancellation_reason_comments?: string;
|
|
1667
1667
|
send_email?: boolean;
|
|
1668
|
+
/**
|
|
1669
|
+
* Identifier of the cancellation prevention offer the customer was shown and declined, as returned by
|
|
1670
|
+
* `getCustomerSurveyOffers`. Records the declined offer against the cancellation.
|
|
1671
|
+
* @internal
|
|
1672
|
+
*/
|
|
1673
|
+
claim_id?: string;
|
|
1668
1674
|
}
|
|
1669
1675
|
interface CreateSubscriptionsRequest extends Omit<CreateSubscriptionRequest, 'plan_id'> {
|
|
1670
1676
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// recharge-client-1.
|
|
1
|
+
// recharge-client-1.91.1.min.js | MIT License | © Recharge Inc.
|
|
2
2
|
(function(C,$e){typeof exports=="object"&&typeof module<"u"?module.exports=$e():typeof define=="function"&&define.amd?define($e):(C=typeof globalThis<"u"?globalThis:C||self,C.recharge=$e())})(this,function(){"use strict";var C=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $e(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function ec(r){if(r.__esModule)return r;var e=r.default;if(typeof e=="function"){var t=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return r[n]}})}),t}var k=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof k<"u"&&k,H={searchParams:"URLSearchParams"in k,iterable:"Symbol"in k&&"iterator"in Symbol,blob:"FileReader"in k&&"Blob"in k&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in k,arrayBuffer:"ArrayBuffer"in k};function rc(r){return r&&DataView.prototype.isPrototypeOf(r)}if(H.arrayBuffer)var tc=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],nc=ArrayBuffer.isView||function(r){return r&&tc.indexOf(Object.prototype.toString.call(r))>-1};function hr(r){if(typeof r!="string"&&(r=String(r)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(r)||r==="")throw new TypeError('Invalid character in header field name: "'+r+'"');return r.toLowerCase()}function mn(r){return typeof r!="string"&&(r=String(r)),r}function wn(r){var e={next:function(){var t=r.shift();return{done:t===void 0,value:t}}};return H.iterable&&(e[Symbol.iterator]=function(){return e}),e}function N(r){this.map={},r instanceof N?r.forEach(function(e,t){this.append(t,e)},this):Array.isArray(r)?r.forEach(function(e){this.append(e[0],e[1])},this):r&&Object.getOwnPropertyNames(r).forEach(function(e){this.append(e,r[e])},this)}N.prototype.append=function(r,e){r=hr(r),e=mn(e);var t=this.map[r];this.map[r]=t?t+", "+e:e},N.prototype.delete=function(r){delete this.map[hr(r)]},N.prototype.get=function(r){return r=hr(r),this.has(r)?this.map[r]:null},N.prototype.has=function(r){return this.map.hasOwnProperty(hr(r))},N.prototype.set=function(r,e){this.map[hr(r)]=mn(e)},N.prototype.forEach=function(r,e){for(var t in this.map)this.map.hasOwnProperty(t)&&r.call(e,this.map[t],t,this)},N.prototype.keys=function(){var r=[];return this.forEach(function(e,t){r.push(t)}),wn(r)},N.prototype.values=function(){var r=[];return this.forEach(function(e){r.push(e)}),wn(r)},N.prototype.entries=function(){var r=[];return this.forEach(function(e,t){r.push([t,e])}),wn(r)},H.iterable&&(N.prototype[Symbol.iterator]=N.prototype.entries);function bn(r){if(r.bodyUsed)return Promise.reject(new TypeError("Already read"));r.bodyUsed=!0}function ha(r){return new Promise(function(e,t){r.onload=function(){e(r.result)},r.onerror=function(){t(r.error)}})}function ic(r){var e=new FileReader,t=ha(e);return e.readAsArrayBuffer(r),t}function ac(r){var e=new FileReader,t=ha(e);return e.readAsText(r),t}function oc(r){for(var e=new Uint8Array(r),t=new Array(e.length),n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return t.join("")}function ya(r){if(r.slice)return r.slice(0);var e=new Uint8Array(r.byteLength);return e.set(new Uint8Array(r)),e.buffer}function ga(){return this.bodyUsed=!1,this._initBody=function(r){this.bodyUsed=this.bodyUsed,this._bodyInit=r,r?typeof r=="string"?this._bodyText=r:H.blob&&Blob.prototype.isPrototypeOf(r)?this._bodyBlob=r:H.formData&&FormData.prototype.isPrototypeOf(r)?this._bodyFormData=r:H.searchParams&&URLSearchParams.prototype.isPrototypeOf(r)?this._bodyText=r.toString():H.arrayBuffer&&H.blob&&rc(r)?(this._bodyArrayBuffer=ya(r.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):H.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(r)||nc(r))?this._bodyArrayBuffer=ya(r):this._bodyText=r=Object.prototype.toString.call(r):this._bodyText="",this.headers.get("content-type")||(typeof r=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):H.searchParams&&URLSearchParams.prototype.isPrototypeOf(r)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},H.blob&&(this.blob=function(){var r=bn(this);if(r)return r;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 r=bn(this);return r||(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(ic)}),this.text=function(){var r=bn(this);if(r)return r;if(this._bodyBlob)return ac(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(oc(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},H.formData&&(this.formData=function(){return this.text().then(fc)}),this.json=function(){return this.text().then(JSON.parse)},this}var sc=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function uc(r){var e=r.toUpperCase();return sc.indexOf(e)>-1?e:r}function Ee(r,e){if(!(this instanceof Ee))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e=e||{};var t=e.body;if(r instanceof Ee){if(r.bodyUsed)throw new TypeError("Already read");this.url=r.url,this.credentials=r.credentials,e.headers||(this.headers=new N(r.headers)),this.method=r.method,this.mode=r.mode,this.signal=r.signal,!t&&r._bodyInit!=null&&(t=r._bodyInit,r.bodyUsed=!0)}else this.url=String(r);if(this.credentials=e.credentials||this.credentials||"same-origin",(e.headers||!this.headers)&&(this.headers=new N(e.headers)),this.method=uc(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")&&t)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(t),(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()}}}Ee.prototype.clone=function(){return new Ee(this,{body:this._bodyInit})};function fc(r){var e=new FormData;return r.trim().split("&").forEach(function(t){if(t){var n=t.split("="),i=n.shift().replace(/\+/g," "),a=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(a))}}),e}function cc(r){var e=new N,t=r.replace(/\r?\n[\t ]+/g," ");return t.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}ga.call(Ee.prototype);function J(r,e){if(!(this instanceof J))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(r)}ga.call(J.prototype),J.prototype.clone=function(){return new J(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new N(this.headers),url:this.url})},J.error=function(){var r=new J(null,{status:0,statusText:""});return r.type="error",r};var lc=[301,302,303,307,308];J.redirect=function(r,e){if(lc.indexOf(e)===-1)throw new RangeError("Invalid status code");return new J(null,{status:e,headers:{location:r}})};var Se=k.DOMException;try{new Se}catch{Se=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},Se.prototype=Object.create(Error.prototype),Se.prototype.constructor=Se}function _a(r,e){return new Promise(function(t,n){var i=new Ee(r,e);if(i.signal&&i.signal.aborted)return n(new Se("Aborted","AbortError"));var a=new XMLHttpRequest;function o(){a.abort()}a.onload=function(){var f={status:a.status,statusText:a.statusText,headers:cc(a.getAllResponseHeaders()||"")};f.url="responseURL"in a?a.responseURL:f.headers.get("X-Request-URL");var d="response"in a?a.response:a.responseText;setTimeout(function(){t(new J(d,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 Se("Aborted","AbortError"))},0)};function u(f){try{return f===""&&k.location.href?k.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&&(H.blob?a.responseType="blob":H.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,mn(e.headers[f]))}):i.headers.forEach(function(f,d){a.setRequestHeader(d,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)})}_a.polyfill=!0,k.fetch||(k.fetch=_a,k.Headers=N,k.Request=Ee,k.Response=J),self.fetch.bind(self);let dc="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",va=(r=21)=>{let e="",t=r|0;for(;t--;)e+=dc[Math.random()*64|0];return e};var je=TypeError,Ve=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Q=[],X=[],pc=typeof Uint8Array<"u"?Uint8Array:Array,$n=!1;function ma(){$n=!0;for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,t=r.length;e<t;++e)Q[e]=r[e],X[r.charCodeAt(e)]=e;X["-".charCodeAt(0)]=62,X["_".charCodeAt(0)]=63}function hc(r){$n||ma();var e,t,n,i,a,o,u=r.length;if(u%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a=r[u-2]==="="?2:r[u-1]==="="?1:0,o=new pc(u*3/4-a),n=a>0?u-4:u;var f=0;for(e=0,t=0;e<n;e+=4,t+=3)i=X[r.charCodeAt(e)]<<18|X[r.charCodeAt(e+1)]<<12|X[r.charCodeAt(e+2)]<<6|X[r.charCodeAt(e+3)],o[f++]=i>>16&255,o[f++]=i>>8&255,o[f++]=i&255;return a===2?(i=X[r.charCodeAt(e)]<<2|X[r.charCodeAt(e+1)]>>4,o[f++]=i&255):a===1&&(i=X[r.charCodeAt(e)]<<10|X[r.charCodeAt(e+1)]<<4|X[r.charCodeAt(e+2)]>>2,o[f++]=i>>8&255,o[f++]=i&255),o}function yc(r){return Q[r>>18&63]+Q[r>>12&63]+Q[r>>6&63]+Q[r&63]}function gc(r,e,t){for(var n,i=[],a=e;a<t;a+=3)n=(r[a]<<16)+(r[a+1]<<8)+r[a+2],i.push(yc(n));return i.join("")}function wa(r){$n||ma();for(var e,t=r.length,n=t%3,i="",a=[],o=16383,u=0,f=t-n;u<f;u+=o)a.push(gc(r,u,u+o>f?f:u+o));return n===1?(e=r[t-1],i+=Q[e>>2],i+=Q[e<<4&63],i+="=="):n===2&&(e=(r[t-2]<<8)+r[t-1],i+=Q[e>>10],i+=Q[e>>4&63],i+=Q[e<<2&63],i+="="),a.push(i),a.join("")}function et(r,e,t,n,i){var a,o,u=i*8-n-1,f=(1<<u)-1,d=f>>1,c=-7,s=t?i-1:0,l=t?-1:1,p=r[e+s];for(s+=l,a=p&(1<<-c)-1,p>>=-c,c+=u;c>0;a=a*256+r[e+s],s+=l,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=o*256+r[e+s],s+=l,c-=8);if(a===0)a=1-d;else{if(a===f)return o?NaN:(p?-1:1)*(1/0);o=o+Math.pow(2,n),a=a-d}return(p?-1:1)*o*Math.pow(2,a-n)}function ba(r,e,t,n,i,a){var o,u,f,d=a*8-i-1,c=(1<<d)-1,s=c>>1,l=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:a-1,g=n?1:-1,$=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=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-o))<1&&(o--,f*=2),o+s>=1?e+=l/f:e+=l*Math.pow(2,1-s),e*f>=2&&(o++,f/=2),o+s>=c?(u=0,o=c):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;r[t+p]=u&255,p+=g,u/=256,i-=8);for(o=o<<i|u,d+=i;d>0;r[t+p]=o&255,p+=g,o/=256,d-=8);r[t+p-g]|=$*128}var _c={}.toString,$a=Array.isArray||function(r){return _c.call(r)=="[object Array]"};/*!
|
|
4
4
|
* The buffer module from node.js, for the browser.
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
`)+" "+t[1]:t[0]+e+" "+r.join(", ")+" "+t[1]}function Fn(r){return Array.isArray(r)}function ct(r){return typeof r=="boolean"}function yr(r){return r===null}function Ga(r){return r==null}function Rn(r){return typeof r=="number"}function gr(r){return typeof r=="string"}function Ha(r){return typeof r=="symbol"}function te(r){return r===void 0}function _r(r){return Pe(r)&&Mn(r)==="[object RegExp]"}function Pe(r){return typeof r=="object"&&r!==null}function lt(r){return Pe(r)&&Mn(r)==="[object Date]"}function vr(r){return Pe(r)&&(Mn(r)==="[object Error]"||r instanceof Error)}function mr(r){return typeof r=="function"}function Wa(r){return r===null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||typeof r=="symbol"||typeof r>"u"}function za(r){return y.isBuffer(r)}function Mn(r){return Object.prototype.toString.call(r)}function Dn(r){return r<10?"0"+r.toString(10):r.toString(10)}var Sl=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Al(){var r=new Date,e=[Dn(r.getHours()),Dn(r.getMinutes()),Dn(r.getSeconds())].join(":");return[r.getDate(),Sl[r.getMonth()],e].join(" ")}function Xa(){console.log("%s - %s",Al(),st.apply(null,arguments))}function Cn(r,e){if(!e||!Pe(e))return r;for(var t=Object.keys(e),n=t.length;n--;)r[t[n]]=e[t[n]];return r}function Ya(r,e){return Object.prototype.hasOwnProperty.call(r,e)}var xe=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;function Nn(r){if(typeof r!="function")throw new TypeError('The "original" argument must be of type Function');if(xe&&r[xe]){var e=r[xe];if(typeof e!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,xe,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var t,n,i=new Promise(function(u,f){t=u,n=f}),a=[],o=0;o<arguments.length;o++)a.push(arguments[o]);a.push(function(u,f){u?n(u):t(f)});try{r.apply(this,a)}catch(u){n(u)}return i}return Object.setPrototypeOf(e,Object.getPrototypeOf(r)),xe&&Object.defineProperty(e,xe,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,ja(r))}Nn.custom=xe;function Ol(r,e){if(!r){var t=new Error("Promise was rejected with a falsy value");t.reason=r,r=t}return e(r)}function Ka(r){if(typeof r!="function")throw new TypeError('The "original" argument must be of type Function');function e(){for(var t=[],n=0;n<arguments.length;n++)t.push(arguments[n]);var i=t.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)};r.apply(this,t).then(function(u){We.nextTick(o.bind(null,null,u))},function(u){We.nextTick(Ol.bind(null,u,o))})}return Object.setPrototypeOf(e,Object.getPrototypeOf(r)),Object.defineProperties(e,ja(r)),e}var Il={inherits:ka,_extend:Cn,log:Xa,isBuffer:za,isPrimitive:Wa,isFunction:mr,isError:vr,isDate:lt,isObject:Pe,isRegExp:_r,isUndefined:te,isSymbol:Ha,isString:gr,isNumber:Rn,isNullOrUndefined:Ga,isNull:yr,isBoolean:ct,isArray:Fn,inspect:re,deprecate:In,format:st,debuglog:Va,promisify:Nn,callbackify:Ka},Pl=Object.freeze({__proto__:null,_extend:Cn,callbackify:Ka,debuglog:Va,default:Il,deprecate:In,format:st,inherits:ka,inspect:re,isArray:Fn,isBoolean:ct,isBuffer:za,isDate:lt,isError:vr,isFunction:mr,isNull:yr,isNullOrUndefined:Ga,isNumber:Rn,isObject:Pe,isPrimitive:Wa,isRegExp:_r,isString:gr,isSymbol:Ha,isUndefined:te,log:Xa,promisify:Nn}),xl=ec(Pl),Tl=xl.inspect,Bn=typeof Map=="function"&&Map.prototype,qn=Object.getOwnPropertyDescriptor&&Bn?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,dt=Bn&&qn&&typeof qn.get=="function"?qn.get:null,Za=Bn&&Map.prototype.forEach,Un=typeof Set=="function"&&Set.prototype,Ln=Object.getOwnPropertyDescriptor&&Un?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,pt=Un&&Ln&&typeof Ln.get=="function"?Ln.get:null,Ja=Un&&Set.prototype.forEach,Fl=typeof WeakMap=="function"&&WeakMap.prototype,wr=Fl?WeakMap.prototype.has:null,Rl=typeof WeakSet=="function"&&WeakSet.prototype,br=Rl?WeakSet.prototype.has:null,Ml=typeof WeakRef=="function"&&WeakRef.prototype,Qa=Ml?WeakRef.prototype.deref:null,Dl=Boolean.prototype.valueOf,Cl=Object.prototype.toString,Nl=Function.prototype.toString,Bl=String.prototype.match,kn=String.prototype.slice,_e=String.prototype.replace,ql=String.prototype.toUpperCase,eo=String.prototype.toLowerCase,ro=RegExp.prototype.test,to=Array.prototype.concat,ne=Array.prototype.join,Ul=Array.prototype.slice,no=Math.floor,jn=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Vn=Object.getOwnPropertySymbols,Gn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ze=typeof Symbol=="function"&&typeof Symbol.iterator=="object",$r=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ze||"symbol")?Symbol.toStringTag:null,io=Object.prototype.propertyIsEnumerable,ao=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function oo(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||ro.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var n=r<0?-no(-r):no(r);if(n!==r){var i=String(n),a=kn.call(e,i.length+1);return _e.call(i,t,"$&_")+"."+_e.call(_e.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return _e.call(e,t,"$&_")}var Hn=Tl,so=Hn.custom,uo=po(so)?so:null,fo={__proto__:null,double:'"',single:"'"},Ll={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},ht=function r(e,t,n,i){var a=t||{};if(le(a,"quoteStyle")&&!le(fo,a.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(le(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=le(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(le(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(le(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 yo(e,a);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var f=String(e);return u?oo(e,f):f}if(typeof e=="bigint"){var d=String(e)+"n";return u?oo(e,d):d}var c=typeof a.depth>"u"?5:a.depth;if(typeof n>"u"&&(n=0),n>=c&&c>0&&typeof e=="object")return Wn(e)?"[Array]":"[Object]";var s=id(a,n);if(typeof i>"u")i=[];else if(ho(i,e)>=0)return"[Circular]";function l(z,ue,Z){if(ue&&(i=Ul.call(i),i.push(ue)),Z){var ke={depth:a.depth};return le(a,"quoteStyle")&&(ke.quoteStyle=a.quoteStyle),r(z,ke,n+1,i)}return r(z,a,n+1,i)}if(typeof e=="function"&&!lo(e)){var p=Yl(e),g=yt(e,l);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(g.length>0?" { "+ne.call(g,", ")+" }":"")}if(po(e)){var $=ze?_e.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Gn.call(e);return typeof e=="object"&&!ze?Er($):$}if(rd(e)){for(var E="<"+eo.call(String(e.nodeName)),A=e.attributes||[],S=0;S<A.length;S++)E+=" "+A[S].name+"="+co(kl(A[S].value),"double",a);return E+=">",e.childNodes&&e.childNodes.length&&(E+="..."),E+="</"+eo.call(String(e.nodeName))+">",E}if(Wn(e)){if(e.length===0)return"[]";var h=yt(e,l);return s&&!nd(h)?"["+Xn(h,s)+"]":"[ "+ne.call(h,", ")+" ]"}if(Vl(e)){var O=yt(e,l);return!("cause"in Error.prototype)&&"cause"in e&&!io.call(e,"cause")?"{ ["+String(e)+"] "+ne.call(to.call("[cause]: "+l(e.cause),O),", ")+" }":O.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+ne.call(O,", ")+" }"}if(typeof e=="object"&&o){if(uo&&typeof e[uo]=="function"&&Hn)return Hn(e,{depth:c-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Kl(e)){var T=[];return Za&&Za.call(e,function(z,ue){T.push(l(ue,e,!0)+" => "+l(z,e))}),go("Map",dt.call(e),T,s)}if(Ql(e)){var R=[];return Ja&&Ja.call(e,function(z){R.push(l(z,e))}),go("Set",pt.call(e),R,s)}if(Zl(e))return zn("WeakMap");if(ed(e))return zn("WeakSet");if(Jl(e))return zn("WeakRef");if(Hl(e))return Er(l(Number(e)));if(zl(e))return Er(l(jn.call(e)));if(Wl(e))return Er(Dl.call(e));if(Gl(e))return Er(l(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof C<"u"&&e===C)return"{ [object globalThis] }";if(!jl(e)&&!lo(e)){var b=yt(e,l),_=ao?ao(e)===Object.prototype:e instanceof Object||e.constructor===Object,m=e instanceof Object?"":"null prototype",I=!_&&$r&&Object(e)===e&&$r in e?kn.call(ve(e),8,-1):m?"Object":"",P=_||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",q=P+(I||m?"["+ne.call(to.call([],I||[],m||[]),": ")+"] ":"");return b.length===0?q+"{}":s?q+"{"+Xn(b,s)+"}":q+"{ "+ne.call(b,", ")+" }"}return String(e)};function co(r,e,t){var n=t.quoteStyle||e,i=fo[n];return i+r+i}function kl(r){return _e.call(String(r),/"/g,""")}function Te(r){return!$r||!(typeof r=="object"&&($r in r||typeof r[$r]<"u"))}function Wn(r){return ve(r)==="[object Array]"&&Te(r)}function jl(r){return ve(r)==="[object Date]"&&Te(r)}function lo(r){return ve(r)==="[object RegExp]"&&Te(r)}function Vl(r){return ve(r)==="[object Error]"&&Te(r)}function Gl(r){return ve(r)==="[object String]"&&Te(r)}function Hl(r){return ve(r)==="[object Number]"&&Te(r)}function Wl(r){return ve(r)==="[object Boolean]"&&Te(r)}function po(r){if(ze)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Gn)return!1;try{return Gn.call(r),!0}catch{}return!1}function zl(r){if(!r||typeof r!="object"||!jn)return!1;try{return jn.call(r),!0}catch{}return!1}var Xl=Object.prototype.hasOwnProperty||function(r){return r in this};function le(r,e){return Xl.call(r,e)}function ve(r){return Cl.call(r)}function Yl(r){if(r.name)return r.name;var e=Bl.call(Nl.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function ho(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,n=r.length;t<n;t++)if(r[t]===e)return t;return-1}function Kl(r){if(!dt||!r||typeof r!="object")return!1;try{dt.call(r);try{pt.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function Zl(r){if(!wr||!r||typeof r!="object")return!1;try{wr.call(r,wr);try{br.call(r,br)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function Jl(r){if(!Qa||!r||typeof r!="object")return!1;try{return Qa.call(r),!0}catch{}return!1}function Ql(r){if(!pt||!r||typeof r!="object")return!1;try{pt.call(r);try{dt.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function ed(r){if(!br||!r||typeof r!="object")return!1;try{br.call(r,br);try{wr.call(r,wr)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function rd(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function yo(r,e){if(r.length>e.maxStringLength){var t=r.length-e.maxStringLength,n="... "+t+" more character"+(t>1?"s":"");return yo(kn.call(r,0,e.maxStringLength),e)+n}var i=Ll[e.quoteStyle||"single"];i.lastIndex=0;var a=_e.call(_e.call(r,i,"\\$1"),/[\x00-\x1f]/g,td);return co(a,"single",e)}function td(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+ql.call(e.toString(16))}function Er(r){return"Object("+r+")"}function zn(r){return r+" { ? }"}function go(r,e,t,n){var i=n?Xn(t,n):ne.call(t,", ");return r+" ("+e+") {"+i+"}"}function nd(r){for(var e=0;e<r.length;e++)if(ho(r[e],`
|
|
18
18
|
`)>=0)return!1;return!0}function id(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=ne.call(Array(r.indent+1)," ");else return null;return{base:t,prev:ne.call(Array(e+1),t)}}function Xn(r,e){if(r.length===0)return"";var t=`
|
|
19
19
|
`+e.prev+e.base;return t+ne.call(r,","+t)+`
|
|
20
|
-
`+e.prev}function yt(r,e){var t=Wn(r),n=[];if(t){n.length=r.length;for(var i=0;i<r.length;i++)n[i]=le(r,i)?e(r[i],r):""}var a=typeof Vn=="function"?Vn(r):[],o;if(ze){o={};for(var u=0;u<a.length;u++)o["$"+a[u]]=a[u]}for(var f in r)le(r,f)&&(t&&String(Number(f))===f&&f<r.length||ze&&o["$"+f]instanceof Symbol||(ro.call(/[^\w$]/,f)?n.push(e(f,r)+": "+e(r[f],r)):n.push(f+": "+e(r[f],r))));if(typeof Vn=="function")for(var d=0;d<a.length;d++)io.call(r,a[d])&&n.push("["+e(a[d])+"]: "+e(r[a[d]],r));return n}var ad=ht,od=je,gt=function(r,e,t){for(var n=r,i;(i=n.next)!=null;n=i)if(i.key===e)return n.next=i.next,t||(i.next=r.next,r.next=i),i},sd=function(r,e){if(r){var t=gt(r,e);return t&&t.value}},ud=function(r,e,t){var n=gt(r,e);n?n.value=t:r.next={key:e,next:r.next,value:t}},fd=function(r,e){return r?!!gt(r,e):!1},cd=function(r,e){if(r)return gt(r,e,!0)},ld=function(){var e,t={assert:function(n){if(!t.has(n))throw new od("Side channel does not contain "+ad(n))},delete:function(n){var i=e&&e.next,a=cd(e,n);return a&&i&&i===a&&(e=void 0),!!a},get:function(n){return sd(e,n)},has:function(n){return fd(e,n)},set:function(n,i){e||(e={next:void 0}),ud(e,n,i)}};return t},_o=Object,dd=Error,pd=EvalError,hd=RangeError,yd=ReferenceError,gd=SyntaxError,_d=URIError,vd=Math.abs,md=Math.floor,wd=Math.max,bd=Math.min,$d=Math.pow,Ed=Math.round,Sd=Number.isNaN||function(e){return e!==e},Ad=Sd,Od=function(e){return Ad(e)||e===0?e:e<0?-1:1},Id=Object.getOwnPropertyDescriptor,_t=Id;if(_t)try{_t([],"length")}catch{_t=null}var vo=_t,vt=Object.defineProperty||!1;if(vt)try{vt({},"a",{value:1})}catch{vt=!1}var Pd=vt,Yn,mo;function xd(){return mo||(mo=1,Yn=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),n=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[t]=i;for(var a 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 o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var u=Object.getOwnPropertyDescriptor(e,t);if(u.value!==i||u.enumerable!==!0)return!1}return!0}),Yn}var Kn,wo;function Td(){if(wo)return Kn;wo=1;var r=typeof Symbol<"u"&&Symbol,e=xd();return Kn=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},Kn}var Zn,bo;function $o(){return bo||(bo=1,Zn=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Zn}var Jn,Eo;function So(){if(Eo)return Jn;Eo=1;var r=_o;return Jn=r.getPrototypeOf||null,Jn}var Qn,Ao;function Fd(){if(Ao)return Qn;Ao=1;var r="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,t=Math.max,n="[object Function]",i=function(f,d){for(var c=[],s=0;s<f.length;s+=1)c[s]=f[s];for(var l=0;l<d.length;l+=1)c[l+f.length]=d[l];return c},a=function(f,d){for(var c=[],s=d||0,l=0;s<f.length;s+=1,l+=1)c[l]=f[s];return c},o=function(u,f){for(var d="",c=0;c<u.length;c+=1)d+=u[c],c+1<u.length&&(d+=f);return d};return Qn=function(f){var d=this;if(typeof d!="function"||e.apply(d)!==n)throw new TypeError(r+d);for(var c=a(arguments,1),s,l=function(){if(this instanceof s){var A=d.apply(this,i(c,arguments));return Object(A)===A?A:this}return d.apply(f,i(c,arguments))},p=t(0,d.length-c.length),g=[],$=0;$<p;$++)g[$]="$"+$;if(s=Function("binder","return function ("+o(g,",")+"){ return binder.apply(this,arguments); }")(l),d.prototype){var E=function(){};E.prototype=d.prototype,s.prototype=new E,E.prototype=null}return s},Qn}var ei,Oo;function mt(){if(Oo)return ei;Oo=1;var r=Fd();return ei=Function.prototype.bind||r,ei}var ri=Function.prototype.call,ti,Io;function Po(){return Io||(Io=1,ti=Function.prototype.apply),ti}var Rd=typeof Reflect<"u"&&Reflect&&Reflect.apply,Md=mt(),Dd=Po(),Cd=ri,Nd=Rd,Bd=Nd||Md.call(Cd,Dd),qd=mt(),Ud=je,Ld=ri,kd=Bd,xo=function(e){if(e.length<1||typeof e[0]!="function")throw new Ud("a function is required");return kd(qd,Ld,e)},ni,To;function jd(){if(To)return ni;To=1;var r=xo,e=vo,t;try{t=[].__proto__===Array.prototype}catch(o){if(!o||typeof o!="object"||!("code"in o)||o.code!=="ERR_PROTO_ACCESS")throw o}var n=!!t&&e&&e(Object.prototype,"__proto__"),i=Object,a=i.getPrototypeOf;return ni=n&&typeof n.get=="function"?r([n.get]):typeof a=="function"?function(u){return a(u==null?u:i(u))}:!1,ni}var ii,Fo;function Vd(){if(Fo)return ii;Fo=1;var r=$o(),e=So(),t=jd();return ii=r?function(i){return r(i)}:e?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return e(i)}:t?function(i){return t(i)}:null,ii}var ai,Ro;function Gd(){if(Ro)return ai;Ro=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=mt();return ai=t.call(r,e),ai}var x,Hd=_o,Wd=dd,zd=pd,Xd=hd,Yd=yd,Xe=gd,Ye=je,Kd=_d,Zd=vd,Jd=md,Qd=wd,ep=bd,rp=$d,tp=Ed,np=Od,Mo=Function,oi=function(r){try{return Mo('"use strict"; return ('+r+").constructor;")()}catch{}},Sr=vo,ip=Pd,si=function(){throw new Ye},ap=Sr?function(){try{return arguments.callee,si}catch{try{return Sr(arguments,"callee").get}catch{return si}}}():si,Ke=Td()(),L=Vd(),op=So(),sp=$o(),Do=Po(),Ar=ri,Ze={},up=typeof Uint8Array>"u"||!L?x:L(Uint8Array),Fe={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?x:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?x:ArrayBuffer,"%ArrayIteratorPrototype%":Ke&&L?L([][Symbol.iterator]()):x,"%AsyncFromSyncIteratorPrototype%":x,"%AsyncFunction%":Ze,"%AsyncGenerator%":Ze,"%AsyncGeneratorFunction%":Ze,"%AsyncIteratorPrototype%":Ze,"%Atomics%":typeof Atomics>"u"?x:Atomics,"%BigInt%":typeof BigInt>"u"?x:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?x:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?x:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?x:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Wd,"%eval%":eval,"%EvalError%":zd,"%Float16Array%":typeof Float16Array>"u"?x:Float16Array,"%Float32Array%":typeof Float32Array>"u"?x:Float32Array,"%Float64Array%":typeof Float64Array>"u"?x:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?x:FinalizationRegistry,"%Function%":Mo,"%GeneratorFunction%":Ze,"%Int8Array%":typeof Int8Array>"u"?x:Int8Array,"%Int16Array%":typeof Int16Array>"u"?x:Int16Array,"%Int32Array%":typeof Int32Array>"u"?x:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ke&&L?L(L([][Symbol.iterator]())):x,"%JSON%":typeof JSON=="object"?JSON:x,"%Map%":typeof Map>"u"?x:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ke||!L?x:L(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Hd,"%Object.getOwnPropertyDescriptor%":Sr,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?x:Promise,"%Proxy%":typeof Proxy>"u"?x:Proxy,"%RangeError%":Xd,"%ReferenceError%":Yd,"%Reflect%":typeof Reflect>"u"?x:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?x:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ke||!L?x:L(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?x:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ke&&L?L(""[Symbol.iterator]()):x,"%Symbol%":Ke?Symbol:x,"%SyntaxError%":Xe,"%ThrowTypeError%":ap,"%TypedArray%":up,"%TypeError%":Ye,"%Uint8Array%":typeof Uint8Array>"u"?x:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?x:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?x:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?x:Uint32Array,"%URIError%":Kd,"%WeakMap%":typeof WeakMap>"u"?x:WeakMap,"%WeakRef%":typeof WeakRef>"u"?x:WeakRef,"%WeakSet%":typeof WeakSet>"u"?x:WeakSet,"%Function.prototype.call%":Ar,"%Function.prototype.apply%":Do,"%Object.defineProperty%":ip,"%Object.getPrototypeOf%":op,"%Math.abs%":Zd,"%Math.floor%":Jd,"%Math.max%":Qd,"%Math.min%":ep,"%Math.pow%":rp,"%Math.round%":tp,"%Math.sign%":np,"%Reflect.getPrototypeOf%":sp};if(L)try{null.error}catch(r){var fp=L(L(r));Fe["%Error.prototype%"]=fp}var cp=function r(e){var t;if(e==="%AsyncFunction%")t=oi("async function () {}");else if(e==="%GeneratorFunction%")t=oi("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=oi("async function* () {}");else if(e==="%AsyncGenerator%"){var n=r("%AsyncGeneratorFunction%");n&&(t=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=r("%AsyncGenerator%");i&&L&&(t=L(i.prototype))}return Fe[e]=t,t},Co={__proto__:null,"%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"]},Or=mt(),wt=Gd(),lp=Or.call(Ar,Array.prototype.concat),dp=Or.call(Do,Array.prototype.splice),No=Or.call(Ar,String.prototype.replace),bt=Or.call(Ar,String.prototype.slice),pp=Or.call(Ar,RegExp.prototype.exec),hp=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,yp=/\\(\\)?/g,gp=function(e){var t=bt(e,0,1),n=bt(e,-1);if(t==="%"&&n!=="%")throw new Xe("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&t!=="%")throw new Xe("invalid intrinsic syntax, expected opening `%`");var i=[];return No(e,hp,function(a,o,u,f){i[i.length]=u?No(f,yp,"$1"):o||a}),i},_p=function(e,t){var n=e,i;if(wt(Co,n)&&(i=Co[n],n="%"+i[0]+"%"),wt(Fe,n)){var a=Fe[n];if(a===Ze&&(a=cp(n)),typeof a>"u"&&!t)throw new Ye("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:a}}throw new Xe("intrinsic "+e+" does not exist!")},ui=function(e,t){if(typeof e!="string"||e.length===0)throw new Ye("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Ye('"allowMissing" argument must be a boolean');if(pp(/^%?[^%]*%?$/,e)===null)throw new Xe("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=gp(e),i=n.length>0?n[0]:"",a=_p("%"+i+"%",t),o=a.name,u=a.value,f=!1,d=a.alias;d&&(i=d[0],dp(n,lp([0,1],d)));for(var c=1,s=!0;c<n.length;c+=1){var l=n[c],p=bt(l,0,1),g=bt(l,-1);if((p==='"'||p==="'"||p==="`"||g==='"'||g==="'"||g==="`")&&p!==g)throw new Xe("property names with quotes must have matching quotes");if((l==="constructor"||!s)&&(f=!0),i+="."+l,o="%"+i+"%",wt(Fe,o))u=Fe[o];else if(u!=null){if(!(l in u)){if(!t)throw new Ye("base intrinsic for "+e+" exists, but the property is not available.");return}if(Sr&&c+1>=n.length){var $=Sr(u,l);s=!!$,s&&"get"in $&&!("originalValue"in $.get)?u=$.get:u=u[l]}else s=wt(u,l),u=u[l];s&&!f&&(Fe[o]=u)}}return u},Bo=ui,qo=xo,vp=qo([Bo("%String.prototype.indexOf%")]),Uo=function(e,t){var n=Bo(e,!!t);return typeof n=="function"&&vp(e,".prototype.")>-1?qo([n]):n},mp=ui,Ir=Uo,wp=ht,bp=je,Lo=mp("%Map%",!0),$p=Ir("Map.prototype.get",!0),Ep=Ir("Map.prototype.set",!0),Sp=Ir("Map.prototype.has",!0),Ap=Ir("Map.prototype.delete",!0),Op=Ir("Map.prototype.size",!0),ko=!!Lo&&function(){var e,t={assert:function(n){if(!t.has(n))throw new bp("Side channel does not contain "+wp(n))},delete:function(n){if(e){var i=Ap(e,n);return Op(e)===0&&(e=void 0),i}return!1},get:function(n){if(e)return $p(e,n)},has:function(n){return e?Sp(e,n):!1},set:function(n,i){e||(e=new Lo),Ep(e,n,i)}};return t},Ip=ui,$t=Uo,Pp=ht,Et=ko,xp=je,Je=Ip("%WeakMap%",!0),Tp=$t("WeakMap.prototype.get",!0),Fp=$t("WeakMap.prototype.set",!0),Rp=$t("WeakMap.prototype.has",!0),Mp=$t("WeakMap.prototype.delete",!0),Dp=Je?function(){var e,t,n={assert:function(i){if(!n.has(i))throw new xp("Side channel does not contain "+Pp(i))},delete:function(i){if(Je&&i&&(typeof i=="object"||typeof i=="function")){if(e)return Mp(e,i)}else if(Et&&t)return t.delete(i);return!1},get:function(i){return Je&&i&&(typeof i=="object"||typeof i=="function")&&e?Tp(e,i):t&&t.get(i)},has:function(i){return Je&&i&&(typeof i=="object"||typeof i=="function")&&e?Rp(e,i):!!t&&t.has(i)},set:function(i,a){Je&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new Je),Fp(e,i,a)):Et&&(t||(t=Et()),t.set(i,a))}};return n}:Et,Cp=je,Np=ht,Bp=ld,qp=ko,Up=Dp,Lp=Up||qp||Bp,jo=function(){var e,t={assert:function(n){if(!t.has(n))throw new Cp("Side channel does not contain "+Np(n))},delete:function(n){return!!e&&e.delete(n)},get:function(n){return e&&e.get(n)},has:function(n){return!!e&&e.has(n)},set:function(n,i){e||(e=Lp()),e.set(n,i)}};return t},kp=String.prototype.replace,jp=/%20/g,fi={RFC1738:"RFC1738",RFC3986:"RFC3986"},Vo={default:fi.RFC3986,formatters:{RFC1738:function(r){return kp.call(r,jp,"+")},RFC3986:function(r){return String(r)}},RFC1738:fi.RFC1738,RFC3986:fi.RFC3986},Vp=Vo,Gp=jo,ci=Object.prototype.hasOwnProperty,Re=Array.isArray,St=Gp(),Go=function(e,t){return St.set(e,t),e},At=function(e){return St.has(e)},li=function(e){return St.get(e)},Ho=function(e,t){St.set(e,t)},ie=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),Hp=function(e){for(;e.length>1;){var t=e.pop(),n=t.obj[t.prop];if(Re(n)){for(var i=[],a=0;a<n.length;++a)typeof n[a]<"u"&&i.push(n[a]);t.obj[t.prop]=i}}},di=function(e,t){for(var n=t&&t.plainObjects?{__proto__:null}:{},i=0;i<e.length;++i)typeof e[i]<"u"&&(n[i]=e[i]);return n},Wp=function r(e,t,n){if(!t)return e;if(typeof t!="object"&&typeof t!="function"){if(Re(e))e.push(t);else if(e&&typeof e=="object")if(At(e)){var i=li(e)+1;e[i]=t,Ho(e,i)}else(n&&(n.plainObjects||n.allowPrototypes)||!ci.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object"){if(At(t)){for(var a=Object.keys(t),o=n&&n.plainObjects?{__proto__:null,0:e}:{0:e},u=0;u<a.length;u++){var f=parseInt(a[u],10);o[f+1]=t[a[u]]}return Go(o,li(t)+1)}return[e].concat(t)}var d=e;return Re(e)&&!Re(t)&&(d=di(e,n)),Re(e)&&Re(t)?(t.forEach(function(c,s){if(ci.call(e,s)){var l=e[s];l&&typeof l=="object"&&c&&typeof c=="object"?e[s]=r(l,c,n):e.push(c)}else e[s]=c}),e):Object.keys(t).reduce(function(c,s){var l=t[s];return ci.call(c,s)?c[s]=r(c[s],l,n):c[s]=l,c},d)},zp=function(e,t){return Object.keys(t).reduce(function(n,i){return n[i]=t[i],n},e)},Xp=function(r,e,t){var n=r.replace(/\+/g," ");if(t==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},pi=1024,Yp=function(e,t,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(p){return"%26%23"+parseInt(p.slice(2),16)+"%3B"});for(var u="",f=0;f<o.length;f+=pi){for(var d=o.length>=pi?o.slice(f,f+pi):o,c=[],s=0;s<d.length;++s){var l=d.charCodeAt(s);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||a===Vp.RFC1738&&(l===40||l===41)){c[c.length]=d.charAt(s);continue}if(l<128){c[c.length]=ie[l];continue}if(l<2048){c[c.length]=ie[192|l>>6]+ie[128|l&63];continue}if(l<55296||l>=57344){c[c.length]=ie[224|l>>12]+ie[128|l>>6&63]+ie[128|l&63];continue}s+=1,l=65536+((l&1023)<<10|d.charCodeAt(s)&1023),c[c.length]=ie[240|l>>18]+ie[128|l>>12&63]+ie[128|l>>6&63]+ie[128|l&63]}u+=c.join("")}return u},Kp=function(e){for(var t=[{obj:{o:e},prop:"o"}],n=[],i=0;i<t.length;++i)for(var a=t[i],o=a.obj[a.prop],u=Object.keys(o),f=0;f<u.length;++f){var d=u[f],c=o[d];typeof c=="object"&&c!==null&&n.indexOf(c)===-1&&(t.push({obj:o,prop:d}),n.push(c))}return Hp(t),e},Zp=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Jp=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Qp=function(e,t,n,i){if(At(e)){var a=li(e)+1;return e[a]=t,Ho(e,a),e}var o=[].concat(e,t);return o.length>n?Go(di(o,{plainObjects:i}),o.length-1):o},eh=function(e,t){if(Re(e)){for(var n=[],i=0;i<e.length;i+=1)n.push(t(e[i]));return n}return t(e)},rh={arrayToObject:di,assign:zp,combine:Qp,compact:Kp,decode:Xp,encode:Yp,isBuffer:Jp,isOverflow:At,isRegExp:Zp,maybeMap:eh,merge:Wp},Wo=jo,Ot=rh,Pr=Vo,th=Object.prototype.hasOwnProperty,zo={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},ae=Array.isArray,nh=Array.prototype.push,Xo=function(r,e){nh.apply(r,ae(e)?e:[e])},ih=Date.prototype.toISOString,Yo=Pr.default,B={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Ot.encode,encodeValuesOnly:!1,filter:void 0,format:Yo,formatter:Pr.formatters[Yo],indices:!1,serializeDate:function(e){return ih.call(e)},skipNulls:!1,strictNullHandling:!1},ah=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},hi={},oh=function r(e,t,n,i,a,o,u,f,d,c,s,l,p,g,$,E,A,S){for(var h=e,O=S,T=0,R=!1;(O=O.get(hi))!==void 0&&!R;){var b=O.get(e);if(T+=1,typeof b<"u"){if(b===T)throw new RangeError("Cyclic object value");R=!0}typeof O.get(hi)>"u"&&(T=0)}if(typeof c=="function"?h=c(t,h):h instanceof Date?h=p(h):n==="comma"&&ae(h)&&(h=Ot.maybeMap(h,function(pa){return pa instanceof Date?p(pa):pa})),h===null){if(o)return d&&!E?d(t,B.encoder,A,"key",g):t;h=""}if(ah(h)||Ot.isBuffer(h)){if(d){var _=E?t:d(t,B.encoder,A,"key",g);return[$(_)+"="+$(d(h,B.encoder,A,"value",g))]}return[$(t)+"="+$(String(h))]}var m=[];if(typeof h>"u")return m;var I;if(n==="comma"&&ae(h))E&&d&&(h=Ot.maybeMap(h,d)),I=[{value:h.length>0?h.join(",")||null:void 0}];else if(ae(c))I=c;else{var P=Object.keys(h);I=s?P.sort(s):P}var q=f?String(t).replace(/\./g,"%2E"):String(t),z=i&&ae(h)&&h.length===1?q+"[]":q;if(a&&ae(h)&&h.length===0)return z+"[]";for(var ue=0;ue<I.length;++ue){var Z=I[ue],ke=typeof Z=="object"&&Z&&typeof Z.value<"u"?Z.value:h[Z];if(!(u&&ke===null)){var da=l&&f?String(Z).replace(/\./g,"%2E"):String(Z),ST=ae(h)?typeof n=="function"?n(z,da):z:z+(l?"."+da:"["+da+"]");S.set(e,T);var Qf=Wo();Qf.set(hi,S),Xo(m,r(ke,ST,n,i,a,o,u,f,n==="comma"&&E&&ae(h)?null:d,c,s,l,p,g,$,E,A,Qf))}}return m},sh=function(e){if(!e)return B;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var t=e.charset||B.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=Pr.default;if(typeof e.format<"u"){if(!th.call(Pr.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var i=Pr.formatters[n],a=B.filter;(typeof e.filter=="function"||ae(e.filter))&&(a=e.filter);var o;if(e.arrayFormat in zo?o=e.arrayFormat:"indices"in e?o=e.indices?"indices":"repeat":o=B.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var u=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:B.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:B.addQueryPrefix,allowDots:u,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:B.allowEmptyArrays,arrayFormat:o,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:B.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?B.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:B.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:B.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:B.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:B.encodeValuesOnly,filter:a,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:B.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:B.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:B.strictNullHandling}},uh=function(r,e){var t=r,n=sh(e),i,a;typeof n.filter=="function"?(a=n.filter,t=a("",t)):ae(n.filter)&&(a=n.filter,i=a);var o=[];if(typeof t!="object"||t===null)return"";var u=zo[n.arrayFormat],f=u==="comma"&&n.commaRoundTrip;i||(i=Object.keys(t)),n.sort&&i.sort(n.sort);for(var d=Wo(),c=0;c<i.length;++c){var s=i[c],l=t[s];n.skipNulls&&l===null||Xo(o,oh(l,s,u,f,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,d))}var p=o.join(n.delimiter),g=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?g+="utf8=%26%2310003%3B&":g+="utf8=%E2%9C%93&"),p.length>0?g+p:""},fh=$e(uh);let Ko={storeIdentifier:"",environment:"prod"};function ch(r){Ko=r}function V(){return Ko}const lh=(r,e="")=>{switch(r){case"prod":return"https://api.rechargeapps.com";case"stage":return"https://api.stage.rechargeapps.com";case"preprod":case"prestage":return`${e}/api`}},dh=(r,e="")=>{switch(r){case"prod":return"https://admin.rechargeapps.com";case"stage":return"https://admin.stage.rechargeapps.com";case"preprod":case"prestage":return e}},ph=r=>{switch(r){case"prod":case"preprod":return"https://static.rechargecdn.com";case"stage":case"prestage":return"https://static.stage.rechargecdn.com"}},Zo="/tools/recurring";class Qe{constructor(e,t){this.name="RechargeRequestError",this.message=e,this.status=t}}function F(r){return encodeURIComponent(`${r}`.trim())}function hh(r){return fh(r,{encodeValuesOnly:!0,indices:!1,arrayFormat:"comma"})}const yh=new Set(["shop_url"]);function v(r,e){return{...r,internalFnCall:r.internalFnCall??e,internalRequestId:r.internalRequestId??va()}}async function It(r,e,t={}){const n=V();return Y(r,`${ph(n.environment)}/store/${n.storeIdentifier}${e}`,t)}async function w(r,e,{id:t,query:n,data:i,headers:a}={},o){const{environment:u,environmentUri:f,storeIdentifier:d,loginRetryFn:c,__unstable_twoFactorRetryFn:s,appName:l,appVersion:p}=V();if(!d)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const g=o.apiToken;if(!g)throw new Error("No API token defined on session.");const $=lh(u,f),E={"X-Recharge-Access-Token":g,"X-Recharge-Version":"2021-11","X-Recharge-Sdk-Fn":o.internalFnCall,...l?{"X-Recharge-Sdk-App-Name":l}:{},...p?{"X-Recharge-Sdk-App-Version":p}:{},"X-Recharge-Sdk-Version":"1.90.0","X-Request-Id":o.internalRequestId,...o.tmp_fn_identifier?{"X-Recharge-Sdk-Fn-Identifier":o.tmp_fn_identifier}:{},...a||{}},A=n,S={...A?Object.fromEntries(Object.entries(A).filter(([h])=>!yh.has(h))):void 0,shop_url:d};try{return await Y(r,`${$}${e}`,{id:t,query:S,data:i,headers:E})}catch(h){if(c&&h instanceof Qe&&h.status===401)return c().then(O=>{if(O)return Y(r,`${$}${e}`,{id:t,query:S,data:i,headers:{...E,"X-Recharge-Access-Token":O.apiToken}});throw h});if(s&&h instanceof Qe&&h.status===423)return s().then(O=>{if(O)return Y(r,`${$}${e}`,{id:t,query:S,data:i,headers:{...E,"X-Recharge-Access-Token":O.apiToken}});throw h});throw h}}async function Me(r,e,t={}){return Y(r,`${Zo}${e}`,t)}async function Y(r,e,{id:t,query:n,data:i,headers:a}={}){let o=e.trim();if(t&&(o=[o,F(t)].join("/")),n){let s;[o,s]=o.split("?");const l=[s,hh(n)].join("&").replace(/^&/,"");o=`${o}${l?`?${l}`:""}`}let u;i&&r!=="get"&&(u=JSON.stringify(i));const f={Accept:"application/json","Content-Type":"application/json","X-Recharge-App":"storefront-client",...a||{}},d=await fetch(o,{method:r,headers:f,body:u});let c;try{c=await d.json()}catch{}if(!d.ok)throw d.status===502||d.status===504?new Qe("A gateway error occurred while making the request",d.status):c&&c.error?new Qe(c.error,d.status):c&&c.errors?new Qe(JSON.stringify(c.errors),d.status):new Qe("A connection error occurred while making the request");return c}function gh(r,e){return w("get","/addresses",{query:e},v(r,"listAddresses"))}async function _h(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{address:n}=await w("get","/addresses",{id:e,query:{include:t?.include}},v(r,"getAddress"));return n}async function vh(r,e){const{address:t}=await w("post","/addresses",{data:{...e,customer_id:r.customerId?Number(r.customerId):void 0}},v(r,"createAddress"));return t}async function yi(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");const{address:i}=await w("put","/addresses",{id:e,data:t,query:n},v(r,"updateAddress"));return i}async function mh(r,e,t,n){return yi(v(r,"applyDiscountToAddress"),e,{discounts:[{code:t}]},n)}async function wh(r,e,t){if(e===void 0||e==="")throw new Error("Id is required");return yi(v(r,"removeDiscountsFromAddress"),e,{discounts:[]},t)}function bh(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/addresses",{id:e},v(r,"deleteAddress"))}async function $h(r,e){const{address:t}=await w("post","/addresses/merge",{data:e},v(r,"mergeAddresses"));return t}async function Eh(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await w("post",`/addresses/${F(e)}/charges/skip`,{data:t},v(r,"skipFutureCharge"));return n}var Sh=Object.freeze({__proto__:null,applyDiscountToAddress:mh,createAddress:vh,deleteAddress:bh,getAddress:_h,listAddresses:gh,mergeAddresses:$h,removeDiscountsFromAddress:wh,skipFutureCharge:Eh,updateAddress:yi});async function Ah(){const{storefrontAccessToken:r}=V(),e={};r&&(e["X-Recharge-Storefront-Access-Token"]=r);const t=await Me("get","/access",{headers:e});return{apiToken:t.api_token,customerId:t.customer_id,message:t.message}}async function Oh(r,e){return Jo(r,e)}async function Jo(r,e){if(!r)throw new Error("Shopify storefront token is required");const{storeIdentifier:t}=V();if(!t)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const{api_token:n,customer_id:i,message:a}=await xr("post","/shopify_storefront_access",{data:{customer_token:e,storefront_token:r,shop_url:t}});return n?{apiToken:n,customerId:i,message:a}:null}async function Ih(r){const{storeIdentifier:e}=V();if(!e)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const{api_token:t,customer_id:n,message:i}=await xr("post","/shopify_customer_account_api_access",{data:{customer_token:r,shop_url:e}});return t?{apiToken:t,customerId:n,message:i}:null}async function Ph(r,e={}){if(!r)throw new Error("Email is required.");const{storeIdentifier:t}=V();if(!t)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const{send_email:n,send_sms:i}=e,a=await xr("post","/attempt_login",{data:{email:r,shop:t,...n!==void 0?{send_email:n}:{},...i!==void 0?{send_sms:i}:{}}});if(a.errors)throw new Error(a.errors);return a.session_token}async function xh(r,e={}){if(!r)throw new Error("Email is required.");const{storefrontAccessToken:t}=V(),n={};t&&(n["X-Recharge-Storefront-Access-Token"]=t);const{send_email:i,send_sms:a}=e,o=await Me("post","/attempt_login",{data:{email:r,...i!==void 0?{send_email:i}:{},...a!==void 0?{send_sms:a}:{}},headers:n});if(o.errors)throw new Error(o.errors);return o.session_token}async function Th(r,e,t){if(!r)throw new Error("Email is required.");if(!e)throw new Error("Session token is required.");if(!t)throw new Error("Code is required.");const{storeIdentifier:n}=V();if(!n)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const i=await xr("post","/validate_login",{data:{code:t,email:r,session_token:e,shop:n}});if(i.errors)throw new Error(i.errors);return{apiToken:i.api_token,customerId:i.customer_id}}async function Fh(r,e,t){if(!r)throw new Error("Email is required.");if(!e)throw new Error("Session token is required.");if(!t)throw new Error("Code is required.");const{storefrontAccessToken:n}=V(),i={};n&&(i["X-Recharge-Storefront-Access-Token"]=n);const a=await Me("post","/validate_login",{data:{code:t,email:r,session_token:e},headers:i});if(a.errors)throw new Error(a.errors);return{apiToken:a.api_token,customerId:a.customer_id}}function Rh(){const{customerHash:r}=V(),{pathname:e,search:t}=window.location,n=new URLSearchParams(t).get("token"),i=e.split("/").filter(Boolean),a=i.findIndex(u=>u==="portal"),o=a!==-1?i[a+1]:r;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 Mh(){const{customerHash:r,token:e}=Rh(),{storeIdentifier:t}=V(),n=await xr("post",`/customers/${F(r)}/access`,{data:{token:e,shop:t}});return{apiToken:n.api_token,customerId:n.customer_id}}async function xr(r,e,{id:t,query:n,data:i,headers:a}={}){const{environment:o,environmentUri:u,storefrontAccessToken:f,appName:d,appVersion:c}=V(),s=dh(o,u),l={...f?{"X-Recharge-Storefront-Access-Token":f}:{},...d?{"X-Recharge-Sdk-App-Name":d}:{},...c?{"X-Recharge-Sdk-App-Version":c}:{},"X-Recharge-Sdk-Version":"1.90.0",...a||{}};return Y(r,`${s}${e}`,{id:t,query:n,data:i,headers:l})}var Dh=Object.freeze({__proto__:null,loginCustomerPortal:Mh,loginShopifyApi:Oh,loginShopifyAppProxy:Ah,loginWithShopifyCustomerAccount:Ih,loginWithShopifyStorefront:Jo,sendPasswordlessCode:Ph,sendPasswordlessCodeAppProxy:xh,validatePasswordlessCode:Th,validatePasswordlessCodeAppProxy:Fh}),Qo={},gi={},de={},Ch=typeof C=="object"&&C&&C.Object===Object&&C,es=Ch,Nh=es,Bh=typeof self=="object"&&self&&self.Object===Object&&self,qh=Nh||Bh||Function("return this")(),pe=qh,Uh=pe,Lh=Uh.Symbol,Pt=Lh,rs=Pt,ts=Object.prototype,kh=ts.hasOwnProperty,jh=ts.toString,Tr=rs?rs.toStringTag:void 0;function Vh(r){var e=kh.call(r,Tr),t=r[Tr];try{r[Tr]=void 0;var n=!0}catch{}var i=jh.call(r);return n&&(e?r[Tr]=t:delete r[Tr]),i}var Gh=Vh,Hh=Object.prototype,Wh=Hh.toString;function zh(r){return Wh.call(r)}var Xh=zh,ns=Pt,Yh=Gh,Kh=Xh,Zh="[object Null]",Jh="[object Undefined]",is=ns?ns.toStringTag:void 0;function Qh(r){return r==null?r===void 0?Jh:Zh:is&&is in Object(r)?Yh(r):Kh(r)}var me=Qh;function ey(r){return r!=null&&typeof r=="object"}var we=ey,ry=me,ty=we,ny="[object Number]";function iy(r){return typeof r=="number"||ty(r)&&ry(r)==ny}var xt=iy,D={};function ay(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}var er=ay,oy=me,sy=er,uy="[object AsyncFunction]",fy="[object Function]",cy="[object GeneratorFunction]",ly="[object Proxy]";function dy(r){if(!sy(r))return!1;var e=oy(r);return e==fy||e==cy||e==uy||e==ly}var _i=dy,py=pe,hy=py["__core-js_shared__"],yy=hy,vi=yy,as=function(){var r=/[^.]+$/.exec(vi&&vi.keys&&vi.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function gy(r){return!!as&&as in r}var _y=gy,vy=Function.prototype,my=vy.toString;function wy(r){if(r!=null){try{return my.call(r)}catch{}try{return r+""}catch{}}return""}var os=wy,by=_i,$y=_y,Ey=er,Sy=os,Ay=/[\\^$.*+?()[\]{}|]/g,Oy=/^\[object .+?Constructor\]$/,Iy=Function.prototype,Py=Object.prototype,xy=Iy.toString,Ty=Py.hasOwnProperty,Fy=RegExp("^"+xy.call(Ty).replace(Ay,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ry(r){if(!Ey(r)||$y(r))return!1;var e=by(r)?Fy:Oy;return e.test(Sy(r))}var My=Ry;function Dy(r,e){return r?.[e]}var Cy=Dy,Ny=My,By=Cy;function qy(r,e){var t=By(r,e);return Ny(t)?t:void 0}var De=qy,Uy=De,Ly=function(){try{var r=Uy(Object,"defineProperty");return r({},"",{}),r}catch{}}(),ss=Ly,us=ss;function ky(r,e,t){e=="__proto__"&&us?us(r,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):r[e]=t}var fs=ky;function jy(r,e){return r===e||r!==r&&e!==e}var Tt=jy,Vy=fs,Gy=Tt,Hy=Object.prototype,Wy=Hy.hasOwnProperty;function zy(r,e,t){var n=r[e];(!(Wy.call(r,e)&&Gy(n,t))||t===void 0&&!(e in r))&&Vy(r,e,t)}var Xy=zy,Yy=Xy,Ky=fs;function Zy(r,e,t,n){var i=!t;t||(t={});for(var a=-1,o=e.length;++a<o;){var u=e[a],f=n?n(t[u],r[u],u,t,r):void 0;f===void 0&&(f=r[u]),i?Ky(t,u,f):Yy(t,u,f)}return t}var Jy=Zy;function Qy(r){return r}var Ft=Qy;function eg(r,e,t){switch(t.length){case 0:return r.call(e);case 1:return r.call(e,t[0]);case 2:return r.call(e,t[0],t[1]);case 3:return r.call(e,t[0],t[1],t[2])}return r.apply(e,t)}var rg=eg,tg=rg,cs=Math.max;function ng(r,e,t){return e=cs(e===void 0?r.length-1:e,0),function(){for(var n=arguments,i=-1,a=cs(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]=t(o),tg(r,this,u)}}var ig=ng;function ag(r){return function(){return r}}var og=ag,sg=og,ls=ss,ug=Ft,fg=ls?function(r,e){return ls(r,"toString",{configurable:!0,enumerable:!1,value:sg(e),writable:!0})}:ug,cg=fg,lg=800,dg=16,pg=Date.now;function hg(r){var e=0,t=0;return function(){var n=pg(),i=dg-(n-t);if(t=n,i>0){if(++e>=lg)return arguments[0]}else e=0;return r.apply(void 0,arguments)}}var yg=hg,gg=cg,_g=yg,vg=_g(gg),mg=vg,wg=Ft,bg=ig,$g=mg;function Eg(r,e){return $g(bg(r,e,wg),r+"")}var Sg=Eg,Ag=9007199254740991;function Og(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=Ag}var mi=Og,Ig=_i,Pg=mi;function xg(r){return r!=null&&Pg(r.length)&&!Ig(r)}var Fr=xg,Tg=9007199254740991,Fg=/^(?:0|[1-9]\d*)$/;function Rg(r,e){var t=typeof r;return e=e??Tg,!!e&&(t=="number"||t!="symbol"&&Fg.test(r))&&r>-1&&r%1==0&&r<e}var wi=Rg,Mg=Tt,Dg=Fr,Cg=wi,Ng=er;function Bg(r,e,t){if(!Ng(t))return!1;var n=typeof e;return(n=="number"?Dg(t)&&Cg(e,t.length):n=="string"&&e in t)?Mg(t[e],r):!1}var ds=Bg,qg=Sg,Ug=ds;function Lg(r){return qg(function(e,t){var n=-1,i=t.length,a=i>1?t[i-1]:void 0,o=i>2?t[2]:void 0;for(a=r.length>3&&typeof a=="function"?(i--,a):void 0,o&&Ug(t[0],t[1],o)&&(a=i<3?void 0:a,i=1),e=Object(e);++n<i;){var u=t[n];u&&r(e,u,n,a)}return e})}var kg=Lg;function jg(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}var ps=jg,Vg=me,Gg=we,Hg="[object Arguments]";function Wg(r){return Gg(r)&&Vg(r)==Hg}var zg=Wg,hs=zg,Xg=we,ys=Object.prototype,Yg=ys.hasOwnProperty,Kg=ys.propertyIsEnumerable,Zg=hs(function(){return arguments}())?hs:function(r){return Xg(r)&&Yg.call(r,"callee")&&!Kg.call(r,"callee")},gs=Zg,Jg=Array.isArray,G=Jg,Rt={exports:{}};function Qg(){return!1}var e_=Qg;Rt.exports,function(r,e){var t=pe,n=e_,i=e&&!e.nodeType&&e,a=i&&!0&&r&&!r.nodeType&&r,o=a&&a.exports===i,u=o?t.Buffer:void 0,f=u?u.isBuffer:void 0,d=f||n;r.exports=d}(Rt,Rt.exports);var _s=Rt.exports,r_=me,t_=mi,n_=we,i_="[object Arguments]",a_="[object Array]",o_="[object Boolean]",s_="[object Date]",u_="[object Error]",f_="[object Function]",c_="[object Map]",l_="[object Number]",d_="[object Object]",p_="[object RegExp]",h_="[object Set]",y_="[object String]",g_="[object WeakMap]",__="[object ArrayBuffer]",v_="[object DataView]",m_="[object Float32Array]",w_="[object Float64Array]",b_="[object Int8Array]",$_="[object Int16Array]",E_="[object Int32Array]",S_="[object Uint8Array]",A_="[object Uint8ClampedArray]",O_="[object Uint16Array]",I_="[object Uint32Array]",M={};M[m_]=M[w_]=M[b_]=M[$_]=M[E_]=M[S_]=M[A_]=M[O_]=M[I_]=!0,M[i_]=M[a_]=M[__]=M[o_]=M[v_]=M[s_]=M[u_]=M[f_]=M[c_]=M[l_]=M[d_]=M[p_]=M[h_]=M[y_]=M[g_]=!1;function P_(r){return n_(r)&&t_(r.length)&&!!M[r_(r)]}var x_=P_;function T_(r){return function(e){return r(e)}}var F_=T_,Mt={exports:{}};Mt.exports,function(r,e){var t=es,n=e&&!e.nodeType&&e,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,o=a&&t.process,u=function(){try{var f=i&&i.require&&i.require("util").types;return f||o&&o.binding&&o.binding("util")}catch{}}();r.exports=u}(Mt,Mt.exports);var R_=Mt.exports,M_=x_,D_=F_,vs=R_,ms=vs&&vs.isTypedArray,C_=ms?D_(ms):M_,ws=C_,N_=ps,B_=gs,q_=G,U_=_s,L_=wi,k_=ws,j_=Object.prototype,V_=j_.hasOwnProperty;function G_(r,e){var t=q_(r),n=!t&&B_(r),i=!t&&!n&&U_(r),a=!t&&!n&&!i&&k_(r),o=t||n||i||a,u=o?N_(r.length,String):[],f=u.length;for(var d in r)(e||V_.call(r,d))&&!(o&&(d=="length"||i&&(d=="offset"||d=="parent")||a&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||L_(d,f)))&&u.push(d);return u}var bs=G_,H_=Object.prototype;function W_(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||H_;return r===t}var $s=W_;function z_(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e}var X_=z_,Y_=er,K_=$s,Z_=X_,J_=Object.prototype,Q_=J_.hasOwnProperty;function ev(r){if(!Y_(r))return Z_(r);var e=K_(r),t=[];for(var n in r)n=="constructor"&&(e||!Q_.call(r,n))||t.push(n);return t}var rv=ev,tv=bs,nv=rv,iv=Fr;function av(r){return iv(r)?tv(r,!0):nv(r)}var ov=av,sv=Jy,uv=kg,fv=ov,cv=uv(function(r,e){sv(e,fv(e),r)}),lv=cv,dv=lv,Dt={},Ce={};function pv(r,e){for(var t=-1,n=r==null?0:r.length;++t<n;)if(!e(r[t],t,r))return!1;return!0}var hv=pv;function yv(r){return function(e,t,n){for(var i=-1,a=Object(e),o=n(e),u=o.length;u--;){var f=o[r?u:++i];if(t(a[f],f,a)===!1)break}return e}}var gv=yv,_v=gv,vv=_v(),mv=vv;function wv(r,e){return function(t){return r(e(t))}}var bv=wv,$v=bv,Ev=$v(Object.keys,Object),Sv=Ev,Av=$s,Ov=Sv,Iv=Object.prototype,Pv=Iv.hasOwnProperty;function xv(r){if(!Av(r))return Ov(r);var e=[];for(var t in Object(r))Pv.call(r,t)&&t!="constructor"&&e.push(t);return e}var Tv=xv,Fv=bs,Rv=Tv,Mv=Fr;function Dv(r){return Mv(r)?Fv(r):Rv(r)}var Ct=Dv,Cv=mv,Nv=Ct;function Bv(r,e){return r&&Cv(r,e,Nv)}var qv=Bv,Uv=Fr;function Lv(r,e){return function(t,n){if(t==null)return t;if(!Uv(t))return r(t,n);for(var i=t.length,a=e?i:-1,o=Object(t);(e?a--:++a<i)&&n(o[a],a,o)!==!1;);return t}}var kv=Lv,jv=qv,Vv=kv,Gv=Vv(jv),bi=Gv,Hv=bi;function Wv(r,e){var t=!0;return Hv(r,function(n,i,a){return t=!!e(n,i,a),t}),t}var zv=Wv;function Xv(){this.__data__=[],this.size=0}var Yv=Xv,Kv=Tt;function Zv(r,e){for(var t=r.length;t--;)if(Kv(r[t][0],e))return t;return-1}var Nt=Zv,Jv=Nt,Qv=Array.prototype,em=Qv.splice;function rm(r){var e=this.__data__,t=Jv(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():em.call(e,t,1),--this.size,!0}var tm=rm,nm=Nt;function im(r){var e=this.__data__,t=nm(e,r);return t<0?void 0:e[t][1]}var am=im,om=Nt;function sm(r){return om(this.__data__,r)>-1}var um=sm,fm=Nt;function cm(r,e){var t=this.__data__,n=fm(t,r);return n<0?(++this.size,t.push([r,e])):t[n][1]=e,this}var lm=cm,dm=Yv,pm=tm,hm=am,ym=um,gm=lm;function rr(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}rr.prototype.clear=dm,rr.prototype.delete=pm,rr.prototype.get=hm,rr.prototype.has=ym,rr.prototype.set=gm;var Bt=rr,_m=Bt;function vm(){this.__data__=new _m,this.size=0}var mm=vm;function wm(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}var bm=wm;function $m(r){return this.__data__.get(r)}var Em=$m;function Sm(r){return this.__data__.has(r)}var Am=Sm,Om=De,Im=pe,Pm=Om(Im,"Map"),$i=Pm,xm=De,Tm=xm(Object,"create"),qt=Tm,Es=qt;function Fm(){this.__data__=Es?Es(null):{},this.size=0}var Rm=Fm;function Mm(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}var Dm=Mm,Cm=qt,Nm="__lodash_hash_undefined__",Bm=Object.prototype,qm=Bm.hasOwnProperty;function Um(r){var e=this.__data__;if(Cm){var t=e[r];return t===Nm?void 0:t}return qm.call(e,r)?e[r]:void 0}var Lm=Um,km=qt,jm=Object.prototype,Vm=jm.hasOwnProperty;function Gm(r){var e=this.__data__;return km?e[r]!==void 0:Vm.call(e,r)}var Hm=Gm,Wm=qt,zm="__lodash_hash_undefined__";function Xm(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=Wm&&e===void 0?zm:e,this}var Ym=Xm,Km=Rm,Zm=Dm,Jm=Lm,Qm=Hm,ew=Ym;function tr(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}tr.prototype.clear=Km,tr.prototype.delete=Zm,tr.prototype.get=Jm,tr.prototype.has=Qm,tr.prototype.set=ew;var rw=tr,Ss=rw,tw=Bt,nw=$i;function iw(){this.size=0,this.__data__={hash:new Ss,map:new(nw||tw),string:new Ss}}var aw=iw;function ow(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}var sw=ow,uw=sw;function fw(r,e){var t=r.__data__;return uw(e)?t[typeof e=="string"?"string":"hash"]:t.map}var Ut=fw,cw=Ut;function lw(r){var e=cw(this,r).delete(r);return this.size-=e?1:0,e}var dw=lw,pw=Ut;function hw(r){return pw(this,r).get(r)}var yw=hw,gw=Ut;function _w(r){return gw(this,r).has(r)}var vw=_w,mw=Ut;function ww(r,e){var t=mw(this,r),n=t.size;return t.set(r,e),this.size+=t.size==n?0:1,this}var bw=ww,$w=aw,Ew=dw,Sw=yw,Aw=vw,Ow=bw;function nr(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}nr.prototype.clear=$w,nr.prototype.delete=Ew,nr.prototype.get=Sw,nr.prototype.has=Aw,nr.prototype.set=Ow;var Ei=nr,Iw=Bt,Pw=$i,xw=Ei,Tw=200;function Fw(r,e){var t=this.__data__;if(t instanceof Iw){var n=t.__data__;if(!Pw||n.length<Tw-1)return n.push([r,e]),this.size=++t.size,this;t=this.__data__=new xw(n)}return t.set(r,e),this.size=t.size,this}var Rw=Fw,Mw=Bt,Dw=mm,Cw=bm,Nw=Em,Bw=Am,qw=Rw;function ir(r){var e=this.__data__=new Mw(r);this.size=e.size}ir.prototype.clear=Dw,ir.prototype.delete=Cw,ir.prototype.get=Nw,ir.prototype.has=Bw,ir.prototype.set=qw;var As=ir,Uw="__lodash_hash_undefined__";function Lw(r){return this.__data__.set(r,Uw),this}var kw=Lw;function jw(r){return this.__data__.has(r)}var Vw=jw,Gw=Ei,Hw=kw,Ww=Vw;function Lt(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new Gw;++e<t;)this.add(r[e])}Lt.prototype.add=Lt.prototype.push=Hw,Lt.prototype.has=Ww;var zw=Lt;function Xw(r,e){for(var t=-1,n=r==null?0:r.length;++t<n;)if(e(r[t],t,r))return!0;return!1}var Yw=Xw;function Kw(r,e){return r.has(e)}var Zw=Kw,Jw=zw,Qw=Yw,e0=Zw,r0=1,t0=2;function n0(r,e,t,n,i,a){var o=t&r0,u=r.length,f=e.length;if(u!=f&&!(o&&f>u))return!1;var d=a.get(r),c=a.get(e);if(d&&c)return d==e&&c==r;var s=-1,l=!0,p=t&t0?new Jw:void 0;for(a.set(r,e),a.set(e,r);++s<u;){var g=r[s],$=e[s];if(n)var E=o?n($,g,s,e,r,a):n(g,$,s,r,e,a);if(E!==void 0){if(E)continue;l=!1;break}if(p){if(!Qw(e,function(A,S){if(!e0(p,S)&&(g===A||i(g,A,t,n,a)))return p.push(S)})){l=!1;break}}else if(!(g===$||i(g,$,t,n,a))){l=!1;break}}return a.delete(r),a.delete(e),l}var Os=n0,i0=pe,a0=i0.Uint8Array,o0=a0;function s0(r){var e=-1,t=Array(r.size);return r.forEach(function(n,i){t[++e]=[i,n]}),t}var u0=s0;function f0(r){var e=-1,t=Array(r.size);return r.forEach(function(n){t[++e]=n}),t}var c0=f0,Is=Pt,Ps=o0,l0=Tt,d0=Os,p0=u0,h0=c0,y0=1,g0=2,_0="[object Boolean]",v0="[object Date]",m0="[object Error]",w0="[object Map]",b0="[object Number]",$0="[object RegExp]",E0="[object Set]",S0="[object String]",A0="[object Symbol]",O0="[object ArrayBuffer]",I0="[object DataView]",xs=Is?Is.prototype:void 0,Si=xs?xs.valueOf:void 0;function P0(r,e,t,n,i,a,o){switch(t){case I0:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case O0:return!(r.byteLength!=e.byteLength||!a(new Ps(r),new Ps(e)));case _0:case v0:case b0:return l0(+r,+e);case m0:return r.name==e.name&&r.message==e.message;case $0:case S0:return r==e+"";case w0:var u=p0;case E0:var f=n&y0;if(u||(u=h0),r.size!=e.size&&!f)return!1;var d=o.get(r);if(d)return d==e;n|=g0,o.set(r,e);var c=d0(u(r),u(e),n,i,a,o);return o.delete(r),c;case A0:if(Si)return Si.call(r)==Si.call(e)}return!1}var x0=P0;function T0(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r}var F0=T0,R0=F0,M0=G;function D0(r,e,t){var n=e(r);return M0(r)?n:R0(n,t(r))}var C0=D0;function N0(r,e){for(var t=-1,n=r==null?0:r.length,i=0,a=[];++t<n;){var o=r[t];e(o,t,r)&&(a[i++]=o)}return a}var B0=N0;function q0(){return[]}var U0=q0,L0=B0,k0=U0,j0=Object.prototype,V0=j0.propertyIsEnumerable,Ts=Object.getOwnPropertySymbols,G0=Ts?function(r){return r==null?[]:(r=Object(r),L0(Ts(r),function(e){return V0.call(r,e)}))}:k0,H0=G0,W0=C0,z0=H0,X0=Ct;function Y0(r){return W0(r,X0,z0)}var K0=Y0,Fs=K0,Z0=1,J0=Object.prototype,Q0=J0.hasOwnProperty;function eb(r,e,t,n,i,a){var o=t&Z0,u=Fs(r),f=u.length,d=Fs(e),c=d.length;if(f!=c&&!o)return!1;for(var s=f;s--;){var l=u[s];if(!(o?l in e:Q0.call(e,l)))return!1}var p=a.get(r),g=a.get(e);if(p&&g)return p==e&&g==r;var $=!0;a.set(r,e),a.set(e,r);for(var E=o;++s<f;){l=u[s];var A=r[l],S=e[l];if(n)var h=o?n(S,A,l,e,r,a):n(A,S,l,r,e,a);if(!(h===void 0?A===S||i(A,S,t,n,a):h)){$=!1;break}E||(E=l=="constructor")}if($&&!E){var O=r.constructor,T=e.constructor;O!=T&&"constructor"in r&&"constructor"in e&&!(typeof O=="function"&&O instanceof O&&typeof T=="function"&&T instanceof T)&&($=!1)}return a.delete(r),a.delete(e),$}var rb=eb,tb=De,nb=pe,ib=tb(nb,"DataView"),ab=ib,ob=De,sb=pe,ub=ob(sb,"Promise"),fb=ub,cb=De,lb=pe,db=cb(lb,"Set"),pb=db,hb=De,yb=pe,gb=hb(yb,"WeakMap"),_b=gb,Ai=ab,Oi=$i,Ii=fb,Pi=pb,xi=_b,Rs=me,ar=os,Ms="[object Map]",vb="[object Object]",Ds="[object Promise]",Cs="[object Set]",Ns="[object WeakMap]",Bs="[object DataView]",mb=ar(Ai),wb=ar(Oi),bb=ar(Ii),$b=ar(Pi),Eb=ar(xi),Ne=Rs;(Ai&&Ne(new Ai(new ArrayBuffer(1)))!=Bs||Oi&&Ne(new Oi)!=Ms||Ii&&Ne(Ii.resolve())!=Ds||Pi&&Ne(new Pi)!=Cs||xi&&Ne(new xi)!=Ns)&&(Ne=function(r){var e=Rs(r),t=e==vb?r.constructor:void 0,n=t?ar(t):"";if(n)switch(n){case mb:return Bs;case wb:return Ms;case bb:return Ds;case $b:return Cs;case Eb:return Ns}return e});var Sb=Ne,Ti=As,Ab=Os,Ob=x0,Ib=rb,qs=Sb,Us=G,Ls=_s,Pb=ws,xb=1,ks="[object Arguments]",js="[object Array]",kt="[object Object]",Tb=Object.prototype,Vs=Tb.hasOwnProperty;function Fb(r,e,t,n,i,a){var o=Us(r),u=Us(e),f=o?js:qs(r),d=u?js:qs(e);f=f==ks?kt:f,d=d==ks?kt:d;var c=f==kt,s=d==kt,l=f==d;if(l&&Ls(r)){if(!Ls(e))return!1;o=!0,c=!1}if(l&&!c)return a||(a=new Ti),o||Pb(r)?Ab(r,e,t,n,i,a):Ob(r,e,f,t,n,i,a);if(!(t&xb)){var p=c&&Vs.call(r,"__wrapped__"),g=s&&Vs.call(e,"__wrapped__");if(p||g){var $=p?r.value():r,E=g?e.value():e;return a||(a=new Ti),i($,E,t,n,a)}}return l?(a||(a=new Ti),Ib(r,e,t,n,i,a)):!1}var Rb=Fb,Mb=Rb,Gs=we;function Hs(r,e,t,n,i){return r===e?!0:r==null||e==null||!Gs(r)&&!Gs(e)?r!==r&&e!==e:Mb(r,e,t,n,Hs,i)}var Ws=Hs,Db=As,Cb=Ws,Nb=1,Bb=2;function qb(r,e,t,n){var i=t.length,a=i,o=!n;if(r==null)return!a;for(r=Object(r);i--;){var u=t[i];if(o&&u[2]?u[1]!==r[u[0]]:!(u[0]in r))return!1}for(;++i<a;){u=t[i];var f=u[0],d=r[f],c=u[1];if(o&&u[2]){if(d===void 0&&!(f in r))return!1}else{var s=new Db;if(n)var l=n(d,c,f,r,e,s);if(!(l===void 0?Cb(c,d,Nb|Bb,n,s):l))return!1}}return!0}var Ub=qb,Lb=er;function kb(r){return r===r&&!Lb(r)}var zs=kb,jb=zs,Vb=Ct;function Gb(r){for(var e=Vb(r),t=e.length;t--;){var n=e[t],i=r[n];e[t]=[n,i,jb(i)]}return e}var Hb=Gb;function Wb(r,e){return function(t){return t==null?!1:t[r]===e&&(e!==void 0||r in Object(t))}}var Xs=Wb,zb=Ub,Xb=Hb,Yb=Xs;function Kb(r){var e=Xb(r);return e.length==1&&e[0][2]?Yb(e[0][0],e[0][1]):function(t){return t===r||zb(t,r,e)}}var Zb=Kb,Jb=me,Qb=we,e1="[object Symbol]";function r1(r){return typeof r=="symbol"||Qb(r)&&Jb(r)==e1}var jt=r1,t1=G,n1=jt,i1=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a1=/^\w*$/;function o1(r,e){if(t1(r))return!1;var t=typeof r;return t=="number"||t=="symbol"||t=="boolean"||r==null||n1(r)?!0:a1.test(r)||!i1.test(r)||e!=null&&r in Object(e)}var Fi=o1,Ys=Ei,s1="Expected a function";function Ri(r,e){if(typeof r!="function"||e!=null&&typeof e!="function")throw new TypeError(s1);var t=function(){var n=arguments,i=e?e.apply(this,n):n[0],a=t.cache;if(a.has(i))return a.get(i);var o=r.apply(this,n);return t.cache=a.set(i,o)||a,o};return t.cache=new(Ri.Cache||Ys),t}Ri.Cache=Ys;var u1=Ri,f1=u1,c1=500;function l1(r){var e=f1(r,function(n){return t.size===c1&&t.clear(),n}),t=e.cache;return e}var d1=l1,p1=d1,h1=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,y1=/\\(\\)?/g,g1=p1(function(r){var e=[];return r.charCodeAt(0)===46&&e.push(""),r.replace(h1,function(t,n,i,a){e.push(i?a.replace(y1,"$1"):n||t)}),e}),_1=g1;function v1(r,e){for(var t=-1,n=r==null?0:r.length,i=Array(n);++t<n;)i[t]=e(r[t],t,r);return i}var Mi=v1,Ks=Pt,m1=Mi,w1=G,b1=jt,$1=1/0,Zs=Ks?Ks.prototype:void 0,Js=Zs?Zs.toString:void 0;function Qs(r){if(typeof r=="string")return r;if(w1(r))return m1(r,Qs)+"";if(b1(r))return Js?Js.call(r):"";var e=r+"";return e=="0"&&1/r==-$1?"-0":e}var E1=Qs,S1=E1;function A1(r){return r==null?"":S1(r)}var O1=A1,I1=G,P1=Fi,x1=_1,T1=O1;function F1(r,e){return I1(r)?r:P1(r,e)?[r]:x1(T1(r))}var eu=F1,R1=jt,M1=1/0;function D1(r){if(typeof r=="string"||R1(r))return r;var e=r+"";return e=="0"&&1/r==-M1?"-0":e}var Vt=D1,C1=eu,N1=Vt;function B1(r,e){e=C1(e,r);for(var t=0,n=e.length;r!=null&&t<n;)r=r[N1(e[t++])];return t&&t==n?r:void 0}var ru=B1,q1=ru;function U1(r,e,t){var n=r==null?void 0:q1(r,e);return n===void 0?t:n}var L1=U1;function k1(r,e){return r!=null&&e in Object(r)}var j1=k1,V1=eu,G1=gs,H1=G,W1=wi,z1=mi,X1=Vt;function Y1(r,e,t){e=V1(e,r);for(var n=-1,i=e.length,a=!1;++n<i;){var o=X1(e[n]);if(!(a=r!=null&&t(r,o)))break;r=r[o]}return a||++n!=i?a:(i=r==null?0:r.length,!!i&&z1(i)&&W1(o,i)&&(H1(r)||G1(r)))}var K1=Y1,Z1=j1,J1=K1;function Q1(r,e){return r!=null&&J1(r,e,Z1)}var e$=Q1,r$=Ws,t$=L1,n$=e$,i$=Fi,a$=zs,o$=Xs,s$=Vt,u$=1,f$=2;function c$(r,e){return i$(r)&&a$(e)?o$(s$(r),e):function(t){var n=t$(t,r);return n===void 0&&n===e?n$(t,r):r$(e,n,u$|f$)}}var l$=c$;function d$(r){return function(e){return e?.[r]}}var p$=d$,h$=ru;function y$(r){return function(e){return h$(e,r)}}var g$=y$,_$=p$,v$=g$,m$=Fi,w$=Vt;function b$(r){return m$(r)?_$(w$(r)):v$(r)}var $$=b$,E$=Zb,S$=l$,A$=Ft,O$=G,I$=$$;function P$(r){return typeof r=="function"?r:r==null?A$:typeof r=="object"?O$(r)?S$(r[0],r[1]):E$(r):I$(r)}var tu=P$,x$=hv,T$=zv,F$=tu,R$=G,M$=ds;function D$(r,e,t){var n=R$(r)?x$:T$;return t&&M$(r,e,t)&&(e=void 0),n(r,F$(e))}var Di=D$;Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.calculatePadding=q$,Ce.slicePadding=U$;var C$=Di,N$=B$(C$);function B$(r){return r&&r.__esModule?r:{default:r}}function q$(r){switch(r%4){case 0:return 0;case 1:return 3;case 2:return 2;case 3:return 1;default:return null}}function U$(r,e){var t=r.slice(e),n=(0,N$.default)(t.buffer(),function(i){return i===0});if(n!==!0)throw new Error("XDR Read Error: invalid padding")}Object.defineProperty(Dt,"__esModule",{value:!0}),Dt.Cursor=void 0;var L$=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),k$=Ce;function j$(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var Ci=function(){function r(e){j$(this,r),e instanceof y||(e=typeof e=="number"?y.alloc(e):y.from(e)),this._setBuffer(e),this.rewind()}return L$(r,[{key:"_setBuffer",value:function(t){this._buffer=t,this.length=t.length}},{key:"buffer",value:function(){return this._buffer}},{key:"tap",value:function(t){return t(this),this}},{key:"clone",value:function(t){var n=new this.constructor(this.buffer());return n.seek(arguments.length===0?this.tell():t),n}},{key:"tell",value:function(){return this._index}},{key:"seek",value:function(t,n){return arguments.length===1&&(n=t,t="="),t==="+"?this._index+=n:t==="-"?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(t,n,i){return this.seek("+",this.buffer().write(t,this.tell(),n,i))}},{key:"fill",value:function(t,n){return arguments.length===1&&(n=this.buffer().length-this.tell()),this.buffer().fill(t,this.tell(),this.tell()+n),this.seek("+",n),this}},{key:"slice",value:function(t){arguments.length===0&&(t=this.length-this.tell());var n=new this.constructor(this.buffer().slice(this.tell(),this.tell()+t));return this.seek("+",t),n}},{key:"copyFrom",value:function(t){var n=t instanceof y?t:t.buffer();return n.copy(this.buffer(),this.tell(),0,n.length),this.seek("+",n.length),this}},{key:"concat",value:function(t){t.forEach(function(i,a){i instanceof r&&(t[a]=i.buffer())}),t.unshift(this.buffer());var n=y.concat(t);return this._setBuffer(n),this}},{key:"toString",value:function(t,n){arguments.length===0?(t="utf8",n=this.buffer().length-this.tell()):arguments.length===1&&(n=this.buffer().length-this.tell());var i=this.buffer().toString(t,this.tell(),this.tell()+n);return this.seek("+",n),i}},{key:"writeBufferPadded",value:function(t){var n=(0,k$.calculatePadding)(t.length),i=y.alloc(n);return this.copyFrom(new r(t)).copyFrom(new r(i))}}]),r}();[[1,["readInt8","readUInt8"]],[2,["readInt16BE","readInt16LE","readUInt16BE","readUInt16LE"]],[4,["readInt32BE","readInt32LE","readUInt32BE","readUInt32LE","readFloatBE","readFloatLE"]],[8,["readDoubleBE","readDoubleLE"]]].forEach(function(r){r[1].forEach(function(e){Ci.prototype[e]=function(){var n=this.buffer()[e](this.tell());return this.seek("+",r[0]),n}})}),[[1,["writeInt8","writeUInt8"]],[2,["writeInt16BE","writeInt16LE","writeUInt16BE","writeUInt16LE"]],[4,["writeInt32BE","writeInt32LE","writeUInt32BE","writeUInt32LE","writeFloatBE","writeFloatLE"]],[8,["writeDoubleBE","writeDoubleLE"]]].forEach(function(r){r[1].forEach(function(e){Ci.prototype[e]=function(n){return this.buffer()[e](n,this.tell()),this.seek("+",r[0]),this}})}),Dt.Cursor=Ci,Object.defineProperty(D,"__esModule",{value:!0}),D.default=Y$;var V$=dv,nu=au(V$),G$=_i,H$=au(G$),iu=Dt;function au(r){return r&&r.__esModule?r:{default:r}}var W$=Math.pow(2,16),z$={toXDR:function(e){var t=new iu.Cursor(W$);this.write(e,t);var n=t.tell();return t.rewind(),t.slice(n).buffer()},fromXDR:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"raw",n=void 0;switch(t){case"raw":n=e;break;case"hex":n=y.from(e,"hex");break;case"base64":n=y.from(e,"base64");break;default:throw new Error("Invalid format "+t+', must be "raw", "hex", "base64"')}var i=new iu.Cursor(n),a=this.read(i);return a},validateXDR:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"raw";try{return this.fromXDR(e,t),!0}catch{return!1}}},X$={toXDR:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"raw",t=this.constructor.toXDR(this);switch(e){case"raw":return t;case"hex":return t.toString("hex");case"base64":return t.toString("base64");default:throw new Error("Invalid format "+e+', must be "raw", "hex", "base64"')}}};function Y$(r){(0,nu.default)(r,z$),(0,H$.default)(r)&&(0,nu.default)(r.prototype,X$)}Object.defineProperty(de,"__esModule",{value:!0}),de.Int=void 0;var K$=xt,ou=su(K$),Z$=D,J$=su(Z$);function su(r){return r&&r.__esModule?r:{default:r}}var Rr=de.Int={read:function(e){return e.readInt32BE()},write:function(e,t){if(!(0,ou.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");t.writeInt32BE(e)},isValid:function(e){return!(0,ou.default)(e)||Math.floor(e)!==e?!1:e>=Rr.MIN_VALUE&&e<=Rr.MAX_VALUE}};Rr.MAX_VALUE=Math.pow(2,31)-1,Rr.MIN_VALUE=-Math.pow(2,31),(0,J$.default)(Rr);var Gt={};function Q$(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var uu={exports:{}};(function(r){/**
|
|
20
|
+
`+e.prev}function yt(r,e){var t=Wn(r),n=[];if(t){n.length=r.length;for(var i=0;i<r.length;i++)n[i]=le(r,i)?e(r[i],r):""}var a=typeof Vn=="function"?Vn(r):[],o;if(ze){o={};for(var u=0;u<a.length;u++)o["$"+a[u]]=a[u]}for(var f in r)le(r,f)&&(t&&String(Number(f))===f&&f<r.length||ze&&o["$"+f]instanceof Symbol||(ro.call(/[^\w$]/,f)?n.push(e(f,r)+": "+e(r[f],r)):n.push(f+": "+e(r[f],r))));if(typeof Vn=="function")for(var d=0;d<a.length;d++)io.call(r,a[d])&&n.push("["+e(a[d])+"]: "+e(r[a[d]],r));return n}var ad=ht,od=je,gt=function(r,e,t){for(var n=r,i;(i=n.next)!=null;n=i)if(i.key===e)return n.next=i.next,t||(i.next=r.next,r.next=i),i},sd=function(r,e){if(r){var t=gt(r,e);return t&&t.value}},ud=function(r,e,t){var n=gt(r,e);n?n.value=t:r.next={key:e,next:r.next,value:t}},fd=function(r,e){return r?!!gt(r,e):!1},cd=function(r,e){if(r)return gt(r,e,!0)},ld=function(){var e,t={assert:function(n){if(!t.has(n))throw new od("Side channel does not contain "+ad(n))},delete:function(n){var i=e&&e.next,a=cd(e,n);return a&&i&&i===a&&(e=void 0),!!a},get:function(n){return sd(e,n)},has:function(n){return fd(e,n)},set:function(n,i){e||(e={next:void 0}),ud(e,n,i)}};return t},_o=Object,dd=Error,pd=EvalError,hd=RangeError,yd=ReferenceError,gd=SyntaxError,_d=URIError,vd=Math.abs,md=Math.floor,wd=Math.max,bd=Math.min,$d=Math.pow,Ed=Math.round,Sd=Number.isNaN||function(e){return e!==e},Ad=Sd,Od=function(e){return Ad(e)||e===0?e:e<0?-1:1},Id=Object.getOwnPropertyDescriptor,_t=Id;if(_t)try{_t([],"length")}catch{_t=null}var vo=_t,vt=Object.defineProperty||!1;if(vt)try{vt({},"a",{value:1})}catch{vt=!1}var Pd=vt,Yn,mo;function xd(){return mo||(mo=1,Yn=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),n=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[t]=i;for(var a 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 o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var u=Object.getOwnPropertyDescriptor(e,t);if(u.value!==i||u.enumerable!==!0)return!1}return!0}),Yn}var Kn,wo;function Td(){if(wo)return Kn;wo=1;var r=typeof Symbol<"u"&&Symbol,e=xd();return Kn=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},Kn}var Zn,bo;function $o(){return bo||(bo=1,Zn=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Zn}var Jn,Eo;function So(){if(Eo)return Jn;Eo=1;var r=_o;return Jn=r.getPrototypeOf||null,Jn}var Qn,Ao;function Fd(){if(Ao)return Qn;Ao=1;var r="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,t=Math.max,n="[object Function]",i=function(f,d){for(var c=[],s=0;s<f.length;s+=1)c[s]=f[s];for(var l=0;l<d.length;l+=1)c[l+f.length]=d[l];return c},a=function(f,d){for(var c=[],s=d||0,l=0;s<f.length;s+=1,l+=1)c[l]=f[s];return c},o=function(u,f){for(var d="",c=0;c<u.length;c+=1)d+=u[c],c+1<u.length&&(d+=f);return d};return Qn=function(f){var d=this;if(typeof d!="function"||e.apply(d)!==n)throw new TypeError(r+d);for(var c=a(arguments,1),s,l=function(){if(this instanceof s){var A=d.apply(this,i(c,arguments));return Object(A)===A?A:this}return d.apply(f,i(c,arguments))},p=t(0,d.length-c.length),g=[],$=0;$<p;$++)g[$]="$"+$;if(s=Function("binder","return function ("+o(g,",")+"){ return binder.apply(this,arguments); }")(l),d.prototype){var E=function(){};E.prototype=d.prototype,s.prototype=new E,E.prototype=null}return s},Qn}var ei,Oo;function mt(){if(Oo)return ei;Oo=1;var r=Fd();return ei=Function.prototype.bind||r,ei}var ri=Function.prototype.call,ti,Io;function Po(){return Io||(Io=1,ti=Function.prototype.apply),ti}var Rd=typeof Reflect<"u"&&Reflect&&Reflect.apply,Md=mt(),Dd=Po(),Cd=ri,Nd=Rd,Bd=Nd||Md.call(Cd,Dd),qd=mt(),Ud=je,Ld=ri,kd=Bd,xo=function(e){if(e.length<1||typeof e[0]!="function")throw new Ud("a function is required");return kd(qd,Ld,e)},ni,To;function jd(){if(To)return ni;To=1;var r=xo,e=vo,t;try{t=[].__proto__===Array.prototype}catch(o){if(!o||typeof o!="object"||!("code"in o)||o.code!=="ERR_PROTO_ACCESS")throw o}var n=!!t&&e&&e(Object.prototype,"__proto__"),i=Object,a=i.getPrototypeOf;return ni=n&&typeof n.get=="function"?r([n.get]):typeof a=="function"?function(u){return a(u==null?u:i(u))}:!1,ni}var ii,Fo;function Vd(){if(Fo)return ii;Fo=1;var r=$o(),e=So(),t=jd();return ii=r?function(i){return r(i)}:e?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return e(i)}:t?function(i){return t(i)}:null,ii}var ai,Ro;function Gd(){if(Ro)return ai;Ro=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=mt();return ai=t.call(r,e),ai}var x,Hd=_o,Wd=dd,zd=pd,Xd=hd,Yd=yd,Xe=gd,Ye=je,Kd=_d,Zd=vd,Jd=md,Qd=wd,ep=bd,rp=$d,tp=Ed,np=Od,Mo=Function,oi=function(r){try{return Mo('"use strict"; return ('+r+").constructor;")()}catch{}},Sr=vo,ip=Pd,si=function(){throw new Ye},ap=Sr?function(){try{return arguments.callee,si}catch{try{return Sr(arguments,"callee").get}catch{return si}}}():si,Ke=Td()(),L=Vd(),op=So(),sp=$o(),Do=Po(),Ar=ri,Ze={},up=typeof Uint8Array>"u"||!L?x:L(Uint8Array),Fe={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?x:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?x:ArrayBuffer,"%ArrayIteratorPrototype%":Ke&&L?L([][Symbol.iterator]()):x,"%AsyncFromSyncIteratorPrototype%":x,"%AsyncFunction%":Ze,"%AsyncGenerator%":Ze,"%AsyncGeneratorFunction%":Ze,"%AsyncIteratorPrototype%":Ze,"%Atomics%":typeof Atomics>"u"?x:Atomics,"%BigInt%":typeof BigInt>"u"?x:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?x:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?x:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?x:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Wd,"%eval%":eval,"%EvalError%":zd,"%Float16Array%":typeof Float16Array>"u"?x:Float16Array,"%Float32Array%":typeof Float32Array>"u"?x:Float32Array,"%Float64Array%":typeof Float64Array>"u"?x:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?x:FinalizationRegistry,"%Function%":Mo,"%GeneratorFunction%":Ze,"%Int8Array%":typeof Int8Array>"u"?x:Int8Array,"%Int16Array%":typeof Int16Array>"u"?x:Int16Array,"%Int32Array%":typeof Int32Array>"u"?x:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ke&&L?L(L([][Symbol.iterator]())):x,"%JSON%":typeof JSON=="object"?JSON:x,"%Map%":typeof Map>"u"?x:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ke||!L?x:L(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Hd,"%Object.getOwnPropertyDescriptor%":Sr,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?x:Promise,"%Proxy%":typeof Proxy>"u"?x:Proxy,"%RangeError%":Xd,"%ReferenceError%":Yd,"%Reflect%":typeof Reflect>"u"?x:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?x:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ke||!L?x:L(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?x:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ke&&L?L(""[Symbol.iterator]()):x,"%Symbol%":Ke?Symbol:x,"%SyntaxError%":Xe,"%ThrowTypeError%":ap,"%TypedArray%":up,"%TypeError%":Ye,"%Uint8Array%":typeof Uint8Array>"u"?x:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?x:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?x:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?x:Uint32Array,"%URIError%":Kd,"%WeakMap%":typeof WeakMap>"u"?x:WeakMap,"%WeakRef%":typeof WeakRef>"u"?x:WeakRef,"%WeakSet%":typeof WeakSet>"u"?x:WeakSet,"%Function.prototype.call%":Ar,"%Function.prototype.apply%":Do,"%Object.defineProperty%":ip,"%Object.getPrototypeOf%":op,"%Math.abs%":Zd,"%Math.floor%":Jd,"%Math.max%":Qd,"%Math.min%":ep,"%Math.pow%":rp,"%Math.round%":tp,"%Math.sign%":np,"%Reflect.getPrototypeOf%":sp};if(L)try{null.error}catch(r){var fp=L(L(r));Fe["%Error.prototype%"]=fp}var cp=function r(e){var t;if(e==="%AsyncFunction%")t=oi("async function () {}");else if(e==="%GeneratorFunction%")t=oi("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=oi("async function* () {}");else if(e==="%AsyncGenerator%"){var n=r("%AsyncGeneratorFunction%");n&&(t=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=r("%AsyncGenerator%");i&&L&&(t=L(i.prototype))}return Fe[e]=t,t},Co={__proto__:null,"%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"]},Or=mt(),wt=Gd(),lp=Or.call(Ar,Array.prototype.concat),dp=Or.call(Do,Array.prototype.splice),No=Or.call(Ar,String.prototype.replace),bt=Or.call(Ar,String.prototype.slice),pp=Or.call(Ar,RegExp.prototype.exec),hp=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,yp=/\\(\\)?/g,gp=function(e){var t=bt(e,0,1),n=bt(e,-1);if(t==="%"&&n!=="%")throw new Xe("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&t!=="%")throw new Xe("invalid intrinsic syntax, expected opening `%`");var i=[];return No(e,hp,function(a,o,u,f){i[i.length]=u?No(f,yp,"$1"):o||a}),i},_p=function(e,t){var n=e,i;if(wt(Co,n)&&(i=Co[n],n="%"+i[0]+"%"),wt(Fe,n)){var a=Fe[n];if(a===Ze&&(a=cp(n)),typeof a>"u"&&!t)throw new Ye("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:a}}throw new Xe("intrinsic "+e+" does not exist!")},ui=function(e,t){if(typeof e!="string"||e.length===0)throw new Ye("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Ye('"allowMissing" argument must be a boolean');if(pp(/^%?[^%]*%?$/,e)===null)throw new Xe("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=gp(e),i=n.length>0?n[0]:"",a=_p("%"+i+"%",t),o=a.name,u=a.value,f=!1,d=a.alias;d&&(i=d[0],dp(n,lp([0,1],d)));for(var c=1,s=!0;c<n.length;c+=1){var l=n[c],p=bt(l,0,1),g=bt(l,-1);if((p==='"'||p==="'"||p==="`"||g==='"'||g==="'"||g==="`")&&p!==g)throw new Xe("property names with quotes must have matching quotes");if((l==="constructor"||!s)&&(f=!0),i+="."+l,o="%"+i+"%",wt(Fe,o))u=Fe[o];else if(u!=null){if(!(l in u)){if(!t)throw new Ye("base intrinsic for "+e+" exists, but the property is not available.");return}if(Sr&&c+1>=n.length){var $=Sr(u,l);s=!!$,s&&"get"in $&&!("originalValue"in $.get)?u=$.get:u=u[l]}else s=wt(u,l),u=u[l];s&&!f&&(Fe[o]=u)}}return u},Bo=ui,qo=xo,vp=qo([Bo("%String.prototype.indexOf%")]),Uo=function(e,t){var n=Bo(e,!!t);return typeof n=="function"&&vp(e,".prototype.")>-1?qo([n]):n},mp=ui,Ir=Uo,wp=ht,bp=je,Lo=mp("%Map%",!0),$p=Ir("Map.prototype.get",!0),Ep=Ir("Map.prototype.set",!0),Sp=Ir("Map.prototype.has",!0),Ap=Ir("Map.prototype.delete",!0),Op=Ir("Map.prototype.size",!0),ko=!!Lo&&function(){var e,t={assert:function(n){if(!t.has(n))throw new bp("Side channel does not contain "+wp(n))},delete:function(n){if(e){var i=Ap(e,n);return Op(e)===0&&(e=void 0),i}return!1},get:function(n){if(e)return $p(e,n)},has:function(n){return e?Sp(e,n):!1},set:function(n,i){e||(e=new Lo),Ep(e,n,i)}};return t},Ip=ui,$t=Uo,Pp=ht,Et=ko,xp=je,Je=Ip("%WeakMap%",!0),Tp=$t("WeakMap.prototype.get",!0),Fp=$t("WeakMap.prototype.set",!0),Rp=$t("WeakMap.prototype.has",!0),Mp=$t("WeakMap.prototype.delete",!0),Dp=Je?function(){var e,t,n={assert:function(i){if(!n.has(i))throw new xp("Side channel does not contain "+Pp(i))},delete:function(i){if(Je&&i&&(typeof i=="object"||typeof i=="function")){if(e)return Mp(e,i)}else if(Et&&t)return t.delete(i);return!1},get:function(i){return Je&&i&&(typeof i=="object"||typeof i=="function")&&e?Tp(e,i):t&&t.get(i)},has:function(i){return Je&&i&&(typeof i=="object"||typeof i=="function")&&e?Rp(e,i):!!t&&t.has(i)},set:function(i,a){Je&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new Je),Fp(e,i,a)):Et&&(t||(t=Et()),t.set(i,a))}};return n}:Et,Cp=je,Np=ht,Bp=ld,qp=ko,Up=Dp,Lp=Up||qp||Bp,jo=function(){var e,t={assert:function(n){if(!t.has(n))throw new Cp("Side channel does not contain "+Np(n))},delete:function(n){return!!e&&e.delete(n)},get:function(n){return e&&e.get(n)},has:function(n){return!!e&&e.has(n)},set:function(n,i){e||(e=Lp()),e.set(n,i)}};return t},kp=String.prototype.replace,jp=/%20/g,fi={RFC1738:"RFC1738",RFC3986:"RFC3986"},Vo={default:fi.RFC3986,formatters:{RFC1738:function(r){return kp.call(r,jp,"+")},RFC3986:function(r){return String(r)}},RFC1738:fi.RFC1738,RFC3986:fi.RFC3986},Vp=Vo,Gp=jo,ci=Object.prototype.hasOwnProperty,Re=Array.isArray,St=Gp(),Go=function(e,t){return St.set(e,t),e},At=function(e){return St.has(e)},li=function(e){return St.get(e)},Ho=function(e,t){St.set(e,t)},ie=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),Hp=function(e){for(;e.length>1;){var t=e.pop(),n=t.obj[t.prop];if(Re(n)){for(var i=[],a=0;a<n.length;++a)typeof n[a]<"u"&&i.push(n[a]);t.obj[t.prop]=i}}},di=function(e,t){for(var n=t&&t.plainObjects?{__proto__:null}:{},i=0;i<e.length;++i)typeof e[i]<"u"&&(n[i]=e[i]);return n},Wp=function r(e,t,n){if(!t)return e;if(typeof t!="object"&&typeof t!="function"){if(Re(e))e.push(t);else if(e&&typeof e=="object")if(At(e)){var i=li(e)+1;e[i]=t,Ho(e,i)}else(n&&(n.plainObjects||n.allowPrototypes)||!ci.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object"){if(At(t)){for(var a=Object.keys(t),o=n&&n.plainObjects?{__proto__:null,0:e}:{0:e},u=0;u<a.length;u++){var f=parseInt(a[u],10);o[f+1]=t[a[u]]}return Go(o,li(t)+1)}return[e].concat(t)}var d=e;return Re(e)&&!Re(t)&&(d=di(e,n)),Re(e)&&Re(t)?(t.forEach(function(c,s){if(ci.call(e,s)){var l=e[s];l&&typeof l=="object"&&c&&typeof c=="object"?e[s]=r(l,c,n):e.push(c)}else e[s]=c}),e):Object.keys(t).reduce(function(c,s){var l=t[s];return ci.call(c,s)?c[s]=r(c[s],l,n):c[s]=l,c},d)},zp=function(e,t){return Object.keys(t).reduce(function(n,i){return n[i]=t[i],n},e)},Xp=function(r,e,t){var n=r.replace(/\+/g," ");if(t==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},pi=1024,Yp=function(e,t,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(p){return"%26%23"+parseInt(p.slice(2),16)+"%3B"});for(var u="",f=0;f<o.length;f+=pi){for(var d=o.length>=pi?o.slice(f,f+pi):o,c=[],s=0;s<d.length;++s){var l=d.charCodeAt(s);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||a===Vp.RFC1738&&(l===40||l===41)){c[c.length]=d.charAt(s);continue}if(l<128){c[c.length]=ie[l];continue}if(l<2048){c[c.length]=ie[192|l>>6]+ie[128|l&63];continue}if(l<55296||l>=57344){c[c.length]=ie[224|l>>12]+ie[128|l>>6&63]+ie[128|l&63];continue}s+=1,l=65536+((l&1023)<<10|d.charCodeAt(s)&1023),c[c.length]=ie[240|l>>18]+ie[128|l>>12&63]+ie[128|l>>6&63]+ie[128|l&63]}u+=c.join("")}return u},Kp=function(e){for(var t=[{obj:{o:e},prop:"o"}],n=[],i=0;i<t.length;++i)for(var a=t[i],o=a.obj[a.prop],u=Object.keys(o),f=0;f<u.length;++f){var d=u[f],c=o[d];typeof c=="object"&&c!==null&&n.indexOf(c)===-1&&(t.push({obj:o,prop:d}),n.push(c))}return Hp(t),e},Zp=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Jp=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Qp=function(e,t,n,i){if(At(e)){var a=li(e)+1;return e[a]=t,Ho(e,a),e}var o=[].concat(e,t);return o.length>n?Go(di(o,{plainObjects:i}),o.length-1):o},eh=function(e,t){if(Re(e)){for(var n=[],i=0;i<e.length;i+=1)n.push(t(e[i]));return n}return t(e)},rh={arrayToObject:di,assign:zp,combine:Qp,compact:Kp,decode:Xp,encode:Yp,isBuffer:Jp,isOverflow:At,isRegExp:Zp,maybeMap:eh,merge:Wp},Wo=jo,Ot=rh,Pr=Vo,th=Object.prototype.hasOwnProperty,zo={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},ae=Array.isArray,nh=Array.prototype.push,Xo=function(r,e){nh.apply(r,ae(e)?e:[e])},ih=Date.prototype.toISOString,Yo=Pr.default,B={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Ot.encode,encodeValuesOnly:!1,filter:void 0,format:Yo,formatter:Pr.formatters[Yo],indices:!1,serializeDate:function(e){return ih.call(e)},skipNulls:!1,strictNullHandling:!1},ah=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},hi={},oh=function r(e,t,n,i,a,o,u,f,d,c,s,l,p,g,$,E,A,S){for(var h=e,O=S,T=0,R=!1;(O=O.get(hi))!==void 0&&!R;){var b=O.get(e);if(T+=1,typeof b<"u"){if(b===T)throw new RangeError("Cyclic object value");R=!0}typeof O.get(hi)>"u"&&(T=0)}if(typeof c=="function"?h=c(t,h):h instanceof Date?h=p(h):n==="comma"&&ae(h)&&(h=Ot.maybeMap(h,function(pa){return pa instanceof Date?p(pa):pa})),h===null){if(o)return d&&!E?d(t,B.encoder,A,"key",g):t;h=""}if(ah(h)||Ot.isBuffer(h)){if(d){var _=E?t:d(t,B.encoder,A,"key",g);return[$(_)+"="+$(d(h,B.encoder,A,"value",g))]}return[$(t)+"="+$(String(h))]}var m=[];if(typeof h>"u")return m;var I;if(n==="comma"&&ae(h))E&&d&&(h=Ot.maybeMap(h,d)),I=[{value:h.length>0?h.join(",")||null:void 0}];else if(ae(c))I=c;else{var P=Object.keys(h);I=s?P.sort(s):P}var q=f?String(t).replace(/\./g,"%2E"):String(t),z=i&&ae(h)&&h.length===1?q+"[]":q;if(a&&ae(h)&&h.length===0)return z+"[]";for(var ue=0;ue<I.length;++ue){var Z=I[ue],ke=typeof Z=="object"&&Z&&typeof Z.value<"u"?Z.value:h[Z];if(!(u&&ke===null)){var da=l&&f?String(Z).replace(/\./g,"%2E"):String(Z),ST=ae(h)?typeof n=="function"?n(z,da):z:z+(l?"."+da:"["+da+"]");S.set(e,T);var Qf=Wo();Qf.set(hi,S),Xo(m,r(ke,ST,n,i,a,o,u,f,n==="comma"&&E&&ae(h)?null:d,c,s,l,p,g,$,E,A,Qf))}}return m},sh=function(e){if(!e)return B;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var t=e.charset||B.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=Pr.default;if(typeof e.format<"u"){if(!th.call(Pr.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var i=Pr.formatters[n],a=B.filter;(typeof e.filter=="function"||ae(e.filter))&&(a=e.filter);var o;if(e.arrayFormat in zo?o=e.arrayFormat:"indices"in e?o=e.indices?"indices":"repeat":o=B.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var u=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:B.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:B.addQueryPrefix,allowDots:u,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:B.allowEmptyArrays,arrayFormat:o,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:B.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?B.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:B.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:B.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:B.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:B.encodeValuesOnly,filter:a,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:B.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:B.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:B.strictNullHandling}},uh=function(r,e){var t=r,n=sh(e),i,a;typeof n.filter=="function"?(a=n.filter,t=a("",t)):ae(n.filter)&&(a=n.filter,i=a);var o=[];if(typeof t!="object"||t===null)return"";var u=zo[n.arrayFormat],f=u==="comma"&&n.commaRoundTrip;i||(i=Object.keys(t)),n.sort&&i.sort(n.sort);for(var d=Wo(),c=0;c<i.length;++c){var s=i[c],l=t[s];n.skipNulls&&l===null||Xo(o,oh(l,s,u,f,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,d))}var p=o.join(n.delimiter),g=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?g+="utf8=%26%2310003%3B&":g+="utf8=%E2%9C%93&"),p.length>0?g+p:""},fh=$e(uh);let Ko={storeIdentifier:"",environment:"prod"};function ch(r){Ko=r}function V(){return Ko}const lh=(r,e="")=>{switch(r){case"prod":return"https://api.rechargeapps.com";case"stage":return"https://api.stage.rechargeapps.com";case"preprod":case"prestage":return`${e}/api`}},dh=(r,e="")=>{switch(r){case"prod":return"https://admin.rechargeapps.com";case"stage":return"https://admin.stage.rechargeapps.com";case"preprod":case"prestage":return e}},ph=r=>{switch(r){case"prod":case"preprod":return"https://static.rechargecdn.com";case"stage":case"prestage":return"https://static.stage.rechargecdn.com"}},Zo="/tools/recurring";class Qe{constructor(e,t){this.name="RechargeRequestError",this.message=e,this.status=t}}function F(r){return encodeURIComponent(`${r}`.trim())}function hh(r){return fh(r,{encodeValuesOnly:!0,indices:!1,arrayFormat:"comma"})}const yh=new Set(["shop_url"]);function v(r,e){return{...r,internalFnCall:r.internalFnCall??e,internalRequestId:r.internalRequestId??va()}}async function It(r,e,t={}){const n=V();return Y(r,`${ph(n.environment)}/store/${n.storeIdentifier}${e}`,t)}async function w(r,e,{id:t,query:n,data:i,headers:a}={},o){const{environment:u,environmentUri:f,storeIdentifier:d,loginRetryFn:c,__unstable_twoFactorRetryFn:s,appName:l,appVersion:p}=V();if(!d)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const g=o.apiToken;if(!g)throw new Error("No API token defined on session.");const $=lh(u,f),E={"X-Recharge-Access-Token":g,"X-Recharge-Version":"2021-11","X-Recharge-Sdk-Fn":o.internalFnCall,...l?{"X-Recharge-Sdk-App-Name":l}:{},...p?{"X-Recharge-Sdk-App-Version":p}:{},"X-Recharge-Sdk-Version":"1.91.1","X-Request-Id":o.internalRequestId,...o.tmp_fn_identifier?{"X-Recharge-Sdk-Fn-Identifier":o.tmp_fn_identifier}:{},...a||{}},A=n,S={...A?Object.fromEntries(Object.entries(A).filter(([h])=>!yh.has(h))):void 0,shop_url:d};try{return await Y(r,`${$}${e}`,{id:t,query:S,data:i,headers:E})}catch(h){if(c&&h instanceof Qe&&h.status===401)return c().then(O=>{if(O)return Y(r,`${$}${e}`,{id:t,query:S,data:i,headers:{...E,"X-Recharge-Access-Token":O.apiToken}});throw h});if(s&&h instanceof Qe&&h.status===423)return s().then(O=>{if(O)return Y(r,`${$}${e}`,{id:t,query:S,data:i,headers:{...E,"X-Recharge-Access-Token":O.apiToken}});throw h});throw h}}async function Me(r,e,t={}){return Y(r,`${Zo}${e}`,t)}async function Y(r,e,{id:t,query:n,data:i,headers:a}={}){let o=e.trim();if(t&&(o=[o,F(t)].join("/")),n){let s;[o,s]=o.split("?");const l=[s,hh(n)].join("&").replace(/^&/,"");o=`${o}${l?`?${l}`:""}`}let u;i&&r!=="get"&&(u=JSON.stringify(i));const f={Accept:"application/json","Content-Type":"application/json","X-Recharge-App":"storefront-client",...a||{}},d=await fetch(o,{method:r,headers:f,body:u});let c;try{c=await d.json()}catch{}if(!d.ok)throw d.status===502||d.status===504?new Qe("A gateway error occurred while making the request",d.status):c&&c.error?new Qe(c.error,d.status):c&&c.errors?new Qe(JSON.stringify(c.errors),d.status):new Qe("A connection error occurred while making the request");return c}function gh(r,e){return w("get","/addresses",{query:e},v(r,"listAddresses"))}async function _h(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{address:n}=await w("get","/addresses",{id:e,query:{include:t?.include}},v(r,"getAddress"));return n}async function vh(r,e){const{address:t}=await w("post","/addresses",{data:{...e,customer_id:r.customerId?Number(r.customerId):void 0}},v(r,"createAddress"));return t}async function yi(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");const{address:i}=await w("put","/addresses",{id:e,data:t,query:n},v(r,"updateAddress"));return i}async function mh(r,e,t,n){return yi(v(r,"applyDiscountToAddress"),e,{discounts:[{code:t}]},n)}async function wh(r,e,t){if(e===void 0||e==="")throw new Error("Id is required");return yi(v(r,"removeDiscountsFromAddress"),e,{discounts:[]},t)}function bh(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/addresses",{id:e},v(r,"deleteAddress"))}async function $h(r,e){const{address:t}=await w("post","/addresses/merge",{data:e},v(r,"mergeAddresses"));return t}async function Eh(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await w("post",`/addresses/${F(e)}/charges/skip`,{data:t},v(r,"skipFutureCharge"));return n}var Sh=Object.freeze({__proto__:null,applyDiscountToAddress:mh,createAddress:vh,deleteAddress:bh,getAddress:_h,listAddresses:gh,mergeAddresses:$h,removeDiscountsFromAddress:wh,skipFutureCharge:Eh,updateAddress:yi});async function Ah(){const{storefrontAccessToken:r}=V(),e={};r&&(e["X-Recharge-Storefront-Access-Token"]=r);const t=await Me("get","/access",{headers:e});return{apiToken:t.api_token,customerId:t.customer_id,message:t.message}}async function Oh(r,e){return Jo(r,e)}async function Jo(r,e){if(!r)throw new Error("Shopify storefront token is required");const{storeIdentifier:t}=V();if(!t)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const{api_token:n,customer_id:i,message:a}=await xr("post","/shopify_storefront_access",{data:{customer_token:e,storefront_token:r,shop_url:t}});return n?{apiToken:n,customerId:i,message:a}:null}async function Ih(r){const{storeIdentifier:e}=V();if(!e)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const{api_token:t,customer_id:n,message:i}=await xr("post","/shopify_customer_account_api_access",{data:{customer_token:r,shop_url:e}});return t?{apiToken:t,customerId:n,message:i}:null}async function Ph(r,e={}){if(!r)throw new Error("Email is required.");const{storeIdentifier:t}=V();if(!t)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const{send_email:n,send_sms:i}=e,a=await xr("post","/attempt_login",{data:{email:r,shop:t,...n!==void 0?{send_email:n}:{},...i!==void 0?{send_sms:i}:{}}});if(a.errors)throw new Error(a.errors);return a.session_token}async function xh(r,e={}){if(!r)throw new Error("Email is required.");const{storefrontAccessToken:t}=V(),n={};t&&(n["X-Recharge-Storefront-Access-Token"]=t);const{send_email:i,send_sms:a}=e,o=await Me("post","/attempt_login",{data:{email:r,...i!==void 0?{send_email:i}:{},...a!==void 0?{send_sms:a}:{}},headers:n});if(o.errors)throw new Error(o.errors);return o.session_token}async function Th(r,e,t){if(!r)throw new Error("Email is required.");if(!e)throw new Error("Session token is required.");if(!t)throw new Error("Code is required.");const{storeIdentifier:n}=V();if(!n)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const i=await xr("post","/validate_login",{data:{code:t,email:r,session_token:e,shop:n}});if(i.errors)throw new Error(i.errors);return{apiToken:i.api_token,customerId:i.customer_id}}async function Fh(r,e,t){if(!r)throw new Error("Email is required.");if(!e)throw new Error("Session token is required.");if(!t)throw new Error("Code is required.");const{storefrontAccessToken:n}=V(),i={};n&&(i["X-Recharge-Storefront-Access-Token"]=n);const a=await Me("post","/validate_login",{data:{code:t,email:r,session_token:e},headers:i});if(a.errors)throw new Error(a.errors);return{apiToken:a.api_token,customerId:a.customer_id}}function Rh(){const{customerHash:r}=V(),{pathname:e,search:t}=window.location,n=new URLSearchParams(t).get("token"),i=e.split("/").filter(Boolean),a=i.findIndex(u=>u==="portal"),o=a!==-1?i[a+1]:r;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 Mh(){const{customerHash:r,token:e}=Rh(),{storeIdentifier:t}=V(),n=await xr("post",`/customers/${F(r)}/access`,{data:{token:e,shop:t}});return{apiToken:n.api_token,customerId:n.customer_id}}async function xr(r,e,{id:t,query:n,data:i,headers:a}={}){const{environment:o,environmentUri:u,storefrontAccessToken:f,appName:d,appVersion:c}=V(),s=dh(o,u),l={...f?{"X-Recharge-Storefront-Access-Token":f}:{},...d?{"X-Recharge-Sdk-App-Name":d}:{},...c?{"X-Recharge-Sdk-App-Version":c}:{},"X-Recharge-Sdk-Version":"1.91.1",...a||{}};return Y(r,`${s}${e}`,{id:t,query:n,data:i,headers:l})}var Dh=Object.freeze({__proto__:null,loginCustomerPortal:Mh,loginShopifyApi:Oh,loginShopifyAppProxy:Ah,loginWithShopifyCustomerAccount:Ih,loginWithShopifyStorefront:Jo,sendPasswordlessCode:Ph,sendPasswordlessCodeAppProxy:xh,validatePasswordlessCode:Th,validatePasswordlessCodeAppProxy:Fh}),Qo={},gi={},de={},Ch=typeof C=="object"&&C&&C.Object===Object&&C,es=Ch,Nh=es,Bh=typeof self=="object"&&self&&self.Object===Object&&self,qh=Nh||Bh||Function("return this")(),pe=qh,Uh=pe,Lh=Uh.Symbol,Pt=Lh,rs=Pt,ts=Object.prototype,kh=ts.hasOwnProperty,jh=ts.toString,Tr=rs?rs.toStringTag:void 0;function Vh(r){var e=kh.call(r,Tr),t=r[Tr];try{r[Tr]=void 0;var n=!0}catch{}var i=jh.call(r);return n&&(e?r[Tr]=t:delete r[Tr]),i}var Gh=Vh,Hh=Object.prototype,Wh=Hh.toString;function zh(r){return Wh.call(r)}var Xh=zh,ns=Pt,Yh=Gh,Kh=Xh,Zh="[object Null]",Jh="[object Undefined]",is=ns?ns.toStringTag:void 0;function Qh(r){return r==null?r===void 0?Jh:Zh:is&&is in Object(r)?Yh(r):Kh(r)}var me=Qh;function ey(r){return r!=null&&typeof r=="object"}var we=ey,ry=me,ty=we,ny="[object Number]";function iy(r){return typeof r=="number"||ty(r)&&ry(r)==ny}var xt=iy,D={};function ay(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}var er=ay,oy=me,sy=er,uy="[object AsyncFunction]",fy="[object Function]",cy="[object GeneratorFunction]",ly="[object Proxy]";function dy(r){if(!sy(r))return!1;var e=oy(r);return e==fy||e==cy||e==uy||e==ly}var _i=dy,py=pe,hy=py["__core-js_shared__"],yy=hy,vi=yy,as=function(){var r=/[^.]+$/.exec(vi&&vi.keys&&vi.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function gy(r){return!!as&&as in r}var _y=gy,vy=Function.prototype,my=vy.toString;function wy(r){if(r!=null){try{return my.call(r)}catch{}try{return r+""}catch{}}return""}var os=wy,by=_i,$y=_y,Ey=er,Sy=os,Ay=/[\\^$.*+?()[\]{}|]/g,Oy=/^\[object .+?Constructor\]$/,Iy=Function.prototype,Py=Object.prototype,xy=Iy.toString,Ty=Py.hasOwnProperty,Fy=RegExp("^"+xy.call(Ty).replace(Ay,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ry(r){if(!Ey(r)||$y(r))return!1;var e=by(r)?Fy:Oy;return e.test(Sy(r))}var My=Ry;function Dy(r,e){return r?.[e]}var Cy=Dy,Ny=My,By=Cy;function qy(r,e){var t=By(r,e);return Ny(t)?t:void 0}var De=qy,Uy=De,Ly=function(){try{var r=Uy(Object,"defineProperty");return r({},"",{}),r}catch{}}(),ss=Ly,us=ss;function ky(r,e,t){e=="__proto__"&&us?us(r,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):r[e]=t}var fs=ky;function jy(r,e){return r===e||r!==r&&e!==e}var Tt=jy,Vy=fs,Gy=Tt,Hy=Object.prototype,Wy=Hy.hasOwnProperty;function zy(r,e,t){var n=r[e];(!(Wy.call(r,e)&&Gy(n,t))||t===void 0&&!(e in r))&&Vy(r,e,t)}var Xy=zy,Yy=Xy,Ky=fs;function Zy(r,e,t,n){var i=!t;t||(t={});for(var a=-1,o=e.length;++a<o;){var u=e[a],f=n?n(t[u],r[u],u,t,r):void 0;f===void 0&&(f=r[u]),i?Ky(t,u,f):Yy(t,u,f)}return t}var Jy=Zy;function Qy(r){return r}var Ft=Qy;function eg(r,e,t){switch(t.length){case 0:return r.call(e);case 1:return r.call(e,t[0]);case 2:return r.call(e,t[0],t[1]);case 3:return r.call(e,t[0],t[1],t[2])}return r.apply(e,t)}var rg=eg,tg=rg,cs=Math.max;function ng(r,e,t){return e=cs(e===void 0?r.length-1:e,0),function(){for(var n=arguments,i=-1,a=cs(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]=t(o),tg(r,this,u)}}var ig=ng;function ag(r){return function(){return r}}var og=ag,sg=og,ls=ss,ug=Ft,fg=ls?function(r,e){return ls(r,"toString",{configurable:!0,enumerable:!1,value:sg(e),writable:!0})}:ug,cg=fg,lg=800,dg=16,pg=Date.now;function hg(r){var e=0,t=0;return function(){var n=pg(),i=dg-(n-t);if(t=n,i>0){if(++e>=lg)return arguments[0]}else e=0;return r.apply(void 0,arguments)}}var yg=hg,gg=cg,_g=yg,vg=_g(gg),mg=vg,wg=Ft,bg=ig,$g=mg;function Eg(r,e){return $g(bg(r,e,wg),r+"")}var Sg=Eg,Ag=9007199254740991;function Og(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=Ag}var mi=Og,Ig=_i,Pg=mi;function xg(r){return r!=null&&Pg(r.length)&&!Ig(r)}var Fr=xg,Tg=9007199254740991,Fg=/^(?:0|[1-9]\d*)$/;function Rg(r,e){var t=typeof r;return e=e??Tg,!!e&&(t=="number"||t!="symbol"&&Fg.test(r))&&r>-1&&r%1==0&&r<e}var wi=Rg,Mg=Tt,Dg=Fr,Cg=wi,Ng=er;function Bg(r,e,t){if(!Ng(t))return!1;var n=typeof e;return(n=="number"?Dg(t)&&Cg(e,t.length):n=="string"&&e in t)?Mg(t[e],r):!1}var ds=Bg,qg=Sg,Ug=ds;function Lg(r){return qg(function(e,t){var n=-1,i=t.length,a=i>1?t[i-1]:void 0,o=i>2?t[2]:void 0;for(a=r.length>3&&typeof a=="function"?(i--,a):void 0,o&&Ug(t[0],t[1],o)&&(a=i<3?void 0:a,i=1),e=Object(e);++n<i;){var u=t[n];u&&r(e,u,n,a)}return e})}var kg=Lg;function jg(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}var ps=jg,Vg=me,Gg=we,Hg="[object Arguments]";function Wg(r){return Gg(r)&&Vg(r)==Hg}var zg=Wg,hs=zg,Xg=we,ys=Object.prototype,Yg=ys.hasOwnProperty,Kg=ys.propertyIsEnumerable,Zg=hs(function(){return arguments}())?hs:function(r){return Xg(r)&&Yg.call(r,"callee")&&!Kg.call(r,"callee")},gs=Zg,Jg=Array.isArray,G=Jg,Rt={exports:{}};function Qg(){return!1}var e_=Qg;Rt.exports,function(r,e){var t=pe,n=e_,i=e&&!e.nodeType&&e,a=i&&!0&&r&&!r.nodeType&&r,o=a&&a.exports===i,u=o?t.Buffer:void 0,f=u?u.isBuffer:void 0,d=f||n;r.exports=d}(Rt,Rt.exports);var _s=Rt.exports,r_=me,t_=mi,n_=we,i_="[object Arguments]",a_="[object Array]",o_="[object Boolean]",s_="[object Date]",u_="[object Error]",f_="[object Function]",c_="[object Map]",l_="[object Number]",d_="[object Object]",p_="[object RegExp]",h_="[object Set]",y_="[object String]",g_="[object WeakMap]",__="[object ArrayBuffer]",v_="[object DataView]",m_="[object Float32Array]",w_="[object Float64Array]",b_="[object Int8Array]",$_="[object Int16Array]",E_="[object Int32Array]",S_="[object Uint8Array]",A_="[object Uint8ClampedArray]",O_="[object Uint16Array]",I_="[object Uint32Array]",M={};M[m_]=M[w_]=M[b_]=M[$_]=M[E_]=M[S_]=M[A_]=M[O_]=M[I_]=!0,M[i_]=M[a_]=M[__]=M[o_]=M[v_]=M[s_]=M[u_]=M[f_]=M[c_]=M[l_]=M[d_]=M[p_]=M[h_]=M[y_]=M[g_]=!1;function P_(r){return n_(r)&&t_(r.length)&&!!M[r_(r)]}var x_=P_;function T_(r){return function(e){return r(e)}}var F_=T_,Mt={exports:{}};Mt.exports,function(r,e){var t=es,n=e&&!e.nodeType&&e,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,o=a&&t.process,u=function(){try{var f=i&&i.require&&i.require("util").types;return f||o&&o.binding&&o.binding("util")}catch{}}();r.exports=u}(Mt,Mt.exports);var R_=Mt.exports,M_=x_,D_=F_,vs=R_,ms=vs&&vs.isTypedArray,C_=ms?D_(ms):M_,ws=C_,N_=ps,B_=gs,q_=G,U_=_s,L_=wi,k_=ws,j_=Object.prototype,V_=j_.hasOwnProperty;function G_(r,e){var t=q_(r),n=!t&&B_(r),i=!t&&!n&&U_(r),a=!t&&!n&&!i&&k_(r),o=t||n||i||a,u=o?N_(r.length,String):[],f=u.length;for(var d in r)(e||V_.call(r,d))&&!(o&&(d=="length"||i&&(d=="offset"||d=="parent")||a&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||L_(d,f)))&&u.push(d);return u}var bs=G_,H_=Object.prototype;function W_(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||H_;return r===t}var $s=W_;function z_(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e}var X_=z_,Y_=er,K_=$s,Z_=X_,J_=Object.prototype,Q_=J_.hasOwnProperty;function ev(r){if(!Y_(r))return Z_(r);var e=K_(r),t=[];for(var n in r)n=="constructor"&&(e||!Q_.call(r,n))||t.push(n);return t}var rv=ev,tv=bs,nv=rv,iv=Fr;function av(r){return iv(r)?tv(r,!0):nv(r)}var ov=av,sv=Jy,uv=kg,fv=ov,cv=uv(function(r,e){sv(e,fv(e),r)}),lv=cv,dv=lv,Dt={},Ce={};function pv(r,e){for(var t=-1,n=r==null?0:r.length;++t<n;)if(!e(r[t],t,r))return!1;return!0}var hv=pv;function yv(r){return function(e,t,n){for(var i=-1,a=Object(e),o=n(e),u=o.length;u--;){var f=o[r?u:++i];if(t(a[f],f,a)===!1)break}return e}}var gv=yv,_v=gv,vv=_v(),mv=vv;function wv(r,e){return function(t){return r(e(t))}}var bv=wv,$v=bv,Ev=$v(Object.keys,Object),Sv=Ev,Av=$s,Ov=Sv,Iv=Object.prototype,Pv=Iv.hasOwnProperty;function xv(r){if(!Av(r))return Ov(r);var e=[];for(var t in Object(r))Pv.call(r,t)&&t!="constructor"&&e.push(t);return e}var Tv=xv,Fv=bs,Rv=Tv,Mv=Fr;function Dv(r){return Mv(r)?Fv(r):Rv(r)}var Ct=Dv,Cv=mv,Nv=Ct;function Bv(r,e){return r&&Cv(r,e,Nv)}var qv=Bv,Uv=Fr;function Lv(r,e){return function(t,n){if(t==null)return t;if(!Uv(t))return r(t,n);for(var i=t.length,a=e?i:-1,o=Object(t);(e?a--:++a<i)&&n(o[a],a,o)!==!1;);return t}}var kv=Lv,jv=qv,Vv=kv,Gv=Vv(jv),bi=Gv,Hv=bi;function Wv(r,e){var t=!0;return Hv(r,function(n,i,a){return t=!!e(n,i,a),t}),t}var zv=Wv;function Xv(){this.__data__=[],this.size=0}var Yv=Xv,Kv=Tt;function Zv(r,e){for(var t=r.length;t--;)if(Kv(r[t][0],e))return t;return-1}var Nt=Zv,Jv=Nt,Qv=Array.prototype,em=Qv.splice;function rm(r){var e=this.__data__,t=Jv(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():em.call(e,t,1),--this.size,!0}var tm=rm,nm=Nt;function im(r){var e=this.__data__,t=nm(e,r);return t<0?void 0:e[t][1]}var am=im,om=Nt;function sm(r){return om(this.__data__,r)>-1}var um=sm,fm=Nt;function cm(r,e){var t=this.__data__,n=fm(t,r);return n<0?(++this.size,t.push([r,e])):t[n][1]=e,this}var lm=cm,dm=Yv,pm=tm,hm=am,ym=um,gm=lm;function rr(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}rr.prototype.clear=dm,rr.prototype.delete=pm,rr.prototype.get=hm,rr.prototype.has=ym,rr.prototype.set=gm;var Bt=rr,_m=Bt;function vm(){this.__data__=new _m,this.size=0}var mm=vm;function wm(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}var bm=wm;function $m(r){return this.__data__.get(r)}var Em=$m;function Sm(r){return this.__data__.has(r)}var Am=Sm,Om=De,Im=pe,Pm=Om(Im,"Map"),$i=Pm,xm=De,Tm=xm(Object,"create"),qt=Tm,Es=qt;function Fm(){this.__data__=Es?Es(null):{},this.size=0}var Rm=Fm;function Mm(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}var Dm=Mm,Cm=qt,Nm="__lodash_hash_undefined__",Bm=Object.prototype,qm=Bm.hasOwnProperty;function Um(r){var e=this.__data__;if(Cm){var t=e[r];return t===Nm?void 0:t}return qm.call(e,r)?e[r]:void 0}var Lm=Um,km=qt,jm=Object.prototype,Vm=jm.hasOwnProperty;function Gm(r){var e=this.__data__;return km?e[r]!==void 0:Vm.call(e,r)}var Hm=Gm,Wm=qt,zm="__lodash_hash_undefined__";function Xm(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=Wm&&e===void 0?zm:e,this}var Ym=Xm,Km=Rm,Zm=Dm,Jm=Lm,Qm=Hm,ew=Ym;function tr(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}tr.prototype.clear=Km,tr.prototype.delete=Zm,tr.prototype.get=Jm,tr.prototype.has=Qm,tr.prototype.set=ew;var rw=tr,Ss=rw,tw=Bt,nw=$i;function iw(){this.size=0,this.__data__={hash:new Ss,map:new(nw||tw),string:new Ss}}var aw=iw;function ow(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}var sw=ow,uw=sw;function fw(r,e){var t=r.__data__;return uw(e)?t[typeof e=="string"?"string":"hash"]:t.map}var Ut=fw,cw=Ut;function lw(r){var e=cw(this,r).delete(r);return this.size-=e?1:0,e}var dw=lw,pw=Ut;function hw(r){return pw(this,r).get(r)}var yw=hw,gw=Ut;function _w(r){return gw(this,r).has(r)}var vw=_w,mw=Ut;function ww(r,e){var t=mw(this,r),n=t.size;return t.set(r,e),this.size+=t.size==n?0:1,this}var bw=ww,$w=aw,Ew=dw,Sw=yw,Aw=vw,Ow=bw;function nr(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}nr.prototype.clear=$w,nr.prototype.delete=Ew,nr.prototype.get=Sw,nr.prototype.has=Aw,nr.prototype.set=Ow;var Ei=nr,Iw=Bt,Pw=$i,xw=Ei,Tw=200;function Fw(r,e){var t=this.__data__;if(t instanceof Iw){var n=t.__data__;if(!Pw||n.length<Tw-1)return n.push([r,e]),this.size=++t.size,this;t=this.__data__=new xw(n)}return t.set(r,e),this.size=t.size,this}var Rw=Fw,Mw=Bt,Dw=mm,Cw=bm,Nw=Em,Bw=Am,qw=Rw;function ir(r){var e=this.__data__=new Mw(r);this.size=e.size}ir.prototype.clear=Dw,ir.prototype.delete=Cw,ir.prototype.get=Nw,ir.prototype.has=Bw,ir.prototype.set=qw;var As=ir,Uw="__lodash_hash_undefined__";function Lw(r){return this.__data__.set(r,Uw),this}var kw=Lw;function jw(r){return this.__data__.has(r)}var Vw=jw,Gw=Ei,Hw=kw,Ww=Vw;function Lt(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new Gw;++e<t;)this.add(r[e])}Lt.prototype.add=Lt.prototype.push=Hw,Lt.prototype.has=Ww;var zw=Lt;function Xw(r,e){for(var t=-1,n=r==null?0:r.length;++t<n;)if(e(r[t],t,r))return!0;return!1}var Yw=Xw;function Kw(r,e){return r.has(e)}var Zw=Kw,Jw=zw,Qw=Yw,e0=Zw,r0=1,t0=2;function n0(r,e,t,n,i,a){var o=t&r0,u=r.length,f=e.length;if(u!=f&&!(o&&f>u))return!1;var d=a.get(r),c=a.get(e);if(d&&c)return d==e&&c==r;var s=-1,l=!0,p=t&t0?new Jw:void 0;for(a.set(r,e),a.set(e,r);++s<u;){var g=r[s],$=e[s];if(n)var E=o?n($,g,s,e,r,a):n(g,$,s,r,e,a);if(E!==void 0){if(E)continue;l=!1;break}if(p){if(!Qw(e,function(A,S){if(!e0(p,S)&&(g===A||i(g,A,t,n,a)))return p.push(S)})){l=!1;break}}else if(!(g===$||i(g,$,t,n,a))){l=!1;break}}return a.delete(r),a.delete(e),l}var Os=n0,i0=pe,a0=i0.Uint8Array,o0=a0;function s0(r){var e=-1,t=Array(r.size);return r.forEach(function(n,i){t[++e]=[i,n]}),t}var u0=s0;function f0(r){var e=-1,t=Array(r.size);return r.forEach(function(n){t[++e]=n}),t}var c0=f0,Is=Pt,Ps=o0,l0=Tt,d0=Os,p0=u0,h0=c0,y0=1,g0=2,_0="[object Boolean]",v0="[object Date]",m0="[object Error]",w0="[object Map]",b0="[object Number]",$0="[object RegExp]",E0="[object Set]",S0="[object String]",A0="[object Symbol]",O0="[object ArrayBuffer]",I0="[object DataView]",xs=Is?Is.prototype:void 0,Si=xs?xs.valueOf:void 0;function P0(r,e,t,n,i,a,o){switch(t){case I0:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case O0:return!(r.byteLength!=e.byteLength||!a(new Ps(r),new Ps(e)));case _0:case v0:case b0:return l0(+r,+e);case m0:return r.name==e.name&&r.message==e.message;case $0:case S0:return r==e+"";case w0:var u=p0;case E0:var f=n&y0;if(u||(u=h0),r.size!=e.size&&!f)return!1;var d=o.get(r);if(d)return d==e;n|=g0,o.set(r,e);var c=d0(u(r),u(e),n,i,a,o);return o.delete(r),c;case A0:if(Si)return Si.call(r)==Si.call(e)}return!1}var x0=P0;function T0(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r}var F0=T0,R0=F0,M0=G;function D0(r,e,t){var n=e(r);return M0(r)?n:R0(n,t(r))}var C0=D0;function N0(r,e){for(var t=-1,n=r==null?0:r.length,i=0,a=[];++t<n;){var o=r[t];e(o,t,r)&&(a[i++]=o)}return a}var B0=N0;function q0(){return[]}var U0=q0,L0=B0,k0=U0,j0=Object.prototype,V0=j0.propertyIsEnumerable,Ts=Object.getOwnPropertySymbols,G0=Ts?function(r){return r==null?[]:(r=Object(r),L0(Ts(r),function(e){return V0.call(r,e)}))}:k0,H0=G0,W0=C0,z0=H0,X0=Ct;function Y0(r){return W0(r,X0,z0)}var K0=Y0,Fs=K0,Z0=1,J0=Object.prototype,Q0=J0.hasOwnProperty;function eb(r,e,t,n,i,a){var o=t&Z0,u=Fs(r),f=u.length,d=Fs(e),c=d.length;if(f!=c&&!o)return!1;for(var s=f;s--;){var l=u[s];if(!(o?l in e:Q0.call(e,l)))return!1}var p=a.get(r),g=a.get(e);if(p&&g)return p==e&&g==r;var $=!0;a.set(r,e),a.set(e,r);for(var E=o;++s<f;){l=u[s];var A=r[l],S=e[l];if(n)var h=o?n(S,A,l,e,r,a):n(A,S,l,r,e,a);if(!(h===void 0?A===S||i(A,S,t,n,a):h)){$=!1;break}E||(E=l=="constructor")}if($&&!E){var O=r.constructor,T=e.constructor;O!=T&&"constructor"in r&&"constructor"in e&&!(typeof O=="function"&&O instanceof O&&typeof T=="function"&&T instanceof T)&&($=!1)}return a.delete(r),a.delete(e),$}var rb=eb,tb=De,nb=pe,ib=tb(nb,"DataView"),ab=ib,ob=De,sb=pe,ub=ob(sb,"Promise"),fb=ub,cb=De,lb=pe,db=cb(lb,"Set"),pb=db,hb=De,yb=pe,gb=hb(yb,"WeakMap"),_b=gb,Ai=ab,Oi=$i,Ii=fb,Pi=pb,xi=_b,Rs=me,ar=os,Ms="[object Map]",vb="[object Object]",Ds="[object Promise]",Cs="[object Set]",Ns="[object WeakMap]",Bs="[object DataView]",mb=ar(Ai),wb=ar(Oi),bb=ar(Ii),$b=ar(Pi),Eb=ar(xi),Ne=Rs;(Ai&&Ne(new Ai(new ArrayBuffer(1)))!=Bs||Oi&&Ne(new Oi)!=Ms||Ii&&Ne(Ii.resolve())!=Ds||Pi&&Ne(new Pi)!=Cs||xi&&Ne(new xi)!=Ns)&&(Ne=function(r){var e=Rs(r),t=e==vb?r.constructor:void 0,n=t?ar(t):"";if(n)switch(n){case mb:return Bs;case wb:return Ms;case bb:return Ds;case $b:return Cs;case Eb:return Ns}return e});var Sb=Ne,Ti=As,Ab=Os,Ob=x0,Ib=rb,qs=Sb,Us=G,Ls=_s,Pb=ws,xb=1,ks="[object Arguments]",js="[object Array]",kt="[object Object]",Tb=Object.prototype,Vs=Tb.hasOwnProperty;function Fb(r,e,t,n,i,a){var o=Us(r),u=Us(e),f=o?js:qs(r),d=u?js:qs(e);f=f==ks?kt:f,d=d==ks?kt:d;var c=f==kt,s=d==kt,l=f==d;if(l&&Ls(r)){if(!Ls(e))return!1;o=!0,c=!1}if(l&&!c)return a||(a=new Ti),o||Pb(r)?Ab(r,e,t,n,i,a):Ob(r,e,f,t,n,i,a);if(!(t&xb)){var p=c&&Vs.call(r,"__wrapped__"),g=s&&Vs.call(e,"__wrapped__");if(p||g){var $=p?r.value():r,E=g?e.value():e;return a||(a=new Ti),i($,E,t,n,a)}}return l?(a||(a=new Ti),Ib(r,e,t,n,i,a)):!1}var Rb=Fb,Mb=Rb,Gs=we;function Hs(r,e,t,n,i){return r===e?!0:r==null||e==null||!Gs(r)&&!Gs(e)?r!==r&&e!==e:Mb(r,e,t,n,Hs,i)}var Ws=Hs,Db=As,Cb=Ws,Nb=1,Bb=2;function qb(r,e,t,n){var i=t.length,a=i,o=!n;if(r==null)return!a;for(r=Object(r);i--;){var u=t[i];if(o&&u[2]?u[1]!==r[u[0]]:!(u[0]in r))return!1}for(;++i<a;){u=t[i];var f=u[0],d=r[f],c=u[1];if(o&&u[2]){if(d===void 0&&!(f in r))return!1}else{var s=new Db;if(n)var l=n(d,c,f,r,e,s);if(!(l===void 0?Cb(c,d,Nb|Bb,n,s):l))return!1}}return!0}var Ub=qb,Lb=er;function kb(r){return r===r&&!Lb(r)}var zs=kb,jb=zs,Vb=Ct;function Gb(r){for(var e=Vb(r),t=e.length;t--;){var n=e[t],i=r[n];e[t]=[n,i,jb(i)]}return e}var Hb=Gb;function Wb(r,e){return function(t){return t==null?!1:t[r]===e&&(e!==void 0||r in Object(t))}}var Xs=Wb,zb=Ub,Xb=Hb,Yb=Xs;function Kb(r){var e=Xb(r);return e.length==1&&e[0][2]?Yb(e[0][0],e[0][1]):function(t){return t===r||zb(t,r,e)}}var Zb=Kb,Jb=me,Qb=we,e1="[object Symbol]";function r1(r){return typeof r=="symbol"||Qb(r)&&Jb(r)==e1}var jt=r1,t1=G,n1=jt,i1=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a1=/^\w*$/;function o1(r,e){if(t1(r))return!1;var t=typeof r;return t=="number"||t=="symbol"||t=="boolean"||r==null||n1(r)?!0:a1.test(r)||!i1.test(r)||e!=null&&r in Object(e)}var Fi=o1,Ys=Ei,s1="Expected a function";function Ri(r,e){if(typeof r!="function"||e!=null&&typeof e!="function")throw new TypeError(s1);var t=function(){var n=arguments,i=e?e.apply(this,n):n[0],a=t.cache;if(a.has(i))return a.get(i);var o=r.apply(this,n);return t.cache=a.set(i,o)||a,o};return t.cache=new(Ri.Cache||Ys),t}Ri.Cache=Ys;var u1=Ri,f1=u1,c1=500;function l1(r){var e=f1(r,function(n){return t.size===c1&&t.clear(),n}),t=e.cache;return e}var d1=l1,p1=d1,h1=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,y1=/\\(\\)?/g,g1=p1(function(r){var e=[];return r.charCodeAt(0)===46&&e.push(""),r.replace(h1,function(t,n,i,a){e.push(i?a.replace(y1,"$1"):n||t)}),e}),_1=g1;function v1(r,e){for(var t=-1,n=r==null?0:r.length,i=Array(n);++t<n;)i[t]=e(r[t],t,r);return i}var Mi=v1,Ks=Pt,m1=Mi,w1=G,b1=jt,$1=1/0,Zs=Ks?Ks.prototype:void 0,Js=Zs?Zs.toString:void 0;function Qs(r){if(typeof r=="string")return r;if(w1(r))return m1(r,Qs)+"";if(b1(r))return Js?Js.call(r):"";var e=r+"";return e=="0"&&1/r==-$1?"-0":e}var E1=Qs,S1=E1;function A1(r){return r==null?"":S1(r)}var O1=A1,I1=G,P1=Fi,x1=_1,T1=O1;function F1(r,e){return I1(r)?r:P1(r,e)?[r]:x1(T1(r))}var eu=F1,R1=jt,M1=1/0;function D1(r){if(typeof r=="string"||R1(r))return r;var e=r+"";return e=="0"&&1/r==-M1?"-0":e}var Vt=D1,C1=eu,N1=Vt;function B1(r,e){e=C1(e,r);for(var t=0,n=e.length;r!=null&&t<n;)r=r[N1(e[t++])];return t&&t==n?r:void 0}var ru=B1,q1=ru;function U1(r,e,t){var n=r==null?void 0:q1(r,e);return n===void 0?t:n}var L1=U1;function k1(r,e){return r!=null&&e in Object(r)}var j1=k1,V1=eu,G1=gs,H1=G,W1=wi,z1=mi,X1=Vt;function Y1(r,e,t){e=V1(e,r);for(var n=-1,i=e.length,a=!1;++n<i;){var o=X1(e[n]);if(!(a=r!=null&&t(r,o)))break;r=r[o]}return a||++n!=i?a:(i=r==null?0:r.length,!!i&&z1(i)&&W1(o,i)&&(H1(r)||G1(r)))}var K1=Y1,Z1=j1,J1=K1;function Q1(r,e){return r!=null&&J1(r,e,Z1)}var e$=Q1,r$=Ws,t$=L1,n$=e$,i$=Fi,a$=zs,o$=Xs,s$=Vt,u$=1,f$=2;function c$(r,e){return i$(r)&&a$(e)?o$(s$(r),e):function(t){var n=t$(t,r);return n===void 0&&n===e?n$(t,r):r$(e,n,u$|f$)}}var l$=c$;function d$(r){return function(e){return e?.[r]}}var p$=d$,h$=ru;function y$(r){return function(e){return h$(e,r)}}var g$=y$,_$=p$,v$=g$,m$=Fi,w$=Vt;function b$(r){return m$(r)?_$(w$(r)):v$(r)}var $$=b$,E$=Zb,S$=l$,A$=Ft,O$=G,I$=$$;function P$(r){return typeof r=="function"?r:r==null?A$:typeof r=="object"?O$(r)?S$(r[0],r[1]):E$(r):I$(r)}var tu=P$,x$=hv,T$=zv,F$=tu,R$=G,M$=ds;function D$(r,e,t){var n=R$(r)?x$:T$;return t&&M$(r,e,t)&&(e=void 0),n(r,F$(e))}var Di=D$;Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.calculatePadding=q$,Ce.slicePadding=U$;var C$=Di,N$=B$(C$);function B$(r){return r&&r.__esModule?r:{default:r}}function q$(r){switch(r%4){case 0:return 0;case 1:return 3;case 2:return 2;case 3:return 1;default:return null}}function U$(r,e){var t=r.slice(e),n=(0,N$.default)(t.buffer(),function(i){return i===0});if(n!==!0)throw new Error("XDR Read Error: invalid padding")}Object.defineProperty(Dt,"__esModule",{value:!0}),Dt.Cursor=void 0;var L$=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),k$=Ce;function j$(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var Ci=function(){function r(e){j$(this,r),e instanceof y||(e=typeof e=="number"?y.alloc(e):y.from(e)),this._setBuffer(e),this.rewind()}return L$(r,[{key:"_setBuffer",value:function(t){this._buffer=t,this.length=t.length}},{key:"buffer",value:function(){return this._buffer}},{key:"tap",value:function(t){return t(this),this}},{key:"clone",value:function(t){var n=new this.constructor(this.buffer());return n.seek(arguments.length===0?this.tell():t),n}},{key:"tell",value:function(){return this._index}},{key:"seek",value:function(t,n){return arguments.length===1&&(n=t,t="="),t==="+"?this._index+=n:t==="-"?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(t,n,i){return this.seek("+",this.buffer().write(t,this.tell(),n,i))}},{key:"fill",value:function(t,n){return arguments.length===1&&(n=this.buffer().length-this.tell()),this.buffer().fill(t,this.tell(),this.tell()+n),this.seek("+",n),this}},{key:"slice",value:function(t){arguments.length===0&&(t=this.length-this.tell());var n=new this.constructor(this.buffer().slice(this.tell(),this.tell()+t));return this.seek("+",t),n}},{key:"copyFrom",value:function(t){var n=t instanceof y?t:t.buffer();return n.copy(this.buffer(),this.tell(),0,n.length),this.seek("+",n.length),this}},{key:"concat",value:function(t){t.forEach(function(i,a){i instanceof r&&(t[a]=i.buffer())}),t.unshift(this.buffer());var n=y.concat(t);return this._setBuffer(n),this}},{key:"toString",value:function(t,n){arguments.length===0?(t="utf8",n=this.buffer().length-this.tell()):arguments.length===1&&(n=this.buffer().length-this.tell());var i=this.buffer().toString(t,this.tell(),this.tell()+n);return this.seek("+",n),i}},{key:"writeBufferPadded",value:function(t){var n=(0,k$.calculatePadding)(t.length),i=y.alloc(n);return this.copyFrom(new r(t)).copyFrom(new r(i))}}]),r}();[[1,["readInt8","readUInt8"]],[2,["readInt16BE","readInt16LE","readUInt16BE","readUInt16LE"]],[4,["readInt32BE","readInt32LE","readUInt32BE","readUInt32LE","readFloatBE","readFloatLE"]],[8,["readDoubleBE","readDoubleLE"]]].forEach(function(r){r[1].forEach(function(e){Ci.prototype[e]=function(){var n=this.buffer()[e](this.tell());return this.seek("+",r[0]),n}})}),[[1,["writeInt8","writeUInt8"]],[2,["writeInt16BE","writeInt16LE","writeUInt16BE","writeUInt16LE"]],[4,["writeInt32BE","writeInt32LE","writeUInt32BE","writeUInt32LE","writeFloatBE","writeFloatLE"]],[8,["writeDoubleBE","writeDoubleLE"]]].forEach(function(r){r[1].forEach(function(e){Ci.prototype[e]=function(n){return this.buffer()[e](n,this.tell()),this.seek("+",r[0]),this}})}),Dt.Cursor=Ci,Object.defineProperty(D,"__esModule",{value:!0}),D.default=Y$;var V$=dv,nu=au(V$),G$=_i,H$=au(G$),iu=Dt;function au(r){return r&&r.__esModule?r:{default:r}}var W$=Math.pow(2,16),z$={toXDR:function(e){var t=new iu.Cursor(W$);this.write(e,t);var n=t.tell();return t.rewind(),t.slice(n).buffer()},fromXDR:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"raw",n=void 0;switch(t){case"raw":n=e;break;case"hex":n=y.from(e,"hex");break;case"base64":n=y.from(e,"base64");break;default:throw new Error("Invalid format "+t+', must be "raw", "hex", "base64"')}var i=new iu.Cursor(n),a=this.read(i);return a},validateXDR:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"raw";try{return this.fromXDR(e,t),!0}catch{return!1}}},X$={toXDR:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"raw",t=this.constructor.toXDR(this);switch(e){case"raw":return t;case"hex":return t.toString("hex");case"base64":return t.toString("base64");default:throw new Error("Invalid format "+e+', must be "raw", "hex", "base64"')}}};function Y$(r){(0,nu.default)(r,z$),(0,H$.default)(r)&&(0,nu.default)(r.prototype,X$)}Object.defineProperty(de,"__esModule",{value:!0}),de.Int=void 0;var K$=xt,ou=su(K$),Z$=D,J$=su(Z$);function su(r){return r&&r.__esModule?r:{default:r}}var Rr=de.Int={read:function(e){return e.readInt32BE()},write:function(e,t){if(!(0,ou.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");t.writeInt32BE(e)},isValid:function(e){return!(0,ou.default)(e)||Math.floor(e)!==e?!1:e>=Rr.MIN_VALUE&&e<=Rr.MAX_VALUE}};Rr.MAX_VALUE=Math.pow(2,31)-1,Rr.MIN_VALUE=-Math.pow(2,31),(0,J$.default)(Rr);var Gt={};function Q$(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var uu={exports:{}};(function(r){/**
|
|
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
|
-
*/(function(e,t){typeof Q$=="function"&&r&&r.exports?r.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(C,function(){function e(c,s,l){this.low=c|0,this.high=s|0,this.unsigned=!!l}e.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=function(s){return(s&&s.__isLong__)===!0};var t={},n={};e.fromInt=function(s,l){var p,g;return l?(s=s>>>0,0<=s&&s<256&&(g=n[s],g)?g:(p=new e(s,(s|0)<0?-1:0,!0),0<=s&&s<256&&(n[s]=p),p)):(s=s|0,-128<=s&&s<128&&(g=t[s],g)?g:(p=new e(s,s<0?-1:0,!1),-128<=s&&s<128&&(t[s]=p),p))},e.fromNumber=function(s,l){return l=!!l,isNaN(s)||!isFinite(s)?e.ZERO:!l&&s<=-f?e.MIN_VALUE:!l&&s+1>=f?e.MAX_VALUE:l&&s>=u?e.MAX_UNSIGNED_VALUE:s<0?e.fromNumber(-s,l).negate():new e(s%o|0,s/o|0,l)},e.fromBits=function(s,l,p){return new e(s,l,p)},e.fromString=function(s,l,p){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 l=="number"&&(p=l,l=!1),p=p||10,p<2||36<p)throw Error("radix out of range: "+p);var g;if((g=s.indexOf("-"))>0)throw Error('number format error: interior "-" character: '+s);if(g===0)return e.fromString(s.substring(1),l,p).negate();for(var $=e.fromNumber(Math.pow(p,8)),E=e.ZERO,A=0;A<s.length;A+=8){var S=Math.min(8,s.length-A),h=parseInt(s.substring(A,A+S),p);if(S<8){var O=e.fromNumber(Math.pow(p,S));E=E.multiply(O).add(e.fromNumber(h))}else E=E.multiply($),E=E.add(e.fromNumber(h))}return E.unsigned=l,E},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,d=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 l;if(this.isNegative())if(this.equals(e.MIN_VALUE)){var p=e.fromNumber(s),g=this.divide(p);return l=g.multiply(p).subtract(this),g.toString(s)+l.toInt().toString(s)}else return"-"+this.negate().toString(s);var $=e.fromNumber(Math.pow(s,6),this.unsigned);l=this;for(var E="";;){var A=l.divide($),S=l.subtract(A.multiply($)).toInt()>>>0,h=S.toString(s);if(l=A,l.isZero())return h+E;for(;h.length<6;)h="0"+h;E=""+h+E}},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,l=31;l>0&&!(s&1<<l);l--);return this.high!=0?l+33:l+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 l=this.isNegative(),p=s.isNegative();return l&&!p?-1:!l&&p?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 l=this.high>>>16,p=this.high&65535,g=this.low>>>16,$=this.low&65535,E=s.high>>>16,A=s.high&65535,S=s.low>>>16,h=s.low&65535,O=0,T=0,R=0,b=0;return b+=$+h,R+=b>>>16,b&=65535,R+=g+S,T+=R>>>16,R&=65535,T+=p+A,O+=T>>>16,T&=65535,O+=l+E,O&=65535,e.fromBits(R<<16|b,O<<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(d)&&s.lessThan(d))return e.fromNumber(this.toNumber()*s.toNumber(),this.unsigned);var l=this.high>>>16,p=this.high&65535,g=this.low>>>16,$=this.low&65535,E=s.high>>>16,A=s.high&65535,S=s.low>>>16,h=s.low&65535,O=0,T=0,R=0,b=0;return b+=$*h,R+=b>>>16,b&=65535,R+=g*h,T+=R>>>16,R&=65535,R+=$*S,T+=R>>>16,R&=65535,T+=p*h,O+=T>>>16,T&=65535,T+=g*S,O+=T>>>16,T&=65535,T+=$*A,O+=T>>>16,T&=65535,O+=l*h+p*S+g*A+$*E,O&=65535,e.fromBits(R<<16|b,O<<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 l,p,g;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 $=this.shiftRight(1);return l=$.divide(s).shiftLeft(1),l.equals(e.ZERO)?s.isNegative()?e.ONE:e.NEG_ONE:(p=this.subtract(s.multiply(l)),g=l.add(p.divide(s)),g)}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(g=e.ZERO,p=this;p.greaterThanOrEqual(s);){l=Math.max(1,Math.floor(p.toNumber()/s.toNumber()));for(var E=Math.ceil(Math.log(l)/Math.LN2),A=E<=48?1:Math.pow(2,E-48),S=e.fromNumber(l),h=S.multiply(s);h.isNegative()||h.greaterThan(p);)l-=A,S=e.fromNumber(l,this.unsigned),h=S.multiply(s);S.isZero()&&(S=e.ONE),g=g.add(S),p=p.subtract(h)}return g},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 l=this.high;if(s<32){var p=this.low;return e.fromBits(p>>>s|l<<32-s,l>>>s,this.unsigned)}else return s===32?e.fromBits(l,0,this.unsigned):e.fromBits(l>>>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})})(uu);var fu=uu.exports;Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.Hyper=void 0;var eE=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),cu=function r(e,t,n){e===null&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,t);if(i===void 0){var a=Object.getPrototypeOf(e);return a===null?void 0:r(a,t,n)}else{if("value"in i)return i.value;var o=i.get;return o===void 0?void 0:o.call(n)}},rE=fu,Mr=lu(rE),tE=D,nE=lu(tE);function lu(r){return r&&r.__esModule?r:{default:r}}function iE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function aE(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function oE(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var Dr=Gt.Hyper=function(r){oE(e,r),eE(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=cu(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=cu(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(t,n){return iE(this,e),aE(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,!1))}return e}(Mr.default);(0,nE.default)(Dr),Dr.MAX_VALUE=new Dr(Mr.default.MAX_VALUE.low,Mr.default.MAX_VALUE.high),Dr.MIN_VALUE=new Dr(Mr.default.MIN_VALUE.low,Mr.default.MIN_VALUE.high);var Be={};Object.defineProperty(Be,"__esModule",{value:!0}),Be.UnsignedInt=void 0;var sE=xt,du=pu(sE),uE=D,fE=pu(uE);function pu(r){return r&&r.__esModule?r:{default:r}}var Cr=Be.UnsignedInt={read:function(e){return e.readUInt32BE()},write:function(e,t){if(!(0,du.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);t.writeUInt32BE(e)},isValid:function(e){return!(0,du.default)(e)||Math.floor(e)!==e?!1:e>=Cr.MIN_VALUE&&e<=Cr.MAX_VALUE}};Cr.MAX_VALUE=Math.pow(2,32)-1,Cr.MIN_VALUE=0,(0,fE.default)(Cr);var Ht={};Object.defineProperty(Ht,"__esModule",{value:!0}),Ht.UnsignedHyper=void 0;var cE=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),hu=function r(e,t,n){e===null&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,t);if(i===void 0){var a=Object.getPrototypeOf(e);return a===null?void 0:r(a,t,n)}else{if("value"in i)return i.value;var o=i.get;return o===void 0?void 0:o.call(n)}},lE=fu,Nr=yu(lE),dE=D,pE=yu(dE);function yu(r){return r&&r.__esModule?r:{default:r}}function hE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function yE(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function gE(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var Br=Ht.UnsignedHyper=function(r){gE(e,r),cE(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=hu(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=hu(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(t,n){return hE(this,e),yE(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,!0))}return e}(Nr.default);(0,pE.default)(Br),Br.MAX_VALUE=new Br(Nr.default.MAX_UNSIGNED_VALUE.low,Nr.default.MAX_UNSIGNED_VALUE.high),Br.MIN_VALUE=new Br(Nr.default.MIN_VALUE.low,Nr.default.MIN_VALUE.high);var Wt={};Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.Float=void 0;var _E=xt,gu=_u(_E),vE=D,mE=_u(vE);function _u(r){return r&&r.__esModule?r:{default:r}}var wE=Wt.Float={read:function(e){return e.readFloatBE()},write:function(e,t){if(!(0,gu.default)(e))throw new Error("XDR Write Error: not a number");t.writeFloatBE(e)},isValid:function(e){return(0,gu.default)(e)}};(0,mE.default)(wE);var zt={};Object.defineProperty(zt,"__esModule",{value:!0}),zt.Double=void 0;var bE=xt,vu=mu(bE),$E=D,EE=mu($E);function mu(r){return r&&r.__esModule?r:{default:r}}var SE=zt.Double={read:function(e){return e.readDoubleBE()},write:function(e,t){if(!(0,vu.default)(e))throw new Error("XDR Write Error: not a number");t.writeDoubleBE(e)},isValid:function(e){return(0,vu.default)(e)}};(0,EE.default)(SE);var Xt={};Object.defineProperty(Xt,"__esModule",{value:!0}),Xt.Quadruple=void 0;var AE=D,OE=IE(AE);function IE(r){return r&&r.__esModule?r:{default:r}}var PE=Xt.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,OE.default)(PE);var qr={},xE=me,TE=we,FE="[object Boolean]";function RE(r){return r===!0||r===!1||TE(r)&&xE(r)==FE}var ME=RE;Object.defineProperty(qr,"__esModule",{value:!0}),qr.Bool=void 0;var DE=ME,CE=bu(DE),wu=de,NE=D,BE=bu(NE);function bu(r){return r&&r.__esModule?r:{default:r}}var qE=qr.Bool={read:function(e){var t=wu.Int.read(e);switch(t){case 0:return!1;case 1:return!0;default:throw new Error("XDR Read Error: Got "+t+" when trying to read a bool")}},write:function(e,t){var n=e?1:0;return wu.Int.write(n,t)},isValid:function(e){return(0,CE.default)(e)}};(0,BE.default)(qE);var Yt={},UE=me,LE=G,kE=we,jE="[object String]";function VE(r){return typeof r=="string"||!LE(r)&&kE(r)&&UE(r)==jE}var $u=VE;Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.String=void 0;var GE=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),HE=$u,Eu=Ni(HE),WE=G,zE=Ni(WE),Su=de,XE=Be,Au=Ce,YE=D,KE=Ni(YE);function Ni(r){return r&&r.__esModule?r:{default:r}}function ZE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var JE=Yt.String=function(){function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:XE.UnsignedInt.MAX_VALUE;ZE(this,r),this._maxLength=e}return GE(r,[{key:"read",value:function(t){var n=Su.Int.read(t);if(n>this._maxLength)throw new Error("XDR Read Error: Saw "+n+" length String,"+("max allowed is "+this._maxLength));var i=(0,Au.calculatePadding)(n),a=t.slice(n);return(0,Au.slicePadding)(t,i),a.buffer()}},{key:"readString",value:function(t){return this.read(t).toString("utf8")}},{key:"write",value:function(t,n){if(t.length>this._maxLength)throw new Error("XDR Write Error: Got "+t.length+" bytes,"+("max allows is "+this._maxLength));var i=void 0;(0,Eu.default)(t)?i=y.from(t,"utf8"):i=y.from(t),Su.Int.write(i.length,n),n.writeBufferPadded(i)}},{key:"isValid",value:function(t){var n=void 0;if((0,Eu.default)(t))n=y.from(t,"utf8");else if((0,zE.default)(t)||y.isBuffer(t))n=y.from(t);else return!1;return n.length<=this._maxLength}}]),r}();(0,KE.default)(JE.prototype);var Kt={};Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.Opaque=void 0;var QE=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),Ou=Ce,eS=D,rS=tS(eS);function tS(r){return r&&r.__esModule?r:{default:r}}function nS(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var iS=Kt.Opaque=function(){function r(e){nS(this,r),this._length=e,this._padding=(0,Ou.calculatePadding)(e)}return QE(r,[{key:"read",value:function(t){var n=t.slice(this._length);return(0,Ou.slicePadding)(t,this._padding),n.buffer()}},{key:"write",value:function(t,n){if(t.length!==this._length)throw new Error("XDR Write Error: Got "+t.length+" bytes, expected "+this._length);n.writeBufferPadded(t)}},{key:"isValid",value:function(t){return y.isBuffer(t)&&t.length===this._length}}]),r}();(0,rS.default)(iS.prototype);var Zt={};Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.VarOpaque=void 0;var aS=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),Iu=de,oS=Be,Pu=Ce,sS=D,uS=fS(sS);function fS(r){return r&&r.__esModule?r:{default:r}}function cS(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var lS=Zt.VarOpaque=function(){function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:oS.UnsignedInt.MAX_VALUE;cS(this,r),this._maxLength=e}return aS(r,[{key:"read",value:function(t){var n=Iu.Int.read(t);if(n>this._maxLength)throw new Error("XDR Read Error: Saw "+n+" length VarOpaque,"+("max allowed is "+this._maxLength));var i=(0,Pu.calculatePadding)(n),a=t.slice(n);return(0,Pu.slicePadding)(t,i),a.buffer()}},{key:"write",value:function(t,n){if(t.length>this._maxLength)throw new Error("XDR Write Error: Got "+t.length+" bytes,"+("max allows is "+this._maxLength));Iu.Int.write(t.length,n),n.writeBufferPadded(t)}},{key:"isValid",value:function(t){return y.isBuffer(t)&&t.length<=this._maxLength}}]),r}();(0,uS.default)(lS.prototype);var Jt={};function dS(r,e){for(var t=-1,n=r==null?0:r.length;++t<n&&e(r[t],t,r)!==!1;);return r}var pS=dS,hS=Ft;function yS(r){return typeof r=="function"?r:hS}var xu=yS,gS=pS,_S=bi,vS=xu,mS=G;function wS(r,e){var t=mS(r)?gS:_S;return t(r,vS(e))}var bS=wS,or=bS,$S=/\s/;function ES(r){for(var e=r.length;e--&&$S.test(r.charAt(e)););return e}var SS=ES,AS=SS,OS=/^\s+/;function IS(r){return r&&r.slice(0,AS(r)+1).replace(OS,"")}var PS=IS,xS=PS,Tu=er,TS=jt,Fu=0/0,FS=/^[-+]0x[0-9a-f]+$/i,RS=/^0b[01]+$/i,MS=/^0o[0-7]+$/i,DS=parseInt;function CS(r){if(typeof r=="number")return r;if(TS(r))return Fu;if(Tu(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=Tu(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=xS(r);var t=RS.test(r);return t||MS.test(r)?DS(r.slice(2),t?2:8):FS.test(r)?Fu:+r}var NS=CS,BS=NS,Ru=1/0,qS=17976931348623157e292;function US(r){if(!r)return r===0?r:0;if(r=BS(r),r===Ru||r===-Ru){var e=r<0?-1:1;return e*qS}return r===r?r:0}var LS=US,kS=LS;function jS(r){var e=kS(r),t=e%1;return e===e?t?e-t:e:0}var VS=jS,GS=ps,HS=xu,WS=VS,zS=9007199254740991,Bi=4294967295,XS=Math.min;function YS(r,e){if(r=WS(r),r<1||r>zS)return[];var t=Bi,n=XS(r,Bi);e=HS(e),r-=Bi;for(var i=GS(n,e);++t<r;)e(t);return i}var Mu=YS;Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.Array=void 0;var KS=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),ZS=Di,JS=Ur(ZS),QS=or,eA=Ur(QS),rA=Mu,tA=Ur(rA),nA=G,Du=Ur(nA),iA=D,aA=Ur(iA);function Ur(r){return r&&r.__esModule?r:{default:r}}function oA(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var sA=Jt.Array=function(){function r(e,t){oA(this,r),this._childType=e,this._length=t}return KS(r,[{key:"read",value:function(t){var n=this;return(0,tA.default)(this._length,function(){return n._childType.read(t)})}},{key:"write",value:function(t,n){var i=this;if(!(0,Du.default)(t))throw new Error("XDR Write Error: value is not array");if(t.length!==this._length)throw new Error("XDR Write Error: Got array of size "+t.length+","+("expected "+this._length));(0,eA.default)(t,function(a){return i._childType.write(a,n)})}},{key:"isValid",value:function(t){var n=this;return!(0,Du.default)(t)||t.length!==this._length?!1:(0,JS.default)(t,function(i){return n._childType.isValid(i)})}}]),r}();(0,aA.default)(sA.prototype);var Qt={};Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.VarArray=void 0;var uA=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),fA=Di,cA=Lr(fA),lA=or,dA=Lr(lA),pA=Mu,hA=Lr(pA),yA=G,Cu=Lr(yA),gA=Be,Nu=de,_A=D,vA=Lr(_A);function Lr(r){return r&&r.__esModule?r:{default:r}}function mA(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var wA=Qt.VarArray=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gA.UnsignedInt.MAX_VALUE;mA(this,r),this._childType=e,this._maxLength=t}return uA(r,[{key:"read",value:function(t){var n=this,i=Nu.Int.read(t);if(i>this._maxLength)throw new Error("XDR Read Error: Saw "+i+" length VarArray,"+("max allowed is "+this._maxLength));return(0,hA.default)(i,function(){return n._childType.read(t)})}},{key:"write",value:function(t,n){var i=this;if(!(0,Cu.default)(t))throw new Error("XDR Write Error: value is not array");if(t.length>this._maxLength)throw new Error("XDR Write Error: Got array of size "+t.length+","+("max allowed is "+this._maxLength));Nu.Int.write(t.length,n),(0,dA.default)(t,function(a){return i._childType.write(a,n)})}},{key:"isValid",value:function(t){var n=this;return!(0,Cu.default)(t)||t.length>this._maxLength?!1:(0,cA.default)(t,function(i){return n._childType.isValid(i)})}}]),r}();(0,vA.default)(wA.prototype);var en={};function bA(r){return r===null}var $A=bA;function EA(r){return r===void 0}var kr=EA;Object.defineProperty(en,"__esModule",{value:!0}),en.Option=void 0;var SA=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),AA=$A,Bu=qi(AA),OA=kr,qu=qi(OA),Uu=qr,IA=D,PA=qi(IA);function qi(r){return r&&r.__esModule?r:{default:r}}function xA(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var TA=en.Option=function(){function r(e){xA(this,r),this._childType=e}return SA(r,[{key:"read",value:function(t){if(Uu.Bool.read(t))return this._childType.read(t)}},{key:"write",value:function(t,n){var i=!((0,Bu.default)(t)||(0,qu.default)(t));Uu.Bool.write(i,n),i&&this._childType.write(t,n)}},{key:"isValid",value:function(t){return(0,Bu.default)(t)||(0,qu.default)(t)?!0:this._childType.isValid(t)}}]),r}();(0,PA.default)(TA.prototype);var jr={};Object.defineProperty(jr,"__esModule",{value:!0}),jr.Void=void 0;var FA=kr,Lu=ku(FA),RA=D,MA=ku(RA);function ku(r){return r&&r.__esModule?r:{default:r}}var DA=jr.Void={read:function(){},write:function(e){if(!(0,Lu.default)(e))throw new Error("XDR Write Error: trying to write value to a void slot")},isValid:function(e){return(0,Lu.default)(e)}};(0,MA.default)(DA);var rn={},CA=Mi;function NA(r,e){return CA(e,function(t){return r[t]})}var BA=NA,qA=BA,UA=Ct;function LA(r){return r==null?[]:qA(r,UA(r))}var kA=LA;Object.defineProperty(rn,"__esModule",{value:!0}),rn.Enum=void 0;var jA=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),VA=or,GA=Ui(VA),HA=kA,WA=Ui(HA),ju=de,zA=D,XA=Ui(zA);function Ui(r){return r&&r.__esModule?r:{default:r}}function YA(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function KA(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}function Vu(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var ZA=rn.Enum=function(){function r(e,t){Vu(this,r),this.name=e,this.value=t}return jA(r,null,[{key:"read",value:function(t){var n=ju.Int.read(t);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(t,n){if(!(t instanceof this))throw new Error("XDR Write Error: Unknown "+t+" is not a "+this.enumName);ju.Int.write(t.value,n)}},{key:"isValid",value:function(t){return t instanceof this}},{key:"members",value:function(){return this._members}},{key:"values",value:function(){return(0,WA.default)(this._members)}},{key:"fromName",value:function(t){var n=this._members[t];if(!n)throw new Error(t+" is not a member of "+this.enumName);return n}},{key:"fromValue",value:function(t){var n=this._byValue.get(t);if(!n)throw new Error(t+" is not a value of any member of "+this.enumName);return n}},{key:"create",value:function(t,n,i){var a=function(o){KA(u,o);function u(){return Vu(this,u),YA(this,(u.__proto__||Object.getPrototypeOf(u)).apply(this,arguments))}return u}(r);return a.enumName=n,t.results[n]=a,a._members={},a._byValue=new Map,(0,GA.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}}]),r}();(0,XA.default)(ZA);var tn={},JA=bi,QA=Fr;function eO(r,e){var t=-1,n=QA(r)?Array(r.length):[];return JA(r,function(i,a,o){n[++t]=e(i,a,o)}),n}var rO=eO,tO=Mi,nO=tu,iO=rO,aO=G;function oO(r,e){var t=aO(r)?tO:iO;return t(r,nO(e))}var sO=oO;function uO(r){for(var e=-1,t=r==null?0:r.length,n={};++e<t;){var i=r[e];n[i[0]]=i[1]}return n}var fO=uO,Vr={};Object.defineProperty(Vr,"__esModule",{value:!0});var cO=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();function lO(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}Vr.Reference=function(){function r(){lO(this,r)}return cO(r,[{key:"resolve",value:function(){throw new Error("implement resolve in child class")}}]),r}(),Object.defineProperty(tn,"__esModule",{value:!0}),tn.Struct=void 0;var nn=function(){function r(e,t){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),!(t&&n.length===t));i=!0);}catch(d){a=!0,o=d}finally{try{!i&&u.return&&u.return()}finally{if(a)throw o}}return n}return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return r(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),dO=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),pO=or,Gu=Gr(pO),hO=sO,yO=Gr(hO),gO=kr,_O=Gr(gO),vO=fO,mO=Gr(vO),wO=Vr,bO=D,$O=Gr(bO);function Gr(r){return r&&r.__esModule?r:{default:r}}function EO(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function SO(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}function Hu(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var AO=tn.Struct=function(){function r(e){Hu(this,r),this._attributes=e||{}}return dO(r,null,[{key:"read",value:function(t){var n=(0,yO.default)(this._fields,function(i){var a=nn(i,2),o=a[0],u=a[1],f=u.read(t);return[o,f]});return new this((0,mO.default)(n))}},{key:"write",value:function(t,n){if(!(t instanceof this))throw new Error("XDR Write Error: "+t+" is not a "+this.structName);(0,Gu.default)(this._fields,function(i){var a=nn(i,2),o=a[0],u=a[1],f=t._attributes[o];u.write(f,n)})}},{key:"isValid",value:function(t){return t instanceof this}},{key:"create",value:function(t,n,i){var a=function(o){SO(u,o);function u(){return Hu(this,u),EO(this,(u.__proto__||Object.getPrototypeOf(u)).apply(this,arguments))}return u}(r);return a.structName=n,t.results[n]=a,a._fields=i.map(function(o){var u=nn(o,2),f=u[0],d=u[1];return d instanceof wO.Reference&&(d=d.resolve(t)),[f,d]}),(0,Gu.default)(a._fields,function(o){var u=nn(o,1),f=u[0];a.prototype[f]=OO(f)}),a}}]),r}();(0,$O.default)(AO);function OO(r){return function(t){return(0,_O.default)(t)||(this._attributes[r]=t),this._attributes[r]}}var an={};Object.defineProperty(an,"__esModule",{value:!0}),an.Union=void 0;var IO=function(){function r(e,t){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),!(t&&n.length===t));i=!0);}catch(d){a=!0,o=d}finally{try{!i&&u.return&&u.return()}finally{if(a)throw o}}return n}return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return r(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),PO=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),xO=or,on=un(xO),TO=kr,Wu=un(TO),FO=$u,zu=un(FO),sn=jr,Li=Vr,RO=D,MO=un(RO);function un(r){return r&&r.__esModule?r:{default:r}}function DO(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function CO(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}function Xu(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var NO=an.Union=function(){function r(e,t){Xu(this,r),this.set(e,t)}return PO(r,[{key:"set",value:function(t,n){(0,zu.default)(t)&&(t=this.constructor._switchOn.fromName(t)),this._switch=t,this._arm=this.constructor.armForSwitch(this._switch),this._armType=this.constructor.armTypeForArm(this._arm),this._value=n}},{key:"get",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this._arm;if(this._arm!==sn.Void&&this._arm!==t)throw new Error(t+" 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(t){if(this._switches.has(t))return this._switches.get(t);if(this._defaultArm)return this._defaultArm;throw new Error("Bad union switch: "+t)}},{key:"armTypeForArm",value:function(t){return t===sn.Void?sn.Void:this._arms[t]}},{key:"read",value:function(t){var n=this._switchOn.read(t),i=this.armForSwitch(n),a=this.armTypeForArm(i),o=void 0;return(0,Wu.default)(a)?o=i.read(t):o=a.read(t),new this(n,o)}},{key:"write",value:function(t,n){if(!(t instanceof this))throw new Error("XDR Write Error: "+t+" is not a "+this.unionName);this._switchOn.write(t.switch(),n),t.armType().write(t.value(),n)}},{key:"isValid",value:function(t){return t instanceof this}},{key:"create",value:function(t,n,i){var a=function(u){CO(f,u);function f(){return Xu(this,f),DO(this,(f.__proto__||Object.getPrototypeOf(f)).apply(this,arguments))}return f}(r);a.unionName=n,t.results[n]=a,i.switchOn instanceof Li.Reference?a._switchOn=i.switchOn.resolve(t):a._switchOn=i.switchOn,a._switches=new Map,a._arms={},(0,on.default)(i.arms,function(u,f){u instanceof Li.Reference&&(u=u.resolve(t)),a._arms[f]=u});var o=i.defaultArm;return o instanceof Li.Reference&&(o=o.resolve(t)),a._defaultArm=o,(0,on.default)(i.switches,function(u){var f=IO(u,2),d=f[0],c=f[1];(0,zu.default)(d)&&(d=a._switchOn.fromName(d)),a._switches.set(d,c)}),(0,Wu.default)(a._switchOn.values)||(0,on.default)(a._switchOn.values(),function(u){a[u.name]=function(f){return new a(u,f)},a.prototype[u.name]=function(d){return this.set(u,d)}}),(0,on.default)(a._arms,function(u,f){u!==sn.Void&&(a.prototype[f]=function(){return this.get(f)})}),a}}]),r}();(0,MO.default)(NO),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=de;Object.keys(e).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return e[h]}})});var t=Gt;Object.keys(t).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return t[h]}})});var n=Be;Object.keys(n).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return n[h]}})});var i=Ht;Object.keys(i).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return i[h]}})});var a=Wt;Object.keys(a).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return a[h]}})});var o=zt;Object.keys(o).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return o[h]}})});var u=Xt;Object.keys(u).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return u[h]}})});var f=qr;Object.keys(f).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return f[h]}})});var d=Yt;Object.keys(d).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return d[h]}})});var c=Kt;Object.keys(c).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return c[h]}})});var s=Zt;Object.keys(s).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return s[h]}})});var l=Jt;Object.keys(l).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return l[h]}})});var p=Qt;Object.keys(p).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return p[h]}})});var g=en;Object.keys(g).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return g[h]}})});var $=jr;Object.keys($).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return $[h]}})});var E=rn;Object.keys(E).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return E[h]}})});var A=tn;Object.keys(A).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return A[h]}})});var S=an;Object.keys(S).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return S[h]}})})}(gi);var Yu={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=function(){function b(_,m){for(var I=0;I<m.length;I++){var P=m[I];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(_,P.key,P)}}return function(_,m,I){return m&&b(_.prototype,m),I&&b(_,I),_}}(),t=Vr;Object.keys(t).forEach(function(b){b==="default"||b==="__esModule"||Object.defineProperty(r,b,{enumerable:!0,get:function(){return t[b]}})}),r.config=g;var n=kr,i=c(n),a=or,o=c(a),u=gi,f=d(u);function d(b){if(b&&b.__esModule)return b;var _={};if(b!=null)for(var m in b)Object.prototype.hasOwnProperty.call(b,m)&&(_[m]=b[m]);return _.default=b,_}function c(b){return b&&b.__esModule?b:{default:b}}function s(b,_){if(!(b instanceof _))throw new TypeError("Cannot call a class as a function")}function l(b,_){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:b}function p(b,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);b.prototype=Object.create(_&&_.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(b,_):b.__proto__=_)}function g(b){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(b){var m=new R(_);b(m),m.resolve()}return _}var $=function(b){p(_,b);function _(m){s(this,_);var I=l(this,(_.__proto__||Object.getPrototypeOf(_)).call(this));return I.name=m,I}return e(_,[{key:"resolve",value:function(I){var P=I.definitions[this.name];return P.resolve(I)}}]),_}(t.Reference),E=function(b){p(_,b);function _(m,I){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;s(this,_);var q=l(this,(_.__proto__||Object.getPrototypeOf(_)).call(this));return q.childReference=m,q.length=I,q.variable=P,q}return e(_,[{key:"resolve",value:function(I){var P=this.childReference,q=this.length;return P instanceof t.Reference&&(P=P.resolve(I)),q instanceof t.Reference&&(q=q.resolve(I)),this.variable?new f.VarArray(P,q):new f.Array(P,q)}}]),_}(t.Reference),A=function(b){p(_,b);function _(m){s(this,_);var I=l(this,(_.__proto__||Object.getPrototypeOf(_)).call(this));return I.childReference=m,I.name=m.name,I}return e(_,[{key:"resolve",value:function(I){var P=this.childReference;return P instanceof t.Reference&&(P=P.resolve(I)),new f.Option(P)}}]),_}(t.Reference),S=function(b){p(_,b);function _(m,I){s(this,_);var P=l(this,(_.__proto__||Object.getPrototypeOf(_)).call(this));return P.sizedType=m,P.length=I,P}return e(_,[{key:"resolve",value:function(I){var P=this.length;return P instanceof t.Reference&&(P=P.resolve(I)),new this.sizedType(P)}}]),_}(t.Reference),h=function(){function b(_,m,I){s(this,b),this.constructor=_,this.name=m,this.config=I}return e(b,[{key:"resolve",value:function(m){return this.name in m.results?m.results[this.name]:this.constructor(m,this.name,this.config)}}]),b}();function O(b,_,m){return m instanceof t.Reference&&(m=m.resolve(b)),b.results[_]=m,m}function T(b,_,m){return b.results[_]=m,m}var R=function(){function b(_){s(this,b),this._destination=_,this._definitions={}}return e(b,[{key:"enum",value:function(m,I){var P=new h(f.Enum.create,m,I);this.define(m,P)}},{key:"struct",value:function(m,I){var P=new h(f.Struct.create,m,I);this.define(m,P)}},{key:"union",value:function(m,I){var P=new h(f.Union.create,m,I);this.define(m,P)}},{key:"typedef",value:function(m,I){var P=new h(O,m,I);this.define(m,P)}},{key:"const",value:function(m,I){var P=new h(T,m,I);this.define(m,P)}},{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(m){return new S(f.String,m)}},{key:"opaque",value:function(m){return new S(f.Opaque,m)}},{key:"varOpaque",value:function(m){return new S(f.VarOpaque,m)}},{key:"array",value:function(m,I){return new E(m,I)}},{key:"varArray",value:function(m,I){return new E(m,I,!0)}},{key:"option",value:function(m){return new A(m)}},{key:"define",value:function(m,I){if((0,i.default)(this._destination[m]))this._definitions[m]=I;else throw new Error("XDRTypes Error:"+m+" is already defined")}},{key:"lookup",value:function(m){return new $(m)}},{key:"resolve",value:function(){var m=this;(0,o.default)(this._definitions,function(I){I.resolve({definitions:m._definitions,results:m._destination})})}}]),b}()})(Yu),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=gi;Object.keys(e).forEach(function(n){n==="default"||n==="__esModule"||Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[n]}})});var t=Yu;Object.keys(t).forEach(function(n){n==="default"||n==="__esModule"||Object.defineProperty(r,n,{enumerable:!0,get:function(){return t[n]}})})}(Qo);var ki=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)},j=(r,e,t)=>(ki(r,e,"read from private field"),t?t.call(r):e.get(r)),be=(r,e,t)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,t)},ji=(r,e,t,n)=>(ki(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),K=(r,e,t)=>(ki(r,e,"access private method"),t),oe,se,Hr,Vi,Ku,Gi,Zu,fn,Hi,sr,Wr,zr,cn;function BO(r){const e={variantId:he.Uint64.fromString(r.variantId.toString()),version:r.version||Math.floor(Date.now()/1e3),items:r.items.map(n=>new he.BundleItem({collectionId:he.Uint64.fromString(n.collectionId.toString()),productId:he.Uint64.fromString(n.productId.toString()),variantId:he.Uint64.fromString(n.variantId.toString()),sku:n.sku||"",quantity:n.quantity,ext:new he.BundleItemExt(0)})),ext:new he.BundleExt(0)},t=new he.Bundle(e);return he.BundleEnvelope.envelopeTypeBundle(t).toXDR("base64")}const he=Qo.config(r=>{r.enum("EnvelopeType",{envelopeTypeBundle:0}),r.typedef("Uint32",r.uint()),r.typedef("Uint64",r.uhyper()),r.union("BundleItemExt",{switchOn:r.int(),switchName:"v",switches:[[0,r.void()]],arms:{}}),r.struct("BundleItem",[["collectionId",r.lookup("Uint64")],["productId",r.lookup("Uint64")],["variantId",r.lookup("Uint64")],["sku",r.string()],["quantity",r.lookup("Uint32")],["ext",r.lookup("BundleItemExt")]]),r.union("BundleExt",{switchOn:r.int(),switchName:"v",switches:[[0,r.void()]],arms:{}}),r.struct("Bundle",[["variantId",r.lookup("Uint64")],["items",r.varArray(r.lookup("BundleItem"),500)],["version",r.lookup("Uint32")],["ext",r.lookup("BundleExt")]]),r.union("BundleEnvelope",{switchOn:r.lookup("EnvelopeType"),switchName:"type",switches:[["envelopeTypeBundle","v1"]],arms:{v1:r.lookup("Bundle")}})});class qO{constructor(e,t){be(this,Vi),be(this,Gi),be(this,fn),be(this,sr),be(this,zr),be(this,oe,void 0),be(this,se,void 0),be(this,Hr,void 0),ji(this,oe,K(this,Vi,Ku).call(this,t)),ji(this,Hr,K(this,Gi,Zu).call(this,t)),ji(this,se,e)}isInitialDataValid(){if(!j(this,Hr))throw"Bundle data does not exist for the given product.";if(!j(this,oe))throw"Bundle settings do not exist for the given product.";if(!Array.isArray(j(this,se))||!j(this,se).length)throw"No bundle selection items provided.";return!0}isValidVariant(e){if(!j(this,oe)?.variantsSettings[e])throw`The ${e} bundle variant is invalid.`;return!0}isSelectionInVariantRange(e){const t=j(this,se).reduce((i,a)=>i+a.quantity,0),n=j(this,oe)?.variantsSettings[e].ranges||[];if(!K(this,fn,Hi).call(this,n,t))throw"The total number of products does not fall within the required variant range.";return!0}areItemsInMaxPerItemBound(){const e=j(this,oe)?.bundleSettings.maxPerItem||0,t=j(this,se).filter(({quantity:n})=>n>e);if(e&&t.length)throw`The selected products (${K(this,sr,Wr).call(this,t.map(({externalProductId:n})=>n)).join(", ")}) exceed the maximum limit of ${e} items per product.`;return!0}areSelectedCollectionsValid(e){const t=j(this,oe)?.variantsSettings[e]?.optionSources,n=j(this,se).filter(({collectionId:i})=>!t||!K(this,zr,cn).call(this,t,i));if(n.length)throw`The collections (${K(this,sr,Wr).call(this,n.map(({collectionId:i})=>i)).join(", ")}) are no longer valid for the bundle variant (${e}).`;return!0}areItemsQuantitiesValidForTheCollection(e){const t=j(this,se).reduce((a,o)=>(a[o.collectionId]=o.quantity+(a[o.collectionId]||0),a),Object.create(null)),n=j(this,oe)?.variantsSettings[e],i=Object.values(n?.optionSources||{}).filter(a=>{const o=t[a.collectionId]||0;return!K(this,fn,Hi).call(this,[a],o)});if(!n||i.length)throw`The selection exceeds the limits for the collections (${K(this,sr,Wr).call(this,i.map(({collectionId:a})=>a)).join(", ")}).`;return!0}areSelectedProductsValid(e){const t=j(this,oe)?.variantsSettings[e]?.optionSources||{},n=Object.values(t).reduce((a,o)=>{const u=j(this,Hr)?.collections[o.collectionId];return u&&(a[o.collectionId]=u),a},Object.create(null));if(!Object.values(n).length)throw`No collections found for the bundle variant (${e}).`;const i=j(this,se).filter(({externalProductId:a,collectionId:o})=>K(this,zr,cn).call(this,n,o)?!K(this,zr,cn).call(this,n[o].products,a):!0);if(i.length)throw`The products (${K(this,sr,Wr).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}}oe=new WeakMap,se=new WeakMap,Hr=new WeakMap,Vi=new WeakSet,Ku=function(r){try{const e=r.bundle_settings;return{bundleSettings:{maxPerItem:e.max_quantity_per_variant,isCustomizable:e.is_customizable},variantsSettings:e.variants.reduce((t,n)=>{if(!n.enabled)return t;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}))),t[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),Object.create(null)),ranges:i},t},Object.create(null))}}catch{return null}},Gi=new WeakSet,Zu=function(r){try{const e=Object.values(r.collections).reduce((t,n)=>(t[n.id]={...n,products:n.products.reduce((i,a)=>(i[a.id]=a,i),Object.create(null))},t),Object.create(null));return{...r,collections:e}}catch{return null}},fn=new WeakSet,Hi=function(r,e){return!!r.filter(({min:t,max:n})=>{const i=t??e,a=n??e;return i<=e&&e<=a}).length},sr=new WeakSet,Wr=function(r){return Array.from(new Set(r))},zr=new WeakSet,cn=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)};const UO="/bundling-storefront-manager";function Ju(r){return BO({variantId:r.externalVariantId,version:0,items:r.selections.map(e=>({collectionId:e.collectionId,productId:e.externalProductId,variantId:e.externalVariantId,quantity:e.quantity,sku:""}))})}async function LO(r){const e=V(),t=await Wi(r);if(t!==!0)throw new Error(t);const n=Ju(r);try{const i=await Me("post",`${UO}/api/v1/bundles`,{data:{bundle:n},headers:{Origin:`https://${e.storeIdentifier}`}});if(!i.id||i.code!==200)throw new Error(`1: failed generating rb_id: ${JSON.stringify(i)}`);return i.id}catch(i){throw new Error(`2: failed generating rb_id ${i}`)}}async function kO(r,e){const t=await Wi(e);if(t!==!0)throw new Error(t);const n=Ju(e);try{const i=await w("post","/bundle_selections/bundle_id",{data:{bundle:n}},v(r,"getBundleSelectionId"));if(!i.id||i.code!==200)throw new Error(`1: failed generating rb_id: ${JSON.stringify(i)}`);return i.id}catch(i){throw new Error(`2: failed generating rb_id ${i}`)}}function jO(r,e){const t=Qu(r);if(t!==!0)throw new Error(`Dynamic Bundle is invalid. ${t}`);const n=`${va(9)}:${r.externalProductId}`;return r.selections.map(i=>{const a={id:i.externalVariantId,quantity:i.quantity,properties:{_rc_bundle:n,_rc_bundle_variant:r.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 Wi(r){try{return r?r.selections.length===0?"No selections defined":!0:"Bundle is not defined"}catch(e){return`Error fetching bundle settings: ${e}`}}async function VO(r){try{const e=await Me("get",`/bundle-data/${F(r.externalProductId)}`);return{valid:new qO(r.selections,e).isBundleSelectionValid(r.externalVariantId)}}catch(e){return{valid:!1,error:String(e)}}}const GO={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 Qu(r){if(!r)return"No bundle defined.";if(r.selections.length===0)return"No selections defined.";const{shippingIntervalFrequency:e,shippingIntervalUnitType:t}=r.selections.find(n=>n.shippingIntervalFrequency||n.shippingIntervalUnitType)||{};if(e||t){if(!e||!t)return"Shipping intervals do not match on selections.";{const n=GO[t];for(let i=0;i<r.selections.length;i++){const{shippingIntervalFrequency:a,shippingIntervalUnitType:o}=r.selections[i];if(a&&a!==e||o&&!n.includes(o))return"Shipping intervals do not match on selections."}}}return!0}async function HO(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{bundle_selection:t}=await w("get","/bundle_selections",{id:e},v(r,"getBundleSelection"));return t}function WO(r,e){return w("get","/bundle_selections",{query:e},v(r,"listBundleSelections"))}async function zO(r,e){const{bundle_selection:t}=await w("post","/bundle_selections",{data:e},v(r,"createBundleSelection"));return t}async function XO(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{bundle_selection:n}=await w("put","/bundle_selections",{id:e,data:t},v(r,"updateBundleSelection"));return n}function YO(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/bundle_selections",{id:e},v(r,"deleteBundleSelection"))}async function KO(r,e,t,n){if(e===void 0||e==="")throw new Error("Purchase item ID is required");const{subscription:i}=await w("put","/bundles",{id:e,data:t,query:n},v(r,"updateBundle"));return i}var ZO=Object.freeze({__proto__:null,createBundleSelection:zO,deleteBundleSelection:YO,getBundleId:LO,getBundleSelection:HO,getBundleSelectionId:kO,getDynamicBundleItems:jO,listBundleSelections:WO,updateBundle:KO,updateBundleSelection:XO,validateBundle:Wi,validateBundleSelection:VO,validateDynamicBundle:Qu});const JO=r=>{const e=r.layout_settings.addons,t=r.layout_settings.crossSells,n=r.customization_window,i=r.layout_settings?.defaultVariantId??r.default_bundle_variant_id,a=r.layout_settings.defaultFrequency,o=r.layout_settings.addToCartCallback;return{default_variant_id:i?String(i):null,is_customizable:r.is_customizable,price_rule:String(r.price_rule).toUpperCase(),customization_window:n?{active_days:n,disabled_message:r.customization_window_disabled_message||""}:null,addons:e.collectionId?{collection_id:e.collectionId,collection_handle:e.collectionHandle}:null,cross_sells:t.collectionId?{collection_id:e.collectionId,collection_handle:e.collectionHandle}:null,default_selling_plan_id:a||null,collapsible_collections:r.layout_settings.collapsibleSections,max_quantity_per_variant:r.max_quantity_per_variant,show_product_variants:r.layout_settings.showVariants,product_details_modal_enabled:r.layout_settings.learnMoreModal,addToCartBehavior:{type:o.type==="none"?"cart_page":o.type,value:o.value}}},QO=r=>r.tiered_discounts.length===0?null:{tiered_discounts:r.tiered_discounts},ln=r=>({id:r.id,name:r.name,options:r.options.map(e=>({name:e.name,value:e.value})),recurring_deliveries:r.recurring_deliveries,price_adjustments:r.price_adjustments.map(({value:e,value_type:t})=>({value:e,value_type:t}))}),ef=r=>({name:r.name,options:r.options.map(e=>({name:e.name,values:e.values})),selling_plans:r.selling_plans.map(ln)}),rf=r=>({id:String(r.id),title:r.title,price:r.price,compare_at_price:r.compare_at_price,options:r.options,available_for_sale:r.available}),zi=r=>r==null||typeof r=="string"?r:"src"in r?r.src:null,tf=r=>({id:String(r.id),title:r.title,description:r.description,available_for_sale:r.available,featured_image:zi(r.featured_image),images:r.images,requires_selling_plan:r.requires_selling_plan,selling_plan_groups:r.selling_plan_groups.map(ef)}),nf=r=>{const e=rI(r.selling_plan_groups);return{...tf(r),handle:r.handle,tags:r.tags,price_range:{min:r.price_min,max:r.price_max},compare_at_price_range:{min:r.compare_at_price_min,max:r.compare_at_price_max},options:r.options,variants:r.variants.map(t=>({...rf(t),selling_plan_allocations:t.selling_plan_allocations.map(n=>({price:n.price,compare_at_price:n.compare_at_price,selling_plan:ln(e[`${n.selling_plan_group_id}-${n.selling_plan_id}`])})),option1:t.option1,option2:t.option2,option3:t.option3,sku:t.sku||"",requires_shipping:t.requires_shipping,taxable:t.taxable,featured_image:zi(t.featured_image),public_title:t.public_title,requires_selling_plan:t.requires_selling_plan}))}},eI=({items_count:r,ranges:e})=>e.length>0?e.map(({quantity_max:t,quantity_min:n})=>({min:n,max:t})):[{min:r,max:r}],rI=r=>r.reduce((e,t)=>(t.selling_plans.forEach(n=>{const i=`${t.id}-${n.id}`;e[i]=n}),e),{}),tI=r=>Array.isArray(r)?r:[];function Xi(r){const e=JO(r.bundle_settings),t=r.variants.reduce((n,i)=>(n[i.id]=i,n),{});return{id:String(r.id),title:r.title,description:r.description||null,handle:r.handle,options:r.options.map(n=>({name:n.name,position:n.position,values:n.values})),default_variant_id:e.default_variant_id,default_selling_plan_id:e.default_selling_plan_id?Number(e.default_selling_plan_id):null,available_for_sale:r.available,requires_selling_plan:r.requires_selling_plan,bundle_settings:{is_customizable:e.is_customizable,price_rule:e.price_rule,customization_window:e.customization_window,max_quantity_per_variant:e.max_quantity_per_variant,collapsible_collections:e.collapsible_collections,show_product_variants:e.show_product_variants,product_details_modal_enabled:e.product_details_modal_enabled,show_variants_as_individual_products:r.bundle_settings.settings.display_variants_as_separate_products_in_list,post_add_to_cart_behavior:e.addToCartBehavior},variants:r.bundle_settings.variants.filter(({enabled:n})=>n).map((n,i)=>{const a=t[String(n.external_variant_id)];return{id:String(n.external_variant_id),title:a.title,price:a.price,compare_at_price:a.compare_at_price,image:a.image||"",available_for_sale:a.available,options:a.options,requires_selling_plan:a.requires_selling_plan,selling_plan_allocations:a.selling_plan_allocations.map(o=>({price:o.price,compare_at_price:o.compare_at_price,selling_plan:ln(o.selling_plan)})),ranges:eI(n),collections:n.option_sources.map(o=>({id:o.option_source_id,source_platform:"shopify",min:o.quantity_min||0,max:o.quantity_max,position:o.position})),default_selections:n.selection_defaults.map(o=>({quantity:o.quantity,product:{id:String(o.product.id),handle:o.handle,title:o.product.title,description:o.product.description,images:o.product.images},variant:{id:o.external_variant_id,title:o.variant.title,featured_image:zi(o.variant.featured_image),sku:o.sku||""}})),position:i}}),selling_plan_groups:r.selling_plan_groups.map(ef),collections:Object.values(r.collections).reduce((n,i)=>(Array.isArray(i.products)&&(n[String(i.id)]={id:String(i.id),title:i.title,handle:i.handle,products:i.products.map(nf)}),n),{}),addons:r.addons.products.length?{collection_id:e.addons?.collection_id||"",collection_handle:e.addons?.collection_handle||"",products:r.addons.products.map(n=>({...tf(n),price_range:{min:n.price,max:n.price},compare_at_price_range:{min:n.compare_at_price||0,max:n.compare_at_price},variants:n.variants.map(i=>({...rf(i),image:i.image,selling_plan_allocations:i.selling_plan_allocations.map(a=>({price:a.price,compare_at_price:a.compare_at_price,selling_plan:ln(a.selling_plan)}))}))}))}:null,cross_sells:r.cross_sells.products.length?{collection_id:e.cross_sells?.collection_id||"",collection_handle:e.cross_sells?.collection_handle||"",products:r.cross_sells.products.map(nf)}:null,incentives:QO(r.incentives),filters:tI(r.filters),templates:r.bundle_settings.layout_settings.templates||null,globalStyles:r.bundle_settings.layout_settings.globalStyles||null}}async function nI(r,e){return e?.source==="shopify_storefront"?aI():iI(r,e?.country_code)}async function iI(r,e){const{appName:t,appVersion:n}=V(),i={"X-Recharge-Sdk-Fn":"loadFromOnlineStore","X-Recharge-Sdk-Version":"1.90.0",...t?{"X-Recharge-Sdk-App-Name":t}:{},...n?{"X-Recharge-Sdk-App-Version":n}:{}};if(!e){const o=await Me("get",`/bundle-data/${F(r)}`,{headers:i});return Xi(o)}const a=new FormData;a.append("form_type","localization"),a.append("_method","put"),a.append("return_to",`${Zo}/bundle-data/${r}`),a.append("country_code",e);try{const o=await Y("post","/localization",{headers:{"Content-Type":"multipart/form-data",...i},data:a});return Xi(o)}catch{const o=await Me("get",`/bundle-data/${F(r)}`,{headers:i});return Xi(o)}}async function aI(r,e){if(!V().storeIdentifier)throw new Error("Store identifier is required for Shopify Storefront API requests");return{}}var oI=Object.freeze({__proto__:null,loadBundleData:nI}),sI=200,Yi="__lodash_hash_undefined__",uI=1/0,af=9007199254740991,fI="[object Arguments]",cI="[object Function]",lI="[object GeneratorFunction]",dI="[object Symbol]",pI=/[\\^$.*+?()[\]{}|]/g,hI=/^\[object .+?Constructor\]$/,yI=/^(?:0|[1-9]\d*)$/,gI=typeof C=="object"&&C&&C.Object===Object&&C,_I=typeof self=="object"&&self&&self.Object===Object&&self,Ki=gI||_I||Function("return this")();function vI(r,e,t){switch(t.length){case 0:return r.call(e);case 1:return r.call(e,t[0]);case 2:return r.call(e,t[0],t[1]);case 3:return r.call(e,t[0],t[1],t[2])}return r.apply(e,t)}function mI(r,e){var t=r?r.length:0;return!!t&&$I(r,e,0)>-1}function wI(r,e,t){for(var n=-1,i=r?r.length:0;++n<i;)if(t(e,r[n]))return!0;return!1}function of(r,e){for(var t=-1,n=r?r.length:0,i=Array(n);++t<n;)i[t]=e(r[t],t,r);return i}function Zi(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r}function bI(r,e,t,n){for(var i=r.length,a=t+(n?1:-1);n?a--:++a<i;)if(e(r[a],a,r))return a;return-1}function $I(r,e,t){if(e!==e)return bI(r,EI,t);for(var n=t-1,i=r.length;++n<i;)if(r[n]===e)return n;return-1}function EI(r){return r!==r}function SI(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}function AI(r){return function(e){return r(e)}}function OI(r,e){return r.has(e)}function II(r,e){return r?.[e]}function PI(r){var e=!1;if(r!=null&&typeof r.toString!="function")try{e=!!(r+"")}catch{}return e}function sf(r,e){return function(t){return r(e(t))}}var xI=Array.prototype,TI=Function.prototype,dn=Object.prototype,Ji=Ki["__core-js_shared__"],uf=function(){var r=/[^.]+$/.exec(Ji&&Ji.keys&&Ji.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),ff=TI.toString,ur=dn.hasOwnProperty,Qi=dn.toString,FI=RegExp("^"+ff.call(ur).replace(pI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),cf=Ki.Symbol,RI=sf(Object.getPrototypeOf,Object),MI=dn.propertyIsEnumerable,DI=xI.splice,lf=cf?cf.isConcatSpreadable:void 0,ea=Object.getOwnPropertySymbols,df=Math.max,CI=hf(Ki,"Map"),Xr=hf(Object,"create");function qe(r){var e=-1,t=r?r.length:0;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}function NI(){this.__data__=Xr?Xr(null):{}}function BI(r){return this.has(r)&&delete this.__data__[r]}function qI(r){var e=this.__data__;if(Xr){var t=e[r];return t===Yi?void 0:t}return ur.call(e,r)?e[r]:void 0}function UI(r){var e=this.__data__;return Xr?e[r]!==void 0:ur.call(e,r)}function LI(r,e){var t=this.__data__;return t[r]=Xr&&e===void 0?Yi:e,this}qe.prototype.clear=NI,qe.prototype.delete=BI,qe.prototype.get=qI,qe.prototype.has=UI,qe.prototype.set=LI;function fr(r){var e=-1,t=r?r.length:0;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}function kI(){this.__data__=[]}function jI(r){var e=this.__data__,t=hn(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():DI.call(e,t,1),!0}function VI(r){var e=this.__data__,t=hn(e,r);return t<0?void 0:e[t][1]}function GI(r){return hn(this.__data__,r)>-1}function HI(r,e){var t=this.__data__,n=hn(t,r);return n<0?t.push([r,e]):t[n][1]=e,this}fr.prototype.clear=kI,fr.prototype.delete=jI,fr.prototype.get=VI,fr.prototype.has=GI,fr.prototype.set=HI;function cr(r){var e=-1,t=r?r.length:0;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}function WI(){this.__data__={hash:new qe,map:new(CI||fr),string:new qe}}function zI(r){return yn(this,r).delete(r)}function XI(r){return yn(this,r).get(r)}function YI(r){return yn(this,r).has(r)}function KI(r,e){return yn(this,r).set(r,e),this}cr.prototype.clear=WI,cr.prototype.delete=zI,cr.prototype.get=XI,cr.prototype.has=YI,cr.prototype.set=KI;function pn(r){var e=-1,t=r?r.length:0;for(this.__data__=new cr;++e<t;)this.add(r[e])}function ZI(r){return this.__data__.set(r,Yi),this}function JI(r){return this.__data__.has(r)}pn.prototype.add=pn.prototype.push=ZI,pn.prototype.has=JI;function QI(r,e){var t=ra(r)||yf(r)?SI(r.length,String):[],n=t.length,i=!!n;for(var a in r)(e||ur.call(r,a))&&!(i&&(a=="length"||lP(a,n)))&&t.push(a);return t}function hn(r,e){for(var t=r.length;t--;)if(vP(r[t][0],e))return t;return-1}function eP(r,e,t,n){var i=-1,a=mI,o=!0,u=r.length,f=[],d=e.length;if(!u)return f;t&&(e=of(e,AI(t))),n?(a=wI,o=!1):e.length>=sI&&(a=OI,o=!1,e=new pn(e));e:for(;++i<u;){var c=r[i],s=t?t(c):c;if(c=n||c!==0?c:0,o&&s===s){for(var l=d;l--;)if(e[l]===s)continue e;f.push(c)}else a(e,s,n)||f.push(c)}return f}function pf(r,e,t,n,i){var a=-1,o=r.length;for(t||(t=cP),i||(i=[]);++a<o;){var u=r[a];e>0&&t(u)?e>1?pf(u,e-1,t,n,i):Zi(i,u):n||(i[i.length]=u)}return i}function rP(r,e,t){var n=e(r);return ra(r)?n:Zi(n,t(r))}function tP(r){if(!ta(r)||pP(r))return!1;var e=_f(r)||PI(r)?FI:hI;return e.test(_P(r))}function nP(r){if(!ta(r))return yP(r);var e=hP(r),t=[];for(var n in r)n=="constructor"&&(e||!ur.call(r,n))||t.push(n);return t}function iP(r,e){return r=Object(r),aP(r,e,function(t,n){return n in r})}function aP(r,e,t){for(var n=-1,i=e.length,a={};++n<i;){var o=e[n],u=r[o];t(u,o)&&(a[o]=u)}return a}function oP(r,e){return e=df(e===void 0?r.length-1:e,0),function(){for(var t=arguments,n=-1,i=df(t.length-e,0),a=Array(i);++n<i;)a[n]=t[e+n];n=-1;for(var o=Array(e+1);++n<e;)o[n]=t[n];return o[e]=a,vI(r,this,o)}}function sP(r){return rP(r,$P,fP)}function yn(r,e){var t=r.__data__;return dP(e)?t[typeof e=="string"?"string":"hash"]:t.map}function hf(r,e){var t=II(r,e);return tP(t)?t:void 0}var uP=ea?sf(ea,Object):mf,fP=ea?function(r){for(var e=[];r;)Zi(e,uP(r)),r=RI(r);return e}:mf;function cP(r){return ra(r)||yf(r)||!!(lf&&r&&r[lf])}function lP(r,e){return e=e??af,!!e&&(typeof r=="number"||yI.test(r))&&r>-1&&r%1==0&&r<e}function dP(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function pP(r){return!!uf&&uf in r}function hP(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||dn;return r===t}function yP(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e}function gP(r){if(typeof r=="string"||bP(r))return r;var e=r+"";return e=="0"&&1/r==-uI?"-0":e}function _P(r){if(r!=null){try{return ff.call(r)}catch{}try{return r+""}catch{}}return""}function vP(r,e){return r===e||r!==r&&e!==e}function yf(r){return mP(r)&&ur.call(r,"callee")&&(!MI.call(r,"callee")||Qi.call(r)==fI)}var ra=Array.isArray;function gf(r){return r!=null&&wP(r.length)&&!_f(r)}function mP(r){return vf(r)&&gf(r)}function _f(r){var e=ta(r)?Qi.call(r):"";return e==cI||e==lI}function wP(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=af}function ta(r){var e=typeof r;return!!r&&(e=="object"||e=="function")}function vf(r){return!!r&&typeof r=="object"}function bP(r){return typeof r=="symbol"||vf(r)&&Qi.call(r)==dI}function $P(r){return gf(r)?QI(r,!0):nP(r)}var EP=oP(function(r,e){return r==null?{}:(e=of(pf(e,1),gP),iP(r,eP(sP(r),e)))});function mf(){return[]}var SP=EP,na=$e(SP);function AP(r){try{return JSON.parse(r)}catch{return r}}function OP(r){return Object.entries(r).reduce((e,[t,n])=>({...e,[t]:AP(n)}),{})}const wf=r=>typeof r=="string"?r!=="0"&&r!=="false":!!r;function bf(r){const e=OP(r),t=e.auto_inject===void 0?!0:e.auto_inject,n=e.display_on??[],i=e.first_option==="autodeliver";return{...na(e,["display_on","first_option"]),auto_inject:t,valid_pages:n,is_subscription_first:i,autoInject:t,validPages:n,isSubscriptionFirst:i}}function $f(r){const e=r.subscription_options?.storefront_purchase_options==="subscription_only";return{...r,is_subscription_only:e,isSubscriptionOnly:e}}function IP(r){return r.map(e=>{const t={};return Object.entries(e).forEach(([n,i])=>{Object.defineProperty(t,n,{value:$f(i),enumerable:!0,writable:!0,configurable:!0})}),t})}const ia="2020-12",PP={store_currency:{currency_code:"USD",currency_symbol:"$",decimal_separator:".",thousands_separator:",",currency_symbol_location:"left"}},Yr=new Map;function gn(r,e){return Yr.has(r)||Yr.set(r,e()),Yr.get(r)}async function aa(r,e){if(r===void 0||r==="")throw new Error("ID is required");const t=e?.version??"2020-12",{product:n}=await gn(`product.${r}.${t}`,()=>It("get",`/product/${t}/${F(r)}.json`));return t==="2020-12"?$f(n):n}async function Ef(){return await gn("storeSettings",()=>It("get",`/${ia}/store_settings.json`).catch(()=>PP))}async function Sf(){const{widget_settings:r}=await gn("widgetSettings",()=>It("get",`/${ia}/widget_settings.json`));return bf(r)}async function Af(){const{products:r,widget_settings:e,store_settings:t,meta:n}=await gn("productsAndSettings",()=>It("get",`/product/${ia}/products.json`));return n?.status==="error"?Promise.reject(n.message):{products:IP(r),widget_settings:bf(e),store_settings:t??{}}}async function xP(){const{products:r}=await Af();return r}async function TP(r){const[e,t,n]=await Promise.all([aa(r),Ef(),Sf()]);return{product:e,store_settings:t,widget_settings:n,storeSettings:t,widgetSettings:n}}async function FP(r){const{bundle_product:e}=await aa(r);return e}async function Of(){return Array.from(Yr.keys()).forEach(r=>Yr.delete(r))}var RP=Object.freeze({__proto__:null,getCDNBundleSettings:FP,getCDNProduct:aa,getCDNProductAndSettings:TP,getCDNProducts:xP,getCDNProductsAndSettings:Af,getCDNStoreSettings:Ef,getCDNWidgetSettings:Sf,resetCDNCache:Of});async function MP(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await w("get","/charges",{id:e,query:{include:t?.include}},v(r,"getCharge"));return n}function DP(r,e){return w("get","/charges",{query:e},v(r,"listCharges"))}async function CP(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await w("post",`/charges/${F(e)}/apply_discount`,{data:{discount_code:t}},v(r,"applyDiscountToCharge"));return n}async function NP(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{charge:t}=await w("post",`/charges/${F(e)}/remove_discount`,{},v(r,"removeDiscountsFromCharge"));return t}async function BP(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");if(t===void 0||t.length===0)throw new Error("Purchase item IDs are required");const{charge:i}=await w("post",`/charges/${F(e)}/skip`,{query:n,data:{purchase_item_ids:t.map(a=>Number(a))}},v(r,"skipCharge"));return i}async function qP(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");if(t===void 0||t.length===0)throw new Error("Purchase item IDs are required");const{charge:i}=await w("post",`/charges/${F(e)}/unskip`,{query:n,data:{purchase_item_ids:t.map(a=>Number(a))}},v(r,"unskipCharge"));return i}async function UP(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{charge:t}=await w("post",`/charges/${F(e)}/process`,{},v(r,"processCharge"));return t}async function LP(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await w("post",`/charges/${F(e)}/change_next_charge_date`,{data:{next_charge_date:t}},v(r,"rescheduleCharge"));return n}var kP=Object.freeze({__proto__:null,applyDiscountToCharge:CP,getCharge:MP,listCharges:DP,processCharge:UP,removeDiscountsFromCharge:NP,rescheduleCharge:LP,skipCharge:BP,unskipCharge:qP});async function If(r,e){if(!["2020-12","2022-06"].includes(e.format_version))throw new Error("Missing or unsupported format_version.");return w("get","/product_search",{query:e,headers:{"X-Recharge-Version":"2021-01"}},v(r,"productSearch"))}var jP=Object.freeze({__proto__:null,productSearch:If});async function Pf(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{collection:t}=await w("get","/collections",{id:e},v(r,"getCollection"));return t}function VP(r,e){return w("get","/collections",{query:e},v(r,"listCollections"))}async function GP(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");if(!["2020-12","2022-06"].includes(t.format_version))throw new Error("Missing or unsupported format_version.");const n=v(r,"listCollectionProducts"),[{sort_order:i,manual_sort_order:a},{products:o}]=await Promise.all([Pf(n,e),If(n,{...t,collection_ids:[e],limit:250})]);if(i==="manual")return{products:a.reduce((u,f)=>{const d=o.find(c=>c.external_product_id===f);return d&&u.push(d),u},[])};{const u=HP(i);return{products:o.slice().sort(u)}}}function xf(r,e){const t=r.external_created_at,n=e.external_created_at;return t<n?-1:n>t?1:0}function Tf(r,e){const t=r.external_product_id,n=e.external_product_id;return t<n?-1:n>t?1:0}function Ff(r,e){const t=r.title.toLowerCase(),n=e.title.toLowerCase();return t<n?-1:n>t?1:0}function HP(r){switch(r){case"created_at-asc":return xf;case"created_at-desc":return(e,t)=>xf(t,e);case"id-asc":return Tf;case"id-desc":return(e,t)=>Tf(t,e);case"title-asc":return Ff;case"title-desc":return(e,t)=>Ff(t,e)}}var WP=Object.freeze({__proto__:null,getCollection:Pf,listCollectionProducts:GP,listCollections:VP});async function zP(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{customer:n}=await w("get","/customers",{id:t,query:{include:e?.include}},v(r,"getCustomer"));return n}async function Rf(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{customer:n}=await w("put","/customers",{id:t,data:e},v(r,"updateCustomer"));return n}async function XP(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{deliveries:n}=await w("get",`/customers/${F(t)}/delivery_schedule`,{query:e},v(r,"getDeliverySchedule"));return n}async function _n(r,e){return w("get","/portal_access",{query:e},v(r,"getCustomerPortalAccess"))}async function YP(r,e,t){if(e===void 0||e==="")throw new Error("Subscription ID is required");const{base_url:n,customer_hash:i,temp_token:a}=await _n(v(r,"getActiveChurnLandingPageURL"));return`${n.replace("portal","pages")}${i}/subscriptions/${e}/cancel?token=${a}&subscription=${e}&redirect_to=${t}`}async function KP(r){const{base_url:e,customer_hash:t,temp_token:n}=await _n(v(r,"getFailedPaymentMethodRecoveryLandingPageURL"));return`${e.replace("portal","pages")}account/payment-methods?token=${n}&hash=${t}`}async function ZP(r,e,t){if(e===void 0||e==="")throw new Error("Gift ID is required");const{base_url:n,customer_hash:i,temp_token:a}=await _n(v(r,"getGiftRedemptionLandingPageURL"));return`${n.replace("portal","pages")}${i}/gifts/${e}?token=${a}&redirect_to=${t}`}const Mf={SHOPIFY_UPDATE_PAYMENT_INFO:{type:"email",template_type:"shopify_update_payment_information"},SHOPIFY_MIGRATE_PAYMENT_INFO:{type:"email",template_type:"shopify_migrate_payment_information"}};async function JP(r,e,t){const n=r.customerId;if(!n)throw new Error("Not logged in.");if(!Object.prototype.hasOwnProperty.call(Mf,e))throw new Error("Notification not supported.");const i=Mf[e];return w("post",`/customers/${F(n)}/notifications`,{data:{...i,template_vars:t}},v(r,"sendCustomerNotification"))}async function QP(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{credit_summary:n}=await w("get",`/customers/${F(t)}/credit_summary`,{query:{include:e?.include}},v(r,"getCreditSummary"));return n}var ex=Object.freeze({__proto__:null,getActiveChurnLandingPageURL:YP,getCreditSummary:QP,getCustomer:zP,getCustomerPortalAccess:_n,getDeliverySchedule:XP,getFailedPaymentMethodRecoveryLandingPageURL:KP,getGiftRedemptionLandingPageURL:ZP,sendCustomerNotification:JP,updateCustomer:Rf});async function rx(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{credit_summary:n}=await w("get",`/customers/${F(t)}/credit_summary`,{query:{include:e?.include,presentment_currency_code:e?.presentment_currency_code}},v(r,"getCreditSummary"));return n}function tx(r,{recurring:e}){if(!r.customerId)throw new Error("Not logged in.");const t={};return e!==void 0&&(t.apply_credit_to_next_recurring_charge=e),Rf(v(r,"setApplyCreditsToNextCharge"),t)}async function nx(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{customer_id:n,...i}=e??{};return await w("get","/credit_accounts",{query:{...i,customer_id:t}},v(r,"listCreditAccounts"))}var ix=Object.freeze({__proto__:null,getCreditSummary:rx,listCreditAccounts:nx,setApplyCreditsToNextCharge:tx});async function ax(r,e,t){return await w("post","/customer_surveys/cancellation_prevention",{data:{customer_id:e,subscription_id:t}},v(r,"getCustomerSurveyReasons"))}async function ox(r,e,t,n){return await w("post",`/customer_surveys/${F(t)}/customer_response`,{data:{customer_id:e,response_id:n}},v(r,"getCustomerSurveyOffers"))}async function sx(r,e){return await w("post","/offers/claim",{data:e},v(r,"claimOfferCustomerSurvey")),{}}var ux=Object.freeze({__proto__:null,claimOfferCustomerSurvey:sx,getCustomerSurveyOffers:ox,getCustomerSurveyReasons:ax});function fx(r,e){if(!r.customerId)throw new Error("Not logged in.");return w("get","/gift_purchases",{query:e},v(r,"listGiftPurchases"))}async function cx(r,e){if(!r.customerId)throw new Error("Not logged in.");if(e===void 0||e==="")throw new Error("ID is required");const{gift_purchase:t}=await w("get","/gift_purchases",{id:e},v(r,"getGiftPurchase"));return t}var lx=Object.freeze({__proto__:null,getGiftPurchase:cx,listGiftPurchases:fx});function dx(r,e){if(!r.customerId)throw new Error("Not logged in.");return w("get","/incentives/tiered_discounts",{query:e},v(r,"listTieredDiscounts"))}async function px(r,e){if(!r.customerId)throw new Error("Not logged in.");if(e===void 0||e==="")throw new Error("ID is required");const{tiered_discount:t}=await w("get",`/incentives/tiered_discounts/${F(e)}`,{},v(r,"getTieredDiscount"));return t}function hx(r,e){return w("post","/incentives/tiered_discounts/offers",{data:e},v(r,"getTieredDiscountOffers"))}var yx=Object.freeze({__proto__:null,getTieredDiscount:px,getTieredDiscountOffers:hx,listTieredDiscounts:dx});async function gx(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{membership:t}=await w("get","/memberships",{id:e},v(r,"getMembership"));return t}function _x(r,e){return w("get","/memberships",{query:e},v(r,"listMemberships"))}async function vx(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{membership:n}=await w("post",`/memberships/${F(e)}/cancel`,{data:t},v(r,"cancelMembership"));return n}async function mx(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{membership:n}=await w("post",`/memberships/${F(e)}/activate`,{data:t},v(r,"activateMembership"));return n}async function wx(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{membership:n}=await w("post",`/memberships/${F(e)}/change`,{data:t},v(r,"changeMembership"));return n}var bx=Object.freeze({__proto__:null,activateMembership:mx,cancelMembership:vx,changeMembership:wx,getMembership:gx,listMemberships:_x});async function $x(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{membership_program:n}=await w("get","/membership_programs",{id:e,query:{include:t?.include}},v(r,"getMembershipProgram"));return n}function Ex(r,e){return w("get","/membership_programs",{query:e},v(r,"listMembershipPrograms"))}var Sx=Object.freeze({__proto__:null,getMembershipProgram:$x,listMembershipPrograms:Ex});async function Ax(r,e){const{metafield:t}=await w("post","/metafields",{data:{metafield:e}},v(r,"createMetafield"));return t}async function Ox(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{metafield:n}=await w("put","/metafields",{id:e,data:{metafield:t}},v(r,"updateMetafield"));return n}function Ix(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/metafields",{id:e},v(r,"deleteMetafield"))}var Px=Object.freeze({__proto__:null,createMetafield:Ax,deleteMetafield:Ix,updateMetafield:Ox});async function xx(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{onetime:t}=await w("get","/onetimes",{id:e},v(r,"getOnetime"));return t}function Tx(r,e){return w("get","/onetimes",{query:e},v(r,"listOnetimes"))}async function Fx(r,e){const{onetime:t}=await w("post","/onetimes",{data:e},v(r,"createOnetime"));return t}async function Rx(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{onetime:n}=await w("put","/onetimes",{id:e,data:t},v(r,"updateOnetime"));return n}function Mx(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/onetimes",{id:e},v(r,"deleteOnetime"))}var Dx=Object.freeze({__proto__:null,createOnetime:Fx,deleteOnetime:Mx,getOnetime:xx,listOnetimes:Tx,updateOnetime:Rx});async function Cx(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{order:t}=await w("get","/orders",{id:e},v(r,"getOrder"));return t}function Nx(r,e){return w("get","/orders",{query:e},v(r,"listOrders"))}async function Bx(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{order:t}=await w("post",`/orders/${F(e)}/delay`,{},v(r,"delayOrder"));return t}var qx=Object.freeze({__proto__:null,delayOrder:Bx,getOrder:Cx,listOrders:Nx});async function Ux(r,e){return typeof window<"u"&&window.Spreedly?Promise.resolve():new Promise((t,n)=>{if(typeof document>"u"){n(new Error("Document is not available. This function must be called in a browser environment."));return}if(document.querySelector(`script[src="${r}"]`)){const a=()=>{window.Spreedly?t():setTimeout(a,50)};a();return}const i=document.createElement("script");i.src=r,i.integrity=e,i.crossOrigin="anonymous",i.addEventListener("load",()=>{const a=()=>{window.Spreedly?t():setTimeout(a,50)};a()}),i.addEventListener("error",()=>{n(new Error("Failed to load payment iFrame script"))}),document.head.appendChild(i)})}async function Lx(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{payment_method:n}=await w("get","/payment_methods",{id:e,query:{include:t?.include}},v(r,"getPaymentMethod"));return n}async function Df(r,e){const{payment_method:t}=await w("post","/payment_methods",{data:{...e,customer_id:r.customerId}},v(r,"createPaymentMethod"));return t}async function kx(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{payment_method:n}=await w("put","/payment_methods",{id:e,data:t},v(r,"updatePaymentMethod"));return n}function jx(r,e){return w("get","/payment_methods",{query:e},v(r,"listPaymentMethods"))}async function Vx(r,e){const t=await Gx(r,e),n=t.external.environment_key,i=t.payment_method_intent_id,a=t.external_customer_id.ecommerce,o=t.external.resource_url,u=t.external.integrity_hash,f=t.payment_method?.processor_payment_method_token;await Ux(o,u);let d=!1,c=null,s=null,l=null;return{mount(p,g){if(typeof window>"u"||!window.Spreedly)throw new Error("Payment script failed to load");window.Spreedly.init(n,{numberEl:p.numberElementId,cvvEl:p.cvvElementId}),window.Spreedly.on("ready",()=>{d=!0,p.styles&&(window.Spreedly.setStyle("number",p.styles),window.Spreedly.setStyle("cvv",p.styles)),p.numberLabel&&window.Spreedly.setLabel("number",p.numberLabel),p.cvvLabel&&window.Spreedly.setLabel("cvv",p.cvvLabel),p.numberPlaceholder&&window.Spreedly.setPlaceholder("number",p.numberPlaceholder),p.cvvPlaceholder&&window.Spreedly.setPlaceholder("cvv",p.cvvPlaceholder),p.numberFormat==="plainFormat"?(p.numberFieldType&&window.Spreedly.setFieldType("number",p.numberFieldType),p.cvvFieldType&&window.Spreedly.setFieldType("cvv",p.cvvFieldType),window.Spreedly.setNumberFormat("plainFormat")):p.numberFormat==="maskedFormat"?(window.Spreedly.setFieldType("cvv","text"),window.Spreedly.setFieldType("number","text"),window.Spreedly.setNumberFormat("maskedFormat")):p.numberFormat==="prettyFormat"?(p.numberFieldType==="text"||p.numberFieldType==="tel"?window.Spreedly.setFieldType("number",p.numberFieldType):window.Spreedly.setFieldType("number","tel"),p.cvvFieldType==="text"||p.cvvFieldType==="tel"?window.Spreedly.setFieldType("cvv",p.cvvFieldType):window.Spreedly.setFieldType("cvv","tel"),window.Spreedly.setNumberFormat("prettyFormat")):(p.numberFieldType&&window.Spreedly.setFieldType("number",p.numberFieldType),p.cvvFieldType&&window.Spreedly.setFieldType("cvv",p.cvvFieldType)),g?.onReady?.()}),window.Spreedly.on("fieldEvent",($,E,A,S)=>{g?.onFieldEvent?.($,E,A,S)}),window.Spreedly.on("errors",$=>{g?.onErrors?.($)}),window.Spreedly.on("paymentMethod",($,E)=>{c=$,g?.onPaymentMethod?.($,E),s&&(c=null,s($),s=null)})},tokenize(p){if(!d||!window.Spreedly)throw new Error("Payment form is not initialized");let g=String(p.year);g.length===2&&(g=`20${g}`);const $=String(p.month).padStart(2,"0");"full_name"in p?window.Spreedly.tokenizeCreditCard({full_name:p.full_name,month:$,year:g}):window.Spreedly.tokenizeCreditCard({first_name:p.first_name,last_name:p.last_name,month:$,year:g})},async submit(p){if(!d)throw new Error("Payment form is not initialized");if(c){const g=c;return c=null,Cf(r,g,p,{external_payment_method_id:f,payment_method_intent_id:i,external_customer_id:a})}return new Promise((g,$)=>{l=p,s=async E=>{try{const A=await Cf(r,E,l,{external_payment_method_id:f,payment_method_intent_id:i,external_customer_id:a});g(A)}catch(A){$(A)}finally{l=null}},this.tokenize(p.card_details)})},reset(){window.Spreedly&&window.Spreedly.reload(),c=null,s=null,l=null},unmount(){window.Spreedly&&window.Spreedly.removeHandlers(),d=!1,c=null,s=null,l=null},addEventHandlers(p){p.onReady&&window.Spreedly.on("ready",p.onReady),p.onFieldEvent&&window.Spreedly.on("fieldEvent",p.onFieldEvent),p.onErrors&&window.Spreedly.on("errors",p.onErrors),p.onPaymentMethod&&window.Spreedly.on("paymentMethod",p.onPaymentMethod)},removeHandlers(){window.Spreedly&&window.Spreedly.removeHandlers()},setFieldType(p,g){window.Spreedly.setFieldType(p,g)},setLabel(p,g){window.Spreedly.setLabel(p,g)},setNumberFormat(p){window.Spreedly.setNumberFormat(p)},setPlaceholder(p,g){window.Spreedly.setPlaceholder(p,g)},setStyle(p,g){window.Spreedly.setStyle(p,g)}}}async function Gx(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");return await w("post","/payment_method_intents",{data:{customer_id:t,payment_method_id:e}},v(r,"createFrictionlessPaymentIntentV1"))}async function Cf(r,e,{billing_address:t,default_payment_method:n,address_ids:i,apply_to_all_subscription_addresses:a},{external_payment_method_id:o,payment_method_intent_id:u,external_customer_id:f}){return await Df(v(r,"submitFrictionlessPaymentMethodV1"),{default:n??!1,payment_type:"CREDIT_CARD",processor_customer_token:f.toString(),processor_name:"frictionless",processor_payment_method_token:e,billing_address:t,payment_method_intent_id:u,address_ids:i,external_payment_method_id:o,apply_to_all_subscription_addresses:a})}var Hx=Object.freeze({__proto__:null,createPaymentMethod:Df,getPaymentMethod:Lx,initFrictionlessPaymentV1:Vx,listPaymentMethods:jx,updatePaymentMethod:kx});async function Wx(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{plan:t}=await w("get","/plans",{id:e},v(r,"getPlan"));return t}function zx(r,e){return w("get","/plans",{query:e},v(r,"listPlans"))}var Xx=Object.freeze({__proto__:null,getPlan:Wx,listPlans:zx});async function Yx(r,e){return await w("get","/shop/shipping_countries",{query:e,headers:{"X-Recharge-Version":"2021-01"}},v(r,"getShippingCountries"))}async function Kx(r){return await w("get","/shop/settings",{headers:{"X-Recharge-Version":"2021-01"}},v(r,"getStoreSettings"))}var Zx=Object.freeze({__proto__:null,getShippingCountries:Yx,getStoreSettings:Kx}),Jx="Expected a function",Nf="__lodash_placeholder__",Ue=1,vn=2,Qx=4,lr=8,Kr=16,Le=32,Zr=64,Bf=128,e2=256,qf=512,Uf=1/0,r2=9007199254740991,t2=17976931348623157e292,Lf=0/0,n2=[["ary",Bf],["bind",Ue],["bindKey",vn],["curry",lr],["curryRight",Kr],["flip",qf],["partial",Le],["partialRight",Zr],["rearg",e2]],i2="[object Function]",a2="[object GeneratorFunction]",o2="[object Symbol]",s2=/[\\^$.*+?()[\]{}|]/g,u2=/^\s+|\s+$/g,f2=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,c2=/\{\n\/\* \[wrapped with (.+)\] \*/,l2=/,? & /,d2=/^[-+]0x[0-9a-f]+$/i,p2=/^0b[01]+$/i,h2=/^\[object .+?Constructor\]$/,y2=/^0o[0-7]+$/i,g2=/^(?:0|[1-9]\d*)$/,_2=parseInt,v2=typeof C=="object"&&C&&C.Object===Object&&C,m2=typeof self=="object"&&self&&self.Object===Object&&self,Jr=v2||m2||Function("return this")();function oa(r,e,t){switch(t.length){case 0:return r.call(e);case 1:return r.call(e,t[0]);case 2:return r.call(e,t[0],t[1]);case 3:return r.call(e,t[0],t[1],t[2])}return r.apply(e,t)}function w2(r,e){for(var t=-1,n=r?r.length:0;++t<n&&e(r[t],t,r)!==!1;);return r}function b2(r,e){var t=r?r.length:0;return!!t&&E2(r,e,0)>-1}function $2(r,e,t,n){for(var i=r.length,a=t+(n?1:-1);n?a--:++a<i;)if(e(r[a],a,r))return a;return-1}function E2(r,e,t){if(e!==e)return $2(r,S2,t);for(var n=t-1,i=r.length;++n<i;)if(r[n]===e)return n;return-1}function S2(r){return r!==r}function A2(r,e){for(var t=r.length,n=0;t--;)r[t]===e&&n++;return n}function O2(r,e){return r?.[e]}function I2(r){var e=!1;if(r!=null&&typeof r.toString!="function")try{e=!!(r+"")}catch{}return e}function sa(r,e){for(var t=-1,n=r.length,i=0,a=[];++t<n;){var o=r[t];(o===e||o===Nf)&&(r[t]=Nf,a[i++]=t)}return a}var P2=Function.prototype,kf=Object.prototype,ua=Jr["__core-js_shared__"],jf=function(){var r=/[^.]+$/.exec(ua&&ua.keys&&ua.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),Vf=P2.toString,x2=kf.hasOwnProperty,Gf=kf.toString,T2=RegExp("^"+Vf.call(x2).replace(s2,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),F2=Object.create,dr=Math.max,R2=Math.min,Hf=function(){var r=zf(Object,"defineProperty"),e=zf.name;return e&&e.length>2?r:void 0}();function M2(r){return pr(r)?F2(r):{}}function D2(r){if(!pr(r)||W2(r))return!1;var e=K2(r)||I2(r)?T2:h2;return e.test(X2(r))}function C2(r,e){return e=dr(e===void 0?r.length-1:e,0),function(){for(var t=arguments,n=-1,i=dr(t.length-e,0),a=Array(i);++n<i;)a[n]=t[e+n];n=-1;for(var o=Array(e+1);++n<e;)o[n]=t[n];return o[e]=a,oa(r,this,o)}}function N2(r,e,t,n){for(var i=-1,a=r.length,o=t.length,u=-1,f=e.length,d=dr(a-o,0),c=Array(f+d),s=!n;++u<f;)c[u]=e[u];for(;++i<o;)(s||i<a)&&(c[t[i]]=r[i]);for(;d--;)c[u++]=r[i++];return c}function B2(r,e,t,n){for(var i=-1,a=r.length,o=-1,u=t.length,f=-1,d=e.length,c=dr(a-u,0),s=Array(c+d),l=!n;++i<c;)s[i]=r[i];for(var p=i;++f<d;)s[p+f]=e[f];for(;++o<u;)(l||i<a)&&(s[p+t[o]]=r[i++]);return s}function q2(r,e){var t=-1,n=r.length;for(e||(e=Array(n));++t<n;)e[t]=r[t];return e}function U2(r,e,t){var n=e&Ue,i=Qr(r);function a(){var o=this&&this!==Jr&&this instanceof a?i:r;return o.apply(n?t:this,arguments)}return a}function Qr(r){return function(){var e=arguments;switch(e.length){case 0:return new r;case 1:return new r(e[0]);case 2:return new r(e[0],e[1]);case 3:return new r(e[0],e[1],e[2]);case 4:return new r(e[0],e[1],e[2],e[3]);case 5:return new r(e[0],e[1],e[2],e[3],e[4]);case 6:return new r(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new r(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var t=M2(r.prototype),n=r.apply(t,e);return pr(n)?n:t}}function L2(r,e,t){var n=Qr(r);function i(){for(var a=arguments.length,o=Array(a),u=a,f=ca(i);u--;)o[u]=arguments[u];var d=a<3&&o[0]!==f&&o[a-1]!==f?[]:sa(o,f);if(a-=d.length,a<t)return Wf(r,e,fa,i.placeholder,void 0,o,d,void 0,void 0,t-a);var c=this&&this!==Jr&&this instanceof i?n:r;return oa(c,this,o)}return i}function fa(r,e,t,n,i,a,o,u,f,d){var c=e&Bf,s=e&Ue,l=e&vn,p=e&(lr|Kr),g=e&qf,$=l?void 0:Qr(r);function E(){for(var A=arguments.length,S=Array(A),h=A;h--;)S[h]=arguments[h];if(p)var O=ca(E),T=A2(S,O);if(n&&(S=N2(S,n,i,p)),a&&(S=B2(S,a,o,p)),A-=T,p&&A<d){var R=sa(S,O);return Wf(r,e,fa,E.placeholder,t,S,R,u,f,d-A)}var b=s?t:this,_=l?b[r]:r;return A=S.length,u?S=z2(S,u):g&&A>1&&S.reverse(),c&&f<A&&(S.length=f),this&&this!==Jr&&this instanceof E&&(_=$||Qr(_)),_.apply(b,S)}return E}function k2(r,e,t,n){var i=e&Ue,a=Qr(r);function o(){for(var u=-1,f=arguments.length,d=-1,c=n.length,s=Array(c+f),l=this&&this!==Jr&&this instanceof o?a:r;++d<c;)s[d]=n[d];for(;f--;)s[d++]=arguments[++u];return oa(l,i?t:this,s)}return o}function Wf(r,e,t,n,i,a,o,u,f,d){var c=e&lr,s=c?o:void 0,l=c?void 0:o,p=c?a:void 0,g=c?void 0:a;e|=c?Le:Zr,e&=~(c?Zr:Le),e&Qx||(e&=~(Ue|vn));var $=t(r,e,i,p,s,g,l,u,f,d);return $.placeholder=n,Xf($,r,e)}function j2(r,e,t,n,i,a,o,u){var f=e&vn;if(!f&&typeof r!="function")throw new TypeError(Jx);var d=n?n.length:0;if(d||(e&=~(Le|Zr),n=i=void 0),o=o===void 0?o:dr(Yf(o),0),u=u===void 0?u:Yf(u),d-=i?i.length:0,e&Zr){var c=n,s=i;n=i=void 0}var l=[r,e,t,n,i,c,s,a,o,u];if(r=l[0],e=l[1],t=l[2],n=l[3],i=l[4],u=l[9]=l[9]==null?f?0:r.length:dr(l[9]-d,0),!u&&e&(lr|Kr)&&(e&=~(lr|Kr)),!e||e==Ue)var p=U2(r,e,t);else e==lr||e==Kr?p=L2(r,e,u):(e==Le||e==(Ue|Le))&&!i.length?p=k2(r,e,t,n):p=fa.apply(void 0,l);return Xf(p,r,e)}function ca(r){var e=r;return e.placeholder}function zf(r,e){var t=O2(r,e);return D2(t)?t:void 0}function V2(r){var e=r.match(c2);return e?e[1].split(l2):[]}function G2(r,e){var t=e.length,n=t-1;return e[n]=(t>1?"& ":"")+e[n],e=e.join(t>2?", ":" "),r.replace(f2,`{
|
|
24
|
+
*/(function(e,t){typeof Q$=="function"&&r&&r.exports?r.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(C,function(){function e(c,s,l){this.low=c|0,this.high=s|0,this.unsigned=!!l}e.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=function(s){return(s&&s.__isLong__)===!0};var t={},n={};e.fromInt=function(s,l){var p,g;return l?(s=s>>>0,0<=s&&s<256&&(g=n[s],g)?g:(p=new e(s,(s|0)<0?-1:0,!0),0<=s&&s<256&&(n[s]=p),p)):(s=s|0,-128<=s&&s<128&&(g=t[s],g)?g:(p=new e(s,s<0?-1:0,!1),-128<=s&&s<128&&(t[s]=p),p))},e.fromNumber=function(s,l){return l=!!l,isNaN(s)||!isFinite(s)?e.ZERO:!l&&s<=-f?e.MIN_VALUE:!l&&s+1>=f?e.MAX_VALUE:l&&s>=u?e.MAX_UNSIGNED_VALUE:s<0?e.fromNumber(-s,l).negate():new e(s%o|0,s/o|0,l)},e.fromBits=function(s,l,p){return new e(s,l,p)},e.fromString=function(s,l,p){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 l=="number"&&(p=l,l=!1),p=p||10,p<2||36<p)throw Error("radix out of range: "+p);var g;if((g=s.indexOf("-"))>0)throw Error('number format error: interior "-" character: '+s);if(g===0)return e.fromString(s.substring(1),l,p).negate();for(var $=e.fromNumber(Math.pow(p,8)),E=e.ZERO,A=0;A<s.length;A+=8){var S=Math.min(8,s.length-A),h=parseInt(s.substring(A,A+S),p);if(S<8){var O=e.fromNumber(Math.pow(p,S));E=E.multiply(O).add(e.fromNumber(h))}else E=E.multiply($),E=E.add(e.fromNumber(h))}return E.unsigned=l,E},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,d=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 l;if(this.isNegative())if(this.equals(e.MIN_VALUE)){var p=e.fromNumber(s),g=this.divide(p);return l=g.multiply(p).subtract(this),g.toString(s)+l.toInt().toString(s)}else return"-"+this.negate().toString(s);var $=e.fromNumber(Math.pow(s,6),this.unsigned);l=this;for(var E="";;){var A=l.divide($),S=l.subtract(A.multiply($)).toInt()>>>0,h=S.toString(s);if(l=A,l.isZero())return h+E;for(;h.length<6;)h="0"+h;E=""+h+E}},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,l=31;l>0&&!(s&1<<l);l--);return this.high!=0?l+33:l+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 l=this.isNegative(),p=s.isNegative();return l&&!p?-1:!l&&p?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 l=this.high>>>16,p=this.high&65535,g=this.low>>>16,$=this.low&65535,E=s.high>>>16,A=s.high&65535,S=s.low>>>16,h=s.low&65535,O=0,T=0,R=0,b=0;return b+=$+h,R+=b>>>16,b&=65535,R+=g+S,T+=R>>>16,R&=65535,T+=p+A,O+=T>>>16,T&=65535,O+=l+E,O&=65535,e.fromBits(R<<16|b,O<<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(d)&&s.lessThan(d))return e.fromNumber(this.toNumber()*s.toNumber(),this.unsigned);var l=this.high>>>16,p=this.high&65535,g=this.low>>>16,$=this.low&65535,E=s.high>>>16,A=s.high&65535,S=s.low>>>16,h=s.low&65535,O=0,T=0,R=0,b=0;return b+=$*h,R+=b>>>16,b&=65535,R+=g*h,T+=R>>>16,R&=65535,R+=$*S,T+=R>>>16,R&=65535,T+=p*h,O+=T>>>16,T&=65535,T+=g*S,O+=T>>>16,T&=65535,T+=$*A,O+=T>>>16,T&=65535,O+=l*h+p*S+g*A+$*E,O&=65535,e.fromBits(R<<16|b,O<<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 l,p,g;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 $=this.shiftRight(1);return l=$.divide(s).shiftLeft(1),l.equals(e.ZERO)?s.isNegative()?e.ONE:e.NEG_ONE:(p=this.subtract(s.multiply(l)),g=l.add(p.divide(s)),g)}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(g=e.ZERO,p=this;p.greaterThanOrEqual(s);){l=Math.max(1,Math.floor(p.toNumber()/s.toNumber()));for(var E=Math.ceil(Math.log(l)/Math.LN2),A=E<=48?1:Math.pow(2,E-48),S=e.fromNumber(l),h=S.multiply(s);h.isNegative()||h.greaterThan(p);)l-=A,S=e.fromNumber(l,this.unsigned),h=S.multiply(s);S.isZero()&&(S=e.ONE),g=g.add(S),p=p.subtract(h)}return g},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 l=this.high;if(s<32){var p=this.low;return e.fromBits(p>>>s|l<<32-s,l>>>s,this.unsigned)}else return s===32?e.fromBits(l,0,this.unsigned):e.fromBits(l>>>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})})(uu);var fu=uu.exports;Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.Hyper=void 0;var eE=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),cu=function r(e,t,n){e===null&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,t);if(i===void 0){var a=Object.getPrototypeOf(e);return a===null?void 0:r(a,t,n)}else{if("value"in i)return i.value;var o=i.get;return o===void 0?void 0:o.call(n)}},rE=fu,Mr=lu(rE),tE=D,nE=lu(tE);function lu(r){return r&&r.__esModule?r:{default:r}}function iE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function aE(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function oE(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var Dr=Gt.Hyper=function(r){oE(e,r),eE(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=cu(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=cu(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(t,n){return iE(this,e),aE(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,!1))}return e}(Mr.default);(0,nE.default)(Dr),Dr.MAX_VALUE=new Dr(Mr.default.MAX_VALUE.low,Mr.default.MAX_VALUE.high),Dr.MIN_VALUE=new Dr(Mr.default.MIN_VALUE.low,Mr.default.MIN_VALUE.high);var Be={};Object.defineProperty(Be,"__esModule",{value:!0}),Be.UnsignedInt=void 0;var sE=xt,du=pu(sE),uE=D,fE=pu(uE);function pu(r){return r&&r.__esModule?r:{default:r}}var Cr=Be.UnsignedInt={read:function(e){return e.readUInt32BE()},write:function(e,t){if(!(0,du.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);t.writeUInt32BE(e)},isValid:function(e){return!(0,du.default)(e)||Math.floor(e)!==e?!1:e>=Cr.MIN_VALUE&&e<=Cr.MAX_VALUE}};Cr.MAX_VALUE=Math.pow(2,32)-1,Cr.MIN_VALUE=0,(0,fE.default)(Cr);var Ht={};Object.defineProperty(Ht,"__esModule",{value:!0}),Ht.UnsignedHyper=void 0;var cE=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),hu=function r(e,t,n){e===null&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,t);if(i===void 0){var a=Object.getPrototypeOf(e);return a===null?void 0:r(a,t,n)}else{if("value"in i)return i.value;var o=i.get;return o===void 0?void 0:o.call(n)}},lE=fu,Nr=yu(lE),dE=D,pE=yu(dE);function yu(r){return r&&r.__esModule?r:{default:r}}function hE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function yE(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function gE(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var Br=Ht.UnsignedHyper=function(r){gE(e,r),cE(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=hu(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=hu(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(t,n){return hE(this,e),yE(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,!0))}return e}(Nr.default);(0,pE.default)(Br),Br.MAX_VALUE=new Br(Nr.default.MAX_UNSIGNED_VALUE.low,Nr.default.MAX_UNSIGNED_VALUE.high),Br.MIN_VALUE=new Br(Nr.default.MIN_VALUE.low,Nr.default.MIN_VALUE.high);var Wt={};Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.Float=void 0;var _E=xt,gu=_u(_E),vE=D,mE=_u(vE);function _u(r){return r&&r.__esModule?r:{default:r}}var wE=Wt.Float={read:function(e){return e.readFloatBE()},write:function(e,t){if(!(0,gu.default)(e))throw new Error("XDR Write Error: not a number");t.writeFloatBE(e)},isValid:function(e){return(0,gu.default)(e)}};(0,mE.default)(wE);var zt={};Object.defineProperty(zt,"__esModule",{value:!0}),zt.Double=void 0;var bE=xt,vu=mu(bE),$E=D,EE=mu($E);function mu(r){return r&&r.__esModule?r:{default:r}}var SE=zt.Double={read:function(e){return e.readDoubleBE()},write:function(e,t){if(!(0,vu.default)(e))throw new Error("XDR Write Error: not a number");t.writeDoubleBE(e)},isValid:function(e){return(0,vu.default)(e)}};(0,EE.default)(SE);var Xt={};Object.defineProperty(Xt,"__esModule",{value:!0}),Xt.Quadruple=void 0;var AE=D,OE=IE(AE);function IE(r){return r&&r.__esModule?r:{default:r}}var PE=Xt.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,OE.default)(PE);var qr={},xE=me,TE=we,FE="[object Boolean]";function RE(r){return r===!0||r===!1||TE(r)&&xE(r)==FE}var ME=RE;Object.defineProperty(qr,"__esModule",{value:!0}),qr.Bool=void 0;var DE=ME,CE=bu(DE),wu=de,NE=D,BE=bu(NE);function bu(r){return r&&r.__esModule?r:{default:r}}var qE=qr.Bool={read:function(e){var t=wu.Int.read(e);switch(t){case 0:return!1;case 1:return!0;default:throw new Error("XDR Read Error: Got "+t+" when trying to read a bool")}},write:function(e,t){var n=e?1:0;return wu.Int.write(n,t)},isValid:function(e){return(0,CE.default)(e)}};(0,BE.default)(qE);var Yt={},UE=me,LE=G,kE=we,jE="[object String]";function VE(r){return typeof r=="string"||!LE(r)&&kE(r)&&UE(r)==jE}var $u=VE;Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.String=void 0;var GE=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),HE=$u,Eu=Ni(HE),WE=G,zE=Ni(WE),Su=de,XE=Be,Au=Ce,YE=D,KE=Ni(YE);function Ni(r){return r&&r.__esModule?r:{default:r}}function ZE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var JE=Yt.String=function(){function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:XE.UnsignedInt.MAX_VALUE;ZE(this,r),this._maxLength=e}return GE(r,[{key:"read",value:function(t){var n=Su.Int.read(t);if(n>this._maxLength)throw new Error("XDR Read Error: Saw "+n+" length String,"+("max allowed is "+this._maxLength));var i=(0,Au.calculatePadding)(n),a=t.slice(n);return(0,Au.slicePadding)(t,i),a.buffer()}},{key:"readString",value:function(t){return this.read(t).toString("utf8")}},{key:"write",value:function(t,n){if(t.length>this._maxLength)throw new Error("XDR Write Error: Got "+t.length+" bytes,"+("max allows is "+this._maxLength));var i=void 0;(0,Eu.default)(t)?i=y.from(t,"utf8"):i=y.from(t),Su.Int.write(i.length,n),n.writeBufferPadded(i)}},{key:"isValid",value:function(t){var n=void 0;if((0,Eu.default)(t))n=y.from(t,"utf8");else if((0,zE.default)(t)||y.isBuffer(t))n=y.from(t);else return!1;return n.length<=this._maxLength}}]),r}();(0,KE.default)(JE.prototype);var Kt={};Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.Opaque=void 0;var QE=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),Ou=Ce,eS=D,rS=tS(eS);function tS(r){return r&&r.__esModule?r:{default:r}}function nS(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var iS=Kt.Opaque=function(){function r(e){nS(this,r),this._length=e,this._padding=(0,Ou.calculatePadding)(e)}return QE(r,[{key:"read",value:function(t){var n=t.slice(this._length);return(0,Ou.slicePadding)(t,this._padding),n.buffer()}},{key:"write",value:function(t,n){if(t.length!==this._length)throw new Error("XDR Write Error: Got "+t.length+" bytes, expected "+this._length);n.writeBufferPadded(t)}},{key:"isValid",value:function(t){return y.isBuffer(t)&&t.length===this._length}}]),r}();(0,rS.default)(iS.prototype);var Zt={};Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.VarOpaque=void 0;var aS=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),Iu=de,oS=Be,Pu=Ce,sS=D,uS=fS(sS);function fS(r){return r&&r.__esModule?r:{default:r}}function cS(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var lS=Zt.VarOpaque=function(){function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:oS.UnsignedInt.MAX_VALUE;cS(this,r),this._maxLength=e}return aS(r,[{key:"read",value:function(t){var n=Iu.Int.read(t);if(n>this._maxLength)throw new Error("XDR Read Error: Saw "+n+" length VarOpaque,"+("max allowed is "+this._maxLength));var i=(0,Pu.calculatePadding)(n),a=t.slice(n);return(0,Pu.slicePadding)(t,i),a.buffer()}},{key:"write",value:function(t,n){if(t.length>this._maxLength)throw new Error("XDR Write Error: Got "+t.length+" bytes,"+("max allows is "+this._maxLength));Iu.Int.write(t.length,n),n.writeBufferPadded(t)}},{key:"isValid",value:function(t){return y.isBuffer(t)&&t.length<=this._maxLength}}]),r}();(0,uS.default)(lS.prototype);var Jt={};function dS(r,e){for(var t=-1,n=r==null?0:r.length;++t<n&&e(r[t],t,r)!==!1;);return r}var pS=dS,hS=Ft;function yS(r){return typeof r=="function"?r:hS}var xu=yS,gS=pS,_S=bi,vS=xu,mS=G;function wS(r,e){var t=mS(r)?gS:_S;return t(r,vS(e))}var bS=wS,or=bS,$S=/\s/;function ES(r){for(var e=r.length;e--&&$S.test(r.charAt(e)););return e}var SS=ES,AS=SS,OS=/^\s+/;function IS(r){return r&&r.slice(0,AS(r)+1).replace(OS,"")}var PS=IS,xS=PS,Tu=er,TS=jt,Fu=0/0,FS=/^[-+]0x[0-9a-f]+$/i,RS=/^0b[01]+$/i,MS=/^0o[0-7]+$/i,DS=parseInt;function CS(r){if(typeof r=="number")return r;if(TS(r))return Fu;if(Tu(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=Tu(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=xS(r);var t=RS.test(r);return t||MS.test(r)?DS(r.slice(2),t?2:8):FS.test(r)?Fu:+r}var NS=CS,BS=NS,Ru=1/0,qS=17976931348623157e292;function US(r){if(!r)return r===0?r:0;if(r=BS(r),r===Ru||r===-Ru){var e=r<0?-1:1;return e*qS}return r===r?r:0}var LS=US,kS=LS;function jS(r){var e=kS(r),t=e%1;return e===e?t?e-t:e:0}var VS=jS,GS=ps,HS=xu,WS=VS,zS=9007199254740991,Bi=4294967295,XS=Math.min;function YS(r,e){if(r=WS(r),r<1||r>zS)return[];var t=Bi,n=XS(r,Bi);e=HS(e),r-=Bi;for(var i=GS(n,e);++t<r;)e(t);return i}var Mu=YS;Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.Array=void 0;var KS=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),ZS=Di,JS=Ur(ZS),QS=or,eA=Ur(QS),rA=Mu,tA=Ur(rA),nA=G,Du=Ur(nA),iA=D,aA=Ur(iA);function Ur(r){return r&&r.__esModule?r:{default:r}}function oA(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var sA=Jt.Array=function(){function r(e,t){oA(this,r),this._childType=e,this._length=t}return KS(r,[{key:"read",value:function(t){var n=this;return(0,tA.default)(this._length,function(){return n._childType.read(t)})}},{key:"write",value:function(t,n){var i=this;if(!(0,Du.default)(t))throw new Error("XDR Write Error: value is not array");if(t.length!==this._length)throw new Error("XDR Write Error: Got array of size "+t.length+","+("expected "+this._length));(0,eA.default)(t,function(a){return i._childType.write(a,n)})}},{key:"isValid",value:function(t){var n=this;return!(0,Du.default)(t)||t.length!==this._length?!1:(0,JS.default)(t,function(i){return n._childType.isValid(i)})}}]),r}();(0,aA.default)(sA.prototype);var Qt={};Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.VarArray=void 0;var uA=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),fA=Di,cA=Lr(fA),lA=or,dA=Lr(lA),pA=Mu,hA=Lr(pA),yA=G,Cu=Lr(yA),gA=Be,Nu=de,_A=D,vA=Lr(_A);function Lr(r){return r&&r.__esModule?r:{default:r}}function mA(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var wA=Qt.VarArray=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gA.UnsignedInt.MAX_VALUE;mA(this,r),this._childType=e,this._maxLength=t}return uA(r,[{key:"read",value:function(t){var n=this,i=Nu.Int.read(t);if(i>this._maxLength)throw new Error("XDR Read Error: Saw "+i+" length VarArray,"+("max allowed is "+this._maxLength));return(0,hA.default)(i,function(){return n._childType.read(t)})}},{key:"write",value:function(t,n){var i=this;if(!(0,Cu.default)(t))throw new Error("XDR Write Error: value is not array");if(t.length>this._maxLength)throw new Error("XDR Write Error: Got array of size "+t.length+","+("max allowed is "+this._maxLength));Nu.Int.write(t.length,n),(0,dA.default)(t,function(a){return i._childType.write(a,n)})}},{key:"isValid",value:function(t){var n=this;return!(0,Cu.default)(t)||t.length>this._maxLength?!1:(0,cA.default)(t,function(i){return n._childType.isValid(i)})}}]),r}();(0,vA.default)(wA.prototype);var en={};function bA(r){return r===null}var $A=bA;function EA(r){return r===void 0}var kr=EA;Object.defineProperty(en,"__esModule",{value:!0}),en.Option=void 0;var SA=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),AA=$A,Bu=qi(AA),OA=kr,qu=qi(OA),Uu=qr,IA=D,PA=qi(IA);function qi(r){return r&&r.__esModule?r:{default:r}}function xA(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var TA=en.Option=function(){function r(e){xA(this,r),this._childType=e}return SA(r,[{key:"read",value:function(t){if(Uu.Bool.read(t))return this._childType.read(t)}},{key:"write",value:function(t,n){var i=!((0,Bu.default)(t)||(0,qu.default)(t));Uu.Bool.write(i,n),i&&this._childType.write(t,n)}},{key:"isValid",value:function(t){return(0,Bu.default)(t)||(0,qu.default)(t)?!0:this._childType.isValid(t)}}]),r}();(0,PA.default)(TA.prototype);var jr={};Object.defineProperty(jr,"__esModule",{value:!0}),jr.Void=void 0;var FA=kr,Lu=ku(FA),RA=D,MA=ku(RA);function ku(r){return r&&r.__esModule?r:{default:r}}var DA=jr.Void={read:function(){},write:function(e){if(!(0,Lu.default)(e))throw new Error("XDR Write Error: trying to write value to a void slot")},isValid:function(e){return(0,Lu.default)(e)}};(0,MA.default)(DA);var rn={},CA=Mi;function NA(r,e){return CA(e,function(t){return r[t]})}var BA=NA,qA=BA,UA=Ct;function LA(r){return r==null?[]:qA(r,UA(r))}var kA=LA;Object.defineProperty(rn,"__esModule",{value:!0}),rn.Enum=void 0;var jA=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),VA=or,GA=Ui(VA),HA=kA,WA=Ui(HA),ju=de,zA=D,XA=Ui(zA);function Ui(r){return r&&r.__esModule?r:{default:r}}function YA(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function KA(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}function Vu(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var ZA=rn.Enum=function(){function r(e,t){Vu(this,r),this.name=e,this.value=t}return jA(r,null,[{key:"read",value:function(t){var n=ju.Int.read(t);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(t,n){if(!(t instanceof this))throw new Error("XDR Write Error: Unknown "+t+" is not a "+this.enumName);ju.Int.write(t.value,n)}},{key:"isValid",value:function(t){return t instanceof this}},{key:"members",value:function(){return this._members}},{key:"values",value:function(){return(0,WA.default)(this._members)}},{key:"fromName",value:function(t){var n=this._members[t];if(!n)throw new Error(t+" is not a member of "+this.enumName);return n}},{key:"fromValue",value:function(t){var n=this._byValue.get(t);if(!n)throw new Error(t+" is not a value of any member of "+this.enumName);return n}},{key:"create",value:function(t,n,i){var a=function(o){KA(u,o);function u(){return Vu(this,u),YA(this,(u.__proto__||Object.getPrototypeOf(u)).apply(this,arguments))}return u}(r);return a.enumName=n,t.results[n]=a,a._members={},a._byValue=new Map,(0,GA.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}}]),r}();(0,XA.default)(ZA);var tn={},JA=bi,QA=Fr;function eO(r,e){var t=-1,n=QA(r)?Array(r.length):[];return JA(r,function(i,a,o){n[++t]=e(i,a,o)}),n}var rO=eO,tO=Mi,nO=tu,iO=rO,aO=G;function oO(r,e){var t=aO(r)?tO:iO;return t(r,nO(e))}var sO=oO;function uO(r){for(var e=-1,t=r==null?0:r.length,n={};++e<t;){var i=r[e];n[i[0]]=i[1]}return n}var fO=uO,Vr={};Object.defineProperty(Vr,"__esModule",{value:!0});var cO=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();function lO(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}Vr.Reference=function(){function r(){lO(this,r)}return cO(r,[{key:"resolve",value:function(){throw new Error("implement resolve in child class")}}]),r}(),Object.defineProperty(tn,"__esModule",{value:!0}),tn.Struct=void 0;var nn=function(){function r(e,t){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),!(t&&n.length===t));i=!0);}catch(d){a=!0,o=d}finally{try{!i&&u.return&&u.return()}finally{if(a)throw o}}return n}return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return r(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),dO=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),pO=or,Gu=Gr(pO),hO=sO,yO=Gr(hO),gO=kr,_O=Gr(gO),vO=fO,mO=Gr(vO),wO=Vr,bO=D,$O=Gr(bO);function Gr(r){return r&&r.__esModule?r:{default:r}}function EO(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function SO(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}function Hu(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var AO=tn.Struct=function(){function r(e){Hu(this,r),this._attributes=e||{}}return dO(r,null,[{key:"read",value:function(t){var n=(0,yO.default)(this._fields,function(i){var a=nn(i,2),o=a[0],u=a[1],f=u.read(t);return[o,f]});return new this((0,mO.default)(n))}},{key:"write",value:function(t,n){if(!(t instanceof this))throw new Error("XDR Write Error: "+t+" is not a "+this.structName);(0,Gu.default)(this._fields,function(i){var a=nn(i,2),o=a[0],u=a[1],f=t._attributes[o];u.write(f,n)})}},{key:"isValid",value:function(t){return t instanceof this}},{key:"create",value:function(t,n,i){var a=function(o){SO(u,o);function u(){return Hu(this,u),EO(this,(u.__proto__||Object.getPrototypeOf(u)).apply(this,arguments))}return u}(r);return a.structName=n,t.results[n]=a,a._fields=i.map(function(o){var u=nn(o,2),f=u[0],d=u[1];return d instanceof wO.Reference&&(d=d.resolve(t)),[f,d]}),(0,Gu.default)(a._fields,function(o){var u=nn(o,1),f=u[0];a.prototype[f]=OO(f)}),a}}]),r}();(0,$O.default)(AO);function OO(r){return function(t){return(0,_O.default)(t)||(this._attributes[r]=t),this._attributes[r]}}var an={};Object.defineProperty(an,"__esModule",{value:!0}),an.Union=void 0;var IO=function(){function r(e,t){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),!(t&&n.length===t));i=!0);}catch(d){a=!0,o=d}finally{try{!i&&u.return&&u.return()}finally{if(a)throw o}}return n}return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return r(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),PO=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),xO=or,on=un(xO),TO=kr,Wu=un(TO),FO=$u,zu=un(FO),sn=jr,Li=Vr,RO=D,MO=un(RO);function un(r){return r&&r.__esModule?r:{default:r}}function DO(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function CO(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}function Xu(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var NO=an.Union=function(){function r(e,t){Xu(this,r),this.set(e,t)}return PO(r,[{key:"set",value:function(t,n){(0,zu.default)(t)&&(t=this.constructor._switchOn.fromName(t)),this._switch=t,this._arm=this.constructor.armForSwitch(this._switch),this._armType=this.constructor.armTypeForArm(this._arm),this._value=n}},{key:"get",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this._arm;if(this._arm!==sn.Void&&this._arm!==t)throw new Error(t+" 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(t){if(this._switches.has(t))return this._switches.get(t);if(this._defaultArm)return this._defaultArm;throw new Error("Bad union switch: "+t)}},{key:"armTypeForArm",value:function(t){return t===sn.Void?sn.Void:this._arms[t]}},{key:"read",value:function(t){var n=this._switchOn.read(t),i=this.armForSwitch(n),a=this.armTypeForArm(i),o=void 0;return(0,Wu.default)(a)?o=i.read(t):o=a.read(t),new this(n,o)}},{key:"write",value:function(t,n){if(!(t instanceof this))throw new Error("XDR Write Error: "+t+" is not a "+this.unionName);this._switchOn.write(t.switch(),n),t.armType().write(t.value(),n)}},{key:"isValid",value:function(t){return t instanceof this}},{key:"create",value:function(t,n,i){var a=function(u){CO(f,u);function f(){return Xu(this,f),DO(this,(f.__proto__||Object.getPrototypeOf(f)).apply(this,arguments))}return f}(r);a.unionName=n,t.results[n]=a,i.switchOn instanceof Li.Reference?a._switchOn=i.switchOn.resolve(t):a._switchOn=i.switchOn,a._switches=new Map,a._arms={},(0,on.default)(i.arms,function(u,f){u instanceof Li.Reference&&(u=u.resolve(t)),a._arms[f]=u});var o=i.defaultArm;return o instanceof Li.Reference&&(o=o.resolve(t)),a._defaultArm=o,(0,on.default)(i.switches,function(u){var f=IO(u,2),d=f[0],c=f[1];(0,zu.default)(d)&&(d=a._switchOn.fromName(d)),a._switches.set(d,c)}),(0,Wu.default)(a._switchOn.values)||(0,on.default)(a._switchOn.values(),function(u){a[u.name]=function(f){return new a(u,f)},a.prototype[u.name]=function(d){return this.set(u,d)}}),(0,on.default)(a._arms,function(u,f){u!==sn.Void&&(a.prototype[f]=function(){return this.get(f)})}),a}}]),r}();(0,MO.default)(NO),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=de;Object.keys(e).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return e[h]}})});var t=Gt;Object.keys(t).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return t[h]}})});var n=Be;Object.keys(n).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return n[h]}})});var i=Ht;Object.keys(i).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return i[h]}})});var a=Wt;Object.keys(a).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return a[h]}})});var o=zt;Object.keys(o).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return o[h]}})});var u=Xt;Object.keys(u).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return u[h]}})});var f=qr;Object.keys(f).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return f[h]}})});var d=Yt;Object.keys(d).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return d[h]}})});var c=Kt;Object.keys(c).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return c[h]}})});var s=Zt;Object.keys(s).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return s[h]}})});var l=Jt;Object.keys(l).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return l[h]}})});var p=Qt;Object.keys(p).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return p[h]}})});var g=en;Object.keys(g).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return g[h]}})});var $=jr;Object.keys($).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return $[h]}})});var E=rn;Object.keys(E).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return E[h]}})});var A=tn;Object.keys(A).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return A[h]}})});var S=an;Object.keys(S).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return S[h]}})})}(gi);var Yu={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=function(){function b(_,m){for(var I=0;I<m.length;I++){var P=m[I];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(_,P.key,P)}}return function(_,m,I){return m&&b(_.prototype,m),I&&b(_,I),_}}(),t=Vr;Object.keys(t).forEach(function(b){b==="default"||b==="__esModule"||Object.defineProperty(r,b,{enumerable:!0,get:function(){return t[b]}})}),r.config=g;var n=kr,i=c(n),a=or,o=c(a),u=gi,f=d(u);function d(b){if(b&&b.__esModule)return b;var _={};if(b!=null)for(var m in b)Object.prototype.hasOwnProperty.call(b,m)&&(_[m]=b[m]);return _.default=b,_}function c(b){return b&&b.__esModule?b:{default:b}}function s(b,_){if(!(b instanceof _))throw new TypeError("Cannot call a class as a function")}function l(b,_){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:b}function p(b,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);b.prototype=Object.create(_&&_.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(b,_):b.__proto__=_)}function g(b){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(b){var m=new R(_);b(m),m.resolve()}return _}var $=function(b){p(_,b);function _(m){s(this,_);var I=l(this,(_.__proto__||Object.getPrototypeOf(_)).call(this));return I.name=m,I}return e(_,[{key:"resolve",value:function(I){var P=I.definitions[this.name];return P.resolve(I)}}]),_}(t.Reference),E=function(b){p(_,b);function _(m,I){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;s(this,_);var q=l(this,(_.__proto__||Object.getPrototypeOf(_)).call(this));return q.childReference=m,q.length=I,q.variable=P,q}return e(_,[{key:"resolve",value:function(I){var P=this.childReference,q=this.length;return P instanceof t.Reference&&(P=P.resolve(I)),q instanceof t.Reference&&(q=q.resolve(I)),this.variable?new f.VarArray(P,q):new f.Array(P,q)}}]),_}(t.Reference),A=function(b){p(_,b);function _(m){s(this,_);var I=l(this,(_.__proto__||Object.getPrototypeOf(_)).call(this));return I.childReference=m,I.name=m.name,I}return e(_,[{key:"resolve",value:function(I){var P=this.childReference;return P instanceof t.Reference&&(P=P.resolve(I)),new f.Option(P)}}]),_}(t.Reference),S=function(b){p(_,b);function _(m,I){s(this,_);var P=l(this,(_.__proto__||Object.getPrototypeOf(_)).call(this));return P.sizedType=m,P.length=I,P}return e(_,[{key:"resolve",value:function(I){var P=this.length;return P instanceof t.Reference&&(P=P.resolve(I)),new this.sizedType(P)}}]),_}(t.Reference),h=function(){function b(_,m,I){s(this,b),this.constructor=_,this.name=m,this.config=I}return e(b,[{key:"resolve",value:function(m){return this.name in m.results?m.results[this.name]:this.constructor(m,this.name,this.config)}}]),b}();function O(b,_,m){return m instanceof t.Reference&&(m=m.resolve(b)),b.results[_]=m,m}function T(b,_,m){return b.results[_]=m,m}var R=function(){function b(_){s(this,b),this._destination=_,this._definitions={}}return e(b,[{key:"enum",value:function(m,I){var P=new h(f.Enum.create,m,I);this.define(m,P)}},{key:"struct",value:function(m,I){var P=new h(f.Struct.create,m,I);this.define(m,P)}},{key:"union",value:function(m,I){var P=new h(f.Union.create,m,I);this.define(m,P)}},{key:"typedef",value:function(m,I){var P=new h(O,m,I);this.define(m,P)}},{key:"const",value:function(m,I){var P=new h(T,m,I);this.define(m,P)}},{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(m){return new S(f.String,m)}},{key:"opaque",value:function(m){return new S(f.Opaque,m)}},{key:"varOpaque",value:function(m){return new S(f.VarOpaque,m)}},{key:"array",value:function(m,I){return new E(m,I)}},{key:"varArray",value:function(m,I){return new E(m,I,!0)}},{key:"option",value:function(m){return new A(m)}},{key:"define",value:function(m,I){if((0,i.default)(this._destination[m]))this._definitions[m]=I;else throw new Error("XDRTypes Error:"+m+" is already defined")}},{key:"lookup",value:function(m){return new $(m)}},{key:"resolve",value:function(){var m=this;(0,o.default)(this._definitions,function(I){I.resolve({definitions:m._definitions,results:m._destination})})}}]),b}()})(Yu),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=gi;Object.keys(e).forEach(function(n){n==="default"||n==="__esModule"||Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[n]}})});var t=Yu;Object.keys(t).forEach(function(n){n==="default"||n==="__esModule"||Object.defineProperty(r,n,{enumerable:!0,get:function(){return t[n]}})})}(Qo);var ki=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)},j=(r,e,t)=>(ki(r,e,"read from private field"),t?t.call(r):e.get(r)),be=(r,e,t)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,t)},ji=(r,e,t,n)=>(ki(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),K=(r,e,t)=>(ki(r,e,"access private method"),t),oe,se,Hr,Vi,Ku,Gi,Zu,fn,Hi,sr,Wr,zr,cn;function BO(r){const e={variantId:he.Uint64.fromString(r.variantId.toString()),version:r.version||Math.floor(Date.now()/1e3),items:r.items.map(n=>new he.BundleItem({collectionId:he.Uint64.fromString(n.collectionId.toString()),productId:he.Uint64.fromString(n.productId.toString()),variantId:he.Uint64.fromString(n.variantId.toString()),sku:n.sku||"",quantity:n.quantity,ext:new he.BundleItemExt(0)})),ext:new he.BundleExt(0)},t=new he.Bundle(e);return he.BundleEnvelope.envelopeTypeBundle(t).toXDR("base64")}const he=Qo.config(r=>{r.enum("EnvelopeType",{envelopeTypeBundle:0}),r.typedef("Uint32",r.uint()),r.typedef("Uint64",r.uhyper()),r.union("BundleItemExt",{switchOn:r.int(),switchName:"v",switches:[[0,r.void()]],arms:{}}),r.struct("BundleItem",[["collectionId",r.lookup("Uint64")],["productId",r.lookup("Uint64")],["variantId",r.lookup("Uint64")],["sku",r.string()],["quantity",r.lookup("Uint32")],["ext",r.lookup("BundleItemExt")]]),r.union("BundleExt",{switchOn:r.int(),switchName:"v",switches:[[0,r.void()]],arms:{}}),r.struct("Bundle",[["variantId",r.lookup("Uint64")],["items",r.varArray(r.lookup("BundleItem"),500)],["version",r.lookup("Uint32")],["ext",r.lookup("BundleExt")]]),r.union("BundleEnvelope",{switchOn:r.lookup("EnvelopeType"),switchName:"type",switches:[["envelopeTypeBundle","v1"]],arms:{v1:r.lookup("Bundle")}})});class qO{constructor(e,t){be(this,Vi),be(this,Gi),be(this,fn),be(this,sr),be(this,zr),be(this,oe,void 0),be(this,se,void 0),be(this,Hr,void 0),ji(this,oe,K(this,Vi,Ku).call(this,t)),ji(this,Hr,K(this,Gi,Zu).call(this,t)),ji(this,se,e)}isInitialDataValid(){if(!j(this,Hr))throw"Bundle data does not exist for the given product.";if(!j(this,oe))throw"Bundle settings do not exist for the given product.";if(!Array.isArray(j(this,se))||!j(this,se).length)throw"No bundle selection items provided.";return!0}isValidVariant(e){if(!j(this,oe)?.variantsSettings[e])throw`The ${e} bundle variant is invalid.`;return!0}isSelectionInVariantRange(e){const t=j(this,se).reduce((i,a)=>i+a.quantity,0),n=j(this,oe)?.variantsSettings[e].ranges||[];if(!K(this,fn,Hi).call(this,n,t))throw"The total number of products does not fall within the required variant range.";return!0}areItemsInMaxPerItemBound(){const e=j(this,oe)?.bundleSettings.maxPerItem||0,t=j(this,se).filter(({quantity:n})=>n>e);if(e&&t.length)throw`The selected products (${K(this,sr,Wr).call(this,t.map(({externalProductId:n})=>n)).join(", ")}) exceed the maximum limit of ${e} items per product.`;return!0}areSelectedCollectionsValid(e){const t=j(this,oe)?.variantsSettings[e]?.optionSources,n=j(this,se).filter(({collectionId:i})=>!t||!K(this,zr,cn).call(this,t,i));if(n.length)throw`The collections (${K(this,sr,Wr).call(this,n.map(({collectionId:i})=>i)).join(", ")}) are no longer valid for the bundle variant (${e}).`;return!0}areItemsQuantitiesValidForTheCollection(e){const t=j(this,se).reduce((a,o)=>(a[o.collectionId]=o.quantity+(a[o.collectionId]||0),a),Object.create(null)),n=j(this,oe)?.variantsSettings[e],i=Object.values(n?.optionSources||{}).filter(a=>{const o=t[a.collectionId]||0;return!K(this,fn,Hi).call(this,[a],o)});if(!n||i.length)throw`The selection exceeds the limits for the collections (${K(this,sr,Wr).call(this,i.map(({collectionId:a})=>a)).join(", ")}).`;return!0}areSelectedProductsValid(e){const t=j(this,oe)?.variantsSettings[e]?.optionSources||{},n=Object.values(t).reduce((a,o)=>{const u=j(this,Hr)?.collections[o.collectionId];return u&&(a[o.collectionId]=u),a},Object.create(null));if(!Object.values(n).length)throw`No collections found for the bundle variant (${e}).`;const i=j(this,se).filter(({externalProductId:a,collectionId:o})=>K(this,zr,cn).call(this,n,o)?!K(this,zr,cn).call(this,n[o].products,a):!0);if(i.length)throw`The products (${K(this,sr,Wr).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}}oe=new WeakMap,se=new WeakMap,Hr=new WeakMap,Vi=new WeakSet,Ku=function(r){try{const e=r.bundle_settings;return{bundleSettings:{maxPerItem:e.max_quantity_per_variant,isCustomizable:e.is_customizable},variantsSettings:e.variants.reduce((t,n)=>{if(!n.enabled)return t;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}))),t[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),Object.create(null)),ranges:i},t},Object.create(null))}}catch{return null}},Gi=new WeakSet,Zu=function(r){try{const e=Object.values(r.collections).reduce((t,n)=>(t[n.id]={...n,products:n.products.reduce((i,a)=>(i[a.id]=a,i),Object.create(null))},t),Object.create(null));return{...r,collections:e}}catch{return null}},fn=new WeakSet,Hi=function(r,e){return!!r.filter(({min:t,max:n})=>{const i=t??e,a=n??e;return i<=e&&e<=a}).length},sr=new WeakSet,Wr=function(r){return Array.from(new Set(r))},zr=new WeakSet,cn=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)};const UO="/bundling-storefront-manager";function Ju(r){return BO({variantId:r.externalVariantId,version:0,items:r.selections.map(e=>({collectionId:e.collectionId,productId:e.externalProductId,variantId:e.externalVariantId,quantity:e.quantity,sku:""}))})}async function LO(r){const e=V(),t=await Wi(r);if(t!==!0)throw new Error(t);const n=Ju(r);try{const i=await Me("post",`${UO}/api/v1/bundles`,{data:{bundle:n},headers:{Origin:`https://${e.storeIdentifier}`}});if(!i.id||i.code!==200)throw new Error(`1: failed generating rb_id: ${JSON.stringify(i)}`);return i.id}catch(i){throw new Error(`2: failed generating rb_id ${i}`)}}async function kO(r,e){const t=await Wi(e);if(t!==!0)throw new Error(t);const n=Ju(e);try{const i=await w("post","/bundle_selections/bundle_id",{data:{bundle:n}},v(r,"getBundleSelectionId"));if(!i.id||i.code!==200)throw new Error(`1: failed generating rb_id: ${JSON.stringify(i)}`);return i.id}catch(i){throw new Error(`2: failed generating rb_id ${i}`)}}function jO(r,e){const t=Qu(r);if(t!==!0)throw new Error(`Dynamic Bundle is invalid. ${t}`);const n=`${va(9)}:${r.externalProductId}`;return r.selections.map(i=>{const a={id:i.externalVariantId,quantity:i.quantity,properties:{_rc_bundle:n,_rc_bundle_variant:r.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 Wi(r){try{return r?r.selections.length===0?"No selections defined":!0:"Bundle is not defined"}catch(e){return`Error fetching bundle settings: ${e}`}}async function VO(r){try{const e=await Me("get",`/bundle-data/${F(r.externalProductId)}`);return{valid:new qO(r.selections,e).isBundleSelectionValid(r.externalVariantId)}}catch(e){return{valid:!1,error:String(e)}}}const GO={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 Qu(r){if(!r)return"No bundle defined.";if(r.selections.length===0)return"No selections defined.";const{shippingIntervalFrequency:e,shippingIntervalUnitType:t}=r.selections.find(n=>n.shippingIntervalFrequency||n.shippingIntervalUnitType)||{};if(e||t){if(!e||!t)return"Shipping intervals do not match on selections.";{const n=GO[t];for(let i=0;i<r.selections.length;i++){const{shippingIntervalFrequency:a,shippingIntervalUnitType:o}=r.selections[i];if(a&&a!==e||o&&!n.includes(o))return"Shipping intervals do not match on selections."}}}return!0}async function HO(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{bundle_selection:t}=await w("get","/bundle_selections",{id:e},v(r,"getBundleSelection"));return t}function WO(r,e){return w("get","/bundle_selections",{query:e},v(r,"listBundleSelections"))}async function zO(r,e){const{bundle_selection:t}=await w("post","/bundle_selections",{data:e},v(r,"createBundleSelection"));return t}async function XO(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{bundle_selection:n}=await w("put","/bundle_selections",{id:e,data:t},v(r,"updateBundleSelection"));return n}function YO(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/bundle_selections",{id:e},v(r,"deleteBundleSelection"))}async function KO(r,e,t,n){if(e===void 0||e==="")throw new Error("Purchase item ID is required");const{subscription:i}=await w("put","/bundles",{id:e,data:t,query:n},v(r,"updateBundle"));return i}var ZO=Object.freeze({__proto__:null,createBundleSelection:zO,deleteBundleSelection:YO,getBundleId:LO,getBundleSelection:HO,getBundleSelectionId:kO,getDynamicBundleItems:jO,listBundleSelections:WO,updateBundle:KO,updateBundleSelection:XO,validateBundle:Wi,validateBundleSelection:VO,validateDynamicBundle:Qu});const JO=r=>{const e=r.layout_settings.addons,t=r.layout_settings.crossSells,n=r.customization_window,i=r.layout_settings?.defaultVariantId??r.default_bundle_variant_id,a=r.layout_settings.defaultFrequency,o=r.layout_settings.addToCartCallback;return{default_variant_id:i?String(i):null,is_customizable:r.is_customizable,price_rule:String(r.price_rule).toUpperCase(),customization_window:n?{active_days:n,disabled_message:r.customization_window_disabled_message||""}:null,addons:e.collectionId?{collection_id:e.collectionId,collection_handle:e.collectionHandle}:null,cross_sells:t.collectionId?{collection_id:e.collectionId,collection_handle:e.collectionHandle}:null,default_selling_plan_id:a||null,collapsible_collections:r.layout_settings.collapsibleSections,max_quantity_per_variant:r.max_quantity_per_variant,show_product_variants:r.layout_settings.showVariants,product_details_modal_enabled:r.layout_settings.learnMoreModal,addToCartBehavior:{type:o.type==="none"?"cart_page":o.type,value:o.value}}},QO=r=>r.tiered_discounts.length===0?null:{tiered_discounts:r.tiered_discounts},ln=r=>({id:r.id,name:r.name,options:r.options.map(e=>({name:e.name,value:e.value})),recurring_deliveries:r.recurring_deliveries,price_adjustments:r.price_adjustments.map(({value:e,value_type:t})=>({value:e,value_type:t}))}),ef=r=>({name:r.name,options:r.options.map(e=>({name:e.name,values:e.values})),selling_plans:r.selling_plans.map(ln)}),rf=r=>({id:String(r.id),title:r.title,price:r.price,compare_at_price:r.compare_at_price,options:r.options,available_for_sale:r.available}),zi=r=>r==null||typeof r=="string"?r:"src"in r?r.src:null,tf=r=>({id:String(r.id),title:r.title,description:r.description,available_for_sale:r.available,featured_image:zi(r.featured_image),images:r.images,requires_selling_plan:r.requires_selling_plan,selling_plan_groups:r.selling_plan_groups.map(ef)}),nf=r=>{const e=rI(r.selling_plan_groups);return{...tf(r),handle:r.handle,tags:r.tags,price_range:{min:r.price_min,max:r.price_max},compare_at_price_range:{min:r.compare_at_price_min,max:r.compare_at_price_max},options:r.options,variants:r.variants.map(t=>({...rf(t),selling_plan_allocations:t.selling_plan_allocations.map(n=>({price:n.price,compare_at_price:n.compare_at_price,selling_plan:ln(e[`${n.selling_plan_group_id}-${n.selling_plan_id}`])})),option1:t.option1,option2:t.option2,option3:t.option3,sku:t.sku||"",requires_shipping:t.requires_shipping,taxable:t.taxable,featured_image:zi(t.featured_image),public_title:t.public_title,requires_selling_plan:t.requires_selling_plan}))}},eI=({items_count:r,ranges:e})=>e.length>0?e.map(({quantity_max:t,quantity_min:n})=>({min:n,max:t})):[{min:r,max:r}],rI=r=>r.reduce((e,t)=>(t.selling_plans.forEach(n=>{const i=`${t.id}-${n.id}`;e[i]=n}),e),{}),tI=r=>Array.isArray(r)?r:[];function Xi(r){const e=JO(r.bundle_settings),t=r.variants.reduce((n,i)=>(n[i.id]=i,n),{});return{id:String(r.id),title:r.title,description:r.description||null,handle:r.handle,options:r.options.map(n=>({name:n.name,position:n.position,values:n.values})),default_variant_id:e.default_variant_id,default_selling_plan_id:e.default_selling_plan_id?Number(e.default_selling_plan_id):null,available_for_sale:r.available,requires_selling_plan:r.requires_selling_plan,bundle_settings:{is_customizable:e.is_customizable,price_rule:e.price_rule,customization_window:e.customization_window,max_quantity_per_variant:e.max_quantity_per_variant,collapsible_collections:e.collapsible_collections,show_product_variants:e.show_product_variants,product_details_modal_enabled:e.product_details_modal_enabled,show_variants_as_individual_products:r.bundle_settings.settings.display_variants_as_separate_products_in_list,post_add_to_cart_behavior:e.addToCartBehavior},variants:r.bundle_settings.variants.filter(({enabled:n})=>n).map((n,i)=>{const a=t[String(n.external_variant_id)];return{id:String(n.external_variant_id),title:a.title,price:a.price,compare_at_price:a.compare_at_price,image:a.image||"",available_for_sale:a.available,options:a.options,requires_selling_plan:a.requires_selling_plan,selling_plan_allocations:a.selling_plan_allocations.map(o=>({price:o.price,compare_at_price:o.compare_at_price,selling_plan:ln(o.selling_plan)})),ranges:eI(n),collections:n.option_sources.map(o=>({id:o.option_source_id,source_platform:"shopify",min:o.quantity_min||0,max:o.quantity_max,position:o.position})),default_selections:n.selection_defaults.map(o=>({quantity:o.quantity,product:{id:String(o.product.id),handle:o.handle,title:o.product.title,description:o.product.description,images:o.product.images},variant:{id:o.external_variant_id,title:o.variant.title,featured_image:zi(o.variant.featured_image),sku:o.sku||""}})),position:i}}),selling_plan_groups:r.selling_plan_groups.map(ef),collections:Object.values(r.collections).reduce((n,i)=>(Array.isArray(i.products)&&(n[String(i.id)]={id:String(i.id),title:i.title,handle:i.handle,products:i.products.map(nf)}),n),{}),addons:r.addons.products.length?{collection_id:e.addons?.collection_id||"",collection_handle:e.addons?.collection_handle||"",products:r.addons.products.map(n=>({...tf(n),price_range:{min:n.price,max:n.price},compare_at_price_range:{min:n.compare_at_price||0,max:n.compare_at_price},variants:n.variants.map(i=>({...rf(i),image:i.image,selling_plan_allocations:i.selling_plan_allocations.map(a=>({price:a.price,compare_at_price:a.compare_at_price,selling_plan:ln(a.selling_plan)}))}))}))}:null,cross_sells:r.cross_sells.products.length?{collection_id:e.cross_sells?.collection_id||"",collection_handle:e.cross_sells?.collection_handle||"",products:r.cross_sells.products.map(nf)}:null,incentives:QO(r.incentives),filters:tI(r.filters),templates:r.bundle_settings.layout_settings.templates||null,globalStyles:r.bundle_settings.layout_settings.globalStyles||null}}async function nI(r,e){return e?.source==="shopify_storefront"?aI():iI(r,e?.country_code)}async function iI(r,e){const{appName:t,appVersion:n}=V(),i={"X-Recharge-Sdk-Fn":"loadFromOnlineStore","X-Recharge-Sdk-Version":"1.91.1",...t?{"X-Recharge-Sdk-App-Name":t}:{},...n?{"X-Recharge-Sdk-App-Version":n}:{}};if(!e){const o=await Me("get",`/bundle-data/${F(r)}`,{headers:i});return Xi(o)}const a=new FormData;a.append("form_type","localization"),a.append("_method","put"),a.append("return_to",`${Zo}/bundle-data/${r}`),a.append("country_code",e);try{const o=await Y("post","/localization",{headers:{"Content-Type":"multipart/form-data",...i},data:a});return Xi(o)}catch{const o=await Me("get",`/bundle-data/${F(r)}`,{headers:i});return Xi(o)}}async function aI(r,e){if(!V().storeIdentifier)throw new Error("Store identifier is required for Shopify Storefront API requests");return{}}var oI=Object.freeze({__proto__:null,loadBundleData:nI}),sI=200,Yi="__lodash_hash_undefined__",uI=1/0,af=9007199254740991,fI="[object Arguments]",cI="[object Function]",lI="[object GeneratorFunction]",dI="[object Symbol]",pI=/[\\^$.*+?()[\]{}|]/g,hI=/^\[object .+?Constructor\]$/,yI=/^(?:0|[1-9]\d*)$/,gI=typeof C=="object"&&C&&C.Object===Object&&C,_I=typeof self=="object"&&self&&self.Object===Object&&self,Ki=gI||_I||Function("return this")();function vI(r,e,t){switch(t.length){case 0:return r.call(e);case 1:return r.call(e,t[0]);case 2:return r.call(e,t[0],t[1]);case 3:return r.call(e,t[0],t[1],t[2])}return r.apply(e,t)}function mI(r,e){var t=r?r.length:0;return!!t&&$I(r,e,0)>-1}function wI(r,e,t){for(var n=-1,i=r?r.length:0;++n<i;)if(t(e,r[n]))return!0;return!1}function of(r,e){for(var t=-1,n=r?r.length:0,i=Array(n);++t<n;)i[t]=e(r[t],t,r);return i}function Zi(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r}function bI(r,e,t,n){for(var i=r.length,a=t+(n?1:-1);n?a--:++a<i;)if(e(r[a],a,r))return a;return-1}function $I(r,e,t){if(e!==e)return bI(r,EI,t);for(var n=t-1,i=r.length;++n<i;)if(r[n]===e)return n;return-1}function EI(r){return r!==r}function SI(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}function AI(r){return function(e){return r(e)}}function OI(r,e){return r.has(e)}function II(r,e){return r?.[e]}function PI(r){var e=!1;if(r!=null&&typeof r.toString!="function")try{e=!!(r+"")}catch{}return e}function sf(r,e){return function(t){return r(e(t))}}var xI=Array.prototype,TI=Function.prototype,dn=Object.prototype,Ji=Ki["__core-js_shared__"],uf=function(){var r=/[^.]+$/.exec(Ji&&Ji.keys&&Ji.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),ff=TI.toString,ur=dn.hasOwnProperty,Qi=dn.toString,FI=RegExp("^"+ff.call(ur).replace(pI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),cf=Ki.Symbol,RI=sf(Object.getPrototypeOf,Object),MI=dn.propertyIsEnumerable,DI=xI.splice,lf=cf?cf.isConcatSpreadable:void 0,ea=Object.getOwnPropertySymbols,df=Math.max,CI=hf(Ki,"Map"),Xr=hf(Object,"create");function qe(r){var e=-1,t=r?r.length:0;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}function NI(){this.__data__=Xr?Xr(null):{}}function BI(r){return this.has(r)&&delete this.__data__[r]}function qI(r){var e=this.__data__;if(Xr){var t=e[r];return t===Yi?void 0:t}return ur.call(e,r)?e[r]:void 0}function UI(r){var e=this.__data__;return Xr?e[r]!==void 0:ur.call(e,r)}function LI(r,e){var t=this.__data__;return t[r]=Xr&&e===void 0?Yi:e,this}qe.prototype.clear=NI,qe.prototype.delete=BI,qe.prototype.get=qI,qe.prototype.has=UI,qe.prototype.set=LI;function fr(r){var e=-1,t=r?r.length:0;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}function kI(){this.__data__=[]}function jI(r){var e=this.__data__,t=hn(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():DI.call(e,t,1),!0}function VI(r){var e=this.__data__,t=hn(e,r);return t<0?void 0:e[t][1]}function GI(r){return hn(this.__data__,r)>-1}function HI(r,e){var t=this.__data__,n=hn(t,r);return n<0?t.push([r,e]):t[n][1]=e,this}fr.prototype.clear=kI,fr.prototype.delete=jI,fr.prototype.get=VI,fr.prototype.has=GI,fr.prototype.set=HI;function cr(r){var e=-1,t=r?r.length:0;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}function WI(){this.__data__={hash:new qe,map:new(CI||fr),string:new qe}}function zI(r){return yn(this,r).delete(r)}function XI(r){return yn(this,r).get(r)}function YI(r){return yn(this,r).has(r)}function KI(r,e){return yn(this,r).set(r,e),this}cr.prototype.clear=WI,cr.prototype.delete=zI,cr.prototype.get=XI,cr.prototype.has=YI,cr.prototype.set=KI;function pn(r){var e=-1,t=r?r.length:0;for(this.__data__=new cr;++e<t;)this.add(r[e])}function ZI(r){return this.__data__.set(r,Yi),this}function JI(r){return this.__data__.has(r)}pn.prototype.add=pn.prototype.push=ZI,pn.prototype.has=JI;function QI(r,e){var t=ra(r)||yf(r)?SI(r.length,String):[],n=t.length,i=!!n;for(var a in r)(e||ur.call(r,a))&&!(i&&(a=="length"||lP(a,n)))&&t.push(a);return t}function hn(r,e){for(var t=r.length;t--;)if(vP(r[t][0],e))return t;return-1}function eP(r,e,t,n){var i=-1,a=mI,o=!0,u=r.length,f=[],d=e.length;if(!u)return f;t&&(e=of(e,AI(t))),n?(a=wI,o=!1):e.length>=sI&&(a=OI,o=!1,e=new pn(e));e:for(;++i<u;){var c=r[i],s=t?t(c):c;if(c=n||c!==0?c:0,o&&s===s){for(var l=d;l--;)if(e[l]===s)continue e;f.push(c)}else a(e,s,n)||f.push(c)}return f}function pf(r,e,t,n,i){var a=-1,o=r.length;for(t||(t=cP),i||(i=[]);++a<o;){var u=r[a];e>0&&t(u)?e>1?pf(u,e-1,t,n,i):Zi(i,u):n||(i[i.length]=u)}return i}function rP(r,e,t){var n=e(r);return ra(r)?n:Zi(n,t(r))}function tP(r){if(!ta(r)||pP(r))return!1;var e=_f(r)||PI(r)?FI:hI;return e.test(_P(r))}function nP(r){if(!ta(r))return yP(r);var e=hP(r),t=[];for(var n in r)n=="constructor"&&(e||!ur.call(r,n))||t.push(n);return t}function iP(r,e){return r=Object(r),aP(r,e,function(t,n){return n in r})}function aP(r,e,t){for(var n=-1,i=e.length,a={};++n<i;){var o=e[n],u=r[o];t(u,o)&&(a[o]=u)}return a}function oP(r,e){return e=df(e===void 0?r.length-1:e,0),function(){for(var t=arguments,n=-1,i=df(t.length-e,0),a=Array(i);++n<i;)a[n]=t[e+n];n=-1;for(var o=Array(e+1);++n<e;)o[n]=t[n];return o[e]=a,vI(r,this,o)}}function sP(r){return rP(r,$P,fP)}function yn(r,e){var t=r.__data__;return dP(e)?t[typeof e=="string"?"string":"hash"]:t.map}function hf(r,e){var t=II(r,e);return tP(t)?t:void 0}var uP=ea?sf(ea,Object):mf,fP=ea?function(r){for(var e=[];r;)Zi(e,uP(r)),r=RI(r);return e}:mf;function cP(r){return ra(r)||yf(r)||!!(lf&&r&&r[lf])}function lP(r,e){return e=e??af,!!e&&(typeof r=="number"||yI.test(r))&&r>-1&&r%1==0&&r<e}function dP(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function pP(r){return!!uf&&uf in r}function hP(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||dn;return r===t}function yP(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e}function gP(r){if(typeof r=="string"||bP(r))return r;var e=r+"";return e=="0"&&1/r==-uI?"-0":e}function _P(r){if(r!=null){try{return ff.call(r)}catch{}try{return r+""}catch{}}return""}function vP(r,e){return r===e||r!==r&&e!==e}function yf(r){return mP(r)&&ur.call(r,"callee")&&(!MI.call(r,"callee")||Qi.call(r)==fI)}var ra=Array.isArray;function gf(r){return r!=null&&wP(r.length)&&!_f(r)}function mP(r){return vf(r)&&gf(r)}function _f(r){var e=ta(r)?Qi.call(r):"";return e==cI||e==lI}function wP(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=af}function ta(r){var e=typeof r;return!!r&&(e=="object"||e=="function")}function vf(r){return!!r&&typeof r=="object"}function bP(r){return typeof r=="symbol"||vf(r)&&Qi.call(r)==dI}function $P(r){return gf(r)?QI(r,!0):nP(r)}var EP=oP(function(r,e){return r==null?{}:(e=of(pf(e,1),gP),iP(r,eP(sP(r),e)))});function mf(){return[]}var SP=EP,na=$e(SP);function AP(r){try{return JSON.parse(r)}catch{return r}}function OP(r){return Object.entries(r).reduce((e,[t,n])=>({...e,[t]:AP(n)}),{})}const wf=r=>typeof r=="string"?r!=="0"&&r!=="false":!!r;function bf(r){const e=OP(r),t=e.auto_inject===void 0?!0:e.auto_inject,n=e.display_on??[],i=e.first_option==="autodeliver";return{...na(e,["display_on","first_option"]),auto_inject:t,valid_pages:n,is_subscription_first:i,autoInject:t,validPages:n,isSubscriptionFirst:i}}function $f(r){const e=r.subscription_options?.storefront_purchase_options==="subscription_only";return{...r,is_subscription_only:e,isSubscriptionOnly:e}}function IP(r){return r.map(e=>{const t={};return Object.entries(e).forEach(([n,i])=>{Object.defineProperty(t,n,{value:$f(i),enumerable:!0,writable:!0,configurable:!0})}),t})}const ia="2020-12",PP={store_currency:{currency_code:"USD",currency_symbol:"$",decimal_separator:".",thousands_separator:",",currency_symbol_location:"left"}},Yr=new Map;function gn(r,e){return Yr.has(r)||Yr.set(r,e()),Yr.get(r)}async function aa(r,e){if(r===void 0||r==="")throw new Error("ID is required");const t=e?.version??"2020-12",{product:n}=await gn(`product.${r}.${t}`,()=>It("get",`/product/${t}/${F(r)}.json`));return t==="2020-12"?$f(n):n}async function Ef(){return await gn("storeSettings",()=>It("get",`/${ia}/store_settings.json`).catch(()=>PP))}async function Sf(){const{widget_settings:r}=await gn("widgetSettings",()=>It("get",`/${ia}/widget_settings.json`));return bf(r)}async function Af(){const{products:r,widget_settings:e,store_settings:t,meta:n}=await gn("productsAndSettings",()=>It("get",`/product/${ia}/products.json`));return n?.status==="error"?Promise.reject(n.message):{products:IP(r),widget_settings:bf(e),store_settings:t??{}}}async function xP(){const{products:r}=await Af();return r}async function TP(r){const[e,t,n]=await Promise.all([aa(r),Ef(),Sf()]);return{product:e,store_settings:t,widget_settings:n,storeSettings:t,widgetSettings:n}}async function FP(r){const{bundle_product:e}=await aa(r);return e}async function Of(){return Array.from(Yr.keys()).forEach(r=>Yr.delete(r))}var RP=Object.freeze({__proto__:null,getCDNBundleSettings:FP,getCDNProduct:aa,getCDNProductAndSettings:TP,getCDNProducts:xP,getCDNProductsAndSettings:Af,getCDNStoreSettings:Ef,getCDNWidgetSettings:Sf,resetCDNCache:Of});async function MP(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await w("get","/charges",{id:e,query:{include:t?.include}},v(r,"getCharge"));return n}function DP(r,e){return w("get","/charges",{query:e},v(r,"listCharges"))}async function CP(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await w("post",`/charges/${F(e)}/apply_discount`,{data:{discount_code:t}},v(r,"applyDiscountToCharge"));return n}async function NP(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{charge:t}=await w("post",`/charges/${F(e)}/remove_discount`,{},v(r,"removeDiscountsFromCharge"));return t}async function BP(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");if(t===void 0||t.length===0)throw new Error("Purchase item IDs are required");const{charge:i}=await w("post",`/charges/${F(e)}/skip`,{query:n,data:{purchase_item_ids:t.map(a=>Number(a))}},v(r,"skipCharge"));return i}async function qP(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");if(t===void 0||t.length===0)throw new Error("Purchase item IDs are required");const{charge:i}=await w("post",`/charges/${F(e)}/unskip`,{query:n,data:{purchase_item_ids:t.map(a=>Number(a))}},v(r,"unskipCharge"));return i}async function UP(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{charge:t}=await w("post",`/charges/${F(e)}/process`,{},v(r,"processCharge"));return t}async function LP(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await w("post",`/charges/${F(e)}/change_next_charge_date`,{data:{next_charge_date:t}},v(r,"rescheduleCharge"));return n}var kP=Object.freeze({__proto__:null,applyDiscountToCharge:CP,getCharge:MP,listCharges:DP,processCharge:UP,removeDiscountsFromCharge:NP,rescheduleCharge:LP,skipCharge:BP,unskipCharge:qP});async function If(r,e){if(!["2020-12","2022-06"].includes(e.format_version))throw new Error("Missing or unsupported format_version.");return w("get","/product_search",{query:e,headers:{"X-Recharge-Version":"2021-01"}},v(r,"productSearch"))}var jP=Object.freeze({__proto__:null,productSearch:If});async function Pf(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{collection:t}=await w("get","/collections",{id:e},v(r,"getCollection"));return t}function VP(r,e){return w("get","/collections",{query:e},v(r,"listCollections"))}async function GP(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");if(!["2020-12","2022-06"].includes(t.format_version))throw new Error("Missing or unsupported format_version.");const n=v(r,"listCollectionProducts"),[{sort_order:i,manual_sort_order:a},{products:o}]=await Promise.all([Pf(n,e),If(n,{...t,collection_ids:[e],limit:250})]);if(i==="manual")return{products:a.reduce((u,f)=>{const d=o.find(c=>c.external_product_id===f);return d&&u.push(d),u},[])};{const u=HP(i);return{products:o.slice().sort(u)}}}function xf(r,e){const t=r.external_created_at,n=e.external_created_at;return t<n?-1:n>t?1:0}function Tf(r,e){const t=r.external_product_id,n=e.external_product_id;return t<n?-1:n>t?1:0}function Ff(r,e){const t=r.title.toLowerCase(),n=e.title.toLowerCase();return t<n?-1:n>t?1:0}function HP(r){switch(r){case"created_at-asc":return xf;case"created_at-desc":return(e,t)=>xf(t,e);case"id-asc":return Tf;case"id-desc":return(e,t)=>Tf(t,e);case"title-asc":return Ff;case"title-desc":return(e,t)=>Ff(t,e)}}var WP=Object.freeze({__proto__:null,getCollection:Pf,listCollectionProducts:GP,listCollections:VP});async function zP(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{customer:n}=await w("get","/customers",{id:t,query:{include:e?.include}},v(r,"getCustomer"));return n}async function Rf(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{customer:n}=await w("put","/customers",{id:t,data:e},v(r,"updateCustomer"));return n}async function XP(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{deliveries:n}=await w("get",`/customers/${F(t)}/delivery_schedule`,{query:e},v(r,"getDeliverySchedule"));return n}async function _n(r,e){return w("get","/portal_access",{query:e},v(r,"getCustomerPortalAccess"))}async function YP(r,e,t){if(e===void 0||e==="")throw new Error("Subscription ID is required");const{base_url:n,customer_hash:i,temp_token:a}=await _n(v(r,"getActiveChurnLandingPageURL"));return`${n.replace("portal","pages")}${i}/subscriptions/${e}/cancel?token=${a}&subscription=${e}&redirect_to=${encodeURIComponent(t)}`}async function KP(r){const{base_url:e,customer_hash:t,temp_token:n}=await _n(v(r,"getFailedPaymentMethodRecoveryLandingPageURL"));return`${e.replace("portal","pages")}account/payment-methods?token=${n}&hash=${t}`}async function ZP(r,e,t){if(e===void 0||e==="")throw new Error("Gift ID is required");const{base_url:n,customer_hash:i,temp_token:a}=await _n(v(r,"getGiftRedemptionLandingPageURL"));return`${n.replace("portal","pages")}${i}/gifts/${e}?token=${a}&redirect_to=${encodeURIComponent(t)}`}const Mf={SHOPIFY_UPDATE_PAYMENT_INFO:{type:"email",template_type:"shopify_update_payment_information"},SHOPIFY_MIGRATE_PAYMENT_INFO:{type:"email",template_type:"shopify_migrate_payment_information"}};async function JP(r,e,t){const n=r.customerId;if(!n)throw new Error("Not logged in.");if(!Object.prototype.hasOwnProperty.call(Mf,e))throw new Error("Notification not supported.");const i=Mf[e];return w("post",`/customers/${F(n)}/notifications`,{data:{...i,template_vars:t}},v(r,"sendCustomerNotification"))}async function QP(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{credit_summary:n}=await w("get",`/customers/${F(t)}/credit_summary`,{query:{include:e?.include}},v(r,"getCreditSummary"));return n}var ex=Object.freeze({__proto__:null,getActiveChurnLandingPageURL:YP,getCreditSummary:QP,getCustomer:zP,getCustomerPortalAccess:_n,getDeliverySchedule:XP,getFailedPaymentMethodRecoveryLandingPageURL:KP,getGiftRedemptionLandingPageURL:ZP,sendCustomerNotification:JP,updateCustomer:Rf});async function rx(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{credit_summary:n}=await w("get",`/customers/${F(t)}/credit_summary`,{query:{include:e?.include,presentment_currency_code:e?.presentment_currency_code}},v(r,"getCreditSummary"));return n}function tx(r,{recurring:e}){if(!r.customerId)throw new Error("Not logged in.");const t={};return e!==void 0&&(t.apply_credit_to_next_recurring_charge=e),Rf(v(r,"setApplyCreditsToNextCharge"),t)}async function nx(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{customer_id:n,...i}=e??{};return await w("get","/credit_accounts",{query:{...i,customer_id:t}},v(r,"listCreditAccounts"))}var ix=Object.freeze({__proto__:null,getCreditSummary:rx,listCreditAccounts:nx,setApplyCreditsToNextCharge:tx});async function ax(r,e,t){return await w("post","/customer_surveys/cancellation_prevention",{data:{customer_id:e,subscription_id:t}},v(r,"getCustomerSurveyReasons"))}async function ox(r,e,t,n){return await w("post",`/customer_surveys/${F(t)}/customer_response`,{data:{customer_id:e,response_id:n}},v(r,"getCustomerSurveyOffers"))}async function sx(r,e){return await w("post","/offers/claim",{data:e},v(r,"claimOfferCustomerSurvey")),{}}var ux=Object.freeze({__proto__:null,claimOfferCustomerSurvey:sx,getCustomerSurveyOffers:ox,getCustomerSurveyReasons:ax});function fx(r,e){if(!r.customerId)throw new Error("Not logged in.");return w("get","/gift_purchases",{query:e},v(r,"listGiftPurchases"))}async function cx(r,e){if(!r.customerId)throw new Error("Not logged in.");if(e===void 0||e==="")throw new Error("ID is required");const{gift_purchase:t}=await w("get","/gift_purchases",{id:e},v(r,"getGiftPurchase"));return t}var lx=Object.freeze({__proto__:null,getGiftPurchase:cx,listGiftPurchases:fx});function dx(r,e){if(!r.customerId)throw new Error("Not logged in.");return w("get","/incentives/tiered_discounts",{query:e},v(r,"listTieredDiscounts"))}async function px(r,e){if(!r.customerId)throw new Error("Not logged in.");if(e===void 0||e==="")throw new Error("ID is required");const{tiered_discount:t}=await w("get",`/incentives/tiered_discounts/${F(e)}`,{},v(r,"getTieredDiscount"));return t}function hx(r,e){return w("post","/incentives/tiered_discounts/offers",{data:e},v(r,"getTieredDiscountOffers"))}var yx=Object.freeze({__proto__:null,getTieredDiscount:px,getTieredDiscountOffers:hx,listTieredDiscounts:dx});async function gx(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{membership:t}=await w("get","/memberships",{id:e},v(r,"getMembership"));return t}function _x(r,e){return w("get","/memberships",{query:e},v(r,"listMemberships"))}async function vx(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{membership:n}=await w("post",`/memberships/${F(e)}/cancel`,{data:t},v(r,"cancelMembership"));return n}async function mx(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{membership:n}=await w("post",`/memberships/${F(e)}/activate`,{data:t},v(r,"activateMembership"));return n}async function wx(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{membership:n}=await w("post",`/memberships/${F(e)}/change`,{data:t},v(r,"changeMembership"));return n}var bx=Object.freeze({__proto__:null,activateMembership:mx,cancelMembership:vx,changeMembership:wx,getMembership:gx,listMemberships:_x});async function $x(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{membership_program:n}=await w("get","/membership_programs",{id:e,query:{include:t?.include}},v(r,"getMembershipProgram"));return n}function Ex(r,e){return w("get","/membership_programs",{query:e},v(r,"listMembershipPrograms"))}var Sx=Object.freeze({__proto__:null,getMembershipProgram:$x,listMembershipPrograms:Ex});async function Ax(r,e){const{metafield:t}=await w("post","/metafields",{data:{metafield:e}},v(r,"createMetafield"));return t}async function Ox(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{metafield:n}=await w("put","/metafields",{id:e,data:{metafield:t}},v(r,"updateMetafield"));return n}function Ix(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/metafields",{id:e},v(r,"deleteMetafield"))}var Px=Object.freeze({__proto__:null,createMetafield:Ax,deleteMetafield:Ix,updateMetafield:Ox});async function xx(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{onetime:t}=await w("get","/onetimes",{id:e},v(r,"getOnetime"));return t}function Tx(r,e){return w("get","/onetimes",{query:e},v(r,"listOnetimes"))}async function Fx(r,e){const{onetime:t}=await w("post","/onetimes",{data:e},v(r,"createOnetime"));return t}async function Rx(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{onetime:n}=await w("put","/onetimes",{id:e,data:t},v(r,"updateOnetime"));return n}function Mx(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/onetimes",{id:e},v(r,"deleteOnetime"))}var Dx=Object.freeze({__proto__:null,createOnetime:Fx,deleteOnetime:Mx,getOnetime:xx,listOnetimes:Tx,updateOnetime:Rx});async function Cx(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{order:t}=await w("get","/orders",{id:e},v(r,"getOrder"));return t}function Nx(r,e){return w("get","/orders",{query:e},v(r,"listOrders"))}async function Bx(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{order:t}=await w("post",`/orders/${F(e)}/delay`,{},v(r,"delayOrder"));return t}var qx=Object.freeze({__proto__:null,delayOrder:Bx,getOrder:Cx,listOrders:Nx});async function Ux(r,e){return typeof window<"u"&&window.Spreedly?Promise.resolve():new Promise((t,n)=>{if(typeof document>"u"){n(new Error("Document is not available. This function must be called in a browser environment."));return}if(document.querySelector(`script[src="${r}"]`)){const a=()=>{window.Spreedly?t():setTimeout(a,50)};a();return}const i=document.createElement("script");i.src=r,i.integrity=e,i.crossOrigin="anonymous",i.addEventListener("load",()=>{const a=()=>{window.Spreedly?t():setTimeout(a,50)};a()}),i.addEventListener("error",()=>{n(new Error("Failed to load payment iFrame script"))}),document.head.appendChild(i)})}async function Lx(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{payment_method:n}=await w("get","/payment_methods",{id:e,query:{include:t?.include}},v(r,"getPaymentMethod"));return n}async function Df(r,e){const{payment_method:t}=await w("post","/payment_methods",{data:{...e,customer_id:r.customerId}},v(r,"createPaymentMethod"));return t}async function kx(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{payment_method:n}=await w("put","/payment_methods",{id:e,data:t},v(r,"updatePaymentMethod"));return n}function jx(r,e){return w("get","/payment_methods",{query:e},v(r,"listPaymentMethods"))}async function Vx(r,e){const t=await Gx(r,e),n=t.external.environment_key,i=t.payment_method_intent_id,a=t.external_customer_id.ecommerce,o=t.external.resource_url,u=t.external.integrity_hash,f=t.payment_method?.processor_payment_method_token;await Ux(o,u);let d=!1,c=null,s=null,l=null;return{mount(p,g){if(typeof window>"u"||!window.Spreedly)throw new Error("Payment script failed to load");window.Spreedly.init(n,{numberEl:p.numberElementId,cvvEl:p.cvvElementId}),window.Spreedly.on("ready",()=>{d=!0,p.styles&&(window.Spreedly.setStyle("number",p.styles),window.Spreedly.setStyle("cvv",p.styles)),p.numberLabel&&window.Spreedly.setLabel("number",p.numberLabel),p.cvvLabel&&window.Spreedly.setLabel("cvv",p.cvvLabel),p.numberPlaceholder&&window.Spreedly.setPlaceholder("number",p.numberPlaceholder),p.cvvPlaceholder&&window.Spreedly.setPlaceholder("cvv",p.cvvPlaceholder),p.numberFormat==="plainFormat"?(p.numberFieldType&&window.Spreedly.setFieldType("number",p.numberFieldType),p.cvvFieldType&&window.Spreedly.setFieldType("cvv",p.cvvFieldType),window.Spreedly.setNumberFormat("plainFormat")):p.numberFormat==="maskedFormat"?(window.Spreedly.setFieldType("cvv","text"),window.Spreedly.setFieldType("number","text"),window.Spreedly.setNumberFormat("maskedFormat")):p.numberFormat==="prettyFormat"?(p.numberFieldType==="text"||p.numberFieldType==="tel"?window.Spreedly.setFieldType("number",p.numberFieldType):window.Spreedly.setFieldType("number","tel"),p.cvvFieldType==="text"||p.cvvFieldType==="tel"?window.Spreedly.setFieldType("cvv",p.cvvFieldType):window.Spreedly.setFieldType("cvv","tel"),window.Spreedly.setNumberFormat("prettyFormat")):(p.numberFieldType&&window.Spreedly.setFieldType("number",p.numberFieldType),p.cvvFieldType&&window.Spreedly.setFieldType("cvv",p.cvvFieldType)),g?.onReady?.()}),window.Spreedly.on("fieldEvent",($,E,A,S)=>{g?.onFieldEvent?.($,E,A,S)}),window.Spreedly.on("errors",$=>{g?.onErrors?.($)}),window.Spreedly.on("paymentMethod",($,E)=>{c=$,g?.onPaymentMethod?.($,E),s&&(c=null,s($),s=null)})},tokenize(p){if(!d||!window.Spreedly)throw new Error("Payment form is not initialized");let g=String(p.year);g.length===2&&(g=`20${g}`);const $=String(p.month).padStart(2,"0");"full_name"in p?window.Spreedly.tokenizeCreditCard({full_name:p.full_name,month:$,year:g}):window.Spreedly.tokenizeCreditCard({first_name:p.first_name,last_name:p.last_name,month:$,year:g})},async submit(p){if(!d)throw new Error("Payment form is not initialized");if(c){const g=c;return c=null,Cf(r,g,p,{external_payment_method_id:f,payment_method_intent_id:i,external_customer_id:a})}return new Promise((g,$)=>{l=p,s=async E=>{try{const A=await Cf(r,E,l,{external_payment_method_id:f,payment_method_intent_id:i,external_customer_id:a});g(A)}catch(A){$(A)}finally{l=null}},this.tokenize(p.card_details)})},reset(){window.Spreedly&&window.Spreedly.reload(),c=null,s=null,l=null},unmount(){window.Spreedly&&window.Spreedly.removeHandlers(),d=!1,c=null,s=null,l=null},addEventHandlers(p){p.onReady&&window.Spreedly.on("ready",p.onReady),p.onFieldEvent&&window.Spreedly.on("fieldEvent",p.onFieldEvent),p.onErrors&&window.Spreedly.on("errors",p.onErrors),p.onPaymentMethod&&window.Spreedly.on("paymentMethod",p.onPaymentMethod)},removeHandlers(){window.Spreedly&&window.Spreedly.removeHandlers()},setFieldType(p,g){window.Spreedly.setFieldType(p,g)},setLabel(p,g){window.Spreedly.setLabel(p,g)},setNumberFormat(p){window.Spreedly.setNumberFormat(p)},setPlaceholder(p,g){window.Spreedly.setPlaceholder(p,g)},setStyle(p,g){window.Spreedly.setStyle(p,g)}}}async function Gx(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");return await w("post","/payment_method_intents",{data:{customer_id:t,payment_method_id:e}},v(r,"createFrictionlessPaymentIntentV1"))}async function Cf(r,e,{billing_address:t,default_payment_method:n,address_ids:i,apply_to_all_subscription_addresses:a},{external_payment_method_id:o,payment_method_intent_id:u,external_customer_id:f}){return await Df(v(r,"submitFrictionlessPaymentMethodV1"),{default:n??!1,payment_type:"CREDIT_CARD",processor_customer_token:f.toString(),processor_name:"frictionless",processor_payment_method_token:e,billing_address:t,payment_method_intent_id:u,address_ids:i,external_payment_method_id:o,apply_to_all_subscription_addresses:a})}var Hx=Object.freeze({__proto__:null,createPaymentMethod:Df,getPaymentMethod:Lx,initFrictionlessPaymentV1:Vx,listPaymentMethods:jx,updatePaymentMethod:kx});async function Wx(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{plan:t}=await w("get","/plans",{id:e},v(r,"getPlan"));return t}function zx(r,e){return w("get","/plans",{query:e},v(r,"listPlans"))}var Xx=Object.freeze({__proto__:null,getPlan:Wx,listPlans:zx});async function Yx(r,e){return await w("get","/shop/shipping_countries",{query:e,headers:{"X-Recharge-Version":"2021-01"}},v(r,"getShippingCountries"))}async function Kx(r){return await w("get","/shop/settings",{headers:{"X-Recharge-Version":"2021-01"}},v(r,"getStoreSettings"))}var Zx=Object.freeze({__proto__:null,getShippingCountries:Yx,getStoreSettings:Kx}),Jx="Expected a function",Nf="__lodash_placeholder__",Ue=1,vn=2,Qx=4,lr=8,Kr=16,Le=32,Zr=64,Bf=128,e2=256,qf=512,Uf=1/0,r2=9007199254740991,t2=17976931348623157e292,Lf=0/0,n2=[["ary",Bf],["bind",Ue],["bindKey",vn],["curry",lr],["curryRight",Kr],["flip",qf],["partial",Le],["partialRight",Zr],["rearg",e2]],i2="[object Function]",a2="[object GeneratorFunction]",o2="[object Symbol]",s2=/[\\^$.*+?()[\]{}|]/g,u2=/^\s+|\s+$/g,f2=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,c2=/\{\n\/\* \[wrapped with (.+)\] \*/,l2=/,? & /,d2=/^[-+]0x[0-9a-f]+$/i,p2=/^0b[01]+$/i,h2=/^\[object .+?Constructor\]$/,y2=/^0o[0-7]+$/i,g2=/^(?:0|[1-9]\d*)$/,_2=parseInt,v2=typeof C=="object"&&C&&C.Object===Object&&C,m2=typeof self=="object"&&self&&self.Object===Object&&self,Jr=v2||m2||Function("return this")();function oa(r,e,t){switch(t.length){case 0:return r.call(e);case 1:return r.call(e,t[0]);case 2:return r.call(e,t[0],t[1]);case 3:return r.call(e,t[0],t[1],t[2])}return r.apply(e,t)}function w2(r,e){for(var t=-1,n=r?r.length:0;++t<n&&e(r[t],t,r)!==!1;);return r}function b2(r,e){var t=r?r.length:0;return!!t&&E2(r,e,0)>-1}function $2(r,e,t,n){for(var i=r.length,a=t+(n?1:-1);n?a--:++a<i;)if(e(r[a],a,r))return a;return-1}function E2(r,e,t){if(e!==e)return $2(r,S2,t);for(var n=t-1,i=r.length;++n<i;)if(r[n]===e)return n;return-1}function S2(r){return r!==r}function A2(r,e){for(var t=r.length,n=0;t--;)r[t]===e&&n++;return n}function O2(r,e){return r?.[e]}function I2(r){var e=!1;if(r!=null&&typeof r.toString!="function")try{e=!!(r+"")}catch{}return e}function sa(r,e){for(var t=-1,n=r.length,i=0,a=[];++t<n;){var o=r[t];(o===e||o===Nf)&&(r[t]=Nf,a[i++]=t)}return a}var P2=Function.prototype,kf=Object.prototype,ua=Jr["__core-js_shared__"],jf=function(){var r=/[^.]+$/.exec(ua&&ua.keys&&ua.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),Vf=P2.toString,x2=kf.hasOwnProperty,Gf=kf.toString,T2=RegExp("^"+Vf.call(x2).replace(s2,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),F2=Object.create,dr=Math.max,R2=Math.min,Hf=function(){var r=zf(Object,"defineProperty"),e=zf.name;return e&&e.length>2?r:void 0}();function M2(r){return pr(r)?F2(r):{}}function D2(r){if(!pr(r)||W2(r))return!1;var e=K2(r)||I2(r)?T2:h2;return e.test(X2(r))}function C2(r,e){return e=dr(e===void 0?r.length-1:e,0),function(){for(var t=arguments,n=-1,i=dr(t.length-e,0),a=Array(i);++n<i;)a[n]=t[e+n];n=-1;for(var o=Array(e+1);++n<e;)o[n]=t[n];return o[e]=a,oa(r,this,o)}}function N2(r,e,t,n){for(var i=-1,a=r.length,o=t.length,u=-1,f=e.length,d=dr(a-o,0),c=Array(f+d),s=!n;++u<f;)c[u]=e[u];for(;++i<o;)(s||i<a)&&(c[t[i]]=r[i]);for(;d--;)c[u++]=r[i++];return c}function B2(r,e,t,n){for(var i=-1,a=r.length,o=-1,u=t.length,f=-1,d=e.length,c=dr(a-u,0),s=Array(c+d),l=!n;++i<c;)s[i]=r[i];for(var p=i;++f<d;)s[p+f]=e[f];for(;++o<u;)(l||i<a)&&(s[p+t[o]]=r[i++]);return s}function q2(r,e){var t=-1,n=r.length;for(e||(e=Array(n));++t<n;)e[t]=r[t];return e}function U2(r,e,t){var n=e&Ue,i=Qr(r);function a(){var o=this&&this!==Jr&&this instanceof a?i:r;return o.apply(n?t:this,arguments)}return a}function Qr(r){return function(){var e=arguments;switch(e.length){case 0:return new r;case 1:return new r(e[0]);case 2:return new r(e[0],e[1]);case 3:return new r(e[0],e[1],e[2]);case 4:return new r(e[0],e[1],e[2],e[3]);case 5:return new r(e[0],e[1],e[2],e[3],e[4]);case 6:return new r(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new r(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var t=M2(r.prototype),n=r.apply(t,e);return pr(n)?n:t}}function L2(r,e,t){var n=Qr(r);function i(){for(var a=arguments.length,o=Array(a),u=a,f=ca(i);u--;)o[u]=arguments[u];var d=a<3&&o[0]!==f&&o[a-1]!==f?[]:sa(o,f);if(a-=d.length,a<t)return Wf(r,e,fa,i.placeholder,void 0,o,d,void 0,void 0,t-a);var c=this&&this!==Jr&&this instanceof i?n:r;return oa(c,this,o)}return i}function fa(r,e,t,n,i,a,o,u,f,d){var c=e&Bf,s=e&Ue,l=e&vn,p=e&(lr|Kr),g=e&qf,$=l?void 0:Qr(r);function E(){for(var A=arguments.length,S=Array(A),h=A;h--;)S[h]=arguments[h];if(p)var O=ca(E),T=A2(S,O);if(n&&(S=N2(S,n,i,p)),a&&(S=B2(S,a,o,p)),A-=T,p&&A<d){var R=sa(S,O);return Wf(r,e,fa,E.placeholder,t,S,R,u,f,d-A)}var b=s?t:this,_=l?b[r]:r;return A=S.length,u?S=z2(S,u):g&&A>1&&S.reverse(),c&&f<A&&(S.length=f),this&&this!==Jr&&this instanceof E&&(_=$||Qr(_)),_.apply(b,S)}return E}function k2(r,e,t,n){var i=e&Ue,a=Qr(r);function o(){for(var u=-1,f=arguments.length,d=-1,c=n.length,s=Array(c+f),l=this&&this!==Jr&&this instanceof o?a:r;++d<c;)s[d]=n[d];for(;f--;)s[d++]=arguments[++u];return oa(l,i?t:this,s)}return o}function Wf(r,e,t,n,i,a,o,u,f,d){var c=e&lr,s=c?o:void 0,l=c?void 0:o,p=c?a:void 0,g=c?void 0:a;e|=c?Le:Zr,e&=~(c?Zr:Le),e&Qx||(e&=~(Ue|vn));var $=t(r,e,i,p,s,g,l,u,f,d);return $.placeholder=n,Xf($,r,e)}function j2(r,e,t,n,i,a,o,u){var f=e&vn;if(!f&&typeof r!="function")throw new TypeError(Jx);var d=n?n.length:0;if(d||(e&=~(Le|Zr),n=i=void 0),o=o===void 0?o:dr(Yf(o),0),u=u===void 0?u:Yf(u),d-=i?i.length:0,e&Zr){var c=n,s=i;n=i=void 0}var l=[r,e,t,n,i,c,s,a,o,u];if(r=l[0],e=l[1],t=l[2],n=l[3],i=l[4],u=l[9]=l[9]==null?f?0:r.length:dr(l[9]-d,0),!u&&e&(lr|Kr)&&(e&=~(lr|Kr)),!e||e==Ue)var p=U2(r,e,t);else e==lr||e==Kr?p=L2(r,e,u):(e==Le||e==(Ue|Le))&&!i.length?p=k2(r,e,t,n):p=fa.apply(void 0,l);return Xf(p,r,e)}function ca(r){var e=r;return e.placeholder}function zf(r,e){var t=O2(r,e);return D2(t)?t:void 0}function V2(r){var e=r.match(c2);return e?e[1].split(l2):[]}function G2(r,e){var t=e.length,n=t-1;return e[n]=(t>1?"& ":"")+e[n],e=e.join(t>2?", ":" "),r.replace(f2,`{
|
|
25
25
|
/* [wrapped with `+e+`] */
|
|
26
26
|
`)}function H2(r,e){return e=e??r2,!!e&&(typeof r=="number"||g2.test(r))&&r>-1&&r%1==0&&r<e}function W2(r){return!!jf&&jf in r}function z2(r,e){for(var t=r.length,n=R2(e.length,t),i=q2(r);n--;){var a=e[n];r[n]=H2(a,t)?i[a]:void 0}return r}var Xf=Hf?function(r,e,t){var n=e+"";return Hf(r,"toString",{configurable:!0,enumerable:!1,value:rT(G2(n,Y2(V2(n),t)))})}:tT;function X2(r){if(r!=null){try{return Vf.call(r)}catch{}try{return r+""}catch{}}return""}function Y2(r,e){return w2(n2,function(t){var n="_."+t[0];e&t[1]&&!b2(r,n)&&r.push(n)}),r.sort()}var la=C2(function(r,e){var t=sa(e,ca(la));return j2(r,Le,void 0,e,t)});function K2(r){var e=pr(r)?Gf.call(r):"";return e==i2||e==a2}function pr(r){var e=typeof r;return!!r&&(e=="object"||e=="function")}function Z2(r){return!!r&&typeof r=="object"}function J2(r){return typeof r=="symbol"||Z2(r)&&Gf.call(r)==o2}function Q2(r){if(!r)return r===0?r:0;if(r=eT(r),r===Uf||r===-Uf){var e=r<0?-1:1;return e*t2}return r===r?r:0}function Yf(r){var e=Q2(r),t=e%1;return e===e?t?e-t:e:0}function eT(r){if(typeof r=="number")return r;if(J2(r))return Lf;if(pr(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=pr(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=r.replace(u2,"");var t=p2.test(r);return t||y2.test(r)?_2(r.slice(2),t?2:8):d2.test(r)?Lf:+r}function rT(r){return function(){return r}}function tT(r){return r}la.placeholder={};var nT=la,Kf=$e(nT);function iT(r,e){return{...na(e,["address_id","external_variant_id","external_product_id","charge_interval_frequency","order_interval_frequency","price","status"]),customer_id:parseInt(r,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 aT(r,e){return{...na(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:r}}function Zf(r){const{id:e,address_id:t,customer_id:n,analytics_data:i,cancellation_reason:a,cancellation_reason_comments:o,cancelled_at:u,charge_interval_frequency:f,created_at:d,expire_after_specific_number_of_charges:c,shopify_product_id:s,shopify_variant_id:l,has_queued_charges:p,is_prepaid:g,is_skippable:$,is_swappable:E,max_retries_reached:A,next_charge_scheduled_at:S,order_day_of_month:h,order_day_of_week:O,order_interval_frequency:T,order_interval_unit:R,presentment_currency:b,price:_,product_title:m,properties:I,quantity:P,sku:q,sku_override:z,status:ue,updated_at:Z,variant_title:ke}=r;return{id:e,address_id:t,customer_id:n,analytics_data:i,cancellation_reason:a,cancellation_reason_comments:o,cancelled_at:u,charge_interval_frequency:parseInt(f,10),created_at:d,expire_after_specific_number_of_charges:c,external_product_id:{ecommerce:`${s}`},external_variant_id:{ecommerce:`${l}`},has_queued_charges:wf(p),is_prepaid:g,is_skippable:$,is_swappable:E,max_retries_reached:wf(A),next_charge_scheduled_at:S,order_day_of_month:h,order_day_of_week:O,order_interval_frequency:parseInt(T,10),order_interval_unit:R,presentment_currency:b,price:`${_}`,product_title:m??"",properties:I,quantity:P,sku:q,sku_override:z,status:ue.toLowerCase(),updated_at:Z,variant_title:ke}}async function oT(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{subscription:n}=await w("get","/subscriptions",{id:e,query:{include:t?.include}},v(r,"getSubscription"));return n}function sT(r,e){return w("get","/subscriptions",{query:e},v(r,"listSubscriptions"))}function uT(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");return w("get",`/subscriptions/${F(e)}/addons`,{query:t},v(r,"listSubscriptionAddons"))}async function fT(r,e,t){const{subscription:n}=await w("post","/subscriptions",{data:e,query:t},v(r,"createSubscription"));return n}async function cT(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");const{subscription:i}=await w("put","/subscriptions",{id:e,data:t,query:n},v(r,"updateSubscription"));return i}async function lT(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");const{subscription:i}=await w("post",`/subscriptions/${F(e)}/set_next_charge_date`,{data:{date:t},query:n},v(r,"updateSubscriptionChargeDate"));return i}async function dT(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{subscription:n}=await w("post",`/subscriptions/${F(e)}/change_address`,{data:{address_id:t}},v(r,"updateSubscriptionAddress"));return n}async function pT(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");const{subscription:i}=await w("post",`/subscriptions/${F(e)}/cancel`,{data:t,query:n},v(r,"cancelSubscription"));return i}async function hT(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{subscription:n}=await w("post",`/subscriptions/${F(e)}/activate`,{query:t},v(r,"activateSubscription"));return n}async function yT(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await w("post",`/subscriptions/${F(e)}/charges/skip`,{data:{date:t,subscription_id:`${e}`}},v(r,"skipSubscriptionCharge"));return n}async function gT(r,e,t){if(e===void 0||e.length===0)throw new Error("Subscription IDs are required");const{onetimes:n}=await w("post","/purchase_items/skip_gift",{data:{purchase_item_ids:e.map(Number),recipient_address:t}},v(r,"skipGiftSubscriptionCharge"));return n}async function _T(r,e,t){const n=e.length;if(n<1||n>21)throw new Error("Number of subscriptions must be between 1 and 20.");const{customerId:i}=r;if(!i)throw new Error("No customerId in session.");const a=e[0].address_id;if(!e.every(c=>c.address_id===a))throw new Error("All subscriptions must have the same address_id.");const o=Kf(iT,i),u=e.map(o);let f;t?.allow_onetimes!==void 0&&(f={allow_onetimes:t.allow_onetimes});const{subscriptions:d}=await w("post",`/addresses/${F(a)}/subscriptions-bulk`,{data:{subscriptions:u,commit_update:!!t?.commit},headers:{"X-Recharge-Version":"2021-01"},query:f},v(r,"createSubscriptions"));return d.map(Zf)}async function vT(r,e,t,n){if(e===void 0||e==="")throw new Error("Address ID is required");const i=t.length;if(i<1||i>21)throw new Error("Number of subscriptions must be between 1 and 20.");const{customerId:a}=r;if(!a)throw new Error("No customerId in session.");const o=Kf(aT,!!n?.force_update),u=t.map(o);let f;n?.allow_onetimes!==void 0&&(f={allow_onetimes:n.allow_onetimes});const{subscriptions:d}=await w("put",`/addresses/${F(e)}/subscriptions-bulk`,{data:{subscriptions:u,commit_update:!!n?.commit},headers:{"X-Recharge-Version":"2021-01"},query:f},v(r,"updateSubscriptions"));return d.map(Zf)}async function mT(r,e,t,n){if(e===void 0||e==="")throw new Error("Address ID is required");const i=t.length;if(i<1||i>21)throw new Error("Number of subscriptions must be between 1 and 20.");const{customerId:a}=r;if(!a)throw new Error("No customerId in session.");let o;n?.allow_onetimes!==void 0&&(o={allow_onetimes:n.allow_onetimes}),await w("delete",`/addresses/${F(e)}/subscriptions-bulk`,{data:{subscriptions:t,send_email:!!n?.send_email,commit_update:!!n?.commit},headers:{"X-Recharge-Version":"2021-01"},query:o},v(r,"deleteSubscriptions"))}var wT=Object.freeze({__proto__:null,activateSubscription:hT,cancelSubscription:pT,createSubscription:fT,createSubscriptions:_T,deleteSubscriptions:mT,getSubscription:oT,listSubscriptionAddons:uT,listSubscriptions:sT,skipGiftSubscriptionCharge:gT,skipSubscriptionCharge:yT,updateSubscription:cT,updateSubscriptionAddress:dT,updateSubscriptionChargeDate:lT,updateSubscriptions:vT});const bT={get(r,e){return Y("get",r,e)},post(r,e){return Y("post",r,e)},put(r,e){return Y("put",r,e)},delete(r,e){return Y("delete",r,e)}};function $T(r){if(r)return r;if(window?.Shopify?.shop)return window.Shopify.shop;let e=window?.domain;if(!e){const t=location?.href.match(/(?:http[s]*:\/\/)*(.*?)\.(?=admin\.rechargeapps\.com)/i)?.[1].replace(/-sp$/,"");t&&(e=`${t}.myshopify.com`)}if(e)return e;throw new Error("No storeIdentifier was passed into init.")}function ET(r={}){const e=r,{storefrontAccessToken:t}=r;if(t&&!t.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.");ch({storeIdentifier:$T(r.storeIdentifier),loginRetryFn:r.loginRetryFn,__unstable_twoFactorRetryFn:r.__unstable_twoFactorRetryFn,storefrontAccessToken:t,appName:r.appName,appVersion:r.appVersion,environment:e.environment?e.environment:"prod",environmentUri:e.environmentUri,customerHash:e.customerHash}),Of()}const Jf={init:ET,api:bT,address:Sh,auth:Dh,bundle:ZO,bundleData:oI,charge:kP,cdn:RP,collection:WP,credit:ix,customer:ex,customerSurveys:ux,gift:lx,tieredDiscount:yx,membership:bx,membershipProgram:Sx,metafield:Px,onetime:Dx,order:qx,paymentMethod:Hx,plan:Xx,product:jP,store:Zx,subscription:wT};try{Jf.init()}catch{}return Jf});
|