shopify 3.93.0 → 3.93.2

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.
Files changed (84) hide show
  1. package/dist/assets/hydrogen/starter/CHANGELOG.md +64 -0
  2. package/dist/assets/hydrogen/starter/app/components/Aside.tsx +4 -2
  3. package/dist/assets/hydrogen/starter/app/components/CartMain.tsx +6 -3
  4. package/dist/assets/hydrogen/starter/app/components/CartSummary.tsx +117 -23
  5. package/dist/assets/hydrogen/starter/app/components/Header.tsx +3 -3
  6. package/dist/assets/hydrogen/starter/app/components/PaginatedResourceSection.tsx +24 -4
  7. package/dist/assets/hydrogen/starter/app/components/ProductPrice.tsx +1 -1
  8. package/dist/assets/hydrogen/starter/app/routes/[robots.txt].tsx +14 -53
  9. package/dist/assets/hydrogen/starter/app/routes/_index.tsx +11 -4
  10. package/dist/assets/hydrogen/starter/app/routes/account.$.tsx +1 -1
  11. package/dist/assets/hydrogen/starter/app/routes/account.addresses.tsx +2 -2
  12. package/dist/assets/hydrogen/starter/app/routes/account.profile.tsx +1 -1
  13. package/dist/assets/hydrogen/starter/package.json +5 -5
  14. package/dist/assets/hydrogen/starter/storefrontapi.generated.d.ts +0 -11
  15. package/dist/assets/hydrogen/starter/vite.config.ts +1 -1
  16. package/dist/assets/hydrogen/vite/vite.config.js +1 -1
  17. package/dist/{chunk-DLK7L2KZ.js → chunk-4QL77VYJ.js} +3 -3
  18. package/dist/{chunk-U7JC7ESX.js → chunk-4VZV4LQX.js} +2 -2
  19. package/dist/{chunk-MYTB32VB.js → chunk-5FCKEHCK.js} +177 -181
  20. package/dist/{chunk-POO2TAEO.js → chunk-DDTYWTF2.js} +1 -1
  21. package/dist/{chunk-XV44IQDO.js → chunk-FYQIRCLV.js} +1 -1
  22. package/dist/{chunk-O6CC6JKI.js → chunk-IG47ZDRU.js} +1 -1
  23. package/dist/{chunk-SBSUITP6.js → chunk-MX6WWR5F.js} +1 -1
  24. package/dist/{chunk-P3ASN7B5.js → chunk-XVFYDYZA.js} +1 -1
  25. package/dist/cli/commands/store/auth.d.ts +1 -0
  26. package/dist/cli/commands/store/auth.js +10 -3
  27. package/dist/cli/commands/store/execute.d.ts +1 -0
  28. package/dist/cli/commands/store/execute.js +7 -4
  29. package/dist/cli/services/store/auth/callback.d.ts +8 -0
  30. package/dist/cli/services/store/auth/callback.js +140 -0
  31. package/dist/cli/services/store/{auth-config.js → auth/config.js} +1 -1
  32. package/dist/cli/services/store/auth/existing-scopes.d.ts +5 -0
  33. package/dist/cli/services/store/auth/existing-scopes.js +40 -0
  34. package/dist/cli/services/store/auth/index.d.ts +18 -0
  35. package/dist/cli/services/store/auth/index.js +88 -0
  36. package/dist/cli/services/store/auth/pkce.d.ts +36 -0
  37. package/dist/cli/services/store/auth/pkce.js +49 -0
  38. package/dist/cli/services/store/{auth-recovery.js → auth/recovery.js} +1 -1
  39. package/dist/cli/services/store/auth/result.d.ts +24 -0
  40. package/dist/cli/services/store/auth/result.js +39 -0
  41. package/dist/cli/services/store/auth/scopes.d.ts +4 -0
  42. package/dist/cli/services/store/auth/scopes.js +53 -0
  43. package/dist/cli/services/store/auth/session-lifecycle.d.ts +3 -0
  44. package/dist/cli/services/store/auth/session-lifecycle.js +69 -0
  45. package/dist/cli/services/store/{session.d.ts → auth/session-store.d.ts} +1 -2
  46. package/dist/cli/services/store/auth/session-store.js +127 -0
  47. package/dist/cli/services/store/auth/token-client.d.ts +40 -0
  48. package/dist/cli/services/store/auth/token-client.js +95 -0
  49. package/dist/cli/services/store/{admin-graphql-context.d.ts → execute/admin-context.d.ts} +3 -2
  50. package/dist/cli/services/store/execute/admin-context.js +41 -0
  51. package/dist/cli/services/store/execute/admin-transport.d.ts +6 -0
  52. package/dist/cli/services/store/{admin-graphql-transport.js → execute/admin-transport.js} +7 -7
  53. package/dist/cli/services/store/{execute.d.ts → execute/index.d.ts} +2 -3
  54. package/dist/cli/services/store/{execute.js → execute/index.js} +4 -11
  55. package/dist/cli/services/store/{execute-request.d.ts → execute/request.d.ts} +0 -2
  56. package/dist/cli/services/store/{execute-request.js → execute/request.js} +1 -2
  57. package/dist/cli/services/store/execute/result.d.ts +3 -0
  58. package/dist/cli/services/store/execute/result.js +29 -0
  59. package/dist/cli/services/store/{graphql-targets.d.ts → execute/targets.d.ts} +2 -3
  60. package/dist/cli/services/store/{graphql-targets.js → execute/targets.js} +5 -11
  61. package/dist/{error-handler-IRR4EZPS.js → error-handler-GZ2I7BG5.js} +1 -1
  62. package/dist/hooks/postrun.js +1 -1
  63. package/dist/hooks/prerun.js +1 -1
  64. package/dist/{http-proxy-node16-KBILO6A6.js → http-proxy-node16-DSQMBVDI.js} +1 -1
  65. package/dist/index.js +873 -865
  66. package/dist/{lib-EN3PX6IK.js → lib-GGVLMXY5.js} +1 -1
  67. package/dist/{local-PQUMWHWR.js → local-WHQ3ZS4K.js} +1 -1
  68. package/dist/{node-package-manager-HIOT5VLV.js → node-package-manager-6XMPTNUI.js} +1 -1
  69. package/dist/tsconfig.tsbuildinfo +1 -1
  70. package/dist/{ui-QBSPD4RX.js → ui-GZ7DOSHP.js} +1 -1
  71. package/dist/{workerd-QSZBPNES.js → workerd-LJU6AVMQ.js} +1 -1
  72. package/oclif.manifest.json +24 -5
  73. package/package.json +7 -7
  74. package/dist/assets/hydrogen/starter/app/routes/api.$version.[graphql.json].tsx +0 -14
  75. package/dist/cli/services/store/admin-graphql-context.js +0 -103
  76. package/dist/cli/services/store/admin-graphql-transport.d.ts +0 -9
  77. package/dist/cli/services/store/auth.d.ts +0 -61
  78. package/dist/cli/services/store/auth.js +0 -326
  79. package/dist/cli/services/store/execute-result.d.ts +0 -1
  80. package/dist/cli/services/store/execute-result.js +0 -18
  81. package/dist/cli/services/store/session.js +0 -69
  82. /package/dist/cli/services/store/{auth-config.d.ts → auth/config.d.ts} +0 -0
  83. /package/dist/cli/services/store/{auth-recovery.d.ts → auth/recovery.d.ts} +0 -0
  84. /package/dist/{morph-6DCXNO2H.js → morph-Q32V442A.js} +0 -0
