@membranehq/sdk 0.28.3 → 0.29.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.
Files changed (88) hide show
  1. package/dist/bundle.d.ts +140 -4
  2. package/dist/bundle.js +1917 -1394
  3. package/dist/bundle.js.map +1 -1
  4. package/dist/dts/accessors/connection-events-listener.d.ts +14 -0
  5. package/dist/dts/accessors/connection-events-listener.test.d.ts +1 -0
  6. package/dist/dts/accessors/connections-accessors.d.ts +9 -1
  7. package/dist/dts/accessors/integrations-accessors.d.ts +3 -0
  8. package/dist/dts/agent/harness-snapshot.d.ts +65 -0
  9. package/dist/dts/agent/harness.d.ts +107 -0
  10. package/dist/dts/agent/index.d.ts +6 -0
  11. package/dist/dts/agent/instruction.d.ts +32 -0
  12. package/dist/dts/agent/session.d.ts +6 -2
  13. package/dist/dts/agent/skill.d.ts +50 -0
  14. package/dist/dts/agent/tool.d.ts +8 -0
  15. package/dist/dts/agent/worker-contracts.d.ts +4 -1
  16. package/dist/dts/agent/workspace-element-context.d.ts +3 -0
  17. package/dist/dts/ai-gateway/models.d.ts +4 -0
  18. package/dist/dts/async-requests/types.d.ts +50 -0
  19. package/dist/dts/data-schema/types.d.ts +1 -1
  20. package/dist/dts/deprecation.d.ts +1 -0
  21. package/dist/dts/errors/index.d.ts +5 -1
  22. package/dist/dts/index.browser.d.ts +3 -1
  23. package/dist/dts/mcp-client/index.d.ts +76 -0
  24. package/dist/dts/oauth/types.d.ts +14 -5
  25. package/dist/dts/orgs/types.d.ts +1183 -33
  26. package/dist/dts/orgs/types.test.d.ts +1 -0
  27. package/dist/dts/platform-user-tokens/types.d.ts +42 -0
  28. package/dist/dts/scenario-templates/index.d.ts +1 -0
  29. package/dist/dts/workspace-elements/api/action-run-log-records-api.d.ts +50 -72
  30. package/dist/dts/workspace-elements/api/checkpoints-api.d.ts +1 -1
  31. package/dist/dts/workspace-elements/api/connections-api.d.ts +71 -1
  32. package/dist/dts/workspace-elements/api/connectors-api.d.ts +10 -0
  33. package/dist/dts/workspace-elements/api/data-link-table-instances-api.d.ts +10 -0
  34. package/dist/dts/workspace-elements/api/data-sources-api.d.ts +20 -0
  35. package/dist/dts/workspace-elements/api/external-api-logs-api.d.ts +10 -0
  36. package/dist/dts/workspace-elements/api/external-apps-api.d.ts +28 -0
  37. package/dist/dts/workspace-elements/api/external-event-log-records-api.d.ts +14 -0
  38. package/dist/dts/workspace-elements/api/external-event-pulls-api.d.ts +13 -0
  39. package/dist/dts/workspace-elements/api/external-event-subscriptions-api.d.ts +22 -0
  40. package/dist/dts/workspace-elements/api/external-event-types-api.d.ts +331 -0
  41. package/dist/dts/workspace-elements/api/field-mappings-api.d.ts +20 -0
  42. package/dist/dts/workspace-elements/api/flow-runs-api.d.ts +20 -0
  43. package/dist/dts/workspace-elements/api/flows-api.d.ts +20 -0
  44. package/dist/dts/workspace-elements/api/incoming-webhooks-api.d.ts +13 -0
  45. package/dist/dts/workspace-elements/api/index.d.ts +1 -0
  46. package/dist/dts/workspace-elements/api/integrations-api.d.ts +32 -7
  47. package/dist/dts/workspace-elements/base/action-run-log-records/index.d.ts +19 -0
  48. package/dist/dts/workspace-elements/base/actions/action-payload.d.ts +46 -0
  49. package/dist/dts/workspace-elements/base/actions/action-payload.test.d.ts +1 -0
  50. package/dist/dts/workspace-elements/base/actions/index.d.ts +3 -2
  51. package/dist/dts/workspace-elements/base/app-data-schemas/index.d.ts +2 -2
  52. package/dist/dts/workspace-elements/base/app-event-types/index.d.ts +2 -2
  53. package/dist/dts/workspace-elements/base/connection-requests/index.d.ts +6 -0
  54. package/dist/dts/workspace-elements/base/connections/index.d.ts +25 -0
  55. package/dist/dts/workspace-elements/base/connectors/auth.d.ts +6 -0
  56. package/dist/dts/workspace-elements/base/connectors/index.d.ts +213 -5
  57. package/dist/dts/workspace-elements/base/connectors/rest-api.d.ts +1 -0
  58. package/dist/dts/workspace-elements/base/data-link-tables/index.d.ts +2 -2
  59. package/dist/dts/workspace-elements/base/data-sources/index.d.ts +2 -2
  60. package/dist/dts/workspace-elements/base/external-event-log-records/index.d.ts +1 -0
  61. package/dist/dts/workspace-elements/base/external-event-pulls/index.d.ts +50 -0
  62. package/dist/dts/workspace-elements/base/external-event-subscriptions/index.d.ts +2 -0
  63. package/dist/dts/workspace-elements/base/external-event-types/index.d.ts +190 -0
  64. package/dist/dts/workspace-elements/base/field-mappings/index.d.ts +2 -2
  65. package/dist/dts/workspace-elements/base/flows/index.d.ts +2 -2
  66. package/dist/dts/workspace-elements/base/index.d.ts +1 -0
  67. package/dist/dts/workspace-elements/base/integrations/index.d.ts +2 -2
  68. package/dist/dts/workspace-elements/base/packages/index.d.ts +2 -2
  69. package/dist/dts/workspace-elements/paths.d.ts +1 -0
  70. package/dist/dts/workspace-elements/types.d.ts +15 -3
  71. package/dist/dts/workspace-tokens/index.d.ts +1 -0
  72. package/dist/dts/{client-tokens → workspace-tokens}/types.d.ts +35 -22
  73. package/dist/dts/workspaces/api.d.ts +0 -6
  74. package/dist/dts/workspaces/compare.d.ts +4 -1
  75. package/dist/index.browser.d.mts +3654 -858
  76. package/dist/index.browser.d.ts +3654 -858
  77. package/dist/index.browser.js +1105 -213
  78. package/dist/index.browser.js.map +1 -1
  79. package/dist/index.browser.mjs +1032 -207
  80. package/dist/index.browser.mjs.map +1 -1
  81. package/dist/index.node.d.mts +3654 -858
  82. package/dist/index.node.d.ts +3654 -858
  83. package/dist/index.node.js +1105 -213
  84. package/dist/index.node.js.map +1 -1
  85. package/dist/index.node.mjs +1032 -207
  86. package/dist/index.node.mjs.map +1 -1
  87. package/package.json +3 -3
  88. /package/dist/dts/{client-tokens → platform-user-tokens}/index.d.ts +0 -0
package/dist/bundle.js CHANGED
@@ -3635,9 +3635,8 @@
3635
3635
  }
3636
3636
  },
3637
3637
  'delete': function (key) {
3638
- var root = $o && $o.next;
3639
3638
  var deletedNode = listDelete($o, key);
3640
- if (deletedNode && root && root === deletedNode) {
3639
+ if (deletedNode && $o && !$o.next) {
3641
3640
  $o = void undefined;
3642
3641
  }
3643
3642
  return !!deletedNode;
@@ -3659,7 +3658,6 @@
3659
3658
  listSet(/** @type {NonNullable<typeof $o>} */ ($o), key, value);
3660
3659
  }
3661
3660
  };
3662
- // @ts-expect-error TODO: figure out why this is erroring
3663
3661
  return channel;
3664
3662
  };
3665
3663
  return sideChannelList;
@@ -5734,10 +5732,10 @@
5734
5732
  var limit = options.parameterLimit === Infinity ? void undefined : options.parameterLimit;
5735
5733
  var parts = cleanStr.split(
5736
5734
  options.delimiter,
5737
- options.throwOnLimitExceeded ? limit + 1 : limit
5735
+ options.throwOnLimitExceeded && typeof limit !== 'undefined' ? limit + 1 : limit
5738
5736
  );
5739
5737
 
5740
- if (options.throwOnLimitExceeded && parts.length > limit) {
5738
+ if (options.throwOnLimitExceeded && typeof limit !== 'undefined' && parts.length > limit) {
5741
5739
  throw new RangeError('Parameter limit exceeded. Only ' + limit + ' parameter' + (limit === 1 ? '' : 's') + ' allowed.');
5742
5740
  }
5743
5741
 
@@ -20563,6 +20561,14 @@
20563
20561
  }
20564
20562
  }
20565
20563
 
20564
+ const warned = new Set();
20565
+ function warnDeprecatedOnce(key, message) {
20566
+ if (warned.has(key))
20567
+ return;
20568
+ warned.add(key);
20569
+ console.warn(`[Membrane deprecation] ${message}`);
20570
+ }
20571
+
20566
20572
  class ConnectionLevelElementAccessor {
20567
20573
  constructor(client, connectionSelector, selector, elementKey, query) {
20568
20574
  this.client = client;
@@ -20671,6 +20677,7 @@
20671
20677
  return await this.options.client.post(this.getPath('reset'));
20672
20678
  }
20673
20679
  async run(input, options) {
20680
+ warnDeprecatedOnce('ActionAccessor.run', 'ActionAccessor.run() is deprecated. Use POST /act with { action: { id } } or { integrationKey, key } instead.');
20674
20681
  const queryParams = options
20675
20682
  ? {
20676
20683
  integrationKey: options.integrationKey,
@@ -20705,6 +20712,7 @@
20705
20712
  this.query = query;
20706
20713
  }
20707
20714
  async run(input) {
20715
+ warnDeprecatedOnce('ConnectionLevelActionAccessor.run', 'ConnectionLevelActionAccessor.run() is deprecated. Use POST /act with { action: { id } } or { integrationKey, key } instead.');
20708
20716
  return this.client.post(this.uri('/run'), input);
20709
20717
  }
20710
20718
  }
@@ -20847,159 +20855,6 @@
20847
20855
  .substring(0, 11);
20848
20856
  };
20849
20857
 
20850
- var ErrorType;
20851
- (function (ErrorType) {
20852
- ErrorType["BAD_REQUEST"] = "bad_request";
20853
- ErrorType["CONNECTION"] = "connection";
20854
- ErrorType["CONFIGURATION"] = "configuration";
20855
- ErrorType["DEPENDENCY_ERROR"] = "dependency_error";
20856
- ErrorType["FLOW_RUN"] = "flow_run";
20857
- ErrorType["FLOW_INSTANCE_SETUP"] = "flow_instance_setup";
20858
- ErrorType["CONCURRENCY"] = "concurrency";
20859
- ErrorType["INTERNAL"] = "internal";
20860
- ErrorType["ACTION_RUN"] = "action_run";
20861
- ErrorType["ACTION_INSTANCE_SETUP"] = "action_instance_setup";
20862
- ErrorType["UNIT_RUN"] = "unit_run";
20863
- ErrorType["CUSTOM_CODE"] = "custom_code";
20864
- ErrorType["INSUFFICIENT_CREDIT"] = "insufficient_credit";
20865
- ErrorType["OPENROUTER_NOT_CONFIGURED"] = "openrouter_not_configured";
20866
- })(ErrorType || (ErrorType = {}));
20867
- var BadRequestErrorKey;
20868
- (function (BadRequestErrorKey) {
20869
- BadRequestErrorKey["NOT_FOUND"] = "not_found";
20870
- BadRequestErrorKey["NOT_AUTHENTICATED"] = "not_authenticated";
20871
- BadRequestErrorKey["ACCESS_DENIED"] = "access_denied";
20872
- BadRequestErrorKey["ALREADY_EXISTS"] = "already_exists";
20873
- BadRequestErrorKey["RATE_LIMIT_EXCEEDED"] = "rate_limit_exceeded";
20874
- })(BadRequestErrorKey || (BadRequestErrorKey = {}));
20875
- var ConnectionErrorKey;
20876
- (function (ConnectionErrorKey) {
20877
- ConnectionErrorKey["CONNECTION_IS_DEFUNCT"] = "connection_is_defunct";
20878
- ConnectionErrorKey["ACCESS_TOKEN_EXPIRED"] = "access_token_expired";
20879
- ConnectionErrorKey["RATE_LIMIT_EXCEEDED"] = "rate_limit_exceeded";
20880
- })(ConnectionErrorKey || (ConnectionErrorKey = {}));
20881
- var ConcurrencyErrorKey;
20882
- (function (ConcurrencyErrorKey) {
20883
- ConcurrencyErrorKey["LOCK_TIMEOUT"] = "lock_timeout";
20884
- })(ConcurrencyErrorKey || (ConcurrencyErrorKey = {}));
20885
- const ErrorDataSchema = lazy(() => object({
20886
- type: _enum(ErrorType).optional(),
20887
- key: string$1().optional(),
20888
- message: string$1(),
20889
- data: any().optional(),
20890
- stack: any().optional(),
20891
- causedByError: lazy(() => ErrorDataSchema).optional(),
20892
- logs: array(any()).optional(),
20893
- }));
20894
- class ErrorData {
20895
- constructor(arg) {
20896
- if (arg instanceof Error) {
20897
- this.message = arg.message;
20898
- this.stack = arg.stack;
20899
- this.type = ErrorType.INTERNAL;
20900
- }
20901
- else if (typeof arg === 'string') {
20902
- this.message = arg;
20903
- this.type = ErrorType.INTERNAL;
20904
- }
20905
- else if (typeof arg === 'object' && arg !== null) {
20906
- Object.assign(this, arg);
20907
- }
20908
- else {
20909
- throw new Error('Invalid argument when creating BaseErrorData: ' + JSON.stringify(arg));
20910
- }
20911
- }
20912
- }
20913
- class MembraneError extends Error {
20914
- constructor(arg) {
20915
- const errorData = new ErrorData(arg);
20916
- super(errorData.message);
20917
- this.isMembraneError = true;
20918
- this.data = errorData;
20919
- if (!this.data.type) {
20920
- this.data.type = ErrorType.INTERNAL;
20921
- }
20922
- }
20923
- }
20924
- class InternalError extends MembraneError {
20925
- constructor(arg) {
20926
- super(arg);
20927
- this.data.type = ErrorType.INTERNAL;
20928
- }
20929
- }
20930
- class BadRequestError extends MembraneError {
20931
- constructor(arg) {
20932
- super(arg);
20933
- this.data.type = ErrorType.BAD_REQUEST;
20934
- }
20935
- }
20936
- class ConcurrencyError extends MembraneError {
20937
- constructor(arg) {
20938
- super(arg);
20939
- this.data.type = ErrorType.CONCURRENCY;
20940
- }
20941
- }
20942
- class ConfigurationError extends MembraneError {
20943
- constructor(arg) {
20944
- super(arg);
20945
- this.data.type = ErrorType.CONFIGURATION;
20946
- }
20947
- }
20948
- class FlowInstanceSetupError extends MembraneError {
20949
- constructor(arg) {
20950
- super(arg);
20951
- this.data.type = ErrorType.FLOW_INSTANCE_SETUP;
20952
- }
20953
- }
20954
- class FlowRunError extends MembraneError {
20955
- constructor(arg) {
20956
- super(arg);
20957
- this.data.type = ErrorType.FLOW_RUN;
20958
- }
20959
- }
20960
- class ActionRunError extends MembraneError {
20961
- constructor(arg) {
20962
- super(arg);
20963
- this.data.type = ErrorType.ACTION_RUN;
20964
- }
20965
- }
20966
- class ActionInstanceSetupError extends MembraneError {
20967
- constructor(arg) {
20968
- super(arg);
20969
- this.data.type = ErrorType.ACTION_INSTANCE_SETUP;
20970
- }
20971
- }
20972
- class UnitRunError extends MembraneError {
20973
- constructor(arg) {
20974
- super(arg);
20975
- this.data.type = ErrorType.UNIT_RUN;
20976
- }
20977
- }
20978
- class ConnectionError extends MembraneError {
20979
- constructor(arg) {
20980
- super(arg);
20981
- this.data.type = ErrorType.CONNECTION;
20982
- }
20983
- }
20984
- class CustomCodeError extends MembraneError {
20985
- constructor(arg) {
20986
- super(arg);
20987
- this.data.type = ErrorType.CUSTOM_CODE;
20988
- }
20989
- }
20990
- class InsufficientCreditsError extends MembraneError {
20991
- constructor(arg) {
20992
- super(arg);
20993
- this.data.type = ErrorType.INSUFFICIENT_CREDIT;
20994
- }
20995
- }
20996
- class OpenRouterNotConfiguredError extends MembraneError {
20997
- constructor(arg) {
20998
- super(arg);
20999
- this.data.type = ErrorType.OPENROUTER_NOT_CONFIGURED;
21000
- }
21001
- }
21002
-
21003
20858
  var MessageType;
21004
20859
  (function (MessageType) {
21005
20860
  MessageType["Call"] = "call";
@@ -21988,33 +21843,245 @@
21988
21843
  });
21989
21844
  }
21990
21845
 
