@rechargeapps/storefront-client 1.16.3 → 1.17.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.
@@ -14,6 +14,9 @@ async function loginShopifyAppProxy() {
14
14
  return { apiToken: response.api_token, customerId: response.customer_id, message: response.message };
15
15
  }
16
16
  async function loginShopifyApi(shopifyStorefrontToken, shopifyCustomerAccessToken) {
17
+ return loginWithShopifyStorefront(shopifyStorefrontToken, shopifyCustomerAccessToken);
18
+ }
19
+ async function loginWithShopifyStorefront(shopifyStorefrontToken, shopifyCustomerAccessToken) {
17
20
  const { environment, environmentUri, storefrontAccessToken, storeIdentifier } = options.getOptions();
18
21
  const rechargeBaseUrl = api.RECHARGE_ADMIN_URL(environment, environmentUri);
19
22
  const headers = {};
@@ -34,6 +37,26 @@ async function loginShopifyApi(shopifyStorefrontToken, shopifyCustomerAccessToke
34
37
  });
35
38
  return apiToken ? { apiToken, customerId, message } : null;
36
39
  }
40
+ async function loginWithShopifyCustomerAccount(shopifyCustomerAccessToken) {
41
+ const { environment, environmentUri, storefrontAccessToken, storeIdentifier } = options.getOptions();
42
+ const rechargeBaseUrl = api.RECHARGE_ADMIN_URL(environment, environmentUri);
43
+ const headers = {};
44
+ if (storefrontAccessToken) {
45
+ headers["X-Recharge-Storefront-Access-Token"] = storefrontAccessToken;
46
+ }
47
+ const {
48
+ api_token: apiToken,
49
+ customer_id: customerId,
50
+ message
51
+ } = await request.request("post", `${rechargeBaseUrl}/shopify_customer_account_api_access`, {
52
+ data: {
53
+ customer_token: shopifyCustomerAccessToken,
54
+ shop_url: storeIdentifier
55
+ },
56
+ headers
57
+ });
58
+ return apiToken ? { apiToken, customerId, message } : null;
59
+ }
37
60
  async function sendPasswordlessCode(email, options$1 = {}) {
38
61
  const { environment, environmentUri, storefrontAccessToken, storeIdentifier } = options.getOptions();
39
62
  const rechargeBaseUrl = api.RECHARGE_ADMIN_URL(environment, environmentUri);
@@ -145,6 +168,8 @@ async function loginCustomerPortal() {
145
168
  exports.loginCustomerPortal = loginCustomerPortal;
146
169
  exports.loginShopifyApi = loginShopifyApi;
147
170
  exports.loginShopifyAppProxy = loginShopifyAppProxy;
171
+ exports.loginWithShopifyCustomerAccount = loginWithShopifyCustomerAccount;
172
+ exports.loginWithShopifyStorefront = loginWithShopifyStorefront;
148
173
  exports.sendPasswordlessCode = sendPasswordlessCode;
149
174
  exports.sendPasswordlessCodeAppProxy = sendPasswordlessCodeAppProxy;
150
175
  exports.validatePasswordlessCode = validatePasswordlessCode;
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sources":["../../../src/api/auth.ts"],"sourcesContent":["import { request as baseRequest, shopifyAppProxyRequest } from '../utils/request';\nimport {\n LoginResponse,\n PasswordlessCodeResponse,\n PasswordlessOptions,\n PasswordlessValidateResponse,\n} from '../types/auth';\nimport { getOptions } from '../utils/options';\nimport { RECHARGE_ADMIN_URL } from '../constants/api';\nimport { Session } from '../types/session';\nimport { RequestHeaders } from '../types';\n\nexport async function loginShopifyAppProxy(): Promise<Session> {\n const { storefrontAccessToken } = getOptions();\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await shopifyAppProxyRequest<LoginResponse>('get', '/access', { headers });\n\n return { apiToken: response.api_token, customerId: response.customer_id, message: response.message };\n}\n\nexport async function loginShopifyApi(\n shopifyStorefrontToken: string,\n shopifyCustomerAccessToken?: string\n): Promise<Session | null> {\n const { environment, environmentUri, storefrontAccessToken, storeIdentifier } = getOptions();\n const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment, environmentUri);\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const {\n api_token: apiToken,\n customer_id: customerId,\n message,\n } = await baseRequest<LoginResponse>('post', `${rechargeBaseUrl}/shopify_storefront_access`, {\n data: {\n customer_token: shopifyCustomerAccessToken,\n storefront_token: shopifyStorefrontToken,\n shop_url: storeIdentifier,\n },\n headers,\n });\n\n return apiToken ? { apiToken, customerId, message } : null;\n}\n\nexport async function sendPasswordlessCode(email: string, options: PasswordlessOptions = {}): Promise<string> {\n const { environment, environmentUri, storefrontAccessToken, storeIdentifier } = getOptions();\n const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment, environmentUri);\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await baseRequest<PasswordlessCodeResponse>('post', `${rechargeBaseUrl}/attempt_login`, {\n data: {\n email,\n shop: storeIdentifier,\n ...options,\n },\n headers,\n });\n\n if (response.errors) {\n throw new Error(response.errors);\n }\n return response.session_token;\n}\n\nexport async function sendPasswordlessCodeAppProxy(email: string, options: PasswordlessOptions = {}): Promise<string> {\n const { storefrontAccessToken } = getOptions();\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await shopifyAppProxyRequest<PasswordlessCodeResponse>('post', '/attempt_login', {\n data: {\n email,\n ...options,\n },\n headers,\n });\n\n if (response.errors) {\n throw new Error(response.errors);\n }\n return response.session_token;\n}\n\nexport async function validatePasswordlessCode(email: string, session_token: string, code: string): Promise<Session> {\n const { environment, environmentUri, storefrontAccessToken, storeIdentifier } = getOptions();\n const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment, environmentUri);\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await baseRequest<PasswordlessValidateResponse>('post', `${rechargeBaseUrl}/validate_login`, {\n data: {\n code,\n email,\n session_token,\n shop: storeIdentifier,\n },\n headers,\n });\n\n if (response.errors) {\n throw new Error(response.errors);\n }\n return { apiToken: response.api_token, customerId: response.customer_id };\n}\n\nexport async function validatePasswordlessCodeAppProxy(\n email: string,\n session_token: string,\n code: string\n): Promise<Session> {\n const { storefrontAccessToken } = getOptions();\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await shopifyAppProxyRequest<PasswordlessValidateResponse>('post', '/validate_login', {\n data: {\n code,\n email,\n session_token,\n },\n headers,\n });\n\n if (response.errors) {\n throw new Error(response.errors);\n }\n return { apiToken: response.api_token, customerId: response.customer_id };\n}\n\nfunction getCustomerParams() {\n const { pathname, search } = window.location;\n const urlParams = new URLSearchParams(search);\n const token = urlParams.get('token');\n const subpaths = pathname.split('/').filter(Boolean);\n const portalIndex = subpaths.findIndex(path => path === 'portal');\n const customerHash = portalIndex !== -1 ? subpaths[portalIndex + 1] : undefined;\n\n // make sure the URL contained the data we need\n if (!token || !customerHash) {\n throw new Error('Not in context of Recharge Customer Portal or URL did not contain correct params');\n }\n return { customerHash, token };\n}\n\nexport async function loginCustomerPortal(): Promise<Session> {\n const { customerHash, token } = getCustomerParams();\n const { environment, environmentUri, storefrontAccessToken, storeIdentifier } = getOptions();\n const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment, environmentUri);\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await baseRequest<LoginResponse>('post', `${rechargeBaseUrl}/customers/${customerHash}/access`, {\n headers,\n data: {\n token,\n shop: storeIdentifier,\n },\n });\n\n return { apiToken: response.api_token, customerId: response.customer_id };\n}\n"],"names":["getOptions","shopifyAppProxyRequest","RECHARGE_ADMIN_URL","baseRequest","options"],"mappings":";;;;;;AAYA,eAAsB,oBAAyC,GAAA;AAC7D,EAAM,MAAA,EAAE,qBAAsB,EAAA,GAAIA,kBAAW,EAAA,CAAA;AAC7C,EAAA,MAAM,UAA0B,EAAC,CAAA;AACjC,EAAA,IAAI,qBAAuB,EAAA;AACzB,IAAA,OAAA,CAAQ,oCAAoC,CAAI,GAAA,qBAAA,CAAA;AAAA,GAClD;AACA,EAAA,MAAM,WAAW,MAAMC,8BAAA,CAAsC,OAAO,SAAW,EAAA,EAAE,SAAS,CAAA,CAAA;AAE1F,EAAO,OAAA,EAAE,UAAU,QAAS,CAAA,SAAA,EAAW,YAAY,QAAS,CAAA,WAAA,EAAa,OAAS,EAAA,QAAA,CAAS,OAAQ,EAAA,CAAA;AACrG,CAAA;AAEsB,eAAA,eAAA,CACpB,wBACA,0BACyB,EAAA;AACzB,EAAA,MAAM,EAAE,WAAa,EAAA,cAAA,EAAgB,qBAAuB,EAAA,eAAA,KAAoBD,kBAAW,EAAA,CAAA;AAC3F,EAAM,MAAA,eAAA,GAAkBE,sBAAmB,CAAA,WAAA,EAAa,cAAc,CAAA,CAAA;AACtE,EAAA,MAAM,UAA0B,EAAC,CAAA;AACjC,EAAA,IAAI,qBAAuB,EAAA;AACzB,IAAA,OAAA,CAAQ,oCAAoC,CAAI,GAAA,qBAAA,CAAA;AAAA,GAClD;AACA,EAAM,MAAA;AAAA,IACJ,SAAW,EAAA,QAAA;AAAA,IACX,WAAa,EAAA,UAAA;AAAA,IACb,OAAA;AAAA,MACE,MAAMC,eAAA,CAA2B,MAAQ,EAAA,CAAA,EAAG,eAAe,CAA8B,0BAAA,CAAA,EAAA;AAAA,IAC3F,IAAM,EAAA;AAAA,MACJ,cAAgB,EAAA,0BAAA;AAAA,MAChB,gBAAkB,EAAA,sBAAA;AAAA,MAClB,QAAU,EAAA,eAAA;AAAA,KACZ;AAAA,IACA,OAAA;AAAA,GACD,CAAA,CAAA;AAED,EAAA,OAAO,QAAW,GAAA,EAAE,QAAU,EAAA,UAAA,EAAY,SAAY,GAAA,IAAA,CAAA;AACxD,CAAA;AAEA,eAAsB,oBAAqB,CAAA,KAAA,EAAeC,SAA+B,GAAA,EAAqB,EAAA;AAC5G,EAAA,MAAM,EAAE,WAAa,EAAA,cAAA,EAAgB,qBAAuB,EAAA,eAAA,KAAoBJ,kBAAW,EAAA,CAAA;AAC3F,EAAM,MAAA,eAAA,GAAkBE,sBAAmB,CAAA,WAAA,EAAa,cAAc,CAAA,CAAA;AACtE,EAAA,MAAM,UAA0B,EAAC,CAAA;AACjC,EAAA,IAAI,qBAAuB,EAAA;AACzB,IAAA,OAAA,CAAQ,oCAAoC,CAAI,GAAA,qBAAA,CAAA;AAAA,GAClD;AACA,EAAA,MAAM,WAAW,MAAMC,eAAA,CAAsC,MAAQ,EAAA,CAAA,EAAG,eAAe,CAAkB,cAAA,CAAA,EAAA;AAAA,IACvG,IAAM,EAAA;AAAA,MACJ,KAAA;AAAA,MACA,IAAM,EAAA,eAAA;AAAA,MACN,GAAGC,SAAA;AAAA,KACL;AAAA,IACA,OAAA;AAAA,GACD,CAAA,CAAA;AAED,EAAA,IAAI,SAAS,MAAQ,EAAA;AACnB,IAAM,MAAA,IAAI,KAAM,CAAA,QAAA,CAAS,MAAM,CAAA,CAAA;AAAA,GACjC;AACA,EAAA,OAAO,QAAS,CAAA,aAAA,CAAA;AAClB,CAAA;AAEA,eAAsB,4BAA6B,CAAA,KAAA,EAAeA,SAA+B,GAAA,EAAqB,EAAA;AACpH,EAAM,MAAA,EAAE,qBAAsB,EAAA,GAAIJ,kBAAW,EAAA,CAAA;AAC7C,EAAA,MAAM,UAA0B,EAAC,CAAA;AACjC,EAAA,IAAI,qBAAuB,EAAA;AACzB,IAAA,OAAA,CAAQ,oCAAoC,CAAI,GAAA,qBAAA,CAAA;AAAA,GAClD;AACA,EAAA,MAAM,QAAW,GAAA,MAAMC,8BAAiD,CAAA,MAAA,EAAQ,gBAAkB,EAAA;AAAA,IAChG,IAAM,EAAA;AAAA,MACJ,KAAA;AAAA,MACA,GAAGG,SAAA;AAAA,KACL;AAAA,IACA,OAAA;AAAA,GACD,CAAA,CAAA;AAED,EAAA,IAAI,SAAS,MAAQ,EAAA;AACnB,IAAM,MAAA,IAAI,KAAM,CAAA,QAAA,CAAS,MAAM,CAAA,CAAA;AAAA,GACjC;AACA,EAAA,OAAO,QAAS,CAAA,aAAA,CAAA;AAClB,CAAA;AAEsB,eAAA,wBAAA,CAAyB,KAAe,EAAA,aAAA,EAAuB,IAAgC,EAAA;AACnH,EAAA,MAAM,EAAE,WAAa,EAAA,cAAA,EAAgB,qBAAuB,EAAA,eAAA,KAAoBJ,kBAAW,EAAA,CAAA;AAC3F,EAAM,MAAA,eAAA,GAAkBE,sBAAmB,CAAA,WAAA,EAAa,cAAc,CAAA,CAAA;AACtE,EAAA,MAAM,UAA0B,EAAC,CAAA;AACjC,EAAA,IAAI,qBAAuB,EAAA;AACzB,IAAA,OAAA,CAAQ,oCAAoC,CAAI,GAAA,qBAAA,CAAA;AAAA,GAClD;AACA,EAAA,MAAM,WAAW,MAAMC,eAAA,CAA0C,MAAQ,EAAA,CAAA,EAAG,eAAe,CAAmB,eAAA,CAAA,EAAA;AAAA,IAC5G,IAAM,EAAA;AAAA,MACJ,IAAA;AAAA,MACA,KAAA;AAAA,MACA,aAAA;AAAA,MACA,IAAM,EAAA,eAAA;AAAA,KACR;AAAA,IACA,OAAA;AAAA,GACD,CAAA,CAAA;AAED,EAAA,IAAI,SAAS,MAAQ,EAAA;AACnB,IAAM,MAAA,IAAI,KAAM,CAAA,QAAA,CAAS,MAAM,CAAA,CAAA;AAAA,GACjC;AACA,EAAA,OAAO,EAAE,QAAU,EAAA,QAAA,CAAS,SAAW,EAAA,UAAA,EAAY,SAAS,WAAY,EAAA,CAAA;AAC1E,CAAA;AAEsB,eAAA,gCAAA,CACpB,KACA,EAAA,aAAA,EACA,IACkB,EAAA;AAClB,EAAM,MAAA,EAAE,qBAAsB,EAAA,GAAIH,kBAAW,EAAA,CAAA;AAC7C,EAAA,MAAM,UAA0B,EAAC,CAAA;AACjC,EAAA,IAAI,qBAAuB,EAAA;AACzB,IAAA,OAAA,CAAQ,oCAAoC,CAAI,GAAA,qBAAA,CAAA;AAAA,GAClD;AACA,EAAA,MAAM,QAAW,GAAA,MAAMC,8BAAqD,CAAA,MAAA,EAAQ,iBAAmB,EAAA;AAAA,IACrG,IAAM,EAAA;AAAA,MACJ,IAAA;AAAA,MACA,KAAA;AAAA,MACA,aAAA;AAAA,KACF;AAAA,IACA,OAAA;AAAA,GACD,CAAA,CAAA;AAED,EAAA,IAAI,SAAS,MAAQ,EAAA;AACnB,IAAM,MAAA,IAAI,KAAM,CAAA,QAAA,CAAS,MAAM,CAAA,CAAA;AAAA,GACjC;AACA,EAAA,OAAO,EAAE,QAAU,EAAA,QAAA,CAAS,SAAW,EAAA,UAAA,EAAY,SAAS,WAAY,EAAA,CAAA;AAC1E,CAAA;AAEA,SAAS,iBAAoB,GAAA;AAC3B,EAAA,MAAM,EAAE,QAAA,EAAU,MAAO,EAAA,GAAI,MAAO,CAAA,QAAA,CAAA;AACpC,EAAM,MAAA,SAAA,GAAY,IAAI,eAAA,CAAgB,MAAM,CAAA,CAAA;AAC5C,EAAM,MAAA,KAAA,GAAQ,SAAU,CAAA,GAAA,CAAI,OAAO,CAAA,CAAA;AACnC,EAAA,MAAM,WAAW,QAAS,CAAA,KAAA,CAAM,GAAG,CAAA,CAAE,OAAO,OAAO,CAAA,CAAA;AACnD,EAAA,MAAM,WAAc,GAAA,QAAA,CAAS,SAAU,CAAA,CAAA,IAAA,KAAQ,SAAS,QAAQ,CAAA,CAAA;AAChE,EAAA,MAAM,eAAe,WAAgB,KAAA,CAAA,CAAA,GAAK,QAAS,CAAA,WAAA,GAAc,CAAC,CAAI,GAAA,KAAA,CAAA,CAAA;AAGtE,EAAI,IAAA,CAAC,KAAS,IAAA,CAAC,YAAc,EAAA;AAC3B,IAAM,MAAA,IAAI,MAAM,kFAAkF,CAAA,CAAA;AAAA,GACpG;AACA,EAAO,OAAA,EAAE,cAAc,KAAM,EAAA,CAAA;AAC/B,CAAA;AAEA,eAAsB,mBAAwC,GAAA;AAC5D,EAAA,MAAM,EAAE,YAAA,EAAc,KAAM,EAAA,GAAI,iBAAkB,EAAA,CAAA;AAClD,EAAA,MAAM,EAAE,WAAa,EAAA,cAAA,EAAgB,qBAAuB,EAAA,eAAA,KAAoBD,kBAAW,EAAA,CAAA;AAC3F,EAAM,MAAA,eAAA,GAAkBE,sBAAmB,CAAA,WAAA,EAAa,cAAc,CAAA,CAAA;AACtE,EAAA,MAAM,UAA0B,EAAC,CAAA;AACjC,EAAA,IAAI,qBAAuB,EAAA;AACzB,IAAA,OAAA,CAAQ,oCAAoC,CAAI,GAAA,qBAAA,CAAA;AAAA,GAClD;AACA,EAAM,MAAA,QAAA,GAAW,MAAMC,eAA2B,CAAA,MAAA,EAAQ,GAAG,eAAe,CAAA,WAAA,EAAc,YAAY,CAAW,OAAA,CAAA,EAAA;AAAA,IAC/G,OAAA;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,KAAA;AAAA,MACA,IAAM,EAAA,eAAA;AAAA,KACR;AAAA,GACD,CAAA,CAAA;AAED,EAAA,OAAO,EAAE,QAAU,EAAA,QAAA,CAAS,SAAW,EAAA,UAAA,EAAY,SAAS,WAAY,EAAA,CAAA;AAC1E;;;;;;;;;;"}
1
+ {"version":3,"file":"auth.js","sources":["../../../src/api/auth.ts"],"sourcesContent":["import { request as baseRequest, shopifyAppProxyRequest } from '../utils/request';\nimport {\n LoginResponse,\n PasswordlessCodeResponse,\n PasswordlessOptions,\n PasswordlessValidateResponse,\n} from '../types/auth';\nimport { getOptions } from '../utils/options';\nimport { RECHARGE_ADMIN_URL } from '../constants/api';\nimport { Session } from '../types/session';\nimport { RequestHeaders } from '../types';\n\nexport async function loginShopifyAppProxy(): Promise<Session> {\n const { storefrontAccessToken } = getOptions();\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await shopifyAppProxyRequest<LoginResponse>('get', '/access', { headers });\n\n return { apiToken: response.api_token, customerId: response.customer_id, message: response.message };\n}\n\n/** @deprecated Use `loginWithShopifyStorefront` instead */\nexport async function loginShopifyApi(\n shopifyStorefrontToken: string,\n shopifyCustomerAccessToken?: string\n): Promise<Session | null> {\n return loginWithShopifyStorefront(shopifyStorefrontToken, shopifyCustomerAccessToken);\n}\n\nexport async function loginWithShopifyStorefront(\n shopifyStorefrontToken: string,\n shopifyCustomerAccessToken?: string\n): Promise<Session | null> {\n const { environment, environmentUri, storefrontAccessToken, storeIdentifier } = getOptions();\n const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment, environmentUri);\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const {\n api_token: apiToken,\n customer_id: customerId,\n message,\n } = await baseRequest<LoginResponse>('post', `${rechargeBaseUrl}/shopify_storefront_access`, {\n data: {\n customer_token: shopifyCustomerAccessToken,\n storefront_token: shopifyStorefrontToken,\n shop_url: storeIdentifier,\n },\n headers,\n });\n\n return apiToken ? { apiToken, customerId, message } : null;\n}\n\nexport async function loginWithShopifyCustomerAccount(shopifyCustomerAccessToken?: string): Promise<Session | null> {\n const { environment, environmentUri, storefrontAccessToken, storeIdentifier } = getOptions();\n const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment, environmentUri);\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const {\n api_token: apiToken,\n customer_id: customerId,\n message,\n } = await baseRequest<LoginResponse>('post', `${rechargeBaseUrl}/shopify_customer_account_api_access`, {\n data: {\n customer_token: shopifyCustomerAccessToken,\n shop_url: storeIdentifier,\n },\n headers,\n });\n\n return apiToken ? { apiToken, customerId, message } : null;\n}\n\nexport async function sendPasswordlessCode(email: string, options: PasswordlessOptions = {}): Promise<string> {\n const { environment, environmentUri, storefrontAccessToken, storeIdentifier } = getOptions();\n const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment, environmentUri);\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await baseRequest<PasswordlessCodeResponse>('post', `${rechargeBaseUrl}/attempt_login`, {\n data: {\n email,\n shop: storeIdentifier,\n ...options,\n },\n headers,\n });\n\n if (response.errors) {\n throw new Error(response.errors);\n }\n return response.session_token;\n}\n\nexport async function sendPasswordlessCodeAppProxy(email: string, options: PasswordlessOptions = {}): Promise<string> {\n const { storefrontAccessToken } = getOptions();\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await shopifyAppProxyRequest<PasswordlessCodeResponse>('post', '/attempt_login', {\n data: {\n email,\n ...options,\n },\n headers,\n });\n\n if (response.errors) {\n throw new Error(response.errors);\n }\n return response.session_token;\n}\n\nexport async function validatePasswordlessCode(email: string, session_token: string, code: string): Promise<Session> {\n const { environment, environmentUri, storefrontAccessToken, storeIdentifier } = getOptions();\n const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment, environmentUri);\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await baseRequest<PasswordlessValidateResponse>('post', `${rechargeBaseUrl}/validate_login`, {\n data: {\n code,\n email,\n session_token,\n shop: storeIdentifier,\n },\n headers,\n });\n\n if (response.errors) {\n throw new Error(response.errors);\n }\n return { apiToken: response.api_token, customerId: response.customer_id };\n}\n\nexport async function validatePasswordlessCodeAppProxy(\n email: string,\n session_token: string,\n code: string\n): Promise<Session> {\n const { storefrontAccessToken } = getOptions();\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await shopifyAppProxyRequest<PasswordlessValidateResponse>('post', '/validate_login', {\n data: {\n code,\n email,\n session_token,\n },\n headers,\n });\n\n if (response.errors) {\n throw new Error(response.errors);\n }\n return { apiToken: response.api_token, customerId: response.customer_id };\n}\n\nfunction getCustomerParams() {\n const { pathname, search } = window.location;\n const urlParams = new URLSearchParams(search);\n const token = urlParams.get('token');\n const subpaths = pathname.split('/').filter(Boolean);\n const portalIndex = subpaths.findIndex(path => path === 'portal');\n const customerHash = portalIndex !== -1 ? subpaths[portalIndex + 1] : undefined;\n\n // make sure the URL contained the data we need\n if (!token || !customerHash) {\n throw new Error('Not in context of Recharge Customer Portal or URL did not contain correct params');\n }\n return { customerHash, token };\n}\n\nexport async function loginCustomerPortal(): Promise<Session> {\n const { customerHash, token } = getCustomerParams();\n const { environment, environmentUri, storefrontAccessToken, storeIdentifier } = getOptions();\n const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment, environmentUri);\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await baseRequest<LoginResponse>('post', `${rechargeBaseUrl}/customers/${customerHash}/access`, {\n headers,\n data: {\n token,\n shop: storeIdentifier,\n },\n });\n\n return { apiToken: response.api_token, customerId: response.customer_id };\n}\n"],"names":["getOptions","shopifyAppProxyRequest","RECHARGE_ADMIN_URL","baseRequest","options"],"mappings":"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"}
package/dist/cjs/index.js CHANGED
@@ -33,6 +33,8 @@ exports.updateAddress = address.updateAddress;
33
33
  exports.loginCustomerPortal = auth.loginCustomerPortal;
34
34
  exports.loginShopifyApi = auth.loginShopifyApi;
35
35
  exports.loginShopifyAppProxy = auth.loginShopifyAppProxy;
36
+ exports.loginWithShopifyCustomerAccount = auth.loginWithShopifyCustomerAccount;
37
+ exports.loginWithShopifyStorefront = auth.loginWithShopifyStorefront;
36
38
  exports.sendPasswordlessCode = auth.sendPasswordlessCode;
37
39
  exports.sendPasswordlessCodeAppProxy = auth.sendPasswordlessCodeAppProxy;
38
40
  exports.validatePasswordlessCode = auth.validatePasswordlessCode;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -12,6 +12,9 @@ async function loginShopifyAppProxy() {
12
12
  return { apiToken: response.api_token, customerId: response.customer_id, message: response.message };
13
13
  }
14
14
  async function loginShopifyApi(shopifyStorefrontToken, shopifyCustomerAccessToken) {
15
+ return loginWithShopifyStorefront(shopifyStorefrontToken, shopifyCustomerAccessToken);
16
+ }
17
+ async function loginWithShopifyStorefront(shopifyStorefrontToken, shopifyCustomerAccessToken) {
15
18
  const { environment, environmentUri, storefrontAccessToken, storeIdentifier } = getOptions();
16
19
  const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment, environmentUri);
17
20
  const headers = {};
@@ -32,6 +35,26 @@ async function loginShopifyApi(shopifyStorefrontToken, shopifyCustomerAccessToke
32
35
  });
33
36
  return apiToken ? { apiToken, customerId, message } : null;
34
37
  }
38
+ async function loginWithShopifyCustomerAccount(shopifyCustomerAccessToken) {
39
+ const { environment, environmentUri, storefrontAccessToken, storeIdentifier } = getOptions();
40
+ const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment, environmentUri);
41
+ const headers = {};
42
+ if (storefrontAccessToken) {
43
+ headers["X-Recharge-Storefront-Access-Token"] = storefrontAccessToken;
44
+ }
45
+ const {
46
+ api_token: apiToken,
47
+ customer_id: customerId,
48
+ message
49
+ } = await request("post", `${rechargeBaseUrl}/shopify_customer_account_api_access`, {
50
+ data: {
51
+ customer_token: shopifyCustomerAccessToken,
52
+ shop_url: storeIdentifier
53
+ },
54
+ headers
55
+ });
56
+ return apiToken ? { apiToken, customerId, message } : null;
57
+ }
35
58
  async function sendPasswordlessCode(email, options = {}) {
36
59
  const { environment, environmentUri, storefrontAccessToken, storeIdentifier } = getOptions();
37
60
  const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment, environmentUri);
@@ -140,5 +163,5 @@ async function loginCustomerPortal() {
140
163
  return { apiToken: response.api_token, customerId: response.customer_id };
141
164
  }
142
165
 
143
- export { loginCustomerPortal, loginShopifyApi, loginShopifyAppProxy, sendPasswordlessCode, sendPasswordlessCodeAppProxy, validatePasswordlessCode, validatePasswordlessCodeAppProxy };
166
+ export { loginCustomerPortal, loginShopifyApi, loginShopifyAppProxy, loginWithShopifyCustomerAccount, loginWithShopifyStorefront, sendPasswordlessCode, sendPasswordlessCodeAppProxy, validatePasswordlessCode, validatePasswordlessCodeAppProxy };
144
167
  //# sourceMappingURL=auth.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sources":["../../../src/api/auth.ts"],"sourcesContent":["import { request as baseRequest, shopifyAppProxyRequest } from '../utils/request';\nimport {\n LoginResponse,\n PasswordlessCodeResponse,\n PasswordlessOptions,\n PasswordlessValidateResponse,\n} from '../types/auth';\nimport { getOptions } from '../utils/options';\nimport { RECHARGE_ADMIN_URL } from '../constants/api';\nimport { Session } from '../types/session';\nimport { RequestHeaders } from '../types';\n\nexport async function loginShopifyAppProxy(): Promise<Session> {\n const { storefrontAccessToken } = getOptions();\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await shopifyAppProxyRequest<LoginResponse>('get', '/access', { headers });\n\n return { apiToken: response.api_token, customerId: response.customer_id, message: response.message };\n}\n\nexport async function loginShopifyApi(\n shopifyStorefrontToken: string,\n shopifyCustomerAccessToken?: string\n): Promise<Session | null> {\n const { environment, environmentUri, storefrontAccessToken, storeIdentifier } = getOptions();\n const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment, environmentUri);\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const {\n api_token: apiToken,\n customer_id: customerId,\n message,\n } = await baseRequest<LoginResponse>('post', `${rechargeBaseUrl}/shopify_storefront_access`, {\n data: {\n customer_token: shopifyCustomerAccessToken,\n storefront_token: shopifyStorefrontToken,\n shop_url: storeIdentifier,\n },\n headers,\n });\n\n return apiToken ? { apiToken, customerId, message } : null;\n}\n\nexport async function sendPasswordlessCode(email: string, options: PasswordlessOptions = {}): Promise<string> {\n const { environment, environmentUri, storefrontAccessToken, storeIdentifier } = getOptions();\n const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment, environmentUri);\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await baseRequest<PasswordlessCodeResponse>('post', `${rechargeBaseUrl}/attempt_login`, {\n data: {\n email,\n shop: storeIdentifier,\n ...options,\n },\n headers,\n });\n\n if (response.errors) {\n throw new Error(response.errors);\n }\n return response.session_token;\n}\n\nexport async function sendPasswordlessCodeAppProxy(email: string, options: PasswordlessOptions = {}): Promise<string> {\n const { storefrontAccessToken } = getOptions();\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await shopifyAppProxyRequest<PasswordlessCodeResponse>('post', '/attempt_login', {\n data: {\n email,\n ...options,\n },\n headers,\n });\n\n if (response.errors) {\n throw new Error(response.errors);\n }\n return response.session_token;\n}\n\nexport async function validatePasswordlessCode(email: string, session_token: string, code: string): Promise<Session> {\n const { environment, environmentUri, storefrontAccessToken, storeIdentifier } = getOptions();\n const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment, environmentUri);\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await baseRequest<PasswordlessValidateResponse>('post', `${rechargeBaseUrl}/validate_login`, {\n data: {\n code,\n email,\n session_token,\n shop: storeIdentifier,\n },\n headers,\n });\n\n if (response.errors) {\n throw new Error(response.errors);\n }\n return { apiToken: response.api_token, customerId: response.customer_id };\n}\n\nexport async function validatePasswordlessCodeAppProxy(\n email: string,\n session_token: string,\n code: string\n): Promise<Session> {\n const { storefrontAccessToken } = getOptions();\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await shopifyAppProxyRequest<PasswordlessValidateResponse>('post', '/validate_login', {\n data: {\n code,\n email,\n session_token,\n },\n headers,\n });\n\n if (response.errors) {\n throw new Error(response.errors);\n }\n return { apiToken: response.api_token, customerId: response.customer_id };\n}\n\nfunction getCustomerParams() {\n const { pathname, search } = window.location;\n const urlParams = new URLSearchParams(search);\n const token = urlParams.get('token');\n const subpaths = pathname.split('/').filter(Boolean);\n const portalIndex = subpaths.findIndex(path => path === 'portal');\n const customerHash = portalIndex !== -1 ? subpaths[portalIndex + 1] : undefined;\n\n // make sure the URL contained the data we need\n if (!token || !customerHash) {\n throw new Error('Not in context of Recharge Customer Portal or URL did not contain correct params');\n }\n return { customerHash, token };\n}\n\nexport async function loginCustomerPortal(): Promise<Session> {\n const { customerHash, token } = getCustomerParams();\n const { environment, environmentUri, storefrontAccessToken, storeIdentifier } = getOptions();\n const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment, environmentUri);\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await baseRequest<LoginResponse>('post', `${rechargeBaseUrl}/customers/${customerHash}/access`, {\n headers,\n data: {\n token,\n shop: storeIdentifier,\n },\n });\n\n return { apiToken: response.api_token, customerId: response.customer_id };\n}\n"],"names":["baseRequest"],"mappings":"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"}
1
+ {"version":3,"file":"auth.js","sources":["../../../src/api/auth.ts"],"sourcesContent":["import { request as baseRequest, shopifyAppProxyRequest } from '../utils/request';\nimport {\n LoginResponse,\n PasswordlessCodeResponse,\n PasswordlessOptions,\n PasswordlessValidateResponse,\n} from '../types/auth';\nimport { getOptions } from '../utils/options';\nimport { RECHARGE_ADMIN_URL } from '../constants/api';\nimport { Session } from '../types/session';\nimport { RequestHeaders } from '../types';\n\nexport async function loginShopifyAppProxy(): Promise<Session> {\n const { storefrontAccessToken } = getOptions();\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await shopifyAppProxyRequest<LoginResponse>('get', '/access', { headers });\n\n return { apiToken: response.api_token, customerId: response.customer_id, message: response.message };\n}\n\n/** @deprecated Use `loginWithShopifyStorefront` instead */\nexport async function loginShopifyApi(\n shopifyStorefrontToken: string,\n shopifyCustomerAccessToken?: string\n): Promise<Session | null> {\n return loginWithShopifyStorefront(shopifyStorefrontToken, shopifyCustomerAccessToken);\n}\n\nexport async function loginWithShopifyStorefront(\n shopifyStorefrontToken: string,\n shopifyCustomerAccessToken?: string\n): Promise<Session | null> {\n const { environment, environmentUri, storefrontAccessToken, storeIdentifier } = getOptions();\n const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment, environmentUri);\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const {\n api_token: apiToken,\n customer_id: customerId,\n message,\n } = await baseRequest<LoginResponse>('post', `${rechargeBaseUrl}/shopify_storefront_access`, {\n data: {\n customer_token: shopifyCustomerAccessToken,\n storefront_token: shopifyStorefrontToken,\n shop_url: storeIdentifier,\n },\n headers,\n });\n\n return apiToken ? { apiToken, customerId, message } : null;\n}\n\nexport async function loginWithShopifyCustomerAccount(shopifyCustomerAccessToken?: string): Promise<Session | null> {\n const { environment, environmentUri, storefrontAccessToken, storeIdentifier } = getOptions();\n const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment, environmentUri);\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const {\n api_token: apiToken,\n customer_id: customerId,\n message,\n } = await baseRequest<LoginResponse>('post', `${rechargeBaseUrl}/shopify_customer_account_api_access`, {\n data: {\n customer_token: shopifyCustomerAccessToken,\n shop_url: storeIdentifier,\n },\n headers,\n });\n\n return apiToken ? { apiToken, customerId, message } : null;\n}\n\nexport async function sendPasswordlessCode(email: string, options: PasswordlessOptions = {}): Promise<string> {\n const { environment, environmentUri, storefrontAccessToken, storeIdentifier } = getOptions();\n const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment, environmentUri);\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await baseRequest<PasswordlessCodeResponse>('post', `${rechargeBaseUrl}/attempt_login`, {\n data: {\n email,\n shop: storeIdentifier,\n ...options,\n },\n headers,\n });\n\n if (response.errors) {\n throw new Error(response.errors);\n }\n return response.session_token;\n}\n\nexport async function sendPasswordlessCodeAppProxy(email: string, options: PasswordlessOptions = {}): Promise<string> {\n const { storefrontAccessToken } = getOptions();\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await shopifyAppProxyRequest<PasswordlessCodeResponse>('post', '/attempt_login', {\n data: {\n email,\n ...options,\n },\n headers,\n });\n\n if (response.errors) {\n throw new Error(response.errors);\n }\n return response.session_token;\n}\n\nexport async function validatePasswordlessCode(email: string, session_token: string, code: string): Promise<Session> {\n const { environment, environmentUri, storefrontAccessToken, storeIdentifier } = getOptions();\n const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment, environmentUri);\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await baseRequest<PasswordlessValidateResponse>('post', `${rechargeBaseUrl}/validate_login`, {\n data: {\n code,\n email,\n session_token,\n shop: storeIdentifier,\n },\n headers,\n });\n\n if (response.errors) {\n throw new Error(response.errors);\n }\n return { apiToken: response.api_token, customerId: response.customer_id };\n}\n\nexport async function validatePasswordlessCodeAppProxy(\n email: string,\n session_token: string,\n code: string\n): Promise<Session> {\n const { storefrontAccessToken } = getOptions();\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await shopifyAppProxyRequest<PasswordlessValidateResponse>('post', '/validate_login', {\n data: {\n code,\n email,\n session_token,\n },\n headers,\n });\n\n if (response.errors) {\n throw new Error(response.errors);\n }\n return { apiToken: response.api_token, customerId: response.customer_id };\n}\n\nfunction getCustomerParams() {\n const { pathname, search } = window.location;\n const urlParams = new URLSearchParams(search);\n const token = urlParams.get('token');\n const subpaths = pathname.split('/').filter(Boolean);\n const portalIndex = subpaths.findIndex(path => path === 'portal');\n const customerHash = portalIndex !== -1 ? subpaths[portalIndex + 1] : undefined;\n\n // make sure the URL contained the data we need\n if (!token || !customerHash) {\n throw new Error('Not in context of Recharge Customer Portal or URL did not contain correct params');\n }\n return { customerHash, token };\n}\n\nexport async function loginCustomerPortal(): Promise<Session> {\n const { customerHash, token } = getCustomerParams();\n const { environment, environmentUri, storefrontAccessToken, storeIdentifier } = getOptions();\n const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment, environmentUri);\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await baseRequest<LoginResponse>('post', `${rechargeBaseUrl}/customers/${customerHash}/access`, {\n headers,\n data: {\n token,\n shop: storeIdentifier,\n },\n });\n\n return { apiToken: response.api_token, customerId: response.customer_id };\n}\n"],"names":["baseRequest"],"mappings":"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"}
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { applyDiscountToAddress, createAddress, deleteAddress, getAddress, listAddresses, mergeAddresses, removeDiscountsFromAddress, skipFutureCharge, updateAddress } from './api/address.js';
2
- export { loginCustomerPortal, loginShopifyApi, loginShopifyAppProxy, sendPasswordlessCode, sendPasswordlessCodeAppProxy, validatePasswordlessCode, validatePasswordlessCodeAppProxy } from './api/auth.js';
2
+ export { loginCustomerPortal, loginShopifyApi, loginShopifyAppProxy, loginWithShopifyCustomerAccount, loginWithShopifyStorefront, sendPasswordlessCode, sendPasswordlessCodeAppProxy, validatePasswordlessCode, validatePasswordlessCodeAppProxy } from './api/auth.js';
3
3
  export { createBundleSelection, deleteBundleSelection, getBundleId, getBundleSelection, getDynamicBundleItems, listBundleSelections, updateBundle, updateBundleSelection, validateBundle, validateDynamicBundle } from './api/bundle.js';
4
4
  export { getCDNBundleSettings, getCDNProduct, getCDNProductAndSettings, getCDNProducts, getCDNProductsAndSettings, getCDNStoreSettings, getCDNWidgetSettings, resetCDNCache } from './api/cdn.js';
5
5
  export { applyDiscountToCharge, getCharge, listCharges, processCharge, removeDiscountsFromCharge, skipCharge, unskipCharge } from './api/charge.js';
package/dist/index.d.ts CHANGED
@@ -1450,7 +1450,10 @@ interface PasswordlessValidateResponse {
1450
1450
  }
1451
1451
 
1452
1452
  declare function loginShopifyAppProxy(): Promise<Session>;
1453
+ /** @deprecated Use `loginWithShopifyStorefront` instead */
1453
1454
  declare function loginShopifyApi(shopifyStorefrontToken: string, shopifyCustomerAccessToken?: string): Promise<Session | null>;
1455
+ declare function loginWithShopifyStorefront(shopifyStorefrontToken: string, shopifyCustomerAccessToken?: string): Promise<Session | null>;
1456
+ declare function loginWithShopifyCustomerAccount(shopifyCustomerAccessToken?: string): Promise<Session | null>;
1454
1457
  declare function sendPasswordlessCode(email: string, options?: PasswordlessOptions): Promise<string>;
1455
1458
  declare function sendPasswordlessCodeAppProxy(email: string, options?: PasswordlessOptions): Promise<string>;
1456
1459
  declare function validatePasswordlessCode(email: string, session_token: string, code: string): Promise<Session>;
@@ -2054,6 +2057,7 @@ interface CDNStoreSettings {
2054
2057
  currency_symbol_location: string;
2055
2058
  zero_decimal_currency?: boolean;
2056
2059
  };
2060
+ store_platform?: 'shopify_sci' | 'shopify_rcs' | 'big_commerce';
2057
2061
  }
2058
2062
  interface CDNPlan extends Omit<Plan, 'channel_settings' | 'created_at' | 'deleted_at' | 'external_product_id' | 'subscription_preferences' | 'updated_at'> {
2059
2063
  apply_custom_date_to_checkout: boolean;
@@ -2646,4 +2650,4 @@ declare const api: {
2646
2650
  };
2647
2651
  declare function initRecharge(opt?: InitOptions): void;
2648
2652
 
2649
- export { type ActivateMembershipRequest, type AddToCartCallbackSettings, type AddonSettings, type Address, type AddressIncludes, type AddressListParams, type AddressListResponse, type AddressResponse, type AddressSortBy, type AnalyticsData, type AssociatedAddress, type BasicSubscriptionParams, type BooleanLike, type BooleanNumbers, type BooleanString, type BooleanStringNumbers, type BundleAppProxy, type BundlePriceRule, type BundleProduct, type BundleProductLayoutSettings, type BundlePurchaseItem, type BundlePurchaseItemParams, type BundleSelection, type BundleSelectionAppProxy, type BundleSelectionItem, type BundleSelectionItemRequiredCreateProps, type BundleSelectionListParams, type BundleSelectionsResponse, type BundleSelectionsSortBy, type BundleTemplateSettings, type BundleTemplateType, type BundleTranslations, type BundleVariant, type BundleVariantOptionSource, type BundleVariantRange, type BundleVariantSelectionDefault, type CDNBaseWidgetSettings, type CDNBundleSettings, type CDNBundleVariant, type CDNBundleVariantOptionSource, type CDNPlan, type CDNProduct, type CDNProductAndSettings, type CDNProductKeyObject, type CDNProductQuery_2020_12, type CDNProductQuery_2022_06, type CDNProductRaw, type CDNProductResource, type CDNProductResponseType, type CDNProductType, type CDNProductVariant_2022_06, type CDNProduct_2022_06, type CDNProductsAndSettings, type CDNProductsAndSettingsResource, type CDNStoreSettings, type CDNSubscriptionOption, type CDNVariant, type CDNVersion, type CDNWidgetSettings, type CDNWidgetSettingsRaw, type CDNWidgetSettingsResource, type CRUDRequestOptions, type CancelMembershipRequest, type CancelSubscriptionRequest, type ChangeMembershipRequest, type ChannelSettings, type Charge, type ChargeIncludes, type ChargeListParams, type ChargeListResponse, type ChargeResponse, type ChargeSortBy, type ChargeStatus, type ColorString, type CreateAddressRequest, type CreateBundleSelectionRequest, type CreateMetafieldRequest, type CreateOnetimeRequest, type CreatePaymentMethodRequest, type CreateRecipientAddress, type CreateSubscriptionRequest, type CreditAccount, type CreditAccountType, type CreditSummaryIncludes, type CrossSellsSettings, type Customer, type CustomerCreditSummary, type CustomerDeliveryScheduleParams, type CustomerDeliveryScheduleResponse, type CustomerIncludes, type CustomerNotification, type CustomerNotificationOptions, type CustomerNotificationTemplate, type CustomerNotificationType, type CustomerPortalAccessResponse, type Delivery, type DeliveryLineItem, type DeliveryOrder, type DeliveryPaymentMethod, type Discount, type DiscountType, type DynamicBundleItemAppProxy, type DynamicBundlePropertiesAppProxy, type ExternalAttributeSchema, type ExternalId, type ExternalTransactionId, type FirstOption, type GetAddressOptions, type GetChargeOptions, type GetCreditSummaryOptions, type GetCustomerOptions, type GetMembershipProgramOptions, type GetPaymentMethodOptions, type GetRequestOptions, type GetSubscriptionOptions, type GiftPurchase, type GiftPurchasesParams, type GiftPurchasesResponse, type HTMLString, type InitOptions, type IntervalUnit, type IsoDateString, type LineItem, type ListParams, type LoginResponse, type Membership, type MembershipBenefit, type MembershipIncludes, type MembershipListParams, type MembershipListResponse, type MembershipProgram, type MembershipProgramIncludes, type MembershipProgramListParams, type MembershipProgramListResponse, type MembershipProgramResponse, type MembershipProgramSortBy, type MembershipProgramStatus, type MembershipResponse, type MembershipStatus, type MembershipsSortBy, type MergeAddressesRequest, type Metafield, type MetafieldOptionalCreateProps, type MetafieldOwnerResource, type MetafieldRequiredCreateProps, type Method, type Modifier, type MultiStepSettings, type OnePageSettings, type Onetime, type OnetimeListParams, type OnetimeOptionalCreateProps, type OnetimeRequiredCreateProps, type OnetimesResponse, type OnetimesSortBy, type Order, type OrderIncludes, type OrderListParams, type OrderSortBy, type OrderStatus, type OrderType, type OrdersResponse, type PasswordlessCodeResponse, type PasswordlessOptions, type PasswordlessValidateResponse, type PaymentDetails, type PaymentMethod, type PaymentMethodIncludes, type PaymentMethodListParams, type PaymentMethodOptionalCreateProps, type PaymentMethodRequiredCreateProps, type PaymentMethodSortBy, type PaymentMethodStatus, type PaymentMethodsResponse, type PaymentType, type Plan, type PlanListParams, type PlanSortBy, type PlanType, type PlansResponse, type ProcessorName, type ProductImage, type ProductInclude, type ProductOption, type ProductSearchParams_2020_12, type ProductSearchParams_2022_06, type ProductSearchResponse_2020_12, type ProductSearchResponse_2022_06, type ProductSearchType, type ProductSource, type ProductValueOption, type ProductVariant_2020_12, type ProductVariant_2022_06, type Product_2020_12, type Product_2022_06, type Property, type PublishStatus, type Request, type RequestHeaders, type RequestOptions, type SellingPlan, type SellingPlanGroup, type Session, type ShippingCountriesOptions, type ShippingCountriesResponse, type ShippingCountry, type ShippingLine, type ShippingProvince, type ShopifyUpdatePaymentInfoOptions, type SkipChargeParams, type SkipFutureChargeAddressRequest, type SkipFutureChargeAddressResponse, type SortBy, type SortField, type SortKeys, type StepSettings, type StepSettingsCommon, type StepSettingsTypes, type StorefrontEnvironment, type StorefrontOptions, type StorefrontPurchaseOption, type SubType, type Subscription, type SubscriptionIncludes, type SubscriptionListParams, type SubscriptionOption, type SubscriptionOptionalCreateProps, type SubscriptionPreferences, type SubscriptionRequiredCreateProps, type SubscriptionSortBy, type SubscriptionStatus, type Subscription_2021_01, type SubscriptionsResponse, type TaxLine, type Translations, type UpdateAddressRequest, type UpdateBundlePurchaseItem, type UpdateBundleSelectionRequest, type UpdateCustomerRequest, type UpdateMetafieldRequest, type UpdateOnetimeRequest, type UpdatePaymentMethodRequest, type UpdateSubscriptionParams, type UpdateSubscriptionRequest, type UpdateSubscriptionsParams, type UpdateSubscriptionsRequest, type VariantSelector, type VariantSelectorStepSetting, type WidgetIconColor, type WidgetTemplateType, type WidgetVisibility, activateMembership, activateSubscription, api, applyDiscountToAddress, applyDiscountToCharge, cancelMembership, cancelSubscription, changeMembership, createAddress, createBundleSelection, createMetafield, createOnetime, createPaymentMethod, createSubscription, createSubscriptions, deleteAddress, deleteBundleSelection, deleteMetafield, deleteOnetime, getActiveChurnLandingPageURL, getAddress, getBundleId, getBundleSelection, getCDNBundleSettings, getCDNProduct, getCDNProductAndSettings, getCDNProducts, getCDNProductsAndSettings, getCDNStoreSettings, getCDNWidgetSettings, getCharge, getCreditSummary, getCustomer, getCustomerPortalAccess, getDeliverySchedule, getDynamicBundleItems, getGiftPurchase, getGiftRedemptionLandingPageURL, getMembership, getMembershipProgram, getOnetime, getOrder, getPaymentMethod, getPlan, getShippingCountries, getSubscription, initRecharge, type intervalUnit, listAddresses, listBundleSelections, listCharges, listGiftPurchases, listMembershipPrograms, listMemberships, listOnetimes, listOrders, listPaymentMethods, listPlans, listSubscriptions, loginCustomerPortal, loginShopifyApi, loginShopifyAppProxy, type membershipIncludes, mergeAddresses, processCharge, productSearch, removeDiscountsFromAddress, removeDiscountsFromCharge, resetCDNCache, sendCustomerNotification, sendPasswordlessCode, sendPasswordlessCodeAppProxy, skipCharge, skipFutureCharge, skipGiftSubscriptionCharge, skipSubscriptionCharge, unskipCharge, updateAddress, updateBundle, updateBundleSelection, updateCustomer, updateMetafield, updateOnetime, updatePaymentMethod, updateSubscription, updateSubscriptionAddress, updateSubscriptionChargeDate, updateSubscriptions, validateBundle, validateDynamicBundle, validatePasswordlessCode, validatePasswordlessCodeAppProxy };
2653
+ export { type ActivateMembershipRequest, type AddToCartCallbackSettings, type AddonSettings, type Address, type AddressIncludes, type AddressListParams, type AddressListResponse, type AddressResponse, type AddressSortBy, type AnalyticsData, type AssociatedAddress, type BasicSubscriptionParams, type BooleanLike, type BooleanNumbers, type BooleanString, type BooleanStringNumbers, type BundleAppProxy, type BundlePriceRule, type BundleProduct, type BundleProductLayoutSettings, type BundlePurchaseItem, type BundlePurchaseItemParams, type BundleSelection, type BundleSelectionAppProxy, type BundleSelectionItem, type BundleSelectionItemRequiredCreateProps, type BundleSelectionListParams, type BundleSelectionsResponse, type BundleSelectionsSortBy, type BundleTemplateSettings, type BundleTemplateType, type BundleTranslations, type BundleVariant, type BundleVariantOptionSource, type BundleVariantRange, type BundleVariantSelectionDefault, type CDNBaseWidgetSettings, type CDNBundleSettings, type CDNBundleVariant, type CDNBundleVariantOptionSource, type CDNPlan, type CDNProduct, type CDNProductAndSettings, type CDNProductKeyObject, type CDNProductQuery_2020_12, type CDNProductQuery_2022_06, type CDNProductRaw, type CDNProductResource, type CDNProductResponseType, type CDNProductType, type CDNProductVariant_2022_06, type CDNProduct_2022_06, type CDNProductsAndSettings, type CDNProductsAndSettingsResource, type CDNStoreSettings, type CDNSubscriptionOption, type CDNVariant, type CDNVersion, type CDNWidgetSettings, type CDNWidgetSettingsRaw, type CDNWidgetSettingsResource, type CRUDRequestOptions, type CancelMembershipRequest, type CancelSubscriptionRequest, type ChangeMembershipRequest, type ChannelSettings, type Charge, type ChargeIncludes, type ChargeListParams, type ChargeListResponse, type ChargeResponse, type ChargeSortBy, type ChargeStatus, type ColorString, type CreateAddressRequest, type CreateBundleSelectionRequest, type CreateMetafieldRequest, type CreateOnetimeRequest, type CreatePaymentMethodRequest, type CreateRecipientAddress, type CreateSubscriptionRequest, type CreditAccount, type CreditAccountType, type CreditSummaryIncludes, type CrossSellsSettings, type Customer, type CustomerCreditSummary, type CustomerDeliveryScheduleParams, type CustomerDeliveryScheduleResponse, type CustomerIncludes, type CustomerNotification, type CustomerNotificationOptions, type CustomerNotificationTemplate, type CustomerNotificationType, type CustomerPortalAccessResponse, type Delivery, type DeliveryLineItem, type DeliveryOrder, type DeliveryPaymentMethod, type Discount, type DiscountType, type DynamicBundleItemAppProxy, type DynamicBundlePropertiesAppProxy, type ExternalAttributeSchema, type ExternalId, type ExternalTransactionId, type FirstOption, type GetAddressOptions, type GetChargeOptions, type GetCreditSummaryOptions, type GetCustomerOptions, type GetMembershipProgramOptions, type GetPaymentMethodOptions, type GetRequestOptions, type GetSubscriptionOptions, type GiftPurchase, type GiftPurchasesParams, type GiftPurchasesResponse, type HTMLString, type InitOptions, type IntervalUnit, type IsoDateString, type LineItem, type ListParams, type LoginResponse, type Membership, type MembershipBenefit, type MembershipIncludes, type MembershipListParams, type MembershipListResponse, type MembershipProgram, type MembershipProgramIncludes, type MembershipProgramListParams, type MembershipProgramListResponse, type MembershipProgramResponse, type MembershipProgramSortBy, type MembershipProgramStatus, type MembershipResponse, type MembershipStatus, type MembershipsSortBy, type MergeAddressesRequest, type Metafield, type MetafieldOptionalCreateProps, type MetafieldOwnerResource, type MetafieldRequiredCreateProps, type Method, type Modifier, type MultiStepSettings, type OnePageSettings, type Onetime, type OnetimeListParams, type OnetimeOptionalCreateProps, type OnetimeRequiredCreateProps, type OnetimesResponse, type OnetimesSortBy, type Order, type OrderIncludes, type OrderListParams, type OrderSortBy, type OrderStatus, type OrderType, type OrdersResponse, type PasswordlessCodeResponse, type PasswordlessOptions, type PasswordlessValidateResponse, type PaymentDetails, type PaymentMethod, type PaymentMethodIncludes, type PaymentMethodListParams, type PaymentMethodOptionalCreateProps, type PaymentMethodRequiredCreateProps, type PaymentMethodSortBy, type PaymentMethodStatus, type PaymentMethodsResponse, type PaymentType, type Plan, type PlanListParams, type PlanSortBy, type PlanType, type PlansResponse, type ProcessorName, type ProductImage, type ProductInclude, type ProductOption, type ProductSearchParams_2020_12, type ProductSearchParams_2022_06, type ProductSearchResponse_2020_12, type ProductSearchResponse_2022_06, type ProductSearchType, type ProductSource, type ProductValueOption, type ProductVariant_2020_12, type ProductVariant_2022_06, type Product_2020_12, type Product_2022_06, type Property, type PublishStatus, type Request, type RequestHeaders, type RequestOptions, type SellingPlan, type SellingPlanGroup, type Session, type ShippingCountriesOptions, type ShippingCountriesResponse, type ShippingCountry, type ShippingLine, type ShippingProvince, type ShopifyUpdatePaymentInfoOptions, type SkipChargeParams, type SkipFutureChargeAddressRequest, type SkipFutureChargeAddressResponse, type SortBy, type SortField, type SortKeys, type StepSettings, type StepSettingsCommon, type StepSettingsTypes, type StorefrontEnvironment, type StorefrontOptions, type StorefrontPurchaseOption, type SubType, type Subscription, type SubscriptionIncludes, type SubscriptionListParams, type SubscriptionOption, type SubscriptionOptionalCreateProps, type SubscriptionPreferences, type SubscriptionRequiredCreateProps, type SubscriptionSortBy, type SubscriptionStatus, type Subscription_2021_01, type SubscriptionsResponse, type TaxLine, type Translations, type UpdateAddressRequest, type UpdateBundlePurchaseItem, type UpdateBundleSelectionRequest, type UpdateCustomerRequest, type UpdateMetafieldRequest, type UpdateOnetimeRequest, type UpdatePaymentMethodRequest, type UpdateSubscriptionParams, type UpdateSubscriptionRequest, type UpdateSubscriptionsParams, type UpdateSubscriptionsRequest, type VariantSelector, type VariantSelectorStepSetting, type WidgetIconColor, type WidgetTemplateType, type WidgetVisibility, activateMembership, activateSubscription, api, applyDiscountToAddress, applyDiscountToCharge, cancelMembership, cancelSubscription, changeMembership, createAddress, createBundleSelection, createMetafield, createOnetime, createPaymentMethod, createSubscription, createSubscriptions, deleteAddress, deleteBundleSelection, deleteMetafield, deleteOnetime, getActiveChurnLandingPageURL, getAddress, getBundleId, getBundleSelection, getCDNBundleSettings, getCDNProduct, getCDNProductAndSettings, getCDNProducts, getCDNProductsAndSettings, getCDNStoreSettings, getCDNWidgetSettings, getCharge, getCreditSummary, getCustomer, getCustomerPortalAccess, getDeliverySchedule, getDynamicBundleItems, getGiftPurchase, getGiftRedemptionLandingPageURL, getMembership, getMembershipProgram, getOnetime, getOrder, getPaymentMethod, getPlan, getShippingCountries, getSubscription, initRecharge, type intervalUnit, listAddresses, listBundleSelections, listCharges, listGiftPurchases, listMembershipPrograms, listMemberships, listOnetimes, listOrders, listPaymentMethods, listPlans, listSubscriptions, loginCustomerPortal, loginShopifyApi, loginShopifyAppProxy, loginWithShopifyCustomerAccount, loginWithShopifyStorefront, type membershipIncludes, mergeAddresses, processCharge, productSearch, removeDiscountsFromAddress, removeDiscountsFromCharge, resetCDNCache, sendCustomerNotification, sendPasswordlessCode, sendPasswordlessCodeAppProxy, skipCharge, skipFutureCharge, skipGiftSubscriptionCharge, skipSubscriptionCharge, unskipCharge, updateAddress, updateBundle, updateBundleSelection, updateCustomer, updateMetafield, updateOnetime, updatePaymentMethod, updateSubscription, updateSubscriptionAddress, updateSubscriptionChargeDate, updateSubscriptions, validateBundle, validateDynamicBundle, validatePasswordlessCode, validatePasswordlessCodeAppProxy };
@@ -1,22 +1,22 @@
1
- // recharge-client-1.16.3.min.js | MIT License | © Recharge Inc.
2
- (function(oe,$e){typeof exports=="object"&&typeof module<"u"?module.exports=$e():typeof define=="function"&&define.amd?define($e):(oe=typeof globalThis<"u"?globalThis:oe||self,oe.recharge=$e())})(this,function(){"use strict";var oe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Ro(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var a=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,a.get?a:{enumerable:!0,get:function(){return t[n]}})}),r}var J=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof J<"u"&&J,te={searchParams:"URLSearchParams"in J,iterable:"Symbol"in J&&"iterator"in Symbol,blob:"FileReader"in J&&"Blob"in J&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in J,arrayBuffer:"ArrayBuffer"in J};function Fo(t){return t&&DataView.prototype.isPrototypeOf(t)}if(te.arrayBuffer)var Po=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],$o=ArrayBuffer.isView||function(t){return t&&Po.indexOf(Object.prototype.toString.call(t))>-1};function ht(t){if(typeof t!="string"&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||t==="")throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function wr(t){return typeof t!="string"&&(t=String(t)),t}function vr(t){var e={next:function(){var r=t.shift();return{done:r===void 0,value:r}}};return te.iterable&&(e[Symbol.iterator]=function(){return e}),e}function q(t){this.map={},t instanceof q?t.forEach(function(e,r){this.append(r,e)},this):Array.isArray(t)?t.forEach(function(e){this.append(e[0],e[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}q.prototype.append=function(t,e){t=ht(t),e=wr(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},q.prototype.delete=function(t){delete this.map[ht(t)]},q.prototype.get=function(t){return t=ht(t),this.has(t)?this.map[t]:null},q.prototype.has=function(t){return this.map.hasOwnProperty(ht(t))},q.prototype.set=function(t,e){this.map[ht(t)]=wr(e)},q.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},q.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),vr(t)},q.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),vr(t)},q.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),vr(t)},te.iterable&&(q.prototype[Symbol.iterator]=q.prototype.entries);function _r(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function Sn(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function Uo(t){var e=new FileReader,r=Sn(e);return e.readAsArrayBuffer(t),r}function Co(t){var e=new FileReader,r=Sn(e);return e.readAsText(t),r}function Do(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}function In(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function Bn(){return this.bodyUsed=!1,this._initBody=function(t){this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?typeof t=="string"?this._bodyText=t:te.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:te.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:te.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():te.arrayBuffer&&te.blob&&Fo(t)?(this._bodyArrayBuffer=In(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):te.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||$o(t))?this._bodyArrayBuffer=In(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||(typeof t=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):te.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},te.blob&&(this.blob=function(){var t=_r(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var t=_r(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(Uo)}),this.text=function(){var t=_r(this);if(t)return t;if(this._bodyBlob)return Co(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(Do(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},te.formData&&(this.formData=function(){return this.text().then(Lo)}),this.json=function(){return this.text().then(JSON.parse)},this}var No=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function Mo(t){var e=t.toUpperCase();return No.indexOf(e)>-1?e:t}function Ue(t,e){if(!(this instanceof Ue))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e=e||{};var r=e.body;if(t instanceof Ue){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new q(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,!r&&t._bodyInit!=null&&(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",(e.headers||!this.headers)&&(this.headers=new q(e.headers)),this.method=Mo(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&r)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(r),(this.method==="GET"||this.method==="HEAD")&&(e.cache==="no-store"||e.cache==="no-cache")){var n=/([?&])_=[^&]*/;if(n.test(this.url))this.url=this.url.replace(n,"$1_="+new Date().getTime());else{var a=/\?/;this.url+=(a.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}Ue.prototype.clone=function(){return new Ue(this,{body:this._bodyInit})};function Lo(t){var e=new FormData;return t.trim().split("&").forEach(function(r){if(r){var n=r.split("="),a=n.shift().replace(/\+/g," "),s=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(a),decodeURIComponent(s))}}),e}function ko(t){var e=new q,r=t.replace(/\r?\n[\t ]+/g," ");return r.split("\r").map(function(n){return n.indexOf(`
3
- `)===0?n.substr(1,n.length):n}).forEach(function(n){var a=n.split(":"),s=a.shift().trim();if(s){var f=a.join(":").trim();e.append(s,f)}}),e}Bn.call(Ue.prototype);function pe(t,e){if(!(this instanceof pe))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 q(e.headers),this.url=e.url||"",this._initBody(t)}Bn.call(pe.prototype),pe.prototype.clone=function(){return new pe(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new q(this.headers),url:this.url})},pe.error=function(){var t=new pe(null,{status:0,statusText:""});return t.type="error",t};var jo=[301,302,303,307,308];pe.redirect=function(t,e){if(jo.indexOf(e)===-1)throw new RangeError("Invalid status code");return new pe(null,{status:e,headers:{location:t}})};var Ce=J.DOMException;try{new Ce}catch{Ce=function(e,r){this.message=e,this.name=r;var n=Error(e);this.stack=n.stack},Ce.prototype=Object.create(Error.prototype),Ce.prototype.constructor=Ce}function On(t,e){return new Promise(function(r,n){var a=new Ue(t,e);if(a.signal&&a.signal.aborted)return n(new Ce("Aborted","AbortError"));var s=new XMLHttpRequest;function f(){s.abort()}s.onload=function(){var h={status:s.status,statusText:s.statusText,headers:ko(s.getAllResponseHeaders()||"")};h.url="responseURL"in s?s.responseURL:h.headers.get("X-Request-URL");var m="response"in s?s.response:s.responseText;setTimeout(function(){r(new pe(m,h))},0)},s.onerror=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},s.ontimeout=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},s.onabort=function(){setTimeout(function(){n(new Ce("Aborted","AbortError"))},0)};function p(h){try{return h===""&&J.location.href?J.location.href:h}catch{return h}}s.open(a.method,p(a.url),!0),a.credentials==="include"?s.withCredentials=!0:a.credentials==="omit"&&(s.withCredentials=!1),"responseType"in s&&(te.blob?s.responseType="blob":te.arrayBuffer&&a.headers.get("Content-Type")&&a.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(s.responseType="arraybuffer")),e&&typeof e.headers=="object"&&!(e.headers instanceof q)?Object.getOwnPropertyNames(e.headers).forEach(function(h){s.setRequestHeader(h,wr(e.headers[h]))}):a.headers.forEach(function(h,m){s.setRequestHeader(m,h)}),a.signal&&(a.signal.addEventListener("abort",f),s.onreadystatechange=function(){s.readyState===4&&a.signal.removeEventListener("abort",f)}),s.send(typeof a._bodyInit>"u"?null:a._bodyInit)})}On.polyfill=!0,J.fetch||(J.fetch=On,J.Headers=q,J.Request=Ue,J.Response=pe),self.fetch.bind(self);var qo=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var a=42;e[r]=a;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var f=Object.getOwnPropertyDescriptor(e,r);if(f.value!==a||f.enumerable!==!0)return!1}return!0},Tn=typeof Symbol<"u"&&Symbol,Vo=qo,zo=function(){return typeof Tn!="function"||typeof Symbol!="function"||typeof Tn("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Vo()},Rn={foo:{}},Go=Object,Wo=function(){return{__proto__:Rn}.foo===Rn.foo&&!({__proto__:null}instanceof Go)},Ho="Function.prototype.bind called on incompatible ",br=Array.prototype.slice,Yo=Object.prototype.toString,Xo="[object Function]",Jo=function(e){var r=this;if(typeof r!="function"||Yo.call(r)!==Xo)throw new TypeError(Ho+r);for(var n=br.call(arguments,1),a,s=function(){if(this instanceof a){var v=r.apply(this,n.concat(br.call(arguments)));return Object(v)===v?v:this}else return r.apply(e,n.concat(br.call(arguments)))},f=Math.max(0,r.length-n.length),p=[],h=0;h<f;h++)p.push("$"+h);if(a=Function("binder","return function ("+p.join(",")+"){ return binder.apply(this,arguments); }")(s),r.prototype){var m=function(){};m.prototype=r.prototype,a.prototype=new m,m.prototype=null}return a},Ko=Jo,Er=Function.prototype.bind||Ko,Qo=Er,Zo=Qo.call(Function.call,Object.prototype.hasOwnProperty),C,Ye=SyntaxError,Fn=Function,Xe=TypeError,Ar=function(t){try{return Fn('"use strict"; return ('+t+").constructor;")()}catch{}},De=Object.getOwnPropertyDescriptor;if(De)try{De({},"")}catch{De=null}var xr=function(){throw new Xe},ea=De?function(){try{return arguments.callee,xr}catch{try{return De(arguments,"callee").get}catch{return xr}}}():xr,Je=zo(),ta=Wo(),W=Object.getPrototypeOf||(ta?function(t){return t.__proto__}:null),Ke={},ra=typeof Uint8Array>"u"||!W?C:W(Uint8Array),Ne={"%AggregateError%":typeof AggregateError>"u"?C:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?C:ArrayBuffer,"%ArrayIteratorPrototype%":Je&&W?W([][Symbol.iterator]()):C,"%AsyncFromSyncIteratorPrototype%":C,"%AsyncFunction%":Ke,"%AsyncGenerator%":Ke,"%AsyncGeneratorFunction%":Ke,"%AsyncIteratorPrototype%":Ke,"%Atomics%":typeof Atomics>"u"?C:Atomics,"%BigInt%":typeof BigInt>"u"?C:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?C:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?C:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?C:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?C:Float32Array,"%Float64Array%":typeof Float64Array>"u"?C:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?C:FinalizationRegistry,"%Function%":Fn,"%GeneratorFunction%":Ke,"%Int8Array%":typeof Int8Array>"u"?C:Int8Array,"%Int16Array%":typeof Int16Array>"u"?C:Int16Array,"%Int32Array%":typeof Int32Array>"u"?C:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Je&&W?W(W([][Symbol.iterator]())):C,"%JSON%":typeof JSON=="object"?JSON:C,"%Map%":typeof Map>"u"?C:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Je||!W?C:W(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?C:Promise,"%Proxy%":typeof Proxy>"u"?C:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?C:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?C:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Je||!W?C:W(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?C:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Je&&W?W(""[Symbol.iterator]()):C,"%Symbol%":Je?Symbol:C,"%SyntaxError%":Ye,"%ThrowTypeError%":ea,"%TypedArray%":ra,"%TypeError%":Xe,"%Uint8Array%":typeof Uint8Array>"u"?C:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?C:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?C:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?C:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?C:WeakMap,"%WeakRef%":typeof WeakRef>"u"?C:WeakRef,"%WeakSet%":typeof WeakSet>"u"?C:WeakSet};if(W)try{null.error}catch(t){var na=W(W(t));Ne["%Error.prototype%"]=na}var ia=function t(e){var r;if(e==="%AsyncFunction%")r=Ar("async function () {}");else if(e==="%GeneratorFunction%")r=Ar("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=Ar("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var a=t("%AsyncGenerator%");a&&W&&(r=W(a.prototype))}return Ne[e]=r,r},Pn={"%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"]},dt=Er,Dt=Zo,oa=dt.call(Function.call,Array.prototype.concat),aa=dt.call(Function.apply,Array.prototype.splice),$n=dt.call(Function.call,String.prototype.replace),Nt=dt.call(Function.call,String.prototype.slice),sa=dt.call(Function.call,RegExp.prototype.exec),ua=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,ca=/\\(\\)?/g,fa=function(e){var r=Nt(e,0,1),n=Nt(e,-1);if(r==="%"&&n!=="%")throw new Ye("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Ye("invalid intrinsic syntax, expected opening `%`");var a=[];return $n(e,ua,function(s,f,p,h){a[a.length]=p?$n(h,ca,"$1"):f||s}),a},la=function(e,r){var n=e,a;if(Dt(Pn,n)&&(a=Pn[n],n="%"+a[0]+"%"),Dt(Ne,n)){var s=Ne[n];if(s===Ke&&(s=ia(n)),typeof s>"u"&&!r)throw new Xe("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:a,name:n,value:s}}throw new Ye("intrinsic "+e+" does not exist!")},Sr=function(e,r){if(typeof e!="string"||e.length===0)throw new Xe("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Xe('"allowMissing" argument must be a boolean');if(sa(/^%?[^%]*%?$/,e)===null)throw new Ye("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=fa(e),a=n.length>0?n[0]:"",s=la("%"+a+"%",r),f=s.name,p=s.value,h=!1,m=s.alias;m&&(a=m[0],aa(n,oa([0,1],m)));for(var v=1,_=!0;v<n.length;v+=1){var b=n[v],y=Nt(b,0,1),x=Nt(b,-1);if((y==='"'||y==="'"||y==="`"||x==='"'||x==="'"||x==="`")&&y!==x)throw new Ye("property names with quotes must have matching quotes");if((b==="constructor"||!_)&&(h=!0),a+="."+b,f="%"+a+"%",Dt(Ne,f))p=Ne[f];else if(p!=null){if(!(b in p)){if(!r)throw new Xe("base intrinsic for "+e+" exists, but the property is not available.");return}if(De&&v+1>=n.length){var I=De(p,b);_=!!I,_&&"get"in I&&!("originalValue"in I.get)?p=I.get:p=p[b]}else _=Dt(p,b),p=p[b];_&&!h&&(Ne[f]=p)}}return p},Un={exports:{}};(function(t){var e=Er,r=Sr,n=r("%Function.prototype.apply%"),a=r("%Function.prototype.call%"),s=r("%Reflect.apply%",!0)||e.call(a,n),f=r("%Object.getOwnPropertyDescriptor%",!0),p=r("%Object.defineProperty%",!0),h=r("%Math.max%");if(p)try{p({},"a",{value:1})}catch{p=null}t.exports=function(_){var b=s(e,a,arguments);if(f&&p){var y=f(b,"length");y.configurable&&p(b,"length",{value:1+h(0,_.length-(arguments.length-1))})}return b};var m=function(){return s(e,n,arguments)};p?p(t.exports,"apply",{value:m}):t.exports.apply=m})(Un);var pa=Un.exports,Cn=Sr,Dn=pa,ha=Dn(Cn("String.prototype.indexOf")),da=function(e,r){var n=Cn(e,!!r);return typeof n=="function"&&ha(e,".prototype.")>-1?Dn(n):n},Qe=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},he=[],ae=[],ya=typeof Uint8Array<"u"?Uint8Array:Array,Ir=!1;function Nn(){Ir=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,r=t.length;e<r;++e)he[e]=t[e],ae[t.charCodeAt(e)]=e;ae["-".charCodeAt(0)]=62,ae["_".charCodeAt(0)]=63}function ga(t){Ir||Nn();var e,r,n,a,s,f,p=t.length;if(p%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s=t[p-2]==="="?2:t[p-1]==="="?1:0,f=new ya(p*3/4-s),n=s>0?p-4:p;var h=0;for(e=0,r=0;e<n;e+=4,r+=3)a=ae[t.charCodeAt(e)]<<18|ae[t.charCodeAt(e+1)]<<12|ae[t.charCodeAt(e+2)]<<6|ae[t.charCodeAt(e+3)],f[h++]=a>>16&255,f[h++]=a>>8&255,f[h++]=a&255;return s===2?(a=ae[t.charCodeAt(e)]<<2|ae[t.charCodeAt(e+1)]>>4,f[h++]=a&255):s===1&&(a=ae[t.charCodeAt(e)]<<10|ae[t.charCodeAt(e+1)]<<4|ae[t.charCodeAt(e+2)]>>2,f[h++]=a>>8&255,f[h++]=a&255),f}function ma(t){return he[t>>18&63]+he[t>>12&63]+he[t>>6&63]+he[t&63]}function wa(t,e,r){for(var n,a=[],s=e;s<r;s+=3)n=(t[s]<<16)+(t[s+1]<<8)+t[s+2],a.push(ma(n));return a.join("")}function Mn(t){Ir||Nn();for(var e,r=t.length,n=r%3,a="",s=[],f=16383,p=0,h=r-n;p<h;p+=f)s.push(wa(t,p,p+f>h?h:p+f));return n===1?(e=t[r-1],a+=he[e>>2],a+=he[e<<4&63],a+="=="):n===2&&(e=(t[r-2]<<8)+t[r-1],a+=he[e>>10],a+=he[e>>4&63],a+=he[e<<2&63],a+="="),s.push(a),s.join("")}function Mt(t,e,r,n,a){var s,f,p=a*8-n-1,h=(1<<p)-1,m=h>>1,v=-7,_=r?a-1:0,b=r?-1:1,y=t[e+_];for(_+=b,s=y&(1<<-v)-1,y>>=-v,v+=p;v>0;s=s*256+t[e+_],_+=b,v-=8);for(f=s&(1<<-v)-1,s>>=-v,v+=n;v>0;f=f*256+t[e+_],_+=b,v-=8);if(s===0)s=1-m;else{if(s===h)return f?NaN:(y?-1:1)*(1/0);f=f+Math.pow(2,n),s=s-m}return(y?-1:1)*f*Math.pow(2,s-n)}function Ln(t,e,r,n,a,s){var f,p,h,m=s*8-a-1,v=(1<<m)-1,_=v>>1,b=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:s-1,x=n?1:-1,I=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(p=isNaN(e)?1:0,f=v):(f=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-f))<1&&(f--,h*=2),f+_>=1?e+=b/h:e+=b*Math.pow(2,1-_),e*h>=2&&(f++,h/=2),f+_>=v?(p=0,f=v):f+_>=1?(p=(e*h-1)*Math.pow(2,a),f=f+_):(p=e*Math.pow(2,_-1)*Math.pow(2,a),f=0));a>=8;t[r+y]=p&255,y+=x,p/=256,a-=8);for(f=f<<a|p,m+=a;m>0;t[r+y]=f&255,y+=x,f/=256,m-=8);t[r+y-x]|=I*128}var va={}.toString,kn=Array.isArray||function(t){return va.call(t)=="[object Array]"};/*!
1
+ // recharge-client-1.17.1.min.js | MIT License | © Recharge Inc.
2
+ (function(oe,$e){typeof exports=="object"&&typeof module<"u"?module.exports=$e():typeof define=="function"&&define.amd?define($e):(oe=typeof globalThis<"u"?globalThis:oe||self,oe.recharge=$e())})(this,function(){"use strict";var oe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Fo(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var a=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,a.get?a:{enumerable:!0,get:function(){return t[n]}})}),r}var J=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof J<"u"&&J,te={searchParams:"URLSearchParams"in J,iterable:"Symbol"in J&&"iterator"in Symbol,blob:"FileReader"in J&&"Blob"in J&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in J,arrayBuffer:"ArrayBuffer"in J};function Po(t){return t&&DataView.prototype.isPrototypeOf(t)}if(te.arrayBuffer)var $o=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],Uo=ArrayBuffer.isView||function(t){return t&&$o.indexOf(Object.prototype.toString.call(t))>-1};function ht(t){if(typeof t!="string"&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||t==="")throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function wr(t){return typeof t!="string"&&(t=String(t)),t}function vr(t){var e={next:function(){var r=t.shift();return{done:r===void 0,value:r}}};return te.iterable&&(e[Symbol.iterator]=function(){return e}),e}function q(t){this.map={},t instanceof q?t.forEach(function(e,r){this.append(r,e)},this):Array.isArray(t)?t.forEach(function(e){this.append(e[0],e[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}q.prototype.append=function(t,e){t=ht(t),e=wr(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},q.prototype.delete=function(t){delete this.map[ht(t)]},q.prototype.get=function(t){return t=ht(t),this.has(t)?this.map[t]:null},q.prototype.has=function(t){return this.map.hasOwnProperty(ht(t))},q.prototype.set=function(t,e){this.map[ht(t)]=wr(e)},q.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},q.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),vr(t)},q.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),vr(t)},q.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),vr(t)},te.iterable&&(q.prototype[Symbol.iterator]=q.prototype.entries);function _r(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function Sn(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function Co(t){var e=new FileReader,r=Sn(e);return e.readAsArrayBuffer(t),r}function Do(t){var e=new FileReader,r=Sn(e);return e.readAsText(t),r}function No(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}function In(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function Bn(){return this.bodyUsed=!1,this._initBody=function(t){this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?typeof t=="string"?this._bodyText=t:te.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:te.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:te.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():te.arrayBuffer&&te.blob&&Po(t)?(this._bodyArrayBuffer=In(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):te.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||Uo(t))?this._bodyArrayBuffer=In(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||(typeof t=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):te.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},te.blob&&(this.blob=function(){var t=_r(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var t=_r(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(Co)}),this.text=function(){var t=_r(this);if(t)return t;if(this._bodyBlob)return Do(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(No(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},te.formData&&(this.formData=function(){return this.text().then(ko)}),this.json=function(){return this.text().then(JSON.parse)},this}var Mo=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function Lo(t){var e=t.toUpperCase();return Mo.indexOf(e)>-1?e:t}function Ue(t,e){if(!(this instanceof Ue))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e=e||{};var r=e.body;if(t instanceof Ue){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new q(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,!r&&t._bodyInit!=null&&(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",(e.headers||!this.headers)&&(this.headers=new q(e.headers)),this.method=Lo(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&r)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(r),(this.method==="GET"||this.method==="HEAD")&&(e.cache==="no-store"||e.cache==="no-cache")){var n=/([?&])_=[^&]*/;if(n.test(this.url))this.url=this.url.replace(n,"$1_="+new Date().getTime());else{var a=/\?/;this.url+=(a.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}Ue.prototype.clone=function(){return new Ue(this,{body:this._bodyInit})};function ko(t){var e=new FormData;return t.trim().split("&").forEach(function(r){if(r){var n=r.split("="),a=n.shift().replace(/\+/g," "),s=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(a),decodeURIComponent(s))}}),e}function jo(t){var e=new q,r=t.replace(/\r?\n[\t ]+/g," ");return r.split("\r").map(function(n){return n.indexOf(`
3
+ `)===0?n.substr(1,n.length):n}).forEach(function(n){var a=n.split(":"),s=a.shift().trim();if(s){var f=a.join(":").trim();e.append(s,f)}}),e}Bn.call(Ue.prototype);function he(t,e){if(!(this instanceof he))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 q(e.headers),this.url=e.url||"",this._initBody(t)}Bn.call(he.prototype),he.prototype.clone=function(){return new he(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new q(this.headers),url:this.url})},he.error=function(){var t=new he(null,{status:0,statusText:""});return t.type="error",t};var qo=[301,302,303,307,308];he.redirect=function(t,e){if(qo.indexOf(e)===-1)throw new RangeError("Invalid status code");return new he(null,{status:e,headers:{location:t}})};var Ce=J.DOMException;try{new Ce}catch{Ce=function(e,r){this.message=e,this.name=r;var n=Error(e);this.stack=n.stack},Ce.prototype=Object.create(Error.prototype),Ce.prototype.constructor=Ce}function On(t,e){return new Promise(function(r,n){var a=new Ue(t,e);if(a.signal&&a.signal.aborted)return n(new Ce("Aborted","AbortError"));var s=new XMLHttpRequest;function f(){s.abort()}s.onload=function(){var h={status:s.status,statusText:s.statusText,headers:jo(s.getAllResponseHeaders()||"")};h.url="responseURL"in s?s.responseURL:h.headers.get("X-Request-URL");var m="response"in s?s.response:s.responseText;setTimeout(function(){r(new he(m,h))},0)},s.onerror=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},s.ontimeout=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},s.onabort=function(){setTimeout(function(){n(new Ce("Aborted","AbortError"))},0)};function p(h){try{return h===""&&J.location.href?J.location.href:h}catch{return h}}s.open(a.method,p(a.url),!0),a.credentials==="include"?s.withCredentials=!0:a.credentials==="omit"&&(s.withCredentials=!1),"responseType"in s&&(te.blob?s.responseType="blob":te.arrayBuffer&&a.headers.get("Content-Type")&&a.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(s.responseType="arraybuffer")),e&&typeof e.headers=="object"&&!(e.headers instanceof q)?Object.getOwnPropertyNames(e.headers).forEach(function(h){s.setRequestHeader(h,wr(e.headers[h]))}):a.headers.forEach(function(h,m){s.setRequestHeader(m,h)}),a.signal&&(a.signal.addEventListener("abort",f),s.onreadystatechange=function(){s.readyState===4&&a.signal.removeEventListener("abort",f)}),s.send(typeof a._bodyInit>"u"?null:a._bodyInit)})}On.polyfill=!0,J.fetch||(J.fetch=On,J.Headers=q,J.Request=Ue,J.Response=he),self.fetch.bind(self);var Vo=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var a=42;e[r]=a;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var f=Object.getOwnPropertyDescriptor(e,r);if(f.value!==a||f.enumerable!==!0)return!1}return!0},Tn=typeof Symbol<"u"&&Symbol,zo=Vo,Go=function(){return typeof Tn!="function"||typeof Symbol!="function"||typeof Tn("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:zo()},Rn={foo:{}},Wo=Object,Ho=function(){return{__proto__:Rn}.foo===Rn.foo&&!({__proto__:null}instanceof Wo)},Yo="Function.prototype.bind called on incompatible ",br=Array.prototype.slice,Xo=Object.prototype.toString,Jo="[object Function]",Ko=function(e){var r=this;if(typeof r!="function"||Xo.call(r)!==Jo)throw new TypeError(Yo+r);for(var n=br.call(arguments,1),a,s=function(){if(this instanceof a){var v=r.apply(this,n.concat(br.call(arguments)));return Object(v)===v?v:this}else return r.apply(e,n.concat(br.call(arguments)))},f=Math.max(0,r.length-n.length),p=[],h=0;h<f;h++)p.push("$"+h);if(a=Function("binder","return function ("+p.join(",")+"){ return binder.apply(this,arguments); }")(s),r.prototype){var m=function(){};m.prototype=r.prototype,a.prototype=new m,m.prototype=null}return a},Qo=Ko,Er=Function.prototype.bind||Qo,Zo=Er,ea=Zo.call(Function.call,Object.prototype.hasOwnProperty),C,Ye=SyntaxError,Fn=Function,Xe=TypeError,Ar=function(t){try{return Fn('"use strict"; return ('+t+").constructor;")()}catch{}},De=Object.getOwnPropertyDescriptor;if(De)try{De({},"")}catch{De=null}var xr=function(){throw new Xe},ta=De?function(){try{return arguments.callee,xr}catch{try{return De(arguments,"callee").get}catch{return xr}}}():xr,Je=Go(),ra=Ho(),W=Object.getPrototypeOf||(ra?function(t){return t.__proto__}:null),Ke={},na=typeof Uint8Array>"u"||!W?C:W(Uint8Array),Ne={"%AggregateError%":typeof AggregateError>"u"?C:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?C:ArrayBuffer,"%ArrayIteratorPrototype%":Je&&W?W([][Symbol.iterator]()):C,"%AsyncFromSyncIteratorPrototype%":C,"%AsyncFunction%":Ke,"%AsyncGenerator%":Ke,"%AsyncGeneratorFunction%":Ke,"%AsyncIteratorPrototype%":Ke,"%Atomics%":typeof Atomics>"u"?C:Atomics,"%BigInt%":typeof BigInt>"u"?C:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?C:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?C:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?C:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?C:Float32Array,"%Float64Array%":typeof Float64Array>"u"?C:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?C:FinalizationRegistry,"%Function%":Fn,"%GeneratorFunction%":Ke,"%Int8Array%":typeof Int8Array>"u"?C:Int8Array,"%Int16Array%":typeof Int16Array>"u"?C:Int16Array,"%Int32Array%":typeof Int32Array>"u"?C:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Je&&W?W(W([][Symbol.iterator]())):C,"%JSON%":typeof JSON=="object"?JSON:C,"%Map%":typeof Map>"u"?C:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Je||!W?C:W(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?C:Promise,"%Proxy%":typeof Proxy>"u"?C:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?C:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?C:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Je||!W?C:W(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?C:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Je&&W?W(""[Symbol.iterator]()):C,"%Symbol%":Je?Symbol:C,"%SyntaxError%":Ye,"%ThrowTypeError%":ta,"%TypedArray%":na,"%TypeError%":Xe,"%Uint8Array%":typeof Uint8Array>"u"?C:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?C:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?C:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?C:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?C:WeakMap,"%WeakRef%":typeof WeakRef>"u"?C:WeakRef,"%WeakSet%":typeof WeakSet>"u"?C:WeakSet};if(W)try{null.error}catch(t){var ia=W(W(t));Ne["%Error.prototype%"]=ia}var oa=function t(e){var r;if(e==="%AsyncFunction%")r=Ar("async function () {}");else if(e==="%GeneratorFunction%")r=Ar("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=Ar("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var a=t("%AsyncGenerator%");a&&W&&(r=W(a.prototype))}return Ne[e]=r,r},Pn={"%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"]},dt=Er,Nt=ea,aa=dt.call(Function.call,Array.prototype.concat),sa=dt.call(Function.apply,Array.prototype.splice),$n=dt.call(Function.call,String.prototype.replace),Mt=dt.call(Function.call,String.prototype.slice),ua=dt.call(Function.call,RegExp.prototype.exec),ca=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,fa=/\\(\\)?/g,la=function(e){var r=Mt(e,0,1),n=Mt(e,-1);if(r==="%"&&n!=="%")throw new Ye("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Ye("invalid intrinsic syntax, expected opening `%`");var a=[];return $n(e,ca,function(s,f,p,h){a[a.length]=p?$n(h,fa,"$1"):f||s}),a},pa=function(e,r){var n=e,a;if(Nt(Pn,n)&&(a=Pn[n],n="%"+a[0]+"%"),Nt(Ne,n)){var s=Ne[n];if(s===Ke&&(s=oa(n)),typeof s>"u"&&!r)throw new Xe("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:a,name:n,value:s}}throw new Ye("intrinsic "+e+" does not exist!")},Sr=function(e,r){if(typeof e!="string"||e.length===0)throw new Xe("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Xe('"allowMissing" argument must be a boolean');if(ua(/^%?[^%]*%?$/,e)===null)throw new Ye("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=la(e),a=n.length>0?n[0]:"",s=pa("%"+a+"%",r),f=s.name,p=s.value,h=!1,m=s.alias;m&&(a=m[0],sa(n,aa([0,1],m)));for(var v=1,_=!0;v<n.length;v+=1){var b=n[v],y=Mt(b,0,1),x=Mt(b,-1);if((y==='"'||y==="'"||y==="`"||x==='"'||x==="'"||x==="`")&&y!==x)throw new Ye("property names with quotes must have matching quotes");if((b==="constructor"||!_)&&(h=!0),a+="."+b,f="%"+a+"%",Nt(Ne,f))p=Ne[f];else if(p!=null){if(!(b in p)){if(!r)throw new Xe("base intrinsic for "+e+" exists, but the property is not available.");return}if(De&&v+1>=n.length){var I=De(p,b);_=!!I,_&&"get"in I&&!("originalValue"in I.get)?p=I.get:p=p[b]}else _=Nt(p,b),p=p[b];_&&!h&&(Ne[f]=p)}}return p},Un={exports:{}};(function(t){var e=Er,r=Sr,n=r("%Function.prototype.apply%"),a=r("%Function.prototype.call%"),s=r("%Reflect.apply%",!0)||e.call(a,n),f=r("%Object.getOwnPropertyDescriptor%",!0),p=r("%Object.defineProperty%",!0),h=r("%Math.max%");if(p)try{p({},"a",{value:1})}catch{p=null}t.exports=function(_){var b=s(e,a,arguments);if(f&&p){var y=f(b,"length");y.configurable&&p(b,"length",{value:1+h(0,_.length-(arguments.length-1))})}return b};var m=function(){return s(e,n,arguments)};p?p(t.exports,"apply",{value:m}):t.exports.apply=m})(Un);var ha=Un.exports,Cn=Sr,Dn=ha,da=Dn(Cn("String.prototype.indexOf")),ya=function(e,r){var n=Cn(e,!!r);return typeof n=="function"&&da(e,".prototype.")>-1?Dn(n):n},Qe=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},de=[],se=[],ga=typeof Uint8Array<"u"?Uint8Array:Array,Ir=!1;function Nn(){Ir=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,r=t.length;e<r;++e)de[e]=t[e],se[t.charCodeAt(e)]=e;se["-".charCodeAt(0)]=62,se["_".charCodeAt(0)]=63}function ma(t){Ir||Nn();var e,r,n,a,s,f,p=t.length;if(p%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s=t[p-2]==="="?2:t[p-1]==="="?1:0,f=new ga(p*3/4-s),n=s>0?p-4:p;var h=0;for(e=0,r=0;e<n;e+=4,r+=3)a=se[t.charCodeAt(e)]<<18|se[t.charCodeAt(e+1)]<<12|se[t.charCodeAt(e+2)]<<6|se[t.charCodeAt(e+3)],f[h++]=a>>16&255,f[h++]=a>>8&255,f[h++]=a&255;return s===2?(a=se[t.charCodeAt(e)]<<2|se[t.charCodeAt(e+1)]>>4,f[h++]=a&255):s===1&&(a=se[t.charCodeAt(e)]<<10|se[t.charCodeAt(e+1)]<<4|se[t.charCodeAt(e+2)]>>2,f[h++]=a>>8&255,f[h++]=a&255),f}function wa(t){return de[t>>18&63]+de[t>>12&63]+de[t>>6&63]+de[t&63]}function va(t,e,r){for(var n,a=[],s=e;s<r;s+=3)n=(t[s]<<16)+(t[s+1]<<8)+t[s+2],a.push(wa(n));return a.join("")}function Mn(t){Ir||Nn();for(var e,r=t.length,n=r%3,a="",s=[],f=16383,p=0,h=r-n;p<h;p+=f)s.push(va(t,p,p+f>h?h:p+f));return n===1?(e=t[r-1],a+=de[e>>2],a+=de[e<<4&63],a+="=="):n===2&&(e=(t[r-2]<<8)+t[r-1],a+=de[e>>10],a+=de[e>>4&63],a+=de[e<<2&63],a+="="),s.push(a),s.join("")}function Lt(t,e,r,n,a){var s,f,p=a*8-n-1,h=(1<<p)-1,m=h>>1,v=-7,_=r?a-1:0,b=r?-1:1,y=t[e+_];for(_+=b,s=y&(1<<-v)-1,y>>=-v,v+=p;v>0;s=s*256+t[e+_],_+=b,v-=8);for(f=s&(1<<-v)-1,s>>=-v,v+=n;v>0;f=f*256+t[e+_],_+=b,v-=8);if(s===0)s=1-m;else{if(s===h)return f?NaN:(y?-1:1)*(1/0);f=f+Math.pow(2,n),s=s-m}return(y?-1:1)*f*Math.pow(2,s-n)}function Ln(t,e,r,n,a,s){var f,p,h,m=s*8-a-1,v=(1<<m)-1,_=v>>1,b=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:s-1,x=n?1:-1,I=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(p=isNaN(e)?1:0,f=v):(f=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-f))<1&&(f--,h*=2),f+_>=1?e+=b/h:e+=b*Math.pow(2,1-_),e*h>=2&&(f++,h/=2),f+_>=v?(p=0,f=v):f+_>=1?(p=(e*h-1)*Math.pow(2,a),f=f+_):(p=e*Math.pow(2,_-1)*Math.pow(2,a),f=0));a>=8;t[r+y]=p&255,y+=x,p/=256,a-=8);for(f=f<<a|p,m+=a;m>0;t[r+y]=f&255,y+=x,f/=256,m-=8);t[r+y-x]|=I*128}var _a={}.toString,kn=Array.isArray||function(t){return _a.call(t)=="[object Array]"};/*!
4
4
  * The buffer module from node.js, for the browser.
5
5
  *
6
6
  * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
7
7
  * @license MIT
8
- */var _a=50;E.TYPED_ARRAY_SUPPORT=Qe.TYPED_ARRAY_SUPPORT!==void 0?Qe.TYPED_ARRAY_SUPPORT:!0,Lt();function Lt(){return E.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function be(t,e){if(Lt()<e)throw new RangeError("Invalid typed array length");return E.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=E.prototype):(t===null&&(t=new E(e)),t.length=e),t}function E(t,e,r){if(!E.TYPED_ARRAY_SUPPORT&&!(this instanceof E))return new E(t,e,r);if(typeof t=="number"){if(typeof e=="string")throw new Error("If encoding is specified then the first argument must be a string");return Br(this,t)}return jn(this,t,e,r)}E.poolSize=8192,E._augment=function(t){return t.__proto__=E.prototype,t};function jn(t,e,r,n){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?Aa(t,e,r,n):typeof e=="string"?Ea(t,e,r):xa(t,e)}E.from=function(t,e,r){return jn(null,t,e,r)},E.TYPED_ARRAY_SUPPORT&&(E.prototype.__proto__=Uint8Array.prototype,E.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&E[Symbol.species]);function qn(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function ba(t,e,r,n){return qn(e),e<=0?be(t,e):r!==void 0?typeof n=="string"?be(t,e).fill(r,n):be(t,e).fill(r):be(t,e)}E.alloc=function(t,e,r){return ba(null,t,e,r)};function Br(t,e){if(qn(e),t=be(t,e<0?0:Tr(e)|0),!E.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}E.allocUnsafe=function(t){return Br(null,t)},E.allocUnsafeSlow=function(t){return Br(null,t)};function Ea(t,e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!E.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=Vn(e,r)|0;t=be(t,n);var a=t.write(e,r);return a!==n&&(t=t.slice(0,a)),t}function Or(t,e){var r=e.length<0?0:Tr(e.length)|0;t=be(t,r);for(var n=0;n<r;n+=1)t[n]=e[n]&255;return t}function Aa(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return r===void 0&&n===void 0?e=new Uint8Array(e):n===void 0?e=new Uint8Array(e,r):e=new Uint8Array(e,r,n),E.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=E.prototype):t=Or(t,e),t}function xa(t,e){if(de(e)){var r=Tr(e.length)|0;return t=be(t,r),t.length===0||e.copy(t,0,0,r),t}if(e){if(typeof ArrayBuffer<"u"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||Va(e.length)?be(t,0):Or(t,e);if(e.type==="Buffer"&&kn(e.data))return Or(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Tr(t){if(t>=Lt())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Lt().toString(16)+" bytes");return t|0}E.isBuffer=za;function de(t){return!!(t!=null&&t._isBuffer)}E.compare=function(e,r){if(!de(e)||!de(r))throw new TypeError("Arguments must be Buffers");if(e===r)return 0;for(var n=e.length,a=r.length,s=0,f=Math.min(n,a);s<f;++s)if(e[s]!==r[s]){n=e[s],a=r[s];break}return n<a?-1:a<n?1:0},E.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},E.concat=function(e,r){if(!kn(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return E.alloc(0);var n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;var a=E.allocUnsafe(r),s=0;for(n=0;n<e.length;++n){var f=e[n];if(!de(f))throw new TypeError('"list" argument must be an Array of Buffers');f.copy(a,s),s+=f.length}return a};function Vn(t,e){if(de(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var r=t.length;if(r===0)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return qt(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Qn(t).length;default:if(n)return qt(t).length;e=(""+e).toLowerCase(),n=!0}}E.byteLength=Vn;function Sa(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return Ca(this,e,r);case"utf8":case"utf-8":return Hn(this,e,r);case"ascii":return $a(this,e,r);case"latin1":case"binary":return Ua(this,e,r);case"base64":return Fa(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Da(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}E.prototype._isBuffer=!0;function Me(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}E.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<e;r+=2)Me(this,r,r+1);return this},E.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<e;r+=4)Me(this,r,r+3),Me(this,r+1,r+2);return this},E.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<e;r+=8)Me(this,r,r+7),Me(this,r+1,r+6),Me(this,r+2,r+5),Me(this,r+3,r+4);return this},E.prototype.toString=function(){var e=this.length|0;return e===0?"":arguments.length===0?Hn(this,0,e):Sa.apply(this,arguments)},E.prototype.equals=function(e){if(!de(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:E.compare(this,e)===0},E.prototype.inspect=function(){var e="",r=_a;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},E.prototype.compare=function(e,r,n,a,s){if(!de(e))throw new TypeError("Argument must be a Buffer");if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),a===void 0&&(a=0),s===void 0&&(s=this.length),r<0||n>e.length||a<0||s>this.length)throw new RangeError("out of range index");if(a>=s&&r>=n)return 0;if(a>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,a>>>=0,s>>>=0,this===e)return 0;for(var f=s-a,p=n-r,h=Math.min(f,p),m=this.slice(a,s),v=e.slice(r,n),_=0;_<h;++_)if(m[_]!==v[_]){f=m[_],p=v[_];break}return f<p?-1:p<f?1:0};function zn(t,e,r,n,a){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=a?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(a)return-1;r=t.length-1}else if(r<0)if(a)r=0;else return-1;if(typeof e=="string"&&(e=E.from(e,n)),de(e))return e.length===0?-1:Gn(t,e,r,n,a);if(typeof e=="number")return e=e&255,E.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?a?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Gn(t,[e],r,n,a);throw new TypeError("val must be string, number or Buffer")}function Gn(t,e,r,n,a){var s=1,f=t.length,p=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,f/=2,p/=2,r/=2}function h(y,x){return s===1?y[x]:y.readUInt16BE(x*s)}var m;if(a){var v=-1;for(m=r;m<f;m++)if(h(t,m)===h(e,v===-1?0:m-v)){if(v===-1&&(v=m),m-v+1===p)return v*s}else v!==-1&&(m-=m-v),v=-1}else for(r+p>f&&(r=f-p),m=r;m>=0;m--){for(var _=!0,b=0;b<p;b++)if(h(t,m+b)!==h(e,b)){_=!1;break}if(_)return m}return-1}E.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1},E.prototype.indexOf=function(e,r,n){return zn(this,e,r,n,!0)},E.prototype.lastIndexOf=function(e,r,n){return zn(this,e,r,n,!1)};function Ia(t,e,r,n){r=Number(r)||0;var a=t.length-r;n?(n=Number(n),n>a&&(n=a)):n=a;var s=e.length;if(s%2!==0)throw new TypeError("Invalid hex string");n>s/2&&(n=s/2);for(var f=0;f<n;++f){var p=parseInt(e.substr(f*2,2),16);if(isNaN(p))return f;t[r+f]=p}return f}function Ba(t,e,r,n){return Vt(qt(e,t.length-r),t,r,n)}function Wn(t,e,r,n){return Vt(ja(e),t,r,n)}function Oa(t,e,r,n){return Wn(t,e,r,n)}function Ta(t,e,r,n){return Vt(Qn(e),t,r,n)}function Ra(t,e,r,n){return Vt(qa(e,t.length-r),t,r,n)}E.prototype.write=function(e,r,n,a){if(r===void 0)a="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")a=r,n=this.length,r=0;else if(isFinite(r))r=r|0,isFinite(n)?(n=n|0,a===void 0&&(a="utf8")):(a=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var f=!1;;)switch(a){case"hex":return Ia(this,e,r,n);case"utf8":case"utf-8":return Ba(this,e,r,n);case"ascii":return Wn(this,e,r,n);case"latin1":case"binary":return Oa(this,e,r,n);case"base64":return Ta(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ra(this,e,r,n);default:if(f)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),f=!0}},E.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Fa(t,e,r){return e===0&&r===t.length?Mn(t):Mn(t.slice(e,r))}function Hn(t,e,r){r=Math.min(t.length,r);for(var n=[],a=e;a<r;){var s=t[a],f=null,p=s>239?4:s>223?3:s>191?2:1;if(a+p<=r){var h,m,v,_;switch(p){case 1:s<128&&(f=s);break;case 2:h=t[a+1],(h&192)===128&&(_=(s&31)<<6|h&63,_>127&&(f=_));break;case 3:h=t[a+1],m=t[a+2],(h&192)===128&&(m&192)===128&&(_=(s&15)<<12|(h&63)<<6|m&63,_>2047&&(_<55296||_>57343)&&(f=_));break;case 4:h=t[a+1],m=t[a+2],v=t[a+3],(h&192)===128&&(m&192)===128&&(v&192)===128&&(_=(s&15)<<18|(h&63)<<12|(m&63)<<6|v&63,_>65535&&_<1114112&&(f=_))}}f===null?(f=65533,p=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|f&1023),n.push(f),a+=p}return Pa(n)}var Yn=4096;function Pa(t){var e=t.length;if(e<=Yn)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Yn));return r}function $a(t,e,r){var n="";r=Math.min(t.length,r);for(var a=e;a<r;++a)n+=String.fromCharCode(t[a]&127);return n}function Ua(t,e,r){var n="";r=Math.min(t.length,r);for(var a=e;a<r;++a)n+=String.fromCharCode(t[a]);return n}function Ca(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var a="",s=e;s<r;++s)a+=ka(t[s]);return a}function Da(t,e,r){for(var n=t.slice(e,r),a="",s=0;s<n.length;s+=2)a+=String.fromCharCode(n[s]+n[s+1]*256);return a}E.prototype.slice=function(e,r){var n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);var a;if(E.TYPED_ARRAY_SUPPORT)a=this.subarray(e,r),a.__proto__=E.prototype;else{var s=r-e;a=new E(s,void 0);for(var f=0;f<s;++f)a[f]=this[f+e]}return a};function H(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}E.prototype.readUIntLE=function(e,r,n){e=e|0,r=r|0,n||H(e,r,this.length);for(var a=this[e],s=1,f=0;++f<r&&(s*=256);)a+=this[e+f]*s;return a},E.prototype.readUIntBE=function(e,r,n){e=e|0,r=r|0,n||H(e,r,this.length);for(var a=this[e+--r],s=1;r>0&&(s*=256);)a+=this[e+--r]*s;return a},E.prototype.readUInt8=function(e,r){return r||H(e,1,this.length),this[e]},E.prototype.readUInt16LE=function(e,r){return r||H(e,2,this.length),this[e]|this[e+1]<<8},E.prototype.readUInt16BE=function(e,r){return r||H(e,2,this.length),this[e]<<8|this[e+1]},E.prototype.readUInt32LE=function(e,r){return r||H(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},E.prototype.readUInt32BE=function(e,r){return r||H(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},E.prototype.readIntLE=function(e,r,n){e=e|0,r=r|0,n||H(e,r,this.length);for(var a=this[e],s=1,f=0;++f<r&&(s*=256);)a+=this[e+f]*s;return s*=128,a>=s&&(a-=Math.pow(2,8*r)),a},E.prototype.readIntBE=function(e,r,n){e=e|0,r=r|0,n||H(e,r,this.length);for(var a=r,s=1,f=this[e+--a];a>0&&(s*=256);)f+=this[e+--a]*s;return s*=128,f>=s&&(f-=Math.pow(2,8*r)),f},E.prototype.readInt8=function(e,r){return r||H(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},E.prototype.readInt16LE=function(e,r){r||H(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},E.prototype.readInt16BE=function(e,r){r||H(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},E.prototype.readInt32LE=function(e,r){return r||H(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},E.prototype.readInt32BE=function(e,r){return r||H(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},E.prototype.readFloatLE=function(e,r){return r||H(e,4,this.length),Mt(this,e,!0,23,4)},E.prototype.readFloatBE=function(e,r){return r||H(e,4,this.length),Mt(this,e,!1,23,4)},E.prototype.readDoubleLE=function(e,r){return r||H(e,8,this.length),Mt(this,e,!0,52,8)},E.prototype.readDoubleBE=function(e,r){return r||H(e,8,this.length),Mt(this,e,!1,52,8)};function re(t,e,r,n,a,s){if(!de(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>a||e<s)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}E.prototype.writeUIntLE=function(e,r,n,a){if(e=+e,r=r|0,n=n|0,!a){var s=Math.pow(2,8*n)-1;re(this,e,r,n,s,0)}var f=1,p=0;for(this[r]=e&255;++p<n&&(f*=256);)this[r+p]=e/f&255;return r+n},E.prototype.writeUIntBE=function(e,r,n,a){if(e=+e,r=r|0,n=n|0,!a){var s=Math.pow(2,8*n)-1;re(this,e,r,n,s,0)}var f=n-1,p=1;for(this[r+f]=e&255;--f>=0&&(p*=256);)this[r+f]=e/p&255;return r+n},E.prototype.writeUInt8=function(e,r,n){return e=+e,r=r|0,n||re(this,e,r,1,255,0),E.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=e&255,r+1};function kt(t,e,r,n){e<0&&(e=65535+e+1);for(var a=0,s=Math.min(t.length-r,2);a<s;++a)t[r+a]=(e&255<<8*(n?a:1-a))>>>(n?a:1-a)*8}E.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r|0,n||re(this,e,r,2,65535,0),E.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):kt(this,e,r,!0),r+2},E.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r|0,n||re(this,e,r,2,65535,0),E.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):kt(this,e,r,!1),r+2};function jt(t,e,r,n){e<0&&(e=4294967295+e+1);for(var a=0,s=Math.min(t.length-r,4);a<s;++a)t[r+a]=e>>>(n?a:3-a)*8&255}E.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r|0,n||re(this,e,r,4,4294967295,0),E.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255):jt(this,e,r,!0),r+4},E.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r|0,n||re(this,e,r,4,4294967295,0),E.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):jt(this,e,r,!1),r+4},E.prototype.writeIntLE=function(e,r,n,a){if(e=+e,r=r|0,!a){var s=Math.pow(2,8*n-1);re(this,e,r,n,s-1,-s)}var f=0,p=1,h=0;for(this[r]=e&255;++f<n&&(p*=256);)e<0&&h===0&&this[r+f-1]!==0&&(h=1),this[r+f]=(e/p>>0)-h&255;return r+n},E.prototype.writeIntBE=function(e,r,n,a){if(e=+e,r=r|0,!a){var s=Math.pow(2,8*n-1);re(this,e,r,n,s-1,-s)}var f=n-1,p=1,h=0;for(this[r+f]=e&255;--f>=0&&(p*=256);)e<0&&h===0&&this[r+f+1]!==0&&(h=1),this[r+f]=(e/p>>0)-h&255;return r+n},E.prototype.writeInt8=function(e,r,n){return e=+e,r=r|0,n||re(this,e,r,1,127,-128),E.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[r]=e&255,r+1},E.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r|0,n||re(this,e,r,2,32767,-32768),E.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):kt(this,e,r,!0),r+2},E.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r|0,n||re(this,e,r,2,32767,-32768),E.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):kt(this,e,r,!1),r+2},E.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r|0,n||re(this,e,r,4,2147483647,-2147483648),E.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):jt(this,e,r,!0),r+4},E.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r|0,n||re(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),E.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):jt(this,e,r,!1),r+4};function Xn(t,e,r,n,a,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Jn(t,e,r,n,a){return a||Xn(t,e,r,4),Ln(t,e,r,n,23,4),r+4}E.prototype.writeFloatLE=function(e,r,n){return Jn(this,e,r,!0,n)},E.prototype.writeFloatBE=function(e,r,n){return Jn(this,e,r,!1,n)};function Kn(t,e,r,n,a){return a||Xn(t,e,r,8),Ln(t,e,r,n,52,8),r+8}E.prototype.writeDoubleLE=function(e,r,n){return Kn(this,e,r,!0,n)},E.prototype.writeDoubleBE=function(e,r,n){return Kn(this,e,r,!1,n)},E.prototype.copy=function(e,r,n,a){if(n||(n=0),!a&&a!==0&&(a=this.length),r>=e.length&&(r=e.length),r||(r=0),a>0&&a<n&&(a=n),a===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-r<a-n&&(a=e.length-r+n);var s=a-n,f;if(this===e&&n<r&&r<a)for(f=s-1;f>=0;--f)e[f+r]=this[f+n];else if(s<1e3||!E.TYPED_ARRAY_SUPPORT)for(f=0;f<s;++f)e[f+r]=this[f+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+s),r);return s},E.prototype.fill=function(e,r,n,a){if(typeof e=="string"){if(typeof r=="string"?(a=r,r=0,n=this.length):typeof n=="string"&&(a=n,n=this.length),e.length===1){var s=e.charCodeAt(0);s<256&&(e=s)}if(a!==void 0&&typeof a!="string")throw new TypeError("encoding must be a string");if(typeof a=="string"&&!E.isEncoding(a))throw new TypeError("Unknown encoding: "+a)}else typeof e=="number"&&(e=e&255);if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var f;if(typeof e=="number")for(f=r;f<n;++f)this[f]=e;else{var p=de(e)?e:qt(new E(e,a).toString()),h=p.length;for(f=0;f<n-r;++f)this[f+r]=p[f%h]}return this};var Na=/[^+\/0-9A-Za-z-_]/g;function Ma(t){if(t=La(t).replace(Na,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function La(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function ka(t){return t<16?"0"+t.toString(16):t.toString(16)}function qt(t,e){e=e||1/0;for(var r,n=t.length,a=null,s=[],f=0;f<n;++f){if(r=t.charCodeAt(f),r>55295&&r<57344){if(!a){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(f+1===n){(e-=3)>-1&&s.push(239,191,189);continue}a=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),a=r;continue}r=(a-55296<<10|r-56320)+65536}else a&&(e-=3)>-1&&s.push(239,191,189);if(a=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function ja(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function qa(t,e){for(var r,n,a,s=[],f=0;f<t.length&&!((e-=2)<0);++f)r=t.charCodeAt(f),n=r>>8,a=r%256,s.push(a),s.push(n);return s}function Qn(t){return ga(Ma(t))}function Vt(t,e,r,n){for(var a=0;a<n&&!(a+r>=e.length||a>=t.length);++a)e[a+r]=t[a];return a}function Va(t){return t!==t}function za(t){return t!=null&&(!!t._isBuffer||Zn(t)||Ga(t))}function Zn(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Ga(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&Zn(t.slice(0,0))}function ei(){throw new Error("setTimeout has not been defined")}function ti(){throw new Error("clearTimeout has not been defined")}var Be=ei,Oe=ti;typeof Qe.setTimeout=="function"&&(Be=setTimeout),typeof Qe.clearTimeout=="function"&&(Oe=clearTimeout);function ri(t){if(Be===setTimeout)return setTimeout(t,0);if((Be===ei||!Be)&&setTimeout)return Be=setTimeout,setTimeout(t,0);try{return Be(t,0)}catch{try{return Be.call(null,t,0)}catch{return Be.call(this,t,0)}}}function Wa(t){if(Oe===clearTimeout)return clearTimeout(t);if((Oe===ti||!Oe)&&clearTimeout)return Oe=clearTimeout,clearTimeout(t);try{return Oe(t)}catch{try{return Oe.call(null,t)}catch{return Oe.call(this,t)}}}var Ee=[],Ze=!1,Le,zt=-1;function Ha(){!Ze||!Le||(Ze=!1,Le.length?Ee=Le.concat(Ee):zt=-1,Ee.length&&ni())}function ni(){if(!Ze){var t=ri(Ha);Ze=!0;for(var e=Ee.length;e;){for(Le=Ee,Ee=[];++zt<e;)Le&&Le[zt].run();zt=-1,e=Ee.length}Le=null,Ze=!1,Wa(t)}}function Ya(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];Ee.push(new ii(t,e)),Ee.length===1&&!Ze&&ri(ni)}function ii(t,e){this.fun=t,this.array=e}ii.prototype.run=function(){this.fun.apply(null,this.array)};var Xa="browser",Ja="browser",Ka=!0,Qa={},Za=[],es="",ts={},rs={},ns={};function ke(){}var is=ke,os=ke,as=ke,ss=ke,us=ke,cs=ke,fs=ke;function ls(t){throw new Error("process.binding is not supported")}function ps(){return"/"}function hs(t){throw new Error("process.chdir is not supported")}function ds(){return 0}var et=Qe.performance||{},ys=et.now||et.mozNow||et.msNow||et.oNow||et.webkitNow||function(){return new Date().getTime()};function gs(t){var e=ys.call(et)*.001,r=Math.floor(e),n=Math.floor(e%1*1e9);return t&&(r=r-t[0],n=n-t[1],n<0&&(r--,n+=1e9)),[r,n]}var ms=new Date;function ws(){var t=new Date,e=t-ms;return e/1e3}var tt={nextTick:Ya,title:Xa,browser:Ka,env:Qa,argv:Za,version:es,versions:ts,on:is,addListener:os,once:as,off:ss,removeListener:us,removeAllListeners:cs,emit:fs,binding:ls,cwd:ps,chdir:hs,umask:ds,hrtime:gs,platform:Ja,release:rs,config:ns,uptime:ws},Rr;typeof Object.create=="function"?Rr=function(e,r){e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:Rr=function(e,r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e};var oi=Rr,ai=Object.getOwnPropertyDescriptors||function(e){for(var r=Object.keys(e),n={},a=0;a<r.length;a++)n[r[a]]=Object.getOwnPropertyDescriptor(e,r[a]);return n},vs=/%[sdj%]/g;function Gt(t){if(!gt(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(ye(arguments[r]));return e.join(" ")}for(var r=1,n=arguments,a=n.length,s=String(t).replace(vs,function(p){if(p==="%%")return"%";if(r>=a)return p;switch(p){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch{return"[Circular]"}default:return p}}),f=n[r];r<a;f=n[++r])yt(f)||!je(f)?s+=" "+f:s+=" "+ye(f);return s}function Fr(t,e){if(ge(Qe.process))return function(){return Fr(t,e).apply(this,arguments)};if(tt.noDeprecation===!0)return t;var r=!1;function n(){if(!r){if(tt.throwDeprecation)throw new Error(e);tt.traceDeprecation?console.trace(e):console.error(e),r=!0}return t.apply(this,arguments)}return n}var Wt={},Pr;function si(t){if(ge(Pr)&&(Pr=tt.env.NODE_DEBUG||""),t=t.toUpperCase(),!Wt[t])if(new RegExp("\\b"+t+"\\b","i").test(Pr)){var e=0;Wt[t]=function(){var r=Gt.apply(null,arguments);console.error("%s %d: %s",t,e,r)}}else Wt[t]=function(){};return Wt[t]}function ye(t,e){var r={seen:[],stylize:bs};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),Yt(e)?r.showHidden=e:e&&Lr(r,e),ge(r.showHidden)&&(r.showHidden=!1),ge(r.depth)&&(r.depth=2),ge(r.colors)&&(r.colors=!1),ge(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=_s),Ht(r,t,r.depth)}ye.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},ye.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function _s(t,e){var r=ye.styles[e];return r?"\x1B["+ye.colors[r][0]+"m"+t+"\x1B["+ye.colors[r][1]+"m":t}function bs(t,e){return t}function Es(t){var e={};return t.forEach(function(r,n){e[r]=!0}),e}function Ht(t,e,r){if(t.customInspect&&e&&vt(e.inspect)&&e.inspect!==ye&&!(e.constructor&&e.constructor.prototype===e)){var n=e.inspect(r,t);return gt(n)||(n=Ht(t,n,r)),n}var a=As(t,e);if(a)return a;var s=Object.keys(e),f=Es(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(e)),wt(e)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return $r(e);if(s.length===0){if(vt(e)){var p=e.name?": "+e.name:"";return t.stylize("[Function"+p+"]","special")}if(mt(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(Xt(e))return t.stylize(Date.prototype.toString.call(e),"date");if(wt(e))return $r(e)}var h="",m=!1,v=["{","}"];if(Cr(e)&&(m=!0,v=["[","]"]),vt(e)){var _=e.name?": "+e.name:"";h=" [Function"+_+"]"}if(mt(e)&&(h=" "+RegExp.prototype.toString.call(e)),Xt(e)&&(h=" "+Date.prototype.toUTCString.call(e)),wt(e)&&(h=" "+$r(e)),s.length===0&&(!m||e.length==0))return v[0]+h+v[1];if(r<0)return mt(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var b;return m?b=xs(t,e,r,f,s):b=s.map(function(y){return Ur(t,e,r,f,y,m)}),t.seen.pop(),Ss(b,h,v)}function As(t,e){if(ge(e))return t.stylize("undefined","undefined");if(gt(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(Dr(e))return t.stylize(""+e,"number");if(Yt(e))return t.stylize(""+e,"boolean");if(yt(e))return t.stylize("null","null")}function $r(t){return"["+Error.prototype.toString.call(t)+"]"}function xs(t,e,r,n,a){for(var s=[],f=0,p=e.length;f<p;++f)hi(e,String(f))?s.push(Ur(t,e,r,n,String(f),!0)):s.push("");return a.forEach(function(h){h.match(/^\d+$/)||s.push(Ur(t,e,r,n,h,!0))}),s}function Ur(t,e,r,n,a,s){var f,p,h;if(h=Object.getOwnPropertyDescriptor(e,a)||{value:e[a]},h.get?h.set?p=t.stylize("[Getter/Setter]","special"):p=t.stylize("[Getter]","special"):h.set&&(p=t.stylize("[Setter]","special")),hi(n,a)||(f="["+a+"]"),p||(t.seen.indexOf(h.value)<0?(yt(r)?p=Ht(t,h.value,null):p=Ht(t,h.value,r-1),p.indexOf(`
8
+ */var ba=50;E.TYPED_ARRAY_SUPPORT=Qe.TYPED_ARRAY_SUPPORT!==void 0?Qe.TYPED_ARRAY_SUPPORT:!0,kt();function kt(){return E.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function be(t,e){if(kt()<e)throw new RangeError("Invalid typed array length");return E.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=E.prototype):(t===null&&(t=new E(e)),t.length=e),t}function E(t,e,r){if(!E.TYPED_ARRAY_SUPPORT&&!(this instanceof E))return new E(t,e,r);if(typeof t=="number"){if(typeof e=="string")throw new Error("If encoding is specified then the first argument must be a string");return Br(this,t)}return jn(this,t,e,r)}E.poolSize=8192,E._augment=function(t){return t.__proto__=E.prototype,t};function jn(t,e,r,n){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?xa(t,e,r,n):typeof e=="string"?Aa(t,e,r):Sa(t,e)}E.from=function(t,e,r){return jn(null,t,e,r)},E.TYPED_ARRAY_SUPPORT&&(E.prototype.__proto__=Uint8Array.prototype,E.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&E[Symbol.species]);function qn(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function Ea(t,e,r,n){return qn(e),e<=0?be(t,e):r!==void 0?typeof n=="string"?be(t,e).fill(r,n):be(t,e).fill(r):be(t,e)}E.alloc=function(t,e,r){return Ea(null,t,e,r)};function Br(t,e){if(qn(e),t=be(t,e<0?0:Tr(e)|0),!E.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}E.allocUnsafe=function(t){return Br(null,t)},E.allocUnsafeSlow=function(t){return Br(null,t)};function Aa(t,e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!E.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=Vn(e,r)|0;t=be(t,n);var a=t.write(e,r);return a!==n&&(t=t.slice(0,a)),t}function Or(t,e){var r=e.length<0?0:Tr(e.length)|0;t=be(t,r);for(var n=0;n<r;n+=1)t[n]=e[n]&255;return t}function xa(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return r===void 0&&n===void 0?e=new Uint8Array(e):n===void 0?e=new Uint8Array(e,r):e=new Uint8Array(e,r,n),E.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=E.prototype):t=Or(t,e),t}function Sa(t,e){if(ye(e)){var r=Tr(e.length)|0;return t=be(t,r),t.length===0||e.copy(t,0,0,r),t}if(e){if(typeof ArrayBuffer<"u"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||za(e.length)?be(t,0):Or(t,e);if(e.type==="Buffer"&&kn(e.data))return Or(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Tr(t){if(t>=kt())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kt().toString(16)+" bytes");return t|0}E.isBuffer=Ga;function ye(t){return!!(t!=null&&t._isBuffer)}E.compare=function(e,r){if(!ye(e)||!ye(r))throw new TypeError("Arguments must be Buffers");if(e===r)return 0;for(var n=e.length,a=r.length,s=0,f=Math.min(n,a);s<f;++s)if(e[s]!==r[s]){n=e[s],a=r[s];break}return n<a?-1:a<n?1:0},E.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},E.concat=function(e,r){if(!kn(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return E.alloc(0);var n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;var a=E.allocUnsafe(r),s=0;for(n=0;n<e.length;++n){var f=e[n];if(!ye(f))throw new TypeError('"list" argument must be an Array of Buffers');f.copy(a,s),s+=f.length}return a};function Vn(t,e){if(ye(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var r=t.length;if(r===0)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Vt(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Qn(t).length;default:if(n)return Vt(t).length;e=(""+e).toLowerCase(),n=!0}}E.byteLength=Vn;function Ia(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return Da(this,e,r);case"utf8":case"utf-8":return Hn(this,e,r);case"ascii":return Ua(this,e,r);case"latin1":case"binary":return Ca(this,e,r);case"base64":return Pa(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Na(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}E.prototype._isBuffer=!0;function Me(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}E.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<e;r+=2)Me(this,r,r+1);return this},E.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<e;r+=4)Me(this,r,r+3),Me(this,r+1,r+2);return this},E.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<e;r+=8)Me(this,r,r+7),Me(this,r+1,r+6),Me(this,r+2,r+5),Me(this,r+3,r+4);return this},E.prototype.toString=function(){var e=this.length|0;return e===0?"":arguments.length===0?Hn(this,0,e):Ia.apply(this,arguments)},E.prototype.equals=function(e){if(!ye(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:E.compare(this,e)===0},E.prototype.inspect=function(){var e="",r=ba;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},E.prototype.compare=function(e,r,n,a,s){if(!ye(e))throw new TypeError("Argument must be a Buffer");if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),a===void 0&&(a=0),s===void 0&&(s=this.length),r<0||n>e.length||a<0||s>this.length)throw new RangeError("out of range index");if(a>=s&&r>=n)return 0;if(a>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,a>>>=0,s>>>=0,this===e)return 0;for(var f=s-a,p=n-r,h=Math.min(f,p),m=this.slice(a,s),v=e.slice(r,n),_=0;_<h;++_)if(m[_]!==v[_]){f=m[_],p=v[_];break}return f<p?-1:p<f?1:0};function zn(t,e,r,n,a){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=a?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(a)return-1;r=t.length-1}else if(r<0)if(a)r=0;else return-1;if(typeof e=="string"&&(e=E.from(e,n)),ye(e))return e.length===0?-1:Gn(t,e,r,n,a);if(typeof e=="number")return e=e&255,E.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?a?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Gn(t,[e],r,n,a);throw new TypeError("val must be string, number or Buffer")}function Gn(t,e,r,n,a){var s=1,f=t.length,p=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,f/=2,p/=2,r/=2}function h(y,x){return s===1?y[x]:y.readUInt16BE(x*s)}var m;if(a){var v=-1;for(m=r;m<f;m++)if(h(t,m)===h(e,v===-1?0:m-v)){if(v===-1&&(v=m),m-v+1===p)return v*s}else v!==-1&&(m-=m-v),v=-1}else for(r+p>f&&(r=f-p),m=r;m>=0;m--){for(var _=!0,b=0;b<p;b++)if(h(t,m+b)!==h(e,b)){_=!1;break}if(_)return m}return-1}E.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1},E.prototype.indexOf=function(e,r,n){return zn(this,e,r,n,!0)},E.prototype.lastIndexOf=function(e,r,n){return zn(this,e,r,n,!1)};function Ba(t,e,r,n){r=Number(r)||0;var a=t.length-r;n?(n=Number(n),n>a&&(n=a)):n=a;var s=e.length;if(s%2!==0)throw new TypeError("Invalid hex string");n>s/2&&(n=s/2);for(var f=0;f<n;++f){var p=parseInt(e.substr(f*2,2),16);if(isNaN(p))return f;t[r+f]=p}return f}function Oa(t,e,r,n){return zt(Vt(e,t.length-r),t,r,n)}function Wn(t,e,r,n){return zt(qa(e),t,r,n)}function Ta(t,e,r,n){return Wn(t,e,r,n)}function Ra(t,e,r,n){return zt(Qn(e),t,r,n)}function Fa(t,e,r,n){return zt(Va(e,t.length-r),t,r,n)}E.prototype.write=function(e,r,n,a){if(r===void 0)a="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")a=r,n=this.length,r=0;else if(isFinite(r))r=r|0,isFinite(n)?(n=n|0,a===void 0&&(a="utf8")):(a=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var f=!1;;)switch(a){case"hex":return Ba(this,e,r,n);case"utf8":case"utf-8":return Oa(this,e,r,n);case"ascii":return Wn(this,e,r,n);case"latin1":case"binary":return Ta(this,e,r,n);case"base64":return Ra(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Fa(this,e,r,n);default:if(f)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),f=!0}},E.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Pa(t,e,r){return e===0&&r===t.length?Mn(t):Mn(t.slice(e,r))}function Hn(t,e,r){r=Math.min(t.length,r);for(var n=[],a=e;a<r;){var s=t[a],f=null,p=s>239?4:s>223?3:s>191?2:1;if(a+p<=r){var h,m,v,_;switch(p){case 1:s<128&&(f=s);break;case 2:h=t[a+1],(h&192)===128&&(_=(s&31)<<6|h&63,_>127&&(f=_));break;case 3:h=t[a+1],m=t[a+2],(h&192)===128&&(m&192)===128&&(_=(s&15)<<12|(h&63)<<6|m&63,_>2047&&(_<55296||_>57343)&&(f=_));break;case 4:h=t[a+1],m=t[a+2],v=t[a+3],(h&192)===128&&(m&192)===128&&(v&192)===128&&(_=(s&15)<<18|(h&63)<<12|(m&63)<<6|v&63,_>65535&&_<1114112&&(f=_))}}f===null?(f=65533,p=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|f&1023),n.push(f),a+=p}return $a(n)}var Yn=4096;function $a(t){var e=t.length;if(e<=Yn)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Yn));return r}function Ua(t,e,r){var n="";r=Math.min(t.length,r);for(var a=e;a<r;++a)n+=String.fromCharCode(t[a]&127);return n}function Ca(t,e,r){var n="";r=Math.min(t.length,r);for(var a=e;a<r;++a)n+=String.fromCharCode(t[a]);return n}function Da(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var a="",s=e;s<r;++s)a+=ja(t[s]);return a}function Na(t,e,r){for(var n=t.slice(e,r),a="",s=0;s<n.length;s+=2)a+=String.fromCharCode(n[s]+n[s+1]*256);return a}E.prototype.slice=function(e,r){var n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);var a;if(E.TYPED_ARRAY_SUPPORT)a=this.subarray(e,r),a.__proto__=E.prototype;else{var s=r-e;a=new E(s,void 0);for(var f=0;f<s;++f)a[f]=this[f+e]}return a};function H(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}E.prototype.readUIntLE=function(e,r,n){e=e|0,r=r|0,n||H(e,r,this.length);for(var a=this[e],s=1,f=0;++f<r&&(s*=256);)a+=this[e+f]*s;return a},E.prototype.readUIntBE=function(e,r,n){e=e|0,r=r|0,n||H(e,r,this.length);for(var a=this[e+--r],s=1;r>0&&(s*=256);)a+=this[e+--r]*s;return a},E.prototype.readUInt8=function(e,r){return r||H(e,1,this.length),this[e]},E.prototype.readUInt16LE=function(e,r){return r||H(e,2,this.length),this[e]|this[e+1]<<8},E.prototype.readUInt16BE=function(e,r){return r||H(e,2,this.length),this[e]<<8|this[e+1]},E.prototype.readUInt32LE=function(e,r){return r||H(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},E.prototype.readUInt32BE=function(e,r){return r||H(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},E.prototype.readIntLE=function(e,r,n){e=e|0,r=r|0,n||H(e,r,this.length);for(var a=this[e],s=1,f=0;++f<r&&(s*=256);)a+=this[e+f]*s;return s*=128,a>=s&&(a-=Math.pow(2,8*r)),a},E.prototype.readIntBE=function(e,r,n){e=e|0,r=r|0,n||H(e,r,this.length);for(var a=r,s=1,f=this[e+--a];a>0&&(s*=256);)f+=this[e+--a]*s;return s*=128,f>=s&&(f-=Math.pow(2,8*r)),f},E.prototype.readInt8=function(e,r){return r||H(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},E.prototype.readInt16LE=function(e,r){r||H(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},E.prototype.readInt16BE=function(e,r){r||H(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},E.prototype.readInt32LE=function(e,r){return r||H(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},E.prototype.readInt32BE=function(e,r){return r||H(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},E.prototype.readFloatLE=function(e,r){return r||H(e,4,this.length),Lt(this,e,!0,23,4)},E.prototype.readFloatBE=function(e,r){return r||H(e,4,this.length),Lt(this,e,!1,23,4)},E.prototype.readDoubleLE=function(e,r){return r||H(e,8,this.length),Lt(this,e,!0,52,8)},E.prototype.readDoubleBE=function(e,r){return r||H(e,8,this.length),Lt(this,e,!1,52,8)};function re(t,e,r,n,a,s){if(!ye(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>a||e<s)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}E.prototype.writeUIntLE=function(e,r,n,a){if(e=+e,r=r|0,n=n|0,!a){var s=Math.pow(2,8*n)-1;re(this,e,r,n,s,0)}var f=1,p=0;for(this[r]=e&255;++p<n&&(f*=256);)this[r+p]=e/f&255;return r+n},E.prototype.writeUIntBE=function(e,r,n,a){if(e=+e,r=r|0,n=n|0,!a){var s=Math.pow(2,8*n)-1;re(this,e,r,n,s,0)}var f=n-1,p=1;for(this[r+f]=e&255;--f>=0&&(p*=256);)this[r+f]=e/p&255;return r+n},E.prototype.writeUInt8=function(e,r,n){return e=+e,r=r|0,n||re(this,e,r,1,255,0),E.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=e&255,r+1};function jt(t,e,r,n){e<0&&(e=65535+e+1);for(var a=0,s=Math.min(t.length-r,2);a<s;++a)t[r+a]=(e&255<<8*(n?a:1-a))>>>(n?a:1-a)*8}E.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r|0,n||re(this,e,r,2,65535,0),E.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):jt(this,e,r,!0),r+2},E.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r|0,n||re(this,e,r,2,65535,0),E.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):jt(this,e,r,!1),r+2};function qt(t,e,r,n){e<0&&(e=4294967295+e+1);for(var a=0,s=Math.min(t.length-r,4);a<s;++a)t[r+a]=e>>>(n?a:3-a)*8&255}E.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r|0,n||re(this,e,r,4,4294967295,0),E.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255):qt(this,e,r,!0),r+4},E.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r|0,n||re(this,e,r,4,4294967295,0),E.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):qt(this,e,r,!1),r+4},E.prototype.writeIntLE=function(e,r,n,a){if(e=+e,r=r|0,!a){var s=Math.pow(2,8*n-1);re(this,e,r,n,s-1,-s)}var f=0,p=1,h=0;for(this[r]=e&255;++f<n&&(p*=256);)e<0&&h===0&&this[r+f-1]!==0&&(h=1),this[r+f]=(e/p>>0)-h&255;return r+n},E.prototype.writeIntBE=function(e,r,n,a){if(e=+e,r=r|0,!a){var s=Math.pow(2,8*n-1);re(this,e,r,n,s-1,-s)}var f=n-1,p=1,h=0;for(this[r+f]=e&255;--f>=0&&(p*=256);)e<0&&h===0&&this[r+f+1]!==0&&(h=1),this[r+f]=(e/p>>0)-h&255;return r+n},E.prototype.writeInt8=function(e,r,n){return e=+e,r=r|0,n||re(this,e,r,1,127,-128),E.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[r]=e&255,r+1},E.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r|0,n||re(this,e,r,2,32767,-32768),E.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):jt(this,e,r,!0),r+2},E.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r|0,n||re(this,e,r,2,32767,-32768),E.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):jt(this,e,r,!1),r+2},E.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r|0,n||re(this,e,r,4,2147483647,-2147483648),E.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):qt(this,e,r,!0),r+4},E.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r|0,n||re(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),E.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):qt(this,e,r,!1),r+4};function Xn(t,e,r,n,a,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Jn(t,e,r,n,a){return a||Xn(t,e,r,4),Ln(t,e,r,n,23,4),r+4}E.prototype.writeFloatLE=function(e,r,n){return Jn(this,e,r,!0,n)},E.prototype.writeFloatBE=function(e,r,n){return Jn(this,e,r,!1,n)};function Kn(t,e,r,n,a){return a||Xn(t,e,r,8),Ln(t,e,r,n,52,8),r+8}E.prototype.writeDoubleLE=function(e,r,n){return Kn(this,e,r,!0,n)},E.prototype.writeDoubleBE=function(e,r,n){return Kn(this,e,r,!1,n)},E.prototype.copy=function(e,r,n,a){if(n||(n=0),!a&&a!==0&&(a=this.length),r>=e.length&&(r=e.length),r||(r=0),a>0&&a<n&&(a=n),a===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-r<a-n&&(a=e.length-r+n);var s=a-n,f;if(this===e&&n<r&&r<a)for(f=s-1;f>=0;--f)e[f+r]=this[f+n];else if(s<1e3||!E.TYPED_ARRAY_SUPPORT)for(f=0;f<s;++f)e[f+r]=this[f+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+s),r);return s},E.prototype.fill=function(e,r,n,a){if(typeof e=="string"){if(typeof r=="string"?(a=r,r=0,n=this.length):typeof n=="string"&&(a=n,n=this.length),e.length===1){var s=e.charCodeAt(0);s<256&&(e=s)}if(a!==void 0&&typeof a!="string")throw new TypeError("encoding must be a string");if(typeof a=="string"&&!E.isEncoding(a))throw new TypeError("Unknown encoding: "+a)}else typeof e=="number"&&(e=e&255);if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var f;if(typeof e=="number")for(f=r;f<n;++f)this[f]=e;else{var p=ye(e)?e:Vt(new E(e,a).toString()),h=p.length;for(f=0;f<n-r;++f)this[f+r]=p[f%h]}return this};var Ma=/[^+\/0-9A-Za-z-_]/g;function La(t){if(t=ka(t).replace(Ma,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function ka(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function ja(t){return t<16?"0"+t.toString(16):t.toString(16)}function Vt(t,e){e=e||1/0;for(var r,n=t.length,a=null,s=[],f=0;f<n;++f){if(r=t.charCodeAt(f),r>55295&&r<57344){if(!a){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(f+1===n){(e-=3)>-1&&s.push(239,191,189);continue}a=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),a=r;continue}r=(a-55296<<10|r-56320)+65536}else a&&(e-=3)>-1&&s.push(239,191,189);if(a=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function qa(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function Va(t,e){for(var r,n,a,s=[],f=0;f<t.length&&!((e-=2)<0);++f)r=t.charCodeAt(f),n=r>>8,a=r%256,s.push(a),s.push(n);return s}function Qn(t){return ma(La(t))}function zt(t,e,r,n){for(var a=0;a<n&&!(a+r>=e.length||a>=t.length);++a)e[a+r]=t[a];return a}function za(t){return t!==t}function Ga(t){return t!=null&&(!!t._isBuffer||Zn(t)||Wa(t))}function Zn(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Wa(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&Zn(t.slice(0,0))}function ei(){throw new Error("setTimeout has not been defined")}function ti(){throw new Error("clearTimeout has not been defined")}var Be=ei,Oe=ti;typeof Qe.setTimeout=="function"&&(Be=setTimeout),typeof Qe.clearTimeout=="function"&&(Oe=clearTimeout);function ri(t){if(Be===setTimeout)return setTimeout(t,0);if((Be===ei||!Be)&&setTimeout)return Be=setTimeout,setTimeout(t,0);try{return Be(t,0)}catch{try{return Be.call(null,t,0)}catch{return Be.call(this,t,0)}}}function Ha(t){if(Oe===clearTimeout)return clearTimeout(t);if((Oe===ti||!Oe)&&clearTimeout)return Oe=clearTimeout,clearTimeout(t);try{return Oe(t)}catch{try{return Oe.call(null,t)}catch{return Oe.call(this,t)}}}var Ee=[],Ze=!1,Le,Gt=-1;function Ya(){!Ze||!Le||(Ze=!1,Le.length?Ee=Le.concat(Ee):Gt=-1,Ee.length&&ni())}function ni(){if(!Ze){var t=ri(Ya);Ze=!0;for(var e=Ee.length;e;){for(Le=Ee,Ee=[];++Gt<e;)Le&&Le[Gt].run();Gt=-1,e=Ee.length}Le=null,Ze=!1,Ha(t)}}function Xa(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];Ee.push(new ii(t,e)),Ee.length===1&&!Ze&&ri(ni)}function ii(t,e){this.fun=t,this.array=e}ii.prototype.run=function(){this.fun.apply(null,this.array)};var Ja="browser",Ka="browser",Qa=!0,Za={},es=[],ts="",rs={},ns={},is={};function ke(){}var os=ke,as=ke,ss=ke,us=ke,cs=ke,fs=ke,ls=ke;function ps(t){throw new Error("process.binding is not supported")}function hs(){return"/"}function ds(t){throw new Error("process.chdir is not supported")}function ys(){return 0}var et=Qe.performance||{},gs=et.now||et.mozNow||et.msNow||et.oNow||et.webkitNow||function(){return new Date().getTime()};function ms(t){var e=gs.call(et)*.001,r=Math.floor(e),n=Math.floor(e%1*1e9);return t&&(r=r-t[0],n=n-t[1],n<0&&(r--,n+=1e9)),[r,n]}var ws=new Date;function vs(){var t=new Date,e=t-ws;return e/1e3}var tt={nextTick:Xa,title:Ja,browser:Qa,env:Za,argv:es,version:ts,versions:rs,on:os,addListener:as,once:ss,off:us,removeListener:cs,removeAllListeners:fs,emit:ls,binding:ps,cwd:hs,chdir:ds,umask:ys,hrtime:ms,platform:Ka,release:ns,config:is,uptime:vs},Rr;typeof Object.create=="function"?Rr=function(e,r){e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:Rr=function(e,r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e};var oi=Rr,ai=Object.getOwnPropertyDescriptors||function(e){for(var r=Object.keys(e),n={},a=0;a<r.length;a++)n[r[a]]=Object.getOwnPropertyDescriptor(e,r[a]);return n},_s=/%[sdj%]/g;function Wt(t){if(!gt(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(ge(arguments[r]));return e.join(" ")}for(var r=1,n=arguments,a=n.length,s=String(t).replace(_s,function(p){if(p==="%%")return"%";if(r>=a)return p;switch(p){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch{return"[Circular]"}default:return p}}),f=n[r];r<a;f=n[++r])yt(f)||!je(f)?s+=" "+f:s+=" "+ge(f);return s}function Fr(t,e){if(me(Qe.process))return function(){return Fr(t,e).apply(this,arguments)};if(tt.noDeprecation===!0)return t;var r=!1;function n(){if(!r){if(tt.throwDeprecation)throw new Error(e);tt.traceDeprecation?console.trace(e):console.error(e),r=!0}return t.apply(this,arguments)}return n}var Ht={},Pr;function si(t){if(me(Pr)&&(Pr=tt.env.NODE_DEBUG||""),t=t.toUpperCase(),!Ht[t])if(new RegExp("\\b"+t+"\\b","i").test(Pr)){var e=0;Ht[t]=function(){var r=Wt.apply(null,arguments);console.error("%s %d: %s",t,e,r)}}else Ht[t]=function(){};return Ht[t]}function ge(t,e){var r={seen:[],stylize:Es};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),Xt(e)?r.showHidden=e:e&&Lr(r,e),me(r.showHidden)&&(r.showHidden=!1),me(r.depth)&&(r.depth=2),me(r.colors)&&(r.colors=!1),me(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=bs),Yt(r,t,r.depth)}ge.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},ge.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function bs(t,e){var r=ge.styles[e];return r?"\x1B["+ge.colors[r][0]+"m"+t+"\x1B["+ge.colors[r][1]+"m":t}function Es(t,e){return t}function As(t){var e={};return t.forEach(function(r,n){e[r]=!0}),e}function Yt(t,e,r){if(t.customInspect&&e&&vt(e.inspect)&&e.inspect!==ge&&!(e.constructor&&e.constructor.prototype===e)){var n=e.inspect(r,t);return gt(n)||(n=Yt(t,n,r)),n}var a=xs(t,e);if(a)return a;var s=Object.keys(e),f=As(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(e)),wt(e)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return $r(e);if(s.length===0){if(vt(e)){var p=e.name?": "+e.name:"";return t.stylize("[Function"+p+"]","special")}if(mt(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(Jt(e))return t.stylize(Date.prototype.toString.call(e),"date");if(wt(e))return $r(e)}var h="",m=!1,v=["{","}"];if(Cr(e)&&(m=!0,v=["[","]"]),vt(e)){var _=e.name?": "+e.name:"";h=" [Function"+_+"]"}if(mt(e)&&(h=" "+RegExp.prototype.toString.call(e)),Jt(e)&&(h=" "+Date.prototype.toUTCString.call(e)),wt(e)&&(h=" "+$r(e)),s.length===0&&(!m||e.length==0))return v[0]+h+v[1];if(r<0)return mt(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var b;return m?b=Ss(t,e,r,f,s):b=s.map(function(y){return Ur(t,e,r,f,y,m)}),t.seen.pop(),Is(b,h,v)}function xs(t,e){if(me(e))return t.stylize("undefined","undefined");if(gt(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(Dr(e))return t.stylize(""+e,"number");if(Xt(e))return t.stylize(""+e,"boolean");if(yt(e))return t.stylize("null","null")}function $r(t){return"["+Error.prototype.toString.call(t)+"]"}function Ss(t,e,r,n,a){for(var s=[],f=0,p=e.length;f<p;++f)hi(e,String(f))?s.push(Ur(t,e,r,n,String(f),!0)):s.push("");return a.forEach(function(h){h.match(/^\d+$/)||s.push(Ur(t,e,r,n,h,!0))}),s}function Ur(t,e,r,n,a,s){var f,p,h;if(h=Object.getOwnPropertyDescriptor(e,a)||{value:e[a]},h.get?h.set?p=t.stylize("[Getter/Setter]","special"):p=t.stylize("[Getter]","special"):h.set&&(p=t.stylize("[Setter]","special")),hi(n,a)||(f="["+a+"]"),p||(t.seen.indexOf(h.value)<0?(yt(r)?p=Yt(t,h.value,null):p=Yt(t,h.value,r-1),p.indexOf(`
9
9
  `)>-1&&(s?p=p.split(`
10
10
  `).map(function(m){return" "+m}).join(`
11
11
  `).substr(2):p=`
12
12
  `+p.split(`
13
13
  `).map(function(m){return" "+m}).join(`
14
- `))):p=t.stylize("[Circular]","special")),ge(f)){if(s&&a.match(/^\d+$/))return p;f=JSON.stringify(""+a),f.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(f=f.substr(1,f.length-2),f=t.stylize(f,"name")):(f=f.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),f=t.stylize(f,"string"))}return f+": "+p}function Ss(t,e,r){var n=t.reduce(function(a,s){return s.indexOf(`
14
+ `))):p=t.stylize("[Circular]","special")),me(f)){if(s&&a.match(/^\d+$/))return p;f=JSON.stringify(""+a),f.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(f=f.substr(1,f.length-2),f=t.stylize(f,"name")):(f=f.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),f=t.stylize(f,"string"))}return f+": "+p}function Is(t,e,r){var n=t.reduce(function(a,s){return s.indexOf(`
15
15
  `)>=0,a+s.replace(/\u001b\[\d\d?m/g,"").length+1},0);return n>60?r[0]+(e===""?"":e+`
16
16
  `)+" "+t.join(`,
17
- `)+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function Cr(t){return Array.isArray(t)}function Yt(t){return typeof t=="boolean"}function yt(t){return t===null}function ui(t){return t==null}function Dr(t){return typeof t=="number"}function gt(t){return typeof t=="string"}function ci(t){return typeof t=="symbol"}function ge(t){return t===void 0}function mt(t){return je(t)&&Nr(t)==="[object RegExp]"}function je(t){return typeof t=="object"&&t!==null}function Xt(t){return je(t)&&Nr(t)==="[object Date]"}function wt(t){return je(t)&&(Nr(t)==="[object Error]"||t instanceof Error)}function vt(t){return typeof t=="function"}function fi(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||typeof t>"u"}function li(t){return E.isBuffer(t)}function Nr(t){return Object.prototype.toString.call(t)}function Mr(t){return t<10?"0"+t.toString(10):t.toString(10)}var Is=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Bs(){var t=new Date,e=[Mr(t.getHours()),Mr(t.getMinutes()),Mr(t.getSeconds())].join(":");return[t.getDate(),Is[t.getMonth()],e].join(" ")}function pi(){console.log("%s - %s",Bs(),Gt.apply(null,arguments))}function Lr(t,e){if(!e||!je(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}function hi(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var qe=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;function kr(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');if(qe&&t[qe]){var e=t[qe];if(typeof e!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,qe,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var r,n,a=new Promise(function(p,h){r=p,n=h}),s=[],f=0;f<arguments.length;f++)s.push(arguments[f]);s.push(function(p,h){p?n(p):r(h)});try{t.apply(this,s)}catch(p){n(p)}return a}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),qe&&Object.defineProperty(e,qe,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,ai(t))}kr.custom=qe;function Os(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}function di(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');function e(){for(var r=[],n=0;n<arguments.length;n++)r.push(arguments[n]);var a=r.pop();if(typeof a!="function")throw new TypeError("The last argument must be of type Function");var s=this,f=function(){return a.apply(s,arguments)};t.apply(this,r).then(function(p){tt.nextTick(f.bind(null,null,p))},function(p){tt.nextTick(Os.bind(null,p,f))})}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,ai(t)),e}var Ts={inherits:oi,_extend:Lr,log:pi,isBuffer:li,isPrimitive:fi,isFunction:vt,isError:wt,isDate:Xt,isObject:je,isRegExp:mt,isUndefined:ge,isSymbol:ci,isString:gt,isNumber:Dr,isNullOrUndefined:ui,isNull:yt,isBoolean:Yt,isArray:Cr,inspect:ye,deprecate:Fr,format:Gt,debuglog:si,promisify:kr,callbackify:di},Rs=Object.freeze({__proto__:null,_extend:Lr,callbackify:di,debuglog:si,default:Ts,deprecate:Fr,format:Gt,inherits:oi,inspect:ye,isArray:Cr,isBoolean:Yt,isBuffer:li,isDate:Xt,isError:wt,isFunction:vt,isNull:yt,isNullOrUndefined:ui,isNumber:Dr,isObject:je,isPrimitive:fi,isRegExp:mt,isString:gt,isSymbol:ci,isUndefined:ge,log:pi,promisify:kr}),Fs=Ro(Rs),Ps=Fs.inspect,jr=typeof Map=="function"&&Map.prototype,qr=Object.getOwnPropertyDescriptor&&jr?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Jt=jr&&qr&&typeof qr.get=="function"?qr.get:null,yi=jr&&Map.prototype.forEach,Vr=typeof Set=="function"&&Set.prototype,zr=Object.getOwnPropertyDescriptor&&Vr?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Kt=Vr&&zr&&typeof zr.get=="function"?zr.get:null,gi=Vr&&Set.prototype.forEach,$s=typeof WeakMap=="function"&&WeakMap.prototype,_t=$s?WeakMap.prototype.has:null,Us=typeof WeakSet=="function"&&WeakSet.prototype,bt=Us?WeakSet.prototype.has:null,Cs=typeof WeakRef=="function"&&WeakRef.prototype,mi=Cs?WeakRef.prototype.deref:null,Ds=Boolean.prototype.valueOf,Ns=Object.prototype.toString,Ms=Function.prototype.toString,Ls=String.prototype.match,Gr=String.prototype.slice,Te=String.prototype.replace,ks=String.prototype.toUpperCase,wi=String.prototype.toLowerCase,vi=RegExp.prototype.test,_i=Array.prototype.concat,me=Array.prototype.join,js=Array.prototype.slice,bi=Math.floor,Wr=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Hr=Object.getOwnPropertySymbols,Yr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,rt=typeof Symbol=="function"&&typeof Symbol.iterator=="object",K=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===rt||"symbol")?Symbol.toStringTag:null,Ei=Object.prototype.propertyIsEnumerable,Ai=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function xi(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||vi.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-bi(-t):bi(t);if(n!==t){var a=String(n),s=Gr.call(e,a.length+1);return Te.call(a,r,"$&_")+"."+Te.call(Te.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Te.call(e,r,"$&_")}var Xr=Ps,Si=Xr.custom,Ii=Ti(Si)?Si:null,qs=function t(e,r,n,a){var s=r||{};if(Re(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Re(s,"maxStringLength")&&(typeof s.maxStringLength=="number"?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var f=Re(s,"customInspect")?s.customInspect:!0;if(typeof f!="boolean"&&f!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Re(s,"indent")&&s.indent!==null&&s.indent!==" "&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Re(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var p=s.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 Fi(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var h=String(e);return p?xi(e,h):h}if(typeof e=="bigint"){var m=String(e)+"n";return p?xi(e,m):m}var v=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=v&&v>0&&typeof e=="object")return Jr(e)?"[Array]":"[Object]";var _=au(s,n);if(typeof a>"u")a=[];else if(Ri(a,e)>=0)return"[Circular]";function b(M,ne,L){if(ne&&(a=js.call(a),a.push(ne)),L){var ie={depth:s.depth};return Re(s,"quoteStyle")&&(ie.quoteStyle=s.quoteStyle),t(M,ie,n+1,a)}return t(M,s,n+1,a)}if(typeof e=="function"&&!Oi(e)){var y=Ks(e),x=Qt(e,b);return"[Function"+(y?": "+y:" (anonymous)")+"]"+(x.length>0?" { "+me.call(x,", ")+" }":"")}if(Ti(e)){var I=rt?Te.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Yr.call(e);return typeof e=="object"&&!rt?Et(I):I}if(nu(e)){for(var O="<"+wi.call(String(e.nodeName)),S=e.attributes||[],T=0;T<S.length;T++)O+=" "+S[T].name+"="+Bi(Vs(S[T].value),"double",s);return O+=">",e.childNodes&&e.childNodes.length&&(O+="..."),O+="</"+wi.call(String(e.nodeName))+">",O}if(Jr(e)){if(e.length===0)return"[]";var F=Qt(e,b);return _&&!ou(F)?"["+Qr(F,_)+"]":"[ "+me.call(F,", ")+" ]"}if(Gs(e)){var R=Qt(e,b);return!("cause"in Error.prototype)&&"cause"in e&&!Ei.call(e,"cause")?"{ ["+String(e)+"] "+me.call(_i.call("[cause]: "+b(e.cause),R),", ")+" }":R.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+me.call(R,", ")+" }"}if(typeof e=="object"&&f){if(Ii&&typeof e[Ii]=="function"&&Xr)return Xr(e,{depth:v-n});if(f!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Qs(e)){var D=[];return yi&&yi.call(e,function(M,ne){D.push(b(ne,e,!0)+" => "+b(M,e))}),Pi("Map",Jt.call(e),D,_)}if(tu(e)){var N=[];return gi&&gi.call(e,function(M){N.push(b(M,e))}),Pi("Set",Kt.call(e),N,_)}if(Zs(e))return Kr("WeakMap");if(ru(e))return Kr("WeakSet");if(eu(e))return Kr("WeakRef");if(Hs(e))return Et(b(Number(e)));if(Xs(e))return Et(b(Wr.call(e)));if(Ys(e))return Et(Ds.call(e));if(Ws(e))return Et(b(String(e)));if(!zs(e)&&!Oi(e)){var V=Qt(e,b),k=Ai?Ai(e)===Object.prototype:e instanceof Object||e.constructor===Object,ee=e instanceof Object?"":"null prototype",z=!k&&K&&Object(e)===e&&K in e?Gr.call(Fe(e),8,-1):ee?"Object":"",ue=k||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",Y=ue+(z||ee?"["+me.call(_i.call([],z||[],ee||[]),": ")+"] ":"");return V.length===0?Y+"{}":_?Y+"{"+Qr(V,_)+"}":Y+"{ "+me.call(V,", ")+" }"}return String(e)};function Bi(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function Vs(t){return Te.call(String(t),/"/g,"&quot;")}function Jr(t){return Fe(t)==="[object Array]"&&(!K||!(typeof t=="object"&&K in t))}function zs(t){return Fe(t)==="[object Date]"&&(!K||!(typeof t=="object"&&K in t))}function Oi(t){return Fe(t)==="[object RegExp]"&&(!K||!(typeof t=="object"&&K in t))}function Gs(t){return Fe(t)==="[object Error]"&&(!K||!(typeof t=="object"&&K in t))}function Ws(t){return Fe(t)==="[object String]"&&(!K||!(typeof t=="object"&&K in t))}function Hs(t){return Fe(t)==="[object Number]"&&(!K||!(typeof t=="object"&&K in t))}function Ys(t){return Fe(t)==="[object Boolean]"&&(!K||!(typeof t=="object"&&K in t))}function Ti(t){if(rt)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!Yr)return!1;try{return Yr.call(t),!0}catch{}return!1}function Xs(t){if(!t||typeof t!="object"||!Wr)return!1;try{return Wr.call(t),!0}catch{}return!1}var Js=Object.prototype.hasOwnProperty||function(t){return t in this};function Re(t,e){return Js.call(t,e)}function Fe(t){return Ns.call(t)}function Ks(t){if(t.name)return t.name;var e=Ls.call(Ms.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function Ri(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}function Qs(t){if(!Jt||!t||typeof t!="object")return!1;try{Jt.call(t);try{Kt.call(t)}catch{return!0}return t instanceof Map}catch{}return!1}function Zs(t){if(!_t||!t||typeof t!="object")return!1;try{_t.call(t,_t);try{bt.call(t,bt)}catch{return!0}return t instanceof WeakMap}catch{}return!1}function eu(t){if(!mi||!t||typeof t!="object")return!1;try{return mi.call(t),!0}catch{}return!1}function tu(t){if(!Kt||!t||typeof t!="object")return!1;try{Kt.call(t);try{Jt.call(t)}catch{return!0}return t instanceof Set}catch{}return!1}function ru(t){if(!bt||!t||typeof t!="object")return!1;try{bt.call(t,bt);try{_t.call(t,_t)}catch{return!0}return t instanceof WeakSet}catch{}return!1}function nu(t){return!t||typeof t!="object"?!1:typeof HTMLElement<"u"&&t instanceof HTMLElement?!0:typeof t.nodeName=="string"&&typeof t.getAttribute=="function"}function Fi(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return Fi(Gr.call(t,0,e.maxStringLength),e)+n}var a=Te.call(Te.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,iu);return Bi(a,"single",e)}function iu(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+ks.call(e.toString(16))}function Et(t){return"Object("+t+")"}function Kr(t){return t+" { ? }"}function Pi(t,e,r,n){var a=n?Qr(r,n):me.call(r,", ");return t+" ("+e+") {"+a+"}"}function ou(t){for(var e=0;e<t.length;e++)if(Ri(t[e],`
18
- `)>=0)return!1;return!0}function au(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=me.call(Array(t.indent+1)," ");else return null;return{base:r,prev:me.call(Array(e+1),r)}}function Qr(t,e){if(t.length===0)return"";var r=`
19
- `+e.prev+e.base;return r+me.call(t,","+r)+`
20
- `+e.prev}function Qt(t,e){var r=Jr(t),n=[];if(r){n.length=t.length;for(var a=0;a<t.length;a++)n[a]=Re(t,a)?e(t[a],t):""}var s=typeof Hr=="function"?Hr(t):[],f;if(rt){f={};for(var p=0;p<s.length;p++)f["$"+s[p]]=s[p]}for(var h in t)Re(t,h)&&(r&&String(Number(h))===h&&h<t.length||rt&&f["$"+h]instanceof Symbol||(vi.call(/[^\w$]/,h)?n.push(e(h,t)+": "+e(t[h],t)):n.push(h+": "+e(t[h],t))));if(typeof Hr=="function")for(var m=0;m<s.length;m++)Ei.call(t,s[m])&&n.push("["+e(s[m])+"]: "+e(t[s[m]],t));return n}var Zr=Sr,nt=da,su=qs,uu=Zr("%TypeError%"),Zt=Zr("%WeakMap%",!0),er=Zr("%Map%",!0),cu=nt("WeakMap.prototype.get",!0),fu=nt("WeakMap.prototype.set",!0),lu=nt("WeakMap.prototype.has",!0),pu=nt("Map.prototype.get",!0),hu=nt("Map.prototype.set",!0),du=nt("Map.prototype.has",!0),en=function(t,e){for(var r=t,n;(n=r.next)!==null;r=n)if(n.key===e)return r.next=n.next,n.next=t.next,t.next=n,n},yu=function(t,e){var r=en(t,e);return r&&r.value},gu=function(t,e,r){var n=en(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},mu=function(t,e){return!!en(t,e)},wu=function(){var e,r,n,a={assert:function(s){if(!a.has(s))throw new uu("Side channel does not contain "+su(s))},get:function(s){if(Zt&&s&&(typeof s=="object"||typeof s=="function")){if(e)return cu(e,s)}else if(er){if(r)return pu(r,s)}else if(n)return yu(n,s)},has:function(s){if(Zt&&s&&(typeof s=="object"||typeof s=="function")){if(e)return lu(e,s)}else if(er){if(r)return du(r,s)}else if(n)return mu(n,s);return!1},set:function(s,f){Zt&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new Zt),fu(e,s,f)):er?(r||(r=new er),hu(r,s,f)):(n||(n={key:{},next:null}),gu(n,s,f))}};return a},vu=String.prototype.replace,_u=/%20/g,tn={RFC1738:"RFC1738",RFC3986:"RFC3986"},$i={default:tn.RFC3986,formatters:{RFC1738:function(t){return vu.call(t,_u,"+")},RFC3986:function(t){return String(t)}},RFC1738:tn.RFC1738,RFC3986:tn.RFC3986},bu=$i,rn=Object.prototype.hasOwnProperty,Ve=Array.isArray,we=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),Eu=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(Ve(n)){for(var a=[],s=0;s<n.length;++s)typeof n[s]<"u"&&a.push(n[s]);r.obj[r.prop]=a}}},Ui=function(e,r){for(var n=r&&r.plainObjects?Object.create(null):{},a=0;a<e.length;++a)typeof e[a]<"u"&&(n[a]=e[a]);return n},Au=function t(e,r,n){if(!r)return e;if(typeof r!="object"){if(Ve(e))e.push(r);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!rn.call(Object.prototype,r))&&(e[r]=!0);else return[e,r];return e}if(!e||typeof e!="object")return[e].concat(r);var a=e;return Ve(e)&&!Ve(r)&&(a=Ui(e,n)),Ve(e)&&Ve(r)?(r.forEach(function(s,f){if(rn.call(e,f)){var p=e[f];p&&typeof p=="object"&&s&&typeof s=="object"?e[f]=t(p,s,n):e.push(s)}else e[f]=s}),e):Object.keys(r).reduce(function(s,f){var p=r[f];return rn.call(s,f)?s[f]=t(s[f],p,n):s[f]=p,s},a)},xu=function(e,r){return Object.keys(r).reduce(function(n,a){return n[a]=r[a],n},e)},Su=function(t,e,r){var n=t.replace(/\+/g," ");if(r==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},Iu=function(e,r,n,a,s){if(e.length===0)return e;var f=e;if(typeof e=="symbol"?f=Symbol.prototype.toString.call(e):typeof e!="string"&&(f=String(e)),n==="iso-8859-1")return escape(f).replace(/%u[0-9a-f]{4}/gi,function(v){return"%26%23"+parseInt(v.slice(2),16)+"%3B"});for(var p="",h=0;h<f.length;++h){var m=f.charCodeAt(h);if(m===45||m===46||m===95||m===126||m>=48&&m<=57||m>=65&&m<=90||m>=97&&m<=122||s===bu.RFC1738&&(m===40||m===41)){p+=f.charAt(h);continue}if(m<128){p=p+we[m];continue}if(m<2048){p=p+(we[192|m>>6]+we[128|m&63]);continue}if(m<55296||m>=57344){p=p+(we[224|m>>12]+we[128|m>>6&63]+we[128|m&63]);continue}h+=1,m=65536+((m&1023)<<10|f.charCodeAt(h)&1023),p+=we[240|m>>18]+we[128|m>>12&63]+we[128|m>>6&63]+we[128|m&63]}return p},Bu=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],a=0;a<r.length;++a)for(var s=r[a],f=s.obj[s.prop],p=Object.keys(f),h=0;h<p.length;++h){var m=p[h],v=f[m];typeof v=="object"&&v!==null&&n.indexOf(v)===-1&&(r.push({obj:f,prop:m}),n.push(v))}return Eu(r),e},Ou=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Tu=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Ru=function(e,r){return[].concat(e,r)},Fu=function(e,r){if(Ve(e)){for(var n=[],a=0;a<e.length;a+=1)n.push(r(e[a]));return n}return r(e)},Pu={arrayToObject:Ui,assign:xu,combine:Ru,compact:Bu,decode:Su,encode:Iu,isBuffer:Tu,isRegExp:Ou,maybeMap:Fu,merge:Au},Ci=wu,tr=Pu,At=$i,$u=Object.prototype.hasOwnProperty,Di={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},Ae=Array.isArray,Uu=Array.prototype.push,Ni=function(t,e){Uu.apply(t,Ae(e)?e:[e])},Cu=Date.prototype.toISOString,Mi=At.default,Q={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:tr.encode,encodeValuesOnly:!1,format:Mi,formatter:At.formatters[Mi],indices:!1,serializeDate:function(e){return Cu.call(e)},skipNulls:!1,strictNullHandling:!1},Du=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},nn={},Nu=function t(e,r,n,a,s,f,p,h,m,v,_,b,y,x,I,O){for(var S=e,T=O,F=0,R=!1;(T=T.get(nn))!==void 0&&!R;){var D=T.get(e);if(F+=1,typeof D<"u"){if(D===F)throw new RangeError("Cyclic object value");R=!0}typeof T.get(nn)>"u"&&(F=0)}if(typeof h=="function"?S=h(r,S):S instanceof Date?S=_(S):n==="comma"&&Ae(S)&&(S=tr.maybeMap(S,function(ie){return ie instanceof Date?_(ie):ie})),S===null){if(s)return p&&!x?p(r,Q.encoder,I,"key",b):r;S=""}if(Du(S)||tr.isBuffer(S)){if(p){var N=x?r:p(r,Q.encoder,I,"key",b);return[y(N)+"="+y(p(S,Q.encoder,I,"value",b))]}return[y(r)+"="+y(String(S))]}var V=[];if(typeof S>"u")return V;var k;if(n==="comma"&&Ae(S))x&&p&&(S=tr.maybeMap(S,p)),k=[{value:S.length>0?S.join(",")||null:void 0}];else if(Ae(h))k=h;else{var ee=Object.keys(S);k=m?ee.sort(m):ee}for(var z=a&&Ae(S)&&S.length===1?r+"[]":r,ue=0;ue<k.length;++ue){var Y=k[ue],M=typeof Y=="object"&&typeof Y.value<"u"?Y.value:S[Y];if(!(f&&M===null)){var ne=Ae(S)?typeof n=="function"?n(z,Y):z:z+(v?"."+Y:"["+Y+"]");O.set(e,F);var L=Ci();L.set(nn,O),Ni(V,t(M,ne,n,a,s,f,n==="comma"&&x&&Ae(S)?null:p,h,m,v,_,b,y,x,I,L))}}return V},Mu=function(e){if(!e)return Q;if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var r=e.charset||Q.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=At.default;if(typeof e.format<"u"){if(!$u.call(At.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var a=At.formatters[n],s=Q.filter;return(typeof e.filter=="function"||Ae(e.filter))&&(s=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:Q.addQueryPrefix,allowDots:typeof e.allowDots>"u"?Q.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Q.charsetSentinel,delimiter:typeof e.delimiter>"u"?Q.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Q.encode,encoder:typeof e.encoder=="function"?e.encoder:Q.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Q.encodeValuesOnly,filter:s,format:n,formatter:a,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Q.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Q.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Q.strictNullHandling}},Lu=function(t,e){var r=t,n=Mu(e),a,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):Ae(n.filter)&&(s=n.filter,a=s);var f=[];if(typeof r!="object"||r===null)return"";var p;e&&e.arrayFormat in Di?p=e.arrayFormat:e&&"indices"in e?p=e.indices?"indices":"repeat":p="indices";var h=Di[p];if(e&&"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var m=h==="comma"&&e&&e.commaRoundTrip;a||(a=Object.keys(r)),n.sort&&a.sort(n.sort);for(var v=Ci(),_=0;_<a.length;++_){var b=a[_];n.skipNulls&&r[b]===null||Ni(f,Nu(r[b],b,h,m,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,v))}var y=f.join(n.delimiter),x=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?x+="utf8=%26%2310003%3B&":x+="utf8=%E2%9C%93&"),y.length>0?x+y:""},ku=$e(Lu);let Li={storeIdentifier:"",environment:"prod"};function ju(t){Li=t}function ve(){return Li}const qu=(t,e="")=>{switch(t){case"prod":return"https://api.rechargeapps.com";case"stage":return"https://api.stage.rechargeapps.com";case"preprod":case"prestage":return`${e}/api`}},rr=(t,e="")=>{switch(t){case"prod":return"https://admin.rechargeapps.com";case"stage":return"https://admin.stage.rechargeapps.com";case"preprod":case"prestage":return e}},Vu=t=>{switch(t){case"prod":case"preprod":return"https://static.rechargecdn.com";case"stage":case"prestage":return"https://static.stage.rechargecdn.com"}},zu="/tools/recurring";class nr{constructor(e,r){this.name="RechargeRequestError",this.message=e,this.status=r}}function Gu(t){return ku(t,{encode:!1,indices:!1,arrayFormat:"comma"})}async function ir(t,e,r={}){const n=ve();return se(t,`${Vu(n.environment)}/store/${n.storeIdentifier}${e}`,r)}async function B(t,e,{id:r,query:n,data:a,headers:s}={},f){const{environment:p,environmentUri:h,storeIdentifier:m,loginRetryFn:v}=ve(),_=f.apiToken,b=qu(p,h),y={"X-Recharge-Access-Token":_,"X-Recharge-Version":"2021-11",...s||{}},x={shop_url:m,...n};try{return await se(t,`${b}${e}`,{id:r,query:x,data:a,headers:y})}catch(I){if(v&&I instanceof nr&&I.status===401)return v().then(O=>{if(O)return se(t,`${b}${e}`,{id:r,query:x,data:a,headers:{...y,"X-Recharge-Access-Token":O.apiToken}});throw I});throw I}}async function xt(t,e,r={}){return se(t,`${zu}${e}`,r)}async function se(t,e,{id:r,query:n,data:a,headers:s}={}){let f=e.trim();if(r&&(f=[f,`${r}`.trim()].join("/")),n){let _;[f,_]=f.split("?");const b=[_,Gu(n)].join("&").replace(/^&/,"");f=`${f}${b?`?${b}`:""}`}let p;a&&t!=="get"&&(p=JSON.stringify(a));const h={Accept:"application/json","Content-Type":"application/json","X-Recharge-App":"storefront-client",...s||{}},m=await fetch(f,{method:t,headers:h,body:p});let v;try{v=await m.json()}catch{}if(!m.ok)throw v&&v.error?new nr(v.error,m.status):v&&v.errors?new nr(JSON.stringify(v.errors),m.status):new nr("A connection error occurred while making the request");return v}function Wu(t,e){return B("get","/addresses",{query:e},t)}async function Hu(t,e,r){const{address:n}=await B("get","/addresses",{id:e,query:{include:r?.include}},t);return n}async function Yu(t,e){const{address:r}=await B("post","/addresses",{data:{customer_id:t.customerId?Number(t.customerId):void 0,...e}},t);return r}async function on(t,e,r){const{address:n}=await B("put","/addresses",{id:e,data:r},t);return n}async function Xu(t,e,r){return on(t,e,{discounts:[{code:r}]})}async function Ju(t,e){return on(t,e,{discounts:[]})}function Ku(t,e){return B("delete","/addresses",{id:e},t)}async function Qu(t,e){const{address:r}=await B("post","/addresses/merge",{data:e},t);return r}async function Zu(t,e,r){const{charge:n}=await B("post",`/addresses/${e}/charges/skip`,{data:r},t);return n}var ec=Object.freeze({__proto__:null,applyDiscountToAddress:Xu,createAddress:Yu,deleteAddress:Ku,getAddress:Hu,listAddresses:Wu,mergeAddresses:Qu,removeDiscountsFromAddress:Ju,skipFutureCharge:Zu,updateAddress:on});async function tc(){const{storefrontAccessToken:t}=ve(),e={};t&&(e["X-Recharge-Storefront-Access-Token"]=t);const r=await xt("get","/access",{headers:e});return{apiToken:r.api_token,customerId:r.customer_id,message:r.message}}async function rc(t,e){const{environment:r,environmentUri:n,storefrontAccessToken:a,storeIdentifier:s}=ve(),f=rr(r,n),p={};a&&(p["X-Recharge-Storefront-Access-Token"]=a);const{api_token:h,customer_id:m,message:v}=await se("post",`${f}/shopify_storefront_access`,{data:{customer_token:e,storefront_token:t,shop_url:s},headers:p});return h?{apiToken:h,customerId:m,message:v}:null}async function nc(t,e={}){const{environment:r,environmentUri:n,storefrontAccessToken:a,storeIdentifier:s}=ve(),f=rr(r,n),p={};a&&(p["X-Recharge-Storefront-Access-Token"]=a);const h=await se("post",`${f}/attempt_login`,{data:{email:t,shop:s,...e},headers:p});if(h.errors)throw new Error(h.errors);return h.session_token}async function ic(t,e={}){const{storefrontAccessToken:r}=ve(),n={};r&&(n["X-Recharge-Storefront-Access-Token"]=r);const a=await xt("post","/attempt_login",{data:{email:t,...e},headers:n});if(a.errors)throw new Error(a.errors);return a.session_token}async function oc(t,e,r){const{environment:n,environmentUri:a,storefrontAccessToken:s,storeIdentifier:f}=ve(),p=rr(n,a),h={};s&&(h["X-Recharge-Storefront-Access-Token"]=s);const m=await se("post",`${p}/validate_login`,{data:{code:r,email:t,session_token:e,shop:f},headers:h});if(m.errors)throw new Error(m.errors);return{apiToken:m.api_token,customerId:m.customer_id}}async function ac(t,e,r){const{storefrontAccessToken:n}=ve(),a={};n&&(a["X-Recharge-Storefront-Access-Token"]=n);const s=await xt("post","/validate_login",{data:{code:r,email:t,session_token:e},headers:a});if(s.errors)throw new Error(s.errors);return{apiToken:s.api_token,customerId:s.customer_id}}function sc(){const{pathname:t,search:e}=window.location,r=new URLSearchParams(e).get("token"),n=t.split("/").filter(Boolean),a=n.findIndex(f=>f==="portal"),s=a!==-1?n[a+1]:void 0;if(!r||!s)throw new Error("Not in context of Recharge Customer Portal or URL did not contain correct params");return{customerHash:s,token:r}}async function uc(){const{customerHash:t,token:e}=sc(),{environment:r,environmentUri:n,storefrontAccessToken:a,storeIdentifier:s}=ve(),f=rr(r,n),p={};a&&(p["X-Recharge-Storefront-Access-Token"]=a);const h=await se("post",`${f}/customers/${t}/access`,{headers:p,data:{token:e,shop:s}});return{apiToken:h.api_token,customerId:h.customer_id}}var cc=Object.freeze({__proto__:null,loginCustomerPortal:uc,loginShopifyApi:rc,loginShopifyAppProxy:tc,sendPasswordlessCode:nc,sendPasswordlessCodeAppProxy:ic,validatePasswordlessCode:oc,validatePasswordlessCodeAppProxy:ac});let fc=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,r)=>(r&=63,r<36?e+=r.toString(36):r<62?e+=(r-26).toString(36).toUpperCase():r>62?e+="-":e+="_",e),"");var ki={exports:{}};/*! For license information please see xdr.js.LICENSE.txt */(function(t,e){(function(r,n){t.exports=n()})(oe,()=>(()=>{var r={899:(s,f,p)=>{const h=p(221);s.exports=h},221:(s,f,p)=>{p.r(f),p.d(f,{Array:()=>lt,Bool:()=>G,Double:()=>hr,Enum:()=>_e,Float:()=>pr,Hyper:()=>M,Int:()=>z,Opaque:()=>Pt,Option:()=>Ut,Quadruple:()=>j,Reference:()=>Z,String:()=>Ft,Struct:()=>Pe,Union:()=>Ie,UnsignedHyper:()=>le,UnsignedInt:()=>L,VarArray:()=>$t,VarOpaque:()=>Se,Void:()=>X,config:()=>g});class h extends TypeError{constructor(o){super(`XDR Write Error: ${o}`)}}class m extends TypeError{constructor(o){super(`XDR Read Error: ${o}`)}}class v extends TypeError{constructor(o){super(`XDR Type Definition Error: ${o}`)}}class _ extends v{constructor(){super("method not implemented, it should be overloaded in the descendant class.")}}var b=p(764).lW;class y{constructor(o){if(!b.isBuffer(o)){if(!(o instanceof Array))throw new m("source not specified");o=b.from(o)}this._buffer=o,this._length=o.length,this._index=0}_buffer;_length;_index;get eof(){return this._index===this._length}advance(o){const l=this._index;if(this._index+=o,this._length<this._index)throw new m("attempt to read outside the boundary of the buffer");const w=4-(o%4||4);if(w>0){for(let A=0;A<w;A++)if(this._buffer[this._index+A]!==0)throw new m("invalid padding");this._index+=w}return l}rewind(){this._index=0}read(o){const l=this.advance(o);return this._buffer.subarray(l,l+o)}readInt32BE(){return this._buffer.readInt32BE(this.advance(4))}readUInt32BE(){return this._buffer.readUInt32BE(this.advance(4))}readBigInt64BE(){return this._buffer.readBigInt64BE(this.advance(8))}readBigUInt64BE(){return this._buffer.readBigUInt64BE(this.advance(8))}readFloatBE(){return this._buffer.readFloatBE(this.advance(4))}readDoubleBE(){return this._buffer.readDoubleBE(this.advance(8))}ensureInputConsumed(){if(this._index!==this._length)throw new m("invalid XDR contract typecast - source buffer not entirely consumed")}}var x=p(764).lW;const I=8192;class O{constructor(o){typeof o=="number"?o=x.allocUnsafe(o):o instanceof x||(o=x.allocUnsafe(I)),this._buffer=o,this._length=o.length}_buffer;_length;_index=0;alloc(o){const l=this._index;return this._index+=o,this._length<this._index&&this.resize(this._index),l}resize(o){const l=Math.ceil(o/I)*I,w=x.allocUnsafe(l);this._buffer.copy(w,0,0,this._length),this._buffer=w,this._length=l}finalize(){return this._buffer.subarray(0,this._index)}toArray(){return[...this.finalize()]}write(o,l){if(typeof o=="string"){const A=this.alloc(l);this._buffer.write(o,A,"utf8")}else{o instanceof x||(o=x.from(o));const A=this.alloc(l);o.copy(this._buffer,A,0,l)}const w=4-(l%4||4);if(w>0){const A=this.alloc(w);this._buffer.fill(0,A,this._index)}}writeInt32BE(o){const l=this.alloc(4);this._buffer.writeInt32BE(o,l)}writeUInt32BE(o){const l=this.alloc(4);this._buffer.writeUInt32BE(o,l)}writeBigInt64BE(o){const l=this.alloc(8);this._buffer.writeBigInt64BE(o,l)}writeBigUInt64BE(o){const l=this.alloc(8);this._buffer.writeBigUInt64BE(o,l)}writeFloatBE(o){const l=this.alloc(4);this._buffer.writeFloatBE(o,l)}writeDoubleBE(o){const l=this.alloc(8);this._buffer.writeDoubleBE(o,l)}static bufferChunkSize=I}var S=p(764).lW;class T{toXDR(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"raw";if(!this.write)return this.constructor.toXDR(this,o);const l=new O;return this.write(this,l),N(l.finalize(),o)}fromXDR(o){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"raw";if(!this.read)return this.constructor.fromXDR(o,l);const w=new y(V(o,l)),A=this.read(w);return w.ensureInputConsumed(),A}validateXDR(o){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"raw";try{return this.fromXDR(o,l),!0}catch{return!1}}static toXDR(o){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"raw";const w=new O;return this.write(o,w),N(w.finalize(),l)}static fromXDR(o){const l=new y(V(o,arguments.length>1&&arguments[1]!==void 0?arguments[1]:"raw")),w=this.read(l);return l.ensureInputConsumed(),w}static validateXDR(o){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"raw";try{return this.fromXDR(o,l),!0}catch{return!1}}}class F extends T{static read(o){throw new _}static write(o,l){throw new _}static isValid(o){return!1}}class R extends T{isValid(o){return!1}}class D extends TypeError{constructor(o){super(`Invalid format ${o}, must be one of "raw", "hex", "base64"`)}}function N(d,o){switch(o){case"raw":return d;case"hex":return d.toString("hex");case"base64":return d.toString("base64");default:throw new D(o)}}function V(d,o){switch(o){case"raw":return d;case"hex":return S.from(d,"hex");case"base64":return S.from(d,"base64");default:throw new D(o)}}const k=2147483647,ee=-2147483648;class z extends F{static read(o){return o.readInt32BE()}static write(o,l){if(typeof o!="number")throw new h("not a number");if((0|o)!==o)throw new h("invalid i32 value");l.writeInt32BE(o)}static isValid(o){return typeof o=="number"&&(0|o)===o&&o>=ee&&o<=k}}z.MAX_VALUE=k,z.MIN_VALUE=2147483648;const ue=-9223372036854775808n,Y=9223372036854775807n;class M extends F{constructor(o,l){if(super(),typeof o=="bigint"){if(o<ue||o>Y)throw new TypeError("Invalid i64 value");this._value=o}else{if((0|o)!==o||(0|l)!==l)throw new TypeError("Invalid i64 value");this._value=BigInt(l>>>0)<<32n|BigInt(o>>>0)}}get low(){return Number(0xFFFFFFFFn&this._value)<<0}get high(){return Number(this._value>>32n)>>0}get unsigned(){return!1}toString(){return this._value.toString()}toJSON(){return{_value:this._value.toString()}}static read(o){return new M(o.readBigInt64BE())}static write(o,l){if(!(o instanceof this))throw new h(`${o} is not a Hyper`);l.writeBigInt64BE(o._value)}static fromString(o){if(!/^-?\d{0,19}$/.test(o))throw new TypeError(`Invalid i64 string value: ${o}`);return new M(BigInt(o))}static fromBits(o,l){return new this(o,l)}static isValid(o){return o instanceof this}}M.MAX_VALUE=new M(Y),M.MIN_VALUE=new M(ue);const ne=4294967295;class L extends F{static read(o){return o.readUInt32BE()}static write(o,l){if(typeof o!="number"||!(o>=0&&o<=ne)||o%1!=0)throw new h("invalid u32 value");l.writeUInt32BE(o)}static isValid(o){return typeof o=="number"&&o%1==0&&o>=0&&o<=ne}}L.MAX_VALUE=ne,L.MIN_VALUE=0;const ie=0n,lr=0xFFFFFFFFFFFFFFFFn;class le extends F{constructor(o,l){if(super(),typeof o=="bigint"){if(o<ie||o>lr)throw new TypeError("Invalid u64 value");this._value=o}else{if((0|o)!==o||(0|l)!==l)throw new TypeError("Invalid u64 value");this._value=BigInt(l>>>0)<<32n|BigInt(o>>>0)}}get low(){return Number(0xFFFFFFFFn&this._value)<<0}get high(){return Number(this._value>>32n)>>0}get unsigned(){return!0}toString(){return this._value.toString()}toJSON(){return{_value:this._value.toString()}}static read(o){return new le(o.readBigUInt64BE())}static write(o,l){if(!(o instanceof this))throw new h(`${o} is not an UnsignedHyper`);l.writeBigUInt64BE(o._value)}static fromString(o){if(!/^\d{0,20}$/.test(o))throw new TypeError(`Invalid u64 string value: ${o}`);return new le(BigInt(o))}static fromBits(o,l){return new this(o,l)}static isValid(o){return o instanceof this}}le.MAX_VALUE=new le(lr),le.MIN_VALUE=new le(ie);class pr extends F{static read(o){return o.readFloatBE()}static write(o,l){if(typeof o!="number")throw new h("not a number");l.writeFloatBE(o)}static isValid(o){return typeof o=="number"}}class hr extends F{static read(o){return o.readDoubleBE()}static write(o,l){if(typeof o!="number")throw new h("not a number");l.writeDoubleBE(o)}static isValid(o){return typeof o=="number"}}class j extends F{static read(){throw new v("quadruple not supported")}static write(){throw new v("quadruple not supported")}static isValid(){return!1}}class G extends F{static read(o){const l=z.read(o);switch(l){case 0:return!1;case 1:return!0;default:throw new m(`got ${l} when trying to read a bool`)}}static write(o,l){const w=o?1:0;z.write(w,l)}static isValid(o){return typeof o=="boolean"}}var ft=p(764).lW;class Ft extends R{constructor(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:L.MAX_VALUE;super(),this._maxLength=o}read(o){const l=L.read(o);if(l>this._maxLength)throw new m(`saw ${l} length String, max allowed is ${this._maxLength}`);return o.read(l)}readString(o){return this.read(o).toString("utf8")}write(o,l){const w=typeof o=="string"?ft.byteLength(o,"utf8"):o.length;if(w>this._maxLength)throw new h(`got ${o.length} bytes, max allowed is ${this._maxLength}`);L.write(w,l),l.write(o,w)}isValid(o){return typeof o=="string"?ft.byteLength(o,"utf8")<=this._maxLength:!!(o instanceof Array||ft.isBuffer(o))&&o.length<=this._maxLength}}var dr=p(764).lW;class Pt extends R{constructor(o){super(),this._length=o}read(o){return o.read(this._length)}write(o,l){const{length:w}=o;if(w!==this._length)throw new h(`got ${o.length} bytes, expected ${this._length}`);l.write(o,w)}isValid(o){return dr.isBuffer(o)&&o.length===this._length}}var yr=p(764).lW;class Se extends R{constructor(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:L.MAX_VALUE;super(),this._maxLength=o}read(o){const l=L.read(o);if(l>this._maxLength)throw new m(`saw ${l} length VarOpaque, max allowed is ${this._maxLength}`);return o.read(l)}write(o,l){const{length:w}=o;if(o.length>this._maxLength)throw new h(`got ${o.length} bytes, max allowed is ${this._maxLength}`);L.write(w,l),l.write(o,w)}isValid(o){return yr.isBuffer(o)&&o.length<=this._maxLength}}class lt extends R{constructor(o,l){super(),this._childType=o,this._length=l}read(o){const l=new p.g.Array(this._length);for(let w=0;w<this._length;w++)l[w]=this._childType.read(o);return l}write(o,l){if(!(o instanceof p.g.Array))throw new h("value is not array");if(o.length!==this._length)throw new h(`got array of size ${o.length}, expected ${this._length}`);for(const w of o)this._childType.write(w,l)}isValid(o){if(!(o instanceof p.g.Array)||o.length!==this._length)return!1;for(const l of o)if(!this._childType.isValid(l))return!1;return!0}}class $t extends R{constructor(o){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:L.MAX_VALUE;super(),this._childType=o,this._maxLength=l}read(o){const l=L.read(o);if(l>this._maxLength)throw new m(`saw ${l} length VarArray, max allowed is ${this._maxLength}`);const w=new Array(l);for(let A=0;A<l;A++)w[A]=this._childType.read(o);return w}write(o,l){if(!(o instanceof Array))throw new h("value is not array");if(o.length>this._maxLength)throw new h(`got array of size ${o.length}, max allowed is ${this._maxLength}`);L.write(o.length,l);for(const w of o)this._childType.write(w,l)}isValid(o){if(!(o instanceof Array)||o.length>this._maxLength)return!1;for(const l of o)if(!this._childType.isValid(l))return!1;return!0}}class Ut extends F{constructor(o){super(),this._childType=o}read(o){if(G.read(o))return this._childType.read(o)}write(o,l){const w=o!=null;G.write(w,l),w&&this._childType.write(o,l)}isValid(o){return o==null||this._childType.isValid(o)}}class X extends F{static read(){}static write(o){if(o!==void 0)throw new h("trying to write value to a void slot")}static isValid(o){return o===void 0}}class _e extends F{constructor(o,l){super(),this.name=o,this.value=l}static read(o){const l=z.read(o),w=this._byValue[l];if(w===void 0)throw new m(`unknown ${this.enumName} member for value ${l}`);return w}static write(o,l){if(!(o instanceof this))throw new h(`unknown ${o} is not a ${this.enumName}`);z.write(o.value,l)}static isValid(o){return o instanceof this}static members(){return this._members}static values(){return Object.values(this._members)}static fromName(o){const l=this._members[o];if(!l)throw new TypeError(`${o} is not a member of ${this.enumName}`);return l}static fromValue(o){const l=this._byValue[o];if(l===void 0)throw new TypeError(`${o} is not a value of any member of ${this.enumName}`);return l}static create(o,l,w){const A=class extends _e{};A.enumName=l,o.results[l]=A,A._members={},A._byValue={};for(const[$,P]of Object.entries(w)){const U=new A($,P);A._members[$]=U,A._byValue[P]=U,A[$]=()=>U}return A}}class Z extends F{resolve(){throw new v('"resolve" method should be implemented in the descendant class')}}class Pe extends F{constructor(o){super(),this._attributes=o||{}}static read(o){const l={};for(const[w,A]of this._fields)l[w]=A.read(o);return new this(l)}static write(o,l){if(!(o instanceof this))throw new h(`${o} is not a ${this.structName}`);for(const[w,A]of this._fields){const $=o._attributes[w];A.write($,l)}}static isValid(o){return o instanceof this}static create(o,l,w){const A=class extends Pe{};A.structName=l,o.results[l]=A;const $=new Array(w.length);for(let P=0;P<w.length;P++){const U=w[P],Ct=U[0];let mr=U[1];mr instanceof Z&&(mr=mr.resolve(o)),$[P]=[Ct,mr],A.prototype[Ct]=gr(Ct)}return A._fields=$,A}}function gr(d){return function(o){return o!==void 0&&(this._attributes[d]=o),this._attributes[d]}}class Ie extends R{constructor(o,l){super(),this.set(o,l)}set(o,l){typeof o=="string"&&(o=this.constructor._switchOn.fromName(o)),this._switch=o;const w=this.constructor.armForSwitch(this._switch);this._arm=w,this._armType=w===X?X:this.constructor._arms[w],this._value=l}get(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this._arm;if(this._arm!==X&&this._arm!==o)throw new TypeError(`${o} not set`);return this._value}switch(){return this._switch}arm(){return this._arm}armType(){return this._armType}value(){return this._value}static armForSwitch(o){const l=this._switches.get(o);if(l!==void 0)return l;if(this._defaultArm)return this._defaultArm;throw new TypeError(`Bad union switch: ${o}`)}static armTypeForArm(o){return o===X?X:this._arms[o]}static read(o){const l=this._switchOn.read(o),w=this.armForSwitch(l),A=w===X?X:this._arms[w];let $;return $=A!==void 0?A.read(o):w.read(o),new this(l,$)}static write(o,l){if(!(o instanceof this))throw new h(`${o} is not a ${this.unionName}`);this._switchOn.write(o.switch(),l),o.armType().write(o.value(),l)}static isValid(o){return o instanceof this}static create(o,l,w){const A=class extends Ie{};A.unionName=l,o.results[l]=A,w.switchOn instanceof Z?A._switchOn=w.switchOn.resolve(o):A._switchOn=w.switchOn,A._switches=new Map,A._arms={};let $=w.defaultArm;$ instanceof Z&&($=$.resolve(o)),A._defaultArm=$;for(const[P,U]of w.switches){const Ct=typeof P=="string"?A._switchOn.fromName(P):P;A._switches.set(Ct,U)}if(A._switchOn.values!==void 0)for(const P of A._switchOn.values())A[P.name]=function(U){return new A(P,U)},A.prototype[P.name]=function(U){return this.set(P,U)};if(w.arms)for(const[P,U]of Object.entries(w.arms))A._arms[P]=U instanceof Z?U.resolve(o):U,U!==X&&(A.prototype[P]=function(){return this.get(P)});return A}}class ce extends Z{constructor(o){super(),this.name=o}resolve(o){return o.definitions[this.name].resolve(o)}}class pt extends Z{constructor(o,l){let w=arguments.length>2&&arguments[2]!==void 0&&arguments[2];super(),this.childReference=o,this.length=l,this.variable=w}resolve(o){let l=this.childReference,w=this.length;return l instanceof Z&&(l=l.resolve(o)),w instanceof Z&&(w=w.resolve(o)),this.variable?new $t(l,w):new lt(l,w)}}class xn extends Z{constructor(o){super(),this.childReference=o,this.name=o.name}resolve(o){let l=this.childReference;return l instanceof Z&&(l=l.resolve(o)),new Ut(l)}}class fe extends Z{constructor(o,l){super(),this.sizedType=o,this.length=l}resolve(o){let l=this.length;return l instanceof Z&&(l=l.resolve(o)),new this.sizedType(l)}}class He{constructor(o,l,w){this.constructor=o,this.name=l,this.config=w}resolve(o){return this.name in o.results?o.results[this.name]:this.constructor(o,this.name,this.config)}}function i(d,o,l){return l instanceof Z&&(l=l.resolve(d)),d.results[o]=l,l}function u(d,o,l){return d.results[o]=l,l}class c{constructor(o){this._destination=o,this._definitions={}}enum(o,l){const w=new He(_e.create,o,l);this.define(o,w)}struct(o,l){const w=new He(Pe.create,o,l);this.define(o,w)}union(o,l){const w=new He(Ie.create,o,l);this.define(o,w)}typedef(o,l){const w=new He(i,o,l);this.define(o,w)}const(o,l){const w=new He(u,o,l);this.define(o,w)}void(){return X}bool(){return G}int(){return z}hyper(){return M}uint(){return L}uhyper(){return le}float(){return pr}double(){return hr}quadruple(){return j}string(o){return new fe(Ft,o)}opaque(o){return new fe(Pt,o)}varOpaque(o){return new fe(Se,o)}array(o,l){return new pt(o,l)}varArray(o,l){return new pt(o,l,!0)}option(o){return new xn(o)}define(o,l){if(this._destination[o]!==void 0)throw new v(`${o} is already defined`);this._definitions[o]=l}lookup(o){return new ce(o)}resolve(){for(const o of Object.values(this._definitions))o.resolve({definitions:this._definitions,results:this._destination})}}function g(d){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(d){const l=new c(o);d(l),l.resolve()}return o}},742:(s,f)=>{f.byteLength=function(x){var I=b(x),O=I[0],S=I[1];return 3*(O+S)/4-S},f.toByteArray=function(x){var I,O,S=b(x),T=S[0],F=S[1],R=new m(function(V,k,ee){return 3*(k+ee)/4-ee}(0,T,F)),D=0,N=F>0?T-4:T;for(O=0;O<N;O+=4)I=h[x.charCodeAt(O)]<<18|h[x.charCodeAt(O+1)]<<12|h[x.charCodeAt(O+2)]<<6|h[x.charCodeAt(O+3)],R[D++]=I>>16&255,R[D++]=I>>8&255,R[D++]=255&I;return F===2&&(I=h[x.charCodeAt(O)]<<2|h[x.charCodeAt(O+1)]>>4,R[D++]=255&I),F===1&&(I=h[x.charCodeAt(O)]<<10|h[x.charCodeAt(O+1)]<<4|h[x.charCodeAt(O+2)]>>2,R[D++]=I>>8&255,R[D++]=255&I),R},f.fromByteArray=function(x){for(var I,O=x.length,S=O%3,T=[],F=16383,R=0,D=O-S;R<D;R+=F)T.push(y(x,R,R+F>D?D:R+F));return S===1?(I=x[O-1],T.push(p[I>>2]+p[I<<4&63]+"==")):S===2&&(I=(x[O-2]<<8)+x[O-1],T.push(p[I>>10]+p[I>>4&63]+p[I<<2&63]+"=")),T.join("")};for(var p=[],h=[],m=typeof Uint8Array<"u"?Uint8Array:Array,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_=0;_<64;++_)p[_]=v[_],h[v.charCodeAt(_)]=_;function b(x){var I=x.length;if(I%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var O=x.indexOf("=");return O===-1&&(O=I),[O,O===I?0:4-O%4]}function y(x,I,O){for(var S,T,F=[],R=I;R<O;R+=3)S=(x[R]<<16&16711680)+(x[R+1]<<8&65280)+(255&x[R+2]),F.push(p[(T=S)>>18&63]+p[T>>12&63]+p[T>>6&63]+p[63&T]);return F.join("")}h["-".charCodeAt(0)]=62,h["_".charCodeAt(0)]=63},764:(s,f,p)=>{const h=p(742),m=p(645),v=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;f.lW=y,f.h2=50;const _=2147483647;function b(i){if(i>_)throw new RangeError('The value "'+i+'" is invalid for option "size"');const u=new Uint8Array(i);return Object.setPrototypeOf(u,y.prototype),u}function y(i,u,c){if(typeof i=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return O(i)}return x(i,u,c)}function x(i,u,c){if(typeof i=="string")return function(o,l){if(typeof l=="string"&&l!==""||(l="utf8"),!y.isEncoding(l))throw new TypeError("Unknown encoding: "+l);const w=0|R(o,l);let A=b(w);const $=A.write(o,l);return $!==w&&(A=A.slice(0,$)),A}(i,u);if(ArrayBuffer.isView(i))return function(o){if(ce(o,Uint8Array)){const l=new Uint8Array(o);return T(l.buffer,l.byteOffset,l.byteLength)}return S(o)}(i);if(i==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i);if(ce(i,ArrayBuffer)||i&&ce(i.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ce(i,SharedArrayBuffer)||i&&ce(i.buffer,SharedArrayBuffer)))return T(i,u,c);if(typeof i=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const g=i.valueOf&&i.valueOf();if(g!=null&&g!==i)return y.from(g,u,c);const d=function(o){if(y.isBuffer(o)){const l=0|F(o.length),w=b(l);return w.length===0||o.copy(w,0,0,l),w}if(o.length!==void 0)return typeof o.length!="number"||pt(o.length)?b(0):S(o);if(o.type==="Buffer"&&Array.isArray(o.data))return S(o.data)}(i);if(d)return d;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof i[Symbol.toPrimitive]=="function")return y.from(i[Symbol.toPrimitive]("string"),u,c);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i)}function I(i){if(typeof i!="number")throw new TypeError('"size" argument must be of type number');if(i<0)throw new RangeError('The value "'+i+'" is invalid for option "size"')}function O(i){return I(i),b(i<0?0:0|F(i))}function S(i){const u=i.length<0?0:0|F(i.length),c=b(u);for(let g=0;g<u;g+=1)c[g]=255&i[g];return c}function T(i,u,c){if(u<0||i.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(i.byteLength<u+(c||0))throw new RangeError('"length" is outside of buffer bounds');let g;return g=u===void 0&&c===void 0?new Uint8Array(i):c===void 0?new Uint8Array(i,u):new Uint8Array(i,u,c),Object.setPrototypeOf(g,y.prototype),g}function F(i){if(i>=_)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+_.toString(16)+" bytes");return 0|i}function R(i,u){if(y.isBuffer(i))return i.length;if(ArrayBuffer.isView(i)||ce(i,ArrayBuffer))return i.byteLength;if(typeof i!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof i);const c=i.length,g=arguments.length>2&&arguments[2]===!0;if(!g&&c===0)return 0;let d=!1;for(;;)switch(u){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":return Pe(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*c;case"hex":return c>>>1;case"base64":return gr(i).length;default:if(d)return g?-1:Pe(i).length;u=(""+u).toLowerCase(),d=!0}}function D(i,u,c){let g=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((c===void 0||c>this.length)&&(c=this.length),c<=0)||(c>>>=0)<=(u>>>=0))return"";for(i||(i="utf8");;)switch(i){case"hex":return pr(this,u,c);case"utf8":case"utf-8":return L(this,u,c);case"ascii":return lr(this,u,c);case"latin1":case"binary":return le(this,u,c);case"base64":return ne(this,u,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return hr(this,u,c);default:if(g)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),g=!0}}function N(i,u,c){const g=i[u];i[u]=i[c],i[c]=g}function V(i,u,c,g,d){if(i.length===0)return-1;if(typeof c=="string"?(g=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),pt(c=+c)&&(c=d?0:i.length-1),c<0&&(c=i.length+c),c>=i.length){if(d)return-1;c=i.length-1}else if(c<0){if(!d)return-1;c=0}if(typeof u=="string"&&(u=y.from(u,g)),y.isBuffer(u))return u.length===0?-1:k(i,u,c,g,d);if(typeof u=="number")return u&=255,typeof Uint8Array.prototype.indexOf=="function"?d?Uint8Array.prototype.indexOf.call(i,u,c):Uint8Array.prototype.lastIndexOf.call(i,u,c):k(i,[u],c,g,d);throw new TypeError("val must be string, number or Buffer")}function k(i,u,c,g,d){let o,l=1,w=i.length,A=u.length;if(g!==void 0&&((g=String(g).toLowerCase())==="ucs2"||g==="ucs-2"||g==="utf16le"||g==="utf-16le")){if(i.length<2||u.length<2)return-1;l=2,w/=2,A/=2,c/=2}function $(P,U){return l===1?P[U]:P.readUInt16BE(U*l)}if(d){let P=-1;for(o=c;o<w;o++)if($(i,o)===$(u,P===-1?0:o-P)){if(P===-1&&(P=o),o-P+1===A)return P*l}else P!==-1&&(o-=o-P),P=-1}else for(c+A>w&&(c=w-A),o=c;o>=0;o--){let P=!0;for(let U=0;U<A;U++)if($(i,o+U)!==$(u,U)){P=!1;break}if(P)return o}return-1}function ee(i,u,c,g){c=Number(c)||0;const d=i.length-c;g?(g=Number(g))>d&&(g=d):g=d;const o=u.length;let l;for(g>o/2&&(g=o/2),l=0;l<g;++l){const w=parseInt(u.substr(2*l,2),16);if(pt(w))return l;i[c+l]=w}return l}function z(i,u,c,g){return Ie(Pe(u,i.length-c),i,c,g)}function ue(i,u,c,g){return Ie(function(d){const o=[];for(let l=0;l<d.length;++l)o.push(255&d.charCodeAt(l));return o}(u),i,c,g)}function Y(i,u,c,g){return Ie(gr(u),i,c,g)}function M(i,u,c,g){return Ie(function(d,o){let l,w,A;const $=[];for(let P=0;P<d.length&&!((o-=2)<0);++P)l=d.charCodeAt(P),w=l>>8,A=l%256,$.push(A),$.push(w);return $}(u,i.length-c),i,c,g)}function ne(i,u,c){return u===0&&c===i.length?h.fromByteArray(i):h.fromByteArray(i.slice(u,c))}function L(i,u,c){c=Math.min(i.length,c);const g=[];let d=u;for(;d<c;){const o=i[d];let l=null,w=o>239?4:o>223?3:o>191?2:1;if(d+w<=c){let A,$,P,U;switch(w){case 1:o<128&&(l=o);break;case 2:A=i[d+1],(192&A)==128&&(U=(31&o)<<6|63&A,U>127&&(l=U));break;case 3:A=i[d+1],$=i[d+2],(192&A)==128&&(192&$)==128&&(U=(15&o)<<12|(63&A)<<6|63&$,U>2047&&(U<55296||U>57343)&&(l=U));break;case 4:A=i[d+1],$=i[d+2],P=i[d+3],(192&A)==128&&(192&$)==128&&(192&P)==128&&(U=(15&o)<<18|(63&A)<<12|(63&$)<<6|63&P,U>65535&&U<1114112&&(l=U))}}l===null?(l=65533,w=1):l>65535&&(l-=65536,g.push(l>>>10&1023|55296),l=56320|1023&l),g.push(l),d+=w}return function(o){const l=o.length;if(l<=ie)return String.fromCharCode.apply(String,o);let w="",A=0;for(;A<l;)w+=String.fromCharCode.apply(String,o.slice(A,A+=ie));return w}(g)}y.TYPED_ARRAY_SUPPORT=function(){try{const i=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(i,u),i.foo()===42}catch{return!1}}(),y.TYPED_ARRAY_SUPPORT||typeof console>"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(y.prototype,"parent",{enumerable:!0,get:function(){if(y.isBuffer(this))return this.buffer}}),Object.defineProperty(y.prototype,"offset",{enumerable:!0,get:function(){if(y.isBuffer(this))return this.byteOffset}}),y.poolSize=8192,y.from=function(i,u,c){return x(i,u,c)},Object.setPrototypeOf(y.prototype,Uint8Array.prototype),Object.setPrototypeOf(y,Uint8Array),y.alloc=function(i,u,c){return function(g,d,o){return I(g),g<=0?b(g):d!==void 0?typeof o=="string"?b(g).fill(d,o):b(g).fill(d):b(g)}(i,u,c)},y.allocUnsafe=function(i){return O(i)},y.allocUnsafeSlow=function(i){return O(i)},y.isBuffer=function(i){return i!=null&&i._isBuffer===!0&&i!==y.prototype},y.compare=function(i,u){if(ce(i,Uint8Array)&&(i=y.from(i,i.offset,i.byteLength)),ce(u,Uint8Array)&&(u=y.from(u,u.offset,u.byteLength)),!y.isBuffer(i)||!y.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(i===u)return 0;let c=i.length,g=u.length;for(let d=0,o=Math.min(c,g);d<o;++d)if(i[d]!==u[d]){c=i[d],g=u[d];break}return c<g?-1:g<c?1:0},y.isEncoding=function(i){switch(String(i).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},y.concat=function(i,u){if(!Array.isArray(i))throw new TypeError('"list" argument must be an Array of Buffers');if(i.length===0)return y.alloc(0);let c;if(u===void 0)for(u=0,c=0;c<i.length;++c)u+=i[c].length;const g=y.allocUnsafe(u);let d=0;for(c=0;c<i.length;++c){let o=i[c];if(ce(o,Uint8Array))d+o.length>g.length?(y.isBuffer(o)||(o=y.from(o)),o.copy(g,d)):Uint8Array.prototype.set.call(g,o,d);else{if(!y.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(g,d)}d+=o.length}return g},y.byteLength=R,y.prototype._isBuffer=!0,y.prototype.swap16=function(){const i=this.length;if(i%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let u=0;u<i;u+=2)N(this,u,u+1);return this},y.prototype.swap32=function(){const i=this.length;if(i%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let u=0;u<i;u+=4)N(this,u,u+3),N(this,u+1,u+2);return this},y.prototype.swap64=function(){const i=this.length;if(i%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let u=0;u<i;u+=8)N(this,u,u+7),N(this,u+1,u+6),N(this,u+2,u+5),N(this,u+3,u+4);return this},y.prototype.toString=function(){const i=this.length;return i===0?"":arguments.length===0?L(this,0,i):D.apply(this,arguments)},y.prototype.toLocaleString=y.prototype.toString,y.prototype.equals=function(i){if(!y.isBuffer(i))throw new TypeError("Argument must be a Buffer");return this===i||y.compare(this,i)===0},y.prototype.inspect=function(){let i="";const u=f.h2;return i=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(i+=" ... "),"<Buffer "+i+">"},v&&(y.prototype[v]=y.prototype.inspect),y.prototype.compare=function(i,u,c,g,d){if(ce(i,Uint8Array)&&(i=y.from(i,i.offset,i.byteLength)),!y.isBuffer(i))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof i);if(u===void 0&&(u=0),c===void 0&&(c=i?i.length:0),g===void 0&&(g=0),d===void 0&&(d=this.length),u<0||c>i.length||g<0||d>this.length)throw new RangeError("out of range index");if(g>=d&&u>=c)return 0;if(g>=d)return-1;if(u>=c)return 1;if(this===i)return 0;let o=(d>>>=0)-(g>>>=0),l=(c>>>=0)-(u>>>=0);const w=Math.min(o,l),A=this.slice(g,d),$=i.slice(u,c);for(let P=0;P<w;++P)if(A[P]!==$[P]){o=A[P],l=$[P];break}return o<l?-1:l<o?1:0},y.prototype.includes=function(i,u,c){return this.indexOf(i,u,c)!==-1},y.prototype.indexOf=function(i,u,c){return V(this,i,u,c,!0)},y.prototype.lastIndexOf=function(i,u,c){return V(this,i,u,c,!1)},y.prototype.write=function(i,u,c,g){if(u===void 0)g="utf8",c=this.length,u=0;else if(c===void 0&&typeof u=="string")g=u,c=this.length,u=0;else{if(!isFinite(u))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");u>>>=0,isFinite(c)?(c>>>=0,g===void 0&&(g="utf8")):(g=c,c=void 0)}const d=this.length-u;if((c===void 0||c>d)&&(c=d),i.length>0&&(c<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");g||(g="utf8");let o=!1;for(;;)switch(g){case"hex":return ee(this,i,u,c);case"utf8":case"utf-8":return z(this,i,u,c);case"ascii":case"latin1":case"binary":return ue(this,i,u,c);case"base64":return Y(this,i,u,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,i,u,c);default:if(o)throw new TypeError("Unknown encoding: "+g);g=(""+g).toLowerCase(),o=!0}},y.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const ie=4096;function lr(i,u,c){let g="";c=Math.min(i.length,c);for(let d=u;d<c;++d)g+=String.fromCharCode(127&i[d]);return g}function le(i,u,c){let g="";c=Math.min(i.length,c);for(let d=u;d<c;++d)g+=String.fromCharCode(i[d]);return g}function pr(i,u,c){const g=i.length;(!u||u<0)&&(u=0),(!c||c<0||c>g)&&(c=g);let d="";for(let o=u;o<c;++o)d+=xn[i[o]];return d}function hr(i,u,c){const g=i.slice(u,c);let d="";for(let o=0;o<g.length-1;o+=2)d+=String.fromCharCode(g[o]+256*g[o+1]);return d}function j(i,u,c){if(i%1!=0||i<0)throw new RangeError("offset is not uint");if(i+u>c)throw new RangeError("Trying to access beyond buffer length")}function G(i,u,c,g,d,o){if(!y.isBuffer(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>d||u<o)throw new RangeError('"value" argument is out of bounds');if(c+g>i.length)throw new RangeError("Index out of range")}function ft(i,u,c,g,d){Ut(u,g,d,i,c,7);let o=Number(u&BigInt(4294967295));i[c++]=o,o>>=8,i[c++]=o,o>>=8,i[c++]=o,o>>=8,i[c++]=o;let l=Number(u>>BigInt(32)&BigInt(4294967295));return i[c++]=l,l>>=8,i[c++]=l,l>>=8,i[c++]=l,l>>=8,i[c++]=l,c}function Ft(i,u,c,g,d){Ut(u,g,d,i,c,7);let o=Number(u&BigInt(4294967295));i[c+7]=o,o>>=8,i[c+6]=o,o>>=8,i[c+5]=o,o>>=8,i[c+4]=o;let l=Number(u>>BigInt(32)&BigInt(4294967295));return i[c+3]=l,l>>=8,i[c+2]=l,l>>=8,i[c+1]=l,l>>=8,i[c]=l,c+8}function dr(i,u,c,g,d,o){if(c+g>i.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function Pt(i,u,c,g,d){return u=+u,c>>>=0,d||dr(i,0,c,4),m.write(i,u,c,g,23,4),c+4}function yr(i,u,c,g,d){return u=+u,c>>>=0,d||dr(i,0,c,8),m.write(i,u,c,g,52,8),c+8}y.prototype.slice=function(i,u){const c=this.length;(i=~~i)<0?(i+=c)<0&&(i=0):i>c&&(i=c),(u=u===void 0?c:~~u)<0?(u+=c)<0&&(u=0):u>c&&(u=c),u<i&&(u=i);const g=this.subarray(i,u);return Object.setPrototypeOf(g,y.prototype),g},y.prototype.readUintLE=y.prototype.readUIntLE=function(i,u,c){i>>>=0,u>>>=0,c||j(i,u,this.length);let g=this[i],d=1,o=0;for(;++o<u&&(d*=256);)g+=this[i+o]*d;return g},y.prototype.readUintBE=y.prototype.readUIntBE=function(i,u,c){i>>>=0,u>>>=0,c||j(i,u,this.length);let g=this[i+--u],d=1;for(;u>0&&(d*=256);)g+=this[i+--u]*d;return g},y.prototype.readUint8=y.prototype.readUInt8=function(i,u){return i>>>=0,u||j(i,1,this.length),this[i]},y.prototype.readUint16LE=y.prototype.readUInt16LE=function(i,u){return i>>>=0,u||j(i,2,this.length),this[i]|this[i+1]<<8},y.prototype.readUint16BE=y.prototype.readUInt16BE=function(i,u){return i>>>=0,u||j(i,2,this.length),this[i]<<8|this[i+1]},y.prototype.readUint32LE=y.prototype.readUInt32LE=function(i,u){return i>>>=0,u||j(i,4,this.length),(this[i]|this[i+1]<<8|this[i+2]<<16)+16777216*this[i+3]},y.prototype.readUint32BE=y.prototype.readUInt32BE=function(i,u){return i>>>=0,u||j(i,4,this.length),16777216*this[i]+(this[i+1]<<16|this[i+2]<<8|this[i+3])},y.prototype.readBigUInt64LE=fe(function(i){X(i>>>=0,"offset");const u=this[i],c=this[i+7];u!==void 0&&c!==void 0||_e(i,this.length-8);const g=u+256*this[++i]+65536*this[++i]+this[++i]*2**24,d=this[++i]+256*this[++i]+65536*this[++i]+c*2**24;return BigInt(g)+(BigInt(d)<<BigInt(32))}),y.prototype.readBigUInt64BE=fe(function(i){X(i>>>=0,"offset");const u=this[i],c=this[i+7];u!==void 0&&c!==void 0||_e(i,this.length-8);const g=u*2**24+65536*this[++i]+256*this[++i]+this[++i],d=this[++i]*2**24+65536*this[++i]+256*this[++i]+c;return(BigInt(g)<<BigInt(32))+BigInt(d)}),y.prototype.readIntLE=function(i,u,c){i>>>=0,u>>>=0,c||j(i,u,this.length);let g=this[i],d=1,o=0;for(;++o<u&&(d*=256);)g+=this[i+o]*d;return d*=128,g>=d&&(g-=Math.pow(2,8*u)),g},y.prototype.readIntBE=function(i,u,c){i>>>=0,u>>>=0,c||j(i,u,this.length);let g=u,d=1,o=this[i+--g];for(;g>0&&(d*=256);)o+=this[i+--g]*d;return d*=128,o>=d&&(o-=Math.pow(2,8*u)),o},y.prototype.readInt8=function(i,u){return i>>>=0,u||j(i,1,this.length),128&this[i]?-1*(255-this[i]+1):this[i]},y.prototype.readInt16LE=function(i,u){i>>>=0,u||j(i,2,this.length);const c=this[i]|this[i+1]<<8;return 32768&c?4294901760|c:c},y.prototype.readInt16BE=function(i,u){i>>>=0,u||j(i,2,this.length);const c=this[i+1]|this[i]<<8;return 32768&c?4294901760|c:c},y.prototype.readInt32LE=function(i,u){return i>>>=0,u||j(i,4,this.length),this[i]|this[i+1]<<8|this[i+2]<<16|this[i+3]<<24},y.prototype.readInt32BE=function(i,u){return i>>>=0,u||j(i,4,this.length),this[i]<<24|this[i+1]<<16|this[i+2]<<8|this[i+3]},y.prototype.readBigInt64LE=fe(function(i){X(i>>>=0,"offset");const u=this[i],c=this[i+7];u!==void 0&&c!==void 0||_e(i,this.length-8);const g=this[i+4]+256*this[i+5]+65536*this[i+6]+(c<<24);return(BigInt(g)<<BigInt(32))+BigInt(u+256*this[++i]+65536*this[++i]+this[++i]*16777216)}),y.prototype.readBigInt64BE=fe(function(i){X(i>>>=0,"offset");const u=this[i],c=this[i+7];u!==void 0&&c!==void 0||_e(i,this.length-8);const g=(u<<24)+65536*this[++i]+256*this[++i]+this[++i];return(BigInt(g)<<BigInt(32))+BigInt(this[++i]*16777216+65536*this[++i]+256*this[++i]+c)}),y.prototype.readFloatLE=function(i,u){return i>>>=0,u||j(i,4,this.length),m.read(this,i,!0,23,4)},y.prototype.readFloatBE=function(i,u){return i>>>=0,u||j(i,4,this.length),m.read(this,i,!1,23,4)},y.prototype.readDoubleLE=function(i,u){return i>>>=0,u||j(i,8,this.length),m.read(this,i,!0,52,8)},y.prototype.readDoubleBE=function(i,u){return i>>>=0,u||j(i,8,this.length),m.read(this,i,!1,52,8)},y.prototype.writeUintLE=y.prototype.writeUIntLE=function(i,u,c,g){i=+i,u>>>=0,c>>>=0,!g&&G(this,i,u,c,Math.pow(2,8*c)-1,0);let d=1,o=0;for(this[u]=255&i;++o<c&&(d*=256);)this[u+o]=i/d&255;return u+c},y.prototype.writeUintBE=y.prototype.writeUIntBE=function(i,u,c,g){i=+i,u>>>=0,c>>>=0,!g&&G(this,i,u,c,Math.pow(2,8*c)-1,0);let d=c-1,o=1;for(this[u+d]=255&i;--d>=0&&(o*=256);)this[u+d]=i/o&255;return u+c},y.prototype.writeUint8=y.prototype.writeUInt8=function(i,u,c){return i=+i,u>>>=0,c||G(this,i,u,1,255,0),this[u]=255&i,u+1},y.prototype.writeUint16LE=y.prototype.writeUInt16LE=function(i,u,c){return i=+i,u>>>=0,c||G(this,i,u,2,65535,0),this[u]=255&i,this[u+1]=i>>>8,u+2},y.prototype.writeUint16BE=y.prototype.writeUInt16BE=function(i,u,c){return i=+i,u>>>=0,c||G(this,i,u,2,65535,0),this[u]=i>>>8,this[u+1]=255&i,u+2},y.prototype.writeUint32LE=y.prototype.writeUInt32LE=function(i,u,c){return i=+i,u>>>=0,c||G(this,i,u,4,4294967295,0),this[u+3]=i>>>24,this[u+2]=i>>>16,this[u+1]=i>>>8,this[u]=255&i,u+4},y.prototype.writeUint32BE=y.prototype.writeUInt32BE=function(i,u,c){return i=+i,u>>>=0,c||G(this,i,u,4,4294967295,0),this[u]=i>>>24,this[u+1]=i>>>16,this[u+2]=i>>>8,this[u+3]=255&i,u+4},y.prototype.writeBigUInt64LE=fe(function(i,u=0){return ft(this,i,u,BigInt(0),BigInt("0xffffffffffffffff"))}),y.prototype.writeBigUInt64BE=fe(function(i,u=0){return Ft(this,i,u,BigInt(0),BigInt("0xffffffffffffffff"))}),y.prototype.writeIntLE=function(i,u,c,g){if(i=+i,u>>>=0,!g){const w=Math.pow(2,8*c-1);G(this,i,u,c,w-1,-w)}let d=0,o=1,l=0;for(this[u]=255&i;++d<c&&(o*=256);)i<0&&l===0&&this[u+d-1]!==0&&(l=1),this[u+d]=(i/o>>0)-l&255;return u+c},y.prototype.writeIntBE=function(i,u,c,g){if(i=+i,u>>>=0,!g){const w=Math.pow(2,8*c-1);G(this,i,u,c,w-1,-w)}let d=c-1,o=1,l=0;for(this[u+d]=255&i;--d>=0&&(o*=256);)i<0&&l===0&&this[u+d+1]!==0&&(l=1),this[u+d]=(i/o>>0)-l&255;return u+c},y.prototype.writeInt8=function(i,u,c){return i=+i,u>>>=0,c||G(this,i,u,1,127,-128),i<0&&(i=255+i+1),this[u]=255&i,u+1},y.prototype.writeInt16LE=function(i,u,c){return i=+i,u>>>=0,c||G(this,i,u,2,32767,-32768),this[u]=255&i,this[u+1]=i>>>8,u+2},y.prototype.writeInt16BE=function(i,u,c){return i=+i,u>>>=0,c||G(this,i,u,2,32767,-32768),this[u]=i>>>8,this[u+1]=255&i,u+2},y.prototype.writeInt32LE=function(i,u,c){return i=+i,u>>>=0,c||G(this,i,u,4,2147483647,-2147483648),this[u]=255&i,this[u+1]=i>>>8,this[u+2]=i>>>16,this[u+3]=i>>>24,u+4},y.prototype.writeInt32BE=function(i,u,c){return i=+i,u>>>=0,c||G(this,i,u,4,2147483647,-2147483648),i<0&&(i=4294967295+i+1),this[u]=i>>>24,this[u+1]=i>>>16,this[u+2]=i>>>8,this[u+3]=255&i,u+4},y.prototype.writeBigInt64LE=fe(function(i,u=0){return ft(this,i,u,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),y.prototype.writeBigInt64BE=fe(function(i,u=0){return Ft(this,i,u,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),y.prototype.writeFloatLE=function(i,u,c){return Pt(this,i,u,!0,c)},y.prototype.writeFloatBE=function(i,u,c){return Pt(this,i,u,!1,c)},y.prototype.writeDoubleLE=function(i,u,c){return yr(this,i,u,!0,c)},y.prototype.writeDoubleBE=function(i,u,c){return yr(this,i,u,!1,c)},y.prototype.copy=function(i,u,c,g){if(!y.isBuffer(i))throw new TypeError("argument should be a Buffer");if(c||(c=0),g||g===0||(g=this.length),u>=i.length&&(u=i.length),u||(u=0),g>0&&g<c&&(g=c),g===c||i.length===0||this.length===0)return 0;if(u<0)throw new RangeError("targetStart out of bounds");if(c<0||c>=this.length)throw new RangeError("Index out of range");if(g<0)throw new RangeError("sourceEnd out of bounds");g>this.length&&(g=this.length),i.length-u<g-c&&(g=i.length-u+c);const d=g-c;return this===i&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,c,g):Uint8Array.prototype.set.call(i,this.subarray(c,g),u),d},y.prototype.fill=function(i,u,c,g){if(typeof i=="string"){if(typeof u=="string"?(g=u,u=0,c=this.length):typeof c=="string"&&(g=c,c=this.length),g!==void 0&&typeof g!="string")throw new TypeError("encoding must be a string");if(typeof g=="string"&&!y.isEncoding(g))throw new TypeError("Unknown encoding: "+g);if(i.length===1){const o=i.charCodeAt(0);(g==="utf8"&&o<128||g==="latin1")&&(i=o)}}else typeof i=="number"?i&=255:typeof i=="boolean"&&(i=Number(i));if(u<0||this.length<u||this.length<c)throw new RangeError("Out of range index");if(c<=u)return this;let d;if(u>>>=0,c=c===void 0?this.length:c>>>0,i||(i=0),typeof i=="number")for(d=u;d<c;++d)this[d]=i;else{const o=y.isBuffer(i)?i:y.from(i,g),l=o.length;if(l===0)throw new TypeError('The value "'+i+'" is invalid for argument "value"');for(d=0;d<c-u;++d)this[d+u]=o[d%l]}return this};const Se={};function lt(i,u,c){Se[i]=class extends c{constructor(){super(),Object.defineProperty(this,"message",{value:u.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${i}]`,this.stack,delete this.name}get code(){return i}set code(g){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:g,writable:!0})}toString(){return`${this.name} [${i}]: ${this.message}`}}}function $t(i){let u="",c=i.length;const g=i[0]==="-"?1:0;for(;c>=g+4;c-=3)u=`_${i.slice(c-3,c)}${u}`;return`${i.slice(0,c)}${u}`}function Ut(i,u,c,g,d,o){if(i>c||i<u){const l=typeof u=="bigint"?"n":"";let w;throw w=o>3?u===0||u===BigInt(0)?`>= 0${l} and < 2${l} ** ${8*(o+1)}${l}`:`>= -(2${l} ** ${8*(o+1)-1}${l}) and < 2 ** ${8*(o+1)-1}${l}`:`>= ${u}${l} and <= ${c}${l}`,new Se.ERR_OUT_OF_RANGE("value",w,i)}(function(l,w,A){X(w,"offset"),l[w]!==void 0&&l[w+A]!==void 0||_e(w,l.length-(A+1))})(g,d,o)}function X(i,u){if(typeof i!="number")throw new Se.ERR_INVALID_ARG_TYPE(u,"number",i)}function _e(i,u,c){throw Math.floor(i)!==i?(X(i,c),new Se.ERR_OUT_OF_RANGE(c||"offset","an integer",i)):u<0?new Se.ERR_BUFFER_OUT_OF_BOUNDS:new Se.ERR_OUT_OF_RANGE(c||"offset",`>= ${c?1:0} and <= ${u}`,i)}lt("ERR_BUFFER_OUT_OF_BOUNDS",function(i){return i?`${i} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),lt("ERR_INVALID_ARG_TYPE",function(i,u){return`The "${i}" argument must be of type number. Received type ${typeof u}`},TypeError),lt("ERR_OUT_OF_RANGE",function(i,u,c){let g=`The value of "${i}" is out of range.`,d=c;return Number.isInteger(c)&&Math.abs(c)>4294967296?d=$t(String(c)):typeof c=="bigint"&&(d=String(c),(c>BigInt(2)**BigInt(32)||c<-(BigInt(2)**BigInt(32)))&&(d=$t(d)),d+="n"),g+=` It must be ${u}. Received ${d}`,g},RangeError);const Z=/[^+/0-9A-Za-z-_]/g;function Pe(i,u){let c;u=u||1/0;const g=i.length;let d=null;const o=[];for(let l=0;l<g;++l){if(c=i.charCodeAt(l),c>55295&&c<57344){if(!d){if(c>56319){(u-=3)>-1&&o.push(239,191,189);continue}if(l+1===g){(u-=3)>-1&&o.push(239,191,189);continue}d=c;continue}if(c<56320){(u-=3)>-1&&o.push(239,191,189),d=c;continue}c=65536+(d-55296<<10|c-56320)}else d&&(u-=3)>-1&&o.push(239,191,189);if(d=null,c<128){if((u-=1)<0)break;o.push(c)}else if(c<2048){if((u-=2)<0)break;o.push(c>>6|192,63&c|128)}else if(c<65536){if((u-=3)<0)break;o.push(c>>12|224,c>>6&63|128,63&c|128)}else{if(!(c<1114112))throw new Error("Invalid code point");if((u-=4)<0)break;o.push(c>>18|240,c>>12&63|128,c>>6&63|128,63&c|128)}}return o}function gr(i){return h.toByteArray(function(u){if((u=(u=u.split("=")[0]).trim().replace(Z,"")).length<2)return"";for(;u.length%4!=0;)u+="=";return u}(i))}function Ie(i,u,c,g){let d;for(d=0;d<g&&!(d+c>=u.length||d>=i.length);++d)u[d+c]=i[d];return d}function ce(i,u){return i instanceof u||i!=null&&i.constructor!=null&&i.constructor.name!=null&&i.constructor.name===u.name}function pt(i){return i!=i}const xn=function(){const i="0123456789abcdef",u=new Array(256);for(let c=0;c<16;++c){const g=16*c;for(let d=0;d<16;++d)u[g+d]=i[c]+i[d]}return u}();function fe(i){return typeof BigInt>"u"?He:i}function He(){throw new Error("BigInt not supported")}},645:(s,f)=>{f.read=function(p,h,m,v,_){var b,y,x=8*_-v-1,I=(1<<x)-1,O=I>>1,S=-7,T=m?_-1:0,F=m?-1:1,R=p[h+T];for(T+=F,b=R&(1<<-S)-1,R>>=-S,S+=x;S>0;b=256*b+p[h+T],T+=F,S-=8);for(y=b&(1<<-S)-1,b>>=-S,S+=v;S>0;y=256*y+p[h+T],T+=F,S-=8);if(b===0)b=1-O;else{if(b===I)return y?NaN:1/0*(R?-1:1);y+=Math.pow(2,v),b-=O}return(R?-1:1)*y*Math.pow(2,b-v)},f.write=function(p,h,m,v,_,b){var y,x,I,O=8*b-_-1,S=(1<<O)-1,T=S>>1,F=_===23?Math.pow(2,-24)-Math.pow(2,-77):0,R=v?0:b-1,D=v?1:-1,N=h<0||h===0&&1/h<0?1:0;for(h=Math.abs(h),isNaN(h)||h===1/0?(x=isNaN(h)?1:0,y=S):(y=Math.floor(Math.log(h)/Math.LN2),h*(I=Math.pow(2,-y))<1&&(y--,I*=2),(h+=y+T>=1?F/I:F*Math.pow(2,1-T))*I>=2&&(y++,I/=2),y+T>=S?(x=0,y=S):y+T>=1?(x=(h*I-1)*Math.pow(2,_),y+=T):(x=h*Math.pow(2,T-1)*Math.pow(2,_),y=0));_>=8;p[m+R]=255&x,R+=D,x/=256,_-=8);for(y=y<<_|x,O+=_;O>0;p[m+R]=255&y,R+=D,y/=256,O-=8);p[m+R-D]|=128*N}}},n={};function a(s){var f=n[s];if(f!==void 0)return f.exports;var p=n[s]={exports:{}};return r[s](p,p.exports,a),p.exports}return a.d=(s,f)=>{for(var p in f)a.o(f,p)&&!a.o(s,p)&&Object.defineProperty(s,p,{enumerable:!0,get:f[p]})},a.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),a.o=(s,f)=>Object.prototype.hasOwnProperty.call(s,f),a.r=s=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},a(899)})())})(ki);var lc=ki.exports;function pc(t){const e={variantId:xe.Uint64.fromString(t.variantId.toString()),version:t.version||Math.floor(Date.now()/1e3),items:t.items.map(n=>new xe.BundleItem({collectionId:xe.Uint64.fromString(n.collectionId.toString()),productId:xe.Uint64.fromString(n.productId.toString()),variantId:xe.Uint64.fromString(n.variantId.toString()),sku:n.sku||"",quantity:n.quantity,ext:new xe.BundleItemExt(0)})),ext:new xe.BundleExt(0)},r=new xe.Bundle(e);return xe.BundleEnvelope.envelopeTypeBundle(r).toXDR("base64")}const xe=lc.config(t=>{t.enum("EnvelopeType",{envelopeTypeBundle:0}),t.typedef("Uint32",t.uint()),t.typedef("Uint64",t.uhyper()),t.union("BundleItemExt",{switchOn:t.int(),switchName:"v",switches:[[0,t.void()]],arms:{}}),t.struct("BundleItem",[["collectionId",t.lookup("Uint64")],["productId",t.lookup("Uint64")],["variantId",t.lookup("Uint64")],["sku",t.string()],["quantity",t.lookup("Uint32")],["ext",t.lookup("BundleItemExt")]]),t.union("BundleExt",{switchOn:t.int(),switchName:"v",switches:[[0,t.void()]],arms:{}}),t.struct("Bundle",[["variantId",t.lookup("Uint64")],["items",t.varArray(t.lookup("BundleItem"),500)],["version",t.lookup("Uint32")],["ext",t.lookup("BundleExt")]]),t.union("BundleEnvelope",{switchOn:t.lookup("EnvelopeType"),switchName:"type",switches:[["envelopeTypeBundle","v1"]],arms:{v1:t.lookup("Bundle")}})}),ji="/bundling-storefront-manager";function hc(){return Math.ceil(Date.now()/1e3)}async function dc(){try{const{timestamp:t}=await xt("get",`${ji}/t`,{headers:{"X-Recharge-App":"storefront-client"}});return t}catch(t){return console.error(`Fetch failed: ${t}. Using client-side date.`),hc()}}async function yc(t){const e=ve(),r=await qi(t);if(r!==!0)throw new Error(r);const n=await dc(),a=pc({variantId:t.externalVariantId,version:n,items:t.selections.map(s=>({collectionId:s.collectionId,productId:s.externalProductId,variantId:s.externalVariantId,quantity:s.quantity,sku:""}))});try{const s=await xt("post",`${ji}/api/v1/bundles`,{data:{bundle:a},headers:{Origin:`https://${e.storeIdentifier}`}});if(!s.id||s.code!==200)throw new Error(`1: failed generating rb_id: ${JSON.stringify(s)}`);return s.id}catch(s){throw new Error(`2: failed generating rb_id ${s}`)}}function gc(t,e){const r=Vi(t);if(r!==!0)throw new Error(`Dynamic Bundle is invalid. ${r}`);const n=`${fc(9)}:${t.externalProductId}`;return t.selections.map(a=>{const s={id:a.externalVariantId,quantity:a.quantity,properties:{_rc_bundle:n,_rc_bundle_variant:t.externalVariantId,_rc_bundle_parent:e,_rc_bundle_collection_id:a.collectionId}};return a.sellingPlan?s.selling_plan=a.sellingPlan:a.shippingIntervalFrequency&&(s.properties.shipping_interval_frequency=a.shippingIntervalFrequency,s.properties.shipping_interval_unit_type=a.shippingIntervalUnitType,s.id=`${a.discountedVariantId}`),s})}async function qi(t){try{return t?!0:"Bundle is not defined"}catch(e){return`Error fetching bundle settings: ${e}`}}const mc={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 Vi(t){if(!t)return"No bundle defined.";if(t.selections.length===0)return"No selections defined.";const{shippingIntervalFrequency:e,shippingIntervalUnitType:r}=t.selections.find(n=>n.shippingIntervalFrequency||n.shippingIntervalUnitType)||{};if(e||r){if(!e||!r)return"Shipping intervals do not match on selections.";{const n=mc[r];for(let a=0;a<t.selections.length;a++){const{shippingIntervalFrequency:s,shippingIntervalUnitType:f}=t.selections[a];if(s&&s!==e||f&&!n.includes(f))return"Shipping intervals do not match on selections."}}}return!0}async function wc(t,e){const{bundle_selection:r}=await B("get","/bundle_selections",{id:e},t);return r}function vc(t,e){return B("get","/bundle_selections",{query:e},t)}async function _c(t,e){const{bundle_selection:r}=await B("post","/bundle_selections",{data:e},t);return r}async function bc(t,e,r){const{bundle_selection:n}=await B("put","/bundle_selections",{id:e,data:r},t);return n}function Ec(t,e){return B("delete","/bundle_selections",{id:e},t)}async function Ac(t,e,r,n){const{subscription:a}=await B("put","/bundles",{id:e,data:r,query:n},t);return a}var xc=Object.freeze({__proto__:null,createBundleSelection:_c,deleteBundleSelection:Ec,getBundleId:yc,getBundleSelection:wc,getDynamicBundleItems:gc,listBundleSelections:vc,updateBundle:Ac,updateBundleSelection:bc,validateBundle:qi,validateDynamicBundle:Vi}),Sc=200,an="__lodash_hash_undefined__",Ic=1/0,zi=9007199254740991,Bc="[object Arguments]",Oc="[object Function]",Tc="[object GeneratorFunction]",Rc="[object Symbol]",Fc=/[\\^$.*+?()[\]{}|]/g,Pc=/^\[object .+?Constructor\]$/,$c=/^(?:0|[1-9]\d*)$/,Uc=typeof oe=="object"&&oe&&oe.Object===Object&&oe,Cc=typeof self=="object"&&self&&self.Object===Object&&self,sn=Uc||Cc||Function("return this")();function Dc(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function Nc(t,e){var r=t?t.length:0;return!!r&&kc(t,e,0)>-1}function Mc(t,e,r){for(var n=-1,a=t?t.length:0;++n<a;)if(r(e,t[n]))return!0;return!1}function Gi(t,e){for(var r=-1,n=t?t.length:0,a=Array(n);++r<n;)a[r]=e(t[r],r,t);return a}function un(t,e){for(var r=-1,n=e.length,a=t.length;++r<n;)t[a+r]=e[r];return t}function Lc(t,e,r,n){for(var a=t.length,s=r+(n?1:-1);n?s--:++s<a;)if(e(t[s],s,t))return s;return-1}function kc(t,e,r){if(e!==e)return Lc(t,jc,r);for(var n=r-1,a=t.length;++n<a;)if(t[n]===e)return n;return-1}function jc(t){return t!==t}function qc(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function Vc(t){return function(e){return t(e)}}function zc(t,e){return t.has(e)}function Gc(t,e){return t?.[e]}function Wc(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function Wi(t,e){return function(r){return t(e(r))}}var Hc=Array.prototype,Yc=Function.prototype,or=Object.prototype,cn=sn["__core-js_shared__"],Hi=function(){var t=/[^.]+$/.exec(cn&&cn.keys&&cn.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Yi=Yc.toString,it=or.hasOwnProperty,fn=or.toString,Xc=RegExp("^"+Yi.call(it).replace(Fc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Xi=sn.Symbol,Jc=Wi(Object.getPrototypeOf,Object),Kc=or.propertyIsEnumerable,Qc=Hc.splice,Ji=Xi?Xi.isConcatSpreadable:void 0,ln=Object.getOwnPropertySymbols,Ki=Math.max,Zc=Zi(sn,"Map"),St=Zi(Object,"create");function ze(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function ef(){this.__data__=St?St(null):{}}function tf(t){return this.has(t)&&delete this.__data__[t]}function rf(t){var e=this.__data__;if(St){var r=e[t];return r===an?void 0:r}return it.call(e,t)?e[t]:void 0}function nf(t){var e=this.__data__;return St?e[t]!==void 0:it.call(e,t)}function of(t,e){var r=this.__data__;return r[t]=St&&e===void 0?an:e,this}ze.prototype.clear=ef,ze.prototype.delete=tf,ze.prototype.get=rf,ze.prototype.has=nf,ze.prototype.set=of;function ot(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function af(){this.__data__=[]}function sf(t){var e=this.__data__,r=sr(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():Qc.call(e,r,1),!0}function uf(t){var e=this.__data__,r=sr(e,t);return r<0?void 0:e[r][1]}function cf(t){return sr(this.__data__,t)>-1}function ff(t,e){var r=this.__data__,n=sr(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ot.prototype.clear=af,ot.prototype.delete=sf,ot.prototype.get=uf,ot.prototype.has=cf,ot.prototype.set=ff;function at(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function lf(){this.__data__={hash:new ze,map:new(Zc||ot),string:new ze}}function pf(t){return ur(this,t).delete(t)}function hf(t){return ur(this,t).get(t)}function df(t){return ur(this,t).has(t)}function yf(t,e){return ur(this,t).set(t,e),this}at.prototype.clear=lf,at.prototype.delete=pf,at.prototype.get=hf,at.prototype.has=df,at.prototype.set=yf;function ar(t){var e=-1,r=t?t.length:0;for(this.__data__=new at;++e<r;)this.add(t[e])}function gf(t){return this.__data__.set(t,an),this}function mf(t){return this.__data__.has(t)}ar.prototype.add=ar.prototype.push=gf,ar.prototype.has=mf;function wf(t,e){var r=pn(t)||eo(t)?qc(t.length,String):[],n=r.length,a=!!n;for(var s in t)(e||it.call(t,s))&&!(a&&(s=="length"||Rf(s,n)))&&r.push(s);return r}function sr(t,e){for(var r=t.length;r--;)if(Nf(t[r][0],e))return r;return-1}function vf(t,e,r,n){var a=-1,s=Nc,f=!0,p=t.length,h=[],m=e.length;if(!p)return h;r&&(e=Gi(e,Vc(r))),n?(s=Mc,f=!1):e.length>=Sc&&(s=zc,f=!1,e=new ar(e));e:for(;++a<p;){var v=t[a],_=r?r(v):v;if(v=n||v!==0?v:0,f&&_===_){for(var b=m;b--;)if(e[b]===_)continue e;h.push(v)}else s(e,_,n)||h.push(v)}return h}function Qi(t,e,r,n,a){var s=-1,f=t.length;for(r||(r=Tf),a||(a=[]);++s<f;){var p=t[s];e>0&&r(p)?e>1?Qi(p,e-1,r,n,a):un(a,p):n||(a[a.length]=p)}return a}function _f(t,e,r){var n=e(t);return pn(t)?n:un(n,r(t))}function bf(t){if(!hn(t)||Pf(t))return!1;var e=ro(t)||Wc(t)?Xc:Pc;return e.test(Df(t))}function Ef(t){if(!hn(t))return Uf(t);var e=$f(t),r=[];for(var n in t)n=="constructor"&&(e||!it.call(t,n))||r.push(n);return r}function Af(t,e){return t=Object(t),xf(t,e,function(r,n){return n in t})}function xf(t,e,r){for(var n=-1,a=e.length,s={};++n<a;){var f=e[n],p=t[f];r(p,f)&&(s[f]=p)}return s}function Sf(t,e){return e=Ki(e===void 0?t.length-1:e,0),function(){for(var r=arguments,n=-1,a=Ki(r.length-e,0),s=Array(a);++n<a;)s[n]=r[e+n];n=-1;for(var f=Array(e+1);++n<e;)f[n]=r[n];return f[e]=s,Dc(t,this,f)}}function If(t){return _f(t,jf,Of)}function ur(t,e){var r=t.__data__;return Ff(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Zi(t,e){var r=Gc(t,e);return bf(r)?r:void 0}var Bf=ln?Wi(ln,Object):io,Of=ln?function(t){for(var e=[];t;)un(e,Bf(t)),t=Jc(t);return e}:io;function Tf(t){return pn(t)||eo(t)||!!(Ji&&t&&t[Ji])}function Rf(t,e){return e=e??zi,!!e&&(typeof t=="number"||$c.test(t))&&t>-1&&t%1==0&&t<e}function Ff(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function Pf(t){return!!Hi&&Hi in t}function $f(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||or;return t===r}function Uf(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}function Cf(t){if(typeof t=="string"||kf(t))return t;var e=t+"";return e=="0"&&1/t==-Ic?"-0":e}function Df(t){if(t!=null){try{return Yi.call(t)}catch{}try{return t+""}catch{}}return""}function Nf(t,e){return t===e||t!==t&&e!==e}function eo(t){return Mf(t)&&it.call(t,"callee")&&(!Kc.call(t,"callee")||fn.call(t)==Bc)}var pn=Array.isArray;function to(t){return t!=null&&Lf(t.length)&&!ro(t)}function Mf(t){return no(t)&&to(t)}function ro(t){var e=hn(t)?fn.call(t):"";return e==Oc||e==Tc}function Lf(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=zi}function hn(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function no(t){return!!t&&typeof t=="object"}function kf(t){return typeof t=="symbol"||no(t)&&fn.call(t)==Rc}function jf(t){return to(t)?wf(t,!0):Ef(t)}var qf=Sf(function(t,e){return t==null?{}:(e=Gi(Qi(e,1),Cf),Af(t,vf(If(t),e)))});function io(){return[]}var Vf=qf,dn=$e(Vf);function zf(t){try{return JSON.parse(t)}catch{return t}}function Gf(t){return Object.entries(t).reduce((e,[r,n])=>({...e,[r]:zf(n)}),{})}const oo=t=>typeof t=="string"?t!=="0"&&t!=="false":!!t;function ao(t){const e=Gf(t),r=e.auto_inject===void 0?!0:e.auto_inject,n=e.display_on??[],a=e.first_option==="autodeliver";return{...dn(e,["display_on","first_option"]),auto_inject:r,valid_pages:n,is_subscription_first:a,autoInject:r,validPages:n,isSubscriptionFirst:a}}function so(t){const e=t.subscription_options?.storefront_purchase_options==="subscription_only";return{...t,is_subscription_only:e,isSubscriptionOnly:e}}function Wf(t){return t.map(e=>{const r={};return Object.entries(e).forEach(([n,a])=>{r[n]=so(a)}),r})}const yn="2020-12",Hf={store_currency:{currency_code:"USD",currency_symbol:"$",decimal_separator:".",thousands_separator:",",currency_symbol_location:"left"}},It=new Map;function cr(t,e){return It.has(t)||It.set(t,e()),It.get(t)}async function gn(t,e){const r=e?.version??"2020-12",{product:n}=await cr(`product.${t}.${r}`,()=>ir("get",`/product/${r}/${t}.json`));return r==="2020-12"?so(n):n}async function uo(){return await cr("storeSettings",()=>ir("get",`/${yn}/store_settings.json`).catch(()=>Hf))}async function co(){const{widget_settings:t}=await cr("widgetSettings",()=>ir("get",`/${yn}/widget_settings.json`));return ao(t)}async function fo(){const{products:t,widget_settings:e,store_settings:r,meta:n}=await cr("productsAndSettings",()=>ir("get",`/product/${yn}/products.json`));return n?.status==="error"?Promise.reject(n.message):{products:Wf(t),widget_settings:ao(e),store_settings:r??{}}}async function Yf(){const{products:t}=await fo();return t}async function Xf(t){const[e,r,n]=await Promise.all([gn(t),uo(),co()]);return{product:e,store_settings:r,widget_settings:n,storeSettings:r,widgetSettings:n}}async function Jf(t){const{bundle_product:e}=await gn(t);return e}async function lo(){return Array.from(It.keys()).forEach(t=>It.delete(t))}var Kf=Object.freeze({__proto__:null,getCDNBundleSettings:Jf,getCDNProduct:gn,getCDNProductAndSettings:Xf,getCDNProducts:Yf,getCDNProductsAndSettings:fo,getCDNStoreSettings:uo,getCDNWidgetSettings:co,resetCDNCache:lo});async function Qf(t,e,r){const{charge:n}=await B("get","/charges",{id:e,query:{include:r?.include}},t);return n}function Zf(t,e){return B("get","/charges",{query:e},t)}async function el(t,e,r){const{charge:n}=await B("post",`/charges/${e}/apply_discount`,{data:{discount_code:r}},t);return n}async function tl(t,e){const{charge:r}=await B("post",`/charges/${e}/remove_discount`,{},t);return r}async function rl(t,e,r,n){const{charge:a}=await B("post",`/charges/${e}/skip`,{query:n,data:{purchase_item_ids:r.map(s=>Number(s))}},t);return a}async function nl(t,e,r,n){const{charge:a}=await B("post",`/charges/${e}/unskip`,{query:n,data:{purchase_item_ids:r.map(s=>Number(s))}},t);return a}async function il(t,e){const{charge:r}=await B("post",`/charges/${e}/process`,{},t);return r}var ol=Object.freeze({__proto__:null,applyDiscountToCharge:el,getCharge:Qf,listCharges:Zf,processCharge:il,removeDiscountsFromCharge:tl,skipCharge:rl,unskipCharge:nl});async function al(t,e){const r=t.customerId;if(!r)throw new Error("Not logged in.");const{customer:n}=await B("get","/customers",{id:r,query:{include:e?.include}},t);return n}async function sl(t,e){const r=t.customerId;if(!r)throw new Error("Not logged in.");const{customer:n}=await B("put","/customers",{id:r,data:e},t);return n}async function ul(t,e){const r=t.customerId;if(!r)throw new Error("Not logged in.");const{deliveries:n}=await B("get",`/customers/${r}/delivery_schedule`,{query:e},t);return n}async function mn(t){return B("get","/portal_access",{},t)}async function cl(t,e,r){const{base_url:n,customer_hash:a,temp_token:s}=await mn(t);return`${n.replace("portal","pages")}${a}/subscriptions/${e}/cancel?token=${s}&subscription=${e}&redirect_to=${r}`}async function fl(t,e,r){const{base_url:n,customer_hash:a,temp_token:s}=await mn(t);return`${n.replace("portal","pages")}${a}/gifts/${e}?token=${s}&redirect_to=${r}`}const ll={SHOPIFY_UPDATE_PAYMENT_INFO:{type:"email",template_type:"shopify_update_payment_information"}};async function pl(t,e,r){const n=t.customerId;if(!n)throw new Error("Not logged in.");const a=ll[e];if(!a)throw new Error("Notification not supported.");return B("post",`/customers/${n}/notifications`,{data:{...a,template_vars:r}},t)}async function hl(t,e){const r=t.customerId;if(!r)throw new Error("Not logged in.");const{credit_summary:n}=await B("get",`/customers/${r}/credit_summary`,{query:{include:e?.include}},t);return n}var dl=Object.freeze({__proto__:null,getActiveChurnLandingPageURL:cl,getCreditSummary:hl,getCustomer:al,getCustomerPortalAccess:mn,getDeliverySchedule:ul,getGiftRedemptionLandingPageURL:fl,sendCustomerNotification:pl,updateCustomer:sl});function yl(t,e){if(!t.customerId)throw new Error("Not logged in.");return B("get","/gift_purchases",{query:e},t)}async function gl(t,e){if(!t.customerId)throw new Error("Not logged in.");const{gift_purchase:r}=await B("get","/gift_purchases",{id:e},t);return r}var ml=Object.freeze({__proto__:null,getGiftPurchase:gl,listGiftPurchases:yl});async function wl(t,e){const{membership:r}=await B("get","/memberships",{id:e},t);return r}function vl(t,e){return B("get","/memberships",{query:e},t)}async function _l(t,e,r){const{membership:n}=await B("post",`/memberships/${e}/cancel`,{data:r},t);return n}async function bl(t,e,r){const{membership:n}=await B("post",`/memberships/${e}/activate`,{data:r},t);return n}async function El(t,e,r){const{membership:n}=await B("post",`/memberships/${e}/change`,{data:r},t);return n}var Al=Object.freeze({__proto__:null,activateMembership:bl,cancelMembership:_l,changeMembership:El,getMembership:wl,listMemberships:vl});async function xl(t,e,r){const{membership_program:n}=await B("get","/membership_programs",{id:e,query:{include:r?.include}},t);return n}function Sl(t,e){return B("get","/membership_programs",{query:e},t)}var Il=Object.freeze({__proto__:null,getMembershipProgram:xl,listMembershipPrograms:Sl});async function Bl(t,e){const{metafield:r}=await B("post","/metafields",{data:{metafield:e}},t);return r}async function Ol(t,e,r){const{metafield:n}=await B("put","/metafields",{id:e,data:{metafield:r}},t);return n}function Tl(t,e){return B("delete","/metafields",{id:e},t)}var Rl=Object.freeze({__proto__:null,createMetafield:Bl,deleteMetafield:Tl,updateMetafield:Ol});async function Fl(t,e){const{onetime:r}=await B("get","/onetimes",{id:e},t);return r}function Pl(t,e){return B("get","/onetimes",{query:e},t)}async function $l(t,e){const{onetime:r}=await B("post","/onetimes",{data:e},t);return r}async function Ul(t,e,r){const{onetime:n}=await B("put","/onetimes",{id:e,data:r},t);return n}function Cl(t,e){return B("delete","/onetimes",{id:e},t)}var Dl=Object.freeze({__proto__:null,createOnetime:$l,deleteOnetime:Cl,getOnetime:Fl,listOnetimes:Pl,updateOnetime:Ul});async function Nl(t,e){const{order:r}=await B("get","/orders",{id:e},t);return r}function Ml(t,e){return B("get","/orders",{query:e},t)}var Ll=Object.freeze({__proto__:null,getOrder:Nl,listOrders:Ml});async function kl(t,e,r){const{payment_method:n}=await B("get","/payment_methods",{id:e,query:{include:r?.include}},t);return n}async function jl(t,e){const{payment_method:r}=await B("post","/payment_methods",{data:{...e,customer_id:t.customerId}},t);return r}async function ql(t,e,r){const{payment_method:n}=await B("put","/payment_methods",{id:e,data:r},t);return n}function Vl(t,e){return B("get","/payment_methods",{query:e},t)}var zl=Object.freeze({__proto__:null,createPaymentMethod:jl,getPaymentMethod:kl,listPaymentMethods:Vl,updatePaymentMethod:ql});async function Gl(t,e){const{plan:r}=await B("get","/plans",{id:e},t);return r}function Wl(t,e){return B("get","/plans",{query:e},t)}var Hl=Object.freeze({__proto__:null,getPlan:Gl,listPlans:Wl});async function Yl(t,e){if(!["2020-12","2022-06"].includes(e.format_version))throw new Error("Missing or unsupported format_version.");return B("get","/product_search",{query:e,headers:{"X-Recharge-Version":"2021-01"}},t)}var Xl=Object.freeze({__proto__:null,productSearch:Yl});async function Jl(t,e){return await B("get","/shop/shipping_countries",{query:e,headers:{"X-Recharge-Version":"2021-01"}},t)}var Kl=Object.freeze({__proto__:null,getShippingCountries:Jl}),Ql="Expected a function",po="__lodash_placeholder__",Ge=1,fr=2,Zl=4,st=8,Bt=16,We=32,Ot=64,ho=128,ep=256,yo=512,go=1/0,tp=9007199254740991,rp=17976931348623157e292,mo=0/0,np=[["ary",ho],["bind",Ge],["bindKey",fr],["curry",st],["curryRight",Bt],["flip",yo],["partial",We],["partialRight",Ot],["rearg",ep]],ip="[object Function]",op="[object GeneratorFunction]",ap="[object Symbol]",sp=/[\\^$.*+?()[\]{}|]/g,up=/^\s+|\s+$/g,cp=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,fp=/\{\n\/\* \[wrapped with (.+)\] \*/,lp=/,? & /,pp=/^[-+]0x[0-9a-f]+$/i,hp=/^0b[01]+$/i,dp=/^\[object .+?Constructor\]$/,yp=/^0o[0-7]+$/i,gp=/^(?:0|[1-9]\d*)$/,mp=parseInt,wp=typeof oe=="object"&&oe&&oe.Object===Object&&oe,vp=typeof self=="object"&&self&&self.Object===Object&&self,Tt=wp||vp||Function("return this")();function wn(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function _p(t,e){for(var r=-1,n=t?t.length:0;++r<n&&e(t[r],r,t)!==!1;);return t}function bp(t,e){var r=t?t.length:0;return!!r&&Ap(t,e,0)>-1}function Ep(t,e,r,n){for(var a=t.length,s=r+(n?1:-1);n?s--:++s<a;)if(e(t[s],s,t))return s;return-1}function Ap(t,e,r){if(e!==e)return Ep(t,xp,r);for(var n=r-1,a=t.length;++n<a;)if(t[n]===e)return n;return-1}function xp(t){return t!==t}function Sp(t,e){for(var r=t.length,n=0;r--;)t[r]===e&&n++;return n}function Ip(t,e){return t?.[e]}function Bp(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function vn(t,e){for(var r=-1,n=t.length,a=0,s=[];++r<n;){var f=t[r];(f===e||f===po)&&(t[r]=po,s[a++]=r)}return s}var Op=Function.prototype,wo=Object.prototype,_n=Tt["__core-js_shared__"],vo=function(){var t=/[^.]+$/.exec(_n&&_n.keys&&_n.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),_o=Op.toString,Tp=wo.hasOwnProperty,bo=wo.toString,Rp=RegExp("^"+_o.call(Tp).replace(sp,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Fp=Object.create,ut=Math.max,Pp=Math.min,Eo=function(){var t=xo(Object,"defineProperty"),e=xo.name;return e&&e.length>2?t:void 0}();function $p(t){return ct(t)?Fp(t):{}}function Up(t){if(!ct(t)||Wp(t))return!1;var e=Jp(t)||Bp(t)?Rp:dp;return e.test(Yp(t))}function Cp(t,e){return e=ut(e===void 0?t.length-1:e,0),function(){for(var r=arguments,n=-1,a=ut(r.length-e,0),s=Array(a);++n<a;)s[n]=r[e+n];n=-1;for(var f=Array(e+1);++n<e;)f[n]=r[n];return f[e]=s,wn(t,this,f)}}function Dp(t,e,r,n){for(var a=-1,s=t.length,f=r.length,p=-1,h=e.length,m=ut(s-f,0),v=Array(h+m),_=!n;++p<h;)v[p]=e[p];for(;++a<f;)(_||a<s)&&(v[r[a]]=t[a]);for(;m--;)v[p++]=t[a++];return v}function Np(t,e,r,n){for(var a=-1,s=t.length,f=-1,p=r.length,h=-1,m=e.length,v=ut(s-p,0),_=Array(v+m),b=!n;++a<v;)_[a]=t[a];for(var y=a;++h<m;)_[y+h]=e[h];for(;++f<p;)(b||a<s)&&(_[y+r[f]]=t[a++]);return _}function Mp(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}function Lp(t,e,r){var n=e&Ge,a=Rt(t);function s(){var f=this&&this!==Tt&&this instanceof s?a:t;return f.apply(n?r:this,arguments)}return s}function Rt(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var r=$p(t.prototype),n=t.apply(r,e);return ct(n)?n:r}}function kp(t,e,r){var n=Rt(t);function a(){for(var s=arguments.length,f=Array(s),p=s,h=En(a);p--;)f[p]=arguments[p];var m=s<3&&f[0]!==h&&f[s-1]!==h?[]:vn(f,h);if(s-=m.length,s<r)return Ao(t,e,bn,a.placeholder,void 0,f,m,void 0,void 0,r-s);var v=this&&this!==Tt&&this instanceof a?n:t;return wn(v,this,f)}return a}function bn(t,e,r,n,a,s,f,p,h,m){var v=e&ho,_=e&Ge,b=e&fr,y=e&(st|Bt),x=e&yo,I=b?void 0:Rt(t);function O(){for(var S=arguments.length,T=Array(S),F=S;F--;)T[F]=arguments[F];if(y)var R=En(O),D=Sp(T,R);if(n&&(T=Dp(T,n,a,y)),s&&(T=Np(T,s,f,y)),S-=D,y&&S<m){var N=vn(T,R);return Ao(t,e,bn,O.placeholder,r,T,N,p,h,m-S)}var V=_?r:this,k=b?V[t]:t;return S=T.length,p?T=Hp(T,p):x&&S>1&&T.reverse(),v&&h<S&&(T.length=h),this&&this!==Tt&&this instanceof O&&(k=I||Rt(k)),k.apply(V,T)}return O}function jp(t,e,r,n){var a=e&Ge,s=Rt(t);function f(){for(var p=-1,h=arguments.length,m=-1,v=n.length,_=Array(v+h),b=this&&this!==Tt&&this instanceof f?s:t;++m<v;)_[m]=n[m];for(;h--;)_[m++]=arguments[++p];return wn(b,a?r:this,_)}return f}function Ao(t,e,r,n,a,s,f,p,h,m){var v=e&st,_=v?f:void 0,b=v?void 0:f,y=v?s:void 0,x=v?void 0:s;e|=v?We:Ot,e&=~(v?Ot:We),e&Zl||(e&=~(Ge|fr));var I=r(t,e,a,y,_,x,b,p,h,m);return I.placeholder=n,So(I,t,e)}function qp(t,e,r,n,a,s,f,p){var h=e&fr;if(!h&&typeof t!="function")throw new TypeError(Ql);var m=n?n.length:0;if(m||(e&=~(We|Ot),n=a=void 0),f=f===void 0?f:ut(Io(f),0),p=p===void 0?p:Io(p),m-=a?a.length:0,e&Ot){var v=n,_=a;n=a=void 0}var b=[t,e,r,n,a,v,_,s,f,p];if(t=b[0],e=b[1],r=b[2],n=b[3],a=b[4],p=b[9]=b[9]==null?h?0:t.length:ut(b[9]-m,0),!p&&e&(st|Bt)&&(e&=~(st|Bt)),!e||e==Ge)var y=Lp(t,e,r);else e==st||e==Bt?y=kp(t,e,p):(e==We||e==(Ge|We))&&!a.length?y=jp(t,e,r,n):y=bn.apply(void 0,b);return So(y,t,e)}function En(t){var e=t;return e.placeholder}function xo(t,e){var r=Ip(t,e);return Up(r)?r:void 0}function Vp(t){var e=t.match(fp);return e?e[1].split(lp):[]}function zp(t,e){var r=e.length,n=r-1;return e[n]=(r>1?"& ":"")+e[n],e=e.join(r>2?", ":" "),t.replace(cp,`{
17
+ `)+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function Cr(t){return Array.isArray(t)}function Xt(t){return typeof t=="boolean"}function yt(t){return t===null}function ui(t){return t==null}function Dr(t){return typeof t=="number"}function gt(t){return typeof t=="string"}function ci(t){return typeof t=="symbol"}function me(t){return t===void 0}function mt(t){return je(t)&&Nr(t)==="[object RegExp]"}function je(t){return typeof t=="object"&&t!==null}function Jt(t){return je(t)&&Nr(t)==="[object Date]"}function wt(t){return je(t)&&(Nr(t)==="[object Error]"||t instanceof Error)}function vt(t){return typeof t=="function"}function fi(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||typeof t>"u"}function li(t){return E.isBuffer(t)}function Nr(t){return Object.prototype.toString.call(t)}function Mr(t){return t<10?"0"+t.toString(10):t.toString(10)}var Bs=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Os(){var t=new Date,e=[Mr(t.getHours()),Mr(t.getMinutes()),Mr(t.getSeconds())].join(":");return[t.getDate(),Bs[t.getMonth()],e].join(" ")}function pi(){console.log("%s - %s",Os(),Wt.apply(null,arguments))}function Lr(t,e){if(!e||!je(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}function hi(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var qe=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;function kr(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');if(qe&&t[qe]){var e=t[qe];if(typeof e!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,qe,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var r,n,a=new Promise(function(p,h){r=p,n=h}),s=[],f=0;f<arguments.length;f++)s.push(arguments[f]);s.push(function(p,h){p?n(p):r(h)});try{t.apply(this,s)}catch(p){n(p)}return a}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),qe&&Object.defineProperty(e,qe,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,ai(t))}kr.custom=qe;function Ts(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}function di(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');function e(){for(var r=[],n=0;n<arguments.length;n++)r.push(arguments[n]);var a=r.pop();if(typeof a!="function")throw new TypeError("The last argument must be of type Function");var s=this,f=function(){return a.apply(s,arguments)};t.apply(this,r).then(function(p){tt.nextTick(f.bind(null,null,p))},function(p){tt.nextTick(Ts.bind(null,p,f))})}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,ai(t)),e}var Rs={inherits:oi,_extend:Lr,log:pi,isBuffer:li,isPrimitive:fi,isFunction:vt,isError:wt,isDate:Jt,isObject:je,isRegExp:mt,isUndefined:me,isSymbol:ci,isString:gt,isNumber:Dr,isNullOrUndefined:ui,isNull:yt,isBoolean:Xt,isArray:Cr,inspect:ge,deprecate:Fr,format:Wt,debuglog:si,promisify:kr,callbackify:di},Fs=Object.freeze({__proto__:null,_extend:Lr,callbackify:di,debuglog:si,default:Rs,deprecate:Fr,format:Wt,inherits:oi,inspect:ge,isArray:Cr,isBoolean:Xt,isBuffer:li,isDate:Jt,isError:wt,isFunction:vt,isNull:yt,isNullOrUndefined:ui,isNumber:Dr,isObject:je,isPrimitive:fi,isRegExp:mt,isString:gt,isSymbol:ci,isUndefined:me,log:pi,promisify:kr}),Ps=Fo(Fs),$s=Ps.inspect,jr=typeof Map=="function"&&Map.prototype,qr=Object.getOwnPropertyDescriptor&&jr?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Kt=jr&&qr&&typeof qr.get=="function"?qr.get:null,yi=jr&&Map.prototype.forEach,Vr=typeof Set=="function"&&Set.prototype,zr=Object.getOwnPropertyDescriptor&&Vr?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Qt=Vr&&zr&&typeof zr.get=="function"?zr.get:null,gi=Vr&&Set.prototype.forEach,Us=typeof WeakMap=="function"&&WeakMap.prototype,_t=Us?WeakMap.prototype.has:null,Cs=typeof WeakSet=="function"&&WeakSet.prototype,bt=Cs?WeakSet.prototype.has:null,Ds=typeof WeakRef=="function"&&WeakRef.prototype,mi=Ds?WeakRef.prototype.deref:null,Ns=Boolean.prototype.valueOf,Ms=Object.prototype.toString,Ls=Function.prototype.toString,ks=String.prototype.match,Gr=String.prototype.slice,Te=String.prototype.replace,js=String.prototype.toUpperCase,wi=String.prototype.toLowerCase,vi=RegExp.prototype.test,_i=Array.prototype.concat,we=Array.prototype.join,qs=Array.prototype.slice,bi=Math.floor,Wr=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Hr=Object.getOwnPropertySymbols,Yr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,rt=typeof Symbol=="function"&&typeof Symbol.iterator=="object",K=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===rt||"symbol")?Symbol.toStringTag:null,Ei=Object.prototype.propertyIsEnumerable,Ai=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function xi(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||vi.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-bi(-t):bi(t);if(n!==t){var a=String(n),s=Gr.call(e,a.length+1);return Te.call(a,r,"$&_")+"."+Te.call(Te.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Te.call(e,r,"$&_")}var Xr=$s,Si=Xr.custom,Ii=Ti(Si)?Si:null,Vs=function t(e,r,n,a){var s=r||{};if(Re(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Re(s,"maxStringLength")&&(typeof s.maxStringLength=="number"?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var f=Re(s,"customInspect")?s.customInspect:!0;if(typeof f!="boolean"&&f!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Re(s,"indent")&&s.indent!==null&&s.indent!==" "&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Re(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var p=s.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 Fi(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var h=String(e);return p?xi(e,h):h}if(typeof e=="bigint"){var m=String(e)+"n";return p?xi(e,m):m}var v=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=v&&v>0&&typeof e=="object")return Jr(e)?"[Array]":"[Object]";var _=su(s,n);if(typeof a>"u")a=[];else if(Ri(a,e)>=0)return"[Circular]";function b(M,ne,L){if(ne&&(a=qs.call(a),a.push(ne)),L){var ie={depth:s.depth};return Re(s,"quoteStyle")&&(ie.quoteStyle=s.quoteStyle),t(M,ie,n+1,a)}return t(M,s,n+1,a)}if(typeof e=="function"&&!Oi(e)){var y=Qs(e),x=Zt(e,b);return"[Function"+(y?": "+y:" (anonymous)")+"]"+(x.length>0?" { "+we.call(x,", ")+" }":"")}if(Ti(e)){var I=rt?Te.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Yr.call(e);return typeof e=="object"&&!rt?Et(I):I}if(iu(e)){for(var O="<"+wi.call(String(e.nodeName)),S=e.attributes||[],T=0;T<S.length;T++)O+=" "+S[T].name+"="+Bi(zs(S[T].value),"double",s);return O+=">",e.childNodes&&e.childNodes.length&&(O+="..."),O+="</"+wi.call(String(e.nodeName))+">",O}if(Jr(e)){if(e.length===0)return"[]";var F=Zt(e,b);return _&&!au(F)?"["+Qr(F,_)+"]":"[ "+we.call(F,", ")+" ]"}if(Ws(e)){var R=Zt(e,b);return!("cause"in Error.prototype)&&"cause"in e&&!Ei.call(e,"cause")?"{ ["+String(e)+"] "+we.call(_i.call("[cause]: "+b(e.cause),R),", ")+" }":R.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+we.call(R,", ")+" }"}if(typeof e=="object"&&f){if(Ii&&typeof e[Ii]=="function"&&Xr)return Xr(e,{depth:v-n});if(f!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Zs(e)){var D=[];return yi&&yi.call(e,function(M,ne){D.push(b(ne,e,!0)+" => "+b(M,e))}),Pi("Map",Kt.call(e),D,_)}if(ru(e)){var N=[];return gi&&gi.call(e,function(M){N.push(b(M,e))}),Pi("Set",Qt.call(e),N,_)}if(eu(e))return Kr("WeakMap");if(nu(e))return Kr("WeakSet");if(tu(e))return Kr("WeakRef");if(Ys(e))return Et(b(Number(e)));if(Js(e))return Et(b(Wr.call(e)));if(Xs(e))return Et(Ns.call(e));if(Hs(e))return Et(b(String(e)));if(!Gs(e)&&!Oi(e)){var V=Zt(e,b),k=Ai?Ai(e)===Object.prototype:e instanceof Object||e.constructor===Object,ee=e instanceof Object?"":"null prototype",z=!k&&K&&Object(e)===e&&K in e?Gr.call(Fe(e),8,-1):ee?"Object":"",ue=k||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",Y=ue+(z||ee?"["+we.call(_i.call([],z||[],ee||[]),": ")+"] ":"");return V.length===0?Y+"{}":_?Y+"{"+Qr(V,_)+"}":Y+"{ "+we.call(V,", ")+" }"}return String(e)};function Bi(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function zs(t){return Te.call(String(t),/"/g,"&quot;")}function Jr(t){return Fe(t)==="[object Array]"&&(!K||!(typeof t=="object"&&K in t))}function Gs(t){return Fe(t)==="[object Date]"&&(!K||!(typeof t=="object"&&K in t))}function Oi(t){return Fe(t)==="[object RegExp]"&&(!K||!(typeof t=="object"&&K in t))}function Ws(t){return Fe(t)==="[object Error]"&&(!K||!(typeof t=="object"&&K in t))}function Hs(t){return Fe(t)==="[object String]"&&(!K||!(typeof t=="object"&&K in t))}function Ys(t){return Fe(t)==="[object Number]"&&(!K||!(typeof t=="object"&&K in t))}function Xs(t){return Fe(t)==="[object Boolean]"&&(!K||!(typeof t=="object"&&K in t))}function Ti(t){if(rt)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!Yr)return!1;try{return Yr.call(t),!0}catch{}return!1}function Js(t){if(!t||typeof t!="object"||!Wr)return!1;try{return Wr.call(t),!0}catch{}return!1}var Ks=Object.prototype.hasOwnProperty||function(t){return t in this};function Re(t,e){return Ks.call(t,e)}function Fe(t){return Ms.call(t)}function Qs(t){if(t.name)return t.name;var e=ks.call(Ls.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function Ri(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}function Zs(t){if(!Kt||!t||typeof t!="object")return!1;try{Kt.call(t);try{Qt.call(t)}catch{return!0}return t instanceof Map}catch{}return!1}function eu(t){if(!_t||!t||typeof t!="object")return!1;try{_t.call(t,_t);try{bt.call(t,bt)}catch{return!0}return t instanceof WeakMap}catch{}return!1}function tu(t){if(!mi||!t||typeof t!="object")return!1;try{return mi.call(t),!0}catch{}return!1}function ru(t){if(!Qt||!t||typeof t!="object")return!1;try{Qt.call(t);try{Kt.call(t)}catch{return!0}return t instanceof Set}catch{}return!1}function nu(t){if(!bt||!t||typeof t!="object")return!1;try{bt.call(t,bt);try{_t.call(t,_t)}catch{return!0}return t instanceof WeakSet}catch{}return!1}function iu(t){return!t||typeof t!="object"?!1:typeof HTMLElement<"u"&&t instanceof HTMLElement?!0:typeof t.nodeName=="string"&&typeof t.getAttribute=="function"}function Fi(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return Fi(Gr.call(t,0,e.maxStringLength),e)+n}var a=Te.call(Te.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,ou);return Bi(a,"single",e)}function ou(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+js.call(e.toString(16))}function Et(t){return"Object("+t+")"}function Kr(t){return t+" { ? }"}function Pi(t,e,r,n){var a=n?Qr(r,n):we.call(r,", ");return t+" ("+e+") {"+a+"}"}function au(t){for(var e=0;e<t.length;e++)if(Ri(t[e],`
18
+ `)>=0)return!1;return!0}function su(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=we.call(Array(t.indent+1)," ");else return null;return{base:r,prev:we.call(Array(e+1),r)}}function Qr(t,e){if(t.length===0)return"";var r=`
19
+ `+e.prev+e.base;return r+we.call(t,","+r)+`
20
+ `+e.prev}function Zt(t,e){var r=Jr(t),n=[];if(r){n.length=t.length;for(var a=0;a<t.length;a++)n[a]=Re(t,a)?e(t[a],t):""}var s=typeof Hr=="function"?Hr(t):[],f;if(rt){f={};for(var p=0;p<s.length;p++)f["$"+s[p]]=s[p]}for(var h in t)Re(t,h)&&(r&&String(Number(h))===h&&h<t.length||rt&&f["$"+h]instanceof Symbol||(vi.call(/[^\w$]/,h)?n.push(e(h,t)+": "+e(t[h],t)):n.push(h+": "+e(t[h],t))));if(typeof Hr=="function")for(var m=0;m<s.length;m++)Ei.call(t,s[m])&&n.push("["+e(s[m])+"]: "+e(t[s[m]],t));return n}var Zr=Sr,nt=ya,uu=Vs,cu=Zr("%TypeError%"),er=Zr("%WeakMap%",!0),tr=Zr("%Map%",!0),fu=nt("WeakMap.prototype.get",!0),lu=nt("WeakMap.prototype.set",!0),pu=nt("WeakMap.prototype.has",!0),hu=nt("Map.prototype.get",!0),du=nt("Map.prototype.set",!0),yu=nt("Map.prototype.has",!0),en=function(t,e){for(var r=t,n;(n=r.next)!==null;r=n)if(n.key===e)return r.next=n.next,n.next=t.next,t.next=n,n},gu=function(t,e){var r=en(t,e);return r&&r.value},mu=function(t,e,r){var n=en(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},wu=function(t,e){return!!en(t,e)},vu=function(){var e,r,n,a={assert:function(s){if(!a.has(s))throw new cu("Side channel does not contain "+uu(s))},get:function(s){if(er&&s&&(typeof s=="object"||typeof s=="function")){if(e)return fu(e,s)}else if(tr){if(r)return hu(r,s)}else if(n)return gu(n,s)},has:function(s){if(er&&s&&(typeof s=="object"||typeof s=="function")){if(e)return pu(e,s)}else if(tr){if(r)return yu(r,s)}else if(n)return wu(n,s);return!1},set:function(s,f){er&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new er),lu(e,s,f)):tr?(r||(r=new tr),du(r,s,f)):(n||(n={key:{},next:null}),mu(n,s,f))}};return a},_u=String.prototype.replace,bu=/%20/g,tn={RFC1738:"RFC1738",RFC3986:"RFC3986"},$i={default:tn.RFC3986,formatters:{RFC1738:function(t){return _u.call(t,bu,"+")},RFC3986:function(t){return String(t)}},RFC1738:tn.RFC1738,RFC3986:tn.RFC3986},Eu=$i,rn=Object.prototype.hasOwnProperty,Ve=Array.isArray,ve=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),Au=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(Ve(n)){for(var a=[],s=0;s<n.length;++s)typeof n[s]<"u"&&a.push(n[s]);r.obj[r.prop]=a}}},Ui=function(e,r){for(var n=r&&r.plainObjects?Object.create(null):{},a=0;a<e.length;++a)typeof e[a]<"u"&&(n[a]=e[a]);return n},xu=function t(e,r,n){if(!r)return e;if(typeof r!="object"){if(Ve(e))e.push(r);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!rn.call(Object.prototype,r))&&(e[r]=!0);else return[e,r];return e}if(!e||typeof e!="object")return[e].concat(r);var a=e;return Ve(e)&&!Ve(r)&&(a=Ui(e,n)),Ve(e)&&Ve(r)?(r.forEach(function(s,f){if(rn.call(e,f)){var p=e[f];p&&typeof p=="object"&&s&&typeof s=="object"?e[f]=t(p,s,n):e.push(s)}else e[f]=s}),e):Object.keys(r).reduce(function(s,f){var p=r[f];return rn.call(s,f)?s[f]=t(s[f],p,n):s[f]=p,s},a)},Su=function(e,r){return Object.keys(r).reduce(function(n,a){return n[a]=r[a],n},e)},Iu=function(t,e,r){var n=t.replace(/\+/g," ");if(r==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},Bu=function(e,r,n,a,s){if(e.length===0)return e;var f=e;if(typeof e=="symbol"?f=Symbol.prototype.toString.call(e):typeof e!="string"&&(f=String(e)),n==="iso-8859-1")return escape(f).replace(/%u[0-9a-f]{4}/gi,function(v){return"%26%23"+parseInt(v.slice(2),16)+"%3B"});for(var p="",h=0;h<f.length;++h){var m=f.charCodeAt(h);if(m===45||m===46||m===95||m===126||m>=48&&m<=57||m>=65&&m<=90||m>=97&&m<=122||s===Eu.RFC1738&&(m===40||m===41)){p+=f.charAt(h);continue}if(m<128){p=p+ve[m];continue}if(m<2048){p=p+(ve[192|m>>6]+ve[128|m&63]);continue}if(m<55296||m>=57344){p=p+(ve[224|m>>12]+ve[128|m>>6&63]+ve[128|m&63]);continue}h+=1,m=65536+((m&1023)<<10|f.charCodeAt(h)&1023),p+=ve[240|m>>18]+ve[128|m>>12&63]+ve[128|m>>6&63]+ve[128|m&63]}return p},Ou=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],a=0;a<r.length;++a)for(var s=r[a],f=s.obj[s.prop],p=Object.keys(f),h=0;h<p.length;++h){var m=p[h],v=f[m];typeof v=="object"&&v!==null&&n.indexOf(v)===-1&&(r.push({obj:f,prop:m}),n.push(v))}return Au(r),e},Tu=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Ru=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Fu=function(e,r){return[].concat(e,r)},Pu=function(e,r){if(Ve(e)){for(var n=[],a=0;a<e.length;a+=1)n.push(r(e[a]));return n}return r(e)},$u={arrayToObject:Ui,assign:Su,combine:Fu,compact:Ou,decode:Iu,encode:Bu,isBuffer:Ru,isRegExp:Tu,maybeMap:Pu,merge:xu},Ci=vu,rr=$u,At=$i,Uu=Object.prototype.hasOwnProperty,Di={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},Ae=Array.isArray,Cu=Array.prototype.push,Ni=function(t,e){Cu.apply(t,Ae(e)?e:[e])},Du=Date.prototype.toISOString,Mi=At.default,Q={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:rr.encode,encodeValuesOnly:!1,format:Mi,formatter:At.formatters[Mi],indices:!1,serializeDate:function(e){return Du.call(e)},skipNulls:!1,strictNullHandling:!1},Nu=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},nn={},Mu=function t(e,r,n,a,s,f,p,h,m,v,_,b,y,x,I,O){for(var S=e,T=O,F=0,R=!1;(T=T.get(nn))!==void 0&&!R;){var D=T.get(e);if(F+=1,typeof D<"u"){if(D===F)throw new RangeError("Cyclic object value");R=!0}typeof T.get(nn)>"u"&&(F=0)}if(typeof h=="function"?S=h(r,S):S instanceof Date?S=_(S):n==="comma"&&Ae(S)&&(S=rr.maybeMap(S,function(ie){return ie instanceof Date?_(ie):ie})),S===null){if(s)return p&&!x?p(r,Q.encoder,I,"key",b):r;S=""}if(Nu(S)||rr.isBuffer(S)){if(p){var N=x?r:p(r,Q.encoder,I,"key",b);return[y(N)+"="+y(p(S,Q.encoder,I,"value",b))]}return[y(r)+"="+y(String(S))]}var V=[];if(typeof S>"u")return V;var k;if(n==="comma"&&Ae(S))x&&p&&(S=rr.maybeMap(S,p)),k=[{value:S.length>0?S.join(",")||null:void 0}];else if(Ae(h))k=h;else{var ee=Object.keys(S);k=m?ee.sort(m):ee}for(var z=a&&Ae(S)&&S.length===1?r+"[]":r,ue=0;ue<k.length;++ue){var Y=k[ue],M=typeof Y=="object"&&typeof Y.value<"u"?Y.value:S[Y];if(!(f&&M===null)){var ne=Ae(S)?typeof n=="function"?n(z,Y):z:z+(v?"."+Y:"["+Y+"]");O.set(e,F);var L=Ci();L.set(nn,O),Ni(V,t(M,ne,n,a,s,f,n==="comma"&&x&&Ae(S)?null:p,h,m,v,_,b,y,x,I,L))}}return V},Lu=function(e){if(!e)return Q;if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var r=e.charset||Q.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=At.default;if(typeof e.format<"u"){if(!Uu.call(At.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var a=At.formatters[n],s=Q.filter;return(typeof e.filter=="function"||Ae(e.filter))&&(s=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:Q.addQueryPrefix,allowDots:typeof e.allowDots>"u"?Q.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Q.charsetSentinel,delimiter:typeof e.delimiter>"u"?Q.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Q.encode,encoder:typeof e.encoder=="function"?e.encoder:Q.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Q.encodeValuesOnly,filter:s,format:n,formatter:a,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Q.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Q.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Q.strictNullHandling}},ku=function(t,e){var r=t,n=Lu(e),a,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):Ae(n.filter)&&(s=n.filter,a=s);var f=[];if(typeof r!="object"||r===null)return"";var p;e&&e.arrayFormat in Di?p=e.arrayFormat:e&&"indices"in e?p=e.indices?"indices":"repeat":p="indices";var h=Di[p];if(e&&"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var m=h==="comma"&&e&&e.commaRoundTrip;a||(a=Object.keys(r)),n.sort&&a.sort(n.sort);for(var v=Ci(),_=0;_<a.length;++_){var b=a[_];n.skipNulls&&r[b]===null||Ni(f,Mu(r[b],b,h,m,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,v))}var y=f.join(n.delimiter),x=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?x+="utf8=%26%2310003%3B&":x+="utf8=%E2%9C%93&"),y.length>0?x+y:""},ju=$e(ku);let Li={storeIdentifier:"",environment:"prod"};function qu(t){Li=t}function le(){return Li}const Vu=(t,e="")=>{switch(t){case"prod":return"https://api.rechargeapps.com";case"stage":return"https://api.stage.rechargeapps.com";case"preprod":case"prestage":return`${e}/api`}},xt=(t,e="")=>{switch(t){case"prod":return"https://admin.rechargeapps.com";case"stage":return"https://admin.stage.rechargeapps.com";case"preprod":case"prestage":return e}},zu=t=>{switch(t){case"prod":case"preprod":return"https://static.rechargecdn.com";case"stage":case"prestage":return"https://static.stage.rechargecdn.com"}},Gu="/tools/recurring";class nr{constructor(e,r){this.name="RechargeRequestError",this.message=e,this.status=r}}function Wu(t){return ju(t,{encode:!1,indices:!1,arrayFormat:"comma"})}async function ir(t,e,r={}){const n=le();return ae(t,`${zu(n.environment)}/store/${n.storeIdentifier}${e}`,r)}async function B(t,e,{id:r,query:n,data:a,headers:s}={},f){const{environment:p,environmentUri:h,storeIdentifier:m,loginRetryFn:v}=le(),_=f.apiToken,b=Vu(p,h),y={"X-Recharge-Access-Token":_,"X-Recharge-Version":"2021-11",...s||{}},x={shop_url:m,...n};try{return await ae(t,`${b}${e}`,{id:r,query:x,data:a,headers:y})}catch(I){if(v&&I instanceof nr&&I.status===401)return v().then(O=>{if(O)return ae(t,`${b}${e}`,{id:r,query:x,data:a,headers:{...y,"X-Recharge-Access-Token":O.apiToken}});throw I});throw I}}async function St(t,e,r={}){return ae(t,`${Gu}${e}`,r)}async function ae(t,e,{id:r,query:n,data:a,headers:s}={}){let f=e.trim();if(r&&(f=[f,`${r}`.trim()].join("/")),n){let _;[f,_]=f.split("?");const b=[_,Wu(n)].join("&").replace(/^&/,"");f=`${f}${b?`?${b}`:""}`}let p;a&&t!=="get"&&(p=JSON.stringify(a));const h={Accept:"application/json","Content-Type":"application/json","X-Recharge-App":"storefront-client",...s||{}},m=await fetch(f,{method:t,headers:h,body:p});let v;try{v=await m.json()}catch{}if(!m.ok)throw v&&v.error?new nr(v.error,m.status):v&&v.errors?new nr(JSON.stringify(v.errors),m.status):new nr("A connection error occurred while making the request");return v}function Hu(t,e){return B("get","/addresses",{query:e},t)}async function Yu(t,e,r){const{address:n}=await B("get","/addresses",{id:e,query:{include:r?.include}},t);return n}async function Xu(t,e){const{address:r}=await B("post","/addresses",{data:{customer_id:t.customerId?Number(t.customerId):void 0,...e}},t);return r}async function on(t,e,r){const{address:n}=await B("put","/addresses",{id:e,data:r},t);return n}async function Ju(t,e,r){return on(t,e,{discounts:[{code:r}]})}async function Ku(t,e){return on(t,e,{discounts:[]})}function Qu(t,e){return B("delete","/addresses",{id:e},t)}async function Zu(t,e){const{address:r}=await B("post","/addresses/merge",{data:e},t);return r}async function ec(t,e,r){const{charge:n}=await B("post",`/addresses/${e}/charges/skip`,{data:r},t);return n}var tc=Object.freeze({__proto__:null,applyDiscountToAddress:Ju,createAddress:Xu,deleteAddress:Qu,getAddress:Yu,listAddresses:Hu,mergeAddresses:Zu,removeDiscountsFromAddress:Ku,skipFutureCharge:ec,updateAddress:on});async function rc(){const{storefrontAccessToken:t}=le(),e={};t&&(e["X-Recharge-Storefront-Access-Token"]=t);const r=await St("get","/access",{headers:e});return{apiToken:r.api_token,customerId:r.customer_id,message:r.message}}async function nc(t,e){return ki(t,e)}async function ki(t,e){const{environment:r,environmentUri:n,storefrontAccessToken:a,storeIdentifier:s}=le(),f=xt(r,n),p={};a&&(p["X-Recharge-Storefront-Access-Token"]=a);const{api_token:h,customer_id:m,message:v}=await ae("post",`${f}/shopify_storefront_access`,{data:{customer_token:e,storefront_token:t,shop_url:s},headers:p});return h?{apiToken:h,customerId:m,message:v}:null}async function ic(t){const{environment:e,environmentUri:r,storefrontAccessToken:n,storeIdentifier:a}=le(),s=xt(e,r),f={};n&&(f["X-Recharge-Storefront-Access-Token"]=n);const{api_token:p,customer_id:h,message:m}=await ae("post",`${s}/shopify_customer_account_api_access`,{data:{customer_token:t,shop_url:a},headers:f});return p?{apiToken:p,customerId:h,message:m}:null}async function oc(t,e={}){const{environment:r,environmentUri:n,storefrontAccessToken:a,storeIdentifier:s}=le(),f=xt(r,n),p={};a&&(p["X-Recharge-Storefront-Access-Token"]=a);const h=await ae("post",`${f}/attempt_login`,{data:{email:t,shop:s,...e},headers:p});if(h.errors)throw new Error(h.errors);return h.session_token}async function ac(t,e={}){const{storefrontAccessToken:r}=le(),n={};r&&(n["X-Recharge-Storefront-Access-Token"]=r);const a=await St("post","/attempt_login",{data:{email:t,...e},headers:n});if(a.errors)throw new Error(a.errors);return a.session_token}async function sc(t,e,r){const{environment:n,environmentUri:a,storefrontAccessToken:s,storeIdentifier:f}=le(),p=xt(n,a),h={};s&&(h["X-Recharge-Storefront-Access-Token"]=s);const m=await ae("post",`${p}/validate_login`,{data:{code:r,email:t,session_token:e,shop:f},headers:h});if(m.errors)throw new Error(m.errors);return{apiToken:m.api_token,customerId:m.customer_id}}async function uc(t,e,r){const{storefrontAccessToken:n}=le(),a={};n&&(a["X-Recharge-Storefront-Access-Token"]=n);const s=await St("post","/validate_login",{data:{code:r,email:t,session_token:e},headers:a});if(s.errors)throw new Error(s.errors);return{apiToken:s.api_token,customerId:s.customer_id}}function cc(){const{pathname:t,search:e}=window.location,r=new URLSearchParams(e).get("token"),n=t.split("/").filter(Boolean),a=n.findIndex(f=>f==="portal"),s=a!==-1?n[a+1]:void 0;if(!r||!s)throw new Error("Not in context of Recharge Customer Portal or URL did not contain correct params");return{customerHash:s,token:r}}async function fc(){const{customerHash:t,token:e}=cc(),{environment:r,environmentUri:n,storefrontAccessToken:a,storeIdentifier:s}=le(),f=xt(r,n),p={};a&&(p["X-Recharge-Storefront-Access-Token"]=a);const h=await ae("post",`${f}/customers/${t}/access`,{headers:p,data:{token:e,shop:s}});return{apiToken:h.api_token,customerId:h.customer_id}}var lc=Object.freeze({__proto__:null,loginCustomerPortal:fc,loginShopifyApi:nc,loginShopifyAppProxy:rc,loginWithShopifyCustomerAccount:ic,loginWithShopifyStorefront:ki,sendPasswordlessCode:oc,sendPasswordlessCodeAppProxy:ac,validatePasswordlessCode:sc,validatePasswordlessCodeAppProxy:uc});let pc=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,r)=>(r&=63,r<36?e+=r.toString(36):r<62?e+=(r-26).toString(36).toUpperCase():r>62?e+="-":e+="_",e),"");var ji={exports:{}};/*! For license information please see xdr.js.LICENSE.txt */(function(t,e){(function(r,n){t.exports=n()})(oe,()=>(()=>{var r={899:(s,f,p)=>{const h=p(221);s.exports=h},221:(s,f,p)=>{p.r(f),p.d(f,{Array:()=>lt,Bool:()=>G,Double:()=>hr,Enum:()=>_e,Float:()=>pr,Hyper:()=>M,Int:()=>z,Opaque:()=>$t,Option:()=>Ct,Quadruple:()=>j,Reference:()=>Z,String:()=>Pt,Struct:()=>Pe,Union:()=>Ie,UnsignedHyper:()=>pe,UnsignedInt:()=>L,VarArray:()=>Ut,VarOpaque:()=>Se,Void:()=>X,config:()=>g});class h extends TypeError{constructor(o){super(`XDR Write Error: ${o}`)}}class m extends TypeError{constructor(o){super(`XDR Read Error: ${o}`)}}class v extends TypeError{constructor(o){super(`XDR Type Definition Error: ${o}`)}}class _ extends v{constructor(){super("method not implemented, it should be overloaded in the descendant class.")}}var b=p(764).lW;class y{constructor(o){if(!b.isBuffer(o)){if(!(o instanceof Array))throw new m("source not specified");o=b.from(o)}this._buffer=o,this._length=o.length,this._index=0}_buffer;_length;_index;get eof(){return this._index===this._length}advance(o){const l=this._index;if(this._index+=o,this._length<this._index)throw new m("attempt to read outside the boundary of the buffer");const w=4-(o%4||4);if(w>0){for(let A=0;A<w;A++)if(this._buffer[this._index+A]!==0)throw new m("invalid padding");this._index+=w}return l}rewind(){this._index=0}read(o){const l=this.advance(o);return this._buffer.subarray(l,l+o)}readInt32BE(){return this._buffer.readInt32BE(this.advance(4))}readUInt32BE(){return this._buffer.readUInt32BE(this.advance(4))}readBigInt64BE(){return this._buffer.readBigInt64BE(this.advance(8))}readBigUInt64BE(){return this._buffer.readBigUInt64BE(this.advance(8))}readFloatBE(){return this._buffer.readFloatBE(this.advance(4))}readDoubleBE(){return this._buffer.readDoubleBE(this.advance(8))}ensureInputConsumed(){if(this._index!==this._length)throw new m("invalid XDR contract typecast - source buffer not entirely consumed")}}var x=p(764).lW;const I=8192;class O{constructor(o){typeof o=="number"?o=x.allocUnsafe(o):o instanceof x||(o=x.allocUnsafe(I)),this._buffer=o,this._length=o.length}_buffer;_length;_index=0;alloc(o){const l=this._index;return this._index+=o,this._length<this._index&&this.resize(this._index),l}resize(o){const l=Math.ceil(o/I)*I,w=x.allocUnsafe(l);this._buffer.copy(w,0,0,this._length),this._buffer=w,this._length=l}finalize(){return this._buffer.subarray(0,this._index)}toArray(){return[...this.finalize()]}write(o,l){if(typeof o=="string"){const A=this.alloc(l);this._buffer.write(o,A,"utf8")}else{o instanceof x||(o=x.from(o));const A=this.alloc(l);o.copy(this._buffer,A,0,l)}const w=4-(l%4||4);if(w>0){const A=this.alloc(w);this._buffer.fill(0,A,this._index)}}writeInt32BE(o){const l=this.alloc(4);this._buffer.writeInt32BE(o,l)}writeUInt32BE(o){const l=this.alloc(4);this._buffer.writeUInt32BE(o,l)}writeBigInt64BE(o){const l=this.alloc(8);this._buffer.writeBigInt64BE(o,l)}writeBigUInt64BE(o){const l=this.alloc(8);this._buffer.writeBigUInt64BE(o,l)}writeFloatBE(o){const l=this.alloc(4);this._buffer.writeFloatBE(o,l)}writeDoubleBE(o){const l=this.alloc(8);this._buffer.writeDoubleBE(o,l)}static bufferChunkSize=I}var S=p(764).lW;class T{toXDR(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"raw";if(!this.write)return this.constructor.toXDR(this,o);const l=new O;return this.write(this,l),N(l.finalize(),o)}fromXDR(o){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"raw";if(!this.read)return this.constructor.fromXDR(o,l);const w=new y(V(o,l)),A=this.read(w);return w.ensureInputConsumed(),A}validateXDR(o){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"raw";try{return this.fromXDR(o,l),!0}catch{return!1}}static toXDR(o){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"raw";const w=new O;return this.write(o,w),N(w.finalize(),l)}static fromXDR(o){const l=new y(V(o,arguments.length>1&&arguments[1]!==void 0?arguments[1]:"raw")),w=this.read(l);return l.ensureInputConsumed(),w}static validateXDR(o){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"raw";try{return this.fromXDR(o,l),!0}catch{return!1}}}class F extends T{static read(o){throw new _}static write(o,l){throw new _}static isValid(o){return!1}}class R extends T{isValid(o){return!1}}class D extends TypeError{constructor(o){super(`Invalid format ${o}, must be one of "raw", "hex", "base64"`)}}function N(d,o){switch(o){case"raw":return d;case"hex":return d.toString("hex");case"base64":return d.toString("base64");default:throw new D(o)}}function V(d,o){switch(o){case"raw":return d;case"hex":return S.from(d,"hex");case"base64":return S.from(d,"base64");default:throw new D(o)}}const k=2147483647,ee=-2147483648;class z extends F{static read(o){return o.readInt32BE()}static write(o,l){if(typeof o!="number")throw new h("not a number");if((0|o)!==o)throw new h("invalid i32 value");l.writeInt32BE(o)}static isValid(o){return typeof o=="number"&&(0|o)===o&&o>=ee&&o<=k}}z.MAX_VALUE=k,z.MIN_VALUE=2147483648;const ue=-9223372036854775808n,Y=9223372036854775807n;class M extends F{constructor(o,l){if(super(),typeof o=="bigint"){if(o<ue||o>Y)throw new TypeError("Invalid i64 value");this._value=o}else{if((0|o)!==o||(0|l)!==l)throw new TypeError("Invalid i64 value");this._value=BigInt(l>>>0)<<32n|BigInt(o>>>0)}}get low(){return Number(0xFFFFFFFFn&this._value)<<0}get high(){return Number(this._value>>32n)>>0}get unsigned(){return!1}toString(){return this._value.toString()}toJSON(){return{_value:this._value.toString()}}static read(o){return new M(o.readBigInt64BE())}static write(o,l){if(!(o instanceof this))throw new h(`${o} is not a Hyper`);l.writeBigInt64BE(o._value)}static fromString(o){if(!/^-?\d{0,19}$/.test(o))throw new TypeError(`Invalid i64 string value: ${o}`);return new M(BigInt(o))}static fromBits(o,l){return new this(o,l)}static isValid(o){return o instanceof this}}M.MAX_VALUE=new M(Y),M.MIN_VALUE=new M(ue);const ne=4294967295;class L extends F{static read(o){return o.readUInt32BE()}static write(o,l){if(typeof o!="number"||!(o>=0&&o<=ne)||o%1!=0)throw new h("invalid u32 value");l.writeUInt32BE(o)}static isValid(o){return typeof o=="number"&&o%1==0&&o>=0&&o<=ne}}L.MAX_VALUE=ne,L.MIN_VALUE=0;const ie=0n,lr=0xFFFFFFFFFFFFFFFFn;class pe extends F{constructor(o,l){if(super(),typeof o=="bigint"){if(o<ie||o>lr)throw new TypeError("Invalid u64 value");this._value=o}else{if((0|o)!==o||(0|l)!==l)throw new TypeError("Invalid u64 value");this._value=BigInt(l>>>0)<<32n|BigInt(o>>>0)}}get low(){return Number(0xFFFFFFFFn&this._value)<<0}get high(){return Number(this._value>>32n)>>0}get unsigned(){return!0}toString(){return this._value.toString()}toJSON(){return{_value:this._value.toString()}}static read(o){return new pe(o.readBigUInt64BE())}static write(o,l){if(!(o instanceof this))throw new h(`${o} is not an UnsignedHyper`);l.writeBigUInt64BE(o._value)}static fromString(o){if(!/^\d{0,20}$/.test(o))throw new TypeError(`Invalid u64 string value: ${o}`);return new pe(BigInt(o))}static fromBits(o,l){return new this(o,l)}static isValid(o){return o instanceof this}}pe.MAX_VALUE=new pe(lr),pe.MIN_VALUE=new pe(ie);class pr extends F{static read(o){return o.readFloatBE()}static write(o,l){if(typeof o!="number")throw new h("not a number");l.writeFloatBE(o)}static isValid(o){return typeof o=="number"}}class hr extends F{static read(o){return o.readDoubleBE()}static write(o,l){if(typeof o!="number")throw new h("not a number");l.writeDoubleBE(o)}static isValid(o){return typeof o=="number"}}class j extends F{static read(){throw new v("quadruple not supported")}static write(){throw new v("quadruple not supported")}static isValid(){return!1}}class G extends F{static read(o){const l=z.read(o);switch(l){case 0:return!1;case 1:return!0;default:throw new m(`got ${l} when trying to read a bool`)}}static write(o,l){const w=o?1:0;z.write(w,l)}static isValid(o){return typeof o=="boolean"}}var ft=p(764).lW;class Pt extends R{constructor(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:L.MAX_VALUE;super(),this._maxLength=o}read(o){const l=L.read(o);if(l>this._maxLength)throw new m(`saw ${l} length String, max allowed is ${this._maxLength}`);return o.read(l)}readString(o){return this.read(o).toString("utf8")}write(o,l){const w=typeof o=="string"?ft.byteLength(o,"utf8"):o.length;if(w>this._maxLength)throw new h(`got ${o.length} bytes, max allowed is ${this._maxLength}`);L.write(w,l),l.write(o,w)}isValid(o){return typeof o=="string"?ft.byteLength(o,"utf8")<=this._maxLength:!!(o instanceof Array||ft.isBuffer(o))&&o.length<=this._maxLength}}var dr=p(764).lW;class $t extends R{constructor(o){super(),this._length=o}read(o){return o.read(this._length)}write(o,l){const{length:w}=o;if(w!==this._length)throw new h(`got ${o.length} bytes, expected ${this._length}`);l.write(o,w)}isValid(o){return dr.isBuffer(o)&&o.length===this._length}}var yr=p(764).lW;class Se extends R{constructor(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:L.MAX_VALUE;super(),this._maxLength=o}read(o){const l=L.read(o);if(l>this._maxLength)throw new m(`saw ${l} length VarOpaque, max allowed is ${this._maxLength}`);return o.read(l)}write(o,l){const{length:w}=o;if(o.length>this._maxLength)throw new h(`got ${o.length} bytes, max allowed is ${this._maxLength}`);L.write(w,l),l.write(o,w)}isValid(o){return yr.isBuffer(o)&&o.length<=this._maxLength}}class lt extends R{constructor(o,l){super(),this._childType=o,this._length=l}read(o){const l=new p.g.Array(this._length);for(let w=0;w<this._length;w++)l[w]=this._childType.read(o);return l}write(o,l){if(!(o instanceof p.g.Array))throw new h("value is not array");if(o.length!==this._length)throw new h(`got array of size ${o.length}, expected ${this._length}`);for(const w of o)this._childType.write(w,l)}isValid(o){if(!(o instanceof p.g.Array)||o.length!==this._length)return!1;for(const l of o)if(!this._childType.isValid(l))return!1;return!0}}class Ut extends R{constructor(o){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:L.MAX_VALUE;super(),this._childType=o,this._maxLength=l}read(o){const l=L.read(o);if(l>this._maxLength)throw new m(`saw ${l} length VarArray, max allowed is ${this._maxLength}`);const w=new Array(l);for(let A=0;A<l;A++)w[A]=this._childType.read(o);return w}write(o,l){if(!(o instanceof Array))throw new h("value is not array");if(o.length>this._maxLength)throw new h(`got array of size ${o.length}, max allowed is ${this._maxLength}`);L.write(o.length,l);for(const w of o)this._childType.write(w,l)}isValid(o){if(!(o instanceof Array)||o.length>this._maxLength)return!1;for(const l of o)if(!this._childType.isValid(l))return!1;return!0}}class Ct extends F{constructor(o){super(),this._childType=o}read(o){if(G.read(o))return this._childType.read(o)}write(o,l){const w=o!=null;G.write(w,l),w&&this._childType.write(o,l)}isValid(o){return o==null||this._childType.isValid(o)}}class X extends F{static read(){}static write(o){if(o!==void 0)throw new h("trying to write value to a void slot")}static isValid(o){return o===void 0}}class _e extends F{constructor(o,l){super(),this.name=o,this.value=l}static read(o){const l=z.read(o),w=this._byValue[l];if(w===void 0)throw new m(`unknown ${this.enumName} member for value ${l}`);return w}static write(o,l){if(!(o instanceof this))throw new h(`unknown ${o} is not a ${this.enumName}`);z.write(o.value,l)}static isValid(o){return o instanceof this}static members(){return this._members}static values(){return Object.values(this._members)}static fromName(o){const l=this._members[o];if(!l)throw new TypeError(`${o} is not a member of ${this.enumName}`);return l}static fromValue(o){const l=this._byValue[o];if(l===void 0)throw new TypeError(`${o} is not a value of any member of ${this.enumName}`);return l}static create(o,l,w){const A=class extends _e{};A.enumName=l,o.results[l]=A,A._members={},A._byValue={};for(const[$,P]of Object.entries(w)){const U=new A($,P);A._members[$]=U,A._byValue[P]=U,A[$]=()=>U}return A}}class Z extends F{resolve(){throw new v('"resolve" method should be implemented in the descendant class')}}class Pe extends F{constructor(o){super(),this._attributes=o||{}}static read(o){const l={};for(const[w,A]of this._fields)l[w]=A.read(o);return new this(l)}static write(o,l){if(!(o instanceof this))throw new h(`${o} is not a ${this.structName}`);for(const[w,A]of this._fields){const $=o._attributes[w];A.write($,l)}}static isValid(o){return o instanceof this}static create(o,l,w){const A=class extends Pe{};A.structName=l,o.results[l]=A;const $=new Array(w.length);for(let P=0;P<w.length;P++){const U=w[P],Dt=U[0];let mr=U[1];mr instanceof Z&&(mr=mr.resolve(o)),$[P]=[Dt,mr],A.prototype[Dt]=gr(Dt)}return A._fields=$,A}}function gr(d){return function(o){return o!==void 0&&(this._attributes[d]=o),this._attributes[d]}}class Ie extends R{constructor(o,l){super(),this.set(o,l)}set(o,l){typeof o=="string"&&(o=this.constructor._switchOn.fromName(o)),this._switch=o;const w=this.constructor.armForSwitch(this._switch);this._arm=w,this._armType=w===X?X:this.constructor._arms[w],this._value=l}get(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this._arm;if(this._arm!==X&&this._arm!==o)throw new TypeError(`${o} not set`);return this._value}switch(){return this._switch}arm(){return this._arm}armType(){return this._armType}value(){return this._value}static armForSwitch(o){const l=this._switches.get(o);if(l!==void 0)return l;if(this._defaultArm)return this._defaultArm;throw new TypeError(`Bad union switch: ${o}`)}static armTypeForArm(o){return o===X?X:this._arms[o]}static read(o){const l=this._switchOn.read(o),w=this.armForSwitch(l),A=w===X?X:this._arms[w];let $;return $=A!==void 0?A.read(o):w.read(o),new this(l,$)}static write(o,l){if(!(o instanceof this))throw new h(`${o} is not a ${this.unionName}`);this._switchOn.write(o.switch(),l),o.armType().write(o.value(),l)}static isValid(o){return o instanceof this}static create(o,l,w){const A=class extends Ie{};A.unionName=l,o.results[l]=A,w.switchOn instanceof Z?A._switchOn=w.switchOn.resolve(o):A._switchOn=w.switchOn,A._switches=new Map,A._arms={};let $=w.defaultArm;$ instanceof Z&&($=$.resolve(o)),A._defaultArm=$;for(const[P,U]of w.switches){const Dt=typeof P=="string"?A._switchOn.fromName(P):P;A._switches.set(Dt,U)}if(A._switchOn.values!==void 0)for(const P of A._switchOn.values())A[P.name]=function(U){return new A(P,U)},A.prototype[P.name]=function(U){return this.set(P,U)};if(w.arms)for(const[P,U]of Object.entries(w.arms))A._arms[P]=U instanceof Z?U.resolve(o):U,U!==X&&(A.prototype[P]=function(){return this.get(P)});return A}}class ce extends Z{constructor(o){super(),this.name=o}resolve(o){return o.definitions[this.name].resolve(o)}}class pt extends Z{constructor(o,l){let w=arguments.length>2&&arguments[2]!==void 0&&arguments[2];super(),this.childReference=o,this.length=l,this.variable=w}resolve(o){let l=this.childReference,w=this.length;return l instanceof Z&&(l=l.resolve(o)),w instanceof Z&&(w=w.resolve(o)),this.variable?new Ut(l,w):new lt(l,w)}}class xn extends Z{constructor(o){super(),this.childReference=o,this.name=o.name}resolve(o){let l=this.childReference;return l instanceof Z&&(l=l.resolve(o)),new Ct(l)}}class fe extends Z{constructor(o,l){super(),this.sizedType=o,this.length=l}resolve(o){let l=this.length;return l instanceof Z&&(l=l.resolve(o)),new this.sizedType(l)}}class He{constructor(o,l,w){this.constructor=o,this.name=l,this.config=w}resolve(o){return this.name in o.results?o.results[this.name]:this.constructor(o,this.name,this.config)}}function i(d,o,l){return l instanceof Z&&(l=l.resolve(d)),d.results[o]=l,l}function u(d,o,l){return d.results[o]=l,l}class c{constructor(o){this._destination=o,this._definitions={}}enum(o,l){const w=new He(_e.create,o,l);this.define(o,w)}struct(o,l){const w=new He(Pe.create,o,l);this.define(o,w)}union(o,l){const w=new He(Ie.create,o,l);this.define(o,w)}typedef(o,l){const w=new He(i,o,l);this.define(o,w)}const(o,l){const w=new He(u,o,l);this.define(o,w)}void(){return X}bool(){return G}int(){return z}hyper(){return M}uint(){return L}uhyper(){return pe}float(){return pr}double(){return hr}quadruple(){return j}string(o){return new fe(Pt,o)}opaque(o){return new fe($t,o)}varOpaque(o){return new fe(Se,o)}array(o,l){return new pt(o,l)}varArray(o,l){return new pt(o,l,!0)}option(o){return new xn(o)}define(o,l){if(this._destination[o]!==void 0)throw new v(`${o} is already defined`);this._definitions[o]=l}lookup(o){return new ce(o)}resolve(){for(const o of Object.values(this._definitions))o.resolve({definitions:this._definitions,results:this._destination})}}function g(d){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(d){const l=new c(o);d(l),l.resolve()}return o}},742:(s,f)=>{f.byteLength=function(x){var I=b(x),O=I[0],S=I[1];return 3*(O+S)/4-S},f.toByteArray=function(x){var I,O,S=b(x),T=S[0],F=S[1],R=new m(function(V,k,ee){return 3*(k+ee)/4-ee}(0,T,F)),D=0,N=F>0?T-4:T;for(O=0;O<N;O+=4)I=h[x.charCodeAt(O)]<<18|h[x.charCodeAt(O+1)]<<12|h[x.charCodeAt(O+2)]<<6|h[x.charCodeAt(O+3)],R[D++]=I>>16&255,R[D++]=I>>8&255,R[D++]=255&I;return F===2&&(I=h[x.charCodeAt(O)]<<2|h[x.charCodeAt(O+1)]>>4,R[D++]=255&I),F===1&&(I=h[x.charCodeAt(O)]<<10|h[x.charCodeAt(O+1)]<<4|h[x.charCodeAt(O+2)]>>2,R[D++]=I>>8&255,R[D++]=255&I),R},f.fromByteArray=function(x){for(var I,O=x.length,S=O%3,T=[],F=16383,R=0,D=O-S;R<D;R+=F)T.push(y(x,R,R+F>D?D:R+F));return S===1?(I=x[O-1],T.push(p[I>>2]+p[I<<4&63]+"==")):S===2&&(I=(x[O-2]<<8)+x[O-1],T.push(p[I>>10]+p[I>>4&63]+p[I<<2&63]+"=")),T.join("")};for(var p=[],h=[],m=typeof Uint8Array<"u"?Uint8Array:Array,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_=0;_<64;++_)p[_]=v[_],h[v.charCodeAt(_)]=_;function b(x){var I=x.length;if(I%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var O=x.indexOf("=");return O===-1&&(O=I),[O,O===I?0:4-O%4]}function y(x,I,O){for(var S,T,F=[],R=I;R<O;R+=3)S=(x[R]<<16&16711680)+(x[R+1]<<8&65280)+(255&x[R+2]),F.push(p[(T=S)>>18&63]+p[T>>12&63]+p[T>>6&63]+p[63&T]);return F.join("")}h["-".charCodeAt(0)]=62,h["_".charCodeAt(0)]=63},764:(s,f,p)=>{const h=p(742),m=p(645),v=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;f.lW=y,f.h2=50;const _=2147483647;function b(i){if(i>_)throw new RangeError('The value "'+i+'" is invalid for option "size"');const u=new Uint8Array(i);return Object.setPrototypeOf(u,y.prototype),u}function y(i,u,c){if(typeof i=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return O(i)}return x(i,u,c)}function x(i,u,c){if(typeof i=="string")return function(o,l){if(typeof l=="string"&&l!==""||(l="utf8"),!y.isEncoding(l))throw new TypeError("Unknown encoding: "+l);const w=0|R(o,l);let A=b(w);const $=A.write(o,l);return $!==w&&(A=A.slice(0,$)),A}(i,u);if(ArrayBuffer.isView(i))return function(o){if(ce(o,Uint8Array)){const l=new Uint8Array(o);return T(l.buffer,l.byteOffset,l.byteLength)}return S(o)}(i);if(i==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i);if(ce(i,ArrayBuffer)||i&&ce(i.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ce(i,SharedArrayBuffer)||i&&ce(i.buffer,SharedArrayBuffer)))return T(i,u,c);if(typeof i=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const g=i.valueOf&&i.valueOf();if(g!=null&&g!==i)return y.from(g,u,c);const d=function(o){if(y.isBuffer(o)){const l=0|F(o.length),w=b(l);return w.length===0||o.copy(w,0,0,l),w}if(o.length!==void 0)return typeof o.length!="number"||pt(o.length)?b(0):S(o);if(o.type==="Buffer"&&Array.isArray(o.data))return S(o.data)}(i);if(d)return d;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof i[Symbol.toPrimitive]=="function")return y.from(i[Symbol.toPrimitive]("string"),u,c);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i)}function I(i){if(typeof i!="number")throw new TypeError('"size" argument must be of type number');if(i<0)throw new RangeError('The value "'+i+'" is invalid for option "size"')}function O(i){return I(i),b(i<0?0:0|F(i))}function S(i){const u=i.length<0?0:0|F(i.length),c=b(u);for(let g=0;g<u;g+=1)c[g]=255&i[g];return c}function T(i,u,c){if(u<0||i.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(i.byteLength<u+(c||0))throw new RangeError('"length" is outside of buffer bounds');let g;return g=u===void 0&&c===void 0?new Uint8Array(i):c===void 0?new Uint8Array(i,u):new Uint8Array(i,u,c),Object.setPrototypeOf(g,y.prototype),g}function F(i){if(i>=_)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+_.toString(16)+" bytes");return 0|i}function R(i,u){if(y.isBuffer(i))return i.length;if(ArrayBuffer.isView(i)||ce(i,ArrayBuffer))return i.byteLength;if(typeof i!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof i);const c=i.length,g=arguments.length>2&&arguments[2]===!0;if(!g&&c===0)return 0;let d=!1;for(;;)switch(u){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":return Pe(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*c;case"hex":return c>>>1;case"base64":return gr(i).length;default:if(d)return g?-1:Pe(i).length;u=(""+u).toLowerCase(),d=!0}}function D(i,u,c){let g=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((c===void 0||c>this.length)&&(c=this.length),c<=0)||(c>>>=0)<=(u>>>=0))return"";for(i||(i="utf8");;)switch(i){case"hex":return pr(this,u,c);case"utf8":case"utf-8":return L(this,u,c);case"ascii":return lr(this,u,c);case"latin1":case"binary":return pe(this,u,c);case"base64":return ne(this,u,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return hr(this,u,c);default:if(g)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),g=!0}}function N(i,u,c){const g=i[u];i[u]=i[c],i[c]=g}function V(i,u,c,g,d){if(i.length===0)return-1;if(typeof c=="string"?(g=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),pt(c=+c)&&(c=d?0:i.length-1),c<0&&(c=i.length+c),c>=i.length){if(d)return-1;c=i.length-1}else if(c<0){if(!d)return-1;c=0}if(typeof u=="string"&&(u=y.from(u,g)),y.isBuffer(u))return u.length===0?-1:k(i,u,c,g,d);if(typeof u=="number")return u&=255,typeof Uint8Array.prototype.indexOf=="function"?d?Uint8Array.prototype.indexOf.call(i,u,c):Uint8Array.prototype.lastIndexOf.call(i,u,c):k(i,[u],c,g,d);throw new TypeError("val must be string, number or Buffer")}function k(i,u,c,g,d){let o,l=1,w=i.length,A=u.length;if(g!==void 0&&((g=String(g).toLowerCase())==="ucs2"||g==="ucs-2"||g==="utf16le"||g==="utf-16le")){if(i.length<2||u.length<2)return-1;l=2,w/=2,A/=2,c/=2}function $(P,U){return l===1?P[U]:P.readUInt16BE(U*l)}if(d){let P=-1;for(o=c;o<w;o++)if($(i,o)===$(u,P===-1?0:o-P)){if(P===-1&&(P=o),o-P+1===A)return P*l}else P!==-1&&(o-=o-P),P=-1}else for(c+A>w&&(c=w-A),o=c;o>=0;o--){let P=!0;for(let U=0;U<A;U++)if($(i,o+U)!==$(u,U)){P=!1;break}if(P)return o}return-1}function ee(i,u,c,g){c=Number(c)||0;const d=i.length-c;g?(g=Number(g))>d&&(g=d):g=d;const o=u.length;let l;for(g>o/2&&(g=o/2),l=0;l<g;++l){const w=parseInt(u.substr(2*l,2),16);if(pt(w))return l;i[c+l]=w}return l}function z(i,u,c,g){return Ie(Pe(u,i.length-c),i,c,g)}function ue(i,u,c,g){return Ie(function(d){const o=[];for(let l=0;l<d.length;++l)o.push(255&d.charCodeAt(l));return o}(u),i,c,g)}function Y(i,u,c,g){return Ie(gr(u),i,c,g)}function M(i,u,c,g){return Ie(function(d,o){let l,w,A;const $=[];for(let P=0;P<d.length&&!((o-=2)<0);++P)l=d.charCodeAt(P),w=l>>8,A=l%256,$.push(A),$.push(w);return $}(u,i.length-c),i,c,g)}function ne(i,u,c){return u===0&&c===i.length?h.fromByteArray(i):h.fromByteArray(i.slice(u,c))}function L(i,u,c){c=Math.min(i.length,c);const g=[];let d=u;for(;d<c;){const o=i[d];let l=null,w=o>239?4:o>223?3:o>191?2:1;if(d+w<=c){let A,$,P,U;switch(w){case 1:o<128&&(l=o);break;case 2:A=i[d+1],(192&A)==128&&(U=(31&o)<<6|63&A,U>127&&(l=U));break;case 3:A=i[d+1],$=i[d+2],(192&A)==128&&(192&$)==128&&(U=(15&o)<<12|(63&A)<<6|63&$,U>2047&&(U<55296||U>57343)&&(l=U));break;case 4:A=i[d+1],$=i[d+2],P=i[d+3],(192&A)==128&&(192&$)==128&&(192&P)==128&&(U=(15&o)<<18|(63&A)<<12|(63&$)<<6|63&P,U>65535&&U<1114112&&(l=U))}}l===null?(l=65533,w=1):l>65535&&(l-=65536,g.push(l>>>10&1023|55296),l=56320|1023&l),g.push(l),d+=w}return function(o){const l=o.length;if(l<=ie)return String.fromCharCode.apply(String,o);let w="",A=0;for(;A<l;)w+=String.fromCharCode.apply(String,o.slice(A,A+=ie));return w}(g)}y.TYPED_ARRAY_SUPPORT=function(){try{const i=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(i,u),i.foo()===42}catch{return!1}}(),y.TYPED_ARRAY_SUPPORT||typeof console>"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(y.prototype,"parent",{enumerable:!0,get:function(){if(y.isBuffer(this))return this.buffer}}),Object.defineProperty(y.prototype,"offset",{enumerable:!0,get:function(){if(y.isBuffer(this))return this.byteOffset}}),y.poolSize=8192,y.from=function(i,u,c){return x(i,u,c)},Object.setPrototypeOf(y.prototype,Uint8Array.prototype),Object.setPrototypeOf(y,Uint8Array),y.alloc=function(i,u,c){return function(g,d,o){return I(g),g<=0?b(g):d!==void 0?typeof o=="string"?b(g).fill(d,o):b(g).fill(d):b(g)}(i,u,c)},y.allocUnsafe=function(i){return O(i)},y.allocUnsafeSlow=function(i){return O(i)},y.isBuffer=function(i){return i!=null&&i._isBuffer===!0&&i!==y.prototype},y.compare=function(i,u){if(ce(i,Uint8Array)&&(i=y.from(i,i.offset,i.byteLength)),ce(u,Uint8Array)&&(u=y.from(u,u.offset,u.byteLength)),!y.isBuffer(i)||!y.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(i===u)return 0;let c=i.length,g=u.length;for(let d=0,o=Math.min(c,g);d<o;++d)if(i[d]!==u[d]){c=i[d],g=u[d];break}return c<g?-1:g<c?1:0},y.isEncoding=function(i){switch(String(i).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},y.concat=function(i,u){if(!Array.isArray(i))throw new TypeError('"list" argument must be an Array of Buffers');if(i.length===0)return y.alloc(0);let c;if(u===void 0)for(u=0,c=0;c<i.length;++c)u+=i[c].length;const g=y.allocUnsafe(u);let d=0;for(c=0;c<i.length;++c){let o=i[c];if(ce(o,Uint8Array))d+o.length>g.length?(y.isBuffer(o)||(o=y.from(o)),o.copy(g,d)):Uint8Array.prototype.set.call(g,o,d);else{if(!y.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(g,d)}d+=o.length}return g},y.byteLength=R,y.prototype._isBuffer=!0,y.prototype.swap16=function(){const i=this.length;if(i%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let u=0;u<i;u+=2)N(this,u,u+1);return this},y.prototype.swap32=function(){const i=this.length;if(i%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let u=0;u<i;u+=4)N(this,u,u+3),N(this,u+1,u+2);return this},y.prototype.swap64=function(){const i=this.length;if(i%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let u=0;u<i;u+=8)N(this,u,u+7),N(this,u+1,u+6),N(this,u+2,u+5),N(this,u+3,u+4);return this},y.prototype.toString=function(){const i=this.length;return i===0?"":arguments.length===0?L(this,0,i):D.apply(this,arguments)},y.prototype.toLocaleString=y.prototype.toString,y.prototype.equals=function(i){if(!y.isBuffer(i))throw new TypeError("Argument must be a Buffer");return this===i||y.compare(this,i)===0},y.prototype.inspect=function(){let i="";const u=f.h2;return i=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(i+=" ... "),"<Buffer "+i+">"},v&&(y.prototype[v]=y.prototype.inspect),y.prototype.compare=function(i,u,c,g,d){if(ce(i,Uint8Array)&&(i=y.from(i,i.offset,i.byteLength)),!y.isBuffer(i))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof i);if(u===void 0&&(u=0),c===void 0&&(c=i?i.length:0),g===void 0&&(g=0),d===void 0&&(d=this.length),u<0||c>i.length||g<0||d>this.length)throw new RangeError("out of range index");if(g>=d&&u>=c)return 0;if(g>=d)return-1;if(u>=c)return 1;if(this===i)return 0;let o=(d>>>=0)-(g>>>=0),l=(c>>>=0)-(u>>>=0);const w=Math.min(o,l),A=this.slice(g,d),$=i.slice(u,c);for(let P=0;P<w;++P)if(A[P]!==$[P]){o=A[P],l=$[P];break}return o<l?-1:l<o?1:0},y.prototype.includes=function(i,u,c){return this.indexOf(i,u,c)!==-1},y.prototype.indexOf=function(i,u,c){return V(this,i,u,c,!0)},y.prototype.lastIndexOf=function(i,u,c){return V(this,i,u,c,!1)},y.prototype.write=function(i,u,c,g){if(u===void 0)g="utf8",c=this.length,u=0;else if(c===void 0&&typeof u=="string")g=u,c=this.length,u=0;else{if(!isFinite(u))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");u>>>=0,isFinite(c)?(c>>>=0,g===void 0&&(g="utf8")):(g=c,c=void 0)}const d=this.length-u;if((c===void 0||c>d)&&(c=d),i.length>0&&(c<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");g||(g="utf8");let o=!1;for(;;)switch(g){case"hex":return ee(this,i,u,c);case"utf8":case"utf-8":return z(this,i,u,c);case"ascii":case"latin1":case"binary":return ue(this,i,u,c);case"base64":return Y(this,i,u,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,i,u,c);default:if(o)throw new TypeError("Unknown encoding: "+g);g=(""+g).toLowerCase(),o=!0}},y.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const ie=4096;function lr(i,u,c){let g="";c=Math.min(i.length,c);for(let d=u;d<c;++d)g+=String.fromCharCode(127&i[d]);return g}function pe(i,u,c){let g="";c=Math.min(i.length,c);for(let d=u;d<c;++d)g+=String.fromCharCode(i[d]);return g}function pr(i,u,c){const g=i.length;(!u||u<0)&&(u=0),(!c||c<0||c>g)&&(c=g);let d="";for(let o=u;o<c;++o)d+=xn[i[o]];return d}function hr(i,u,c){const g=i.slice(u,c);let d="";for(let o=0;o<g.length-1;o+=2)d+=String.fromCharCode(g[o]+256*g[o+1]);return d}function j(i,u,c){if(i%1!=0||i<0)throw new RangeError("offset is not uint");if(i+u>c)throw new RangeError("Trying to access beyond buffer length")}function G(i,u,c,g,d,o){if(!y.isBuffer(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>d||u<o)throw new RangeError('"value" argument is out of bounds');if(c+g>i.length)throw new RangeError("Index out of range")}function ft(i,u,c,g,d){Ct(u,g,d,i,c,7);let o=Number(u&BigInt(4294967295));i[c++]=o,o>>=8,i[c++]=o,o>>=8,i[c++]=o,o>>=8,i[c++]=o;let l=Number(u>>BigInt(32)&BigInt(4294967295));return i[c++]=l,l>>=8,i[c++]=l,l>>=8,i[c++]=l,l>>=8,i[c++]=l,c}function Pt(i,u,c,g,d){Ct(u,g,d,i,c,7);let o=Number(u&BigInt(4294967295));i[c+7]=o,o>>=8,i[c+6]=o,o>>=8,i[c+5]=o,o>>=8,i[c+4]=o;let l=Number(u>>BigInt(32)&BigInt(4294967295));return i[c+3]=l,l>>=8,i[c+2]=l,l>>=8,i[c+1]=l,l>>=8,i[c]=l,c+8}function dr(i,u,c,g,d,o){if(c+g>i.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function $t(i,u,c,g,d){return u=+u,c>>>=0,d||dr(i,0,c,4),m.write(i,u,c,g,23,4),c+4}function yr(i,u,c,g,d){return u=+u,c>>>=0,d||dr(i,0,c,8),m.write(i,u,c,g,52,8),c+8}y.prototype.slice=function(i,u){const c=this.length;(i=~~i)<0?(i+=c)<0&&(i=0):i>c&&(i=c),(u=u===void 0?c:~~u)<0?(u+=c)<0&&(u=0):u>c&&(u=c),u<i&&(u=i);const g=this.subarray(i,u);return Object.setPrototypeOf(g,y.prototype),g},y.prototype.readUintLE=y.prototype.readUIntLE=function(i,u,c){i>>>=0,u>>>=0,c||j(i,u,this.length);let g=this[i],d=1,o=0;for(;++o<u&&(d*=256);)g+=this[i+o]*d;return g},y.prototype.readUintBE=y.prototype.readUIntBE=function(i,u,c){i>>>=0,u>>>=0,c||j(i,u,this.length);let g=this[i+--u],d=1;for(;u>0&&(d*=256);)g+=this[i+--u]*d;return g},y.prototype.readUint8=y.prototype.readUInt8=function(i,u){return i>>>=0,u||j(i,1,this.length),this[i]},y.prototype.readUint16LE=y.prototype.readUInt16LE=function(i,u){return i>>>=0,u||j(i,2,this.length),this[i]|this[i+1]<<8},y.prototype.readUint16BE=y.prototype.readUInt16BE=function(i,u){return i>>>=0,u||j(i,2,this.length),this[i]<<8|this[i+1]},y.prototype.readUint32LE=y.prototype.readUInt32LE=function(i,u){return i>>>=0,u||j(i,4,this.length),(this[i]|this[i+1]<<8|this[i+2]<<16)+16777216*this[i+3]},y.prototype.readUint32BE=y.prototype.readUInt32BE=function(i,u){return i>>>=0,u||j(i,4,this.length),16777216*this[i]+(this[i+1]<<16|this[i+2]<<8|this[i+3])},y.prototype.readBigUInt64LE=fe(function(i){X(i>>>=0,"offset");const u=this[i],c=this[i+7];u!==void 0&&c!==void 0||_e(i,this.length-8);const g=u+256*this[++i]+65536*this[++i]+this[++i]*2**24,d=this[++i]+256*this[++i]+65536*this[++i]+c*2**24;return BigInt(g)+(BigInt(d)<<BigInt(32))}),y.prototype.readBigUInt64BE=fe(function(i){X(i>>>=0,"offset");const u=this[i],c=this[i+7];u!==void 0&&c!==void 0||_e(i,this.length-8);const g=u*2**24+65536*this[++i]+256*this[++i]+this[++i],d=this[++i]*2**24+65536*this[++i]+256*this[++i]+c;return(BigInt(g)<<BigInt(32))+BigInt(d)}),y.prototype.readIntLE=function(i,u,c){i>>>=0,u>>>=0,c||j(i,u,this.length);let g=this[i],d=1,o=0;for(;++o<u&&(d*=256);)g+=this[i+o]*d;return d*=128,g>=d&&(g-=Math.pow(2,8*u)),g},y.prototype.readIntBE=function(i,u,c){i>>>=0,u>>>=0,c||j(i,u,this.length);let g=u,d=1,o=this[i+--g];for(;g>0&&(d*=256);)o+=this[i+--g]*d;return d*=128,o>=d&&(o-=Math.pow(2,8*u)),o},y.prototype.readInt8=function(i,u){return i>>>=0,u||j(i,1,this.length),128&this[i]?-1*(255-this[i]+1):this[i]},y.prototype.readInt16LE=function(i,u){i>>>=0,u||j(i,2,this.length);const c=this[i]|this[i+1]<<8;return 32768&c?4294901760|c:c},y.prototype.readInt16BE=function(i,u){i>>>=0,u||j(i,2,this.length);const c=this[i+1]|this[i]<<8;return 32768&c?4294901760|c:c},y.prototype.readInt32LE=function(i,u){return i>>>=0,u||j(i,4,this.length),this[i]|this[i+1]<<8|this[i+2]<<16|this[i+3]<<24},y.prototype.readInt32BE=function(i,u){return i>>>=0,u||j(i,4,this.length),this[i]<<24|this[i+1]<<16|this[i+2]<<8|this[i+3]},y.prototype.readBigInt64LE=fe(function(i){X(i>>>=0,"offset");const u=this[i],c=this[i+7];u!==void 0&&c!==void 0||_e(i,this.length-8);const g=this[i+4]+256*this[i+5]+65536*this[i+6]+(c<<24);return(BigInt(g)<<BigInt(32))+BigInt(u+256*this[++i]+65536*this[++i]+this[++i]*16777216)}),y.prototype.readBigInt64BE=fe(function(i){X(i>>>=0,"offset");const u=this[i],c=this[i+7];u!==void 0&&c!==void 0||_e(i,this.length-8);const g=(u<<24)+65536*this[++i]+256*this[++i]+this[++i];return(BigInt(g)<<BigInt(32))+BigInt(this[++i]*16777216+65536*this[++i]+256*this[++i]+c)}),y.prototype.readFloatLE=function(i,u){return i>>>=0,u||j(i,4,this.length),m.read(this,i,!0,23,4)},y.prototype.readFloatBE=function(i,u){return i>>>=0,u||j(i,4,this.length),m.read(this,i,!1,23,4)},y.prototype.readDoubleLE=function(i,u){return i>>>=0,u||j(i,8,this.length),m.read(this,i,!0,52,8)},y.prototype.readDoubleBE=function(i,u){return i>>>=0,u||j(i,8,this.length),m.read(this,i,!1,52,8)},y.prototype.writeUintLE=y.prototype.writeUIntLE=function(i,u,c,g){i=+i,u>>>=0,c>>>=0,!g&&G(this,i,u,c,Math.pow(2,8*c)-1,0);let d=1,o=0;for(this[u]=255&i;++o<c&&(d*=256);)this[u+o]=i/d&255;return u+c},y.prototype.writeUintBE=y.prototype.writeUIntBE=function(i,u,c,g){i=+i,u>>>=0,c>>>=0,!g&&G(this,i,u,c,Math.pow(2,8*c)-1,0);let d=c-1,o=1;for(this[u+d]=255&i;--d>=0&&(o*=256);)this[u+d]=i/o&255;return u+c},y.prototype.writeUint8=y.prototype.writeUInt8=function(i,u,c){return i=+i,u>>>=0,c||G(this,i,u,1,255,0),this[u]=255&i,u+1},y.prototype.writeUint16LE=y.prototype.writeUInt16LE=function(i,u,c){return i=+i,u>>>=0,c||G(this,i,u,2,65535,0),this[u]=255&i,this[u+1]=i>>>8,u+2},y.prototype.writeUint16BE=y.prototype.writeUInt16BE=function(i,u,c){return i=+i,u>>>=0,c||G(this,i,u,2,65535,0),this[u]=i>>>8,this[u+1]=255&i,u+2},y.prototype.writeUint32LE=y.prototype.writeUInt32LE=function(i,u,c){return i=+i,u>>>=0,c||G(this,i,u,4,4294967295,0),this[u+3]=i>>>24,this[u+2]=i>>>16,this[u+1]=i>>>8,this[u]=255&i,u+4},y.prototype.writeUint32BE=y.prototype.writeUInt32BE=function(i,u,c){return i=+i,u>>>=0,c||G(this,i,u,4,4294967295,0),this[u]=i>>>24,this[u+1]=i>>>16,this[u+2]=i>>>8,this[u+3]=255&i,u+4},y.prototype.writeBigUInt64LE=fe(function(i,u=0){return ft(this,i,u,BigInt(0),BigInt("0xffffffffffffffff"))}),y.prototype.writeBigUInt64BE=fe(function(i,u=0){return Pt(this,i,u,BigInt(0),BigInt("0xffffffffffffffff"))}),y.prototype.writeIntLE=function(i,u,c,g){if(i=+i,u>>>=0,!g){const w=Math.pow(2,8*c-1);G(this,i,u,c,w-1,-w)}let d=0,o=1,l=0;for(this[u]=255&i;++d<c&&(o*=256);)i<0&&l===0&&this[u+d-1]!==0&&(l=1),this[u+d]=(i/o>>0)-l&255;return u+c},y.prototype.writeIntBE=function(i,u,c,g){if(i=+i,u>>>=0,!g){const w=Math.pow(2,8*c-1);G(this,i,u,c,w-1,-w)}let d=c-1,o=1,l=0;for(this[u+d]=255&i;--d>=0&&(o*=256);)i<0&&l===0&&this[u+d+1]!==0&&(l=1),this[u+d]=(i/o>>0)-l&255;return u+c},y.prototype.writeInt8=function(i,u,c){return i=+i,u>>>=0,c||G(this,i,u,1,127,-128),i<0&&(i=255+i+1),this[u]=255&i,u+1},y.prototype.writeInt16LE=function(i,u,c){return i=+i,u>>>=0,c||G(this,i,u,2,32767,-32768),this[u]=255&i,this[u+1]=i>>>8,u+2},y.prototype.writeInt16BE=function(i,u,c){return i=+i,u>>>=0,c||G(this,i,u,2,32767,-32768),this[u]=i>>>8,this[u+1]=255&i,u+2},y.prototype.writeInt32LE=function(i,u,c){return i=+i,u>>>=0,c||G(this,i,u,4,2147483647,-2147483648),this[u]=255&i,this[u+1]=i>>>8,this[u+2]=i>>>16,this[u+3]=i>>>24,u+4},y.prototype.writeInt32BE=function(i,u,c){return i=+i,u>>>=0,c||G(this,i,u,4,2147483647,-2147483648),i<0&&(i=4294967295+i+1),this[u]=i>>>24,this[u+1]=i>>>16,this[u+2]=i>>>8,this[u+3]=255&i,u+4},y.prototype.writeBigInt64LE=fe(function(i,u=0){return ft(this,i,u,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),y.prototype.writeBigInt64BE=fe(function(i,u=0){return Pt(this,i,u,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),y.prototype.writeFloatLE=function(i,u,c){return $t(this,i,u,!0,c)},y.prototype.writeFloatBE=function(i,u,c){return $t(this,i,u,!1,c)},y.prototype.writeDoubleLE=function(i,u,c){return yr(this,i,u,!0,c)},y.prototype.writeDoubleBE=function(i,u,c){return yr(this,i,u,!1,c)},y.prototype.copy=function(i,u,c,g){if(!y.isBuffer(i))throw new TypeError("argument should be a Buffer");if(c||(c=0),g||g===0||(g=this.length),u>=i.length&&(u=i.length),u||(u=0),g>0&&g<c&&(g=c),g===c||i.length===0||this.length===0)return 0;if(u<0)throw new RangeError("targetStart out of bounds");if(c<0||c>=this.length)throw new RangeError("Index out of range");if(g<0)throw new RangeError("sourceEnd out of bounds");g>this.length&&(g=this.length),i.length-u<g-c&&(g=i.length-u+c);const d=g-c;return this===i&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,c,g):Uint8Array.prototype.set.call(i,this.subarray(c,g),u),d},y.prototype.fill=function(i,u,c,g){if(typeof i=="string"){if(typeof u=="string"?(g=u,u=0,c=this.length):typeof c=="string"&&(g=c,c=this.length),g!==void 0&&typeof g!="string")throw new TypeError("encoding must be a string");if(typeof g=="string"&&!y.isEncoding(g))throw new TypeError("Unknown encoding: "+g);if(i.length===1){const o=i.charCodeAt(0);(g==="utf8"&&o<128||g==="latin1")&&(i=o)}}else typeof i=="number"?i&=255:typeof i=="boolean"&&(i=Number(i));if(u<0||this.length<u||this.length<c)throw new RangeError("Out of range index");if(c<=u)return this;let d;if(u>>>=0,c=c===void 0?this.length:c>>>0,i||(i=0),typeof i=="number")for(d=u;d<c;++d)this[d]=i;else{const o=y.isBuffer(i)?i:y.from(i,g),l=o.length;if(l===0)throw new TypeError('The value "'+i+'" is invalid for argument "value"');for(d=0;d<c-u;++d)this[d+u]=o[d%l]}return this};const Se={};function lt(i,u,c){Se[i]=class extends c{constructor(){super(),Object.defineProperty(this,"message",{value:u.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${i}]`,this.stack,delete this.name}get code(){return i}set code(g){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:g,writable:!0})}toString(){return`${this.name} [${i}]: ${this.message}`}}}function Ut(i){let u="",c=i.length;const g=i[0]==="-"?1:0;for(;c>=g+4;c-=3)u=`_${i.slice(c-3,c)}${u}`;return`${i.slice(0,c)}${u}`}function Ct(i,u,c,g,d,o){if(i>c||i<u){const l=typeof u=="bigint"?"n":"";let w;throw w=o>3?u===0||u===BigInt(0)?`>= 0${l} and < 2${l} ** ${8*(o+1)}${l}`:`>= -(2${l} ** ${8*(o+1)-1}${l}) and < 2 ** ${8*(o+1)-1}${l}`:`>= ${u}${l} and <= ${c}${l}`,new Se.ERR_OUT_OF_RANGE("value",w,i)}(function(l,w,A){X(w,"offset"),l[w]!==void 0&&l[w+A]!==void 0||_e(w,l.length-(A+1))})(g,d,o)}function X(i,u){if(typeof i!="number")throw new Se.ERR_INVALID_ARG_TYPE(u,"number",i)}function _e(i,u,c){throw Math.floor(i)!==i?(X(i,c),new Se.ERR_OUT_OF_RANGE(c||"offset","an integer",i)):u<0?new Se.ERR_BUFFER_OUT_OF_BOUNDS:new Se.ERR_OUT_OF_RANGE(c||"offset",`>= ${c?1:0} and <= ${u}`,i)}lt("ERR_BUFFER_OUT_OF_BOUNDS",function(i){return i?`${i} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),lt("ERR_INVALID_ARG_TYPE",function(i,u){return`The "${i}" argument must be of type number. Received type ${typeof u}`},TypeError),lt("ERR_OUT_OF_RANGE",function(i,u,c){let g=`The value of "${i}" is out of range.`,d=c;return Number.isInteger(c)&&Math.abs(c)>4294967296?d=Ut(String(c)):typeof c=="bigint"&&(d=String(c),(c>BigInt(2)**BigInt(32)||c<-(BigInt(2)**BigInt(32)))&&(d=Ut(d)),d+="n"),g+=` It must be ${u}. Received ${d}`,g},RangeError);const Z=/[^+/0-9A-Za-z-_]/g;function Pe(i,u){let c;u=u||1/0;const g=i.length;let d=null;const o=[];for(let l=0;l<g;++l){if(c=i.charCodeAt(l),c>55295&&c<57344){if(!d){if(c>56319){(u-=3)>-1&&o.push(239,191,189);continue}if(l+1===g){(u-=3)>-1&&o.push(239,191,189);continue}d=c;continue}if(c<56320){(u-=3)>-1&&o.push(239,191,189),d=c;continue}c=65536+(d-55296<<10|c-56320)}else d&&(u-=3)>-1&&o.push(239,191,189);if(d=null,c<128){if((u-=1)<0)break;o.push(c)}else if(c<2048){if((u-=2)<0)break;o.push(c>>6|192,63&c|128)}else if(c<65536){if((u-=3)<0)break;o.push(c>>12|224,c>>6&63|128,63&c|128)}else{if(!(c<1114112))throw new Error("Invalid code point");if((u-=4)<0)break;o.push(c>>18|240,c>>12&63|128,c>>6&63|128,63&c|128)}}return o}function gr(i){return h.toByteArray(function(u){if((u=(u=u.split("=")[0]).trim().replace(Z,"")).length<2)return"";for(;u.length%4!=0;)u+="=";return u}(i))}function Ie(i,u,c,g){let d;for(d=0;d<g&&!(d+c>=u.length||d>=i.length);++d)u[d+c]=i[d];return d}function ce(i,u){return i instanceof u||i!=null&&i.constructor!=null&&i.constructor.name!=null&&i.constructor.name===u.name}function pt(i){return i!=i}const xn=function(){const i="0123456789abcdef",u=new Array(256);for(let c=0;c<16;++c){const g=16*c;for(let d=0;d<16;++d)u[g+d]=i[c]+i[d]}return u}();function fe(i){return typeof BigInt>"u"?He:i}function He(){throw new Error("BigInt not supported")}},645:(s,f)=>{f.read=function(p,h,m,v,_){var b,y,x=8*_-v-1,I=(1<<x)-1,O=I>>1,S=-7,T=m?_-1:0,F=m?-1:1,R=p[h+T];for(T+=F,b=R&(1<<-S)-1,R>>=-S,S+=x;S>0;b=256*b+p[h+T],T+=F,S-=8);for(y=b&(1<<-S)-1,b>>=-S,S+=v;S>0;y=256*y+p[h+T],T+=F,S-=8);if(b===0)b=1-O;else{if(b===I)return y?NaN:1/0*(R?-1:1);y+=Math.pow(2,v),b-=O}return(R?-1:1)*y*Math.pow(2,b-v)},f.write=function(p,h,m,v,_,b){var y,x,I,O=8*b-_-1,S=(1<<O)-1,T=S>>1,F=_===23?Math.pow(2,-24)-Math.pow(2,-77):0,R=v?0:b-1,D=v?1:-1,N=h<0||h===0&&1/h<0?1:0;for(h=Math.abs(h),isNaN(h)||h===1/0?(x=isNaN(h)?1:0,y=S):(y=Math.floor(Math.log(h)/Math.LN2),h*(I=Math.pow(2,-y))<1&&(y--,I*=2),(h+=y+T>=1?F/I:F*Math.pow(2,1-T))*I>=2&&(y++,I/=2),y+T>=S?(x=0,y=S):y+T>=1?(x=(h*I-1)*Math.pow(2,_),y+=T):(x=h*Math.pow(2,T-1)*Math.pow(2,_),y=0));_>=8;p[m+R]=255&x,R+=D,x/=256,_-=8);for(y=y<<_|x,O+=_;O>0;p[m+R]=255&y,R+=D,y/=256,O-=8);p[m+R-D]|=128*N}}},n={};function a(s){var f=n[s];if(f!==void 0)return f.exports;var p=n[s]={exports:{}};return r[s](p,p.exports,a),p.exports}return a.d=(s,f)=>{for(var p in f)a.o(f,p)&&!a.o(s,p)&&Object.defineProperty(s,p,{enumerable:!0,get:f[p]})},a.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),a.o=(s,f)=>Object.prototype.hasOwnProperty.call(s,f),a.r=s=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},a(899)})())})(ji);var hc=ji.exports;function dc(t){const e={variantId:xe.Uint64.fromString(t.variantId.toString()),version:t.version||Math.floor(Date.now()/1e3),items:t.items.map(n=>new xe.BundleItem({collectionId:xe.Uint64.fromString(n.collectionId.toString()),productId:xe.Uint64.fromString(n.productId.toString()),variantId:xe.Uint64.fromString(n.variantId.toString()),sku:n.sku||"",quantity:n.quantity,ext:new xe.BundleItemExt(0)})),ext:new xe.BundleExt(0)},r=new xe.Bundle(e);return xe.BundleEnvelope.envelopeTypeBundle(r).toXDR("base64")}const xe=hc.config(t=>{t.enum("EnvelopeType",{envelopeTypeBundle:0}),t.typedef("Uint32",t.uint()),t.typedef("Uint64",t.uhyper()),t.union("BundleItemExt",{switchOn:t.int(),switchName:"v",switches:[[0,t.void()]],arms:{}}),t.struct("BundleItem",[["collectionId",t.lookup("Uint64")],["productId",t.lookup("Uint64")],["variantId",t.lookup("Uint64")],["sku",t.string()],["quantity",t.lookup("Uint32")],["ext",t.lookup("BundleItemExt")]]),t.union("BundleExt",{switchOn:t.int(),switchName:"v",switches:[[0,t.void()]],arms:{}}),t.struct("Bundle",[["variantId",t.lookup("Uint64")],["items",t.varArray(t.lookup("BundleItem"),500)],["version",t.lookup("Uint32")],["ext",t.lookup("BundleExt")]]),t.union("BundleEnvelope",{switchOn:t.lookup("EnvelopeType"),switchName:"type",switches:[["envelopeTypeBundle","v1"]],arms:{v1:t.lookup("Bundle")}})}),qi="/bundling-storefront-manager";function yc(){return Math.ceil(Date.now()/1e3)}async function gc(){try{const{timestamp:t}=await St("get",`${qi}/t`,{headers:{"X-Recharge-App":"storefront-client"}});return t}catch(t){return console.error(`Fetch failed: ${t}. Using client-side date.`),yc()}}async function mc(t){const e=le(),r=await Vi(t);if(r!==!0)throw new Error(r);const n=await gc(),a=dc({variantId:t.externalVariantId,version:n,items:t.selections.map(s=>({collectionId:s.collectionId,productId:s.externalProductId,variantId:s.externalVariantId,quantity:s.quantity,sku:""}))});try{const s=await St("post",`${qi}/api/v1/bundles`,{data:{bundle:a},headers:{Origin:`https://${e.storeIdentifier}`}});if(!s.id||s.code!==200)throw new Error(`1: failed generating rb_id: ${JSON.stringify(s)}`);return s.id}catch(s){throw new Error(`2: failed generating rb_id ${s}`)}}function wc(t,e){const r=zi(t);if(r!==!0)throw new Error(`Dynamic Bundle is invalid. ${r}`);const n=`${pc(9)}:${t.externalProductId}`;return t.selections.map(a=>{const s={id:a.externalVariantId,quantity:a.quantity,properties:{_rc_bundle:n,_rc_bundle_variant:t.externalVariantId,_rc_bundle_parent:e,_rc_bundle_collection_id:a.collectionId}};return a.sellingPlan?s.selling_plan=a.sellingPlan:a.shippingIntervalFrequency&&(s.properties.shipping_interval_frequency=a.shippingIntervalFrequency,s.properties.shipping_interval_unit_type=a.shippingIntervalUnitType,s.id=`${a.discountedVariantId}`),s})}async function Vi(t){try{return t?!0:"Bundle is not defined"}catch(e){return`Error fetching bundle settings: ${e}`}}const vc={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 zi(t){if(!t)return"No bundle defined.";if(t.selections.length===0)return"No selections defined.";const{shippingIntervalFrequency:e,shippingIntervalUnitType:r}=t.selections.find(n=>n.shippingIntervalFrequency||n.shippingIntervalUnitType)||{};if(e||r){if(!e||!r)return"Shipping intervals do not match on selections.";{const n=vc[r];for(let a=0;a<t.selections.length;a++){const{shippingIntervalFrequency:s,shippingIntervalUnitType:f}=t.selections[a];if(s&&s!==e||f&&!n.includes(f))return"Shipping intervals do not match on selections."}}}return!0}async function _c(t,e){const{bundle_selection:r}=await B("get","/bundle_selections",{id:e},t);return r}function bc(t,e){return B("get","/bundle_selections",{query:e},t)}async function Ec(t,e){const{bundle_selection:r}=await B("post","/bundle_selections",{data:e},t);return r}async function Ac(t,e,r){const{bundle_selection:n}=await B("put","/bundle_selections",{id:e,data:r},t);return n}function xc(t,e){return B("delete","/bundle_selections",{id:e},t)}async function Sc(t,e,r,n){const{subscription:a}=await B("put","/bundles",{id:e,data:r,query:n},t);return a}var Ic=Object.freeze({__proto__:null,createBundleSelection:Ec,deleteBundleSelection:xc,getBundleId:mc,getBundleSelection:_c,getDynamicBundleItems:wc,listBundleSelections:bc,updateBundle:Sc,updateBundleSelection:Ac,validateBundle:Vi,validateDynamicBundle:zi}),Bc=200,an="__lodash_hash_undefined__",Oc=1/0,Gi=9007199254740991,Tc="[object Arguments]",Rc="[object Function]",Fc="[object GeneratorFunction]",Pc="[object Symbol]",$c=/[\\^$.*+?()[\]{}|]/g,Uc=/^\[object .+?Constructor\]$/,Cc=/^(?:0|[1-9]\d*)$/,Dc=typeof oe=="object"&&oe&&oe.Object===Object&&oe,Nc=typeof self=="object"&&self&&self.Object===Object&&self,sn=Dc||Nc||Function("return this")();function Mc(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function Lc(t,e){var r=t?t.length:0;return!!r&&qc(t,e,0)>-1}function kc(t,e,r){for(var n=-1,a=t?t.length:0;++n<a;)if(r(e,t[n]))return!0;return!1}function Wi(t,e){for(var r=-1,n=t?t.length:0,a=Array(n);++r<n;)a[r]=e(t[r],r,t);return a}function un(t,e){for(var r=-1,n=e.length,a=t.length;++r<n;)t[a+r]=e[r];return t}function jc(t,e,r,n){for(var a=t.length,s=r+(n?1:-1);n?s--:++s<a;)if(e(t[s],s,t))return s;return-1}function qc(t,e,r){if(e!==e)return jc(t,Vc,r);for(var n=r-1,a=t.length;++n<a;)if(t[n]===e)return n;return-1}function Vc(t){return t!==t}function zc(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function Gc(t){return function(e){return t(e)}}function Wc(t,e){return t.has(e)}function Hc(t,e){return t?.[e]}function Yc(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function Hi(t,e){return function(r){return t(e(r))}}var Xc=Array.prototype,Jc=Function.prototype,or=Object.prototype,cn=sn["__core-js_shared__"],Yi=function(){var t=/[^.]+$/.exec(cn&&cn.keys&&cn.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Xi=Jc.toString,it=or.hasOwnProperty,fn=or.toString,Kc=RegExp("^"+Xi.call(it).replace($c,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ji=sn.Symbol,Qc=Hi(Object.getPrototypeOf,Object),Zc=or.propertyIsEnumerable,ef=Xc.splice,Ki=Ji?Ji.isConcatSpreadable:void 0,ln=Object.getOwnPropertySymbols,Qi=Math.max,tf=eo(sn,"Map"),It=eo(Object,"create");function ze(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function rf(){this.__data__=It?It(null):{}}function nf(t){return this.has(t)&&delete this.__data__[t]}function of(t){var e=this.__data__;if(It){var r=e[t];return r===an?void 0:r}return it.call(e,t)?e[t]:void 0}function af(t){var e=this.__data__;return It?e[t]!==void 0:it.call(e,t)}function sf(t,e){var r=this.__data__;return r[t]=It&&e===void 0?an:e,this}ze.prototype.clear=rf,ze.prototype.delete=nf,ze.prototype.get=of,ze.prototype.has=af,ze.prototype.set=sf;function ot(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function uf(){this.__data__=[]}function cf(t){var e=this.__data__,r=sr(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():ef.call(e,r,1),!0}function ff(t){var e=this.__data__,r=sr(e,t);return r<0?void 0:e[r][1]}function lf(t){return sr(this.__data__,t)>-1}function pf(t,e){var r=this.__data__,n=sr(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ot.prototype.clear=uf,ot.prototype.delete=cf,ot.prototype.get=ff,ot.prototype.has=lf,ot.prototype.set=pf;function at(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function hf(){this.__data__={hash:new ze,map:new(tf||ot),string:new ze}}function df(t){return ur(this,t).delete(t)}function yf(t){return ur(this,t).get(t)}function gf(t){return ur(this,t).has(t)}function mf(t,e){return ur(this,t).set(t,e),this}at.prototype.clear=hf,at.prototype.delete=df,at.prototype.get=yf,at.prototype.has=gf,at.prototype.set=mf;function ar(t){var e=-1,r=t?t.length:0;for(this.__data__=new at;++e<r;)this.add(t[e])}function wf(t){return this.__data__.set(t,an),this}function vf(t){return this.__data__.has(t)}ar.prototype.add=ar.prototype.push=wf,ar.prototype.has=vf;function _f(t,e){var r=pn(t)||to(t)?zc(t.length,String):[],n=r.length,a=!!n;for(var s in t)(e||it.call(t,s))&&!(a&&(s=="length"||Pf(s,n)))&&r.push(s);return r}function sr(t,e){for(var r=t.length;r--;)if(Lf(t[r][0],e))return r;return-1}function bf(t,e,r,n){var a=-1,s=Lc,f=!0,p=t.length,h=[],m=e.length;if(!p)return h;r&&(e=Wi(e,Gc(r))),n?(s=kc,f=!1):e.length>=Bc&&(s=Wc,f=!1,e=new ar(e));e:for(;++a<p;){var v=t[a],_=r?r(v):v;if(v=n||v!==0?v:0,f&&_===_){for(var b=m;b--;)if(e[b]===_)continue e;h.push(v)}else s(e,_,n)||h.push(v)}return h}function Zi(t,e,r,n,a){var s=-1,f=t.length;for(r||(r=Ff),a||(a=[]);++s<f;){var p=t[s];e>0&&r(p)?e>1?Zi(p,e-1,r,n,a):un(a,p):n||(a[a.length]=p)}return a}function Ef(t,e,r){var n=e(t);return pn(t)?n:un(n,r(t))}function Af(t){if(!hn(t)||Uf(t))return!1;var e=no(t)||Yc(t)?Kc:Uc;return e.test(Mf(t))}function xf(t){if(!hn(t))return Df(t);var e=Cf(t),r=[];for(var n in t)n=="constructor"&&(e||!it.call(t,n))||r.push(n);return r}function Sf(t,e){return t=Object(t),If(t,e,function(r,n){return n in t})}function If(t,e,r){for(var n=-1,a=e.length,s={};++n<a;){var f=e[n],p=t[f];r(p,f)&&(s[f]=p)}return s}function Bf(t,e){return e=Qi(e===void 0?t.length-1:e,0),function(){for(var r=arguments,n=-1,a=Qi(r.length-e,0),s=Array(a);++n<a;)s[n]=r[e+n];n=-1;for(var f=Array(e+1);++n<e;)f[n]=r[n];return f[e]=s,Mc(t,this,f)}}function Of(t){return Ef(t,Vf,Rf)}function ur(t,e){var r=t.__data__;return $f(e)?r[typeof e=="string"?"string":"hash"]:r.map}function eo(t,e){var r=Hc(t,e);return Af(r)?r:void 0}var Tf=ln?Hi(ln,Object):oo,Rf=ln?function(t){for(var e=[];t;)un(e,Tf(t)),t=Qc(t);return e}:oo;function Ff(t){return pn(t)||to(t)||!!(Ki&&t&&t[Ki])}function Pf(t,e){return e=e??Gi,!!e&&(typeof t=="number"||Cc.test(t))&&t>-1&&t%1==0&&t<e}function $f(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function Uf(t){return!!Yi&&Yi in t}function Cf(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||or;return t===r}function Df(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}function Nf(t){if(typeof t=="string"||qf(t))return t;var e=t+"";return e=="0"&&1/t==-Oc?"-0":e}function Mf(t){if(t!=null){try{return Xi.call(t)}catch{}try{return t+""}catch{}}return""}function Lf(t,e){return t===e||t!==t&&e!==e}function to(t){return kf(t)&&it.call(t,"callee")&&(!Zc.call(t,"callee")||fn.call(t)==Tc)}var pn=Array.isArray;function ro(t){return t!=null&&jf(t.length)&&!no(t)}function kf(t){return io(t)&&ro(t)}function no(t){var e=hn(t)?fn.call(t):"";return e==Rc||e==Fc}function jf(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Gi}function hn(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function io(t){return!!t&&typeof t=="object"}function qf(t){return typeof t=="symbol"||io(t)&&fn.call(t)==Pc}function Vf(t){return ro(t)?_f(t,!0):xf(t)}var zf=Bf(function(t,e){return t==null?{}:(e=Wi(Zi(e,1),Nf),Sf(t,bf(Of(t),e)))});function oo(){return[]}var Gf=zf,dn=$e(Gf);function Wf(t){try{return JSON.parse(t)}catch{return t}}function Hf(t){return Object.entries(t).reduce((e,[r,n])=>({...e,[r]:Wf(n)}),{})}const ao=t=>typeof t=="string"?t!=="0"&&t!=="false":!!t;function so(t){const e=Hf(t),r=e.auto_inject===void 0?!0:e.auto_inject,n=e.display_on??[],a=e.first_option==="autodeliver";return{...dn(e,["display_on","first_option"]),auto_inject:r,valid_pages:n,is_subscription_first:a,autoInject:r,validPages:n,isSubscriptionFirst:a}}function uo(t){const e=t.subscription_options?.storefront_purchase_options==="subscription_only";return{...t,is_subscription_only:e,isSubscriptionOnly:e}}function Yf(t){return t.map(e=>{const r={};return Object.entries(e).forEach(([n,a])=>{r[n]=uo(a)}),r})}const yn="2020-12",Xf={store_currency:{currency_code:"USD",currency_symbol:"$",decimal_separator:".",thousands_separator:",",currency_symbol_location:"left"}},Bt=new Map;function cr(t,e){return Bt.has(t)||Bt.set(t,e()),Bt.get(t)}async function gn(t,e){const r=e?.version??"2020-12",{product:n}=await cr(`product.${t}.${r}`,()=>ir("get",`/product/${r}/${t}.json`));return r==="2020-12"?uo(n):n}async function co(){return await cr("storeSettings",()=>ir("get",`/${yn}/store_settings.json`).catch(()=>Xf))}async function fo(){const{widget_settings:t}=await cr("widgetSettings",()=>ir("get",`/${yn}/widget_settings.json`));return so(t)}async function lo(){const{products:t,widget_settings:e,store_settings:r,meta:n}=await cr("productsAndSettings",()=>ir("get",`/product/${yn}/products.json`));return n?.status==="error"?Promise.reject(n.message):{products:Yf(t),widget_settings:so(e),store_settings:r??{}}}async function Jf(){const{products:t}=await lo();return t}async function Kf(t){const[e,r,n]=await Promise.all([gn(t),co(),fo()]);return{product:e,store_settings:r,widget_settings:n,storeSettings:r,widgetSettings:n}}async function Qf(t){const{bundle_product:e}=await gn(t);return e}async function po(){return Array.from(Bt.keys()).forEach(t=>Bt.delete(t))}var Zf=Object.freeze({__proto__:null,getCDNBundleSettings:Qf,getCDNProduct:gn,getCDNProductAndSettings:Kf,getCDNProducts:Jf,getCDNProductsAndSettings:lo,getCDNStoreSettings:co,getCDNWidgetSettings:fo,resetCDNCache:po});async function el(t,e,r){const{charge:n}=await B("get","/charges",{id:e,query:{include:r?.include}},t);return n}function tl(t,e){return B("get","/charges",{query:e},t)}async function rl(t,e,r){const{charge:n}=await B("post",`/charges/${e}/apply_discount`,{data:{discount_code:r}},t);return n}async function nl(t,e){const{charge:r}=await B("post",`/charges/${e}/remove_discount`,{},t);return r}async function il(t,e,r,n){const{charge:a}=await B("post",`/charges/${e}/skip`,{query:n,data:{purchase_item_ids:r.map(s=>Number(s))}},t);return a}async function ol(t,e,r,n){const{charge:a}=await B("post",`/charges/${e}/unskip`,{query:n,data:{purchase_item_ids:r.map(s=>Number(s))}},t);return a}async function al(t,e){const{charge:r}=await B("post",`/charges/${e}/process`,{},t);return r}var sl=Object.freeze({__proto__:null,applyDiscountToCharge:rl,getCharge:el,listCharges:tl,processCharge:al,removeDiscountsFromCharge:nl,skipCharge:il,unskipCharge:ol});async function ul(t,e){const r=t.customerId;if(!r)throw new Error("Not logged in.");const{customer:n}=await B("get","/customers",{id:r,query:{include:e?.include}},t);return n}async function cl(t,e){const r=t.customerId;if(!r)throw new Error("Not logged in.");const{customer:n}=await B("put","/customers",{id:r,data:e},t);return n}async function fl(t,e){const r=t.customerId;if(!r)throw new Error("Not logged in.");const{deliveries:n}=await B("get",`/customers/${r}/delivery_schedule`,{query:e},t);return n}async function mn(t){return B("get","/portal_access",{},t)}async function ll(t,e,r){const{base_url:n,customer_hash:a,temp_token:s}=await mn(t);return`${n.replace("portal","pages")}${a}/subscriptions/${e}/cancel?token=${s}&subscription=${e}&redirect_to=${r}`}async function pl(t,e,r){const{base_url:n,customer_hash:a,temp_token:s}=await mn(t);return`${n.replace("portal","pages")}${a}/gifts/${e}?token=${s}&redirect_to=${r}`}const hl={SHOPIFY_UPDATE_PAYMENT_INFO:{type:"email",template_type:"shopify_update_payment_information"}};async function dl(t,e,r){const n=t.customerId;if(!n)throw new Error("Not logged in.");const a=hl[e];if(!a)throw new Error("Notification not supported.");return B("post",`/customers/${n}/notifications`,{data:{...a,template_vars:r}},t)}async function yl(t,e){const r=t.customerId;if(!r)throw new Error("Not logged in.");const{credit_summary:n}=await B("get",`/customers/${r}/credit_summary`,{query:{include:e?.include}},t);return n}var gl=Object.freeze({__proto__:null,getActiveChurnLandingPageURL:ll,getCreditSummary:yl,getCustomer:ul,getCustomerPortalAccess:mn,getDeliverySchedule:fl,getGiftRedemptionLandingPageURL:pl,sendCustomerNotification:dl,updateCustomer:cl});function ml(t,e){if(!t.customerId)throw new Error("Not logged in.");return B("get","/gift_purchases",{query:e},t)}async function wl(t,e){if(!t.customerId)throw new Error("Not logged in.");const{gift_purchase:r}=await B("get","/gift_purchases",{id:e},t);return r}var vl=Object.freeze({__proto__:null,getGiftPurchase:wl,listGiftPurchases:ml});async function _l(t,e){const{membership:r}=await B("get","/memberships",{id:e},t);return r}function bl(t,e){return B("get","/memberships",{query:e},t)}async function El(t,e,r){const{membership:n}=await B("post",`/memberships/${e}/cancel`,{data:r},t);return n}async function Al(t,e,r){const{membership:n}=await B("post",`/memberships/${e}/activate`,{data:r},t);return n}async function xl(t,e,r){const{membership:n}=await B("post",`/memberships/${e}/change`,{data:r},t);return n}var Sl=Object.freeze({__proto__:null,activateMembership:Al,cancelMembership:El,changeMembership:xl,getMembership:_l,listMemberships:bl});async function Il(t,e,r){const{membership_program:n}=await B("get","/membership_programs",{id:e,query:{include:r?.include}},t);return n}function Bl(t,e){return B("get","/membership_programs",{query:e},t)}var Ol=Object.freeze({__proto__:null,getMembershipProgram:Il,listMembershipPrograms:Bl});async function Tl(t,e){const{metafield:r}=await B("post","/metafields",{data:{metafield:e}},t);return r}async function Rl(t,e,r){const{metafield:n}=await B("put","/metafields",{id:e,data:{metafield:r}},t);return n}function Fl(t,e){return B("delete","/metafields",{id:e},t)}var Pl=Object.freeze({__proto__:null,createMetafield:Tl,deleteMetafield:Fl,updateMetafield:Rl});async function $l(t,e){const{onetime:r}=await B("get","/onetimes",{id:e},t);return r}function Ul(t,e){return B("get","/onetimes",{query:e},t)}async function Cl(t,e){const{onetime:r}=await B("post","/onetimes",{data:e},t);return r}async function Dl(t,e,r){const{onetime:n}=await B("put","/onetimes",{id:e,data:r},t);return n}function Nl(t,e){return B("delete","/onetimes",{id:e},t)}var Ml=Object.freeze({__proto__:null,createOnetime:Cl,deleteOnetime:Nl,getOnetime:$l,listOnetimes:Ul,updateOnetime:Dl});async function Ll(t,e){const{order:r}=await B("get","/orders",{id:e},t);return r}function kl(t,e){return B("get","/orders",{query:e},t)}var jl=Object.freeze({__proto__:null,getOrder:Ll,listOrders:kl});async function ql(t,e,r){const{payment_method:n}=await B("get","/payment_methods",{id:e,query:{include:r?.include}},t);return n}async function Vl(t,e){const{payment_method:r}=await B("post","/payment_methods",{data:{...e,customer_id:t.customerId}},t);return r}async function zl(t,e,r){const{payment_method:n}=await B("put","/payment_methods",{id:e,data:r},t);return n}function Gl(t,e){return B("get","/payment_methods",{query:e},t)}var Wl=Object.freeze({__proto__:null,createPaymentMethod:Vl,getPaymentMethod:ql,listPaymentMethods:Gl,updatePaymentMethod:zl});async function Hl(t,e){const{plan:r}=await B("get","/plans",{id:e},t);return r}function Yl(t,e){return B("get","/plans",{query:e},t)}var Xl=Object.freeze({__proto__:null,getPlan:Hl,listPlans:Yl});async function Jl(t,e){if(!["2020-12","2022-06"].includes(e.format_version))throw new Error("Missing or unsupported format_version.");return B("get","/product_search",{query:e,headers:{"X-Recharge-Version":"2021-01"}},t)}var Kl=Object.freeze({__proto__:null,productSearch:Jl});async function Ql(t,e){return await B("get","/shop/shipping_countries",{query:e,headers:{"X-Recharge-Version":"2021-01"}},t)}var Zl=Object.freeze({__proto__:null,getShippingCountries:Ql}),ep="Expected a function",ho="__lodash_placeholder__",Ge=1,fr=2,tp=4,st=8,Ot=16,We=32,Tt=64,yo=128,rp=256,go=512,mo=1/0,np=9007199254740991,ip=17976931348623157e292,wo=0/0,op=[["ary",yo],["bind",Ge],["bindKey",fr],["curry",st],["curryRight",Ot],["flip",go],["partial",We],["partialRight",Tt],["rearg",rp]],ap="[object Function]",sp="[object GeneratorFunction]",up="[object Symbol]",cp=/[\\^$.*+?()[\]{}|]/g,fp=/^\s+|\s+$/g,lp=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,pp=/\{\n\/\* \[wrapped with (.+)\] \*/,hp=/,? & /,dp=/^[-+]0x[0-9a-f]+$/i,yp=/^0b[01]+$/i,gp=/^\[object .+?Constructor\]$/,mp=/^0o[0-7]+$/i,wp=/^(?:0|[1-9]\d*)$/,vp=parseInt,_p=typeof oe=="object"&&oe&&oe.Object===Object&&oe,bp=typeof self=="object"&&self&&self.Object===Object&&self,Rt=_p||bp||Function("return this")();function wn(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function Ep(t,e){for(var r=-1,n=t?t.length:0;++r<n&&e(t[r],r,t)!==!1;);return t}function Ap(t,e){var r=t?t.length:0;return!!r&&Sp(t,e,0)>-1}function xp(t,e,r,n){for(var a=t.length,s=r+(n?1:-1);n?s--:++s<a;)if(e(t[s],s,t))return s;return-1}function Sp(t,e,r){if(e!==e)return xp(t,Ip,r);for(var n=r-1,a=t.length;++n<a;)if(t[n]===e)return n;return-1}function Ip(t){return t!==t}function Bp(t,e){for(var r=t.length,n=0;r--;)t[r]===e&&n++;return n}function Op(t,e){return t?.[e]}function Tp(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function vn(t,e){for(var r=-1,n=t.length,a=0,s=[];++r<n;){var f=t[r];(f===e||f===ho)&&(t[r]=ho,s[a++]=r)}return s}var Rp=Function.prototype,vo=Object.prototype,_n=Rt["__core-js_shared__"],_o=function(){var t=/[^.]+$/.exec(_n&&_n.keys&&_n.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),bo=Rp.toString,Fp=vo.hasOwnProperty,Eo=vo.toString,Pp=RegExp("^"+bo.call(Fp).replace(cp,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),$p=Object.create,ut=Math.max,Up=Math.min,Ao=function(){var t=So(Object,"defineProperty"),e=So.name;return e&&e.length>2?t:void 0}();function Cp(t){return ct(t)?$p(t):{}}function Dp(t){if(!ct(t)||Yp(t))return!1;var e=Qp(t)||Tp(t)?Pp:gp;return e.test(Jp(t))}function Np(t,e){return e=ut(e===void 0?t.length-1:e,0),function(){for(var r=arguments,n=-1,a=ut(r.length-e,0),s=Array(a);++n<a;)s[n]=r[e+n];n=-1;for(var f=Array(e+1);++n<e;)f[n]=r[n];return f[e]=s,wn(t,this,f)}}function Mp(t,e,r,n){for(var a=-1,s=t.length,f=r.length,p=-1,h=e.length,m=ut(s-f,0),v=Array(h+m),_=!n;++p<h;)v[p]=e[p];for(;++a<f;)(_||a<s)&&(v[r[a]]=t[a]);for(;m--;)v[p++]=t[a++];return v}function Lp(t,e,r,n){for(var a=-1,s=t.length,f=-1,p=r.length,h=-1,m=e.length,v=ut(s-p,0),_=Array(v+m),b=!n;++a<v;)_[a]=t[a];for(var y=a;++h<m;)_[y+h]=e[h];for(;++f<p;)(b||a<s)&&(_[y+r[f]]=t[a++]);return _}function kp(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}function jp(t,e,r){var n=e&Ge,a=Ft(t);function s(){var f=this&&this!==Rt&&this instanceof s?a:t;return f.apply(n?r:this,arguments)}return s}function Ft(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var r=Cp(t.prototype),n=t.apply(r,e);return ct(n)?n:r}}function qp(t,e,r){var n=Ft(t);function a(){for(var s=arguments.length,f=Array(s),p=s,h=En(a);p--;)f[p]=arguments[p];var m=s<3&&f[0]!==h&&f[s-1]!==h?[]:vn(f,h);if(s-=m.length,s<r)return xo(t,e,bn,a.placeholder,void 0,f,m,void 0,void 0,r-s);var v=this&&this!==Rt&&this instanceof a?n:t;return wn(v,this,f)}return a}function bn(t,e,r,n,a,s,f,p,h,m){var v=e&yo,_=e&Ge,b=e&fr,y=e&(st|Ot),x=e&go,I=b?void 0:Ft(t);function O(){for(var S=arguments.length,T=Array(S),F=S;F--;)T[F]=arguments[F];if(y)var R=En(O),D=Bp(T,R);if(n&&(T=Mp(T,n,a,y)),s&&(T=Lp(T,s,f,y)),S-=D,y&&S<m){var N=vn(T,R);return xo(t,e,bn,O.placeholder,r,T,N,p,h,m-S)}var V=_?r:this,k=b?V[t]:t;return S=T.length,p?T=Xp(T,p):x&&S>1&&T.reverse(),v&&h<S&&(T.length=h),this&&this!==Rt&&this instanceof O&&(k=I||Ft(k)),k.apply(V,T)}return O}function Vp(t,e,r,n){var a=e&Ge,s=Ft(t);function f(){for(var p=-1,h=arguments.length,m=-1,v=n.length,_=Array(v+h),b=this&&this!==Rt&&this instanceof f?s:t;++m<v;)_[m]=n[m];for(;h--;)_[m++]=arguments[++p];return wn(b,a?r:this,_)}return f}function xo(t,e,r,n,a,s,f,p,h,m){var v=e&st,_=v?f:void 0,b=v?void 0:f,y=v?s:void 0,x=v?void 0:s;e|=v?We:Tt,e&=~(v?Tt:We),e&tp||(e&=~(Ge|fr));var I=r(t,e,a,y,_,x,b,p,h,m);return I.placeholder=n,Io(I,t,e)}function zp(t,e,r,n,a,s,f,p){var h=e&fr;if(!h&&typeof t!="function")throw new TypeError(ep);var m=n?n.length:0;if(m||(e&=~(We|Tt),n=a=void 0),f=f===void 0?f:ut(Bo(f),0),p=p===void 0?p:Bo(p),m-=a?a.length:0,e&Tt){var v=n,_=a;n=a=void 0}var b=[t,e,r,n,a,v,_,s,f,p];if(t=b[0],e=b[1],r=b[2],n=b[3],a=b[4],p=b[9]=b[9]==null?h?0:t.length:ut(b[9]-m,0),!p&&e&(st|Ot)&&(e&=~(st|Ot)),!e||e==Ge)var y=jp(t,e,r);else e==st||e==Ot?y=qp(t,e,p):(e==We||e==(Ge|We))&&!a.length?y=Vp(t,e,r,n):y=bn.apply(void 0,b);return Io(y,t,e)}function En(t){var e=t;return e.placeholder}function So(t,e){var r=Op(t,e);return Dp(r)?r:void 0}function Gp(t){var e=t.match(pp);return e?e[1].split(hp):[]}function Wp(t,e){var r=e.length,n=r-1;return e[n]=(r>1?"& ":"")+e[n],e=e.join(r>2?", ":" "),t.replace(lp,`{
21
21
  /* [wrapped with `+e+`] */
22
- `)}function Gp(t,e){return e=e??tp,!!e&&(typeof t=="number"||gp.test(t))&&t>-1&&t%1==0&&t<e}function Wp(t){return!!vo&&vo in t}function Hp(t,e){for(var r=t.length,n=Pp(e.length,r),a=Mp(t);n--;){var s=e[n];t[n]=Gp(s,r)?a[s]:void 0}return t}var So=Eo?function(t,e,r){var n=e+"";return Eo(t,"toString",{configurable:!0,enumerable:!1,value:th(zp(n,Xp(Vp(n),r)))})}:rh;function Yp(t){if(t!=null){try{return _o.call(t)}catch{}try{return t+""}catch{}}return""}function Xp(t,e){return _p(np,function(r){var n="_."+r[0];e&r[1]&&!bp(t,n)&&t.push(n)}),t.sort()}var An=Cp(function(t,e){var r=vn(e,En(An));return qp(t,We,void 0,e,r)});function Jp(t){var e=ct(t)?bo.call(t):"";return e==ip||e==op}function ct(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Kp(t){return!!t&&typeof t=="object"}function Qp(t){return typeof t=="symbol"||Kp(t)&&bo.call(t)==ap}function Zp(t){if(!t)return t===0?t:0;if(t=eh(t),t===go||t===-go){var e=t<0?-1:1;return e*rp}return t===t?t:0}function Io(t){var e=Zp(t),r=e%1;return e===e?r?e-r:e:0}function eh(t){if(typeof t=="number")return t;if(Qp(t))return mo;if(ct(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=ct(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(up,"");var r=hp.test(t);return r||yp.test(t)?mp(t.slice(2),r?2:8):pp.test(t)?mo:+t}function th(t){return function(){return t}}function rh(t){return t}An.placeholder={};var nh=An,Bo=$e(nh);function ih(t,e){return{...dn(e,["address_id","external_variant_id","external_product_id","charge_interval_frequency","order_interval_frequency","price","status"]),customer_id:parseInt(t,10),shopify_variant_id:e.external_variant_id.ecommerce?parseInt(e.external_variant_id.ecommerce,10):void 0,charge_interval_frequency:`${e.charge_interval_frequency}`,order_interval_frequency:`${e.order_interval_frequency}`,status:e.status?e.status.toUpperCase():void 0}}function oh(t,e){return{...dn(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,charge_interval_frequency:e.charge_interval_frequency?`${e.charge_interval_frequency}`:void 0,order_interval_frequency:e.order_interval_frequency?`${e.order_interval_frequency}`:void 0,force_update:t}}function Oo(t){const{id:e,address_id:r,customer_id:n,analytics_data:a,cancellation_reason:s,cancellation_reason_comments:f,cancelled_at:p,charge_interval_frequency:h,created_at:m,expire_after_specific_number_of_charges:v,shopify_product_id:_,shopify_variant_id:b,has_queued_charges:y,is_prepaid:x,is_skippable:I,is_swappable:O,max_retries_reached:S,next_charge_scheduled_at:T,order_day_of_month:F,order_day_of_week:R,order_interval_frequency:D,order_interval_unit:N,presentment_currency:V,price:k,product_title:ee,properties:z,quantity:ue,sku:Y,sku_override:M,status:ne,updated_at:L,variant_title:ie}=t;return{id:e,address_id:r,customer_id:n,analytics_data:a,cancellation_reason:s,cancellation_reason_comments:f,cancelled_at:p,charge_interval_frequency:parseInt(h,10),created_at:m,expire_after_specific_number_of_charges:v,external_product_id:{ecommerce:`${_}`},external_variant_id:{ecommerce:`${b}`},has_queued_charges:oo(y),is_prepaid:x,is_skippable:I,is_swappable:O,max_retries_reached:oo(S),next_charge_scheduled_at:T,order_day_of_month:F,order_day_of_week:R,order_interval_frequency:parseInt(D,10),order_interval_unit:N,presentment_currency:V,price:`${k}`,product_title:ee??"",properties:z,quantity:ue,sku:Y,sku_override:M,status:ne.toLowerCase(),updated_at:L,variant_title:ie}}async function ah(t,e,r){const{subscription:n}=await B("get","/subscriptions",{id:e,query:{include:r?.include}},t);return n}function sh(t,e){return B("get","/subscriptions",{query:e},t)}async function uh(t,e,r){const{subscription:n}=await B("post","/subscriptions",{data:e,query:r},t);return n}async function ch(t,e,r,n){const{subscription:a}=await B("put","/subscriptions",{id:e,data:r,query:n},t);return a}async function fh(t,e,r,n){const{subscription:a}=await B("post",`/subscriptions/${e}/set_next_charge_date`,{data:{date:r},query:n},t);return a}async function lh(t,e,r){const{subscription:n}=await B("post",`/subscriptions/${e}/change_address`,{data:{address_id:r}},t);return n}async function ph(t,e,r,n){const{subscription:a}=await B("post",`/subscriptions/${e}/cancel`,{data:r,query:n},t);return a}async function hh(t,e,r){const{subscription:n}=await B("post",`/subscriptions/${e}/activate`,{query:r},t);return n}async function dh(t,e,r){const{charge:n}=await B("post",`/subscriptions/${e}/charges/skip`,{data:{date:r,subscription_id:`${e}`}},t);return n}async function yh(t,e,r){const{onetimes:n}=await B("post","/purchase_items/skip_gift",{data:{purchase_item_ids:e.map(Number),recipient_address:r}},t);return n}async function gh(t,e){const r=e.length;if(r<1||r>21)throw new Error("Number of subscriptions must be between 1 and 20.");const{customerId:n}=t;if(!n)throw new Error("No customerId in session.");const a=e[0].address_id;if(!e.every(h=>h.address_id===a))throw new Error("All subscriptions must have the same address_id.");const s=Bo(ih,n),f=e.map(s),{subscriptions:p}=await B("post",`/addresses/${a}/subscriptions-bulk`,{data:{subscriptions:f},headers:{"X-Recharge-Version":"2021-01"}},t);return p.map(Oo)}async function mh(t,e,r,n){const a=r.length;if(a<1||a>21)throw new Error("Number of subscriptions must be between 1 and 20.");const{customerId:s}=t;if(!s)throw new Error("No customerId in session.");const f=Bo(oh,!!n?.force_update),p=r.map(f),{subscriptions:h}=await B("put",`/addresses/${e}/subscriptions-bulk`,{data:{subscriptions:p},headers:{"X-Recharge-Version":"2021-01"}},t);return h.map(Oo)}var wh=Object.freeze({__proto__:null,activateSubscription:hh,cancelSubscription:ph,createSubscription:uh,createSubscriptions:gh,getSubscription:ah,listSubscriptions:sh,skipGiftSubscriptionCharge:yh,skipSubscriptionCharge:dh,updateSubscription:ch,updateSubscriptionAddress:lh,updateSubscriptionChargeDate:fh,updateSubscriptions:mh});const vh={get(t,e){return se("get",t,e)},post(t,e){return se("post",t,e)},put(t,e){return se("put",t,e)},delete(t,e){return se("delete",t,e)}};function _h(t){if(t)return t;if(window?.Shopify?.shop)return window.Shopify.shop;let e=window?.domain;if(!e){const r=location?.href.match(/(?:http[s]*:\/\/)*(.*?)\.(?=admin\.rechargeapps\.com)/i)?.[1].replace(/-sp$/,"");r&&(e=`${r}.myshopify.com`)}if(e)return e;throw new Error("No storeIdentifier was passed into init.")}function bh(t={}){const e=t,{storefrontAccessToken:r}=t;if(r&&!r.startsWith("strfnt"))throw new Error("Incorrect storefront access token used. See https://storefront.rechargepayments.com/client/docs/getting_started/package_setup/#initialization-- for more information.");ju({storeIdentifier:_h(t.storeIdentifier),loginRetryFn:t.loginRetryFn,storefrontAccessToken:r,environment:e.environment?e.environment:"prod",environmentUri:e.environmentUri}),lo()}const To={init:bh,api:vh,address:ec,auth:cc,bundle:xc,charge:ol,cdn:Kf,customer:dl,gift:ml,membership:Al,membershipProgram:Il,metafield:Rl,onetime:Dl,order:Ll,paymentMethod:zl,plan:Hl,product:Xl,store:Kl,subscription:wh};try{To.init()}catch{}return To});
22
+ `)}function Hp(t,e){return e=e??np,!!e&&(typeof t=="number"||wp.test(t))&&t>-1&&t%1==0&&t<e}function Yp(t){return!!_o&&_o in t}function Xp(t,e){for(var r=t.length,n=Up(e.length,r),a=kp(t);n--;){var s=e[n];t[n]=Hp(s,r)?a[s]:void 0}return t}var Io=Ao?function(t,e,r){var n=e+"";return Ao(t,"toString",{configurable:!0,enumerable:!1,value:nh(Wp(n,Kp(Gp(n),r)))})}:ih;function Jp(t){if(t!=null){try{return bo.call(t)}catch{}try{return t+""}catch{}}return""}function Kp(t,e){return Ep(op,function(r){var n="_."+r[0];e&r[1]&&!Ap(t,n)&&t.push(n)}),t.sort()}var An=Np(function(t,e){var r=vn(e,En(An));return zp(t,We,void 0,e,r)});function Qp(t){var e=ct(t)?Eo.call(t):"";return e==ap||e==sp}function ct(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Zp(t){return!!t&&typeof t=="object"}function eh(t){return typeof t=="symbol"||Zp(t)&&Eo.call(t)==up}function th(t){if(!t)return t===0?t:0;if(t=rh(t),t===mo||t===-mo){var e=t<0?-1:1;return e*ip}return t===t?t:0}function Bo(t){var e=th(t),r=e%1;return e===e?r?e-r:e:0}function rh(t){if(typeof t=="number")return t;if(eh(t))return wo;if(ct(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=ct(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(fp,"");var r=yp.test(t);return r||mp.test(t)?vp(t.slice(2),r?2:8):dp.test(t)?wo:+t}function nh(t){return function(){return t}}function ih(t){return t}An.placeholder={};var oh=An,Oo=$e(oh);function ah(t,e){return{...dn(e,["address_id","external_variant_id","external_product_id","charge_interval_frequency","order_interval_frequency","price","status"]),customer_id:parseInt(t,10),shopify_variant_id:e.external_variant_id.ecommerce?parseInt(e.external_variant_id.ecommerce,10):void 0,charge_interval_frequency:`${e.charge_interval_frequency}`,order_interval_frequency:`${e.order_interval_frequency}`,status:e.status?e.status.toUpperCase():void 0}}function sh(t,e){return{...dn(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,charge_interval_frequency:e.charge_interval_frequency?`${e.charge_interval_frequency}`:void 0,order_interval_frequency:e.order_interval_frequency?`${e.order_interval_frequency}`:void 0,force_update:t}}function To(t){const{id:e,address_id:r,customer_id:n,analytics_data:a,cancellation_reason:s,cancellation_reason_comments:f,cancelled_at:p,charge_interval_frequency:h,created_at:m,expire_after_specific_number_of_charges:v,shopify_product_id:_,shopify_variant_id:b,has_queued_charges:y,is_prepaid:x,is_skippable:I,is_swappable:O,max_retries_reached:S,next_charge_scheduled_at:T,order_day_of_month:F,order_day_of_week:R,order_interval_frequency:D,order_interval_unit:N,presentment_currency:V,price:k,product_title:ee,properties:z,quantity:ue,sku:Y,sku_override:M,status:ne,updated_at:L,variant_title:ie}=t;return{id:e,address_id:r,customer_id:n,analytics_data:a,cancellation_reason:s,cancellation_reason_comments:f,cancelled_at:p,charge_interval_frequency:parseInt(h,10),created_at:m,expire_after_specific_number_of_charges:v,external_product_id:{ecommerce:`${_}`},external_variant_id:{ecommerce:`${b}`},has_queued_charges:ao(y),is_prepaid:x,is_skippable:I,is_swappable:O,max_retries_reached:ao(S),next_charge_scheduled_at:T,order_day_of_month:F,order_day_of_week:R,order_interval_frequency:parseInt(D,10),order_interval_unit:N,presentment_currency:V,price:`${k}`,product_title:ee??"",properties:z,quantity:ue,sku:Y,sku_override:M,status:ne.toLowerCase(),updated_at:L,variant_title:ie}}async function uh(t,e,r){const{subscription:n}=await B("get","/subscriptions",{id:e,query:{include:r?.include}},t);return n}function ch(t,e){return B("get","/subscriptions",{query:e},t)}async function fh(t,e,r){const{subscription:n}=await B("post","/subscriptions",{data:e,query:r},t);return n}async function lh(t,e,r,n){const{subscription:a}=await B("put","/subscriptions",{id:e,data:r,query:n},t);return a}async function ph(t,e,r,n){const{subscription:a}=await B("post",`/subscriptions/${e}/set_next_charge_date`,{data:{date:r},query:n},t);return a}async function hh(t,e,r){const{subscription:n}=await B("post",`/subscriptions/${e}/change_address`,{data:{address_id:r}},t);return n}async function dh(t,e,r,n){const{subscription:a}=await B("post",`/subscriptions/${e}/cancel`,{data:r,query:n},t);return a}async function yh(t,e,r){const{subscription:n}=await B("post",`/subscriptions/${e}/activate`,{query:r},t);return n}async function gh(t,e,r){const{charge:n}=await B("post",`/subscriptions/${e}/charges/skip`,{data:{date:r,subscription_id:`${e}`}},t);return n}async function mh(t,e,r){const{onetimes:n}=await B("post","/purchase_items/skip_gift",{data:{purchase_item_ids:e.map(Number),recipient_address:r}},t);return n}async function wh(t,e){const r=e.length;if(r<1||r>21)throw new Error("Number of subscriptions must be between 1 and 20.");const{customerId:n}=t;if(!n)throw new Error("No customerId in session.");const a=e[0].address_id;if(!e.every(h=>h.address_id===a))throw new Error("All subscriptions must have the same address_id.");const s=Oo(ah,n),f=e.map(s),{subscriptions:p}=await B("post",`/addresses/${a}/subscriptions-bulk`,{data:{subscriptions:f},headers:{"X-Recharge-Version":"2021-01"}},t);return p.map(To)}async function vh(t,e,r,n){const a=r.length;if(a<1||a>21)throw new Error("Number of subscriptions must be between 1 and 20.");const{customerId:s}=t;if(!s)throw new Error("No customerId in session.");const f=Oo(sh,!!n?.force_update),p=r.map(f),{subscriptions:h}=await B("put",`/addresses/${e}/subscriptions-bulk`,{data:{subscriptions:p},headers:{"X-Recharge-Version":"2021-01"}},t);return h.map(To)}var _h=Object.freeze({__proto__:null,activateSubscription:yh,cancelSubscription:dh,createSubscription:fh,createSubscriptions:wh,getSubscription:uh,listSubscriptions:ch,skipGiftSubscriptionCharge:mh,skipSubscriptionCharge:gh,updateSubscription:lh,updateSubscriptionAddress:hh,updateSubscriptionChargeDate:ph,updateSubscriptions:vh});const bh={get(t,e){return ae("get",t,e)},post(t,e){return ae("post",t,e)},put(t,e){return ae("put",t,e)},delete(t,e){return ae("delete",t,e)}};function Eh(t){if(t)return t;if(window?.Shopify?.shop)return window.Shopify.shop;let e=window?.domain;if(!e){const r=location?.href.match(/(?:http[s]*:\/\/)*(.*?)\.(?=admin\.rechargeapps\.com)/i)?.[1].replace(/-sp$/,"");r&&(e=`${r}.myshopify.com`)}if(e)return e;throw new Error("No storeIdentifier was passed into init.")}function Ah(t={}){const e=t,{storefrontAccessToken:r}=t;if(r&&!r.startsWith("strfnt"))throw new Error("Incorrect storefront access token used. See https://storefront.rechargepayments.com/client/docs/getting_started/package_setup/#initialization-- for more information.");qu({storeIdentifier:Eh(t.storeIdentifier),loginRetryFn:t.loginRetryFn,storefrontAccessToken:r,environment:e.environment?e.environment:"prod",environmentUri:e.environmentUri}),po()}const Ro={init:Ah,api:bh,address:tc,auth:lc,bundle:Ic,charge:sl,cdn:Zf,customer:gl,gift:vl,membership:Sl,membershipProgram:Ol,metafield:Pl,onetime:Ml,order:jl,paymentMethod:Wl,plan:Xl,product:Kl,store:Zl,subscription:_h};try{Ro.init()}catch{}return Ro});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rechargeapps/storefront-client",
3
3
  "description": "Storefront client for Recharge",
4
- "version": "1.16.3",
4
+ "version": "1.17.1",
5
5
  "author": "Recharge Inc.",
6
6
  "license": "MIT",
7
7
  "main": "dist/cjs/index.js",