@@ -0,0 +1,95 @@
1
+ import { adminUrl } from '@shopify/cli-kit/node/api/admin';
2
+ import { graphqlRequest } from '@shopify/cli-kit/node/api/graphql';
3
+ import { AbortError } from '@shopify/cli-kit/node/error';
4
+ import { fetch } from '@shopify/cli-kit/node/http';
5
+ import { outputContent, outputDebug, outputToken } from '@shopify/cli-kit/node/output';
6
+ import { maskToken, STORE_AUTH_APP_CLIENT_ID } from './config.js';
7
+ function truncateHttpErrorBody(body, length = 300) {
8
+ return body.slice(0, length);
9
+ }
10
+ export async function exchangeStoreAuthCodeForToken(options) {
11
+ const endpoint = `https://${options.store}/admin/oauth/access_token`;
12
+ outputDebug(outputContent `Exchanging authorization code for token at ${outputToken.raw(endpoint)}`);
13
+ const response = await fetch(endpoint, {
14
+ method: 'POST',
15
+ headers: { 'Content-Type': 'application/json' },
16
+ body: JSON.stringify({
17
+ client_id: STORE_AUTH_APP_CLIENT_ID,
18
+ code: options.code,
19
+ code_verifier: options.codeVerifier,
20
+ redirect_uri: options.redirectUri,
21
+ }),
22
+ });
23
+ const body = await response.text();
24
+ if (!response.ok) {
25
+ outputDebug(outputContent `Token exchange failed with HTTP ${outputToken.raw(String(response.status))}: ${outputToken.raw(truncateHttpErrorBody(body || response.statusText))}`);
26
+ throw new AbortError(`Failed to exchange OAuth code for an access token (HTTP ${response.status}).`, body || response.statusText);
27
+ }
28
+ let parsed;
29
+ try {
30
+ parsed = JSON.parse(body);
31
+ }
32
+ catch {
33
+ throw new AbortError('Received an invalid token response from Shopify.');
34
+ }
35
+ outputDebug(outputContent `Token exchange succeeded: access_token=${outputToken.raw(maskToken(parsed.access_token))}, refresh_token=${outputToken.raw(parsed.refresh_token ? maskToken(parsed.refresh_token) : 'none')}, expires_in=${outputToken.raw(String(parsed.expires_in ?? 'unknown'))}s, user=${outputToken.raw(String(parsed.associated_user?.id ?? 'unknown'))} (${outputToken.raw(parsed.associated_user?.email ?? 'no email')})`);
36
+ return parsed;
37
+ }
38
+ export async function refreshStoreAccessToken(options) {
39
+ const endpoint = `https://${options.store}/admin/oauth/access_token`;
40
+ outputDebug(outputContent `Refreshing access token for ${outputToken.raw(options.store)} using refresh_token=${outputToken.raw(maskToken(options.refreshToken))}`);
41
+ const response = await fetch(endpoint, {
42
+ method: 'POST',
43
+ headers: { 'Content-Type': 'application/json' },
44
+ body: JSON.stringify({
45
+ client_id: STORE_AUTH_APP_CLIENT_ID,
46
+ grant_type: 'refresh_token',
47
+ refresh_token: options.refreshToken,
48
+ }),
49
+ });
50
+ const body = await response.text();
51
+ if (!response.ok) {
52
+ outputDebug(outputContent `Token refresh failed with HTTP ${outputToken.raw(String(response.status))}: ${outputToken.raw(truncateHttpErrorBody(body || response.statusText))}`);
53
+ throw new AbortError(`Token refresh failed for ${options.store} (HTTP ${response.status}).`);
54
+ }
55
+ let parsed;
56
+ try {
57
+ parsed = JSON.parse(body);
58
+ }
59
+ catch {
60
+ throw new AbortError('Received an invalid refresh response from Shopify.');
61
+ }
62
+ if (!parsed.access_token) {
63
+ throw new AbortError(`Token refresh returned an invalid response for ${options.store}.`);
64
+ }
65
+ return {
66
+ accessToken: parsed.access_token,
67
+ refreshToken: parsed.refresh_token,
68
+ expiresIn: parsed.expires_in,
69
+ refreshTokenExpiresIn: parsed.refresh_token_expires_in,
70
+ };
71
+ }
72
+ const CurrentAppInstallationAccessScopesQuery = `#graphql
73
+ query CurrentAppInstallationAccessScopes {
74
+ currentAppInstallation {
75
+ accessScopes {
76
+ handle
77
+ }
78
+ }
79
+ }
80
+ `;
81
+ export async function fetchCurrentStoreAuthScopes(options) {
82
+ outputDebug(outputContent `Fetching current app installation scopes for ${outputToken.raw(options.store)} using token ${outputToken.raw(maskToken(options.accessToken))}`);
83
+ const data = await graphqlRequest({
84
+ query: CurrentAppInstallationAccessScopesQuery,
85
+ api: 'Admin',
86
+ url: adminUrl(options.store, 'unstable'),
87
+ token: options.accessToken,
88
+ responseOptions: { handleErrors: false },
89
+ });
90
+ if (!Array.isArray(data.currentAppInstallation?.accessScopes)) {
91
+ throw new Error('Shopify did not return currentAppInstallation.accessScopes.');
92
+ }
93
+ return data.currentAppInstallation.accessScopes.flatMap((scope) => typeof scope.handle === 'string' ? [scope.handle] : []);
94
+ }
95
+ //# sourceMappingURL=token-client.js.map
@@ -1,8 +1,9 @@
1
- import { AdminSession } from '@shopify/cli-kit/node/session';
1
+ import type { AdminSession } from '@shopify/cli-kit/node/session';
2
+ import type { StoredStoreAppSession } from '../auth/session-store.js';
2
3
  export interface AdminStoreGraphQLContext {
3
4
  adminSession: AdminSession;
4
5
  version: string;
5
- sessionUserId: string;
6
+ session: StoredStoreAppSession;
6
7
  }