21991
- class DataSourcesAccessor extends ElementListAccessor {
21992
- constructor(client) {
21993
- super(client, 'data-sources');
21846
+ var ErrorType;
21847
+ (function (ErrorType) {
21848
+ ErrorType["BAD_REQUEST"] = "bad_request";
21849
+ ErrorType["CONNECTION"] = "connection";
21850
+ ErrorType["CONFIGURATION"] = "configuration";
21851
+ ErrorType["DEPENDENCY_ERROR"] = "dependency_error";
21852
+ ErrorType["FLOW_RUN"] = "flow_run";
21853
+ ErrorType["FLOW_INSTANCE_SETUP"] = "flow_instance_setup";
21854
+ ErrorType["CONCURRENCY"] = "concurrency";
21855
+ ErrorType["INTERNAL"] = "internal";
21856
+ ErrorType["ACTION_RUN"] = "action_run";
21857
+ ErrorType["ACTION_INSTANCE_SETUP"] = "action_instance_setup";
21858
+ ErrorType["UNIT_RUN"] = "unit_run";
21859
+ ErrorType["CUSTOM_CODE"] = "custom_code";
21860
+ ErrorType["INSUFFICIENT_CREDIT"] = "insufficient_credit";
21861
+ ErrorType["OPENROUTER_NOT_CONFIGURED"] = "openrouter_not_configured";
21862
+ })(ErrorType || (ErrorType = {}));
21863
+ var BadRequestErrorKey;
21864
+ (function (BadRequestErrorKey) {
21865
+ BadRequestErrorKey["NOT_FOUND"] = "not_found";
21866
+ BadRequestErrorKey["NOT_AUTHENTICATED"] = "not_authenticated";
21867
+ BadRequestErrorKey["ACCESS_DENIED"] = "access_denied";
21868
+ BadRequestErrorKey["ALREADY_EXISTS"] = "already_exists";
21869
+ BadRequestErrorKey["RATE_LIMIT_EXCEEDED"] = "rate_limit_exceeded";
21870
+ BadRequestErrorKey["WORKSPACE_TIER_GATED"] = "workspace_tier_gated";
21871
+ })(BadRequestErrorKey || (BadRequestErrorKey = {}));
21872
+ var ConnectionErrorKey;
21873
+ (function (ConnectionErrorKey) {
21874
+ ConnectionErrorKey["CONNECTION_IS_DEFUNCT"] = "connection_is_defunct";
21875
+ ConnectionErrorKey["ACCESS_TOKEN_EXPIRED"] = "access_token_expired";
21876
+ ConnectionErrorKey["RATE_LIMIT_EXCEEDED"] = "rate_limit_exceeded";
21877
+ })(ConnectionErrorKey || (ConnectionErrorKey = {}));
21878
+ var ConcurrencyErrorKey;
21879
+ (function (ConcurrencyErrorKey) {
21880
+ ConcurrencyErrorKey["LOCK_TIMEOUT"] = "lock_timeout";
21881
+ })(ConcurrencyErrorKey || (ConcurrencyErrorKey = {}));
21882
+ const ErrorDataSchema = lazy(() => object({
21883
+ type: _enum(ErrorType).optional(),
21884
+ key: string$1().optional(),
21885
+ message: string$1(),
21886
+ data: any().optional(),
21887
+ stack: any().optional(),
21888
+ causedByError: lazy(() => ErrorDataSchema).optional(),
21889
+ logs: array(any()).optional(),
21890
+ }));
21891
+ class ErrorData {
21892
+ constructor(arg) {
21893
+ if (arg instanceof Error) {
21894
+ this.message = arg.message;
21895
+ this.stack = arg.stack;
21896
+ this.type = ErrorType.INTERNAL;
21897
+ }
21898
+ else if (typeof arg === 'string') {
21899
+ this.message = arg;
21900
+ this.type = ErrorType.INTERNAL;
21901
+ }
21902
+ else if (typeof arg === 'object' && arg !== null) {
21903
+ Object.assign(this, arg);
21904
+ }
21905
+ else {
21906
+ throw new Error('Invalid argument when creating BaseErrorData: ' + JSON.stringify(arg));
21907
+ }
21994
21908
  }
21995
21909
  }
21996
- class DataSourceAccessor extends ElementAccessor {
21997
- constructor(client, selector) {
21998
- super({
21999
- client,
22000
- selector,
22001
- path: 'data-source',
22002
- });
22003
- }
22004
- async setup() {
22005
- await this.options.client.post(this.getPath('setup'));
21910
+ class MembraneError extends Error {
21911
+ constructor(arg) {
21912
+ const errorData = new ErrorData(arg);
21913
+ super(errorData.message);
21914
+ this.isMembraneError = true;
21915
+ this.data = errorData;
21916
+ if (!this.data.type) {
21917
+ this.data.type = ErrorType.INTERNAL;
21918
+ }
22006
21919
  }
22007
- async reset() {
22008
- return await this.options.client.post(this.getPath('reset'));
21920
+ }
21921
+ class InternalError extends MembraneError {
21922
+ constructor(arg) {
21923
+ super(arg);
21924
+ this.data.type = ErrorType.INTERNAL;
22009
21925
  }
22010
21926
  }
22011
- class DataSourceInstancesAccessor extends ElementInstanceListAccessor {
22012
- constructor(client) {
22013
- super(client, 'data-source-instances');
21927
+ class BadRequestError extends MembraneError {
21928
+ constructor(arg) {
21929
+ super(arg);
21930
+ this.data.type = ErrorType.BAD_REQUEST;
22014
21931
  }
22015
21932
  }
22016
- class DataSourceInstanceAccessor extends ElementInstanceAccessor {
22017
- constructor(client, selector) {
21933
+ class ConcurrencyError extends MembraneError {
21934
+ constructor(arg) {
21935
+ super(arg);
21936
+ this.data.type = ErrorType.CONCURRENCY;
21937
+ }
21938
+ }
21939
+ class ConfigurationError extends MembraneError {
21940
+ constructor(arg) {
21941
+ super(arg);
21942
+ this.data.type = ErrorType.CONFIGURATION;
21943
+ }
21944
+ }
21945
+ class FlowInstanceSetupError extends MembraneError {
21946
+ constructor(arg) {
21947
+ super(arg);
21948
+ this.data.type = ErrorType.FLOW_INSTANCE_SETUP;
21949
+ }
21950
+ }
21951
+ class FlowRunError extends MembraneError {
21952
+ constructor(arg) {
21953
+ super(arg);
21954
+ this.data.type = ErrorType.FLOW_RUN;
21955
+ }
21956
+ }
21957
+ class ActionRunError extends MembraneError {
21958
+ constructor(arg) {
21959
+ super(arg);
21960
+ this.data.type = ErrorType.ACTION_RUN;
21961
+ }
21962
+ }
21963
+ class ActionInstanceSetupError extends MembraneError {
21964
+ constructor(arg) {
21965
+ super(arg);
21966
+ this.data.type = ErrorType.ACTION_INSTANCE_SETUP;
21967
+ }
21968
+ }
21969
+ class UnitRunError extends MembraneError {
21970
+ constructor(arg) {
21971
+ super(arg);
21972
+ this.data.type = ErrorType.UNIT_RUN;
21973
+ }
21974
+ }
21975
+ class ConnectionError extends MembraneError {
21976
+ constructor(arg) {
21977
+ super(arg);
21978
+ this.data.type = ErrorType.CONNECTION;
21979
+ }
21980
+ }
21981
+ class CustomCodeError extends MembraneError {
21982
+ constructor(arg) {
21983
+ super(arg);
21984
+ this.data.type = ErrorType.CUSTOM_CODE;
21985
+ }
21986
+ }
21987
+ class InsufficientCreditsError extends MembraneError {
21988
+ constructor(arg) {
21989
+ super(arg);
21990
+ this.data.type = ErrorType.INSUFFICIENT_CREDIT;
21991
+ }
21992
+ }
21993
+ class OpenRouterNotConfiguredError extends MembraneError {
21994
+ constructor(arg) {
21995
+ super(arg);
21996
+ this.data.type = ErrorType.OPENROUTER_NOT_CONFIGURED;
21997
+ }
21998
+ }
21999
+
22000
+ function routeConnectionEventMessage(message, requestId, handlers) {
22001
+ var _a, _b, _c, _d, _e;
22002
+ if (!isConnectionMessagePayload(message))
22003
+ return;
22004
+ if (message.requestId && message.requestId !== requestId)
22005
+ return;
22006
+ if (message.type === 'newConnectionCreated') {
22007
+ (_a = handlers.onSuccess) === null || _a === void 0 ? void 0 : _a.call(handlers, message.connection);
22008
+ (_b = handlers.onTerminal) === null || _b === void 0 ? void 0 : _b.call(handlers);
22009
+ return;
22010
+ }
22011
+ if (message.type === 'newConnectionFailure') {
22012
+ const error = new MembraneError((_c = message.errorData) !== null && _c !== void 0 ? _c : message.error);
22013
+ if (message.connectionId) {
22014
+ error.data.data = { ...error.data.data, connectionId: message.connectionId };
22015
+ }
22016
+ (_d = handlers.onFailure) === null || _d === void 0 ? void 0 : _d.call(handlers, error);
22017
+ (_e = handlers.onTerminal) === null || _e === void 0 ? void 0 : _e.call(handlers);
22018
+ }
22019
+ }
22020
+ function isConnectionMessagePayload(value) {
22021
+ if (!value || typeof value !== 'object')
22022
+ return false;
22023
+ const m = value;
22024
+ return m.source === 'integration.app' && typeof m.type === 'string';
22025
+ }
22026
+ function createConnectionEventsSubscription(options) {
22027
+ const { apiUri, getToken, requestId, handlers } = options;
22028
+ let eventSource = null;
22029
+ let cancelled = false;
22030
+ const close = () => {
22031
+ cancelled = true;
22032
+ eventSource === null || eventSource === void 0 ? void 0 : eventSource.close();
22033
+ eventSource = null;
22034
+ };
22035
+ Promise.resolve(getToken()).then((token) => {
22036
+ if (cancelled)
22037
+ return;
22038
+ const url = urljoin(apiUri, '/sse/connection-events', requestId) + `?token=${encodeURIComponent(token)}`;
22039
+ try {
22040
+ eventSource = new EventSource(url);
22041
+ eventSource.onmessage = (event) => {
22042
+ let data;
22043
+ try {
22044
+ data = JSON.parse(event.data);
22045
+ }
22046
+ catch (_a) {
22047
+ return;
22048
+ }
22049
+ routeConnectionEventMessage(data, requestId, handlers);
22050
+ };
22051
+ eventSource.onerror = close;
22052
+ }
22053
+ catch (_a) { }
22054
+ });
22055
+ return close;
22056
+ }
22057
+
22058
+ class DataSourcesAccessor extends ElementListAccessor {
22059
+ constructor(client) {
22060
+ super(client, 'data-sources');
22061
+ }
22062
+ }
22063
+ class DataSourceAccessor extends ElementAccessor {
22064
+ constructor(client, selector) {
22065
+ super({
22066
+ client,
22067
+ selector,
22068
+ path: 'data-source',
22069
+ });
22070
+ }
22071
+ async setup() {
22072
+ await this.options.client.post(this.getPath('setup'));
22073
+ }
22074
+ async reset() {
22075
+ return await this.options.client.post(this.getPath('reset'));
22076
+ }
22077
+ }
22078
+ class DataSourceInstancesAccessor extends ElementInstanceListAccessor {
22079
+ constructor(client) {
22080
+ super(client, 'data-source-instances');
22081
+ }
22082
+ }
22083
+ class DataSourceInstanceAccessor extends ElementInstanceAccessor {
22084
+ constructor(client, selector) {
22018
22085
  super({
22019
22086
  client,
22020
22087
  instancePath: 'data-source-instance',
@@ -22234,11 +22301,15 @@
22234
22301
  WorkspaceElementType["ExternalEventSubscription"] = "external-event-subscription";
22235
22302
  WorkspaceElementType["ExternalEventLogRecord"] = "external-event-log-record";
22236
22303
  WorkspaceElementType["ExternalEventPull"] = "external-event-pull";
22304
+ WorkspaceElementType["ExternalEventType"] = "external-event-type";
22237
22305
  WorkspaceElementType["Screen"] = "screen";
22238
22306
  WorkspaceElementType["ActionRunLogRecord"] = "action-run-log-record";
22239
22307
  WorkspaceElementType["ExternalApiLogRecord"] = "external-api-log-record";
22240
22308
  WorkspaceElementType["IncomingWebhookLogRecord"] = "incoming-webhook-log-record";
22241
22309
  WorkspaceElementType["ConnectedProduct"] = "connected-product";
22310
+ WorkspaceElementType["AgentHarness"] = "agent-harness";
22311
+ WorkspaceElementType["AgentSkill"] = "agent-skill";
22312
+ WorkspaceElementType["AgentInstruction"] = "agent-instruction";
22242
22313
  })(WorkspaceElementType || (WorkspaceElementType = {}));
22243
22314
  var WorkspaceEventType;
22244
22315
  (function (WorkspaceEventType) {
@@ -22350,7 +22421,8 @@
22350
22421
  const BaseIntegrationLevelMembraneInterfaceReadOnlyProperties = BaseMembraneInterfaceReadOnlyProperties.extend({
22351
22422
  isCustomized: boolean$1().optional(),
22352
22423
  });
22353
- BaseMembraneInterfaceEditableProperties.extend({
22424
+ const BaseExportProperties = BaseMembraneInterfaceEditableProperties.required({ uuid: true, key: true });
22425
+ BaseExportProperties.extend({
22354
22426
  integrationUuid: string$1().optional(),
22355
22427
  parentUuid: string$1().optional(),
22356
22428
  externalAppUuid: string$1().optional(),
@@ -22783,12 +22855,12 @@
22783
22855
  }
22784
22856
  }
22785
22857
 
22786
- var ConnectionType;
22787
- (function (ConnectionType) {
22788
- ConnectionType["IFRAME"] = "iframe";
22789
- ConnectionType["POPUP"] = "popup";
22790
- ConnectionType["REDIRECT"] = "redirect";
22791
- })(ConnectionType || (ConnectionType = {}));
22858
+ var ConnectionDisplayMode;
22859
+ (function (ConnectionDisplayMode) {
22860
+ ConnectionDisplayMode["IFRAME"] = "iframe";
22861
+ ConnectionDisplayMode["POPUP"] = "popup";
22862
+ ConnectionDisplayMode["REDIRECT"] = "redirect";
22863
+ })(ConnectionDisplayMode || (ConnectionDisplayMode = {}));
22792
22864
  class ConnectionsAccessor extends ElementInstanceListAccessor {
22793
22865
  constructor(client) {
22794
22866
  super(client, 'connections');
@@ -22838,6 +22910,9 @@
22838
22910
  async archive() {
22839
22911
  return this.client.delete(`/connections/${this.connectionSelector}`);
22840
22912
  }
22913
+ async restore() {
22914
+ return this.client.post(`/connections/${this.connectionSelector}/restore`);
22915
+ }
22841
22916
  async request(path, data = null) {
22842
22917
  const pathWithoutSlash = path.startsWith('/') ? path.slice(1) : path;
22843
22918
  return this.client.post(`/connections/${this.connectionSelector}/api/${pathWithoutSlash}`, data);
@@ -22949,17 +23024,19 @@
22949
23024
  }
22950
23025
  }
22951
23026
  async function createOrUpdateConnection(options) {
22952
- const { client, connectionId, connectionKey, integrationKey, integrationId, connectorId, connectorVersion, name, input, connectorParameters, allowMultipleConnections, authOptionKey, connectionRequestId, apiUri, redirectUri, onPopupClosed, } = options !== null && options !== void 0 ? options : {};
22953
- let connectionType = await detectConnectionType(options);
23027
+ const { client, type, connectionId, connectionKey, integrationKey, integrationId, connectorId, connectorVersion, name, input, connectorParameters, allowMultipleConnections, authOptionKey, connectionRequestId, apiUri, redirectUri, customState, onPopupClosed, lateEvents, } = options !== null && options !== void 0 ? options : {};
23028
+ let connectionType = type === 'mcp' ? ConnectionDisplayMode.POPUP : await detectConnectionType(options);
22954
23029
  if (redirectUri) {
22955
- connectionType = ConnectionType.REDIRECT;
23030
+ connectionType = ConnectionDisplayMode.REDIRECT;
22956
23031
  }
22957
23032
  const freshToken = await client.getToken();
22958
23033
  const connectPath = 'connect';
22959
23034
  return new Promise((resolve, reject) => {
23035
+ var _a, _b;
22960
23036
  const requestId = simpleUniqueId() + simpleUniqueId();
22961
23037
  const payload = {
22962
23038
  token: freshToken,
23039
+ type,
22963
23040
  input,
22964
23041
  connectorParameters,
22965
23042
  integrationKey,
@@ -22974,26 +23051,54 @@
22974
23051
  connectionRequestId,
22975
23052
  requestId,
22976
23053
  redirectUri,
23054
+ customState,
22977
23055
  };
22978
23056
  let cancelCheckInterval;
22979
- const eventHandler = createConnectionEventHandler(requestId, (data) => {
22980
- resolve(data);
22981
- }, (error) => {
22982
- reject(error);
22983
- }, () => {
22984
- cleanup();
22985
- });
22986
- const { stopCrossWindow } = createCrossWindowListener({
22987
- handler: eventHandler,
22988
- });
22989
- const { stopSSE } = createSSEListener({
23057
+ let lateEventsTimeout;
23058
+ let promiseSettled = false;
23059
+ const handlers = {
23060
+ onSuccess: (data) => {
23061
+ var _a;
23062
+ if (promiseSettled) {
23063
+ (_a = lateEvents === null || lateEvents === void 0 ? void 0 : lateEvents.onConnection) === null || _a === void 0 ? void 0 : _a.call(lateEvents, data);
23064
+ }
23065
+ else {
23066
+ promiseSettled = true;
23067
+ resolve(data);
23068
+ }
23069
+ },
23070
+ onFailure: (error) => {
23071
+ var _a;
23072
+ if (promiseSettled) {
23073
+ (_a = lateEvents === null || lateEvents === void 0 ? void 0 : lateEvents.onFailure) === null || _a === void 0 ? void 0 : _a.call(lateEvents, error);
23074
+ }
23075
+ else {
23076
+ promiseSettled = true;
23077
+ reject(error);
23078
+ }
23079
+ },
23080
+ onTerminal: () => cleanup(),
23081
+ };
23082
+ const { stopCrossWindow } = createCrossWindowListener({ requestId, handlers });
23083
+ const stopSSE = createConnectionEventsSubscription({
22990
23084
  apiUri: apiUri,
23085
+ getToken: () => freshToken,
22991
23086
  requestId,
22992
- token: freshToken,
22993
- handler: eventHandler,
23087
+ handlers,
22994
23088
  });
23089
+ if (lateEvents) {
23090
+ lateEventsTimeout = setTimeout(stopSSE, 30 * 60 * 1000);
23091
+ if ((_a = lateEvents.signal) === null || _a === void 0 ? void 0 : _a.aborted) {
23092
+ stopSSE();
23093
+ }
23094
+ else {
23095
+ (_b = lateEvents.signal) === null || _b === void 0 ? void 0 : _b.addEventListener('abort', stopSSE, { once: true });
23096
+ }
23097
+ }
22995
23098
  function cleanup() {
22996
23099
  clearInterval(cancelCheckInterval);
23100
+ if (lateEventsTimeout)
23101
+ clearTimeout(lateEventsTimeout);
22997
23102
  stopCrossWindow();
22998
23103
  stopSSE();
22999
23104
  }
@@ -23010,7 +23115,7 @@
23010
23115
  input.value = JSON.stringify(payload);
23011
23116
  form.appendChild(input);
23012
23117
  document.body.appendChild(form);
23013
- if (connectionType === ConnectionType.IFRAME) {
23118
+ if (connectionType === ConnectionDisplayMode.IFRAME) {
23014
23119
  const iframeElement = document.createElement('iframe');
23015
23120
  iframeElement.id = targetElementId;
23016
23121
  iframeElement.name = targetElementId;
@@ -23025,12 +23130,12 @@
23025
23130
  form.submit();
23026
23131
  document.body.removeChild(form);
23027
23132
  }
23028
- if (connectionType === ConnectionType.REDIRECT) {
23133
+ if (connectionType === ConnectionDisplayMode.REDIRECT) {
23029
23134
  form.target = '_self';
23030
23135
  form.submit();
23031
23136
  document.body.removeChild(form);
23032
23137
  }
23033
- if (connectionType === ConnectionType.POPUP) {
23138
+ if (connectionType === ConnectionDisplayMode.POPUP) {
23034
23139
  const width = Math.min(Math.round(screen.width * 0.7), 1000);
23035
23140
  const height = Math.min(Math.round(screen.height * 0.6), 800);
23036
23141
  const left = Math.round((screen.width - width) / 2);
@@ -23051,9 +23156,15 @@
23051
23156
  }, 1000);
23052
23157
  cancelCheckInterval = setInterval(() => {
23053
23158
  if (popup === null || popup === void 0 ? void 0 : popup.closed) {
23054
- cleanup();
23055
- onPopupClosed === null || onPopupClosed === void 0 ? void 0 : onPopupClosed();
23056
- resolve(null);
23159
+ clearInterval(cancelCheckInterval);
23160
+ stopCrossWindow();
23161
+ if (!lateEvents)
23162
+ stopSSE();
23163
+ if (!promiseSettled) {
23164
+ promiseSettled = true;
23165
+ onPopupClosed === null || onPopupClosed === void 0 ? void 0 : onPopupClosed();
23166
+ resolve(null);
23167
+ }
23057
23168
  }
23058
23169
  }, 1000);
23059
23170
  }
@@ -23073,64 +23184,21 @@
23073
23184
  });
23074
23185
  const option = connectionOptions.find((option) => option.key == authOptionKey);
23075
23186
  if ((option === null || option === void 0 ? void 0 : option.type) === 'client-credentials') {
23076
- return ConnectionType.IFRAME;
23187
+ return ConnectionDisplayMode.IFRAME;
23077
23188
  }
23078
- return ConnectionType.POPUP;
23189
+ return ConnectionDisplayMode.POPUP;
23079
23190
  }
23080
- const createConnectionEventHandler = (requestId, onResolve, onReject, onFinally) => {
23081
- return (event) => {
23082
- var _a;
23083
- const message = event.data || {};
23084
- if (message.source == 'integration.app' && (message.requestId == requestId || !message.requestId)) {
23085
- if (message.type == 'newConnectionCreated') {
23086
- onResolve(message.connection);
23087
- }
23088
- if (message.type == 'newConnectionFailure') {
23089
- const error = new MembraneError((_a = message.errorData) !== null && _a !== void 0 ? _a : message.error);
23090
- if (message.connectionId) {
23091
- error.data.data = { ...error.data.data, connectionId: message.connectionId };
23092
- }
23093
- onReject(error);
23094
- }
23095
- onFinally();
23096
- }
23191
+ const createCrossWindowListener = ({ requestId, handlers, }) => {
23192
+ const listener = (event) => {
23193
+ routeConnectionEventMessage(event.data, requestId, handlers);
23097
23194
  };
23098
- };
23099
- const createCrossWindowListener = ({ handler }) => {
23100
- window.addEventListener('message', handler);
23195
+ window.addEventListener('message', listener);
23101
23196
  return {
23102
23197
  stopCrossWindow: () => {
23103
- window.removeEventListener('message', handler);
23198
+ window.removeEventListener('message', listener);
23104
23199
  },
23105
23200
  };
23106
23201
  };
23107
- const createSSEListener = ({ apiUri, requestId, token, handler, }) => {
23108
- const sseUrl = urljoin(apiUri, '/sse/connection-events', requestId) + `?token=${encodeURIComponent(token)}`;
23109
- let eventSource = null;
23110
- const closeSseConnection = () => {
23111
- eventSource === null || eventSource === void 0 ? void 0 : eventSource.close();
23112
- eventSource = null;
23113
- };
23114
- try {
23115
- eventSource = new EventSource(sseUrl);
23116
- eventSource.onmessage = (event) => {
23117
- const eventCopy = {
23118
- ...event,
23119
- data: JSON.parse(event.data),
23120
- };
23121
- handler(eventCopy);
23122
- };
23123
- eventSource.onerror = () => {
23124
- closeSseConnection();
23125
- };
23126
- }
23127
- catch (err) {
23128
- console.error('Error setting up SSE connection:', err);
23129
- }
23130
- return {
23131
- stopSSE: closeSseConnection,
23132
- };
23133
- };
23134
23202
 
23135
23203
  class FlowsAccessor extends ElementListAccessor {
23136
23204
  constructor(client) {
@@ -23533,7 +23601,7 @@
23533
23601
  }
23534
23602
  }
23535
23603
 
23536
- /*! Axios v1.15.0 Copyright (c) 2026 Matt Zabriskie and contributors */
23604
+ /*! Axios v1.16.0 Copyright (c) 2026 Matt Zabriskie and contributors */
23537
23605
  /**
23538
23606
  * Create a bound version of a function with a specified `this` context
23539
23607
  *
@@ -23737,9 +23805,9 @@
23737
23805
  * also have a `name` and `type` attribute to specify filename and content type
23738
23806
  *
23739
23807
  * @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
23740
- *
23808
+ *
23741
23809
  * @param {*} value The value to test
23742
- *
23810
+ *
23743
23811
  * @returns {boolean} True if value is a React Native Blob, otherwise false
23744
23812
  */
23745
23813
  const isReactNativeBlob = (value) => {
@@ -23749,9 +23817,9 @@
23749
23817
  /**
23750
23818
  * Determine if environment is React Native
23751
23819
  * ReactNative `FormData` has a non-standard `getParts()` method
23752
- *
23820
+ *
23753
23821
  * @param {*} formData The formData to test
23754
- *
23822
+ *
23755
23823
  * @returns {boolean} True if environment is React Native, otherwise false
23756
23824
  */
23757
23825
  const isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';
@@ -23770,7 +23838,7 @@
23770
23838
  *
23771
23839
  * @param {*} val The value to test
23772
23840
  *
23773
- * @returns {boolean} True if value is a File, otherwise false
23841
+ * @returns {boolean} True if value is a FileList, otherwise false
23774
23842
  */
23775
23843
  const isFileList = kindOfTest('FileList');
23776
23844
 
@@ -23802,15 +23870,17 @@
23802
23870
  const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
23803
23871
 
23804
23872
  const isFormData = (thing) => {
23805
- let kind;
23806
- return thing && (
23807
- (FormDataCtor && thing instanceof FormDataCtor) || (
23808
- isFunction$1(thing.append) && (
23809
- (kind = kindOf(thing)) === 'formdata' ||
23810
- // detect form-data instance
23811
- (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
23812
- )
23813
- )
23873
+ if (!thing) return false;
23874
+ if (FormDataCtor && thing instanceof FormDataCtor) return true;
23875
+ // Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData.
23876
+ const proto = getPrototypeOf(thing);
23877
+ if (!proto || proto === Object.prototype) return false;
23878
+ if (!isFunction$1(thing.append)) return false;
23879
+ const kind = kindOf(thing);
23880
+ return (
23881
+ kind === 'formdata' ||
23882
+ // detect form-data instance
23883
+ (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
23814
23884
  );
23815
23885
  };
23816
23886
 
@@ -23946,7 +24016,7 @@
23946
24016
  *
23947
24017
  * @returns {Object} Result of all merge properties
23948
24018
  */
23949
- function merge(/* obj1, obj2, obj3, ... */) {
24019
+ function merge(...objs) {
23950
24020
  const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
23951
24021
  const result = {};
23952
24022
  const assignValue = (val, key) => {
@@ -23956,8 +24026,12 @@
23956
24026
  }
23957
24027
 
23958
24028
  const targetKey = (caseless && findKey(result, key)) || key;
23959
- if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
23960
- result[targetKey] = merge(result[targetKey], val);
24029
+ // Read via own-prop only — a bare `result[targetKey]` walks the prototype
24030
+ // chain, so a polluted Object.prototype value could surface here and get
24031
+ // copied into the merged result.
24032
+ const existing = hasOwnProperty(result, targetKey) ? result[targetKey] : undefined;
24033
+ if (isPlainObject(existing) && isPlainObject(val)) {
24034
+ result[targetKey] = merge(existing, val);
23961
24035
  } else if (isPlainObject(val)) {
23962
24036
  result[targetKey] = merge({}, val);
23963
24037
  } else if (isArray(val)) {
@@ -23967,8 +24041,8 @@
23967
24041
  }
23968
24042
  };
23969
24043
 
23970
- for (let i = 0, l = arguments.length; i < l; i++) {
23971
- arguments[i] && forEach(arguments[i], assignValue);
24044
+ for (let i = 0, l = objs.length; i < l; i++) {
24045
+ objs[i] && forEach(objs[i], assignValue);
23972
24046
  }
23973
24047
  return result;
23974
24048
  }
@@ -23990,6 +24064,9 @@
23990
24064
  (val, key) => {
23991
24065
  if (thisArg && isFunction$1(val)) {
23992
24066
  Object.defineProperty(a, key, {
24067
+ // Null-proto descriptor so a polluted Object.prototype.get cannot
24068
+ // hijack defineProperty's accessor-vs-data resolution.
24069
+ __proto__: null,
23993
24070
  value: bind(val, thisArg),
23994
24071
  writable: true,
23995
24072
  enumerable: true,
@@ -23997,6 +24074,7 @@
23997
24074
  });
23998
24075
  } else {
23999
24076
  Object.defineProperty(a, key, {
24077
+ __proto__: null,
24000
24078
  value: val,
24001
24079
  writable: true,
24002
24080
  enumerable: true,
@@ -24035,12 +24113,14 @@
24035
24113
  const inherits = (constructor, superConstructor, props, descriptors) => {
24036
24114
  constructor.prototype = Object.create(superConstructor.prototype, descriptors);
24037
24115
  Object.defineProperty(constructor.prototype, 'constructor', {
24116
+ __proto__: null,
24038
24117
  value: constructor,
24039
24118
  writable: true,
24040
24119
  enumerable: false,
24041
24120
  configurable: true,
24042
24121
  });
24043
24122
  Object.defineProperty(constructor, 'super', {
24123
+ __proto__: null,
24044
24124
  value: superConstructor.prototype,
24045
24125
  });
24046
24126
  props && Object.assign(constructor.prototype, props);
@@ -24222,7 +24302,7 @@
24222
24302
  const freezeMethods = (obj) => {
24223
24303
  reduceDescriptors(obj, (descriptor, name) => {
24224
24304
  // skip restricted props in strict mode
24225
- if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
24305
+ if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].includes(name)) {
24226
24306
  return false;
24227
24307
  }
24228
24308
 
@@ -24463,1297 +24543,1398 @@
24463
24543
  isIterable,
24464
24544
  };
24465
24545
 
24466
- let AxiosError$1 = class AxiosError extends Error {
24467
- static from(error, code, config, request, response, customProps) {
24468
- const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
24469
- axiosError.cause = error;
24470
- axiosError.name = error.name;
24546
+ // RawAxiosHeaders whose duplicates are ignored by node
24547
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
24548
+ const ignoreDuplicateOf = utils$1.toObjectSet([
24549
+ 'age',
24550
+ 'authorization',
24551
+ 'content-length',
24552
+ 'content-type',
24553
+ 'etag',
24554
+ 'expires',
24555
+ 'from',
24556
+ 'host',
24557
+ 'if-modified-since',
24558
+ 'if-unmodified-since',
24559
+ 'last-modified',
24560
+ 'location',
24561
+ 'max-forwards',
24562
+ 'proxy-authorization',
24563
+ 'referer',
24564
+ 'retry-after',
24565
+ 'user-agent',
24566
+ ]);
24471
24567
 
24472
- // Preserve status from the original error if not already set from response
24473
- if (error.status != null && axiosError.status == null) {
24474
- axiosError.status = error.status;
24475
- }
24568
+ /**
24569
+ * Parse headers into an object
24570
+ *
24571
+ * ```
24572
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
24573
+ * Content-Type: application/json
24574
+ * Connection: keep-alive
24575
+ * Transfer-Encoding: chunked
24576
+ * ```
24577
+ *
24578
+ * @param {String} rawHeaders Headers needing to be parsed
24579
+ *
24580
+ * @returns {Object} Headers parsed into an object
24581
+ */
24582
+ var parseHeaders = (rawHeaders) => {
24583
+ const parsed = {};
24584
+ let key;
24585
+ let val;
24586
+ let i;
24476
24587
 
24477
- customProps && Object.assign(axiosError, customProps);
24478
- return axiosError;
24479
- }
24588
+ rawHeaders &&
24589
+ rawHeaders.split('\n').forEach(function parser(line) {
24590
+ i = line.indexOf(':');
24591
+ key = line.substring(0, i).trim().toLowerCase();
24592
+ val = line.substring(i + 1).trim();
24480
24593
 
24481
- /**
24482
- * Create an Error with the specified message, config, error code, request and response.
24483
- *
24484
- * @param {string} message The error message.
24485
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
24486
- * @param {Object} [config] The config.
24487
- * @param {Object} [request] The request.
24488
- * @param {Object} [response] The response.
24489
- *
24490
- * @returns {Error} The created error.
24491
- */
24492
- constructor(message, code, config, request, response) {
24493
- super(message);
24494
-
24495
- // Make message enumerable to maintain backward compatibility
24496
- // The native Error constructor sets message as non-enumerable,
24497
- // but axios < v1.13.3 had it as enumerable
24498
- Object.defineProperty(this, 'message', {
24499
- value: message,
24500
- enumerable: true,
24501
- writable: true,
24502
- configurable: true
24503
- });
24504
-
24505
- this.name = 'AxiosError';
24506
- this.isAxiosError = true;
24507
- code && (this.code = code);
24508
- config && (this.config = config);
24509
- request && (this.request = request);
24510
- if (response) {
24511
- this.response = response;
24512
- this.status = response.status;
24594
+ if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
24595
+ return;
24596
+ }
24597
+
24598
+ if (key === 'set-cookie') {
24599
+ if (parsed[key]) {
24600
+ parsed[key].push(val);
24601
+ } else {
24602
+ parsed[key] = [val];
24603
+ }
24604
+ } else {
24605
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
24513
24606
  }
24607
+ });
24608
+
24609
+ return parsed;
24610
+ };
24611
+
24612
+ const $internals = Symbol('internals');
24613
+
24614
+ const INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
24615
+
24616
+ function trimSPorHTAB(str) {
24617
+ let start = 0;
24618
+ let end = str.length;
24619
+
24620
+ while (start < end) {
24621
+ const code = str.charCodeAt(start);
24622
+
24623
+ if (code !== 0x09 && code !== 0x20) {
24624
+ break;
24514
24625
  }
24515
24626
 
24516
- toJSON() {
24517
- return {
24518
- // Standard
24519
- message: this.message,
24520
- name: this.name,
24521
- // Microsoft
24522
- description: this.description,
24523
- number: this.number,
24524
- // Mozilla
24525
- fileName: this.fileName,
24526
- lineNumber: this.lineNumber,
24527
- columnNumber: this.columnNumber,
24528
- stack: this.stack,
24529
- // Axios
24530
- config: utils$1.toJSONObject(this.config),
24531
- code: this.code,
24532
- status: this.status,
24533
- };
24627
+ start += 1;
24534
24628
  }
24535
- };
24536
24629
 
24537
- // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
24538
- AxiosError$1.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
24539
- AxiosError$1.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
24540
- AxiosError$1.ECONNABORTED = 'ECONNABORTED';
24541
- AxiosError$1.ETIMEDOUT = 'ETIMEDOUT';
24542
- AxiosError$1.ERR_NETWORK = 'ERR_NETWORK';
24543
- AxiosError$1.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
24544
- AxiosError$1.ERR_DEPRECATED = 'ERR_DEPRECATED';
24545
- AxiosError$1.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
24546
- AxiosError$1.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
24547
- AxiosError$1.ERR_CANCELED = 'ERR_CANCELED';
24548
- AxiosError$1.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
24549
- AxiosError$1.ERR_INVALID_URL = 'ERR_INVALID_URL';
24630
+ while (end > start) {
24631
+ const code = str.charCodeAt(end - 1);
24550
24632
 
24551
- // eslint-disable-next-line strict
24552
- var httpAdapter = null;
24633
+ if (code !== 0x09 && code !== 0x20) {
24634
+ break;
24635
+ }
24553
24636
 
24554
- /**
24555
- * Determines if the given thing is a array or js object.
24556
- *
24557
- * @param {string} thing - The object or array to be visited.
24558
- *
24559
- * @returns {boolean}
24560
- */
24561
- function isVisitable(thing) {
24562
- return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
24637
+ end -= 1;
24638
+ }
24639
+
24640
+ return start === 0 && end === str.length ? str : str.slice(start, end);
24563
24641
  }
24564
24642
 
24565
- /**
24566
- * It removes the brackets from the end of a string
24567
- *
24568
- * @param {string} key - The key of the parameter.
24569
- *
24570
- * @returns {string} the key without the brackets.
24571
- */
24572
- function removeBrackets(key) {
24573
- return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
24643
+ function normalizeHeader(header) {
24644
+ return header && String(header).trim().toLowerCase();
24574
24645
  }
24575
24646
 
24576
- /**
24577
- * It takes a path, a key, and a boolean, and returns a string
24578
- *
24579
- * @param {string} path - The path to the current key.
24580
- * @param {string} key - The key of the current object being iterated over.
24581
- * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
24582
- *
24583
- * @returns {string} The path to the current key.
24584
- */
24585
- function renderKey(path, key, dots) {
24586
- if (!path) return key;
24587
- return path
24588
- .concat(key)
24589
- .map(function each(token, i) {
24590
- // eslint-disable-next-line no-param-reassign
24591
- token = removeBrackets(token);
24592
- return !dots && i ? '[' + token + ']' : token;
24593
- })
24594
- .join(dots ? '.' : '');
24647
+ function sanitizeHeaderValue(str) {
24648
+ return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
24595
24649
  }
24596
24650
 
24597
- /**
24598
- * If the array is an array and none of its elements are visitable, then it's a flat array.
24599
- *
24600
- * @param {Array<any>} arr - The array to check
24601
- *
24602
- * @returns {boolean}
24603
- */
24604
- function isFlatArray(arr) {
24605
- return utils$1.isArray(arr) && !arr.some(isVisitable);
24651
+ function normalizeValue(value) {
24652
+ if (value === false || value == null) {
24653
+ return value;
24654
+ }
24655
+
24656
+ return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
24606
24657
  }
24607
24658
 
24608
- const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
24609
- return /^is[A-Z]/.test(prop);
24610
- });
24659
+ function parseTokens(str) {
24660
+ const tokens = Object.create(null);
24661
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
24662
+ let match;
24611
24663
 
24612
- /**
24613
- * Convert a data object to FormData
24614
- *
24615
- * @param {Object} obj
24616
- * @param {?Object} [formData]
24617
- * @param {?Object} [options]
24618
- * @param {Function} [options.visitor]
24619
- * @param {Boolean} [options.metaTokens = true]
24620
- * @param {Boolean} [options.dots = false]
24621
- * @param {?Boolean} [options.indexes = false]
24622
- *
24623
- * @returns {Object}
24624
- **/
24664
+ while ((match = tokensRE.exec(str))) {
24665
+ tokens[match[1]] = match[2];
24666
+ }
24625
24667
 
24626
- /**
24627
- * It converts an object into a FormData object
24628
- *
24629
- * @param {Object<any, any>} obj - The object to convert to form data.
24630
- * @param {string} formData - The FormData object to append to.
24631
- * @param {Object<string, any>} options
24632
- *
24633
- * @returns
24634
- */
24635
- function toFormData$1(obj, formData, options) {
24636
- if (!utils$1.isObject(obj)) {
24637
- throw new TypeError('target must be an object');
24668
+ return tokens;
24669
+ }
24670
+
24671
+ const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
24672
+
24673
+ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
24674
+ if (utils$1.isFunction(filter)) {
24675
+ return filter.call(this, value, header);
24638
24676
  }
24639
24677
 
24640
- // eslint-disable-next-line no-param-reassign
24641
- formData = formData || new (FormData)();
24678
+ if (isHeaderNameFilter) {
24679
+ value = header;
24680
+ }
24642
24681
 
24643
- // eslint-disable-next-line no-param-reassign
24644
- options = utils$1.toFlatObject(
24645
- options,
24646
- {
24647
- metaTokens: true,
24648
- dots: false,
24649
- indexes: false,
24650
- },
24651
- false,
24652
- function defined(option, source) {
24653
- // eslint-disable-next-line no-eq-null,eqeqeq
24654
- return !utils$1.isUndefined(source[option]);
24655
- }
24656
- );
24682
+ if (!utils$1.isString(value)) return;
24657
24683
 
24658
- const metaTokens = options.metaTokens;
24659
- // eslint-disable-next-line no-use-before-define
24660
- const visitor = options.visitor || defaultVisitor;
24661
- const dots = options.dots;
24662
- const indexes = options.indexes;
24663
- const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
24664
- const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
24684
+ if (utils$1.isString(filter)) {
24685
+ return value.indexOf(filter) !== -1;
24686
+ }
24665
24687
 
24666
- if (!utils$1.isFunction(visitor)) {
24667
- throw new TypeError('visitor must be a function');
24688
+ if (utils$1.isRegExp(filter)) {
24689
+ return filter.test(value);
24668
24690
  }
24691
+ }
24669
24692
 
24670
- function convertValue(value) {
24671
- if (value === null) return '';
24693
+ function formatHeader(header) {
24694
+ return header
24695
+ .trim()
24696
+ .toLowerCase()
24697
+ .replace(/([a-z\d])(\w*)/g, (w, char, str) => {
24698
+ return char.toUpperCase() + str;
24699
+ });
24700
+ }
24672
24701
 
24673
- if (utils$1.isDate(value)) {
24674
- return value.toISOString();
24675
- }
24702
+ function buildAccessors(obj, header) {
24703
+ const accessorName = utils$1.toCamelCase(' ' + header);
24676
24704
 
24677
- if (utils$1.isBoolean(value)) {
24678
- return value.toString();
24679
- }
24705
+ ['get', 'set', 'has'].forEach((methodName) => {
24706
+ Object.defineProperty(obj, methodName + accessorName, {
24707
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
24708
+ // this data descriptor into an accessor descriptor on the way in.
24709
+ __proto__: null,
24710
+ value: function (arg1, arg2, arg3) {
24711
+ return this[methodName].call(this, header, arg1, arg2, arg3);
24712
+ },
24713
+ configurable: true,
24714
+ });
24715
+ });
24716
+ }
24680
24717
 
24681
- if (!useBlob && utils$1.isBlob(value)) {
24682
- throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
24718
+ let AxiosHeaders$1 = class AxiosHeaders {
24719
+ constructor(headers) {
24720
+ headers && this.set(headers);
24721
+ }
24722
+
24723
+ set(header, valueOrRewrite, rewrite) {
24724
+ const self = this;
24725
+
24726
+ function setHeader(_value, _header, _rewrite) {
24727
+ const lHeader = normalizeHeader(_header);
24728
+
24729
+ if (!lHeader) {
24730
+ throw new Error('header name must be a non-empty string');
24731
+ }
24732
+
24733
+ const key = utils$1.findKey(self, lHeader);
24734
+
24735
+ if (
24736
+ !key ||
24737
+ self[key] === undefined ||
24738
+ _rewrite === true ||
24739
+ (_rewrite === undefined && self[key] !== false)
24740
+ ) {
24741
+ self[key || _header] = normalizeValue(_value);
24742
+ }
24683
24743
  }
24684
24744
 
24685
- if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
24686
- return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
24745
+ const setHeaders = (headers, _rewrite) =>
24746
+ utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
24747
+
24748
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
24749
+ setHeaders(header, valueOrRewrite);
24750
+ } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
24751
+ setHeaders(parseHeaders(header), valueOrRewrite);
24752
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
24753
+ let obj = {},
24754
+ dest,
24755
+ key;
24756
+ for (const entry of header) {
24757
+ if (!utils$1.isArray(entry)) {
24758
+ throw TypeError('Object iterator must return a key-value pair');
24759
+ }
24760
+
24761
+ obj[(key = entry[0])] = (dest = obj[key])
24762
+ ? utils$1.isArray(dest)
24763
+ ? [...dest, entry[1]]
24764
+ : [dest, entry[1]]
24765
+ : entry[1];
24766
+ }
24767
+
24768
+ setHeaders(obj, valueOrRewrite);
24769
+ } else {
24770
+ header != null && setHeader(valueOrRewrite, header, rewrite);
24687
24771
  }
24688
24772
 
24689
- return value;
24773
+ return this;
24690
24774
  }
24691
24775
 
24692
- /**
24693
- * Default visitor.
24694
- *
24695
- * @param {*} value
24696
- * @param {String|Number} key
24697
- * @param {Array<String|Number>} path
24698
- * @this {FormData}
24699
- *
24700
- * @returns {boolean} return true to visit the each prop of the value recursively
24701
- */
24702
- function defaultVisitor(value, key, path) {
24703
- let arr = value;
24776
+ get(header, parser) {
24777
+ header = normalizeHeader(header);
24704
24778
 
24705
- if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
24706
- formData.append(renderKey(path, key, dots), convertValue(value));
24707
- return false;
24708
- }
24779
+ if (header) {
24780
+ const key = utils$1.findKey(this, header);
24709
24781
 
24710
- if (value && !path && typeof value === 'object') {
24711
- if (utils$1.endsWith(key, '{}')) {
24712
- // eslint-disable-next-line no-param-reassign
24713
- key = metaTokens ? key : key.slice(0, -2);
24714
- // eslint-disable-next-line no-param-reassign
24715
- value = JSON.stringify(value);
24716
- } else if (
24717
- (utils$1.isArray(value) && isFlatArray(value)) ||
24718
- ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
24719
- ) {
24720
- // eslint-disable-next-line no-param-reassign
24721
- key = removeBrackets(key);
24782
+ if (key) {
24783
+ const value = this[key];
24722
24784
 
24723
- arr.forEach(function each(el, index) {
24724
- !(utils$1.isUndefined(el) || el === null) &&
24725
- formData.append(
24726
- // eslint-disable-next-line no-nested-ternary
24727
- indexes === true
24728
- ? renderKey([key], index, dots)
24729
- : indexes === null
24730
- ? key
24731
- : key + '[]',
24732
- convertValue(el)
24733
- );
24734
- });
24735
- return false;
24785
+ if (!parser) {
24786
+ return value;
24787
+ }
24788
+
24789
+ if (parser === true) {
24790
+ return parseTokens(value);
24791
+ }
24792
+
24793
+ if (utils$1.isFunction(parser)) {
24794
+ return parser.call(this, value, key);
24795
+ }
24796
+
24797
+ if (utils$1.isRegExp(parser)) {
24798
+ return parser.exec(value);
24799
+ }
24800
+
24801
+ throw new TypeError('parser must be boolean|regexp|function');
24736
24802
  }
24737
24803
  }
24804
+ }
24738
24805
 
24739
- if (isVisitable(value)) {
24740
- return true;
24741
- }
24806
+ has(header, matcher) {
24807
+ header = normalizeHeader(header);
24742
24808
 
24743
- formData.append(renderKey(path, key, dots), convertValue(value));
24809
+ if (header) {
24810
+ const key = utils$1.findKey(this, header);
24811
+
24812
+ return !!(
24813
+ key &&
24814
+ this[key] !== undefined &&
24815
+ (!matcher || matchHeaderValue(this, this[key], key, matcher))
24816
+ );
24817
+ }
24744
24818
 
24745
24819
  return false;
24746
24820
  }
24747
24821
 
24748
- const stack = [];
24822
+ delete(header, matcher) {
24823
+ const self = this;
24824
+ let deleted = false;
24749
24825
 
24750
- const exposedHelpers = Object.assign(predicates, {
24751
- defaultVisitor,
24752
- convertValue,
24753
- isVisitable,
24754
- });
24826
+ function deleteHeader(_header) {
24827
+ _header = normalizeHeader(_header);
24755
24828
 
24756
- function build(value, path) {
24757
- if (utils$1.isUndefined(value)) return;
24829
+ if (_header) {
24830
+ const key = utils$1.findKey(self, _header);
24758
24831
 
24759
- if (stack.indexOf(value) !== -1) {
24760
- throw Error('Circular reference detected in ' + path.join('.'));
24832
+ if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
24833
+ delete self[key];
24834
+
24835
+ deleted = true;
24836
+ }
24837
+ }
24761
24838
  }
24762
24839
 
24763
- stack.push(value);
24840
+ if (utils$1.isArray(header)) {
24841
+ header.forEach(deleteHeader);
24842
+ } else {
24843
+ deleteHeader(header);
24844
+ }
24764
24845
 
24765
- utils$1.forEach(value, function each(el, key) {
24766
- const result =
24767
- !(utils$1.isUndefined(el) || el === null) &&
24768
- visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
24846
+ return deleted;
24847
+ }
24769
24848
 
24770
- if (result === true) {
24771
- build(el, path ? path.concat(key) : [key]);
24849
+ clear(matcher) {
24850
+ const keys = Object.keys(this);
24851
+ let i = keys.length;
24852
+ let deleted = false;
24853
+
24854
+ while (i--) {
24855
+ const key = keys[i];
24856
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
24857
+ delete this[key];
24858
+ deleted = true;
24772
24859
  }
24773
- });
24860
+ }
24774
24861
 
24775
- stack.pop();
24862
+ return deleted;
24776
24863
  }
24777
24864
 
24778
- if (!utils$1.isObject(obj)) {
24779
- throw new TypeError('data must be an object');
24780
- }
24865
+ normalize(format) {
24866
+ const self = this;
24867
+ const headers = {};
24781
24868
 
24782
- build(obj);
24869
+ utils$1.forEach(this, (value, header) => {
24870
+ const key = utils$1.findKey(headers, header);
24783
24871
 
24784
- return formData;
24785
- }
24872
+ if (key) {
24873
+ self[key] = normalizeValue(value);
24874
+ delete self[header];
24875
+ return;
24876
+ }
24786
24877
 
24787
- /**
24788
- * It encodes a string by replacing all characters that are not in the unreserved set with
24789
- * their percent-encoded equivalents
24790
- *
24791
- * @param {string} str - The string to encode.
24792
- *
24793
- * @returns {string} The encoded string.
24794
- */
24795
- function encode$1(str) {
24796
- const charMap = {
24797
- '!': '%21',
24798
- "'": '%27',
24799
- '(': '%28',
24800
- ')': '%29',
24801
- '~': '%7E',
24802
- '%20': '+',
24803
- '%00': '\x00',
24804
- };
24805
- return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
24806
- return charMap[match];
24807
- });
24808
- }
24878
+ const normalized = format ? formatHeader(header) : String(header).trim();
24809
24879
 
24810
- /**
24811
- * It takes a params object and converts it to a FormData object
24812
- *
24813
- * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
24814
- * @param {Object<string, any>} options - The options object passed to the Axios constructor.
24815
- *
24816
- * @returns {void}
24817
- */
24818
- function AxiosURLSearchParams(params, options) {
24819
- this._pairs = [];
24880
+ if (normalized !== header) {
24881
+ delete self[header];
24882
+ }
24820
24883
 
24821
- params && toFormData$1(params, this, options);
24822
- }
24884
+ self[normalized] = normalizeValue(value);
24823
24885
 
24824
- const prototype = AxiosURLSearchParams.prototype;
24886
+ headers[normalized] = true;
24887
+ });
24825
24888
 
24826
- prototype.append = function append(name, value) {
24827
- this._pairs.push([name, value]);
24828
- };
24889
+ return this;
24890
+ }
24829
24891
 
24830
- prototype.toString = function toString(encoder) {
24831
- const _encode = encoder
24832
- ? function (value) {
24833
- return encoder.call(this, value, encode$1);
24834
- }
24835
- : encode$1;
24892
+ concat(...targets) {
24893
+ return this.constructor.concat(this, ...targets);
24894
+ }
24836
24895
 
24837
- return this._pairs
24838
- .map(function each(pair) {
24839
- return _encode(pair[0]) + '=' + _encode(pair[1]);
24840
- }, '')
24841
- .join('&');
24842
- };
24896
+ toJSON(asStrings) {
24897
+ const obj = Object.create(null);
24843
24898
 
24844
- /**
24845
- * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
24846
- * their plain counterparts (`:`, `$`, `,`, `+`).
24847
- *
24848
- * @param {string} val The value to be encoded.
24849
- *
24850
- * @returns {string} The encoded value.
24851
- */
24852
- function encode(val) {
24853
- return encodeURIComponent(val)
24854
- .replace(/%3A/gi, ':')
24855
- .replace(/%24/g, '$')
24856
- .replace(/%2C/gi, ',')
24857
- .replace(/%20/g, '+');
24858
- }
24899
+ utils$1.forEach(this, (value, header) => {
24900
+ value != null &&
24901
+ value !== false &&
24902
+ (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
24903
+ });
24859
24904
 
24860
- /**
24861
- * Build a URL by appending params to the end
24862
- *
24863
- * @param {string} url The base of the url (e.g., http://www.google.com)
24864
- * @param {object} [params] The params to be appended
24865
- * @param {?(object|Function)} options
24866
- *
24867
- * @returns {string} The formatted url
24868
- */
24869
- function buildURL(url, params, options) {
24870
- if (!params) {
24871
- return url;
24905
+ return obj;
24906
+ }
24907
+
24908
+ [Symbol.iterator]() {
24909
+ return Object.entries(this.toJSON())[Symbol.iterator]();
24910
+ }
24911
+
24912
+ toString() {
24913
+ return Object.entries(this.toJSON())
24914
+ .map(([header, value]) => header + ': ' + value)
24915
+ .join('\n');
24916
+ }
24917
+
24918
+ getSetCookie() {
24919
+ return this.get('set-cookie') || [];
24920
+ }
24921
+
24922
+ get [Symbol.toStringTag]() {
24923
+ return 'AxiosHeaders';
24924
+ }
24925
+
24926
+ static from(thing) {
24927
+ return thing instanceof this ? thing : new this(thing);
24872
24928
  }
24873
24929
 
24874
- const _encode = (options && options.encode) || encode;
24930
+ static concat(first, ...targets) {
24931
+ const computed = new this(first);
24875
24932
 
24876
- const _options = utils$1.isFunction(options)
24877
- ? {
24878
- serialize: options,
24879
- }
24880
- : options;
24933
+ targets.forEach((target) => computed.set(target));
24881
24934
 
24882
- const serializeFn = _options && _options.serialize;
24935
+ return computed;
24936
+ }
24883
24937
 
24884
- let serializedParams;
24938
+ static accessor(header) {
24939
+ const internals =
24940
+ (this[$internals] =
24941
+ this[$internals] =
24942
+ {
24943
+ accessors: {},
24944
+ });
24885
24945
 
24886
- if (serializeFn) {
24887
- serializedParams = serializeFn(params, _options);
24888
- } else {
24889
- serializedParams = utils$1.isURLSearchParams(params)
24890
- ? params.toString()
24891
- : new AxiosURLSearchParams(params, _options).toString(_encode);
24892
- }
24946
+ const accessors = internals.accessors;
24947
+ const prototype = this.prototype;
24893
24948
 
24894
- if (serializedParams) {
24895
- const hashmarkIndex = url.indexOf('#');
24949
+ function defineAccessor(_header) {
24950
+ const lHeader = normalizeHeader(_header);
24896
24951
 
24897
- if (hashmarkIndex !== -1) {
24898
- url = url.slice(0, hashmarkIndex);
24952
+ if (!accessors[lHeader]) {
24953
+ buildAccessors(prototype, _header);
24954
+ accessors[lHeader] = true;
24955
+ }
24899
24956
  }
24900
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
24901
- }
24902
24957
 
24903
- return url;
24904
- }
24958
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
24905
24959
 
24906
- class InterceptorManager {
24907
- constructor() {
24908
- this.handlers = [];
24960
+ return this;
24909
24961
  }
24962
+ };
24910
24963
 
24911
- /**
24912
- * Add a new interceptor to the stack
24913
- *
24914
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
24915
- * @param {Function} rejected The function to handle `reject` for a `Promise`
24916
- * @param {Object} options The options for the interceptor, synchronous and runWhen
24917
- *
24918
- * @return {Number} An ID used to remove interceptor later
24919
- */
24920
- use(fulfilled, rejected, options) {
24921
- this.handlers.push({
24922
- fulfilled,
24923
- rejected,
24924
- synchronous: options ? options.synchronous : false,
24925
- runWhen: options ? options.runWhen : null,
24926
- });
24927
- return this.handlers.length - 1;
24928
- }
24964
+ AxiosHeaders$1.accessor([
24965
+ 'Content-Type',
24966
+ 'Content-Length',
24967
+ 'Accept',
24968
+ 'Accept-Encoding',
24969
+ 'User-Agent',
24970
+ 'Authorization',
24971
+ ]);
24929
24972
 
24930
- /**
24931
- * Remove an interceptor from the stack
24932
- *
24933
- * @param {Number} id The ID that was returned by `use`
24934
- *
24935
- * @returns {void}
24936
- */
24937
- eject(id) {
24938
- if (this.handlers[id]) {
24939
- this.handlers[id] = null;
24940
- }
24973
+ // reserved names hotfix
24974
+ utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
24975
+ let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
24976
+ return {
24977
+ get: () => value,
24978
+ set(headerValue) {
24979
+ this[mapped] = headerValue;
24980
+ },
24981
+ };
24982
+ });
24983
+
24984
+ utils$1.freezeMethods(AxiosHeaders$1);
24985
+
24986
+ const REDACTED = '[REDACTED ****]';
24987
+
24988
+ function hasOwnOrPrototypeToJSON(source) {
24989
+ if (utils$1.hasOwnProp(source, 'toJSON')) {
24990
+ return true;
24941
24991
  }
24942
24992
 
24943
- /**
24944
- * Clear all interceptors from the stack
24945
- *
24946
- * @returns {void}
24947
- */
24948
- clear() {
24949
- if (this.handlers) {
24950
- this.handlers = [];
24993
+ let prototype = Object.getPrototypeOf(source);
24994
+
24995
+ while (prototype && prototype !== Object.prototype) {
24996
+ if (utils$1.hasOwnProp(prototype, 'toJSON')) {
24997
+ return true;
24951
24998
  }
24952
- }
24953
24999
 
24954
- /**
24955
- * Iterate over all the registered interceptors
24956
- *
24957
- * This method is particularly useful for skipping over any
24958
- * interceptors that may have become `null` calling `eject`.
24959
- *
24960
- * @param {Function} fn The function to call for each interceptor
24961
- *
24962
- * @returns {void}
24963
- */
24964
- forEach(fn) {
24965
- utils$1.forEach(this.handlers, function forEachHandler(h) {
24966
- if (h !== null) {
24967
- fn(h);
24968
- }
24969
- });
25000
+ prototype = Object.getPrototypeOf(prototype);
24970
25001
  }
25002
+
25003
+ return false;
24971
25004
  }
24972
25005
 
24973
- var transitionalDefaults = {
24974
- silentJSONParsing: true,
24975
- forcedJSONParsing: true,
24976
- clarifyTimeoutError: false,
24977
- legacyInterceptorReqResOrdering: true,
24978
- };
25006
+ // Build a plain-object snapshot of `config` and replace the value of any key
25007
+ // (case-insensitive) listed in `redactKeys` with REDACTED. Walks through arrays
25008
+ // and AxiosHeaders, and short-circuits on circular references.
25009
+ function redactConfig(config, redactKeys) {
25010
+ const lowerKeys = new Set(redactKeys.map((k) => String(k).toLowerCase()));
25011
+ const seen = [];
24979
25012
 
24980
- var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
25013
+ const visit = (source) => {
25014
+ if (source === null || typeof source !== 'object') return source;
25015
+ if (utils$1.isBuffer(source)) return source;
25016
+ if (seen.indexOf(source) !== -1) return undefined;
24981
25017
 
24982
- var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
25018
+ if (source instanceof AxiosHeaders$1) {
25019
+ source = source.toJSON();
25020
+ }
24983
25021
 
24984
- var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
25022
+ seen.push(source);
24985
25023
 
24986
- var platform$1 = {
24987
- isBrowser: true,
24988
- classes: {
24989
- URLSearchParams: URLSearchParams$1,
24990
- FormData: FormData$1,
24991
- Blob: Blob$1,
24992
- },
24993
- protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
24994
- };
25024
+ let result;
25025
+ if (utils$1.isArray(source)) {
25026
+ result = [];
25027
+ source.forEach((v, i) => {
25028
+ const reducedValue = visit(v);
25029
+ if (!utils$1.isUndefined(reducedValue)) {
25030
+ result[i] = reducedValue;
25031
+ }
25032
+ });
25033
+ } else {
25034
+ if (!utils$1.isPlainObject(source) && hasOwnOrPrototypeToJSON(source)) {
25035
+ seen.pop();
25036
+ return source;
25037
+ }
24995
25038
 
24996
- const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
25039
+ result = Object.create(null);
25040
+ for (const [key, value] of Object.entries(source)) {
25041
+ const reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED : visit(value);
25042
+ if (!utils$1.isUndefined(reducedValue)) {
25043
+ result[key] = reducedValue;
25044
+ }
25045
+ }
25046
+ }
24997
25047
 
24998
- const _navigator = (typeof navigator === 'object' && navigator) || undefined;
25048
+ seen.pop();
25049
+ return result;
25050
+ };
24999
25051
 
25000
- /**
25001
- * Determine if we're running in a standard browser environment
25002
- *
25003
- * This allows axios to run in a web worker, and react-native.
25004
- * Both environments support XMLHttpRequest, but not fully standard globals.
25005
- *
25006
- * web workers:
25007
- * typeof window -> undefined
25008
- * typeof document -> undefined
25009
- *
25010
- * react-native:
25011
- * navigator.product -> 'ReactNative'
25012
- * nativescript
25013
- * navigator.product -> 'NativeScript' or 'NS'
25014
- *
25015
- * @returns {boolean}
25016
- */
25017
- const hasStandardBrowserEnv =
25018
- hasBrowserEnv &&
25019
- (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
25052
+ return visit(config);
25053
+ }
25020
25054
 
25021
- /**
25022
- * Determine if we're running in a standard browser webWorker environment
25023
- *
25024
- * Although the `isStandardBrowserEnv` method indicates that
25025
- * `allows axios to run in a web worker`, the WebWorker will still be
25026
- * filtered out due to its judgment standard
25027
- * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
25028
- * This leads to a problem when axios post `FormData` in webWorker
25029
- */
25030
- const hasStandardBrowserWebWorkerEnv = (() => {
25031
- return (
25032
- typeof WorkerGlobalScope !== 'undefined' &&
25033
- // eslint-disable-next-line no-undef
25034
- self instanceof WorkerGlobalScope &&
25035
- typeof self.importScripts === 'function'
25036
- );
25037
- })();
25055
+ let AxiosError$1 = class AxiosError extends Error {
25056
+ static from(error, code, config, request, response, customProps) {
25057
+ const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
25058
+ axiosError.cause = error;
25059
+ axiosError.name = error.name;
25038
25060
 
25039
- const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
25061
+ // Preserve status from the original error if not already set from response
25062
+ if (error.status != null && axiosError.status == null) {
25063
+ axiosError.status = error.status;
25064
+ }
25040
25065
 
25041
- var utils$2 = /*#__PURE__*/Object.freeze({
25042
- __proto__: null,
25043
- hasBrowserEnv: hasBrowserEnv,
25044
- hasStandardBrowserEnv: hasStandardBrowserEnv,
25045
- hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
25046
- navigator: _navigator,
25047
- origin: origin
25048
- });
25066
+ customProps && Object.assign(axiosError, customProps);
25067
+ return axiosError;
25068
+ }
25049
25069
 
25050
- var platform = {
25051
- ...utils$2,
25052
- ...platform$1,
25070
+ /**
25071
+ * Create an Error with the specified message, config, error code, request and response.
25072
+ *
25073
+ * @param {string} message The error message.
25074
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
25075
+ * @param {Object} [config] The config.
25076
+ * @param {Object} [request] The request.
25077
+ * @param {Object} [response] The response.
25078
+ *
25079
+ * @returns {Error} The created error.
25080
+ */
25081
+ constructor(message, code, config, request, response) {
25082
+ super(message);
25083
+
25084
+ // Make message enumerable to maintain backward compatibility
25085
+ // The native Error constructor sets message as non-enumerable,
25086
+ // but axios < v1.13.3 had it as enumerable
25087
+ Object.defineProperty(this, 'message', {
25088
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
25089
+ // this data descriptor into an accessor descriptor on the way in.
25090
+ __proto__: null,
25091
+ value: message,
25092
+ enumerable: true,
25093
+ writable: true,
25094
+ configurable: true,
25095
+ });
25096
+
25097
+ this.name = 'AxiosError';
25098
+ this.isAxiosError = true;
25099
+ code && (this.code = code);
25100
+ config && (this.config = config);
25101
+ request && (this.request = request);
25102
+ if (response) {
25103
+ this.response = response;
25104
+ this.status = response.status;
25105
+ }
25106
+ }
25107
+
25108
+ toJSON() {
25109
+ // Opt-in redaction: when the request config carries a `redact` array, the
25110
+ // value of any matching key (case-insensitive, at any depth) is replaced
25111
+ // with REDACTED in the serialized snapshot. Undefined or empty leaves the
25112
+ // existing serialization behavior unchanged.
25113
+ const config = this.config;
25114
+ const redactKeys = config && utils$1.hasOwnProp(config, 'redact') ? config.redact : undefined;
25115
+ const serializedConfig =
25116
+ utils$1.isArray(redactKeys) && redactKeys.length > 0
25117
+ ? redactConfig(config, redactKeys)
25118
+ : utils$1.toJSONObject(config);
25119
+
25120
+ return {
25121
+ // Standard
25122
+ message: this.message,
25123
+ name: this.name,
25124
+ // Microsoft
25125
+ description: this.description,
25126
+ number: this.number,
25127
+ // Mozilla
25128
+ fileName: this.fileName,
25129
+ lineNumber: this.lineNumber,
25130
+ columnNumber: this.columnNumber,
25131
+ stack: this.stack,
25132
+ // Axios
25133
+ config: serializedConfig,
25134
+ code: this.code,
25135
+ status: this.status,
25136
+ };
25137
+ }
25053
25138
  };
25054
25139
 
25055
- function toURLEncodedForm(data, options) {
25056
- return toFormData$1(data, new platform.classes.URLSearchParams(), {
25057
- visitor: function (value, key, path, helpers) {
25058
- if (platform.isNode && utils$1.isBuffer(value)) {
25059
- this.append(key, value.toString('base64'));
25060
- return false;
25061
- }
25140
+ // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
25141
+ AxiosError$1.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
25142
+ AxiosError$1.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
25143
+ AxiosError$1.ECONNABORTED = 'ECONNABORTED';
25144
+ AxiosError$1.ETIMEDOUT = 'ETIMEDOUT';
25145
+ AxiosError$1.ECONNREFUSED = 'ECONNREFUSED';
25146
+ AxiosError$1.ERR_NETWORK = 'ERR_NETWORK';
25147
+ AxiosError$1.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
25148
+ AxiosError$1.ERR_DEPRECATED = 'ERR_DEPRECATED';
25149
+ AxiosError$1.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
25150
+ AxiosError$1.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
25151
+ AxiosError$1.ERR_CANCELED = 'ERR_CANCELED';
25152
+ AxiosError$1.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
25153
+ AxiosError$1.ERR_INVALID_URL = 'ERR_INVALID_URL';
25154
+ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
25155
+
25156
+ // eslint-disable-next-line strict
25157
+ var httpAdapter = null;
25062
25158
 
25063
- return helpers.defaultVisitor.apply(this, arguments);
25064
- },
25065
- ...options,
25066
- });
25159
+ /**
25160
+ * Determines if the given thing is a array or js object.
25161
+ *
25162
+ * @param {string} thing - The object or array to be visited.
25163
+ *
25164
+ * @returns {boolean}
25165
+ */
25166
+ function isVisitable(thing) {
25167
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
25067
25168
  }
25068
25169
 
25069
25170
  /**
25070
- * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
25171
+ * It removes the brackets from the end of a string
25071
25172
  *
25072
- * @param {string} name - The name of the property to get.
25173
+ * @param {string} key - The key of the parameter.
25073
25174
  *
25074
- * @returns An array of strings.
25175
+ * @returns {string} the key without the brackets.
25075
25176
  */
25076
- function parsePropPath(name) {
25077
- // foo[x][y][z]
25078
- // foo.x.y.z
25079
- // foo-x-y-z
25080
- // foo x y z
25081
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
25082
- return match[0] === '[]' ? '' : match[1] || match[0];
25083
- });
25177
+ function removeBrackets(key) {
25178
+ return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
25084
25179
  }
25085
25180
 
25086
25181
  /**
25087
- * Convert an array to an object.
25182
+ * It takes a path, a key, and a boolean, and returns a string
25088
25183
  *
25089
- * @param {Array<any>} arr - The array to convert to an object.
25184
+ * @param {string} path - The path to the current key.
25185
+ * @param {string} key - The key of the current object being iterated over.
25186
+ * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
25090
25187
  *
25091
- * @returns An object with the same keys and values as the array.
25188
+ * @returns {string} The path to the current key.
25092
25189
  */
25093
- function arrayToObject(arr) {
25094
- const obj = {};
25095
- const keys = Object.keys(arr);
25096
- let i;
25097
- const len = keys.length;
25098
- let key;
25099
- for (i = 0; i < len; i++) {
25100
- key = keys[i];
25101
- obj[key] = arr[key];
25102
- }
25103
- return obj;
25190
+ function renderKey(path, key, dots) {
25191
+ if (!path) return key;
25192
+ return path
25193
+ .concat(key)
25194
+ .map(function each(token, i) {
25195
+ // eslint-disable-next-line no-param-reassign
25196
+ token = removeBrackets(token);
25197
+ return !dots && i ? '[' + token + ']' : token;
25198
+ })
25199
+ .join(dots ? '.' : '');
25104
25200
  }
25105
25201
 
25106
25202
  /**
25107
- * It takes a FormData object and returns a JavaScript object
25203
+ * If the array is an array and none of its elements are visitable, then it's a flat array.
25108
25204
  *
25109
- * @param {string} formData The FormData object to convert to JSON.
25205
+ * @param {Array<any>} arr - The array to check
25110
25206
  *
25111
- * @returns {Object<string, any> | null} The converted object.
25207
+ * @returns {boolean}
25112
25208
  */
25113
- function formDataToJSON(formData) {
25114
- function buildPath(path, value, target, index) {
25115
- let name = path[index++];
25116
-
25117
- if (name === '__proto__') return true;
25118
-
25119
- const isNumericKey = Number.isFinite(+name);
25120
- const isLast = index >= path.length;
25121
- name = !name && utils$1.isArray(target) ? target.length : name;
25122
-
25123
- if (isLast) {
25124
- if (utils$1.hasOwnProp(target, name)) {
25125
- target[name] = [target[name], value];
25126
- } else {
25127
- target[name] = value;
25128
- }
25129
-
25130
- return !isNumericKey;
25131
- }
25132
-
25133
- if (!target[name] || !utils$1.isObject(target[name])) {
25134
- target[name] = [];
25135
- }
25136
-
25137
- const result = buildPath(path, value, target[name], index);
25138
-
25139
- if (result && utils$1.isArray(target[name])) {
25140
- target[name] = arrayToObject(target[name]);
25141
- }
25142
-
25143
- return !isNumericKey;
25144
- }
25145
-
25146
- if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
25147
- const obj = {};
25148
-
25149
- utils$1.forEachEntry(formData, (name, value) => {
25150
- buildPath(parsePropPath(name), value, obj, 0);
25151
- });
25209
+ function isFlatArray(arr) {
25210
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
25211
+ }
25152
25212
 
25153
- return obj;
25154
- }
25213
+ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
25214
+ return /^is[A-Z]/.test(prop);
25215
+ });
25155
25216
 
25156
- return null;
25157
- }
25217
+ /**
25218
+ * Convert a data object to FormData
25219
+ *
25220
+ * @param {Object} obj
25221
+ * @param {?Object} [formData]
25222
+ * @param {?Object} [options]
25223
+ * @param {Function} [options.visitor]
25224
+ * @param {Boolean} [options.metaTokens = true]
25225
+ * @param {Boolean} [options.dots = false]
25226
+ * @param {?Boolean} [options.indexes = false]
25227
+ *
25228
+ * @returns {Object}
25229
+ **/
25158
25230
 
25159
25231
  /**
25160
- * It takes a string, tries to parse it, and if it fails, it returns the stringified version
25161
- * of the input
25232
+ * It converts an object into a FormData object
25162
25233
  *
25163
- * @param {any} rawValue - The value to be stringified.
25164
- * @param {Function} parser - A function that parses a string into a JavaScript object.
25165
- * @param {Function} encoder - A function that takes a value and returns a string.
25234
+ * @param {Object<any, any>} obj - The object to convert to form data.
25235
+ * @param {string} formData - The FormData object to append to.
25236
+ * @param {Object<string, any>} options
25166
25237
  *
25167
- * @returns {string} A stringified version of the rawValue.
25238
+ * @returns
25168
25239
  */
25169
- function stringifySafely(rawValue, parser, encoder) {
25170
- if (utils$1.isString(rawValue)) {
25171
- try {
25172
- (parser || JSON.parse)(rawValue);
25173
- return utils$1.trim(rawValue);
25174
- } catch (e) {
25175
- if (e.name !== 'SyntaxError') {
25176
- throw e;
25177
- }
25178
- }
25240
+ function toFormData$1(obj, formData, options) {
25241
+ if (!utils$1.isObject(obj)) {
25242
+ throw new TypeError('target must be an object');
25179
25243
  }
25180
25244
 
25181
- return (encoder || JSON.stringify)(rawValue);
25182
- }
25245
+ // eslint-disable-next-line no-param-reassign
25246
+ formData = formData || new (FormData)();
25183
25247
 
25184
- const defaults = {
25185
- transitional: transitionalDefaults,
25248
+ // eslint-disable-next-line no-param-reassign
25249
+ options = utils$1.toFlatObject(
25250
+ options,
25251
+ {
25252
+ metaTokens: true,
25253
+ dots: false,
25254
+ indexes: false,
25255
+ },
25256
+ false,
25257
+ function defined(option, source) {
25258
+ // eslint-disable-next-line no-eq-null,eqeqeq
25259
+ return !utils$1.isUndefined(source[option]);
25260
+ }
25261
+ );
25186
25262
 
25187
- adapter: ['xhr', 'http', 'fetch'],
25263
+ const metaTokens = options.metaTokens;
25264
+ // eslint-disable-next-line no-use-before-define
25265
+ const visitor = options.visitor || defaultVisitor;
25266
+ const dots = options.dots;
25267
+ const indexes = options.indexes;
25268
+ const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
25269
+ const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
25270
+ const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
25188
25271
 
25189
- transformRequest: [
25190
- function transformRequest(data, headers) {
25191
- const contentType = headers.getContentType() || '';
25192
- const hasJSONContentType = contentType.indexOf('application/json') > -1;
25193
- const isObjectPayload = utils$1.isObject(data);
25272
+ if (!utils$1.isFunction(visitor)) {
25273
+ throw new TypeError('visitor must be a function');
25274
+ }
25194
25275
 
25195
- if (isObjectPayload && utils$1.isHTMLForm(data)) {
25196
- data = new FormData(data);
25197
- }
25276
+ function convertValue(value) {
25277
+ if (value === null) return '';
25198
25278
 
25199
- const isFormData = utils$1.isFormData(data);
25279
+ if (utils$1.isDate(value)) {
25280
+ return value.toISOString();
25281
+ }
25200
25282
 
25201
- if (isFormData) {
25202
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
25203
- }
25283
+ if (utils$1.isBoolean(value)) {
25284
+ return value.toString();
25285
+ }
25204
25286
 
25205
- if (
25206
- utils$1.isArrayBuffer(data) ||
25207
- utils$1.isBuffer(data) ||
25208
- utils$1.isStream(data) ||
25209
- utils$1.isFile(data) ||
25210
- utils$1.isBlob(data) ||
25211
- utils$1.isReadableStream(data)
25212
- ) {
25213
- return data;
25214
- }
25215
- if (utils$1.isArrayBufferView(data)) {
25216
- return data.buffer;
25217
- }
25218
- if (utils$1.isURLSearchParams(data)) {
25219
- headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
25220
- return data.toString();
25221
- }
25287
+ if (!useBlob && utils$1.isBlob(value)) {
25288
+ throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
25289
+ }
25222
25290
 
25223
- let isFileList;
25291
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
25292
+ return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
25293
+ }
25294
+
25295
+ return value;
25296
+ }
25297
+
25298
+ /**
25299
+ * Default visitor.
25300
+ *
25301
+ * @param {*} value
25302
+ * @param {String|Number} key
25303
+ * @param {Array<String|Number>} path
25304
+ * @this {FormData}
25305
+ *
25306
+ * @returns {boolean} return true to visit the each prop of the value recursively
25307
+ */
25308
+ function defaultVisitor(value, key, path) {
25309
+ let arr = value;
25224
25310
 
25225
- if (isObjectPayload) {
25226
- if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
25227
- return toURLEncodedForm(data, this.formSerializer).toString();
25228
- }
25311
+ if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
25312
+ formData.append(renderKey(path, key, dots), convertValue(value));
25313
+ return false;
25314
+ }
25229
25315
 
25230
- if (
25231
- (isFileList = utils$1.isFileList(data)) ||
25232
- contentType.indexOf('multipart/form-data') > -1
25233
- ) {
25234
- const _FormData = this.env && this.env.FormData;
25316
+ if (value && !path && typeof value === 'object') {
25317
+ if (utils$1.endsWith(key, '{}')) {
25318
+ // eslint-disable-next-line no-param-reassign
25319
+ key = metaTokens ? key : key.slice(0, -2);
25320
+ // eslint-disable-next-line no-param-reassign
25321
+ value = JSON.stringify(value);
25322
+ } else if (
25323
+ (utils$1.isArray(value) && isFlatArray(value)) ||
25324
+ ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
25325
+ ) {
25326
+ // eslint-disable-next-line no-param-reassign
25327
+ key = removeBrackets(key);
25235
25328
 
25236
- return toFormData$1(
25237
- isFileList ? { 'files[]': data } : data,
25238
- _FormData && new _FormData(),
25239
- this.formSerializer
25240
- );
25241
- }
25329
+ arr.forEach(function each(el, index) {
25330
+ !(utils$1.isUndefined(el) || el === null) &&
25331
+ formData.append(
25332
+ // eslint-disable-next-line no-nested-ternary
25333
+ indexes === true
25334
+ ? renderKey([key], index, dots)
25335
+ : indexes === null
25336
+ ? key
25337
+ : key + '[]',
25338
+ convertValue(el)
25339
+ );
25340
+ });
25341
+ return false;
25242
25342
  }
25343
+ }
25243
25344
 
25244
- if (isObjectPayload || hasJSONContentType) {
25245
- headers.setContentType('application/json', false);
25246
- return stringifySafely(data);
25247
- }
25345
+ if (isVisitable(value)) {
25346
+ return true;
25347
+ }
25248
25348
 
25249
- return data;
25250
- },
25251
- ],
25349
+ formData.append(renderKey(path, key, dots), convertValue(value));
25252
25350
 
25253
- transformResponse: [
25254
- function transformResponse(data) {
25255
- const transitional = this.transitional || defaults.transitional;
25256
- const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
25257
- const JSONRequested = this.responseType === 'json';
25351
+ return false;
25352
+ }
25258
25353
 
25259
- if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
25260
- return data;
25261
- }
25354
+ const stack = [];
25262
25355
 
25263
- if (
25264
- data &&
25265
- utils$1.isString(data) &&
25266
- ((forcedJSONParsing && !this.responseType) || JSONRequested)
25267
- ) {
25268
- const silentJSONParsing = transitional && transitional.silentJSONParsing;
25269
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
25356
+ const exposedHelpers = Object.assign(predicates, {
25357
+ defaultVisitor,
25358
+ convertValue,
25359
+ isVisitable,
25360
+ });
25270
25361
 
25271
- try {
25272
- return JSON.parse(data, this.parseReviver);
25273
- } catch (e) {
25274
- if (strictJSONParsing) {
25275
- if (e.name === 'SyntaxError') {
25276
- throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
25277
- }
25278
- throw e;
25279
- }
25280
- }
25281
- }
25362
+ function build(value, path, depth = 0) {
25363
+ if (utils$1.isUndefined(value)) return;
25282
25364
 
25283
- return data;
25284
- },
25285
- ],
25365
+ if (depth > maxDepth) {
25366
+ throw new AxiosError$1(
25367
+ 'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
25368
+ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
25369
+ );
25370
+ }
25286
25371
 
25287
- /**
25288
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
25289
- * timeout is not created.
25290
- */
25291
- timeout: 0,
25372
+ if (stack.indexOf(value) !== -1) {
25373
+ throw Error('Circular reference detected in ' + path.join('.'));
25374
+ }
25292
25375
 
25293
- xsrfCookieName: 'XSRF-TOKEN',
25294
- xsrfHeaderName: 'X-XSRF-TOKEN',
25376
+ stack.push(value);
25295
25377
 
25296
- maxContentLength: -1,
25297
- maxBodyLength: -1,
25378
+ utils$1.forEach(value, function each(el, key) {
25379
+ const result =
25380
+ !(utils$1.isUndefined(el) || el === null) &&
25381
+ visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
25298
25382
 
25299
- env: {
25300
- FormData: platform.classes.FormData,
25301
- Blob: platform.classes.Blob,
25302
- },
25383
+ if (result === true) {
25384
+ build(el, path ? path.concat(key) : [key], depth + 1);
25385
+ }
25386
+ });
25303
25387
 
25304
- validateStatus: function validateStatus(status) {
25305
- return status >= 200 && status < 300;
25306
- },
25388
+ stack.pop();
25389
+ }
25307
25390
 
25308
- headers: {
25309
- common: {
25310
- Accept: 'application/json, text/plain, */*',
25311
- 'Content-Type': undefined,
25312
- },
25313
- },
25314
- };
25391
+ if (!utils$1.isObject(obj)) {
25392
+ throw new TypeError('data must be an object');
25393
+ }
25315
25394
 
25316
- utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
25317
- defaults.headers[method] = {};
25318
- });
25395
+ build(obj);
25319
25396
 
25320
- // RawAxiosHeaders whose duplicates are ignored by node
25321
- // c.f. https://nodejs.org/api/http.html#http_message_headers
25322
- const ignoreDuplicateOf = utils$1.toObjectSet([
25323
- 'age',
25324
- 'authorization',
25325
- 'content-length',
25326
- 'content-type',
25327
- 'etag',
25328
- 'expires',
25329
- 'from',
25330
- 'host',
25331
- 'if-modified-since',
25332
- 'if-unmodified-since',
25333
- 'last-modified',
25334
- 'location',
25335
- 'max-forwards',
25336
- 'proxy-authorization',
25337
- 'referer',
25338
- 'retry-after',
25339
- 'user-agent',
25340
- ]);
25397
+ return formData;
25398
+ }
25341
25399
 
25342
25400
  /**
25343
- * Parse headers into an object
25344
- *
25345
- * ```
25346
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
25347
- * Content-Type: application/json
25348
- * Connection: keep-alive
25349
- * Transfer-Encoding: chunked
25350
- * ```
25401
+ * It encodes a string by replacing all characters that are not in the unreserved set with
25402
+ * their percent-encoded equivalents
25351
25403
  *
25352
- * @param {String} rawHeaders Headers needing to be parsed
25404
+ * @param {string} str - The string to encode.
25353
25405
  *
25354
- * @returns {Object} Headers parsed into an object
25406
+ * @returns {string} The encoded string.
25355
25407
  */
25356
- var parseHeaders = (rawHeaders) => {
25357
- const parsed = {};
25358
- let key;
25359
- let val;
25360
- let i;
25408
+ function encode$1(str) {
25409
+ const charMap = {
25410
+ '!': '%21',
25411
+ "'": '%27',
25412
+ '(': '%28',
25413
+ ')': '%29',
25414
+ '~': '%7E',
25415
+ '%20': '+',
25416
+ };
25417
+ return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
25418
+ return charMap[match];
25419
+ });
25420
+ }
25361
25421
 
25362
- rawHeaders &&
25363
- rawHeaders.split('\n').forEach(function parser(line) {
25364
- i = line.indexOf(':');
25365
- key = line.substring(0, i).trim().toLowerCase();
25366
- val = line.substring(i + 1).trim();
25422
+ /**
25423
+ * It takes a params object and converts it to a FormData object
25424
+ *
25425
+ * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
25426
+ * @param {Object<string, any>} options - The options object passed to the Axios constructor.
25427
+ *
25428
+ * @returns {void}
25429
+ */
25430
+ function AxiosURLSearchParams(params, options) {
25431
+ this._pairs = [];
25367
25432
 
25368
- if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
25369
- return;
25370
- }
25433
+ params && toFormData$1(params, this, options);
25434
+ }
25371
25435
 
25372
- if (key === 'set-cookie') {
25373
- if (parsed[key]) {
25374
- parsed[key].push(val);
25375
- } else {
25376
- parsed[key] = [val];
25377
- }
25378
- } else {
25379
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
25380
- }
25381
- });
25436
+ const prototype = AxiosURLSearchParams.prototype;
25382
25437
 
25383
- return parsed;
25438
+ prototype.append = function append(name, value) {
25439
+ this._pairs.push([name, value]);
25384
25440
  };
25385
25441
 
25386
- const $internals = Symbol('internals');
25387
-
25388
- const isValidHeaderValue = (value) => !/[\r\n]/.test(value);
25389
-
25390
- function assertValidHeaderValue(value, header) {
25391
- if (value === false || value == null) {
25392
- return;
25393
- }
25394
-
25395
- if (utils$1.isArray(value)) {
25396
- value.forEach((v) => assertValidHeaderValue(v, header));
25397
- return;
25398
- }
25442
+ prototype.toString = function toString(encoder) {
25443
+ const _encode = encoder
25444
+ ? function (value) {
25445
+ return encoder.call(this, value, encode$1);
25446
+ }
25447
+ : encode$1;
25399
25448
 
25400
- if (!isValidHeaderValue(String(value))) {
25401
- throw new Error(`Invalid character in header content ["${header}"]`);
25402
- }
25403
- }
25449
+ return this._pairs
25450
+ .map(function each(pair) {
25451
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
25452
+ }, '')
25453
+ .join('&');
25454
+ };
25404
25455
 
25405
- function normalizeHeader(header) {
25406
- return header && String(header).trim().toLowerCase();
25456
+ /**
25457
+ * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
25458
+ * their plain counterparts (`:`, `$`, `,`, `+`).
25459
+ *
25460
+ * @param {string} val The value to be encoded.
25461
+ *
25462
+ * @returns {string} The encoded value.
25463
+ */
25464
+ function encode(val) {
25465
+ return encodeURIComponent(val)
25466
+ .replace(/%3A/gi, ':')
25467
+ .replace(/%24/g, '$')
25468
+ .replace(/%2C/gi, ',')
25469
+ .replace(/%20/g, '+');
25407
25470
  }
25408
25471
 
25409
- function stripTrailingCRLF(str) {
25410
- let end = str.length;
25472
+ /**
25473
+ * Build a URL by appending params to the end
25474
+ *
25475
+ * @param {string} url The base of the url (e.g., http://www.google.com)
25476
+ * @param {object} [params] The params to be appended
25477
+ * @param {?(object|Function)} options
25478
+ *
25479
+ * @returns {string} The formatted url
25480
+ */
25481
+ function buildURL(url, params, options) {
25482
+ if (!params) {
25483
+ return url;
25484
+ }
25411
25485
 
25412
- while (end > 0) {
25413
- const charCode = str.charCodeAt(end - 1);
25486
+ const _encode = (options && options.encode) || encode;
25414
25487
 
25415
- if (charCode !== 10 && charCode !== 13) {
25416
- break;
25417
- }
25488
+ const _options = utils$1.isFunction(options)
25489
+ ? {
25490
+ serialize: options,
25491
+ }
25492
+ : options;
25418
25493
 
25419
- end -= 1;
25420
- }
25494
+ const serializeFn = _options && _options.serialize;
25421
25495
 
25422
- return end === str.length ? str : str.slice(0, end);
25423
- }
25496
+ let serializedParams;
25424
25497
 
25425
- function normalizeValue(value) {
25426
- if (value === false || value == null) {
25427
- return value;
25498
+ if (serializeFn) {
25499
+ serializedParams = serializeFn(params, _options);
25500
+ } else {
25501
+ serializedParams = utils$1.isURLSearchParams(params)
25502
+ ? params.toString()
25503
+ : new AxiosURLSearchParams(params, _options).toString(_encode);
25428
25504
  }
25429
25505
 
25430
- return utils$1.isArray(value) ? value.map(normalizeValue) : stripTrailingCRLF(String(value));
25431
- }
25432
-
25433
- function parseTokens(str) {
25434
- const tokens = Object.create(null);
25435
- const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
25436
- let match;
25506
+ if (serializedParams) {
25507
+ const hashmarkIndex = url.indexOf('#');
25437
25508
 
25438
- while ((match = tokensRE.exec(str))) {
25439
- tokens[match[1]] = match[2];
25509
+ if (hashmarkIndex !== -1) {
25510
+ url = url.slice(0, hashmarkIndex);
25511
+ }
25512
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
25440
25513
  }
25441
25514
 
25442
- return tokens;
25515
+ return url;
25443
25516
  }
25444
25517
 
25445
- const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
25446
-
25447
- function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
25448
- if (utils$1.isFunction(filter)) {
25449
- return filter.call(this, value, header);
25518
+ class InterceptorManager {
25519
+ constructor() {
25520
+ this.handlers = [];
25450
25521
  }
25451
25522
 
25452
- if (isHeaderNameFilter) {
25453
- value = header;
25523
+ /**
25524
+ * Add a new interceptor to the stack
25525
+ *
25526
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
25527
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
25528
+ * @param {Object} options The options for the interceptor, synchronous and runWhen
25529
+ *
25530
+ * @return {Number} An ID used to remove interceptor later
25531
+ */
25532
+ use(fulfilled, rejected, options) {
25533
+ this.handlers.push({
25534
+ fulfilled,
25535
+ rejected,
25536
+ synchronous: options ? options.synchronous : false,
25537
+ runWhen: options ? options.runWhen : null,
25538
+ });
25539
+ return this.handlers.length - 1;
25454
25540
  }
25455
25541
 
25456
- if (!utils$1.isString(value)) return;
25457
-
25458
- if (utils$1.isString(filter)) {
25459
- return value.indexOf(filter) !== -1;
25542
+ /**
25543
+ * Remove an interceptor from the stack
25544
+ *
25545
+ * @param {Number} id The ID that was returned by `use`
25546
+ *
25547
+ * @returns {void}
25548
+ */
25549
+ eject(id) {
25550
+ if (this.handlers[id]) {
25551
+ this.handlers[id] = null;
25552
+ }
25460
25553
  }
25461
25554
 
25462
- if (utils$1.isRegExp(filter)) {
25463
- return filter.test(value);
25555
+ /**
25556
+ * Clear all interceptors from the stack
25557
+ *
25558
+ * @returns {void}
25559
+ */
25560
+ clear() {
25561
+ if (this.handlers) {
25562
+ this.handlers = [];
25563
+ }
25464
25564
  }
25465
- }
25466
-
25467
- function formatHeader(header) {
25468
- return header
25469
- .trim()
25470
- .toLowerCase()
25471
- .replace(/([a-z\d])(\w*)/g, (w, char, str) => {
25472
- return char.toUpperCase() + str;
25473
- });
25474
- }
25475
-
25476
- function buildAccessors(obj, header) {
25477
- const accessorName = utils$1.toCamelCase(' ' + header);
25478
25565
 
25479
- ['get', 'set', 'has'].forEach((methodName) => {
25480
- Object.defineProperty(obj, methodName + accessorName, {
25481
- value: function (arg1, arg2, arg3) {
25482
- return this[methodName].call(this, header, arg1, arg2, arg3);
25483
- },
25484
- configurable: true,
25566
+ /**
25567
+ * Iterate over all the registered interceptors
25568
+ *
25569
+ * This method is particularly useful for skipping over any
25570
+ * interceptors that may have become `null` calling `eject`.
25571
+ *
25572
+ * @param {Function} fn The function to call for each interceptor
25573
+ *
25574
+ * @returns {void}
25575
+ */
25576
+ forEach(fn) {
25577
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
25578
+ if (h !== null) {
25579
+ fn(h);
25580
+ }
25485
25581
  });
25486
- });
25487
- }
25488
-
25489
- let AxiosHeaders$1 = class AxiosHeaders {
25490
- constructor(headers) {
25491
- headers && this.set(headers);
25492
25582
  }
25583
+ }
25493
25584
 
25494
- set(header, valueOrRewrite, rewrite) {
25495
- const self = this;
25496
-
25497
- function setHeader(_value, _header, _rewrite) {
25498
- const lHeader = normalizeHeader(_header);
25499
-
25500
- if (!lHeader) {
25501
- throw new Error('header name must be a non-empty string');
25502
- }
25503
-
25504
- const key = utils$1.findKey(self, lHeader);
25505
-
25506
- if (
25507
- !key ||
25508
- self[key] === undefined ||
25509
- _rewrite === true ||
25510
- (_rewrite === undefined && self[key] !== false)
25511
- ) {
25512
- assertValidHeaderValue(_value, _header);
25513
- self[key || _header] = normalizeValue(_value);
25514
- }
25515
- }
25516
-
25517
- const setHeaders = (headers, _rewrite) =>
25518
- utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
25585
+ var transitionalDefaults = {
25586
+ silentJSONParsing: true,
25587
+ forcedJSONParsing: true,
25588
+ clarifyTimeoutError: false,
25589
+ legacyInterceptorReqResOrdering: true,
25590
+ };
25519
25591
 
25520
- if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
25521
- setHeaders(header, valueOrRewrite);
25522
- } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
25523
- setHeaders(parseHeaders(header), valueOrRewrite);
25524
- } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
25525
- let obj = {},
25526
- dest,
25527
- key;
25528
- for (const entry of header) {
25529
- if (!utils$1.isArray(entry)) {
25530
- throw TypeError('Object iterator must return a key-value pair');
25531
- }
25592
+ var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
25532
25593
 
25533
- obj[(key = entry[0])] = (dest = obj[key])
25534
- ? utils$1.isArray(dest)
25535
- ? [...dest, entry[1]]
25536
- : [dest, entry[1]]
25537
- : entry[1];
25538
- }
25594
+ var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
25539
25595
 
25540
- setHeaders(obj, valueOrRewrite);
25541
- } else {
25542
- header != null && setHeader(valueOrRewrite, header, rewrite);
25543
- }
25596
+ var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
25544
25597
 
25545
- return this;
25546
- }
25598
+ var platform$1 = {
25599
+ isBrowser: true,
25600
+ classes: {
25601
+ URLSearchParams: URLSearchParams$1,
25602
+ FormData: FormData$1,
25603
+ Blob: Blob$1,
25604
+ },
25605
+ protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
25606
+ };
25547
25607
 
25548
- get(header, parser) {
25549
- header = normalizeHeader(header);
25608
+ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
25550
25609
 
25551
- if (header) {
25552
- const key = utils$1.findKey(this, header);
25610
+ const _navigator = (typeof navigator === 'object' && navigator) || undefined;
25553
25611
 
25554
- if (key) {
25555
- const value = this[key];
25612
+ /**
25613
+ * Determine if we're running in a standard browser environment
25614
+ *
25615
+ * This allows axios to run in a web worker, and react-native.
25616
+ * Both environments support XMLHttpRequest, but not fully standard globals.
25617
+ *
25618
+ * web workers:
25619
+ * typeof window -> undefined
25620
+ * typeof document -> undefined
25621
+ *
25622
+ * react-native:
25623
+ * navigator.product -> 'ReactNative'
25624
+ * nativescript
25625
+ * navigator.product -> 'NativeScript' or 'NS'
25626
+ *
25627
+ * @returns {boolean}
25628
+ */
25629
+ const hasStandardBrowserEnv =
25630
+ hasBrowserEnv &&
25631
+ (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
25556
25632
 
25557
- if (!parser) {
25558
- return value;
25559
- }
25633
+ /**
25634
+ * Determine if we're running in a standard browser webWorker environment
25635
+ *
25636
+ * Although the `isStandardBrowserEnv` method indicates that
25637
+ * `allows axios to run in a web worker`, the WebWorker will still be
25638
+ * filtered out due to its judgment standard
25639
+ * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
25640
+ * This leads to a problem when axios post `FormData` in webWorker
25641
+ */
25642
+ const hasStandardBrowserWebWorkerEnv = (() => {
25643
+ return (
25644
+ typeof WorkerGlobalScope !== 'undefined' &&
25645
+ // eslint-disable-next-line no-undef
25646
+ self instanceof WorkerGlobalScope &&
25647
+ typeof self.importScripts === 'function'
25648
+ );
25649
+ })();
25560
25650
 
25561
- if (parser === true) {
25562
- return parseTokens(value);
25563
- }
25651
+ const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
25564
25652
 
25565
- if (utils$1.isFunction(parser)) {
25566
- return parser.call(this, value, key);
25567
- }
25653
+ var utils$2 = /*#__PURE__*/Object.freeze({
25654
+ __proto__: null,
25655
+ hasBrowserEnv: hasBrowserEnv,
25656
+ hasStandardBrowserEnv: hasStandardBrowserEnv,
25657
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
25658
+ navigator: _navigator,
25659
+ origin: origin
25660
+ });
25568
25661
 
25569
- if (utils$1.isRegExp(parser)) {
25570
- return parser.exec(value);
25571
- }
25662
+ var platform = {
25663
+ ...utils$2,
25664
+ ...platform$1,
25665
+ };
25572
25666
 
25573
- throw new TypeError('parser must be boolean|regexp|function');
25667
+ function toURLEncodedForm(data, options) {
25668
+ return toFormData$1(data, new platform.classes.URLSearchParams(), {
25669
+ visitor: function (value, key, path, helpers) {
25670
+ if (platform.isNode && utils$1.isBuffer(value)) {
25671
+ this.append(key, value.toString('base64'));
25672
+ return false;
25574
25673
  }
25575
- }
25576
- }
25577
-
25578
- has(header, matcher) {
25579
- header = normalizeHeader(header);
25580
25674
 
25581
- if (header) {
25582
- const key = utils$1.findKey(this, header);
25675
+ return helpers.defaultVisitor.apply(this, arguments);
25676
+ },
25677
+ ...options,
25678
+ });
25679
+ }
25583
25680
 
25584
- return !!(
25585
- key &&
25586
- this[key] !== undefined &&
25587
- (!matcher || matchHeaderValue(this, this[key], key, matcher))
25588
- );
25589
- }
25681
+ /**
25682
+ * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
25683
+ *
25684
+ * @param {string} name - The name of the property to get.
25685
+ *
25686
+ * @returns An array of strings.
25687
+ */
25688
+ function parsePropPath(name) {
25689
+ // foo[x][y][z]
25690
+ // foo.x.y.z
25691
+ // foo-x-y-z
25692
+ // foo x y z
25693
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
25694
+ return match[0] === '[]' ? '' : match[1] || match[0];
25695
+ });
25696
+ }
25590
25697
 
25591
- return false;
25698
+ /**
25699
+ * Convert an array to an object.
25700
+ *
25701
+ * @param {Array<any>} arr - The array to convert to an object.
25702
+ *
25703
+ * @returns An object with the same keys and values as the array.
25704
+ */
25705
+ function arrayToObject(arr) {
25706
+ const obj = {};
25707
+ const keys = Object.keys(arr);
25708
+ let i;
25709
+ const len = keys.length;
25710
+ let key;
25711
+ for (i = 0; i < len; i++) {
25712
+ key = keys[i];
25713
+ obj[key] = arr[key];
25592
25714
  }
25715
+ return obj;
25716
+ }
25593
25717
 
25594
- delete(header, matcher) {
25595
- const self = this;
25596
- let deleted = false;
25597
-
25598
- function deleteHeader(_header) {
25599
- _header = normalizeHeader(_header);
25718
+ /**
25719
+ * It takes a FormData object and returns a JavaScript object
25720
+ *
25721
+ * @param {string} formData The FormData object to convert to JSON.
25722
+ *
25723
+ * @returns {Object<string, any> | null} The converted object.
25724
+ */
25725
+ function formDataToJSON(formData) {
25726
+ function buildPath(path, value, target, index) {
25727
+ let name = path[index++];
25600
25728
 
25601
- if (_header) {
25602
- const key = utils$1.findKey(self, _header);
25729
+ if (name === '__proto__') return true;
25603
25730
 
25604
- if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
25605
- delete self[key];
25731
+ const isNumericKey = Number.isFinite(+name);
25732
+ const isLast = index >= path.length;
25733
+ name = !name && utils$1.isArray(target) ? target.length : name;
25606
25734
 
25607
- deleted = true;
25608
- }
25735
+ if (isLast) {
25736
+ if (utils$1.hasOwnProp(target, name)) {
25737
+ target[name] = utils$1.isArray(target[name])
25738
+ ? target[name].concat(value)
25739
+ : [target[name], value];
25740
+ } else {
25741
+ target[name] = value;
25609
25742
  }
25743
+
25744
+ return !isNumericKey;
25610
25745
  }
25611
25746
 
25612
- if (utils$1.isArray(header)) {
25613
- header.forEach(deleteHeader);
25614
- } else {
25615
- deleteHeader(header);
25747
+ if (!target[name] || !utils$1.isObject(target[name])) {
25748
+ target[name] = [];
25616
25749
  }
25617
25750
 
25618
- return deleted;
25751
+ const result = buildPath(path, value, target[name], index);
25752
+
25753
+ if (result && utils$1.isArray(target[name])) {
25754
+ target[name] = arrayToObject(target[name]);
25755
+ }
25756
+
25757
+ return !isNumericKey;
25619
25758
  }
25620
25759
 
25621
- clear(matcher) {
25622
- const keys = Object.keys(this);
25623
- let i = keys.length;
25624
- let deleted = false;
25760
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
25761
+ const obj = {};
25625
25762
 
25626
- while (i--) {
25627
- const key = keys[i];
25628
- if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
25629
- delete this[key];
25630
- deleted = true;
25631
- }
25632
- }
25763
+ utils$1.forEachEntry(formData, (name, value) => {
25764
+ buildPath(parsePropPath(name), value, obj, 0);
25765
+ });
25633
25766
 
25634
- return deleted;
25767
+ return obj;
25635
25768
  }
25636
25769
 
25637
- normalize(format) {
25638
- const self = this;
25639
- const headers = {};
25770
+ return null;
25771
+ }
25640
25772
 
25641
- utils$1.forEach(this, (value, header) => {
25642
- const key = utils$1.findKey(headers, header);
25773
+ const own = (obj, key) => (obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined);
25643
25774
 
25644
- if (key) {
25645
- self[key] = normalizeValue(value);
25646
- delete self[header];
25647
- return;
25775
+ /**
25776
+ * It takes a string, tries to parse it, and if it fails, it returns the stringified version
25777
+ * of the input
25778
+ *
25779
+ * @param {any} rawValue - The value to be stringified.
25780
+ * @param {Function} parser - A function that parses a string into a JavaScript object.
25781
+ * @param {Function} encoder - A function that takes a value and returns a string.
25782
+ *
25783
+ * @returns {string} A stringified version of the rawValue.
25784
+ */
25785
+ function stringifySafely(rawValue, parser, encoder) {
25786
+ if (utils$1.isString(rawValue)) {
25787
+ try {
25788
+ (parser || JSON.parse)(rawValue);
25789
+ return utils$1.trim(rawValue);
25790
+ } catch (e) {
25791
+ if (e.name !== 'SyntaxError') {
25792
+ throw e;
25648
25793
  }
25794
+ }
25795
+ }
25649
25796
 
25650
- const normalized = format ? formatHeader(header) : String(header).trim();
25797
+ return (encoder || JSON.stringify)(rawValue);
25798
+ }
25651
25799
 
25652
- if (normalized !== header) {
25653
- delete self[header];
25654
- }
25800
+ const defaults = {
25801
+ transitional: transitionalDefaults,
25655
25802
 
25656
- self[normalized] = normalizeValue(value);
25803
+ adapter: ['xhr', 'http', 'fetch'],
25657
25804
 
25658
- headers[normalized] = true;
25659
- });
25805
+ transformRequest: [
25806
+ function transformRequest(data, headers) {
25807
+ const contentType = headers.getContentType() || '';
25808
+ const hasJSONContentType = contentType.indexOf('application/json') > -1;
25809
+ const isObjectPayload = utils$1.isObject(data);
25660
25810
 
25661
- return this;
25662
- }
25811
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
25812
+ data = new FormData(data);
25813
+ }
25663
25814
 
25664
- concat(...targets) {
25665
- return this.constructor.concat(this, ...targets);
25666
- }
25815
+ const isFormData = utils$1.isFormData(data);
25667
25816
 
25668
- toJSON(asStrings) {
25669
- const obj = Object.create(null);
25817
+ if (isFormData) {
25818
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
25819
+ }
25670
25820
 
25671
- utils$1.forEach(this, (value, header) => {
25672
- value != null &&
25673
- value !== false &&
25674
- (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
25675
- });
25821
+ if (
25822
+ utils$1.isArrayBuffer(data) ||
25823
+ utils$1.isBuffer(data) ||
25824
+ utils$1.isStream(data) ||
25825
+ utils$1.isFile(data) ||
25826
+ utils$1.isBlob(data) ||
25827
+ utils$1.isReadableStream(data)
25828
+ ) {
25829
+ return data;
25830
+ }
25831
+ if (utils$1.isArrayBufferView(data)) {
25832
+ return data.buffer;
25833
+ }
25834
+ if (utils$1.isURLSearchParams(data)) {
25835
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
25836
+ return data.toString();
25837
+ }
25676
25838
 
25677
- return obj;
25678
- }
25839
+ let isFileList;
25679
25840
 
25680
- [Symbol.iterator]() {
25681
- return Object.entries(this.toJSON())[Symbol.iterator]();
25682
- }
25841
+ if (isObjectPayload) {
25842
+ const formSerializer = own(this, 'formSerializer');
25843
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
25844
+ return toURLEncodedForm(data, formSerializer).toString();
25845
+ }
25683
25846
 
25684
- toString() {
25685
- return Object.entries(this.toJSON())
25686
- .map(([header, value]) => header + ': ' + value)
25687
- .join('\n');
25688
- }
25847
+ if (
25848
+ (isFileList = utils$1.isFileList(data)) ||
25849
+ contentType.indexOf('multipart/form-data') > -1
25850
+ ) {
25851
+ const env = own(this, 'env');
25852
+ const _FormData = env && env.FormData;
25689
25853
 
25690
- getSetCookie() {
25691
- return this.get('set-cookie') || [];
25692
- }
25854
+ return toFormData$1(
25855
+ isFileList ? { 'files[]': data } : data,
25856
+ _FormData && new _FormData(),
25857
+ formSerializer
25858
+ );
25859
+ }
25860
+ }
25693
25861
 
25694
- get [Symbol.toStringTag]() {
25695
- return 'AxiosHeaders';
25696
- }
25862
+ if (isObjectPayload || hasJSONContentType) {
25863
+ headers.setContentType('application/json', false);
25864
+ return stringifySafely(data);
25865
+ }
25697
25866
 
25698
- static from(thing) {
25699
- return thing instanceof this ? thing : new this(thing);
25700
- }
25867
+ return data;
25868
+ },
25869
+ ],
25701
25870
 
25702
- static concat(first, ...targets) {
25703
- const computed = new this(first);
25871
+ transformResponse: [
25872
+ function transformResponse(data) {
25873
+ const transitional = own(this, 'transitional') || defaults.transitional;
25874
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
25875
+ const responseType = own(this, 'responseType');
25876
+ const JSONRequested = responseType === 'json';
25704
25877
 
25705
- targets.forEach((target) => computed.set(target));
25878
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
25879
+ return data;
25880
+ }
25706
25881
 
25707
- return computed;
25708
- }
25882
+ if (
25883
+ data &&
25884
+ utils$1.isString(data) &&
25885
+ ((forcedJSONParsing && !responseType) || JSONRequested)
25886
+ ) {
25887
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
25888
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
25709
25889
 
25710
- static accessor(header) {
25711
- const internals =
25712
- (this[$internals] =
25713
- this[$internals] =
25714
- {
25715
- accessors: {},
25716
- });
25890
+ try {
25891
+ return JSON.parse(data, own(this, 'parseReviver'));
25892
+ } catch (e) {
25893
+ if (strictJSONParsing) {
25894
+ if (e.name === 'SyntaxError') {
25895
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
25896
+ }
25897
+ throw e;
25898
+ }
25899
+ }
25900
+ }
25717
25901
 
25718
- const accessors = internals.accessors;
25719
- const prototype = this.prototype;
25902
+ return data;
25903
+ },
25904
+ ],
25720
25905
 
25721
- function defineAccessor(_header) {
25722
- const lHeader = normalizeHeader(_header);
25906
+ /**
25907
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
25908
+ * timeout is not created.
25909
+ */
25910
+ timeout: 0,
25723
25911
 
25724
- if (!accessors[lHeader]) {
25725
- buildAccessors(prototype, _header);
25726
- accessors[lHeader] = true;
25727
- }
25728
- }
25912
+ xsrfCookieName: 'XSRF-TOKEN',
25913
+ xsrfHeaderName: 'X-XSRF-TOKEN',
25729
25914
 
25730
- utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
25915
+ maxContentLength: -1,
25916
+ maxBodyLength: -1,
25731
25917
 
25732
- return this;
25733
- }
25734
- };
25918
+ env: {
25919
+ FormData: platform.classes.FormData,
25920
+ Blob: platform.classes.Blob,
25921
+ },
25735
25922
 
25736
- AxiosHeaders$1.accessor([
25737
- 'Content-Type',
25738
- 'Content-Length',
25739
- 'Accept',
25740
- 'Accept-Encoding',
25741
- 'User-Agent',
25742
- 'Authorization',
25743
- ]);
25923
+ validateStatus: function validateStatus(status) {
25924
+ return status >= 200 && status < 300;
25925
+ },
25744
25926
 
25745
- // reserved names hotfix
25746
- utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
25747
- let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
25748
- return {
25749
- get: () => value,
25750
- set(headerValue) {
25751
- this[mapped] = headerValue;
25927
+ headers: {
25928
+ common: {
25929
+ Accept: 'application/json, text/plain, */*',
25930
+ 'Content-Type': undefined,
25752
25931
  },
25753
- };
25754
- });
25932
+ },
25933
+ };
25755
25934
 
25756
- utils$1.freezeMethods(AxiosHeaders$1);
25935
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query'], (method) => {
25936
+ defaults.headers[method] = {};
25937
+ });
25757
25938
 
25758
25939
  /**
25759
25940
  * Transform the data for a request or a response
@@ -25813,22 +25994,18 @@
25813
25994
  if (!response.status || !validateStatus || validateStatus(response.status)) {
25814
25995
  resolve(response);
25815
25996
  } else {
25816
- reject(
25817
- new AxiosError$1(
25818
- 'Request failed with status code ' + response.status,
25819
- [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][
25820
- Math.floor(response.status / 100) - 4
25821
- ],
25822
- response.config,
25823
- response.request,
25824
- response
25825
- )
25826
- );
25997
+ reject(new AxiosError$1(
25998
+ 'Request failed with status code ' + response.status,
25999
+ response.status >= 400 && response.status < 500 ? AxiosError$1.ERR_BAD_REQUEST : AxiosError$1.ERR_BAD_RESPONSE,
26000
+ response.config,
26001
+ response.request,
26002
+ response
26003
+ ));
25827
26004
  }
25828
26005
  }
25829
26006
 
25830
26007
  function parseProtocol(url) {
25831
- const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
26008
+ const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
25832
26009
  return (match && match[1]) || '';
25833
26010
  }
25834
26011
 
@@ -25932,13 +26109,13 @@
25932
26109
  const _speedometer = speedometer(50, 250);
25933
26110
 
25934
26111
  return throttle((e) => {
25935
- const loaded = e.loaded;
26112
+ const rawLoaded = e.loaded;
25936
26113
  const total = e.lengthComputable ? e.total : undefined;
25937
- const progressBytes = loaded - bytesNotified;
26114
+ const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
26115
+ const progressBytes = Math.max(0, loaded - bytesNotified);
25938
26116
  const rate = _speedometer(progressBytes);
25939
- const inRange = loaded <= total;
25940
26117
 
25941
- bytesNotified = loaded;
26118
+ bytesNotified = Math.max(bytesNotified, loaded);
25942
26119
 
25943
26120
  const data = {
25944
26121
  loaded,
@@ -25946,7 +26123,7 @@
25946
26123
  progress: total ? loaded / total : undefined,
25947
26124
  bytes: progressBytes,
25948
26125
  rate: rate ? rate : undefined,
25949
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
26126
+ estimated: rate && total ? (total - loaded) / rate : undefined,
25950
26127
  event: e,
25951
26128
  lengthComputable: total != null,
25952
26129
  [isDownloadStream ? 'download' : 'upload']: true,
@@ -26019,8 +26196,20 @@
26019
26196
 
26020
26197
  read(name) {
26021
26198
  if (typeof document === 'undefined') return null;
26022
- const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
26023
- return match ? decodeURIComponent(match[1]) : null;
26199
+ // Match name=value by splitting on the semicolon separator instead of building a
26200
+ // RegExp from `name` interpolating an unescaped string into a RegExp would let
26201
+ // metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
26202
+ // match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
26203
+ // "; ", so ignore optional whitespace before each cookie name.
26204
+ const cookies = document.cookie.split(';');
26205
+ for (let i = 0; i < cookies.length; i++) {
26206
+ const cookie = cookies[i].replace(/^\s+/, '');
26207
+ const eq = cookie.indexOf('=');
26208
+ if (eq !== -1 && cookie.slice(0, eq) === name) {
26209
+ return decodeURIComponent(cookie.slice(eq + 1));
26210
+ }
26211
+ }
26212
+ return null;
26024
26213
  },
26025
26214
 
26026
26215
  remove(name) {
@@ -26080,7 +26269,7 @@
26080
26269
  */
26081
26270
  function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
26082
26271
  let isRelativeUrl = !isAbsoluteURL(requestedURL);
26083
- if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
26272
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
26084
26273
  return combineURLs(baseURL, requestedURL);
26085
26274
  }
26086
26275
  return requestedURL;
@@ -26100,7 +26289,21 @@
26100
26289
  function mergeConfig$1(config1, config2) {
26101
26290
  // eslint-disable-next-line no-param-reassign
26102
26291
  config2 = config2 || {};
26103
- const config = {};
26292
+
26293
+ // Use a null-prototype object so that downstream reads such as `config.auth`
26294
+ // or `config.baseURL` cannot inherit polluted values from Object.prototype.
26295
+ // `hasOwnProperty` is restored as a non-enumerable own slot to preserve
26296
+ // ergonomics for user code that relies on it.
26297
+ const config = Object.create(null);
26298
+ Object.defineProperty(config, 'hasOwnProperty', {
26299
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
26300
+ // this data descriptor into an accessor descriptor on the way in.
26301
+ __proto__: null,
26302
+ value: Object.prototype.hasOwnProperty,
26303
+ enumerable: false,
26304
+ writable: true,
26305
+ configurable: true,
26306
+ });
26104
26307
 
26105
26308
  function getMergedValue(target, source, prop, caseless) {
26106
26309
  if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
@@ -26139,9 +26342,9 @@
26139
26342
 
26140
26343
  // eslint-disable-next-line consistent-return
26141
26344
  function mergeDirectKeys(a, b, prop) {
26142
- if (prop in config2) {
26345
+ if (utils$1.hasOwnProp(config2, prop)) {
26143
26346
  return getMergedValue(a, b);
26144
- } else if (prop in config1) {
26347
+ } else if (utils$1.hasOwnProp(config1, prop)) {
26145
26348
  return getMergedValue(undefined, a);
26146
26349
  }
26147
26350
  }
@@ -26173,6 +26376,7 @@
26173
26376
  httpsAgent: defaultToConfig2,
26174
26377
  cancelToken: defaultToConfig2,
26175
26378
  socketPath: defaultToConfig2,
26379
+ allowedSocketPaths: defaultToConfig2,
26176
26380
  responseEncoding: defaultToConfig2,
26177
26381
  validateStatus: mergeDirectKeys,
26178
26382
  headers: (a, b, prop) =>
@@ -26182,22 +26386,64 @@
26182
26386
  utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
26183
26387
  if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
26184
26388
  const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
26185
- const configValue = merge(config1[prop], config2[prop], prop);
26389
+ const a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : undefined;
26390
+ const b = utils$1.hasOwnProp(config2, prop) ? config2[prop] : undefined;
26391
+ const configValue = merge(a, b, prop);
26186
26392
  (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
26187
26393
  });
26188
26394
 
26189
26395
  return config;
26190
26396
  }
26191
26397
 
26398
+ const FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
26399
+
26400
+ function setFormDataHeaders(headers, formHeaders, policy) {
26401
+ if (policy !== 'content-only') {
26402
+ headers.set(formHeaders);
26403
+ return;
26404
+ }
26405
+
26406
+ Object.entries(formHeaders).forEach(([key, val]) => {
26407
+ if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
26408
+ headers.set(key, val);
26409
+ }
26410
+ });
26411
+ }
26412
+
26413
+ /**
26414
+ * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
26415
+ * This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
26416
+ *
26417
+ * @param {string} str The string to encode
26418
+ *
26419
+ * @returns {string} UTF-8 bytes as a Latin-1 string
26420
+ */
26421
+ const encodeUTF8 = (str) =>
26422
+ encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>
26423
+ String.fromCharCode(parseInt(hex, 16))
26424
+ );
26425
+
26192
26426
  var resolveConfig = (config) => {
26193
26427
  const newConfig = mergeConfig$1({}, config);
26194
26428
 
26195
- let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
26429
+ // Read only own properties to prevent prototype pollution gadgets
26430
+ // (e.g. Object.prototype.baseURL = 'https://evil.com').
26431
+ const own = (key) => (utils$1.hasOwnProp(newConfig, key) ? newConfig[key] : undefined);
26432
+
26433
+ const data = own('data');
26434
+ let withXSRFToken = own('withXSRFToken');
26435
+ const xsrfHeaderName = own('xsrfHeaderName');
26436
+ const xsrfCookieName = own('xsrfCookieName');
26437
+ let headers = own('headers');
26438
+ const auth = own('auth');
26439
+ const baseURL = own('baseURL');
26440
+ const allowAbsoluteUrls = own('allowAbsoluteUrls');
26441
+ const url = own('url');
26196
26442
 
26197
26443
  newConfig.headers = headers = AxiosHeaders$1.from(headers);
26198
26444
 
26199
26445
  newConfig.url = buildURL(
26200
- buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
26446
+ buildFullPath(baseURL, url, allowAbsoluteUrls),
26201
26447
  config.params,
26202
26448
  config.paramsSerializer
26203
26449
  );
@@ -26207,11 +26453,7 @@
26207
26453
  headers.set(
26208
26454
  'Authorization',
26209
26455
  'Basic ' +
26210
- btoa(
26211
- (auth.username || '') +
26212
- ':' +
26213
- (auth.password ? unescape(encodeURIComponent(auth.password)) : '')
26214
- )
26456
+ btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8(auth.password) : ''))
26215
26457
  );
26216
26458
  }
26217
26459
 
@@ -26220,14 +26462,7 @@
26220
26462
  headers.setContentType(undefined); // browser handles it
26221
26463
  } else if (utils$1.isFunction(data.getHeaders)) {
26222
26464
  // Node.js FormData (like form-data package)
26223
- const formHeaders = data.getHeaders();
26224
- // Only set safe headers to avoid overwriting security headers
26225
- const allowedHeaders = ['content-type', 'content-length'];
26226
- Object.entries(formHeaders).forEach(([key, val]) => {
26227
- if (allowedHeaders.includes(key.toLowerCase())) {
26228
- headers.set(key, val);
26229
- }
26230
- });
26465
+ setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
26231
26466
  }
26232
26467
  }
26233
26468
 
@@ -26236,10 +26471,17 @@
26236
26471
  // Specifically not if we're in a web worker, or react-native.
26237
26472
 
26238
26473
  if (platform.hasStandardBrowserEnv) {
26239
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
26474
+ if (utils$1.isFunction(withXSRFToken)) {
26475
+ withXSRFToken = withXSRFToken(newConfig);
26476
+ }
26477
+
26478
+ // Strict boolean check — prevents proto-pollution gadgets (e.g. Object.prototype.withXSRFToken = 1)
26479
+ // and misconfigurations (e.g. "false") from short-circuiting the same-origin check and leaking
26480
+ // the XSRF token cross-origin.
26481
+ const shouldSendXSRF =
26482
+ withXSRFToken === true || (withXSRFToken == null && isURLSameOrigin(newConfig.url));
26240
26483
 
26241
- if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
26242
- // Add xsrf header
26484
+ if (shouldSendXSRF) {
26243
26485
  const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
26244
26486
 
26245
26487
  if (xsrfValue) {
@@ -26333,7 +26575,7 @@
26333
26575
  // will return status as 0 even though it's a successful request
26334
26576
  if (
26335
26577
  request.status === 0 &&
26336
- !(request.responseURL && request.responseURL.indexOf('file:') === 0)
26578
+ !(request.responseURL && request.responseURL.startsWith('file:'))
26337
26579
  ) {
26338
26580
  return;
26339
26581
  }
@@ -26350,6 +26592,7 @@
26350
26592
  }
26351
26593
 
26352
26594
  reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
26595
+ done();
26353
26596
 
26354
26597
  // Clean up request
26355
26598
  request = null;
@@ -26365,6 +26608,7 @@
26365
26608
  // attach the underlying event for consumers who want details
26366
26609
  err.event = event || null;
26367
26610
  reject(err);
26611
+ done();
26368
26612
  request = null;
26369
26613
  };
26370
26614
 
@@ -26385,6 +26629,7 @@
26385
26629
  request
26386
26630
  )
26387
26631
  );
26632
+ done();
26388
26633
 
26389
26634
  // Clean up request
26390
26635
  request = null;
@@ -26434,6 +26679,7 @@
26434
26679
  }
26435
26680
  reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
26436
26681
  request.abort();
26682
+ done();
26437
26683
  request = null;
26438
26684
  };
26439
26685
 
@@ -26447,7 +26693,7 @@
26447
26693
 
26448
26694
  const protocol = parseProtocol(_config.url);
26449
26695
 
26450
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
26696
+ if (protocol && !platform.protocols.includes(protocol)) {
26451
26697
  reject(
26452
26698
  new AxiosError$1(
26453
26699
  'Unsupported protocol ' + protocol + ':',
@@ -26604,16 +26850,112 @@
26604
26850
  );
26605
26851
  };
26606
26852
 
26607
- const DEFAULT_CHUNK_SIZE = 64 * 1024;
26853
+ /**
26854
+ * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
26855
+ * - For base64: compute exact decoded size using length and padding;
26856
+ * handle %XX at the character-count level (no string allocation).
26857
+ * - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
26858
+ *
26859
+ * @param {string} url
26860
+ * @returns {number}
26861
+ */
26862
+ function estimateDataURLDecodedBytes(url) {
26863
+ if (!url || typeof url !== 'string') return 0;
26864
+ if (!url.startsWith('data:')) return 0;
26608
26865
 
26609
- const { isFunction } = utils$1;
26866
+ const comma = url.indexOf(',');
26867
+ if (comma < 0) return 0;
26868
+
26869
+ const meta = url.slice(5, comma);
26870
+ const body = url.slice(comma + 1);
26871
+ const isBase64 = /;base64/i.test(meta);
26872
+
26873
+ if (isBase64) {
26874
+ let effectiveLen = body.length;
26875
+ const len = body.length; // cache length
26876
+
26877
+ for (let i = 0; i < len; i++) {
26878
+ if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
26879
+ const a = body.charCodeAt(i + 1);
26880
+ const b = body.charCodeAt(i + 2);
26881
+ const isHex =
26882
+ ((a >= 48 && a <= 57) || (a >= 65 && a <= 70) || (a >= 97 && a <= 102)) &&
26883
+ ((b >= 48 && b <= 57) || (b >= 65 && b <= 70) || (b >= 97 && b <= 102));
26884
+
26885
+ if (isHex) {
26886
+ effectiveLen -= 2;
26887
+ i += 2;
26888
+ }
26889
+ }
26890
+ }
26891
+
26892
+ let pad = 0;
26893
+ let idx = len - 1;
26894
+
26895
+ const tailIsPct3D = (j) =>
26896
+ j >= 2 &&
26897
+ body.charCodeAt(j - 2) === 37 && // '%'
26898
+ body.charCodeAt(j - 1) === 51 && // '3'
26899
+ (body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100); // 'D' or 'd'
26610
26900
 
26611
- const globalFetchAPI = (({ Request, Response }) => ({
26612
- Request,
26613
- Response,
26614
- }))(utils$1.global);
26901
+ if (idx >= 0) {
26902
+ if (body.charCodeAt(idx) === 61 /* '=' */) {
26903
+ pad++;
26904
+ idx--;
26905
+ } else if (tailIsPct3D(idx)) {
26906
+ pad++;
26907
+ idx -= 3;
26908
+ }
26909
+ }
26910
+
26911
+ if (pad === 1 && idx >= 0) {
26912
+ if (body.charCodeAt(idx) === 61 /* '=' */) {
26913
+ pad++;
26914
+ } else if (tailIsPct3D(idx)) {
26915
+ pad++;
26916
+ }
26917
+ }
26918
+
26919
+ const groups = Math.floor(effectiveLen / 4);
26920
+ const bytes = groups * 3 - (pad || 0);
26921
+ return bytes > 0 ? bytes : 0;
26922
+ }
26923
+
26924
+ if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
26925
+ return Buffer.byteLength(body, 'utf8');
26926
+ }
26927
+
26928
+ // Compute UTF-8 byte length directly from UTF-16 code units without allocating
26929
+ // a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
26930
+ // Using body.length here would undercount non-ASCII (e.g. '€' is 1 code unit
26931
+ // but 3 UTF-8 bytes).
26932
+ let bytes = 0;
26933
+ for (let i = 0, len = body.length; i < len; i++) {
26934
+ const c = body.charCodeAt(i);
26935
+ if (c < 0x80) {
26936
+ bytes += 1;
26937
+ } else if (c < 0x800) {
26938
+ bytes += 2;
26939
+ } else if (c >= 0xd800 && c <= 0xdbff && i + 1 < len) {
26940
+ const next = body.charCodeAt(i + 1);
26941
+ if (next >= 0xdc00 && next <= 0xdfff) {
26942
+ bytes += 4;
26943
+ i++;
26944
+ } else {
26945
+ bytes += 3;
26946
+ }
26947
+ } else {
26948
+ bytes += 3;
26949
+ }
26950
+ }
26951
+ return bytes;
26952
+ }
26953
+
26954
+ const VERSION$1 = "1.16.0";
26955
+
26956
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
26615
26957
 
26616
- const { ReadableStream: ReadableStream$1, TextEncoder: TextEncoder$1 } = utils$1.global;
26958
+ const { isFunction } = utils$1;
26617
26959
 
26618
26960
  const test = (fn, ...args) => {
26619
26961
  try {
@@ -26624,11 +26966,17 @@
26624
26966
  };
26625
26967
 
26626
26968
  const factory = (env) => {
26969
+ const globalObject = utils$1.global ?? globalThis;
26970
+ const { ReadableStream, TextEncoder } = globalObject;
26971
+
26627
26972
  env = utils$1.merge.call(
26628
26973
  {
26629
26974
  skipUndefined: true,
26630
26975
  },
26631
- globalFetchAPI,
26976
+ {
26977
+ Request: globalObject.Request,
26978
+ Response: globalObject.Response,
26979
+ },
26632
26980
  env
26633
26981
  );
26634
26982
 
@@ -26641,15 +26989,15 @@
26641
26989
  return false;
26642
26990
  }
26643
26991
 
26644
- const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
26992
+ const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream);
26645
26993
 
26646
26994
  const encodeText =
26647
26995
  isFetchSupported &&
26648
- (typeof TextEncoder$1 === 'function'
26996
+ (typeof TextEncoder === 'function'
26649
26997
  ? (
26650
26998
  (encoder) => (str) =>
26651
26999
  encoder.encode(str)
26652
- )(new TextEncoder$1())
27000
+ )(new TextEncoder())
26653
27001
  : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
26654
27002
 
26655
27003
  const supportsRequestStream =
@@ -26658,18 +27006,20 @@
26658
27006
  test(() => {
26659
27007
  let duplexAccessed = false;
26660
27008
 
26661
- const body = new ReadableStream$1();
26662
-
26663
- const hasContentType = new Request(platform.origin, {
26664
- body,
27009
+ const request = new Request(platform.origin, {
27010
+ body: new ReadableStream(),
26665
27011
  method: 'POST',
26666
27012
  get duplex() {
26667
27013
  duplexAccessed = true;
26668
27014
  return 'half';
26669
27015
  },
26670
- }).headers.has('Content-Type');
27016
+ });
27017
+
27018
+ const hasContentType = request.headers.has('Content-Type');
26671
27019
 
26672
- body.cancel();
27020
+ if (request.body != null) {
27021
+ request.body.cancel();
27022
+ }
26673
27023
 
26674
27024
  return duplexAccessed && !hasContentType;
26675
27025
  });
@@ -26753,8 +27103,13 @@
26753
27103
  headers,
26754
27104
  withCredentials = 'same-origin',
26755
27105
  fetchOptions,
27106
+ maxContentLength,
27107
+ maxBodyLength,
26756
27108
  } = resolveConfig(config);
26757
27109
 
27110
+ const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
27111
+ const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
27112
+
26758
27113
  let _fetch = envFetch || fetch;
26759
27114
 
26760
27115
  responseType = responseType ? (responseType + '').toLowerCase() : 'text';
@@ -26776,6 +27131,41 @@
26776
27131
  let requestContentLength;
26777
27132
 
26778
27133
  try {
27134
+ // Enforce maxContentLength for data: URLs up-front so we never materialize
27135
+ // an oversized payload. The HTTP adapter applies the same check (see http.js
27136
+ // "if (protocol === 'data:')" branch).
27137
+ if (hasMaxContentLength && typeof url === 'string' && url.startsWith('data:')) {
27138
+ const estimated = estimateDataURLDecodedBytes(url);
27139
+ if (estimated > maxContentLength) {
27140
+ throw new AxiosError$1(
27141
+ 'maxContentLength size of ' + maxContentLength + ' exceeded',
27142
+ AxiosError$1.ERR_BAD_RESPONSE,
27143
+ config,
27144
+ request
27145
+ );
27146
+ }
27147
+ }
27148
+
27149
+ // Enforce maxBodyLength against the outbound request body before dispatch.
27150
+ // Mirrors http.js behavior (ERR_BAD_REQUEST / 'Request body larger than
27151
+ // maxBodyLength limit'). Skip when the body length cannot be determined
27152
+ // (e.g. a live ReadableStream supplied by the caller).
27153
+ if (hasMaxBodyLength && method !== 'get' && method !== 'head') {
27154
+ const outboundLength = await resolveBodyLength(headers, data);
27155
+ if (
27156
+ typeof outboundLength === 'number' &&
27157
+ isFinite(outboundLength) &&
27158
+ outboundLength > maxBodyLength
27159
+ ) {
27160
+ throw new AxiosError$1(
27161
+ 'Request body larger than maxBodyLength limit',
27162
+ AxiosError$1.ERR_BAD_REQUEST,
27163
+ config,
27164
+ request
27165
+ );
27166
+ }
27167
+ }
27168
+
26779
27169
  if (
26780
27170
  onUploadProgress &&
26781
27171
  supportsRequestStream &&
@@ -26813,6 +27203,22 @@
26813
27203
  // see https://github.com/cloudflare/workerd/issues/902
26814
27204
  const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
26815
27205
 
27206
+ // If data is FormData and Content-Type is multipart/form-data without boundary,
27207
+ // delete it so fetch can set it correctly with the boundary
27208
+ if (utils$1.isFormData(data)) {
27209
+ const contentType = headers.getContentType();
27210
+ if (
27211
+ contentType &&
27212
+ /^multipart\/form-data/i.test(contentType) &&
27213
+ !/boundary=/i.test(contentType)
27214
+ ) {
27215
+ headers.delete('content-type');
27216
+ }
27217
+ }
27218
+
27219
+ // Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)
27220
+ headers.set('User-Agent', 'axios/' + VERSION$1, false);
27221
+
26816
27222
  const resolvedOptions = {
26817
27223
  ...fetchOptions,
26818
27224
  signal: composedSignal,
@@ -26829,10 +27235,28 @@
26829
27235
  ? _fetch(request, fetchOptions)
26830
27236
  : _fetch(url, resolvedOptions));
26831
27237
 
27238
+ // Cheap pre-check: if the server honestly declares a content-length that
27239
+ // already exceeds the cap, reject before we start streaming.
27240
+ if (hasMaxContentLength) {
27241
+ const declaredLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
27242
+ if (declaredLength != null && declaredLength > maxContentLength) {
27243
+ throw new AxiosError$1(
27244
+ 'maxContentLength size of ' + maxContentLength + ' exceeded',
27245
+ AxiosError$1.ERR_BAD_RESPONSE,
27246
+ config,
27247
+ request
27248
+ );
27249
+ }
27250
+ }
27251
+
26832
27252
  const isStreamResponse =
26833
27253
  supportsResponseStream && (responseType === 'stream' || responseType === 'response');
26834
27254
 
26835
- if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
27255
+ if (
27256
+ supportsResponseStream &&
27257
+ response.body &&
27258
+ (onDownloadProgress || hasMaxContentLength || (isStreamResponse && unsubscribe))
27259
+ ) {
26836
27260
  const options = {};
26837
27261
 
26838
27262
  ['status', 'statusText', 'headers'].forEach((prop) => {
@@ -26849,8 +27273,24 @@
26849
27273
  )) ||
26850
27274
  [];
26851
27275
 
27276
+ let bytesRead = 0;
27277
+ const onChunkProgress = (loadedBytes) => {
27278
+ if (hasMaxContentLength) {
27279
+ bytesRead = loadedBytes;
27280
+ if (bytesRead > maxContentLength) {
27281
+ throw new AxiosError$1(
27282
+ 'maxContentLength size of ' + maxContentLength + ' exceeded',
27283
+ AxiosError$1.ERR_BAD_RESPONSE,
27284
+ config,
27285
+ request
27286
+ );
27287
+ }
27288
+ }
27289
+ onProgress && onProgress(loadedBytes);
27290
+ };
27291
+
26852
27292
  response = new Response(
26853
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
27293
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, () => {
26854
27294
  flush && flush();
26855
27295
  unsubscribe && unsubscribe();
26856
27296
  }),
@@ -26865,6 +27305,33 @@
26865
27305
  config
26866
27306
  );
26867
27307
 
27308
+ // Fallback enforcement for environments without ReadableStream support
27309
+ // (legacy runtimes). Detect materialized size from typed output; skip
27310
+ // streams/Response passthrough since the user will read those themselves.
27311
+ if (hasMaxContentLength && !supportsResponseStream && !isStreamResponse) {
27312
+ let materializedSize;
27313
+ if (responseData != null) {
27314
+ if (typeof responseData.byteLength === 'number') {
27315
+ materializedSize = responseData.byteLength;
27316
+ } else if (typeof responseData.size === 'number') {
27317
+ materializedSize = responseData.size;
27318
+ } else if (typeof responseData === 'string') {
27319
+ materializedSize =
27320
+ typeof TextEncoder === 'function'
27321
+ ? new TextEncoder().encode(responseData).byteLength
27322
+ : responseData.length;
27323
+ }
27324
+ }
27325
+ if (typeof materializedSize === 'number' && materializedSize > maxContentLength) {
27326
+ throw new AxiosError$1(
27327
+ 'maxContentLength size of ' + maxContentLength + ' exceeded',
27328
+ AxiosError$1.ERR_BAD_RESPONSE,
27329
+ config,
27330
+ request
27331
+ );
27332
+ }
27333
+ }
27334
+
26868
27335
  !isStreamResponse && unsubscribe && unsubscribe();
26869
27336
 
26870
27337
  return await new Promise((resolve, reject) => {
@@ -26880,6 +27347,17 @@
26880
27347
  } catch (err) {
26881
27348
  unsubscribe && unsubscribe();
26882
27349
 
27350
+ // Safari can surface fetch aborts as a DOMException-like object whose
27351
+ // branded getters throw. Prefer our composed signal reason before reading
27352
+ // the caught error, preserving timeout vs cancellation semantics.
27353
+ if (composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError$1) {
27354
+ const canceledError = composedSignal.reason;
27355
+ canceledError.config = config;
27356
+ request && (canceledError.request = request);
27357
+ err !== canceledError && (canceledError.cause = err);
27358
+ throw canceledError;
27359
+ }
27360
+
26883
27361
  if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
26884
27362
  throw Object.assign(
26885
27363
  new AxiosError$1(
@@ -26948,11 +27426,13 @@
26948
27426
  utils$1.forEach(knownAdapters, (fn, value) => {
26949
27427
  if (fn) {
26950
27428
  try {
26951
- Object.defineProperty(fn, 'name', { value });
27429
+ // Null-proto descriptors so a polluted Object.prototype.get cannot turn
27430
+ // these data descriptors into accessor descriptors on the way in.
27431
+ Object.defineProperty(fn, 'name', { __proto__: null, value });
26952
27432
  } catch (e) {
26953
27433
  // eslint-disable-next-line no-empty
26954
27434
  }
26955
- Object.defineProperty(fn, 'adapterName', { value });
27435
+ Object.defineProperty(fn, 'adapterName', { __proto__: null, value });
26956
27436
  }
26957
27437
  });
26958
27438
 
@@ -27094,8 +27574,15 @@
27094
27574
  function onAdapterResolution(response) {
27095
27575
  throwIfCancellationRequested(config);
27096
27576
 
27097
- // Transform response data
27098
- response.data = transformData.call(config, config.transformResponse, response);
27577
+ // Expose the current response on config so that transformResponse can
27578
+ // attach it to any AxiosError it throws (e.g. on JSON parse failure).
27579
+ // We clean it up afterwards to avoid polluting the config object.
27580
+ config.response = response;
27581
+ try {
27582
+ response.data = transformData.call(config, config.transformResponse, response);
27583
+ } finally {
27584
+ delete config.response;
27585
+ }
27099
27586
 
27100
27587
  response.headers = AxiosHeaders$1.from(response.headers);
27101
27588
 
@@ -27107,11 +27594,16 @@
27107
27594
 
27108
27595
  // Transform response data
27109
27596
  if (reason && reason.response) {
27110
- reason.response.data = transformData.call(
27111
- config,
27112
- config.transformResponse,
27113
- reason.response
27114
- );
27597
+ config.response = reason.response;
27598
+ try {
27599
+ reason.response.data = transformData.call(
27600
+ config,
27601
+ config.transformResponse,
27602
+ reason.response
27603
+ );
27604
+ } finally {
27605
+ delete config.response;
27606
+ }
27115
27607
  reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
27116
27608
  }
27117
27609
  }
@@ -27121,8 +27613,6 @@
27121
27613
  );
27122
27614
  }
27123
27615
 
27124
- const VERSION$1 = "1.15.0";
27125
-
27126
27616
  const validators$1 = {};
27127
27617
 
27128
27618
  // eslint-disable-next-line func-names
@@ -27206,7 +27696,9 @@
27206
27696
  let i = keys.length;
27207
27697
  while (i-- > 0) {
27208
27698
  const opt = keys[i];
27209
- const validator = schema[opt];
27699
+ // Use hasOwnProperty so a polluted Object.prototype.<opt> cannot supply
27700
+ // a non-function validator and cause a TypeError.
27701
+ const validator = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : undefined;
27210
27702
  if (validator) {
27211
27703
  const value = options[opt];
27212
27704
  const result = value === undefined || validator(value, opt, options);
@@ -27365,7 +27857,7 @@
27365
27857
  let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
27366
27858
 
27367
27859
  headers &&
27368
- utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], (method) => {
27860
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query', 'common'], (method) => {
27369
27861
  delete headers[method];
27370
27862
  });
27371
27863
 
@@ -27468,7 +27960,7 @@
27468
27960
  };
27469
27961
  });
27470
27962
 
27471
- utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
27963
+ utils$1.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {
27472
27964
  function generateHTTPMethod(isForm) {
27473
27965
  return function httpMethod(url, data, config) {
27474
27966
  return this.request(
@@ -27488,7 +27980,11 @@
27488
27980
 
27489
27981
  Axios$1.prototype[method] = generateHTTPMethod();
27490
27982
 
27491
- Axios$1.prototype[method + 'Form'] = generateHTTPMethod(true);
27983
+ // QUERY is a safe/idempotent read method; multipart form bodies don't fit
27984
+ // its semantics, so no queryForm shorthand is generated.
27985
+ if (method !== 'query') {
27986
+ Axios$1.prototype[method + 'Form'] = generateHTTPMethod(true);
27987
+ }
27492
27988
  });
27493
27989
 
27494
27990
  /**
@@ -27822,6 +28318,7 @@
27822
28318
  formToJSON,
27823
28319
  getAdapter,
27824
28320
  mergeConfig,
28321
+ create,
27825
28322
  } = axios$1;
27826
28323
 
27827
28324
  // lib/v4/isZodErrorLike.ts
@@ -28492,7 +28989,9 @@
28492
28989
  body: any().optional(),
28493
28990
  });
28494
28991
 
28992
+ const ConnectionType = _enum(['connector', 'mcp']);
28495
28993
  const ConnectionEditableProperties = object({
28994
+ type: ConnectionType.optional(),
28496
28995
  name: string$1().optional(),
28497
28996
  meta: record(string$1(), any()).optional(),
28498
28997
  authOptionKey: string$1().optional(),
@@ -28515,9 +29014,14 @@
28515
29014
  description: string$1(),
28516
29015
  uiUrl: string$1().optional(),
28517
29016
  agentInstructions: string$1().optional(),
29017
+ handoffAgentInstructions: string$1().optional(),
29018
+ reason: _enum(['authenticate', 'reauthenticate', 'provide-input'])
29019
+ .optional()
29020
+ .describe('[INTERNAL] Cause that triggered this client action; persisted so prompts can be re-rendered on read.'),
28518
29021
  });
28519
29022
  const BaseConnection = BaseWorkspaceElement.extend({
28520
29023
  ...TenantLayerElement.shape,
29024
+ type: ConnectionType.optional(),
28521
29025
  name: string$1(),
28522
29026
  key: string$1().optional(),
28523
29027
  isTest: boolean$1().optional(),
@@ -29282,7 +29786,7 @@
29282
29786
  properties: record(string$1(), DataSchema).optional(),
29283
29787
  items: DataSchema.optional(),
29284
29788
  additionalProperties: union([boolean$1(), DataSchema]).optional(),
29285
- enum: array(string$1()).optional(),
29789
+ enum: array(union([string$1(), number$1()])).optional(),
29286
29790
  referenceRecords: array(any()).optional(),
29287
29791
  referenceCollection: object({
29288
29792
  key: any().optional(),
@@ -29536,25 +30040,29 @@
29536
30040
  });
29537
30041
  const IntegrationEditableProperties = BaseMembraneInterfaceEditableProperties.extend({
29538
30042
  logoUri: string$1().optional(),
29539
- externalAppId: string$1().optional(),
30043
+ externalAppId: string$1()
30044
+ .optional()
30045
+ .describe("External app id; alternative to connectorId — resolves to the app's default connector."),
29540
30046
  externalAppUuid: string$1().optional(),
29541
30047
  appUuid: string$1().optional().describe('[INTERNAL] Deprecated: resolved to externalAppId'),
29542
30048
  oAuthCallbackUri: url().or(literal('')).optional(),
29543
30049
  logoBase64: string$1().optional(),
29544
30050
  connectorVersion: string$1().optional(),
29545
- connectorId: string$1().optional(),
30051
+ connectorId: string$1().optional().describe('ID of the connector this integration uses.'),
29546
30052
  connectorUuid: string$1().optional(),
29547
30053
  connectorKey: string$1()
29548
30054
  .optional()
29549
30055
  .describe('Key of the connector; alternative to connectorId. Resolved to connectorId by the API.'),
29550
- parameters: record(string$1(), any()).optional(),
30056
+ parameters: record(string$1(), any())
30057
+ .optional()
30058
+ .describe('Connector-specific parameters (e.g. OAuth { clientId, clientSecret, scopes }).'),
29551
30059
  optionsConfig: IntegrationOptions.optional(),
29552
30060
  });
29553
30061
  IntegrationEditableProperties.omit({
29554
30062
  connectorId: true,
29555
30063
  externalAppId: true,
29556
30064
  parameters: true,
29557
- });
30065
+ }).required({ uuid: true, key: true });
29558
30066
 
29559
30067
  PaginationQuery.merge(SearchQuery)
29560
30068
  .merge(IncludeArchivedQuery)
@@ -29704,6 +30212,18 @@
29704
30212
  connectionId: string$1().optional(),
29705
30213
  }),
29706
30214
  ]);
30215
+ discriminatedUnion('type', [
30216
+ object({
30217
+ type: literal('connected'),
30218
+ connectionId: string$1(),
30219
+ timestamp: string$1(),
30220
+ message: string$1().optional(),
30221
+ }),
30222
+ object({
30223
+ type: literal('connectionPatched'),
30224
+ connectionId: string$1(),
30225
+ }),
30226
+ ]);
29707
30227
  object({
29708
30228
  integrationId: string$1().optional(),
29709
30229
  integrationKey: string$1().optional(),
@@ -29714,12 +30234,15 @@
29714
30234
  connectorVersion: string$1().optional(),
29715
30235
  });
29716
30236
  const ConnectPayload = object({
30237
+ type: ConnectionType.optional(),
29717
30238
  requestId: string$1().optional(),
29718
30239
  integrationKey: string$1().optional(),
29719
30240
  integrationId: string$1().optional(),
29720
30241
  connectorId: string$1().optional(),
29721
30242
  connectorKey: string$1().optional(),
29722
30243
  connectorVersion: string$1().optional(),
30244
+ externalAppId: string$1().optional(),
30245
+ externalAppKey: string$1().optional(),
29723
30246
  connectionId: string$1().optional(),
29724
30247
  connectionKey: string$1().min(1).max(100).optional(),
29725
30248
  name: string$1().optional(),