@amp-labs/react 2.9.10 → 2.9.11

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,32 +1,51 @@
1
- "use strict";var Op=Object.defineProperty;var pc=e=>{throw TypeError(e)};var _p=(e,t,n)=>t in e?Op(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var pi=(e,t,n)=>_p(e,typeof t!="symbol"?t+"":t,n),es=(e,t,n)=>t.has(e)||pc("Cannot "+n);var _=(e,t,n)=>(es(e,t,"read from private field"),n?n.call(e):t.get(e)),oe=(e,t,n)=>t.has(e)?pc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Q=(e,t,n,r)=>(es(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),me=(e,t,n)=>(es(e,t,"access private method"),n);var Xi=(e,t,n,r)=>({set _(i){Q(e,t,i,n)},get _(){return _(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),I=require("react");require("react-dom");function Sp(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 B=Sp(I),Ep="https://api.withampersand.com/v1".replace(/\/+$/,"");class ia{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Ep}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Lu}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 Np=new ia,Fo=class Fo{constructor(t=Np){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 Ap(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?Fo.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 oa(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(f=>i[f]===void 0?delete i[f]:{});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})},u={...a,body:Rp(a.body)||a.body instanceof URLSearchParams||Tp(a.body)?a.body:JSON.stringify(a.body)};return{url:r,init:u}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};Fo.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let rn=Fo;function Tp(e){return typeof Blob<"u"&&e instanceof Blob}function Rp(e){return typeof FormData<"u"&&e instanceof FormData}class oa extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class Ap extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class ie extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function E(e,t){const n=e[t];return n!=null}function Lu(e,t=""){return Object.keys(e).map(n=>Vu(n,e[n],t)).filter(n=>n.length>0).join("&")}function Vu(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 Vu(e,i,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Lu(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function qe(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class Me{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class Hr{constructor(t){this.raw=t}async value(){}}class hc{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function Fp(e){return Pp(e)}function Pp(e,t){return e==null?e:{fieldUsed:E(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:E(e,"keyFormat")?e.keyFormat:void 0}}function Dp(e){return Mp(e)}function Mp(e,t){return e==null?e:{name:e.name,valuePrefix:E(e,"valuePrefix")?e.valuePrefix:void 0}}function kp(e){return jp(e)}function jp(e,t){return e==null?e:{name:e.name}}function Lp(e){return Vp(e)}function Vp(e,t){return e==null?e:{attachmentType:e.attachmentType,query:E(e,"query")?kp(e.query):void 0,header:E(e,"header")?Dp(e.header):void 0,docsURL:E(e,"docsURL")?e.docsURL:void 0}}function $p(e){return Kp(e)}function Kp(e,t){return e==null?e:{enabled:E(e,"enabled")?e.enabled:void 0,includeFullRecords:E(e,"includeFullRecords")?e.includeFullRecords:void 0}}function Up(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function qp(e){return Bp(e)}function Bp(e,t){return e==null?e:{url:e.url,method:E(e,"method")?e.method:void 0,successStatusCodes:E(e,"successStatusCodes")?e.successStatusCodes:void 0}}const mc={ApiKey:"apiKey",Basic:"basic"};function Jp(e){return Hp(e)}function Hp(e,t){return e}function Wp(e){return zp(e)}function zp(e,t){return e==null?e:{days:E(e,"days")?e.days:void 0,fullHistory:E(e,"fullHistory")?e.fullHistory:void 0}}function Qp(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function $u(e){return Gp(e)}function Gp(e,t){return e==null?e:{defaultPeriod:Wp(e.defaultPeriod)}}function Xp(e){if(e!==void 0)return e===null?null:{defaultPeriod:Qp(e.defaultPeriod)}}function Yp(e){return Zp(e)}function Zp(e,t){return e==null?e:{days:E(e,"days")?e.days:void 0,fullHistory:E(e,"fullHistory")?e.fullHistory:void 0}}function eh(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function th(e){return nh(e)}function nh(e,t){return e==null?e:{defaultPeriod:Yp(e.defaultPeriod)}}function Ku(e){if(e!==void 0)return e===null?null:{defaultPeriod:eh(e.defaultPeriod)}}function rh(e){return ih(e)}function ih(e,t){return e==null?e:{enabled:E(e,"enabled")?e.enabled:void 0,useModule:E(e,"useModule")?e.useModule:void 0}}function Uu(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,useModule:e.useModule}}function oh(e){return sh(e)}function sh(e,t){return e==null?e:{mappedValue:e.mappedValue,mappedDisplayValue:e.mappedDisplayValue}}function ah(e){if(e!==void 0)return e===null?null:{mappedValue:e.mappedValue,mappedDisplayValue:e.mappedDisplayValue}}function ch(e){return uh(e)}function uh(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:E(e,"mapToDisplayName")?e.mapToDisplayName:void 0,prompt:E(e,"prompt")?e.prompt:void 0,mappedValues:E(e,"mappedValues")?e.mappedValues.map(oh):void 0,fieldName:E(e,"fieldName")?e.fieldName:void 0}}function qu(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,prompt:e.prompt,mappedValues:e.mappedValues===void 0?void 0:e.mappedValues.map(ah),fieldName:e.fieldName}}function lh(e){return dh(e)}function dh(e,t){return e}function fh(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,disabled:e.disabled,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:e.selectedValueMappings,dynamicMappingsInput:e.dynamicMappingsInput===void 0?void 0:e.dynamicMappingsInput.map(qu),selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:Ku(e.backfill)}}function ph(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:qe(e.objects,fh)}}function hh(e){return mh(e)}function mh(e,t){return e==null?e:{stringValue:E(e,"stringValue")?e.stringValue:void 0,integerValue:E(e,"integerValue")?e.integerValue:void 0,booleanValue:E(e,"booleanValue")?e.booleanValue:void 0}}function gh(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}const yh={Always:"always",Never:"never"},vh={Always:"always",Never:"never"};function wh(e){return bh(e)}function bh(e,t){return e==null?e:{default:E(e,"default")?hh(e.default):void 0,writeOnCreate:E(e,"writeOnCreate")?e.writeOnCreate:void 0,writeOnUpdate:E(e,"writeOnUpdate")?e.writeOnUpdate:void 0}}function Bu(e){if(e!==void 0)return e===null?null:{default:gh(e.default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function Ih(e){let t=!0;return t=t&&"value"in e,t}function Ch(e,t){return e==null?e:{value:e.value,applyOnUpdate:E(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function xh(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Oh(e){let t=!0;return t=t&&"value"in e,t}function _h(e,t){return e==null?e:{value:e.value,applyOnUpdate:E(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Sh(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Eh(e){let t=!0;return t=t&&"value"in e,t}function Nh(e,t){return e==null?e:{value:e.value,applyOnUpdate:E(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Th(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Rh(e){return Ah(e)}function Ah(e,t){return e==null?e:{...Ch(e),..._h(e),...Nh(e)}}function Ju(e){if(e!==void 0)return e===null?null:Ih(e)?xh(e):Oh(e)?Sh(e):Eh(e)?Th(e):{}}function Fh(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:qe(e.selectedValueDefaults,Ju),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:qe(e.selectedFieldSettings,Bu)}}function Ph(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:qe(e.objects,Fh)}}function Dh(e){return Mh(e)}function Mh(e,t){return e==null?e:{enabled:e.enabled}}function kh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function jh(e){return Lh(e)}function Lh(e,t){return e==null?e:{enabled:e.enabled}}function Vh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function $h(e){return Kh(e)}function Kh(e,t){return e==null?e:{enabled:e.enabled,watchFieldsAuto:E(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:E(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function Uh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function qh(e){return Bh(e)}function Bh(e,t){return e==null?e:{apiKeyAsBasic:E(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:E(e,"apiKeyAsBasicOpts")?Fp(e.apiKeyAsBasicOpts):void 0,docsURL:E(e,"docsURL")?e.docsURL:void 0}}function Jh(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Hh(e){return Wh(e)}function Wh(e,t){return e==null?e:{value:e.value}}function zh(e){return Qh(e)}function Qh(e,t){return e==null?e:{brandingRemoval:E(e,"brandingRemoval")?Hh(e.brandingRemoval):void 0}}function Yi(e){return Gh(e)}function Gh(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:E(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:E(e,"updateTime")?new Date(e.updateTime):void 0,entitlements:E(e,"entitlements")?zh(e.entitlements):void 0}}function Xh(e){return Yh(e)}function Yh(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Zh(e){return em(e)}function em(e,t){return e==null?e:{objectName:e.objectName,schedule:E(e,"schedule")?e.schedule:void 0,disabled:E(e,"disabled")?e.disabled:void 0,destination:E(e,"destination")?e.destination:void 0,selectedFields:e.selectedFields,selectedValueMappings:E(e,"selectedValueMappings")?e.selectedValueMappings:void 0,dynamicMappingsInput:E(e,"dynamicMappingsInput")?e.dynamicMappingsInput.map(ch):void 0,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:E(e,"selectedFieldsAuto")?lh(e.selectedFieldsAuto):void 0,backfill:E(e,"backfill")?th(e.backfill):void 0}}function tm(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,disabled:e.disabled,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:e.selectedValueMappings,dynamicMappingsInput:e.dynamicMappingsInput===void 0?void 0:e.dynamicMappingsInput.map(qu),selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:Ku(e.backfill)}}function nm(e){return rm(e)}function rm(e,t){return e==null?e:{objects:qe(e.objects,Zh)}}function im(e){if(e!==void 0)return e===null?null:{objects:qe(e.objects,tm)}}function om(e){return sm(e)}function sm(e,t){return e==null?e:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:E(e,"createEvent")?Dh(e.createEvent):void 0,updateEvent:E(e,"updateEvent")?$h(e.updateEvent):void 0,deleteEvent:E(e,"deleteEvent")?jh(e.deleteEvent):void 0}}function am(e){if(e!==void 0)return e===null?null:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:kh(e.createEvent),updateEvent:Uh(e.updateEvent),deleteEvent:Vh(e.deleteEvent)}}function cm(e){return um(e)}function um(e,t){return e==null?e:{objects:qe(e.objects,om)}}function lm(e){if(e!==void 0)return e===null?null:{objects:qe(e.objects,am)}}function dm(e){return fm(e)}function fm(e,t){return e==null?e:{objectName:e.objectName,selectedValueDefaults:E(e,"selectedValueDefaults")?qe(e.selectedValueDefaults,Rh):void 0,selectedFieldSettings:E(e,"selectedFieldSettings")?qe(e.selectedFieldSettings,wh):void 0}}function pm(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:qe(e.selectedValueDefaults,Ju),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:qe(e.selectedFieldSettings,Bu)}}function hm(e){return mm(e)}function mm(e,t){return e==null?e:{objects:E(e,"objects")?qe(e.objects,dm):void 0}}function gm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:qe(e.objects,pm)}}function ym(e){return vm(e)}function vm(e,t){return e==null?e:{provider:e.provider,module:E(e,"module")?e.module:void 0,read:E(e,"read")?nm(e.read):void 0,write:E(e,"write")?hm(e.write):void 0,proxy:E(e,"proxy")?rh(e.proxy):void 0,subscribe:E(e,"subscribe")?cm(e.subscribe):void 0}}function wm(e){if(e!==void 0)return e===null?null:{provider:e.provider,module:e.module,read:im(e.read),write:gm(e.write),proxy:Uu(e.proxy),subscribe:lm(e.subscribe)}}function bm(e){return Im(e)}function Im(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:ym(e.content)}}function Cm(e){return xm(e)}function xm(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:E(e,"updateTime")?new Date(e.updateTime):void 0}}function Hu(e){return Om(e)}function Om(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:E(e,"updateTime")?new Date(e.updateTime):void 0}}function _m(e){return Sm(e)}function Sm(e,t){return e==null?e:{token:e.token,issuedAt:E(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:E(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Em(e){return Nm(e)}function Nm(e,t){return e==null?e:{token:e.token,issuedAt:E(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:E(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Tm(e){return Rm(e)}function Rm(e,t){return e==null?e:{accessToken:E(e,"accessToken")?_m(e.accessToken):void 0,refreshToken:E(e,"refreshToken")?Em(e.refreshToken):void 0,scopes:E(e,"scopes")?e.scopes:void 0}}function ao(e){return Am(e)}function Am(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:E(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:E(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:E(e,"updateTime")?new Date(e.updateTime):void 0}}function Fm(e){return Pm(e)}function Pm(e,t){return e==null?e:{value:e.value,source:e.source,displayName:E(e,"displayName")?e.displayName:void 0}}function sa(e){if(e!==void 0)return e===null?null:{value:e.value,source:e.source,displayName:e.displayName}}function yi(e){return Dm(e)}function Dm(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:E(e,"providerApp")?ao(e.providerApp):void 0,group:Hu(e.group),consumer:Cm(e.consumer),providerWorkspaceRef:E(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:E(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:E(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:E(e,"oauth2AuthorizationCode")?Tm(e.oauth2AuthorizationCode):void 0,apiKey:E(e,"apiKey")?e.apiKey:void 0,providerMetadata:E(e,"providerMetadata")?qe(e.providerMetadata,Fm):void 0}}function Wu(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function zu(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Qu(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 Mm(e){if(e!==void 0)return e===null?null:{token:e.token,expiresAt:e.expiresAt===void 0?void 0:e.expiresAt.toISOString(),issuedAt:e.issuedAt===void 0?void 0:e.issuedAt.toISOString()}}function km(e){if(e!==void 0)return e===null?null:{token:e.token,expiresAt:e.expiresAt===void 0?void 0:e.expiresAt.toISOString(),issuedAt:e.issuedAt===void 0?void 0:e.issuedAt.toISOString()}}function Gu(e){if(e!==void 0)return e===null?null:{accessToken:Mm(e.accessToken),refreshToken:km(e.refreshToken),scopes:e.scopes}}function jm(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:qe(e.providerMetadata,sa),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:Wu(e.basicAuth),oauth2ClientCredentials:zu(e.oauth2ClientCredentials),oauth2PasswordCredentials:Qu(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Gu(e.oauth2AuthorizationCode)}}function Lm(e){return Vm(e)}function Vm(e,t){return e==null?e:{enabled:E(e,"enabled")?e.enabled:void 0}}function $m(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Km(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:wm(e.content)}}function Um(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:Km(e.config)}}function qm(e){return Bm(e)}function Bm(e,t){return e==null?e:{enabled:E(e,"enabled")?e.enabled:void 0,useModule:E(e,"useModule")?e.useModule:void 0}}function Jm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,useModule:e.useModule}}function Hm(e){return Wm(e)}function Wm(e,t){return e==null?e:{mode:E(e,"mode")?e.mode:void 0,pageSize:E(e,"pageSize")?e.pageSize:void 0}}function zm(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Qm(e){let t=!0;return t=t&&"fieldName"in e,t}function Gm(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:E(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:E(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Xm(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Ym(e){let t=!0;return t=t&&"mapToName"in e,t}function Xu(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:E(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:E(e,"default")?e.default:void 0,prompt:E(e,"prompt")?e.prompt:void 0}}function Zm(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function gc(e){return eg(e)}function eg(e,t){return e==null?e:{...Gm(e),...Xu(e)}}function yc(e){if(e!==void 0)return e===null?null:Qm(e)?Xm(e):Ym(e)?Zm(e):{}}function Yu(e){return tg(e)}function tg(e,t){return e}function ng(e){return rg(e)}function rg(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:E(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:E(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:E(e,"requiredFields")?e.requiredFields.map(gc):void 0,optionalFields:E(e,"optionalFields")?e.optionalFields.map(gc):void 0,optionalFieldsAuto:E(e,"optionalFieldsAuto")?Yu(e.optionalFieldsAuto):void 0,backfill:E(e,"backfill")?$u(e.backfill):void 0,delivery:E(e,"delivery")?Hm(e.delivery):void 0,enabled:E(e,"enabled")?e.enabled:void 0}}function ig(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(yc),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(yc),optionalFieldsAuto:e.optionalFieldsAuto,backfill:Xp(e.backfill),delivery:zm(e.delivery),enabled:e.enabled}}function og(e){return sg(e)}function sg(e,t){return e==null?e:{objects:E(e,"objects")?e.objects.map(ng):void 0}}function ag(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(ig)}}function cg(e){return ug(e)}function ug(e,t){return e==null?e:{enabled:E(e,"enabled")?e.enabled:void 0}}function lg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function dg(e){return fg(e)}function fg(e,t){return e==null?e:{enabled:E(e,"enabled")?e.enabled:void 0,watchFieldsAuto:E(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:E(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function pg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function hg(e){return mg(e)}function mg(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:E(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:E(e,"createEvent")?Lm(e.createEvent):void 0,updateEvent:E(e,"updateEvent")?dg(e.updateEvent):void 0,deleteEvent:E(e,"deleteEvent")?cg(e.deleteEvent):void 0,associationChangeEvent:E(e,"associationChangeEvent")?$p(e.associationChangeEvent):void 0,otherEvents:E(e,"otherEvents")?e.otherEvents:void 0}}function gg(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:$m(e.createEvent),updateEvent:pg(e.updateEvent),deleteEvent:lg(e.deleteEvent),associationChangeEvent:Up(e.associationChangeEvent),otherEvents:e.otherEvents}}function yg(e){return vg(e)}function vg(e,t){return e==null?e:{objects:E(e,"objects")?e.objects.map(hg):void 0}}function wg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(gg)}}function Zu(e){return bg(e)}function bg(e,t){return e==null?e:{allowAnyFields:E(e,"allowAnyFields")?e.allowAnyFields:void 0}}function Ig(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function Cg(e){return xg(e)}function xg(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:E(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:E(e,"valueDefaults")?Zu(e.valueDefaults):void 0}}function Og(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:Ig(e.valueDefaults)}}function _g(e){return Sg(e)}function Sg(e,t){return e==null?e:{objects:E(e,"objects")?e.objects.map(Cg):void 0}}function Eg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Og)}}function Ng(e){return Tg(e)}function Tg(e,t){return e==null?e:{name:e.name,provider:e.provider,displayName:E(e,"displayName")?e.displayName:void 0,module:E(e,"module")?e.module:void 0,read:E(e,"read")?og(e.read):void 0,write:E(e,"write")?_g(e.write):void 0,proxy:E(e,"proxy")?qm(e.proxy):void 0,subscribe:E(e,"subscribe")?yg(e.subscribe):void 0}}function Rg(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,displayName:e.displayName,module:e.module,read:ag(e.read),write:Eg(e.write),proxy:Jm(e.proxy),subscribe:wg(e.subscribe)}}function Ag(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:Rg(e.content)}}function Fg(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:Ag(e.latestRevision)}}function Pg(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function Dg(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 Mg(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function kg(e){return jg(e)}function jg(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function Lg(e){return Vg(e)}function Vg(e,t){return e==null?e:{name:e.name,displayName:e.displayName,prompt:E(e,"prompt")?e.prompt:void 0,docsURL:E(e,"docsURL")?e.docsURL:void 0}}function $g(e){return Kg(e)}function Kg(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function Ug(e){return qg(e)}function qg(e,t){return e==null?e:{headers:E(e,"headers")?e.headers.map(kg):void 0,queryParams:E(e,"queryParams")?e.queryParams.map($g):void 0,inputs:E(e,"inputs")?e.inputs.map(Lg):void 0}}function Bg(e){return Jg(e)}function Jg(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function Hg(e){return Wg(e)}function Wg(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:E(e,"valueType")?e.valueType:void 0,providerType:E(e,"providerType")?e.providerType:void 0,readOnly:E(e,"readOnly")?e.readOnly:void 0,values:E(e,"values")?e.values.map(Bg):void 0}}function zg(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:qe(e.providerMetadata,sa),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:Wu(e.basicAuth),oauth2ClientCredentials:zu(e.oauth2ClientCredentials),oauth2PasswordCredentials:Qu(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Gu(e.oauth2AuthorizationCode)}}function Qg(e){return Gg(e)}function Gg(e,t){return e==null?e:{enabled:E(e,"enabled")?e.enabled:void 0,useModule:E(e,"useModule")?e.useModule:void 0}}function Xg(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:E(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:E(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function ts(e){return Yg(e)}function Yg(e,t){return e==null?e:{...Xg(e),...Xu(e)}}function Zg(e){return ey(e)}function ey(e,t){return e==null?e:{error:E(e,"error")?e.error:void 0,objectName:e.objectName,displayName:e.displayName,mapToName:E(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:E(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:E(e,"requiredFields")?e.requiredFields.map(ts):void 0,optionalFields:E(e,"optionalFields")?e.optionalFields.map(ts):void 0,optionalFieldsAuto:E(e,"optionalFieldsAuto")?Yu(e.optionalFieldsAuto):void 0,allFieldsMetadata:E(e,"allFieldsMetadata")?qe(e.allFieldsMetadata,Hg):void 0,allFields:E(e,"allFields")?e.allFields.map(ts):void 0,backfill:E(e,"backfill")?$u(e.backfill):void 0}}function ty(e){return ny(e)}function ny(e,t){return e==null?e:{objects:E(e,"objects")?e.objects.map(Zg):void 0}}function ry(e){return iy(e)}function iy(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:E(e,"valueDefaults")?Zu(e.valueDefaults):void 0}}function oy(e){return sy(e)}function sy(e,t){return e==null?e:{objects:E(e,"objects")?e.objects.map(ry):void 0}}function ay(e){return cy(e)}function cy(e,t){return e==null?e:{name:e.name,displayName:E(e,"displayName")?e.displayName:void 0,module:E(e,"module")?e.module:void 0,provider:e.provider,read:E(e,"read")?ty(e.read):void 0,write:E(e,"write")?oy(e.write):void 0,proxy:E(e,"proxy")?Qg(e.proxy):void 0}}function uy(e){return ly(e)}function ly(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:ay(e.content)}}function hi(e){return dy(e)}function dy(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:E(e,"group")?Hu(e.group):void 0,healthStatus:e.healthStatus,connection:yi(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:E(e,"updateTime")?new Date(e.updateTime):void 0,config:bm(e.config)}}function fy(e){return py(e)}function py(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Ng(e.content)}}function ns(e){return hy(e)}function hy(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:E(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:fy(e.latestRevision)}}function my(e){return gy(e)}function gy(e,t){return e==null?e:{iconURL:E(e,"iconURL")?e.iconURL:void 0,logoURL:E(e,"logoURL")?e.logoURL:void 0}}function yy(e){return vy(e)}function vy(e,t){return e==null?e:{iconURL:E(e,"iconURL")?e.iconURL:void 0,logoURL:E(e,"logoURL")?e.logoURL:void 0}}function wy(e){return by(e)}function by(e,t){return e==null?e:{regular:E(e,"regular")?yy(e.regular):void 0,darkMode:E(e,"darkMode")?my(e.darkMode):void 0}}function Iy(e){return Cy(e)}function Cy(e,t){return e==null?e:{name:e.name,displayName:E(e,"displayName")?e.displayName:void 0,defaultValue:E(e,"defaultValue")?e.defaultValue:void 0,docsURL:E(e,"docsURL")?e.docsURL:void 0,moduleDependencies:E(e,"moduleDependencies")?e.moduleDependencies:void 0}}function xy(e){return Oy(e)}function Oy(e,t){return e==null?e:{name:e.name,moduleDependencies:E(e,"moduleDependencies")?e.moduleDependencies:void 0}}function _y(e){return Sy(e)}function Sy(e,t){return e==null?e:{create:E(e,"create")?e.create:void 0,update:E(e,"update")?e.update:void 0,_delete:E(e,"delete")?e.delete:void 0,passThrough:E(e,"passThrough")?e.passThrough:void 0}}function el(e){return Ey(e)}function Ey(e,t){return e==null?e:{bulkWrite:Xh(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:E(e,"subscribeSupport")?_y(e.subscribeSupport):void 0}}function Ny(e){return Ty(e)}function Ty(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:el(e.support)}}function Ry(e){return Ay(e)}function Ay(e,t){return e==null?e:{name:e.name,displayName:e.displayName,path:e.path,capture:E(e,"capture")?e.capture:void 0}}function Fy(e){return Py(e)}function Py(e,t){return e==null?e:{workspaceRefField:E(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:E(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:E(e,"scopesField")?e.scopesField:void 0,otherFields:E(e,"otherFields")?e.otherFields.map(Ry):void 0}}const rs={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials"};function Dy(e){return My(e)}function My(e,t){return e==null?e:{grantType:e.grantType,authURL:E(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:E(e,"audience")?e.audience:void 0,tokenMetadataFields:Fy(e.tokenMetadataFields),docsURL:E(e,"docsURL")?e.docsURL:void 0,authURLParams:E(e,"authURLParams")?e.authURLParams:void 0}}function ky(e){if(e!==void 0)return e===null?null:{projectId:e.projectId,provider:e.provider,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:qe(e.providerMetadata,sa),providerAppId:e.providerAppId,enableCSRFProtection:e.enableCSRFProtection}}function jy(e){return Ly(e)}function Ly(e,t){return e==null?e:{input:E(e,"input")?e.input.map(Iy):void 0,postAuthentication:E(e,"postAuthentication")?e.postAuthentication.map(xy):void 0}}function Vy(e){return $y(e)}function $y(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function vc(e){return Ky(e)}function Ky(e,t){return e==null?e:{name:e.name,authType:Jp(e.authType),baseURL:e.baseURL,defaultModule:e.defaultModule,oauth2Opts:E(e,"oauth2Opts")?Dy(e.oauth2Opts):void 0,apiKeyOpts:E(e,"apiKeyOpts")?Lp(e.apiKeyOpts):void 0,basicOpts:E(e,"basicOpts")?qh(e.basicOpts):void 0,customOpts:E(e,"customOpts")?Ug(e.customOpts):void 0,support:el(e.support),providerOpts:e.providerOpts,authHealthCheck:E(e,"authHealthCheck")?qp(e.authHealthCheck):void 0,displayName:E(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:E(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:E(e,"media")?wy(e.media):void 0,labels:E(e,"labels")?e.labels:void 0,subscribeOpts:E(e,"subscribeOpts")?Vy(e.subscribeOpts):void 0,modules:E(e,"modules")?qe(e.modules,Ny):void 0,metadata:E(e,"metadata")?jy(e.metadata):void 0}}function Uy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:jm(e.connection)}}function qy(e){if(e!==void 0)return e===null?null:{provider:e.provider,module:e.module,read:ph(e.read),write:Ph(e.write),proxy:Uu(e.proxy)}}function By(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:qy(e.content)}}function Jy(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:By(e.config)}}function Hy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:Jy(e.installation)}}function Wy(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function zy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:Wy(e.project)}}function Qy(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 Gy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:Qy(e.providerApp)}}class Xy extends rn{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Hr(o)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:zg(t.generateConnectionParams)},n);return new Me(o,s=>yi(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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={};t.includeCreds!==void 0&&(r.includeCreds=t.includeCreds),t.includeRefreshToken!==void 0&&(r.includeRefreshToken=t.includeRefreshToken),t.refresh!==void 0&&(r.refresh=t.refresh);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Me(o,s=>yi(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 ie("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={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Me(o,s=>s.map(yi))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}async updateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling updateConnection.");if(t.updateConnectionRequest===null||t.updateConnectionRequest===void 0)throw new ie("updateConnectionRequest","Required parameter requestParameters.updateConnectionRequest was null or undefined when calling updateConnection.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:i,query:r,body:Uy(t.updateConnectionRequest)},n);return new Me(o,s=>yi(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class Yy extends rn{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new ie("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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:Um(t.installation)},n);return new Me(o,s=>hi(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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Hr(o)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Me(o,s=>hi(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Me(o,s=>s.map(hi))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async listInstallationsForProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallationsForProject.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Me(o,s=>s.map(hi))}async listInstallationsForProject(t,n){return await(await this.listInstallationsForProjectRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new ie("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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:Hy(t.installationUpdate)},n);return new Me(o,s=>hi(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class Zy extends rn{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new ie("batchUpsertIntegrationsRequest","Required parameter requestParameters.batchUpsertIntegrationsRequest was null or undefined when calling batchUpsertIntegrations.");const r={};t.destructive!==void 0&&(r.destructive=t.destructive);const i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:i,query:r,body:Jh(t.batchUpsertIntegrationsRequest)},n);return new Me(o,s=>s.map(ns))}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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new ie("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:Fg(t.integration)},n);return new Hr(o)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Hr(o)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async getIntegrationRaw(t,n){if(t.integrationIdOrName===null||t.integrationIdOrName===void 0)throw new ie("integrationIdOrName","Required parameter requestParameters.integrationIdOrName was null or undefined when calling getIntegration.");if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getIntegration.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationIdOrName}".replace("{integrationIdOrName}",encodeURIComponent(String(t.integrationIdOrName))).replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Me(o,s=>ns(s))}async getIntegration(t,n){return await(await this.getIntegrationRaw(t,n)).value()}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Me(o,s=>s.map(ns))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class ev extends rn{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new ie("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/oauth-connect",method:"POST",headers:i,query:r,body:ky(t.connectOAuthParams)},n);return this.isJsonMime(o.headers.get("content-type"))?new Me(o):new hc(o)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}async oauthUpdateRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling oauthUpdate.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling oauthUpdate.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}:oauth-update".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:i,query:r},n);return this.isJsonMime(o.headers.get("content-type"))?new Me(o):new hc(o)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class tv extends rn{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new ie("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects",method:"POST",headers:i,query:r,body:Pg(t.project)},n);return new Me(o,s=>Yi(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={};t.includeEntitlements!==void 0&&(r.includeEntitlements=t.includeEntitlements);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Me(o,s=>Yi(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};if(this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const o=this.configuration.accessToken,s=await o("Bearer",[]);s&&(r.Authorization=`Bearer ${s}`)}const i=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new Me(i,o=>o.map(Yi))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new ie("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:i,query:r,body:zy(t.projectUpdate)},n);return new Me(o,s=>Yi(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class nv extends rn{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new ie("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:i,query:r},n);return new Me(o,s=>vc(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};if(this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const o=this.configuration.accessToken,s=await o("Bearer",[]);s&&(r.Authorization=`Bearer ${s}`)}const i=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new Me(i,o=>qe(o,vc))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class rv extends rn{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new ie("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:Dg(t.providerApp)},n);return new Me(o,s=>ao(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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ie("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Hr(o)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Me(o,s=>s.map(ao))}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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ie("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new ie("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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:Gy(t.providerAppUpdate)},n);return new Me(o,s=>ao(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class iv extends rn{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new ie("revision","Required parameter requestParameters.revision was null or undefined when calling createRevision.");const r={};t.destructive!==void 0&&(r.destructive=t.destructive);const i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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:Mg(t.revision)},n);return new Hr(o)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new ie("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Me(o,s=>uy(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}var ii=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ov={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Zt,lr,Eu,sv=(Eu=class{constructor(){oe(this,Zt,ov);oe(this,lr,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&_(this,lr)&&e!==_(this,Zt)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:_(this,Zt),provider:e}),Q(this,Zt,e),process.env.NODE_ENV!=="production"&&Q(this,lr,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&Q(this,lr,!0),_(this,Zt).setTimeout(e,t)}clearTimeout(e){_(this,Zt).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&Q(this,lr,!0),_(this,Zt).setInterval(e,t)}clearInterval(e){_(this,Zt).clearInterval(e)}},Zt=new WeakMap,lr=new WeakMap,Eu),cr=new sv;function av(e){setTimeout(e,0)}var Ir=typeof window>"u"||"Deno"in globalThis;function gt(){}function cv(e,t){return typeof e=="function"?e(t):e}function Is(e){return typeof e=="number"&&e>=0&&e!==1/0}function tl(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Wn(e,t){return typeof e=="function"?e(t):e}function Lt(e,t){return typeof e=="function"?e(t):e}function wc(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==aa(s,t.options))return!1}else if(!Ci(t.queryKey,s))return!1}if(n!=="all"){const u=t.isActive();if(n==="active"&&!u||n==="inactive"&&u)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||i&&i!==t.state.fetchStatus||o&&!o(t))}function bc(e,t){const{exact:n,status:r,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(Cr(t.options.mutationKey)!==Cr(o))return!1}else if(!Ci(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function aa(e,t){return((t==null?void 0:t.queryKeyHashFn)||Cr)(e)}function Cr(e){return JSON.stringify(e,(t,n)=>xs(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function Ci(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Ci(e[n],t[n])):!1}var uv=Object.prototype.hasOwnProperty;function Cs(e,t){if(e===t)return e;const n=Ic(e)&&Ic(t);if(!n&&!(xs(e)&&xs(t)))return t;const i=(n?e:Object.keys(e)).length,o=n?t:Object.keys(t),s=o.length,a=n?new Array(s):{};let u=0;for(let f=0;f<s;f++){const l=n?f:o[f],d=e[l],h=t[l];if(d===h){a[l]=d,(n?f<i:uv.call(e,l))&&u++;continue}if(d===null||h===null||typeof d!="object"||typeof h!="object"){a[l]=h;continue}const m=Cs(d,h);a[l]=m,m===d&&u++}return i===s&&u===i?e:a}function ho(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Ic(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function xs(e){if(!Cc(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Cc(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Cc(e){return Object.prototype.toString.call(e)==="[object Object]"}function lv(e){return new Promise(t=>{cr.setTimeout(t,e)})}function Os(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Cs(e,t)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return Cs(e,t)}return t}function dv(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function fv(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var mo=Symbol();function nl(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===mo&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===mo?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function rl(e,t){return typeof e=="function"?e(...t):!!e}var dr,Ln,Dr,Nu,pv=(Nu=class extends ii{constructor(){super();oe(this,dr);oe(this,Ln);oe(this,Dr);Q(this,Dr,t=>{if(!Ir&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){_(this,Ln)||this.setEventListener(_(this,Dr))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,Ln))==null||t.call(this),Q(this,Ln,void 0))}setEventListener(t){var n;Q(this,Dr,t),(n=_(this,Ln))==null||n.call(this),Q(this,Ln,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){_(this,dr)!==t&&(Q(this,dr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof _(this,dr)=="boolean"?_(this,dr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},dr=new WeakMap,Ln=new WeakMap,Dr=new WeakMap,Nu),ca=new pv;function _s(){let e,t;const n=new Promise((i,o)=>{e=i,t=o});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}var hv=av;function mv(){let e=[],t=0,n=a=>{a()},r=a=>{a()},i=hv;const o=a=>{t?e.push(a):i(()=>{n(a)})},s=()=>{const a=e;e=[],a.length&&i(()=>{r(()=>{a.forEach(u=>{n(u)})})})};return{batch:a=>{let u;t++;try{u=a()}finally{t--,t||s()}return u},batchCalls:a=>(...u)=>{o(()=>{a(...u)})},schedule:o,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var Ge=mv(),Mr,Vn,kr,Tu,gv=(Tu=class extends ii{constructor(){super();oe(this,Mr,!0);oe(this,Vn);oe(this,kr);Q(this,kr,t=>{if(!Ir&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){_(this,Vn)||this.setEventListener(_(this,kr))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,Vn))==null||t.call(this),Q(this,Vn,void 0))}setEventListener(t){var n;Q(this,kr,t),(n=_(this,Vn))==null||n.call(this),Q(this,Vn,t(this.setOnline.bind(this)))}setOnline(t){_(this,Mr)!==t&&(Q(this,Mr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return _(this,Mr)}},Mr=new WeakMap,Vn=new WeakMap,kr=new WeakMap,Tu),go=new gv;function yv(e){return Math.min(1e3*2**e,3e4)}function il(e){return(e??"online")==="online"?go.isOnline():!0}var Ss=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function ol(e){let t=!1,n=0,r;const i=_s(),o=()=>i.status!=="pending",s=w=>{var g;if(!o()){const O=new Ss(w);h(O),(g=e.onCancel)==null||g.call(e,O)}},a=()=>{t=!0},u=()=>{t=!1},f=()=>ca.isFocused()&&(e.networkMode==="always"||go.isOnline())&&e.canRun(),l=()=>il(e.networkMode)&&e.canRun(),d=w=>{o()||(r==null||r(),i.resolve(w))},h=w=>{o()||(r==null||r(),i.reject(w))},m=()=>new Promise(w=>{var g;r=O=>{(o()||f())&&w(O)},(g=e.onPause)==null||g.call(e)}).then(()=>{var w;r=void 0,o()||(w=e.onContinue)==null||w.call(e)}),y=()=>{if(o())return;let w;const g=n===0?e.initialPromise:void 0;try{w=g??e.fn()}catch(O){w=Promise.reject(O)}Promise.resolve(w).then(d).catch(O=>{var S;if(o())return;const p=e.retry??(Ir?0:3),b=e.retryDelay??yv,v=typeof b=="function"?b(n,O):b,x=p===!0||typeof p=="number"&&n<p||typeof p=="function"&&p(n,O);if(t||!x){h(O);return}n++,(S=e.onFail)==null||S.call(e,n,O),lv(v).then(()=>f()?void 0:m()).then(()=>{t?h(O):y()})})};return{promise:i,status:()=>i.status,cancel:s,continue:()=>(r==null||r(),i),cancelRetry:a,continueRetry:u,canStart:l,start:()=>(l()?y():m().then(y),i)}}var fr,Ru,sl=(Ru=class{constructor(){oe(this,fr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Is(this.gcTime)&&Q(this,fr,cr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ir?1/0:5*60*1e3))}clearGcTimeout(){_(this,fr)&&(cr.clearTimeout(_(this,fr)),Q(this,fr,void 0))}},fr=new WeakMap,Ru),pr,jr,jt,hr,nt,Ti,mr,Bt,yn,Au,vv=(Au=class extends sl{constructor(t){super();oe(this,Bt);oe(this,pr);oe(this,jr);oe(this,jt);oe(this,hr);oe(this,nt);oe(this,Ti);oe(this,mr);Q(this,mr,!1),Q(this,Ti,t.defaultOptions),this.setOptions(t.options),this.observers=[],Q(this,hr,t.client),Q(this,jt,_(this,hr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Q(this,pr,xc(this.options)),this.state=t.state??_(this,pr),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=_(this,nt))==null?void 0:t.promise}setOptions(t){if(this.options={..._(this,Ti),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=xc(this.options);n.data!==void 0&&(this.setData(n.data,{updatedAt:n.dataUpdatedAt,manual:!0}),Q(this,pr,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&_(this,jt).remove(this)}setData(t,n){const r=Os(this.state.data,t,this.options);return me(this,Bt,yn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){me(this,Bt,yn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,i;const n=(r=_(this,nt))==null?void 0:r.promise;return(i=_(this,nt))==null||i.cancel(t),n?n.then(gt).catch(gt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(_(this,pr))}isActive(){return this.observers.some(t=>Lt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===mo||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Wn(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!tl(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,nt))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,nt))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),_(this,jt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(_(this,nt)&&(_(this,mr)?_(this,nt).cancel({revert:!0}):_(this,nt).cancelRetry()),this.scheduleGc()),_(this,jt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||me(this,Bt,yn).call(this,{type:"invalidate"})}async fetch(t,n){var u,f,l,d,h,m,y,w,g,O,p,b;if(this.state.fetchStatus!=="idle"&&((u=_(this,nt))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(_(this,nt))return _(this,nt).continueRetry(),_(this,nt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const v=this.observers.find(x=>x.options.queryFn);v&&this.setOptions(v.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,i=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(Q(this,mr,!0),r.signal)})},o=()=>{const v=nl(this.options,n),S=(()=>{const A={client:_(this,hr),queryKey:this.queryKey,meta:this.meta};return i(A),A})();return Q(this,mr,!1),this.options.persister?this.options.persister(v,S,this):v(S)},a=(()=>{const v={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:_(this,hr),state:this.state,fetchFn:o};return i(v),v})();(f=this.options.behavior)==null||f.onFetch(a,this),Q(this,jr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((l=a.fetchOptions)==null?void 0:l.meta))&&me(this,Bt,yn).call(this,{type:"fetch",meta:(d=a.fetchOptions)==null?void 0:d.meta}),Q(this,nt,ol({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:v=>{v instanceof Ss&&v.revert&&this.setState({..._(this,jr),fetchStatus:"idle"}),r.abort()},onFail:(v,x)=>{me(this,Bt,yn).call(this,{type:"failed",failureCount:v,error:x})},onPause:()=>{me(this,Bt,yn).call(this,{type:"pause"})},onContinue:()=>{me(this,Bt,yn).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const v=await _(this,nt).start();if(v===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(v),(m=(h=_(this,jt).config).onSuccess)==null||m.call(h,v,this),(w=(y=_(this,jt).config).onSettled)==null||w.call(y,v,this.state.error,this),v}catch(v){if(v instanceof Ss){if(v.silent)return _(this,nt).promise;if(v.revert){if(this.state.data===void 0)throw v;return this.state.data}}throw me(this,Bt,yn).call(this,{type:"error",error:v}),(O=(g=_(this,jt).config).onError)==null||O.call(g,v,this),(b=(p=_(this,jt).config).onSettled)==null||b.call(p,this.state.data,v,this),v}finally{this.scheduleGc()}}},pr=new WeakMap,jr=new WeakMap,jt=new WeakMap,hr=new WeakMap,nt=new WeakMap,Ti=new WeakMap,mr=new WeakMap,Bt=new WeakSet,yn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...al(r.data,this.options),fetchMeta:t.meta??null};case"success":const i={...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Q(this,jr,t.manual?i:void 0),i;case"error":const o=t.error;return{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Ge.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),_(this,jt).notify({query:this,type:"updated",action:t})})},Au);function al(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:il(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function xc(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var It,Ie,Ri,ht,gr,Lr,vn,$n,Ai,Vr,$r,yr,vr,Kn,Kr,Re,vi,Es,Ns,Ts,Rs,As,Fs,Ps,cl,Fu,wv=(Fu=class extends ii{constructor(t,n){super();oe(this,Re);oe(this,It);oe(this,Ie);oe(this,Ri);oe(this,ht);oe(this,gr);oe(this,Lr);oe(this,vn);oe(this,$n);oe(this,Ai);oe(this,Vr);oe(this,$r);oe(this,yr);oe(this,vr);oe(this,Kn);oe(this,Kr,new Set);this.options=n,Q(this,It,t),Q(this,$n,null),Q(this,vn,_s()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(_(this,Ie).addObserver(this),Oc(_(this,Ie),this.options)?me(this,Re,vi).call(this):this.updateResult(),me(this,Re,Rs).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ds(_(this,Ie),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ds(_(this,Ie),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,me(this,Re,As).call(this),me(this,Re,Fs).call(this),_(this,Ie).removeObserver(this)}setOptions(t){const n=this.options,r=_(this,Ie);if(this.options=_(this,It).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Lt(this.options.enabled,_(this,Ie))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");me(this,Re,Ps).call(this),_(this,Ie).setOptions(this.options),n._defaulted&&!ho(this.options,n)&&_(this,It).getQueryCache().notify({type:"observerOptionsUpdated",query:_(this,Ie),observer:this});const i=this.hasListeners();i&&_c(_(this,Ie),r,this.options,n)&&me(this,Re,vi).call(this),this.updateResult(),i&&(_(this,Ie)!==r||Lt(this.options.enabled,_(this,Ie))!==Lt(n.enabled,_(this,Ie))||Wn(this.options.staleTime,_(this,Ie))!==Wn(n.staleTime,_(this,Ie)))&&me(this,Re,Es).call(this);const o=me(this,Re,Ns).call(this);i&&(_(this,Ie)!==r||Lt(this.options.enabled,_(this,Ie))!==Lt(n.enabled,_(this,Ie))||o!==_(this,Kn))&&me(this,Re,Ts).call(this,o)}getOptimisticResult(t){const n=_(this,It).getQueryCache().build(_(this,It),t),r=this.createResult(n,t);return Iv(this,r)&&(Q(this,ht,r),Q(this,Lr,this.options),Q(this,gr,_(this,Ie).state)),r}getCurrentResult(){return _(this,ht)}trackResult(t,n){return new Proxy(t,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&_(this,vn).status==="pending"&&_(this,vn).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(t){_(this,Kr).add(t)}getCurrentQuery(){return _(this,Ie)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=_(this,It).defaultQueryOptions(t),r=_(this,It).getQueryCache().build(_(this,It),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return me(this,Re,vi).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),_(this,ht)))}createResult(t,n){var F;const r=_(this,Ie),i=this.options,o=_(this,ht),s=_(this,gr),a=_(this,Lr),f=t!==r?t.state:_(this,Ri),{state:l}=t;let d={...l},h=!1,m;if(n._optimisticResults){const R=this.hasListeners(),D=!R&&Oc(t,n),K=R&&_c(t,r,n,i);(D||K)&&(d={...d,...al(l.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:y,errorUpdatedAt:w,status:g}=d;m=d.data;let O=!1;if(n.placeholderData!==void 0&&m===void 0&&g==="pending"){let R;o!=null&&o.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(R=o.data,O=!0):R=typeof n.placeholderData=="function"?n.placeholderData((F=_(this,$r))==null?void 0:F.state.data,_(this,$r)):n.placeholderData,R!==void 0&&(g="success",m=Os(o==null?void 0:o.data,R,n),h=!0)}if(n.select&&m!==void 0&&!O)if(o&&m===(s==null?void 0:s.data)&&n.select===_(this,Ai))m=_(this,Vr);else try{Q(this,Ai,n.select),m=n.select(m),m=Os(o==null?void 0:o.data,m,n),Q(this,Vr,m),Q(this,$n,null)}catch(R){Q(this,$n,R)}_(this,$n)&&(y=_(this,$n),m=_(this,Vr),w=Date.now(),g="error");const p=d.fetchStatus==="fetching",b=g==="pending",v=g==="error",x=b&&p,S=m!==void 0,N={status:g,fetchStatus:d.fetchStatus,isPending:b,isSuccess:g==="success",isError:v,isInitialLoading:x,isLoading:x,data:m,dataUpdatedAt:d.dataUpdatedAt,error:y,errorUpdatedAt:w,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>f.dataUpdateCount||d.errorUpdateCount>f.errorUpdateCount,isFetching:p,isRefetching:p&&!b,isLoadingError:v&&!S,isPaused:d.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:v&&S,isStale:ua(t,n),refetch:this.refetch,promise:_(this,vn),isEnabled:Lt(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const R=j=>{N.status==="error"?j.reject(N.error):N.data!==void 0&&j.resolve(N.data)},D=()=>{const j=Q(this,vn,N.promise=_s());R(j)},K=_(this,vn);switch(K.status){case"pending":t.queryHash===r.queryHash&&R(K);break;case"fulfilled":(N.status==="error"||N.data!==K.value)&&D();break;case"rejected":(N.status!=="error"||N.error!==K.reason)&&D();break}}return N}updateResult(){const t=_(this,ht),n=this.createResult(_(this,Ie),this.options);if(Q(this,gr,_(this,Ie).state),Q(this,Lr,this.options),_(this,gr).data!==void 0&&Q(this,$r,_(this,Ie)),ho(n,t))return;Q(this,ht,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,o=typeof i=="function"?i():i;if(o==="all"||!o&&!_(this,Kr).size)return!0;const s=new Set(o??_(this,Kr));return this.options.throwOnError&&s.add("error"),Object.keys(_(this,ht)).some(a=>{const u=a;return _(this,ht)[u]!==t[u]&&s.has(u)})};me(this,Re,cl).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&me(this,Re,Rs).call(this)}},It=new WeakMap,Ie=new WeakMap,Ri=new WeakMap,ht=new WeakMap,gr=new WeakMap,Lr=new WeakMap,vn=new WeakMap,$n=new WeakMap,Ai=new WeakMap,Vr=new WeakMap,$r=new WeakMap,yr=new WeakMap,vr=new WeakMap,Kn=new WeakMap,Kr=new WeakMap,Re=new WeakSet,vi=function(t){me(this,Re,Ps).call(this);let n=_(this,Ie).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(gt)),n},Es=function(){me(this,Re,As).call(this);const t=Wn(this.options.staleTime,_(this,Ie));if(Ir||_(this,ht).isStale||!Is(t))return;const r=tl(_(this,ht).dataUpdatedAt,t)+1;Q(this,yr,cr.setTimeout(()=>{_(this,ht).isStale||this.updateResult()},r))},Ns=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(_(this,Ie)):this.options.refetchInterval)??!1},Ts=function(t){me(this,Re,Fs).call(this),Q(this,Kn,t),!(Ir||Lt(this.options.enabled,_(this,Ie))===!1||!Is(_(this,Kn))||_(this,Kn)===0)&&Q(this,vr,cr.setInterval(()=>{(this.options.refetchIntervalInBackground||ca.isFocused())&&me(this,Re,vi).call(this)},_(this,Kn)))},Rs=function(){me(this,Re,Es).call(this),me(this,Re,Ts).call(this,me(this,Re,Ns).call(this))},As=function(){_(this,yr)&&(cr.clearTimeout(_(this,yr)),Q(this,yr,void 0))},Fs=function(){_(this,vr)&&(cr.clearInterval(_(this,vr)),Q(this,vr,void 0))},Ps=function(){const t=_(this,It).getQueryCache().build(_(this,It),this.options);if(t===_(this,Ie))return;const n=_(this,Ie);Q(this,Ie,t),Q(this,Ri,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},cl=function(t){Ge.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(_(this,ht))}),_(this,It).getQueryCache().notify({query:_(this,Ie),type:"observerResultsUpdated"})})},Fu);function bv(e,t){return Lt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Oc(e,t){return bv(e,t)||e.state.data!==void 0&&Ds(e,t,t.refetchOnMount)}function Ds(e,t,n){if(Lt(t.enabled,e)!==!1&&Wn(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&ua(e,t)}return!1}function _c(e,t,n,r){return(e!==t||Lt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&ua(e,n)}function ua(e,t){return Lt(t.enabled,e)!==!1&&e.isStaleByTime(Wn(t.staleTime,e))}function Iv(e,t){return!ho(e.getCurrentResult(),t)}function Sc(e){return{onFetch:(t,n)=>{var l,d,h,m,y;const r=t.options,i=(h=(d=(l=t.fetchOptions)==null?void 0:l.meta)==null?void 0:d.fetchMore)==null?void 0:h.direction,o=((m=t.state.data)==null?void 0:m.pages)||[],s=((y=t.state.data)==null?void 0:y.pageParams)||[];let a={pages:[],pageParams:[]},u=0;const f=async()=>{let w=!1;const g=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(t.signal.aborted?w=!0:t.signal.addEventListener("abort",()=>{w=!0}),t.signal)})},O=nl(t.options,t.fetchOptions),p=async(b,v,x)=>{if(w)return Promise.reject();if(v==null&&b.pages.length)return Promise.resolve(b);const A=(()=>{const D={client:t.client,queryKey:t.queryKey,pageParam:v,direction:x?"backward":"forward",meta:t.options.meta};return g(D),D})(),N=await O(A),{maxPages:F}=t.options,R=x?fv:dv;return{pages:R(b.pages,N,F),pageParams:R(b.pageParams,v,F)}};if(i&&o.length){const b=i==="backward",v=b?Cv:Ec,x={pages:o,pageParams:s},S=v(r,x);a=await p(x,S,b)}else{const b=e??o.length;do{const v=u===0?s[0]??r.initialPageParam:Ec(r,a);if(u>0&&v==null)break;a=await p(a,v),u++}while(u<b)}return a};t.options.persister?t.fetchFn=()=>{var w,g;return(g=(w=t.options).persister)==null?void 0:g.call(w,f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=f}}}function Ec(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Cv(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var Fi,en,mt,wr,tn,kn,Pu,xv=(Pu=class extends sl{constructor(t){super();oe(this,tn);oe(this,Fi);oe(this,en);oe(this,mt);oe(this,wr);Q(this,Fi,t.client),this.mutationId=t.mutationId,Q(this,mt,t.mutationCache),Q(this,en,[]),this.state=t.state||ul(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){_(this,en).includes(t)||(_(this,en).push(t),this.clearGcTimeout(),_(this,mt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Q(this,en,_(this,en).filter(n=>n!==t)),this.scheduleGc(),_(this,mt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){_(this,en).length||(this.state.status==="pending"?this.scheduleGc():_(this,mt).remove(this))}continue(){var t;return((t=_(this,wr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var s,a,u,f,l,d,h,m,y,w,g,O,p,b,v,x,S,A,N,F;const n=()=>{me(this,tn,kn).call(this,{type:"continue"})},r={client:_(this,Fi),meta:this.options.meta,mutationKey:this.options.mutationKey};Q(this,wr,ol({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(R,D)=>{me(this,tn,kn).call(this,{type:"failed",failureCount:R,error:D})},onPause:()=>{me(this,tn,kn).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>_(this,mt).canRun(this)}));const i=this.state.status==="pending",o=!_(this,wr).canStart();try{if(i)n();else{me(this,tn,kn).call(this,{type:"pending",variables:t,isPaused:o}),await((a=(s=_(this,mt).config).onMutate)==null?void 0:a.call(s,t,this,r));const D=await((f=(u=this.options).onMutate)==null?void 0:f.call(u,t,r));D!==this.state.context&&me(this,tn,kn).call(this,{type:"pending",context:D,variables:t,isPaused:o})}const R=await _(this,wr).start();return await((d=(l=_(this,mt).config).onSuccess)==null?void 0:d.call(l,R,t,this.state.context,this,r)),await((m=(h=this.options).onSuccess)==null?void 0:m.call(h,R,t,this.state.context,r)),await((w=(y=_(this,mt).config).onSettled)==null?void 0:w.call(y,R,null,this.state.variables,this.state.context,this,r)),await((O=(g=this.options).onSettled)==null?void 0:O.call(g,R,null,t,this.state.context,r)),me(this,tn,kn).call(this,{type:"success",data:R}),R}catch(R){try{throw await((b=(p=_(this,mt).config).onError)==null?void 0:b.call(p,R,t,this.state.context,this,r)),await((x=(v=this.options).onError)==null?void 0:x.call(v,R,t,this.state.context,r)),await((A=(S=_(this,mt).config).onSettled)==null?void 0:A.call(S,void 0,R,this.state.variables,this.state.context,this,r)),await((F=(N=this.options).onSettled)==null?void 0:F.call(N,void 0,R,t,this.state.context,r)),R}finally{me(this,tn,kn).call(this,{type:"error",error:R})}}finally{_(this,mt).runNext(this)}}},Fi=new WeakMap,en=new WeakMap,mt=new WeakMap,wr=new WeakMap,tn=new WeakSet,kn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Ge.batch(()=>{_(this,en).forEach(r=>{r.onMutationUpdate(t)}),_(this,mt).notify({mutation:this,type:"updated",action:t})})},Pu);function ul(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var wn,Jt,Pi,Du,Ov=(Du=class extends ii{constructor(t={}){super();oe(this,wn);oe(this,Jt);oe(this,Pi);this.config=t,Q(this,wn,new Set),Q(this,Jt,new Map),Q(this,Pi,0)}build(t,n,r){const i=new xv({client:t,mutationCache:this,mutationId:++Xi(this,Pi)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){_(this,wn).add(t);const n=Zi(t);if(typeof n=="string"){const r=_(this,Jt).get(n);r?r.push(t):_(this,Jt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(_(this,wn).delete(t)){const n=Zi(t);if(typeof n=="string"){const r=_(this,Jt).get(n);if(r)if(r.length>1){const i=r.indexOf(t);i!==-1&&r.splice(i,1)}else r[0]===t&&_(this,Jt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Zi(t);if(typeof n=="string"){const r=_(this,Jt).get(n),i=r==null?void 0:r.find(o=>o.state.status==="pending");return!i||i===t}else return!0}runNext(t){var r;const n=Zi(t);if(typeof n=="string"){const i=(r=_(this,Jt).get(n))==null?void 0:r.find(o=>o!==t&&o.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Ge.batch(()=>{_(this,wn).forEach(t=>{this.notify({type:"removed",mutation:t})}),_(this,wn).clear(),_(this,Jt).clear()})}getAll(){return Array.from(_(this,wn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>bc(n,r))}findAll(t={}){return this.getAll().filter(n=>bc(t,n))}notify(t){Ge.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Ge.batch(()=>Promise.all(t.map(n=>n.continue().catch(gt))))}},wn=new WeakMap,Jt=new WeakMap,Pi=new WeakMap,Du);function Zi(e){var t;return(t=e.options.scope)==null?void 0:t.id}var bn,Un,Ct,In,xn,co,Ms,Mu,_v=(Mu=class extends ii{constructor(n,r){super();oe(this,xn);oe(this,bn);oe(this,Un);oe(this,Ct);oe(this,In);Q(this,bn,n),this.setOptions(r),this.bindMethods(),me(this,xn,co).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var i;const r=this.options;this.options=_(this,bn).defaultMutationOptions(n),ho(this.options,r)||_(this,bn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:_(this,Ct),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Cr(r.mutationKey)!==Cr(this.options.mutationKey)?this.reset():((i=_(this,Ct))==null?void 0:i.state.status)==="pending"&&_(this,Ct).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=_(this,Ct))==null||n.removeObserver(this)}onMutationUpdate(n){me(this,xn,co).call(this),me(this,xn,Ms).call(this,n)}getCurrentResult(){return _(this,Un)}reset(){var n;(n=_(this,Ct))==null||n.removeObserver(this),Q(this,Ct,void 0),me(this,xn,co).call(this),me(this,xn,Ms).call(this)}mutate(n,r){var i;return Q(this,In,r),(i=_(this,Ct))==null||i.removeObserver(this),Q(this,Ct,_(this,bn).getMutationCache().build(_(this,bn),this.options)),_(this,Ct).addObserver(this),_(this,Ct).execute(n)}},bn=new WeakMap,Un=new WeakMap,Ct=new WeakMap,In=new WeakMap,xn=new WeakSet,co=function(){var r;const n=((r=_(this,Ct))==null?void 0:r.state)??ul();Q(this,Un,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Ms=function(n){Ge.batch(()=>{var r,i,o,s,a,u,f,l;if(_(this,In)&&this.hasListeners()){const d=_(this,Un).variables,h=_(this,Un).context,m={client:_(this,bn),meta:this.options.meta,mutationKey:this.options.mutationKey};(n==null?void 0:n.type)==="success"?((i=(r=_(this,In)).onSuccess)==null||i.call(r,n.data,d,h,m),(s=(o=_(this,In)).onSettled)==null||s.call(o,n.data,null,d,h,m)):(n==null?void 0:n.type)==="error"&&((u=(a=_(this,In)).onError)==null||u.call(a,n.error,d,h,m),(l=(f=_(this,In)).onSettled)==null||l.call(f,void 0,n.error,d,h,m))}this.listeners.forEach(d=>{d(_(this,Un))})})},Mu),nn,ku,Sv=(ku=class extends ii{constructor(t={}){super();oe(this,nn);this.config=t,Q(this,nn,new Map)}build(t,n,r){const i=n.queryKey,o=n.queryHash??aa(i,n);let s=this.get(o);return s||(s=new vv({client:t,queryKey:i,queryHash:o,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(s)),s}add(t){_(this,nn).has(t.queryHash)||(_(this,nn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=_(this,nn).get(t.queryHash);n&&(t.destroy(),n===t&&_(this,nn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ge.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return _(this,nn).get(t)}getAll(){return[..._(this,nn).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>wc(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>wc(t,r)):n}notify(t){Ge.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Ge.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ge.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},nn=new WeakMap,ku),$e,qn,Bn,Ur,qr,Jn,Br,Jr,ju,Ev=(ju=class{constructor(e={}){oe(this,$e);oe(this,qn);oe(this,Bn);oe(this,Ur);oe(this,qr);oe(this,Jn);oe(this,Br);oe(this,Jr);Q(this,$e,e.queryCache||new Sv),Q(this,qn,e.mutationCache||new Ov),Q(this,Bn,e.defaultOptions||{}),Q(this,Ur,new Map),Q(this,qr,new Map),Q(this,Jn,0)}mount(){Xi(this,Jn)._++,_(this,Jn)===1&&(Q(this,Br,ca.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,$e).onFocus())})),Q(this,Jr,go.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,$e).onOnline())})))}unmount(){var e,t;Xi(this,Jn)._--,_(this,Jn)===0&&((e=_(this,Br))==null||e.call(this),Q(this,Br,void 0),(t=_(this,Jr))==null||t.call(this),Q(this,Jr,void 0))}isFetching(e){return _(this,$e).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return _(this,qn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,$e).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=_(this,$e).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Wn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return _(this,$e).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=_(this,$e).get(r.queryHash),o=i==null?void 0:i.state.data,s=cv(t,o);if(s!==void 0)return _(this,$e).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return Ge.batch(()=>_(this,$e).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,$e).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=_(this,$e);Ge.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=_(this,$e);return Ge.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Ge.batch(()=>_(this,$e).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(gt).catch(gt)}invalidateQueries(e,t={}){return Ge.batch(()=>(_(this,$e).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Ge.batch(()=>_(this,$e).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(gt)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(gt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=_(this,$e).build(this,t);return n.isStaleByTime(Wn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(gt).catch(gt)}fetchInfiniteQuery(e){return e.behavior=Sc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(gt).catch(gt)}ensureInfiniteQueryData(e){return e.behavior=Sc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return go.isOnline()?_(this,qn).resumePausedMutations():Promise.resolve()}getQueryCache(){return _(this,$e)}getMutationCache(){return _(this,qn)}getDefaultOptions(){return _(this,Bn)}setDefaultOptions(e){Q(this,Bn,e)}setQueryDefaults(e,t){_(this,Ur).set(Cr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[..._(this,Ur).values()],n={};return t.forEach(r=>{Ci(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){_(this,qr).set(Cr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[..._(this,qr).values()],n={};return t.forEach(r=>{Ci(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={..._(this,Bn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=aa(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===mo&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{..._(this,Bn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){_(this,$e).clear(),_(this,qn).clear()}},$e=new WeakMap,qn=new WeakMap,Bn=new WeakMap,Ur=new WeakMap,qr=new WeakMap,Jn=new WeakMap,Br=new WeakMap,Jr=new WeakMap,ju),ll=B.createContext(void 0),We=e=>{const t=B.useContext(ll);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Nv=({client:e,children:t})=>(B.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(ll.Provider,{value:e,children:t})),dl=B.createContext(!1),Tv=()=>B.useContext(dl);dl.Provider;function Rv(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Av=B.createContext(Rv()),Fv=()=>B.useContext(Av),Pv=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Dv=e=>{B.useEffect(()=>{e.clearReset()},[e])},Mv=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||rl(n,[e.error,r])),kv=e=>{if(e.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},jv=(e,t)=>e.isLoading&&e.isFetching&&!t,Lv=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Nc=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Vv(e,t,n){var d,h,m,y,w;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=Tv(),i=Fv(),o=We(),s=o.defaultQueryOptions(e);(h=(d=o.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||h.call(d,s),process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),s._optimisticResults=r?"isRestoring":"optimistic",kv(s),Pv(s,i),Dv(i);const a=!o.getQueryCache().get(s.queryHash),[u]=B.useState(()=>new t(o,s)),f=u.getOptimisticResult(s),l=!r&&e.subscribed!==!1;if(B.useSyncExternalStore(B.useCallback(g=>{const O=l?u.subscribe(Ge.batchCalls(g)):gt;return u.updateResult(),O},[u,l]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),B.useEffect(()=>{u.setOptions(s)},[s,u]),Lv(s,f))throw Nc(s,u,i);if(Mv({result:f,errorResetBoundary:i,throwOnError:s.throwOnError,query:o.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw f.error;if((y=(m=o.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||y.call(m,s,f),s.experimental_prefetchInRender&&!Ir&&jv(f,r)){const g=a?Nc(s,u,i):(w=o.getQueryCache().get(s.queryHash))==null?void 0:w.promise;g==null||g.catch(gt).finally(()=>{u.updateResult()})}return s.notifyOnChangeProps?f:u.trackResult(f)}function Er(e,t){return Vv(e,wv)}function On(e,t){const n=We(),[r]=B.useState(()=>new _v(n,e));B.useEffect(()=>{r.setOptions(e)},[r,e]);const i=B.useSyncExternalStore(B.useCallback(s=>r.subscribe(Ge.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),o=B.useCallback((s,a)=>{r.mutate(s,a).catch(gt)},[r]);if(i.error&&rl(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:o,mutateAsync:i.mutate}}const fl=I.createContext(null),$v=fl.Provider,pl=()=>I.useContext(fl);var we=(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.VALUE_MAPPING="valueMappingError",e))(we||{});const hl=I.createContext(void 0);function sn(){const e=I.useContext(hl);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Kv=(()=>{const e={};return Object.values(we).forEach(t=>{e[t]={}}),e})();function Uv({children:e}){const[t,n]=I.useState(Kv),r=I.useCallback((l,d,h=!0)=>{n(m=>{const y={...m};return y[l]=y[l]||{},y[l][d]=h,y})},[n]),i=I.useCallback((l,d)=>{var h;return!!((h=t[l])!=null&&h[d])},[t]),o=I.useCallback((l,d)=>{var h;return(h=t[l])==null?void 0:h[d]},[t]),s=I.useCallback((l,d)=>{n(h=>{var y;const m={...h};return(y=m[l])==null||delete y[d],m})},[n]),a=I.useCallback(l=>{n(d=>{const h={...d};return h[l]={},h})},[n]),u=I.useCallback((l,d)=>{n(h=>{const m={...h};return m[l]=m[l]||{},d.forEach(y=>{m[l][y]=!0}),m})},[n]),f=I.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:i,removeError:s,resetBoundary:a,setErrors:u,getError:o}),[t,n,r,i,s,a,u,o]);return c.jsx(hl.Provider,{value:f,children:e})}new TextEncoder;const ks=new TextDecoder;function qv(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function Bv(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof e=="string"?e:ks.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=ks.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return qv(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}class ml extends Error{constructor(n,r){var i;super(n,r);pi(this,"code","ERR_JOSE_GENERIC");this.name=this.constructor.name,(i=Error.captureStackTrace)==null||i.call(Error,this,this.constructor)}}pi(ml,"code","ERR_JOSE_GENERIC");class jn extends ml{constructor(){super(...arguments);pi(this,"code","ERR_JWT_INVALID")}}pi(jn,"code","ERR_JWT_INVALID");function Jv(e){return typeof e=="object"&&e!==null}const Hv=e=>{if(!Jv(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t};function Wv(e){if(typeof e!="string")throw new jn("JWTs must use Compact JWS serialization, JWT must be a string");const{1:t,length:n}=e.split(".");if(n===5)throw new jn("Only JWTs using Compact JWS serialization can be decoded");if(n!==3)throw new jn("Invalid JWT");if(!t)throw new jn("JWTs must contain a payload");let r;try{r=Bv(t)}catch{throw new jn("Failed to base64url decode the payload")}let i;try{i=JSON.parse(ks.decode(r))}catch{throw new jn("Failed to parse the decoded payload as JSON")}if(!Hv(i))throw new jn("Invalid JWT Claims Set");return i}const js="amp-labs_jwt_",zv=10*60*1e3,Tc=(e,t)=>`${e}:${t}`,Rc=e=>`${js}${e}`,gl=I.createContext(null),Qv=e=>{try{const t=Wv(e);return t.exp&&typeof t.exp=="number"?t.exp*1e3:null}catch(t){return console.warn("Failed to decode JWT token:",t),null}};function Gv({getTokenCallback:e,children:t}){const[n,r]=I.useState(new Map);I.useEffect(()=>{try{const u=new Map,f=Date.now();Object.keys(sessionStorage).forEach(l=>{if(l.startsWith(js)){const d=l.replace(js,""),h=sessionStorage.getItem(l);if(h)try{const m=JSON.parse(h);m.expiresAt>f?u.set(d,m):sessionStorage.removeItem(l)}catch{sessionStorage.removeItem(l)}}}),u.size>0&&r(u)}catch{console.warn("Failed to load JWT tokens from sessionStorage")}},[]);const i=I.useCallback((u,f)=>{const l=Tc(u,f),d=Date.now(),h=n.get(l);if(h&&h.expiresAt>d)return h.token;n.delete(l);const m=Rc(l),y=sessionStorage.getItem(m);if(y)try{const w=JSON.parse(y);if(w.expiresAt>d)return r(g=>new Map(g).set(l,w)),w.token;sessionStorage.removeItem(m)}catch{sessionStorage.removeItem(m)}return null},[n]),o=I.useCallback(async(u,f,l)=>{const d=Tc(u,f),m=await Qv(l)||Date.now()+zv,y={token:l,expiresAt:m};r(w=>new Map(w).set(d,y));try{sessionStorage.setItem(Rc(d),JSON.stringify(y))}catch{console.warn("Failed to store JWT token in sessionStorage")}},[]),s=I.useCallback(async({consumerRef:u,groupRef:f})=>{const l=i(u,f);if(l)return l;if(!e)throw new Error("JWT token callback not provided");try{const d=await e({consumerRef:u,groupRef:f});return await o(u,f,d),d}catch(d){throw console.error("Failed to get JWT token:",d),new Error("Failed to get JWT token")}},[e,i,o]),a={getToken:e?s:void 0};return c.jsx(gl.Provider,{value:a,children:t})}const Xv=()=>{const e=I.useContext(gl);if(!e)throw new Error("useJwtToken must be used within a JwtTokenProvider");return e},la=I.createContext(null);function Ke(){const e=I.useContext(la);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
2
- component is wrapped with AmpersandProvider`);return e}const Yv=new Ev({defaultOptions:{queries:{retry:(e,t)=>{if(t instanceof oa){const n=t.response.status;if(n>=400&&n<500)return!1}return e<3}}}});function Zv(e){const{options:{apiKey:t,projectId:n,project:r,getToken:i},children:o}=e,s=r||n;if(n&&r)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!s)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t&&!i)throw new Error("Cannot use AmpersandProvider without an apiKey or getToken.");if(t&&i)throw new Error("Cannot use AmpersandProvider with both apiKey and getToken.");const a={options:e.options,projectIdOrName:s};return c.jsx(Nv,{client:Yv,children:c.jsx(la.Provider,{value:a,children:c.jsx(Uv,{children:c.jsx(Gv,{getTokenCallback:i||null,children:c.jsx($v,{value:t||null,children:o})})})})})}var yl=Symbol.for("immer-nothing"),Ac=Symbol.for("immer-draftable"),At=Symbol.for("immer-state"),ew=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 xt(e,...t){if(process.env.NODE_ENV!=="production"){const n=ew[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 Wr=Object.getPrototypeOf;function zr(e){return!!e&&!!e[At]}function xr(e){var t;return e?vl(e)||Array.isArray(e)||!!e[Ac]||!!((t=e.constructor)!=null&&t[Ac])||Di(e)||Do(e):!1}var tw=Object.prototype.constructor.toString();function vl(e){if(!e||typeof e!="object")return!1;const t=Wr(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)===tw}function yo(e,t){Po(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Po(e){const t=e[At];return t?t.type_:Array.isArray(e)?1:Di(e)?2:Do(e)?3:0}function Ls(e,t){return Po(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function wl(e,t,n){const r=Po(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function nw(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Di(e){return e instanceof Map}function Do(e){return e instanceof Set}function ar(e){return e.copy_||e.base_}function Vs(e,t){if(Di(e))return new Map(e);if(Do(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=vl(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[At];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(Wr(e),r)}else{const r=Wr(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function da(e,t=!1){return Mo(e)||zr(e)||!xr(e)||(Po(e)>1&&Object.defineProperties(e,{set:{value:eo},add:{value:eo},clear:{value:eo},delete:{value:eo}}),Object.freeze(e),t&&Object.values(e).forEach(n=>da(n,!0))),e}function eo(){xt(2)}function Mo(e){return Object.isFrozen(e)}var rw={};function Or(e){const t=rw[e];return t||xt(0,e),t}var xi;function bl(){return xi}function iw(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Fc(e,t){t&&(Or("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function $s(e){Ks(e),e.drafts_.forEach(ow),e.drafts_=null}function Ks(e){e===xi&&(xi=e.parent_)}function Pc(e){return xi=iw(xi,e)}function ow(e){const t=e[At];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Dc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[At].modified_&&($s(t),xt(4)),xr(e)&&(e=vo(t,e),t.parent_||wo(t,e)),t.patches_&&Or("Patches").generateReplacementPatches_(n[At].base_,e,t.patches_,t.inversePatches_)):e=vo(t,n,[]),$s(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==yl?e:void 0}function vo(e,t,n){if(Mo(t))return t;const r=t[At];if(!r)return yo(t,(i,o)=>Mc(e,r,t,i,o,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return wo(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),yo(o,(a,u)=>Mc(e,r,i,a,u,n,s)),wo(e,i,!1),n&&e.patches_&&Or("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Mc(e,t,n,r,i,o,s){if(process.env.NODE_ENV!=="production"&&i===n&&xt(5),zr(i)){const a=o&&t&&t.type_!==3&&!Ls(t.assigned_,r)?o.concat(r):void 0,u=vo(e,i,a);if(wl(n,r,u),zr(u))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(xr(i)&&!Mo(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;vo(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(Di(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&wo(e,i)}}function wo(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&da(t,n)}function sw(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:bl(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=fa;n&&(i=[r],o=Oi);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,a}var fa={get(e,t){if(t===At)return e;const n=ar(e);if(!Ls(n,t))return aw(e,n,t);const r=n[t];return e.finalized_||!xr(r)?r:r===is(e.base_,t)?(os(e),e.copy_[t]=qs(r,e)):r},has(e,t){return t in ar(e)},ownKeys(e){return Reflect.ownKeys(ar(e))},set(e,t,n){const r=Il(ar(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=is(ar(e),t),o=i==null?void 0:i[At];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(nw(n,i)&&(n!==void 0||Ls(e.base_,t)))return!0;os(e),Us(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 is(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,os(e),Us(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=ar(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){xt(11)},getPrototypeOf(e){return Wr(e.base_)},setPrototypeOf(){xt(12)}},Oi={};yo(fa,(e,t)=>{Oi[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Oi.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&xt(13),Oi.set.call(this,e,t,void 0)};Oi.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&xt(14),fa.set.call(this,e[0],t,n,e[0])};function is(e,t){const n=e[At];return(n?ar(n):e)[t]}function aw(e,t,n){var i;const r=Il(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function Il(e,t){if(!(t in e))return;let n=Wr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Wr(n)}}function Us(e){e.modified_||(e.modified_=!0,e.parent_&&Us(e.parent_))}function os(e){e.copy_||(e.copy_=Vs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var cw=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(u=o,...f){return s.produce(u,l=>n.call(this,l,...f))}}typeof n!="function"&&xt(6),r!==void 0&&typeof r!="function"&&xt(7);let i;if(xr(t)){const o=Pc(this),s=qs(t,void 0);let a=!0;try{i=n(s),a=!1}finally{a?$s(o):Ks(o)}return Fc(o,r),Dc(i,o)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===yl&&(i=void 0),this.autoFreeze_&&da(i,!0),r){const o=[],s=[];Or("Patches").generateReplacementPatches_(t,i,o,s),r(o,s)}return i}else xt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,u=>t(u,...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){xr(e)||xt(8),zr(e)&&(e=uw(e));const t=Pc(this),n=qs(e,void 0);return n[At].isManual_=!0,Ks(t),n}finishDraft(e,t){const n=e&&e[At];(!n||!n.isManual_)&&xt(9);const{scope_:r}=n;return Fc(r,t),Dc(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=Or("Patches").applyPatches_;return zr(e)?r(e,t):this.produce(e,i=>r(i,t))}};function qs(e,t){const n=Di(e)?Or("MapSet").proxyMap_(e,t):Do(e)?Or("MapSet").proxySet_(e,t):sw(e,t);return(t?t.scope_:bl()).drafts_.push(n),n}function uw(e){return zr(e)||xt(10,e),Cl(e)}function Cl(e){if(!xr(e)||Mo(e))return e;const t=e[At];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Vs(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Vs(e,!0);return yo(n,(r,i)=>{wl(n,r,Cl(i))}),t&&(t.finalized_=!1),n}var lw=new cw,Nt=lw.produce,Hn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ko(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bo={exports:{}};bo.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=1,o=2,s=9007199254740991,a="[object Arguments]",u="[object Array]",f="[object AsyncFunction]",l="[object Boolean]",d="[object Date]",h="[object Error]",m="[object Function]",y="[object GeneratorFunction]",w="[object Map]",g="[object Number]",O="[object Null]",p="[object Object]",b="[object Promise]",v="[object Proxy]",x="[object RegExp]",S="[object Set]",A="[object String]",N="[object Symbol]",F="[object Undefined]",R="[object WeakMap]",D="[object ArrayBuffer]",K="[object DataView]",j="[object Float32Array]",L="[object Float64Array]",se="[object Int8Array]",re="[object Int16Array]",ge="[object Int32Array]",de="[object Uint8Array]",be="[object Uint8ClampedArray]",P="[object Uint16Array]",$="[object Uint32Array]",H=/[\\^$.*+?()[\]{}|]/g,U=/^\[object .+?Constructor\]$/,q=/^(?:0|[1-9]\d*)$/,V={};V[j]=V[L]=V[se]=V[re]=V[ge]=V[de]=V[be]=V[P]=V[$]=!0,V[a]=V[u]=V[D]=V[l]=V[K]=V[d]=V[h]=V[m]=V[w]=V[g]=V[p]=V[x]=V[S]=V[A]=V[R]=!1;var G=typeof Hn=="object"&&Hn&&Hn.Object===Object&&Hn,Z=typeof self=="object"&&self&&self.Object===Object&&self,Y=G||Z||Function("return this")(),ee=t&&!t.nodeType&&t,ne=ee&&!0&&e&&!e.nodeType&&e,ce=ne&&ne.exports===ee,k=ce&&G.process,ve=function(){try{return k&&k.binding&&k.binding("util")}catch{}}(),z=ve&&ve.isTypedArray;function Xe(C,T){for(var M=-1,te=C==null?0:C.length,Pe=0,fe=[];++M<te;){var Ve=C[M];T(Ve,M,C)&&(fe[Pe++]=Ve)}return fe}function Ce(C,T){for(var M=-1,te=T.length,Pe=C.length;++M<te;)C[Pe+M]=T[M];return C}function st(C,T){for(var M=-1,te=C==null?0:C.length;++M<te;)if(T(C[M],M,C))return!0;return!1}function Ue(C,T){for(var M=-1,te=Array(C);++M<C;)te[M]=T(M);return te}function rt(C){return function(T){return C(T)}}function xe(C,T){return C.has(T)}function ze(C,T){return C==null?void 0:C[T]}function ft(C){var T=-1,M=Array(C.size);return C.forEach(function(te,Pe){M[++T]=[Pe,te]}),M}function yt(C,T){return function(M){return C(T(M))}}function vt(C){var T=-1,M=Array(C.size);return C.forEach(function(te){M[++T]=te}),M}var Ye=Array.prototype,Ze=Function.prototype,De=Object.prototype,J=Y["__core-js_shared__"],pe=Ze.toString,_e=De.hasOwnProperty,ln=function(){var C=/[^.]+$/.exec(J&&J.keys&&J.keys.IE_PROTO||"");return C?"Symbol(src)_1."+C:""}(),dn=De.toString,fn=RegExp("^"+pe.call(_e).replace(H,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),wt=ce?Y.Buffer:void 0,Fe=Y.Symbol,nr=Y.Uint8Array,En=De.propertyIsEnumerable,Nn=Ye.splice,St=Fe?Fe.toStringTag:void 0,pn=Object.getOwnPropertySymbols,Tn=wt?wt.isBuffer:void 0,Rn=yt(Object.keys,Object),hn=Rr(Y,"DataView"),Xt=Rr(Y,"Map"),je=Rr(Y,"Promise"),at=Rr(Y,"Set"),ae=Rr(Y,"WeakMap"),he=Rr(Object,"create"),pt=ir(hn),mn=ir(Xt),X=ir(je),ue=ir(at),le=ir(ae),Le=Fe?Fe.prototype:void 0,Be=Le?Le.valueOf:void 0;function et(C){var T=-1,M=C==null?0:C.length;for(this.clear();++T<M;){var te=C[T];this.set(te[0],te[1])}}function Pt(){this.__data__=he?he(null):{},this.size=0}function it(C){var T=this.has(C)&&delete this.__data__[C];return this.size-=T?1:0,T}function bt(C){var T=this.__data__;if(he){var M=T[C];return M===r?void 0:M}return _e.call(T,C)?T[C]:void 0}function Ae(C){var T=this.__data__;return he?T[C]!==void 0:_e.call(T,C)}function An(C,T){var M=this.__data__;return this.size+=this.has(C)?0:1,M[C]=he&&T===void 0?r:T,this}et.prototype.clear=Pt,et.prototype.delete=it,et.prototype.get=bt,et.prototype.has=Ae,et.prototype.set=An;function $t(C){var T=-1,M=C==null?0:C.length;for(this.clear();++T<M;){var te=C[T];this.set(te[0],te[1])}}function Xo(){this.__data__=[],this.size=0}function Ui(C){var T=this.__data__,M=Hi(T,C);if(M<0)return!1;var te=T.length-1;return M==te?T.pop():Nn.call(T,M,1),--this.size,!0}function qi(C){var T=this.__data__,M=Hi(T,C);return M<0?void 0:T[M][1]}function Bi(C){return Hi(this.__data__,C)>-1}function Ji(C,T){var M=this.__data__,te=Hi(M,C);return te<0?(++this.size,M.push([C,T])):M[te][1]=T,this}$t.prototype.clear=Xo,$t.prototype.delete=Ui,$t.prototype.get=qi,$t.prototype.has=Bi,$t.prototype.set=Ji;function Yt(C){var T=-1,M=C==null?0:C.length;for(this.clear();++T<M;){var te=C[T];this.set(te[0],te[1])}}function Oe(){this.size=0,this.__data__={hash:new et,map:new(Xt||$t),string:new et}}function Kt(C){var T=Wi(this,C).delete(C);return this.size-=T?1:0,T}function li(C){return Wi(this,C).get(C)}function rr(C){return Wi(this,C).has(C)}function Yo(C,T){var M=Wi(this,C),te=M.size;return M.set(C,T),this.size+=M.size==te?0:1,this}Yt.prototype.clear=Oe,Yt.prototype.delete=Kt,Yt.prototype.get=li,Yt.prototype.has=rr,Yt.prototype.set=Yo;function Fn(C){var T=-1,M=C==null?0:C.length;for(this.__data__=new Yt;++T<M;)this.add(C[T])}function Gf(C){return this.__data__.set(C,r),this}function Xf(C){return this.__data__.has(C)}Fn.prototype.add=Fn.prototype.push=Gf,Fn.prototype.has=Xf;function Pn(C){var T=this.__data__=new $t(C);this.size=T.size}function Yf(){this.__data__=new $t,this.size=0}function Zf(C){var T=this.__data__,M=T.delete(C);return this.size=T.size,M}function ep(C){return this.__data__.get(C)}function tp(C){return this.__data__.has(C)}function np(C,T){var M=this.__data__;if(M instanceof $t){var te=M.__data__;if(!Xt||te.length<n-1)return te.push([C,T]),this.size=++M.size,this;M=this.__data__=new Yt(te)}return M.set(C,T),this.size=M.size,this}Pn.prototype.clear=Yf,Pn.prototype.delete=Zf,Pn.prototype.get=ep,Pn.prototype.has=tp,Pn.prototype.set=np;function rp(C,T){var M=zi(C),te=!M&&vp(C),Pe=!M&&!te&&Zo(C),fe=!M&&!te&&!Pe&&dc(C),Ve=M||te||Pe||fe,tt=Ve?Ue(C.length,String):[],ot=tt.length;for(var ke in C)_e.call(C,ke)&&!(Ve&&(ke=="length"||Pe&&(ke=="offset"||ke=="parent")||fe&&(ke=="buffer"||ke=="byteLength"||ke=="byteOffset")||pp(ke,ot)))&&tt.push(ke);return tt}function Hi(C,T){for(var M=C.length;M--;)if(ac(C[M][0],T))return M;return-1}function ip(C,T,M){var te=T(C);return zi(C)?te:Ce(te,M(C))}function di(C){return C==null?C===void 0?F:O:St&&St in Object(C)?dp(C):yp(C)}function rc(C){return fi(C)&&di(C)==a}function ic(C,T,M,te,Pe){return C===T?!0:C==null||T==null||!fi(C)&&!fi(T)?C!==C&&T!==T:op(C,T,M,te,ic,Pe)}function op(C,T,M,te,Pe,fe){var Ve=zi(C),tt=zi(T),ot=Ve?u:Dn(C),ke=tt?u:Dn(T);ot=ot==a?p:ot,ke=ke==a?p:ke;var Et=ot==p,Ut=ke==p,ct=ot==ke;if(ct&&Zo(C)){if(!Zo(T))return!1;Ve=!0,Et=!1}if(ct&&!Et)return fe||(fe=new Pn),Ve||dc(C)?oc(C,T,M,te,Pe,fe):up(C,T,ot,M,te,Pe,fe);if(!(M&i)){var Dt=Et&&_e.call(C,"__wrapped__"),Mt=Ut&&_e.call(T,"__wrapped__");if(Dt||Mt){var Mn=Dt?C.value():C,gn=Mt?T.value():T;return fe||(fe=new Pn),Pe(Mn,gn,M,te,fe)}}return ct?(fe||(fe=new Pn),lp(C,T,M,te,Pe,fe)):!1}function sp(C){if(!lc(C)||mp(C))return!1;var T=cc(C)?fn:U;return T.test(ir(C))}function ap(C){return fi(C)&&uc(C.length)&&!!V[di(C)]}function cp(C){if(!gp(C))return Rn(C);var T=[];for(var M in Object(C))_e.call(C,M)&&M!="constructor"&&T.push(M);return T}function oc(C,T,M,te,Pe,fe){var Ve=M&i,tt=C.length,ot=T.length;if(tt!=ot&&!(Ve&&ot>tt))return!1;var ke=fe.get(C);if(ke&&fe.get(T))return ke==T;var Et=-1,Ut=!0,ct=M&o?new Fn:void 0;for(fe.set(C,T),fe.set(T,C);++Et<tt;){var Dt=C[Et],Mt=T[Et];if(te)var Mn=Ve?te(Mt,Dt,Et,T,C,fe):te(Dt,Mt,Et,C,T,fe);if(Mn!==void 0){if(Mn)continue;Ut=!1;break}if(ct){if(!st(T,function(gn,or){if(!xe(ct,or)&&(Dt===gn||Pe(Dt,gn,M,te,fe)))return ct.push(or)})){Ut=!1;break}}else if(!(Dt===Mt||Pe(Dt,Mt,M,te,fe))){Ut=!1;break}}return fe.delete(C),fe.delete(T),Ut}function up(C,T,M,te,Pe,fe,Ve){switch(M){case K:if(C.byteLength!=T.byteLength||C.byteOffset!=T.byteOffset)return!1;C=C.buffer,T=T.buffer;case D:return!(C.byteLength!=T.byteLength||!fe(new nr(C),new nr(T)));case l:case d:case g:return ac(+C,+T);case h:return C.name==T.name&&C.message==T.message;case x:case A:return C==T+"";case w:var tt=ft;case S:var ot=te&i;if(tt||(tt=vt),C.size!=T.size&&!ot)return!1;var ke=Ve.get(C);if(ke)return ke==T;te|=o,Ve.set(C,T);var Et=oc(tt(C),tt(T),te,Pe,fe,Ve);return Ve.delete(C),Et;case N:if(Be)return Be.call(C)==Be.call(T)}return!1}function lp(C,T,M,te,Pe,fe){var Ve=M&i,tt=sc(C),ot=tt.length,ke=sc(T),Et=ke.length;if(ot!=Et&&!Ve)return!1;for(var Ut=ot;Ut--;){var ct=tt[Ut];if(!(Ve?ct in T:_e.call(T,ct)))return!1}var Dt=fe.get(C);if(Dt&&fe.get(T))return Dt==T;var Mt=!0;fe.set(C,T),fe.set(T,C);for(var Mn=Ve;++Ut<ot;){ct=tt[Ut];var gn=C[ct],or=T[ct];if(te)var fc=Ve?te(or,gn,ct,T,C,fe):te(gn,or,ct,C,T,fe);if(!(fc===void 0?gn===or||Pe(gn,or,M,te,fe):fc)){Mt=!1;break}Mn||(Mn=ct=="constructor")}if(Mt&&!Mn){var Qi=C.constructor,Gi=T.constructor;Qi!=Gi&&"constructor"in C&&"constructor"in T&&!(typeof Qi=="function"&&Qi instanceof Qi&&typeof Gi=="function"&&Gi instanceof Gi)&&(Mt=!1)}return fe.delete(C),fe.delete(T),Mt}function sc(C){return ip(C,Ip,fp)}function Wi(C,T){var M=C.__data__;return hp(T)?M[typeof T=="string"?"string":"hash"]:M.map}function Rr(C,T){var M=ze(C,T);return sp(M)?M:void 0}function dp(C){var T=_e.call(C,St),M=C[St];try{C[St]=void 0;var te=!0}catch{}var Pe=dn.call(C);return te&&(T?C[St]=M:delete C[St]),Pe}var fp=pn?function(C){return C==null?[]:(C=Object(C),Xe(pn(C),function(T){return En.call(C,T)}))}:Cp,Dn=di;(hn&&Dn(new hn(new ArrayBuffer(1)))!=K||Xt&&Dn(new Xt)!=w||je&&Dn(je.resolve())!=b||at&&Dn(new at)!=S||ae&&Dn(new ae)!=R)&&(Dn=function(C){var T=di(C),M=T==p?C.constructor:void 0,te=M?ir(M):"";if(te)switch(te){case pt:return K;case mn:return w;case X:return b;case ue:return S;case le:return R}return T});function pp(C,T){return T=T??s,!!T&&(typeof C=="number"||q.test(C))&&C>-1&&C%1==0&&C<T}function hp(C){var T=typeof C;return T=="string"||T=="number"||T=="symbol"||T=="boolean"?C!=="__proto__":C===null}function mp(C){return!!ln&&ln in C}function gp(C){var T=C&&C.constructor,M=typeof T=="function"&&T.prototype||De;return C===M}function yp(C){return dn.call(C)}function ir(C){if(C!=null){try{return pe.call(C)}catch{}try{return C+""}catch{}}return""}function ac(C,T){return C===T||C!==C&&T!==T}var vp=rc(function(){return arguments}())?rc:function(C){return fi(C)&&_e.call(C,"callee")&&!En.call(C,"callee")},zi=Array.isArray;function wp(C){return C!=null&&uc(C.length)&&!cc(C)}var Zo=Tn||xp;function bp(C,T){return ic(C,T)}function cc(C){if(!lc(C))return!1;var T=di(C);return T==m||T==y||T==f||T==v}function uc(C){return typeof C=="number"&&C>-1&&C%1==0&&C<=s}function lc(C){var T=typeof C;return C!=null&&(T=="object"||T=="function")}function fi(C){return C!=null&&typeof C=="object"}var dc=z?rt(z):ap;function Ip(C){return wp(C)?rp(C):cp(C)}function Cp(){return[]}function xp(){return!1}e.exports=bp})(bo,bo.exports);var dw=bo.exports;const xl=ko(dw),Je=async(e,t)=>{var n;if(e instanceof oa){const{status:r,statusText:i}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,i);try{const s=await e.response.clone().json(),a=((n=s==null?void 0:s.causes)==null?void 0:n.join(`
3
- `))||(s==null?void 0:s.detail);a?(console.error("[Error Message]",a),s!=null&&s.remedy&&console.error("[Remedy]",s.remedy)):console.error("Unexpected error response:",s);const u=`${a} ${s!=null&&s.remedy?`
1
+ "use strict";var Tg=Object.defineProperty;var zu=e=>{throw TypeError(e)};var Ng=(e,t,n)=>t in e?Tg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ui=(e,t,n)=>Ng(e,typeof t!="symbol"?t+"":t,n),Hs=(e,t,n)=>t.has(e)||zu("Cannot "+n);var T=(e,t,n)=>(Hs(e,t,"read from private field"),n?n.call(e):t.get(e)),pe=(e,t,n)=>t.has(e)?zu("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),re=(e,t,n,r)=>(Hs(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Ce=(e,t,n)=>(Hs(e,t,"access private method"),n);var Do=(e,t,n,r)=>({set _(i){re(e,t,i,n)},get _(){return T(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),C=require("react");require("react-dom");function kg(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 W=kg(C),Ag="https://api.withampersand.com/v1".replace(/\/+$/,"");class vl{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Ag}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||af}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 Rg=new vl,Is=class Is{constructor(t=Rg){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 Dg(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?Is.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 wl(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(c=>i[c]===void 0?delete i[c]:{});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})},l={...a,body:Fg(a.body)||a.body instanceof URLSearchParams||Pg(a.body)?a.body:JSON.stringify(a.body)};return{url:r,init:l}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};Is.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let Tn=Is;function Pg(e){return typeof Blob<"u"&&e instanceof Blob}function Fg(e){return typeof FormData<"u"&&e instanceof FormData}class wl extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class Dg extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class fe extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function k(e,t){const n=e[t];return n!=null}function af(e,t=""){return Object.keys(e).map(n=>lf(n,e[n],t)).filter(n=>n.length>0).join("&")}function lf(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 lf(e,i,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?af(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function tt(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class Qe{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class gi{constructor(t){this.raw=t}async value(){}}class Ku{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function Mg(e){return Lg(e)}function Lg(e,t){return e==null?e:{fieldUsed:k(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:k(e,"keyFormat")?e.keyFormat:void 0}}function jg(e){return Bg(e)}function Bg(e,t){return e==null?e:{name:e.name,valuePrefix:k(e,"valuePrefix")?e.valuePrefix:void 0}}function Vg(e){return Ug(e)}function Ug(e,t){return e==null?e:{name:e.name}}function $g(e){return qg(e)}function qg(e,t){return e==null?e:{attachmentType:e.attachmentType,query:k(e,"query")?Vg(e.query):void 0,header:k(e,"header")?jg(e.header):void 0,docsURL:k(e,"docsURL")?e.docsURL:void 0}}function zg(e){return Kg(e)}function Kg(e,t){return e==null?e:{enabled:k(e,"enabled")?e.enabled:void 0,includeFullRecords:k(e,"includeFullRecords")?e.includeFullRecords:void 0}}function Hg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function Jg(e){return Wg(e)}function Wg(e,t){return e==null?e:{url:e.url,method:k(e,"method")?e.method:void 0,successStatusCodes:k(e,"successStatusCodes")?e.successStatusCodes:void 0}}const Hu={ApiKey:"apiKey",Basic:"basic"};function Qg(e){return Gg(e)}function Gg(e,t){return e}function Xg(e){return Yg(e)}function Yg(e,t){return e==null?e:{days:k(e,"days")?e.days:void 0,fullHistory:k(e,"fullHistory")?e.fullHistory:void 0}}function Zg(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function uf(e){return ey(e)}function ey(e,t){return e==null?e:{defaultPeriod:Xg(e.defaultPeriod)}}function ty(e){if(e!==void 0)return e===null?null:{defaultPeriod:Zg(e.defaultPeriod)}}function ny(e){return ry(e)}function ry(e,t){return e==null?e:{days:k(e,"days")?e.days:void 0,fullHistory:k(e,"fullHistory")?e.fullHistory:void 0}}function iy(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function oy(e){return sy(e)}function sy(e,t){return e==null?e:{defaultPeriod:ny(e.defaultPeriod)}}function cf(e){if(e!==void 0)return e===null?null:{defaultPeriod:iy(e.defaultPeriod)}}function ay(e){return ly(e)}function ly(e,t){return e==null?e:{enabled:k(e,"enabled")?e.enabled:void 0}}function df(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function uy(e){return cy(e)}function cy(e,t){return e==null?e:{mappedValue:e.mappedValue,mappedDisplayValue:e.mappedDisplayValue}}function dy(e){if(e!==void 0)return e===null?null:{mappedValue:e.mappedValue,mappedDisplayValue:e.mappedDisplayValue}}function fy(e){return py(e)}function py(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:k(e,"mapToDisplayName")?e.mapToDisplayName:void 0,prompt:k(e,"prompt")?e.prompt:void 0,mappedValues:k(e,"mappedValues")?e.mappedValues.map(uy):void 0,fieldName:k(e,"fieldName")?e.fieldName:void 0}}function ff(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,prompt:e.prompt,mappedValues:e.mappedValues===void 0?void 0:e.mappedValues.map(dy),fieldName:e.fieldName}}function hy(e){return my(e)}function my(e,t){return e}function gy(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,disabled:e.disabled,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:e.selectedValueMappings,dynamicMappingsInput:e.dynamicMappingsInput===void 0?void 0:e.dynamicMappingsInput.map(ff),selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:cf(e.backfill)}}function yy(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:tt(e.objects,gy)}}function vy(e){return wy(e)}function wy(e,t){return e==null?e:{stringValue:k(e,"stringValue")?e.stringValue:void 0,integerValue:k(e,"integerValue")?e.integerValue:void 0,booleanValue:k(e,"booleanValue")?e.booleanValue:void 0}}function by(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}const xy={Always:"always",Never:"never"},Iy={Always:"always",Never:"never"};function Cy(e){return Sy(e)}function Sy(e,t){return e==null?e:{default:k(e,"default")?vy(e.default):void 0,writeOnCreate:k(e,"writeOnCreate")?e.writeOnCreate:void 0,writeOnUpdate:k(e,"writeOnUpdate")?e.writeOnUpdate:void 0}}function pf(e){if(e!==void 0)return e===null?null:{default:by(e.default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function Oy(e){let t=!0;return t=t&&"value"in e,t}function Ey(e,t){return e==null?e:{value:e.value,applyOnUpdate:k(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function _y(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Ty(e){let t=!0;return t=t&&"value"in e,t}function Ny(e,t){return e==null?e:{value:e.value,applyOnUpdate:k(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function ky(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Ay(e){let t=!0;return t=t&&"value"in e,t}function Ry(e,t){return e==null?e:{value:e.value,applyOnUpdate:k(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Py(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Fy(e){return Dy(e)}function Dy(e,t){return e==null?e:{...Ey(e),...Ny(e),...Ry(e)}}function hf(e){if(e!==void 0)return e===null?null:Oy(e)?_y(e):Ty(e)?ky(e):Ay(e)?Py(e):{}}function My(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:tt(e.selectedValueDefaults,hf),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:tt(e.selectedFieldSettings,pf)}}function Ly(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:tt(e.objects,My)}}function jy(e){return By(e)}function By(e,t){return e==null?e:{enabled:e.enabled}}function Vy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Uy(e){return $y(e)}function $y(e,t){return e==null?e:{enabled:e.enabled}}function qy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function zy(e){return Ky(e)}function Ky(e,t){return e==null?e:{enabled:e.enabled,watchFieldsAuto:k(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:k(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function Hy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function Jy(e){return Wy(e)}function Wy(e,t){return e==null?e:{apiKeyAsBasic:k(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:k(e,"apiKeyAsBasicOpts")?Mg(e.apiKeyAsBasicOpts):void 0,docsURL:k(e,"docsURL")?e.docsURL:void 0}}function Qy(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Mo(e){return Gy(e)}function Gy(e,t){return e==null?e:{supported:e.supported,defaultRecordLimit:k(e,"defaultRecordLimit")?e.defaultRecordLimit:void 0,objectRecordLimits:k(e,"objectRecordLimits")?e.objectRecordLimits:void 0}}function Xy(e){return Yy(e)}function Yy(e,t){return e==null?e:{_delete:Mo(e.delete),create:Mo(e.create),update:Mo(e.update),upsert:Mo(e.upsert)}}function Zy(e){return ev(e)}function ev(e,t){return e==null?e:{value:e.value}}function tv(e){return nv(e)}function nv(e,t){return e==null?e:{brandingRemoval:k(e,"brandingRemoval")?Zy(e.brandingRemoval):void 0}}function Lo(e){return rv(e)}function rv(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:k(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:k(e,"updateTime")?new Date(e.updateTime):void 0,entitlements:k(e,"entitlements")?tv(e.entitlements):void 0}}function iv(e){return ov(e)}function ov(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function sv(e){return av(e)}function av(e,t){return e==null?e:{objectName:e.objectName,schedule:k(e,"schedule")?e.schedule:void 0,disabled:k(e,"disabled")?e.disabled:void 0,destination:k(e,"destination")?e.destination:void 0,selectedFields:e.selectedFields,selectedValueMappings:k(e,"selectedValueMappings")?e.selectedValueMappings:void 0,dynamicMappingsInput:k(e,"dynamicMappingsInput")?e.dynamicMappingsInput.map(fy):void 0,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:k(e,"selectedFieldsAuto")?hy(e.selectedFieldsAuto):void 0,backfill:k(e,"backfill")?oy(e.backfill):void 0}}function lv(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,disabled:e.disabled,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:e.selectedValueMappings,dynamicMappingsInput:e.dynamicMappingsInput===void 0?void 0:e.dynamicMappingsInput.map(ff),selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:cf(e.backfill)}}function uv(e){return cv(e)}function cv(e,t){return e==null?e:{objects:tt(e.objects,sv)}}function dv(e){if(e!==void 0)return e===null?null:{objects:tt(e.objects,lv)}}function fv(e){return pv(e)}function pv(e,t){return e==null?e:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:k(e,"createEvent")?jy(e.createEvent):void 0,updateEvent:k(e,"updateEvent")?zy(e.updateEvent):void 0,deleteEvent:k(e,"deleteEvent")?Uy(e.deleteEvent):void 0}}function hv(e){if(e!==void 0)return e===null?null:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:Vy(e.createEvent),updateEvent:Hy(e.updateEvent),deleteEvent:qy(e.deleteEvent)}}function mv(e){return gv(e)}function gv(e,t){return e==null?e:{objects:tt(e.objects,fv)}}function yv(e){if(e!==void 0)return e===null?null:{objects:tt(e.objects,hv)}}function vv(e){return wv(e)}function wv(e,t){return e==null?e:{objectName:e.objectName,selectedValueDefaults:k(e,"selectedValueDefaults")?tt(e.selectedValueDefaults,Fy):void 0,selectedFieldSettings:k(e,"selectedFieldSettings")?tt(e.selectedFieldSettings,Cy):void 0}}function bv(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:tt(e.selectedValueDefaults,hf),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:tt(e.selectedFieldSettings,pf)}}function xv(e){return Iv(e)}function Iv(e,t){return e==null?e:{objects:k(e,"objects")?tt(e.objects,vv):void 0}}function Cv(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:tt(e.objects,bv)}}function Sv(e){return Ov(e)}function Ov(e,t){return e==null?e:{provider:e.provider,read:k(e,"read")?uv(e.read):void 0,write:k(e,"write")?xv(e.write):void 0,proxy:k(e,"proxy")?ay(e.proxy):void 0,subscribe:k(e,"subscribe")?mv(e.subscribe):void 0}}function Ev(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:dv(e.read),write:Cv(e.write),proxy:df(e.proxy),subscribe:yv(e.subscribe)}}function _v(e){return Tv(e)}function Tv(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:Sv(e.content)}}function Nv(e){return kv(e)}function kv(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:k(e,"updateTime")?new Date(e.updateTime):void 0}}function mf(e){return Av(e)}function Av(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:k(e,"updateTime")?new Date(e.updateTime):void 0}}function Rv(e){return Pv(e)}function Pv(e,t){return e==null?e:{token:e.token,issuedAt:k(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:k(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Fv(e){return Dv(e)}function Dv(e,t){return e==null?e:{token:e.token,issuedAt:k(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:k(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Mv(e){return Lv(e)}function Lv(e,t){return e==null?e:{accessToken:k(e,"accessToken")?Rv(e.accessToken):void 0,refreshToken:k(e,"refreshToken")?Fv(e.refreshToken):void 0,scopes:k(e,"scopes")?e.scopes:void 0}}function Qo(e){return jv(e)}function jv(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:k(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:k(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:k(e,"updateTime")?new Date(e.updateTime):void 0}}function Bv(e){return Vv(e)}function Vv(e,t){return e==null?e:{value:e.value,source:e.source,displayName:k(e,"displayName")?e.displayName:void 0}}function bl(e){if(e!==void 0)return e===null?null:{value:e.value,source:e.source,displayName:e.displayName}}function Ji(e){return Uv(e)}function Uv(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:k(e,"providerApp")?Qo(e.providerApp):void 0,group:mf(e.group),consumer:Nv(e.consumer),providerWorkspaceRef:k(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:k(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:k(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:k(e,"oauth2AuthorizationCode")?Mv(e.oauth2AuthorizationCode):void 0,apiKey:k(e,"apiKey")?e.apiKey:void 0,providerMetadata:k(e,"providerMetadata")?tt(e.providerMetadata,Bv):void 0}}function gf(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function yf(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function vf(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 $v(e){if(e!==void 0)return e===null?null:{token:e.token,expiresAt:e.expiresAt===void 0?void 0:e.expiresAt.toISOString(),issuedAt:e.issuedAt===void 0?void 0:e.issuedAt.toISOString()}}function qv(e){if(e!==void 0)return e===null?null:{token:e.token,expiresAt:e.expiresAt===void 0?void 0:e.expiresAt.toISOString(),issuedAt:e.issuedAt===void 0?void 0:e.issuedAt.toISOString()}}function wf(e){if(e!==void 0)return e===null?null:{accessToken:$v(e.accessToken),refreshToken:qv(e.refreshToken),scopes:e.scopes}}function zv(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:tt(e.providerMetadata,bl),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:gf(e.basicAuth),oauth2ClientCredentials:yf(e.oauth2ClientCredentials),oauth2PasswordCredentials:vf(e.oauth2PasswordCredentials),oauth2AuthorizationCode:wf(e.oauth2AuthorizationCode)}}function Kv(e){return Hv(e)}function Hv(e,t){return e==null?e:{enabled:k(e,"enabled")?e.enabled:void 0}}function Jv(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Wv(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Ev(e.content)}}function Qv(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:Wv(e.config)}}function Gv(e){return Xv(e)}function Xv(e,t){return e==null?e:{enabled:k(e,"enabled")?e.enabled:void 0,useModule:k(e,"useModule")?e.useModule:void 0}}function Yv(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,useModule:e.useModule}}function Zv(e){return ew(e)}function ew(e,t){return e==null?e:{mode:k(e,"mode")?e.mode:void 0,pageSize:k(e,"pageSize")?e.pageSize:void 0}}function tw(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function nw(e){let t=!0;return t=t&&"fieldName"in e,t}function rw(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:k(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:k(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function iw(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function ow(e){let t=!0;return t=t&&"mapToName"in e,t}function bf(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:k(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:k(e,"default")?e.default:void 0,prompt:k(e,"prompt")?e.prompt:void 0}}function sw(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Ju(e){return aw(e)}function aw(e,t){return e==null?e:{...rw(e),...bf(e)}}function Wu(e){if(e!==void 0)return e===null?null:nw(e)?iw(e):ow(e)?sw(e):{}}function xf(e){return lw(e)}function lw(e,t){return e}function uw(e){return cw(e)}function cw(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:k(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:k(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:k(e,"requiredFields")?e.requiredFields.map(Ju):void 0,optionalFields:k(e,"optionalFields")?e.optionalFields.map(Ju):void 0,optionalFieldsAuto:k(e,"optionalFieldsAuto")?xf(e.optionalFieldsAuto):void 0,backfill:k(e,"backfill")?uf(e.backfill):void 0,delivery:k(e,"delivery")?Zv(e.delivery):void 0,enabled:k(e,"enabled")?e.enabled:void 0}}function dw(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(Wu),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(Wu),optionalFieldsAuto:e.optionalFieldsAuto,backfill:ty(e.backfill),delivery:tw(e.delivery),enabled:e.enabled}}function fw(e){return pw(e)}function pw(e,t){return e==null?e:{objects:k(e,"objects")?e.objects.map(uw):void 0}}function hw(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(dw)}}function mw(e){return gw(e)}function gw(e,t){return e==null?e:{enabled:k(e,"enabled")?e.enabled:void 0}}function yw(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function vw(e){return ww(e)}function ww(e,t){return e==null?e:{enabled:k(e,"enabled")?e.enabled:void 0,watchFieldsAuto:k(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:k(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function bw(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function xw(e){return Iw(e)}function Iw(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:k(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:k(e,"createEvent")?Kv(e.createEvent):void 0,updateEvent:k(e,"updateEvent")?vw(e.updateEvent):void 0,deleteEvent:k(e,"deleteEvent")?mw(e.deleteEvent):void 0,associationChangeEvent:k(e,"associationChangeEvent")?zg(e.associationChangeEvent):void 0,otherEvents:k(e,"otherEvents")?e.otherEvents:void 0}}function Cw(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:Jv(e.createEvent),updateEvent:bw(e.updateEvent),deleteEvent:yw(e.deleteEvent),associationChangeEvent:Hg(e.associationChangeEvent),otherEvents:e.otherEvents}}function Sw(e){return Ow(e)}function Ow(e,t){return e==null?e:{objects:k(e,"objects")?e.objects.map(xw):void 0}}function Ew(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Cw)}}function If(e){return _w(e)}function _w(e,t){return e==null?e:{allowAnyFields:k(e,"allowAnyFields")?e.allowAnyFields:void 0}}function Tw(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function Nw(e){return kw(e)}function kw(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:k(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:k(e,"valueDefaults")?If(e.valueDefaults):void 0}}function Aw(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:Tw(e.valueDefaults)}}function Rw(e){return Pw(e)}function Pw(e,t){return e==null?e:{objects:k(e,"objects")?e.objects.map(Nw):void 0}}function Fw(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Aw)}}function Dw(e){return Mw(e)}function Mw(e,t){return e==null?e:{name:e.name,provider:e.provider,displayName:k(e,"displayName")?e.displayName:void 0,module:k(e,"module")?e.module:void 0,read:k(e,"read")?fw(e.read):void 0,write:k(e,"write")?Rw(e.write):void 0,proxy:k(e,"proxy")?Gv(e.proxy):void 0,subscribe:k(e,"subscribe")?Sw(e.subscribe):void 0}}function Lw(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,displayName:e.displayName,module:e.module,read:hw(e.read),write:Fw(e.write),proxy:Yv(e.proxy),subscribe:Ew(e.subscribe)}}function jw(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:Lw(e.content)}}function Bw(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:jw(e.latestRevision)}}function Vw(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function Uw(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 $w(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function qw(e){return zw(e)}function zw(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function Kw(e){return Hw(e)}function Hw(e,t){return e==null?e:{name:e.name,displayName:e.displayName,prompt:k(e,"prompt")?e.prompt:void 0,docsURL:k(e,"docsURL")?e.docsURL:void 0}}function Jw(e){return Ww(e)}function Ww(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function Qw(e){return Gw(e)}function Gw(e,t){return e==null?e:{headers:k(e,"headers")?e.headers.map(qw):void 0,queryParams:k(e,"queryParams")?e.queryParams.map(Jw):void 0,inputs:k(e,"inputs")?e.inputs.map(Kw):void 0}}function Xw(e){return Yw(e)}function Yw(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function Zw(e){return eb(e)}function eb(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:k(e,"valueType")?e.valueType:void 0,providerType:k(e,"providerType")?e.providerType:void 0,readOnly:k(e,"readOnly")?e.readOnly:void 0,values:k(e,"values")?e.values.map(Xw):void 0}}function tb(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:tt(e.providerMetadata,bl),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:gf(e.basicAuth),oauth2ClientCredentials:yf(e.oauth2ClientCredentials),oauth2PasswordCredentials:vf(e.oauth2PasswordCredentials),oauth2AuthorizationCode:wf(e.oauth2AuthorizationCode)}}function nb(e){return rb(e)}function rb(e,t){return e==null?e:{enabled:k(e,"enabled")?e.enabled:void 0,useModule:k(e,"useModule")?e.useModule:void 0}}function ib(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:k(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:k(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Js(e){return ob(e)}function ob(e,t){return e==null?e:{...ib(e),...bf(e)}}function sb(e){return ab(e)}function ab(e,t){return e==null?e:{error:k(e,"error")?e.error:void 0,objectName:e.objectName,displayName:e.displayName,mapToName:k(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:k(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:k(e,"requiredFields")?e.requiredFields.map(Js):void 0,optionalFields:k(e,"optionalFields")?e.optionalFields.map(Js):void 0,optionalFieldsAuto:k(e,"optionalFieldsAuto")?xf(e.optionalFieldsAuto):void 0,allFieldsMetadata:k(e,"allFieldsMetadata")?tt(e.allFieldsMetadata,Zw):void 0,allFields:k(e,"allFields")?e.allFields.map(Js):void 0,backfill:k(e,"backfill")?uf(e.backfill):void 0}}function lb(e){return ub(e)}function ub(e,t){return e==null?e:{objects:k(e,"objects")?e.objects.map(sb):void 0}}function cb(e){return db(e)}function db(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:k(e,"valueDefaults")?If(e.valueDefaults):void 0}}function fb(e){return pb(e)}function pb(e,t){return e==null?e:{objects:k(e,"objects")?e.objects.map(cb):void 0}}function hb(e){return mb(e)}function mb(e,t){return e==null?e:{name:e.name,displayName:k(e,"displayName")?e.displayName:void 0,module:k(e,"module")?e.module:void 0,provider:e.provider,read:k(e,"read")?lb(e.read):void 0,write:k(e,"write")?fb(e.write):void 0,proxy:k(e,"proxy")?nb(e.proxy):void 0}}function gb(e){return yb(e)}function yb(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:hb(e.content)}}function $i(e){return vb(e)}function vb(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:k(e,"group")?mf(e.group):void 0,healthStatus:e.healthStatus,connection:Ji(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:k(e,"updateTime")?new Date(e.updateTime):void 0,config:_v(e.config)}}function wb(e){return bb(e)}function bb(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Dw(e.content)}}function Ws(e){return xb(e)}function xb(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:k(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:wb(e.latestRevision)}}function Ib(e){return Cb(e)}function Cb(e,t){return e==null?e:{iconURL:k(e,"iconURL")?e.iconURL:void 0,logoURL:k(e,"logoURL")?e.logoURL:void 0}}function Sb(e){return Ob(e)}function Ob(e,t){return e==null?e:{iconURL:k(e,"iconURL")?e.iconURL:void 0,logoURL:k(e,"logoURL")?e.logoURL:void 0}}function Eb(e){return _b(e)}function _b(e,t){return e==null?e:{regular:k(e,"regular")?Sb(e.regular):void 0,darkMode:k(e,"darkMode")?Ib(e.darkMode):void 0}}function Tb(e){return Nb(e)}function Nb(e,t){return e==null?e:{name:e.name,displayName:k(e,"displayName")?e.displayName:void 0,prompt:k(e,"prompt")?e.prompt:void 0,defaultValue:k(e,"defaultValue")?e.defaultValue:void 0,docsURL:k(e,"docsURL")?e.docsURL:void 0,moduleDependencies:k(e,"moduleDependencies")?e.moduleDependencies:void 0}}function kb(e){return Ab(e)}function Ab(e,t){return e==null?e:{name:e.name,moduleDependencies:k(e,"moduleDependencies")?e.moduleDependencies:void 0}}function Rb(e){return Pb(e)}function Pb(e,t){return e==null?e:{create:k(e,"create")?e.create:void 0,update:k(e,"update")?e.update:void 0,_delete:k(e,"delete")?e.delete:void 0,passThrough:k(e,"passThrough")?e.passThrough:void 0}}function Cf(e){return Fb(e)}function Fb(e,t){return e==null?e:{bulkWrite:iv(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:k(e,"subscribeSupport")?Rb(e.subscribeSupport):void 0,batchWrite:k(e,"batchWrite")?Xy(e.batchWrite):void 0}}function Db(e){return Mb(e)}function Mb(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:Cf(e.support)}}function Lb(e){return jb(e)}function jb(e,t){return e==null?e:{name:e.name,displayName:e.displayName,path:e.path,capture:k(e,"capture")?e.capture:void 0}}function Bb(e){return Vb(e)}function Vb(e,t){return e==null?e:{workspaceRefField:k(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:k(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:k(e,"scopesField")?e.scopesField:void 0,otherFields:k(e,"otherFields")?e.otherFields.map(Lb):void 0}}const Qs={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials"};function Ub(e){return $b(e)}function $b(e,t){return e==null?e:{grantType:e.grantType,authURL:k(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:k(e,"audience")?e.audience:void 0,tokenMetadataFields:Bb(e.tokenMetadataFields),docsURL:k(e,"docsURL")?e.docsURL:void 0,authURLParams:k(e,"authURLParams")?e.authURLParams:void 0}}function qb(e){if(e!==void 0)return e===null?null:{projectId:e.projectId,provider:e.provider,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:tt(e.providerMetadata,bl),providerAppId:e.providerAppId,enableCSRFProtection:e.enableCSRFProtection}}function zb(e){return Kb(e)}function Kb(e,t){return e==null?e:{input:k(e,"input")?e.input.map(Tb):void 0,postAuthentication:k(e,"postAuthentication")?e.postAuthentication.map(kb):void 0}}function Hb(e){return Jb(e)}function Jb(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function Qu(e){return Wb(e)}function Wb(e,t){return e==null?e:{name:e.name,authType:Qg(e.authType),baseURL:e.baseURL,defaultModule:e.defaultModule,oauth2Opts:k(e,"oauth2Opts")?Ub(e.oauth2Opts):void 0,apiKeyOpts:k(e,"apiKeyOpts")?$g(e.apiKeyOpts):void 0,basicOpts:k(e,"basicOpts")?Jy(e.basicOpts):void 0,customOpts:k(e,"customOpts")?Qw(e.customOpts):void 0,support:Cf(e.support),providerOpts:e.providerOpts,authHealthCheck:k(e,"authHealthCheck")?Jg(e.authHealthCheck):void 0,displayName:k(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:k(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:k(e,"media")?Eb(e.media):void 0,labels:k(e,"labels")?e.labels:void 0,subscribeOpts:k(e,"subscribeOpts")?Hb(e.subscribeOpts):void 0,modules:k(e,"modules")?tt(e.modules,Db):void 0,metadata:k(e,"metadata")?zb(e.metadata):void 0}}function Qb(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:zv(e.connection)}}function Gb(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:yy(e.read),write:Ly(e.write),proxy:df(e.proxy)}}function Xb(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Gb(e.content)}}function Yb(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:Xb(e.config)}}function Zb(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:Yb(e.installation)}}function ex(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function tx(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:ex(e.project)}}function nx(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 rx(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:nx(e.providerApp)}}class ix extends Tn{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new fe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new fe("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 gi(o)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new fe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:tb(t.generateConnectionParams)},n);return new Qe(o,s=>Ji(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 fe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new fe("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={};t.includeCreds!==void 0&&(r.includeCreds=t.includeCreds),t.includeRefreshToken!==void 0&&(r.includeRefreshToken=t.includeRefreshToken),t.refresh!==void 0&&(r.refresh=t.refresh);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Qe(o,s=>Ji(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 fe("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={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Qe(o,s=>s.map(Ji))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}async updateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new fe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new fe("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling updateConnection.");if(t.updateConnectionRequest===null||t.updateConnectionRequest===void 0)throw new fe("updateConnectionRequest","Required parameter requestParameters.updateConnectionRequest was null or undefined when calling updateConnection.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:i,query:r,body:Qb(t.updateConnectionRequest)},n);return new Qe(o,s=>Ji(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class ox extends Tn{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new fe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new fe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new fe("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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:Qv(t.installation)},n);return new Qe(o,s=>$i(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 fe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new fe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new fe("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 gi(o)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new fe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new fe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new fe("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Qe(o,s=>$i(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new fe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new fe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Qe(o,s=>s.map($i))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async listInstallationsForProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new fe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallationsForProject.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Qe(o,s=>s.map($i))}async listInstallationsForProject(t,n){return await(await this.listInstallationsForProjectRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new fe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new fe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new fe("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new fe("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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:Zb(t.installationUpdate)},n);return new Qe(o,s=>$i(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class sx extends Tn{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new fe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new fe("batchUpsertIntegrationsRequest","Required parameter requestParameters.batchUpsertIntegrationsRequest was null or undefined when calling batchUpsertIntegrations.");const r={};t.destructive!==void 0&&(r.destructive=t.destructive);const i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:i,query:r,body:Qy(t.batchUpsertIntegrationsRequest)},n);return new Qe(o,s=>s.map(Ws))}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 fe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new fe("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:Bw(t.integration)},n);return new gi(o)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new fe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new fe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 gi(o)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async getIntegrationRaw(t,n){if(t.integrationIdOrName===null||t.integrationIdOrName===void 0)throw new fe("integrationIdOrName","Required parameter requestParameters.integrationIdOrName was null or undefined when calling getIntegration.");if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new fe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getIntegration.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationIdOrName}".replace("{integrationIdOrName}",encodeURIComponent(String(t.integrationIdOrName))).replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Qe(o,s=>Ws(s))}async getIntegration(t,n){return await(await this.getIntegrationRaw(t,n)).value()}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new fe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Qe(o,s=>s.map(Ws))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class ax extends Tn{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new fe("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/oauth-connect",method:"POST",headers:i,query:r,body:qb(t.connectOAuthParams)},n);return this.isJsonMime(o.headers.get("content-type"))?new Qe(o):new Ku(o)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}async oauthUpdateRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new fe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling oauthUpdate.");if(t.connectionId===null||t.connectionId===void 0)throw new fe("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling oauthUpdate.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}:oauth-update".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:i,query:r},n);return this.isJsonMime(o.headers.get("content-type"))?new Qe(o):new Ku(o)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class lx extends Tn{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new fe("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects",method:"POST",headers:i,query:r,body:Vw(t.project)},n);return new Qe(o,s=>Lo(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new fe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={};t.includeEntitlements!==void 0&&(r.includeEntitlements=t.includeEntitlements);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Qe(o,s=>Lo(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};if(this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const o=this.configuration.accessToken,s=await o("Bearer",[]);s&&(r.Authorization=`Bearer ${s}`)}const i=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new Qe(i,o=>o.map(Lo))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new fe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new fe("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:i,query:r,body:tx(t.projectUpdate)},n);return new Qe(o,s=>Lo(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class ux extends Tn{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new fe("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:i,query:r},n);return new Qe(o,s=>Qu(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};if(this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const o=this.configuration.accessToken,s=await o("Bearer",[]);s&&(r.Authorization=`Bearer ${s}`)}const i=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new Qe(i,o=>tt(o,Qu))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class cx extends Tn{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new fe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new fe("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:Uw(t.providerApp)},n);return new Qe(o,s=>Qo(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 fe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new fe("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 gi(o)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new fe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Qe(o,s=>s.map(Qo))}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 fe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new fe("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new fe("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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:rx(t.providerAppUpdate)},n);return new Qe(o,s=>Qo(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class dx extends Tn{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new fe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new fe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new fe("revision","Required parameter requestParameters.revision was null or undefined when calling createRevision.");const r={};t.destructive!==void 0&&(r.destructive=t.destructive);const i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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:$w(t.revision)},n);return new gi(o)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new fe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new fe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new fe("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new fe("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Qe(o,s=>gb(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}var Ti=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},fx={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},In,Nr,Qd,px=(Qd=class{constructor(){pe(this,In,fx);pe(this,Nr,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&T(this,Nr)&&e!==T(this,In)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:T(this,In),provider:e}),re(this,In,e),process.env.NODE_ENV!=="production"&&re(this,Nr,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&re(this,Nr,!0),T(this,In).setTimeout(e,t)}clearTimeout(e){T(this,In).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&re(this,Nr,!0),T(this,In).setInterval(e,t)}clearInterval(e){T(this,In).clearInterval(e)}},In=new WeakMap,Nr=new WeakMap,Qd),_r=new px;function hx(e){setTimeout(e,0)}var Vr=typeof window>"u"||"Deno"in globalThis;function Pt(){}function mx(e,t){return typeof e=="function"?e(t):e}function Sa(e){return typeof e=="number"&&e>=0&&e!==1/0}function Sf(e,t){return Math.max(e+(t||0)-Date.now(),0)}function dr(e,t){return typeof e=="function"?e(t):e}function rn(e,t){return typeof e=="function"?e(t):e}function Gu(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==xl(s,t.options))return!1}else if(!to(t.queryKey,s))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||i&&i!==t.state.fetchStatus||o&&!o(t))}function Xu(e,t){const{exact:n,status:r,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(Ur(t.options.mutationKey)!==Ur(o))return!1}else if(!to(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function xl(e,t){return((t==null?void 0:t.queryKeyHashFn)||Ur)(e)}function Ur(e){return JSON.stringify(e,(t,n)=>Ea(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function to(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>to(e[n],t[n])):!1}var gx=Object.prototype.hasOwnProperty;function Oa(e,t){if(e===t)return e;const n=Yu(e)&&Yu(t);if(!n&&!(Ea(e)&&Ea(t)))return t;const i=(n?e:Object.keys(e)).length,o=n?t:Object.keys(t),s=o.length,a=n?new Array(s):{};let l=0;for(let c=0;c<s;c++){const u=n?c:o[c],d=e[u],h=t[u];if(d===h){a[u]=d,(n?c<i:gx.call(e,u))&&l++;continue}if(d===null||h===null||typeof d!="object"||typeof h!="object"){a[u]=h;continue}const f=Oa(d,h);a[u]=f,f===d&&l++}return i===s&&l===i?e:a}function rs(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Yu(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ea(e){if(!Zu(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Zu(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Zu(e){return Object.prototype.toString.call(e)==="[object Object]"}function yx(e){return new Promise(t=>{_r.setTimeout(t,e)})}function _a(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Oa(e,t)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return Oa(e,t)}return t}function vx(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function wx(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var is=Symbol();function Of(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===is&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===is?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ef(e,t){return typeof e=="function"?e(...t):!!e}var kr,rr,ii,Gd,bx=(Gd=class extends Ti{constructor(){super();pe(this,kr);pe(this,rr);pe(this,ii);re(this,ii,t=>{if(!Vr&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){T(this,rr)||this.setEventListener(T(this,ii))}onUnsubscribe(){var t;this.hasListeners()||((t=T(this,rr))==null||t.call(this),re(this,rr,void 0))}setEventListener(t){var n;re(this,ii,t),(n=T(this,rr))==null||n.call(this),re(this,rr,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){T(this,kr)!==t&&(re(this,kr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof T(this,kr)=="boolean"?T(this,kr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},kr=new WeakMap,rr=new WeakMap,ii=new WeakMap,Gd),Il=new bx;function Ta(){let e,t;const n=new Promise((i,o)=>{e=i,t=o});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}var xx=hx;function Ix(){let e=[],t=0,n=a=>{a()},r=a=>{a()},i=xx;const o=a=>{t?e.push(a):i(()=>{n(a)})},s=()=>{const a=e;e=[],a.length&&i(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||s()}return l},batchCalls:a=>(...l)=>{o(()=>{a(...l)})},schedule:o,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var dt=Ix(),oi,ir,si,Xd,Cx=(Xd=class extends Ti{constructor(){super();pe(this,oi,!0);pe(this,ir);pe(this,si);re(this,si,t=>{if(!Vr&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){T(this,ir)||this.setEventListener(T(this,si))}onUnsubscribe(){var t;this.hasListeners()||((t=T(this,ir))==null||t.call(this),re(this,ir,void 0))}setEventListener(t){var n;re(this,si,t),(n=T(this,ir))==null||n.call(this),re(this,ir,t(this.setOnline.bind(this)))}setOnline(t){T(this,oi)!==t&&(re(this,oi,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return T(this,oi)}},oi=new WeakMap,ir=new WeakMap,si=new WeakMap,Xd),os=new Cx;function Sx(e){return Math.min(1e3*2**e,3e4)}function _f(e){return(e??"online")==="online"?os.isOnline():!0}var Na=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Tf(e){let t=!1,n=0,r;const i=Ta(),o=()=>i.status!=="pending",s=m=>{var v;if(!o()){const b=new Na(m);h(b),(v=e.onCancel)==null||v.call(e,b)}},a=()=>{t=!0},l=()=>{t=!1},c=()=>Il.isFocused()&&(e.networkMode==="always"||os.isOnline())&&e.canRun(),u=()=>_f(e.networkMode)&&e.canRun(),d=m=>{o()||(r==null||r(),i.resolve(m))},h=m=>{o()||(r==null||r(),i.reject(m))},f=()=>new Promise(m=>{var v;r=b=>{(o()||c())&&m(b)},(v=e.onPause)==null||v.call(e)}).then(()=>{var m;r=void 0,o()||(m=e.onContinue)==null||m.call(e)}),y=()=>{if(o())return;let m;const v=n===0?e.initialPromise:void 0;try{m=v??e.fn()}catch(b){m=Promise.reject(b)}Promise.resolve(m).then(d).catch(b=>{var E;if(o())return;const g=e.retry??(Vr?0:3),w=e.retryDelay??Sx,x=typeof w=="function"?w(n,b):w,O=g===!0||typeof g=="number"&&n<g||typeof g=="function"&&g(n,b);if(t||!O){h(b);return}n++,(E=e.onFail)==null||E.call(e,n,b),yx(x).then(()=>c()?void 0:f()).then(()=>{t?h(b):y()})})};return{promise:i,status:()=>i.status,cancel:s,continue:()=>(r==null||r(),i),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?y():f().then(y),i)}}var Ar,Yd,Nf=(Yd=class{constructor(){pe(this,Ar)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Sa(this.gcTime)&&re(this,Ar,_r.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Vr?1/0:5*60*1e3))}clearGcTimeout(){T(this,Ar)&&(_r.clearTimeout(T(this,Ar)),re(this,Ar,void 0))}},Ar=new WeakMap,Yd),Rr,ai,nn,Pr,ht,uo,Fr,fn,Ln,Zd,Ox=(Zd=class extends Nf{constructor(t){super();pe(this,fn);pe(this,Rr);pe(this,ai);pe(this,nn);pe(this,Pr);pe(this,ht);pe(this,uo);pe(this,Fr);re(this,Fr,!1),re(this,uo,t.defaultOptions),this.setOptions(t.options),this.observers=[],re(this,Pr,t.client),re(this,nn,T(this,Pr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,re(this,Rr,ec(this.options)),this.state=t.state??T(this,Rr),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=T(this,ht))==null?void 0:t.promise}setOptions(t){if(this.options={...T(this,uo),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=ec(this.options);n.data!==void 0&&(this.setData(n.data,{updatedAt:n.dataUpdatedAt,manual:!0}),re(this,Rr,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&T(this,nn).remove(this)}setData(t,n){const r=_a(this.state.data,t,this.options);return Ce(this,fn,Ln).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Ce(this,fn,Ln).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,i;const n=(r=T(this,ht))==null?void 0:r.promise;return(i=T(this,ht))==null||i.cancel(t),n?n.then(Pt).catch(Pt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(T(this,Rr))}isActive(){return this.observers.some(t=>rn(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===is||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>dr(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!Sf(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=T(this,ht))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=T(this,ht))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),T(this,nn).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(T(this,ht)&&(T(this,Fr)?T(this,ht).cancel({revert:!0}):T(this,ht).cancelRetry()),this.scheduleGc()),T(this,nn).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ce(this,fn,Ln).call(this,{type:"invalidate"})}async fetch(t,n){var l,c,u,d,h,f,y,m,v,b,g,w;if(this.state.fetchStatus!=="idle"&&((l=T(this,ht))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(T(this,ht))return T(this,ht).continueRetry(),T(this,ht).promise}if(t&&this.setOptions(t),!this.options.queryFn){const x=this.observers.find(O=>O.options.queryFn);x&&this.setOptions(x.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,i=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(re(this,Fr,!0),r.signal)})},o=()=>{const x=Of(this.options,n),E=(()=>{const D={client:T(this,Pr),queryKey:this.queryKey,meta:this.meta};return i(D),D})();return re(this,Fr,!1),this.options.persister?this.options.persister(x,E,this):x(E)},a=(()=>{const x={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:T(this,Pr),state:this.state,fetchFn:o};return i(x),x})();(c=this.options.behavior)==null||c.onFetch(a,this),re(this,ai,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&Ce(this,fn,Ln).call(this,{type:"fetch",meta:(d=a.fetchOptions)==null?void 0:d.meta}),re(this,ht,Tf({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:x=>{x instanceof Na&&x.revert&&this.setState({...T(this,ai),fetchStatus:"idle"}),r.abort()},onFail:(x,O)=>{Ce(this,fn,Ln).call(this,{type:"failed",failureCount:x,error:O})},onPause:()=>{Ce(this,fn,Ln).call(this,{type:"pause"})},onContinue:()=>{Ce(this,fn,Ln).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const x=await T(this,ht).start();if(x===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(x),(f=(h=T(this,nn).config).onSuccess)==null||f.call(h,x,this),(m=(y=T(this,nn).config).onSettled)==null||m.call(y,x,this.state.error,this),x}catch(x){if(x instanceof Na){if(x.silent)return T(this,ht).promise;if(x.revert){if(this.state.data===void 0)throw x;return this.state.data}}throw Ce(this,fn,Ln).call(this,{type:"error",error:x}),(b=(v=T(this,nn).config).onError)==null||b.call(v,x,this),(w=(g=T(this,nn).config).onSettled)==null||w.call(g,this.state.data,x,this),x}finally{this.scheduleGc()}}},Rr=new WeakMap,ai=new WeakMap,nn=new WeakMap,Pr=new WeakMap,ht=new WeakMap,uo=new WeakMap,Fr=new WeakMap,fn=new WeakSet,Ln=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...kf(r.data,this.options),fetchMeta:t.meta??null};case"success":const i={...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return re(this,ai,t.manual?i:void 0),i;case"error":const o=t.error;return{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),dt.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),T(this,nn).notify({query:this,type:"updated",action:t})})},Zd);function kf(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:_f(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function ec(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Lt,Te,co,At,Dr,li,jn,or,fo,ui,ci,Mr,Lr,sr,di,Le,Wi,ka,Aa,Ra,Pa,Fa,Da,Ma,Af,ef,Ex=(ef=class extends Ti{constructor(t,n){super();pe(this,Le);pe(this,Lt);pe(this,Te);pe(this,co);pe(this,At);pe(this,Dr);pe(this,li);pe(this,jn);pe(this,or);pe(this,fo);pe(this,ui);pe(this,ci);pe(this,Mr);pe(this,Lr);pe(this,sr);pe(this,di,new Set);this.options=n,re(this,Lt,t),re(this,or,null),re(this,jn,Ta()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(T(this,Te).addObserver(this),tc(T(this,Te),this.options)?Ce(this,Le,Wi).call(this):this.updateResult(),Ce(this,Le,Pa).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return La(T(this,Te),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return La(T(this,Te),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ce(this,Le,Fa).call(this),Ce(this,Le,Da).call(this),T(this,Te).removeObserver(this)}setOptions(t){const n=this.options,r=T(this,Te);if(this.options=T(this,Lt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof rn(this.options.enabled,T(this,Te))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ce(this,Le,Ma).call(this),T(this,Te).setOptions(this.options),n._defaulted&&!rs(this.options,n)&&T(this,Lt).getQueryCache().notify({type:"observerOptionsUpdated",query:T(this,Te),observer:this});const i=this.hasListeners();i&&nc(T(this,Te),r,this.options,n)&&Ce(this,Le,Wi).call(this),this.updateResult(),i&&(T(this,Te)!==r||rn(this.options.enabled,T(this,Te))!==rn(n.enabled,T(this,Te))||dr(this.options.staleTime,T(this,Te))!==dr(n.staleTime,T(this,Te)))&&Ce(this,Le,ka).call(this);const o=Ce(this,Le,Aa).call(this);i&&(T(this,Te)!==r||rn(this.options.enabled,T(this,Te))!==rn(n.enabled,T(this,Te))||o!==T(this,sr))&&Ce(this,Le,Ra).call(this,o)}getOptimisticResult(t){const n=T(this,Lt).getQueryCache().build(T(this,Lt),t),r=this.createResult(n,t);return Tx(this,r)&&(re(this,At,r),re(this,li,this.options),re(this,Dr,T(this,Te).state)),r}getCurrentResult(){return T(this,At)}trackResult(t,n){return new Proxy(t,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&T(this,jn).status==="pending"&&T(this,jn).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(t){T(this,di).add(t)}getCurrentQuery(){return T(this,Te)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=T(this,Lt).defaultQueryOptions(t),r=T(this,Lt).getQueryCache().build(T(this,Lt),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return Ce(this,Le,Wi).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),T(this,At)))}createResult(t,n){var M;const r=T(this,Te),i=this.options,o=T(this,At),s=T(this,Dr),a=T(this,li),c=t!==r?t.state:T(this,co),{state:u}=t;let d={...u},h=!1,f;if(n._optimisticResults){const R=this.hasListeners(),P=!R&&tc(t,n),F=R&&nc(t,r,n,i);(P||F)&&(d={...d,...kf(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:y,errorUpdatedAt:m,status:v}=d;f=d.data;let b=!1;if(n.placeholderData!==void 0&&f===void 0&&v==="pending"){let R;o!=null&&o.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(R=o.data,b=!0):R=typeof n.placeholderData=="function"?n.placeholderData((M=T(this,ci))==null?void 0:M.state.data,T(this,ci)):n.placeholderData,R!==void 0&&(v="success",f=_a(o==null?void 0:o.data,R,n),h=!0)}if(n.select&&f!==void 0&&!b)if(o&&f===(s==null?void 0:s.data)&&n.select===T(this,fo))f=T(this,ui);else try{re(this,fo,n.select),f=n.select(f),f=_a(o==null?void 0:o.data,f,n),re(this,ui,f),re(this,or,null)}catch(R){re(this,or,R)}T(this,or)&&(y=T(this,or),f=T(this,ui),m=Date.now(),v="error");const g=d.fetchStatus==="fetching",w=v==="pending",x=v==="error",O=w&&g,E=f!==void 0,N={status:v,fetchStatus:d.fetchStatus,isPending:w,isSuccess:v==="success",isError:x,isInitialLoading:O,isLoading:O,data:f,dataUpdatedAt:d.dataUpdatedAt,error:y,errorUpdatedAt:m,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>c.dataUpdateCount||d.errorUpdateCount>c.errorUpdateCount,isFetching:g,isRefetching:g&&!w,isLoadingError:x&&!E,isPaused:d.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:x&&E,isStale:Cl(t,n),refetch:this.refetch,promise:T(this,jn),isEnabled:rn(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const R=U=>{N.status==="error"?U.reject(N.error):N.data!==void 0&&U.resolve(N.data)},P=()=>{const U=re(this,jn,N.promise=Ta());R(U)},F=T(this,jn);switch(F.status){case"pending":t.queryHash===r.queryHash&&R(F);break;case"fulfilled":(N.status==="error"||N.data!==F.value)&&P();break;case"rejected":(N.status!=="error"||N.error!==F.reason)&&P();break}}return N}updateResult(){const t=T(this,At),n=this.createResult(T(this,Te),this.options);if(re(this,Dr,T(this,Te).state),re(this,li,this.options),T(this,Dr).data!==void 0&&re(this,ci,T(this,Te)),rs(n,t))return;re(this,At,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,o=typeof i=="function"?i():i;if(o==="all"||!o&&!T(this,di).size)return!0;const s=new Set(o??T(this,di));return this.options.throwOnError&&s.add("error"),Object.keys(T(this,At)).some(a=>{const l=a;return T(this,At)[l]!==t[l]&&s.has(l)})};Ce(this,Le,Af).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ce(this,Le,Pa).call(this)}},Lt=new WeakMap,Te=new WeakMap,co=new WeakMap,At=new WeakMap,Dr=new WeakMap,li=new WeakMap,jn=new WeakMap,or=new WeakMap,fo=new WeakMap,ui=new WeakMap,ci=new WeakMap,Mr=new WeakMap,Lr=new WeakMap,sr=new WeakMap,di=new WeakMap,Le=new WeakSet,Wi=function(t){Ce(this,Le,Ma).call(this);let n=T(this,Te).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Pt)),n},ka=function(){Ce(this,Le,Fa).call(this);const t=dr(this.options.staleTime,T(this,Te));if(Vr||T(this,At).isStale||!Sa(t))return;const r=Sf(T(this,At).dataUpdatedAt,t)+1;re(this,Mr,_r.setTimeout(()=>{T(this,At).isStale||this.updateResult()},r))},Aa=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(T(this,Te)):this.options.refetchInterval)??!1},Ra=function(t){Ce(this,Le,Da).call(this),re(this,sr,t),!(Vr||rn(this.options.enabled,T(this,Te))===!1||!Sa(T(this,sr))||T(this,sr)===0)&&re(this,Lr,_r.setInterval(()=>{(this.options.refetchIntervalInBackground||Il.isFocused())&&Ce(this,Le,Wi).call(this)},T(this,sr)))},Pa=function(){Ce(this,Le,ka).call(this),Ce(this,Le,Ra).call(this,Ce(this,Le,Aa).call(this))},Fa=function(){T(this,Mr)&&(_r.clearTimeout(T(this,Mr)),re(this,Mr,void 0))},Da=function(){T(this,Lr)&&(_r.clearInterval(T(this,Lr)),re(this,Lr,void 0))},Ma=function(){const t=T(this,Lt).getQueryCache().build(T(this,Lt),this.options);if(t===T(this,Te))return;const n=T(this,Te);re(this,Te,t),re(this,co,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Af=function(t){dt.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(T(this,At))}),T(this,Lt).getQueryCache().notify({query:T(this,Te),type:"observerResultsUpdated"})})},ef);function _x(e,t){return rn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function tc(e,t){return _x(e,t)||e.state.data!==void 0&&La(e,t,t.refetchOnMount)}function La(e,t,n){if(rn(t.enabled,e)!==!1&&dr(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Cl(e,t)}return!1}function nc(e,t,n,r){return(e!==t||rn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Cl(e,n)}function Cl(e,t){return rn(t.enabled,e)!==!1&&e.isStaleByTime(dr(t.staleTime,e))}function Tx(e,t){return!rs(e.getCurrentResult(),t)}function rc(e){return{onFetch:(t,n)=>{var u,d,h,f,y;const r=t.options,i=(h=(d=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:d.fetchMore)==null?void 0:h.direction,o=((f=t.state.data)==null?void 0:f.pages)||[],s=((y=t.state.data)==null?void 0:y.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let m=!1;const v=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(t.signal.aborted?m=!0:t.signal.addEventListener("abort",()=>{m=!0}),t.signal)})},b=Of(t.options,t.fetchOptions),g=async(w,x,O)=>{if(m)return Promise.reject();if(x==null&&w.pages.length)return Promise.resolve(w);const D=(()=>{const P={client:t.client,queryKey:t.queryKey,pageParam:x,direction:O?"backward":"forward",meta:t.options.meta};return v(P),P})(),N=await b(D),{maxPages:M}=t.options,R=O?wx:vx;return{pages:R(w.pages,N,M),pageParams:R(w.pageParams,x,M)}};if(i&&o.length){const w=i==="backward",x=w?Nx:ic,O={pages:o,pageParams:s},E=x(r,O);a=await g(O,E,w)}else{const w=e??o.length;do{const x=l===0?s[0]??r.initialPageParam:ic(r,a);if(l>0&&x==null)break;a=await g(a,x),l++}while(l<w)}return a};t.options.persister?t.fetchFn=()=>{var m,v;return(v=(m=t.options).persister)==null?void 0:v.call(m,c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=c}}}function ic(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Nx(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var po,Cn,Rt,jr,Sn,tr,tf,kx=(tf=class extends Nf{constructor(t){super();pe(this,Sn);pe(this,po);pe(this,Cn);pe(this,Rt);pe(this,jr);re(this,po,t.client),this.mutationId=t.mutationId,re(this,Rt,t.mutationCache),re(this,Cn,[]),this.state=t.state||Rf(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){T(this,Cn).includes(t)||(T(this,Cn).push(t),this.clearGcTimeout(),T(this,Rt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){re(this,Cn,T(this,Cn).filter(n=>n!==t)),this.scheduleGc(),T(this,Rt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){T(this,Cn).length||(this.state.status==="pending"?this.scheduleGc():T(this,Rt).remove(this))}continue(){var t;return((t=T(this,jr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var s,a,l,c,u,d,h,f,y,m,v,b,g,w,x,O,E,D,N,M;const n=()=>{Ce(this,Sn,tr).call(this,{type:"continue"})},r={client:T(this,po),meta:this.options.meta,mutationKey:this.options.mutationKey};re(this,jr,Tf({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(R,P)=>{Ce(this,Sn,tr).call(this,{type:"failed",failureCount:R,error:P})},onPause:()=>{Ce(this,Sn,tr).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>T(this,Rt).canRun(this)}));const i=this.state.status==="pending",o=!T(this,jr).canStart();try{if(i)n();else{Ce(this,Sn,tr).call(this,{type:"pending",variables:t,isPaused:o}),await((a=(s=T(this,Rt).config).onMutate)==null?void 0:a.call(s,t,this,r));const P=await((c=(l=this.options).onMutate)==null?void 0:c.call(l,t,r));P!==this.state.context&&Ce(this,Sn,tr).call(this,{type:"pending",context:P,variables:t,isPaused:o})}const R=await T(this,jr).start();return await((d=(u=T(this,Rt).config).onSuccess)==null?void 0:d.call(u,R,t,this.state.context,this,r)),await((f=(h=this.options).onSuccess)==null?void 0:f.call(h,R,t,this.state.context,r)),await((m=(y=T(this,Rt).config).onSettled)==null?void 0:m.call(y,R,null,this.state.variables,this.state.context,this,r)),await((b=(v=this.options).onSettled)==null?void 0:b.call(v,R,null,t,this.state.context,r)),Ce(this,Sn,tr).call(this,{type:"success",data:R}),R}catch(R){try{throw await((w=(g=T(this,Rt).config).onError)==null?void 0:w.call(g,R,t,this.state.context,this,r)),await((O=(x=this.options).onError)==null?void 0:O.call(x,R,t,this.state.context,r)),await((D=(E=T(this,Rt).config).onSettled)==null?void 0:D.call(E,void 0,R,this.state.variables,this.state.context,this,r)),await((M=(N=this.options).onSettled)==null?void 0:M.call(N,void 0,R,t,this.state.context,r)),R}finally{Ce(this,Sn,tr).call(this,{type:"error",error:R})}}finally{T(this,Rt).runNext(this)}}},po=new WeakMap,Cn=new WeakMap,Rt=new WeakMap,jr=new WeakMap,Sn=new WeakSet,tr=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),dt.batch(()=>{T(this,Cn).forEach(r=>{r.onMutationUpdate(t)}),T(this,Rt).notify({mutation:this,type:"updated",action:t})})},tf);function Rf(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Bn,pn,ho,nf,Ax=(nf=class extends Ti{constructor(t={}){super();pe(this,Bn);pe(this,pn);pe(this,ho);this.config=t,re(this,Bn,new Set),re(this,pn,new Map),re(this,ho,0)}build(t,n,r){const i=new kx({client:t,mutationCache:this,mutationId:++Do(this,ho)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){T(this,Bn).add(t);const n=jo(t);if(typeof n=="string"){const r=T(this,pn).get(n);r?r.push(t):T(this,pn).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(T(this,Bn).delete(t)){const n=jo(t);if(typeof n=="string"){const r=T(this,pn).get(n);if(r)if(r.length>1){const i=r.indexOf(t);i!==-1&&r.splice(i,1)}else r[0]===t&&T(this,pn).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=jo(t);if(typeof n=="string"){const r=T(this,pn).get(n),i=r==null?void 0:r.find(o=>o.state.status==="pending");return!i||i===t}else return!0}runNext(t){var r;const n=jo(t);if(typeof n=="string"){const i=(r=T(this,pn).get(n))==null?void 0:r.find(o=>o!==t&&o.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){dt.batch(()=>{T(this,Bn).forEach(t=>{this.notify({type:"removed",mutation:t})}),T(this,Bn).clear(),T(this,pn).clear()})}getAll(){return Array.from(T(this,Bn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Xu(n,r))}findAll(t={}){return this.getAll().filter(n=>Xu(t,n))}notify(t){dt.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return dt.batch(()=>Promise.all(t.map(n=>n.continue().catch(Pt))))}},Bn=new WeakMap,pn=new WeakMap,ho=new WeakMap,nf);function jo(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Vn,ar,jt,Un,qn,Go,ja,rf,Rx=(rf=class extends Ti{constructor(n,r){super();pe(this,qn);pe(this,Vn);pe(this,ar);pe(this,jt);pe(this,Un);re(this,Vn,n),this.setOptions(r),this.bindMethods(),Ce(this,qn,Go).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var i;const r=this.options;this.options=T(this,Vn).defaultMutationOptions(n),rs(this.options,r)||T(this,Vn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:T(this,jt),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Ur(r.mutationKey)!==Ur(this.options.mutationKey)?this.reset():((i=T(this,jt))==null?void 0:i.state.status)==="pending"&&T(this,jt).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=T(this,jt))==null||n.removeObserver(this)}onMutationUpdate(n){Ce(this,qn,Go).call(this),Ce(this,qn,ja).call(this,n)}getCurrentResult(){return T(this,ar)}reset(){var n;(n=T(this,jt))==null||n.removeObserver(this),re(this,jt,void 0),Ce(this,qn,Go).call(this),Ce(this,qn,ja).call(this)}mutate(n,r){var i;return re(this,Un,r),(i=T(this,jt))==null||i.removeObserver(this),re(this,jt,T(this,Vn).getMutationCache().build(T(this,Vn),this.options)),T(this,jt).addObserver(this),T(this,jt).execute(n)}},Vn=new WeakMap,ar=new WeakMap,jt=new WeakMap,Un=new WeakMap,qn=new WeakSet,Go=function(){var r;const n=((r=T(this,jt))==null?void 0:r.state)??Rf();re(this,ar,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},ja=function(n){dt.batch(()=>{var r,i,o,s,a,l,c,u;if(T(this,Un)&&this.hasListeners()){const d=T(this,ar).variables,h=T(this,ar).context,f={client:T(this,Vn),meta:this.options.meta,mutationKey:this.options.mutationKey};(n==null?void 0:n.type)==="success"?((i=(r=T(this,Un)).onSuccess)==null||i.call(r,n.data,d,h,f),(s=(o=T(this,Un)).onSettled)==null||s.call(o,n.data,null,d,h,f)):(n==null?void 0:n.type)==="error"&&((l=(a=T(this,Un)).onError)==null||l.call(a,n.error,d,h,f),(u=(c=T(this,Un)).onSettled)==null||u.call(c,void 0,n.error,d,h,f))}this.listeners.forEach(d=>{d(T(this,ar))})})},rf),On,of,Px=(of=class extends Ti{constructor(t={}){super();pe(this,On);this.config=t,re(this,On,new Map)}build(t,n,r){const i=n.queryKey,o=n.queryHash??xl(i,n);let s=this.get(o);return s||(s=new Ox({client:t,queryKey:i,queryHash:o,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(s)),s}add(t){T(this,On).has(t.queryHash)||(T(this,On).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=T(this,On).get(t.queryHash);n&&(t.destroy(),n===t&&T(this,On).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){dt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return T(this,On).get(t)}getAll(){return[...T(this,On).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Gu(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Gu(t,r)):n}notify(t){dt.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){dt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){dt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},On=new WeakMap,of),Ye,lr,ur,fi,pi,cr,hi,mi,sf,Fx=(sf=class{constructor(e={}){pe(this,Ye);pe(this,lr);pe(this,ur);pe(this,fi);pe(this,pi);pe(this,cr);pe(this,hi);pe(this,mi);re(this,Ye,e.queryCache||new Px),re(this,lr,e.mutationCache||new Ax),re(this,ur,e.defaultOptions||{}),re(this,fi,new Map),re(this,pi,new Map),re(this,cr,0)}mount(){Do(this,cr)._++,T(this,cr)===1&&(re(this,hi,Il.subscribe(async e=>{e&&(await this.resumePausedMutations(),T(this,Ye).onFocus())})),re(this,mi,os.subscribe(async e=>{e&&(await this.resumePausedMutations(),T(this,Ye).onOnline())})))}unmount(){var e,t;Do(this,cr)._--,T(this,cr)===0&&((e=T(this,hi))==null||e.call(this),re(this,hi,void 0),(t=T(this,mi))==null||t.call(this),re(this,mi,void 0))}isFetching(e){return T(this,Ye).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return T(this,lr).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=T(this,Ye).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=T(this,Ye).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(dr(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return T(this,Ye).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=T(this,Ye).get(r.queryHash),o=i==null?void 0:i.state.data,s=mx(t,o);if(s!==void 0)return T(this,Ye).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return dt.batch(()=>T(this,Ye).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=T(this,Ye).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=T(this,Ye);dt.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=T(this,Ye);return dt.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=dt.batch(()=>T(this,Ye).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(Pt).catch(Pt)}invalidateQueries(e,t={}){return dt.batch(()=>(T(this,Ye).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=dt.batch(()=>T(this,Ye).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(Pt)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(Pt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=T(this,Ye).build(this,t);return n.isStaleByTime(dr(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Pt).catch(Pt)}fetchInfiniteQuery(e){return e.behavior=rc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Pt).catch(Pt)}ensureInfiniteQueryData(e){return e.behavior=rc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return os.isOnline()?T(this,lr).resumePausedMutations():Promise.resolve()}getQueryCache(){return T(this,Ye)}getMutationCache(){return T(this,lr)}getDefaultOptions(){return T(this,ur)}setDefaultOptions(e){re(this,ur,e)}setQueryDefaults(e,t){T(this,fi).set(Ur(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...T(this,fi).values()],n={};return t.forEach(r=>{to(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){T(this,pi).set(Ur(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...T(this,pi).values()],n={};return t.forEach(r=>{to(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...T(this,ur).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=xl(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===is&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...T(this,ur).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){T(this,Ye).clear(),T(this,lr).clear()}},Ye=new WeakMap,lr=new WeakMap,ur=new WeakMap,fi=new WeakMap,pi=new WeakMap,cr=new WeakMap,hi=new WeakMap,mi=new WeakMap,sf),Pf=W.createContext(void 0),st=e=>{const t=W.useContext(Pf);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Dx=({client:e,children:t})=>(W.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),p.jsx(Pf.Provider,{value:e,children:t})),Ff=W.createContext(!1),Mx=()=>W.useContext(Ff);Ff.Provider;function Lx(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var jx=W.createContext(Lx()),Bx=()=>W.useContext(jx),Vx=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Ux=e=>{W.useEffect(()=>{e.clearReset()},[e])},$x=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Ef(n,[e.error,r])),qx=e=>{if(e.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},zx=(e,t)=>e.isLoading&&e.isFetching&&!t,Kx=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,oc=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Hx(e,t,n){var d,h,f,y,m;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=Mx(),i=Bx(),o=st(),s=o.defaultQueryOptions(e);(h=(d=o.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||h.call(d,s),process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),s._optimisticResults=r?"isRestoring":"optimistic",qx(s),Vx(s,i),Ux(i);const a=!o.getQueryCache().get(s.queryHash),[l]=W.useState(()=>new t(o,s)),c=l.getOptimisticResult(s),u=!r&&e.subscribed!==!1;if(W.useSyncExternalStore(W.useCallback(v=>{const b=u?l.subscribe(dt.batchCalls(v)):Pt;return l.updateResult(),b},[l,u]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),W.useEffect(()=>{l.setOptions(s)},[s,l]),Kx(s,c))throw oc(s,l,i);if($x({result:c,errorResetBoundary:i,throwOnError:s.throwOnError,query:o.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw c.error;if((y=(f=o.getDefaultOptions().queries)==null?void 0:f._experimental_afterQuery)==null||y.call(f,s,c),s.experimental_prefetchInRender&&!Vr&&zx(c,r)){const v=a?oc(s,l,i):(m=o.getQueryCache().get(s.queryHash))==null?void 0:m.promise;v==null||v.catch(Pt).finally(()=>{l.updateResult()})}return s.notifyOnChangeProps?c:l.trackResult(c)}function Hr(e,t){return Hx(e,Ex)}function zn(e,t){const n=st(),[r]=W.useState(()=>new Rx(n,e));W.useEffect(()=>{r.setOptions(e)},[r,e]);const i=W.useSyncExternalStore(W.useCallback(s=>r.subscribe(dt.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),o=W.useCallback((s,a)=>{r.mutate(s,a).catch(Pt)},[r]);if(i.error&&Ef(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:o,mutateAsync:i.mutate}}const Df=C.createContext(null),Jx=Df.Provider,Mf=()=>C.useContext(Df);var Ee=(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.VALUE_MAPPING="valueMappingError",e))(Ee||{});const Lf=C.createContext(void 0);function An(){const e=C.useContext(Lf);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Wx=(()=>{const e={};return Object.values(Ee).forEach(t=>{e[t]={}}),e})();function Qx({children:e}){const[t,n]=C.useState(Wx),r=C.useCallback((u,d,h=!0)=>{n(f=>{const y={...f};return y[u]=y[u]||{},y[u][d]=h,y})},[n]),i=C.useCallback((u,d)=>{var h;return!!((h=t[u])!=null&&h[d])},[t]),o=C.useCallback((u,d)=>{var h;return(h=t[u])==null?void 0:h[d]},[t]),s=C.useCallback((u,d)=>{n(h=>{var y;const f={...h};return(y=f[u])==null||delete y[d],f})},[n]),a=C.useCallback(u=>{n(d=>{const h={...d};return h[u]={},h})},[n]),l=C.useCallback((u,d)=>{n(h=>{const f={...h};return f[u]=f[u]||{},d.forEach(y=>{f[u][y]=!0}),f})},[n]),c=C.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:i,removeError:s,resetBoundary:a,setErrors:l,getError:o}),[t,n,r,i,s,a,l,o]);return p.jsx(Lf.Provider,{value:c,children:e})}new TextEncoder;const Ba=new TextDecoder;function Gx(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function Xx(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof e=="string"?e:Ba.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=Ba.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return Gx(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}class jf extends Error{constructor(n,r){var i;super(n,r);Ui(this,"code","ERR_JOSE_GENERIC");this.name=this.constructor.name,(i=Error.captureStackTrace)==null||i.call(Error,this,this.constructor)}}Ui(jf,"code","ERR_JOSE_GENERIC");class nr extends jf{constructor(){super(...arguments);Ui(this,"code","ERR_JWT_INVALID")}}Ui(nr,"code","ERR_JWT_INVALID");function Yx(e){return typeof e=="object"&&e!==null}const Zx=e=>{if(!Yx(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t};function eI(e){if(typeof e!="string")throw new nr("JWTs must use Compact JWS serialization, JWT must be a string");const{1:t,length:n}=e.split(".");if(n===5)throw new nr("Only JWTs using Compact JWS serialization can be decoded");if(n!==3)throw new nr("Invalid JWT");if(!t)throw new nr("JWTs must contain a payload");let r;try{r=Xx(t)}catch{throw new nr("Failed to base64url decode the payload")}let i;try{i=JSON.parse(Ba.decode(r))}catch{throw new nr("Failed to parse the decoded payload as JSON")}if(!Zx(i))throw new nr("Invalid JWT Claims Set");return i}const Va="amp-labs_jwt_",tI=10*60*1e3,sc=(e,t)=>`${e}:${t}`,ac=e=>`${Va}${e}`,Bf=C.createContext(null),nI=e=>{try{const t=eI(e);return t.exp&&typeof t.exp=="number"?t.exp*1e3:null}catch(t){return console.warn("Failed to decode JWT token:",t),null}};function rI({getTokenCallback:e,children:t}){const[n,r]=C.useState(new Map);C.useEffect(()=>{try{const l=new Map,c=Date.now();Object.keys(sessionStorage).forEach(u=>{if(u.startsWith(Va)){const d=u.replace(Va,""),h=sessionStorage.getItem(u);if(h)try{const f=JSON.parse(h);f.expiresAt>c?l.set(d,f):sessionStorage.removeItem(u)}catch{sessionStorage.removeItem(u)}}}),l.size>0&&r(l)}catch{console.warn("Failed to load JWT tokens from sessionStorage")}},[]);const i=C.useCallback((l,c)=>{const u=sc(l,c),d=Date.now(),h=n.get(u);if(h&&h.expiresAt>d)return h.token;n.delete(u);const f=ac(u),y=sessionStorage.getItem(f);if(y)try{const m=JSON.parse(y);if(m.expiresAt>d)return r(v=>new Map(v).set(u,m)),m.token;sessionStorage.removeItem(f)}catch{sessionStorage.removeItem(f)}return null},[n]),o=C.useCallback(async(l,c,u)=>{const d=sc(l,c),f=await nI(u)||Date.now()+tI,y={token:u,expiresAt:f};r(m=>new Map(m).set(d,y));try{sessionStorage.setItem(ac(d),JSON.stringify(y))}catch{console.warn("Failed to store JWT token in sessionStorage")}},[]),s=C.useCallback(async({consumerRef:l,groupRef:c})=>{const u=i(l,c);if(u)return u;if(!e)throw new Error("JWT token callback not provided");try{const d=await e({consumerRef:l,groupRef:c});return await o(l,c,d),d}catch(d){throw console.error("Failed to get JWT token:",d),new Error("Failed to get JWT token")}},[e,i,o]),a={getToken:e?s:void 0};return p.jsx(Bf.Provider,{value:a,children:t})}const iI=()=>{const e=C.useContext(Bf);if(!e)throw new Error("useJwtToken must be used within a JwtTokenProvider");return e},Sl=C.createContext(null);function Ze(){const e=C.useContext(Sl);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
2
+ component is wrapped with AmpersandProvider`);return e}const oI=new Fx({defaultOptions:{queries:{retry:(e,t)=>{if(t instanceof wl){const n=t.response.status;if(n>=400&&n<500)return!1}return e<3}}}});function sI(e){const{options:{apiKey:t,projectId:n,project:r,getToken:i},children:o}=e,s=r||n;if(n&&r)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!s)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t&&!i)throw new Error("Cannot use AmpersandProvider without an apiKey or getToken.");if(t&&i)throw new Error("Cannot use AmpersandProvider with both apiKey and getToken.");const a={options:e.options,projectIdOrName:s};return p.jsx(Dx,{client:oI,children:p.jsx(Sl.Provider,{value:a,children:p.jsx(Qx,{children:p.jsx(rI,{getTokenCallback:i||null,children:p.jsx(Jx,{value:t||null,children:o})})})})})}var Vf=Symbol.for("immer-nothing"),lc=Symbol.for("immer-draftable"),Qt=Symbol.for("immer-state"),aI=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 Bt(e,...t){if(process.env.NODE_ENV!=="production"){const n=aI[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 yi=Object.getPrototypeOf;function vi(e){return!!e&&!!e[Qt]}function $r(e){var t;return e?Uf(e)||Array.isArray(e)||!!e[lc]||!!((t=e.constructor)!=null&&t[lc])||mo(e)||Ss(e):!1}var lI=Object.prototype.constructor.toString();function Uf(e){if(!e||typeof e!="object")return!1;const t=yi(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)===lI}function ss(e,t){Cs(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Cs(e){const t=e[Qt];return t?t.type_:Array.isArray(e)?1:mo(e)?2:Ss(e)?3:0}function Ua(e,t){return Cs(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function $f(e,t,n){const r=Cs(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function uI(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function mo(e){return e instanceof Map}function Ss(e){return e instanceof Set}function Or(e){return e.copy_||e.base_}function $a(e,t){if(mo(e))return new Map(e);if(Ss(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Uf(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Qt];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(yi(e),r)}else{const r=yi(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function Ol(e,t=!1){return Os(e)||vi(e)||!$r(e)||(Cs(e)>1&&Object.defineProperties(e,{set:{value:Bo},add:{value:Bo},clear:{value:Bo},delete:{value:Bo}}),Object.freeze(e),t&&Object.values(e).forEach(n=>Ol(n,!0))),e}function Bo(){Bt(2)}function Os(e){return Object.isFrozen(e)}var cI={};function qr(e){const t=cI[e];return t||Bt(0,e),t}var no;function qf(){return no}function dI(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function uc(e,t){t&&(qr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function qa(e){za(e),e.drafts_.forEach(fI),e.drafts_=null}function za(e){e===no&&(no=e.parent_)}function cc(e){return no=dI(no,e)}function fI(e){const t=e[Qt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function dc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Qt].modified_&&(qa(t),Bt(4)),$r(e)&&(e=as(t,e),t.parent_||ls(t,e)),t.patches_&&qr("Patches").generateReplacementPatches_(n[Qt].base_,e,t.patches_,t.inversePatches_)):e=as(t,n,[]),qa(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Vf?e:void 0}function as(e,t,n){if(Os(t))return t;const r=t[Qt];if(!r)return ss(t,(i,o)=>fc(e,r,t,i,o,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return ls(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),ss(o,(a,l)=>fc(e,r,i,a,l,n,s)),ls(e,i,!1),n&&e.patches_&&qr("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function fc(e,t,n,r,i,o,s){if(process.env.NODE_ENV!=="production"&&i===n&&Bt(5),vi(i)){const a=o&&t&&t.type_!==3&&!Ua(t.assigned_,r)?o.concat(r):void 0,l=as(e,i,a);if($f(n,r,l),vi(l))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if($r(i)&&!Os(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;as(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(mo(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&ls(e,i)}}function ls(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ol(t,n)}function pI(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:qf(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=El;n&&(i=[r],o=ro);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,a}var El={get(e,t){if(t===Qt)return e;const n=Or(e);if(!Ua(n,t))return hI(e,n,t);const r=n[t];return e.finalized_||!$r(r)?r:r===Gs(e.base_,t)?(Xs(e),e.copy_[t]=Ha(r,e)):r},has(e,t){return t in Or(e)},ownKeys(e){return Reflect.ownKeys(Or(e))},set(e,t,n){const r=zf(Or(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=Gs(Or(e),t),o=i==null?void 0:i[Qt];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(uI(n,i)&&(n!==void 0||Ua(e.base_,t)))return!0;Xs(e),Ka(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 Gs(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Xs(e),Ka(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Or(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Bt(11)},getPrototypeOf(e){return yi(e.base_)},setPrototypeOf(){Bt(12)}},ro={};ss(El,(e,t)=>{ro[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});ro.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Bt(13),ro.set.call(this,e,t,void 0)};ro.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Bt(14),El.set.call(this,e[0],t,n,e[0])};function Gs(e,t){const n=e[Qt];return(n?Or(n):e)[t]}function hI(e,t,n){var i;const r=zf(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function zf(e,t){if(!(t in e))return;let n=yi(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=yi(n)}}function Ka(e){e.modified_||(e.modified_=!0,e.parent_&&Ka(e.parent_))}function Xs(e){e.copy_||(e.copy_=$a(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var mI=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(l=o,...c){return s.produce(l,u=>n.call(this,u,...c))}}typeof n!="function"&&Bt(6),r!==void 0&&typeof r!="function"&&Bt(7);let i;if($r(t)){const o=cc(this),s=Ha(t,void 0);let a=!0;try{i=n(s),a=!1}finally{a?qa(o):za(o)}return uc(o,r),dc(i,o)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===Vf&&(i=void 0),this.autoFreeze_&&Ol(i,!0),r){const o=[],s=[];qr("Patches").generateReplacementPatches_(t,i,o,s),r(o,s)}return i}else Bt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,l=>t(l,...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){$r(e)||Bt(8),vi(e)&&(e=gI(e));const t=cc(this),n=Ha(e,void 0);return n[Qt].isManual_=!0,za(t),n}finishDraft(e,t){const n=e&&e[Qt];(!n||!n.isManual_)&&Bt(9);const{scope_:r}=n;return uc(r,t),dc(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=qr("Patches").applyPatches_;return vi(e)?r(e,t):this.produce(e,i=>r(i,t))}};function Ha(e,t){const n=mo(e)?qr("MapSet").proxyMap_(e,t):Ss(e)?qr("MapSet").proxySet_(e,t):pI(e,t);return(t?t.scope_:qf()).drafts_.push(n),n}function gI(e){return vi(e)||Bt(10,e),Kf(e)}function Kf(e){if(!$r(e)||Os(e))return e;const t=e[Qt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=$a(e,t.scope_.immer_.useStrictShallowCopy_)}else n=$a(e,!0);return ss(n,(r,i)=>{$f(n,r,Kf(i))}),t&&(t.finalized_=!1),n}var yI=new mI,Kt=yI.produce,sn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ni(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var us={exports:{}};us.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=1,o=2,s=9007199254740991,a="[object Arguments]",l="[object Array]",c="[object AsyncFunction]",u="[object Boolean]",d="[object Date]",h="[object Error]",f="[object Function]",y="[object GeneratorFunction]",m="[object Map]",v="[object Number]",b="[object Null]",g="[object Object]",w="[object Promise]",x="[object Proxy]",O="[object RegExp]",E="[object Set]",D="[object String]",N="[object Symbol]",M="[object Undefined]",R="[object WeakMap]",P="[object ArrayBuffer]",F="[object DataView]",U="[object Float32Array]",B="[object Float64Array]",X="[object Int8Array]",se="[object Int16Array]",ce="[object Int32Array]",ge="[object Uint8Array]",we="[object Uint8ClampedArray]",I="[object Uint16Array]",J="[object Uint32Array]",V=/[\\^$.*+?()[\]{}|]/g,S=/^\[object .+?Constructor\]$/,z=/^(?:0|[1-9]\d*)$/,$={};$[U]=$[B]=$[X]=$[se]=$[ce]=$[ge]=$[we]=$[I]=$[J]=!0,$[a]=$[l]=$[P]=$[u]=$[F]=$[d]=$[h]=$[f]=$[m]=$[v]=$[g]=$[O]=$[E]=$[D]=$[R]=!1;var Y=typeof sn=="object"&&sn&&sn.Object===Object&&sn,ne=typeof self=="object"&&self&&self.Object===Object&&self,te=Y||ne||Function("return this")(),ae=t&&!t.nodeType&&t,Z=ae&&!0&&e&&!e.nodeType&&e,ye=Z&&Z.exports===ae,q=ye&&Y.process,be=function(){try{return q&&q.binding&&q.binding("util")}catch{}}(),ee=be&&be.isTypedArray;function Ke(_,A){for(var K=-1,le=_==null?0:_.length,He=0,xe=[];++K<le;){var Xe=_[K];A(Xe,K,_)&&(xe[He++]=Xe)}return xe}function Be(_,A){for(var K=-1,le=A.length,He=_.length;++K<le;)_[He+K]=A[K];return _}function je(_,A){for(var K=-1,le=_==null?0:_.length;++K<le;)if(A(_[K],K,_))return!0;return!1}function et(_,A){for(var K=-1,le=Array(_);++K<_;)le[K]=A(K);return le}function at(_){return function(A){return _(A)}}function lt(_,A){return _.has(A)}function Oe(_,A){return _==null?void 0:_[A]}function ft(_){var A=-1,K=Array(_.size);return _.forEach(function(le,He){K[++A]=[He,le]}),K}function _t(_,A){return function(K){return _(A(K))}}function mt(_){var A=-1,K=Array(_.size);return _.forEach(function(le){K[++A]=le}),K}var nt=Array.prototype,j=Function.prototype,H=Object.prototype,L=te["__core-js_shared__"],oe=j.toString,ue=H.hasOwnProperty,Je=function(){var _=/[^.]+$/.exec(L&&L.keys&&L.keys.IE_PROTO||"");return _?"Symbol(src)_1."+_:""}(),Tt=H.toString,gt=RegExp("^"+oe.call(ue).replace(V,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),bt=ye?te.Buffer:void 0,Ve=te.Symbol,ke=te.Uint8Array,Nt=H.propertyIsEnumerable,yt=nt.splice,Ft=Ve?Ve.toStringTag:void 0,Jn=Object.getOwnPropertySymbols,Wn=bt?bt.isBuffer:void 0,Qn=_t(Object.keys,Object),wn=Xr(te,"DataView"),ln=Xr(te,"Map"),Gn=Xr(te,"Promise"),We=Xr(te,"Set"),ut=Xr(te,"WeakMap"),he=Xr(Object,"create"),_e=Ir(wn),kt=Ir(ln),Dn=Ir(Gn),ie=Ir(We),me=Ir(ut),de=Ve?Ve.prototype:void 0,Ne=de?de.valueOf:void 0;function Ue(_){var A=-1,K=_==null?0:_.length;for(this.clear();++A<K;){var le=_[A];this.set(le[0],le[1])}}function Xt(){this.__data__=he?he(null):{},this.size=0}function Yt(_){var A=this.has(_)&&delete this.__data__[_];return this.size-=A?1:0,A}function vt(_){var A=this.__data__;if(he){var K=A[_];return K===r?void 0:K}return ue.call(A,_)?A[_]:void 0}function Dt(_){var A=this.__data__;return he?A[_]!==void 0:ue.call(A,_)}function $e(_,A){var K=this.__data__;return this.size+=this.has(_)?0:1,K[_]=he&&A===void 0?r:A,this}Ue.prototype.clear=Xt,Ue.prototype.delete=Yt,Ue.prototype.get=vt,Ue.prototype.has=Dt,Ue.prototype.set=$e;function xt(_){var A=-1,K=_==null?0:_.length;for(this.clear();++A<K;){var le=_[A];this.set(le[0],le[1])}}function qs(){this.__data__=[],this.size=0}function zs(_){var A=this.__data__,K=ko(A,_);if(K<0)return!1;var le=A.length-1;return K==le?A.pop():yt.call(A,K,1),--this.size,!0}function Eo(_){var A=this.__data__,K=ko(A,_);return K<0?void 0:A[K][1]}function _o(_){return ko(this.__data__,_)>-1}function To(_,A){var K=this.__data__,le=ko(K,_);return le<0?(++this.size,K.push([_,A])):K[le][1]=A,this}xt.prototype.clear=qs,xt.prototype.delete=zs,xt.prototype.get=Eo,xt.prototype.has=_o,xt.prototype.set=To;function bn(_){var A=-1,K=_==null?0:_.length;for(this.clear();++A<K;){var le=_[A];this.set(le[0],le[1])}}function No(){this.size=0,this.__data__={hash:new Ue,map:new(ln||xt),string:new Ue}}function Ae(_){var A=Ao(this,_).delete(_);return this.size-=A?1:0,A}function un(_){return Ao(this,_).get(_)}function Li(_){return Ao(this,_).has(_)}function xr(_,A){var K=Ao(this,_),le=K.size;return K.set(_,A),this.size+=K.size==le?0:1,this}bn.prototype.clear=No,bn.prototype.delete=Ae,bn.prototype.get=un,bn.prototype.has=Li,bn.prototype.set=xr;function Gr(_){var A=-1,K=_==null?0:_.length;for(this.__data__=new bn;++A<K;)this.add(_[A])}function ji(_){return this.__data__.set(_,r),this}function tg(_){return this.__data__.has(_)}Gr.prototype.add=Gr.prototype.push=ji,Gr.prototype.has=tg;function Xn(_){var A=this.__data__=new xt(_);this.size=A.size}function ng(){this.__data__=new xt,this.size=0}function rg(_){var A=this.__data__,K=A.delete(_);return this.size=A.size,K}function ig(_){return this.__data__.get(_)}function og(_){return this.__data__.has(_)}function sg(_,A){var K=this.__data__;if(K instanceof xt){var le=K.__data__;if(!ln||le.length<n-1)return le.push([_,A]),this.size=++K.size,this;K=this.__data__=new bn(le)}return K.set(_,A),this.size=K.size,this}Xn.prototype.clear=ng,Xn.prototype.delete=rg,Xn.prototype.get=ig,Xn.prototype.has=og,Xn.prototype.set=sg;function ag(_,A){var K=Ro(_),le=!K&&Ig(_),He=!K&&!le&&Ks(_),xe=!K&&!le&&!He&&$u(_),Xe=K||le||He||xe,pt=Xe?et(_.length,String):[],wt=pt.length;for(var Ge in _)ue.call(_,Ge)&&!(Xe&&(Ge=="length"||He&&(Ge=="offset"||Ge=="parent")||xe&&(Ge=="buffer"||Ge=="byteLength"||Ge=="byteOffset")||yg(Ge,wt)))&&pt.push(Ge);return pt}function ko(_,A){for(var K=_.length;K--;)if(ju(_[K][0],A))return K;return-1}function lg(_,A,K){var le=A(_);return Ro(_)?le:Be(le,K(_))}function Bi(_){return _==null?_===void 0?M:b:Ft&&Ft in Object(_)?mg(_):xg(_)}function Fu(_){return Vi(_)&&Bi(_)==a}function Du(_,A,K,le,He){return _===A?!0:_==null||A==null||!Vi(_)&&!Vi(A)?_!==_&&A!==A:ug(_,A,K,le,Du,He)}function ug(_,A,K,le,He,xe){var Xe=Ro(_),pt=Ro(A),wt=Xe?l:Yn(_),Ge=pt?l:Yn(A);wt=wt==a?g:wt,Ge=Ge==a?g:Ge;var qt=wt==g,cn=Ge==g,It=wt==Ge;if(It&&Ks(_)){if(!Ks(A))return!1;Xe=!0,qt=!1}if(It&&!qt)return xe||(xe=new Xn),Xe||$u(_)?Mu(_,A,K,le,He,xe):pg(_,A,wt,K,le,He,xe);if(!(K&i)){var Zt=qt&&ue.call(_,"__wrapped__"),en=cn&&ue.call(A,"__wrapped__");if(Zt||en){var Zn=Zt?_.value():_,Mn=en?A.value():A;return xe||(xe=new Xn),He(Zn,Mn,K,le,xe)}}return It?(xe||(xe=new Xn),hg(_,A,K,le,He,xe)):!1}function cg(_){if(!Uu(_)||wg(_))return!1;var A=Bu(_)?gt:S;return A.test(Ir(_))}function dg(_){return Vi(_)&&Vu(_.length)&&!!$[Bi(_)]}function fg(_){if(!bg(_))return Qn(_);var A=[];for(var K in Object(_))ue.call(_,K)&&K!="constructor"&&A.push(K);return A}function Mu(_,A,K,le,He,xe){var Xe=K&i,pt=_.length,wt=A.length;if(pt!=wt&&!(Xe&&wt>pt))return!1;var Ge=xe.get(_);if(Ge&&xe.get(A))return Ge==A;var qt=-1,cn=!0,It=K&o?new Gr:void 0;for(xe.set(_,A),xe.set(A,_);++qt<pt;){var Zt=_[qt],en=A[qt];if(le)var Zn=Xe?le(en,Zt,qt,A,_,xe):le(Zt,en,qt,_,A,xe);if(Zn!==void 0){if(Zn)continue;cn=!1;break}if(It){if(!je(A,function(Mn,Cr){if(!lt(It,Cr)&&(Zt===Mn||He(Zt,Mn,K,le,xe)))return It.push(Cr)})){cn=!1;break}}else if(!(Zt===en||He(Zt,en,K,le,xe))){cn=!1;break}}return xe.delete(_),xe.delete(A),cn}function pg(_,A,K,le,He,xe,Xe){switch(K){case F:if(_.byteLength!=A.byteLength||_.byteOffset!=A.byteOffset)return!1;_=_.buffer,A=A.buffer;case P:return!(_.byteLength!=A.byteLength||!xe(new ke(_),new ke(A)));case u:case d:case v:return ju(+_,+A);case h:return _.name==A.name&&_.message==A.message;case O:case D:return _==A+"";case m:var pt=ft;case E:var wt=le&i;if(pt||(pt=mt),_.size!=A.size&&!wt)return!1;var Ge=Xe.get(_);if(Ge)return Ge==A;le|=o,Xe.set(_,A);var qt=Mu(pt(_),pt(A),le,He,xe,Xe);return Xe.delete(_),qt;case N:if(Ne)return Ne.call(_)==Ne.call(A)}return!1}function hg(_,A,K,le,He,xe){var Xe=K&i,pt=Lu(_),wt=pt.length,Ge=Lu(A),qt=Ge.length;if(wt!=qt&&!Xe)return!1;for(var cn=wt;cn--;){var It=pt[cn];if(!(Xe?It in A:ue.call(A,It)))return!1}var Zt=xe.get(_);if(Zt&&xe.get(A))return Zt==A;var en=!0;xe.set(_,A),xe.set(A,_);for(var Zn=Xe;++cn<wt;){It=pt[cn];var Mn=_[It],Cr=A[It];if(le)var qu=Xe?le(Cr,Mn,It,A,_,xe):le(Mn,Cr,It,_,A,xe);if(!(qu===void 0?Mn===Cr||He(Mn,Cr,K,le,xe):qu)){en=!1;break}Zn||(Zn=It=="constructor")}if(en&&!Zn){var Po=_.constructor,Fo=A.constructor;Po!=Fo&&"constructor"in _&&"constructor"in A&&!(typeof Po=="function"&&Po instanceof Po&&typeof Fo=="function"&&Fo instanceof Fo)&&(en=!1)}return xe.delete(_),xe.delete(A),en}function Lu(_){return lg(_,Og,gg)}function Ao(_,A){var K=_.__data__;return vg(A)?K[typeof A=="string"?"string":"hash"]:K.map}function Xr(_,A){var K=Oe(_,A);return cg(K)?K:void 0}function mg(_){var A=ue.call(_,Ft),K=_[Ft];try{_[Ft]=void 0;var le=!0}catch{}var He=Tt.call(_);return le&&(A?_[Ft]=K:delete _[Ft]),He}var gg=Jn?function(_){return _==null?[]:(_=Object(_),Ke(Jn(_),function(A){return Nt.call(_,A)}))}:Eg,Yn=Bi;(wn&&Yn(new wn(new ArrayBuffer(1)))!=F||ln&&Yn(new ln)!=m||Gn&&Yn(Gn.resolve())!=w||We&&Yn(new We)!=E||ut&&Yn(new ut)!=R)&&(Yn=function(_){var A=Bi(_),K=A==g?_.constructor:void 0,le=K?Ir(K):"";if(le)switch(le){case _e:return F;case kt:return m;case Dn:return w;case ie:return E;case me:return R}return A});function yg(_,A){return A=A??s,!!A&&(typeof _=="number"||z.test(_))&&_>-1&&_%1==0&&_<A}function vg(_){var A=typeof _;return A=="string"||A=="number"||A=="symbol"||A=="boolean"?_!=="__proto__":_===null}function wg(_){return!!Je&&Je in _}function bg(_){var A=_&&_.constructor,K=typeof A=="function"&&A.prototype||H;return _===K}function xg(_){return Tt.call(_)}function Ir(_){if(_!=null){try{return oe.call(_)}catch{}try{return _+""}catch{}}return""}function ju(_,A){return _===A||_!==_&&A!==A}var Ig=Fu(function(){return arguments}())?Fu:function(_){return Vi(_)&&ue.call(_,"callee")&&!Nt.call(_,"callee")},Ro=Array.isArray;function Cg(_){return _!=null&&Vu(_.length)&&!Bu(_)}var Ks=Wn||_g;function Sg(_,A){return Du(_,A)}function Bu(_){if(!Uu(_))return!1;var A=Bi(_);return A==f||A==y||A==c||A==x}function Vu(_){return typeof _=="number"&&_>-1&&_%1==0&&_<=s}function Uu(_){var A=typeof _;return _!=null&&(A=="object"||A=="function")}function Vi(_){return _!=null&&typeof _=="object"}var $u=ee?at(ee):dg;function Og(_){return Cg(_)?ag(_):fg(_)}function Eg(){return[]}function _g(){return!1}e.exports=Sg})(us,us.exports);var vI=us.exports;const Hf=Ni(vI),it=async(e,t)=>{var n;if(e instanceof wl){const{status:r,statusText:i}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,i);try{const s=await e.response.clone().json(),a=((n=s==null?void 0:s.causes)==null?void 0:n.join(`
3
+ `))||(s==null?void 0:s.detail);a?(console.error("[Error Message]",a),s!=null&&s.remedy&&console.error("[Remedy]",s.remedy)):console.error("Unexpected error response:",s);const l=`${a} ${s!=null&&s.remedy?`
4
4
 
5
- [Remedy] ${s.remedy}`:""}`;t&&t(u)}catch(o){console.error("Error parsing error response body:",o)}}else console.error("Unexpected error:",e.message)};function jo(){const e=ut(),{projectIdOrName:t}=Ke(),{setError:n,removeError:r}=sn(),i=Er({queryKey:["amp","integrations",t],queryFn:async()=>{if(!t)throw new Error("Project ID or name is required");return(await e()).integrationApi.listIntegrations({projectIdOrName:t})},enabled:!!t});return I.useEffect(()=>{i.isError?(Je(i.error),n(we.INTEGRATION_LIST,t)):r(we.INTEGRATION_LIST,t)},[i.isError,i.error,t,n,r]),i}const pa=(e,t)=>{var s;const n=ut(),{projectIdOrName:r}=Ke(),{data:i}=jo(),o=(s=i==null?void 0:i.find(a=>a.name===e))==null?void 0:s.id;return Er({queryKey:["amp","installations",r,o,t],queryFn:async()=>{if(!r)throw new Error("Project ID is required");if(!o)throw new Error("Integration ID is required");if(!t)throw new Error("Group reference is required");return(await n()).installationApi.listInstallations({projectIdOrName:r,integrationId:o,groupRef:t})},enabled:!!r&&!!o&&!!t&&!!i&&i.length>0})},Yn=()=>{var i,o;const{setError:e}=sn(),t=ut(),{projectIdOrName:n}=Ke(),r=Er({queryKey:["project",n],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:n})});return I.useEffect(()=>{r.isError&&e(we.PROJECT,n)},[r.isError,n,e]),{...r,projectIdOrName:n,appName:(i=r.data)==null?void 0:i.name,projectId:(o=r.data)==null?void 0:o.id}};function Nr(){const{integrationNameOrId:e,groupRef:t}=Tr(),n=pa(e,t),{isPending:r,isFetching:i,isError:o,isSuccess:s,error:a,data:u}=n;return{installation:u==null?void 0:u[0],isPending:r,isFetching:i,isError:o,isSuccess:s,error:a}}const oi=e=>{const t=jo(),n=t.data,r=n==null?void 0:n.find(i=>i.name===e||i.id===e);return{...t,data:r,provider:r==null?void 0:r.provider}},ha=()=>{const{groupRef:e,integrationNameOrId:t}=Tr(),{provider:n}=oi(t),r=ya({groupRef:e,provider:n}),{isPending:i,isFetching:o,isError:s,isSuccess:a,error:u,data:f}=r;return{connection:f==null?void 0:f[0],error:u,isPending:i,isFetching:o,isError:s,isSuccess:a}},Ol=()=>{var d;const e=ut(),{connection:t,isPending:n,isFetching:r}=ha(),{projectIdOrName:i}=Ke(),{integrationNameOrId:o}=Tr(),{data:s}=oi(o),a=t==null?void 0:t.id,u=s==null?void 0:s.id,f=(d=s==null?void 0:s.latestRevision)==null?void 0:d.id;return Er({queryKey:["amp","hydratedRevision",i,u,f,a],queryFn:async()=>{if(!i)throw new Error("projectIdOrName is required");if(!u)throw new Error("integrationId is required");if(!f)throw new Error("revisionId is required");if(!a)throw new Error("connectionId is required");return(await e()).revisionApi.getHydratedRevision({projectIdOrName:i,integrationId:u,revisionId:f,connectionId:a})},enabled:!!i&&!!u&&!!f&&!!a&&!(n||r)})};function Lo(){var l,d;const e=Ol(),{isLoading:t,isPending:n,isFetching:r,isError:i,isSuccess:o,error:s,data:a}=e,u=a==null?void 0:a.content,f=I.useMemo(()=>({getReadObject:h=>{var y,w;const m=(w=(y=u==null?void 0:u.read)==null?void 0:y.objects)==null?void 0:w.find(g=>g.objectName===h);return m?{object:m,getRequiredFields:()=>m.requiredFields??[],getOptionalFields:()=>m.optionalFields??[]}:(console.error(`Object ${h} not found`),{object:null,getRequiredFields:()=>null,getOptionalFields:()=>null})},getWriteObject:h=>{var y,w;const m=(w=(y=u==null?void 0:u.write)==null?void 0:y.objects)==null?void 0:w.find(g=>g.objectName===h);return m?{object:m}:(console.error(`Object ${h} not found`),{object:null})},getCustomerFieldsForObject:h=>{var y,w;const m=(w=(y=u==null?void 0:u.read)==null?void 0:y.objects)==null?void 0:w.find(g=>g.objectName===h);return m?{allFields:m.allFieldsMetadata??{},getField:g=>{var p;const O=(p=m.allFieldsMetadata)==null?void 0:p[g];return O||(console.error(`Field ${g} not found`),null)}}:(console.error(`Object ${h} not found`),{allFields:null,getField:()=>null})}}),[(l=u==null?void 0:u.read)==null?void 0:l.objects,(d=u==null?void 0:u.write)==null?void 0:d.objects]);return{data:a,isLoading:t,isPending:n,isFetching:r,isError:i,isSuccess:o,error:s,...f}}function fw(e){var m,y,w,g;const[t,n]=I.useState(e),r=I.useRef(void 0),{getReadObject:i,data:o}=Lo(),{installation:s}=Nr(),a=I.useCallback(()=>t,[t]),u=I.useCallback((O,p)=>{var N,F;p.provider=p.provider||((N=o==null?void 0:o.content)==null?void 0:N.provider)||"";const b=p.read||{objects:{}},v=b.objects||{},x=v[O]||{},S=i(O),A={};return(F=S==null?void 0:S.getRequiredFields())==null||F.forEach(R=>{"fieldName"in R&&(A[R.fieldName]=!0)}),x.objectName=x.objectName||O,x.selectedFields=x.selectedFields||A,v[O]=x,b.objects=v,p.read=b,{read:b,objects:v,obj:x}},[i,(m=o==null?void 0:o.content)==null?void 0:m.provider]),f=I.useCallback(O=>{var p,b;return{object:(b=(p=t.read)==null?void 0:p.objects)==null?void 0:b[O],getSelectedField:v=>{var x,S,A,N;return!!((N=(A=(S=(x=t.read)==null?void 0:x.objects)==null?void 0:S[O])==null?void 0:A.selectedFields)!=null&&N[v])},setSelectedField:({fieldName:v,selected:x})=>{n(S=>Nt(S,A=>{const{obj:N}=u(O,A);N.selectedFields=N.selectedFields||{},N.selectedFields[v]=x,N.selectedFields[v]===!1&&delete N.selectedFields[v]}))},getFieldMapping:v=>{var x,S,A,N;return(N=(A=(S=(x=t.read)==null?void 0:x.objects)==null?void 0:S[O])==null?void 0:A.selectedFieldMappings)==null?void 0:N[v]},setFieldMapping:({fieldName:v,mapToName:x})=>{n(S=>Nt(S,A=>{const{obj:N}=u(O,A);N.selectedFieldMappings=N.selectedFieldMappings||{},N.selectedFieldMappings[x]=v}))},deleteFieldMapping:v=>{n(x=>Nt(x,S=>{var N,F,R;const A=(R=(F=(N=S.read)==null?void 0:N.objects)==null?void 0:F[O])==null?void 0:R.selectedFieldMappings;A&&v in A&&delete A[v]}))}}},[(y=t.read)==null?void 0:y.objects,u]),l=I.useCallback(O=>{var S,A;const p=(A=(S=t.write)==null?void 0:S.objects)==null?void 0:A[O],b=N=>{const F=N.write||{},R=F.objects||{},D=R[O]||{objectName:O};return R[O]=D,F.objects=R,N.write=F,{write:F,objects:R,obj:D}},v=(N,F)=>{var R,D;return(D=(R=p==null?void 0:p.selectedFieldSettings)==null?void 0:R[N])==null?void 0:D[F]},x=(N,F,R)=>{n(D=>Nt(D,K=>{var L;const{obj:j}=b(K);j.selectedFieldSettings={...j.selectedFieldSettings,[N]:{...(L=j.selectedFieldSettings)==null?void 0:L[N],[F]:R}}}))};return{object:p,setEnableWrite:()=>{n(N=>Nt(N,F=>{const{obj:R}=b(F);R.objectName=O}))},setDisableWrite:()=>{n(N=>Nt(N,F=>{const{objects:R}=b(F);delete R[O]}))},getWriteObject:()=>{var N,F;return(F=(N=t.write)==null?void 0:N.objects)==null?void 0:F[O]},getSelectedFieldSettings:N=>{var F;return(F=p==null?void 0:p.selectedFieldSettings)==null?void 0:F[N]},setSelectedFieldSettings:({fieldName:N,settings:F})=>{n(R=>Nt(R,D=>{const{obj:K}=b(D),j=K.selectedFieldSettings||{};K.selectedFieldSettings={...j,[N]:F},F===void 0&&delete K.selectedFieldSettings[N]}))},getDefaultValues:N=>v(N,"default"),setDefaultValues:({fieldName:N,value:F})=>x(N,"default",F),getWriteOnCreateSetting:N=>v(N,"writeOnCreate"),setWriteOnCreateSetting:({fieldName:N,value:F})=>x(N,"writeOnCreate",F),getWriteOnUpdateSetting:N=>v(N,"writeOnUpdate"),setWriteOnUpdateSetting:({fieldName:N,value:F})=>x(N,"writeOnUpdate",F)}},[(w=t.write)==null?void 0:w.objects]),d=I.useCallback(()=>({object:t.proxy,setEnableProxy:()=>{n(O=>Nt(O,p=>{p.proxy={enabled:!0}}))},setDisableProxy:()=>{n(O=>Nt(O,p=>{p.proxy={enabled:!1}}))},getProxyEnabled:()=>{var O;return((O=t.proxy)==null?void 0:O.enabled)||!1}}),[t.proxy]),h=I.useCallback(()=>{n(O=>Nt(O,p=>{var b;Object.assign(p,(b=s==null?void 0:s.config)==null?void 0:b.content)}))},[(g=s==null?void 0:s.config)==null?void 0:g.content]);return I.useEffect(()=>{s&&(console.debug("Installation found",{installation:s}),r.current?xl(r.current,s)||(console.debug("Installation changed, resetting config",{previous:r.current,current:s}),h(),r.current=s):(r.current=s,h()))},[s,h]),{draft:t,get:a,reset:h,setDraft:n,readObject:f,writeObject:l,proxy:d}}const ma=I.createContext(null);function pw({children:e,initialConfig:t}){const n=fw(t);return c.jsx(ma.Provider,{value:n,children:e})}function hw(){const e=I.useContext(ma);if(!e)throw new Error("useLocalConfig must be used within a ConfigProvider / InstallationProvider");return e}function mw(){console.warn("useConfig is deprecated. Please use useLocalConfig instead.");const e=I.useContext(ma);if(!e)throw new Error("useConfigContext must be used within a ConfigProvider / InstallationProvider");return e}const _l=I.createContext({integrationNameOrId:"",consumerRef:"",consumerName:void 0,groupRef:"",groupName:void 0});function Tr(){const e=I.useContext(_l);if(!e)throw new Error("useInstallationProps must be used within an InstallationProvider");return e}function ga({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o}){const s=I.useMemo(()=>({integrationNameOrId:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o}),[t,n,r,i,o]);return c.jsx(_l.Provider,{value:s,children:c.jsx(pw,{initialConfig:{},children:e})})}class Bs{constructor(t){this.connectionApi=new Xy(t),this.installationApi=new Yy(t),this.integrationApi=new Zy(t),this.oAuthApi=new ev(t),this.projectApi=new tv(t),this.providerApi=new nv(t),this.providerAppApi=new rv(t),this.revisionApi=new iv(t)}}const Sl="2.9.10",gw="v1",to="https://api.withampersand.com";function El(){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 to;case"mock":return"http://127.0.0.1:4010";case"":return to;default:return e??to}}catch{return to}}const yw=(e,t)=>`${e}/${t}`;function vw(){return yw(El(),gw)}const Nl=El(),Tl=vw(),ww=new ia({basePath:Tl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Sl}});new Bs(ww);const bw=e=>({header:"X-Api-Key",value:e}),Iw=e=>{try{return{header:"Authorization",value:`Bearer ${e}`}}catch(t){throw console.error("Failed to get JWT token for API authentication:",t),new Error("Failed to authenticate with JWT token")}},kc=(e,t)=>new ia({basePath:Tl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Sl,[e]:t}});function ut(){const e=pl(),{getToken:t}=Xv(),{consumerRef:n,groupRef:r}=Tr();return I.useCallback(async()=>{if(e){const o=bw(e),s=kc(o.header,o.value);return new Bs(s)}if(t){if(!n||!r)throw console.error("Unable to create JWT API service without consumerRef or groupRef.",{consumerRef:n,groupRef:r}),new Error("Unable to create JWT API service without consumerRef or groupRef.");const o=await t({consumerRef:n,groupRef:r}),s=Iw(o),a=kc(s.header,s.value);return new Bs(a)}throw console.error("Unable to create API service without API key or JWT token."),new Error("Unable to create API service without API key or JWT token.")},[e,t,n,r])}const ya=({groupRef:e,provider:t})=>{const{projectIdOrName:n}=Ke(),r=ut();return Er({queryKey:["amp","connections",n,e,t],queryFn:async()=>{if(!n)throw new Error("Project ID or name not found. Please wrap this component inside of AmpersandProvider");if(!e)throw new Error("Group reference not found.");if(!t)throw new Error("Provider not found.");return(await r()).connectionApi.listConnections({projectIdOrName:n,groupRef:e,provider:t})},retry:3,enabled:!!n&&!!e&&!!t})};function Cw({height:e="48",width:t="48"}){return c.jsxs("svg",{width:t,height:e,viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.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"}),c.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}const xw="_box_1p7c5_1",jc={box:xw};function _n({children:e,className:t,style:n}){return c.jsx("div",{className:t?`${jc.box} ${t}`:jc.box,style:n,children:e})}const Ow="_container_1wvzr_1",Lc={container:Ow};function si({children:e,className:t,style:n}){return c.jsx("div",{className:t?`${Lc.container} ${t}`:Lc.container,style:n,children:e})}const _w="_errorBoxContainer_19655_1",Sw="_errorBox_19655_1",Ew="_errorIconWrapper_19655_23",Nw="_errorText_19655_34",uo={errorBoxContainer:_w,errorBox:Sw,errorIconWrapper:Ew,errorText:Nw};function Rl({message:e}){return c.jsxs(_n,{className:uo.errorBox,children:[c.jsx("div",{className:uo.errorIconWrapper,children:c.jsx(Cw,{width:"20",height:"20"})}),c.jsx("p",{className:uo.errorText,children:e})]})}function Al({message:e,children:t}){return c.jsxs(si,{className:uo.errorBoxContainer,children:[c.jsx(Rl,{message:e}),t]})}const Tw="_loader_6ubm6_1",Rw={loader:Tw};function Aw(){return c.jsx("span",{className:Rw.loader})}function _i(){return c.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:c.jsx(Aw,{})})}function Fl({children:e}){return c.jsx(si,{style:{maxWidth:"55rem"},children:c.jsx(_n,{children:e})})}function ai(){return c.jsx(Fl,{children:c.jsx(_i,{})})}function _t({message:e,children:t}){return c.jsx(Fl,{children:c.jsx(Al,{message:e,children:t})})}function Wt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Fw(e,t){return(t==null?void 0:t.displayName)??Wt(e)}const Pw=e=>e.split(`
6
- `).filter(n=>n.trim()!==""),Dw=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null;function Mw(e){return!e||typeof e!="string"?"id_"+Math.random().toString(36).substr(2,9):e.toLowerCase().replace(/[^a-z0-9_-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").replace(/^[^a-z]/,"id-").substring(0,50)}const kw=()=>{const[e,t]=I.useState(!1),n=I.useCallback(()=>{t(!0)},[t]),r=I.useCallback(()=>{t(!1)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n,resetIntegrationDeleted:r}},Pl=I.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:()=>{},resetComponent:()=>{}});function lt(){const e=I.useContext(Pl);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function jw({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:u,fieldMapping:f,resetComponent:l}){const{data:d}=jo(),{setError:h,isError:m,removeError:y}=sn(),{isIntegrationDeleted:w,setIntegrationDeleted:g,resetIntegrationDeleted:O}=kw(),p=I.useMemo(()=>Dw(t,d||[]),[t,d]),{data:b,isLoading:v,isError:x,error:S}=pa(t,i),A=(b==null?void 0:b[0])||null;I.useEffect(()=>{O()},[t,n,r,i,o,f]),I.useEffect(()=>{p===null&&(d!=null&&d.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,p,d]),I.useEffect(()=>{x?(h(we.INSTALLATION_LIST,(p==null?void 0:p.id)||""),Je(S)):y(we.INSTALLATION_LIST,(p==null?void 0:p.id)||"")},[x,p,h,y,S]);const N=We(),F=I.useCallback(()=>{N.invalidateQueries({queryKey:["amp","installations"]})},[N]),R=I.useCallback(j=>{N.setQueryData(["amp","installations"],[j]),N.invalidateQueries({queryKey:["amp","installations"]})},[N]),D=(p==null?void 0:p.id)||"",K=I.useMemo(()=>({integrationId:(p==null?void 0:p.id)||"",provider:(p==null?void 0:p.provider)||"",integrationObj:p,consumerRef:n,consumerName:r,groupRef:i,groupName:o,installation:A||void 0,setInstallation:R,resetInstallations:F,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:u,isIntegrationDeleted:w,setIntegrationDeleted:g,fieldMapping:f,resetComponent:l}),[p,n,r,i,o,A,R,F,s,a,u,w,g,f,l]);if(v)return c.jsx(ai,{});if(p===null)return c.jsx(_t,{message:`Integration "${t}" not found`});if(m(we.INSTALLATION_LIST,D)){const j=`Error retrieving installation information for integration "${(p==null?void 0:p.name)||"unknown"}"`;return c.jsx(_t,{message:j})}return c.jsx(Pl.Provider,{value:K,children:e})}const Dl=I.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),an=()=>{const e=I.useContext(Dl);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function Ml({groupRef:e,provider:t,children:n}){const r=We(),{setError:i,isError:o}=sn(),{projectIdOrName:s,isLoading:a}=Yn(),{integrationId:u,groupRef:f}=lt(),{provider:l}=oi(u),{data:d,isLoading:h,isError:m,error:y}=ya({groupRef:e||f,provider:l||t}),w=d==null?void 0:d[0],g=I.useCallback(b=>{r.setQueryData(["amp","connections"],()=>b),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),O=I.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);I.useEffect(()=>{m?(i(we.CONNECTION_LIST,s,!0),Je(y)):i(we.CONNECTION_LIST,s,!1)},[m,i,s,y]);const p=I.useMemo(()=>({connections:d||null,isConnectionsLoading:h,selectedConnection:w||null,setConnections:g,setSelectedConnection:O}),[d,h,w,g,O]);if(h||a)return c.jsx(ai,{});if(s&&o(we.PROJECT,s))return c.jsx(_t,{message:`Error loading project ${s}`});if(s&&o(we.CONNECTION_LIST,s))return c.jsx(_t,{message:"Error retrieving existing connections"});if(!s)throw new Error("Project ID or Project Name not found. ConnectionsProvider must be used within AmpersandProvider");return c.jsx(Dl.Provider,{value:p,children:n})}const kl=()=>{const e=ut(),t=We(),[n,r]=I.useState(null);return{...On({mutationKey:["createInstallation"],mutationFn:async o=>(await e()).installationApi.createInstallation(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:o=>{console.error("Error creating installation"),Je(o,r)}}),errorMsg:n}};function Lw(e){return typeof e.provider=="string"}function Vw(e){return Lw(e)?{data:e}:{error:new Error("Config must have a provider field for creation")}}function jl(){const{projectIdOrName:e}=Ke(),{groupRef:t,integrationNameOrId:n}=Tr(),{data:r}=oi(n),{connection:i}=ha(),{installation:o}=Nr(),s=We(),{mutate:a,isIdle:u,isPending:f,error:l,errorMsg:d}=kl();return{createInstallation:({config:m,onSuccess:y,onError:w,onSettled:g})=>{if(o){const b=new Error("Installation already created. Try updating instead.");w==null||w(b),g==null||g();return}if(!r){const b=new Error("No integration found");w==null||w(b),g==null||g();return}const O=Vw(m);if(O.error||!O.data){w==null||w(O.error||new Error("Invalid configuration data")),g==null||g();return}const p={projectIdOrName:e,integrationId:r==null?void 0:r.id,installation:{groupRef:t,connectionId:i==null?void 0:i.id,config:{content:O.data}}};return a(p,{onSuccess:b=>{y==null||y(b)},onError:b=>{w==null||w(b)},onSettled:()=>{g==null||g(),s.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:u,isPending:f,error:l,errorMsg:d}}const $w=()=>{const e=ut(),t=We(),[n,r]=I.useState(null);return{...On({mutationKey:["updateInstallation"],mutationFn:async o=>(await e()).installationApi.updateInstallation(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:o=>{console.error("Error updating installation"),Je(o,r)}}),errorMsg:n}};function Ll(){const{projectIdOrName:e}=Ke(),{integrationNameOrId:t}=Tr(),{data:n}=oi(t),{installation:r}=Nr(),i=We(),{mutate:o,isIdle:s,isPending:a,error:u,errorMsg:f}=$w();return{updateInstallation:({config:d,onSuccess:h,onError:m,onSettled:y})=>{var O,p,b,v,x;if(!r){const S=new Error("Installation not created yet. Try creating the installation first.");m==null||m(S),y==null||y();return}if(!n){const S=new Error("No integration found");m==null||m(S),y==null||y();return}const w=[];if((O=d==null?void 0:d.write)!=null&&O.objects){const S=Object.keys(d.write.objects).length,A=Object.keys(((v=(b=(p=r==null?void 0:r.config)==null?void 0:p.content)==null?void 0:b.write)==null?void 0:v.objects)||{}).length;(S>0||S===0&&A>0)&&w.push("config.content.write.objects")}if((x=d==null?void 0:d.read)!=null&&x.objects){const S=Object.keys(d.read.objects);w.push(...S.map(A=>`config.content.read.objects.${A}`))}const g={projectIdOrName:e,integrationId:n==null?void 0:n.id,installationId:r.id,installationUpdate:{updateMask:w,installation:{config:{content:d}}}};return o(g,{onSuccess:S=>{h==null||h(S)},onError:S=>{m==null||m(S)},onSettled:()=>{y==null||y(),i.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:s,isPending:a,error:u,errorMsg:f}}const Kw=()=>{const e=ut(),t=We(),[n,r]=I.useState(null);return{...On({mutationKey:["deleteInstallation"],mutationFn:async o=>(await e()).installationApi.deleteInstallation(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:o=>{console.error("Error deleting installation"),Je(o,r)}}),errorMsg:n}};function Uw(){const{projectIdOrName:e}=Ke(),{integrationNameOrId:t}=Tr(),{data:n}=oi(t),{installation:r}=Nr(),i=We(),{mutate:o,isIdle:s,isPending:a,error:u,errorMsg:f}=Kw();return{deleteInstallation:({onSuccess:d,onError:h,onSettled:m})=>{if(!r){const y=new Error("Installation not found. Not able to delete installation.");h==null||h(y),m==null||m();return}if(!n){const y=new Error("No integration found");h==null||h(y),m==null||m();return}return o({projectIdOrName:e,integrationId:n==null?void 0:n.id,installationId:r.id},{onSuccess:()=>{d==null||d()},onError:y=>{h==null||h(y)},onSettled:()=>{m==null||m(),i.invalidateQueries({queryKey:["amp","installations"]}),i.invalidateQueries({queryKey:["amp","connections"]})}})},isIdle:s,isPending:a,error:u,errorMsg:f}}function Vl(){const[e,t]=I.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}var Io={exports:{}};Io.exports;(function(e,t){var n=9007199254740991,r="[object Arguments]",i="[object Function]",o="[object GeneratorFunction]",s="[object Map]",a="[object Object]",u="[object Promise]",f="[object Set]",l="[object WeakMap]",d="[object DataView]",h=/[\\^$.*+?()[\]{}|]/g,m=/^\[object .+?Constructor\]$/,y=typeof Hn=="object"&&Hn&&Hn.Object===Object&&Hn,w=typeof self=="object"&&self&&self.Object===Object&&self,g=y||w||Function("return this")(),O=t&&!t.nodeType&&t,p=O&&!0&&e&&!e.nodeType&&e,b=p&&p.exports===O;function v(J,pe){return J==null?void 0:J[pe]}function x(J){var pe=!1;if(J!=null&&typeof J.toString!="function")try{pe=!!(J+"")}catch{}return pe}function S(J,pe){return function(_e){return J(pe(_e))}}var A=Function.prototype,N=Object.prototype,F=g["__core-js_shared__"],R=function(){var J=/[^.]+$/.exec(F&&F.keys&&F.keys.IE_PROTO||"");return J?"Symbol(src)_1."+J:""}(),D=A.toString,K=N.hasOwnProperty,j=N.toString,L=RegExp("^"+D.call(K).replace(h,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),se=b?g.Buffer:void 0,re=N.propertyIsEnumerable,ge=se?se.isBuffer:void 0,de=S(Object.keys,Object),be=k(g,"DataView"),P=k(g,"Map"),$=k(g,"Promise"),H=k(g,"Set"),U=k(g,"WeakMap"),q=!re.call({valueOf:1},"valueOf"),V=Ce(be),G=Ce(P),Z=Ce($),Y=Ce(H),ee=Ce(U);function ne(J){return j.call(J)}function ce(J){if(!Ye(J)||z(J))return!1;var pe=yt(J)||x(J)?L:m;return pe.test(Ce(J))}function k(J,pe){var _e=v(J,pe);return ce(_e)?_e:void 0}var ve=ne;(be&&ve(new be(new ArrayBuffer(1)))!=d||P&&ve(new P)!=s||$&&ve($.resolve())!=u||H&&ve(new H)!=f||U&&ve(new U)!=l)&&(ve=function(J){var pe=j.call(J),_e=pe==a?J.constructor:void 0,ln=_e?Ce(_e):void 0;if(ln)switch(ln){case V:return d;case G:return s;case Z:return u;case Y:return f;case ee:return l}return pe});function z(J){return!!R&&R in J}function Xe(J){var pe=J&&J.constructor,_e=typeof pe=="function"&&pe.prototype||N;return J===_e}function Ce(J){if(J!=null){try{return D.call(J)}catch{}try{return J+""}catch{}}return""}function st(J){return xe(J)&&K.call(J,"callee")&&(!re.call(J,"callee")||j.call(J)==r)}var Ue=Array.isArray;function rt(J){return J!=null&&vt(J.length)&&!yt(J)}function xe(J){return Ze(J)&&rt(J)}var ze=ge||De;function ft(J){if(rt(J)&&(Ue(J)||typeof J=="string"||typeof J.splice=="function"||ze(J)||st(J)))return!J.length;var pe=ve(J);if(pe==s||pe==f)return!J.size;if(q||Xe(J))return!de(J).length;for(var _e in J)if(K.call(J,_e))return!1;return!0}function yt(J){var pe=Ye(J)?j.call(J):"";return pe==i||pe==o}function vt(J){return typeof J=="number"&&J>-1&&J%1==0&&J<=n}function Ye(J){var pe=typeof J;return!!J&&(pe=="object"||pe=="function")}function Ze(J){return!!J&&typeof J=="object"}function De(){return!1}e.exports=ft})(Io,Io.exports);var qw=Io.exports;const Bw=ko(qw),Qr="other",Co="manage-tab";function Zn(e){return!e.fieldName}function $l(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function Jw(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!Zn(n)&&!!n.fieldName))||null}function Hw(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>Zn(r)&&!!r.mapToName))||[]}function Ww(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>Zn(r)&&!!r.mapToName))||[]}function Kl(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!Zn(n)&&!!n.fieldName))||null}const Ul=(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 zw(e){return Zn(e)?e.mapToName:e.fieldName}const ql=(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)&&Wt(s==null?void 0:s.objectName),completed:e?!!Ul(e,s.objectName):!1})}),n},Bl=e=>{var n;return{name:Qr,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function Qw(e,t){var o;const n=ql(e,t),i=!!((o=t==null?void 0:t.content)!=null&&o.write)?Bl(e):void 0;return i&&n.push(i),n}function Jl(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(we.MAPPING,i),r!=null&&r.length&&console.error("required fields not met",r.map(o=>o.mapToDisplayName)),{errorList:i}}function Vc(e,t){return Bw(e)?!0:Object.values(e).every(t)}function va(e,t,n){const r=Vc(e,n),i=Vc(t,n);return r&&i?!0:r!==i?!1:xl(e,t)}function Hl(e,t){return va(e,t,n=>n===!1||n===void 0)}function Wl(e,t){return va(e,t,n=>!n||n==="")}function zl(e,t){return va(e,t,n=>!n||typeof n!="object"?!0:Object.keys(n).length===0)}function Ql(e,t){const n=new Set(Object.values(e).map(i=>i==null?void 0:i.objectName)),r=new Set(Object.values(t).map(i=>i==null?void 0:i.objectName));return n.size===r.size&&[...n].every(i=>r.has(i))}const Gw=(e,t,n)=>{var y,w,g,O,p,b;if(!e)return null;const r=$l(e,t),i=r&&Jw(r),o=r&&Kl(r),s=r&&Hw(r),a=r&&Ww(r),u=(r==null?void 0:r.allFields)||[],f=(r==null?void 0:r.allFieldsMetadata)||{},l=n==null?void 0:n.content,d=((g=(w=(y=l==null?void 0:l.read)==null?void 0:y.objects)==null?void 0:w[t])==null?void 0:g.selectedValueMappings)||{},h=((b=(p=(O=l==null?void 0:l.read)==null?void 0:O.objects)==null?void 0:p[t])==null?void 0:b.selectedFieldMappings)||{},m=wa(n,{content:{read:e}},t);return{allFields:u,allFieldsMetadata:f,requiredFields:i,optionalFields:o,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:m,selectedFieldMappings:h,selectedValueMappings:d}},Xw=(e,t)=>{var r,i;if(!e)return null;const n=(i=(r=t==null?void 0:t.content)==null?void 0:r.write)==null?void 0:i.objects;return{writeObjects:(e==null?void 0:e.objects)||[],selectedWriteObjects:n||{}}};function Gl(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:Gw(r,t,n),write:Xw(i,n)}}const Xl=(e,t,n,r)=>{const i=Gl(e,n,t);r(n,i)},Yw=(e,t,n)=>{const r=Qw(t,e),i={};r.forEach(({name:o,completed:s})=>{s&&(i[o]=Gl(e,o,t))}),n(i)},Yl=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(o=>r.add(zw(o))),{...Array.from(r).reduce((o,s)=>({...o,[s]:!0}),{}),...n||{}}},Zl=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},ed=(e,t)=>!t||!t[e]?[]:t[e],td=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t},wa=(e,t,n)=>{var f,l,d,h,m;if(!e||!t)return{};const r=(f=t==null?void 0:t.content)==null?void 0:f.read;if(!r)return{};const i=$l(r,n),o=i&&Kl(i),s=new Set((o==null?void 0:o.filter(y=>!Zn(y)&&!!y.fieldName).map(y=>y.fieldName))||[]),a=((m=(h=(d=(l=e==null?void 0:e.content)==null?void 0:l.read)==null?void 0:d.objects)==null?void 0:h[n])==null?void 0:m.selectedFields)||{};return Object.entries(a).reduce((y,[w,g])=>(s.has(w)&&(y[w]=g),y),{})},nd=(e,t)=>{var r,i,o,s;return!e||!t?{}:((s=(o=(i=(r=e==null?void 0:e.content)==null?void 0:r.read)==null?void 0:i.objects)==null?void 0:o[t])==null?void 0:s.selectedFieldMappings)||{}};function rd(e,t){return t[e]||void 0}function Mi(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const Zw=(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)},eb=(e,t,n,r,i)=>{const o=Yl(e),s=Zl(e),a=ed(t,i),u=td(e),f=Zw(n,t);if(!f)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const l={createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,selectedFields:o,selectedFieldMappings:s,dynamicMappingsInput:a,selectedValueMappings:u||{},backfill:f.backfill}}}}};return Mi(n)&&(l.content.proxy={enabled:!0}),l},id=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},tb=e=>{const t=e.content.write;return t==null?void 0:t.objects},nb=(e,t,n)=>{if(!tb(t))return console.error("Error when getting write objects from hydratedRevision"),null;const i=id(e),o={createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:i}}};return Mi(t)&&(o.content.proxy={enabled:!0}),o};var od={exports:{}};/*!
5
+ [Remedy] ${s.remedy}`:""}`;t&&t(l)}catch(o){console.error("Error parsing error response body:",o)}}else console.error("Unexpected error:",e.message)};function Es(){const e=Ct(),{projectIdOrName:t}=Ze(),{setError:n,removeError:r}=An(),i=Hr({queryKey:["amp","integrations",t],queryFn:async()=>{if(!t)throw new Error("Project ID or name is required");return(await e()).integrationApi.listIntegrations({projectIdOrName:t})},enabled:!!t});return C.useEffect(()=>{i.isError?(it(i.error),n(Ee.INTEGRATION_LIST,t)):r(Ee.INTEGRATION_LIST,t)},[i.isError,i.error,t,n,r]),i}const _l=(e,t)=>{var s;const n=Ct(),{projectIdOrName:r}=Ze(),{data:i}=Es(),o=(s=i==null?void 0:i.find(a=>a.name===e))==null?void 0:s.id;return Hr({queryKey:["amp","installations",r,o,t],queryFn:async()=>{if(!r)throw new Error("Project ID is required");if(!o)throw new Error("Integration ID is required");if(!t)throw new Error("Group reference is required");return(await n()).installationApi.listInstallations({projectIdOrName:r,integrationId:o,groupRef:t})},enabled:!!r&&!!o&&!!t&&!!i&&i.length>0})},gr=()=>{var i,o;const{setError:e}=An(),t=Ct(),{projectIdOrName:n}=Ze(),r=Hr({queryKey:["project",n],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:n})});return C.useEffect(()=>{r.isError&&e(Ee.PROJECT,n)},[r.isError,n,e]),{...r,projectIdOrName:n,appName:(i=r.data)==null?void 0:i.name,projectId:(o=r.data)==null?void 0:o.id}};function Jr(){const{integrationNameOrId:e,groupRef:t}=Wr(),n=_l(e,t),{isPending:r,isFetching:i,isError:o,isSuccess:s,error:a,data:l}=n;return{installation:l==null?void 0:l[0],isPending:r,isFetching:i,isError:o,isSuccess:s,error:a}}const ki=e=>{const t=Es(),n=t.data,r=n==null?void 0:n.find(i=>i.name===e||i.id===e);return{...t,data:r,provider:r==null?void 0:r.provider}},Tl=()=>{const{groupRef:e,integrationNameOrId:t}=Wr(),{provider:n}=ki(t),r=Al({groupRef:e,provider:n}),{isPending:i,isFetching:o,isError:s,isSuccess:a,error:l,data:c}=r;return{connection:c==null?void 0:c[0],error:l,isPending:i,isFetching:o,isError:s,isSuccess:a}},Jf=()=>{var d;const e=Ct(),{connection:t,isPending:n,isFetching:r}=Tl(),{projectIdOrName:i}=Ze(),{integrationNameOrId:o}=Wr(),{data:s}=ki(o),a=t==null?void 0:t.id,l=s==null?void 0:s.id,c=(d=s==null?void 0:s.latestRevision)==null?void 0:d.id;return Hr({queryKey:["amp","hydratedRevision",i,l,c,a],queryFn:async()=>{if(!i)throw new Error("projectIdOrName is required");if(!l)throw new Error("integrationId is required");if(!c)throw new Error("revisionId is required");if(!a)throw new Error("connectionId is required");return(await e()).revisionApi.getHydratedRevision({projectIdOrName:i,integrationId:l,revisionId:c,connectionId:a})},enabled:!!i&&!!l&&!!c&&!!a&&!(n||r)})};function _s(){var u,d;const e=Jf(),{isLoading:t,isPending:n,isFetching:r,isError:i,isSuccess:o,error:s,data:a}=e,l=a==null?void 0:a.content,c=C.useMemo(()=>({getReadObject:h=>{var y,m;const f=(m=(y=l==null?void 0:l.read)==null?void 0:y.objects)==null?void 0:m.find(v=>v.objectName===h);return f?{object:f,getRequiredFields:()=>f.requiredFields??[],getOptionalFields:()=>f.optionalFields??[]}:(console.error(`Object ${h} not found`),{object:null,getRequiredFields:()=>null,getOptionalFields:()=>null})},getWriteObject:h=>{var y,m;const f=(m=(y=l==null?void 0:l.write)==null?void 0:y.objects)==null?void 0:m.find(v=>v.objectName===h);return f?{object:f}:(console.error(`Object ${h} not found`),{object:null})},getCustomerFieldsForObject:h=>{var y,m;const f=(m=(y=l==null?void 0:l.read)==null?void 0:y.objects)==null?void 0:m.find(v=>v.objectName===h);return f?{allFields:f.allFieldsMetadata??{},getField:v=>{var g;const b=(g=f.allFieldsMetadata)==null?void 0:g[v];return b||(console.error(`Field ${v} not found`),null)}}:(console.error(`Object ${h} not found`),{allFields:null,getField:()=>null})}}),[(u=l==null?void 0:l.read)==null?void 0:u.objects,(d=l==null?void 0:l.write)==null?void 0:d.objects]);return{data:a,isLoading:t,isPending:n,isFetching:r,isError:i,isSuccess:o,error:s,...c}}function wI(e){var f,y,m,v;const[t,n]=C.useState(e),r=C.useRef(void 0),{getReadObject:i,data:o}=_s(),{installation:s}=Jr(),a=C.useCallback(()=>t,[t]),l=C.useCallback((b,g)=>{var N,M;g.provider=g.provider||((N=o==null?void 0:o.content)==null?void 0:N.provider)||"";const w=g.read||{objects:{}},x=w.objects||{},O=x[b]||{},E=i(b),D={};return(M=E==null?void 0:E.getRequiredFields())==null||M.forEach(R=>{"fieldName"in R&&(D[R.fieldName]=!0)}),O.objectName=O.objectName||b,O.selectedFields=O.selectedFields||D,x[b]=O,w.objects=x,g.read=w,{read:w,objects:x,obj:O}},[i,(f=o==null?void 0:o.content)==null?void 0:f.provider]),c=C.useCallback(b=>{var g,w;return{object:(w=(g=t.read)==null?void 0:g.objects)==null?void 0:w[b],getSelectedField:x=>{var O,E,D,N;return!!((N=(D=(E=(O=t.read)==null?void 0:O.objects)==null?void 0:E[b])==null?void 0:D.selectedFields)!=null&&N[x])},setSelectedField:({fieldName:x,selected:O})=>{n(E=>Kt(E,D=>{const{obj:N}=l(b,D);N.selectedFields=N.selectedFields||{},N.selectedFields[x]=O,N.selectedFields[x]===!1&&delete N.selectedFields[x]}))},getFieldMapping:x=>{var O,E,D,N;return(N=(D=(E=(O=t.read)==null?void 0:O.objects)==null?void 0:E[b])==null?void 0:D.selectedFieldMappings)==null?void 0:N[x]},setFieldMapping:({fieldName:x,mapToName:O})=>{n(E=>Kt(E,D=>{const{obj:N}=l(b,D);N.selectedFieldMappings=N.selectedFieldMappings||{},N.selectedFieldMappings[O]=x}))},deleteFieldMapping:x=>{n(O=>Kt(O,E=>{var N,M,R;const D=(R=(M=(N=E.read)==null?void 0:N.objects)==null?void 0:M[b])==null?void 0:R.selectedFieldMappings;D&&x in D&&delete D[x]}))}}},[(y=t.read)==null?void 0:y.objects,l]),u=C.useCallback(b=>{var E,D;const g=(D=(E=t.write)==null?void 0:E.objects)==null?void 0:D[b],w=N=>{const M=N.write||{},R=M.objects||{},P=R[b]||{objectName:b};return R[b]=P,M.objects=R,N.write=M,{write:M,objects:R,obj:P}},x=(N,M)=>{var R,P;return(P=(R=g==null?void 0:g.selectedFieldSettings)==null?void 0:R[N])==null?void 0:P[M]},O=(N,M,R)=>{n(P=>Kt(P,F=>{var B;const{obj:U}=w(F);U.selectedFieldSettings={...U.selectedFieldSettings,[N]:{...(B=U.selectedFieldSettings)==null?void 0:B[N],[M]:R}}}))};return{object:g,setEnableWrite:()=>{n(N=>Kt(N,M=>{const{obj:R}=w(M);R.objectName=b}))},setDisableWrite:()=>{n(N=>Kt(N,M=>{const{objects:R}=w(M);delete R[b]}))},getWriteObject:()=>{var N,M;return(M=(N=t.write)==null?void 0:N.objects)==null?void 0:M[b]},getSelectedFieldSettings:N=>{var M;return(M=g==null?void 0:g.selectedFieldSettings)==null?void 0:M[N]},setSelectedFieldSettings:({fieldName:N,settings:M})=>{n(R=>Kt(R,P=>{const{obj:F}=w(P),U=F.selectedFieldSettings||{};F.selectedFieldSettings={...U,[N]:M},M===void 0&&delete F.selectedFieldSettings[N]}))},getDefaultValues:N=>x(N,"default"),setDefaultValues:({fieldName:N,value:M})=>O(N,"default",M),getWriteOnCreateSetting:N=>x(N,"writeOnCreate"),setWriteOnCreateSetting:({fieldName:N,value:M})=>O(N,"writeOnCreate",M),getWriteOnUpdateSetting:N=>x(N,"writeOnUpdate"),setWriteOnUpdateSetting:({fieldName:N,value:M})=>O(N,"writeOnUpdate",M)}},[(m=t.write)==null?void 0:m.objects]),d=C.useCallback(()=>({object:t.proxy,setEnableProxy:()=>{n(b=>Kt(b,g=>{g.proxy={enabled:!0}}))},setDisableProxy:()=>{n(b=>Kt(b,g=>{g.proxy={enabled:!1}}))},getProxyEnabled:()=>{var b;return((b=t.proxy)==null?void 0:b.enabled)||!1}}),[t.proxy]),h=C.useCallback(()=>{n(b=>Kt(b,g=>{var w;Object.assign(g,(w=s==null?void 0:s.config)==null?void 0:w.content)}))},[(v=s==null?void 0:s.config)==null?void 0:v.content]);return C.useEffect(()=>{s&&(console.debug("Installation found",{installation:s}),r.current?Hf(r.current,s)||(console.debug("Installation changed, resetting config",{previous:r.current,current:s}),h(),r.current=s):(r.current=s,h()))},[s,h]),{draft:t,get:a,reset:h,setDraft:n,readObject:c,writeObject:u,proxy:d}}const Nl=C.createContext(null);function bI({children:e,initialConfig:t}){const n=wI(t);return p.jsx(Nl.Provider,{value:n,children:e})}function xI(){const e=C.useContext(Nl);if(!e)throw new Error("useLocalConfig must be used within a ConfigProvider / InstallationProvider");return e}function II(){console.warn("useConfig is deprecated. Please use useLocalConfig instead.");const e=C.useContext(Nl);if(!e)throw new Error("useConfigContext must be used within a ConfigProvider / InstallationProvider");return e}const Wf=C.createContext({integrationNameOrId:"",consumerRef:"",consumerName:void 0,groupRef:"",groupName:void 0});function Wr(){const e=C.useContext(Wf);if(!e)throw new Error("useInstallationProps must be used within an InstallationProvider");return e}function kl({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o}){const s=C.useMemo(()=>({integrationNameOrId:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o}),[t,n,r,i,o]);return p.jsx(Wf.Provider,{value:s,children:p.jsx(bI,{initialConfig:{},children:e})})}class Ja{constructor(t){this.connectionApi=new ix(t),this.installationApi=new ox(t),this.integrationApi=new sx(t),this.oAuthApi=new ax(t),this.projectApi=new lx(t),this.providerApi=new ux(t),this.providerAppApi=new cx(t),this.revisionApi=new dx(t)}}const Qf="2.9.11",CI="v1",Vo="https://api.withampersand.com";function Gf(){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 Vo;case"mock":return"http://127.0.0.1:4010";case"":return Vo;default:return e??Vo}}catch{return Vo}}const SI=(e,t)=>`${e}/${t}`;function OI(){return SI(Gf(),CI)}const Xf=Gf(),Yf=OI(),EI=new vl({basePath:Yf,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Qf}});new Ja(EI);const _I=e=>({header:"X-Api-Key",value:e}),TI=e=>{try{return{header:"Authorization",value:`Bearer ${e}`}}catch(t){throw console.error("Failed to get JWT token for API authentication:",t),new Error("Failed to authenticate with JWT token")}},pc=(e,t)=>new vl({basePath:Yf,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Qf,[e]:t}});function Ct(){const e=Mf(),{getToken:t}=iI(),{consumerRef:n,groupRef:r}=Wr();return C.useCallback(async()=>{if(e){const o=_I(e),s=pc(o.header,o.value);return new Ja(s)}if(t){if(!n||!r)throw console.error("Unable to create JWT API service without consumerRef or groupRef.",{consumerRef:n,groupRef:r}),new Error("Unable to create JWT API service without consumerRef or groupRef.");const o=await t({consumerRef:n,groupRef:r}),s=TI(o),a=pc(s.header,s.value);return new Ja(a)}throw console.error("Unable to create API service without API key or JWT token."),new Error("Unable to create API service without API key or JWT token.")},[e,t,n,r])}const Al=({groupRef:e,provider:t})=>{const{projectIdOrName:n}=Ze(),r=Ct();return Hr({queryKey:["amp","connections",n,e,t],queryFn:async()=>{if(!n)throw new Error("Project ID or name not found. Please wrap this component inside of AmpersandProvider");if(!e)throw new Error("Group reference not found.");if(!t)throw new Error("Provider not found.");return(await r()).connectionApi.listConnections({projectIdOrName:n,groupRef:e,provider:t})},retry:3,enabled:!!n&&!!e&&!!t})};function NI({height:e="48",width:t="48"}){return p.jsxs("svg",{width:t,height:e,viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[p.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"}),p.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),p.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}const kI="_box_1p7c5_1",hc={box:kI};function Kn({children:e,className:t,style:n}){return p.jsx("div",{className:t?`${hc.box} ${t}`:hc.box,style:n,children:e})}const AI="_container_1wvzr_1",mc={container:AI};function Ai({children:e,className:t,style:n}){return p.jsx("div",{className:t?`${mc.container} ${t}`:mc.container,style:n,children:e})}const RI="_errorBoxContainer_19655_1",PI="_errorBox_19655_1",FI="_errorIconWrapper_19655_23",DI="_errorText_19655_34",Xo={errorBoxContainer:RI,errorBox:PI,errorIconWrapper:FI,errorText:DI};function Zf({message:e}){return p.jsxs(Kn,{className:Xo.errorBox,children:[p.jsx("div",{className:Xo.errorIconWrapper,children:p.jsx(NI,{width:"20",height:"20"})}),p.jsx("p",{className:Xo.errorText,children:e})]})}function ep({message:e,children:t}){return p.jsxs(Ai,{className:Xo.errorBoxContainer,children:[p.jsx(Zf,{message:e}),t]})}const MI="_loader_6ubm6_1",LI={loader:MI};function jI(){return p.jsx("span",{className:LI.loader})}function io(){return p.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:p.jsx(jI,{})})}function tp({children:e}){return p.jsx(Ai,{style:{maxWidth:"55rem"},children:p.jsx(Kn,{children:e})})}function Ri(){return p.jsx(tp,{children:p.jsx(io,{})})}function Vt({message:e,children:t}){return p.jsx(tp,{children:p.jsx(ep,{message:e,children:t})})}function mn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function BI(e,t){return(t==null?void 0:t.displayName)??mn(e)}const VI=e=>e.split(`
6
+ `).filter(n=>n.trim()!==""),UI=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null;function $I(e){return!e||typeof e!="string"?"id_"+Math.random().toString(36).substr(2,9):e.toLowerCase().replace(/[^a-z0-9_-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").replace(/^[^a-z]/,"id-").substring(0,50)}const qI=()=>{const[e,t]=C.useState(!1),n=C.useCallback(()=>{t(!0)},[t]),r=C.useCallback(()=>{t(!1)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n,resetIntegrationDeleted:r}},np=C.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:()=>{},resetComponent:()=>{}});function St(){const e=C.useContext(np);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function zI({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:l,fieldMapping:c,resetComponent:u}){const{data:d}=Es(),{setError:h,isError:f,removeError:y}=An(),{isIntegrationDeleted:m,setIntegrationDeleted:v,resetIntegrationDeleted:b}=qI(),g=C.useMemo(()=>UI(t,d||[]),[t,d]),{data:w,isLoading:x,isError:O,error:E}=_l(t,i),D=(w==null?void 0:w[0])||null;C.useEffect(()=>{b()},[t,n,r,i,o,c]),C.useEffect(()=>{g===null&&(d!=null&&d.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,g,d]),C.useEffect(()=>{O?(h(Ee.INSTALLATION_LIST,(g==null?void 0:g.id)||""),it(E)):y(Ee.INSTALLATION_LIST,(g==null?void 0:g.id)||"")},[O,g,h,y,E]);const N=st(),M=C.useCallback(()=>{N.invalidateQueries({queryKey:["amp","installations"]})},[N]),R=C.useCallback(U=>{N.setQueryData(["amp","installations"],[U]),N.invalidateQueries({queryKey:["amp","installations"]})},[N]),P=(g==null?void 0:g.id)||"",F=C.useMemo(()=>({integrationId:(g==null?void 0:g.id)||"",provider:(g==null?void 0:g.provider)||"",integrationObj:g,consumerRef:n,consumerName:r,groupRef:i,groupName:o,installation:D||void 0,setInstallation:R,resetInstallations:M,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:l,isIntegrationDeleted:m,setIntegrationDeleted:v,fieldMapping:c,resetComponent:u}),[g,n,r,i,o,D,R,M,s,a,l,m,v,c,u]);if(x)return p.jsx(Ri,{});if(g===null)return p.jsx(Vt,{message:`Integration "${t}" not found`});if(f(Ee.INSTALLATION_LIST,P)){const U=`Error retrieving installation information for integration "${(g==null?void 0:g.name)||"unknown"}"`;return p.jsx(Vt,{message:U})}return p.jsx(np.Provider,{value:F,children:e})}const rp=C.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Rn=()=>{const e=C.useContext(rp);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function ip({groupRef:e,provider:t,children:n}){const r=st(),{setError:i,isError:o}=An(),{projectIdOrName:s,isLoading:a}=gr(),{integrationId:l,groupRef:c}=St(),{provider:u}=ki(l),{data:d,isLoading:h,isError:f,error:y}=Al({groupRef:e||c,provider:u||t}),m=d==null?void 0:d[0],v=C.useCallback(w=>{r.setQueryData(["amp","connections"],()=>w),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),b=C.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);C.useEffect(()=>{f?(i(Ee.CONNECTION_LIST,s,!0),it(y)):i(Ee.CONNECTION_LIST,s,!1)},[f,i,s,y]);const g=C.useMemo(()=>({connections:d||null,isConnectionsLoading:h,selectedConnection:m||null,setConnections:v,setSelectedConnection:b}),[d,h,m,v,b]);if(h||a)return p.jsx(Ri,{});if(s&&o(Ee.PROJECT,s))return p.jsx(Vt,{message:`Error loading project ${s}`});if(s&&o(Ee.CONNECTION_LIST,s))return p.jsx(Vt,{message:"Error retrieving existing connections"});if(!s)throw new Error("Project ID or Project Name not found. ConnectionsProvider must be used within AmpersandProvider");return p.jsx(rp.Provider,{value:g,children:n})}const op=()=>{const e=Ct(),t=st(),[n,r]=C.useState(null);return{...zn({mutationKey:["createInstallation"],mutationFn:async o=>(await e()).installationApi.createInstallation(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:o=>{console.error("Error creating installation"),it(o,r)}}),errorMsg:n}};function KI(e){return typeof e.provider=="string"}function HI(e){return KI(e)?{data:e}:{error:new Error("Config must have a provider field for creation")}}function sp(){const{projectIdOrName:e}=Ze(),{groupRef:t,integrationNameOrId:n}=Wr(),{data:r}=ki(n),{connection:i}=Tl(),{installation:o}=Jr(),s=st(),{mutate:a,isIdle:l,isPending:c,error:u,errorMsg:d}=op();return{createInstallation:({config:f,onSuccess:y,onError:m,onSettled:v})=>{if(o){const w=new Error("Installation already created. Try updating instead.");m==null||m(w),v==null||v();return}if(!r){const w=new Error("No integration found");m==null||m(w),v==null||v();return}const b=HI(f);if(b.error||!b.data){m==null||m(b.error||new Error("Invalid configuration data")),v==null||v();return}const g={projectIdOrName:e,integrationId:r==null?void 0:r.id,installation:{groupRef:t,connectionId:i==null?void 0:i.id,config:{content:b.data}}};return a(g,{onSuccess:w=>{y==null||y(w)},onError:w=>{m==null||m(w)},onSettled:()=>{v==null||v(),s.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:l,isPending:c,error:u,errorMsg:d}}const JI=()=>{const e=Ct(),t=st(),[n,r]=C.useState(null);return{...zn({mutationKey:["updateInstallation"],mutationFn:async o=>(await e()).installationApi.updateInstallation(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:o=>{console.error("Error updating installation"),it(o,r)}}),errorMsg:n}};function ap(){const{projectIdOrName:e}=Ze(),{integrationNameOrId:t}=Wr(),{data:n}=ki(t),{installation:r}=Jr(),i=st(),{mutate:o,isIdle:s,isPending:a,error:l,errorMsg:c}=JI();return{updateInstallation:({config:d,onSuccess:h,onError:f,onSettled:y})=>{var b,g,w,x,O;if(!r){const E=new Error("Installation not created yet. Try creating the installation first.");f==null||f(E),y==null||y();return}if(!n){const E=new Error("No integration found");f==null||f(E),y==null||y();return}const m=[];if((b=d==null?void 0:d.write)!=null&&b.objects){const E=Object.keys(d.write.objects).length,D=Object.keys(((x=(w=(g=r==null?void 0:r.config)==null?void 0:g.content)==null?void 0:w.write)==null?void 0:x.objects)||{}).length;(E>0||E===0&&D>0)&&m.push("config.content.write.objects")}if((O=d==null?void 0:d.read)!=null&&O.objects){const E=Object.keys(d.read.objects);m.push(...E.map(D=>`config.content.read.objects.${D}`))}const v={projectIdOrName:e,integrationId:n==null?void 0:n.id,installationId:r.id,installationUpdate:{updateMask:m,installation:{config:{content:d}}}};return o(v,{onSuccess:E=>{h==null||h(E)},onError:E=>{f==null||f(E)},onSettled:()=>{y==null||y(),i.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:s,isPending:a,error:l,errorMsg:c}}const WI=()=>{const e=Ct(),t=st(),[n,r]=C.useState(null);return{...zn({mutationKey:["deleteInstallation"],mutationFn:async o=>(await e()).installationApi.deleteInstallation(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:o=>{console.error("Error deleting installation"),it(o,r)}}),errorMsg:n}};function QI(){const{projectIdOrName:e}=Ze(),{integrationNameOrId:t}=Wr(),{data:n}=ki(t),{installation:r}=Jr(),i=st(),{mutate:o,isIdle:s,isPending:a,error:l,errorMsg:c}=WI();return{deleteInstallation:({onSuccess:d,onError:h,onSettled:f})=>{if(!r){const y=new Error("Installation not found. Not able to delete installation.");h==null||h(y),f==null||f();return}if(!n){const y=new Error("No integration found");h==null||h(y),f==null||f();return}return o({projectIdOrName:e,integrationId:n==null?void 0:n.id,installationId:r.id},{onSuccess:()=>{d==null||d()},onError:y=>{h==null||h(y)},onSettled:()=>{f==null||f(),i.invalidateQueries({queryKey:["amp","installations"]}),i.invalidateQueries({queryKey:["amp","connections"]})}})},isIdle:s,isPending:a,error:l,errorMsg:c}}function lp(){const[e,t]=C.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}var cs={exports:{}};cs.exports;(function(e,t){var n=9007199254740991,r="[object Arguments]",i="[object Function]",o="[object GeneratorFunction]",s="[object Map]",a="[object Object]",l="[object Promise]",c="[object Set]",u="[object WeakMap]",d="[object DataView]",h=/[\\^$.*+?()[\]{}|]/g,f=/^\[object .+?Constructor\]$/,y=typeof sn=="object"&&sn&&sn.Object===Object&&sn,m=typeof self=="object"&&self&&self.Object===Object&&self,v=y||m||Function("return this")(),b=t&&!t.nodeType&&t,g=b&&!0&&e&&!e.nodeType&&e,w=g&&g.exports===b;function x(L,oe){return L==null?void 0:L[oe]}function O(L){var oe=!1;if(L!=null&&typeof L.toString!="function")try{oe=!!(L+"")}catch{}return oe}function E(L,oe){return function(ue){return L(oe(ue))}}var D=Function.prototype,N=Object.prototype,M=v["__core-js_shared__"],R=function(){var L=/[^.]+$/.exec(M&&M.keys&&M.keys.IE_PROTO||"");return L?"Symbol(src)_1."+L:""}(),P=D.toString,F=N.hasOwnProperty,U=N.toString,B=RegExp("^"+P.call(F).replace(h,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),X=w?v.Buffer:void 0,se=N.propertyIsEnumerable,ce=X?X.isBuffer:void 0,ge=E(Object.keys,Object),we=q(v,"DataView"),I=q(v,"Map"),J=q(v,"Promise"),V=q(v,"Set"),S=q(v,"WeakMap"),z=!se.call({valueOf:1},"valueOf"),$=Be(we),Y=Be(I),ne=Be(J),te=Be(V),ae=Be(S);function Z(L){return U.call(L)}function ye(L){if(!nt(L)||ee(L))return!1;var oe=_t(L)||O(L)?B:f;return oe.test(Be(L))}function q(L,oe){var ue=x(L,oe);return ye(ue)?ue:void 0}var be=Z;(we&&be(new we(new ArrayBuffer(1)))!=d||I&&be(new I)!=s||J&&be(J.resolve())!=l||V&&be(new V)!=c||S&&be(new S)!=u)&&(be=function(L){var oe=U.call(L),ue=oe==a?L.constructor:void 0,Je=ue?Be(ue):void 0;if(Je)switch(Je){case $:return d;case Y:return s;case ne:return l;case te:return c;case ae:return u}return oe});function ee(L){return!!R&&R in L}function Ke(L){var oe=L&&L.constructor,ue=typeof oe=="function"&&oe.prototype||N;return L===ue}function Be(L){if(L!=null){try{return P.call(L)}catch{}try{return L+""}catch{}}return""}function je(L){return lt(L)&&F.call(L,"callee")&&(!se.call(L,"callee")||U.call(L)==r)}var et=Array.isArray;function at(L){return L!=null&&mt(L.length)&&!_t(L)}function lt(L){return j(L)&&at(L)}var Oe=ce||H;function ft(L){if(at(L)&&(et(L)||typeof L=="string"||typeof L.splice=="function"||Oe(L)||je(L)))return!L.length;var oe=be(L);if(oe==s||oe==c)return!L.size;if(z||Ke(L))return!ge(L).length;for(var ue in L)if(F.call(L,ue))return!1;return!0}function _t(L){var oe=nt(L)?U.call(L):"";return oe==i||oe==o}function mt(L){return typeof L=="number"&&L>-1&&L%1==0&&L<=n}function nt(L){var oe=typeof L;return!!L&&(oe=="object"||oe=="function")}function j(L){return!!L&&typeof L=="object"}function H(){return!1}e.exports=ft})(cs,cs.exports);var GI=cs.exports;const XI=Ni(GI),wi="other",ds="manage-tab";function yr(e){return!e.fieldName}function up(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function YI(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!yr(n)&&!!n.fieldName))||null}function ZI(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>yr(r)&&!!r.mapToName))||[]}function eC(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>yr(r)&&!!r.mapToName))||[]}function cp(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!yr(n)&&!!n.fieldName))||null}const dp=(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 tC(e){return yr(e)?e.mapToName:e.fieldName}const fp=(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=>{const a=e?dp(e,s.objectName):void 0;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)&&mn(s==null?void 0:s.objectName),completed:!!a,disabled:a==null?void 0:a.disabled})}),n},pp=e=>{var n;return{name:wi,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function nC(e,t){var o;const n=fp(e,t),i=!!((o=t==null?void 0:t.content)!=null&&o.write)?pp(e):void 0;return i&&n.push(i),n}function hp(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(Ee.MAPPING,i),r!=null&&r.length&&console.error("required fields not met",r.map(o=>o.mapToDisplayName)),{errorList:i}}function gc(e,t){return XI(e)?!0:Object.values(e).every(t)}function Rl(e,t,n){const r=gc(e,n),i=gc(t,n);return r&&i?!0:r!==i?!1:Hf(e,t)}function mp(e,t){return Rl(e,t,n=>n===!1||n===void 0)}function gp(e,t){return Rl(e,t,n=>!n||n==="")}function yp(e,t){return Rl(e,t,n=>!n||typeof n!="object"?!0:Object.keys(n).length===0)}function vp(e,t){const n=new Set(Object.values(e).map(i=>i==null?void 0:i.objectName)),r=new Set(Object.values(t).map(i=>i==null?void 0:i.objectName));return n.size===r.size&&[...n].every(i=>r.has(i))}const rC=(e,t,n)=>{var y,m,v,b,g,w;if(!e)return null;const r=up(e,t),i=r&&YI(r),o=r&&cp(r),s=r&&ZI(r),a=r&&eC(r),l=(r==null?void 0:r.allFields)||[],c=(r==null?void 0:r.allFieldsMetadata)||{},u=n==null?void 0:n.content,d=((v=(m=(y=u==null?void 0:u.read)==null?void 0:y.objects)==null?void 0:m[t])==null?void 0:v.selectedValueMappings)||{},h=((w=(g=(b=u==null?void 0:u.read)==null?void 0:b.objects)==null?void 0:g[t])==null?void 0:w.selectedFieldMappings)||{},f=Pl(n,{content:{read:e}},t);return{allFields:l,allFieldsMetadata:c,requiredFields:i,optionalFields:o,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:f,selectedFieldMappings:h,selectedValueMappings:d}},iC=(e,t)=>{var r,i;if(!e)return null;const n=(i=(r=t==null?void 0:t.content)==null?void 0:r.write)==null?void 0:i.objects;return{writeObjects:(e==null?void 0:e.objects)||[],selectedWriteObjects:n||{}}};function wp(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:rC(r,t,n),write:iC(i,n)}}const bp=(e,t,n,r)=>{const i=wp(e,n,t);r(n,i)},oC=(e,t,n)=>{const r=nC(t,e),i={};r.forEach(({name:o,completed:s})=>{s&&(i[o]=wp(e,o,t))}),n(i)},xp=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(o=>r.add(tC(o))),{...Array.from(r).reduce((o,s)=>({...o,[s]:!0}),{}),...n||{}}},Ip=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},Cp=(e,t)=>!t||!t[e]?[]:t[e],Sp=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t},Pl=(e,t,n)=>{var c,u,d,h,f;if(!e||!t)return{};const r=(c=t==null?void 0:t.content)==null?void 0:c.read;if(!r)return{};const i=up(r,n),o=i&&cp(i),s=new Set((o==null?void 0:o.filter(y=>!yr(y)&&!!y.fieldName).map(y=>y.fieldName))||[]),a=((f=(h=(d=(u=e==null?void 0:e.content)==null?void 0:u.read)==null?void 0:d.objects)==null?void 0:h[n])==null?void 0:f.selectedFields)||{};return Object.entries(a).reduce((y,[m,v])=>(s.has(m)&&(y[m]=v),y),{})},Op=(e,t)=>{var r,i,o,s;return!e||!t?{}:((s=(o=(i=(r=e==null?void 0:e.content)==null?void 0:r.read)==null?void 0:i.objects)==null?void 0:o[t])==null?void 0:s.selectedFieldMappings)||{}};function Ep(e,t){return t[e]||void 0}function go(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const sC=(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)},aC=(e,t,n,r,i)=>{const o=xp(e),s=Ip(e),a=Cp(t,i),l=Sp(e),c=sC(n,t);if(!c)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const u={createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,selectedFields:o,selectedFieldMappings:s,dynamicMappingsInput:a,selectedValueMappings:l||{},backfill:c.backfill}}}}};return go(n)&&(u.content.proxy={enabled:!0}),u},_p=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},lC=e=>{const t=e.content.write;return t==null?void 0:t.objects},uC=(e,t,n)=>{if(!lC(t))return console.error("Error when getting write objects from hydratedRevision"),null;const i=_p(e),o={createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:i}}};return go(t)&&(o.content.proxy={enabled:!0}),o};var Tp={exports:{}};/*!
7
7
  Copyright (c) 2018 Jed Watson.
8
8
  Licensed under the MIT License (MIT), see
9
9
  http://jedwatson.github.io/classnames
10
- */(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})()})(od);var rb=od.exports;const Vt=ko(rb),ib="_button_kwfiu_1",ob="_danger_kwfiu_42",sb="_ghost_kwfiu_47",ss={button:ib,danger:ob,ghost:sb};function He({className:e,style:t,type:n,children:r,variant:i,...o}){const s=Vt(ss.button,{[ss.danger]:i==="danger",[ss.ghost]:i==="ghost",[e||""]:!!e});return c.jsx("button",{type:n,className:s,style:t,...o,children:r})}const ab={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 ki({children:e,style:t}){return c.jsx(_n,{style:{...ab,...t},children:e})}const Vo=e=>{const t=ut(),{provider:n}=lt(),r=e||n;return Er({queryKey:["amp","providerInfo",r],queryFn:async()=>{if(!r)throw new Error("Provider not found");return(await t()).providerApi.getProvider({provider:r})},enabled:!!r})},dt=e=>{const t=Vo(e),{data:n}=t,{provider:r}=lt(),i=n&&Fw(n==null?void 0:n.name,n);return{...t,providerName:i,selectedProvider:e||r}};function cn({error:e}){return e?c.jsx(ki,{style:{marginTop:"2em"},children:e}):null}const cb="_input_1ymb7_1",ub="_inputError_1ymb7_27",as={input:cb,inputError:ub};function sd({id:e,type:t,className:n,isError:r=!1,...i}){const o=r?Vt(as.inputError,as.input):as.input;return c.jsx("input",{id:e,type:t,className:Vt(o,n),...i})}function lb(){return c.jsx("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:c.jsxs("g",{opacity:"0.5",children:[c.jsx("path",{d:"M14.2821 11.0004C14.2821 12.8154 12.8154 14.2821 11.0004 14.2821C9.18542 14.2821 7.71875 12.8154 7.71875 11.0004C7.71875 9.18542 9.18542 7.71875 11.0004 7.71875C12.8154 7.71875 14.2821 9.18542 14.2821 11.0004Z",stroke:"currentColor",strokeWidth:"1.375",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M10.9999 18.581C14.2357 18.581 17.2515 16.6743 19.3507 13.3743C20.1757 12.0818 20.1757 9.90932 19.3507 8.61682C17.2515 5.31682 14.2357 3.41016 10.9999 3.41016C7.76402 3.41016 4.74819 5.31682 2.64902 8.61682C1.82402 9.90932 1.82402 12.0818 2.64902 13.3743C4.74819 16.6743 7.76402 18.581 10.9999 18.581Z",stroke:"currentColor",strokeWidth:"1.375",strokeLinecap:"round",strokeLinejoin:"round"})]})})}function db(){return c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[c.jsx("path",{d:"M13.3187 8.68036L8.68036 13.3187C8.06528 12.7036 7.71973 11.8694 7.71973 10.9995C7.71973 10.5688 7.80456 10.1423 7.96939 9.7444C8.13421 9.34648 8.3758 8.98491 8.68036 8.68036C8.98491 8.3758 9.34648 8.13421 9.7444 7.96939C10.1423 7.80456 10.5688 7.71973 10.9995 7.71973C11.8694 7.71973 12.7036 8.06528 13.3187 8.68036Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M16.3349 5.28895C14.7307 4.07895 12.8974 3.41895 10.9999 3.41895C7.76402 3.41895 4.74819 5.32561 2.64902 8.62561C1.82402 9.91811 1.82402 12.0906 2.64902 13.3831C3.37319 14.5198 4.21652 15.5006 5.13319 16.2889M7.71819 17.9023C8.76319 18.3423 9.87236 18.5806 10.9999 18.5806C14.2357 18.5806 17.2515 16.6739 19.3507 13.3739C20.1757 12.0814 20.1757 9.90895 19.3507 8.61645C19.0482 8.13978 18.7182 7.69061 18.379 7.26895",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M14.2172 11.6413C14.093 12.2808 13.7806 12.8685 13.32 13.3291C12.8594 13.7897 12.2716 14.1022 11.6322 14.2263M8.68051 13.3188L1.83301 20.1663M20.1663 1.83301L13.3188 8.68051",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function fb({id:e,name:t,placeholder:n="Password",onChange:r,value:i,className:o,isError:s}){const[a,u]=I.useState(!1),f=()=>u(l=>!l);return c.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[c.jsx(Ot.Input,{id:e,name:t,type:a?"text":"password",placeholder:n,onChange:r,value:i,className:o,isError:s}),c.jsx(He,{type:"button","aria-label":a?"Hide password":"Show password",style:{height:"2.5rem",width:"2.5rem",display:"flex",alignItems:"center",justifyContent:"center"},onClick:f,variant:"ghost",children:c.jsx("span",{style:{height:"1.5rem",width:"1.5rem"},children:a?c.jsx(db,{}):c.jsx(lb,{})})})]})}const pb="_textarea_18zl4_1",hb="_textareaError_18zl4_14",cs={textarea:pb,textareaError:hb};function mb({className:e,isError:t=!1,...n}){const r=t?Vt(cs.textareaError,cs.textarea):cs.textarea;return c.jsx("textarea",{className:Vt(e,r),...n})}const Ot={Input:sd,Textarea:mb,PasswordInput:fb},gb=()=>{const{projectIdOrName:e}=Ke(),t=ut();return Er({queryKey:["project",e,"entitlements"],queryFn:async()=>{if(!e)throw new Error("Project ID is required");return(await t()).projectApi.getProject({projectIdOrName:e,includeEntitlements:!0})},enabled:!!e})};function ad(){var n,r;const{data:e}=gb();return((r=(n=e==null?void 0:e.entitlements)==null?void 0:n.brandingRemoval)==null?void 0:r.value)===!0?null:c.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:[c.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),c.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:c.jsx("img",{style:{height:".8em"},src:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",alt:"Ampersand"})})]})}function er({children:e}){return c.jsx(si,{children:c.jsxs(_n,{children:[c.jsx("div",{style:{padding:"3rem 2rem"},children:e}),c.jsx(ad,{})]})})}function tr({children:e}){return c.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function yb({children:e}){return c.jsx("p",{style:{padding:".5em 0"},children:e})}const vb="_link_oo2kv_1",wb={link:vb};function ba({href:e,className:t,style:n,label:r,children:i,newTab:o=!1}){return c.jsx("a",{className:Vt(wb.link,t),style:n,href:e,"aria-label":r||void 0,target:o?"_blank":"_self",rel:o?"noopener noreferrer":void 0,children:i})}function xo({url:e,providerDisplayName:t,credentialName:n}){return c.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[c.jsx(ba,{href:e,newTab:!0,children:c.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," ","about where to find your ",t," ",n,"."]})}function $o(e,t){const n={},r=[];if(e.forEach(i=>{const o=t[i.name];!o||o.trim()===""?r.push(i.displayName||i.name):n[i.name]={value:o,source:"input"}}),r.length>0)throw new Error(`Please fill in the following required fields: ${r.join(", ")}.`);return n}function Gr(e,t){return e.every(n=>{const r=t[n.name];return r&&r.trim()!==""})}function cd({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:i,submitButtonType:o}){var O,p;const[s,a]=I.useState({apiKey:""}),u=((O=t.metadata)==null?void 0:O.input)||[],f=b=>{const{name:v,value:x}=b.currentTarget;a(S=>({...S,[v]:x.trim()}))},{apiKey:l}=s,{providerName:d}=dt(e),h=l.length>0,m=Gr(u,s),y=r||!h||!m,w=(p=t.apiKeyOpts)==null?void 0:p.docsURL,g=()=>{const b=$o(u,s);n({apiKey:l,providerMetadata:b})};return c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[w&&c.jsx(xo,{url:w,providerDisplayName:d||Wt(e),credentialName:"API key"}),c.jsx(Ot.PasswordInput,{id:"apiKey",name:"apiKey",placeholder:"API Key",onChange:f}),u.map(b=>c.jsxs("div",{children:[b.docsURL&&c.jsx(xo,{url:b.docsURL,providerDisplayName:d||Wt(e),credentialName:b.displayName||b.name}),c.jsx(Ot.Input,{id:b.name,name:b.name,type:"text",placeholder:b.displayName||b.name,onChange:f})]},b.name)),c.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:y,type:o||"submit",onClick:g,variant:i,children:"Next"})]})}function bb({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i}){const{providerName:o}=dt(e);return c.jsxs(er,{children:[c.jsx(tr,{children:`Set up ${o} integration`}),c.jsx(cn,{error:r}),c.jsx(cd,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:i})]})}function Ib({...e}){return c.jsx(bb,{...e})}const Cb={backgroundColor:"var(--amp-colors-status-success-muted)",borderColor:"var(--amp-colors-status-success-muted)",color:"var(--amp-colors-status-success-dark)",padding:".5rem 1rem"};function Ko({children:e,style:t}){return c.jsx(_n,{style:{...Cb,...t},children:e})}const Ia=()=>{const e=ut(),t=We(),[n,r]=I.useState(null);return{...On({mutationKey:["updateConnection"],mutationFn:async o=>(await e()).connectionApi.updateConnection(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)}}),errorMsg:n}},xb="_divider_1kmoj_1",$c={divider:xb};function Uo({className:e,style:t}){return c.jsx("hr",{className:e?`${$c.divider} ${e}`:$c.divider,style:t})}function Ft({string:e}){return c.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[c.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),c.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:c.jsx(Uo,{style:{width:"100%",marginLeft:"1rem"}})})]})}function Ob({provider:e}){const{projectIdOrName:t}=Ke(),{providerName:n,data:r}=dt(e),{selectedConnection:i,isConnectionsLoading:o}=an(),{mutateAsync:s,isPending:a,error:u}=Ia(),[f,l]=I.useState(null),[d,h]=I.useState(!1),m=()=>h(!1),y=()=>{h(!0),l(null)},w=(u==null?void 0:u.message)||f||null,g=async O=>{m(),l(null);try{await s({projectIdOrName:t||"",connectionId:(i==null?void 0:i.id)||"",updateConnectionRequest:{updateMask:["apiKey"],connection:{apiKey:O.apiKey}}},{onError:p=>{console.error("Update connection error:",p),Je(p,l)},onSuccess:()=>{y()}})}catch(p){console.error("Update connection caught error:",p),Je(p,l)}};return r?c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Update connection"}),c.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[c.jsx("p",{children:`Update ${n} API Key`}),d&&c.jsx(Ko,{children:"Connection updated successfully"}),w&&c.jsx(ki,{children:`Error updating connection ${w}`}),c.jsx(cd,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:g,isButtonDisabled:a||o,buttonVariant:"ghost",submitButtonType:"button"})]})]}):null}function ud({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:i}){var g,O;const[o,s]=I.useState({username:"",password:""}),a=((g=t.metadata)==null?void 0:g.input)||[],{username:u,password:f}=o,{providerName:l}=dt(e),d=p=>{const{name:b,value:v}=p.currentTarget;s(x=>({...x,[b]:v.trim()}))},h=Gr(a,o),m=r||!h,y=()=>{const p=$o(a,o);n({user:u,pass:f,providerMetadata:p})},w=(O=t.basicOpts)==null?void 0:O.docsURL;return c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[w&&c.jsx(xo,{url:w,providerDisplayName:l||Wt(e),credentialName:"credentials"}),c.jsx(Ot.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:d}),c.jsx(Ot.PasswordInput,{id:"password",name:"password",placeholder:"Password",onChange:d}),a.map(p=>c.jsxs("div",{children:[p.docsURL&&c.jsx(xo,{url:p.docsURL,providerDisplayName:l||Wt(e),credentialName:p.displayName||p.name}),c.jsx(Ot.Input,{id:p.name,name:p.name,type:"text",placeholder:p.displayName||p.name,onChange:d})]},p.name)),c.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:m,type:"button",onClick:y,variant:i,children:"Next"})]})}function _b({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i}){const{providerName:o}=dt(e);return c.jsxs(er,{children:[c.jsx(tr,{children:`Set up ${o} integration`}),c.jsx(cn,{error:r}),c.jsx(ud,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:i})]})}function Sb({...e}){return c.jsx(_b,{...e})}function Eb({provider:e}){const{projectIdOrName:t}=Ke(),{providerName:n,data:r}=dt(e),{selectedConnection:i,isConnectionsLoading:o}=an(),{mutateAsync:s,isPending:a,error:u}=Ia(),[f,l]=I.useState(null),[d,h]=I.useState(!1),m=()=>h(!1),y=()=>{h(!0),l(null)},w=(u==null?void 0:u.message)||f||null,g=async O=>{m(),l(null);try{await s({projectIdOrName:t||"",connectionId:(i==null?void 0:i.id)||"",updateConnectionRequest:{updateMask:["basicAuth"],connection:{basicAuth:{username:O.user,password:O.pass}}}},{onError:p=>{console.error(p),Je(p,l)},onSuccess:()=>{y()}})}catch(p){console.error(p),Je(p,l)}};return r?c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Update connection"}),c.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[c.jsx("p",{children:`Update ${n} credentials`}),d&&c.jsx(Ko,{children:"Connection updated successfully"}),w&&c.jsx(ki,{children:`Error updating connection: ${w}`}),c.jsx(ud,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:g,isButtonDisabled:a||o,buttonVariant:"ghost"})]})]}):null}function ld({provider:e,handleSubmit:t,isButtonDisabled:n,explicitScopesRequired:r,buttonVariant:i}){var v;const[o,s]=I.useState({clientSecret:"",clientId:"",scopes:""}),[a,u]=I.useState(null),{data:f}=Vo(e),l=((v=f==null?void 0:f.metadata)==null?void 0:v.input)||[],d=x=>{const{name:S,value:A}=x.currentTarget;s(N=>({...N,[S]:A.trim()})),u(null)},{clientSecret:h,clientId:m,scopes:y}=o,w=h.length>0,g=m.length>0,O=Gr(l,o),p=n||!w||!g||!O,b=()=>{const x=$o(l,o),S={clientId:m,clientSecret:h,providerMetadata:x};r&&y.length>0&&(S.scopes=Pw(y)),t(S)};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[c.jsx(Ot.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:d}),c.jsx(Ot.PasswordInput,{id:"clientSecret",name:"clientSecret",placeholder:"Client Secret",onChange:d}),r&&c.jsx(Ot.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:d}),l.map(x=>c.jsx(Ot.Input,{id:x.name,name:x.name,type:"text",placeholder:x.displayName||x.name,onChange:d},x.name))]}),c.jsx(cn,{error:a}),c.jsx("br",{}),c.jsx(He,{style:{width:"100%"},disabled:p,type:"button",onClick:b,variant:i,children:"Next"})]})}function Nb({provider:e,handleSubmit:t,error:n,isButtonDisabled:r,providerName:i,explicitScopesRequired:o}){return c.jsxs(er,{children:[c.jsx(tr,{children:`Set up ${i} integration`}),c.jsx(cn,{error:n}),c.jsx("br",{}),c.jsx(ld,{provider:e,handleSubmit:t,isButtonDisabled:r,explicitScopesRequired:o})]})}function Tb({provider:e}){var p;const{projectIdOrName:t}=Ke(),{selectedConnection:n,isConnectionsLoading:r}=an(),{providerName:i,data:o}=dt(e),{mutateAsync:s,isPending:a,error:u}=Ia(),[f,l]=I.useState(null),[d,h]=I.useState(!1),m=()=>{h(!1)},y=()=>{h(!0),l(null)},w=(p=o==null?void 0:o.oauth2Opts)==null?void 0:p.explicitScopesRequired,g=(u==null?void 0:u.message)||f||null,O=async b=>{m(),l(null);try{await s({projectIdOrName:t||"",connectionId:(n==null?void 0:n.id)||"",updateConnectionRequest:{updateMask:["oauth2ClientCredentials"],connection:{oauth2ClientCredentials:{clientId:b.clientId,clientSecret:b.clientSecret,scopes:b.scopes}}}}),y()}catch(v){Je(v,l)}};return c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Update connection"}),c.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[c.jsx("p",{children:`Re-authenticate to ${i}`}),d&&c.jsx(Ko,{children:"Connection updated successfully"}),g&&c.jsx(ki,{children:`Error updating connection ${g}`}),c.jsx(ld,{provider:i||"",handleSubmit:O,isButtonDisabled:a||r,explicitScopesRequired:w,buttonVariant:"ghost"})]})]})}const Kc=600,Uc=600,Rb="AUTHORIZATION_SUCCEEDED",Ab="AUTHORIZATION_FAILED";function Fb(e,t,n,r){return I.useCallback(()=>{if(!r)return;const i=window.screenX+(window.outerWidth-Kc)/2,o=window.screenY+(window.outerHeight-Uc)/2.5,s=`width=${Kc},height=${Uc},left=${i},top=${o}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function Pb(e,t,n,r){const i=We();return I.useCallback(o=>{var s,a;if(o.origin===Nl){if(o.data.eventType===Rb){const u=(s=o.data.data)==null?void 0:s.connection;u?(e(u),i.setQueriesData({queryKey:["amp","connections"]},()=>[u]),t==null||t.close(),r==null||r(),i.invalidateQueries({queryKey:["amp","connections"]})):console.error("Connection ID not found in event data: ",{event:o})}o.data.eventType===Ab&&(console.error("OAuth failed: ",{event:o}),n==null||n(((a=o==null?void 0:o.data)==null?void 0:a.message)??"Something went wrong. Please try again."))}},[t,n,i,e,r])}function Db({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:i,onSuccessConnect:o,isSuccessConnect:s,onWindowClose:a}){const[u,f]=I.useState(null),[l,d]=I.useState(null),h=We(),m=I.useRef(null),y=Pb(f,l,r,o),w=Fb(n,d,y,t);I.useEffect(()=>{t&&!l&&!u&&!i&&!s&&(r==null||r(null),w())},[t,l,w,u,i,s,r]);const g=I.useCallback(()=>{h.invalidateQueries({queryKey:["amp","connections"]}),d(null),!u&&!i?console.error("Window closed and no connection was found. Please try again."):u&&(r==null||r(null)),a==null||a()},[u,i,r,a,h]);return I.useEffect(()=>{if(l)return m.current=setInterval(()=>{l!=null&&l.closed&&(m.current&&clearInterval(m.current),m.current=null,g())},500),()=>{m.current&&(clearInterval(m.current),m.current=null),window.removeEventListener("message",y)}},[g,l,y]),c.jsx("div",{children:e})}const Mb=()=>{const e=ut(),t=We();return On({mutationKey:["updateOauthConnection"],mutationFn:async n=>!n.projectIdOrName||!n.connectionId?Promise.reject(new Error("Project ID and connection ID are required")):(await e()).oAuthApi.oauthUpdate(n),onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function kb({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return c.jsxs("div",{style:{padding:"1rem 0"},children:[c.jsx("p",{children:`Re-authenticate to ${r}`}),c.jsx(cn,{error:t}),c.jsx(He,{variant:"ghost",style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function jb({provider:e}){const{selectedConnection:t,isConnectionsLoading:n}=an(),r=t==null?void 0:t.id,i=t==null?void 0:t.projectId,{providerName:o}=dt(e),{mutateAsync:s,isPending:a,error:u}=Mb(),[f,l]=I.useState(null),[d,h]=I.useState(!1),[m,y]=I.useState(null),w=()=>{h(!1)},g=()=>{h(!0),l(null),y(null)},O=(u==null?void 0:u.message)||f||null,p=async()=>{w(),l(null);try{const v=await s({projectIdOrName:i||"",connectionId:r||""});y(v)}catch(v){Je(v,l)}},b=I.useCallback(v=>{l(v)},[]);return c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Update connection"}),d&&c.jsx(Ko,{children:"Connection updated successfully"}),c.jsx(Db,{windowTitle:`Connect to ${o}`,oauthUrl:m||null,onError:b,error:O,isSuccessConnect:d,onSuccessConnect:g,children:c.jsx(kb,{handleSubmit:p,error:O,providerName:o,isButtonDisabled:a||n||d})})]})}function Ca({provider:e}){var r;const{data:t}=Vo(e);if((t==null?void 0:t.authType)===mc.Basic)return c.jsx(Eb,{provider:e});if((t==null?void 0:t.authType)===mc.ApiKey)return c.jsx(Ob,{provider:e});const n=(r=t==null?void 0:t.oauth2Opts)==null?void 0:r.grantType;if(n){if(n===rs.AuthorizationCode||n===rs.AuthorizationCodePkce)return c.jsx(jb,{provider:e});if(n===rs.ClientCredentials)return c.jsx(Tb,{provider:e})}return null}const Lb=()=>{const e=ut(),t=We(),[n,r]=I.useState(null);return{...On({mutationKey:["deleteConnection"],mutationFn:async o=>(await e()).connectionApi.deleteConnection(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)},onError:o=>{console.error("Error deleting connection"),Je(o,r)}}),errorMsg:n}};function dd({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:i,onDisconnectError:o}){const{projectIdOrName:s}=Ke(),{selectedConnection:a}=an(),{mutate:u,isPending:f}=Lb(),l=!s||!a||!a.id||f,d=async()=>{l||(console.warn("deleting connection",{projectIdOrName:s,connectionId:a==null?void 0:a.id}),u({projectIdOrName:s,connectionId:a==null?void 0:a.id},{onSuccess:()=>{console.warn("successfully deleted connection:",a==null?void 0:a.id),r==null||r(a),i()},onError:y=>{Je(y,o)}}))},h=f?"Pending...":e;return c.jsx(He,{type:"button",onClick:d,disabled:l,variant:t,style:n,children:h})}const fd=I.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),ci=()=>{const e=I.useContext(fd);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e};function Vb({children:e,resetComponent:t}){const{integrationId:n,integrationObj:r}=lt(),{isError:i,removeError:o,setError:s}=sn(),a=(r==null?void 0:r.name)||n,[u,f]=I.useState(null),[l,d]=I.useState(null),{data:h,isLoading:m,isError:y,error:w,isSuccess:g}=Lo();I.useEffect(()=>{!g&&!y||(y?(s(we.HYDRATED_REVISION,a),w&&Je(w,f)):(o(we.HYDRATED_REVISION,a),f(null),d(null)))},[y,g,a,s,o,w,f]);const O=I.useMemo(()=>{var b,v,x;return{hydratedRevision:h||null,loading:m,readAction:(b=h==null?void 0:h.content)==null?void 0:b.read,writeObjects:((x=(v=h==null?void 0:h.content)==null?void 0:v.write)==null?void 0:x.objects)||[]}},[h,m]),p=(r==null?void 0:r.provider)||"provider";if(i(we.HYDRATED_REVISION,a)){const b=(r==null?void 0:r.name)||n||"unknown integration",v=`${u?Wt(u):`Error retrieving objects from ${p} or integration details for ${b}`}`;return c.jsx(_t,{message:v,children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem",width:"100%"},children:[c.jsx(Ca,{provider:p}),c.jsx("p",{children:"If authentication is failing, please try reauthenticating using the section above before deleting and recreating the connection."}),l&&c.jsx(Rl,{message:l}),c.jsx(dd,{buttonText:"Delete Connection",resetComponent:t,buttonVariant:"danger",onDisconnectError:x=>d(x)})]})})}return m?c.jsx(ai,{}):c.jsx(fd.Provider,{value:O,children:e})}const pd=I.createContext(null);function hd(){const e=I.useContext(pd);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const md=I.createContext(()=>{});function $b(){const e=I.useContext(md);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}const gd=I.createContext(void 0),Kb={};function xa(){const e=I.useContext(gd);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function Ub({children:e}){const{installation:t}=lt(),{hydratedRevision:n,loading:r}=ci(),[i,o]=I.useState(Kb),s=t==null?void 0:t.config;I.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(i).length>0)&&Yw(n,s,o)},[n,r,s,i]);const a=I.useCallback((l,d)=>{o(h=>Nt(h,m=>{m[l]=Nt(m[l],d)}))},[o]),u=I.useCallback((l,d)=>{o(h=>Nt(h,m=>{m[l]=d}))},[o]),f=I.useMemo(()=>({objectConfigurationsState:i,setObjectConfigurationsState:o,setConfigureState:a,resetConfigureState:u}),[i,u,a]);return c.jsx(gd.Provider,{value:f,children:e})}const Gt=()=>{const{appName:e}=Yn(),{objectConfigurationsState:t,setConfigureState:n}=xa(),{selectedObjectName:r}=hd(),i=rd(r||"",t);return{appName:e,configureState:i,setConfigureState:n,selectedObjectName:r}};function Cn(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 ye(){return ye=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},ye.apply(null,arguments)}function Js(e,t){return Js=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Js(e,t)}function qb(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Js(e,t)}var Hs={exports:{}},no={exports:{}},Se={};/** @license React v16.13.1
10
+ */(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})()})(Tp);var cC=Tp.exports;const an=Ni(cC),dC="_button_kwfiu_1",fC="_danger_kwfiu_42",pC="_ghost_kwfiu_47",Ys={button:dC,danger:fC,ghost:pC};function ot({className:e,style:t,type:n,children:r,variant:i,...o}){const s=an(Ys.button,{[Ys.danger]:i==="danger",[Ys.ghost]:i==="ghost",[e||""]:!!e});return p.jsx("button",{type:n,className:s,style:t,...o,children:r})}const hC={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 yo({children:e,style:t}){return p.jsx(Kn,{style:{...hC,...t},children:e})}const Np=e=>{const t=Ct(),{provider:n}=St(),r=e||n;return Hr({queryKey:["amp","providerInfo",r],queryFn:async()=>{if(!r)throw new Error("Provider not found");return(await t()).providerApi.getProvider({provider:r})},enabled:!!r})},Ot=e=>{const t=Np(e),{data:n}=t,{provider:r}=St(),i=n&&BI(n==null?void 0:n.name,n);return{...t,providerName:i,selectedProvider:e||r}};function Pn({error:e}){return e?p.jsx(yo,{style:{marginTop:"2em"},children:e}):null}const mC="_input_1ymb7_1",gC="_inputError_1ymb7_27",Zs={input:mC,inputError:gC};function kp({id:e,type:t,className:n,isError:r=!1,...i}){const o=r?an(Zs.inputError,Zs.input):Zs.input;return p.jsx("input",{id:e,type:t,className:an(o,n),...i})}function yC(){return p.jsx("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:p.jsxs("g",{opacity:"0.5",children:[p.jsx("path",{d:"M14.2821 11.0004C14.2821 12.8154 12.8154 14.2821 11.0004 14.2821C9.18542 14.2821 7.71875 12.8154 7.71875 11.0004C7.71875 9.18542 9.18542 7.71875 11.0004 7.71875C12.8154 7.71875 14.2821 9.18542 14.2821 11.0004Z",stroke:"currentColor",strokeWidth:"1.375",strokeLinecap:"round",strokeLinejoin:"round"}),p.jsx("path",{d:"M10.9999 18.581C14.2357 18.581 17.2515 16.6743 19.3507 13.3743C20.1757 12.0818 20.1757 9.90932 19.3507 8.61682C17.2515 5.31682 14.2357 3.41016 10.9999 3.41016C7.76402 3.41016 4.74819 5.31682 2.64902 8.61682C1.82402 9.90932 1.82402 12.0818 2.64902 13.3743C4.74819 16.6743 7.76402 18.581 10.9999 18.581Z",stroke:"currentColor",strokeWidth:"1.375",strokeLinecap:"round",strokeLinejoin:"round"})]})})}function vC(){return p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[p.jsx("path",{d:"M13.3187 8.68036L8.68036 13.3187C8.06528 12.7036 7.71973 11.8694 7.71973 10.9995C7.71973 10.5688 7.80456 10.1423 7.96939 9.7444C8.13421 9.34648 8.3758 8.98491 8.68036 8.68036C8.98491 8.3758 9.34648 8.13421 9.7444 7.96939C10.1423 7.80456 10.5688 7.71973 10.9995 7.71973C11.8694 7.71973 12.7036 8.06528 13.3187 8.68036Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),p.jsx("path",{d:"M16.3349 5.28895C14.7307 4.07895 12.8974 3.41895 10.9999 3.41895C7.76402 3.41895 4.74819 5.32561 2.64902 8.62561C1.82402 9.91811 1.82402 12.0906 2.64902 13.3831C3.37319 14.5198 4.21652 15.5006 5.13319 16.2889M7.71819 17.9023C8.76319 18.3423 9.87236 18.5806 10.9999 18.5806C14.2357 18.5806 17.2515 16.6739 19.3507 13.3739C20.1757 12.0814 20.1757 9.90895 19.3507 8.61645C19.0482 8.13978 18.7182 7.69061 18.379 7.26895",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),p.jsx("path",{d:"M14.2172 11.6413C14.093 12.2808 13.7806 12.8685 13.32 13.3291C12.8594 13.7897 12.2716 14.1022 11.6322 14.2263M8.68051 13.3188L1.83301 20.1663M20.1663 1.83301L13.3188 8.68051",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function wC({id:e,name:t,placeholder:n="Password",onChange:r,value:i,className:o,isError:s}){const[a,l]=C.useState(!1),c=()=>l(u=>!u);return p.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[p.jsx(_n.Input,{id:e,name:t,type:a?"text":"password",placeholder:n,onChange:r,value:i,className:o,isError:s}),p.jsx(ot,{type:"button","aria-label":a?"Hide password":"Show password",style:{height:"2.5rem",width:"2.5rem",display:"flex",alignItems:"center",justifyContent:"center"},onClick:c,variant:"ghost",children:p.jsx("span",{style:{height:"1.5rem",width:"1.5rem"},children:a?p.jsx(vC,{}):p.jsx(yC,{})})})]})}const bC="_textarea_18zl4_1",xC="_textareaError_18zl4_14",ea={textarea:bC,textareaError:xC};function IC({className:e,isError:t=!1,...n}){const r=t?an(ea.textareaError,ea.textarea):ea.textarea;return p.jsx("textarea",{className:an(e,r),...n})}const _n={Input:kp,Textarea:IC,PasswordInput:wC},CC=()=>{const{projectIdOrName:e}=Ze(),t=Ct();return Hr({queryKey:["project",e,"entitlements"],queryFn:async()=>{if(!e)throw new Error("Project ID is required");return(await t()).projectApi.getProject({projectIdOrName:e,includeEntitlements:!0})},enabled:!!e})};function Ap(){var n,r;const{data:e}=CC();return((r=(n=e==null?void 0:e.entitlements)==null?void 0:n.brandingRemoval)==null?void 0:r.value)===!0?null:p.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:[p.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),p.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:p.jsx("img",{style:{height:".8em"},src:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",alt:"Ampersand"})})]})}function vr({children:e}){return p.jsx(Ai,{children:p.jsxs(Kn,{children:[p.jsx("div",{style:{padding:"3rem 2rem"},children:e}),p.jsx(Ap,{})]})})}function wr({children:e}){return p.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function SC({children:e}){return p.jsx("p",{style:{padding:".5em 0"},children:e})}const OC="_link_oo2kv_1",EC={link:OC};function Fl({href:e,className:t,style:n,label:r,children:i,newTab:o=!1}){return p.jsx("a",{className:an(EC.link,t),style:n,href:e,"aria-label":r||void 0,target:o?"_blank":"_self",rel:o?"noopener noreferrer":void 0,children:i})}function _C(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const TC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,NC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,kC={};function yc(e,t){return(kC.jsx?NC:TC).test(e)}const AC=/[ \t\n\f\r]/g;function RC(e){return typeof e=="object"?e.type==="text"?vc(e.value):!1:vc(e)}function vc(e){return e.replace(AC,"")===""}class vo{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}vo.prototype.normal={};vo.prototype.property={};vo.prototype.space=void 0;function Rp(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new vo(n,r,t)}function Wa(e){return e.toLowerCase()}class $t{constructor(t,n){this.attribute=n,this.property=t}}$t.prototype.attribute="";$t.prototype.booleanish=!1;$t.prototype.boolean=!1;$t.prototype.commaOrSpaceSeparated=!1;$t.prototype.commaSeparated=!1;$t.prototype.defined=!1;$t.prototype.mustUseProperty=!1;$t.prototype.number=!1;$t.prototype.overloadedBoolean=!1;$t.prototype.property="";$t.prototype.spaceSeparated=!1;$t.prototype.space=void 0;let PC=0;const Ie=Qr(),rt=Qr(),Qa=Qr(),Q=Qr(),qe=Qr(),ti=Qr(),zt=Qr();function Qr(){return 2**++PC}const Ga=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ie,booleanish:rt,commaOrSpaceSeparated:zt,commaSeparated:ti,number:Q,overloadedBoolean:Qa,spaceSeparated:qe},Symbol.toStringTag,{value:"Module"})),ta=Object.keys(Ga);class Dl extends $t{constructor(t,n,r,i){let o=-1;if(super(t,n),wc(this,"space",i),typeof r=="number")for(;++o<ta.length;){const s=ta[o];wc(this,ta[o],(r&Ga[s])===Ga[s])}}}Dl.prototype.defined=!0;function wc(e,t,n){n&&(e[t]=n)}function Pi(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const o=new Dl(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[Wa(r)]=r,n[Wa(o.attribute)]=r}return new vo(t,n,e.space)}const Pp=Pi({properties:{ariaActiveDescendant:null,ariaAtomic:rt,ariaAutoComplete:null,ariaBusy:rt,ariaChecked:rt,ariaColCount:Q,ariaColIndex:Q,ariaColSpan:Q,ariaControls:qe,ariaCurrent:null,ariaDescribedBy:qe,ariaDetails:null,ariaDisabled:rt,ariaDropEffect:qe,ariaErrorMessage:null,ariaExpanded:rt,ariaFlowTo:qe,ariaGrabbed:rt,ariaHasPopup:null,ariaHidden:rt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:qe,ariaLevel:Q,ariaLive:null,ariaModal:rt,ariaMultiLine:rt,ariaMultiSelectable:rt,ariaOrientation:null,ariaOwns:qe,ariaPlaceholder:null,ariaPosInSet:Q,ariaPressed:rt,ariaReadOnly:rt,ariaRelevant:null,ariaRequired:rt,ariaRoleDescription:qe,ariaRowCount:Q,ariaRowIndex:Q,ariaRowSpan:Q,ariaSelected:rt,ariaSetSize:Q,ariaSort:null,ariaValueMax:Q,ariaValueMin:Q,ariaValueNow:Q,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Fp(e,t){return t in e?e[t]:t}function Dp(e,t){return Fp(e,t.toLowerCase())}const FC=Pi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ti,acceptCharset:qe,accessKey:qe,action:null,allow:null,allowFullScreen:Ie,allowPaymentRequest:Ie,allowUserMedia:Ie,alt:null,as:null,async:Ie,autoCapitalize:null,autoComplete:qe,autoFocus:Ie,autoPlay:Ie,blocking:qe,capture:null,charSet:null,checked:Ie,cite:null,className:qe,cols:Q,colSpan:null,content:null,contentEditable:rt,controls:Ie,controlsList:qe,coords:Q|ti,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ie,defer:Ie,dir:null,dirName:null,disabled:Ie,download:Qa,draggable:rt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ie,formTarget:null,headers:qe,height:Q,hidden:Qa,high:Q,href:null,hrefLang:null,htmlFor:qe,httpEquiv:qe,id:null,imageSizes:null,imageSrcSet:null,inert:Ie,inputMode:null,integrity:null,is:null,isMap:Ie,itemId:null,itemProp:qe,itemRef:qe,itemScope:Ie,itemType:qe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ie,low:Q,manifest:null,max:null,maxLength:Q,media:null,method:null,min:null,minLength:Q,multiple:Ie,muted:Ie,name:null,nonce:null,noModule:Ie,noValidate:Ie,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ie,optimum:Q,pattern:null,ping:qe,placeholder:null,playsInline:Ie,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ie,referrerPolicy:null,rel:qe,required:Ie,reversed:Ie,rows:Q,rowSpan:Q,sandbox:qe,scope:null,scoped:Ie,seamless:Ie,selected:Ie,shadowRootClonable:Ie,shadowRootDelegatesFocus:Ie,shadowRootMode:null,shape:null,size:Q,sizes:null,slot:null,span:Q,spellCheck:rt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Q,step:null,style:null,tabIndex:Q,target:null,title:null,translate:null,type:null,typeMustMatch:Ie,useMap:null,value:rt,width:Q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:qe,axis:null,background:null,bgColor:null,border:Q,borderColor:null,bottomMargin:Q,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ie,declare:Ie,event:null,face:null,frame:null,frameBorder:null,hSpace:Q,leftMargin:Q,link:null,longDesc:null,lowSrc:null,marginHeight:Q,marginWidth:Q,noResize:Ie,noHref:Ie,noShade:Ie,noWrap:Ie,object:null,profile:null,prompt:null,rev:null,rightMargin:Q,rules:null,scheme:null,scrolling:rt,standby:null,summary:null,text:null,topMargin:Q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Q,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ie,disableRemotePlayback:Ie,prefix:null,property:null,results:Q,security:null,unselectable:null},space:"html",transform:Dp}),DC=Pi({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:zt,accentHeight:Q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Q,amplitude:Q,arabicForm:null,ascent:Q,attributeName:null,attributeType:null,azimuth:Q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Q,by:null,calcMode:null,capHeight:Q,className:qe,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Q,diffuseConstant:Q,direction:null,display:null,dur:null,divisor:Q,dominantBaseline:null,download:Ie,dx:null,dy:null,edgeMode:null,editable:null,elevation:Q,enableBackground:null,end:null,event:null,exponent:Q,externalResourcesRequired:null,fill:null,fillOpacity:Q,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ti,g2:ti,glyphName:ti,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Q,horizOriginX:Q,horizOriginY:Q,id:null,ideographic:Q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Q,k:Q,k1:Q,k2:Q,k3:Q,k4:Q,kernelMatrix:zt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Q,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Q,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Q,overlineThickness:Q,paintOrder:null,panose1:null,path:null,pathLength:Q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:qe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Q,pointsAtY:Q,pointsAtZ:Q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:zt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:zt,rev:zt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:zt,requiredFeatures:zt,requiredFonts:zt,requiredFormats:zt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Q,specularExponent:Q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Q,strikethroughThickness:Q,string:null,stroke:null,strokeDashArray:zt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Q,strokeOpacity:Q,strokeWidth:null,style:null,surfaceScale:Q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:zt,tabIndex:Q,tableValues:null,target:null,targetX:Q,targetY:Q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:zt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Q,underlineThickness:Q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Q,values:null,vAlphabetic:Q,vMathematical:Q,vectorEffect:null,vHanging:Q,vIdeographic:Q,version:null,vertAdvY:Q,vertOriginX:Q,vertOriginY:Q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Fp}),Mp=Pi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Lp=Pi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Dp}),jp=Pi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),MC={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},LC=/[A-Z]/g,bc=/-[a-z]/g,jC=/^data[-\w.:]+$/i;function BC(e,t){const n=Wa(t);let r=t,i=$t;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&jC.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(bc,UC);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!bc.test(o)){let s=o.replace(LC,VC);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}i=Dl}return new i(r,t)}function VC(e){return"-"+e.toLowerCase()}function UC(e){return e.charAt(1).toUpperCase()}const $C=Rp([Pp,FC,Mp,Lp,jp],"html"),Ml=Rp([Pp,DC,Mp,Lp,jp],"svg");function qC(e){return e.join(" ").trim()}var Ll={},xc=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,zC=/\n/g,KC=/^\s*/,HC=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,JC=/^:\s*/,WC=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,QC=/^[;\s]*/,GC=/^\s+|\s+$/g,XC=`
11
+ `,Ic="/",Cc="*",Er="",YC="comment",ZC="declaration";function e0(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(y){var m=y.match(zC);m&&(n+=m.length);var v=y.lastIndexOf(XC);r=~v?y.length-v:r+y.length}function o(){var y={line:n,column:r};return function(m){return m.position=new s(y),c(),m}}function s(y){this.start=y,this.end={line:n,column:r},this.source=t.source}s.prototype.content=e;function a(y){var m=new Error(t.source+":"+n+":"+r+": "+y);if(m.reason=y,m.filename=t.source,m.line=n,m.column=r,m.source=e,!t.silent)throw m}function l(y){var m=y.exec(e);if(m){var v=m[0];return i(v),e=e.slice(v.length),m}}function c(){l(KC)}function u(y){var m;for(y=y||[];m=d();)m!==!1&&y.push(m);return y}function d(){var y=o();if(!(Ic!=e.charAt(0)||Cc!=e.charAt(1))){for(var m=2;Er!=e.charAt(m)&&(Cc!=e.charAt(m)||Ic!=e.charAt(m+1));)++m;if(m+=2,Er===e.charAt(m-1))return a("End of comment missing");var v=e.slice(2,m-2);return r+=2,i(v),e=e.slice(m),r+=2,y({type:YC,comment:v})}}function h(){var y=o(),m=l(HC);if(m){if(d(),!l(JC))return a("property missing ':'");var v=l(WC),b=y({type:ZC,property:Sc(m[0].replace(xc,Er)),value:v?Sc(v[0].replace(xc,Er)):Er});return l(QC),b}}function f(){var y=[];u(y);for(var m;m=h();)m!==!1&&(y.push(m),u(y));return y}return c(),f()}function Sc(e){return e?e.replace(GC,Er):Er}var t0=e0,n0=sn&&sn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ll,"__esModule",{value:!0});Ll.default=i0;const r0=n0(t0);function i0(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,r0.default)(e),i=typeof t=="function";return r.forEach(o=>{if(o.type!=="declaration")return;const{property:s,value:a}=o;i?t(s,a,o):a&&(n=n||{},n[s]=a)}),n}var Ts={};Object.defineProperty(Ts,"__esModule",{value:!0});Ts.camelCase=void 0;var o0=/^--[a-zA-Z0-9_-]+$/,s0=/-([a-z])/g,a0=/^[^-]+$/,l0=/^-(webkit|moz|ms|o|khtml)-/,u0=/^-(ms)-/,c0=function(e){return!e||a0.test(e)||o0.test(e)},d0=function(e,t){return t.toUpperCase()},Oc=function(e,t){return"".concat(t,"-")},f0=function(e,t){return t===void 0&&(t={}),c0(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(u0,Oc):e=e.replace(l0,Oc),e.replace(s0,d0))};Ts.camelCase=f0;var p0=sn&&sn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},h0=p0(Ll),m0=Ts;function Xa(e,t){var n={};return!e||typeof e!="string"||(0,h0.default)(e,function(r,i){r&&i&&(n[(0,m0.camelCase)(r,t)]=i)}),n}Xa.default=Xa;var g0=Xa;const y0=Ni(g0),Bp=Vp("end"),jl=Vp("start");function Vp(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function v0(e){const t=jl(e),n=Bp(e);if(t&&n)return{start:t,end:n}}function Qi(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Ec(e.position):"start"in e||"end"in e?Ec(e):"line"in e||"column"in e?Ya(e):""}function Ya(e){return _c(e&&e.line)+":"+_c(e&&e.column)}function Ec(e){return Ya(e&&e.start)+"-"+Ya(e&&e.end)}function _c(e){return e&&typeof e=="number"?e:1}class Et extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},s=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?i=t:!o.cause&&t&&(s=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?o.ruleId=r:(o.source=r.slice(0,l),o.ruleId=r.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){const l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}const a=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=Qi(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=s&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Et.prototype.file="";Et.prototype.name="";Et.prototype.reason="";Et.prototype.message="";Et.prototype.stack="";Et.prototype.column=void 0;Et.prototype.line=void 0;Et.prototype.ancestors=void 0;Et.prototype.cause=void 0;Et.prototype.fatal=void 0;Et.prototype.place=void 0;Et.prototype.ruleId=void 0;Et.prototype.source=void 0;const Bl={}.hasOwnProperty,w0=new Map,b0=/[A-Z]/g,x0=new Set(["table","tbody","thead","tfoot","tr"]),I0=new Set(["td","th"]),Up="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function C0(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=A0(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=k0(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Ml:$C,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=$p(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function $p(e,t,n){if(t.type==="element")return S0(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return O0(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return _0(e,t,n);if(t.type==="mdxjsEsm")return E0(e,t);if(t.type==="root")return T0(e,t,n);if(t.type==="text")return N0(e,t)}function S0(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Ml,e.schema=i),e.ancestors.push(t);const o=zp(e,t.tagName,!1),s=R0(e,t);let a=Ul(e,t);return x0.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!RC(l):!0})),qp(e,s,o,t),Vl(s,a),e.ancestors.pop(),e.schema=r,e.create(t,o,s,n)}function O0(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}oo(e,t.position)}function E0(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);oo(e,t.position)}function _0(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Ml,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:zp(e,t.name,!0),s=P0(e,t),a=Ul(e,t);return qp(e,s,o,t),Vl(s,a),e.ancestors.pop(),e.schema=r,e.create(t,o,s,n)}function T0(e,t,n){const r={};return Vl(r,Ul(e,t)),e.create(t,e.Fragment,r,n)}function N0(e,t){return t.value}function qp(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Vl(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function k0(e,t,n){return r;function r(i,o,s,a){const c=Array.isArray(s.children)?n:t;return a?c(o,s,a):c(o,s)}}function A0(e,t){return n;function n(r,i,o,s){const a=Array.isArray(o.children),l=jl(r);return t(i,o,s,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function R0(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Bl.call(t.properties,i)){const o=F0(e,i,t.properties[i]);if(o){const[s,a]=o;e.tableCellAlignToStyle&&s==="align"&&typeof a=="string"&&I0.has(t.tagName)?r=a:n[s]=a}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function P0(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const s=o.expression;s.type;const a=s.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else oo(e,t.position);else{const i=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,o=e.evaluater.evaluateExpression(a.expression)}else oo(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function Ul(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:w0;for(;++r<t.children.length;){const o=t.children[r];let s;if(e.passKeys){const l=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(l){const c=i.get(l)||0;s=l+"-"+c,i.set(l,c+1)}}const a=$p(e,o,s);a!==void 0&&n.push(a)}return n}function F0(e,t,n){const r=BC(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?_C(n):qC(n)),r.property==="style"){let i=typeof n=="object"?n:D0(e,String(n));return e.stylePropertyNameCase==="css"&&(i=M0(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?MC[r.property]||r.property:r.attribute,n]}}function D0(e,t){try{return y0(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Et("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=Up+"#cannot-parse-style-attribute",i}}function zp(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let o=-1,s;for(;++o<i.length;){const a=yc(i[o])?{type:"Identifier",name:i[o]}:{type:"Literal",value:i[o]};s=s?{type:"MemberExpression",object:s,property:a,computed:!!(o&&a.type==="Literal"),optional:!1}:a}r=s}else r=yc(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Bl.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);oo(e)}function oo(e,t){const n=new Et("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Up+"#cannot-handle-mdx-estrees-without-createevaluater",n}function M0(e){const t={};let n;for(n in e)Bl.call(e,n)&&(t[L0(n)]=e[n]);return t}function L0(e){let t=e.replace(b0,j0);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function j0(e){return"-"+e.toLowerCase()}const na={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},B0={};function V0(e,t){const n=B0,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Kp(e,r,i)}function Kp(e,t,n){if(U0(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Tc(e.children,t,n)}return Array.isArray(e)?Tc(e,t,n):""}function Tc(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=Kp(e[i],t,n);return r.join("")}function U0(e){return!!(e&&typeof e=="object")}const Nc=document.createElement("i");function $l(e){const t="&"+e+";";Nc.innerHTML=t;const n=Nc.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Nn(e,t,n,r){const i=e.length;let o=0,s;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);o<r.length;)s=r.slice(o,o+1e4),s.unshift(t,0),e.splice(...s),o+=1e4,t+=1e4}function on(e,t){return e.length>0?(Nn(e,e.length,0,t),e):t}const kc={}.hasOwnProperty;function $0(e){const t={};let n=-1;for(;++n<e.length;)q0(t,e[n]);return t}function q0(e,t){let n;for(n in t){const i=(kc.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let s;if(o)for(s in o){kc.call(i,s)||(i[s]=[]);const a=o[s];z0(i[s],Array.isArray(a)?a:a?[a]:[])}}}function z0(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Nn(e,0,0,r)}function Hp(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function ni(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const En=br(/[A-Za-z]/),Jt=br(/[\dA-Za-z]/),K0=br(/[#-'*+\--9=?A-Z^-~]/);function Za(e){return e!==null&&(e<32||e===127)}const el=br(/\d/),H0=br(/[\dA-Fa-f]/),J0=br(/[!-/:-@[-`{-~]/);function ve(e){return e!==null&&e<-2}function Ut(e){return e!==null&&(e<0||e===32)}function Re(e){return e===-2||e===-1||e===32}const W0=br(new RegExp("\\p{P}|\\p{S}","u")),Q0=br(/\s/);function br(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Fi(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let s="";if(o===37&&Jt(e.charCodeAt(n+1))&&Jt(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(s=String.fromCharCode(o));else if(o>55295&&o<57344){const a=e.charCodeAt(n+1);o<56320&&a>56319&&a<57344?(s=String.fromCharCode(o,a),i=1):s="�"}else s=String.fromCharCode(o);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+i+1,s=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function ze(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return s;function s(l){return Re(l)?(e.enter(n),a(l)):t(l)}function a(l){return Re(l)&&o++<i?(e.consume(l),a):(e.exit(n),t(l))}}const G0={tokenize:X0};function X0(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),ze(e,t,"linePrefix")}function i(a){return e.enter("paragraph"),o(a)}function o(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(a)}function s(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return ve(a)?(e.consume(a),e.exit("chunkText"),o):(e.consume(a),s)}}const Y0={tokenize:Z0},Ac={tokenize:eS};function Z0(e){const t=this,n=[];let r=0,i,o,s;return a;function a(w){if(r<n.length){const x=n[r];return t.containerState=x[1],e.attempt(x[0].continuation,l,c)(w)}return c(w)}function l(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&g();const x=t.events.length;let O=x,E;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){E=t.events[O][1].end;break}b(r);let D=x;for(;D<t.events.length;)t.events[D][1].end={...E},D++;return Nn(t.events,O+1,0,t.events.slice(x)),t.events.length=D,c(w)}return a(w)}function c(w){if(r===n.length){if(!i)return h(w);if(i.currentConstruct&&i.currentConstruct.concrete)return y(w);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Ac,u,d)(w)}function u(w){return i&&g(),b(r),h(w)}function d(w){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,y(w)}function h(w){return t.containerState={},e.attempt(Ac,f,y)(w)}function f(w){return r++,n.push([t.currentConstruct,t.containerState]),h(w)}function y(w){if(w===null){i&&g(),b(0),e.consume(w);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),m(w)}function m(w){if(w===null){v(e.exit("chunkFlow"),!0),b(0),e.consume(w);return}return ve(w)?(e.consume(w),v(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(w),m)}function v(w,x){const O=t.sliceStream(w);if(x&&O.push(null),w.previous=o,o&&(o.next=w),o=w,i.defineSkip(w.start),i.write(O),t.parser.lazy[w.start.line]){let E=i.events.length;for(;E--;)if(i.events[E][1].start.offset<s&&(!i.events[E][1].end||i.events[E][1].end.offset>s))return;const D=t.events.length;let N=D,M,R;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){if(M){R=t.events[N][1].end;break}M=!0}for(b(r),E=D;E<t.events.length;)t.events[E][1].end={...R},E++;Nn(t.events,N+1,0,t.events.slice(D)),t.events.length=E}}function b(w){let x=n.length;for(;x-- >w;){const O=n[x];t.containerState=O[1],O[0].exit.call(t,e)}n.length=w}function g(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function eS(e,t,n){return ze(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Rc(e){if(e===null||Ut(e)||Q0(e))return 1;if(W0(e))return 2}function ql(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const tl={name:"attention",resolveAll:tS,tokenize:nS};function tS(e,t){let n=-1,r,i,o,s,a,l,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},h={...e[n][1].start};Pc(d,-l),Pc(h,l),s={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},o={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...s.start},end:{...a.end}},e[r][1].end={...s.start},e[n][1].start={...a.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=on(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=on(c,[["enter",i,t],["enter",s,t],["exit",s,t],["enter",o,t]]),c=on(c,ql(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=on(c,[["exit",o,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=on(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,Nn(e,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function nS(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Rc(r);let o;return s;function s(l){return o=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===o)return e.consume(l),a;const c=e.exit("attentionSequence"),u=Rc(l),d=!u||u===2&&i||n.includes(l),h=!i||i===2&&u||n.includes(r);return c._open=!!(o===42?d:d&&(i||!h)),c._close=!!(o===42?h:h&&(u||!d)),t(l)}}function Pc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const rS={name:"autolink",tokenize:iS};function iS(e,t,n){let r=0;return i;function i(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(f){return En(f)?(e.consume(f),s):f===64?n(f):c(f)}function s(f){return f===43||f===45||f===46||Jt(f)?(r=1,a(f)):c(f)}function a(f){return f===58?(e.consume(f),r=0,l):(f===43||f===45||f===46||Jt(f))&&r++<32?(e.consume(f),a):(r=0,c(f))}function l(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||Za(f)?n(f):(e.consume(f),l)}function c(f){return f===64?(e.consume(f),u):K0(f)?(e.consume(f),c):n(f)}function u(f){return Jt(f)?d(f):n(f)}function d(f){return f===46?(e.consume(f),r=0,u):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):h(f)}function h(f){if((f===45||Jt(f))&&r++<63){const y=f===45?h:d;return e.consume(f),y}return n(f)}}const Ns={partial:!0,tokenize:oS};function oS(e,t,n){return r;function r(o){return Re(o)?ze(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||ve(o)?t(o):n(o)}}const Jp={continuation:{tokenize:aS},exit:lS,name:"blockQuote",tokenize:sS};function sS(e,t,n){const r=this;return i;function i(s){if(s===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),o}return n(s)}function o(s){return Re(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function aS(e,t,n){const r=this;return i;function i(s){return Re(s)?ze(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):o(s)}function o(s){return e.attempt(Jp,t,n)(s)}}function lS(e){e.exit("blockQuote")}const Wp={name:"characterEscape",tokenize:uS};function uS(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return J0(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const Qp={name:"characterReference",tokenize:cS};function cS(e,t,n){const r=this;let i=0,o,s;return a;function a(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),l}function l(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),o=31,s=Jt,u(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,s=H0,u):(e.enter("characterReferenceValue"),o=7,s=el,u(d))}function u(d){if(d===59&&i){const h=e.exit("characterReferenceValue");return s===Jt&&!$l(r.sliceSerialize(h))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(d)&&i++<o?(e.consume(d),u):n(d)}}const Fc={partial:!0,tokenize:fS},Dc={concrete:!0,name:"codeFenced",tokenize:dS};function dS(e,t,n){const r=this,i={partial:!0,tokenize:O};let o=0,s=0,a;return l;function l(E){return c(E)}function c(E){const D=r.events[r.events.length-1];return o=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,a=E,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(E)}function u(E){return E===a?(s++,e.consume(E),u):s<3?n(E):(e.exit("codeFencedFenceSequence"),Re(E)?ze(e,d,"whitespace")(E):d(E))}function d(E){return E===null||ve(E)?(e.exit("codeFencedFence"),r.interrupt?t(E):e.check(Fc,m,x)(E)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(E))}function h(E){return E===null||ve(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(E)):Re(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ze(e,f,"whitespace")(E)):E===96&&E===a?n(E):(e.consume(E),h)}function f(E){return E===null||ve(E)?d(E):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),y(E))}function y(E){return E===null||ve(E)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(E)):E===96&&E===a?n(E):(e.consume(E),y)}function m(E){return e.attempt(i,x,v)(E)}function v(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),b}function b(E){return o>0&&Re(E)?ze(e,g,"linePrefix",o+1)(E):g(E)}function g(E){return E===null||ve(E)?e.check(Fc,m,x)(E):(e.enter("codeFlowValue"),w(E))}function w(E){return E===null||ve(E)?(e.exit("codeFlowValue"),g(E)):(e.consume(E),w)}function x(E){return e.exit("codeFenced"),t(E)}function O(E,D,N){let M=0;return R;function R(X){return E.enter("lineEnding"),E.consume(X),E.exit("lineEnding"),P}function P(X){return E.enter("codeFencedFence"),Re(X)?ze(E,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(X):F(X)}function F(X){return X===a?(E.enter("codeFencedFenceSequence"),U(X)):N(X)}function U(X){return X===a?(M++,E.consume(X),U):M>=s?(E.exit("codeFencedFenceSequence"),Re(X)?ze(E,B,"whitespace")(X):B(X)):N(X)}function B(X){return X===null||ve(X)?(E.exit("codeFencedFence"),D(X)):N(X)}}}function fS(e,t,n){const r=this;return i;function i(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o)}function o(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const ra={name:"codeIndented",tokenize:hS},pS={partial:!0,tokenize:mS};function hS(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),ze(e,o,"linePrefix",5)(c)}function o(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?s(c):n(c)}function s(c){return c===null?l(c):ve(c)?e.attempt(pS,s,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||ve(c)?(e.exit("codeFlowValue"),s(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function mS(e,t,n){const r=this;return i;function i(s){return r.parser.lazy[r.now().line]?n(s):ve(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):ze(e,o,"linePrefix",5)(s)}function o(s){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):ve(s)?i(s):n(s)}}const gS={name:"codeText",previous:vS,resolve:yS,tokenize:wS};function yS(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function vS(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function wS(e,t,n){let r=0,i,o;return s;function s(d){return e.enter("codeText"),e.enter("codeTextSequence"),a(d)}function a(d){return d===96?(e.consume(d),r++,a):(e.exit("codeTextSequence"),l(d))}function l(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),l):d===96?(o=e.enter("codeTextSequence"),i=0,u(d)):ve(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||ve(d)?(e.exit("codeTextData"),l(d)):(e.consume(d),c)}function u(d){return d===96?(e.consume(d),i++,u):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(o.type="codeTextData",c(d))}}class bS{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&qi(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),qi(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),qi(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);qi(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);qi(this.left,n.reverse())}}}function qi(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Gp(e){const t={};let n=-1,r,i,o,s,a,l,c;const u=new bS(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,o=0,o<l.length&&l[o][1].type==="lineEndingBlank"&&(o+=2),o<l.length&&l[o][1].type==="content"))for(;++o<l.length&&l[o][1].type!=="content";)l[o][1].type==="chunkText"&&(l[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,xS(u,n)),n=t[n],c=!0);else if(r[1]._container){for(o=n,i=void 0;o--;)if(s=u.get(o),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),s[1].type="lineEnding",i=o);else if(!(s[1].type==="linePrefix"||s[1].type==="listItemIndent"))break;i&&(r[1].end={...u.get(i)[1].start},a=u.slice(i,n),a.unshift(r),u.splice(i,n-i+1,a))}}return Nn(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function xS(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const o=[];let s=n._tokenizer;s||(s=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));const a=s.events,l=[],c={};let u,d,h=-1,f=n,y=0,m=0;const v=[m];for(;f;){for(;e.get(++i)[1]!==f;);o.push(i),f._tokenizer||(u=r.sliceStream(f),f.next||u.push(null),d&&s.defineSkip(f.start),f._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(u),f._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),d=f,f=f.next}for(f=n;++h<a.length;)a[h][0]==="exit"&&a[h-1][0]==="enter"&&a[h][1].type===a[h-1][1].type&&a[h][1].start.line!==a[h][1].end.line&&(m=h+1,v.push(m),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(s.events=[],f?(f._tokenizer=void 0,f.previous=void 0):v.pop(),h=v.length;h--;){const b=a.slice(v[h],v[h+1]),g=o.pop();l.push([g,g+b.length-1]),e.splice(g,2,b)}for(l.reverse(),h=-1;++h<l.length;)c[y+l[h][0]]=y+l[h][1],y+=l[h][1]-l[h][0]-1;return c}const IS={resolve:SS,tokenize:OS},CS={partial:!0,tokenize:ES};function SS(e){return Gp(e),e}function OS(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?o(a):ve(a)?e.check(CS,s,o)(a):(e.consume(a),i)}function o(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function s(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function ES(e,t,n){const r=this;return i;function i(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ze(e,o,"linePrefix")}function o(s){if(s===null||ve(s))return n(s);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function Xp(e,t,n,r,i,o,s,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(b){return b===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(b),e.exit(o),h):b===null||b===32||b===41||Za(b)?n(b):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),m(b))}function h(b){return b===62?(e.enter(o),e.consume(b),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),f(b))}function f(b){return b===62?(e.exit("chunkString"),e.exit(a),h(b)):b===null||b===60||ve(b)?n(b):(e.consume(b),b===92?y:f)}function y(b){return b===60||b===62||b===92?(e.consume(b),f):f(b)}function m(b){return!u&&(b===null||b===41||Ut(b))?(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(b)):u<c&&b===40?(e.consume(b),u++,m):b===41?(e.consume(b),u--,m):b===null||b===32||b===40||Za(b)?n(b):(e.consume(b),b===92?v:m)}function v(b){return b===40||b===41||b===92?(e.consume(b),m):m(b)}}function Yp(e,t,n,r,i,o){const s=this;let a=0,l;return c;function c(f){return e.enter(r),e.enter(i),e.consume(f),e.exit(i),e.enter(o),u}function u(f){return a>999||f===null||f===91||f===93&&!l||f===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?n(f):f===93?(e.exit(o),e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):ve(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||ve(f)||a++>999?(e.exit("chunkString"),u(f)):(e.consume(f),l||(l=!Re(f)),f===92?h:d)}function h(f){return f===91||f===92||f===93?(e.consume(f),a++,d):d(f)}}function Zp(e,t,n,r,i,o){let s;return a;function a(h){return h===34||h===39||h===40?(e.enter(r),e.enter(i),e.consume(h),e.exit(i),s=h===40?41:h,l):n(h)}function l(h){return h===s?(e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):(e.enter(o),c(h))}function c(h){return h===s?(e.exit(o),l(s)):h===null?n(h):ve(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),ze(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(h))}function u(h){return h===s||h===null||ve(h)?(e.exit("chunkString"),c(h)):(e.consume(h),h===92?d:u)}function d(h){return h===s||h===92?(e.consume(h),u):u(h)}}function Gi(e,t){let n;return r;function r(i){return ve(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Re(i)?ze(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const _S={name:"definition",tokenize:NS},TS={partial:!0,tokenize:kS};function NS(e,t,n){const r=this;let i;return o;function o(f){return e.enter("definition"),s(f)}function s(f){return Yp.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return i=ni(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),l):n(f)}function l(f){return Ut(f)?Gi(e,c)(f):c(f)}function c(f){return Xp(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function u(f){return e.attempt(TS,d,d)(f)}function d(f){return Re(f)?ze(e,h,"whitespace")(f):h(f)}function h(f){return f===null||ve(f)?(e.exit("definition"),r.parser.defined.push(i),t(f)):n(f)}}function kS(e,t,n){return r;function r(a){return Ut(a)?Gi(e,i)(a):n(a)}function i(a){return Zp(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return Re(a)?ze(e,s,"whitespace")(a):s(a)}function s(a){return a===null||ve(a)?t(a):n(a)}}const AS={name:"hardBreakEscape",tokenize:RS};function RS(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return ve(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const PS={name:"headingAtx",resolve:FS,tokenize:DS};function FS(e,t){let n=e.length-2,r=3,i,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Nn(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function DS(e,t,n){let r=0;return i;function i(u){return e.enter("atxHeading"),o(u)}function o(u){return e.enter("atxHeadingSequence"),s(u)}function s(u){return u===35&&r++<6?(e.consume(u),s):u===null||Ut(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||ve(u)?(e.exit("atxHeading"),t(u)):Re(u)?ze(e,a,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||Ut(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const MS=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Mc=["pre","script","style","textarea"],LS={concrete:!0,name:"htmlFlow",resolveTo:VS,tokenize:US},jS={partial:!0,tokenize:qS},BS={partial:!0,tokenize:$S};function VS(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function US(e,t,n){const r=this;let i,o,s,a,l;return c;function c(S){return u(S)}function u(S){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(S),d}function d(S){return S===33?(e.consume(S),h):S===47?(e.consume(S),o=!0,m):S===63?(e.consume(S),i=3,r.interrupt?t:I):En(S)?(e.consume(S),s=String.fromCharCode(S),v):n(S)}function h(S){return S===45?(e.consume(S),i=2,f):S===91?(e.consume(S),i=5,a=0,y):En(S)?(e.consume(S),i=4,r.interrupt?t:I):n(S)}function f(S){return S===45?(e.consume(S),r.interrupt?t:I):n(S)}function y(S){const z="CDATA[";return S===z.charCodeAt(a++)?(e.consume(S),a===z.length?r.interrupt?t:F:y):n(S)}function m(S){return En(S)?(e.consume(S),s=String.fromCharCode(S),v):n(S)}function v(S){if(S===null||S===47||S===62||Ut(S)){const z=S===47,$=s.toLowerCase();return!z&&!o&&Mc.includes($)?(i=1,r.interrupt?t(S):F(S)):MS.includes(s.toLowerCase())?(i=6,z?(e.consume(S),b):r.interrupt?t(S):F(S)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(S):o?g(S):w(S))}return S===45||Jt(S)?(e.consume(S),s+=String.fromCharCode(S),v):n(S)}function b(S){return S===62?(e.consume(S),r.interrupt?t:F):n(S)}function g(S){return Re(S)?(e.consume(S),g):R(S)}function w(S){return S===47?(e.consume(S),R):S===58||S===95||En(S)?(e.consume(S),x):Re(S)?(e.consume(S),w):R(S)}function x(S){return S===45||S===46||S===58||S===95||Jt(S)?(e.consume(S),x):O(S)}function O(S){return S===61?(e.consume(S),E):Re(S)?(e.consume(S),O):w(S)}function E(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(e.consume(S),l=S,D):Re(S)?(e.consume(S),E):N(S)}function D(S){return S===l?(e.consume(S),l=null,M):S===null||ve(S)?n(S):(e.consume(S),D)}function N(S){return S===null||S===34||S===39||S===47||S===60||S===61||S===62||S===96||Ut(S)?O(S):(e.consume(S),N)}function M(S){return S===47||S===62||Re(S)?w(S):n(S)}function R(S){return S===62?(e.consume(S),P):n(S)}function P(S){return S===null||ve(S)?F(S):Re(S)?(e.consume(S),P):n(S)}function F(S){return S===45&&i===2?(e.consume(S),se):S===60&&i===1?(e.consume(S),ce):S===62&&i===4?(e.consume(S),J):S===63&&i===3?(e.consume(S),I):S===93&&i===5?(e.consume(S),we):ve(S)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(jS,V,U)(S)):S===null||ve(S)?(e.exit("htmlFlowData"),U(S)):(e.consume(S),F)}function U(S){return e.check(BS,B,V)(S)}function B(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),X}function X(S){return S===null||ve(S)?U(S):(e.enter("htmlFlowData"),F(S))}function se(S){return S===45?(e.consume(S),I):F(S)}function ce(S){return S===47?(e.consume(S),s="",ge):F(S)}function ge(S){if(S===62){const z=s.toLowerCase();return Mc.includes(z)?(e.consume(S),J):F(S)}return En(S)&&s.length<8?(e.consume(S),s+=String.fromCharCode(S),ge):F(S)}function we(S){return S===93?(e.consume(S),I):F(S)}function I(S){return S===62?(e.consume(S),J):S===45&&i===2?(e.consume(S),I):F(S)}function J(S){return S===null||ve(S)?(e.exit("htmlFlowData"),V(S)):(e.consume(S),J)}function V(S){return e.exit("htmlFlow"),t(S)}}function $S(e,t,n){const r=this;return i;function i(s){return ve(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o):n(s)}function o(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function qS(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Ns,t,n)}}const zS={name:"htmlText",tokenize:KS};function KS(e,t,n){const r=this;let i,o,s;return a;function a(I){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(I),l}function l(I){return I===33?(e.consume(I),c):I===47?(e.consume(I),O):I===63?(e.consume(I),w):En(I)?(e.consume(I),N):n(I)}function c(I){return I===45?(e.consume(I),u):I===91?(e.consume(I),o=0,y):En(I)?(e.consume(I),g):n(I)}function u(I){return I===45?(e.consume(I),f):n(I)}function d(I){return I===null?n(I):I===45?(e.consume(I),h):ve(I)?(s=d,ce(I)):(e.consume(I),d)}function h(I){return I===45?(e.consume(I),f):d(I)}function f(I){return I===62?se(I):I===45?h(I):d(I)}function y(I){const J="CDATA[";return I===J.charCodeAt(o++)?(e.consume(I),o===J.length?m:y):n(I)}function m(I){return I===null?n(I):I===93?(e.consume(I),v):ve(I)?(s=m,ce(I)):(e.consume(I),m)}function v(I){return I===93?(e.consume(I),b):m(I)}function b(I){return I===62?se(I):I===93?(e.consume(I),b):m(I)}function g(I){return I===null||I===62?se(I):ve(I)?(s=g,ce(I)):(e.consume(I),g)}function w(I){return I===null?n(I):I===63?(e.consume(I),x):ve(I)?(s=w,ce(I)):(e.consume(I),w)}function x(I){return I===62?se(I):w(I)}function O(I){return En(I)?(e.consume(I),E):n(I)}function E(I){return I===45||Jt(I)?(e.consume(I),E):D(I)}function D(I){return ve(I)?(s=D,ce(I)):Re(I)?(e.consume(I),D):se(I)}function N(I){return I===45||Jt(I)?(e.consume(I),N):I===47||I===62||Ut(I)?M(I):n(I)}function M(I){return I===47?(e.consume(I),se):I===58||I===95||En(I)?(e.consume(I),R):ve(I)?(s=M,ce(I)):Re(I)?(e.consume(I),M):se(I)}function R(I){return I===45||I===46||I===58||I===95||Jt(I)?(e.consume(I),R):P(I)}function P(I){return I===61?(e.consume(I),F):ve(I)?(s=P,ce(I)):Re(I)?(e.consume(I),P):M(I)}function F(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),i=I,U):ve(I)?(s=F,ce(I)):Re(I)?(e.consume(I),F):(e.consume(I),B)}function U(I){return I===i?(e.consume(I),i=void 0,X):I===null?n(I):ve(I)?(s=U,ce(I)):(e.consume(I),U)}function B(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||Ut(I)?M(I):(e.consume(I),B)}function X(I){return I===47||I===62||Ut(I)?M(I):n(I)}function se(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):n(I)}function ce(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),ge}function ge(I){return Re(I)?ze(e,we,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):we(I)}function we(I){return e.enter("htmlTextData"),s(I)}}const zl={name:"labelEnd",resolveAll:QS,resolveTo:GS,tokenize:XS},HS={tokenize:YS},JS={tokenize:ZS},WS={tokenize:eO};function QS(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&Nn(e,0,e.length,n),e}function GS(e,t){let n=e.length,r=0,i,o,s,a;for(;n--;)if(i=e[n][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(s=n);const l={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[o][1].start},end:{...e[s][1].end}},u={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[s-2][1].start}};return a=[["enter",l,t],["enter",c,t]],a=on(a,e.slice(o+1,o+r+3)),a=on(a,[["enter",u,t]]),a=on(a,ql(t.parser.constructs.insideSpan.null,e.slice(o+r+4,s-3),t)),a=on(a,[["exit",u,t],e[s-2],e[s-1],["exit",c,t]]),a=on(a,e.slice(s+1)),a=on(a,[["exit",l,t]]),Nn(e,o,e.length,a),e}function XS(e,t,n){const r=this;let i=r.events.length,o,s;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return a;function a(h){return o?o._inactive?d(h):(s=r.parser.defined.includes(ni(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),l):n(h)}function l(h){return h===40?e.attempt(HS,u,s?u:d)(h):h===91?e.attempt(JS,u,s?c:d)(h):s?u(h):d(h)}function c(h){return e.attempt(WS,u,d)(h)}function u(h){return t(h)}function d(h){return o._balanced=!0,n(h)}}function YS(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),i}function i(d){return Ut(d)?Gi(e,o)(d):o(d)}function o(d){return d===41?u(d):Xp(e,s,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function s(d){return Ut(d)?Gi(e,l)(d):u(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?Zp(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return Ut(d)?Gi(e,u)(d):u(d)}function u(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function ZS(e,t,n){const r=this;return i;function i(a){return Yp.call(r,e,o,s,"reference","referenceMarker","referenceString")(a)}function o(a){return r.parser.defined.includes(ni(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function s(a){return n(a)}}function eO(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const tO={name:"labelStartImage",resolveAll:zl.resolveAll,tokenize:nO};function nO(e,t,n){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),o}function o(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),s):n(a)}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const rO={name:"labelStartLink",resolveAll:zl.resolveAll,tokenize:iO};function iO(e,t,n){const r=this;return i;function i(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),o}function o(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const ia={name:"lineEnding",tokenize:oO};function oO(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ze(e,t,"linePrefix")}}const Yo={name:"thematicBreak",tokenize:sO};function sO(e,t,n){let r=0,i;return o;function o(c){return e.enter("thematicBreak"),s(c)}function s(c){return i=c,a(c)}function a(c){return c===i?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||ve(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),Re(c)?ze(e,a,"whitespace")(c):a(c))}}const Mt={continuation:{tokenize:cO},exit:fO,name:"list",tokenize:uO},aO={partial:!0,tokenize:pO},lO={partial:!0,tokenize:dO};function uO(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return a;function a(f){const y=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:el(f)){if(r.containerState.type||(r.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(Yo,n,c)(f):c(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(f)}return n(f)}function l(f){return el(f)&&++s<10?(e.consume(f),l):(!r.interrupt||s<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),c(f)):n(f)}function c(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(Ns,r.interrupt?n:u,e.attempt(aO,h,d))}function u(f){return r.containerState.initialBlankLine=!0,o++,h(f)}function d(f){return Re(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),h):n(f)}function h(f){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function cO(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Ns,i,o);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ze(e,t,"listItemIndent",r.containerState.size+1)(a)}function o(a){return r.containerState.furtherBlankLines||!Re(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(lO,t,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,ze(e,e.attempt(Mt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function dO(e,t,n){const r=this;return ze(e,i,"listItemIndent",r.containerState.size+1);function i(o){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(o):n(o)}}function fO(e){e.exit(this.containerState.type)}function pO(e,t,n){const r=this;return ze(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const s=r.events[r.events.length-1];return!Re(o)&&s&&s[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const Lc={name:"setextUnderline",resolveTo:hO,tokenize:mO};function hO(e,t){let n=e.length,r,i,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const s={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",s,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=s,e.push(["exit",s,t]),e}function mO(e,t,n){const r=this;let i;return o;function o(c){let u=r.events.length,d;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){d=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),i=c,s(c)):n(c)}function s(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),Re(c)?ze(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||ve(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const gO={tokenize:yO};function yO(e){const t=this,n=e.attempt(Ns,r,e.attempt(this.parser.constructs.flowInitial,i,ze(e,e.attempt(this.parser.constructs.flow,i,e.attempt(IS,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const vO={resolveAll:th()},wO=eh("string"),bO=eh("text");function eh(e){return{resolveAll:th(e==="text"?xO:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,s,a);return s;function s(u){return c(u)?o(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),o(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const d=i[u];let h=-1;if(d)for(;++h<d.length;){const f=d[h];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function th(e){return t;function t(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(n,r):n}}function xO(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let o=i.length,s=-1,a=0,l;for(;o--;){const c=i[o];if(typeof c=="string"){for(s=c.length;c.charCodeAt(s-1)===32;)a++,s--;if(s)break;s=-1}else if(c===-2)l=!0,a++;else if(c!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const c={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?s:r.start._bufferIndex+s,_index:r.start._index+o,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const IO={42:Mt,43:Mt,45:Mt,48:Mt,49:Mt,50:Mt,51:Mt,52:Mt,53:Mt,54:Mt,55:Mt,56:Mt,57:Mt,62:Jp},CO={91:_S},SO={[-2]:ra,[-1]:ra,32:ra},OO={35:PS,42:Yo,45:[Lc,Yo],60:LS,61:Lc,95:Yo,96:Dc,126:Dc},EO={38:Qp,92:Wp},_O={[-5]:ia,[-4]:ia,[-3]:ia,33:tO,38:Qp,42:tl,60:[rS,zS],91:rO,92:[AS,Wp],93:zl,95:tl,96:gS},TO={null:[tl,vO]},NO={null:[42,95]},kO={null:[]},AO=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:NO,contentInitial:CO,disable:kO,document:IO,flow:OO,flowInitial:SO,insideSpan:TO,string:EO,text:_O},Symbol.toStringTag,{value:"Module"}));function RO(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},o=[];let s=[],a=[];const l={attempt:D(O),check:D(E),consume:g,enter:w,exit:x,interrupt:D(E,{interrupt:!0})},c={code:null,containerState:{},defineSkip:m,events:[],now:y,parser:e,previous:null,sliceSerialize:h,sliceStream:f,write:d};let u=t.tokenize.call(c,l);return t.resolveAll&&o.push(t),c;function d(P){return s=on(s,P),v(),s[s.length-1]!==null?[]:(N(t,0),c.events=ql(o,c.events,c),c.events)}function h(P,F){return FO(f(P),F)}function f(P){return PO(s,P)}function y(){const{_bufferIndex:P,_index:F,line:U,column:B,offset:X}=r;return{_bufferIndex:P,_index:F,line:U,column:B,offset:X}}function m(P){i[P.line]=P.column,R()}function v(){let P;for(;r._index<s.length;){const F=s[r._index];if(typeof F=="string")for(P=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===P&&r._bufferIndex<F.length;)b(F.charCodeAt(r._bufferIndex));else b(F)}}function b(P){u=u(P)}function g(P){ve(P)?(r.line++,r.column=1,r.offset+=P===-3?2:1,R()):P!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=P}function w(P,F){const U=F||{};return U.type=P,U.start=y(),c.events.push(["enter",U,c]),a.push(U),U}function x(P){const F=a.pop();return F.end=y(),c.events.push(["exit",F,c]),F}function O(P,F){N(P,F.from)}function E(P,F){F.restore()}function D(P,F){return U;function U(B,X,se){let ce,ge,we,I;return Array.isArray(B)?V(B):"tokenize"in B?V([B]):J(B);function J(Y){return ne;function ne(te){const ae=te!==null&&Y[te],Z=te!==null&&Y.null,ye=[...Array.isArray(ae)?ae:ae?[ae]:[],...Array.isArray(Z)?Z:Z?[Z]:[]];return V(ye)(te)}}function V(Y){return ce=Y,ge=0,Y.length===0?se:S(Y[ge])}function S(Y){return ne;function ne(te){return I=M(),we=Y,Y.partial||(c.currentConstruct=Y),Y.name&&c.parser.constructs.disable.null.includes(Y.name)?$():Y.tokenize.call(F?Object.assign(Object.create(c),F):c,l,z,$)(te)}}function z(Y){return P(we,I),X}function $(Y){return I.restore(),++ge<ce.length?S(ce[ge]):se}}}function N(P,F){P.resolveAll&&!o.includes(P)&&o.push(P),P.resolve&&Nn(c.events,F,c.events.length-F,P.resolve(c.events.slice(F),c)),P.resolveTo&&(c.events=P.resolveTo(c.events,c))}function M(){const P=y(),F=c.previous,U=c.currentConstruct,B=c.events.length,X=Array.from(a);return{from:B,restore:se};function se(){r=P,c.previous=F,c.currentConstruct=U,c.events.length=B,a=X,R()}}function R(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function PO(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let s;if(n===i)s=[e[n].slice(r,o)];else{if(s=e.slice(n,i),r>-1){const a=s[0];typeof a=="string"?s[0]=a.slice(r):s.shift()}o>0&&s.push(e[i].slice(0,o))}return s}function FO(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let s;if(typeof o=="string")s=o;else switch(o){case-5:{s="\r";break}case-4:{s=`
12
+ `;break}case-3:{s=`\r
13
+ `;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&i)continue;s=" ";break}default:s=String.fromCharCode(o)}i=o===-2,r.push(s)}return r.join("")}function DO(e){const r={constructs:$0([AO,...(e||{}).extensions||[]]),content:i(G0),defined:[],document:i(Y0),flow:i(gO),lazy:{},string:i(wO),text:i(bO)};return r;function i(o){return s;function s(a){return RO(r,o,a)}}}function MO(e){for(;!Gp(e););return e}const jc=/[\0\t\n\r]/g;function LO(){let e=1,t="",n=!0,r;return i;function i(o,s,a){const l=[];let c,u,d,h,f;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(s||void 0).decode(o)),d=0,t="",n&&(o.charCodeAt(0)===65279&&d++,n=void 0);d<o.length;){if(jc.lastIndex=d,c=jc.exec(o),h=c&&c.index!==void 0?c.index:o.length,f=o.charCodeAt(h),!c){t=o.slice(d);break}if(f===10&&d===h&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<h&&(l.push(o.slice(d,h)),e+=h-d),f){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}d=h+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const jO=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function BO(e){return e.replace(jO,VO)}function VO(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),o=i===120||i===88;return Hp(n.slice(o?2:1),o?16:10)}return $l(n)||e}const nh={}.hasOwnProperty;function UO(e,t,n){return typeof t!="string"&&(n=t,t=void 0),$O(n)(MO(DO(n).document().write(LO()(e,t,!0))))}function $O(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(at),autolinkProtocol:M,autolinkEmail:M,atxHeading:o(Ke),blockQuote:o(Z),characterEscape:M,characterReference:M,codeFenced:o(ye),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(ye,s),codeText:o(q,s),codeTextData:M,data:M,codeFlowValue:M,definition:o(be),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o(ee),hardBreakEscape:o(Be),hardBreakTrailing:o(Be),htmlFlow:o(je,s),htmlFlowData:M,htmlText:o(je,s),htmlTextData:M,image:o(et),label:s,link:o(at),listItem:o(Oe),listItemValue:h,listOrdered:o(lt,d),listUnordered:o(lt),paragraph:o(ft),reference:S,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o(Ke),strong:o(_t),thematicBreak:o(nt)},exit:{atxHeading:l(),atxHeadingSequence:O,autolink:l(),autolinkEmail:ae,autolinkProtocol:te,blockQuote:l(),characterEscapeValue:R,characterReferenceMarkerHexadecimal:$,characterReferenceMarkerNumeric:$,characterReferenceValue:Y,characterReference:ne,codeFenced:l(v),codeFencedFence:m,codeFencedFenceInfo:f,codeFencedFenceMeta:y,codeFlowValue:R,codeIndented:l(b),codeText:l(X),codeTextData:R,data:R,definition:l(),definitionDestinationString:x,definitionLabelString:g,definitionTitleString:w,emphasis:l(),hardBreakEscape:l(F),hardBreakTrailing:l(F),htmlFlow:l(U),htmlFlowData:R,htmlText:l(B),htmlTextData:R,image:l(ce),label:we,labelText:ge,lineEnding:P,link:l(se),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:z,resourceDestinationString:I,resourceTitleString:J,resource:V,setextHeading:l(N),setextHeadingLineSequence:D,setextHeadingText:E,strong:l(),thematicBreak:l()}};rh(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(j){let H={type:"root",children:[]};const L={stack:[H],tokenStack:[],config:t,enter:a,exit:c,buffer:s,resume:u,data:n},oe=[];let ue=-1;for(;++ue<j.length;)if(j[ue][1].type==="listOrdered"||j[ue][1].type==="listUnordered")if(j[ue][0]==="enter")oe.push(ue);else{const Je=oe.pop();ue=i(j,Je,ue)}for(ue=-1;++ue<j.length;){const Je=t[j[ue][0]];nh.call(Je,j[ue][1].type)&&Je[j[ue][1].type].call(Object.assign({sliceSerialize:j[ue][2].sliceSerialize},L),j[ue][1])}if(L.tokenStack.length>0){const Je=L.tokenStack[L.tokenStack.length-1];(Je[1]||Bc).call(L,void 0,Je[0])}for(H.position={start:er(j.length>0?j[0][1].start:{line:1,column:1,offset:0}),end:er(j.length>0?j[j.length-2][1].end:{line:1,column:1,offset:0})},ue=-1;++ue<t.transforms.length;)H=t.transforms[ue](H)||H;return H}function i(j,H,L){let oe=H-1,ue=-1,Je=!1,Tt,gt,bt,Ve;for(;++oe<=L;){const ke=j[oe];switch(ke[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ke[0]==="enter"?ue++:ue--,Ve=void 0;break}case"lineEndingBlank":{ke[0]==="enter"&&(Tt&&!Ve&&!ue&&!bt&&(bt=oe),Ve=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ve=void 0}if(!ue&&ke[0]==="enter"&&ke[1].type==="listItemPrefix"||ue===-1&&ke[0]==="exit"&&(ke[1].type==="listUnordered"||ke[1].type==="listOrdered")){if(Tt){let Nt=oe;for(gt=void 0;Nt--;){const yt=j[Nt];if(yt[1].type==="lineEnding"||yt[1].type==="lineEndingBlank"){if(yt[0]==="exit")continue;gt&&(j[gt][1].type="lineEndingBlank",Je=!0),yt[1].type="lineEnding",gt=Nt}else if(!(yt[1].type==="linePrefix"||yt[1].type==="blockQuotePrefix"||yt[1].type==="blockQuotePrefixWhitespace"||yt[1].type==="blockQuoteMarker"||yt[1].type==="listItemIndent"))break}bt&&(!gt||bt<gt)&&(Tt._spread=!0),Tt.end=Object.assign({},gt?j[gt][1].start:ke[1].end),j.splice(gt||oe,0,["exit",Tt,ke[2]]),oe++,L++}if(ke[1].type==="listItemPrefix"){const Nt={type:"listItem",_spread:!1,start:Object.assign({},ke[1].start),end:void 0};Tt=Nt,j.splice(oe,0,["enter",Nt,ke[2]]),oe++,L++,bt=void 0,Ve=!0}}}return j[H][1]._spread=Je,L}function o(j,H){return L;function L(oe){a.call(this,j(oe),oe),H&&H.call(this,oe)}}function s(){this.stack.push({type:"fragment",children:[]})}function a(j,H,L){this.stack[this.stack.length-1].children.push(j),this.stack.push(j),this.tokenStack.push([H,L||void 0]),j.position={start:er(H.start),end:void 0}}function l(j){return H;function H(L){j&&j.call(this,L),c.call(this,L)}}function c(j,H){const L=this.stack.pop(),oe=this.tokenStack.pop();if(oe)oe[0].type!==j.type&&(H?H.call(this,j,oe[0]):(oe[1]||Bc).call(this,j,oe[0]));else throw new Error("Cannot close `"+j.type+"` ("+Qi({start:j.start,end:j.end})+"): it’s not open");L.position.end=er(j.end)}function u(){return V0(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function h(j){if(this.data.expectingFirstListItemValue){const H=this.stack[this.stack.length-2];H.start=Number.parseInt(this.sliceSerialize(j),10),this.data.expectingFirstListItemValue=void 0}}function f(){const j=this.resume(),H=this.stack[this.stack.length-1];H.lang=j}function y(){const j=this.resume(),H=this.stack[this.stack.length-1];H.meta=j}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const j=this.resume(),H=this.stack[this.stack.length-1];H.value=j.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const j=this.resume(),H=this.stack[this.stack.length-1];H.value=j.replace(/(\r?\n|\r)$/g,"")}function g(j){const H=this.resume(),L=this.stack[this.stack.length-1];L.label=H,L.identifier=ni(this.sliceSerialize(j)).toLowerCase()}function w(){const j=this.resume(),H=this.stack[this.stack.length-1];H.title=j}function x(){const j=this.resume(),H=this.stack[this.stack.length-1];H.url=j}function O(j){const H=this.stack[this.stack.length-1];if(!H.depth){const L=this.sliceSerialize(j).length;H.depth=L}}function E(){this.data.setextHeadingSlurpLineEnding=!0}function D(j){const H=this.stack[this.stack.length-1];H.depth=this.sliceSerialize(j).codePointAt(0)===61?1:2}function N(){this.data.setextHeadingSlurpLineEnding=void 0}function M(j){const L=this.stack[this.stack.length-1].children;let oe=L[L.length-1];(!oe||oe.type!=="text")&&(oe=mt(),oe.position={start:er(j.start),end:void 0},L.push(oe)),this.stack.push(oe)}function R(j){const H=this.stack.pop();H.value+=this.sliceSerialize(j),H.position.end=er(j.end)}function P(j){const H=this.stack[this.stack.length-1];if(this.data.atHardBreak){const L=H.children[H.children.length-1];L.position.end=er(j.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(H.type)&&(M.call(this,j),R.call(this,j))}function F(){this.data.atHardBreak=!0}function U(){const j=this.resume(),H=this.stack[this.stack.length-1];H.value=j}function B(){const j=this.resume(),H=this.stack[this.stack.length-1];H.value=j}function X(){const j=this.resume(),H=this.stack[this.stack.length-1];H.value=j}function se(){const j=this.stack[this.stack.length-1];if(this.data.inReference){const H=this.data.referenceType||"shortcut";j.type+="Reference",j.referenceType=H,delete j.url,delete j.title}else delete j.identifier,delete j.label;this.data.referenceType=void 0}function ce(){const j=this.stack[this.stack.length-1];if(this.data.inReference){const H=this.data.referenceType||"shortcut";j.type+="Reference",j.referenceType=H,delete j.url,delete j.title}else delete j.identifier,delete j.label;this.data.referenceType=void 0}function ge(j){const H=this.sliceSerialize(j),L=this.stack[this.stack.length-2];L.label=BO(H),L.identifier=ni(H).toLowerCase()}function we(){const j=this.stack[this.stack.length-1],H=this.resume(),L=this.stack[this.stack.length-1];if(this.data.inReference=!0,L.type==="link"){const oe=j.children;L.children=oe}else L.alt=H}function I(){const j=this.resume(),H=this.stack[this.stack.length-1];H.url=j}function J(){const j=this.resume(),H=this.stack[this.stack.length-1];H.title=j}function V(){this.data.inReference=void 0}function S(){this.data.referenceType="collapsed"}function z(j){const H=this.resume(),L=this.stack[this.stack.length-1];L.label=H,L.identifier=ni(this.sliceSerialize(j)).toLowerCase(),this.data.referenceType="full"}function $(j){this.data.characterReferenceType=j.type}function Y(j){const H=this.sliceSerialize(j),L=this.data.characterReferenceType;let oe;L?(oe=Hp(H,L==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):oe=$l(H);const ue=this.stack[this.stack.length-1];ue.value+=oe}function ne(j){const H=this.stack.pop();H.position.end=er(j.end)}function te(j){R.call(this,j);const H=this.stack[this.stack.length-1];H.url=this.sliceSerialize(j)}function ae(j){R.call(this,j);const H=this.stack[this.stack.length-1];H.url="mailto:"+this.sliceSerialize(j)}function Z(){return{type:"blockquote",children:[]}}function ye(){return{type:"code",lang:null,meta:null,value:""}}function q(){return{type:"inlineCode",value:""}}function be(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ee(){return{type:"emphasis",children:[]}}function Ke(){return{type:"heading",depth:0,children:[]}}function Be(){return{type:"break"}}function je(){return{type:"html",value:""}}function et(){return{type:"image",title:null,url:"",alt:null}}function at(){return{type:"link",title:null,url:"",children:[]}}function lt(j){return{type:"list",ordered:j.type==="listOrdered",start:null,spread:j._spread,children:[]}}function Oe(j){return{type:"listItem",spread:j._spread,checked:null,children:[]}}function ft(){return{type:"paragraph",children:[]}}function _t(){return{type:"strong",children:[]}}function mt(){return{type:"text",value:""}}function nt(){return{type:"thematicBreak"}}}function er(e){return{line:e.line,column:e.column,offset:e.offset}}function rh(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?rh(e,r):qO(e,r)}}function qO(e,t){let n;for(n in t)if(nh.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Bc(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Qi({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Qi({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Qi({start:t.start,end:t.end})+") is still open")}function zO(e){const t=this;t.parser=n;function n(r){return UO(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function KO(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function HO(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
14
+ `}]}function JO(e,t){const n=t.value?t.value+`
15
+ `:"",r={};t.lang&&(r.className=["language-"+t.lang]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function WO(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function QO(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function GO(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=Fi(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let s,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),s=e.footnoteOrder.length):s=o+1,a+=1,e.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)}function XO(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function YO(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function ih(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const s=i[i.length-1];return s&&s.type==="text"?s.value+=r:i.push({type:"text",value:r}),i}function ZO(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return ih(e,t);const i={src:Fi(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)}function eE(e,t){const n={src:Fi(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function tE(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function nE(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return ih(e,t);const i={href:Fi(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function rE(e,t){const n={href:Fi(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function iE(e,t,n){const r=e.all(t),i=n?oE(n):oh(t),o={},s=[];if(typeof t.checked=="boolean"){const u=r[0];let d;u&&u.type==="element"&&u.tagName==="p"?d=u:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const u=r[a];(i||a!==0||u.type!=="element"||u.tagName!=="p")&&s.push({type:"text",value:`
16
+ `}),u.type==="element"&&u.tagName==="p"&&!i?s.push(...u.children):s.push(u)}const l=r[r.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&s.push({type:"text",value:`
17
+ `});const c={type:"element",tagName:"li",properties:o,children:s};return e.patch(t,c),e.applyData(t,c)}function oE(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=oh(n[r])}return t}function oh(e){const t=e.spread;return t??e.children.length>1}function sE(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const s=r[i];if(s.type==="element"&&s.tagName==="li"&&s.properties&&Array.isArray(s.properties.className)&&s.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)}function aE(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function lE(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function uE(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function cE(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const s={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],s),i.push(s)}if(n.length>0){const s={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=jl(t.children[1]),l=Bp(t.children[t.children.length-1]);a&&l&&(s.position={start:a,end:l}),i.push(s)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function dE(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",s=n&&n.type==="table"?n.align:void 0,a=s?s.length:t.children.length;let l=-1;const c=[];for(;++l<a;){const d=t.children[l],h={},f=s?s[l]:void 0;f&&(h.align=f);let y={type:"element",tagName:o,properties:h,children:[]};d&&(y.children=e.all(d),e.patch(d,y),y=e.applyData(d,y)),c.push(y)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,u),e.applyData(t,u)}function fE(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Vc=9,Uc=32;function pE(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const o=[];for(;r;)o.push($c(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push($c(t.slice(i),i>0,!1)),o.join("")}function $c(e,t,n){let r=0,i=e.length;if(t){let o=e.codePointAt(r);for(;o===Vc||o===Uc;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(i-1);for(;o===Vc||o===Uc;)i--,o=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function hE(e,t){const n={type:"text",value:pE(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function mE(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const gE={blockquote:KO,break:HO,code:JO,delete:WO,emphasis:QO,footnoteReference:GO,heading:XO,html:YO,imageReference:ZO,image:eE,inlineCode:tE,linkReference:nE,link:rE,listItem:iE,list:sE,paragraph:aE,root:lE,strong:uE,table:cE,tableCell:fE,tableRow:dE,text:hE,thematicBreak:mE,toml:Uo,yaml:Uo,definition:Uo,footnoteDefinition:Uo};function Uo(){}const sh=-1,ks=0,Xi=1,fs=2,Kl=3,Hl=4,Jl=5,Wl=6,ah=7,lh=8,qc=typeof self=="object"?self:globalThis,yE=(e,t)=>{const n=(i,o)=>(e.set(o,i),i),r=i=>{if(e.has(i))return e.get(i);const[o,s]=t[i];switch(o){case ks:case sh:return n(s,i);case Xi:{const a=n([],i);for(const l of s)a.push(r(l));return a}case fs:{const a=n({},i);for(const[l,c]of s)a[r(l)]=r(c);return a}case Kl:return n(new Date(s),i);case Hl:{const{source:a,flags:l}=s;return n(new RegExp(a,l),i)}case Jl:{const a=n(new Map,i);for(const[l,c]of s)a.set(r(l),r(c));return a}case Wl:{const a=n(new Set,i);for(const l of s)a.add(r(l));return a}case ah:{const{name:a,message:l}=s;return n(new qc[a](l),i)}case lh:return n(BigInt(s),i);case"BigInt":return n(Object(BigInt(s)),i);case"ArrayBuffer":return n(new Uint8Array(s).buffer,s);case"DataView":{const{buffer:a}=new Uint8Array(s);return n(new DataView(a),s)}}return n(new qc[o](s),i)};return r},zc=e=>yE(new Map,e)(0),Yr="",{toString:vE}={},{keys:wE}=Object,zi=e=>{const t=typeof e;if(t!=="object"||!e)return[ks,t];const n=vE.call(e).slice(8,-1);switch(n){case"Array":return[Xi,Yr];case"Object":return[fs,Yr];case"Date":return[Kl,Yr];case"RegExp":return[Hl,Yr];case"Map":return[Jl,Yr];case"Set":return[Wl,Yr];case"DataView":return[Xi,n]}return n.includes("Array")?[Xi,n]:n.includes("Error")?[ah,n]:[fs,n]},$o=([e,t])=>e===ks&&(t==="function"||t==="symbol"),bE=(e,t,n,r)=>{const i=(s,a)=>{const l=r.push(s)-1;return n.set(a,l),l},o=s=>{if(n.has(s))return n.get(s);let[a,l]=zi(s);switch(a){case ks:{let u=s;switch(l){case"bigint":a=lh,u=s.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return i([sh],s)}return i([a,u],s)}case Xi:{if(l){let h=s;return l==="DataView"?h=new Uint8Array(s.buffer):l==="ArrayBuffer"&&(h=new Uint8Array(s)),i([l,[...h]],s)}const u=[],d=i([a,u],s);for(const h of s)u.push(o(h));return d}case fs:{if(l)switch(l){case"BigInt":return i([l,s.toString()],s);case"Boolean":case"Number":case"String":return i([l,s.valueOf()],s)}if(t&&"toJSON"in s)return o(s.toJSON());const u=[],d=i([a,u],s);for(const h of wE(s))(e||!$o(zi(s[h])))&&u.push([o(h),o(s[h])]);return d}case Kl:return i([a,s.toISOString()],s);case Hl:{const{source:u,flags:d}=s;return i([a,{source:u,flags:d}],s)}case Jl:{const u=[],d=i([a,u],s);for(const[h,f]of s)(e||!($o(zi(h))||$o(zi(f))))&&u.push([o(h),o(f)]);return d}case Wl:{const u=[],d=i([a,u],s);for(const h of s)(e||!$o(zi(h)))&&u.push(o(h));return d}}const{message:c}=s;return i([a,{name:l,message:c}],s)};return o},Kc=(e,{json:t,lossy:n}={})=>{const r=[];return bE(!(t||n),!!t,new Map,r)(e),r},ps=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?zc(Kc(e,t)):structuredClone(e):(e,t)=>zc(Kc(e,t));function xE(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function IE(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function CE(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||xE,r=e.options.footnoteBackLabel||IE,i=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",s=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[l]);if(!c)continue;const u=e.all(c),d=String(c.identifier).toUpperCase(),h=Fi(d.toLowerCase());let f=0;const y=[],m=e.footnoteCounts.get(d);for(;m!==void 0&&++f<=m;){y.length>0&&y.push({type:"text",value:" "});let g=typeof n=="string"?n:n(l,f);typeof g=="string"&&(g={type:"text",value:g}),y.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,f),className:["data-footnote-backref"]},children:Array.isArray(g)?g:[g]})}const v=u[u.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const g=v.children[v.children.length-1];g&&g.type==="text"?g.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...y)}else u.push(...y);const b={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(u,!0)};e.patch(c,b),a.push(b)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...ps(s),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
18
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
19
+ `}]}}const uh=function(e){if(e==null)return _E;if(typeof e=="function")return As(e);if(typeof e=="object")return Array.isArray(e)?SE(e):OE(e);if(typeof e=="string")return EE(e);throw new Error("Expected function, string, or object as test")};function SE(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=uh(e[n]);return As(r);function r(...i){let o=-1;for(;++o<t.length;)if(t[o].apply(this,i))return!0;return!1}}function OE(e){const t=e;return As(n);function n(r){const i=r;let o;for(o in e)if(i[o]!==t[o])return!1;return!0}}function EE(e){return As(t);function t(n){return n&&n.type===e}}function As(e){return t;function t(n,r,i){return!!(TE(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function _E(){return!0}function TE(e){return e!==null&&typeof e=="object"&&"type"in e}const ch=[],NE=!0,Hc=!1,kE="skip";function AE(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const o=uh(i),s=r?-1:1;a(e,void 0,[])();function a(l,c,u){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const f=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return h;function h(){let f=ch,y,m,v;if((!t||o(l,c,u[u.length-1]||void 0))&&(f=RE(n(l,u)),f[0]===Hc))return f;if("children"in l&&l.children){const b=l;if(b.children&&f[0]!==kE)for(m=(r?b.children.length:-1)+s,v=u.concat(b);m>-1&&m<b.children.length;){const g=b.children[m];if(y=a(g,m,v)(),y[0]===Hc)return y;m=typeof y[1]=="number"?y[1]:m+s}}return f}}}function RE(e){return Array.isArray(e)?e:typeof e=="number"?[NE,e]:e==null?ch:[e]}function dh(e,t,n,r){let i,o,s;typeof t=="function"&&typeof n!="function"?(o=void 0,s=t,i=n):(o=t,s=n,i=r),AE(e,o,a,i);function a(l,c){const u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return s(l,d,u)}}const nl={}.hasOwnProperty,PE={};function FE(e,t){const n=t||PE,r=new Map,i=new Map,o=new Map,s={...gE,...n.handlers},a={all:c,applyData:ME,definitionById:r,footnoteById:i,footnoteCounts:o,footnoteOrder:[],handlers:s,one:l,options:n,patch:DE,wrap:jE};return dh(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const d=u.type==="definition"?r:i,h=String(u.identifier).toUpperCase();d.has(h)||d.set(h,u)}}),a;function l(u,d){const h=u.type,f=a.handlers[h];if(nl.call(a.handlers,h)&&f)return f(a,u,d);if(a.options.passThrough&&a.options.passThrough.includes(h)){if("children"in u){const{children:m,...v}=u,b=ps(v);return b.children=a.all(u),b}return ps(u)}return(a.options.unknownHandler||LE)(a,u,d)}function c(u){const d=[];if("children"in u){const h=u.children;let f=-1;for(;++f<h.length;){const y=a.one(h[f],u);if(y){if(f&&h[f-1].type==="break"&&(!Array.isArray(y)&&y.type==="text"&&(y.value=Jc(y.value)),!Array.isArray(y)&&y.type==="element")){const m=y.children[0];m&&m.type==="text"&&(m.value=Jc(m.value))}Array.isArray(y)?d.push(...y):d.push(y)}}}return d}}function DE(e,t){e.position&&(t.position=v0(e))}function ME(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,o=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const s="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:s}}n.type==="element"&&o&&Object.assign(n.properties,ps(o)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function LE(e,t){const n=t.data||{},r="value"in t&&!(nl.call(n,"hProperties")||nl.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function jE(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
20
+ `});++r<e.length;)r&&n.push({type:"text",value:`
21
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
22
+ `}),n}function Jc(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Wc(e,t){const n=FE(e,t),r=n.one(e,void 0),i=CE(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:`
23
+ `},i),o}function BE(e,t){return e&&"run"in e?async function(n,r){const i=Wc(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Wc(n,{file:r,...e||t})}}function Qc(e){if(e)throw e}var Zo=Object.prototype.hasOwnProperty,fh=Object.prototype.toString,Gc=Object.defineProperty,Xc=Object.getOwnPropertyDescriptor,Yc=function(t){return typeof Array.isArray=="function"?Array.isArray(t):fh.call(t)==="[object Array]"},Zc=function(t){if(!t||fh.call(t)!=="[object Object]")return!1;var n=Zo.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Zo.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||Zo.call(t,i)},ed=function(t,n){Gc&&n.name==="__proto__"?Gc(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},td=function(t,n){if(n==="__proto__")if(Zo.call(t,n)){if(Xc)return Xc(t,n).value}else return;return t[n]},VE=function e(){var t,n,r,i,o,s,a=arguments[0],l=1,c=arguments.length,u=!1;for(typeof a=="boolean"&&(u=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});l<c;++l)if(t=arguments[l],t!=null)for(n in t)r=td(a,n),i=td(t,n),a!==i&&(u&&i&&(Zc(i)||(o=Yc(i)))?(o?(o=!1,s=r&&Yc(r)?r:[]):s=r&&Zc(r)?r:{},ed(a,{name:n,newValue:e(u,s,i)})):typeof i<"u"&&ed(a,{name:n,newValue:i}));return a};const oa=Ni(VE);function rl(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function UE(){const e=[],t={run:n,use:r};return t;function n(...i){let o=-1;const s=i.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);a(null,...i);function a(l,...c){const u=e[++o];let d=-1;if(l){s(l);return}for(;++d<i.length;)(c[d]===null||c[d]===void 0)&&(c[d]=i[d]);i=c,u?$E(u,a)(...c):s(null,...c)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function $E(e,t){let n;return r;function r(...s){const a=e.length>s.length;let l;a&&s.push(i);try{l=e.apply(this,s)}catch(c){const u=c;if(a&&n)throw u;return i(u)}a||(l&&l.then&&typeof l.then=="function"?l.then(o,i):l instanceof Error?i(l):o(l))}function i(s,...a){n||(n=!0,t(s,...a))}function o(s){i(null,s)}}const xn={basename:qE,dirname:zE,extname:KE,join:HE,sep:"/"};function qE(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');wo(e);let n=0,r=-1,i=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,a=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else s<0&&(o=!0,s=i+1),a>-1&&(e.codePointAt(i)===t.codePointAt(a--)?a<0&&(r=i):(a=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function zE(e){if(wo(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function KE(e){wo(e);let t=e.length,n=-1,r=0,i=-1,o=0,s;for(;t--;){const a=e.codePointAt(t);if(a===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),a===46?i<0?i=t:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function HE(...e){let t=-1,n;for(;++t<e.length;)wo(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":JE(n)}function JE(e){wo(e);const t=e.codePointAt(0)===47;let n=WE(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function WE(e,t){let n="",r=0,i=-1,o=0,s=-1,a,l;for(;++s<=e.length;){if(s<e.length)a=e.codePointAt(s);else{if(a===47)break;a=47}if(a===47){if(!(i===s-1||o===1))if(i!==s-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=s,o=0;continue}}else if(n.length>0){n="",r=0,i=s,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,o=0}else a===46&&o>-1?o++:o=-1}return n}function wo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const QE={cwd:GE};function GE(){return"/"}function il(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function XE(e){if(typeof e=="string")e=new URL(e);else if(!il(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return YE(e)}function YE(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const sa=["history","path","basename","stem","extname","dirname"];class ph{constructor(t){let n;t?il(t)?n={path:t}:typeof t=="string"||ZE(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":QE.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<sa.length;){const o=sa[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let i;for(i in n)sa.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?xn.basename(this.path):void 0}set basename(t){la(t,"basename"),aa(t,"basename"),this.path=xn.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?xn.dirname(this.path):void 0}set dirname(t){nd(this.basename,"dirname"),this.path=xn.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?xn.extname(this.path):void 0}set extname(t){if(aa(t,"extname"),nd(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=xn.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){il(t)&&(t=XE(t)),la(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?xn.basename(this.path,this.extname):void 0}set stem(t){la(t,"stem"),aa(t,"stem"),this.path=xn.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new Et(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function aa(e,t){if(e&&e.includes(xn.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+xn.sep+"`")}function la(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function nd(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function ZE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const e1=function(e){const r=this.constructor.prototype,i=r[e],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,r),o},t1={}.hasOwnProperty;class Ql extends e1{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=UE()}copy(){const t=new Ql;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(oa(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(da("data",this.frozen),this.namespace[t]=n,this):t1.call(this.namespace,t)&&this.namespace[t]||void 0:t?(da("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=qo(t),r=this.parser||this.Parser;return ua("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),ua("process",this.parser||this.Parser),ca("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(o,s){const a=qo(t),l=r.parse(a);r.run(l,a,function(u,d,h){if(u||!d||!h)return c(u);const f=d,y=r.stringify(f,h);i1(y)?h.value=y:h.result=y,c(u,h)});function c(u,d){u||!d?s(u):o?o(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),ua("processSync",this.parser||this.Parser),ca("processSync",this.compiler||this.Compiler),this.process(t,i),id("processSync","process",n),r;function i(o,s){n=!0,Qc(o),r=s}}run(t,n,r){rd(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(s,a){const l=qo(n);i.run(t,l,c);function c(u,d,h){const f=d||t;u?a(u):s?s(f):r(void 0,f,h)}}}runSync(t,n){let r=!1,i;return this.run(t,n,o),id("runSync","run",r),i;function o(s,a){Qc(s),i=a,r=!0}}stringify(t,n){this.freeze();const r=qo(n),i=this.compiler||this.Compiler;return ca("stringify",i),rd(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(da("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...d]=c;l(u,d)}else s(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function s(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(i.settings=oa(!0,i.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const d=c[u];o(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let d=-1,h=-1;for(;++d<r.length;)if(r[d][0]===c){h=d;break}if(h===-1)r.push([c,...u]);else if(u.length>0){let[f,...y]=u;const m=r[h][1];rl(m)&&rl(f)&&(f=oa(!0,m,f)),r[h]=[c,f,...y]}}}}const n1=new Ql().freeze();function ua(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ca(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function da(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function rd(e){if(!rl(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function id(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function qo(e){return r1(e)?e:new ph(e)}function r1(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function i1(e){return typeof e=="string"||o1(e)}function o1(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const s1="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",od=[],sd={allowDangerousHtml:!0},a1=/^(https?|ircs?|mailto|xmpp)$/i,l1=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function u1(e){const t=c1(e),n=d1(e);return f1(t.runSync(t.parse(n),n),e)}function c1(e){const t=e.rehypePlugins||od,n=e.remarkPlugins||od,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...sd}:sd;return n1().use(zO).use(n).use(BE,r).use(t)}function d1(e){const t=e.children||"",n=new ph;return typeof t=="string"&&(n.value=t),n}function f1(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,o=t.disallowedElements,s=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||p1;for(const u of l1)Object.hasOwn(t,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+s1+u.id,void 0);return dh(e,c),C0(e,{Fragment:p.Fragment,components:i,ignoreInvalidStyle:!0,jsx:p.jsx,jsxs:p.jsxs,passKeys:!0,passNode:!0});function c(u,d,h){if(u.type==="raw"&&h&&typeof d=="number")return s?h.children.splice(d,1):h.children[d]={type:"text",value:u.value},d;if(u.type==="element"){let f;for(f in na)if(Object.hasOwn(na,f)&&Object.hasOwn(u.properties,f)){const y=u.properties[f],m=na[f];(m===null||m.includes(u.tagName))&&(u.properties[f]=l(String(y||""),f,u))}}if(u.type==="element"){let f=n?!n.includes(u.tagName):o?o.includes(u.tagName):!1;if(!f&&r&&typeof d=="number"&&(f=!r(u,d,h)),f&&h&&typeof d=="number")return a&&u.children?h.children.splice(d,1,...u.children):h.children.splice(d,1),d}}}function p1(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||a1.test(e.slice(0,t))?e:""}const h1="_container_r1dnc_1",m1="_code_r1dnc_9",ad={container:h1,code:m1};function g1({prompt:e}){return p.jsx("div",{className:ad.container,children:p.jsx(u1,{components:{p:({children:t})=>p.jsx(p.Fragment,{children:t}),code:({children:t})=>p.jsx("code",{className:ad.code,children:t})},children:e})})}function Gl({url:e,providerDisplayName:t,credentialName:n,prompt:r}){return p.jsxs("div",{style:{marginBottom:"0.5rem"},children:[p.jsxs("p",{style:{color:"var(--amp-colors-text-muted)",marginBottom:r?"0.25rem":"0rem",lineHeight:"1.5"},children:[p.jsx(Fl,{href:e,newTab:!0,children:p.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," ","about where to find your ",t," ",n,"."]}),r&&p.jsx(g1,{prompt:r})]})}const bi=Math.min,Br=Math.max,hs=Math.round,zo=Math.floor,hr=e=>({x:e,y:e}),y1={left:"right",right:"left",bottom:"top",top:"bottom"},v1={start:"end",end:"start"};function ol(e,t,n){return Br(e,bi(t,n))}function bo(e,t){return typeof e=="function"?e(t):e}function zr(e){return e.split("-")[0]}function xo(e){return e.split("-")[1]}function hh(e){return e==="x"?"y":"x"}function Xl(e){return e==="y"?"height":"width"}function xi(e){return["top","bottom"].includes(zr(e))?"y":"x"}function Yl(e){return hh(xi(e))}function w1(e,t,n){n===void 0&&(n=!1);const r=xo(e),i=Yl(e),o=Xl(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=ms(s)),[s,ms(s)]}function b1(e){const t=ms(e);return[sl(e),t,sl(t)]}function sl(e){return e.replace(/start|end/g,t=>v1[t])}function x1(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 I1(e,t,n,r){const i=xo(e);let o=x1(zr(e),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(sl)))),o}function ms(e){return e.replace(/left|right|bottom|top/g,t=>y1[t])}function C1(e){return{top:0,right:0,bottom:0,left:0,...e}}function mh(e){return typeof e!="number"?C1(e):{top:e,right:e,bottom:e,left:e}}function gs(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 ld(e,t,n){let{reference:r,floating:i}=e;const o=xi(t),s=Yl(t),a=Xl(s),l=zr(t),c=o==="y",u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let f;switch(l){case"top":f={x:u,y:r.y-i.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-i.width,y:d};break;default:f={x:r.x,y:r.y}}switch(xo(t)){case"start":f[s]-=h*(n&&c?-1:1);break;case"end":f[s]+=h*(n&&c?-1:1);break}return f}const S1=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ld(c,r,l),h=r,f={},y=0;for(let m=0;m<a.length;m++){const{name:v,fn:b}=a[m],{x:g,y:w,data:x,reset:O}=await b({x:u,y:d,initialPlacement:r,placement:h,strategy:i,middlewareData:f,rects:c,platform:s,elements:{reference:e,floating:t}});u=g??u,d=w??d,f={...f,[v]:{...f[v],...x}},O&&y<=50&&(y++,typeof O=="object"&&(O.placement&&(h=O.placement),O.rects&&(c=O.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):O.rects),{x:u,y:d}=ld(c,h,l)),m=-1)}return{x:u,y:d,placement:h,strategy:i,middlewareData:f}};async function gh(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:f=0}=bo(t,e),y=mh(f),v=a[h?d==="floating"?"reference":"floating":d],b=gs(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(v)))==null||n?v:v.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),g=d==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,w=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),x=await(o.isElement==null?void 0:o.isElement(w))?await(o.getScale==null?void 0:o.getScale(w))||{x:1,y:1}:{x:1,y:1},O=gs(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:g,offsetParent:w,strategy:l}):g);return{top:(b.top-O.top+y.top)/x.y,bottom:(O.bottom-b.bottom+y.bottom)/x.y,left:(b.left-O.left+y.left)/x.x,right:(O.right-b.right+y.right)/x.x}}const O1=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=bo(e,t)||{};if(c==null)return{};const d=mh(u),h={x:n,y:r},f=Yl(i),y=Xl(f),m=await s.getDimensions(c),v=f==="y",b=v?"top":"left",g=v?"bottom":"right",w=v?"clientHeight":"clientWidth",x=o.reference[y]+o.reference[f]-h[f]-o.floating[y],O=h[f]-o.reference[f],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let D=E?E[w]:0;(!D||!await(s.isElement==null?void 0:s.isElement(E)))&&(D=a.floating[w]||o.floating[y]);const N=x/2-O/2,M=D/2-m[y]/2-1,R=bi(d[b],M),P=bi(d[g],M),F=R,U=D-m[y]-P,B=D/2-m[y]/2+N,X=ol(F,B,U),se=!l.arrow&&xo(i)!=null&&B!==X&&o.reference[y]/2-(B<F?R:P)-m[y]/2<0,ce=se?B<F?B-F:B-U:0;return{[f]:h[f]+ce,data:{[f]:X,centerOffset:B-X-ce,...se&&{alignmentOffset:ce}},reset:se}}}),E1=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:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:m=!0,...v}=bo(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const b=zr(i),g=xi(a),w=zr(a)===a,x=await(l.isRTL==null?void 0:l.isRTL(c.floating)),O=h||(w||!m?[ms(a)]:b1(a)),E=y!=="none";!h&&E&&O.push(...I1(a,m,y,x));const D=[a,...O],N=await gh(t,v),M=[];let R=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&M.push(N[b]),d){const B=w1(i,s,x);M.push(N[B[0]],N[B[1]])}if(R=[...R,{placement:i,overflows:M}],!M.every(B=>B<=0)){var P,F;const B=(((P=o.flip)==null?void 0:P.index)||0)+1,X=D[B];if(X)return{data:{index:B,overflows:R},reset:{placement:X}};let se=(F=R.filter(ce=>ce.overflows[0]<=0).sort((ce,ge)=>ce.overflows[1]-ge.overflows[1])[0])==null?void 0:F.placement;if(!se)switch(f){case"bestFit":{var U;const ce=(U=R.filter(ge=>{if(E){const we=xi(ge.placement);return we===g||we==="y"}return!0}).map(ge=>[ge.placement,ge.overflows.filter(we=>we>0).reduce((we,I)=>we+I,0)]).sort((ge,we)=>ge[1]-we[1])[0])==null?void 0:U[0];ce&&(se=ce);break}case"initialPlacement":se=a;break}if(i!==se)return{reset:{placement:se}}}return{}}}};async function _1(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=zr(n),a=xo(n),l=xi(n)==="y",c=["left","top"].includes(s)?-1:1,u=o&&l?-1:1,d=bo(t,e);let{mainAxis:h,crossAxis:f,alignmentAxis:y}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof y=="number"&&(f=a==="end"?y*-1:y),l?{x:f*u,y:h*c}:{x:h*c,y:f*u}}const T1=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,l=await _1(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},N1=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:v=>{let{x:b,y:g}=v;return{x:b,y:g}}},...l}=bo(e,t),c={x:n,y:r},u=await gh(t,l),d=xi(zr(i)),h=hh(d);let f=c[h],y=c[d];if(o){const v=h==="y"?"top":"left",b=h==="y"?"bottom":"right",g=f+u[v],w=f-u[b];f=ol(g,f,w)}if(s){const v=d==="y"?"top":"left",b=d==="y"?"bottom":"right",g=y+u[v],w=y-u[b];y=ol(g,y,w)}const m=a.fn({...t,[h]:f,[d]:y});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[h]:o,[d]:s}}}}}};function Rs(){return typeof window<"u"}function Di(e){return yh(e)?(e.nodeName||"").toLowerCase():"#document"}function Wt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Fn(e){var t;return(t=(yh(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function yh(e){return Rs()?e instanceof Node||e instanceof Wt(e).Node:!1}function gn(e){return Rs()?e instanceof Element||e instanceof Wt(e).Element:!1}function kn(e){return Rs()?e instanceof HTMLElement||e instanceof Wt(e).HTMLElement:!1}function ud(e){return!Rs()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Wt(e).ShadowRoot}function Io(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=yn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function k1(e){return["table","td","th"].includes(Di(e))}function Ps(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Zl(e){const t=eu(),n=gn(e)?yn(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 A1(e){let t=mr(e);for(;kn(t)&&!Ii(t);){if(Zl(t))return t;if(Ps(t))return null;t=mr(t)}return null}function eu(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ii(e){return["html","body","#document"].includes(Di(e))}function yn(e){return Wt(e).getComputedStyle(e)}function Fs(e){return gn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function mr(e){if(Di(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ud(e)&&e.host||Fn(e);return ud(t)?t.host:t}function vh(e){const t=mr(e);return Ii(t)?e.ownerDocument?e.ownerDocument.body:e.body:kn(t)&&Io(t)?t:vh(t)}function so(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=vh(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),s=Wt(i);if(o){const a=al(s);return t.concat(s,s.visualViewport||[],Io(i)?i:[],a&&n?so(a):[])}return t.concat(i,so(i,[],n))}function al(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function wh(e){const t=yn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=kn(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=hs(n)!==o||hs(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function tu(e){return gn(e)?e:e.contextElement}function ri(e){const t=tu(e);if(!kn(t))return hr(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=wh(t);let s=(o?hs(n.width):n.width)/r,a=(o?hs(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const R1=hr(0);function bh(e){const t=Wt(e);return!eu()||!t.visualViewport?R1:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function P1(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Wt(e)?!1:t}function Kr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=tu(e);let s=hr(1);t&&(r?gn(r)&&(s=ri(r)):s=ri(e));const a=P1(o,n,r)?bh(o):hr(0);let l=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,u=i.width/s.x,d=i.height/s.y;if(o){const h=Wt(o),f=r&&gn(r)?Wt(r):r;let y=h,m=al(y);for(;m&&r&&f!==y;){const v=ri(m),b=m.getBoundingClientRect(),g=yn(m),w=b.left+(m.clientLeft+parseFloat(g.paddingLeft))*v.x,x=b.top+(m.clientTop+parseFloat(g.paddingTop))*v.y;l*=v.x,c*=v.y,u*=v.x,d*=v.y,l+=w,c+=x,y=Wt(m),m=al(y)}}return gs({width:u,height:d,x:l,y:c})}function F1(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",s=Fn(r),a=t?Ps(t.floating):!1;if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=hr(1);const u=hr(0),d=kn(r);if((d||!d&&!o)&&((Di(r)!=="body"||Io(s))&&(l=Fs(r)),kn(r))){const h=Kr(r);c=ri(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x,y:n.y*c.y-l.scrollTop*c.y+u.y}}function D1(e){return Array.from(e.getClientRects())}function ll(e,t){const n=Fs(e).scrollLeft;return t?t.left+n:Kr(Fn(e)).left+n}function M1(e){const t=Fn(e),n=Fs(e),r=e.ownerDocument.body,i=Br(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Br(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+ll(e);const a=-n.scrollTop;return yn(r).direction==="rtl"&&(s+=Br(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function L1(e,t){const n=Wt(e),r=Fn(e),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const c=eu();(!c||c&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a,y:l}}function j1(e,t){const n=Kr(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=kn(e)?ri(e):hr(1),s=e.clientWidth*o.x,a=e.clientHeight*o.y,l=i*o.x,c=r*o.y;return{width:s,height:a,x:l,y:c}}function cd(e,t,n){let r;if(t==="viewport")r=L1(e,n);else if(t==="document")r=M1(Fn(e));else if(gn(t))r=j1(t,n);else{const i=bh(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return gs(r)}function xh(e,t){const n=mr(e);return n===t||!gn(n)||Ii(n)?!1:yn(n).position==="fixed"||xh(n,t)}function B1(e,t){const n=t.get(e);if(n)return n;let r=so(e,[],!1).filter(a=>gn(a)&&Di(a)!=="body"),i=null;const o=yn(e).position==="fixed";let s=o?mr(e):e;for(;gn(s)&&!Ii(s);){const a=yn(s),l=Zl(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Io(s)&&!l&&xh(e,s))?r=r.filter(u=>u!==s):i=a,s=mr(s)}return t.set(e,r),r}function V1(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?Ps(t)?[]:B1(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const d=cd(t,u,i);return c.top=Br(d.top,c.top),c.right=bi(d.right,c.right),c.bottom=bi(d.bottom,c.bottom),c.left=Br(d.left,c.left),c},cd(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function U1(e){const{width:t,height:n}=wh(e);return{width:t,height:n}}function $1(e,t,n){const r=kn(t),i=Fn(t),o=n==="fixed",s=Kr(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=hr(0);if(r||!r&&!o)if((Di(t)!=="body"||Io(i))&&(a=Fs(t)),r){const f=Kr(t,!0,o,t);l.x=f.x+t.clientLeft,l.y=f.y+t.clientTop}else i&&(l.x=ll(i));let c=0,u=0;if(i&&!r&&!o){const f=i.getBoundingClientRect();u=f.top+a.scrollTop,c=f.left+a.scrollLeft-ll(i,f)}const d=s.left+a.scrollLeft-l.x-c,h=s.top+a.scrollTop-l.y-u;return{x:d,y:h,width:s.width,height:s.height}}function fa(e){return yn(e).position==="static"}function dd(e,t){if(!kn(e)||yn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Fn(e)===n&&(n=n.ownerDocument.body),n}function Ih(e,t){const n=Wt(e);if(Ps(e))return n;if(!kn(e)){let i=mr(e);for(;i&&!Ii(i);){if(gn(i)&&!fa(i))return i;i=mr(i)}return n}let r=dd(e,t);for(;r&&k1(r)&&fa(r);)r=dd(r,t);return r&&Ii(r)&&fa(r)&&!Zl(r)?n:r||A1(e)||n}const q1=async function(e){const t=this.getOffsetParent||Ih,n=this.getDimensions,r=await n(e.floating);return{reference:$1(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function z1(e){return yn(e).direction==="rtl"}const K1={convertOffsetParentRelativeRectToViewportRelativeRect:F1,getDocumentElement:Fn,getClippingRect:V1,getOffsetParent:Ih,getElementRects:q1,getClientRects:D1,getDimensions:U1,getScale:ri,isElement:gn,isRTL:z1};function H1(e,t){let n=null,r;const i=Fn(e);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const{left:c,top:u,width:d,height:h}=e.getBoundingClientRect();if(a||t(),!d||!h)return;const f=zo(u),y=zo(i.clientWidth-(c+d)),m=zo(i.clientHeight-(u+h)),v=zo(c),g={rootMargin:-f+"px "+-y+"px "+-m+"px "+-v+"px",threshold:Br(0,bi(1,l))||1};let w=!0;function x(O){const E=O[0].intersectionRatio;if(E!==l){if(!w)return s();E?s(!1,E):r=setTimeout(()=>{s(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(x,{...g,root:i.ownerDocument})}catch{n=new IntersectionObserver(x,g)}n.observe(e)}return s(!0),o}function J1(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:l=!1}=r,c=tu(e),u=i||o?[...c?so(c):[],...so(t)]:[];u.forEach(b=>{i&&b.addEventListener("scroll",n,{passive:!0}),o&&b.addEventListener("resize",n)});const d=c&&a?H1(c,n):null;let h=-1,f=null;s&&(f=new ResizeObserver(b=>{let[g]=b;g&&g.target===c&&f&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=f)==null||w.observe(t)})),n()}),c&&!l&&f.observe(c),f.observe(t));let y,m=l?Kr(e):null;l&&v();function v(){const b=Kr(e);m&&(b.x!==m.x||b.y!==m.y||b.width!==m.width||b.height!==m.height)&&n(),m=b,y=requestAnimationFrame(v)}return n(),()=>{var b;u.forEach(g=>{i&&g.removeEventListener("scroll",n),o&&g.removeEventListener("resize",n)}),d==null||d(),(b=f)==null||b.disconnect(),f=null,l&&cancelAnimationFrame(y)}}const W1=T1,Q1=N1,G1=E1,X1=O1,fd=(e,t,n)=>{const r=new Map,i={platform:K1,...n},o={...i.platform,_c:r};return S1(e,t,{...i,platform:o})};/*
24
+ * React Tooltip
25
+ * {@link https://github.com/ReactTooltip/react-tooltip}
26
+ * @copyright ReactTooltip Team
27
+ * @license MIT
28
+ */const Y1="react-tooltip-core-styles",Z1="react-tooltip-base-styles",pd={core:!1,base:!1};function hd({css:e,id:t=Z1,type:n="base",ref:r}){var i,o;if(!e||typeof document>"u"||pd[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=Y1),r||(r={});const{insertAt:s}=r;if(document.getElementById(t))return;const a=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.id=t,l.type="text/css",s==="top"&&a.firstChild?a.insertBefore(l,a.firstChild):a.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e)),pd[n]=!0}const md=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:i=10,strategy:o="absolute",middlewares:s=[W1(Number(i)),G1({fallbackAxisSideDirection:"start"}),Q1({padding:5})],border:a,arrowSize:l=8})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const c=s;return n?(c.push(X1({element:n,padding:5})),fd(e,t,{placement:r,strategy:o,middleware:c}).then(({x:u,y:d,placement:h,middlewareData:f})=>{var y,m;const v={left:`${u}px`,top:`${d}px`,border:a},{x:b,y:g}=(y=f.arrow)!==null&&y!==void 0?y:{x:0,y:0},w=(m={top:"bottom",right:"left",bottom:"top",left:"right"}[h.split("-")[0]])!==null&&m!==void 0?m:"bottom",x=a&&{borderBottom:a,borderRight:a};let O=0;if(a){const E=`${a}`.match(/(\d+)px/);O=E!=null&&E[1]?Number(E[1]):1}return{tooltipStyles:v,tooltipArrowStyles:{left:b!=null?`${b}px`:"",top:g!=null?`${g}px`:"",right:"",bottom:"",...x,[w]:`-${l/2+O}px`},place:h}})):fd(e,t,{placement:"bottom",strategy:o,middleware:c}).then(({x:u,y:d,placement:h})=>({tooltipStyles:{left:`${u}px`,top:`${d}px`},tooltipArrowStyles:{},place:h}))},gd=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),yd=(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},vd=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",ul=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((i,o)=>ul(i,t[o]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!vd(e)||!vd(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(i=>ul(e[i],t[i]))},e_=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"})},wd=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(e_(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},t_=typeof window<"u"?C.useLayoutEffect:C.useEffect,tn=e=>{e.current&&(clearTimeout(e.current),e.current=null)},n_="DEFAULT_TOOLTIP_ID",r_={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},i_=C.createContext({getTooltipData:()=>r_});function Ch(e=n_){return C.useContext(i_).getTooltipData(e)}var Zr={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"},pa={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 o_=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:i="dark",anchorId:o,anchorSelect:s,place:a="top",offset:l=10,events:c=["hover"],openOnClick:u=!1,positionStrategy:d="absolute",middlewares:h,wrapper:f,delayShow:y=0,delayHide:m=0,float:v=!1,hidden:b=!1,noArrow:g=!1,clickable:w=!1,closeOnEsc:x=!1,closeOnScroll:O=!1,closeOnResize:E=!1,openEvents:D,closeEvents:N,globalCloseEvents:M,imperativeModeOnly:R,style:P,position:F,afterShow:U,afterHide:B,disableTooltip:X,content:se,contentWrapperRef:ce,isOpen:ge,defaultIsOpen:we=!1,setIsOpen:I,previousActiveAnchor:J,activeAnchor:V,setActiveAnchor:S,border:z,opacity:$,arrowColor:Y,arrowSize:ne=8,role:te="tooltip"})=>{var ae;const Z=C.useRef(null),ye=C.useRef(null),q=C.useRef(null),be=C.useRef(null),ee=C.useRef(null),[Ke,Be]=C.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[je,et]=C.useState(!1),[at,lt]=C.useState(!1),[Oe,ft]=C.useState(null),_t=C.useRef(!1),mt=C.useRef(null),{anchorRefs:nt,setActiveAnchor:j}=Ch(t),H=C.useRef(!1),[L,oe]=C.useState([]),ue=C.useRef(!1),Je=u||c.includes("click"),Tt=Je||(D==null?void 0:D.click)||(D==null?void 0:D.dblclick)||(D==null?void 0:D.mousedown),gt=D?{...D}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!D&&Je&&Object.assign(gt,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const bt=N?{...N}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!N&&Je&&Object.assign(bt,{mouseleave:!1,blur:!1,mouseout:!1});const Ve=M?{...M}:{escape:x||!1,scroll:O||!1,resize:E||!1,clickOutsideAnchor:Tt||!1};R&&(Object.assign(gt,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(bt,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(Ve,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),t_(()=>(ue.current=!0,()=>{ue.current=!1}),[]);const ke=ie=>{ue.current&&(ie&&lt(!0),setTimeout(()=>{ue.current&&(I==null||I(ie),ge===void 0&&et(ie))},10))};C.useEffect(()=>{if(t){if(je){me(J);const de=ie(V),Ne=[...new Set([...de,t])].filter(Boolean).join(" ");V==null||V.setAttribute("aria-describedby",Ne)}else me(V);return()=>{me(V),me(J)}}function ie(de){var Ne;return((Ne=de==null?void 0:de.getAttribute("aria-describedby"))===null||Ne===void 0?void 0:Ne.split(" "))||[]}function me(de){const Ne=ie(de).filter(Ue=>Ue!==t);Ne.length?de==null||de.setAttribute("aria-describedby",Ne.join(" ")):de==null||de.removeAttribute("aria-describedby")}},[V,je,t,J]),C.useEffect(()=>{if(ge===void 0)return()=>null;ge&&lt(!0);const ie=setTimeout(()=>{et(ge)},10);return()=>{clearTimeout(ie)}},[ge]),C.useEffect(()=>{if(je!==_t.current)if(tn(ee),_t.current=je,je)U==null||U();else{const ie=(me=>{const de=me.match(/^([\d.]+)(ms|s)$/);if(!de)return 0;const[,Ne,Ue]=de;return Number(Ne)*(Ue==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));ee.current=setTimeout(()=>{lt(!1),ft(null),B==null||B()},ie+25)}},[je]);const Nt=ie=>{Be(me=>ul(me,ie)?me:ie)},yt=(ie=y)=>{tn(q),at?ke(!0):q.current=setTimeout(()=>{ke(!0)},ie)},Ft=(ie=m)=>{tn(be),be.current=setTimeout(()=>{H.current||ke(!1)},ie)},Jn=ie=>{var me;if(!ie)return;const de=(me=ie.currentTarget)!==null&&me!==void 0?me:ie.target;if(!(de!=null&&de.isConnected))return S(null),void j({current:null});y?yt():ke(!0),S(de),j({current:de}),tn(be)},Wn=()=>{w?Ft(m||100):m?Ft():ke(!1),tn(q)},Qn=({x:ie,y:me})=>{var de;const Ne={getBoundingClientRect:()=>({x:ie,y:me,width:0,height:0,top:me,left:ie,right:ie,bottom:me})};md({place:(de=Oe==null?void 0:Oe.place)!==null&&de!==void 0?de:a,offset:l,elementReference:Ne,tooltipReference:Z.current,tooltipArrowReference:ye.current,strategy:d,middlewares:h,border:z,arrowSize:ne}).then(Ue=>{Nt(Ue)})},wn=ie=>{if(!ie)return;const me=ie,de={x:me.clientX,y:me.clientY};Qn(de),mt.current=de},ln=ie=>{var me;if(!je)return;const de=ie.target;de.isConnected&&(!((me=Z.current)===null||me===void 0)&&me.contains(de)||[document.querySelector(`[id='${o}']`),...L].some(Ne=>Ne==null?void 0:Ne.contains(de))||(ke(!1),tn(q)))},Gn=yd(Jn,50),We=yd(Wn,50),ut=ie=>{We.cancel(),Gn(ie)},he=()=>{Gn.cancel(),We()},_e=C.useCallback(()=>{var ie,me;const de=(ie=Oe==null?void 0:Oe.position)!==null&&ie!==void 0?ie:F;de?Qn(de):v?mt.current&&Qn(mt.current):V!=null&&V.isConnected&&md({place:(me=Oe==null?void 0:Oe.place)!==null&&me!==void 0?me:a,offset:l,elementReference:V,tooltipReference:Z.current,tooltipArrowReference:ye.current,strategy:d,middlewares:h,border:z,arrowSize:ne}).then(Ne=>{ue.current&&Nt(Ne)})},[je,V,se,P,a,Oe==null?void 0:Oe.place,l,d,F,Oe==null?void 0:Oe.position,v,ne]);C.useEffect(()=>{var ie,me;const de=new Set(nt);L.forEach(Ae=>{X!=null&&X(Ae)||de.add({current:Ae})});const Ne=document.querySelector(`[id='${o}']`);Ne&&!(X!=null&&X(Ne))&&de.add({current:Ne});const Ue=()=>{ke(!1)},Xt=wd(V),Yt=wd(Z.current);Ve.scroll&&(window.addEventListener("scroll",Ue),Xt==null||Xt.addEventListener("scroll",Ue),Yt==null||Yt.addEventListener("scroll",Ue));let vt=null;Ve.resize?window.addEventListener("resize",Ue):V&&Z.current&&(vt=J1(V,Z.current,_e,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const Dt=Ae=>{Ae.key==="Escape"&&ke(!1)};Ve.escape&&window.addEventListener("keydown",Dt),Ve.clickOutsideAnchor&&window.addEventListener("click",ln);const $e=[],xt=Ae=>!!(Ae!=null&&Ae.target&&(V!=null&&V.contains(Ae.target))),qs=Ae=>{je&&xt(Ae)||Jn(Ae)},zs=Ae=>{je&&xt(Ae)&&Wn()},Eo=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],_o=["click","dblclick","mousedown","mouseup"];Object.entries(gt).forEach(([Ae,un])=>{un&&(Eo.includes(Ae)?$e.push({event:Ae,listener:ut}):_o.includes(Ae)&&$e.push({event:Ae,listener:qs}))}),Object.entries(bt).forEach(([Ae,un])=>{un&&(Eo.includes(Ae)?$e.push({event:Ae,listener:he}):_o.includes(Ae)&&$e.push({event:Ae,listener:zs}))}),v&&$e.push({event:"pointermove",listener:wn});const To=()=>{H.current=!0},bn=()=>{H.current=!1,Wn()},No=w&&(bt.mouseout||bt.mouseleave);return No&&((ie=Z.current)===null||ie===void 0||ie.addEventListener("mouseover",To),(me=Z.current)===null||me===void 0||me.addEventListener("mouseout",bn)),$e.forEach(({event:Ae,listener:un})=>{de.forEach(Li=>{var xr;(xr=Li.current)===null||xr===void 0||xr.addEventListener(Ae,un)})}),()=>{var Ae,un;Ve.scroll&&(window.removeEventListener("scroll",Ue),Xt==null||Xt.removeEventListener("scroll",Ue),Yt==null||Yt.removeEventListener("scroll",Ue)),Ve.resize?window.removeEventListener("resize",Ue):vt==null||vt(),Ve.clickOutsideAnchor&&window.removeEventListener("click",ln),Ve.escape&&window.removeEventListener("keydown",Dt),No&&((Ae=Z.current)===null||Ae===void 0||Ae.removeEventListener("mouseover",To),(un=Z.current)===null||un===void 0||un.removeEventListener("mouseout",bn)),$e.forEach(({event:Li,listener:xr})=>{de.forEach(Gr=>{var ji;(ji=Gr.current)===null||ji===void 0||ji.removeEventListener(Li,xr)})})}},[V,_e,at,nt,L,D,N,M,Je,y,m]),C.useEffect(()=>{var ie,me;let de=(me=(ie=Oe==null?void 0:Oe.anchorSelect)!==null&&ie!==void 0?ie:s)!==null&&me!==void 0?me:"";!de&&t&&(de=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Ne=new MutationObserver(Ue=>{const Xt=[],Yt=[];Ue.forEach(vt=>{if(vt.type==="attributes"&&vt.attributeName==="data-tooltip-id"&&(vt.target.getAttribute("data-tooltip-id")===t?Xt.push(vt.target):vt.oldValue===t&&Yt.push(vt.target)),vt.type==="childList"){if(V){const Dt=[...vt.removedNodes].filter($e=>$e.nodeType===1);if(de)try{Yt.push(...Dt.filter($e=>$e.matches(de))),Yt.push(...Dt.flatMap($e=>[...$e.querySelectorAll(de)]))}catch{}Dt.some($e=>{var xt;return!!(!((xt=$e==null?void 0:$e.contains)===null||xt===void 0)&&xt.call($e,V))&&(lt(!1),ke(!1),S(null),tn(q),tn(be),!0)})}if(de)try{const Dt=[...vt.addedNodes].filter($e=>$e.nodeType===1);Xt.push(...Dt.filter($e=>$e.matches(de))),Xt.push(...Dt.flatMap($e=>[...$e.querySelectorAll(de)]))}catch{}}}),(Xt.length||Yt.length)&&oe(vt=>[...vt.filter(Dt=>!Yt.includes(Dt)),...Xt])});return Ne.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{Ne.disconnect()}},[t,s,Oe==null?void 0:Oe.anchorSelect,V]),C.useEffect(()=>{_e()},[_e]),C.useEffect(()=>{if(!(ce!=null&&ce.current))return()=>null;const ie=new ResizeObserver(()=>{setTimeout(()=>_e())});return ie.observe(ce.current),()=>{ie.disconnect()}},[se,ce==null?void 0:ce.current]),C.useEffect(()=>{var ie;const me=document.querySelector(`[id='${o}']`),de=[...L,me];V&&de.includes(V)||S((ie=L[0])!==null&&ie!==void 0?ie:me)},[o,L,V]),C.useEffect(()=>(we&&ke(!0),()=>{tn(q),tn(be)}),[]),C.useEffect(()=>{var ie;let me=(ie=Oe==null?void 0:Oe.anchorSelect)!==null&&ie!==void 0?ie:s;if(!me&&t&&(me=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),me)try{const de=Array.from(document.querySelectorAll(me));oe(de)}catch{oe([])}},[t,s,Oe==null?void 0:Oe.anchorSelect]),C.useEffect(()=>{q.current&&(tn(q),yt(y))},[y]);const kt=(ae=Oe==null?void 0:Oe.content)!==null&&ae!==void 0?ae:se,Dn=je&&Object.keys(Ke.tooltipStyles).length>0;return C.useImperativeHandle(e,()=>({open:ie=>{if(ie!=null&&ie.anchorSelect)try{document.querySelector(ie.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${ie.anchorSelect}" is not a valid CSS selector`)}ft(ie??null),ie!=null&&ie.delay?yt(ie.delay):ke(!0)},close:ie=>{ie!=null&&ie.delay?Ft(ie.delay):ke(!1)},activeAnchor:V,place:Ke.place,isOpen:!!(at&&!b&&kt&&Dn)})),at&&!b&&kt?C.createElement(f,{id:t,role:te,className:an("react-tooltip",Zr.tooltip,pa.tooltip,pa[i],n,`react-tooltip__place-${Ke.place}`,Zr[Dn?"show":"closing"],Dn?"react-tooltip__show":"react-tooltip__closing",d==="fixed"&&Zr.fixed,w&&Zr.clickable),onTransitionEnd:ie=>{tn(ee),je||ie.propertyName!=="opacity"||(lt(!1),ft(null),B==null||B())},style:{...P,...Ke.tooltipStyles,opacity:$!==void 0&&Dn?$:void 0},ref:Z},kt,C.createElement(f,{className:an("react-tooltip-arrow",Zr.arrow,pa.arrow,r,g&&Zr.noArrow),style:{...Ke.tooltipArrowStyles,background:Y?`linear-gradient(to right bottom, transparent 50%, ${Y} 50%)`:void 0,"--rt-arrow-size":`${ne}px`},ref:ye})):null},s_=({content:e})=>C.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),a_=C.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:i,render:o,className:s,classNameArrow:a,variant:l="dark",place:c="top",offset:u=10,wrapper:d="div",children:h=null,events:f=["hover"],openOnClick:y=!1,positionStrategy:m="absolute",middlewares:v,delayShow:b=0,delayHide:g=0,float:w=!1,hidden:x=!1,noArrow:O=!1,clickable:E=!1,closeOnEsc:D=!1,closeOnScroll:N=!1,closeOnResize:M=!1,openEvents:R,closeEvents:P,globalCloseEvents:F,imperativeModeOnly:U=!1,style:B,position:X,isOpen:se,defaultIsOpen:ce=!1,disableStyleInjection:ge=!1,border:we,opacity:I,arrowColor:J,arrowSize:V,setIsOpen:S,afterShow:z,afterHide:$,disableTooltip:Y,role:ne="tooltip"},te)=>{const[ae,Z]=C.useState(r),[ye,q]=C.useState(i),[be,ee]=C.useState(c),[Ke,Be]=C.useState(l),[je,et]=C.useState(u),[at,lt]=C.useState(b),[Oe,ft]=C.useState(g),[_t,mt]=C.useState(w),[nt,j]=C.useState(x),[H,L]=C.useState(d),[oe,ue]=C.useState(f),[Je,Tt]=C.useState(m),[gt,bt]=C.useState(null),[Ve,ke]=C.useState(null),Nt=C.useRef(null),yt=C.useRef(ge),{anchorRefs:Ft,activeAnchor:Jn}=Ch(e),Wn=We=>We==null?void 0:We.getAttributeNames().reduce((ut,he)=>{var _e;return he.startsWith("data-tooltip-")&&(ut[he.replace(/^data-tooltip-/,"")]=(_e=We==null?void 0:We.getAttribute(he))!==null&&_e!==void 0?_e:null),ut},{}),Qn=We=>{const ut={place:he=>{var _e;ee((_e=he)!==null&&_e!==void 0?_e:c)},content:he=>{Z(he??r)},html:he=>{q(he??i)},variant:he=>{var _e;Be((_e=he)!==null&&_e!==void 0?_e:l)},offset:he=>{et(he===null?u:Number(he))},wrapper:he=>{var _e;L((_e=he)!==null&&_e!==void 0?_e:d)},events:he=>{const _e=he==null?void 0:he.split(" ");ue(_e??f)},"position-strategy":he=>{var _e;Tt((_e=he)!==null&&_e!==void 0?_e:m)},"delay-show":he=>{lt(he===null?b:Number(he))},"delay-hide":he=>{ft(he===null?g:Number(he))},float:he=>{mt(he===null?w:he==="true")},hidden:he=>{j(he===null?x:he==="true")},"class-name":he=>{bt(he)}};Object.values(ut).forEach(he=>he(null)),Object.entries(We).forEach(([he,_e])=>{var kt;(kt=ut[he])===null||kt===void 0||kt.call(ut,_e)})};C.useEffect(()=>{Z(r)},[r]),C.useEffect(()=>{q(i)},[i]),C.useEffect(()=>{ee(c)},[c]),C.useEffect(()=>{Be(l)},[l]),C.useEffect(()=>{et(u)},[u]),C.useEffect(()=>{lt(b)},[b]),C.useEffect(()=>{ft(g)},[g]),C.useEffect(()=>{mt(w)},[w]),C.useEffect(()=>{j(x)},[x]),C.useEffect(()=>{Tt(m)},[m]),C.useEffect(()=>{yt.current!==ge&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[ge]),C.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:ge==="core",disableBase:ge}}))},[]),C.useEffect(()=>{var We;const ut=new Set(Ft);let he=n;if(!he&&e&&(he=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),he)try{document.querySelectorAll(he).forEach(me=>{ut.add({current:me})})}catch{console.warn(`[react-tooltip] "${he}" is not a valid CSS selector`)}const _e=document.querySelector(`[id='${t}']`);if(_e&&ut.add({current:_e}),!ut.size)return()=>null;const kt=(We=Ve??_e)!==null&&We!==void 0?We:Jn.current,Dn=new MutationObserver(me=>{me.forEach(de=>{var Ne;if(!kt||de.type!=="attributes"||!(!((Ne=de.attributeName)===null||Ne===void 0)&&Ne.startsWith("data-tooltip-")))return;const Ue=Wn(kt);Qn(Ue)})}),ie={attributes:!0,childList:!1,subtree:!1};if(kt){const me=Wn(kt);Qn(me),Dn.observe(kt,ie)}return()=>{Dn.disconnect()}},[Ft,Jn,Ve,t,n]),C.useEffect(()=>{B!=null&&B.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),we&&!gd("border",`${we}`)&&console.warn(`[react-tooltip] "${we}" is not a valid \`border\`.`),B!=null&&B.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),I&&!gd("opacity",`${I}`)&&console.warn(`[react-tooltip] "${I}" is not a valid \`opacity\`.`)},[]);let wn=h;const ln=C.useRef(null);if(o){const We=o({content:(Ve==null?void 0:Ve.getAttribute("data-tooltip-content"))||ae||null,activeAnchor:Ve});wn=We?C.createElement("div",{ref:ln,className:"react-tooltip-content-wrapper"},We):null}else ae&&(wn=ae);ye&&(wn=C.createElement(s_,{content:ye}));const Gn={forwardRef:te,id:e,anchorId:t,anchorSelect:n,className:an(s,gt),classNameArrow:a,content:wn,contentWrapperRef:ln,place:be,variant:Ke,offset:je,wrapper:H,events:oe,openOnClick:y,positionStrategy:Je,middlewares:v,delayShow:at,delayHide:Oe,float:_t,hidden:nt,noArrow:O,clickable:E,closeOnEsc:D,closeOnScroll:N,closeOnResize:M,openEvents:R,closeEvents:P,globalCloseEvents:F,imperativeModeOnly:U,style:B,position:X,isOpen:se,defaultIsOpen:ce,border:we,opacity:I,arrowColor:J,arrowSize:V,setIsOpen:S,afterShow:z,afterHide:$,disableTooltip:Y,activeAnchor:Ve,previousActiveAnchor:Nt.current,setActiveAnchor:We=>{ke(ut=>(We!=null&&We.isSameNode(ut)||(Nt.current=ut),We))},role:ne};return C.createElement(o_,{...Gn})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||hd({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;--rt-arrow-size:8px}.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;z-index:-1}.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||hd({css:`
29
+ .styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:var(--rt-arrow-size);height:var(--rt-arrow-size)}[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 l_(){return p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[p.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[p.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"}),p.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),p.jsx("defs",{children:p.jsx("clipPath",{id:"clip0_2896_16290",children:p.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function Sh({id:e,tooltipText:t}){return p.jsxs(p.Fragment,{children:[p.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:l_()}),p.jsx(a_,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}function Oh({url:e,prompt:t,inputName:n}){return p.jsx("p",{style:{color:"var(--amp-colors-text-muted)",display:"flex",justifyContent:"space-between"},children:p.jsxs("span",{children:[e?p.jsx(Fl,{href:e,newTab:!0,children:p.jsx("span",{style:{textDecoration:"underline"},children:n})}):p.jsx("span",{children:n})," ",t&&p.jsx(Sh,{id:`docs-helper-text-${$I(n||(t==null?void 0:t.slice(0,50)))}`,tooltipText:t})]})})}const u_="_metadataInputWrapper_1266b_1",c_={metadataInputWrapper:u_};function Co({metadata:e,onChange:t,providerName:n,variant:r="standard"}){return p.jsxs("div",{className:c_.metadataInputWrapper,children:[e.docsURL&&r==="standard"&&p.jsx(Gl,{url:e.docsURL,providerDisplayName:n||"",credentialName:e.displayName||mn(e.name.toLowerCase()),prompt:e.prompt}),r==="header"&&p.jsx(Oh,{url:e.docsURL,prompt:e.prompt,inputName:e.displayName||e.name}),p.jsx(_n.Input,{id:e.name,name:e.name,type:"text",placeholder:e.displayName||e.name,onChange:t})]})}function Ds(e,t){const n={},r=[];if(e.forEach(i=>{const o=t[i.name];!o||o.trim()===""?r.push(i.displayName||i.name):n[i.name]={value:o,source:"input"}}),r.length>0)throw new Error(`Please fill in the following required fields: ${r.join(", ")}.`);return n}function Ci(e,t){return e.every(n=>{const r=t[n.name];return r&&r.trim()!==""})}function d_(e,t){const n=t==null?void 0:t.modules;if(!(n&&Object.keys(n).length>0))return{module:"",error:null};const i=e||t.defaultModule;return i?{module:i,error:null}:{module:"",error:`Could not determine module for provider ${t==null?void 0:t.name}`}}function f_(e,t){if(t==="")return e;const n=t.toLowerCase();return e.filter(r=>r.moduleDependencies?Object.keys(r.moduleDependencies).some(i=>i.toLowerCase()===n):!0)}function Eh({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:i,submitButtonType:o,metadataInputs:s}){var b;const[a,l]=C.useState({apiKey:""}),c=g=>{const{name:w,value:x}=g.currentTarget;l(O=>({...O,[w]:x.trim()}))},{apiKey:u}=a,{providerName:d}=Ot(e),h=u.length>0,f=Ci(s,a),y=r||!h||!f,m=(b=t.apiKeyOpts)==null?void 0:b.docsURL,v=()=>{const g=Ds(s,a);n({apiKey:u,providerMetadata:g})};return p.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[m&&p.jsx(Gl,{url:m,providerDisplayName:d||mn(e),credentialName:"API key"}),p.jsx(_n.PasswordInput,{id:"apiKey",name:"apiKey",placeholder:"API Key",onChange:c}),s.map(g=>p.jsx(Co,{metadata:g,onChange:c,providerName:d||mn(e)},g.name)),p.jsx(ot,{style:{marginTop:"1em",width:"100%"},disabled:y,type:o||"submit",onClick:v,variant:i,children:"Next"})]})}function p_({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i,metadataInputs:o}){const{providerName:s}=Ot(e);return p.jsxs(vr,{children:[p.jsx(wr,{children:`Set up ${s} integration`}),p.jsx(Pn,{error:r}),p.jsx(Eh,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:i||!!r,metadataInputs:o})]})}function h_({...e}){return p.jsx(p_,{...e})}const m_={backgroundColor:"var(--amp-colors-status-success-muted)",borderColor:"var(--amp-colors-status-success-muted)",color:"var(--amp-colors-status-success-dark)",padding:".5rem 1rem"};function Ms({children:e,style:t}){return p.jsx(Kn,{style:{...m_,...t},children:e})}const nu=()=>{const e=Ct(),t=st(),[n,r]=C.useState(null);return{...zn({mutationKey:["updateConnection"],mutationFn:async o=>(await e()).connectionApi.updateConnection(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)}}),errorMsg:n}},g_="_divider_1kmoj_1",bd={divider:g_};function Ls({className:e,style:t}){return p.jsx("hr",{className:e?`${bd.divider} ${e}`:bd.divider,style:t})}function Gt({string:e}){return p.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[p.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),p.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:p.jsx(Ls,{style:{width:"100%",marginLeft:"1rem"}})})]})}function y_({provider:e}){const{projectIdOrName:t}=Ze(),{providerName:n,data:r}=Ot(e),{selectedConnection:i,isConnectionsLoading:o}=Rn(),{mutateAsync:s,isPending:a,error:l}=nu(),[c,u]=C.useState(null),[d,h]=C.useState(!1),f=()=>h(!1),y=()=>{h(!0),u(null)},m=(l==null?void 0:l.message)||c||null,v=async b=>{f(),u(null);try{await s({projectIdOrName:t||"",connectionId:(i==null?void 0:i.id)||"",updateConnectionRequest:{updateMask:["apiKey"],connection:{apiKey:b.apiKey}}},{onError:g=>{console.error("Update connection error:",g),it(g,u)},onSuccess:()=>{y()}})}catch(g){console.error("Update connection caught error:",g),it(g,u)}};return r?p.jsxs(p.Fragment,{children:[p.jsx(Gt,{string:"Update connection"}),p.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[p.jsx("p",{children:`Update ${n} API Key`}),d&&p.jsx(Ms,{children:"Connection updated successfully"}),m&&p.jsx(yo,{children:`Error updating connection ${m}`}),p.jsx(Eh,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:v,isButtonDisabled:a||o,buttonVariant:"ghost",submitButtonType:"button",metadataInputs:[]})]})]}):null}function _h({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:i,metadataInputs:o}){var v;const[s,a]=C.useState({username:"",password:""}),{username:l,password:c}=s,{providerName:u}=Ot(e),d=b=>{const{name:g,value:w}=b.currentTarget;a(x=>({...x,[g]:w.trim()}))},h=Ci(o,s),f=r||!h,y=()=>{const b=Ds(o,s);n({user:l,pass:c,providerMetadata:b})},m=(v=t.basicOpts)==null?void 0:v.docsURL;return p.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[m&&p.jsx(Gl,{url:m,providerDisplayName:u||mn(e),credentialName:"credentials"}),p.jsx(_n.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:d}),p.jsx(_n.PasswordInput,{id:"password",name:"password",placeholder:"Password",onChange:d}),o.map(b=>p.jsx(Co,{metadata:b,onChange:d,providerName:u||mn(e)},b.name)),p.jsx(ot,{style:{marginTop:"1em",width:"100%"},disabled:f,type:"button",onClick:y,variant:i,children:"Next"})]})}function v_({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i,metadataInputs:o}){const{providerName:s}=Ot(e);return p.jsxs(vr,{children:[p.jsx(wr,{children:`Set up ${s} integration`}),p.jsx(Pn,{error:r}),p.jsx(_h,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:i||!!r,metadataInputs:o})]})}function w_({...e}){return p.jsx(v_,{...e})}function b_({provider:e}){const{projectIdOrName:t}=Ze(),{providerName:n,data:r}=Ot(e),{selectedConnection:i,isConnectionsLoading:o}=Rn(),{mutateAsync:s,isPending:a,error:l}=nu(),[c,u]=C.useState(null),[d,h]=C.useState(!1),f=()=>h(!1),y=()=>{h(!0),u(null)},m=(l==null?void 0:l.message)||c||null,v=async b=>{f(),u(null);try{await s({projectIdOrName:t||"",connectionId:(i==null?void 0:i.id)||"",updateConnectionRequest:{updateMask:["basicAuth"],connection:{basicAuth:{username:b.user,password:b.pass}}}},{onError:g=>{console.error(g),it(g,u)},onSuccess:()=>{y()}})}catch(g){console.error(g),it(g,u)}};return r?p.jsxs(p.Fragment,{children:[p.jsx(Gt,{string:"Update connection"}),p.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[p.jsx("p",{children:`Update ${n} credentials`}),d&&p.jsx(Ms,{children:"Connection updated successfully"}),m&&p.jsx(yo,{children:`Error updating connection: ${m}`}),p.jsx(_h,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:v,isButtonDisabled:a||o,buttonVariant:"ghost",metadataInputs:[]})]})]}):null}function Th({handleSubmit:e,isButtonDisabled:t,explicitScopesRequired:n,buttonVariant:r,metadataInputs:i,providerName:o}){const[s,a]=C.useState({clientSecret:"",clientId:"",scopes:""}),[l,c]=C.useState(null),u=w=>{const{name:x,value:O}=w.currentTarget;a(E=>({...E,[x]:O.trim()})),c(null)},{clientSecret:d,clientId:h,scopes:f}=s,y=d.length>0,m=h.length>0,v=Ci(i,s),b=t||!y||!m||!v,g=()=>{const w=Ds(i,s),x={clientId:h,clientSecret:d,providerMetadata:w};n&&f.length>0&&(x.scopes=VI(f)),e(x)};return p.jsxs(p.Fragment,{children:[p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[p.jsx(_n.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:u}),p.jsx(_n.PasswordInput,{id:"clientSecret",name:"clientSecret",placeholder:"Client Secret",onChange:u}),n&&p.jsx(_n.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:u}),i.map(w=>p.jsx(Co,{metadata:w,onChange:u,providerName:o},w.name))]}),p.jsx(Pn,{error:l}),p.jsx("br",{}),p.jsx(ot,{style:{width:"100%"},disabled:b,type:"button",onClick:g,variant:r,children:"Next"})]})}function x_({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,explicitScopesRequired:i,metadataInputs:o}){return p.jsxs(vr,{children:[p.jsx(wr,{children:`Set up ${r} integration`}),p.jsx(Pn,{error:t}),p.jsx("br",{}),p.jsx(Th,{handleSubmit:e,isButtonDisabled:n||!!t,explicitScopesRequired:i,metadataInputs:o,providerName:r})]})}function I_({provider:e}){var g;const{projectIdOrName:t}=Ze(),{selectedConnection:n,isConnectionsLoading:r}=Rn(),{providerName:i,data:o}=Ot(e),{mutateAsync:s,isPending:a,error:l}=nu(),[c,u]=C.useState(null),[d,h]=C.useState(!1),f=()=>{h(!1)},y=()=>{h(!0),u(null)},m=(g=o==null?void 0:o.oauth2Opts)==null?void 0:g.explicitScopesRequired,v=(l==null?void 0:l.message)||c||null,b=async w=>{f(),u(null);try{await s({projectIdOrName:t||"",connectionId:(n==null?void 0:n.id)||"",updateConnectionRequest:{updateMask:["oauth2ClientCredentials"],connection:{oauth2ClientCredentials:{clientId:w.clientId,clientSecret:w.clientSecret,scopes:w.scopes}}}}),y()}catch(x){it(x,u)}};return p.jsxs(p.Fragment,{children:[p.jsx(Gt,{string:"Update connection"}),p.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[p.jsx("p",{children:`Re-authenticate to ${i}`}),d&&p.jsx(Ms,{children:"Connection updated successfully"}),v&&p.jsx(yo,{children:`Error updating connection ${v}`}),p.jsx(Th,{handleSubmit:b,isButtonDisabled:a||r,explicitScopesRequired:m,buttonVariant:"ghost",metadataInputs:[]})]})]})}const xd=600,Id=600,C_="AUTHORIZATION_SUCCEEDED",S_="AUTHORIZATION_FAILED";function O_(e,t,n,r){return C.useCallback(()=>{if(!r)return;const i=window.screenX+(window.outerWidth-xd)/2,o=window.screenY+(window.outerHeight-Id)/2.5,s=`width=${xd},height=${Id},left=${i},top=${o}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function E_(e,t,n,r){const i=st();return C.useCallback(o=>{var s,a;if(o.origin===Xf){if(o.data.eventType===C_){const l=(s=o.data.data)==null?void 0:s.connection;l?(e(l),i.setQueriesData({queryKey:["amp","connections"]},()=>[l]),t==null||t.close(),r==null||r(),i.invalidateQueries({queryKey:["amp","connections"]})):console.error("Connection ID not found in event data: ",{event:o})}o.data.eventType===S_&&(console.error("OAuth failed: ",{event:o}),n==null||n(((a=o==null?void 0:o.data)==null?void 0:a.message)??"Something went wrong. Please try again."))}},[t,n,i,e,r])}function __({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:i,onSuccessConnect:o,isSuccessConnect:s,onWindowClose:a}){const[l,c]=C.useState(null),[u,d]=C.useState(null),h=st(),f=C.useRef(null),y=E_(c,u,r,o),m=O_(n,d,y,t);C.useEffect(()=>{t&&!u&&!l&&!i&&!s&&(r==null||r(null),m())},[t,u,m,l,i,s,r]);const v=C.useCallback(()=>{h.invalidateQueries({queryKey:["amp","connections"]}),d(null),!l&&!i?console.error("Window closed and no connection was found. Please try again."):l&&(r==null||r(null)),a==null||a()},[l,i,r,a,h]);return C.useEffect(()=>{if(u)return f.current=setInterval(()=>{u!=null&&u.closed&&(f.current&&clearInterval(f.current),f.current=null,v())},500),()=>{f.current&&(clearInterval(f.current),f.current=null),window.removeEventListener("message",y)}},[v,u,y]),p.jsx("div",{children:e})}const T_=()=>{const e=Ct(),t=st();return zn({mutationKey:["updateOauthConnection"],mutationFn:async n=>!n.projectIdOrName||!n.connectionId?Promise.reject(new Error("Project ID and connection ID are required")):(await e()).oAuthApi.oauthUpdate(n),onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function N_({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return p.jsxs("div",{style:{padding:"1rem 0"},children:[p.jsx("p",{children:`Re-authenticate to ${r}`}),p.jsx(Pn,{error:t}),p.jsx(ot,{variant:"ghost",style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function k_({provider:e}){const{selectedConnection:t,isConnectionsLoading:n}=Rn(),r=t==null?void 0:t.id,i=t==null?void 0:t.projectId,{providerName:o}=Ot(e),{mutateAsync:s,isPending:a,error:l}=T_(),[c,u]=C.useState(null),[d,h]=C.useState(!1),[f,y]=C.useState(null),m=()=>{h(!1)},v=()=>{h(!0),u(null),y(null)},b=(l==null?void 0:l.message)||c||null,g=async()=>{m(),u(null);try{const x=await s({projectIdOrName:i||"",connectionId:r||""});y(x)}catch(x){it(x,u)}},w=C.useCallback(x=>{u(x)},[]);return p.jsxs(p.Fragment,{children:[p.jsx(Gt,{string:"Update connection"}),d&&p.jsx(Ms,{children:"Connection updated successfully"}),p.jsx(__,{windowTitle:`Connect to ${o}`,oauthUrl:f||null,onError:w,error:b,isSuccessConnect:d,onSuccessConnect:v,children:p.jsx(N_,{handleSubmit:g,error:b,providerName:o,isButtonDisabled:a||n||d})})]})}function ru({provider:e}){var r;const{data:t}=Np(e);if((t==null?void 0:t.authType)===Hu.Basic)return p.jsx(b_,{provider:e});if((t==null?void 0:t.authType)===Hu.ApiKey)return p.jsx(y_,{provider:e});const n=(r=t==null?void 0:t.oauth2Opts)==null?void 0:r.grantType;if(n){if(n===Qs.AuthorizationCode||n===Qs.AuthorizationCodePkce)return p.jsx(k_,{provider:e});if(n===Qs.ClientCredentials)return p.jsx(I_,{provider:e})}return null}const A_=()=>{const e=Ct(),t=st();return zn({mutationFn:async({projectIdOrName:n,integrationId:r,installationId:i})=>(await e()).installationApi.deleteInstallation({projectIdOrName:n,integrationId:r,installationId:i}),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]})},onError:n=>{console.error("Error uninstalling installation."),it(n)}})};function iu({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectIdOrName:r}=Ze(),{integrationId:i,installation:o,setIntegrationDeleted:s,onUninstallSuccess:a}=St(),[l,c]=C.useState(!1),u=!r||!i||!(o!=null&&o.id)||l,d=A_(),h=async()=>{u||(c(!0),console.warn("uninstalling installation",{projectIdOrName:r,integrationId:i,installationId:o.id}),d.mutate({projectIdOrName:r,integrationId:i,installationId:o.id},{onSuccess:()=>{console.warn("successfully uninstalled installation:",o.id),a==null||a(o==null?void 0:o.id),s()},onSettled:()=>c(!1)}))},f=l?"Uninstalling...":e,y=p.jsx(ot,{type:"button",onClick:h,disabled:u,variant:t,style:n,children:f});return o!=null&&o.id?y:null}const R_=()=>{const e=Ct(),t=st(),[n,r]=C.useState(null);return{...zn({mutationKey:["deleteConnection"],mutationFn:async o=>(await e()).connectionApi.deleteConnection(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)},onError:o=>{console.error("Error deleting connection"),it(o,r)}}),errorMsg:n}};function Nh({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:i,onDisconnectError:o}){const{projectIdOrName:s}=Ze(),{selectedConnection:a}=Rn(),{mutate:l,isPending:c}=R_(),u=!s||!a||!a.id||c,d=async()=>{u||(console.warn("deleting connection",{projectIdOrName:s,connectionId:a==null?void 0:a.id}),l({projectIdOrName:s,connectionId:a==null?void 0:a.id},{onSuccess:()=>{console.warn("successfully deleted connection:",a==null?void 0:a.id),r==null||r(a),i()},onError:y=>{it(y,o)}}))},h=c?"Pending...":e;return p.jsx(ot,{type:"button",onClick:d,disabled:u,variant:t,style:n,children:h})}const kh=C.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),Mi=()=>{const e=C.useContext(kh);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e};function P_({children:e,resetComponent:t}){const{integrationId:n,integrationObj:r,installation:i}=St(),{isError:o,removeError:s,setError:a}=An(),l=(r==null?void 0:r.name)||n,[c,u]=C.useState(null),[d,h]=C.useState(null),{data:f,isLoading:y,isError:m,error:v,isSuccess:b}=_s();C.useEffect(()=>{!b&&!m||(m?(a(Ee.HYDRATED_REVISION,l),v&&it(v,u)):(s(Ee.HYDRATED_REVISION,l),u(null),h(null)))},[m,b,l,a,s,v,u]);const g=C.useMemo(()=>{var O,E,D;return{hydratedRevision:f||null,loading:y,readAction:(O=f==null?void 0:f.content)==null?void 0:O.read,writeObjects:((D=(E=f==null?void 0:f.content)==null?void 0:E.write)==null?void 0:D.objects)||[]}},[f,y]),w=(r==null?void 0:r.provider)||"provider",x=(r==null?void 0:r.name)||n||"unknown integration";if(o(Ee.HYDRATED_REVISION,l)){const O=`${c?mn(c):`Error retrieving objects from ${w} or integration details for ${x}`}`;return p.jsx(Vt,{message:O,children:p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem",width:"100%"},children:[p.jsx(ru,{provider:w}),i?p.jsx("p",{children:"If authentication is failing, please try reauthenticating using the section above before uninstalling the integration."}):p.jsx("p",{children:"If authentication is failing, please try reauthenticating using the section above before deleting and recreating the connection."}),d&&p.jsx(Zf,{message:d}),i?p.jsx(iu,{buttonText:"Uninstall",buttonVariant:"danger"}):p.jsx(Nh,{buttonText:"Delete Connection",resetComponent:t,buttonVariant:"danger",onDisconnectError:E=>h(E)})]})})}return y?p.jsx(Ri,{}):p.jsx(kh.Provider,{value:g,children:e})}const Ah=C.createContext(null);function Rh(){const e=C.useContext(Ah);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const Ph=C.createContext(()=>{});function F_(){const e=C.useContext(Ph);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}const Fh=C.createContext(void 0),D_={};function ou(){const e=C.useContext(Fh);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function M_({children:e}){const{installation:t}=St(),{hydratedRevision:n,loading:r}=Mi(),[i,o]=C.useState(D_),s=t==null?void 0:t.config;C.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(i).length>0)&&oC(n,s,o)},[n,r,s,i]);const a=C.useCallback((u,d)=>{o(h=>Kt(h,f=>{f[u]=Kt(f[u],d)}))},[o]),l=C.useCallback((u,d)=>{o(h=>Kt(h,f=>{f[u]=d}))},[o]),c=C.useMemo(()=>({objectConfigurationsState:i,setObjectConfigurationsState:o,setConfigureState:a,resetConfigureState:l}),[i,l,a]);return p.jsx(Fh.Provider,{value:c,children:e})}const vn=()=>{const{appName:e}=gr(),{objectConfigurationsState:t,setConfigureState:n}=ou(),{selectedObjectName:r}=Rh(),i=Ep(r||"",t);return{appName:e,configureState:i,setConfigureState:n,selectedObjectName:r}};function $n(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 Se(){return Se=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},Se.apply(null,arguments)}function cl(e,t){return cl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},cl(e,t)}function L_(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,cl(e,t)}var dl={exports:{}},Ko={exports:{}},Pe={};/** @license React v16.13.1
11
30
  * react-is.production.min.js
12
31
  *
13
32
  * Copyright (c) Facebook, Inc. and its affiliates.
14
33
  *
15
34
  * This source code is licensed under the MIT license found in the
16
35
  * LICENSE file in the root directory of this source tree.
17
- */var qc;function Bb(){if(qc)return Se;qc=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,u=e?Symbol.for("react.async_mode"):60111,f=e?Symbol.for("react.concurrent_mode"):60111,l=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,w=e?Symbol.for("react.block"):60121,g=e?Symbol.for("react.fundamental"):60117,O=e?Symbol.for("react.responder"):60118,p=e?Symbol.for("react.scope"):60119;function b(x){if(typeof x=="object"&&x!==null){var S=x.$$typeof;switch(S){case t:switch(x=x.type,x){case u:case f:case r:case o:case i:case d:return x;default:switch(x=x&&x.$$typeof,x){case a:case l:case y:case m:case s:return x;default:return S}}case n:return S}}}function v(x){return b(x)===f}return Se.AsyncMode=u,Se.ConcurrentMode=f,Se.ContextConsumer=a,Se.ContextProvider=s,Se.Element=t,Se.ForwardRef=l,Se.Fragment=r,Se.Lazy=y,Se.Memo=m,Se.Portal=n,Se.Profiler=o,Se.StrictMode=i,Se.Suspense=d,Se.isAsyncMode=function(x){return v(x)||b(x)===u},Se.isConcurrentMode=v,Se.isContextConsumer=function(x){return b(x)===a},Se.isContextProvider=function(x){return b(x)===s},Se.isElement=function(x){return typeof x=="object"&&x!==null&&x.$$typeof===t},Se.isForwardRef=function(x){return b(x)===l},Se.isFragment=function(x){return b(x)===r},Se.isLazy=function(x){return b(x)===y},Se.isMemo=function(x){return b(x)===m},Se.isPortal=function(x){return b(x)===n},Se.isProfiler=function(x){return b(x)===o},Se.isStrictMode=function(x){return b(x)===i},Se.isSuspense=function(x){return b(x)===d},Se.isValidElementType=function(x){return typeof x=="string"||typeof x=="function"||x===r||x===f||x===o||x===i||x===d||x===h||typeof x=="object"&&x!==null&&(x.$$typeof===y||x.$$typeof===m||x.$$typeof===s||x.$$typeof===a||x.$$typeof===l||x.$$typeof===g||x.$$typeof===O||x.$$typeof===p||x.$$typeof===w)},Se.typeOf=b,Se}var Ee={};/** @license React v16.13.1
36
+ */var Cd;function j_(){if(Cd)return Pe;Cd=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,l=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,f=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,m=e?Symbol.for("react.block"):60121,v=e?Symbol.for("react.fundamental"):60117,b=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function w(O){if(typeof O=="object"&&O!==null){var E=O.$$typeof;switch(E){case t:switch(O=O.type,O){case l:case c:case r:case o:case i:case d:return O;default:switch(O=O&&O.$$typeof,O){case a:case u:case y:case f:case s:return O;default:return E}}case n:return E}}}function x(O){return w(O)===c}return Pe.AsyncMode=l,Pe.ConcurrentMode=c,Pe.ContextConsumer=a,Pe.ContextProvider=s,Pe.Element=t,Pe.ForwardRef=u,Pe.Fragment=r,Pe.Lazy=y,Pe.Memo=f,Pe.Portal=n,Pe.Profiler=o,Pe.StrictMode=i,Pe.Suspense=d,Pe.isAsyncMode=function(O){return x(O)||w(O)===l},Pe.isConcurrentMode=x,Pe.isContextConsumer=function(O){return w(O)===a},Pe.isContextProvider=function(O){return w(O)===s},Pe.isElement=function(O){return typeof O=="object"&&O!==null&&O.$$typeof===t},Pe.isForwardRef=function(O){return w(O)===u},Pe.isFragment=function(O){return w(O)===r},Pe.isLazy=function(O){return w(O)===y},Pe.isMemo=function(O){return w(O)===f},Pe.isPortal=function(O){return w(O)===n},Pe.isProfiler=function(O){return w(O)===o},Pe.isStrictMode=function(O){return w(O)===i},Pe.isSuspense=function(O){return w(O)===d},Pe.isValidElementType=function(O){return typeof O=="string"||typeof O=="function"||O===r||O===c||O===o||O===i||O===d||O===h||typeof O=="object"&&O!==null&&(O.$$typeof===y||O.$$typeof===f||O.$$typeof===s||O.$$typeof===a||O.$$typeof===u||O.$$typeof===v||O.$$typeof===b||O.$$typeof===g||O.$$typeof===m)},Pe.typeOf=w,Pe}var Fe={};/** @license React v16.13.1
18
37
  * react-is.development.js
19
38
  *
20
39
  * Copyright (c) Facebook, Inc. and its affiliates.
21
40
  *
22
41
  * This source code is licensed under the MIT license found in the
23
42
  * LICENSE file in the root directory of this source tree.
24
- */var Bc;function Jb(){return Bc||(Bc=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,u=e?Symbol.for("react.async_mode"):60111,f=e?Symbol.for("react.concurrent_mode"):60111,l=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,w=e?Symbol.for("react.block"):60121,g=e?Symbol.for("react.fundamental"):60117,O=e?Symbol.for("react.responder"):60118,p=e?Symbol.for("react.scope"):60119;function b(k){return typeof k=="string"||typeof k=="function"||k===r||k===f||k===o||k===i||k===d||k===h||typeof k=="object"&&k!==null&&(k.$$typeof===y||k.$$typeof===m||k.$$typeof===s||k.$$typeof===a||k.$$typeof===l||k.$$typeof===g||k.$$typeof===O||k.$$typeof===p||k.$$typeof===w)}function v(k){if(typeof k=="object"&&k!==null){var ve=k.$$typeof;switch(ve){case t:var z=k.type;switch(z){case u:case f:case r:case o:case i:case d:return z;default:var Xe=z&&z.$$typeof;switch(Xe){case a:case l:case y:case m:case s:return Xe;default:return ve}}case n:return ve}}}var x=u,S=f,A=a,N=s,F=t,R=l,D=r,K=y,j=m,L=n,se=o,re=i,ge=d,de=!1;function be(k){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.")),P(k)||v(k)===u}function P(k){return v(k)===f}function $(k){return v(k)===a}function H(k){return v(k)===s}function U(k){return typeof k=="object"&&k!==null&&k.$$typeof===t}function q(k){return v(k)===l}function V(k){return v(k)===r}function G(k){return v(k)===y}function Z(k){return v(k)===m}function Y(k){return v(k)===n}function ee(k){return v(k)===o}function ne(k){return v(k)===i}function ce(k){return v(k)===d}Ee.AsyncMode=x,Ee.ConcurrentMode=S,Ee.ContextConsumer=A,Ee.ContextProvider=N,Ee.Element=F,Ee.ForwardRef=R,Ee.Fragment=D,Ee.Lazy=K,Ee.Memo=j,Ee.Portal=L,Ee.Profiler=se,Ee.StrictMode=re,Ee.Suspense=ge,Ee.isAsyncMode=be,Ee.isConcurrentMode=P,Ee.isContextConsumer=$,Ee.isContextProvider=H,Ee.isElement=U,Ee.isForwardRef=q,Ee.isFragment=V,Ee.isLazy=G,Ee.isMemo=Z,Ee.isPortal=Y,Ee.isProfiler=ee,Ee.isStrictMode=ne,Ee.isSuspense=ce,Ee.isValidElementType=b,Ee.typeOf=v}()),Ee}var Jc;function yd(){return Jc||(Jc=1,process.env.NODE_ENV==="production"?no.exports=Bb():no.exports=Jb()),no.exports}/*
43
+ */var Sd;function B_(){return Sd||(Sd=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,l=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,f=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,m=e?Symbol.for("react.block"):60121,v=e?Symbol.for("react.fundamental"):60117,b=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function w(q){return typeof q=="string"||typeof q=="function"||q===r||q===c||q===o||q===i||q===d||q===h||typeof q=="object"&&q!==null&&(q.$$typeof===y||q.$$typeof===f||q.$$typeof===s||q.$$typeof===a||q.$$typeof===u||q.$$typeof===v||q.$$typeof===b||q.$$typeof===g||q.$$typeof===m)}function x(q){if(typeof q=="object"&&q!==null){var be=q.$$typeof;switch(be){case t:var ee=q.type;switch(ee){case l:case c:case r:case o:case i:case d:return ee;default:var Ke=ee&&ee.$$typeof;switch(Ke){case a:case u:case y:case f:case s:return Ke;default:return be}}case n:return be}}}var O=l,E=c,D=a,N=s,M=t,R=u,P=r,F=y,U=f,B=n,X=o,se=i,ce=d,ge=!1;function we(q){return ge||(ge=!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.")),I(q)||x(q)===l}function I(q){return x(q)===c}function J(q){return x(q)===a}function V(q){return x(q)===s}function S(q){return typeof q=="object"&&q!==null&&q.$$typeof===t}function z(q){return x(q)===u}function $(q){return x(q)===r}function Y(q){return x(q)===y}function ne(q){return x(q)===f}function te(q){return x(q)===n}function ae(q){return x(q)===o}function Z(q){return x(q)===i}function ye(q){return x(q)===d}Fe.AsyncMode=O,Fe.ConcurrentMode=E,Fe.ContextConsumer=D,Fe.ContextProvider=N,Fe.Element=M,Fe.ForwardRef=R,Fe.Fragment=P,Fe.Lazy=F,Fe.Memo=U,Fe.Portal=B,Fe.Profiler=X,Fe.StrictMode=se,Fe.Suspense=ce,Fe.isAsyncMode=we,Fe.isConcurrentMode=I,Fe.isContextConsumer=J,Fe.isContextProvider=V,Fe.isElement=S,Fe.isForwardRef=z,Fe.isFragment=$,Fe.isLazy=Y,Fe.isMemo=ne,Fe.isPortal=te,Fe.isProfiler=ae,Fe.isStrictMode=Z,Fe.isSuspense=ye,Fe.isValidElementType=w,Fe.typeOf=x}()),Fe}var Od;function Dh(){return Od||(Od=1,process.env.NODE_ENV==="production"?Ko.exports=j_():Ko.exports=B_()),Ko.exports}/*
25
44
  object-assign
26
45
  (c) Sindre Sorhus
27
46
  @license MIT
28
- */var us,Hc;function Hb(){if(Hc)return us;Hc=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 u=Object.getOwnPropertyNames(s).map(function(l){return s[l]});if(u.join("")!=="0123456789")return!1;var f={};return"abcdefghijklmnopqrst".split("").forEach(function(l){f[l]=l}),Object.keys(Object.assign({},f)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return us=i()?Object.assign:function(o,s){for(var a,u=r(o),f,l=1;l<arguments.length;l++){a=Object(arguments[l]);for(var d in a)t.call(a,d)&&(u[d]=a[d]);if(e){f=e(a);for(var h=0;h<f.length;h++)n.call(a,f[h])&&(u[f[h]]=a[f[h]])}}return u},us}var ls,Wc;function Oa(){if(Wc)return ls;Wc=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ls=e,ls}var ds,zc;function vd(){return zc||(zc=1,ds=Function.call.bind(Object.prototype.hasOwnProperty)),ds}var fs,Qc;function Wb(){if(Qc)return fs;Qc=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Oa(),n={},r=vd();e=function(o){var s="Warning: "+o;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function i(o,s,a,u,f){if(process.env.NODE_ENV!=="production"){for(var l in o)if(r(o,l)){var d;try{if(typeof o[l]!="function"){var h=Error((u||"React class")+": "+a+" type `"+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[l]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}d=o[l](s,l,u,a,null,t)}catch(y){d=y}if(d&&!(d instanceof Error)&&e((u||"React class")+": type specification of "+a+" `"+l+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in n)){n[d.message]=!0;var m=f?f():"";e("Failed "+a+" type: "+d.message+(m??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},fs=i,fs}var ps,Gc;function zb(){if(Gc)return ps;Gc=1;var e=yd(),t=Hb(),n=Oa(),r=vd(),i=Wb(),o=function(){};process.env.NODE_ENV!=="production"&&(o=function(a){var u="Warning: "+a;typeof console<"u"&&console.error(u);try{throw new Error(u)}catch{}});function s(){return null}return ps=function(a,u){var f=typeof Symbol=="function"&&Symbol.iterator,l="@@iterator";function d(P){var $=P&&(f&&P[f]||P[l]);if(typeof $=="function")return $}var h="<<anonymous>>",m={array:O("array"),bigint:O("bigint"),bool:O("boolean"),func:O("function"),number:O("number"),object:O("object"),string:O("string"),symbol:O("symbol"),any:p(),arrayOf:b,element:v(),elementType:x(),instanceOf:S,node:R(),objectOf:N,oneOf:A,oneOfType:F,shape:K,exact:j};function y(P,$){return P===$?P!==0||1/P===1/$:P!==P&&$!==$}function w(P,$){this.message=P,this.data=$&&typeof $=="object"?$:{},this.stack=""}w.prototype=Error.prototype;function g(P){if(process.env.NODE_ENV!=="production")var $={},H=0;function U(V,G,Z,Y,ee,ne,ce){if(Y=Y||h,ne=ne||Z,ce!==n){if(u){var k=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 k.name="Invariant Violation",k}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ve=Y+":"+Z;!$[ve]&&H<3&&(o("You are manually calling a React.PropTypes validation function for the `"+ne+"` prop on `"+Y+"`. 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."),$[ve]=!0,H++)}}return G[Z]==null?V?G[Z]===null?new w("The "+ee+" `"+ne+"` is marked as required "+("in `"+Y+"`, but its value is `null`.")):new w("The "+ee+" `"+ne+"` is marked as required in "+("`"+Y+"`, but its value is `undefined`.")):null:P(G,Z,Y,ee,ne)}var q=U.bind(null,!1);return q.isRequired=U.bind(null,!0),q}function O(P){function $(H,U,q,V,G,Z){var Y=H[U],ee=re(Y);if(ee!==P){var ne=ge(Y);return new w("Invalid "+V+" `"+G+"` of type "+("`"+ne+"` supplied to `"+q+"`, expected ")+("`"+P+"`."),{expectedType:P})}return null}return g($)}function p(){return g(s)}function b(P){function $(H,U,q,V,G){if(typeof P!="function")return new w("Property `"+G+"` of component `"+q+"` has invalid PropType notation inside arrayOf.");var Z=H[U];if(!Array.isArray(Z)){var Y=re(Z);return new w("Invalid "+V+" `"+G+"` of type "+("`"+Y+"` supplied to `"+q+"`, expected an array."))}for(var ee=0;ee<Z.length;ee++){var ne=P(Z,ee,q,V,G+"["+ee+"]",n);if(ne instanceof Error)return ne}return null}return g($)}function v(){function P($,H,U,q,V){var G=$[H];if(!a(G)){var Z=re(G);return new w("Invalid "+q+" `"+V+"` of type "+("`"+Z+"` supplied to `"+U+"`, expected a single ReactElement."))}return null}return g(P)}function x(){function P($,H,U,q,V){var G=$[H];if(!e.isValidElementType(G)){var Z=re(G);return new w("Invalid "+q+" `"+V+"` of type "+("`"+Z+"` supplied to `"+U+"`, expected a single ReactElement type."))}return null}return g(P)}function S(P){function $(H,U,q,V,G){if(!(H[U]instanceof P)){var Z=P.name||h,Y=be(H[U]);return new w("Invalid "+V+" `"+G+"` of type "+("`"+Y+"` supplied to `"+q+"`, expected ")+("instance of `"+Z+"`."))}return null}return g($)}function A(P){if(!Array.isArray(P))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 $(H,U,q,V,G){for(var Z=H[U],Y=0;Y<P.length;Y++)if(y(Z,P[Y]))return null;var ee=JSON.stringify(P,function(ce,k){var ve=ge(k);return ve==="symbol"?String(k):k});return new w("Invalid "+V+" `"+G+"` of value `"+String(Z)+"` "+("supplied to `"+q+"`, expected one of "+ee+"."))}return g($)}function N(P){function $(H,U,q,V,G){if(typeof P!="function")return new w("Property `"+G+"` of component `"+q+"` has invalid PropType notation inside objectOf.");var Z=H[U],Y=re(Z);if(Y!=="object")return new w("Invalid "+V+" `"+G+"` of type "+("`"+Y+"` supplied to `"+q+"`, expected an object."));for(var ee in Z)if(r(Z,ee)){var ne=P(Z,ee,q,V,G+"."+ee,n);if(ne instanceof Error)return ne}return null}return g($)}function F(P){if(!Array.isArray(P))return process.env.NODE_ENV!=="production"&&o("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var $=0;$<P.length;$++){var H=P[$];if(typeof H!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+de(H)+" at index "+$+"."),s}function U(q,V,G,Z,Y){for(var ee=[],ne=0;ne<P.length;ne++){var ce=P[ne],k=ce(q,V,G,Z,Y,n);if(k==null)return null;k.data&&r(k.data,"expectedType")&&ee.push(k.data.expectedType)}var ve=ee.length>0?", expected one of type ["+ee.join(", ")+"]":"";return new w("Invalid "+Z+" `"+Y+"` supplied to "+("`"+G+"`"+ve+"."))}return g(U)}function R(){function P($,H,U,q,V){return L($[H])?null:new w("Invalid "+q+" `"+V+"` supplied to "+("`"+U+"`, expected a ReactNode."))}return g(P)}function D(P,$,H,U,q){return new w((P||"React class")+": "+$+" type `"+H+"."+U+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+q+"`.")}function K(P){function $(H,U,q,V,G){var Z=H[U],Y=re(Z);if(Y!=="object")return new w("Invalid "+V+" `"+G+"` of type `"+Y+"` "+("supplied to `"+q+"`, expected `object`."));for(var ee in P){var ne=P[ee];if(typeof ne!="function")return D(q,V,G,ee,ge(ne));var ce=ne(Z,ee,q,V,G+"."+ee,n);if(ce)return ce}return null}return g($)}function j(P){function $(H,U,q,V,G){var Z=H[U],Y=re(Z);if(Y!=="object")return new w("Invalid "+V+" `"+G+"` of type `"+Y+"` "+("supplied to `"+q+"`, expected `object`."));var ee=t({},H[U],P);for(var ne in ee){var ce=P[ne];if(r(P,ne)&&typeof ce!="function")return D(q,V,G,ne,ge(ce));if(!ce)return new w("Invalid "+V+" `"+G+"` key `"+ne+"` supplied to `"+q+"`.\nBad object: "+JSON.stringify(H[U],null," ")+`
29
- Valid keys: `+JSON.stringify(Object.keys(P),null," "));var k=ce(Z,ne,q,V,G+"."+ne,n);if(k)return k}return null}return g($)}function L(P){switch(typeof P){case"number":case"string":case"undefined":return!0;case"boolean":return!P;case"object":if(Array.isArray(P))return P.every(L);if(P===null||a(P))return!0;var $=d(P);if($){var H=$.call(P),U;if($!==P.entries){for(;!(U=H.next()).done;)if(!L(U.value))return!1}else for(;!(U=H.next()).done;){var q=U.value;if(q&&!L(q[1]))return!1}}else return!1;return!0;default:return!1}}function se(P,$){return P==="symbol"?!0:$?$["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&$ instanceof Symbol:!1}function re(P){var $=typeof P;return Array.isArray(P)?"array":P instanceof RegExp?"object":se($,P)?"symbol":$}function ge(P){if(typeof P>"u"||P===null)return""+P;var $=re(P);if($==="object"){if(P instanceof Date)return"date";if(P instanceof RegExp)return"regexp"}return $}function de(P){var $=ge(P);switch($){case"array":case"object":return"an "+$;case"boolean":case"date":case"regexp":return"a "+$;default:return $}}function be(P){return!P.constructor||!P.constructor.name?h:P.constructor.name}return m.checkPropTypes=i,m.resetWarningCache=i.resetWarningCache,m.PropTypes=m,m},ps}var hs,Xc;function Qb(){if(Xc)return hs;Xc=1;var e=Oa();function t(){}function n(){}return n.resetWarningCache=t,hs=function(){function r(s,a,u,f,l,d){if(d!==e){var h=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 h.name="Invariant Violation",h}}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},hs}if(process.env.NODE_ENV!=="production"){var Gb=yd(),Xb=!0;Hs.exports=zb()(Gb.isElement,Xb)}else Hs.exports=Qb()();var Yb=Hs.exports;const W=ko(Yb);var Ws={exports:{}},Ne={};/**
47
+ */var ha,Ed;function V_(){if(Ed)return ha;Ed=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 l=Object.getOwnPropertyNames(s).map(function(u){return s[u]});if(l.join("")!=="0123456789")return!1;var c={};return"abcdefghijklmnopqrst".split("").forEach(function(u){c[u]=u}),Object.keys(Object.assign({},c)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return ha=i()?Object.assign:function(o,s){for(var a,l=r(o),c,u=1;u<arguments.length;u++){a=Object(arguments[u]);for(var d in a)t.call(a,d)&&(l[d]=a[d]);if(e){c=e(a);for(var h=0;h<c.length;h++)n.call(a,c[h])&&(l[c[h]]=a[c[h]])}}return l},ha}var ma,_d;function su(){if(_d)return ma;_d=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ma=e,ma}var ga,Td;function Mh(){return Td||(Td=1,ga=Function.call.bind(Object.prototype.hasOwnProperty)),ga}var ya,Nd;function U_(){if(Nd)return ya;Nd=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=su(),n={},r=Mh();e=function(o){var s="Warning: "+o;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function i(o,s,a,l,c){if(process.env.NODE_ENV!=="production"){for(var u in o)if(r(o,u)){var d;try{if(typeof o[u]!="function"){var h=Error((l||"React class")+": "+a+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}d=o[u](s,u,l,a,null,t)}catch(y){d=y}if(d&&!(d instanceof Error)&&e((l||"React class")+": type specification of "+a+" `"+u+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in n)){n[d.message]=!0;var f=c?c():"";e("Failed "+a+" type: "+d.message+(f??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},ya=i,ya}var va,kd;function $_(){if(kd)return va;kd=1;var e=Dh(),t=V_(),n=su(),r=Mh(),i=U_(),o=function(){};process.env.NODE_ENV!=="production"&&(o=function(a){var l="Warning: "+a;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}});function s(){return null}return va=function(a,l){var c=typeof Symbol=="function"&&Symbol.iterator,u="@@iterator";function d(I){var J=I&&(c&&I[c]||I[u]);if(typeof J=="function")return J}var h="<<anonymous>>",f={array:b("array"),bigint:b("bigint"),bool:b("boolean"),func:b("function"),number:b("number"),object:b("object"),string:b("string"),symbol:b("symbol"),any:g(),arrayOf:w,element:x(),elementType:O(),instanceOf:E,node:R(),objectOf:N,oneOf:D,oneOfType:M,shape:F,exact:U};function y(I,J){return I===J?I!==0||1/I===1/J:I!==I&&J!==J}function m(I,J){this.message=I,this.data=J&&typeof J=="object"?J:{},this.stack=""}m.prototype=Error.prototype;function v(I){if(process.env.NODE_ENV!=="production")var J={},V=0;function S($,Y,ne,te,ae,Z,ye){if(te=te||h,Z=Z||ne,ye!==n){if(l){var q=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 q.name="Invariant Violation",q}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var be=te+":"+ne;!J[be]&&V<3&&(o("You are manually calling a React.PropTypes validation function for the `"+Z+"` prop on `"+te+"`. 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."),J[be]=!0,V++)}}return Y[ne]==null?$?Y[ne]===null?new m("The "+ae+" `"+Z+"` is marked as required "+("in `"+te+"`, but its value is `null`.")):new m("The "+ae+" `"+Z+"` is marked as required in "+("`"+te+"`, but its value is `undefined`.")):null:I(Y,ne,te,ae,Z)}var z=S.bind(null,!1);return z.isRequired=S.bind(null,!0),z}function b(I){function J(V,S,z,$,Y,ne){var te=V[S],ae=se(te);if(ae!==I){var Z=ce(te);return new m("Invalid "+$+" `"+Y+"` of type "+("`"+Z+"` supplied to `"+z+"`, expected ")+("`"+I+"`."),{expectedType:I})}return null}return v(J)}function g(){return v(s)}function w(I){function J(V,S,z,$,Y){if(typeof I!="function")return new m("Property `"+Y+"` of component `"+z+"` has invalid PropType notation inside arrayOf.");var ne=V[S];if(!Array.isArray(ne)){var te=se(ne);return new m("Invalid "+$+" `"+Y+"` of type "+("`"+te+"` supplied to `"+z+"`, expected an array."))}for(var ae=0;ae<ne.length;ae++){var Z=I(ne,ae,z,$,Y+"["+ae+"]",n);if(Z instanceof Error)return Z}return null}return v(J)}function x(){function I(J,V,S,z,$){var Y=J[V];if(!a(Y)){var ne=se(Y);return new m("Invalid "+z+" `"+$+"` of type "+("`"+ne+"` supplied to `"+S+"`, expected a single ReactElement."))}return null}return v(I)}function O(){function I(J,V,S,z,$){var Y=J[V];if(!e.isValidElementType(Y)){var ne=se(Y);return new m("Invalid "+z+" `"+$+"` of type "+("`"+ne+"` supplied to `"+S+"`, expected a single ReactElement type."))}return null}return v(I)}function E(I){function J(V,S,z,$,Y){if(!(V[S]instanceof I)){var ne=I.name||h,te=we(V[S]);return new m("Invalid "+$+" `"+Y+"` of type "+("`"+te+"` supplied to `"+z+"`, expected ")+("instance of `"+ne+"`."))}return null}return v(J)}function D(I){if(!Array.isArray(I))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 J(V,S,z,$,Y){for(var ne=V[S],te=0;te<I.length;te++)if(y(ne,I[te]))return null;var ae=JSON.stringify(I,function(ye,q){var be=ce(q);return be==="symbol"?String(q):q});return new m("Invalid "+$+" `"+Y+"` of value `"+String(ne)+"` "+("supplied to `"+z+"`, expected one of "+ae+"."))}return v(J)}function N(I){function J(V,S,z,$,Y){if(typeof I!="function")return new m("Property `"+Y+"` of component `"+z+"` has invalid PropType notation inside objectOf.");var ne=V[S],te=se(ne);if(te!=="object")return new m("Invalid "+$+" `"+Y+"` of type "+("`"+te+"` supplied to `"+z+"`, expected an object."));for(var ae in ne)if(r(ne,ae)){var Z=I(ne,ae,z,$,Y+"."+ae,n);if(Z instanceof Error)return Z}return null}return v(J)}function M(I){if(!Array.isArray(I))return process.env.NODE_ENV!=="production"&&o("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var J=0;J<I.length;J++){var V=I[J];if(typeof V!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ge(V)+" at index "+J+"."),s}function S(z,$,Y,ne,te){for(var ae=[],Z=0;Z<I.length;Z++){var ye=I[Z],q=ye(z,$,Y,ne,te,n);if(q==null)return null;q.data&&r(q.data,"expectedType")&&ae.push(q.data.expectedType)}var be=ae.length>0?", expected one of type ["+ae.join(", ")+"]":"";return new m("Invalid "+ne+" `"+te+"` supplied to "+("`"+Y+"`"+be+"."))}return v(S)}function R(){function I(J,V,S,z,$){return B(J[V])?null:new m("Invalid "+z+" `"+$+"` supplied to "+("`"+S+"`, expected a ReactNode."))}return v(I)}function P(I,J,V,S,z){return new m((I||"React class")+": "+J+" type `"+V+"."+S+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+z+"`.")}function F(I){function J(V,S,z,$,Y){var ne=V[S],te=se(ne);if(te!=="object")return new m("Invalid "+$+" `"+Y+"` of type `"+te+"` "+("supplied to `"+z+"`, expected `object`."));for(var ae in I){var Z=I[ae];if(typeof Z!="function")return P(z,$,Y,ae,ce(Z));var ye=Z(ne,ae,z,$,Y+"."+ae,n);if(ye)return ye}return null}return v(J)}function U(I){function J(V,S,z,$,Y){var ne=V[S],te=se(ne);if(te!=="object")return new m("Invalid "+$+" `"+Y+"` of type `"+te+"` "+("supplied to `"+z+"`, expected `object`."));var ae=t({},V[S],I);for(var Z in ae){var ye=I[Z];if(r(I,Z)&&typeof ye!="function")return P(z,$,Y,Z,ce(ye));if(!ye)return new m("Invalid "+$+" `"+Y+"` key `"+Z+"` supplied to `"+z+"`.\nBad object: "+JSON.stringify(V[S],null," ")+`
48
+ Valid keys: `+JSON.stringify(Object.keys(I),null," "));var q=ye(ne,Z,z,$,Y+"."+Z,n);if(q)return q}return null}return v(J)}function B(I){switch(typeof I){case"number":case"string":case"undefined":return!0;case"boolean":return!I;case"object":if(Array.isArray(I))return I.every(B);if(I===null||a(I))return!0;var J=d(I);if(J){var V=J.call(I),S;if(J!==I.entries){for(;!(S=V.next()).done;)if(!B(S.value))return!1}else for(;!(S=V.next()).done;){var z=S.value;if(z&&!B(z[1]))return!1}}else return!1;return!0;default:return!1}}function X(I,J){return I==="symbol"?!0:J?J["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&J instanceof Symbol:!1}function se(I){var J=typeof I;return Array.isArray(I)?"array":I instanceof RegExp?"object":X(J,I)?"symbol":J}function ce(I){if(typeof I>"u"||I===null)return""+I;var J=se(I);if(J==="object"){if(I instanceof Date)return"date";if(I instanceof RegExp)return"regexp"}return J}function ge(I){var J=ce(I);switch(J){case"array":case"object":return"an "+J;case"boolean":case"date":case"regexp":return"a "+J;default:return J}}function we(I){return!I.constructor||!I.constructor.name?h:I.constructor.name}return f.checkPropTypes=i,f.resetWarningCache=i.resetWarningCache,f.PropTypes=f,f},va}var wa,Ad;function q_(){if(Ad)return wa;Ad=1;var e=su();function t(){}function n(){}return n.resetWarningCache=t,wa=function(){function r(s,a,l,c,u,d){if(d!==e){var h=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 h.name="Invariant Violation",h}}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},wa}if(process.env.NODE_ENV!=="production"){var z_=Dh(),K_=!0;dl.exports=$_()(z_.isElement,K_)}else dl.exports=q_()();var H_=dl.exports;const G=Ni(H_);var fl={exports:{}},De={};/**
30
49
  * @license React
31
50
  * react-is.production.min.js
32
51
  *
@@ -34,7 +53,7 @@ Valid keys: `+JSON.stringify(Object.keys(P),null," "));var k=ce(Z,ne,q,V,G+"."+
34
53
  *
35
54
  * This source code is licensed under the MIT license found in the
36
55
  * LICENSE file in the root directory of this source tree.
37
- */var Yc;function Zb(){if(Yc)return Ne;Yc=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"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),y;y=Symbol.for("react.module.reference");function w(g){if(typeof g=="object"&&g!==null){var O=g.$$typeof;switch(O){case e:switch(g=g.type,g){case n:case i:case r:case f:case l:return g;default:switch(g=g&&g.$$typeof,g){case a:case s:case u:case h:case d:case o:return g;default:return O}}case t:return O}}}return Ne.ContextConsumer=s,Ne.ContextProvider=o,Ne.Element=e,Ne.ForwardRef=u,Ne.Fragment=n,Ne.Lazy=h,Ne.Memo=d,Ne.Portal=t,Ne.Profiler=i,Ne.StrictMode=r,Ne.Suspense=f,Ne.SuspenseList=l,Ne.isAsyncMode=function(){return!1},Ne.isConcurrentMode=function(){return!1},Ne.isContextConsumer=function(g){return w(g)===s},Ne.isContextProvider=function(g){return w(g)===o},Ne.isElement=function(g){return typeof g=="object"&&g!==null&&g.$$typeof===e},Ne.isForwardRef=function(g){return w(g)===u},Ne.isFragment=function(g){return w(g)===n},Ne.isLazy=function(g){return w(g)===h},Ne.isMemo=function(g){return w(g)===d},Ne.isPortal=function(g){return w(g)===t},Ne.isProfiler=function(g){return w(g)===i},Ne.isStrictMode=function(g){return w(g)===r},Ne.isSuspense=function(g){return w(g)===f},Ne.isSuspenseList=function(g){return w(g)===l},Ne.isValidElementType=function(g){return typeof g=="string"||typeof g=="function"||g===n||g===i||g===r||g===f||g===l||g===m||typeof g=="object"&&g!==null&&(g.$$typeof===h||g.$$typeof===d||g.$$typeof===o||g.$$typeof===s||g.$$typeof===u||g.$$typeof===y||g.getModuleId!==void 0)},Ne.typeOf=w,Ne}var Te={};/**
56
+ */var Rd;function J_(){if(Rd)return De;Rd=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"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),y;y=Symbol.for("react.module.reference");function m(v){if(typeof v=="object"&&v!==null){var b=v.$$typeof;switch(b){case e:switch(v=v.type,v){case n:case i:case r:case c:case u:return v;default:switch(v=v&&v.$$typeof,v){case a:case s:case l:case h:case d:case o:return v;default:return b}}case t:return b}}}return De.ContextConsumer=s,De.ContextProvider=o,De.Element=e,De.ForwardRef=l,De.Fragment=n,De.Lazy=h,De.Memo=d,De.Portal=t,De.Profiler=i,De.StrictMode=r,De.Suspense=c,De.SuspenseList=u,De.isAsyncMode=function(){return!1},De.isConcurrentMode=function(){return!1},De.isContextConsumer=function(v){return m(v)===s},De.isContextProvider=function(v){return m(v)===o},De.isElement=function(v){return typeof v=="object"&&v!==null&&v.$$typeof===e},De.isForwardRef=function(v){return m(v)===l},De.isFragment=function(v){return m(v)===n},De.isLazy=function(v){return m(v)===h},De.isMemo=function(v){return m(v)===d},De.isPortal=function(v){return m(v)===t},De.isProfiler=function(v){return m(v)===i},De.isStrictMode=function(v){return m(v)===r},De.isSuspense=function(v){return m(v)===c},De.isSuspenseList=function(v){return m(v)===u},De.isValidElementType=function(v){return typeof v=="string"||typeof v=="function"||v===n||v===i||v===r||v===c||v===u||v===f||typeof v=="object"&&v!==null&&(v.$$typeof===h||v.$$typeof===d||v.$$typeof===o||v.$$typeof===s||v.$$typeof===l||v.$$typeof===y||v.getModuleId!==void 0)},De.typeOf=m,De}var Me={};/**
38
57
  * @license React
39
58
  * react-is.development.js
40
59
  *
@@ -42,11 +61,5 @@ Valid keys: `+JSON.stringify(Object.keys(P),null," "));var k=ce(Z,ne,q,V,G+"."+
42
61
  *
43
62
  * This source code is licensed under the MIT license found in the
44
63
  * LICENSE file in the root directory of this source tree.
45
- */var Zc;function eI(){return Zc||(Zc=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"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),y=!1,w=!1,g=!1,O=!1,p=!1,b;b=Symbol.for("react.module.reference");function v(z){return!!(typeof z=="string"||typeof z=="function"||z===n||z===i||p||z===r||z===f||z===l||O||z===m||y||w||g||typeof z=="object"&&z!==null&&(z.$$typeof===h||z.$$typeof===d||z.$$typeof===o||z.$$typeof===s||z.$$typeof===u||z.$$typeof===b||z.getModuleId!==void 0))}function x(z){if(typeof z=="object"&&z!==null){var Xe=z.$$typeof;switch(Xe){case e:var Ce=z.type;switch(Ce){case n:case i:case r:case f:case l:return Ce;default:var st=Ce&&Ce.$$typeof;switch(st){case a:case s:case u:case h:case d:case o:return st;default:return Xe}}case t:return Xe}}}var S=s,A=o,N=e,F=u,R=n,D=h,K=d,j=t,L=i,se=r,re=f,ge=l,de=!1,be=!1;function P(z){return de||(de=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function $(z){return be||(be=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function H(z){return x(z)===s}function U(z){return x(z)===o}function q(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function V(z){return x(z)===u}function G(z){return x(z)===n}function Z(z){return x(z)===h}function Y(z){return x(z)===d}function ee(z){return x(z)===t}function ne(z){return x(z)===i}function ce(z){return x(z)===r}function k(z){return x(z)===f}function ve(z){return x(z)===l}Te.ContextConsumer=S,Te.ContextProvider=A,Te.Element=N,Te.ForwardRef=F,Te.Fragment=R,Te.Lazy=D,Te.Memo=K,Te.Portal=j,Te.Profiler=L,Te.StrictMode=se,Te.Suspense=re,Te.SuspenseList=ge,Te.isAsyncMode=P,Te.isConcurrentMode=$,Te.isContextConsumer=H,Te.isContextProvider=U,Te.isElement=q,Te.isForwardRef=V,Te.isFragment=G,Te.isLazy=Z,Te.isMemo=Y,Te.isPortal=ee,Te.isProfiler=ne,Te.isStrictMode=ce,Te.isSuspense=k,Te.isSuspenseList=ve,Te.isValidElementType=v,Te.typeOf=x}()),Te}process.env.NODE_ENV==="production"?Ws.exports=Zb():Ws.exports=eI();var eu=Ws.exports;const tu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,nu=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",ms=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return nu(n.overflowY,t)||nu(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},ro=(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,tI=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},nI=(e,t)=>{var n,r,i,o;if(typeof document>"u")return[];const{inline:s,boundary:a,skipOverflowHiddenElements:u}=t,f=typeof a=="function"?a:j=>j!==a;if(!tu(e))throw new TypeError("Invalid target");const l=document.scrollingElement||document.documentElement,d=[];let h=e;for(;tu(h)&&f(h);){if(h=tI(h),h===l){d.push(h);break}h!=null&&h===document.body&&ms(h)&&!ms(document.documentElement)||h!=null&&ms(h,u)&&d.push(h)}const m=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,y=(o=(i=window.visualViewport)==null?void 0:i.height)!=null?o:innerHeight,{scrollX:w,scrollY:g}=window,{height:O,width:p,top:b,right:v,bottom:x,left:S}=e.getBoundingClientRect(),{top:A,right:N,left:F}=(j=>{const L=window.getComputedStyle(j);return{top:parseFloat(L.scrollMarginTop)||0,right:parseFloat(L.scrollMarginRight)||0,bottom:parseFloat(L.scrollMarginBottom)||0,left:parseFloat(L.scrollMarginLeft)||0}})(e);let R=b-A,D=s==="center"?S+p/2-F+N:s==="end"?v+N:S-F;const K=[];for(let j=0;j<d.length;j++){const L=d[j],{height:se,width:re,top:ge,right:de,bottom:be,left:P}=L.getBoundingClientRect();if(b>=0&&S>=0&&x<=y&&v<=m&&b>=ge&&x<=be&&S>=P&&v<=de)return K;const $=getComputedStyle(L),H=parseInt($.borderLeftWidth,10),U=parseInt($.borderTopWidth,10),q=parseInt($.borderRightWidth,10),V=parseInt($.borderBottomWidth,10);let G=0,Z=0;const Y="offsetWidth"in L?L.offsetWidth-L.clientWidth-H-q:0,ee="offsetHeight"in L?L.offsetHeight-L.clientHeight-U-V:0,ne="offsetWidth"in L?L.offsetWidth===0?0:re/L.offsetWidth:0,ce="offsetHeight"in L?L.offsetHeight===0?0:se/L.offsetHeight:0;if(l===L)G=ro(g,g+y,y,U,V,g+R,g+R+O,O),Z=s==="start"?D:s==="center"?D-m/2:s==="end"?D-m:ro(w,w+m,m,H,q,w+D,w+D+p,p),G=Math.max(0,G+g),Z=Math.max(0,Z+w);else{G=ro(ge,be,se,U,V+ee,R,R+O,O),Z=s==="start"?D-P-H:s==="center"?D-(P+re/2)+Y/2:s==="end"?D-de+q+Y:ro(P,de,re,H,q+Y,D,D+p,p);const{scrollLeft:k,scrollTop:ve}=L;G=ce===0?0:Math.max(0,Math.min(ve+G/ce,L.scrollHeight-se/ce+ee)),Z=ne===0?0:Math.max(0,Math.min(k+Z/ne,L.scrollWidth-re/ne+Y)),R+=ve-G,D+=k-Z}K.push({el:L,top:G,left:Z})}return K};var Xr=function(){return Xr=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},Xr.apply(this,arguments)};var rI=0;function ru(e){return typeof e=="function"?e:Tt}function Tt(){}function wd(e,t){if(e){var n=nI(e,{boundary:t});n.forEach(function(r){var i=r.el,o=r.top,s=r.left;i.scrollTop=o,i.scrollLeft=s})}}function iu(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function _a(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 Qe(){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 Fr(){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 bd(){return String(rI++)}function iI(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 ou(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function Id(e){return typeof e.type=="string"}function Cd(e){return e.props}function oI(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var sI=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function io(e){e===void 0&&(e={});var t={};return sI.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function Oo(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=_o(t,r)?t[r]:e[r],n},{})}function _o(e,t){return e[t]!==void 0}function zs(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function aI(e){return Object.prototype.toString.call(e)==="[object Object]"}function ur(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 u=Yr(a,t<0,n,r,i);return u===-1?e>=o?-1:e:u}function Yr(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?Yr(t?o-1:0,t,n,r):-1}function So(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(i){return i&&(iu(i,e,n)||r&&iu(i,n.document.activeElement,n))})}var Sa=Tt;process.env.NODE_ENV!=="production"&&(Sa=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 cI=_a(function(e){xd(e).textContent=""},500);function xd(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 Od(e,t){if(!(!e||!t)){var n=xd(t);n.textContent=e,cI(t)}}function uI(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var _d=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,Sd=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,Ed=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,lo=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,fo=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,Nd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Td=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Rd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Ad=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Fd=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Pd=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,Dd=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Md=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,Qs=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,kd=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,jd=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Ld=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,lI=Object.freeze({__proto__:null,blurButton:kd,blurInput:Pd,changeInput:Dd,clickButton:Qs,clickItem:Fd,controlledPropUpdatedSelectedItem:jd,itemMouseEnter:Ed,keyDownArrowDown:fo,keyDownArrowUp:lo,keyDownEnd:Ad,keyDownEnter:Td,keyDownEscape:Nd,keyDownHome:Rd,keyDownSpaceButton:Md,mouseUp:Sd,touchEnd:Ld,unknown:_d}),dI=["refKey","ref"],fI=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],pI=["onKeyDown","onBlur","onChange","onInput","onChangeText"],hI=["refKey","ref"],mI=["onMouseMove","onMouseDown","onClick","onPress","index","item"],gI=function(){var e=function(t){function n(i){var o;o=t.call(this,i)||this,o.id=o.props.id||"downshift-"+bd(),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(p){return o.id+"-item-"+p},o.items=[],o.itemCount=null,o.previousResultCount=0,o.timeoutIds=[],o.internalSetTimeout=function(p,b){var v=setTimeout(function(){o.timeoutIds=o.timeoutIds.filter(function(x){return x!==v}),p()},b);o.timeoutIds.push(v)},o.setItemCount=function(p){o.itemCount=p},o.unsetItemCount=function(){o.itemCount=null},o.isItemDisabled=function(p,b){var v=o.getItemNodeFromIndex(b);return v&&v.hasAttribute("disabled")},o.setHighlightedIndex=function(p,b){p===void 0&&(p=o.props.defaultHighlightedIndex),b===void 0&&(b={}),b=io(b),o.internalSetState(ye({highlightedIndex:p},b))},o.clearSelection=function(p){o.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:o.props.defaultHighlightedIndex,isOpen:o.props.defaultIsOpen},p)},o.selectItem=function(p,b,v){b=io(b),o.internalSetState(ye({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,selectedItem:p,inputValue:o.props.itemToString(p)},b),v)},o.selectItemAtIndex=function(p,b,v){var x=o.items[p];x!=null&&o.selectItem(x,b,v)},o.selectHighlightedItem=function(p,b){return o.selectItemAtIndex(o.getState().highlightedIndex,p,b)},o.internalSetState=function(p,b){var v,x,S={},A=typeof p=="function";return!A&&p.hasOwnProperty("inputValue")&&o.props.onInputValueChange(p.inputValue,ye({},o.getStateAndHelpers(),p)),o.setState(function(N){var F;N=o.getState(N);var R=A?p(N):p;R=o.props.stateReducer(N,R),v=R.hasOwnProperty("selectedItem");var D={};return v&&R.selectedItem!==N.selectedItem&&(x=R.selectedItem),(F=R).type||(F.type=_d),Object.keys(R).forEach(function(K){N[K]!==R[K]&&(S[K]=R[K]),K!=="type"&&(R[K],_o(o.props,K)||(D[K]=R[K]))}),A&&R.hasOwnProperty("inputValue")&&o.props.onInputValueChange(R.inputValue,ye({},o.getStateAndHelpers(),R)),D},function(){ru(b)();var N=Object.keys(S).length>1;N&&o.props.onStateChange(S,o.getStateAndHelpers()),v&&o.props.onSelect(p.selectedItem,o.getStateAndHelpers()),x!==void 0&&o.props.onChange(x,o.getStateAndHelpers()),o.props.onUserAction(S,o.getStateAndHelpers())})},o.rootRef=function(p){return o._rootNode=p},o.getRootProps=function(p,b){var v,x=p===void 0?{}:p,S=x.refKey,A=S===void 0?"ref":S,N=x.ref,F=Cn(x,dI),R=b===void 0?{}:b,D=R.suppressRefError,K=D===void 0?!1:D;o.getRootProps.called=!0,o.getRootProps.refKey=A,o.getRootProps.suppressRefError=K;var j=o.getState(),L=j.isOpen;return ye((v={},v[A]=Fr(N,o.rootRef),v.role="combobox",v["aria-expanded"]=L,v["aria-haspopup"]="listbox",v["aria-owns"]=L?o.menuId:void 0,v["aria-labelledby"]=o.labelId,v),F)},o.keyDownHandlers={ArrowDown:function(b){var v=this;if(b.preventDefault(),this.getState().isOpen){var x=b.shiftKey?5:1;this.moveHighlightedIndex(x,{type:fo})}else this.internalSetState({isOpen:!0,type:fo},function(){var S=v.getItemCount();if(S>0){var A=v.getState(),N=A.highlightedIndex,F=ur(N,1,{length:S},v.isItemDisabled,!0);v.setHighlightedIndex(F,{type:fo})}})},ArrowUp:function(b){var v=this;if(b.preventDefault(),this.getState().isOpen){var x=b.shiftKey?-5:-1;this.moveHighlightedIndex(x,{type:lo})}else this.internalSetState({isOpen:!0,type:lo},function(){var S=v.getItemCount();if(S>0){var A=v.getState(),N=A.highlightedIndex,F=ur(N,-1,{length:S},v.isItemDisabled,!0);v.setHighlightedIndex(F,{type:lo})}})},Enter:function(b){if(b.which!==229){var v=this.getState(),x=v.isOpen,S=v.highlightedIndex;if(x&&S!=null){b.preventDefault();var A=this.items[S],N=this.getItemNodeFromIndex(S);if(A==null||N&&N.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Td})}}},Escape:function(b){b.preventDefault(),this.reset(ye({type:Nd},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},o.buttonKeyDownHandlers=ye({},o.keyDownHandlers,{" ":function(b){b.preventDefault(),this.toggleMenu({type:Md})}}),o.inputKeyDownHandlers=ye({},o.keyDownHandlers,{Home:function(b){var v=this.getState(),x=v.isOpen;if(x){b.preventDefault();var S=this.getItemCount();if(!(S<=0||!x)){var A=Yr(0,!1,{length:S},this.isItemDisabled);this.setHighlightedIndex(A,{type:Rd})}}},End:function(b){var v=this.getState(),x=v.isOpen;if(x){b.preventDefault();var S=this.getItemCount();if(!(S<=0||!x)){var A=Yr(S-1,!0,{length:S},this.isItemDisabled);this.setHighlightedIndex(A,{type:Ad})}}}}),o.getToggleButtonProps=function(p){var b=p===void 0?{}:p,v=b.onClick;b.onPress;var x=b.onKeyDown,S=b.onKeyUp,A=b.onBlur,N=Cn(b,fI),F=o.getState(),R=F.isOpen,D={onClick:Qe(v,o.buttonHandleClick),onKeyDown:Qe(x,o.buttonHandleKeyDown),onKeyUp:Qe(S,o.buttonHandleKeyUp),onBlur:Qe(A,o.buttonHandleBlur)},K=N.disabled?{}:D;return ye({type:"button",role:"button","aria-label":R?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},K,N)},o.buttonHandleKeyUp=function(p){p.preventDefault()},o.buttonHandleKeyDown=function(p){var b=zs(p);o.buttonKeyDownHandlers[b]&&o.buttonKeyDownHandlers[b].call(o,p)},o.buttonHandleClick=function(p){if(p.preventDefault(),o.props.environment){var b=o.props.environment.document,v=b.body,x=b.activeElement;v&&v===x&&p.target.focus()}process.env.NODE_ENV==="test"?o.toggleMenu({type:Qs}):o.internalSetTimeout(function(){return o.toggleMenu({type:Qs})})},o.buttonHandleBlur=function(p){var b=p.target;o.internalSetTimeout(function(){if(!(o.isMouseDown||!o.props.environment)){var v=o.props.environment.document.activeElement;(v==null||v.id!==o.inputId)&&v!==b&&o.reset({type:kd})}})},o.getLabelProps=function(p){return ye({htmlFor:o.inputId,id:o.labelId},p)},o.getInputProps=function(p){var b=p===void 0?{}:p,v=b.onKeyDown,x=b.onBlur,S=b.onChange,A=b.onInput;b.onChangeText;var N=Cn(b,pI),F,R={};F="onChange";var D=o.getState(),K=D.inputValue,j=D.isOpen,L=D.highlightedIndex;if(!N.disabled){var se;R=(se={},se[F]=Qe(S,A,o.inputHandleChange),se.onKeyDown=Qe(v,o.inputHandleKeyDown),se.onBlur=Qe(x,o.inputHandleBlur),se)}return ye({"aria-autocomplete":"list","aria-activedescendant":j&&typeof L=="number"&&L>=0?o.getItemId(L):void 0,"aria-controls":j?o.menuId:void 0,"aria-labelledby":N&&N["aria-label"]?void 0:o.labelId,autoComplete:"off",value:K,id:o.inputId},R,N)},o.inputHandleKeyDown=function(p){var b=zs(p);b&&o.inputKeyDownHandlers[b]&&o.inputKeyDownHandlers[b].call(o,p)},o.inputHandleChange=function(p){o.internalSetState({type:Dd,isOpen:!0,inputValue:p.target.value,highlightedIndex:o.props.defaultHighlightedIndex})},o.inputHandleBlur=function(){o.internalSetTimeout(function(){var p;if(!(o.isMouseDown||!o.props.environment)){var b=o.props.environment.document.activeElement,v=(b==null||(p=b.dataset)==null?void 0:p.toggle)&&o._rootNode&&o._rootNode.contains(b);v||o.reset({type:Pd})}})},o.menuRef=function(p){o._menuNode=p},o.getMenuProps=function(p,b){var v,x=p===void 0?{}:p,S=x.refKey,A=S===void 0?"ref":S,N=x.ref,F=Cn(x,hI),R=b===void 0?{}:b,D=R.suppressRefError,K=D===void 0?!1:D;return o.getMenuProps.called=!0,o.getMenuProps.refKey=A,o.getMenuProps.suppressRefError=K,ye((v={},v[A]=Fr(N,o.menuRef),v.role="listbox",v["aria-labelledby"]=F&&F["aria-label"]?void 0:o.labelId,v.id=o.menuId,v),F)},o.getItemProps=function(p){var b,v=p===void 0?{}:p,x=v.onMouseMove,S=v.onMouseDown,A=v.onClick;v.onPress;var N=v.index,F=v.item,R=F===void 0?process.env.NODE_ENV==="production"?void 0:oI("getItemProps","item"):F,D=Cn(v,mI);N===void 0?(o.items.push(R),N=o.items.indexOf(R)):o.items[N]=R;var K="onClick",j=A,L=(b={onMouseMove:Qe(x,function(){N!==o.getState().highlightedIndex&&(o.setHighlightedIndex(N,{type:Ed}),o.avoidScrolling=!0,o.internalSetTimeout(function(){return o.avoidScrolling=!1},250))}),onMouseDown:Qe(S,function(re){re.preventDefault()})},b[K]=Qe(j,function(){o.selectItemAtIndex(N,{type:Fd})}),b),se=D.disabled?{onMouseDown:L.onMouseDown}:L;return ye({id:o.getItemId(N),role:"option","aria-selected":o.getState().highlightedIndex===N},se,D)},o.clearItems=function(){o.items=[]},o.reset=function(p,b){p===void 0&&(p={}),p=io(p),o.internalSetState(function(v){var x=v.selectedItem;return ye({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,inputValue:o.props.itemToString(x)},p)},b)},o.toggleMenu=function(p,b){p===void 0&&(p={}),p=io(p),o.internalSetState(function(v){var x=v.isOpen;return ye({isOpen:!x},x&&{highlightedIndex:o.props.defaultHighlightedIndex},p)},function(){var v=o.getState(),x=v.isOpen,S=v.highlightedIndex;x&&o.getItemCount()>0&&typeof S=="number"&&o.setHighlightedIndex(S,p),ru(b)()})},o.openMenu=function(p){o.internalSetState({isOpen:!0},p)},o.closeMenu=function(p){o.internalSetState({isOpen:!1},p)},o.updateStatus=_a(function(){var p;if((p=o.props)!=null&&(p=p.environment)!=null&&p.document){var b=o.getState(),v=o.items[b.highlightedIndex],x=o.getItemCount(),S=o.props.getA11yStatusMessage(ye({itemToString:o.props.itemToString,previousResultCount:o.previousResultCount,resultCount:x,highlightedItem:v},b));o.previousResultCount=x,Od(S,o.props.environment.document)}},200);var s=o.props,a=s.defaultHighlightedIndex,u=s.initialHighlightedIndex,f=u===void 0?a:u,l=s.defaultIsOpen,d=s.initialIsOpen,h=d===void 0?l:d,m=s.initialInputValue,y=m===void 0?"":m,w=s.initialSelectedItem,g=w===void 0?null:w,O=o.getState({highlightedIndex:f,isOpen:h,inputValue:y,selectedItem:g});return O.selectedItem!=null&&o.props.initialInputValue===void 0&&(O.inputValue=o.props.itemToString(O.selectedItem)),o.state=O,o}qb(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),Oo(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(),u=this.getState(),f=u.highlightedIndex;if(a>0){var l=ur(f,o,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(l,s)}},r.getStateAndHelpers=function(){var o=this.getState(),s=o.highlightedIndex,a=o.inputValue,u=o.selectedItem,f=o.isOpen,l=this.props.itemToString,d=this.id,h=this.getRootProps,m=this.getToggleButtonProps,y=this.getLabelProps,w=this.getMenuProps,g=this.getInputProps,O=this.getItemProps,p=this.openMenu,b=this.closeMenu,v=this.toggleMenu,x=this.selectItem,S=this.selectItemAtIndex,A=this.selectHighlightedItem,N=this.setHighlightedIndex,F=this.clearSelection,R=this.clearItems,D=this.reset,K=this.setItemCount,j=this.unsetItemCount,L=this.internalSetState;return{getRootProps:h,getToggleButtonProps:m,getLabelProps:y,getMenuProps:w,getInputProps:g,getItemProps:O,reset:D,openMenu:p,closeMenu:b,toggleMenu:v,selectItem:x,selectItemAtIndex:S,selectHighlightedItem:A,setHighlightedIndex:N,clearSelection:F,clearItems:R,setItemCount:K,unsetItemCount:j,setState:L,itemToString:l,id:d,highlightedIndex:s,inputValue:a,isOpen:f,selectedItem:u}},r.componentDidMount=function(){var o=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&su(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){o.internalClearTimeouts()};else{var s=function(){o.isMouseDown=!0},a=function(m){o.isMouseDown=!1;var y=So(m.target,[o._rootNode,o._menuNode],o.props.environment);!y&&o.getState().isOpen&&o.reset({type:Sd},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},u=function(){o.isTouchMove=!1},f=function(){o.isTouchMove=!0},l=function(m){var y=So(m.target,[o._rootNode,o._menuNode],o.props.environment,!1);!o.isTouchMove&&!y&&o.getState().isOpen&&o.reset({type:Ld},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},d=this.props.environment;d.addEventListener("mousedown",s),d.addEventListener("mouseup",a),d.addEventListener("touchstart",u),d.addEventListener("touchmove",f),d.addEventListener("touchend",l),this.cleanup=function(){o.internalClearTimeouts(),o.updateStatus.cancel(),d.removeEventListener("mousedown",s),d.removeEventListener("mouseup",a),d.removeEventListener("touchstart",u),d.removeEventListener("touchmove",f),d.removeEventListener("touchend",l)}}},r.shouldScroll=function(o,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,u=a.highlightedIndex,f=s.highlightedIndex===void 0?o:s,l=f.highlightedIndex,d=u&&this.getState().isOpen&&!o.isOpen,h=u!==l;return d||h},r.componentDidUpdate=function(o,s){process.env.NODE_ENV!=="production"&&(Sa(this.state,o,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&su(this._menuNode,this.getMenuProps)),_o(this.props,"selectedItem")&&this.props.selectedItemChanged(o.selectedItem,this.props.selectedItem)&&this.internalSetState({type:jd,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=ou(this.props.children,Tt);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=ou(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&&yI(s,this.getRootProps),s;if(Id(s))return I.cloneElement(s,this.getRootProps(Cd(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}(I.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:iI,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&aI(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:Tt,onInputValueChange:Tt,onUserAction:Tt,onChange:Tt,onSelect:Tt,onOuterClick:Tt,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:wd},e.stateChangeTypes=lI,e}();process.env.NODE_ENV!=="production"&&(gI.propTypes={children:W.func,defaultHighlightedIndex:W.number,defaultIsOpen:W.bool,initialHighlightedIndex:W.number,initialSelectedItem:W.any,initialInputValue:W.string,initialIsOpen:W.bool,getA11yStatusMessage:W.func,itemToString:W.func,onChange:W.func,onSelect:W.func,onStateChange:W.func,onInputValueChange:W.func,onUserAction:W.func,onOuterClick:W.func,selectedItemChanged:W.func,stateReducer:W.func,itemCount:W.number,id:W.string,environment:W.shape({addEventListener:W.func.isRequired,removeEventListener:W.func.isRequired,document:W.shape({createElement:W.func.isRequired,getElementById:W.func.isRequired,activeElement:W.any.isRequired,body:W.any.isRequired}).isRequired,Node:W.func.isRequired}),suppressRefError:W.bool,scrollIntoView:W.func,selectedItem:W.any,isOpen:W.bool,inputValue:W.string,highlightedIndex:W.number,labelId:W.string,inputId:W.string,menuId:W.string,getItemId:W.func});function su(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 yI(e,t){var n=t.refKey,r=n!=="ref",i=!Id(e);i&&!r&&!eu.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+'"'),!eu.isForwardRef(e)&&!Cd(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Vd={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function vI(e,t,n){var r=e.props,i=e.type,o={};Object.keys(t).forEach(function(s){wI(s,e,t,n),n[s]!==t[s]&&(o[s]=n[s])}),r.onStateChange&&Object.keys(o).length&&r.onStateChange(ye({type:i},o))}function wI(e,t,n,r){var i=t.props,o=t.type,s="on"+Ea(e)+"Change";i[s]&&r[e]!==void 0&&r[e]!==n[e]&&i[s](ye({type:o},r))}function bI(e,t){return t.changes}var au=_a(function(e,t){Od(e,t)},200),II=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?I.useLayoutEffect:I.useEffect,CI="useId"in I?function(t){var n=t.id,r=t.labelId,i=t.menuId,o=t.getItemId,s=t.toggleButtonId,a=t.inputId,u="downshift-"+I.useId();n||(n=u);var f=I.useRef({labelId:r||n+"-label",menuId:i||n+"-menu",getItemId:o||function(l){return n+"-item-"+l},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"});return f.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+bd():n,i=t.labelId,o=t.menuId,s=t.getItemId,a=t.toggleButtonId,u=t.inputId,f=I.useRef({labelId:i||r+"-label",menuId:o||r+"-menu",getItemId:s||function(l){return r+"-item-"+l},toggleButtonId:a||r+"-toggle-button",inputId:u||r+"-input"});return f.current};function xI(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 Ea(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function $d(e){var t=I.useRef(e);return t.current=e,t}function OI(e,t,n,r){var i=I.useRef(),o=I.useRef(),s=I.useCallback(function(m,y){o.current=y,m=Oo(m,y.props);var w=e(m,y),g=y.props.stateReducer(m,ye({},y,{changes:w}));return g},[e]),a=I.useReducer(s,t,n),u=a[0],f=a[1],l=$d(t),d=I.useCallback(function(m){return f(ye({props:l.current},m))},[l]),h=o.current;return I.useEffect(function(){var m=Oo(i.current,h==null?void 0:h.props),y=h&&i.current&&!r(m,u);y&&vI(h,m,u),i.current=u},[u,h,r]),[u,d]}var wi={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:bI,scrollIntoView:wd,environment:typeof window>"u"?void 0:window};function zn(e,t,n){n===void 0&&(n=Vd);var r=e["default"+Ea(t)];return r!==void 0?r:n[t]}function bi(e,t,n){n===void 0&&(n=Vd);var r=e[t];if(r!==void 0)return r;var i=e["initial"+Ea(t)];return i!==void 0?i:zn(e,t,n)}function _I(e){var t=bi(e,"selectedItem"),n=bi(e,"isOpen"),r=RI(e),i=bi(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 Ii(e,t,n){var r=e.items,i=e.initialHighlightedIndex,o=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,u=t.selectedItem,f=t.highlightedIndex;return r.length===0?-1:i!==void 0&&f===i&&!s(r[i],i)?i:o!==void 0&&!s(r[o],o)?o:u?r.findIndex(function(l){return a(u)===a(l)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function SI(e,t,n){var r=I.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return I.useEffect(function(){if(!e)return Tt;var i=n.map(function(l){return l.current});function o(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(l){r.current.isMouseDown=!1,So(l.target,i,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function u(){r.current.isTouchMove=!0}function f(l){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!So(l.target,i,e,!1)&&t()}return e.addEventListener("mousedown",o),e.addEventListener("mouseup",s),e.addEventListener("touchstart",a),e.addEventListener("touchmove",u),e.addEventListener("touchend",f),function(){e.removeEventListener("mousedown",o),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",u),e.removeEventListener("touchend",f)}},[n,e,t]),r.current}var Kd=function(){return Tt};process.env.NODE_ENV!=="production"&&(Kd=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=I.useRef(n.reduce(function(s,a){return s[a]={},s},{}));I.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 u=a.suppressRefError,f=a.refKey,l=a.elementRef;u||l!=null&&l.current||console.error('downshift: The ref prop "'+f+'" from '+s+" was not applied correctly on your element.")})},[]);var o=I.useCallback(function(s,a,u,f){i.current[s]={suppressRefError:a,refKey:u,elementRef:f}},[]);return o});function EI(e,t,n,r){r===void 0&&(r={});var i=r.document,o=qo();I.useEffect(function(){if(!(!e||o||!i)){var s=e(t);au(s,i)}},n),I.useEffect(function(){return function(){au.cancel(),uI(i)}},[i])}function NI(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,i=e.getItemNodeFromIndex,o=e.menuElement,s=e.scrollIntoView,a=I.useRef(!0);return II(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(i(t),o))},[t]),a}var Ud=Tt;process.env.NODE_ENV!=="production"&&(Ud=function(t){var n=t.props,r=t.state,i=I.useRef(n),o=qo();I.useEffect(function(){o||(Sa(r,i.current,n),i.current=n)},[r,n,o])});function cu(e,t,n){var r;n===void 0&&(n=!0);var i=((r=e.items)==null?void 0:r.length)&&t>=0;return ye({isOpen:!1,highlightedIndex:-1},i&&ye({selectedItem:e.items[t],isOpen:zn(e,"isOpen"),highlightedIndex:zn(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function TI(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function qo(){var e=I.useRef(!0);return I.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function Gs(e){var t=zn(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function RI(e){var t=bi(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var po={environment:W.shape({addEventListener:W.func.isRequired,removeEventListener:W.func.isRequired,document:W.shape({createElement:W.func.isRequired,getElementById:W.func.isRequired,activeElement:W.any.isRequired,body:W.any.isRequired}).isRequired,Node:W.func.isRequired}),itemToString:W.func,itemToKey:W.func,stateReducer:W.func},qd=ye({},po,{getA11yStatusMessage:W.func,highlightedIndex:W.number,defaultHighlightedIndex:W.number,initialHighlightedIndex:W.number,isOpen:W.bool,defaultIsOpen:W.bool,initialIsOpen:W.bool,selectedItem:W.any,initialSelectedItem:W.any,defaultSelectedItem:W.any,id:W.string,labelId:W.string,menuId:W.string,getItemId:W.func,toggleButtonId:W.string,onSelectedItemChange:W.func,onHighlightedIndexChange:W.func,onStateChange:W.func,onIsOpenChange:W.func,scrollIntoView:W.func});function AI(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:Ii(i,e,0)};break;case n.FunctionOpenMenu:o={isOpen:!0,highlightedIndex:Ii(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:Gs(i),isOpen:zn(i,"isOpen"),selectedItem:zn(i,"selectedItem"),inputValue:zn(i,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return ye({},e,o)}Xr(Xr({},qd),{items:W.array.isRequired,isItemDisabled:W.func});Xr(Xr({},wi),{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 Na=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Ta=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Ra=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Aa=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,Fa=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Pa=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,Da=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,Ma=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,ka=process.env.NODE_ENV!=="production"?"__input_change__":8,Eo=process.env.NODE_ENV!=="production"?"__input_blur__":9,ja=process.env.NODE_ENV!=="production"?"__input_click__":10,Bd=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,Jd=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,La=process.env.NODE_ENV!=="production"?"__item_click__":13,Hd=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,Wd=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,zd=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,Qd=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,Gd=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,Va=process.env.NODE_ENV!=="production"?"__function_select_item__":19,Xd=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,Yd=process.env.NODE_ENV!=="production"?"__function_reset__":21,$a=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,Zd=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:$a,FunctionCloseMenu:Qd,FunctionOpenMenu:zd,FunctionReset:Yd,FunctionSelectItem:Va,FunctionSetHighlightedIndex:Gd,FunctionSetInputValue:Xd,FunctionToggleMenu:Wd,InputBlur:Eo,InputChange:ka,InputClick:ja,InputKeyDownArrowDown:Na,InputKeyDownArrowUp:Ta,InputKeyDownEnd:Fa,InputKeyDownEnter:Ma,InputKeyDownEscape:Ra,InputKeyDownHome:Aa,InputKeyDownPageDown:Da,InputKeyDownPageUp:Pa,ItemClick:La,ItemMouseMove:Jd,MenuMouseLeave:Bd,ToggleButtonClick:Hd});function FI(e){var t=_I(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)),ye({},t,{inputValue:r})}var PI=ye({},qd,{items:W.array.isRequired,isItemDisabled:W.func,inputValue:W.string,defaultInputValue:W.string,initialInputValue:W.string,inputId:W.string,onInputValueChange:W.func});function DI(e,t,n,r){var i=I.useRef(),o=OI(e,t,n,r),s=o[0],a=o[1],u=qo();return I.useEffect(function(){if(_o(t,"selectedItem")){if(!u){var f=t.itemToKey(t.selectedItem)!==t.itemToKey(i.current);f&&a({type:$a,inputValue:t.itemToString(t.selectedItem)})}i.current=s.selectedItem===i.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[Oo(s,t),a]}var ef=Tt;process.env.NODE_ENV!=="production"&&(ef=function(t,n){W.checkPropTypes(PI,t,"prop",n.name)});var MI=ye({},wi,{isItemDisabled:function(){return!1}});function kI(e,t){var n,r=t.type,i=t.props,o=t.altKey,s;switch(r){case La:s={isOpen:zn(i,"isOpen"),highlightedIndex:Gs(i),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case Na:e.isOpen?s={highlightedIndex:ur(e.highlightedIndex,1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:o&&e.selectedItem==null?-1:Ii(i,e,1),isOpen:i.items.length>=0};break;case Ta:e.isOpen?o?s=cu(i,e.highlightedIndex):s={highlightedIndex:ur(e.highlightedIndex,-1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:Ii(i,e,-1),isOpen:i.items.length>=0};break;case Ma:s=cu(i,e.highlightedIndex);break;case Ra:s=ye({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Pa:s={highlightedIndex:ur(e.highlightedIndex,-10,i.items,i.isItemDisabled,!0)};break;case Da:s={highlightedIndex:ur(e.highlightedIndex,10,i.items,i.isItemDisabled,!0)};break;case Aa:s={highlightedIndex:Yr(0,!1,i.items,i.isItemDisabled)};break;case Fa:s={highlightedIndex:Yr(i.items.length-1,!0,i.items,i.isItemDisabled)};break;case Eo:s=ye({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 ka:s={isOpen:!0,highlightedIndex:Gs(i),inputValue:t.inputValue};break;case ja:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Ii(i,e,0)};break;case Va:s={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case $a:s={inputValue:t.inputValue};break;default:return AI(e,t,Zd)}return ye({},e,s)}var jI=["onMouseLeave","refKey","ref"],LI=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],VI=["onClick","onPress","refKey","ref"],$I=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];Ka.stateChangeTypes=Zd;function Ka(e){e===void 0&&(e={}),ef(e,Ka);var t=ye({},MI,e),n=t.items,r=t.scrollIntoView,i=t.environment,o=t.getA11yStatusMessage,s=DI(kI,t,FI,TI),a=s[0],u=s[1],f=a.isOpen,l=a.highlightedIndex,d=a.selectedItem,h=a.inputValue,m=I.useRef(null),y=I.useRef({}),w=I.useRef(null),g=I.useRef(null),O=qo(),p=CI(t),b=I.useRef(),v=$d({state:a,props:t}),x=I.useCallback(function(H){return y.current[p.getItemId(H)]},[p]);EI(o,a,[f,l,d,h],i);var S=NI({menuElement:m.current,highlightedIndex:l,isOpen:f,itemRefs:y,scrollIntoView:r,getItemNodeFromIndex:x});Ud({props:t,state:a}),I.useEffect(function(){var H=bi(t,"isOpen");H&&w.current&&w.current.focus()},[]),I.useEffect(function(){O||(b.current=n.length)});var A=SI(i,I.useCallback(function(){v.current.state.isOpen&&u({type:Eo,selectItem:!1})},[u,v]),I.useMemo(function(){return[m,g,w]},[m.current,g.current,w.current])),N=Kd("getInputProps","getMenuProps");I.useEffect(function(){f||(y.current={})},[f]),I.useEffect(function(){var H;!f||!(i!=null&&i.document)||!(w!=null&&(H=w.current)!=null&&H.focus)||i.document.activeElement!==w.current&&w.current.focus()},[f,i]);var F=I.useMemo(function(){return{ArrowDown:function(U){U.preventDefault(),u({type:Na,altKey:U.altKey})},ArrowUp:function(U){U.preventDefault(),u({type:Ta,altKey:U.altKey})},Home:function(U){v.current.state.isOpen&&(U.preventDefault(),u({type:Aa}))},End:function(U){v.current.state.isOpen&&(U.preventDefault(),u({type:Fa}))},Escape:function(U){var q=v.current.state;(q.isOpen||q.inputValue||q.selectedItem||q.highlightedIndex>-1)&&(U.preventDefault(),u({type:Ra}))},Enter:function(U){var q=v.current.state;!q.isOpen||U.which===229||(U.preventDefault(),u({type:Ma}))},PageUp:function(U){v.current.state.isOpen&&(U.preventDefault(),u({type:Pa}))},PageDown:function(U){v.current.state.isOpen&&(U.preventDefault(),u({type:Da}))}}},[u,v]),R=I.useCallback(function(H){return ye({id:p.labelId,htmlFor:p.inputId},H)},[p]),D=I.useCallback(function(H,U){var q,V=H===void 0?{}:H,G=V.onMouseLeave,Z=V.refKey,Y=Z===void 0?"ref":Z,ee=V.ref,ne=Cn(V,jI),ce=U===void 0?{}:U,k=ce.suppressRefError,ve=k===void 0?!1:k;return N("getMenuProps",ve,Y,m),ye((q={},q[Y]=Fr(ee,function(z){m.current=z}),q.id=p.menuId,q.role="listbox",q["aria-labelledby"]=ne&&ne["aria-label"]?void 0:""+p.labelId,q.onMouseLeave=Qe(G,function(){u({type:Bd})}),q),ne)},[u,N,p]),K=I.useCallback(function(H){var U,q,V=H===void 0?{}:H,G=V.item,Z=V.index,Y=V.refKey,ee=Y===void 0?"ref":Y,ne=V.ref,ce=V.onMouseMove,k=V.onMouseDown,ve=V.onClick;V.onPress;var z=V.disabled,Xe=Cn(V,LI);z!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Ce=v.current,st=Ce.props,Ue=Ce.state,rt=xI(G,Z,st.items,"Pass either item or index to getItemProps!"),xe=rt[0],ze=rt[1],ft=st.isItemDisabled(xe,ze),yt="onClick",vt=ve,Ye=function(){A.isTouchEnd||ze===Ue.highlightedIndex||(S.current=!1,u({type:Jd,index:ze,disabled:ft}))},Ze=function(){u({type:La,index:ze})},De=function(pe){return pe.preventDefault()};return ye((U={},U[ee]=Fr(ne,function(J){J&&(y.current[p.getItemId(ze)]=J)}),U["aria-disabled"]=ft,U["aria-selected"]=ze===Ue.highlightedIndex,U.id=p.getItemId(ze),U.role="option",U),!ft&&(q={},q[yt]=Qe(vt,Ze),q),{onMouseMove:Qe(ce,Ye),onMouseDown:Qe(k,De)},Xe)},[u,p,v,A,S]),j=I.useCallback(function(H){var U,q=H===void 0?{}:H,V=q.onClick;q.onPress;var G=q.refKey,Z=G===void 0?"ref":G,Y=q.ref,ee=Cn(q,VI),ne=v.current.state,ce=function(){u({type:Hd})};return ye((U={},U[Z]=Fr(Y,function(k){g.current=k}),U["aria-controls"]=p.menuId,U["aria-expanded"]=ne.isOpen,U.id=p.toggleButtonId,U.tabIndex=-1,U),!ee.disabled&&ye({},{onClick:Qe(V,ce)}),ee)},[u,v,p]),L=I.useCallback(function(H,U){var q,V=H===void 0?{}:H,G=V.onKeyDown,Z=V.onChange,Y=V.onInput,ee=V.onBlur;V.onChangeText;var ne=V.onClick,ce=V.refKey,k=ce===void 0?"ref":ce,ve=V.ref,z=Cn(V,$I),Xe=U===void 0?{}:U,Ce=Xe.suppressRefError,st=Ce===void 0?!1:Ce;N("getInputProps",st,k,w);var Ue=v.current.state,rt=function(De){var J=zs(De);J&&F[J]&&F[J](De)},xe=function(De){u({type:ka,inputValue:De.target.value})},ze=function(De){if(i!=null&&i.document&&Ue.isOpen&&!A.isMouseDown){var J=De.relatedTarget===null&&i.document.activeElement!==i.document.body;u({type:Eo,selectItem:!J})}},ft=function(){u({type:ja})},yt="onChange",vt={};if(!z.disabled){var Ye;vt=(Ye={},Ye[yt]=Qe(Z,Y,xe),Ye.onKeyDown=Qe(G,rt),Ye.onBlur=Qe(ee,ze),Ye.onClick=Qe(ne,ft),Ye)}return ye((q={},q[k]=Fr(ve,function(Ze){w.current=Ze}),q["aria-activedescendant"]=Ue.isOpen&&Ue.highlightedIndex>-1?p.getItemId(Ue.highlightedIndex):"",q["aria-autocomplete"]="list",q["aria-controls"]=p.menuId,q["aria-expanded"]=Ue.isOpen,q["aria-labelledby"]=z&&z["aria-label"]?void 0:p.labelId,q.autoComplete="off",q.id=p.inputId,q.role="combobox",q.value=Ue.inputValue,q),vt,z)},[u,p,i,F,v,A,N]),se=I.useCallback(function(){u({type:Wd})},[u]),re=I.useCallback(function(){u({type:Qd})},[u]),ge=I.useCallback(function(){u({type:zd})},[u]),de=I.useCallback(function(H){u({type:Gd,highlightedIndex:H})},[u]),be=I.useCallback(function(H){u({type:Va,selectedItem:H})},[u]),P=I.useCallback(function(H){u({type:Xd,inputValue:H})},[u]),$=I.useCallback(function(){u({type:Yd})},[u]);return{getItemProps:K,getLabelProps:R,getMenuProps:D,getInputProps:L,getToggleButtonProps:j,toggleMenu:se,openMenu:ge,closeMenu:re,setHighlightedIndex:de,setInputValue:P,selectItem:be,reset:$,highlightedIndex:l,isOpen:f,selectedItem:d,inputValue:h}}po.stateReducer,po.itemToKey,po.environment,W.array,W.array,W.array,W.func,W.number,W.number,W.number,W.func,W.func,W.string,W.string;wi.itemToKey,wi.stateReducer,wi.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 KI="_comboboxContainer_1lcc8_1",UI="_inputContainer_1lcc8_12",qI="_input_1lcc8_12",BI="_toggleButton_1lcc8_33",JI="_menu_1lcc8_39",HI="_menuBottom_1lcc8_55",WI="_menuTop_1lcc8_61",zI="_menuItem_1lcc8_66",QI="_highlighted_1lcc8_73",GI="_selected_1lcc8_77",XI="_hidden_1lcc8_81",qt={comboboxContainer:KI,inputContainer:UI,input:qI,toggleButton:BI,menu:JI,menuBottom:HI,menuTop:WI,menuItem:zI,highlighted:QI,selected:GI,hidden:XI};function YI(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function tf({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:i,style:o,menuPosition:s="bottom"}){const[a,u]=I.useState(e),f=I.useRef(null);I.useEffect(()=>u(e),[e]);const l=I.useCallback(S=>{(S==null?void 0:S.length)>0?u(e.filter(YI(S))):u(e)},[e]),{isOpen:d,getToggleButtonProps:h,getMenuProps:m,getInputProps:y,highlightedIndex:w,getItemProps:g,setInputValue:O}=Ka({items:a,selectedItem:t?e.find(S=>S.value===t):null,itemToString:S=>(S==null?void 0:S.label)||"",onInputValueChange:({inputValue:S})=>l(S),onSelectedItemChange:({selectedItem:S})=>{var A;n(S),(A=f.current)==null||A.blur()}}),p=()=>{O(""),u(e)},b=()=>p(),v=I.useMemo(()=>{var S;return(S=e.find(A=>A.value===t))==null?void 0:S.label},[e,t]),x=()=>{O(t&&v?v:"")};return c.jsxs("div",{style:{position:"relative",...o},children:[c.jsx("div",{className:qt.comboboxContainer,children:c.jsxs("div",{className:qt.inputContainer,children:[c.jsx("input",{style:{border:"none"},disabled:i,placeholder:r,className:qt.input,...y({onFocus:b,onBlur:x,ref:f})}),c.jsx("button",{style:{border:"none"},disabled:i,"aria-label":"toggle menu",className:qt.toggleButton,type:"button",...h(),children:d?c.jsx(c.Fragment,{children:"↑"}):c.jsx(c.Fragment,{children:"↓"})})]})}),c.jsx("ul",{className:`${qt.menu} ${d&&e.length?"":qt.hidden} ${s==="top"?qt.menuTop:qt.menuBottom}`,...m(),children:d&&a.map((S,A)=>c.jsx("li",{className:`${qt.menuItem} ${w===A?qt.highlighted:""} ${t===(S==null?void 0:S.value)?qt.selected:""}`,...g({item:S,index:A}),children:c.jsx("span",{children:S.label})},S.id))})]})}const Zr=Math.min,br=Math.max,No=Math.round,oo=Math.floor,Gn=e=>({x:e,y:e}),ZI={left:"right",right:"left",bottom:"top",top:"bottom"},e0={start:"end",end:"start"};function Xs(e,t,n){return br(e,Zr(t,n))}function ji(e,t){return typeof e=="function"?e(t):e}function _r(e){return e.split("-")[0]}function Li(e){return e.split("-")[1]}function nf(e){return e==="x"?"y":"x"}function Ua(e){return e==="y"?"height":"width"}function ei(e){return["top","bottom"].includes(_r(e))?"y":"x"}function qa(e){return nf(ei(e))}function t0(e,t,n){n===void 0&&(n=!1);const r=Li(e),i=qa(e),o=Ua(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=To(s)),[s,To(s)]}function n0(e){const t=To(e);return[Ys(e),t,Ys(t)]}function Ys(e){return e.replace(/start|end/g,t=>e0[t])}function r0(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 i0(e,t,n,r){const i=Li(e);let o=r0(_r(e),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(Ys)))),o}function To(e){return e.replace(/left|right|bottom|top/g,t=>ZI[t])}function o0(e){return{top:0,right:0,bottom:0,left:0,...e}}function rf(e){return typeof e!="number"?o0(e):{top:e,right:e,bottom:e,left:e}}function Ro(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 uu(e,t,n){let{reference:r,floating:i}=e;const o=ei(t),s=qa(t),a=Ua(s),u=_r(t),f=o==="y",l=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let m;switch(u){case"top":m={x:l,y:r.y-i.height};break;case"bottom":m={x:l,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:d};break;case"left":m={x:r.x-i.width,y:d};break;default:m={x:r.x,y:r.y}}switch(Li(t)){case"start":m[s]-=h*(n&&f?-1:1);break;case"end":m[s]+=h*(n&&f?-1:1);break}return m}const s0=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),u=await(s.isRTL==null?void 0:s.isRTL(t));let f=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:l,y:d}=uu(f,r,u),h=r,m={},y=0;for(let w=0;w<a.length;w++){const{name:g,fn:O}=a[w],{x:p,y:b,data:v,reset:x}=await O({x:l,y:d,initialPlacement:r,placement:h,strategy:i,middlewareData:m,rects:f,platform:s,elements:{reference:e,floating:t}});l=p??l,d=b??d,m={...m,[g]:{...m[g],...v}},x&&y<=50&&(y++,typeof x=="object"&&(x.placement&&(h=x.placement),x.rects&&(f=x.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:l,y:d}=uu(f,h,u)),w=-1)}return{x:l,y:d,placement:h,strategy:i,middlewareData:m}};async function of(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:u}=e,{boundary:f="clippingAncestors",rootBoundary:l="viewport",elementContext:d="floating",altBoundary:h=!1,padding:m=0}=ji(t,e),y=rf(m),g=a[h?d==="floating"?"reference":"floating":d],O=Ro(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(g)))==null||n?g:g.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:f,rootBoundary:l,strategy:u})),p=d==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,b=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),v=await(o.isElement==null?void 0:o.isElement(b))?await(o.getScale==null?void 0:o.getScale(b))||{x:1,y:1}:{x:1,y:1},x=Ro(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:p,offsetParent:b,strategy:u}):p);return{top:(O.top-x.top+y.top)/v.y,bottom:(x.bottom-O.bottom+y.bottom)/v.y,left:(O.left-x.left+y.left)/v.x,right:(x.right-O.right+y.right)/v.x}}const a0=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:u}=t,{element:f,padding:l=0}=ji(e,t)||{};if(f==null)return{};const d=rf(l),h={x:n,y:r},m=qa(i),y=Ua(m),w=await s.getDimensions(f),g=m==="y",O=g?"top":"left",p=g?"bottom":"right",b=g?"clientHeight":"clientWidth",v=o.reference[y]+o.reference[m]-h[m]-o.floating[y],x=h[m]-o.reference[m],S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(f));let A=S?S[b]:0;(!A||!await(s.isElement==null?void 0:s.isElement(S)))&&(A=a.floating[b]||o.floating[y]);const N=v/2-x/2,F=A/2-w[y]/2-1,R=Zr(d[O],F),D=Zr(d[p],F),K=R,j=A-w[y]-D,L=A/2-w[y]/2+N,se=Xs(K,L,j),re=!u.arrow&&Li(i)!=null&&L!==se&&o.reference[y]/2-(L<K?R:D)-w[y]/2<0,ge=re?L<K?L-K:L-j:0;return{[m]:h[m]+ge,data:{[m]:se,centerOffset:L-se-ge,...re&&{alignmentOffset:ge}},reset:re}}}),c0=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:u,elements:f}=t,{mainAxis:l=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:w=!0,...g}=ji(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const O=_r(i),p=ei(a),b=_r(a)===a,v=await(u.isRTL==null?void 0:u.isRTL(f.floating)),x=h||(b||!w?[To(a)]:n0(a)),S=y!=="none";!h&&S&&x.push(...i0(a,w,y,v));const A=[a,...x],N=await of(t,g),F=[];let R=((r=o.flip)==null?void 0:r.overflows)||[];if(l&&F.push(N[O]),d){const L=t0(i,s,v);F.push(N[L[0]],N[L[1]])}if(R=[...R,{placement:i,overflows:F}],!F.every(L=>L<=0)){var D,K;const L=(((D=o.flip)==null?void 0:D.index)||0)+1,se=A[L];if(se)return{data:{index:L,overflows:R},reset:{placement:se}};let re=(K=R.filter(ge=>ge.overflows[0]<=0).sort((ge,de)=>ge.overflows[1]-de.overflows[1])[0])==null?void 0:K.placement;if(!re)switch(m){case"bestFit":{var j;const ge=(j=R.filter(de=>{if(S){const be=ei(de.placement);return be===p||be==="y"}return!0}).map(de=>[de.placement,de.overflows.filter(be=>be>0).reduce((be,P)=>be+P,0)]).sort((de,be)=>de[1]-be[1])[0])==null?void 0:j[0];ge&&(re=ge);break}case"initialPlacement":re=a;break}if(i!==re)return{reset:{placement:re}}}return{}}}};async function u0(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=_r(n),a=Li(n),u=ei(n)==="y",f=["left","top"].includes(s)?-1:1,l=o&&u?-1:1,d=ji(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:y}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof y=="number"&&(m=a==="end"?y*-1:y),u?{x:m*l,y:h*f}:{x:h*f,y:m*l}}const l0=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,u=await u0(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+u.x,y:o+u.y,data:{...u,placement:s}}}}},d0=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:g=>{let{x:O,y:p}=g;return{x:O,y:p}}},...u}=ji(e,t),f={x:n,y:r},l=await of(t,u),d=ei(_r(i)),h=nf(d);let m=f[h],y=f[d];if(o){const g=h==="y"?"top":"left",O=h==="y"?"bottom":"right",p=m+l[g],b=m-l[O];m=Xs(p,m,b)}if(s){const g=d==="y"?"top":"left",O=d==="y"?"bottom":"right",p=y+l[g],b=y-l[O];y=Xs(p,y,b)}const w=a.fn({...t,[h]:m,[d]:y});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[h]:o,[d]:s}}}}}};function Bo(){return typeof window<"u"}function ui(e){return sf(e)?(e.nodeName||"").toLowerCase():"#document"}function Rt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function un(e){var t;return(t=(sf(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function sf(e){return Bo()?e instanceof Node||e instanceof Rt(e).Node:!1}function zt(e){return Bo()?e instanceof Element||e instanceof Rt(e).Element:!1}function on(e){return Bo()?e instanceof HTMLElement||e instanceof Rt(e).HTMLElement:!1}function lu(e){return!Bo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Rt(e).ShadowRoot}function Vi(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Qt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function f0(e){return["table","td","th"].includes(ui(e))}function Jo(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Ba(e){const t=Ja(),n=zt(e)?Qt(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 p0(e){let t=Xn(e);for(;on(t)&&!ti(t);){if(Ba(t))return t;if(Jo(t))return null;t=Xn(t)}return null}function Ja(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ti(e){return["html","body","#document"].includes(ui(e))}function Qt(e){return Rt(e).getComputedStyle(e)}function Ho(e){return zt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Xn(e){if(ui(e)==="html")return e;const t=e.assignedSlot||e.parentNode||lu(e)&&e.host||un(e);return lu(t)?t.host:t}function af(e){const t=Xn(e);return ti(t)?e.ownerDocument?e.ownerDocument.body:e.body:on(t)&&Vi(t)?t:af(t)}function Si(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=af(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),s=Rt(i);if(o){const a=Zs(s);return t.concat(s,s.visualViewport||[],Vi(i)?i:[],a&&n?Si(a):[])}return t.concat(i,Si(i,[],n))}function Zs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function cf(e){const t=Qt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=on(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=No(n)!==o||No(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function Ha(e){return zt(e)?e:e.contextElement}function Pr(e){const t=Ha(e);if(!on(t))return Gn(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=cf(t);let s=(o?No(n.width):n.width)/r,a=(o?No(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const h0=Gn(0);function uf(e){const t=Rt(e);return!Ja()||!t.visualViewport?h0:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function m0(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Rt(e)?!1:t}function Sr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=Ha(e);let s=Gn(1);t&&(r?zt(r)&&(s=Pr(r)):s=Pr(e));const a=m0(o,n,r)?uf(o):Gn(0);let u=(i.left+a.x)/s.x,f=(i.top+a.y)/s.y,l=i.width/s.x,d=i.height/s.y;if(o){const h=Rt(o),m=r&&zt(r)?Rt(r):r;let y=h,w=Zs(y);for(;w&&r&&m!==y;){const g=Pr(w),O=w.getBoundingClientRect(),p=Qt(w),b=O.left+(w.clientLeft+parseFloat(p.paddingLeft))*g.x,v=O.top+(w.clientTop+parseFloat(p.paddingTop))*g.y;u*=g.x,f*=g.y,l*=g.x,d*=g.y,u+=b,f+=v,y=Rt(w),w=Zs(y)}}return Ro({width:l,height:d,x:u,y:f})}function g0(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",s=un(r),a=t?Jo(t.floating):!1;if(r===s||a&&o)return n;let u={scrollLeft:0,scrollTop:0},f=Gn(1);const l=Gn(0),d=on(r);if((d||!d&&!o)&&((ui(r)!=="body"||Vi(s))&&(u=Ho(r)),on(r))){const h=Sr(r);f=Pr(r),l.x=h.x+r.clientLeft,l.y=h.y+r.clientTop}return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-u.scrollLeft*f.x+l.x,y:n.y*f.y-u.scrollTop*f.y+l.y}}function y0(e){return Array.from(e.getClientRects())}function ea(e,t){const n=Ho(e).scrollLeft;return t?t.left+n:Sr(un(e)).left+n}function v0(e){const t=un(e),n=Ho(e),r=e.ownerDocument.body,i=br(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=br(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+ea(e);const a=-n.scrollTop;return Qt(r).direction==="rtl"&&(s+=br(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function w0(e,t){const n=Rt(e),r=un(e),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,u=0;if(i){o=i.width,s=i.height;const f=Ja();(!f||f&&t==="fixed")&&(a=i.offsetLeft,u=i.offsetTop)}return{width:o,height:s,x:a,y:u}}function b0(e,t){const n=Sr(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=on(e)?Pr(e):Gn(1),s=e.clientWidth*o.x,a=e.clientHeight*o.y,u=i*o.x,f=r*o.y;return{width:s,height:a,x:u,y:f}}function du(e,t,n){let r;if(t==="viewport")r=w0(e,n);else if(t==="document")r=v0(un(e));else if(zt(t))r=b0(t,n);else{const i=uf(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return Ro(r)}function lf(e,t){const n=Xn(e);return n===t||!zt(n)||ti(n)?!1:Qt(n).position==="fixed"||lf(n,t)}function I0(e,t){const n=t.get(e);if(n)return n;let r=Si(e,[],!1).filter(a=>zt(a)&&ui(a)!=="body"),i=null;const o=Qt(e).position==="fixed";let s=o?Xn(e):e;for(;zt(s)&&!ti(s);){const a=Qt(s),u=Ba(s);!u&&a.position==="fixed"&&(i=null),(o?!u&&!i:!u&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Vi(s)&&!u&&lf(e,s))?r=r.filter(l=>l!==s):i=a,s=Xn(s)}return t.set(e,r),r}function C0(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?Jo(t)?[]:I0(t,this._c):[].concat(n),r],a=s[0],u=s.reduce((f,l)=>{const d=du(t,l,i);return f.top=br(d.top,f.top),f.right=Zr(d.right,f.right),f.bottom=Zr(d.bottom,f.bottom),f.left=br(d.left,f.left),f},du(t,a,i));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function x0(e){const{width:t,height:n}=cf(e);return{width:t,height:n}}function O0(e,t,n){const r=on(t),i=un(t),o=n==="fixed",s=Sr(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const u=Gn(0);if(r||!r&&!o)if((ui(t)!=="body"||Vi(i))&&(a=Ho(t)),r){const m=Sr(t,!0,o,t);u.x=m.x+t.clientLeft,u.y=m.y+t.clientTop}else i&&(u.x=ea(i));let f=0,l=0;if(i&&!r&&!o){const m=i.getBoundingClientRect();l=m.top+a.scrollTop,f=m.left+a.scrollLeft-ea(i,m)}const d=s.left+a.scrollLeft-u.x-f,h=s.top+a.scrollTop-u.y-l;return{x:d,y:h,width:s.width,height:s.height}}function gs(e){return Qt(e).position==="static"}function fu(e,t){if(!on(e)||Qt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return un(e)===n&&(n=n.ownerDocument.body),n}function df(e,t){const n=Rt(e);if(Jo(e))return n;if(!on(e)){let i=Xn(e);for(;i&&!ti(i);){if(zt(i)&&!gs(i))return i;i=Xn(i)}return n}let r=fu(e,t);for(;r&&f0(r)&&gs(r);)r=fu(r,t);return r&&ti(r)&&gs(r)&&!Ba(r)?n:r||p0(e)||n}const _0=async function(e){const t=this.getOffsetParent||df,n=this.getDimensions,r=await n(e.floating);return{reference:O0(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function S0(e){return Qt(e).direction==="rtl"}const E0={convertOffsetParentRelativeRectToViewportRelativeRect:g0,getDocumentElement:un,getClippingRect:C0,getOffsetParent:df,getElementRects:_0,getClientRects:y0,getDimensions:x0,getScale:Pr,isElement:zt,isRTL:S0};function N0(e,t){let n=null,r;const i=un(e);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,u){a===void 0&&(a=!1),u===void 0&&(u=1),o();const{left:f,top:l,width:d,height:h}=e.getBoundingClientRect();if(a||t(),!d||!h)return;const m=oo(l),y=oo(i.clientWidth-(f+d)),w=oo(i.clientHeight-(l+h)),g=oo(f),p={rootMargin:-m+"px "+-y+"px "+-w+"px "+-g+"px",threshold:br(0,Zr(1,u))||1};let b=!0;function v(x){const S=x[0].intersectionRatio;if(S!==u){if(!b)return s();S?s(!1,S):r=setTimeout(()=>{s(!1,1e-7)},1e3)}b=!1}try{n=new IntersectionObserver(v,{...p,root:i.ownerDocument})}catch{n=new IntersectionObserver(v,p)}n.observe(e)}return s(!0),o}function T0(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:u=!1}=r,f=Ha(e),l=i||o?[...f?Si(f):[],...Si(t)]:[];l.forEach(O=>{i&&O.addEventListener("scroll",n,{passive:!0}),o&&O.addEventListener("resize",n)});const d=f&&a?N0(f,n):null;let h=-1,m=null;s&&(m=new ResizeObserver(O=>{let[p]=O;p&&p.target===f&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var b;(b=m)==null||b.observe(t)})),n()}),f&&!u&&m.observe(f),m.observe(t));let y,w=u?Sr(e):null;u&&g();function g(){const O=Sr(e);w&&(O.x!==w.x||O.y!==w.y||O.width!==w.width||O.height!==w.height)&&n(),w=O,y=requestAnimationFrame(g)}return n(),()=>{var O;l.forEach(p=>{i&&p.removeEventListener("scroll",n),o&&p.removeEventListener("resize",n)}),d==null||d(),(O=m)==null||O.disconnect(),m=null,u&&cancelAnimationFrame(y)}}const R0=l0,A0=d0,F0=c0,P0=a0,pu=(e,t,n)=>{const r=new Map,i={platform:E0,...n},o={...i.platform,_c:r};return s0(e,t,{...i,platform:o})};/*
46
- * React Tooltip
47
- * {@link https://github.com/ReactTooltip/react-tooltip}
48
- * @copyright ReactTooltip Team
49
- * @license MIT
50
- */const D0="react-tooltip-core-styles",M0="react-tooltip-base-styles",hu={core:!1,base:!1};function mu({css:e,id:t=M0,type:n="base",ref:r}){var i,o;if(!e||typeof document>"u"||hu[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=D0),r||(r={});const{insertAt:s}=r;if(document.getElementById(t))return;const a=document.head||document.getElementsByTagName("head")[0],u=document.createElement("style");u.id=t,u.type="text/css",s==="top"&&a.firstChild?a.insertBefore(u,a.firstChild):a.appendChild(u),u.styleSheet?u.styleSheet.cssText=e:u.appendChild(document.createTextNode(e)),hu[n]=!0}const gu=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:i=10,strategy:o="absolute",middlewares:s=[R0(Number(i)),F0({fallbackAxisSideDirection:"start"}),A0({padding:5})],border:a,arrowSize:u=8})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const f=s;return n?(f.push(P0({element:n,padding:5})),pu(e,t,{placement:r,strategy:o,middleware:f}).then(({x:l,y:d,placement:h,middlewareData:m})=>{var y,w;const g={left:`${l}px`,top:`${d}px`,border:a},{x:O,y:p}=(y=m.arrow)!==null&&y!==void 0?y:{x:0,y:0},b=(w={top:"bottom",right:"left",bottom:"top",left:"right"}[h.split("-")[0]])!==null&&w!==void 0?w:"bottom",v=a&&{borderBottom:a,borderRight:a};let x=0;if(a){const S=`${a}`.match(/(\d+)px/);x=S!=null&&S[1]?Number(S[1]):1}return{tooltipStyles:g,tooltipArrowStyles:{left:O!=null?`${O}px`:"",top:p!=null?`${p}px`:"",right:"",bottom:"",...v,[b]:`-${u/2+x}px`},place:h}})):pu(e,t,{placement:"bottom",strategy:o,middleware:f}).then(({x:l,y:d,placement:h})=>({tooltipStyles:{left:`${l}px`,top:`${d}px`},tooltipArrowStyles:{},place:h}))},yu=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),vu=(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},wu=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",ta=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((i,o)=>ta(i,t[o]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!wu(e)||!wu(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(i=>ta(e[i],t[i]))},k0=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"})},bu=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(k0(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},j0=typeof window<"u"?I.useLayoutEffect:I.useEffect,kt=e=>{e.current&&(clearTimeout(e.current),e.current=null)},L0="DEFAULT_TOOLTIP_ID",V0={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},$0=I.createContext({getTooltipData:()=>V0});function ff(e=L0){return I.useContext($0).getTooltipData(e)}var Ar={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"},ys={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 K0=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:i="dark",anchorId:o,anchorSelect:s,place:a="top",offset:u=10,events:f=["hover"],openOnClick:l=!1,positionStrategy:d="absolute",middlewares:h,wrapper:m,delayShow:y=0,delayHide:w=0,float:g=!1,hidden:O=!1,noArrow:p=!1,clickable:b=!1,closeOnEsc:v=!1,closeOnScroll:x=!1,closeOnResize:S=!1,openEvents:A,closeEvents:N,globalCloseEvents:F,imperativeModeOnly:R,style:D,position:K,afterShow:j,afterHide:L,disableTooltip:se,content:re,contentWrapperRef:ge,isOpen:de,defaultIsOpen:be=!1,setIsOpen:P,activeAnchor:$,setActiveAnchor:H,border:U,opacity:q,arrowColor:V,arrowSize:G=8,role:Z="tooltip"})=>{var Y;const ee=I.useRef(null),ne=I.useRef(null),ce=I.useRef(null),k=I.useRef(null),ve=I.useRef(null),[z,Xe]=I.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ce,st]=I.useState(!1),[Ue,rt]=I.useState(!1),[xe,ze]=I.useState(null),ft=I.useRef(!1),yt=I.useRef(null),{anchorRefs:vt,setActiveAnchor:Ye}=ff(t),Ze=I.useRef(!1),[De,J]=I.useState([]),pe=I.useRef(!1),_e=l||f.includes("click"),ln=_e||(A==null?void 0:A.click)||(A==null?void 0:A.dblclick)||(A==null?void 0:A.mousedown),dn=A?{...A}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!A&&_e&&Object.assign(dn,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const fn=N?{...N}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!N&&_e&&Object.assign(fn,{mouseleave:!1,blur:!1,mouseout:!1});const wt=F?{...F}:{escape:v||!1,scroll:x||!1,resize:S||!1,clickOutsideAnchor:ln||!1};R&&(Object.assign(dn,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(fn,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(wt,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),j0(()=>(pe.current=!0,()=>{pe.current=!1}),[]);const Fe=X=>{pe.current&&(X&&rt(!0),setTimeout(()=>{pe.current&&(P==null||P(X),de===void 0&&st(X))},10))};I.useEffect(()=>{if(de===void 0)return()=>null;de&&rt(!0);const X=setTimeout(()=>{st(de)},10);return()=>{clearTimeout(X)}},[de]),I.useEffect(()=>{if(Ce!==ft.current)if(kt(ve),ft.current=Ce,Ce)j==null||j();else{const X=(ue=>{const le=ue.match(/^([\d.]+)(ms|s)$/);if(!le)return 0;const[,Le,Be]=le;return Number(Le)*(Be==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));ve.current=setTimeout(()=>{rt(!1),ze(null),L==null||L()},X+25)}},[Ce]);const nr=X=>{Xe(ue=>ta(ue,X)?ue:X)},En=(X=y)=>{kt(ce),Ue?Fe(!0):ce.current=setTimeout(()=>{Fe(!0)},X)},Nn=(X=w)=>{kt(k),k.current=setTimeout(()=>{Ze.current||Fe(!1)},X)},St=X=>{var ue;if(!X)return;const le=(ue=X.currentTarget)!==null&&ue!==void 0?ue:X.target;if(!(le!=null&&le.isConnected))return H(null),void Ye({current:null});y?En():Fe(!0),H(le),Ye({current:le}),kt(k)},pn=()=>{b?Nn(w||100):w?Nn():Fe(!1),kt(ce)},Tn=({x:X,y:ue})=>{var le;const Le={getBoundingClientRect:()=>({x:X,y:ue,width:0,height:0,top:ue,left:X,right:X,bottom:ue})};gu({place:(le=xe==null?void 0:xe.place)!==null&&le!==void 0?le:a,offset:u,elementReference:Le,tooltipReference:ee.current,tooltipArrowReference:ne.current,strategy:d,middlewares:h,border:U,arrowSize:G}).then(Be=>{nr(Be)})},Rn=X=>{if(!X)return;const ue=X,le={x:ue.clientX,y:ue.clientY};Tn(le),yt.current=le},hn=X=>{var ue;if(!Ce)return;const le=X.target;le.isConnected&&(!((ue=ee.current)===null||ue===void 0)&&ue.contains(le)||[document.querySelector(`[id='${o}']`),...De].some(Le=>Le==null?void 0:Le.contains(le))||(Fe(!1),kt(ce)))},Xt=vu(St,50),je=vu(pn,50),at=X=>{je.cancel(),Xt(X)},ae=()=>{Xt.cancel(),je()},he=I.useCallback(()=>{var X,ue;const le=(X=xe==null?void 0:xe.position)!==null&&X!==void 0?X:K;le?Tn(le):g?yt.current&&Tn(yt.current):$!=null&&$.isConnected&&gu({place:(ue=xe==null?void 0:xe.place)!==null&&ue!==void 0?ue:a,offset:u,elementReference:$,tooltipReference:ee.current,tooltipArrowReference:ne.current,strategy:d,middlewares:h,border:U,arrowSize:G}).then(Le=>{pe.current&&nr(Le)})},[Ce,$,re,D,a,xe==null?void 0:xe.place,u,d,K,xe==null?void 0:xe.position,g,G]);I.useEffect(()=>{var X,ue;const le=new Set(vt);De.forEach(Oe=>{se!=null&&se(Oe)||le.add({current:Oe})});const Le=document.querySelector(`[id='${o}']`);Le&&!(se!=null&&se(Le))&&le.add({current:Le});const Be=()=>{Fe(!1)},et=bu($),Pt=bu(ee.current);wt.scroll&&(window.addEventListener("scroll",Be),et==null||et.addEventListener("scroll",Be),Pt==null||Pt.addEventListener("scroll",Be));let it=null;wt.resize?window.addEventListener("resize",Be):$&&ee.current&&(it=T0($,ee.current,he,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const bt=Oe=>{Oe.key==="Escape"&&Fe(!1)};wt.escape&&window.addEventListener("keydown",bt),wt.clickOutsideAnchor&&window.addEventListener("click",hn);const Ae=[],An=Oe=>!!(Oe!=null&&Oe.target&&($!=null&&$.contains(Oe.target))),$t=Oe=>{Ce&&An(Oe)||St(Oe)},Xo=Oe=>{Ce&&An(Oe)&&pn()},Ui=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],qi=["click","dblclick","mousedown","mouseup"];Object.entries(dn).forEach(([Oe,Kt])=>{Kt&&(Ui.includes(Oe)?Ae.push({event:Oe,listener:at}):qi.includes(Oe)&&Ae.push({event:Oe,listener:$t}))}),Object.entries(fn).forEach(([Oe,Kt])=>{Kt&&(Ui.includes(Oe)?Ae.push({event:Oe,listener:ae}):qi.includes(Oe)&&Ae.push({event:Oe,listener:Xo}))}),g&&Ae.push({event:"pointermove",listener:Rn});const Bi=()=>{Ze.current=!0},Ji=()=>{Ze.current=!1,pn()},Yt=b&&(fn.mouseout||fn.mouseleave);return Yt&&((X=ee.current)===null||X===void 0||X.addEventListener("mouseover",Bi),(ue=ee.current)===null||ue===void 0||ue.addEventListener("mouseout",Ji)),Ae.forEach(({event:Oe,listener:Kt})=>{le.forEach(li=>{var rr;(rr=li.current)===null||rr===void 0||rr.addEventListener(Oe,Kt)})}),()=>{var Oe,Kt;wt.scroll&&(window.removeEventListener("scroll",Be),et==null||et.removeEventListener("scroll",Be),Pt==null||Pt.removeEventListener("scroll",Be)),wt.resize?window.removeEventListener("resize",Be):it==null||it(),wt.clickOutsideAnchor&&window.removeEventListener("click",hn),wt.escape&&window.removeEventListener("keydown",bt),Yt&&((Oe=ee.current)===null||Oe===void 0||Oe.removeEventListener("mouseover",Bi),(Kt=ee.current)===null||Kt===void 0||Kt.removeEventListener("mouseout",Ji)),Ae.forEach(({event:li,listener:rr})=>{le.forEach(Yo=>{var Fn;(Fn=Yo.current)===null||Fn===void 0||Fn.removeEventListener(li,rr)})})}},[$,he,Ue,vt,De,A,N,F,_e,y,w]),I.useEffect(()=>{var X,ue;let le=(ue=(X=xe==null?void 0:xe.anchorSelect)!==null&&X!==void 0?X:s)!==null&&ue!==void 0?ue:"";!le&&t&&(le=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Le=new MutationObserver(Be=>{const et=[],Pt=[];Be.forEach(it=>{if(it.type==="attributes"&&it.attributeName==="data-tooltip-id"&&(it.target.getAttribute("data-tooltip-id")===t?et.push(it.target):it.oldValue===t&&Pt.push(it.target)),it.type==="childList"){if($){const bt=[...it.removedNodes].filter(Ae=>Ae.nodeType===1);if(le)try{Pt.push(...bt.filter(Ae=>Ae.matches(le))),Pt.push(...bt.flatMap(Ae=>[...Ae.querySelectorAll(le)]))}catch{}bt.some(Ae=>{var An;return!!(!((An=Ae==null?void 0:Ae.contains)===null||An===void 0)&&An.call(Ae,$))&&(rt(!1),Fe(!1),H(null),kt(ce),kt(k),!0)})}if(le)try{const bt=[...it.addedNodes].filter(Ae=>Ae.nodeType===1);et.push(...bt.filter(Ae=>Ae.matches(le))),et.push(...bt.flatMap(Ae=>[...Ae.querySelectorAll(le)]))}catch{}}}),(et.length||Pt.length)&&J(it=>[...it.filter(bt=>!Pt.includes(bt)),...et])});return Le.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{Le.disconnect()}},[t,s,xe==null?void 0:xe.anchorSelect,$]),I.useEffect(()=>{he()},[he]),I.useEffect(()=>{if(!(ge!=null&&ge.current))return()=>null;const X=new ResizeObserver(()=>{setTimeout(()=>he())});return X.observe(ge.current),()=>{X.disconnect()}},[re,ge==null?void 0:ge.current]),I.useEffect(()=>{var X;const ue=document.querySelector(`[id='${o}']`),le=[...De,ue];$&&le.includes($)||H((X=De[0])!==null&&X!==void 0?X:ue)},[o,De,$]),I.useEffect(()=>(be&&Fe(!0),()=>{kt(ce),kt(k)}),[]),I.useEffect(()=>{var X;let ue=(X=xe==null?void 0:xe.anchorSelect)!==null&&X!==void 0?X:s;if(!ue&&t&&(ue=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),ue)try{const le=Array.from(document.querySelectorAll(ue));J(le)}catch{J([])}},[t,s,xe==null?void 0:xe.anchorSelect]),I.useEffect(()=>{ce.current&&(kt(ce),En(y))},[y]);const pt=(Y=xe==null?void 0:xe.content)!==null&&Y!==void 0?Y:re,mn=Ce&&Object.keys(z.tooltipStyles).length>0;return I.useImperativeHandle(e,()=>({open:X=>{if(X!=null&&X.anchorSelect)try{document.querySelector(X.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${X.anchorSelect}" is not a valid CSS selector`)}ze(X??null),X!=null&&X.delay?En(X.delay):Fe(!0)},close:X=>{X!=null&&X.delay?Nn(X.delay):Fe(!1)},activeAnchor:$,place:z.place,isOpen:!!(Ue&&!O&&pt&&mn)})),Ue&&!O&&pt?I.createElement(m,{id:t,role:Z,className:Vt("react-tooltip",Ar.tooltip,ys.tooltip,ys[i],n,`react-tooltip__place-${z.place}`,Ar[mn?"show":"closing"],mn?"react-tooltip__show":"react-tooltip__closing",d==="fixed"&&Ar.fixed,b&&Ar.clickable),onTransitionEnd:X=>{kt(ve),Ce||X.propertyName!=="opacity"||(rt(!1),ze(null),L==null||L())},style:{...D,...z.tooltipStyles,opacity:q!==void 0&&mn?q:void 0},ref:ee},pt,I.createElement(m,{className:Vt("react-tooltip-arrow",Ar.arrow,ys.arrow,r,p&&Ar.noArrow),style:{...z.tooltipArrowStyles,background:V?`linear-gradient(to right bottom, transparent 50%, ${V} 50%)`:void 0,"--rt-arrow-size":`${G}px`},ref:ne})):null},U0=({content:e})=>I.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),q0=I.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:i,render:o,className:s,classNameArrow:a,variant:u="dark",place:f="top",offset:l=10,wrapper:d="div",children:h=null,events:m=["hover"],openOnClick:y=!1,positionStrategy:w="absolute",middlewares:g,delayShow:O=0,delayHide:p=0,float:b=!1,hidden:v=!1,noArrow:x=!1,clickable:S=!1,closeOnEsc:A=!1,closeOnScroll:N=!1,closeOnResize:F=!1,openEvents:R,closeEvents:D,globalCloseEvents:K,imperativeModeOnly:j=!1,style:L,position:se,isOpen:re,defaultIsOpen:ge=!1,disableStyleInjection:de=!1,border:be,opacity:P,arrowColor:$,arrowSize:H,setIsOpen:U,afterShow:q,afterHide:V,disableTooltip:G,role:Z="tooltip"},Y)=>{const[ee,ne]=I.useState(r),[ce,k]=I.useState(i),[ve,z]=I.useState(f),[Xe,Ce]=I.useState(u),[st,Ue]=I.useState(l),[rt,xe]=I.useState(O),[ze,ft]=I.useState(p),[yt,vt]=I.useState(b),[Ye,Ze]=I.useState(v),[De,J]=I.useState(d),[pe,_e]=I.useState(m),[ln,dn]=I.useState(w),[fn,wt]=I.useState(null),[Fe,nr]=I.useState(null),En=I.useRef(de),{anchorRefs:Nn,activeAnchor:St}=ff(e),pn=je=>je==null?void 0:je.getAttributeNames().reduce((at,ae)=>{var he;return ae.startsWith("data-tooltip-")&&(at[ae.replace(/^data-tooltip-/,"")]=(he=je==null?void 0:je.getAttribute(ae))!==null&&he!==void 0?he:null),at},{}),Tn=je=>{const at={place:ae=>{var he;z((he=ae)!==null&&he!==void 0?he:f)},content:ae=>{ne(ae??r)},html:ae=>{k(ae??i)},variant:ae=>{var he;Ce((he=ae)!==null&&he!==void 0?he:u)},offset:ae=>{Ue(ae===null?l:Number(ae))},wrapper:ae=>{var he;J((he=ae)!==null&&he!==void 0?he:d)},events:ae=>{const he=ae==null?void 0:ae.split(" ");_e(he??m)},"position-strategy":ae=>{var he;dn((he=ae)!==null&&he!==void 0?he:w)},"delay-show":ae=>{xe(ae===null?O:Number(ae))},"delay-hide":ae=>{ft(ae===null?p:Number(ae))},float:ae=>{vt(ae===null?b:ae==="true")},hidden:ae=>{Ze(ae===null?v:ae==="true")},"class-name":ae=>{wt(ae)}};Object.values(at).forEach(ae=>ae(null)),Object.entries(je).forEach(([ae,he])=>{var pt;(pt=at[ae])===null||pt===void 0||pt.call(at,he)})};I.useEffect(()=>{ne(r)},[r]),I.useEffect(()=>{k(i)},[i]),I.useEffect(()=>{z(f)},[f]),I.useEffect(()=>{Ce(u)},[u]),I.useEffect(()=>{Ue(l)},[l]),I.useEffect(()=>{xe(O)},[O]),I.useEffect(()=>{ft(p)},[p]),I.useEffect(()=>{vt(b)},[b]),I.useEffect(()=>{Ze(v)},[v]),I.useEffect(()=>{dn(w)},[w]),I.useEffect(()=>{En.current!==de&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[de]),I.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:de==="core",disableBase:de}}))},[]),I.useEffect(()=>{var je;const at=new Set(Nn);let ae=n;if(!ae&&e&&(ae=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),ae)try{document.querySelectorAll(ae).forEach(ue=>{at.add({current:ue})})}catch{console.warn(`[react-tooltip] "${ae}" is not a valid CSS selector`)}const he=document.querySelector(`[id='${t}']`);if(he&&at.add({current:he}),!at.size)return()=>null;const pt=(je=Fe??he)!==null&&je!==void 0?je:St.current,mn=new MutationObserver(ue=>{ue.forEach(le=>{var Le;if(!pt||le.type!=="attributes"||!(!((Le=le.attributeName)===null||Le===void 0)&&Le.startsWith("data-tooltip-")))return;const Be=pn(pt);Tn(Be)})}),X={attributes:!0,childList:!1,subtree:!1};if(pt){const ue=pn(pt);Tn(ue),mn.observe(pt,X)}return()=>{mn.disconnect()}},[Nn,St,Fe,t,n]),I.useEffect(()=>{L!=null&&L.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),be&&!yu("border",`${be}`)&&console.warn(`[react-tooltip] "${be}" is not a valid \`border\`.`),L!=null&&L.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),P&&!yu("opacity",`${P}`)&&console.warn(`[react-tooltip] "${P}" is not a valid \`opacity\`.`)},[]);let Rn=h;const hn=I.useRef(null);if(o){const je=o({content:(Fe==null?void 0:Fe.getAttribute("data-tooltip-content"))||ee||null,activeAnchor:Fe});Rn=je?I.createElement("div",{ref:hn,className:"react-tooltip-content-wrapper"},je):null}else ee&&(Rn=ee);ce&&(Rn=I.createElement(U0,{content:ce}));const Xt={forwardRef:Y,id:e,anchorId:t,anchorSelect:n,className:Vt(s,fn),classNameArrow:a,content:Rn,contentWrapperRef:hn,place:ve,variant:Xe,offset:st,wrapper:De,events:pe,openOnClick:y,positionStrategy:ln,middlewares:g,delayShow:rt,delayHide:ze,float:yt,hidden:Ye,noArrow:x,clickable:S,closeOnEsc:A,closeOnScroll:N,closeOnResize:F,openEvents:R,closeEvents:D,globalCloseEvents:K,imperativeModeOnly:j,style:L,position:se,isOpen:re,defaultIsOpen:ge,border:be,opacity:P,arrowColor:$,arrowSize:H,setIsOpen:U,afterShow:q,afterHide:V,disableTooltip:G,activeAnchor:Fe,setActiveAnchor:je=>nr(je),role:Z};return I.createElement(K0,{...Xt})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||mu({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;--rt-arrow-size:8px}.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;z-index:-1}.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||mu({css:`
51
- .styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:var(--rt-arrow-size);height:var(--rt-arrow-size)}[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 B0(){return c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[c.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[c.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"}),c.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),c.jsx("defs",{children:c.jsx("clipPath",{id:"clip0_2896_16290",children:c.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function pf({id:e,tooltipText:t}){return c.jsxs(c.Fragment,{children:[c.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:B0()}),c.jsx(q0,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}function J0(e,t){var r;const n=((r=e==null?void 0:e.read)==null?void 0:r.selectedFieldMappings)||{};t.forEach(i=>{var a,u;const{field:o,value:s}=i;if(s===null){const f=n[o];delete n[o],f&&((a=e==null?void 0:e.read)!=null&&a.selectedValueMappings)&&e.read.selectedValueMappings[f]&&delete e.read.selectedValueMappings[f]}else{const f=n[o];n[o]=s,f&&f!==s&&((u=e==null?void 0:e.read)!=null&&u.selectedValueMappings)&&e.read.selectedValueMappings[f]&&delete e.read.selectedValueMappings[f]}})}function Ei(e,t,n){t(e,r=>J0(r,n))}const H0="Each field must be mapped to a unique value";function Wa({field:e,onSelectChange:t,allFields:n}){var p;const{configureState:r,selectedObjectName:i,setConfigureState:o}=Gt(),[s,a]=I.useState(!0),{isError:u,removeError:f,getError:l}=sn(),d=(p=r==null?void 0:r.read)==null?void 0:p.selectedFieldMappings,h=d==null?void 0:d[e.mapToName];I.useEffect(()=>{e._default&&!h&&i&&r&&Ei(i,o,[{field:e.mapToName,value:e._default}]),a(!1)},[e,o,i,h,r]);const m=I.useMemo(()=>n.map(b=>({id:b.fieldName,label:b.displayName,value:b.fieldName})),[n]),y=c.jsx(tf,{disabled:s,items:m,selectedValue:h||null,onSelectedItemChange:b=>{t({target:{name:e.mapToName,value:b==null?void 0:b.value}})},placeholder:"Please select one",style:{width:"100%"}}),w=I.useCallback(()=>{i&&(Ei(i,o,[{field:e.mapToName,value:null}]),u(we.MAPPING,i)&&f(we.MAPPING,i))},[e.mapToName,i,o,u,f]),{hasDuplicationError:g,errorMessage:O}=I.useMemo(()=>{const b=l(we.MAPPING,i),v=Array.isArray(b)&&b.length>0&&b.includes(e.mapToName);return{hasDuplicationError:v,errorMessage:v?H0:""}},[i,l,e.mapToName]);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[c.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName??e.mapToName}),c.jsx("span",{children:(e==null?void 0:e.prompt)&&c.jsx(pf,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),c.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[y,c.jsx(He,{type:"button",variant:"ghost",onClick:w,children:"Clear"})]})]},e.mapToName),g&&c.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",O," "]},e.mapToName)]})}const W0="_formControl_9qd8d_1",z0="_formLabel_9qd8d_5",Q0="_formLabelRequired_9qd8d_11",G0="_formInput_9qd8d_16",X0="_formInputInvalid_9qd8d_20",Y0="_formError_9qd8d_24",Z0="_disabled_9qd8d_30",sr={formControl:W0,formLabel:z0,formLabelRequired:Q0,formInput:G0,formInputInvalid:X0,formError:Y0,disabled:Z0};function Wo({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:i=!1,errorMessage:o,children:s}){return c.jsxs("div",{className:Vt(sr.formControl,{[sr.disabled]:r}),children:[t&&c.jsx("label",{htmlFor:e,className:Vt(sr.formLabel,{[sr.formLabelRequired]:n}),children:t}),c.jsx("div",{id:e,className:Vt(sr.formInput,{[sr.formInputInvalid]:i}),children:s}),i&&o&&c.jsx("div",{className:sr.formError,role:"alert",children:o})]})}function hf({selectedFieldMappings:e,selectedObjectName:t,fieldName:n,fieldValue:r,setError:i}){if(!e||!t)return!1;if(Object.values(e).some(s=>s===r&&s!==n)){console.error("Each field must be mapped to a unique value",e);const s=Object.keys(e).filter(u=>e[u]===r),a=[n,...s];return i(we.MAPPING,t,a),!0}return!1}function eC({dynamicFieldMappings:e,onSelectChange:t,allFields:n}){return e.length?c.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:e.map(r=>c.jsx(Wo,{id:r.mapToName,children:c.jsx(Wa,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function tC(){var y,w;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Gt(),{isError:r,removeError:i,setError:o}=sn(),s=((y=t==null?void 0:t.read)==null?void 0:y.allFields)||[],{fieldMapping:a}=lt(),u=(w=t==null?void 0:t.read)==null?void 0:w.selectedFieldMappings,f=g=>{const{value:O,name:p}=g.target;!O||hf({selectedFieldMappings:u,selectedObjectName:e,fieldName:p,fieldValue:O,setError:o})||(e&&Ei(e,n,[{field:p,value:O}]),r(we.MAPPING,p)&&i(we.MAPPING,p),e&&r(we.MAPPING,e)&&i(we.MAPPING,e))},l=I.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(g=>!g.fieldName),[a,e]),d=I.useMemo(()=>{var p;return(((p=t==null?void 0:t.read)==null?void 0:p.optionalMapFields)||[]).filter(b=>!l.some(v=>v.mapToName===b.mapToName))},[t,l]),h=l.length>0;return d.length>0||h?c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Map the following optional fields"}),c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[d==null?void 0:d.map(g=>c.jsx(Wo,{id:g.mapToName,children:c.jsx(Wa,{allFields:s,field:g,onSelectChange:f})},g.mapToName)),h&&c.jsx(eC,{dynamicFieldMappings:l,onSelectChange:f,allFields:s})]})]}):null}function nC(){var f;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Gt(),{isError:r,removeError:i,setError:o}=sn(),s=(f=t==null?void 0:t.read)==null?void 0:f.selectedFieldMappings,a=l=>{const{value:d,name:h}=l.target;!d||hf({selectedFieldMappings:s,selectedObjectName:e,fieldName:h,fieldValue:d,setError:o})||(e&&Ei(e,n,[{field:h,value:d}]),r(we.MAPPING,h)&&i(we.MAPPING,h),e&&r(we.MAPPING,e)&&i(we.MAPPING,e))},u=I.useMemo(()=>{var l;return((l=t==null?void 0:t.read)==null?void 0:l.requiredMapFields)||[]},[t]);return u!=null&&u.length?c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Map the following fields"}),c.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:u.map(l=>{var d;return c.jsx(Wo,{id:l.mapToName,isInvalid:r(we.MAPPING,l.mapToName),errorMessage:"* required",children:c.jsx(Wa,{allFields:((d=t==null?void 0:t.read)==null?void 0:d.allFields)||[],field:l,onSelectChange:a})},l.mapToName)})})]}):null}const rC=(e,t)=>e.filter(n=>!t.has(n));function iC(){var h,m,y;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Gt(),{fieldMapping:r}=lt(),i=((h=t==null?void 0:t.read)==null?void 0:h.selectedFieldMappings)||{},o=Object.keys(i),s=((m=t==null?void 0:t.read)==null?void 0:m.requiredMapFields)||[],a=((y=t==null?void 0:t.read)==null?void 0:y.optionalMapFields)||[],u=e&&r?Object.values(r[e]||{}).flat().filter(w=>!w.fieldName):[],f=s.concat(u,a).map(w=>w.mapToName),l=new Set(f),d=rC(o,l);I.useEffect(()=>{e&&d.length&&Ei(e,n,d.map(w=>({field:w,value:null})))},[e,n,d])}const oC={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function sC({children:e,style:t}){return c.jsx(_n,{style:{...oC,...t},children:e})}function aC(){var f,l,d;const{data:e}=Yn(),{hydratedRevision:t}=ci(),{selectedObjectName:n}=Gt(),{providerName:r}=dt(),i=e==null?void 0:e.appName,o=(d=(l=(f=t==null?void 0:t.content)==null?void 0:f.read)==null?void 0:l.objects)==null?void 0:d.find(h=>h.objectName===n),s=(o==null?void 0:o.displayName)||n&&Wt(n),a=o==null?void 0:o.mapToName,u=(o==null?void 0:o.mapToDisplayName)||a&&Wt(a);return u&&i&&r?c.jsx(sC,{style:{marginTop:"1rem"},children:c.jsxs("p",{style:{margin:"1rem 0"},children:[c.jsx("b",{children:u})," in ",i," is mapped to"," ",c.jsx("b",{children:s})," in ",r,"."]})}):null}function Iu(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function mf(...e){return t=>{let n=!1;const r=e.map(i=>{const o=Iu(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():Iu(e[i],null)}}}}function ni(...e){return B.useCallback(mf(...e),e)}function zo(e,t=[]){let n=[];function r(o,s){const a=B.createContext(s),u=n.length;n=[...n,s];const f=d=>{var O;const{scope:h,children:m,...y}=d,w=((O=h==null?void 0:h[e])==null?void 0:O[u])||a,g=B.useMemo(()=>y,Object.values(y));return c.jsx(w.Provider,{value:g,children:m})};f.displayName=o+"Provider";function l(d,h){var w;const m=((w=h==null?void 0:h[e])==null?void 0:w[u])||a,y=B.useContext(m);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${o}\``)}return[f,l]}const i=()=>{const o=n.map(s=>B.createContext(s));return function(a){const u=(a==null?void 0:a[e])||o;return B.useMemo(()=>({[`__scope${e}`]:{...a,[e]:u}}),[a,u])}};return i.scopeName=e,[r,cC(i,...t)]}function cC(...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:u,scopeName:f})=>{const d=u(o)[`__scope${f}`];return{...a,...d}},{});return B.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Ht(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}var Ni=globalThis!=null&&globalThis.document?B.useLayoutEffect:()=>{},uC=B[" useInsertionEffect ".trim().toString()]||Ni;function za({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,o,s]=lC({defaultProp:t,onChange:n}),a=e!==void 0,u=a?e:i;{const l=B.useRef(e!==void 0);B.useEffect(()=>{const d=l.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),l.current=a},[a,r])}const f=B.useCallback(l=>{var d;if(a){const h=dC(l)?l(e):l;h!==e&&((d=s.current)==null||d.call(s,h))}else o(l)},[a,e,o,s]);return[u,f]}function lC({defaultProp:e,onChange:t}){const[n,r]=B.useState(e),i=B.useRef(n),o=B.useRef(t);return uC(()=>{o.current=t},[t]),B.useEffect(()=>{var s;i.current!==n&&((s=o.current)==null||s.call(o,n),i.current=n)},[n,i]),[n,r,o]}function dC(e){return typeof e=="function"}function fC(e){const t=B.useRef({value:e,previous:e});return B.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function pC(e){const[t,n]=B.useState(void 0);return Ni(()=>{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 u=o.borderBoxSize,f=Array.isArray(u)?u[0]:u;s=f.inlineSize,a=f.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 hC(e,t){return B.useReducer((n,r)=>t[n][r]??n,e)}var Qa=e=>{const{present:t,children:n}=e,r=mC(t),i=typeof n=="function"?n({present:r.isPresent}):B.Children.only(n),o=ni(r.ref,gC(i));return typeof n=="function"||r.isPresent?B.cloneElement(i,{ref:o}):null};Qa.displayName="Presence";function mC(e){const[t,n]=B.useState(),r=B.useRef(null),i=B.useRef(e),o=B.useRef("none"),s=e?"mounted":"unmounted",[a,u]=hC(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return B.useEffect(()=>{const f=so(r.current);o.current=a==="mounted"?f:"none"},[a]),Ni(()=>{const f=r.current,l=i.current;if(l!==e){const h=o.current,m=so(f);e?u("MOUNT"):m==="none"||(f==null?void 0:f.display)==="none"?u("UNMOUNT"):u(l&&h!==m?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,u]),Ni(()=>{if(t){let f;const l=t.ownerDocument.defaultView??window,d=m=>{const w=so(r.current).includes(CSS.escape(m.animationName));if(m.target===t&&w&&(u("ANIMATION_END"),!i.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",f=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},h=m=>{m.target===t&&(o.current=so(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{l.clearTimeout(f),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:B.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function so(e){return(e==null?void 0:e.animationName)||"none"}function gC(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)}function na(e){const t=yC(e),n=B.forwardRef((r,i)=>{const{children:o,...s}=r,a=B.Children.toArray(o),u=a.find(wC);if(u){const f=u.props.children,l=a.map(d=>d===u?B.Children.count(f)>1?B.Children.only(null):B.isValidElement(f)?f.props.children:null:d);return c.jsx(t,{...s,ref:i,children:B.isValidElement(f)?B.cloneElement(f,void 0,l):null})}return c.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function yC(e){const t=B.forwardRef((n,r)=>{const{children:i,...o}=n;if(B.isValidElement(i)){const s=IC(i),a=bC(o,i.props);return i.type!==B.Fragment&&(a.ref=r?mf(r,s):s),B.cloneElement(i,a)}return B.Children.count(i)>1?B.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var vC=Symbol("radix.slottable");function wC(e){return B.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===vC}function bC(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)=>{const u=o(...a);return i(...a),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function IC(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 CC=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Sn=CC.reduce((e,t)=>{const n=na(`Primitive.${t}`),r=B.forwardRef((i,o)=>{const{asChild:s,...a}=i,u=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(u,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Qo="Checkbox",[xC,WO]=zo(Qo),[OC,Ga]=xC(Qo);function _C(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:o,form:s,name:a,onCheckedChange:u,required:f,value:l="on",internal_do_not_use_render:d}=e,[h,m]=za({prop:n,defaultProp:i??!1,onChange:u,caller:Qo}),[y,w]=B.useState(null),[g,O]=B.useState(null),p=B.useRef(!1),b=y?!!s||!!y.closest("form"):!0,v={checked:h,disabled:o,setChecked:m,control:y,setControl:w,name:a,form:s,value:l,hasConsumerStoppedPropagationRef:p,required:f,defaultChecked:Qn(i)?!1:i,isFormControl:b,bubbleInput:g,setBubbleInput:O};return c.jsx(OC,{scope:t,...v,children:SC(d)?d(v):r})}var gf="CheckboxTrigger",yf=B.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{const{control:o,value:s,disabled:a,checked:u,required:f,setControl:l,setChecked:d,hasConsumerStoppedPropagationRef:h,isFormControl:m,bubbleInput:y}=Ga(gf,e),w=ni(i,l),g=B.useRef(u);return B.useEffect(()=>{const O=o==null?void 0:o.form;if(O){const p=()=>d(g.current);return O.addEventListener("reset",p),()=>O.removeEventListener("reset",p)}},[o,d]),c.jsx(Sn.button,{type:"button",role:"checkbox","aria-checked":Qn(u)?"mixed":u,"aria-required":f,"data-state":If(u),"data-disabled":a?"":void 0,disabled:a,value:s,...r,ref:w,onKeyDown:Ht(t,O=>{O.key==="Enter"&&O.preventDefault()}),onClick:Ht(n,O=>{d(p=>Qn(p)?!0:!p),y&&m&&(h.current=O.isPropagationStopped(),h.current||O.stopPropagation())})})});yf.displayName=gf;var Xa=B.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:s,disabled:a,value:u,onCheckedChange:f,form:l,...d}=e;return c.jsx(_C,{__scopeCheckbox:n,checked:i,defaultChecked:o,disabled:a,required:s,onCheckedChange:f,name:r,form:l,value:u,internal_do_not_use_render:({isFormControl:h})=>c.jsxs(c.Fragment,{children:[c.jsx(yf,{...d,ref:t,__scopeCheckbox:n}),h&&c.jsx(bf,{__scopeCheckbox:n})]})})});Xa.displayName=Qo;var vf="CheckboxIndicator",Ya=B.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=Ga(vf,n);return c.jsx(Qa,{present:r||Qn(o.checked)||o.checked===!0,children:c.jsx(Sn.span,{"data-state":If(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});Ya.displayName=vf;var wf="CheckboxBubbleInput",bf=B.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:i,checked:o,defaultChecked:s,required:a,disabled:u,name:f,value:l,form:d,bubbleInput:h,setBubbleInput:m}=Ga(wf,e),y=ni(n,m),w=fC(o),g=pC(r);B.useEffect(()=>{const p=h;if(!p)return;const b=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(b,"checked").set,S=!i.current;if(w!==o&&x){const A=new Event("click",{bubbles:S});p.indeterminate=Qn(o),x.call(p,Qn(o)?!1:o),p.dispatchEvent(A)}},[h,w,o,i]);const O=B.useRef(Qn(o)?!1:o);return c.jsx(Sn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??O.current,required:a,disabled:u,name:f,value:l,form:d,...t,tabIndex:-1,ref:y,style:{...t.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});bf.displayName=wf;function SC(e){return typeof e=="function"}function Qn(e){return e==="indeterminate"}function If(e){return Qn(e)?"indeterminate":e?"checked":"unchecked"}function Za(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 EC=["color"],Cf=I.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Za(e,EC);return I.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}),I.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"}))}),NC=["color"],TC=I.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Za(e,NC);return I.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}),I.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"}))}),RC=["color"],AC=I.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Za(e,RC);return I.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}),I.createElement("path",{d:"M8.4449 0.608765C8.0183 -0.107015 6.9817 -0.107015 6.55509 0.608766L0.161178 11.3368C-0.275824 12.07 0.252503 13 1.10608 13H13.8939C14.7475 13 15.2758 12.07 14.8388 11.3368L8.4449 0.608765ZM7.4141 1.12073C7.45288 1.05566 7.54712 1.05566 7.5859 1.12073L13.9798 11.8488C14.0196 11.9154 13.9715 12 13.8939 12H1.10608C1.02849 12 0.980454 11.9154 1.02018 11.8488L7.4141 1.12073ZM6.8269 4.48611C6.81221 4.10423 7.11783 3.78663 7.5 3.78663C7.88217 3.78663 8.18778 4.10423 8.1731 4.48612L8.01921 8.48701C8.00848 8.766 7.7792 8.98664 7.5 8.98664C7.2208 8.98664 6.99151 8.766 6.98078 8.48701L6.8269 4.48611ZM8.24989 10.476C8.24989 10.8902 7.9141 11.226 7.49989 11.226C7.08567 11.226 6.74989 10.8902 6.74989 10.476C6.74989 10.0618 7.08567 9.72599 7.49989 9.72599C7.9141 9.72599 8.24989 10.0618 8.24989 10.476Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const FC="_checkboxGroupContainer_hqfeu_1",PC="_stack_hqfeu_6",DC="_selectAllContainer_hqfeu_10",MC="_fieldContainer_hqfeu_17",kC="_checkbox_hqfeu_1",ri={checkboxGroupContainer:FC,stack:PC,selectAllContainer:DC,fieldContainer:MC,checkbox:kC};function jC({id:e,isChecked:t,label:n,onCheckedChange:r}){return c.jsxs("div",{className:ri.fieldContainer,children:[c.jsx(Xa,{className:ri.checkbox,id:e,onCheckedChange:r,checked:t,children:c.jsx(Ya,{children:c.jsx(Cf,{})})}),c.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function LC({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:i}){return c.jsxs("div",{className:ri.selectAllContainer,children:[c.jsx(Xa,{className:ri.checkbox,id:e,onCheckedChange:r,checked:i?"indeterminate":t,children:c.jsxs(Ya,{children:[i&&c.jsx(TC,{}),t===!0&&c.jsx(Cf,{})]})}),c.jsx("label",{htmlFor:e,children:n})]})}function VC({children:e}){return c.jsx("div",{className:ri.checkboxGroupContainer,children:e})}function $C({children:e}){return c.jsx("div",{className:ri.stack,children:e})}const KC="_paginationContainer_1p51x_1",UC="_pageInfo_1p51x_7",qC="_searchContainer_1p51x_13",BC="_searchInput_1p51x_17",JC="_noResults_1p51x_21",mi={paginationContainer:KC,pageInfo:UC,searchContainer:qC,searchInput:BC,noResults:JC};function xf({items:e,onItemChange:t,itemsPerPage:n=8,showSelectAll:r=!0,showSearch:i=!0,searchPlaceholder:o="Search fields...",itemName:s="fields"}){const[a,u]=I.useState(1),[f,l]=I.useState(""),d=e.filter(v=>v.label.toLowerCase().includes(f.toLowerCase())),h=Math.ceil(d.length/n),m=(a-1)*n,y=m+n,w=d.slice(m,y),g=v=>{l(v),u(1)},O=v=>{d.forEach(x=>{t(x.id,v)})},p=d.length>0&&d.every(v=>v.isChecked),b=d.some(v=>v.isChecked);return c.jsxs(VC,{children:[i&&c.jsx("div",{className:mi.searchContainer,children:c.jsx(sd,{id:"field-search",type:"text",placeholder:o,value:f,onChange:v=>g(v.target.value),className:mi.searchInput})}),r&&e.length>=2&&c.jsx(LC,{id:"select-all-fields",isChecked:p,label:`Select all ${d.length} ${f?"matching ":""}${s}`,onCheckedChange:O,isIndeterminate:b&&!p}),c.jsx($C,{children:w.map(v=>c.jsx(jC,{id:v.id,isChecked:v.isChecked,label:v.label,onCheckedChange:x=>t(v.id,x===!0)},v.id))}),h>1&&c.jsxs("div",{className:mi.paginationContainer,children:[c.jsx(He,{type:"button",onClick:()=>u(v=>Math.max(1,v-1)),disabled:a===1,variant:"ghost",children:"<"}),c.jsxs("span",{className:mi.pageInfo,children:[a," of ",h]}),c.jsx(He,{type:"button",onClick:()=>u(v=>Math.min(h,v+1)),disabled:a===h,variant:"ghost",children:">"})]}),d.length===0&&f&&c.jsxs("div",{className:mi.noResults,children:["No ",s,' found matching "',f,'"']})]})}function HC(e,t,n){var i;const r=((i=e==null?void 0:e.read)==null?void 0:i.selectedOptionalFields)||{};r[t]=n,n||delete r[t]}function WC(e,t,n,r){t(e,i=>HC(i,n,r))}function zC(){var f,l;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=Gt(),i=(f=t==null?void 0:t.read)==null?void 0:f.selectedOptionalFields,o=(l=t==null?void 0:t.read)==null?void 0:l.optionalFields,s=(d,h)=>{r&&t&&WC(r,n,d,h)},a=I.useMemo(()=>(o==null?void 0:o.filter(d=>!Zn(d)&&"fieldName"in d&&"displayName"in d).map(d=>({id:d.fieldName,label:d.displayName,isChecked:!!(i!=null&&i[d.fieldName])})).sort((d,h)=>d.label.localeCompare(h.label)))||[],[o,i]);return!!(o&&o.length>0)&&c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:`${e} reads the following optional fields`}),c.jsx(xf,{items:a,onItemChange:s,showSelectAll:a.length>=2},`${r}-${o==null?void 0:o.length}`)]})}function QC(){return c.jsx(zC,{})}const GC={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 XC({children:e,style:t,...n}){return c.jsx("span",{style:{...GC,...t},...n,children:e})}const YC="_errorAlert_1tcao_1",ZC="_errorHeader_1tcao_11",ex="_errorIcon_1tcao_17",tx="_errorTitle_1tcao_24",nx="_errorMessage_1tcao_30",gi={errorAlert:YC,errorHeader:ZC,errorIcon:ex,errorTitle:tx,errorMessage:nx};function rx({error:e}){return c.jsxs("div",{className:gi.errorAlert,children:[c.jsxs("div",{className:gi.errorHeader,children:[c.jsx(AC,{className:gi.errorIcon}),c.jsx("span",{className:gi.errorTitle,children:"Unable to load object"})]}),c.jsx("div",{className:gi.errorMessage,children:e})]})}function ix(){var s,a,u;const{data:e}=Lo(),{selectedObjectName:t}=Gt(),{appName:n}=Yn(),r=(u=(a=(s=e==null?void 0:e.content)==null?void 0:s.read)==null?void 0:a.objects)==null?void 0:u.find(f=>f.objectName===t),i=r==null?void 0:r.error,o=r==null?void 0:r.requiredFields;return i?c.jsx(rx,{error:i}):c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:`${n} reads the following fields`}),c.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:o!=null&&o.length?o.map(f=>Zn(f)?null:c.jsx(XC,{children:f.displayName},f.fieldName)):"There are no required fields."})]})}function ox(e,t,n,r,i){e.read&&(e.read.selectedValueMappings||(e.read.selectedValueMappings={}),e.read.selectedValueMappings[i]||(e.read.selectedValueMappings[i]={}),r===""&&e.read.selectedValueMappings[i][n]?delete e.read.selectedValueMappings[i][n]:e.read.selectedValueMappings[i][n]=r)}function Of(e,t,n,r,i){t(e,o=>ox(o,e,n,r,i))}function vs(e){return e.mapToDisplayName||e.mapToName||e.fieldName||""}function sx(e,t){if(!e.fieldName)return{isValid:!1,errorMessage:"Field name is missing"};const n=t==null?void 0:t.valueType;if(!["singleSelect","multiSelect"].includes(n||""))return{isValid:!1,errorMessage:"fieldName is not a singleSelect or multiSelect"};const r=t==null?void 0:t.values;if(!r)return{isValid:!1,errorMessage:"Field values array is missing"};const i=Object.keys(r).length,o=Object.keys((e==null?void 0:e.mappedValues)||[]).length;return i!==o?{isValid:!1,errorMessage:"field values and the values to be mapped are not of the same length"}:{isValid:!0}}function ax(e,t,n){const r=Object.values(t).filter(Boolean),i=t[n];return e.filter(o=>{const s=o.value===i,a=r.includes(o.value);return s||!a})}function cx({string:e,fieldName:t}){return c.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[c.jsxs("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:[e,c.jsx("b",{children:t})]}),c.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:c.jsx(Uo,{style:{width:"100%",marginLeft:"1rem"}})})]})}function ux({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r}){var m;const{configureState:i,selectedObjectName:o,setConfigureState:s}=Gt(),a=I.useMemo(()=>{var y,w;return((w=(y=i==null?void 0:i.read)==null?void 0:y.selectedValueMappings)==null?void 0:w[n])||{}},[(m=i==null?void 0:i.read)==null?void 0:m.selectedValueMappings,n]),u=I.useMemo(()=>a==null?void 0:a[e.mappedValue],[a,e.mappedValue]),f=I.useMemo(()=>r.map(y=>({id:y.value,label:y.displayValue,value:y.value})),[r]),l=I.useCallback(y=>{y&&t({target:{name:e.mappedValue,value:y.value,fieldName:n}})},[t,n,e.mappedValue]),d=I.useMemo(()=>c.jsx(tf,{items:f,selectedValue:u||null,onSelectedItemChange:l,placeholder:"Please select one",style:{borderRadius:"8px",width:"100%"}},u),[u,f,l]),h=I.useCallback(()=>{o&&Of(o,s,e.mappedValue,"",n)},[o,s,e.mappedValue,n]);return c.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:".25rem"},children:[c.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:c.jsx("span",{style:{fontWeight:500},children:e.mappedDisplayValue})}),c.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[d,c.jsx(He,{type:"button",variant:"ghost",onClick:h,children:"Clear"})]})]},e.mappedValue)}function lx(){var u,f;const{fieldMapping:e}=lt(),{selectedObjectName:t,configureState:n,setConfigureState:r}=Gt(),i=(u=n==null?void 0:n.read)==null?void 0:u.selectedFieldMappings,o=(f=n==null?void 0:n.read)==null?void 0:f.selectedValueMappings,s=I.useMemo(()=>{const l=t&&e?Object.values(e[t]||{}).flat().filter(d=>d.mappedValues).map(d=>({...d})):[];if(i)for(let d=0;d<l.length;d+=1){const{mapToName:h}=l[d];i!=null&&i[h]&&(l[d].fieldName=i[h])}return l},[t,e,i]),a=I.useCallback(l=>{const{value:d,name:h,fieldName:m}=l.target;d&&t&&Of(t,r,h,d,m)},[t,r]);return s!=null&&s.length?c.jsx(c.Fragment,{children:s.map(l=>{var m,y,w;const d=(y=(m=n==null?void 0:n.read)==null?void 0:m.allFieldsMetadata)==null?void 0:y[l.fieldName],h=sx(l,d);return h.isValid?c.jsxs(c.Fragment,{children:[c.jsx(cx,{string:"Map the values for ",fieldName:vs(l)}),c.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:c.jsx(Wo,{id:vs(l),children:(w=l==null?void 0:l.mappedValues)==null?void 0:w.map(g=>{const O=(d==null?void 0:d.values)||[],p=(o==null?void 0:o[l.fieldName])||{},b=ax(O,p,g.mappedValue);return c.jsx(ux,{allValueOptions:b,mappedValue:g,onSelectChange:a,fieldName:(l==null?void 0:l.fieldName)||""},`${g.mappedValue}-${l.fieldName}`)})},vs(l))})]}):(console.error(h.errorMessage,l),null)})}):null}const dx=!1;function fx(){return iC(),c.jsxs(c.Fragment,{children:[c.jsx(aC,{}),c.jsx(ix,{}),c.jsx(nC,{}),c.jsx(tC,{}),c.jsx(lx,{}),c.jsx(QC,{}),dx]})}function px(e,t,n){var r;if(((r=e==null?void 0:e.write)==null?void 0:r.selectedWriteObjects)===null&&(e.write.selectedWriteObjects={}),e!=null&&e.write){const i=e.write.selectedWriteObjects;n&&(i[t]={objectName:t}),n||delete i[t]}}function hx(e,t,n,r){t(e,i=>{px(i,n,r)})}function mx(){var f,l;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=Gt(),i=(f=n==null?void 0:n.write)==null?void 0:f.selectedWriteObjects,o=(l=n==null?void 0:n.write)==null?void 0:l.writeObjects,s=(d,h)=>{t&&n&&hx(t,r,d,h)},a=!!o,u=(o==null?void 0:o.map(d=>({id:d.objectName,label:d.displayName,isChecked:!!(i!=null&&i[d.objectName])})))||[];return a&&c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:`Allow ${e} to write to these objects`}),c.jsx(xf,{items:u,onItemChange:s,showSelectAll:o.length>=2,searchPlaceholder:"Search objects...",itemName:"objects"})]})}function gx(){return c.jsx(c.Fragment,{children:c.jsx(mx,{})})}function _f({resetComponent:e,onDisconnectSuccess:t}){return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[c.jsx(Ft,{string:"Remove connection"}),c.jsx("p",{children:"Click to disconnect your connection from the provider."}),c.jsx(dd,{resetComponent:e,onDisconnectSuccess:t,buttonText:"Remove connection",buttonVariant:"danger",buttonStyle:{fontSize:"13px",width:"100%"}})]})}const yx="_authenticationRow_1g2ms_1",vx="_field_1g2ms_8",wx="_value_1g2ms_12",ws={authenticationRow:yx,field:vx,value:wx};function Cu({label:e,value:t}){return c.jsxs("div",{className:ws.authenticationRow,children:[c.jsx("div",{className:ws.field,children:e}),c.jsx("div",{className:ws.value,children:t})]})}function bx(){const{selectedConnection:e}=an(),{providerName:t}=dt(),r=(e==null?void 0:e.provider)==="salesforce"?"subdomain":"workspace",i=`${t} ${r}`;return c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Connection details"}),c.jsxs("div",{style:{paddingBottom:"1rem"},children:[c.jsx(Cu,{label:i,value:e==null?void 0:e.providerWorkspaceRef}),c.jsx(Cu,{label:"Status",value:Wt((e==null?void 0:e.status)||"")})]})]})}const Ix=()=>{const e=ut(),t=We();return On({mutationFn:async({projectIdOrName:n,integrationId:r,installationId:i})=>(await e()).installationApi.deleteInstallation({projectIdOrName:n,integrationId:r,installationId:i}),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]})},onError:n=>{console.error("Error uninstalling installation."),Je(n)}})};function Sf({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectIdOrName:r}=Ke(),{integrationId:i,installation:o,setIntegrationDeleted:s,onUninstallSuccess:a}=lt(),[u,f]=I.useState(!1),l=!r||!i||!(o!=null&&o.id)||u,d=Ix(),h=async()=>{l||(f(!0),console.warn("uninstalling installation",{projectIdOrName:r,integrationId:i,installationId:o.id}),d.mutate({projectIdOrName:r,integrationId:i,installationId:o.id},{onSuccess:()=>{console.warn("successfully uninstalled installation:",o.id),a==null||a(o==null?void 0:o.id),s()},onSettled:()=>f(!1)}))},m=u?"Uninstalling...":e,y=c.jsx(He,{type:"button",onClick:h,disabled:l,variant:t,style:n,children:m});return o!=null&&o.id?y:null}function Cx(){const{installation:e}=lt(),{providerName:t}=dt();return e?c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Uninstall entire integration"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",padding:"1rem 0"},children:[e!=null&&e.id?c.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:["By clicking below, you will uninstall the entire ",t," ","integration. You will lose any configuration you've set up."]}):c.jsx("p",{children:"You've successfully uninstalled the integration."}),c.jsx(Sf,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function xx(){const{installation:e,resetComponent:t}=lt();return c.jsxs(c.Fragment,{children:[c.jsx(bx,{}),c.jsx(Ca,{}),e&&c.jsx(Cx,{}),!e&&c.jsx(_f,{resetComponent:t})]})}function Ef({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:i}){var de,be,P,$,H,U,q,V,G,Z,Y,ee,ne,ce;const{installation:o}=Nr(),{hydratedRevision:s,loading:a}=ci(),{configureState:u,selectedObjectName:f}=Gt(),l=o==null?void 0:o.config,d=l&&f&&!!Ul(l,f)||!1,h=f?nd(l,f):void 0,m=(de=u==null?void 0:u.read)==null?void 0:de.selectedFieldMappings,y=!Wl(h,m),w=s&&f?wa(l,s,f):void 0,g=(be=u==null?void 0:u.read)==null?void 0:be.selectedOptionalFields,O=!Hl(w,g),p=f?(U=(H=($=(P=l==null?void 0:l.content)==null?void 0:P.read)==null?void 0:$.objects)==null?void 0:H[f])==null?void 0:U.selectedValueMappings:void 0,b=(q=u==null?void 0:u.read)==null?void 0:q.selectedValueMappings,v=!zl(p,b),x=(G=(V=l==null?void 0:l.content)==null?void 0:V.write)==null?void 0:G.objects,S=(Z=u==null?void 0:u.write)==null?void 0:Z.selectedWriteObjects,A=!Ql(x||{},S||{}),D=O||y||v||A||r||f!==Qr&&!d,K=!!((ce=(ne=(ee=(Y=s==null?void 0:s.content)==null?void 0:Y.read)==null?void 0:ee.objects)==null?void 0:ne.find(k=>k.objectName===f))!=null&&ce.error),j=a||n||!u||!f||!D||K,L=f===Qr,se=f===Co,re=c.jsx(He,{type:"submit",disabled:j,children:r?"Install":"Save"}),ge=c.jsx(He,{type:"button",onClick:t,disabled:j,variant:"ghost",children:"Reset"});return n?c.jsx(_i,{}):c.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[c.jsx("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px",height:"3rem"},children:!se&&c.jsxs(c.Fragment,{children:[re,ge]})}),c.jsxs(_n,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[i&&c.jsx(ki,{children:typeof i=="string"?i:"Installation Failed."}),a&&c.jsx(_i,{}),s&&!L&&!se&&c.jsx(fx,{}),s&&L&&!se&&c.jsx(gx,{}),!a&&se&&c.jsx(xx,{})]})]})}const Nf=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:i,onUpdateSuccess:o,fieldMapping:s}=lt(),{hydratedRevision:a,loading:u}=ci(),{selectedObjectName:f}=hd(),{selectedConnection:l}=an(),d=pl(),{projectIdOrName:h}=Ke(),{resetBoundary:m,setErrors:y,setError:w,getError:g}=sn(),{resetConfigureState:O,objectConfigurationsState:p}=xa(),b=rd(f||"",p),{onNextIncompleteTab:v}=$b(),x=I.useCallback(()=>{m(we.INSTALLATION_MUTATION)},[m]),S=I.useCallback(N=>N?F=>{w(we.INSTALLATION_MUTATION,N,F)}:F=>{console.error("objectName is required to set installation error: ",F)},[w]),A=I.useCallback(N=>N?g(we.INSTALLATION_MUTATION,N):"",[g]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:a,loading:u,selectedObjectName:f,selectedConnection:l,apiKey:d,projectIdOrName:h,resetBoundary:m,setErrors:y,setMutateInstallationError:S,getMutateInstallationError:A,resetMutateInstallationErrorState:x,resetConfigureState:O,objectConfigurationsState:p,configureState:b,onInstallSuccess:i,onUpdateSuccess:o,onNextIncompleteTab:v,fieldMapping:s}},Ox=void 0;function _x(){const{consumerRef:e,setInstallation:t,hydratedRevision:n,loading:r,selectedObjectName:i,selectedConnection:o,resetBoundary:s,setErrors:a,setMutateInstallationError:u,getMutateInstallationError:f,resetMutateInstallationErrorState:l,resetConfigureState:d,objectConfigurationsState:h,configureState:m,onInstallSuccess:y,onNextIncompleteTab:w,fieldMapping:g}=Nf(),[O,p]=I.useState(!1),{createInstallation:b}=jl(),v=i===Qr,x=f(i),S=I.useCallback(()=>{s(we.MAPPING),n!=null&&n.content&&!r&&i&&Xl(n,Ox,i,d)},[s,n,r,i,d]);I.useEffect(()=>{!m&&(n!=null&&n.content)&&!r&&S()},[m,h,n,r,S]);const A=()=>{l();const{requiredMapFields:R,selectedFieldMappings:D}=(m==null?void 0:m.read)||{},{errorList:K}=Jl(R,D,a);if(!(K.length>0))if(i&&(o!=null&&o.id)&&e&&n){p(!0);const j=eb(m,i,n,e,g);if(!j){console.error("Error when generating createConfig from configureState"),p(!1);return}b({config:j.content,onSuccess:L=>{t(L),y==null||y(L.id,L.config),p(!1),w()},onError:L=>{u(i)(L.message),p(!1)}})}else console.error("CreateInstallallation - onSaveReadCreate: missing required props")},N=()=>{if(l(),i&&(o!=null&&o.id)&&e&&n){p(!0);const R=nb(m,n,e);if(!R){console.error("Error when generating createConfig from configureState"),p(!1);return}b({config:R.content,onSuccess:D=>{t(D),y==null||y(D.id,D.config),p(!1),w()},onError:D=>{u(i)(D.message),p(!1)}})}else console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},F=R=>{R.preventDefault(),v?N():A()};return c.jsx(Ef,{errorMsg:x,isCreateMode:!0,isLoading:O,onSave:F,onReset:S})}const Sx=(e,t,n,r,i)=>{const o=Yl(e),s=Zl(e),a=ed(t,i),u=td(e),f={content:{read:{objects:{[t]:{objectName:t,selectedFields:o,selectedFieldMappings:s,dynamicMappingsInput:a,selectedValueMappings:u||{},backfill:r}}}}};return Mi(n)&&(f.content||(f.content={}),f.content.proxy={enabled:!0}),f},Ex=(e,t)=>{const r={content:{write:{objects:id(e)}}};return Mi(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r};function Nx({installation:e}){const{setInstallation:t,hydratedRevision:n,loading:r,selectedObjectName:i,resetBoundary:o,setErrors:s,setMutateInstallationError:a,getMutateInstallationError:u,resetConfigureState:f,configureState:l,onUpdateSuccess:d,onNextIncompleteTab:h,fieldMapping:m}=Nf(),{updateInstallation:y}=Ll(),[w,g]=I.useState(!1),O=i===Qr,p=u(i),{config:b}=e,v=I.useCallback(()=>{o(we.MAPPING),n!=null&&n.content&&!r&&i&&Xl(n,b,i,f)},[o,n,r,i,b,f]);I.useEffect(()=>{l||v()},[l,v]);const x=I.useMemo(()=>{var R,D,K;return(K=(D=(R=n==null?void 0:n.content)==null?void 0:R.read)==null?void 0:D.objects)==null?void 0:K.find(j=>(j==null?void 0:j.objectName)===i)},[n,i]),S=()=>{const{requiredMapFields:F,selectedFieldMappings:R}=(l==null?void 0:l.read)||{},{errorList:D}=Jl(F,R,s);if(!(D.length>0))if(n&&l&&i&&x){g(!0);const K=Sx(l,i,n,x.backfill,m);if(!K){console.error("Error when generating updateConfig from configureState"),g(!1);return}y({config:K.content,onSuccess:j=>{t(j),d==null||d(j.id,j.config),g(!1),h()},onError:j=>{a(i)(j.message),g(!1)}})}else console.error("UpdateInstallation - onSaveRead missing required props")},A=()=>{if(l&&n){g(!0);const F=Ex(l,n);if(!F){console.error("Error when generating write updateConfig from configureState"),g(!1);return}y({config:F.content,onSuccess:R=>{t(R),d==null||d(R.id,R.config),g(!1),h()},onError:R=>{a(i)(R.message),g(!1)}})}else console.error("UpdateInstallation - onSaveWrite missing required props")},N=F=>{F.preventDefault(),O?A():S()};return c.jsx(Ef,{errorMsg:p,onSave:N,onReset:v,isLoading:w})}function Tx(){const{integrationObj:e,installation:t}=lt();return e?t&&e?c.jsx(Nx,{installation:t}):c.jsx(_x,{}):c.jsx(Al,{message:"We can't load the integration"})}class ec extends I.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){var r,i;console.error("Ampersand Error Boundary caught an error:",t),console.error("[Error Info]:",n),(i=(r=this.props).onError)==null||i.call(r,t,n)}render(){var t;return this.state.hasError?this.props.fallback?this.props.fallback:c.jsx(_t,{message:((t=this.state.error)==null?void 0:t.message)||"Something went wrong. Please try again later."}):this.props.children}}function Rx(){return c.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),c.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function tc({text:e,children:t}){return c.jsx(si,{children:c.jsxs(_n,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[c.jsx(Rx,{}),c.jsx("p",{children:e}),t]})})}function Ax({provider:e}){const{providerName:t}=dt(e),n=`You have successfully installed your ${t} integration.`;return c.jsx(tc,{text:n,children:c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:c.jsx(Sf,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const Fx=e=>{const{read:t,write:n}=(e==null?void 0:e.content)??{};return!t&&!n};function Px({children:e}){var x;const t=I.useRef(!1),{projectIdOrName:n}=Ke(),{hydratedRevision:r,loading:i}=ci(),{integrationObj:o,installation:s,groupRef:a,consumerRef:u,onInstallSuccess:f,isIntegrationDeleted:l}=lt(),{mutate:d,isIdle:h,isPending:m,error:y,errorMsg:w}=kl(),{selectedConnection:g,isConnectionsLoading:O}=an(),p=i||m||O,b=(x=r==null?void 0:r.content)==null?void 0:x.provider,v=Fx(r);return I.useEffect(()=>{var S;if(!p&&!O&&r&&v&&!s&&g&&(o!=null&&o.id)&&!l&&b){const A={projectIdOrName:n,integrationId:o==null?void 0:o.id,installation:{groupRef:a,connectionId:g==null?void 0:g.id,config:{content:{provider:b}}}};Mi(r)===!0&&(A.installation.config.content.proxy=(S=r==null?void 0:r.content)==null?void 0:S.proxy),h&&!t.current&&d(A,{onSuccess:N=>{t.current||(f==null||f(N==null?void 0:N.id,N.config),t.current=!0)}})}},[r,v,s,g,n,o==null?void 0:o.id,a,u,p,f,l,O,b,d,h]),v&&b&&s?c.jsx(Ax,{provider:b}):y?c.jsx(_t,{message:w??"Create installation failed"}):o?p?c.jsx(ai,{}):c.jsx("div",{children:e}):c.jsx(_t,{message:"We can't load the integration"})}function $i(){const e=ut(),t=We();return On({mutationKey:["createConnection"],mutationFn:async n=>(await e()).connectionApi.generateConnection(n),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]})},onError:n=>{console.error("Error creating connection and loading provider info"),Je(n)}})}function Dx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a}){const{projectIdOrName:u}=Ke(),f=$i(),l=I.useCallback(d=>{var w;const{apiKey:h,providerMetadata:m}=d,y={projectIdOrName:u,generateConnectionParams:{providerWorkspaceRef:(w=m==null?void 0:m.workspace)==null?void 0:w.value,groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,apiKey:h,...m&&{providerMetadata:m}}};f.mutate(y)},[u,o,i,r,n,e,f]);return a===null?c.jsx(Ib,{provider:e,providerInfo:t,handleSubmit:l,error:null}):s}function Mx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a}){const{projectIdOrName:u}=Ke(),f=$i(),l=I.useCallback(d=>{var g;const{user:h,pass:m,providerMetadata:y}=d,w={projectIdOrName:u,generateConnectionParams:{providerWorkspaceRef:(g=y==null?void 0:y.workspace)==null?void 0:g.value,groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:h,password:m},...y&&{providerMetadata:y}}};f.mutate(w)},[u,o,i,r,n,e,f]);return a===null?c.jsx(Sb,{provider:e,providerInfo:t,handleSubmit:l,error:null}):s}function xu({url:e,prompt:t,inputName:n}){return c.jsx("p",{style:{color:"var(--amp-colors-text-muted)",display:"flex",justifyContent:"space-between"},children:c.jsxs("span",{children:[e?c.jsx(ba,{href:e,newTab:!0,children:c.jsx("span",{style:{textDecoration:"underline"},children:n})}):c.jsx("span",{children:n})," ",t&&c.jsx(pf,{id:`docs-helper-text-${Mw(n||(t==null?void 0:t.slice(0,50)))}`,tooltipText:t})]})})}function kx({providerInfo:e,handleSubmit:t,isButtonDisabled:n,buttonVariant:r}){var h,m;const[i,o]=I.useState({}),s=((h=e.metadata)==null?void 0:h.input)||[],a=y=>{const{name:w,value:g}=y.currentTarget;o(O=>({...O,[w]:g.trim()}))},u=Gr(s,i),f=n||!u,l=((m=e.customOpts)==null?void 0:m.inputs)||[],d=()=>{const y=$o(s,i),w=Object.fromEntries(l.map(g=>[g.name,i[g.name]]));t({customAuth:w,providerMetadata:y})};return c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[l.map(y=>c.jsxs("div",{children:[c.jsx(xu,{url:y.docsURL,prompt:y.prompt,inputName:y.displayName}),c.jsx(Ot.PasswordInput,{id:y.name,name:y.name,onChange:a,placeholder:""})]},y.name)),s.map(y=>c.jsxs("div",{children:[y.docsURL&&c.jsx(xu,{url:y.docsURL,prompt:y.displayName||y.name,inputName:y.displayName||Wt(y.name.toLowerCase())}),c.jsx(Ot.Input,{id:y.name,name:y.name,type:"text",placeholder:"",onChange:a})]},y.name)),c.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:f,type:"submit",onClick:d,variant:r,children:"Next"})]})}function jx({providerInfo:e,handleSubmit:t,error:n,isButtonDisabled:r}){return c.jsxs(er,{children:[c.jsx(tr,{children:`Set up ${e.displayName} integration`}),c.jsx(cn,{error:n}),c.jsx(kx,{providerInfo:e,handleSubmit:t,isButtonDisabled:r})]})}function Lx({providerInfo:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,selectedConnection:s}){const{projectIdOrName:a}=Ke(),u=$i(),[f,l]=I.useState(null),d=I.useCallback(h=>{var g;const{customAuth:m,providerMetadata:y}=h;l(null);const w={projectIdOrName:a,generateConnectionParams:{providerWorkspaceRef:(g=y==null?void 0:y.workspace)==null?void 0:g.value,groupName:i,groupRef:r,consumerName:n,consumerRef:t,provider:e.name,customAuth:m,...y&&{providerMetadata:y}}};u.mutate(w,{onError:O=>{Je(O,l)},onSuccess:()=>{l(null)}})},[a,i,r,n,t,e.name,u]);return s===null?c.jsx(jx,{providerInfo:e,handleSubmit:d,error:f}):o}function Vx({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 c.jsxs(er,{children:[c.jsx(tr,{children:o||`Set up ${r} integration`}),c.jsx(cn,{error:t}),i,c.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function $x({...e}){return c.jsx(Vx,{...e})}function Kx({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,selectedConnection:s,providerName:a}){const{projectIdOrName:u}=Ke(),f=$i(),l=I.useCallback(()=>{const d={projectIdOrName:u,generateConnectionParams:{groupName:i,groupRef:r,consumerName:n,consumerRef:t,provider:e}};f.mutate(d)},[u,i,r,n,t,e,f]);return s===null?c.jsx($x,{handleSubmit:l,error:null,providerName:a}):o}const Ux=()=>{const e=ut(),t=We();return On({mutationKey:["createOauthConnection"],mutationFn:async n=>(await e()).oAuthApi.oauthConnect(n),onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function qx({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return c.jsxs(er,{children:[c.jsx(tr,{children:`Set up ${r} integration`}),c.jsx(yb,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),c.jsx(cn,{error:t}),c.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:n?"Loading...":"Next"})]})}const Bx="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function Jx({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return c.jsxs(er,{children:[c.jsx(tr,{children:"Enter your Salesforce subdomain"}),c.jsx(ba,{href:Bx,newTab:!0,children:"What is my Salesforce subdomain?"}),c.jsx(cn,{error:n}),c.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[c.jsx(Ot.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:i=>t(i.currentTarget.value)}),c.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),c.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function Hx({handleSubmit:e,setFormData:t,error:n,isButtonDisabled:r,providerName:i,metadataFields:o}){return c.jsxs(er,{children:[c.jsxs(tr,{children:["Enter your ",i," workspace"]}),c.jsx(cn,{error:n}),c.jsx("br",{}),o.map(s=>c.jsx(Ot.Input,{id:s.name,name:s.name,type:"text",placeholder:s.displayName||s.name,onChange:a=>t(s.name,a.currentTarget.value)},s.name)),c.jsx("br",{}),c.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const Ou=600,_u=600,Su="salesforce";function Wx({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o}){var D;const{projectId:s}=Yn(),a=We(),u=I.useRef(null),[f,l]=I.useState(null),[d,h]=I.useState(""),[m,y]=I.useState({}),[w,g]=I.useState({}),{data:O}=Vo(e),p=((D=O==null?void 0:O.metadata)==null?void 0:D.input)||[],{mutateAsync:b,isPending:v}=Ux(),{isFetching:x,refetch:S}=ya({groupRef:r,provider:e});I.useEffect(()=>{const K=j=>{var L,se,re;j.origin===Nl&&(((L=j.data)==null?void 0:L.eventType)==="AUTHORIZATION_SUCCEEDED"?(l(null),console.debug("New connection:",j.data.data.connection),a.invalidateQueries({queryKey:["amp","connections"]})):((se=j.data)==null?void 0:se.eventType)==="AUTHORIZATION_FAILED"&&(console.error("OAuth failed:",j.data.data.error),a.invalidateQueries({queryKey:["amp","connections"]}),l(j.data.data.error||"An error occurred. Please try again.")),(re=u.current)==null||re.close())};return window.addEventListener("message",K),()=>window.removeEventListener("message",K)},[a]);const A=K=>{h(K),y(j=>({...j,workspace:K})),g(j=>({...j,workspace:{value:K,source:"input"}}))},N=(K,j)=>{y(L=>({...L,[K]:j})),g(L=>({...L,[K]:{value:j,source:"input"}}))},F=async()=>{var K;l(null);try{const{data:j}=await S();if(j&&j.length>0){console.debug("connections found");return}}catch{console.debug("error with fetching connections")}if(p.length>0&&!Gr(p,m)){l("Please fill in all required fields");return}try{const j=await b({connectOAuthParams:{provider:e,consumerRef:t,groupRef:r,projectId:s||"",consumerName:n,groupName:i,providerWorkspaceRef:e===Su?d:(K=w==null?void 0:w.workspace)==null?void 0:K.value,providerMetadata:w}});if(j){const L=window.screenX+(window.outerWidth-Ou)/2,se=window.screenY+(window.outerHeight-_u)/2.5,re=`width=${Ou},height=${_u},left=${L},top=${se}`;u.current=window.open(j,"OAuthPopup",re)}}catch(j){console.error(j),l(j instanceof Error?j.message:String(j)||"An error occurred. Please try again.")}},R=e===Su?c.jsx(Jx,{handleSubmit:F,setWorkspace:A,error:f,isButtonDisabled:d.length===0||v||x}):p.length>0?c.jsx(Hx,{handleSubmit:F,setFormData:N,error:f,isButtonDisabled:!Gr(p,m)||v||x,providerName:o,metadataFields:p}):c.jsx(qx,{handleSubmit:F,error:f,providerName:o,isButtonDisabled:v||x});return c.jsx("div",{children:R})}function zx({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,explicitScopesRequired:s,selectedConnection:a}){const{projectIdOrName:u}=Ke(),f=$i(),[l,d]=I.useState(null),h=I.useCallback(m=>{var w,g;d(null);const y={projectIdOrName:u,generateConnectionParams:{groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:(g=(w=m.providerMetadata)==null?void 0:w.workspace)==null?void 0:g.value,oauth2ClientCredentials:{clientId:m.clientId,clientSecret:m.clientSecret,scopes:m.scopes},...m.providerMetadata&&{providerMetadata:m.providerMetadata}}};f.mutate(y,{onError:()=>d("Error loading provider info")})},[u,o,i,r,n,e,f]);return a===null?c.jsx(Nb,{provider:e,providerName:t,handleSubmit:h,error:l,explicitScopesRequired:s}):c.jsx(_i,{})}function Qx({...e}){return c.jsx(zx,{...e})}const Gx="authorizationCode",Xx="authorizationCodePKCE",Yx="clientCredentials";function Zx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,selectedConnection:s,setSelectedConnection:a}){const{providerName:u}=dt(e);if(t.oauth2Opts===void 0)return c.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:f,explicitScopesRequired:l}=t.oauth2Opts,d={provider:e,consumerRef:n,consumerName:r,groupRef:i,groupName:o,providerName:u};return f===Gx||f===Xx?c.jsx(Wx,{...d}):f===Yx?c.jsx(Qx,{...d,explicitScopesRequired:l,selectedConnection:s,setSelectedConnection:a}):f==="password"?c.jsx("em",{children:"Password flow not supported yet"}):c.jsxs("em",{children:["Unsupported grant type: ",f]})}function eO(e){const{selectedConnection:t}=an();I.useEffect(()=>{e&&t&&e(t)},[e,t])}function tO({onSuccess:e}){eO(e)}function Tf({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,onSuccess:s,onDisconnectSuccess:a,resetComponent:u}){const{data:f,isLoading:l,isError:d,error:h,providerName:m,selectedProvider:y}=dt(e),{provider:w,isIntegrationDeleted:g}=lt(),{selectedConnection:O,setSelectedConnection:p}=an();tO({onSuccess:s});const b=We(),v=f;I.useEffect(()=>{d&&(console.error("Error loading provider info."),Je(h))},[d,h]);const x=I.useCallback(()=>{b.clear(),u()},[u,b]);if(!e&&!w)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(g)return c.jsx(tc,{text:"Integration successfully uninstalled.",children:c.jsx(He,{type:"button",onClick:x,style:{width:"100%"},children:"Reinstall Integration"})});if(O)return o;if(l)return c.jsx(ai,{});if(v==null)return c.jsx(_t,{message:"Provider info was not found."});const S={provider:y,consumerRef:t,consumerName:n,groupRef:r,groupName:i,selectedConnection:O,setSelectedConnection:p,providerName:m,providerInfo:v,onDisconnectSuccess:a};return v.authType==="none"?c.jsx(Kx,{...S,children:o}):v.authType==="basic"?c.jsx(Mx,{...S,children:o}):v.authType==="apiKey"?c.jsx(Dx,{...S,children:o}):v.authType==="custom"?c.jsx(Lx,{...S,children:o}):c.jsx(Zx,{...S})}function nO(e){const t=e+"CollectionProvider",[n,r]=zo(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=w=>{const{scope:g,children:O}=w,p=I.useRef(null),b=I.useRef(new Map).current;return c.jsx(i,{scope:g,itemMap:b,collectionRef:p,children:O})};s.displayName=t;const a=e+"CollectionSlot",u=na(a),f=I.forwardRef((w,g)=>{const{scope:O,children:p}=w,b=o(a,O),v=ni(g,b.collectionRef);return c.jsx(u,{ref:v,children:p})});f.displayName=a;const l=e+"CollectionItemSlot",d="data-radix-collection-item",h=na(l),m=I.forwardRef((w,g)=>{const{scope:O,children:p,...b}=w,v=I.useRef(null),x=ni(g,v),S=o(l,O);return I.useEffect(()=>(S.itemMap.set(v,{ref:v,...b}),()=>void S.itemMap.delete(v))),c.jsx(h,{[d]:"",ref:x,children:p})});m.displayName=l;function y(w){const g=o(e+"CollectionConsumer",w);return I.useCallback(()=>{const p=g.collectionRef.current;if(!p)return[];const b=Array.from(p.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((S,A)=>b.indexOf(S.ref.current)-b.indexOf(A.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:s,Slot:f,ItemSlot:m},y,r]}var rO=B[" useId ".trim().toString()]||(()=>{}),iO=0;function Rf(e){const[t,n]=B.useState(rO());return Ni(()=>{n(r=>r??String(iO++))},[e]),e||(t?`radix-${t}`:"")}function oO(e){const t=B.useRef(e);return B.useEffect(()=>{t.current=e}),B.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var sO=B.createContext(void 0);function Af(e){const t=B.useContext(sO);return e||t||"ltr"}var bs="rovingFocusGroup.onEntryFocus",aO={bubbles:!1,cancelable:!0},Ki="RovingFocusGroup",[ra,Ff,cO]=nO(Ki),[uO,Pf]=zo(Ki,[cO]),[lO,dO]=uO(Ki),Df=B.forwardRef((e,t)=>c.jsx(ra.Provider,{scope:e.__scopeRovingFocusGroup,children:c.jsx(ra.Slot,{scope:e.__scopeRovingFocusGroup,children:c.jsx(fO,{...e,ref:t})})}));Df.displayName=Ki;var fO=B.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:u,onEntryFocus:f,preventScrollOnEntryFocus:l=!1,...d}=e,h=B.useRef(null),m=ni(t,h),y=Af(o),[w,g]=za({prop:s,defaultProp:a??null,onChange:u,caller:Ki}),[O,p]=B.useState(!1),b=oO(f),v=Ff(n),x=B.useRef(!1),[S,A]=B.useState(0);return B.useEffect(()=>{const N=h.current;if(N)return N.addEventListener(bs,b),()=>N.removeEventListener(bs,b)},[b]),c.jsx(lO,{scope:n,orientation:r,dir:y,loop:i,currentTabStopId:w,onItemFocus:B.useCallback(N=>g(N),[g]),onItemShiftTab:B.useCallback(()=>p(!0),[]),onFocusableItemAdd:B.useCallback(()=>A(N=>N+1),[]),onFocusableItemRemove:B.useCallback(()=>A(N=>N-1),[]),children:c.jsx(Sn.div,{tabIndex:O||S===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:"none",...e.style},onMouseDown:Ht(e.onMouseDown,()=>{x.current=!0}),onFocus:Ht(e.onFocus,N=>{const F=!x.current;if(N.target===N.currentTarget&&F&&!O){const R=new CustomEvent(bs,aO);if(N.currentTarget.dispatchEvent(R),!R.defaultPrevented){const D=v().filter(re=>re.focusable),K=D.find(re=>re.active),j=D.find(re=>re.id===w),se=[K,j,...D].filter(Boolean).map(re=>re.ref.current);jf(se,l)}}x.current=!1}),onBlur:Ht(e.onBlur,()=>p(!1))})})}),Mf="RovingFocusGroupItem",kf=B.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,children:s,...a}=e,u=Rf(),f=o||u,l=dO(Mf,n),d=l.currentTabStopId===f,h=Ff(n),{onFocusableItemAdd:m,onFocusableItemRemove:y,currentTabStopId:w}=l;return B.useEffect(()=>{if(r)return m(),()=>y()},[r,m,y]),c.jsx(ra.ItemSlot,{scope:n,id:f,focusable:r,active:i,children:c.jsx(Sn.span,{tabIndex:d?0:-1,"data-orientation":l.orientation,...a,ref:t,onMouseDown:Ht(e.onMouseDown,g=>{r?l.onItemFocus(f):g.preventDefault()}),onFocus:Ht(e.onFocus,()=>l.onItemFocus(f)),onKeyDown:Ht(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){l.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const O=mO(g,l.orientation,l.dir);if(O!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let b=h().filter(v=>v.focusable).map(v=>v.ref.current);if(O==="last")b.reverse();else if(O==="prev"||O==="next"){O==="prev"&&b.reverse();const v=b.indexOf(g.currentTarget);b=l.loop?gO(b,v+1):b.slice(v+1)}setTimeout(()=>jf(b))}}),children:typeof s=="function"?s({isCurrentTabStop:d,hasTabStop:w!=null}):s})})});kf.displayName=Mf;var pO={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function hO(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function mO(e,t,n){const r=hO(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return pO[r]}function jf(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function gO(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var yO=Df,vO=kf,Go="Tabs",[wO,zO]=zo(Go,[Pf]),Lf=Pf(),[bO,nc]=wO(Go),Vf=B.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:a,activationMode:u="automatic",...f}=e,l=Af(a),[d,h]=za({prop:r,onChange:i,defaultProp:o??"",caller:Go});return c.jsx(bO,{scope:n,baseId:Rf(),value:d,onValueChange:h,orientation:s,dir:l,activationMode:u,children:c.jsx(Sn.div,{dir:l,"data-orientation":s,...f,ref:t})})});Vf.displayName=Go;var $f="TabsList",Kf=B.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=nc($f,n),s=Lf(n);return c.jsx(yO,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:c.jsx(Sn.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});Kf.displayName=$f;var Uf="TabsTrigger",qf=B.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=nc(Uf,n),a=Lf(n),u=Jf(s.baseId,r),f=Hf(s.baseId,r),l=r===s.value;return c.jsx(vO,{asChild:!0,...a,focusable:!i,active:l,children:c.jsx(Sn.button,{type:"button",role:"tab","aria-selected":l,"aria-controls":f,"data-state":l?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:u,...o,ref:t,onMouseDown:Ht(e.onMouseDown,d=>{!i&&d.button===0&&d.ctrlKey===!1?s.onValueChange(r):d.preventDefault()}),onKeyDown:Ht(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(r)}),onFocus:Ht(e.onFocus,()=>{const d=s.activationMode!=="manual";!l&&!i&&d&&s.onValueChange(r)})})})});qf.displayName=Uf;var Bf="TabsContent",IO=B.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,a=nc(Bf,n),u=Jf(a.baseId,r),f=Hf(a.baseId,r),l=r===a.value,d=B.useRef(l);return B.useEffect(()=>{const h=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(h)},[]),c.jsx(Qa,{present:i||l,children:({present:h})=>c.jsx(Sn.div,{"data-state":l?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":u,hidden:!h,id:f,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:h&&o})})});IO.displayName=Bf;function Jf(e,t){return`${e}-trigger-${t}`}function Hf(e,t){return`${e}-content-${t}`}var CO=Vf,xO=Kf,Wf=qf;const OO=c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[c.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),c.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function _O(e,t){return t?I.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},I.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?OO:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:c.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}function SO(){return c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{d:"M8 11C9.65685 11 11 9.65685 11 8C11 6.34315 9.65685 5 8 5C6.34315 5 5 6.34315 5 8C5 9.65685 6.34315 11 8 11Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M12.3378 5.04365C12.4882 5.25907 12.62 5.48699 12.7315 5.7249L14.3503 6.6249C14.5524 7.5302 14.5545 8.4687 14.3565 9.3749L12.7315 10.2749C12.62 10.5128 12.4882 10.7407 12.3378 10.9562L12.369 12.8124C11.683 13.4375 10.871 13.9085 9.98776 14.1937L8.39401 13.2374C8.13185 13.2562 7.86868 13.2562 7.60651 13.2374L6.01901 14.1874C5.13295 13.9075 4.31832 13.4383 3.63151 12.8124L3.66276 10.9624C3.51356 10.744 3.38189 10.5141 3.26901 10.2749L1.65026 9.3749C1.44814 8.46961 1.446 7.53111 1.64401 6.6249L3.26901 5.7249C3.38056 5.48699 3.5123 5.25907 3.66276 5.04365L3.63151 3.1874C4.31754 2.56226 5.1295 2.09128 6.01276 1.80615L7.60651 2.7624C7.86868 2.74365 8.13185 2.74365 8.39401 2.7624L9.98151 1.8124C10.8676 2.09234 11.6822 2.5615 12.369 3.1874L12.3378 5.04365Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const EO="_tabsRoot_ktpr0_1",NO="_tabsList_ktpr0_6",TO="_tabTrigger_ktpr0_12",Ao={tabsRoot:EO,tabsList:NO,tabTrigger:TO};function RO(){return c.jsxs(c.Fragment,{children:[c.jsx(Uo,{style:{margin:"1rem 0"}}),c.jsx(Wf,{value:Co,className:Ao.tabTrigger,children:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[c.jsx(SO,{}),c.jsx("span",{children:"Manage"})]})})]})}function zf({objectName:e,completed:t,pending:n,displayName:r}){return c.jsx(Wf,{value:e,className:Ao.tabTrigger,children:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[_O(t,n),c.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[c.jsx("span",{children:r||e}),n&&c.jsx("span",{style:{fontSize:".8rem",fontStyle:"italic"},children:"pending"})]})]})})}function AO({completed:e,pending:t,displayName:n}){return c.jsxs(c.Fragment,{children:[c.jsx(Uo,{style:{margin:"1rem 0"}}),c.jsx(zf,{objectName:Qr,completed:e,pending:t,displayName:n},"other-write")]})}function FO({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:i}){var l,d,h,m;const{data:o}=Ol(),{installation:s}=Nr(),a=s==null?void 0:s.config,u=(d=(l=a==null?void 0:a.content)==null?void 0:l.write)==null?void 0:d.objects,f=(m=(h=r==null?void 0:r.other)==null?void 0:h.write)==null?void 0:m.selectedWriteObjects;return c.jsx(CO,{value:e,className:Ao.tabsRoot,onValueChange:n,children:c.jsxs(xO,{className:Ao.tabsList,children:[t.map(y=>{var D,K,j,L,se,re;const w=(j=(K=(D=a==null?void 0:a.content)==null?void 0:D.read)==null?void 0:K.objects)==null?void 0:j[y.name],g=r==null?void 0:r[y.name],O=nd(a,y.name),p=(L=g==null?void 0:g.read)==null?void 0:L.selectedFieldMappings,b=!Wl(O,p),v=o?wa(a,o,y.name):void 0,x=(se=g==null?void 0:g.read)==null?void 0:se.selectedOptionalFields,S=!Hl(v,x),A=w==null?void 0:w.selectedValueMappings,N=(re=g==null?void 0:g.read)==null?void 0:re.selectedValueMappings,F=!zl(A,N),R=S||b||F||!1;return c.jsx(zf,{objectName:y.name,displayName:y.displayName,completed:y.completed,pending:R},y.name)}),i&&(()=>{const y=!Ql(u||{},f||{});return c.jsx(AO,{completed:i.completed,pending:y,displayName:"Write"})})(),c.jsx(RO,{})]})})}function PO(e,t){return t===Co?{name:Co,completed:!1}:e.find(n=>n.name===t)}function DO({children:e}){var O;const{data:t}=Yn(),{installation:n}=lt(),{providerName:r}=dt(),{hydratedRevision:i}=ci(),{objectConfigurationsState:o}=xa(),[s,a]=I.useState(""),u=(t==null?void 0:t.appName)||"",f=n==null?void 0:n.config,l=i&&ql(f,i),d=l!==null,h=!!((O=i==null?void 0:i.content)!=null&&O.write),m=h?Bl(f):void 0,y=I.useMemo(()=>{const p=[...l||[]];return m&&h&&p.push(m),p},[l,m,h]),w=PO(y,s),g=I.useCallback(()=>{const p=y.find(b=>w!==b&&!b.completed);p&&a(p.name)},[y,w]);return I.useEffect(()=>{!s&&y.length>0&&a(y[0].name)},[y,s,g]),c.jsx(md.Provider,{value:g,children:c.jsx(pd.Provider,{value:w==null?void 0:w.name,children:c.jsxs(si,{style:{maxWidth:"55rem"},children:[c.jsxs(_n,{style:{display:"flex",gap:"1rem",padding:"3rem",paddingBottom:"6rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[c.jsxs("div",{style:{width:"20rem"},children:[c.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[r," integration"]}),c.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:u}),d&&c.jsx(FO,{value:s,readNavObjects:l,onValueChange:p=>a(p),objectConfigurationsState:o,writeNavObject:m})]}),e]}),c.jsx(ad,{})]})})})}function MO({...e}){return c.jsx(DO,{...e})}const kO="_resetContainer_lkwv9_4",Qf={resetContainer:kO},jO=({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:u})=>{var g;const{projectIdOrName:f,isLoading:l}=Yn(),{isLoading:d}=jo(),{isError:h,errorState:m}=sn(),{seed:y,reset:w}=Vl();return l||d?c.jsx(ai,{}):h(we.PROJECT,f)?c.jsx(_t,{message:`Error loading project ${f}`}):h(we.INTEGRATION_LIST,f)?c.jsx(_t,{message:"Error retrieving integrations for the project, double check the API key"}):(g=m[we.INTEGRATION_LIST])!=null&&g.apiError?c.jsx(_t,{message:"Something went wrong, couldn't find integration information"}):c.jsx("div",{className:Qf.resetContainer,children:c.jsx(jw,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:u,resetComponent:w,children:c.jsx(Ml,{children:c.jsx(Tf,{consumerRef:t,consumerName:n,groupRef:r,groupName:i,resetComponent:w,children:c.jsx(Vb,{resetComponent:w,children:c.jsx(Px,{children:c.jsx(Ub,{children:c.jsx(MO,{children:c.jsx(Tx,{})})})})})})})},y)})};function LO({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:u}){const f={integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:u};return c.jsx(ec,{fallback:c.jsx(_t,{message:"Something went wrong, couldn't find integration information"}),children:c.jsx(ga,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:c.jsx(jO,{...f})})})}function VO(){return c.jsxs(si,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[c.jsx(_i,{}),c.jsx("p",{children:"Redirecting"})]})}function $O({redirectURL:e,children:t}){return I.useEffect(()=>{e&&window.location.replace(e)},[e]),e?c.jsx(VO,{}):t}function KO({resetComponent:e,onDisconnectSuccess:t,provider:n}){const[r,i]=I.useState(!1);return c.jsxs(c.Fragment,{children:[r===!1&&c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Manage connection"}),c.jsxs("div",{style:{padding:"1rem 0",width:"100%",display:"flex",flexDirection:"column",gap:"1rem"},children:[c.jsx("p",{children:"Click to reauthenticate or refresh your connection."}),c.jsx(He,{type:"button",onClick:()=>i(!0),variant:"ghost",style:{fontSize:"13px"},children:"Update connection"})]})]}),r===!0&&c.jsxs(c.Fragment,{children:[c.jsx(Ca,{provider:n}),c.jsx(_f,{resetComponent:e,onDisconnectSuccess:t})]})]})}function UO({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Yn(),{providerName:i}=dt(e),o=`You have successfully connected your ${i} account to ${r}.`;return c.jsx(tc,{text:o,children:c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"},children:c.jsx(KO,{resetComponent:n,onDisconnectSuccess:t,provider:e})})})}function qO({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,redirectUrl:o,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:u}){const{seed:f,reset:l}=Vl(),d=I.useCallback(h=>{s?s(h.id):u&&u(h)},[s,u]);return c.jsx(ec,{fallback:c.jsx(_t,{message:"Something went wrong with the connection. Please try again."}),children:c.jsx("div",{className:Qf.resetContainer,children:c.jsx(ga,{integration:"connect-provider-dummy-string",consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:c.jsx(Ml,{groupRef:r,provider:e,children:c.jsx(Tf,{resetComponent:l,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onSuccess:d,onDisconnectSuccess:a,children:c.jsx($O,{redirectURL:o,children:c.jsx(UO,{resetComponent:l,provider:e,onDisconnectSuccess:a})})})})})},f)})}const BO=(e,t)=>{const{data:n,isLoading:r,isError:i,error:o}=pa(e,t),s=((n==null?void 0:n.length)||0)>0,a=!!n&&!r,u=n==null?void 0:n[0],f=u==null?void 0:u.config;return I.useEffect(()=>{i&&Je(o)},[i,o]),{isLoaded:a,isIntegrationInstalled:s,isLoading:r,config:f}};exports.AmpersandContext=la;exports.AmpersandErrorBoundary=ec;exports.AmpersandProvider=Zv;exports.ConnectProvider=qO;exports.FieldSettingWriteOnCreateEnum=yh;exports.FieldSettingWriteOnUpdateEnum=vh;exports.InstallIntegration=LO;exports.InstallationProvider=ga;exports.useAmpersandProviderProps=Ke;exports.useConfig=mw;exports.useConnection=ha;exports.useCreateInstallation=jl;exports.useDeleteInstallation=Uw;exports.useInstallation=Nr;exports.useIsIntegrationInstalled=BO;exports.useLocalConfig=hw;exports.useManifest=Lo;exports.useUpdateInstallation=Ll;
64
+ */var Pd;function W_(){return Pd||(Pd=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"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),y=!1,m=!1,v=!1,b=!1,g=!1,w;w=Symbol.for("react.module.reference");function x(ee){return!!(typeof ee=="string"||typeof ee=="function"||ee===n||ee===i||g||ee===r||ee===c||ee===u||b||ee===f||y||m||v||typeof ee=="object"&&ee!==null&&(ee.$$typeof===h||ee.$$typeof===d||ee.$$typeof===o||ee.$$typeof===s||ee.$$typeof===l||ee.$$typeof===w||ee.getModuleId!==void 0))}function O(ee){if(typeof ee=="object"&&ee!==null){var Ke=ee.$$typeof;switch(Ke){case e:var Be=ee.type;switch(Be){case n:case i:case r:case c:case u:return Be;default:var je=Be&&Be.$$typeof;switch(je){case a:case s:case l:case h:case d:case o:return je;default:return Ke}}case t:return Ke}}}var E=s,D=o,N=e,M=l,R=n,P=h,F=d,U=t,B=i,X=r,se=c,ce=u,ge=!1,we=!1;function I(ee){return ge||(ge=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function J(ee){return we||(we=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function V(ee){return O(ee)===s}function S(ee){return O(ee)===o}function z(ee){return typeof ee=="object"&&ee!==null&&ee.$$typeof===e}function $(ee){return O(ee)===l}function Y(ee){return O(ee)===n}function ne(ee){return O(ee)===h}function te(ee){return O(ee)===d}function ae(ee){return O(ee)===t}function Z(ee){return O(ee)===i}function ye(ee){return O(ee)===r}function q(ee){return O(ee)===c}function be(ee){return O(ee)===u}Me.ContextConsumer=E,Me.ContextProvider=D,Me.Element=N,Me.ForwardRef=M,Me.Fragment=R,Me.Lazy=P,Me.Memo=F,Me.Portal=U,Me.Profiler=B,Me.StrictMode=X,Me.Suspense=se,Me.SuspenseList=ce,Me.isAsyncMode=I,Me.isConcurrentMode=J,Me.isContextConsumer=V,Me.isContextProvider=S,Me.isElement=z,Me.isForwardRef=$,Me.isFragment=Y,Me.isLazy=ne,Me.isMemo=te,Me.isPortal=ae,Me.isProfiler=Z,Me.isStrictMode=ye,Me.isSuspense=q,Me.isSuspenseList=be,Me.isValidElementType=x,Me.typeOf=O}()),Me}process.env.NODE_ENV==="production"?fl.exports=J_():fl.exports=W_();var Fd=fl.exports;const Dd=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Md=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",ba=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Md(n.overflowY,t)||Md(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},Ho=(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,Q_=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},G_=(e,t)=>{var n,r,i,o;if(typeof document>"u")return[];const{inline:s,boundary:a,skipOverflowHiddenElements:l}=t,c=typeof a=="function"?a:U=>U!==a;if(!Dd(e))throw new TypeError("Invalid target");const u=document.scrollingElement||document.documentElement,d=[];let h=e;for(;Dd(h)&&c(h);){if(h=Q_(h),h===u){d.push(h);break}h!=null&&h===document.body&&ba(h)&&!ba(document.documentElement)||h!=null&&ba(h,l)&&d.push(h)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,y=(o=(i=window.visualViewport)==null?void 0:i.height)!=null?o:innerHeight,{scrollX:m,scrollY:v}=window,{height:b,width:g,top:w,right:x,bottom:O,left:E}=e.getBoundingClientRect(),{top:D,right:N,left:M}=(U=>{const B=window.getComputedStyle(U);return{top:parseFloat(B.scrollMarginTop)||0,right:parseFloat(B.scrollMarginRight)||0,bottom:parseFloat(B.scrollMarginBottom)||0,left:parseFloat(B.scrollMarginLeft)||0}})(e);let R=w-D,P=s==="center"?E+g/2-M+N:s==="end"?x+N:E-M;const F=[];for(let U=0;U<d.length;U++){const B=d[U],{height:X,width:se,top:ce,right:ge,bottom:we,left:I}=B.getBoundingClientRect();if(w>=0&&E>=0&&O<=y&&x<=f&&w>=ce&&O<=we&&E>=I&&x<=ge)return F;const J=getComputedStyle(B),V=parseInt(J.borderLeftWidth,10),S=parseInt(J.borderTopWidth,10),z=parseInt(J.borderRightWidth,10),$=parseInt(J.borderBottomWidth,10);let Y=0,ne=0;const te="offsetWidth"in B?B.offsetWidth-B.clientWidth-V-z:0,ae="offsetHeight"in B?B.offsetHeight-B.clientHeight-S-$:0,Z="offsetWidth"in B?B.offsetWidth===0?0:se/B.offsetWidth:0,ye="offsetHeight"in B?B.offsetHeight===0?0:X/B.offsetHeight:0;if(u===B)Y=Ho(v,v+y,y,S,$,v+R,v+R+b,b),ne=s==="start"?P:s==="center"?P-f/2:s==="end"?P-f:Ho(m,m+f,f,V,z,m+P,m+P+g,g),Y=Math.max(0,Y+v),ne=Math.max(0,ne+m);else{Y=Ho(ce,we,X,S,$+ae,R,R+b,b),ne=s==="start"?P-I-V:s==="center"?P-(I+se/2)+te/2:s==="end"?P-ge+z+te:Ho(I,ge,se,V,z+te,P,P+g,g);const{scrollLeft:q,scrollTop:be}=B;Y=ye===0?0:Math.max(0,Math.min(be+Y/ye,B.scrollHeight-X/ye+ae)),ne=Z===0?0:Math.max(0,Math.min(q+ne/Z,B.scrollWidth-se/Z+te)),R+=be-Y,P+=q-ne}F.push({el:B,top:Y,left:ne})}return F};var Si=function(){return Si=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},Si.apply(this,arguments)};var X_=0;function Ld(e){return typeof e=="function"?e:Ht}function Ht(){}function Lh(e,t){if(e){var n=G_(e,{boundary:t});n.forEach(function(r){var i=r.el,o=r.top,s=r.left;i.scrollTop=o,i.scrollLeft=s})}}function jd(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function au(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 ct(){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 ei(){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 jh(){return String(X_++)}function Y_(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 Bd(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function Bh(e){return typeof e.type=="string"}function Vh(e){return e.props}function Z_(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var eT=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function Jo(e){e===void 0&&(e={});var t={};return eT.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function ys(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=vs(t,r)?t[r]:e[r],n},{})}function vs(e,t){return e[t]!==void 0}function pl(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function tT(e){return Object.prototype.toString.call(e)==="[object Object]"}function Tr(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 l=Oi(a,t<0,n,r,i);return l===-1?e>=o?-1:e:l}function Oi(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?Oi(t?o-1:0,t,n,r):-1}function ws(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(i){return i&&(jd(i,e,n)||r&&jd(i,n.document.activeElement,n))})}var lu=Ht;process.env.NODE_ENV!=="production"&&(lu=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 nT=au(function(e){Uh(e).textContent=""},500);function Uh(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 $h(e,t){if(!(!e||!t)){var n=Uh(t);n.textContent=e,nT(t)}}function rT(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var qh=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,zh=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,Kh=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,es=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,ts=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,Hh=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Jh=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Wh=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Qh=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Gh=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Xh=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,Yh=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Zh=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,hl=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,em=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,tm=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,nm=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,iT=Object.freeze({__proto__:null,blurButton:em,blurInput:Xh,changeInput:Yh,clickButton:hl,clickItem:Gh,controlledPropUpdatedSelectedItem:tm,itemMouseEnter:Kh,keyDownArrowDown:ts,keyDownArrowUp:es,keyDownEnd:Qh,keyDownEnter:Jh,keyDownEscape:Hh,keyDownHome:Wh,keyDownSpaceButton:Zh,mouseUp:zh,touchEnd:nm,unknown:qh}),oT=["refKey","ref"],sT=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],aT=["onKeyDown","onBlur","onChange","onInput","onChangeText"],lT=["refKey","ref"],uT=["onMouseMove","onMouseDown","onClick","onPress","index","item"],cT=function(){var e=function(t){function n(i){var o;o=t.call(this,i)||this,o.id=o.props.id||"downshift-"+jh(),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(g){return o.id+"-item-"+g},o.items=[],o.itemCount=null,o.previousResultCount=0,o.timeoutIds=[],o.internalSetTimeout=function(g,w){var x=setTimeout(function(){o.timeoutIds=o.timeoutIds.filter(function(O){return O!==x}),g()},w);o.timeoutIds.push(x)},o.setItemCount=function(g){o.itemCount=g},o.unsetItemCount=function(){o.itemCount=null},o.isItemDisabled=function(g,w){var x=o.getItemNodeFromIndex(w);return x&&x.hasAttribute("disabled")},o.setHighlightedIndex=function(g,w){g===void 0&&(g=o.props.defaultHighlightedIndex),w===void 0&&(w={}),w=Jo(w),o.internalSetState(Se({highlightedIndex:g},w))},o.clearSelection=function(g){o.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:o.props.defaultHighlightedIndex,isOpen:o.props.defaultIsOpen},g)},o.selectItem=function(g,w,x){w=Jo(w),o.internalSetState(Se({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,selectedItem:g,inputValue:o.props.itemToString(g)},w),x)},o.selectItemAtIndex=function(g,w,x){var O=o.items[g];O!=null&&o.selectItem(O,w,x)},o.selectHighlightedItem=function(g,w){return o.selectItemAtIndex(o.getState().highlightedIndex,g,w)},o.internalSetState=function(g,w){var x,O,E={},D=typeof g=="function";return!D&&g.hasOwnProperty("inputValue")&&o.props.onInputValueChange(g.inputValue,Se({},o.getStateAndHelpers(),g)),o.setState(function(N){var M;N=o.getState(N);var R=D?g(N):g;R=o.props.stateReducer(N,R),x=R.hasOwnProperty("selectedItem");var P={};return x&&R.selectedItem!==N.selectedItem&&(O=R.selectedItem),(M=R).type||(M.type=qh),Object.keys(R).forEach(function(F){N[F]!==R[F]&&(E[F]=R[F]),F!=="type"&&(R[F],vs(o.props,F)||(P[F]=R[F]))}),D&&R.hasOwnProperty("inputValue")&&o.props.onInputValueChange(R.inputValue,Se({},o.getStateAndHelpers(),R)),P},function(){Ld(w)();var N=Object.keys(E).length>1;N&&o.props.onStateChange(E,o.getStateAndHelpers()),x&&o.props.onSelect(g.selectedItem,o.getStateAndHelpers()),O!==void 0&&o.props.onChange(O,o.getStateAndHelpers()),o.props.onUserAction(E,o.getStateAndHelpers())})},o.rootRef=function(g){return o._rootNode=g},o.getRootProps=function(g,w){var x,O=g===void 0?{}:g,E=O.refKey,D=E===void 0?"ref":E,N=O.ref,M=$n(O,oT),R=w===void 0?{}:w,P=R.suppressRefError,F=P===void 0?!1:P;o.getRootProps.called=!0,o.getRootProps.refKey=D,o.getRootProps.suppressRefError=F;var U=o.getState(),B=U.isOpen;return Se((x={},x[D]=ei(N,o.rootRef),x.role="combobox",x["aria-expanded"]=B,x["aria-haspopup"]="listbox",x["aria-owns"]=B?o.menuId:void 0,x["aria-labelledby"]=o.labelId,x),M)},o.keyDownHandlers={ArrowDown:function(w){var x=this;if(w.preventDefault(),this.getState().isOpen){var O=w.shiftKey?5:1;this.moveHighlightedIndex(O,{type:ts})}else this.internalSetState({isOpen:!0,type:ts},function(){var E=x.getItemCount();if(E>0){var D=x.getState(),N=D.highlightedIndex,M=Tr(N,1,{length:E},x.isItemDisabled,!0);x.setHighlightedIndex(M,{type:ts})}})},ArrowUp:function(w){var x=this;if(w.preventDefault(),this.getState().isOpen){var O=w.shiftKey?-5:-1;this.moveHighlightedIndex(O,{type:es})}else this.internalSetState({isOpen:!0,type:es},function(){var E=x.getItemCount();if(E>0){var D=x.getState(),N=D.highlightedIndex,M=Tr(N,-1,{length:E},x.isItemDisabled,!0);x.setHighlightedIndex(M,{type:es})}})},Enter:function(w){if(w.which!==229){var x=this.getState(),O=x.isOpen,E=x.highlightedIndex;if(O&&E!=null){w.preventDefault();var D=this.items[E],N=this.getItemNodeFromIndex(E);if(D==null||N&&N.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Jh})}}},Escape:function(w){w.preventDefault(),this.reset(Se({type:Hh},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},o.buttonKeyDownHandlers=Se({},o.keyDownHandlers,{" ":function(w){w.preventDefault(),this.toggleMenu({type:Zh})}}),o.inputKeyDownHandlers=Se({},o.keyDownHandlers,{Home:function(w){var x=this.getState(),O=x.isOpen;if(O){w.preventDefault();var E=this.getItemCount();if(!(E<=0||!O)){var D=Oi(0,!1,{length:E},this.isItemDisabled);this.setHighlightedIndex(D,{type:Wh})}}},End:function(w){var x=this.getState(),O=x.isOpen;if(O){w.preventDefault();var E=this.getItemCount();if(!(E<=0||!O)){var D=Oi(E-1,!0,{length:E},this.isItemDisabled);this.setHighlightedIndex(D,{type:Qh})}}}}),o.getToggleButtonProps=function(g){var w=g===void 0?{}:g,x=w.onClick;w.onPress;var O=w.onKeyDown,E=w.onKeyUp,D=w.onBlur,N=$n(w,sT),M=o.getState(),R=M.isOpen,P={onClick:ct(x,o.buttonHandleClick),onKeyDown:ct(O,o.buttonHandleKeyDown),onKeyUp:ct(E,o.buttonHandleKeyUp),onBlur:ct(D,o.buttonHandleBlur)},F=N.disabled?{}:P;return Se({type:"button",role:"button","aria-label":R?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},F,N)},o.buttonHandleKeyUp=function(g){g.preventDefault()},o.buttonHandleKeyDown=function(g){var w=pl(g);o.buttonKeyDownHandlers[w]&&o.buttonKeyDownHandlers[w].call(o,g)},o.buttonHandleClick=function(g){if(g.preventDefault(),o.props.environment){var w=o.props.environment.document,x=w.body,O=w.activeElement;x&&x===O&&g.target.focus()}process.env.NODE_ENV==="test"?o.toggleMenu({type:hl}):o.internalSetTimeout(function(){return o.toggleMenu({type:hl})})},o.buttonHandleBlur=function(g){var w=g.target;o.internalSetTimeout(function(){if(!(o.isMouseDown||!o.props.environment)){var x=o.props.environment.document.activeElement;(x==null||x.id!==o.inputId)&&x!==w&&o.reset({type:em})}})},o.getLabelProps=function(g){return Se({htmlFor:o.inputId,id:o.labelId},g)},o.getInputProps=function(g){var w=g===void 0?{}:g,x=w.onKeyDown,O=w.onBlur,E=w.onChange,D=w.onInput;w.onChangeText;var N=$n(w,aT),M,R={};M="onChange";var P=o.getState(),F=P.inputValue,U=P.isOpen,B=P.highlightedIndex;if(!N.disabled){var X;R=(X={},X[M]=ct(E,D,o.inputHandleChange),X.onKeyDown=ct(x,o.inputHandleKeyDown),X.onBlur=ct(O,o.inputHandleBlur),X)}return Se({"aria-autocomplete":"list","aria-activedescendant":U&&typeof B=="number"&&B>=0?o.getItemId(B):void 0,"aria-controls":U?o.menuId:void 0,"aria-labelledby":N&&N["aria-label"]?void 0:o.labelId,autoComplete:"off",value:F,id:o.inputId},R,N)},o.inputHandleKeyDown=function(g){var w=pl(g);w&&o.inputKeyDownHandlers[w]&&o.inputKeyDownHandlers[w].call(o,g)},o.inputHandleChange=function(g){o.internalSetState({type:Yh,isOpen:!0,inputValue:g.target.value,highlightedIndex:o.props.defaultHighlightedIndex})},o.inputHandleBlur=function(){o.internalSetTimeout(function(){var g;if(!(o.isMouseDown||!o.props.environment)){var w=o.props.environment.document.activeElement,x=(w==null||(g=w.dataset)==null?void 0:g.toggle)&&o._rootNode&&o._rootNode.contains(w);x||o.reset({type:Xh})}})},o.menuRef=function(g){o._menuNode=g},o.getMenuProps=function(g,w){var x,O=g===void 0?{}:g,E=O.refKey,D=E===void 0?"ref":E,N=O.ref,M=$n(O,lT),R=w===void 0?{}:w,P=R.suppressRefError,F=P===void 0?!1:P;return o.getMenuProps.called=!0,o.getMenuProps.refKey=D,o.getMenuProps.suppressRefError=F,Se((x={},x[D]=ei(N,o.menuRef),x.role="listbox",x["aria-labelledby"]=M&&M["aria-label"]?void 0:o.labelId,x.id=o.menuId,x),M)},o.getItemProps=function(g){var w,x=g===void 0?{}:g,O=x.onMouseMove,E=x.onMouseDown,D=x.onClick;x.onPress;var N=x.index,M=x.item,R=M===void 0?process.env.NODE_ENV==="production"?void 0:Z_("getItemProps","item"):M,P=$n(x,uT);N===void 0?(o.items.push(R),N=o.items.indexOf(R)):o.items[N]=R;var F="onClick",U=D,B=(w={onMouseMove:ct(O,function(){N!==o.getState().highlightedIndex&&(o.setHighlightedIndex(N,{type:Kh}),o.avoidScrolling=!0,o.internalSetTimeout(function(){return o.avoidScrolling=!1},250))}),onMouseDown:ct(E,function(se){se.preventDefault()})},w[F]=ct(U,function(){o.selectItemAtIndex(N,{type:Gh})}),w),X=P.disabled?{onMouseDown:B.onMouseDown}:B;return Se({id:o.getItemId(N),role:"option","aria-selected":o.getState().highlightedIndex===N},X,P)},o.clearItems=function(){o.items=[]},o.reset=function(g,w){g===void 0&&(g={}),g=Jo(g),o.internalSetState(function(x){var O=x.selectedItem;return Se({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,inputValue:o.props.itemToString(O)},g)},w)},o.toggleMenu=function(g,w){g===void 0&&(g={}),g=Jo(g),o.internalSetState(function(x){var O=x.isOpen;return Se({isOpen:!O},O&&{highlightedIndex:o.props.defaultHighlightedIndex},g)},function(){var x=o.getState(),O=x.isOpen,E=x.highlightedIndex;O&&o.getItemCount()>0&&typeof E=="number"&&o.setHighlightedIndex(E,g),Ld(w)()})},o.openMenu=function(g){o.internalSetState({isOpen:!0},g)},o.closeMenu=function(g){o.internalSetState({isOpen:!1},g)},o.updateStatus=au(function(){var g;if((g=o.props)!=null&&(g=g.environment)!=null&&g.document){var w=o.getState(),x=o.items[w.highlightedIndex],O=o.getItemCount(),E=o.props.getA11yStatusMessage(Se({itemToString:o.props.itemToString,previousResultCount:o.previousResultCount,resultCount:O,highlightedItem:x},w));o.previousResultCount=O,$h(E,o.props.environment.document)}},200);var s=o.props,a=s.defaultHighlightedIndex,l=s.initialHighlightedIndex,c=l===void 0?a:l,u=s.defaultIsOpen,d=s.initialIsOpen,h=d===void 0?u:d,f=s.initialInputValue,y=f===void 0?"":f,m=s.initialSelectedItem,v=m===void 0?null:m,b=o.getState({highlightedIndex:c,isOpen:h,inputValue:y,selectedItem:v});return b.selectedItem!=null&&o.props.initialInputValue===void 0&&(b.inputValue=o.props.itemToString(b.selectedItem)),o.state=b,o}L_(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),ys(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(),l=this.getState(),c=l.highlightedIndex;if(a>0){var u=Tr(c,o,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(u,s)}},r.getStateAndHelpers=function(){var o=this.getState(),s=o.highlightedIndex,a=o.inputValue,l=o.selectedItem,c=o.isOpen,u=this.props.itemToString,d=this.id,h=this.getRootProps,f=this.getToggleButtonProps,y=this.getLabelProps,m=this.getMenuProps,v=this.getInputProps,b=this.getItemProps,g=this.openMenu,w=this.closeMenu,x=this.toggleMenu,O=this.selectItem,E=this.selectItemAtIndex,D=this.selectHighlightedItem,N=this.setHighlightedIndex,M=this.clearSelection,R=this.clearItems,P=this.reset,F=this.setItemCount,U=this.unsetItemCount,B=this.internalSetState;return{getRootProps:h,getToggleButtonProps:f,getLabelProps:y,getMenuProps:m,getInputProps:v,getItemProps:b,reset:P,openMenu:g,closeMenu:w,toggleMenu:x,selectItem:O,selectItemAtIndex:E,selectHighlightedItem:D,setHighlightedIndex:N,clearSelection:M,clearItems:R,setItemCount:F,unsetItemCount:U,setState:B,itemToString:u,id:d,highlightedIndex:s,inputValue:a,isOpen:c,selectedItem:l}},r.componentDidMount=function(){var o=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&Vd(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){o.internalClearTimeouts()};else{var s=function(){o.isMouseDown=!0},a=function(f){o.isMouseDown=!1;var y=ws(f.target,[o._rootNode,o._menuNode],o.props.environment);!y&&o.getState().isOpen&&o.reset({type:zh},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},l=function(){o.isTouchMove=!1},c=function(){o.isTouchMove=!0},u=function(f){var y=ws(f.target,[o._rootNode,o._menuNode],o.props.environment,!1);!o.isTouchMove&&!y&&o.getState().isOpen&&o.reset({type:nm},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},d=this.props.environment;d.addEventListener("mousedown",s),d.addEventListener("mouseup",a),d.addEventListener("touchstart",l),d.addEventListener("touchmove",c),d.addEventListener("touchend",u),this.cleanup=function(){o.internalClearTimeouts(),o.updateStatus.cancel(),d.removeEventListener("mousedown",s),d.removeEventListener("mouseup",a),d.removeEventListener("touchstart",l),d.removeEventListener("touchmove",c),d.removeEventListener("touchend",u)}}},r.shouldScroll=function(o,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,l=a.highlightedIndex,c=s.highlightedIndex===void 0?o:s,u=c.highlightedIndex,d=l&&this.getState().isOpen&&!o.isOpen,h=l!==u;return d||h},r.componentDidUpdate=function(o,s){process.env.NODE_ENV!=="production"&&(lu(this.state,o,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&Vd(this._menuNode,this.getMenuProps)),vs(this.props,"selectedItem")&&this.props.selectedItemChanged(o.selectedItem,this.props.selectedItem)&&this.internalSetState({type:tm,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=Bd(this.props.children,Ht);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=Bd(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&&dT(s,this.getRootProps),s;if(Bh(s))return C.cloneElement(s,this.getRootProps(Vh(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}(C.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:Y_,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&tT(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:Ht,onInputValueChange:Ht,onUserAction:Ht,onChange:Ht,onSelect:Ht,onOuterClick:Ht,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:Lh},e.stateChangeTypes=iT,e}();process.env.NODE_ENV!=="production"&&(cT.propTypes={children:G.func,defaultHighlightedIndex:G.number,defaultIsOpen:G.bool,initialHighlightedIndex:G.number,initialSelectedItem:G.any,initialInputValue:G.string,initialIsOpen:G.bool,getA11yStatusMessage:G.func,itemToString:G.func,onChange:G.func,onSelect:G.func,onStateChange:G.func,onInputValueChange:G.func,onUserAction:G.func,onOuterClick:G.func,selectedItemChanged:G.func,stateReducer:G.func,itemCount:G.number,id:G.string,environment:G.shape({addEventListener:G.func.isRequired,removeEventListener:G.func.isRequired,document:G.shape({createElement:G.func.isRequired,getElementById:G.func.isRequired,activeElement:G.any.isRequired,body:G.any.isRequired}).isRequired,Node:G.func.isRequired}),suppressRefError:G.bool,scrollIntoView:G.func,selectedItem:G.any,isOpen:G.bool,inputValue:G.string,highlightedIndex:G.number,labelId:G.string,inputId:G.string,menuId:G.string,getItemId:G.func});function Vd(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 dT(e,t){var n=t.refKey,r=n!=="ref",i=!Bh(e);i&&!r&&!Fd.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+'"'),!Fd.isForwardRef(e)&&!Vh(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var rm={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function fT(e,t,n){var r=e.props,i=e.type,o={};Object.keys(t).forEach(function(s){pT(s,e,t,n),n[s]!==t[s]&&(o[s]=n[s])}),r.onStateChange&&Object.keys(o).length&&r.onStateChange(Se({type:i},o))}function pT(e,t,n,r){var i=t.props,o=t.type,s="on"+uu(e)+"Change";i[s]&&r[e]!==void 0&&r[e]!==n[e]&&i[s](Se({type:o},r))}function hT(e,t){return t.changes}var Ud=au(function(e,t){$h(e,t)},200),mT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?C.useLayoutEffect:C.useEffect,gT="useId"in C?function(t){var n=t.id,r=t.labelId,i=t.menuId,o=t.getItemId,s=t.toggleButtonId,a=t.inputId,l="downshift-"+C.useId();n||(n=l);var c=C.useRef({labelId:r||n+"-label",menuId:i||n+"-menu",getItemId:o||function(u){return n+"-item-"+u},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"});return c.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+jh():n,i=t.labelId,o=t.menuId,s=t.getItemId,a=t.toggleButtonId,l=t.inputId,c=C.useRef({labelId:i||r+"-label",menuId:o||r+"-menu",getItemId:s||function(u){return r+"-item-"+u},toggleButtonId:a||r+"-toggle-button",inputId:l||r+"-input"});return c.current};function yT(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 uu(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function im(e){var t=C.useRef(e);return t.current=e,t}function vT(e,t,n,r){var i=C.useRef(),o=C.useRef(),s=C.useCallback(function(f,y){o.current=y,f=ys(f,y.props);var m=e(f,y),v=y.props.stateReducer(f,Se({},y,{changes:m}));return v},[e]),a=C.useReducer(s,t,n),l=a[0],c=a[1],u=im(t),d=C.useCallback(function(f){return c(Se({props:u.current},f))},[u]),h=o.current;return C.useEffect(function(){var f=ys(i.current,h==null?void 0:h.props),y=h&&i.current&&!r(f,l);y&&fT(h,f,l),i.current=l},[l,h,r]),[l,d]}var Yi={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:hT,scrollIntoView:Lh,environment:typeof window>"u"?void 0:window};function fr(e,t,n){n===void 0&&(n=rm);var r=e["default"+uu(t)];return r!==void 0?r:n[t]}function Zi(e,t,n){n===void 0&&(n=rm);var r=e[t];if(r!==void 0)return r;var i=e["initial"+uu(t)];return i!==void 0?i:fr(e,t,n)}function wT(e){var t=Zi(e,"selectedItem"),n=Zi(e,"isOpen"),r=ST(e),i=Zi(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 eo(e,t,n){var r=e.items,i=e.initialHighlightedIndex,o=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,l=t.selectedItem,c=t.highlightedIndex;return r.length===0?-1:i!==void 0&&c===i&&!s(r[i],i)?i:o!==void 0&&!s(r[o],o)?o:l?r.findIndex(function(u){return a(l)===a(u)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function bT(e,t,n){var r=C.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return C.useEffect(function(){if(!e)return Ht;var i=n.map(function(u){return u.current});function o(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(u){r.current.isMouseDown=!1,ws(u.target,i,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function l(){r.current.isTouchMove=!0}function c(u){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!ws(u.target,i,e,!1)&&t()}return e.addEventListener("mousedown",o),e.addEventListener("mouseup",s),e.addEventListener("touchstart",a),e.addEventListener("touchmove",l),e.addEventListener("touchend",c),function(){e.removeEventListener("mousedown",o),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",l),e.removeEventListener("touchend",c)}},[n,e,t]),r.current}var om=function(){return Ht};process.env.NODE_ENV!=="production"&&(om=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=C.useRef(n.reduce(function(s,a){return s[a]={},s},{}));C.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 l=a.suppressRefError,c=a.refKey,u=a.elementRef;l||u!=null&&u.current||console.error('downshift: The ref prop "'+c+'" from '+s+" was not applied correctly on your element.")})},[]);var o=C.useCallback(function(s,a,l,c){i.current[s]={suppressRefError:a,refKey:l,elementRef:c}},[]);return o});function xT(e,t,n,r){r===void 0&&(r={});var i=r.document,o=js();C.useEffect(function(){if(!(!e||o||!i)){var s=e(t);Ud(s,i)}},n),C.useEffect(function(){return function(){Ud.cancel(),rT(i)}},[i])}function IT(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,i=e.getItemNodeFromIndex,o=e.menuElement,s=e.scrollIntoView,a=C.useRef(!0);return mT(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(i(t),o))},[t]),a}var sm=Ht;process.env.NODE_ENV!=="production"&&(sm=function(t){var n=t.props,r=t.state,i=C.useRef(n),o=js();C.useEffect(function(){o||(lu(r,i.current,n),i.current=n)},[r,n,o])});function $d(e,t,n){var r;n===void 0&&(n=!0);var i=((r=e.items)==null?void 0:r.length)&&t>=0;return Se({isOpen:!1,highlightedIndex:-1},i&&Se({selectedItem:e.items[t],isOpen:fr(e,"isOpen"),highlightedIndex:fr(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function CT(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function js(){var e=C.useRef(!0);return C.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function ml(e){var t=fr(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function ST(e){var t=Zi(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var ns={environment:G.shape({addEventListener:G.func.isRequired,removeEventListener:G.func.isRequired,document:G.shape({createElement:G.func.isRequired,getElementById:G.func.isRequired,activeElement:G.any.isRequired,body:G.any.isRequired}).isRequired,Node:G.func.isRequired}),itemToString:G.func,itemToKey:G.func,stateReducer:G.func},am=Se({},ns,{getA11yStatusMessage:G.func,highlightedIndex:G.number,defaultHighlightedIndex:G.number,initialHighlightedIndex:G.number,isOpen:G.bool,defaultIsOpen:G.bool,initialIsOpen:G.bool,selectedItem:G.any,initialSelectedItem:G.any,defaultSelectedItem:G.any,id:G.string,labelId:G.string,menuId:G.string,getItemId:G.func,toggleButtonId:G.string,onSelectedItemChange:G.func,onHighlightedIndexChange:G.func,onStateChange:G.func,onIsOpenChange:G.func,scrollIntoView:G.func});function OT(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:eo(i,e,0)};break;case n.FunctionOpenMenu:o={isOpen:!0,highlightedIndex:eo(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:ml(i),isOpen:fr(i,"isOpen"),selectedItem:fr(i,"selectedItem"),inputValue:fr(i,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return Se({},e,o)}Si(Si({},am),{items:G.array.isRequired,isItemDisabled:G.func});Si(Si({},Yi),{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 cu=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,du=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,fu=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,pu=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,hu=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,mu=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,gu=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,yu=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,vu=process.env.NODE_ENV!=="production"?"__input_change__":8,bs=process.env.NODE_ENV!=="production"?"__input_blur__":9,wu=process.env.NODE_ENV!=="production"?"__input_click__":10,lm=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,um=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,bu=process.env.NODE_ENV!=="production"?"__item_click__":13,cm=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,dm=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,fm=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,pm=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,hm=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,xu=process.env.NODE_ENV!=="production"?"__function_select_item__":19,mm=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,gm=process.env.NODE_ENV!=="production"?"__function_reset__":21,Iu=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,ym=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:Iu,FunctionCloseMenu:pm,FunctionOpenMenu:fm,FunctionReset:gm,FunctionSelectItem:xu,FunctionSetHighlightedIndex:hm,FunctionSetInputValue:mm,FunctionToggleMenu:dm,InputBlur:bs,InputChange:vu,InputClick:wu,InputKeyDownArrowDown:cu,InputKeyDownArrowUp:du,InputKeyDownEnd:hu,InputKeyDownEnter:yu,InputKeyDownEscape:fu,InputKeyDownHome:pu,InputKeyDownPageDown:gu,InputKeyDownPageUp:mu,ItemClick:bu,ItemMouseMove:um,MenuMouseLeave:lm,ToggleButtonClick:cm});function ET(e){var t=wT(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)),Se({},t,{inputValue:r})}var _T=Se({},am,{items:G.array.isRequired,isItemDisabled:G.func,inputValue:G.string,defaultInputValue:G.string,initialInputValue:G.string,inputId:G.string,onInputValueChange:G.func});function TT(e,t,n,r){var i=C.useRef(),o=vT(e,t,n,r),s=o[0],a=o[1],l=js();return C.useEffect(function(){if(vs(t,"selectedItem")){if(!l){var c=t.itemToKey(t.selectedItem)!==t.itemToKey(i.current);c&&a({type:Iu,inputValue:t.itemToString(t.selectedItem)})}i.current=s.selectedItem===i.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[ys(s,t),a]}var vm=Ht;process.env.NODE_ENV!=="production"&&(vm=function(t,n){G.checkPropTypes(_T,t,"prop",n.name)});var NT=Se({},Yi,{isItemDisabled:function(){return!1}});function kT(e,t){var n,r=t.type,i=t.props,o=t.altKey,s;switch(r){case bu:s={isOpen:fr(i,"isOpen"),highlightedIndex:ml(i),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case cu:e.isOpen?s={highlightedIndex:Tr(e.highlightedIndex,1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:o&&e.selectedItem==null?-1:eo(i,e,1),isOpen:i.items.length>=0};break;case du:e.isOpen?o?s=$d(i,e.highlightedIndex):s={highlightedIndex:Tr(e.highlightedIndex,-1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:eo(i,e,-1),isOpen:i.items.length>=0};break;case yu:s=$d(i,e.highlightedIndex);break;case fu:s=Se({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case mu:s={highlightedIndex:Tr(e.highlightedIndex,-10,i.items,i.isItemDisabled,!0)};break;case gu:s={highlightedIndex:Tr(e.highlightedIndex,10,i.items,i.isItemDisabled,!0)};break;case pu:s={highlightedIndex:Oi(0,!1,i.items,i.isItemDisabled)};break;case hu:s={highlightedIndex:Oi(i.items.length-1,!0,i.items,i.isItemDisabled)};break;case bs:s=Se({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 vu:s={isOpen:!0,highlightedIndex:ml(i),inputValue:t.inputValue};break;case wu:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:eo(i,e,0)};break;case xu:s={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case Iu:s={inputValue:t.inputValue};break;default:return OT(e,t,ym)}return Se({},e,s)}var AT=["onMouseLeave","refKey","ref"],RT=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],PT=["onClick","onPress","refKey","ref"],FT=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];Cu.stateChangeTypes=ym;function Cu(e){e===void 0&&(e={}),vm(e,Cu);var t=Se({},NT,e),n=t.items,r=t.scrollIntoView,i=t.environment,o=t.getA11yStatusMessage,s=TT(kT,t,ET,CT),a=s[0],l=s[1],c=a.isOpen,u=a.highlightedIndex,d=a.selectedItem,h=a.inputValue,f=C.useRef(null),y=C.useRef({}),m=C.useRef(null),v=C.useRef(null),b=js(),g=gT(t),w=C.useRef(),x=im({state:a,props:t}),O=C.useCallback(function(V){return y.current[g.getItemId(V)]},[g]);xT(o,a,[c,u,d,h],i);var E=IT({menuElement:f.current,highlightedIndex:u,isOpen:c,itemRefs:y,scrollIntoView:r,getItemNodeFromIndex:O});sm({props:t,state:a}),C.useEffect(function(){var V=Zi(t,"isOpen");V&&m.current&&m.current.focus()},[]),C.useEffect(function(){b||(w.current=n.length)});var D=bT(i,C.useCallback(function(){x.current.state.isOpen&&l({type:bs,selectItem:!1})},[l,x]),C.useMemo(function(){return[f,v,m]},[f.current,v.current,m.current])),N=om("getInputProps","getMenuProps");C.useEffect(function(){c||(y.current={})},[c]),C.useEffect(function(){var V;!c||!(i!=null&&i.document)||!(m!=null&&(V=m.current)!=null&&V.focus)||i.document.activeElement!==m.current&&m.current.focus()},[c,i]);var M=C.useMemo(function(){return{ArrowDown:function(S){S.preventDefault(),l({type:cu,altKey:S.altKey})},ArrowUp:function(S){S.preventDefault(),l({type:du,altKey:S.altKey})},Home:function(S){x.current.state.isOpen&&(S.preventDefault(),l({type:pu}))},End:function(S){x.current.state.isOpen&&(S.preventDefault(),l({type:hu}))},Escape:function(S){var z=x.current.state;(z.isOpen||z.inputValue||z.selectedItem||z.highlightedIndex>-1)&&(S.preventDefault(),l({type:fu}))},Enter:function(S){var z=x.current.state;!z.isOpen||S.which===229||(S.preventDefault(),l({type:yu}))},PageUp:function(S){x.current.state.isOpen&&(S.preventDefault(),l({type:mu}))},PageDown:function(S){x.current.state.isOpen&&(S.preventDefault(),l({type:gu}))}}},[l,x]),R=C.useCallback(function(V){return Se({id:g.labelId,htmlFor:g.inputId},V)},[g]),P=C.useCallback(function(V,S){var z,$=V===void 0?{}:V,Y=$.onMouseLeave,ne=$.refKey,te=ne===void 0?"ref":ne,ae=$.ref,Z=$n($,AT),ye=S===void 0?{}:S,q=ye.suppressRefError,be=q===void 0?!1:q;return N("getMenuProps",be,te,f),Se((z={},z[te]=ei(ae,function(ee){f.current=ee}),z.id=g.menuId,z.role="listbox",z["aria-labelledby"]=Z&&Z["aria-label"]?void 0:""+g.labelId,z.onMouseLeave=ct(Y,function(){l({type:lm})}),z),Z)},[l,N,g]),F=C.useCallback(function(V){var S,z,$=V===void 0?{}:V,Y=$.item,ne=$.index,te=$.refKey,ae=te===void 0?"ref":te,Z=$.ref,ye=$.onMouseMove,q=$.onMouseDown,be=$.onClick;$.onPress;var ee=$.disabled,Ke=$n($,RT);ee!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Be=x.current,je=Be.props,et=Be.state,at=yT(Y,ne,je.items,"Pass either item or index to getItemProps!"),lt=at[0],Oe=at[1],ft=je.isItemDisabled(lt,Oe),_t="onClick",mt=be,nt=function(){D.isTouchEnd||Oe===et.highlightedIndex||(E.current=!1,l({type:um,index:Oe,disabled:ft}))},j=function(){l({type:bu,index:Oe})},H=function(oe){return oe.preventDefault()};return Se((S={},S[ae]=ei(Z,function(L){L&&(y.current[g.getItemId(Oe)]=L)}),S["aria-disabled"]=ft,S["aria-selected"]=Oe===et.highlightedIndex,S.id=g.getItemId(Oe),S.role="option",S),!ft&&(z={},z[_t]=ct(mt,j),z),{onMouseMove:ct(ye,nt),onMouseDown:ct(q,H)},Ke)},[l,g,x,D,E]),U=C.useCallback(function(V){var S,z=V===void 0?{}:V,$=z.onClick;z.onPress;var Y=z.refKey,ne=Y===void 0?"ref":Y,te=z.ref,ae=$n(z,PT),Z=x.current.state,ye=function(){l({type:cm})};return Se((S={},S[ne]=ei(te,function(q){v.current=q}),S["aria-controls"]=g.menuId,S["aria-expanded"]=Z.isOpen,S.id=g.toggleButtonId,S.tabIndex=-1,S),!ae.disabled&&Se({},{onClick:ct($,ye)}),ae)},[l,x,g]),B=C.useCallback(function(V,S){var z,$=V===void 0?{}:V,Y=$.onKeyDown,ne=$.onChange,te=$.onInput,ae=$.onBlur;$.onChangeText;var Z=$.onClick,ye=$.refKey,q=ye===void 0?"ref":ye,be=$.ref,ee=$n($,FT),Ke=S===void 0?{}:S,Be=Ke.suppressRefError,je=Be===void 0?!1:Be;N("getInputProps",je,q,m);var et=x.current.state,at=function(H){var L=pl(H);L&&M[L]&&M[L](H)},lt=function(H){l({type:vu,inputValue:H.target.value})},Oe=function(H){if(i!=null&&i.document&&et.isOpen&&!D.isMouseDown){var L=H.relatedTarget===null&&i.document.activeElement!==i.document.body;l({type:bs,selectItem:!L})}},ft=function(){l({type:wu})},_t="onChange",mt={};if(!ee.disabled){var nt;mt=(nt={},nt[_t]=ct(ne,te,lt),nt.onKeyDown=ct(Y,at),nt.onBlur=ct(ae,Oe),nt.onClick=ct(Z,ft),nt)}return Se((z={},z[q]=ei(be,function(j){m.current=j}),z["aria-activedescendant"]=et.isOpen&&et.highlightedIndex>-1?g.getItemId(et.highlightedIndex):"",z["aria-autocomplete"]="list",z["aria-controls"]=g.menuId,z["aria-expanded"]=et.isOpen,z["aria-labelledby"]=ee&&ee["aria-label"]?void 0:g.labelId,z.autoComplete="off",z.id=g.inputId,z.role="combobox",z.value=et.inputValue,z),mt,ee)},[l,g,i,M,x,D,N]),X=C.useCallback(function(){l({type:dm})},[l]),se=C.useCallback(function(){l({type:pm})},[l]),ce=C.useCallback(function(){l({type:fm})},[l]),ge=C.useCallback(function(V){l({type:hm,highlightedIndex:V})},[l]),we=C.useCallback(function(V){l({type:xu,selectedItem:V})},[l]),I=C.useCallback(function(V){l({type:mm,inputValue:V})},[l]),J=C.useCallback(function(){l({type:gm})},[l]);return{getItemProps:F,getLabelProps:R,getMenuProps:P,getInputProps:B,getToggleButtonProps:U,toggleMenu:X,openMenu:ce,closeMenu:se,setHighlightedIndex:ge,setInputValue:I,selectItem:we,reset:J,highlightedIndex:u,isOpen:c,selectedItem:d,inputValue:h}}ns.stateReducer,ns.itemToKey,ns.environment,G.array,G.array,G.array,G.func,G.number,G.number,G.number,G.func,G.func,G.string,G.string;Yi.itemToKey,Yi.stateReducer,Yi.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 DT="_comboboxContainer_1lcc8_1",MT="_inputContainer_1lcc8_12",LT="_input_1lcc8_12",jT="_toggleButton_1lcc8_33",BT="_menu_1lcc8_39",VT="_menuBottom_1lcc8_55",UT="_menuTop_1lcc8_61",$T="_menuItem_1lcc8_66",qT="_highlighted_1lcc8_73",zT="_selected_1lcc8_77",KT="_hidden_1lcc8_81",dn={comboboxContainer:DT,inputContainer:MT,input:LT,toggleButton:jT,menu:BT,menuBottom:VT,menuTop:UT,menuItem:$T,highlighted:qT,selected:zT,hidden:KT};function HT(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function wm({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:i,style:o,menuPosition:s="bottom"}){const[a,l]=C.useState(e),c=C.useRef(null);C.useEffect(()=>l(e),[e]);const u=C.useCallback(E=>{(E==null?void 0:E.length)>0?l(e.filter(HT(E))):l(e)},[e]),{isOpen:d,getToggleButtonProps:h,getMenuProps:f,getInputProps:y,highlightedIndex:m,getItemProps:v,setInputValue:b}=Cu({items:a,selectedItem:t?e.find(E=>E.value===t):null,itemToString:E=>(E==null?void 0:E.label)||"",onInputValueChange:({inputValue:E})=>u(E),onSelectedItemChange:({selectedItem:E})=>{var D;n(E),(D=c.current)==null||D.blur()}}),g=()=>{b(""),l(e)},w=()=>g(),x=C.useMemo(()=>{var E;return(E=e.find(D=>D.value===t))==null?void 0:E.label},[e,t]),O=()=>{b(t&&x?x:"")};return p.jsxs("div",{style:{position:"relative",...o},children:[p.jsx("div",{className:dn.comboboxContainer,children:p.jsxs("div",{className:dn.inputContainer,children:[p.jsx("input",{style:{border:"none"},disabled:i,placeholder:r,className:dn.input,...y({onFocus:w,onBlur:O,ref:c})}),p.jsx("button",{style:{border:"none"},disabled:i,"aria-label":"toggle menu",className:dn.toggleButton,type:"button",...h(),children:d?p.jsx(p.Fragment,{children:"↑"}):p.jsx(p.Fragment,{children:"↓"})})]})}),p.jsx("ul",{className:`${dn.menu} ${d&&e.length?"":dn.hidden} ${s==="top"?dn.menuTop:dn.menuBottom}`,...f(),children:d&&a.map((E,D)=>p.jsx("li",{className:`${dn.menuItem} ${m===D?dn.highlighted:""} ${t===(E==null?void 0:E.value)?dn.selected:""}`,...v({item:E,index:D}),children:p.jsx("span",{children:E.label})},E.id))})]})}function JT(e,t){var r;const n=((r=e==null?void 0:e.read)==null?void 0:r.selectedFieldMappings)||{};t.forEach(i=>{var a,l;const{field:o,value:s}=i;if(s===null){const c=n[o];delete n[o],c&&((a=e==null?void 0:e.read)!=null&&a.selectedValueMappings)&&e.read.selectedValueMappings[c]&&delete e.read.selectedValueMappings[c]}else{const c=n[o];n[o]=s,c&&c!==s&&((l=e==null?void 0:e.read)!=null&&l.selectedValueMappings)&&e.read.selectedValueMappings[c]&&delete e.read.selectedValueMappings[c]}})}function ao(e,t,n){t(e,r=>JT(r,n))}const WT="Each field must be mapped to a unique value";function Su({field:e,onSelectChange:t,allFields:n}){var g;const{configureState:r,selectedObjectName:i,setConfigureState:o}=vn(),[s,a]=C.useState(!0),{isError:l,removeError:c,getError:u}=An(),d=(g=r==null?void 0:r.read)==null?void 0:g.selectedFieldMappings,h=d==null?void 0:d[e.mapToName];C.useEffect(()=>{e._default&&!h&&i&&r&&ao(i,o,[{field:e.mapToName,value:e._default}]),a(!1)},[e,o,i,h,r]);const f=C.useMemo(()=>n.map(w=>({id:w.fieldName,label:w.displayName,value:w.fieldName})),[n]),y=p.jsx(wm,{disabled:s,items:f,selectedValue:h||null,onSelectedItemChange:w=>{t({target:{name:e.mapToName,value:w==null?void 0:w.value}})},placeholder:"Please select one",style:{width:"100%"}}),m=C.useCallback(()=>{i&&(ao(i,o,[{field:e.mapToName,value:null}]),l(Ee.MAPPING,i)&&c(Ee.MAPPING,i))},[e.mapToName,i,o,l,c]),{hasDuplicationError:v,errorMessage:b}=C.useMemo(()=>{const w=u(Ee.MAPPING,i),x=Array.isArray(w)&&w.length>0&&w.includes(e.mapToName);return{hasDuplicationError:x,errorMessage:x?WT:""}},[i,u,e.mapToName]);return p.jsxs(p.Fragment,{children:[p.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[p.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[p.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName??e.mapToName}),p.jsx("span",{children:(e==null?void 0:e.prompt)&&p.jsx(Sh,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),p.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[y,p.jsx(ot,{type:"button",variant:"ghost",onClick:m,children:"Clear"})]})]},e.mapToName),v&&p.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",b," "]},e.mapToName)]})}const QT="_formControl_9qd8d_1",GT="_formLabel_9qd8d_5",XT="_formLabelRequired_9qd8d_11",YT="_formInput_9qd8d_16",ZT="_formInputInvalid_9qd8d_20",eN="_formError_9qd8d_24",tN="_disabled_9qd8d_30",Sr={formControl:QT,formLabel:GT,formLabelRequired:XT,formInput:YT,formInputInvalid:ZT,formError:eN,disabled:tN};function Bs({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:i=!1,errorMessage:o,children:s}){return p.jsxs("div",{className:an(Sr.formControl,{[Sr.disabled]:r}),children:[t&&p.jsx("label",{htmlFor:e,className:an(Sr.formLabel,{[Sr.formLabelRequired]:n}),children:t}),p.jsx("div",{id:e,className:an(Sr.formInput,{[Sr.formInputInvalid]:i}),children:s}),i&&o&&p.jsx("div",{className:Sr.formError,role:"alert",children:o})]})}function bm({selectedFieldMappings:e,selectedObjectName:t,fieldName:n,fieldValue:r,setError:i}){if(!e||!t)return!1;if(Object.values(e).some(s=>s===r&&s!==n)){console.error("Each field must be mapped to a unique value",e);const s=Object.keys(e).filter(l=>e[l]===r),a=[n,...s];return i(Ee.MAPPING,t,a),!0}return!1}function nN({dynamicFieldMappings:e,onSelectChange:t,allFields:n}){return e.length?p.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:e.map(r=>p.jsx(Bs,{id:r.mapToName,children:p.jsx(Su,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function rN(){var y,m;const{selectedObjectName:e,configureState:t,setConfigureState:n}=vn(),{isError:r,removeError:i,setError:o}=An(),s=((y=t==null?void 0:t.read)==null?void 0:y.allFields)||[],{fieldMapping:a}=St(),l=(m=t==null?void 0:t.read)==null?void 0:m.selectedFieldMappings,c=v=>{const{value:b,name:g}=v.target;!b||bm({selectedFieldMappings:l,selectedObjectName:e,fieldName:g,fieldValue:b,setError:o})||(e&&ao(e,n,[{field:g,value:b}]),r(Ee.MAPPING,g)&&i(Ee.MAPPING,g),e&&r(Ee.MAPPING,e)&&i(Ee.MAPPING,e))},u=C.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(v=>!v.fieldName),[a,e]),d=C.useMemo(()=>{var g;return(((g=t==null?void 0:t.read)==null?void 0:g.optionalMapFields)||[]).filter(w=>!u.some(x=>x.mapToName===w.mapToName))},[t,u]),h=u.length>0;return d.length>0||h?p.jsxs(p.Fragment,{children:[p.jsx(Gt,{string:"Map the following optional fields"}),p.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[d==null?void 0:d.map(v=>p.jsx(Bs,{id:v.mapToName,children:p.jsx(Su,{allFields:s,field:v,onSelectChange:c})},v.mapToName)),h&&p.jsx(nN,{dynamicFieldMappings:u,onSelectChange:c,allFields:s})]})]}):null}function iN(){var c;const{selectedObjectName:e,configureState:t,setConfigureState:n}=vn(),{isError:r,removeError:i,setError:o}=An(),s=(c=t==null?void 0:t.read)==null?void 0:c.selectedFieldMappings,a=u=>{const{value:d,name:h}=u.target;!d||bm({selectedFieldMappings:s,selectedObjectName:e,fieldName:h,fieldValue:d,setError:o})||(e&&ao(e,n,[{field:h,value:d}]),r(Ee.MAPPING,h)&&i(Ee.MAPPING,h),e&&r(Ee.MAPPING,e)&&i(Ee.MAPPING,e))},l=C.useMemo(()=>{var u;return((u=t==null?void 0:t.read)==null?void 0:u.requiredMapFields)||[]},[t]);return l!=null&&l.length?p.jsxs(p.Fragment,{children:[p.jsx(Gt,{string:"Map the following fields"}),p.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:l.map(u=>{var d;return p.jsx(Bs,{id:u.mapToName,isInvalid:r(Ee.MAPPING,u.mapToName),errorMessage:"* required",children:p.jsx(Su,{allFields:((d=t==null?void 0:t.read)==null?void 0:d.allFields)||[],field:u,onSelectChange:a})},u.mapToName)})})]}):null}const oN=(e,t)=>e.filter(n=>!t.has(n));function sN(){var h,f,y;const{selectedObjectName:e,configureState:t,setConfigureState:n}=vn(),{fieldMapping:r}=St(),i=((h=t==null?void 0:t.read)==null?void 0:h.selectedFieldMappings)||{},o=Object.keys(i),s=((f=t==null?void 0:t.read)==null?void 0:f.requiredMapFields)||[],a=((y=t==null?void 0:t.read)==null?void 0:y.optionalMapFields)||[],l=e&&r?Object.values(r[e]||{}).flat().filter(m=>!m.fieldName):[],c=s.concat(l,a).map(m=>m.mapToName),u=new Set(c),d=oN(o,u);C.useEffect(()=>{e&&d.length&&ao(e,n,d.map(m=>({field:m,value:null})))},[e,n,d])}const aN={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function lN({children:e,style:t}){return p.jsx(Kn,{style:{...aN,...t},children:e})}function uN(){var c,u,d;const{data:e}=gr(),{hydratedRevision:t}=Mi(),{selectedObjectName:n}=vn(),{providerName:r}=Ot(),i=e==null?void 0:e.appName,o=(d=(u=(c=t==null?void 0:t.content)==null?void 0:c.read)==null?void 0:u.objects)==null?void 0:d.find(h=>h.objectName===n),s=(o==null?void 0:o.displayName)||n&&mn(n),a=o==null?void 0:o.mapToName,l=(o==null?void 0:o.mapToDisplayName)||a&&mn(a);return l&&i&&r?p.jsx(lN,{style:{marginTop:"1rem"},children:p.jsxs("p",{style:{margin:"1rem 0"},children:[p.jsx("b",{children:l})," in ",i," is mapped to"," ",p.jsx("b",{children:s})," in ",r,"."]})}):null}function qd(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function xm(...e){return t=>{let n=!1;const r=e.map(i=>{const o=qd(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():qd(e[i],null)}}}}function Ei(...e){return W.useCallback(xm(...e),e)}function Vs(e,t=[]){let n=[];function r(o,s){const a=W.createContext(s),l=n.length;n=[...n,s];const c=d=>{var b;const{scope:h,children:f,...y}=d,m=((b=h==null?void 0:h[e])==null?void 0:b[l])||a,v=W.useMemo(()=>y,Object.values(y));return p.jsx(m.Provider,{value:v,children:f})};c.displayName=o+"Provider";function u(d,h){var m;const f=((m=h==null?void 0:h[e])==null?void 0:m[l])||a,y=W.useContext(f);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>W.createContext(s));return function(a){const l=(a==null?void 0:a[e])||o;return W.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,cN(i,...t)]}function cN(...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:l,scopeName:c})=>{const d=l(o)[`__scope${c}`];return{...a,...d}},{});return W.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function hn(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}var lo=globalThis!=null&&globalThis.document?W.useLayoutEffect:()=>{},dN=W[" useInsertionEffect ".trim().toString()]||lo;function Ou({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,o,s]=fN({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:i;{const u=W.useRef(e!==void 0);W.useEffect(()=>{const d=u.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,r])}const c=W.useCallback(u=>{var d;if(a){const h=pN(u)?u(e):u;h!==e&&((d=s.current)==null||d.call(s,h))}else o(u)},[a,e,o,s]);return[l,c]}function fN({defaultProp:e,onChange:t}){const[n,r]=W.useState(e),i=W.useRef(n),o=W.useRef(t);return dN(()=>{o.current=t},[t]),W.useEffect(()=>{var s;i.current!==n&&((s=o.current)==null||s.call(o,n),i.current=n)},[n,i]),[n,r,o]}function pN(e){return typeof e=="function"}function hN(e){const t=W.useRef({value:e,previous:e});return W.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function mN(e){const[t,n]=W.useState(void 0);return lo(()=>{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 l=o.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.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 gN(e,t){return W.useReducer((n,r)=>t[n][r]??n,e)}var Eu=e=>{const{present:t,children:n}=e,r=yN(t),i=typeof n=="function"?n({present:r.isPresent}):W.Children.only(n),o=Ei(r.ref,vN(i));return typeof n=="function"||r.isPresent?W.cloneElement(i,{ref:o}):null};Eu.displayName="Presence";function yN(e){const[t,n]=W.useState(),r=W.useRef(null),i=W.useRef(e),o=W.useRef("none"),s=e?"mounted":"unmounted",[a,l]=gN(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return W.useEffect(()=>{const c=Wo(r.current);o.current=a==="mounted"?c:"none"},[a]),lo(()=>{const c=r.current,u=i.current;if(u!==e){const h=o.current,f=Wo(c);e?l("MOUNT"):f==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),lo(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=f=>{const m=Wo(r.current).includes(CSS.escape(f.animationName));if(f.target===t&&m&&(l("ANIMATION_END"),!i.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},h=f=>{f.target===t&&(o.current=Wo(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:W.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function Wo(e){return(e==null?void 0:e.animationName)||"none"}function vN(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)}function gl(e){const t=wN(e),n=W.forwardRef((r,i)=>{const{children:o,...s}=r,a=W.Children.toArray(o),l=a.find(xN);if(l){const c=l.props.children,u=a.map(d=>d===l?W.Children.count(c)>1?W.Children.only(null):W.isValidElement(c)?c.props.children:null:d);return p.jsx(t,{...s,ref:i,children:W.isValidElement(c)?W.cloneElement(c,void 0,u):null})}return p.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function wN(e){const t=W.forwardRef((n,r)=>{const{children:i,...o}=n;if(W.isValidElement(i)){const s=CN(i),a=IN(o,i.props);return i.type!==W.Fragment&&(a.ref=r?xm(r,s):s),W.cloneElement(i,a)}return W.Children.count(i)>1?W.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var bN=Symbol("radix.slottable");function xN(e){return W.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===bN}function IN(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)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function CN(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 SN=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Hn=SN.reduce((e,t)=>{const n=gl(`Primitive.${t}`),r=W.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Us="Checkbox",[ON,JA]=Vs(Us),[EN,_u]=ON(Us);function _N(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:o,form:s,name:a,onCheckedChange:l,required:c,value:u="on",internal_do_not_use_render:d}=e,[h,f]=Ou({prop:n,defaultProp:i??!1,onChange:l,caller:Us}),[y,m]=W.useState(null),[v,b]=W.useState(null),g=W.useRef(!1),w=y?!!s||!!y.closest("form"):!0,x={checked:h,disabled:o,setChecked:f,control:y,setControl:m,name:a,form:s,value:u,hasConsumerStoppedPropagationRef:g,required:c,defaultChecked:pr(i)?!1:i,isFormControl:w,bubbleInput:v,setBubbleInput:b};return p.jsx(EN,{scope:t,...x,children:TN(d)?d(x):r})}var Im="CheckboxTrigger",Cm=W.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{const{control:o,value:s,disabled:a,checked:l,required:c,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:h,isFormControl:f,bubbleInput:y}=_u(Im,e),m=Ei(i,u),v=W.useRef(l);return W.useEffect(()=>{const b=o==null?void 0:o.form;if(b){const g=()=>d(v.current);return b.addEventListener("reset",g),()=>b.removeEventListener("reset",g)}},[o,d]),p.jsx(Hn.button,{type:"button",role:"checkbox","aria-checked":pr(l)?"mixed":l,"aria-required":c,"data-state":_m(l),"data-disabled":a?"":void 0,disabled:a,value:s,...r,ref:m,onKeyDown:hn(t,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:hn(n,b=>{d(g=>pr(g)?!0:!g),y&&f&&(h.current=b.isPropagationStopped(),h.current||b.stopPropagation())})})});Cm.displayName=Im;var Tu=W.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:s,disabled:a,value:l,onCheckedChange:c,form:u,...d}=e;return p.jsx(_N,{__scopeCheckbox:n,checked:i,defaultChecked:o,disabled:a,required:s,onCheckedChange:c,name:r,form:u,value:l,internal_do_not_use_render:({isFormControl:h})=>p.jsxs(p.Fragment,{children:[p.jsx(Cm,{...d,ref:t,__scopeCheckbox:n}),h&&p.jsx(Em,{__scopeCheckbox:n})]})})});Tu.displayName=Us;var Sm="CheckboxIndicator",Nu=W.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=_u(Sm,n);return p.jsx(Eu,{present:r||pr(o.checked)||o.checked===!0,children:p.jsx(Hn.span,{"data-state":_m(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});Nu.displayName=Sm;var Om="CheckboxBubbleInput",Em=W.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:i,checked:o,defaultChecked:s,required:a,disabled:l,name:c,value:u,form:d,bubbleInput:h,setBubbleInput:f}=_u(Om,e),y=Ei(n,f),m=hN(o),v=mN(r);W.useEffect(()=>{const g=h;if(!g)return;const w=window.HTMLInputElement.prototype,O=Object.getOwnPropertyDescriptor(w,"checked").set,E=!i.current;if(m!==o&&O){const D=new Event("click",{bubbles:E});g.indeterminate=pr(o),O.call(g,pr(o)?!1:o),g.dispatchEvent(D)}},[h,m,o,i]);const b=W.useRef(pr(o)?!1:o);return p.jsx(Hn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??b.current,required:a,disabled:l,name:c,value:u,form:d,...t,tabIndex:-1,ref:y,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Em.displayName=Om;function TN(e){return typeof e=="function"}function pr(e){return e==="indeterminate"}function _m(e){return pr(e)?"indeterminate":e?"checked":"unchecked"}function ku(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 NN=["color"],Tm=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=ku(e,NN);return C.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}),C.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"}))}),kN=["color"],AN=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=ku(e,kN);return C.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}),C.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"}))}),RN=["color"],PN=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=ku(e,RN);return C.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}),C.createElement("path",{d:"M8.4449 0.608765C8.0183 -0.107015 6.9817 -0.107015 6.55509 0.608766L0.161178 11.3368C-0.275824 12.07 0.252503 13 1.10608 13H13.8939C14.7475 13 15.2758 12.07 14.8388 11.3368L8.4449 0.608765ZM7.4141 1.12073C7.45288 1.05566 7.54712 1.05566 7.5859 1.12073L13.9798 11.8488C14.0196 11.9154 13.9715 12 13.8939 12H1.10608C1.02849 12 0.980454 11.9154 1.02018 11.8488L7.4141 1.12073ZM6.8269 4.48611C6.81221 4.10423 7.11783 3.78663 7.5 3.78663C7.88217 3.78663 8.18778 4.10423 8.1731 4.48612L8.01921 8.48701C8.00848 8.766 7.7792 8.98664 7.5 8.98664C7.2208 8.98664 6.99151 8.766 6.98078 8.48701L6.8269 4.48611ZM8.24989 10.476C8.24989 10.8902 7.9141 11.226 7.49989 11.226C7.08567 11.226 6.74989 10.8902 6.74989 10.476C6.74989 10.0618 7.08567 9.72599 7.49989 9.72599C7.9141 9.72599 8.24989 10.0618 8.24989 10.476Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const FN="_checkboxGroupContainer_hqfeu_1",DN="_stack_hqfeu_6",MN="_selectAllContainer_hqfeu_10",LN="_fieldContainer_hqfeu_17",jN="_checkbox_hqfeu_1",_i={checkboxGroupContainer:FN,stack:DN,selectAllContainer:MN,fieldContainer:LN,checkbox:jN};function BN({id:e,isChecked:t,label:n,onCheckedChange:r}){return p.jsxs("div",{className:_i.fieldContainer,children:[p.jsx(Tu,{className:_i.checkbox,id:e,onCheckedChange:r,checked:t,children:p.jsx(Nu,{children:p.jsx(Tm,{})})}),p.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function VN({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:i}){return p.jsxs("div",{className:_i.selectAllContainer,children:[p.jsx(Tu,{className:_i.checkbox,id:e,onCheckedChange:r,checked:i?"indeterminate":t,children:p.jsxs(Nu,{children:[i&&p.jsx(AN,{}),t===!0&&p.jsx(Tm,{})]})}),p.jsx("label",{htmlFor:e,children:n})]})}function UN({children:e}){return p.jsx("div",{className:_i.checkboxGroupContainer,children:e})}function $N({children:e}){return p.jsx("div",{className:_i.stack,children:e})}const qN="_paginationContainer_1p51x_1",zN="_pageInfo_1p51x_7",KN="_searchContainer_1p51x_13",HN="_searchInput_1p51x_17",JN="_noResults_1p51x_21",Ki={paginationContainer:qN,pageInfo:zN,searchContainer:KN,searchInput:HN,noResults:JN};function Nm({items:e,onItemChange:t,itemsPerPage:n=8,showSelectAll:r=!0,showSearch:i=!0,searchPlaceholder:o="Search fields...",itemName:s="fields"}){const[a,l]=C.useState(1),[c,u]=C.useState(""),d=e.filter(x=>x.label.toLowerCase().includes(c.toLowerCase())),h=Math.ceil(d.length/n),f=(a-1)*n,y=f+n,m=d.slice(f,y),v=x=>{u(x),l(1)},b=x=>{d.forEach(O=>{t(O.id,x)})},g=d.length>0&&d.every(x=>x.isChecked),w=d.some(x=>x.isChecked);return p.jsxs(UN,{children:[i&&p.jsx("div",{className:Ki.searchContainer,children:p.jsx(kp,{id:"field-search",type:"text",placeholder:o,value:c,onChange:x=>v(x.target.value),className:Ki.searchInput})}),r&&e.length>=2&&p.jsx(VN,{id:"select-all-fields",isChecked:g,label:`Select all ${d.length} ${c?"matching ":""}${s}`,onCheckedChange:b,isIndeterminate:w&&!g}),p.jsx($N,{children:m.map(x=>p.jsx(BN,{id:x.id,isChecked:x.isChecked,label:x.label,onCheckedChange:O=>t(x.id,O===!0)},x.id))}),h>1&&p.jsxs("div",{className:Ki.paginationContainer,children:[p.jsx(ot,{type:"button",onClick:()=>l(x=>Math.max(1,x-1)),disabled:a===1,variant:"ghost",children:"<"}),p.jsxs("span",{className:Ki.pageInfo,children:[a," of ",h]}),p.jsx(ot,{type:"button",onClick:()=>l(x=>Math.min(h,x+1)),disabled:a===h,variant:"ghost",children:">"})]}),d.length===0&&c&&p.jsxs("div",{className:Ki.noResults,children:["No ",s,' found matching "',c,'"']})]})}function WN(e,t,n){var i;const r=((i=e==null?void 0:e.read)==null?void 0:i.selectedOptionalFields)||{};r[t]=n,n||delete r[t]}function QN(e,t,n,r){t(e,i=>WN(i,n,r))}function GN(){var c,u;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=vn(),i=(c=t==null?void 0:t.read)==null?void 0:c.selectedOptionalFields,o=(u=t==null?void 0:t.read)==null?void 0:u.optionalFields,s=(d,h)=>{r&&t&&QN(r,n,d,h)},a=C.useMemo(()=>(o==null?void 0:o.filter(d=>!yr(d)&&"fieldName"in d&&"displayName"in d).map(d=>({id:d.fieldName,label:d.displayName,isChecked:!!(i!=null&&i[d.fieldName])})).sort((d,h)=>d.label.localeCompare(h.label)))||[],[o,i]);return!!(o&&o.length>0)&&p.jsxs(p.Fragment,{children:[p.jsx(Gt,{string:`${e} reads the following optional fields`}),p.jsx(Nm,{items:a,onItemChange:s,showSelectAll:a.length>=2},`${r}-${o==null?void 0:o.length}`)]})}function XN(){return p.jsx(GN,{})}const YN={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 ZN({children:e,style:t,...n}){return p.jsx("span",{style:{...YN,...t},...n,children:e})}const ek="_errorAlert_1tcao_1",tk="_errorHeader_1tcao_11",nk="_errorIcon_1tcao_17",rk="_errorTitle_1tcao_24",ik="_errorMessage_1tcao_30",Hi={errorAlert:ek,errorHeader:tk,errorIcon:nk,errorTitle:rk,errorMessage:ik};function ok({error:e}){return p.jsxs("div",{className:Hi.errorAlert,children:[p.jsxs("div",{className:Hi.errorHeader,children:[p.jsx(PN,{className:Hi.errorIcon}),p.jsx("span",{className:Hi.errorTitle,children:"Unable to load object"})]}),p.jsx("div",{className:Hi.errorMessage,children:e})]})}function sk(){var s,a,l;const{data:e}=_s(),{selectedObjectName:t}=vn(),{appName:n}=gr(),r=(l=(a=(s=e==null?void 0:e.content)==null?void 0:s.read)==null?void 0:a.objects)==null?void 0:l.find(c=>c.objectName===t),i=r==null?void 0:r.error,o=r==null?void 0:r.requiredFields;return i?p.jsx(ok,{error:i}):p.jsxs(p.Fragment,{children:[p.jsx(Gt,{string:`${n} reads the following fields`}),p.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:o!=null&&o.length?o.map(c=>yr(c)?null:p.jsx(ZN,{children:c.displayName},c.fieldName)):"There are no required fields."})]})}function ak(e,t,n,r,i){e.read&&(e.read.selectedValueMappings||(e.read.selectedValueMappings={}),e.read.selectedValueMappings[i]||(e.read.selectedValueMappings[i]={}),r===""&&e.read.selectedValueMappings[i][n]?delete e.read.selectedValueMappings[i][n]:e.read.selectedValueMappings[i][n]=r)}function km(e,t,n,r,i){t(e,o=>ak(o,e,n,r,i))}function xa(e){return e.mapToDisplayName||e.mapToName||e.fieldName||""}function lk(e,t){if(!e.fieldName)return{isValid:!1,errorMessage:"Field name is missing"};const n=t==null?void 0:t.valueType;if(!["singleSelect","multiSelect"].includes(n||""))return{isValid:!1,errorMessage:"fieldName is not a singleSelect or multiSelect"};const r=t==null?void 0:t.values;if(!r)return{isValid:!1,errorMessage:"Field values array is missing"};const i=Object.keys(r).length,o=Object.keys((e==null?void 0:e.mappedValues)||[]).length;return i!==o?{isValid:!1,errorMessage:"field values and the values to be mapped are not of the same length"}:{isValid:!0}}function uk(e,t,n){const r=Object.values(t).filter(Boolean),i=t[n];return e.filter(o=>{const s=o.value===i,a=r.includes(o.value);return s||!a})}function ck({string:e,fieldName:t}){return p.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[p.jsxs("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:[e,p.jsx("b",{children:t})]}),p.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:p.jsx(Ls,{style:{width:"100%",marginLeft:"1rem"}})})]})}function dk({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r}){var f;const{configureState:i,selectedObjectName:o,setConfigureState:s}=vn(),a=C.useMemo(()=>{var y,m;return((m=(y=i==null?void 0:i.read)==null?void 0:y.selectedValueMappings)==null?void 0:m[n])||{}},[(f=i==null?void 0:i.read)==null?void 0:f.selectedValueMappings,n]),l=C.useMemo(()=>a==null?void 0:a[e.mappedValue],[a,e.mappedValue]),c=C.useMemo(()=>r.map(y=>({id:y.value,label:y.displayValue,value:y.value})),[r]),u=C.useCallback(y=>{y&&t({target:{name:e.mappedValue,value:y.value,fieldName:n}})},[t,n,e.mappedValue]),d=C.useMemo(()=>p.jsx(wm,{items:c,selectedValue:l||null,onSelectedItemChange:u,placeholder:"Please select one",style:{borderRadius:"8px",width:"100%"}},l),[l,c,u]),h=C.useCallback(()=>{o&&km(o,s,e.mappedValue,"",n)},[o,s,e.mappedValue,n]);return p.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:".25rem"},children:[p.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:p.jsx("span",{style:{fontWeight:500},children:e.mappedDisplayValue})}),p.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[d,p.jsx(ot,{type:"button",variant:"ghost",onClick:h,children:"Clear"})]})]},e.mappedValue)}function fk(){var l,c;const{fieldMapping:e}=St(),{selectedObjectName:t,configureState:n,setConfigureState:r}=vn(),i=(l=n==null?void 0:n.read)==null?void 0:l.selectedFieldMappings,o=(c=n==null?void 0:n.read)==null?void 0:c.selectedValueMappings,s=C.useMemo(()=>{const u=t&&e?Object.values(e[t]||{}).flat().filter(d=>d.mappedValues).map(d=>({...d})):[];if(i)for(let d=0;d<u.length;d+=1){const{mapToName:h}=u[d];i!=null&&i[h]&&(u[d].fieldName=i[h])}return u},[t,e,i]),a=C.useCallback(u=>{const{value:d,name:h,fieldName:f}=u.target;d&&t&&km(t,r,h,d,f)},[t,r]);return s!=null&&s.length?p.jsx(p.Fragment,{children:s.map(u=>{var f,y,m;const d=(y=(f=n==null?void 0:n.read)==null?void 0:f.allFieldsMetadata)==null?void 0:y[u.fieldName],h=lk(u,d);return h.isValid?p.jsxs(p.Fragment,{children:[p.jsx(ck,{string:"Map the values for ",fieldName:xa(u)}),p.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:p.jsx(Bs,{id:xa(u),children:(m=u==null?void 0:u.mappedValues)==null?void 0:m.map(v=>{const b=(d==null?void 0:d.values)||[],g=(o==null?void 0:o[u.fieldName])||{},w=uk(b,g,v.mappedValue);return p.jsx(dk,{allValueOptions:w,mappedValue:v,onSelectChange:a,fieldName:(u==null?void 0:u.fieldName)||""},`${v.mappedValue}-${u.fieldName}`)})},xa(u))})]}):(console.error(h.errorMessage,u),null)})}):null}const zd=!1;function pk(){return sN(),p.jsxs(p.Fragment,{children:[zd,p.jsx(uN,{}),p.jsx(sk,{}),p.jsx(iN,{}),p.jsx(rN,{}),p.jsx(fk,{}),p.jsx(XN,{}),zd]})}function hk(e,t,n){var r;if(((r=e==null?void 0:e.write)==null?void 0:r.selectedWriteObjects)===null&&(e.write.selectedWriteObjects={}),e!=null&&e.write){const i=e.write.selectedWriteObjects;n&&(i[t]={objectName:t}),n||delete i[t]}}function mk(e,t,n,r){t(e,i=>{hk(i,n,r)})}function gk(){var c,u;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=vn(),i=(c=n==null?void 0:n.write)==null?void 0:c.selectedWriteObjects,o=(u=n==null?void 0:n.write)==null?void 0:u.writeObjects,s=(d,h)=>{t&&n&&mk(t,r,d,h)},a=!!o,l=(o==null?void 0:o.map(d=>({id:d.objectName,label:d.displayName,isChecked:!!(i!=null&&i[d.objectName])})))||[];return a&&p.jsxs(p.Fragment,{children:[p.jsx(Gt,{string:`Allow ${e} to write to these objects`}),p.jsx(Nm,{items:l,onItemChange:s,showSelectAll:o.length>=2,searchPlaceholder:"Search objects...",itemName:"objects"})]})}function yk(){return p.jsx(p.Fragment,{children:p.jsx(gk,{})})}function Am({resetComponent:e,onDisconnectSuccess:t}){return p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[p.jsx(Gt,{string:"Remove connection"}),p.jsx("p",{children:"Click to disconnect your connection from the provider."}),p.jsx(Nh,{resetComponent:e,onDisconnectSuccess:t,buttonText:"Remove connection",buttonVariant:"danger",buttonStyle:{fontSize:"13px",width:"100%"}})]})}const vk="_authenticationRow_1g2ms_1",wk="_field_1g2ms_8",bk="_value_1g2ms_12",Ia={authenticationRow:vk,field:wk,value:bk};function Kd({label:e,value:t}){return p.jsxs("div",{className:Ia.authenticationRow,children:[p.jsx("div",{className:Ia.field,children:e}),p.jsx("div",{className:Ia.value,children:t})]})}function xk(){const{selectedConnection:e}=Rn(),{providerName:t}=Ot(),r=(e==null?void 0:e.provider)==="salesforce"?"subdomain":"workspace",i=`${t} ${r}`;return p.jsxs(p.Fragment,{children:[p.jsx(Gt,{string:"Connection details"}),p.jsxs("div",{style:{paddingBottom:"1rem"},children:[p.jsx(Kd,{label:i,value:e==null?void 0:e.providerWorkspaceRef}),p.jsx(Kd,{label:"Status",value:mn((e==null?void 0:e.status)||"")})]})]})}function Ik(){const{installation:e}=St(),{providerName:t}=Ot();return e?p.jsxs(p.Fragment,{children:[p.jsx(Gt,{string:"Uninstall entire integration"}),p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",padding:"1rem 0"},children:[e!=null&&e.id?p.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:["By clicking below, you will uninstall the entire ",t," ","integration. You will lose any configuration you've set up."]}):p.jsx("p",{children:"You've successfully uninstalled the integration."}),p.jsx(iu,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function Ck(){const{installation:e,resetComponent:t}=St();return p.jsxs(p.Fragment,{children:[p.jsx(xk,{}),p.jsx(ru,{}),e&&p.jsx(Ik,{}),!e&&p.jsx(Am,{resetComponent:t})]})}function Rm({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:i}){var ge,we,I,J,V,S,z,$,Y,ne,te,ae,Z,ye;const{installation:o}=Jr(),{hydratedRevision:s,loading:a}=Mi(),{configureState:l,selectedObjectName:c}=vn(),u=o==null?void 0:o.config,d=u&&c&&!!dp(u,c)||!1,h=c?Op(u,c):void 0,f=(ge=l==null?void 0:l.read)==null?void 0:ge.selectedFieldMappings,y=!gp(h,f),m=s&&c?Pl(u,s,c):void 0,v=(we=l==null?void 0:l.read)==null?void 0:we.selectedOptionalFields,b=!mp(m,v),g=c?(S=(V=(J=(I=u==null?void 0:u.content)==null?void 0:I.read)==null?void 0:J.objects)==null?void 0:V[c])==null?void 0:S.selectedValueMappings:void 0,w=(z=l==null?void 0:l.read)==null?void 0:z.selectedValueMappings,x=!yp(g,w),O=(Y=($=u==null?void 0:u.content)==null?void 0:$.write)==null?void 0:Y.objects,E=(ne=l==null?void 0:l.write)==null?void 0:ne.selectedWriteObjects,D=!vp(O||{},E||{}),P=b||y||x||D||r||c!==wi&&!d,F=!!((ye=(Z=(ae=(te=s==null?void 0:s.content)==null?void 0:te.read)==null?void 0:ae.objects)==null?void 0:Z.find(q=>q.objectName===c))!=null&&ye.error),U=a||n||!l||!c||!P||F,B=c===wi,X=c===ds,se=p.jsx(ot,{type:"submit",disabled:U,children:r?"Install":"Save"}),ce=p.jsx(ot,{type:"button",onClick:t,disabled:U,variant:"ghost",children:"Reset"});return n?p.jsx(io,{}):p.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[p.jsx("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px",height:"3rem"},children:!X&&p.jsxs(p.Fragment,{children:[se,ce]})}),p.jsxs(Kn,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[i&&p.jsx(yo,{children:typeof i=="string"?i:"Installation Failed."}),a&&p.jsx(io,{}),s&&!B&&!X&&p.jsx(pk,{}),s&&B&&!X&&p.jsx(yk,{}),!a&&X&&p.jsx(Ck,{})]})]})}const Pm=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:i,onUpdateSuccess:o,fieldMapping:s}=St(),{hydratedRevision:a,loading:l}=Mi(),{selectedObjectName:c}=Rh(),{selectedConnection:u}=Rn(),d=Mf(),{projectIdOrName:h}=Ze(),{resetBoundary:f,setErrors:y,setError:m,getError:v}=An(),{resetConfigureState:b,objectConfigurationsState:g}=ou(),w=Ep(c||"",g),{onNextIncompleteTab:x}=F_(),O=C.useCallback(()=>{f(Ee.INSTALLATION_MUTATION)},[f]),E=C.useCallback(N=>N?M=>{m(Ee.INSTALLATION_MUTATION,N,M)}:M=>{console.error("objectName is required to set installation error: ",M)},[m]),D=C.useCallback(N=>N?v(Ee.INSTALLATION_MUTATION,N):"",[v]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:a,loading:l,selectedObjectName:c,selectedConnection:u,apiKey:d,projectIdOrName:h,resetBoundary:f,setErrors:y,setMutateInstallationError:E,getMutateInstallationError:D,resetMutateInstallationErrorState:O,resetConfigureState:b,objectConfigurationsState:g,configureState:w,onInstallSuccess:i,onUpdateSuccess:o,onNextIncompleteTab:x,fieldMapping:s}},Sk=void 0;function Ok(){const{consumerRef:e,setInstallation:t,hydratedRevision:n,loading:r,selectedObjectName:i,selectedConnection:o,resetBoundary:s,setErrors:a,setMutateInstallationError:l,getMutateInstallationError:c,resetMutateInstallationErrorState:u,resetConfigureState:d,objectConfigurationsState:h,configureState:f,onInstallSuccess:y,onNextIncompleteTab:m,fieldMapping:v}=Pm(),[b,g]=C.useState(!1),{createInstallation:w}=sp(),x=i===wi,O=c(i),E=C.useCallback(()=>{s(Ee.MAPPING),n!=null&&n.content&&!r&&i&&bp(n,Sk,i,d)},[s,n,r,i,d]);C.useEffect(()=>{!f&&(n!=null&&n.content)&&!r&&E()},[f,h,n,r,E]);const D=()=>{u();const{requiredMapFields:R,selectedFieldMappings:P}=(f==null?void 0:f.read)||{},{errorList:F}=hp(R,P,a);if(!(F.length>0))if(i&&(o!=null&&o.id)&&e&&n){g(!0);const U=aC(f,i,n,e,v);if(!U){console.error("Error when generating createConfig from configureState"),g(!1);return}w({config:U.content,onSuccess:B=>{t(B),y==null||y(B.id,B.config),g(!1),m()},onError:B=>{l(i)(B.message),g(!1)}})}else console.error("CreateInstallallation - onSaveReadCreate: missing required props")},N=()=>{if(u(),i&&(o!=null&&o.id)&&e&&n){g(!0);const R=uC(f,n,e);if(!R){console.error("Error when generating createConfig from configureState"),g(!1);return}w({config:R.content,onSuccess:P=>{t(P),y==null||y(P.id,P.config),g(!1),m()},onError:P=>{l(i)(P.message),g(!1)}})}else console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},M=R=>{R.preventDefault(),x?N():D()};return p.jsx(Rm,{errorMsg:O,isCreateMode:!0,isLoading:b,onSave:M,onReset:E})}const Ek=(e,t,n,r,i)=>{const o=xp(e),s=Ip(e),a=Cp(t,i),l=Sp(e),c={content:{read:{objects:{[t]:{objectName:t,selectedFields:o,selectedFieldMappings:s,dynamicMappingsInput:a,selectedValueMappings:l||{},backfill:r}}}}};return go(n)&&(c.content||(c.content={}),c.content.proxy={enabled:!0}),c},_k=(e,t)=>{const r={content:{write:{objects:_p(e)}}};return go(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r};function Tk({installation:e}){const{setInstallation:t,hydratedRevision:n,loading:r,selectedObjectName:i,resetBoundary:o,setErrors:s,setMutateInstallationError:a,getMutateInstallationError:l,resetConfigureState:c,configureState:u,onUpdateSuccess:d,onNextIncompleteTab:h,fieldMapping:f}=Pm(),{updateInstallation:y}=ap(),[m,v]=C.useState(!1),b=i===wi,g=l(i),{config:w}=e,x=C.useCallback(()=>{o(Ee.MAPPING),n!=null&&n.content&&!r&&i&&bp(n,w,i,c)},[o,n,r,i,w,c]);C.useEffect(()=>{u||x()},[u,x]);const O=C.useMemo(()=>{var R,P,F;return(F=(P=(R=n==null?void 0:n.content)==null?void 0:R.read)==null?void 0:P.objects)==null?void 0:F.find(U=>(U==null?void 0:U.objectName)===i)},[n,i]),E=()=>{const{requiredMapFields:M,selectedFieldMappings:R}=(u==null?void 0:u.read)||{},{errorList:P}=hp(M,R,s);if(!(P.length>0))if(n&&u&&i&&O){v(!0);const F=Ek(u,i,n,O.backfill,f);if(!F){console.error("Error when generating updateConfig from configureState"),v(!1);return}y({config:F.content,onSuccess:U=>{t(U),d==null||d(U.id,U.config),v(!1),h()},onError:U=>{a(i)(U.message),v(!1)}})}else console.error("UpdateInstallation - onSaveRead missing required props")},D=()=>{if(u&&n){v(!0);const M=_k(u,n);if(!M){console.error("Error when generating write updateConfig from configureState"),v(!1);return}y({config:M.content,onSuccess:R=>{t(R),d==null||d(R.id,R.config),v(!1),h()},onError:R=>{a(i)(R.message),v(!1)}})}else console.error("UpdateInstallation - onSaveWrite missing required props")},N=M=>{M.preventDefault(),b?D():E()};return p.jsx(Rm,{errorMsg:g,onSave:N,onReset:x,isLoading:m})}function Nk(){const{integrationObj:e,installation:t}=St();return e?t&&e?p.jsx(Tk,{installation:t}):p.jsx(Ok,{}):p.jsx(ep,{message:"We can't load the integration"})}class Au extends C.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){var r,i;console.error("Ampersand Error Boundary caught an error:",t),console.error("[Error Info]:",n),(i=(r=this.props).onError)==null||i.call(r,t,n)}render(){var t;return this.state.hasError?this.props.fallback?this.props.fallback:p.jsx(Vt,{message:((t=this.state.error)==null?void 0:t.message)||"Something went wrong. Please try again later."}):this.props.children}}function kk(){return p.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[p.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),p.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ru({text:e,children:t}){return p.jsx(Ai,{children:p.jsxs(Kn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[p.jsx(kk,{}),p.jsx("p",{children:e}),t]})})}function Ak({provider:e}){const{providerName:t}=Ot(e),n=`You have successfully installed your ${t} integration.`;return p.jsx(Ru,{text:n,children:p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:p.jsx(iu,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const Rk=e=>{const{read:t,write:n}=(e==null?void 0:e.content)??{};return!t&&!n};function Pk({children:e}){var O;const t=C.useRef(!1),{projectIdOrName:n}=Ze(),{hydratedRevision:r,loading:i}=Mi(),{integrationObj:o,installation:s,groupRef:a,consumerRef:l,onInstallSuccess:c,isIntegrationDeleted:u}=St(),{mutate:d,isIdle:h,isPending:f,error:y,errorMsg:m}=op(),{selectedConnection:v,isConnectionsLoading:b}=Rn(),g=i||f||b,w=(O=r==null?void 0:r.content)==null?void 0:O.provider,x=Rk(r);return C.useEffect(()=>{var E;if(!g&&!b&&r&&x&&!s&&v&&(o!=null&&o.id)&&!u&&w){const D={projectIdOrName:n,integrationId:o==null?void 0:o.id,installation:{groupRef:a,connectionId:v==null?void 0:v.id,config:{content:{provider:w}}}};go(r)===!0&&(D.installation.config.content.proxy=(E=r==null?void 0:r.content)==null?void 0:E.proxy),h&&!t.current&&d(D,{onSuccess:N=>{t.current||(c==null||c(N==null?void 0:N.id,N.config),t.current=!0)}})}},[r,x,s,v,n,o==null?void 0:o.id,a,l,g,c,u,b,w,d,h]),x&&w&&s?p.jsx(Ak,{provider:w}):y?p.jsx(Vt,{message:m??"Create installation failed"}):o?g?p.jsx(Ri,{}):p.jsx("div",{children:e}):p.jsx(Vt,{message:"We can't load the integration"})}function So(){const e=Ct(),t=st();return zn({mutationKey:["createConnection"],mutationFn:async n=>(await e()).connectionApi.generateConnection(n),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]})},onError:n=>{console.error("Error creating connection and loading provider info"),it(n)}})}function Fk({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,metadataInputs:l,moduleError:c}){const{projectIdOrName:u}=Ze(),d=So(),h=C.useCallback(f=>{var b;const{apiKey:y,providerMetadata:m}=f,v={projectIdOrName:u,generateConnectionParams:{providerWorkspaceRef:(b=m==null?void 0:m.workspace)==null?void 0:b.value,groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,apiKey:y,...m&&{providerMetadata:m}}};d.mutate(v)},[u,o,i,r,n,e,d]);return a===null?p.jsx(h_,{provider:e,providerInfo:t,handleSubmit:h,error:c||null,metadataInputs:l}):s}function Dk({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,metadataInputs:l,moduleError:c}){const{projectIdOrName:u}=Ze(),d=So(),h=C.useCallback(f=>{var g;const{user:y,pass:m,providerMetadata:v}=f,b={projectIdOrName:u,generateConnectionParams:{providerWorkspaceRef:(g=v==null?void 0:v.workspace)==null?void 0:g.value,groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:y,password:m},...v&&{providerMetadata:v}}};d.mutate(b)},[u,o,i,r,n,e,d]);return a===null?p.jsx(w_,{provider:e,providerInfo:t,handleSubmit:h,error:c||null,metadataInputs:l}):s}function Mk({providerInfo:e,handleSubmit:t,isButtonDisabled:n,buttonVariant:r,metadataInputs:i}){var h;const[o,s]=C.useState({}),a=f=>{const{name:y,value:m}=f.currentTarget;s(v=>({...v,[y]:m.trim()}))},l=Ci(i,o),c=n||!l,u=((h=e.customOpts)==null?void 0:h.inputs)||[],d=()=>{const f=Ds(i,o),y=Object.fromEntries(u.map(m=>[m.name,o[m.name]]));t({customAuth:y,providerMetadata:f})};return p.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[u.map(f=>p.jsxs("div",{children:[p.jsx(Oh,{url:f.docsURL,prompt:f.prompt,inputName:f.displayName}),p.jsx(_n.PasswordInput,{id:f.name,name:f.name,onChange:a,placeholder:""})]},f.name)),i.map(f=>p.jsx(Co,{metadata:f,onChange:a,variant:"header"},f.name)),p.jsx(ot,{style:{marginTop:"1em",width:"100%"},disabled:c,type:"submit",onClick:d,variant:r,children:"Next"})]})}function Lk({providerInfo:e,handleSubmit:t,error:n,isButtonDisabled:r,metadataInputs:i}){return p.jsxs(vr,{children:[p.jsx(wr,{children:`Set up ${e.displayName} integration`}),p.jsx(Pn,{error:n}),p.jsx(Mk,{providerInfo:e,handleSubmit:t,isButtonDisabled:r||!!n,metadataInputs:i})]})}function jk({providerInfo:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,selectedConnection:s,metadataInputs:a,moduleError:l}){const{projectIdOrName:c}=Ze(),u=So(),[d,h]=C.useState(l||null),f=C.useCallback(y=>{var g;const{customAuth:m,providerMetadata:v}=y;h(null);const b={projectIdOrName:c,generateConnectionParams:{providerWorkspaceRef:(g=v==null?void 0:v.workspace)==null?void 0:g.value,groupName:i,groupRef:r,consumerName:n,consumerRef:t,provider:e.name,customAuth:m,...v&&{providerMetadata:v}}};u.mutate(b,{onError:w=>{it(w,h)},onSuccess:()=>{h(null)}})},[c,i,r,n,t,e.name,u]);return s===null?p.jsx(Lk,{providerInfo:e,handleSubmit:f,error:d,metadataInputs:a}):o}function Bk({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 p.jsxs(vr,{children:[p.jsx(wr,{children:o||`Set up ${r} integration`}),p.jsx(Pn,{error:t}),i,p.jsx(ot,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function Vk({...e}){return p.jsx(Bk,{...e})}function Uk({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,selectedConnection:s,providerName:a,moduleError:l}){const{projectIdOrName:c}=Ze(),u=So(),d=C.useCallback(()=>{const h={projectIdOrName:c,generateConnectionParams:{groupName:i,groupRef:r,consumerName:n,consumerRef:t,provider:e}};u.mutate(h)},[c,i,r,n,t,e,u]);return s===null?p.jsx(Vk,{handleSubmit:d,error:l||null,providerName:a}):o}const $k=()=>{const e=Ct(),t=st();return zn({mutationKey:["createOauthConnection"],mutationFn:async n=>(await e()).oAuthApi.oauthConnect(n),onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function qk({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return p.jsxs(vr,{children:[p.jsx(wr,{children:`Set up ${r} integration`}),p.jsx(SC,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),p.jsx(Pn,{error:t}),p.jsx(ot,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:n&&!t?"Loading...":"Next"})]})}const zk="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function Kk({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return p.jsxs(vr,{children:[p.jsx(wr,{children:"Enter your Salesforce subdomain"}),p.jsx(Fl,{href:zk,newTab:!0,children:"What is my Salesforce subdomain?"}),p.jsx(Pn,{error:n}),p.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[p.jsx(_n.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:i=>t(i.currentTarget.value)}),p.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),p.jsx(ot,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function Hk({handleSubmit:e,setFormData:t,error:n,isButtonDisabled:r,providerName:i,metadataInputs:o}){return p.jsxs(vr,{children:[p.jsxs(wr,{children:["Enter your ",i," workspace"]}),p.jsx(Pn,{error:n}),p.jsx("br",{}),o.map(s=>p.jsx(Co,{metadata:s,onChange:a=>t(s.name,a.currentTarget.value),providerName:i},s.name)),p.jsx(ot,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const Hd=600,Jd=600,Wd="salesforce";function Jk({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o,metadataInputs:s,moduleError:a}){const{projectId:l}=gr(),c=st(),u=C.useRef(null),[d,h]=C.useState(a||null),[f,y]=C.useState(""),[m,v]=C.useState({}),[b,g]=C.useState({}),{mutateAsync:w,isPending:x}=$k(),{isFetching:O,refetch:E}=Al({groupRef:r,provider:e});C.useEffect(()=>{const P=F=>{var U,B,X;F.origin===Xf&&(((U=F.data)==null?void 0:U.eventType)==="AUTHORIZATION_SUCCEEDED"?(h(null),console.debug("New connection:",F.data.data.connection),c.invalidateQueries({queryKey:["amp","connections"]})):((B=F.data)==null?void 0:B.eventType)==="AUTHORIZATION_FAILED"&&(console.error("OAuth failed:",F.data.data.error),c.invalidateQueries({queryKey:["amp","connections"]}),h(F.data.data.error||"An error occurred. Please try again.")),(X=u.current)==null||X.close())};return window.addEventListener("message",P),()=>window.removeEventListener("message",P)},[c]);const D=P=>{y(P),v(F=>({...F,workspace:P})),g(F=>({...F,workspace:{value:P,source:"input"}}))},N=(P,F)=>{v(U=>({...U,[P]:F})),g(U=>({...U,[P]:{value:F,source:"input"}}))},M=async()=>{var P;h(null);try{const{data:F}=await E();if(F&&F.length>0){console.debug("connections found");return}}catch{console.debug("error with fetching connections")}if(s.length>0&&!Ci(s,m)){h("Please fill in all required fields");return}try{const F=await w({connectOAuthParams:{provider:e,consumerRef:t,groupRef:r,projectId:l||"",consumerName:n,groupName:i,providerWorkspaceRef:e===Wd?f:(P=b==null?void 0:b.workspace)==null?void 0:P.value,providerMetadata:b}});if(F){const U=window.screenX+(window.outerWidth-Hd)/2,B=window.screenY+(window.outerHeight-Jd)/2.5,X=`width=${Hd},height=${Jd},left=${U},top=${B}`;u.current=window.open(F,"OAuthPopup",X)}}catch(F){console.error(F),h(F instanceof Error?F.message:String(F)||"An error occurred. Please try again.")}},R=e===Wd?p.jsx(Kk,{handleSubmit:M,setWorkspace:D,error:d,isButtonDisabled:f.length===0||x||O||!!d}):s.length>0?p.jsx(Hk,{handleSubmit:M,setFormData:N,error:d,isButtonDisabled:!Ci(s,m)||x||O||!!d,providerName:o,metadataInputs:s}):p.jsx(qk,{handleSubmit:M,error:d,providerName:o,isButtonDisabled:x||O||!!d});return p.jsx("div",{children:R})}function Wk({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,explicitScopesRequired:s,selectedConnection:a,metadataInputs:l,moduleError:c}){const{projectIdOrName:u}=Ze(),d=So(),[h,f]=C.useState(c||null),y=C.useCallback(m=>{var b,g;f(null);const v={projectIdOrName:u,generateConnectionParams:{groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:(g=(b=m.providerMetadata)==null?void 0:b.workspace)==null?void 0:g.value,oauth2ClientCredentials:{clientId:m.clientId,clientSecret:m.clientSecret,scopes:m.scopes},...m.providerMetadata&&{providerMetadata:m.providerMetadata}}};d.mutate(v,{onError:()=>f("Error loading provider info")})},[u,o,i,r,n,e,d]);return a===null?p.jsx(x_,{providerName:t,handleSubmit:y,error:h,explicitScopesRequired:s,metadataInputs:l}):p.jsx(io,{})}function Qk({...e}){return p.jsx(Wk,{...e})}const Gk="authorizationCode",Xk="authorizationCodePKCE",Yk="clientCredentials";function Zk({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,selectedConnection:s,setSelectedConnection:a,metadataInputs:l,moduleError:c}){const{providerName:u}=Ot(e);if(t.oauth2Opts===void 0)return p.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:d,explicitScopesRequired:h}=t.oauth2Opts,f={provider:e,consumerRef:n,consumerName:r,groupRef:i,groupName:o,providerName:u,metadataInputs:l,moduleError:c};return d===Gk||d===Xk?p.jsx(Jk,{...f}):d===Yk?p.jsx(Qk,{...f,explicitScopesRequired:h,selectedConnection:s,setSelectedConnection:a}):d==="password"?p.jsx("em",{children:"Password flow not supported yet"}):p.jsxs("em",{children:["Unsupported grant type: ",d]})}function eA(e){const{selectedConnection:t}=Rn();C.useEffect(()=>{e&&t&&e(t)},[e,t])}function tA({onSuccess:e}){eA(e)}function Fm({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,onSuccess:s,onDisconnectSuccess:a,resetComponent:l}){var U,B,X;const{data:c,isLoading:u,isError:d,error:h,providerName:f,selectedProvider:y}=Ot(e),{provider:m,isIntegrationDeleted:v,integrationObj:b}=St(),{selectedConnection:g,setSelectedConnection:w}=Rn();tA({onSuccess:s});const x=st(),O=c,E=(B=(U=b==null?void 0:b.latestRevision)==null?void 0:U.content)==null?void 0:B.module,{module:D,error:N}=d_(E,O),M=((X=O==null?void 0:O.metadata)==null?void 0:X.input)||[],R=f_(M,D);C.useEffect(()=>{d&&(console.error("Error loading provider info."),it(h))},[d,h]);const P=C.useCallback(()=>{x.clear(),l()},[l,x]);if(!e&&!m)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(v)return p.jsx(Ru,{text:"Integration successfully uninstalled.",children:p.jsx(ot,{type:"button",onClick:P,style:{width:"100%"},children:"Reinstall Integration"})});if(g)return o;if(u)return p.jsx(Ri,{});if(O==null)return p.jsx(Vt,{message:"Provider info was not found."});const F={provider:y,consumerRef:t,consumerName:n,groupRef:r,groupName:i,selectedConnection:g,setSelectedConnection:w,providerName:f,providerInfo:O,onDisconnectSuccess:a,metadataInputs:R,moduleError:N};return O.authType==="none"?p.jsx(Uk,{...F,children:o}):O.authType==="basic"?p.jsx(Dk,{...F,children:o}):O.authType==="apiKey"?p.jsx(Fk,{...F,children:o}):O.authType==="custom"?p.jsx(jk,{...F,children:o}):p.jsx(Zk,{...F})}function nA(e){const t=e+"CollectionProvider",[n,r]=Vs(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=m=>{const{scope:v,children:b}=m,g=C.useRef(null),w=C.useRef(new Map).current;return p.jsx(i,{scope:v,itemMap:w,collectionRef:g,children:b})};s.displayName=t;const a=e+"CollectionSlot",l=gl(a),c=C.forwardRef((m,v)=>{const{scope:b,children:g}=m,w=o(a,b),x=Ei(v,w.collectionRef);return p.jsx(l,{ref:x,children:g})});c.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",h=gl(u),f=C.forwardRef((m,v)=>{const{scope:b,children:g,...w}=m,x=C.useRef(null),O=Ei(v,x),E=o(u,b);return C.useEffect(()=>(E.itemMap.set(x,{ref:x,...w}),()=>void E.itemMap.delete(x))),p.jsx(h,{[d]:"",ref:O,children:g})});f.displayName=u;function y(m){const v=o(e+"CollectionConsumer",m);return C.useCallback(()=>{const g=v.collectionRef.current;if(!g)return[];const w=Array.from(g.querySelectorAll(`[${d}]`));return Array.from(v.itemMap.values()).sort((E,D)=>w.indexOf(E.ref.current)-w.indexOf(D.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:s,Slot:c,ItemSlot:f},y,r]}var rA=W[" useId ".trim().toString()]||(()=>{}),iA=0;function Dm(e){const[t,n]=W.useState(rA());return lo(()=>{n(r=>r??String(iA++))},[e]),e||(t?`radix-${t}`:"")}function oA(e){const t=W.useRef(e);return W.useEffect(()=>{t.current=e}),W.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var sA=W.createContext(void 0);function Mm(e){const t=W.useContext(sA);return e||t||"ltr"}var Ca="rovingFocusGroup.onEntryFocus",aA={bubbles:!1,cancelable:!0},Oo="RovingFocusGroup",[yl,Lm,lA]=nA(Oo),[uA,jm]=Vs(Oo,[lA]),[cA,dA]=uA(Oo),Bm=W.forwardRef((e,t)=>p.jsx(yl.Provider,{scope:e.__scopeRovingFocusGroup,children:p.jsx(yl.Slot,{scope:e.__scopeRovingFocusGroup,children:p.jsx(fA,{...e,ref:t})})}));Bm.displayName=Oo;var fA=W.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,h=W.useRef(null),f=Ei(t,h),y=Mm(o),[m,v]=Ou({prop:s,defaultProp:a??null,onChange:l,caller:Oo}),[b,g]=W.useState(!1),w=oA(c),x=Lm(n),O=W.useRef(!1),[E,D]=W.useState(0);return W.useEffect(()=>{const N=h.current;if(N)return N.addEventListener(Ca,w),()=>N.removeEventListener(Ca,w)},[w]),p.jsx(cA,{scope:n,orientation:r,dir:y,loop:i,currentTabStopId:m,onItemFocus:W.useCallback(N=>v(N),[v]),onItemShiftTab:W.useCallback(()=>g(!0),[]),onFocusableItemAdd:W.useCallback(()=>D(N=>N+1),[]),onFocusableItemRemove:W.useCallback(()=>D(N=>N-1),[]),children:p.jsx(Hn.div,{tabIndex:b||E===0?-1:0,"data-orientation":r,...d,ref:f,style:{outline:"none",...e.style},onMouseDown:hn(e.onMouseDown,()=>{O.current=!0}),onFocus:hn(e.onFocus,N=>{const M=!O.current;if(N.target===N.currentTarget&&M&&!b){const R=new CustomEvent(Ca,aA);if(N.currentTarget.dispatchEvent(R),!R.defaultPrevented){const P=x().filter(se=>se.focusable),F=P.find(se=>se.active),U=P.find(se=>se.id===m),X=[F,U,...P].filter(Boolean).map(se=>se.ref.current);$m(X,u)}}O.current=!1}),onBlur:hn(e.onBlur,()=>g(!1))})})}),Vm="RovingFocusGroupItem",Um=W.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,children:s,...a}=e,l=Dm(),c=o||l,u=dA(Vm,n),d=u.currentTabStopId===c,h=Lm(n),{onFocusableItemAdd:f,onFocusableItemRemove:y,currentTabStopId:m}=u;return W.useEffect(()=>{if(r)return f(),()=>y()},[r,f,y]),p.jsx(yl.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:p.jsx(Hn.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:hn(e.onMouseDown,v=>{r?u.onItemFocus(c):v.preventDefault()}),onFocus:hn(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:hn(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){u.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const b=mA(v,u.orientation,u.dir);if(b!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let w=h().filter(x=>x.focusable).map(x=>x.ref.current);if(b==="last")w.reverse();else if(b==="prev"||b==="next"){b==="prev"&&w.reverse();const x=w.indexOf(v.currentTarget);w=u.loop?gA(w,x+1):w.slice(x+1)}setTimeout(()=>$m(w))}}),children:typeof s=="function"?s({isCurrentTabStop:d,hasTabStop:m!=null}):s})})});Um.displayName=Vm;var pA={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function hA(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function mA(e,t,n){const r=hA(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return pA[r]}function $m(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function gA(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var yA=Bm,vA=Um,$s="Tabs",[wA,WA]=Vs($s,[jm]),qm=jm(),[bA,Pu]=wA($s),zm=W.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=Mm(a),[d,h]=Ou({prop:r,onChange:i,defaultProp:o??"",caller:$s});return p.jsx(bA,{scope:n,baseId:Dm(),value:d,onValueChange:h,orientation:s,dir:u,activationMode:l,children:p.jsx(Hn.div,{dir:u,"data-orientation":s,...c,ref:t})})});zm.displayName=$s;var Km="TabsList",Hm=W.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=Pu(Km,n),s=qm(n);return p.jsx(yA,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:p.jsx(Hn.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});Hm.displayName=Km;var Jm="TabsTrigger",Wm=W.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=Pu(Jm,n),a=qm(n),l=Gm(s.baseId,r),c=Xm(s.baseId,r),u=r===s.value;return p.jsx(vA,{asChild:!0,...a,focusable:!i,active:u,children:p.jsx(Hn.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...o,ref:t,onMouseDown:hn(e.onMouseDown,d=>{!i&&d.button===0&&d.ctrlKey===!1?s.onValueChange(r):d.preventDefault()}),onKeyDown:hn(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(r)}),onFocus:hn(e.onFocus,()=>{const d=s.activationMode!=="manual";!u&&!i&&d&&s.onValueChange(r)})})})});Wm.displayName=Jm;var Qm="TabsContent",xA=W.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,a=Pu(Qm,n),l=Gm(a.baseId,r),c=Xm(a.baseId,r),u=r===a.value,d=W.useRef(u);return W.useEffect(()=>{const h=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(h)},[]),p.jsx(Eu,{present:i||u,children:({present:h})=>p.jsx(Hn.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:c,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:h&&o})})});xA.displayName=Qm;function Gm(e,t){return`${e}-trigger-${t}`}function Xm(e,t){return`${e}-content-${t}`}var IA=zm,CA=Hm,Ym=Wm;const SA=p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[p.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),p.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function OA(e,t){return t?C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},C.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?SA:p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:p.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}function EA(){return p.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[p.jsx("path",{d:"M8 11C9.65685 11 11 9.65685 11 8C11 6.34315 9.65685 5 8 5C6.34315 5 5 6.34315 5 8C5 9.65685 6.34315 11 8 11Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),p.jsx("path",{d:"M12.3378 5.04365C12.4882 5.25907 12.62 5.48699 12.7315 5.7249L14.3503 6.6249C14.5524 7.5302 14.5545 8.4687 14.3565 9.3749L12.7315 10.2749C12.62 10.5128 12.4882 10.7407 12.3378 10.9562L12.369 12.8124C11.683 13.4375 10.871 13.9085 9.98776 14.1937L8.39401 13.2374C8.13185 13.2562 7.86868 13.2562 7.60651 13.2374L6.01901 14.1874C5.13295 13.9075 4.31832 13.4383 3.63151 12.8124L3.66276 10.9624C3.51356 10.744 3.38189 10.5141 3.26901 10.2749L1.65026 9.3749C1.44814 8.46961 1.446 7.53111 1.64401 6.6249L3.26901 5.7249C3.38056 5.48699 3.5123 5.25907 3.66276 5.04365L3.63151 3.1874C4.31754 2.56226 5.1295 2.09128 6.01276 1.80615L7.60651 2.7624C7.86868 2.74365 8.13185 2.74365 8.39401 2.7624L9.98151 1.8124C10.8676 2.09234 11.6822 2.5615 12.369 3.1874L12.3378 5.04365Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const _A="_tabsRoot_ktpr0_1",TA="_tabsList_ktpr0_6",NA="_tabTrigger_ktpr0_12",xs={tabsRoot:_A,tabsList:TA,tabTrigger:NA};function kA(){return p.jsxs(p.Fragment,{children:[p.jsx(Ls,{style:{margin:"1rem 0"}}),p.jsx(Ym,{value:ds,className:xs.tabTrigger,children:p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[p.jsx(EA,{}),p.jsx("span",{children:"Manage"})]})})]})}function Zm({objectName:e,completed:t,pending:n,displayName:r,disabled:i}){return p.jsx(Ym,{value:e,className:xs.tabTrigger,children:p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[OA(!i&&t,n),p.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[p.jsx("span",{children:r||e}),n&&p.jsx("span",{style:{fontSize:".8rem",fontStyle:"italic"},children:"pending"})]})]})})}function AA({completed:e,pending:t,displayName:n}){return p.jsxs(p.Fragment,{children:[p.jsx(Ls,{style:{margin:"1rem 0"}}),p.jsx(Zm,{objectName:wi,completed:e,pending:t,displayName:n},"other-write")]})}function RA({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:i}){var u,d,h,f;const{data:o}=Jf(),{installation:s}=Jr(),a=s==null?void 0:s.config,l=(d=(u=a==null?void 0:a.content)==null?void 0:u.write)==null?void 0:d.objects,c=(f=(h=r==null?void 0:r.other)==null?void 0:h.write)==null?void 0:f.selectedWriteObjects;return p.jsx(IA,{value:e,className:xs.tabsRoot,onValueChange:n,children:p.jsxs(CA,{className:xs.tabsList,children:[t.map(y=>{var P,F,U,B,X,se;const m=(U=(F=(P=a==null?void 0:a.content)==null?void 0:P.read)==null?void 0:F.objects)==null?void 0:U[y.name],v=r==null?void 0:r[y.name],b=Op(a,y.name),g=(B=v==null?void 0:v.read)==null?void 0:B.selectedFieldMappings,w=!gp(b,g),x=o?Pl(a,o,y.name):void 0,O=(X=v==null?void 0:v.read)==null?void 0:X.selectedOptionalFields,E=!mp(x,O),D=m==null?void 0:m.selectedValueMappings,N=(se=v==null?void 0:v.read)==null?void 0:se.selectedValueMappings,M=!yp(D,N),R=E||w||M||!1;return p.jsx(Zm,{objectName:y.name,displayName:y.displayName,completed:y.completed,disabled:y.disabled,pending:R},y.name)}),i&&(()=>{const y=!vp(l||{},c||{});return p.jsx(AA,{completed:i.completed,pending:y,displayName:"Write"})})(),p.jsx(kA,{})]})})}function PA(e,t){return t===ds?{name:ds,completed:!1}:e.find(n=>n.name===t)}function FA({children:e}){var b;const{data:t}=gr(),{installation:n}=St(),{providerName:r}=Ot(),{hydratedRevision:i}=Mi(),{objectConfigurationsState:o}=ou(),[s,a]=C.useState(""),l=(t==null?void 0:t.appName)||"",c=n==null?void 0:n.config,u=i&&fp(c,i),d=u!==null,h=!!((b=i==null?void 0:i.content)!=null&&b.write),f=h?pp(c):void 0,y=C.useMemo(()=>{const g=[...u||[]];return f&&h&&g.push(f),g},[u,f,h]),m=PA(y,s),v=C.useCallback(()=>{const g=y.find(w=>m!==w&&!w.completed);g&&a(g.name)},[y,m]);return C.useEffect(()=>{!s&&y.length>0&&a(y[0].name)},[y,s,v]),p.jsx(Ph.Provider,{value:v,children:p.jsx(Ah.Provider,{value:m==null?void 0:m.name,children:p.jsxs(Ai,{style:{maxWidth:"55rem"},children:[p.jsxs(Kn,{style:{display:"flex",gap:"1rem",padding:"3rem",paddingBottom:"6rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[p.jsxs("div",{style:{width:"20rem"},children:[p.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[r," integration"]}),p.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:l}),d&&p.jsx(RA,{value:s,readNavObjects:u,onValueChange:g=>a(g),objectConfigurationsState:o,writeNavObject:f})]}),e]}),p.jsx(Ap,{})]})})})}function DA({...e}){return p.jsx(FA,{...e})}const MA="_resetContainer_lkwv9_4",eg={resetContainer:MA},LA=({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:l})=>{var v;const{projectIdOrName:c,isLoading:u}=gr(),{isLoading:d}=Es(),{isError:h,errorState:f}=An(),{seed:y,reset:m}=lp();return u||d?p.jsx(Ri,{}):h(Ee.PROJECT,c)?p.jsx(Vt,{message:`Error loading project ${c}`}):h(Ee.INTEGRATION_LIST,c)?p.jsx(Vt,{message:"Error retrieving integrations for the project, double check the API key"}):(v=f[Ee.INTEGRATION_LIST])!=null&&v.apiError?p.jsx(Vt,{message:"Something went wrong, couldn't find integration information"}):p.jsx("div",{className:eg.resetContainer,children:p.jsx(zI,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:l,resetComponent:m,children:p.jsx(ip,{children:p.jsx(Fm,{consumerRef:t,consumerName:n,groupRef:r,groupName:i,resetComponent:m,children:p.jsx(P_,{resetComponent:m,children:p.jsx(Pk,{children:p.jsx(M_,{children:p.jsx(DA,{children:p.jsx(Nk,{})})})})})})})},y)})};function jA({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:l}){const c={integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:l};return p.jsx(Au,{fallback:p.jsx(Vt,{message:"Something went wrong, couldn't find integration information"}),children:p.jsx(kl,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:p.jsx(LA,{...c})})})}function BA(){return p.jsxs(Ai,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[p.jsx(io,{}),p.jsx("p",{children:"Redirecting"})]})}function VA({redirectURL:e,children:t}){return C.useEffect(()=>{e&&window.location.replace(e)},[e]),e?p.jsx(BA,{}):t}function UA({resetComponent:e,onDisconnectSuccess:t,provider:n}){const[r,i]=C.useState(!1);return p.jsxs(p.Fragment,{children:[r===!1&&p.jsxs(p.Fragment,{children:[p.jsx(Gt,{string:"Manage connection"}),p.jsxs("div",{style:{padding:"1rem 0",width:"100%",display:"flex",flexDirection:"column",gap:"1rem"},children:[p.jsx("p",{children:"Click to reauthenticate or refresh your connection."}),p.jsx(ot,{type:"button",onClick:()=>i(!0),variant:"ghost",style:{fontSize:"13px"},children:"Update connection"})]})]}),r===!0&&p.jsxs(p.Fragment,{children:[p.jsx(ru,{provider:n}),p.jsx(Am,{resetComponent:e,onDisconnectSuccess:t})]})]})}function $A({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=gr(),{providerName:i}=Ot(e),o=`You have successfully connected your ${i} account to ${r}.`;return p.jsx(Ru,{text:o,children:p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"},children:p.jsx(UA,{resetComponent:n,onDisconnectSuccess:t,provider:e})})})}function qA({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,redirectUrl:o,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:l}){const{seed:c,reset:u}=lp(),d=C.useCallback(h=>{s?s(h.id):l&&l(h)},[s,l]);return p.jsx(Au,{fallback:p.jsx(Vt,{message:"Something went wrong with the connection. Please try again."}),children:p.jsx("div",{className:eg.resetContainer,children:p.jsx(kl,{integration:"connect-provider-dummy-string",consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:p.jsx(ip,{groupRef:r,provider:e,children:p.jsx(Fm,{resetComponent:u,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onSuccess:d,onDisconnectSuccess:a,children:p.jsx(VA,{redirectURL:o,children:p.jsx($A,{resetComponent:u,provider:e,onDisconnectSuccess:a})})})})})},c)})}const zA=(e,t)=>{const{data:n,isLoading:r,isError:i,error:o}=_l(e,t),s=((n==null?void 0:n.length)||0)>0,a=!!n&&!r,l=n==null?void 0:n[0],c=l==null?void 0:l.config;return C.useEffect(()=>{i&&it(o)},[i,o]),{isLoaded:a,isIntegrationInstalled:s,isLoading:r,config:c}};exports.AmpersandContext=Sl;exports.AmpersandErrorBoundary=Au;exports.AmpersandProvider=sI;exports.ConnectProvider=qA;exports.FieldSettingWriteOnCreateEnum=xy;exports.FieldSettingWriteOnUpdateEnum=Iy;exports.InstallIntegration=jA;exports.InstallationProvider=kl;exports.useAmpersandProviderProps=Ze;exports.useConfig=II;exports.useConnection=Tl;exports.useCreateInstallation=sp;exports.useDeleteInstallation=QI;exports.useInstallation=Jr;exports.useIsIntegrationInstalled=zA;exports.useLocalConfig=xI;exports.useManifest=_s;exports.useUpdateInstallation=ap;
52
65
  //# sourceMappingURL=amp-react.cjs.js.map