7
8
  export declare function prepareAdminStoreGraphQLContext(input: {
8
9
  store: string;
@@ -0,0 +1,41 @@
1
+ import { fetchApiVersions } from '@shopify/cli-kit/node/api/admin';
2
+ import { AbortError } from '@shopify/cli-kit/node/error';
3
+ import { reauthenticateStoreAuthError } from '../auth/recovery.js';
4
+ import { clearStoredStoreAppSession } from '../auth/session-store.js';
5
+ import { loadStoredStoreSession } from '../auth/session-lifecycle.js';
6
+ async function resolveApiVersion(options) {
7
+ const { session, adminSession, userSpecifiedVersion } = options;
8
+ if (userSpecifiedVersion === 'unstable')
9
+ return userSpecifiedVersion;
10
+ let availableVersions;
11
+ try {
12
+ availableVersions = await fetchApiVersions(adminSession);
13
+ }
14
+ catch (error) {
15
+ if (error instanceof AbortError &&
16
+ error.message.includes(`Error connecting to your store ${adminSession.storeFqdn}:`) &&
17
+ /\b(?:401|404)\b/.test(error.message)) {
18
+ clearStoredStoreAppSession(session.store, session.userId);
19
+ throw reauthenticateStoreAuthError(`Stored app authentication for ${session.store} is no longer valid.`, session.store, session.scopes.join(','));
20
+ }
21
+ throw error;
22
+ }
23
+ if (!userSpecifiedVersion) {
24
+ const supportedVersions = availableVersions.filter((version) => version.supported).map((version) => version.handle);
25
+ return supportedVersions.sort().reverse()[0];
26
+ }
27
+ const versionList = availableVersions.map((version) => version.handle);
28
+ if (versionList.includes(userSpecifiedVersion))
29
+ return userSpecifiedVersion;
30
+ throw new AbortError(`Invalid API version: ${userSpecifiedVersion}`, `Allowed versions: ${versionList.join(', ')}`);
31
+ }
32
+ export async function prepareAdminStoreGraphQLContext(input) {
33
+ const session = await loadStoredStoreSession(input.store);
34
+ const adminSession = {
35
+ token: session.accessToken,
36
+ storeFqdn: session.store,
37
+ };
38
+ const version = await resolveApiVersion({ session, adminSession, userSpecifiedVersion: input.userSpecifiedVersion });
39
+ return { adminSession, version, session };
40
+ }
41
+ //# sourceMappingURL=admin-context.js.map
@@ -0,0 +1,6 @@
1
+ import type { PreparedStoreExecuteRequest } from './request.js';
2
+ import type { AdminStoreGraphQLContext } from './admin-context.js';
3
+ export declare function runAdminStoreGraphQLOperation(input: {
4
+ context: AdminStoreGraphQLContext;
5
+ request: PreparedStoreExecuteRequest;
6
+ }): Promise<unknown>;
@@ -3,8 +3,8 @@ import { graphqlRequest } from '@shopify/cli-kit/node/api/graphql';
3
3
  import { AbortError } from '@shopify/cli-kit/node/error';
4
4
  import { outputContent } from '@shopify/cli-kit/node/output';
5
5
  import { renderSingleTask } from '@shopify/cli-kit/node/ui';
6
- import { reauthenticateStoreAuthError } from './auth-recovery.js';
7
- import { clearStoredStoreAppSession } from './session.js';
6
+ import { reauthenticateStoreAuthError } from '../auth/recovery.js';
7
+ import { clearStoredStoreAppSession } from '../auth/session-store.js';
8
8
  function isGraphQLClientError(error) {
9
9
  if (!error || typeof error !== 'object' || !('response' in error))
10
10
  return false;
@@ -19,8 +19,8 @@ export async function runAdminStoreGraphQLOperation(input) {
19
19
  return graphqlRequest({
20
20
  query: input.request.query,
21
21
  api: 'Admin',
22
- url: adminUrl(input.adminSession.storeFqdn, input.version, input.adminSession),
23
- token: input.adminSession.token,
22
+ url: adminUrl(input.context.adminSession.storeFqdn, input.context.version, input.context.adminSession),
23
+ token: input.context.adminSession.token,
24
24
  variables: input.request.parsedVariables,
25
25
  responseOptions: { handleErrors: false },
26
26
  });
@@ -30,8 +30,8 @@ export async function runAdminStoreGraphQLOperation(input) {
30
30
  }
31
31
  catch (error) {
32
32
  if (isGraphQLClientError(error) && error.response.status === 401) {
33
- clearStoredStoreAppSession(input.store, input.sessionUserId);
34
- throw reauthenticateStoreAuthError(`Stored app authentication for ${input.store} is no longer valid.`, input.store, '<comma-separated-scopes>');
33
+ clearStoredStoreAppSession(input.context.session.store, input.context.session.userId);
34
+ throw reauthenticateStoreAuthError(`Stored app authentication for ${input.context.session.store} is no longer valid.`, input.context.session.store, input.context.session.scopes.join(','));
35
35
  }
36
36
  if (isGraphQLClientError(error) && error.response.errors) {
37
37
  throw new AbortError('GraphQL operation failed.', JSON.stringify({ errors: error.response.errors }, null, 2));
@@ -39,4 +39,4 @@ export async function runAdminStoreGraphQLOperation(input) {
39
39
  throw error;
40
40
  }
41
41
  }
42
- //# sourceMappingURL=admin-graphql-transport.js.map
42
+ //# sourceMappingURL=admin-transport.js.map
@@ -1,4 +1,4 @@
1
- import { StoreGraphQLApi } from './graphql-targets.js';
1
+ import { type StoreGraphQLApi } from './targets.js';
2
2
  interface ExecuteStoreOperationInput {
3
3
  store: string;
4
4
  api?: StoreGraphQLApi;
@@ -6,9 +6,8 @@ interface ExecuteStoreOperationInput {
6
6
  queryFile?: string;
7
7
  variables?: string;
8
8
  variableFile?: string;
9
- outputFile?: string;
10
9
  version?: string;
11
10
  allowMutations?: boolean;
12
11
  }
13
- export declare function executeStoreOperation(input: ExecuteStoreOperationInput): Promise<void>;
12
+ export declare function executeStoreOperation(input: ExecuteStoreOperationInput): Promise<unknown>;
14
13
  export {};
@@ -1,8 +1,7 @@
1
1
  import { renderSingleTask } from '@shopify/cli-kit/node/ui';
2
2
  import { outputContent } from '@shopify/cli-kit/node/output';
3
- import { prepareStoreExecuteRequest } from './execute-request.js';
4
- import { writeOrOutputStoreExecuteResult } from './execute-result.js';
5
- import { getStoreGraphQLTarget } from './graphql-targets.js';
3
+ import { prepareStoreExecuteRequest } from './request.js';
4
+ import { getStoreGraphQLTarget } from './targets.js';
6
5
  export async function executeStoreOperation(input) {
7
6
  const target = getStoreGraphQLTarget(input.api ?? 'admin');
8
7
  const request = await prepareStoreExecuteRequest({
@@ -10,7 +9,6 @@ export async function executeStoreOperation(input) {
10
9
  queryFile: input.queryFile,
11
10
  variables: input.variables,
12
11
  variableFile: input.variableFile,
13
- outputFile: input.outputFile,
14
12
  version: input.version,
15
13
  allowMutations: input.allowMutations,
16
14
  });
@@ -19,11 +17,6 @@ export async function executeStoreOperation(input) {
19
17
  task: async () => target.prepareContext({ store: input.store, requestedVersion: request.requestedVersion }),
20
18
  renderOptions: { stdout: process.stderr },
21
19
  });
22
- const result = await target.execute({
23
- store: input.store,
24
- context,
25
- request,
26
- });
27
- await writeOrOutputStoreExecuteResult(result, request.outputFile);
20
+ return await target.execute({ context, request });
28
21
  }
29
- //# sourceMappingURL=execute.js.map
22
+ //# sourceMappingURL=index.js.map
@@ -8,7 +8,6 @@ export interface PreparedStoreExecuteRequest {
8
8
  parsedVariables?: {
9
9
  [key: string]: unknown;
10
10
  };
11
- outputFile?: string;
12
11
  requestedVersion?: string;
13
12
  }
14
13
  export declare function prepareStoreExecuteRequest(input: {
@@ -16,7 +15,6 @@ export declare function prepareStoreExecuteRequest(input: {
16
15
  queryFile?: string;
17
16
  variables?: string;
18
17
  variableFile?: string;
19
- outputFile?: string;
20
18
  version?: string;
21
19
  allowMutations?: boolean;
22
20
  }): Promise<PreparedStoreExecuteRequest>;
@@ -82,8 +82,7 @@ export async function prepareStoreExecuteRequest(input) {
82
82
  query,
83
83
  parsedOperation,
84
84
  parsedVariables,
85
- outputFile: input.outputFile,
86
85
  requestedVersion: input.version,
87
86
  };
88
87
  }
89
- //# sourceMappingURL=execute-request.js.map
88
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1,3 @@
1
+ type StoreExecuteOutputFormat = 'text' | 'json';
2
+ export declare function writeOrOutputStoreExecuteResult(result: unknown, outputFile?: string, format?: StoreExecuteOutputFormat): Promise<void>;
3
+ export {};
@@ -0,0 +1,29 @@
1
+ import { writeFile } from '@shopify/cli-kit/node/fs';
2
+ import { outputResult } from '@shopify/cli-kit/node/output';
3
+ import { renderSuccess } from '@shopify/cli-kit/node/ui';
4
+ function serializeStoreExecuteResult(result) {
5
+ return JSON.stringify(result, null, 2);
6
+ }
7
+ function renderStoreExecuteSuccess(outputFile) {
8
+ if (outputFile) {
9
+ renderSuccess({
10
+ headline: 'Operation succeeded.',
11
+ body: `Results written to ${outputFile}`,
12
+ });
13
+ return;
14
+ }
15
+ renderSuccess({ headline: 'Operation succeeded.' });
16
+ }
17
+ export async function writeOrOutputStoreExecuteResult(result, outputFile, format = 'text') {
18
+ const serializedResult = serializeStoreExecuteResult(result);
19
+ if (outputFile) {
20
+ await writeFile(outputFile, serializedResult);
21
+ if (format === 'text')
22
+ renderStoreExecuteSuccess(outputFile);
23
+ return;
24
+ }
25
+ if (format === 'text')
26
+ renderStoreExecuteSuccess();
27
+ outputResult(serializedResult);
28
+ }
29
+ //# sourceMappingURL=result.js.map
@@ -1,12 +1,11 @@
1
- import { PreparedStoreExecuteRequest } from './execute-request.js';
2
- import { AdminStoreGraphQLContext } from './admin-graphql-context.js';
1
+ import type { PreparedStoreExecuteRequest } from './request.js';
2
+ import { type AdminStoreGraphQLContext } from './admin-context.js';
3
3
  export type StoreGraphQLApi = 'admin';
4
4
  interface PrepareStoreGraphQLTargetContextInput {
5
5
  store: string;
6
6
  requestedVersion?: string;
7
7
  }
8
8
  interface ExecuteStoreGraphQLTargetInput<TContext> {
9
- store: string;
10
9
  context: TContext;
11
10
  request: PreparedStoreExecuteRequest;
12
11
  }
@@ -1,19 +1,13 @@
1
1
  import { BugError } from '@shopify/cli-kit/node/error';
2
- import { prepareAdminStoreGraphQLContext } from './admin-graphql-context.js';
3
- import { runAdminStoreGraphQLOperation } from './admin-graphql-transport.js';
2
+ import { prepareAdminStoreGraphQLContext } from './admin-context.js';
3
+ import { runAdminStoreGraphQLOperation } from './admin-transport.js';
4
4
  const adminStoreGraphQLTarget = {
5
5
  id: 'admin',
6
6
  prepareContext: async ({ store, requestedVersion }) => {
7
7
  return prepareAdminStoreGraphQLContext({ store, userSpecifiedVersion: requestedVersion });
8
8
  },
9
- execute: async ({ store, context, request }) => {
10
- return runAdminStoreGraphQLOperation({
11
- store,
12
- adminSession: context.adminSession,
13
- sessionUserId: context.sessionUserId,
14
- version: context.version,
15
- request,
16
- });
9
+ execute: async ({ context, request }) => {
10
+ return runAdminStoreGraphQLOperation({ context, request });
17
11
  },
18
12
  };
19
13
  export function getStoreGraphQLTarget(api) {
@@ -24,4 +18,4 @@ export function getStoreGraphQLTarget(api) {
24
18
  throw new BugError(`Unsupported store GraphQL API target: ${api}`);
25
19
  }
26
20
  }
27
- //# sourceMappingURL=graphql-targets.js.map
21
+ //# sourceMappingURL=targets.js.map
@@ -1 +1 @@
1
- import{Na as a,Oa as b,Pa as c,Qa as d,Ra as e}from"./chunk-U7JC7ESX.js";import"./chunk-PRKBO42R.js";import"./chunk-SBSUITP6.js";import"./chunk-DLK7L2KZ.js";import"./chunk-P3ASN7B5.js";import"./chunk-XV44IQDO.js";import"./chunk-QJEBL3WX.js";import"./chunk-EENHXSWU.js";import"./chunk-NOSKVZWJ.js";import"./chunk-T4M5CWAO.js";import"./chunk-PRVQAHWI.js";import"./chunk-QUTQDXSL.js";import"./chunk-VPRTJUIN.js";export{e as addBugsnagMetadata,c as cleanStackFrameFilePath,a as errorHandler,d as registerCleanBugsnagErrorsFromWithinPlugins,b as sendErrorToBugsnag};
1
+ import{Na as a,Oa as b,Pa as c,Qa as d,Ra as e}from"./chunk-4VZV4LQX.js";import"./chunk-PRKBO42R.js";import"./chunk-MX6WWR5F.js";import"./chunk-4QL77VYJ.js";import"./chunk-XVFYDYZA.js";import"./chunk-FYQIRCLV.js";import"./chunk-QJEBL3WX.js";import"./chunk-EENHXSWU.js";import"./chunk-NOSKVZWJ.js";import"./chunk-T4M5CWAO.js";import"./chunk-PRVQAHWI.js";import"./chunk-QUTQDXSL.js";import"./chunk-VPRTJUIN.js";export{e as addBugsnagMetadata,c as cleanStackFrameFilePath,a as errorHandler,d as registerCleanBugsnagErrorsFromWithinPlugins,b as sendErrorToBugsnag};
@@ -1 +1 @@
1
- import{d as a}from"../chunk-POO2TAEO.js";import"../chunk-U7JC7ESX.js";import"../chunk-PRKBO42R.js";import"../chunk-SBSUITP6.js";import"../chunk-DLK7L2KZ.js";import"../chunk-P3ASN7B5.js";import"../chunk-XV44IQDO.js";import"../chunk-QJEBL3WX.js";import"../chunk-EENHXSWU.js";import"../chunk-NOSKVZWJ.js";import"../chunk-T4M5CWAO.js";import"../chunk-PRVQAHWI.js";import"../chunk-QUTQDXSL.js";import{g as o}from"../chunk-VPRTJUIN.js";o();export{a as default};
1
+ import{d as a}from"../chunk-DDTYWTF2.js";import"../chunk-4VZV4LQX.js";import"../chunk-PRKBO42R.js";import"../chunk-MX6WWR5F.js";import"../chunk-4QL77VYJ.js";import"../chunk-XVFYDYZA.js";import"../chunk-FYQIRCLV.js";import"../chunk-QJEBL3WX.js";import"../chunk-EENHXSWU.js";import"../chunk-NOSKVZWJ.js";import"../chunk-T4M5CWAO.js";import"../chunk-PRVQAHWI.js";import"../chunk-QUTQDXSL.js";import{g as o}from"../chunk-VPRTJUIN.js";o();export{a as default};
@@ -1 +1 @@
1
- import{e as c}from"../chunk-O6CC6JKI.js";import{Ca as s,a}from"../chunk-U7JC7ESX.js";import"../chunk-PRKBO42R.js";import{N as i}from"../chunk-SBSUITP6.js";import{Ed as m,lb as t}from"../chunk-DLK7L2KZ.js";import"../chunk-P3ASN7B5.js";import"../chunk-XV44IQDO.js";import"../chunk-QJEBL3WX.js";import"../chunk-EENHXSWU.js";import"../chunk-NOSKVZWJ.js";import"../chunk-T4M5CWAO.js";import"../chunk-PRVQAHWI.js";import"../chunk-QUTQDXSL.js";import{g as e}from"../chunk-VPRTJUIN.js";e();e();var d=async n=>{let r=f({id:n.Command.id,aliases:n.Command.aliases,pluginAlias:n.Command.plugin?.alias}),o=n.argv;h(),m(`Running command ${r.command}`),await s({commandContent:r,args:o,commandClass:n.Command}),c(n.Command.id)};function f(n){let r=p(n.pluginAlias);return r??(r=l(n.id,n.aliases)),r}function l(n,r){return{command:n.replace(/:/g," "),topic:C(n),alias:g(r)}}function p(n){if(n?.startsWith("@shopify/create-"))return{command:n.substring(n.indexOf("/")+1)}}function C(n){if(n.lastIndexOf(":")!==-1)return n.slice(0,n.lastIndexOf(":")).replace(/:/g," ")}function g(n){let r=n.find(o=>o.split(":").every(u=>process.argv.includes(u)));if(r)return r.replace(/:/g," ")}function h(){let n=a;t(n)||i("@shopify/cli",n,{cacheExpiryInHours:24})}export{d as default};
1
+ import{e as c}from"../chunk-IG47ZDRU.js";import{Ca as s,a}from"../chunk-4VZV4LQX.js";import"../chunk-PRKBO42R.js";import{N as i}from"../chunk-MX6WWR5F.js";import{Ed as m,lb as t}from"../chunk-4QL77VYJ.js";import"../chunk-XVFYDYZA.js";import"../chunk-FYQIRCLV.js";import"../chunk-QJEBL3WX.js";import"../chunk-EENHXSWU.js";import"../chunk-NOSKVZWJ.js";import"../chunk-T4M5CWAO.js";import"../chunk-PRVQAHWI.js";import"../chunk-QUTQDXSL.js";import{g as e}from"../chunk-VPRTJUIN.js";e();e();var d=async n=>{let r=f({id:n.Command.id,aliases:n.Command.aliases,pluginAlias:n.Command.plugin?.alias}),o=n.argv;h(),m(`Running command ${r.command}`),await s({commandContent:r,args:o,commandClass:n.Command}),c(n.Command.id)};function f(n){let r=p(n.pluginAlias);return r??(r=l(n.id,n.aliases)),r}function l(n,r){return{command:n.replace(/:/g," "),topic:C(n),alias:g(r)}}function p(n){if(n?.startsWith("@shopify/create-"))return{command:n.substring(n.indexOf("/")+1)}}function C(n){if(n.lastIndexOf(":")!==-1)return n.slice(0,n.lastIndexOf(":")).replace(/:/g," ")}function g(n){let r=n.find(o=>o.split(":").every(u=>process.argv.includes(u)));if(r)return r.replace(/:/g," ")}function h(){let n=a;t(n)||i("@shopify/cli",n,{cacheExpiryInHours:24})}export{d as default};
@@ -1,4 +1,4 @@
1
- import{d as Ae}from"./chunk-XV44IQDO.js";import{a as w,c as g,g as l}from"./chunk-VPRTJUIN.js";var re=g((ft,D)=>{"use strict";l();var qe=Object.prototype.hasOwnProperty,_="~";function C(){}Object.create&&(C.prototype=Object.create(null),new C().__proto__||(_=!1));function Be(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function te(e,t,r,s,o){if(typeof r!="function")throw new TypeError("The listener must be a function");var n=new Be(r,s||e,o),i=_?_+t:t;return e._events[i]?e._events[i].fn?e._events[i]=[e._events[i],n]:e._events[i].push(n):(e._events[i]=n,e._eventsCount++),e}function j(e,t){--e._eventsCount===0?e._events=new C:delete e._events[t]}function v(){this._events=new C,this._eventsCount=0}v.prototype.eventNames=function(){var t=[],r,s;if(this._eventsCount===0)return t;for(s in r=this._events)qe.call(r,s)&&t.push(_?s.slice(1):s);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(r)):t};v.prototype.listeners=function(t){var r=_?_+t:t,s=this._events[r];if(!s)return[];if(s.fn)return[s.fn];for(var o=0,n=s.length,i=new Array(n);o<n;o++)i[o]=s[o].fn;return i};v.prototype.listenerCount=function(t){var r=_?_+t:t,s=this._events[r];return s?s.fn?1:s.length:0};v.prototype.emit=function(t,r,s,o,n,i){var c=_?_+t:t;if(!this._events[c])return!1;var a=this._events[c],h=arguments.length,u,f;if(a.fn){switch(a.once&&this.removeListener(t,a.fn,void 0,!0),h){case 1:return a.fn.call(a.context),!0;case 2:return a.fn.call(a.context,r),!0;case 3:return a.fn.call(a.context,r,s),!0;case 4:return a.fn.call(a.context,r,s,o),!0;case 5:return a.fn.call(a.context,r,s,o,n),!0;case 6:return a.fn.call(a.context,r,s,o,n,i),!0}for(f=1,u=new Array(h-1);f<h;f++)u[f-1]=arguments[f];a.fn.apply(a.context,u)}else{var d=a.length,p;for(f=0;f<d;f++)switch(a[f].once&&this.removeListener(t,a[f].fn,void 0,!0),h){case 1:a[f].fn.call(a[f].context);break;case 2:a[f].fn.call(a[f].context,r);break;case 3:a[f].fn.call(a[f].context,r,s);break;case 4:a[f].fn.call(a[f].context,r,s,o);break;default:if(!u)for(p=1,u=new Array(h-1);p<h;p++)u[p-1]=arguments[p];a[f].fn.apply(a[f].context,u)}}return!0};v.prototype.on=function(t,r,s){return te(this,t,r,s,!1)};v.prototype.once=function(t,r,s){return te(this,t,r,s,!0)};v.prototype.removeListener=function(t,r,s,o){var n=_?_+t:t;if(!this._events[n])return this;if(!r)return j(this,n),this;var i=this._events[n];if(i.fn)i.fn===r&&(!o||i.once)&&(!s||i.context===s)&&j(this,n);else{for(var c=0,a=[],h=i.length;c<h;c++)(i[c].fn!==r||o&&!i[c].once||s&&i[c].context!==s)&&a.push(i[c]);a.length?this._events[n]=a.length===1?a[0]:a:j(this,n)}return this};v.prototype.removeAllListeners=function(t){var r;return t?(r=_?_+t:t,this._events[r]&&j(this,r)):(this._events=new C,this._eventsCount=0),this};v.prototype.off=v.prototype.removeListener;v.prototype.addListener=v.prototype.on;v.prefixed=_;v.EventEmitter=v;typeof D<"u"&&(D.exports=v)});var ne=g((ct,se)=>{"use strict";l();se.exports=function(t,r){if(r=r.split(":")[0],t=+t,!t)return!1;switch(r){case"http":case"ws":return t!==80;case"https":case"wss":return t!==443;case"ftp":return t!==21;case"gopher":return t!==70;case"file":return!1}return t!==0}});var N=g(oe=>{l();var E=oe,Ue=w("url"),ie=Object.assign,je=ne(),Ne=/(^|,)\s*upgrade\s*($|,)/i,k=/^https|wss/;E.isSSL=k;E.setupOutgoing=function(e,t,r,s){e.port=t[s||"target"].port||(k.test(t[s||"target"].protocol)?443:80),["host","hostname","socketPath","pfx","key","passphrase","cert","ca","ciphers","secureProtocol"].forEach(function(c){e[c]=t[s||"target"][c]}),e.method=t.method||r.method,e.headers=ie({},r.headers),t.headers&&ie(e.headers,t.headers),t.auth&&(e.auth=t.auth),t.ca&&(e.ca=t.ca),k.test(t[s||"target"].protocol)&&(e.rejectUnauthorized=typeof t.secure>"u"?!0:t.secure),e.agent=t.agent||!1,e.localAddress=t.localAddress,e.agent||(e.headers=e.headers||{},(typeof e.headers.connection!="string"||!Ne.test(e.headers.connection))&&(e.headers.connection="close"));var o=t[s||"target"],n=o&&t.prependPath!==!1&&o.path||"",i=t.toProxy?r.url:Ue.parse(r.url).path||"";return i=t.ignorePath?"":i,e.path=E.urlJoin(n,i),t.changeOrigin&&(e.headers.host=je(e.port,t[s||"target"].protocol)&&!Me(e.host)?e.host+":"+e.port:e.host),e};E.setupSocket=function(e){return e.setTimeout(0),e.setNoDelay(!0),e.setKeepAlive(!0,0),e};E.getPort=function(e){var t=e.headers.host?e.headers.host.match(/:(\d+)/):"";return t?t[1]:E.hasEncryptedConnection(e)?"443":"80"};E.hasEncryptedConnection=function(e){return!!(e.connection.encrypted||e.connection.pair)};E.urlJoin=function(){var e=Array.prototype.slice.call(arguments),t=[],r="",s;return e.forEach((o,n)=>{var i=o.indexOf("?");i!==-1&&(t.push(o.substring(i+1)),e[n]=o.substring(0,i))}),r=t.filter(Boolean).join("&"),s=e.filter(Boolean).join("/").replace(/\/+/g,"/").replace("http:/","http://").replace("https:/","https://"),r?s+"?"+r:s};E.rewriteCookieProperty=function e(t,r,s){return Array.isArray(t)?t.map(function(o){return e(o,r,s)}):t.replace(new RegExp("(;\\s*"+s+"=)([^;]+)","i"),function(o,n,i){var c;if(i in r)c=r[i];else if("*"in r)c=r["*"];else return o;return c?n+c:""})};function Me(e){return!!~e.indexOf(":")}});var he=g((vt,fe)=>{l();var ae=w("url"),ue=N(),De=/^201|30(1|2|7|8)$/;fe.exports={removeChunked:function(t,r,s){t.httpVersion==="1.0"&&delete s.headers["transfer-encoding"]},setConnection:function(t,r,s){t.httpVersion==="1.0"?s.headers.connection=t.headers.connection||"close":t.httpVersion!=="2.0"&&!s.headers.connection&&(s.headers.connection=t.headers.connection||"keep-alive")},setRedirectHostRewrite:function(t,r,s,o){if((o.hostRewrite||o.autoRewrite||o.protocolRewrite)&&s.headers.location&&De.test(s.statusCode)){var n=ae.parse(o.target),i=ae.parse(s.headers.location);if(n.host!=i.host)return;o.hostRewrite?i.host=o.hostRewrite:o.autoRewrite&&(i.host=t.headers.host),o.protocolRewrite&&(i.protocol=o.protocolRewrite),s.headers.location=i.format()}},writeHeaders:function(t,r,s,o){var n=o.cookieDomainRewrite,i=o.cookiePathRewrite,c=o.preserveHeaderKeyCase,a,h=function(d,p){p!=null&&(n&&d.toLowerCase()==="set-cookie"&&(p=ue.rewriteCookieProperty(p,n,"domain")),i&&d.toLowerCase()==="set-cookie"&&(p=ue.rewriteCookieProperty(p,i,"path")),r.setHeader(String(d).trim(),p))};if(typeof n=="string"&&(n={"*":n}),typeof i=="string"&&(i={"*":i}),c&&s.rawHeaders!=null){a={};for(var u=0;u<s.rawHeaders.length;u+=2){var f=s.rawHeaders[u];a[f.toLowerCase()]=f}}Object.keys(s.headers).forEach(function(d){var p=s.headers[d];c&&a&&(d=a[d]||d),h(d,p)})},writeStatusCode:function(t,r,s){s.statusMessage?(r.statusCode=s.statusCode,r.statusMessage=s.statusMessage):r.statusCode=s.statusCode}}});var de=g((wt,ce)=>{l();var T;ce.exports=function(){if(!T){try{T=Ae()("follow-redirects")}catch{}typeof T!="function"&&(T=function(){})}T.apply(null,arguments)}});var we=g((yt,Q)=>{l();var S=w("url"),H=S.URL,ke=w("http"),Ie=w("https"),$=w("stream").Writable,X=w("assert"),le=de();(function(){var t=typeof process<"u",r=typeof window<"u"&&typeof document<"u",s=x(Error.captureStackTrace);!t&&(r||!s)&&console.warn("The follow-redirects package should be excluded from browser builds.")})();var z=!1;try{X(new H(""))}catch(e){z=e.code==="ERR_INVALID_URL"}var Fe=["auth","host","hostname","href","path","pathname","port","protocol","query","search","hash"],K=["abort","aborted","connect","error","socket","timeout"],G=Object.create(null);K.forEach(function(e){G[e]=function(t,r,s){this._redirectable.emit(e,t,r,s)}});var F=A("ERR_INVALID_URL","Invalid URL",TypeError),V=A("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),Ve=A("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded",V),We=A("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),$e=A("ERR_STREAM_WRITE_AFTER_END","write after end"),Xe=$.prototype.destroy||ve;function y(e,t){$.call(this),this._sanitizeOptions(e),this._options=e,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],t&&this.on("response",t);var r=this;this._onNativeResponse=function(s){try{r._processResponse(s)}catch(o){r.emit("error",o instanceof V?o:new V({cause:o}))}},this._performRequest()}y.prototype=Object.create($.prototype);y.prototype.abort=function(){Y(this._currentRequest),this._currentRequest.abort(),this.emit("abort")};y.prototype.destroy=function(e){return Y(this._currentRequest,e),Xe.call(this,e),this};y.prototype.write=function(e,t,r){if(this._ending)throw new $e;if(!P(e)&&!Ge(e))throw new TypeError("data should be a string, Buffer or Uint8Array");if(x(t)&&(r=t,t=null),e.length===0){r&&r();return}this._requestBodyLength+e.length<=this._options.maxBodyLength?(this._requestBodyLength+=e.length,this._requestBodyBuffers.push({data:e,encoding:t}),this._currentRequest.write(e,t,r)):(this.emit("error",new We),this.abort())};y.prototype.end=function(e,t,r){if(x(e)?(r=e,e=t=null):x(t)&&(r=t,t=null),!e)this._ended=this._ending=!0,this._currentRequest.end(null,null,r);else{var s=this,o=this._currentRequest;this.write(e,t,function(){s._ended=!0,o.end(null,null,r)}),this._ending=!0}};y.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)};y.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)};y.prototype.setTimeout=function(e,t){var r=this;function s(i){i.setTimeout(e),i.removeListener("timeout",i.destroy),i.addListener("timeout",i.destroy)}function o(i){r._timeout&&clearTimeout(r._timeout),r._timeout=setTimeout(function(){r.emit("timeout"),n()},e),s(i)}function n(){r._timeout&&(clearTimeout(r._timeout),r._timeout=null),r.removeListener("abort",n),r.removeListener("error",n),r.removeListener("response",n),r.removeListener("close",n),t&&r.removeListener("timeout",t),r.socket||r._currentRequest.removeListener("socket",o)}return t&&this.on("timeout",t),this.socket?o(this.socket):this._currentRequest.once("socket",o),this.on("socket",s),this.on("abort",n),this.on("error",n),this.on("response",n),this.on("close",n),this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(e){y.prototype[e]=function(t,r){return this._currentRequest[e](t,r)}});["aborted","connection","socket"].forEach(function(e){Object.defineProperty(y.prototype,e,{get:function(){return this._currentRequest[e]}})});y.prototype._sanitizeOptions=function(e){if(e.headers||(e.headers={}),e.host&&(e.hostname||(e.hostname=e.host),delete e.host),!e.pathname&&e.path){var t=e.path.indexOf("?");t<0?e.pathname=e.path:(e.pathname=e.path.substring(0,t),e.search=e.path.substring(t))}};y.prototype._performRequest=function(){var e=this._options.protocol,t=this._options.nativeProtocols[e];if(!t)throw new TypeError("Unsupported protocol "+e);if(this._options.agents){var r=e.slice(0,-1);this._options.agent=this._options.agents[r]}var s=this._currentRequest=t.request(this._options,this._onNativeResponse);s._redirectable=this;for(var o of K)s.on(o,G[o]);if(this._currentUrl=/^\//.test(this._options.path)?S.format(this._options):this._options.path,this._isRedirect){var n=0,i=this,c=this._requestBodyBuffers;(function a(h){if(s===i._currentRequest)if(h)i.emit("error",h);else if(n<c.length){var u=c[n++];s.finished||s.write(u.data,u.encoding,a)}else i._ended&&s.end()})()}};y.prototype._processResponse=function(e){var t=e.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:t});var r=e.headers.location;if(!r||this._options.followRedirects===!1||t<300||t>=400){e.responseUrl=this._currentUrl,e.redirects=this._redirects,this.emit("response",e),this._requestBodyBuffers=[];return}if(Y(this._currentRequest),e.destroy(),++this._redirectCount>this._options.maxRedirects)throw new Ve;var s,o=this._options.beforeRedirect;o&&(s=Object.assign({Host:e.req.getHeader("host")},this._options.headers));var n=this._options.method;((t===301||t===302)&&this._options.method==="POST"||t===303&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],I(/^content-/i,this._options.headers));var i=I(/^host$/i,this._options.headers),c=J(this._currentUrl),a=i||c.host,h=/^\w+:/.test(r)?this._currentUrl:S.format(Object.assign(c,{host:a})),u=ze(r,h);if(le("redirecting to",u.href),this._isRedirect=!0,W(u,this._options),(u.protocol!==c.protocol&&u.protocol!=="https:"||u.host!==a&&!Ke(u.host,a))&&I(/^(?:(?:proxy-)?authorization|cookie)$/i,this._options.headers),x(o)){var f={headers:e.headers,statusCode:t},d={url:h,method:n,headers:s};o(this._options,f,d),this._sanitizeOptions(this._options)}this._performRequest()};function pe(e){var t={maxRedirects:21,maxBodyLength:10485760},r={};return Object.keys(e).forEach(function(s){var o=s+":",n=r[o]=e[s],i=t[s]=Object.create(n);function c(h,u,f){return Je(h)?h=W(h):P(h)?h=W(J(h)):(f=u,u=me(h),h={protocol:o}),x(u)&&(f=u,u=null),u=Object.assign({maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},h,u),u.nativeProtocols=r,!P(u.host)&&!P(u.hostname)&&(u.hostname="::1"),X.equal(u.protocol,o,"protocol mismatch"),le("options",u),new y(u,f)}function a(h,u,f){var d=i.request(h,u,f);return d.end(),d}Object.defineProperties(i,{request:{value:c,configurable:!0,enumerable:!0,writable:!0},get:{value:a,configurable:!0,enumerable:!0,writable:!0}})}),t}function ve(){}function J(e){var t;if(z)t=new H(e);else if(t=me(S.parse(e)),!P(t.protocol))throw new F({input:e});return t}function ze(e,t){return z?new H(e,t):J(S.resolve(t,e))}function me(e){if(/^\[/.test(e.hostname)&&!/^\[[:0-9a-f]+\]$/i.test(e.hostname))throw new F({input:e.href||e});if(/^\[/.test(e.host)&&!/^\[[:0-9a-f]+\](:\d+)?$/i.test(e.host))throw new F({input:e.href||e});return e}function W(e,t){var r=t||{};for(var s of Fe)r[s]=e[s];return r.hostname.startsWith("[")&&(r.hostname=r.hostname.slice(1,-1)),r.port!==""&&(r.port=Number(r.port)),r.path=r.search?r.pathname+r.search:r.pathname,r}function I(e,t){var r;for(var s in t)e.test(s)&&(r=t[s],delete t[s]);return r===null||typeof r>"u"?void 0:String(r).trim()}function A(e,t,r){function s(o){x(Error.captureStackTrace)&&Error.captureStackTrace(this,this.constructor),Object.assign(this,o||{}),this.code=e,this.message=this.cause?t+": "+this.cause.message:t}return s.prototype=new(r||Error),Object.defineProperties(s.prototype,{constructor:{value:s,enumerable:!1},name:{value:"Error ["+e+"]",enumerable:!1}}),s}function Y(e,t){for(var r of K)e.removeListener(r,G[r]);e.on("error",ve),e.destroy(t)}function Ke(e,t){X(P(e)&&P(t));var r=e.length-t.length-1;return r>0&&e[r]==="."&&e.endsWith(t)}function P(e){return typeof e=="string"||e instanceof String}function x(e){return typeof e=="function"}function Ge(e){return typeof e=="object"&&"length"in e}function Je(e){return H&&e instanceof H}Q.exports=pe({http:ke,https:Ie});Q.exports.wrap=pe});var ye=g((Et,_e)=>{l();var Ye=w("http"),Qe=w("https"),q=he(),M=N(),Ze=we();q=Object.keys(q).map(function(e){return q[e]});var et={http:Ye,https:Qe};var tt=(function(){var e=process.versions.node.split(".").map(Number);return e[0]<=14||e[0]===15&&e[1]<=4})();_e.exports={deleteLength:function(t,r,s){(t.method==="DELETE"||t.method==="OPTIONS")&&!t.headers["content-length"]&&(t.headers["content-length"]="0",delete t.headers["transfer-encoding"])},timeout:function(t,r,s){s.timeout&&t.socket.setTimeout(s.timeout)},XHeaders:function(t,r,s){if(s.xfwd){var o=t.isSpdy||M.hasEncryptedConnection(t),n={for:t.connection.remoteAddress||t.socket.remoteAddress,port:M.getPort(t),proto:o?"https":"http"};["for","port","proto"].forEach(function(i){t.headers["x-forwarded-"+i]=(t.headers["x-forwarded-"+i]||"")+(t.headers["x-forwarded-"+i]?",":"")+n[i]}),t.headers["x-forwarded-host"]=t.headers["x-forwarded-host"]||t.headers.host||""}},stream:function(t,r,s,o,n,i){n.emit("start",t,r,s.target||s.forward);var c=s.followRedirects?Ze:et,a=c.http,h=c.https;if(s.forward){var u=(s.forward.protocol==="https:"?h:a).request(M.setupOutgoing(s.ssl||{},s,t,"forward")),f=R(u,s.forward);if(t.on("error",f),u.on("error",f),(s.buffer||t).pipe(u),!s.target)return r.end()}var d=(s.target.protocol==="https:"?h:a).request(M.setupOutgoing(s.ssl||{},s,t));d.on("socket",function(m){n&&!d.getHeader("expect")&&n.emit("proxyReq",d,t,r,s)}),s.proxyTimeout&&d.setTimeout(s.proxyTimeout,function(){d.abort()}),tt?t.on("aborted",function(){d.abort()}):r.on("close",function(){var m=!r.writableFinished;m&&d.abort()});var p=R(d,s.target);t.on("error",p),d.on("error",p);function R(m,b){return function(U){if(t.socket.destroyed&&U.code==="ECONNRESET")return n.emit("econnreset",U,t,r,b),m.abort();i?i(U,t,r,b):n.emit("error",U,t,r,b)}}(s.buffer||t).pipe(d),d.on("response",function(m){if(n&&n.emit("proxyRes",m,t,r),!r.headersSent&&!s.selfHandleResponse)for(var b=0;b<q.length&&!q[b](t,r,m,s);b++);r.finished?n&&n.emit("end",t,r,m):(m.on("end",function(){n&&n.emit("end",t,r,m)}),s.selfHandleResponse||m.pipe(r))})}}});var Ee=g((bt,ge)=>{l();var rt=w("http"),st=w("https"),O=N();ge.exports={checkMethodAndHeader:function(t,r){if(t.method!=="GET"||!t.headers.upgrade||t.headers.upgrade.toLowerCase()!=="websocket")return r.destroy(),!0},XHeaders:function(t,r,s){if(s.xfwd){var o={for:t.connection.remoteAddress||t.socket.remoteAddress,port:O.getPort(t),proto:O.hasEncryptedConnection(t)?"wss":"ws"};["for","port","proto"].forEach(function(n){t.headers["x-forwarded-"+n]=(t.headers["x-forwarded-"+n]||"")+(t.headers["x-forwarded-"+n]?",":"")+o[n]})}},stream:function(t,r,s,o,n,i){var c=function(u,f){return Object.keys(f).reduce(function(d,p){var R=f[p];if(!Array.isArray(R))return d.push(p+": "+R),d;for(var m=0;m<R.length;m++)d.push(p+": "+R[m]);return d},[u]).join(`\r
1
+ import{c as Ae}from"./chunk-FYQIRCLV.js";import{a as w,c as g,g as l}from"./chunk-VPRTJUIN.js";var re=g((ft,D)=>{"use strict";l();var qe=Object.prototype.hasOwnProperty,_="~";function C(){}Object.create&&(C.prototype=Object.create(null),new C().__proto__||(_=!1));function Be(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function te(e,t,r,s,o){if(typeof r!="function")throw new TypeError("The listener must be a function");var n=new Be(r,s||e,o),i=_?_+t:t;return e._events[i]?e._events[i].fn?e._events[i]=[e._events[i],n]:e._events[i].push(n):(e._events[i]=n,e._eventsCount++),e}function j(e,t){--e._eventsCount===0?e._events=new C:delete e._events[t]}function v(){this._events=new C,this._eventsCount=0}v.prototype.eventNames=function(){var t=[],r,s;if(this._eventsCount===0)return t;for(s in r=this._events)qe.call(r,s)&&t.push(_?s.slice(1):s);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(r)):t};v.prototype.listeners=function(t){var r=_?_+t:t,s=this._events[r];if(!s)return[];if(s.fn)return[s.fn];for(var o=0,n=s.length,i=new Array(n);o<n;o++)i[o]=s[o].fn;return i};v.prototype.listenerCount=function(t){var r=_?_+t:t,s=this._events[r];return s?s.fn?1:s.length:0};v.prototype.emit=function(t,r,s,o,n,i){var c=_?_+t:t;if(!this._events[c])return!1;var a=this._events[c],h=arguments.length,u,f;if(a.fn){switch(a.once&&this.removeListener(t,a.fn,void 0,!0),h){case 1:return a.fn.call(a.context),!0;case 2:return a.fn.call(a.context,r),!0;case 3:return a.fn.call(a.context,r,s),!0;case 4:return a.fn.call(a.context,r,s,o),!0;case 5:return a.fn.call(a.context,r,s,o,n),!0;case 6:return a.fn.call(a.context,r,s,o,n,i),!0}for(f=1,u=new Array(h-1);f<h;f++)u[f-1]=arguments[f];a.fn.apply(a.context,u)}else{var d=a.length,p;for(f=0;f<d;f++)switch(a[f].once&&this.removeListener(t,a[f].fn,void 0,!0),h){case 1:a[f].fn.call(a[f].context);break;case 2:a[f].fn.call(a[f].context,r);break;case 3:a[f].fn.call(a[f].context,r,s);break;case 4:a[f].fn.call(a[f].context,r,s,o);break;default:if(!u)for(p=1,u=new Array(h-1);p<h;p++)u[p-1]=arguments[p];a[f].fn.apply(a[f].context,u)}}return!0};v.prototype.on=function(t,r,s){return te(this,t,r,s,!1)};v.prototype.once=function(t,r,s){return te(this,t,r,s,!0)};v.prototype.removeListener=function(t,r,s,o){var n=_?_+t:t;if(!this._events[n])return this;if(!r)return j(this,n),this;var i=this._events[n];if(i.fn)i.fn===r&&(!o||i.once)&&(!s||i.context===s)&&j(this,n);else{for(var c=0,a=[],h=i.length;c<h;c++)(i[c].fn!==r||o&&!i[c].once||s&&i[c].context!==s)&&a.push(i[c]);a.length?this._events[n]=a.length===1?a[0]:a:j(this,n)}return this};v.prototype.removeAllListeners=function(t){var r;return t?(r=_?_+t:t,this._events[r]&&j(this,r)):(this._events=new C,this._eventsCount=0),this};v.prototype.off=v.prototype.removeListener;v.prototype.addListener=v.prototype.on;v.prefixed=_;v.EventEmitter=v;typeof D<"u"&&(D.exports=v)});var ne=g((ct,se)=>{"use strict";l();se.exports=function(t,r){if(r=r.split(":")[0],t=+t,!t)return!1;switch(r){case"http":case"ws":return t!==80;case"https":case"wss":return t!==443;case"ftp":return t!==21;case"gopher":return t!==70;case"file":return!1}return t!==0}});var N=g(oe=>{l();var E=oe,Ue=w("url"),ie=Object.assign,je=ne(),Ne=/(^|,)\s*upgrade\s*($|,)/i,k=/^https|wss/;E.isSSL=k;E.setupOutgoing=function(e,t,r,s){e.port=t[s||"target"].port||(k.test(t[s||"target"].protocol)?443:80),["host","hostname","socketPath","pfx","key","passphrase","cert","ca","ciphers","secureProtocol"].forEach(function(c){e[c]=t[s||"target"][c]}),e.method=t.method||r.method,e.headers=ie({},r.headers),t.headers&&ie(e.headers,t.headers),t.auth&&(e.auth=t.auth),t.ca&&(e.ca=t.ca),k.test(t[s||"target"].protocol)&&(e.rejectUnauthorized=typeof t.secure>"u"?!0:t.secure),e.agent=t.agent||!1,e.localAddress=t.localAddress,e.agent||(e.headers=e.headers||{},(typeof e.headers.connection!="string"||!Ne.test(e.headers.connection))&&(e.headers.connection="close"));var o=t[s||"target"],n=o&&t.prependPath!==!1&&o.path||"",i=t.toProxy?r.url:Ue.parse(r.url).path||"";return i=t.ignorePath?"":i,e.path=E.urlJoin(n,i),t.changeOrigin&&(e.headers.host=je(e.port,t[s||"target"].protocol)&&!Me(e.host)?e.host+":"+e.port:e.host),e};E.setupSocket=function(e){return e.setTimeout(0),e.setNoDelay(!0),e.setKeepAlive(!0,0),e};E.getPort=function(e){var t=e.headers.host?e.headers.host.match(/:(\d+)/):"";return t?t[1]:E.hasEncryptedConnection(e)?"443":"80"};E.hasEncryptedConnection=function(e){return!!(e.connection.encrypted||e.connection.pair)};E.urlJoin=function(){var e=Array.prototype.slice.call(arguments),t=[],r="",s;return e.forEach((o,n)=>{var i=o.indexOf("?");i!==-1&&(t.push(o.substring(i+1)),e[n]=o.substring(0,i))}),r=t.filter(Boolean).join("&"),s=e.filter(Boolean).join("/").replace(/\/+/g,"/").replace("http:/","http://").replace("https:/","https://"),r?s+"?"+r:s};E.rewriteCookieProperty=function e(t,r,s){return Array.isArray(t)?t.map(function(o){return e(o,r,s)}):t.replace(new RegExp("(;\\s*"+s+"=)([^;]+)","i"),function(o,n,i){var c;if(i in r)c=r[i];else if("*"in r)c=r["*"];else return o;return c?n+c:""})};function Me(e){return!!~e.indexOf(":")}});var he=g((vt,fe)=>{l();var ae=w("url"),ue=N(),De=/^201|30(1|2|7|8)$/;fe.exports={removeChunked:function(t,r,s){t.httpVersion==="1.0"&&delete s.headers["transfer-encoding"]},setConnection:function(t,r,s){t.httpVersion==="1.0"?s.headers.connection=t.headers.connection||"close":t.httpVersion!=="2.0"&&!s.headers.connection&&(s.headers.connection=t.headers.connection||"keep-alive")},setRedirectHostRewrite:function(t,r,s,o){if((o.hostRewrite||o.autoRewrite||o.protocolRewrite)&&s.headers.location&&De.test(s.statusCode)){var n=ae.parse(o.target),i=ae.parse(s.headers.location);if(n.host!=i.host)return;o.hostRewrite?i.host=o.hostRewrite:o.autoRewrite&&(i.host=t.headers.host),o.protocolRewrite&&(i.protocol=o.protocolRewrite),s.headers.location=i.format()}},writeHeaders:function(t,r,s,o){var n=o.cookieDomainRewrite,i=o.cookiePathRewrite,c=o.preserveHeaderKeyCase,a,h=function(d,p){p!=null&&(n&&d.toLowerCase()==="set-cookie"&&(p=ue.rewriteCookieProperty(p,n,"domain")),i&&d.toLowerCase()==="set-cookie"&&(p=ue.rewriteCookieProperty(p,i,"path")),r.setHeader(String(d).trim(),p))};if(typeof n=="string"&&(n={"*":n}),typeof i=="string"&&(i={"*":i}),c&&s.rawHeaders!=null){a={};for(var u=0;u<s.rawHeaders.length;u+=2){var f=s.rawHeaders[u];a[f.toLowerCase()]=f}}Object.keys(s.headers).forEach(function(d){var p=s.headers[d];c&&a&&(d=a[d]||d),h(d,p)})},writeStatusCode:function(t,r,s){s.statusMessage?(r.statusCode=s.statusCode,r.statusMessage=s.statusMessage):r.statusCode=s.statusCode}}});var de=g((wt,ce)=>{l();var T;ce.exports=function(){if(!T){try{T=Ae()("follow-redirects")}catch{}typeof T!="function"&&(T=function(){})}T.apply(null,arguments)}});var we=g((yt,Q)=>{l();var S=w("url"),H=S.URL,ke=w("http"),Ie=w("https"),$=w("stream").Writable,X=w("assert"),le=de();(function(){var t=typeof process<"u",r=typeof window<"u"&&typeof document<"u",s=x(Error.captureStackTrace);!t&&(r||!s)&&console.warn("The follow-redirects package should be excluded from browser builds.")})();var z=!1;try{X(new H(""))}catch(e){z=e.code==="ERR_INVALID_URL"}var Fe=["auth","host","hostname","href","path","pathname","port","protocol","query","search","hash"],K=["abort","aborted","connect","error","socket","timeout"],G=Object.create(null);K.forEach(function(e){G[e]=function(t,r,s){this._redirectable.emit(e,t,r,s)}});var F=A("ERR_INVALID_URL","Invalid URL",TypeError),V=A("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),Ve=A("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded",V),We=A("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),$e=A("ERR_STREAM_WRITE_AFTER_END","write after end"),Xe=$.prototype.destroy||ve;function y(e,t){$.call(this),this._sanitizeOptions(e),this._options=e,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],t&&this.on("response",t);var r=this;this._onNativeResponse=function(s){try{r._processResponse(s)}catch(o){r.emit("error",o instanceof V?o:new V({cause:o}))}},this._performRequest()}y.prototype=Object.create($.prototype);y.prototype.abort=function(){Y(this._currentRequest),this._currentRequest.abort(),this.emit("abort")};y.prototype.destroy=function(e){return Y(this._currentRequest,e),Xe.call(this,e),this};y.prototype.write=function(e,t,r){if(this._ending)throw new $e;if(!P(e)&&!Ge(e))throw new TypeError("data should be a string, Buffer or Uint8Array");if(x(t)&&(r=t,t=null),e.length===0){r&&r();return}this._requestBodyLength+e.length<=this._options.maxBodyLength?(this._requestBodyLength+=e.length,this._requestBodyBuffers.push({data:e,encoding:t}),this._currentRequest.write(e,t,r)):(this.emit("error",new We),this.abort())};y.prototype.end=function(e,t,r){if(x(e)?(r=e,e=t=null):x(t)&&(r=t,t=null),!e)this._ended=this._ending=!0,this._currentRequest.end(null,null,r);else{var s=this,o=this._currentRequest;this.write(e,t,function(){s._ended=!0,o.end(null,null,r)}),this._ending=!0}};y.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)};y.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)};y.prototype.setTimeout=function(e,t){var r=this;function s(i){i.setTimeout(e),i.removeListener("timeout",i.destroy),i.addListener("timeout",i.destroy)}function o(i){r._timeout&&clearTimeout(r._timeout),r._timeout=setTimeout(function(){r.emit("timeout"),n()},e),s(i)}function n(){r._timeout&&(clearTimeout(r._timeout),r._timeout=null),r.removeListener("abort",n),r.removeListener("error",n),r.removeListener("response",n),r.removeListener("close",n),t&&r.removeListener("timeout",t),r.socket||r._currentRequest.removeListener("socket",o)}return t&&this.on("timeout",t),this.socket?o(this.socket):this._currentRequest.once("socket",o),this.on("socket",s),this.on("abort",n),this.on("error",n),this.on("response",n),this.on("close",n),this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(e){y.prototype[e]=function(t,r){return this._currentRequest[e](t,r)}});["aborted","connection","socket"].forEach(function(e){Object.defineProperty(y.prototype,e,{get:function(){return this._currentRequest[e]}})});y.prototype._sanitizeOptions=function(e){if(e.headers||(e.headers={}),e.host&&(e.hostname||(e.hostname=e.host),delete e.host),!e.pathname&&e.path){var t=e.path.indexOf("?");t<0?e.pathname=e.path:(e.pathname=e.path.substring(0,t),e.search=e.path.substring(t))}};y.prototype._performRequest=function(){var e=this._options.protocol,t=this._options.nativeProtocols[e];if(!t)throw new TypeError("Unsupported protocol "+e);if(this._options.agents){var r=e.slice(0,-1);this._options.agent=this._options.agents[r]}var s=this._currentRequest=t.request(this._options,this._onNativeResponse);s._redirectable=this;for(var o of K)s.on(o,G[o]);if(this._currentUrl=/^\//.test(this._options.path)?S.format(this._options):this._options.path,this._isRedirect){var n=0,i=this,c=this._requestBodyBuffers;(function a(h){if(s===i._currentRequest)if(h)i.emit("error",h);else if(n<c.length){var u=c[n++];s.finished||s.write(u.data,u.encoding,a)}else i._ended&&s.end()})()}};y.prototype._processResponse=function(e){var t=e.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:t});var r=e.headers.location;if(!r||this._options.followRedirects===!1||t<300||t>=400){e.responseUrl=this._currentUrl,e.redirects=this._redirects,this.emit("response",e),this._requestBodyBuffers=[];return}if(Y(this._currentRequest),e.destroy(),++this._redirectCount>this._options.maxRedirects)throw new Ve;var s,o=this._options.beforeRedirect;o&&(s=Object.assign({Host:e.req.getHeader("host")},this._options.headers));var n=this._options.method;((t===301||t===302)&&this._options.method==="POST"||t===303&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],I(/^content-/i,this._options.headers));var i=I(/^host$/i,this._options.headers),c=J(this._currentUrl),a=i||c.host,h=/^\w+:/.test(r)?this._currentUrl:S.format(Object.assign(c,{host:a})),u=ze(r,h);if(le("redirecting to",u.href),this._isRedirect=!0,W(u,this._options),(u.protocol!==c.protocol&&u.protocol!=="https:"||u.host!==a&&!Ke(u.host,a))&&I(/^(?:(?:proxy-)?authorization|cookie)$/i,this._options.headers),x(o)){var f={headers:e.headers,statusCode:t},d={url:h,method:n,headers:s};o(this._options,f,d),this._sanitizeOptions(this._options)}this._performRequest()};function pe(e){var t={maxRedirects:21,maxBodyLength:10485760},r={};return Object.keys(e).forEach(function(s){var o=s+":",n=r[o]=e[s],i=t[s]=Object.create(n);function c(h,u,f){return Je(h)?h=W(h):P(h)?h=W(J(h)):(f=u,u=me(h),h={protocol:o}),x(u)&&(f=u,u=null),u=Object.assign({maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},h,u),u.nativeProtocols=r,!P(u.host)&&!P(u.hostname)&&(u.hostname="::1"),X.equal(u.protocol,o,"protocol mismatch"),le("options",u),new y(u,f)}function a(h,u,f){var d=i.request(h,u,f);return d.end(),d}Object.defineProperties(i,{request:{value:c,configurable:!0,enumerable:!0,writable:!0},get:{value:a,configurable:!0,enumerable:!0,writable:!0}})}),t}function ve(){}function J(e){var t;if(z)t=new H(e);else if(t=me(S.parse(e)),!P(t.protocol))throw new F({input:e});return t}function ze(e,t){return z?new H(e,t):J(S.resolve(t,e))}function me(e){if(/^\[/.test(e.hostname)&&!/^\[[:0-9a-f]+\]$/i.test(e.hostname))throw new F({input:e.href||e});if(/^\[/.test(e.host)&&!/^\[[:0-9a-f]+\](:\d+)?$/i.test(e.host))throw new F({input:e.href||e});return e}function W(e,t){var r=t||{};for(var s of Fe)r[s]=e[s];return r.hostname.startsWith("[")&&(r.hostname=r.hostname.slice(1,-1)),r.port!==""&&(r.port=Number(r.port)),r.path=r.search?r.pathname+r.search:r.pathname,r}function I(e,t){var r;for(var s in t)e.test(s)&&(r=t[s],delete t[s]);return r===null||typeof r>"u"?void 0:String(r).trim()}function A(e,t,r){function s(o){x(Error.captureStackTrace)&&Error.captureStackTrace(this,this.constructor),Object.assign(this,o||{}),this.code=e,this.message=this.cause?t+": "+this.cause.message:t}return s.prototype=new(r||Error),Object.defineProperties(s.prototype,{constructor:{value:s,enumerable:!1},name:{value:"Error ["+e+"]",enumerable:!1}}),s}function Y(e,t){for(var r of K)e.removeListener(r,G[r]);e.on("error",ve),e.destroy(t)}function Ke(e,t){X(P(e)&&P(t));var r=e.length-t.length-1;return r>0&&e[r]==="."&&e.endsWith(t)}function P(e){return typeof e=="string"||e instanceof String}function x(e){return typeof e=="function"}function Ge(e){return typeof e=="object"&&"length"in e}function Je(e){return H&&e instanceof H}Q.exports=pe({http:ke,https:Ie});Q.exports.wrap=pe});var ye=g((Et,_e)=>{l();var Ye=w("http"),Qe=w("https"),q=he(),M=N(),Ze=we();q=Object.keys(q).map(function(e){return q[e]});var et={http:Ye,https:Qe};var tt=(function(){var e=process.versions.node.split(".").map(Number);return e[0]<=14||e[0]===15&&e[1]<=4})();_e.exports={deleteLength:function(t,r,s){(t.method==="DELETE"||t.method==="OPTIONS")&&!t.headers["content-length"]&&(t.headers["content-length"]="0",delete t.headers["transfer-encoding"])},timeout:function(t,r,s){s.timeout&&t.socket.setTimeout(s.timeout)},XHeaders:function(t,r,s){if(s.xfwd){var o=t.isSpdy||M.hasEncryptedConnection(t),n={for:t.connection.remoteAddress||t.socket.remoteAddress,port:M.getPort(t),proto:o?"https":"http"};["for","port","proto"].forEach(function(i){t.headers["x-forwarded-"+i]=(t.headers["x-forwarded-"+i]||"")+(t.headers["x-forwarded-"+i]?",":"")+n[i]}),t.headers["x-forwarded-host"]=t.headers["x-forwarded-host"]||t.headers.host||""}},stream:function(t,r,s,o,n,i){n.emit("start",t,r,s.target||s.forward);var c=s.followRedirects?Ze:et,a=c.http,h=c.https;if(s.forward){var u=(s.forward.protocol==="https:"?h:a).request(M.setupOutgoing(s.ssl||{},s,t,"forward")),f=R(u,s.forward);if(t.on("error",f),u.on("error",f),(s.buffer||t).pipe(u),!s.target)return r.end()}var d=(s.target.protocol==="https:"?h:a).request(M.setupOutgoing(s.ssl||{},s,t));d.on("socket",function(m){n&&!d.getHeader("expect")&&n.emit("proxyReq",d,t,r,s)}),s.proxyTimeout&&d.setTimeout(s.proxyTimeout,function(){d.abort()}),tt?t.on("aborted",function(){d.abort()}):r.on("close",function(){var m=!r.writableFinished;m&&d.abort()});var p=R(d,s.target);t.on("error",p),d.on("error",p);function R(m,b){return function(U){if(t.socket.destroyed&&U.code==="ECONNRESET")return n.emit("econnreset",U,t,r,b),m.abort();i?i(U,t,r,b):n.emit("error",U,t,r,b)}}(s.buffer||t).pipe(d),d.on("response",function(m){if(n&&n.emit("proxyRes",m,t,r),!r.headersSent&&!s.selfHandleResponse)for(var b=0;b<q.length&&!q[b](t,r,m,s);b++);r.finished?n&&n.emit("end",t,r,m):(m.on("end",function(){n&&n.emit("end",t,r,m)}),s.selfHandleResponse||m.pipe(r))})}}});var Ee=g((bt,ge)=>{l();var rt=w("http"),st=w("https"),O=N();ge.exports={checkMethodAndHeader:function(t,r){if(t.method!=="GET"||!t.headers.upgrade||t.headers.upgrade.toLowerCase()!=="websocket")return r.destroy(),!0},XHeaders:function(t,r,s){if(s.xfwd){var o={for:t.connection.remoteAddress||t.socket.remoteAddress,port:O.getPort(t),proto:O.hasEncryptedConnection(t)?"wss":"ws"};["for","port","proto"].forEach(function(n){t.headers["x-forwarded-"+n]=(t.headers["x-forwarded-"+n]||"")+(t.headers["x-forwarded-"+n]?",":"")+o[n]})}},stream:function(t,r,s,o,n,i){var c=function(u,f){return Object.keys(f).reduce(function(d,p){var R=f[p];if(!Array.isArray(R))return d.push(p+": "+R),d;for(var m=0;m<R.length;m++)d.push(p+": "+R[m]);return d},[u]).join(`\r
2
2
  `)+`\r
3
3
  \r
4
4
  `};O.setupSocket(r),o&&o.length&&r.unshift(o);var a=(O.isSSL.test(s.target.protocol)?st:rt).request(O.setupOutgoing(s.ssl||{},s,t));return n&&n.emit("proxyReqWs",a,t,r,s,o),a.on("error",h),a.on("response",function(u){u.upgrade||(r.write(c("HTTP/"+u.httpVersion+" "+u.statusCode+" "+u.statusMessage,u.headers)),u.pipe(r))}),a.on("upgrade",function(u,f,d){f.on("error",h),f.on("end",function(){n.emit("close",u,f,d)}),r.on("error",function(){f.destroy()}),O.setupSocket(f),d&&d.length&&f.unshift(d),r.write(c("HTTP/1.1 101 Switching Protocols",u.headers)),f.pipe(r).pipe(f),n.emit("open",f),n.emit("proxySocket",f)}),a.end();function h(u){i?i(u,t,r):n.emit("error",u,t,r),r.end()}}}});var Ce=g((xt,Oe)=>{l();var xe=Oe.exports,Re=Object.assign,nt=w("url").parse,Le=re(),it=w("http"),ot=w("https"),be=ye(),Pe=Ee();xe.Server=L;function Z(e){return function(t){return function(r,s){var o=e==="ws"?this.wsPasses:this.webPasses,n=[].slice.call(arguments),i=n.length-1,c,a;typeof n[i]=="function"&&(a=n[i],i--);var h=t;if(!(n[i]instanceof Buffer)&&n[i]!==s&&(h=Re({},t),Re(h,n[i]),i--),n[i]instanceof Buffer&&(c=n[i]),["target","forward"].forEach(function(f){typeof h[f]=="string"&&(h[f]=nt(h[f]))}),!h.target&&!h.forward)return this.emit("error",new Error("Must provide a proper URL as target"));for(var u=0;u<o.length&&!o[u](r,s,h,c,this,a);u++);}}}xe.createRightProxy=Z;function L(e){Le.call(this),e=e||{},e.prependPath=e.prependPath!==!1,this.web=this.proxyRequest=Z("web")(e),this.ws=this.proxyWebsocketRequest=Z("ws")(e),this.options=e,this.webPasses=Object.keys(be).map(function(t){return be[t]}),this.wsPasses=Object.keys(Pe).map(function(t){return Pe[t]}),this.on("error",this.onError,this)}w("util").inherits(L,Le);L.prototype.onError=function(e){if(this.listeners("error").length===1)throw e};L.prototype.listen=function(e,t){var r=this,s=function(o,n){r.web(o,n)};return this._server=this.options.ssl?ot.createServer(this.options.ssl,s):it.createServer(s),this.options.ws&&this._server.on("upgrade",function(o,n,i){r.ws(o,n,i)}),this._server.listen(e,t),this};L.prototype.close=function(e){var t=this;this._server&&this._server.close(r);function r(){t._server=null,e&&e.apply(null,arguments)}};L.prototype.before=function(e,t,r){if(e!=="ws"&&e!=="web")throw new Error("type must be `web` or `ws`");var s=e==="ws"?this.wsPasses:this.webPasses,o=!1;if(s.forEach(function(n,i){n.name===t&&(o=i)}),o===!1)throw new Error("No such pass");s.splice(o,0,r)};L.prototype.after=function(e,t,r){if(e!=="ws"&&e!=="web")throw new Error("type must be `web` or `ws`");var s=e==="ws"?this.wsPasses:this.webPasses,o=!1;if(s.forEach(function(n,i){n.name===t&&(o=i)}),o===!1)throw new Error("No such pass");s.splice(o++,0,r)}});var He=g((Ot,Te)=>{l();var B=Ce().Server;function ee(e){return new B(e)}B.createProxyServer=ee;B.createServer=ee;B.createProxy=ee;Te.exports=B});var at=g((Tt,Se)=>{l();Se.exports=He()});export default at();