@useparagon/connect 1.0.36 → 1.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/ConnectSDK.d.ts +1 -2
- package/dist/src/ConnectSDK.js +1 -1
- package/dist/src/constants.d.ts +0 -1
- package/dist/src/file-picker/integrations/box.d.ts +77 -0
- package/dist/src/file-picker/integrations/index.d.ts +2 -0
- package/dist/src/index.js +1 -1
- package/dist/src/types/connect.d.ts +0 -4
- package/dist/src/types/connectModal.d.ts +1 -0
- package/dist/src/types/sdk.d.ts +16 -0
- package/dist/src/utils/connect.d.ts +1 -5
- package/package.json +1 -1
package/dist/src/ConnectSDK.d.ts
CHANGED
|
@@ -215,7 +215,6 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
|
|
|
215
215
|
private updateLocalState;
|
|
216
216
|
/**
|
|
217
217
|
* gets the user data from api `/sdk/me`
|
|
218
|
-
* userMeta header is passed to support user metadata upsert based on authentication options
|
|
219
218
|
*/
|
|
220
219
|
private fetchUserData;
|
|
221
220
|
/**
|
|
@@ -245,7 +244,7 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
|
|
|
245
244
|
completeInstall(action: string, options: CompleteInstallOptions): Promise<void>;
|
|
246
245
|
/**
|
|
247
246
|
* update credential data in integration
|
|
248
|
-
* @param
|
|
247
|
+
* @param newCredential
|
|
249
248
|
* @param integration
|
|
250
249
|
*/
|
|
251
250
|
private updateCredentialData;
|
package/dist/src/ConnectSDK.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see ConnectSDK.js.LICENSE.txt */
|
|
2
|
-
(()=>{var e={773:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExternalFilePicker=t.PARAGON_OVERFLOW_EMPTY_VALUE=void 0;const i=n(655),r=i.__importDefault(n(245)),o=n(931),s=n(59),a=n(745),l=n(343),d=n(50);Object.defineProperty(t,"ExternalFilePicker",{enumerable:!0,get:function(){return d.ExternalFilePicker}});const c=n(643),u=n(429),h=i.__importDefault(n(892)),f=n(821),p=n(158),g=n(846),E=n(572),_=n(321),v=n(35),I="paragon-connect-frame",C=`${I}-container`,S="paragon-connect-user-state";t.PARAGON_OVERFLOW_EMPTY_VALUE="PARAGON_OVERFLOW_EMPTY_VALUE";class O extends h.default{constructor(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(super(),this.rootLoaded=!1,this.rootElementCreated=!1,this.modalState={integration:null,onClose:this.onClose.bind(this),overlayStyle:{overflow:"auto"},onOpen:this.onOpen.bind(this),apiInstallationOptions:{isApiInstallation:!1,showPortalAfterInstall:!1}},this.userState={authenticated:!1},this.loadedConfigs={},this.loadedIntegrations={},this.endUserIntegrationConfig={},this.metadata={},this.cachedApiResponse=new v.CacheThrottle({ttl:5e3}),this.keyToRequestPromiseMap={},this.originalBodyOverflow=t.PARAGON_OVERFLOW_EMPTY_VALUE,this.customDropdownOptionsLoaders={},"undefined"==typeof window)return void console.warn("connect sdk can only be used on browser");const i=(0,p.getAssetUrl)({CDN_PUBLIC_URL:"https://cdn.useparagon.com",DASHBOARD_PUBLIC_URL:"https://dashboard.useparagon.com",NODE_ENV:"production",PLATFORM_ENV:"production",VERSION:"latest"});if(this.environments={CDN_PUBLIC_URL:i,CONNECT_PUBLIC_URL:"https://connect.useparagon.com",DASHBOARD_PUBLIC_URL:"https://dashboard.useparagon.com",HERMES_PUBLIC_URL:"https://hermes.useparagon.com",NODE_ENV:"production",PASSPORT_PRODUCTION_URL:"https://passport.useparagon.com",PASSPORT_PUBLIC_URL:"https://passport.useparagon.com",PLATFORM_ENV:"production",VERSION:"latest",WORKER_PROXY_PUBLIC_URL:"https://proxy.useparagon.com",ZEUS_PUBLIC_URL:"https://zeus.useparagon.com"},this.userState={authenticated:!1},"string"==typeof e?this.configureGlobal({host:e}):this.environments={...this.environments,...e},!this.environments.CONNECT_PUBLIC_URL)throw new Error("Paragon SDK error! No `CONNECT_PUBLIC_URL` configured.");if(!this.environments.DASHBOARD_PUBLIC_URL)throw new Error("Paragon SDK error! No `DASHBOARD_PUBLIC_URL` configured.");if(!this.environments.PASSPORT_PUBLIC_URL)throw new Error("Paragon SDK error! No `PASSPORT_PUBLIC_URL` configured.");if(!this.environments.WORKER_PROXY_PUBLIC_URL)throw new Error("Paragon SDK error! No `WORKER_PROXY_PUBLIC_URL` configured.");if(!this.environments.ZEUS_PUBLIC_URL)throw new Error("Paragon SDK error! No `ZEUS_PUBLIC_URL` configured.");n.skipBootstrapWithLastKnownState||this.loadState(),window.addEventListener("message",this.eventMessageHandler.bind(this)),window.document.readyState===f.DocumentLoadingState.LOADING?window.document.addEventListener("DOMContentLoaded",(()=>{this.createReactRoot()})):this.createReactRoot()}async eventMessageHandler(e){switch(e.data.type){case"oauth_success_callback":await this._oauthCallback(e.data.credential);break;case"oauth_error_callback":await this._oauthErrorCallback(e.data.error,e);break;default:await this.functionInvocationHandler(e)}}async functionInvocationHandler(e){if("SDK_FUNCTION_INVOCATION"!==e.data.messageType)return;const{type:t,id:n,parameters:i}=e.data;let r;try{r={messageType:"SDK_FUNCTION_RESPONSE",id:n,type:t,result:await this[t](...i)}}catch(e){r={messageType:"SDK_FUNCTION_ERROR",error:!0,message:e.message,id:n}}e.source.postMessage(r,this.environments.CONNECT_PUBLIC_URL)}createReactRoot(){var e;if(this.rootElementCreated)return;this.rootElementCreated=!0,this.root=document.createElement("iframe"),this.root.onload=()=>{this.rootLoaded=!0,this.render()};const t=!!document.querySelector(`#${C}`);this.root.id=I,this.root.src=`${this.environments.CONNECT_PUBLIC_URL}/ui${this.projectId?`?projectId=${this.projectId}`:""}`,this.root.style.position=t?"absolute":"fixed",this.root.style.top="0",this.root.style.left="0",this.root.style.width=t?"100%":"100vw",this.root.style.height=t?"100%":"100vh",this.root.style.zIndex="2147483647",this.root.style.display="none",null===(e=document.querySelector(`#${C}`)||document.body)||void 0===e||e.appendChild(this.root)}validateAction(e){var t;if(!this.loadedIntegrations[e]&&!(0,l.isCustomIntegrationTypeName)(e))throw new Error(`"${e}" is not a valid integration type. The integrations you have configured for this Paragon project are:\n\n${Object.keys(this.loadedConfigs).map((e=>`- "${e}"`)).join("\n")}\n`);if(!this.loadedConfigs[e]||!this.userState.integrations[e])throw new Error(`integration "${e}" has not been set up in your Paragon project yet.\n\n${Object.keys(this.loadedConfigs).map((e=>`- "${e}"`)).join("\n")}`);if(!(null===(t=this.loadedIntegrations[e])||void 0===t?void 0:t.isActive))throw new Error(`integration "${e}" is not active in your Paragon project yet.`)}isAlreadyInstalled(e,t,n){var i,r;if(n){const e=this.getCredentialAndConfig({selectedCredentialId:n});return(null===(i=null==e?void 0:e.selectedCredential)||void 0===i?void 0:i.status)===s.CredentialStatus.VALID}return Boolean(null===(r=t.integrations[e])||void 0===r?void 0:r.enabled)}async bootstrapSDKState(e){this.projectId&&this.userState.authenticated&&await this.updateLocalState(e)}setModalState(e){this.modalState={config:void 0,...this.modalState,...e},this.render()}loadState(){if("undefined"!=typeof window)try{const e=window.localStorage.getItem(S)?JSON.parse(window.localStorage.getItem(S)):{};if(e.projectId&&(this.projectId=e.projectId),e.userState){const{userState:t}=e;if(!("authenticated"in t&&t.authenticated&&"token"in t))throw new Error("Malformatted or unauthenticated user was persisted into localStorage. Refusing to load.");this.updateAuthenticatedUser(t),this.bootstrapSDKState().catch((()=>{this.clearState()}))}}catch{this.clearState()}}saveState(){"undefined"!=typeof window&&this.userState.authenticated&&window.localStorage.setItem(S,JSON.stringify({projectId:this.projectId,userState:this.userState}))}clearState(){"undefined"!=typeof window&&window.localStorage.removeItem(S)}render(){if(this.root&&this.rootLoaded){const{onClose:e,onOpen:t,...n}=this.modalState,i={messageType:"UI_UPDATE",nextContext:{user:this.userState,projectId:this.projectId,environments:this.environments,project:this.project,endUserIntegrationConfig:this.modalState.integration?this.endUserIntegrationConfig[(0,l.getIntegrationTypeName)(this.modalState.integration)||""]:void 0},nextModalState:n};if(!this.root.contentWindow)throw new Error("Browser not supported");this.root.contentWindow.postMessage(i,this.environments.CONNECT_PUBLIC_URL)}}updateContainerStyle(e){let{isModalShown:t}=e;this.root&&(this.root.style.display=t?"block":"none")}async authenticate(e,t,n){var i;if(!e||!t)throw new Error("projectId or token not specified to paragon.authenticate()");let o={};try{o=(0,r.default)(t)}catch(e){throw new Error("A well-formed JWT was not provided to paragon.authenticate()")}this.projectId=e,this.userState={authenticated:!0,token:t,userId:o.sub||o.id,integrations:{},meta:null!==(i=null==n?void 0:n.metadata)&&void 0!==i?i:{},resources:[]};try{if(Date.now()>=1e3*(o.exp||0))throw new Error("JWT token provided has expired.");await this.bootstrapSDKState(null==n?void 0:n.metadata)}catch(e){throw console.warn("paragon.authenticate() could not login user",e),this.logout(),new Error(`Failed to authenticate user with Paragon: ${e.message}`)}this.render()}getUser(){return Object.fromEntries(Object.entries(this.userState).filter((e=>{let[t]=e;return"token"!==t})))}updateAuthenticatedUser(e){this.userState.authenticated?this.userState={...this.userState,...e}:e.authenticated&&(this.userState=e),this.render()}logout(){this.userState={authenticated:!1},this.clearState(),this.render()}async connect(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{mapObjectFields:n,overrideRedirectUrl:i,isApiInstallation:r=!1,showPortalAfterInstall:o,bypassPostOAuthPrompt:s,allowMultipleCredentials:d,selectedCredentialId:h,selectedConfigurationId:p,accountType:g,...E}=t;return this.integrationToBeEnabled=e,new Promise(((v,I)=>{var C,S;if(!this.userState.authenticated)throw new Error("User not authenticated, Call paragon.authenticate(<projectId>, <user token>) before using the SDK.");const O=Array.isArray(g)?{selectedMultipleAccountTypes:g}:{};this.subscribeToIntegration(e,{...E,onInstall:(t,n)=>{var i;const r=n.integrations[e];t.credentialId=null==r?void 0:r.credentialId,t.credential=null==r?void 0:r.allCredentials.find((e=>e.id===r.credentialId)),v(t),(null==E?void 0:E.onInstall)?E.onInstall(t,n):null===(i=null==E?void 0:E.onSuccess)||void 0===i||i.call(E,t,n)},onError:e=>{var t;I(e),null===(t=null==E?void 0:E.onError)||void 0===t||t.call(E,e)}});try{if(n&&!this.project.accessibleFeatures.includes(f.ConnectAddOn.DynamicFieldMapper))throw new Error("Dynamic Field Mapping is available on our Enterprise plan. Contact sales@useparagon.com to learn more or upgrade.");if(this.validateAction(e),i&&!(0,_.isValidUrl)(i))throw new Error(`${i} is not valid url.`);this.endUserIntegrationConfig[e]={mapObjectFields:n,overrideRedirectUrl:i?(0,_.sanitizeUrl)(i):void 0};const E=Object.values(this.loadedIntegrations).find((t=>(0,l.getIntegrationTypeName)(t)===e)),v="string"==typeof g?null==g?void 0:g.trim():"",I=Array.isArray(g)?g.filter((e=>{var t,n;return!(null===(n=null===(t=null==E?void 0:E.sdkIntegrationConfig)||void 0===t?void 0:t.accountTypes)||void 0===n?void 0:n.some((t=>t.id===e)))})):[],y=(0,c.findSelectedAccountType)(null===(C=null==E?void 0:E.sdkIntegrationConfig)||void 0===C?void 0:C.accountTypes,v,null==O?void 0:O.selectedMultipleAccountTypes),A={isApiInstallation:r,showPortalAfterInstall:o,bypassPostOAuthPrompt:s,allowMultipleCredentials:d,selectedCredentialId:h,selectedConfigurationId:p};if(this.setCredentialConfigForUserState(e,h,p),t.isApiInstallation){const t={context:{user:this.userState,projectId:this.projectId,environments:this.environments,endUserIntegrationConfig:this.endUserIntegrationConfig[e]},integration:E};if(Boolean(E.needPreOauthInputs&&y&&!(null===(S=y.endUserSuppliedValues)||void 0===S?void 0:S.length)&&y.scheme===a.AuthenticationScheme.OAUTH)||!E.needPreOauthInputs){t.authParams=null==y?void 0:y.oauthParameters,t.installOptions=A;const n=Math.random().toString(36).substring(2,15),i=(0,u.startOAuthFlow)(t,n);if(i){const t=Date.now(),r=setInterval((()=>{if(Date.now()-t>u.MAX_POLL_DURATION)clearInterval(r);else try{i.opener||(clearInterval(r),this.pollForCredential(e,n))}catch(t){clearInterval(r),this.pollForCredential(e,n)}}),500)}}}(g&&!y&&"string"==typeof g||I.length)&&console.warn(`Account type "${I.length?I:g}" is not valid for integration "${null==E?void 0:E.type}"`);const w=JSON.parse(JSON.stringify(this.loadedConfigs[e])),T=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(!e)return;const t=new Set,n=[];for(const i of e)t.has(i.value)?console.warn(`Duplicated key: "${i.value}", Ignored: "${i.label}"`):(n.push(i),t.add(i.value));return n};if("dropdowns"in t){const n=t.dropdowns,i=[];for(const e in n){const t=n[e];if("loadOptions"in t){const n=t.loadOptions;this.customDropdownOptionsLoaders[e]=n,i.push(e)}}if(w.sharedMeta&&Array.isArray(w.sharedMeta.inputs))for(const e of w.sharedMeta.inputs){if(i.includes(e.key)){e.customDropdownOptions=[];continue}const t=T(n[e.key]);t&&e.customDropdownOptions&&(e.customDropdownOptions=t)}if(w.workflowMeta)for(const e in w.workflowMeta){const t=w.workflowMeta[e];for(const e of t.inputs){if(i.includes(e.key)){e.customDropdownOptions=[];continue}const t=T(n[e.key]);t&&e.customDropdownOptions&&(e.customDropdownOptions=t)}}this.loadedConfigs[e]=w}this.setModalState({integration:E,config:this.loadedConfigs[e],apiInstallationOptions:{...A,...O,selectedAccountConfig:y},selectedCredentialId:h,connectionError:void 0})}catch(t){this.emitError(t,e)}}))}setCredentialConfigForUserState(e,t,n){var i,r,o;if(!this.userState.authenticated||!(null===(i=this.userState.integrations[e])||void 0===i?void 0:i.allCredentials.length))return;const a=this.userState.integrations[e],l=null!==(r=null==a?void 0:a.credentialId)&&void 0!==r?r:null==a?void 0:a.allCredentials[0].id,d=this.getCredentialAndConfig(t||n?{selectedCredentialId:t,selectedConfigurationId:n}:{selectedCredentialId:l},a);if(!(null===(o=null==a?void 0:a.allCredentials)||void 0===o?void 0:o.some((e=>{let{id:t}=e;return t===(null==d?void 0:d.selectedCredential.id)})))||!d)throw new Error(`Credential with ID "${t}" is not a valid ${e} account.`);const{selectedConfig:c,selectedCredential:u}=d,h={...a,allConfigurations:(null==a?void 0:a.allConfigurations)||[],allCredentials:(null==a?void 0:a.allCredentials)||[],enabled:u.status===s.CredentialStatus.VALID,credentialId:u.id,credentialStatus:u.status,providerData:u.providerData,providerId:u.providerId,configMeta:null==c?void 0:c.configMeta,credentialConfigId:null==c?void 0:c.id,externalId:null==c?void 0:c.externalId,sharedSettings:null==c?void 0:c.sharedSettings,workflowSettings:null==c?void 0:c.workflowSettings,configuredWorkflows:null==c?void 0:c.workflowSettings};this.userState.integrations={...this.userState.integrations,[e]:h}}getCredentialAndConfig(e,t){var n;const{selectedCredentialId:i,selectedConfigurationId:r}=e;if(!this.userState.authenticated||!i&&!r)return;let o,s;const a=null!==(n=null==t?void 0:t.allCredentials)&&void 0!==n?n:Object.values(this.userState.integrations).flatMap((e=>(null==e?void 0:e.allCredentials)||[])),l=a.flatMap((e=>{let{configurations:t}=e;return t}));if(r){const e=r.startsWith("ext:")||!(0,E.isUUID)(r),t=(0,p.sanitizeExternalConfigId)(r);if(s=l.find((n=>(e?n.externalId===t:n.id===t)&&(!i||n.connectCredentialId===i))),!s)throw new Error(`Credential configuration not found for provided id: ${r}.`)}if(o=a.find((e=>{let{id:t}=e;return t===((null==s?void 0:s.connectCredentialId)||i)})),s=null!=s?s:null==o?void 0:o.configurations.find((e=>{let{isDefault:t}=e;return t})),!o)throw new Error("Unable to find credential for provided options.");if(!s)throw new Error(`Credential configuration not found for credential: ${o.id}.`);if(s&&s.connectCredentialId!==(null==o?void 0:o.id))throw new Error('Provided "selectedCredentialId" does not belongs to provided "selectedConfigurationId".');return{selectedCredential:o,selectedConfig:s}}_getIntegration(e){return Object.values(this.loadedIntegrations).find((t=>t.id===e))}async _oauthCallback(e,t){var n;const{integrationId:i,payload:r}=e,o=this._getIntegration(i);if(!o)return;const a=(0,g.hash)(JSON.stringify({oauthResponse:e,credentialId:t}));if(await this.cachedApiResponse.get(a))return;await this.cachedApiResponse.set(a,!0);const d=(0,l.getIntegrationTypeName)(o),c=(null===(n=this.modalState.apiInstallationOptions)||void 0===n?void 0:n.isApiInstallation)?this.modalState.apiInstallationOptions:{};try{const e=t?`/sdk/credentials/${t}/complete-setup`:"/sdk/credentials",n=await this.sendConnectRequest(e,{method:"POST",body:JSON.stringify({integrationId:o.id,config:{},payload:r,installOptions:c})});if(!n)throw new Error("Unable to save oauth credentials");this.updateCredentialData(n,o),n.status===s.CredentialStatus.VALID&&this.triggerSDKEvent({type:f.SDK_EVENT.ON_INTEGRATION_INSTALL,integrationId:o.id,integrationType:d}),this.setModalState({...this.modalState,connectionError:void 0})}catch(e){this.setModalState({...this.modalState,connectionError:e}),this.emitError(e,d),await this._oauthErrorCallback(e.message)}}async _oauthErrorCallback(e,t){var n;const i=e;let r;r=this.integrationToBeEnabled?this.loadedIntegrations[this.integrationToBeEnabled].id:null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.integrationId,t&&(this.emitError(t.data.errorResponse,(0,l.getIntegrationTypeName)(this._getIntegration(r))),this.setModalState({...this.modalState,connectionError:t.data})),console.error("Failed to connect account to Paragon over OAuth",i)}async _loadCustomDropdownOptions(e,t,n){return this.customDropdownOptionsLoaders[e](t,n)}async sendConnectRequest(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];var i;if(!this.userState.authenticated||!this.projectId)throw new Error("Connect SDK attempted to make an API request, but no user was authenticated.\nCall paragon.authenticate(<projectId>, <user token>) before using the SDK.");const r=`${null!==(i=null==t?void 0:t.baseURLOverride)&&void 0!==i?i:this.environments.ZEUS_PUBLIC_URL}${n?`/projects/${this.projectId}`:""}${e}`,o=(0,g.hash)(JSON.stringify({url:r,payload:{...t}})),s=await this.cachedApiResponse.get(o,!0);if((null==t?void 0:t.cacheResult)&&s)return s;const a=Boolean(!t||"GET"===t.method||t.cacheResult);if(a&&"object"==typeof this.keyToRequestPromiseMap[o])return this.keyToRequestPromiseMap[o];const l=this.userState.token,d=this.modalState.integration&&this.integrationToBeEnabled?this.userState.integrations[this.integrationToBeEnabled]:void 0,c=new Promise(((e,n)=>{(async()=>{try{const n=await this.sendRequest(r,{...t,headers:{Accept:"application/json","Content-Type":"application/json",...(null==d?void 0:d.credentialId)?{[f.SELECTED_CREDENTIAL_ID_HEADER]:null==d?void 0:d.credentialId}:{},...null==t?void 0:t.headers,Authorization:`Bearer ${l}`}},a?o:void 0);e(n)}catch(e){n(e)}})()}));return a&&(this.keyToRequestPromiseMap[o]=c),c}async sendRequest(e,t,n){var i;let r,s,a;try{r=await fetch(e,t)}catch(e){a=e}if(r&&!r.ok||a){const t=r?await(0,_.getErrorMessage)(r,!0):null==a?void 0:a.message,s="string"==typeof t?t:null==t?void 0:t.message,l=(0,_.errorMessageParser)(s),d="object"==typeof t&&t.response.code===o.INSUFFICIENT_PERMISSION,c="object"==typeof t&&[o.BYO_CREDENTIAL_VERIFICATION_ERROR,o.BYO_USER_PROFILE_ERROR_CODE].includes(t.response.code),u=401===(null==r?void 0:r.status)||403===(null==r?void 0:r.status),h=!l&&!d&&!c&&u;if(h&&!e.includes("proxy"))this.logout();else if(h&&e.includes("proxy")){const e=await this.fetchUserData();this.updateAuthenticatedUser({integrations:e.integrations,meta:e.meta,resources:e.resources})}if(n&&(await this.cachedApiResponse.del(n),delete this.keyToRequestPromiseMap[n]),"string"!=typeof t&&e.includes("proxy"))throw null===(i=t.response)||void 0===i||delete i.headers,new _.ProxyRequestError(t.message,t.response);throw new Error("string"==typeof t?s:JSON.stringify(t.response))}try{s=await(null==r?void 0:r.json())}catch{s=void 0}return n&&(await this.cachedApiResponse.set(n,s),delete this.keyToRequestPromiseMap[n]),s}async request(e,t,n){var i,r;let o=`/sdk/proxy/${e}`;(0,l.isCustomIntegrationTypeName)(e)&&(o=`/sdk/proxy/custom/${null===(i=Object.values(this.loadedIntegrations).find((t=>!!t.customIntegration&&t.customIntegration.slug===e)))||void 0===i?void 0:i.id}`);const s=t.startsWith("/")?t:`/${t}`,a=n.selectedCredentialId?n.selectedCredentialId:null===(r=this.userState.integrations[e])||void 0===r?void 0:r.credentialId,d=await this.sendConnectRequest(`${o}${s}`,{method:n.method,body:"object"==typeof n.body?JSON.stringify(n.body):n.body,headers:{"Content-Type":f.INFER_CONTENT_TYPE_FROM_CONNECT_OPTIONS,...a?{[f.SELECTED_CREDENTIAL_ID_HEADER]:a}:{},...n.headers},baseURLOverride:this.environments.WORKER_PROXY_PUBLIC_URL});return null==d?void 0:d.output}async event(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{selectedConfigurationId:i,selectedCredentialId:r}=n;if(i&&!r||!i&&r)throw new Error("Both Configuration ID and Credential ID must either be provided together or not at all.");const o=this.getCredentialAndConfig({selectedConfigurationId:i,selectedCredentialId:r});await this.sendConnectRequest(`/v2/projects/${this.projectId}/sdk/events/trigger`,{method:"POST",headers:{...o?{[f.SELECTED_CREDENTIAL_ID_HEADER]:o.selectedCredential.id,[f.SELECTED_CREDENTIAL_CONFIG_ID_HEADER]:o.selectedConfig.id}:{}},body:JSON.stringify({name:e,payload:t})},!1)}onClose(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{integration:n,apiInstallationOptions:i}=this.modalState;n&&(this.triggerSDKEvent({type:f.SDK_EVENT.ON_PORTAL_CLOSE,integrationId:n.id,integrationType:(0,l.getIntegrationTypeName)(n)}),this.originalBodyOverflow!==t.PARAGON_OVERFLOW_EMPTY_VALUE&&(window.document.body.style.overflow=this.originalBodyOverflow,this.originalBodyOverflow=t.PARAGON_OVERFLOW_EMPTY_VALUE),!e&&(null==i?void 0:i.isApiInstallation)||(this.setModalState({integration:null}),this.integrationToBeEnabled=void 0))}onOpen(){const{integration:e}=this.modalState;if(e&&(this.triggerSDKEvent({type:f.SDK_EVENT.ON_PORTAL_OPEN,integrationId:e.id,integrationType:(0,l.getIntegrationTypeName)(e)}),this.root&&this.originalBodyOverflow===t.PARAGON_OVERFLOW_EMPTY_VALUE)){const e=this.root.getBoundingClientRect();window.innerHeight<=e.height&&window.innerWidth<=e.width&&(this.originalBodyOverflow=window.document.body.style.overflow,window.document.body.style.overflow="hidden")}}triggerSDKEvent(e){this.triggerEvent(e,this.userState)}getIntegrationMetadata(e){const t=e=>{return{...e,icon:(t=e.icon,t.includes(".svg")?(null===(n=t.split(".svg"))||void 0===n?void 0:n[0])+".svg":t)};var t,n};if(e){const n=this.metadata[e];if(!n)throw new Error(`${e} is not a valid integration name`);return t(n)}return Object.values(this.metadata).map(t)}closePortal(){this.onClose(!0)}workflow(e){let{selectedCredentialId:t,selectedConfigurationId:n,body:i={},query:r={},headers:o={}}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var s;if(!e)throw new Error("workflowId is required.");const a=new URLSearchParams(r).toString(),{integrationState:l}=this.getIntegrationForWorkflow(e),d=this.getCredentialAndConfig(t||n?{selectedCredentialId:t,selectedConfigurationId:n}:{selectedCredentialId:l.credentialId},l);if(!d||!(null===(s=d.selectedConfig.workflowSettings[e])||void 0===s?void 0:s.enabled))throw new Error(`Workflow ${e} is not enabled for this user.`);return this.sendConnectRequest(`/sdk/triggers/${e}?${a}`,{method:"POST",body:JSON.stringify(i),headers:{[f.SELECTED_CREDENTIAL_ID_HEADER]:d.selectedCredential.id,[f.SELECTED_CREDENTIAL_CONFIG_ID_HEADER]:d.selectedConfig.id,...o}},!0)}installIntegration(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.userState.authenticated)throw new Error("User not authenticated, Call paragon.authenticate(<projectId>, <user token>) before using the SDK.");const n={showPortalAfterInstall:!1,bypassPostOAuthPrompt:!1,allowMultipleCredentials:!1,...t,isApiInstallation:!0};if(n.bypassPostOAuthPrompt&&n.showPortalAfterInstall)throw new Error("Could not use both `bypassPostOAuthPrompt` and `showPortalAfterInstall` as true at the same time.");if(this.ensureHeadlessIsSupported(),this.validateAction(e),!n.allowMultipleCredentials&&this.isAlreadyInstalled(e,this.userState))throw new Error(`Integration "${e}" is already installed.`);return this.setModalState({integration:null}),this.connect(e,n)}ensureHeadlessIsSupported(){if(!this.project.accessibleFeatures.includes(f.ConnectAddOn.HeadlessConnectPortal))throw new Error("Headless Connect Portal is available on our Pro plan and above. Contact sales@useparagon.com to learn more or upgrade.")}async uninstallIntegration(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=null==t?void 0:t.selectedCredentialId;if(!this.userState.authenticated)throw new Error("User not authenticated, Call paragon.authenticate(<projectId>, <user token>) before using the SDK.");if(this.ensureHeadlessIsSupported(),this.validateAction(e),!this.isAlreadyInstalled(e,this.userState,t.selectedCredentialId))throw new Error(`Integration "${e}" is not installed.`);const i=this.loadedIntegrations[e].id,r=this.userState.integrations[e],o=n||(null==r?void 0:r.credentialId);if(!o||!r)throw new Error("No credential found for uninstall");await this.sendConnectRequest(`/sdk/integrations/${i}`,{method:"DELETE",headers:{...o?{[f.SELECTED_CREDENTIAL_ID_HEADER]:o}:{}}}),this.updateAuthenticatedUser({integrations:{...this.userState.integrations,[e]:(0,c.getActionStateForCredentialDelete)(o,r)}}),n===this.modalState.selectedCredentialId&&this.setModalState({integration:null,selectedCredentialId:void 0}),this.saveState(),this.triggerSDKEvent({type:f.SDK_EVENT.ON_INTEGRATION_UNINSTALL,integrationId:i,integrationType:e})}async disableWorkflow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var n;const{selectedCredentialId:i,selectedConfigurationId:r}=t,{integration:o,integrationState:s}=this.getIntegrationForWorkflow(e),a=this.getCredentialAndConfig(i||r?{selectedCredentialId:i,selectedConfigurationId:r}:{selectedCredentialId:s.credentialId},s);if(!a||!(null===(n=a.selectedConfig.workflowSettings[e])||void 0===n?void 0:n.enabled))throw new Error(`Workflow ${e} cannot be disabled for this user.`);const{selectedConfig:l,selectedCredential:d}=a;await this.sendConnectRequest(`/sdk/workflows/${e}`,{method:"DELETE",headers:{[f.SELECTED_CREDENTIAL_ID_HEADER]:d.id,[f.SELECTED_CREDENTIAL_CONFIG_ID_HEADER]:l.id}});const c={...l,workflowSettings:{...l.workflowSettings,[e]:{settings:{},...l.workflowSettings[e],enabled:!1}}},u={...d,configurations:d.configurations.filter((e=>e.id!==l.id)).concat(c)};this.updateCredentialData(u,o)}async enableWorkflow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var n;const{selectedCredentialId:i,selectedConfigurationId:r}=t,{integration:o,integrationState:a}=this.getIntegrationForWorkflow(e),l=this.getCredentialAndConfig(i||r?{selectedCredentialId:i,selectedConfigurationId:r}:{selectedCredentialId:a.credentialId},a);if(!l||(null==l?void 0:l.selectedCredential.status)!==s.CredentialStatus.VALID)throw new Error("Valid credential not found for provided options.");const{selectedConfig:d,selectedCredential:c}=l;if(null===(n=d.workflowSettings[e])||void 0===n?void 0:n.enabled)throw new Error(`Workflow ${e} is already enabled for this user.`);await this.sendConnectRequest(`/sdk/workflows/${e}`,{method:"POST",headers:{[f.SELECTED_CREDENTIAL_ID_HEADER]:c.id,[f.SELECTED_CREDENTIAL_CONFIG_ID_HEADER]:d.id}});const u={...d,workflowSettings:{...d.workflowSettings,[e]:{settings:{},...d.workflowSettings[e],enabled:!0}}},h={...c,configurations:c.configurations.filter((e=>e.id!==d.id)).concat(u)};this.updateCredentialData(h,o)}async getIntegrationAccount(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var n;this.validateAction(e);const i=null===(n=this.userState.integrations[e])||void 0===n?void 0:n.allCredentials;if(!(null==i?void 0:i.length))throw new Error("Connect credential not found");const r=await this.sendConnectRequest(`/sdk/credentials?integration=${e}&includeAccountAuth=${t.includeAccountAuth}`,{method:"GET",headers:t.selectedCredentialId?{[f.SELECTED_CREDENTIAL_ID_HEADER]:t.selectedCredentialId}:{}});if(!r)throw new Error("Integration not connected");return r}getIntegrationForWorkflow(e){if(!this.userState.authenticated)throw new Error("User not authenticated, Call paragon.authenticate(<projectId>, <user token>) before using the SDK.");const t=Object.values(this.loadedIntegrations).find((t=>{const n=t.configs[0].values;return e in(n.workflowMeta||{})}));if(!t)throw new Error("Workflow not found in the configured integrations in your Paragon project.");const n=(0,l.getIntegrationTypeName)(t)?this.userState.integrations[(0,l.getIntegrationTypeName)(t)]:void 0;if(!n||!n.allCredentials.some((e=>{let{status:t}=e;return t===s.CredentialStatus.VALID})))throw new Error(`Integration "${(0,l.getIntegrationTypeName)(t)}" not enabled for workflow."`);return{integration:t,integrationState:n}}async updateLocalState(e){var t,n;const[i,r]=await Promise.all([this.fetchUserData(e),this.fetchIntegrations()]);this.project=i.project;let o={...i.integrations};if(this.modalState.integration&&this.integrationToBeEnabled){const e=this.userState.integrations[this.integrationToBeEnabled],i=null==e?void 0:e.credentialConfigId,r=null==e?void 0:e.credentialId;let s;if(i)s=null===(t=o[this.integrationToBeEnabled])||void 0===t?void 0:t.allConfigurations.find((e=>{let{id:t}=e;return t===i}));else if(r){const e=null===(n=o[this.integrationToBeEnabled])||void 0===n?void 0:n.allCredentials.find((e=>{let{id:t}=e;return t===r}));s=e?e.configurations.find((e=>e.isDefault)):void 0}s&&(o={...o,[this.integrationToBeEnabled]:{enabled:!1,allConfigurations:[],allCredentials:[],...o[this.integrationToBeEnabled],credentialId:s.connectCredentialId,credentialConfigId:s.id,workflowSettings:s.workflowSettings,configuredWorkflows:s.workflowSettings,sharedSettings:s.sharedSettings,configMeta:s.configMeta}})}this.updateAuthenticatedUser({integrations:o,meta:i.meta,resources:i.resources}),this.updateIntegrations(r),this.saveState()}async fetchUserData(e){const t=await this.sendConnectRequest("/sdk/me",{headers:(0,p.getHeadersForUserMeta)(e)});if(!t)throw new Error("Unable to get user Data");return{...t,integrations:Object.fromEntries(Object.entries(t.integrations).map((e=>{let[t,n]=e;const i=n.allCredentials.flatMap((e=>{let{configurations:t}=e;return t}));return[t,{...n,allConfigurations:i}]})))}}async fetchIntegrations(){const e=await this.sendConnectRequest("/sdk/integrations");if(!e)throw new Error("Unable to fetch integrations");return e}updateIntegrations(e){e.forEach((e=>{var t,n,i;if(e.configs.length)try{const r=(0,l.getIntegrationTypeName)(e);this.loadedConfigs[r]=e.configs[0].values,this.loadedIntegrations[r]=e,Boolean(e.isActive)&&(this.metadata[r]={type:r,name:e.name,brandColor:e.brandColor,icon:null!==(n=null===(t=e.customIntegration)||void 0===t?void 0:t.icon)&&void 0!==n?n:`${this.environments.CDN_PUBLIC_URL}/integrations/${f.overrideActionAlias[e.type]||e.type}.svg`}),(null===(i=this.modalState.integration)||void 0===i?void 0:i.id)===e.id&&this.setModalState({integration:e})}catch(e){console.warn(e)}}))}async setUserMetadata(e){return await this.sendConnectRequest("/sdk/me",{method:"PATCH",body:JSON.stringify({meta:e})}),await this.updateLocalState(),this.render(),this.userState}configureGlobal(e,t){var n,i,r,o,s,a,l,d;if(!e||!e.host)throw new Error("host not specified");const c=e.host.indexOf("http")>-1?new URL(e.host).hostname:e.host;this.environments.CONNECT_PUBLIC_URL=null!==(n=null==t?void 0:t.CONNECT_PUBLIC_URL)&&void 0!==n?n:(0,_.getServiceUrl)("connect",c),this.environments.DASHBOARD_PUBLIC_URL=null!==(i=null==t?void 0:t.DASHBOARD_PUBLIC_URL)&&void 0!==i?i:(0,_.getServiceUrl)("dashboard",c),this.environments.HERMES_PUBLIC_URL=null!==(r=null==t?void 0:t.HERMES_PUBLIC_URL)&&void 0!==r?r:(0,_.getServiceUrl)("hermes",c),this.environments.PASSPORT_PRODUCTION_URL=null!==(o=null==t?void 0:t.PASSPORT_PRODUCTION_URL)&&void 0!==o?o:(0,_.getServiceUrl)("passport",c),this.environments.PASSPORT_PUBLIC_URL=null!==(s=null==t?void 0:t.PASSPORT_PUBLIC_URL)&&void 0!==s?s:(0,_.getServiceUrl)("passport",c),this.environments.ZEUS_PUBLIC_URL=null!==(a=null==t?void 0:t.ZEUS_PUBLIC_URL)&&void 0!==a?a:(0,_.getServiceUrl)("zeus",c),this.environments.CDN_PUBLIC_URL=null!==(l=null==t?void 0:t.CDN_PUBLIC_URL)&&void 0!==l?l:(0,_.getServiceUrl)("dashboard",c),this.environments.WORKER_PROXY_PUBLIC_URL=null!==(d=null==t?void 0:t.WORKER_PROXY_PUBLIC_URL)&&void 0!==d?d:(0,_.getServiceUrl)("proxy",c),this.userState.authenticated=!1,this.root?this.root.src=`${this.environments.CONNECT_PUBLIC_URL}/ui${this.projectId?`?projectId=${this.projectId}`:""}`:console.error("Root element not defined")}async completeInstall(e,t){var n;if(!this.userState.authenticated)throw new Error("Authentication is required");if(!t||!t.authorizationCode)throw new Error("authorizationCode is required");if(t.redirectUrl&&!(0,_.isValidUrl)(t.redirectUrl))throw new Error(`${t.redirectUrl} is not valid url`);this.validateAction(e);const i=Object.values(this.loadedIntegrations).find((t=>(0,l.getIntegrationTypeName)(t)===e)),r=null===(n=t.showPortalAfterInstall)||void 0===n||n,o=await this.sendConnectRequest("/sdk/credentials",{method:"POST",body:JSON.stringify({code:t.authorizationCode,integrationId:i.id,redirectUrl:t.redirectUrl?(0,_.sanitizeUrl)(t.redirectUrl):void 0,integrationOptions:t.integrationOptions||{}})});if(!o)throw new Error("Unable to create credential");this.updateCredentialData(o,i),r&&this.setModalState({integration:i,config:this.loadedConfigs[e],apiInstallationOptions:{}})}updateCredentialData(e,t){var n;const i=this.userState,r=(0,l.getIntegrationTypeName)(t),o=i.integrations[r],a=o.allCredentials.findIndex((t=>{let{id:n}=t;return n===e.id}));a>-1?o.allCredentials[a]=e:o.allCredentials.push(e);const d=Object.values(null!==(n=o.allConfigurations)&&void 0!==n?n:[]).filter((t=>{let{connectCredentialId:n}=t;return n!==e.id})).concat(e.configurations);if(!(-1===a||e.id===o.credentialId||!(!o.credentialConfigId||!e.configurations.some((e=>e.id===o.credentialConfigId)))))return this.updateAuthenticatedUser({integrations:{...i.integrations,[r]:{...o,allConfigurations:d}}}),void this.saveState();const c=o.credentialConfigId?e.configurations.find((e=>o.credentialConfigId===e.id)):e.configurations[0];this.updateAuthenticatedUser({integrations:{...i.integrations,[r]:{...o,allConfigurations:d,credentialStatus:e.status,enabled:e.status===s.CredentialStatus.VALID,credentialId:e.id,providerId:e.providerId,providerData:e.providerData,configMeta:null==c?void 0:c.configMeta,credentialConfigId:null==c?void 0:c.id,externalId:null==c?void 0:c.externalId,sharedSettings:null==c?void 0:c.sharedSettings,workflowSettings:null==c?void 0:c.workflowSettings,configuredWorkflows:null==c?void 0:c.workflowSettings}}}),this.saveState()}async connectAction(e,t){var n;if(!this.userState.authenticated)throw new Error("User not authenticated, Call paragon.authenticate(<projectId>, <user token>) before using the SDK.");const i=null===(n=this.userState.resources.find((t=>e===t.slug)))||void 0===n?void 0:n.id;if(!i)throw new Error(`No resource found with name "${e}".`);if(!t||"object"!=typeof t)throw new Error("payload must be of type object.");const r=await this.sendConnectRequest(`/sdk/resources/${i}/connect`,{method:"POST",body:JSON.stringify(t)});if(!r)throw new Error(`Unable to connect to "${e}".`);return r}async createConfiguration(e){let{credentialId:t,externalId:n}=e;var i,r;if(!this.userState.authenticated)throw new Error("User not authenticated, Call paragon.authenticate(<projectId>, <user token>) before using the SDK.");if(!t)throw new Error('Required options not provided: "credentialId"');const o=this.getCredentialAndConfig({selectedCredentialId:t});if(!o||(null==o?void 0:o.selectedCredential.status)!==s.CredentialStatus.VALID)throw new Error("Valid credential not found for provided options.");const a=await this.sendConnectRequest(`/sdk/credentials/${t}/configurations`,{method:"POST",body:JSON.stringify(n?{externalId:n}:{})});if(!a)throw new Error("Unable to create a configuration for credential.");const l=Object.keys(this.userState.integrations).find((e=>{var t;return null===(t=this.userState.integrations[e])||void 0===t?void 0:t.allCredentials.find((e=>{let{id:t}=e;return t===a.id}))}));if(l){const e=null===(i=this.userState.integrations[l])||void 0===i?void 0:i.allConfigurations.filter((e=>{let{connectCredentialId:t}=e;return t!==a.id})).concat(a.configurations),t=null===(r=this.userState.integrations[l])||void 0===r?void 0:r.allCredentials.map((e=>e.id===a.id?a:e)),n={...this.userState.integrations,[l]:{enabled:!1,...this.userState.integrations[l],allConfigurations:e||[],allCredentials:t||[]}};this.updateAuthenticatedUser({integrations:n})}return a.configurations.sort(((e,t)=>new Date(t.dateCreated).getTime()-new Date(e.dateCreated).getTime()))[0]}async destroyConfiguration(e){let{id:t,credentialId:n}=e;var i,r,o,s;if(!this.userState.authenticated)throw new Error("User not authenticated, Call paragon.authenticate(<projectId>, <user token>) before using the SDK.");if(!(null==t?void 0:t.trim())||!(null==n?void 0:n.trim()))throw new Error("One or more required options not provided.");const a=this.getCredentialAndConfig({selectedConfigurationId:t,selectedCredentialId:n});if(!a)throw new Error(`Unable to find credential for configuration: ${t}.`);if(a.selectedConfig.isDefault)throw new Error("Cannot delete default configuration.");await this.sendConnectRequest(`/sdk/credentials/${a.selectedCredential.id}/configurations`,{method:"DELETE",headers:{[f.SELECTED_CREDENTIAL_ID_HEADER]:null==a?void 0:a.selectedCredential.id,[f.SELECTED_CREDENTIAL_CONFIG_ID_HEADER]:null==a?void 0:a.selectedConfig.id}});const l=Object.keys(this.userState.integrations).find((e=>{var t;return null===(t=this.userState.integrations[e])||void 0===t?void 0:t.allCredentials.find((e=>{let{id:t}=e;return t===a.selectedCredential.id}))}));if(l){const{selectedConfig:e,selectedCredential:t}=a,n=null===(i=this.userState.integrations[l])||void 0===i?void 0:i.allConfigurations.filter((t=>{let{id:n}=t;return n!==e.id})),d=null===(r=this.userState.integrations[l])||void 0===r?void 0:r.allCredentials.map((n=>n.id!==t.id?n:{...n,configurations:n.configurations.filter((t=>{let{id:n}=t;return n!==e.id}))})),c={...this.userState.integrations,[l]:{enabled:!1,...this.userState.integrations[l],allConfigurations:n||[],allCredentials:d||[]}};this.updateAuthenticatedUser({integrations:c}),(null===(o=this.userState.integrations[l])||void 0===o?void 0:o.credentialId)===t.id&&(null===(s=this.userState.integrations[l])||void 0===s?void 0:s.credentialConfigId)===e.id&&this.closePortal()}}async updateConfiguration(e){let{id:t,credentialId:n,meta:i={}}=e;var r,o;if(!this.userState.authenticated)throw new Error("User not authenticated, Call paragon.authenticate(<projectId>, <user token>) before using the SDK.");if(!(null==t?void 0:t.trim())||!(null==n?void 0:n.trim()))throw new Error("One or more required options not provided.");const s=this.getCredentialAndConfig({selectedConfigurationId:t,selectedCredentialId:n});if(!(null==s?void 0:s.selectedConfig))throw new Error(`Cannot find credential configuration with given id: "${t}"`);const a=await this.sendConnectRequest(`/sdk/credentials/${s.selectedConfig.connectCredentialId}/configurations`,{method:"PATCH",body:JSON.stringify({meta:i}),headers:{[f.SELECTED_CREDENTIAL_ID_HEADER]:s.selectedCredential.id,[f.SELECTED_CREDENTIAL_CONFIG_ID_HEADER]:s.selectedConfig.id}});if(!a)throw new Error("Unable to update configuration.");const l=Object.keys(this.userState.integrations).find((e=>{var t;return null===(t=this.userState.integrations[e])||void 0===t?void 0:t.allCredentials.find((e=>{let{id:t}=e;return t===a.id}))}));if(l){const e=null===(r=this.userState.integrations[l])||void 0===r?void 0:r.allConfigurations.filter((e=>{let{connectCredentialId:t}=e;return t!==a.id})).concat(a.configurations),t=null===(o=this.userState.integrations[l])||void 0===o?void 0:o.allCredentials.map((e=>e.id===a.id?a:e)),n={...this.userState.integrations,[l]:{enabled:!1,...this.userState.integrations[l],allConfigurations:e||[],allCredentials:t||[]}};this.updateAuthenticatedUser({integrations:n})}const d=a.configurations.find((e=>{let{id:t}=e;return t===s.selectedConfig.id}));return d}async pollForCredential(e,t){var n;const i=Date.now(),r=async()=>{try{return await this.sendConnectRequest(`/sdk/actions/session-id/${t}`,{method:"GET"})}catch(e){return console.error("error",e),null}};try{const t=await(0,E.tryUntil)(r,(function(e,t){return!((arguments.length>2&&void 0!==arguments[2]?arguments[2]:1)>=20||Date.now()-i>=u.MAX_POLL_DURATION||(null==e?void 0:e.connectCredentialId))}),u.CREDENTIAL_POLL_INTERVAL);if(!t||!t.connectCredentialId)return;if(null===(n=this.userState.integrations[e])||void 0===n?void 0:n.allCredentials.find((e=>e.id===t.connectCredentialId)))return;const o=await this.sendConnectRequest(`/sdk/credentials/${t.connectCredentialId}`,{method:"GET"});o&&this.updateCredentialData(o,this.loadedIntegrations[e])}catch(e){console.error("Error while connecting to integration",e)}finally{await this.sendConnectRequest(`/sdk/actions/session-id/${t}`,{method:"DELETE"})}}}t.default=O},892:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(821);t.default=class{constructor(){this.eventListenersMap={},this.integrationStateCallbacks={}}subscribe(e,t){var n;if(this.assertEventType(e),"function"!=typeof t)throw new Error(`no listener is provided for ${e}`);return this.eventListenersMap={...this.eventListenersMap,[e]:[...null!==(n=this.eventListenersMap[e])&&void 0!==n?n:[],t]},()=>this.unsubscribe(e,t)}subscribeToIntegration(e,t){this.integrationStateCallbacks[e]={...t}}unsubscribe(e,t){var n,i;if(this.assertEventType(e),"function"!=typeof t)throw new Error("listener is required for unsubscription");const r=(null!==(n=this.eventListenersMap[e])&&void 0!==n?n:[]).length;return this.eventListenersMap={...this.eventListenersMap,[e]:(null!==(i=this.eventListenersMap[e])&&void 0!==i?i:[]).filter((e=>e!==t))},r>this.eventListenersMap[e].length}assertEventType(e){if(!Object.values(i.SDK_EVENT).includes(e))throw new Error(`${e} is not valid paragon event`)}emitSafe(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];var r;(null!==(r=this.eventListenersMap[e])&&void 0!==r?r:[]).forEach((e=>{try{e(...n)}catch(e){console.error(e)}}))}emitError(e,t){this.invokeCallbackSafe(t,"onError",e)}invokeCallbackSafe(e,t){var n,i;try{for(var r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];null===(i=null===(n=this.integrationStateCallbacks[e])||void 0===n?void 0:n[t])||void 0===i||i.call(n,...o)}catch(e){console.error(e)}}triggerEvent(e,t){let{type:n,integrationId:r,integrationType:o,workflowId:s,workflowStateChange:a}=e;if(r&&o)switch(n){case i.SDK_EVENT.ON_INTEGRATION_INSTALL:{const e=[{integrationId:r,integrationType:o},t];this.invokeCallbackSafe(o,"onInstall",...e),this.emitSafe(i.SDK_EVENT.ON_INTEGRATION_INSTALL,...e);break}case i.SDK_EVENT.ON_INTEGRATION_UNINSTALL:{const e=[{integrationId:r,integrationType:o},t];this.invokeCallbackSafe(o,"onUninstall",...e),this.emitSafe(i.SDK_EVENT.ON_INTEGRATION_UNINSTALL,...e);break}case i.SDK_EVENT.ON_PORTAL_OPEN:{const e=[{integrationId:r,integrationType:o},t];this.invokeCallbackSafe(o,"onOpen",...e),this.emitSafe(i.SDK_EVENT.ON_PORTAL_OPEN,...e);break}case i.SDK_EVENT.ON_PORTAL_CLOSE:{const e=[{integrationId:r,integrationType:o},t];this.invokeCallbackSafe(o,"onClose",...e),this.emitSafe(i.SDK_EVENT.ON_PORTAL_CLOSE,...e);break}case i.SDK_EVENT.ON_WORKFLOW_CHANGE:{const e=[{integrationId:r,workflowId:s,workflowStateChange:a||{}},t];this.invokeCallbackSafe(o,"onWorkflowChange",...e),this.emitSafe(i.SDK_EVENT.ON_WORKFLOW_CHANGE,...e);break}default:throw new Error(`${n} is not valid event.`)}}}},931:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PERSONA_META_HEADER=t.BYO_USER_PROFILE_ERROR_CODE=t.BYO_CREDENTIAL_VERIFICATION_ERROR=t.INSUFFICIENT_PERMISSION=t.ACTION_CUSTOM=void 0,t.ACTION_CUSTOM="custom",t.INSUFFICIENT_PERMISSION="7210",t.BYO_CREDENTIAL_VERIFICATION_ERROR="7003",t.BYO_USER_PROFILE_ERROR_CODE="0704",t.PERSONA_META_HEADER="X-Paragon-User-Metadata"},59:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CredentialStatus=void 0,function(e){e.PENDING="PENDING",e.INVALID="INVALID",e.VALID="VALID"}(t.CredentialStatus||(t.CredentialStatus={}))},745:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AuthenticationScheme=void 0,function(e){e.BASIC="basic",e.OAUTH="oauth",e.OAUTH_CLIENT_CREDENTIAL="oauth_client_credential",e.SERVICE_ACCOUNT="service_account",e.OAUTH_APP="oauth_app",e.IMPERSONATED_APP="impersonated_app"}(t.AuthenticationScheme||(t.AuthenticationScheme={}))},663:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateSlugForIntegration=void 0,t.generateSlugForIntegration=function(e){if(!e.name)return;return`custom.${e.name?e.name.replace(/[\W_]+/g,"").trim().toLowerCase():void 0}`}},343:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isCustomIntegrationTypeName=t.getIntegrationTypeName=void 0;const i=n(931),r=n(663);t.getIntegrationTypeName=function(e){if(e.type===i.ACTION_CUSTOM){if(e.customIntegration)return(0,r.generateSlugForIntegration)(e.customIntegration);throw new Error(`Custom integration details are missing from this integration: ${e.id}`)}return e.type},t.isCustomIntegrationTypeName=function(e){return e.startsWith("custom.")}},845:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MicrosoftPicker=void 0;const i=n(821),r=n(473);class o extends r.BaseFilePicker{constructor(e,t){super(e,t),this.options=e,this.connectSDKInstance=t,this.accessToken="",this.baseUrl=""}getInstance(){return null}open(){var e,t;return this.dependencyStatus===i.FilePickerStatus.LOADED&&(null===(t=(e=this.options).onOpen)||void 0===t||t.call(e),this.launchPicker(this.getPickerOptions()),!0)}async initPicker(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"https://alcdn.msauth.net/browser/2.19.0/js/msal-browser.min.js";var r;this.dependencyStatus=i.FilePickerStatus.LOADING,this.initOptions=e;const o=await this.connectSDKInstance.getIntegrationAccount(t,{includeAccountAuth:!0});return this.accessToken=o.accountAuth[(null===(r=i.AUTH_TOKEN_ALLOWED_INTEGRATIONS[t])||void 0===r?void 0:r.accessTokenPath)||""],this.baseUrl=this.getUrl(o,t),this.initialiseDependencyPromise(),this.injectScript(n),this.dependenciesPromise}onScriptLoaded(){this.dependencyStatus=i.FilePickerStatus.LOADED,this.dependenciesPromise.resolve(!0)}onScriptError(){this.dependencyStatus=i.FilePickerStatus.FAILED,this.dependenciesPromise.reject(new Error("Failed to load dependencies"))}combinePaths(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.map((e=>e.replace(/^[/\\]+|[/\\]+$/g,""))).join("/").replace(/\\/g,"/")}async launchPicker(e){if(!this.accessToken)throw new Error("Access Token is not set! Please re-authenticate your account.");const t={sdk:"8.0",entry:e.entry,search:{enabled:!0},messaging:{origin:window.location.origin,channelId:`X-PARAGON-CHANNEL-${Date.now()}`},selection:{mode:this.options.allowMultiSelect?"multiple":"single"},typesAndSources:{mode:"boolean"==typeof this.options.allowFolderSelect?this.options.allowFolderSelect?"folders":"files":"all",filters:this.options.allowedTypes,pivots:e.pivots}},n=new URLSearchParams({filePicker:JSON.stringify(t)}).toString(),i=`${this.getPickerUrl(this.baseUrl)}?${n}`,r=window.open("","Picker","width=800,height=600,left=100,top=150");if(!r)throw new Error("Failed to open picker window.");const o=r.document.createElement("form");o.setAttribute("action",i),o.setAttribute("method","POST");const s=r.document.createElement("input");s.setAttribute("type","hidden"),s.setAttribute("name","access_token"),s.setAttribute("value",this.accessToken),o.appendChild(s),r.document.body.appendChild(o),o.submit(),this.setupMessageListener(r,t.messaging.channelId)}initializePort(e,t){e.addEventListener("message",(async n=>{const{type:i,data:r,id:o}=n.data;if("command"===i){const{command:n}=r;this.handlePickerCommand({command:n,id:o,items:r.items},t,e)}})),e.start(),e.postMessage({type:"activate"})}setupMessageListener(e,t){window.addEventListener("message",(n=>{var i;if(n.source===e&&(null===(i=n.data)||void 0===i?void 0:i.channelId)===t){const{type:t,data:i}=n.data;switch(t){case"initialize":const r=n.ports[0];this.initializePort(r,e);break;case"command":this.handlePickerCommand(i,e);break;default:console.warn("Unknown message type:",t)}}}))}handlePickerCommand(e,t,n){var i,r,o,s,a,l;const{command:d,id:c,items:u}=e;switch(d){case"close":null===(r=(i=this.options).onClose)||void 0===r||r.call(i),t.close();break;case"pick":null==n||n.postMessage({type:"result",id:c,data:{result:"success"}}),null===(s=(o=this.options).onFileSelect)||void 0===s||s.call(o,u),null===(l=(a=this.options).onClose)||void 0===l||l.call(a),t.close();break;default:null==n||n.postMessage({type:"error",id:c,data:{message:"Unsupported command",command:d}})}}}t.MicrosoftPicker=o},950:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GoogleDriveFilePicker=void 0;const i=n(821),r=n(473);class o extends r.BaseFilePicker{constructor(e,t){super(e,t),this.accessToken=""}get google(){return window.google}getInstance(){var e;return null!==(e=this.instance)&&void 0!==e?e:null}open(){var e,t;return!(this.dependencyStatus!==i.FilePickerStatus.LOADED||!this.instance)&&(this.instance.setVisible(!0),null===(t=(e=this.options).onOpen)||void 0===t||t.call(e),!0)}async init(e){this.dependencyStatus=i.FilePickerStatus.LOADING,await this.validateInitOptions(e,[["developerKey","developer key"]]),this.initOptions={...e};const t=await this.connectSDKInstance.getIntegrationAccount("googledrive",{includeAccountAuth:!0}),{accessTokenPath:n=""}=i.AUTH_TOKEN_ALLOWED_INTEGRATIONS.googledrive;return this.accessToken=t.accountAuth[n],this.initialiseDependencyPromise(),this.injectScript("https://apis.google.com/js/api.js"),this.dependenciesPromise}onScriptLoaded(){this.dependencyStatus=i.FilePickerStatus.LOADED,window.gapi.load("picker",this.onPickerLoaded.bind(this))}onScriptError(){this.dependencyStatus=i.FilePickerStatus.FAILED,this.dependenciesPromise.reject(new Error("Not able to load dependencies"))}onPickerLoaded(){var e,t,n,i,r;const o=new this.google.picker.PickerBuilder,s=new this.google.picker.DocsView;if((null===(e=this.initOptions)||void 0===e?void 0:e.appId)&&o.setAppId(this.initOptions.appId),this.options.allowMultiSelect&&o.enableFeature(this.google.picker.Feature.MULTISELECT_ENABLED),this.options.allowFolderSelect&&(s.setIncludeFolders(!0),s.setSelectFolderEnabled(!0)),this.options.allowedTypes&&this.options.allowedTypes.length>0&&s.setMimeTypes(this.options.allowedTypes.join(",")),(null===(n=null===(t=this.options.integrationOptions)||void 0===t?void 0:t.googledrive)||void 0===n?void 0:n.viewMode)&&s.setMode(this.options.integrationOptions.googledrive.viewMode),(null===(r=null===(i=this.options.integrationOptions)||void 0===i?void 0:i.googledrive)||void 0===r?void 0:r.includeFolders)&&s.setIncludeFolders(!0),!this.initOptions.developerKey)throw new Error("Please provide a valid developer key");const a=o.addView(s).setOAuthToken(this.accessToken).setDeveloperKey(this.initOptions.developerKey).setCallback(this.pickerCallback.bind(this));this.initOptions.appId&&a.setAppId(this.initOptions.appId),this.instance=a.build(),this.dependenciesPromise.resolve(!0)}pickerCallback(e){var t,n,i,r,o,s;const{action:a,...l}=e;switch(a){case this.google.picker.Action.PICKED:null===(n=(t=this.options).onFileSelect)||void 0===n||n.call(t,l),null===(r=(i=this.options).onClose)||void 0===r||r.call(i);break;case this.google.picker.Action.CANCEL:null===(s=(o=this.options).onCancel)||void 0===s||s.call(o)}}}t.GoogleDriveFilePicker=o},698:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(950),r=n(128),o=n(737);t.default={GoogleDriveFilePicker:i.GoogleDriveFilePicker,OneDriveFilePicker:r.OneDriveFilePicker,SharepointFilePicker:o.SharepointFilePicker}},128:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OneDriveFilePicker=void 0;const i=n(821),r=n(845);class o extends r.MicrosoftPicker{constructor(){super(...arguments),this.integrationName="onedrive",this.personalAccountUrl="https://onedrive.live.com"}async init(e){return super.initPicker(e,this.integrationName)}getPickerUrl(e){return e?e.includes(this.personalAccountUrl)?`${e}/picker`:this.combinePaths(e,"_layouts/15/FilePicker.aspx"):`${this.personalAccountUrl}/picker`}getIntegrationName(){return this.integrationName}getUrl(e,t){return e.accountAuth[i.AUTH_TOKEN_ALLOWED_INTEGRATIONS[t].domain||""]}getPickerOptions(){return{entry:{oneDrive:{files:{fallbackToRoot:!0}}},pivots:{oneDrive:!0,recent:!0,shared:!0}}}}t.OneDriveFilePicker=o},737:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SharepointFilePicker=void 0;const i=n(321),r=n(845);class o extends r.MicrosoftPicker{constructor(){super(...arguments),this.integrationName="sharepoint"}async init(e){return super.initPicker(e,this.integrationName)}getIntegrationName(){return this.integrationName}getPickerUrl(e){return this.combinePaths(e,"_layouts/15/FilePicker.aspx")}getUrl(e){var t;return(0,i.sanitizeUrl)(null===(t=e.providerData)||void 0===t?void 0:t.webUrl)}getPickerOptions(){return{entry:{sharePoint:{byPath:{list:`${this.baseUrl}/Shared Documents`,fallbackToRoot:!0}}},pivots:{shared:!0,oneDrive:!1,sharedLibraries:!0,site:!0}}}}t.SharepointFilePicker=o},473:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseFilePicker=void 0;const i=n(643),r=n(572);t.BaseFilePicker=class{constructor(e,t){this.options=e,this.connectSDKInstance=t}initialiseDependencyPromise(){this.dependenciesPromise=new r.DeferredPromise}getInstance(){return this.instance}injectScript(e){if(this.checkIfScriptLoaded(e))this.onScriptLoaded();else{const t=document.createElement("script");t.src=e,t.async=!0,t.id=e,t.onload=this.onScriptLoaded.bind(this),t.onerror=this.onScriptError.bind(this),document.body.appendChild(t)}}checkIfScriptLoaded(e){const t=document.getElementsByTagName("script");for(let n=0;n<t.length;n++)if(t[n].getAttribute("src")==e)return!0;return!1}async validateInitOptions(e,t){for(const[n,r]of t)if(!e||(0,i.isStringEmpty)(e[n]))throw new Error(`Please provide a valid ${r}`);return!0}}},731:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.buildExternalFilePickerInstance=void 0;const i=n(655).__importDefault(n(698));class r{constructor(e,t,n){const i=this.createFilePicker(e,t,n);this.open=this.open.bind(i),this.init=this.init.bind(i),this.getInstance=this.getInstance.bind(i)}createFilePicker(e,t,n){const r={googledrive:i.default.GoogleDriveFilePicker,onedrive:i.default.OneDriveFilePicker,sharepoint:i.default.SharepointFilePicker}[e];if(!r)throw new Error(`${e}'s file picker is not supported`);return new r(t,n)}open(){return this.open()}init(e){return this.init(e)}getInstance(){return this.getInstance()}}t.default=r;t.buildExternalFilePickerInstance=e=>function(t,n){if(!e.getUser().authenticated)throw new Error("Authentication is required");if(!t)throw new Error("Missing argument: Integration type is required");return e.validateAction(t),new r(t,n,e)}},50:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.buildExternalFilePickerInstance=t.ExternalFilePicker=void 0;var r=n(731);Object.defineProperty(t,"ExternalFilePicker",{enumerable:!0,get:function(){return i(r).default}}),Object.defineProperty(t,"buildExternalFilePickerInstance",{enumerable:!0,get:function(){return r.buildExternalFilePickerInstance}})},643:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findSelectedAccountType=t.isStringEmpty=t.getActionStateForCredentialDelete=t.stripUndefinedAndNull=t.parseKeyedSource=void 0;const i=n(59);t.parseKeyedSource=function(e){return e&&(null==e?void 0:e.length)?Object.fromEntries(e.map((e=>[e.key,"VALUE"===e.source.type?e.source.value:void 0]))):{}},t.stripUndefinedAndNull=function e(t){const n={};return Object.keys(t).forEach((i=>{var r;(r=t[i])&&"object"==typeof r&&!Array.isArray(r)?n[i]=e(t[i]):void 0!==t[i]&&null!==t[i]&&(n[i]=t[i])})),n};t.getActionStateForCredentialDelete=(e,t)=>{var n,r;const o=(null!==(n=null==t?void 0:t.allCredentials)&&void 0!==n?n:[]).filter((t=>t.id!==e)),s=(null!==(r=null==t?void 0:t.allConfigurations)&&void 0!==r?r:[]).filter((t=>t.connectCredentialId!==e));if(0===o.length)return{enabled:!1,workflowSettings:{},allCredentials:[],allConfigurations:[]};{const e=o[0];return{...t,credentialStatus:e.status,enabled:e.status===i.CredentialStatus.VALID,credentialId:e.id,providerId:e.providerId,providerData:e.providerData,allCredentials:o,allConfigurations:s}}};t.isStringEmpty=e=>!e||"string"==typeof e&&!e.trim();t.findSelectedAccountType=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(t)return e.find((e=>{let{id:n}=e;return n===t}));if(1===n.length)return e.find((e=>{let{id:t}=e;return n.includes(t)}));if(!t&&!n.length&&Array.isArray(e)&&2===e.length){const[t,n]=e;return"default"===t.id&&"user-configured-oauth"===n.id?t:void 0}}},429:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.startOAuthFlow=t.MAX_POLL_DURATION=t.CREDENTIAL_POLL_INTERVAL=void 0;const i=n(931),r=n(343),o=n(643);t.CREDENTIAL_POLL_INTERVAL=3e3,t.MAX_POLL_DURATION=6e4;t.startOAuthFlow=(e,t)=>{let{context:n,integration:s,endUserSuppliedValues:a={},authParams:l,isPreviewMode:d=!1,installOptions:c={}}=e;var u;const h=(0,r.getIntegrationTypeName)(s);if(!h)return;const f=l?(0,o.parseKeyedSource)(l):{},p=(0,o.stripUndefinedAndNull)({action:h&&(0,r.isCustomIntegrationTypeName)(h)?i.ACTION_CUSTOM:h,endUserSuppliedValues:JSON.stringify(a),parameters:JSON.stringify(f),userToken:n.user.token,integrationId:s.id,redirectUrl:null===(u=n.endUserIntegrationConfig)||void 0===u?void 0:u.overrideRedirectUrl,originForPostMessage:window.location.origin,isPreviewMode:d,installOptions:JSON.stringify(c),sessionId:t}),g=`${n.environments.ZEUS_PUBLIC_URL}/projects/${n.projectId}/sdk/actions/build-oauth?${new URLSearchParams(p).toString()}`;return window.open(g,void 0,"width=500,height=600,left=100,top=150")}},992:(e,t)=>{"use strict";var n,i,r;Object.defineProperty(t,"__esModule",{value:!0}),t.AUTH_TOKEN_ALLOWED_INTEGRATIONS=t.overrideActionAlias=t.TokenType=t.SidebarInputType=void 0,function(e){e.Auth="AUTH",e.Enum="ENUM",e.DynamicEnum="DYNAMIC_ENUM",e.Intent="INTENT",e.Text="TEXT",e.TextArea="TEXTAREA",e.ValueText="TEXT_NO_VARS",e.ValueTextArea="TEXTAREA_NO_VARS",e.Code="CODE",e.ActionButton="ACTION_BUTTON",e.Conditional="CONDITIONAL",e.DynamicConditional="DYNAMIC_CONDITIONAL",e.NestedList="NESTED_LIST",e.File="FILE",e.EditableDynamicEnum="EDITABLE_DYNAMIC_ENUM",e.EditableEnum="EDITABLE_ENUM",e.BooleanInput="BOOLEAN_INPUT",e.UserSuppliedCredential="USER_SUPPLIED_CREDENTIAL",e.NativeDynamicEnumInput="NATIVE_DYNAMIC_INPUT",e.TimeConstraintInput="TIME_CONSTRAINT_INPUT",e.LinesListInput="LinesListInput",e.LinesListDynamicInput="LinesListDynamicInput",e.Number="NUMBER",e.Email="EMAIL",e.URL="URL",e.EnumTextAreaPairInput="EnumTextAreaPairInput",e.FieldMapper="FIELD_MAPPER",e.ComboInput="COMBO_INPUT",e.Password="PASSWORD",e.Switch="SWITCH"}(t.SidebarInputType||(t.SidebarInputType={})),function(e){e.ACCESS_TOKEN="ACCESS_TOKEN",e.REFRESH_TOKEN="REFRESH_TOKEN",e.BOT_TOKEN="BOT_TOKEN",e.KLAVIYO_API_KEY="KLAVIYO_API_KEY",e.MARKETO_CLIENT_ID="MARKETO_CLIENT_ID",e.MARKETO_CLIENT_SECRET="MARKETO_CLIENT_SECRETI",e.MARKETO_ENDPOINT="MARKETO_ENDPOINT",e.MARKETO_IDENTITY="MARKETO_IDENTITY",e.MONDAY_API_TOKEN="MONDAY_API_TOKEN",e.ORACLE_CLOUD_URL="ORACLE_CLOUD_URL",e.ORACLE_PASSWORD="ORACLE_PASSWORD",e.ORACLE_USERNAME="ORACLE_USERNAME",e.SAGE_INTACCT_COMPANY_ID="SAGE_INTACCT_COMPANY_ID",e.SAGE_INTACCT_USER_ID="SAGE_INTACCT_USER_ID",e.SAGE_INTACCT_USER_PASSWORD="SAGE_INTACCT_USER_PASSWORD",e.SAILTHRU_COMPANY_KEY="SAILTHRU_COMPANY_KEY",e.SAILTHRU_COMPANY_SECRET="SAILTHRU_COMPANY_SECRET",e.SERVICENOW_PASSWORD="SERVICENOW_PASSWORD",e.SERVICENOW_SUBDOMAIN="SERVICENOW_SUBDOMAIN",e.SERVICENOW_USERNAME="SERVICENOW_USERNAME",e.TABLEAU_PERSONAL_ACCESS_TOKEN_NAME="TABLEAU_PERSONAL_ACCESS_TOKEN_NAME",e.TABLEAU_PERSONAL_ACCESS_TOKEN_SECRET="TABLEAU_PERSONAL_ACCESS_TOKEN_SECRET",e.TABLEAU_SERVER_NAME="TABLEAU_SERVER_NAME",e.TABLEAU_SITE_ID="TABLEAU_SITE_ID",e.TRELLO_API_KEY="TRELLO_API_KEY",e.TRELLO_API_TOKEN="TRELLO_API_TOKEN",e.WOOCOMMERCE_CONSUMER_KEY="WOOCOMMERCE_CONSUMER_KEY",e.WOOCOMMERCE_CONSUMER_SECRET="WOOCOMMERCE_CONSUMER_SECRET",e.WOOCOMMERCE_STORE_DOMAIN="WOOCOMMERCE_STORE_DOMAIN",e.WORKABLE_API_ACCESS_TOKEN="WORKABLE_API_ACCESS_TOKEN",e.WORKABLE_ACCOUNT_SUBDOMAIN="WORKABLE_ACCOUNT_SUBDOMAIN",e.ZOHO_CRM_ACCOUNTS_SERVER="ZOHO_CRM_ACCOUNTS_SERVER",e.ZOHO_CRM_API_DOMAIN="ZOHO_CRM_API_DOMAIN"}(t.TokenType||(t.TokenType={})),function(e){e.INFO="INFO",e.ERROR="ERROR",e.SUCCESS="SUCCESS"}(n||(n={})),function(e){e.NONE="NONE",e.RE_AUTHENTICATE="RE_AUTHENTICATE",e.ALERT="ALERT",e.DISPATCH="DISPATCH"}(i||(i={})),function(e){e.DYNAMIC="DYNAMIC_DATA_SOURCE",e.STATIC_ENUM="STATIC_ENUM_DATA_SOURCE",e.FIELD_MAPPER="FIELD_MAPPER_DATA_SOURCE",e.COMBO_INPUT="COMBO_INPUT_DATA_SOURCE"}(r||(r={})),t.overrideActionAlias={"monday.com":"monday","wordpress.com":"wordpress"},t.AUTH_TOKEN_ALLOWED_INTEGRATIONS={googledrive:{accessTokenPath:"OAUTH_ACCESS_TOKEN"},onedrive:{accessTokenPath:"OAUTH_ACCESS_TOKEN",domain:"DOMAIN"},sharepoint:{accessTokenPath:"OAUTH_ACCESS_TOKEN"}}},34:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CONNECT_PLAN_FEATURE_MAP=void 0;const i=n(471);t.CONNECT_PLAN_FEATURE_MAP={[i.BillingPlan.ConnectBasic]:[],[i.BillingPlan.ConnectPro]:[i.ConnectAddOn.CustomIntegrationBuilder,i.ConnectAddOn.HeadlessConnectPortal,i.ConnectAddOn.Monitoring,i.ConnectAddOn.UserMetadata,i.ConnectAddOn.WhiteLabeling],[i.BillingPlan.ConnectEnterprise]:[i.ConnectAddOn.CustomIntegrationBuilder,i.ConnectAddOn.DynamicFieldMapper,i.ConnectAddOn.HeadlessConnectPortal,i.ConnectAddOn.TaskHistoryAPI,i.ConnectAddOn.Monitoring,i.ConnectAddOn.RoleBasedAccessControl,i.ConnectAddOn.UserMetadata,i.ConnectAddOn.WhiteLabeling,i.ConnectAddOn.WorkflowPermission]}},935:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SELECTED_CREDENTIAL_CONFIG_ID_HEADER=t.SELECTED_CREDENTIAL_ID_HEADER=t.INFER_CONTENT_TYPE_FROM_CONNECT_OPTIONS=void 0;const i=n(992);i.SidebarInputType.ValueText,i.SidebarInputType.DynamicEnum,i.SidebarInputType.Enum,i.SidebarInputType.Number,i.SidebarInputType.Email,i.SidebarInputType.URL,i.SidebarInputType.FieldMapper,i.SidebarInputType.BooleanInput,i.SidebarInputType.ComboInput,i.SidebarInputType.Password,i.SidebarInputType.Switch,i.SidebarInputType.ValueTextArea;t.INFER_CONTENT_TYPE_FROM_CONNECT_OPTIONS="auto",t.SELECTED_CREDENTIAL_ID_HEADER="X-Paragon-Credential",t.SELECTED_CREDENTIAL_CONFIG_ID_HEADER="X-Paragon-Configuration-Id"},977:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},914:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PLATFORM_ENV=t.NODE_ENV=void 0,function(e){e.PRODUCTION="production",e.DEVELOPMENT="development",e.TEST="test"}(t.NODE_ENV||(t.NODE_ENV={})),function(e){e.PRODUCTION="production",e.PRODUCTION_MIRROR_1="p-m1",e.STAGING="staging",e.STAGING_MIRROR_1="s-m1",e.DEVELOPMENT="dev",e.TEST="test",e.SANDBOX="sandbox",e.RELEASE="release",e.ENTERPRISE="enterprise"}(t.PLATFORM_ENV||(t.PLATFORM_ENV={}))},65:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},821:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(655);i.__exportStar(n(992),t),i.__exportStar(n(34),t),i.__exportStar(n(935),t),i.__exportStar(n(977),t),i.__exportStar(n(914),t),i.__exportStar(n(65),t),i.__exportStar(n(835),t),i.__exportStar(n(750),t),i.__exportStar(n(471),t)},835:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.DataType=void 0,function(e){e.STRING="STRING",e.NUMBER="NUMBER",e.DATE="DATE",e.BOOLEAN="BOOLEAN",e.EMAIL="EMAIL",e.OBJECT="OBJECT",e.ARRAY="ARRAY",e.ANY="ANY",e.FILE="FILE",e.NON_DECIMAL="NON_DECIMAL"}(t.DataType||(t.DataType={})),function(e){e.None="$none",e.StringContains="$stringContains",e.StringDoesNotContain="$stringDoesNotContain",e.StringExactlyMatches="$stringExactlyMatches",e.StringDoesNotExactlyMatch="$stringDoesNotExactlyMatch",e.StringIsIn="$stringIsIn",e.StringIsNotIn="$stringIsNotIn",e.StringStartsWith="$stringStartsWith",e.StringDoesNotStartWith="$stringDoesNotStartWith",e.StringEndsWith="$stringEndsWith",e.StringDoesNotEndWith="$stringDoesNotEndWith",e.NumberGreaterThan="$numberGreaterThan",e.NumberLessThan="$numberLessThan",e.NumberEquals="$numberEquals",e.NumberDoesNotEqual="$numberDoesNotEqual",e.NumberLessThanOrEqualTo="$numberLessThanOrEqualTo",e.NumberGreaterThanOrEqualTo="$numberGreaterThanOrEqualTo",e.DateTimeAfter="$dateTimeAfter",e.DateTimeBefore="$dateTimeBefore",e.DateTimeEquals="$dateTimeEquals",e.BooleanTrue="$booleanTrue",e.BooleanFalse="$booleanFalse",e.IsNotNull="$exists",e.IsNull="$doesNotExist",e.Exists="$isNotUndefinedOrNull",e.DoesNotExist="$isUndefinedOrNull",e.ArrayIsIn="$arrayIsIn",e.ArrayIsNotIn="$arrayIsNotIn",e.ArrayIsEmpty="$arrayIsEmpty",e.ArrayIsNotEmpty="$arrayIsNotEmpty",e.StringGreaterThan="$stringGreaterThan",e.StringLessThan="$stringLessThan"}(n||(n={}))},750:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FilePickerStatus=t.DocumentLoadingState=t.SDK_EVENT=t.ModalView=void 0,function(e){e.OVERVIEW="overview",e.CONFIGURATION="configuration"}(t.ModalView||(t.ModalView={})),function(e){e.ON_INTEGRATION_INSTALL="onIntegrationInstall",e.ON_INTEGRATION_UNINSTALL="onIntegrationUninstall",e.ON_WORKFLOW_CHANGE="onWorkflowChange",e.ON_PORTAL_OPEN="onPortalOpen",e.ON_PORTAL_CLOSE="onPortalClose"}(t.SDK_EVENT||(t.SDK_EVENT={})),function(e){e.LOADING="loading",e.INTERACTIVE="interactive",e.COMPLETE="complete"}(t.DocumentLoadingState||(t.DocumentLoadingState={})),function(e){e.LOADING="loading",e.FAILED="failed",e.LOADED="loaded"}(t.FilePickerStatus||(t.FilePickerStatus={}))},471:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectAddOn=t.BillingPlan=void 0,function(e){e.ClassicFree="free",e.ClassicStarter="starter",e.ClassicBusiness="business",e.ClassicPremium="premium",e.ClassicEnterprise="enterprise",e.ConnectTrial="connect_trial",e.ConnectBasic="basic",e.ConnectPro="pro",e.ConnectEnterprise="connect_enterprise"}(t.BillingPlan||(t.BillingPlan={})),function(e){e.CustomIntegrationBuilder="byo",e.DynamicFieldMapper="dfm",e.HeadlessConnectPortal="headless-cp",e.TaskHistoryAPI="th-api",e.Monitoring="monitoring",e.RoleBasedAccessControl="rbac",e.UserMetadata="user-metadata",e.WhiteLabeling="whitelabel",e.WorkflowPermission="workflow-permissions"}(t.ConnectAddOn||(t.ConnectAddOn={}))},158:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getHeadersForUserMeta=t.sanitizeExternalConfigId=t.getAssetUrl=void 0;const i=n(931),r=n(821);t.getAssetUrl=e=>{let{CDN_PUBLIC_URL:t,DASHBOARD_PUBLIC_URL:n,VERSION:i,PLATFORM_ENV:o,NODE_ENV:s}=e;return t&&s===r.NODE_ENV.PRODUCTION&&o!==r.PLATFORM_ENV.ENTERPRISE?`${t}/${i}/dashboard/public`:n},t.sanitizeExternalConfigId=function(e){if(e.startsWith("ext:")){return(e.split("ext:").pop()||"").trim()}return e.trim()};t.getHeadersForUserMeta=e=>({...e?{[i.PERSONA_META_HEADER]:JSON.stringify(e)}:{}})},846:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hash=void 0;const i=n(715);t.hash=function(e){return null==e?e:(0,i.sha256)().update(e).digest("hex").substr(0,10)}},572:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tryUntil=t.isUUID=t.uuidPattern=t.sleep=t.generateMatrix=t.DeferredPromise=void 0;function n(e){return new Promise((t=>setTimeout(t,e)))}t.DeferredPromise=class{get state(){return this._state}constructor(){this._state="pending",this._promise=new Promise(((e,t)=>{this._resolve=e,this._reject=t}))}then(e,t){return this._promise.then(e,t)}catch(e){return this._promise.catch(e)}resolve(e){this._resolve(e),this._state="fulfilled"}reject(e){this._reject(e),this._state="rejected"}finally(e){return null==e||e(),this._promise}},Symbol.toStringTag,t.generateMatrix=function(e,t){const n=Object.keys(e);if(n.reduce(((t,n)=>t+e[n].length),0)&&n.length)for(const t of n)e[t].length||e[t].push(void 0);const i=Object.entries(e).reduce(((e,t)=>{let[,n]=t;return e.length?e.reduce(((e,t)=>(n.forEach((n=>{const i=t.slice();i.push(n),e.push(i)}),[]),e)),[]):n.map((e=>[e]))}),[]).reduce(((e,t)=>{const i=t.reduce(((e,t,i)=>({...e,[n[i]]:t})),{});return[...e,i]}),[]);return t?i.slice(-1*t):i},t.sleep=n,t.uuidPattern=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i,t.isUUID=function(e){return"string"==typeof e&&t.uuidPattern.test(e)},t.tryUntil=async function(e,t,i){let r=0,o=!0;for(;o;){r+=1;let s=null,a=null;try{s=await e()}catch(e){a=e}if(o=await t(s,a,r),!o){if(a)throw a;return s}{const e="number"==typeof i?i:i(r);await n(e)}}throw new Error("Method unable to run: invalid retries.")}},321:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.errorMessageParser=t.isIntegrationError=t.ProxyRequestError=t.getErrorMessage=t.getServiceUrl=t.sanitizeUrl=t.isValidUrl=void 0;function n(e){return e?e.match(/^[a-zA-Z]+:\/\//)?e:`https://${e}`:e}function i(e){return Array.isArray(e)?e.flatMap((e=>[e,i(e.children||[])].flatMap((e=>"string"==typeof e?e:i(e))))).filter((e=>e)).join(", "):Object.values(e.constraints||{}).join(", ")}t.isValidUrl=e=>{const t=n(e);try{return new globalThis.URL(t),!0}catch(e){return!1}},t.sanitizeUrl=n,t.getServiceUrl=function(e,t){return`https://${e}${`.${t}`}`},t.getErrorMessage=async function(e,n){var r,o;const s=null===(r=e.headers)||void 0===r?void 0:r.get("content-type"),a=s&&s.includes("application/json")?await e.json():null;let l;return l=a&&(0,t.isIntegrationError)(a.meta)?JSON.stringify(a.meta):a&&"string"==typeof a.message?a.message:a&&400===e.status&&Array.isArray(a.message)?i(a.message):a?JSON.stringify(a):await(null===(o=e.text)||void 0===o?void 0:o.call(e)),n?{message:l,response:a||e}:l};class r extends Error{constructor(e,t){super(e),this.name="Error",this.response=t,Object.setPrototypeOf(this,r.prototype)}}t.ProxyRequestError=r;t.isIntegrationError=e=>!("object"!=typeof e||!e)&&e.isIntegrationError,t.errorMessageParser=function(e){e="string"==typeof e?e:e.message;try{const n=JSON.parse(e);return!!(0,t.isIntegrationError)(n)}catch(e){return!1}}},35:(e,t,n)=>{"use strict";var i,r,o,s,a=n(155);Object.defineProperty(t,"__esModule",{value:!0}),t.CacheThrottle=t.CacheMode=void 0;const l=n(655),d=n(572);var c,u,h;!function(e){e.Debounce="debounce",e.Throttle="throttle"}(c=t.CacheMode||(t.CacheMode={})),function(e){e.Closed="closed",e.Idle="idle",e.Processing="processing"}(u||(u={})),function(e){e[e.Get=0]="Get",e[e.Set=1]="Set",e[e.GetOrSet=2]="GetOrSet",e[e.Del=3]="Del",e[e.Do=4]="Do"}(h||(h={}));t.CacheThrottle=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i.set(this,u.Idle),r.set(this,{}),o.set(this,void 0),s.set(this,[]),l.__classPrivateFieldSet(this,o,{mode:c.Debounce,ttl:0,...e},"f")}async get(e,t){const n=this.serializeKey(e),i=async()=>{const t=l.__classPrivateFieldGet(this,r,"f")[n],{mode:i,ttl:s,value:a}=null!=t?t:{};return!t||!s||i&&i!==c.Debounce||this.refreshTimeout(e,n,s),l.__classPrivateFieldGet(this,o,"f").clearPendingDeletes&&this.clearPendingDeletesOnKey(n,a),a};return t?i():this.enqueue(n,h.Get,i)}async set(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.__classPrivateFieldGet(this,o,"f").ttl,i=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;const a=this.serializeKey(e),d=async()=>{const s=l.__classPrivateFieldGet(this,r,"f")[a],d=!!s;return l.__classPrivateFieldGet(this,r,"f")[a]={...s,mode:i,ttl:n,value:t},d&&i===c.Throttle||this.refreshTimeout(e,a,n),l.__classPrivateFieldGet(this,o,"f").clearPendingDeletes&&this.clearPendingDeletesOnKey(a,t),t};return s?d():this.enqueue(a,h.Set,d)}async getOrSet(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.__classPrivateFieldGet(this,o,"f").ttl,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l.__classPrivateFieldGet(this,o,"f").mode,s=arguments.length>4?arguments[4]:void 0;const a=this.serializeKey(e),d=async()=>{if(l.__classPrivateFieldGet(this,r,"f")[a])return l.__classPrivateFieldGet(this,r,"f")[a].value;const s=await t();return await this.set(e,s,n,i,!0),l.__classPrivateFieldGet(this,o,"f").clearPendingDeletes&&this.clearPendingDeletesOnKey(a,s),s};return s?d():this.enqueue(a,h.GetOrSet,d)}async del(e){let t=arguments.length>2?arguments[2]:void 0;const n=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?e:this.serializeKey(e),i=async()=>{const e=l.__classPrivateFieldGet(this,r,"f")[n];let t;return(null==e?void 0:e.timeout)&&clearTimeout(e.timeout),e&&(t=e.value,delete l.__classPrivateFieldGet(this,r,"f")[n],await(async()=>{var e,n;return null===(n=(e=l.__classPrivateFieldGet(this,o,"f")).onDeregister)||void 0===n?void 0:n.call(e,t)})().catch((e=>{}))),t};return t?i():this.enqueue(n,h.Del,i)}keys(){return Object.keys(l.__classPrivateFieldGet(this,r,"f"))}async do(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.__classPrivateFieldGet(this,o,"f").ttl,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l.__classPrivateFieldGet(this,o,"f").mode;const s=this.serializeKey(e);return this.enqueue(s,h.Do,(async()=>{if(l.__classPrivateFieldGet(this,r,"f")[s])return l.__classPrivateFieldGet(this,r,"f")[s].value;const o=await t();return await this.set(e,o,n,i,!0)}))}async close(){l.__classPrivateFieldSet(this,i,u.Closed,"f"),await Promise.all(Object.keys(l.__classPrivateFieldGet(this,r,"f")).map((e=>this.del(e,!0,!0))))}refreshTimeout(e,t,n){if(l.__classPrivateFieldGet(this,i,"f")===u.Closed)return;const o=l.__classPrivateFieldGet(this,r,"f")[t];return n&&void 0!==(null==o?void 0:o.timeout)&&clearTimeout(o.timeout),n?(o.timeout=setTimeout((()=>this.del(e)),n),o.timeout):void 0}clearPendingDeletesOnKey(e,t){l.__classPrivateFieldSet(this,s,l.__classPrivateFieldGet(this,s,"f").filter((n=>{let[i,r,o,s]=n;return e!==i||r!==h.Del||(s.resolve(t),!1)})),"f")}serializeKey(e){var t,n,i;return null!==(i=null===(n=(t=l.__classPrivateFieldGet(this,o,"f")).serializeKey)||void 0===n?void 0:n.call(t,e))&&void 0!==i?i:e}async enqueue(e,t,n){const r=new d.DeferredPromise;return l.__classPrivateFieldGet(this,s,"f").push([e,t,n,r]),l.__classPrivateFieldGet(this,i,"f")===u.Idle&&this.flush(),r}flush(){l.__classPrivateFieldSet(this,i,u.Processing,"f"),a.nextTick((async()=>{for(;l.__classPrivateFieldGet(this,s,"f").length&&l.__classPrivateFieldGet(this,i,"f")!==u.Closed;){const e=l.__classPrivateFieldGet(this,s,"f").shift();if(e){const[,,t,n]=e;try{const e=await t();n.resolve(e)}catch(e){n.reject(e)}}}l.__classPrivateFieldSet(this,i,u.Idle,"f")}))}},i=new WeakMap,r=new WeakMap,o=new WeakMap,s=new WeakMap},715:(e,t,n)=>{var i=t;i.utils=n(436),i.common=n(772),i.sha=n(41),i.ripemd=n(949),i.hmac=n(326),i.sha1=i.sha.sha1,i.sha256=i.sha.sha256,i.sha224=i.sha.sha224,i.sha384=i.sha.sha384,i.sha512=i.sha.sha512,i.ripemd160=i.ripemd.ripemd160},772:(e,t,n)=>{"use strict";var i=n(436),r=n(746);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=o,o.prototype.update=function(e,t){if(e=i.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=i.join32(e,0,e.length-n,this.endian);for(var r=0;r<e.length;r+=this._delta32)this._update(e,r,r+this._delta32)}return this},o.prototype.digest=function(e){return this.update(this._pad()),r(null===this.pending),this._digest(e)},o.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,n=t-(e+this.padLength)%t,i=new Array(n+this.padLength);i[0]=128;for(var r=1;r<n;r++)i[r]=0;if(e<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)i[r++]=0;i[r++]=0,i[r++]=0,i[r++]=0,i[r++]=0,i[r++]=e>>>24&255,i[r++]=e>>>16&255,i[r++]=e>>>8&255,i[r++]=255&e}else for(i[r++]=255&e,i[r++]=e>>>8&255,i[r++]=e>>>16&255,i[r++]=e>>>24&255,i[r++]=0,i[r++]=0,i[r++]=0,i[r++]=0,o=8;o<this.padLength;o++)i[r++]=0;return i}},326:(e,t,n)=>{"use strict";var i=n(436),r=n(746);function o(e,t,n){if(!(this instanceof o))return new o(e,t,n);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(i.toArray(t,n))}e.exports=o,o.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),r(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},o.prototype.update=function(e,t){return this.inner.update(e,t),this},o.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}},949:(e,t,n)=>{"use strict";var i=n(436),r=n(772),o=i.rotl32,s=i.sum32,a=i.sum32_3,l=i.sum32_4,d=r.BlockHash;function c(){if(!(this instanceof c))return new c;d.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function u(e,t,n,i){return e<=15?t^n^i:e<=31?t&n|~t&i:e<=47?(t|~n)^i:e<=63?t&i|n&~i:t^(n|~i)}function h(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function f(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}i.inherits(c,d),t.ripemd160=c,c.blockSize=512,c.outSize=160,c.hmacStrength=192,c.padLength=64,c.prototype._update=function(e,t){for(var n=this.h[0],i=this.h[1],r=this.h[2],d=this.h[3],c=this.h[4],v=n,I=i,C=r,S=d,O=c,y=0;y<80;y++){var A=s(o(l(n,u(y,i,r,d),e[p[y]+t],h(y)),E[y]),c);n=c,c=d,d=o(r,10),r=i,i=A,A=s(o(l(v,u(79-y,I,C,S),e[g[y]+t],f(y)),_[y]),O),v=O,O=S,S=o(C,10),C=I,I=A}A=a(this.h[1],r,S),this.h[1]=a(this.h[2],d,O),this.h[2]=a(this.h[3],c,v),this.h[3]=a(this.h[4],n,I),this.h[4]=a(this.h[0],i,C),this.h[0]=A},c.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"little"):i.split32(this.h,"little")};var p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],g=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],E=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],_=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},41:(e,t,n)=>{"use strict";t.sha1=n(761),t.sha224=n(799),t.sha256=n(344),t.sha384=n(978),t.sha512=n(900)},761:(e,t,n)=>{"use strict";var i=n(436),r=n(772),o=n(38),s=i.rotl32,a=i.sum32,l=i.sum32_5,d=o.ft_1,c=r.BlockHash,u=[1518500249,1859775393,2400959708,3395469782];function h(){if(!(this instanceof h))return new h;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}i.inherits(h,c),e.exports=h,h.blockSize=512,h.outSize=160,h.hmacStrength=80,h.padLength=64,h.prototype._update=function(e,t){for(var n=this.W,i=0;i<16;i++)n[i]=e[t+i];for(;i<n.length;i++)n[i]=s(n[i-3]^n[i-8]^n[i-14]^n[i-16],1);var r=this.h[0],o=this.h[1],c=this.h[2],h=this.h[3],f=this.h[4];for(i=0;i<n.length;i++){var p=~~(i/20),g=l(s(r,5),d(p,o,c,h),f,n[i],u[p]);f=h,h=c,c=s(o,30),o=r,r=g}this.h[0]=a(this.h[0],r),this.h[1]=a(this.h[1],o),this.h[2]=a(this.h[2],c),this.h[3]=a(this.h[3],h),this.h[4]=a(this.h[4],f)},h.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},799:(e,t,n)=>{"use strict";var i=n(436),r=n(344);function o(){if(!(this instanceof o))return new o;r.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}i.inherits(o,r),e.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h.slice(0,7),"big"):i.split32(this.h.slice(0,7),"big")}},344:(e,t,n)=>{"use strict";var i=n(436),r=n(772),o=n(38),s=n(746),a=i.sum32,l=i.sum32_4,d=i.sum32_5,c=o.ch32,u=o.maj32,h=o.s0_256,f=o.s1_256,p=o.g0_256,g=o.g1_256,E=r.BlockHash,_=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function v(){if(!(this instanceof v))return new v;E.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=_,this.W=new Array(64)}i.inherits(v,E),e.exports=v,v.blockSize=512,v.outSize=256,v.hmacStrength=192,v.padLength=64,v.prototype._update=function(e,t){for(var n=this.W,i=0;i<16;i++)n[i]=e[t+i];for(;i<n.length;i++)n[i]=l(g(n[i-2]),n[i-7],p(n[i-15]),n[i-16]);var r=this.h[0],o=this.h[1],E=this.h[2],_=this.h[3],v=this.h[4],I=this.h[5],C=this.h[6],S=this.h[7];for(s(this.k.length===n.length),i=0;i<n.length;i++){var O=d(S,f(v),c(v,I,C),this.k[i],n[i]),y=a(h(r),u(r,o,E));S=C,C=I,I=v,v=a(_,O),_=E,E=o,o=r,r=a(O,y)}this.h[0]=a(this.h[0],r),this.h[1]=a(this.h[1],o),this.h[2]=a(this.h[2],E),this.h[3]=a(this.h[3],_),this.h[4]=a(this.h[4],v),this.h[5]=a(this.h[5],I),this.h[6]=a(this.h[6],C),this.h[7]=a(this.h[7],S)},v.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},978:(e,t,n)=>{"use strict";var i=n(436),r=n(900);function o(){if(!(this instanceof o))return new o;r.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}i.inherits(o,r),e.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h.slice(0,12),"big"):i.split32(this.h.slice(0,12),"big")}},900:(e,t,n)=>{"use strict";var i=n(436),r=n(772),o=n(746),s=i.rotr64_hi,a=i.rotr64_lo,l=i.shr64_hi,d=i.shr64_lo,c=i.sum64,u=i.sum64_hi,h=i.sum64_lo,f=i.sum64_4_hi,p=i.sum64_4_lo,g=i.sum64_5_hi,E=i.sum64_5_lo,_=r.BlockHash,v=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function I(){if(!(this instanceof I))return new I;_.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=v,this.W=new Array(160)}function C(e,t,n,i,r){var o=e&n^~e&r;return o<0&&(o+=4294967296),o}function S(e,t,n,i,r,o){var s=t&i^~t&o;return s<0&&(s+=4294967296),s}function O(e,t,n,i,r){var o=e&n^e&r^n&r;return o<0&&(o+=4294967296),o}function y(e,t,n,i,r,o){var s=t&i^t&o^i&o;return s<0&&(s+=4294967296),s}function A(e,t){var n=s(e,t,28)^s(t,e,2)^s(t,e,7);return n<0&&(n+=4294967296),n}function w(e,t){var n=a(e,t,28)^a(t,e,2)^a(t,e,7);return n<0&&(n+=4294967296),n}function T(e,t){var n=s(e,t,14)^s(e,t,18)^s(t,e,9);return n<0&&(n+=4294967296),n}function m(e,t){var n=a(e,t,14)^a(e,t,18)^a(t,e,9);return n<0&&(n+=4294967296),n}function N(e,t){var n=s(e,t,1)^s(e,t,8)^l(e,t,7);return n<0&&(n+=4294967296),n}function P(e,t){var n=a(e,t,1)^a(e,t,8)^d(e,t,7);return n<0&&(n+=4294967296),n}function R(e,t){var n=s(e,t,19)^s(t,e,29)^l(e,t,6);return n<0&&(n+=4294967296),n}function b(e,t){var n=a(e,t,19)^a(t,e,29)^d(e,t,6);return n<0&&(n+=4294967296),n}i.inherits(I,_),e.exports=I,I.blockSize=1024,I.outSize=512,I.hmacStrength=192,I.padLength=128,I.prototype._prepareBlock=function(e,t){for(var n=this.W,i=0;i<32;i++)n[i]=e[t+i];for(;i<n.length;i+=2){var r=R(n[i-4],n[i-3]),o=b(n[i-4],n[i-3]),s=n[i-14],a=n[i-13],l=N(n[i-30],n[i-29]),d=P(n[i-30],n[i-29]),c=n[i-32],u=n[i-31];n[i]=f(r,o,s,a,l,d,c,u),n[i+1]=p(r,o,s,a,l,d,c,u)}},I.prototype._update=function(e,t){this._prepareBlock(e,t);var n=this.W,i=this.h[0],r=this.h[1],s=this.h[2],a=this.h[3],l=this.h[4],d=this.h[5],f=this.h[6],p=this.h[7],_=this.h[8],v=this.h[9],I=this.h[10],N=this.h[11],P=this.h[12],R=this.h[13],b=this.h[14],D=this.h[15];o(this.k.length===n.length);for(var L=0;L<n.length;L+=2){var U=b,k=D,M=T(_,v),F=m(_,v),j=C(_,v,I,N,P),B=S(_,v,I,N,P,R),x=this.k[L],K=this.k[L+1],$=n[L],V=n[L+1],G=g(U,k,M,F,j,B,x,K,$,V),H=E(U,k,M,F,j,B,x,K,$,V);U=A(i,r),k=w(i,r),M=O(i,r,s,a,l),F=y(i,r,s,a,l,d);var W=u(U,k,M,F),q=h(U,k,M,F);b=P,D=R,P=I,R=N,I=_,N=v,_=u(f,p,G,H),v=h(p,p,G,H),f=l,p=d,l=s,d=a,s=i,a=r,i=u(G,H,W,q),r=h(G,H,W,q)}c(this.h,0,i,r),c(this.h,2,s,a),c(this.h,4,l,d),c(this.h,6,f,p),c(this.h,8,_,v),c(this.h,10,I,N),c(this.h,12,P,R),c(this.h,14,b,D)},I.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},38:(e,t,n)=>{"use strict";var i=n(436).rotr32;function r(e,t,n){return e&t^~e&n}function o(e,t,n){return e&t^e&n^t&n}function s(e,t,n){return e^t^n}t.ft_1=function(e,t,n,i){return 0===e?r(t,n,i):1===e||3===e?s(t,n,i):2===e?o(t,n,i):void 0},t.ch32=r,t.maj32=o,t.p32=s,t.s0_256=function(e){return i(e,2)^i(e,13)^i(e,22)},t.s1_256=function(e){return i(e,6)^i(e,11)^i(e,25)},t.g0_256=function(e){return i(e,7)^i(e,18)^e>>>3},t.g1_256=function(e){return i(e,17)^i(e,19)^e>>>10}},436:(e,t,n)=>{"use strict";var i=n(746),r=n(717);function o(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function s(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function a(e){return 1===e.length?"0"+e:e}function l(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=r,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16))}else for(var i=0,r=0;r<e.length;r++){var s=e.charCodeAt(r);s<128?n[i++]=s:s<2048?(n[i++]=s>>6|192,n[i++]=63&s|128):o(e,r)?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++r)),n[i++]=s>>18|240,n[i++]=s>>12&63|128,n[i++]=s>>6&63|128,n[i++]=63&s|128):(n[i++]=s>>12|224,n[i++]=s>>6&63|128,n[i++]=63&s|128)}else for(r=0;r<e.length;r++)n[r]=0|e[r];return n},t.toHex=function(e){for(var t="",n=0;n<e.length;n++)t+=a(e[n].toString(16));return t},t.htonl=s,t.toHex32=function(e,t){for(var n="",i=0;i<e.length;i++){var r=e[i];"little"===t&&(r=s(r)),n+=l(r.toString(16))}return n},t.zero2=a,t.zero8=l,t.join32=function(e,t,n,r){var o=n-t;i(o%4==0);for(var s=new Array(o/4),a=0,l=t;a<s.length;a++,l+=4){var d;d="big"===r?e[l]<<24|e[l+1]<<16|e[l+2]<<8|e[l+3]:e[l+3]<<24|e[l+2]<<16|e[l+1]<<8|e[l],s[a]=d>>>0}return s},t.split32=function(e,t){for(var n=new Array(4*e.length),i=0,r=0;i<e.length;i++,r+=4){var o=e[i];"big"===t?(n[r]=o>>>24,n[r+1]=o>>>16&255,n[r+2]=o>>>8&255,n[r+3]=255&o):(n[r+3]=o>>>24,n[r+2]=o>>>16&255,n[r+1]=o>>>8&255,n[r]=255&o)}return n},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<<t|e>>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,n){return e+t+n>>>0},t.sum32_4=function(e,t,n,i){return e+t+n+i>>>0},t.sum32_5=function(e,t,n,i,r){return e+t+n+i+r>>>0},t.sum64=function(e,t,n,i){var r=e[t],o=i+e[t+1]>>>0,s=(o<i?1:0)+n+r;e[t]=s>>>0,e[t+1]=o},t.sum64_hi=function(e,t,n,i){return(t+i>>>0<t?1:0)+e+n>>>0},t.sum64_lo=function(e,t,n,i){return t+i>>>0},t.sum64_4_hi=function(e,t,n,i,r,o,s,a){var l=0,d=t;return l+=(d=d+i>>>0)<t?1:0,l+=(d=d+o>>>0)<o?1:0,e+n+r+s+(l+=(d=d+a>>>0)<a?1:0)>>>0},t.sum64_4_lo=function(e,t,n,i,r,o,s,a){return t+i+o+a>>>0},t.sum64_5_hi=function(e,t,n,i,r,o,s,a,l,d){var c=0,u=t;return c+=(u=u+i>>>0)<t?1:0,c+=(u=u+o>>>0)<o?1:0,c+=(u=u+a>>>0)<a?1:0,e+n+r+s+l+(c+=(u=u+d>>>0)<d?1:0)>>>0},t.sum64_5_lo=function(e,t,n,i,r,o,s,a,l,d){return t+i+o+a+d>>>0},t.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},t.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},t.shr64_hi=function(e,t,n){return e>>>n},t.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0}},717:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},245:(e,t,n)=>{"use strict";function i(e){this.message=e}n.r(t),n.d(t,{InvalidTokenError:()=>s,default:()=>a}),i.prototype=new Error,i.prototype.name="InvalidCharacterError";var r="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new i("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r,o=0,s=0,a="";r=t.charAt(s++);~r&&(n=o%4?64*n+r:r,o++%4)?a+=String.fromCharCode(255&n>>(-2*o&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return a};function o(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(r(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return r(t)}}function s(e){this.message=e}s.prototype=new Error,s.prototype.name="InvalidTokenError";const a=function(e,t){if("string"!=typeof e)throw new s("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(o(e.split(".")[n]))}catch(e){throw new s("Invalid token specified: "+e.message)}}},746:e=>{function t(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=t,t.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)}},155:e=>{var t,n,i=e.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(e){t=r}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var a,l=[],d=!1,c=-1;function u(){d&&a&&(d=!1,a.length?l=a.concat(l):c=-1,l.length&&h())}function h(){if(!d){var e=s(u);d=!0;for(var t=l.length;t;){for(a=l,l=[];++c<t;)a&&a[c].run();c=-1,t=l.length}a=null,d=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{return n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function p(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new f(e,t)),1!==l.length||d||s(h)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=p,i.addListener=p,i.once=p,i.off=p,i.removeListener=p,i.removeAllListeners=p,i.emit=p,i.prependListener=p,i.prependOnceListener=p,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},655:(e,t,n)=>{"use strict";n.r(t),n.d(t,{__assign:()=>o,__asyncDelegator:()=>S,__asyncGenerator:()=>C,__asyncValues:()=>O,__await:()=>I,__awaiter:()=>c,__classPrivateFieldGet:()=>m,__classPrivateFieldSet:()=>N,__createBinding:()=>h,__decorate:()=>a,__exportStar:()=>f,__extends:()=>r,__generator:()=>u,__importDefault:()=>T,__importStar:()=>w,__makeTemplateObject:()=>y,__metadata:()=>d,__param:()=>l,__read:()=>g,__rest:()=>s,__spread:()=>E,__spreadArray:()=>v,__spreadArrays:()=>_,__values:()=>p});var i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},i(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return o=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},o.apply(this,arguments)};function s(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function a(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function l(e,t){return function(n,i){t(n,i,e)}}function d(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function c(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))}function u(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}var h=Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]};function f(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||h(t,e,n)}function p(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}function E(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(g(arguments[t]));return e}function _(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),r=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,r++)i[r]=o[s];return i}function v(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}function I(e){return this instanceof I?(this.v=e,this):new I(e)}function C(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=n.apply(e,t||[]),o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(e){r[e]&&(i[e]=function(t){return new Promise((function(n,i){o.push([e,t,n,i])>1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof I?Promise.resolve(n.value.v).then(l,d):c(o[0][2],n)}catch(e){c(o[0][3],e)}var n}function l(e){a("next",e)}function d(e){a("throw",e)}function c(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function S(e){var t,n;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,r){t[i]=e[i]?function(t){return(n=!n)?{value:I(e[i](t)),done:"return"===i}:r?r(t):t}:r}}function O(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=p(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(n){t[n]=e[n]&&function(t){return new Promise((function(i,r){(function(e,t,n,i){Promise.resolve(i).then((function(t){e({value:t,done:n})}),t)})(i,r,(t=e[n](t)).done,t.value)}))}}}function y(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var A=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function w(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&h(t,e,n);return A(t,e),t}function T(e){return e&&e.__esModule?e:{default:e}}function m(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function N(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,n),o.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i=n(773);module.exports=i})();
|
|
2
|
+
(()=>{var e={773:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExternalFilePicker=t.PARAGON_OVERFLOW_EMPTY_VALUE=void 0;const i=n(655),r=i.__importDefault(n(6245)),o=n(3931),s=n(4059),a=n(745),l=n(7343),d=n(7050);Object.defineProperty(t,"ExternalFilePicker",{enumerable:!0,get:function(){return d.ExternalFilePicker}});const c=n(2643),u=n(4429),h=i.__importDefault(n(9892)),p=n(3821),f=n(3158),g=n(4846),E=n(572),_=n(8321),v=n(3035),I="paragon-connect-frame",S=`${I}-container`,C="paragon-connect-user-state";t.PARAGON_OVERFLOW_EMPTY_VALUE="PARAGON_OVERFLOW_EMPTY_VALUE";class O extends h.default{constructor(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(super(),this.rootLoaded=!1,this.rootElementCreated=!1,this.modalState={integration:null,onClose:this.onClose.bind(this),overlayStyle:{overflow:"auto"},onOpen:this.onOpen.bind(this),apiInstallationOptions:{isApiInstallation:!1,showPortalAfterInstall:!1}},this.userState={authenticated:!1},this.loadedConfigs={},this.loadedIntegrations={},this.endUserIntegrationConfig={},this.metadata={},this.cachedApiResponse=new v.CacheThrottle({ttl:5e3}),this.keyToRequestPromiseMap={},this.originalBodyOverflow=t.PARAGON_OVERFLOW_EMPTY_VALUE,this.customDropdownOptionsLoaders={},"undefined"==typeof window)return void console.warn("connect sdk can only be used on browser");const i=(0,f.getAssetUrl)({CDN_PUBLIC_URL:"https://cdn.useparagon.com",DASHBOARD_PUBLIC_URL:"https://dashboard.useparagon.com",NODE_ENV:"production",PLATFORM_ENV:"production",VERSION:"latest"});if(this.environments={CDN_PUBLIC_URL:i,CONNECT_PUBLIC_URL:"https://connect.useparagon.com",DASHBOARD_PUBLIC_URL:"https://dashboard.useparagon.com",HERMES_PUBLIC_URL:"https://hermes.useparagon.com",NODE_ENV:"production",PASSPORT_PRODUCTION_URL:"https://passport.useparagon.com",PASSPORT_PUBLIC_URL:"https://passport.useparagon.com",PLATFORM_ENV:"production",VERSION:"latest",WORKER_PROXY_PUBLIC_URL:"https://proxy.useparagon.com",ZEUS_PUBLIC_URL:"https://zeus.useparagon.com"},this.userState={authenticated:!1},"string"==typeof e?this.configureGlobal({host:e}):this.environments={...this.environments,...e},!this.environments.CONNECT_PUBLIC_URL)throw new Error("Paragon SDK error! No `CONNECT_PUBLIC_URL` configured.");if(!this.environments.DASHBOARD_PUBLIC_URL)throw new Error("Paragon SDK error! No `DASHBOARD_PUBLIC_URL` configured.");if(!this.environments.PASSPORT_PUBLIC_URL)throw new Error("Paragon SDK error! No `PASSPORT_PUBLIC_URL` configured.");if(!this.environments.WORKER_PROXY_PUBLIC_URL)throw new Error("Paragon SDK error! No `WORKER_PROXY_PUBLIC_URL` configured.");if(!this.environments.ZEUS_PUBLIC_URL)throw new Error("Paragon SDK error! No `ZEUS_PUBLIC_URL` configured.");n.skipBootstrapWithLastKnownState||this.loadState(),window.addEventListener("message",this.eventMessageHandler.bind(this)),window.document.readyState===p.DocumentLoadingState.LOADING?window.document.addEventListener("DOMContentLoaded",(()=>{this.createReactRoot()})):this.createReactRoot()}async eventMessageHandler(e){switch(e.data.type){case"oauth_success_callback":await this._oauthCallback(e.data.credential);break;case"oauth_error_callback":await this._oauthErrorCallback(e.data.error,e);break;default:await this.functionInvocationHandler(e)}}async functionInvocationHandler(e){if("SDK_FUNCTION_INVOCATION"!==e.data.messageType)return;const{type:t,id:n,parameters:i}=e.data;let r;try{r={messageType:"SDK_FUNCTION_RESPONSE",id:n,type:t,result:await this[t](...i)}}catch(e){r={messageType:"SDK_FUNCTION_ERROR",error:!0,message:e.message,id:n}}e.source.postMessage(r,this.environments.CONNECT_PUBLIC_URL)}createReactRoot(){var e;if(this.rootElementCreated)return;this.rootElementCreated=!0,this.root=document.createElement("iframe"),this.root.onload=()=>{this.rootLoaded=!0,this.render()};const t=!!document.querySelector(`#${S}`);this.root.id=I,this.root.src=`${this.environments.CONNECT_PUBLIC_URL}/ui${this.projectId?`?projectId=${this.projectId}`:""}`,this.root.style.position=t?"absolute":"fixed",this.root.style.top="0",this.root.style.left="0",this.root.style.width=t?"100%":"100vw",this.root.style.height=t?"100%":"100vh",this.root.style.zIndex="2147483647",this.root.style.display="none",null===(e=document.querySelector(`#${S}`)||document.body)||void 0===e||e.appendChild(this.root)}validateAction(e){var t;if(!this.loadedIntegrations[e]&&!(0,l.isCustomIntegrationTypeName)(e))throw new Error(`"${e}" is not a valid integration type. The integrations you have configured for this Paragon project are:\n\n${Object.keys(this.loadedConfigs).map((e=>`- "${e}"`)).join("\n")}\n`);if(!this.loadedConfigs[e]||!this.userState.integrations[e])throw new Error(`integration "${e}" has not been set up in your Paragon project yet.\n\n${Object.keys(this.loadedConfigs).map((e=>`- "${e}"`)).join("\n")}`);if(!(null===(t=this.loadedIntegrations[e])||void 0===t?void 0:t.isActive))throw new Error(`integration "${e}" is not active in your Paragon project yet.`)}isAlreadyInstalled(e,t,n){var i,r;if(n){const e=this.getCredentialAndConfig({selectedCredentialId:n});return(null===(i=null==e?void 0:e.selectedCredential)||void 0===i?void 0:i.status)===s.CredentialStatus.VALID}return Boolean(null===(r=t.integrations[e])||void 0===r?void 0:r.enabled)}async bootstrapSDKState(e){this.projectId&&this.userState.authenticated&&(this.project=await this.sendConnectRequest(`/sdk/projects/${this.projectId}`,{headers:{"X-Paragon-Cache-Metadata":"1",...e?{"X-Paragon-User-Metadata":JSON.stringify(e)}:{}}},!1),await this.updateLocalState())}setModalState(e){this.modalState={config:void 0,...this.modalState,...e},this.render()}loadState(){if("undefined"!=typeof window)try{const e=window.localStorage.getItem(C)?JSON.parse(window.localStorage.getItem(C)):{};if(e.projectId&&(this.projectId=e.projectId),e.userState){const{userState:t}=e;if(!("authenticated"in t&&t.authenticated&&"token"in t))throw new Error("Malformatted or unauthenticated user was persisted into localStorage. Refusing to load.");this.updateAuthenticatedUser(t),this.bootstrapSDKState().catch((()=>{this.clearState()}))}}catch{this.clearState()}}saveState(){"undefined"!=typeof window&&this.userState.authenticated&&window.localStorage.setItem(C,JSON.stringify({projectId:this.projectId,userState:this.userState}))}clearState(){"undefined"!=typeof window&&window.localStorage.removeItem(C)}render(){if(this.root&&this.rootLoaded){const{onClose:e,onOpen:t,...n}=this.modalState,i={messageType:"UI_UPDATE",nextContext:{user:this.userState,projectId:this.projectId,environments:this.environments,project:this.project,endUserIntegrationConfig:this.modalState.integration?this.endUserIntegrationConfig[(0,l.getIntegrationTypeName)(this.modalState.integration)||""]:void 0},nextModalState:n};if(!this.root.contentWindow)throw new Error("Browser not supported");this.root.contentWindow.postMessage(i,this.environments.CONNECT_PUBLIC_URL)}}updateContainerStyle(e){let{isModalShown:t}=e;this.root&&(this.root.style.display=t?"block":"none")}async authenticate(e,t,n){var i;if(!e||!t)throw new Error("projectId or token not specified to paragon.authenticate()");let o={};try{o=(0,r.default)(t)}catch(e){throw new Error("A well-formed JWT was not provided to paragon.authenticate()")}this.projectId=e,this.userState={authenticated:!0,token:t,userId:o.sub||o.id,integrations:{},meta:null!==(i=null==n?void 0:n.metadata)&&void 0!==i?i:{},resources:[]};try{if(Date.now()>=1e3*(o.exp||0))throw new Error("JWT token provided has expired.");await this.bootstrapSDKState(null==n?void 0:n.metadata)}catch(e){throw console.warn("paragon.authenticate() could not login user",e),this.logout(),new Error(`Failed to authenticate user with Paragon: ${e.message}`)}this.render()}getUser(){return Object.fromEntries(Object.entries(this.userState).filter((e=>{let[t]=e;return"token"!==t})))}updateAuthenticatedUser(e){this.userState.authenticated?this.userState={...this.userState,...e}:e.authenticated&&(this.userState=e),this.render()}logout(){this.userState={authenticated:!1},this.clearState(),this.render()}async connect(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{mapObjectFields:n,overrideRedirectUrl:i,isApiInstallation:r=!1,showPortalAfterInstall:o,bypassPostOAuthPrompt:s,allowMultipleCredentials:d,selectedCredentialId:h,selectedConfigurationId:f,accountType:g,...E}=t;return this.integrationToBeEnabled=e,new Promise(((v,I)=>{var S,C;if(!this.userState.authenticated)throw new Error("User not authenticated, Call paragon.authenticate(<projectId>, <user token>) before using the SDK.");const O=Array.isArray(g)?{selectedMultipleAccountTypes:g}:{};this.subscribeToIntegration(e,{...E,onInstall:(t,n)=>{var i;const r=n.integrations[e];t.credentialId=null==r?void 0:r.credentialId,t.credential=null==r?void 0:r.allCredentials.find((e=>e.id===r.credentialId)),v(t),(null==E?void 0:E.onInstall)?E.onInstall(t,n):null===(i=null==E?void 0:E.onSuccess)||void 0===i||i.call(E,t,n)},onError:e=>{var t;I(e),null===(t=null==E?void 0:E.onError)||void 0===t||t.call(E,e)}});try{if(n&&!this.project.accessibleFeatures.includes(p.ConnectAddOn.DynamicFieldMapper))throw new Error("Dynamic Field Mapping is available on our Enterprise plan. Contact sales@useparagon.com to learn more or upgrade.");if(this.validateAction(e),i&&!(0,_.isValidUrl)(i))throw new Error(`${i} is not valid url.`);this.endUserIntegrationConfig[e]={mapObjectFields:n,overrideRedirectUrl:i?(0,_.sanitizeUrl)(i):void 0};const E=Object.values(this.loadedIntegrations).find((t=>(0,l.getIntegrationTypeName)(t)===e)),v="string"==typeof g?null==g?void 0:g.trim():"",I=Array.isArray(g)?g.filter((e=>{var t,n;return!(null===(n=null===(t=null==E?void 0:E.sdkIntegrationConfig)||void 0===t?void 0:t.accountTypes)||void 0===n?void 0:n.some((t=>t.id===e)))})):[],y=(0,c.findSelectedAccountType)(null===(S=null==E?void 0:E.sdkIntegrationConfig)||void 0===S?void 0:S.accountTypes,v,null==O?void 0:O.selectedMultipleAccountTypes),m={isApiInstallation:r,showPortalAfterInstall:o,bypassPostOAuthPrompt:s,allowMultipleCredentials:d,selectedCredentialId:h,selectedConfigurationId:f};if(this.setCredentialConfigForUserState(e,h,f),t.isApiInstallation){const t={context:{user:this.userState,projectId:this.projectId,environments:this.environments,endUserIntegrationConfig:this.endUserIntegrationConfig[e]},integration:E};if(Boolean(E.needPreOauthInputs&&y&&!(null===(C=y.endUserSuppliedValues)||void 0===C?void 0:C.length)&&y.scheme===a.AuthenticationScheme.OAUTH)||!E.needPreOauthInputs){t.authParams=null==y?void 0:y.oauthParameters,t.installOptions=m;const e=Math.random().toString(36).substring(2,15),n=(0,u.startOAuthFlow)(t,e);if(n){const t=Date.now(),i=setInterval((()=>{if(Date.now()-t>u.MAX_POLL_DURATION)clearInterval(i);else try{n.opener||(clearInterval(i),this.pollForCredential(e))}catch(t){this.pollForCredential(e)}}),500)}}}(g&&!y&&"string"==typeof g||I.length)&&console.warn(`Account type "${I.length?I:g}" is not valid for integration "${null==E?void 0:E.type}"`);const A=JSON.parse(JSON.stringify(this.loadedConfigs[e])),w=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(!e)return;const t=new Set,n=[];for(const i of e)t.has(i.value)?console.warn(`Duplicated key: "${i.value}", Ignored: "${i.label}"`):(n.push(i),t.add(i.value));return n};if("dropdowns"in t){const n=t.dropdowns,i=[];for(const e in n){const t=n[e];if("loadOptions"in t){const n=t.loadOptions;this.customDropdownOptionsLoaders[e]=n,i.push(e)}}if(A.sharedMeta&&Array.isArray(A.sharedMeta.inputs))for(const e of A.sharedMeta.inputs){if(i.includes(e.key)){e.customDropdownOptions=[];continue}const t=w(n[e.key]);t&&e.customDropdownOptions&&(e.customDropdownOptions=t)}if(A.workflowMeta)for(const e in A.workflowMeta){const t=A.workflowMeta[e];for(const e of t.inputs){if(i.includes(e.key)){e.customDropdownOptions=[];continue}const t=w(n[e.key]);t&&e.customDropdownOptions&&(e.customDropdownOptions=t)}}this.loadedConfigs[e]=A}this.setModalState({integration:E,config:this.loadedConfigs[e],apiInstallationOptions:{...m,...O,selectedAccountConfig:y},selectedCredentialId:h,connectionError:void 0,shouldShowPortalAfterInstall:!1})}catch(t){this.emitError(t,e)}}))}setCredentialConfigForUserState(e,t,n){var i,r,o;if(!this.userState.authenticated||!(null===(i=this.userState.integrations[e])||void 0===i?void 0:i.allCredentials.length))return;const a=this.userState.integrations[e],l=null!==(r=null==a?void 0:a.credentialId)&&void 0!==r?r:null==a?void 0:a.allCredentials[0].id,d=this.getCredentialAndConfig(t||n?{selectedCredentialId:t,selectedConfigurationId:n}:{selectedCredentialId:l},a);if(!(null===(o=null==a?void 0:a.allCredentials)||void 0===o?void 0:o.some((e=>{let{id:t}=e;return t===(null==d?void 0:d.selectedCredential.id)})))||!d)throw new Error(`Credential with ID "${t}" is not a valid ${e} account.`);const{selectedConfig:c,selectedCredential:u}=d,h={...a,allConfigurations:(null==a?void 0:a.allConfigurations)||[],allCredentials:(null==a?void 0:a.allCredentials)||[],enabled:u.status===s.CredentialStatus.VALID,credentialId:u.id,credentialStatus:u.status,providerData:u.providerData,providerId:u.providerId,configMeta:null==c?void 0:c.configMeta,credentialConfigId:null==c?void 0:c.id,externalId:null==c?void 0:c.externalId,sharedSettings:null==c?void 0:c.sharedSettings,workflowSettings:null==c?void 0:c.workflowSettings,configuredWorkflows:null==c?void 0:c.workflowSettings};this.userState.integrations={...this.userState.integrations,[e]:h}}getCredentialAndConfig(e,t){var n;const{selectedCredentialId:i,selectedConfigurationId:r}=e;if(!this.userState.authenticated||!i&&!r)return;let o,s;const a=null!==(n=null==t?void 0:t.allCredentials)&&void 0!==n?n:Object.values(this.userState.integrations).flatMap((e=>(null==e?void 0:e.allCredentials)||[])),l=a.flatMap((e=>{let{configurations:t}=e;return t}));if(r){const e=r.startsWith("ext:")||!(0,E.isUUID)(r),t=(0,f.sanitizeExternalConfigId)(r);if(s=l.find((n=>(e?n.externalId===t:n.id===t)&&(!i||n.connectCredentialId===i))),!s)throw new Error(`Credential configuration not found for provided id: ${r}.`)}if(o=a.find((e=>{let{id:t}=e;return t===((null==s?void 0:s.connectCredentialId)||i)})),s=null!=s?s:null==o?void 0:o.configurations.find((e=>{let{isDefault:t}=e;return t})),!o)throw new Error("Unable to find credential for provided options.");if(!s)throw new Error(`Credential configuration not found for credential: ${o.id}.`);if(s&&s.connectCredentialId!==(null==o?void 0:o.id))throw new Error('Provided "selectedCredentialId" does not belongs to provided "selectedConfigurationId".');return{selectedCredential:o,selectedConfig:s}}_getIntegration(e){return Object.values(this.loadedIntegrations).find((t=>t.id===e))}async _oauthCallback(e,t){var n,i,r;const{integrationId:o,payload:a}=e,d=this._getIntegration(o);if(!d)return;const c=(0,g.hash)(JSON.stringify({oauthResponse:e,credentialId:t}));if(await this.cachedApiResponse.get(c))return;await this.cachedApiResponse.set(c,!0);const u=(0,l.getIntegrationTypeName)(d),h=(null===(n=this.modalState.apiInstallationOptions)||void 0===n?void 0:n.isApiInstallation)?this.modalState.apiInstallationOptions:{};try{const e=t?`/sdk/credentials/${t}/complete-setup`:"/sdk/credentials",n=await this.sendConnectRequest(e,{method:"POST",body:JSON.stringify({integrationId:d.id,config:{},payload:a,installOptions:h})});if(!n)throw new Error("Unable to save oauth credentials");this.updateCredentialData(n,d),n.status===s.CredentialStatus.VALID&&this.triggerSDKEvent({type:p.SDK_EVENT.ON_INTEGRATION_INSTALL,integrationId:d.id,integrationType:u}),(null===(i=this.modalState.apiInstallationOptions)||void 0===i?void 0:i.allowMultipleCredentials)&&(null===(r=this.modalState.apiInstallationOptions)||void 0===r?void 0:r.showPortalAfterInstall)?this.setModalState({...this.modalState,shouldShowPortalAfterInstall:!0}):this.setModalState({...this.modalState,connectionError:void 0})}catch(e){this.setModalState({...this.modalState,connectionError:e}),this.emitError(e,u),await this._oauthErrorCallback(e.message)}}async _oauthErrorCallback(e,t){var n;const i=e;let r;r=this.integrationToBeEnabled?this.loadedIntegrations[this.integrationToBeEnabled].id:null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.integrationId,t&&(this.emitError(t.data.errorResponse,(0,l.getIntegrationTypeName)(this._getIntegration(r))),this.setModalState({...this.modalState,connectionError:t.data})),console.error("Failed to connect account to Paragon over OAuth",i)}async _loadCustomDropdownOptions(e,t,n){return this.customDropdownOptionsLoaders[e](t,n)}async sendConnectRequest(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];var i;if(!this.userState.authenticated||!this.projectId)throw new Error("Connect SDK attempted to make an API request, but no user was authenticated.\nCall paragon.authenticate(<projectId>, <user token>) before using the SDK.");const r=`${null!==(i=null==t?void 0:t.baseURLOverride)&&void 0!==i?i:this.environments.ZEUS_PUBLIC_URL}${n?`/projects/${this.projectId}`:""}${e}`,o=(0,g.hash)(JSON.stringify({url:r,payload:{...t}})),s=await this.cachedApiResponse.get(o,!0);if((null==t?void 0:t.cacheResult)&&s)return s;const a=Boolean(!t||"GET"===t.method||t.cacheResult);if(a&&"object"==typeof this.keyToRequestPromiseMap[o])return this.keyToRequestPromiseMap[o];const l=this.userState.token,d=this.modalState.integration&&this.integrationToBeEnabled?this.userState.integrations[this.integrationToBeEnabled]:void 0,c=new Promise(((e,n)=>{(async()=>{try{const n=await this.sendRequest(r,{...t,headers:{Accept:"application/json","Content-Type":"application/json",...(null==d?void 0:d.credentialId)?{[p.SELECTED_CREDENTIAL_ID_HEADER]:null==d?void 0:d.credentialId}:{},...null==t?void 0:t.headers,Authorization:`Bearer ${l}`}},a?o:void 0);e(n)}catch(e){n(e)}})()}));return a&&(this.keyToRequestPromiseMap[o]=c),c}async sendRequest(e,t,n){var i;let r,s,a;try{r=await fetch(e,t)}catch(e){a=e}if(r&&!r.ok||a){const t=r?await(0,_.getErrorMessage)(r,!0):null==a?void 0:a.message,s="string"==typeof t?t:null==t?void 0:t.message,l=(0,_.errorMessageParser)(s),d="object"==typeof t&&t.response.code===o.INSUFFICIENT_PERMISSION,c="object"==typeof t&&[o.BYO_CREDENTIAL_VERIFICATION_ERROR,o.BYO_USER_PROFILE_ERROR_CODE].includes(t.response.code),u=401===(null==r?void 0:r.status)||403===(null==r?void 0:r.status),h=!l&&!d&&!c&&u;if(h&&!e.includes("proxy"))this.logout();else if(h&&e.includes("proxy")){const e=await this.fetchUserData();this.updateAuthenticatedUser({integrations:e.integrations,meta:e.meta,resources:e.resources})}if(n&&(await this.cachedApiResponse.del(n),delete this.keyToRequestPromiseMap[n]),"string"!=typeof t&&e.includes("proxy"))throw null===(i=t.response)||void 0===i||delete i.headers,new _.ProxyRequestError(t.message,t.response);throw new Error("string"==typeof t?s:JSON.stringify(t.response))}try{s=await(null==r?void 0:r.json())}catch{s=void 0}return n&&(await this.cachedApiResponse.set(n,s),delete this.keyToRequestPromiseMap[n]),s}async request(e,t,n){var i,r;let o=`/sdk/proxy/${e}`;(0,l.isCustomIntegrationTypeName)(e)&&(o=`/sdk/proxy/custom/${null===(i=Object.values(this.loadedIntegrations).find((t=>!!t.customIntegration&&t.customIntegration.slug===e)))||void 0===i?void 0:i.id}`);const s=t.startsWith("/")?t:`/${t}`,a=n.selectedCredentialId?n.selectedCredentialId:null===(r=this.userState.integrations[e])||void 0===r?void 0:r.credentialId,d=await this.sendConnectRequest(`${o}${s}`,{method:n.method,body:"object"==typeof n.body?JSON.stringify(n.body):n.body,headers:{"Content-Type":p.INFER_CONTENT_TYPE_FROM_CONNECT_OPTIONS,...a?{[p.SELECTED_CREDENTIAL_ID_HEADER]:a}:{},...n.headers},baseURLOverride:this.environments.WORKER_PROXY_PUBLIC_URL});return null==d?void 0:d.output}async event(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{selectedConfigurationId:i,selectedCredentialId:r}=n;if(i&&!r||!i&&r)throw new Error("Both Configuration ID and Credential ID must either be provided together or not at all.");const o=this.getCredentialAndConfig({selectedConfigurationId:i,selectedCredentialId:r});await this.sendConnectRequest(`/v2/projects/${this.projectId}/sdk/events/trigger`,{method:"POST",headers:{...o?{[p.SELECTED_CREDENTIAL_ID_HEADER]:o.selectedCredential.id,[p.SELECTED_CREDENTIAL_CONFIG_ID_HEADER]:o.selectedConfig.id}:{}},body:JSON.stringify({name:e,payload:t})},!1)}onClose(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{integration:n,apiInstallationOptions:i}=this.modalState;n&&(this.triggerSDKEvent({type:p.SDK_EVENT.ON_PORTAL_CLOSE,integrationId:n.id,integrationType:(0,l.getIntegrationTypeName)(n)}),this.originalBodyOverflow!==t.PARAGON_OVERFLOW_EMPTY_VALUE&&(window.document.body.style.overflow=this.originalBodyOverflow,this.originalBodyOverflow=t.PARAGON_OVERFLOW_EMPTY_VALUE),!e&&(null==i?void 0:i.isApiInstallation)||(this.setModalState({integration:null}),this.integrationToBeEnabled=void 0))}onOpen(){const{integration:e}=this.modalState;if(e&&(this.triggerSDKEvent({type:p.SDK_EVENT.ON_PORTAL_OPEN,integrationId:e.id,integrationType:(0,l.getIntegrationTypeName)(e)}),this.root&&this.originalBodyOverflow===t.PARAGON_OVERFLOW_EMPTY_VALUE)){const e=this.root.getBoundingClientRect();window.innerHeight<=e.height&&window.innerWidth<=e.width&&(this.originalBodyOverflow=window.document.body.style.overflow,window.document.body.style.overflow="hidden")}}triggerSDKEvent(e){this.triggerEvent(e,this.userState)}getIntegrationMetadata(e){const t=e=>{return{...e,icon:(t=e.icon,t.includes(".svg")?(null===(n=t.split(".svg"))||void 0===n?void 0:n[0])+".svg":t)};var t,n};if(e){const n=this.metadata[e];if(!n)throw new Error(`${e} is not a valid integration name`);return t(n)}return Object.values(this.metadata).map(t)}closePortal(){this.onClose(!0)}workflow(e){let{selectedCredentialId:t,selectedConfigurationId:n,body:i={},query:r={},headers:o={}}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var s;if(!e)throw new Error("workflowId is required.");const a=new URLSearchParams(r).toString(),l=this.getIntegrationForWorkflow(e),d=this.getCredentialAndConfig(t||n?{selectedCredentialId:t,selectedConfigurationId:n}:{selectedCredentialId:l.credentialId},l);if(!d||!(null===(s=d.selectedConfig.workflowSettings[e])||void 0===s?void 0:s.enabled))throw new Error(`Workflow ${e} is not enabled for this user.`);return this.sendConnectRequest(`/sdk/triggers/${e}?${a}`,{method:"POST",body:JSON.stringify(i),headers:{[p.SELECTED_CREDENTIAL_ID_HEADER]:d.selectedCredential.id,[p.SELECTED_CREDENTIAL_CONFIG_ID_HEADER]:d.selectedConfig.id,...o}},!0)}installIntegration(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.userState.authenticated)throw new Error("User not authenticated, Call paragon.authenticate(<projectId>, <user token>) before using the SDK.");this.closePortal();const n={showPortalAfterInstall:!1,bypassPostOAuthPrompt:!1,allowMultipleCredentials:!1,...t,isApiInstallation:!0};if(n.bypassPostOAuthPrompt&&n.showPortalAfterInstall)throw new Error("Could not use both `bypassPostOAuthPrompt` and `showPortalAfterInstall` as true at the same time.");if(this.ensureHeadlessIsSupported(),this.validateAction(e),!n.allowMultipleCredentials&&this.isAlreadyInstalled(e,this.userState))throw new Error(`Integration "${e}" is already installed.`);if(t.showPortalAfterInstall){const t=Object.values(this.loadedIntegrations).find((t=>(0,l.getIntegrationTypeName)(t)===e));this.setModalState({integration:t,config:this.loadedConfigs[e],apiInstallationOptions:n,shouldShowPortalAfterInstall:!1})}else this.setModalState({integration:null});return this.connect(e,n)}ensureHeadlessIsSupported(){if(!this.project.accessibleFeatures.includes(p.ConnectAddOn.HeadlessConnectPortal))throw new Error("Headless Connect Portal is available on our Pro plan and above. Contact sales@useparagon.com to learn more or upgrade.")}async uninstallIntegration(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=null==t?void 0:t.selectedCredentialId;if(!this.userState.authenticated)throw new Error("User not authenticated, Call paragon.authenticate(<projectId>, <user token>) before using the SDK.");if(this.ensureHeadlessIsSupported(),this.validateAction(e),!this.isAlreadyInstalled(e,this.userState,t.selectedCredentialId))throw new Error(`Integration "${e}" is not installed.`);const i=this.loadedIntegrations[e].id,r=this.userState.integrations[e],o=n||(null==r?void 0:r.credentialId);if(!o||!r)throw new Error("No credential found for uninstall");await this.sendConnectRequest(`/sdk/integrations/${i}`,{method:"DELETE",headers:{...o?{[p.SELECTED_CREDENTIAL_ID_HEADER]:o}:{}}}),this.updateAuthenticatedUser({integrations:{...this.userState.integrations,[e]:(0,c.getActionStateForCredentialDelete)(o,r)}}),n===this.modalState.selectedCredentialId&&this.setModalState({integration:null,selectedCredentialId:void 0}),this.saveState(),this.triggerSDKEvent({type:p.SDK_EVENT.ON_INTEGRATION_UNINSTALL,integrationId:i,integrationType:e})}async disableWorkflow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var n;const{selectedCredentialId:i,selectedConfigurationId:r}=t,o=this.getIntegrationForWorkflow(e),s=this.getCredentialAndConfig(i||r?{selectedCredentialId:i,selectedConfigurationId:r}:{selectedCredentialId:o.credentialId},o);if(!s||!(null===(n=s.selectedConfig.workflowSettings[e])||void 0===n?void 0:n.enabled))throw new Error(`Workflow ${e} cannot be disabled for this user.`);await this.sendConnectRequest(`/sdk/workflows/${e}`,{method:"DELETE",headers:{[p.SELECTED_CREDENTIAL_ID_HEADER]:s.selectedCredential.id,[p.SELECTED_CREDENTIAL_CONFIG_ID_HEADER]:s.selectedConfig.id}}),await this.updateLocalState()}async enableWorkflow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var n;const{selectedCredentialId:i,selectedConfigurationId:r}=t,o=this.getIntegrationForWorkflow(e),a=this.getCredentialAndConfig(i||r?{selectedCredentialId:i,selectedConfigurationId:r}:{selectedCredentialId:o.credentialId},o);if(!a||(null==a?void 0:a.selectedCredential.status)!==s.CredentialStatus.VALID)throw new Error("Valid credential not found for provided options.");const{selectedConfig:l,selectedCredential:d}=a;if(null===(n=l.workflowSettings[e])||void 0===n?void 0:n.enabled)throw new Error(`Workflow ${e} is already enabled for this user.`);await this.sendConnectRequest(`/sdk/workflows/${e}`,{method:"POST",headers:{[p.SELECTED_CREDENTIAL_ID_HEADER]:d.id,[p.SELECTED_CREDENTIAL_CONFIG_ID_HEADER]:l.id}}),await this.updateLocalState()}async getIntegrationAccount(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var n;this.validateAction(e);const i=null===(n=this.userState.integrations[e])||void 0===n?void 0:n.allCredentials;if(!(null==i?void 0:i.length))throw new Error("Connect credential not found");const r=await this.sendConnectRequest(`/sdk/credentials?integration=${e}&includeAccountAuth=${t.includeAccountAuth}`,{method:"GET",headers:t.selectedCredentialId?{[p.SELECTED_CREDENTIAL_ID_HEADER]:t.selectedCredentialId}:{}});if(!r)throw new Error("Integration not connected");return r}getIntegrationForWorkflow(e){if(!this.userState.authenticated)throw new Error("User not authenticated, Call paragon.authenticate(<projectId>, <user token>) before using the SDK.");const t=Object.values(this.loadedIntegrations).find((t=>{const n=t.configs[0].values;return e in(n.workflowMeta||{})}));if(!t)throw new Error("Workflow not found in the configured integrations in your Paragon project.");const n=(0,l.getIntegrationTypeName)(t)?this.userState.integrations[(0,l.getIntegrationTypeName)(t)]:void 0;if(!n||!n.allCredentials.some((e=>{let{status:t}=e;return t===s.CredentialStatus.VALID})))throw new Error(`Integration "${(0,l.getIntegrationTypeName)(t)}" not enabled for workflow."`);return n}async updateLocalState(){var e;const[t,n]=await Promise.all([this.fetchUserData(),this.fetchIntegrations()]);let i={...t.integrations};if(this.modalState.integration&&this.integrationToBeEnabled){const t=this.userState.integrations[this.integrationToBeEnabled],n=t?null===(e=i[this.integrationToBeEnabled])||void 0===e?void 0:e.allConfigurations.find((e=>{let{id:n}=e;return n===t.credentialConfigId})):void 0;n&&(i={...i,[this.integrationToBeEnabled]:{enabled:!1,allConfigurations:[],allCredentials:[],...i[this.integrationToBeEnabled],credentialConfigId:n.id,workflowSettings:n.workflowSettings,configuredWorkflows:n.workflowSettings,sharedSettings:n.sharedSettings,configMeta:n.configMeta}})}this.updateAuthenticatedUser({integrations:i,meta:t.meta,resources:t.resources}),this.updateIntegrations(n),this.saveState()}async fetchUserData(){const e=await this.sendConnectRequest("/sdk/me");if(!e)throw new Error("Unable to get user Data");return{...e,integrations:Object.fromEntries(Object.entries(e.integrations).map((e=>{let[t,n]=e;const i=n.allCredentials.flatMap((e=>{let{configurations:t}=e;return t}));return[t,{...n,allConfigurations:i}]})))}}async fetchIntegrations(){const e=await this.sendConnectRequest("/sdk/integrations");if(!e)throw new Error("Unable to fetch integrations");return e}updateIntegrations(e){e.forEach((e=>{var t,n,i;if(e.configs.length)try{const r=(0,l.getIntegrationTypeName)(e);this.loadedConfigs[r]=e.configs[0].values,this.loadedIntegrations[r]=e,Boolean(e.isActive)&&(this.metadata[r]={type:r,name:e.name,brandColor:e.brandColor,icon:null!==(n=null===(t=e.customIntegration)||void 0===t?void 0:t.icon)&&void 0!==n?n:`${this.environments.CDN_PUBLIC_URL}/integrations/${p.overrideActionAlias[e.type]||e.type}.svg`}),(null===(i=this.modalState.integration)||void 0===i?void 0:i.id)===e.id&&this.setModalState({integration:e})}catch(e){console.warn(e)}}))}async setUserMetadata(e){return await this.sendConnectRequest("/sdk/me",{method:"PATCH",body:JSON.stringify({meta:e})}),await this.updateLocalState(),this.render(),this.userState}configureGlobal(e,t){var n,i,r,o,s,a,l,d;if(!e||!e.host)throw new Error("host not specified");const c=e.host.indexOf("http")>-1?new URL(e.host).hostname:e.host;this.environments.CONNECT_PUBLIC_URL=null!==(n=null==t?void 0:t.CONNECT_PUBLIC_URL)&&void 0!==n?n:(0,_.getServiceUrl)("connect",c),this.environments.DASHBOARD_PUBLIC_URL=null!==(i=null==t?void 0:t.DASHBOARD_PUBLIC_URL)&&void 0!==i?i:(0,_.getServiceUrl)("dashboard",c),this.environments.HERMES_PUBLIC_URL=null!==(r=null==t?void 0:t.HERMES_PUBLIC_URL)&&void 0!==r?r:(0,_.getServiceUrl)("hermes",c),this.environments.PASSPORT_PRODUCTION_URL=null!==(o=null==t?void 0:t.PASSPORT_PRODUCTION_URL)&&void 0!==o?o:(0,_.getServiceUrl)("passport",c),this.environments.PASSPORT_PUBLIC_URL=null!==(s=null==t?void 0:t.PASSPORT_PUBLIC_URL)&&void 0!==s?s:(0,_.getServiceUrl)("passport",c),this.environments.ZEUS_PUBLIC_URL=null!==(a=null==t?void 0:t.ZEUS_PUBLIC_URL)&&void 0!==a?a:(0,_.getServiceUrl)("zeus",c),this.environments.CDN_PUBLIC_URL=null!==(l=null==t?void 0:t.CDN_PUBLIC_URL)&&void 0!==l?l:(0,_.getServiceUrl)("dashboard",c),this.environments.WORKER_PROXY_PUBLIC_URL=null!==(d=null==t?void 0:t.WORKER_PROXY_PUBLIC_URL)&&void 0!==d?d:(0,_.getServiceUrl)("proxy",c),this.userState.authenticated=!1,this.root?this.root.src=`${this.environments.CONNECT_PUBLIC_URL}/ui${this.projectId?`?projectId=${this.projectId}`:""}`:console.error("Root element not defined")}async completeInstall(e,t){var n;if(!this.userState.authenticated)throw new Error("Authentication is required");if(!t||!t.authorizationCode)throw new Error("authorizationCode is required");if(t.redirectUrl&&!(0,_.isValidUrl)(t.redirectUrl))throw new Error(`${t.redirectUrl} is not valid url`);this.validateAction(e);const i=Object.values(this.loadedIntegrations).find((t=>(0,l.getIntegrationTypeName)(t)===e)),r=null===(n=t.showPortalAfterInstall)||void 0===n||n,o=await this.sendConnectRequest("/sdk/credentials",{method:"POST",body:JSON.stringify({code:t.authorizationCode,integrationId:i.id,redirectUrl:t.redirectUrl?(0,_.sanitizeUrl)(t.redirectUrl):void 0,integrationOptions:t.integrationOptions||{}})});if(!o)throw new Error("Unable to create credential");this.updateCredentialData(o,i),r&&this.setModalState({integration:i,config:this.loadedConfigs[e],apiInstallationOptions:{}})}updateCredentialData(e,t){var n,i,r,o,a,d;const c=this.userState,u=(0,l.getIntegrationTypeName)(t),h=c.integrations[u],p=h.allCredentials.findIndex((t=>t.id===e.id));p>-1?h.allCredentials[p]=e:h.allCredentials.push(e);const f=Object.fromEntries((h.allConfigurations||[]).concat(e.configurations).map((e=>[e.id,e])));this.updateAuthenticatedUser({integrations:{...c.integrations,[u]:{...h,allConfigurations:Object.values(f),credentialStatus:e.status,enabled:e.status===s.CredentialStatus.VALID,credentialId:e.id,providerId:e.providerId,providerData:e.providerData,configMeta:null===(n=e.configurations[0])||void 0===n?void 0:n.configMeta,credentialConfigId:null===(i=e.configurations[0])||void 0===i?void 0:i.id,externalId:null===(r=e.configurations[0])||void 0===r?void 0:r.externalId,sharedSettings:null===(o=e.configurations[0])||void 0===o?void 0:o.sharedSettings,workflowSettings:null===(a=e.configurations[0])||void 0===a?void 0:a.workflowSettings,configuredWorkflows:null===(d=e.configurations[0])||void 0===d?void 0:d.workflowSettings}}})}async connectAction(e,t){var n;if(!this.userState.authenticated)throw new Error("User not authenticated, Call paragon.authenticate(<projectId>, <user token>) before using the SDK.");const i=null===(n=this.userState.resources.find((t=>e===t.slug)))||void 0===n?void 0:n.id;if(!i)throw new Error(`No resource found with name "${e}".`);if(!t||"object"!=typeof t)throw new Error("payload must be of type object.");const r=await this.sendConnectRequest(`/sdk/resources/${i}/connect`,{method:"POST",body:JSON.stringify(t)});if(!r)throw new Error(`Unable to connect to "${e}".`);return r}async createConfiguration(e){let{credentialId:t,externalId:n}=e;var i,r;if(!this.userState.authenticated)throw new Error("User not authenticated, Call paragon.authenticate(<projectId>, <user token>) before using the SDK.");if(!t)throw new Error('Required options not provided: "credentialId"');const o=this.getCredentialAndConfig({selectedCredentialId:t});if(!o||(null==o?void 0:o.selectedCredential.status)!==s.CredentialStatus.VALID)throw new Error("Valid credential not found for provided options.");const a=await this.sendConnectRequest(`/sdk/credentials/${t}/configurations`,{method:"POST",body:JSON.stringify(n?{externalId:n}:{})});if(!a)throw new Error("Unable to create a configuration for credential.");const l=Object.keys(this.userState.integrations).find((e=>{var t;return null===(t=this.userState.integrations[e])||void 0===t?void 0:t.allCredentials.find((e=>{let{id:t}=e;return t===a.id}))}));if(l){const e=null===(i=this.userState.integrations[l])||void 0===i?void 0:i.allConfigurations.filter((e=>{let{connectCredentialId:t}=e;return t!==a.id})).concat(a.configurations),t=null===(r=this.userState.integrations[l])||void 0===r?void 0:r.allCredentials.map((e=>e.id===a.id?a:e)),n={...this.userState.integrations,[l]:{enabled:!1,...this.userState.integrations[l],allConfigurations:e||[],allCredentials:t||[]}};this.updateAuthenticatedUser({integrations:n})}return a.configurations.sort(((e,t)=>new Date(t.dateCreated).getTime()-new Date(e.dateCreated).getTime()))[0]}async destroyConfiguration(e){let{id:t,credentialId:n}=e;var i,r,o,s;if(!this.userState.authenticated)throw new Error("User not authenticated, Call paragon.authenticate(<projectId>, <user token>) before using the SDK.");if(!(null==t?void 0:t.trim())||!(null==n?void 0:n.trim()))throw new Error("One or more required options not provided.");const a=this.getCredentialAndConfig({selectedConfigurationId:t,selectedCredentialId:n});if(!a)throw new Error(`Unable to find credential for configuration: ${t}.`);if(a.selectedConfig.isDefault)throw new Error("Cannot delete default configuration.");await this.sendConnectRequest(`/sdk/credentials/${a.selectedCredential.id}/configurations`,{method:"DELETE",headers:{[p.SELECTED_CREDENTIAL_ID_HEADER]:null==a?void 0:a.selectedCredential.id,[p.SELECTED_CREDENTIAL_CONFIG_ID_HEADER]:null==a?void 0:a.selectedConfig.id}});const l=Object.keys(this.userState.integrations).find((e=>{var t;return null===(t=this.userState.integrations[e])||void 0===t?void 0:t.allCredentials.find((e=>{let{id:t}=e;return t===a.selectedCredential.id}))}));if(l){const{selectedConfig:e,selectedCredential:t}=a,n=null===(i=this.userState.integrations[l])||void 0===i?void 0:i.allConfigurations.filter((t=>{let{id:n}=t;return n!==e.id})),d=null===(r=this.userState.integrations[l])||void 0===r?void 0:r.allCredentials.map((n=>n.id!==t.id?n:{...n,configurations:n.configurations.filter((t=>{let{id:n}=t;return n!==e.id}))})),c={...this.userState.integrations,[l]:{enabled:!1,...this.userState.integrations[l],allConfigurations:n||[],allCredentials:d||[]}};this.updateAuthenticatedUser({integrations:c}),(null===(o=this.userState.integrations[l])||void 0===o?void 0:o.credentialId)===t.id&&(null===(s=this.userState.integrations[l])||void 0===s?void 0:s.credentialConfigId)===e.id&&this.closePortal()}}async updateConfiguration(e){let{id:t,credentialId:n,meta:i={}}=e;var r,o;if(!this.userState.authenticated)throw new Error("User not authenticated, Call paragon.authenticate(<projectId>, <user token>) before using the SDK.");if(!(null==t?void 0:t.trim())||!(null==n?void 0:n.trim()))throw new Error("One or more required options not provided.");const s=this.getCredentialAndConfig({selectedConfigurationId:t,selectedCredentialId:n});if(!(null==s?void 0:s.selectedConfig))throw new Error(`Cannot find credential configuration with given id: "${t}"`);const a=await this.sendConnectRequest(`/sdk/credentials/${s.selectedConfig.connectCredentialId}/configurations`,{method:"PATCH",body:JSON.stringify({meta:i}),headers:{[p.SELECTED_CREDENTIAL_ID_HEADER]:s.selectedCredential.id,[p.SELECTED_CREDENTIAL_CONFIG_ID_HEADER]:s.selectedConfig.id}});if(!a)throw new Error("Unable to update configuration.");const l=Object.keys(this.userState.integrations).find((e=>{var t;return null===(t=this.userState.integrations[e])||void 0===t?void 0:t.allCredentials.find((e=>{let{id:t}=e;return t===a.id}))}));if(l){const e=null===(r=this.userState.integrations[l])||void 0===r?void 0:r.allConfigurations.filter((e=>{let{connectCredentialId:t}=e;return t!==a.id})).concat(a.configurations),t=null===(o=this.userState.integrations[l])||void 0===o?void 0:o.allCredentials.map((e=>e.id===a.id?a:e)),n={...this.userState.integrations,[l]:{enabled:!1,...this.userState.integrations[l],allConfigurations:e||[],allCredentials:t||[]}};this.updateAuthenticatedUser({integrations:n})}const d=a.configurations.find((e=>{let{id:t}=e;return t===s.selectedConfig.id}));return d}async pollForCredential(e){const t=Date.now(),n=async()=>{try{return await this.sendConnectRequest(`/sdk/actions/session-id/${e}`,{method:"GET"})}catch(e){return console.error("error",e),null}};try{const e=await(0,E.tryUntil)(n,(function(e,n){return!((arguments.length>2&&void 0!==arguments[2]?arguments[2]:1)>=20||Date.now()-t>=u.MAX_POLL_DURATION||(null==e?void 0:e.connectCredentialId))}),u.CREDENTIAL_POLL_INTERVAL);e&&e.connectCredentialId&&this.updateLocalState()}catch(e){console.error("Error while connecting to integration",e)}finally{await this.sendConnectRequest(`/sdk/actions/session-id/${e}`,{method:"DELETE"})}}}t.default=O},9892:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3821);t.default=class{constructor(){this.eventListenersMap={},this.integrationStateCallbacks={}}subscribe(e,t){var n;if(this.assertEventType(e),"function"!=typeof t)throw new Error(`no listener is provided for ${e}`);return this.eventListenersMap={...this.eventListenersMap,[e]:[...null!==(n=this.eventListenersMap[e])&&void 0!==n?n:[],t]},()=>this.unsubscribe(e,t)}subscribeToIntegration(e,t){this.integrationStateCallbacks[e]={...t}}unsubscribe(e,t){var n,i;if(this.assertEventType(e),"function"!=typeof t)throw new Error("listener is required for unsubscription");const r=(null!==(n=this.eventListenersMap[e])&&void 0!==n?n:[]).length;return this.eventListenersMap={...this.eventListenersMap,[e]:(null!==(i=this.eventListenersMap[e])&&void 0!==i?i:[]).filter((e=>e!==t))},r>this.eventListenersMap[e].length}assertEventType(e){if(!Object.values(i.SDK_EVENT).includes(e))throw new Error(`${e} is not valid paragon event`)}emitSafe(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];var r;(null!==(r=this.eventListenersMap[e])&&void 0!==r?r:[]).forEach((e=>{try{e(...n)}catch(e){console.error(e)}}))}emitError(e,t){this.invokeCallbackSafe(t,"onError",e)}invokeCallbackSafe(e,t){var n,i;try{for(var r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];null===(i=null===(n=this.integrationStateCallbacks[e])||void 0===n?void 0:n[t])||void 0===i||i.call(n,...o)}catch(e){console.error(e)}}triggerEvent(e,t){let{type:n,integrationId:r,integrationType:o,workflowId:s,workflowStateChange:a}=e;if(r&&o)switch(n){case i.SDK_EVENT.ON_INTEGRATION_INSTALL:{const e=[{integrationId:r,integrationType:o},t];this.invokeCallbackSafe(o,"onInstall",...e),this.emitSafe(i.SDK_EVENT.ON_INTEGRATION_INSTALL,...e);break}case i.SDK_EVENT.ON_INTEGRATION_UNINSTALL:{const e=[{integrationId:r,integrationType:o},t];this.invokeCallbackSafe(o,"onUninstall",...e),this.emitSafe(i.SDK_EVENT.ON_INTEGRATION_UNINSTALL,...e);break}case i.SDK_EVENT.ON_PORTAL_OPEN:{const e=[{integrationId:r,integrationType:o},t];this.invokeCallbackSafe(o,"onOpen",...e),this.emitSafe(i.SDK_EVENT.ON_PORTAL_OPEN,...e);break}case i.SDK_EVENT.ON_PORTAL_CLOSE:{const e=[{integrationId:r,integrationType:o},t];this.invokeCallbackSafe(o,"onClose",...e),this.emitSafe(i.SDK_EVENT.ON_PORTAL_CLOSE,...e);break}case i.SDK_EVENT.ON_WORKFLOW_CHANGE:{const e=[{integrationId:r,workflowId:s,workflowStateChange:a||{}},t];this.invokeCallbackSafe(o,"onWorkflowChange",...e),this.emitSafe(i.SDK_EVENT.ON_WORKFLOW_CHANGE,...e);break}default:throw new Error(`${n} is not valid event.`)}}}},3931:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BYO_USER_PROFILE_ERROR_CODE=t.BYO_CREDENTIAL_VERIFICATION_ERROR=t.INSUFFICIENT_PERMISSION=t.ACTION_CUSTOM=void 0,t.ACTION_CUSTOM="custom",t.INSUFFICIENT_PERMISSION="7210",t.BYO_CREDENTIAL_VERIFICATION_ERROR="7003",t.BYO_USER_PROFILE_ERROR_CODE="0704"},4059:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CredentialStatus=void 0,function(e){e.PENDING="PENDING",e.INVALID="INVALID",e.VALID="VALID"}(t.CredentialStatus||(t.CredentialStatus={}))},745:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AuthenticationScheme=void 0,function(e){e.BASIC="basic",e.OAUTH="oauth",e.OAUTH_CLIENT_CREDENTIAL="oauth_client_credential",e.SERVICE_ACCOUNT="service_account",e.OAUTH_APP="oauth_app",e.IMPERSONATED_APP="impersonated_app"}(t.AuthenticationScheme||(t.AuthenticationScheme={}))},1663:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateSlugForIntegration=void 0,t.generateSlugForIntegration=function(e){if(!e.name)return;return`custom.${e.name?e.name.replace(/[\W_]+/g,"").trim().toLowerCase():void 0}`}},7343:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isCustomIntegrationTypeName=t.getIntegrationTypeName=void 0;const i=n(3931),r=n(1663);t.getIntegrationTypeName=function(e){if(e.type===i.ACTION_CUSTOM){if(e.customIntegration)return(0,r.generateSlugForIntegration)(e.customIntegration);throw new Error(`Custom integration details are missing from this integration: ${e.id}`)}return e.type},t.isCustomIntegrationTypeName=function(e){return e.startsWith("custom.")}},9845:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MicrosoftPicker=void 0;const i=n(3821),r=n(7473);class o extends r.BaseFilePicker{constructor(e,t){super(e,t),this.options=e,this.connectSDKInstance=t,this.accessToken="",this.baseUrl=""}getInstance(){return null}open(){var e,t;return this.dependencyStatus===i.FilePickerStatus.LOADED&&(null===(t=(e=this.options).onOpen)||void 0===t||t.call(e),this.launchPicker(this.getPickerOptions()),!0)}async initPicker(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"https://alcdn.msauth.net/browser/2.19.0/js/msal-browser.min.js";var r;this.dependencyStatus=i.FilePickerStatus.LOADING,this.initOptions=e;const o=await this.connectSDKInstance.getIntegrationAccount(t,{includeAccountAuth:!0});return this.accessToken=o.accountAuth[(null===(r=i.AUTH_TOKEN_ALLOWED_INTEGRATIONS[t])||void 0===r?void 0:r.accessTokenPath)||""],this.baseUrl=this.getUrl(o,t),this.initialiseDependencyPromise(),this.injectScript(n),this.dependenciesPromise}onScriptLoaded(){this.dependencyStatus=i.FilePickerStatus.LOADED,this.dependenciesPromise.resolve(!0)}onScriptError(){this.dependencyStatus=i.FilePickerStatus.FAILED,this.dependenciesPromise.reject(new Error("Failed to load dependencies"))}combinePaths(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.map((e=>e.replace(/^[/\\]+|[/\\]+$/g,""))).join("/").replace(/\\/g,"/")}async launchPicker(e){if(!this.accessToken)throw new Error("Access Token is not set! Please re-authenticate your account.");const t={sdk:"8.0",entry:e.entry,search:{enabled:!0},messaging:{origin:window.location.origin,channelId:`X-PARAGON-CHANNEL-${Date.now()}`},selection:{mode:this.options.allowMultiSelect?"multiple":"single"},typesAndSources:{mode:"boolean"==typeof this.options.allowFolderSelect?this.options.allowFolderSelect?"folders":"files":"all",filters:this.options.allowedTypes,pivots:e.pivots}},n=new URLSearchParams({filePicker:JSON.stringify(t)}).toString(),i=`${this.getPickerUrl(this.baseUrl)}?${n}`,r=window.open("","Picker","width=800,height=600,left=100,top=150");if(!r)throw new Error("Failed to open picker window.");const o=r.document.createElement("form");o.setAttribute("action",i),o.setAttribute("method","POST");const s=r.document.createElement("input");s.setAttribute("type","hidden"),s.setAttribute("name","access_token"),s.setAttribute("value",this.accessToken),o.appendChild(s),r.document.body.appendChild(o),o.submit(),this.setupMessageListener(r,t.messaging.channelId)}initializePort(e,t){e.addEventListener("message",(async n=>{const{type:i,data:r,id:o}=n.data;if("command"===i){const{command:n}=r;this.handlePickerCommand({command:n,id:o,items:r.items},t,e)}})),e.start(),e.postMessage({type:"activate"})}setupMessageListener(e,t){window.addEventListener("message",(n=>{var i;if(n.source===e&&(null===(i=n.data)||void 0===i?void 0:i.channelId)===t){const{type:t,data:i}=n.data;switch(t){case"initialize":const r=n.ports[0];this.initializePort(r,e);break;case"command":this.handlePickerCommand(i,e);break;default:console.warn("Unknown message type:",t)}}}))}handlePickerCommand(e,t,n){var i,r,o,s,a,l;const{command:d,id:c,items:u}=e;switch(d){case"close":null===(r=(i=this.options).onClose)||void 0===r||r.call(i),t.close();break;case"pick":null==n||n.postMessage({type:"result",id:c,data:{result:"success"}}),null===(s=(o=this.options).onFileSelect)||void 0===s||s.call(o,u),null===(l=(a=this.options).onClose)||void 0===l||l.call(a),t.close();break;default:null==n||n.postMessage({type:"error",id:c,data:{message:"Unsupported command",command:d}})}}}t.MicrosoftPicker=o},9008:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BoxFilePicker=void 0;const i=n(3821),r=n(7473),o={version:"21.0.0",scriptUrl:"https://cdn01.boxcdn.net/platform/elements/21.0.0/en-US/picker.js",cssUrl:"https://cdn01.boxcdn.net/platform/elements/21.0.0/en-US/picker.css",containerClass:"picker",containerStyles:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",height:"80%",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:"9999",display:"flex",alignItems:"center",justifyContent:"center"},iframeStyles:{width:"90%",height:"800px",border:"none",backgroundColor:"white",boxShadow:"0 0 10px rgba(0,0,0,0.2)",borderRadius:"8px",maxHeight:"90vh",maxWidth:"90vw",margin:"auto"},pickerOptions:{maxSelectable:1,canUpload:!0,canCreateNewFolder:!0,canSetShareAccess:!0,canDownload:!0,canDelete:!1,canRename:!1,canPreview:!0,canComment:!1,canShare:!0,canMove:!1,canCopy:!0}};class s extends r.BaseFilePicker{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super(e,t),this.accessToken="",this.config={...o,...n}}getInstance(){var e;if(!this.instance){const t=window;if(!(null===(e=t.Box)||void 0===e?void 0:e.FilePicker))throw new Error("Box script is not loaded yet. Please wait for initialization to complete.");const n=new t.Box.FilePicker({container:`.${this.config.containerClass}`});if(!n)throw new Error("Failed to create Box FilePicker instance");this.instance=n,this.setupEventListeners()}return this.instance}setupEventListeners(){var e=this;if(!this.instance)return;const t={choose:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];var n,i;null===(i=(n=e.options).onFileSelect)||void 0===i||i.call(n,t),e.cleanup()},cancel:()=>{var e,t;null===(t=(e=this.options).onCancel)||void 0===t||t.call(e),this.cleanup()},close:()=>{var e,t;null===(t=(e=this.options).onClose)||void 0===t||t.call(e),this.cleanup()}};Object.entries(t).forEach((e=>{let[t,n]=e;var i;null===(i=this.instance)||void 0===i||i.addListener(t,n)}))}cleanup(){var e;this.instance&&(this.instance.removeAllListeners(),null===(e=document.querySelector(`.${this.config.containerClass}`))||void 0===e||e.remove())}createPickerContainer(){if(document.querySelector(`.${this.config.containerClass}`))return;const e=document.createElement("div");e.className=this.config.containerClass,Object.entries(this.config.containerStyles).forEach((t=>{let[n,i]=t;e.style[n]=i}));const t=document.createElement("iframe");t.id="box-picker-iframe",Object.entries(this.config.iframeStyles).forEach((e=>{let[n,i]=e;t.style[n]=i})),e.appendChild(t),document.body.appendChild(e)}injectCSS(e){const t=document.createElement("link");t.rel="stylesheet",t.href=e,document.head.appendChild(t)}open(){var e,t,n;if(this.dependencyStatus===i.FilePickerStatus.LOADED)try{this.instance=void 0;const i=this.getInstance();if(i){const r={...this.config.pickerOptions,container:`.${this.config.containerClass}`,maxSelectable:this.options.allowMultiSelect?void 0:1,extensions:this.options.allowedTypes,canSelectFolder:this.options.allowFolderSelect,...(null===(e=this.options.integrationOptions)||void 0===e?void 0:e.box)||{}};if(this.createPickerContainer(),this.initOptions.folderId)return i.show(this.initOptions.folderId,this.accessToken,r),null===(n=(t=this.options).onOpen)||void 0===n||n.call(t),!0}}catch(e){return!1}return!1}async init(e){this.dependencyStatus=i.FilePickerStatus.LOADING,await this.validateInitOptions(e,[["folderId","Folder ID"]]),this.initOptions={...e};const t=await this.connectSDKInstance.getIntegrationAccount("box",{includeAccountAuth:!0}),{accessTokenPath:n=""}=i.AUTH_TOKEN_ALLOWED_INTEGRATIONS.box;return this.accessToken=t.accountAuth[n],this.initialiseDependencyPromise(),this.injectCSS(this.config.cssUrl),this.injectScript(this.config.scriptUrl),this.dependenciesPromise}async launch(){this.dependencyStatus!==i.FilePickerStatus.LOADED&&await this.init(this.initOptions),this.open()}onScriptLoaded(){this.dependencyStatus=i.FilePickerStatus.LOADED,this.instance=void 0,this.dependenciesPromise.resolve(!0)}onScriptError(){this.dependencyStatus=i.FilePickerStatus.FAILED,this.dependenciesPromise.reject(new Error("Failed to load Box script"))}}t.BoxFilePicker=s},9950:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GoogleDriveFilePicker=void 0;const i=n(3821),r=n(7473);class o extends r.BaseFilePicker{constructor(e,t){super(e,t),this.accessToken=""}get google(){return window.google}getInstance(){var e;return null!==(e=this.instance)&&void 0!==e?e:null}open(){var e,t;return!(this.dependencyStatus!==i.FilePickerStatus.LOADED||!this.instance)&&(this.instance.setVisible(!0),null===(t=(e=this.options).onOpen)||void 0===t||t.call(e),!0)}async init(e){this.dependencyStatus=i.FilePickerStatus.LOADING,await this.validateInitOptions(e,[["developerKey","developer key"]]),this.initOptions={...e};const t=await this.connectSDKInstance.getIntegrationAccount("googledrive",{includeAccountAuth:!0}),{accessTokenPath:n=""}=i.AUTH_TOKEN_ALLOWED_INTEGRATIONS.googledrive;return this.accessToken=t.accountAuth[n],this.initialiseDependencyPromise(),this.injectScript("https://apis.google.com/js/api.js"),this.dependenciesPromise}onScriptLoaded(){this.dependencyStatus=i.FilePickerStatus.LOADED,window.gapi.load("picker",this.onPickerLoaded.bind(this))}onScriptError(){this.dependencyStatus=i.FilePickerStatus.FAILED,this.dependenciesPromise.reject(new Error("Not able to load dependencies"))}onPickerLoaded(){var e,t,n,i,r;const o=new this.google.picker.PickerBuilder,s=new this.google.picker.DocsView;if((null===(e=this.initOptions)||void 0===e?void 0:e.appId)&&o.setAppId(this.initOptions.appId),this.options.allowMultiSelect&&o.enableFeature(this.google.picker.Feature.MULTISELECT_ENABLED),this.options.allowFolderSelect&&(s.setIncludeFolders(!0),s.setSelectFolderEnabled(!0)),this.options.allowedTypes&&this.options.allowedTypes.length>0&&s.setMimeTypes(this.options.allowedTypes.join(",")),(null===(n=null===(t=this.options.integrationOptions)||void 0===t?void 0:t.googledrive)||void 0===n?void 0:n.viewMode)&&s.setMode(this.options.integrationOptions.googledrive.viewMode),(null===(r=null===(i=this.options.integrationOptions)||void 0===i?void 0:i.googledrive)||void 0===r?void 0:r.includeFolders)&&s.setIncludeFolders(!0),!this.initOptions.developerKey)throw new Error("Please provide a valid developer key");const a=o.addView(s).setOAuthToken(this.accessToken).setDeveloperKey(this.initOptions.developerKey).setCallback(this.pickerCallback.bind(this));this.initOptions.appId&&a.setAppId(this.initOptions.appId),this.instance=a.build(),this.dependenciesPromise.resolve(!0)}pickerCallback(e){var t,n,i,r,o,s;const{action:a,...l}=e;switch(a){case this.google.picker.Action.PICKED:null===(n=(t=this.options).onFileSelect)||void 0===n||n.call(t,l),null===(r=(i=this.options).onClose)||void 0===r||r.call(i);break;case this.google.picker.Action.CANCEL:null===(s=(o=this.options).onCancel)||void 0===s||s.call(o)}}}t.GoogleDriveFilePicker=o},1698:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9008),r=n(9950),o=n(6128),s=n(8737);t.default={BoxFilePicker:i.BoxFilePicker,GoogleDriveFilePicker:r.GoogleDriveFilePicker,OneDriveFilePicker:o.OneDriveFilePicker,SharepointFilePicker:s.SharepointFilePicker}},6128:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OneDriveFilePicker=void 0;const i=n(3821),r=n(9845);class o extends r.MicrosoftPicker{constructor(){super(...arguments),this.integrationName="onedrive",this.personalAccountUrl="https://onedrive.live.com"}async init(e){return super.initPicker(e,this.integrationName)}getPickerUrl(e){return e?e.includes(this.personalAccountUrl)?`${e}/picker`:this.combinePaths(e,"_layouts/15/FilePicker.aspx"):`${this.personalAccountUrl}/picker`}getIntegrationName(){return this.integrationName}getUrl(e,t){return e.accountAuth[i.AUTH_TOKEN_ALLOWED_INTEGRATIONS[t].domain||""]}getPickerOptions(){return{entry:{oneDrive:{files:{fallbackToRoot:!0}}},pivots:{oneDrive:!0,recent:!0,shared:!0}}}}t.OneDriveFilePicker=o},8737:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SharepointFilePicker=void 0;const i=n(8321),r=n(9845);class o extends r.MicrosoftPicker{constructor(){super(...arguments),this.integrationName="sharepoint"}async init(e){return super.initPicker(e,this.integrationName)}getIntegrationName(){return this.integrationName}getPickerUrl(e){return this.combinePaths(e,"_layouts/15/FilePicker.aspx")}getUrl(e){var t;return(0,i.sanitizeUrl)(null===(t=e.providerData)||void 0===t?void 0:t.webUrl)}getPickerOptions(){return{entry:{sharePoint:{byPath:{list:`${this.baseUrl}/Shared Documents`,fallbackToRoot:!0}}},pivots:{shared:!0,oneDrive:!1,sharedLibraries:!0,site:!0}}}}t.SharepointFilePicker=o},7473:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseFilePicker=void 0;const i=n(2643),r=n(572);t.BaseFilePicker=class{constructor(e,t){this.options=e,this.connectSDKInstance=t}initialiseDependencyPromise(){this.dependenciesPromise=new r.DeferredPromise}getInstance(){return this.instance}injectScript(e){if(this.checkIfScriptLoaded(e))this.onScriptLoaded();else{const t=document.createElement("script");t.src=e,t.async=!0,t.id=e,t.onload=this.onScriptLoaded.bind(this),t.onerror=this.onScriptError.bind(this),document.body.appendChild(t)}}checkIfScriptLoaded(e){const t=document.getElementsByTagName("script");for(let n=0;n<t.length;n++)if(t[n].getAttribute("src")==e)return!0;return!1}async validateInitOptions(e,t){for(const[n,r]of t)if(!e||(0,i.isStringEmpty)(e[n]))throw new Error(`Please provide a valid ${r}`);return!0}}},4731:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.buildExternalFilePickerInstance=void 0;const i=n(655).__importDefault(n(1698));class r{constructor(e,t,n){const i=this.createFilePicker(e,t,n);this.open=this.open.bind(i),this.init=this.init.bind(i),this.getInstance=this.getInstance.bind(i)}createFilePicker(e,t,n){const r={box:i.default.BoxFilePicker,googledrive:i.default.GoogleDriveFilePicker,onedrive:i.default.OneDriveFilePicker,sharepoint:i.default.SharepointFilePicker}[e];if(!r)throw new Error(`${e}'s file picker is not supported`);return new r(t,n)}open(){return this.open()}init(e){return this.init(e)}getInstance(){return this.getInstance()}}t.default=r;t.buildExternalFilePickerInstance=e=>function(t,n){if(!e.getUser().authenticated)throw new Error("Authentication is required");if(!t)throw new Error("Missing argument: Integration type is required");return e.validateAction(t),new r(t,n,e)}},7050:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.buildExternalFilePickerInstance=t.ExternalFilePicker=void 0;var r=n(4731);Object.defineProperty(t,"ExternalFilePicker",{enumerable:!0,get:function(){return i(r).default}}),Object.defineProperty(t,"buildExternalFilePickerInstance",{enumerable:!0,get:function(){return r.buildExternalFilePickerInstance}})},2643:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findSelectedAccountType=t.isStringEmpty=t.getActionStateForCredentialDelete=t.stripUndefinedAndNull=t.parseKeyedSource=void 0;const i=n(4059);t.parseKeyedSource=function(e){return e&&(null==e?void 0:e.length)?Object.fromEntries(e.map((e=>[e.key,"VALUE"===e.source.type?e.source.value:void 0]))):{}},t.stripUndefinedAndNull=function e(t){const n={};return Object.keys(t).forEach((i=>{var r;(r=t[i])&&"object"==typeof r&&!Array.isArray(r)?n[i]=e(t[i]):void 0!==t[i]&&null!==t[i]&&(n[i]=t[i])})),n};t.getActionStateForCredentialDelete=(e,t)=>{var n,r;const o=(null!==(n=null==t?void 0:t.allCredentials)&&void 0!==n?n:[]).filter((t=>t.id!==e)),s=(null!==(r=null==t?void 0:t.allConfigurations)&&void 0!==r?r:[]).filter((t=>t.connectCredentialId!==e));if(0===o.length)return{enabled:!1,workflowSettings:{},allCredentials:[],allConfigurations:[]};{const e=o[0];return{...t,credentialStatus:e.status,enabled:e.status===i.CredentialStatus.VALID,credentialId:e.id,providerId:e.providerId,providerData:e.providerData,allCredentials:o,allConfigurations:s}}};t.isStringEmpty=e=>!e||"string"==typeof e&&!e.trim();t.findSelectedAccountType=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(t)return e.find((e=>{let{id:n}=e;return n===t}));if(1===n.length)return e.find((e=>{let{id:t}=e;return n.includes(t)}));if(!t&&!n.length&&Array.isArray(e)&&2===e.length){const[t,n]=e;return"default"===t.id&&"user-configured-oauth"===n.id?t:void 0}}},4429:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.startOAuthFlow=t.MAX_POLL_DURATION=t.CREDENTIAL_POLL_INTERVAL=void 0;const i=n(3931),r=n(7343),o=n(2643);t.CREDENTIAL_POLL_INTERVAL=3e3,t.MAX_POLL_DURATION=6e4;t.startOAuthFlow=(e,t)=>{let{context:n,integration:s,endUserSuppliedValues:a={},authParams:l,isPreviewMode:d=!1,installOptions:c={}}=e;var u;const h=(0,r.getIntegrationTypeName)(s);if(!h)return;const p=l?(0,o.parseKeyedSource)(l):{},f=(0,o.stripUndefinedAndNull)({action:h&&(0,r.isCustomIntegrationTypeName)(h)?i.ACTION_CUSTOM:h,endUserSuppliedValues:JSON.stringify(a),parameters:JSON.stringify(p),userToken:n.user.token,integrationId:s.id,redirectUrl:null===(u=n.endUserIntegrationConfig)||void 0===u?void 0:u.overrideRedirectUrl,originForPostMessage:window.location.origin,isPreviewMode:d,installOptions:JSON.stringify(c),sessionId:t}),g=`${n.environments.ZEUS_PUBLIC_URL}/projects/${n.projectId}/sdk/actions/build-oauth?${new URLSearchParams(f).toString()}`;return window.open(g,void 0,"width=500,height=600,left=100,top=150")}},2992:(e,t)=>{"use strict";var n,i,r;Object.defineProperty(t,"__esModule",{value:!0}),t.AUTH_TOKEN_ALLOWED_INTEGRATIONS=t.overrideActionAlias=t.TokenType=t.SidebarInputType=void 0,function(e){e.Auth="AUTH",e.Enum="ENUM",e.DynamicEnum="DYNAMIC_ENUM",e.Intent="INTENT",e.Text="TEXT",e.TextArea="TEXTAREA",e.ValueText="TEXT_NO_VARS",e.ValueTextArea="TEXTAREA_NO_VARS",e.Code="CODE",e.ActionButton="ACTION_BUTTON",e.Conditional="CONDITIONAL",e.DynamicConditional="DYNAMIC_CONDITIONAL",e.NestedList="NESTED_LIST",e.File="FILE",e.EditableDynamicEnum="EDITABLE_DYNAMIC_ENUM",e.EditableEnum="EDITABLE_ENUM",e.BooleanInput="BOOLEAN_INPUT",e.UserSuppliedCredential="USER_SUPPLIED_CREDENTIAL",e.NativeDynamicEnumInput="NATIVE_DYNAMIC_INPUT",e.TimeConstraintInput="TIME_CONSTRAINT_INPUT",e.LinesListInput="LinesListInput",e.LinesListDynamicInput="LinesListDynamicInput",e.Number="NUMBER",e.Email="EMAIL",e.URL="URL",e.EnumTextAreaPairInput="EnumTextAreaPairInput",e.FieldMapper="FIELD_MAPPER",e.ComboInput="COMBO_INPUT",e.Password="PASSWORD",e.Switch="SWITCH"}(t.SidebarInputType||(t.SidebarInputType={})),function(e){e.ACCESS_TOKEN="ACCESS_TOKEN",e.REFRESH_TOKEN="REFRESH_TOKEN",e.BOT_TOKEN="BOT_TOKEN",e.KLAVIYO_API_KEY="KLAVIYO_API_KEY",e.MARKETO_CLIENT_ID="MARKETO_CLIENT_ID",e.MARKETO_CLIENT_SECRET="MARKETO_CLIENT_SECRETI",e.MARKETO_ENDPOINT="MARKETO_ENDPOINT",e.MARKETO_IDENTITY="MARKETO_IDENTITY",e.MONDAY_API_TOKEN="MONDAY_API_TOKEN",e.ORACLE_CLOUD_URL="ORACLE_CLOUD_URL",e.ORACLE_PASSWORD="ORACLE_PASSWORD",e.ORACLE_USERNAME="ORACLE_USERNAME",e.SAGE_INTACCT_COMPANY_ID="SAGE_INTACCT_COMPANY_ID",e.SAGE_INTACCT_USER_ID="SAGE_INTACCT_USER_ID",e.SAGE_INTACCT_USER_PASSWORD="SAGE_INTACCT_USER_PASSWORD",e.SAILTHRU_COMPANY_KEY="SAILTHRU_COMPANY_KEY",e.SAILTHRU_COMPANY_SECRET="SAILTHRU_COMPANY_SECRET",e.SERVICENOW_PASSWORD="SERVICENOW_PASSWORD",e.SERVICENOW_SUBDOMAIN="SERVICENOW_SUBDOMAIN",e.SERVICENOW_USERNAME="SERVICENOW_USERNAME",e.TABLEAU_PERSONAL_ACCESS_TOKEN_NAME="TABLEAU_PERSONAL_ACCESS_TOKEN_NAME",e.TABLEAU_PERSONAL_ACCESS_TOKEN_SECRET="TABLEAU_PERSONAL_ACCESS_TOKEN_SECRET",e.TABLEAU_SERVER_NAME="TABLEAU_SERVER_NAME",e.TABLEAU_SITE_ID="TABLEAU_SITE_ID",e.TRELLO_API_KEY="TRELLO_API_KEY",e.TRELLO_API_TOKEN="TRELLO_API_TOKEN",e.WOOCOMMERCE_CONSUMER_KEY="WOOCOMMERCE_CONSUMER_KEY",e.WOOCOMMERCE_CONSUMER_SECRET="WOOCOMMERCE_CONSUMER_SECRET",e.WOOCOMMERCE_STORE_DOMAIN="WOOCOMMERCE_STORE_DOMAIN",e.WORKABLE_API_ACCESS_TOKEN="WORKABLE_API_ACCESS_TOKEN",e.WORKABLE_ACCOUNT_SUBDOMAIN="WORKABLE_ACCOUNT_SUBDOMAIN",e.ZOHO_CRM_ACCOUNTS_SERVER="ZOHO_CRM_ACCOUNTS_SERVER",e.ZOHO_CRM_API_DOMAIN="ZOHO_CRM_API_DOMAIN"}(t.TokenType||(t.TokenType={})),function(e){e.INFO="INFO",e.ERROR="ERROR",e.SUCCESS="SUCCESS"}(n||(n={})),function(e){e.NONE="NONE",e.RE_AUTHENTICATE="RE_AUTHENTICATE",e.ALERT="ALERT",e.DISPATCH="DISPATCH"}(i||(i={})),function(e){e.DYNAMIC="DYNAMIC_DATA_SOURCE",e.STATIC_ENUM="STATIC_ENUM_DATA_SOURCE",e.FIELD_MAPPER="FIELD_MAPPER_DATA_SOURCE",e.COMBO_INPUT="COMBO_INPUT_DATA_SOURCE"}(r||(r={})),t.overrideActionAlias={"monday.com":"monday","wordpress.com":"wordpress"},t.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"}}},9034:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CONNECT_PLAN_FEATURE_MAP=void 0;const i=n(471);t.CONNECT_PLAN_FEATURE_MAP={[i.BillingPlan.ConnectBasic]:[],[i.BillingPlan.ConnectPro]:[i.ConnectAddOn.CustomIntegrationBuilder,i.ConnectAddOn.HeadlessConnectPortal,i.ConnectAddOn.Monitoring,i.ConnectAddOn.UserMetadata,i.ConnectAddOn.WhiteLabeling],[i.BillingPlan.ConnectEnterprise]:[i.ConnectAddOn.CustomIntegrationBuilder,i.ConnectAddOn.DynamicFieldMapper,i.ConnectAddOn.HeadlessConnectPortal,i.ConnectAddOn.TaskHistoryAPI,i.ConnectAddOn.Monitoring,i.ConnectAddOn.RoleBasedAccessControl,i.ConnectAddOn.UserMetadata,i.ConnectAddOn.WhiteLabeling,i.ConnectAddOn.WorkflowPermission]}},1935:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SELECTED_CREDENTIAL_CONFIG_ID_HEADER=t.SELECTED_CREDENTIAL_ID_HEADER=t.INFER_CONTENT_TYPE_FROM_CONNECT_OPTIONS=void 0;const i=n(2992);i.SidebarInputType.ValueText,i.SidebarInputType.DynamicEnum,i.SidebarInputType.Enum,i.SidebarInputType.Number,i.SidebarInputType.Email,i.SidebarInputType.URL,i.SidebarInputType.FieldMapper,i.SidebarInputType.BooleanInput,i.SidebarInputType.ComboInput,i.SidebarInputType.Password,i.SidebarInputType.Switch,i.SidebarInputType.ValueTextArea;t.INFER_CONTENT_TYPE_FROM_CONNECT_OPTIONS="auto",t.SELECTED_CREDENTIAL_ID_HEADER="X-Paragon-Credential",t.SELECTED_CREDENTIAL_CONFIG_ID_HEADER="X-Paragon-Configuration-Id"},9977:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},914:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PLATFORM_ENV=t.NODE_ENV=void 0,function(e){e.PRODUCTION="production",e.DEVELOPMENT="development",e.TEST="test"}(t.NODE_ENV||(t.NODE_ENV={})),function(e){e.PRODUCTION="production",e.PRODUCTION_MIRROR_1="p-m1",e.STAGING="staging",e.STAGING_MIRROR_1="s-m1",e.DEVELOPMENT="dev",e.TEST="test",e.SANDBOX="sandbox",e.RELEASE="release",e.ENTERPRISE="enterprise"}(t.PLATFORM_ENV||(t.PLATFORM_ENV={}))},8065:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},3821:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(655);i.__exportStar(n(2992),t),i.__exportStar(n(9034),t),i.__exportStar(n(1935),t),i.__exportStar(n(9977),t),i.__exportStar(n(914),t),i.__exportStar(n(8065),t),i.__exportStar(n(9835),t),i.__exportStar(n(7750),t),i.__exportStar(n(471),t)},9835:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.DataType=void 0,function(e){e.STRING="STRING",e.NUMBER="NUMBER",e.DATE="DATE",e.BOOLEAN="BOOLEAN",e.EMAIL="EMAIL",e.OBJECT="OBJECT",e.ARRAY="ARRAY",e.ANY="ANY",e.FILE="FILE",e.NON_DECIMAL="NON_DECIMAL"}(t.DataType||(t.DataType={})),function(e){e.None="$none",e.StringContains="$stringContains",e.StringDoesNotContain="$stringDoesNotContain",e.StringExactlyMatches="$stringExactlyMatches",e.StringDoesNotExactlyMatch="$stringDoesNotExactlyMatch",e.StringIsIn="$stringIsIn",e.StringIsNotIn="$stringIsNotIn",e.StringStartsWith="$stringStartsWith",e.StringDoesNotStartWith="$stringDoesNotStartWith",e.StringEndsWith="$stringEndsWith",e.StringDoesNotEndWith="$stringDoesNotEndWith",e.NumberGreaterThan="$numberGreaterThan",e.NumberLessThan="$numberLessThan",e.NumberEquals="$numberEquals",e.NumberDoesNotEqual="$numberDoesNotEqual",e.NumberLessThanOrEqualTo="$numberLessThanOrEqualTo",e.NumberGreaterThanOrEqualTo="$numberGreaterThanOrEqualTo",e.DateTimeAfter="$dateTimeAfter",e.DateTimeBefore="$dateTimeBefore",e.DateTimeEquals="$dateTimeEquals",e.BooleanTrue="$booleanTrue",e.BooleanFalse="$booleanFalse",e.IsNotNull="$exists",e.IsNull="$doesNotExist",e.Exists="$isNotUndefinedOrNull",e.DoesNotExist="$isUndefinedOrNull",e.ArrayIsIn="$arrayIsIn",e.ArrayIsNotIn="$arrayIsNotIn",e.ArrayIsEmpty="$arrayIsEmpty",e.ArrayIsNotEmpty="$arrayIsNotEmpty",e.StringGreaterThan="$stringGreaterThan",e.StringLessThan="$stringLessThan"}(n||(n={}))},7750:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FilePickerStatus=t.DocumentLoadingState=t.SDK_EVENT=t.ModalView=void 0,function(e){e.OVERVIEW="overview",e.CONFIGURATION="configuration"}(t.ModalView||(t.ModalView={})),function(e){e.ON_INTEGRATION_INSTALL="onIntegrationInstall",e.ON_INTEGRATION_UNINSTALL="onIntegrationUninstall",e.ON_WORKFLOW_CHANGE="onWorkflowChange",e.ON_PORTAL_OPEN="onPortalOpen",e.ON_PORTAL_CLOSE="onPortalClose"}(t.SDK_EVENT||(t.SDK_EVENT={})),function(e){e.LOADING="loading",e.INTERACTIVE="interactive",e.COMPLETE="complete"}(t.DocumentLoadingState||(t.DocumentLoadingState={})),function(e){e.LOADING="loading",e.FAILED="failed",e.LOADED="loaded"}(t.FilePickerStatus||(t.FilePickerStatus={}))},471:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectAddOn=t.BillingPlan=void 0,function(e){e.ClassicFree="free",e.ClassicStarter="starter",e.ClassicBusiness="business",e.ClassicPremium="premium",e.ClassicEnterprise="enterprise",e.ConnectTrial="connect_trial",e.ConnectBasic="basic",e.ConnectPro="pro",e.ConnectEnterprise="connect_enterprise"}(t.BillingPlan||(t.BillingPlan={})),function(e){e.CustomIntegrationBuilder="byo",e.DynamicFieldMapper="dfm",e.HeadlessConnectPortal="headless-cp",e.TaskHistoryAPI="th-api",e.Monitoring="monitoring",e.RoleBasedAccessControl="rbac",e.UserMetadata="user-metadata",e.WhiteLabeling="whitelabel",e.WorkflowPermission="workflow-permissions"}(t.ConnectAddOn||(t.ConnectAddOn={}))},3158:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sanitizeExternalConfigId=t.getAssetUrl=void 0;const i=n(914);t.getAssetUrl=e=>{let{CDN_PUBLIC_URL:t,DASHBOARD_PUBLIC_URL:n,VERSION:r,PLATFORM_ENV:o,NODE_ENV:s}=e;return t&&s===i.NODE_ENV.PRODUCTION&&o!==i.PLATFORM_ENV.ENTERPRISE?`${t}/${r}/dashboard/public`:n},t.sanitizeExternalConfigId=function(e){if(e.startsWith("ext:")){return(e.split("ext:").pop()||"").trim()}return e.trim()}},4846:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hash=void 0;const i=n(3715);t.hash=function(e){return null==e?e:(0,i.sha256)().update(e).digest("hex").substr(0,10)}},572:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tryUntil=t.isUUID=t.uuidPattern=t.sleep=t.generateMatrix=t.DeferredPromise=void 0;function n(e){return new Promise((t=>setTimeout(t,e)))}t.DeferredPromise=class{get state(){return this._state}constructor(){this._state="pending",this._promise=new Promise(((e,t)=>{this._resolve=e,this._reject=t}))}then(e,t){return this._promise.then(e,t)}catch(e){return this._promise.catch(e)}resolve(e){this._resolve(e),this._state="fulfilled"}reject(e){this._reject(e),this._state="rejected"}finally(e){return null==e||e(),this._promise}},Symbol.toStringTag,t.generateMatrix=function(e,t){const n=Object.keys(e);if(n.reduce(((t,n)=>t+e[n].length),0)&&n.length)for(const t of n)e[t].length||e[t].push(void 0);const i=Object.entries(e).reduce(((e,t)=>{let[,n]=t;return e.length?e.reduce(((e,t)=>(n.forEach((n=>{const i=t.slice();i.push(n),e.push(i)}),[]),e)),[]):n.map((e=>[e]))}),[]).reduce(((e,t)=>{const i=t.reduce(((e,t,i)=>({...e,[n[i]]:t})),{});return[...e,i]}),[]);return t?i.slice(-1*t):i},t.sleep=n,t.uuidPattern=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i,t.isUUID=function(e){return"string"==typeof e&&t.uuidPattern.test(e)},t.tryUntil=async function(e,t,i){let r=0,o=!0;for(;o;){r+=1;let s=null,a=null;try{s=await e()}catch(e){a=e}if(o=await t(s,a,r),!o){if(a)throw a;return s}{const e="number"==typeof i?i:i(r);await n(e)}}throw new Error("Method unable to run: invalid retries.")}},8321:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.errorMessageParser=t.isIntegrationError=t.ProxyRequestError=t.getErrorMessage=t.getServiceUrl=t.sanitizeUrl=t.isValidUrl=void 0;function n(e){return e?e.match(/^[a-zA-Z]+:\/\//)?e:`https://${e}`:e}function i(e){return Array.isArray(e)?e.flatMap((e=>[e,i(e.children||[])].flatMap((e=>"string"==typeof e?e:i(e))))).filter((e=>e)).join(", "):Object.values(e.constraints||{}).join(", ")}t.isValidUrl=e=>{const t=n(e);try{return new globalThis.URL(t),!0}catch(e){return!1}},t.sanitizeUrl=n,t.getServiceUrl=function(e,t){return`https://${e}${`.${t}`}`},t.getErrorMessage=async function(e,n){var r,o;const s=null===(r=e.headers)||void 0===r?void 0:r.get("content-type"),a=s&&s.includes("application/json")?await e.json():null;let l;return l=a&&(0,t.isIntegrationError)(a.meta)?JSON.stringify(a.meta):a&&"string"==typeof a.message?a.message:a&&400===e.status&&Array.isArray(a.message)?i(a.message):a?JSON.stringify(a):await(null===(o=e.text)||void 0===o?void 0:o.call(e)),n?{message:l,response:a||e}:l};class r extends Error{constructor(e,t){super(e),this.name="Error",this.response=t,Object.setPrototypeOf(this,r.prototype)}}t.ProxyRequestError=r;t.isIntegrationError=e=>!("object"!=typeof e||!e)&&e.isIntegrationError,t.errorMessageParser=function(e){e="string"==typeof e?e:e.message;try{const n=JSON.parse(e);return!!(0,t.isIntegrationError)(n)}catch(e){return!1}}},3035:(e,t,n)=>{"use strict";var i,r,o,s,a=n(4155);Object.defineProperty(t,"__esModule",{value:!0}),t.CacheThrottle=t.CacheMode=void 0;const l=n(655),d=n(572);var c,u,h;!function(e){e.Debounce="debounce",e.Throttle="throttle"}(c=t.CacheMode||(t.CacheMode={})),function(e){e.Closed="closed",e.Idle="idle",e.Processing="processing"}(u||(u={})),function(e){e[e.Get=0]="Get",e[e.Set=1]="Set",e[e.GetOrSet=2]="GetOrSet",e[e.Del=3]="Del",e[e.Do=4]="Do"}(h||(h={}));t.CacheThrottle=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i.set(this,u.Idle),r.set(this,{}),o.set(this,void 0),s.set(this,[]),l.__classPrivateFieldSet(this,o,{mode:c.Debounce,ttl:0,...e},"f")}async get(e,t){const n=this.serializeKey(e),i=async()=>{const t=l.__classPrivateFieldGet(this,r,"f")[n],{mode:i,ttl:s,value:a}=null!=t?t:{};return!t||!s||i&&i!==c.Debounce||this.refreshTimeout(e,n,s),l.__classPrivateFieldGet(this,o,"f").clearPendingDeletes&&this.clearPendingDeletesOnKey(n,a),a};return t?i():this.enqueue(n,h.Get,i)}async set(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.__classPrivateFieldGet(this,o,"f").ttl,i=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;const a=this.serializeKey(e),d=async()=>{const s=l.__classPrivateFieldGet(this,r,"f")[a],d=!!s;return l.__classPrivateFieldGet(this,r,"f")[a]={...s,mode:i,ttl:n,value:t},d&&i===c.Throttle||this.refreshTimeout(e,a,n),l.__classPrivateFieldGet(this,o,"f").clearPendingDeletes&&this.clearPendingDeletesOnKey(a,t),t};return s?d():this.enqueue(a,h.Set,d)}async getOrSet(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.__classPrivateFieldGet(this,o,"f").ttl,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l.__classPrivateFieldGet(this,o,"f").mode,s=arguments.length>4?arguments[4]:void 0;const a=this.serializeKey(e),d=async()=>{if(l.__classPrivateFieldGet(this,r,"f")[a])return l.__classPrivateFieldGet(this,r,"f")[a].value;const s=await t();return await this.set(e,s,n,i,!0),l.__classPrivateFieldGet(this,o,"f").clearPendingDeletes&&this.clearPendingDeletesOnKey(a,s),s};return s?d():this.enqueue(a,h.GetOrSet,d)}async del(e){let t=arguments.length>2?arguments[2]:void 0;const n=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?e:this.serializeKey(e),i=async()=>{const e=l.__classPrivateFieldGet(this,r,"f")[n];let t;return(null==e?void 0:e.timeout)&&clearTimeout(e.timeout),e&&(t=e.value,delete l.__classPrivateFieldGet(this,r,"f")[n],await(async()=>{var e,n;return null===(n=(e=l.__classPrivateFieldGet(this,o,"f")).onDeregister)||void 0===n?void 0:n.call(e,t)})().catch((e=>{}))),t};return t?i():this.enqueue(n,h.Del,i)}keys(){return Object.keys(l.__classPrivateFieldGet(this,r,"f"))}async do(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.__classPrivateFieldGet(this,o,"f").ttl,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l.__classPrivateFieldGet(this,o,"f").mode;const s=this.serializeKey(e);return this.enqueue(s,h.Do,(async()=>{if(l.__classPrivateFieldGet(this,r,"f")[s])return l.__classPrivateFieldGet(this,r,"f")[s].value;const o=await t();return await this.set(e,o,n,i,!0)}))}async close(){l.__classPrivateFieldSet(this,i,u.Closed,"f"),await Promise.all(Object.keys(l.__classPrivateFieldGet(this,r,"f")).map((e=>this.del(e,!0,!0))))}refreshTimeout(e,t,n){if(l.__classPrivateFieldGet(this,i,"f")===u.Closed)return;const o=l.__classPrivateFieldGet(this,r,"f")[t];return n&&void 0!==(null==o?void 0:o.timeout)&&clearTimeout(o.timeout),n?(o.timeout=setTimeout((()=>this.del(e)),n),o.timeout):void 0}clearPendingDeletesOnKey(e,t){l.__classPrivateFieldSet(this,s,l.__classPrivateFieldGet(this,s,"f").filter((n=>{let[i,r,o,s]=n;return e!==i||r!==h.Del||(s.resolve(t),!1)})),"f")}serializeKey(e){var t,n,i;return null!==(i=null===(n=(t=l.__classPrivateFieldGet(this,o,"f")).serializeKey)||void 0===n?void 0:n.call(t,e))&&void 0!==i?i:e}async enqueue(e,t,n){const r=new d.DeferredPromise;return l.__classPrivateFieldGet(this,s,"f").push([e,t,n,r]),l.__classPrivateFieldGet(this,i,"f")===u.Idle&&this.flush(),r}flush(){l.__classPrivateFieldSet(this,i,u.Processing,"f"),a.nextTick((async()=>{for(;l.__classPrivateFieldGet(this,s,"f").length&&l.__classPrivateFieldGet(this,i,"f")!==u.Closed;){const e=l.__classPrivateFieldGet(this,s,"f").shift();if(e){const[,,t,n]=e;try{const e=await t();n.resolve(e)}catch(e){n.reject(e)}}}l.__classPrivateFieldSet(this,i,u.Idle,"f")}))}},i=new WeakMap,r=new WeakMap,o=new WeakMap,s=new WeakMap},3715:(e,t,n)=>{var i=t;i.utils=n(6436),i.common=n(5772),i.sha=n(9041),i.ripemd=n(2949),i.hmac=n(2344),i.sha1=i.sha.sha1,i.sha256=i.sha.sha256,i.sha224=i.sha.sha224,i.sha384=i.sha.sha384,i.sha512=i.sha.sha512,i.ripemd160=i.ripemd.ripemd160},5772:(e,t,n)=>{"use strict";var i=n(6436),r=n(9746);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=o,o.prototype.update=function(e,t){if(e=i.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=i.join32(e,0,e.length-n,this.endian);for(var r=0;r<e.length;r+=this._delta32)this._update(e,r,r+this._delta32)}return this},o.prototype.digest=function(e){return this.update(this._pad()),r(null===this.pending),this._digest(e)},o.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,n=t-(e+this.padLength)%t,i=new Array(n+this.padLength);i[0]=128;for(var r=1;r<n;r++)i[r]=0;if(e<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)i[r++]=0;i[r++]=0,i[r++]=0,i[r++]=0,i[r++]=0,i[r++]=e>>>24&255,i[r++]=e>>>16&255,i[r++]=e>>>8&255,i[r++]=255&e}else for(i[r++]=255&e,i[r++]=e>>>8&255,i[r++]=e>>>16&255,i[r++]=e>>>24&255,i[r++]=0,i[r++]=0,i[r++]=0,i[r++]=0,o=8;o<this.padLength;o++)i[r++]=0;return i}},2344:(e,t,n)=>{"use strict";var i=n(6436),r=n(9746);function o(e,t,n){if(!(this instanceof o))return new o(e,t,n);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(i.toArray(t,n))}e.exports=o,o.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),r(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},o.prototype.update=function(e,t){return this.inner.update(e,t),this},o.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}},2949:(e,t,n)=>{"use strict";var i=n(6436),r=n(5772),o=i.rotl32,s=i.sum32,a=i.sum32_3,l=i.sum32_4,d=r.BlockHash;function c(){if(!(this instanceof c))return new c;d.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function u(e,t,n,i){return e<=15?t^n^i:e<=31?t&n|~t&i:e<=47?(t|~n)^i:e<=63?t&i|n&~i:t^(n|~i)}function h(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function p(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}i.inherits(c,d),t.ripemd160=c,c.blockSize=512,c.outSize=160,c.hmacStrength=192,c.padLength=64,c.prototype._update=function(e,t){for(var n=this.h[0],i=this.h[1],r=this.h[2],d=this.h[3],c=this.h[4],v=n,I=i,S=r,C=d,O=c,y=0;y<80;y++){var m=s(o(l(n,u(y,i,r,d),e[f[y]+t],h(y)),E[y]),c);n=c,c=d,d=o(r,10),r=i,i=m,m=s(o(l(v,u(79-y,I,S,C),e[g[y]+t],p(y)),_[y]),O),v=O,O=C,C=o(S,10),S=I,I=m}m=a(this.h[1],r,C),this.h[1]=a(this.h[2],d,O),this.h[2]=a(this.h[3],c,v),this.h[3]=a(this.h[4],n,I),this.h[4]=a(this.h[0],i,S),this.h[0]=m},c.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"little"):i.split32(this.h,"little")};var f=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],g=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],E=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],_=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},9041:(e,t,n)=>{"use strict";t.sha1=n(4761),t.sha224=n(799),t.sha256=n(9344),t.sha384=n(772),t.sha512=n(5900)},4761:(e,t,n)=>{"use strict";var i=n(6436),r=n(5772),o=n(7038),s=i.rotl32,a=i.sum32,l=i.sum32_5,d=o.ft_1,c=r.BlockHash,u=[1518500249,1859775393,2400959708,3395469782];function h(){if(!(this instanceof h))return new h;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}i.inherits(h,c),e.exports=h,h.blockSize=512,h.outSize=160,h.hmacStrength=80,h.padLength=64,h.prototype._update=function(e,t){for(var n=this.W,i=0;i<16;i++)n[i]=e[t+i];for(;i<n.length;i++)n[i]=s(n[i-3]^n[i-8]^n[i-14]^n[i-16],1);var r=this.h[0],o=this.h[1],c=this.h[2],h=this.h[3],p=this.h[4];for(i=0;i<n.length;i++){var f=~~(i/20),g=l(s(r,5),d(f,o,c,h),p,n[i],u[f]);p=h,h=c,c=s(o,30),o=r,r=g}this.h[0]=a(this.h[0],r),this.h[1]=a(this.h[1],o),this.h[2]=a(this.h[2],c),this.h[3]=a(this.h[3],h),this.h[4]=a(this.h[4],p)},h.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},799:(e,t,n)=>{"use strict";var i=n(6436),r=n(9344);function o(){if(!(this instanceof o))return new o;r.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}i.inherits(o,r),e.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h.slice(0,7),"big"):i.split32(this.h.slice(0,7),"big")}},9344:(e,t,n)=>{"use strict";var i=n(6436),r=n(5772),o=n(7038),s=n(9746),a=i.sum32,l=i.sum32_4,d=i.sum32_5,c=o.ch32,u=o.maj32,h=o.s0_256,p=o.s1_256,f=o.g0_256,g=o.g1_256,E=r.BlockHash,_=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function v(){if(!(this instanceof v))return new v;E.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=_,this.W=new Array(64)}i.inherits(v,E),e.exports=v,v.blockSize=512,v.outSize=256,v.hmacStrength=192,v.padLength=64,v.prototype._update=function(e,t){for(var n=this.W,i=0;i<16;i++)n[i]=e[t+i];for(;i<n.length;i++)n[i]=l(g(n[i-2]),n[i-7],f(n[i-15]),n[i-16]);var r=this.h[0],o=this.h[1],E=this.h[2],_=this.h[3],v=this.h[4],I=this.h[5],S=this.h[6],C=this.h[7];for(s(this.k.length===n.length),i=0;i<n.length;i++){var O=d(C,p(v),c(v,I,S),this.k[i],n[i]),y=a(h(r),u(r,o,E));C=S,S=I,I=v,v=a(_,O),_=E,E=o,o=r,r=a(O,y)}this.h[0]=a(this.h[0],r),this.h[1]=a(this.h[1],o),this.h[2]=a(this.h[2],E),this.h[3]=a(this.h[3],_),this.h[4]=a(this.h[4],v),this.h[5]=a(this.h[5],I),this.h[6]=a(this.h[6],S),this.h[7]=a(this.h[7],C)},v.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},772:(e,t,n)=>{"use strict";var i=n(6436),r=n(5900);function o(){if(!(this instanceof o))return new o;r.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}i.inherits(o,r),e.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h.slice(0,12),"big"):i.split32(this.h.slice(0,12),"big")}},5900:(e,t,n)=>{"use strict";var i=n(6436),r=n(5772),o=n(9746),s=i.rotr64_hi,a=i.rotr64_lo,l=i.shr64_hi,d=i.shr64_lo,c=i.sum64,u=i.sum64_hi,h=i.sum64_lo,p=i.sum64_4_hi,f=i.sum64_4_lo,g=i.sum64_5_hi,E=i.sum64_5_lo,_=r.BlockHash,v=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function I(){if(!(this instanceof I))return new I;_.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=v,this.W=new Array(160)}function S(e,t,n,i,r){var o=e&n^~e&r;return o<0&&(o+=4294967296),o}function C(e,t,n,i,r,o){var s=t&i^~t&o;return s<0&&(s+=4294967296),s}function O(e,t,n,i,r){var o=e&n^e&r^n&r;return o<0&&(o+=4294967296),o}function y(e,t,n,i,r,o){var s=t&i^t&o^i&o;return s<0&&(s+=4294967296),s}function m(e,t){var n=s(e,t,28)^s(t,e,2)^s(t,e,7);return n<0&&(n+=4294967296),n}function A(e,t){var n=a(e,t,28)^a(t,e,2)^a(t,e,7);return n<0&&(n+=4294967296),n}function w(e,t){var n=s(e,t,14)^s(e,t,18)^s(t,e,9);return n<0&&(n+=4294967296),n}function T(e,t){var n=a(e,t,14)^a(e,t,18)^a(t,e,9);return n<0&&(n+=4294967296),n}function P(e,t){var n=s(e,t,1)^s(e,t,8)^l(e,t,7);return n<0&&(n+=4294967296),n}function N(e,t){var n=a(e,t,1)^a(e,t,8)^d(e,t,7);return n<0&&(n+=4294967296),n}function b(e,t){var n=s(e,t,19)^s(t,e,29)^l(e,t,6);return n<0&&(n+=4294967296),n}function R(e,t){var n=a(e,t,19)^a(t,e,29)^d(e,t,6);return n<0&&(n+=4294967296),n}i.inherits(I,_),e.exports=I,I.blockSize=1024,I.outSize=512,I.hmacStrength=192,I.padLength=128,I.prototype._prepareBlock=function(e,t){for(var n=this.W,i=0;i<32;i++)n[i]=e[t+i];for(;i<n.length;i+=2){var r=b(n[i-4],n[i-3]),o=R(n[i-4],n[i-3]),s=n[i-14],a=n[i-13],l=P(n[i-30],n[i-29]),d=N(n[i-30],n[i-29]),c=n[i-32],u=n[i-31];n[i]=p(r,o,s,a,l,d,c,u),n[i+1]=f(r,o,s,a,l,d,c,u)}},I.prototype._update=function(e,t){this._prepareBlock(e,t);var n=this.W,i=this.h[0],r=this.h[1],s=this.h[2],a=this.h[3],l=this.h[4],d=this.h[5],p=this.h[6],f=this.h[7],_=this.h[8],v=this.h[9],I=this.h[10],P=this.h[11],N=this.h[12],b=this.h[13],R=this.h[14],L=this.h[15];o(this.k.length===n.length);for(var D=0;D<n.length;D+=2){var U=R,k=L,M=w(_,v),F=T(_,v),j=S(_,v,I,P,N),x=C(_,v,I,P,N,b),B=this.k[D],K=this.k[D+1],$=n[D],V=n[D+1],G=g(U,k,M,F,j,x,B,K,$,V),W=E(U,k,M,F,j,x,B,K,$,V);U=m(i,r),k=A(i,r),M=O(i,r,s,a,l),F=y(i,r,s,a,l,d);var H=u(U,k,M,F),q=h(U,k,M,F);R=N,L=b,N=I,b=P,I=_,P=v,_=u(p,f,G,W),v=h(f,f,G,W),p=l,f=d,l=s,d=a,s=i,a=r,i=u(G,W,H,q),r=h(G,W,H,q)}c(this.h,0,i,r),c(this.h,2,s,a),c(this.h,4,l,d),c(this.h,6,p,f),c(this.h,8,_,v),c(this.h,10,I,P),c(this.h,12,N,b),c(this.h,14,R,L)},I.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},7038:(e,t,n)=>{"use strict";var i=n(6436).rotr32;function r(e,t,n){return e&t^~e&n}function o(e,t,n){return e&t^e&n^t&n}function s(e,t,n){return e^t^n}t.ft_1=function(e,t,n,i){return 0===e?r(t,n,i):1===e||3===e?s(t,n,i):2===e?o(t,n,i):void 0},t.ch32=r,t.maj32=o,t.p32=s,t.s0_256=function(e){return i(e,2)^i(e,13)^i(e,22)},t.s1_256=function(e){return i(e,6)^i(e,11)^i(e,25)},t.g0_256=function(e){return i(e,7)^i(e,18)^e>>>3},t.g1_256=function(e){return i(e,17)^i(e,19)^e>>>10}},6436:(e,t,n)=>{"use strict";var i=n(9746),r=n(5717);function o(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function s(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function a(e){return 1===e.length?"0"+e:e}function l(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=r,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16))}else for(var i=0,r=0;r<e.length;r++){var s=e.charCodeAt(r);s<128?n[i++]=s:s<2048?(n[i++]=s>>6|192,n[i++]=63&s|128):o(e,r)?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++r)),n[i++]=s>>18|240,n[i++]=s>>12&63|128,n[i++]=s>>6&63|128,n[i++]=63&s|128):(n[i++]=s>>12|224,n[i++]=s>>6&63|128,n[i++]=63&s|128)}else for(r=0;r<e.length;r++)n[r]=0|e[r];return n},t.toHex=function(e){for(var t="",n=0;n<e.length;n++)t+=a(e[n].toString(16));return t},t.htonl=s,t.toHex32=function(e,t){for(var n="",i=0;i<e.length;i++){var r=e[i];"little"===t&&(r=s(r)),n+=l(r.toString(16))}return n},t.zero2=a,t.zero8=l,t.join32=function(e,t,n,r){var o=n-t;i(o%4==0);for(var s=new Array(o/4),a=0,l=t;a<s.length;a++,l+=4){var d;d="big"===r?e[l]<<24|e[l+1]<<16|e[l+2]<<8|e[l+3]:e[l+3]<<24|e[l+2]<<16|e[l+1]<<8|e[l],s[a]=d>>>0}return s},t.split32=function(e,t){for(var n=new Array(4*e.length),i=0,r=0;i<e.length;i++,r+=4){var o=e[i];"big"===t?(n[r]=o>>>24,n[r+1]=o>>>16&255,n[r+2]=o>>>8&255,n[r+3]=255&o):(n[r+3]=o>>>24,n[r+2]=o>>>16&255,n[r+1]=o>>>8&255,n[r]=255&o)}return n},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<<t|e>>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,n){return e+t+n>>>0},t.sum32_4=function(e,t,n,i){return e+t+n+i>>>0},t.sum32_5=function(e,t,n,i,r){return e+t+n+i+r>>>0},t.sum64=function(e,t,n,i){var r=e[t],o=i+e[t+1]>>>0,s=(o<i?1:0)+n+r;e[t]=s>>>0,e[t+1]=o},t.sum64_hi=function(e,t,n,i){return(t+i>>>0<t?1:0)+e+n>>>0},t.sum64_lo=function(e,t,n,i){return t+i>>>0},t.sum64_4_hi=function(e,t,n,i,r,o,s,a){var l=0,d=t;return l+=(d=d+i>>>0)<t?1:0,l+=(d=d+o>>>0)<o?1:0,e+n+r+s+(l+=(d=d+a>>>0)<a?1:0)>>>0},t.sum64_4_lo=function(e,t,n,i,r,o,s,a){return t+i+o+a>>>0},t.sum64_5_hi=function(e,t,n,i,r,o,s,a,l,d){var c=0,u=t;return c+=(u=u+i>>>0)<t?1:0,c+=(u=u+o>>>0)<o?1:0,c+=(u=u+a>>>0)<a?1:0,e+n+r+s+l+(c+=(u=u+d>>>0)<d?1:0)>>>0},t.sum64_5_lo=function(e,t,n,i,r,o,s,a,l,d){return t+i+o+a+d>>>0},t.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},t.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},t.shr64_hi=function(e,t,n){return e>>>n},t.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0}},5717:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},6245:(e,t,n)=>{"use strict";function i(e){this.message=e}n.r(t),n.d(t,{InvalidTokenError:()=>s,default:()=>a}),i.prototype=new Error,i.prototype.name="InvalidCharacterError";var r="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new i("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r,o=0,s=0,a="";r=t.charAt(s++);~r&&(n=o%4?64*n+r:r,o++%4)?a+=String.fromCharCode(255&n>>(-2*o&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return a};function o(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(r(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return r(t)}}function s(e){this.message=e}s.prototype=new Error,s.prototype.name="InvalidTokenError";const a=function(e,t){if("string"!=typeof e)throw new s("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(o(e.split(".")[n]))}catch(e){throw new s("Invalid token specified: "+e.message)}}},9746:e=>{function t(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=t,t.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)}},4155:e=>{var t,n,i=e.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(e){t=r}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var a,l=[],d=!1,c=-1;function u(){d&&a&&(d=!1,a.length?l=a.concat(l):c=-1,l.length&&h())}function h(){if(!d){var e=s(u);d=!0;for(var t=l.length;t;){for(a=l,l=[];++c<t;)a&&a[c].run();c=-1,t=l.length}a=null,d=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{return n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function f(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new p(e,t)),1!==l.length||d||s(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=f,i.addListener=f,i.once=f,i.off=f,i.removeListener=f,i.removeAllListeners=f,i.emit=f,i.prependListener=f,i.prependOnceListener=f,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},655:(e,t,n)=>{"use strict";n.r(t),n.d(t,{__assign:()=>o,__asyncDelegator:()=>C,__asyncGenerator:()=>S,__asyncValues:()=>O,__await:()=>I,__awaiter:()=>c,__classPrivateFieldGet:()=>T,__classPrivateFieldSet:()=>P,__createBinding:()=>h,__decorate:()=>a,__exportStar:()=>p,__extends:()=>r,__generator:()=>u,__importDefault:()=>w,__importStar:()=>A,__makeTemplateObject:()=>y,__metadata:()=>d,__param:()=>l,__read:()=>g,__rest:()=>s,__spread:()=>E,__spreadArray:()=>v,__spreadArrays:()=>_,__values:()=>f});var i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},i(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return o=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},o.apply(this,arguments)};function s(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function a(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function l(e,t){return function(n,i){t(n,i,e)}}function d(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function c(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))}function u(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}var h=Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]};function p(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||h(t,e,n)}function f(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}function E(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(g(arguments[t]));return e}function _(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),r=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,r++)i[r]=o[s];return i}function v(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}function I(e){return this instanceof I?(this.v=e,this):new I(e)}function S(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=n.apply(e,t||[]),o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(e){r[e]&&(i[e]=function(t){return new Promise((function(n,i){o.push([e,t,n,i])>1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof I?Promise.resolve(n.value.v).then(l,d):c(o[0][2],n)}catch(e){c(o[0][3],e)}var n}function l(e){a("next",e)}function d(e){a("throw",e)}function c(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function C(e){var t,n;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,r){t[i]=e[i]?function(t){return(n=!n)?{value:I(e[i](t)),done:"return"===i}:r?r(t):t}:r}}function O(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=f(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(n){t[n]=e[n]&&function(t){return new Promise((function(i,r){(function(e,t,n,i){Promise.resolve(i).then((function(t){e({value:t,done:n})}),t)})(i,r,(t=e[n](t)).done,t.value)}))}}}function y(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var m=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function A(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&h(t,e,n);return m(t,e),t}function w(e){return e&&e.__esModule?e:{default:e}}function T(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function P(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,n),o.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i=n(773);module.exports=i})();
|
package/dist/src/constants.d.ts
CHANGED
|
@@ -2,4 +2,3 @@ export declare const ACTION_CUSTOM = "custom";
|
|
|
2
2
|
export declare const INSUFFICIENT_PERMISSION: string;
|
|
3
3
|
export declare const BYO_CREDENTIAL_VERIFICATION_ERROR: string;
|
|
4
4
|
export declare const BYO_USER_PROFILE_ERROR_CODE: string;
|
|
5
|
-
export declare const PERSONA_META_HEADER: string;
|