@useparagon/connect 3.1.0 → 3.2.0-experimental-27263.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.
@@ -0,0 +1,47 @@
1
+ import { ConnectInputValue, InstallFlowStage, StartOptions } from '../types/connect';
2
+ import { InstallFlowClient } from './InstallFlowClient';
3
+ /**
4
+ * Shared install-flow stage machine. Owns stage branching/sequencing and the
5
+ * OAuth lifecycle; every data read and network effect goes through the
6
+ * host-provided InstallFlowClient, so non-SDK consumers (e.g. setup links)
7
+ * can drive the same flow over their own transport.
8
+ */
9
+ export declare class InstallFlow {
10
+ private readonly client;
11
+ private startOptions;
12
+ private integrationName;
13
+ private accountTypeValue;
14
+ private preOptionsValue;
15
+ private postOptionsValue;
16
+ private credentialId;
17
+ private hasFinishedInstruction;
18
+ private oauthAbortController;
19
+ constructor(client: InstallFlowClient);
20
+ start(integrationName: string, startOptions?: StartOptions): void;
21
+ cancel(): Promise<void>;
22
+ private getInstallOptions;
23
+ private asyncStart;
24
+ private handleError;
25
+ private handleNext;
26
+ private handleComplete;
27
+ private getScheme;
28
+ private getIntegrationName;
29
+ private getConfig;
30
+ private getSelectedAccountTypeOption;
31
+ private requiresAccountType;
32
+ private getIntegrationInstructionMetadata;
33
+ private requiresInstruction;
34
+ private requiresPreOptions;
35
+ private requiresPostOptions;
36
+ private requiresOAuth;
37
+ /** Starts an OAuth authentication flow through a window Pop-up */
38
+ private handleOAuth;
39
+ setAccountType(accountType: string): Promise<void>;
40
+ setPreOptions(options: Record<string, ConnectInputValue>): Promise<void>;
41
+ setPostOptions(options: Record<string, ConnectInputValue>): Promise<void>;
42
+ private setHasFinishedInstruction;
43
+ getAccountTypeValue(): string | null;
44
+ getPreOptionsValue(): Record<string, ConnectInputValue> | null;
45
+ getPostOptionsValue(): Record<string, ConnectInputValue> | null;
46
+ next(): InstallFlowStage;
47
+ }
@@ -0,0 +1,83 @@
1
+ import { IConnectIntegrationWithCredentialInfo } from '../entities/integration.interface';
2
+ import { ConnectInputValue } from '../types/connect';
3
+ import { CredentialConfigOptions, InstallOptions, IntegrationInstallEvent } from '../types/sdk';
4
+ /**
5
+ * The subset of integration data the install flow reads to make stage
6
+ * decisions. Structurally satisfied by the SDK's loaded integrations and by
7
+ * the Zeus `GET /sdk/integrations` response (which includes
8
+ * `sdkIntegrationConfig`), so non-SDK consumers can implement the client
9
+ * directly from API data.
10
+ */
11
+ export type InstallFlowIntegrationConfig = Pick<IConnectIntegrationWithCredentialInfo, 'id' | 'type' | 'authenticationType' | 'customIntegration' | 'sdkIntegrationConfig'>;
12
+ export type OAuthStartParams = {
13
+ integrationName: string;
14
+ accountType?: string | string[];
15
+ endUserSuppliedValues?: Record<string, ConnectInputValue>;
16
+ allowMultipleCredentials?: boolean;
17
+ selectedCredentialId?: string;
18
+ externalId?: string;
19
+ overrideRedirectUrl?: string;
20
+ oauthTimeout?: number;
21
+ /**
22
+ * Aborts the in-flight flow: polling and popup watchers are torn down, the
23
+ * popup is closed when possible, and `onError` receives an
24
+ * `OAuthCancelledError`. `onSuccess` is not invoked afterwards.
25
+ */
26
+ signal?: AbortSignal;
27
+ };
28
+ export type OAuthHandlers = {
29
+ onSuccess(event: IntegrationInstallEvent): void;
30
+ onError(error: unknown): void;
31
+ };
32
+ export type SaveCredentialParams = {
33
+ integrationId: string;
34
+ payload: Record<string, ConnectInputValue>;
35
+ installOptions?: InstallOptions & CredentialConfigOptions;
36
+ };
37
+ export type CompleteSetupParams = SaveCredentialParams & {
38
+ credentialId: string;
39
+ };
40
+ export type UninstallParams = {
41
+ integrationName: string;
42
+ credentialId?: string;
43
+ };
44
+ /**
45
+ * Data/transport seam between the shared InstallFlow stage machine and its
46
+ * host (the ConnectSDK adapter, the setup-links SPA, ...). Implementations
47
+ * own all network I/O, authentication, and consumer-specific gating; the
48
+ * stage machine owns branching and sequencing.
49
+ */
50
+ export interface InstallFlowClient {
51
+ /**
52
+ * Returns the raw integration config feeding every stage decision in
53
+ * `next()`. This is the first read performed at `start()`, so
54
+ * consumer-specific gating (e.g. the SDK's headless-mode check) belongs
55
+ * here and surfaces through the flow's normal `onError` path.
56
+ */
57
+ getIntegrationConfig(name: string): InstallFlowIntegrationConfig;
58
+ /**
59
+ * Resolves a static asset URL. Only used by the Salesforce instruction
60
+ * stage for its install images.
61
+ */
62
+ getAssetUrl(name: string): string;
63
+ /**
64
+ * Runs the OAuth popup flow. Callback-style to match historical SDK
65
+ * semantics; the stage machine wraps it in a Promise internally.
66
+ */
67
+ startOAuth(params: OAuthStartParams, handlers: OAuthHandlers): void;
68
+ /**
69
+ * Creates a credential without OAuth (basic auth / client credentials
70
+ * submitted through pre-options).
71
+ */
72
+ saveCredential(params: SaveCredentialParams): Promise<IntegrationInstallEvent | undefined>;
73
+ /**
74
+ * Submits post-OAuth options against the pending credential created by
75
+ * `startOAuth` or `saveCredential`.
76
+ */
77
+ completeSetup(params: CompleteSetupParams): Promise<IntegrationInstallEvent | undefined>;
78
+ /**
79
+ * Removes a credential. Used to clean up a partially-installed credential
80
+ * on `cancel()`, and by Disconnect-style UX.
81
+ */
82
+ uninstall(params: UninstallParams): Promise<void>;
83
+ }
@@ -0,0 +1,19 @@
1
+ import { AccountType, IntegrationConnectInput } from '../types/action';
2
+ import { InstallFlowIntegrationConfig } from './InstallFlowClient';
3
+ /**
4
+ * Default inputs for custom integrations authenticated via OAuth client
5
+ * credentials — the end user always supplies their own client id/secret.
6
+ */
7
+ export declare const OAUTH_CLIENT_CREDENTIALS_DEFAULT_INPUTS: IntegrationConnectInput[];
8
+ export declare function deriveAccountTypeOptions(integration: InstallFlowIntegrationConfig): AccountType[];
9
+ /**
10
+ * Pre-OAuth inputs, in precedence order: custom integration inputs (or the
11
+ * client-credentials defaults) → selected account type's
12
+ * `endUserSuppliedValues` → `authConfigInputs` → none.
13
+ *
14
+ * Returned arrays are deep copies — callers may mutate them (form state)
15
+ * without affecting the source config. This matches the historical
16
+ * `ConnectSDK.getPreOptions` behavior exactly.
17
+ */
18
+ export declare function derivePreOptions(integration: InstallFlowIntegrationConfig, accountTypeId?: string): IntegrationConnectInput[];
19
+ export declare function derivePostOptions(integration: InstallFlowIntegrationConfig): IntegrationConnectInput[];
@@ -0,0 +1,5 @@
1
+ export * from './derivation';
2
+ export * from './InstallFlow';
3
+ export * from './InstallFlowClient';
4
+ export * from './oauth';
5
+ export * from './salesforceInstruction';
@@ -0,0 +1,2 @@
1
+ /*! For license information please see index.js.LICENSE.txt */
2
+ (()=>{var t={745:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AuthenticationScheme=void 0,function(t){t.BASIC="basic",t.OAUTH="oauth",t.OAUTH_CLIENT_CREDENTIAL="oauth_client_credential",t.SERVICE_ACCOUNT="service_account",t.OAUTH_APP="oauth_app",t.IMPERSONATED_APP="impersonated_app"}(e.AuthenticationScheme||(e.AuthenticationScheme={}))},7442:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InstallFlow=void 0;const n=r(745),o=r(2460),i=r(8321),a=r(9587),s=r(2661);e.InstallFlow=class{constructor(t){this.client=t,this.startOptions=null,this.integrationName=null,this.accountTypeValue=null,this.preOptionsValue=null,this.postOptionsValue=null,this.credentialId=null,this.hasFinishedInstruction=!1,this.oauthAbortController=null}start(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.asyncStart(t,e).catch((t=>{this.handleError(t)}))}async cancel(){var t;null===(t=this.oauthAbortController)||void 0===t||t.abort(),this.oauthAbortController=null,this.startOptions=null,this.accountTypeValue=null,this.preOptionsValue=null,this.postOptionsValue=null,this.hasFinishedInstruction=!1;try{if(this.credentialId&&this.integrationName&&await this.client.uninstall({integrationName:this.integrationName,credentialId:this.credentialId}),!this.credentialId&&!this.integrationName){const t=new o.NoActiveInstallFlowError;console.warn(t.message)}}catch(t){console.error("Error cancelling the current install flow",{credentialId:this.credentialId,integration:this.integrationName},t)}finally{this.integrationName=null,this.credentialId=null}}getInstallOptions(){var t,e,r,n,o,i,a,s;return{allowMultipleCredentials:null!==(e=null===(t=this.startOptions)||void 0===t?void 0:t.allowMultipleCredentials)&&void 0!==e&&e,overrideRedirectUrl:null!==(n=null===(r=this.startOptions)||void 0===r?void 0:r.overrideRedirectUrl)&&void 0!==n?n:void 0,selectedCredentialId:null!==(i=null===(o=this.startOptions)||void 0===o?void 0:o.selectedCredentialId)&&void 0!==i?i:void 0,externalId:null!==(s=null===(a=this.startOptions)||void 0===a?void 0:a.externalId)&&void 0!==s?s:void 0}}async asyncStart(t,e){this.startOptions=e,this.integrationName=t,this.accountTypeValue=null,this.preOptionsValue=null,this.postOptionsValue=null,this.credentialId=null;const r=this.next();if("oauth"===r.stage)return this.handleNext(r),this.handleOAuth();this.handleNext(r)}handleError(t,e){var r,n;const i=(0,o.getConnectSDKError)(t);null===(n=null===(r=this.startOptions)||void 0===r?void 0:r.onError)||void 0===n||n.call(r,i,null!=e?e:null)}handleNext(t){var e,r;null===(r=null===(e=this.startOptions)||void 0===e?void 0:e.onNext)||void 0===r||r.call(e,t)}handleComplete(t){var e,r;null===(r=null===(e=this.startOptions)||void 0===e?void 0:e.onComplete)||void 0===r||r.call(e,t)}getScheme(){var t,e;if(null===this.integrationName)return null;if(!this.accountTypeValue)return null!==(t=this.client.getIntegrationConfig(this.integrationName).authenticationType)&&void 0!==t?t:null;const r=this.getSelectedAccountTypeOption();return null!==(e=null==r?void 0:r.scheme)&&void 0!==e?e:null}getIntegrationName(){if(!this.integrationName)throw new o.NoActiveInstallFlowError;return this.integrationName}getConfig(){return this.client.getIntegrationConfig(this.getIntegrationName())}getSelectedAccountTypeOption(){return(0,a.deriveAccountTypeOptions)(this.getConfig()).find((t=>t.id===this.accountTypeValue))}requiresAccountType(){const t=(0,a.deriveAccountTypeOptions)(this.getConfig());return!(!t||0===t.length)&&!this.accountTypeValue}getIntegrationInstructionMetadata(){return null===this.integrationName?null:(0,s.buildSalesforceInstructionMetadata)({integration:this.client.getIntegrationConfig(this.integrationName),accountTypeValue:this.accountTypeValue,getAssetUrl:t=>this.client.getAssetUrl(t),onFinish:()=>{this.setHasFinishedInstruction()}})}requiresInstruction(){if(this.hasFinishedInstruction)return[!1,null];const t=this.getIntegrationInstructionMetadata();return null===t?[!1,null]:[!0,t]}requiresPreOptions(){var t;const e=(0,a.derivePreOptions)(this.getConfig(),null!==(t=this.accountTypeValue)&&void 0!==t?t:void 0);return!(!e||0===e.length)&&!this.preOptionsValue}requiresPostOptions(){var t,e;if(null!==(e=null===(t=this.getSelectedAccountTypeOption())||void 0===t?void 0:t.skipPostOAuthInputs)&&void 0!==e&&e)return!1;const r=(0,a.derivePostOptions)(this.getConfig());return!(!r||0===r.length)&&!this.postOptionsValue}requiresOAuth(){return this.getScheme()===n.AuthenticationScheme.OAUTH&&!this.credentialId}async handleOAuth(){let{accountType:t,endUserSuppliedValues:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const r=null!=t?t:this.accountTypeValue,n=this.getInstallOptions(),a=new AbortController;this.oauthAbortController=a;try{const t=await new Promise(((t,o)=>{var s;this.client.startOAuth({integrationName:this.getIntegrationName(),accountType:null!=r?r:void 0,endUserSuppliedValues:e,allowMultipleCredentials:n.allowMultipleCredentials,selectedCredentialId:n.selectedCredentialId,externalId:n.externalId,overrideRedirectUrl:n.overrideRedirectUrl?(0,i.sanitizeUrl)(n.overrideRedirectUrl):void 0,oauthTimeout:null===(s=this.startOptions)||void 0===s?void 0:s.oauthTimeout,signal:a.signal},{onSuccess:e=>t(e),onError:t=>o(t)})}));if(!(null==t?void 0:t.credentialId))throw new o.CredentialNotReturnedFromInstallationError(this.getIntegrationName());this.credentialId=t.credentialId;const s=this.next();"done"===s.stage?this.handleComplete(t):this.handleNext(s)}catch(t){if(t instanceof o.OAuthCancelledError)return;this.handleError(t,{stage:"oauth"})}finally{this.oauthAbortController===a&&(this.oauthAbortController=null)}}async setAccountType(t){try{this.accountTypeValue=t;const e=this.next();if("oauth"===e.stage)return this.handleNext(e),void await this.handleOAuth();this.handleNext(e)}catch(t){this.handleError(t,{stage:"accountType"})}}async setPreOptions(t){var e,r,n;try{if(!t)throw new Error("Pre options are not set");this.preOptionsValue=t;const o=this.next();if("oauth"===o.stage)return this.handleNext(o),void await this.handleOAuth({endUserSuppliedValues:{...t}});const i=null!==(r=null===(e=this.getSelectedAccountTypeOption())||void 0===e?void 0:e.skipPostOAuthInputs)&&void 0!==r&&r,a=await this.client.saveCredential({integrationId:this.getConfig().id,payload:{...t,skipPostOAuthInputs:i},installOptions:this.getInstallOptions()});this.credentialId=null!==(n=null==a?void 0:a.credentialId)&&void 0!==n?n:null;if(!("done"===o.stage))return void this.handleNext(o);if(!a)return void console.warn("Could not find a credential ID");this.handleComplete(a)}catch(t){this.handleError(t,{stage:"preOptions"})}}async setPostOptions(t){var e,r;try{if(!t)throw new Error("Post options are not set");if(!this.credentialId)throw new o.CredentialIdNotSetError(this.getIntegrationName());this.postOptionsValue=t;const n=null!==(r=null===(e=this.getSelectedAccountTypeOption())||void 0===e?void 0:e.skipPostOAuthInputs)&&void 0!==r&&r,i=await this.client.completeSetup({integrationId:this.getConfig().id,credentialId:this.credentialId,payload:{...t,skipPostOAuthInputs:n},installOptions:this.getInstallOptions()}),a=this.next();if(!("done"===a.stage))return void this.handleNext(a);if(!i)return void console.warn("Could not find a credential ID");this.handleComplete(i)}catch(t){this.handleError(t,{stage:"postOptions"})}}async setHasFinishedInstruction(){try{this.hasFinishedInstruction=!0;const t=this.next();if("oauth"===t.stage)return this.handleNext(t),void await this.handleOAuth();this.handleNext(t)}catch(t){this.handleError(t,{stage:"instruction"})}}getAccountTypeValue(){return this.accountTypeValue}getPreOptionsValue(){return this.preOptionsValue}getPostOptionsValue(){return this.postOptionsValue}next(){var t,e;const r=this.getIntegrationName();if(this.requiresAccountType())return{stage:"accountType",options:(0,a.deriveAccountTypeOptions)(this.client.getIntegrationConfig(r)),done:!1};const[n,o]=this.requiresInstruction();if(n)return{stage:"instruction",content:o.content,ctas:o.ctas,finish:o.finish,packageInstallUrl:o.packageInstallUrl,done:!1};if(this.requiresPreOptions())return{stage:"preOptions",options:(0,a.derivePreOptions)(this.client.getIntegrationConfig(r),null!==(t=this.accountTypeValue)&&void 0!==t?t:void 0),done:!1};if(this.requiresOAuth())return{stage:"oauth",done:!1};if(this.requiresPostOptions()){const t=null!==(e=this.credentialId)&&void 0!==e?e:void 0;return{stage:"postOptions",options:(0,a.derivePostOptions)(this.client.getIntegrationConfig(r)),credentialId:t,done:!1}}return{stage:"done",done:!0}}}},4588:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},9587:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.derivePostOptions=e.derivePreOptions=e.deriveAccountTypeOptions=e.OAUTH_CLIENT_CREDENTIALS_DEFAULT_INPUTS=void 0;const n=r(745),o=r(9636),i=r(2992);function a(t){var e,r,n;return null!==(n=(0,o.cloneDeep)(null!==(r=null===(e=t.sdkIntegrationConfig)||void 0===e?void 0:e.accountTypes)&&void 0!==r?r:[]))&&void 0!==n?n:[]}e.OAUTH_CLIENT_CREDENTIALS_DEFAULT_INPUTS=[{id:"clientId",title:"Client ID",type:i.SidebarInputType.ValueText,required:!0},{id:"clientSecret",title:"Client Secret",type:i.SidebarInputType.Password,required:!0}],e.deriveAccountTypeOptions=a,e.derivePreOptions=function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";var i,s,u,l;const c=(0,o.cloneDeep)(t);if(c.customIntegration)return c.authenticationType===n.AuthenticationScheme.OAUTH_CLIENT_CREDENTIAL?(0,o.cloneDeep)(e.OAUTH_CLIENT_CREDENTIALS_DEFAULT_INPUTS):null!==(i=c.customIntegration.inputFields)&&void 0!==i?i:[];const f=a(c);if(null==f?void 0:f.length){const t=null==f?void 0:f.find((t=>t.id===r));if(null===(s=null==t?void 0:t.endUserSuppliedValues)||void 0===s?void 0:s.length)return(0,o.cloneDeep)(t.endUserSuppliedValues)}return(null===(l=null===(u=c.sdkIntegrationConfig)||void 0===u?void 0:u.authConfigInputs)||void 0===l?void 0:l.length)?c.sdkIntegrationConfig.authConfigInputs:[]},e.derivePostOptions=function(t){var e,r;return null!==(r=(0,o.cloneDeep)(null===(e=t.sdkIntegrationConfig)||void 0===e?void 0:e.postOauthInputs))&&void 0!==r?r:[]}},6953:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(655);n.__exportStar(r(9587),e),n.__exportStar(r(7442),e),n.__exportStar(r(4588),e),n.__exportStar(r(8452),e),n.__exportStar(r(2661),e)},8452:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.runOAuthFlow=void 0;const n=r(2460);e.runOAuthFlow=function(t,e){let{oauthTimeout:r,signal:o,pollImmediately:i=!1}=e,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;if(null==o?void 0:o.aborted)return void(null===(s=a.onError)||void 0===s||s.call(a,new n.OAuthCancelledError));const u=Math.random().toString(36).substring(2,15),l=t.buildOAuthUrl(u),c=window.open(t.getNonceUrl(u),void 0,"width=500,height=600,left=100,top=150");if(!c)throw new n.OAuthBlockedError;const f=e=>{"oauth-nonce-loaded"===e.data.type&&l.then((t=>{c.location.href=t,window.removeEventListener("message",f)})).catch((e=>{var r;const n=null!==(r=null==e?void 0:e.message)&&void 0!==r?r:"Something went wrong. Please try again later.";console.error("Build Oauth URL",{message:n,code:null==e?void 0:e.code,meta:null==e?void 0:e.meta}),c.location.href=t.getOAuthErrorRedirectUrl(n),window.removeEventListener("message",f)}))};window.addEventListener("message",f);const h=()=>{clearInterval(v)},p=Date.now(),d=new AbortController;let y=!1;const g={abortSignal:d.signal,onSuccess:t=>{var e;y||(y=!0,h(),null===(e=a.onSuccess)||void 0===e||e.call(a,t))},onError:t=>{var e;y||(y=!0,h(),d.abort(),null===(e=a.onError)||void 0===e||e.call(a,t))}},E=setInterval((()=>{try{!i&&c.opener||(clearInterval(E),t.waitForCredential(u,g))}catch(e){clearInterval(E),t.waitForCredential(u,g)}}),500),v=setInterval((()=>{try{if(!y&&r&&Date.now()-p>r)return c.close(),void g.onError(new n.OAuthTimeoutError)}catch(t){g.onError(t)}}),500);if(o){const t=()=>{var t;if(!y){y=!0,clearInterval(E),clearInterval(v),d.abort();try{c.close()}catch{}null===(t=a.onError)||void 0===t||t.call(a,new n.OAuthCancelledError)}};o.aborted?t():o.addEventListener("abort",t,{once:!0})}}},2661:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.buildSalesforceInstructionMetadata=void 0;const n=r(5349),o="login.salesforce.com/packaging/installPackage.apexp",i="https://"+o,a="appexchange.salesforce.com/appxListingDetail",s="https://"+a;e.buildSalesforceInstructionMetadata=function(t){let{integration:e,accountTypeValue:r,getAssetUrl:u,onFinish:l}=t;var c,f;if(!r||"user-configured-oauth"===r)return null;if("salesforce"!==e.type)return null;let h=null===(f=null===(c=e.sdkIntegrationConfig)||void 0===c?void 0:c.authSchemeOptions)||void 0===f?void 0:f.packageInstallUrl;if(!h)return null;const p=h.startsWith(i)||h.startsWith(o),d=h.startsWith(s)||h.startsWith(a);if(!p&&!d)return null;"sandbox"!==r||d||(h=h.replace("login.salesforce.com","test.salesforce.com"));const y="sandbox"===r,g=d?"Install App":"Install Package",E=d?"You'll need an admin to add this app from AppExchange to your Salesforce org to continue authorizing your account.":"You'll need an admin to install a package to your Salesforce org to continue authorizing your account.",v=d?`From AppExchange, click ${y?"Try It":"Get It Now"} and follow the prompts to add the app to your ${y?"Sandbox":"Production"} environment.`:'In the install prompt, choose "Install for All Users" if Salesforce users in your org other than your admin will also connect their accounts to this integration.',A=d?y?"salesforce-install-app-sandbox":"salesforce-install-app-default":"salesforce-install-package",O=d?"Go to AppExchange":"Install";return{content:(0,n.dedent)(`\n ## ${g}\n\n ${E}\n\n ![Install Image](${u(A)} "Install Image")\n\n ${v}\n `),ctas:[{type:"link",label:O,href:h},{type:"copyButton",label:"Copy link",copyText:h}],finish:{type:"finishButton",label:"I've installed the package",onClick:l},packageInstallUrl:h}}},9636:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.cloneDeep=void 0;const n=r(655).__importDefault(r(738));e.cloneDeep=function(t){return(0,n.default)(t)}},2992:(t,e)=>{"use strict";var r,n;Object.defineProperty(e,"__esModule",{value:!0}),e.DelayUnit=e.AUTH_TOKEN_ALLOWED_INTEGRATIONS=e.overrideActionAlias=e.DataSourceType=e.TokenType=e.VariableInputType=e.SidebarInputType=void 0,function(t){t.Auth="AUTH",t.Enum="ENUM",t.DynamicEnum="DYNAMIC_ENUM",t.Intent="INTENT",t.Text="TEXT",t.TextArea="TEXTAREA",t.ValueText="TEXT_NO_VARS",t.ValueTextArea="TEXTAREA_NO_VARS",t.Code="CODE",t.ActionButton="ACTION_BUTTON",t.Conditional="CONDITIONAL",t.CustomDropdown="CUSTOM_DROPDOWN",t.DynamicConditional="DYNAMIC_CONDITIONAL",t.NestedList="NESTED_LIST",t.File="FILE",t.EditableDynamicEnum="EDITABLE_DYNAMIC_ENUM",t.EditableEnum="EDITABLE_ENUM",t.BooleanInput="BOOLEAN_INPUT",t.UserSuppliedCredential="USER_SUPPLIED_CREDENTIAL",t.NativeDynamicEnumInput="NATIVE_DYNAMIC_INPUT",t.TimeConstraintInput="TIME_CONSTRAINT_INPUT",t.LinesListInput="LinesListInput",t.LinesListDynamicInput="LinesListDynamicInput",t.Number="NUMBER",t.Email="EMAIL",t.URL="URL",t.EnumTextAreaPairInput="EnumTextAreaPairInput",t.FieldMapper="FIELD_MAPPER",t.ComboInput="COMBO_INPUT",t.Password="PASSWORD",t.Switch="SWITCH",t.DynamicComboInput="DYNAMIC_COMBO_INPUT",t.CopyableButtonInput="COPYABLE_BUTTON_INPUT",t.Permission="PERMISSION"}(e.SidebarInputType||(e.SidebarInputType={})),function(t){t.MultiSelect="multi",t.String="string",t.Dropdown="dropdown",t.MultiSelectCheckbox="multiCheckbox",t.Number="number"}(e.VariableInputType||(e.VariableInputType={})),function(t){t.ACCESS_TOKEN="ACCESS_TOKEN",t.REFRESH_TOKEN="REFRESH_TOKEN",t.BOT_TOKEN="BOT_TOKEN",t.KLAVIYO_API_KEY="KLAVIYO_API_KEY",t.MARKETO_CLIENT_ID="MARKETO_CLIENT_ID",t.MARKETO_CLIENT_SECRET="MARKETO_CLIENT_SECRETI",t.MARKETO_ENDPOINT="MARKETO_ENDPOINT",t.MARKETO_IDENTITY="MARKETO_IDENTITY",t.MONDAY_API_TOKEN="MONDAY_API_TOKEN",t.ORACLE_CLOUD_URL="ORACLE_CLOUD_URL",t.ORACLE_PASSWORD="ORACLE_PASSWORD",t.ORACLE_USERNAME="ORACLE_USERNAME",t.SAGE_INTACCT_COMPANY_ID="SAGE_INTACCT_COMPANY_ID",t.SAGE_INTACCT_USER_ID="SAGE_INTACCT_USER_ID",t.SAGE_INTACCT_USER_PASSWORD="SAGE_INTACCT_USER_PASSWORD",t.SAILTHRU_COMPANY_KEY="SAILTHRU_COMPANY_KEY",t.SAILTHRU_COMPANY_SECRET="SAILTHRU_COMPANY_SECRET",t.SERVICENOW_PASSWORD="SERVICENOW_PASSWORD",t.SERVICENOW_SUBDOMAIN="SERVICENOW_SUBDOMAIN",t.SERVICENOW_USERNAME="SERVICENOW_USERNAME",t.TABLEAU_PERSONAL_ACCESS_TOKEN_NAME="TABLEAU_PERSONAL_ACCESS_TOKEN_NAME",t.TABLEAU_PERSONAL_ACCESS_TOKEN_SECRET="TABLEAU_PERSONAL_ACCESS_TOKEN_SECRET",t.TABLEAU_SERVER_NAME="TABLEAU_SERVER_NAME",t.TABLEAU_SITE_ID="TABLEAU_SITE_ID",t.TRELLO_API_KEY="TRELLO_API_KEY",t.TRELLO_API_TOKEN="TRELLO_API_TOKEN",t.WOOCOMMERCE_CONSUMER_KEY="WOOCOMMERCE_CONSUMER_KEY",t.WOOCOMMERCE_CONSUMER_SECRET="WOOCOMMERCE_CONSUMER_SECRET",t.WOOCOMMERCE_STORE_DOMAIN="WOOCOMMERCE_STORE_DOMAIN",t.WORKABLE_API_ACCESS_TOKEN="WORKABLE_API_ACCESS_TOKEN",t.WORKABLE_ACCOUNT_SUBDOMAIN="WORKABLE_ACCOUNT_SUBDOMAIN",t.ZOHO_CRM_ACCOUNTS_SERVER="ZOHO_CRM_ACCOUNTS_SERVER",t.ZOHO_CRM_API_DOMAIN="ZOHO_CRM_API_DOMAIN"}(e.TokenType||(e.TokenType={})),function(t){t.INFO="INFO",t.ERROR="ERROR",t.SUCCESS="SUCCESS"}(r||(r={})),function(t){t.NONE="NONE",t.RE_AUTHENTICATE="RE_AUTHENTICATE",t.ALERT="ALERT",t.DISPATCH="DISPATCH"}(n||(n={})),function(t){t.DYNAMIC="DYNAMIC_DATA_SOURCE",t.STATIC_ENUM="STATIC_ENUM_DATA_SOURCE",t.FIELD_MAPPER="FIELD_MAPPER_DATA_SOURCE",t.COMBO_INPUT="COMBO_INPUT_DATA_SOURCE",t.DYNAMIC_COMBO_INPUT="DYNAMIC_COMBO_INPUT_DATA_SOURCE"}(e.DataSourceType||(e.DataSourceType={})),e.overrideActionAlias={"monday.com":"monday","wordpress.com":"wordpress"},e.AUTH_TOKEN_ALLOWED_INTEGRATIONS={box:{accessTokenPath:"OAUTH_ACCESS_TOKEN"},googledrive:{accessTokenPath:"OAUTH_ACCESS_TOKEN"},onedrive:{accessTokenPath:"OAUTH_ACCESS_TOKEN",domain:"DOMAIN"},sharepoint:{accessTokenPath:"OAUTH_ACCESS_TOKEN"}},function(t){t.SECONDS="SECONDS",t.MINUTES="MINUTES",t.HOURS="HOURS",t.DAYS="DAYS"}(e.DelayUnit||(e.DelayUnit={}))},2460:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ParagonError=e.getConnectSDKError=e.OAuthCancelledError=e.OAuthTimeoutError=e.OAuthBlockedError=e.HeadlessModeNotEnabledError=e.IntegrationNotInstalledError=e.IntegrationNotFoundError=e.NoActiveInstallFlowError=e.CredentialNotReturnedFromInstallationError=e.CredentialIdNotSetError=e.UserNotAuthenticatedError=e.BaseSDKError=void 0;class r extends Error{constructor(t){super(t.message),this.name=t.name,this.meta="meta"in t?t.meta:null}}e.BaseSDKError=r;e.UserNotAuthenticatedError=class extends r{constructor(){super({name:"UserNotAuthenticatedError",message:"User not authenticated, Call paragon.authenticate(<projectId>, <user token>) before using the SDK."})}};e.CredentialIdNotSetError=class extends r{constructor(t){super({name:"CredentialIdNotSetError",message:`Credential ID not set for ${t}`})}};e.CredentialNotReturnedFromInstallationError=class extends r{constructor(t){super({name:"CredentialNotReturnedFromInstallationError",message:`Credential not found in installation event for ${t}`})}};e.NoActiveInstallFlowError=class extends r{constructor(){super({name:"NoActiveInstallFlowError",message:"No active install flow, make sure you call installFlow.start(<integrationName>, ...args) before calling any other method"})}};e.IntegrationNotFoundError=class extends r{constructor(t){super({name:"IntegrationNotFoundError",message:`Integration with name ${t} not found`,meta:{integrationName:t}})}};e.IntegrationNotInstalledError=class extends r{constructor(t){super({name:"IntegrationNotInstalledError",message:`Integration "${t}" is not installed.`,meta:{integrationName:t}}),this.integrationName=t}};e.HeadlessModeNotEnabledError=class extends r{constructor(){super({name:"HeadlessModeNotEnabledError",message:"Headless mode is not enabled. Make sure you call `paragon.setHeadless(true)` as early as possible in your code."})}};e.OAuthBlockedError=class extends r{constructor(){super({name:"OAuthBlockedError",message:"Popup was blocked by the browser."})}};e.OAuthTimeoutError=class extends r{constructor(){super({name:"OAuthTimeoutError",message:"OAuth timeout"})}};e.OAuthCancelledError=class extends r{constructor(){super({name:"OAuthCancelledError",message:"OAuth flow was cancelled."})}},e.getConnectSDKError=function(t){return t instanceof r?{name:t.name,message:t.message,meta:t.meta}:{name:"UnknownError",message:t instanceof Error?t.message:"An unknown error occurred",originalError:t}};class n extends Error{constructor(t){let{message:e,code:r,meta:n}=t;super(e),this.name="ZeusError",this.code=r,this.meta=n}}e.ParagonError=n},5349:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.dedent=void 0,e.dedent=function(t){const e=(t=t.replace(/^\n+|\n+$/g,"")).split("\n"),r=e.filter((t=>t.trim().length>0)).map((t=>t.match(/^(\s*)/)[1].length)),n=r.length>0?Math.min(...r):0;return e.map((t=>t.slice(n))).join("\n")}},8321:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.errorMessageParser=e.isIntegrationError=e.ProxyRequestError=e.getErrorMessage=e.getServiceUrl=e.sanitizeUrl=e.isValidUrl=void 0;function r(t){return t?t.match(/^[a-zA-Z]+:\/\//)?t:`https://${t}`:t}function n(t){return Array.isArray(t)?t.flatMap((t=>[t,n(t.children||[])].flatMap((t=>"string"==typeof t?t:n(t))))).filter((t=>t)).join(", "):Object.values(t.constraints||{}).join(", ")}e.isValidUrl=t=>{const e=r(t);try{return new globalThis.URL(e),!0}catch(t){return!1}},e.sanitizeUrl=r,e.getServiceUrl=function(t,e){return`https://${t}${`.${e}`}`},e.getErrorMessage=async function(t,r){var o,i;const a=null===(o=t.headers)||void 0===o?void 0:o.get("content-type"),s=a&&a.includes("application/json")?await t.json():null;let u;return u=s&&(0,e.isIntegrationError)(s.meta)?JSON.stringify(s.meta):s&&"string"==typeof s.message?s.message:s&&400===t.status&&Array.isArray(s.message)?n(s.message):s?JSON.stringify(s):await(null===(i=t.text)||void 0===i?void 0:i.call(t)),r?{message:u,response:s||t}:u};class o extends Error{constructor(t,e){super(t),this.name="Error",this.response=e,Object.setPrototypeOf(this,o.prototype)}}e.ProxyRequestError=o;e.isIntegrationError=t=>!("object"!=typeof t||!t)&&t.isIntegrationError,e.errorMessageParser=function(t){t="string"==typeof t?t:t.message;try{const r=JSON.parse(t);return!!(0,e.isIntegrationError)(r)}catch(t){return!1}}},9742:(t,e)=>{"use strict";e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,i=u(t),a=i[0],s=i[1],l=new o(function(t,e,r){return 3*(e+r)/4-r}(0,a,s)),c=0,f=s>0?a-4:a;for(r=0;r<f;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],l[c++]=e>>16&255,l[c++]=e>>8&255,l[c++]=255&e;2===s&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,l[c++]=255&e);1===s&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,l[c++]=e>>8&255,l[c++]=255&e);return l},e.fromByteArray=function(t){for(var e,n=t.length,o=n%3,i=[],a=16383,s=0,u=n-o;s<u;s+=a)i.push(l(t,s,s+a>u?u:s+a));1===o?(e=t[n-1],i.push(r[e>>2]+r[e<<4&63]+"==")):2===o&&(e=(t[n-2]<<8)+t[n-1],i.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return i.join("")};for(var r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,s=i.length;a<s;++a)r[a]=i[a],n[i.charCodeAt(a)]=a;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,n){for(var o,i,a=[],s=e;s<n;s+=3)o=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),a.push(r[(i=o)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},8764:(t,e,r)=>{"use strict";var n=r(9742),o=r(645),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.lW=u,e.h2=50;var a=2147483647;function s(t){if(t>a)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return f(t)}return l(t,e,r)}function l(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|y(t,e),n=s(r),o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(F(t,Uint8Array)){var e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return h(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(F(t,ArrayBuffer)||t&&F(t.buffer,ArrayBuffer))return p(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(F(t,SharedArrayBuffer)||t&&F(t.buffer,SharedArrayBuffer)))return p(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);var o=function(t){if(u.isBuffer(t)){var e=0|d(t.length),r=s(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||K(t.length)?s(0):h(t);if("Buffer"===t.type&&Array.isArray(t.data))return h(t.data)}(t);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function f(t){return c(t),s(t<0?0:0|d(t))}function h(t){for(var e=t.length<0?0:0|d(t.length),r=s(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function p(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function d(t){if(t>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|t}function y(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||F(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return k(t).length;default:if(o)return n?-1:j(t).length;e=(""+e).toLowerCase(),o=!0}}function g(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return U(this,e,r);case"utf8":case"utf-8":return b(this,e,r);case"ascii":return C(this,e,r);case"latin1":case"binary":return N(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function E(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function v(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),K(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:A(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):A(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function A(t,e,r,n,o){var i,a=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,r/=2}function l(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(o){var c=-1;for(i=r;i<s;i++)if(l(t,i)===l(e,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===u)return c*a}else-1!==c&&(i-=i-c),c=-1}else for(r+u>s&&(r=s-u),i=r;i>=0;i--){for(var f=!0,h=0;h<u;h++)if(l(t,i+h)!==l(e,h)){f=!1;break}if(f)return i}return-1}function O(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var a=0;a<n;++a){var s=parseInt(e.substr(2*a,2),16);if(K(s))return a;t[r+a]=s}return a}function m(t,e,r,n){return V(j(e,t.length-r),t,r,n)}function I(t,e,r,n){return V(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function w(t,e,r,n){return V(k(e),t,r,n)}function _(t,e,r,n){return V(function(t,e){for(var r,n,o,i=[],a=0;a<t.length&&!((e-=2)<0);++a)n=(r=t.charCodeAt(a))>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function T(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function b(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,a,s,u,l=t[o],c=null,f=l>239?4:l>223?3:l>191?2:1;if(o+f<=r)switch(f){case 1:l<128&&(c=l);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&l)<<6|63&i)>127&&(c=u);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&(u=(15&l)<<12|(63&i)<<6|63&a)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:i=t[o+1],a=t[o+2],s=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(u=(15&l)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=f}return function(t){var e=t.length;if(e<=S)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=S));return r}(n)}u.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return l(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return c(t),t<=0?s(t):void 0!==e?"string"==typeof r?s(t).fill(e,r):s(t).fill(e):s(t)}(t,e,r)},u.allocUnsafe=function(t){return f(t)},u.allocUnsafeSlow=function(t){return f(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(F(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),F(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var i=t[r];if(F(i,Uint8Array))o+i.length>n.length?u.from(i).copy(n,o):Uint8Array.prototype.set.call(n,i,o);else{if(!u.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o)}o+=i.length}return n},u.byteLength=y,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)E(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)E(this,e,e+3),E(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)E(this,e,e+7),E(this,e+1,e+6),E(this,e+2,e+5),E(this,e+3,e+4);return this},u.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?b(this,0,t):g.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.h2;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},i&&(u.prototype[i]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,o){if(F(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),s=Math.min(i,a),l=this.slice(n,o),c=t.slice(e,r),f=0;f<s;++f)if(l[f]!==c[f]){i=l[f],a=c[f];break}return i<a?-1:a<i?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return v(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return v(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return O(this,t,e,r);case"utf8":case"utf-8":return m(this,t,e,r);case"ascii":case"latin1":case"binary":return I(this,t,e,r);case"base64":return w(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var S=4096;function C(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function N(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function U(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=H[t[i]];return o}function R(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length-1;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function P(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function M(t,e,r,n,o,i){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function L(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,r,n,i){return e=+e,r>>>=0,i||L(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function x(t,e,r,n,i){return e=+e,r>>>=0,i||L(t,0,r,8),o.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},u.prototype.readInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||P(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||P(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return t>>>=0,e||P(t,4,this.length),o.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||P(t,4,this.length),o.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||P(t,8,this.length),o.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||P(t,8,this.length),o.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||M(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||M(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);M(this,t,e,r,o-1,-o)}var i=0,a=1,s=0;for(this[e]=255&t;++i<r&&(a*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/a>>0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);M(this,t,e,r,o-1,-o)}var i=r-1,a=1,s=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/a>>0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return x(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return x(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var o=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),o},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{var a=u.isBuffer(t)?t:u.from(t,n),s=a.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=a[i%s]}return this};var B=/[^+/0-9A-Za-z-_]/g;function j(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],a=0;a<n;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function k(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(B,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function V(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function F(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function K(t){return t!=t}var H=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=16*r,o=0;o<16;++o)e[n+o]=t[r]+t[o];return e}()},738:(t,e,r)=>{"use strict";const n=r(3341),o=r(6401),i=r(5299);function a(t,e){switch(o(t)){case"object":return function(t,e){if("function"==typeof e)return e(t);if(e||i(t)){const r=new t.constructor;for(let n in t)r[n]=a(t[n],e);return r}return t}(t,e);case"array":return function(t,e){const r=new t.constructor(t.length);for(let n=0;n<t.length;n++)r[n]=a(t[n],e);return r}(t,e);default:return n(t)}}t.exports=a},645:(t,e)=>{e.read=function(t,e,r,n,o){var i,a,s=8*o-n-1,u=(1<<s)-1,l=u>>1,c=-7,f=r?o-1:0,h=r?-1:1,p=t[e+f];for(f+=h,i=p&(1<<-c)-1,p>>=-c,c+=s;c>0;i=256*i+t[e+f],f+=h,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=n;c>0;a=256*a+t[e+f],f+=h,c-=8);if(0===i)i=1-l;else{if(i===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),i-=l}return(p?-1:1)*a*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var a,s,u,l=8*i-o-1,c=(1<<l)-1,f=c>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(a++,u/=2),a+f>=c?(s=0,a=c):a+f>=1?(s=(e*u-1)*Math.pow(2,o),a+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,o),a=0));o>=8;t[r+p]=255&s,p+=d,s/=256,o-=8);for(a=a<<o|s,l+=o;l>0;t[r+p]=255&a,p+=d,a/=256,l-=8);t[r+p-d]|=128*y}},5299:(t,e,r)=>{"use strict";var n=r(7798);function o(t){return!0===n(t)&&"[object Object]"===Object.prototype.toString.call(t)}t.exports=function(t){var e,r;return!1!==o(t)&&("function"==typeof(e=t.constructor)&&(!1!==o(r=e.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf")))}},7798:t=>{"use strict";t.exports=function(t){return null!=t&&"object"==typeof t&&!1===Array.isArray(t)}},6401:t=>{var e=Object.prototype.toString;function r(t){return"function"==typeof t.constructor?t.constructor.name:null}t.exports=function(t){if(void 0===t)return"undefined";if(null===t)return"null";var n=typeof t;if("boolean"===n)return"boolean";if("string"===n)return"string";if("number"===n)return"number";if("symbol"===n)return"symbol";if("function"===n)return"GeneratorFunction"===r(t)?"generatorfunction":"function";if(function(t){return Array.isArray?Array.isArray(t):t instanceof Array}(t))return"array";if(function(t){if(t.constructor&&"function"==typeof t.constructor.isBuffer)return t.constructor.isBuffer(t);return!1}(t))return"buffer";if(function(t){try{if("number"==typeof t.length&&"function"==typeof t.callee)return!0}catch(t){if(-1!==t.message.indexOf("callee"))return!0}return!1}(t))return"arguments";if(function(t){return t instanceof Date||"function"==typeof t.toDateString&&"function"==typeof t.getDate&&"function"==typeof t.setDate}(t))return"date";if(function(t){return t instanceof Error||"string"==typeof t.message&&t.constructor&&"number"==typeof t.constructor.stackTraceLimit}(t))return"error";if(function(t){return t instanceof RegExp||"string"==typeof t.flags&&"boolean"==typeof t.ignoreCase&&"boolean"==typeof t.multiline&&"boolean"==typeof t.global}(t))return"regexp";switch(r(t)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(function(t){return"function"==typeof t.throw&&"function"==typeof t.return&&"function"==typeof t.next}(t))return"generator";switch(n=e.call(t)){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return n.slice(8,-1).toLowerCase().replace(/\s/g,"")}},3341:(t,e,r)=>{"use strict";var n=r(8764).lW;const o=Symbol.prototype.valueOf,i=r(6401);t.exports=function(t,e){switch(i(t)){case"array":return t.slice();case"object":return Object.assign({},t);case"date":return new t.constructor(Number(t));case"map":return new Map(t);case"set":return new Set(t);case"buffer":return function(t){const e=t.length,r=n.allocUnsafe?n.allocUnsafe(e):n.from(e);return t.copy(r),r}(t);case"symbol":return function(t){return o?Object(o.call(t)):{}}(t);case"arraybuffer":return function(t){const e=new t.constructor(t.byteLength);return new Uint8Array(e).set(new Uint8Array(t)),e}(t);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return function(t,e){return new t.constructor(t.buffer,t.byteOffset,t.length)}(t);case"regexp":return function(t){const e=void 0!==t.flags?t.flags:/\w+$/.exec(t)||void 0,r=new t.constructor(t.source,e);return r.lastIndex=t.lastIndex,r}(t);case"error":return Object.create(t);default:return t}}},655:(t,e,r)=>{"use strict";r.r(e),r.d(e,{__assign:()=>i,__asyncDelegator:()=>m,__asyncGenerator:()=>O,__asyncValues:()=>I,__await:()=>A,__awaiter:()=>c,__classPrivateFieldGet:()=>S,__classPrivateFieldSet:()=>C,__createBinding:()=>h,__decorate:()=>s,__exportStar:()=>p,__extends:()=>o,__generator:()=>f,__importDefault:()=>b,__importStar:()=>T,__makeTemplateObject:()=>w,__metadata:()=>l,__param:()=>u,__read:()=>y,__rest:()=>a,__spread:()=>g,__spreadArray:()=>v,__spreadArrays:()=>E,__values:()=>d});var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)};function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var i=function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};function a(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}function s(t,e,r,n){var o,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a}function u(t,e){return function(r,n){e(r,n,t)}}function l(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function c(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))}function f(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}var h=Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]};function p(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||h(e,t,r)}function d(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function y(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function g(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(y(arguments[e]));return t}function E(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function v(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))}function A(t){return this instanceof A?(this.v=t,this):new A(t)}function O(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(t,e||[]),i=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(t){o[t]&&(n[t]=function(e){return new Promise((function(r,n){i.push([t,e,r,n])>1||s(t,e)}))})}function s(t,e){try{(r=o[t](e)).value instanceof A?Promise.resolve(r.value.v).then(u,l):c(i[0][2],r)}catch(t){c(i[0][3],t)}var r}function u(t){s("next",t)}function l(t){s("throw",t)}function c(t,e){t(e),i.shift(),i.length&&s(i[0][0],i[0][1])}}function m(t){var e,r;return e={},n("next"),n("throw",(function(t){throw t})),n("return"),e[Symbol.iterator]=function(){return this},e;function n(n,o){e[n]=t[n]?function(e){return(r=!r)?{value:A(t[n](e)),done:"return"===n}:o?o(e):e}:o}}function I(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=d(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise((function(n,o){(function(t,e,r,n){Promise.resolve(n).then((function(e){t({value:e,done:r})}),e)})(n,o,(e=t[r](e)).done,e.value)}))}}}function w(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var _=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};function T(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&h(e,t,r);return _(e,t),e}function b(t){return t&&t.__esModule?t:{default:t}}function S(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)}function C(t,e,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(t,r):o?o.value=r:e.set(t,r),r}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n=r(6953);module.exports=n})();
@@ -0,0 +1,44 @@
1
+ /*!
2
+ * The buffer module from node.js, for the browser.
3
+ *
4
+ * @author Feross Aboukhadijeh <https://feross.org>
5
+ * @license MIT
6
+ */
7
+
8
+ /*!
9
+ * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
10
+ *
11
+ * Copyright (c) 2014-2017, Jon Schlinkert.
12
+ * Released under the MIT License.
13
+ */
14
+
15
+ /*!
16
+ * isobject <https://github.com/jonschlinkert/isobject>
17
+ *
18
+ * Copyright (c) 2014-2017, Jon Schlinkert.
19
+ * Released under the MIT License.
20
+ */
21
+
22
+ /*!
23
+ * shallow-clone <https://github.com/jonschlinkert/shallow-clone>
24
+ *
25
+ * Copyright (c) 2015-present, Jon Schlinkert.
26
+ * Released under the MIT License.
27
+ */
28
+
29
+ /*! *****************************************************************************
30
+ Copyright (c) Microsoft Corporation.
31
+
32
+ Permission to use, copy, modify, and/or distribute this software for any
33
+ purpose with or without fee is hereby granted.
34
+
35
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
36
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
37
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
38
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
39
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
40
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
41
+ PERFORMANCE OF THIS SOFTWARE.
42
+ ***************************************************************************** */
43
+
44
+ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
@@ -0,0 +1,68 @@
1
+ import { IntegrationInstallEvent } from '../types/sdk';
2
+ /**
3
+ * The host-environment seam for the shared OAuth popup flow. Implementations
4
+ * own all URL construction and network I/O; `runOAuthFlow` owns the popup
5
+ * lifecycle, nonce handshake, polling handoff, timeout, and abort semantics.
6
+ */
7
+ export type OAuthTransport = {
8
+ /**
9
+ * Starts the build-oauth request and resolves with the provider authorize
10
+ * URL the popup should navigate to. Called eagerly (before the nonce
11
+ * handshake completes) so the request is in flight while the popup loads.
12
+ * Rejections route the popup to `getOAuthErrorRedirectUrl`.
13
+ */
14
+ buildOAuthUrl(oauthMetaKeyId: string): Promise<string>;
15
+ /**
16
+ * The URL the popup is initially opened with. The nonce endpoint sets the
17
+ * CSRF cookie and postMessages `oauth-nonce-loaded` back to the opener,
18
+ * which is the signal to navigate the popup to the built OAuth URL.
19
+ */
20
+ getNonceUrl(oauthMetaKeyId: string): string;
21
+ /**
22
+ * Where the popup is sent when building the OAuth URL fails.
23
+ */
24
+ getOAuthErrorRedirectUrl(errorMessage: string): string;
25
+ /**
26
+ * Polls until the credential lands after the OAuth callback. Callback-style
27
+ * to match historical SDK semantics; implementations must honor
28
+ * `abortSignal` and stop calling handlers afterwards.
29
+ */
30
+ waitForCredential(oauthMetaKeyId: string, options: {
31
+ abortSignal?: AbortSignal;
32
+ onSuccess?: (installationEvent: IntegrationInstallEvent) => void;
33
+ onError?: (error: unknown) => void;
34
+ }): void;
35
+ };
36
+ export type RunOAuthFlowParams = {
37
+ oauthTimeout?: number;
38
+ /**
39
+ * When aborted, polling and popup watchers are torn down, the popup is
40
+ * closed when possible, and `onError` receives an `OAuthCancelledError`.
41
+ * `onSuccess` is not invoked afterwards.
42
+ */
43
+ signal?: AbortSignal;
44
+ /**
45
+ * When true, credential polling starts on the first popup-status tick
46
+ * instead of waiting for the popup to lose its `opener` (headless hosts,
47
+ * where COOP/opener access is unreliable).
48
+ */
49
+ pollImmediately?: boolean;
50
+ };
51
+ export type RunOAuthFlowHandlers = {
52
+ onSuccess?: (installationEvent: IntegrationInstallEvent) => void;
53
+ onError?: (error: unknown) => void;
54
+ };
55
+ /**
56
+ * Runs the OAuth popup flow against a host-supplied transport:
57
+ *
58
+ * oauthNonce popup -> buildOAuthUrl -> provider authorize URL -> callback
59
+ *
60
+ * The popup opens on the nonce URL first so the CSRF cookie lands before any
61
+ * redirect; the nonce page postMessages back when loaded, and only then is
62
+ * the popup navigated to the provider URL. Credential completion is detected
63
+ * by `transport.waitForCredential` once the popup loses its `opener` (or
64
+ * immediately when `pollImmediately` is set).
65
+ *
66
+ * Throws `OAuthBlockedError` synchronously when the popup cannot be opened.
67
+ */
68
+ export declare function runOAuthFlow(transport: OAuthTransport, { oauthTimeout, signal, pollImmediately }: RunOAuthFlowParams, handlers?: RunOAuthFlowHandlers): void;
@@ -0,0 +1,17 @@
1
+ import { InstructionMetadata } from '../types/action';
2
+ import { InstallFlowIntegrationConfig } from './InstallFlowClient';
3
+ /**
4
+ * Builds the instruction-stage content for Salesforce integrations whose auth
5
+ * requires installing a managed package or AppExchange app first. Returns
6
+ * null when the integration/account-type combination needs no instruction
7
+ * step (including all non-Salesforce integrations).
8
+ *
9
+ * `onFinish` is invoked by the stage's finish button; the host (InstallFlow)
10
+ * uses it to mark the instruction as completed and advance the flow.
11
+ */
12
+ export declare function buildSalesforceInstructionMetadata({ integration, accountTypeValue, getAssetUrl, onFinish, }: {
13
+ integration: InstallFlowIntegrationConfig;
14
+ accountTypeValue: string | null;
15
+ getAssetUrl: (name: string) => string;
16
+ onFinish: () => void;
17
+ }): InstructionMetadata | null;
@@ -1,5 +1,6 @@
1
1
  /// <reference types="google.picker" />
2
- import ConnectSDK, { InstallFlow } from '../ConnectSDK';
2
+ import type ConnectSDK from '../ConnectSDK';
3
+ import type { InstallFlow } from '../ConnectSDK';
3
4
  import { IConnectCredential } from '../entities/connectCredential.interface';
4
5
  import { IConnectCredentialConfig } from '../entities/connectCredentialConfig.interface';
5
6
  import { OauthCallbackResponse } from '../entities/credential.interface';
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@useparagon/connect",
3
- "version": "3.1.0",
3
+ "version": "3.2.0-experimental-27263.1",
4
4
  "description": "Embed integrations into your app with the Paragon SDK",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
7
7
  "exports": {
8
8
  ".": "./dist/src/index.js",
9
- "./ConnectSDK": "./dist/src/ConnectSDK.js"
9
+ "./ConnectSDK": "./dist/src/ConnectSDK.js",
10
+ "./install-flow": "./dist/src/install-flow/index.js"
10
11
  },
11
12
  "scripts": {
12
13
  "start:dev": "NODE_ENV=development webpack serve",