@amp-labs/react 2.1.0 → 2.2.0

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.
@@ -1,30 +1,30 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),g=require("react");require("react-dom");function Fl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const V=Fl(g),Ts=g.createContext(null),kl=Ts.Provider,He=()=>{const e=g.useContext(Ts);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var Ce=(e=>(e.MAPPING="mappingError",e.INTEGRATION_LIST="integrationListError",e.PROJECT="projectError",e.CONNECTION_LIST="connectionListError",e.HYDRATED_REVISION="hydratedRevisionError",e.INSTALLATION_LIST="installationListError",e.INSTALLATION_MUTATION="installationMutationError",e))(Ce||{});const Rs=g.createContext(void 0);function Yt(){const e=g.useContext(Rs);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Ml=(()=>{const e={};return Object.values(Ce).forEach(t=>{e[t]={}}),e})();function Ll({children:e}){const[t,n]=g.useState(Ml),r=g.useCallback((d,f,m=!0)=>{n(p=>{const y={...p};return y[d]=y[d]||{},y[d][f]=m,y})},[n]),i=g.useCallback((d,f)=>{var m;return!!((m=t[d])!=null&&m[f])},[t]),o=g.useCallback((d,f)=>{var m;return(m=t[d])==null?void 0:m[f]},[t]),s=g.useCallback((d,f)=>{n(m=>{var y;const p={...m};return(y=p[d])==null||delete y[f],p})},[n]),a=g.useCallback(d=>{n(f=>{const m={...f};return m[d]={},m})},[n]),c=g.useCallback((d,f)=>{n(m=>{const p={...m};return p[d]=p[d]||{},f.forEach(y=>{p[d][y]=!0}),p})},[n]),l=g.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:i,removeError:s,resetBoundary:a,setErrors:c,getError:o}),[t,n,r,i,s,a,c,o]);return u.jsx(Rs.Provider,{value:l,children:e})}const Kl="https://api.withampersand.com/v1".replace(/\/+$/,"");class As{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Kl}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Ds}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const $l=new As,Lr=class Lr{constructor(t=$l){this.configuration=t,this.fetchApi=async(n,r)=>{let i={url:n,init:r};for(const s of this.middleware)s.pre&&(i=await s.pre({fetch:this.fetchApi,...i})||i);let o;try{o=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(s){for(const a of this.middleware)a.onError&&(o=await a.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:s,response:o?o.clone():void 0})||o);if(o===void 0)throw s instanceof Error?new Ul(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(o=await s.post({fetch:this.fetchApi,url:i.url,init:i.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const n=this.clone();return n.middleware=n.middleware.concat(...t),n}withPreMiddleware(...t){const n=t.map(r=>({pre:r}));return this.withMiddleware(...n)}withPostMiddleware(...t){const n=t.map(r=>({post:r}));return this.withMiddleware(...n)}isJsonMime(t){return t?Lr.jsonRegex.test(t):!1}async request(t,n){const{url:r,init:i}=await this.createFetchParams(t,n),o=await this.fetchApi(r,i);if(o&&o.status>=200&&o.status<300)return o;throw new Ps(o,"Response returned an error code")}async createFetchParams(t,n){let r=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(r+="?"+this.configuration.queryParamsStringify(t.query));const i=Object.assign({},this.configuration.headers,t.headers);Object.keys(i).forEach(l=>i[l]===void 0?delete i[l]:{});const o=typeof n=="function"?n:async()=>n,s={method:t.method,headers:i,body:t.body,credentials:this.configuration.credentials},a={...s,...await o({init:s,context:t})},c={...a,body:Hl(a.body)||a.body instanceof URLSearchParams||Vl(a.body)?a.body:JSON.stringify(a.body)};return{url:r,init:c}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};Lr.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let Et=Lr;function Vl(e){return typeof Blob<"u"&&e instanceof Blob}function Hl(e){return typeof FormData<"u"&&e instanceof FormData}class Ps extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class Ul extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class re extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function M(e,t){const n=e[t];return n!=null}function Ds(e,t=""){return Object.keys(e).map(n=>js(n,e[n],t)).filter(n=>n.length>0).join("&")}function js(e,t,n=""){const r=n+(n.length?`[${e}]`:e);if(t instanceof Array){const i=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(r)}=`);return`${encodeURIComponent(r)}=${i}`}if(t instanceof Set){const i=Array.from(t);return js(e,i,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Ds(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function Lo(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class Ae{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class pn{constructor(t){this.raw=t}async value(){}}class Bl{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function ql(e){return Wl(e)}function Wl(e,t){return e==null?e:{fieldUsed:M(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:M(e,"keyFormat")?e.keyFormat:void 0}}function Jl(e){return zl(e)}function zl(e,t){return e==null?e:{name:e.name,valuePrefix:M(e,"valuePrefix")?e.valuePrefix:void 0}}function Xl(e){return Gl(e)}function Gl(e,t){return e==null?e:{name:e.name}}function Yl(e){return Zl(e)}function Zl(e,t){return e==null?e:{attachmentType:e.attachmentType,query:M(e,"query")?Xl(e.query):void 0,header:M(e,"header")?Jl(e.header):void 0,docsURL:M(e,"docsURL")?e.docsURL:void 0}}function Ql(e){return eu(e)}function eu(e,t){return e}function tu(e){return nu(e)}function nu(e,t){return e==null?e:{days:M(e,"days")?e.days:void 0,fullHistory:M(e,"fullHistory")?e.fullHistory:void 0}}function ru(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Fs(e){return ou(e)}function ou(e,t){return e==null?e:{defaultPeriod:tu(e.defaultPeriod)}}function iu(e){if(e!==void 0)return e===null?null:{defaultPeriod:ru(e.defaultPeriod)}}function su(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function au(e){if(e!==void 0)return e===null?null:{defaultPeriod:su(e.defaultPeriod)}}function cu(e){return lu(e)}function lu(e,t){return e==null?e:{enabled:M(e,"enabled")?e.enabled:void 0}}function ks(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function uu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:au(e.backfill)}}function du(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Lo(e.objects,uu)}}function pu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName}}function fu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Lo(e.objects,pu)}}function mu(e){return hu(e)}function hu(e,t){return e==null?e:{apiKeyAsBasic:M(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:M(e,"apiKeyAsBasicOpts")?ql(e.apiKeyAsBasicOpts):void 0,docsURL:M(e,"docsURL")?e.docsURL:void 0}}function gu(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function dr(e){return vu(e)}function vu(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:M(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function yu(e){return Iu(e)}function Iu(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function wu(e){return _u(e)}function _u(e,t){return e==null?e:{provider:e.provider,read:M(e,"read")?e.read:void 0,write:M(e,"write")?e.write:void 0,proxy:M(e,"proxy")?cu(e.proxy):void 0}}function Ms(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:e.read,write:e.write,proxy:ks(e.proxy)}}function bu(e){return xu(e)}function xu(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:wu(e.content)}}function Cu(e){return Ou(e)}function Ou(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function Ls(e){return Eu(e)}function Eu(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function Ir(e){return Su(e)}function Su(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:M(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:M(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function wr(e){return Nu(e)}function Nu(e,t){return e==null?e:{id:e.id,projectId:e.projectId,providerApp:Ir(e.providerApp),group:Ls(e.group),consumer:Cu(e.consumer),providerWorkspaceRef:e.providerWorkspaceRef,providerConsumerRef:M(e,"ProviderConsumerRef")?e.ProviderConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function Tu(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Ms(e.content)}}function Ru(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:Tu(e.config)}}function Au(e){return Pu(e)}function Pu(e,t){return e==null?e:{enabled:M(e,"enabled")?e.enabled:void 0}}function Du(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function ju(e){return Fu(e)}function Fu(e,t){return e==null?e:{mode:M(e,"mode")?e.mode:void 0,pageSize:M(e,"pageSize")?e.pageSize:void 0}}function ku(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Mu(e){let t=!0;return t=t&&"fieldName"in e,t}function Lu(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:M(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:M(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Ku(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function $u(e){let t=!0;return t=t&&"mapToName"in e,t}function Ks(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:M(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:M(e,"default")?e.default:void 0,prompt:M(e,"prompt")?e.prompt:void 0}}function Vu(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function ji(e){return Hu(e)}function Hu(e,t){return e==null?e:{...Lu(e),...Ks(e)}}function Fi(e){if(e!==void 0)return e===null?null:Mu(e)?Ku(e):$u(e)?Vu(e):{}}function $s(e){return Uu(e)}function Uu(e,t){return e}function Bu(e){return qu(e)}function qu(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:M(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:M(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:M(e,"requiredFields")?e.requiredFields.map(ji):void 0,optionalFields:M(e,"optionalFields")?e.optionalFields.map(ji):void 0,optionalFieldsAuto:M(e,"optionalFieldsAuto")?$s(e.optionalFieldsAuto):void 0,backfill:M(e,"backfill")?Fs(e.backfill):void 0,delivery:M(e,"delivery")?ju(e.delivery):void 0}}function Wu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,requiredFields:e.requiredFields===void 0?void 0:e.requiredFields.map(Fi),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(Fi),optionalFieldsAuto:e.optionalFieldsAuto,backfill:iu(e.backfill),delivery:ku(e.delivery)}}function Ju(e){return zu(e)}function zu(e,t){return e==null?e:{objects:M(e,"objects")?e.objects.map(Bu):void 0}}function Xu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Wu)}}function Gu(e){return Yu(e)}function Yu(e,t){return e==null?e:{objectName:e.objectName,inheritMappingFromRead:M(e,"inheritMappingFromRead")?e.inheritMappingFromRead:void 0}}function Zu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMappingFromRead:e.inheritMappingFromRead}}function Qu(e){return ed(e)}function ed(e,t){return e==null?e:{objects:M(e,"objects")?e.objects.map(Gu):void 0}}function td(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Zu)}}function nd(e){return rd(e)}function rd(e,t){return e==null?e:{name:e.name,displayName:M(e,"displayName")?e.displayName:void 0,provider:e.provider,read:M(e,"read")?Ju(e.read):void 0,write:M(e,"write")?Qu(e.write):void 0,proxy:M(e,"proxy")?Au(e.proxy):void 0}}function od(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:Xu(e.read),write:td(e.write),proxy:Du(e.proxy)}}function id(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:od(e.content)}}function sd(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:id(e.latestRevision)}}function ad(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function cd(e){if(e!==void 0)return e===null?null:{externalRef:e.externalRef,provider:e.provider,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function ld(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function ud(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function dd(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function pd(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function fd(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:ud(e.basicAuth),oauth2ClientCredentials:dd(e.oauth2ClientCredentials),oauth2Password:pd(e.oauth2Password)}}function md(e){return hd(e)}function hd(e,t){return e==null?e:{enabled:M(e,"enabled")?e.enabled:void 0}}function gd(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:M(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:M(e,"mapToDisplayName")?e.mapToDisplayName:void 0,displayName:e.displayName}}function to(e){return vd(e)}function vd(e,t){return e==null?e:{...gd(e),...Ks(e)}}function yd(e){return Id(e)}function Id(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,mapToName:M(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:M(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:M(e,"requiredFields")?e.requiredFields.map(to):void 0,optionalFields:M(e,"optionalFields")?e.optionalFields.map(to):void 0,optionalFieldsAuto:M(e,"optionalFieldsAuto")?$s(e.optionalFieldsAuto):void 0,allFields:M(e,"allFields")?e.allFields.map(to):void 0,backfill:M(e,"backfill")?Fs(e.backfill):void 0}}function wd(e){return _d(e)}function _d(e,t){return e==null?e:{objects:M(e,"objects")?e.objects.map(yd):void 0}}function bd(e){return xd(e)}function xd(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName}}function Cd(e){return Od(e)}function Od(e,t){return e==null?e:{objects:M(e,"objects")?e.objects.map(bd):void 0}}function Ed(e){return Sd(e)}function Sd(e,t){return e==null?e:{name:e.name,displayName:M(e,"displayName")?e.displayName:void 0,provider:e.provider,read:M(e,"read")?wd(e.read):void 0,write:M(e,"write")?Cd(e.write):void 0,proxy:M(e,"proxy")?md(e.proxy):void 0}}function Nd(e){return Td(e)}function Td(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Ed(e.content)}}function Rd(e){if(e!==void 0)return e===null?null:{providerAppId:e.providerAppId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerWorkspaceRef:e.providerWorkspaceRef,providerConsumerRef:e.providerConsumerRef,refreshToken:e.refreshToken,scopes:e.scopes}}function Ad(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,content:Ms(e.content)}}function Pd(e){if(e!==void 0)return e===null?null:{provider:e.provider,connection:Rd(e.connection),config:Ad(e.config)}}function Ln(e){return Dd(e)}function Dd(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:M(e,"group")?Ls(e.group):void 0,healthStatus:e.healthStatus,connection:wr(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0,config:bu(e.config)}}function jd(e){return Fd(e)}function Fd(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:nd(e.content)}}function ki(e){return kd(e)}function kd(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:jd(e.latestRevision)}}function Md(e){return Ld(e)}function Ld(e,t){return e==null?e:{iconURL:M(e,"iconURL")?e.iconURL:void 0,logoURL:M(e,"logoURL")?e.logoURL:void 0}}function Kd(e){return $d(e)}function $d(e,t){return e==null?e:{iconURL:M(e,"iconURL")?e.iconURL:void 0,logoURL:M(e,"logoURL")?e.logoURL:void 0}}function Vd(e){return Hd(e)}function Hd(e,t){return e==null?e:{regular:M(e,"regular")?Kd(e.regular):void 0,darkMode:M(e,"darkMode")?Md(e.darkMode):void 0}}function Ud(e){return Bd(e)}function Bd(e,t){return e==null?e:{workspaceRefField:M(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:M(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:M(e,"scopesField")?e.scopesField:void 0}}function qd(e){return Wd(e)}function Wd(e,t){return e==null?e:{grantType:e.grantType,authURL:M(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:M(e,"audience")?e.audience:void 0,tokenMetadataFields:Ud(e.tokenMetadataFields),docsURL:M(e,"docsURL")?e.docsURL:void 0,authURLParams:M(e,"authURLParams")?e.authURLParams:void 0}}function Jd(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,projectId:e.projectId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerAppId:e.providerAppId,provider:e.provider,enableCSRFProtection:e.enableCSRFProtection}}function zd(e){return Xd(e)}function Xd(e,t){return e==null?e:{bulkWrite:yu(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write}}function Mi(e){return Gd(e)}function Gd(e,t){return e==null?e:{name:e.name,authType:Ql(e.authType),baseURL:e.baseURL,oauth2Opts:M(e,"oauth2Opts")?qd(e.oauth2Opts):void 0,apiKeyOpts:M(e,"apiKeyOpts")?Yl(e.apiKeyOpts):void 0,basicOpts:M(e,"basicOpts")?mu(e.basicOpts):void 0,support:zd(e.support),providerOpts:e.providerOpts,displayName:M(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:M(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:M(e,"media")?Vd(e.media):void 0,labels:M(e,"labels")?e.labels:void 0}}function Yd(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:du(e.read),write:fu(e.write),proxy:ks(e.proxy)}}function Zd(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Yd(e.content)}}function Qd(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:Zd(e.config)}}function ep(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:Qd(e.installation)}}function tp(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function np(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:tp(e.project)}}function rp(e){if(e!==void 0)return e===null?null:{externalRef:e.externalRef,provider:e.provider,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function op(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:rp(e.providerApp)}}class ip extends Et{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"DELETE",headers:i,query:r},n);return new pn(o)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:fd(t.generateConnectionParams)},n);return new Ae(o,s=>wr(s))}async generateConnection(t,n){return await(await this.generateConnectionRaw(t,n)).value()}async getConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>wr(s))}async getConnection(t,n){return await(await this.getConnectionRaw(t,n)).value()}async listConnectionsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>s.map(wr))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}}class sp extends Et{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new re("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:Ru(t.installation)},n);return new Ae(o,s=>Ln(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new re("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"DELETE",headers:i,query:r},n);return new pn(o)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new re("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>Ln(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async importInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling importInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling importInstallation.");if(t.installation===null||t.installation===void 0)throw new re("installation","Required parameter requestParameters.installation was null or undefined when calling importInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations:import".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:Pd(t.installation)},n);return new Ae(o,s=>Ln(s))}async importInstallation(t,n){return await(await this.importInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>s.map(Ln))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new re("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new re("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"PATCH",headers:i,query:r,body:ep(t.installationUpdate)},n);return new Ae(o,s=>Ln(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class ap extends Et{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:i,query:r,body:gu(t.batchUpsertIntegrationsRequest)},n);return new Ae(o,s=>s.map(ki))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new re("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:sd(t.integration)},n);return new pn(o)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:i,query:r},n);return new pn(o)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>s.map(ki))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class cp extends Et{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new re("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},i={};i["Content-Type"]="application/json";const o=await this.request({path:"/oauth-connect",method:"POST",headers:i,query:r,body:Jd(t.connectOAuthParams)},n);return this.isJsonMime(o.headers.get("content-type"))?new Ae(o):new Bl(o)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}}class lp extends Et{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new re("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects",method:"POST",headers:i,query:r,body:ad(t.project)},n);return new Ae(o,s=>dr(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async deleteProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:i,query:r},n);return new pn(o)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>dr(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new Ae(i,o=>o.map(dr))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new re("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:i,query:r,body:np(t.projectUpdate)},n);return new Ae(o,s=>dr(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class up extends Et{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new re("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>Mi(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new Ae(i,o=>Lo(o,Mi))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class dp extends Et{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new re("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:cd(t.providerApp)},n);return new Ae(o,s=>Ir(s))}async createProviderApp(t,n){return await(await this.createProviderAppRaw(t,n)).value()}async deleteProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new re("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:i,query:r},n);return new pn(o)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>s.map(Ir))}async listProviderApps(t,n){return await(await this.listProviderAppsRaw(t,n)).value()}async updateProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new re("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new re("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:i,query:r,body:op(t.providerAppUpdate)},n);return new Ae(o,s=>Ir(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class pp extends Et{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:ld(t.revision)},n);return new pn(o)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new re("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions/{revisionId}:hydrate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{revisionId}",encodeURIComponent(String(t.revisionId))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>Nd(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class fp{constructor(t){this.connectionApi=new ip(t),this.installationApi=new sp(t),this.integrationApi=new ap(t),this.oAuthApi=new cp(t),this.projectApi=new lp(t),this.providerApi=new up(t),this.providerAppApi=new dp(t),this.revisionApi=new pp(t)}}const mp="2.1.0",hp="v1",pr="https://api.withampersand.com";function Vs(){try{const e=process.env.REACT_APP_AMP_SERVER;switch(e){case"local":return"http://localhost:8080";case"dev":return"https://dev-api.withampersand.com";case"staging":return"https://staging-api.withampersand.com";case"prod":return pr;case"mock":return"http://127.0.0.1:4010";case"":return pr;default:return e??pr}}catch{return pr}}const gp=(e,t)=>`${e}/${t}`;function vp(){return gp(Vs(),hp)}const yp=Vs(),Ip=vp(),wp=new As({basePath:Ip,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":mp}});let _p=new fp(wp);const Oe=()=>_p,ze=async(e,t)=>{var n;if(e instanceof Ps){const{status:r,statusText:i}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,i);const o=await e.response.json(),s=((n=o==null?void 0:o.causes)==null?void 0:n.join(`
2
- `))||"[ERROR] Creating installation failed.";console.error("[Error Message]",s),t&&t(s)}else console.error("Unexpected error:",e.message)},Hs=g.createContext({integrations:null,isLoading:!0}),Ko=()=>{const e=g.useContext(Hs);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function bp({projectIdOrName:e,children:t}){const n=He(),{setError:r}=Yt(),[i,o]=g.useState(null),[s,a]=g.useState(!0);g.useEffect(()=>{Oe().integrationApi.listIntegrations({projectIdOrName:e},{headers:{"X-Api-Key":n??""}}).then(l=>{a(!1),o(l||[])}).catch(l=>{console.error("Error retrieving integration information."),ze(l),a(!1),r(Ce.INTEGRATION_LIST,e)})},[e,n,r]);const c=g.useMemo(()=>({integrations:i,isLoading:s}),[i,s]);return u.jsx(Hs.Provider,{value:c,children:t})}const Us=g.createContext({project:null,appName:"",projectId:"",projectIdOrName:"",isLoading:!0}),Pe=()=>{const e=g.useContext(Us);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function xp({projectIdOrName:e,children:t}){const n=He(),{setError:r}=Yt(),[i,o]=g.useState(null),[s,a]=g.useState(!0);g.useEffect(()=>{Oe().projectApi.getProject({projectIdOrName:e},{headers:{"X-Api-Key":n??""}}).then(l=>{a(!1),o(l)}).catch(l=>{console.error("Error loading Ampersand project."),ze(l),r(Ce.PROJECT,e),a(!1)})},[e,n,a,r]);const c=g.useMemo(()=>({projectId:(i==null?void 0:i.id)||"",projectIdOrName:e,project:i,appName:(i==null?void 0:i.appName)||"",isLoading:s}),[e,i,s]);return u.jsx(Us.Provider,{value:c,children:t})}function Cp(e){const{options:{apiKey:t,projectId:n,project:r},children:i}=e,o=r||n;if(n&&r)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!o)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t)throw new Error("Cannot use AmpersandProvider without an apiKey.");return u.jsx(Ll,{children:u.jsx(kl,{value:t,children:u.jsx(xp,{projectIdOrName:o,children:u.jsx(bp,{projectIdOrName:o,children:i})})})})}const Bs=g.createContext(null);function Op(){const e=g.useContext(Bs);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
3
- component is wrapped with AmpersandProvider`);return e}function Ep(){return u.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("path",{d:"M20.5796 7.72236L3.63955 36.0024C3.29029 36.6072 3.10549 37.293 3.10353 37.9914C3.10158 38.6898 3.28254 39.3766 3.62841 39.9834C3.97428 40.5902 4.473 41.0959 5.07497 41.4501C5.67693 41.8043 6.36115 41.9947 7.05955 42.0024H40.9396C41.638 41.9947 42.3222 41.8043 42.9241 41.4501C43.5261 41.0959 44.0248 40.5902 44.3707 39.9834C44.7166 39.3766 44.8975 38.6898 44.8956 37.9914C44.8936 37.293 44.7088 36.6072 44.3596 36.0024L27.4196 7.72236C27.063 7.13458 26.561 6.6486 25.9619 6.31133C25.3629 5.97406 24.687 5.79688 23.9996 5.79688C23.3121 5.79688 22.6362 5.97406 22.0372 6.31133C21.4381 6.6486 20.9361 7.13458 20.5796 7.72236Z",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}const Sp="_box_1p7c5_1",Li={box:Sp};function Zt({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${Li.box} ${t}`:Li.box,style:n,children:e})}const Np="_container_1wvzr_1",Ki={container:Np};function Pn({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${Ki.container} ${t}`:Ki.container,style:n,children:e})}const Tp="_errorBoxContainer_4sdb2_1",Rp="_errorBox_4sdb2_1",Ap="_errorText_4sdb2_20",no={errorBoxContainer:Tp,errorBox:Rp,errorText:Ap};function qs({message:e}){return u.jsxs(Pn,{className:no.errorBoxContainer,children:[u.jsx(Ep,{}),u.jsx(Zt,{className:no.errorBox,children:u.jsx("p",{className:no.errorText,children:e})})]})}const Pp="_loader_6ubm6_1",Dp="_rotate_6ubm6_1",jp="_ball1_6ubm6_1",Fp="_ball2_6ubm6_1",kp={loader:Pp,rotate:Dp,ball1:jp,ball2:Fp};function Mp(){return u.jsx("span",{className:kp.loader})}function Un(){return u.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:u.jsx(Mp,{})})}function Ws({children:e}){return u.jsx(Pn,{style:{maxWidth:"55rem"},children:u.jsx(Zt,{children:e})})}function Kr(){return u.jsx(Ws,{children:u.jsx(Un,{})})}function Lt({message:e}){return u.jsx(Ws,{children:u.jsx(qs,{message:e})})}const Js=()=>{const[e,t]=g.useState(!1),n=g.useCallback(()=>{t(!0)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n}};function Bn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Qt(e,t){return(t==null?void 0:t.displayName)??Bn(e)}const Lp=e=>e.split(`
4
- `).filter(n=>n.trim()!==""),Kp=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,zs=g.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0,onUninstallSuccess:void 0,isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}});function dt(){const e=g.useContext(zs);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function $p({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,fieldMapping:l}){const d=He(),{projectId:f}=Pe(),{integrations:m}=Ko(),{setError:p,isError:y}=Yt(),{isIntegrationDeleted:I,setIntegrationDeleted:w}=Js(),[C,v]=g.useState([]),[x,b]=g.useState(!0),_=(C==null?void 0:C[0])||null,E=g.useMemo(()=>Kp(t,m||[]),[t,m]);g.useEffect(()=>{E===null&&(m!=null&&m.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,E,m]);const L=g.useCallback(z=>{v([z])},[v]),T=g.useCallback(()=>{E!=null&&E.id&&Oe().installationApi.listInstallations({projectIdOrName:f,integrationId:E.id,groupRef:i},{headers:{"X-Api-Key":d??""}}).then(z=>{b(!1),v(z||[])}).catch(z=>{p(Ce.INSTALLATION_LIST,E.id),b(!1),console.error("Error retrieving installation information: ",z)})},[E,f,d,p,i]),J=(E==null?void 0:E.id)||"";g.useEffect(()=>{T()},[T]);const q=g.useMemo(()=>({integrationId:(E==null?void 0:E.id)||"",provider:(E==null?void 0:E.provider)||"",integrationObj:E,consumerRef:n,consumerName:r,groupRef:i,groupName:o,installation:_,setInstallation:L,resetInstallations:T,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,isIntegrationDeleted:I,setIntegrationDeleted:w,fieldMapping:l}),[E,n,r,i,o,_,L,T,s,a,c,I,w,l]);if(x)return u.jsx(Kr,{});if(E===null)return u.jsx(Lt,{message:`Integration "${t}" not found`});if(y(Ce.INSTALLATION_LIST,J)){const z=`Error retrieving installation information for integration "${(E==null?void 0:E.name)||"unknown"}"`;return u.jsx(Lt,{message:z})}return u.jsx(zs.Provider,{value:q,children:e})}const Xs=g.createContext({connections:null,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{},isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}}),yn=()=>{const e=g.useContext(Xs);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function Gs({provider:e,groupRef:t,children:n}){const r=He(),{projectId:i,isLoading:o}=Pe(),[s,a]=g.useState(null),[c,l]=g.useState(null),[d,f]=g.useState(!0),{setError:m,isError:p}=Yt(),{provider:y}=dt(),{isIntegrationDeleted:I,setIntegrationDeleted:w}=Js(),C=e||y;if(!C)throw new Error("ConnectionsProvider must be given a provider prop or be used within InstallIntegrationProvider");g.useEffect(()=>{i&&r&&Oe().connectionApi.listConnections({projectIdOrName:i,groupRef:t,provider:C},{headers:{"X-Api-Key":r??""}}).then(x=>{f(!1),a(x)}).catch(x=>{console.error(`Error retrieving existing OAuth connections for group ID ${t}.`),ze(x),f(!1),m(Ce.CONNECTION_LIST,i)})},[i,r,t,C,m]);const v=g.useMemo(()=>({connections:s,selectedConnection:c,setConnections:a,setSelectedConnection:l,isIntegrationDeleted:I,setIntegrationDeleted:w}),[s,c,a,l,I,w]);if(d||o)return u.jsx(Kr,{});if(p(Ce.PROJECT,i))return u.jsx(Lt,{message:`Error loading project ${i}`});if(p(Ce.CONNECTION_LIST,i))return u.jsx(Lt,{message:"Error retrieving existing connections"});if(!i)throw new Error("Project ID not found. ConnectionsProvider must be used within AmpersandProvider");return u.jsx(Xs.Provider,{value:v,children:n})}function Ys(){const[e,t]=g.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}const Vp="_resetContainer_lkwv9_4",Zs={resetContainer:Vp};var fr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Cr={exports:{}};Cr.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=1,o=2,s=9007199254740991,a="[object Arguments]",c="[object Array]",l="[object AsyncFunction]",d="[object Boolean]",f="[object Date]",m="[object Error]",p="[object Function]",y="[object GeneratorFunction]",I="[object Map]",w="[object Number]",C="[object Null]",v="[object Object]",x="[object Promise]",b="[object Proxy]",_="[object RegExp]",E="[object Set]",L="[object String]",T="[object Symbol]",J="[object Undefined]",q="[object WeakMap]",z="[object ArrayBuffer]",Y="[object DataView]",ee="[object Float32Array]",U="[object Float64Array]",se="[object Int8Array]",ne="[object Int16Array]",Q="[object Int32Array]",de="[object Uint8Array]",fe="[object Uint8ClampedArray]",S="[object Uint16Array]",P="[object Uint32Array]",k=/[\\^$.*+?()[\]{}|]/g,j=/^\[object .+?Constructor\]$/,D=/^(?:0|[1-9]\d*)$/,R={};R[ee]=R[U]=R[se]=R[ne]=R[Q]=R[de]=R[fe]=R[S]=R[P]=!0,R[a]=R[c]=R[z]=R[d]=R[Y]=R[f]=R[m]=R[p]=R[I]=R[w]=R[v]=R[_]=R[E]=R[L]=R[q]=!1;var X=typeof fr=="object"&&fr&&fr.Object===Object&&fr,G=typeof self=="object"&&self&&self.Object===Object&&self,K=X||G||Function("return this")(),Z=t&&!t.nodeType&&t,B=Z&&!0&&e&&!e.nodeType&&e,ae=B&&B.exports===Z,A=ae&&X.process,pe=function(){try{return A&&A.binding&&A.binding("util")}catch{}}(),$=pe&&pe.isTypedArray;function Ie(h,O){for(var N=-1,W=h==null?0:h.length,be=0,ce=[];++N<W;){var Te=h[N];O(Te,N,h)&&(ce[be++]=Te)}return ce}function De(h,O){for(var N=-1,W=O.length,be=h.length;++N<W;)h[be+N]=O[N];return h}function Ue(h,O){for(var N=-1,W=h==null?0:h.length;++N<W;)if(O(h[N],N,h))return!0;return!1}function je(h,O){for(var N=-1,W=Array(h);++N<h;)W[N]=O(N);return W}function me(h){return function(O){return h(O)}}function gt(h,O){return h.has(O)}function Be(h,O){return h==null?void 0:h[O]}function nt(h){var O=-1,N=Array(h.size);return h.forEach(function(W,be){N[++O]=[be,W]}),N}function vt(h,O){return function(N){return h(O(N))}}function yt(h){var O=-1,N=Array(h.size);return h.forEach(function(W){N[++O]=W}),N}var qe=Array.prototype,Ke=Function.prototype,Fe=Object.prototype,Ee=K["__core-js_shared__"],It=Ke.toString,Xe=Fe.hasOwnProperty,Tt=function(){var h=/[^.]+$/.exec(Ee&&Ee.keys&&Ee.keys.IE_PROTO||"");return h?"Symbol(src)_1."+h:""}(),Kt=Fe.toString,rt=RegExp("^"+It.call(Xe).replace(k,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Se=ae?K.Buffer:void 0,Rt=K.Symbol,$t=K.Uint8Array,At=Fe.propertyIsEnumerable,tn=qe.splice,Ze=Rt?Rt.toStringTag:void 0,Pt=Object.getOwnPropertySymbols,Vt=Se?Se.isBuffer:void 0,nn=vt(Object.keys,Object),Ht=wn(K,"DataView"),xe=wn(K,"Map"),Ge=wn(K,"Promise"),te=wn(K,"Set"),ue=wn(K,"WeakMap"),ke=wn(Object,"create"),Dt=sn(Ht),H=sn(xe),oe=sn(Ge),ie=sn(te),Re=sn(ue),Me=Rt?Rt.prototype:void 0,Qe=Me?Me.valueOf:void 0;function $e(h){var O=-1,N=h==null?0:h.length;for(this.clear();++O<N;){var W=h[O];this.set(W[0],W[1])}}function We(){this.__data__=ke?ke(null):{},this.size=0}function et(h){var O=this.has(h)&&delete this.__data__[h];return this.size-=O?1:0,O}function _e(h){var O=this.__data__;if(ke){var N=O[h];return N===r?void 0:N}return Xe.call(O,h)?O[h]:void 0}function rn(h){var O=this.__data__;return ke?O[h]!==void 0:Xe.call(O,h)}function Zr(h,O){var N=this.__data__;return this.size+=this.has(h)?0:1,N[h]=ke&&O===void 0?r:O,this}$e.prototype.clear=We,$e.prototype.delete=et,$e.prototype.get=_e,$e.prototype.has=rn,$e.prototype.set=Zr;function pt(h){var O=-1,N=h==null?0:h.length;for(this.clear();++O<N;){var W=h[O];this.set(W[0],W[1])}}function nr(){this.__data__=[],this.size=0}function rr(h){var O=this.__data__,N=sr(O,h);if(N<0)return!1;var W=O.length-1;return N==W?O.pop():tn.call(O,N,1),--this.size,!0}function or(h){var O=this.__data__,N=sr(O,h);return N<0?void 0:O[N][1]}function we(h){return sr(this.__data__,h)>-1}function wt(h,O){var N=this.__data__,W=sr(N,h);return W<0?(++this.size,N.push([h,O])):N[W][1]=O,this}pt.prototype.clear=nr,pt.prototype.delete=rr,pt.prototype.get=or,pt.prototype.has=we,pt.prototype.set=wt;function _t(h){var O=-1,N=h==null?0:h.length;for(this.clear();++O<N;){var W=h[O];this.set(W[0],W[1])}}function on(){this.size=0,this.__data__={hash:new $e,map:new(xe||pt),string:new $e}}function Qr(h){var O=ar(this,h).delete(h);return this.size-=O?1:0,O}function Fn(h){return ar(this,h).get(h)}function il(h){return ar(this,h).has(h)}function sl(h,O){var N=ar(this,h),W=N.size;return N.set(h,O),this.size+=N.size==W?0:1,this}_t.prototype.clear=on,_t.prototype.delete=Qr,_t.prototype.get=Fn,_t.prototype.has=il,_t.prototype.set=sl;function ir(h){var O=-1,N=h==null?0:h.length;for(this.__data__=new _t;++O<N;)this.add(h[O])}function al(h){return this.__data__.set(h,r),this}function cl(h){return this.__data__.has(h)}ir.prototype.add=ir.prototype.push=al,ir.prototype.has=cl;function Ut(h){var O=this.__data__=new pt(h);this.size=O.size}function ll(){this.__data__=new pt,this.size=0}function ul(h){var O=this.__data__,N=O.delete(h);return this.size=O.size,N}function dl(h){return this.__data__.get(h)}function pl(h){return this.__data__.has(h)}function fl(h,O){var N=this.__data__;if(N instanceof pt){var W=N.__data__;if(!xe||W.length<n-1)return W.push([h,O]),this.size=++N.size,this;N=this.__data__=new _t(W)}return N.set(h,O),this.size=N.size,this}Ut.prototype.clear=ll,Ut.prototype.delete=ul,Ut.prototype.get=dl,Ut.prototype.has=pl,Ut.prototype.set=fl;function ml(h,O){var N=cr(h),W=!N&&Tl(h),be=!N&&!W&&eo(h),ce=!N&&!W&&!be&&Pi(h),Te=N||W||be||ce,Ve=Te?je(h.length,String):[],Je=Ve.length;for(var Ne in h)Xe.call(h,Ne)&&!(Te&&(Ne=="length"||be&&(Ne=="offset"||Ne=="parent")||ce&&(Ne=="buffer"||Ne=="byteLength"||Ne=="byteOffset")||Cl(Ne,Je)))&&Ve.push(Ne);return Ve}function sr(h,O){for(var N=h.length;N--;)if(Ni(h[N][0],O))return N;return-1}function hl(h,O,N){var W=O(h);return cr(h)?W:De(W,N(h))}function kn(h){return h==null?h===void 0?J:C:Ze&&Ze in Object(h)?bl(h):Nl(h)}function Ci(h){return Mn(h)&&kn(h)==a}function Oi(h,O,N,W,be){return h===O?!0:h==null||O==null||!Mn(h)&&!Mn(O)?h!==h&&O!==O:gl(h,O,N,W,Oi,be)}function gl(h,O,N,W,be,ce){var Te=cr(h),Ve=cr(O),Je=Te?c:Bt(h),Ne=Ve?c:Bt(O);Je=Je==a?v:Je,Ne=Ne==a?v:Ne;var ot=Je==v,bt=Ne==v,Ye=Je==Ne;if(Ye&&eo(h)){if(!eo(O))return!1;Te=!0,ot=!1}if(Ye&&!ot)return ce||(ce=new Ut),Te||Pi(h)?Ei(h,O,N,W,be,ce):wl(h,O,Je,N,W,be,ce);if(!(N&i)){var ft=ot&&Xe.call(h,"__wrapped__"),mt=bt&&Xe.call(O,"__wrapped__");if(ft||mt){var qt=ft?h.value():h,jt=mt?O.value():O;return ce||(ce=new Ut),be(qt,jt,N,W,ce)}}return Ye?(ce||(ce=new Ut),_l(h,O,N,W,be,ce)):!1}function vl(h){if(!Ai(h)||El(h))return!1;var O=Ti(h)?rt:j;return O.test(sn(h))}function yl(h){return Mn(h)&&Ri(h.length)&&!!R[kn(h)]}function Il(h){if(!Sl(h))return nn(h);var O=[];for(var N in Object(h))Xe.call(h,N)&&N!="constructor"&&O.push(N);return O}function Ei(h,O,N,W,be,ce){var Te=N&i,Ve=h.length,Je=O.length;if(Ve!=Je&&!(Te&&Je>Ve))return!1;var Ne=ce.get(h);if(Ne&&ce.get(O))return Ne==O;var ot=-1,bt=!0,Ye=N&o?new ir:void 0;for(ce.set(h,O),ce.set(O,h);++ot<Ve;){var ft=h[ot],mt=O[ot];if(W)var qt=Te?W(mt,ft,ot,O,h,ce):W(ft,mt,ot,h,O,ce);if(qt!==void 0){if(qt)continue;bt=!1;break}if(Ye){if(!Ue(O,function(jt,an){if(!gt(Ye,an)&&(ft===jt||be(ft,jt,N,W,ce)))return Ye.push(an)})){bt=!1;break}}else if(!(ft===mt||be(ft,mt,N,W,ce))){bt=!1;break}}return ce.delete(h),ce.delete(O),bt}function wl(h,O,N,W,be,ce,Te){switch(N){case Y:if(h.byteLength!=O.byteLength||h.byteOffset!=O.byteOffset)return!1;h=h.buffer,O=O.buffer;case z:return!(h.byteLength!=O.byteLength||!ce(new $t(h),new $t(O)));case d:case f:case w:return Ni(+h,+O);case m:return h.name==O.name&&h.message==O.message;case _:case L:return h==O+"";case I:var Ve=nt;case E:var Je=W&i;if(Ve||(Ve=yt),h.size!=O.size&&!Je)return!1;var Ne=Te.get(h);if(Ne)return Ne==O;W|=o,Te.set(h,O);var ot=Ei(Ve(h),Ve(O),W,be,ce,Te);return Te.delete(h),ot;case T:if(Qe)return Qe.call(h)==Qe.call(O)}return!1}function _l(h,O,N,W,be,ce){var Te=N&i,Ve=Si(h),Je=Ve.length,Ne=Si(O),ot=Ne.length;if(Je!=ot&&!Te)return!1;for(var bt=Je;bt--;){var Ye=Ve[bt];if(!(Te?Ye in O:Xe.call(O,Ye)))return!1}var ft=ce.get(h);if(ft&&ce.get(O))return ft==O;var mt=!0;ce.set(h,O),ce.set(O,h);for(var qt=Te;++bt<Je;){Ye=Ve[bt];var jt=h[Ye],an=O[Ye];if(W)var Di=Te?W(an,jt,Ye,O,h,ce):W(jt,an,Ye,h,O,ce);if(!(Di===void 0?jt===an||be(jt,an,N,W,ce):Di)){mt=!1;break}qt||(qt=Ye=="constructor")}if(mt&&!qt){var lr=h.constructor,ur=O.constructor;lr!=ur&&"constructor"in h&&"constructor"in O&&!(typeof lr=="function"&&lr instanceof lr&&typeof ur=="function"&&ur instanceof ur)&&(mt=!1)}return ce.delete(h),ce.delete(O),mt}function Si(h){return hl(h,Pl,xl)}function ar(h,O){var N=h.__data__;return Ol(O)?N[typeof O=="string"?"string":"hash"]:N.map}function wn(h,O){var N=Be(h,O);return vl(N)?N:void 0}function bl(h){var O=Xe.call(h,Ze),N=h[Ze];try{h[Ze]=void 0;var W=!0}catch{}var be=Kt.call(h);return W&&(O?h[Ze]=N:delete h[Ze]),be}var xl=Pt?function(h){return h==null?[]:(h=Object(h),Ie(Pt(h),function(O){return At.call(h,O)}))}:Dl,Bt=kn;(Ht&&Bt(new Ht(new ArrayBuffer(1)))!=Y||xe&&Bt(new xe)!=I||Ge&&Bt(Ge.resolve())!=x||te&&Bt(new te)!=E||ue&&Bt(new ue)!=q)&&(Bt=function(h){var O=kn(h),N=O==v?h.constructor:void 0,W=N?sn(N):"";if(W)switch(W){case Dt:return Y;case H:return I;case oe:return x;case ie:return E;case Re:return q}return O});function Cl(h,O){return O=O??s,!!O&&(typeof h=="number"||D.test(h))&&h>-1&&h%1==0&&h<O}function Ol(h){var O=typeof h;return O=="string"||O=="number"||O=="symbol"||O=="boolean"?h!=="__proto__":h===null}function El(h){return!!Tt&&Tt in h}function Sl(h){var O=h&&h.constructor,N=typeof O=="function"&&O.prototype||Fe;return h===N}function Nl(h){return Kt.call(h)}function sn(h){if(h!=null){try{return It.call(h)}catch{}try{return h+""}catch{}}return""}function Ni(h,O){return h===O||h!==h&&O!==O}var Tl=Ci(function(){return arguments}())?Ci:function(h){return Mn(h)&&Xe.call(h,"callee")&&!At.call(h,"callee")},cr=Array.isArray;function Rl(h){return h!=null&&Ri(h.length)&&!Ti(h)}var eo=Vt||jl;function Al(h,O){return Oi(h,O)}function Ti(h){if(!Ai(h))return!1;var O=kn(h);return O==p||O==y||O==l||O==b}function Ri(h){return typeof h=="number"&&h>-1&&h%1==0&&h<=s}function Ai(h){var O=typeof h;return h!=null&&(O=="object"||O=="function")}function Mn(h){return h!=null&&typeof h=="object"}var Pi=$?me($):yl;function Pl(h){return Rl(h)?ml(h):Il(h)}function Dl(){return[]}function jl(){return!1}e.exports=Al})(Cr,Cr.exports);var Hp=Cr.exports;const Up=$o(Hp),fn="other",Or="uninstall-installation";function zt(e){return!e.fieldName}function Bp(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function qp(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!zt(n)&&!!n.fieldName))||null}function Wp(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>zt(r)&&!!r.mapToName))||[]}function Jp(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!zt(n)&&!!n.fieldName))||null}const Qs=(e,t)=>{var n,r,i;return(i=(r=(n=e==null?void 0:e.content)==null?void 0:n.read)==null?void 0:r.objects)==null?void 0:i[t]};function zp(e){return zt(e)?e.mapToName:e.fieldName}const ea=(e,t)=>{var r,i,o;const n=[];return(o=(i=(r=t.content)==null?void 0:r.read)==null?void 0:i.objects)==null||o.forEach(s=>{n.push({name:s==null?void 0:s.objectName,displayName:(s==null?void 0:s.mapToDisplayName)||(s==null?void 0:s.displayName)||(s==null?void 0:s.objectName)&&Bn(s==null?void 0:s.objectName),completed:e?!!Qs(e,s.objectName):!1})}),n},ta=e=>{var n;return{name:fn,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function Xp(e,t){var o;const n=ea(e,t),i=!!((o=t==null?void 0:t.content)!=null&&o.write)?ta(e):void 0;return i&&n.push(i),n}function na(e,t,n){const r=(e==null?void 0:e.filter(o=>!(t!=null&&t[o==null?void 0:o.mapToName])))||[],i=r.map(o=>o.mapToName);return n(Ce.MAPPING,i),r!=null&&r.length&&console.error("required fields not met",r.map(o=>o.mapToDisplayName)),{errorList:i}}function Vo(e,t){return Up(e,t)}const Gp=(e,t,n)=>{var p,y,I,w,C,v;if(!e)return null;const r=Bp(e,t),i=r&&qp(r),o=r&&Jp(r),s=r&&Wp(r),a=(r==null?void 0:r.allFields)||[],c=n==null?void 0:n.content,l=((I=(y=(p=c==null?void 0:c.read)==null?void 0:p.objects)==null?void 0:y[t])==null?void 0:I.selectedFields)||{},d=((v=(C=(w=c==null?void 0:c.read)==null?void 0:w.objects)==null?void 0:C[t])==null?void 0:v.selectedFieldMappings)||{},f={...l},m={...d};return{allFields:a,requiredFields:i,optionalFields:o,requiredMapFields:s,selectedOptionalFields:l,selectedFieldMappings:d,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,savedConfig:{optionalFields:f,requiredMapFields:m}}},Yp=(e,t)=>{var s,a;if(!e)return null;const n=(a=(s=t==null?void 0:t.content)==null?void 0:s.write)==null?void 0:a.objects,r=Object.keys(n||{}),i={};r.forEach(c=>{i[c]=!0});const o={...i};return{writeObjects:(e==null?void 0:e.objects)||[],selectedNonConfigurableWriteFields:i,isWriteModified:!1,savedConfig:{selectedNonConfigurableWriteFields:o}}};function ra(e,t,n){var o,s;const r=(o=e==null?void 0:e.content)==null?void 0:o.read,i=(s=e==null?void 0:e.content)==null?void 0:s.write;return{read:Gp(r,t,n),write:Yp(i,n)}}const oa=(e,t,n,r)=>{const i=ra(e,n,t);r(n,i)},Zp=(e,t,n)=>{const r=Xp(t,e),i={};r.forEach(({name:o,completed:s})=>{s&&(i[o]=ra(e,o,t))}),n(i)},ia=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(o=>r.add(zp(o))),{...Array.from(r).reduce((o,s)=>({...o,[s]:!0}),{}),...n||{}}},sa=e=>{const{selectedFieldMappings:t}=(e==null?void 0:e.read)||{},n={};return t&&Object.keys(t).forEach(r=>{t[r]!==void 0?n[r]=t[r]||"":console.warn(`Error undefined when generating selectedRequiredMapFieldsSubmit for key: ${r}`)}),n};function aa(e,t){return t[e]||void 0}async function Ho({createConfig:e,projectId:t,integrationId:n,groupRef:r,connectionId:i,apiKey:o,setError:s,setInstallation:a,onInstallSuccess:c}){const l={projectIdOrName:t,integrationId:n,installation:{groupRef:r,connectionId:i,config:e}};try{const d=await Oe().installationApi.createInstallation(l,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}});a(d),c==null||c(d.id,d.config)}catch(d){ze(d,s)}}function $r(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const Qp=(e,t)=>{const n=e.content.read,r=n==null?void 0:n.objects;return r==null?void 0:r.find(i=>i.objectName===t)},ef=(e,t,n,r)=>{const i=ia(e),o=sa(e),s=Qp(n,t);if(!s)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const a={revisionId:n.id,createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,schedule:s.schedule,destination:s.destination,selectedFields:i,selectedFieldMappings:o,backfill:s.backfill}}}}};return $r(n)&&(a.content.proxy={enabled:!0}),a},tf=(e,t,n,r,i,o,s,a,c,l,d,f)=>{const m=ef(c,o,a,r);return m?Ho({createConfig:m,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:s,setError:l,setInstallation:d,onInstallSuccess:f}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},ca=e=>{var o,s;const t={},n=(o=e.write)==null?void 0:o.writeObjects,r=(s=e.write)==null?void 0:s.selectedNonConfigurableWriteFields,i=r?Object.keys(r):[];return n&&n.forEach(a=>{const c=a.objectName;i.includes(c)&&(t[c]={objectName:c})}),t},nf=e=>{const t=e.content.write;return t==null?void 0:t.objects},rf=(e,t,n)=>{if(!nf(t))return console.error("Error when getting write objects from hydratedRevision"),null;const i=ca(e),o={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:i}}};return $r(t)&&(o.content.proxy={enabled:!0}),o},of=(e,t,n,r,i,o,s,a,c,l,d)=>{const f=rf(a,s,r);return f?Ho({createConfig:f,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:o,setError:c,setInstallation:l,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},sf={backgroundColor:"var(--amp-colors-status-critical-muted)",borderColor:"var(--amp-colors-status-critical-muted)",color:"var(--amp-colors-status-critical-dark)",padding:".5rem 1rem"};function la({children:e,style:t}){return u.jsx(Zt,{style:{...sf,...t},children:e})}var ua={exports:{}};/*!
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),g=require("react");require("react-dom");function kl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const V=kl(g),Rs=g.createContext(null),Ml=Rs.Provider,He=()=>{const e=g.useContext(Rs);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var Ce=(e=>(e.MAPPING="mappingError",e.INTEGRATION_LIST="integrationListError",e.PROJECT="projectError",e.CONNECTION_LIST="connectionListError",e.HYDRATED_REVISION="hydratedRevisionError",e.INSTALLATION_LIST="installationListError",e.INSTALLATION_MUTATION="installationMutationError",e))(Ce||{});const As=g.createContext(void 0);function Yt(){const e=g.useContext(As);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Ll=(()=>{const e={};return Object.values(Ce).forEach(t=>{e[t]={}}),e})();function Kl({children:e}){const[t,n]=g.useState(Ll),r=g.useCallback((d,f,m=!0)=>{n(p=>{const y={...p};return y[d]=y[d]||{},y[d][f]=m,y})},[n]),i=g.useCallback((d,f)=>{var m;return!!((m=t[d])!=null&&m[f])},[t]),o=g.useCallback((d,f)=>{var m;return(m=t[d])==null?void 0:m[f]},[t]),s=g.useCallback((d,f)=>{n(m=>{var y;const p={...m};return(y=p[d])==null||delete y[f],p})},[n]),a=g.useCallback(d=>{n(f=>{const m={...f};return m[d]={},m})},[n]),c=g.useCallback((d,f)=>{n(m=>{const p={...m};return p[d]=p[d]||{},f.forEach(y=>{p[d][y]=!0}),p})},[n]),l=g.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:i,removeError:s,resetBoundary:a,setErrors:c,getError:o}),[t,n,r,i,s,a,c,o]);return u.jsx(As.Provider,{value:l,children:e})}const $l="https://api.withampersand.com/v1".replace(/\/+$/,"");class Ps{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:$l}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||js}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const Vl=new Ps,Lr=class Lr{constructor(t=Vl){this.configuration=t,this.fetchApi=async(n,r)=>{let i={url:n,init:r};for(const s of this.middleware)s.pre&&(i=await s.pre({fetch:this.fetchApi,...i})||i);let o;try{o=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(s){for(const a of this.middleware)a.onError&&(o=await a.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:s,response:o?o.clone():void 0})||o);if(o===void 0)throw s instanceof Error?new Bl(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(o=await s.post({fetch:this.fetchApi,url:i.url,init:i.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const n=this.clone();return n.middleware=n.middleware.concat(...t),n}withPreMiddleware(...t){const n=t.map(r=>({pre:r}));return this.withMiddleware(...n)}withPostMiddleware(...t){const n=t.map(r=>({post:r}));return this.withMiddleware(...n)}isJsonMime(t){return t?Lr.jsonRegex.test(t):!1}async request(t,n){const{url:r,init:i}=await this.createFetchParams(t,n),o=await this.fetchApi(r,i);if(o&&o.status>=200&&o.status<300)return o;throw new Ds(o,"Response returned an error code")}async createFetchParams(t,n){let r=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(r+="?"+this.configuration.queryParamsStringify(t.query));const i=Object.assign({},this.configuration.headers,t.headers);Object.keys(i).forEach(l=>i[l]===void 0?delete i[l]:{});const o=typeof n=="function"?n:async()=>n,s={method:t.method,headers:i,body:t.body,credentials:this.configuration.credentials},a={...s,...await o({init:s,context:t})},c={...a,body:Ul(a.body)||a.body instanceof URLSearchParams||Hl(a.body)?a.body:JSON.stringify(a.body)};return{url:r,init:c}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};Lr.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let Et=Lr;function Hl(e){return typeof Blob<"u"&&e instanceof Blob}function Ul(e){return typeof FormData<"u"&&e instanceof FormData}class Ds extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class Bl extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class re extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function M(e,t){const n=e[t];return n!=null}function js(e,t=""){return Object.keys(e).map(n=>Fs(n,e[n],t)).filter(n=>n.length>0).join("&")}function Fs(e,t,n=""){const r=n+(n.length?`[${e}]`:e);if(t instanceof Array){const i=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(r)}=`);return`${encodeURIComponent(r)}=${i}`}if(t instanceof Set){const i=Array.from(t);return Fs(e,i,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?js(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function Lo(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class Ae{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class pn{constructor(t){this.raw=t}async value(){}}class ql{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function Wl(e){return Jl(e)}function Jl(e,t){return e==null?e:{fieldUsed:M(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:M(e,"keyFormat")?e.keyFormat:void 0}}function zl(e){return Xl(e)}function Xl(e,t){return e==null?e:{name:e.name,valuePrefix:M(e,"valuePrefix")?e.valuePrefix:void 0}}function Gl(e){return Yl(e)}function Yl(e,t){return e==null?e:{name:e.name}}function Zl(e){return Ql(e)}function Ql(e,t){return e==null?e:{attachmentType:e.attachmentType,query:M(e,"query")?Gl(e.query):void 0,header:M(e,"header")?zl(e.header):void 0,docsURL:M(e,"docsURL")?e.docsURL:void 0}}function eu(e){return tu(e)}function tu(e,t){return e}function nu(e){return ru(e)}function ru(e,t){return e==null?e:{days:M(e,"days")?e.days:void 0,fullHistory:M(e,"fullHistory")?e.fullHistory:void 0}}function ou(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function ks(e){return iu(e)}function iu(e,t){return e==null?e:{defaultPeriod:nu(e.defaultPeriod)}}function su(e){if(e!==void 0)return e===null?null:{defaultPeriod:ou(e.defaultPeriod)}}function au(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function cu(e){if(e!==void 0)return e===null?null:{defaultPeriod:au(e.defaultPeriod)}}function lu(e){return uu(e)}function uu(e,t){return e==null?e:{enabled:M(e,"enabled")?e.enabled:void 0}}function Ms(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function du(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:cu(e.backfill)}}function pu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Lo(e.objects,du)}}function fu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName}}function mu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Lo(e.objects,fu)}}function hu(e){return gu(e)}function gu(e,t){return e==null?e:{apiKeyAsBasic:M(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:M(e,"apiKeyAsBasicOpts")?Wl(e.apiKeyAsBasicOpts):void 0,docsURL:M(e,"docsURL")?e.docsURL:void 0}}function vu(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function dr(e){return yu(e)}function yu(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:M(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function Iu(e){return wu(e)}function wu(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function _u(e){return bu(e)}function bu(e,t){return e==null?e:{provider:e.provider,read:M(e,"read")?e.read:void 0,write:M(e,"write")?e.write:void 0,proxy:M(e,"proxy")?lu(e.proxy):void 0}}function Ls(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:e.read,write:e.write,proxy:Ms(e.proxy)}}function xu(e){return Cu(e)}function Cu(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:_u(e.content)}}function Ou(e){return Eu(e)}function Eu(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function Ks(e){return Su(e)}function Su(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function Ir(e){return Nu(e)}function Nu(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:M(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:M(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function wr(e){return Tu(e)}function Tu(e,t){return e==null?e:{id:e.id,projectId:e.projectId,providerApp:Ir(e.providerApp),group:Ks(e.group),consumer:Ou(e.consumer),providerWorkspaceRef:e.providerWorkspaceRef,providerConsumerRef:M(e,"ProviderConsumerRef")?e.ProviderConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function Ru(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Ls(e.content)}}function Au(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:Ru(e.config)}}function Pu(e){return Du(e)}function Du(e,t){return e==null?e:{enabled:M(e,"enabled")?e.enabled:void 0}}function ju(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Fu(e){return ku(e)}function ku(e,t){return e==null?e:{mode:M(e,"mode")?e.mode:void 0,pageSize:M(e,"pageSize")?e.pageSize:void 0}}function Mu(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Lu(e){let t=!0;return t=t&&"fieldName"in e,t}function Ku(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:M(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:M(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function $u(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Vu(e){let t=!0;return t=t&&"mapToName"in e,t}function $s(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:M(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:M(e,"default")?e.default:void 0,prompt:M(e,"prompt")?e.prompt:void 0}}function Hu(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Fi(e){return Uu(e)}function Uu(e,t){return e==null?e:{...Ku(e),...$s(e)}}function ki(e){if(e!==void 0)return e===null?null:Lu(e)?$u(e):Vu(e)?Hu(e):{}}function Vs(e){return Bu(e)}function Bu(e,t){return e}function qu(e){return Wu(e)}function Wu(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:M(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:M(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:M(e,"requiredFields")?e.requiredFields.map(Fi):void 0,optionalFields:M(e,"optionalFields")?e.optionalFields.map(Fi):void 0,optionalFieldsAuto:M(e,"optionalFieldsAuto")?Vs(e.optionalFieldsAuto):void 0,backfill:M(e,"backfill")?ks(e.backfill):void 0,delivery:M(e,"delivery")?Fu(e.delivery):void 0}}function Ju(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,requiredFields:e.requiredFields===void 0?void 0:e.requiredFields.map(ki),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(ki),optionalFieldsAuto:e.optionalFieldsAuto,backfill:su(e.backfill),delivery:Mu(e.delivery)}}function zu(e){return Xu(e)}function Xu(e,t){return e==null?e:{objects:M(e,"objects")?e.objects.map(qu):void 0}}function Gu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Ju)}}function Yu(e){return Zu(e)}function Zu(e,t){return e==null?e:{objectName:e.objectName,inheritMappingFromRead:M(e,"inheritMappingFromRead")?e.inheritMappingFromRead:void 0}}function Qu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMappingFromRead:e.inheritMappingFromRead}}function ed(e){return td(e)}function td(e,t){return e==null?e:{objects:M(e,"objects")?e.objects.map(Yu):void 0}}function nd(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Qu)}}function rd(e){return od(e)}function od(e,t){return e==null?e:{name:e.name,displayName:M(e,"displayName")?e.displayName:void 0,provider:e.provider,read:M(e,"read")?zu(e.read):void 0,write:M(e,"write")?ed(e.write):void 0,proxy:M(e,"proxy")?Pu(e.proxy):void 0}}function id(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:Gu(e.read),write:nd(e.write),proxy:ju(e.proxy)}}function sd(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:id(e.content)}}function ad(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:sd(e.latestRevision)}}function cd(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function ld(e){if(e!==void 0)return e===null?null:{externalRef:e.externalRef,provider:e.provider,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function ud(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function dd(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function pd(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function fd(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function md(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:dd(e.basicAuth),oauth2ClientCredentials:pd(e.oauth2ClientCredentials),oauth2Password:fd(e.oauth2Password)}}function hd(e){return gd(e)}function gd(e,t){return e==null?e:{enabled:M(e,"enabled")?e.enabled:void 0}}function vd(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:M(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:M(e,"mapToDisplayName")?e.mapToDisplayName:void 0,displayName:e.displayName}}function to(e){return yd(e)}function yd(e,t){return e==null?e:{...vd(e),...$s(e)}}function Id(e){return wd(e)}function wd(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,mapToName:M(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:M(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:M(e,"requiredFields")?e.requiredFields.map(to):void 0,optionalFields:M(e,"optionalFields")?e.optionalFields.map(to):void 0,optionalFieldsAuto:M(e,"optionalFieldsAuto")?Vs(e.optionalFieldsAuto):void 0,allFields:M(e,"allFields")?e.allFields.map(to):void 0,backfill:M(e,"backfill")?ks(e.backfill):void 0}}function _d(e){return bd(e)}function bd(e,t){return e==null?e:{objects:M(e,"objects")?e.objects.map(Id):void 0}}function xd(e){return Cd(e)}function Cd(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName}}function Od(e){return Ed(e)}function Ed(e,t){return e==null?e:{objects:M(e,"objects")?e.objects.map(xd):void 0}}function Sd(e){return Nd(e)}function Nd(e,t){return e==null?e:{name:e.name,displayName:M(e,"displayName")?e.displayName:void 0,provider:e.provider,read:M(e,"read")?_d(e.read):void 0,write:M(e,"write")?Od(e.write):void 0,proxy:M(e,"proxy")?hd(e.proxy):void 0}}function Td(e){return Rd(e)}function Rd(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Sd(e.content)}}function Ad(e){if(e!==void 0)return e===null?null:{providerAppId:e.providerAppId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerWorkspaceRef:e.providerWorkspaceRef,providerConsumerRef:e.providerConsumerRef,refreshToken:e.refreshToken,scopes:e.scopes}}function Pd(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,content:Ls(e.content)}}function Dd(e){if(e!==void 0)return e===null?null:{provider:e.provider,connection:Ad(e.connection),config:Pd(e.config)}}function Ln(e){return jd(e)}function jd(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:M(e,"group")?Ks(e.group):void 0,healthStatus:e.healthStatus,connection:wr(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0,config:xu(e.config)}}function Fd(e){return kd(e)}function kd(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:rd(e.content)}}function Mi(e){return Md(e)}function Md(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:Fd(e.latestRevision)}}function Ld(e){return Kd(e)}function Kd(e,t){return e==null?e:{iconURL:M(e,"iconURL")?e.iconURL:void 0,logoURL:M(e,"logoURL")?e.logoURL:void 0}}function $d(e){return Vd(e)}function Vd(e,t){return e==null?e:{iconURL:M(e,"iconURL")?e.iconURL:void 0,logoURL:M(e,"logoURL")?e.logoURL:void 0}}function Hd(e){return Ud(e)}function Ud(e,t){return e==null?e:{regular:M(e,"regular")?$d(e.regular):void 0,darkMode:M(e,"darkMode")?Ld(e.darkMode):void 0}}function Bd(e){return qd(e)}function qd(e,t){return e==null?e:{workspaceRefField:M(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:M(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:M(e,"scopesField")?e.scopesField:void 0}}function Wd(e){return Jd(e)}function Jd(e,t){return e==null?e:{grantType:e.grantType,authURL:M(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:M(e,"audience")?e.audience:void 0,tokenMetadataFields:Bd(e.tokenMetadataFields),docsURL:M(e,"docsURL")?e.docsURL:void 0,authURLParams:M(e,"authURLParams")?e.authURLParams:void 0}}function zd(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,projectId:e.projectId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerAppId:e.providerAppId,provider:e.provider,enableCSRFProtection:e.enableCSRFProtection}}function Xd(e){return Gd(e)}function Gd(e,t){return e==null?e:{bulkWrite:Iu(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write}}function Li(e){return Yd(e)}function Yd(e,t){return e==null?e:{name:e.name,authType:eu(e.authType),baseURL:e.baseURL,oauth2Opts:M(e,"oauth2Opts")?Wd(e.oauth2Opts):void 0,apiKeyOpts:M(e,"apiKeyOpts")?Zl(e.apiKeyOpts):void 0,basicOpts:M(e,"basicOpts")?hu(e.basicOpts):void 0,support:Xd(e.support),providerOpts:e.providerOpts,displayName:M(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:M(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:M(e,"media")?Hd(e.media):void 0,labels:M(e,"labels")?e.labels:void 0}}function Zd(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:pu(e.read),write:mu(e.write),proxy:Ms(e.proxy)}}function Qd(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Zd(e.content)}}function ep(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:Qd(e.config)}}function tp(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:ep(e.installation)}}function np(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function rp(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:np(e.project)}}function op(e){if(e!==void 0)return e===null?null:{externalRef:e.externalRef,provider:e.provider,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function ip(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:op(e.providerApp)}}class sp extends Et{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"DELETE",headers:i,query:r},n);return new pn(o)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:md(t.generateConnectionParams)},n);return new Ae(o,s=>wr(s))}async generateConnection(t,n){return await(await this.generateConnectionRaw(t,n)).value()}async getConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>wr(s))}async getConnection(t,n){return await(await this.getConnectionRaw(t,n)).value()}async listConnectionsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>s.map(wr))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}}class ap extends Et{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new re("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:Au(t.installation)},n);return new Ae(o,s=>Ln(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new re("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"DELETE",headers:i,query:r},n);return new pn(o)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new re("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>Ln(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async importInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling importInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling importInstallation.");if(t.installation===null||t.installation===void 0)throw new re("installation","Required parameter requestParameters.installation was null or undefined when calling importInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations:import".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:Dd(t.installation)},n);return new Ae(o,s=>Ln(s))}async importInstallation(t,n){return await(await this.importInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>s.map(Ln))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new re("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new re("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"PATCH",headers:i,query:r,body:tp(t.installationUpdate)},n);return new Ae(o,s=>Ln(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class cp extends Et{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:i,query:r,body:vu(t.batchUpsertIntegrationsRequest)},n);return new Ae(o,s=>s.map(Mi))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new re("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:ad(t.integration)},n);return new pn(o)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:i,query:r},n);return new pn(o)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>s.map(Mi))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class lp extends Et{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new re("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},i={};i["Content-Type"]="application/json";const o=await this.request({path:"/oauth-connect",method:"POST",headers:i,query:r,body:zd(t.connectOAuthParams)},n);return this.isJsonMime(o.headers.get("content-type"))?new Ae(o):new ql(o)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}}class up extends Et{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new re("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects",method:"POST",headers:i,query:r,body:cd(t.project)},n);return new Ae(o,s=>dr(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async deleteProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:i,query:r},n);return new pn(o)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>dr(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new Ae(i,o=>o.map(dr))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new re("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:i,query:r,body:rp(t.projectUpdate)},n);return new Ae(o,s=>dr(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class dp extends Et{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new re("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>Li(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new Ae(i,o=>Lo(o,Li))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class pp extends Et{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new re("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:ld(t.providerApp)},n);return new Ae(o,s=>Ir(s))}async createProviderApp(t,n){return await(await this.createProviderAppRaw(t,n)).value()}async deleteProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new re("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:i,query:r},n);return new pn(o)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>s.map(Ir))}async listProviderApps(t,n){return await(await this.listProviderAppsRaw(t,n)).value()}async updateProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new re("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new re("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:i,query:r,body:ip(t.providerAppUpdate)},n);return new Ae(o,s=>Ir(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class fp extends Et{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:ud(t.revision)},n);return new pn(o)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new re("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions/{revisionId}:hydrate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{revisionId}",encodeURIComponent(String(t.revisionId))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>Td(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class mp{constructor(t){this.connectionApi=new sp(t),this.installationApi=new ap(t),this.integrationApi=new cp(t),this.oAuthApi=new lp(t),this.projectApi=new up(t),this.providerApi=new dp(t),this.providerAppApi=new pp(t),this.revisionApi=new fp(t)}}const hp="2.2.0",gp="v1",pr="https://api.withampersand.com";function Hs(){try{const e=process.env.REACT_APP_AMP_SERVER;switch(e){case"local":return"http://localhost:8080";case"dev":return"https://dev-api.withampersand.com";case"staging":return"https://staging-api.withampersand.com";case"prod":return pr;case"mock":return"http://127.0.0.1:4010";case"":return pr;default:return e??pr}}catch{return pr}}const vp=(e,t)=>`${e}/${t}`;function yp(){return vp(Hs(),gp)}const Ip=Hs(),wp=yp(),_p=new Ps({basePath:wp,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":hp}});let bp=new mp(_p);const Oe=()=>bp,ze=async(e,t)=>{var n;if(e instanceof Ds){const{status:r,statusText:i}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,i);const o=await e.response.json(),s=((n=o==null?void 0:o.causes)==null?void 0:n.join(`
2
+ `))||"[ERROR] Creating installation failed.";console.error("[Error Message]",s),t&&t(s)}else console.error("Unexpected error:",e.message)},Us=g.createContext({integrations:null,isLoading:!0}),Ko=()=>{const e=g.useContext(Us);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function xp({projectIdOrName:e,children:t}){const n=He(),{setError:r}=Yt(),[i,o]=g.useState(null),[s,a]=g.useState(!0);g.useEffect(()=>{Oe().integrationApi.listIntegrations({projectIdOrName:e},{headers:{"X-Api-Key":n??""}}).then(l=>{a(!1),o(l||[])}).catch(l=>{console.error("Error retrieving integration information."),ze(l),a(!1),r(Ce.INTEGRATION_LIST,e)})},[e,n,r]);const c=g.useMemo(()=>({integrations:i,isLoading:s}),[i,s]);return u.jsx(Us.Provider,{value:c,children:t})}const Bs=g.createContext({project:null,appName:"",projectId:"",projectIdOrName:"",isLoading:!0}),Pe=()=>{const e=g.useContext(Bs);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function Cp({projectIdOrName:e,children:t}){const n=He(),{setError:r}=Yt(),[i,o]=g.useState(null),[s,a]=g.useState(!0);g.useEffect(()=>{Oe().projectApi.getProject({projectIdOrName:e},{headers:{"X-Api-Key":n??""}}).then(l=>{a(!1),o(l)}).catch(l=>{console.error("Error loading Ampersand project."),ze(l),r(Ce.PROJECT,e),a(!1)})},[e,n,a,r]);const c=g.useMemo(()=>({projectId:(i==null?void 0:i.id)||"",projectIdOrName:e,project:i,appName:(i==null?void 0:i.appName)||"",isLoading:s}),[e,i,s]);return u.jsx(Bs.Provider,{value:c,children:t})}function Op(e){const{options:{apiKey:t,projectId:n,project:r},children:i}=e,o=r||n;if(n&&r)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!o)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t)throw new Error("Cannot use AmpersandProvider without an apiKey.");return u.jsx(Kl,{children:u.jsx(Ml,{value:t,children:u.jsx(Cp,{projectIdOrName:o,children:u.jsx(xp,{projectIdOrName:o,children:i})})})})}const qs=g.createContext(null);function Ep(){const e=g.useContext(qs);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
3
+ component is wrapped with AmpersandProvider`);return e}function Sp(){return u.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("path",{d:"M20.5796 7.72236L3.63955 36.0024C3.29029 36.6072 3.10549 37.293 3.10353 37.9914C3.10158 38.6898 3.28254 39.3766 3.62841 39.9834C3.97428 40.5902 4.473 41.0959 5.07497 41.4501C5.67693 41.8043 6.36115 41.9947 7.05955 42.0024H40.9396C41.638 41.9947 42.3222 41.8043 42.9241 41.4501C43.5261 41.0959 44.0248 40.5902 44.3707 39.9834C44.7166 39.3766 44.8975 38.6898 44.8956 37.9914C44.8936 37.293 44.7088 36.6072 44.3596 36.0024L27.4196 7.72236C27.063 7.13458 26.561 6.6486 25.9619 6.31133C25.3629 5.97406 24.687 5.79688 23.9996 5.79688C23.3121 5.79688 22.6362 5.97406 22.0372 6.31133C21.4381 6.6486 20.9361 7.13458 20.5796 7.72236Z",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}const Np="_box_1p7c5_1",Ki={box:Np};function Zt({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${Ki.box} ${t}`:Ki.box,style:n,children:e})}const Tp="_container_1wvzr_1",$i={container:Tp};function Pn({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${$i.container} ${t}`:$i.container,style:n,children:e})}const Rp="_errorBoxContainer_4sdb2_1",Ap="_errorBox_4sdb2_1",Pp="_errorText_4sdb2_20",no={errorBoxContainer:Rp,errorBox:Ap,errorText:Pp};function Ws({message:e}){return u.jsxs(Pn,{className:no.errorBoxContainer,children:[u.jsx(Sp,{}),u.jsx(Zt,{className:no.errorBox,children:u.jsx("p",{className:no.errorText,children:e})})]})}const Dp="_loader_6ubm6_1",jp="_rotate_6ubm6_1",Fp="_ball1_6ubm6_1",kp="_ball2_6ubm6_1",Mp={loader:Dp,rotate:jp,ball1:Fp,ball2:kp};function Lp(){return u.jsx("span",{className:Mp.loader})}function Un(){return u.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:u.jsx(Lp,{})})}function Js({children:e}){return u.jsx(Pn,{style:{maxWidth:"55rem"},children:u.jsx(Zt,{children:e})})}function Kr(){return u.jsx(Js,{children:u.jsx(Un,{})})}function Lt({message:e}){return u.jsx(Js,{children:u.jsx(Ws,{message:e})})}const zs=()=>{const[e,t]=g.useState(!1),n=g.useCallback(()=>{t(!0)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n}};function $o(e,t){try{return process.env[e]}catch{return t}}function Bn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Qt(e,t){return(t==null?void 0:t.displayName)??Bn(e)}const Kp=e=>e.split(`
4
+ `).filter(n=>n.trim()!==""),$p=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,Xs=g.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0,onUninstallSuccess:void 0,isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}});function dt(){const e=g.useContext(Xs);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function Vp({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,fieldMapping:l}){const d=He(),{projectId:f}=Pe(),{integrations:m}=Ko(),{setError:p,isError:y}=Yt(),{isIntegrationDeleted:I,setIntegrationDeleted:w}=zs(),[C,v]=g.useState([]),[x,b]=g.useState(!0),_=(C==null?void 0:C[0])||null,E=g.useMemo(()=>$p(t,m||[]),[t,m]);g.useEffect(()=>{E===null&&(m!=null&&m.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,E,m]);const L=g.useCallback(z=>{v([z])},[v]),T=g.useCallback(()=>{E!=null&&E.id&&Oe().installationApi.listInstallations({projectIdOrName:f,integrationId:E.id,groupRef:i},{headers:{"X-Api-Key":d??""}}).then(z=>{b(!1),v(z||[])}).catch(z=>{p(Ce.INSTALLATION_LIST,E.id),b(!1),console.error("Error retrieving installation information: ",z)})},[E,f,d,p,i]),J=(E==null?void 0:E.id)||"";g.useEffect(()=>{T()},[T]);const q=g.useMemo(()=>({integrationId:(E==null?void 0:E.id)||"",provider:(E==null?void 0:E.provider)||"",integrationObj:E,consumerRef:n,consumerName:r,groupRef:i,groupName:o,installation:_,setInstallation:L,resetInstallations:T,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,isIntegrationDeleted:I,setIntegrationDeleted:w,fieldMapping:l}),[E,n,r,i,o,_,L,T,s,a,c,I,w,l]);if(x)return u.jsx(Kr,{});if(E===null)return u.jsx(Lt,{message:`Integration "${t}" not found`});if(y(Ce.INSTALLATION_LIST,J)){const z=`Error retrieving installation information for integration "${(E==null?void 0:E.name)||"unknown"}"`;return u.jsx(Lt,{message:z})}return u.jsx(Xs.Provider,{value:q,children:e})}const Gs=g.createContext({connections:null,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{},isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}}),yn=()=>{const e=g.useContext(Gs);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function Ys({provider:e,groupRef:t,children:n}){const r=He(),{projectId:i,isLoading:o}=Pe(),[s,a]=g.useState(null),[c,l]=g.useState(null),[d,f]=g.useState(!0),{setError:m,isError:p}=Yt(),{provider:y}=dt(),{isIntegrationDeleted:I,setIntegrationDeleted:w}=zs(),C=e||y;if(!C)throw new Error("ConnectionsProvider must be given a provider prop or be used within InstallIntegrationProvider");g.useEffect(()=>{i&&r&&Oe().connectionApi.listConnections({projectIdOrName:i,groupRef:t,provider:C},{headers:{"X-Api-Key":r??""}}).then(x=>{f(!1),a(x)}).catch(x=>{console.error(`Error retrieving existing OAuth connections for group ID ${t}.`),ze(x),f(!1),m(Ce.CONNECTION_LIST,i)})},[i,r,t,C,m]);const v=g.useMemo(()=>({connections:s,selectedConnection:c,setConnections:a,setSelectedConnection:l,isIntegrationDeleted:I,setIntegrationDeleted:w}),[s,c,a,l,I,w]);if(d||o)return u.jsx(Kr,{});if(p(Ce.PROJECT,i))return u.jsx(Lt,{message:`Error loading project ${i}`});if(p(Ce.CONNECTION_LIST,i))return u.jsx(Lt,{message:"Error retrieving existing connections"});if(!i)throw new Error("Project ID not found. ConnectionsProvider must be used within AmpersandProvider");return u.jsx(Gs.Provider,{value:v,children:n})}function Zs(){const[e,t]=g.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}const Hp="_resetContainer_lkwv9_4",Qs={resetContainer:Hp};var fr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Vo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Cr={exports:{}};Cr.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=1,o=2,s=9007199254740991,a="[object Arguments]",c="[object Array]",l="[object AsyncFunction]",d="[object Boolean]",f="[object Date]",m="[object Error]",p="[object Function]",y="[object GeneratorFunction]",I="[object Map]",w="[object Number]",C="[object Null]",v="[object Object]",x="[object Promise]",b="[object Proxy]",_="[object RegExp]",E="[object Set]",L="[object String]",T="[object Symbol]",J="[object Undefined]",q="[object WeakMap]",z="[object ArrayBuffer]",Y="[object DataView]",ee="[object Float32Array]",U="[object Float64Array]",se="[object Int8Array]",ne="[object Int16Array]",Q="[object Int32Array]",de="[object Uint8Array]",fe="[object Uint8ClampedArray]",S="[object Uint16Array]",P="[object Uint32Array]",k=/[\\^$.*+?()[\]{}|]/g,j=/^\[object .+?Constructor\]$/,D=/^(?:0|[1-9]\d*)$/,R={};R[ee]=R[U]=R[se]=R[ne]=R[Q]=R[de]=R[fe]=R[S]=R[P]=!0,R[a]=R[c]=R[z]=R[d]=R[Y]=R[f]=R[m]=R[p]=R[I]=R[w]=R[v]=R[_]=R[E]=R[L]=R[q]=!1;var X=typeof fr=="object"&&fr&&fr.Object===Object&&fr,G=typeof self=="object"&&self&&self.Object===Object&&self,K=X||G||Function("return this")(),Z=t&&!t.nodeType&&t,B=Z&&!0&&e&&!e.nodeType&&e,ae=B&&B.exports===Z,A=ae&&X.process,pe=function(){try{return A&&A.binding&&A.binding("util")}catch{}}(),$=pe&&pe.isTypedArray;function Ie(h,O){for(var N=-1,W=h==null?0:h.length,be=0,ce=[];++N<W;){var Te=h[N];O(Te,N,h)&&(ce[be++]=Te)}return ce}function De(h,O){for(var N=-1,W=O.length,be=h.length;++N<W;)h[be+N]=O[N];return h}function Ue(h,O){for(var N=-1,W=h==null?0:h.length;++N<W;)if(O(h[N],N,h))return!0;return!1}function je(h,O){for(var N=-1,W=Array(h);++N<h;)W[N]=O(N);return W}function me(h){return function(O){return h(O)}}function gt(h,O){return h.has(O)}function Be(h,O){return h==null?void 0:h[O]}function nt(h){var O=-1,N=Array(h.size);return h.forEach(function(W,be){N[++O]=[be,W]}),N}function vt(h,O){return function(N){return h(O(N))}}function yt(h){var O=-1,N=Array(h.size);return h.forEach(function(W){N[++O]=W}),N}var qe=Array.prototype,Ke=Function.prototype,Fe=Object.prototype,Ee=K["__core-js_shared__"],It=Ke.toString,Xe=Fe.hasOwnProperty,Tt=function(){var h=/[^.]+$/.exec(Ee&&Ee.keys&&Ee.keys.IE_PROTO||"");return h?"Symbol(src)_1."+h:""}(),Kt=Fe.toString,rt=RegExp("^"+It.call(Xe).replace(k,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Se=ae?K.Buffer:void 0,Rt=K.Symbol,$t=K.Uint8Array,At=Fe.propertyIsEnumerable,tn=qe.splice,Ze=Rt?Rt.toStringTag:void 0,Pt=Object.getOwnPropertySymbols,Vt=Se?Se.isBuffer:void 0,nn=vt(Object.keys,Object),Ht=wn(K,"DataView"),xe=wn(K,"Map"),Ge=wn(K,"Promise"),te=wn(K,"Set"),ue=wn(K,"WeakMap"),ke=wn(Object,"create"),Dt=sn(Ht),H=sn(xe),oe=sn(Ge),ie=sn(te),Re=sn(ue),Me=Rt?Rt.prototype:void 0,Qe=Me?Me.valueOf:void 0;function $e(h){var O=-1,N=h==null?0:h.length;for(this.clear();++O<N;){var W=h[O];this.set(W[0],W[1])}}function We(){this.__data__=ke?ke(null):{},this.size=0}function et(h){var O=this.has(h)&&delete this.__data__[h];return this.size-=O?1:0,O}function _e(h){var O=this.__data__;if(ke){var N=O[h];return N===r?void 0:N}return Xe.call(O,h)?O[h]:void 0}function rn(h){var O=this.__data__;return ke?O[h]!==void 0:Xe.call(O,h)}function Zr(h,O){var N=this.__data__;return this.size+=this.has(h)?0:1,N[h]=ke&&O===void 0?r:O,this}$e.prototype.clear=We,$e.prototype.delete=et,$e.prototype.get=_e,$e.prototype.has=rn,$e.prototype.set=Zr;function pt(h){var O=-1,N=h==null?0:h.length;for(this.clear();++O<N;){var W=h[O];this.set(W[0],W[1])}}function nr(){this.__data__=[],this.size=0}function rr(h){var O=this.__data__,N=sr(O,h);if(N<0)return!1;var W=O.length-1;return N==W?O.pop():tn.call(O,N,1),--this.size,!0}function or(h){var O=this.__data__,N=sr(O,h);return N<0?void 0:O[N][1]}function we(h){return sr(this.__data__,h)>-1}function wt(h,O){var N=this.__data__,W=sr(N,h);return W<0?(++this.size,N.push([h,O])):N[W][1]=O,this}pt.prototype.clear=nr,pt.prototype.delete=rr,pt.prototype.get=or,pt.prototype.has=we,pt.prototype.set=wt;function _t(h){var O=-1,N=h==null?0:h.length;for(this.clear();++O<N;){var W=h[O];this.set(W[0],W[1])}}function on(){this.size=0,this.__data__={hash:new $e,map:new(xe||pt),string:new $e}}function Qr(h){var O=ar(this,h).delete(h);return this.size-=O?1:0,O}function Fn(h){return ar(this,h).get(h)}function sl(h){return ar(this,h).has(h)}function al(h,O){var N=ar(this,h),W=N.size;return N.set(h,O),this.size+=N.size==W?0:1,this}_t.prototype.clear=on,_t.prototype.delete=Qr,_t.prototype.get=Fn,_t.prototype.has=sl,_t.prototype.set=al;function ir(h){var O=-1,N=h==null?0:h.length;for(this.__data__=new _t;++O<N;)this.add(h[O])}function cl(h){return this.__data__.set(h,r),this}function ll(h){return this.__data__.has(h)}ir.prototype.add=ir.prototype.push=cl,ir.prototype.has=ll;function Ut(h){var O=this.__data__=new pt(h);this.size=O.size}function ul(){this.__data__=new pt,this.size=0}function dl(h){var O=this.__data__,N=O.delete(h);return this.size=O.size,N}function pl(h){return this.__data__.get(h)}function fl(h){return this.__data__.has(h)}function ml(h,O){var N=this.__data__;if(N instanceof pt){var W=N.__data__;if(!xe||W.length<n-1)return W.push([h,O]),this.size=++N.size,this;N=this.__data__=new _t(W)}return N.set(h,O),this.size=N.size,this}Ut.prototype.clear=ul,Ut.prototype.delete=dl,Ut.prototype.get=pl,Ut.prototype.has=fl,Ut.prototype.set=ml;function hl(h,O){var N=cr(h),W=!N&&Rl(h),be=!N&&!W&&eo(h),ce=!N&&!W&&!be&&Di(h),Te=N||W||be||ce,Ve=Te?je(h.length,String):[],Je=Ve.length;for(var Ne in h)Xe.call(h,Ne)&&!(Te&&(Ne=="length"||be&&(Ne=="offset"||Ne=="parent")||ce&&(Ne=="buffer"||Ne=="byteLength"||Ne=="byteOffset")||Ol(Ne,Je)))&&Ve.push(Ne);return Ve}function sr(h,O){for(var N=h.length;N--;)if(Ti(h[N][0],O))return N;return-1}function gl(h,O,N){var W=O(h);return cr(h)?W:De(W,N(h))}function kn(h){return h==null?h===void 0?J:C:Ze&&Ze in Object(h)?xl(h):Tl(h)}function Oi(h){return Mn(h)&&kn(h)==a}function Ei(h,O,N,W,be){return h===O?!0:h==null||O==null||!Mn(h)&&!Mn(O)?h!==h&&O!==O:vl(h,O,N,W,Ei,be)}function vl(h,O,N,W,be,ce){var Te=cr(h),Ve=cr(O),Je=Te?c:Bt(h),Ne=Ve?c:Bt(O);Je=Je==a?v:Je,Ne=Ne==a?v:Ne;var ot=Je==v,bt=Ne==v,Ye=Je==Ne;if(Ye&&eo(h)){if(!eo(O))return!1;Te=!0,ot=!1}if(Ye&&!ot)return ce||(ce=new Ut),Te||Di(h)?Si(h,O,N,W,be,ce):_l(h,O,Je,N,W,be,ce);if(!(N&i)){var ft=ot&&Xe.call(h,"__wrapped__"),mt=bt&&Xe.call(O,"__wrapped__");if(ft||mt){var qt=ft?h.value():h,jt=mt?O.value():O;return ce||(ce=new Ut),be(qt,jt,N,W,ce)}}return Ye?(ce||(ce=new Ut),bl(h,O,N,W,be,ce)):!1}function yl(h){if(!Pi(h)||Sl(h))return!1;var O=Ri(h)?rt:j;return O.test(sn(h))}function Il(h){return Mn(h)&&Ai(h.length)&&!!R[kn(h)]}function wl(h){if(!Nl(h))return nn(h);var O=[];for(var N in Object(h))Xe.call(h,N)&&N!="constructor"&&O.push(N);return O}function Si(h,O,N,W,be,ce){var Te=N&i,Ve=h.length,Je=O.length;if(Ve!=Je&&!(Te&&Je>Ve))return!1;var Ne=ce.get(h);if(Ne&&ce.get(O))return Ne==O;var ot=-1,bt=!0,Ye=N&o?new ir:void 0;for(ce.set(h,O),ce.set(O,h);++ot<Ve;){var ft=h[ot],mt=O[ot];if(W)var qt=Te?W(mt,ft,ot,O,h,ce):W(ft,mt,ot,h,O,ce);if(qt!==void 0){if(qt)continue;bt=!1;break}if(Ye){if(!Ue(O,function(jt,an){if(!gt(Ye,an)&&(ft===jt||be(ft,jt,N,W,ce)))return Ye.push(an)})){bt=!1;break}}else if(!(ft===mt||be(ft,mt,N,W,ce))){bt=!1;break}}return ce.delete(h),ce.delete(O),bt}function _l(h,O,N,W,be,ce,Te){switch(N){case Y:if(h.byteLength!=O.byteLength||h.byteOffset!=O.byteOffset)return!1;h=h.buffer,O=O.buffer;case z:return!(h.byteLength!=O.byteLength||!ce(new $t(h),new $t(O)));case d:case f:case w:return Ti(+h,+O);case m:return h.name==O.name&&h.message==O.message;case _:case L:return h==O+"";case I:var Ve=nt;case E:var Je=W&i;if(Ve||(Ve=yt),h.size!=O.size&&!Je)return!1;var Ne=Te.get(h);if(Ne)return Ne==O;W|=o,Te.set(h,O);var ot=Si(Ve(h),Ve(O),W,be,ce,Te);return Te.delete(h),ot;case T:if(Qe)return Qe.call(h)==Qe.call(O)}return!1}function bl(h,O,N,W,be,ce){var Te=N&i,Ve=Ni(h),Je=Ve.length,Ne=Ni(O),ot=Ne.length;if(Je!=ot&&!Te)return!1;for(var bt=Je;bt--;){var Ye=Ve[bt];if(!(Te?Ye in O:Xe.call(O,Ye)))return!1}var ft=ce.get(h);if(ft&&ce.get(O))return ft==O;var mt=!0;ce.set(h,O),ce.set(O,h);for(var qt=Te;++bt<Je;){Ye=Ve[bt];var jt=h[Ye],an=O[Ye];if(W)var ji=Te?W(an,jt,Ye,O,h,ce):W(jt,an,Ye,h,O,ce);if(!(ji===void 0?jt===an||be(jt,an,N,W,ce):ji)){mt=!1;break}qt||(qt=Ye=="constructor")}if(mt&&!qt){var lr=h.constructor,ur=O.constructor;lr!=ur&&"constructor"in h&&"constructor"in O&&!(typeof lr=="function"&&lr instanceof lr&&typeof ur=="function"&&ur instanceof ur)&&(mt=!1)}return ce.delete(h),ce.delete(O),mt}function Ni(h){return gl(h,Dl,Cl)}function ar(h,O){var N=h.__data__;return El(O)?N[typeof O=="string"?"string":"hash"]:N.map}function wn(h,O){var N=Be(h,O);return yl(N)?N:void 0}function xl(h){var O=Xe.call(h,Ze),N=h[Ze];try{h[Ze]=void 0;var W=!0}catch{}var be=Kt.call(h);return W&&(O?h[Ze]=N:delete h[Ze]),be}var Cl=Pt?function(h){return h==null?[]:(h=Object(h),Ie(Pt(h),function(O){return At.call(h,O)}))}:jl,Bt=kn;(Ht&&Bt(new Ht(new ArrayBuffer(1)))!=Y||xe&&Bt(new xe)!=I||Ge&&Bt(Ge.resolve())!=x||te&&Bt(new te)!=E||ue&&Bt(new ue)!=q)&&(Bt=function(h){var O=kn(h),N=O==v?h.constructor:void 0,W=N?sn(N):"";if(W)switch(W){case Dt:return Y;case H:return I;case oe:return x;case ie:return E;case Re:return q}return O});function Ol(h,O){return O=O??s,!!O&&(typeof h=="number"||D.test(h))&&h>-1&&h%1==0&&h<O}function El(h){var O=typeof h;return O=="string"||O=="number"||O=="symbol"||O=="boolean"?h!=="__proto__":h===null}function Sl(h){return!!Tt&&Tt in h}function Nl(h){var O=h&&h.constructor,N=typeof O=="function"&&O.prototype||Fe;return h===N}function Tl(h){return Kt.call(h)}function sn(h){if(h!=null){try{return It.call(h)}catch{}try{return h+""}catch{}}return""}function Ti(h,O){return h===O||h!==h&&O!==O}var Rl=Oi(function(){return arguments}())?Oi:function(h){return Mn(h)&&Xe.call(h,"callee")&&!At.call(h,"callee")},cr=Array.isArray;function Al(h){return h!=null&&Ai(h.length)&&!Ri(h)}var eo=Vt||Fl;function Pl(h,O){return Ei(h,O)}function Ri(h){if(!Pi(h))return!1;var O=kn(h);return O==p||O==y||O==l||O==b}function Ai(h){return typeof h=="number"&&h>-1&&h%1==0&&h<=s}function Pi(h){var O=typeof h;return h!=null&&(O=="object"||O=="function")}function Mn(h){return h!=null&&typeof h=="object"}var Di=$?me($):Il;function Dl(h){return Al(h)?hl(h):wl(h)}function jl(){return[]}function Fl(){return!1}e.exports=Pl})(Cr,Cr.exports);var Up=Cr.exports;const Bp=Vo(Up),fn="other",Or="uninstall-installation";function zt(e){return!e.fieldName}function qp(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function Wp(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!zt(n)&&!!n.fieldName))||null}function Jp(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>zt(r)&&!!r.mapToName))||[]}function zp(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!zt(n)&&!!n.fieldName))||null}const ea=(e,t)=>{var n,r,i;return(i=(r=(n=e==null?void 0:e.content)==null?void 0:n.read)==null?void 0:r.objects)==null?void 0:i[t]};function Xp(e){return zt(e)?e.mapToName:e.fieldName}const ta=(e,t)=>{var r,i,o;const n=[];return(o=(i=(r=t.content)==null?void 0:r.read)==null?void 0:i.objects)==null||o.forEach(s=>{n.push({name:s==null?void 0:s.objectName,displayName:(s==null?void 0:s.mapToDisplayName)||(s==null?void 0:s.displayName)||(s==null?void 0:s.objectName)&&Bn(s==null?void 0:s.objectName),completed:e?!!ea(e,s.objectName):!1})}),n},na=e=>{var n;return{name:fn,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function Gp(e,t){var o;const n=ta(e,t),i=!!((o=t==null?void 0:t.content)!=null&&o.write)?na(e):void 0;return i&&n.push(i),n}function ra(e,t,n){const r=(e==null?void 0:e.filter(o=>!(t!=null&&t[o==null?void 0:o.mapToName])))||[],i=r.map(o=>o.mapToName);return n(Ce.MAPPING,i),r!=null&&r.length&&console.error("required fields not met",r.map(o=>o.mapToDisplayName)),{errorList:i}}function Ho(e,t){return Bp(e,t)}const Yp=(e,t,n)=>{var p,y,I,w,C,v;if(!e)return null;const r=qp(e,t),i=r&&Wp(r),o=r&&zp(r),s=r&&Jp(r),a=(r==null?void 0:r.allFields)||[],c=n==null?void 0:n.content,l=((I=(y=(p=c==null?void 0:c.read)==null?void 0:p.objects)==null?void 0:y[t])==null?void 0:I.selectedFields)||{},d=((v=(C=(w=c==null?void 0:c.read)==null?void 0:w.objects)==null?void 0:C[t])==null?void 0:v.selectedFieldMappings)||{},f={...l},m={...d};return{allFields:a,requiredFields:i,optionalFields:o,requiredMapFields:s,selectedOptionalFields:l,selectedFieldMappings:d,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,savedConfig:{optionalFields:f,requiredMapFields:m}}},Zp=(e,t)=>{var s,a;if(!e)return null;const n=(a=(s=t==null?void 0:t.content)==null?void 0:s.write)==null?void 0:a.objects,r=Object.keys(n||{}),i={};r.forEach(c=>{i[c]=!0});const o={...i};return{writeObjects:(e==null?void 0:e.objects)||[],selectedNonConfigurableWriteFields:i,isWriteModified:!1,savedConfig:{selectedNonConfigurableWriteFields:o}}};function oa(e,t,n){var o,s;const r=(o=e==null?void 0:e.content)==null?void 0:o.read,i=(s=e==null?void 0:e.content)==null?void 0:s.write;return{read:Yp(r,t,n),write:Zp(i,n)}}const ia=(e,t,n,r)=>{const i=oa(e,n,t);r(n,i)},Qp=(e,t,n)=>{const r=Gp(t,e),i={};r.forEach(({name:o,completed:s})=>{s&&(i[o]=oa(e,o,t))}),n(i)},sa=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(o=>r.add(Xp(o))),{...Array.from(r).reduce((o,s)=>({...o,[s]:!0}),{}),...n||{}}},aa=e=>{const{selectedFieldMappings:t}=(e==null?void 0:e.read)||{},n={};return t&&Object.keys(t).forEach(r=>{t[r]!==void 0?n[r]=t[r]||"":console.warn(`Error undefined when generating selectedRequiredMapFieldsSubmit for key: ${r}`)}),n};function ca(e,t){return t[e]||void 0}async function Uo({createConfig:e,projectId:t,integrationId:n,groupRef:r,connectionId:i,apiKey:o,setError:s,setInstallation:a,onInstallSuccess:c}){const l={projectIdOrName:t,integrationId:n,installation:{groupRef:r,connectionId:i,config:e}};try{const d=await Oe().installationApi.createInstallation(l,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}});a(d),c==null||c(d.id,d.config)}catch(d){ze(d,s)}}function $r(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const ef=(e,t)=>{const n=e.content.read,r=n==null?void 0:n.objects;return r==null?void 0:r.find(i=>i.objectName===t)},tf=(e,t,n,r)=>{const i=sa(e),o=aa(e),s=ef(n,t);if(!s)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const a={revisionId:n.id,createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,schedule:s.schedule,destination:s.destination,selectedFields:i,selectedFieldMappings:o,backfill:s.backfill}}}}};return $r(n)&&(a.content.proxy={enabled:!0}),a},nf=(e,t,n,r,i,o,s,a,c,l,d,f)=>{const m=tf(c,o,a,r);return m?Uo({createConfig:m,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:s,setError:l,setInstallation:d,onInstallSuccess:f}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},la=e=>{var o,s;const t={},n=(o=e.write)==null?void 0:o.writeObjects,r=(s=e.write)==null?void 0:s.selectedNonConfigurableWriteFields,i=r?Object.keys(r):[];return n&&n.forEach(a=>{const c=a.objectName;i.includes(c)&&(t[c]={objectName:c})}),t},rf=e=>{const t=e.content.write;return t==null?void 0:t.objects},of=(e,t,n)=>{if(!rf(t))return console.error("Error when getting write objects from hydratedRevision"),null;const i=la(e),o={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:i}}};return $r(t)&&(o.content.proxy={enabled:!0}),o},sf=(e,t,n,r,i,o,s,a,c,l,d)=>{const f=of(a,s,r);return f?Uo({createConfig:f,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:o,setError:c,setInstallation:l,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},af={backgroundColor:"var(--amp-colors-status-critical-muted)",borderColor:"var(--amp-colors-status-critical-muted)",color:"var(--amp-colors-status-critical-dark)",padding:".5rem 1rem"};function ua({children:e,style:t}){return u.jsx(Zt,{style:{...af,...t},children:e})}var da={exports:{}};/*!
5
5
  Copyright (c) 2018 Jed Watson.
6
6
  Licensed under the MIT License (MIT), see
7
7
  http://jedwatson.github.io/classnames
8
- */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var o="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(o=i(o,r(a)))}return o}function r(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return n.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var s="";for(var a in o)t.call(o,a)&&o[a]&&(s=i(s,a));return s}function i(o,s){return s?o?o+" "+s:o+s:o}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(ua);var af=ua.exports;const st=$o(af),cf="_button_1kk7v_1",lf="_buttonError_1kk7v_20",uf="_danger_1kk7v_34",df="_ghost_1kk7v_39",ro={button:cf,buttonError:lf,danger:uf,ghost:df};function ct({className:e,style:t,type:n,children:r,variant:i,...o}){const s=st(ro.button,{[ro.danger]:i==="danger",[ro.ghost]:i==="ghost",[e||""]:!!e});return u.jsx("button",{type:n,className:s,style:t,...o,children:r})}const da=g.createContext({hydratedRevision:null,loading:!1}),Dn=()=>{const e=g.useContext(da);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e};function pf({projectId:e,children:t}){var C;const{selectedConnection:n}=yn(),{integrationId:r,integrationObj:i}=dt(),[o,s]=g.useState(null),[a,c]=g.useState(!0),{isError:l,removeError:d,setError:f}=Yt(),m=He(),p=n==null?void 0:n.id,y=(C=i==null?void 0:i.latestRevision)==null?void 0:C.id,I=(i==null?void 0:i.name)||r;g.useEffect(()=>{e&&r&&y&&p&&m&&Oe().revisionApi.getHydratedRevision({projectIdOrName:e,integrationId:r,revisionId:y,connectionId:p},{headers:{"X-Api-Key":m??""}}).then(v=>{s(v),c(!1),d(Ce.HYDRATED_REVISION,I)}).catch(v=>{console.error(`Error loading integration ${I}.`),ze(v),c(!1),f(Ce.HYDRATED_REVISION,I)})},[e,r,y,p,m,d,f,I]);const w=g.useMemo(()=>({hydratedRevision:o,loading:a}),[o,a]);if(l(Ce.HYDRATED_REVISION,I)){const x=`Error retrieving integration details for '${(i==null?void 0:i.name)||r||"unknown integration"}. This is sometimes caused by insufficient permissions with your credentials'`;return u.jsx(Lt,{message:x})}return u.jsx(da.Provider,{value:w,children:t})}function kt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function le(){return le=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},le.apply(null,arguments)}function Io(e,t){return Io=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Io(e,t)}function ff(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Io(e,t)}var wo={exports:{}},mr={exports:{}},he={};/** @license React v16.13.1
8
+ */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var o="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(o=i(o,r(a)))}return o}function r(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return n.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var s="";for(var a in o)t.call(o,a)&&o[a]&&(s=i(s,a));return s}function i(o,s){return s?o?o+" "+s:o+s:o}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(da);var cf=da.exports;const st=Vo(cf),lf="_button_1kk7v_1",uf="_buttonError_1kk7v_20",df="_danger_1kk7v_34",pf="_ghost_1kk7v_39",ro={button:lf,buttonError:uf,danger:df,ghost:pf};function ct({className:e,style:t,type:n,children:r,variant:i,...o}){const s=st(ro.button,{[ro.danger]:i==="danger",[ro.ghost]:i==="ghost",[e||""]:!!e});return u.jsx("button",{type:n,className:s,style:t,...o,children:r})}const pa=g.createContext({hydratedRevision:null,loading:!1}),Dn=()=>{const e=g.useContext(pa);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e};function ff({projectId:e,children:t}){var C;const{selectedConnection:n}=yn(),{integrationId:r,integrationObj:i}=dt(),[o,s]=g.useState(null),[a,c]=g.useState(!0),{isError:l,removeError:d,setError:f}=Yt(),m=He(),p=n==null?void 0:n.id,y=(C=i==null?void 0:i.latestRevision)==null?void 0:C.id,I=(i==null?void 0:i.name)||r;g.useEffect(()=>{e&&r&&y&&p&&m&&Oe().revisionApi.getHydratedRevision({projectIdOrName:e,integrationId:r,revisionId:y,connectionId:p},{headers:{"X-Api-Key":m??""}}).then(v=>{s(v),c(!1),d(Ce.HYDRATED_REVISION,I)}).catch(v=>{console.error(`Error loading integration ${I}.`),ze(v),c(!1),f(Ce.HYDRATED_REVISION,I)})},[e,r,y,p,m,d,f,I]);const w=g.useMemo(()=>({hydratedRevision:o,loading:a}),[o,a]);if(l(Ce.HYDRATED_REVISION,I)){const x=`Error retrieving integration details for '${(i==null?void 0:i.name)||r||"unknown integration"}. This is sometimes caused by insufficient permissions with your credentials'`;return u.jsx(Lt,{message:x})}return u.jsx(pa.Provider,{value:w,children:t})}function kt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function le(){return le=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},le.apply(null,arguments)}function Io(e,t){return Io=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Io(e,t)}function mf(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Io(e,t)}var wo={exports:{}},mr={exports:{}},he={};/** @license React v16.13.1
9
9
  * react-is.production.min.js
10
10
  *
11
11
  * Copyright (c) Facebook, Inc. and its affiliates.
12
12
  *
13
13
  * This source code is licensed under the MIT license found in the
14
14
  * LICENSE file in the root directory of this source tree.
15
- */var $i;function mf(){if($i)return he;$i=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,l=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,I=e?Symbol.for("react.block"):60121,w=e?Symbol.for("react.fundamental"):60117,C=e?Symbol.for("react.responder"):60118,v=e?Symbol.for("react.scope"):60119;function x(_){if(typeof _=="object"&&_!==null){var E=_.$$typeof;switch(E){case t:switch(_=_.type,_){case c:case l:case r:case o:case i:case f:return _;default:switch(_=_&&_.$$typeof,_){case a:case d:case y:case p:case s:return _;default:return E}}case n:return E}}}function b(_){return x(_)===l}return he.AsyncMode=c,he.ConcurrentMode=l,he.ContextConsumer=a,he.ContextProvider=s,he.Element=t,he.ForwardRef=d,he.Fragment=r,he.Lazy=y,he.Memo=p,he.Portal=n,he.Profiler=o,he.StrictMode=i,he.Suspense=f,he.isAsyncMode=function(_){return b(_)||x(_)===c},he.isConcurrentMode=b,he.isContextConsumer=function(_){return x(_)===a},he.isContextProvider=function(_){return x(_)===s},he.isElement=function(_){return typeof _=="object"&&_!==null&&_.$$typeof===t},he.isForwardRef=function(_){return x(_)===d},he.isFragment=function(_){return x(_)===r},he.isLazy=function(_){return x(_)===y},he.isMemo=function(_){return x(_)===p},he.isPortal=function(_){return x(_)===n},he.isProfiler=function(_){return x(_)===o},he.isStrictMode=function(_){return x(_)===i},he.isSuspense=function(_){return x(_)===f},he.isValidElementType=function(_){return typeof _=="string"||typeof _=="function"||_===r||_===l||_===o||_===i||_===f||_===m||typeof _=="object"&&_!==null&&(_.$$typeof===y||_.$$typeof===p||_.$$typeof===s||_.$$typeof===a||_.$$typeof===d||_.$$typeof===w||_.$$typeof===C||_.$$typeof===v||_.$$typeof===I)},he.typeOf=x,he}var ge={};/** @license React v16.13.1
15
+ */var Vi;function hf(){if(Vi)return he;Vi=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,l=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,I=e?Symbol.for("react.block"):60121,w=e?Symbol.for("react.fundamental"):60117,C=e?Symbol.for("react.responder"):60118,v=e?Symbol.for("react.scope"):60119;function x(_){if(typeof _=="object"&&_!==null){var E=_.$$typeof;switch(E){case t:switch(_=_.type,_){case c:case l:case r:case o:case i:case f:return _;default:switch(_=_&&_.$$typeof,_){case a:case d:case y:case p:case s:return _;default:return E}}case n:return E}}}function b(_){return x(_)===l}return he.AsyncMode=c,he.ConcurrentMode=l,he.ContextConsumer=a,he.ContextProvider=s,he.Element=t,he.ForwardRef=d,he.Fragment=r,he.Lazy=y,he.Memo=p,he.Portal=n,he.Profiler=o,he.StrictMode=i,he.Suspense=f,he.isAsyncMode=function(_){return b(_)||x(_)===c},he.isConcurrentMode=b,he.isContextConsumer=function(_){return x(_)===a},he.isContextProvider=function(_){return x(_)===s},he.isElement=function(_){return typeof _=="object"&&_!==null&&_.$$typeof===t},he.isForwardRef=function(_){return x(_)===d},he.isFragment=function(_){return x(_)===r},he.isLazy=function(_){return x(_)===y},he.isMemo=function(_){return x(_)===p},he.isPortal=function(_){return x(_)===n},he.isProfiler=function(_){return x(_)===o},he.isStrictMode=function(_){return x(_)===i},he.isSuspense=function(_){return x(_)===f},he.isValidElementType=function(_){return typeof _=="string"||typeof _=="function"||_===r||_===l||_===o||_===i||_===f||_===m||typeof _=="object"&&_!==null&&(_.$$typeof===y||_.$$typeof===p||_.$$typeof===s||_.$$typeof===a||_.$$typeof===d||_.$$typeof===w||_.$$typeof===C||_.$$typeof===v||_.$$typeof===I)},he.typeOf=x,he}var ge={};/** @license React v16.13.1
16
16
  * react-is.development.js
17
17
  *
18
18
  * Copyright (c) Facebook, Inc. and its affiliates.
19
19
  *
20
20
  * This source code is licensed under the MIT license found in the
21
21
  * LICENSE file in the root directory of this source tree.
22
- */var Vi;function hf(){return Vi||(Vi=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,l=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,I=e?Symbol.for("react.block"):60121,w=e?Symbol.for("react.fundamental"):60117,C=e?Symbol.for("react.responder"):60118,v=e?Symbol.for("react.scope"):60119;function x(A){return typeof A=="string"||typeof A=="function"||A===r||A===l||A===o||A===i||A===f||A===m||typeof A=="object"&&A!==null&&(A.$$typeof===y||A.$$typeof===p||A.$$typeof===s||A.$$typeof===a||A.$$typeof===d||A.$$typeof===w||A.$$typeof===C||A.$$typeof===v||A.$$typeof===I)}function b(A){if(typeof A=="object"&&A!==null){var pe=A.$$typeof;switch(pe){case t:var $=A.type;switch($){case c:case l:case r:case o:case i:case f:return $;default:var Ie=$&&$.$$typeof;switch(Ie){case a:case d:case y:case p:case s:return Ie;default:return pe}}case n:return pe}}}var _=c,E=l,L=a,T=s,J=t,q=d,z=r,Y=y,ee=p,U=n,se=o,ne=i,Q=f,de=!1;function fe(A){return de||(de=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),S(A)||b(A)===c}function S(A){return b(A)===l}function P(A){return b(A)===a}function k(A){return b(A)===s}function j(A){return typeof A=="object"&&A!==null&&A.$$typeof===t}function D(A){return b(A)===d}function R(A){return b(A)===r}function X(A){return b(A)===y}function G(A){return b(A)===p}function K(A){return b(A)===n}function Z(A){return b(A)===o}function B(A){return b(A)===i}function ae(A){return b(A)===f}ge.AsyncMode=_,ge.ConcurrentMode=E,ge.ContextConsumer=L,ge.ContextProvider=T,ge.Element=J,ge.ForwardRef=q,ge.Fragment=z,ge.Lazy=Y,ge.Memo=ee,ge.Portal=U,ge.Profiler=se,ge.StrictMode=ne,ge.Suspense=Q,ge.isAsyncMode=fe,ge.isConcurrentMode=S,ge.isContextConsumer=P,ge.isContextProvider=k,ge.isElement=j,ge.isForwardRef=D,ge.isFragment=R,ge.isLazy=X,ge.isMemo=G,ge.isPortal=K,ge.isProfiler=Z,ge.isStrictMode=B,ge.isSuspense=ae,ge.isValidElementType=x,ge.typeOf=b}()),ge}var Hi;function pa(){return Hi||(Hi=1,process.env.NODE_ENV==="production"?mr.exports=mf():mr.exports=hf()),mr.exports}/*
22
+ */var Hi;function gf(){return Hi||(Hi=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,l=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,I=e?Symbol.for("react.block"):60121,w=e?Symbol.for("react.fundamental"):60117,C=e?Symbol.for("react.responder"):60118,v=e?Symbol.for("react.scope"):60119;function x(A){return typeof A=="string"||typeof A=="function"||A===r||A===l||A===o||A===i||A===f||A===m||typeof A=="object"&&A!==null&&(A.$$typeof===y||A.$$typeof===p||A.$$typeof===s||A.$$typeof===a||A.$$typeof===d||A.$$typeof===w||A.$$typeof===C||A.$$typeof===v||A.$$typeof===I)}function b(A){if(typeof A=="object"&&A!==null){var pe=A.$$typeof;switch(pe){case t:var $=A.type;switch($){case c:case l:case r:case o:case i:case f:return $;default:var Ie=$&&$.$$typeof;switch(Ie){case a:case d:case y:case p:case s:return Ie;default:return pe}}case n:return pe}}}var _=c,E=l,L=a,T=s,J=t,q=d,z=r,Y=y,ee=p,U=n,se=o,ne=i,Q=f,de=!1;function fe(A){return de||(de=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),S(A)||b(A)===c}function S(A){return b(A)===l}function P(A){return b(A)===a}function k(A){return b(A)===s}function j(A){return typeof A=="object"&&A!==null&&A.$$typeof===t}function D(A){return b(A)===d}function R(A){return b(A)===r}function X(A){return b(A)===y}function G(A){return b(A)===p}function K(A){return b(A)===n}function Z(A){return b(A)===o}function B(A){return b(A)===i}function ae(A){return b(A)===f}ge.AsyncMode=_,ge.ConcurrentMode=E,ge.ContextConsumer=L,ge.ContextProvider=T,ge.Element=J,ge.ForwardRef=q,ge.Fragment=z,ge.Lazy=Y,ge.Memo=ee,ge.Portal=U,ge.Profiler=se,ge.StrictMode=ne,ge.Suspense=Q,ge.isAsyncMode=fe,ge.isConcurrentMode=S,ge.isContextConsumer=P,ge.isContextProvider=k,ge.isElement=j,ge.isForwardRef=D,ge.isFragment=R,ge.isLazy=X,ge.isMemo=G,ge.isPortal=K,ge.isProfiler=Z,ge.isStrictMode=B,ge.isSuspense=ae,ge.isValidElementType=x,ge.typeOf=b}()),ge}var Ui;function fa(){return Ui||(Ui=1,process.env.NODE_ENV==="production"?mr.exports=hf():mr.exports=gf()),mr.exports}/*
23
23
  object-assign
24
24
  (c) Sindre Sorhus
25
25
  @license MIT
26
- */var oo,Ui;function gf(){if(Ui)return oo;Ui=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function i(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var s={},a=0;a<10;a++)s["_"+String.fromCharCode(a)]=a;var c=Object.getOwnPropertyNames(s).map(function(d){return s[d]});if(c.join("")!=="0123456789")return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(d){l[d]=d}),Object.keys(Object.assign({},l)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return oo=i()?Object.assign:function(o,s){for(var a,c=r(o),l,d=1;d<arguments.length;d++){a=Object(arguments[d]);for(var f in a)t.call(a,f)&&(c[f]=a[f]);if(e){l=e(a);for(var m=0;m<l.length;m++)n.call(a,l[m])&&(c[l[m]]=a[l[m]])}}return c},oo}var io,Bi;function Uo(){if(Bi)return io;Bi=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return io=e,io}var so,qi;function fa(){return qi||(qi=1,so=Function.call.bind(Object.prototype.hasOwnProperty)),so}var ao,Wi;function vf(){if(Wi)return ao;Wi=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Uo(),n={},r=fa();e=function(o){var s="Warning: "+o;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function i(o,s,a,c,l){if(process.env.NODE_ENV!=="production"){for(var d in o)if(r(o,d)){var f;try{if(typeof o[d]!="function"){var m=Error((c||"React class")+": "+a+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw m.name="Invariant Violation",m}f=o[d](s,d,c,a,null,t)}catch(y){f=y}if(f&&!(f instanceof Error)&&e((c||"React class")+": type specification of "+a+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof f+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),f instanceof Error&&!(f.message in n)){n[f.message]=!0;var p=l?l():"";e("Failed "+a+" type: "+f.message+(p??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},ao=i,ao}var co,Ji;function yf(){if(Ji)return co;Ji=1;var e=pa(),t=gf(),n=Uo(),r=fa(),i=vf(),o=function(){};process.env.NODE_ENV!=="production"&&(o=function(a){var c="Warning: "+a;typeof console<"u"&&console.error(c);try{throw new Error(c)}catch{}});function s(){return null}return co=function(a,c){var l=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function f(S){var P=S&&(l&&S[l]||S[d]);if(typeof P=="function")return P}var m="<<anonymous>>",p={array:C("array"),bigint:C("bigint"),bool:C("boolean"),func:C("function"),number:C("number"),object:C("object"),string:C("string"),symbol:C("symbol"),any:v(),arrayOf:x,element:b(),elementType:_(),instanceOf:E,node:q(),objectOf:T,oneOf:L,oneOfType:J,shape:Y,exact:ee};function y(S,P){return S===P?S!==0||1/S===1/P:S!==S&&P!==P}function I(S,P){this.message=S,this.data=P&&typeof P=="object"?P:{},this.stack=""}I.prototype=Error.prototype;function w(S){if(process.env.NODE_ENV!=="production")var P={},k=0;function j(R,X,G,K,Z,B,ae){if(K=K||m,B=B||G,ae!==n){if(c){var A=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw A.name="Invariant Violation",A}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var pe=K+":"+G;!P[pe]&&k<3&&(o("You are manually calling a React.PropTypes validation function for the `"+B+"` prop on `"+K+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),P[pe]=!0,k++)}}return X[G]==null?R?X[G]===null?new I("The "+Z+" `"+B+"` is marked as required "+("in `"+K+"`, but its value is `null`.")):new I("The "+Z+" `"+B+"` is marked as required in "+("`"+K+"`, but its value is `undefined`.")):null:S(X,G,K,Z,B)}var D=j.bind(null,!1);return D.isRequired=j.bind(null,!0),D}function C(S){function P(k,j,D,R,X,G){var K=k[j],Z=ne(K);if(Z!==S){var B=Q(K);return new I("Invalid "+R+" `"+X+"` of type "+("`"+B+"` supplied to `"+D+"`, expected ")+("`"+S+"`."),{expectedType:S})}return null}return w(P)}function v(){return w(s)}function x(S){function P(k,j,D,R,X){if(typeof S!="function")return new I("Property `"+X+"` of component `"+D+"` has invalid PropType notation inside arrayOf.");var G=k[j];if(!Array.isArray(G)){var K=ne(G);return new I("Invalid "+R+" `"+X+"` of type "+("`"+K+"` supplied to `"+D+"`, expected an array."))}for(var Z=0;Z<G.length;Z++){var B=S(G,Z,D,R,X+"["+Z+"]",n);if(B instanceof Error)return B}return null}return w(P)}function b(){function S(P,k,j,D,R){var X=P[k];if(!a(X)){var G=ne(X);return new I("Invalid "+D+" `"+R+"` of type "+("`"+G+"` supplied to `"+j+"`, expected a single ReactElement."))}return null}return w(S)}function _(){function S(P,k,j,D,R){var X=P[k];if(!e.isValidElementType(X)){var G=ne(X);return new I("Invalid "+D+" `"+R+"` of type "+("`"+G+"` supplied to `"+j+"`, expected a single ReactElement type."))}return null}return w(S)}function E(S){function P(k,j,D,R,X){if(!(k[j]instanceof S)){var G=S.name||m,K=fe(k[j]);return new I("Invalid "+R+" `"+X+"` of type "+("`"+K+"` supplied to `"+D+"`, expected ")+("instance of `"+G+"`."))}return null}return w(P)}function L(S){if(!Array.isArray(S))return process.env.NODE_ENV!=="production"&&(arguments.length>1?o("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):o("Invalid argument supplied to oneOf, expected an array.")),s;function P(k,j,D,R,X){for(var G=k[j],K=0;K<S.length;K++)if(y(G,S[K]))return null;var Z=JSON.stringify(S,function(ae,A){var pe=Q(A);return pe==="symbol"?String(A):A});return new I("Invalid "+R+" `"+X+"` of value `"+String(G)+"` "+("supplied to `"+D+"`, expected one of "+Z+"."))}return w(P)}function T(S){function P(k,j,D,R,X){if(typeof S!="function")return new I("Property `"+X+"` of component `"+D+"` has invalid PropType notation inside objectOf.");var G=k[j],K=ne(G);if(K!=="object")return new I("Invalid "+R+" `"+X+"` of type "+("`"+K+"` supplied to `"+D+"`, expected an object."));for(var Z in G)if(r(G,Z)){var B=S(G,Z,D,R,X+"."+Z,n);if(B instanceof Error)return B}return null}return w(P)}function J(S){if(!Array.isArray(S))return process.env.NODE_ENV!=="production"&&o("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var P=0;P<S.length;P++){var k=S[P];if(typeof k!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+de(k)+" at index "+P+"."),s}function j(D,R,X,G,K){for(var Z=[],B=0;B<S.length;B++){var ae=S[B],A=ae(D,R,X,G,K,n);if(A==null)return null;A.data&&r(A.data,"expectedType")&&Z.push(A.data.expectedType)}var pe=Z.length>0?", expected one of type ["+Z.join(", ")+"]":"";return new I("Invalid "+G+" `"+K+"` supplied to "+("`"+X+"`"+pe+"."))}return w(j)}function q(){function S(P,k,j,D,R){return U(P[k])?null:new I("Invalid "+D+" `"+R+"` supplied to "+("`"+j+"`, expected a ReactNode."))}return w(S)}function z(S,P,k,j,D){return new I((S||"React class")+": "+P+" type `"+k+"."+j+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+D+"`.")}function Y(S){function P(k,j,D,R,X){var G=k[j],K=ne(G);if(K!=="object")return new I("Invalid "+R+" `"+X+"` of type `"+K+"` "+("supplied to `"+D+"`, expected `object`."));for(var Z in S){var B=S[Z];if(typeof B!="function")return z(D,R,X,Z,Q(B));var ae=B(G,Z,D,R,X+"."+Z,n);if(ae)return ae}return null}return w(P)}function ee(S){function P(k,j,D,R,X){var G=k[j],K=ne(G);if(K!=="object")return new I("Invalid "+R+" `"+X+"` of type `"+K+"` "+("supplied to `"+D+"`, expected `object`."));var Z=t({},k[j],S);for(var B in Z){var ae=S[B];if(r(S,B)&&typeof ae!="function")return z(D,R,X,B,Q(ae));if(!ae)return new I("Invalid "+R+" `"+X+"` key `"+B+"` supplied to `"+D+"`.\nBad object: "+JSON.stringify(k[j],null," ")+`
27
- Valid keys: `+JSON.stringify(Object.keys(S),null," "));var A=ae(G,B,D,R,X+"."+B,n);if(A)return A}return null}return w(P)}function U(S){switch(typeof S){case"number":case"string":case"undefined":return!0;case"boolean":return!S;case"object":if(Array.isArray(S))return S.every(U);if(S===null||a(S))return!0;var P=f(S);if(P){var k=P.call(S),j;if(P!==S.entries){for(;!(j=k.next()).done;)if(!U(j.value))return!1}else for(;!(j=k.next()).done;){var D=j.value;if(D&&!U(D[1]))return!1}}else return!1;return!0;default:return!1}}function se(S,P){return S==="symbol"?!0:P?P["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&P instanceof Symbol:!1}function ne(S){var P=typeof S;return Array.isArray(S)?"array":S instanceof RegExp?"object":se(P,S)?"symbol":P}function Q(S){if(typeof S>"u"||S===null)return""+S;var P=ne(S);if(P==="object"){if(S instanceof Date)return"date";if(S instanceof RegExp)return"regexp"}return P}function de(S){var P=Q(S);switch(P){case"array":case"object":return"an "+P;case"boolean":case"date":case"regexp":return"a "+P;default:return P}}function fe(S){return!S.constructor||!S.constructor.name?m:S.constructor.name}return p.checkPropTypes=i,p.resetWarningCache=i.resetWarningCache,p.PropTypes=p,p},co}var lo,zi;function If(){if(zi)return lo;zi=1;var e=Uo();function t(){}function n(){}return n.resetWarningCache=t,lo=function(){function r(s,a,c,l,d,f){if(f!==e){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}r.isRequired=r;function i(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},lo}if(process.env.NODE_ENV!=="production"){var wf=pa(),_f=!0;wo.exports=yf()(wf.isElement,_f)}else wo.exports=If()();var bf=wo.exports;const F=$o(bf);var _o={exports:{}},ve={};/**
26
+ */var oo,Bi;function vf(){if(Bi)return oo;Bi=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function i(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var s={},a=0;a<10;a++)s["_"+String.fromCharCode(a)]=a;var c=Object.getOwnPropertyNames(s).map(function(d){return s[d]});if(c.join("")!=="0123456789")return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(d){l[d]=d}),Object.keys(Object.assign({},l)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return oo=i()?Object.assign:function(o,s){for(var a,c=r(o),l,d=1;d<arguments.length;d++){a=Object(arguments[d]);for(var f in a)t.call(a,f)&&(c[f]=a[f]);if(e){l=e(a);for(var m=0;m<l.length;m++)n.call(a,l[m])&&(c[l[m]]=a[l[m]])}}return c},oo}var io,qi;function Bo(){if(qi)return io;qi=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return io=e,io}var so,Wi;function ma(){return Wi||(Wi=1,so=Function.call.bind(Object.prototype.hasOwnProperty)),so}var ao,Ji;function yf(){if(Ji)return ao;Ji=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Bo(),n={},r=ma();e=function(o){var s="Warning: "+o;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function i(o,s,a,c,l){if(process.env.NODE_ENV!=="production"){for(var d in o)if(r(o,d)){var f;try{if(typeof o[d]!="function"){var m=Error((c||"React class")+": "+a+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw m.name="Invariant Violation",m}f=o[d](s,d,c,a,null,t)}catch(y){f=y}if(f&&!(f instanceof Error)&&e((c||"React class")+": type specification of "+a+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof f+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),f instanceof Error&&!(f.message in n)){n[f.message]=!0;var p=l?l():"";e("Failed "+a+" type: "+f.message+(p??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},ao=i,ao}var co,zi;function If(){if(zi)return co;zi=1;var e=fa(),t=vf(),n=Bo(),r=ma(),i=yf(),o=function(){};process.env.NODE_ENV!=="production"&&(o=function(a){var c="Warning: "+a;typeof console<"u"&&console.error(c);try{throw new Error(c)}catch{}});function s(){return null}return co=function(a,c){var l=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function f(S){var P=S&&(l&&S[l]||S[d]);if(typeof P=="function")return P}var m="<<anonymous>>",p={array:C("array"),bigint:C("bigint"),bool:C("boolean"),func:C("function"),number:C("number"),object:C("object"),string:C("string"),symbol:C("symbol"),any:v(),arrayOf:x,element:b(),elementType:_(),instanceOf:E,node:q(),objectOf:T,oneOf:L,oneOfType:J,shape:Y,exact:ee};function y(S,P){return S===P?S!==0||1/S===1/P:S!==S&&P!==P}function I(S,P){this.message=S,this.data=P&&typeof P=="object"?P:{},this.stack=""}I.prototype=Error.prototype;function w(S){if(process.env.NODE_ENV!=="production")var P={},k=0;function j(R,X,G,K,Z,B,ae){if(K=K||m,B=B||G,ae!==n){if(c){var A=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw A.name="Invariant Violation",A}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var pe=K+":"+G;!P[pe]&&k<3&&(o("You are manually calling a React.PropTypes validation function for the `"+B+"` prop on `"+K+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),P[pe]=!0,k++)}}return X[G]==null?R?X[G]===null?new I("The "+Z+" `"+B+"` is marked as required "+("in `"+K+"`, but its value is `null`.")):new I("The "+Z+" `"+B+"` is marked as required in "+("`"+K+"`, but its value is `undefined`.")):null:S(X,G,K,Z,B)}var D=j.bind(null,!1);return D.isRequired=j.bind(null,!0),D}function C(S){function P(k,j,D,R,X,G){var K=k[j],Z=ne(K);if(Z!==S){var B=Q(K);return new I("Invalid "+R+" `"+X+"` of type "+("`"+B+"` supplied to `"+D+"`, expected ")+("`"+S+"`."),{expectedType:S})}return null}return w(P)}function v(){return w(s)}function x(S){function P(k,j,D,R,X){if(typeof S!="function")return new I("Property `"+X+"` of component `"+D+"` has invalid PropType notation inside arrayOf.");var G=k[j];if(!Array.isArray(G)){var K=ne(G);return new I("Invalid "+R+" `"+X+"` of type "+("`"+K+"` supplied to `"+D+"`, expected an array."))}for(var Z=0;Z<G.length;Z++){var B=S(G,Z,D,R,X+"["+Z+"]",n);if(B instanceof Error)return B}return null}return w(P)}function b(){function S(P,k,j,D,R){var X=P[k];if(!a(X)){var G=ne(X);return new I("Invalid "+D+" `"+R+"` of type "+("`"+G+"` supplied to `"+j+"`, expected a single ReactElement."))}return null}return w(S)}function _(){function S(P,k,j,D,R){var X=P[k];if(!e.isValidElementType(X)){var G=ne(X);return new I("Invalid "+D+" `"+R+"` of type "+("`"+G+"` supplied to `"+j+"`, expected a single ReactElement type."))}return null}return w(S)}function E(S){function P(k,j,D,R,X){if(!(k[j]instanceof S)){var G=S.name||m,K=fe(k[j]);return new I("Invalid "+R+" `"+X+"` of type "+("`"+K+"` supplied to `"+D+"`, expected ")+("instance of `"+G+"`."))}return null}return w(P)}function L(S){if(!Array.isArray(S))return process.env.NODE_ENV!=="production"&&(arguments.length>1?o("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):o("Invalid argument supplied to oneOf, expected an array.")),s;function P(k,j,D,R,X){for(var G=k[j],K=0;K<S.length;K++)if(y(G,S[K]))return null;var Z=JSON.stringify(S,function(ae,A){var pe=Q(A);return pe==="symbol"?String(A):A});return new I("Invalid "+R+" `"+X+"` of value `"+String(G)+"` "+("supplied to `"+D+"`, expected one of "+Z+"."))}return w(P)}function T(S){function P(k,j,D,R,X){if(typeof S!="function")return new I("Property `"+X+"` of component `"+D+"` has invalid PropType notation inside objectOf.");var G=k[j],K=ne(G);if(K!=="object")return new I("Invalid "+R+" `"+X+"` of type "+("`"+K+"` supplied to `"+D+"`, expected an object."));for(var Z in G)if(r(G,Z)){var B=S(G,Z,D,R,X+"."+Z,n);if(B instanceof Error)return B}return null}return w(P)}function J(S){if(!Array.isArray(S))return process.env.NODE_ENV!=="production"&&o("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var P=0;P<S.length;P++){var k=S[P];if(typeof k!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+de(k)+" at index "+P+"."),s}function j(D,R,X,G,K){for(var Z=[],B=0;B<S.length;B++){var ae=S[B],A=ae(D,R,X,G,K,n);if(A==null)return null;A.data&&r(A.data,"expectedType")&&Z.push(A.data.expectedType)}var pe=Z.length>0?", expected one of type ["+Z.join(", ")+"]":"";return new I("Invalid "+G+" `"+K+"` supplied to "+("`"+X+"`"+pe+"."))}return w(j)}function q(){function S(P,k,j,D,R){return U(P[k])?null:new I("Invalid "+D+" `"+R+"` supplied to "+("`"+j+"`, expected a ReactNode."))}return w(S)}function z(S,P,k,j,D){return new I((S||"React class")+": "+P+" type `"+k+"."+j+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+D+"`.")}function Y(S){function P(k,j,D,R,X){var G=k[j],K=ne(G);if(K!=="object")return new I("Invalid "+R+" `"+X+"` of type `"+K+"` "+("supplied to `"+D+"`, expected `object`."));for(var Z in S){var B=S[Z];if(typeof B!="function")return z(D,R,X,Z,Q(B));var ae=B(G,Z,D,R,X+"."+Z,n);if(ae)return ae}return null}return w(P)}function ee(S){function P(k,j,D,R,X){var G=k[j],K=ne(G);if(K!=="object")return new I("Invalid "+R+" `"+X+"` of type `"+K+"` "+("supplied to `"+D+"`, expected `object`."));var Z=t({},k[j],S);for(var B in Z){var ae=S[B];if(r(S,B)&&typeof ae!="function")return z(D,R,X,B,Q(ae));if(!ae)return new I("Invalid "+R+" `"+X+"` key `"+B+"` supplied to `"+D+"`.\nBad object: "+JSON.stringify(k[j],null," ")+`
27
+ Valid keys: `+JSON.stringify(Object.keys(S),null," "));var A=ae(G,B,D,R,X+"."+B,n);if(A)return A}return null}return w(P)}function U(S){switch(typeof S){case"number":case"string":case"undefined":return!0;case"boolean":return!S;case"object":if(Array.isArray(S))return S.every(U);if(S===null||a(S))return!0;var P=f(S);if(P){var k=P.call(S),j;if(P!==S.entries){for(;!(j=k.next()).done;)if(!U(j.value))return!1}else for(;!(j=k.next()).done;){var D=j.value;if(D&&!U(D[1]))return!1}}else return!1;return!0;default:return!1}}function se(S,P){return S==="symbol"?!0:P?P["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&P instanceof Symbol:!1}function ne(S){var P=typeof S;return Array.isArray(S)?"array":S instanceof RegExp?"object":se(P,S)?"symbol":P}function Q(S){if(typeof S>"u"||S===null)return""+S;var P=ne(S);if(P==="object"){if(S instanceof Date)return"date";if(S instanceof RegExp)return"regexp"}return P}function de(S){var P=Q(S);switch(P){case"array":case"object":return"an "+P;case"boolean":case"date":case"regexp":return"a "+P;default:return P}}function fe(S){return!S.constructor||!S.constructor.name?m:S.constructor.name}return p.checkPropTypes=i,p.resetWarningCache=i.resetWarningCache,p.PropTypes=p,p},co}var lo,Xi;function wf(){if(Xi)return lo;Xi=1;var e=Bo();function t(){}function n(){}return n.resetWarningCache=t,lo=function(){function r(s,a,c,l,d,f){if(f!==e){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}r.isRequired=r;function i(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},lo}if(process.env.NODE_ENV!=="production"){var _f=fa(),bf=!0;wo.exports=If()(_f.isElement,bf)}else wo.exports=wf()();var xf=wo.exports;const F=Vo(xf);var _o={exports:{}},ve={};/**
28
28
  * @license React
29
29
  * react-is.production.min.js
30
30
  *
@@ -32,7 +32,7 @@ Valid keys: `+JSON.stringify(Object.keys(S),null," "));var A=ae(G,B,D,R,X+"."+B
32
32
  *
33
33
  * This source code is licensed under the MIT license found in the
34
34
  * LICENSE file in the root directory of this source tree.
35
- */var Xi;function xf(){if(Xi)return ve;Xi=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),y;y=Symbol.for("react.module.reference");function I(w){if(typeof w=="object"&&w!==null){var C=w.$$typeof;switch(C){case e:switch(w=w.type,w){case n:case i:case r:case l:case d:return w;default:switch(w=w&&w.$$typeof,w){case a:case s:case c:case m:case f:case o:return w;default:return C}}case t:return C}}}return ve.ContextConsumer=s,ve.ContextProvider=o,ve.Element=e,ve.ForwardRef=c,ve.Fragment=n,ve.Lazy=m,ve.Memo=f,ve.Portal=t,ve.Profiler=i,ve.StrictMode=r,ve.Suspense=l,ve.SuspenseList=d,ve.isAsyncMode=function(){return!1},ve.isConcurrentMode=function(){return!1},ve.isContextConsumer=function(w){return I(w)===s},ve.isContextProvider=function(w){return I(w)===o},ve.isElement=function(w){return typeof w=="object"&&w!==null&&w.$$typeof===e},ve.isForwardRef=function(w){return I(w)===c},ve.isFragment=function(w){return I(w)===n},ve.isLazy=function(w){return I(w)===m},ve.isMemo=function(w){return I(w)===f},ve.isPortal=function(w){return I(w)===t},ve.isProfiler=function(w){return I(w)===i},ve.isStrictMode=function(w){return I(w)===r},ve.isSuspense=function(w){return I(w)===l},ve.isSuspenseList=function(w){return I(w)===d},ve.isValidElementType=function(w){return typeof w=="string"||typeof w=="function"||w===n||w===i||w===r||w===l||w===d||w===p||typeof w=="object"&&w!==null&&(w.$$typeof===m||w.$$typeof===f||w.$$typeof===o||w.$$typeof===s||w.$$typeof===c||w.$$typeof===y||w.getModuleId!==void 0)},ve.typeOf=I,ve}var ye={};/**
35
+ */var Gi;function Cf(){if(Gi)return ve;Gi=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),y;y=Symbol.for("react.module.reference");function I(w){if(typeof w=="object"&&w!==null){var C=w.$$typeof;switch(C){case e:switch(w=w.type,w){case n:case i:case r:case l:case d:return w;default:switch(w=w&&w.$$typeof,w){case a:case s:case c:case m:case f:case o:return w;default:return C}}case t:return C}}}return ve.ContextConsumer=s,ve.ContextProvider=o,ve.Element=e,ve.ForwardRef=c,ve.Fragment=n,ve.Lazy=m,ve.Memo=f,ve.Portal=t,ve.Profiler=i,ve.StrictMode=r,ve.Suspense=l,ve.SuspenseList=d,ve.isAsyncMode=function(){return!1},ve.isConcurrentMode=function(){return!1},ve.isContextConsumer=function(w){return I(w)===s},ve.isContextProvider=function(w){return I(w)===o},ve.isElement=function(w){return typeof w=="object"&&w!==null&&w.$$typeof===e},ve.isForwardRef=function(w){return I(w)===c},ve.isFragment=function(w){return I(w)===n},ve.isLazy=function(w){return I(w)===m},ve.isMemo=function(w){return I(w)===f},ve.isPortal=function(w){return I(w)===t},ve.isProfiler=function(w){return I(w)===i},ve.isStrictMode=function(w){return I(w)===r},ve.isSuspense=function(w){return I(w)===l},ve.isSuspenseList=function(w){return I(w)===d},ve.isValidElementType=function(w){return typeof w=="string"||typeof w=="function"||w===n||w===i||w===r||w===l||w===d||w===p||typeof w=="object"&&w!==null&&(w.$$typeof===m||w.$$typeof===f||w.$$typeof===o||w.$$typeof===s||w.$$typeof===c||w.$$typeof===y||w.getModuleId!==void 0)},ve.typeOf=I,ve}var ye={};/**
36
36
  * @license React
37
37
  * react-is.development.js
38
38
  *
@@ -40,10 +40,10 @@ Valid keys: `+JSON.stringify(Object.keys(S),null," "));var A=ae(G,B,D,R,X+"."+B
40
40
  *
41
41
  * This source code is licensed under the MIT license found in the
42
42
  * LICENSE file in the root directory of this source tree.
43
- */var Gi;function Cf(){return Gi||(Gi=1,process.env.NODE_ENV!=="production"&&function(){var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),y=!1,I=!1,w=!1,C=!1,v=!1,x;x=Symbol.for("react.module.reference");function b($){return!!(typeof $=="string"||typeof $=="function"||$===n||$===i||v||$===r||$===l||$===d||C||$===p||y||I||w||typeof $=="object"&&$!==null&&($.$$typeof===m||$.$$typeof===f||$.$$typeof===o||$.$$typeof===s||$.$$typeof===c||$.$$typeof===x||$.getModuleId!==void 0))}function _($){if(typeof $=="object"&&$!==null){var Ie=$.$$typeof;switch(Ie){case e:var De=$.type;switch(De){case n:case i:case r:case l:case d:return De;default:var Ue=De&&De.$$typeof;switch(Ue){case a:case s:case c:case m:case f:case o:return Ue;default:return Ie}}case t:return Ie}}}var E=s,L=o,T=e,J=c,q=n,z=m,Y=f,ee=t,U=i,se=r,ne=l,Q=d,de=!1,fe=!1;function S($){return de||(de=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function P($){return fe||(fe=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function k($){return _($)===s}function j($){return _($)===o}function D($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function R($){return _($)===c}function X($){return _($)===n}function G($){return _($)===m}function K($){return _($)===f}function Z($){return _($)===t}function B($){return _($)===i}function ae($){return _($)===r}function A($){return _($)===l}function pe($){return _($)===d}ye.ContextConsumer=E,ye.ContextProvider=L,ye.Element=T,ye.ForwardRef=J,ye.Fragment=q,ye.Lazy=z,ye.Memo=Y,ye.Portal=ee,ye.Profiler=U,ye.StrictMode=se,ye.Suspense=ne,ye.SuspenseList=Q,ye.isAsyncMode=S,ye.isConcurrentMode=P,ye.isContextConsumer=k,ye.isContextProvider=j,ye.isElement=D,ye.isForwardRef=R,ye.isFragment=X,ye.isLazy=G,ye.isMemo=K,ye.isPortal=Z,ye.isProfiler=B,ye.isStrictMode=ae,ye.isSuspense=A,ye.isSuspenseList=pe,ye.isValidElementType=b,ye.typeOf=_}()),ye}process.env.NODE_ENV==="production"?_o.exports=xf():_o.exports=Cf();var Yi=_o.exports;const Zi=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Qi=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",uo=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Qi(n.overflowY,t)||Qi(n.overflowX,t)||(r=>{const i=(o=>{if(!o.ownerDocument||!o.ownerDocument.defaultView)return null;try{return o.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!i&&(i.clientHeight<r.scrollHeight||i.clientWidth<r.scrollWidth)})(e)}return!1},hr=(e,t,n,r,i,o,s,a)=>o<e&&s>t||o>e&&s<t?0:o<=e&&a<=n||s>=t&&a>=n?o-e-r:s>t&&a<n||o<e&&a>n?s-t+i:0,Of=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Ef=(e,t)=>{var n,r,i,o;if(typeof document>"u")return[];const{scrollMode:s,block:a,inline:c,boundary:l,skipOverflowHiddenElements:d}=t,f=typeof l=="function"?l:ne=>ne!==l;if(!Zi(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,p=[];let y=e;for(;Zi(y)&&f(y);){if(y=Of(y),y===m){p.push(y);break}y!=null&&y===document.body&&uo(y)&&!uo(document.documentElement)||y!=null&&uo(y,d)&&p.push(y)}const I=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,w=(o=(i=window.visualViewport)==null?void 0:i.height)!=null?o:innerHeight,{scrollX:C,scrollY:v}=window,{height:x,width:b,top:_,right:E,bottom:L,left:T}=e.getBoundingClientRect(),{top:J,right:q,bottom:z,left:Y}=(ne=>{const Q=window.getComputedStyle(ne);return{top:parseFloat(Q.scrollMarginTop)||0,right:parseFloat(Q.scrollMarginRight)||0,bottom:parseFloat(Q.scrollMarginBottom)||0,left:parseFloat(Q.scrollMarginLeft)||0}})(e);let ee=a==="start"||a==="nearest"?_-J:a==="end"?L+z:_+x/2-J+z,U=c==="center"?T+b/2-Y+q:c==="end"?E+q:T-Y;const se=[];for(let ne=0;ne<p.length;ne++){const Q=p[ne],{height:de,width:fe,top:S,right:P,bottom:k,left:j}=Q.getBoundingClientRect();if(s==="if-needed"&&_>=0&&T>=0&&L<=w&&E<=I&&_>=S&&L<=k&&T>=j&&E<=P)return se;const D=getComputedStyle(Q),R=parseInt(D.borderLeftWidth,10),X=parseInt(D.borderTopWidth,10),G=parseInt(D.borderRightWidth,10),K=parseInt(D.borderBottomWidth,10);let Z=0,B=0;const ae="offsetWidth"in Q?Q.offsetWidth-Q.clientWidth-R-G:0,A="offsetHeight"in Q?Q.offsetHeight-Q.clientHeight-X-K:0,pe="offsetWidth"in Q?Q.offsetWidth===0?0:fe/Q.offsetWidth:0,$="offsetHeight"in Q?Q.offsetHeight===0?0:de/Q.offsetHeight:0;if(m===Q)Z=a==="start"?ee:a==="end"?ee-w:a==="nearest"?hr(v,v+w,w,X,K,v+ee,v+ee+x,x):ee-w/2,B=c==="start"?U:c==="center"?U-I/2:c==="end"?U-I:hr(C,C+I,I,R,G,C+U,C+U+b,b),Z=Math.max(0,Z+v),B=Math.max(0,B+C);else{Z=a==="start"?ee-S-X:a==="end"?ee-k+K+A:a==="nearest"?hr(S,k,de,X,K+A,ee,ee+x,x):ee-(S+de/2)+A/2,B=c==="start"?U-j-R:c==="center"?U-(j+fe/2)+ae/2:c==="end"?U-P+G+ae:hr(j,P,fe,R,G+ae,U,U+b,b);const{scrollLeft:Ie,scrollTop:De}=Q;Z=$===0?0:Math.max(0,Math.min(De+Z/$,Q.scrollHeight-de/$+A)),B=pe===0?0:Math.max(0,Math.min(Ie+B/pe,Q.scrollWidth-fe/pe+ae)),ee+=De-Z,U+=Ie-B}se.push({el:Q,top:Z,left:B})}return se};var Cn=function(){return Cn=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Cn.apply(this,arguments)};var Sf=0;function es(e){return typeof e=="function"?e:it}function it(){}function ma(e,t){if(e){var n=Ef(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach(function(r){var i=r.el,o=r.top,s=r.left;i.scrollTop=o,i.scrollLeft=s})}}function ts(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Bo(e,t){var n;function r(){n&&clearTimeout(n)}function i(){for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];r(),n=setTimeout(function(){n=null,e.apply(void 0,s)},t)}return i.cancel=r,i}function Le(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];return t.some(function(a){return a&&a.apply(void 0,[r].concat(o)),r.preventDownshiftDefault||r.hasOwnProperty("nativeEvent")&&r.nativeEvent.preventDownshiftDefault})}}function bn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){t.forEach(function(i){typeof i=="function"?i(r):i&&(i.current=r)})}}function ha(){return String(Sf++)}function Nf(e){var t=e.isOpen,n=e.resultCount,r=e.previousResultCount;return t?n?n!==r?n+" result"+(n===1?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter key to select.":"":"No results are available.":""}function ns(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function ga(e){return typeof e.type=="string"}function va(e){return e.props}function Tf(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var Rf=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function gr(e){e===void 0&&(e={});var t={};return Rf.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function Er(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=Sr(t,r)?t[r]:e[r],n},{})}function Sr(e,t){return e[t]!==void 0}function bo(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function Af(e){return Object.prototype.toString.call(e)==="[object Object]"}function un(e,t,n,r,i){var o=n.length;if(o===0)return-1;var s=o-1;(typeof e!="number"||e<0||e>s)&&(e=t>0?-1:s+1);var a=e+t;a<0?a=s:a>s&&(a=0);var c=On(a,t<0,n,r,i);return c===-1?e>=o?-1:e:c}function On(e,t,n,r,i){i===void 0&&(i=!1);var o=n.length;if(t){for(var s=e;s>=0;s--)if(!r(n[s],s))return s}else for(var a=e;a<o;a++)if(!r(n[a],a))return a;return i?On(t?o-1:0,t,n,r):-1}function Nr(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(i){return i&&(ts(i,e,n)||r&&ts(i,n.document.activeElement,n))})}var qo=it;process.env.NODE_ENV!=="production"&&(qo=function(t,n,r){var i="This prop should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled Downshift element for the lifetime of the component. More info: https://github.com/downshift-js/downshift#control-props";Object.keys(t).forEach(function(o){n[o]!==void 0&&r[o]===void 0?console.error('downshift: A component has changed the controlled prop "'+o+'" to be uncontrolled. '+i):n[o]===void 0&&r[o]!==void 0&&console.error('downshift: A component has changed the uncontrolled prop "'+o+'" to be controlled. '+i)})});var Pf=Bo(function(e){ya(e).textContent=""},500);function ya(e){var t=e.getElementById("a11y-status-message");return t||(t=e.createElement("div"),t.setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}function Ia(e,t){if(!(!e||!t)){var n=ya(t);n.textContent=e,Pf(t)}}function Df(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var wa=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,_a=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,ba=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,_r=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,br=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,xa=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Ca=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Oa=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Ea=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Sa=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Na=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,Ta=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Ra=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,xo=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,Aa=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Pa=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Da=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,jf=Object.freeze({__proto__:null,blurButton:Aa,blurInput:Na,changeInput:Ta,clickButton:xo,clickItem:Sa,controlledPropUpdatedSelectedItem:Pa,itemMouseEnter:ba,keyDownArrowDown:br,keyDownArrowUp:_r,keyDownEnd:Ea,keyDownEnter:Ca,keyDownEscape:xa,keyDownHome:Oa,keyDownSpaceButton:Ra,mouseUp:_a,touchEnd:Da,unknown:wa}),Ff=["refKey","ref"],kf=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Mf=["onKeyDown","onBlur","onChange","onInput","onChangeText"],Lf=["refKey","ref"],Kf=["onMouseMove","onMouseDown","onClick","onPress","index","item"],$f=function(){var e=function(t){function n(i){var o;o=t.call(this,i)||this,o.id=o.props.id||"downshift-"+ha(),o.menuId=o.props.menuId||o.id+"-menu",o.labelId=o.props.labelId||o.id+"-label",o.inputId=o.props.inputId||o.id+"-input",o.getItemId=o.props.getItemId||function(v){return o.id+"-item-"+v},o.items=[],o.itemCount=null,o.previousResultCount=0,o.timeoutIds=[],o.internalSetTimeout=function(v,x){var b=setTimeout(function(){o.timeoutIds=o.timeoutIds.filter(function(_){return _!==b}),v()},x);o.timeoutIds.push(b)},o.setItemCount=function(v){o.itemCount=v},o.unsetItemCount=function(){o.itemCount=null},o.isItemDisabled=function(v,x){var b=o.getItemNodeFromIndex(x);return b&&b.hasAttribute("disabled")},o.setHighlightedIndex=function(v,x){v===void 0&&(v=o.props.defaultHighlightedIndex),x===void 0&&(x={}),x=gr(x),o.internalSetState(le({highlightedIndex:v},x))},o.clearSelection=function(v){o.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:o.props.defaultHighlightedIndex,isOpen:o.props.defaultIsOpen},v)},o.selectItem=function(v,x,b){x=gr(x),o.internalSetState(le({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,selectedItem:v,inputValue:o.props.itemToString(v)},x),b)},o.selectItemAtIndex=function(v,x,b){var _=o.items[v];_!=null&&o.selectItem(_,x,b)},o.selectHighlightedItem=function(v,x){return o.selectItemAtIndex(o.getState().highlightedIndex,v,x)},o.internalSetState=function(v,x){var b,_,E={},L=typeof v=="function";return!L&&v.hasOwnProperty("inputValue")&&o.props.onInputValueChange(v.inputValue,le({},o.getStateAndHelpers(),v)),o.setState(function(T){var J;T=o.getState(T);var q=L?v(T):v;q=o.props.stateReducer(T,q),b=q.hasOwnProperty("selectedItem");var z={};return b&&q.selectedItem!==T.selectedItem&&(_=q.selectedItem),(J=q).type||(J.type=wa),Object.keys(q).forEach(function(Y){T[Y]!==q[Y]&&(E[Y]=q[Y]),Y!=="type"&&(q[Y],Sr(o.props,Y)||(z[Y]=q[Y]))}),L&&q.hasOwnProperty("inputValue")&&o.props.onInputValueChange(q.inputValue,le({},o.getStateAndHelpers(),q)),z},function(){es(x)();var T=Object.keys(E).length>1;T&&o.props.onStateChange(E,o.getStateAndHelpers()),b&&o.props.onSelect(v.selectedItem,o.getStateAndHelpers()),_!==void 0&&o.props.onChange(_,o.getStateAndHelpers()),o.props.onUserAction(E,o.getStateAndHelpers())})},o.rootRef=function(v){return o._rootNode=v},o.getRootProps=function(v,x){var b,_=v===void 0?{}:v,E=_.refKey,L=E===void 0?"ref":E,T=_.ref,J=kt(_,Ff),q=x===void 0?{}:x,z=q.suppressRefError,Y=z===void 0?!1:z;o.getRootProps.called=!0,o.getRootProps.refKey=L,o.getRootProps.suppressRefError=Y;var ee=o.getState(),U=ee.isOpen;return le((b={},b[L]=bn(T,o.rootRef),b.role="combobox",b["aria-expanded"]=U,b["aria-haspopup"]="listbox",b["aria-owns"]=U?o.menuId:void 0,b["aria-labelledby"]=o.labelId,b),J)},o.keyDownHandlers={ArrowDown:function(x){var b=this;if(x.preventDefault(),this.getState().isOpen){var _=x.shiftKey?5:1;this.moveHighlightedIndex(_,{type:br})}else this.internalSetState({isOpen:!0,type:br},function(){var E=b.getItemCount();if(E>0){var L=b.getState(),T=L.highlightedIndex,J=un(T,1,{length:E},b.isItemDisabled,!0);b.setHighlightedIndex(J,{type:br})}})},ArrowUp:function(x){var b=this;if(x.preventDefault(),this.getState().isOpen){var _=x.shiftKey?-5:-1;this.moveHighlightedIndex(_,{type:_r})}else this.internalSetState({isOpen:!0,type:_r},function(){var E=b.getItemCount();if(E>0){var L=b.getState(),T=L.highlightedIndex,J=un(T,-1,{length:E},b.isItemDisabled,!0);b.setHighlightedIndex(J,{type:_r})}})},Enter:function(x){if(x.which!==229){var b=this.getState(),_=b.isOpen,E=b.highlightedIndex;if(_&&E!=null){x.preventDefault();var L=this.items[E],T=this.getItemNodeFromIndex(E);if(L==null||T&&T.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Ca})}}},Escape:function(x){x.preventDefault(),this.reset(le({type:xa},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},o.buttonKeyDownHandlers=le({},o.keyDownHandlers,{" ":function(x){x.preventDefault(),this.toggleMenu({type:Ra})}}),o.inputKeyDownHandlers=le({},o.keyDownHandlers,{Home:function(x){var b=this.getState(),_=b.isOpen;if(_){x.preventDefault();var E=this.getItemCount();if(!(E<=0||!_)){var L=On(0,!1,{length:E},this.isItemDisabled);this.setHighlightedIndex(L,{type:Oa})}}},End:function(x){var b=this.getState(),_=b.isOpen;if(_){x.preventDefault();var E=this.getItemCount();if(!(E<=0||!_)){var L=On(E-1,!0,{length:E},this.isItemDisabled);this.setHighlightedIndex(L,{type:Ea})}}}}),o.getToggleButtonProps=function(v){var x=v===void 0?{}:v,b=x.onClick;x.onPress;var _=x.onKeyDown,E=x.onKeyUp,L=x.onBlur,T=kt(x,kf),J=o.getState(),q=J.isOpen,z={onClick:Le(b,o.buttonHandleClick),onKeyDown:Le(_,o.buttonHandleKeyDown),onKeyUp:Le(E,o.buttonHandleKeyUp),onBlur:Le(L,o.buttonHandleBlur)},Y=T.disabled?{}:z;return le({type:"button",role:"button","aria-label":q?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},Y,T)},o.buttonHandleKeyUp=function(v){v.preventDefault()},o.buttonHandleKeyDown=function(v){var x=bo(v);o.buttonKeyDownHandlers[x]&&o.buttonKeyDownHandlers[x].call(o,v)},o.buttonHandleClick=function(v){if(v.preventDefault(),o.props.environment){var x=o.props.environment.document,b=x.body,_=x.activeElement;b&&b===_&&v.target.focus()}process.env.NODE_ENV==="test"?o.toggleMenu({type:xo}):o.internalSetTimeout(function(){return o.toggleMenu({type:xo})})},o.buttonHandleBlur=function(v){var x=v.target;o.internalSetTimeout(function(){if(!(o.isMouseDown||!o.props.environment)){var b=o.props.environment.document.activeElement;(b==null||b.id!==o.inputId)&&b!==x&&o.reset({type:Aa})}})},o.getLabelProps=function(v){return le({htmlFor:o.inputId,id:o.labelId},v)},o.getInputProps=function(v){var x=v===void 0?{}:v,b=x.onKeyDown,_=x.onBlur,E=x.onChange,L=x.onInput;x.onChangeText;var T=kt(x,Mf),J,q={};J="onChange";var z=o.getState(),Y=z.inputValue,ee=z.isOpen,U=z.highlightedIndex;if(!T.disabled){var se;q=(se={},se[J]=Le(E,L,o.inputHandleChange),se.onKeyDown=Le(b,o.inputHandleKeyDown),se.onBlur=Le(_,o.inputHandleBlur),se)}return le({"aria-autocomplete":"list","aria-activedescendant":ee&&typeof U=="number"&&U>=0?o.getItemId(U):void 0,"aria-controls":ee?o.menuId:void 0,"aria-labelledby":T&&T["aria-label"]?void 0:o.labelId,autoComplete:"off",value:Y,id:o.inputId},q,T)},o.inputHandleKeyDown=function(v){var x=bo(v);x&&o.inputKeyDownHandlers[x]&&o.inputKeyDownHandlers[x].call(o,v)},o.inputHandleChange=function(v){o.internalSetState({type:Ta,isOpen:!0,inputValue:v.target.value,highlightedIndex:o.props.defaultHighlightedIndex})},o.inputHandleBlur=function(){o.internalSetTimeout(function(){var v;if(!(o.isMouseDown||!o.props.environment)){var x=o.props.environment.document.activeElement,b=(x==null||(v=x.dataset)==null?void 0:v.toggle)&&o._rootNode&&o._rootNode.contains(x);b||o.reset({type:Na})}})},o.menuRef=function(v){o._menuNode=v},o.getMenuProps=function(v,x){var b,_=v===void 0?{}:v,E=_.refKey,L=E===void 0?"ref":E,T=_.ref,J=kt(_,Lf),q=x===void 0?{}:x,z=q.suppressRefError,Y=z===void 0?!1:z;return o.getMenuProps.called=!0,o.getMenuProps.refKey=L,o.getMenuProps.suppressRefError=Y,le((b={},b[L]=bn(T,o.menuRef),b.role="listbox",b["aria-labelledby"]=J&&J["aria-label"]?void 0:o.labelId,b.id=o.menuId,b),J)},o.getItemProps=function(v){var x,b=v===void 0?{}:v,_=b.onMouseMove,E=b.onMouseDown,L=b.onClick;b.onPress;var T=b.index,J=b.item,q=J===void 0?process.env.NODE_ENV==="production"?void 0:Tf("getItemProps","item"):J,z=kt(b,Kf);T===void 0?(o.items.push(q),T=o.items.indexOf(q)):o.items[T]=q;var Y="onClick",ee=L,U=(x={onMouseMove:Le(_,function(){T!==o.getState().highlightedIndex&&(o.setHighlightedIndex(T,{type:ba}),o.avoidScrolling=!0,o.internalSetTimeout(function(){return o.avoidScrolling=!1},250))}),onMouseDown:Le(E,function(ne){ne.preventDefault()})},x[Y]=Le(ee,function(){o.selectItemAtIndex(T,{type:Sa})}),x),se=z.disabled?{onMouseDown:U.onMouseDown}:U;return le({id:o.getItemId(T),role:"option","aria-selected":o.getState().highlightedIndex===T},se,z)},o.clearItems=function(){o.items=[]},o.reset=function(v,x){v===void 0&&(v={}),v=gr(v),o.internalSetState(function(b){var _=b.selectedItem;return le({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,inputValue:o.props.itemToString(_)},v)},x)},o.toggleMenu=function(v,x){v===void 0&&(v={}),v=gr(v),o.internalSetState(function(b){var _=b.isOpen;return le({isOpen:!_},_&&{highlightedIndex:o.props.defaultHighlightedIndex},v)},function(){var b=o.getState(),_=b.isOpen,E=b.highlightedIndex;_&&o.getItemCount()>0&&typeof E=="number"&&o.setHighlightedIndex(E,v),es(x)()})},o.openMenu=function(v){o.internalSetState({isOpen:!0},v)},o.closeMenu=function(v){o.internalSetState({isOpen:!1},v)},o.updateStatus=Bo(function(){var v;if((v=o.props)!=null&&(v=v.environment)!=null&&v.document){var x=o.getState(),b=o.items[x.highlightedIndex],_=o.getItemCount(),E=o.props.getA11yStatusMessage(le({itemToString:o.props.itemToString,previousResultCount:o.previousResultCount,resultCount:_,highlightedItem:b},x));o.previousResultCount=_,Ia(E,o.props.environment.document)}},200);var s=o.props,a=s.defaultHighlightedIndex,c=s.initialHighlightedIndex,l=c===void 0?a:c,d=s.defaultIsOpen,f=s.initialIsOpen,m=f===void 0?d:f,p=s.initialInputValue,y=p===void 0?"":p,I=s.initialSelectedItem,w=I===void 0?null:I,C=o.getState({highlightedIndex:l,isOpen:m,inputValue:y,selectedItem:w});return C.selectedItem!=null&&o.props.initialInputValue===void 0&&(C.inputValue=o.props.itemToString(C.selectedItem)),o.state=C,o}ff(n,t);var r=n.prototype;return r.internalClearTimeouts=function(){this.timeoutIds.forEach(function(o){clearTimeout(o)}),this.timeoutIds=[]},r.getState=function(o){return o===void 0&&(o=this.state),Er(o,this.props)},r.getItemCount=function(){var o=this.items.length;return this.itemCount!=null?o=this.itemCount:this.props.itemCount!==void 0&&(o=this.props.itemCount),o},r.getItemNodeFromIndex=function(o){return this.props.environment?this.props.environment.document.getElementById(this.getItemId(o)):null},r.scrollHighlightedItemIntoView=function(){{var o=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(o,this._menuNode)}},r.moveHighlightedIndex=function(o,s){var a=this.getItemCount(),c=this.getState(),l=c.highlightedIndex;if(a>0){var d=un(l,o,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(d,s)}},r.getStateAndHelpers=function(){var o=this.getState(),s=o.highlightedIndex,a=o.inputValue,c=o.selectedItem,l=o.isOpen,d=this.props.itemToString,f=this.id,m=this.getRootProps,p=this.getToggleButtonProps,y=this.getLabelProps,I=this.getMenuProps,w=this.getInputProps,C=this.getItemProps,v=this.openMenu,x=this.closeMenu,b=this.toggleMenu,_=this.selectItem,E=this.selectItemAtIndex,L=this.selectHighlightedItem,T=this.setHighlightedIndex,J=this.clearSelection,q=this.clearItems,z=this.reset,Y=this.setItemCount,ee=this.unsetItemCount,U=this.internalSetState;return{getRootProps:m,getToggleButtonProps:p,getLabelProps:y,getMenuProps:I,getInputProps:w,getItemProps:C,reset:z,openMenu:v,closeMenu:x,toggleMenu:b,selectItem:_,selectItemAtIndex:E,selectHighlightedItem:L,setHighlightedIndex:T,clearSelection:J,clearItems:q,setItemCount:Y,unsetItemCount:ee,setState:U,itemToString:d,id:f,highlightedIndex:s,inputValue:a,isOpen:l,selectedItem:c}},r.componentDidMount=function(){var o=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&rs(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){o.internalClearTimeouts()};else{var s=function(){o.isMouseDown=!0},a=function(p){o.isMouseDown=!1;var y=Nr(p.target,[o._rootNode,o._menuNode],o.props.environment);!y&&o.getState().isOpen&&o.reset({type:_a},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},c=function(){o.isTouchMove=!1},l=function(){o.isTouchMove=!0},d=function(p){var y=Nr(p.target,[o._rootNode,o._menuNode],o.props.environment,!1);!o.isTouchMove&&!y&&o.getState().isOpen&&o.reset({type:Da},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},f=this.props.environment;f.addEventListener("mousedown",s),f.addEventListener("mouseup",a),f.addEventListener("touchstart",c),f.addEventListener("touchmove",l),f.addEventListener("touchend",d),this.cleanup=function(){o.internalClearTimeouts(),o.updateStatus.cancel(),f.removeEventListener("mousedown",s),f.removeEventListener("mouseup",a),f.removeEventListener("touchstart",c),f.removeEventListener("touchmove",l),f.removeEventListener("touchend",d)}}},r.shouldScroll=function(o,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,c=a.highlightedIndex,l=s.highlightedIndex===void 0?o:s,d=l.highlightedIndex,f=c&&this.getState().isOpen&&!o.isOpen,m=c!==d;return f||m},r.componentDidUpdate=function(o,s){process.env.NODE_ENV!=="production"&&(qo(this.state,o,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&rs(this._menuNode,this.getMenuProps)),Sr(this.props,"selectedItem")&&this.props.selectedItemChanged(o.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Pa,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(s,o)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},r.componentWillUnmount=function(){this.cleanup()},r.render=function(){var o=ns(this.props.children,it);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var s=ns(o(this.getStateAndHelpers()));if(!s)return null;if(this.getRootProps.called||this.props.suppressRefError)return process.env.NODE_ENV!=="production"&&!this.getRootProps.suppressRefError&&!this.props.suppressRefError&&Vf(s,this.getRootProps),s;if(ga(s))return g.cloneElement(s,this.getRootProps(va(s)));if(process.env.NODE_ENV!=="production")throw new Error("downshift: If you return a non-DOM element, you must apply the getRootProps function")},n}(g.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:Nf,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&Af(n)&&!n.hasOwnProperty("toString")&&console.warn("downshift: An object was passed to the default implementation of `itemToString`. You should probably provide your own `itemToString` implementation. Please refer to the `itemToString` API documentation.","The object that was passed:",n),String(n))},onStateChange:it,onInputValueChange:it,onUserAction:it,onChange:it,onSelect:it,onOuterClick:it,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:ma},e.stateChangeTypes=jf,e}();process.env.NODE_ENV!=="production"&&($f.propTypes={children:F.func,defaultHighlightedIndex:F.number,defaultIsOpen:F.bool,initialHighlightedIndex:F.number,initialSelectedItem:F.any,initialInputValue:F.string,initialIsOpen:F.bool,getA11yStatusMessage:F.func,itemToString:F.func,onChange:F.func,onSelect:F.func,onStateChange:F.func,onInputValueChange:F.func,onUserAction:F.func,onOuterClick:F.func,selectedItemChanged:F.func,stateReducer:F.func,itemCount:F.number,id:F.string,environment:F.shape({addEventListener:F.func.isRequired,removeEventListener:F.func.isRequired,document:F.shape({createElement:F.func.isRequired,getElementById:F.func.isRequired,activeElement:F.any.isRequired,body:F.any.isRequired}).isRequired,Node:F.func.isRequired}),suppressRefError:F.bool,scrollIntoView:F.func,selectedItem:F.any,isOpen:F.bool,inputValue:F.string,highlightedIndex:F.number,labelId:F.string,inputId:F.string,menuId:F.string,getItemId:F.func});function rs(e,t){var n=t.refKey;e||console.error('downshift: The ref prop "'+n+'" from getMenuProps was not applied correctly on your menu element.')}function Vf(e,t){var n=t.refKey,r=n!=="ref",i=!ga(e);i&&!r&&!Yi.isForwardRef(e)?console.error("downshift: You returned a non-DOM element. You must specify a refKey in getRootProps"):!i&&r&&console.error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "'+n+'"'),!Yi.isForwardRef(e)&&!va(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var ja={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function Hf(e,t,n){var r=e.props,i=e.type,o={};Object.keys(t).forEach(function(s){Uf(s,e,t,n),n[s]!==t[s]&&(o[s]=n[s])}),r.onStateChange&&Object.keys(o).length&&r.onStateChange(le({type:i},o))}function Uf(e,t,n,r){var i=t.props,o=t.type,s="on"+Wo(e)+"Change";i[s]&&r[e]!==void 0&&r[e]!==n[e]&&i[s](le({type:o},r))}function Bf(e,t){return t.changes}var os=Bo(function(e,t){Ia(e,t)},200),qf=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?g.useLayoutEffect:g.useEffect,Wf="useId"in g?function(t){var n=t.id,r=t.labelId,i=t.menuId,o=t.getItemId,s=t.toggleButtonId,a=t.inputId,c="downshift-"+g.useId();n||(n=c);var l=g.useRef({labelId:r||n+"-label",menuId:i||n+"-menu",getItemId:o||function(d){return n+"-item-"+d},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"});return l.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+ha():n,i=t.labelId,o=t.menuId,s=t.getItemId,a=t.toggleButtonId,c=t.inputId,l=g.useRef({labelId:i||r+"-label",menuId:o||r+"-menu",getItemId:s||function(d){return r+"-item-"+d},toggleButtonId:a||r+"-toggle-button",inputId:c||r+"-input"});return l.current};function Jf(e,t,n,r){var i,o;if(e===void 0){if(t===void 0)throw new Error(r);i=n[t],o=t}else o=t===void 0?n.indexOf(e):t,i=e;return[i,o]}function Wo(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Fa(e){var t=g.useRef(e);return t.current=e,t}function zf(e,t,n,r){var i=g.useRef(),o=g.useRef(),s=g.useCallback(function(p,y){o.current=y,p=Er(p,y.props);var I=e(p,y),w=y.props.stateReducer(p,le({},y,{changes:I}));return w},[e]),a=g.useReducer(s,t,n),c=a[0],l=a[1],d=Fa(t),f=g.useCallback(function(p){return l(le({props:d.current},p))},[d]),m=o.current;return g.useEffect(function(){var p=Er(i.current,m==null?void 0:m.props),y=m&&i.current&&!r(p,c);y&&Hf(m,p,c),i.current=c},[c,m,r]),[c,f]}var $n={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:Bf,scrollIntoView:ma,environment:typeof window>"u"?void 0:window};function Wt(e,t,n){n===void 0&&(n=ja);var r=e["default"+Wo(t)];return r!==void 0?r:n[t]}function Vn(e,t,n){n===void 0&&(n=ja);var r=e[t];if(r!==void 0)return r;var i=e["initial"+Wo(t)];return i!==void 0?i:Wt(e,t,n)}function Xf(e){var t=Vn(e,"selectedItem"),n=Vn(e,"isOpen"),r=em(e),i=Vn(e,"inputValue");return{highlightedIndex:r<0&&t&&n?e.items.findIndex(function(o){return e.itemToKey(o)===e.itemToKey(t)}):r,isOpen:n,selectedItem:t,inputValue:i}}function Hn(e,t,n){var r=e.items,i=e.initialHighlightedIndex,o=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,c=t.selectedItem,l=t.highlightedIndex;return r.length===0?-1:i!==void 0&&l===i&&!s(r[i],i)?i:o!==void 0&&!s(r[o],o)?o:c?r.findIndex(function(d){return a(c)===a(d)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function Gf(e,t,n){var r=g.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return g.useEffect(function(){if(!e)return it;var i=n.map(function(d){return d.current});function o(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(d){r.current.isMouseDown=!1,Nr(d.target,i,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function c(){r.current.isTouchMove=!0}function l(d){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!Nr(d.target,i,e,!1)&&t()}return e.addEventListener("mousedown",o),e.addEventListener("mouseup",s),e.addEventListener("touchstart",a),e.addEventListener("touchmove",c),e.addEventListener("touchend",l),function(){e.removeEventListener("mousedown",o),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",c),e.removeEventListener("touchend",l)}},[n,e,t]),r.current}var ka=function(){return it};process.env.NODE_ENV!=="production"&&(ka=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=g.useRef(n.reduce(function(s,a){return s[a]={},s},{}));g.useEffect(function(){Object.keys(i.current).forEach(function(s){var a=i.current[s];if(!Object.keys(a).length){console.error("downshift: You forgot to call the "+s+" getter function on your component / element.");return}var c=a.suppressRefError,l=a.refKey,d=a.elementRef;c||d!=null&&d.current||console.error('downshift: The ref prop "'+l+'" from '+s+" was not applied correctly on your element.")})},[]);var o=g.useCallback(function(s,a,c,l){i.current[s]={suppressRefError:a,refKey:c,elementRef:l}},[]);return o});function Yf(e,t,n,r){r===void 0&&(r={});var i=r.document,o=Vr();g.useEffect(function(){if(!(!e||o||!i)){var s=e(t);os(s,i)}},n),g.useEffect(function(){return function(){os.cancel(),Df(i)}},[i])}function Zf(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,i=e.getItemNodeFromIndex,o=e.menuElement,s=e.scrollIntoView,a=g.useRef(!0);return qf(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(i(t),o))},[t]),a}var Ma=it;process.env.NODE_ENV!=="production"&&(Ma=function(t){var n=t.props,r=t.state,i=g.useRef(n),o=Vr();g.useEffect(function(){o||(qo(r,i.current,n),i.current=n)},[r,n,o])});function is(e,t,n){var r;n===void 0&&(n=!0);var i=((r=e.items)==null?void 0:r.length)&&t>=0;return le({isOpen:!1,highlightedIndex:-1},i&&le({selectedItem:e.items[t],isOpen:Wt(e,"isOpen"),highlightedIndex:Wt(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function Qf(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function Vr(){var e=g.useRef(!0);return g.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function Co(e){var t=Wt(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function em(e){var t=Vn(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var xr={environment:F.shape({addEventListener:F.func.isRequired,removeEventListener:F.func.isRequired,document:F.shape({createElement:F.func.isRequired,getElementById:F.func.isRequired,activeElement:F.any.isRequired,body:F.any.isRequired}).isRequired,Node:F.func.isRequired}),itemToString:F.func,itemToKey:F.func,stateReducer:F.func},La=le({},xr,{getA11yStatusMessage:F.func,highlightedIndex:F.number,defaultHighlightedIndex:F.number,initialHighlightedIndex:F.number,isOpen:F.bool,defaultIsOpen:F.bool,initialIsOpen:F.bool,selectedItem:F.any,initialSelectedItem:F.any,defaultSelectedItem:F.any,id:F.string,labelId:F.string,menuId:F.string,getItemId:F.func,toggleButtonId:F.string,onSelectedItemChange:F.func,onHighlightedIndexChange:F.func,onStateChange:F.func,onIsOpenChange:F.func,scrollIntoView:F.func});function tm(e,t,n){var r=t.type,i=t.props,o;switch(r){case n.ItemMouseMove:o={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:o={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:o={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Hn(i,e,0)};break;case n.FunctionOpenMenu:o={isOpen:!0,highlightedIndex:Hn(i,e,0)};break;case n.FunctionCloseMenu:o={isOpen:!1};break;case n.FunctionSetHighlightedIndex:o={highlightedIndex:i.isItemDisabled(i.items[t.highlightedIndex],t.highlightedIndex)?-1:t.highlightedIndex};break;case n.FunctionSetInputValue:o={inputValue:t.inputValue};break;case n.FunctionReset:o={highlightedIndex:Co(i),isOpen:Wt(i,"isOpen"),selectedItem:Wt(i,"selectedItem"),inputValue:Wt(i,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return le({},e,o)}Cn(Cn({},La),{items:F.array.isRequired,isItemDisabled:F.func});Cn(Cn({},$n),{isItemDisabled:function(){return!1}});process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;var Jo=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,zo=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Xo=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Go=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,Yo=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Zo=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,Qo=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,ei=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,ti=process.env.NODE_ENV!=="production"?"__input_change__":8,Tr=process.env.NODE_ENV!=="production"?"__input_blur__":9,ni=process.env.NODE_ENV!=="production"?"__input_click__":10,Ka=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,$a=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,ri=process.env.NODE_ENV!=="production"?"__item_click__":13,Va=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,Ha=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,Ua=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,Ba=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,qa=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,oi=process.env.NODE_ENV!=="production"?"__function_select_item__":19,Wa=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,Ja=process.env.NODE_ENV!=="production"?"__function_reset__":21,ii=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,za=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:ii,FunctionCloseMenu:Ba,FunctionOpenMenu:Ua,FunctionReset:Ja,FunctionSelectItem:oi,FunctionSetHighlightedIndex:qa,FunctionSetInputValue:Wa,FunctionToggleMenu:Ha,InputBlur:Tr,InputChange:ti,InputClick:ni,InputKeyDownArrowDown:Jo,InputKeyDownArrowUp:zo,InputKeyDownEnd:Yo,InputKeyDownEnter:ei,InputKeyDownEscape:Xo,InputKeyDownHome:Go,InputKeyDownPageDown:Qo,InputKeyDownPageUp:Zo,ItemClick:ri,ItemMouseMove:$a,MenuMouseLeave:Ka,ToggleButtonClick:Va});function nm(e){var t=Xf(e),n=t.selectedItem,r=t.inputValue;return r===""&&n&&e.defaultInputValue===void 0&&e.initialInputValue===void 0&&e.inputValue===void 0&&(r=e.itemToString(n)),le({},t,{inputValue:r})}var rm=le({},La,{items:F.array.isRequired,isItemDisabled:F.func,inputValue:F.string,defaultInputValue:F.string,initialInputValue:F.string,inputId:F.string,onInputValueChange:F.func});function om(e,t,n,r){var i=g.useRef(),o=zf(e,t,n,r),s=o[0],a=o[1],c=Vr();return g.useEffect(function(){if(Sr(t,"selectedItem")){if(!c){var l=t.itemToKey(t.selectedItem)!==t.itemToKey(i.current);l&&a({type:ii,inputValue:t.itemToString(t.selectedItem)})}i.current=s.selectedItem===i.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[Er(s,t),a]}var Xa=it;process.env.NODE_ENV!=="production"&&(Xa=function(t,n){F.checkPropTypes(rm,t,"prop",n.name)});var im=le({},$n,{isItemDisabled:function(){return!1}});function sm(e,t){var n,r=t.type,i=t.props,o=t.altKey,s;switch(r){case ri:s={isOpen:Wt(i,"isOpen"),highlightedIndex:Co(i),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case Jo:e.isOpen?s={highlightedIndex:un(e.highlightedIndex,1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:o&&e.selectedItem==null?-1:Hn(i,e,1),isOpen:i.items.length>=0};break;case zo:e.isOpen?o?s=is(i,e.highlightedIndex):s={highlightedIndex:un(e.highlightedIndex,-1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:Hn(i,e,-1),isOpen:i.items.length>=0};break;case ei:s=is(i,e.highlightedIndex);break;case Xo:s=le({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Zo:s={highlightedIndex:un(e.highlightedIndex,-10,i.items,i.isItemDisabled,!0)};break;case Qo:s={highlightedIndex:un(e.highlightedIndex,10,i.items,i.isItemDisabled,!0)};break;case Go:s={highlightedIndex:On(0,!1,i.items,i.isItemDisabled)};break;case Yo:s={highlightedIndex:On(i.items.length-1,!0,i.items,i.isItemDisabled)};break;case Tr:s=le({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&((n=i.items)==null?void 0:n.length)&&t.selectItem&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])});break;case ti:s={isOpen:!0,highlightedIndex:Co(i),inputValue:t.inputValue};break;case ni:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Hn(i,e,0)};break;case oi:s={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case ii:s={inputValue:t.inputValue};break;default:return tm(e,t,za)}return le({},e,s)}var am=["onMouseLeave","refKey","ref"],cm=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],lm=["onClick","onPress","refKey","ref"],um=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];si.stateChangeTypes=za;function si(e){e===void 0&&(e={}),Xa(e,si);var t=le({},im,e),n=t.items,r=t.scrollIntoView,i=t.environment,o=t.getA11yStatusMessage,s=om(sm,t,nm,Qf),a=s[0],c=s[1],l=a.isOpen,d=a.highlightedIndex,f=a.selectedItem,m=a.inputValue,p=g.useRef(null),y=g.useRef({}),I=g.useRef(null),w=g.useRef(null),C=Vr(),v=Wf(t),x=g.useRef(),b=Fa({state:a,props:t}),_=g.useCallback(function(k){return y.current[v.getItemId(k)]},[v]);Yf(o,a,[l,d,f,m],i);var E=Zf({menuElement:p.current,highlightedIndex:d,isOpen:l,itemRefs:y,scrollIntoView:r,getItemNodeFromIndex:_});Ma({props:t,state:a}),g.useEffect(function(){var k=Vn(t,"isOpen");k&&I.current&&I.current.focus()},[]),g.useEffect(function(){C||(x.current=n.length)});var L=Gf(i,g.useCallback(function(){b.current.state.isOpen&&c({type:Tr,selectItem:!1})},[c,b]),g.useMemo(function(){return[p,w,I]},[p.current,w.current,I.current])),T=ka("getInputProps","getMenuProps");g.useEffect(function(){l||(y.current={})},[l]),g.useEffect(function(){var k;!l||!(i!=null&&i.document)||!(I!=null&&(k=I.current)!=null&&k.focus)||i.document.activeElement!==I.current&&I.current.focus()},[l,i]);var J=g.useMemo(function(){return{ArrowDown:function(j){j.preventDefault(),c({type:Jo,altKey:j.altKey})},ArrowUp:function(j){j.preventDefault(),c({type:zo,altKey:j.altKey})},Home:function(j){b.current.state.isOpen&&(j.preventDefault(),c({type:Go}))},End:function(j){b.current.state.isOpen&&(j.preventDefault(),c({type:Yo}))},Escape:function(j){var D=b.current.state;(D.isOpen||D.inputValue||D.selectedItem||D.highlightedIndex>-1)&&(j.preventDefault(),c({type:Xo}))},Enter:function(j){var D=b.current.state;!D.isOpen||j.which===229||(j.preventDefault(),c({type:ei}))},PageUp:function(j){b.current.state.isOpen&&(j.preventDefault(),c({type:Zo}))},PageDown:function(j){b.current.state.isOpen&&(j.preventDefault(),c({type:Qo}))}}},[c,b]),q=g.useCallback(function(k){return le({id:v.labelId,htmlFor:v.inputId},k)},[v]),z=g.useCallback(function(k,j){var D,R=k===void 0?{}:k,X=R.onMouseLeave,G=R.refKey,K=G===void 0?"ref":G,Z=R.ref,B=kt(R,am),ae=j===void 0?{}:j,A=ae.suppressRefError,pe=A===void 0?!1:A;return T("getMenuProps",pe,K,p),le((D={},D[K]=bn(Z,function($){p.current=$}),D.id=v.menuId,D.role="listbox",D["aria-labelledby"]=B&&B["aria-label"]?void 0:""+v.labelId,D.onMouseLeave=Le(X,function(){c({type:Ka})}),D),B)},[c,T,v]),Y=g.useCallback(function(k){var j,D,R=k===void 0?{}:k,X=R.item,G=R.index,K=R.refKey,Z=K===void 0?"ref":K,B=R.ref,ae=R.onMouseMove,A=R.onMouseDown,pe=R.onClick;R.onPress;var $=R.disabled,Ie=kt(R,cm);$!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var De=b.current,Ue=De.props,je=De.state,me=Jf(X,G,Ue.items,"Pass either item or index to getItemProps!"),gt=me[0],Be=me[1],nt=Ue.isItemDisabled(gt,Be),vt="onClick",yt=pe,qe=function(){L.isTouchEnd||Be===je.highlightedIndex||(E.current=!1,c({type:$a,index:Be,disabled:nt}))},Ke=function(){c({type:ri,index:Be})},Fe=function(It){return It.preventDefault()};return le((j={},j[Z]=bn(B,function(Ee){Ee&&(y.current[v.getItemId(Be)]=Ee)}),j["aria-disabled"]=nt,j["aria-selected"]=Be===je.highlightedIndex,j.id=v.getItemId(Be),j.role="option",j),!nt&&(D={},D[vt]=Le(yt,Ke),D),{onMouseMove:Le(ae,qe),onMouseDown:Le(A,Fe)},Ie)},[c,v,b,L,E]),ee=g.useCallback(function(k){var j,D=k===void 0?{}:k,R=D.onClick;D.onPress;var X=D.refKey,G=X===void 0?"ref":X,K=D.ref,Z=kt(D,lm),B=b.current.state,ae=function(){c({type:Va})};return le((j={},j[G]=bn(K,function(A){w.current=A}),j["aria-controls"]=v.menuId,j["aria-expanded"]=B.isOpen,j.id=v.toggleButtonId,j.tabIndex=-1,j),!Z.disabled&&le({},{onClick:Le(R,ae)}),Z)},[c,b,v]),U=g.useCallback(function(k,j){var D,R=k===void 0?{}:k,X=R.onKeyDown,G=R.onChange,K=R.onInput,Z=R.onBlur;R.onChangeText;var B=R.onClick,ae=R.refKey,A=ae===void 0?"ref":ae,pe=R.ref,$=kt(R,um),Ie=j===void 0?{}:j,De=Ie.suppressRefError,Ue=De===void 0?!1:De;T("getInputProps",Ue,A,I);var je=b.current.state,me=function(Fe){var Ee=bo(Fe);Ee&&J[Ee]&&J[Ee](Fe)},gt=function(Fe){c({type:ti,inputValue:Fe.target.value})},Be=function(Fe){if(i!=null&&i.document&&je.isOpen&&!L.isMouseDown){var Ee=Fe.relatedTarget===null&&i.document.activeElement!==i.document.body;c({type:Tr,selectItem:!Ee})}},nt=function(){c({type:ni})},vt="onChange",yt={};if(!$.disabled){var qe;yt=(qe={},qe[vt]=Le(G,K,gt),qe.onKeyDown=Le(X,me),qe.onBlur=Le(Z,Be),qe.onClick=Le(B,nt),qe)}return le((D={},D[A]=bn(pe,function(Ke){I.current=Ke}),D["aria-activedescendant"]=je.isOpen&&je.highlightedIndex>-1?v.getItemId(je.highlightedIndex):"",D["aria-autocomplete"]="list",D["aria-controls"]=v.menuId,D["aria-expanded"]=je.isOpen,D["aria-labelledby"]=$&&$["aria-label"]?void 0:v.labelId,D.autoComplete="off",D.id=v.inputId,D.role="combobox",D.value=je.inputValue,D),yt,$)},[c,v,i,J,b,L,T]),se=g.useCallback(function(){c({type:Ha})},[c]),ne=g.useCallback(function(){c({type:Ba})},[c]),Q=g.useCallback(function(){c({type:Ua})},[c]),de=g.useCallback(function(k){c({type:qa,highlightedIndex:k})},[c]),fe=g.useCallback(function(k){c({type:oi,selectedItem:k})},[c]),S=g.useCallback(function(k){c({type:Wa,inputValue:k})},[c]),P=g.useCallback(function(){c({type:Ja})},[c]);return{getItemProps:Y,getLabelProps:q,getMenuProps:z,getInputProps:U,getToggleButtonProps:ee,toggleMenu:se,openMenu:Q,closeMenu:ne,setHighlightedIndex:de,setInputValue:S,selectItem:fe,reset:P,highlightedIndex:d,isOpen:l,selectedItem:f,inputValue:m}}xr.stateReducer,xr.itemToKey,xr.environment,F.array,F.array,F.array,F.func,F.number,F.number,F.number,F.func,F.func,F.string,F.string;$n.itemToKey,$n.stateReducer,$n.environment;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;const dm="_comboboxContainer_9s7ov_1",pm="_label_9s7ov_8",fm="_inputContainer_9s7ov_12",mm="_input_9s7ov_12",hm="_toggleButton_9s7ov_33",gm="_menu_9s7ov_39",vm="_menuItem_9s7ov_54",ym="_highlighted_9s7ov_61",Im="_selected_9s7ov_65",wm="_hidden_9s7ov_69",Ft={comboboxContainer:dm,label:pm,inputContainer:fm,input:mm,toggleButton:hm,menu:gm,menuItem:vm,highlighted:ym,selected:Im,hidden:wm};function _m(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function bm({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:i}){const[o,s]=g.useState(e),a=g.useRef(null);g.useEffect(()=>s(e),[e]);const c=b=>{s(e.filter(_m(b)))},{isOpen:l,getToggleButtonProps:d,getMenuProps:f,getInputProps:m,highlightedIndex:p,getItemProps:y,setInputValue:I}=si({items:o,selectedItem:t?e.find(b=>b.value===t):null,itemToString:b=>(b==null?void 0:b.label)||"",onInputValueChange:({inputValue:b})=>c(b),onSelectedItemChange:({selectedItem:b})=>{var _;(_=a.current)==null||_.blur(),n(b)}}),w=()=>{I(""),s(e)},C=()=>w(),v=g.useMemo(()=>{var b;return(b=e.find(_=>_.value===t))==null?void 0:b.label},[e,t]),x=()=>I(v||"");return u.jsxs("div",{children:[u.jsx("div",{className:Ft.comboboxContainer,children:u.jsxs("div",{className:Ft.inputContainer,children:[u.jsx("input",{style:{border:"none"},disabled:i,placeholder:v||r,className:Ft.input,...m({onFocus:C,onBlur:x,ref:a})}),u.jsx("button",{style:{border:"none"},disabled:i,"aria-label":"toggle menu",className:Ft.toggleButton,type:"button",...d(),children:l?u.jsx(u.Fragment,{children:"↑"}):u.jsx(u.Fragment,{children:"↓"})})]})}),u.jsx("ul",{className:`${Ft.menu} ${l&&e.length?"":Ft.hidden}`,...f(),children:l&&o.map((b,_)=>u.jsx("li",{className:`${Ft.menuItem} ${p===_?Ft.highlighted:""} ${t===(b==null?void 0:b.value)?Ft.selected:""}`,...y({item:b,index:_}),children:u.jsx("span",{children:b.label})},b.id))})]})}const En=Math.min,dn=Math.max,Rr=Math.round,vr=Math.floor,Xt=e=>({x:e,y:e}),xm={left:"right",right:"left",bottom:"top",top:"bottom"},Cm={start:"end",end:"start"};function Oo(e,t,n){return dn(e,En(t,n))}function Gn(e,t){return typeof e=="function"?e(t):e}function mn(e){return e.split("-")[0]}function Yn(e){return e.split("-")[1]}function Ga(e){return e==="x"?"y":"x"}function ai(e){return e==="y"?"height":"width"}function Sn(e){return["top","bottom"].includes(mn(e))?"y":"x"}function ci(e){return Ga(Sn(e))}function Om(e,t,n){n===void 0&&(n=!1);const r=Yn(e),i=ci(e),o=ai(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Ar(s)),[s,Ar(s)]}function Em(e){const t=Ar(e);return[Eo(e),t,Eo(t)]}function Eo(e){return e.replace(/start|end/g,t=>Cm[t])}function Sm(e,t,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:r:t?r:i;case"left":case"right":return t?o:s;default:return[]}}function Nm(e,t,n,r){const i=Yn(e);let o=Sm(mn(e),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(Eo)))),o}function Ar(e){return e.replace(/left|right|bottom|top/g,t=>xm[t])}function Tm(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ya(e){return typeof e!="number"?Tm(e):{top:e,right:e,bottom:e,left:e}}function Pr(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ss(e,t,n){let{reference:r,floating:i}=e;const o=Sn(t),s=ci(t),a=ai(s),c=mn(t),l=o==="y",d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,m=r[a]/2-i[a]/2;let p;switch(c){case"top":p={x:d,y:r.y-i.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Yn(t)){case"start":p[s]-=m*(n&&l?-1:1);break;case"end":p[s]+=m*(n&&l?-1:1);break}return p}const Rm=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t));let l=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:f}=ss(l,r,c),m=r,p={},y=0;for(let I=0;I<a.length;I++){const{name:w,fn:C}=a[I],{x:v,y:x,data:b,reset:_}=await C({x:d,y:f,initialPlacement:r,placement:m,strategy:i,middlewareData:p,rects:l,platform:s,elements:{reference:e,floating:t}});d=v??d,f=x??f,p={...p,[w]:{...p[w],...b}},_&&y<=50&&(y++,typeof _=="object"&&(_.placement&&(m=_.placement),_.rects&&(l=_.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):_.rects),{x:d,y:f}=ss(l,m,c)),I=-1)}return{x:d,y:f,placement:m,strategy:i,middlewareData:p}};async function Za(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:m=!1,padding:p=0}=Gn(t,e),y=Ya(p),w=a[m?f==="floating"?"reference":"floating":f],C=Pr(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(w)))==null||n?w:w.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:l,rootBoundary:d,strategy:c})),v=f==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,x=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),b=await(o.isElement==null?void 0:o.isElement(x))?await(o.getScale==null?void 0:o.getScale(x))||{x:1,y:1}:{x:1,y:1},_=Pr(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:x,strategy:c}):v);return{top:(C.top-_.top+y.top)/b.y,bottom:(_.bottom-C.bottom+y.bottom)/b.y,left:(C.left-_.left+y.left)/b.x,right:(_.right-C.right+y.right)/b.x}}const Am=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:c}=t,{element:l,padding:d=0}=Gn(e,t)||{};if(l==null)return{};const f=Ya(d),m={x:n,y:r},p=ci(i),y=ai(p),I=await s.getDimensions(l),w=p==="y",C=w?"top":"left",v=w?"bottom":"right",x=w?"clientHeight":"clientWidth",b=o.reference[y]+o.reference[p]-m[p]-o.floating[y],_=m[p]-o.reference[p],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l));let L=E?E[x]:0;(!L||!await(s.isElement==null?void 0:s.isElement(E)))&&(L=a.floating[x]||o.floating[y]);const T=b/2-_/2,J=L/2-I[y]/2-1,q=En(f[C],J),z=En(f[v],J),Y=q,ee=L-I[y]-z,U=L/2-I[y]/2+T,se=Oo(Y,U,ee),ne=!c.arrow&&Yn(i)!=null&&U!==se&&o.reference[y]/2-(U<Y?q:z)-I[y]/2<0,Q=ne?U<Y?U-Y:U-ee:0;return{[p]:m[p]+Q,data:{[p]:se,centerOffset:U-se-Q,...ne&&{alignmentOffset:Q}},reset:ne}}}),Pm=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:c,elements:l}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:I=!0,...w}=Gn(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const C=mn(i),v=Sn(a),x=mn(a)===a,b=await(c.isRTL==null?void 0:c.isRTL(l.floating)),_=m||(x||!I?[Ar(a)]:Em(a)),E=y!=="none";!m&&E&&_.push(...Nm(a,I,y,b));const L=[a,..._],T=await Za(t,w),J=[];let q=((r=o.flip)==null?void 0:r.overflows)||[];if(d&&J.push(T[C]),f){const U=Om(i,s,b);J.push(T[U[0]],T[U[1]])}if(q=[...q,{placement:i,overflows:J}],!J.every(U=>U<=0)){var z,Y;const U=(((z=o.flip)==null?void 0:z.index)||0)+1,se=L[U];if(se)return{data:{index:U,overflows:q},reset:{placement:se}};let ne=(Y=q.filter(Q=>Q.overflows[0]<=0).sort((Q,de)=>Q.overflows[1]-de.overflows[1])[0])==null?void 0:Y.placement;if(!ne)switch(p){case"bestFit":{var ee;const Q=(ee=q.filter(de=>{if(E){const fe=Sn(de.placement);return fe===v||fe==="y"}return!0}).map(de=>[de.placement,de.overflows.filter(fe=>fe>0).reduce((fe,S)=>fe+S,0)]).sort((de,fe)=>de[1]-fe[1])[0])==null?void 0:ee[0];Q&&(ne=Q);break}case"initialPlacement":ne=a;break}if(i!==ne)return{reset:{placement:ne}}}return{}}}};async function Dm(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=mn(n),a=Yn(n),c=Sn(n)==="y",l=["left","top"].includes(s)?-1:1,d=o&&c?-1:1,f=Gn(t,e);let{mainAxis:m,crossAxis:p,alignmentAxis:y}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof y=="number"&&(p=a==="end"?y*-1:y),c?{x:p*d,y:m*l}:{x:m*l,y:p*d}}const jm=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=t,c=await Dm(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:o+c.y,data:{...c,placement:s}}}}},Fm=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:w=>{let{x:C,y:v}=w;return{x:C,y:v}}},...c}=Gn(e,t),l={x:n,y:r},d=await Za(t,c),f=Sn(mn(i)),m=Ga(f);let p=l[m],y=l[f];if(o){const w=m==="y"?"top":"left",C=m==="y"?"bottom":"right",v=p+d[w],x=p-d[C];p=Oo(v,p,x)}if(s){const w=f==="y"?"top":"left",C=f==="y"?"bottom":"right",v=y+d[w],x=y-d[C];y=Oo(v,y,x)}const I=a.fn({...t,[m]:p,[f]:y});return{...I,data:{x:I.x-n,y:I.y-r,enabled:{[m]:o,[f]:s}}}}}};function Hr(){return typeof window<"u"}function jn(e){return Qa(e)?(e.nodeName||"").toLowerCase():"#document"}function at(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Nt(e){var t;return(t=(Qa(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Qa(e){return Hr()?e instanceof Node||e instanceof at(e).Node:!1}function Ct(e){return Hr()?e instanceof Element||e instanceof at(e).Element:!1}function St(e){return Hr()?e instanceof HTMLElement||e instanceof at(e).HTMLElement:!1}function as(e){return!Hr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof at(e).ShadowRoot}function Zn(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Ot(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function km(e){return["table","td","th"].includes(jn(e))}function Ur(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function li(e){const t=ui(),n=Ct(e)?Ot(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Mm(e){let t=Gt(e);for(;St(t)&&!Nn(t);){if(li(t))return t;if(Ur(t))return null;t=Gt(t)}return null}function ui(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Nn(e){return["html","body","#document"].includes(jn(e))}function Ot(e){return at(e).getComputedStyle(e)}function Br(e){return Ct(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Gt(e){if(jn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||as(e)&&e.host||Nt(e);return as(t)?t.host:t}function ec(e){const t=Gt(e);return Nn(t)?e.ownerDocument?e.ownerDocument.body:e.body:St(t)&&Zn(t)?t:ec(t)}function qn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=ec(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),s=at(i);if(o){const a=So(s);return t.concat(s,s.visualViewport||[],Zn(i)?i:[],a&&n?qn(a):[])}return t.concat(i,qn(i,[],n))}function So(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function tc(e){const t=Ot(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=St(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=Rr(n)!==o||Rr(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function di(e){return Ct(e)?e:e.contextElement}function xn(e){const t=di(e);if(!St(t))return Xt(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=tc(t);let s=(o?Rr(n.width):n.width)/r,a=(o?Rr(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const Lm=Xt(0);function nc(e){const t=at(e);return!ui()||!t.visualViewport?Lm:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Km(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==at(e)?!1:t}function hn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=di(e);let s=Xt(1);t&&(r?Ct(r)&&(s=xn(r)):s=xn(e));const a=Km(o,n,r)?nc(o):Xt(0);let c=(i.left+a.x)/s.x,l=(i.top+a.y)/s.y,d=i.width/s.x,f=i.height/s.y;if(o){const m=at(o),p=r&&Ct(r)?at(r):r;let y=m,I=So(y);for(;I&&r&&p!==y;){const w=xn(I),C=I.getBoundingClientRect(),v=Ot(I),x=C.left+(I.clientLeft+parseFloat(v.paddingLeft))*w.x,b=C.top+(I.clientTop+parseFloat(v.paddingTop))*w.y;c*=w.x,l*=w.y,d*=w.x,f*=w.y,c+=x,l+=b,y=at(I),I=So(y)}}return Pr({width:d,height:f,x:c,y:l})}function $m(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",s=Nt(r),a=t?Ur(t.floating):!1;if(r===s||a&&o)return n;let c={scrollLeft:0,scrollTop:0},l=Xt(1);const d=Xt(0),f=St(r);if((f||!f&&!o)&&((jn(r)!=="body"||Zn(s))&&(c=Br(r)),St(r))){const m=hn(r);l=xn(r),d.x=m.x+r.clientLeft,d.y=m.y+r.clientTop}return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+d.x,y:n.y*l.y-c.scrollTop*l.y+d.y}}function Vm(e){return Array.from(e.getClientRects())}function No(e,t){const n=Br(e).scrollLeft;return t?t.left+n:hn(Nt(e)).left+n}function Hm(e){const t=Nt(e),n=Br(e),r=e.ownerDocument.body,i=dn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=dn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+No(e);const a=-n.scrollTop;return Ot(r).direction==="rtl"&&(s+=dn(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function Um(e,t){const n=at(e),r=Nt(e),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,c=0;if(i){o=i.width,s=i.height;const l=ui();(!l||l&&t==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:o,height:s,x:a,y:c}}function Bm(e,t){const n=hn(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=St(e)?xn(e):Xt(1),s=e.clientWidth*o.x,a=e.clientHeight*o.y,c=i*o.x,l=r*o.y;return{width:s,height:a,x:c,y:l}}function cs(e,t,n){let r;if(t==="viewport")r=Um(e,n);else if(t==="document")r=Hm(Nt(e));else if(Ct(t))r=Bm(t,n);else{const i=nc(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return Pr(r)}function rc(e,t){const n=Gt(e);return n===t||!Ct(n)||Nn(n)?!1:Ot(n).position==="fixed"||rc(n,t)}function qm(e,t){const n=t.get(e);if(n)return n;let r=qn(e,[],!1).filter(a=>Ct(a)&&jn(a)!=="body"),i=null;const o=Ot(e).position==="fixed";let s=o?Gt(e):e;for(;Ct(s)&&!Nn(s);){const a=Ot(s),c=li(s);!c&&a.position==="fixed"&&(i=null),(o?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Zn(s)&&!c&&rc(e,s))?r=r.filter(d=>d!==s):i=a,s=Gt(s)}return t.set(e,r),r}function Wm(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?Ur(t)?[]:qm(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((l,d)=>{const f=cs(t,d,i);return l.top=dn(f.top,l.top),l.right=En(f.right,l.right),l.bottom=En(f.bottom,l.bottom),l.left=dn(f.left,l.left),l},cs(t,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Jm(e){const{width:t,height:n}=tc(e);return{width:t,height:n}}function zm(e,t,n){const r=St(t),i=Nt(t),o=n==="fixed",s=hn(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const c=Xt(0);if(r||!r&&!o)if((jn(t)!=="body"||Zn(i))&&(a=Br(t)),r){const p=hn(t,!0,o,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else i&&(c.x=No(i));let l=0,d=0;if(i&&!r&&!o){const p=i.getBoundingClientRect();d=p.top+a.scrollTop,l=p.left+a.scrollLeft-No(i,p)}const f=s.left+a.scrollLeft-c.x-l,m=s.top+a.scrollTop-c.y-d;return{x:f,y:m,width:s.width,height:s.height}}function po(e){return Ot(e).position==="static"}function ls(e,t){if(!St(e)||Ot(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Nt(e)===n&&(n=n.ownerDocument.body),n}function oc(e,t){const n=at(e);if(Ur(e))return n;if(!St(e)){let i=Gt(e);for(;i&&!Nn(i);){if(Ct(i)&&!po(i))return i;i=Gt(i)}return n}let r=ls(e,t);for(;r&&km(r)&&po(r);)r=ls(r,t);return r&&Nn(r)&&po(r)&&!li(r)?n:r||Mm(e)||n}const Xm=async function(e){const t=this.getOffsetParent||oc,n=this.getDimensions,r=await n(e.floating);return{reference:zm(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Gm(e){return Ot(e).direction==="rtl"}const Ym={convertOffsetParentRelativeRectToViewportRelativeRect:$m,getDocumentElement:Nt,getClippingRect:Wm,getOffsetParent:oc,getElementRects:Xm,getClientRects:Vm,getDimensions:Jm,getScale:xn,isElement:Ct,isRTL:Gm};function Zm(e,t){let n=null,r;const i=Nt(e);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),o();const{left:l,top:d,width:f,height:m}=e.getBoundingClientRect();if(a||t(),!f||!m)return;const p=vr(d),y=vr(i.clientWidth-(l+f)),I=vr(i.clientHeight-(d+m)),w=vr(l),v={rootMargin:-p+"px "+-y+"px "+-I+"px "+-w+"px",threshold:dn(0,En(1,c))||1};let x=!0;function b(_){const E=_[0].intersectionRatio;if(E!==c){if(!x)return s();E?s(!1,E):r=setTimeout(()=>{s(!1,1e-7)},1e3)}x=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return s(!0),o}function Qm(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,l=di(e),d=i||o?[...l?qn(l):[],...qn(t)]:[];d.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),o&&C.addEventListener("resize",n)});const f=l&&a?Zm(l,n):null;let m=-1,p=null;s&&(p=new ResizeObserver(C=>{let[v]=C;v&&v.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var x;(x=p)==null||x.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let y,I=c?hn(e):null;c&&w();function w(){const C=hn(e);I&&(C.x!==I.x||C.y!==I.y||C.width!==I.width||C.height!==I.height)&&n(),I=C,y=requestAnimationFrame(w)}return n(),()=>{var C;d.forEach(v=>{i&&v.removeEventListener("scroll",n),o&&v.removeEventListener("resize",n)}),f==null||f(),(C=p)==null||C.disconnect(),p=null,c&&cancelAnimationFrame(y)}}const eh=jm,th=Fm,nh=Pm,rh=Am,us=(e,t,n)=>{const r=new Map,i={platform:Ym,...n},o={...i.platform,_c:r};return Rm(e,t,{...i,platform:o})};/*
43
+ */var Yi;function Of(){return Yi||(Yi=1,process.env.NODE_ENV!=="production"&&function(){var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),y=!1,I=!1,w=!1,C=!1,v=!1,x;x=Symbol.for("react.module.reference");function b($){return!!(typeof $=="string"||typeof $=="function"||$===n||$===i||v||$===r||$===l||$===d||C||$===p||y||I||w||typeof $=="object"&&$!==null&&($.$$typeof===m||$.$$typeof===f||$.$$typeof===o||$.$$typeof===s||$.$$typeof===c||$.$$typeof===x||$.getModuleId!==void 0))}function _($){if(typeof $=="object"&&$!==null){var Ie=$.$$typeof;switch(Ie){case e:var De=$.type;switch(De){case n:case i:case r:case l:case d:return De;default:var Ue=De&&De.$$typeof;switch(Ue){case a:case s:case c:case m:case f:case o:return Ue;default:return Ie}}case t:return Ie}}}var E=s,L=o,T=e,J=c,q=n,z=m,Y=f,ee=t,U=i,se=r,ne=l,Q=d,de=!1,fe=!1;function S($){return de||(de=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function P($){return fe||(fe=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function k($){return _($)===s}function j($){return _($)===o}function D($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function R($){return _($)===c}function X($){return _($)===n}function G($){return _($)===m}function K($){return _($)===f}function Z($){return _($)===t}function B($){return _($)===i}function ae($){return _($)===r}function A($){return _($)===l}function pe($){return _($)===d}ye.ContextConsumer=E,ye.ContextProvider=L,ye.Element=T,ye.ForwardRef=J,ye.Fragment=q,ye.Lazy=z,ye.Memo=Y,ye.Portal=ee,ye.Profiler=U,ye.StrictMode=se,ye.Suspense=ne,ye.SuspenseList=Q,ye.isAsyncMode=S,ye.isConcurrentMode=P,ye.isContextConsumer=k,ye.isContextProvider=j,ye.isElement=D,ye.isForwardRef=R,ye.isFragment=X,ye.isLazy=G,ye.isMemo=K,ye.isPortal=Z,ye.isProfiler=B,ye.isStrictMode=ae,ye.isSuspense=A,ye.isSuspenseList=pe,ye.isValidElementType=b,ye.typeOf=_}()),ye}process.env.NODE_ENV==="production"?_o.exports=Cf():_o.exports=Of();var Zi=_o.exports;const Qi=e=>typeof e=="object"&&e!=null&&e.nodeType===1,es=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",uo=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return es(n.overflowY,t)||es(n.overflowX,t)||(r=>{const i=(o=>{if(!o.ownerDocument||!o.ownerDocument.defaultView)return null;try{return o.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!i&&(i.clientHeight<r.scrollHeight||i.clientWidth<r.scrollWidth)})(e)}return!1},hr=(e,t,n,r,i,o,s,a)=>o<e&&s>t||o>e&&s<t?0:o<=e&&a<=n||s>=t&&a>=n?o-e-r:s>t&&a<n||o<e&&a>n?s-t+i:0,Ef=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Sf=(e,t)=>{var n,r,i,o;if(typeof document>"u")return[];const{scrollMode:s,block:a,inline:c,boundary:l,skipOverflowHiddenElements:d}=t,f=typeof l=="function"?l:ne=>ne!==l;if(!Qi(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,p=[];let y=e;for(;Qi(y)&&f(y);){if(y=Ef(y),y===m){p.push(y);break}y!=null&&y===document.body&&uo(y)&&!uo(document.documentElement)||y!=null&&uo(y,d)&&p.push(y)}const I=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,w=(o=(i=window.visualViewport)==null?void 0:i.height)!=null?o:innerHeight,{scrollX:C,scrollY:v}=window,{height:x,width:b,top:_,right:E,bottom:L,left:T}=e.getBoundingClientRect(),{top:J,right:q,bottom:z,left:Y}=(ne=>{const Q=window.getComputedStyle(ne);return{top:parseFloat(Q.scrollMarginTop)||0,right:parseFloat(Q.scrollMarginRight)||0,bottom:parseFloat(Q.scrollMarginBottom)||0,left:parseFloat(Q.scrollMarginLeft)||0}})(e);let ee=a==="start"||a==="nearest"?_-J:a==="end"?L+z:_+x/2-J+z,U=c==="center"?T+b/2-Y+q:c==="end"?E+q:T-Y;const se=[];for(let ne=0;ne<p.length;ne++){const Q=p[ne],{height:de,width:fe,top:S,right:P,bottom:k,left:j}=Q.getBoundingClientRect();if(s==="if-needed"&&_>=0&&T>=0&&L<=w&&E<=I&&_>=S&&L<=k&&T>=j&&E<=P)return se;const D=getComputedStyle(Q),R=parseInt(D.borderLeftWidth,10),X=parseInt(D.borderTopWidth,10),G=parseInt(D.borderRightWidth,10),K=parseInt(D.borderBottomWidth,10);let Z=0,B=0;const ae="offsetWidth"in Q?Q.offsetWidth-Q.clientWidth-R-G:0,A="offsetHeight"in Q?Q.offsetHeight-Q.clientHeight-X-K:0,pe="offsetWidth"in Q?Q.offsetWidth===0?0:fe/Q.offsetWidth:0,$="offsetHeight"in Q?Q.offsetHeight===0?0:de/Q.offsetHeight:0;if(m===Q)Z=a==="start"?ee:a==="end"?ee-w:a==="nearest"?hr(v,v+w,w,X,K,v+ee,v+ee+x,x):ee-w/2,B=c==="start"?U:c==="center"?U-I/2:c==="end"?U-I:hr(C,C+I,I,R,G,C+U,C+U+b,b),Z=Math.max(0,Z+v),B=Math.max(0,B+C);else{Z=a==="start"?ee-S-X:a==="end"?ee-k+K+A:a==="nearest"?hr(S,k,de,X,K+A,ee,ee+x,x):ee-(S+de/2)+A/2,B=c==="start"?U-j-R:c==="center"?U-(j+fe/2)+ae/2:c==="end"?U-P+G+ae:hr(j,P,fe,R,G+ae,U,U+b,b);const{scrollLeft:Ie,scrollTop:De}=Q;Z=$===0?0:Math.max(0,Math.min(De+Z/$,Q.scrollHeight-de/$+A)),B=pe===0?0:Math.max(0,Math.min(Ie+B/pe,Q.scrollWidth-fe/pe+ae)),ee+=De-Z,U+=Ie-B}se.push({el:Q,top:Z,left:B})}return se};var Cn=function(){return Cn=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Cn.apply(this,arguments)};var Nf=0;function ts(e){return typeof e=="function"?e:it}function it(){}function ha(e,t){if(e){var n=Sf(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach(function(r){var i=r.el,o=r.top,s=r.left;i.scrollTop=o,i.scrollLeft=s})}}function ns(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function qo(e,t){var n;function r(){n&&clearTimeout(n)}function i(){for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];r(),n=setTimeout(function(){n=null,e.apply(void 0,s)},t)}return i.cancel=r,i}function Le(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];return t.some(function(a){return a&&a.apply(void 0,[r].concat(o)),r.preventDownshiftDefault||r.hasOwnProperty("nativeEvent")&&r.nativeEvent.preventDownshiftDefault})}}function bn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){t.forEach(function(i){typeof i=="function"?i(r):i&&(i.current=r)})}}function ga(){return String(Nf++)}function Tf(e){var t=e.isOpen,n=e.resultCount,r=e.previousResultCount;return t?n?n!==r?n+" result"+(n===1?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter key to select.":"":"No results are available.":""}function rs(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function va(e){return typeof e.type=="string"}function ya(e){return e.props}function Rf(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var Af=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function gr(e){e===void 0&&(e={});var t={};return Af.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function Er(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=Sr(t,r)?t[r]:e[r],n},{})}function Sr(e,t){return e[t]!==void 0}function bo(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function Pf(e){return Object.prototype.toString.call(e)==="[object Object]"}function un(e,t,n,r,i){var o=n.length;if(o===0)return-1;var s=o-1;(typeof e!="number"||e<0||e>s)&&(e=t>0?-1:s+1);var a=e+t;a<0?a=s:a>s&&(a=0);var c=On(a,t<0,n,r,i);return c===-1?e>=o?-1:e:c}function On(e,t,n,r,i){i===void 0&&(i=!1);var o=n.length;if(t){for(var s=e;s>=0;s--)if(!r(n[s],s))return s}else for(var a=e;a<o;a++)if(!r(n[a],a))return a;return i?On(t?o-1:0,t,n,r):-1}function Nr(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(i){return i&&(ns(i,e,n)||r&&ns(i,n.document.activeElement,n))})}var Wo=it;process.env.NODE_ENV!=="production"&&(Wo=function(t,n,r){var i="This prop should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled Downshift element for the lifetime of the component. More info: https://github.com/downshift-js/downshift#control-props";Object.keys(t).forEach(function(o){n[o]!==void 0&&r[o]===void 0?console.error('downshift: A component has changed the controlled prop "'+o+'" to be uncontrolled. '+i):n[o]===void 0&&r[o]!==void 0&&console.error('downshift: A component has changed the uncontrolled prop "'+o+'" to be controlled. '+i)})});var Df=qo(function(e){Ia(e).textContent=""},500);function Ia(e){var t=e.getElementById("a11y-status-message");return t||(t=e.createElement("div"),t.setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}function wa(e,t){if(!(!e||!t)){var n=Ia(t);n.textContent=e,Df(t)}}function jf(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var _a=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,ba=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,xa=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,_r=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,br=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,Ca=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Oa=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Ea=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Sa=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Na=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Ta=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,Ra=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Aa=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,xo=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,Pa=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Da=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,ja=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,Ff=Object.freeze({__proto__:null,blurButton:Pa,blurInput:Ta,changeInput:Ra,clickButton:xo,clickItem:Na,controlledPropUpdatedSelectedItem:Da,itemMouseEnter:xa,keyDownArrowDown:br,keyDownArrowUp:_r,keyDownEnd:Sa,keyDownEnter:Oa,keyDownEscape:Ca,keyDownHome:Ea,keyDownSpaceButton:Aa,mouseUp:ba,touchEnd:ja,unknown:_a}),kf=["refKey","ref"],Mf=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Lf=["onKeyDown","onBlur","onChange","onInput","onChangeText"],Kf=["refKey","ref"],$f=["onMouseMove","onMouseDown","onClick","onPress","index","item"],Vf=function(){var e=function(t){function n(i){var o;o=t.call(this,i)||this,o.id=o.props.id||"downshift-"+ga(),o.menuId=o.props.menuId||o.id+"-menu",o.labelId=o.props.labelId||o.id+"-label",o.inputId=o.props.inputId||o.id+"-input",o.getItemId=o.props.getItemId||function(v){return o.id+"-item-"+v},o.items=[],o.itemCount=null,o.previousResultCount=0,o.timeoutIds=[],o.internalSetTimeout=function(v,x){var b=setTimeout(function(){o.timeoutIds=o.timeoutIds.filter(function(_){return _!==b}),v()},x);o.timeoutIds.push(b)},o.setItemCount=function(v){o.itemCount=v},o.unsetItemCount=function(){o.itemCount=null},o.isItemDisabled=function(v,x){var b=o.getItemNodeFromIndex(x);return b&&b.hasAttribute("disabled")},o.setHighlightedIndex=function(v,x){v===void 0&&(v=o.props.defaultHighlightedIndex),x===void 0&&(x={}),x=gr(x),o.internalSetState(le({highlightedIndex:v},x))},o.clearSelection=function(v){o.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:o.props.defaultHighlightedIndex,isOpen:o.props.defaultIsOpen},v)},o.selectItem=function(v,x,b){x=gr(x),o.internalSetState(le({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,selectedItem:v,inputValue:o.props.itemToString(v)},x),b)},o.selectItemAtIndex=function(v,x,b){var _=o.items[v];_!=null&&o.selectItem(_,x,b)},o.selectHighlightedItem=function(v,x){return o.selectItemAtIndex(o.getState().highlightedIndex,v,x)},o.internalSetState=function(v,x){var b,_,E={},L=typeof v=="function";return!L&&v.hasOwnProperty("inputValue")&&o.props.onInputValueChange(v.inputValue,le({},o.getStateAndHelpers(),v)),o.setState(function(T){var J;T=o.getState(T);var q=L?v(T):v;q=o.props.stateReducer(T,q),b=q.hasOwnProperty("selectedItem");var z={};return b&&q.selectedItem!==T.selectedItem&&(_=q.selectedItem),(J=q).type||(J.type=_a),Object.keys(q).forEach(function(Y){T[Y]!==q[Y]&&(E[Y]=q[Y]),Y!=="type"&&(q[Y],Sr(o.props,Y)||(z[Y]=q[Y]))}),L&&q.hasOwnProperty("inputValue")&&o.props.onInputValueChange(q.inputValue,le({},o.getStateAndHelpers(),q)),z},function(){ts(x)();var T=Object.keys(E).length>1;T&&o.props.onStateChange(E,o.getStateAndHelpers()),b&&o.props.onSelect(v.selectedItem,o.getStateAndHelpers()),_!==void 0&&o.props.onChange(_,o.getStateAndHelpers()),o.props.onUserAction(E,o.getStateAndHelpers())})},o.rootRef=function(v){return o._rootNode=v},o.getRootProps=function(v,x){var b,_=v===void 0?{}:v,E=_.refKey,L=E===void 0?"ref":E,T=_.ref,J=kt(_,kf),q=x===void 0?{}:x,z=q.suppressRefError,Y=z===void 0?!1:z;o.getRootProps.called=!0,o.getRootProps.refKey=L,o.getRootProps.suppressRefError=Y;var ee=o.getState(),U=ee.isOpen;return le((b={},b[L]=bn(T,o.rootRef),b.role="combobox",b["aria-expanded"]=U,b["aria-haspopup"]="listbox",b["aria-owns"]=U?o.menuId:void 0,b["aria-labelledby"]=o.labelId,b),J)},o.keyDownHandlers={ArrowDown:function(x){var b=this;if(x.preventDefault(),this.getState().isOpen){var _=x.shiftKey?5:1;this.moveHighlightedIndex(_,{type:br})}else this.internalSetState({isOpen:!0,type:br},function(){var E=b.getItemCount();if(E>0){var L=b.getState(),T=L.highlightedIndex,J=un(T,1,{length:E},b.isItemDisabled,!0);b.setHighlightedIndex(J,{type:br})}})},ArrowUp:function(x){var b=this;if(x.preventDefault(),this.getState().isOpen){var _=x.shiftKey?-5:-1;this.moveHighlightedIndex(_,{type:_r})}else this.internalSetState({isOpen:!0,type:_r},function(){var E=b.getItemCount();if(E>0){var L=b.getState(),T=L.highlightedIndex,J=un(T,-1,{length:E},b.isItemDisabled,!0);b.setHighlightedIndex(J,{type:_r})}})},Enter:function(x){if(x.which!==229){var b=this.getState(),_=b.isOpen,E=b.highlightedIndex;if(_&&E!=null){x.preventDefault();var L=this.items[E],T=this.getItemNodeFromIndex(E);if(L==null||T&&T.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Oa})}}},Escape:function(x){x.preventDefault(),this.reset(le({type:Ca},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},o.buttonKeyDownHandlers=le({},o.keyDownHandlers,{" ":function(x){x.preventDefault(),this.toggleMenu({type:Aa})}}),o.inputKeyDownHandlers=le({},o.keyDownHandlers,{Home:function(x){var b=this.getState(),_=b.isOpen;if(_){x.preventDefault();var E=this.getItemCount();if(!(E<=0||!_)){var L=On(0,!1,{length:E},this.isItemDisabled);this.setHighlightedIndex(L,{type:Ea})}}},End:function(x){var b=this.getState(),_=b.isOpen;if(_){x.preventDefault();var E=this.getItemCount();if(!(E<=0||!_)){var L=On(E-1,!0,{length:E},this.isItemDisabled);this.setHighlightedIndex(L,{type:Sa})}}}}),o.getToggleButtonProps=function(v){var x=v===void 0?{}:v,b=x.onClick;x.onPress;var _=x.onKeyDown,E=x.onKeyUp,L=x.onBlur,T=kt(x,Mf),J=o.getState(),q=J.isOpen,z={onClick:Le(b,o.buttonHandleClick),onKeyDown:Le(_,o.buttonHandleKeyDown),onKeyUp:Le(E,o.buttonHandleKeyUp),onBlur:Le(L,o.buttonHandleBlur)},Y=T.disabled?{}:z;return le({type:"button",role:"button","aria-label":q?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},Y,T)},o.buttonHandleKeyUp=function(v){v.preventDefault()},o.buttonHandleKeyDown=function(v){var x=bo(v);o.buttonKeyDownHandlers[x]&&o.buttonKeyDownHandlers[x].call(o,v)},o.buttonHandleClick=function(v){if(v.preventDefault(),o.props.environment){var x=o.props.environment.document,b=x.body,_=x.activeElement;b&&b===_&&v.target.focus()}process.env.NODE_ENV==="test"?o.toggleMenu({type:xo}):o.internalSetTimeout(function(){return o.toggleMenu({type:xo})})},o.buttonHandleBlur=function(v){var x=v.target;o.internalSetTimeout(function(){if(!(o.isMouseDown||!o.props.environment)){var b=o.props.environment.document.activeElement;(b==null||b.id!==o.inputId)&&b!==x&&o.reset({type:Pa})}})},o.getLabelProps=function(v){return le({htmlFor:o.inputId,id:o.labelId},v)},o.getInputProps=function(v){var x=v===void 0?{}:v,b=x.onKeyDown,_=x.onBlur,E=x.onChange,L=x.onInput;x.onChangeText;var T=kt(x,Lf),J,q={};J="onChange";var z=o.getState(),Y=z.inputValue,ee=z.isOpen,U=z.highlightedIndex;if(!T.disabled){var se;q=(se={},se[J]=Le(E,L,o.inputHandleChange),se.onKeyDown=Le(b,o.inputHandleKeyDown),se.onBlur=Le(_,o.inputHandleBlur),se)}return le({"aria-autocomplete":"list","aria-activedescendant":ee&&typeof U=="number"&&U>=0?o.getItemId(U):void 0,"aria-controls":ee?o.menuId:void 0,"aria-labelledby":T&&T["aria-label"]?void 0:o.labelId,autoComplete:"off",value:Y,id:o.inputId},q,T)},o.inputHandleKeyDown=function(v){var x=bo(v);x&&o.inputKeyDownHandlers[x]&&o.inputKeyDownHandlers[x].call(o,v)},o.inputHandleChange=function(v){o.internalSetState({type:Ra,isOpen:!0,inputValue:v.target.value,highlightedIndex:o.props.defaultHighlightedIndex})},o.inputHandleBlur=function(){o.internalSetTimeout(function(){var v;if(!(o.isMouseDown||!o.props.environment)){var x=o.props.environment.document.activeElement,b=(x==null||(v=x.dataset)==null?void 0:v.toggle)&&o._rootNode&&o._rootNode.contains(x);b||o.reset({type:Ta})}})},o.menuRef=function(v){o._menuNode=v},o.getMenuProps=function(v,x){var b,_=v===void 0?{}:v,E=_.refKey,L=E===void 0?"ref":E,T=_.ref,J=kt(_,Kf),q=x===void 0?{}:x,z=q.suppressRefError,Y=z===void 0?!1:z;return o.getMenuProps.called=!0,o.getMenuProps.refKey=L,o.getMenuProps.suppressRefError=Y,le((b={},b[L]=bn(T,o.menuRef),b.role="listbox",b["aria-labelledby"]=J&&J["aria-label"]?void 0:o.labelId,b.id=o.menuId,b),J)},o.getItemProps=function(v){var x,b=v===void 0?{}:v,_=b.onMouseMove,E=b.onMouseDown,L=b.onClick;b.onPress;var T=b.index,J=b.item,q=J===void 0?process.env.NODE_ENV==="production"?void 0:Rf("getItemProps","item"):J,z=kt(b,$f);T===void 0?(o.items.push(q),T=o.items.indexOf(q)):o.items[T]=q;var Y="onClick",ee=L,U=(x={onMouseMove:Le(_,function(){T!==o.getState().highlightedIndex&&(o.setHighlightedIndex(T,{type:xa}),o.avoidScrolling=!0,o.internalSetTimeout(function(){return o.avoidScrolling=!1},250))}),onMouseDown:Le(E,function(ne){ne.preventDefault()})},x[Y]=Le(ee,function(){o.selectItemAtIndex(T,{type:Na})}),x),se=z.disabled?{onMouseDown:U.onMouseDown}:U;return le({id:o.getItemId(T),role:"option","aria-selected":o.getState().highlightedIndex===T},se,z)},o.clearItems=function(){o.items=[]},o.reset=function(v,x){v===void 0&&(v={}),v=gr(v),o.internalSetState(function(b){var _=b.selectedItem;return le({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,inputValue:o.props.itemToString(_)},v)},x)},o.toggleMenu=function(v,x){v===void 0&&(v={}),v=gr(v),o.internalSetState(function(b){var _=b.isOpen;return le({isOpen:!_},_&&{highlightedIndex:o.props.defaultHighlightedIndex},v)},function(){var b=o.getState(),_=b.isOpen,E=b.highlightedIndex;_&&o.getItemCount()>0&&typeof E=="number"&&o.setHighlightedIndex(E,v),ts(x)()})},o.openMenu=function(v){o.internalSetState({isOpen:!0},v)},o.closeMenu=function(v){o.internalSetState({isOpen:!1},v)},o.updateStatus=qo(function(){var v;if((v=o.props)!=null&&(v=v.environment)!=null&&v.document){var x=o.getState(),b=o.items[x.highlightedIndex],_=o.getItemCount(),E=o.props.getA11yStatusMessage(le({itemToString:o.props.itemToString,previousResultCount:o.previousResultCount,resultCount:_,highlightedItem:b},x));o.previousResultCount=_,wa(E,o.props.environment.document)}},200);var s=o.props,a=s.defaultHighlightedIndex,c=s.initialHighlightedIndex,l=c===void 0?a:c,d=s.defaultIsOpen,f=s.initialIsOpen,m=f===void 0?d:f,p=s.initialInputValue,y=p===void 0?"":p,I=s.initialSelectedItem,w=I===void 0?null:I,C=o.getState({highlightedIndex:l,isOpen:m,inputValue:y,selectedItem:w});return C.selectedItem!=null&&o.props.initialInputValue===void 0&&(C.inputValue=o.props.itemToString(C.selectedItem)),o.state=C,o}mf(n,t);var r=n.prototype;return r.internalClearTimeouts=function(){this.timeoutIds.forEach(function(o){clearTimeout(o)}),this.timeoutIds=[]},r.getState=function(o){return o===void 0&&(o=this.state),Er(o,this.props)},r.getItemCount=function(){var o=this.items.length;return this.itemCount!=null?o=this.itemCount:this.props.itemCount!==void 0&&(o=this.props.itemCount),o},r.getItemNodeFromIndex=function(o){return this.props.environment?this.props.environment.document.getElementById(this.getItemId(o)):null},r.scrollHighlightedItemIntoView=function(){{var o=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(o,this._menuNode)}},r.moveHighlightedIndex=function(o,s){var a=this.getItemCount(),c=this.getState(),l=c.highlightedIndex;if(a>0){var d=un(l,o,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(d,s)}},r.getStateAndHelpers=function(){var o=this.getState(),s=o.highlightedIndex,a=o.inputValue,c=o.selectedItem,l=o.isOpen,d=this.props.itemToString,f=this.id,m=this.getRootProps,p=this.getToggleButtonProps,y=this.getLabelProps,I=this.getMenuProps,w=this.getInputProps,C=this.getItemProps,v=this.openMenu,x=this.closeMenu,b=this.toggleMenu,_=this.selectItem,E=this.selectItemAtIndex,L=this.selectHighlightedItem,T=this.setHighlightedIndex,J=this.clearSelection,q=this.clearItems,z=this.reset,Y=this.setItemCount,ee=this.unsetItemCount,U=this.internalSetState;return{getRootProps:m,getToggleButtonProps:p,getLabelProps:y,getMenuProps:I,getInputProps:w,getItemProps:C,reset:z,openMenu:v,closeMenu:x,toggleMenu:b,selectItem:_,selectItemAtIndex:E,selectHighlightedItem:L,setHighlightedIndex:T,clearSelection:J,clearItems:q,setItemCount:Y,unsetItemCount:ee,setState:U,itemToString:d,id:f,highlightedIndex:s,inputValue:a,isOpen:l,selectedItem:c}},r.componentDidMount=function(){var o=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&os(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){o.internalClearTimeouts()};else{var s=function(){o.isMouseDown=!0},a=function(p){o.isMouseDown=!1;var y=Nr(p.target,[o._rootNode,o._menuNode],o.props.environment);!y&&o.getState().isOpen&&o.reset({type:ba},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},c=function(){o.isTouchMove=!1},l=function(){o.isTouchMove=!0},d=function(p){var y=Nr(p.target,[o._rootNode,o._menuNode],o.props.environment,!1);!o.isTouchMove&&!y&&o.getState().isOpen&&o.reset({type:ja},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},f=this.props.environment;f.addEventListener("mousedown",s),f.addEventListener("mouseup",a),f.addEventListener("touchstart",c),f.addEventListener("touchmove",l),f.addEventListener("touchend",d),this.cleanup=function(){o.internalClearTimeouts(),o.updateStatus.cancel(),f.removeEventListener("mousedown",s),f.removeEventListener("mouseup",a),f.removeEventListener("touchstart",c),f.removeEventListener("touchmove",l),f.removeEventListener("touchend",d)}}},r.shouldScroll=function(o,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,c=a.highlightedIndex,l=s.highlightedIndex===void 0?o:s,d=l.highlightedIndex,f=c&&this.getState().isOpen&&!o.isOpen,m=c!==d;return f||m},r.componentDidUpdate=function(o,s){process.env.NODE_ENV!=="production"&&(Wo(this.state,o,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&os(this._menuNode,this.getMenuProps)),Sr(this.props,"selectedItem")&&this.props.selectedItemChanged(o.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Da,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(s,o)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},r.componentWillUnmount=function(){this.cleanup()},r.render=function(){var o=rs(this.props.children,it);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var s=rs(o(this.getStateAndHelpers()));if(!s)return null;if(this.getRootProps.called||this.props.suppressRefError)return process.env.NODE_ENV!=="production"&&!this.getRootProps.suppressRefError&&!this.props.suppressRefError&&Hf(s,this.getRootProps),s;if(va(s))return g.cloneElement(s,this.getRootProps(ya(s)));if(process.env.NODE_ENV!=="production")throw new Error("downshift: If you return a non-DOM element, you must apply the getRootProps function")},n}(g.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:Tf,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&Pf(n)&&!n.hasOwnProperty("toString")&&console.warn("downshift: An object was passed to the default implementation of `itemToString`. You should probably provide your own `itemToString` implementation. Please refer to the `itemToString` API documentation.","The object that was passed:",n),String(n))},onStateChange:it,onInputValueChange:it,onUserAction:it,onChange:it,onSelect:it,onOuterClick:it,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:ha},e.stateChangeTypes=Ff,e}();process.env.NODE_ENV!=="production"&&(Vf.propTypes={children:F.func,defaultHighlightedIndex:F.number,defaultIsOpen:F.bool,initialHighlightedIndex:F.number,initialSelectedItem:F.any,initialInputValue:F.string,initialIsOpen:F.bool,getA11yStatusMessage:F.func,itemToString:F.func,onChange:F.func,onSelect:F.func,onStateChange:F.func,onInputValueChange:F.func,onUserAction:F.func,onOuterClick:F.func,selectedItemChanged:F.func,stateReducer:F.func,itemCount:F.number,id:F.string,environment:F.shape({addEventListener:F.func.isRequired,removeEventListener:F.func.isRequired,document:F.shape({createElement:F.func.isRequired,getElementById:F.func.isRequired,activeElement:F.any.isRequired,body:F.any.isRequired}).isRequired,Node:F.func.isRequired}),suppressRefError:F.bool,scrollIntoView:F.func,selectedItem:F.any,isOpen:F.bool,inputValue:F.string,highlightedIndex:F.number,labelId:F.string,inputId:F.string,menuId:F.string,getItemId:F.func});function os(e,t){var n=t.refKey;e||console.error('downshift: The ref prop "'+n+'" from getMenuProps was not applied correctly on your menu element.')}function Hf(e,t){var n=t.refKey,r=n!=="ref",i=!va(e);i&&!r&&!Zi.isForwardRef(e)?console.error("downshift: You returned a non-DOM element. You must specify a refKey in getRootProps"):!i&&r&&console.error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "'+n+'"'),!Zi.isForwardRef(e)&&!ya(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Fa={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function Uf(e,t,n){var r=e.props,i=e.type,o={};Object.keys(t).forEach(function(s){Bf(s,e,t,n),n[s]!==t[s]&&(o[s]=n[s])}),r.onStateChange&&Object.keys(o).length&&r.onStateChange(le({type:i},o))}function Bf(e,t,n,r){var i=t.props,o=t.type,s="on"+Jo(e)+"Change";i[s]&&r[e]!==void 0&&r[e]!==n[e]&&i[s](le({type:o},r))}function qf(e,t){return t.changes}var is=qo(function(e,t){wa(e,t)},200),Wf=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?g.useLayoutEffect:g.useEffect,Jf="useId"in g?function(t){var n=t.id,r=t.labelId,i=t.menuId,o=t.getItemId,s=t.toggleButtonId,a=t.inputId,c="downshift-"+g.useId();n||(n=c);var l=g.useRef({labelId:r||n+"-label",menuId:i||n+"-menu",getItemId:o||function(d){return n+"-item-"+d},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"});return l.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+ga():n,i=t.labelId,o=t.menuId,s=t.getItemId,a=t.toggleButtonId,c=t.inputId,l=g.useRef({labelId:i||r+"-label",menuId:o||r+"-menu",getItemId:s||function(d){return r+"-item-"+d},toggleButtonId:a||r+"-toggle-button",inputId:c||r+"-input"});return l.current};function zf(e,t,n,r){var i,o;if(e===void 0){if(t===void 0)throw new Error(r);i=n[t],o=t}else o=t===void 0?n.indexOf(e):t,i=e;return[i,o]}function Jo(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function ka(e){var t=g.useRef(e);return t.current=e,t}function Xf(e,t,n,r){var i=g.useRef(),o=g.useRef(),s=g.useCallback(function(p,y){o.current=y,p=Er(p,y.props);var I=e(p,y),w=y.props.stateReducer(p,le({},y,{changes:I}));return w},[e]),a=g.useReducer(s,t,n),c=a[0],l=a[1],d=ka(t),f=g.useCallback(function(p){return l(le({props:d.current},p))},[d]),m=o.current;return g.useEffect(function(){var p=Er(i.current,m==null?void 0:m.props),y=m&&i.current&&!r(p,c);y&&Uf(m,p,c),i.current=c},[c,m,r]),[c,f]}var $n={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:qf,scrollIntoView:ha,environment:typeof window>"u"?void 0:window};function Wt(e,t,n){n===void 0&&(n=Fa);var r=e["default"+Jo(t)];return r!==void 0?r:n[t]}function Vn(e,t,n){n===void 0&&(n=Fa);var r=e[t];if(r!==void 0)return r;var i=e["initial"+Jo(t)];return i!==void 0?i:Wt(e,t,n)}function Gf(e){var t=Vn(e,"selectedItem"),n=Vn(e,"isOpen"),r=tm(e),i=Vn(e,"inputValue");return{highlightedIndex:r<0&&t&&n?e.items.findIndex(function(o){return e.itemToKey(o)===e.itemToKey(t)}):r,isOpen:n,selectedItem:t,inputValue:i}}function Hn(e,t,n){var r=e.items,i=e.initialHighlightedIndex,o=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,c=t.selectedItem,l=t.highlightedIndex;return r.length===0?-1:i!==void 0&&l===i&&!s(r[i],i)?i:o!==void 0&&!s(r[o],o)?o:c?r.findIndex(function(d){return a(c)===a(d)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function Yf(e,t,n){var r=g.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return g.useEffect(function(){if(!e)return it;var i=n.map(function(d){return d.current});function o(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(d){r.current.isMouseDown=!1,Nr(d.target,i,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function c(){r.current.isTouchMove=!0}function l(d){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!Nr(d.target,i,e,!1)&&t()}return e.addEventListener("mousedown",o),e.addEventListener("mouseup",s),e.addEventListener("touchstart",a),e.addEventListener("touchmove",c),e.addEventListener("touchend",l),function(){e.removeEventListener("mousedown",o),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",c),e.removeEventListener("touchend",l)}},[n,e,t]),r.current}var Ma=function(){return it};process.env.NODE_ENV!=="production"&&(Ma=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=g.useRef(n.reduce(function(s,a){return s[a]={},s},{}));g.useEffect(function(){Object.keys(i.current).forEach(function(s){var a=i.current[s];if(!Object.keys(a).length){console.error("downshift: You forgot to call the "+s+" getter function on your component / element.");return}var c=a.suppressRefError,l=a.refKey,d=a.elementRef;c||d!=null&&d.current||console.error('downshift: The ref prop "'+l+'" from '+s+" was not applied correctly on your element.")})},[]);var o=g.useCallback(function(s,a,c,l){i.current[s]={suppressRefError:a,refKey:c,elementRef:l}},[]);return o});function Zf(e,t,n,r){r===void 0&&(r={});var i=r.document,o=Vr();g.useEffect(function(){if(!(!e||o||!i)){var s=e(t);is(s,i)}},n),g.useEffect(function(){return function(){is.cancel(),jf(i)}},[i])}function Qf(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,i=e.getItemNodeFromIndex,o=e.menuElement,s=e.scrollIntoView,a=g.useRef(!0);return Wf(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(i(t),o))},[t]),a}var La=it;process.env.NODE_ENV!=="production"&&(La=function(t){var n=t.props,r=t.state,i=g.useRef(n),o=Vr();g.useEffect(function(){o||(Wo(r,i.current,n),i.current=n)},[r,n,o])});function ss(e,t,n){var r;n===void 0&&(n=!0);var i=((r=e.items)==null?void 0:r.length)&&t>=0;return le({isOpen:!1,highlightedIndex:-1},i&&le({selectedItem:e.items[t],isOpen:Wt(e,"isOpen"),highlightedIndex:Wt(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function em(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function Vr(){var e=g.useRef(!0);return g.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function Co(e){var t=Wt(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function tm(e){var t=Vn(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var xr={environment:F.shape({addEventListener:F.func.isRequired,removeEventListener:F.func.isRequired,document:F.shape({createElement:F.func.isRequired,getElementById:F.func.isRequired,activeElement:F.any.isRequired,body:F.any.isRequired}).isRequired,Node:F.func.isRequired}),itemToString:F.func,itemToKey:F.func,stateReducer:F.func},Ka=le({},xr,{getA11yStatusMessage:F.func,highlightedIndex:F.number,defaultHighlightedIndex:F.number,initialHighlightedIndex:F.number,isOpen:F.bool,defaultIsOpen:F.bool,initialIsOpen:F.bool,selectedItem:F.any,initialSelectedItem:F.any,defaultSelectedItem:F.any,id:F.string,labelId:F.string,menuId:F.string,getItemId:F.func,toggleButtonId:F.string,onSelectedItemChange:F.func,onHighlightedIndexChange:F.func,onStateChange:F.func,onIsOpenChange:F.func,scrollIntoView:F.func});function nm(e,t,n){var r=t.type,i=t.props,o;switch(r){case n.ItemMouseMove:o={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:o={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:o={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Hn(i,e,0)};break;case n.FunctionOpenMenu:o={isOpen:!0,highlightedIndex:Hn(i,e,0)};break;case n.FunctionCloseMenu:o={isOpen:!1};break;case n.FunctionSetHighlightedIndex:o={highlightedIndex:i.isItemDisabled(i.items[t.highlightedIndex],t.highlightedIndex)?-1:t.highlightedIndex};break;case n.FunctionSetInputValue:o={inputValue:t.inputValue};break;case n.FunctionReset:o={highlightedIndex:Co(i),isOpen:Wt(i,"isOpen"),selectedItem:Wt(i,"selectedItem"),inputValue:Wt(i,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return le({},e,o)}Cn(Cn({},Ka),{items:F.array.isRequired,isItemDisabled:F.func});Cn(Cn({},$n),{isItemDisabled:function(){return!1}});process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;var zo=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Xo=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Go=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Yo=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,Zo=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Qo=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,ei=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,ti=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,ni=process.env.NODE_ENV!=="production"?"__input_change__":8,Tr=process.env.NODE_ENV!=="production"?"__input_blur__":9,ri=process.env.NODE_ENV!=="production"?"__input_click__":10,$a=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,Va=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,oi=process.env.NODE_ENV!=="production"?"__item_click__":13,Ha=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,Ua=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,Ba=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,qa=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,Wa=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,ii=process.env.NODE_ENV!=="production"?"__function_select_item__":19,Ja=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,za=process.env.NODE_ENV!=="production"?"__function_reset__":21,si=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,Xa=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:si,FunctionCloseMenu:qa,FunctionOpenMenu:Ba,FunctionReset:za,FunctionSelectItem:ii,FunctionSetHighlightedIndex:Wa,FunctionSetInputValue:Ja,FunctionToggleMenu:Ua,InputBlur:Tr,InputChange:ni,InputClick:ri,InputKeyDownArrowDown:zo,InputKeyDownArrowUp:Xo,InputKeyDownEnd:Zo,InputKeyDownEnter:ti,InputKeyDownEscape:Go,InputKeyDownHome:Yo,InputKeyDownPageDown:ei,InputKeyDownPageUp:Qo,ItemClick:oi,ItemMouseMove:Va,MenuMouseLeave:$a,ToggleButtonClick:Ha});function rm(e){var t=Gf(e),n=t.selectedItem,r=t.inputValue;return r===""&&n&&e.defaultInputValue===void 0&&e.initialInputValue===void 0&&e.inputValue===void 0&&(r=e.itemToString(n)),le({},t,{inputValue:r})}var om=le({},Ka,{items:F.array.isRequired,isItemDisabled:F.func,inputValue:F.string,defaultInputValue:F.string,initialInputValue:F.string,inputId:F.string,onInputValueChange:F.func});function im(e,t,n,r){var i=g.useRef(),o=Xf(e,t,n,r),s=o[0],a=o[1],c=Vr();return g.useEffect(function(){if(Sr(t,"selectedItem")){if(!c){var l=t.itemToKey(t.selectedItem)!==t.itemToKey(i.current);l&&a({type:si,inputValue:t.itemToString(t.selectedItem)})}i.current=s.selectedItem===i.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[Er(s,t),a]}var Ga=it;process.env.NODE_ENV!=="production"&&(Ga=function(t,n){F.checkPropTypes(om,t,"prop",n.name)});var sm=le({},$n,{isItemDisabled:function(){return!1}});function am(e,t){var n,r=t.type,i=t.props,o=t.altKey,s;switch(r){case oi:s={isOpen:Wt(i,"isOpen"),highlightedIndex:Co(i),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case zo:e.isOpen?s={highlightedIndex:un(e.highlightedIndex,1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:o&&e.selectedItem==null?-1:Hn(i,e,1),isOpen:i.items.length>=0};break;case Xo:e.isOpen?o?s=ss(i,e.highlightedIndex):s={highlightedIndex:un(e.highlightedIndex,-1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:Hn(i,e,-1),isOpen:i.items.length>=0};break;case ti:s=ss(i,e.highlightedIndex);break;case Go:s=le({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Qo:s={highlightedIndex:un(e.highlightedIndex,-10,i.items,i.isItemDisabled,!0)};break;case ei:s={highlightedIndex:un(e.highlightedIndex,10,i.items,i.isItemDisabled,!0)};break;case Yo:s={highlightedIndex:On(0,!1,i.items,i.isItemDisabled)};break;case Zo:s={highlightedIndex:On(i.items.length-1,!0,i.items,i.isItemDisabled)};break;case Tr:s=le({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&((n=i.items)==null?void 0:n.length)&&t.selectItem&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])});break;case ni:s={isOpen:!0,highlightedIndex:Co(i),inputValue:t.inputValue};break;case ri:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Hn(i,e,0)};break;case ii:s={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case si:s={inputValue:t.inputValue};break;default:return nm(e,t,Xa)}return le({},e,s)}var cm=["onMouseLeave","refKey","ref"],lm=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],um=["onClick","onPress","refKey","ref"],dm=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];ai.stateChangeTypes=Xa;function ai(e){e===void 0&&(e={}),Ga(e,ai);var t=le({},sm,e),n=t.items,r=t.scrollIntoView,i=t.environment,o=t.getA11yStatusMessage,s=im(am,t,rm,em),a=s[0],c=s[1],l=a.isOpen,d=a.highlightedIndex,f=a.selectedItem,m=a.inputValue,p=g.useRef(null),y=g.useRef({}),I=g.useRef(null),w=g.useRef(null),C=Vr(),v=Jf(t),x=g.useRef(),b=ka({state:a,props:t}),_=g.useCallback(function(k){return y.current[v.getItemId(k)]},[v]);Zf(o,a,[l,d,f,m],i);var E=Qf({menuElement:p.current,highlightedIndex:d,isOpen:l,itemRefs:y,scrollIntoView:r,getItemNodeFromIndex:_});La({props:t,state:a}),g.useEffect(function(){var k=Vn(t,"isOpen");k&&I.current&&I.current.focus()},[]),g.useEffect(function(){C||(x.current=n.length)});var L=Yf(i,g.useCallback(function(){b.current.state.isOpen&&c({type:Tr,selectItem:!1})},[c,b]),g.useMemo(function(){return[p,w,I]},[p.current,w.current,I.current])),T=Ma("getInputProps","getMenuProps");g.useEffect(function(){l||(y.current={})},[l]),g.useEffect(function(){var k;!l||!(i!=null&&i.document)||!(I!=null&&(k=I.current)!=null&&k.focus)||i.document.activeElement!==I.current&&I.current.focus()},[l,i]);var J=g.useMemo(function(){return{ArrowDown:function(j){j.preventDefault(),c({type:zo,altKey:j.altKey})},ArrowUp:function(j){j.preventDefault(),c({type:Xo,altKey:j.altKey})},Home:function(j){b.current.state.isOpen&&(j.preventDefault(),c({type:Yo}))},End:function(j){b.current.state.isOpen&&(j.preventDefault(),c({type:Zo}))},Escape:function(j){var D=b.current.state;(D.isOpen||D.inputValue||D.selectedItem||D.highlightedIndex>-1)&&(j.preventDefault(),c({type:Go}))},Enter:function(j){var D=b.current.state;!D.isOpen||j.which===229||(j.preventDefault(),c({type:ti}))},PageUp:function(j){b.current.state.isOpen&&(j.preventDefault(),c({type:Qo}))},PageDown:function(j){b.current.state.isOpen&&(j.preventDefault(),c({type:ei}))}}},[c,b]),q=g.useCallback(function(k){return le({id:v.labelId,htmlFor:v.inputId},k)},[v]),z=g.useCallback(function(k,j){var D,R=k===void 0?{}:k,X=R.onMouseLeave,G=R.refKey,K=G===void 0?"ref":G,Z=R.ref,B=kt(R,cm),ae=j===void 0?{}:j,A=ae.suppressRefError,pe=A===void 0?!1:A;return T("getMenuProps",pe,K,p),le((D={},D[K]=bn(Z,function($){p.current=$}),D.id=v.menuId,D.role="listbox",D["aria-labelledby"]=B&&B["aria-label"]?void 0:""+v.labelId,D.onMouseLeave=Le(X,function(){c({type:$a})}),D),B)},[c,T,v]),Y=g.useCallback(function(k){var j,D,R=k===void 0?{}:k,X=R.item,G=R.index,K=R.refKey,Z=K===void 0?"ref":K,B=R.ref,ae=R.onMouseMove,A=R.onMouseDown,pe=R.onClick;R.onPress;var $=R.disabled,Ie=kt(R,lm);$!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var De=b.current,Ue=De.props,je=De.state,me=zf(X,G,Ue.items,"Pass either item or index to getItemProps!"),gt=me[0],Be=me[1],nt=Ue.isItemDisabled(gt,Be),vt="onClick",yt=pe,qe=function(){L.isTouchEnd||Be===je.highlightedIndex||(E.current=!1,c({type:Va,index:Be,disabled:nt}))},Ke=function(){c({type:oi,index:Be})},Fe=function(It){return It.preventDefault()};return le((j={},j[Z]=bn(B,function(Ee){Ee&&(y.current[v.getItemId(Be)]=Ee)}),j["aria-disabled"]=nt,j["aria-selected"]=Be===je.highlightedIndex,j.id=v.getItemId(Be),j.role="option",j),!nt&&(D={},D[vt]=Le(yt,Ke),D),{onMouseMove:Le(ae,qe),onMouseDown:Le(A,Fe)},Ie)},[c,v,b,L,E]),ee=g.useCallback(function(k){var j,D=k===void 0?{}:k,R=D.onClick;D.onPress;var X=D.refKey,G=X===void 0?"ref":X,K=D.ref,Z=kt(D,um),B=b.current.state,ae=function(){c({type:Ha})};return le((j={},j[G]=bn(K,function(A){w.current=A}),j["aria-controls"]=v.menuId,j["aria-expanded"]=B.isOpen,j.id=v.toggleButtonId,j.tabIndex=-1,j),!Z.disabled&&le({},{onClick:Le(R,ae)}),Z)},[c,b,v]),U=g.useCallback(function(k,j){var D,R=k===void 0?{}:k,X=R.onKeyDown,G=R.onChange,K=R.onInput,Z=R.onBlur;R.onChangeText;var B=R.onClick,ae=R.refKey,A=ae===void 0?"ref":ae,pe=R.ref,$=kt(R,dm),Ie=j===void 0?{}:j,De=Ie.suppressRefError,Ue=De===void 0?!1:De;T("getInputProps",Ue,A,I);var je=b.current.state,me=function(Fe){var Ee=bo(Fe);Ee&&J[Ee]&&J[Ee](Fe)},gt=function(Fe){c({type:ni,inputValue:Fe.target.value})},Be=function(Fe){if(i!=null&&i.document&&je.isOpen&&!L.isMouseDown){var Ee=Fe.relatedTarget===null&&i.document.activeElement!==i.document.body;c({type:Tr,selectItem:!Ee})}},nt=function(){c({type:ri})},vt="onChange",yt={};if(!$.disabled){var qe;yt=(qe={},qe[vt]=Le(G,K,gt),qe.onKeyDown=Le(X,me),qe.onBlur=Le(Z,Be),qe.onClick=Le(B,nt),qe)}return le((D={},D[A]=bn(pe,function(Ke){I.current=Ke}),D["aria-activedescendant"]=je.isOpen&&je.highlightedIndex>-1?v.getItemId(je.highlightedIndex):"",D["aria-autocomplete"]="list",D["aria-controls"]=v.menuId,D["aria-expanded"]=je.isOpen,D["aria-labelledby"]=$&&$["aria-label"]?void 0:v.labelId,D.autoComplete="off",D.id=v.inputId,D.role="combobox",D.value=je.inputValue,D),yt,$)},[c,v,i,J,b,L,T]),se=g.useCallback(function(){c({type:Ua})},[c]),ne=g.useCallback(function(){c({type:qa})},[c]),Q=g.useCallback(function(){c({type:Ba})},[c]),de=g.useCallback(function(k){c({type:Wa,highlightedIndex:k})},[c]),fe=g.useCallback(function(k){c({type:ii,selectedItem:k})},[c]),S=g.useCallback(function(k){c({type:Ja,inputValue:k})},[c]),P=g.useCallback(function(){c({type:za})},[c]);return{getItemProps:Y,getLabelProps:q,getMenuProps:z,getInputProps:U,getToggleButtonProps:ee,toggleMenu:se,openMenu:Q,closeMenu:ne,setHighlightedIndex:de,setInputValue:S,selectItem:fe,reset:P,highlightedIndex:d,isOpen:l,selectedItem:f,inputValue:m}}xr.stateReducer,xr.itemToKey,xr.environment,F.array,F.array,F.array,F.func,F.number,F.number,F.number,F.func,F.func,F.string,F.string;$n.itemToKey,$n.stateReducer,$n.environment;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;const pm="_comboboxContainer_9s7ov_1",fm="_label_9s7ov_8",mm="_inputContainer_9s7ov_12",hm="_input_9s7ov_12",gm="_toggleButton_9s7ov_33",vm="_menu_9s7ov_39",ym="_menuItem_9s7ov_54",Im="_highlighted_9s7ov_61",wm="_selected_9s7ov_65",_m="_hidden_9s7ov_69",Ft={comboboxContainer:pm,label:fm,inputContainer:mm,input:hm,toggleButton:gm,menu:vm,menuItem:ym,highlighted:Im,selected:wm,hidden:_m};function bm(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function xm({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:i}){const[o,s]=g.useState(e),a=g.useRef(null);g.useEffect(()=>s(e),[e]);const c=b=>{s(e.filter(bm(b)))},{isOpen:l,getToggleButtonProps:d,getMenuProps:f,getInputProps:m,highlightedIndex:p,getItemProps:y,setInputValue:I}=ai({items:o,selectedItem:t?e.find(b=>b.value===t):null,itemToString:b=>(b==null?void 0:b.label)||"",onInputValueChange:({inputValue:b})=>c(b),onSelectedItemChange:({selectedItem:b})=>{var _;(_=a.current)==null||_.blur(),n(b)}}),w=()=>{I(""),s(e)},C=()=>w(),v=g.useMemo(()=>{var b;return(b=e.find(_=>_.value===t))==null?void 0:b.label},[e,t]),x=()=>I(v||"");return u.jsxs("div",{children:[u.jsx("div",{className:Ft.comboboxContainer,children:u.jsxs("div",{className:Ft.inputContainer,children:[u.jsx("input",{style:{border:"none"},disabled:i,placeholder:v||r,className:Ft.input,...m({onFocus:C,onBlur:x,ref:a})}),u.jsx("button",{style:{border:"none"},disabled:i,"aria-label":"toggle menu",className:Ft.toggleButton,type:"button",...d(),children:l?u.jsx(u.Fragment,{children:"↑"}):u.jsx(u.Fragment,{children:"↓"})})]})}),u.jsx("ul",{className:`${Ft.menu} ${l&&e.length?"":Ft.hidden}`,...f(),children:l&&o.map((b,_)=>u.jsx("li",{className:`${Ft.menuItem} ${p===_?Ft.highlighted:""} ${t===(b==null?void 0:b.value)?Ft.selected:""}`,...y({item:b,index:_}),children:u.jsx("span",{children:b.label})},b.id))})]})}const En=Math.min,dn=Math.max,Rr=Math.round,vr=Math.floor,Xt=e=>({x:e,y:e}),Cm={left:"right",right:"left",bottom:"top",top:"bottom"},Om={start:"end",end:"start"};function Oo(e,t,n){return dn(e,En(t,n))}function Gn(e,t){return typeof e=="function"?e(t):e}function mn(e){return e.split("-")[0]}function Yn(e){return e.split("-")[1]}function Ya(e){return e==="x"?"y":"x"}function ci(e){return e==="y"?"height":"width"}function Sn(e){return["top","bottom"].includes(mn(e))?"y":"x"}function li(e){return Ya(Sn(e))}function Em(e,t,n){n===void 0&&(n=!1);const r=Yn(e),i=li(e),o=ci(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Ar(s)),[s,Ar(s)]}function Sm(e){const t=Ar(e);return[Eo(e),t,Eo(t)]}function Eo(e){return e.replace(/start|end/g,t=>Om[t])}function Nm(e,t,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:r:t?r:i;case"left":case"right":return t?o:s;default:return[]}}function Tm(e,t,n,r){const i=Yn(e);let o=Nm(mn(e),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(Eo)))),o}function Ar(e){return e.replace(/left|right|bottom|top/g,t=>Cm[t])}function Rm(e){return{top:0,right:0,bottom:0,left:0,...e}}function Za(e){return typeof e!="number"?Rm(e):{top:e,right:e,bottom:e,left:e}}function Pr(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function as(e,t,n){let{reference:r,floating:i}=e;const o=Sn(t),s=li(t),a=ci(s),c=mn(t),l=o==="y",d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,m=r[a]/2-i[a]/2;let p;switch(c){case"top":p={x:d,y:r.y-i.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Yn(t)){case"start":p[s]-=m*(n&&l?-1:1);break;case"end":p[s]+=m*(n&&l?-1:1);break}return p}const Am=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t));let l=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:f}=as(l,r,c),m=r,p={},y=0;for(let I=0;I<a.length;I++){const{name:w,fn:C}=a[I],{x:v,y:x,data:b,reset:_}=await C({x:d,y:f,initialPlacement:r,placement:m,strategy:i,middlewareData:p,rects:l,platform:s,elements:{reference:e,floating:t}});d=v??d,f=x??f,p={...p,[w]:{...p[w],...b}},_&&y<=50&&(y++,typeof _=="object"&&(_.placement&&(m=_.placement),_.rects&&(l=_.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):_.rects),{x:d,y:f}=as(l,m,c)),I=-1)}return{x:d,y:f,placement:m,strategy:i,middlewareData:p}};async function Qa(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:m=!1,padding:p=0}=Gn(t,e),y=Za(p),w=a[m?f==="floating"?"reference":"floating":f],C=Pr(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(w)))==null||n?w:w.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:l,rootBoundary:d,strategy:c})),v=f==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,x=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),b=await(o.isElement==null?void 0:o.isElement(x))?await(o.getScale==null?void 0:o.getScale(x))||{x:1,y:1}:{x:1,y:1},_=Pr(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:x,strategy:c}):v);return{top:(C.top-_.top+y.top)/b.y,bottom:(_.bottom-C.bottom+y.bottom)/b.y,left:(C.left-_.left+y.left)/b.x,right:(_.right-C.right+y.right)/b.x}}const Pm=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:c}=t,{element:l,padding:d=0}=Gn(e,t)||{};if(l==null)return{};const f=Za(d),m={x:n,y:r},p=li(i),y=ci(p),I=await s.getDimensions(l),w=p==="y",C=w?"top":"left",v=w?"bottom":"right",x=w?"clientHeight":"clientWidth",b=o.reference[y]+o.reference[p]-m[p]-o.floating[y],_=m[p]-o.reference[p],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l));let L=E?E[x]:0;(!L||!await(s.isElement==null?void 0:s.isElement(E)))&&(L=a.floating[x]||o.floating[y]);const T=b/2-_/2,J=L/2-I[y]/2-1,q=En(f[C],J),z=En(f[v],J),Y=q,ee=L-I[y]-z,U=L/2-I[y]/2+T,se=Oo(Y,U,ee),ne=!c.arrow&&Yn(i)!=null&&U!==se&&o.reference[y]/2-(U<Y?q:z)-I[y]/2<0,Q=ne?U<Y?U-Y:U-ee:0;return{[p]:m[p]+Q,data:{[p]:se,centerOffset:U-se-Q,...ne&&{alignmentOffset:Q}},reset:ne}}}),Dm=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:c,elements:l}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:I=!0,...w}=Gn(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const C=mn(i),v=Sn(a),x=mn(a)===a,b=await(c.isRTL==null?void 0:c.isRTL(l.floating)),_=m||(x||!I?[Ar(a)]:Sm(a)),E=y!=="none";!m&&E&&_.push(...Tm(a,I,y,b));const L=[a,..._],T=await Qa(t,w),J=[];let q=((r=o.flip)==null?void 0:r.overflows)||[];if(d&&J.push(T[C]),f){const U=Em(i,s,b);J.push(T[U[0]],T[U[1]])}if(q=[...q,{placement:i,overflows:J}],!J.every(U=>U<=0)){var z,Y;const U=(((z=o.flip)==null?void 0:z.index)||0)+1,se=L[U];if(se)return{data:{index:U,overflows:q},reset:{placement:se}};let ne=(Y=q.filter(Q=>Q.overflows[0]<=0).sort((Q,de)=>Q.overflows[1]-de.overflows[1])[0])==null?void 0:Y.placement;if(!ne)switch(p){case"bestFit":{var ee;const Q=(ee=q.filter(de=>{if(E){const fe=Sn(de.placement);return fe===v||fe==="y"}return!0}).map(de=>[de.placement,de.overflows.filter(fe=>fe>0).reduce((fe,S)=>fe+S,0)]).sort((de,fe)=>de[1]-fe[1])[0])==null?void 0:ee[0];Q&&(ne=Q);break}case"initialPlacement":ne=a;break}if(i!==ne)return{reset:{placement:ne}}}return{}}}};async function jm(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=mn(n),a=Yn(n),c=Sn(n)==="y",l=["left","top"].includes(s)?-1:1,d=o&&c?-1:1,f=Gn(t,e);let{mainAxis:m,crossAxis:p,alignmentAxis:y}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof y=="number"&&(p=a==="end"?y*-1:y),c?{x:p*d,y:m*l}:{x:m*l,y:p*d}}const Fm=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=t,c=await jm(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:o+c.y,data:{...c,placement:s}}}}},km=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:w=>{let{x:C,y:v}=w;return{x:C,y:v}}},...c}=Gn(e,t),l={x:n,y:r},d=await Qa(t,c),f=Sn(mn(i)),m=Ya(f);let p=l[m],y=l[f];if(o){const w=m==="y"?"top":"left",C=m==="y"?"bottom":"right",v=p+d[w],x=p-d[C];p=Oo(v,p,x)}if(s){const w=f==="y"?"top":"left",C=f==="y"?"bottom":"right",v=y+d[w],x=y-d[C];y=Oo(v,y,x)}const I=a.fn({...t,[m]:p,[f]:y});return{...I,data:{x:I.x-n,y:I.y-r,enabled:{[m]:o,[f]:s}}}}}};function Hr(){return typeof window<"u"}function jn(e){return ec(e)?(e.nodeName||"").toLowerCase():"#document"}function at(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Nt(e){var t;return(t=(ec(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ec(e){return Hr()?e instanceof Node||e instanceof at(e).Node:!1}function Ct(e){return Hr()?e instanceof Element||e instanceof at(e).Element:!1}function St(e){return Hr()?e instanceof HTMLElement||e instanceof at(e).HTMLElement:!1}function cs(e){return!Hr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof at(e).ShadowRoot}function Zn(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Ot(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function Mm(e){return["table","td","th"].includes(jn(e))}function Ur(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function ui(e){const t=di(),n=Ct(e)?Ot(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Lm(e){let t=Gt(e);for(;St(t)&&!Nn(t);){if(ui(t))return t;if(Ur(t))return null;t=Gt(t)}return null}function di(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Nn(e){return["html","body","#document"].includes(jn(e))}function Ot(e){return at(e).getComputedStyle(e)}function Br(e){return Ct(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Gt(e){if(jn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||cs(e)&&e.host||Nt(e);return cs(t)?t.host:t}function tc(e){const t=Gt(e);return Nn(t)?e.ownerDocument?e.ownerDocument.body:e.body:St(t)&&Zn(t)?t:tc(t)}function qn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=tc(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),s=at(i);if(o){const a=So(s);return t.concat(s,s.visualViewport||[],Zn(i)?i:[],a&&n?qn(a):[])}return t.concat(i,qn(i,[],n))}function So(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function nc(e){const t=Ot(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=St(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=Rr(n)!==o||Rr(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function pi(e){return Ct(e)?e:e.contextElement}function xn(e){const t=pi(e);if(!St(t))return Xt(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=nc(t);let s=(o?Rr(n.width):n.width)/r,a=(o?Rr(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const Km=Xt(0);function rc(e){const t=at(e);return!di()||!t.visualViewport?Km:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function $m(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==at(e)?!1:t}function hn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=pi(e);let s=Xt(1);t&&(r?Ct(r)&&(s=xn(r)):s=xn(e));const a=$m(o,n,r)?rc(o):Xt(0);let c=(i.left+a.x)/s.x,l=(i.top+a.y)/s.y,d=i.width/s.x,f=i.height/s.y;if(o){const m=at(o),p=r&&Ct(r)?at(r):r;let y=m,I=So(y);for(;I&&r&&p!==y;){const w=xn(I),C=I.getBoundingClientRect(),v=Ot(I),x=C.left+(I.clientLeft+parseFloat(v.paddingLeft))*w.x,b=C.top+(I.clientTop+parseFloat(v.paddingTop))*w.y;c*=w.x,l*=w.y,d*=w.x,f*=w.y,c+=x,l+=b,y=at(I),I=So(y)}}return Pr({width:d,height:f,x:c,y:l})}function Vm(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",s=Nt(r),a=t?Ur(t.floating):!1;if(r===s||a&&o)return n;let c={scrollLeft:0,scrollTop:0},l=Xt(1);const d=Xt(0),f=St(r);if((f||!f&&!o)&&((jn(r)!=="body"||Zn(s))&&(c=Br(r)),St(r))){const m=hn(r);l=xn(r),d.x=m.x+r.clientLeft,d.y=m.y+r.clientTop}return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+d.x,y:n.y*l.y-c.scrollTop*l.y+d.y}}function Hm(e){return Array.from(e.getClientRects())}function No(e,t){const n=Br(e).scrollLeft;return t?t.left+n:hn(Nt(e)).left+n}function Um(e){const t=Nt(e),n=Br(e),r=e.ownerDocument.body,i=dn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=dn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+No(e);const a=-n.scrollTop;return Ot(r).direction==="rtl"&&(s+=dn(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function Bm(e,t){const n=at(e),r=Nt(e),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,c=0;if(i){o=i.width,s=i.height;const l=di();(!l||l&&t==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:o,height:s,x:a,y:c}}function qm(e,t){const n=hn(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=St(e)?xn(e):Xt(1),s=e.clientWidth*o.x,a=e.clientHeight*o.y,c=i*o.x,l=r*o.y;return{width:s,height:a,x:c,y:l}}function ls(e,t,n){let r;if(t==="viewport")r=Bm(e,n);else if(t==="document")r=Um(Nt(e));else if(Ct(t))r=qm(t,n);else{const i=rc(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return Pr(r)}function oc(e,t){const n=Gt(e);return n===t||!Ct(n)||Nn(n)?!1:Ot(n).position==="fixed"||oc(n,t)}function Wm(e,t){const n=t.get(e);if(n)return n;let r=qn(e,[],!1).filter(a=>Ct(a)&&jn(a)!=="body"),i=null;const o=Ot(e).position==="fixed";let s=o?Gt(e):e;for(;Ct(s)&&!Nn(s);){const a=Ot(s),c=ui(s);!c&&a.position==="fixed"&&(i=null),(o?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Zn(s)&&!c&&oc(e,s))?r=r.filter(d=>d!==s):i=a,s=Gt(s)}return t.set(e,r),r}function Jm(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?Ur(t)?[]:Wm(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((l,d)=>{const f=ls(t,d,i);return l.top=dn(f.top,l.top),l.right=En(f.right,l.right),l.bottom=En(f.bottom,l.bottom),l.left=dn(f.left,l.left),l},ls(t,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function zm(e){const{width:t,height:n}=nc(e);return{width:t,height:n}}function Xm(e,t,n){const r=St(t),i=Nt(t),o=n==="fixed",s=hn(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const c=Xt(0);if(r||!r&&!o)if((jn(t)!=="body"||Zn(i))&&(a=Br(t)),r){const p=hn(t,!0,o,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else i&&(c.x=No(i));let l=0,d=0;if(i&&!r&&!o){const p=i.getBoundingClientRect();d=p.top+a.scrollTop,l=p.left+a.scrollLeft-No(i,p)}const f=s.left+a.scrollLeft-c.x-l,m=s.top+a.scrollTop-c.y-d;return{x:f,y:m,width:s.width,height:s.height}}function po(e){return Ot(e).position==="static"}function us(e,t){if(!St(e)||Ot(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Nt(e)===n&&(n=n.ownerDocument.body),n}function ic(e,t){const n=at(e);if(Ur(e))return n;if(!St(e)){let i=Gt(e);for(;i&&!Nn(i);){if(Ct(i)&&!po(i))return i;i=Gt(i)}return n}let r=us(e,t);for(;r&&Mm(r)&&po(r);)r=us(r,t);return r&&Nn(r)&&po(r)&&!ui(r)?n:r||Lm(e)||n}const Gm=async function(e){const t=this.getOffsetParent||ic,n=this.getDimensions,r=await n(e.floating);return{reference:Xm(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ym(e){return Ot(e).direction==="rtl"}const Zm={convertOffsetParentRelativeRectToViewportRelativeRect:Vm,getDocumentElement:Nt,getClippingRect:Jm,getOffsetParent:ic,getElementRects:Gm,getClientRects:Hm,getDimensions:zm,getScale:xn,isElement:Ct,isRTL:Ym};function Qm(e,t){let n=null,r;const i=Nt(e);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),o();const{left:l,top:d,width:f,height:m}=e.getBoundingClientRect();if(a||t(),!f||!m)return;const p=vr(d),y=vr(i.clientWidth-(l+f)),I=vr(i.clientHeight-(d+m)),w=vr(l),v={rootMargin:-p+"px "+-y+"px "+-I+"px "+-w+"px",threshold:dn(0,En(1,c))||1};let x=!0;function b(_){const E=_[0].intersectionRatio;if(E!==c){if(!x)return s();E?s(!1,E):r=setTimeout(()=>{s(!1,1e-7)},1e3)}x=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return s(!0),o}function eh(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,l=pi(e),d=i||o?[...l?qn(l):[],...qn(t)]:[];d.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),o&&C.addEventListener("resize",n)});const f=l&&a?Qm(l,n):null;let m=-1,p=null;s&&(p=new ResizeObserver(C=>{let[v]=C;v&&v.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var x;(x=p)==null||x.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let y,I=c?hn(e):null;c&&w();function w(){const C=hn(e);I&&(C.x!==I.x||C.y!==I.y||C.width!==I.width||C.height!==I.height)&&n(),I=C,y=requestAnimationFrame(w)}return n(),()=>{var C;d.forEach(v=>{i&&v.removeEventListener("scroll",n),o&&v.removeEventListener("resize",n)}),f==null||f(),(C=p)==null||C.disconnect(),p=null,c&&cancelAnimationFrame(y)}}const th=Fm,nh=km,rh=Dm,oh=Pm,ds=(e,t,n)=>{const r=new Map,i={platform:Zm,...n},o={...i.platform,_c:r};return Am(e,t,{...i,platform:o})};/*
44
44
  * React Tooltip
45
45
  * {@link https://github.com/ReactTooltip/react-tooltip}
46
46
  * @copyright ReactTooltip Team
47
47
  * @license MIT
48
- */const oh="react-tooltip-core-styles",ih="react-tooltip-base-styles",ds={core:!1,base:!1};function ps({css:e,id:t=ih,type:n="base",ref:r}){var i,o;if(!e||typeof document>"u"||ds[n]||n==="core"&&typeof process<"u"&&(!((i=process==null?void 0:process.env)===null||i===void 0)&&i.REACT_TOOLTIP_DISABLE_CORE_STYLES)||n!=="base"&&typeof process<"u"&&(!((o=process==null?void 0:process.env)===null||o===void 0)&&o.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;n==="core"&&(t=oh),r||(r={});const{insertAt:s}=r;if(document.getElementById(t))return;const a=document.head||document.getElementsByTagName("head")[0],c=document.createElement("style");c.id=t,c.type="text/css",s==="top"&&a.firstChild?a.insertBefore(c,a.firstChild):a.appendChild(c),c.styleSheet?c.styleSheet.cssText=e:c.appendChild(document.createTextNode(e)),ds[n]=!0}const fs=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:i=10,strategy:o="absolute",middlewares:s=[eh(Number(i)),nh({fallbackAxisSideDirection:"start"}),th({padding:5})],border:a})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const c=s;return n?(c.push(rh({element:n,padding:5})),us(e,t,{placement:r,strategy:o,middleware:c}).then(({x:l,y:d,placement:f,middlewareData:m})=>{var p,y;const I={left:`${l}px`,top:`${d}px`,border:a},{x:w,y:C}=(p=m.arrow)!==null&&p!==void 0?p:{x:0,y:0},v=(y={top:"bottom",right:"left",bottom:"top",left:"right"}[f.split("-")[0]])!==null&&y!==void 0?y:"bottom",x=a&&{borderBottom:a,borderRight:a};let b=0;if(a){const _=`${a}`.match(/(\d+)px/);b=_!=null&&_[1]?Number(_[1]):1}return{tooltipStyles:I,tooltipArrowStyles:{left:w!=null?`${w}px`:"",top:C!=null?`${C}px`:"",right:"",bottom:"",...x,[v]:`-${4+b}px`},place:f}})):us(e,t,{placement:"bottom",strategy:o,middleware:c}).then(({x:l,y:d,placement:f})=>({tooltipStyles:{left:`${l}px`,top:`${d}px`},tooltipArrowStyles:{},place:f}))},ms=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),hs=(e,t,n)=>{let r=null;const i=function(...o){const s=()=>{r=null};!r&&(e.apply(this,o),r=setTimeout(s,t))};return i.cancel=()=>{r&&(clearTimeout(r),r=null)},i},gs=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",To=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((i,o)=>To(i,t[o]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!gs(e)||!gs(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(i=>To(e[i],t[i]))},sh=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const t=getComputedStyle(e);return["overflow","overflow-x","overflow-y"].some(n=>{const r=t.getPropertyValue(n);return r==="auto"||r==="scroll"})},vs=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(sh(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},ah=typeof window<"u"?g.useLayoutEffect:g.useEffect,ht=e=>{e.current&&(clearTimeout(e.current),e.current=null)},ch="DEFAULT_TOOLTIP_ID",lh={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},uh=g.createContext({getTooltipData:()=>lh});function ic(e=ch){return g.useContext(uh).getTooltipData(e)}var _n={tooltip:"core-styles-module_tooltip__3vRRp",fixed:"core-styles-module_fixed__pcSol",arrow:"core-styles-module_arrow__cvMwQ",noArrow:"core-styles-module_noArrow__xock6",clickable:"core-styles-module_clickable__ZuTTB",show:"core-styles-module_show__Nt9eE",closing:"core-styles-module_closing__sGnxF"},fo={tooltip:"styles-module_tooltip__mnnfp",arrow:"styles-module_arrow__K0L3T",dark:"styles-module_dark__xNqje",light:"styles-module_light__Z6W-X",success:"styles-module_success__A2AKt",warning:"styles-module_warning__SCK0X",error:"styles-module_error__JvumD",info:"styles-module_info__BWdHW"};const dh=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:i="dark",anchorId:o,anchorSelect:s,place:a="top",offset:c=10,events:l=["hover"],openOnClick:d=!1,positionStrategy:f="absolute",middlewares:m,wrapper:p,delayShow:y=0,delayHide:I=0,float:w=!1,hidden:C=!1,noArrow:v=!1,clickable:x=!1,closeOnEsc:b=!1,closeOnScroll:_=!1,closeOnResize:E=!1,openEvents:L,closeEvents:T,globalCloseEvents:J,imperativeModeOnly:q,style:z,position:Y,afterShow:ee,afterHide:U,disableTooltip:se,content:ne,contentWrapperRef:Q,isOpen:de,defaultIsOpen:fe=!1,setIsOpen:S,activeAnchor:P,setActiveAnchor:k,border:j,opacity:D,arrowColor:R,role:X="tooltip"})=>{var G;const K=g.useRef(null),Z=g.useRef(null),B=g.useRef(null),ae=g.useRef(null),A=g.useRef(null),[pe,$]=g.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ie,De]=g.useState(!1),[Ue,je]=g.useState(!1),[me,gt]=g.useState(null),Be=g.useRef(!1),nt=g.useRef(null),{anchorRefs:vt,setActiveAnchor:yt}=ic(t),qe=g.useRef(!1),[Ke,Fe]=g.useState([]),Ee=g.useRef(!1),It=d||l.includes("click"),Xe=It||(L==null?void 0:L.click)||(L==null?void 0:L.dblclick)||(L==null?void 0:L.mousedown),Tt=L?{...L}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!L&&It&&Object.assign(Tt,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const Kt=T?{...T}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!T&&It&&Object.assign(Kt,{mouseleave:!1,blur:!1,mouseout:!1});const rt=J?{...J}:{escape:b||!1,scroll:_||!1,resize:E||!1,clickOutsideAnchor:Xe||!1};q&&(Object.assign(Tt,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(Kt,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(rt,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),ah(()=>(Ee.current=!0,()=>{Ee.current=!1}),[]);const Se=H=>{Ee.current&&(H&&je(!0),setTimeout(()=>{Ee.current&&(S==null||S(H),de===void 0&&De(H))},10))};g.useEffect(()=>{if(de===void 0)return()=>null;de&&je(!0);const H=setTimeout(()=>{De(de)},10);return()=>{clearTimeout(H)}},[de]),g.useEffect(()=>{if(Ie!==Be.current)if(ht(A),Be.current=Ie,Ie)ee==null||ee();else{const H=(oe=>{const ie=oe.match(/^([\d.]+)(ms|s)$/);if(!ie)return 0;const[,Re,Me]=ie;return Number(Re)*(Me==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));A.current=setTimeout(()=>{je(!1),gt(null),U==null||U()},H+25)}},[Ie]);const Rt=H=>{$(oe=>To(oe,H)?oe:H)},$t=(H=y)=>{ht(B),Ue?Se(!0):B.current=setTimeout(()=>{Se(!0)},H)},At=(H=I)=>{ht(ae),ae.current=setTimeout(()=>{qe.current||Se(!1)},H)},tn=H=>{var oe;if(!H)return;const ie=(oe=H.currentTarget)!==null&&oe!==void 0?oe:H.target;if(!(ie!=null&&ie.isConnected))return k(null),void yt({current:null});y?$t():Se(!0),k(ie),yt({current:ie}),ht(ae)},Ze=()=>{x?At(I||100):I?At():Se(!1),ht(B)},Pt=({x:H,y:oe})=>{var ie;const Re={getBoundingClientRect:()=>({x:H,y:oe,width:0,height:0,top:oe,left:H,right:H,bottom:oe})};fs({place:(ie=me==null?void 0:me.place)!==null&&ie!==void 0?ie:a,offset:c,elementReference:Re,tooltipReference:K.current,tooltipArrowReference:Z.current,strategy:f,middlewares:m,border:j}).then(Me=>{Rt(Me)})},Vt=H=>{if(!H)return;const oe=H,ie={x:oe.clientX,y:oe.clientY};Pt(ie),nt.current=ie},nn=H=>{var oe;if(!Ie)return;const ie=H.target;ie.isConnected&&(!((oe=K.current)===null||oe===void 0)&&oe.contains(ie)||[document.querySelector(`[id='${o}']`),...Ke].some(Re=>Re==null?void 0:Re.contains(ie))||(Se(!1),ht(B)))},Ht=hs(tn,50),xe=hs(Ze,50),Ge=H=>{xe.cancel(),Ht(H)},te=()=>{Ht.cancel(),xe()},ue=g.useCallback(()=>{var H,oe;const ie=(H=me==null?void 0:me.position)!==null&&H!==void 0?H:Y;ie?Pt(ie):w?nt.current&&Pt(nt.current):P!=null&&P.isConnected&&fs({place:(oe=me==null?void 0:me.place)!==null&&oe!==void 0?oe:a,offset:c,elementReference:P,tooltipReference:K.current,tooltipArrowReference:Z.current,strategy:f,middlewares:m,border:j}).then(Re=>{Ee.current&&Rt(Re)})},[Ie,P,ne,z,a,me==null?void 0:me.place,c,f,Y,me==null?void 0:me.position,w]);g.useEffect(()=>{var H,oe;const ie=new Set(vt);Ke.forEach(we=>{se!=null&&se(we)||ie.add({current:we})});const Re=document.querySelector(`[id='${o}']`);Re&&!(se!=null&&se(Re))&&ie.add({current:Re});const Me=()=>{Se(!1)},Qe=vs(P),$e=vs(K.current);rt.scroll&&(window.addEventListener("scroll",Me),Qe==null||Qe.addEventListener("scroll",Me),$e==null||$e.addEventListener("scroll",Me));let We=null;rt.resize?window.addEventListener("resize",Me):P&&K.current&&(We=Qm(P,K.current,ue,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const et=we=>{we.key==="Escape"&&Se(!1)};rt.escape&&window.addEventListener("keydown",et),rt.clickOutsideAnchor&&window.addEventListener("click",nn);const _e=[],rn=we=>{Ie&&(we==null?void 0:we.target)===P||tn(we)},Zr=we=>{Ie&&(we==null?void 0:we.target)===P&&Ze()},pt=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],nr=["click","dblclick","mousedown","mouseup"];Object.entries(Tt).forEach(([we,wt])=>{wt&&(pt.includes(we)?_e.push({event:we,listener:Ge}):nr.includes(we)&&_e.push({event:we,listener:rn}))}),Object.entries(Kt).forEach(([we,wt])=>{wt&&(pt.includes(we)?_e.push({event:we,listener:te}):nr.includes(we)&&_e.push({event:we,listener:Zr}))}),w&&_e.push({event:"pointermove",listener:Vt});const rr=()=>{qe.current=!0},or=()=>{qe.current=!1,Ze()};return x&&!Xe&&((H=K.current)===null||H===void 0||H.addEventListener("mouseenter",rr),(oe=K.current)===null||oe===void 0||oe.addEventListener("mouseleave",or)),_e.forEach(({event:we,listener:wt})=>{ie.forEach(_t=>{var on;(on=_t.current)===null||on===void 0||on.addEventListener(we,wt)})}),()=>{var we,wt;rt.scroll&&(window.removeEventListener("scroll",Me),Qe==null||Qe.removeEventListener("scroll",Me),$e==null||$e.removeEventListener("scroll",Me)),rt.resize?window.removeEventListener("resize",Me):We==null||We(),rt.clickOutsideAnchor&&window.removeEventListener("click",nn),rt.escape&&window.removeEventListener("keydown",et),x&&!Xe&&((we=K.current)===null||we===void 0||we.removeEventListener("mouseenter",rr),(wt=K.current)===null||wt===void 0||wt.removeEventListener("mouseleave",or)),_e.forEach(({event:_t,listener:on})=>{ie.forEach(Qr=>{var Fn;(Fn=Qr.current)===null||Fn===void 0||Fn.removeEventListener(_t,on)})})}},[P,ue,Ue,vt,Ke,L,T,J,It,y,I]),g.useEffect(()=>{var H,oe;let ie=(oe=(H=me==null?void 0:me.anchorSelect)!==null&&H!==void 0?H:s)!==null&&oe!==void 0?oe:"";!ie&&t&&(ie=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Re=new MutationObserver(Me=>{const Qe=[],$e=[];Me.forEach(We=>{if(We.type==="attributes"&&We.attributeName==="data-tooltip-id"&&(We.target.getAttribute("data-tooltip-id")===t?Qe.push(We.target):We.oldValue===t&&$e.push(We.target)),We.type==="childList"){if(P){const et=[...We.removedNodes].filter(_e=>_e.nodeType===1);if(ie)try{$e.push(...et.filter(_e=>_e.matches(ie))),$e.push(...et.flatMap(_e=>[..._e.querySelectorAll(ie)]))}catch{}et.some(_e=>{var rn;return!!(!((rn=_e==null?void 0:_e.contains)===null||rn===void 0)&&rn.call(_e,P))&&(je(!1),Se(!1),k(null),ht(B),ht(ae),!0)})}if(ie)try{const et=[...We.addedNodes].filter(_e=>_e.nodeType===1);Qe.push(...et.filter(_e=>_e.matches(ie))),Qe.push(...et.flatMap(_e=>[..._e.querySelectorAll(ie)]))}catch{}}}),(Qe.length||$e.length)&&Fe(We=>[...We.filter(et=>!$e.includes(et)),...Qe])});return Re.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{Re.disconnect()}},[t,s,me==null?void 0:me.anchorSelect,P]),g.useEffect(()=>{ue()},[ue]),g.useEffect(()=>{if(!(Q!=null&&Q.current))return()=>null;const H=new ResizeObserver(()=>{setTimeout(()=>ue())});return H.observe(Q.current),()=>{H.disconnect()}},[ne,Q==null?void 0:Q.current]),g.useEffect(()=>{var H;const oe=document.querySelector(`[id='${o}']`),ie=[...Ke,oe];P&&ie.includes(P)||k((H=Ke[0])!==null&&H!==void 0?H:oe)},[o,Ke,P]),g.useEffect(()=>(fe&&Se(!0),()=>{ht(B),ht(ae)}),[]),g.useEffect(()=>{var H;let oe=(H=me==null?void 0:me.anchorSelect)!==null&&H!==void 0?H:s;if(!oe&&t&&(oe=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),oe)try{const ie=Array.from(document.querySelectorAll(oe));Fe(ie)}catch{Fe([])}},[t,s,me==null?void 0:me.anchorSelect]),g.useEffect(()=>{B.current&&(ht(B),$t(y))},[y]);const ke=(G=me==null?void 0:me.content)!==null&&G!==void 0?G:ne,Dt=Ie&&Object.keys(pe.tooltipStyles).length>0;return g.useImperativeHandle(e,()=>({open:H=>{if(H!=null&&H.anchorSelect)try{document.querySelector(H.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${H.anchorSelect}" is not a valid CSS selector`)}gt(H??null),H!=null&&H.delay?$t(H.delay):Se(!0)},close:H=>{H!=null&&H.delay?At(H.delay):Se(!1)},activeAnchor:P,place:pe.place,isOpen:!!(Ue&&!C&&ke&&Dt)})),Ue&&!C&&ke?g.createElement(p,{id:t,role:X,className:st("react-tooltip",_n.tooltip,fo.tooltip,fo[i],n,`react-tooltip__place-${pe.place}`,_n[Dt?"show":"closing"],Dt?"react-tooltip__show":"react-tooltip__closing",f==="fixed"&&_n.fixed,x&&_n.clickable),onTransitionEnd:H=>{ht(A),Ie||H.propertyName!=="opacity"||(je(!1),gt(null),U==null||U())},style:{...z,...pe.tooltipStyles,opacity:D!==void 0&&Dt?D:void 0},ref:K},ke,g.createElement(p,{className:st("react-tooltip-arrow",_n.arrow,fo.arrow,r,v&&_n.noArrow),style:{...pe.tooltipArrowStyles,background:R?`linear-gradient(to right bottom, transparent 50%, ${R} 50%)`:void 0},ref:Z})):null},ph=({content:e})=>g.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),fh=g.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:i,render:o,className:s,classNameArrow:a,variant:c="dark",place:l="top",offset:d=10,wrapper:f="div",children:m=null,events:p=["hover"],openOnClick:y=!1,positionStrategy:I="absolute",middlewares:w,delayShow:C=0,delayHide:v=0,float:x=!1,hidden:b=!1,noArrow:_=!1,clickable:E=!1,closeOnEsc:L=!1,closeOnScroll:T=!1,closeOnResize:J=!1,openEvents:q,closeEvents:z,globalCloseEvents:Y,imperativeModeOnly:ee=!1,style:U,position:se,isOpen:ne,defaultIsOpen:Q=!1,disableStyleInjection:de=!1,border:fe,opacity:S,arrowColor:P,setIsOpen:k,afterShow:j,afterHide:D,disableTooltip:R,role:X="tooltip"},G)=>{const[K,Z]=g.useState(r),[B,ae]=g.useState(i),[A,pe]=g.useState(l),[$,Ie]=g.useState(c),[De,Ue]=g.useState(d),[je,me]=g.useState(C),[gt,Be]=g.useState(v),[nt,vt]=g.useState(x),[yt,qe]=g.useState(b),[Ke,Fe]=g.useState(f),[Ee,It]=g.useState(p),[Xe,Tt]=g.useState(I),[Kt,rt]=g.useState(null),[Se,Rt]=g.useState(null),$t=g.useRef(de),{anchorRefs:At,activeAnchor:tn}=ic(e),Ze=xe=>xe==null?void 0:xe.getAttributeNames().reduce((Ge,te)=>{var ue;return te.startsWith("data-tooltip-")&&(Ge[te.replace(/^data-tooltip-/,"")]=(ue=xe==null?void 0:xe.getAttribute(te))!==null&&ue!==void 0?ue:null),Ge},{}),Pt=xe=>{const Ge={place:te=>{var ue;pe((ue=te)!==null&&ue!==void 0?ue:l)},content:te=>{Z(te??r)},html:te=>{ae(te??i)},variant:te=>{var ue;Ie((ue=te)!==null&&ue!==void 0?ue:c)},offset:te=>{Ue(te===null?d:Number(te))},wrapper:te=>{var ue;Fe((ue=te)!==null&&ue!==void 0?ue:f)},events:te=>{const ue=te==null?void 0:te.split(" ");It(ue??p)},"position-strategy":te=>{var ue;Tt((ue=te)!==null&&ue!==void 0?ue:I)},"delay-show":te=>{me(te===null?C:Number(te))},"delay-hide":te=>{Be(te===null?v:Number(te))},float:te=>{vt(te===null?x:te==="true")},hidden:te=>{qe(te===null?b:te==="true")},"class-name":te=>{rt(te)}};Object.values(Ge).forEach(te=>te(null)),Object.entries(xe).forEach(([te,ue])=>{var ke;(ke=Ge[te])===null||ke===void 0||ke.call(Ge,ue)})};g.useEffect(()=>{Z(r)},[r]),g.useEffect(()=>{ae(i)},[i]),g.useEffect(()=>{pe(l)},[l]),g.useEffect(()=>{Ie(c)},[c]),g.useEffect(()=>{Ue(d)},[d]),g.useEffect(()=>{me(C)},[C]),g.useEffect(()=>{Be(v)},[v]),g.useEffect(()=>{vt(x)},[x]),g.useEffect(()=>{qe(b)},[b]),g.useEffect(()=>{Tt(I)},[I]),g.useEffect(()=>{$t.current!==de&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[de]),g.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:de==="core",disableBase:de}}))},[]),g.useEffect(()=>{var xe;const Ge=new Set(At);let te=n;if(!te&&e&&(te=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),te)try{document.querySelectorAll(te).forEach(oe=>{Ge.add({current:oe})})}catch{console.warn(`[react-tooltip] "${te}" is not a valid CSS selector`)}const ue=document.querySelector(`[id='${t}']`);if(ue&&Ge.add({current:ue}),!Ge.size)return()=>null;const ke=(xe=Se??ue)!==null&&xe!==void 0?xe:tn.current,Dt=new MutationObserver(oe=>{oe.forEach(ie=>{var Re;if(!ke||ie.type!=="attributes"||!(!((Re=ie.attributeName)===null||Re===void 0)&&Re.startsWith("data-tooltip-")))return;const Me=Ze(ke);Pt(Me)})}),H={attributes:!0,childList:!1,subtree:!1};if(ke){const oe=Ze(ke);Pt(oe),Dt.observe(ke,H)}return()=>{Dt.disconnect()}},[At,tn,Se,t,n]),g.useEffect(()=>{U!=null&&U.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),fe&&!ms("border",`${fe}`)&&console.warn(`[react-tooltip] "${fe}" is not a valid \`border\`.`),U!=null&&U.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),S&&!ms("opacity",`${S}`)&&console.warn(`[react-tooltip] "${S}" is not a valid \`opacity\`.`)},[]);let Vt=m;const nn=g.useRef(null);if(o){const xe=o({content:(Se==null?void 0:Se.getAttribute("data-tooltip-content"))||K||null,activeAnchor:Se});Vt=xe?g.createElement("div",{ref:nn,className:"react-tooltip-content-wrapper"},xe):null}else K&&(Vt=K);B&&(Vt=g.createElement(ph,{content:B}));const Ht={forwardRef:G,id:e,anchorId:t,anchorSelect:n,className:st(s,Kt),classNameArrow:a,content:Vt,contentWrapperRef:nn,place:A,variant:$,offset:De,wrapper:Ke,events:Ee,openOnClick:y,positionStrategy:Xe,middlewares:w,delayShow:je,delayHide:gt,float:nt,hidden:yt,noArrow:_,clickable:E,closeOnEsc:L,closeOnScroll:T,closeOnResize:J,openEvents:q,closeEvents:z,globalCloseEvents:Y,imperativeModeOnly:ee,style:U,position:se,isOpen:ne,defaultIsOpen:Q,border:fe,opacity:S,arrowColor:P,setIsOpen:k,afterShow:j,afterHide:D,disableTooltip:R,activeAnchor:Se,setActiveAnchor:xe=>Rt(xe),role:X};return g.createElement(dh,{...Ht})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||ps({css:":root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}",type:"core"}),e.detail.disableBase||ps({css:`
49
- .styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})});function mh(){return u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[u.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[u.jsx("path",{d:"M8.00032 11.167L8.00032 7.83366M8.00032 1.83366C4.33366 1.83366 1.33366 4.83366 1.33366 8.50033C1.33366 12.167 4.33366 15.167 8.00033 15.167C11.667 15.167 14.667 12.167 14.667 8.50033C14.667 4.83366 11.667 1.83366 8.00032 1.83366Z",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),u.jsx("defs",{children:u.jsx("clipPath",{id:"clip0_2896_16290",children:u.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function hh({id:e,tooltipText:t}){return u.jsxs(u.Fragment,{children:[u.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:mh()}),u.jsx(fh,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}const sc=g.createContext(null);function ac(){const e=g.useContext(sc);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const cc=g.createContext(()=>{});function gh(){const e=g.useContext(cc);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var lc=Symbol.for("immer-nothing"),ys=Symbol.for("immer-draftable"),lt=Symbol.for("immer-state"),vh=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function tt(e,...t){if(process.env.NODE_ENV!=="production"){const n=vh[e],r=typeof n=="function"?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Tn=Object.getPrototypeOf;function Rn(e){return!!e&&!!e[lt]}function gn(e){var t;return e?uc(e)||Array.isArray(e)||!!e[ys]||!!((t=e.constructor)!=null&&t[ys])||Wr(e)||Jr(e):!1}var yh=Object.prototype.constructor.toString();function uc(e){if(!e||typeof e!="object")return!1;const t=Tn(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===yh}function Dr(e,t){qr(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function qr(e){const t=e[lt];return t?t.type_:Array.isArray(e)?1:Wr(e)?2:Jr(e)?3:0}function Ro(e,t){return qr(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function dc(e,t,n){const r=qr(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Ih(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Wr(e){return e instanceof Map}function Jr(e){return e instanceof Set}function ln(e){return e.copy_||e.base_}function Ao(e,t){if(Wr(e))return new Map(e);if(Jr(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=uc(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[lt];let i=Reflect.ownKeys(r);for(let o=0;o<i.length;o++){const s=i[o],a=r[s];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(r[s]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[s]})}return Object.create(Tn(e),r)}else{const r=Tn(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function pi(e,t=!1){return zr(e)||Rn(e)||!gn(e)||(qr(e)>1&&(e.set=e.add=e.clear=e.delete=wh),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>pi(r,!0))),e}function wh(){tt(2)}function zr(e){return Object.isFrozen(e)}var _h={};function vn(e){const t=_h[e];return t||tt(0,e),t}var Wn;function pc(){return Wn}function bh(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Is(e,t){t&&(vn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Po(e){Do(e),e.drafts_.forEach(xh),e.drafts_=null}function Do(e){e===Wn&&(Wn=e.parent_)}function ws(e){return Wn=bh(Wn,e)}function xh(e){const t=e[lt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function _s(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[lt].modified_&&(Po(t),tt(4)),gn(e)&&(e=jr(t,e),t.parent_||Fr(t,e)),t.patches_&&vn("Patches").generateReplacementPatches_(n[lt].base_,e,t.patches_,t.inversePatches_)):e=jr(t,n,[]),Po(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==lc?e:void 0}function jr(e,t,n){if(zr(t))return t;const r=t[lt];if(!r)return Dr(t,(i,o)=>bs(e,r,t,i,o,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Fr(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const i=r.copy_;let o=i,s=!1;r.type_===3&&(o=new Set(i),i.clear(),s=!0),Dr(o,(a,c)=>bs(e,r,i,a,c,n,s)),Fr(e,i,!1),n&&e.patches_&&vn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function bs(e,t,n,r,i,o,s){if(process.env.NODE_ENV!=="production"&&i===n&&tt(5),Rn(i)){const a=o&&t&&t.type_!==3&&!Ro(t.assigned_,r)?o.concat(r):void 0,c=jr(e,i,a);if(dc(n,r,c),Rn(c))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(gn(i)&&!zr(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;jr(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Fr(e,i)}}function Fr(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&pi(t,n)}function Ch(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:pc(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=fi;n&&(i=[r],o=Jn);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,a}var fi={get(e,t){if(t===lt)return e;const n=ln(e);if(!Ro(n,t))return Oh(e,n,t);const r=n[t];return e.finalized_||!gn(r)?r:r===mo(e.base_,t)?(ho(e),e.copy_[t]=Fo(r,e)):r},has(e,t){return t in ln(e)},ownKeys(e){return Reflect.ownKeys(ln(e))},set(e,t,n){const r=fc(ln(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=mo(ln(e),t),o=i==null?void 0:i[lt];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Ih(n,i)&&(n!==void 0||Ro(e.base_,t)))return!0;ho(e),jo(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return mo(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,ho(e),jo(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=ln(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){tt(11)},getPrototypeOf(e){return Tn(e.base_)},setPrototypeOf(){tt(12)}},Jn={};Dr(fi,(e,t)=>{Jn[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Jn.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&tt(13),Jn.set.call(this,e,t,void 0)};Jn.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&tt(14),fi.set.call(this,e[0],t,n,e[0])};function mo(e,t){const n=e[lt];return(n?ln(n):e)[t]}function Oh(e,t,n){var i;const r=fc(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function fc(e,t){if(!(t in e))return;let n=Tn(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Tn(n)}}function jo(e){e.modified_||(e.modified_=!0,e.parent_&&jo(e.parent_))}function ho(e){e.copy_||(e.copy_=Ao(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Eh=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const o=n;n=t;const s=this;return function(c=o,...l){return s.produce(c,d=>n.call(this,d,...l))}}typeof n!="function"&&tt(6),r!==void 0&&typeof r!="function"&&tt(7);let i;if(gn(t)){const o=ws(this),s=Fo(t,void 0);let a=!0;try{i=n(s),a=!1}finally{a?Po(o):Do(o)}return Is(o,r),_s(i,o)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===lc&&(i=void 0),this.autoFreeze_&&pi(i,!0),r){const o=[],s=[];vn("Patches").generateReplacementPatches_(t,i,o,s),r(o,s)}return i}else tt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,c=>t(c,...a));let r,i;return[this.produce(t,n,(s,a)=>{r=s,i=a}),r,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){gn(e)||tt(8),Rn(e)&&(e=Sh(e));const t=ws(this),n=Fo(e,void 0);return n[lt].isManual_=!0,Do(t),n}finishDraft(e,t){const n=e&&e[lt];(!n||!n.isManual_)&&tt(9);const{scope_:r}=n;return Is(r,t),_s(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=vn("Patches").applyPatches_;return Rn(e)?r(e,t):this.produce(e,i=>r(i,t))}};function Fo(e,t){const n=Wr(e)?vn("MapSet").proxyMap_(e,t):Jr(e)?vn("MapSet").proxySet_(e,t):Ch(e,t);return(t?t.scope_:pc()).drafts_.push(n),n}function Sh(e){return Rn(e)||tt(10,e),mc(e)}function mc(e){if(!gn(e)||zr(e))return e;const t=e[lt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ao(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Ao(e,!0);return Dr(n,(r,i)=>{dc(n,r,mc(i))}),t&&(t.finalized_=!1),n}var ut=new Eh,Kn=ut.produce;ut.produceWithPatches.bind(ut);ut.setAutoFreeze.bind(ut);ut.setUseStrictShallowCopy.bind(ut);ut.applyPatches.bind(ut);ut.createDraft.bind(ut);ut.finishDraft.bind(ut);const hc=g.createContext(void 0),Nh={};function mi(){const e=g.useContext(hc);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function Th({children:e}){const{installation:t}=dt(),{hydratedRevision:n,loading:r}=Dn(),[i,o]=g.useState(Nh),s=t==null?void 0:t.config;g.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(i).length>0)&&Zp(n,s,o)},[n,r,s,i]);const a=g.useCallback((p,y)=>{o(I=>Kn(I,w=>{w[p]=Kn(w[p],y)}))},[o]),c=g.useCallback((p,y)=>{o(I=>Kn(I,w=>{w[p]=y}))},[o]),l=g.useCallback(()=>{o(Kn(p=>{const y=p.other.write;y&&(y.isWriteModified=!1)}))},[o]),d=g.useCallback(p=>{o(Kn(y=>{var w;const I=(w=y[p])==null?void 0:w.read;I&&(I.isOptionalFieldsModified=!1,I.isRequiredMapFieldsModified=!1)}))},[o]),f=g.useCallback(p=>{p===fn?l():d(p)},[d,l]),m=g.useMemo(()=>({objectConfigurationsState:i,setObjectConfigurationsState:o,setConfigureState:a,resetConfigureState:c,resetPendingConfigurationState:f}),[i,c,f,a]);return u.jsx(hc.Provider,{value:m,children:e})}const In=()=>{const{appName:e}=Pe(),{objectConfigurationsState:t,setConfigureState:n}=mi(),{selectedObjectName:r}=ac(),i=aa(r||"",t);return{appName:e,configureState:i,setConfigureState:n,selectedObjectName:r}};function Rh(e,t,n){var i;const r=((i=e==null?void 0:e.read)==null?void 0:i.selectedFieldMappings)||{};if(r[t]=n,e!=null&&e.read){const o=e.read.savedConfig.requiredMapFields,a=!Vo(o,r);e.read.isRequiredMapFieldsModified=a}}function gc(e,t,n,r){t(e,i=>Rh(i,n,r))}function vc({field:e,onSelectChange:t,allFields:n}){var m;const{configureState:r,selectedObjectName:i,setConfigureState:o}=In(),[s,a]=g.useState(!0),c=(m=r==null?void 0:r.read)==null?void 0:m.selectedFieldMappings,l=c==null?void 0:c[e.mapToName];g.useEffect(()=>{e._default&&!l&&i&&r&&gc(i,o,e.mapToName,e._default),a(!1)},[e,o,i,l,r]);const d=g.useMemo(()=>n.map(p=>({id:p.fieldName,label:p.displayName,value:p.fieldName})),[n]),f=u.jsx(bm,{disabled:s,items:d,selectedValue:l||null,onSelectedItemChange:p=>{t({target:{name:e.mapToName,value:p==null?void 0:p.value}})},placeholder:"Please select one"});return u.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[u.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[u.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName}),u.jsx("span",{children:(e==null?void 0:e.prompt)&&u.jsx(hh,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),f]},e.mapToName)}const Ah="_formControl_9qd8d_1",Ph="_formLabel_9qd8d_5",Dh="_formLabelRequired_9qd8d_11",jh="_formInput_9qd8d_16",Fh="_formInputInvalid_9qd8d_20",kh="_formError_9qd8d_24",Mh="_disabled_9qd8d_30",cn={formControl:Ah,formLabel:Ph,formLabelRequired:Dh,formInput:jh,formInputInvalid:Fh,formError:kh,disabled:Mh};function Lh({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:i=!1,errorMessage:o,children:s}){return u.jsxs("div",{className:st(cn.formControl,{[cn.disabled]:r}),children:[t&&u.jsx("label",{htmlFor:e,className:st(cn.formLabel,{[cn.formLabelRequired]:n}),children:t}),u.jsx("div",{id:e,className:st(cn.formInput,{[cn.formInputInvalid]:i}),children:s}),i&&o&&u.jsx("div",{className:cn.formError,role:"alert",children:o})]})}const Kh="_divider_1kmoj_1",xs={divider:Kh};function hi({className:e,style:t}){return u.jsx("hr",{className:e?`${xs.divider} ${e}`:xs.divider,style:t})}function Xr({string:e}){return u.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[u.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),u.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:u.jsx(hi,{style:{width:"100%",marginLeft:"1rem"}})})]})}function $h(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=In(),{fieldMapping:r}=dt(),{isError:i,removeError:o}=Yt(),s=c=>{const{value:l,name:d}=c.target;l&&(e&&gc(e,n,d,l),i(Ce.MAPPING,d)&&o(Ce.MAPPING,d))},a=g.useMemo(()=>{var f;const c=((f=t==null?void 0:t.read)==null?void 0:f.requiredMapFields)||[],l=e&&r?Object.values(r[e]||{}).flat():[];return c.concat(l).reduce((m,p)=>m.find(I=>I.mapToName===p.mapToName)?m.map(I=>I.mapToName===p.mapToName?p:I):m.concat(p),new Array).filter(zt)},[t,r,e]);return a!=null&&a.length?u.jsxs(u.Fragment,{children:[u.jsx(Xr,{string:"Map the following fields"}),u.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:a.map(c=>{var l;return u.jsx(Lh,{id:c.mapToName,isInvalid:i(Ce.MAPPING,c.mapToName),errorMessage:"* required",children:u.jsx(vc,{allFields:((l=t==null?void 0:t.read)==null?void 0:l.allFields)||[],field:c,onSelectChange:s})},c.mapToName)})})]}):null}const Vh={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function Hh({children:e,style:t}){return u.jsx(Zt,{style:{...Vh,...t},children:e})}function Uh(){var d,f,m;const{project:e}=Pe(),{hydratedRevision:t}=Dn(),{selectedObjectName:n}=In(),{provider:r}=dt(),i=e==null?void 0:e.appName,o=Qt(r),s=(m=(f=(d=t==null?void 0:t.content)==null?void 0:d.read)==null?void 0:f.objects)==null?void 0:m.find(p=>p.objectName===n),a=(s==null?void 0:s.displayName)||n&&Bn(n),c=s==null?void 0:s.mapToName,l=(s==null?void 0:s.mapToDisplayName)||c&&Bn(c);return l&&i&&o?u.jsx(Hh,{style:{marginTop:"1rem"},children:u.jsxs("p",{style:{margin:"1rem 0"},children:[u.jsx("b",{children:l})," in ",i," is mapped to ",u.jsx("b",{children:a})," in ",o,"."]})}):null}function Cs(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function yc(...e){return t=>{let n=!1;const r=e.map(i=>{const o=Cs(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i<r.length;i++){const o=r[i];typeof o=="function"?o():Cs(e[i],null)}}}}function zn(...e){return V.useCallback(yc(...e),e)}function Gr(e,t=[]){let n=[];function r(o,s){const a=V.createContext(s),c=n.length;n=[...n,s];const l=f=>{var C;const{scope:m,children:p,...y}=f,I=((C=m==null?void 0:m[e])==null?void 0:C[c])||a,w=V.useMemo(()=>y,Object.values(y));return u.jsx(I.Provider,{value:w,children:p})};l.displayName=o+"Provider";function d(f,m){var I;const p=((I=m==null?void 0:m[e])==null?void 0:I[c])||a,y=V.useContext(p);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[l,d]}const i=()=>{const o=n.map(s=>V.createContext(s));return function(a){const c=(a==null?void 0:a[e])||o;return V.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[r,Bh(i,...t)]}function Bh(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:c,scopeName:l})=>{const f=c(o)[`__scope${l}`];return{...a,...f}},{});return V.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function xt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function gi(e){const t=V.useRef(e);return V.useEffect(()=>{t.current=e}),V.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function vi({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=qh({defaultProp:t,onChange:n}),o=e!==void 0,s=o?e:r,a=gi(n),c=V.useCallback(l=>{if(o){const f=typeof l=="function"?l(e):l;f!==e&&a(f)}else i(l)},[o,e,i,a]);return[s,c]}function qh({defaultProp:e,onChange:t}){const n=V.useState(e),[r]=n,i=V.useRef(r),o=gi(t);return V.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}function Wh(e){const t=V.useRef({value:e,previous:e});return V.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var kr=globalThis!=null&&globalThis.document?V.useLayoutEffect:()=>{};function Jh(e){const[t,n]=V.useState(void 0);return kr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,a;if("borderBoxSize"in o){const c=o.borderBoxSize,l=Array.isArray(c)?c[0]:c;s=l.inlineSize,a=l.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function zh(e,t){return V.useReducer((n,r)=>t[n][r]??n,e)}var yi=e=>{const{present:t,children:n}=e,r=Xh(t),i=typeof n=="function"?n({present:r.isPresent}):V.Children.only(n),o=zn(r.ref,Gh(i));return typeof n=="function"||r.isPresent?V.cloneElement(i,{ref:o}):null};yi.displayName="Presence";function Xh(e){const[t,n]=V.useState(),r=V.useRef({}),i=V.useRef(e),o=V.useRef("none"),s=e?"mounted":"unmounted",[a,c]=zh(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return V.useEffect(()=>{const l=yr(r.current);o.current=a==="mounted"?l:"none"},[a]),kr(()=>{const l=r.current,d=i.current;if(d!==e){const m=o.current,p=yr(l);e?c("MOUNT"):p==="none"||(l==null?void 0:l.display)==="none"?c("UNMOUNT"):c(d&&m!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),kr(()=>{if(t){let l;const d=t.ownerDocument.defaultView??window,f=p=>{const I=yr(r.current).includes(p.animationName);if(p.target===t&&I&&(c("ANIMATION_END"),!i.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",l=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},m=p=>{p.target===t&&(o.current=yr(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(l),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:V.useCallback(l=>{l&&(r.current=getComputedStyle(l)),n(l)},[])}}function yr(e){return(e==null?void 0:e.animationName)||"none"}function Gh(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Mr=V.forwardRef((e,t)=>{const{children:n,...r}=e,i=V.Children.toArray(n),o=i.find(Zh);if(o){const s=o.props.children,a=i.map(c=>c===o?V.Children.count(s)>1?V.Children.only(null):V.isValidElement(s)?s.props.children:null:c);return u.jsx(ko,{...r,ref:t,children:V.isValidElement(s)?V.cloneElement(s,void 0,a):null})}return u.jsx(ko,{...r,ref:t,children:n})});Mr.displayName="Slot";var ko=V.forwardRef((e,t)=>{const{children:n,...r}=e;if(V.isValidElement(n)){const i=eg(n);return V.cloneElement(n,{...Qh(r,n.props),ref:t?yc(t,i):i})}return V.Children.count(n)>1?V.Children.only(null):null});ko.displayName="SlotClone";var Yh=({children:e})=>u.jsx(u.Fragment,{children:e});function Zh(e){return V.isValidElement(e)&&e.type===Yh}function Qh(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{o(...a),i(...a)}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function eg(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var tg=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],en=tg.reduce((e,t)=>{const n=V.forwardRef((r,i)=>{const{asChild:o,...s}=r,a=o?Mr:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(a,{...s,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Ii="Checkbox",[ng,fy]=Gr(Ii),[rg,og]=ng(Ii),Ic=V.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:s,disabled:a,value:c="on",onCheckedChange:l,form:d,...f}=e,[m,p]=V.useState(null),y=zn(t,b=>p(b)),I=V.useRef(!1),w=m?d||!!m.closest("form"):!0,[C=!1,v]=vi({prop:i,defaultProp:o,onChange:l}),x=V.useRef(C);return V.useEffect(()=>{const b=m==null?void 0:m.form;if(b){const _=()=>v(x.current);return b.addEventListener("reset",_),()=>b.removeEventListener("reset",_)}},[m,v]),u.jsxs(rg,{scope:n,state:C,disabled:a,children:[u.jsx(en.button,{type:"button",role:"checkbox","aria-checked":Jt(C)?"mixed":C,"aria-required":s,"data-state":bc(C),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:y,onKeyDown:xt(e.onKeyDown,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:xt(e.onClick,b=>{v(_=>Jt(_)?!0:!_),w&&(I.current=b.isPropagationStopped(),I.current||b.stopPropagation())})}),w&&u.jsx(ig,{control:m,bubbles:!I.current,name:r,value:c,checked:C,required:s,disabled:a,form:d,style:{transform:"translateX(-100%)"},defaultChecked:Jt(o)?!1:o})]})});Ic.displayName=Ii;var wc="CheckboxIndicator",_c=V.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=og(wc,n);return u.jsx(yi,{present:r||Jt(o.state)||o.state===!0,children:u.jsx(en.span,{"data-state":bc(o.state),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});_c.displayName=wc;var ig=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:i,...o}=e,s=V.useRef(null),a=Wh(n),c=Jh(t);V.useEffect(()=>{const d=s.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(a!==n&&p){const y=new Event("click",{bubbles:r});d.indeterminate=Jt(n),p.call(d,Jt(n)?!1:n),d.dispatchEvent(y)}},[a,n,r]);const l=V.useRef(Jt(n)?!1:n);return u.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??l.current,...o,tabIndex:-1,ref:s,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Jt(e){return e==="indeterminate"}function bc(e){return Jt(e)?"indeterminate":e?"checked":"unchecked"}var xc=Ic,Cc=_c;function Oc(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var sg=["color"],Ec=g.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Oc(e,sg);return g.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),g.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),ag=["color"],cg=g.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Oc(e,ag);return g.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),g.createElement("path",{d:"M2 7.5C2 7.22386 2.22386 7 2.5 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H2.5C2.22386 8 2 7.77614 2 7.5Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const lg="_checkboxGroupContainer_1ya1t_1",ug="_stack_1ya1t_6",dg="_selectAllContainer_1ya1t_11",pg="_fieldContainer_1ya1t_18",fg="_checkbox_1ya1t_1",An={checkboxGroupContainer:lg,stack:ug,selectAllContainer:dg,fieldContainer:pg,checkbox:fg};function Sc({id:e,isChecked:t,label:n,onCheckedChange:r}){return u.jsxs("div",{className:An.fieldContainer,children:[u.jsx(xc,{className:An.checkbox,id:e,onCheckedChange:r,checked:t,children:u.jsx(Cc,{children:u.jsx(Ec,{})})}),u.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function Nc({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:i}){return u.jsxs("div",{className:An.selectAllContainer,children:[u.jsx(xc,{className:An.checkbox,id:e,onCheckedChange:r,children:u.jsxs(Cc,{children:[i&&u.jsx(cg,{}),t===!0&&u.jsx(Ec,{})]})}),u.jsx("label",{htmlFor:e,children:n})]})}function Tc({children:e}){return u.jsx("div",{className:An.checkboxGroupContainer,children:e})}function Rc({children:e}){return u.jsx("div",{className:An.stack,children:e})}function mg(e,t,n){var i,o;const r=((i=e==null?void 0:e.read)==null?void 0:i.selectedOptionalFields)||{};if(r[t]=n,n||delete r[t],(o=e.read)!=null&&o.savedConfig.optionalFields){const s=e.read.savedConfig.optionalFields,c=!Vo(s,r);e.read.isOptionalFieldsModified=c}else console.warn("read.savedConfig.optionalFields is undefined")}function Os(e,t,n,r){t(e,i=>mg(i,n,r))}function hg(){var f,m;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=In(),i=(f=t==null?void 0:t.read)==null?void 0:f.selectedOptionalFields,o=(p,y)=>{p!=="indeterminate"&&r&&t&&Os(r,n,y,p)},s=(m=t==null?void 0:t.read)==null?void 0:m.optionalFields,a=p=>{r&&s&&s.forEach(y=>{zt(y)||Os(r,n,y.fieldName,p)})},c=!!(s&&s.length>0),l=Object.keys(i||{}).length===(s==null?void 0:s.length),d=!l&&Object.keys(i||{}).length>0;return c&&u.jsxs(u.Fragment,{children:[u.jsx(Xr,{string:`${e} reads the following optional fields`}),u.jsxs(Tc,{children:[((s==null?void 0:s.length)||0)>=2&&u.jsx(Nc,{id:"select-all-fields",isChecked:l,label:"Select all",onCheckedChange:a,isIndeterminate:d}),u.jsx(Rc,{children:s.map(p=>zt(p)?null:u.jsx(Sc,{id:p.fieldName,isChecked:!!(i!=null&&i[p==null?void 0:p.fieldName]),label:p.displayName,onCheckedChange:y=>o(y,p.fieldName)},p.fieldName))})]})]})}function gg(){return u.jsx(hg,{})}const vg={color:"var(--amp-colors-text-regular)",backgroundColor:"var(--amp-colors-bg-highlight)",borderRadius:"4px",display:"inline-block",fontSize:"0.75rem",fontWeight:500,lineHeight:"1.25",padding:"0.25rem 0.5rem"};function yg({children:e,style:t,...n}){return u.jsx("span",{style:{...vg,...t},...n,children:e})}function Ig(){var r,i,o;const{configureState:e,selectedObjectName:t}=In(),{appName:n}=Pe();return u.jsxs(u.Fragment,{children:[u.jsx(Xr,{string:`${n} reads the following ${t} fields`}),u.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:(i=(r=e==null?void 0:e.read)==null?void 0:r.requiredFields)!=null&&i.length?(o=e.read)==null?void 0:o.requiredFields.map(s=>zt(s)?null:u.jsx(yg,{children:s.displayName},s.fieldName)):"There are no required fields."})]})}function wg(){return u.jsxs(u.Fragment,{children:[u.jsx(Uh,{}),u.jsx(Ig,{}),u.jsx($h,{}),u.jsx(gg,{})]})}function _g(e,t,n){var r,i,o;if(((r=e==null?void 0:e.write)==null?void 0:r.selectedNonConfigurableWriteFields)===null&&(e.write.selectedNonConfigurableWriteFields={}),e!=null&&e.write){const s=e.write.selectedNonConfigurableWriteFields;if(s[t]=n,n||delete s[t],(o=(i=e==null?void 0:e.write)==null?void 0:i.savedConfig)!=null&&o.selectedNonConfigurableWriteFields){const a=e.write.savedConfig.selectedNonConfigurableWriteFields,l=!Vo(a,s);e.write.isWriteModified=l}}}function Es(e,t,n,r){t(e,i=>{_g(i,n,r)})}function bg(){var f,m,p,y;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=In(),i=(f=n==null?void 0:n.write)==null?void 0:f.selectedNonConfigurableWriteFields,o=(m=n==null?void 0:n.write)==null?void 0:m.writeObjects,s=(I,w)=>{I!=="indeterminate"&&t&&n&&Es(t,r,w,I)},a=I=>{var w,C;t&&n&&((C=(w=n==null?void 0:n.write)==null?void 0:w.writeObjects)==null||C.forEach(v=>{Es(t,r,v.objectName,I)}))},c=!!o,l=Object.keys(i||{}).length===((y=(p=n==null?void 0:n.write)==null?void 0:p.writeObjects)==null?void 0:y.length),d=!l&&Object.keys(i||{}).length>0;return c&&u.jsxs(u.Fragment,{children:[u.jsx(Xr,{string:`Allow ${e} to write to these objects`}),u.jsxs(Tc,{children:[((o==null?void 0:o.length)||0)>=2&&u.jsx(Nc,{id:"select-all-fields",onCheckedChange:a,isIndeterminate:d,isChecked:l,label:"Select all"}),u.jsx(Rc,{children:o.map(I=>u.jsx(Sc,{id:I.objectName,onCheckedChange:w=>s(w,I.objectName),isChecked:!!(i!=null&&i[I.objectName]),label:I.displayName},I.objectName))})]})]})}function xg(){return u.jsx(bg,{})}function Ac({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const r=He(),{projectId:i}=Pe(),{integrationId:o,installation:s,resetInstallations:a,setIntegrationDeleted:c,onUninstallSuccess:l}=dt(),[d,f]=g.useState(!1),m=!i||!o||!(s!=null&&s.id)||d,p=async()=>{if(!m){f(!0),console.warn("uninstalling installation",{projectId:i,integrationId:o,installationId:s.id});try{await Oe().installationApi.deleteInstallation({projectIdOrName:i,integrationId:o,installationId:s.id},{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}),console.warn("successfully uninstalled installation:",s.id),l==null||l(s==null?void 0:s.id),a(),c()}catch(w){console.error("Error uninstalling installation."),ze(w)}finally{f(!1)}}},y=d?"Uninstalling...":e,I=u.jsx(ct,{type:"button",onClick:p,disabled:m,variant:t,style:n,children:y});return s!=null&&s.id?I:null}function Cg(){const{appName:e}=Pe(),{installation:t}=dt();return u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[t!=null&&t.id?u.jsxs("p",{children:["Once you uninstall this integration, all your configuration will be lost, and"," ",u.jsx("b",{children:e})," may stop working."]}):u.jsx("p",{children:"You've successfully uninstalled the integration."}),u.jsx(Ac,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})}function Pc({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:i}){var E,L,T;const{installation:o}=dt(),{hydratedRevision:s,loading:a}=Dn(),{configureState:c,selectedObjectName:l}=In(),d=o==null?void 0:o.config,f=d&&l&&!!Qs(d,l)||!1,m=((E=c==null?void 0:c.read)==null?void 0:E.isOptionalFieldsModified)||((L=c==null?void 0:c.read)==null?void 0:L.isRequiredMapFieldsModified),p=(T=c==null?void 0:c.write)==null?void 0:T.isWriteModified,C=a||n||!c||!l||!(m||p||r||l!==fn&&!f),v=l===fn,x=l===Or,b=u.jsx(ct,{type:"submit",disabled:C,children:r?"Install":"Save"}),_=u.jsx(ct,{type:"button",onClick:t,disabled:C,variant:"ghost",children:"Reset"});return n?u.jsx(Un,{}):u.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[u.jsxs("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px"},children:[b,_]}),u.jsxs(Zt,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[i&&u.jsx(la,{children:typeof i=="string"?i:"Installation Failed."}),a&&u.jsx(Un,{}),s&&!x&&!v&&u.jsx(wg,{}),s&&!x&&v&&u.jsx(xg,{}),!a&&x&&u.jsx(Cg,{})]})]})}const Dc=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:i,onUpdateSuccess:o}=dt(),{hydratedRevision:s,loading:a}=Dn(),{selectedObjectName:c}=ac(),{selectedConnection:l}=yn(),d=He(),{projectId:f}=Pe(),{resetBoundary:m,setErrors:p,setError:y,getError:I}=Yt(),{resetConfigureState:w,objectConfigurationsState:C,resetPendingConfigurationState:v}=mi(),x=aa(c||"",C),{onNextIncompleteTab:b}=gh(),_=g.useCallback(()=>{m(Ce.INSTALLATION_MUTATION)},[m]),E=g.useCallback(T=>T?J=>{y(Ce.INSTALLATION_MUTATION,T,J)}:J=>{console.error("objectName is required to set installation error: ",J)},[y]),L=g.useCallback(T=>T?I(Ce.INSTALLATION_MUTATION,T):"",[I]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:c,selectedConnection:l,apiKey:d,projectId:f,resetBoundary:m,setErrors:p,setMutateInstallationError:E,getMutateInstallationError:L,resetMutateInstallationErrorState:_,resetConfigureState:w,objectConfigurationsState:C,resetPendingConfigurationState:v,configureState:x,onInstallSuccess:i,onUpdateSuccess:o,onNextIncompleteTab:b}},Og=void 0;function Eg(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:i,loading:o,selectedObjectName:s,selectedConnection:a,apiKey:c,projectId:l,resetBoundary:d,setErrors:f,setMutateInstallationError:m,getMutateInstallationError:p,resetMutateInstallationErrorState:y,resetConfigureState:I,objectConfigurationsState:w,resetPendingConfigurationState:C,configureState:v,onInstallSuccess:x,onNextIncompleteTab:b}=Dc(),[_,E]=g.useState(!1),L=s===fn,T=p(s),J=g.useCallback(()=>{d(Ce.MAPPING),i!=null&&i.content&&!o&&s&&oa(i,Og,s,I)},[d,i,o,s,I]);g.useEffect(()=>{!v&&(i!=null&&i.content)&&!o&&J()},[v,w,i,o,J]);const q=()=>{y();const{requiredMapFields:ee,selectedFieldMappings:U}=(v==null?void 0:v.read)||{},{errorList:se}=na(ee,U,f);se.length>0||(s&&(a!=null&&a.id)&&c&&l&&e&&t&&n&&i?(E(!0),tf(l,e,t,n,a.id,s,c,i,v,m(s),r,x).finally(()=>{E(!1),C(s),b()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},z=()=>{y(),s&&(a!=null&&a.id)&&c&&l&&e&&t&&n&&i?(E(!0),of(l,e,t,n,a.id,c,i,v,m(s),r,x).finally(()=>{E(!1),C(s),b()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},Y=ee=>{ee.preventDefault(),L?z():q()};return u.jsx(Pc,{errorMsg:T,isCreateMode:!0,isLoading:_,onSave:Y,onReset:J})}function Sg({updateConfig:e,projectId:t,integrationId:n,installationId:r,apiKey:i,selectedObjectName:o,setInstallation:s,onUpdateSuccess:a,setError:c}){const l={projectIdOrName:t,installationId:r,integrationId:n,installationUpdate:{updateMask:[`config.content.read.objects.${o}`],installation:{config:e}}};return Oe().installationApi.updateInstallation(l,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}}).then(d=>{s(d),a==null||a(d.id,d.config)}).catch(d=>{ze(d,c)})}const Ng=(e,t,n,r,i,o)=>{const s=ia(e),a=sa(e),c={content:{read:{objects:{[t]:{objectName:t,schedule:r,destination:(n==null?void 0:n.destination)||"",selectedFields:s,selectedFieldMappings:a,backfill:o}}}}};return $r(i)&&(c.content||(c.content={}),c.content.proxy={enabled:!0}),c},Tg=(e,t,n,r,i,o,s,a,c,l,d)=>{const f=Ng(o,r||"",a,a.schedule,c,a.backfill);return f?Sg({updateConfig:f,projectId:e,integrationId:t,installationId:n,apiKey:i,selectedObjectName:r,setError:l,setInstallation:s,onUpdateSuccess:d}):(console.error("Error when generating updateConfig from configureState"),Promise.resolve(null))},Rg=(e,t)=>{const r={content:{write:{objects:ca(e)}}};return $r(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},Ag=(e,t,n,r,i,o,s,a,c)=>{const l=Rg(i,o);if(!l)return console.error("Error when generating write updateConfig from configureState"),Promise.resolve(null);const d={projectIdOrName:e,installationId:n,integrationId:t,installationUpdate:{updateMask:["config.content.write.objects"],installation:{config:l}}};return Oe().installationApi.updateInstallation(d,{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}).then(f=>{a(f),c==null||c(f.id,f.config)}).catch(f=>{ze(f,s)})};function Pg({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:r,loading:i,selectedObjectName:o,apiKey:s,projectId:a,resetBoundary:c,setErrors:l,setMutateInstallationError:d,getMutateInstallationError:f,resetConfigureState:m,resetPendingConfigurationState:p,configureState:y,onUpdateSuccess:I,onNextIncompleteTab:w}=Dc(),[C,v]=g.useState(!1),x=o===fn,b=f(o),{config:_}=e,E=g.useCallback(()=>{c(Ce.MAPPING),r!=null&&r.content&&!i&&o&&oa(r,_,o,m)},[c,r,i,o,_,m]);g.useEffect(()=>{y||E()},[y,E]),g.useEffect(()=>{e&&E()},[e,E]);const L=g.useMemo(()=>{var Y,ee,U;return(U=(ee=(Y=r==null?void 0:r.content)==null?void 0:Y.read)==null?void 0:ee.objects)==null?void 0:U.find(se=>(se==null?void 0:se.objectName)===o)},[r,o]),T=()=>{const{requiredMapFields:z,selectedFieldMappings:Y}=(y==null?void 0:y.read)||{},{errorList:ee}=na(z,Y,l);ee.length>0||(r&&e&&o&&s&&a&&L?(v(!0),Tg(a,t.id,e.id,o,s,y,n,L,r,d(o),I).finally(()=>{v(!1),p(o),w()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},J=()=>{e&&o&&s&&a&&r?(v(!0),Ag(a,t.id,e.id,s,y,r,d(o),n,I).finally(()=>{v(!1),p(o),w()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},q=z=>{z.preventDefault(),x?J():T()};return u.jsx(Pc,{errorMsg:b,onSave:q,onReset:E,isLoading:C})}function Dg(){const{integrationObj:e,installation:t}=dt();return e?t&&e?u.jsx(Pg,{installation:t,integrationObj:e}):u.jsx(Eg,{}):u.jsx(qs,{message:"We can't load the integration"})}function jg(){return u.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),u.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function wi({text:e,children:t}){return u.jsx(Pn,{children:u.jsxs(Zt,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[u.jsx(jg,{}),u.jsx("p",{children:e}),t]})})}const Fg=(e,t)=>({revisionId:e.id,createdBy:`consumer:${t}`,content:{provider:e.content.provider,proxy:{enabled:!0}}});function kg({projectId:e,integrationId:t,groupRef:n,consumerRef:r,connectionId:i,apiKey:o,hydratedRevision:s,setError:a,setInstallation:c,onInstallSuccess:l}){const d=Fg(s,r);return d?Ho({createConfig:d,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:o,setError:a,setInstallation:c,onInstallSuccess:l}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))}function Mg({provider:e}){const t=`You have successfully installed your ${Qt(e)} integration.`;return u.jsx(wi,{text:t,children:u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:u.jsx(Ac,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const Lg=e=>{const{read:t,write:n,proxy:r}=(e==null?void 0:e.content)??{};return!t&&!n&&(r==null?void 0:r.enabled)||!1};function Kg({children:e,resetComponent:t}){var b;const{projectId:n}=Pe(),r=He(),{hydratedRevision:i,loading:o}=Dn(),{integrationObj:s,installation:a,groupRef:c,consumerRef:l,setInstallation:d,onInstallSuccess:f,isIntegrationDeleted:m}=dt(),{selectedConnection:p}=yn(),[y,I]=g.useState(!1),w=o||y,C=(b=i==null?void 0:i.content)==null?void 0:b.provider,v=Lg(i),x=_=>{console.error("Error when creating proxy installation:",_)};return g.useEffect(()=>{!w&&i&&v&&!a&&p&&r&&(s!=null&&s.id)&&(I(!0),kg({apiKey:r,projectId:n,integrationId:s==null?void 0:s.id,groupRef:c,consumerRef:l,connectionId:p==null?void 0:p.id,hydratedRevision:i,setError:x,setInstallation:d,onInstallSuccess:f}).then(()=>{I(!1)}).catch(_=>{I(!1),console.error("Error when creating proxy installation:",_)}))},[i,v,a,p,r,n,s==null?void 0:s.id,c,l,d,w,f]),m?u.jsx(wi,{text:"Integration successfully uninstalled.",children:u.jsx(ct,{type:"button",onClick:t,style:{width:"100%"},children:"Reinstall Integration"})}):s?w?u.jsx(Kr,{}):v&&C&&a?u.jsx(Mg,{provider:C}):u.jsx("div",{children:e}):u.jsx(Lt,{message:"We can't load the integration"})}function jc(){return u.jsxs("footer",{style:{backgroundColor:"light-dark(#EFEFEF, #646266)",padding:"1em",fontSize:"0.8em",color:"gray",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"0 0 4px 4px",gap:"0.4em"},children:[u.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),u.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:u.jsx("img",{style:{height:".8em"},src:"https://ampersand-website.vercel.app/logo-black.svg",alt:"Ampersand"})})]})}function Qn({children:e}){return u.jsx(Pn,{children:u.jsxs(Zt,{children:[u.jsx("div",{style:{padding:"3rem 2rem"},children:e}),u.jsx(jc,{})]})})}function er({children:e}){return u.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function tr({error:e}){return e?u.jsx(la,{style:{marginTop:"2em"},children:e}):null}function _i({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,children:i,title:o}){if(!o&&!r)throw new Error("Either title or providerName is required");return u.jsxs(Qn,{children:[u.jsx(er,{children:o||`Set up ${r} integration`}),u.jsx(tr,{error:t}),i,u.jsx(ct,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}const $g="_link_oo2kv_1",Vg={link:$g};function Fc({href:e,className:t,style:n,label:r,children:i,newTab:o=!1}){return u.jsx("a",{className:st(Vg.link,t),style:n,href:e,"aria-label":r||void 0,target:o?"_blank":"_self",rel:o?"noopener noreferrer":void 0,children:i})}function kc({url:e,providerDisplayName:t,credentialName:n}){return u.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[u.jsx(Fc,{href:e,newTab:!0,children:u.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," about where to find your ",t," ",n,"."]})}const Hg="_input_10rzg_1",Ug="_inputError_10rzg_27",Bg="_error_10rzg_43",go={input:Hg,inputError:Ug,error:Bg};function qg({id:e,type:t,className:n,isError:r=!1,...i}){const o=r?st(go.inputError,go.input):go.input;return u.jsx("input",{id:e,type:t,className:st(o,n),...i})}const Wg="_textarea_18zl4_1",Jg="_textareaError_18zl4_14",zg="_error_18zl4_29",vo={textarea:Wg,textareaError:Jg,error:zg};function Xg({className:e,isError:t=!1,...n}){const r=t?st(vo.textareaError,vo.textarea):vo.textarea;return u.jsx("textarea",{className:st(e,r),...n})}const Mt={Input:qg,Textarea:Xg};function Gg({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i}){var I;const[o,s]=g.useState(!1),a=()=>s(w=>!w),[c,l]=g.useState(""),d=w=>l(w.currentTarget.value),f=c.length>0,m=i||!f,p=Qt(e,t),y=(I=t.apiKeyOpts)==null?void 0:I.docsURL;return u.jsx(_i,{providerName:p,handleSubmit:()=>{n({apiKey:c})},error:r,isButtonDisabled:m,children:u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[y&&u.jsx(kc,{url:y,providerDisplayName:p,credentialName:"API key"}),u.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[u.jsx(Mt.Input,{id:"password",name:"password",type:o?"text":"password",placeholder:"API Key",onChange:w=>d(w)}),u.jsx(ct,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:o?"Hide":"Show"})]})]})})}function Yg({...e}){return u.jsx(Gg,{...e})}function Zg({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,setSelectedConnection:c}){const l=Pe(),[d,f]=g.useState(!1),[m,p]=g.useState(null),y=He();g.useEffect(()=>{if(e&&Oe&&d&&m!=null){const w={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,apiKey:m};Oe().connectionApi.generateConnection({projectIdOrName:l.projectId,generateConnectionParams:w},{headers:{"X-Api-Key":y??"","Content-Type":"application/json"}}).then(C=>{c(C)}).catch(C=>{console.error("Error loading provider info."),ze(C)})}},[y,e,d,r,n,o,i,l,c,m]);const I=w=>{p(w.apiKey),f(!0)};return a===null?u.jsx(Yg,{provider:e,providerInfo:t,handleSubmit:I,error:null}):s}function Qg({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i}){var C;const[o,s]=g.useState(!1),a=()=>s(v=>!v),[c,l]=g.useState({username:"",password:""}),{username:d,password:f}=c,m=Qt(e,t),p=(C=t.basicOpts)==null?void 0:C.docsURL,y=d.length>0,I=i||!y,w=v=>{const{name:x,value:b}=v.currentTarget;l(_=>({..._,[x]:b}))};return u.jsx(_i,{providerName:m,handleSubmit:()=>{n({user:d,pass:f})},error:r,isButtonDisabled:I,children:u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[p&&u.jsx(kc,{url:p,providerDisplayName:m,credentialName:"credentials"}),u.jsx(Mt.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:v=>w(v)}),u.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[u.jsx(Mt.Input,{id:"password",name:"password",type:o?"text":"password",placeholder:"Password",onChange:v=>w(v)}),u.jsx(ct,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:o?"Hide":"Show"})]})]})})}function ev({...e}){return u.jsx(Qg,{...e})}function tv({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,setSelectedConnection:c}){const l=Pe(),[d,f]=g.useState(!1),[m,p]=g.useState(null),y=He();g.useEffect(()=>{if(e&&Oe&&d&&m!=null){const w={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:m.user,password:m.pass}};Oe().connectionApi.generateConnection({projectIdOrName:l.projectId,generateConnectionParams:w},{headers:{"X-Api-Key":y??"","Content-Type":"application/json"}}).then(C=>{c(C)}).catch(C=>{console.error("Error loading provider info."),ze(C)})}},[y,e,d,r,n,o,i,l,m,c]);const I=w=>{const{user:C,pass:v}=w;p({user:C,pass:v}),f(!0)};return a===null?u.jsx(ev,{provider:e,providerInfo:t,handleSubmit:I,error:null}):s}function nv({...e}){return u.jsx(_i,{...e})}function rv({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,selectedConnection:s,setSelectedConnection:a,providerName:c}){const l=Pe(),d=He(),[f,m]=g.useState(!1);g.useEffect(()=>{if(e&&Oe&&f){const y={groupName:i,groupRef:r,consumerName:n,consumerRef:t,provider:e};Oe().connectionApi.generateConnection({projectIdOrName:l.projectId,generateConnectionParams:y},{headers:{"X-Api-Key":d??"","Content-Type":"application/json"}}).then(I=>{a(I)}).catch(I=>{console.error("Error loading provider info."),ze(I)})}},[d,e,f,n,t,i,r,a,l]);const p=()=>{m(!0)};return s===null?u.jsx(nv,{handleSubmit:p,error:null,providerName:c}):o}const Mc=async(e,t,n,r,i,o,s,a)=>{var l,d;const c=await Oe().providerApi.getProvider({provider:i},{headers:{"X-Api-Key":r??""}});if(!c)throw new Error(`Provider ${i} not found`);if(c.authType==="oauth2"&&(((l=c.oauth2Opts)==null?void 0:l.grantType)==="authorizationCode"||((d=c.oauth2Opts)==null?void 0:d.grantType)==="authorizationCodePKCE")){const m=(await Oe().providerAppApi.listProviderApps({projectIdOrName:e},{headers:{"X-Api-Key":r??""}})).find(w=>w.provider===i),p=Qt(i,c);if(!m)throw new Error(`You must first set up a ${p} Provider App using the Ampersand Console.`);const y={connectOAuthParams:{providerWorkspaceRef:o,projectId:e,groupRef:n,groupName:a,consumerRef:t,consumerName:s,providerAppId:m.id,provider:i,enableCSRFProtection:!0}};return await Oe().oAuthApi.oauthConnect(y,{credentials:"include",headers:{"X-Api-Key":r??"","Content-Type":"application/json"}})}throw new Error(`Provider ${i} does not support an OAuth2 web flow.`)},Ss=600,Ns=600,ov="AUTHORIZATION_SUCCEEDED",iv="AUTHORIZATION_FAILED";function sv(e,t,n){return g.useCallback(async r=>{const i=await Oe().connectionApi.getConnection({projectIdOrName:e,connectionId:r},{headers:{"X-Api-Key":t??""}});n(i)},[e,t,n])}function av(e,t,n,r){return g.useCallback(()=>{if(!r)return;const i=window.screenX+(window.outerWidth-Ss)/2,o=window.screenY+(window.outerHeight-Ns)/2.5,s=`width=${Ss},height=${Ns},left=${i},top=${o}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function cv(e,t){return g.useCallback(n=>{var r,i;if(n.origin===yp){if(n.data.eventType===ov){const o=(r=n.data.data)==null?void 0:r.connection;o?e(o):console.error("Connection ID not found in event data: ",{event:n})}n.data.eventType===iv&&(console.error("OAuth failed: ",{event:n}),t==null||t(((i=n==null?void 0:n.data)==null?void 0:i.message)??"OAuth failed. Please try again."))}},[t,e])}function Lc({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:i}){const o=He(),{projectId:s}=Pe(),[a,c]=g.useState(null),[l,d]=g.useState(null),{setSelectedConnection:f}=yn(),m=cv(c,r),p=av(n,d,m,t),y=sv(s,o,f);return g.useEffect(()=>{t&&!l&&p()},[t,l,p,m,n]),g.useEffect(()=>{a&&y(a).then(()=>{l==null||l.close()}).catch(I=>{console.error("Error refreshing connection: ",I),r==null||r(I.message??"Unexpected error: not able to refresh connection")})},[a,o,f,y,l,r]),g.useEffect(()=>{if(!l)return;const I=setInterval(()=>{l.closed&&(clearInterval(I),window.removeEventListener("message",m),d(null),!a&&!i?(console.error("OAuth failed. Please try again."),r==null||r("OAuth failed. Please try again.")):a&&(r==null||r(null)))},500);return()=>{clearInterval(I),window.removeEventListener("message",m)}},[l,a,i,m,r]),u.jsx("div",{children:e})}function lv({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return u.jsxs(Qn,{children:[u.jsx(er,{children:`Set up ${r} integration`}),u.jsx(tr,{error:t}),u.jsx(ct,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function uv({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o}){const{projectId:s}=Pe(),a=He(),[c,l]=g.useState(null),[d,f]=g.useState(null),m=async()=>{f(null);try{const y=await Mc(s,t,r,a,e,void 0,n,i);l(y)}catch(y){console.error("Could not fetch OAuth popup URL."),ze(y),f(y.message??"Unexpected error")}},p=g.useCallback(y=>{f(y),l(null)},[]);return u.jsx(Lc,{windowTitle:`Connect to ${o}`,oauthUrl:c,onError:p,children:u.jsx(lv,{handleSubmit:m,error:d,providerName:o})})}const dv="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function pv({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return u.jsxs(Qn,{children:[u.jsx(er,{children:"Enter your Salesforce subdomain"}),u.jsx(Fc,{href:dv,newTab:!0,children:"What is my Salesforce subdomain?"}),u.jsx(tr,{error:n}),u.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[u.jsx(Mt.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:i=>t(i.currentTarget.value)}),u.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),u.jsx(ct,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function fv({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r,providerName:i}){return u.jsxs(Qn,{children:[u.jsxs(er,{children:["Enter your ",i," workspace"]}),u.jsx(tr,{error:n}),u.jsx("br",{}),u.jsx(Mt.Input,{id:"workspace",type:"text",placeholder:"MyWorkspace",onChange:o=>t(o.currentTarget.value)}),u.jsx("br",{}),u.jsx(ct,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const mv="salesforce";function hv({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o}){const{projectId:s}=Pe(),a=He(),[c,l]=g.useState(""),[d,f]=g.useState(null),[m,p]=g.useState(null),y=async()=>{if(p(null),!c){p("Workspace is required");return}try{const C=await Mc(s,t,r,a,e,c,n,i);f(C)}catch(C){console.error(C),p((C==null?void 0:C.message)??"Unexpected error")}},I=g.useCallback(C=>{p(C),f(null)},[]),w=e===mv?u.jsx(pv,{handleSubmit:y,setWorkspace:l,error:m,isButtonDisabled:c.length===0}):u.jsx(fv,{handleSubmit:y,setWorkspace:l,error:m,isButtonDisabled:c.length===0,providerName:o});return u.jsx(Lc,{windowTitle:`Connect to ${o}`,oauthUrl:d,onError:I,children:w})}function gv({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,explicitScopesRequired:i,explicitWorkspaceRequired:o}){const[s,a]=g.useState(!1),[c,l]=g.useState({clientSecret:"",clientId:"",workspace:"",scopes:""}),d=()=>a(_=>!_),f=_=>{const{name:E,value:L}=_.currentTarget;l(T=>({...T,[E]:L}))},{clientSecret:m,clientId:p,workspace:y,scopes:I}=c,w=m.length>0,C=p.length>0,v=o?y.length>0:!0,x=n||!w||!C||!v,b=()=>{const _={clientId:p,clientSecret:m};o&&(_.workspace=y),i&&I.length>0&&(_.scopes=Lp(I)),e(_)};return u.jsxs(Qn,{children:[u.jsx(er,{children:`Set up ${r} integration`}),u.jsx(tr,{error:t}),u.jsx("br",{}),u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[o&&u.jsx(Mt.Input,{id:"workspace",name:"workspace",type:"text",placeholder:"MyWorkspace",onChange:_=>f(_)}),u.jsx(Mt.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:_=>f(_)}),u.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[u.jsx(Mt.Input,{id:"clientSecret",name:"clientSecret",type:s?"text":"password",placeholder:"Client Secret",onChange:_=>f(_)}),u.jsx(ct,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:d,children:s?"Hide":"Show"})]}),i&&u.jsx(Mt.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:_=>f(_)})]}),u.jsx("br",{}),u.jsx(ct,{style:{marginTop:"1em",width:"100%"},disabled:x,type:"submit",onClick:b,children:"Next"})]})}function vv({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,explicitScopesRequired:s,explicitWorkspaceRequired:a,selectedConnection:c,setSelectedConnection:l}){const{projectId:d}=Pe(),f=He(),[m,p]=g.useState(null),y=async I=>{p(null);const w={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:I.workspace,oauth2ClientCredentials:{clientId:I.clientId,clientSecret:I.clientSecret,scopes:I.scopes}};Oe().connectionApi.generateConnection({projectIdOrName:d,generateConnectionParams:w},{headers:{"X-Api-Key":f??"","Content-Type":"application/json"}}).then(C=>{l(C)}).catch(C=>{console.error("Error loading provider info."),ze(C),p("Error loading provider info")})};return c===null?u.jsx(gv,{providerName:t,handleSubmit:y,error:m,explicitScopesRequired:s,explicitWorkspaceRequired:a}):u.jsx(Un,{})}function yv({...e}){return u.jsx(vv,{...e})}const Iv="authorizationCode",wv="authorizationCodePKCE",_v="clientCredentials";function bv({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,selectedConnection:s,setSelectedConnection:a}){if(t.oauth2Opts===void 0)return u.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:c,explicitScopesRequired:l,explicitWorkspaceRequired:d}=t.oauth2Opts,f=Qt(e,t),m={provider:e,consumerRef:n,consumerName:r,groupRef:i,groupName:o,providerName:f};return c===Iv||c===wv?d?u.jsx(hv,{...m}):u.jsx(uv,{...m}):c===_v?u.jsx(yv,{...m,explicitWorkspaceRequired:d,explicitScopesRequired:l,selectedConnection:s,setSelectedConnection:a}):c==="password"?u.jsx("em",{children:"Password flow not supported yet"}):u.jsxs("em",{children:["Unsupported grant type: ",c]})}function xv(e){const{selectedConnection:t}=yn();g.useEffect(()=>{e&&t&&e(t)},[e,t])}function Cv({onSuccess:e}){xv(e)}const Ov=async(e,t)=>{const n=await Oe().providerApi.getProvider({provider:t},{headers:{"X-Api-Key":e??""}});if(!n)throw new Error(`Provider ${t} not found`);return n};function Kc({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,onSuccess:s,onDisconnectSuccess:a}){const c=He(),[l,d]=g.useState(null),{provider:f}=dt(),{selectedConnection:m,setSelectedConnection:p,connections:y}=yn();Cv({onSuccess:s});const I=e||f,w=(l==null?void 0:l.displayName)??Bn(I);if(g.useEffect(()=>{if(!m&&y&&y.length>0){const[v]=y;p(v)}Ov(c,I).then(v=>{d(v)}).catch(v=>{console.error("Error loading provider info."),ze(v)})},[y,m,p,c,I]),!e&&!f)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(m)return o;if(l==null)return u.jsx("strong",{children:"Provider not found"});const C={provider:I,consumerRef:t,consumerName:n,groupRef:r,groupName:i,selectedConnection:m,setSelectedConnection:p,providerName:w,providerInfo:l,onDisconnectSuccess:a};return l.authType==="none"?u.jsx(rv,{...C,children:o}):l.authType==="basic"?u.jsx(tv,{...C,children:o}):l.authType==="apiKey"?u.jsx(Zg,{...C,children:o}):u.jsx(bv,{...C})}function Ev(e){const t=e+"CollectionProvider",[n,r]=Gr(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:y,children:I}=p,w=g.useRef(null),C=g.useRef(new Map).current;return u.jsx(i,{scope:y,itemMap:C,collectionRef:w,children:I})};s.displayName=t;const a=e+"CollectionSlot",c=g.forwardRef((p,y)=>{const{scope:I,children:w}=p,C=o(a,I),v=zn(y,C.collectionRef);return u.jsx(Mr,{ref:v,children:w})});c.displayName=a;const l=e+"CollectionItemSlot",d="data-radix-collection-item",f=g.forwardRef((p,y)=>{const{scope:I,children:w,...C}=p,v=g.useRef(null),x=zn(y,v),b=o(l,I);return g.useEffect(()=>(b.itemMap.set(v,{ref:v,...C}),()=>void b.itemMap.delete(v))),u.jsx(Mr,{[d]:"",ref:x,children:w})});f.displayName=l;function m(p){const y=o(e+"CollectionConsumer",p);return g.useCallback(()=>{const w=y.collectionRef.current;if(!w)return[];const C=Array.from(w.querySelectorAll(`[${d}]`));return Array.from(y.itemMap.values()).sort((b,_)=>C.indexOf(b.ref.current)-C.indexOf(_.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:s,Slot:c,ItemSlot:f},m,r]}var Sv=V.useId||(()=>{}),Nv=0;function $c(e){const[t,n]=V.useState(Sv());return kr(()=>{e||n(r=>r??String(Nv++))},[e]),e||(t?`radix-${t}`:"")}var Tv=V.createContext(void 0);function Vc(e){const t=V.useContext(Tv);return e||t||"ltr"}var yo="rovingFocusGroup.onEntryFocus",Rv={bubbles:!1,cancelable:!0},Yr="RovingFocusGroup",[Mo,Hc,Av]=Ev(Yr),[Pv,Uc]=Gr(Yr,[Av]),[Dv,jv]=Pv(Yr),Bc=V.forwardRef((e,t)=>u.jsx(Mo.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Mo.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Fv,{...e,ref:t})})}));Bc.displayName=Yr;var Fv=V.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:d=!1,...f}=e,m=V.useRef(null),p=zn(t,m),y=Vc(o),[I=null,w]=vi({prop:s,defaultProp:a,onChange:c}),[C,v]=V.useState(!1),x=gi(l),b=Hc(n),_=V.useRef(!1),[E,L]=V.useState(0);return V.useEffect(()=>{const T=m.current;if(T)return T.addEventListener(yo,x),()=>T.removeEventListener(yo,x)},[x]),u.jsx(Dv,{scope:n,orientation:r,dir:y,loop:i,currentTabStopId:I,onItemFocus:V.useCallback(T=>w(T),[w]),onItemShiftTab:V.useCallback(()=>v(!0),[]),onFocusableItemAdd:V.useCallback(()=>L(T=>T+1),[]),onFocusableItemRemove:V.useCallback(()=>L(T=>T-1),[]),children:u.jsx(en.div,{tabIndex:C||E===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:xt(e.onMouseDown,()=>{_.current=!0}),onFocus:xt(e.onFocus,T=>{const J=!_.current;if(T.target===T.currentTarget&&J&&!C){const q=new CustomEvent(yo,Rv);if(T.currentTarget.dispatchEvent(q),!q.defaultPrevented){const z=b().filter(ne=>ne.focusable),Y=z.find(ne=>ne.active),ee=z.find(ne=>ne.id===I),se=[Y,ee,...z].filter(Boolean).map(ne=>ne.ref.current);Jc(se,d)}}_.current=!1}),onBlur:xt(e.onBlur,()=>v(!1))})})}),qc="RovingFocusGroupItem",Wc=V.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,...s}=e,a=$c(),c=o||a,l=jv(qc,n),d=l.currentTabStopId===c,f=Hc(n),{onFocusableItemAdd:m,onFocusableItemRemove:p}=l;return V.useEffect(()=>{if(r)return m(),()=>p()},[r,m,p]),u.jsx(Mo.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:u.jsx(en.span,{tabIndex:d?0:-1,"data-orientation":l.orientation,...s,ref:t,onMouseDown:xt(e.onMouseDown,y=>{r?l.onItemFocus(c):y.preventDefault()}),onFocus:xt(e.onFocus,()=>l.onItemFocus(c)),onKeyDown:xt(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){l.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const I=Lv(y,l.orientation,l.dir);if(I!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let C=f().filter(v=>v.focusable).map(v=>v.ref.current);if(I==="last")C.reverse();else if(I==="prev"||I==="next"){I==="prev"&&C.reverse();const v=C.indexOf(y.currentTarget);C=l.loop?Kv(C,v+1):C.slice(v+1)}setTimeout(()=>Jc(C))}})})})});Wc.displayName=qc;var kv={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Mv(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Lv(e,t,n){const r=Mv(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return kv[r]}function Jc(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Kv(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var $v=Bc,Vv=Wc,bi="Tabs",[Hv,my]=Gr(bi,[Uc]),zc=Uc(),[Uv,xi]=Hv(bi),Xc=V.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:a,activationMode:c="automatic",...l}=e,d=Vc(a),[f,m]=vi({prop:r,onChange:i,defaultProp:o});return u.jsx(Uv,{scope:n,baseId:$c(),value:f,onValueChange:m,orientation:s,dir:d,activationMode:c,children:u.jsx(en.div,{dir:d,"data-orientation":s,...l,ref:t})})});Xc.displayName=bi;var Gc="TabsList",Yc=V.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=xi(Gc,n),s=zc(n);return u.jsx($v,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:u.jsx(en.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});Yc.displayName=Gc;var Zc="TabsTrigger",Qc=V.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=xi(Zc,n),a=zc(n),c=tl(s.baseId,r),l=nl(s.baseId,r),d=r===s.value;return u.jsx(Vv,{asChild:!0,...a,focusable:!i,active:d,children:u.jsx(en.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":l,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:c,...o,ref:t,onMouseDown:xt(e.onMouseDown,f=>{!i&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:xt(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:xt(e.onFocus,()=>{const f=s.activationMode!=="manual";!d&&!i&&f&&s.onValueChange(r)})})})});Qc.displayName=Zc;var el="TabsContent",Bv=V.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,a=xi(el,n),c=tl(a.baseId,r),l=nl(a.baseId,r),d=r===a.value,f=V.useRef(d);return V.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),u.jsx(yi,{present:i||d,children:({present:m})=>u.jsx(en.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:l,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:m&&o})})});Bv.displayName=el;function tl(e,t){return`${e}-trigger-${t}`}function nl(e,t){return`${e}-content-${t}`}var qv=Xc,Wv=Yc,rl=Qc;const Jv=u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[u.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),u.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function zv(e,t){return t?g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},g.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?Jv:u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:u.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}function Xv(){return u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("path",{d:"M2.25 4.5H3.75H15.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M14.25 4.5V15C14.25 15.3978 14.092 15.7794 13.8107 16.0607C13.5294 16.342 13.1478 16.5 12.75 16.5H5.25C4.85218 16.5 4.47064 16.342 4.18934 16.0607C3.90804 15.7794 3.75 15.3978 3.75 15V4.5M6 4.5V3C6 2.60218 6.15804 2.22064 6.43934 1.93934C6.72064 1.65804 7.10218 1.5 7.5 1.5H10.5C10.8978 1.5 11.2794 1.65804 11.5607 1.93934C11.842 2.22064 12 2.60218 12 3V4.5",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M7.5 8.25V12.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M10.5 8.25V12.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const Gv="_tabsRoot_ktpr0_1",Yv="_tabsList_ktpr0_6",Zv="_tabTrigger_ktpr0_12",Qv="_danger_ktpr0_29",Xn={tabsRoot:Gv,tabsList:Yv,tabTrigger:Zv,danger:Qv};function ol({objectName:e,completed:t,pending:n,displayName:r}){return u.jsx(rl,{value:e,className:Xn.tabTrigger,children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[zv(t,n),u.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[u.jsx("span",{children:r||e}),n&&u.jsx("span",{style:{fontSize:".8rem",fontStyle:"italic"},children:"pending"})]})]})})}function ey({completed:e,pending:t,displayName:n}){return u.jsxs(u.Fragment,{children:[u.jsx(hi,{style:{margin:"1rem 0"}}),u.jsx(ol,{objectName:fn,completed:e,pending:t,displayName:n},"other-write")]})}function ty(){return u.jsxs(u.Fragment,{children:[u.jsx(hi,{style:{margin:"3rem 0 1rem 0"}}),u.jsx(rl,{value:Or,className:st(Xn.tabTrigger,Xn.danger),children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[Xv(),u.jsx("span",{children:"Uninstall"})]})})]})}function ny({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:i,showUninstallButton:o}){var s,a;return u.jsx(qv,{value:e,className:Xn.tabsRoot,onValueChange:n,children:u.jsxs(Wv,{className:Xn.tabsList,children:[t.map(c=>{var l,d,f,m;return u.jsx(ol,{objectName:c.name,displayName:c.displayName,completed:c.completed,pending:((d=(l=r==null?void 0:r[c.name])==null?void 0:l.read)==null?void 0:d.isOptionalFieldsModified)||((m=(f=r==null?void 0:r[c.name])==null?void 0:f.read)==null?void 0:m.isRequiredMapFieldsModified)||!1},c.name)}),i&&u.jsx(ey,{completed:i.completed,pending:((a=(s=r==null?void 0:r.other)==null?void 0:s.write)==null?void 0:a.isWriteModified)||!1,displayName:"Write"}),o&&u.jsx(ty,{})]})})}function ry(e,t){return t===Or?{name:Or,completed:!1}:e.find(n=>n.name===t)}function oy({children:e}){var C;const{project:t}=Pe(),{installation:n,provider:r}=dt(),{hydratedRevision:i}=Dn(),{objectConfigurationsState:o}=mi(),[s,a]=g.useState(""),c=(t==null?void 0:t.appName)||"",l=n==null?void 0:n.config,d=i&&ea(l,i),f=d!==null,m=!!((C=i==null?void 0:i.content)!=null&&C.write),p=m?ta(l):void 0,y=g.useMemo(()=>{const v=[...d||[]];return p&&m&&v.push(p),v},[d,p,m]),I=ry(y,s),w=g.useCallback(()=>{const v=y.find(x=>I!==x&&!x.completed);v&&a(v.name)},[y,I]);return g.useEffect(()=>{!s&&y.length>0&&a(y[0].name)},[y,s,w]),u.jsx(cc.Provider,{value:w,children:u.jsx(sc.Provider,{value:I==null?void 0:I.name,children:u.jsxs(Pn,{style:{maxWidth:"55rem"},children:[u.jsxs(Zt,{style:{display:"flex",gap:"1rem",padding:"3rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[u.jsxs("div",{style:{width:"20rem"},children:[u.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[Qt(r)," integration"]}),u.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:c}),f&&u.jsx(ny,{value:s,readNavObjects:d,onValueChange:v=>a(v),objectConfigurationsState:o,writeNavObject:p,showUninstallButton:!!n})]}),e]}),u.jsx(jc,{})]})})})}function iy({...e}){return u.jsx(oy,{...e})}function sy({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c}){var C;const{projectId:l,projectIdOrName:d,isLoading:f}=Pe(),{isLoading:m}=Ko(),{isError:p,errorState:y}=Yt(),{seed:I,reset:w}=Ys();return f||m?u.jsx(Kr,{}):p(Ce.PROJECT,d)?u.jsx(Lt,{message:`Error loading project ${d}`}):p(Ce.INTEGRATION_LIST,d)?u.jsx(Lt,{message:"Error retrieving integrations for the project, double check the API key"}):(C=y[Ce.INTEGRATION_LIST])!=null&&C.apiError?u.jsx(Lt,{message:"Something went wrong, couldn't find integration information"}):u.jsx("div",{className:Zs.resetContainer,children:u.jsx($p,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c,children:u.jsx(Gs,{groupRef:r,children:u.jsx(Kc,{consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:u.jsx(pf,{projectId:l,children:u.jsx(Kg,{resetComponent:w,children:u.jsx(Th,{children:u.jsx(iy,{children:u.jsx(Dg,{})})})})})})})},I)})}function ay(){return u.jsxs(Pn,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[u.jsx(Un,{}),u.jsx("p",{children:"Redirecting"})]})}function cy({redirectURL:e,children:t}){return g.useEffect(()=>{e&&window.location.replace(e)},[e]),e?u.jsx(ay,{}):t}function ly({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:i}){const o=He(),{projectId:s}=Pe(),{selectedConnection:a,setConnections:c}=yn(),[l,d]=g.useState(!1),f=!s||!a||!a.id||l,m=async()=>{if(!f){d(!0),console.warn("deleting connection",{projectId:s,connectionId:a==null?void 0:a.id});try{await Oe().connectionApi.deleteConnection({projectIdOrName:s,connectionId:a==null?void 0:a.id},{headers:{"X-Api-Key":o,"Content-Type":"application/json"}}),console.warn("successfully deleted connection:",a==null?void 0:a.id),r==null||r(a),Oe().connectionApi.listConnections({projectIdOrName:s},{headers:{"X-Api-Key":o??""}}).then(I=>{c(I),i()}).catch(I=>{ze(I)})}catch(I){console.error("Error deleting connection."),ze(I)}finally{d(!1)}}},p=l?"Disconnecting...":e;return u.jsx(ct,{type:"button",onClick:m,disabled:f,variant:t,style:n,children:p})}function uy({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Pe(),i=`You have successfully connected your ${Qt(e)} account to ${r}.`;return u.jsx(wi,{text:i,children:u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:u.jsx(ly,{resetComponent:n,onDisconnectSuccess:t,buttonText:"Remove Connection",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}function dy({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,redirectUrl:o,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:c}){const{seed:l,reset:d}=Ys(),f=g.useCallback(m=>{s?s(m.id):c&&c(m)},[s,c]);return u.jsx("div",{className:Zs.resetContainer,children:u.jsx(Gs,{provider:e,groupRef:r,children:u.jsx(Kc,{provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onSuccess:f,onDisconnectSuccess:a,children:u.jsx(cy,{redirectURL:o,children:u.jsx(uy,{resetComponent:d,provider:e,onDisconnectSuccess:a})})})})},l)}const py=(e,t)=>{const n=He(),{projectId:r,isLoading:i}=Pe(),{integrations:o}=Ko(),[s,a]=g.useState(!1),[c,l]=g.useState(null);if(!n||!i&&!r)throw new Error("useIsIntegrationInstalled must be used within AmpersandProvider");if(!e)throw new Error("useIsIntegrationInstalled requires an integration name");if(!t)throw new Error("useIsIntegrationInstalled requires a groupRef");const f=g.useMemo(()=>o==null?void 0:o.reduce((m,p)=>(p==null?void 0:p.name)===e?p:m,{}),[o,e]);return g.useEffect(()=>{!f||i||Oe().installationApi.listInstallations({projectIdOrName:r,integrationId:f.id,groupRef:t},{headers:{"x-api-key":n}}).then(m=>{a(!0),l(m.length>0)}).catch(m=>{console.error("Error listing installations."),ze(m),a(!0)})},[t,n,r,f,i]),{isLoaded:s,isIntegrationInstalled:c}};exports.AmpersandContext=Bs;exports.AmpersandProvider=Cp;exports.ConnectProvider=dy;exports.FieldMapping=vc;exports.InstallIntegration=sy;exports.useAmpersandProvider=Op;exports.useIsIntegrationInstalled=py;
48
+ */const ih="react-tooltip-core-styles",sh="react-tooltip-base-styles",ps={core:!1,base:!1};function fs({css:e,id:t=sh,type:n="base",ref:r}){var i,o;if(!e||typeof document>"u"||ps[n]||n==="core"&&typeof process<"u"&&(!((i=process==null?void 0:process.env)===null||i===void 0)&&i.REACT_TOOLTIP_DISABLE_CORE_STYLES)||n!=="base"&&typeof process<"u"&&(!((o=process==null?void 0:process.env)===null||o===void 0)&&o.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;n==="core"&&(t=ih),r||(r={});const{insertAt:s}=r;if(document.getElementById(t))return;const a=document.head||document.getElementsByTagName("head")[0],c=document.createElement("style");c.id=t,c.type="text/css",s==="top"&&a.firstChild?a.insertBefore(c,a.firstChild):a.appendChild(c),c.styleSheet?c.styleSheet.cssText=e:c.appendChild(document.createTextNode(e)),ps[n]=!0}const ms=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:i=10,strategy:o="absolute",middlewares:s=[th(Number(i)),rh({fallbackAxisSideDirection:"start"}),nh({padding:5})],border:a})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const c=s;return n?(c.push(oh({element:n,padding:5})),ds(e,t,{placement:r,strategy:o,middleware:c}).then(({x:l,y:d,placement:f,middlewareData:m})=>{var p,y;const I={left:`${l}px`,top:`${d}px`,border:a},{x:w,y:C}=(p=m.arrow)!==null&&p!==void 0?p:{x:0,y:0},v=(y={top:"bottom",right:"left",bottom:"top",left:"right"}[f.split("-")[0]])!==null&&y!==void 0?y:"bottom",x=a&&{borderBottom:a,borderRight:a};let b=0;if(a){const _=`${a}`.match(/(\d+)px/);b=_!=null&&_[1]?Number(_[1]):1}return{tooltipStyles:I,tooltipArrowStyles:{left:w!=null?`${w}px`:"",top:C!=null?`${C}px`:"",right:"",bottom:"",...x,[v]:`-${4+b}px`},place:f}})):ds(e,t,{placement:"bottom",strategy:o,middleware:c}).then(({x:l,y:d,placement:f})=>({tooltipStyles:{left:`${l}px`,top:`${d}px`},tooltipArrowStyles:{},place:f}))},hs=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),gs=(e,t,n)=>{let r=null;const i=function(...o){const s=()=>{r=null};!r&&(e.apply(this,o),r=setTimeout(s,t))};return i.cancel=()=>{r&&(clearTimeout(r),r=null)},i},vs=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",To=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((i,o)=>To(i,t[o]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!vs(e)||!vs(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(i=>To(e[i],t[i]))},ah=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const t=getComputedStyle(e);return["overflow","overflow-x","overflow-y"].some(n=>{const r=t.getPropertyValue(n);return r==="auto"||r==="scroll"})},ys=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(ah(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},ch=typeof window<"u"?g.useLayoutEffect:g.useEffect,ht=e=>{e.current&&(clearTimeout(e.current),e.current=null)},lh="DEFAULT_TOOLTIP_ID",uh={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},dh=g.createContext({getTooltipData:()=>uh});function sc(e=lh){return g.useContext(dh).getTooltipData(e)}var _n={tooltip:"core-styles-module_tooltip__3vRRp",fixed:"core-styles-module_fixed__pcSol",arrow:"core-styles-module_arrow__cvMwQ",noArrow:"core-styles-module_noArrow__xock6",clickable:"core-styles-module_clickable__ZuTTB",show:"core-styles-module_show__Nt9eE",closing:"core-styles-module_closing__sGnxF"},fo={tooltip:"styles-module_tooltip__mnnfp",arrow:"styles-module_arrow__K0L3T",dark:"styles-module_dark__xNqje",light:"styles-module_light__Z6W-X",success:"styles-module_success__A2AKt",warning:"styles-module_warning__SCK0X",error:"styles-module_error__JvumD",info:"styles-module_info__BWdHW"};const ph=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:i="dark",anchorId:o,anchorSelect:s,place:a="top",offset:c=10,events:l=["hover"],openOnClick:d=!1,positionStrategy:f="absolute",middlewares:m,wrapper:p,delayShow:y=0,delayHide:I=0,float:w=!1,hidden:C=!1,noArrow:v=!1,clickable:x=!1,closeOnEsc:b=!1,closeOnScroll:_=!1,closeOnResize:E=!1,openEvents:L,closeEvents:T,globalCloseEvents:J,imperativeModeOnly:q,style:z,position:Y,afterShow:ee,afterHide:U,disableTooltip:se,content:ne,contentWrapperRef:Q,isOpen:de,defaultIsOpen:fe=!1,setIsOpen:S,activeAnchor:P,setActiveAnchor:k,border:j,opacity:D,arrowColor:R,role:X="tooltip"})=>{var G;const K=g.useRef(null),Z=g.useRef(null),B=g.useRef(null),ae=g.useRef(null),A=g.useRef(null),[pe,$]=g.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ie,De]=g.useState(!1),[Ue,je]=g.useState(!1),[me,gt]=g.useState(null),Be=g.useRef(!1),nt=g.useRef(null),{anchorRefs:vt,setActiveAnchor:yt}=sc(t),qe=g.useRef(!1),[Ke,Fe]=g.useState([]),Ee=g.useRef(!1),It=d||l.includes("click"),Xe=It||(L==null?void 0:L.click)||(L==null?void 0:L.dblclick)||(L==null?void 0:L.mousedown),Tt=L?{...L}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!L&&It&&Object.assign(Tt,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const Kt=T?{...T}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!T&&It&&Object.assign(Kt,{mouseleave:!1,blur:!1,mouseout:!1});const rt=J?{...J}:{escape:b||!1,scroll:_||!1,resize:E||!1,clickOutsideAnchor:Xe||!1};q&&(Object.assign(Tt,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(Kt,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(rt,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),ch(()=>(Ee.current=!0,()=>{Ee.current=!1}),[]);const Se=H=>{Ee.current&&(H&&je(!0),setTimeout(()=>{Ee.current&&(S==null||S(H),de===void 0&&De(H))},10))};g.useEffect(()=>{if(de===void 0)return()=>null;de&&je(!0);const H=setTimeout(()=>{De(de)},10);return()=>{clearTimeout(H)}},[de]),g.useEffect(()=>{if(Ie!==Be.current)if(ht(A),Be.current=Ie,Ie)ee==null||ee();else{const H=(oe=>{const ie=oe.match(/^([\d.]+)(ms|s)$/);if(!ie)return 0;const[,Re,Me]=ie;return Number(Re)*(Me==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));A.current=setTimeout(()=>{je(!1),gt(null),U==null||U()},H+25)}},[Ie]);const Rt=H=>{$(oe=>To(oe,H)?oe:H)},$t=(H=y)=>{ht(B),Ue?Se(!0):B.current=setTimeout(()=>{Se(!0)},H)},At=(H=I)=>{ht(ae),ae.current=setTimeout(()=>{qe.current||Se(!1)},H)},tn=H=>{var oe;if(!H)return;const ie=(oe=H.currentTarget)!==null&&oe!==void 0?oe:H.target;if(!(ie!=null&&ie.isConnected))return k(null),void yt({current:null});y?$t():Se(!0),k(ie),yt({current:ie}),ht(ae)},Ze=()=>{x?At(I||100):I?At():Se(!1),ht(B)},Pt=({x:H,y:oe})=>{var ie;const Re={getBoundingClientRect:()=>({x:H,y:oe,width:0,height:0,top:oe,left:H,right:H,bottom:oe})};ms({place:(ie=me==null?void 0:me.place)!==null&&ie!==void 0?ie:a,offset:c,elementReference:Re,tooltipReference:K.current,tooltipArrowReference:Z.current,strategy:f,middlewares:m,border:j}).then(Me=>{Rt(Me)})},Vt=H=>{if(!H)return;const oe=H,ie={x:oe.clientX,y:oe.clientY};Pt(ie),nt.current=ie},nn=H=>{var oe;if(!Ie)return;const ie=H.target;ie.isConnected&&(!((oe=K.current)===null||oe===void 0)&&oe.contains(ie)||[document.querySelector(`[id='${o}']`),...Ke].some(Re=>Re==null?void 0:Re.contains(ie))||(Se(!1),ht(B)))},Ht=gs(tn,50),xe=gs(Ze,50),Ge=H=>{xe.cancel(),Ht(H)},te=()=>{Ht.cancel(),xe()},ue=g.useCallback(()=>{var H,oe;const ie=(H=me==null?void 0:me.position)!==null&&H!==void 0?H:Y;ie?Pt(ie):w?nt.current&&Pt(nt.current):P!=null&&P.isConnected&&ms({place:(oe=me==null?void 0:me.place)!==null&&oe!==void 0?oe:a,offset:c,elementReference:P,tooltipReference:K.current,tooltipArrowReference:Z.current,strategy:f,middlewares:m,border:j}).then(Re=>{Ee.current&&Rt(Re)})},[Ie,P,ne,z,a,me==null?void 0:me.place,c,f,Y,me==null?void 0:me.position,w]);g.useEffect(()=>{var H,oe;const ie=new Set(vt);Ke.forEach(we=>{se!=null&&se(we)||ie.add({current:we})});const Re=document.querySelector(`[id='${o}']`);Re&&!(se!=null&&se(Re))&&ie.add({current:Re});const Me=()=>{Se(!1)},Qe=ys(P),$e=ys(K.current);rt.scroll&&(window.addEventListener("scroll",Me),Qe==null||Qe.addEventListener("scroll",Me),$e==null||$e.addEventListener("scroll",Me));let We=null;rt.resize?window.addEventListener("resize",Me):P&&K.current&&(We=eh(P,K.current,ue,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const et=we=>{we.key==="Escape"&&Se(!1)};rt.escape&&window.addEventListener("keydown",et),rt.clickOutsideAnchor&&window.addEventListener("click",nn);const _e=[],rn=we=>{Ie&&(we==null?void 0:we.target)===P||tn(we)},Zr=we=>{Ie&&(we==null?void 0:we.target)===P&&Ze()},pt=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],nr=["click","dblclick","mousedown","mouseup"];Object.entries(Tt).forEach(([we,wt])=>{wt&&(pt.includes(we)?_e.push({event:we,listener:Ge}):nr.includes(we)&&_e.push({event:we,listener:rn}))}),Object.entries(Kt).forEach(([we,wt])=>{wt&&(pt.includes(we)?_e.push({event:we,listener:te}):nr.includes(we)&&_e.push({event:we,listener:Zr}))}),w&&_e.push({event:"pointermove",listener:Vt});const rr=()=>{qe.current=!0},or=()=>{qe.current=!1,Ze()};return x&&!Xe&&((H=K.current)===null||H===void 0||H.addEventListener("mouseenter",rr),(oe=K.current)===null||oe===void 0||oe.addEventListener("mouseleave",or)),_e.forEach(({event:we,listener:wt})=>{ie.forEach(_t=>{var on;(on=_t.current)===null||on===void 0||on.addEventListener(we,wt)})}),()=>{var we,wt;rt.scroll&&(window.removeEventListener("scroll",Me),Qe==null||Qe.removeEventListener("scroll",Me),$e==null||$e.removeEventListener("scroll",Me)),rt.resize?window.removeEventListener("resize",Me):We==null||We(),rt.clickOutsideAnchor&&window.removeEventListener("click",nn),rt.escape&&window.removeEventListener("keydown",et),x&&!Xe&&((we=K.current)===null||we===void 0||we.removeEventListener("mouseenter",rr),(wt=K.current)===null||wt===void 0||wt.removeEventListener("mouseleave",or)),_e.forEach(({event:_t,listener:on})=>{ie.forEach(Qr=>{var Fn;(Fn=Qr.current)===null||Fn===void 0||Fn.removeEventListener(_t,on)})})}},[P,ue,Ue,vt,Ke,L,T,J,It,y,I]),g.useEffect(()=>{var H,oe;let ie=(oe=(H=me==null?void 0:me.anchorSelect)!==null&&H!==void 0?H:s)!==null&&oe!==void 0?oe:"";!ie&&t&&(ie=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Re=new MutationObserver(Me=>{const Qe=[],$e=[];Me.forEach(We=>{if(We.type==="attributes"&&We.attributeName==="data-tooltip-id"&&(We.target.getAttribute("data-tooltip-id")===t?Qe.push(We.target):We.oldValue===t&&$e.push(We.target)),We.type==="childList"){if(P){const et=[...We.removedNodes].filter(_e=>_e.nodeType===1);if(ie)try{$e.push(...et.filter(_e=>_e.matches(ie))),$e.push(...et.flatMap(_e=>[..._e.querySelectorAll(ie)]))}catch{}et.some(_e=>{var rn;return!!(!((rn=_e==null?void 0:_e.contains)===null||rn===void 0)&&rn.call(_e,P))&&(je(!1),Se(!1),k(null),ht(B),ht(ae),!0)})}if(ie)try{const et=[...We.addedNodes].filter(_e=>_e.nodeType===1);Qe.push(...et.filter(_e=>_e.matches(ie))),Qe.push(...et.flatMap(_e=>[..._e.querySelectorAll(ie)]))}catch{}}}),(Qe.length||$e.length)&&Fe(We=>[...We.filter(et=>!$e.includes(et)),...Qe])});return Re.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{Re.disconnect()}},[t,s,me==null?void 0:me.anchorSelect,P]),g.useEffect(()=>{ue()},[ue]),g.useEffect(()=>{if(!(Q!=null&&Q.current))return()=>null;const H=new ResizeObserver(()=>{setTimeout(()=>ue())});return H.observe(Q.current),()=>{H.disconnect()}},[ne,Q==null?void 0:Q.current]),g.useEffect(()=>{var H;const oe=document.querySelector(`[id='${o}']`),ie=[...Ke,oe];P&&ie.includes(P)||k((H=Ke[0])!==null&&H!==void 0?H:oe)},[o,Ke,P]),g.useEffect(()=>(fe&&Se(!0),()=>{ht(B),ht(ae)}),[]),g.useEffect(()=>{var H;let oe=(H=me==null?void 0:me.anchorSelect)!==null&&H!==void 0?H:s;if(!oe&&t&&(oe=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),oe)try{const ie=Array.from(document.querySelectorAll(oe));Fe(ie)}catch{Fe([])}},[t,s,me==null?void 0:me.anchorSelect]),g.useEffect(()=>{B.current&&(ht(B),$t(y))},[y]);const ke=(G=me==null?void 0:me.content)!==null&&G!==void 0?G:ne,Dt=Ie&&Object.keys(pe.tooltipStyles).length>0;return g.useImperativeHandle(e,()=>({open:H=>{if(H!=null&&H.anchorSelect)try{document.querySelector(H.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${H.anchorSelect}" is not a valid CSS selector`)}gt(H??null),H!=null&&H.delay?$t(H.delay):Se(!0)},close:H=>{H!=null&&H.delay?At(H.delay):Se(!1)},activeAnchor:P,place:pe.place,isOpen:!!(Ue&&!C&&ke&&Dt)})),Ue&&!C&&ke?g.createElement(p,{id:t,role:X,className:st("react-tooltip",_n.tooltip,fo.tooltip,fo[i],n,`react-tooltip__place-${pe.place}`,_n[Dt?"show":"closing"],Dt?"react-tooltip__show":"react-tooltip__closing",f==="fixed"&&_n.fixed,x&&_n.clickable),onTransitionEnd:H=>{ht(A),Ie||H.propertyName!=="opacity"||(je(!1),gt(null),U==null||U())},style:{...z,...pe.tooltipStyles,opacity:D!==void 0&&Dt?D:void 0},ref:K},ke,g.createElement(p,{className:st("react-tooltip-arrow",_n.arrow,fo.arrow,r,v&&_n.noArrow),style:{...pe.tooltipArrowStyles,background:R?`linear-gradient(to right bottom, transparent 50%, ${R} 50%)`:void 0},ref:Z})):null},fh=({content:e})=>g.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),mh=g.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:i,render:o,className:s,classNameArrow:a,variant:c="dark",place:l="top",offset:d=10,wrapper:f="div",children:m=null,events:p=["hover"],openOnClick:y=!1,positionStrategy:I="absolute",middlewares:w,delayShow:C=0,delayHide:v=0,float:x=!1,hidden:b=!1,noArrow:_=!1,clickable:E=!1,closeOnEsc:L=!1,closeOnScroll:T=!1,closeOnResize:J=!1,openEvents:q,closeEvents:z,globalCloseEvents:Y,imperativeModeOnly:ee=!1,style:U,position:se,isOpen:ne,defaultIsOpen:Q=!1,disableStyleInjection:de=!1,border:fe,opacity:S,arrowColor:P,setIsOpen:k,afterShow:j,afterHide:D,disableTooltip:R,role:X="tooltip"},G)=>{const[K,Z]=g.useState(r),[B,ae]=g.useState(i),[A,pe]=g.useState(l),[$,Ie]=g.useState(c),[De,Ue]=g.useState(d),[je,me]=g.useState(C),[gt,Be]=g.useState(v),[nt,vt]=g.useState(x),[yt,qe]=g.useState(b),[Ke,Fe]=g.useState(f),[Ee,It]=g.useState(p),[Xe,Tt]=g.useState(I),[Kt,rt]=g.useState(null),[Se,Rt]=g.useState(null),$t=g.useRef(de),{anchorRefs:At,activeAnchor:tn}=sc(e),Ze=xe=>xe==null?void 0:xe.getAttributeNames().reduce((Ge,te)=>{var ue;return te.startsWith("data-tooltip-")&&(Ge[te.replace(/^data-tooltip-/,"")]=(ue=xe==null?void 0:xe.getAttribute(te))!==null&&ue!==void 0?ue:null),Ge},{}),Pt=xe=>{const Ge={place:te=>{var ue;pe((ue=te)!==null&&ue!==void 0?ue:l)},content:te=>{Z(te??r)},html:te=>{ae(te??i)},variant:te=>{var ue;Ie((ue=te)!==null&&ue!==void 0?ue:c)},offset:te=>{Ue(te===null?d:Number(te))},wrapper:te=>{var ue;Fe((ue=te)!==null&&ue!==void 0?ue:f)},events:te=>{const ue=te==null?void 0:te.split(" ");It(ue??p)},"position-strategy":te=>{var ue;Tt((ue=te)!==null&&ue!==void 0?ue:I)},"delay-show":te=>{me(te===null?C:Number(te))},"delay-hide":te=>{Be(te===null?v:Number(te))},float:te=>{vt(te===null?x:te==="true")},hidden:te=>{qe(te===null?b:te==="true")},"class-name":te=>{rt(te)}};Object.values(Ge).forEach(te=>te(null)),Object.entries(xe).forEach(([te,ue])=>{var ke;(ke=Ge[te])===null||ke===void 0||ke.call(Ge,ue)})};g.useEffect(()=>{Z(r)},[r]),g.useEffect(()=>{ae(i)},[i]),g.useEffect(()=>{pe(l)},[l]),g.useEffect(()=>{Ie(c)},[c]),g.useEffect(()=>{Ue(d)},[d]),g.useEffect(()=>{me(C)},[C]),g.useEffect(()=>{Be(v)},[v]),g.useEffect(()=>{vt(x)},[x]),g.useEffect(()=>{qe(b)},[b]),g.useEffect(()=>{Tt(I)},[I]),g.useEffect(()=>{$t.current!==de&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[de]),g.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:de==="core",disableBase:de}}))},[]),g.useEffect(()=>{var xe;const Ge=new Set(At);let te=n;if(!te&&e&&(te=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),te)try{document.querySelectorAll(te).forEach(oe=>{Ge.add({current:oe})})}catch{console.warn(`[react-tooltip] "${te}" is not a valid CSS selector`)}const ue=document.querySelector(`[id='${t}']`);if(ue&&Ge.add({current:ue}),!Ge.size)return()=>null;const ke=(xe=Se??ue)!==null&&xe!==void 0?xe:tn.current,Dt=new MutationObserver(oe=>{oe.forEach(ie=>{var Re;if(!ke||ie.type!=="attributes"||!(!((Re=ie.attributeName)===null||Re===void 0)&&Re.startsWith("data-tooltip-")))return;const Me=Ze(ke);Pt(Me)})}),H={attributes:!0,childList:!1,subtree:!1};if(ke){const oe=Ze(ke);Pt(oe),Dt.observe(ke,H)}return()=>{Dt.disconnect()}},[At,tn,Se,t,n]),g.useEffect(()=>{U!=null&&U.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),fe&&!hs("border",`${fe}`)&&console.warn(`[react-tooltip] "${fe}" is not a valid \`border\`.`),U!=null&&U.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),S&&!hs("opacity",`${S}`)&&console.warn(`[react-tooltip] "${S}" is not a valid \`opacity\`.`)},[]);let Vt=m;const nn=g.useRef(null);if(o){const xe=o({content:(Se==null?void 0:Se.getAttribute("data-tooltip-content"))||K||null,activeAnchor:Se});Vt=xe?g.createElement("div",{ref:nn,className:"react-tooltip-content-wrapper"},xe):null}else K&&(Vt=K);B&&(Vt=g.createElement(fh,{content:B}));const Ht={forwardRef:G,id:e,anchorId:t,anchorSelect:n,className:st(s,Kt),classNameArrow:a,content:Vt,contentWrapperRef:nn,place:A,variant:$,offset:De,wrapper:Ke,events:Ee,openOnClick:y,positionStrategy:Xe,middlewares:w,delayShow:je,delayHide:gt,float:nt,hidden:yt,noArrow:_,clickable:E,closeOnEsc:L,closeOnScroll:T,closeOnResize:J,openEvents:q,closeEvents:z,globalCloseEvents:Y,imperativeModeOnly:ee,style:U,position:se,isOpen:ne,defaultIsOpen:Q,border:fe,opacity:S,arrowColor:P,setIsOpen:k,afterShow:j,afterHide:D,disableTooltip:R,activeAnchor:Se,setActiveAnchor:xe=>Rt(xe),role:X};return g.createElement(ph,{...Ht})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||fs({css:":root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}",type:"core"}),e.detail.disableBase||fs({css:`
49
+ .styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})});function hh(){return u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[u.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[u.jsx("path",{d:"M8.00032 11.167L8.00032 7.83366M8.00032 1.83366C4.33366 1.83366 1.33366 4.83366 1.33366 8.50033C1.33366 12.167 4.33366 15.167 8.00033 15.167C11.667 15.167 14.667 12.167 14.667 8.50033C14.667 4.83366 11.667 1.83366 8.00032 1.83366Z",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),u.jsx("defs",{children:u.jsx("clipPath",{id:"clip0_2896_16290",children:u.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function gh({id:e,tooltipText:t}){return u.jsxs(u.Fragment,{children:[u.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:hh()}),u.jsx(mh,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}const ac=g.createContext(null);function cc(){const e=g.useContext(ac);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const lc=g.createContext(()=>{});function vh(){const e=g.useContext(lc);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var uc=Symbol.for("immer-nothing"),Is=Symbol.for("immer-draftable"),lt=Symbol.for("immer-state"),yh=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function tt(e,...t){if(process.env.NODE_ENV!=="production"){const n=yh[e],r=typeof n=="function"?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Tn=Object.getPrototypeOf;function Rn(e){return!!e&&!!e[lt]}function gn(e){var t;return e?dc(e)||Array.isArray(e)||!!e[Is]||!!((t=e.constructor)!=null&&t[Is])||Wr(e)||Jr(e):!1}var Ih=Object.prototype.constructor.toString();function dc(e){if(!e||typeof e!="object")return!1;const t=Tn(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===Ih}function Dr(e,t){qr(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function qr(e){const t=e[lt];return t?t.type_:Array.isArray(e)?1:Wr(e)?2:Jr(e)?3:0}function Ro(e,t){return qr(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function pc(e,t,n){const r=qr(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function wh(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Wr(e){return e instanceof Map}function Jr(e){return e instanceof Set}function ln(e){return e.copy_||e.base_}function Ao(e,t){if(Wr(e))return new Map(e);if(Jr(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=dc(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[lt];let i=Reflect.ownKeys(r);for(let o=0;o<i.length;o++){const s=i[o],a=r[s];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(r[s]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[s]})}return Object.create(Tn(e),r)}else{const r=Tn(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function fi(e,t=!1){return zr(e)||Rn(e)||!gn(e)||(qr(e)>1&&(e.set=e.add=e.clear=e.delete=_h),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>fi(r,!0))),e}function _h(){tt(2)}function zr(e){return Object.isFrozen(e)}var bh={};function vn(e){const t=bh[e];return t||tt(0,e),t}var Wn;function fc(){return Wn}function xh(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function ws(e,t){t&&(vn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Po(e){Do(e),e.drafts_.forEach(Ch),e.drafts_=null}function Do(e){e===Wn&&(Wn=e.parent_)}function _s(e){return Wn=xh(Wn,e)}function Ch(e){const t=e[lt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function bs(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[lt].modified_&&(Po(t),tt(4)),gn(e)&&(e=jr(t,e),t.parent_||Fr(t,e)),t.patches_&&vn("Patches").generateReplacementPatches_(n[lt].base_,e,t.patches_,t.inversePatches_)):e=jr(t,n,[]),Po(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==uc?e:void 0}function jr(e,t,n){if(zr(t))return t;const r=t[lt];if(!r)return Dr(t,(i,o)=>xs(e,r,t,i,o,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Fr(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const i=r.copy_;let o=i,s=!1;r.type_===3&&(o=new Set(i),i.clear(),s=!0),Dr(o,(a,c)=>xs(e,r,i,a,c,n,s)),Fr(e,i,!1),n&&e.patches_&&vn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function xs(e,t,n,r,i,o,s){if(process.env.NODE_ENV!=="production"&&i===n&&tt(5),Rn(i)){const a=o&&t&&t.type_!==3&&!Ro(t.assigned_,r)?o.concat(r):void 0,c=jr(e,i,a);if(pc(n,r,c),Rn(c))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(gn(i)&&!zr(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;jr(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Fr(e,i)}}function Fr(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&fi(t,n)}function Oh(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:fc(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=mi;n&&(i=[r],o=Jn);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,a}var mi={get(e,t){if(t===lt)return e;const n=ln(e);if(!Ro(n,t))return Eh(e,n,t);const r=n[t];return e.finalized_||!gn(r)?r:r===mo(e.base_,t)?(ho(e),e.copy_[t]=Fo(r,e)):r},has(e,t){return t in ln(e)},ownKeys(e){return Reflect.ownKeys(ln(e))},set(e,t,n){const r=mc(ln(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=mo(ln(e),t),o=i==null?void 0:i[lt];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(wh(n,i)&&(n!==void 0||Ro(e.base_,t)))return!0;ho(e),jo(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return mo(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,ho(e),jo(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=ln(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){tt(11)},getPrototypeOf(e){return Tn(e.base_)},setPrototypeOf(){tt(12)}},Jn={};Dr(mi,(e,t)=>{Jn[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Jn.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&tt(13),Jn.set.call(this,e,t,void 0)};Jn.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&tt(14),mi.set.call(this,e[0],t,n,e[0])};function mo(e,t){const n=e[lt];return(n?ln(n):e)[t]}function Eh(e,t,n){var i;const r=mc(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function mc(e,t){if(!(t in e))return;let n=Tn(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Tn(n)}}function jo(e){e.modified_||(e.modified_=!0,e.parent_&&jo(e.parent_))}function ho(e){e.copy_||(e.copy_=Ao(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Sh=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const o=n;n=t;const s=this;return function(c=o,...l){return s.produce(c,d=>n.call(this,d,...l))}}typeof n!="function"&&tt(6),r!==void 0&&typeof r!="function"&&tt(7);let i;if(gn(t)){const o=_s(this),s=Fo(t,void 0);let a=!0;try{i=n(s),a=!1}finally{a?Po(o):Do(o)}return ws(o,r),bs(i,o)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===uc&&(i=void 0),this.autoFreeze_&&fi(i,!0),r){const o=[],s=[];vn("Patches").generateReplacementPatches_(t,i,o,s),r(o,s)}return i}else tt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,c=>t(c,...a));let r,i;return[this.produce(t,n,(s,a)=>{r=s,i=a}),r,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){gn(e)||tt(8),Rn(e)&&(e=Nh(e));const t=_s(this),n=Fo(e,void 0);return n[lt].isManual_=!0,Do(t),n}finishDraft(e,t){const n=e&&e[lt];(!n||!n.isManual_)&&tt(9);const{scope_:r}=n;return ws(r,t),bs(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=vn("Patches").applyPatches_;return Rn(e)?r(e,t):this.produce(e,i=>r(i,t))}};function Fo(e,t){const n=Wr(e)?vn("MapSet").proxyMap_(e,t):Jr(e)?vn("MapSet").proxySet_(e,t):Oh(e,t);return(t?t.scope_:fc()).drafts_.push(n),n}function Nh(e){return Rn(e)||tt(10,e),hc(e)}function hc(e){if(!gn(e)||zr(e))return e;const t=e[lt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ao(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Ao(e,!0);return Dr(n,(r,i)=>{pc(n,r,hc(i))}),t&&(t.finalized_=!1),n}var ut=new Sh,Kn=ut.produce;ut.produceWithPatches.bind(ut);ut.setAutoFreeze.bind(ut);ut.setUseStrictShallowCopy.bind(ut);ut.applyPatches.bind(ut);ut.createDraft.bind(ut);ut.finishDraft.bind(ut);const gc=g.createContext(void 0),Th={};function hi(){const e=g.useContext(gc);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function Rh({children:e}){const{installation:t}=dt(),{hydratedRevision:n,loading:r}=Dn(),[i,o]=g.useState(Th),s=t==null?void 0:t.config;g.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(i).length>0)&&Qp(n,s,o)},[n,r,s,i]);const a=g.useCallback((p,y)=>{o(I=>Kn(I,w=>{w[p]=Kn(w[p],y)}))},[o]),c=g.useCallback((p,y)=>{o(I=>Kn(I,w=>{w[p]=y}))},[o]),l=g.useCallback(()=>{o(Kn(p=>{const y=p.other.write;y&&(y.isWriteModified=!1)}))},[o]),d=g.useCallback(p=>{o(Kn(y=>{var w;const I=(w=y[p])==null?void 0:w.read;I&&(I.isOptionalFieldsModified=!1,I.isRequiredMapFieldsModified=!1)}))},[o]),f=g.useCallback(p=>{p===fn?l():d(p)},[d,l]),m=g.useMemo(()=>({objectConfigurationsState:i,setObjectConfigurationsState:o,setConfigureState:a,resetConfigureState:c,resetPendingConfigurationState:f}),[i,c,f,a]);return u.jsx(gc.Provider,{value:m,children:e})}const In=()=>{const{appName:e}=Pe(),{objectConfigurationsState:t,setConfigureState:n}=hi(),{selectedObjectName:r}=cc(),i=ca(r||"",t);return{appName:e,configureState:i,setConfigureState:n,selectedObjectName:r}};function Ah(e,t,n){var i;const r=((i=e==null?void 0:e.read)==null?void 0:i.selectedFieldMappings)||{};if(r[t]=n,e!=null&&e.read){const o=e.read.savedConfig.requiredMapFields,a=!Ho(o,r);e.read.isRequiredMapFieldsModified=a}}function vc(e,t,n,r){t(e,i=>Ah(i,n,r))}function yc({field:e,onSelectChange:t,allFields:n}){var m;const{configureState:r,selectedObjectName:i,setConfigureState:o}=In(),[s,a]=g.useState(!0),c=(m=r==null?void 0:r.read)==null?void 0:m.selectedFieldMappings,l=c==null?void 0:c[e.mapToName];g.useEffect(()=>{e._default&&!l&&i&&r&&vc(i,o,e.mapToName,e._default),a(!1)},[e,o,i,l,r]);const d=g.useMemo(()=>n.map(p=>({id:p.fieldName,label:p.displayName,value:p.fieldName})),[n]),f=u.jsx(xm,{disabled:s,items:d,selectedValue:l||null,onSelectedItemChange:p=>{t({target:{name:e.mapToName,value:p==null?void 0:p.value}})},placeholder:"Please select one"});return u.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[u.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[u.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName}),u.jsx("span",{children:(e==null?void 0:e.prompt)&&u.jsx(gh,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),f]},e.mapToName)}const Ph="_formControl_9qd8d_1",Dh="_formLabel_9qd8d_5",jh="_formLabelRequired_9qd8d_11",Fh="_formInput_9qd8d_16",kh="_formInputInvalid_9qd8d_20",Mh="_formError_9qd8d_24",Lh="_disabled_9qd8d_30",cn={formControl:Ph,formLabel:Dh,formLabelRequired:jh,formInput:Fh,formInputInvalid:kh,formError:Mh,disabled:Lh};function Kh({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:i=!1,errorMessage:o,children:s}){return u.jsxs("div",{className:st(cn.formControl,{[cn.disabled]:r}),children:[t&&u.jsx("label",{htmlFor:e,className:st(cn.formLabel,{[cn.formLabelRequired]:n}),children:t}),u.jsx("div",{id:e,className:st(cn.formInput,{[cn.formInputInvalid]:i}),children:s}),i&&o&&u.jsx("div",{className:cn.formError,role:"alert",children:o})]})}const $h="_divider_1kmoj_1",Cs={divider:$h};function gi({className:e,style:t}){return u.jsx("hr",{className:e?`${Cs.divider} ${e}`:Cs.divider,style:t})}function Xr({string:e}){return u.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[u.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),u.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:u.jsx(gi,{style:{width:"100%",marginLeft:"1rem"}})})]})}function Vh(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=In(),{fieldMapping:r}=dt(),{isError:i,removeError:o}=Yt(),s=c=>{const{value:l,name:d}=c.target;l&&(e&&vc(e,n,d,l),i(Ce.MAPPING,d)&&o(Ce.MAPPING,d))},a=g.useMemo(()=>{var f;const c=((f=t==null?void 0:t.read)==null?void 0:f.requiredMapFields)||[],l=e&&r?Object.values(r[e]||{}).flat():[];return c.concat(l).reduce((m,p)=>m.find(I=>I.mapToName===p.mapToName)?m.map(I=>I.mapToName===p.mapToName?p:I):m.concat(p),new Array).filter(zt)},[t,r,e]);return a!=null&&a.length?u.jsxs(u.Fragment,{children:[u.jsx(Xr,{string:"Map the following fields"}),u.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:a.map(c=>{var l;return u.jsx(Kh,{id:c.mapToName,isInvalid:i(Ce.MAPPING,c.mapToName),errorMessage:"* required",children:u.jsx(yc,{allFields:((l=t==null?void 0:t.read)==null?void 0:l.allFields)||[],field:c,onSelectChange:s})},c.mapToName)})})]}):null}const Hh={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function Uh({children:e,style:t}){return u.jsx(Zt,{style:{...Hh,...t},children:e})}function Bh(){var d,f,m;const{project:e}=Pe(),{hydratedRevision:t}=Dn(),{selectedObjectName:n}=In(),{provider:r}=dt(),i=e==null?void 0:e.appName,o=Qt(r),s=(m=(f=(d=t==null?void 0:t.content)==null?void 0:d.read)==null?void 0:f.objects)==null?void 0:m.find(p=>p.objectName===n),a=(s==null?void 0:s.displayName)||n&&Bn(n),c=s==null?void 0:s.mapToName,l=(s==null?void 0:s.mapToDisplayName)||c&&Bn(c);return l&&i&&o?u.jsx(Uh,{style:{marginTop:"1rem"},children:u.jsxs("p",{style:{margin:"1rem 0"},children:[u.jsx("b",{children:l})," in ",i," is mapped to ",u.jsx("b",{children:a})," in ",o,"."]})}):null}function Os(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ic(...e){return t=>{let n=!1;const r=e.map(i=>{const o=Os(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i<r.length;i++){const o=r[i];typeof o=="function"?o():Os(e[i],null)}}}}function zn(...e){return V.useCallback(Ic(...e),e)}function Gr(e,t=[]){let n=[];function r(o,s){const a=V.createContext(s),c=n.length;n=[...n,s];const l=f=>{var C;const{scope:m,children:p,...y}=f,I=((C=m==null?void 0:m[e])==null?void 0:C[c])||a,w=V.useMemo(()=>y,Object.values(y));return u.jsx(I.Provider,{value:w,children:p})};l.displayName=o+"Provider";function d(f,m){var I;const p=((I=m==null?void 0:m[e])==null?void 0:I[c])||a,y=V.useContext(p);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[l,d]}const i=()=>{const o=n.map(s=>V.createContext(s));return function(a){const c=(a==null?void 0:a[e])||o;return V.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[r,qh(i,...t)]}function qh(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:c,scopeName:l})=>{const f=c(o)[`__scope${l}`];return{...a,...f}},{});return V.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function xt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function vi(e){const t=V.useRef(e);return V.useEffect(()=>{t.current=e}),V.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function yi({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=Wh({defaultProp:t,onChange:n}),o=e!==void 0,s=o?e:r,a=vi(n),c=V.useCallback(l=>{if(o){const f=typeof l=="function"?l(e):l;f!==e&&a(f)}else i(l)},[o,e,i,a]);return[s,c]}function Wh({defaultProp:e,onChange:t}){const n=V.useState(e),[r]=n,i=V.useRef(r),o=vi(t);return V.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}function Jh(e){const t=V.useRef({value:e,previous:e});return V.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var kr=globalThis!=null&&globalThis.document?V.useLayoutEffect:()=>{};function zh(e){const[t,n]=V.useState(void 0);return kr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,a;if("borderBoxSize"in o){const c=o.borderBoxSize,l=Array.isArray(c)?c[0]:c;s=l.inlineSize,a=l.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function Xh(e,t){return V.useReducer((n,r)=>t[n][r]??n,e)}var Ii=e=>{const{present:t,children:n}=e,r=Gh(t),i=typeof n=="function"?n({present:r.isPresent}):V.Children.only(n),o=zn(r.ref,Yh(i));return typeof n=="function"||r.isPresent?V.cloneElement(i,{ref:o}):null};Ii.displayName="Presence";function Gh(e){const[t,n]=V.useState(),r=V.useRef({}),i=V.useRef(e),o=V.useRef("none"),s=e?"mounted":"unmounted",[a,c]=Xh(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return V.useEffect(()=>{const l=yr(r.current);o.current=a==="mounted"?l:"none"},[a]),kr(()=>{const l=r.current,d=i.current;if(d!==e){const m=o.current,p=yr(l);e?c("MOUNT"):p==="none"||(l==null?void 0:l.display)==="none"?c("UNMOUNT"):c(d&&m!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),kr(()=>{if(t){let l;const d=t.ownerDocument.defaultView??window,f=p=>{const I=yr(r.current).includes(p.animationName);if(p.target===t&&I&&(c("ANIMATION_END"),!i.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",l=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},m=p=>{p.target===t&&(o.current=yr(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(l),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:V.useCallback(l=>{l&&(r.current=getComputedStyle(l)),n(l)},[])}}function yr(e){return(e==null?void 0:e.animationName)||"none"}function Yh(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Mr=V.forwardRef((e,t)=>{const{children:n,...r}=e,i=V.Children.toArray(n),o=i.find(Qh);if(o){const s=o.props.children,a=i.map(c=>c===o?V.Children.count(s)>1?V.Children.only(null):V.isValidElement(s)?s.props.children:null:c);return u.jsx(ko,{...r,ref:t,children:V.isValidElement(s)?V.cloneElement(s,void 0,a):null})}return u.jsx(ko,{...r,ref:t,children:n})});Mr.displayName="Slot";var ko=V.forwardRef((e,t)=>{const{children:n,...r}=e;if(V.isValidElement(n)){const i=tg(n);return V.cloneElement(n,{...eg(r,n.props),ref:t?Ic(t,i):i})}return V.Children.count(n)>1?V.Children.only(null):null});ko.displayName="SlotClone";var Zh=({children:e})=>u.jsx(u.Fragment,{children:e});function Qh(e){return V.isValidElement(e)&&e.type===Zh}function eg(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{o(...a),i(...a)}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function tg(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ng=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],en=ng.reduce((e,t)=>{const n=V.forwardRef((r,i)=>{const{asChild:o,...s}=r,a=o?Mr:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(a,{...s,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),wi="Checkbox",[rg,yy]=Gr(wi),[og,ig]=rg(wi),wc=V.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:s,disabled:a,value:c="on",onCheckedChange:l,form:d,...f}=e,[m,p]=V.useState(null),y=zn(t,b=>p(b)),I=V.useRef(!1),w=m?d||!!m.closest("form"):!0,[C=!1,v]=yi({prop:i,defaultProp:o,onChange:l}),x=V.useRef(C);return V.useEffect(()=>{const b=m==null?void 0:m.form;if(b){const _=()=>v(x.current);return b.addEventListener("reset",_),()=>b.removeEventListener("reset",_)}},[m,v]),u.jsxs(og,{scope:n,state:C,disabled:a,children:[u.jsx(en.button,{type:"button",role:"checkbox","aria-checked":Jt(C)?"mixed":C,"aria-required":s,"data-state":xc(C),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:y,onKeyDown:xt(e.onKeyDown,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:xt(e.onClick,b=>{v(_=>Jt(_)?!0:!_),w&&(I.current=b.isPropagationStopped(),I.current||b.stopPropagation())})}),w&&u.jsx(sg,{control:m,bubbles:!I.current,name:r,value:c,checked:C,required:s,disabled:a,form:d,style:{transform:"translateX(-100%)"},defaultChecked:Jt(o)?!1:o})]})});wc.displayName=wi;var _c="CheckboxIndicator",bc=V.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=ig(_c,n);return u.jsx(Ii,{present:r||Jt(o.state)||o.state===!0,children:u.jsx(en.span,{"data-state":xc(o.state),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});bc.displayName=_c;var sg=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:i,...o}=e,s=V.useRef(null),a=Jh(n),c=zh(t);V.useEffect(()=>{const d=s.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(a!==n&&p){const y=new Event("click",{bubbles:r});d.indeterminate=Jt(n),p.call(d,Jt(n)?!1:n),d.dispatchEvent(y)}},[a,n,r]);const l=V.useRef(Jt(n)?!1:n);return u.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??l.current,...o,tabIndex:-1,ref:s,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Jt(e){return e==="indeterminate"}function xc(e){return Jt(e)?"indeterminate":e?"checked":"unchecked"}var Cc=wc,Oc=bc;function Ec(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var ag=["color"],Sc=g.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Ec(e,ag);return g.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),g.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),cg=["color"],lg=g.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Ec(e,cg);return g.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),g.createElement("path",{d:"M2 7.5C2 7.22386 2.22386 7 2.5 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H2.5C2.22386 8 2 7.77614 2 7.5Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const ug="_checkboxGroupContainer_1ya1t_1",dg="_stack_1ya1t_6",pg="_selectAllContainer_1ya1t_11",fg="_fieldContainer_1ya1t_18",mg="_checkbox_1ya1t_1",An={checkboxGroupContainer:ug,stack:dg,selectAllContainer:pg,fieldContainer:fg,checkbox:mg};function Nc({id:e,isChecked:t,label:n,onCheckedChange:r}){return u.jsxs("div",{className:An.fieldContainer,children:[u.jsx(Cc,{className:An.checkbox,id:e,onCheckedChange:r,checked:t,children:u.jsx(Oc,{children:u.jsx(Sc,{})})}),u.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function Tc({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:i}){return u.jsxs("div",{className:An.selectAllContainer,children:[u.jsx(Cc,{className:An.checkbox,id:e,onCheckedChange:r,children:u.jsxs(Oc,{children:[i&&u.jsx(lg,{}),t===!0&&u.jsx(Sc,{})]})}),u.jsx("label",{htmlFor:e,children:n})]})}function Rc({children:e}){return u.jsx("div",{className:An.checkboxGroupContainer,children:e})}function Ac({children:e}){return u.jsx("div",{className:An.stack,children:e})}function hg(e,t,n){var i,o;const r=((i=e==null?void 0:e.read)==null?void 0:i.selectedOptionalFields)||{};if(r[t]=n,n||delete r[t],(o=e.read)!=null&&o.savedConfig.optionalFields){const s=e.read.savedConfig.optionalFields,c=!Ho(s,r);e.read.isOptionalFieldsModified=c}else console.warn("read.savedConfig.optionalFields is undefined")}function Es(e,t,n,r){t(e,i=>hg(i,n,r))}function gg(){var f,m;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=In(),i=(f=t==null?void 0:t.read)==null?void 0:f.selectedOptionalFields,o=(p,y)=>{p!=="indeterminate"&&r&&t&&Es(r,n,y,p)},s=(m=t==null?void 0:t.read)==null?void 0:m.optionalFields,a=p=>{r&&s&&s.forEach(y=>{zt(y)||Es(r,n,y.fieldName,p)})},c=!!(s&&s.length>0),l=Object.keys(i||{}).length===(s==null?void 0:s.length),d=!l&&Object.keys(i||{}).length>0;return c&&u.jsxs(u.Fragment,{children:[u.jsx(Xr,{string:`${e} reads the following optional fields`}),u.jsxs(Rc,{children:[((s==null?void 0:s.length)||0)>=2&&u.jsx(Tc,{id:"select-all-fields",isChecked:l,label:"Select all",onCheckedChange:a,isIndeterminate:d}),u.jsx(Ac,{children:s.map(p=>zt(p)?null:u.jsx(Nc,{id:p.fieldName,isChecked:!!(i!=null&&i[p==null?void 0:p.fieldName]),label:p.displayName,onCheckedChange:y=>o(y,p.fieldName)},p.fieldName))})]})]})}function vg(){return u.jsx(gg,{})}const yg={color:"var(--amp-colors-text-regular)",backgroundColor:"var(--amp-colors-bg-highlight)",borderRadius:"4px",display:"inline-block",fontSize:"0.75rem",fontWeight:500,lineHeight:"1.25",padding:"0.25rem 0.5rem"};function Ig({children:e,style:t,...n}){return u.jsx("span",{style:{...yg,...t},...n,children:e})}function wg(){var r,i,o;const{configureState:e,selectedObjectName:t}=In(),{appName:n}=Pe();return u.jsxs(u.Fragment,{children:[u.jsx(Xr,{string:`${n} reads the following ${t} fields`}),u.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:(i=(r=e==null?void 0:e.read)==null?void 0:r.requiredFields)!=null&&i.length?(o=e.read)==null?void 0:o.requiredFields.map(s=>zt(s)?null:u.jsx(Ig,{children:s.displayName},s.fieldName)):"There are no required fields."})]})}function _g(){return u.jsxs(u.Fragment,{children:[u.jsx(Bh,{}),u.jsx(wg,{}),u.jsx(Vh,{}),u.jsx(vg,{})]})}function bg(e,t,n){var r,i,o;if(((r=e==null?void 0:e.write)==null?void 0:r.selectedNonConfigurableWriteFields)===null&&(e.write.selectedNonConfigurableWriteFields={}),e!=null&&e.write){const s=e.write.selectedNonConfigurableWriteFields;if(s[t]=n,n||delete s[t],(o=(i=e==null?void 0:e.write)==null?void 0:i.savedConfig)!=null&&o.selectedNonConfigurableWriteFields){const a=e.write.savedConfig.selectedNonConfigurableWriteFields,l=!Ho(a,s);e.write.isWriteModified=l}}}function Ss(e,t,n,r){t(e,i=>{bg(i,n,r)})}function xg(){var f,m,p,y;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=In(),i=(f=n==null?void 0:n.write)==null?void 0:f.selectedNonConfigurableWriteFields,o=(m=n==null?void 0:n.write)==null?void 0:m.writeObjects,s=(I,w)=>{I!=="indeterminate"&&t&&n&&Ss(t,r,w,I)},a=I=>{var w,C;t&&n&&((C=(w=n==null?void 0:n.write)==null?void 0:w.writeObjects)==null||C.forEach(v=>{Ss(t,r,v.objectName,I)}))},c=!!o,l=Object.keys(i||{}).length===((y=(p=n==null?void 0:n.write)==null?void 0:p.writeObjects)==null?void 0:y.length),d=!l&&Object.keys(i||{}).length>0;return c&&u.jsxs(u.Fragment,{children:[u.jsx(Xr,{string:`Allow ${e} to write to these objects`}),u.jsxs(Rc,{children:[((o==null?void 0:o.length)||0)>=2&&u.jsx(Tc,{id:"select-all-fields",onCheckedChange:a,isIndeterminate:d,isChecked:l,label:"Select all"}),u.jsx(Ac,{children:o.map(I=>u.jsx(Nc,{id:I.objectName,onCheckedChange:w=>s(w,I.objectName),isChecked:!!(i!=null&&i[I.objectName]),label:I.displayName},I.objectName))})]})]})}function Cg(){return u.jsx(xg,{})}function Pc({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const r=He(),{projectId:i}=Pe(),{integrationId:o,installation:s,resetInstallations:a,setIntegrationDeleted:c,onUninstallSuccess:l}=dt(),[d,f]=g.useState(!1),m=!i||!o||!(s!=null&&s.id)||d,p=async()=>{if(!m){f(!0),console.warn("uninstalling installation",{projectId:i,integrationId:o,installationId:s.id});try{await Oe().installationApi.deleteInstallation({projectIdOrName:i,integrationId:o,installationId:s.id},{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}),console.warn("successfully uninstalled installation:",s.id),l==null||l(s==null?void 0:s.id),a(),c()}catch(w){console.error("Error uninstalling installation."),ze(w)}finally{f(!1)}}},y=d?"Uninstalling...":e,I=u.jsx(ct,{type:"button",onClick:p,disabled:m,variant:t,style:n,children:y});return s!=null&&s.id?I:null}function Og(){const{appName:e}=Pe(),{installation:t}=dt();return u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[t!=null&&t.id?u.jsxs("p",{children:["Once you uninstall this integration, all your configuration will be lost, and"," ",u.jsx("b",{children:e})," may stop working."]}):u.jsx("p",{children:"You've successfully uninstalled the integration."}),u.jsx(Pc,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})}function Dc({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:i}){var E,L,T;const{installation:o}=dt(),{hydratedRevision:s,loading:a}=Dn(),{configureState:c,selectedObjectName:l}=In(),d=o==null?void 0:o.config,f=d&&l&&!!ea(d,l)||!1,m=((E=c==null?void 0:c.read)==null?void 0:E.isOptionalFieldsModified)||((L=c==null?void 0:c.read)==null?void 0:L.isRequiredMapFieldsModified),p=(T=c==null?void 0:c.write)==null?void 0:T.isWriteModified,C=a||n||!c||!l||!(m||p||r||l!==fn&&!f),v=l===fn,x=l===Or,b=u.jsx(ct,{type:"submit",disabled:C,children:r?"Install":"Save"}),_=u.jsx(ct,{type:"button",onClick:t,disabled:C,variant:"ghost",children:"Reset"});return n?u.jsx(Un,{}):u.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[u.jsxs("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px"},children:[b,_]}),u.jsxs(Zt,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[i&&u.jsx(ua,{children:typeof i=="string"?i:"Installation Failed."}),a&&u.jsx(Un,{}),s&&!x&&!v&&u.jsx(_g,{}),s&&!x&&v&&u.jsx(Cg,{}),!a&&x&&u.jsx(Og,{})]})]})}const jc=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:i,onUpdateSuccess:o}=dt(),{hydratedRevision:s,loading:a}=Dn(),{selectedObjectName:c}=cc(),{selectedConnection:l}=yn(),d=He(),{projectId:f}=Pe(),{resetBoundary:m,setErrors:p,setError:y,getError:I}=Yt(),{resetConfigureState:w,objectConfigurationsState:C,resetPendingConfigurationState:v}=hi(),x=ca(c||"",C),{onNextIncompleteTab:b}=vh(),_=g.useCallback(()=>{m(Ce.INSTALLATION_MUTATION)},[m]),E=g.useCallback(T=>T?J=>{y(Ce.INSTALLATION_MUTATION,T,J)}:J=>{console.error("objectName is required to set installation error: ",J)},[y]),L=g.useCallback(T=>T?I(Ce.INSTALLATION_MUTATION,T):"",[I]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:c,selectedConnection:l,apiKey:d,projectId:f,resetBoundary:m,setErrors:p,setMutateInstallationError:E,getMutateInstallationError:L,resetMutateInstallationErrorState:_,resetConfigureState:w,objectConfigurationsState:C,resetPendingConfigurationState:v,configureState:x,onInstallSuccess:i,onUpdateSuccess:o,onNextIncompleteTab:b}},Eg=void 0;function Sg(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:i,loading:o,selectedObjectName:s,selectedConnection:a,apiKey:c,projectId:l,resetBoundary:d,setErrors:f,setMutateInstallationError:m,getMutateInstallationError:p,resetMutateInstallationErrorState:y,resetConfigureState:I,objectConfigurationsState:w,resetPendingConfigurationState:C,configureState:v,onInstallSuccess:x,onNextIncompleteTab:b}=jc(),[_,E]=g.useState(!1),L=s===fn,T=p(s),J=g.useCallback(()=>{d(Ce.MAPPING),i!=null&&i.content&&!o&&s&&ia(i,Eg,s,I)},[d,i,o,s,I]);g.useEffect(()=>{!v&&(i!=null&&i.content)&&!o&&J()},[v,w,i,o,J]);const q=()=>{y();const{requiredMapFields:ee,selectedFieldMappings:U}=(v==null?void 0:v.read)||{},{errorList:se}=ra(ee,U,f);se.length>0||(s&&(a!=null&&a.id)&&c&&l&&e&&t&&n&&i?(E(!0),nf(l,e,t,n,a.id,s,c,i,v,m(s),r,x).finally(()=>{E(!1),C(s),b()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},z=()=>{y(),s&&(a!=null&&a.id)&&c&&l&&e&&t&&n&&i?(E(!0),sf(l,e,t,n,a.id,c,i,v,m(s),r,x).finally(()=>{E(!1),C(s),b()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},Y=ee=>{ee.preventDefault(),L?z():q()};return u.jsx(Dc,{errorMsg:T,isCreateMode:!0,isLoading:_,onSave:Y,onReset:J})}function Ng({updateConfig:e,projectId:t,integrationId:n,installationId:r,apiKey:i,selectedObjectName:o,setInstallation:s,onUpdateSuccess:a,setError:c}){const l={projectIdOrName:t,installationId:r,integrationId:n,installationUpdate:{updateMask:[`config.content.read.objects.${o}`],installation:{config:e}}};return Oe().installationApi.updateInstallation(l,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}}).then(d=>{s(d),a==null||a(d.id,d.config)}).catch(d=>{ze(d,c)})}const Tg=(e,t,n,r,i,o)=>{const s=sa(e),a=aa(e),c={content:{read:{objects:{[t]:{objectName:t,schedule:r,destination:(n==null?void 0:n.destination)||"",selectedFields:s,selectedFieldMappings:a,backfill:o}}}}};return $r(i)&&(c.content||(c.content={}),c.content.proxy={enabled:!0}),c},Rg=(e,t,n,r,i,o,s,a,c,l,d)=>{const f=Tg(o,r||"",a,a.schedule,c,a.backfill);return f?Ng({updateConfig:f,projectId:e,integrationId:t,installationId:n,apiKey:i,selectedObjectName:r,setError:l,setInstallation:s,onUpdateSuccess:d}):(console.error("Error when generating updateConfig from configureState"),Promise.resolve(null))},Ag=(e,t)=>{const r={content:{write:{objects:la(e)}}};return $r(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},Pg=(e,t,n,r,i,o,s,a,c)=>{const l=Ag(i,o);if(!l)return console.error("Error when generating write updateConfig from configureState"),Promise.resolve(null);const d={projectIdOrName:e,installationId:n,integrationId:t,installationUpdate:{updateMask:["config.content.write.objects"],installation:{config:l}}};return Oe().installationApi.updateInstallation(d,{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}).then(f=>{a(f),c==null||c(f.id,f.config)}).catch(f=>{ze(f,s)})};function Dg({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:r,loading:i,selectedObjectName:o,apiKey:s,projectId:a,resetBoundary:c,setErrors:l,setMutateInstallationError:d,getMutateInstallationError:f,resetConfigureState:m,resetPendingConfigurationState:p,configureState:y,onUpdateSuccess:I,onNextIncompleteTab:w}=jc(),[C,v]=g.useState(!1),x=o===fn,b=f(o),{config:_}=e,E=g.useCallback(()=>{c(Ce.MAPPING),r!=null&&r.content&&!i&&o&&ia(r,_,o,m)},[c,r,i,o,_,m]);g.useEffect(()=>{y||E()},[y,E]),g.useEffect(()=>{e&&E()},[e,E]);const L=g.useMemo(()=>{var Y,ee,U;return(U=(ee=(Y=r==null?void 0:r.content)==null?void 0:Y.read)==null?void 0:ee.objects)==null?void 0:U.find(se=>(se==null?void 0:se.objectName)===o)},[r,o]),T=()=>{const{requiredMapFields:z,selectedFieldMappings:Y}=(y==null?void 0:y.read)||{},{errorList:ee}=ra(z,Y,l);ee.length>0||(r&&e&&o&&s&&a&&L?(v(!0),Rg(a,t.id,e.id,o,s,y,n,L,r,d(o),I).finally(()=>{v(!1),p(o),w()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},J=()=>{e&&o&&s&&a&&r?(v(!0),Pg(a,t.id,e.id,s,y,r,d(o),n,I).finally(()=>{v(!1),p(o),w()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},q=z=>{z.preventDefault(),x?J():T()};return u.jsx(Dc,{errorMsg:b,onSave:q,onReset:E,isLoading:C})}function jg(){const{integrationObj:e,installation:t}=dt();return e?t&&e?u.jsx(Dg,{installation:t,integrationObj:e}):u.jsx(Sg,{}):u.jsx(Ws,{message:"We can't load the integration"})}function Fg(){return u.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),u.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function _i({text:e,children:t}){return u.jsx(Pn,{children:u.jsxs(Zt,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[u.jsx(Fg,{}),u.jsx("p",{children:e}),t]})})}const kg=(e,t)=>({revisionId:e.id,createdBy:`consumer:${t}`,content:{provider:e.content.provider,proxy:{enabled:!0}}});function Mg({projectId:e,integrationId:t,groupRef:n,consumerRef:r,connectionId:i,apiKey:o,hydratedRevision:s,setError:a,setInstallation:c,onInstallSuccess:l}){const d=kg(s,r);return d?Uo({createConfig:d,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:o,setError:a,setInstallation:c,onInstallSuccess:l}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))}function Lg({provider:e}){const t=`You have successfully installed your ${Qt(e)} integration.`;return u.jsx(_i,{text:t,children:u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:u.jsx(Pc,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const Kg=e=>{const{read:t,write:n,proxy:r}=(e==null?void 0:e.content)??{};return!t&&!n&&(r==null?void 0:r.enabled)||!1};function $g({children:e,resetComponent:t}){var b;const{projectId:n}=Pe(),r=He(),{hydratedRevision:i,loading:o}=Dn(),{integrationObj:s,installation:a,groupRef:c,consumerRef:l,setInstallation:d,onInstallSuccess:f,isIntegrationDeleted:m}=dt(),{selectedConnection:p}=yn(),[y,I]=g.useState(!1),w=o||y,C=(b=i==null?void 0:i.content)==null?void 0:b.provider,v=Kg(i),x=_=>{console.error("Error when creating proxy installation:",_)};return g.useEffect(()=>{!w&&i&&v&&!a&&p&&r&&(s!=null&&s.id)&&(I(!0),Mg({apiKey:r,projectId:n,integrationId:s==null?void 0:s.id,groupRef:c,consumerRef:l,connectionId:p==null?void 0:p.id,hydratedRevision:i,setError:x,setInstallation:d,onInstallSuccess:f}).then(()=>{I(!1)}).catch(_=>{I(!1),console.error("Error when creating proxy installation:",_)}))},[i,v,a,p,r,n,s==null?void 0:s.id,c,l,d,w,f]),m?u.jsx(_i,{text:"Integration successfully uninstalled.",children:u.jsx(ct,{type:"button",onClick:t,style:{width:"100%"},children:"Reinstall Integration"})}):s?w?u.jsx(Kr,{}):v&&C&&a?u.jsx(Lg,{provider:C}):u.jsx("div",{children:e}):u.jsx(Lt,{message:"We can't load the integration"})}function Fc(){return u.jsxs("footer",{style:{backgroundColor:"light-dark(#EFEFEF, #646266)",padding:"1em",fontSize:"0.8em",color:"gray",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"0 0 4px 4px",gap:"0.4em"},children:[u.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),u.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:u.jsx("img",{style:{height:".8em"},src:"https://ampersand-website.vercel.app/logo-black.svg",alt:"Ampersand"})})]})}function Qn({children:e}){return u.jsx(Pn,{children:u.jsxs(Zt,{children:[u.jsx("div",{style:{padding:"3rem 2rem"},children:e}),u.jsx(Fc,{})]})})}function er({children:e}){return u.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function tr({error:e}){return e?u.jsx(ua,{style:{marginTop:"2em"},children:e}):null}function bi({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,children:i,title:o}){if(!o&&!r)throw new Error("Either title or providerName is required");return u.jsxs(Qn,{children:[u.jsx(er,{children:o||`Set up ${r} integration`}),u.jsx(tr,{error:t}),i,u.jsx(ct,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}const Vg="_link_oo2kv_1",Hg={link:Vg};function kc({href:e,className:t,style:n,label:r,children:i,newTab:o=!1}){return u.jsx("a",{className:st(Hg.link,t),style:n,href:e,"aria-label":r||void 0,target:o?"_blank":"_self",rel:o?"noopener noreferrer":void 0,children:i})}function Mc({url:e,providerDisplayName:t,credentialName:n}){return u.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[u.jsx(kc,{href:e,newTab:!0,children:u.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," about where to find your ",t," ",n,"."]})}const Ug="_input_10rzg_1",Bg="_inputError_10rzg_27",qg="_error_10rzg_43",go={input:Ug,inputError:Bg,error:qg};function Wg({id:e,type:t,className:n,isError:r=!1,...i}){const o=r?st(go.inputError,go.input):go.input;return u.jsx("input",{id:e,type:t,className:st(o,n),...i})}const Jg="_textarea_18zl4_1",zg="_textareaError_18zl4_14",Xg="_error_18zl4_29",vo={textarea:Jg,textareaError:zg,error:Xg};function Gg({className:e,isError:t=!1,...n}){const r=t?st(vo.textareaError,vo.textarea):vo.textarea;return u.jsx("textarea",{className:st(e,r),...n})}const Mt={Input:Wg,Textarea:Gg};function Yg({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i}){var I;const[o,s]=g.useState(!1),a=()=>s(w=>!w),[c,l]=g.useState(""),d=w=>l(w.currentTarget.value),f=c.length>0,m=i||!f,p=Qt(e,t),y=(I=t.apiKeyOpts)==null?void 0:I.docsURL;return u.jsx(bi,{providerName:p,handleSubmit:()=>{n({apiKey:c})},error:r,isButtonDisabled:m,children:u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[y&&u.jsx(Mc,{url:y,providerDisplayName:p,credentialName:"API key"}),u.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[u.jsx(Mt.Input,{id:"password",name:"password",type:o?"text":"password",placeholder:"API Key",onChange:w=>d(w)}),u.jsx(ct,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:o?"Hide":"Show"})]})]})})}function Zg({...e}){return u.jsx(Yg,{...e})}function Qg({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,setSelectedConnection:c}){const l=Pe(),[d,f]=g.useState(!1),[m,p]=g.useState(null),y=He();g.useEffect(()=>{if(e&&Oe&&d&&m!=null){const w={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,apiKey:m};Oe().connectionApi.generateConnection({projectIdOrName:l.projectId,generateConnectionParams:w},{headers:{"X-Api-Key":y??"","Content-Type":"application/json"}}).then(C=>{c(C)}).catch(C=>{console.error("Error loading provider info."),ze(C)})}},[y,e,d,r,n,o,i,l,c,m]);const I=w=>{p(w.apiKey),f(!0)};return a===null?u.jsx(Zg,{provider:e,providerInfo:t,handleSubmit:I,error:null}):s}function ev({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i}){var C;const[o,s]=g.useState(!1),a=()=>s(v=>!v),[c,l]=g.useState({username:"",password:""}),{username:d,password:f}=c,m=Qt(e,t),p=(C=t.basicOpts)==null?void 0:C.docsURL,y=d.length>0,I=i||!y,w=v=>{const{name:x,value:b}=v.currentTarget;l(_=>({..._,[x]:b}))};return u.jsx(bi,{providerName:m,handleSubmit:()=>{n({user:d,pass:f})},error:r,isButtonDisabled:I,children:u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[p&&u.jsx(Mc,{url:p,providerDisplayName:m,credentialName:"credentials"}),u.jsx(Mt.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:v=>w(v)}),u.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[u.jsx(Mt.Input,{id:"password",name:"password",type:o?"text":"password",placeholder:"Password",onChange:v=>w(v)}),u.jsx(ct,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:o?"Hide":"Show"})]})]})})}function tv({...e}){return u.jsx(ev,{...e})}function nv({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,setSelectedConnection:c}){const l=Pe(),[d,f]=g.useState(!1),[m,p]=g.useState(null),y=He();g.useEffect(()=>{if(e&&Oe&&d&&m!=null){const w={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:m.user,password:m.pass}};Oe().connectionApi.generateConnection({projectIdOrName:l.projectId,generateConnectionParams:w},{headers:{"X-Api-Key":y??"","Content-Type":"application/json"}}).then(C=>{c(C)}).catch(C=>{console.error("Error loading provider info."),ze(C)})}},[y,e,d,r,n,o,i,l,m,c]);const I=w=>{const{user:C,pass:v}=w;p({user:C,pass:v}),f(!0)};return a===null?u.jsx(tv,{provider:e,providerInfo:t,handleSubmit:I,error:null}):s}function rv({...e}){return u.jsx(bi,{...e})}function ov({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,selectedConnection:s,setSelectedConnection:a,providerName:c}){const l=Pe(),d=He(),[f,m]=g.useState(!1);g.useEffect(()=>{if(e&&Oe&&f){const y={groupName:i,groupRef:r,consumerName:n,consumerRef:t,provider:e};Oe().connectionApi.generateConnection({projectIdOrName:l.projectId,generateConnectionParams:y},{headers:{"X-Api-Key":d??"","Content-Type":"application/json"}}).then(I=>{a(I)}).catch(I=>{console.error("Error loading provider info."),ze(I)})}},[d,e,f,n,t,i,r,a,l]);const p=()=>{m(!0)};return s===null?u.jsx(rv,{handleSubmit:p,error:null,providerName:c}):o}const iv=$o("VITE_AMP_ENABLE_CSRF",!1),sv=$o("NEXT_AMP_ENABLE_CSRF",!1),av=$o("REACT_APP_AMP_ENABLE_CSRF",!1),cv=!!iv||!!sv||!!av,Lc=async(e,t,n,r,i,o,s,a)=>{var l,d;const c=await Oe().providerApi.getProvider({provider:i},{headers:{"X-Api-Key":r??""}});if(!c)throw new Error(`Provider ${i} not found`);if(c.authType==="oauth2"&&(((l=c.oauth2Opts)==null?void 0:l.grantType)==="authorizationCode"||((d=c.oauth2Opts)==null?void 0:d.grantType)==="authorizationCodePKCE")){const m=(await Oe().providerAppApi.listProviderApps({projectIdOrName:e},{headers:{"X-Api-Key":r??""}})).find(w=>w.provider===i),p=Qt(i,c);if(!m)throw new Error(`You must first set up a ${p} Provider App using the Ampersand Console.`);const y={connectOAuthParams:{providerWorkspaceRef:o,projectId:e,groupRef:n,groupName:a,consumerRef:t,consumerName:s,providerAppId:m.id,provider:i,enableCSRFProtection:cv}};return await Oe().oAuthApi.oauthConnect(y,{credentials:"include",headers:{"X-Api-Key":r??"","Content-Type":"application/json"}})}throw new Error(`Provider ${i} does not support an OAuth2 web flow.`)},Ns=600,Ts=600,lv="AUTHORIZATION_SUCCEEDED",uv="AUTHORIZATION_FAILED";function dv(e,t,n){return g.useCallback(async r=>{const i=await Oe().connectionApi.getConnection({projectIdOrName:e,connectionId:r},{headers:{"X-Api-Key":t??""}});n(i)},[e,t,n])}function pv(e,t,n,r){return g.useCallback(()=>{if(!r)return;const i=window.screenX+(window.outerWidth-Ns)/2,o=window.screenY+(window.outerHeight-Ts)/2.5,s=`width=${Ns},height=${Ts},left=${i},top=${o}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function fv(e,t){return g.useCallback(n=>{var r,i;if(n.origin===Ip){if(n.data.eventType===lv){const o=(r=n.data.data)==null?void 0:r.connection;o?e(o):console.error("Connection ID not found in event data: ",{event:n})}n.data.eventType===uv&&(console.error("OAuth failed: ",{event:n}),t==null||t(((i=n==null?void 0:n.data)==null?void 0:i.message)??"OAuth failed. Please try again."))}},[t,e])}function Kc({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:i}){const o=He(),{projectId:s}=Pe(),[a,c]=g.useState(null),[l,d]=g.useState(null),{setSelectedConnection:f}=yn(),m=fv(c,r),p=pv(n,d,m,t),y=dv(s,o,f);return g.useEffect(()=>{t&&!l&&p()},[t,l,p,m,n]),g.useEffect(()=>{a&&y(a).then(()=>{l==null||l.close()}).catch(I=>{console.error("Error refreshing connection: ",I),r==null||r(I.message??"Unexpected error: not able to refresh connection")})},[a,o,f,y,l,r]),g.useEffect(()=>{if(!l)return;const I=setInterval(()=>{l.closed&&(clearInterval(I),window.removeEventListener("message",m),d(null),!a&&!i?(console.error("OAuth failed. Please try again."),r==null||r("OAuth failed. Please try again.")):a&&(r==null||r(null)))},500);return()=>{clearInterval(I),window.removeEventListener("message",m)}},[l,a,i,m,r]),u.jsx("div",{children:e})}function mv({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return u.jsxs(Qn,{children:[u.jsx(er,{children:`Set up ${r} integration`}),u.jsx(tr,{error:t}),u.jsx(ct,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function hv({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o}){const{projectId:s}=Pe(),a=He(),[c,l]=g.useState(null),[d,f]=g.useState(null),m=async()=>{f(null);try{const y=await Lc(s,t,r,a,e,void 0,n,i);l(y)}catch(y){console.error("Could not fetch OAuth popup URL."),ze(y),f(y.message??"Unexpected error")}},p=g.useCallback(y=>{f(y),l(null)},[]);return u.jsx(Kc,{windowTitle:`Connect to ${o}`,oauthUrl:c,onError:p,children:u.jsx(mv,{handleSubmit:m,error:d,providerName:o})})}const gv="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function vv({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return u.jsxs(Qn,{children:[u.jsx(er,{children:"Enter your Salesforce subdomain"}),u.jsx(kc,{href:gv,newTab:!0,children:"What is my Salesforce subdomain?"}),u.jsx(tr,{error:n}),u.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[u.jsx(Mt.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:i=>t(i.currentTarget.value)}),u.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),u.jsx(ct,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function yv({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r,providerName:i}){return u.jsxs(Qn,{children:[u.jsxs(er,{children:["Enter your ",i," workspace"]}),u.jsx(tr,{error:n}),u.jsx("br",{}),u.jsx(Mt.Input,{id:"workspace",type:"text",placeholder:"MyWorkspace",onChange:o=>t(o.currentTarget.value)}),u.jsx("br",{}),u.jsx(ct,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const Iv="salesforce";function wv({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o}){const{projectId:s}=Pe(),a=He(),[c,l]=g.useState(""),[d,f]=g.useState(null),[m,p]=g.useState(null),y=async()=>{if(p(null),!c){p("Workspace is required");return}try{const C=await Lc(s,t,r,a,e,c,n,i);f(C)}catch(C){console.error(C),p((C==null?void 0:C.message)??"Unexpected error")}},I=g.useCallback(C=>{p(C),f(null)},[]),w=e===Iv?u.jsx(vv,{handleSubmit:y,setWorkspace:l,error:m,isButtonDisabled:c.length===0}):u.jsx(yv,{handleSubmit:y,setWorkspace:l,error:m,isButtonDisabled:c.length===0,providerName:o});return u.jsx(Kc,{windowTitle:`Connect to ${o}`,oauthUrl:d,onError:I,children:w})}function _v({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,explicitScopesRequired:i,explicitWorkspaceRequired:o}){const[s,a]=g.useState(!1),[c,l]=g.useState({clientSecret:"",clientId:"",workspace:"",scopes:""}),d=()=>a(_=>!_),f=_=>{const{name:E,value:L}=_.currentTarget;l(T=>({...T,[E]:L}))},{clientSecret:m,clientId:p,workspace:y,scopes:I}=c,w=m.length>0,C=p.length>0,v=o?y.length>0:!0,x=n||!w||!C||!v,b=()=>{const _={clientId:p,clientSecret:m};o&&(_.workspace=y),i&&I.length>0&&(_.scopes=Kp(I)),e(_)};return u.jsxs(Qn,{children:[u.jsx(er,{children:`Set up ${r} integration`}),u.jsx(tr,{error:t}),u.jsx("br",{}),u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[o&&u.jsx(Mt.Input,{id:"workspace",name:"workspace",type:"text",placeholder:"MyWorkspace",onChange:_=>f(_)}),u.jsx(Mt.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:_=>f(_)}),u.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[u.jsx(Mt.Input,{id:"clientSecret",name:"clientSecret",type:s?"text":"password",placeholder:"Client Secret",onChange:_=>f(_)}),u.jsx(ct,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:d,children:s?"Hide":"Show"})]}),i&&u.jsx(Mt.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:_=>f(_)})]}),u.jsx("br",{}),u.jsx(ct,{style:{marginTop:"1em",width:"100%"},disabled:x,type:"submit",onClick:b,children:"Next"})]})}function bv({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,explicitScopesRequired:s,explicitWorkspaceRequired:a,selectedConnection:c,setSelectedConnection:l}){const{projectId:d}=Pe(),f=He(),[m,p]=g.useState(null),y=async I=>{p(null);const w={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:I.workspace,oauth2ClientCredentials:{clientId:I.clientId,clientSecret:I.clientSecret,scopes:I.scopes}};Oe().connectionApi.generateConnection({projectIdOrName:d,generateConnectionParams:w},{headers:{"X-Api-Key":f??"","Content-Type":"application/json"}}).then(C=>{l(C)}).catch(C=>{console.error("Error loading provider info."),ze(C),p("Error loading provider info")})};return c===null?u.jsx(_v,{providerName:t,handleSubmit:y,error:m,explicitScopesRequired:s,explicitWorkspaceRequired:a}):u.jsx(Un,{})}function xv({...e}){return u.jsx(bv,{...e})}const Cv="authorizationCode",Ov="authorizationCodePKCE",Ev="clientCredentials";function Sv({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,selectedConnection:s,setSelectedConnection:a}){if(t.oauth2Opts===void 0)return u.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:c,explicitScopesRequired:l,explicitWorkspaceRequired:d}=t.oauth2Opts,f=Qt(e,t),m={provider:e,consumerRef:n,consumerName:r,groupRef:i,groupName:o,providerName:f};return c===Cv||c===Ov?d?u.jsx(wv,{...m}):u.jsx(hv,{...m}):c===Ev?u.jsx(xv,{...m,explicitWorkspaceRequired:d,explicitScopesRequired:l,selectedConnection:s,setSelectedConnection:a}):c==="password"?u.jsx("em",{children:"Password flow not supported yet"}):u.jsxs("em",{children:["Unsupported grant type: ",c]})}function Nv(e){const{selectedConnection:t}=yn();g.useEffect(()=>{e&&t&&e(t)},[e,t])}function Tv({onSuccess:e}){Nv(e)}const Rv=async(e,t)=>{const n=await Oe().providerApi.getProvider({provider:t},{headers:{"X-Api-Key":e??""}});if(!n)throw new Error(`Provider ${t} not found`);return n};function $c({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,onSuccess:s,onDisconnectSuccess:a}){const c=He(),[l,d]=g.useState(null),{provider:f}=dt(),{selectedConnection:m,setSelectedConnection:p,connections:y}=yn();Tv({onSuccess:s});const I=e||f,w=(l==null?void 0:l.displayName)??Bn(I);if(g.useEffect(()=>{if(!m&&y&&y.length>0){const[v]=y;p(v)}Rv(c,I).then(v=>{d(v)}).catch(v=>{console.error("Error loading provider info."),ze(v)})},[y,m,p,c,I]),!e&&!f)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(m)return o;if(l==null)return u.jsx("strong",{children:"Provider not found"});const C={provider:I,consumerRef:t,consumerName:n,groupRef:r,groupName:i,selectedConnection:m,setSelectedConnection:p,providerName:w,providerInfo:l,onDisconnectSuccess:a};return l.authType==="none"?u.jsx(ov,{...C,children:o}):l.authType==="basic"?u.jsx(nv,{...C,children:o}):l.authType==="apiKey"?u.jsx(Qg,{...C,children:o}):u.jsx(Sv,{...C})}function Av(e){const t=e+"CollectionProvider",[n,r]=Gr(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:y,children:I}=p,w=g.useRef(null),C=g.useRef(new Map).current;return u.jsx(i,{scope:y,itemMap:C,collectionRef:w,children:I})};s.displayName=t;const a=e+"CollectionSlot",c=g.forwardRef((p,y)=>{const{scope:I,children:w}=p,C=o(a,I),v=zn(y,C.collectionRef);return u.jsx(Mr,{ref:v,children:w})});c.displayName=a;const l=e+"CollectionItemSlot",d="data-radix-collection-item",f=g.forwardRef((p,y)=>{const{scope:I,children:w,...C}=p,v=g.useRef(null),x=zn(y,v),b=o(l,I);return g.useEffect(()=>(b.itemMap.set(v,{ref:v,...C}),()=>void b.itemMap.delete(v))),u.jsx(Mr,{[d]:"",ref:x,children:w})});f.displayName=l;function m(p){const y=o(e+"CollectionConsumer",p);return g.useCallback(()=>{const w=y.collectionRef.current;if(!w)return[];const C=Array.from(w.querySelectorAll(`[${d}]`));return Array.from(y.itemMap.values()).sort((b,_)=>C.indexOf(b.ref.current)-C.indexOf(_.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:s,Slot:c,ItemSlot:f},m,r]}var Pv=V.useId||(()=>{}),Dv=0;function Vc(e){const[t,n]=V.useState(Pv());return kr(()=>{e||n(r=>r??String(Dv++))},[e]),e||(t?`radix-${t}`:"")}var jv=V.createContext(void 0);function Hc(e){const t=V.useContext(jv);return e||t||"ltr"}var yo="rovingFocusGroup.onEntryFocus",Fv={bubbles:!1,cancelable:!0},Yr="RovingFocusGroup",[Mo,Uc,kv]=Av(Yr),[Mv,Bc]=Gr(Yr,[kv]),[Lv,Kv]=Mv(Yr),qc=V.forwardRef((e,t)=>u.jsx(Mo.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Mo.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx($v,{...e,ref:t})})}));qc.displayName=Yr;var $v=V.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:d=!1,...f}=e,m=V.useRef(null),p=zn(t,m),y=Hc(o),[I=null,w]=yi({prop:s,defaultProp:a,onChange:c}),[C,v]=V.useState(!1),x=vi(l),b=Uc(n),_=V.useRef(!1),[E,L]=V.useState(0);return V.useEffect(()=>{const T=m.current;if(T)return T.addEventListener(yo,x),()=>T.removeEventListener(yo,x)},[x]),u.jsx(Lv,{scope:n,orientation:r,dir:y,loop:i,currentTabStopId:I,onItemFocus:V.useCallback(T=>w(T),[w]),onItemShiftTab:V.useCallback(()=>v(!0),[]),onFocusableItemAdd:V.useCallback(()=>L(T=>T+1),[]),onFocusableItemRemove:V.useCallback(()=>L(T=>T-1),[]),children:u.jsx(en.div,{tabIndex:C||E===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:xt(e.onMouseDown,()=>{_.current=!0}),onFocus:xt(e.onFocus,T=>{const J=!_.current;if(T.target===T.currentTarget&&J&&!C){const q=new CustomEvent(yo,Fv);if(T.currentTarget.dispatchEvent(q),!q.defaultPrevented){const z=b().filter(ne=>ne.focusable),Y=z.find(ne=>ne.active),ee=z.find(ne=>ne.id===I),se=[Y,ee,...z].filter(Boolean).map(ne=>ne.ref.current);zc(se,d)}}_.current=!1}),onBlur:xt(e.onBlur,()=>v(!1))})})}),Wc="RovingFocusGroupItem",Jc=V.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,...s}=e,a=Vc(),c=o||a,l=Kv(Wc,n),d=l.currentTabStopId===c,f=Uc(n),{onFocusableItemAdd:m,onFocusableItemRemove:p}=l;return V.useEffect(()=>{if(r)return m(),()=>p()},[r,m,p]),u.jsx(Mo.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:u.jsx(en.span,{tabIndex:d?0:-1,"data-orientation":l.orientation,...s,ref:t,onMouseDown:xt(e.onMouseDown,y=>{r?l.onItemFocus(c):y.preventDefault()}),onFocus:xt(e.onFocus,()=>l.onItemFocus(c)),onKeyDown:xt(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){l.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const I=Uv(y,l.orientation,l.dir);if(I!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let C=f().filter(v=>v.focusable).map(v=>v.ref.current);if(I==="last")C.reverse();else if(I==="prev"||I==="next"){I==="prev"&&C.reverse();const v=C.indexOf(y.currentTarget);C=l.loop?Bv(C,v+1):C.slice(v+1)}setTimeout(()=>zc(C))}})})})});Jc.displayName=Wc;var Vv={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Hv(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Uv(e,t,n){const r=Hv(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Vv[r]}function zc(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Bv(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var qv=qc,Wv=Jc,xi="Tabs",[Jv,Iy]=Gr(xi,[Bc]),Xc=Bc(),[zv,Ci]=Jv(xi),Gc=V.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:a,activationMode:c="automatic",...l}=e,d=Hc(a),[f,m]=yi({prop:r,onChange:i,defaultProp:o});return u.jsx(zv,{scope:n,baseId:Vc(),value:f,onValueChange:m,orientation:s,dir:d,activationMode:c,children:u.jsx(en.div,{dir:d,"data-orientation":s,...l,ref:t})})});Gc.displayName=xi;var Yc="TabsList",Zc=V.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=Ci(Yc,n),s=Xc(n);return u.jsx(qv,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:u.jsx(en.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});Zc.displayName=Yc;var Qc="TabsTrigger",el=V.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=Ci(Qc,n),a=Xc(n),c=nl(s.baseId,r),l=rl(s.baseId,r),d=r===s.value;return u.jsx(Wv,{asChild:!0,...a,focusable:!i,active:d,children:u.jsx(en.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":l,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:c,...o,ref:t,onMouseDown:xt(e.onMouseDown,f=>{!i&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:xt(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:xt(e.onFocus,()=>{const f=s.activationMode!=="manual";!d&&!i&&f&&s.onValueChange(r)})})})});el.displayName=Qc;var tl="TabsContent",Xv=V.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,a=Ci(tl,n),c=nl(a.baseId,r),l=rl(a.baseId,r),d=r===a.value,f=V.useRef(d);return V.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),u.jsx(Ii,{present:i||d,children:({present:m})=>u.jsx(en.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:l,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:m&&o})})});Xv.displayName=tl;function nl(e,t){return`${e}-trigger-${t}`}function rl(e,t){return`${e}-content-${t}`}var Gv=Gc,Yv=Zc,ol=el;const Zv=u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[u.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),u.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function Qv(e,t){return t?g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},g.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?Zv:u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:u.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}function ey(){return u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("path",{d:"M2.25 4.5H3.75H15.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M14.25 4.5V15C14.25 15.3978 14.092 15.7794 13.8107 16.0607C13.5294 16.342 13.1478 16.5 12.75 16.5H5.25C4.85218 16.5 4.47064 16.342 4.18934 16.0607C3.90804 15.7794 3.75 15.3978 3.75 15V4.5M6 4.5V3C6 2.60218 6.15804 2.22064 6.43934 1.93934C6.72064 1.65804 7.10218 1.5 7.5 1.5H10.5C10.8978 1.5 11.2794 1.65804 11.5607 1.93934C11.842 2.22064 12 2.60218 12 3V4.5",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M7.5 8.25V12.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M10.5 8.25V12.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const ty="_tabsRoot_ktpr0_1",ny="_tabsList_ktpr0_6",ry="_tabTrigger_ktpr0_12",oy="_danger_ktpr0_29",Xn={tabsRoot:ty,tabsList:ny,tabTrigger:ry,danger:oy};function il({objectName:e,completed:t,pending:n,displayName:r}){return u.jsx(ol,{value:e,className:Xn.tabTrigger,children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[Qv(t,n),u.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[u.jsx("span",{children:r||e}),n&&u.jsx("span",{style:{fontSize:".8rem",fontStyle:"italic"},children:"pending"})]})]})})}function iy({completed:e,pending:t,displayName:n}){return u.jsxs(u.Fragment,{children:[u.jsx(gi,{style:{margin:"1rem 0"}}),u.jsx(il,{objectName:fn,completed:e,pending:t,displayName:n},"other-write")]})}function sy(){return u.jsxs(u.Fragment,{children:[u.jsx(gi,{style:{margin:"3rem 0 1rem 0"}}),u.jsx(ol,{value:Or,className:st(Xn.tabTrigger,Xn.danger),children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[ey(),u.jsx("span",{children:"Uninstall"})]})})]})}function ay({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:i,showUninstallButton:o}){var s,a;return u.jsx(Gv,{value:e,className:Xn.tabsRoot,onValueChange:n,children:u.jsxs(Yv,{className:Xn.tabsList,children:[t.map(c=>{var l,d,f,m;return u.jsx(il,{objectName:c.name,displayName:c.displayName,completed:c.completed,pending:((d=(l=r==null?void 0:r[c.name])==null?void 0:l.read)==null?void 0:d.isOptionalFieldsModified)||((m=(f=r==null?void 0:r[c.name])==null?void 0:f.read)==null?void 0:m.isRequiredMapFieldsModified)||!1},c.name)}),i&&u.jsx(iy,{completed:i.completed,pending:((a=(s=r==null?void 0:r.other)==null?void 0:s.write)==null?void 0:a.isWriteModified)||!1,displayName:"Write"}),o&&u.jsx(sy,{})]})})}function cy(e,t){return t===Or?{name:Or,completed:!1}:e.find(n=>n.name===t)}function ly({children:e}){var C;const{project:t}=Pe(),{installation:n,provider:r}=dt(),{hydratedRevision:i}=Dn(),{objectConfigurationsState:o}=hi(),[s,a]=g.useState(""),c=(t==null?void 0:t.appName)||"",l=n==null?void 0:n.config,d=i&&ta(l,i),f=d!==null,m=!!((C=i==null?void 0:i.content)!=null&&C.write),p=m?na(l):void 0,y=g.useMemo(()=>{const v=[...d||[]];return p&&m&&v.push(p),v},[d,p,m]),I=cy(y,s),w=g.useCallback(()=>{const v=y.find(x=>I!==x&&!x.completed);v&&a(v.name)},[y,I]);return g.useEffect(()=>{!s&&y.length>0&&a(y[0].name)},[y,s,w]),u.jsx(lc.Provider,{value:w,children:u.jsx(ac.Provider,{value:I==null?void 0:I.name,children:u.jsxs(Pn,{style:{maxWidth:"55rem"},children:[u.jsxs(Zt,{style:{display:"flex",gap:"1rem",padding:"3rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[u.jsxs("div",{style:{width:"20rem"},children:[u.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[Qt(r)," integration"]}),u.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:c}),f&&u.jsx(ay,{value:s,readNavObjects:d,onValueChange:v=>a(v),objectConfigurationsState:o,writeNavObject:p,showUninstallButton:!!n})]}),e]}),u.jsx(Fc,{})]})})})}function uy({...e}){return u.jsx(ly,{...e})}function dy({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c}){var C;const{projectId:l,projectIdOrName:d,isLoading:f}=Pe(),{isLoading:m}=Ko(),{isError:p,errorState:y}=Yt(),{seed:I,reset:w}=Zs();return f||m?u.jsx(Kr,{}):p(Ce.PROJECT,d)?u.jsx(Lt,{message:`Error loading project ${d}`}):p(Ce.INTEGRATION_LIST,d)?u.jsx(Lt,{message:"Error retrieving integrations for the project, double check the API key"}):(C=y[Ce.INTEGRATION_LIST])!=null&&C.apiError?u.jsx(Lt,{message:"Something went wrong, couldn't find integration information"}):u.jsx("div",{className:Qs.resetContainer,children:u.jsx(Vp,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c,children:u.jsx(Ys,{groupRef:r,children:u.jsx($c,{consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:u.jsx(ff,{projectId:l,children:u.jsx($g,{resetComponent:w,children:u.jsx(Rh,{children:u.jsx(uy,{children:u.jsx(jg,{})})})})})})})},I)})}function py(){return u.jsxs(Pn,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[u.jsx(Un,{}),u.jsx("p",{children:"Redirecting"})]})}function fy({redirectURL:e,children:t}){return g.useEffect(()=>{e&&window.location.replace(e)},[e]),e?u.jsx(py,{}):t}function my({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:i}){const o=He(),{projectId:s}=Pe(),{selectedConnection:a,setConnections:c}=yn(),[l,d]=g.useState(!1),f=!s||!a||!a.id||l,m=async()=>{if(!f){d(!0),console.warn("deleting connection",{projectId:s,connectionId:a==null?void 0:a.id});try{await Oe().connectionApi.deleteConnection({projectIdOrName:s,connectionId:a==null?void 0:a.id},{headers:{"X-Api-Key":o,"Content-Type":"application/json"}}),console.warn("successfully deleted connection:",a==null?void 0:a.id),r==null||r(a),Oe().connectionApi.listConnections({projectIdOrName:s},{headers:{"X-Api-Key":o??""}}).then(I=>{c(I),i()}).catch(I=>{ze(I)})}catch(I){console.error("Error deleting connection."),ze(I)}finally{d(!1)}}},p=l?"Disconnecting...":e;return u.jsx(ct,{type:"button",onClick:m,disabled:f,variant:t,style:n,children:p})}function hy({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Pe(),i=`You have successfully connected your ${Qt(e)} account to ${r}.`;return u.jsx(_i,{text:i,children:u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:u.jsx(my,{resetComponent:n,onDisconnectSuccess:t,buttonText:"Remove Connection",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}function gy({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,redirectUrl:o,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:c}){const{seed:l,reset:d}=Zs(),f=g.useCallback(m=>{s?s(m.id):c&&c(m)},[s,c]);return u.jsx("div",{className:Qs.resetContainer,children:u.jsx(Ys,{provider:e,groupRef:r,children:u.jsx($c,{provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onSuccess:f,onDisconnectSuccess:a,children:u.jsx(fy,{redirectURL:o,children:u.jsx(hy,{resetComponent:d,provider:e,onDisconnectSuccess:a})})})})},l)}const vy=(e,t)=>{const n=He(),{projectId:r,isLoading:i}=Pe(),{integrations:o}=Ko(),[s,a]=g.useState(!1),[c,l]=g.useState(null);if(!n||!i&&!r)throw new Error("useIsIntegrationInstalled must be used within AmpersandProvider");if(!e)throw new Error("useIsIntegrationInstalled requires an integration name");if(!t)throw new Error("useIsIntegrationInstalled requires a groupRef");const f=g.useMemo(()=>o==null?void 0:o.reduce((m,p)=>(p==null?void 0:p.name)===e?p:m,{}),[o,e]);return g.useEffect(()=>{!f||i||Oe().installationApi.listInstallations({projectIdOrName:r,integrationId:f.id,groupRef:t},{headers:{"x-api-key":n}}).then(m=>{a(!0),l(m.length>0)}).catch(m=>{console.error("Error listing installations."),ze(m),a(!0)})},[t,n,r,f,i]),{isLoaded:s,isIntegrationInstalled:c}};exports.AmpersandContext=qs;exports.AmpersandProvider=Op;exports.ConnectProvider=gy;exports.FieldMapping=yc;exports.InstallIntegration=dy;exports.useAmpersandProvider=Ep;exports.useIsIntegrationInstalled=vy;